diff options
author | Karl Berry <karl@freefriends.org> | 2023-03-07 22:23:30 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-03-07 22:23:30 +0000 |
commit | 146b9f2edb0a5faffe05dc68e38be4216d3d5da0 (patch) | |
tree | c6d1be5196b1478a6876efc6e6820fa4fe880e7e /Master/texmf-dist/tex/latex | |
parent | a07923dc8fd8bbd8bb0c493869925341ce9620a0 (diff) |
tagpdf (7mar23) (branch)
git-svn-id: svn://tug.org/texlive/branches/branch2022.final@66444 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
17 files changed, 149 insertions, 99 deletions
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty index 3ba34d0d46a..93139afe872 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty @@ -25,7 +25,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf.dtx -\ProvidesExplPackage {tagpdf-base} {2023-02-15} {0.98d} +\ProvidesExplPackage {tagpdf-base} {2023-03-07} {0.98e} {part of tagpdf - provide base, no-op versions of the user commands } \AddToHook{begindocument} { @@ -60,12 +60,14 @@ \int_gzero:N \c@g__tag_struct_abs_int \tl_new:N \g__tag_struct_stack_current_tl \tl_gset:Nn \g__tag_struct_stack_current_tl {\int_use:N\c@g__tag_struct_abs_int} +\prop_new:N \g__tag_struct_dest_num_prop \cs_new:Npn \__tag_get_data_struct_num: { \g__tag_struct_stack_current_tl } \cs_new_protected:Npn \tag_struct_begin:n #1 {\int_gincr:N \c@g__tag_struct_abs_int} \cs_new_protected:Npn \tag_struct_end:{} +\cs_new_protected:Npn \tag_struct_end:n{} \cs_new_protected:Npn \tag_struct_use:n #1 {} %% File: tagpdf-checks.dtx @@ -108,6 +110,7 @@ { \tag_struct_use:n {#1} } +\bool_new:N \l__tag_para_flattened_bool \newcommand\tagpdfparaOn {} \newcommand\tagpdfparaOff{} %% File: tagpdf-roles.dtx diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty index c7447b08b4d..bbd7ce6bc32 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-mc-generic.dtx -\ProvidesExplPackage {tagpdf-debug-generic} {2023-02-15} {0.98d} +\ProvidesExplPackage {tagpdf-debug-generic} {2023-03-07} {0.98e} {part of tagpdf - debugging code related to marking chunks - generic mode} \cs_set_protected:Npn \tag_mc_begin:n #1 %#1 keyval { diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty index 659ca6f0b38..0e1b80d35c2 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty @@ -26,7 +26,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf.dtx -\ProvidesExplPackage {tagpdf-debug} {2023-02-15} {0.98d} +\ProvidesExplPackage {tagpdf-debug} {2023-03-07} {0.98e} { debug code for tagpdf } \@ifpackageloaded{tagpdf}{}{\PackageWarning{tagpdf-debug}{tagpdf~not~loaded,~quitting}\endinput} \prop_gput:Nnn \g_msg_module_type_prop { tag / debug} {} @@ -80,6 +80,10 @@ { Struct~end~#1~[\msg_line_context:] } +\msg_new:nnn { tag / debug } {struct-end-wrong} + { + Struct~end~'#1'~doesn't~fit~start~'#2'~[\msg_line_context:] + } \cs_new_protected:Npn \__tag_debug_struct_begin_insert:n #1 { @@ -111,6 +115,24 @@ \msg_note:nnn { tag / debug } {struct-end } {ignored} } } +\cs_new_protected:Npn \__tag_debug_struct_end_check:n #1 + { + \int_compare:nNnT { \l__tag_loglevel_int } > {0} + { + \seq_get:NNT \g__tag_struct_tag_stack_seq \l__tag_tmpa_tl + { + \str_if_eq:eeF + {#1} + {\exp_last_unbraced:NV\use_i:nn \l__tag_tmpa_tl} + { + \msg_warning:nnxx { tag/debug }{ struct-end-wrong } + {#1} + {\exp_last_unbraced:NV\use_i:nn \l__tag_tmpa_tl} + } + } + } + } + %% File: tagpdf-user.dtx @@ -250,6 +272,12 @@ {\__tag_debug_struct_end_ignore:} } +\cs_set_protected:Npn \tag_struct_end:n #1 + { +\__tag_debug_struct_end_check:n{#1} + \tag_struct_end: + } + %% File: tagpdf-space.dtx %% %% diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def index c3d7495aab4..cbc9edbe798 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-backend.dtx -\ProvidesExplFile {tagpdf-luatex.def} {2023-02-15} {0.98d} +\ProvidesExplFile {tagpdf-luatex.def} {2023-03-07} {0.98e} {tagpdf~driver~for~luatex} { \fontencoding{TU}\fontfamily{lmr}\fontseries{m}\fontshape{n}\fontsize{10pt}{10pt}\selectfont diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty index 4caa3a5285e..2323af69fe8 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-mc-generic.dtx -\ProvidesExplPackage {tagpdf-mc-code-generic} {2023-02-15} {0.98d} +\ProvidesExplPackage {tagpdf-mc-code-generic} {2023-03-07} {0.98e} {part of tagpdf - code related to marking chunks - generic mode} \__tag_prop_new:N \g__tag_MCID_byabspage_prop diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty index 45bd2d4539e..16fd28a6d1a 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-mc-luacode.dtx -\ProvidesExplPackage {tagpdf-mc-code-lua} {2023-02-15} {0.98d} +\ProvidesExplPackage {tagpdf-mc-code-lua} {2023-03-07} {0.98e} {tagpdf - mc code only for the luamode } \hook_gput_code:nnn{begindocument}{tagpdf/mc} { diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def index d05c1aa5f00..3f5f86e580e 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-data.dtx -%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2023-02-15} {0.98d} +%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2023-03-07} {0.98e} %% {latex-book} {https://www.latex-project.org/ns/book/2022}{} chapter, H1,pdf2, section, H2,pdf2, diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-inline.def b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-inline.def index 5f157ddc740..d930a8f97f7 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-inline.def +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-inline.def @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-data.dtx -%% \ProvidesExplFile {tagpdf-ns-latex-inline.def} {2023-02-15} {0.98d} +%% \ProvidesExplFile {tagpdf-ns-latex-inline.def} {2023-03-07} {0.98e} %% {latex-inline} {https://www.latex-project.org/ns/inline/2022}{} chapter, Span, pdf2, section, Span, pdf2, diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def index 383578f2adf..7ef10a4bd28 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-data.dtx -%% \ProvidesExplFile {tagpdf-ns-latex.def} {2023-02-15} {0.98d} +%% \ProvidesExplFile {tagpdf-ns-latex.def} {2023-03-07} {0.98e} %% {latex} {https://www.latex-project.org/ns/dflt/2022}{} title, Title, pdf2, part, Title, pdf2, @@ -28,15 +28,21 @@ subsection, H2, pdf2, subsubsection,H3, pdf2, paragraph, H4, pdf2, subparagraph, H5, pdf2, +list, L, pdf2, itemize, L, pdf2, enumerate, L, pdf2, description, L, pdf2, +quote, BlockQuote,pdf, +quotation, BlockQuote,pdf, +verbatim, Div, pdf2, item, LI, pdf2, itemlabel, Lbl, pdf2, itembody, LBody, pdf2, footnote, FENote, pdf2, footnotemark, Lbl, pdf2, footnotelabel,Lbl, pdf2, +text-unit, Part, pdf2, +text, P, pdf2, %% %% %% End of file `tagpdf-ns-latex.def'. diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def index 2ad2154bd76..0f04fbbdc04 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-data.dtx -%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2023-02-15} {0.98d} +%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2023-03-07} {0.98e} abs,,, and,,, annotation,,, diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def index a6b07b70fa9..7c99f3115aa 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-data.dtx -%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2023-02-15} {0.98d} +%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2023-03-07} {0.98e} %% {pdf} {http://iso.org/pdf/ssn}{} StructTreeRoot,StructTreeRoot,pdf,D, Document,Document,pdf,D, diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def index 08c829cf819..2edcec9a0ca 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-data.dtx -%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2023-02-15} {0.98d} +%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2023-03-07} {0.98e} %% {pdf2} {http://iso.org/pdf2/ssn}{} Document,Document,pdf2,D, Part,Part,pdf2,G, diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child-2.csv b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child-2.csv index d68bff84bba..12b6780f0fe 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child-2.csv +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child-2.csv @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-data.dtx -%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2023-02-15} {0.98d} +%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2023-03-07} {0.98e} ,,,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/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child.csv b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child.csv index 831dcece77a..2312c16a1c2 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child.csv +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child.csv @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-data.dtx -%% \ProvidesExplFile {tagpdf-parent-child.csv} {2023-02-15} {0.98d} +%% \ProvidesExplFile {tagpdf-parent-child.csv} {2023-03-07} {0.98e} ,,,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,∅,∅ diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua b/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua index 2bd02458eac..5e75b67eb3d 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua @@ -24,8 +24,8 @@ local ProvidesLuaModule = { name = "tagpdf", - version = "0.98d", --TAGVERSION - date = "2023-02-15", --TAGDATE + version = "0.98e", --TAGVERSION + date = "2023-03-07", --TAGDATE description = "tagpdf lua code", license = "The LATEX Project Public License 1.3c" } diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty index ab618dc7099..048f96beee2 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty @@ -28,7 +28,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf.dtx -\ProvidesExplPackage {tagpdf} {2023-02-15} {0.98d} +\ProvidesExplPackage {tagpdf} {2023-03-07} {0.98e} { A package to experiment with pdf tagging } \bool_if:nF @@ -317,7 +317,7 @@ {engine/output~mode~#1~doesn't~support~the~interword~spaces} \cs_set_eq:NN \__tag_check_typeout_v:n \use_none:n \msg_new:nnnn { tag } {para-hook-count-wrong} - {The~number~of~automatic~begin~(#1)~and~end~(#2)~para~hooks~differ!} + {The~number~of~automatic~begin~(#1)~and~end~(#2)~#3~para~hooks~differ!} {This~quite~probably~a~coding~error~and~the~structure~will~be~wrong!} \prg_set_conditional:Npnn \tag_if_active: { p , T , TF, F } { @@ -1872,7 +1872,6 @@ \tl_new:N \g__tag_struct_tag_NS_tl \tl_new:N \l__tag_struct_key_label_tl \bool_new:N \l__tag_struct_elem_stash_bool -\prop_new:N \g__tag_struct_dest_num_prop \prop_new:N \g__tag_struct_ref_by_dest_prop \cs_new:Npn \__tag_struct_output_prop_aux:nn #1 #2 %#1 num, #2 key { @@ -2560,6 +2559,11 @@ } } } + +\cs_set_protected:Npn \tag_struct_end:n #1 + { + \tag_struct_end: + } \cs_set_protected:Npn \tag_struct_use:n #1 %#1 is the label { \__tag_check_if_active_struct:T @@ -3005,10 +3009,14 @@ \bool_new:N \l__tag_para_show_bool \int_new:N \g__tag_para_begin_int \int_new:N \g__tag_para_end_int +\int_new:N \g__tag_para_main_begin_int +\int_new:N \g__tag_para_main_end_int \tl_new:N \l__tag_para_tag_default_tl -\tl_set:Nn \l__tag_para_tag_default_tl { P } +\tl_set:Nn \l__tag_para_tag_default_tl { text } \tl_new:N \l__tag_para_tag_tl \tl_set:Nn \l__tag_para_tag_tl { \l__tag_para_tag_default_tl } +\tl_new:N \l__tag_para_main_tag_tl +\tl_set:Nn \l__tag_para_main_tag_tl {text-unit} \keys_define:nn { __tag / setup } { paratagging .bool_set:N = \l__tag_para_bool, @@ -3017,7 +3025,9 @@ } \keys_define:nn { tag / tool} { - paratag .tl_set:N = \l__tag_para_tag_tl + paratag .tl_set:N = \l__tag_para_tag_tl, + unittag .tl_set:N = \l__tag_para_main_tag_tl, + para-flattened .bool_set:N = \l__tag_para_flattened_bool } \cs_new_protected:Npn \__tag_check_para_begin_show:nn #1 #2 %#1 color, #2 prefix @@ -3045,6 +3055,14 @@ { \bool_if:NT \l__tag_para_bool { + \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, + } + } \int_gincr:N \g__tag_para_begin_int \tag_struct_begin:n {tag=\l__tag_para_tag_tl} \__tag_check_para_begin_show:nn {green}{} @@ -3059,17 +3077,32 @@ \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_struct_end: + } } } \AddToHook{enddocument/info} { + \int_compare:nNnF {\g__tag_para_main_begin_int}={\g__tag_para_main_end_int} + { + \msg_error:nnxxx + {tag} + {para-hook-count-wrong} + {\int_use:N\g__tag_para_main_begin_int} + {\int_use:N\g__tag_para_main_end_int} + {text-unit} + } \int_compare:nNnF {\g__tag_para_begin_int}={\g__tag_para_end_int} { - \msg_error:nnxx + \msg_error:nnxxx {tag} {para-hook-count-wrong} {\int_use:N\g__tag_para_begin_int} {\int_use:N\g__tag_para_end_int} + {text} } } \AddToHook{begindocument/before} @@ -3102,7 +3135,8 @@ \renewcommand\tagpdfparaOff{\bool_set_false:N \l__tag_para_bool} \keys_define:nn { tag / tool} { - para .bool_set:N = \l__tag_para_bool + para .bool_set:N = \l__tag_para_bool, + para-flattened .bool_set:N = \l__tag_para_flattened_bool, } \NewDocumentCommand\tagpdfsuppressmarks{m} {{\use:c{__tag_mc_disable_marks:} #1}} diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty index df9d084a393..2501381ded3 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty @@ -1,9 +1,9 @@ %\RequirePackage[enable-debug]{expl3}[2018/06/14] -\ProvidesExplPackage {tagpdfdocu-patches} {2023-02-15} {0.98d} +\ProvidesExplPackage {tagpdfdocu-patches} {2023-03-07} {0.98e} {patches/commands for the tagpdf documentation} \RequirePackage{etoolbox,xpatch} -%vLogos +%Logos \ExplSyntaxOn \DeclareRobustCommand\TeX{ @@ -48,7 +48,7 @@ \AddToHook{cmd/emph/after} {\tag_mc_end:\tag_struct_end:\tag_mc_begin_pop:n{}} - +% minisec, correct tagging is still unclear. \newcommand\minisec[1]{% \if@noskipsec \leavevmode \fi \par @@ -66,75 +66,34 @@ \@afterheading } - +% listings. Unclear how to make it work for the original lstlisting, so we make a +% copy taglstlisting for now +\DeclareInstance{blockenv}{lstlisting}{display} +{ + env-name = lstlisting, + tag-name = verbatim, + tag-class = , + tagging-recipe = standard, + inner-level-counter = , + level-increase = false, + setup-code = , + block-instance = displayblock , + inner-instance = , + final-code = \tl_set:Nn \l__tag_para_main_tag_tl {codeline}\tagtool{paratag=Code}, +} + +\lstnewenvironment{taglstlisting}[2][]{% + \UseInstance{blockenv}{lstlisting} {} + \lst@TestEOLChar{#2}% + \lstset{#1}% + \csname\@lst @SetFirstNumber\endcsname% + }{% + \@nobreakfalse + \csname\@lst @SaveFirstNumber\endcsname% + \endblockenv + } -%%%% -%% Lists -%% patches enumitem internals! -%%%% -\tagpdfsetup - { - newattribute = - {itemize}{/O /List /ListNumbering/Unordered}, - newattribute = - {enumerate}{/O /List /ListNumbering/Ordered}, - newattribute = - {description}{/O /List /ListNumbering/Description}, - } -\AddToHook{env/itemize/begin}{\par\tagstructbegin{tag=L,attribute-class=itemize}}%\par is needed to close the paragraph before. -\AddToHook{env/itemize/end}{\par\tagstructend\tagstructend\tagstructend}%LBody,LI,L -\AddToHook{env/enumerate/begin}{\par\tagstructbegin{tag=L,attribute-class=enumerate}} -\AddToHook{env/enumerate/end}{\par\tagstructend\tagstructend\tagstructend}%LBody,LI,L -\AddToHook{env/description/begin}{\par\tagstructbegin{tag=L,attribute-class=description}} -\AddToHook{env/description/end}{\par\tagstructend\tagstructend\tagstructend}%LBody,LI,L - -\newcommand\tag@enit@format@preset[1]{% - \str_if_eq:eeTF { \prop_item:cn { g__tag_struct_\g__tag_struct_stack_current_tl _prop }{S} }{/L} - { - %\typeout{BEGIN~OF~LIST} - } - {%\typeout{NEXT ITEM} - \tagstructend\tagstructend} % for the LBody/LI - \tagstructbegin{tag=LI} - \tagstructbegin{tag=Lbl} - \tagmcbegin{} - #1 - \tagmcend - \tagstructend - \tagstructbegin{tag=LBody} - } - -\ExplSyntaxOff -\xpatchcmd\enit@preset{\@firstofone}{\tag@enit@format@preset}{}{\fail} -%close mc from paratagging and reopen ... -% this disturbs someone docCommand which has then a MC outside a P. -\xpatchcmd\@item{\box\@labels}{\tagmcend \box\@labels \tagmcbegin{tag=P}}{}{\fail} -\ExplSyntaxOn - -% keys that overwrite \enit@format must be patched, eg like the follow -% the font key should be patched in a similar way -\enitkv@key{}{format}{% new enumitem don't use first argument - \def\enit@format{% - \tagstructbegin{tag=LI}% - \tagstructbegin{tag=Lbl}% - \tagmcbegin{}% - #1\tagmcend}} - - -% listings + verbatim -% the paragraph code could create span around the lines ... -% we use Code for every line. - -\AddToHook{env/lstlisting/begin}{\tagpdfsetup{paratag=Code}} -\AddToHook{env/lstlisting/end}{} - -\AddToHook{env/verbatim/begin}{\tagpdfsetup{paratag=Code}} -\AddToHook{env/verbatim/end}{} - -\AddToHook{env/docCommand/begin}{\tagstructbegin{tag=P}\tagpdfsetup{paratag=Code}} -\AddToHook{env/docCommand/end} {\tagstructend} - -% ======== marginnote ========== + % ======== marginnote ========== % TODO marginnote has a bug (a \par is missing) so it messes up tagging. % but currently unneeded as we marked them up as artifacts anyway as they don't contain % meaningful contents @@ -144,6 +103,7 @@ \tag_mc_artifact_group_begin:n{notype}\tagpdfparaOff\marginnote{#1}\tag_mc_artifact_group_end: } +\ExplSyntaxOff % ======== tikzpicture ========== % TODO this needs some investigation: it messes up the stack if one add paraOff @@ -153,12 +113,21 @@ % We switch of paratagging at the begin and reenable it locally in before upper. % the before upper setting is dangerous as it can be overwritten by % users. So a more stable hook is needed. -%\AddToHook{env/tcolorbox/begin}{\tagpdfparaOff} -%\AddToHook{env/docCommand/begin}{\tagpdfparaOff} -%\tcbset{before~upper=\tagpdfparaOn} -\AddToHook{env/tcolorbox/begin}{\tagpdfparaOff \tcbset{before~upper=\tagpdfparaOn}} -\AddToHook{env/docCommand/begin}{\tagpdfparaOff \tcbset{before~upper=\tagpdfparaOn}} +% we force also a \par and add a div structure, to avoid clashes with the block +% tagging code. This needs revisting! + +\AddToHook{env/tcolorbox/before}{\par\tagstructbegin{tag=Div}} +\AddToHook{env/tcolorbox/begin}{\tagpdfparaOff \tcbset{before upper=\tagpdfparaOn}} +\AddToHook{env/tcolorbox/after}{\par\tagstructend} + +% this is not good and only temporary, but it is still unclear how to handle internal lists. +\ExplSyntaxOn +\AddToHook{env/docCommand/before}{\par\tagtool{para=false}\tagstructbegin{tag=Code}\tagmcbegin{}\tag_stop:} +\AddToHook{env/docCommand/after}{\par\tag_start:\tagmcend\tagstructend\tagtool{para=true}} \ExplSyntaxOff + +%\AddToHook{env/docCommand/begin}{\tagpdfparaOff \tcbset{before upper=\tagpdfparaOn}\tagtool{paratag=Code}\tagtool{para-flattened=true}} + % ======= footnote ======== % done in testphase code @@ -170,6 +139,16 @@ \newbibmacro*{begentry}{\tagstructbegin{tag=BibEntry}\tagmcbegin{}} \newbibmacro*{finentry}{\finentry\tagmcend\tagstructend} +\def\blx@endbibliography{% + \csuse{blx@endenv@\blx@theenv}% + \blx@noitem + \blx@locallabelwidth@finish + \endgroup + \blx@bibnote\blx@thepostnote +% \endgroup + \expandafter\endgroup\if@endpe\@doendpe\fi +} + % ====== hyperref ======== % this should probably go into tagpdf, but it is related to % problem of pdf strings and context .... |