Typography messed up in prints

10

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]

David

Posted 2012-01-26T16:35:05.687

Reputation: 14 421

1Have you tried exporting (Saving As from the File manu) to PDF? It gives fine results here. – Szabolcs – 2012-01-26T16:42:02.987

Yes, I tried that. (And two different PDF printers.) – David – 2012-01-26T16:44:25.937

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 – 2012-01-26T17:02:40.130

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 – 2012-01-26T22:53:31.997

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 – 2012-01-27T13:01:44.147

I used 8.0.0.0 before, now I've upgraded to 8.0.4.0 and the problem's still there. – David – 2012-01-27T17:20:43.843

Answers

1

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

David

Posted 2012-01-26T16:35:05.687

Reputation: 14 421

5

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?

F'x

Posted 2012-01-26T16:35:05.687

Reputation: 10 517

3

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}]

Mr.Wizard

Posted 2012-01-26T16:35:05.687

Reputation: 259 163

3Thanks, 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 – 2012-01-26T17:00:50.230

3

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.

Mike Honeychurch

Posted 2012-01-26T16:35:05.687

Reputation: 36 211

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 – 2012-01-27T17:20:35.717