Consider this:
Inactivate[3*5 - 2 - 3] // FullForm
Inactive[Plus][Inactive[Times][3, 5], -2, -3]
RunnyKine is correct regarding the cause but he did not really explain the mechanism involved. Formatting rules typically apply to (sub)expressions with certain heads. This has nothing to do with evaluation per se, but rather the patterns in the transformation rules of MakeBoxes
.
In this example the formatting rules for Times
are still applied despite HoldComplete
:
HoldComplete[Times[x, y]] // TraditionalForm
HoldComplete[x y]
Another example and further explanation can be seen in my answer to:
- Returning an unevaluated expression with values substituted inReturning an unevaluated expression with values substituted in
Simply put Inactive[Times]
does not match the patterns used by MakeBoxes
for pretty formatting. However we can easily add our own rules. If you wish to have expressions produced by Inactivate
formatted as the normal form of the expression (without evaluation) you may use:
MakeBoxes[p : Inactive[h_][args___], form_] :=
MakeBoxes[Interpretation[HoldForm @ h[args], p], form]
Now the expression is formatted using the normal rules for Times
and Plus
:
Without the definition this is printed without the nice formatting: