If I try to define boxes for Power[x,-1]
like this,
MakeBoxes[Power[x, -1], TraditionalForm] := "matched";
it works as long as the coefficient is 1:
1/x // TraditionalForm
$\text{matched}$
But, for other coefficients it doesn't work, for example:
2/x // TraditionalForm
$\frac{2}{x}$
But why? After all, FullForm[2/x]
returns Times[2,Power[x,-1]]
, which does contain Power[x,-1]
for which the MakeBoxes
definition was given. But why doesn't it work?
What is the proper way to define boxes for such expressions?
TraditionalForm[2/x]
, I expected "$2\,\text{matched}$" as the output. $\endgroup$ – QuantumDot Sep 3 '16 at 1:37