nmg: (dead mac)
[personal profile] nmg

Since moving to a Mac a bit over a year ago, I've had only a few reasons to look back (the business with the HP LJ1022 printer being one of them). I'm now rather close to the end of my tether, and the reason is fonts.

As an academic and a computer scientist, I end up writing quite a lot of papers and presentations with maths in them. Like any sensible person, I use LaTeX for typesetting the maths; it's a lot easier to type $\sum_{i=0}^{i=n-1} i^2$ than to wrestle with the equation editor in Word. I've also been using LaTeX for rendering mathematical expressions in lecture slides; there are two tools - LaTeXit and LaTeX Equation Editor - which make putting maths in Powerpoint or KeyNote a drag-and-drop operation.

However, I've spent quite a lot of time over the last week trying to debug a problem with the font rendering of TeX-generated PDF files on OS X. If I wrote a LaTeX file containing the following:

\documentclass{article}
\begin{document}
\section{This is a test}
\[e = mc^2 \rightarrow \chi \pi \ldots r^2 \]
\end{document}

then I'd expect it to render something like this:

Preview renders it like that, but not reliably - perhaps one time in eight. The rest of the time, it randomly substitutes a sans serif font for the various Computer Modern fonts. Sometimes it looks like this (missing the italic font):

Sometimes it looks like this (missing the bold and italic fonts):

And sometimes it looks like this (missing the bold and symbol fonts):

It isn't predictable which rendering I get. The problem also isn't limited to CM, but appears whenever you have a subset of a Type1 font embedded in PDF (on my machine, at least); TeX isn't the problem. The problem didn't exist on 10.4. The best guess from the Mac communities is that it's a cache corruption problem with the OS X PDF-rendering component on 10.5 (which would explain why I see the same problem in LaTeXit, LEE and Papers, but not in Acrobat).

I really don't see how Apple could have let a release out of the door with a bug like this - this is surely a critical bug for anyone in publishing.

Edited to add links:

Date: 2008-02-05 06:20 pm (UTC)
From: (Anonymous)
Yes, looks like this one:
http://www.youtube.com/watch?v=OX9kc1ZDI7U

>> I really don't see how Apple could have let a release out of the door with a bug like this - this is surely a critical bug for anyone in publishing.

Perhaps they didn't see it?

Date: 2008-02-05 06:22 pm (UTC)
From: [identity profile] purplecthulhu.livejournal.com
Which latex version are you using? Have you had a look at their help pages?

I've not moved to leopard yet so can't test this for you, but if it's real it might make me wait a bit longer for a fix...

Date: 2008-02-05 06:40 pm (UTC)
From: [identity profile] lionsphil.livejournal.com
Here's the extreme case I mentioned.

(P.S. Do you think I should make my minithesis more readable?)

Date: 2008-02-05 06:56 pm (UTC)
From: [identity profile] nmg.livejournal.com
I'm using MacTeX, which is a largely repackaged version of TeXlive. It's the most recent version, so it's based on TeXLive 2007.

Regardless, I believe that this *isn't* a TeX problem; one of my colleagues reported similar behaviour with the PDF guidelines for our new corporate identity (don't ask). This too contained embedded Type1 fonts, and shows similar behaviour.

Date: 2008-02-05 06:57 pm (UTC)
From: [identity profile] alex-holden.livejournal.com
Some interesting related videos are showing up next to your YouTube video about LaTeX...

Date: 2008-02-05 06:57 pm (UTC)
From: [identity profile] nmg.livejournal.com
Hmmm. Do you want to pass your transfer viva? :)

Date: 2008-02-05 06:59 pm (UTC)
From: [identity profile] nmg.livejournal.com
It isn't just there for LaTeX users, though.

There's a chance that it may be an artifact of a frotzed upgrade to 10.5; I've not yet found anyone with the bug who did a clean install, or an archive and reinstall.

Date: 2008-02-05 07:02 pm (UTC)
From: [identity profile] lionsphil.livejournal.com
See, this just proves that we need the Semantic Web, not the text-scraping web of Google.

Date: 2008-02-05 07:04 pm (UTC)
From: [identity profile] lionsphil.livejournal.com
Have you tried asking osx-users? That's got a mixture.

Date: 2008-02-05 07:40 pm (UTC)
From: [identity profile] gothick-matt.livejournal.com
Tell me what I need to install and do to try and reproduce it and I'll give it a go; I did an archive & install on both machines. At least that might tell you if doing an archive & install now (not too harmful, surely?) would likely cure the problem...

Date: 2008-02-05 07:52 pm (UTC)

Date: 2008-02-05 08:36 pm (UTC)
From: [identity profile] nmg.livejournal.com
It's not a permanent fix; I've already tried purging the font cache, but the problem comes back after a moderate amount of activity.

Date: 2008-02-05 08:38 pm (UTC)
From: [identity profile] nmg.livejournal.com
I'd start with MacTeX and LaTeX Equation Editor - that duplicates my LaTeX environment.

Date: 2008-02-05 08:38 pm (UTC)
From: [identity profile] nmg.livejournal.com
Good call. I really needed a kick like this to get around to subscribing to it.

Date: 2008-02-05 08:47 pm (UTC)
From: [identity profile] lionsphil.livejournal.com
I really, really wouldn't advise running any command which combines sudo, rm -rf, and backticks. Especially off the Internet.

Date: 2008-02-05 08:56 pm (UTC)
From: [identity profile] nmg.livejournal.com
Hey, I did it and my Mac still works okay! Well, apart from the thing with the fonts and everything...

Date: 2008-02-05 09:33 pm (UTC)
From: [identity profile] blue-condition.livejournal.com
kpathsea (the library TeX uses to find fonts) is pretty horrific. It works, sort of. I'd guess at problems with that.

Date: 2008-02-05 09:48 pm (UTC)
From: [identity profile] nmg.livejournal.com
It isn't kpathsea. TeX produces a working DVI file without problems, and dvips produces a working PostScript file from that DVI which a) renders correctly in ghostscript and b) when translated to PDF via ps2pdf (or pstopdf), renders correctly in Acrobat.

I see the same problem with other PDF files (not produced by TeX) that contain embedded Type1 fonts, so I'm guessing that it's an issue with the font cache maintained by Apple Type Services.

Date: 2008-02-05 09:54 pm (UTC)
From: [identity profile] gothick-matt.livejournal.com
Hmm. This post, among others, seems to point at the LaTeX equation editor as being a major culprit in the corruption -- do you only get the problem (after clearing your font caches) after running the equation editor?

Date: 2008-02-05 09:57 pm (UTC)
From: [identity profile] nmg.livejournal.com
I've stopped using LEE, and I still see the problem. It's possible that LaTeXit also triggers the same behaviour, but I've also been seeing the problems in Pages since I upgraded (and I'd put that down to a poor ps->pdf conversion at the time).

Date: 2008-02-05 10:01 pm (UTC)
From: [identity profile] gothick-matt.livejournal.com
Okay, so I've got me some MacTeX, and I've got me LEE and LaTeXit. For starters, how would you get your example LaTeX document above into a PDF? And would it normally be quickly apparent if things were broken?

Date: 2008-02-05 10:05 pm (UTC)
From: [identity profile] nmg.livejournal.com
Assuming your file is text.tex:

pdflatex test.tex


You could also try going the long way via:

latex text.tex
dvips text.dvi
pstopdf test.ps


You should see the problems as soon as you open the resulting PDF file in Preview.app

Date: 2008-02-05 10:13 pm (UTC)
From: [identity profile] gothick-matt.livejournal.com
Well, that all worked beautifully for me, and the equation appears as in your expected first rendering above. Now I'm going to try with LaTeXit.

Date: 2008-02-05 10:14 pm (UTC)
From: [identity profile] gothick-matt.livejournal.com
(Incidentally, my raw prejudice is saying that LEE will be the culprit, simply because anything so elderly to come in a .sit file always seems to be hideously broken or incompatible in some way...)

Date: 2008-02-05 10:25 pm (UTC)
From: [identity profile] gothick-matt.livejournal.com
Hmm. LaTeXiT appears not to work. Unless it normally hangs for several minutes when you press the "LaTeX it!" button, anyway...

Date: 2008-02-05 10:45 pm (UTC)
From: [identity profile] gothick-matt.livejournal.com
Ah, okay, so there's a known problem with the latest version of LaTeXiT on Leopard. I've now reverted to 1.14.4, and it works fine (or it works fine with \[e = mc^2 \rightarrow \chi \pi \ldots r^2 \], anyway.) I've saved the output as a PDF and opened it with Preview, and regenerated my test.tex file and it still looks fine too.

Hmm. Time to play with LEE, I guess... Nope, that works fine, too.

Hard to tell how much hope that might give you, bearing in mind I didn't have any of the LaTeX stuff installed when I upgraded, of course. But yes, a Tiger machine upgraded to Leopard with "Archive and Install" seems to pass the test of generating your example equation quite happily into PDF using pdflatex, LaTeXiT, and LEE, and I've tried it a few times with each, finishing off with re-generating from my test file using the latex/dvips/pstopdf route. All the results look fine in Preview.

Hope that helped in some way. Of course, it may be some strange spurious thing which happens when doing a particular bit of typesetting and then breaks things forevermore...

Date: 2008-02-05 11:46 pm (UTC)
From: [identity profile] hatter.livejournal.com
Best font cache bug I saw was something subtler, where the glyph for 7 was replaced by the glyph for 9. Write 1234567879 in one font, select, change to something else and it became 123456989. 9+9=16; 3+4=9.

http://onestepback.org/index.cgi/Tech/Mac/MyMacCantCount.red (via comp.risks)


the hatter

Date: 2008-02-06 03:19 am (UTC)
From: [identity profile] ronaldraygun.livejournal.com
While the long way certainly works, something like TeXShop is less daunting.

MacTEX + TeXShop (+ XeTeX for ligatures) = win.

Date: 2008-02-06 07:33 am (UTC)
From: [identity profile] nmg.livejournal.com
Indeed - TeXShop is my LaTeX editing environment of choice these days (although emacs still comes a close second).

Date: 2008-02-06 07:34 am (UTC)
From: [identity profile] nmg.livejournal.com
That's inspired...

Date: 2008-02-06 09:28 am (UTC)
From: [identity profile] nmg.livejournal.com
Okay, thanks for your sterling efforts!

Date: 2008-02-06 02:27 pm (UTC)
From: [identity profile] andre-powell.livejournal.com
Sadly I've caught this thread too late to help. However It is nice to know that people are still using LaTeX. When I was back at DCT we used to create all our documentation in LaTeX. It was good to get away from Microsoft and I thought the resulting docs just looked nicer. Oh well halcyon days..

Profile

nmg: (Default)
Nick Gibbins

September 2012

S M T W T F S
      1
2345678
9101112131415
16171819202122
23 242526272829
30      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 4th, 2025 01:21 pm
Powered by Dreamwidth Studios