pdflatex/xelatex 下的 ifxetex 和 ucs 之间存在冲突 - 为什么?

pdflatex/xelatex 下的 ifxetex 和 ucs 之间存在冲突 - 为什么?

我使用 TexLive 2012(在 Mac 上),以下最小示例不起作用:

\documentclass{article}
\usepackage{ifxetex}
\usepackage[mathletters]{ucs} % Need newline here!
\ifxetex
\else
\fi

\begin{document}
\end{document}

上面的例子无法编译,除非我在注释后添加至少一个额外的换行符,如您在最后的日志中看到的那样。错误消息中的乱码是乱码。

我有一个解决方法,而且那个源甚至不是我需要写的(最后,ucs如果我使用 xetex,我不应该加载,所以它的加载也应该是有条件的),但我仍然想知道报告此问题的最佳行动方案。

  1. 什么可能导致错误?
  2. 我可能会遇到更多无声错误吗?
  3. 我该如何最好地报告这个问题?我应该打扰作者吗ifxetex(这是一个非常小的包)还是只打扰作者ucs
  4. 这种问题本身合适吗?

这是我收到的错误。似乎 ucs 加载未完成。

This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012)
 restricted \write18 enabled.
entering extended mode
(./bug.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2012-05-30, ngerman-x-2012-05-30, 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, friulan, galician, german, ngerman, swissgerman, monogreek, greek, h
ungarian, icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, ma
rathi, oriya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian,
kurmanji, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nynorsk,
 polish, portuguese, romanian, romansh, russian, sanskrit, serbian, serbianc, s
lovak, slovenian, spanish, swedish, turkish, turkmen, ukrainian, uppersorbian,
welsh, loaded.
(/usr/local/texlive/2012/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/local/texlive/2012/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2012/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2012/texmf-dist/tex/latex/ucs/ucs.sty
(/usr/local/texlive/2012/texmf-dist/tex/latex/ucs/data/uninames.dat
! Undefined control sequence.
G...tempcnta by1\relax \ifnum \@tempcnta =\uc@got
                                                  \expandafter \uncompress \...
l.241 G
       Ч�ϑ������

答案1

问题在于ucs模拟 LaTeX 内核特性的方式。如果你阅读代码,你会发现:

\ifx\@ifnextchar\undefined
  \def\@ifnextchar#1#2#3{%
    \let\reserved@d=#1%
    \def\reserved@a{#2}%
    \def\reserved@b{#3}%
    \futurelet\@let@token\@ifnch}\fi

\@let@token看起来足够安全,但在紧接着的前面使用是 by 的情况下失败了\newif。这是因为它是\letto \iffalse,这意味着条件不平衡,一切都“失控”。为了使 变得“安全”,需要\@let@token@插入

\let\@let@token\relax

就在本次测试之前(或者实际上更早)。因此,链接到ifxetex是巧合,并且是 中的一个错误ucs

答案2

我已经将 Joseph Wright 建议的补丁合并到加州大学软件包。更新后的软件包将很快出现在 CTAN 上,版本号为 2.2。

相关内容