[latex3-commits] [latex3/latex2e] array: use \tbl_update_multicolumn_cell_data:n (95980c2b)

github at latex-project.org github at latex-project.org
Sat Dec 9 19:56:26 CET 2023


Repository : https://github.com/latex3/latex2e
On branch  : array
Link       : https://github.com/latex3/latex2e/commit/95980c2b31ef7cd82c10b90a1c8dbef6348b221c

>---------------------------------------------------------------

commit 95980c2b31ef7cd82c10b90a1c8dbef6348b221c
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Sat Dec 9 19:56:26 2023 +0100

    use   \tbl_update_multicolumn_cell_data:n


>---------------------------------------------------------------

95980c2b31ef7cd82c10b90a1c8dbef6348b221c
 base/lttagging.dtx                     | 34 +++++++++++++++++++
 required/latex-lab/latex-lab-table.dtx | 61 +++++-----------------------------
 required/tools/array.dtx               | 26 ++-------------
 3 files changed, 44 insertions(+), 77 deletions(-)

diff --git a/base/lttagging.dtx b/base/lttagging.dtx
index 320e2930..44652d0c 100644
--- a/base/lttagging.dtx
+++ b/base/lttagging.dtx
@@ -351,6 +351,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.
+%
 %  \begin{macro}{\tbl_update_cell_data:}
 %    Updating cell data in columns after the first means we have to
 %    increment the \cs{g_@@_col_int} by the span count of the previous
@@ -485,6 +488,37 @@
 %
 %
 %
+%  \begin{macro}{\tbl_update_multicolumn_cell_data:n}
+%    This macro updates \cs{g_@@_col_int} and \cs{g_@@_span_tl} inside
+%    a \cs{multicolumn} and possibly calls the tagging socket
+%    \texttt{tblrow/begin}.
+%    \begin{macrocode}
+\cs_new_protected:Npn \tbl_update_multicolumn_cell_data:n #1 {
+%    \end{macrocode}
+%    We execute socket for tagging only if this \cs{multicolumn}
+%    replaces the preamble of the first column. In that case we also have
+%    to set \cs{g_@@_col_int} to 1 because this is no longer done in the
+%    preamble for the cell either.
+%    \begin{macrocode}
+   \int_compare:nNnTF \g_@@_col_int = 0
+       {
+         \UseTaggingSocket{tblrow/begin}
+         \int_gset:Nn \g_@@_col_int {1}
+       }
+%    \end{macrocode}
+%    If we are in a later column we use \cs{g_@@_span_tl} from the
+%    previous column to update.
+%    \begin{macrocode}
+       {
+         \int_gadd:Nn \g_@@_col_int { \g_@@_span_tl }
+       }
+%    \end{macrocode}
+%    Then we set the span value so that it can be use in the next column.
+%    \begin{macrocode}
+   \tl_gset:Nn \g_@@_span_tl {#1}
+}
+%    \end{macrocode}
+%  \end{macro}
 %
 %
 %
diff --git a/required/latex-lab/latex-lab-table.dtx b/required/latex-lab/latex-lab-table.dtx
index ec549391..c4521e05 100644
--- a/required/latex-lab/latex-lab-table.dtx
+++ b/required/latex-lab/latex-lab-table.dtx
@@ -968,7 +968,7 @@
 %
 %
 %
-%  \begin{macro}{\@@_init_cell_data:}
+%  \begin{macro}{\socket_use:nw}
 %
 %    \begin{macrocode}
 
@@ -992,11 +992,10 @@
 %
 %
 %  \begin{macro}{\@@_add_missing_cells:}
-%    The storing and use of the number of missing cells
-%    must happen at different places  as the testing happens at
-%    the end of the last cell of a row, but
-%    still inside that cell, so we use two commands. The second is used in
-%    the endrow socket.
+%    The storing and use of the number of missing cells must happen at
+%    different places as the testing happens at the end of the last
+%    cell of a row, but still inside that cell, so we use two
+%    commands. The one adding is used in the endrow socket.
 %    \begin{macrocode}
 \NewSocket{tbl/celldata/missingcount}{1}
 \NewSocketPlug{tbl/celldata/missingcount}{code}{\tbl_count_missing_cells:n{#1}}
@@ -1008,8 +1007,9 @@
 \cs_new:Npn \@@_add_missing_cells:
   {
 %    \end{macrocode}
-% The TD-socket messages are issued after the message about the end-row socket,
-% but the structure is ok, so better issue a message for now to avoid confusion:
+%    The TD-socket messages are issued after the message about the
+%    end-row socket, but the structure is ok, so better issue a
+%    message for now to avoid confusion:
 %    \begin{macrocode}
     \int_compare:nNnT \g_@@_missing_cells_int > 0
       {
@@ -1102,51 +1102,6 @@
 %  \end{macro}
 
 
-%
-%
-%    \begin{macrocode}
-
-  % alternative: determine first col with vmode test ...
-  %  \ifvmode
-  %    \multispan{#1}\typeout{A==> vmode}%
-  %  \else
-  %    \multispan{#1}\typeout{A==> not vmode}
-  %  \fi
-  % but this makes the \crcr handling really complicated which would
-  % then need to become something like
-  %    \ifvmode \expandafter \@gobble
-  %    \else \expandafter \@iden \fi {\cr\noalign{do something}}%
-  % so not used.
-  % Instead:
-\NewSocketPlug{tbl/celldata/multicolumn}{code}
-   {
-%    \end{macrocode}
-%    Insert rowbegin socket only if this multicolumn
-%    replaces the preamble of the first column. In that case we have
-%    to set \cs{g_@@_col_int} to 1 since this is no longer done in the
-%    preamble for the cell.
-%    \begin{macrocode}
-   \int_compare:nNnTF \g_@@_col_int = 0
-       {
-         \UseTaggingSocket{tblrow/begin}
-         \int_gset:Nn \g_@@_col_int {1}
-       }
-%    \end{macrocode}
-%    If we are in a later column we use \cs{g_@@_span_tl} from the
-%    previous column to update.
-%    \begin{macrocode}
-       {
-         \int_gadd:Nn \g_@@_col_int { \g_@@_span_tl }
-       }
-%    \end{macrocode}
-%    Then we set the span value so that it can be use in the next column.
-%    \begin{macrocode}
-   \tl_gset:Nn \g_@@_span_tl {#1}
-   }
-
-\AssignSocketPlug{tbl/celldata/multicolumn}{code}
-%    \end{macrocode}
-%
 %
 %
 % \subsection{longtable}
diff --git a/required/tools/array.dtx b/required/tools/array.dtx
index f8602efe..0977b6fa 100644
--- a/required/tools/array.dtx
+++ b/required/tools/array.dtx
@@ -2519,33 +2519,11 @@ Bug reports can be opened (category \texttt{#1}) at\\%
 %    For tagging support we have to solve two problems:
 %    \cs{multicolumn} must handle the row begin if it is used there,
 %    and it must save the numbers of cells it spans so that we can add
-%    a suitable ColSpan attribute. We do this in the next socket
+%    a suitable ColSpan attribute. We do this in the next macro
 %    (which in turn calls the \texttt{tblrow/begin} socket, if
 %    necessary).
 %    \begin{macrocode}
-%   \UseSocket{tbl/celldata/multicolumn}{#1}%
-%    \end{macrocode}
-%    We insert row begin socket for tagging only if this multicolumn
-%    replaces the preamble of the first column. In that case we also have
-%    to set \cs{g_@@_col_int} to 1 since this is no longer done in the
-%    preamble for the cell.
-%    \begin{macrocode}
-   \int_compare:nNnTF \g_@@_col_int = 0
-       {
-         \UseTaggingSocket{tblrow/begin}
-         \int_gset:Nn \g_@@_col_int {1}
-       }
-%    \end{macrocode}
-%    If we are in a later column we use \cs{g_@@_span_tl} from the
-%    previous column to update.
-%    \begin{macrocode}
-       {
-         \int_gadd:Nn \g_@@_col_int { \g_@@_span_tl }
-       }
-%    \end{macrocode}
-%    Then we set the span value so that it can be use in the next column.
-%    \begin{macrocode}
-   \tl_gset:Nn \g_@@_span_tl {#1}
+   \tbl_update_multicolumn_cell_data:n {#1}    
 %    \end{macrocode}
 %    Since a =\multicolumn= should only describe the format of a
 %    result column, we redefine =\@addamp= in such a way that one gets





More information about the latex3-commits mailing list.