我遇到了下面这个奇怪的现象。
首先,以下测试表明我的系统正在运行该iftex
软件包的最新版本(2020):
\listfiles
\RequirePackage{iftex}[2020/03/06]
\documentclass{article}
\begin{document}
\end{document}
日志文件包含以下内容:
This is XeTeX, Version 3.14159265-2.6-0.999992 (MiKTeX 20.10) ...
entering extended mode
...
LaTeX2e <2020-10-01> patch level 1
L3 programming layer <2020-10-05> xparse <2020-03-03>
("C:\Program Files\MiKTeX\tex/generic/iftex\iftex.sty"
Package: iftex 2020/03/06 v1.0d TeX engine tests
)
...
*File List*
iftex.sty 2020/03/06 v1.0d TeX engine tests
...
接下来,请注意iftex
通过 legacyifpdf
包进行调用不会造成任何损害:
\listfiles
\RequirePackage{ifpdf}
\documentclass{article}
\begin{document}
\end{document}
以下是日志输出,显示iftex
加载的包是同一个,来自 2020 年:
This is XeTeX, Version 3.14159265-2.6-0.999992 (MiKTeX 20.10) ...
entering extended mode
....
LaTeX2e <2020-10-01> patch level 1
L3 programming layer <2020-10-05> xparse <2020-03-03>
("C:\Program Files\MiKTeX\tex/generic/iftex\ifpdf.sty"
Package: ifpdf 2019/10/25 v3.4 ifpdf legacy package. Use iftex instead.
("C:\Program Files\MiKTeX\tex/generic/iftex\iftex.sty"
Package: iftex 2020/03/06 v1.0d TeX engine tests
))
...
*File List*
ifpdf.sty 2019/10/25 v3.4 ifpdf legacy package. Use iftex instead.
iftex.sty 2020/03/06 v1.0d TeX engine tests
...
但是,调用xy
包,该包又调用ifpdf
,该包又调用iftex
,会产生一个奇怪的结果:
\listfiles
\RequirePackage{xy}
\RequirePackage{iftex}[2020/03/06] % the iftex package is already loaded via xy
\documentclass{article}
\begin{document}
\end{document}
以下是日志文件输出:
This is XeTeX, Version 3.14159265-2.6-0.999992 (MiKTeX 20.10) ...
entering extended mode
...
LaTeX2e <2020-10-01> patch level 1
L3 programming layer <2020-10-05> xparse <2020-03-03>
("C:\Program Files\MiKTeX\tex/generic/xypic\xy.sty"
...
("C:\Program Files\MiKTeX\tex/generic/iftex\ifpdf.sty"
Package: ifpdf 2019/10/25 v3.4 ifpdf legacy package. Use iftex instead.
("C:\Program Files\MiKTeX\tex/generic/iftex\iftex.sty"
Package: iftex 2020/03/06 v1.0d TeX engine tests
))
Package: xy 2013/10/06 Xy-pic version 3.8.9
)
LaTeX Warning: You have requested, on input line 3, version
`2020/03/06' of package iftex,
but only version
`2013/10/06 Xy-pic version 3.8.9'
is available.
...
*File List*
xy.sty 2013/10/06 Xy-pic version 3.8.9
ifpdf.sty 2019/10/25 v3.4 ifpdf legacy package. Use iftex instead.
iftex.sty 2013/10/06 Xy-pic version 3.8.9
...
一方面,当xy
包加载iftex
(通过ifpdf
)时,日志文件正确报告加载了 2020/03/06 版本的iftex
。但是当我们随后需要该日期的包时,我们会收到一条警告,指出已加载iftex
的 版本被调用(这当然毫无意义)。而在最后的 (由 生成)中,我们看到了相同的错误。iftex
2013/10/06 Xy-pic version 3.8.9
*File List*
\listfiles
iftex.sty 2013/10/06 Xy-pic version 3.8.9
不知何故, 中的代码xy.sty
无意中欺骗了系统,使其将自己的标识符分配给xy
包中加载的最后一个包。据我所知,其中的相关行xy.sty
如下(第 38-46 行),但我不知道是什么导致了这个问题。
% Ensure that we are *really* running LaTeX2e...!
\NeedsTeXFormat{LaTeX2e}
% So we can check for pdfTeX.
\RequirePackage{ifpdf}
% This file provides the current version of Xy-pic!
\edef\next{%
\noexpand\ProvidesPackage{xy}[\xydate\space Xy-pic version \xyversion]}\next
如何以及为何xy.sty
欺骗系统将其自己的 ( xy
) 版本标识符错误地分配给它加载的最后一个包?这似乎是 中的一个错误xy.sty
;可以修复吗?