MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Overriding Division Notation

  • To: mathgroup at
  • Subject: [mg26582] Re: Overriding Division Notation
  • From: "Ersek, Ted R" <ErsekTR at>
  • Date: Tue, 9 Jan 2001 01:51:56 -0500 (EST)
  • Sender: owner-wri-mathgroup at

Jeff Hesh wanted to make  a/b  display as  

a b^-1  instead of  -

I assume he also wants to use parentheses when appropriate as in 
   a/(b+c)   should display as   a (b+c)^-1 
A few extra rules are needed to get the parentheses right. 
The following code should do the trick.


MakeBoxes[(a_Plus) (b_Plus)^-1,form_]:=
   SuperscriptBox[ RowBox[{"(",MakeBoxes[b,form],")"}], "-1"]

MakeBoxes[(a_Plus)  b_^-1,form_]:=
   SuperscriptBox[ RowBox[{MakeBoxes[b,form]}], "-1"]

MakeBoxes[a_ (b_Plus)^-1,form_]:=
 RowBox[{MakeBoxes[a,form]," ",

MakeBoxes[a_ b_^-1,form_]:=
 RowBox[{MakeBoxes[a,form]," ",


To understand how this works look up MakeBoxes at my website.

Ted Ersek

Download Mathematica tips, tricks from

  • Prev by Date: Re: Overriding Division Notation
  • Next by Date: worldplot GIF
  • Previous by thread: Re: Overriding Division Notation
  • Next by thread: plain text