diff options
Diffstat (limited to 'macros/latex/contrib/tagpdf')
17 files changed, 206 insertions, 49 deletions
diff --git a/macros/latex/contrib/tagpdf/README.md b/macros/latex/contrib/tagpdf/README.md index bb0353de51..2196a3b515 100644 --- a/macros/latex/contrib/tagpdf/README.md +++ b/macros/latex/contrib/tagpdf/README.md @@ -1,6 +1,6 @@ #tagpdf — A package to create tagged pdf -Packageversion: 0.98i -Packagedate: 2023/06/14 +Packageversion: 0.98j +Packagedate: 2023/07/08 Author: Ulrike Fischer ## License diff --git a/macros/latex/contrib/tagpdf/tagpdf-backend.dtx b/macros/latex/contrib/tagpdf/tagpdf-backend.dtx index a9c4763358..66a6e7ff7c 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-backend.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-backend.dtx @@ -47,13 +47,13 @@ % }^^A % } % -% \date{Version 0.98i, released 2023-06-14} +% \date{Version 0.98j, released 2023-07-08} % \maketitle % \begin{implementation} % \begin{macrocode} %<@@=tag> %<*luatex> -\ProvidesExplFile {tagpdf-luatex.def} {2023-06-14} {0.98i} +\ProvidesExplFile {tagpdf-luatex.def} {2023-07-08} {0.98j} {tagpdf~driver~for~luatex} % \end{macrocode} % \section{Loading the lua} @@ -158,8 +158,8 @@ local ProvidesLuaModule = { name = "tagpdf", - version = "0.98i", --TAGVERSION - date = "2023-06-14", --TAGDATE + version = "0.98j", --TAGVERSION + date = "2023-07-08", --TAGDATE description = "tagpdf lua code", license = "The LATEX Project Public License 1.3c" } diff --git a/macros/latex/contrib/tagpdf/tagpdf-checks.dtx b/macros/latex/contrib/tagpdf/tagpdf-checks.dtx index 81fd2c8d95..eddfe3eca3 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-checks.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-checks.dtx @@ -48,7 +48,7 @@ % }^^A % } % -% \date{Version 0.98i, released 2023-06-14} +% \date{Version 0.98j, released 2023-07-08} % \maketitle % \begin{documentation} % \section{Commands} @@ -76,7 +76,7 @@ % The LaTeX commands will do that automatically % at some time but it is in the responsability of the user to % ensure that when using low-level code. -% If the internal command doesn't exist the box is assumed to be tagged. +% If the internal command doesn't exist the box is assumed to be untagged. % \end{function} % \section{Description of log messages} % \subsection{\cs{ShowTagging} command} @@ -312,7 +312,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-checks-code} {2023-06-14} {0.98i} +\ProvidesExplPackage {tagpdf-checks-code} {2023-07-08} {0.98j} {part of tagpdf - code related to checks, conditionals, debugging and messages} %</header> % \end{macrocode} @@ -471,12 +471,11 @@ % parent tags. % \begin{macrocode} \msg_new:nnn { tag } {role-parent-child} - { Rule~'#1'~-->~'#2'~is~#3~\msg_line_context:} + { Parent-Child~'#1'~-->~'#2'.\\Relation~is~#3~\msg_line_context:} % \end{macrocode} % \end{macro} -% \begin{macro}{role-parent-child} -% This is info and warning message about the containment rules between child and -% parent tags. +% \begin{macro}{role-remapping} +% This is info and warning message about role-remapping % \begin{macrocode} \msg_new:nnn { tag } {role-remapping} { remapping~tag~to~#1 } @@ -579,19 +578,19 @@ % The LaTeX commands will do that automatically % at some time but it is in the responsability of the user to % ensure that when using low-level code. -% If the internal command doesn't exist the box is assumed to be tagged. +% If the internal command doesn't exist the box is assumed to be untagged. % \begin{macrocode} %<*base> \prg_new_conditional:Npnn \tag_if_box_tagged:N #1 {p,T,F,TF} { \tl_if_exist:cTF {l_tag_box_\int_use:N #1_tl} { - \int_compare:nNnTF {\tl_use:c{l_tag_box_\int_use:N #1_tl}}>{0} + \int_compare:nNnTF {0\tl_use:c{l_tag_box_\int_use:N #1_tl}}>{0} { \prg_return_true: } { \prg_return_false: } } { - \prg_return_true: + \prg_return_false: % warning?? } } diff --git a/macros/latex/contrib/tagpdf/tagpdf-code.pdf b/macros/latex/contrib/tagpdf/tagpdf-code.pdf Binary files differindex 5784294ea4..cb4f7968bb 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-code.pdf +++ b/macros/latex/contrib/tagpdf/tagpdf-code.pdf diff --git a/macros/latex/contrib/tagpdf/tagpdf-data.dtx b/macros/latex/contrib/tagpdf/tagpdf-data.dtx index 57dc3d356e..164fb7d728 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-data.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-data.dtx @@ -47,7 +47,7 @@ % }^^A % } % -% \date{Version 0.98i, released 2023-06-14} +% \date{Version 0.98j, released 2023-07-08} % \maketitle % \begin{documentation} % This files contains a various data files which are read in @@ -60,7 +60,7 @@ % It lists the new tag, the rolemap and the namespace of the rolemap. % \begin{macrocode} %<*ns-latex> -%% \ProvidesExplFile {tagpdf-ns-latex.def} {2023-06-14} {0.98i} +%% \ProvidesExplFile {tagpdf-ns-latex.def} {2023-07-08} {0.98j} %% {latex} {https://www.latex-project.org/ns/dflt/2022}{} title, Title, pdf2, part, Title, pdf2, @@ -92,7 +92,7 @@ text, P, pdf2, % It is bound to change % \begin{macrocode} %<*ns-latex-book> -%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2023-06-14} {0.98i} +%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2023-07-08} {0.98j} %% {latex-book} {https://www.latex-project.org/ns/book/2022}{} chapter, H1,pdf2, section, H2,pdf2, @@ -108,7 +108,7 @@ subparagraph, H6,pdf2, % It is bound to change a lot! % \begin{macrocode} %<*ns-latex-inline> -%% \ProvidesExplFile {tagpdf-ns-latex-inline.def} {2023-06-14} {0.98i} +%% \ProvidesExplFile {tagpdf-ns-latex-inline.def} {2023-07-08} {0.98j} %% {latex-inline} {https://www.latex-project.org/ns/inline/2022}{} chapter, Span, pdf2, section, Span, pdf2, @@ -122,7 +122,7 @@ P, Span, pdf2, % \section{The pdf namespace data} % \begin{macrocode} %<*ns-pdf> -%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2023-06-14} {0.98i} +%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2023-07-08} {0.98j} %% {pdf} {http://iso.org/pdf/ssn}{} StructTreeRoot,StructTreeRoot,pdf,D, Document,Document,pdf,D, @@ -190,7 +190,7 @@ Strong,Span,pdf,I, % \section{The pdf 2.0 namespace data} % \begin{macrocode} %<*ns-pdf2> -%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2023-06-14} {0.98i} +%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2023-07-08} {0.98j} %% {pdf2} {http://iso.org/pdf2/ssn}{} Document,Document,pdf2,D, Part,Part,pdf2,G, @@ -246,7 +246,7 @@ Strong,Strong,pdf2,I, % \section{The mathml namespace data} % \begin{macrocode} %<*ns-mathml> -%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2023-06-14} {0.98i} +%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2023-07-08} {0.98j} % {mathml}{http://www.w3.org/1998/Math/MathML}{} abs,abs,mathml, and,and,mathml, @@ -481,7 +481,7 @@ xor,xor,mathml, % This will perhaps change in future. % \begin{macrocode} %<*parent-child> -%% \ProvidesExplFile {tagpdf-parent-child.csv} {2023-06-14} {0.98i} +%% \ProvidesExplFile {tagpdf-parent-child.csv} {2023-07-08} {0.98j} ,,,StructTreeRoot,Document,Art,Part,Div,Sect,BlockQuote,NonStruct,TOC,TOCI,Index,Private,Quote,Note,Reference,BibEntry,P,Hn,H,Lbl,Code,Span,Link,Annot,Form,Ruby,RB,RT,RP,Warichu,WT,WP,L,LI,LBody,Table,TR,TH,TD,THead,TBody,TFoot,Caption,Figure,Formula,MC Document,both,document level,1,0..n,∅,‡,‡,∅,0..n,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅ Art,1.7,grouping,∅,0..n,∅,‡,‡,0..n,0..n,‡,∅,∅,∅,0..n,∅,0..n,∅,∅,∅,0..1,0..1,∅,∅,∅,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,∅,∅ @@ -536,7 +536,7 @@ MC,both,---,∅,∅,∅,∅,∅,∅,0..n,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0.. % This will perhaps change in future. % \begin{macrocode} %<*parent-child-2> -%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2023-06-14} {0.98i} +%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2023-07-08} {0.98j} ,,,StructTreeRoot,Document,DocumentFragment,Art,Part,Div,Sect,Aside,BlockQuote,NonStruct,TOC,TOCI,Index,Private,Title,Sub,Quote,Note,Reference,BibEntry,P,Hn,H,Lbl,Code,Em,Strong,Span,Link,Annot,Form,Ruby,RB,RT,RP,Warichu,WT,WP,FENote,L,LI,LBody,Table,TR,TH,TD,THead,TBody,TFoot,Caption,Figure,Formula,math,mathml,Artifact,MC Document,both,document level,1,0..n,0..n,∅,‡,‡,∅,0..n,0..n,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅ DocumentFragment,2.0,document level,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,∅,0..n,∅,∅,∅,∅*,∅,∅,∅,∅,∅,∅,∅*,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅,∅,∅,∅,0..n,∅ diff --git a/macros/latex/contrib/tagpdf/tagpdf-mc-generic.dtx b/macros/latex/contrib/tagpdf/tagpdf-mc-generic.dtx index 97732c57bf..d8c1f52cca 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-mc-generic.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-mc-generic.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98i, released 2023-06-14} +% \date{Version 0.98j, released 2023-07-08} % \maketitle % \begin{documentation} % \end{documentation} @@ -55,11 +55,11 @@ % \begin{macrocode} %<@@=tag> %<*generic> -\ProvidesExplPackage {tagpdf-mc-code-generic} {2023-06-14} {0.98i} +\ProvidesExplPackage {tagpdf-mc-code-generic} {2023-07-08} {0.98j} {part of tagpdf - code related to marking chunks - generic mode} %</generic> %<*debug> -\ProvidesExplPackage {tagpdf-debug-generic} {2023-06-14} {0.98i} +\ProvidesExplPackage {tagpdf-debug-generic} {2023-07-08} {0.98j} {part of tagpdf - debugging code related to marking chunks - generic mode} %</debug> % \end{macrocode} diff --git a/macros/latex/contrib/tagpdf/tagpdf-mc-luacode.dtx b/macros/latex/contrib/tagpdf/tagpdf-mc-luacode.dtx index 261a3ff73f..99039a9744 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-mc-luacode.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-mc-luacode.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98i, released 2023-06-14} +% \date{Version 0.98j, released 2023-07-08} % \maketitle % \begin{implementation} % The code is splitted into three parts: code shared by all engines, @@ -86,7 +86,7 @@ % \begin{macrocode} %<@@=tag> %<*luamode> -\ProvidesExplPackage {tagpdf-mc-code-lua} {2023-06-14} {0.98i} +\ProvidesExplPackage {tagpdf-mc-code-lua} {2023-07-08} {0.98j} {tagpdf - mc code only for the luamode } %</luamode> % \end{macrocode} diff --git a/macros/latex/contrib/tagpdf/tagpdf-mc-shared.dtx b/macros/latex/contrib/tagpdf/tagpdf-mc-shared.dtx index 9c9d4ec735..9a9a1046b6 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-mc-shared.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-mc-shared.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98i, released 2023-06-14} +% \date{Version 0.98j, released 2023-07-08} % \maketitle % \begin{documentation} % \section{Public Commands} @@ -181,7 +181,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-mc-code-shared} {2023-06-14} {0.98i} +\ProvidesExplPackage {tagpdf-mc-code-shared} {2023-07-08} {0.98j} {part of tagpdf - code related to marking chunks - code shared by generic and luamode } %</header> diff --git a/macros/latex/contrib/tagpdf/tagpdf-roles.dtx b/macros/latex/contrib/tagpdf/tagpdf-roles.dtx index fcfd5f7534..736eac4a70 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-roles.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-roles.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98i, released 2023-06-14} +% \date{Version 0.98j, released 2023-07-08} % \maketitle % \begin{documentation} % \begin{function} @@ -98,7 +98,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-roles-code} {2023-06-14} {0.98i} +\ProvidesExplPackage {tagpdf-roles-code} {2023-07-08} {0.98j} {part of tagpdf - code related to roles and structure names} %</header> % \end{macrocode} diff --git a/macros/latex/contrib/tagpdf/tagpdf-space.dtx b/macros/latex/contrib/tagpdf/tagpdf-space.dtx index e6b5e02513..c1798f16c6 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-space.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-space.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98i, released 2023-06-14} +% \date{Version 0.98j, released 2023-07-08} % \maketitle % \begin{documentation} % \begin{function}{interwordspace (setup-key)} @@ -64,7 +64,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-space-code} {2023-06-14} {0.98i} +\ProvidesExplPackage {tagpdf-space-code} {2023-07-08} {0.98j} {part of tagpdf - code related to real space chars} %</header> % \end{macrocode} diff --git a/macros/latex/contrib/tagpdf/tagpdf-struct.dtx b/macros/latex/contrib/tagpdf/tagpdf-struct.dtx index d2bb7a2b08..a7bee487a4 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-struct.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-struct.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98i, released 2023-06-14} +% \date{Version 0.98j, released 2023-07-08} % \maketitle % \begin{documentation} % \section{Public Commands} @@ -247,7 +247,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-struct-code} {2023-06-14} {0.98i} +\ProvidesExplPackage {tagpdf-struct-code} {2023-07-08} {0.98j} {part of tagpdf - code related to storing structure} %</header> % \end{macrocode} @@ -1740,7 +1740,7 @@ % \section{Attributes and attribute classes} % \begin{macrocode} %<*header> -\ProvidesExplPackage {tagpdf-attr-code} {2023-06-14} {0.98i} +\ProvidesExplPackage {tagpdf-attr-code} {2023-07-08} {0.98j} {part of tagpdf - code related to attributes and attribute classes} %</header> % \end{macrocode} diff --git a/macros/latex/contrib/tagpdf/tagpdf-tree.dtx b/macros/latex/contrib/tagpdf/tagpdf-tree.dtx index 393a7c359f..010e9a3fcc 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-tree.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-tree.dtx @@ -47,13 +47,13 @@ % }^^A % } % -% \date{Version 0.98i, released 2023-06-14} +% \date{Version 0.98j, released 2023-07-08} % \maketitle % \begin{implementation} % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-tree-code} {2023-06-14} {0.98i} +\ProvidesExplPackage {tagpdf-tree-code} {2023-07-08} {0.98j} {part of tagpdf - code related to writing trees and dictionaries to the pdf} %</header> % \end{macrocode} diff --git a/macros/latex/contrib/tagpdf/tagpdf-user.dtx b/macros/latex/contrib/tagpdf/tagpdf-user.dtx index be082172ef..f33d710e36 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-user.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-user.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98i, released 2023-06-14} +% \date{Version 0.98j, released 2023-07-08} % \maketitle % \begin{documentation} % \section{Setup commands} @@ -250,7 +250,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-user} {2023-06-14} {0.98i} +\ProvidesExplPackage {tagpdf-user} {2023-07-08} {0.98j} {tagpdf - user commands} %</header> % \end{macrocode} diff --git a/macros/latex/contrib/tagpdf/tagpdf.dtx b/macros/latex/contrib/tagpdf/tagpdf.dtx index b5898d0ed4..add2dceced 100644 --- a/macros/latex/contrib/tagpdf/tagpdf.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf.dtx @@ -92,7 +92,7 @@ % \begin{macrocode} %<@@=tag> %<*package> -\ProvidesExplPackage {tagpdf} {2023-06-14} {0.98i} +\ProvidesExplPackage {tagpdf} {2023-07-08} {0.98j} { A package to experiment with pdf tagging } \bool_if:nF @@ -118,7 +118,7 @@ % \end{macrocode} %<*debug> % \begin{macrocode} -\ProvidesExplPackage {tagpdf-debug} {2023-06-14} {0.98i} +\ProvidesExplPackage {tagpdf-debug} {2023-07-08} {0.98j} { debug code for tagpdf } \@ifpackageloaded{tagpdf}{}{\PackageWarning{tagpdf-debug}{tagpdf~not~loaded,~quitting}\endinput} % \end{macrocode} @@ -141,7 +141,7 @@ % we define a base package with dummy functions % \begin{macrocode} %<*base> -\ProvidesExplPackage {tagpdf-base} {2023-06-14} {0.98i} +\ProvidesExplPackage {tagpdf-base} {2023-07-08} {0.98j} {part of tagpdf - provide base, no-op versions of the user commands } %</base> % \end{macrocode} diff --git a/macros/latex/contrib/tagpdf/tagpdf.pdf b/macros/latex/contrib/tagpdf/tagpdf.pdf Binary files differindex 329b97b8a5..4a68c8dbb8 100644 --- a/macros/latex/contrib/tagpdf/tagpdf.pdf +++ b/macros/latex/contrib/tagpdf/tagpdf.pdf diff --git a/macros/latex/contrib/tagpdf/tagpdf.tex b/macros/latex/contrib/tagpdf/tagpdf.tex index 1ee0abb181..8f54068192 100644 --- a/macros/latex/contrib/tagpdf/tagpdf.tex +++ b/macros/latex/contrib/tagpdf/tagpdf.tex @@ -16,8 +16,8 @@ } \DebugBlocksOff \makeatletter -\def\UlrikeFischer@package@version{0.98i} -\def\UlrikeFischer@package@date{2023-06-14} +\def\UlrikeFischer@package@version{0.98j} +\def\UlrikeFischer@package@date{2023-07-08} \makeatother \documentclass[bibliography=totoc,a4paper]{article} @@ -2222,6 +2222,164 @@ This is in pdftex a primitive. It inserts the dummy space glyph. \pkg{tagpdf} de \section{Storing and reusing boxes}\label{sec:savebox} +\section{Saving and using boxes} + +\TeX{} allows to store material in boxes and to use these box once or +multiple times in other places. This poses some challenges to tagging. The +listings in the following examples uses low-level \TeX{} box commands to +avoid that changes in the \LaTeX{} commands that improve tagging interfere +in case you want to test this. To keep the examples short they don't show +the needed \cs{ExplSyntaxOn}/\cs{ExplSyntaxOff}. + +\subsection{Boxes without tagging commands} + + +If no tagging commands were used (or if they were inactive) when the box +was stored then there is no problem to use this box with +pdf\LaTeX{}/generic mode in various places. So + +\begin{taglstlisting} +\newbox\mybox +The\setbox\mybox\hbox{yellow} duck + +The \box\mybox{} sun +\end{taglstlisting} + +will produce (assuming para tagging is activated) the paragraph structures +\enquote{The duck} and \enquote{The yellow sun}. + + +With lua\LaTeX{}/lua mode this is different: The nodes in the box will have +the mc-attribute value attached which were active when the box was saved +and this value is recorded as kid of the first paragraph. So when the lua +code later wanders through the box to find all kids of structure it will +also find the content of the \cs{usebox}. This means with lua\LaTeX{} we +get the two paragraph structures \enquote{The duck yellow} and \enquote{The +sun}. + +The solution here is to reset the attributes before using the box: + +\begin{taglstlisting} +The\setbox\mybox\hbox{yellow} duck + +The \tag_mc_reset_box:N\mybox\box\mybox{} sun +\end{taglstlisting} + + +The box can in both modes be used without problems many times. + + +\subsection{Boxes with tagging commands} + +We assume in the following that the box contains only well balanced tagging +commands and no parts that are \enquote{untagged}. It should be possible to +copy the whole box inside a \verb+\tagstructbegin+/\verb+\tagstructend+ +pair. So the following is fine as box content +\begin{taglstlisting} +box=\tagstructbegin{...}\tagmcbegin{} balanced content\tagmcend\tagstructend +box= + \tagmcbegin{}text\tagmcend + \tagstructbegin{...}\tagmcbegin{} balanced content\tagmcend\tagstructend + \tagmcbegin{}text\tagmcend +\end{taglstlisting} +but this not (this case could probably be handled nevertheless with a bit +care at least in lua mode) +\begin{taglstlisting} +box= text\tagmcend\tagstructbegin{...}...\tagstructend\tagmcbegin{}text +\end{taglstlisting} +and this is absolutely unusable: +\begin{taglstlisting} +box= text\tagmcend\tagstructbegin{...}\tagmcbegin{}text +\end{taglstlisting} + +We also assume that we want to move the structure of the box to the place +where the box is used (if the structure should stay where the box is saved, +simply save it and that will happen). For this we must add a structure that +we can stash and label. + +\begin{taglstlisting} +\tag_mc_end_push: % interrupt an open mc +\tagstructbegin{tag=NonStruct,stash} + \edef\myboxnum{\tag_get:n{struct_num}} % store structure number + \setbox\mybox\hbox %or \vbox or ... + {content} +\tagstructend +\tag_mc_begin_pop:n{}% restart open mc +\end{taglstlisting} + +At the place where the box is then used we also have to inject this +structure: + +\begin{taglstlisting} +\tag_mc_end_push: % interrupt an open mc +\tag_struct_use_num:n {\myboxnum} % use structure +\box\mybox % use box +\tag_mc_begin_pop:n{}% restart open mc +\end{taglstlisting} + +With pdf\LaTeX{} Boxes with tagging commands can currently be used only +once. The tagging commands set labels and reusing the box gives multiple +label warnings. + +With lua\LaTeX{} it is possible to reset the attributes as done with the +untagged box and then to reuse at least the content. + +\subsection{Detecting tagging commands} + +It is possible to detect if a box contains tagging commands by comparing +the state of the mc and structure counter: +\begin{verbatim} +\def\statebeforebox\inteval{\tag_get:n{struct_counter}+\tag_get:n{mc_counter}} +\setbox\mybox ... +%compare numbers against \statebeforebox +\end{verbatim} + + + +\subsection{Putting everything together} + +To tag boxes that can be both (without tagging commands or with balanced +tagging commands) the following strategy can be used: + +\begin{itemize} +\item when storing the box put around it a structure as need by the + tagged variant: +\begin{verbatim} +\tag_mc_end_push: % interrupt an open mc +\tagstructbegin{tag=NonStruct,stash} +\edef\myboxnum{\tag_get:n{struct_num}} % store structure number + \def\statebeforebox{\inteval{\tag_get:n{struct_counter}+\tag_get:n{mc_counter}}} + \setbox\mybox\hbox %or \vbox or ... + {content} + %check if there is tagging content and store that +\tagstructend +\tag_mc_begin_pop:n{}% restart open mc +\end{verbatim} + +\item when using the box the first time + \begin{itemize} + \item if it has no tagging commands then reset the attribute and use + the box. + \begin{verbatim} + The \tagmcresetbox\mybox\box\mybox{} sun + \end{verbatim} + The stashed \texttt{NonStruct} structure is then thrown away. + \item if there is a structure then use the stashed structure + \begin{verbatim} + \tag_mc_end_push: % interrupt an open mc + \tag_struct_use_num:n {\myboxnum} % use structure + \box\mybox % use box + \tag_mc_begin_pop:n{}% restart open mc + \end{verbatim} + \end{itemize} + + \item if the box is used a second time then throw an error with + pdf\LaTeX{}. With lua\LaTeX{} reset the attributes and issue a + warning. + +\end{itemize} + + \section{Accessibility is not only tagging} diff --git a/macros/latex/contrib/tagpdf/tagpdfdocu-patches.sty b/macros/latex/contrib/tagpdf/tagpdfdocu-patches.sty index 0628a46660..49becf6a1f 100644 --- a/macros/latex/contrib/tagpdf/tagpdfdocu-patches.sty +++ b/macros/latex/contrib/tagpdf/tagpdfdocu-patches.sty @@ -1,5 +1,5 @@ %\RequirePackage[enable-debug]{expl3}[2018/06/14] -\ProvidesExplPackage {tagpdfdocu-patches} {2023-06-14} {0.98i} +\ProvidesExplPackage {tagpdfdocu-patches} {2023-07-08} {0.98j} {patches/commands for the tagpdf documentation} \RequirePackage{etoolbox,xpatch} |