[latex3-commits] [latex3/latex2e] array: more updates and documentation (b86ce598)
github at latex-project.org
github at latex-project.org
Fri Dec 15 17:36:11 CET 2023
Repository : https://github.com/latex3/latex2e
On branch : array
Link : https://github.com/latex3/latex2e/commit/b86ce5984b5bd10557fc5d353a2cc71aa7036fcc
>---------------------------------------------------------------
commit b86ce5984b5bd10557fc5d353a2cc71aa7036fcc
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Fri Dec 15 17:36:11 2023 +0100
more updates and documentation
>---------------------------------------------------------------
b86ce5984b5bd10557fc5d353a2cc71aa7036fcc
base/lttagging.dtx | 244 +++++++++++++++++----
.../testfiles-table-luatex/table-006-longtable.tlg | 2 +-
.../testfiles-table-luatex/table-007-longtable.tlg | 2 +-
.../testfiles-table-luatex/table-021-longtable.tlg | 2 +-
.../testfiles-table-pdftex/table-006-longtable.tlg | 2 +-
.../testfiles-table-pdftex/table-007-longtable.tlg | 2 +-
.../testfiles-table-pdftex/table-012-caption.tlg | 2 +-
.../table-013-longtable-hyperref.tlg | 2 +-
.../latex-lab/testfiles-table-pdftex/table-016.tlg | 4 +-
.../latex-lab/testfiles-table-pdftex/table-019.tlg | 2 +-
.../latex-lab/testfiles-table-pdftex/table-020.tlg | 6 +-
.../testfiles-table-pdftex/table-021-longtable.tlg | 2 +-
required/tools/array.dtx | 25 +--
required/tools/longtable.dtx | 21 +-
14 files changed, 232 insertions(+), 86 deletions(-)
diff --git a/base/lttagging.dtx b/base/lttagging.dtx
index 6468c761..9f0354c8 100644
--- a/base/lttagging.dtx
+++ b/base/lttagging.dtx
@@ -80,6 +80,61 @@
%
% \section{General support for tagged output}
%
+% \DescribeMacro\SuspendTagging
+% \DescribeMacro\ResumeTagging
+% The are places in code where it is import top stop any tagging
+% activities, e.g., when we are doing trial typesetting that it is done
+% several times. In such a case one must tag only the final version
+% that is actually used, otherwise tagging structures are allowed
+% which then do not end up in the PDF and confuse the mechanism. For
+% this we have two commands that can be used in packages:
+% \cs{SuspendTagging} and \cs{ResumeTagging}. They are available as
+% part of the \LaTeX{} kernel, so that they can be safely used in
+% packages whether or not tagging is requested. By default they do
+% nothing.
+%
+% TODO: the corresponding L3 layer commands should also have a dummy
+% definition in the kernel!
+%
+% \DescribeMacro\UseTaggingSocket
+% \DescribeMacro\tag_socket_use:n
+% \DescribeMacro\tag_socket_use:nn
+% To support tagging in packages we use sockets with names starting
+% with \texttt{tagsupport/}. Usually, these sockets have exactly two
+% plugs defined:
+% \plug{noop} (when no tagging is requested or tagging is not wanted
+% for some reason) and a second plug that enables the tagging. There
+% may be more, e.g., tagging with special debugging, etc., but right
+% now it is usually just on or off.
+%
+% Given that we sometimes have to suspend tagging, it would be fairly
+% inefficient to put different plugs into these sockets whenever that
+% happens. We therefore offer \cs{UseTaggingSocket} which is like
+% \cs{UseSocket} except that the socket name is specified without
+% \texttt{tagsupport/}, i.e.,
+% \begin{quote}
+% \verb=\UseTaggingSocket{foo}= $\to$
+% \verb=\UseSocket{tagsupport/foo}=
+% \end{quote}
+% Beside being slightly shorter, the big advantage is that this way
+% we can change \cs{UseTaggingSocket} to do nothing when tagging is
+% suspended with \cs{SuspendTagging} instead of changing the plugs of
+% the tagging support sockets back and forth.
+%
+% It is possible to use the tagging support sockets with
+% \cs{UseSocket} directly, but in this case the socket remains active
+% if \cs{SuspendTagging} is in force. There my be reasons for doing
+% that but in general we expect to always use \cs{UseTaggingSocket}.
+%
+% The L3 programming layer versions \cs{tag_socket_use:n} and
+% \cs{tag_socket_use:nn} are slightly more efficient than
+% \cs{UseTaggingSocket} because they do not have to determine how
+% many arguments the socket takes when disabling it, so in code that
+% is using the L3 progamming layer we recomment to use them instead
+% of the CamelCase command.
+%
+%
+%
% \begin{macro}{\SuspendTagging,\ResumeTagging}
%
% In the kernel, these two commands get dummy definitons so that
@@ -115,11 +170,68 @@
}
}
}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tag_socket_use:n,
+% \tag_socket_use:nn,
+% \UseTaggingSocket,
+% }
+% Again this is not the final definition for the kernel; it is just
+% a version to get going while some partsof the kernel support are
+% still missing.
+% \begin{macrocode}
+\AddToHook{begindocument}[kernel]{
+ \cs_if_exist:NF \tag_if_active:T
+ {
+ \prg_new_conditional:Npnn \tag_if_active: { p , T , TF, F }
+ { \prg_return_false: }
+ }
+}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \tag_socket_use:n #1 {
+ \tag_if_active:T
+ { \UseSocket {tagsupport/#1} }
+}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \tag_socket_use:nn #1#2 {
+ \tag_if_active:T
+ { \UseSocket {tagsupport/#1} {#2} }
+}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \UseTaggingSocket #1 {
+ \tag_if_active:TF
+ { \UseSocket{tagsupport/#1} }
+ {
+ \int_case:nnF
+ { \int_use:c { c__socket_tagsupport/#1_args_int } }
+ {
+ 0 \prg_do_nothing:
+ 1 \use_none:n
+ 2 \use_none:nn
+% \end{macrocode}
+% We do not expect tagging sockets with more than one or two
+% arguments, so for now we only provide those.
+% \begin{macrocode}
+ }
+ \ERRORusetaggingsocket
+ }
+}
\ExplSyntaxOff
% \end{macrocode}
% \end{macro}
%
%
+%
+%
+%
+%
% \subsection{Tagging support for table/tabular packages}
%
% The code uses a number of sockets to inject the tagging
@@ -233,49 +345,6 @@
%
%
%
-% \begin{macro}{\tag_socket_use:n,
-% \tag_socket_use:nn,
-% \UseTaggingSocket,
-% }
-%
-% \begin{macrocode}
-\ExplSyntaxOn
-
-\AddToHook{begindocument}[kernel]{
- \cs_if_exist:NF \tag_if_active:T
- {
- \prg_new_conditional:Npnn \tag_if_active: { p , T , TF, F }
- { \prg_return_false: }
- }
-}
-
-\cs_new_protected:Npn \tag_socket_use:n #1 {
- \tag_if_active:T
- { \UseSocket {tagsupport/#1} }
-}
-\cs_new_protected:Npn \tag_socket_use:nn #1#2 {
- \tag_if_active:T
- { \UseSocket {tagsupport/#1} {#2} }
-}
-
-\cs_new_protected:Npn \UseTaggingSocket #1 {
- \tag_if_active:TF
- { \UseSocket{tagsupport/#1} }
- {
- \int_case:nnF
- { \int_use:c { c__socket_tagsupport/#1_args_int } }
- {
- 0 \prg_do_nothing:
- 1 \use_none:n
- 2 \use_none:nn
- }
- \ERRORusetaggingsocket
- }
-}
-\ExplSyntaxOff
-% \end{macrocode}
-% \end{macro}
-%
%
%
% \section{For lttab.dtx parked here for now}
@@ -289,17 +358,29 @@
%
% \subsection{Variables for row, column and span counting}
%
+% This part needs a decision on names for various integer registers
+% as as well as a decision if those should be also made available for
+% \LaTeXe{}-style packages in form of 2e names and or as
+% non-internals for the L3 programming layer.
%
+% At the moment they are all internal but this probably has to change.
%
% \begin{macro}{
% \g_@@_col_int,
% \g_@@_row_int,
% \g_@@_span_tl,
% \g_@@_table_cols_tl}
-% \cs{g_@@_row_int} holds the current row number in the table. The value
-% \texttt{0} means we haven't yet processed the table preamble. It
-% is incremented by every \cs{cr} including the one ending the
-% table preamble.
+%
+% \cs{g_@@_row_int} holds the current row number in the table. The
+% value \texttt{0} means we haven't yet processed the table
+% preamble (or in case of longtable are just in front of the next
+% chunk to be processed). It is incremented by every \cs{cr}
+% including the one ending the table preamble.
+%
+% TODO: due to the gymnastics needed inside the longtable code the
+% row counter is directly exposed there rather than hidden by
+% interfaces. This needs changing when it is decided how to manage
+% these counters.
%
% \cs{g_@@_col_int} holds the current column number. The value
% \texttt{0} means we have not yet started the table or just finished a table row
@@ -379,7 +460,9 @@
% \subsection{Interface commands}
%
% All interface commands for the cell number determination have to be
-% public because they are needed in other packages as well, e.g., longtable.
+% public on some level because they are needed in other packages as
+% well, e.g., longtable. We may or may not also want to provide 2e
+% style names for them.
%
% \begin{macro}{\tbl_update_cell_data:}
% Updating cell data in columns after the first means we have to
@@ -429,6 +512,16 @@
% \end{macro}
%
%
+% \begin{macro}{\tbl_save_outer_table_cols:}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \tbl_save_outer_table_cols: {
+ \tl_set_eq:NN \l_@@_saved_table_cols_tl \g_@@_table_cols_tl
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
% \begin{macro}{\tbl_count_table_cols:}
% Current implementation of \cs{@mkpream} uses the scratch counter
% \cs{count@} to keep track of the number of toks registers it needs
@@ -484,7 +577,21 @@
%
%
%
+% \begin{macro}{\tbl_update_cell_data_for_next_row:}
+% \begin{macrocode}
+\cs_new_protected:Npn \tbl_update_cell_data_for_next_row: {
+ \int_gincr:N \g_@@_row_int % this row about to start
+ \int_gzero:N \g_@@_col_int % we are before first col
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
% \begin{macro}{\tbl_init_cell_data_for_row:}
+% If we start processing a cell in the first column we set
+% \cs{g_@@_col_int} to \texttt{1} as we are no longer "at" but "in"
+% the first column. We also set \cs{g_@@_span_tl} to its default
+% value (not spanning cells).
% \begin{macrocode}
\cs_new_protected:Npn \tbl_init_cell_data_for_row: {
\int_gset:Nn \g_@@_col_int {1}
@@ -494,6 +601,47 @@
% \end{macro}
%
%
+% \begin{macro}{\tbl_if_row_was_started:T,
+% \tbl_if_row_was_started:TF}
+% We use \cs{g_@@_col_int} equal zero to indicate that we are just
+% after a TR (i.e.n between rows or at the very beginning of the
+% table). Using the row
+% count is not so good as longtable may split the table in chunks.
+%
+% These conditionals have to be expandable (i.e., unprotected) as
+% they are sometimes executed when \TeX{} is scanning inside a table.
+% \begin{macrocode}
+\cs_new:Npn \tbl_if_row_was_started:T {
+ \int_compare:nNnT \g_@@_col_int > 0
+}
+\cs_new:Npn \tbl_if_row_was_started:TF {
+ \int_compare:nNnTF \g_@@_col_int > 0
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\tbl_incr_row_count:}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \tbl_incr_row_count: {
+ \int_gincr:N \g_@@_row_int
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\tbl_inbetween_rows:}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \tbl_inbetween_rows: {
+ \int_gzero:N \g_@@_col_int
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
%
%
%
diff --git a/required/latex-lab/testfiles-table-luatex/table-006-longtable.tlg b/required/latex-lab/testfiles-table-luatex/table-006-longtable.tlg
index 5e6bb078..28821efb 100644
--- a/required/latex-lab/testfiles-table-luatex/table-006-longtable.tlg
+++ b/required/latex-lab/testfiles-table-luatex/table-006-longtable.tlg
@@ -2219,7 +2219,7 @@ braces):
> {{Document}{Document}}
> {{Root}{StructTreeRoot}}.
[Sockets] ==> Socket 'tagsupport/tbl/longtable/finalize' containing plug 'Table' used.
---longtable--> chunk row: 21 row: 0 column: 0
+--longtable--> chunk row: 21 row: 22 column: 0
[Sockets] ==> Socket 'tagsupport/tbl/longtable/head' containing plug 'Table' used.
[Sockets] ==> Socket 'tagsupport/tbl/longtable/foot' containing plug 'Table' used.
[Sockets] ==> Socket '@makecol/outputbox' containing plug 'footnotes-floats' used.
diff --git a/required/latex-lab/testfiles-table-luatex/table-007-longtable.tlg b/required/latex-lab/testfiles-table-luatex/table-007-longtable.tlg
index fe91aea6..a9a4c0b0 100644
--- a/required/latex-lab/testfiles-table-luatex/table-007-longtable.tlg
+++ b/required/latex-lab/testfiles-table-luatex/table-007-longtable.tlg
@@ -1250,7 +1250,7 @@ braces):
> {{Document}{Document}}
> {{Root}{StructTreeRoot}}.
[Sockets] ==> Socket 'tagsupport/tbl/longtable/finalize' containing plug 'Table' used.
---longtable--> chunk row: 11 row: 0 column: 0
+--longtable--> chunk row: 11 row: 12 column: 0
[Sockets] ==> Socket 'tagsupport/tbl/longtable/head' containing plug 'Table' used.
[Sockets] ==> Socket 'tagsupport/tbl/longtable/foot' containing plug 'Table' used.
[Sockets] ==> Socket '@makecol/outputbox' containing plug 'footnotes-floats' used.
diff --git a/required/latex-lab/testfiles-table-luatex/table-021-longtable.tlg b/required/latex-lab/testfiles-table-luatex/table-021-longtable.tlg
index 0ec0ee84..030c83c1 100644
--- a/required/latex-lab/testfiles-table-luatex/table-021-longtable.tlg
+++ b/required/latex-lab/testfiles-table-luatex/table-021-longtable.tlg
@@ -51,7 +51,7 @@ Don't change this file in any respect.
[Sockets] ==> Socket 'tagsupport/tbl/row/end' containing plug 'TR' used.
==> stucture stored for row 3: 16,17,18
[Sockets] ==> Socket 'tagsupport/tbl/longtable/finalize' containing plug 'Table' used.
---longtable--> chunk row: 3 row: 0 column: 0
+--longtable--> chunk row: 3 row: 4 column: 0
[Sockets] ==> Socket 'tagsupport/tbl/longtable/head' containing plug 'Table' used.
[Sockets] ==> Socket 'tagsupport/tbl/longtable/foot' containing plug 'Table' used.
[Sockets] ==> Socket 'tagsupport/tbl/vmode/end' containing plug 'Table' used.
diff --git a/required/latex-lab/testfiles-table-pdftex/table-006-longtable.tlg b/required/latex-lab/testfiles-table-pdftex/table-006-longtable.tlg
index ece0a3a3..2cd1dde0 100644
--- a/required/latex-lab/testfiles-table-pdftex/table-006-longtable.tlg
+++ b/required/latex-lab/testfiles-table-pdftex/table-006-longtable.tlg
@@ -2345,7 +2345,7 @@ braces):
> {{Document}{Document}}
> {{Root}{StructTreeRoot}}.
[Sockets] ==> Socket 'tagsupport/tbl/longtable/finalize' containing plug 'Table' used.
---longtable--> chunk row: 21 row: 0 column: 0
+--longtable--> chunk row: 21 row: 22 column: 0
[Sockets] ==> Socket 'tagsupport/tbl/longtable/head' containing plug 'Table' used.
tagpdf DEBUG Info: MC begin inserted with options: artifact [on line ...]
tagpdf DEBUG Info: MC end inserted [on line ...]
diff --git a/required/latex-lab/testfiles-table-pdftex/table-007-longtable.tlg b/required/latex-lab/testfiles-table-pdftex/table-007-longtable.tlg
index 7c5a7e7c..df17fbed 100644
--- a/required/latex-lab/testfiles-table-pdftex/table-007-longtable.tlg
+++ b/required/latex-lab/testfiles-table-pdftex/table-007-longtable.tlg
@@ -1319,7 +1319,7 @@ braces):
> {{Document}{Document}}
> {{Root}{StructTreeRoot}}.
[Sockets] ==> Socket 'tagsupport/tbl/longtable/finalize' containing plug 'Table' used.
---longtable--> chunk row: 11 row: 0 column: 0
+--longtable--> chunk row: 11 row: 12 column: 0
[Sockets] ==> Socket 'tagsupport/tbl/longtable/head' containing plug 'Table' used.
tagpdf DEBUG Info: MC begin inserted with options: artifact [on line ...]
tagpdf DEBUG Info: MC end inserted [on line ...]
diff --git a/required/latex-lab/testfiles-table-pdftex/table-012-caption.tlg b/required/latex-lab/testfiles-table-pdftex/table-012-caption.tlg
index 65dc4ab2..97a96131 100644
--- a/required/latex-lab/testfiles-table-pdftex/table-012-caption.tlg
+++ b/required/latex-lab/testfiles-table-pdftex/table-012-caption.tlg
@@ -69,7 +69,7 @@ Don't change this file in any respect.
==> Inserting 1 additional cell(s) into previous row:
==> current cell data: 11,1,1
==> stucture stored for row 11: 35,36
---longtable--> chunk row: 9 row: 0 column: 0
+--longtable--> chunk row: 9 row: 12 column: 0
! Infinite glue shrinkage found in box being split.
\__box_dim_eval:n ...box_dim_eval:w #1\scan_stop:
l. ...\end{longtable}
diff --git a/required/latex-lab/testfiles-table-pdftex/table-013-longtable-hyperref.tlg b/required/latex-lab/testfiles-table-pdftex/table-013-longtable-hyperref.tlg
index 88fefb75..430466ac 100644
--- a/required/latex-lab/testfiles-table-pdftex/table-013-longtable-hyperref.tlg
+++ b/required/latex-lab/testfiles-table-pdftex/table-013-longtable-hyperref.tlg
@@ -5,7 +5,7 @@ Don't change this file in any respect.
label
--longtable--> chunk row: 1 row: 1 column: 1
--longtable--> chunk row: 1 row: 2 column: 2
---longtable--> chunk row: 1 row: 0 column: 0
+--longtable--> chunk row: 1 row: 3 column: 0
Completed box being shipped out [1]
\vbox(633.0+0.0)x407.0
.\hbox(0.0+0.0)x0.0
diff --git a/required/latex-lab/testfiles-table-pdftex/table-016.tlg b/required/latex-lab/testfiles-table-pdftex/table-016.tlg
index ffea349c..ef836bb1 100644
--- a/required/latex-lab/testfiles-table-pdftex/table-016.tlg
+++ b/required/latex-lab/testfiles-table-pdftex/table-016.tlg
@@ -5,12 +5,12 @@ Don't change this file in any respect.
--longtable--> chunk row: 1 row: 1 column: 1
--longtable--> chunk row: 2 row: 2 column: 3
--longtable--> chunk row: 2 row: 3 column: 1
---longtable--> chunk row: 2 row: 0 column: 0
+--longtable--> chunk row: 2 row: 4 column: 0
==> Table has 3 columns
--longtable--> chunk row: 0 row: 0 column: 0
--longtable--> chunk row: 1 row: 1 column: 1
--longtable--> chunk row: 2 row: 2 column: 3
--longtable--> chunk row: 2 row: 3 column: 1
---longtable--> chunk row: 2 row: 0 column: 0
+--longtable--> chunk row: 2 row: 4 column: 0
[1
] (table-016.aux)
diff --git a/required/latex-lab/testfiles-table-pdftex/table-019.tlg b/required/latex-lab/testfiles-table-pdftex/table-019.tlg
index 4fb0078c..b780bf43 100644
--- a/required/latex-lab/testfiles-table-pdftex/table-019.tlg
+++ b/required/latex-lab/testfiles-table-pdftex/table-019.tlg
@@ -227,7 +227,7 @@ Don't change this file in any respect.
--longtable--> chunk row: 5 row: 15 column: 0
--longtable--> chunk row: 0 row: 15 column: 0
[Sockets] ==> Socket 'tagsupport/tbl/longtable/finalize' containing plug 'Table' used.
---longtable--> chunk row: 0 row: 0 column: 0
+--longtable--> chunk row: 0 row: 16 column: 0
[Sockets] ==> Socket 'tagsupport/tbl/longtable/foot' containing plug 'Table' used.
[Sockets] ==> Socket 'tagsupport/tbl/vmode/end' containing plug 'Table' used.
[Sockets] ==> Socket '@makecol/outputbox' containing plug 'footnotes-floats' used.
diff --git a/required/latex-lab/testfiles-table-pdftex/table-020.tlg b/required/latex-lab/testfiles-table-pdftex/table-020.tlg
index e1efed32..cfa6cd42 100644
--- a/required/latex-lab/testfiles-table-pdftex/table-020.tlg
+++ b/required/latex-lab/testfiles-table-pdftex/table-020.tlg
@@ -37,7 +37,7 @@ Don't change this file in any respect.
[Sockets] ==> Socket 'tagsupport/tbl/row/end' containing plug 'TR' used.
==> stucture stored for row 2: 10,11,12
[Sockets] ==> Socket 'tagsupport/tbl/longtable/finalize' containing plug 'Table' used.
---longtable--> chunk row: 0 row: 0 column: 0
+--longtable--> chunk row: 0 row: 3 column: 0
[Sockets] ==> Socket 'tagsupport/tbl/longtable/head' containing plug 'Table' used.
[Sockets] ==> Socket 'tagsupport/tbl/longtable/foot' containing plug 'Table' used.
[Sockets] ==> Socket 'tagsupport/tbl/vmode/end' containing plug 'Table' used.
@@ -81,7 +81,7 @@ Don't change this file in any respect.
[Sockets] ==> Socket 'tagsupport/tbl/cell/end' containing plug 'TD' used.
==> stucture stored for row 2: 19,20,21
[Sockets] ==> Socket 'tagsupport/tbl/longtable/finalize' containing plug 'Table' used.
---longtable--> chunk row: 0 row: 0 column: 0
+--longtable--> chunk row: 0 row: 3 column: 0
[Sockets] ==> Socket 'tagsupport/tbl/longtable/head' containing plug 'Table' used.
[Sockets] ==> Socket 'tagsupport/tbl/longtable/foot' containing plug 'Table' used.
[Sockets] ==> Socket 'tagsupport/tbl/vmode/end' containing plug 'Table' used.
@@ -143,7 +143,7 @@ Don't change this file in any respect.
[Sockets] ==> Socket 'tagsupport/tbl/cell/end' containing plug 'TD' used.
==> stucture stored for row 3: 32,33,34
[Sockets] ==> Socket 'tagsupport/tbl/longtable/finalize' containing plug 'Table' used.
---longtable--> chunk row: 0 row: 0 column: 0
+--longtable--> chunk row: 0 row: 4 column: 0
[Sockets] ==> Socket 'tagsupport/tbl/longtable/head' containing plug 'Table' used.
[Sockets] ==> Socket 'tagsupport/tbl/longtable/foot' containing plug 'Table' used.
[Sockets] ==> Socket 'tagsupport/tbl/vmode/end' containing plug 'Table' used.
diff --git a/required/latex-lab/testfiles-table-pdftex/table-021-longtable.tlg b/required/latex-lab/testfiles-table-pdftex/table-021-longtable.tlg
index 0fb1e6c5..7df59f6e 100644
--- a/required/latex-lab/testfiles-table-pdftex/table-021-longtable.tlg
+++ b/required/latex-lab/testfiles-table-pdftex/table-021-longtable.tlg
@@ -63,7 +63,7 @@ Don't change this file in any respect.
--longtable--> chunk row: 2 row: 4 column: 0
--longtable--> chunk row: 2 row: 4 column: 0
[Sockets] ==> Socket 'tagsupport/tbl/longtable/finalize' containing plug 'Table' used.
---longtable--> chunk row: 2 row: 0 column: 0
+--longtable--> chunk row: 2 row: 4 column: 0
[Sockets] ==> Socket 'tagsupport/tbl/longtable/head' containing plug 'Table' used.
[Sockets] ==> Socket 'tagsupport/tbl/longtable/foot' containing plug 'Table' used.
[Sockets] ==> Socket 'tagsupport/tbl/vmode/end' containing plug 'Table' used.
diff --git a/required/tools/array.dtx b/required/tools/array.dtx
index 34edbacd..19578860 100644
--- a/required/tools/array.dtx
+++ b/required/tools/array.dtx
@@ -2202,7 +2202,7 @@ Bug reports can be opened (category \texttt{#1}) at\\%
% outer value of \cs{g_@@_table_cols_tl} we do it before the group.
% \changes{v2.6a}{2023/12/11}{Support for tagged PDF}
% \begin{macrocode}
- \tl_set_eq:NN \l_@@_saved_table_cols_tl \g_@@_table_cols_tl
+ \tbl_save_outer_table_cols:
% \end{macrocode}
% Then we open a group, in which the user preamble is evaluated by
% the macro =\@mkpream=. As we know this must happen locally.
@@ -2263,9 +2263,8 @@ Bug reports can be opened (category \texttt{#1}) at\\%
% \begin{macrocode}
\UseTaggingSocket{tbl/row/begin}
% \end{macrocode}
-% At the start of the preamble for the first column we set
-% \cs{g_@@_col_int} to \texttt{1} as we are no longer "at" but "in"
-% the first column. This is done in \cs{tbl_init_cell_data_for_row:}. In
+% At the start of the preamble for the first column we call
+% \cs{tbl_init_cell_data_for_row:} to initialize the cell index data. In
% later columns this data is updated via \cs{tbl_update_cell_data:}.
% \changes{v2.6a}{2023/12/11}{Managing cell indexes}
% \begin{macrocode}
@@ -2365,14 +2364,14 @@ Bug reports can be opened (category \texttt{#1}) at\\%
\everycr{%
\noalign{%
% \end{macrocode}
-% We use \cs{g_@@_col_int} equal zero to indicate that we are just
-% after a TR (or at the very beginning of the table). Using the row
-% count is not so good as longtable may split the table in chunks.
+% If this \cs{cr} was at the end of a real row (e.g., not at the
+% end of the table preamble) we have add a row end tag.
% \begin{macrocode}
- \int_compare:nNnT \g_@@_col_int > 0
- { \UseTaggingSocket{tbl/row/end} }
- \int_gincr:N \g_@@_row_int % this row about to start
- \int_gzero:N \g_@@_col_int % we are before first col
+ \tbl_if_row_was_started:T { \UseTaggingSocket{tbl/row/end} }
+% \end{macrocode}
+% The we prepare for the next row.
+% \begin{macrocode}
+ \tbl_update_cell_data_for_next_row:
}%
}%
\tabskip\z at skip\halign}
@@ -2779,8 +2778,8 @@ Bug reports can be opened (category \texttt{#1}) at\\%
%
% If tables are nested into another then it is necessary to
% restore information about the cell the inner table started
-% in. Otherwise, \cs{g_@@_row_int}, \cs{g_@@_col_int}, and
-% \cs{g_@@_span_tl} reflect the status in the outer table as they
+% in. Otherwise, the cell index data structures reflect the
+% status in the outer table as they
% are globally manipulated. We restore in all cases even if we are
% not in a nesting situation as that makes the code simpler (and
% probably faster).
diff --git a/required/tools/longtable.dtx b/required/tools/longtable.dtx
index ea660447..e2e34ecb 100644
--- a/required/tools/longtable.dtx
+++ b/required/tools/longtable.dtx
@@ -1228,9 +1228,9 @@
% \begin{macrocode}
\xdef\LT at bchunk{%
% \end{macrocode}
-%
+% We aren't inside any row when a chunk starts.
% \begin{macrocode}
- \int_gzero:N \g_@@_col_int
+ \tbl_inbetween_rows:
% \end{macrocode}
% \changes{v4.00}{1996/04/08}
% {(DK) Increment Chunk counter}
@@ -1259,7 +1259,8 @@
% \tabskip\LTleft\halign to\hsize\bgroup
\tabskip\z@ \@arstrut
% \end{macrocode}
-% Insert the socket and the setting of the conditional
+% Insert the tagging socket to start the row and initialize the cell
+% data for the row.
% \begin{macrocode}
\UseTaggingSocket{tbl/row/begin}%
\tbl_init_cell_data_for_row:
@@ -1294,15 +1295,15 @@
row:~ \the\g_@@_row_int \space
column:~ \the\g_@@_col_int
}
- \int_compare:nNnT \g_@@_col_int > 0
+ \tbl_if_row_was_started:T
{
\UseTaggingSocket{tbl/row/end}
% \end{macrocode}
-% This prevents any of the additional \cs{cr}s at the end of the
+% The next setting prevents any of the additional \cs{cr}s at the end of the
% chunk to add another /TR. Then once we really start a new chunk
% it gets incremented so\ldots
% \begin{macrocode}
- \int_gzero:N \g_@@_col_int % before first col
+ \tbl_inbetween_rows:
}
% \end{macrocode}
% And for the same reason such \cs{cr}s should not increment the
@@ -1311,7 +1312,7 @@
% \cs{LTchunksize} at the end of a chunk.
% \begin{macrocode}
\int_compare:nNnT \LT at rows < \LTchunksize
- { \int_gincr:N \g_@@_row_int } % this row about to start
+ { \tbl_incr_row_count: } % next is row about to start
}%
}%
% \end{macrocode}
@@ -1506,8 +1507,6 @@
%
% \begin{macrocode}
\UseTaggingSocket{tbl/longtable/finalize}
- \int_gzero:N \g_@@_row_int % this prevents that the next
- % \crcr is considered to be another row end.
% \end{macrocode}
%
% \begin{macrocode}
@@ -2350,7 +2349,7 @@
%
% To handle missing columns in the header we need this:
% \begin{macrocode}
- \int_compare:nNnTF \g_@@_col_int > 0
+ \tbl_if_row_was_started:TF
{
\tbl_count_missing_cells:n {head/foot}
\int_step_inline:nn
@@ -2385,7 +2384,7 @@
{
\crcr
\noalign{
- \int_gdecr:N \g_@@_row_int
+ \int_gdecr:N \g_@@_row_int % undo the increment
\int_gset:Nn \LT at rows { \LTchunksize }
}
}
More information about the latex3-commits
mailing list.