考虑下面的两个MWE:
\documentclass{article}
\usepackage[AutoFallBack]{xeCJK}
\setCJKmainfont{lmroman10-regular.otf}
\setCJKfallbackfamilyfont{\CJKrmdefault}{FandolSong-Regular.otf}
\begin{document}
China 中国
\end{document}
work.
然而如果引入 xpinyin:
\documentclass{article}
\usepackage[AutoFallBack]{xeCJK}
\setCJKmainfont{lmroman10-regular.otf}
\setCJKfallbackfamilyfont{\CJKrmdefault}{FandolSong-Regular.otf}
\usepackage{xpinyin}
\begin{document}
China 中国
China \xpinyin*{中国}
\end{document}
得到的效果如下:
终端的输出为:
$ xelatex test
This is XeTeX, Version 3.141592653-2.6-0.999998 (TeX Live 2026) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2026-06-01>
L3 programming layer <2026-06-18>
(c:/texlive/2026/texmf-dist/tex/latex/base/article.cls
Document Class: article 2025/01/22 v1.4n Standard LaTeX document class
(c:/texlive/2026/texmf-dist/tex/latex/base/size10.clo))
(c:/texlive/2026/texmf-dist/tex/xelatex/xecjk/xeCJK.sty
(c:/texlive/2026/texmf-dist/tex/latex/l3kernel/expl3.sty
(c:/texlive/2026/texmf-dist/tex/latex/l3backend/l3backend-xetex.def))
(c:/texlive/2026/texmf-dist/tex/latex/ctex/ctexhook.sty)
(c:/texlive/2026/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty)
(c:/texlive/2026/texmf-dist/tex/latex/fontspec/fontspec.sty
(c:/texlive/2026/texmf-dist/tex/latex/l3packages/xparse/xparse.sty)
(c:/texlive/2026/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
(c:/texlive/2026/texmf-dist/tex/latex/base/fontenc.sty)
(c:/texlive/2026/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(c:/texlive/2026/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg))
(c:/texlive/2026/texmf-dist/tex/latex/xpinyin/xpinyin.sty
(c:/texlive/2026/texmf-dist/tex/latex/xpinyin/xpinyin-database.def))
(./test.aux)
Missing character: There is no 中 (U+4E2D) in font [lmroman10-regular.otf]/OT:sc
ript=hani;language=dflt;!
Missing character: There is no 国 (U+56FD) in font [lmroman10-regular.otf]/OT:sc
ript=hani;language=dflt;!
[1] (./test.aux)
*File List*
article.cls 2025/01/22 v1.4n Standard LaTeX document class
size10.clo 2025/01/22 v1.4n Standard LaTeX file (size option)
xeCJK.sty 2026/07/06 v3.10.2 Typesetting CJK scripts with XeLaTeX
expl3.sty 2026-06-18 L3 programming layer (loader)
l3backend-xetex.def 2026-02-18 L3 backend support: XeTeX
ctexhook.sty 2026/07/04 v2.6.2 Document and package hooks (CTEX)
xtemplate.sty 2025-10-09 L3 Experimental prototype document functions
fontspec.sty 2025/09/29 v2.9g Font selection for XeLaTeX and LuaLaTeX
xparse.sty 2025-10-09 L3 Experimental document command parser
fontspec-xetex.sty 2025/09/29 v2.9g Font selection for XeLaTeX and LuaLaTeX
fontenc.sty 2025/07/18 v2.1d Standard LaTeX package
fontspec.cfg
xeCJK.cfg 2026/07/06 v3.10.2 Configuration file for xeCJK package
xpinyin.sty 2022/07/14 v3.1 Automatically add pinyin to Chinese characters
xpinyin-database.def 2022/07/14 v3.1 xpinyin database
***********
)
Output written on test.pdf (1 page).
Transcript written on test.log.
考虑下面的两个MWE:
work.
然而如果引入
xpinyin:得到的效果如下:
终端的输出为: