Let's say I have a sample formula, for example (Abs[x]/(-(2 - \[Kappa]) - 5))/(Binomial[a, b]/4) or something like that. I can of course typeset it to a limited degree and with not necessarily nice results:

enter image description here

It is so small that this x is barely distinguishable from this kappa, and I can't typeset Abs or Binomial.

So I use TraditionalForm and I get this:

enter image description here

This is certainly much nicer. But my formula got rearranged heavily. Yes, I have to admit it, it looks much prettier this way in that particular case (sometimes TraditionalForm actually makes formulae less clear), but this is not what I wanted to achieve. I wanted my formula to be displayed in LaTeX quality exactly as I typed it!

So I add a HoldForm just to get this:

enter image description here

Phew. And they call THIS a "held form".

I can get what I want if I also enter a HoldForm in the middle of the formula in the right place:

enter image description here

But in more complex examples I have to spam those HoldForms obnoxiously, which is annoying. Also having HoldForms in the middle of formulae can get annoying, since this will affect evaluation.

How to stop this rearranging? Isn't there anything like, say, TraditionalForm[StopRearranging[formula]]?

  • $\begingroup$ reference.wolfram.com/language/tutorial/… and reference.wolfram.com/language/guide/… may be helpful. $\endgroup$
    – DavidC
    Feb 13, 2015 at 21:07
  • 2
    $\begingroup$ Are you typing your formulas in an input cell? None of this would happen if you were using one of the cell styles that are meant for that purpose, like DisplayFormula. So you should perhaps clarify what you really want to do with the typed formulas eventually: i.e., use them only for display or do other calculations with them. $\endgroup$
    – Jens
    Feb 13, 2015 at 22:59
  • $\begingroup$ You might want to apply TraditionalForm at single parts of your formula. Highlight Abs[x] and use CTRL+SHIFT+T, then highlight Binomial[a,b] and do the same. Highlight the whole formula and type CTRL+B to remove the bold style. Is this what you are after? (This will work if you use TraditionalForm as default Input method, otherwise you'll have to use Cell Display As... Traditional Form to convert it without touching it). $\endgroup$
    – Peltio
    Feb 14, 2015 at 3:27
  • $\begingroup$ @Jens Checked this. Typed the formula in a DisplayFormula cell. Right-clicked and selected Convert to -> TraditionalForm. The formula still got re-arranged. $\endgroup$
    – gaazkam
    Feb 14, 2015 at 14:07
  • $\begingroup$ The point is that the DisplayFormula Cell is already in TraditionalForm. You don't need to convert anything. $\endgroup$
    – Jens
    Feb 14, 2015 at 16:29

3 Answers 3



It's worth examining how your original expression was rendered in TraditionalForm, even though it was not just what you wanted.

exp = (Abs[x]/(-(2 - \[Kappa]) - 5))/(Binomial[a, b]/4) // TraditionalForm


Let's look at the underlying structure:

tagExp = ToBoxes[exp]

TagBox[FormBox[ FractionBox[RowBox[{"4", " ", TemplateBox[{"x"}, "Abs"]}], RowBox[{RowBox[{"(", RowBox[{"[Kappa]", "-", "7"}], ")"}], " ", TemplateBox[{"a", "b"}, "Binomial"]}]], TraditionalForm], TraditionalForm, Editable -> True]

Let's invert the process to check whether this code will result in the rendering we began with:



And now we get a treeform display of the structure:

tagExp // TreeForm


You may be able to tweak the TagBox coding to obtain what you are looking for.

Here's a somewhat simpler, seat-of-the-pants approach. I'm not sure this is an improvement on what you came up with. But, here goes.

For this FractionBox seems to be the place to start. But in other circumstances other formatting boxes (StyleBox, SuperscriptBox, SubscriptBox, etc.) may be required.

The general structure of your problem is

FractionBox["top", "bottom"] // DisplayForm


Once you realize this, you can move ahead to deal with the top and bottom (or numerator and denominator, if you prefer).

Yes, you might have formatted this as a simple fraction using /. But this is a live operator that could give you trouble as you move forward. FractionBox is your outermost frame, so to speak.

Let' s begin with the bottom, since that seems more straightforward.

bottom = Binomial[a, b]/4 // TraditionalForm


Let's put the bottom into the FractionBox structure:

FractionBox["top", bottom] // DisplayForm


The top itself can be put into its own FractionBox. Like you, I had to use HoldForm to accomplish this.

top = FractionBox[Abs[x] // TraditionalForm, HoldForm[(-(2 - \[Kappa]) - 5)]] // DisplayForm


Let's now insert the top into the outermost FractionBox

FractionBox[top, bottom] // DisplayForm


If that's too small, wrap it in Style:

Style[FractionBox[top, bottom], 24] // DisplayForm


StyleBox will produce the same effect. And it may actually be more appropriate here.

StyleBox[FractionBox[top, bottom], 24] // DisplayForm

Firstly to address the start of the question in which you didn't like how small everything was. This can be fixed quite simply by changing an option to FractionBox

FractionBoxOptions -> {AllowScriptLevelChange -> False}

Normally you would set this as part of a style sheet for Input style or you could set it at the cell level using the options inspector. To see it in use I am setting it for the entire notebook as per the animated gif below:

enter image description here

For the second part of your question, to stop your reordering you can wrap stuff in PolynomialForm and set the option TraditionalOrder to False. You can still use TraditionalForm so that you get traditional typesetting of the binomial but the problem with this approach is that it only stops reordering of the final rearranged expression. You need to intervene before the fractions boxes get rearranged ...which is what you have discovered by using HoldForm.

 PolynomialForm[(Abs[x]/(-(2 - \[Kappa]) - 5))/(Binomial[a, b]/4), 
  TraditionalOrder -> False]

enter image description here

Notwithstanding that there are styles that facilitate this type of typesetting, if you want to do it in an Input cell then just highlight the bits that you want to look traditional and convert those.

enter image description here

Note that syntax styling is switched off for traditional form (which is why x, a, and b are not pink) but you can set it on via the options settings.


From the comments I infer that you are indeed interested only in typesetting formulas and displaying the in TraditionalForm. If you enter the equation in an inline cell, it will be in TraditionalForm. On the other hand, DisplayFormula cells need to be converted to TraditionalForm before you start typing (assuming that you work with the default stylesheet).

Once you are in a cell that displays in TraditionalForm, the issue is how to enter things like Abs[x] and Binomial[a,b] so that they display properly. This is indeed not as convenient as it should be (compared to $\LaTeX$). Specifically for the binomial, I had posted a solution in this answer.

For the Abs function, you could simply use the Basic Math palette.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.