ucs 和 hyperref 软件包在 xelatex 下无法兼容

ucs 和 hyperref 软件包在 xelatex 下无法兼容

\UTFviii@loop每当我使用该ucs包和hyperrefXeLaTeX(和 LuaLaTeX)下的包时,我都会收到“未定义控制序列”错误。(我理解\UTFviii@loop这与输入编码有关。)MWE 是

\documentclass{article}
\usepackage{hyperref}
\usepackage{ucs} 
\begin{document}
testing
\end{document}

这将生成以下运行:

% xelatex lab1-1.tex         
This is XeTeX, Version 3.141592653-2.6-0.999995 (TeX Live 2023) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
(./lab1-1.tex
LaTeX2e <2023-06-01> patch level 1
L3 programming layer <2023-08-11>
(/usr/local/texlive/2023/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(/usr/local/texlive/2023/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2023/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2023/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty)
(/usr/local/texlive/2023/texmf-dist/tex/generic/iftex/iftex.sty)
(/usr/local/texlive/2023/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty
(/usr/local/texlive/2023/texmf-dist/tex/generic/infwarerr/infwarerr.sty))
(/usr/local/texlive/2023/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty)
(/usr/local/texlive/2023/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty)
(/usr/local/texlive/2023/texmf-dist/tex/generic/pdfescape/pdfescape.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/hycolor/hycolor.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/letltxmacro/letltxmacro.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/auxhook/auxhook.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2023/texmf-dist/tex/latex/refcount/refcount.sty)
(/usr/local/texlive/2023/texmf-dist/tex/generic/gettitlestring/gettitlestring.s
ty (/usr/local/texlive/2023/texmf-dist/tex/latex/kvoptions/kvoptions.sty)))
(/usr/local/texlive/2023/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2023/texmf-dist/tex/generic/intcalc/intcalc.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/hyperref/puenc.def)
(/usr/local/texlive/2023/texmf-dist/tex/latex/url/url.sty)
(/usr/local/texlive/2023/texmf-dist/tex/generic/bitset/bitset.sty
(/usr/local/texlive/2023/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty))
(/usr/local/texlive/2023/texmf-dist/tex/latex/base/atbegshi-ltx.sty))
(/usr/local/texlive/2023/texmf-dist/tex/latex/hyperref/hxetex.def
(/usr/local/texlive/2023/texmf-dist/tex/generic/stringenc/stringenc.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty
(/usr/local/texlive/2023/texmf-dist/tex/latex/base/atveryend-ltx.sty)
(/usr/local/texlive/2023/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty
))) (/usr/local/texlive/2023/texmf-dist/tex/latex/ucs/ucs.sty
(/usr/local/texlive/2023/texmf-dist/tex/latex/ucs/data/uni-global.def))
(/usr/local/texlive/2023/texmf-dist/tex/latex/l3backend/l3backend-xetex.def)
(./lab1-1.aux) (/usr/local/texlive/2023/texmf-dist/tex/latex/base/ts1cmr.fd)
(./lab1-1.out) (./lab1-1.out)

Package hyperref Warning: Rerun to get /PageLabels entry.

(/usr/local/texlive/2023/texmf-dist/tex/latex/ucs/ucsencs.def)
! Undefined control sequence.
\HyPsd@expand@utfvii ... {~{####1}}}\UTFviii@loop 
                                                  \count@ "E0 \@tempcnta "F0...
l.6 \end{document}
                  
? 

这可以用 PdfLaTeX 顺利运行:

% pdflatex lab1-1.tex 
This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./lab1-1.tex
LaTeX2e <2023-06-01> patch level 1
L3 programming layer <2023-08-11>
(/usr/local/texlive/2023/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(/usr/local/texlive/2023/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2023/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2023/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty)
(/usr/local/texlive/2023/texmf-dist/tex/generic/iftex/iftex.sty)
(/usr/local/texlive/2023/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty
(/usr/local/texlive/2023/texmf-dist/tex/generic/infwarerr/infwarerr.sty))
(/usr/local/texlive/2023/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty)
(/usr/local/texlive/2023/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty)
(/usr/local/texlive/2023/texmf-dist/tex/generic/pdfescape/pdfescape.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/hycolor/hycolor.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/letltxmacro/letltxmacro.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/auxhook/auxhook.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2023/texmf-dist/tex/latex/refcount/refcount.sty)
(/usr/local/texlive/2023/texmf-dist/tex/generic/gettitlestring/gettitlestring.s
ty (/usr/local/texlive/2023/texmf-dist/tex/latex/kvoptions/kvoptions.sty)))
(/usr/local/texlive/2023/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2023/texmf-dist/tex/generic/intcalc/intcalc.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/hyperref/puenc.def)
(/usr/local/texlive/2023/texmf-dist/tex/latex/url/url.sty)
(/usr/local/texlive/2023/texmf-dist/tex/generic/bitset/bitset.sty
(/usr/local/texlive/2023/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty))
(/usr/local/texlive/2023/texmf-dist/tex/latex/base/atbegshi-ltx.sty))
(/usr/local/texlive/2023/texmf-dist/tex/latex/hyperref/hpdftex.def
(/usr/local/texlive/2023/texmf-dist/tex/latex/base/atveryend-ltx.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty

(/usr/local/texlive/2023/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty
))) (/usr/local/texlive/2023/texmf-dist/tex/latex/ucs/ucs.sty
(/usr/local/texlive/2023/texmf-dist/tex/latex/ucs/data/uni-global.def))
(/usr/local/texlive/2023/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def)
(./lab1-1.aux) (./lab1-1.out) (./lab1-1.out)
(/usr/local/texlive/2023/texmf-dist/tex/latex/ucs/ucsencs.def) [1{/usr/local/te
xlive/2023/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./lab1-1.aux) )</usr
/local/texlive/2023/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on lab1-1.pdf (1 page, 12687 bytes).
Transcript written on lab1-1.log.
% 

我只是在将 TeX Live 更新到当前的 2023 版本时才注意到此问题。在 2022 下我没有遇到任何问题。

一些重要的背景:您可能会问为什么我不直接使用 PdfLaTeX,或者去掉这两个包中的一个(特别是ucs)。这是因为 LaTeX 代码是由nbconvert而不是我生成的。具体来说,它是在使用 进行 Jupyter 笔记本转换的过程中生成的nbconvert --to pdf,它会生成 LaTeX 代码并使用 XeLaTeX 来处理它。它是nbconvert插入两个包。事实上,我通过使用 生成 LaTeX 代码来生成 MWE nbconvert --to latex,然后删除一些位,直到只剩下 MWE。您可能想知道为什么我不直接使用nbconvert来生成 LateX 代码,然后单独使用 PdfLaTeX 来获取 PDF。这是因为nbconvert插入非 ASCII 字符,因为它假定 XeLaTeX 将用于处理 LaTeX 代码。

另外,我只是想知道发生了什么事。

非常感谢任何帮助或见解。

相关内容