10
$\begingroup$

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.

Screen:

enter image description here

Print:

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 8.0.4.0, 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]
$\endgroup$
6
  • 1
    $\begingroup$ Have you tried exporting (Saving As from the File manu) to PDF? It gives fine results here. $\endgroup$
    – Szabolcs
    Commented Jan 26, 2012 at 16:42
  • $\begingroup$ Yes, I tried that. (And two different PDF printers.) $\endgroup$
    – David
    Commented Jan 26, 2012 at 16:44
  • $\begingroup$ 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? $\endgroup$
    – Szabolcs
    Commented Jan 26, 2012 at 17:02
  • $\begingroup$ 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. $\endgroup$
    – Simon
    Commented Jan 26, 2012 at 22:53
  • $\begingroup$ 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. $\endgroup$
    – Szabolcs
    Commented Jan 27, 2012 at 13:01

4 Answers 4

5
$\begingroup$

First, I cannot reproduce your issue on Mathematica 8.0.1.0 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?

$\endgroup$
3
$\begingroup$

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:

SetOptions[$FrontEndSession,
 PrivateFontOptions -> {"FontType" -> "Outline"}]

SetOptions[$FrontEndSession,
 PrivateFontOptions -> {"WindowsUseTrueTypeNames" -> False}]

SetOptions[$FrontEndSession,
 FontProperties -> {"FontMonospaced" -> False}]
$\endgroup$
1
  • 3
    $\begingroup$ 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.) $\endgroup$
    – David
    Commented Jan 26, 2012 at 17:00
3
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ That moved the letters closer together at least, but the spacing is still very irregular (i.e. seemingly random letter spacing changes inside words). :-( $\endgroup$
    – David
    Commented Jan 27, 2012 at 17:20
1
$\begingroup$

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.)

$\endgroup$

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.