Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing \ExplSyntaxOff in xparse-2020-10-01.sty #504

Closed
komascript opened this issue Feb 16, 2021 · 3 comments
Closed

Missing \ExplSyntaxOff in xparse-2020-10-01.sty #504

komascript opened this issue Feb 16, 2021 · 3 comments

Comments

@komascript
Copy link

xparse-2020-10-01.sty has a \ExplSyntaxOn but no corresponding \ExplSyntaxOff. Because of this, with

\RequirePackage[2020/02/01]{latexrelease}
\documentclass{article}
\typeout{space catcode before loading xsparse=\the\catcode`\ }%
\RequirePackage{xparse}%
\typeout{space catcode after loading xparse=\the\catcode`\ }%
\begin{document}
Test
\end{document}

you get

space catcode before loading xsparse=10
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def))
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3packages/xparse/xparse-2020-10-01.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3packages/xparse/xparse-generic.tex)))
space catcode after loading xparse=9

But with

\RequirePackage[2020/02/02]{latexrelease}
\documentclass{article}
\typeout{space catcode before loading xsparse=\the\catcode`\ }%
\RequirePackage{xparse}%
\typeout{space catcode after loading xparse=\the\catcode`\ }%
\begin{document}
Test
\end{document}

The result is as expected:

space catcode before loading xsparse=10
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def))
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3packages/xparse/xparse-2020-10-01.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3packages/xparse/xparse-generic.tex)))
space catcode after loading xparse=10
@PhelypeOleinik PhelypeOleinik self-assigned this Feb 16, 2021
@komascript
Copy link
Author

BTW: IMHO same bug in xparse-2018-04-12.sty, but I was not able force loading this version using latexrelease.

@PhelypeOleinik
Copy link
Member

PhelypeOleinik commented Feb 16, 2021

@komascript To load xparse-2018-04-12.sty you need real LaTeX 2020/02/02 or earlier (emulated with latexrelease won't be enough). More precisely, xparse.sty loads xparse-2018-04-12.sty if \NewDocumentCommand is undefined, and if \fmtversion<2020-10-01.

@PhelypeOleinik PhelypeOleinik transferred this issue from latex3/latex3 Feb 16, 2021
@PhelypeOleinik
Copy link
Member

Hm, I transferred this issue because the bug is not in xparse: note the same files are loaded in both cases, and you get the same behaviour with any expl3-based package:

\begin{filecontents}{myexpl3pkg.sty}
\ProvidesExplPackage{test}{2020-20-20}{1.0}{Testing}
\end{filecontents}
%
\RequirePackage[2020/02/01]{latexrelease}
\documentclass{article}
\typeout{space catcode before loading myexpl3pkg=\the\catcode`\ }%
\RequirePackage{myexpl3pkg}
\typeout{space catcode after loading myexpl3pkg=\the\catcode`\ }%
\begin{document}
Test
\end{document}

The \ExplSyntaxOn/Off status is managed by \@pushfilename and \@popfilename in the same way as \makeatletter/other. Prior to 2020-02-02 the expl3 syntax management was patched by expl3.sty into \@push/\@popfilename, and after the expl3 integration it is there by default. The problem is that rolling back removes that part of the code and the automatic \ExplSyntaxOff after the package ends is no longer there.

I think this is one scenario where rolling back shouldn't roll back all the way through. We can either do a fake rollback and keep the expl3 syntax management in place (after all rolling back doesn't remove expl3), or do a clever checking whether expl3.sty is loaded and if it isn't, undefine \ProvidesExplPackage, so that a package will need to load expl3.sty explicitly, thus apply the patch... I don't like the looks of the second option :)

PhelypeOleinik added a commit that referenced this issue Mar 28, 2021
@PhelypeOleinik PhelypeOleinik added fixed in dev Fixed in development branch, not in stable release and removed to analyse further labels Mar 28, 2021
@PhelypeOleinik PhelypeOleinik added this to Pool (unscheduled issues) in upcoming LaTeX2e releases via automation Mar 28, 2021
@PhelypeOleinik PhelypeOleinik added this to the Release 2021 Spring milestone Mar 28, 2021
@PhelypeOleinik PhelypeOleinik moved this from Pool (unscheduled issues) to Done in dev in upcoming LaTeX2e releases Mar 28, 2021
upcoming LaTeX2e releases automation moved this from Done in dev to Done May 4, 2021
@FrankMittelbach FrankMittelbach removed the fixed in dev Fixed in development branch, not in stable release label Jun 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants