Skip to content

Commit

Permalink
fix for #1585
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankMittelbach committed Dec 17, 2024
1 parent 176699b commit 200dff5
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 5 deletions.
34 changes: 29 additions & 5 deletions required/tools/array.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
% \begin{macrocode}
%<+package>\NeedsTeXFormat{LaTeX2e}[2024/06/01]
%<+package>\ProvidesPackage{array}
%<+package> [2024/10/17 v2.6g Tabular extension package (FMi)]
%<+package> [2024/12/17 v2.6h Tabular extension package (FMi)]
%
% \fi
%
Expand Down Expand Up @@ -2242,7 +2242,7 @@ Bug reports can be opened (category \texttt{#1}) at\\%
%
%
%
% \begin{macro}{\@startpbox}
% \begin{macro}{\@startpbox,\@@@@startpbox}
% In =\@classz= the macro =\@startpbox= is used.
% The width of the \textsf{parbox} is passed as an argument.
% =\vcenter=, =\vtop= or =\vbox= are already in the
Expand Down Expand Up @@ -2286,6 +2286,19 @@ Bug reports can be opened (category \texttt{#1}) at\\%
\everypar{}}%
}
% \end{macrocode}
%
% \changes{v2.6h}{2024/12/17}{New \cs{@@@@startpbox} to do the real work
% after preamble was built (gh/1585)}
% Starting with 2.6h \cs{@startpbox} is only used during the
% built-up of the preamble changing there to \cs{@@@@startpbox}
% To do the real work. For an explanation of this code see
% the documentation in \cs{@mkpream}. We keep the \cs{@startpbox}
% definition on top-level in case there are tabular packages that
% built the preamble differently and expect that it contains
% \cs{@startpbox} (\pkg{longtable} at the moment).
% \begin{macrocode}
\let\@@@@startpbox\@startpbox
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@endpbox}
Expand Down Expand Up @@ -3285,12 +3298,23 @@ Bug reports can be opened (category \texttt{#1}) at\\%
% simple length expression, but with the calc package involved it
% could break under an "\edef" operation, which is how the preamble
% is constructed. We now make use of "\unexpanded" here to prevent that. The
% "\expandafter" gymnastics is necessary to expand the "#1" at least
% "\expandafter" gymnastics is necessary to expand the "#1" exactly
% once (since it will get "\@nextchar" as its value and need its
% content!
% content). However, once added to the preamble, no further
% expansion should happen if the preamble is extended. Therefore we
% change from \cs{@startpbox} to \cs{@@@@startpbox}. The latter
% then has a trivial definition and expands (including its
% argument) to itself while the preamble is being built. Outside of this
% preamble built-up \cs{@@@@startpbox} that does the actual work.
% The definition for \cs{@startpbox} is only ever used during
% \changes{v2.6h}{2024/12/17}{Expand argument of \cs{@startpbox}
% exactly once while the preamble is built and use
% \cs{@@@@startpbox} later to do the real work (gh/1585)}
% \begin{macrocode}
\def\@startpbox##1{\unexpanded\expandafter{\expandafter
\@startpbox\expandafter{##1}}}\let\@endpbox\relax
\@@@@startpbox\expandafter{##1}}}%
\def\@@@@startpbox##1{\unexpanded{\@@@@startpbox{##1}}}%
\let\@endpbox\relax
\let\do@row@strut\relax
\let\ar@align@mcell\relax
% \end{macrocode}
Expand Down
6 changes: 6 additions & 0 deletions required/tools/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ completeness or accuracy and it contains some references to files that
are not part of the distribution.
=======================================================================

2024-12-17 Frank Mittelbach <[email protected]>

* array.dtx (section{The macros \texttt{\textbackslash @classz}):
Expand argument of \@startpbox exactly once while the preamble is built
and use \@@startpbox later to do the real work (gh/1585)

2024-11-12 Frank Mittelbach <[email protected]>
* multicol.dtx (subsection{Tagging support}):
Added another socket to support tagging.
Expand Down
27 changes: 27 additions & 0 deletions required/tools/testfiles/github-1585.lvt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
% This should not produce errors
\documentclass{article}

\input{test2e}

\usepackage{array}

\begin{document}

\START

\typeout{This should show no errors but did!}

\newcommand\hidden{\fpeval{15}pt}

\begin{tabular}{p{\fpeval{15}pt}p{\hidden}p{\fpeval{15}pt}p{\fpeval{15}pt}}
a & b & c & d
\end{tabular}


\begin{tabular}{p{\fpeval{15}pt}lll}
a & b & c & d
\end{tabular}

\newpage
\TIMO
\end{document}
10 changes: 10 additions & 0 deletions required/tools/testfiles/github-1585.tlg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
This should show no errors but did!
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <7> on input line ....
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <5> on input line ....
[1
]
(github-1585.aux)

0 comments on commit 200dff5

Please sign in to comment.