Prev: how to tell Mathematica to display x^-1 as x^-1 and not as 1/x
Next: how to tell Mathematica to display x^-1 as x^-1 and not as
From: Carlos César de Araújo on 4 Jul 2010 03:09 Nasser, >Is there a way to tell Mathematica to >*display* terms with negative >powers as x^-n and not as 1/x^n ? There are many things that you will have to consider, but here goes a start: MakeBoxes[Power[x_, y_?(NumberQ[#] && Negative[#] &)], TraditionalForm] := SuperscriptBox[MakeBoxes[x, TraditionalForm], MakeBoxes[y, TraditionalForm]] MakeBoxes[Times[c_, p : Power[x_, y_?(NumberQ[#] && Negative[#] &)]], TraditionalForm] := If[OrderedQ[{c, p}], RowBox[{MakeBoxes[c, TraditionalForm], MakeBoxes[p, TraditionalForm]}], RowBox[{MakeBoxes[p, TraditionalForm], MakeBoxes[c, TraditionalForm]}]] There are other solutions (for example, TemplateBox, about which I posted some information elsewhere). Carlos César de Araújo Gregos & Troianos Educacional www.gregosetroianos.mat.br Belo Horizonte, MG, Brasil (31) 3283-1122 |