[latex3-commits] [latex3/latex2e] array: getting ready for first draft (216037d0)

github at latex-project.org github at latex-project.org
Sat Dec 16 14:09:49 CET 2023


Repository : https://github.com/latex3/latex2e
On branch  : array
Link       : https://github.com/latex3/latex2e/commit/216037d033a45fe58e51bccb36299d26283975ba

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

commit 216037d033a45fe58e51bccb36299d26283975ba
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Sat Dec 16 14:09:49 2023 +0100

    getting ready for first draft


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

216037d033a45fe58e51bccb36299d26283975ba
 base/changes.txt             |  4 +++
 base/lttagging.dtx           | 20 +++++++++++----
 required/tools/changes.txt   |  6 +++++
 required/tools/longtable.dtx | 58 ++++++++++++++++++++++++++++++++++++++------
 4 files changed, 75 insertions(+), 13 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index 5bca41bc..8d8a4195 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -6,6 +6,10 @@ to completeness or accuracy and it contains some references to files that are
 not part of the distribution.
 ================================================================================
 
+2023-12-16  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+	* lttagging.dtx:
+	First version of lttagging module added
+
 2023-12-02  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 	* doc.dtx (subsection{API creation}):
 	Provide \ProvideDocElement for use cases where files are processed
diff --git a/base/lttagging.dtx b/base/lttagging.dtx
index 9f0354c8..dc5b1ca2 100644
--- a/base/lttagging.dtx
+++ b/base/lttagging.dtx
@@ -622,18 +622,28 @@
 %
 %
 %
-%  \begin{macro}{\tbl_incr_row_count:}
-%    
-%    \begin{macrocode}
+%  \begin{macro}{\tbl_init_row_count:,\tbl_incr_row_count:,\tbl_decr_row_count:}
+%    This here is basically a temporary interface. What it will be in
+%    the end depends on what we decide concerning exposing row and
+%    column counters, if they stay internal we need something like
+%    this here (perhaps using \texttt{gincr} etc, or perhaps some
+%    other names in the first place).
+%    \begin{macrocode}
+\cs_new_protected:Npn \tbl_init_row_count: {
+  \int_gzero:N \g_@@_row_int
+}
 \cs_new_protected:Npn \tbl_incr_row_count: {
   \int_gincr:N \g_@@_row_int
 }
+\cs_new_protected:Npn \tbl_decr_row_count: {
+  \int_gdecr:N \g_@@_row_int
+}
 %    \end{macrocode}
 %  \end{macro}
 %
 %
 %  \begin{macro}{\tbl_inbetween_rows:}
-%    
+%    Again name is not really brilliant so far.
 %    \begin{macrocode}
 \cs_new_protected:Npn \tbl_inbetween_rows: {
        \int_gzero:N  \g_@@_col_int
@@ -710,7 +720,7 @@
 %    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
+%    be false, thus it just vanishes without doing anything. If there
 %    are missing cells (in which case we also haven't see \cs{cr} yet)
 %    the macro \cs{tbl_count_missing_cells:n} is executed and
 %    then the row is finished with a final \cs{cr}.
diff --git a/required/tools/changes.txt b/required/tools/changes.txt
index 6c5bdfdb..0416139d 100644
--- a/required/tools/changes.txt
+++ b/required/tools/changes.txt
@@ -5,6 +5,12 @@ completeness or accuracy and it contains some references to files that
 are not part of the distribution.
 =======================================================================
 
+2023-12-16  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* longtable.dtx:
+	Support for tagged PDF
+	Manage and provide cell indexes
+
 2023-12-12  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 
 	* array.dtx:
diff --git a/required/tools/longtable.dtx b/required/tools/longtable.dtx
index e2e34ecb..c8070fe7 100644
--- a/required/tools/longtable.dtx
+++ b/required/tools/longtable.dtx
@@ -37,7 +37,7 @@
 %<driver> \ProvidesFile{longtable.drv}
 % \fi
 %         \ProvidesFile{longtable.dtx}
-          [2023-11-01 v4.19 Multi-page Table package (DPC)]
+          [2023-12-16 v4.19 Multi-page Table package (DPC)]
 %
 % \iffalse
 %<*driver>
@@ -1050,6 +1050,7 @@
   \fi
 %    \end{macrocode}
 %    
+% \changes{v4.19}{2023/12/16}{Support for tagged PDF}
 %    \begin{macrocode}
   \UseTaggingSocket{tbl/vmode/begin}%
 %    \end{macrocode}
@@ -1096,6 +1097,7 @@
 %    too and must be removed.
 %  
 %    \cs{LT at array} is executed in a group, so we can disable para-tagging here.
+% \changes{v4.19}{2023/12/16}{Support for tagged PDF}
 %    \begin{macrocode}
   \UseTaggingSocket{tbl/init}
   \@kernel at refstepcounter{table}\stepcounter{LT at tables}
@@ -1107,8 +1109,13 @@
   \tl_gset:Ne \@currentHref {table.\cs_if_exist_use:N\theHtable}
 %    \end{macrocode}
 %    
+% \changes{v4.19}{2023/12/16}{Managing cell indexes}
+%    \begin{macrocode}
+  \tbl_init_row_count:
+%    \end{macrocode}
+%    
+% \changes{v4.19}{2023/12/16}{Support for tagged PDF}
 %    \begin{macrocode}
-  \int_gzero:N \g_@@_row_int
   \UseTaggingSocket{tbl/longtable/init}
 %    \end{macrocode}
 % Set up the glue around the table if an optional argument given.
@@ -1217,6 +1224,7 @@
     \@mkpream{#2}%
 %    \end{macrocode}
 %    
+% \changes{v4.19}{2023/12/16}{Managing cell indexes}
 %    \begin{macrocode}
     \tbl_count_table_cols:
 %    \end{macrocode}
@@ -1229,6 +1237,7 @@
     \xdef\LT at bchunk{%
 %    \end{macrocode}
 %    We aren't inside any row when a chunk starts.
+% \changes{v4.19}{2023/12/16}{Managing cell indexes}
 %    \begin{macrocode}
       \tbl_inbetween_rows:
 %    \end{macrocode}
@@ -1261,8 +1270,13 @@
 %    \end{macrocode}
 %    Insert the tagging socket to start the row and initialize the cell
 %    data for the row.  
+% \changes{v4.19}{2023/12/16}{Support for tagged PDF}
 %    \begin{macrocode}
        \UseTaggingSocket{tbl/row/begin}%
+%    \end{macrocode}
+%    
+% \changes{v4.19}{2023/12/16}{Managing cell indexes}
+%    \begin{macrocode}
        \tbl_init_cell_data_for_row:
 %    \end{macrocode}
 %    \begin{macrocode}
@@ -1290,11 +1304,17 @@
 %    In \pkg{longtable} we have a bunch of extra \cs{cr}s that are
 %    executed whenever a chunk ends. In that case they should not
 %    increment the main row counter, sigh.
+%
+%    TODO: At the moment this tracing still exposes the internal row counter!
 %    \begin{macrocode}
       \@@_trace:n {--longtable-->~chunk~row:~ \the\LT at rows \space
                    row:~ \the\g_@@_row_int   \space
                    column:~ \the\g_@@_col_int
       }
+%    \end{macrocode}
+%    
+% \changes{v4.19}{2023/12/16}{Support for tagged PDF}
+%    \begin{macrocode}
       \tbl_if_row_was_started:T
           {
             \UseTaggingSocket{tbl/row/end}
@@ -1302,6 +1322,7 @@
 %    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
+% \changes{v4.19}{2023/12/16}{Managing cell indexes}
 %    \begin{macrocode}
             \tbl_inbetween_rows:
           }
@@ -1310,6 +1331,7 @@
 %    main row counter (but it has to be incremented after the preamble
 %    of a chunk), so here we test against \cs{LT at rows} which is
 %    \cs{LTchunksize} at the end of a chunk.
+% \changes{v4.19}{2023/12/16}{Managing cell indexes}
 %    \begin{macrocode}
       \int_compare:nNnT \LT at rows < \LTchunksize
          { \tbl_incr_row_count: }   % next is row about to start
@@ -1464,6 +1486,7 @@
   \ifvoid\LT at firsthead\copy\LT at head\else\box\LT at firsthead\fi\nobreak
 %    \end{macrocode}
 %    
+% \changes{v4.19}{2023/12/16}{Support for tagged PDF}
 %    \begin{macrocode}
   \UseTaggingSocket{tbl/longtable/head}
 %    \end{macrocode}
@@ -1495,16 +1518,18 @@
 % been shortened, or the table numbering has gone awry). In that case
 % we at least start collecting valid new information with the last
 % chunk of this table, by removing the width constraint.
-% \changes{v4.01}{1996/04/11}
-%      {(DPC) use \cs{noalign} to sneak in \cs{LT at entry@chop}}
+% \changes{v4.19}{2023/12/16}{Support for tagged PDF}
 %    \begin{macrocode}
   \tbl_crcr:n {endlongtable}
 %    \end{macrocode}
 %    
+% \changes{v4.01}{1996/04/11}
+%      {(DPC) use \cs{noalign} to sneak in \cs{LT at entry@chop}}
 %    \begin{macrocode}
   \noalign{%
 %    \end{macrocode}
 %    
+% \changes{v4.19}{2023/12/16}{Support for tagged PDF}
 %    \begin{macrocode}
     \UseTaggingSocket{tbl/longtable/finalize}
 %    \end{macrocode}
@@ -1587,6 +1612,7 @@
   \ifvoid\footins\else\insert\footins{}\fi
 %    \end{macrocode}
 %    
+% \changes{v4.19}{2023/12/16}{Support for tagged PDF}
 %    \begin{macrocode}
   \UseTaggingSocket{tbl/vmode/end}%
 }
@@ -1710,6 +1736,7 @@
 %    At the end of the chunk \verb=\\= is doing something special and
 %    so we loose \verb=\tbl_count_missing_cells:n=. Below is about the
 %    right place to add it do this code branch.
+% \changes{v4.19}{2023/12/16}{Managing cell indexes}
 %    \begin{macrocode}
     \tbl_count_missing_cells:n {echunk}
     \gdef\LT at setprevdepth{%
@@ -2117,17 +2144,19 @@
      \unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
 %    \end{macrocode}
 %    Don't update the row counter, or rather undo the update done in \cs{everycr}:
+% \changes{v4.19}{2023/12/16}{Managing cell indexes}
 %    \begin{macrocode}
   \noalign{
-    \int_gdecr:N\g_@@_row_int
+    \tbl_decr_row_count:
     \LT at sep}
   \multispan\LT at cols
      \unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
 %    \end{macrocode}
 %    Same here.
+% \changes{v4.19}{2023/12/16}{Managing cell indexes}
 %    \begin{macrocode}
   \noalign{
-    \int_gdecr:N\g_@@_row_int
+    \tbl_decr_row_count:
     \penalty\@M}
   \@gtempa}
 \ExplSyntaxOff
@@ -2280,6 +2309,7 @@
 %    \end{macrocode}
 %    Handle foot box when tagging:
 %
+% \changes{v4.19}{2023/12/16}{Support for tagged PDF}
 %    \begin{macrocode}
         \UseTaggingSocket{tbl/longtable/foot}
 %    \end{macrocode}
@@ -2298,6 +2328,7 @@
 %    \end{macrocode}
 %
 %    Handle foot box when tagging:
+% \changes{v4.19}{2023/12/16}{Support for tagged PDF}
 %    \begin{macrocode}
     \UseTaggingSocket{tbl/longtable/foot}
 %    \end{macrocode}
@@ -2348,9 +2379,16 @@
 %    up the structure in the finalize code.
 %
 %    To handle missing columns in the header we need this:
+% \changes{v4.19}{2023/12/16}{Managing cell indexes}
 %    \begin{macrocode}
   \tbl_if_row_was_started:TF
      {
+%    \end{macrocode}
+%    TODO: This is exposing internal counters, so it should be encapsulated
+%    in some interface command (but I'm not sure what that should be
+%    called, so not done yet. 
+% \changes{v4.19}{2023/12/16}{Managing cell indexes}
+%    \begin{macrocode}
        \tbl_count_missing_cells:n {head/foot}
        \int_step_inline:nn
          { \LT at rows + 1 }
@@ -2372,7 +2410,7 @@
 %    and so making any assignment, etc., would start a row --- something we don't want.
 %    To get out of this trap we  run \cs{crcr} (which would normally
 %    come inside \cs{LT at echunk}. That will then trigger \cs{everycr}
-%    and update \verb=\g_@@_row_int=, but now we have a defined state, so
+%    and update row counter unnecessarily, but now we have a defined state, so
 %    we can use \cs{noalign} to undo that. 
 %    We also change \cs{LT at rows} so that further \cs{cr}s do not do
 %    any harm (as explained above.
@@ -2384,7 +2422,11 @@
      {
        \crcr
        \noalign{
-         \int_gdecr:N \g_@@_row_int  % undo the increment
+%    \end{macrocode}
+%    
+% \changes{v4.19}{2023/12/16}{Managing cell indexes}
+%    \begin{macrocode}
+         \tbl_decr_row_count:         % undo the increment
          \int_gset:Nn \LT at rows { \LTchunksize }
        }
      }





More information about the latex3-commits mailing list.