考虑以下最小文档:
\documentclass{article}
\begin{document}
tām आ ṁ
\end{document}
如果你用 编译它xelatex se.tex
,你会得到一些正常且无害的东西,例如:
This is XeTeX, Version 3.1415926-2.2-0.9995.2 (TeX Live 2009/Debian)
entering extended mode
(./se.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, farsi, arabic, croatian, bulgarian, ukrainian, russian, czech, slov
ak, danish, dutch, finnish, french, basque, ngerman, german, german-x-2009-06-1
9, ngerman-x-2009-06-19, ibycus, monogreek, greek, ancientgreek, hungarian, san
skrit, italian, latin, latvian, lithuanian, mongolian2a, mongolian, bokmal, nyn
orsk, romanian, irish, coptic, serbian, turkish, welsh, esperanto, uppersorbian
, estonian, indonesian, interlingua, icelandic, kurmanji, slovenian, polish, po
rtuguese, spanish, galician, catalan, swedish, ukenglish, pinyin, loaded.
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo)) (./se.aux) [1] (./se.aux)
)
(see the transcript file for additional information)
Output written on se.pdf (1 page).
Transcript written on se.log.
似乎没有包含任何错误消息。但是,如果您打开 PDF 文件,您会注意到它只显示“tm”(或者,如果您使用了\usepackage{fontspec}
,它会显示“tām”),而不是tām आ ṁ
。
XeTeX 悄悄地删除了字符,没有向用户发出警告!
公平地说,如果你仔细看看里面se.log
,你会发现一行字:
Missing character: There is no ā in font cmr10!
或者,如果您使用过\usepackage{fontspec}
,它可能包含:
Missing character: There is no ṁ in font [lmroman10-regular]:mapping=tex-text
!
但是当没有错误迹象时,大多数人没有查看日志文件的习惯。
有没有办法告诉 XeTeX 应该更认真地处理缺失字符,并在主屏幕本身中报告?也许是某些命令行标志、环境变量或配置文件更改?
(当然,现在我已经被这个问题困扰了,我可以编写一个 shell 脚本来在日志文件中 grep 此类消息...但我想知道是否有办法将其设为默认设置,并将此更改纳入默认分发版,以便它也可以帮助其他用户。)
答案1
如果您设置\tracinglostchars=2
,则在终端运行时也会打印该消息
This is XeTeX, Version 3.1415926-2.3-0.9997.5 (TeX Live 2011)
restricted \write18 enabled.
entering extended mode
(./lostla.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2011-07-01, ngerman-x-2011-07-01, afrikaans, ancientgreek, ibycus, arabi
c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis
h, dutch, ukenglish, usenglishmax, esperanto, estonian, ethiopic, farsi, finnis
h, french, galician, german, ngerman, swissgerman, monogreek, greek, hungarian,
icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, marathi, or
iya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian, kurmanji,
lao, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nynorsk, pol
ish, portuguese, romanian, russian, sanskrit, serbian, serbianc, slovak, sloven
ian, spanish, swedish, turkish, turkmen, ukrainian, uppersorbian, welsh, loaded
.
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/size10.clo))
No file lostla.aux.
Missing character: There is no ā in font cmr10!
Missing character: There is no आ in font cmr10!
[1] (./lostla.aux) )
Output written on lostla.pdf (1 page).
Transcript written on lostla.log.
如果我还添加,\usepackage{fontspec}
我得到的只是
Missing character: There is no आ in font [lmroman10-regular]:mapping=tex-text!
更新
使用 TeX Live 2021(以及最新的 MiKTeX),您可以通过设置来获取实际错误\tracinglostchars=3
。这适用于 XeTeX 和 LuaTeX。
\tracinglostchars=3
\documentclass{article}
\begin{document}
tām आ ṁ
\end{document}
在控制台上你将获得
! Missing character: There is no आ (U+0906) in font [lmroman10-regular]:mapping
=tex-text;.
l.5 tām आ
ṁ
?
! Missing character: There is no ṁ (U+1E41) in font [lmroman10-regular]:mapping
=tex-text;.
l.5 tām आ ṁ
?
(感谢 ShreevatsaR 指出最近的更新。)