CTeX-org / ctex-kit

Macro Packages and Scripts for Chinese TeX users
976 stars 124 forks source link

xeCJK: 可能与 `moderncv` 冲突 #527

Closed jiaopjie closed 4 years ago

jiaopjie commented 4 years ago

前两天在线安装了 TeXLive 2020, 估计也顺便更新了一些宏包. 使用 moderncv 文档类写中文内容时出现了点奇怪的问题.

% !TeX program = xelatex
\documentclass{moderncv}
\usepackage{ctex}
\name{San}{Zhang}
\begin{document}
中文.
\end{document}

使用 xelatex 编译时出现下述错误

c:/Program Files (x86)/texlive/2020/texmf-dist/tex/xelatex/xecjk/xeCJK.sty|4928 error| Undefined control sequence. \__xeCJK_patch_microtype_get_slot: 

使用 pdflatex 和 lualatex 编译均可正常通过.

我也不知道这应该是 moderncv 的锅还是 xeCJK 的锅, 但这里可以发中文, 我就发在这了.

stone-zeng commented 4 years ago

应该是 22b7668 引入的。

最小示例:

\documentclass{article}
\usepackage{xeCJK}
\usepackage{microtype}
\begin{document}
中文
\end{document}
stone-zeng commented 4 years ago

https://github.com/CTeX-org/ctex-kit/blob/dbf79a0dcb771d567176c974d03f0f8f4a711728/xeCJK/xeCJK.dtx#L8906-L8933

把这边的 \@@_package_hook:nn { microtype } 移至末尾(或者在 microtype 之前载入 xeCJK),虽然可以解决命令未定义的问题,但却会带来大量警告信息:

Package microtype Info: Loading generic protrusion settings for font family
(microtype)             `FandolSong-Regular' (encoding: TU).
(microtype)             For optimal results, create family-specific settings.
(microtype)             See the microtype manual for details.

Package microtype Warning: Unknown slot number of character
(microtype)                `\`A'
(microtype)                in font encoding `TU' in inheritance list
(microtype)                `microtype.cfg/376(protrusion)'.

Package microtype Warning: Unknown slot number of character
(microtype)                `\'A'
(microtype)                in font encoding `TU' in inheritance list
(microtype)                `microtype.cfg/376(protrusion)'.

...