Change to output routine code breaks latex afterpage package

Frank Mittelbach frank.mittelbach at latex-project.org
Sun Mar 24 20:53:46 CET 2024


Am 24.03.24 um 20:47 schrieb David Carlisle:
> 
> It appears that the change
> 
> 
> https://github.com/TeX-Live/texlive-source/commit/d17e5e0968269f781f3fe972b705fff43ea2e139 <https://github.com/TeX-Live/texlive-source/commit/d17e5e0968269f781f3fe972b705fff43ea2e139>
> 
> avoid crashing on devious uses of \output and write braces, from DRF …
> 
> breaks the afterpage package that has been part of the core latex2e 
> release since the start.
> 
> see
> 
> https://github.com/latex3/latex2e/issues/1311 
> <https://github.com/latex3/latex2e/issues/1311>
> 
> Can this be reverted/adjusted so the package still works?
> 
> \documentclass{report}
> \usepackage{afterpage}
> \begin{document}
> Page \thepage
> \afterpage{Hi!}
> \newpage
> Page \thepage
> \newpage
> Page \thepage
> \end{document}
> 
> produces 3 pages  with Hi on page 2 in all previous releases, but 
> produces 4 pages with Hi on page 4 in tl2024


Basically it seems that the change  stops \aftergroup working inside the 
OR, i.e., an \aftergroup in the output routine is simply lost instead of 
being executed after the output routine has ended.

Example, based on the example given in the commit:

\catcode`\{=1 \catcode`\}=2
\def\makepage{
  \hrule width 2in height 1in
  \vskip 1in plus 10in
  \hrule width 2in height 1in
  \penalty-10000
}
\output{\global\advance\count0 by 1 \shipout\box255\extra}
\let\lb={
\let\rb=}
\message{RELAX}
\let\extra=\relax
\makepage
\message{DONE_RELAX}
\message{AFTERGROUP}
\def\extra{\aftergroup\foo}              % <--- this should produce a
                                          %      undefined error later
\makepage
\message{DONE AFTERGROUP -- foo lost}    % <--- but it doesn't
\message{AFTERGROUP 2}
\def\extra{\aftergroup\foo}
\def\foo{\aftergroup\foofoo}
\makepage
\message{DONE AFTERGROUP 2 -- foo lost}
\message{EXTRA_RIGHT_BRACE}
\let\extra=}
\makepage
\message{DONE_EXTRA_RIGHTBRACE}
\message{EXTRA_LEFT_BRACE}
\let\extra={
\makepage


--------

frank


More information about the tex-live mailing list.