summaryrefslogtreecommitdiff
path: root/macros/latex-dev/required
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-02-15 03:01:30 +0000
committerNorbert Preining <norbert@preining.info>2024-02-15 03:01:30 +0000
commit5b6839a58ea5468b40ebd52b579e680b8e62ff13 (patch)
tree1dfc09f53794115129a07bf566b466cc337606f5 /macros/latex-dev/required
parenta90336c3069c198b41b7b6eb76e3389610ad5eb7 (diff)
CTAN sync 202402150301
Diffstat (limited to 'macros/latex-dev/required')
-rw-r--r--macros/latex-dev/required/latex-lab/README.md4
-rw-r--r--macros/latex-dev/required/latex-lab/blocks-code.pdfbin886150 -> 871503 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/blocks-doc.pdfbin440234 -> 485950 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/changes.txt85
-rw-r--r--macros/latex-dev/required/latex-lab/documentmetadata-support-code.pdfbin523380 -> 531721 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/documentmetadata-support-doc.pdfbin389003 -> 419214 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/documentmetadata-support.dtx48
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-amsmath.dtx90
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-amsmath.pdfbin357553 -> 373342 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-bib.dtx19
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-bib.pdfbin411092 -> 383259 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-block.dtx153
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-block.pdfbin886150 -> 871503 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-firstaid.dtx16
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-firstaid.pdfbin272864 -> 273812 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-float.dtx71
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-float.pdfbin444977 -> 426817 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-footnotes.pdfbin815656 -> 815072 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-graphic.dtx9
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-graphic.pdfbin496997 -> 517737 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-marginpar.dtx259
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-marginpar.pdfbin0 -> 389702 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-math.dtx1560
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-math.pdfbin612623 -> 740461 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-mathpkg.dtx2
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-mathpkg.pdfbin302371 -> 302442 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-mathtools.dtx11
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-mathtools.pdfbin357553 -> 373342 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-minipage.dtx4
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-minipage.pdfbin280811 -> 280811 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-namespace.dtx4
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-namespace.pdfbin234649 -> 234649 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-new-or-1.dtx2
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-new-or-1.pdfbin389721 -> 389721 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-new-or-2.dtx2
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-new-or-2.pdfbin632310 -> 632196 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-sec.dtx17
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-sec.pdfbin527916 -> 527096 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-table.dtx1311
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-table.pdfbin621929 -> 556861 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-testphase.dtx5
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-testphase.pdfbin298403 -> 298373 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-text.dtx2
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-text.pdfbin307812 -> 307812 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-title.dtx518
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-title.pdfbin0 -> 348117 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-toc-hyperref-changes.dtx2
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-toc-hyperref-changes.pdfbin296124 -> 296124 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-toc-kernel-changes.dtx8
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-toc-kernel-changes.pdfbin361084 -> 361081 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-toc.dtx10
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-toc.pdfbin396817 -> 396814 bytes
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab.ins8
-rw-r--r--macros/latex-dev/required/tools/README.md2
-rw-r--r--macros/latex-dev/required/tools/afterpage.dtx2
-rw-r--r--macros/latex-dev/required/tools/afterpage.ins4
-rw-r--r--macros/latex-dev/required/tools/afterpage.pdfbin198100 -> 198100 bytes
-rw-r--r--macros/latex-dev/required/tools/array-2023-11-01.sty375
-rw-r--r--macros/latex-dev/required/tools/array.dtx465
-rw-r--r--macros/latex-dev/required/tools/array.pdfbin517410 -> 838028 bytes
-rw-r--r--macros/latex-dev/required/tools/bm.dtx10
-rw-r--r--macros/latex-dev/required/tools/bm.ins4
-rw-r--r--macros/latex-dev/required/tools/bm.pdfbin323929 -> 323640 bytes
-rw-r--r--macros/latex-dev/required/tools/calc.dtx2
-rw-r--r--macros/latex-dev/required/tools/calc.pdfbin370660 -> 370660 bytes
-rw-r--r--macros/latex-dev/required/tools/changes.txt44
-rw-r--r--macros/latex-dev/required/tools/dcolumn.dtx2
-rw-r--r--macros/latex-dev/required/tools/dcolumn.pdfbin221038 -> 221038 bytes
-rw-r--r--macros/latex-dev/required/tools/delarray.dtx2
-rw-r--r--macros/latex-dev/required/tools/delarray.pdfbin191058 -> 191058 bytes
-rw-r--r--macros/latex-dev/required/tools/enumerate.dtx2
-rw-r--r--macros/latex-dev/required/tools/enumerate.pdfbin215077 -> 215077 bytes
-rw-r--r--macros/latex-dev/required/tools/fileerr.dtx2
-rw-r--r--macros/latex-dev/required/tools/fileerr.pdfbin188281 -> 187725 bytes
-rw-r--r--macros/latex-dev/required/tools/fontsmpl.dtx2
-rw-r--r--macros/latex-dev/required/tools/fontsmpl.pdfbin146438 -> 146438 bytes
-rw-r--r--macros/latex-dev/required/tools/ftnright.dtx2
-rw-r--r--macros/latex-dev/required/tools/ftnright.pdfbin387794 -> 387253 bytes
-rw-r--r--macros/latex-dev/required/tools/hhline.dtx2
-rw-r--r--macros/latex-dev/required/tools/hhline.pdfbin189678 -> 189678 bytes
-rw-r--r--macros/latex-dev/required/tools/indentfirst.dtx2
-rw-r--r--macros/latex-dev/required/tools/indentfirst.pdfbin157352 -> 157352 bytes
-rw-r--r--macros/latex-dev/required/tools/layout.dtx2
-rw-r--r--macros/latex-dev/required/tools/layout.pdfbin260278 -> 260278 bytes
-rw-r--r--macros/latex-dev/required/tools/longtable.dtx366
-rw-r--r--macros/latex-dev/required/tools/longtable.ins4
-rw-r--r--macros/latex-dev/required/tools/longtable.pdfbin391258 -> 400149 bytes
-rw-r--r--macros/latex-dev/required/tools/multicol.dtx65
-rw-r--r--macros/latex-dev/required/tools/multicol.ins4
-rw-r--r--macros/latex-dev/required/tools/multicol.pdfbin523618 -> 524502 bytes
-rw-r--r--macros/latex-dev/required/tools/rawfonts.dtx2
-rw-r--r--macros/latex-dev/required/tools/rawfonts.pdfbin138956 -> 138956 bytes
-rw-r--r--macros/latex-dev/required/tools/shellesc.dtx2
-rw-r--r--macros/latex-dev/required/tools/shellesc.pdfbin176171 -> 176171 bytes
-rw-r--r--macros/latex-dev/required/tools/showkeys.dtx10
-rw-r--r--macros/latex-dev/required/tools/showkeys.pdfbin252975 -> 252684 bytes
-rw-r--r--macros/latex-dev/required/tools/somedefs.dtx2
-rw-r--r--macros/latex-dev/required/tools/somedefs.pdfbin167583 -> 167583 bytes
-rw-r--r--macros/latex-dev/required/tools/tabularx.dtx51
-rw-r--r--macros/latex-dev/required/tools/tabularx.ins4
-rw-r--r--macros/latex-dev/required/tools/tabularx.pdfbin287013 -> 289601 bytes
-rw-r--r--macros/latex-dev/required/tools/theorem.dtx2
-rw-r--r--macros/latex-dev/required/tools/theorem.pdfbin352315 -> 351765 bytes
-rw-r--r--macros/latex-dev/required/tools/tools-overview.pdfbin73673 -> 73673 bytes
-rw-r--r--macros/latex-dev/required/tools/tools-overview.tex2
-rw-r--r--macros/latex-dev/required/tools/tools.ins4
-rw-r--r--macros/latex-dev/required/tools/trace.dtx2
-rw-r--r--macros/latex-dev/required/tools/trace.pdfbin222074 -> 222074 bytes
-rw-r--r--macros/latex-dev/required/tools/varioref.dtx2
-rw-r--r--macros/latex-dev/required/tools/varioref.ins4
-rw-r--r--macros/latex-dev/required/tools/varioref.pdfbin393134 -> 393134 bytes
-rw-r--r--macros/latex-dev/required/tools/verbatim.dtx31
-rw-r--r--macros/latex-dev/required/tools/verbatim.pdfbin331003 -> 331587 bytes
-rw-r--r--macros/latex-dev/required/tools/xr.dtx2
-rw-r--r--macros/latex-dev/required/tools/xr.pdfbin170451 -> 170451 bytes
-rw-r--r--macros/latex-dev/required/tools/xspace.dtx2
-rw-r--r--macros/latex-dev/required/tools/xspace.pdfbin257027 -> 257027 bytes
117 files changed, 4094 insertions, 1613 deletions
diff --git a/macros/latex-dev/required/latex-lab/README.md b/macros/latex-dev/required/latex-lab/README.md
index 046d498ab8..a72fd43d9e 100644
--- a/macros/latex-dev/required/latex-lab/README.md
+++ b/macros/latex-dev/required/latex-lab/README.md
@@ -1,6 +1,6 @@
# LaTeX laboratory
-Release 2024-06-01 pre-release 0
+Release 2024-06-01 pre-release 1
## Overview
@@ -38,5 +38,5 @@ The license is LPPL 1.3c.
This README file is
-Copyright (C) 2021-2023
+Copyright (C) 2021-2024
The LaTeX Project
diff --git a/macros/latex-dev/required/latex-lab/blocks-code.pdf b/macros/latex-dev/required/latex-lab/blocks-code.pdf
index ff13361fcc..b9095a2bd6 100644
--- a/macros/latex-dev/required/latex-lab/blocks-code.pdf
+++ b/macros/latex-dev/required/latex-lab/blocks-code.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/blocks-doc.pdf b/macros/latex-dev/required/latex-lab/blocks-doc.pdf
index a0f0e5dfad..c72d60783c 100644
--- a/macros/latex-dev/required/latex-lab/blocks-doc.pdf
+++ b/macros/latex-dev/required/latex-lab/blocks-doc.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/changes.txt b/macros/latex-dev/required/latex-lab/changes.txt
index 1a65830e8b..fd7e2d9333 100644
--- a/macros/latex-dev/required/latex-lab/changes.txt
+++ b/macros/latex-dev/required/latex-lab/changes.txt
@@ -1,3 +1,88 @@
+2024-02-12 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-block.dtx: left align description labels.
+
+2024-02-07 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-table.dtx: change value layout to presentation (as in ARIA).
+
+2024-02-09 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-math.dtx: add keys to suppress AF-files locally
+
+2024-02-09 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-title.dtx: force DisplayDocTitle if UA-standard is detected
+
+2024-02-08 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-testphase.dtx: add marginpar tagging to phase-III
+
+2024-02-08 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-math.dtx, latex-lab-table.dtx: adapt tagpdfsetup keys
+
+2024-02-07 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-table.dtx: change key names from table-tagging to table/tagging
+
+2024-02-05 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-float.dtx: fix caption outside float error
+
+2024-02-05 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-toc-kernel-changes.dtx: fix spurious space, tagging-project#50
+
+2024-01-29 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-math.dtx: disable mathgrabbing in begindocument hook.
+
+2024-01-18 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-firstaid.dtx: add support for \authors from amsart.
+
+2024-01-18 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-title.dtx: make \@title and \@author robust to avoid errors
+ if they are not set.
+
+2024-01-18 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-table.dtx: add support for layout tables.
+
+2024-01-18 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-block.dtx: add support to set an attribute-class for para-main.
+
+2024-01-18 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-table.dtx: add option table-tagging=layout
+
+2024-01-17 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-math.dtx, latex-lab-amsmath.dtx, redefine \text to
+ avoid faulty structure and faulty PDF from \mathchoice.
+ Add statistic for mathml handling.
+
+2024-01-14 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-float.dtx, correct destination, see tagging issue #55
+
+2024-01-14 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-block.dtx, correct error message for environments,
+ see tagging issue #57
+
+2024-01-12 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-table.dtx: add some variables for tag names
+
+2024-01-08 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * move mathml-AF support into latex-lab-math.ltx
+
+2023-12-27 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * added latex-lab-title.dtx for maketitle/title and author tagging.
+
+2023-11-18 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-block.dtx, correct error message for items outside lists
+ see tagging issue #35
+
+2023-11-17 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-block.dtx, latex-lab-sec.dtx: use wrapper for para counter,
+ see tagging issue #34
+
+2023-11-12 Joseph Wright <Joseph.Wright@latex-project.org>
+ * latex-lab-math.dtx: tidy variant creation, switch to e-type expansion
+
+2023-11-05 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-math.dtx: remove processor in \(..\), see tagging issue #29
+
+2023-11-05 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
+ * latex-lab-math.dtx: handle also tabular*, see tagging issue #25
+ * latex-lab-table.dtx: use cmd hook for array, see tagging issue #28
+
2023-10-30 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
* added latex-lab-table.dtx for basic table tagging.
diff --git a/macros/latex-dev/required/latex-lab/documentmetadata-support-code.pdf b/macros/latex-dev/required/latex-lab/documentmetadata-support-code.pdf
index e7e0823f1e..c7d0fe107b 100644
--- a/macros/latex-dev/required/latex-lab/documentmetadata-support-code.pdf
+++ b/macros/latex-dev/required/latex-lab/documentmetadata-support-code.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/documentmetadata-support-doc.pdf b/macros/latex-dev/required/latex-lab/documentmetadata-support-doc.pdf
index af93980113..ff0295a160 100644
--- a/macros/latex-dev/required/latex-lab/documentmetadata-support-doc.pdf
+++ b/macros/latex-dev/required/latex-lab/documentmetadata-support-doc.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/documentmetadata-support.dtx b/macros/latex-dev/required/latex-lab/documentmetadata-support.dtx
index b37ae6c9d7..6bc7e232a1 100644
--- a/macros/latex-dev/required/latex-lab/documentmetadata-support.dtx
+++ b/macros/latex-dev/required/latex-lab/documentmetadata-support.dtx
@@ -84,8 +84,17 @@
% features developed as part of the multi-year ``Tagged PDF''
% project~\cite{blueprint}.
%
-%
-%
+% \section{The \cs{DocumentMetadata} command}
+%
+% \begin{function}{\DocumentMetadata}
+% \begin{syntax}
+% \cs{DocumentMetadata}\Arg{key-value list}
+% \end{syntax}
+%
+% The command should be used as the first command in a document, before
+% \cs{documentclass}. It takes a key-value argument.
+% \end{function}
+
% \section{Currently supported key/values}
%
%
@@ -215,6 +224,10 @@
% This code is also loaded by the \texttt{phase-III} key.
% \item[\texttt{math}] This adapts math for tagging. This is only a prototype.
% The module is currently not loaded by any \texttt{phase} key.
+% \item[\texttt{table}] This provides basic tagging for
+% \texttt{tabular}, \texttt{longtable} and similar table environments.
+% The module is currently not loaded by any \texttt{phase} key. Its use and
+% restrictions is documented in \texttt{latex-lab-table.pdf}.%
% \item[\texttt{firstaid}] This contains small adjustments to external packages.
% The module is currently not loaded by any \texttt{phase} key.
% \end{description}
@@ -274,8 +287,28 @@
\ExplSyntaxOn\makeatletter
% \end{macrocode}
+% \subsection{Variables}
+% These variable definitions are currently also done in ltdocinit.
+% They can be removed from there once latex-lab has been updated to
+% provide them too.
+% \begin{variable}{\g_@@_firstaidoff_clist}
+% A list to store the firstaid code which should be disabled
+% \begin{macrocode}
+\clist_if_exist:NF \g_@@_firstaidoff_clist
+ { \clist_new:N \g_@@_firstaidoff_clist }
+% \end{macrocode}
+% \end{variable}
+% \begin{variable}{\g_@@_testphase_tl}
+% a tl to store the testphase loading code so that we can load them at
+% the end of the command.
+% \begin{macrocode}
+\tl_if_exist:NF \g_@@_testphase_tl
+ { \tl_new:N \g_@@_testphase_tl }
+% \end{macrocode}
+% \end{variable}
-
+% \subsection{\cs{DocumentMetadata}}
+%
% \begin{macro}{\DocumentMetadata}
%
% \cs{DocumentMetadata} should not be used after
@@ -348,15 +381,8 @@
% \end{macrocode}
% \end{macro}
-
-
-
+%\subsection{\cs{DocumentMetadata} keys}
% \begin{macrocode}
-%FMi defined elsewhere
-%FMi
-%FMi \clist_new:N \g_@@_firstaidoff_clist
-%FMi \tl_new:N \g_@@_testphase_tl
-% UFi should the definition move to here?
\keys_define:nn { document / metadata }
{
backend .choices:nn =
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-amsmath.dtx b/macros/latex-dev/required/latex-lab/latex-lab-amsmath.dtx
index e1f95730fa..c50a40eedd 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-amsmath.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-amsmath.dtx
@@ -2,7 +2,7 @@
%
%% File: latex-lab-amsmath.dtx
%
-% Copyright (C) 2022,2023 The LaTeX Project
+% Copyright (C) 2022-2024 The LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -66,7 +66,7 @@
% \subsection{File declaration}
% \begin{macrocode}
\ProvidesFile{latex-lab-amsmath.ltx}
- [2023-01-05 v0.1a amsmath adaptions]
+ [2024-02-12 v0.1b amsmath adaptions]
% \end{macrocode}
% \subsection{Tagpdf support}
% To make the code independent from tagging being loaded and active
@@ -90,7 +90,11 @@
\def\intertext##1{%
\ifvmode\else\\\@empty\fi
\noalign{%
- \penalty\postdisplaypenalty\vskip\belowdisplayskip
+% \end{macrocode}
+% we have to flip the sign and use a negative \cs{belowdisplayskip}
+% as we flipped the sign at the outside.
+% \begin{macrocode}
+ \penalty\postdisplaypenalty\vskip-\belowdisplayskip
\vbox{
% \end{macrocode}
% Stop tagging when measuring:
@@ -105,9 +109,13 @@
% \begin{macrocode}
\tag_mc_end_push:
% \end{macrocode}
-% We are already in a par so we change now to Span:
+% We are already in a par so we change now to text:
+% \begin{macrocode}
+ \tagpdfsetup{paratag=P}%
+% \end{macrocode}
+% TODO why \cs{tagpdfparaOn} needed?
% \begin{macrocode}
- \tagpdfsetup{paratag=Span}%
+ \tagpdfparaOn
\noindent\ignorespaces##1\par
% \end{macrocode}
% Restart the MC
@@ -119,6 +127,78 @@
}
% \end{macrocode}
%
+% \subsection{\cs{text}}
+%
+% The \cs{text} command uses \cs{mathchoice} which \enquote{typesets} the argument
+% four times. This makes it quite problematic for tagging. Without precautions
+% structure objects would be created four times and would get MC-chunks as kids
+% that doesn't really exist. amsmath contains a switch that allows to execute code
+% only in the first (displaymath) branch, but that isn't usable here. At first because
+% we don't know if the first branch creates the same structure as the one that is
+% actually used. At second because the engines executes some commands like \cs{label}
+% and \cs{pdfannot} only at shipout from the branch that really was used. So we would
+% get structure data from one \cs{mathchoice}-branch and MC-labels and links from another
+% one and that gets very messy.
+%
+% We therefore have to avoid that tagging is active in unused branches. In pdflatex it
+% is not possible to detect the mathstyle before, so we use a label. With lualatex is
+% is possible to redefine \cs{text} not to use \cs{mathchoice}
+%
+% \begin{macrocode}
+\AddToHook{package/amstext/after}
+ {
+% \end{macrocode}
+% currently amsmath is loaded in a begindocument hook, so this
+% test is fine. If amstext is loaded earlier (in the kernel), this needs perhaps a change.
+% \begin{macrocode}
+ \tag_if_active:T
+ {
+ \sys_if_engine_luatex:TF
+ {
+ \def\text@#1{{%
+ \ifcase\mathstyle
+ \hbox{{#1}}\or
+ \hbox{{#1}}\or
+ \hbox{{#1}}\or
+ \hbox{{#1}}\or
+ \hbox{{\let\f@size\sf@size\selectfont#1}}\or
+ \hbox{{\let\f@size\sf@size\selectfont#1}}\or
+ \hbox{{\let\f@size\ssf@size\selectfont#1}}\or
+ \hbox{{\let\f@size\ssf@size\selectfont#1}}\or
+ \ERROR
+ \fi
+ \check@mathfonts
+ }}
+ }
+ {
+ \def\text@#1
+ {{
+ \int_gincr:N\g__math_mathchoice_int
+ \tag_stop:
+ \mathchoice
+ {
+ \@@_tag_if_mathstyle:en{mathchoice-\int_use:N\g__math_mathchoice_int}{0}
+ \textdef@\displaystyle\f@size{#1}
+ }
+ {
+ \@@_tag_if_mathstyle:en{mathchoice-\int_use:N\g__math_mathchoice_int}{2}
+ \textdef@\textstyle\f@size{\firstchoice@false #1}
+ }
+ {
+ \@@_tag_if_mathstyle:en{mathchoice-\int_use:N\g__math_mathchoice_int}{4}
+ \textdef@\textstyle\sf@size{\firstchoice@false #1}
+ }
+ {
+ \@@_tag_if_mathstyle:en{mathchoice-\int_use:N\g__math_mathchoice_int}{6}
+ \textdef@\textstyle \ssf@size{\firstchoice@false #1}
+ }
+ \check@mathfonts
+ }}
+ }
+ }
+ }
+% \end{macrocode}
+%
% \begin{macrocode}
\ExplSyntaxOff
% \end{macrocode}
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-amsmath.pdf b/macros/latex-dev/required/latex-lab/latex-lab-amsmath.pdf
index 9c0073d19d..577c3cddab 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-amsmath.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-amsmath.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-bib.dtx b/macros/latex-dev/required/latex-lab/latex-lab-bib.dtx
index a467bf3158..e8ee192a7b 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-bib.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-bib.dtx
@@ -16,8 +16,8 @@
%
% for those people who are interested or want to report an issue.
%
-\def\ltlabbibdate{2023-07-20}
-\def\ltlabbibversion{0.81a}
+\def\ltlabbibdate{2024-02-12}
+\def\ltlabbibversion{0.81b}
%<*driver>
\documentclass{l3doc}
\EnableCrossrefs
@@ -124,6 +124,17 @@
% but has to test if this anchor is already known.
% \end{description}
%
+% \section{Provided or redefined commands}
+%
+% \begin{function}{\@extra@binfo,\@extra@b@citeb}
+%
+% These are taken from hyperref, they are for chapterbib compability (and also
+% signal to chapterbib not to change the citation commands)
+% \end{function}
+%
+% \begin{function}{\@bibitem,\@lbibitem}
+% The internal item commands.
+% \end{function}
%
% \section{Implementation}
% \begin{macrocode}
@@ -264,7 +275,7 @@
\AddToHookWithArguments{bibcite/before}
{
\tag_mc_end_push:
- \exp_args:Nx\tagstructbegin{tag=Reference,ref=cite.#1\@extra@b@citeb}
+ \exp_args:Ne\tagstructbegin{tag=Reference,ref=cite.#1\@extra@b@citeb}
\tagmcbegin{}
}
\AddToHookWithArguments{bibcite/after}[tag]
@@ -318,7 +329,7 @@
{
\leavevmode
\tag_mc_end_push:
- \exp_args:Nx\tag_struct_begin:n{tag=Reference,ref=cite.#1\@extra@b@citeb}
+ \exp_args:Ne\tag_struct_begin:n{tag=Reference,ref=cite.#1\@extra@b@citeb}
\tag_mc_begin:n{}
}
\AddToHook{cmd/hyper@natlinkend/after}
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-bib.pdf b/macros/latex-dev/required/latex-lab/latex-lab-bib.pdf
index 59569a1735..4abf970ebf 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-bib.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-bib.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-block.dtx b/macros/latex-dev/required/latex-lab/latex-lab-block.dtx
index e0a723ca87..75203f8ed5 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-block.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-block.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: latex-lab-block.dtx (C) Copyright 2021-2023 LaTeX Project
+%% File: latex-lab-block.dtx (C) Copyright 2021-2024 LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -9,10 +9,10 @@
%
% https://www.latex-project.org/lppl.txt
%
-\def\ltlabblockdate{2023-09-01}
-\def\ltlabblockversion{0.8h}
+\def\ltlabblockdate{2024-02-12}
+\def\ltlabblockversion{0.8l}
%<*driver>
-\documentclass{l3doc}
+\documentclass[kernel]{l3doc}
\usepackage{amstext}
\EnableCrossrefs
\CodelineIndex
@@ -308,7 +308,7 @@
% \end{TemplateDescription}
%
% The maximum number of \xt{blockenv}s that can be nested into each
-% other is is restricted by the \LaTeX{} counter
+% other is restricted by the \LaTeX{} counter
% \texttt{maxblocklevels} with a default value of \texttt{6}. If this
% value is increased then it is necessary to provide additional
% instances, e.g., \texttt{displayblock-7}, etc. Decreasing is, of
@@ -646,11 +646,59 @@
%
% \end{description}
%
+% \section{Debugging}
+%
+% \begin{function}{\DebugBlocksOn,\DebugBlocksOff, \block_debug_on:, \block_debug_off:}
+%
+% These commands enable/disable debugging messages.
+%
+% \end{function}
%
+% \section{New and redefined kernel command}
+%
+% \begin{function}{\@doendpe}
+% The original \LaTeXe{} command is augmented to allow for tagging.
+% \end{function}
%
+% \begin{function}{\legacyverbatimsetup,\legacylistsetupcode}
+% \emph{to be documented}
+% \end{function}
+%
+% \begin{function}{\@setupverbinvisiblespace}
+% A counterpart definition to the kernel command \cs{@setupverbinvisiblespace},
+% needed as we need to handle real space chars in verbatim.
+% \end{function}
+%
+% \begin{function}{endblockenv,\g_block_nesting_depth_int}
+% \emph{to be documented}
+% \end{function}
+%
+% \begin{function}{\newtheorem,\@thm,\@begintheorem}
+% Redefined to make theorems tagging aware.
+% \end{function}
%
+% \begin{function}{\item,\@itemlabel}
+% The \cs{item} is redefined.
+% \end{function}
%
-%
+% \begin{function}{\c@maxblocklevels}
+% A counter to increase or decrease the number of supported
+% level. If increased, one needs to supply additional level instances.
+% \end{function}
+%
+% \begin{function}{\begin}
+% The \cs{begin} is slightly redefine to handle \cs{@doendpe} better.
+% TODO: move to kernel
+% \end{function}
+%
+% \begin{function}{\para_end:}
+% TODO: consider name, document
+% \end{function}
+%
+% \begin{function}{para/begin}
+% The para/begin hook is enhanced to support list ends
+% \end{function}
+%
% \end{documentation}
%
% \StopEventually{\setlength\IndexMin{200pt} \PrintIndex }
@@ -674,10 +722,6 @@
blockenv implementation]
% \end{macrocode}
%
-% We make use of templates:
-% \begin{macrocode}
-\RequirePackage{xtemplate}
-% \end{macrocode}
% Generell kernel changes, also loaded by the sec and toc code.
% \begin{macrocode}
\RequirePackage{latex-lab-kernel-changes}
@@ -691,7 +735,7 @@
\tl_new:N \l_@@_item_align_tl
\tl_new:N\l_@@_legacy_env_params_tl
% \end{macrocode}
-
+%
% \subsection{Handling \cs{par} after the end of the list}
%
% An empty line (or a \cs{par}) after a list has semantic meaning as
@@ -767,11 +811,11 @@
% given use in the document. This section is devoted to template
% interfaces, and the template code is covered later.
% \begin{macrocode}
-\DeclareObjectType{blockenv}{1}
-\DeclareObjectType{block}{1}
-\DeclareObjectType{para}{1}
-\DeclareObjectType{list}{1}
-\DeclareObjectType{item}{1}
+\NewTemplateType{blockenv}{1}
+\NewTemplateType{block}{1}
+\NewTemplateType{para}{1}
+\NewTemplateType{list}{1}
+\NewTemplateType{item}{1}
% \end{macrocode}
% \end{objecttype}
%
@@ -907,12 +951,9 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\tl_if_novalue:nTF}
-%
% \begin{macrocode}
\cs_generate_variant:Nn \tl_if_novalue:nTF { o }
% \end{macrocode}
-% \end{macro}
%
%
% \subsubsection{Debugging}
@@ -1342,14 +1383,14 @@
\@definecounter {#2}
\IfNoValueTF {#4}
{ % @ynthm
- \tl_gset:cx { the #2 }
+ \tl_gset:ce { the #2 }
{
\@thmcounter{#2}
}
}
{ % @xnthm
\@newctr{#1}[#4]
- \tl_gset:cx { the #2 }
+ \tl_gset:ce { the #2 }
{
\expandafter\noexpand\csname the#4\endcsname
\@thmcountersep
@@ -1802,7 +1843,7 @@
fixed-word-spaces = \l__par_fixed_word_spaces_bool , % name??
final-hyphen-demerits = \finalhyphendemerits ,
cr-cmd = \\ ,
- para-class = \l_tag_para_attr_class_tl ,
+ para-class = \l__tag_para_attr_class_tl ,
}
{
\tl_if_empty:nF {#1} { \SetTemplateKeys{para}{std}{#1} }
@@ -2488,10 +2529,13 @@
{
\@inmatherr \item
% \end{macrocode}
-% TODO: Test for being outside of a list needs updating!
+% TODO: Check if test for being outside of a list is sensible
% \begin{macrocode}
- \tl_if_empty:oTF \@@_item_instance:n %%FMi?
- { \msg_error:nnn { @@ } { item-in-nonlist } { \item[{#1}] } }
+ \cs_if_free:NTF \@@_item_instance:n
+ {
+ \@latex@error{Lonely~\string\item--perhaps~a~missing~
+ list~environment}\@ehc
+ }
{
\legacy_if:nTF { @newlist }
{ \__kernel_list_item_begin: }
@@ -2630,7 +2674,7 @@
%
% \item Then open an new (inner) structure (by default
% \texttt{Figure} but typically the one specified on the instance).
-% \item At the end of the block close the the inner structure
+% \item At the end of the block close the inner structure
% (\texttt{Figure} or explicit one)
% but leave the \texttt{text-unit} open to be either continued or closed due to a
% following \cs{par}.
@@ -3290,6 +3334,7 @@
\DeclareInstance{item}{description}{std}
{
label-format = \normalfont\bfseries #1 ,
+ label-align = left
}
% \end{macrocode}
% \end{instance}
@@ -3389,9 +3434,7 @@
%
% In this section we provide code to the various kernel hooks to support
% the tagging of the different displayblock environments.
-%
-%
-%
+%
% All of the following definitions should only be made if tagging
% is active!
% \begin{macrocode}
@@ -3424,8 +3467,12 @@
{
\int_compare:nNnT \l_@@_flattened_level_int < 2
{
- \int_gincr:N \g__tag_para_main_begin_int
- \tagstructbegin{tag=\l__tag_para_main_tag_tl}
+ \__tag_gincr_para_main_begin_int:
+ \tag_struct_begin:n
+ {
+ tag=\l__tag_para_main_tag_tl,
+ attribute-class=\l__tag_para_main_attr_class_tl,
+ }
}
}
}
@@ -3445,7 +3492,7 @@
\cs_set:Npn \@@_beginpar_hmode:N #1
{
\tag_mc_end:
- \int_gincr:N \g__tag_para_end_int
+ \__tag_gincr_para_end_int:
\@@_debug_typeout:n{increment~ /P \on@line }
\bool_if:NT \l__tag_para_show_bool
{ \tag_mc_begin:n{artifact}
@@ -3492,7 +3539,7 @@
{
\@@_debug_typeout:n{Structure-end~
\l__tag_para_main_tag_tl\space after~ displayblock \on@line }
- \int_gincr:N \g__tag_para_main_end_int
+ \__tag_gincr_para_main_end_int:
\tag_struct_end: %text-unit
}
}
@@ -3551,16 +3598,20 @@
{
\bool_if:NF \l__tag_para_flattened_bool
{
- \int_gincr:N \g__tag_para_main_begin_int
- \tag_struct_begin:n{tag=\l__tag_para_main_tag_tl}
+ \__tag_gincr_para_main_begin_int:
+ \tag_struct_begin:n
+ {
+ tag=\l__tag_para_main_tag_tl,
+ attribute-class=\l__tag_para_main_attr_class_tl,
+ }
}
}
- \int_gincr:N \g__tag_para_begin_int
+ \__tag_gincr_para_begin_int:
\@@_debug_typeout:n{increment~ P \on@line }
\tag_struct_begin:n
{
tag=\l__tag_para_tag_tl
- ,attribute-class=\l_tag_para_attr_class_tl
+ ,attribute-class=\l__tag_para_attr_class_tl
}
\__tag_check_para_begin_show:nn {green}{#1}
\tag_mc_begin:n {}
@@ -3572,15 +3623,19 @@
\cs_new_protected:Npn \@@_start_para_structure_unconditionally:n #1 {
\bool_if:NF \l__tag_para_flattened_bool
{
- \int_gincr:N \g__tag_para_main_begin_int
- \tag_struct_begin:n{tag=\l__tag_para_main_tag_tl}
+ \__tag_gincr_para_main_begin_int:
+ \tag_struct_begin:n
+ {
+ tag=\l__tag_para_main_tag_tl,
+ attribute-class=\l__tag_para_main_attr_class_tl,
+ }
}
- \int_gincr:N \g__tag_para_begin_int
+ \__tag_gincr_para_begin_int:
\@@_debug_typeout:n{increment~ P \on@line }
\tag_struct_begin:n
{
tag=\l__tag_para_tag_tl
- ,attribute-class=\l_tag_para_attr_class_tl
+ ,attribute-class=\l__tag_para_attr_class_tl
}
\__tag_check_para_begin_show:nn {green}{#1}
\tag_mc_begin:n {}
@@ -3594,14 +3649,14 @@
{
\bool_if:NT \l__tag_para_bool
{
- \int_gincr:N \g__tag_para_end_int
+ \__tag_gincr_para_end_int:
\@@_debug_typeout:n{increment~ /P \on@line }
\tag_mc_end:
\__tag_check_para_end_show:nn {red}{}
\tag_struct_end:
\bool_if:NF \l__tag_para_flattened_bool
{
- \int_gincr:N \g__tag_para_main_end_int
+ \__tag_gincr_para_main_end_int:
\tag_struct_end:
}
}
@@ -3657,7 +3712,7 @@
\DeclareRobustCommand*\begin[1]{%
\UseHook{env/#1/before}%
\@ifundefined{#1}%
- {\def\reserved@a{\@latex@error{Environment #1 undefined}\@eha}}%
+ {\def\reserved@a{\@latex@error{Environment~#1~undefined}\@eha}}%
{\def\reserved@a{\def\@currenvir{#1}%
\edef\@currenvline{\on@line}%
\@execute@begin@hook{#1}%
@@ -3680,7 +3735,7 @@
{
\bool_if:NF \l__tag_para_flattened_bool
{
- \int_gincr:N \g__tag_para_main_end_int
+ \__tag_gincr_para_main_end_int:
\tag_struct_end:
}
\@endpefalse
@@ -3722,7 +3777,7 @@
\@@_debug_typeout:n{block-end \on@line}
\legacy_if:nT { @endpe }
{
- \int_gincr:N \g__tag_para_main_end_int
+ \__tag_gincr_para_main_end_int:
\@@_debug_typeout:n{close~ /text-unit \on@line}
\tagstructend
}
@@ -3792,7 +3847,7 @@
\cs_set:Npn \__kernel_list_label_begin: {
%
% FMi: this needs a different logic to decide when to make the label
-% an artifact (after cleaning up the the \item code ), therefore
+% an artifact (after cleaning up the \item code ), therefore
% disabled for now
% \tl_if_empty:oTF \@itemlabel
% {
@@ -3835,7 +3890,7 @@
\cs_set:Npn \@@_list_item_end: {
\legacy_if:nT { @endpe }
{
- \int_gincr:N \g__tag_para_main_end_int
+ \__tag_gincr_para_main_end_int:
\tagstructend % text-unit
% \@@_debug_typeout:n{Structure-end~ P~ at~ item-end \on@line }
}
@@ -3854,7 +3909,7 @@
\cs_set:Npn \@@_list_end: {
\legacy_if:nT { @endpe }
{
- \int_gincr:N \g__tag_para_main_end_int
+ \__tag_gincr_para_main_end_int:
\tagstructend % text-unit
\@@_debug_typeout:n{Structure-end~ P~ at~ list-end \on@line }
}
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-block.pdf b/macros/latex-dev/required/latex-lab/latex-lab-block.pdf
index 7cd08195e3..44c6602ada 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-block.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-block.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-firstaid.dtx b/macros/latex-dev/required/latex-lab/latex-lab-firstaid.dtx
index e2ee78b2ff..a50b367837 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-firstaid.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-firstaid.dtx
@@ -16,8 +16,8 @@
%
% for those people who are interested or want to report an issue.
%
-\def\ltlabfirstaiddate{2023-07-20}
-\def\ltlabfirstaidversion{0.85a}
+\def\ltlabfirstaiddate{2024-01-21}
+\def\ltlabfirstaidversion{0.85b}
%<*driver>
\documentclass{l3doc}
\EnableCrossrefs
@@ -64,7 +64,17 @@
\ltlabfirstaiddate\space v\ltlabfirstaiddate\space
Temporary patches to external packages needed for the tagging project]
% \end{macrocode}
-
+% \subsection{ams classes}
+% The amsart and amsbook classes do not use \cs{@author} to store the author list
+% but a command \cs{authors}. To be able to nevertheless use the authors in the
+% xmp-metadata we map \cs{@author} to this new command.
+%
+% \begin{macrocode}
+\AddToHook{class/amsart/after}
+ {\def\@author{\authors}}
+\AddToHook{class/amsbook/after}
+ {\def\@author{\authors}}
+% \end{macrocode}
% \subsection{blindtext}
% The blindtext package generates lists with nested \cs{loop} command.
% The inner loop introduces a group around the list which error when lists are tagged
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-firstaid.pdf b/macros/latex-dev/required/latex-lab/latex-lab-firstaid.pdf
index 578d70101e..8db9946ef4 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-firstaid.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-firstaid.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-float.dtx b/macros/latex-dev/required/latex-lab/latex-lab-float.dtx
index 3bd3483600..e1c70968ab 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-float.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-float.dtx
@@ -16,8 +16,8 @@
%
% for those people who are interested or want to report an issue.
%
-\def\ltlabfloatdate{2023-07-20}
-\def\ltlabfloatversion{0.81a}
+\def\ltlabfloatdate{2024-02-05}
+\def\ltlabfloatversion{0.81c}
%<*driver>
\documentclass{l3doc}
\EnableCrossrefs
@@ -86,8 +86,8 @@
% In PDF~2.0 there is the suitable \texttt{Aside} tag which hopefully will
% be handled correctly regarding the reading order once processor actually support
% PDF~2.0. But in PDF~1.7 we rolemap it to \texttt{Note} and this doesn't lead to
-% a good reading order. The code therefore collect the float structures and moves
-% them to a \texttt{Sect} the end of the document or the chapter
+% a good reading order. The code therefore collects the float structures and moves
+% them to a \texttt{Sect} at the end of the document or the chapter
% (H-floats once they are handled will not be moved).
%
% To fulfill the requirement that a \texttt{Caption} should be at the begin or end, we always
@@ -106,6 +106,8 @@
%
% The code add two keys for the \cs{tagtool} command
%
+%
+% \begin{function}{flush-floats,split-float}
% \begin{description}
% \item[flush-floats] This will flush out the collected floats sofar (currently
% table and figure. The value is a sectioning level, e.g. \texttt{section} or \texttt{chapter},
@@ -117,9 +119,19 @@
% \item[split-float] This can be used inside a float if there are two captions.
% It will only work reasonably well if the content of the float parts are in a sensible order
% and can be separated by this command. More complex setups with tabulars will need more
-% thoughts
+% thoughts.
+% \end{description}
+% \end{function}
+%
+% \section{Kernel commands}
+% \begin{function}{\@current@float@struct}
+% This variable holds the structure number of current float structure.
+% \end{function}
%
-% \end{description}
+% \begin{function}{\@makecaption}
+% \cs{@makecaption} is defined by the classes so we overwrite it for now
+% at begin document.
+% \end{function}
%
%
% \begin{macrocode}
@@ -182,7 +194,7 @@
\seq_map_inline:Nn\g_@@_float_types_seq
{
\tag_struct_begin:n{tag=##1s,stash}
- \prop_gput:Nnx\g_@@_float_sect_prop {##1-struct}{\int_use:N\c@g__tag_struct_abs_int}
+ \prop_gput:Nne\g_@@_float_sect_prop {##1-struct}{\int_use:N\c@g__tag_struct_abs_int}
\tag_struct_end:
}
}
@@ -239,6 +251,7 @@
{\par\__tag_sec_end:n{-10}\@@_float_stop_sect:}
\DeclareHookRule{tagpdf/finish/before}{latex-lab/float}{before}{tagpdf}
% \end{macrocode}
+%
% \subsection{Splitting floats}
% \begin{macro}{split-float}
% TODO: check if the target affect spacing!!
@@ -249,7 +262,7 @@
{
\@@_float_end:
\@@_float_begin:
- \MakeLinkTarget[tagstructure]{g__tag_struct_abs_int}
+ \MakeLinkTarget*{floatstructure.\int_use:N\c@g__tag_struct_abs_int}
}
}
% \end{macrocode}
@@ -290,12 +303,12 @@
{
\exp_args:Ne
\tag_struct_begin:n{tag=float,parent=0\prop_item:No\g_@@_float_sect_prop{\@captype-struct}}%
- \prop_gput:Nxx \g_@@_float_sect_prop {\@captype-used}{true}
+ \prop_gput:Nee \g_@@_float_sect_prop {\@captype-used}{true}
}
{
\tag_struct_begin:n{tag=float}
}
- \tl_set:Nx\@current@float@struct{\tag_get:n{struct_num}}%
+ \tl_set:Ne\@current@float@struct{\tag_get:n{struct_num}}%
\typeout{Float structure: \@current@float@struct}
}
@@ -381,7 +394,7 @@
% \end{macrocode}
% We add a target for links. TODO: check that it doesn't affect spacing!!
% \begin{macrocode}
- \MakeLinkTarget[tagstructure]{g__tag_struct_abs_int}%
+ \MakeLinkTarget*{floatstructure.\number\value{g__tag_struct_abs_int}}%
}%
% \end{macrocode}
% The end code of the float ...
@@ -446,10 +459,24 @@
\let\@kernel@refstepcounter\refstepcounter %as long it is not in the kernel
\def\caption{%
\ifx\@captype\@undefined
- \@latex@error{\noexpand\caption outside float}\@ehd
+ \@latex@error{\noexpand\caption\c_space_tl outside~float}\@ehd
\expandafter\@gobble
- \else
- \@kernel@refstepcounter\@captype
+ \else
+% \end{macrocode}
+% if a caption is used outside a float no
+% target has been set and \cs{@current@float@struct} is empty
+% \begin{macrocode}
+ \tl_if_empty:NTF\@current@float@struct
+ {
+ \refstepcounter\@captype
+ }
+ {
+ \@kernel@refstepcounter\@captype
+% \end{macrocode}
+% we need to reset the target for \cs{addcontentsline}.
+% \begin{macrocode}
+ \xdef\@currentHref{floatstructure.\@current@float@struct}%
+ }
\expandafter\@firstofone
\fi
{\@dblarg{\@caption\@captype}}%
@@ -471,7 +498,6 @@
{
\long\def\@makecaption#1#2{%
\vskip\abovecaptionskip
- \xdef\@currentHref{tagstructure.\@current@float@struct}%
% \end{macrocode}
% we don't want tagging when storing the caption for the singleline check
% \begin{macrocode}
@@ -482,12 +508,21 @@
% we stop paratagging. TODO: check
% \begin{macrocode}
\tagtool{para=false}
- \tag_struct_begin:n{tag=Caption,parent=\@current@float@struct}
+% \end{macrocode}
+% if caption is used outside a float there is perhaps no number, then we use
+% the parent structure and hope ...
+% \begin{macrocode}
+ \tl_if_empty:NT \@current@float@struct
+ { \tl_set:Ne \@current@float@struct {\tag_get:n{struct_num}} }
+ \tag_struct_begin:n{tag=Caption,parent=\@current@float@struct}
% \end{macrocode}
% move the caption to the begin of the float structure:
% \begin{macrocode}
- \seq_gpop_right:cN {g__tag_struct_kids_\@current@float@struct _seq}\l_@@_tmpa_tl
- \seq_gput_left:cV {g__tag_struct_kids_\@current@float@struct _seq}\l_@@_tmpa_tl
+ \tag_if_active:T
+ {
+ \seq_gpop_right:cN {g__tag_struct_kids_\@current@float@struct _seq}\l_@@_tmpa_tl
+ \seq_gput_left:cV {g__tag_struct_kids_\@current@float@struct _seq}\l_@@_tmpa_tl
+ }
\ifdim \wd\@tempboxa >\hsize
\tag_struct_begin:n{tag=Lbl}
\tag_mc_begin:n{}
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-float.pdf b/macros/latex-dev/required/latex-lab/latex-lab-float.pdf
index 1af101107f..e691200085 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-float.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-float.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-footnotes.pdf b/macros/latex-dev/required/latex-lab/latex-lab-footnotes.pdf
index e0b8bc5580..4e291d6abf 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-footnotes.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-footnotes.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-graphic.dtx b/macros/latex-dev/required/latex-lab/latex-lab-graphic.dtx
index 158b0d2a9c..9585bee189 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-graphic.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-graphic.dtx
@@ -184,7 +184,10 @@
\RequirePackage{l3opacity}
% \end{macrocode}
%
-%
+% Needed during switch to e-type:
+% \begin{macrocode}
+\cs_generate_variant:Nn \@@_prop_gput:Nnn {cne}
+% \end{macrocode}
% \begin{macro}{\@@_graphic_savepos:n}
% this is the command which stores the position. Similar to
% zref-savepos it uses two savepos commands
@@ -894,7 +897,7 @@
% The structure and the mc must be open earlier, before the \cs{setbox} (at least
% for luatex it has to). TODO: think about interface if more attributes are needed.
% \begin{macrocode}
- \@@_prop_gput:cnx
+ \@@_prop_gput:cne
{ g_@@_struct_\int_eval:n {\c@g_@@_struct_abs_int}_prop }
{ A }
{
@@ -970,7 +973,7 @@
{red}
{\int_use:N\g_@@_graphic_int}
}
- \@@_prop_gput:cnx
+ \@@_prop_gput:cne
{ g_@@_struct_\int_eval:n {\c@g_@@_struct_abs_int}_prop }
{ A }
{
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-graphic.pdf b/macros/latex-dev/required/latex-lab/latex-lab-graphic.pdf
index bf57d1bd95..fe21c3e51a 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-graphic.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-graphic.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-marginpar.dtx b/macros/latex-dev/required/latex-lab/latex-lab-marginpar.dtx
new file mode 100644
index 0000000000..ca79d8a67f
--- /dev/null
+++ b/macros/latex-dev/required/latex-lab/latex-lab-marginpar.dtx
@@ -0,0 +1,259 @@
+% \iffalse meta-comment
+%
+%% File: latex-lab-marginpar.dtx
+%%
+% Copyright (C) 2024 LaTeX Project
+%
+% It may be distributed and/or modified under the conditions of the
+% LaTeX Project Public License (LPPL), either version 1.3c of this
+% license or (at your option) any later version. The latest version
+% of this license is in the file
+%
+% https://www.latex-project.org/lppl.txt
+%
+%
+% The development version of the bundle can be found below
+%
+% https://github.com/latex3/latex2e/required/latex-lab
+%
+% for those people who are interested or want to report an issue.
+%
+\def\ltlabmarginpardate{2024-02-12}
+\def\ltlabmarginparversion{0.85b}
+
+%<*driver>
+\documentclass[kernel]{l3doc}
+\EnableCrossrefs
+\CodelineIndex
+\begin{document}
+ \DocInput{latex-lab-marginpar.dtx}
+\end{document}
+%</driver>
+%
+% \fi
+%
+% \title{The \textsf{latex-lab-marginpar} package\\
+% Changes related to the tagging of margin notes}
+% \author{\LaTeX{} Project\thanks{Initial implementation done by Ulrike Fischer}}
+% \date{v\ltlabmarginparversion\ \ltlabmarginpardate}
+%
+% \maketitle
+%
+% \newcommand{\xt}[1]{\textsl{\textsf{#1}}}
+% \newcommand{\TODO}[1]{\textbf{[TODO:} #1\textbf{]}}
+% \newcommand{\docclass}{document class \marginpar{\raggedright document class
+% customizations}}
+%
+% \providecommand\hook[1]{\texttt{#1\DescribeHook[noprint]{#1}}}
+% \providecommand\socket[1]{\texttt{#1\DescribeSocket[noprint]{#1}}}
+% \providecommand\plug[1]{\texttt{#1\DescribePlug[noprint]{#1}}}
+%
+% \NewDocElement[printtype=\textit{socket},idxtype=socket,idxgroup=Sockets]{Socket}{socketdecl}
+% \NewDocElement[printtype=\textit{hook},idxtype=hook,idxgroup=Hooks]{Hook}{hookdecl}
+% \NewDocElement[printtype=\textit{plug},idxtype=plug,idxgroup=Plugs]{Plug}{plugdecl}
+%
+% \begin{abstract}
+% \end{abstract}
+%
+% \section{Introduction}
+%
+% This module contains changes to improve the tagging (in the standard classes) of
+% margin notes created with the \cs{marginpar} command.
+%
+% Such margin notes are rather small but nevertheless tagging is not trivial and poses
+% a number of interesting problems both regarding the structure and the implementation.
+%
+% \subsection{Structure}
+% \cs{marginpar} creates small boxes in the margin of a page.
+% While they are technically floats they also typically
+% relate to the paragraph beside them, so their structure element should be placed near
+% such a paragraph.
+%
+% They can be tagged either as artifacts (if they are merely distracting decoration),
+% as small headings before the paragraph, or as |Aside|. Unlike the PDF 1.7 fallback |Note|
+% the structure |Aside| is not allowed inside |P|,
+% so if |Aside| is used, it must be placed before or after the current |P| in the surounding |text-unit|,
+% or it must split the |P|. Splitting is probably not so good as
+% |\marginpar| is often used somewhere in the middle of sentence.
+% The best default is probably to use |Aside|, find the parent |text-unit| and add it there.
+%
+% \subsection{Implementation}
+%
+% |marginpar| has an optional argument which allows to define a different content
+% on left/right margins for odd/even pages (depending on twoside and \cs{reversemarginpar}).
+%
+% The current implementation stores *both* arguments in boxes and
+% decides in the output routine which
+% one to use. This is quite problematic for tagging, as the unused box produces
+% structure objects, literals, labels, MCID numbers,
+% and perhaps OBJR-objects from links
+% which must be later thrown away again (or are thrown away by the engine).
+% While it is theoretically not impossible to create
+% both boxes while taging is active but to keep everything on hold and insert
+% the real structure only when the box is used it is in practice quite difficult,
+% slow and error prone.
+%
+% There are a number of options to avoid this hassle.
+%
+% \begin{description}
+% \item[Minimal tagging] One option is to disable tagging when the boxes
+% are built and when the box is used to surround them with a simple Aside.
+%
+% \begin{description}
+% \item[Pro:] easy to implement
+% \item[Contra:]
+% Content that perhaps needed tagging (|\LaTeX| logo with /ActualText, images, links) is not tagged.
+% \end{description}
+%
+% \item[Remaking the box]
+% Tagging is deactivated when the boxes are created.
+% The arguments are stored and when the box should be used in the output routine
+% (and when it is known which one will be used) the box is (re)created, now with proper tagging.
+%
+% Contra: The content can change e.g. if it uses counters or macros that are redefine later before the
+% output routine is called. As tagging is done later, it is not trivial to insert the
+% |Aside| in the right place in the paragraph structure.
+%
+% \item[Two pass compilation]
+% A label is used to detect which argument/boxed is used and
+% tagging is activated only for this one.
+%
+% Contra: costs a |label| and requires a two pass compilation (which is needed anyway).
+% This should be ok. |\marginnote| uses a label too, and the same
+% label could also be used to resolve problems if a margin note
+% moves to a new page (and so replace the mparhack package).
+% \end{description}
+%
+% The last option seems the best and is therefore implemented.
+%
+%
+% \section{Implementation}
+% \begin{macrocode}
+%<*package>
+%<@@=tag>
+% \end{macrocode}
+% \begin{macrocode}
+\ProvidesExplPackage {latex-lab-testphase-marginpar} {\ltlabmarginpardate} {\ltlabmarginparversion}
+ {Changes related to the tagging of the margin notes}
+% \end{macrocode}
+% \subsection{Variables}
+% We need a variable to make the label unique.
+% Todo: Not sure about the name.
+% \begin{macro}{\g__kernel_marginpar_int}
+% \begin{macrocode}
+\int_new:N \g__kernel_marginpar_int
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Tagging sockets}
+%
+% \begin{socketdecl}{tagsupport/marginpar/begin,tagsupport/marginpar/end}
+% \begin{macrocode}
+\socket_new:nn {tagsupport/marginpar/begin}{0}
+\socket_new:nn {tagsupport/marginpar/end}{0}
+% \end{macrocode}
+% \end{socketdecl}
+% \begin{plugdecl}{tagsupport/marginpar/begin,tagsupport/marginpar/end}
+% \begin{macrocode}
+\socket_new_plug:nnn {tagsupport/marginpar/begin}{default}
+ {
+ \if_mode_horizontal:
+ \tag_mc_end:
+ \tag_struct_begin:n{tag=Aside,parent=\g__tag_para_main_struct_tl}%
+ \else:
+ \tag_struct_begin:n{tag=Aside}%
+ \fi:
+ }
+\socket_new_plug:nnn {tagsupport/marginpar/end}{default}
+ {
+ \tag_struct_end:
+ \if_mode_horizontal: \tag_mc_begin:n{} \fi:
+ }
+\socket_assign_plug:nn {tagsupport/marginpar/begin}{default}
+\socket_assign_plug:nn {tagsupport/marginpar/end}{default}
+% \end{macrocode}
+% \end{plugdecl}
+
+% \subsection{Kernel command changes}
+% \begin{macro}{\@savemarbox }
+% We add sockets that add a tagging structure Aside:
+% \begin{macrocode}
+\long\def \@savemarbox #1#2{%
+ \UseTaggingSocket{marginpar/begin}
+ \global\setbox #1%
+ \color@vbox
+ \vtop{%
+ \hsize\marginparwidth
+ \@parboxrestore
+ \@marginparreset
+ #2\par
+ \@minipagefalse
+ \outer@nobreak
+ }%
+ \color@endbox
+ \UseTaggingSocket{marginpar/end}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@ympar}
+% We must avoid that \cs{@xympar} creates tagging structure:
+% \begin{macrocode}
+\long\def\@ympar#1{%
+ \@savemarbox\@marbox{#1}%
+ \global\setbox\@currbox\copy\@marbox
+ \tag_stop:
+ \@xympar
+ \tag_start:}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@xmpar}
+% \cs{@xmpar} is the command used if an optional argument is present.
+% In this case we must stop tagging for \cs{@xympar} as above
+% but also decide which of the two @savemarbox should have tagging active.
+% We add a label to \cs{@marbox}. If that exist tagging is activated for this
+% box else for the other one.
+% \begin{macrocode}
+\long\def\@xmpar[#1]#2{%
+ \int_gincr:N\g__kernel_marginpar_int
+ \property_if_recorded:eTF { tag_marginpar-opt-\int_use:N\g__kernel_marginpar_int }
+ {
+ \@savemarbox\@marbox {#1
+ \property_record:ee
+ { tag_marginpar-opt-\int_use:N\g__kernel_marginpar_int }{page}
+ }%
+ \tag_stop:
+ \@savemarbox\@currbox{#2}%
+ \tag_start:
+ }
+% \end{macrocode}
+% order matters! the tagged box should be first so that it can pick up
+% the correct text-unit number.
+% \begin{macrocode}
+ {
+ \@savemarbox\@currbox{#2}%
+ \tag_stop:
+ \@savemarbox\@marbox{#1
+ \property_record:ee
+ { tag_marginpar-opt-\int_use:N\g__kernel_marginpar_int }{page}}
+ \tag_start:
+ }
+ \tag_stop:
+ \@xympar
+ \tag_start:
+ }
+%</package>
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+%<*latex-lab>
+\ProvidesFile{marginpar-latex-lab-testphase.ltx}
+ [\ltlabmarginpardate\space v\ltlabmarginparversion\space
+ Changes related to the tagging of the margin notes]
+
+\RequirePackage{latex-lab-testphase-marginpar}
+
+%</latex-lab>
+% \end{macrocode}
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-marginpar.pdf b/macros/latex-dev/required/latex-lab/latex-lab-marginpar.pdf
new file mode 100644
index 0000000000..33be164cfa
--- /dev/null
+++ b/macros/latex-dev/required/latex-lab/latex-lab-marginpar.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-math.dtx b/macros/latex-dev/required/latex-lab/latex-lab-math.dtx
index 285471addc..03eb8e42d0 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-math.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-math.dtx
@@ -2,7 +2,7 @@
%
%% File: latex-lab-math.dtx
%
-% Copyright (C) 2022-2023 The LaTeX Project
+% Copyright (C) 2022-2024 The LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -19,8 +19,8 @@
% for those people who are interested or want to report an issue.
%
%
-\def\ltlabmathdate{2023-09-11}
-\def\ltlabmathversion{0.5c}
+\def\ltlabmathdate{2024-02-09}
+\def\ltlabmathversion{0.5i}
%
%<*driver>
\documentclass{l3doc}
@@ -46,7 +46,14 @@
% \newcommand\NEW[1]{\marginpar{\mbox{}\hfill\fbox{New: #1}}}
% \providecommand\class[1]{\texttt{#1.cls}}
% \providecommand\pkg[1]{\texttt{#1}}
-% \providecommand\hook[1]{\texttt{#1}}
+%
+% \providecommand\hook[1]{\texttt{#1\DescribeHook[noprint]{#1}}}
+% \providecommand\socket[1]{\texttt{#1\DescribeSocket[noprint]{#1}}}
+% \providecommand\plug[1]{\texttt{#1\DescribePlug[noprint]{#1}}}
+%
+% \NewDocElement[printtype=\textit{socket},idxtype=socket,idxgroup=Sockets]{Socket}{socketdecl}
+% \NewDocElement[printtype=\textit{hook},idxtype=hook,idxgroup=Hooks]{Hook}{hookdecl}
+% \NewDocElement[printtype=\textit{plug},idxtype=plug,idxgroup=Plugs]{Plug}{plugdecl}
%
% ^^A \car {...} for marginal comments
% ^^A \car*{...} for longer inline comments
@@ -59,8 +66,6 @@
% {\IfBooleanTF{#1}{\todo[inline,#2]{#3}}^^A
% {\todo[#2]{#3}}}
%
-%
-%
% \begin{abstract}
% This is an experimental prototype. It captures math material
% (basically okay, but the interfaces for packages aren't yet
@@ -75,6 +80,18 @@
% \car*{Todo: update all the documentation! Both here and
% (what little there is!) in the implementation section.}
%
+% Tagging math involves a variety of tasks that require that math is captured before the
+% typesetting
+% \begin{itemize}
+% \item When typesetting the math MC-tags and structure commands must
+% be inserted at the begin and the end, and perhaps also around lines
+% or other subparts of the equation.
+% \item The source and/or a mathml-representation of the source must be available
+% so that it can be (perhaps after some preprocessing) be used in an associated file
+% or in an alternate text
+% \item It must be possible to measure the math for e.g. a bbox setting.
+% \end{itemize}
+%
% This file implements capture of all math mode material at the outer
% level, i.e., a formula is captured in its entirety with inner text
% blocks (possibly containing further math) absorbed as part of the
@@ -84,7 +101,24 @@
%\end{verbatim}
% would only result in a single capture of the tokens
% ``\verb*/a \in A \text{ for all $a<5$}/''.
+%
%
+% \section{Math capture} \label{sec:mathcapture}
+% In the current setup
+% \begin{itemize}
+% \item |$|, |\(...\)| and |$$| grab (through a command in \cs{everymath}/cs{everydisplay})
+% if the boolean \cs{l_@@_collected_bool} is false.
+% If the boolean is true they behave normally and can for example contain verbatim.
+%
+% \item All (registered) environments grab their body
+% regardless of the state of the boolean. For
+% |equation|, |equation*| and |math| this is a change as they no longer can
+% contain verbatim.
+%
+% \item BUG: |\[...\]| grabs if \cs{l_@@_collected_bool} is false. If it is
+% true it falls back to |equation*| and then errors because this can't find the end.
+% \end{itemize}
+%
% \subsection{Code level interfaces}
%
% \begin{function}{\math_register_env:n, \math_register_env:nn}
@@ -109,7 +143,8 @@
% \end{syntax}
% Declares that the captured math content should be passed to the
% \meta{tokens}, which will receive the environment type as |#1| and
-% the content as |#2|.
+% the content as |#2|. The processing is done before the typesetting. It is not
+% applied if \cs{ifmeasuring@} is true.
% \end{function}
%
% \subsection{Document level interfaces}
@@ -129,38 +164,275 @@
% \end{itemize}
% \end{function}
%
+% \section{Math tagging}
+%
+% The tagging code has to handle
+% \begin{itemize}
+% \item the embedding into the surrounding. This means
+% \begin{itemize}
+% \item closing and reopening MC-chunks
+% \item closing and reopening text/P-structures
+% \item handling interferences of the tagging code with penalties and spacing.
+% \end{itemize}
+% \item the actual tagging which means to do some or all of the following tasks:
+% \begin{itemize}
+% \item setup content for an associated source file
+% \item setup content for an associated mathml file
+% \item setup content for the /Alt key
+% \item setup content for the /ActualText key
+% \item setup attributes
+% \item add associated files
+% \item add a Formula structure
+% \item surround subparts (e.g. lines) with Formula sub structures
+% (perhaps with their own set of additional content)
+% \item surround elements of the equation with mathml structure elements
+% (currently only luatex with luamml)
+% \end{itemize}
+% \end{itemize}
+%
+% \subsection{Inline math}
+%
+% The embedding code is added through
+% the sockets
+% \begin{itemize}
+% \item |tagsupport/math/inline/begin|
+% \item |tagsupport/math/inline/end|
+% \end{itemize}
+% The sockets simply push and pop the MC currently. Without
+% tagging they use the noop-plug.
+%
+% The actual tagging is in done through the sockets
+% \begin{itemize}
+% \item |tagsupport/math/inline/formula/begin|
+% This socket takes the math as argument and its code
+% should output it for typesetting. Without tagging the
+% socket uses the identity plug.
+% The |default| plug of the socket calls these three internal sockets
+% for the tagging support:
+% \begin{itemize}
+% \item |tagsupport/math/content| This should set up the various
+% content variables (empty variables are ignored by the structure code
+% and so can be used to suppress a setting).
+% \item |tagsupport/math/struct/begin| This calls \cs{tag_struct_begin:n}.
+% It should also write the associated files if needed.
+% \item |tagsupport/math/substruct/begin| this handles subparts.
+% TODO: does it really make sense in inline math to have that??
+% \end{itemize}
+% \item |tagsupport/math/inline/formula/end|
+% This socket ends the formula structure(s). The |default|
+% plug calls these internal sockets:
+% \begin{itemize}
+% \item |tagsupport/math/substruct/end|
+% \item |tagsupport/math/struct/end|
+% \end{itemize}
+% \end{itemize}
+%
+% \subsection{Display math}
+%
+% \textit{to be written}
+%
+% \subsection{Associated Files}
+%
+% The current code allows the attachment of two types of associated file to the
+% Formula structure:
+% the \LaTeX\ source and a MathML representation.
+% Technically both can be attached---AF is an array
+% of file references---practically there can be problems with PDF consumers:
+% e.g. ngpdf used both and so showed the equation twice
+% (this has been corrected in the newest version) and
+% Foxit seems to see only the first AF in the array (so we attach the
+% mathml as first file).
+%
+% The \LaTeX\ source can be (and is) attached automatically.
+% It can be suppressed by an option with
+% \texttt{math/tex/AF=false}, see below.
+%
+% The MathML is attached if a file |\jobname-mathml.html| is found and
+% if it contains a suitable MathML snippet for the current formula.
+% The MathML processing can be suppressed globally by emptying the list of
+% mathml files with |math/mathml/sources=|. Locally for a formula |math/mathml/AF=false|
+% can be used.
+%
+% For a MathML representation a file with such representations must be provided.
+% If the equation is numbered the numbering should be part of the MathML as
+% the |Lbl| substructure is ignored if an MathML is used (see https://github.com/foxitsoftware/PDF_UA-2).
+%
+% The MathML representation is given in a special format.
+% It is meant to be a valid html file
+% that can be viewed in a browser.
+% For this it can start with |<!DOCTYPE html><html>| and end with |</html>|
+% It should have the extension \texttt{.html}. The \meta{mathml} content
+% is read with special catcodes, so can contain ambersands, hashes, comment chars
+% and unmatched braces such as |<mo>{</mo>|
+%
+% The file should contain a number of representations in this format:
+% \begin{quote}
+% |<div>| \\
+% | <h2>\mml| \meta{key}|</h2>|\\
+% | <p>|\meta{source}|</p>| \\
+% | <p>|\meta{hash}|</p>| \\
+% | <math | \meta{attributes} |>|\\
+% \meta{mathml}\\
+% | </math>|\\
+% |</div>|
+% \end{quote}
+% The keywords |<div>|, |<h2>\mml|, |<p>|, |<math|, |</math>| |</div>| are required as
+% they are used to delimit the arguments by the \LaTeX{} code.
+%
+% \meta{key} and \meta{source} are only used for debugging, they help to identify
+% the equation referred by this representation. The source should be used correctly escaped
+% |&| and |<| so that if gives valid html!
+%
+% \meta{attributes} is not required either, but can e.g. contain attributes
+% to improve the display in a browser:
+% \begin{verbatim}
+% <math alttext="\mathbf{G}" class="ltx_Math" display="inline">
+% \end{verbatim}
+% It can also contain the name space declaration: |xmlns="http://www.w3.org/1998/Math/MathML"|%
+% \footnote{But it is probably not needed and only blows up the PDF.}
+%
+%
+% By default the code tries at the begin of the document
+% to read a file |\jobname-mathml.html| in the |html|-format.
+% The file name can be changed with |mathml/setfiles={filename1,filename2}|
+% (without extension, |html| is added automatically).
+% If there is a list, all files are loaded.
+% If a file doesn't exist it is ignored, only an info is written to the log.
+%
+% Currently every MathML-snippet from a file is embedded into the PDF,
+% it is not checked first if it is actually used (simply writing everything to the PDF
+% is a bit easier than keeping everything in memory and also means that
+% the snippets are one after the other in the PDF).
+%
+% As mentioned above the MathML-AF can be suppressed for the equations in a group with
+% |math/mathml/AF=false|, or
+% completly by setting |math/mathml/sources=| in the preamble.
+%
+% Files embedded in a PDF can be listed in the attachments panel of a PDF viewer.
+% This is probably not so useful for lots of small files (but one could create
+% collections), but as long as PDF editors or viewers don't offer
+% proper support to access the AF it can help so have them there. The MathML are
+% added by default, but the \LaTeX{} source not. This can be changed with
+% |viewer/pane/mathsource=true| (anywhere in the document) and |viewer/pane/mathml=false| (in the
+% preamble, before the external file is read).
+%
+% \subsection{Options}
+%
+%
% \section{Known current bugs, etc.}
% \car*{New Section, now with subsections.\\
% As indicated, these lists are probably incomplete.\\
% Some of these have been addressed in a more recent branch.}
%
% \subsection{Capture/grabbing problems}
-%
+%
% \begin{enumerate}
% \item Incorrect grabbing of |$|-math when there is also
% explicit |$|-math within a \textit{text environment}
% that is itself within the math that should all be grabbed.
+% For example,
+% \begin{verbatim}
+% $a\begin{minipage}{1cm}$b$\end{minipage}$
+% \end{verbatim}
+% would only result in the capture of the tokens
+% ``\verb*/a\begin {minipage}{1cm}/''.
+% This can be avoided by an additional brace group:
+% \begin{verbatim}
+% $a{\begin{minipage}{1cm}$b$\end{minipage}}$
+% \end{verbatim}
+%
% \item Similar incorrect grabbing with |$$| also.
+%
% \item The grabbing, for all the display environments (and |\) \]|), needs
% to deal with nesting: \pkg{amsmath} contains code for this.
-% \item
+%
+% \item The math can't contain verbatim and verbatim-like commands. This is
+% nothing new for the \pkg{amsmath} environments but changes |$| and |\[\]|
+% and |equation*| (see e.g. tagging-project issue \#30).
+%
+% \item Begin and end of the math or math environment can not be hidden in commands.
+% For example \verb+>{$}l<{$}+ in a tabular would lead to errors.
+% Defining |\[| to fall back to |equation*| doesn't work if |equation*| is
+% a grabbing environment.
+%
+% \item The behaviour of |\[...\]| is faulty. See above.
% \end{enumerate}
%
+% \subsection{Fake math}
+% In a number of places in \LaTeX{} math commands (mainly |$|) is used
+% only for technical reason, e.g. to access a math font, to setup a symbol
+% or to use \cs{vcenter}.
+%
+% The code identifies such fake math mostly by making use of the \cs{m@th} command
+% where two methods are used for the automatic detection:
+%
+% \begin{itemize}
+% \item After grabbing math content the code checks if the content contains the token
+% \cs{m@th} and if yes it doesn't call the processor before reinserting
+% the content and perhaps adding tagging code.
+% This method requires that the math can be grabbed (e.g. that the end dollar is visible)
+% and that the \cs{m@th} is visible. It applies for example in \cs{@iiiparbox} where the
+% code from |$\vcenter| to |\m@th$| is grabbed an put back. It does not work for
+% example for |tabular| where the dollars and the \cs{m@th} token are spread around
+% over three commands. |tabular| needs therefore manual intervention.
+%
+% A look in the list of usages (in \texttt{usage-of-m@th.md}) justifies this approach.
+% All usages are either not math at all, or related to small elements that probably
+% shouldn't be grabbed and processed on their own.
+%
+% \item \cs{m@th} is redefined so that it sets the boolean \cs{l_@@_collected_bool}
+% to true. If \cs{m@th} is used inside math that has been grabbed
+% this doesn't change much as the boolean is set by the grabbing anyway. For usages
+% outside math the benefit is not so clear: The setting avoids that in \cs{LaTeXe}
+% the epsilon is processed as math, but it also prevents that the content of the amsmath
+% command \cs{boxed} is processed as math.
+% It means that if one wants to reenable math processing inside some (fake) math
+% one has to do it after \cs{m@th} calls.
+% \end{itemize}
+%
+% Open problems
+% \begin{enumerate}
+% \item The grabbing code doesn't pass the info that it detected a \cs{m@th} token.
+% This means that the tagging code has to do the same check (and doesn't do this
+% in all cases yet).
+%
+% \item Commands are missing to locally disable the grabbing and processing, e.g.
+% to handle |tabular|.
+%
+% \item It must be checked if setting the boolean in \cs{m@th} really makes sense
+% or if commands like \cs{LaTeXe} should be handled manually.
+%
+% \end{enumerate}
+%
+% \subsection{Processor}
+%
+% The grabbed math is at first passed to the processor. The processor is not called
+% in a measuring phase (from the amsmath \cs{ifmeasuring@}) and if the \cs{m@th}
+% token is detected.
+% It is not quite clear what purpose the processor has. As it is a public interface
+% it can't be used for internal code. And typesetting happens later and the processor
+% can't really change this. Currently it is mostly used for debugging and messages.
+% If the \cs{m@th} is found the \cs{l_@@_fakemath_bool} is set, so if the code
+% is changed this must be preserved.
+%
% \subsection{Other problems}
%
% \begin{enumerate}
% \item
-% The presence of \cs{m@th} in association with \cs{ensuremath}
+% The presence of \cs{m@th} in association with \cs{ensuremath}
% does not necessarily indicate fakemath. This is because
% wanting mathsurround to be zero is very reasonable and common,
% \emph{even when the math is genuine} (and hence needs to be collected).
+%
+% TODO: this claim needs some examples.
+%
% \item User-defined environments can create problems; but this area, of
% new, copied and changed environments, has not yet been developed.
%
% \car*{Joseph wrote, inter alia:\\
% My thinking [regarding] \cs{RegisterMathEnvironment}\\
% - (New) Math environments should not be created-then-patched, but only
-% generated by a [(future)] dedicated command (\cs{DeclareMathEnviornment},
+% generated by a [(future)] dedicated command (\cs{DeclareMathEnvironment},
% presumably)\\
% - Math environments created with \pkg{ltcmd} [commands] should not be copied, . . .\\
% - Package authors should be able to manually set up math environments with a public boolean.}
@@ -172,7 +444,10 @@
% \begin{enumerate}
% \item Add (some of) the math display commands that were \enquote{lifted from
% plain}, e.g., \cs{displaylines} \cs{eqalign}(??).
-% \item
+% \item The breqn packages changes catcodes and that isn't yet covered
+% by our mechanism.
+% \item \cs{intertext} is not correctly taken into account by the
+% code splitting multiline math into subformulas.
% \end{enumerate}
%
%
@@ -218,36 +493,823 @@
% have conditional definitions and deals with how to define \cs{[}/\cs{]}
% neatly.
% \begin{macrocode}
-\tl_gput_right:Nn \@kernel@before@begindocument
- { \RequirePackage { amsmath } }
+\AddToHook{begindocument/before}{ \RequirePackage { amsmath } }
% \end{macrocode}
%
%
% \subsection{Data structures}
%
-%
-%
-% \begin{variable}{\l_@@_collected_bool}
+% \begin{variable}{\l_@@_collected_bool}
% Tracks whether math mode material has been collected, which happens inside
% \pkg{amsmath} environments as well as those handled directly here.
+% If true following math will not grab and/or process.
+% See \ref{sec:mathcapture} for details.
+% \begin{macrocode}
+\bool_new:N \l_@@_collected_bool
+% \end{macrocode}
+% \end{variable}
%
+% \begin{variable}{\l_@@_fakemath_bool}
+% Tracks whether math mode material has been identified as fake math during
+% the grabbing phase, which happens currently if the
+% grabbed contents contains the \cs{m@th} token.
%
% \begin{macrocode}
-\bool_new:N \l_@@_collected_bool
+\bool_new:N \l_@@_fakemath_bool
% \end{macrocode}
% \end{variable}
-%
+%
+%
% \car{Change first tl name below: `env' $=>$ `info'?\\
% Or do we need an extra storage tl?}
%
% \begin{variable}{\g_@@_grabbed_env_tl, \g_@@_grabbed_math_tl}
-% \cs{g_@@_grabbed_env_tl} contains the name of the math environment (\texttt{math} in the case
-% of inline math, \cs{g_@@_grabbed_math_tl} the math content.
+% \cs{g_@@_grabbed_env_tl} contains the name of the math environment
+% (\texttt{math} in the case of inline math,
+% \cs{g_@@_grabbed_math_tl} the math content.
% \begin{macrocode}
\tl_new:N \g_@@_grabbed_env_tl
\tl_new:N \g_@@_grabbed_math_tl
% \end{macrocode}
% \end{variable}
+%
+% \begin{variable}{\l_@@_tmpa_tl,\l_@@_tmpa_skip,\l_@@_tmpa_str}
+% Temporary variables
+% \begin{macrocode}
+\tl_new:N \l_@@_tmpa_tl
+\skip_new:N \l_@@_tmpa_skip
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\l_@@_content_alt_tl,
+% \l_@@_content_actual_tl,
+% \l_@@_content_AF_tl}
+% Temporary variables to hold math content that should
+% be used in actual or alt text and stored as AF.
+% \begin{macrocode}
+\tl_new:N \l_@@_content_alt_tl
+\tl_new:N \l_@@_content_actual_tl
+\tl_new:N \l_@@_content_AF_source_tl
+\tl_new:N \l_@@_content_AF_source_tmpa_tl
+\tl_new:N \l_@@_content_AF_mathml_tl
+% \end{macrocode}
+% \end{variable}
+%
+% \subsection{Tagging tools}
+% The following commands implement small tagging code chunks.
+% This should probably be collected and moved into tagpdf later.
+% \begin{macro}{\__tag_tool_close_P:}
+% This closes a P/text-chunk, both the MC and the structure and
+% increases the counter manually.
+% \begin{macrocode}
+\cs_new_protected:Npn \__tag_tool_close_P:
+ {
+ \tag_if_active:T
+ {
+ \tag_mc_end: %end P-chunk, should perhaps be \tag_mc_end_push: ...
+ \__tag_gincr_para_end_int:
+ \__tag_check_para_end_show:nn{red}{} %debug: show para
+ \tag_struct_end:
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% We add also an attribute.
+% \begin{macrocode}
+\tl_new:N\l_@@_attribute_class_tl
+\tagpdfsetup
+ {newattribute = {inline} {/O /Layout /Placement/Inline},
+ newattribute = {display} {/O /Layout /Placement/Block},
+ }
+% \end{macrocode}
+%
+% \subsection{Code related to AF}
+% Booleans to handle the options.
+% \begin{variable}{
+% \l__tag_math_texsource_AF_bool,
+% \l__tag_math_texsource_pane_bool,
+% \l__tag_math_mathml_AF_bool,
+% \g__tag_math_mathml_AF_bool,
+% \l__tag_math_mathml_pane_bool,
+% \l__tag_math_alt_bool
+% }
+% \begin{macrocode}
+\bool_new:N\l__tag_math_texsource_AF_bool
+\bool_new:N\l__tag_math_texsource_pane_bool
+\bool_new:N\l__tag_math_mathml_AF_bool
+\bool_new:N\g__tag_math_mathml_AF_bool
+\bool_new:N\l__tag_math_mathml_pane_bool
+\bool_new:N\l__tag_math_alt_bool
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{
+% \g_@@_mathml_total_int,
+% \g_@@_mathml_int,
+% \g_@@_math_total_int,
+% \g_@@_mathml_AF_found_int,
+% \g_@@_mathml_AF_attached_int,
+% }
+% \cs{g_@@_mml_total_int} records the mathml fragments read in.
+% \cs{g_@@_mml_int} records the mathml fragments read in with a different hash.
+% \cs{g_@@_AF_total_int} records the number of math structures that try to
+% attach a mathml AF.
+% \cs{g_@@_AF_found_int} records the number of math structures for which a fitting
+% mathml is found.
+% \cs{g_@@_AF_attached_int} records the number of math structures which got a mathml fragment
+% (if mathml-AF are not disabled locally this should be the equal to the previous number.
+%
+% \begin{macrocode}
+\int_new:N\g_@@_mathml_total_int
+\int_new:N\g_@@_mathml_int
+\int_new:N\g_@@_math_total_int
+\int_new:N\g_@@_mathml_AF_found_int
+\int_new:N\g_@@_mathml_AF_attached_int
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\l__tag_math_mathml_files_clist}
+% A sequence to store the file list for the mathml.
+% \begin{macrocode}
+\clist_new:N\l__tag_math_mathml_files_clist
+\clist_put_right:Ne\l__tag_math_mathml_files_clist {\c_sys_jobname_str-mathml}
+% \end{macrocode}
+% \end{variable}
+
+% This is the internal variant of the \cs{mml} command.
+% \begin{macro}{\@@_AF_mml:nnnn}
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_AF_mml:nnnn #1 #2 #3 #4
+%#1 number, #2 tex source for debugging, #3 hash, #4 mathml
+ {
+ \int_gincr:N \g_@@_mathml_total_int
+% \end{macrocode}
+% mathml with the same hash should be included only once:
+% \begin{macrocode}
+ \tl_if_exist:cF { g_@@_mathml_#3_tl }
+ {
+ \int_gincr:N \g_@@_mathml_int
+% \end{macrocode}
+% a simple Desc key, take care that it is a valid string!
+% \begin{macrocode}
+ \pdfdict_put:nne {l_pdffile/Filespec} {Desc}{(mathml-#1)}
+ \pdffile_embed_stream:nnN {#4}{mathml-#1.xml}\l_tmpa_tl
+% \end{macrocode}
+% not strictly necessary but makes the files visible in the file attachment
+% page
+% \begin{macrocode}
+ \bool_if:NT \l__tag_math_mathml_pane_bool
+ {\pdfmanagement_add:nne {Catalog/Names}{EmbeddedFiles}{\l_tmpa_tl}}
+ \tl_new:c{g_@@_mathml_#3_tl}
+ \tl_gset_eq:cN{g_@@_mathml_#3_tl}\l_tmpa_tl
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% The html reader.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_AF_html_reader:w#1</h2>#2<p>#3</p>#4<p>#5</p>#6<math{
+ \begingroup
+ \char_set_catcode_other:N\{
+ \char_set_catcode_other:N\}
+ \char_set_catcode_other:N\#
+ \char_set_catcode_other:N\%
+ \@@_AF_html_reader_verb:w{#1}{#3}{#5}<math
+}
+% \end{macrocode}
+% \begin{macrocode}
+\cs_new_protected:Npn\@@_AF_html_reader_verb:w#1#2#3#4~</div>{
+ \endgroup
+ \@@_AF_mml:nnnn{#1}{#2}{#3}{#4}
+ }
+% \end{macrocode}
+
+%
+% \begin{socketdecl}{tagsupport/math/mathml/write}
+% This writes a html-dummy with the hash and the math content.
+% This should be optional, so it uses a socket that can be disabled
+%
+% \begin{macrocode}
+\socket_new:nn {tagsupport/math/mathml/write}{0}
+% \end{macrocode}
+% \end{socketdecl}
+%
+% \begin{plugdecl}{On}
+% \begin{macrocode}
+\socket_new_plug:nnn{tagsupport/math/mathml/write}{On}
+ {
+ \str_set:NV\l_@@_tmpa_str\l_@@_content_AF_source_tl
+ \str_replace_all:Nnn\l_@@_tmpa_str{&}{&amp;}
+ \str_replace_all:Nnn\l_@@_tmpa_str{<}{&lt;}
+ \iow_now:Ne \g_@@_writedummy_iow
+ {
+ \iow_newline:
+ <div>
+ \iow_newline:
+ <h2>\c_backslash_str mml\c_space_tl \int_use:N \g_@@_math_total_int </h2>
+ \iow_newline:
+ <p>\l_@@_tmpa_str</p>
+ \iow_newline:
+ <p>\l_@@_content_hash_tl </p>
+ \iow_newline:
+ <math></math>
+ \iow_newline:
+ </div>
+ \iow_newline:
+ }
+ }
+% \end{macrocode}
+% \end{plugdecl}
+% And now a key to activate the socket.
+% \begin{macrocode}
+
+\keys_define:nn { __tag / setup }
+ {
+ math/mathml/write-dummy .code:n =
+ {
+ \bool_gset_true:N \g__tag_math_mathml_AF_bool
+ \tl_if_exist:NF\g_@@_writedummy_iow
+ {
+ \iow_new:N \g_@@_writedummy_iow
+ \iow_open:Nn \g_@@_writedummy_iow
+ {
+ \c_sys_jobname_str-mathml-dummy.html
+ }
+ \iow_now:Ne \g_@@_writedummy_iow
+ {
+ <!DOCTYPE~html>
+ \iow_newline:
+ <html>
+ }
+ \AssignSocketPlug {tagsupport/math/mathml/write}{On}
+ \AddToHook{enddocument/afterlastpage}
+ {
+ \iow_now:Nn \g_@@_writedummy_iow {</html>}
+ \iow_close:N \g_@@_writedummy_iow
+ }
+ }
+ },
+ math/mathml/write-dummy .usage:n=preamble
+ }
+% \end{macrocode}
+%
+% \begin{macro}{\@@_AF_process_mathml_files:}
+% \begin{macrocode}
+\box_new:N\l_@@_tmpa_box
+\cs_new_protected:Npn \@@_AF_process_mathml_files:
+ {
+ \hbox_set:Nn \l_@@_tmpa_box
+ {
+ \pdfdict_put:nnn { l_pdffile/Filespec }{AFRelationship} { /Supplement }
+ \pdfdict_put:nne
+ { l_pdffile }{Subtype}
+ { \pdf_name_from_unicode_e:n{application/mathml+xml} }
+ \char_set_catcode_other:N \#
+ \cs_set_eq:NN\mml \@@_AF_html_reader:w
+ \clist_map_inline:Nn \l__tag_math_mathml_files_clist
+ {
+ \file_if_exist:nTF {##1.html}
+ {
+ \typeout{Info:~reading~mathml~file~##1}
+ \file_input:n {##1.html}
+ \bool_gset_true:N\g__tag_math_mathml_AF_bool
+ }
+ {
+ \typeout{Info:~mathml~file~##1~does~not~exist}%info message
+ }
+ }
+ }
+ \bool_if:NT\g__tag_math_mathml_AF_bool
+ {
+ \typeout{Info:~Activating~mathml~support}
+ \AssignSocketPlug{tagsupport/math/struct/begin}{test-mathml}
+ \AssignSocketPlug{tagsupport/math/struct/end}{test-mathml}
+% \end{macrocode}
+% mathml handling doesn't like subparts, so we disable them for now:
+% \begin{macrocode}
+ \AssignSocketPlug{tagsupport/math/substruct/begin}{single}
+ \AssignSocketPlug{tagsupport/math/substruct/end}{single}
+ \AddToHook{enddocument/info}
+ {
+ \iow_term:n{MathML~statistic}
+ \iow_term:n{================}
+ \iow_term:e{==>~\int_use:N\g_@@_mathml_total_int\c_space_tl
+ MathML~fragments~read}
+ \iow_term:e{==>~\int_use:N\g_@@_mathml_int\c_space_tl
+ different~MathML~fragments}
+ \iow_term:e{==>~\int_use:N\g_@@_math_total_int\c_space_tl
+ math~fragments~found}
+ \iow_term:e{==>~\int_use:N\g_@@_mathml_AF_found_int\c_space_tl
+ fitting~MathML~AF~found}
+ \iow_term:e{==>~\int_use:N\g_@@_mathml_AF_attached_int\c_space_tl
+ MathML~AF~attached}
+ }
+ }
+ }
+\AddToHook{begindocument}{\@@_AF_process_mathml_files:}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Mathstyle detection}
+% In some cases we need to detect the mathstyle used in a \cs{mathchoice}
+% command and to disable/enable tagging in the unused branches.
+% This is currently only used in the amstext command \cs{text}
+% but is perhaps also needed in other cases, so we create a general command.
+%
+%\begin{macro}{\l_@@_mathstyle_int,\g_@@_mathchoice_int,mathstyle}
+% \begin{macrocode}
+\int_new:N \l_@@_mathstyle_int
+\int_new:N \g_@@_mathchoice_int
+\property_new:nnnn{mathstyle}{now}{-1}{\int_use:N \l_@@_mathstyle_int }
+% \end{macrocode}
+%\end{macro}
+% For now internal, but perhaps will need a public version.
+% The command should be used in every branch of a \cs{mathchoice}
+% (with the correct mathstyle number) and with an unique label (which should
+% be the same in every branch).
+% \cs{g_@@_mathchoice_int} can be e.g. increased before the mathchoice and
+% then used.
+% \begin{macro}{\@@_tag_if_mathstyle:nn}
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_tag_if_mathstyle:nn #1 #2
+ %#1 refers to label
+ %#2 is a number for the mathstyle (typically 0,2,4,6)
+ {
+ \int_set:Nn \l_@@_mathstyle_int {#2}
+ \property_record:nn {#1} { mathstyle }
+ \int_compare:nNnTF { \property_ref:nn {#1}{ mathstyle} } = { #2 }
+ { \tag_start: }{ \tag_stop: }
+ }
+\cs_generate_variant:Nn \@@_tag_if_mathstyle:nn {en}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Tagging options}
+% \begin{macrocode}
+\keys_define:nn { __tag / setup }
+ {
+ math/mathml/sources .clist_set:N = \l__tag_math_mathml_files_clist,
+ math/alt/use .bool_set:N = \l__tag_math_alt_bool,
+ viewer/pane/mathml .bool_set:N = \l__tag_math_mathml_pane_bool,
+ viewer/pane/mathml .initial:n = true,
+ viewer/pane/mathsource .bool_set:N = \l__tag_math_texsource_pane_bool,
+ math/mathml/AF .bool_set:N = \l__tag_math_mathml_AF_bool,
+ math/mathml/AF .initial:n = true,
+ math/tex/AF .bool_set:N = \l__tag_math_texsource_AF_bool,
+ math/tex/AF .initial:n = true
+ }
+% \end{macrocode}
+%
+% \subsection{Sockets}
+% \subsubsection{Main inline math sockets}
+%
+% \begin{socketdecl}
+% {
+% tagsupport/math/inline/begin,
+% tagsupport/math/inline/end,
+% tagsupport/math/inline/formula/begin,
+% tagsupport/math/inline/formula/end,
+% }
+% The first two sockets are meant to embed inline
+% math into the surrounding (so to close/reopen e.g. MC-chunks).
+% The other two implement the actual formula structure.
+% The formula sockets are despite their naming not symmetric:
+% the begin socket is issued after the math has started, while
+% the end socket is after the math!
+% \begin{macrocode}
+\socket_new:nn {tagsupport/math/inline/begin}{0}
+\socket_new:nn {tagsupport/math/inline/end}{0}
+\socket_new:nn {tagsupport/math/inline/formula/begin}{1} %
+\socket_new:nn {tagsupport/math/inline/formula/end}{0}
+% \end{macrocode}
+%\end{socketdecl}
+%
+%
+% \begin{plugdecl}{MC}
+% \begin{macrocode}
+\socket_new_plug:nnn
+ {tagsupport/math/inline/begin}
+ {MC}
+ {\tag_mc_end_push:}
+\socket_new_plug:nnn
+ {tagsupport/math/inline/end}
+ {MC}
+ {\tag_mc_begin_pop:n{}}
+% \end{macrocode}
+% \end{plugdecl}
+%
+% We probably will want to test different tagging receipes.
+% \begin{plugdecl}{default}
+% \begin{macrocode}
+\socket_new_plug:nnn
+ {tagsupport/math/inline/formula/begin}
+ {default}
+ {
+ \socket_use:n{tagsupport/math/content}
+ \socket_use:n{tagsupport/math/struct/begin}
+% \end{macrocode}
+% TODO: does inline math need subformula handling?
+% \begin{macrocode}
+ % inner formula if multiple parts (not really implemented yet)
+ \socket_use:n{tagsupport/math/substruct/begin}
+ #1
+ \socket_use:n{tagsupport/math/end}
+ }
+\socket_new_plug:nnn
+ {tagsupport/math/inline/formula/end}
+ {default}
+ {
+ \socket_use:n{tagsupport/math/substruct/end}
+ \socket_use:n{tagsupport/math/struct/end}
+ }
+% \end{macrocode}
+% \end{plugdecl}
+%
+% \subsubsection{Main display math sockets}
+%
+% \begin{socketdecl}
+% {
+% tagsupport/math/display/begin,
+% tagsupport/math/display/end,
+% tagsupport/math/display/formula/begin,
+% tagsupport/math/display/formula/end,
+% }
+% The first two sockets are meant to embed display
+% math into the surrounding (so to close/reopen e.g. MC-chunks and
+% P-structure).
+% The other two implement the actual formula structure.
+% The formula sockets are despite their naming not symmetric:
+% the begin socket is issued after the math has started, while
+% the end socket is after the math!
+% \begin{macrocode}
+\socket_new:nn {tagsupport/math/display/begin}{0}
+\socket_new:nn {tagsupport/math/display/end}{0}
+\socket_new:nn {tagsupport/math/display/formula/begin}{1} %
+\socket_new:nn {tagsupport/math/display/formula/end}{0}
+% \end{macrocode}
+%\end{socketdecl}
+
+% \begin{plugdecl}{default}
+% \begin{macrocode}
+\socket_new_plug:nnn
+ {tagsupport/math/display/begin}
+ {default}
+ { \__tag_tool_close_P: }
+\socket_new_plug:nnn
+ {tagsupport/math/display/end}
+ {default}
+ {
+ }
+% \end{macrocode}
+% \end{plugdecl}
+
+
+% \begin{plugdecl}{default}
+% \begin{macrocode}
+\socket_new_plug:nnn
+ {tagsupport/math/display/formula/begin}
+ {default}
+ {
+ \socket_use:n{tagsupport/math/content}
+ \socket_use:n{tagsupport/math/struct/begin}
+ \socket_use:n{tagsupport/math/substruct/begin}
+ #1
+ \socket_use:n{tagsupport/math/end}
+ }
+\socket_new_plug:nnn
+ {tagsupport/math/display/formula/end}
+ {default}
+ {
+ \socket_use:n{tagsupport/math/substruct/end}
+ \socket_use:n{tagsupport/math/struct/end}
+ }
+% \end{macrocode}
+% \end{plugdecl}
+%
+% \subsubsection{Internal sockets}
+%
+% \begin{variable}{\l_@@_content_template_tl}
+% The default text used as alt or actual text.
+% \begin{macrocode}
+\tl_new:N\l_@@_content_template_tl
+\tl_set:Nn \l_@@_content_template_tl
+ {
+ LaTeX~ formula~ starts~
+ \exp_not:N\begin{\g_@@_grabbed_env_tl}
+ \c_space_tl
+ \exp_not:V\g_@@_grabbed_math_tl
+ \c_space_tl
+ \exp_not:N\end{\g_@@_grabbed_env_tl}
+ \c_space_tl LaTeX~ formula~ ends~
+ }
+% \end{macrocode}
+% \end{variable}
+
+% \begin{variable}{\l_@@_texsource_template_tl}
+% The default text used as texsource
+% \begin{macrocode}
+\tl_new:N\l_@@_texsource_template_tl
+\tl_const:Nn\c_@@_inline_env_tl {math}
+\tl_set:Nn \l_@@_texsource_template_tl
+ {
+ \tl_if_eq:NNTF\g_@@_grabbed_env_tl\c_@@_inline_env_tl
+ {
+ $
+ \exp_not:V\g_@@_grabbed_math_tl
+ $
+ }
+ {
+ \exp_not:N\begin{\g_@@_grabbed_env_tl}
+ \exp_not:V\g_@@_grabbed_math_tl
+ \exp_not:N\end{\g_@@_grabbed_env_tl}
+ }
+ }
+% \end{macrocode}
+% \end{variable}
+
+%
+% \begin{socketdecl}{tagsupport/math/content}
+% The math content is stored in associated files and used for
+% actual and alternative text. As the exact text is still
+% unclear we use a socket to be able to test variants.
+% The socket should set all four tl vars above, if needed
+% to identical values. It can use the two variables
+% \cs{g_@@_grabbed_env_tl} and \cs{g_@@_grabbed_math_tl}
+% \begin{macrocode}
+\socket_new:nn {tagsupport/math/content}{0}
+% \end{macrocode}
+% \end{socketdecl}
+%
+% Some default sockets to set the contents.
+% TODO: think about naming convention.
+% TODO: think how this should organized so that one
+% has options to change from the outside and so that
+% there are less repetitions.
+% \begin{plugdecl}{actual+source}
+% \begin{macrocode}
+\socket_new_plug:nnn
+ {tagsupport/math/content}
+ {actual+source}
+ {
+ \tl_set:Ne\l_@@_content_actual_tl
+ {
+ \l_@@_content_template_tl
+ }
+ \tl_set:Ne \l_@@_content_AF_source_tl
+ {
+ \l_@@_texsource_template_tl
+ }
+ \tl_set:Nn \l_@@_content_AF_mathml_tl {}
+ \tl_set:Nn \l_@@_content_alt_tl {}
+ }
+% \end{macrocode}
+% \end{plugdecl}
+%
+% \begin{plugdecl}{alt+source}
+% \begin{macrocode}
+\socket_new_plug:nnn
+ {tagsupport/math/content}
+ {alt+source}
+ {
+ \tl_set:Ne\l_@@_content_alt_tl
+ {
+ \l_@@_content_template_tl
+ }
+ \tl_set:Ne \l_@@_content_AF_source_tl
+ {
+ \l_@@_texsource_template_tl
+ }
+ \tl_set:Nn \l_@@_content_AF_mathml_tl {}
+ \tl_set:Nn \l_@@_content_actual_tl {}
+ }
+% \end{macrocode}
+% \end{plugdecl}
+% \begin{macrocode}
+\socket_assign_plug:nn {tagsupport/math/content}{alt+source}
+% \end{macrocode}
+%
+% \begin{socketdecl}{tagsupport/math/struct/begin,
+% tagsupport/math/struct/end}
+% For the main structure we use a socket too.
+% This allow e.g. to create a special one for luamml
+% which setups additional objects.
+% The begin socket can use the two variables
+% \cs{g_@@_grabbed_env_tl} and \cs{g_@@_grabbed_math_tl}
+% \begin{macrocode}
+\socket_new:nn {tagsupport/math/struct/begin}{0}
+\socket_new:nn {tagsupport/math/struct/end}{0}
+% \end{macrocode}
+% \end{socketdecl}
+%
+% \begin{plugdecl}{default}
+% TODO: think about some naming convention ...
+% \begin{macrocode}
+\socket_new_plug:nnn
+ {tagsupport/math/struct/begin}
+ {default}
+ {
+ \bool_if:NTF\l__tag_math_texsource_AF_bool
+ { \tl_set_eq:NN \l_@@_content_AF_source_tmpa_tl \l_@@_content_AF_source_tl }
+ { \tl_clear:N \l_@@_content_AF_source_tmpa_tl }
+ \tag_struct_begin:n
+ {
+ tag=Formula,
+ texsource = \l_@@_content_AF_source_tmpa_tl,
+ title-o = \g_@@_grabbed_env_tl,
+ actualtext = \l_@@_content_actual_tl,
+ alt = \l_@@_content_alt_tl
+ }
+ }
+\socket_new_plug:nnn
+ {tagsupport/math/struct/end}
+ {default}
+ { \tag_struct_end: }
+
+\socket_assign_plug:nn {tagsupport/math/struct/begin}{default}
+\socket_assign_plug:nn {tagsupport/math/struct/end}{default}
+% \end{macrocode}
+% \end{plugdecl}
+%
+% \begin{plugdecl}{test-mathml}
+% This (test-)socket tries to add a mathml-AF to formula.
+% It is activated if a mathml.html has been found and loaded.
+% Additionally it also sets an attribute
+% (this can perhaps be done by default anyway.)
+% As it disturbs the reading of the AF it currently deactivates the /Alt key,
+% unless it has been reenabled with |math/alt/use=true|
+% \begin{macrocode}
+\cs_generate_variant:Nn \str_mdfive_hash:n {o}
+\tl_new:N\l_@@_content_hash_tl
+% \end{macrocode}
+% we need to save the grabbed math:
+% \begin{macrocode}
+\tl_new:N\l_@@_grabbed_math_tl
+% \end{macrocode}
+% the socket definition
+% \begin{macrocode}
+\socket_new_plug:nnn
+ {tagsupport/math/struct/begin}
+ {test-mathml}
+ {
+ \int_gincr:N\g_@@_math_total_int
+ \tl_set:Ne\l_@@_content_hash_tl
+ {\str_mdfive_hash:o { \l_@@_content_AF_source_tl }}
+ \tl_set_eq:NN\l_@@_grabbed_math_tl\g_@@_grabbed_math_tl
+ \tl_if_eq:NnTF\g_@@_grabbed_env_tl {math}
+ {
+ \tl_set:Nn\l_@@_attribute_class_tl{inline}
+ }
+ {
+ \tl_set:Nn\l_@@_attribute_class_tl{display}
+ }
+ \bool_if:NF\l__tag_math_alt_bool
+ { \tl_set:Nn \l_@@_content_alt_tl{} }
+% \end{macrocode}
+% debugging option. TODO: hide in debug key.
+% \begin{macrocode}
+ \tl_if_exist:cTF { g_@@_mathml_ \l_@@_content_hash_tl _tl }
+ {
+ \int_gincr:N\g_@@_mathml_AF_found_int
+ \bool_if:NTF \l__tag_math_mathml_AF_bool
+ {
+ \int_gincr:N\g_@@_mathml_AF_attached_int
+ \typeout {Inserting~mathml~with~Hash~\l_@@_content_hash_tl}
+ }
+ {
+ \typeout {Ignoring~mathml~with~Hash~\l_@@_content_hash_tl}
+ }
+ }
+ {
+ \typeout{WARNING:~mathml~missing~for~hash~\l_@@_content_hash_tl}
+ }
+ \socket_use:n {tagsupport/math/mathml/write} % write hash if request
+ \bool_if:NTF\l__tag_math_texsource_AF_bool
+ { \tl_set_eq:NN \l_@@_content_AF_source_tmpa_tl \l_@@_content_AF_source_tl }
+ { \tl_clear:N \l_@@_content_AF_source_tmpa_tl }
+ \tag_struct_begin:n
+ {
+ tag=Formula,
+ attribute-class=\l_@@_attribute_class_tl, %
+ AFref =
+ \bool_if:NT\l__tag_math_mathml_AF_bool
+ {
+ \cs_if_exist_use:c {g_@@_mathml_ \l_@@_content_hash_tl _tl}
+ },
+ texsource = \l_@@_content_AF_source_tmpa_tl, % should be after mathml AF!
+ title-o = \g_@@_grabbed_env_tl, %
+ alt = \l_@@_content_alt_tl
+ }
+ }
+% \end{macrocode}
+% not really needed but looks more symmetric:
+% \begin{macrocode}
+\socket_new_plug:nnn
+ {tagsupport/math/struct/end}
+ {test-mathml}
+ {
+ \tag_struct_end:
+ }
+% \end{macrocode}
+% \end{plugdecl}
+%
+% \begin{socketdecl}{tagsupport/math/substruct/begin,
+% tagsupport/math/substruct/end}
+% This holds the code to handle subparts of the formula.
+% \begin{macrocode}
+\socket_new:nn {tagsupport/math/substruct/begin}{0}
+\socket_new:nn {tagsupport/math/substruct/end}{0}
+% \end{macrocode}
+% \end{socketdecl}
+%
+% \begin{plugdecl}{default}
+% \begin{macrocode}
+\socket_new_plug:nnn
+ {tagsupport/math/substruct/begin}
+ {default}
+ { \grabaformulapartandstart }
+\socket_new_plug:nnn
+ {tagsupport/math/substruct/end}
+ {default}
+ {
+ \tagmcend
+ \if@subformulas
+ \tagstructend
+ \fi
+ }
+\socket_assign_plug:nn {tagsupport/math/substruct/begin}{default}
+\socket_assign_plug:nn {tagsupport/math/substruct/end}{default}
+% \end{macrocode}
+% \end{plugdecl}
+
+% \begin{plugdecl}{single}
+% We need an option to disable subparts as it is unclear
+% if consumers can handle them:
+% \begin{macrocode}
+\socket_new_plug:nnn
+ {tagsupport/math/substruct/begin}
+ {single}
+ {
+ \typeout{====>subpart~splitting~deactivated}
+ \typeout{====>grabbed~math=\meaning\g_@@_grabbed_math_tl}
+ \tag_mc_begin:n{}
+ }
+\socket_new_plug:nnn
+ {tagsupport/math/substruct/end}
+ {single}
+ { \tag_mc_end:}
+% \end{macrocode}
+% \end{plugdecl}
+%
+% \begin{socketdecl}{tagsupport/math/end}
+% A socket used at the end of the math (before the closing dollar(s))
+% which can e.g. set a flag for luamml.
+% \begin{macrocode}
+\socket_new:nn {tagsupport/math/end}{0}
+% \end{macrocode}
+% \end{socketdecl}
+
+%
+% \begin{macro}{\__tag_math_disable:}
+% Similar to the table code we collect the plugs that should be
+% assigned to do nothing if we don't want tagging
+% \begin{macrocode}
+\cs_new_protected:Npn \__tag_math_disable:
+ {
+ \socket_assign_plug:nn {tagsupport/math/inline/begin}{noop}
+ \socket_assign_plug:nn {tagsupport/math/inline/end}{noop}
+ \socket_assign_plug:nn {tagsupport/math/inline/formula/begin}{identity}
+ \socket_assign_plug:nn {tagsupport/math/inline/formula/end}{noop}
+ \socket_assign_plug:nn {tagsupport/math/display/begin}{noop}
+ \socket_assign_plug:nn {tagsupport/math/display/end}{noop}
+ \socket_assign_plug:nn {tagsupport/math/display/formula/begin}{identity}
+ \socket_assign_plug:nn {tagsupport/math/display/formula/end}{noop}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\__tag_math_enable:}
+% Similar to the table code we collect the default plugs that should be
+% assigned if we want tagging
+% \begin{macrocode}
+\cs_new_protected:Npn \__tag_math_enable:
+ {
+ \socket_assign_plug:nn {tagsupport/math/inline/begin}{MC}
+ \socket_assign_plug:nn {tagsupport/math/inline/end}{MC}
+ \socket_assign_plug:nn {tagsupport/math/inline/formula/begin}{default}
+ \socket_assign_plug:nn {tagsupport/math/inline/formula/end}{default}
+ \socket_assign_plug:nn {tagsupport/math/display/begin}{default}
+ \socket_assign_plug:nn {tagsupport/math/display/end}{default}
+ \socket_assign_plug:nn {tagsupport/math/display/formula/begin}{default}
+ \socket_assign_plug:nn {tagsupport/math/display/formula/end}{default}
+ }
+% \end{macrocode}
+% \end{macro}
+% At begin document we can activate:
+% \begin{macrocode}
+\AtBeginDocument{\tag_if_active:T{\__tag_math_enable: }}
+% \end{macrocode}
%
% \subsection{Interface commands}
%
@@ -260,7 +1322,8 @@
{
\legacy_if:nF { measuring@ }
{
- \tl_if_in:nnF {#2} { \m@th }
+ \tl_if_in:nnTF {#2} { \m@th }
+ { \bool_set_true:N\l_@@_fakemath_bool }
{ \tl_trim_spaces_apply:nN {#2} \@@_process_auxi:nn {#1} }
}
}
@@ -287,15 +1350,15 @@
%
% \begin{macro}{\@@_grab_dollar:w}
% Grab up to a single |$|, for inline math mode, suppressing
-% any processing if the first token is \tn{m@th}.
+% any processing if the token is \tn{m@th} found in the content.
+%
+% \fmi{what's that test doing?}
%
-% \fmi{what's that test doing?}
+% \car{It is some kind of fix, to avoid the remote
+% possibility that the math is empty, making the code
+% produce an unwanted \texttt{\$\$}.}
%
-% \car{It is some kind of fix, to avoid the remote
-% possibility that the math is empty, making the code
-% produce an unwanted \texttt{\$\$}.}
-%
-%\car{cf.~the code for this in \cs{@ensuredmath}}
+%\car{cf.~the code for this in \cs{@ensuredmath}}
%
%\car{It is harmless but unnecessary in the dollardollar grabbing below.}
%
@@ -309,91 +1372,61 @@
\tl_if_blank:nF {#1}
{
\@@_process:nn { math } {#1} % $
-% fairly simple this one
% \end{macrocode}
-% We do not want math tagging in fakemath or when measuring,
-% so we imitate the test inside \cs{@@_process:nn} for now,
-% see https://github.com/latex3/tagging-project/issues/5
-% TODO: use socket to get more control about typesetting variants (tagged, drop etc)?
+% We do not want math tagging in fakemath or when measuring,
% \begin{macrocode}
- \legacy_if:nTF { measuring@ }
- { #1 $ }
- {
- \tl_if_in:nnTF {#1} { \m@th }
- { #1 $ }
- {
- \tagmcend %end P-chunk, in code: \tag_mc_end_push:
- \@kernel@math@begin
- #1 $
- \@kernel@math@end
- \tagmcbegin{} % restart P-chunk (whatsits in pdftex)
- }
- }
+ \bool_lazy_or:nnTF
+ {\legacy_if_p:n { measuring@ }}
+ { \l_@@_fakemath_bool }
+ { #1 $ }
+ {
+ \socket_use:n {tagsupport/math/inline/begin} %end P-MC
+ \socket_use:nn{tagsupport/math/inline/formula/begin}{#1}
+ $
+ \socket_use:n {tagsupport/math/inline/formula/end}
+ \socket_use:n {tagsupport/math/inline/end} % restart P-MC
+ }
}
}
% \end{macrocode}
% \end{macro}
+%
% \begin{macro}{\@@_grab_dollardollar:w}
% And for the classical \TeX{} display structure.
% \begin{macrocode}
-
-\skip_new:N \l_@@_tmpa_skip
-
\cs_new_protected:Npn \@@_grab_dollardollar:w % $$
#1 $$
{
\tl_if_blank:nF {#1}
{
- \@@_tag_dollardollar_display:nn { equation* }{#1}
- #1
+ \@@_process:nn { equation* } {#1}
+ \socket_use:n {tagsupport/math/display/begin}
+ \socket_use:nn{tagsupport/math/display/formula/begin}{#1}
$$
}
}
% \end{macrocode}
-% To allow to use the code without tagging we guard. But probably tagpdf should
-% provide some tools for such manual para-ends.
+%
+% The end code is added through a \cs{aftergroup} so we
+% store it inside a command.
% \begin{macrocode}
-\cs_new_protected:Npn \@kernel@close@P {
- \tag_if_active:T
- {
- \tagmcend %end P-chunk, should perhaps be \tag_mc_end_push: ...
- \int_gincr:N \g__tag_para_end_int
- \bool_if:NT \l__tag_para_show_bool
- { \tag_mc_begin:n{artifact}
- \rlap{\color_select:n{red}\tiny\ \int_use:N\g__tag_para_end_int}
- \tag_mc_end:
- }
- \tag_struct_end:
- }
-}
-
-
-
-\cs_new_protected:Npn \@@_tag_dollardollar_display:nn #1#2 {
- \@@_process:nn {#1} {#2}
- \@kernel@close@P
- \@kernel@math@begin
-% \skip_set:Nn \belowdisplayskip {-\belowdisplayskip}
-% \skip_set:Nn \belowdisplayshortskip {-\belowdisplayshortskip}
-% \int_set:Nn \postdisplaypenalty {10000}
-%%
-% \group_insert_after:N \@@_tag_dollardollar_display_end:
-}
-
-\cs_new_protected:Npn \@@_tag_dollardollar_display_end: {
-% \typeout{== tag dollarldollar display end}
-% \ShowTagging{struct-stack}
- \tagpdfparaOff
- \para_raw_end:
- \tagpdfparaOn
- \l_@@_tmpa_skip \lastskip
- \@kernel@math@end
- \penalty \postdisplaypenalty
+\cs_new_protected:Npn \@@_tag_dollardollar_display_end:
+ {
+ % \typeout{== tag dollarldollar display end}
+ % \ShowTagging{struct-stack}
+ \para_raw_end:
+% \end{macrocode}
+% TODO why is that needed? where is para-tagging disabled?
+% \begin{macrocode}
+ \tagpdfparaOn
+ \l_@@_tmpa_skip \lastskip
+ \socket_use:n{tagsupport/math/display/formula/end}
+ \penalty \postdisplaypenalty
% \end{macrocode}
% This reinserts the below display skips. It must be doubled to
% get the right amount:
% \begin{macrocode}
- \skip_vertical:n { -\l_@@_tmpa_skip * 2 }
+ \skip_vertical:n { -\l_@@_tmpa_skip * 2 }
%
\@doendpe % this has no \end{...} to take care of it
}
@@ -410,13 +1443,13 @@
{
\tl_if_blank:nF {#1}
{
- \@@_process:nn { math } {#1}
$ #1 $
}
\bool_set_false:N \l_@@_collected_bool
}
% \end{macrocode}
% \end{macro}
+%
% \begin{macro}{\@@_grab_eqn:w}
% For the most common use of \cs{[}/\cs{]}: turn into an environment.
% \begin{macrocode}
@@ -463,7 +1496,7 @@
% \begin{macro}{\math_register_env:n}
% \begin{macro}{\RegisterMathEnvironment}
% Set up to capture environment content and make available.
-%
+%
% \begin{macrocode}
\cs_new_protected:Npn \math_register_env:nn #1#2
{
@@ -472,15 +1505,8 @@
\cs_gset_eq:cc { @@_env_ #1 _begin: } {#1}
\cs_gset_eq:cc { @@_env_ #1 _end: } { end #1 }
%
- \ExpandArgs { nnx } \RenewDocumentEnvironment {#1} { b }
+ \ExpandArgs { nne } \RenewDocumentEnvironment {#1} { b }
{
-% \bool_set_true:N \exp_not:N \l_@@_collected_bool
-% \cs_if_exist:cTF { @@_env #1 _aux: }
-% {
-% \exp_not:c { @@_env #1 _aux: }
-% ####1 \exp_not:N \@@_env_end: {#1}
-% }
-% { \exp_not:N \@@_process:nn {#1} {####1} }
\exp_not:N \bool_if:NTF \exp_not:N \l_@@_collected_bool
{
% \typeout{===>B1}
@@ -490,34 +1516,22 @@
\cs_if_exist:cTF { @@_env #1 _aux: }
{
\exp_not:c { @@_env #1 _aux: }
- ####1 \exp_not:N \@@_env_end: {#1}
+ ##1 \exp_not:N \@@_env_end: {#1}
}
- { \exp_not:N \@@_process:nn {#1} {####1} }
+ { \exp_not:N \@@_process:nn {#1} {##1} }
\exp_not:n { \@kernel@math@registered@begin }
\bool_set_true:N \exp_not:N \l_@@_collected_bool
}
-% \exp_not:N \tracingall
+% \exp_not:N \tracingall
\exp_not:c { @@_env_ #1 _begin: }
- ####1
+ ##1
\exp_not:c { @@_env_ #1 _end: }
-% \exp_not:c { @@_env_ #1 _end: }
% \exp_not:N \tracingnone
-% \exp_not:n { \@kernel@math@registered@end }
}
- {
- }
+ {
+ }
}
-\cs_set_protected:Npn \__cs_tmp:w #1
- {
- \group_begin:
- \exp_args:No \__cs_generate_internal_variant:n
- { \tl_to_str:n {#1} }
- \group_end:
- }
-\__cs_tmp:w { nnxx }
-
-
\cs_new_protected:Npn \math_register_halign_env:nn #1#2
{
\tl_set:Nn \l_@@_env_name_tl {#1}
@@ -525,15 +1539,8 @@
\cs_gset_eq:cc { @@_env_ #1 _begin: } {#1}
\cs_gset_eq:cc { @@_env_ #1 _end: } { end #1 }
%
- \ExpandArgs { nnxx } \RenewDocumentEnvironment {#1} { b }
+ \ExpandArgs { nnee } \RenewDocumentEnvironment {#1} { b }
{
-% \bool_set_true:N \exp_not:N \l_@@_collected_bool
-% \cs_if_exist:cTF { @@_env #1 _aux: }
-% {
-% \exp_not:c { @@_env #1 _aux: }
-% ####1 \exp_not:N \@@_env_end: {#1}
-% }
-% { \exp_not:N \@@_process:nn {#1} {####1} }
\exp_not:N \bool_if:NTF \exp_not:N \l_@@_collected_bool
{
% \typeout{===>B1}
@@ -543,23 +1550,24 @@
\cs_if_exist:cTF { @@_env #1 _aux: }
{
\exp_not:c { @@_env #1 _aux: }
- ####1 \exp_not:N \@@_env_end: {#1}
+ ##1 \exp_not:N \@@_env_end: {#1}
}
- { \exp_not:N \@@_process:nn {#1} {####1} }
+ { \exp_not:N \@@_process:nn {#1} {##1} }
\exp_not:n { \@kernel@math@registered@begin }
\bool_set_true:N \exp_not:N \l_@@_collected_bool
}
-% \exp_not:N \tracingall
+% \exp_not:N \tracingall
\exp_not:c { @@_env_ #1 _begin: }
- ####1
-% \exp_not:c { @@_env_ #1 _end: }
+ ##1
% \exp_not:N \tracingnone
}
- {
- \exp_not:c { @@_env_ #1 _end: }
- }
+ {
+ \exp_not:c { @@_env_ #1 _end: }
+ }
}
-
+% \end{macrocode}
+% TODO: the following command is neither documented nor used. Is is needed?
+% \begin{macrocode}
\cs_new_protected:Npn \math_register_odd_env:nn #1#2
{
\tl_set:Nn \l_@@_env_name_tl {#1}
@@ -567,7 +1575,7 @@
\cs_gset_eq:cc { @@_env_ #1 _begin: } {#1}
\cs_gset_eq:cc { @@_env_ #1 _end: } { end #1 }
%
- \ExpandArgs { nnxx } \RenewDocumentEnvironment {#1} { b }
+ \ExpandArgs { nnee } \RenewDocumentEnvironment {#1} { b }
{
\exp_not:N \bool_if:NTF \exp_not:N \l_@@_collected_bool
{
@@ -578,19 +1586,19 @@
\cs_if_exist:cTF { @@_env #1 _aux: }
{
\exp_not:c { @@_env #1 _aux: }
- ####1 \exp_not:N \@@_env_end: {#1}
+ ##1 \exp_not:N \@@_env_end: {#1}
}
- { \exp_not:N \@@_process:nn {#1} {####1} }
+ { \exp_not:N \@@_process:nn {#1} {##1} }
\exp_not:n { \@kernel@math@registered@begin }
\bool_set_true:N \exp_not:N \l_@@_collected_bool
}
-% \exp_not:N \tracingall
+% \exp_not:N \tracingall
\exp_not:c { @@_env_ #1 _begin: }
- ####1
+ ##1
}
{
\exp_not:c { @@_env_ #1 _end: }
-% needed if we don't have $$...$$
+% needed if we don't have $$...$$
% \exp_not:n { \typeout{---> @kernel@math@registered@end }}
\exp_not:n { \@kernel@math@registered@end }
}
@@ -614,7 +1622,7 @@
\cs_new:Npn \@kernel@math@registered@begin {
-% \ShowTagging{struct-stack}
+% \ShowTagging{struct-stack}
%\typeout{==>A1}\ShowTagging{struct-stack,mc-current}
\mode_if_vertical:TF
{
@@ -623,19 +1631,21 @@
% { \__block_list_beginpar_vmode: }
%
% \typeout{==>~ at:~ \g__tag_struct_tag_tl}
-%
- \exp_args:Noo\str_if_eq:nnF \g__tag_struct_tag_tl { \l__tag_para_main_tag_tl } % needs correction!
+%
+ \tag_if_active:T
+ {
+ \exp_args:Noo\str_if_eq:nnF \g__tag_struct_tag_tl { \l__tag_para_main_tag_tl } % needs correction!
{
% \typeout{==>A2}
\__block_beginpar_vmode:
} % needs correction!
+ }
}
{
% \typeout{==>A3}
- \@kernel@close@P
-% \tagmcend % needs correction!
+ \__tag_tool_close_P:
}
- \@kernel@math@begin
+ \socket_use:nn{tagsupport/math/display/formula/begin}{}
\tagpdfparaOff
% \typeout{==>MC1}\ShowTagging{mc-current}
}
@@ -644,13 +1654,14 @@
% \typeout{==>MC2}\ShowTagging{mc-current}
\para_raw_end:
\tagpdfparaOn
- \@kernel@math@end
+ \socket_use:n{tagsupport/math/display/formula/end}
% \typeout{==>MC3}\ShowTagging{mc-current}
\@endpetrue
}
-
+
\cs_new_protected:Npn \math_register_env:n #1
{ \math_register_env:nn {#1} { } }
+
\NewDocumentCommand \RegisterMathEnvironment { O{} m }
{ \math_register_env:nn {#2} {#1} }
% \end{macrocode}
@@ -660,12 +1671,12 @@
%
% \begin{macro}{\@@_env_forward:w}
% \begin{macrocode}
-\cs_new_protected:Npn \@@_env_forward:w #1 \@@_env_end: #2
+\cs_new_protected:Npn \@@_env_forward:w #1 \@@_env_end: #2
{ \@@_process:nn {#2} {#1} }
% \end{macrocode}
% \end{macro}
-%
-% \subsection{Document commands}
+%
+% \subsection{Document commands}
%
% \car*{Add one more here: \texttt{displaymath}, which
% is equivalent to \cs{[} , \cs{]}\\
@@ -692,9 +1703,9 @@
% at the moment register_env can only do display math
% \math_register_env:n { math }
\RenewDocumentEnvironment{math} {b}{$#1$}{}
-% and this one doesn't work either
+% and this one doesn't work either
% \math_register_env:n { displaymath }
- \RenewDocumentEnvironment{displaymath} {b}{\[#1\]}{}
+ \RenewDocumentEnvironment{displaymath} {b}{\[#1\]}{}
}
% \end{macrocode}
% \end{macro}
@@ -737,29 +1748,31 @@
{
\cs_gset_protected:Npn \[ % \]
{
- \bool_if:NTF \l_@@_collected_bool
- { \begin { equation* } }
- { \@@_grab_eqn:w }
+ \@@_grab_eqn:w
+ % \bool_if:NTF \l_@@_collected_bool
+% { \begin { equation* } }
+% { \@@_grab_eqn:w }
} % \[
\cs_gset_protected:Npn \]
{
- \bool_if:NTF \l_@@_collected_bool
- { \end{ equation* } }
- { \@badmath }
+ \@badmath
+% \bool_if:NTF \l_@@_collected_bool
+% { \end{ equation* } }
+% { \@badmath }
}
}
% \end{macrocode}
% \end{macro}
-%
+%
%
% \begin{macro}{\ensuremath}
% A bit of nesting fun to make sure we collect only if required.
% \fmi{why does ensuremath need handling at all?}
-%
-% \car{Indeed! Currently, this is setup to process the math that
-% it has anyways already captured as its argument; thus it is more
+%
+% \car{Indeed! Currently, this is setup to process the math that
+% it has anyways already captured as its argument; thus it is more
% efficient than leaving the capture to be repeated by the \cs{everymath}}
-%
+%
% \begin{macrocode}
%\cs_gset_protected:Npn \ensuremath #1
% {
@@ -786,47 +1799,6 @@
% have macro control.
% \begin{macrocode}
-\tl_new:N\tmpmathcontent
-
-
-\def\@kernel@math@begin {
-% \typeout{==>~math~begin}
-% needs different handling if we support nesting
- \tl_gset:Nx\tmpmathcontent
- {
- LaTeX~ formula~ starts~
- \exp_not:N\begin{\g_@@_grabbed_env_tl}
- \space
- \exp_not:V\g_@@_grabbed_math_tl
- \space
- \exp_not:N\end{\g_@@_grabbed_env_tl}
- \space LaTeX~ formula~ ends~
- }
- \tagstructbegin{tag=Formula,
- AFinline-o=\tmpmathcontent,
- title-o=\g_@@_grabbed_env_tl,
- actualtext=\tmpmathcontent
-% alt=\tmpmathcontent
- }
-% inner formula if multiple parts (not really implemented yet)
- \grabaformulapartandstart
-% the above does:
-% \tagstructbegin{tag=Formula}\tagmcbegin{}
-% or just
-% \tagmcbegin{}
-}
-\def\@kernel@math@end {
-% \typeout{==>~math~end}
-% \ShowTagging{struct-stack}
- \tagmcend
- \if@subformulas
- \tagstructend
- \else
- \fi
- \tagstructend
-% \ShowTagging{struct-stack}
-}
-
\exp_args:No \tex_everymath:D
{
\tex_the:D \tex_everymath:D
@@ -841,24 +1813,21 @@
{
\tex_the:D \tex_everydisplay:D
\iftrue % this may have to be a settable flag!
-% {
% \typeout{==>~ in~ everydisplay}
% \end{macrocode}
-% flipping the \cs{belowdisplay} values is done so that we get (assumption)
-% a negative skip and not make the page bigger then we take that out,
-% then we add the tagging code (in \cs{@@_tag_dollardollar_display_end} ) and
-% then we put a real \cs{postdisplaypenalty} in and
-% the right skip (of which we don't know if it is short or a
-% normal \cs{belowdisplayskip}). This might need some refinement if that skip
-% is actually negative from the start
+% flipping the \cs{belowdisplay} values is done so that we get (assumption)
+% a negative skip and not make the page bigger then we take that out,
+% then we add the tagging code (in \cs{@@_tag_dollardollar_display_end} ) and
+% then we put a real \cs{postdisplaypenalty} in and
+% the right skip (of which we don't know if it is short or a
+% normal \cs{belowdisplayskip}). This might need some refinement if that skip
+% is actually negative from the start
% (not sure it ever is and is worth bothering about)
% \begin{macrocode}
\skip_set:Nn \belowdisplayskip {-\belowdisplayskip}
\skip_set:Nn \belowdisplayshortskip {-\belowdisplayshortskip}
\int_set:Nn \postdisplaypenalty {10000}
-%
\group_insert_after:N \@@_tag_dollardollar_display_end:
-% }
\fi
\bool_if:NF \l_@@_collected_bool
{
@@ -876,14 +1845,23 @@
\math_register_env:n { eqnarray* }
% \end{macrocode}
%
-% Places where math mode is (ab)used.
+% Tabulars currently contain a \$ that shouldn't trigger math
+% tagging.
% \begin{macrocode}
-\clist_map_inline:nn
- { tabular }
- {
- \AddToHook{ env / #1 / begin }
- { \bool_set_true:N \l_@@_collected_bool }
- }
+\RequirePackage{array}
+\tl_if_in:NnT\@tabular{$}
+ {
+ \def\@tabular{%
+ \leavevmode
+ \UseTaggingSocket{tbl/hmode/begin}%
+ \hbox \bgroup
+ \bool_set_true:N \l_@@_collected_bool
+ $
+ \bool_set_false:N \l_@@_collected_bool
+ \col@sep\tabcolsep \let\d@llarbegin\begingroup
+ \let\d@llarend\endgroup
+ \@tabarray}
+ }
% \end{macrocode}
%
% \begin{macro}{\@@_m@th:, \m@th}
@@ -898,6 +1876,20 @@
}
% \end{macrocode}
% \end{macro}
+%
+% \subsection{Disable math grabbing in the begindocument hook}
+% For example amsart uses math to measure text there.
+%
+% \begin{macrocode}
+\tl_gput_right:Nn\@kernel@before@begindocument
+ {
+ \bool_set_true:N\l_@@_collected_bool
+ }
+\tl_gput_right:Nn\@kernel@after@begindocument
+ {
+ \bool_set_false:N\l_@@_collected_bool
+ }
+% \end{macrocode}
%
% \subsection{Modifying \pkg{amsmath}}
%
@@ -934,7 +1926,7 @@
$$\ignorespacesafterend
}
% \end{macrocode}
-%
+%
% \begin{macrocode}
\def\common@align@ending {
\math@cr \black@\totwidth@
@@ -1007,9 +1999,11 @@
% \end{macrocode}
%
% \begin{macrocode}
-%
+%
\math_register_halign_env:nn {align}{}
\math_register_halign_env:nn {align*}{}
+ \math_register_halign_env:nn {alignat}{}
+ \math_register_halign_env:nn {alignat*}{}
\math_register_halign_env:nn {flalign}{}
\math_register_halign_env:nn {flalign*}{}
\math_register_halign_env:nn {gather}{}
@@ -1032,44 +2026,8 @@
\fi
}
% \end{macrocode}
-%
-% \begin{macrocode}
- \def\intertext@{%
- \def\intertext##1{%
- \ifvmode\else\\\@empty\fi
- \noalign{%
-% we have to flip the sign on the skip because we flipped it on the outside
- \penalty\postdisplaypenalty\vskip-\belowdisplayskip
- \vbox{
-% \end{macrocode}
-% Stop tagging when measuring:
-% \begin{macrocode}
- \ifmeasuring@\tag_stop:\fi
- \normalbaselines
- \ifdim\linewidth=\columnwidth
- \else \parshape\@ne \@totalleftmargin \linewidth
- \fi
-% \end{macrocode}
-% End the previous mc:\fmi{if we use 2 levels of formulas this would
-% need changing}
-% \begin{macrocode}
- \tag_mc_end_push:
-% \end{macrocode}
-% We are already in a par so we change now to Span:\fmi{not true any longer}
-% \begin{macrocode}
- \tagpdfsetup{paratag=P}%
- \tagpdfparaOn
- \noindent\ignorespaces##1\par
-% \end{macrocode}
-% Restart the MC
-% \begin{macrocode}
- \tag_mc_begin_pop:n{}}%
- \penalty\predisplaypenalty\vskip\abovedisplayskip%
- }%
- }
- }
-% \end{macrocode}
-%
+%
+%
% \begin{macrocode}
\@namedef{math@cr @ @ @ gather}{%
\ifst@rred\nonumber\fi
@@ -1083,7 +2041,7 @@
\cr
}
% \end{macrocode}
-%
+%
% \begin{macrocode}
\@namedef{math@cr @ @ @ align}{%
\ifst@rred\nonumber\fi
@@ -1104,7 +2062,7 @@
\cr
}
% \end{macrocode}
-%
+%
% \begin{macrocode}
\def\restore@math@cr{\@namedef{math@cr @ @ @}{
%
@@ -1113,7 +2071,7 @@
\cr}}
\restore@math@cr
% \end{macrocode}
-%
+%
% \begin{macrocode}
}
% \end{macrocode}
@@ -1125,9 +2083,18 @@
%
%
-% \begin{macro}{}
+% \begin{macro}{\@@_split_at_nl:NN}
+% This splits grabbed math at newlines.
%
% \begin{macrocode}
+\cs_new:Npn \@@_split_at_nl:NN #1#2 {
+ \tl_set:Nf \l_@@_tmpa_tl {
+ \exp_after:wN \@@_split_at_nl_first:w #1 \\ \q_nil \\ \s_stop }
+ \exp_after:wN \@@_split_at_nl_aux:nnNN \l_@@_tmpa_tl #1 #2
+}
+% \end{macrocode}
+% and the auxiliary commands
+% \begin{macrocode}
\cs_new:Npn \@@_split_at_nl_first:w #1 \\ #2 \\ #3 \s_stop
{
\quark_if_nil:nTF {#2}
@@ -1137,8 +2104,15 @@
#2 \\ #3 \s_stop
}
}
-\cs_new:Npn \@@_split_chk_if_begin:ww #1 \begin #2 #3 \s_mark
- #4 \\ \q_nil \\ \s_stop
+
+\cs_new_protected:Npn \@@_split_at_nl_aux:nnNN #1 #2 #3 #4
+ {
+ \tl_gset:Nn #4 {#1}
+ \tl_gset:Nn #3 {#2}
+ }
+
+\cs_new:Npn \@@_split_chk_if_begin:ww
+ #1 \begin #2 #3 \s_mark #4 \\ \q_nil \\ \s_stop
{
\quark_if_nil:nTF {#2}
{ {#1} {#4} }
@@ -1148,7 +2122,9 @@
{ } { 1 }
}
}
+
\cs_new:Npn \@@_split_cleanup_begin_q_nil:w #1 \begin \q_nil {#1}
+
\cs_new:Npn \@@_split_collect_one_end:w #1 \end #2 #3 \s_stop #4 #5
{
\exp_args:Nf \@@_split_check_count_begins:nnnn
@@ -1157,14 +2133,16 @@
}
\cs_new:Npn \@@_split_count_begins:n #1
{ \int_eval:n { 0 \@@_split_count_begins:w #1 \begin \q_nil } }
+
\cs_new:Npn \@@_split_count_begins:w #1 \begin #2
{ \quark_if_nil:nF {#2} { +1 \@@_split_count_begins:w } }
+
\cs_new:Npn \@@_split_check_count_begins:nnnn #1 #2 #3 #4
{
\int_compare:nNnTF {#1} = {#2}
{
\exp_last_unbraced:Nf \@@_split_final_cleanup:nn
- { \split:n { \@@_split_guard:n {#3} #4 } }
+ { \@@_split:n { \@@_split_guard:n {#3} #4 } }
}
{
\exp_args:No \use_ii_i:nn
@@ -1184,29 +2162,17 @@
{ \exp_end: { #4 #1 } }
{ \@@_split_final_cleanup:w #3 \s_mark { #4 #1 #2 } }
}
-\NewDocumentCommand \splitnl { mm +m }
- {
- \tl_set:Nf \l_tmpa_tl { \split:n {#3} }
- \show \l_tmpa_tl
- \exp_after:wN \__splitnl_aux:nnNN \l_tmpa_tl #1 #2
- }
-
-
-\cs_new:Npn \split:n #1 {
+
+\cs_new:Npn \@@_split:n #1 {
\@@_split_at_nl_first:w #1 \\ \q_nil \\ \s_stop }
-
-\cs_new:Npn \@@_split_at_nl:NN #1#2 {
- \tl_set:Nf \l_tmpa_tl {
- \exp_after:wN \@@_split_at_nl_first:w #1 \\ \q_nil \\ \s_stop }
- \exp_after:wN \@@_split_at_nl_aux:nnNN \l_tmpa_tl #1 #2
-}
-
-\cs_new_protected:Npn \@@_split_at_nl_aux:nnNN #1 #2 #3 #4
- {
- \tl_gset:Nn #4 {#1}
- \tl_gset:Nn #3 {#2}
-}
-
+
+% this looks unused.
+%\NewDocumentCommand \splitnl { mm +m }
+% {
+% \tl_set:Nf \l_@@_tmpa_tl { \split:n {#3} }
+% \show \l_@@_tmpa_tl
+% \exp_after:wN \__splitnl_aux:nnNN \l_@@_tmpa_tl #1 #2
+% }
% \end{macrocode}
% \end{macro}
%
@@ -1233,9 +2199,11 @@
\edef\resulttitle{\g_@@_grabbed_env_tl\space (part)}
\tagstructbegin{tag=Formula,
% \end{macrocode}
-% For now we don't put anything in /alt or /ActualText on subformulas
+% For now we don't put real content in /alt or /ActualText on subformulas
+% but we add a short text to satisfy the pdf/ua-2 validator
% \begin{macrocode}
% alt=\result,
+ alt = subformula,
title-o=\resulttitle
}
}
@@ -1301,10 +2269,6 @@
% \end{macrocode}
%
% \begin{macrocode}
-%
-% \end{macrocode}
-%
-% \begin{macrocode}
%</kernel>
% \end{macrocode}
%
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-math.pdf b/macros/latex-dev/required/latex-lab/latex-lab-math.pdf
index deab5ad914..4907833be8 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-math.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-math.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-mathpkg.dtx b/macros/latex-dev/required/latex-lab/latex-lab-mathpkg.dtx
index 14d8e94362..a8e8e810ad 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-mathpkg.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-mathpkg.dtx
@@ -2,7 +2,7 @@
%
%% File: latex-lab-mathpkg.dtx
%
-% Copyright (C) 2022,2023 The LaTeX Project
+% Copyright (C) 2022-2024 The LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-mathpkg.pdf b/macros/latex-dev/required/latex-lab/latex-lab-mathpkg.pdf
index dbfcb0815b..1a2b8be781 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-mathpkg.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-mathpkg.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-mathtools.dtx b/macros/latex-dev/required/latex-lab/latex-lab-mathtools.dtx
index c3f43243b1..1a0b8e0630 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-mathtools.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-mathtools.dtx
@@ -2,7 +2,7 @@
%
%% File: latex-lab-mathtools.dtx
%
-% Copyright (C) 2022,2023 The LaTeX Project
+% Copyright (C) 2022-2024 The LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -109,7 +109,7 @@
\def\intertext##1{%
\ifvmode\else\\\@empty\fi
\noalign{%
- \penalty\postdisplaypenalty\vskip\belowdisplayskip
+ \penalty\postdisplaypenalty\vskip-\belowdisplayskip
\vskip-\lineskiplimit % CCS
\vskip\normallineskiplimit % CCS
\vskip\l_MT_above_intertext_sep
@@ -170,6 +170,7 @@
\MH_fi:
\tag_mc_end_push:
\tagpdfsetup{paratag=Span}
+ \tagpdfparaOn
\noindent\ignorespaces#1\par
\tag_mc_begin_pop:n{}}
\penalty\predisplaypenalty\vskip\abovedisplayshortskip%
@@ -197,7 +198,11 @@
\parshape\@ne \@totalleftmargin \linewidth
\MH_fi:
\tag_mc_end_push:
- \tagpdfsetup{paratag=Span}
+ \tagpdfsetup{paratag=P}
+% \end{macrocode}
+% Why is it needed to enable paratagging??
+% \begin{macrocode}
+ \tagpdfparaOn
\noindent\ignorespaces#1\par
\tag_mc_begin_pop:n{}}%
\penalty\predisplaypenalty\vskip\abovedisplayshortskip%
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-mathtools.pdf b/macros/latex-dev/required/latex-lab/latex-lab-mathtools.pdf
index 97026901d6..63e5b1e169 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-mathtools.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-mathtools.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-minipage.dtx b/macros/latex-dev/required/latex-lab/latex-lab-minipage.dtx
index 1d3ee828aa..ffbe5357e7 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-minipage.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-minipage.dtx
@@ -1,6 +1,8 @@
% \iffalse meta-comment
%
-%% File: latex-lab-minipage.dtx (C) Copyright 2023 LaTeX Project
+%% File: latex-lab-minipage.dtx
+%%
+% Copyright (C) 2023-2024 LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-minipage.pdf b/macros/latex-dev/required/latex-lab/latex-lab-minipage.pdf
index c91e93f2fc..6149b51afa 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-minipage.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-minipage.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-namespace.dtx b/macros/latex-dev/required/latex-lab/latex-lab-namespace.dtx
index 2ec9b0584b..a6087abe57 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-namespace.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-namespace.dtx
@@ -1,6 +1,8 @@
% \iffalse meta-comment
%
-%% File: latex-lab-namespace.dtx (C) Copyright 2023 LaTeX Project
+%% File: latex-lab-namespace.dtx
+%%
+% Copyright (C) 2023-2024 LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-namespace.pdf b/macros/latex-dev/required/latex-lab/latex-lab-namespace.pdf
index ff8e705be3..ec3c307a97 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-namespace.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-namespace.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-new-or-1.dtx b/macros/latex-dev/required/latex-lab/latex-lab-new-or-1.dtx
index cc60f50de0..9994b15cb8 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-new-or-1.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-new-or-1.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: latex-lab-new-or-1.dtx (C) Copyright 2020-2023 Frank Mittelbach
+%% File: latex-lab-new-or-1.dtx (C) Copyright 2020-2024 Frank Mittelbach
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-new-or-1.pdf b/macros/latex-dev/required/latex-lab/latex-lab-new-or-1.pdf
index e670627022..05cb1fbb23 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-new-or-1.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-new-or-1.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-new-or-2.dtx b/macros/latex-dev/required/latex-lab/latex-lab-new-or-2.dtx
index d2011256b1..ee20331a8f 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-new-or-2.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-new-or-2.dtx
@@ -1,7 +1,7 @@
% \iffalse meta-comment
%
%% File: latex-lab-new-or-2.dtx
-% Copyright (C) 2022-2023 The LaTeX Project
+% Copyright (C) 2022-2024 The LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-new-or-2.pdf b/macros/latex-dev/required/latex-lab/latex-lab-new-or-2.pdf
index 13f4fa1265..df38c11015 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-new-or-2.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-new-or-2.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-sec.dtx b/macros/latex-dev/required/latex-lab/latex-lab-sec.dtx
index ae7a0b85c3..f3786c2ddb 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-sec.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-sec.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: latex-lab-sec.dtx (C) Copyright 2022-2023 LaTeX Project
+%% File: latex-lab-sec.dtx (C) Copyright 2022-2024 LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -16,10 +16,10 @@
%
% for those people who are interested or want to report an issue.
%
-\def\ltlabsecdate{2023-10-16}
-\def\ltlabsecversion{0.84b}
+\def\ltlabsecdate{2024-02-12}
+\def\ltlabsecversion{0.84c}
%<*driver>
-\documentclass{l3doc}
+\documentclass[kernel]{l3doc}
\EnableCrossrefs
\CodelineIndex
\begin{document}
@@ -214,11 +214,11 @@
\fi
\IfBooleanTF {#1}
{
- \tl_gset:Nx \@currentHref {#3}
+ \tl_gset:Ne \@currentHref {#3}
}
{
\int_gincr:N\g__kernel_target_int
- \tl_gset:Nx \@currentHref {target*.\int_use:N\g__kernel_target_int}
+ \tl_gset:Ne \@currentHref {target*.\int_use:N\g__kernel_target_int}
}
}
\ExplSyntaxOff
@@ -260,7 +260,7 @@
tag= {\int_compare:nNnTF {#1}={-1}{Part}{Sect}}
,#2
}
- \seq_gpush:Nx \g__tag_sec_stack_seq {{\g__tag_struct_tag_tl}{\int_eval:n{#1}}}
+ \seq_gpush:Ne \g__tag_sec_stack_seq {{\g__tag_struct_tag_tl}{\int_eval:n{#1}}}
}
% \end{macrocode}
% \end{macro}
@@ -289,7 +289,7 @@
\__tag_sec_end:n {#1}
}
{
- \msg_warning:nnxx {tag}{wrong-sect-nesting}
+ \msg_warning:nnee {tag}{wrong-sect-nesting}
{ \exp_last_unbraced:NV\use_i:nn \l__tag_tmpa_tl }
{ \exp_last_unbraced:NV\use_i:nn \l__tag_tmpb_tl }
}
@@ -670,6 +670,7 @@
\cs_new_protected:Npn \@kernel@tag@hangfrom #1
{
\tagstructbegin{tag=\l__tag_para_tag_tl}
+ \cs_if_exist_use:N \__tag_gincr_para_begin_int:
\tagstructbegin{tag=Lbl}
\setbox\@tempboxa
\hbox
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-sec.pdf b/macros/latex-dev/required/latex-lab/latex-lab-sec.pdf
index 4dc549e7c9..5e389feb11 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-sec.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-sec.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-table.dtx b/macros/latex-dev/required/latex-lab/latex-lab-table.dtx
index 700d4ce6c1..2eafb0a21e 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-table.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-table.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: latex-lab-table.dtx (C) Copyright 2023 LaTeX Project
+%% File: latex-lab-table.dtx (C) Copyright 2023-2024 LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -16,8 +16,8 @@
%
% for those people who are interested or want to report an issue.
%
-\def\ltlabtbldate{2023-10-30}
-\def\ltlabtblversion{0.85d}
+\def\ltlabtbldate{2024-02-07}
+\def\ltlabtblversion{0.85k}
%<*driver>
\documentclass{l3doc}
\EnableCrossrefs
@@ -115,9 +115,17 @@
% Such tables can be nested.
%
% If a table should not be tagged as table, for example because it is merely used
-% to produce a layout or because it is a not yet (fully) supported table structure,
+% as a layout to ensure that the content is properly aligned
+% or because it is a not yet (fully) supported table structure,
% the tagging can be disabled with
-% \verb|\tagpdfsetup{table-tagging=false}|.
+% \verb|\tagpdfsetup{table/tagging=false}| or with \verb|\tagpdfsetup{table/tagging=presentation}|%
+% \footnote{The key has been renamed. The old name `table-tagging` still works but is
+% deprecated. The value \texttt{presentation} refers to the ARIA role \enquote{presentation}.}
+% The first option disables the table tagging code and he content of the tabular
+% is then treated more or less like running text. This works ok for simple tables using
+% only hmode-cells (l/c/r) with normal text content, but fails if the table uses vmode-cells
+% (p/m/b). In such cases the second option works better: it keeps the tagging code active
+% but changes the tag names to \texttt{Div} and the grouping structure \texttt{NonStruct}.
%
% Inside cells the automatic tagging of paragraphs is disabled with the exception of
% p/m/b-type cells.
@@ -126,9 +134,10 @@
% added with an empty TD-structure.
%
% There is some basic support\footnote{This is not meant to be the
-% final interface, though.} for headers. With
+% final interface, though.} for headers. With\footnote{The old key name \texttt{table-header-rows} still
+% works but is deprecated.}
% \begin{quote}
-% \verb|\tagpdfsetup{table-header-rows={|\meta{list of row numbers}\verb|}|
+% \verb|\tagpdfsetup{table/header-rows={|\meta{list of row numbers}\verb|}|
% \end{quote}
% you can
% declare which (absolute) row numbers should be tagged as header rows.
@@ -139,7 +148,7 @@
% for header columns yet. In a \env{longtable} the code will currently use the \cs{endhead} or
% \cs{endfirsthead} rows as header if one of these commands has been
% used and in that case the code
-% ignores a \texttt{table-header-rows} setting.
+% ignores a \texttt{table/header-rows} setting.
%
% You should not insert meaningful text with \verb+!{...}+ or \verb+@{...}+ or \cs{noalign}
% between the rows or columns of the table.
@@ -193,7 +202,8 @@
%
% \item Not every table should be tagged as a Table structure, often they are
% only used as layout help, e.g. to align authors in a title pages. In such uses
-% the tagging of the table must be deactivated with \verb|\tagpdfsetup{table-tagging=false}|.
+% the tagging of the table must be deactivated with \verb|\tagpdfsetup{table/tagging=false}|
+% or \verb|\tagpdfsetup{table/tagging=presentation}|.
%
% \item Only simple header rows are currently supported. Columns and complex headers with
% subheaders will be handled later as that needs some syntax changes. Tables
@@ -210,6 +220,8 @@
%
% \item The \env{longtable} environment supports footnotes in p-type columns, but it hasn't been
% tested yet if this works also with the tagging code.
+%
+% \item Vertical boxes (\cs{parbox}, \texttt{minipage}, \ldots) inside cells can be problematic.
%
% \item The code is quite noisy and fills the log with lots of
% messages.\footnote{Helpful for us at this stage.}
@@ -271,10 +283,11 @@
% \begin{macro}
% {
% \l_@@_celltag_tl
+% \l_@@_pcelltag_tl
% ,\l_@@_rowtag_tl
+% ,\l_@@_table_tl
% ,\l_@@_cellattribute_tl
% ,\l_@@_rowattribute_tl
-% ,\g_@@_missingcells_int
% ,\l_@@_tmpa_clist
% ,\l_@@_tmpa_seq
% ,\l_@@_tmpa_tl
@@ -283,12 +296,19 @@
% \begin{macrocode}
\tl_new:N \l_@@_celltag_tl
\tl_set:Nn \l_@@_celltag_tl {TD}
+\tl_new:N \l_@@_pcelltag_tl
+\tl_set:Nn \l_@@_pcelltag_tl {TD}
% \end{macrocode}
% For the rowtag, probably always TR:
% \begin{macrocode}
\tl_new:N \l_@@_rowtag_tl
\tl_set:Nn \l_@@_rowtag_tl {TR}
% \end{macrocode}
+% For the tabletag, probably always Table:
+% \begin{macrocode}
+\tl_new:N \l_@@_tabletag_tl
+\tl_set:Nn \l_@@_tabletag_tl {Table}
+% \end{macrocode}
% And here cell and row attributes:
% \begin{macrocode}
\tl_new:N \l_@@_cellattribute_tl
@@ -296,94 +316,27 @@
\tl_new:N \l_@@_rowattribute_tl
\tl_set:Nn \l_@@_rowattribute_tl {}
% \end{macrocode}
-% This will contain the number of missing cells used:
-% \begin{macrocode}
-\int_new:N \g_@@_missing_cells_int
-% \end{macrocode}
% Temp variables
% \begin{macrocode}
\clist_new:N \l_@@_tmpa_clist
-\seq_new:N \l_@@_tmpa_seq
\tl_new:N \l_@@_tmpa_tl
% \end{macrocode}
% \end{macro}
%
-% \subsection{Sockets}
-%
-% The code uses a number of sockets to inject the tagging
-% commands. These can be easily set to a noop-plug in case the
-% automated tagging is not wanted At first sockets for the begin and
-% end of cells and rows
-%
-% \begin{socketdecl}{tagsupport/tblcell/begin,
-% tagsupport/tblcell/end,
-% tagsupport/tblrow/begin,
-% tagsupport/tblrow/end,
-% }
-% \begin{macrocode}
-\NewSocket{tagsupport/tblcell/begin}{0}
-\NewSocket{tagsupport/tblcell/end}{0}
-\NewSocket{tagsupport/tblrow/begin}{0}
-\NewSocket{tagsupport/tblrow/end}{0}
-% \end{macrocode}
-% \end{socketdecl}
-%
-% \begin{socketdecl}{tagsupport/tbl/init}
-% This socket should be at the begin of the table, inside a group.
-% It is meant for settings like disabling paratagging. This socket
-% can perhaps be merged later into the begin-sockets when they are
-% no longer added as hooks but in the environment definitions.
-% \begin{macrocode}
-\NewSocket{tagsupport/tbl/init}{0}
-% \end{macrocode}
-% \end{socketdecl}
-%
-%
-% \begin{socketdecl}{tagsupport/tbl/finalize}
-% To fine tune the structure (change cells to header cells, remove
-% unwanted structures, move a foot to the end, etc.) we also need a
-% socket that is executed at the end of the table but \emph{before}
-% all the variables are restored to the outer or default values.
-% The code in the socket can make assignments, but probably
-% shouldn't do typesetting and not write whatsits.
-% \begin{macrocode}
-\NewSocket{tagsupport/tbl/finalize}{0}
-% \end{macrocode}
-% \end{socketdecl}
+% \subsection{Tagging support sockets}
%
-% \begin{socketdecl}{tagsupport/tbl/finalize/longtable}
-% \env{longtable} needs its own socket to fine tune the structure.
-% Simply switching the plug in the previous socket interferes with
-% enabling/disabling the tagging.
-% \begin{macrocode}
-\NewSocket{tagsupport/tbl/finalize/longtable}{0}
-% \end{macrocode}
-% \end{socketdecl}
-%
-% \begin{socketdecl}{tagsupport/tblhmode/begin,
-% tagsupport/tblhmode/end,
-% tagsupport/tblvmode/begin,
-% tagsupport/tblvmode/end
-% }
-%
-% These sockets are used in the begin and end code of environments,
-% to allow a fast enabling and disabling of the tagging. We
-% distinguish between tables that can be used inside paragraphs and
-% standalone tables like longtable.
-% \begin{macrocode}
-\NewSocket{tagsupport/tblhmode/begin}{0}
-\NewSocket{tagsupport/tblhmode/end}{0}
-\NewSocket{tagsupport/tblvmode/begin}{0}
-\NewSocket{tagsupport/tblvmode/end}{0}
-% \end{macrocode}
-% \end{socketdecl}
%
% This are the standard plugs for tagging of cells and rows.
%
% \begin{plugdecl}{TD}
% \begin{macrocode}
-\NewSocketPlug{tagsupport/tblcell/begin}{TD}
+\NewSocketPlug{tagsupport/tbl/cell/begin}{TD}
{
+% \end{macrocode}
+% Next line was previously outside of the plug, so if we want to execute it
+% always even if the noop plug is in force this needs a different solution.
+% \begin{macrocode}
+ \@@_show_curr_cell_data:
\tag_struct_begin:n
{
tag =\l_@@_celltag_tl,
@@ -405,7 +358,7 @@
%
% \begin{plugdecl}{TD}
% \begin{macrocode}
-\NewSocketPlug{tagsupport/tblcell/end}{TD}
+\NewSocketPlug{tagsupport/tbl/cell/end}{TD}
{
\tag_mc_end:
\tag_struct_end:
@@ -415,14 +368,14 @@
%
% In p-columns we need a slightly different plug which reactivates the
% paragraph tagging.
-% tagging
-% \begin{plugdecl}{TD}
+% \begin{plugdecl}{TDpbox}
% \begin{macrocode}
-\NewSocketPlug{tagsupport/tblcell/begin}{TDpbox}
+\NewSocketPlug{tagsupport/tbl/pcell/begin}{TDpbox}
{
+ \@@_show_curr_cell_data:
\tag_struct_begin:n
{
- tag =\l__tbl_celltag_tl,
+ tag =\l__tbl_pcelltag_tl,
attribute-class =\l__tbl_cellattribute_tl
}
\seq_gput_right:Ne \g__tbl_struct_cur_seq { \tag_get:n {struct_num} }
@@ -436,9 +389,9 @@
% \end{macrocode}
% \end{plugdecl}
%
-% \begin{plugdecl}{TD}
+% \begin{plugdecl}{TDpbox}
% \begin{macrocode}
-\NewSocketPlug{tagsupport/tblcell/end}{TDpbox}
+\NewSocketPlug{tagsupport/tbl/pcell/end}{TDpbox}
{
\tag_struct_end:
}
@@ -447,7 +400,7 @@
%
% \begin{plugdecl}{TR}
% \begin{macrocode}
-\NewSocketPlug{tagsupport/tblrow/begin}{TR}
+\NewSocketPlug{tagsupport/tbl/row/begin}{TR}
{
\seq_gclear:N \g_@@_struct_cur_seq
\tag_struct_begin:n
@@ -462,24 +415,28 @@
%
% \begin{plugdecl}{TR}
% \begin{macrocode}
-\NewSocketPlug{tagsupport/tblrow/end}{TR}
+\NewSocketPlug{tagsupport/tbl/row/end}{TR}
{
- \__tag_tbl_add_missing_cells:n { \g_@@_missing_cells_int }
+ \tag_if_active:T
+ {
+ \@@_add_missing_cells:
\seq_gput_right:Ne \g_@@_struct_cells_seq
{
\seq_use:Nn \g_@@_struct_cur_seq {,}
}
- \int_compare:nNnTF { \g_@@_row_int } = { \seq_count:N\g_@@_struct_cells_seq }
+ \int_compare:nNnTF { \g_@@_row_int } =
+ { \seq_count:N \g_@@_struct_cells_seq }
{
- \typeout
+ \@@_trace:n
{==>~
stucture~stored~for~row~\int_use:N\g_@@_row_int :~
\seq_use:Nn \g_@@_struct_cur_seq {,}
}
}
- { \ERROR } % should not happen ...
+ { \ERRORtbl/row } % should not happen ...
\tag_struct_end:
}
+ }
% \end{macrocode}
% \end{plugdecl}
%
@@ -497,6 +454,10 @@
\tag_if_active:T
{
\bool_set_false:N \l__tag_para_bool
+% \end{macrocode}
+% We also initialize the structure data variables a this point.
+% \begin{macrocode}
+ \@@_init_struct_data:
}
}
% \end{macrocode}
@@ -509,14 +470,41 @@
\NewSocketPlug{tagsupport/tbl/finalize}{Table}
{
\@@_set_header_rows:
+% \end{macrocode}
+% Similarly, we restore the outer values of the structure data when
+% we leave the table.
+% \begin{macrocode}
+ \@@_restore_struct_data:
}
% \end{macrocode}
% \end{plugdecl}
%
+%
+%
+%
+% \begin{plugdecl}{Table}
+% This plug will initialize the structure in longtable.
+% \begin{macrocode}
+\NewSocketPlug{tagsupport/tbl/longtable/init}{Table}
+ {
+ \seq_gclear:N\g_@@_struct_rows_seq
+ \seq_gclear:N\g_@@_struct_cells_seq
+ \seq_gclear:N\g_@@_struct_cur_seq
+ \seq_gclear:N\g_@@_LT@firsthead_rows_seq
+ \seq_gclear:N\g_@@_LT@head_rows_seq
+ \seq_gclear:N\g_@@_LT@lastfoot_rows_seq
+ \seq_gclear:N\g_@@_LT@foot_rows_seq
+ }
+% \end{macrocode}
+% \end{plugdecl}
+%
+%
+
+
% \begin{plugdecl}{Table}
-% This plug will fine tune the structure of longtable.
+% This plug will fine tune the structure in longtable.
% \begin{macrocode}
-\NewSocketPlug{tagsupport/tbl/finalize/longtable}{Table}
+\NewSocketPlug{tagsupport/tbl/longtable/finalize}{Table}
{
% \end{macrocode}
% If neither \cs{endhead} nor \cs{endfirsthead} has been used
@@ -683,11 +671,40 @@
% \end{macrocode}
% \end{plugdecl}
%
+%
+%
+% \begin{plugdecl}{Table}
+%
+% We must avoid that the reuse of the header foot box leads to duplicated
+% content, thus reset attribute of the box:
+% \begin{macrocode}
+\NewSocketPlug{tagsupport/tbl/longtable/head}{Table}
+ {
+ \tagmcbegin{artifact}
+ \tag_mc_reset_box:N\LT@head
+ \tagmcend
+ }
+% \end{macrocode}
+% \end{plugdecl}
+%
% \begin{plugdecl}{Table}
% \begin{macrocode}
-\NewSocketPlug{tagsupport/tblhmode/begin}{Table}
+\NewSocketPlug{tagsupport/tbl/longtable/foot}{Table}
+ {
+ \tagmcbegin{artifact}
+ \tag_mc_reset_box:N \LT@foot
+ \tagmcend
+ }
+% \end{macrocode}
+% \end{plugdecl}
+%
+%
+%
+%
+% \begin{plugdecl}{Table}
+% \begin{macrocode}
+\NewSocketPlug{tagsupport/tbl/hmode/begin}{Table}
{
- \mode_leave_vertical:
\tag_mc_end_push:
% \end{macrocode}
% Close the P-chunk. This assumes that para-tagging is active.
@@ -696,7 +713,7 @@
\bool_lazy_and:nnT
{ \bool_if_exist_p:N \l__tag_para_bool } { \l__tag_para_bool }
{ \tag_struct_end:n { text } }
- \tag_struct_begin:n {tag=Table}
+ \tag_struct_begin:n {tag=\l_@@_tabletag_tl}
\tl_gset:Ne \g_@@_struct_table_tl { \tag_get:n {struct_num} }
}
% \end{macrocode}
@@ -704,7 +721,7 @@
%
% \begin{plugdecl}{Table}
% \begin{macrocode}
-\NewSocketPlug{tagsupport/tblhmode/end}{Table}
+\NewSocketPlug{tagsupport/tbl/hmode/end}{Table}
{
\tag_struct_end:
% \end{macrocode}
@@ -721,9 +738,9 @@
%
% \begin{plugdecl}{Table}
% \begin{macrocode}
-\NewSocketPlug{tagsupport/tblvmode/begin}{Table}
+\NewSocketPlug{tagsupport/tbl/vmode/begin}{Table}
{
- \tag_struct_begin:n {tag=Table}
+ \tag_struct_begin:n {tag=\l_@@_tabletag_tl}
\tl_gset:Ne \g_@@_struct_table_tl { \tag_get:n {struct_num} }
}
% \end{macrocode}
@@ -731,7 +748,7 @@
%
% \begin{plugdecl}{Table}
% \begin{macrocode}
-\NewSocketPlug{tagsupport/tblvmode/end}{Table}
+\NewSocketPlug{tagsupport/tbl/vmode/end}{Table}
{
\tag_struct_end:
\par
@@ -740,30 +757,50 @@
% \end{plugdecl}
%
%
+% \begin{plugdecl}{code}
+% This socket takes a number, checks if is larger than one,
+% checks if the colspan attribute already exists (we can't predefine an
+% arbitrary number), and updates \cs{l_@@_cellattribute_tl}.
+% \begin{macrocode}
+\NewSocketPlug{tagsupport/tbl/colspan}{code}
+ {
+ \int_compare:nNnT {#1}>{1}
+ {
+ \prop_get:NeNF \g__tag_attr_entries_prop
+ {colspan-\int_eval:n{#1}}
+ \l_@@_tmpa_tl
+ {
+ \__tag_attr_new_entry:ee
+ {colspan-\int_eval:n{#1}}
+ {/O /Table /ColSpan~\int_eval:n{#1}}
+ }
+ \tl_set:Ne \l_@@_cellattribute_tl
+ {colspan-\int_eval:n{#1}}
+ }
+ }
+% \end{macrocode}
+% TODO: move to tagpdf
+% \begin{macrocode}
+\tag_if_active:T
+ { \cs_generate_variant:Nn \__tag_attr_new_entry:nn {ee} }
+
+% \end{macrocode}
+% \end{plugdecl}
%
%
%
%\subsection{Environments}
%
-% Currently only tabular, tabular*, tabularx and longtable.
-% We must use the \texttt{before} and \texttt{after} hooks as the \texttt{end}
-% hook is executed before the end of the last row and then MC are messed up.
-% This means that this sockets should only contain code that doesn't needs to be
-% grouped!
-% \begin{macrocode}
-\AddToHook{env/tabular/before} {\UseSocket{tagsupport/tblhmode/begin}}
-\AddToHook{env/tabular/after} {\UseSocket{tagsupport/tblhmode/end}}
-\AddToHook{env/tabular*/before} {\UseSocket{tagsupport/tblhmode/begin}}
-\AddToHook{env/tabular*/after} {\UseSocket{tagsupport/tblhmode/end}}
-\AddToHook{env/tabularx/before} {\UseSocket{tagsupport/tblhmode/begin}}
-\AddToHook{env/tabularx/after} {\UseSocket{tagsupport/tblhmode/end}}
-\AddToHook{env/longtable/before}{\UseSocket{tagsupport/tblvmode/begin}}
-\AddToHook{env/longtable/after} {\UseSocket{tagsupport/tblvmode/end}}
-% \end{macrocode}
+% Currently we support only tabular, tabular*, tabularx and longtable
+% (and possibly environments build directly on top of them).
%
% The \env{array} environment is math. So we disable table tagging for now.
+% We use the command hook to catch also cases where \cs{array} is used directly
+% in other environments like matrix environments.
+% Perhaps table tagging should be disable for math generally, but then
+% we have to handle text insertions.
% \begin{macrocode}
-\AddToHook{env/array/begin} {\__tag_tbl_disable:}
+\AddToHook{cmd/array/before}{\__tag_tbl_disable:}
% \end{macrocode}
%
%
@@ -771,34 +808,6 @@
%
% \subsubsection{Tagging helper commands}
%
-% \begin{macro}{\@@_set_colspan:n}
-% This commands takes a number, checks if is larger than one,
-% checks if the colspan attribute exists (we can't predefine an
-% arbitrary number), and updates \cs{l_@@_cellattribute_tl}.
-% \begin{macrocode}
-\tag_if_active:T
- { \cs_generate_variant:Nn \__tag_attr_new_entry:nn {ee} }
-\cs_new_protected:Npn \@@_set_colspan:n #1
- {
- \tag_if_active:T
- {
- \int_compare:nNnT {#1}>{1}
- {
- \prop_get:NeNF \g__tag_attr_entries_prop
- {colspan-\int_eval:n{#1}}
- \l_@@_tmpa_tl
- {
- \__tag_attr_new_entry:ee
- {colspan-\int_eval:n{#1}}
- {/O /Table /ColSpan~\int_eval:n{#1}}
- }
- \tl_set:Ne \l_@@_cellattribute_tl
- {colspan-\int_eval:n{#1}}
- }
- }
- }
-% \end{macrocode}
-% \end{macro}
%
% \subsubsection{Disabling/enabling}
%
@@ -810,17 +819,23 @@
% \begin{macrocode}
\cs_new_protected:Npn \__tag_tbl_disable:
{
- \AssignSocketPlug{tagsupport/tblcell/begin}{noop}
- \AssignSocketPlug{tagsupport/tblcell/end}{noop}
- \AssignSocketPlug{tagsupport/tblrow/begin}{noop}
- \AssignSocketPlug{tagsupport/tblrow/end}{noop}
+ \AssignSocketPlug{tagsupport/tbl/cell/begin}{noop}
+ \AssignSocketPlug{tagsupport/tbl/cell/end}{noop}
+ \AssignSocketPlug{tagsupport/tbl/pcell/begin}{noop}
+ \AssignSocketPlug{tagsupport/tbl/pcell/end}{noop}
+ \AssignSocketPlug{tagsupport/tbl/row/begin}{noop}
+ \AssignSocketPlug{tagsupport/tbl/row/end}{noop}
\AssignSocketPlug{tagsupport/tbl/init}{noop}
\AssignSocketPlug{tagsupport/tbl/finalize}{noop}
- \AssignSocketPlug{tagsupport/tbl/finalize/longtable}{noop}
- \AssignSocketPlug{tagsupport/tblhmode/begin}{noop}
- \AssignSocketPlug{tagsupport/tblhmode/end}{noop}
- \AssignSocketPlug{tagsupport/tblvmode/begin}{noop}
- \AssignSocketPlug{tagsupport/tblvmode/end}{noop}
+ \AssignSocketPlug{tagsupport/tbl/longtable/init}{noop}
+ \AssignSocketPlug{tagsupport/tbl/longtable/head}{noop}
+ \AssignSocketPlug{tagsupport/tbl/longtable/foot}{noop}
+ \AssignSocketPlug{tagsupport/tbl/longtable/finalize}{noop}
+ \AssignSocketPlug{tagsupport/tbl/hmode/begin}{noop}
+ \AssignSocketPlug{tagsupport/tbl/hmode/end}{noop}
+ \AssignSocketPlug{tagsupport/tbl/vmode/begin}{noop}
+ \AssignSocketPlug{tagsupport/tbl/vmode/end}{noop}
+ \AssignSocketPlug{tagsupport/tbl/colspan}{noop}
}
% \end{macrocode}
% \end{macro}
@@ -831,46 +846,58 @@
% \begin{macrocode}
\cs_new_protected:Npn \__tag_tbl_enable:
{
- \AssignSocketPlug{tagsupport/tblcell/begin}{TD}
- \AssignSocketPlug{tagsupport/tblcell/end}{TD}
- \AssignSocketPlug{tagsupport/tblrow/begin}{TR}
- \AssignSocketPlug{tagsupport/tblrow/end}{TR}
+ \AssignSocketPlug{tagsupport/tbl/cell/begin}{TD}
+ \AssignSocketPlug{tagsupport/tbl/cell/end}{TD}
+ \AssignSocketPlug{tagsupport/tbl/pcell/begin}{TDpbox}
+ \AssignSocketPlug{tagsupport/tbl/pcell/end}{TDpbox}
+ \AssignSocketPlug{tagsupport/tbl/row/begin}{TR}
+ \AssignSocketPlug{tagsupport/tbl/row/end}{TR}
\AssignSocketPlug{tagsupport/tbl/init}{Table}
\AssignSocketPlug{tagsupport/tbl/finalize}{Table}
- \AssignSocketPlug{tagsupport/tbl/finalize/longtable}{Table}
- \AssignSocketPlug{tagsupport/tblhmode/begin}{Table}
- \AssignSocketPlug{tagsupport/tblhmode/end}{Table}
- \AssignSocketPlug{tagsupport/tblvmode/begin}{Table}
- \AssignSocketPlug{tagsupport/tblvmode/end}{Table}
+ \AssignSocketPlug{tagsupport/tbl/longtable/head}{Table}
+ \AssignSocketPlug{tagsupport/tbl/longtable/foot}{Table}
+ \AssignSocketPlug{tagsupport/tbl/longtable/init}{Table}
+ \AssignSocketPlug{tagsupport/tbl/longtable/finalize}{Table}
+ \AssignSocketPlug{tagsupport/tbl/hmode/begin}{Table}
+ \AssignSocketPlug{tagsupport/tbl/hmode/end}{Table}
+ \AssignSocketPlug{tagsupport/tbl/vmode/begin}{Table}
+ \AssignSocketPlug{tagsupport/tbl/vmode/end}{Table}
+ \AssignSocketPlug{tagsupport/tbl/colspan}{code}
}
% \end{macrocode}
% \end{macro}
% \begin{macrocode}
-% TODO decide about key name
+% See tagpdfsetup-keys.md in tagpdf/doc for the naming scheme.
\keys_define:nn { __tag / setup }
{
- table-tagging .choices:nn = { true, on }
+ table/tagging .choices:nn = { true, on }
{ \__tag_tbl_enable: },
- table-tagging .choices:nn = { false, off }
+ table/tagging .choices:nn = { false, off }
{ \__tag_tbl_disable: },
- table-tagging .default:n = true,
- table-tagging .initial:n = true
+ table/tagging .choice:,
+ table/tagging / presentation .code:n =
+ {
+ \__tag_tbl_enable:
+ \tl_set:Nn\l_@@_rowtag_tl {NonStruct}
+ \tl_set:Nn\l_@@_pcelltag_tl {NonStruct}
+ \tl_set:Nn\l_@@_celltag_tl {text}
+ \tl_set:Nn\l_@@_tabletag_tl {Div}
+ },
+ table/tagging .default:n = true,
+ table/tagging .initial:n = true
}
% \end{macrocode}
-%
-% Table tagging should be disabled in the head and foot.
+% This are the old key names kept for now for
+% compability. They will got at some time.
% \begin{macrocode}
-\AddToHook{begindocument}
- {
- \cs_if_exist:NT \@kernel@before@head
- {
- \tl_put_right:Nn \@kernel@before@head {\__tag_tbl_disable:}
- \tl_put_right:Nn \@kernel@before@foot {\__tag_tbl_disable:}
- }
- }
+\keys_define:nn { __tag / setup }
+ {
+ table-tagging .meta:n = {table/tagging={#1}}
+ }
% \end{macrocode}
%
+%
% \subsubsection{Header support}
%
% Accessible table must have header cells declaring the meaning of the
@@ -983,261 +1010,68 @@
% \end{macro}
%
% And some key support:
+% (See tagpdfsetup-keys.md for the naming scheme.)
% \begin{macrocode}
-% TODO decide about key name
\keys_define:nn { __tag / setup }
{
- table-header-rows .clist_set:N = \l_@@_header_rows_clist
+ table/header-rows .clist_set:N = \l_@@_header_rows_clist,
+% \end{macrocode}
+% obsolete older name:
+% \begin{macrocode}
+ table-header-rows .meta:n = {table/header-rows={#1}}
}
% \end{macrocode}
%
-% \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
% for debugging.
% \begin{macrocode}
\cs_new_protected:Npn \@@_show_curr_cell_data: {
- \typeout { ==>~ current~cell~data:~
- \int_use:N \g_@@_row_int ,
- \int_use:N \g_@@_col_int ,
- \g_@@_span_tl
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-%
-% \begin{macro}{\insert@column}
-% \cs{insert@column} is defined in \pkg{array}, here only the two
-% sockets are inserted.
-% \begin{macrocode}
-\def\insert@column{%
- \@@_show_curr_cell_data:
- \UseSocket{tagsupport/tblcell/begin}%
- \the@toks \the \@tempcnta
- \ignorespaces \@sharp \unskip
- \the@toks \the \count@ \relax
- \UseSocket{tagsupport/tblcell/end}%
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\@classz}
-% \begin{macrocode}
-\def\@classz{\@classx
- \@tempcnta \count@
- \prepnext@tok
- \@addtopreamble{\ifcase \@chnum
- \hfil
- \hskip1sp%
- \d@llarbegin
- \insert@column
- \d@llarend \do@row@strut \hfil \or
- \hskip1sp\d@llarbegin \insert@column \d@llarend \do@row@strut \hfil \or
- \hfil\hskip1sp\d@llarbegin \insert@column \d@llarend \do@row@strut \or
- \setbox\ar@mcellbox\vbox
- \@startpbox{\@nextchar}
- \AssignSocketPlug{tagsupport/tblcell/begin}{TDpbox}
- \AssignSocketPlug{tagsupport/tblcell/end}{TDpbox}
- \insert@column \@endpbox
- \ar@align@mcell
- \do@row@strut \or
- \vtop \@startpbox{\@nextchar}
- \AssignSocketPlug{tagsupport/tblcell/begin}{TDpbox}
- \AssignSocketPlug{tagsupport/tblcell/end}{TDpbox}
- \insert@column \@endpbox\do@row@strut \or
- \vbox \@startpbox{\@nextchar}
- \AssignSocketPlug{tagsupport/tblcell/begin}{TDpbox}
- \AssignSocketPlug{tagsupport/tblcell/end}{TDpbox}
- \insert@column \@endpbox\do@row@strut
- \fi}\prepnext@tok}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\@array,\@@@@array}
-% We modificate the \cs{@array} from \pkg{array}.
-% \begin{macrocode}
-\def\@array[#1]#2{%
- \@tempdima \ht \strutbox
- \advance \@tempdima by\extrarowheight
- \setbox \@arstrutbox \hbox{\vrule
- \@height \arraystretch \@tempdima
- \@depth \arraystretch \dp \strutbox
- \@width \z@}%
-% \end{macrocode}
-% The total number of table columns of the current table is
-% determined in \cs{@@_determine_table_cols:} but this is called in
-% a group, so local settings do not survive. Thus, to save away the
-% outer value of \cs{g_@@_table_cols_tl} we do it before the group.
-% \begin{macrocode}
- \tl_set_eq:NN \l_@@_saved_table_cols_tl \g_@@_table_cols_tl
-% \end{macrocode}
-%
-% \begin{macrocode}
- \begingroup
- \@mkpream{#2}
-% \end{macrocode}
-% Next call has to happen immediately after \cs{@mkpream} because
-% it uses implementation details from that.
-% \begin{macrocode}
- \@@_determine_table_cols:
-% \end{macrocode}
-%
-% \begin{macrocode}
- \xdef\@preamble{%
- \noexpand
-% \end{macrocode}
-% \cs{ialign} in the original definition is replaced by
-% \cs{ar@ialign} defined below.
-% \begin{macrocode}
- \ar@ialign
- \@halignto
- \bgroup \@arstrut
-% \end{macrocode}
-% A socket is inserted
-% \begin{macrocode}
- \UseSocket{tagsupport/tblrow/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{@@_init_cell_data:}. In
-% later columns this data is updated via \cs{@@_update_cell_data:}.
-% \begin{macrocode}
- \@@_init_cell_data:
- \@preamble
- \tabskip \z@ \cr}%
- \endgroup
- \@arrayleft
-% \end{macrocode}
-% Another socket for tagging. TODO: what about \cs{arrayleft}?
-% \begin{macrocode}
- \UseSocket{tagsupport/tbl/init}
- \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi \fi
- \bgroup
- \let \@sharp ##\let \protect \relax
- \lineskip \z@
- \baselineskip \z@
- \m@th
- \let\\\@arraycr \let\tabularnewline\\\let\par\@empty
-%\show\@preamble
- \@preamble}
-% \end{macrocode}
-% Finally, also set \cs{@@@@array} to the new definition:
-% \begin{macrocode}
-\let\@@@@array\@array
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\@@_init_cell_data:}
-%
-% \begin{macrocode}
-\cs_new_protected:Npn \@@_init_cell_data: {
- \int_gset:Nn \g_@@_col_int {1}
- \tl_gset:Nn \g_@@_span_tl {1}
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\@@_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
-% cell (in case it was a \cs{multicolumn} and then reset the
-% \cs{g_@@_span_tl} to one (as the default).
-% \begin{macrocode}
-\cs_new_protected:Npn \@@_update_cell_data: {
- \int_gadd:Nn \g_@@_col_int { \g_@@_span_tl }
- \tl_gset:Nn \g_@@_span_tl {1}
+ \@@_trace:n { ==>~ current~cell~data:~
+ \int_use:N \g_@@_row_int ,
+ \int_use:N \g_@@_col_int ,
+ \g_@@_span_tl
+ }
}
% \end{macrocode}
% \end{macro}
%
%
%
-% \begin{macro}{\@@_determine_table_cols:}
-% Current implementation of \cs{@mkpream} uses the scratch counter
-% \cs{count@} to keep track of the number of toks registers it needs
-% (2 per column), but this can't be used as it counts also
-% insertings made with \verb+!{}+ and \verb+@{}+.
-% So similar as does longtable for \cs{LT@cols} we count the
-% numbers of ambersands instead.
-% \begin{macrocode}
-\cs_new:Npn \@@_determine_table_cols: {
- \seq_set_split:NnV\l_@@_tmpa_seq {&}\@preamble
- \tl_gset:Ne \g_@@_table_cols_tl { \seq_count:N \l_@@_tmpa_seq }
- \typeout{ ==>~ Table~ has~ \g_@@_table_cols_tl \space columns }
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\@arraycr}
-% Add code that figures out if the current table row is incomplete
-% (not enough \verb=&=s). It can then do extra actions, such as
-% inserting missing cell tags.
+% \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 one adding is used in the row/end socket.
% \begin{macrocode}
-\protected\def\@arraycr{
- \relax
- \@@_store_missing_cells:n{@arraycr}
- %
- \iffalse{\fi\ifnum 0=`}\fi
- \@ifstar \@xarraycr \@xarraycr}
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-% \begin{macro}{\@@_store_missing_cells:n,
-% \__tag_tbl_add_missing_cells:n}
-% 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.
-% \begin{macrocode}
-\cs_new:Npn \@@_store_missing_cells:n #1 {
- \int_compare:nNnT \g_@@_col_int > 0
- {
- \int_gset:Nn \g_@@_missing_cells_int
- {
- \g_@@_table_cols_tl
- - \g_@@_col_int
- - \g_@@_span_tl
- + 1
- }
- \int_compare:nNnT \g_@@_missing_cells_int < 0 \ERROR % should not happen
- \typeout{==>~
- (#1)~
- This~ row~ needs~
- \int_use:N \g_@@_missing_cells_int \space
- additional~ cell(s)
- }
- }
-}
+\NewSocket{tbl/celldata/missingcount}{1}
+\NewSocketPlug{tbl/celldata/missingcount}{code}{\tbl_count_missing_cells:n{#1}}
+\AssignSocketPlug{tbl/celldata/missingcount}{code}
+
% \end{macrocode}
%
% \begin{macrocode}
-\cs_new:Npn \__tag_tbl_add_missing_cells:n #1
+\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 {#1}>{0}
- {
- \typeout{==>~
- ~Inserting~\int_eval:n{#1}~additional~cell(s)~into~previous~row:}
- }
- \int_step_inline:nn { #1 }
+ \int_compare:nNnT \g_@@_missing_cells_int > 0
{
- \UseSocket{tagsupport/tblcell/begin}
- \UseSocket{tagsupport/tblcell/end}
+ \@@_trace:n {==>~
+ ~Inserting~\int_use:N \g_@@_missing_cells_int \space
+ additional~cell(s)~into~previous~row:}
+ \int_step_inline:nn { \g_@@_missing_cells_int }
+ {
+ \UseTaggingSocket{tbl/cell/begin}
+ \UseTaggingSocket{tbl/cell/end}
+ }
}
}
% \end{macrocode}
@@ -1245,120 +1079,9 @@
%
%
%
-% \begin{macro}{\endarray}
-% 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
-% 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).
-%
-% \cs{endtabular} and \cs{endtabular*} inherit from \cs{endarray}
-% so we only need to change that. \texttt{tabularx} is handled
-% below.
-% \begin{macrocode}
-\def\endarray{
- \@@_store_missing_cells:n{endarray}
- \crcr \egroup
- \UseSocket{tagsupport/tbl/finalize}
- \int_gset:Nn \g_@@_col_int { \l_@@_saved_col_tl }
- \int_gset:Nn \g_@@_row_int { \l_@@_saved_row_tl }
- \tl_gset_eq:NN \g_@@_span_tl \l_@@_saved_span_tl
- \tl_gset_eq:NN \g_@@_table_cols_tl \l_@@_saved_table_cols_tl
- \tl_gset_eq:NN \g_@@_struct_table_tl \l_@@_saved_struct_table_tl
- \seq_gset_eq:NN \g_@@_struct_rows_seq \l_@@_saved_struct_rows_seq
- \seq_gset_eq:NN \g_@@_struct_cells_seq\l_@@_saved_struct_cells_seq
- \seq_gset_eq:NN \g_@@_struct_cur_seq \l_@@_saved_struct_cur_seq
- \typeout{==>~ restored~cell~data:~
- \int_use:N \g_@@_row_int,
- \int_use:N \g_@@_col_int,
- \l_@@_saved_span_tl \space
- (
- \int_compare:nNnTF \g_@@_table_cols_tl = 0
- { outer~ level }
- { max:~ \g_@@_table_cols_tl }
- )
- }
- \egroup
- \@arrayright \gdef\@preamble{}%
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\@addamp}
-% If we are after the first column we have to insert a \verb=&= and
-% also update the cell data.
-% \begin{macrocode}
-\def\@addamp {
- \if@firstamp
- \@firstampfalse
- \else
- \edef\@preamble{\@preamble &
- \@@_update_cell_data:
- }
- \fi
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-% \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_@@_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
-% (with \verb=\\= typically); any other positive value means we
-% are currently typesetting a cell in that column in some row
-% (denoted by the \cs{g_@@_row_int}.
%
-% In a \cs{multicolumn} it holds the column number of the first
-% spanned column and \cs{g_@@_span_tl} the info how many cells are
-% spanned.
-%
-% \cs{g_@@_span_tl} is normally \texttt{1} except in a
-% \cs{multicolumn} cell.
-% \begin{macrocode}
-\int_new:N \g_@@_col_int
-\int_new:N \g_@@_row_int
-\tl_new:N \g_@@_span_tl
-\tl_new:N \g_@@_table_cols_tl
-
-\tl_gset:Nn \g_@@_span_tl {1}
-\tl_gset:Nn \g_@@_table_cols_tl {0} % indicates outer level
-% \end{macrocode}
-% \end{macro}
%
%
-% \begin{macro}{\l_@@_saved_col_tl,\l_@@_saved_row_tl,
-% \l_@@_saved_span_tl,\l_@@_saved_table_cols_tl}
-%
-% Saving the outer values if we are nesting tables is necessary (as
-% the above variables are globally altered. For this we use always
-% token lists because they don't change and we do not need to blow
-% additional integer registers.
-% \begin{macrocode}
-\tl_new:N \l_@@_saved_col_tl
-\tl_new:N \l_@@_saved_row_tl
-\tl_new:N \l_@@_saved_span_tl
-\tl_new:N \l_@@_saved_table_cols_tl
-
-\tl_set:Nn \l_@@_saved_col_tl{0}
-\tl_set:Nn \l_@@_saved_row_tl{0}
-\tl_set:Nn \l_@@_saved_span_tl{1}
-\tl_set:Nn \l_@@_saved_table_cols_tl{0} % indicates outer level
-% \end{macrocode}
-% \end{macro}
-%
% \begin{macro}
% {
% \g_@@_struct_table_tl, \l_@@_saved_struct_table_tl,
@@ -1390,474 +1113,53 @@
\seq_new:N \l_@@_saved_struct_cur_seq
% \end{macrocode}
% \end{macro}
+
+
+
+% \begin{macro}{\@@_init_struct_data:}
+% Save the global structure data variables locally so the we can
+% restore them when the table ends (important in case of nested
+% tables).
%
-% \begin{macro}{\ar@ialign}
-% A new command that replaces \cs{ialign} above. \cs{everycr} is
-% also applied to the \cs{cr} ending the preamble so we have to
-% program around that.
-% \begin{macrocode}
-\def\ar@ialign{%
-% \end{macrocode}
-% Before starting a table we locally stored the information related
-% to the current cell (if any) so that we can restore it once the
-% table is finished.
+% This is also the right point to initialize
+% them. \cs{g_@@_struct_table_tl} is set elsewhere.
% \begin{macrocode}
- \tl_set:No \l_@@_saved_col_tl {\int_use:N \g_@@_col_int }
- \tl_set:No \l_@@_saved_row_tl {\int_use:N \g_@@_row_int }
- \tl_set_eq:NN \l_@@_saved_span_tl \g_@@_span_tl
+\cs_new_protected:Npn \@@_init_struct_data: {
\tl_set_eq:NN \l_@@_saved_struct_table_tl \g_@@_struct_table_tl
\seq_set_eq:NN \l_@@_saved_struct_rows_seq \g_@@_struct_rows_seq
\seq_set_eq:NN \l_@@_saved_struct_cells_seq \g_@@_struct_cells_seq
\seq_set_eq:NN \l_@@_saved_struct_cur_seq \g_@@_struct_cur_seq
%
- \typeout{==>~ saved~cell~data:~
- \l_@@_saved_row_tl,
- \l_@@_saved_col_tl,
- \l_@@_saved_span_tl \space
- (
- \int_compare:nNnTF \l_@@_saved_table_cols_tl = 0
- { outer~ level }
- { max:~ \l_@@_saved_table_cols_tl }
- )
- }
-% \end{macrocode}
-% These are the initial values when starting a table:
-% \begin{macrocode}
- \int_gzero:N \g_@@_row_int
- \int_gzero:N \g_@@_col_int
- \tl_gset:Nn \g_@@_span_tl {1}
\seq_gclear:N\g_@@_struct_rows_seq
\seq_gclear:N\g_@@_struct_cells_seq
\seq_gclear:N\g_@@_struct_cur_seq
+}
% \end{macrocode}
-%
-% \begin{macrocode}
- \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.
-% \begin{macrocode}
- \int_compare:nNnT \g_@@_col_int > 0
- { \UseSocket{tagsupport/tblrow/end} }
- \int_gincr:N \g_@@_row_int % this row about to start
- \int_gzero:N \g_@@_col_int % we are before first col
- }%
- }%
- \tabskip\z@skip\halign}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\multicolumn}
-%
-% \cs{multicolumn} is also defined in \pkg{array}. The redefinition
-% has to solve two problems: it 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.\footnote{FMi: This can
-% now perhaps cleaned up somewhat}
-% \begin{macrocode}
-\long\def\multicolumn#1#2#3{%
- % 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:
- \multispan{#1}\begingroup
-% \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
- {
- \UseSocket{tagsupport/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.
+% \end{macro}
+
+
+
+
+% \begin{macro}{\@@_restore_struct_data:}
+%
% \begin{macrocode}
- \tl_gset:Nn \g_@@_span_tl {#1}
+\cs_new_protected:Npn \@@_restore_struct_data: {
+ \tl_gset_eq:NN \g_@@_struct_table_tl \l_@@_saved_struct_table_tl
+ \seq_gset_eq:NN \g_@@_struct_rows_seq \l_@@_saved_struct_rows_seq
+ \seq_gset_eq:NN \g_@@_struct_cells_seq\l_@@_saved_struct_cells_seq
+ \seq_gset_eq:NN \g_@@_struct_cur_seq \l_@@_saved_struct_cur_seq
+}
% \end{macrocode}
+% \end{macro}
+
+
%
-% \begin{macrocode}
- \def\@addamp{\if@firstamp\@firstampfalse \else
- \@preamerr 5\fi}%
- \@mkpream{#2}\@addtopreamble\@empty
- \endgroup
-% \end{macrocode}
-% Now we update the colspan attribute. This needs setting after
-% the group as it is hidden inside the plug in \cs{insert@column}.
-% \begin{macrocode}
- \@@_set_colspan:n {#1}
-% \end{macrocode}
-% \begin{macrocode}
- \def\@sharp{#3}%
- \@arstrut \@preamble
- \null
- \ignorespaces}
-% \end{macrocode}
-% \end{macro}
%
% \subsection{longtable}
%
-% Longtable is complicated. When at the begin the \cs{endhead},
-% \cs{endfirsthead}, \cs{endfoot} and \cs{endlastfoot} are used to
-% setup head and foot they create each a structure subtree with one or
-% more rows. From this structures we want to keep at most two (head
-% and foot) and move the foot to the end of the table. When the head
-% and foot boxes are (re)inserted on following pages we want to mark
-% them up as artifact with the exception of the head at the begin and
-% the foot box at the end.
-%
-% TODO: When a line is killed the structure subtree is there already
-% too and must be removed.
-%
-% Hyperref patches longtable. This must be disabled and replace with
-% genuine code
-% \begin{macrocode}
-\let\@kernel@refstepcounter\refstepcounter
-\def\hyper@nopatch@longtable{}
-% \end{macrocode}
-% \begin{macrocode}
-\def\@@_patch_LT@array[#1]#2{%
-% \end{macrocode}
-% \cs{LT@array} is executed in a group, so we can disable para-tagging here.
-% \begin{macrocode}
- \UseSocket{tagsupport/tbl/init}%
- \@kernel@refstepcounter{table}\stepcounter{LT@tables}%
-% \end{macrocode}
-% The target is created rather late and a \cs{label} can come earlier,
-% so we have to define \cs{@currentHref} explicitly. We can't currently
-% assume that \cs{theHtable} is defined always.
-% \begin{macrocode}
- \tl_gset:Ne \@currentHref {table.\cs_if_exist_use:N\theHtable}
- \int_gzero:N \g_@@_row_int
- \seq_gclear:N\g_@@_struct_rows_seq
- \seq_gclear:N\g_@@_struct_cells_seq
- \seq_gclear:N\g_@@_struct_cur_seq
- \seq_gclear:N\g_@@_LT@firsthead_rows_seq
- \seq_gclear:N\g_@@_LT@head_rows_seq
- \seq_gclear:N\g_@@_LT@lastfoot_rows_seq
- \seq_gclear:N\g_@@_LT@foot_rows_seq
- \if l#1%
- \LTleft\z@ \LTright\fill
- \else\if r#1%
- \LTleft\fill \LTright\z@
- \else\if c#1%
- \LTleft\fill \LTright\fill
- \fi\fi\fi
- \let\LT@mcol\multicolumn
- \let\LT@@@@tabarray\@tabarray
- \let\LT@@@@hl\hline
- \def\@tabarray{%
- \let\hline\LT@@@@hl
- \LT@@@@tabarray}%
- \let\\\LT@tabularcr
- \let\tabularnewline\\%
- \def\newpage{\noalign{\break}}%
- \def\pagebreak{\noalign{\ifnum`}=0\fi\@testopt{\LT@no@pgbk-}4}%
- \def\nopagebreak{\noalign{\ifnum`}=0\fi\@testopt\LT@no@pgbk4}%
- \let\hline\LT@hline \let\kill\LT@kill\let\caption\LT@caption
- \@tempdima\ht\strutbox
- \let\@endpbox\LT@endpbox
- \ifx\extrarowheight\@undefined
- \let\@acol\@tabacol
- \let\@classz\@tabclassz \let\@classiv\@tabclassiv
- \def\@startpbox{\vtop\LT@startpbox}%
- \let\@@@@startpbox\@startpbox
- \let\@@@@endpbox\@endpbox
- \let\LT@LL@FM@cr\@tabularcr
- \else
- \advance\@tempdima\extrarowheight
- \col@sep\tabcolsep
- \let\@startpbox\LT@startpbox\let\LT@LL@FM@cr\@arraycr
- \fi
- \setbox\@arstrutbox\hbox{\vrule
- \@height \arraystretch \@tempdima
- \@depth \arraystretch \dp \strutbox
- \@width \z@}%
- \let\@sharp##\let\protect\relax
- \begingroup
- \@mkpream{#2}%
- \@@_determine_table_cols:
- \xdef\LT@bchunk{%
-% \end{macrocode}
-% At the start of a chunk we set \cs{g_@@_col_int} to zero to make
-% sure that we aren't generating /TR with the \cs{cr} ending the
-% chunk preamble.
-% \begin{macrocode}
- \int_gzero:N \g_@@_col_int
- \global\advance\c@LT@chunks\@ne
- \global\LT@rows\z@\setbox\z@\vbox\bgroup
- \LT@setprevdepth
- \tabskip\LTleft \noexpand\halign to\hsize\bgroup
- \tabskip\z@ \@arstrut
-% \end{macrocode}
-% Insert the socket and the setting of the conditional
-% \begin{macrocode}
- \UseSocket{tagsupport/tblrow/begin}%
- \@@_init_cell_data:
-% \end{macrocode}
-% \begin{macrocode}
- \@preamble \tabskip\LTright \cr}%
- \endgroup
- \expandafter\LT@nofcols\LT@bchunk&\LT@nofcols
- \LT@make@row
- \m@th\let\par\@empty
-% \end{macrocode}
-% Socket and conditional
-% \begin{macrocode}
- \everycr{%
- \noalign{%
-% \end{macrocode}
-% 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.
-% \begin{macrocode}
- \typeout{--longtable-->~chunk~row:~ \the\LT@rows \space
- row:~ \the\g_@@_row_int \space
- column:~ \the\g_@@_col_int
- }
- \int_compare:nNnT \g_@@_col_int > 0
- {
- \UseSocket{tagsupport/tblrow/end}
- }
-% \end{macrocode}
-% This 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
-% \end{macrocode}
-% And for the same reason such \cs{cr}s should not increment the
-% main row counter (but it has to be incremented after the preamble
-% of a chunk), so here we test against \cs{LT@rows} which is
-% \cs{LTchunksize} at the end of a chunk.
-% \begin{macrocode}
- \int_compare:nNnT \LT@rows < \LTchunksize
- { \int_gincr:N \g_@@_row_int } % this row about to start
- }%
- }%
-% \end{macrocode}
-% \begin{macrocode}
- \lineskip\z@\baselineskip\z@
- \LT@bchunk}
-% \end{macrocode}
-% The end code most stop to insert the endrow too.
-% \begin{macrocode}
-\def\@@_patch_endlongtable{%
- \@@_store_missing_cells:n{endlongtable}
- \crcr
- \noalign{%
- \UseSocket{tagsupport/tbl/finalize/longtable}
- \int_gzero:N \g_@@_row_int % this prevents considering the next
- % \crcr as another row end.
- \let\LT@entry\LT@entry@chop
- \xdef\LT@save@row{\LT@save@row}}%
- \LT@echunk
- \LT@start
- \unvbox\z@
- \LT@get@widths
- \if@filesw
- {\let\LT@entry\LT@entry@write\immediate\write\@auxout{%
- \gdef\expandafter\noexpand
- \csname LT@\romannumeral\c@LT@tables\endcsname
- {\LT@save@row}}}%
- \fi
- \ifx\LT@save@row\LT@@@@save@row
- \else
- \LT@warn{Column~\@width s~have~changed\MessageBreak
- in~table~\thetable}%
- \LT@final@warn
- \fi
- \endgraf\penalty -\LT@end@pen
- \ifvoid\LT@foot\else
- \global\advance\vsize\ht\LT@foot
- \global\advance\@colroom\ht\LT@foot
- \dimen@\pagegoal\advance\dimen@\ht\LT@foot\pagegoal\dimen@
- \fi
- \endgroup
- \global\@mparbottom\z@
- \endgraf\penalty\z@\addvspace\LTpost
- \ifvoid\footins\else\insert\footins{}\fi}
-% \end{macrocode}
-%
-%
-%
-% \begin{macro}{\@@_patch_LT@t@bularcr}
-%
-% \begin{macrocode}
-\def\@@_patch_LT@t@bularcr{%
- \global\advance\LT@rows\@ne
- \ifnum\LT@rows=\LTchunksize
-% \end{macrocode}
-% At the end of the chunk \verb=\\= is doing something special and
-% so we loose \cs{@@_store_missing_cells:n}. Below is about the
-% right place to add it do this code branch.
-% \begin{macrocode}
- \@@_store_missing_cells:n{echunk}
- \gdef\LT@setprevdepth{%
- \prevdepth\z@
- \global\let\LT@setprevdepth\relax}%
- \expandafter\LT@xtabularcr
- \else
- \ifnum0=`{}\fi
- \expandafter\LT@LL@FM@cr
- \fi}
-
-% \end{macrocode}
-% \end{macro}
-%
%
%
-% \begin{macro}{\@@_patch_LT@end@hd@ft}
-% This command is used to store the head and foot boxes.
-% We need to retrieve and store the row so that we can clean
-% up the structure in the finalize code.
-% \begin{macrocode}
-\def\@@_patch_LT@end@hd@ft#1{%
-% \end{macrocode}
-% To handle missing columns in the header we need this:
-% \begin{macrocode}
- \__tbl_store_missing_cells:n{head/foot}
- \int_step_inline:nn
- { \LT@rows + 1 }
- {
- \seq_gput_left:ce
- {g_@@_\cs_to_str:N #1 _rows_seq }
- { \int_eval:n {\g_@@_row_int + 1 - ##1 } }
- }
-% \end{macrocode}
-% We also have to set the chunk rows to its max value before
-% calling \cs{LTechunk} so that we don't get extra increments of
-% the main row counter due to \cs{everycr}.
-% \begin{macrocode}
- \int_gset:Nn \LT@rows { \LTchunksize }
- \LT@echunk
- \ifx\LT@start\endgraf
- \LT@err
- {Longtable head or foot not at start of table}%
- {Increase LTchunksize}%
- \fi
- \setbox#1\box\z@
- \LT@get@widths
- \LT@bchunk}
-% \end{macrocode}
-% \end{macro}
-
-% \begin{macro}{\@@_patch_LT@start}
-% \begin{macrocode}
-\def\@@_patch_LT@start{%
- \let\LT@start\endgraf
- \endgraf\penalty\z@\vskip\LTpre\endgraf
- \ifdim \pagetotal<\pagegoal \else
- \dimen@=\pageshrink
- \advance \dimen@ 1sp %
- \kern\dimen@\penalty 9999\endgraf \kern-\dimen@
- \fi
- \dimen@\pagetotal
- \advance\dimen@ \ht\ifvoid\LT@firsthead\LT@head\else\LT@firsthead\fi
- \advance\dimen@ \dp\ifvoid\LT@firsthead\LT@head\else\LT@firsthead\fi
- \advance\dimen@ \ht\LT@foot
- \edef\LT@reset@vfuzz{\vfuzz\the\vfuzz\vbadness\the\vbadness\relax}%
- \vfuzz\maxdimen
- \vbadness\@M
- \setbox\tw@\copy\z@
- \setbox\tw@\vsplit\tw@ to \ht\@arstrutbox
- \setbox\tw@\vbox{\unvbox\tw@}%
- \LT@reset@vfuzz
- \advance\dimen@ \ht
- \ifdim\ht\@arstrutbox>\ht\tw@\@arstrutbox\else\tw@\fi
- \advance\dimen@\dp
- \ifdim\dp\@arstrutbox>\dp\tw@\@arstrutbox\else\tw@\fi
- \advance\dimen@ -\pagegoal
- \ifdim \dimen@>\z@
- \vfil\break
- \else
- \ifdim\pageshrink>\z@\pageshrink\z@\fi
- \fi
- \global\@colroom\@colht
- \ifvoid\LT@foot\else
- \global\advance\vsize-\ht\LT@foot
- \global\advance\@colroom-\ht\LT@foot
- \dimen@\pagegoal\advance\dimen@-\ht\LT@foot\pagegoal\dimen@
- \maxdepth\z@
- \fi
- \MakeLinkTarget{table}
- \ifvoid\LT@firsthead\copy\LT@head\else\box\LT@firsthead\fi\nobreak
-% \end{macrocode}
-% Avoid that following uses of the box add content:
-% \begin{macrocode}
- \tagmcbegin{artifact}
- \tag_mc_reset_box:N\LT@head
- \tagmcend
- \output{\LT@output}}
-% \end{macrocode}
-% \end{macro}
-%
%
-% \begin{macro}{\@@_patch_LT@output}
-% We must also avoid that the reuse of the foot box leads to
-% duplicated content:
-% \begin{macrocode}
-\def\@@_patch_LT@output{%
- \ifnum\outputpenalty <-\@Mi
- \ifnum\outputpenalty > -\LT@end@pen
- \LT@err{floats and marginpars not allowed in a longtable}\@ehc
- \else
- \setbox\z@\vbox{\unvbox\@cclv}%
- \ifdim \ht\LT@lastfoot>\ht\LT@foot
- \dimen@\pagegoal
- \advance\dimen@\ht\LT@foot
- \advance\dimen@-\ht\LT@lastfoot
- \ifdim\dimen@<\ht\z@
- \setbox\@cclv\vbox{\unvbox\z@\copy\LT@foot\vss}%
- \@makecol
- \@outputpage
- \global\vsize\@colroom
- \setbox\z@\vbox{\box\LT@head}%
- \fi
- \fi
- \unvbox\z@\box\ifvoid\LT@lastfoot\LT@foot\else\LT@lastfoot\fi
-% \end{macrocode}
-% Reset attribute of foot box:
-% \begin{macrocode}
- \tagmcbegin{artifact}
- \tag_mc_reset_box:N \LT@foot
- \tagmcend
- \fi
- \else
- \setbox\@cclv\vbox{\unvbox\@cclv\copy\LT@foot\vss}%
-% \end{macrocode}
-% Reset attribute of foot box:
-% \begin{macrocode}
- \tagmcbegin{artifact}
- \tag_mc_reset_box:N \LT@foot
- \tagmcend
- \@makecol
- \@outputpage
- \global\vsize\@colroom
- \copy\LT@head\nobreak
- \fi}
-% \end{macrocode}
-% \end{macro}
%
% \begin{macro}{\@@_patch_\LT@makecaption}
% This patch is quite similar to the one for LaTeX's \cs{@makecaption}
@@ -1893,74 +1195,11 @@
% \begin{macrocode}
\AddToHook{package/longtable/after}
{
- \seq_new:N \g_@@_LT@firsthead_rows_seq
- \seq_new:N \g_@@_LT@head_rows_seq
- \seq_new:N \g_@@_LT@lastfoot_rows_seq
- \seq_new:N \g_@@_LT@foot_rows_seq
- \cs_set_eq:NN \LT@array\@@_patch_LT@array
- \cs_set_eq:NN \endlongtable\@@_patch_endlongtable
- \cs_set_eq:NN \LT@start\@@_patch_LT@start
- \cs_set_eq:NN \LT@output\@@_patch_LT@output
- \cs_set_eq:NN \LT@t@bularcr\@@_patch_LT@t@bularcr
- \cs_set_eq:NN \LT@end@hd@ft\@@_patch_LT@end@hd@ft
\cs_set_eq:NN \LT@makecaption\@@_patch_LT@makecaption
}
% \end{macrocode}
-
-
-
-% \subsection{tabularx}
-%
-% In tabularx we mainly need to ensure that no tagging is done during
-% the trial.
-%
-% \begin{macrocode}
-\def\@@_patch_TX@endtabularx{%
- \expandafter\expandafter\expandafter
- \TX@find@endtabularxa\csname end\TX@\endcsname
- \endtabularx\TX@\endtabularx\TX@find@endtabularxa
- \expandafter\TX@newcol\expandafter{\tabularxcolumn{\TX@col@width}}%
- \let\verb\TX@verb
- \def\@elt##1{\global\value{##1}\the\value{##1}\relax}%
- \edef\TX@ckpt{\cl@@@@ckpt}%
- \let\@elt\relax
- \TX@old@table\maxdimen
- \TX@col@width\TX@target
- \global\TX@cols\@ne
- \TX@typeout@
- {\@spaces Table Width\@spaces Column Width\@spaces X Columns}%
-% \end{macrocode}
-% Here we stop tagging:
-% \begin{macrocode}
- \tag_stop:n{tabularx}
- \TX@trial{\def\NC@rewrite@X{%
- \global\advance\TX@cols\@ne\NC@find p{\TX@col@width}}}%
- \loop
- \TX@arith
- \ifTX@
- \TX@trial{}%
- \repeat
-% \end{macrocode}
-% And now we restart it again.
-% \begin{macrocode}
- \tag_start:n{tabularx}
- {\let\@footnotetext\TX@ftntext\let\@xfootnotenext\TX@xftntext
- \csname tabular*\expandafter\endcsname\expandafter\TX@target
- \the\toks@
- \csname endtabular*\endcsname}%
- \global\TX@ftn\expandafter{\expandafter}\the\TX@ftn
- \ifnum0=`{\fi}%
- \expandafter\expandafter\expandafter
- \TX@find@endtabularxbb
- \expandafter\end\expandafter{\TX@}%
- \endtabularx\TX@\endtabularx\TX@find@endtabularxb
-}
-
-\AddToHook{package/tabularx/after}
- {\cs_set_eq:NN \TX@endtabularx\@@_patch_TX@endtabularx }
-% \end{macrocode}
% \begin{macrocode}
%</package>
% \end{macrocode}
@@ -1973,3 +1212,11 @@
\RequirePackage{latex-lab-testphase-table}
%</latex-lab>
% \end{macrocode}
+
+% \begin{macrocode}
+%<*latex-lab-alias>
+\ProvidesFile{tabular-latex-lab-testphase.ltx}
+ [\ltlabtbldate\space v\ltlabtblversion\space latex-lab wrapper tabular]
+\RequirePackage{latex-lab-testphase-table}
+%</latex-lab-alias>
+% \end{macrocode}
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-table.pdf b/macros/latex-dev/required/latex-lab/latex-lab-table.pdf
index 997db2d1a7..a8c827c2e6 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-table.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-table.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-testphase.dtx b/macros/latex-dev/required/latex-lab/latex-lab-testphase.dtx
index b2ed5ecf8a..ca3afe896d 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-testphase.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-testphase.dtx
@@ -1,7 +1,7 @@
% \iffalse meta-comment
%
%% File: latex-lab-testphase.dtx
-% Copyright (C) 2021-2023 The LaTeX Project
+% Copyright (C) 2021-2024 The LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -79,7 +79,7 @@
% \begin{macrocode}
%<*phase-III>
\ProvidesFile{phase-III-latex-lab-testphase.ltx}
- [2023-07-20 v0.1b latex-lab wrapper phase-III]
+ [2024-02-12 v0.1c latex-lab wrapper phase-III]
\input{phase-II-latex-lab-testphase.ltx}
\IfFormatAtLeastTF{2023-06-01}
{
@@ -91,6 +91,7 @@
\RequirePackage{latex-lab-testphase-float}
\RequirePackage{latex-lab-testphase-bib}
\RequirePackage{latex-lab-testphase-text}
+ \RequirePackage{latex-lab-testphase-marginpar}
}
{\PackageWarning{latex-lab}{Testphase III needs newer format}{}}
%</phase-III>
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-testphase.pdf b/macros/latex-dev/required/latex-lab/latex-lab-testphase.pdf
index c65847a04f..e10f2c04f1 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-testphase.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-testphase.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-text.dtx b/macros/latex-dev/required/latex-lab/latex-lab-text.dtx
index 4041336ecb..fe9b6ababc 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-text.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-text.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: latex-lab-text.dtx (C) Copyright 2023 LaTeX Project
+%% File: latex-lab-text.dtx (C) Copyright 2023-2024 LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-text.pdf b/macros/latex-dev/required/latex-lab/latex-lab-text.pdf
index a4e26db75f..6847dff5a4 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-text.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-text.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-title.dtx b/macros/latex-dev/required/latex-lab/latex-lab-title.dtx
new file mode 100644
index 0000000000..757bb284a4
--- /dev/null
+++ b/macros/latex-dev/required/latex-lab/latex-lab-title.dtx
@@ -0,0 +1,518 @@
+% \iffalse meta-comment
+%
+%% File: latex-lab-title.dtx (C) Copyright 2023-2024 LaTeX Project
+%
+% It may be distributed and/or modified under the conditions of the
+% LaTeX Project Public License (LPPL), either version 1.3c of this
+% license or (at your option) any later version. The latest version
+% of this license is in the file
+%
+% https://www.latex-project.org/lppl.txt
+%
+%
+% The development version of the bundle can be found below
+%
+% https://github.com/latex3/latex2e/required/latex-lab
+%
+% for those people who are interested or want to report an issue.
+%
+\def\ltlabtitledate{2024-02-09}
+\def\ltlabtitleversion{0.85c}
+
+%<*driver>
+\documentclass{l3doc}
+\EnableCrossrefs
+\CodelineIndex
+\begin{document}
+ \DocInput{latex-lab-title.dtx}
+\end{document}
+%</driver>
+%
+% \fi
+%
+% \title{The \textsf{latex-lab-title} package\\
+% Changes related to the tagging of the title}
+% \author{\LaTeX{} Project\thanks{Initial implementation done by Ulrike Fischer}}
+% \date{v\ltlabtitleversion\ \ltlabtitledate}
+%
+% \maketitle
+%
+% \newcommand{\xt}[1]{\textsl{\textsf{#1}}}
+% \newcommand{\TODO}[1]{\textbf{[TODO:} #1\textbf{]}}
+% \newcommand{\docclass}{document class \marginpar{\raggedright document class
+% customizations}}
+%
+% \providecommand\hook[1]{\texttt{#1}}
+%
+% \begin{abstract}
+% \end{abstract}
+%
+% \section{Introduction}
+%
+% This module contains changes to improve the tagging (in the standard classes) of
+% the title created with the \cs{maketitle} command. It also improves the
+% setting of the metadata related to the title and the author.
+%
+% For basic tagging of the printed title there are basically three things to do:
+%
+% \begin{itemize}
+% \item The actual title should be tagged with the \texttt{Title} tag.
+% \item The tabular used to format the author list should \emph{not} be tagged as a tabular.
+% \item \cs{maketitle} redefines footnote internals. These must be made tagging aware.
+% \end{itemize}
+%
+% A second task related to title is to store the authors and the title text
+% (or a shorter version) inside the XMP-metadata and (in PDF 1.7 or lower) in
+% the Info dictionary. Currently this can only be set if hyperref
+% is loaded and requires the use of the \texttt{pdftitle} and \texttt{pdfauthor} keys.
+% The new code therefore extends the \cs{title} and \cs{author} commands: They
+% stores their argument and use them at the end of the document
+% for the PDF metadata if the data hasn't been given in another way.
+% The code also gives \cs{title} and \cs{author}
+% an optional argument where the PDF title or author can be given with
+% in a key-value syntax. As with hyperref it is possible to store titles
+% in more than one language:
+%
+% \begin{verbatim}
+% \title
+% [pdftitle =
+% {[en]English Title,[de] Deutscher Titel,[fr]{titre français, avec comma}}]
+% {Document title}
+% \end{verbatim}
+%
+% It is also possible to set a subtitle which is then stored in the XMP-metadata:
+%
+% \begin{verbatim}
+% \title
+% [pdfsubtitle =
+% {[en]English Subtitle,[de] Deutscher Subtitel,[fr]{subtitre français, avec comma}}]
+% {Document title}
+% \end{verbatim}
+
+%
+% If using the \texttt{pdfauthor} key authors should be separated
+% by commas, and to hide commas in a name inside braces if needed:
+%
+% \begin{verbatim}
+% \author[pdfauthor = {Bär, Peter Anteater, {Riley, the sloth}}]{\ldots}
+% \end{verbatim}
+%
+% If hyperref is loaded there is no difference to the \texttt{pdftitle} and
+% \texttt{pdfauthor} key used in \cs{hypersetup}. Both can be used (and the last
+% key used will win).
+%
+% \subsection{Open questions and TODOs}
+%
+% \begin{itemize}
+% \item Writing into the Info dictionary needs to convert the input into a PDF string.
+% This is here done with a simple version of hyperref's \cs{pdfstringdef}, similar code
+% exist also in in the generic hyperref driver. This should be moved into a better place
+% module.
+%
+% \item Is it sensible to enhance \cs{author} and \cs{title} with an optional argument as done here?
+% An advantage is that it is rather light-weight and
+% doesn't require to decide how this values should be set in \cs{DocumentMetadata} (and would also work
+% without \cs{DocumentMetadata}. But a problem could be that various classes and packages already
+% extend this commands with other optional arguments.
+%
+% \item Some of the definitions related to metadata should perhaps be moved into l3pdfmeta.
+%
+% \item Are the names \texttt{pdftitle} and \texttt{pdfauthor} ok?
+%
+% \item The patch for \cs{thanks} to get a rlap-footnotemarker looks wrong. This
+% probably means that some configuration option is missing in the footnote code.
+% \end{itemize}
+%
+%
+%
+% \section{Implementation}
+% \begin{macrocode}
+%<*package>
+%<@@=tag>
+% \end{macrocode}
+% \begin{macrocode}
+\ProvidesExplPackage {latex-lab-testphase-title} {\ltlabtitledate} {\ltlabtitleversion}
+ {Changes related to the tagging of the title}
+% \end{macrocode}
+%
+% \subsection{\cs{maketitle} in article class}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_thanks:n #1
+ {
+ \rlap{\footnotemark}
+ \protected@xdef\@thanks{\@thanks
+ \protect\footnotetext[\the\c@footnote]{#1}}
+ }
+% \end{macrocode}
+% The no-titlepage version of article, report and book
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_maketitle:
+ {
+ \par
+ \begingroup
+% \end{macrocode}
+% Disable table tagging
+% \begin{macrocode}
+ \cs_if_exist_use:N\__tag_tbl_disable:
+ \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
+% \end{macrocode}
+% the original definition redefines \cs{@makefnmark} and
+% \cs{@makefntext} to get an rlap-mark in the text without
+% affecting the mark in the note (which gives by the way
+% a wrong link area with hyperref). There seem to be currently
+% no good way in the footnote to configure this, so we redefine
+% \cs{thanks} instead
+% \begin{macrocode}
+ \cs_set_eq:NN \thanks \@@_patch_thanks:n
+ \if@twocolumn
+ \ifnum \col@number=\@ne
+ \@maketitle
+ \else
+ \twocolumn[\@maketitle]%
+ \fi
+ \else
+ \newpage
+ \global\@topnum\z@ % Prevents figures from going at top of page.
+ \@maketitle
+ \fi
+ \thispagestyle{plain}\@thanks
+ \endgroup
+ \setcounter{footnote}{0}%
+ \global\let\thanks\relax
+ \global\let\maketitle\relax
+ \global\let\@maketitle\relax
+ \global\let\@thanks\@empty
+ \global\let\@author\@empty
+ \global\let\@date\@empty
+ \global\let\@title\@empty
+ \global\let\title\relax
+ \global\let\author\relax
+ \global\let\date\relax
+ \global\let\and\relax
+ }
+% \end{macrocode}
+% We must also change \cs{@maketitle} to insert a Title tag
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_@maketitle:
+ {
+ \newpage
+ \null
+ \vskip 2em%
+ \begin{center}%
+ \let \footnote \thanks
+% \end{macrocode}
+% use Title around the title. As in PDF 1.7 this is
+% rolemapped to P we change the text-unit tag there.
+% \begin{macrocode}
+ \pdf_version_compare:NnTF > {1.7}
+ {{\LARGE \tag_struct_begin:n{tag=Title}\@title \par\tag_struct_end:}}
+ {{\LARGE \tagtool{paratag=Title}\@title \par}}%
+ \vskip 1.5em%
+ {\large
+ \lineskip .5em%
+ \begin{tabular}[t]{c}%
+ \@author
+ \end{tabular}\par}%
+ \vskip 1em%
+ {\large \@date}%
+ \end{center}%
+ \par
+ \vskip 1.5em
+ }
+
+% \end{macrocode}
+% The titlepage variant
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_maketitle_page:
+ {\begin{titlepage}%
+% \end{macrocode}
+% disable table tagging
+% \begin{macrocode}
+ \cs_if_exist_use:N\__tag_tbl_disable:
+ \let\footnotesize\small
+ \let\footnoterule\relax
+ \let \footnote \thanks
+ \null\vfil
+ \vskip 60\p@
+% \end{macrocode}
+% use Title around the title. As in PDF 1.7 this is
+% rolemapped to P we change the text-unit tag there.
+% \begin{macrocode}
+ \begin{center}%
+ \pdf_version_compare:NnTF > {1.7}
+ {{\LARGE \tag_struct_begin:n{tag=Title}\@title \par\tag_struct_end:}}
+ {{\LARGE \tagtool{paratag=Title}\@title \par}}%
+ \vskip 3em%
+ {\large
+ \lineskip .75em%
+ \begin{tabular}[t]{c}%
+ \@author
+ \end{tabular}\par}%
+ \vskip 1.5em%
+ {\large \@date \par}% % Set date in \large size.
+ \end{center}\par
+ \@thanks
+ \vfil\null
+ \end{titlepage}%
+ \setcounter{footnote}{0}%
+ \global\let\thanks\relax
+ \global\let\maketitle\relax
+ \global\let\@thanks\@empty
+ \global\let\@author\@empty
+ \global\let\@date\@empty
+ \global\let\@title\@empty
+ \global\let\title\relax
+ \global\let\author\relax
+ \global\let\date\relax
+ \global\let\and\relax
+ }
+
+% \end{macrocode}
+% Map the new commands onto \cs{maketitle}:
+% \begin{macrocode}
+\AddToHook{class/article/after}
+ {
+ \if@titlepage
+ \cs_set_eq:NN \maketitle \@@_patch_maketitle_page:
+ \else
+ \cs_set_eq:NN \maketitle \@@_patch_maketitle:
+ \cs_set_eq:NN \@maketitle \@@_patch_@maketitle:
+ \fi
+ }
+\AddToHook{class/report/after}
+ {
+ \if@titlepage
+ \cs_set_eq:NN \maketitle \@@_patch_maketitle_page:
+ \else
+ \cs_set_eq:NN \maketitle \@@_patch_maketitle:
+ \cs_set_eq:NN \@maketitle \@@_patch_@maketitle:
+ \fi
+ }
+\AddToHook{class/book/after}
+ {
+ \if@titlepage
+ \cs_set_eq:NN \maketitle \@@_patch_maketitle_page:
+ \else
+ \cs_set_eq:NN \maketitle \@@_patch_maketitle:
+ \cs_set_eq:NN \@maketitle \@@_patch_@maketitle:
+ \fi
+ }
+% \end{macrocode}
+%
+% \subsection{Helper commands to set metadata}
+%
+% Some temp variables
+% \begin{macrocode}
+\str_new:N \g_@@_title_tmpa_str
+\str_new:N \l_@@_title_tmpa_str
+\tl_new:N \l_@@_title_tmpa_tl
+\seq_new:N \l_@@_title_tmpa_seq
+% \end{macrocode}
+% Support for \cs{texorpdfstring}
+% \begin{macrocode}
+\providecommand\texorpdfstring[2]{#1}%
+% \end{macrocode}
+%
+% A helper command to convert the title into a pdfstring similar to
+% \cs{pdfstringdef}.
+% As we use \cs{text_purify} we must ensure that the default definitions
+% of \cs{@title} and \cs{@author} are robust:
+% \begin{macrocode}
+\protected\def\@title{\@latex@error{No \noexpand\title given}\@ehc}
+\protected\def\@author{\@latex@warning@no@line{No \noexpand\author given}}
+% \end{macrocode}
+% TODO: This should be improved and moved into the pdf module so that
+% it is generally available.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_title_pdfstring:nnN #1 #2 #3 % #1 text, #2 e.g. utf16/hex
+ {
+ \group_begin:
+% \end{macrocode}
+% TODO: we need probably a common boolean to handle
+% \cs{texorpdfstring} also without hyperref.
+% \begin{macrocode}
+ \cs_set_eq:NN\texorpdfstring\use_ii:nn
+ \str_set:Ne \l_@@_title_tmpa_str {\text_purify:n { #1 } }
+ \pdf_string_from_unicode:nVN { #2 } \l_@@_title_tmpa_str \l_@@_title_tmpa_str
+ \str_gset_eq:NN \g_@@_title_tmpa_str\l_@@_title_tmpa_str
+ \group_end:
+ \str_set_eq:NN #3 \g_@@_title_tmpa_str
+ }
+\cs_generate_variant:Nn\@@_title_pdfstring:nnN {e}
+% \end{macrocode}
+
+% \subsection{Extend title to set metadata}
+% At first a variable to store the title, as \cs{@title} is emptied by \LaTeX.
+% \begin{macrocode}
+\tl_new:N \g_@@_title_title_tl
+% \end{macrocode}
+% Now we redefine \cs{title} so that it stores the title, and processes
+% keys in the optional argument. We use \texttt{hyp} as module
+% name for the key as this means that if hyperref is loaded its definition
+% of \texttt{pdftitle} will be used -- at some time probably this
+% should be moved out of hyperref so that we have only one definition.
+%
+% \begin{macrocode}
+\RenewDocumentCommand\title{O{}m}
+ {
+ \gdef\@title{#2}
+ \tl_gset_eq:NN\g_@@_title_title_tl\@title
+ \keys_set:nn {hyp}{#1}
+ }
+% \end{macrocode}
+% Now we define the \texttt{pdftitle} key. This is more or less
+% the same definition as in the generic hyperref driver.
+% \begin{macrocode}
+\regex_new:N\l_@@_title_optlang_regex
+\regex_set:Nn\l_@@_title_optlang_regex {\A\[([A-Za-z\-]+)\](.*)}
+\cs_generate_variant:Nn \regex_extract_once:NnN{NVN}
+\cs_generate_variant:Nn \clist_item:nn {on}
+% \end{macrocode}
+% and now the keys.
+% \begin{macrocode}
+\keys_define:nn { hyp }
+ {
+ pdftitle .code:n =
+ {
+ \tl_if_blank:nTF {#1}
+ {
+ \pdfmanagement_remove:nn {Info}{Title}
+ }
+ {
+ \tl_set:Ne\l_@@_title_tmpa_tl {\clist_item:on{#1}{1}}
+ \regex_extract_once:NVN
+ \l_@@_title_optlang_regex
+ \l_@@_title_tmpa_tl
+ \l_@@_title_tmpa_seq
+ \seq_if_empty:NTF\l_@@_title_tmpa_seq
+ {
+ \@@_title_pdfstring:nnN {#1}{utf16/hex}\l_@@_title_tmpa_str
+ }
+ {
+ \@@_title_pdfstring:enN
+ {\seq_item:Nn \l_@@_title_tmpa_seq{3}}{utf16/hex}\l_@@_title_tmpa_str
+ }
+ \str_if_eq:VnF\l_@@_title_tmpa_str{<FEFF>}
+ {
+ \pdfmanagement_add:nne {Info}{Title}{\l_@@_title_tmpa_str}
+ }
+ }
+ \AddToDocumentProperties[hyperref]{pdftitle}{#1}
+ }
+ ,pdfsubtitle .code:n = { \AddToDocumentProperties[hyperref]{pdfsubtitle}{#1} }
+ }
+% \end{macrocode}
+%
+% \subsection{Extend \cs{author} to set metadata}
+%
+% At first a variable to store the authors, as \cs{@author} is emptied by \LaTeX.
+% \begin{macrocode}
+\tl_new:N \g_@@_title_author_tl
+% \end{macrocode}
+% Now we redefine \cs{author} so that it stores the authors, and processes
+% keys in the optional argument. We use \texttt{hyp} as module
+% name for the key as this means that if hyperref is loaded its definition
+% of \texttt{pdfauthor} will be used -- at some time probably this
+% should be moved out of hyperref so that we have only one definition.
+%
+% \begin{macrocode}
+\RenewDocumentCommand\author{O{}m}
+ {
+ \gdef\@author{#2}
+ \tl_gset_eq:NN\g_@@_title_author_tl\@author
+ \keys_set:nn {hyp}{#1}
+ }
+% \end{macrocode}
+%
+% Now we define the \texttt{pdfauthor} key. This is more or less
+% the same definition as in the generic hyperref driver.
+
+% \begin{macrocode}
+\keys_define:nn { hyp }
+ {
+ pdfauthor .code:n =
+ {
+ \tl_if_blank:nTF {#1}
+ {
+ \pdfmanagement_remove:nn {Info}{Author}
+ }
+ {
+ \tl_set:Ne\l_@@_title_tmpa_tl {\clist_item:on{#1}{1}}
+ \regex_extract_once:NVN
+ \l_@@_title_optlang_regex
+ \l_@@_title_tmpa_tl
+ \l_@@_title_tmpa_seq
+ \seq_if_empty:NTF\l_@@_title_tmpa_seq
+ {
+ \@@_title_pdfstring:nnN {#1}{utf16/hex}\l_@@_title_tmpa_str
+ }
+ {
+ \@@_title_pdfstring:enN
+ {\seq_item:Nn \l_@@_title_tmpa_seq{3}}{utf16/hex}\l_@@_title_tmpa_str
+ }
+ \str_if_eq:VnF\l_@@_title_tmpa_str{<FEFF>}
+ {
+ \pdfmanagement_add:nne {Info}{Author}{\l_@@_title_tmpa_str}
+ }
+ }
+ \AddToDocumentProperties[hyperref]{pdfauthor}{#1}
+ }
+ }
+% \end{macrocode}
+% \subsection{Fallback for classes and packages that redefine \cs{title} or \cs{author}}
+% If a class redefines \cs{author} and \cs{title} again, we try to retrieve at
+% least the values.
+% \begin{macrocode}
+\AddToHook{cmd/maketitle/before}
+ {
+ \tl_gset_eq:NN \g_@@_title_author_tl\@author
+ \tl_gset_eq:NN \g_@@_title_title_tl\@title
+ }
+% \end{macrocode}
+%
+% \subsection{Finalize document}
+% At last we set the title and the author at the end of document
+% if that hasn't happened yet:
+% \begin{macrocode}
+\AddToHook{shipout/lastpage}
+ {
+ \tl_if_empty:eT{\GetDocumentProperties{hyperref/pdftitle}}
+ {
+ \group_begin:
+ \cs_set_eq:NN\thanks \use_none:n
+ \str_set:Ne \l_@@_title_tmpa_str {\text_purify:n { \g_@@_title_title_tl } }
+ \keys_set:ne{hyp}{pdftitle={\exp_not:V\l_@@_title_tmpa_str}}
+ \group_end:
+ }
+ \tl_if_empty:eT{\GetDocumentProperties{hyperref/pdfauthor}}
+ {
+ \group_begin:
+ \cs_set_eq:NN\thanks \use_none:n
+ \cs_set:Npn \and {,}
+ \str_set:Ne \l_@@_title_tmpa_str {\text_purify:n { \g_@@_title_author_tl } }
+ \keys_set:ne{hyp}{pdfauthor={\exp_not:V\l_@@_title_tmpa_str}}
+ \group_end:
+ }
+% \end{macrocode}
+% force display title, if an UA-standard is detected.
+% \begin{macrocode}
+ \tl_if_empty:eF{\GetDocumentProperties{document/pdfstandard-UA}}
+ {
+ \pdfmanagement_add:nnn {Catalog / ViewerPreferences } { DisplayDocTitle } { true }
+ }
+ }
+\DeclareHookRule{shipout/lastpage}{latex-lab-testphase-title}{before}{pdfmanagement-testphase}
+%</package>
+% \end{macrocode}
+
+% \begin{macrocode}
+%<*latex-lab>
+\ProvidesFile{title-latex-lab-testphase.ltx}
+ [\ltlabtitledate\space v\ltlabtitleversion\space
+ Changes related to the tagging of the title]
+
+\RequirePackage{latex-lab-testphase-title}
+
+%</latex-lab>
+% \end{macrocode}
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-title.pdf b/macros/latex-dev/required/latex-lab/latex-lab-title.pdf
new file mode 100644
index 0000000000..2e60580ba6
--- /dev/null
+++ b/macros/latex-dev/required/latex-lab/latex-lab-title.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-toc-hyperref-changes.dtx b/macros/latex-dev/required/latex-lab/latex-lab-toc-hyperref-changes.dtx
index 2f00b83c05..ff9dd950b7 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-toc-hyperref-changes.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-toc-hyperref-changes.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: latex-lab-toc-hyperref-changes.dtx (C) Copyright 2022-2023 LaTeX Project
+%% File: latex-lab-toc-hyperref-changes.dtx (C) Copyright 2022-2024 LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-toc-hyperref-changes.pdf b/macros/latex-dev/required/latex-lab/latex-lab-toc-hyperref-changes.pdf
index 161e96f338..6fdcf836af 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-toc-hyperref-changes.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-toc-hyperref-changes.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-toc-kernel-changes.dtx b/macros/latex-dev/required/latex-lab/latex-lab-toc-kernel-changes.dtx
index 81c9edfe4d..bb88ffdcb0 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-toc-kernel-changes.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-toc-kernel-changes.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: latex-lab-toc-kernel-changes.dtx (C) Copyright 2022-2023 LaTeX Project
+%% File: latex-lab-toc-kernel-changes.dtx (C) Copyright 2022-2024 LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -17,8 +17,8 @@
% for those people who are interested or want to report an issue.
%
% dates for latex-lab-kernel-changes.sty (pulled from various sources, see ins)
-\def\ltlabkerneldate{2023-10-16}
-\def\ltlabkernelversion{0.85b}
+\def\ltlabkerneldate{2024-02-12}
+\def\ltlabkernelversion{0.85c}
%<*driver>
\documentclass{l3doc}
\EnableCrossrefs
@@ -235,7 +235,7 @@
\makeatletter
\@starttoc@cfgpoint@before{#1}%
\@input{\jobname.#1}%
- \@starttoc@cfgpoint@after{#1}
+ \@starttoc@cfgpoint@after{#1}%
\if@filesw
\expandafter\newwrite\csname tf@#1\endcsname
\immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-toc-kernel-changes.pdf b/macros/latex-dev/required/latex-lab/latex-lab-toc-kernel-changes.pdf
index 0a78ca15d9..de2dd29b50 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-toc-kernel-changes.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-toc-kernel-changes.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-toc.dtx b/macros/latex-dev/required/latex-lab/latex-lab-toc.dtx
index 6def505e11..7235eb9ed9 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-toc.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-toc.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: latex-lab-toc.dtx (C) Copyright 2022-2023 LaTeX Project
+%% File: latex-lab-toc.dtx (C) Copyright 2022-2024 LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -271,7 +271,7 @@
{ \int_compare_p:nNn { \g_@@_toc_level_int } > {-100} }
{ \int_compare_p:nNn { \use:c{toclevel@#1} } > { \g_@@_toc_level_int } }
{
- \seq_gpush:Nx \g_@@_toc_stack_seq {{TOC}\use:c{toclevel@#1}}
+ \seq_gpush:Ne \g_@@_toc_stack_seq {{TOC}\use:c{toclevel@#1}}
\tag_struct_begin:n{tag=TOC}
}
% \end{macrocode}
@@ -298,7 +298,7 @@
% \begin{macrocode}
\group_begin:
\text_declare_expand_equivalent:Nn \numberline \use_none:n
- \exp_args:Nx \tag_struct_begin:n{tag=TOCI,title={\text_purify:n {#2}}}
+ \exp_args:Ne \tag_struct_begin:n{tag=TOCI,title={\text_purify:n {#2}}}
% \end{macrocode}
% The TOCI structure should get a /Ref, so we put a request with its destination
% name into the prop.
@@ -307,9 +307,9 @@
% need to store fake names.
% \end{NOTE}
% \begin{macrocode}
- \prop_gput:Nxx \g_@@_struct_ref_by_dest_prop
+ \prop_gput:Nee \g_@@_struct_ref_by_dest_prop
{ \tag_get:n {struct_num} }{#3}
- \seq_gpush:Nx \g_@@_toc_stack_seq {{TOCI}\use:c{toclevel@#1}}
+ \seq_gpush:Ne \g_@@_toc_stack_seq {{TOCI}\use:c{toclevel@#1}}
\group_end:
}
}
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-toc.pdf b/macros/latex-dev/required/latex-lab/latex-lab-toc.pdf
index eafeeec42e..38122e3322 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-toc.pdf
+++ b/macros/latex-dev/required/latex-lab/latex-lab-toc.pdf
Binary files differ
diff --git a/macros/latex-dev/required/latex-lab/latex-lab.ins b/macros/latex-dev/required/latex-lab/latex-lab.ins
index 548f18a6fa..7071ed6e3d 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab.ins
+++ b/macros/latex-dev/required/latex-lab/latex-lab.ins
@@ -154,8 +154,16 @@ where one can also log issues in case there are any.
%table
\generate{\file{table-latex-lab-testphase.ltx}{\from{latex-lab-table.dtx}{latex-lab}}}
+\generate{\file{tabular-latex-lab-testphase.ltx}{\from{latex-lab-table.dtx}{latex-lab-alias}}}
\generate{\file{latex-lab-testphase-table.sty}{\from{latex-lab-table.dtx}{package}}}
+%title
+\generate{\file{title-latex-lab-testphase.ltx}{\from{latex-lab-title.dtx}{latex-lab}}}
+\generate{\file{latex-lab-testphase-title.sty}{\from{latex-lab-title.dtx}{package}}}
+
+%marginpar
+\generate{\file{marginpar-latex-lab-testphase.ltx}{\from{latex-lab-marginpar.dtx}{latex-lab}}}
+\generate{\file{latex-lab-testphase-marginpar.sty}{\from{latex-lab-marginpar.dtx}{package}}}
% stop docstrip adding \endinput
\preamble
diff --git a/macros/latex-dev/required/tools/README.md b/macros/latex-dev/required/tools/README.md
index c87b522b3c..8c55bf3449 100644
--- a/macros/latex-dev/required/tools/README.md
+++ b/macros/latex-dev/required/tools/README.md
@@ -1,7 +1,7 @@
The LaTeX `tools` bundle
========================
-Release 2024-06-01 pre-release 0
+Release 2024-06-01 pre-release 1
Overview
--------
diff --git a/macros/latex-dev/required/tools/afterpage.dtx b/macros/latex-dev/required/tools/afterpage.dtx
index 518b70761d..72df39402c 100644
--- a/macros/latex-dev/required/tools/afterpage.dtx
+++ b/macros/latex-dev/required/tools/afterpage.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
diff --git a/macros/latex-dev/required/tools/afterpage.ins b/macros/latex-dev/required/tools/afterpage.ins
index 6fec5edc6f..17792ddfa1 100644
--- a/macros/latex-dev/required/tools/afterpage.ins
+++ b/macros/latex-dev/required/tools/afterpage.ins
@@ -3,7 +3,7 @@
%% driver files from the doc files in this package when run through
%% LaTeX or TeX.
%%
-%% Copyright (C) 1993-2023
+%% Copyright (C) 1993-2024
%% The LaTeX Project and any individual authors listed elsewhere
%% in this file.
%%
@@ -45,7 +45,7 @@ The source is maintained by the LaTeX Project team and bug
reports for it can be opened at https://latex-project.org/bugs/
(but please observe conditions on bug reports sent to that address!)
-Copyright (C) 1993-2023
+Copyright (C) 1993-2024
The LaTeX Project and any individual authors listed elsewhere
in this file.
diff --git a/macros/latex-dev/required/tools/afterpage.pdf b/macros/latex-dev/required/tools/afterpage.pdf
index 1e62bd8f2b..a6f340967f 100644
--- a/macros/latex-dev/required/tools/afterpage.pdf
+++ b/macros/latex-dev/required/tools/afterpage.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/array-2023-11-01.sty b/macros/latex-dev/required/tools/array-2023-11-01.sty
new file mode 100644
index 0000000000..cd6eee6a0f
--- /dev/null
+++ b/macros/latex-dev/required/tools/array-2023-11-01.sty
@@ -0,0 +1,375 @@
+%%
+%% This is file `array.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% array.dtx (with options: `package,ncols')
+%%
+%% This is a generated file.
+%%
+%% The source is maintained by the LaTeX Project team and bug
+%% reports for it can be opened at https://latex-project.org/bugs/
+%% (but please observe conditions on bug reports sent to that address!)
+%%
+%%
+%% Copyright (C) 1993-2023
+%% The LaTeX Project and any individual authors listed elsewhere
+%% in this file.
+%%
+%% This file was generated from file(s) of the Standard LaTeX `Tools Bundle'.
+%% --------------------------------------------------------------------------
+%%
+%% It may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% https://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This file may only be distributed together with a copy of the LaTeX
+%% `Tools Bundle'. You may however distribute the LaTeX `Tools Bundle'
+%% without such generated files.
+%%
+%% The list of all files belonging to the LaTeX `Tools Bundle' is
+%% given in the file `manifest.txt'.
+%%
+%% Package `array' to use with LaTeX 2e
+%% Copyright (C) 1989-1998 Frank Mittelbach, all rights reserved.
+\NeedsTeXFormat{LaTeX2e}[1995/06/01]
+\providecommand\DeclareRelease[3]{}
+\providecommand\DeclareCurrentRelease[2]{}
+
+\DeclareRelease{}{2016-10-06}{array-2016-10-06.sty}
+\DeclareRelease{v2.4}{2020-02-10}{array-2020-02-10.sty}
+\DeclareCurrentRelease{}{2020-10-01}
+
+\ProvidesPackage{array}
+ [2023/10/16 v2.5g Tabular extension package (FMi)]
+%%
+
+\def\@addtopreamble#1{\xdef\@preamble{\@preamble #1}}
+\def\@testpach{\@chclass
+ \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else
+ \ifnum \@lastchclass=7 5 \else
+ \ifnum \@lastchclass=8 \tw@ \else
+ \ifnum \@lastchclass=9 \thr@@
+ \else \z@
+ \ifnum \@lastchclass = 10 \else
+ \edef\@nextchar{\expandafter\string\@nextchar}%
+ \@chnum
+ \if \@nextchar c\z@ \else
+ \if \@nextchar l\@ne \else
+ \if \@nextchar r\tw@ \else
+ \z@ \@chclass
+ \if\@nextchar |\@ne \else
+ \if \@nextchar !6 \else
+ \if \@nextchar @7 \else
+ \if \@nextchar <8 \else
+ \if \@nextchar >9 \else
+ 10
+ \@chnum
+ \if \@nextchar m\thr@@\else
+ \if \@nextchar p4 \else
+ \if \@nextchar b5 \else
+ \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi
+ \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi}
+\def\@xexpast#1*#2#3#4\@@{%
+ \@tempcnta #2
+ \toks@={#1}\@temptokena={#3}%
+ \let\the@toksz\relax \let\the@toks\relax
+ \def\@tempa{\the@toksz}%
+ \ifnum\@tempcnta >0 \@whilenum\@tempcnta >0\do
+ {\edef\@tempa{\@tempa\the@toks}\advance \@tempcnta \m@ne}%
+ \let \@tempb \@xexpast \else
+ \let \@tempb \@xexnoop \fi
+ \def\the@toksz{\the\toks@}\def\the@toks{\the\@temptokena}%
+ \edef\@tempa{\@tempa}%
+ \expandafter \@tempb \@tempa #4\@@}
+\def\prepnext@tok{\advance \count@ \@ne
+ \toks\count@{}}
+\def\save@decl{\toks\count@ \expandafter{\@nextchar}}
+\def\insert@column{%
+ \the@toks \the \@tempcnta
+ \ignorespaces \@sharp \unskip
+ \the@toks \the \count@ \relax}
+\newdimen\col@sep
+\def\@acol{\@addtopreamble{\hskip\col@sep}}
+\def\@classx{%
+ \ifcase \@lastchclass
+ \@acolampacol \or
+ \@addamp \@acol \or
+ \@acolampacol \or
+ \or
+ \@acol \@firstampfalse \or
+ \@addamp
+ \fi}
+\def\@classz{\@classx
+ \@tempcnta \count@
+ \prepnext@tok
+ \@addtopreamble{\ifcase \@chnum
+ \hfil
+ \hskip1sp%
+ \d@llarbegin
+ \insert@column
+ \d@llarend \do@row@strut \hfil \or
+ \hskip1sp\d@llarbegin \insert@column \d@llarend \do@row@strut \hfil \or
+ \hfil\hskip1sp\d@llarbegin \insert@column \d@llarend \do@row@strut \or
+ \setbox\ar@mcellbox\vbox
+ \@startpbox{\@nextchar}\insert@column \@endpbox
+ \ar@align@mcell
+ \do@row@strut \or
+ \vtop \@startpbox{\@nextchar}\insert@column \@endpbox\do@row@strut \or
+ \vbox \@startpbox{\@nextchar}\insert@column \@endpbox\do@row@strut
+ \fi}\prepnext@tok}
+
+\newbox\ar@mcellbox
+\def\ar@align@mcell{%
+ \ifdim \ht\ar@mcellbox > \ht\strutbox
+ \begingroup
+ \dimen@\ht\ar@mcellbox
+ \advance\dimen@-\ht\@arstrutbox
+ \advance\dimen@\baselineskip
+ \lower.5\dimen@\box\ar@mcellbox
+ \endgroup
+ \else % assume one line and align at baseline
+ \box\ar@mcellbox
+ \fi}
+
+\def\@arrayrule{\@addtopreamble \vline}
+\def\@classvii{\ifnum \@lastchclass = \thr@@
+ \@preamerr \thr@@ \fi}
+\def\@classvi{\ifcase \@lastchclass
+ \@acol \or
+ \@addtopreamble{\hskip \doublerulesep}\or
+ \@acol \or
+ \@classvii
+ \fi}
+\def\@classii{\advance \count@ \m@ne
+ \save@decl\prepnext@tok}
+\def\@classi{\@classvi
+ \ifcase \@chnum \@arrayrule \or
+ \@classv \fi}
+\def\@startpbox#1{\bgroup
+ \color@begingroup
+ \setlength\hsize{#1}\@arrayparboxrestore
+ \everypar{%
+ \vrule \@height \ht\@arstrutbox \@width \z@
+ \everypar{}}%
+ }
+\def\@endpbox{\@finalstrut\@arstrutbox \par \color@endgroup \egroup\hfil}
+\def\@array[#1]#2{%
+ \@tempdima \ht \strutbox
+ \advance \@tempdima by\extrarowheight
+ \setbox \@arstrutbox \hbox{\vrule
+ \@height \arraystretch \@tempdima
+ \@depth \arraystretch \dp \strutbox
+ \@width \z@}%
+ \begingroup
+ \@mkpream{#2}%
+ \xdef\@preamble{\noexpand \ialign \@halignto
+ \bgroup \@arstrut \@preamble
+ \tabskip \z@ \cr}%
+ \endgroup
+ \@arrayleft
+ \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi \fi
+ \bgroup
+ \let \@sharp ##\let \protect \relax
+ \lineskip \z@
+ \baselineskip \z@
+ \m@th
+ \let\\\@arraycr \let\tabularnewline\\\let\par\@empty \@preamble}
+\def\arraybackslash{\let\\\tabularnewline}
+\newdimen \extrarowheight
+\extrarowheight=0pt
+\def\@arstrut{\unhcopy\@arstrutbox}
+\protected\def\@arraycr{\relax\iffalse{\fi\ifnum 0=`}\fi
+ \@ifstar \@xarraycr \@xarraycr}
+\def\@xarraycr{\@ifnextchar [%
+ \@argarraycr {\ifnum 0=`{}\fi\cr}}
+\def\@argarraycr[#1]{\ifnum0=`{}\fi\ifdim #1>\z@
+ \expandafter\@xargarraycr\else
+ \expandafter\@yargarraycr\fi{#1}}
+\def\@xargarraycr#1{\unskip\gdef\do@row@strut
+ {\@tempdima #1\advance\@tempdima \dp\@arstrutbox
+ \vrule \@depth\@tempdima \@width\z@\global\let\do@row@strut\relax}%
+ \ifnum\@multicnt >\z@ \do@row@strut \fi
+ \cr}
+\let\do@row@strut\relax
+\long\def\multicolumn#1#2#3{%
+ \multispan{#1}\begingroup
+ \def\@addamp{\if@firstamp \@firstampfalse \else
+ \@preamerr 5\fi}%
+ \@mkpream{#2}\@addtopreamble\@empty
+ \endgroup
+ \def\@sharp{#3}%
+ \@arstrut \@preamble
+ \null
+ \ignorespaces}
+\let\d@llarbegin\begingroup
+\let\d@llarend\endgroup
+\def\array{\col@sep\arraycolsep
+ \def\d@llarbegin{$}\let\d@llarend\d@llarbegin\def\@halignto{}%
+ \@tabarray}
+\def\tabular{\def\@halignto{}\@tabular}
+\expandafter\def\csname tabular*\endcsname#1{%
+ \setlength\dimen@{#1}%
+ \edef\@halignto{to\the\dimen@}\@tabular}
+\def\@tabular{%
+ \leavevmode
+ \hbox \bgroup $\col@sep\tabcolsep \let\d@llarbegin\begingroup
+ \let\d@llarend\endgroup
+ \@tabarray}
+\def\endtabular{\endarray\m@th $\egroup}
+\expandafter\let\csname endtabular*\endcsname=\endtabular
+\let\@ampacol=\relax \let\@expast=\relax
+\let\@arrayclassiv=\relax \let\@arrayclassz=\relax
+\let\@tabclassiv=\relax \let\@tabclassz=\relax
+\let\@arrayacol=\relax \let\@tabacol=\relax
+\let\@tabularcr=\relax \let\@@endpbox=\relax
+\let\@argtabularcr=\relax \let\@xtabularcr=\relax
+\def\@preamerr#1{\def\@tempd{{..} at wrong position: }%
+ \PackageError{array}{%
+ \ifcase #1 Illegal pream-token (\@nextchar): `c' used\or %0
+ Missing arg: token ignored\or %1
+ Empty preamble: `l' used\or %2
+ >\@tempd token ignored\or %3
+ <\@tempd changed to !{..}\or %4
+ Only one column-spec. allowed.\fi}\@ehc} %5
+\def\newcolumntype#1{%
+ \edef\NC@char{\string#1}%
+ \@ifundefined{NC@find@\NC@char}%
+ {\@tfor\next:=<>clrmbp@!|\do
+ {%
+ \if\expandafter\noexpand\next\NC@char
+ \PackageWarning{array}%
+ {Redefining primitive column \NC@char}\fi}%
+ \NC@list\expandafter{\the\NC@list\NC@do#1}}%
+ {\PackageWarning{array}{Column \NC@char\space is already defined}}%
+ \@namedef{NC@find@\NC@char}##1#1{\NC@{##1}}%
+ \@ifnextchar[{\newcol@{\NC@char}}{\newcol@{\NC@char}[0]}}
+\def\newcol@#1[#2]#3{\expandafter\@reargdef
+ \csname NC@rewrite@#1\endcsname[#2]{\NC@find#3}}
+\def\NC@#1{%
+ \@temptokena\expandafter{\the\@temptokena#1}\futurelet\next\NC@ifend}
+\def\NC@ifend{%
+ \ifx\next\relax
+ \else\@tempswatrue\expandafter\NC@rewrite\fi}
+\def\NC@do#1{%
+ \expandafter\let\expandafter\NC@rewrite
+ \csname NC@rewrite@\string#1\endcsname
+ \expandafter\let\expandafter\NC@find
+ \csname NC@find@\string#1\endcsname
+ \expandafter\@temptokena\expandafter{\expandafter}%
+ \expandafter\NC@find\the\@temptokena#1\relax}
+\def\showcols{{\def\NC@do##1{\let\NC@do\NC@show}\the\NC@list}}
+\def\NC@show#1{%
+ \typeout{Column #1\expandafter\expandafter\expandafter\NC@strip
+ \expandafter\meaning\csname NC@rewrite@#1\endcsname\@@}}
+\def\NC@strip#1:#2->#3 #4\@@{#2 -> #4}
+\newtoks\NC@list
+\newcolumntype{*}[2]{}
+\long\@namedef{NC@rewrite@*}#1#2{%
+ \count@#1\relax
+ \loop
+ \ifnum\count@>\z@
+ \advance\count@\m@ne
+ \@temptokena\expandafter{\the\@temptokena#2}%
+ \repeat
+ \NC@find}
+\let\@xexpast\relax
+\let\@xexnoop\relax
+\def\save@decl{\toks \count@ = \expandafter\expandafter\expandafter
+ {\expandafter\@nextchar\the\toks\count@}}
+\def\@mkpream#1{\gdef\@preamble{}\@lastchclass 4 \@firstamptrue
+ \let\@sharp\relax
+ \def\@startpbox##1{\unexpanded\expandafter{\expandafter
+ \@startpbox\expandafter{##1}}}\let\@endpbox\relax
+ \let\do@row@strut\relax
+ \let\ar@align@mcell\relax
+ \@temptokena{#1}\@tempswatrue
+ \@whilesw\if@tempswa\fi{\@tempswafalse\the\NC@list}%
+ \count@\m@ne
+ \let\the@toks\relax
+ \prepnext@tok
+ \expandafter \@tfor \expandafter \@nextchar
+ \expandafter :\expandafter =\the\@temptokena \do
+ {\@testpach
+ \ifcase \@chclass \@classz \or \@classi \or \@classii
+ \or \save@decl \or \or \@classv \or \@classvi
+ \or \@classvii \or \@classviii
+ \or \@classx
+ \or \@classx \fi
+ \@lastchclass\@chclass}%
+ \ifcase\@lastchclass
+ \@acol \or
+ \or
+ \@acol \or
+ \@preamerr \thr@@ \or
+ \@preamerr \tw@ \@addtopreamble\@sharp \or
+ \or
+ \else \@preamerr \@ne \fi
+ \def\the@toks{\the\toks}}
+\let\@classix\relax
+\def\@classviii{\ifnum \@lastchclass >\z@\ifnum\@lastchclass=\tw@\else
+ \@preamerr 4\@chclass 6 \@classvi \fi\fi}
+\def\@classv{\save@decl
+ \expandafter\NC@ecs\@nextchar\extracolsep{}\extracolsep\@@@
+ \@addtopreamble{\d@llarbegin\the@toks\the\count@\relax\d@llarend}%
+ \prepnext@tok}
+\def\NC@ecs#1\extracolsep#2#3\extracolsep#4\@@@{\def\@tempa{#2}%
+ \ifx\@tempa\@empty\else\toks\count@={#1\tabskip#2\relax#3}\fi}
+\def\@tabarray{\@ifnextchar[{\@@array}{\@@array[c]}}
+\let\@@array\@array
+\def\endarray{\crcr \egroup \egroup \@arrayright \gdef\@preamble{}}
+\let\@arrayleft\@empty
+\let\@arrayright\@empty
+\newlength{\extratabsurround}
+\setlength{\extratabsurround}{2pt}
+\newlength{\backup@length}
+\newcommand{\firsthline}{%
+ \multicolumn1{@{}c@{}}{%
+ \global\backup@length\ht\@arstrutbox
+ \global\advance\backup@length\dp\@arstrutbox
+ \global\advance\backup@length\arrayrulewidth
+ \raise\extratabsurround\copy\@arstrutbox
+ \kern-1sp%
+ }\\[-\backup@length]\hline
+}
+\newcommand{\lasthline}{\hline\multicolumn1{@{}c@{}}{%
+ \global\backup@length2\ht\@arstrutbox
+ \global\advance\backup@length2\dp\@arstrutbox
+ \global\advance\backup@length\arrayrulewidth
+ }\\[-\backup@length]%
+ \multicolumn1{@{}c@{}}{%
+ \lower\extratabsurround\copy\@arstrutbox
+ \kern-1sp%
+ }%
+}
+\CheckCommand*\@xhline{\ifx\reserved@a\hline
+ \vskip\doublerulesep
+ \vskip-\arrayrulewidth
+ \fi
+ \ifnum0=`{\fi}}
+\renewcommand*\@xhline{\ifx\reserved@a\hline
+ \vskip\doublerulesep
+ \fi
+ \ifnum0=`{\fi}}
+
+\newsavebox\ar@cellbox
+\newcolumntype{w}[2]{%
+ >{\begin{lrbox}\ar@cellbox\d@llarbegin}%
+ c%
+ <{\d@llarend \end{lrbox}%
+ \makebox[#2][#1]{\unhbox\ar@cellbox}}}
+
+\newcolumntype{W}[2]
+ {>{\begin{lrbox}\ar@cellbox\d@llarbegin}%
+ c%
+ <{\d@llarend\end{lrbox}%
+ \let\hss\hfil
+ \makebox[#2][#1]{\unhbox\ar@cellbox}}}
+\endinput
+%%
+%% End of file `array.sty'.
diff --git a/macros/latex-dev/required/tools/array.dtx b/macros/latex-dev/required/tools/array.dtx
index 6e4e34ea26..66c40a5267 100644
--- a/macros/latex-dev/required/tools/array.dtx
+++ b/macros/latex-dev/required/tools/array.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
@@ -30,10 +30,15 @@
%<+package>
%<+package>\DeclareRelease{}{2016-10-06}{array-2016-10-06.sty}
%<+package>\DeclareRelease{v2.4}{2020-02-10}{array-2020-02-10.sty}
-%<+package>\DeclareCurrentRelease{}{2020-10-01}
+%<+package>\DeclareRelease{v2.5}{2023-11-01}{array-2023-11-01.sty}
+%<+package>\DeclareCurrentRelease{}{2024-06-01}
%<+package>
+% \end{macrocode}
+% Current version needs a new kernel.
+% \begin{macrocode}
+%<+package>\NeedsTeXFormat{LaTeX2e}[2024/06/01]
%<+package>\ProvidesPackage{array}
-%<+package> [2023/10/16 v2.5g Tabular extension package (FMi)]
+%<+package> [2023/12/11 v2.6a Tabular extension package (FMi)]
%
% \fi
%
@@ -177,6 +182,18 @@
% \DoNotIndex{\xdef}
% \DoNotIndex{\z@}
%
+%
+% \providecommand\env[1]{\texttt{#1}}
+%
+% \providecommand\hook[1]{\texttt{#1\DescribeHook[noprint]{#1}}}
+% \providecommand\socket[1]{\texttt{#1\DescribeSocket[noprint]{#1}}}
+% \providecommand\plug[1]{\texttt{#1\DescribePlug[noprint]{#1}}}
+%
+% \NewDocElement[printtype=\textit{socket},idxtype=socket,idxgroup=Sockets]{Socket}{socketdecl}
+% \NewDocElement[printtype=\textit{hook},idxtype=hook,idxgroup=Hooks]{Hook}{hookdecl}
+% \NewDocElement[printtype=\textit{plug},idxtype=plug,idxgroup=Plugs]{Plug}{plugdecl}
+%
+%
% \GetFileInfo{array.sty}
%
% \title{A new implementation of \LaTeX's \textsf{tabular}
@@ -195,6 +212,8 @@
% \MaintainedByLaTeXTeam{tools}
% \maketitle
%
+%
+%
% \MakeShortVerb{\=}
%
% \begin{abstract}
@@ -750,12 +769,29 @@
% \end{itemize}
%
%
+% \section{Support for tagged PDF}
%
-% \changes{v2.2b}{1994/02/04}{Removed interactive prompt}
+% With version 2.6a the package is made tagging aware, which means that
+% it will automatically produce tagged tables (necessary, for example, for
+% accessibility) if tagging is requested via \cs{DocumentMetadata}.
%
-% \MaybeStop{
+% More granular control, e.g., explicitly deciding which cells are
+% header cells, etc., is currently under development, but syntax for
+% this will not appear in this package. Instead it will become
+% available across all tabular-generating packages and then
+% automatically apply here as well.
+%
+% Enabling \LaTeX{} to automatically produce tagged PDF is a long-term
+% project and this is a tiny step in this puzzle. For more information
+% on the project and already available functionality, see
+% \url{https://latex-project.org/publications/indexbytopic/pdf} and
+% \url{https://github.com/latex3/tagging-project}.
%
%
+%
+% \changes{v2.2b}{1994/02/04}{Removed interactive prompt}
+%
+% \MaybeStop{
% \begin{thebibliography}{1}
% \bibitem{bk:GMS94} \textsc{M.~Goossens}, \textsc{F.~Mittelbach}
% and \textsc{A.~Samarin}.
@@ -772,7 +808,6 @@
% \newblock
% Addison-Wesley, Reading, Massachusetts, 1986.
% \end{thebibliography}
-%
% } ^^A end of \MaybeStop
%
%
@@ -786,8 +821,49 @@
% \texttt{docstrip} program.
% \begin{macrocode}
%<*driver>
-\NeedsTeXFormat{LaTeX2e}[1995/12/01]
-\documentclass{ltxdoc}
+\NeedsTeXFormat{LaTeX2e}[2024/06/01]
+% \end{macrocode}
+%
+% We switched from \cls{ltxdoc} to \cls{l3doc} to get support for
+% code written in the L3 programming layer. The first is that we
+% are currently missing \cs{MaintainedByLaTeXTeam}, so we have to
+% provide that for now.
+% \begin{macrocode}
+\documentclass{l3doc}
+
+% currently missing in l3doc
+\makeatletter
+\def\MaintainedBy#1{\gdef\@maintainedby{#1}}
+\let\@maintainedby\@empty
+\def\MaintainedByLaTeXTeam#1{%
+{\gdef\@maintainedby{%
+This file is maintained by the \LaTeX{} Project team.\\%
+Bug reports can be opened (category \texttt{#1}) at\\%
+\url{https://latex-project.org/bugs.html}.}}}
+\def\@maketitle{%
+ \newpage
+ \null
+ \vskip 2em%
+ \begin{center}%
+ \let \footnote \thanks
+ {\LARGE \@title \par}%
+ \vskip 1.5em%
+ {\large
+ \lineskip .5em%
+ \begin{tabular}[t]{c}%
+ \@author
+ \end{tabular}\par}%
+ \vskip 1em%
+ {\large \@date}%
+ \ifx\@maintainedby\@empty
+ \else
+ \vskip 1em%
+ \fbox{\fbox{\begin{tabular}{@{}l@{}}\@maintainedby\end{tabular}}}%
+ \fi
+ \end{center}%
+ \par
+ \vskip 1.5em}
+\makeatother
% undo the default is not used:
@@ -817,6 +893,29 @@
% \end{macrocode}
%
%
+% \section{A note on the updates done December 2023}
+%
+% We introduced support for tagged PDf and at the same time we added
+% code to determine row and column numbers for each cell in
+% preparation for supporting formatting or type specifications for individual
+% cells (or group of cells) from the outside, e.g., \enquote{rows 1,
+% 2, and 10 are header rows} (syntax to be decided).
+%
+% This new code is already written with L3 programming layer conventions
+% while most of the legay code is still as it was before. This make the code
+% currently somewhat clattered, unfortunately. Eventually this will all move to L3
+% programming layer but this will take time.
+%
+%
+% \begin{macrocode}
+%<@@=tbl>
+\ExplSyntaxOn
+% \end{macrocode}
+%
+%
+%
+%
+%
% \section{The construction of the preamble}
%
% \DeleteShortVerb{\"}
@@ -972,6 +1071,7 @@
% =\@chclass= and =\@chnum=.
% \changes{v2.0f}{1992/02/29}{Argument removed since implicitly known}
% \begin{macrocode}
+\ExplSyntaxOff
\def\@testpach{\@chclass
% \end{macrocode}
% First we deal with the cases in which the \textsf{token}
@@ -981,7 +1081,7 @@
\ifnum \@lastchclass=6 \@ne \@chnum \@ne \else
\ifnum \@lastchclass=7 5 \else
\ifnum \@lastchclass=8 \tw@ \else
- \ifnum \@lastchclass=9 \thr@@
+ \ifnum \@lastchclass=9 \thr@@@@
% \end{macrocode}
% Otherwise we will assume that the \textsf{token} belongs to the
% class $0$
@@ -1032,7 +1132,7 @@
% \begin{macrocode}
10
\@chnum
- \if \@nextchar m\thr@@\else
+ \if \@nextchar m\thr@@@@ \else
\if \@nextchar p4 \else
\if \@nextchar b5 \else
% \end{macrocode}
@@ -1042,6 +1142,7 @@
% \begin{macrocode}
\z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi
\fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi}
+\ExplSyntaxOn
% \end{macrocode}
% \end{macro}
%
@@ -1062,10 +1163,10 @@
% they are in explicit braces, as in =@{*}=.
%
% This macro is called via
-% =\@xexpast=\meta{preamble}=*0x\@@=.
+% =\@xexpast=\meta{preamble}=*0x\@@@@=.
% The $*$--expression =*0x= is being used to terminate the
% recursion,
-% as we shall see later, and =\@@= serves as an argument
+% as we shall see later, and =\@@@@= serves as an argument
% delimiter. =\@xexpast= has four arguments. The first
% one is the part of the
% user preamble before the first $*$--expression while the second
@@ -1074,7 +1175,7 @@
% above).
% The fourth argument is the rest of the preamble.
% \begin{macrocode}
-\def\@xexpast#1*#2#3#4\@@{%
+\def\@xexpast#1*#2#3#4\@@@@{%
% \end{macrocode}
% The number of copies of \textit{String} (=#2=) that are to be
% produced will be saved in a \textsf{count} register.
@@ -1111,7 +1212,7 @@
% \end{macrocode}
% If \textit{N\/} was greater than zero we prepare for another call
% of =\@xexpast=. Otherwise we assume we have reached the end of
-% the user preamble, because we had appended =*0x\@@= when we first
+% the user preamble, because we had appended =*0x\@@@@= when we first
% called =\@xexpast=. In other words: if the user inserts
% =*{0}{..}= in his preamble, \LaTeX\ ignores the rest of it.
% \begin{macrocode}
@@ -1133,7 +1234,7 @@
% $*$--expression is handled, or to the macro =\@xexnoop=,
% which only ends the recursion by deleting its argument.
% \begin{macrocode}
- \expandafter \@tempb \@tempa #4\@@}
+ \expandafter \@tempb \@tempa #4\@@@@}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1142,10 +1243,10 @@
% \begin{macro}{\@xexnoop}
% So the first big problem is solved. Now it is easy to
% specify =\@xexnoop=.
-% Its argument is delimited by =\@@= and it simply expands to
+% Its argument is delimited by =\@@@@= and it simply expands to
% nothing.
% \begin{macrocode}
-% \def\@xexnoop#1\@@{}
+% \def\@xexnoop#1\@@@@{}
% \end{macrocode}
% \end{macro}
%
@@ -1275,6 +1376,13 @@
% \begin{macrocode}
\def\insert@column{%
% \end{macrocode}
+%
+% For tagging we insert as special socket, that adds the necessary
+% PDF tag at the beginning of the cell if tagging is enabled.
+% \changes{v2.6a}{2023/12/11}{Support for tagged PDF}
+% \begin{macrocode}
+ \UseTaggingSocket{tbl/cell/begin}%
+% \end{macrocode}
% Here, we assume that the \textsf{count} register
% =\@tempcnta= has saved the value $=\count@= - 1$.
% \begin{macrocode}
@@ -1302,12 +1410,36 @@
% \changes{v2.0c}{1990/08/14}{\cs{relax} added to avoid problem
% \cs{the}\cs{toks0}\cs{the}\cs{toks1}.}
% \begin{macrocode}
- \the@toks \the \count@ \relax}
+ \the@toks \the \count@ \relax
+% \end{macrocode}
+%
+% And another socket for tagging that adds the necessary closing tag
+% if enabled.
+% \changes{v2.6a}{2023/12/11}{Support for tagged PDF}
+% \begin{macrocode}
+ \UseTaggingSocket{tbl/cell/end}%
+}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
%
+% \begin{macro}{\insert@pcolumn}
+% Handling pcolumn-cells needs slightly different handling when
+% doing tagging. Rather than changing the plugs in
+% \cs{insert@column} back and forth, we simply use a different
+% version of \cs{insert@column} that has its own sockets.
+% \changes{v2.6a}{2023/12/11}{Support for tagged PDF}
+% \begin{macrocode}
+\def\insert@pcolumn{%
+ \UseTaggingSocket{tbl/pcell/begin}%
+ \the@toks \the \@tempcnta
+ \ignorespaces \@sharp \unskip
+ \the@toks \the \count@ \relax
+ \UseTaggingSocket{tbl/pcell/end}%
+}
+% \end{macrocode}
+% \end{macro}
%
%
% \subsection{The separation of columns}
@@ -1321,11 +1453,24 @@
% =\@addamp=, the macro that inserts the =&=.
% \begin{macrocode}
% \newif \@iffirstamp
-% \def\@addamp{\if@firstamp \@firstampfalse
-% \else \@addtopreamble &\fi}
+\def\@addamp {
+ \if@firstamp
+ \@firstampfalse
+ \else
+% \end{macrocode}
+% If we are after the first column we have to insert a \verb=&= and
+% also update the cell data.
+% \changes{v2.6a}{2023/12/11}{Managing cell indexes}
+% \begin{macrocode}
+ \edef\@preamble{\@preamble &
+ \noexpand\tbl_update_cell_data: }
+ \fi
+}
% \end{macrocode}
% \end{macro}
%
+%
+%
% \begin{macro}{\@acol}
% \begin{macro}{\@acolampacol}
% \begin{macro}{\col@sep}
@@ -1393,7 +1538,7 @@
% command =\@xexpast=. As we already know, this command saves
% its result in the macro =\@tempa=.
% \begin{macrocode}
-% \@xexpast #1*0x\@@
+% \@xexpast #1*0x\@@@@
% \end{macrocode}
% Afterwards we initialize all registers and macros, that we need
% for the build-up of the preamble.
@@ -1477,7 +1622,7 @@
% \texttt{r}, \texttt{p},\texttt{m} or \texttt{b}. We report an
% error and ignore the declaration given by ={..}=.
% \begin{macrocode}
-% \@preamerr \thr@@ \or
+% \@preamerr \thr@@@@ \or
% \end{macrocode}
% If =\@lastchclass= is $4$ the user preamble has been empty.
% To continue, we insert a =#= in the preamble.
@@ -1671,18 +1816,17 @@
\setbox\ar@mcellbox\vbox
% \end{macrocode}
% The part of the templates which is the same in all three cases
-% (\texttt{p}, \texttt{m} and \texttt{b})
-% is built by the macros =\@startpbox= and
-% =\@endpbox=. =\@startpbox= has an argument:
-% the width of the column which is stored in the current
-% \textsf{token} (i.e.\ =\@nextchar=).
-% Between these two macros we find the well known
-% =\insert@column=.
-% The strut is places after the box
+% (\texttt{p}, \texttt{m} and \texttt{b}) is built by the macros
+% =\@startpbox= and =\@endpbox=. =\@startpbox= has an argument: the
+% width of the column which is stored in the current \textsf{token}
+% (i.e.\ =\@nextchar=). Between these two macros we find the well
+% known =\insert@column= or rather the variant for tagging:
+% \cs{insert@pcolumn}. The strut is placed after the box.
% \changes{v2.4e}{2016/10/07}{Fixing SX68732}
% \changes{v2.4f}{2017/11/04}{Managing m-cells without \cs{vcenter}}
+% \changes{v2.6a}{2023/12/11}{Support for tagged PDF}
% \begin{macrocode}
- \@startpbox{\@nextchar}\insert@column \@endpbox
+ \@startpbox{\@nextchar}\insert@pcolumn \@endpbox
\ar@align@mcell
\do@row@strut \or
% \end{macrocode}
@@ -1690,9 +1834,10 @@
% same way though we do not need the =$= characters because we use
% =\vtop= or =\vbox=.
% \changes{v2.4e}{2016/10/07}{Fixing SX68732}
+% \changes{v2.6a}{2023/12/11}{Support for tagged PDF}
% \begin{macrocode}
- \vtop \@startpbox{\@nextchar}\insert@column \@endpbox\do@row@strut \or
- \vbox \@startpbox{\@nextchar}\insert@column \@endpbox\do@row@strut
+ \vtop \@startpbox{\@nextchar}\insert@pcolumn \@endpbox\do@row@strut \or
+ \vbox \@startpbox{\@nextchar}\insert@pcolumn \@endpbox\do@row@strut
% \end{macrocode}
% Other values for =\@chnum= are impossible. Therefore we
% end the arguments to =\@addtopreamble= and =\ifcase=.
@@ -1783,8 +1928,8 @@
% So the declarations defined by the first =>{...}=
% are ignored.
% \begin{macrocode}
-%\def\@classix{\ifnum \@lastchclass = \thr@@
-% \@preamerr \thr@@ \fi
+%\def\@classix{\ifnum \@lastchclass = \thr@@@@
+% \@preamerr \thr@@@@ \fi
% \end{macrocode}
% Furthermore, we call up =\@class10= because afterwards always a
% new column is started by \texttt{c}, \texttt{l}, \texttt{r},
@@ -1836,14 +1981,14 @@
% We only check if the last \textsf{token} was of class $3$ which is
% forbidden.
% \begin{macrocode}
-\def\@classvii{\ifnum \@lastchclass = \thr@@
+\def\@classvii{\ifnum \@lastchclass = \thr@@@@
% \end{macrocode}
% If this is true we output an error message and
% ignore the declarations stored
% by the last =>{...}=, because these are overwritten
% by the argument of \texttt{@}.
% \begin{macrocode}
- \@preamerr \thr@@ \fi}
+ \@preamerr \thr@@@@ \fi}
% \end{macrocode}
% \end{macro}
%
@@ -2032,7 +2177,7 @@
% second one describes the wanted preamble,
% e.g.\ it has the form =|c|c|c|=.
% \begin{macrocode}
-\def\@array[#1]#2{%
+\def\@array[#1]#2{
% \end{macrocode}
% First we define a \textsf{strut} whose size basically corresponds
% to a normal \textsf{strut} multiplied by the factor
@@ -2051,6 +2196,14 @@
\@depth \arraystretch \dp \strutbox
\@width \z@}%
% \end{macrocode}
+% The total number of table columns of the current table is
+% determined in \cs{tbl_count_table_cols:} but this is called in
+% a group, so local settings do not survive. Thus, to save away the
+% 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}
+ \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.
% This macro creates a preamble for a =\halign= and saves
@@ -2059,6 +2212,11 @@
\begingroup
\@mkpream{#2}%
% \end{macrocode}
+% Figure out how many columns this table has:
+% \changes{v2.6a}{2023/12/11}{Managing cell indexes}
+% \begin{macrocode}
+ \tbl_count_table_cols:
+% \end{macrocode}
% We again redefine =\@preamble= so that a call up of =\@preamble=
% now starts the =\halign=. Thus also the arguments of \texttt{>},
% \texttt{<}, \texttt{@} and \texttt{!}, saved in the
@@ -2085,13 +2243,38 @@
% unsupported redefinition of a \TeX{} primitive for the moment (as people rely
% on that experimental code).
% \begin{macrocode}
- \xdef\@preamble{\noexpand \ialign \@halignto
- \bgroup \@arstrut \@preamble
- \tabskip \z@ \cr}%
+ \xdef\@preamble{
+% \end{macrocode}
+% \cs{ialign} in the original definition is replaced by
+% \cs{ar@ialign} defined below. This does what \cs{ialign} does but
+% additionally handles the tagging structure for the whole table if necessary.
+% \changes{v2.6a}{2023/12/11}{Support for tagged PDF}
+% \begin{macrocode}
+ \noexpand \ar@ialign
+ \@halignto
+ \bgroup \@arstrut
% \end{macrocode}
% What we have not explained yet is the macro =\@halignto=
% that was just used. Depending on its replacement text the
% =\halign= becomes a =\halign= \texttt{to} \meta{dimen}.
+%
+% Next, a tagging support socket is inserted adding the start row tag.
+% \changes{v2.6a}{2023/12/11}{Support for tagged PDF}
+% \begin{macrocode}
+ \UseTaggingSocket{tbl/row/begin}
+% \end{macrocode}
+% 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}
+ \tbl_init_cell_data_for_row:
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \@preamble
+ \tabskip \z@ \cr}
+% \end{macrocode}
% Now we close the group again. Thus
% =\@startpbox= and =\@endpbox= as well as all
% \textsf{token} registers get their former meaning back.
@@ -2128,12 +2311,16 @@
% around every column in the \textsf{array}--environment
% the parameter =\mathsurround= should
% also be set to \textsf{0pt}. This prevents additional space between
-% the rows. The
-% \PlainTeX--macro =\m@th= does this.
+% the rows.
% \begin{macrocode}
\lineskip \z@
\baselineskip \z@
- \m@th
+% \end{macrocode}
+% Don't use \cs{m@th} here as that signals to the math taggingg
+% code that this is fake math that should not be tagged.
+% \changes{v2.6a}{2023/12/11}{Support for tagged PDF}
+% \begin{macrocode}
+ \mathsurround \z@
% \end{macrocode}
% Beside, we have to assign a special meaning (which we still have
% to specify) to the line separator =\\=. We also have to
@@ -2144,10 +2331,61 @@
% start the wanted =\halign=.
% \changes{1994/12/08}{v2.3b}{add \cs{tabularnewline}}
% \begin{macrocode}
- \let\\\@arraycr \let\tabularnewline\\\let\par\@empty \@preamble}
+ \let\\\@arraycr \let\tabularnewline\\\let\par\@empty
+% \end{macrocode}
+% Another socket for tagging. TODO: what about \cs{arrayleft} above?
+% \begin{macrocode}
+ \UseTaggingSocket{tbl/init}
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \@preamble
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\ar@ialign}
+% A new command that replaces \cs{ialign} used previously. \cs{everycr} is
+% also applied to the \cs{cr} ending the preamble so we have to
+% program around that.
+% \changes{v2.6a}{2023/12/11}{Support for tagged PDF}
+% \begin{macrocode}
+\def\ar@ialign{%
+% \end{macrocode}
+% Before starting a table we have to initialize the variables
+% holding row and column information for cells. We also have
+% locally store the information related to the current cell (if we
+% are already inside a table) so that we can restore it once the
+% inner table is finished.
+% \changes{v2.6a}{2023/12/11}{Managing cell indexes}
+% \begin{macrocode}
+ \tbl_init_cell_data_for_table:
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \everycr{%
+ \noalign{%
+% \end{macrocode}
+% 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}
+ \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@skip\halign}
% \end{macrocode}
% \end{macro}
%
+%
+%
+%
+%
% \begin{macro}{\arraybackslash}
% \changes{v2.4a}{2003/12/17}{(DPC) Macro added (from tabularx)}
% Restore =\\= for use in array and tabular environment (after
@@ -2182,7 +2420,27 @@
% \begin{macro}{\@arraycr}
% In the macro =\@array= the line separator =\\= is
% =\let= to the command =\@arraycr=.
-% Its definition starts with a special brace which I have directly
+% \changes{v2.3c}{1995/04/23}{Avoid adding an ord atom in math}
+% \changes{v2.5e}{2021/04/20}{Use \cs{protected} for \cs{\bslash} variant (gh/548)}
+% \begin{macrocode}
+\protected\def\@arraycr {
+% \end{macrocode}
+% Add code that figures out if the current table row is incomplete
+% (not enough \verb=&=s). It can then do extra actions, such as
+% inserting missing cell tags.
+% \changes{v2.6a}{2023/12/11}{Managing cell indexes}
+% \begin{macrocode}
+ \tbl_count_missing_cells:n {@arraycr}
+% \end{macrocode}
+% TODO: maybe this is also the right place to add a socket that
+% could be used to actually enter missing cells instead of just
+% adding tagging structures for them later. This would be optional
+% but in many cases it would be the right thing to do (for example
+% if tables contain vertical lines or similar visual structures
+% that require fully specified rows.
+%
+%
+% We then start a special brace which I have directly
% copied from the original definition. It is
% necessary, because the =\futurlet= in =\@ifnextchar=
% might
@@ -2198,10 +2456,8 @@
% =\halign= while we are looking for a =*= or =[=.
% For further information see
% \cite[Appendix D]{bk:knuth}.
-% \changes{v2.3c}{1995/04/23}{Avoid adding an ord atom in math}
-% \changes{v2.5e}{2021/04/20}{Use \cs{protected} for \cs{\bslash} variant (gh/548)}
% \begin{macrocode}
-\protected\def\@arraycr{\relax\iffalse{\fi\ifnum 0=`}\fi
+ \iffalse{\fi\ifnum 0=`}\fi
% \end{macrocode}
% Then we test whether the user is using the star form and ignore
% a possible star (I also disagree with this procedure, because a
@@ -2210,6 +2466,11 @@
\@ifstar \@xarraycr \@xarraycr}
% \end{macrocode}
% \end{macro}
+
+
+
+
+
%
% \begin{macro}{\@xarraycr}
% In the command =\@xarraycr= we test if an optional argument
@@ -2301,6 +2562,7 @@
% the result column and the actual column entry.
% \changes{v2.3j}{1998/01/29}{Command made \cs{long} to match
% kernel change for pr/2180}
+% \changes{v2.6a}{2023/12/11}{Support for tagged PDF}
% \begin{macrocode}
\long\def\multicolumn#1#2#3{%
% \end{macrocode}
@@ -2310,6 +2572,16 @@
% \begin{macrocode}
\multispan{#1}\begingroup
% \end{macrocode}
+% 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 macro
+% (which in turn calls the \texttt{tbl/row/begin} socket, if
+% necessary).
+% \changes{v2.6a}{2023/12/11}{Managing cell indexes}
+% \begin{macrocode}
+ \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
% an error message if one uses more than one \texttt{c},
@@ -2336,6 +2608,12 @@
% \begin{macrocode}
\endgroup
% \end{macrocode}
+% Now we update the colspan attribute. This needs setting after
+% the group as it is hidden inside the plug in \cs{insert@column}.
+% \changes{v2.6a}{2023/12/11}{Support for tagged PDF}
+% \begin{macrocode}
+ \UseTaggingSocket{tbl/colspan}{#1}%
+% \end{macrocode}
% In the special situation of =\multicolumn= =\@preamble=
% is not needed as preamble for a =\halign= but it is directly
% inserted into our table. Thus instead of =\sharp=
@@ -2458,6 +2736,12 @@
% \begin{macrocode}
\leavevmode
% \end{macrocode}
+% Now that we know we are in hmode we can add the start tag for the
+% whole table.
+% \changes{v2.6a}{2023/12/11}{Support for tagged PDF}
+% \begin{macrocode}
+ \UseTaggingSocket{tbl/hmode/begin}%
+% \end{macrocode}
% It should be taken into consideration that the macro =\@array=
% must be called in math mode. Therefore we open a \textsf{box},
% insert a =$= and then assign the correct values to =\col@sep= and
@@ -2486,11 +2770,41 @@
% =\@array=. To save \textsf{token} space we then redefine
% =\@preamble=
% because its replacement text isn't longer needed.
+%
+% To handle cell indexes, we do not use \cs{crcr} but a variant
+% that also handles missing cells as necessary.
+% \changes{v2.6a}{2023/12/11}{Support for tagged PDF}
+% \begin{macrocode}
+\def\endarray {
+ \tbl_crcr:n{endarray} \egroup
+ \UseTaggingSocket{tbl/finalize}
+% \end{macrocode}
+%
+% If tables are nested into another then it is necessary to
+% restore information about the cell the inner table started
+% 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).
+%
+% \cs{endtabular} and \cs{endtabular*} inherit from \cs{endarray}
+% so we only need to change that. \texttt{tabularx} uses a similar method.
+% \changes{v2.6a}{2023/12/11}{Managing cell indexes}
% \begin{macrocode}
-%\def\endarray{\crcr \egroup \egroup \gdef\@preamble{}}
+ \tbl_restore_outer_cell_data:
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \egroup
+ \@arrayright \gdef\@preamble{}%
+}
% \end{macrocode}
% \end{macro}
%
+%
+%
+%
% \begin{macro}{\endtabular}
% \begin{macro}{\endtabular*}
% To end a \textsf{tabular} or \textsf{tabular$*$} environment we
@@ -2499,7 +2813,13 @@
% any =\mathsurround= so we cancel that with =\m@th=.
% \changes{v2.5f}{2021/07/12}{Cancel any outside \cs{mathsurround} (gh/614)}
% \begin{macrocode}
-\def\endtabular{\endarray\m@th $\egroup}
+\def\endtabular{\endarray\m@th $\egroup
+% \end{macrocode}
+%
+% \changes{v2.6a}{2023/12/11}{Support for tagged PDF}
+% \begin{macrocode}
+ \UseTaggingSocket{tbl/hmode/end}%
+}
\expandafter\let\csname endtabular*\endcsname=\endtabular
% \end{macrocode}
% \end{macro}
@@ -2518,7 +2838,7 @@
\let\@arrayclassiv=\relax \let\@arrayclassz=\relax
\let\@tabclassiv=\relax \let\@tabclassz=\relax
\let\@arrayacol=\relax \let\@tabacol=\relax
-\let\@tabularcr=\relax \let\@@endpbox=\relax
+\let\@tabularcr=\relax \let\@@@@endpbox=\relax
\let\@argtabularcr=\relax \let\@xtabularcr=\relax
% \end{macrocode}
%
@@ -2576,6 +2896,7 @@
% to define letters, to be used in the same way as the primitive
% column specifiers, `c' `p' etc.
% \begin{macrocode}
+\ExplSyntaxOff % this is really oldstyle using \@tfor :=
\def\newcolumntype#1{%
% \end{macrocode}
% "\NC@char" was added in V2.01 so that active characters, like "@" in
@@ -2615,6 +2936,7 @@
% If an optional argument was not given, give a default argument of 0.
% \begin{macrocode}
\@ifnextchar[{\newcol@{\NC@char}}{\newcol@{\NC@char}[0]}}
+\ExplSyntaxOn
% \end{macrocode}
% \end{macro}
% \begin{macro}{\newcol@}
@@ -2710,16 +3032,18 @@
% produced and then "\typeout" the required string.
% \begin{macrocode}
\def\NC@show#1{%
- \typeout{Column #1\expandafter\expandafter\expandafter\NC@strip
- \expandafter\meaning\csname NC@rewrite@#1\endcsname\@@}}
+ \typeout{Column~ #1\expandafter\expandafter\expandafter\NC@strip
+ \expandafter\meaning\csname NC@rewrite@#1\endcsname\@@@@}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\NC@strip}
% Delimit the arguments to "\NC@strip" with `\texttt{:}', `\texttt{->}',
-% a space, and "\@@" to pull out the required parts of the output from
+% a space, and "\@@@@" to pull out the required parts of the output from
% "\meaning".
% \begin{macrocode}
-\def\NC@strip#1:#2->#3 #4\@@{#2 -> #4}
+\ExplSyntaxOff
+\def\NC@strip#1:#2->#3 #4\@@@@{#2 -> #4}
+\ExplSyntaxOn
% \end{macrocode}
% \end{macro}
% \begin{macro}{\NC@list}
@@ -2807,6 +3131,7 @@
% \changes{v2.4e}{2016/10/07}{Fixing SX68732}
% \changes{v2.4f}{2017/11/04}{Managing m-cells without \cs{vcenter}}
% \begin{macrocode}
+\ExplSyntaxOff % really oldstyle using \@tfor :=
\def\@mkpream#1{\gdef\@preamble{}\@lastchclass 4 \@firstamptrue
\let\@sharp\relax
% \end{macrocode}
@@ -2869,11 +3194,12 @@
\@acol \or
\or
\@acol \or
- \@preamerr \thr@@ \or
+ \@preamerr \thr@@@@ \or
\@preamerr \tw@ \@addtopreamble\@sharp \or
\or
\else \@preamerr \@ne \fi
\def\the@toks{\the\toks}}
+\ExplSyntaxOn
% \end{macrocode}
% \end{macro}
%
@@ -2908,7 +3234,7 @@
% \texttt{array.sty} 2.0h.
% \begin{macrocode}
\def\@classv{\save@decl
- \expandafter\NC@ecs\@nextchar\extracolsep{}\extracolsep\@@@
+ \expandafter\NC@ecs\@nextchar\extracolsep{}\extracolsep\@@@@@@
\@addtopreamble{\d@llarbegin\the@toks\the\count@\relax\d@llarend}%
\prepnext@tok}
% \end{macrocode}
@@ -2920,7 +3246,7 @@
% second "\extracolsep", there is no point in the user entering two of
% these commands anyway, so this is not really a restriction.
% \begin{macrocode}
-\def\NC@ecs#1\extracolsep#2#3\extracolsep#4\@@@{\def\@tempa{#2}%
+\def\NC@ecs#1\extracolsep#2#3\extracolsep#4\@@@@@@{\def\@tempa{#2}%
\ifx\@tempa\@empty\else\toks\count@={#1\tabskip#2\relax#3}\fi}
%</ncols>
% \end{macrocode}
@@ -2936,28 +3262,27 @@
%
% \begin{macro}{\@tabarray}
% This macro tests for an optional bracket and then calls up
-% "\@@array" or "\@@array[c]" (as default).
+% "\@@@@array" or "\@@@@array[c]" (as default).
% \begin{macrocode}
%<*package>
-\def\@tabarray{\@ifnextchar[{\@@array}{\@@array[c]}}
+\def\@tabarray{\@ifnextchar[{\@@@@array}{\@@@@array[c]}}
% \end{macrocode}
% \end{macro}
-% \begin{macro}{\@@array}
+% \begin{macro}{\@@@@array}
% This macro tests could then test an optional delimiter before the
% left brace of the main preamble argument. Here in the main package
% it simply is let to be "\@array".
% \begin{macrocode}
-\let\@@array\@array
+\let\@@@@array\@array
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\endarray}
+% \begin{macro}{\@arrrayleft}
% \begin{macro}{\@arrayright}
% We have to declare the hook we put into "\@array" above.
-% A similar hook `"\@arrayright"' will be inserted into the
+% A similar hook \cs{@arrayright} will be inserted into the
% "\endarray" to gain control. Both defaults to empty.
% \begin{macrocode}
-\def\endarray{\crcr \egroup \egroup \@arrayright \gdef\@preamble{}}
\let\@arrayleft\@empty
\let\@arrayright\@empty
% \end{macrocode}
@@ -3182,6 +3507,14 @@
% \end{macro}
%
%
+%
+%
+%
+% \begin{macrocode}
+\ExplSyntaxOff
+% \end{macrocode}
+%
+%
% \PrintIndex
% \PrintChanges
%
diff --git a/macros/latex-dev/required/tools/array.pdf b/macros/latex-dev/required/tools/array.pdf
index 9cf73a7e98..87880c97fb 100644
--- a/macros/latex-dev/required/tools/array.pdf
+++ b/macros/latex-dev/required/tools/array.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/bm.dtx b/macros/latex-dev/required/tools/bm.dtx
index a608c6aeb5..d7d6eb54ee 100644
--- a/macros/latex-dev/required/tools/bm.dtx
+++ b/macros/latex-dev/required/tools/bm.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
@@ -22,7 +22,7 @@
% \fi
%
% \iffalse
-%% Copyright 1996 1997 1998 1999 2002 2003 2004 2016 2017 2019 2021 2022
+%% Copyright 1996 1997 1998 1999 2002 2003 2004 2016 2017 2019 2021 2022 2023
%% David Carlisle Frank Mittelbach
%%
%% Development of this package was commissioned by Y&Y Inc.
@@ -36,7 +36,7 @@
%<driver>\ProvidesFile{bm.drv}
% \fi
% \ProvidesFile{bm.dtx}
- [2023/07/08 v1.2f Bold Symbol Support (DPC/FMi)]
+ [2023/12/19 v1.2f Bold Symbol Support (DPC/FMi)]
%
% \iffalse
%<*driver>
@@ -178,14 +178,14 @@
% spacing). So the third example produces identical output to the first
% (but \TeX\ takes more time producing it).
%
-% In the fourth example the |\mathrm{\bm{g}}| is essentially
+% In the fourth example the |\mathrm{\bm{{g}}}| is essentially
% equivalent to |\mathrm{\mbox{\boldmath$g$}}|. Currently math alphabet
% settings are not passed down to `nested' math lists, and so in this
% example, the |\mathrm| has no effect, and a bold math italic $\bm g$
% is obtained.
%
% Similarly the last example is equivalent to
-% |$\mbox{\boldmath$\mathrm{g}$}}| and so in this case, one obtains a
+% |$\mbox{\boldmath$\mathrm{g}$}$| and so in this case, one obtains a
% bold roman \textbf{g}.
%
% \subsection{Delimiters}
diff --git a/macros/latex-dev/required/tools/bm.ins b/macros/latex-dev/required/tools/bm.ins
index a7424a0e67..c0c8125d10 100644
--- a/macros/latex-dev/required/tools/bm.ins
+++ b/macros/latex-dev/required/tools/bm.ins
@@ -3,7 +3,7 @@
%% driver files from the doc files in this package when run through
%% LaTeX or TeX.
%%
-%% Copyright (C) 1993-2023
+%% Copyright (C) 1993-2024
%% The LaTeX Project and any individual authors listed elsewhere
%% in this file.
%%
@@ -45,7 +45,7 @@ The source is maintained by the LaTeX Project team and bug
reports for it can be opened at https://latex-project.org/bugs/
(but please observe conditions on bug reports sent to that address!)
-Copyright (C) 1993-2023
+Copyright (C) 1993-2024
The LaTeX Project and any individual authors listed elsewhere
in this file.
diff --git a/macros/latex-dev/required/tools/bm.pdf b/macros/latex-dev/required/tools/bm.pdf
index c39e17aca0..1f9efb0b02 100644
--- a/macros/latex-dev/required/tools/bm.pdf
+++ b/macros/latex-dev/required/tools/bm.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/calc.dtx b/macros/latex-dev/required/tools/calc.dtx
index 2c4cecbf03..154c6ba26a 100644
--- a/macros/latex-dev/required/tools/calc.dtx
+++ b/macros/latex-dev/required/tools/calc.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
diff --git a/macros/latex-dev/required/tools/calc.pdf b/macros/latex-dev/required/tools/calc.pdf
index 4c0230c693..3cff423972 100644
--- a/macros/latex-dev/required/tools/calc.pdf
+++ b/macros/latex-dev/required/tools/calc.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/changes.txt b/macros/latex-dev/required/tools/changes.txt
index 7b38392bd4..ebf705e687 100644
--- a/macros/latex-dev/required/tools/changes.txt
+++ b/macros/latex-dev/required/tools/changes.txt
@@ -5,11 +5,51 @@ completeness or accuracy and it contains some references to files that
are not part of the distribution.
=======================================================================
+2024-01-22 Lars Madsen <daleif@math.au.dk>
+
+ * verbatim.dtx: added TAB marking support to \verbatiminput* (gh/1245)
+
+2023-12-16 David Carlisle <David.Carlisle@latex-project.org>
+
+ * showkeys.dtx: avoid adding extra box to \@lables gh/1123
+
+2023-12-16 Frank Mittelbach <Frank.Mittelbach@latex-project.org>
+
+ * longtable.dtx:
+ Support for tagged PDF
+ Manage and provide cell indexes
+
+2023-12-12 Frank Mittelbach <Frank.Mittelbach@latex-project.org>
+
+ * array.dtx:
+ Support for tagged PDF
+ Manage and provide cell indexes
+
+2023-12-11 Frank Mittelbach <Frank.Mittelbach@latex-project.org>
+
+ * tabularx.dtx:
+ Require newer LaTeX kernel (that supports tagging)
+ Suspend any tagging while doing trial typesetting
+
+2023-11-10 Frank Mittelbach <Frank.Mittelbach@latex-project.org>
+
+ * multicol.dtx (subsection{Maintaining the mark registers}]):
+ Get rid of forced breaks for mark extraction (gh/1130)
+
================================================================================
All changes above are only part of the development branch for the next release.
================================================================================
#########################
+# 2023-11-01c Release
+#########################
+
+2023-11-06 Frank Mittelbach <Frank.Mittelbach@latex-project.org>
+
+ * verbatim.dtx (subsection{Preliminaries}):
+ Update code so that \verb does not show visible spaces (gh/1160)
+
+#########################
# 2023-11-01b Release
#########################
@@ -23,8 +63,8 @@ All changes above are only part of the development branch for the next release.
2023-08-25 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
- * longtable.dtx: use \everypar to insert the strut in \LT@startpbox
- to match the array use, github/1128
+ * longtable.dtx: use \everypar to insert the strut in \LT@startpbox
+ to match the array use, github/1128
#########################
# 2023-06-01 Release
diff --git a/macros/latex-dev/required/tools/dcolumn.dtx b/macros/latex-dev/required/tools/dcolumn.dtx
index c8ddaf4ce6..feb3096cce 100644
--- a/macros/latex-dev/required/tools/dcolumn.dtx
+++ b/macros/latex-dev/required/tools/dcolumn.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
diff --git a/macros/latex-dev/required/tools/dcolumn.pdf b/macros/latex-dev/required/tools/dcolumn.pdf
index 967e011d28..588505c218 100644
--- a/macros/latex-dev/required/tools/dcolumn.pdf
+++ b/macros/latex-dev/required/tools/dcolumn.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/delarray.dtx b/macros/latex-dev/required/tools/delarray.dtx
index 86a1a6203f..61d40b5c74 100644
--- a/macros/latex-dev/required/tools/delarray.dtx
+++ b/macros/latex-dev/required/tools/delarray.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
diff --git a/macros/latex-dev/required/tools/delarray.pdf b/macros/latex-dev/required/tools/delarray.pdf
index 1a8212075a..1fe65b8c75 100644
--- a/macros/latex-dev/required/tools/delarray.pdf
+++ b/macros/latex-dev/required/tools/delarray.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/enumerate.dtx b/macros/latex-dev/required/tools/enumerate.dtx
index 2818a73a09..c3889a9157 100644
--- a/macros/latex-dev/required/tools/enumerate.dtx
+++ b/macros/latex-dev/required/tools/enumerate.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
diff --git a/macros/latex-dev/required/tools/enumerate.pdf b/macros/latex-dev/required/tools/enumerate.pdf
index 17a894442e..66a10c9002 100644
--- a/macros/latex-dev/required/tools/enumerate.pdf
+++ b/macros/latex-dev/required/tools/enumerate.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/fileerr.dtx b/macros/latex-dev/required/tools/fileerr.dtx
index eef222bb6e..0e8eeb1ffb 100644
--- a/macros/latex-dev/required/tools/fileerr.dtx
+++ b/macros/latex-dev/required/tools/fileerr.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
diff --git a/macros/latex-dev/required/tools/fileerr.pdf b/macros/latex-dev/required/tools/fileerr.pdf
index 3fc612b3d8..102b8c865d 100644
--- a/macros/latex-dev/required/tools/fileerr.pdf
+++ b/macros/latex-dev/required/tools/fileerr.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/fontsmpl.dtx b/macros/latex-dev/required/tools/fontsmpl.dtx
index 525065cde5..6e9835e20e 100644
--- a/macros/latex-dev/required/tools/fontsmpl.dtx
+++ b/macros/latex-dev/required/tools/fontsmpl.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
diff --git a/macros/latex-dev/required/tools/fontsmpl.pdf b/macros/latex-dev/required/tools/fontsmpl.pdf
index 61648a2c33..a40e5d5566 100644
--- a/macros/latex-dev/required/tools/fontsmpl.pdf
+++ b/macros/latex-dev/required/tools/fontsmpl.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/ftnright.dtx b/macros/latex-dev/required/tools/ftnright.dtx
index 663fa304a9..a3826376db 100644
--- a/macros/latex-dev/required/tools/ftnright.dtx
+++ b/macros/latex-dev/required/tools/ftnright.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
diff --git a/macros/latex-dev/required/tools/ftnright.pdf b/macros/latex-dev/required/tools/ftnright.pdf
index 2a4e24a432..e7f13295c7 100644
--- a/macros/latex-dev/required/tools/ftnright.pdf
+++ b/macros/latex-dev/required/tools/ftnright.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/hhline.dtx b/macros/latex-dev/required/tools/hhline.dtx
index 49ac1ae208..b2d833d965 100644
--- a/macros/latex-dev/required/tools/hhline.dtx
+++ b/macros/latex-dev/required/tools/hhline.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
diff --git a/macros/latex-dev/required/tools/hhline.pdf b/macros/latex-dev/required/tools/hhline.pdf
index d8f969b7b0..c8484ff875 100644
--- a/macros/latex-dev/required/tools/hhline.pdf
+++ b/macros/latex-dev/required/tools/hhline.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/indentfirst.dtx b/macros/latex-dev/required/tools/indentfirst.dtx
index 2314db1c70..9bbe1871e1 100644
--- a/macros/latex-dev/required/tools/indentfirst.dtx
+++ b/macros/latex-dev/required/tools/indentfirst.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
diff --git a/macros/latex-dev/required/tools/indentfirst.pdf b/macros/latex-dev/required/tools/indentfirst.pdf
index 235e364993..96440b6c57 100644
--- a/macros/latex-dev/required/tools/indentfirst.pdf
+++ b/macros/latex-dev/required/tools/indentfirst.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/layout.dtx b/macros/latex-dev/required/tools/layout.dtx
index 2798bd4f60..a2fc87a6a5 100644
--- a/macros/latex-dev/required/tools/layout.dtx
+++ b/macros/latex-dev/required/tools/layout.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
diff --git a/macros/latex-dev/required/tools/layout.pdf b/macros/latex-dev/required/tools/layout.pdf
index 4e0722c710..b2d34d40fc 100644
--- a/macros/latex-dev/required/tools/layout.pdf
+++ b/macros/latex-dev/required/tools/layout.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/longtable.dtx b/macros/latex-dev/required/tools/longtable.dtx
index 2a61ab0c87..5a23f3ecb3 100644
--- a/macros/latex-dev/required/tools/longtable.dtx
+++ b/macros/latex-dev/required/tools/longtable.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
@@ -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>
@@ -1048,6 +1048,14 @@
\if@twocolumn
\LT@err{longtable not in 1-column mode}\@ehc
\fi
+% \end{macrocode}
+%
+% \changes{v4.19}{2023/12/16}{Support for tagged PDF}
+% \begin{macrocode}
+ \UseTaggingSocket{tbl/vmode/begin}%
+% \end{macrocode}
+%
+% \begin{macrocode}
\begingroup
% \end{macrocode}
% Check for an optional argument.
@@ -1056,7 +1064,14 @@
% \end{macrocode}
% \end{macro}
%
+%
+%
% \begin{macro}{\LT@array}
+% \begin{macrocode}
+%<@@=tbl>
+\ExplSyntaxOn
+% \end{macrocode}
+%
% Start setting the alignment.
% Based on "\@array" from the \LaTeX\ kernel
% and the \package{array} package.
@@ -1066,7 +1081,43 @@
% so that "\caption" works correctly.
% \begin{macrocode}
\def\LT@array[#1]#2{%
- \refstepcounter{table}\stepcounter{LT@tables}%
+% \end{macrocode}
+%
+% With respect to tagging we have a complicated situation with
+% longtable. When at the begin the \cs{endhead},
+% \cs{endfirsthead}, \cs{endfoot} and \cs{endlastfoot} are used to
+% setup head and foot they create each a structure subtree with one or
+% more rows. From these structures we want to keep at most two (head
+% and foot) and move the foot to the end of the table. When the head
+% and foot boxes are (re)inserted on following pages we want to mark
+% them up as artifact with the exception of the head at the begin and
+% the foot box at the end.
+%
+% TODO: When a line is killed the structure subtree is there already
+% too and must be removed. If hard to do, then maybe at first warn if the
+% construction is used.
+%
+% \cs{LT@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@refstepcounter{table}\stepcounter{LT@tables}
+% \end{macrocode}
+% The target is created rather late and a \cs{label} can come earlier,
+% so we have to define \cs{@currentHref} explicitly. We can't currently
+% assume that \cs{theHtable} is defined always.
+% \begin{macrocode}
+ \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_gzero_row_count:
+% \end{macrocode}
+%
+% \changes{v4.19}{2023/12/16}{Support for tagged PDF}
+% \begin{macrocode}
+ \UseTaggingSocket{tbl/longtable/init}
% \end{macrocode}
% Set up the glue around the table if an optional argument given.
% \begin{macrocode}
@@ -1101,17 +1152,18 @@
% here so that you can load the \package{array} package before or after
% \package{longtable}.
% \begin{macrocode}
- \let\LT@@tabarray\@tabarray
- \let\LT@@hl\hline
+ \let\LT@@@@tabarray\@tabarray
+ \let\LT@@@@hl\hline
\def\@tabarray{%
- \let\hline\LT@@hl
+ \let\hline\LT@@@@hl
% \end{macrocode}
%\begin{verbatim}
% \let\multicolumn\LT@mcol
%\end{verbatim}
% \begin{macrocode}
- \LT@@tabarray}%
- \let\\\LT@tabularcr\let\tabularnewline\\%
+ \LT@@@@tabarray}%
+ \let\\\LT@tabularcr
+ \let\tabularnewline\\%
\def\newpage{\noalign{\break}}%
% \end{macrocode}
% \changes{v4.05}{1996/11/12}
@@ -1128,8 +1180,8 @@
% \end{macrocode}
%
% \changes{v4.08}{1998/01/20}
-% {Move \cs{@endpbox} definition earlier and define \cs{@@endpbox}
-% and \cs{@@startpbox} for non-array case. tools/2736}
+% {Move \cs{@endpbox} definition earlier and define \cs{@@@@endpbox}
+% and \cs{@@@@startpbox} for non-array case. tools/2736}
% \begin{macrocode}
\let\@endpbox\LT@endpbox
% \end{macrocode}
@@ -1142,8 +1194,8 @@
\let\@acol\@tabacol
\let\@classz\@tabclassz \let\@classiv\@tabclassiv
\def\@startpbox{\vtop\LT@startpbox}%
- \let\@@startpbox\@startpbox
- \let\@@endpbox\@endpbox
+ \let\@@@@startpbox\@startpbox
+ \let\@@@@endpbox\@endpbox
\let\LT@LL@FM@cr\@tabularcr
\else
% \end{macrocode}
@@ -1172,6 +1224,11 @@
\begingroup
\@mkpream{#2}%
% \end{macrocode}
+%
+% \changes{v4.19}{2023/12/16}{Managing cell indexes}
+% \begin{macrocode}
+ \tbl_count_table_cols:
+% \end{macrocode}
% We need to rename "\@preamble" here as F.M.'s scheme uses
% "\global", and we may need to nest "\@mkpream", eg for
% "\multicolumn"
@@ -1180,6 +1237,11 @@
% \begin{macrocode}
\xdef\LT@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}
% \changes{v4.00}{1996/04/08}
% {(DK) Increment Chunk counter}
% \begin{macrocode}
@@ -1205,7 +1267,21 @@
% \begin{macrocode}
\tabskip\LTleft \noexpand\halign to\hsize\bgroup
% \tabskip\LTleft\halign to\hsize\bgroup
- \tabskip\z@ \@arstrut \@preamble \tabskip\LTright \cr}%
+ \tabskip\z@ \@arstrut
+% \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}
+ \@preamble \tabskip\LTright \cr}%
\endgroup
% \end{macrocode}
% Find out how many columns we have (store in "\LT@cols").
@@ -1220,11 +1296,57 @@
% A few more internal commands for \env{longtable}.
% \begin{macrocode}
\m@th\let\par\@empty
- \everycr{}\lineskip\z@\baselineskip\z@
+% \end{macrocode}
+% Tagging socket and conditional
+% \begin{macrocode}
+ \everycr{%
+ \noalign{%
+% \end{macrocode}
+% 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@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}
+% \end{macrocode}
+% 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:
+ }
+% \end{macrocode}
+% And for the same reason such \cs{cr}s should not increment the
+% main row counter (but it has to be incremented after the preamble
+% of a chunk), so here we test against \cs{LT@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@rows < \LTchunksize
+ { \tbl_gincr_row_count: } % next is row about to start
+ }%
+ }%
+% \end{macrocode}
+% \begin{macrocode}
+ \lineskip\z@\baselineskip\z@
% \end{macrocode}
% Start the first chunk.
% \begin{macrocode}
\LT@bchunk}
+\ExplSyntaxOff
+%<@@=>
% \end{macrocode}
% \end{macro}
%
@@ -1251,6 +1373,11 @@
% force the page-breaker to wake up. The second "\endgraf" is there so
% that "\pagetotal" is updated and so takes "\LTpre" into account.
% \begin{macrocode}
+%<@@=tbl>
+\ExplSyntaxOn
+% \end{macrocode}
+%
+% \begin{macrocode}
\def\LT@start{%
\let\LT@start\endgraf
\endgraf\penalty\z@\vskip\LTpre\endgraf
@@ -1334,7 +1461,7 @@
% \changes{v3.14}{1995/05/02}
% {Set \cs{@colroom}, for tools/1584}
% \begin{macrocode}
- \global\@colroom\@colht
+ \global\@colroom\@colht
% \end{macrocode}
% If the foot is non empty, reduce the "\vsize" and "\@colroom"
% accordingly.
@@ -1342,24 +1469,46 @@
% {Rearrange vertical space tests for tools/3512 (floats on same page)}
% \begin{macrocode}
\ifvoid\LT@foot\else
-% \advance\vsize-\ht\LT@foot
\global\advance\vsize-\ht\LT@foot
\global\advance\@colroom-\ht\LT@foot
\dimen@\pagegoal\advance\dimen@-\ht\LT@foot\pagegoal\dimen@
\maxdepth\z@
\fi
% \end{macrocode}
+%
+% \begin{macrocode}
+ \MakeLinkTarget{table}
+% \end{macrocode}
% Put the table head on the page, and then switch to the new output
% routine.
% \changes{v4.11}{2004/02/01}
% {\cs{nobreak}, for tools/3484}
% \begin{macrocode}
\ifvoid\LT@firsthead\copy\LT@head\else\box\LT@firsthead\fi\nobreak
+% \end{macrocode}
+%
+% \changes{v4.19}{2023/12/16}{Support for tagged PDF}
+% \begin{macrocode}
+ \UseTaggingSocket{tbl/longtable/head}
+% \end{macrocode}
+%
+% \begin{macrocode}
\output{\LT@output}}
+\ExplSyntaxOff
+%<@@=>
% \end{macrocode}
% \end{macro}
%
+%
+%
+%
% \begin{macro}{\endlongtable}
+%
+% \begin{macrocode}
+%<@@=tbl>
+\ExplSyntaxOn
+% \end{macrocode}
+%
% Called by "\end{longtable}".
% \begin{macrocode}
\def\endlongtable{%
@@ -1370,11 +1519,23 @@
% 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.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@entry@chop}}
% \begin{macrocode}
- \crcr
\noalign{%
+% \end{macrocode}
+%
+% \changes{v4.19}{2023/12/16}{Support for tagged PDF}
+% \begin{macrocode}
+ \UseTaggingSocket{tbl/longtable/finalize}
+% \end{macrocode}
+%
+% \begin{macrocode}
\let\LT@entry\LT@entry@chop
\xdef\LT@save@row{\LT@save@row}}%
\LT@echunk
@@ -1414,10 +1575,10 @@
% \changes{v4.04}{1996/05/24}
% {Use \cs{LT@final@warn}}
% \begin{macrocode}
- \ifx\LT@save@row\LT@@save@row
+ \ifx\LT@save@row\LT@@@@save@row
\else
- \LT@warn{Column \@width s have changed\MessageBreak
- in table \thetable}%
+ \LT@warn{Column~ widths~ have~ changed\MessageBreak
+ in~ table~ \thetable}%
\LT@final@warn
\fi
% \end{macrocode}
@@ -1449,7 +1610,15 @@
% \end{macrocode}
% Footnotes. As done in the \package{multicol} package.
% \begin{macrocode}
- \ifvoid\footins\else\insert\footins{}\fi}
+ \ifvoid\footins\else\insert\footins{}\fi
+% \end{macrocode}
+%
+% \changes{v4.19}{2023/12/16}{Support for tagged PDF}
+% \begin{macrocode}
+ \UseTaggingSocket{tbl/vmode/end}%
+}
+\ExplSyntaxOff
+%<@@=>
% \end{macrocode}
% \end{macro}
%
@@ -1518,6 +1687,10 @@
\protected\def\LT@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@crcr\noalign{\nobreak}}\let\cr\crcr
\LT@t@bularcr}%
{\LT@t@bularcr}}
@@ -1544,8 +1717,13 @@
% \end{macrocode}
% \end{macro}
%
+%
+%
+%
% \begin{macro}{\LT@t@bularcr}
% \begin{macrocode}
+%<@@=tbl>
+\ExplSyntaxOn
\def\LT@t@bularcr{%
% \end{macrocode}
% Increment the counter, and do \env{tabular}'s "\\" or finish the
@@ -1555,6 +1733,13 @@
% \begin{macrocode}
\global\advance\LT@rows\@ne
\ifnum\LT@rows=\LTchunksize
+% \end{macrocode}
+% At the end of the chunk \verb=\\= is doing something special and
+% so we lose \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@setprevdepth{%
\prevdepth\z@
\global\let\LT@setprevdepth\relax}%
@@ -1563,6 +1748,8 @@
\ifnum0=`{}\fi
\expandafter\LT@LL@FM@cr
\fi}
+\ExplSyntaxOff
+%<@@=>
% \end{macrocode}
% \end{macro}
%
@@ -1943,7 +2130,9 @@
% This code is based on "\cline". Two copies of the line are produced,
% as described above.
% \begin{macrocode}
-\def\LT@@hline{%
+%<@@=tbl>
+\ExplSyntaxOn
+\def\LT@@@@hline{%
\ifx\@let@token\hline
\global\let\@gtempa\@gobble
\gdef\LT@sep{\penalty-\@medpenalty\vskip\doublerulesep}%
@@ -1954,11 +2143,25 @@
\ifnum0=`{\fi}%
\multispan\LT@cols
\unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
- \noalign{\LT@sep}%
+% \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{
+ \tbl_gdecr_row_count:
+ \LT@sep}
\multispan\LT@cols
\unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
- \noalign{\penalty\@M}%
+% \end{macrocode}
+% Same here.
+% \changes{v4.19}{2023/12/16}{Managing cell indexes}
+% \begin{macrocode}
+ \noalign{
+ \tbl_gdecr_row_count:
+ \penalty\@M}
\@gtempa}
+\ExplSyntaxOff
+%<@@=>
% \end{macrocode}
% \end{macro}
%
@@ -2049,13 +2252,15 @@
% \begin{macro}{\LT@output}
% Actually this is not so bad, with FM leading the way.
% \begin{macrocode}
+%<@@=tbl>
+\ExplSyntaxOn
\def\LT@output{%
\ifnum\outputpenalty <-\@Mi
\ifnum\outputpenalty > -\LT@end@pen
% \end{macrocode}
% If this was a float or a marginpar we complain.
% \begin{macrocode}
- \LT@err{floats and marginpars not allowed in a longtable}\@ehc
+ \LT@err{floats~ and~ marginpars~ not~ allowed~ in~ a~ longtable}\@ehc
\else
% \end{macrocode}
% We have reached the end of the table, on the scroll at least,
@@ -2103,6 +2308,13 @@
% \begin{macrocode}
\unvbox\z@\box\ifvoid\LT@lastfoot\LT@foot\else\LT@lastfoot\fi
% \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}
+%
% End of "\ifnum\outputpenalty > -\LT@end@pen".
% \begin{macrocode}
\fi
@@ -2114,6 +2326,15 @@
% If we have not reached the end of the table,
% \begin{macrocode}
\setbox\@cclv\vbox{\unvbox\@cclv\copy\LT@foot\vss}%
+% \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}
+%
+% \begin{macrocode}
\@makecol
\@outputpage
% \end{macrocode}
@@ -2133,8 +2354,15 @@
% \begin{macrocode}
\fi}
% \end{macrocode}
+%
+% \begin{macrocode}
+\ExplSyntaxOff
+%<@@=>
+% \end{macrocode}
% \end{macro}
%
+%
+%
% \subsection{Commands for the table head and foot}
%
% \begin{macro}{\LT@end@hd@ft}
@@ -2142,20 +2370,86 @@
% box specified by "#1". Issue an error if the table has already
% started. Then start a new chunk.
% \begin{macrocode}
+%<@@=tbl>
+\ExplSyntaxOn
\def\LT@end@hd@ft#1{%
+% \end{macrocode}
+%
+% This command is used to store the head and foot boxes.
+% We need to retrieve and store the row so that we can clean
+% 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@rows + 1 }
+ {
+ \seq_gput_left:ce
+ {g_@@_\cs_to_str:N #1 _rows_seq }
+ { \int_eval:n {\g_@@_row_int + 1 - ##1 } }
+ }
+% \end{macrocode}
+% We also have to set the chunk rows to its max value before
+% calling \cs{LTechunk} so that we don't get extra increments of
+% the main row counter due to \cs{everycr}.
+% \begin{macrocode}
+ \int_gset:Nn \LT@rows { \LTchunksize }
+ }
+% \end{macrocode}
+
+% If we are still in column zero then we had an empty \cs{endhead}
+% 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@echunk}. That will then trigger \cs{everycr}
+% 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@rows} so that further \cs{cr}s do not do
+% any harm (as explained above.
+%
+% The \cs{crcr} inside \cs{LT@echunk} will be bypassed in that case
+% as we have just executed a \cs{crcr} and are still in scanning modus for
+% \cs{omit} or \cs{noalign}.
+% \begin{macrocode}
+ {
+ \crcr
+ \noalign{
+% \end{macrocode}
+%
+% \changes{v4.19}{2023/12/16}{Managing cell indexes}
+% \begin{macrocode}
+ \tbl_gdecr_row_count: % undo the increment
+ \int_gset:Nn \LT@rows { \LTchunksize }
+ }
+ }
\LT@echunk
% \end{macrocode}
% Changed from "\relax" to "\endgraf" at V3.04, see "\LT@start".
% \begin{macrocode}
\ifx\LT@start\endgraf
\LT@err
- {Longtable head or foot not at start of table}%
- {Increase LTchunksize}%
+ {Longtable~ head~ or~ foot~ not~ at~ start~ of~ table}%
+ {Increase~ LTchunksize}%
\fi
\setbox#1\box\z@
+ \@@_trace:n {-->>~ Saving~\noexpand#1}
\LT@get@widths
\LT@bchunk}
% \end{macrocode}
+%
+% \begin{macrocode}
+\ExplSyntaxOff
+%<@@=>
+% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\endfirsthead}
@@ -2255,6 +2549,24 @@
% \end{macrocode}
% \end{macro}
%
+%
+%
+%
+%
+% Some variables need for the tagging support.
+% \begin{macrocode}
+%<@@=tbl>
+\ExplSyntaxOn
+ \seq_new:N \g_@@_LT@firsthead_rows_seq
+ \seq_new:N \g_@@_LT@head_rows_seq
+ \seq_new:N \g_@@_LT@lastfoot_rows_seq
+ \seq_new:N \g_@@_LT@foot_rows_seq
+\ExplSyntaxOff
+%<@@=>
+% \end{macrocode}
+%
+%
+%
% \begin{macrocode}
%</package>
% \end{macrocode}
diff --git a/macros/latex-dev/required/tools/longtable.ins b/macros/latex-dev/required/tools/longtable.ins
index 5c3ad27063..60b7461571 100644
--- a/macros/latex-dev/required/tools/longtable.ins
+++ b/macros/latex-dev/required/tools/longtable.ins
@@ -3,7 +3,7 @@
%% driver files from the doc files in this package when run through
%% LaTeX or TeX.
%%
-%% Copyright (C) 1993-2023
+%% Copyright (C) 1993-2024
%% The LaTeX Project and any individual authors listed elsewhere
%% in this file.
%%
@@ -45,7 +45,7 @@ The source is maintained by the LaTeX Project team and bug
reports for it can be opened at https://latex-project.org/bugs/
(but please observe conditions on bug reports sent to that address!)
-Copyright (C) 1993-2023
+Copyright (C) 1993-2024
The LaTeX Project and any individual authors listed elsewhere
in this file.
diff --git a/macros/latex-dev/required/tools/longtable.pdf b/macros/latex-dev/required/tools/longtable.pdf
index f24ff36f4f..5fb3c4a917 100644
--- a/macros/latex-dev/required/tools/longtable.pdf
+++ b/macros/latex-dev/required/tools/longtable.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/multicol.dtx b/macros/latex-dev/required/tools/multicol.dtx
index 2676d03aa1..9c680ab563 100644
--- a/macros/latex-dev/required/tools/multicol.dtx
+++ b/macros/latex-dev/required/tools/multicol.dtx
@@ -99,10 +99,10 @@
%<driver> \ProvidesFile{multicol.drv}
% \fi
% \ProvidesFile{multicol.dtx}
- [2023/03/30 v1.9f multicolumn formatting (FMi)]
+ [2024/01/29 v1.9g multicolumn formatting (FMi)]
+%
%
%
-%%
%
% \changes{v1.9c}{2021/11/30}{Added rollback to v1.8}
% \changes{v1.5n}{1997/06/05}{Applied improvement of documentation,
@@ -919,9 +919,22 @@
% And we don't show macro names in the margin.
% \begin{macrocode}
\setcounter{IndexColumns}{4}
-\let\DescribeMacro\SpecialUsageIndex
-\let\DescribeEnv\SpecialEnvIndex
-\renewcommand\PrintMacroName[1]{}
+% \end{macrocode}
+%
+% The following redefinitions have to be moved until after the
+% preamble because version 3 of \pkg{doc} resets them after the
+% premable (this is tmp, because \pkg{hypdoc} is not yet
+% integrated, but as we all know, tmp solutions have a tendency to
+% survive for a long time\ldots).
+% \begin{macrocode}
+\AddToHook{begindocument}{%
+ \let\DescribeMacro\SpecialUsageIndex
+ \let\DescribeEnv\SpecialEnvIndex
+ \renewcommand\PrintMacroName[1]{}%
+}
+% \end{macrocode}
+%
+% \begin{macrocode}
\CodelineIndex
%\DisableCrossrefs % Partial index
\RecordChanges % Change log
@@ -1082,7 +1095,7 @@
% better test for this situation. Otherwise, we will get a \TeX{}
% stack overflow as this would generate a self-referencing definition.
% \changes{v1.6e}{2004/02/14}{Avoid self-referencing definition of
-% \cs{@footnotetext} (pr/3618)}.
+% \cs{@footnotetext} (pr/3618)}
% \begin{macrocode}
\ifx\@footnotetext\mult@footnotetext
\else
@@ -2376,7 +2389,7 @@
% If |\raggedcolumns| is in force we add a |vfill| at the bottom by
% unboxing the split box.
% But we need to unbox anyway to ensure that at the end of the box
-% we do not have unwanted space. This can sneak in in certain
+% we do not have unwanted space. This can sneak in, in certain
% situations, for example, if two lists follow each other and we
% break between them. While such space is usually zero it still has
% an effect because it hides depth of the last line in the column
@@ -2925,7 +2938,11 @@
% We start by setting the kept marks by updating them with any
% marks from this box. This has to be done \emph{before} we add a
% penalty of $-10000$ to the top of the box, otherwise only an
-% empty box will be considered.
+% empty box will be considered. But even that is not enough: the box
+% may contain \cs{columnbreak}s in which case doing some artifical
+% splitting to get the marks out still fails to see all marks
+% unless we take some special precaution in \cs{get@keptmarks}
+% (which is now done).
% \changes{v1.5h}{1994/08/26}{Get kept marks first}
% \begin{macrocode}
\get@keptmarks\mult@box
@@ -3751,8 +3768,15 @@
% everything is split off. As a result |\splitfirstmark| and
% |\splitbotmark| will contain the first and last mark in the box
% respectively.
+%
+% Unfortunately, a simple \cs{vsplit} is not enough if the material
+% contains forced breaks in that case we first have to get rid of
+% those which is why we do this work in a separate macro that can
+% call itself recursively.
+% \changes{v1.9g}{2023/11/10}{Get rid of forced breaks for mark
+% extraction (gh/1130)}
% \begin{macrocode}
- \setbox#1\vsplit#1to\maxdimen
+ \mc@get@all@box@marks #1%
% \end{macrocode}
% Therefore we can now set the kept marks which is a global
% operation and afterwards close the group. This will restore the
@@ -3773,6 +3797,29 @@
% \end{macro}
%
%
+% \begin{macro}{\mc@get@all@box@marks}
+% This macro splits a box to \cs{maxdimen} in order to get at the
+% marks inside. If it turns out that we have a remainder after the
+% split (e.g., if there was a \cs{columnbreak} in the material) we
+% stitch the two parts together again (which omits the forced
+% break) and recurse. Eventually, everything is split off and the
+% split marks will then have the appropriate values.
+% \changes{v1.9g}{2023/11/10}{Get rid of forced breaks for mark
+% extraction (gh/1130)}
+% \begin{macrocode}
+\def\mc@get@all@box@marks #1{%
+ \setbox\@tempboxa\vsplit#1to\maxdimen
+ \ifvoid#1\else
+ \setbox#1\vbox{\unvbox\@tempboxa \unvbox#1}%
+ \mc@get@all@box@marks #1%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
% \begin{macro}{\set@keptmarks}
% The macro |\set@keptmarks| is responsible for setting
% |\kept@firstmark| and |\kept@botmark|, by checking the current
diff --git a/macros/latex-dev/required/tools/multicol.ins b/macros/latex-dev/required/tools/multicol.ins
index fa561e0bb1..7a7ef27d24 100644
--- a/macros/latex-dev/required/tools/multicol.ins
+++ b/macros/latex-dev/required/tools/multicol.ins
@@ -3,7 +3,7 @@
%% driver files from the doc files in this package when run through
%% LaTeX or TeX.
%%
-%% Copyright (C) 1993-2023
+%% Copyright (C) 1993-2024
%% The LaTeX Project and any individual authors listed elsewhere
%% in this file.
%%
@@ -45,7 +45,7 @@ The source is maintained by the LaTeX Project team and bug
reports for it can be opened at https://latex-project.org/bugs/
(but please observe conditions on bug reports sent to that address!)
-Copyright (C) 1993-2023
+Copyright (C) 1993-2024
The LaTeX Project and any individual authors listed elsewhere
in this file.
diff --git a/macros/latex-dev/required/tools/multicol.pdf b/macros/latex-dev/required/tools/multicol.pdf
index 031d1920fa..360c09d0b9 100644
--- a/macros/latex-dev/required/tools/multicol.pdf
+++ b/macros/latex-dev/required/tools/multicol.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/rawfonts.dtx b/macros/latex-dev/required/tools/rawfonts.dtx
index 4b930f3ea7..3ffa2032c3 100644
--- a/macros/latex-dev/required/tools/rawfonts.dtx
+++ b/macros/latex-dev/required/tools/rawfonts.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
diff --git a/macros/latex-dev/required/tools/rawfonts.pdf b/macros/latex-dev/required/tools/rawfonts.pdf
index 08f8d71317..98bfaa374a 100644
--- a/macros/latex-dev/required/tools/rawfonts.pdf
+++ b/macros/latex-dev/required/tools/rawfonts.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/shellesc.dtx b/macros/latex-dev/required/tools/shellesc.dtx
index aa707fe550..8a556de922 100644
--- a/macros/latex-dev/required/tools/shellesc.dtx
+++ b/macros/latex-dev/required/tools/shellesc.dtx
@@ -1,6 +1,6 @@
% \iffalse
%% Source File: shellesc.dtx
-%% Copyright (C) 2015-2023
+%% Copyright (C) 2015-2024
%%
%% The LaTeX Project and any individual authors listed elsewhere
%% in this file.
diff --git a/macros/latex-dev/required/tools/shellesc.pdf b/macros/latex-dev/required/tools/shellesc.pdf
index ee1a87cc01..c41228c1b9 100644
--- a/macros/latex-dev/required/tools/shellesc.pdf
+++ b/macros/latex-dev/required/tools/shellesc.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/showkeys.dtx b/macros/latex-dev/required/tools/showkeys.dtx
index c90b3863e1..aba96a7eab 100644
--- a/macros/latex-dev/required/tools/showkeys.dtx
+++ b/macros/latex-dev/required/tools/showkeys.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
@@ -22,7 +22,7 @@
% \fi
% \iffalse
%% File: showkeys.dtx Copyright (C) 1992-1997 David Carlisle
-%% File: showkeys.dtx Copyright (C) 2006-2019 David Carlisle, LaTeX Project
+%% File: showkeys.dtx Copyright (C) 2006-2023 David Carlisle, LaTeX Project
%
%<*dtx>
\ProvidesFile{showkeys.dtx}
@@ -39,7 +39,7 @@
%<driver> \ProvidesFile{showkeys.drv}
% \fi
% \ProvidesFile{showkeys.dtx}
- [2023/07/08 v3.19 Show cite and label keys (DPC, MH)]
+ [2023/12/16 v3.20 Show cite and label keys (DPC, MH)]
%
% \iffalse
%<*driver>
@@ -417,6 +417,8 @@
% \end{macrocode}
% \changes{v3.02}{1995/03/17}
% {New code for `in label' case.}
+% \changes{v3.20}{2023/12/16}
+% {Avoid adding an extra box layer github/1123}
% If the |\label| is straight after |\item| (|\bibitem| is handled by
% this case as well) then the item label has not been added to the page
% yet. It is hanging around in the box |\@labels| waiting for the
@@ -425,7 +427,7 @@
\global\setbox\@labels\hbox{%
\llap{\SK@lab\SK@lab@relax
\kern\@totalleftmargin\kern\marginparsep}%
- \box\@labels}%
+ \unhbox\@labels}%
% \end{macrocode}
%
% \begin{macrocode}
diff --git a/macros/latex-dev/required/tools/showkeys.pdf b/macros/latex-dev/required/tools/showkeys.pdf
index 2d4da0c5a7..6b1ae4549e 100644
--- a/macros/latex-dev/required/tools/showkeys.pdf
+++ b/macros/latex-dev/required/tools/showkeys.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/somedefs.dtx b/macros/latex-dev/required/tools/somedefs.dtx
index 02653a1393..156621d70e 100644
--- a/macros/latex-dev/required/tools/somedefs.dtx
+++ b/macros/latex-dev/required/tools/somedefs.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
diff --git a/macros/latex-dev/required/tools/somedefs.pdf b/macros/latex-dev/required/tools/somedefs.pdf
index 9d282b58f3..07a32befaa 100644
--- a/macros/latex-dev/required/tools/somedefs.pdf
+++ b/macros/latex-dev/required/tools/somedefs.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/tabularx.dtx b/macros/latex-dev/required/tools/tabularx.dtx
index 6d59ca4c22..52ee62cad9 100644
--- a/macros/latex-dev/required/tools/tabularx.dtx
+++ b/macros/latex-dev/required/tools/tabularx.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
@@ -31,7 +31,7 @@
%<driver> \ProvidesFile{tabularx.drv}
% \fi
% \ProvidesFile{tabularx.dtx}
- [2023/07/08 v2.11c `tabularx' package (DPC)]
+ [2023/12/11 v2.12a `tabularx' package (DPC)]
% \iffalse
%<*driver>
\documentclass{ltxdoc}
@@ -261,6 +261,25 @@
% This behaviour of the package can be customised slightly
% as noted in the documentation of the code section.
%
+% \section{Support for tagged PDF}
+%
+% With version 2.12a the package is made tagging aware, which means that
+% it will automatically produce tagged tables (necessary, for example, for
+% accessibility) if tagging is requested via \cs{DocumentMetadata}.
+%
+% More granular control, e.g., explicitly deciding which cells are
+% header cells, etc., is currently under development, but syntax for
+% this will not appear in this package. Instead it will become
+% available across all tabular-generating packages and then
+% automatically apply here as well.
+%
+% Enabling \LaTeX{} to automatically produce tagged PDF is a long-term
+% project and this is a tiny step in this puzzle. For more information
+% on the project and already available functionality, see
+% \url{https://latex-project.org/publications/indexbytopic/pdf} and
+% \url{https://github.com/latex3/tagging-project}.
+%
+%
% \MaybeStop{}
%
% \section{The Macros}
@@ -269,6 +288,14 @@
%<*package>
% \end{macrocode}
%
+% We only need two changes for tagging support, but they require
+% that a recent \LaTeX{} kernel is used (which should be no problem
+% if \texttt{tools} is distributed in parallel with the kernel.
+% \changes{v2.12a}{2023/12/11}{Require newer LaTeX kernel}
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[2024/06/01]
+% \end{macrocode}
+%
% \changes{v2.00}{1994/02/07}
% {New Option Handling}
% \begin{macrocode}
@@ -506,7 +533,15 @@
% \begin{macrocode}
\TX@typeout@
{\@spaces Table Width\@spaces Column Width\@spaces X Columns}%
-% \end{macrocode}%
+% \end{macrocode}
+%
+% While we do trial typesetting we suspend any tagging if that is
+% active:
+% \changes{v2.12a}{2023/12/11}
+% {Suspend any tagging while doing trial typesetting}
+% \begin{macrocode}
+ \SuspendTagging {tabularx}%
+% \end{macrocode}
% First attempt. Modify the {\ttfamily X} definition to count {\ttfamily
% X} columns.
% \begin{macrocode}
@@ -523,6 +558,12 @@
\TX@trial{}%
\repeat
% \end{macrocode}
+%
+% And here we restart it again:
+% \begin{macrocode}
+ \ResumeTagging {tabularx}%
+% \end{macrocode}
+%
% One last time, with warnings back on (see appendix D)
% use {\ttfamily tabular*} to put it in a box of the right size, in case
% the algorithm failed to find the correct size.
@@ -737,8 +778,9 @@
% Make the table, and finish the hbox.
% Since v1.06, "\toks@" contains the preamble specification,
% and possible optional argument, as well as the table body.
+%
% \begin{macrocode}
- \expandafter\tabular\the\toks@
+ \expandafter\tabular\the\toks@
\endtabular}%
% \end{macrocode}
% Since v1.05 reset all \LaTeX\ counters, by executing "\TX@ckpt".
@@ -961,6 +1003,7 @@
% \end{macrocode}
% \end{macro}
%
+%
% \begin{macrocode}
%</package>
% \end{macrocode}
diff --git a/macros/latex-dev/required/tools/tabularx.ins b/macros/latex-dev/required/tools/tabularx.ins
index 6e81e93432..fdce598d37 100644
--- a/macros/latex-dev/required/tools/tabularx.ins
+++ b/macros/latex-dev/required/tools/tabularx.ins
@@ -3,7 +3,7 @@
%% driver files from the doc files in this package when run through
%% LaTeX or TeX.
%%
-%% Copyright (C) 1993-2023
+%% Copyright (C) 1993-2024
%% The LaTeX Project and any individual authors listed elsewhere
%% in this file.
%%
@@ -45,7 +45,7 @@ The source is maintained by the LaTeX Project team and bug
reports for it can be opened at https://latex-project.org/bugs/
(but please observe conditions on bug reports sent to that address!)
-Copyright (C) 1993-2023
+Copyright (C) 1993-2024
The LaTeX Project and any individual authors listed elsewhere
in this file.
diff --git a/macros/latex-dev/required/tools/tabularx.pdf b/macros/latex-dev/required/tools/tabularx.pdf
index 9f68f26643..28b61a3da3 100644
--- a/macros/latex-dev/required/tools/tabularx.pdf
+++ b/macros/latex-dev/required/tools/tabularx.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/theorem.dtx b/macros/latex-dev/required/tools/theorem.dtx
index e3a8e90b8c..a9c3ccae3e 100644
--- a/macros/latex-dev/required/tools/theorem.dtx
+++ b/macros/latex-dev/required/tools/theorem.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
diff --git a/macros/latex-dev/required/tools/theorem.pdf b/macros/latex-dev/required/tools/theorem.pdf
index 5cdc977c98..96c8c8512f 100644
--- a/macros/latex-dev/required/tools/theorem.pdf
+++ b/macros/latex-dev/required/tools/theorem.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/tools-overview.pdf b/macros/latex-dev/required/tools/tools-overview.pdf
index 300602a9ed..b5dd0670fb 100644
--- a/macros/latex-dev/required/tools/tools-overview.pdf
+++ b/macros/latex-dev/required/tools/tools-overview.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/tools-overview.tex b/macros/latex-dev/required/tools/tools-overview.tex
index 3bc325d67c..54f4b5ed63 100644
--- a/macros/latex-dev/required/tools/tools-overview.tex
+++ b/macros/latex-dev/required/tools/tools-overview.tex
@@ -1,7 +1,7 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{tools-overview.tex}[2015/03/31 v1.0 Tools overview]
-% Copyright (C) 2006-2023
+% Copyright (C) 2006-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
diff --git a/macros/latex-dev/required/tools/tools.ins b/macros/latex-dev/required/tools/tools.ins
index 6898faead3..2fd1cd174b 100644
--- a/macros/latex-dev/required/tools/tools.ins
+++ b/macros/latex-dev/required/tools/tools.ins
@@ -3,7 +3,7 @@
%% driver files from the doc files in this package when run through
%% LaTeX or TeX.
%%
-%% Copyright (C) 1993-2023
+%% Copyright (C) 1993-2024
%% The LaTeX Project and any individual authors listed elsewhere
%% in this file.
%%
@@ -49,7 +49,7 @@ reports for it can be opened at https://latex-project.org/bugs/
(but please observe conditions on bug reports sent to that address!)
-Copyright (C) 1993-2023
+Copyright (C) 1993-2024
The LaTeX Project and any individual authors listed elsewhere
in this file.
diff --git a/macros/latex-dev/required/tools/trace.dtx b/macros/latex-dev/required/tools/trace.dtx
index 788f831620..27a39c776b 100644
--- a/macros/latex-dev/required/tools/trace.dtx
+++ b/macros/latex-dev/required/tools/trace.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
diff --git a/macros/latex-dev/required/tools/trace.pdf b/macros/latex-dev/required/tools/trace.pdf
index 7ddd4fc6b7..f0065a21c3 100644
--- a/macros/latex-dev/required/tools/trace.pdf
+++ b/macros/latex-dev/required/tools/trace.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/varioref.dtx b/macros/latex-dev/required/tools/varioref.dtx
index e801c54f81..ccf3468c9b 100644
--- a/macros/latex-dev/required/tools/varioref.dtx
+++ b/macros/latex-dev/required/tools/varioref.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
diff --git a/macros/latex-dev/required/tools/varioref.ins b/macros/latex-dev/required/tools/varioref.ins
index dcc41d0176..88527a20ba 100644
--- a/macros/latex-dev/required/tools/varioref.ins
+++ b/macros/latex-dev/required/tools/varioref.ins
@@ -3,7 +3,7 @@
%% driver files from the doc files in this package when run through
%% LaTeX or TeX.
%%
-%% Copyright (C) 1993-2023
+%% Copyright (C) 1993-2024
%% The LaTeX Project and any individual authors listed elsewhere
%% in this file.
%%
@@ -45,7 +45,7 @@ The source is maintained by the LaTeX Project team and bug
reports for it can be opened at https://latex-project.org/bugs/
(but please observe conditions on bug reports sent to that address!)
-Copyright (C) 1993-2023
+Copyright (C) 1993-2024
The LaTeX Project and any individual authors listed elsewhere
in this file.
diff --git a/macros/latex-dev/required/tools/varioref.pdf b/macros/latex-dev/required/tools/varioref.pdf
index 6a8d722fd7..01a079a5ff 100644
--- a/macros/latex-dev/required/tools/varioref.pdf
+++ b/macros/latex-dev/required/tools/varioref.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/verbatim.dtx b/macros/latex-dev/required/tools/verbatim.dtx
index 832f80ef3a..468dead3e8 100644
--- a/macros/latex-dev/required/tools/verbatim.dtx
+++ b/macros/latex-dev/required/tools/verbatim.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
@@ -55,7 +55,7 @@
\and
Chris Rowley}
-\date{2023/07/08}
+\date{2023/11/06}
\begin{document}
\markboth{Verbatim style option}{Verbatim style option}
\MaintainedByLaTeXTeam{tools}
@@ -69,6 +69,8 @@
%\fi
%
%
+%
+% \changes{v1.5x}{2024/01/22}{Added TAB marking support to \cs{verbatiminput*}}
% \changes{v1.5u}{2020-07-07}{Typo repair and added a missing comment
% character}
% \changes{v1.5q}{2003/08/22}{Reintroduced \cs{@noligs}, by popular
@@ -508,7 +510,7 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{verbatim}
- [2022-07-02 v1.5u LaTeX2e package for verbatim enhancements]
+ [2024-01-22 v1.5x LaTeX2e package for verbatim enhancements]
\@ifundefined{verbatim@@@}{}{\endinput}
% \end{macrocode}
%
@@ -549,9 +551,17 @@
% to be printed as spaces in the output.
% \begin{macrocode}
\begingroup
- \catcode`\ =\active%
- \def\x{\def\@vobeyspaces{\catcode`\ \active\let \@xobeysp}}
- \expandafter\endgroup\x
+\catcode`\ =\active%
+% \end{macrocode}
+% Because space is active we can't indent the following code
+% nicely---we would then get the spaces at the beginning of the
+% line as the third and fourth argument to \cs{@ifl@t@r}.
+% \changes{v1.5v}{2023/11/06}{\cs{@vobeytabs} added when available (gh/1160)}
+% \begin{macrocode}
+\@ifl@t@r\fmtversion{2023-11-01}%
+{\def\x{\def\@vobeyspaces{\catcode`\ \active\let \@xobeysp\@vobeytabs}}}%
+{\def\x{\def\@vobeyspaces{\catcode`\ \active\let \@xobeysp}}}%
+\expandafter\endgroup\x
% \end{macrocode}
% \end{macro}
%
@@ -1562,7 +1572,14 @@
% arguments, depending on whether an asterisk follows.
% \begin{macrocode}
\def\verbatiminput{\begingroup
- \@ifstar{\verbatim@input\relax}%
+% \end{macrocode}
+%
+% \changes{v1.5x}{2024/01/22}{Added TAB marking support into the
+% starred version (gh/1245)}
+% If starred, we mark spaces and TABs, the two
+% added pieces are the same as for verbatim*.
+% \begin{macrocode}
+ \@ifstar{\verbatim@input{\@setupverbvisiblespace\@vobeyspaces}}%
{\verbatim@input{\frenchspacing\@vobeyspaces}}}
% \end{macrocode}
% \end{macro}
diff --git a/macros/latex-dev/required/tools/verbatim.pdf b/macros/latex-dev/required/tools/verbatim.pdf
index 3908ca304d..bc055db066 100644
--- a/macros/latex-dev/required/tools/verbatim.pdf
+++ b/macros/latex-dev/required/tools/verbatim.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/xr.dtx b/macros/latex-dev/required/tools/xr.dtx
index be48f5a01b..3914cebcd9 100644
--- a/macros/latex-dev/required/tools/xr.dtx
+++ b/macros/latex-dev/required/tools/xr.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
diff --git a/macros/latex-dev/required/tools/xr.pdf b/macros/latex-dev/required/tools/xr.pdf
index 58217a12d2..b3c4530a59 100644
--- a/macros/latex-dev/required/tools/xr.pdf
+++ b/macros/latex-dev/required/tools/xr.pdf
Binary files differ
diff --git a/macros/latex-dev/required/tools/xspace.dtx b/macros/latex-dev/required/tools/xspace.dtx
index 807fc9c5df..be20fc9e52 100644
--- a/macros/latex-dev/required/tools/xspace.dtx
+++ b/macros/latex-dev/required/tools/xspace.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2023
+% Copyright (C) 1993-2024
%
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
diff --git a/macros/latex-dev/required/tools/xspace.pdf b/macros/latex-dev/required/tools/xspace.pdf
index 573624719e..792cae7e6c 100644
--- a/macros/latex-dev/required/tools/xspace.pdf
+++ b/macros/latex-dev/required/tools/xspace.pdf
Binary files differ