Problems with the listings package
Frank Mittelbach
frank.mittelbach at latex-project.org
Sat Jan 25 01:07:33 CET 2025
Am 24.01.25 um 22:55 schrieb Karl Berry:
> Hi Jobst,
>
> I found that at the moment the file listings.dtx isn't
> formattable. I found the culprit in the comparison of different
> flexible columns format, I attach two MWEs (one tabular_00.dtx for
> .dtx-files, the other tabular_01.tex for .tex- files), which are
> formattable with a pdflatex version at least from Sep. 2024, but not
> with the current version
>
> Is this incompatibility intended or will ist be fixed? If it is
> intended, is there a way to use the old documentation code?
Hi Jobst,
I wouldn't say that the "incompatibility" with a low-level error was
intended, but the starting problem is that your input is not valid
syntax and in some sense it was by lucky chance that something worked.
Basically lstlistings is a vertical environment and it initiates end
\par handling (\@doendpe) in its code. However a "c" column is LR and
not supposed to handled vertical environments, e.g., you can't put a
list there or an equation, etc unless you put a minipage around it
(which means the column becomes like p{3cm}).
Now if you try to use itemize or equation, then some parts of LaTeX
detect that and say \item not allowed or \eqno not allowed (low-level
TeX error) but lstlistings happly does its stuff.
Now problem is we fix an old bad fairly bad bug: a lot of people did
things like
{<some decls>
\begin{equation} ...
\end{equation}}
and then par handling stopped at the closing } for the decls. So the
next line got indentation even if it shouldn't.
This got fixed and now \@doendpe slowly migrates out to the outer level
-- only it never expected to be called in internal hmode so it injects
stuff near the end of the table and confuses the \cr handling and that
gives you this low-level error.
For the moment, try
\makeatletter
\def\propagate at doendpe {%
% \showthe\currentgrouptype
%
\if at endpe
\ifnum\currentgrouptype <\tw@
\@doendpe
\else
\ifnum\currentgrouptype =14
\@doendpe
\fi
\fi
\fi
}
\makeatother
to get your stuff compiling again (this is not going to be the final
solution, though).
However, please update the source. Using display envs directly in
restricted hmode, when they invoke vertical para handling is simply
wrong and the final correction/improvement here might get you an
official LaTeX error rather than the low-level one, i.e., in that sense
it is intended to catch such incorrect input (like other envs do).
frank
More information about the tex-live
mailing list.