我正在尝试编译这个MWE:
\documentclass{article}
\newcommand{\hello}{Hi world!}
\usepackage{regexpatch}
\regexpatchcmd{\hello}{Hi}{Hello}{}{}
\begin{document}
\hello
\end{document}
这在使用 LaTeX2e 补丁级别 3 的一个 MiKTeX 系统上有效,但在使用 LaTeX2e 补丁级别 4 的同一系统(和另一个 TeX Live 系统)上失败:
在职的:
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 20.12)
entering extended mode
(bug.tex
LaTeX2e <2020-10-01> patch level 3
L3 programming layer <2020-12-07> xparse <2020-03-03>
("C:\Users\bers\AppData\Local\Programs\MiKTeX 2.9\tex/latex/base\article.cls
"
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
("C:\Users\bers\AppData\Local\Programs\MiKTeX 2.9\tex/latex/base\size10.clo"
))
("C:\Users\bers\AppData\Local\Programs\MiKTeX 2.9\tex/latex/regexpatch\regex
patch.sty"
("C:\Users\bers\AppData\Local\Programs\MiKTeX 2.9\tex/latex/l3kernel\expl3.s
ty"
("C:\Users\bers\AppData\Local\Programs\MiKTeX 2.9\tex/latex/l3backend\l3back
end-pdftex.def"))
("C:\Users\bers\AppData\Local\Programs\MiKTeX 2.9\tex/latex/l3packages/xpars
e\xparse.sty"
("C:\Users\bers\AppData\Local\Programs\MiKTeX 2.9\tex/latex/l3packages/xpars
e\xparse-generic.tex"))) (bug.aux) [1{C:/Users/bers/AppData/Local/MiKTeX/2.9
/pdftex/config/pdftex.map}] (bug.aux) )<C:/Users/bers/AppData/Local/Programs
/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on bug.pdf (1 page, 12460 bytes).
Transcript written on bug.log.
不工作:
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 20.12)
entering extended mode
(bug.tex
LaTeX2e <2020-10-01> patch level 4
L3 programming layer <2021-01-09> xparse <2020-03-03>
("C:\Users\bers\AppData\Local\Programs\MiKTeX 2.9\tex/latex/base\article.cls
"
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
("C:\Users\bers\AppData\Local\Programs\MiKTeX 2.9\tex/latex/base\size10.clo"
))
("C:\Users\bers\AppData\Local\Programs\MiKTeX 2.9\tex/latex/regexpatch\regex
patch.sty"
("C:\Users\bers\AppData\Local\Programs\MiKTeX 2.9\tex/latex/l3kernel\expl3.s
ty"
("C:\Users\bers\AppData\Local\Programs\MiKTeX 2.9\tex/latex/l3backend\l3back
end-pdftex.def"))
("C:\Users\bers\AppData\Local\Programs\MiKTeX 2.9\tex/latex/l3packages/xpars
e\xparse.sty"
("C:\Users\bers\AppData\Local\Programs\MiKTeX 2.9\tex/latex/l3packages/xpars
e\xparse-generic.tex")))
! Undefined control sequence.
<argument> \LaTeX3 error:
Use \cs_replacement_spec:N not \token_get_replace...
l.4 \regexpatchcmd{\hello}{Hi}{Hello}{}{}
也不起作用:
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./bug.tex
LaTeX2e <2020-10-01> patch level 4
L3 programming layer <2021-01-09> xparse <2020-03-03>
(/home/bers/opt/texlive/2020/texmf-dist/tex/latex/base/article.cls
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
(/home/bers/opt/texlive/2020/texmf-dist/tex/latex/base/size10.clo))
(/home/bers/opt/texlive/2020/texmf-dist/tex/latex/regexpatch/regexpatch.sty
(/home/bers/opt/texlive/2020/texmf-dist/tex/latex/l3kernel/expl3.sty
(/home/bers/opt/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-pdftex.
def))
(/home/bers/opt/texlive/2020/texmf-dist/tex/latex/l3packages/xparse/xparse.st
y
(/home/bers/opt/texlive/2020/texmf-dist/tex/latex/l3packages/xparse/xparse-ge
neric.tex)))
! Undefined control sequence.
<argument> \LaTeX3 error:
Use \cs_replacement_spec:N not \token_get_replace...
l.4 \regexpatchcmd{\hello}{Hi}{Hello}{}{}