一些背景:
- 系统:OS X 10.11.6 (El Capitan)
- MacTex 版本:2016
- 软件:TexShop(pTex 配置如下)这里)
pxbabel 的一个特点是它为 pTex 和 upTex 提供了多种语言支持,例如中文、韩文、俄文等,通过\foreignlanguge{语言}{文本},下面是一份应该可以成功编译的文档。
\documentclass[a4paper,uplatex]{jsarticle}
\usepackage[english]{babel}
\usepackage[main=japanese]{pxbabel}
\begin{document}
\foreignlanguage{korean}{내가득합니다}
\end{document}
但是,在尝试编译时,系统返回以下错误消息:
This is ptex2pdf[.lua] version 0.8.
Processing test.tex
This is e-upTeX, Version 3.14159265-p3.7-u1.21-160201-2.6 (utf8.uptex) (TeX Live 2016) (preloaded format=uplatex)
restricted \write18 enabled.
entering extended mode
(./test.tex
pLaTeX2e <2016/09/08u01> (based on LaTeX2e <2016/03/31> patch level 3)
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(/usr/local/texlive/2016/texmf-dist/tex/platex/jsclasses/jsarticle.cls
Document Class: jsarticle 2016/09/08 okumura, texjporg
(/usr/local/texlive/2016/texmf-dist/tex/platex/jsclasses/jslogo.sty))
(/usr/local/texlive/2016/texmf-dist/tex/generic/babel/babel.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/babel-english/english.ldf
(/usr/local/texlive/2016/texmf-dist/tex/generic/babel/babel.def)))
(/usr/local/texlive/2016/texmf-dist/tex/platex/pxbase/pxbabel.sty
(/usr/local/texlive/2016/texmf-dist/tex/platex/pxbase/pxbase.sty
(/usr/local/texlive/2016/texmf-dist/tex/platex/pxbase/pxbase.def
(/usr/local/texlive/2016/texmf-dist/tex/platex/pxbase/pxbase.def))
(/usr/local/texlive/2016/texmf-dist/tex/platex/pxbase/ifuptex.sty)
(/usr/local/texlive/2016/texmf-dist/tex/platex/pxbase/pxbsjc.def))
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2016/texmf-dist/tex/platex/pxbase/pxbasenc.def))
(./test.aux) [1] (./test.aux) )
Output written on test.dvi (1 page, 368 bytes).
Transcript written on test.log.
test.dvi -> test.pdf
[1
kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 0+555/600 --dpi 555 uphysmjm-h
mktexpk: don't know how to create bitmap font for uphysmjm-h.
mktexpk: perhaps uphysmjm-h is missing from the map file.
kpathsea: Appending font creation commands to missfont.log.
dvipdfmx:warning: Could not locate a virtual/physical font for TFM "uphysmjm-h".
dvipdfmx:warning: >> There are no valid font mapping entry for this font.
dvipdfmx:warning: >> Font file name "uphysmjm-h" was assumed but failed to locate that font.
dvipdfmx:fatal: Cannot proceed without .vf or "physical" font for PDF output...
Output file removed.
ptex2pdf processing of test.tex failed.
从“无法找到 TFM“uphysmjm-h”的虚拟/物理字体”看起来代码有效,但系统无法找到韩文字体。
从其他来源,我得知 pxbabel 使用的是这种韩文字体: http://kldp.net/unfonts/
我花了几个小时查看 [/usr/local/texlive] 却没有任何线索......有什么方法可以帮助系统将 pxbabel 包与它所需的韩文字体连接起来?
答案1
Pxbabel 对“物理”字体设置不做任何处理。因此,您必须告诉 dvipdfmx 您要使用哪种字体。
最简单的方法可能是:
\documentclass[a4paper,uplatex]{jsarticle}
\usepackage[english]{babel}
\usepackage[main=japanese]{pxbabel}
\AtBeginDvi{\special{pdf:mapline uphysmjm-h UniKS-UTF16-H UnBatang.ttf}}
\AtBeginDvi{\special{pdf:mapline uphysmjm-v UniKS-UTF16-V UnBatang.ttf}}
\AtBeginDvi{\special{pdf:mapline uphygt-h UniKS-UTF16-H UnDotum.ttf}}
\AtBeginDvi{\special{pdf:mapline uphygt-v UniKS-UTF16-V UnDotum.ttf}}
\begin{document}
\foreignlanguage{korean}{내가득합니다}%
\foreignlanguage{korean}{\textgt{내가득합니다}}
\end{document}
当然,首先你必须将这些字体(.ttf)安装到你的$TEXMFLOCAL
(例如/usr/local/texlive/texmf-local/fonts/truetype/unfonts
)中,然后运行sudo mktexlsr
。
更新(2017-01-14):Norbert 和我为中文和韩文字体开发了新的映射文件,这些更改已应用于 TeX Liver42939--r42951。现在韩文字体默认为 baekmuk,因此更新安装后不会再出现此错误。此外,您可以通过以下方式将默认字体设置从 baekmuk 更改为 unfonts
(sudo) updmap-sys --setoption koEmbed unfonts
命令。