Take the 2-minute tour ×

For a long time now I've had trouble printing Mathematica files. While the .nb itself displays just fine on my screen, the kerning is awful when printed.


enter image description here


enter image description here

And in case you thought that's not too bad, here's a picture of a longer passage:

enter image description here

  • The stylesheet I use is just a slightly modified version of the default stylesheet (which experiences the same problems)
  • If it's any help, I'm on Mathematica, Ubuntu 11.04.
  • Code sections are printed correctly! The error occurs for pretty much everything else, including plot labels, ...
  • If you want to see the horror for yourself, I've uploaded a nb (using the default stylesheet) and a few prints: [tgz] [zip]
share|improve this question
Have you tried exporting (Saving As from the File manu) to PDF? It gives fine results here. –  Szabolcs Jan 26 '12 at 16:42
Yes, I tried that. (And two different PDF printers.) –  David Jan 26 '12 at 16:44
So your screenshot is of a PDF saved (not printed) from Mathematica, and displays like this regardless of the PDF viewer used? It's probably Linux specific then. Since we can't seem to reproduce the problem, can you upload a sample input notebook and the output PDF you get, and link to them? –  Szabolcs Jan 26 '12 at 17:02
It prints fine my machine, Mma 8.0.4, Ubunto 11.10. So it is either in your Mma global configuration (not distributed with the nb) or in your printing setup... Try backing up your $BaseDirectory and $UserBaseDirectory then making a clean start. –  Simon Jan 26 '12 at 22:53
I can reproduce the problem on Ubuntu 11.10 when doing File -> Save As ... -> PDF. Mma 8.0.1. Which version do you have, David? Simon says it works in 8.0.4. –  Szabolcs Jan 27 '12 at 13:01
show 1 more comment

4 Answers

First, I cannot reproduce your issue on Mathematica on 64-bit Linux (CentOS 5.8). But I compare what you obtain and what I see, and I think I have an idea.

  1. The notebook does not specifically require fonts, and as such, the font for e.g. your title cell is system-dependent. On my Mac, it uses a bold Helvetica in size 36, while on my Linux box it substitutes it by a Nimbus Sans L. As the latter is a free Helvetica substitute, it works fine even though it does not strictly have the same metrics. When exported to PDF, the font used is "Helvetica-Bold", which is not embedded because it's a standard PDF font.

  2. In your case, the display font substitution is what is going wrong. Compare your display (top) and print (bottom) versions:

    enter image description here
    enter image description here

    You can see the display font is not a good substitute for Helvetica: the characters are different (see the endings of the s and a) and it's definitely wider. I suspect this difference in metrics is where the awful character positioning is coming from.

  3. So, why is your display font not Helvetica or a substitute? If you have a decent substitute installed, I don't know why Mathematica isn't using it, but font handling in X11 is a hairy topic. Maybe you'll get better results at debugging this on AskUbuntu.

  4. And what can you do to fix it? Well, if it's a problem of fonts missing from you system, try installing Freefont if you haven't already (package ttf-freefont), or MS Core fonts (package ttf-mscorefonts-installer). If it's an X11 issue, then I'm afraid I can't help more…

Edit. I actually have another suggestion for a workaround: have you tried other fonts on your system (non-default fonts) to see if it works better?

share|improve this answer
add comment

Please try setting menu File > Print Settings > Printing Environment to Working and report if the behavior changes at all.

Please also try each of these settings and report any effect:


 PrivateFontOptions -> {"WindowsUseTrueTypeNames" -> False}]

 FontProperties -> {"FontMonospaced" -> False}]
share|improve this answer
Thanks, but nothing changed; the letter distances are still wrong. (Even in the same places, i.e. the "wrongness" is identical. The general font size and coloring changed as expected for the working print environment.) –  David Jan 26 '12 at 17:00
add comment

It looks like something screwy on your system rather than anything specific to your notebook or stylesheet (I downloaded and everything was fine on my Mac). You could try explicitly setting the FontTracking at various levels, Global, Notebook, Cell etc. and see if that helps.

SetOptions[EvaluationNotebook[], FontTracking -> "Condensed"]

SetOptions[EvaluationNotebook[], FontTracking -> "Compressed"]

etc. If you find something that works then add it to your Printout style.

share|improve this answer
That moved the letters closer together at least, but the spacing is still very irregular (i.e. seemingly random letter spacing changes inside words). :-( –  David Jan 27 '12 at 17:20
add comment
up vote 1 down vote accepted

Mathematica 9 came out last week, and the problem is less bad (but not gone) in the default stylesheet. As a solution to the initial problem it's not very satisfying, but in practical terms I got a stochastic differential equation solver as a bonus feature to being able to generate half-decent prints. I'll update this answer in case I find out more.

(Thanks again for the answers though.)

share|improve this answer
add comment

Your Answer


