在 mac osx 上使用 Latex(特别是 pdflatex)生成时,pdf 文档中的字体出现问题

发布于 2024-07-10 06:01:04 字数 675 浏览 8 评论 0原文

我的同事认为 texniscope 是罪魁祸首,我应该尝试将其从系统中清除。 我真的希望不必诉诸于此!

可能的线索:

  • 在我升级到 Leopard 之前这不是问题。

  • 当我说字体搞砸了时,我的意思是主要文本看起来可能是默认的 mac 系统字体,并且所有数学都完全无法阅读。 基本上所有特殊符号都完全是乱码。

  • 我从这里安装了乳胶:http://www.tug.org/mactex/ 。 我已经安装了 texniscope。

  • 当我运行/usr/texbin/pdflatex foo.tex时,它似乎工作:

     This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7)
     %&-line parsing enabled.
     entering extended mode
    ...

但是生成的 pdf 文件已经搞砸了字体。

  • 在命令行上使用 pdflatex 或使用 TeXShop 都会发生同样的事情。

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:

  • This wasn't an issue till I upgraded to Leopard.

  • When I say the fonts are screwed up, I mean the main text looks like maybe it's the default mac system font, and all math is completely unreadable. Basically all special symbols are completely garbled.

  • I installed latex from here: http://www.tug.org/mactex/. I had already had texniscope installed.

  • When I run /usr/texbin/pdflatex foo.tex, it seems to work:

     This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7)
     %&-line parsing enabled.
     entering extended mode
    ...

but the resulting pdf file has screwed up fonts.

  • The same thing happens both with pdflatex on the command line, or using TeXShop.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

谷夏 2024-07-17 06:01:05

这个错误让我发疯。 受到此提示的启发,这是我发现的应对它的最佳方法,即在 shell 中执行以下序列:

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

您可以将此序列添加到 shell 配置文件的 shell 函数中(我的是 .zshrc):

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

...然后只需调用 atsrm< /code> 在终端中清除字体缓存。 请注意,如果打开,Skim 会崩溃,并且某些应用程序可能无法正确显示某些字符,因此您必须重新启动它们。

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.

眼眸印温柔 2024-07-17 06:01:05

在 Adob​​e Reader 中的文档属性下查看 pdf。 如果您有用于数学计算的 Type 3 (?) 位图字体,则需要告诉驱动程序将正确的 Type 1 矢量字体嵌入到生成的文档中。

我在 Linux 上使用 Latex 和 dvips,然后使用 pdf。 以前我必须告诉它这样做,但现在看来至少 ubuntu 上的包有正确的字体设置。

在网上查找告诉您如何将正确的字体嵌入到文档中。

再想一想,也许您的系统上没有安装任何字体,或者您的任何字体都没有嵌入到文档中。

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.

情定在深秋 2024-07-17 06:01:05

我对你的 MacTeX 问题感到有点惊讶。 我最近安装了 2008 版本,无论是 pdftex/latex 还是 xetex/latex,它都运行得非常好。 即使我之前安装了 teTeX,字体也不是问题。 你能把你的 foo.tex 放在某个地方供我们测试吗?

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?

小猫一只 2024-07-17 06:01:04

苹果公司知道这个问题,但不打算修复它(我有一位教员花了很多时间测试并向苹果公司提交了一个错误)。 他们声称 PDFTeX 错误地嵌入了字体,并且他们已经修复了 Apple PDF 库,使其对接受和不接受的内容更加严格,这意味着您将继续在预览中看到使用 PDFTeX 创建的 PDF 文档的问题、TeXShop 或其他使用 Apple PDF 引擎显示 PDF 的工具。 不幸的是,他们根本不清楚 PDFTeX 到底做错了什么,这使得修复它甚至向 PDFTeX 开发人员报告错误都成为问题。 请注意,Adobe 的 Acrobat 或 Reader 应用程序通常可以毫无问题地显示这些文档; 据推测,Adobe 的错误检查比 Apple 的更自由。

实际上,您可以在不重新启动的情况下从该问题中恢复,尽管您可能会看到该问题在同一会话中的同一文档中重复出现。 您需要运行

atsutil server -shutdown

它将终止 Apple Type Services 服务器守护程序 (ATSServer) 并生成一个新实例,同时重建其缓存文件。

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.

雄赳赳气昂昂 2024-07-17 06:01:04

TUG 最近发布了更新的二进制文件,修复了触发字体缓存损坏的错误:http://www.tug.org/mactex/fontcache/

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

静若繁花 2024-07-17 06:01:04

看来我找到了答案,来自 http://www.stat.duke.edu /~dmm36/tech.php,粘贴在下面。 唉,看来我得放弃TeXniscope了。 与 Skim 相比,我更喜欢 TeXniscope,因为它更简单,具有更好的分页键盘快捷键,而且 Skim 可以让您在每次出现 Latex 错误时手动刷新 pdf(否则 Skim 会自动刷新)。

引用自 http://www.stat.duke.edu/~dmm36/tech。 php

最近升级到 Leopard 后,由 Latex(MacTeX 2007 发行版)创建的 pdf 文件开始发生一些非常奇怪和可怕的事情。 最重要的是,任何使用 Apple 原生 pdf 引擎的应用程序(例如,preview.app、skim.app、Texniscope.app、LaTeXit.app,但 adobe reader 8 除外)都无法正确显示字体。 更神秘的是,同一个文档在多个开口上可能会呈现不同的效果。

随后进行了大量的谷歌搜索,直到我在 mac tex 新闻组上发现了一个线程,该线程表明问题在于损坏的字体缓存。 另一项搜索带来了有关如何删除 Leopard 中所有字体缓存的提示。 从终端发出以下命令:(

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

如果 /usr/sbin 不在您的路径中,请将 lsof 替换为 /usr/sbin/lsof

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

然后重新启动。 这为我解决了字体问题。

注意:此问题的部分原因似乎是 TeXniscope.app 破坏字体缓存的结果。 例如,如果您删除字体缓存,重新启动并在预览中打开某些内容,它看起来会很好,但是一旦您再次在 TeXniscope 中打开某些内容,就会回到绘图板。 如果您遇到此问题并使用 TeXniscope 作为 pdf 预览器(如在 aquamacs 中),则应切换到 Skim 作为 pdf 预览器。 它非常好,Skim wiki 有关于如何将它与 Aquamacs 集成的说明。 无论如何,TeXniscope 并没有在积极开发中。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文