6

I am trying to compile this MWE:

\documentclass{article}
\newcommand{\hello}{Hi world!}
\usepackage{regexpatch}
\regexpatchcmd{\hello}{Hi}{Hello}{}{}
\begin{document}
\hello
\end{document}

This worked on one MiKTeX system using LaTeX2e patch level 3, but fails on the same system (and another TeX Live one) using LaTeX2e patch level 4:

Working:

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.

Not working:

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}{}{}

Also not working:

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}{}{}
bers
  • 5,404
  • 1
    It turns out \token_get_replace... is \token_get_replacement_spec:N, and it seems that \regexpatchcmd is using that command which is now deprecated. – bers Jan 12 '21 at 06:52
  • 2
    tlmgr restore l3kernel 57088 solved this for now. – bers Jan 12 '21 at 07:04
  • 2
    What took me a bit to understand: this command has been deprecated for quite some time, see https://github.com/latex3/latex2e/blame/ca7d6261a66ed3ec97b12a0ec2fb36c87aa87d9b/texmf/tex/latex/l3kernel/l3deprecation.def#L114-L115, effective 2021-01-01. But that did not go into effect that day (with patch level 3) because what counts is not the current date, but the date of the kernel - and the date of the kernel only increased with the update to patch level 4 which was build in 2021 despite the 2020 version number. – bers Jan 12 '21 at 07:10
  • 3
    sed -i "s/token_get_\(replacement\|prefix\|arg\)_spec/cs_\1_spec/; s/cs_arg_spec/cs_argument_spec/" \kpsewhich regexpatch.sty`` also works with the most recent kernel. – bers Feb 23 '21 at 08:07
  • 1
    This has been fixed by regexpatch v0.2f (Released 2021/03/21). – bers Mar 26 '21 at 11:06

0 Answers0