在 mac osx 上使用 Latex(特别是 pdflatex)生成时,pdf 文档中的字体出现问题
我的同事认为 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
这个错误让我发疯。 受到此提示的启发,这是我发现的应对它的最佳方法,即在 shell 中执行以下序列:
您可以将此序列添加到 shell 配置文件的 shell 函数中(我的是
.zshrc
):...然后只需调用
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:
You may add it this sequence in a shell function in your shell config file (mine is
.zshrc
):...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.在 Adobe 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.
我对你的 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?
苹果公司知道这个问题,但不打算修复它(我有一位教员花了很多时间测试并向苹果公司提交了一个错误)。 他们声称 PDFTeX 错误地嵌入了字体,并且他们已经修复了 Apple PDF 库,使其对接受和不接受的内容更加严格,这意味着您将继续在预览中看到使用 PDFTeX 创建的 PDF 文档的问题、TeXShop 或其他使用 Apple PDF 引擎显示 PDF 的工具。 不幸的是,他们根本不清楚 PDFTeX 到底做错了什么,这使得修复它甚至向 PDFTeX 开发人员报告错误都成为问题。 请注意,Adobe 的 Acrobat 或 Reader 应用程序通常可以毫无问题地显示这些文档; 据推测,Adobe 的错误检查比 Apple 的更自由。
实际上,您可以在不重新启动的情况下从该问题中恢复,尽管您可能会看到该问题在同一会话中的同一文档中重复出现。 您需要运行
它将终止 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
which will kill the Apple Type Services server daemon (ATSServer) and spawn a new instance, coincidentally rebuilding its cache files.
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/
看来我找到了答案,来自 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 中所有字体缓存的提示。 从终端发出以下命令:(
如果
/usr/sbin
不在您的路径中,请将lsof
替换为/usr/sbin/lsof
)然后重新启动。 这为我解决了字体问题。
注意:此问题的部分原因似乎是 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:
(replace
lsof
with/usr/sbin/lsof
if/usr/sbin
is not in your path)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.