xpinyin会影响xeCJK的Autofallback机制

Open
#997 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
latex
Domain
tooling

Research direction

Reproduce the issue with the shown test.tex document and xelatex, comparing the output with and without xpinyin. Start by reading xpinyin.sty alongside xeCJK.sty to trace the interaction; it is done when xeCJK's AutoFallBack still selects FandolSong-Regular.otf while xpinyin continues to add pinyin.

Written by the indexing model from the issue text.

Description

package/xeCJK

考虑下面的两个MWE:

\documentclass{article}
\usepackage[AutoFallBack]{xeCJK}
\setCJKmainfont{lmroman10-regular.otf}
\setCJKfallbackfamilyfont{\CJKrmdefault}{FandolSong-Regular.otf}

\begin{document}
China 中国

\end{document}
Image

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}

得到的效果如下:

Image

终端的输出为:

$ 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.
Dominant language
TeX
Stars
1.1k
Forks
128
Avg merge
1h 25m
Merged PRs (30d)
5

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from CTeX-org/ctex-kit

All issues in CTeX-org/ctex-kit

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.