Fonts in pdf documents screwed up when generated with latex (specifically, pdflatex) on mac osx

后端 未结 6 806
青春惊慌失措
青春惊慌失措 2021-02-06 16:54

My colleague suggests that texniscope is somehow to blame and that I should try purging it from my system. I really hope not to have to resort to that!

Possible clues:<

相关标签:
6条回答
  • 2021-02-06 17:00

    It seems I found the answer, from http://www.stat.duke.edu/~dmm36/tech.php, pasted below. Alas, it appears I have to give up TeXniscope. I like TeXniscope much better than Skim because it's much simpler, has better keyboard shorcuts for paging, and Skim makes you manually refresh the pdf every time there's a latex error (otherwise Skim auto-refreshes).

    Quoted from http://www.stat.duke.edu/~dmm36/tech.php:

    After recently upgrading to Leopard, something very strange and terrible began happening with pdf files created by latex (MacTeX 2007 distribution). The punchline is that fonts were not being displayed correctly by any application that used Apple's native pdf engine (e.g. preview.app, skim.app, Texniscope.app, LaTeXit.app, but not adobe reader 8). More mysterious was the fact that the same document could render differently on multiple openings.

    Much googling ensued, until I found a thread on the mac tex newsgroup which suggested that the problem lay in corrupted font caches. Another search brought about this hint on how to delete all font caches in Leopard. From the terminal, issue the following commands:

    sudo rm -rf `lsof | grep com.apple.ATS/annex.aux | grep Finder | cut -c 66-139`
    

    (replace lsof with /usr/sbin/lsof if /usr/sbin is not in your path)

    sudo rm -rf /private/var/folders/*/*/-Caches-/com.apple.ATS
    

    And then reboot. This fixed the font problem for me.

    NB: part of this problem appears to be the result of TeXniscope.app screwing up the font cache. For example, if you delete the font cache, reboot, and open something in preview it will look fine, but as soon as you open something in TeXniscope again, back to the drawing board. If you are experiencing this problem and using TeXniscope as your pdf previewer, (as in aquamacs), you should switch to Skim as your pdf previewer. It's pretty nice, and the Skim wiki has instructions for how to integrate it with Aquamacs. TeXniscope isn't under active development anyway.

    0 讨论(0)
  • 2021-02-06 17:07

    This bug has driven me nuts. Inspired by this hint, here is the best way I found to cope with it, namely executing the following sequence in a shell:

    atsutil databases -removeUser
    sudo atsutil databases -remove
    atsutil server -shutdown
    atsutil server -ping
    

    You may add it this sequence in a shell function in your shell config file (mine is .zshrc):

    function atsrm()
    {
      atsutil databases -removeUser
      sudo atsutil databases -remove
      atsutil server -shutdown
      atsutil server -ping
    }
    

    ...and simply call atsrm in a terminal to purge the font cache. Be aware that Skim will crash if it was open, and some application may display some characters improperly, so you will have to restart them.

    0 讨论(0)
  • 2021-02-06 17:12

    Apple knows about the problem and isn't planning to fix it (I had a faculty member spend a lot of time testing and submit a bug to Apple). Their claim is that PDFTeX is embedding the fonts incorrectly, and they have fixed the Apple PDF library to be more strict about what it will and won't accept, which means that you will continue to see problems with PDF documents created with PDFTeX in Preview, TeXShop, or other tools that display PDF using Apple's PDF engine. Unfortunately, they weren't at all clear about exactly what it is that PDFTeX is doing wrong, which makes fixing it or even reporting the bug to the PDFTeX developers problematic. Note that Adobe's Acrobat or Reader applications can often display these documents without any problems; presumably Adobe's error-checking is more liberal than Apple's.

    You can actually recover from this problem without rebooting, although you may see it recur with the same document in the same session. You need to run

    atsutil server -shutdown
    

    which will kill the Apple Type Services server daemon (ATSServer) and spawn a new instance, coincidentally rebuilding its cache files.

    0 讨论(0)
  • 2021-02-06 17:16

    TUG recently released updated binaries fixing the bug that triggers the font cache corruption : http://www.tug.org/mactex/fontcache/

    0 讨论(0)
  • 2021-02-06 17:18

    I'm a bit surprised by your problem with MacTeX. I recently installed the 2008 version and it is working like a charm, be it pdftex/latex or xetex/latex. Even with the previous teTeX installed I had, fonts were not a problem. Can you put your foo.tex somewhere for us to test?

    0 讨论(0)
  • 2021-02-06 17:20

    Look at the pdf in Adobe Reader under the document properties. If you have Type 3 (?) bitmap fonts for the math, you need to tell the driver to embed the proper Type 1 vector fonts into the resulting document.

    I use latex with dvips then pdf on linux. It used to be I had to tell it to do this, but now it seems at least the package on ubuntu has the proper font setting.

    Look on the web to tell you how to embed the proper fonts into the document.

    On second thought, maybe you don't have any of the fonts installed on your system or none of your fonts are being embedded into the document.

    0 讨论(0)
提交回复
热议问题