[latex3-commits] [latex3/latex2e] array: update \endlongtable and \LT at t@bularcr (WIP) (acba5684)
github at latex-project.org
github at latex-project.org
Sun Dec 10 00:55:56 CET 2023
Repository : https://github.com/latex3/latex2e
On branch : array
Link : https://github.com/latex3/latex2e/commit/acba5684c228b36c5e2b84d29ef391fa4b08cc67
>---------------------------------------------------------------
commit acba5684c228b36c5e2b84d29ef391fa4b08cc67
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Sun Dec 10 00:55:56 2023 +0100
update \endlongtable and \LT at t@bularcr (WIP)
>---------------------------------------------------------------
acba5684c228b36c5e2b84d29ef391fa4b08cc67
base/lttagging.dtx | 23 +++++++++++
required/latex-lab/latex-lab-table.dtx | 71 ++--------------------------------
required/tools/array.dtx | 26 +------------
required/tools/longtable.dtx | 57 ++++++++++++++++++++++++---
4 files changed, 78 insertions(+), 99 deletions(-)
diff --git a/base/lttagging.dtx b/base/lttagging.dtx
index 67e6fefd..5e49a918 100644
--- a/base/lttagging.dtx
+++ b/base/lttagging.dtx
@@ -524,6 +524,29 @@
%
%
%
+% \begin{macro}{\tbl_crcr:n}
+% This macro is used instead of the usual \cs{crcr} at the end of a
+% table. It is deliberately defined without protection because it
+% may get expanded by the scanning mechanism of low-level \TeX{}
+% after a final \cs{cr} (aka \verb=\\=) in the table. In that case
+% it shouldn't stop the expansion and the conditional inside will
+% be false this it just vanishes without doing anything. If there
+% are missing cells (in which case we also haven't see \cs{cr} yet)
+% the socket \texttt{tbl/celldata/missingcount} is executed and
+% then the row is finished with a final \cs{cr}.
+% \begin{macrocode}
+\cs_new:Npn \tbl_crcr:n #1 {
+ \int_compare:nNnT \g_@@_col_int > 0
+ {
+ \tbl_count_missing_cells:n {#1}
+ \cr
+ }
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
% \begin{macrocode}
\ExplSyntaxOff
%<@@=>
diff --git a/required/latex-lab/latex-lab-table.dtx b/required/latex-lab/latex-lab-table.dtx
index 65bf6880..02f8503b 100644
--- a/required/latex-lab/latex-lab-table.dtx
+++ b/required/latex-lab/latex-lab-table.dtx
@@ -972,7 +972,7 @@
%
%
%
-% \subsection{Changes to \pkg{array} commands}
+% \subsection{Misc stuff}
%
% \begin{macro}{\@@_show_curr_cell_data:}
% Show the row/column index and span count for current table cell
@@ -1130,71 +1130,6 @@
%
% \subsection{longtable}
%
-% The end code most stop to insert the endrow too.
-% \begin{macrocode}
-\def\@@_patch_endlongtable{%
- \ar at crcr{endlongtable}
- \noalign{%
- \UseTaggingSocket{tbl/finalize/longtable}
- \int_gzero:N \g_@@_row_int % this prevents considering the next
- % \crcr as another row end.
- \let\LT at entry\LT at entry@chop
- \xdef\LT at save@row{\LT at save@row}}%
- \LT at echunk
- \LT at start
- \unvbox\z@
- \LT at get@widths
- \if at filesw
- {\let\LT at entry\LT at entry@write\immediate\write\@auxout{%
- \gdef\expandafter\noexpand
- \csname LT@\romannumeral\c at LT@tables\endcsname
- {\LT at save@row}}}%
- \fi
- \ifx\LT at save@row\LT@@@@save at row
- \else
- \LT at warn{Column~\@width s~have~changed\MessageBreak
- in~table~\thetable}%
- \LT at final@warn
- \fi
- \endgraf\penalty -\LT at end@pen
- \ifvoid\LT at foot\else
- \global\advance\vsize\ht\LT at foot
- \global\advance\@colroom\ht\LT at foot
- \dimen@\pagegoal\advance\dimen@\ht\LT at foot\pagegoal\dimen@
- \fi
- \endgroup
- \global\@mparbottom\z@
- \endgraf\penalty\z@\addvspace\LTpost
- \ifvoid\footins\else\insert\footins{}\fi
- \UseTaggingSocket{tblvmode/end}%
-}
-% \end{macrocode}
-%
-%
-%
-% \begin{macro}{\@@_patch_LT at t@bularcr}
-%
-% \begin{macrocode}
-\def\@@_patch_LT at t@bularcr{%
- \global\advance\LT at rows\@ne
- \ifnum\LT at rows=\LTchunksize
-% \end{macrocode}
-% At the end of the chunk \verb=\\= is doing something special and
-% so we loose \cs{tbl_count_missing_cells:n}. Below is about the
-% right place to add it do this code branch.
-% \begin{macrocode}
- \UseAlignSocket{tbl/celldata/missingcount}{echunk}
- \gdef\LT at setprevdepth{%
- \prevdepth\z@
- \global\let\LT at setprevdepth\relax}%
- \expandafter\LT at xtabularcr
- \else
- \ifnum0=`{}\fi
- \expandafter\LT at LL@FM at cr
- \fi}
-
-% \end{macrocode}
-% \end{macro}
%
%
%
@@ -1369,10 +1304,10 @@
\seq_new:N \g_@@_LT at lastfoot_rows_seq
\seq_new:N \g_@@_LT at foot_rows_seq
% \cs_set_eq:NN \LT at array\@@_patch_LT at array
- \cs_set_eq:NN \endlongtable\@@_patch_endlongtable
+% \cs_set_eq:NN \endlongtable\@@_patch_endlongtable
\cs_set_eq:NN \LT at start\@@_patch_LT at start
\cs_set_eq:NN \LT at output\@@_patch_LT at output
- \cs_set_eq:NN \LT at t@bularcr\@@_patch_LT at t@bularcr
+% \cs_set_eq:NN \LT at t@bularcr\@@_patch_LT at t@bularcr
\cs_set_eq:NN \LT at end@hd at ft\@@_patch_LT at end@hd at ft
\cs_set_eq:NN \LT at makecaption\@@_patch_LT at makecaption
}
diff --git a/required/tools/array.dtx b/required/tools/array.dtx
index 0977b6fa..c3101e43 100644
--- a/required/tools/array.dtx
+++ b/required/tools/array.dtx
@@ -2712,7 +2712,7 @@ Bug reports can be opened (category \texttt{#1}) at\\%
% because its replacement text isn't longer needed.
% \begin{macrocode}
\def\endarray {
- \ar at crcr{endarray} \egroup
+ \tbl_crcr:n{endarray} \egroup
\UseTaggingSocket{tbl/finalize}
% \end{macrocode}
%
@@ -2739,30 +2739,6 @@ Bug reports can be opened (category \texttt{#1}) at\\%
%
%
%
-% \begin{macro}{\ar at crcr}
-% This macro is used instead of the usual \cs{crcr} at the end of a
-% table. It is deliberately defined without protection because it
-% may get expanded by the scanning mechanism of low-level \TeX{}
-% after a final \cs{cr} (aka \verb=\\=) in the table. In that case
-% it shouldn't stop the expansion and the conditional inside will
-% be false this it just vanishes without doing anything. If there
-% are missing cells (in which case we also haven't see \cs{cr} yet)
-% the socket \texttt{tbl/celldata/missingcount} is executed and
-% then the row is finished with a final \cs{cr}.
-% \begin{macrocode}
-\def\ar at crcr #1 {
- \int_compare:nNnT \g_@@_col_int > 0
- {
-% \UseSocket{tbl/celldata/missingcount} {#1}
- \tbl_count_missing_cells:n {#1}
- \cr
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
%
% \begin{macro}{\endtabular}
% \begin{macro}{\endtabular*}
diff --git a/required/tools/longtable.dtx b/required/tools/longtable.dtx
index 576bf4be..86414ca6 100644
--- a/required/tools/longtable.dtx
+++ b/required/tools/longtable.dtx
@@ -1063,7 +1063,14 @@
% \end{macrocode}
% \end{macro}
%
+%
+%
% \begin{macro}{\LT at array}
+% \begin{macrocode}
+%<@@=tbl>
+\ExplSyntaxOn
+% \end{macrocode}
+%
% Start setting the alignment.
% Based on "\@array" from the \LaTeX\ kernel
% and the \package{array} package.
@@ -1072,8 +1079,6 @@
% "\c at LT@tables". The \LaTeX\ counter "table" is still incremented
% so that "\caption" works correctly.
% \begin{macrocode}
-%<@@=tbl>
-\ExplSyntaxOn
\def\LT at array[#1]#2{%
% \end{macrocode}
%
@@ -1452,7 +1457,16 @@
% \end{macrocode}
% \end{macro}
%
+%
+%
+%
% \begin{macro}{\endlongtable}
+%
+% \begin{macrocode}
+%<@@=tbl>
+\ExplSyntaxOn
+% \end{macrocode}
+%
% Called by "\end{longtable}".
% \begin{macrocode}
\def\endlongtable{%
@@ -1466,8 +1480,20 @@
% \changes{v4.01}{1996/04/11}
% {(DPC) use \cs{noalign} to sneak in \cs{LT at entry@chop}}
% \begin{macrocode}
- \crcr
+ \tbl_crcr:n {endlongtable}
+% \end{macrocode}
+%
+% \begin{macrocode}
\noalign{%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \UseTaggingSocket{tbl/finalize/longtable}
+ \int_gzero:N \g_@@_row_int % this prevents that the next
+ % \crcr is considered to be another row end.
+% \end{macrocode}
+%
+% \begin{macrocode}
\let\LT at entry\LT at entry@chop
\xdef\LT at save@row{\LT at save@row}}%
\LT at echunk
@@ -1507,10 +1533,10 @@
% \changes{v4.04}{1996/05/24}
% {Use \cs{LT at final@warn}}
% \begin{macrocode}
- \ifx\LT at save@row\LT@@save at row
+ \ifx\LT at save@row\LT@@@@save at row
\else
- \LT at warn{Column \@width s have changed\MessageBreak
- in table \thetable}%
+ \LT at warn{Column~ widths~ have~ changed\MessageBreak
+ in~ table~ \thetable}%
\LT at final@warn
\fi
% \end{macrocode}
@@ -1548,6 +1574,8 @@
% \begin{macrocode}
\UseTaggingSocket{tblvmode/end}%
}
+\ExplSyntaxOff
+%<@@=>
% \end{macrocode}
% \end{macro}
%
@@ -1616,6 +1644,10 @@
\protected\def\LT at tabularcr{%
\relax\iffalse{\fi\ifnum0=`}\fi
\@ifstar
+% \end{macrocode}
+% TODO: as we replace crcr later in one case, we probably have to
+% implement some further logic there!
+% \begin{macrocode}
{\def\crcr{\LT at crcr\noalign{\nobreak}}\let\cr\crcr
\LT at t@bularcr}%
{\LT at t@bularcr}}
@@ -1642,8 +1674,13 @@
% \end{macrocode}
% \end{macro}
%
+%
+%
+%
% \begin{macro}{\LT at t@bularcr}
% \begin{macrocode}
+%<@@=tbl>
+\ExplSyntaxOn
\def\LT at t@bularcr{%
% \end{macrocode}
% Increment the counter, and do \env{tabular}'s "\\" or finish the
@@ -1653,6 +1690,12 @@
% \begin{macrocode}
\global\advance\LT at rows\@ne
\ifnum\LT at rows=\LTchunksize
+% \end{macrocode}
+% At the end of the chunk \verb=\\= is doing something special and
+% so we loose \cs{tbl_count_missing_cells:n}. Below is about the
+% right place to add it do this code branch.
+% \begin{macrocode}
+ \tbl_count_missing_cells:n {echunk}
\gdef\LT at setprevdepth{%
\prevdepth\z@
\global\let\LT at setprevdepth\relax}%
@@ -1661,6 +1704,8 @@
\ifnum0=`{}\fi
\expandafter\LT at LL@FM at cr
\fi}
+\ExplSyntaxOff
+%<@@=>
% \end{macrocode}
% \end{macro}
%
More information about the latex3-commits
mailing list.