16
$\begingroup$

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:

Mathematica typesetting

I take as reference the equivalent in LaTeX:

LaTeX typesetting

  • 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. enter image description here

$\endgroup$
11
  • $\begingroup$ The monospace input is bold. The output is not by default, if you want the comparison. $\endgroup$
    – David
    Commented Jan 31, 2012 at 17:16
  • $\begingroup$ 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) $\endgroup$
    – agravier
    Commented Jan 31, 2012 at 17:21
  • 1
    $\begingroup$ TraditionalForm is what you need. $\endgroup$
    – faleichik
    Commented Jan 31, 2012 at 17:22
  • 3
    $\begingroup$ @agravier you could try MakeBoxes[OverBar[x_], TraditionalForm] := OverscriptBox[#, "_", DiacriticalPositioning -> False] &[ MakeBoxes[x, TraditionalForm]] $\endgroup$
    – Rojo
    Commented Jan 31, 2012 at 17:45
  • 2
    $\begingroup$ @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. $\endgroup$
    – rm -rf
    Commented Feb 1, 2012 at 7:06

2 Answers 2

16
$\begingroup$

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

$Post = TraditionalForm;

Here's how it would look:

Sin[x]/Cos[x + y]^3 + Integrate[Log[x], {x, 1, 2}] // HoldForm

Imagem1

Without HoldForm:

Sin[x]/Cos[x + y]^3 + Integrate[Log[x], {x, 1, 2}]

Imagem2

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.

$\endgroup$
2
  • $\begingroup$ 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? $\endgroup$
    – agravier
    Commented Jan 31, 2012 at 18:16
  • $\begingroup$ 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 $\endgroup$
    – agravier
    Commented Jan 31, 2012 at 18:59
15
$\begingroup$

Open the Edit -> Preferences menu and try setting the following:

enter image description here

$\endgroup$
3
  • $\begingroup$ 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 :) ? $\endgroup$
    – agravier
    Commented Jan 31, 2012 at 18:09
  • $\begingroup$ What @Rojo is suggesting in the comments above (DiacriticalPositioning -> False) seems to work well. Is this not what you are looking for? $\endgroup$ Commented Jan 31, 2012 at 18:46
  • $\begingroup$ It is :) -- All these answers are good, my question about the MakeBoxes thing is actually off-topic and I should ask it separately. $\endgroup$
    – agravier
    Commented Jan 31, 2012 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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