# How to improve the typesetting of mathematical contents

Until I started diving into Mathematica, I was not using much computer software for symbolic computation. I did my analysis by hand on blank sheets, the calculations using Python or MATLAB, and the computer typesetting and presentations using LaTeX.

Mathematica could be (at least) a great supplement to each of these steps. However, I am frustrated by Mathematica's rendering of mathematical notation.

I got Mathematica (8 on Mac OS X) to automatically display unreadable variable names in a nicer mathematical notation, but the output in notebooks is quite bad:

I take as reference the equivalent in LaTeX:

• I have difficulties to distinguish the Overbar of Mathematica from what is under, as it is often too close to the letters.
• I find the monospace font inappropriate. The letters are too thick (they are not bold, but still disproportionately thick compared to lines in other mathematical elements, as seem in this screenshot). Or maybe it is the decorations and non-literal elements (integral sign, sqrt, overbars and fractions, brackets) that are not thick enough in comparison (particularly when increasing the font size, as seen in the linked example).
• The spacing between tokens and symbols is unnaturally large, while it is slightly insufficient between two separate symbols (e.g., spacing between a and b in a b as compared to ab).
• Also, maybe function names could benefit from having a slightly different style, although I am not certain of that.
• The default font size is too small, but increasing the font size sufficiently to compensate for the poor typesetting makes information take more place than acceptable on the screen.

The official documentation on Math typesetting boasts Mathematica's "world most sophisticated tech", but it doesn't explain much about how to automatically adjust spacing or the fonts used.

Is there another typesetting guide I'm missing? Maybe downloadable stylesheets that redefine spacings and make use of Computer Modern or other high quality fonts? I would not have time to write my own stylesheet, I have no idea how to even begin, so a ready-made one would be preferable.

EDIT in response to answers: Here is an example of TraditionalForm side-by-side with the equivalent LaTeX output. There are clearly some differences in spacing, not all bad. The LaTeX version is more crowded around the fraction bar, while the Mathematica version is a bit too tight between the integral sign and its upper limit. Operators like $+$ are a bit smaller in the Mathematica version, too.

-
The monospace input is bold. The output is not by default, if you want the comparison. –  David Jan 31 '12 at 17:16
Indeed. I probably failed at clearly explaining my point there, thanks for telling it to me. What I mean is that, in the output, the font weight is not balanced between letters/numbers and non-letters involving lines. I update the question to better show what I mean. (cf. this screenshot of a zoomed Mathematica output) –  agravier Jan 31 '12 at 17:21
TraditionalForm is what you need. –  faleichik Jan 31 '12 at 17:22
@agravier you could try MakeBoxes[OverBar[x_], TraditionalForm] := OverscriptBox[#, "_", DiacriticalPositioning -> False] &[ MakeBoxes[x, TraditionalForm]] –  Rojo Jan 31 '12 at 17:45
@agravier Regarding your use of underscore, the reason that it is too close to the letters is because underscore by itself is set at the baseline, which doesn't leave much space. Try replacing it with \[HorizontalLine] or Esc-hline-Esc in your MakeBoxes[...]:= line. If that is satisfactory, I can edit it into my answer. –  rm -rf Feb 1 '12 at 7:06

To format all your output expressions as TraditionalForm, you can set the $Post variable as: $Post = TraditionalForm


Here's how it would look:

To clear the definition for $Post (if you need to), just evaluate $Post =. You can add this to your init.m if you'd like to make this apply to all notebooks henceforth, but I wouldn't suggest doing that.

-
Thanks you @RM :) It seems that you have given the same answer in spirit as Arnoud, at the same time, but your way is more low-level, more Unixy. I am torn. Meta-question: how is one supposed to accept an answer when several good answers are present? –  agravier Jan 31 '12 at 18:16
Thanks @RM. I accept yours because I'm more of a command-line type of guy and I like to understand the internals like \$Post –  agravier Jan 31 '12 at 18:59
Open the Edit -> Preferences menu and try setting the following:
Great! Thank you TraditionalForm is indeed solving most of my issues. For the first point in my question, the OverBars being too close to the letters, I think it comes from the type of definition I am using: MakeBoxes[Pmbar, form_] := InterpretationBox[OverscriptBox["Pm", "_"], Pmbar];... Would you happen to also have a workaround for that :) ? –  agravier Jan 31 '12 at 18:09