You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The new definition for \par starts out with a conditional testing the current mode and if hmode do certain things.
This fails in a curious scenario which is really wrong coding elsewhere, but nevertheless we should safeguard for it:
Consider the following input
text \vskip \z@ \par
The scan for the glue actually "expands" \par here because \z@is a dimen and there could be some plus or minus component following. The correct coding according to the TeXbook would be to use \z@skipinstead for precisely that reason.
Nevertheless most of the time that would be harmless even now with \parchecking the mode. However, the listings package redefines \vskip as follows:
With that it is suddenly no longer harmless because now the \afterassignment is injected into the middle of the conditional
and only then it hits the original \vskip which switches to vertical mode. As a result the code in \par complains about a mode change in the para/endhook because that is supposedly the only code execuded in the middle of that conditional.
Rather a strange combination of circumstances but with listingsbeing used rather widely this needs a first aid which we will provide asap.
A bit of a surprising fact: the new definition for \par is defined as \protected\def, however, that doesn't stop the glue scanner to look into the definition.
Minimal example showing the bug
\RequirePackage{latexbug} % we accept warnings about external packages here htis time!\documentclass{article}
\usepackage{scrlayer-scrpage}
\usepackage{listings}
\begin{document}
abc\\[44\baselineskip] abc
\begin{lstlisting}[caption={abc blub}]
code
\end{lstlisting}
\end{document}
Log file (required) and possibly PDF file
As a result we get:
./parahook-error.tex:13: LaTeX hooks Error: Illegal mode change in hook 'para/end'.
(hooks) Hook code did not remain in horizontal mode.
For immediate help type H <return>.
...
l.13 \begin{lstlisting}[caption={abc blub}]
which is obviously bogus.
The text was updated successfully, but these errors were encountered:
Brief outline of the bug
The new definition for
\par
starts out with a conditional testing the current mode and if hmode do certain things.This fails in a curious scenario which is really wrong coding elsewhere, but nevertheless we should safeguard for it:
Consider the following input
The scan for the glue actually "expands"
\par
here because\z@
is a dimen and there could be some plus or minus component following. The correct coding according to the TeXbook would be to use\z@skip
instead for precisely that reason.Nevertheless most of the time that would be harmless even now with
\par
checking the mode. However, thelistings
package redefines\vskip
as follows:With that it is suddenly no longer harmless because now the
\afterassignment
is injected into the middle of the conditionaland only then it hits the original
\vskip
which switches to vertical mode. As a result the code in\par
complains about a mode change in thepara/end
hook because that is supposedly the only code execuded in the middle of that conditional.Rather a strange combination of circumstances but with
listings
being used rather widely this needs a first aid which we will provide asap.A bit of a surprising fact: the new definition for
\par
is defined as\protected\def
, however, that doesn't stop the glue scanner to look into the definition.Minimal example showing the bug
Log file (required) and possibly PDF file
As a result we get:
which is obviously bogus.
The text was updated successfully, but these errors were encountered: