关于MetaPost的label无法显示、无法编译的文章网上已经有一大堆了,但还是没有一个能解决我的问题……于是研究了两天,得出了又一种解法。
我的问题是:有label的MetaPost文件可以编译,但是编译完的东西无法显示,无论是用Evince还是ghostscript命令都不行,随便找个文件用ghostscript试一下就会得到如下信息:
GPL Ghostscript 9.10 (2013-08-30) Copyright (C) 2013 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Error: /undefined in cmsy10 Operand stack: (p) Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1916 1 3 %oparray_pop 1915 1 3 %oparray_pop 1899 1 3 %oparray_pop 1787 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- Dictionary stack: --dict:1171/1684(ro)(G)-- --dict:0/20(G)-- --dict:77/200(L)-- Current allocation mode is local Current file position is 1066 GPL Ghostscript 9.10: Unrecoverable error, exit code 1
下面是解决方法。
首先根据搜索结果,在MetaPost源文件的开头添加如下一行:
prologues := 1;
之后重新编译一下那个文件,再用ghostscript查看。虽然可以显示,但还是会得到如下错误信息,并且其中的字体也不正常。
GPL Ghostscript 9.10 (2013-08-30) Copyright (C) 2013 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. **** Warning: Some of the BoundingBox for the EPS file will be clipped. Use -dEPSCrop or -dEPSFitPage to avoid clipping. Can't find (or can't open) font file /usr/share/ghostscript/9.10/Resource/Font/CMSY10. Can't find (or can't open) font file CMSY10. Querying operating system for font files... Can't find (or can't open) font file /usr/share/ghostscript/9.10/Resource/Font/CMSY10. Can't find (or can't open) font file CMSY10. Didn't find this font on the system! Substituting font Courier for CMSY10. Loading NimbusMonL-Regu font from /usr/share/fonts/type1/gsfonts/n022003l.pfb... 3935012 2454367 6881384 3120799 2 done. Can't find (or can't open) font file /usr/share/ghostscript/9.10/Resource/Font/CMMI10. Can't find (or can't open) font file CMMI10. Didn't find this font on the system! Substituting font Courier for CMMI10. >>showpage, press <return> to continue<<
其中几行代码显示了字体保存路径,到那里去看看,就会发现那里有一堆字体,把TeX用到的字体文件复制过去就行了。注意大小写。
另外似乎现在TeX的字体不是bluesky,我的字体是在这个路径找到的:/usr/local/texlive/2014/texmf-dist/fonts/type1/public/amsfonts/cm(我用的是TeXLive发行版)。