Skip to content

Commit

Permalink
Tagging of floats and suspend/resume (#1472) (merge tagging705-float …
Browse files Browse the repository at this point in the history
…branch)

* switch to tagging sockets in float module, WIP

* use tagging socket in multicol, latex3/tagging-project#705

* luatex test

* improve autoref compability

* WIP, use sockets for caption

* better documentation of plugs

* use sockets for caption, WIP

* small corrections, flattened par

* update testfiles

* correct brace

* caption sockets

* switch to tag_suspend/tag_resume

* some more docu

* testfile latex3/tagging-project#13

* correct date

* correct wording

* wrong number

* extend todos
  • Loading branch information
u-fischer authored Sep 24, 2024
1 parent bdb49dc commit 6fd8c95
Show file tree
Hide file tree
Showing 37 changed files with 1,270 additions and 785 deletions.
3 changes: 3 additions & 0 deletions base/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ hotfixes). It is provided for convenience only. It therefore makes no claims
to completeness or accuracy and it contains some references to files that are
not part of the distribution.
================================================================================
2024-09-17 Ulrike Fischer <[email protected]>
* lttagging.dtx: dummy for \tag_suspend:n and \tag_resume:n
* lttagging.dtx: declare tagging sockets for floats and caption.

2024-09-15 Joseph Wright <[email protected]>

Expand Down
99 changes: 68 additions & 31 deletions base/lttagging.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{lttagging.dtx}
[2024/08/10 v1.0g LaTeX Kernel (tagging support)]
[2024/09/17 v1.0h LaTeX Kernel (tagging support)]
% \iffalse
\documentclass{l3doc}
\GetFileInfo{lttagging.dtx}
Expand Down Expand Up @@ -75,6 +75,9 @@
%
% \DescribeMacro\SuspendTagging
% \DescribeMacro\ResumeTagging
% \DescribeMacro\tag_suspend:n
% \DescribeMacro\tag_resume:n

%
% The are places in code where it is import top stop any tagging
% activities, e.g., when we are doing trial typesetting that it is
Expand All @@ -88,10 +91,8 @@
% both take string argument that is used for debugging to easily
% identify why tagging was suspended or restarted, for example, in
% \pkg{tabularx} you find \verb=\SuspendTagging{tabularx}=. By default
% they two commands do nothing.
% these four commands do nothing.
%
% TODO: the corresponding L3 layer commands should also have a dummy
% definition in the kernel!
%
% \DescribeMacro\UseTaggingSocket
% \DescribeMacro\tag_socket_use:n
Expand Down Expand Up @@ -144,34 +145,16 @@
%
%
%
% \begin{macro}{\SuspendTagging,\ResumeTagging}
% \begin{macro}{\tag_suspend:n,\tag_resume:n,\SuspendTagging,\ResumeTagging}
%
% In the kernel, these two commands get dummy definitions so that
% In the kernel, these commands get dummy definitions so that
% they can be used without harm in packages. The real definition is
% used when tagging gets enabled.
% \begin{macrocode}
\cs_new_eq:NN \SuspendTagging \use_none:n
\cs_new_eq:NN \ResumeTagging \use_none:n
% \end{macrocode}
%
% A simplified version of this definition should move to
% \pkg{tagpdf} and dropped here, eventually.
% \begin{macrocode}
\AddToHook{begindocument/before}{
\cs_if_exist:NT \tag_stop:n
{
\cs_set:Npn \SuspendTagging #1 {
% \end{macrocode}%
% This stops tagging and also disables all tagging sockets so we are done.
% \begin{macrocode}
\tag_stop:n {#1}
}
% \end{macrocode}
%
% \begin{macrocode}
\cs_set:Npn \ResumeTagging #1 { \tag_start:n {#1} }
}
}
\cs_new_eq:NN \tag_suspend:n \use_none:n
\cs_new_eq:NN \tag_resume:n \use_none:n
\cs_new_protected:Npn \SuspendTagging #1 { \tag_suspend:n {#1} }
\cs_new_protected:Npn \ResumeTagging #1 { \tag_resume:n {#1} }
% \end{macrocode}
% \end{macro}
%
Expand Down Expand Up @@ -261,6 +244,13 @@
\ExplSyntaxOff
% \end{macrocode}
% \end{plugdecl}
%
% \begin{socketdecl}{tagsupport/para/begin,tagsupport/para/end}
% These sockets are currently defined in tagpdf. They overwrite
% definitions in the latex-lab-block code. There is also a simpler
% definition that probably should be a general socket too.
% TODO: move this into lttagging.
% \end{socketdecl}

% \subsubsection{Tagging sockets for toc}

Expand Down Expand Up @@ -295,7 +285,7 @@
% \end{macrocode}
% \end{socketdecl}
%
% \subsection{Tagging support for table/tabular packages}
% \subsubsection{Tagging support for table/tabular packages}
%
% The code uses a number of sockets to inject the tagging
% commands. These can be easily set to a noop-plug in case the
Expand Down Expand Up @@ -433,10 +423,57 @@
% \end{macrocode}
% \end{socketdecl}
%
% \subsubsection{Tagging Support for floats}
%
% \begin{socketdecl}{tagsupport/float/hmode/begin,
% tagsupport/float/hmode/end}
% These sockets are used if the float is called in
% hmode.
% \changes{v1.0h}{2024/09/13}{Sockets for floats added}
% \begin{macrocode}
\NewSocket{tagsupport/float/hmode/begin}{0}
\NewSocket{tagsupport/float/hmode/end}{0}
% \end{macrocode}
% \end{socketdecl}
%
% \begin{socketdecl}{tagsupport/float/begin,
% tagsupport/float/end}
% These sockets start and stop the float structure.
% \begin{macrocode}
\NewSocket{tagsupport/float/begin}{0}
\NewSocket{tagsupport/float/end}{0}
% \end{macrocode}
% \end{socketdecl}
%
%
%
%
% \begin{socketdecl}{tagsupport/caption/begin,
% tagsupport/caption/end}
% These sockets are used in \cs{@makecaption}.
% They open and close the \texttt{Caption} structure.
% Their default plugs assume that they are used in
% vmode. The argument of the begin socket is
% the structure number of the parent float. If it is
% empty the current structure number is used.
% \begin{macrocode}
\NewSocket{tagsupport/caption/begin}{1}
\NewSocket{tagsupport/caption/end}{0}
% \end{macrocode}
% \end{socketdecl}
%
% \begin{socketdecl}{tagsupport/caption/label/begin,
% tagsupport/caption/label/end}
% These sockets are used in \cs{@makecaption} around the
% label. Their default plugs ensure that
% the label is outside the paragraph and that
% the rest of the caption uses flattened para mode. If the
% caption is not in a hbox, the \texttt{para/begin}
% socket should follow to properly start the paragraph.
% \begin{macrocode}
\NewSocket{tagsupport/caption/label/begin}{0}
\NewSocket{tagsupport/caption/label/end}{0}
% \end{macrocode}
% \end{socketdecl}
%
% \section{For lttab.dtx parked here for now}
%
%
Expand Down
9 changes: 9 additions & 0 deletions required/latex-lab/changes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2024-09-18 Ulrike Fischer <[email protected]>
* latex-lab-amsmath.dtx,latex-lab-graphic.dtc,
latex-lab-marginpar.dtx,latex-lab-math.dtx,latex-lab-mathtools.dtx,
latex-lab-minipage.dtx,latex-lab-sec.dtx,latex-lab-table.dtx,latex-lab-text.dtx:
switch to \tag_suspend:n and \tag_resume:n

2024-09-17 Ulrike Fischer <[email protected]>
* latex-lab-float.dtx: switch to tagging sockets

2024-09-13 Ulrike Fischer <[email protected]>
* documentmetadata-support.dtx: change warning to error if pdfstandard is unknown,
see https://github.com/latex3/pdfresources/issues/77#issuecomment-2329522654.
Expand Down
6 changes: 3 additions & 3 deletions required/latex-lab/latex-lab-amsmath.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
% \subsection{File declaration}
% \begin{macrocode}
\ProvidesFile{latex-lab-amsmath.ltx}
[2024-07-05 v0.1b amsmath adaptions]
[2024-09-18 v0.1c amsmath adaptions]
% \end{macrocode}
% \subsection{Tagpdf support}
% To make the code independent from tagging being loaded and active
Expand Down Expand Up @@ -99,7 +99,7 @@
% \end{macrocode}
% Stop tagging when measuring:
% \begin{macrocode}
\ifmeasuring@\tag_stop:\fi
\ifmeasuring@\tag_suspend:n{\measuring}\fi
\normalbaselines
\ifdim\linewidth=\columnwidth
\else \parshape\@ne \@totalleftmargin \linewidth
Expand Down Expand Up @@ -174,7 +174,7 @@
\def\text@#1
{{
\int_gincr:N\g__math_mathchoice_int
\tag_stop:
\tag_suspend:n{\text@}
\mathchoice
{
\@@_tag_if_mathstyle:en{mathchoice-\int_use:N\g__math_mathchoice_int}{0}
Expand Down
Loading

0 comments on commit 6fd8c95

Please sign in to comment.