diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/tagpdf')
17 files changed, 512 insertions, 293 deletions
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty index 3b4313ba490..a6f4347d43a 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty @@ -25,49 +25,28 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf.dtx -\ProvidesExplPackage {tagpdf-base} {2024-04-12} {0.99b} +\ProvidesExplPackage {tagpdf-base} {2024-09-16} {0.99f} {part of tagpdf - provide base, no-op versions of the user commands } +\cs_new_protected:Npn \__tag_whatsits: {} \AddToHook{begindocument} { \str_case:VnF \c_sys_backend_str { - { luatex } { \cs_new_protected:Npn \__tag_whatsits: {} } - { dvisvgm } { \cs_new_protected:Npn \__tag_whatsits: {} } + { luatex } { \cs_set_protected:Npn \__tag_whatsits: {} } + { dvisvgm } { \cs_set_protected:Npn \__tag_whatsits: {} } } { - \cs_new_protected:Npn \__tag_whatsits: {\tex_special:D {} } + \cs_set_protected:Npn \__tag_whatsits: {\tex_special:D {} } } } -\cs_if_free:NT \pdf_object_new_indexed:nn - { - \cs_generate_variant:Nn \pdf_object_new:n {e} - \cs_generate_variant:Nn \pdf_object_write:nnn {enn} - \cs_new_protected:Npn \pdf_object_new_indexed:nn #1 #2 - { - \pdf_object_new:e {#1/\int_eval:n{#2}} - } - \cs_new_protected:Npn \pdf_object_write_indexed:nnnn #1 #2 #3 #4 - { - \pdf_object_write:enn {#1/\int_eval:n{#2}}{#3}{#4} - } - \cs_generate_variant:Nn \pdf_object_write_indexed:nnnn {nnne} - \cs_new:Npn\pdf_object_ref_indexed:nn #1 #2 - { - \pdf_object_ref:e {#1/\int_eval:n{#2}} - } - \cs_new:Npn \__kernel_pdf_object_id_indexed:nn #1 #2 - { - \int_use:c - { c__pdf_object_ #1/\int_eval:n{#2} _int } - } - } - \cs_new_protected:Npn \tag_stop:{} \cs_new_protected:Npn \tag_start:{} \cs_new_protected:Npn \tagstop{} \cs_new_protected:Npn \tagstart{} \cs_new_protected:Npn \tag_stop:n #1 {} \cs_new_protected:Npn \tag_start:n #1 {} +\cs_set_eq:NN \tag_suspend:n \tag_stop:n +\cs_set_eq:NN \tag_resume:n \tag_start:n %% File: tagpdf-mc-generic.dtx \cs_new_protected:Npn \tag_mc_begin:n #1 { \__tag_whatsits: \int_gincr:N \c@g__tag_MCID_abs_int } \cs_new_protected:Nn \tag_mc_end:{ \__tag_whatsits: } @@ -105,6 +84,7 @@ \cs_new_protected:Npn \tag_struct_end:n{} \cs_new_protected:Npn \tag_struct_use:n #1 {} \cs_new_protected:Npn \tag_struct_use_num:n #1 {} +\cs_new_protected:Npn \tag_struct_gput:nnn #1 #2 #3{} %% File: tagpdf-checks.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 87f53aa1b37..10b9399ba38 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} {2024-04-12} {0.99b} +\ProvidesExplPackage {tagpdf-debug-generic} {2024-09-16} {0.99f} {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-lua.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-lua.sty index dc4b9f23fd5..104228a144e 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-lua.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-lua.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-mc-luacode.dtx -\ProvidesExplPackage {tagpdf-debug-lua} {2024-04-12} {0.99b} +\ProvidesExplPackage {tagpdf-debug-lua} {2024-09-16} {0.99f} {part of tagpdf - debugging code related to marking chunks - lua mode} \cs_set_protected:Npn \__tag_mc_handle_stash:n #1 %1 mcidnum { diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty index c68acae7bac..198c0be0c0a 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty @@ -26,38 +26,14 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf.dtx -\ProvidesExplPackage {tagpdf-debug} {2024-04-12} {0.99b} +\ProvidesExplPackage {tagpdf-debug} {2024-09-16} {0.99f} { debug code for tagpdf } \@ifpackageloaded{tagpdf}{}{\PackageWarning{tagpdf-debug}{tagpdf~not~loaded,~quitting}\endinput} \prop_gput:Nnn \g_msg_module_type_prop { tag / debug} {} \prop_gput:Nnn \g_msg_module_name_prop { tag / debug }{tagpdf~DEBUG} -\cs_if_free:NT \pdf_object_new_indexed:nn - { - \cs_generate_variant:Nn \pdf_object_new:n {e} - \cs_generate_variant:Nn \pdf_object_write:nnn {enn} - \cs_new_protected:Npn \pdf_object_new_indexed:nn #1 #2 - { - \pdf_object_new:e {#1/\int_eval:n{#2}} - } - \cs_new_protected:Npn \pdf_object_write_indexed:nnnn #1 #2 #3 #4 - { - \pdf_object_write:enn {#1/\int_eval:n{#2}}{#3}{#4} - } - \cs_generate_variant:Nn \pdf_object_write_indexed:nnnn {nnne} - \cs_new:Npn\pdf_object_ref_indexed:nn #1 #2 - { - \pdf_object_ref:e {#1/\int_eval:n{#2}} - } - \cs_new:Npn \__kernel_pdf_object_id_indexed:nn #1 #2 - { - \int_use:c - { c__pdf_object_ #1/\int_eval:n{#2} _int } - } - } - \cs_set_protected:Npn \tag_stop: { - \msg_note:nne {tag / debug }{tag-stop}{ \int_use:N \l__tag_tag_stop_int } + \msg_note:nne {tag / debug }{tag-suspend}{ \int_use:N \l__tag_tag_stop_int } \int_incr:N \l__tag_tag_stop_int \bool_set_false:N \l__tag_active_struct_bool \bool_set_false:N \l__tag_active_mc_bool @@ -74,20 +50,22 @@ \bool_set_true:N \l__tag_active_socket_bool \__tag_start_para_ints: } - \msg_note:nne {tag / debug }{tag-start}{ \int_use:N \l__tag_tag_stop_int } + \msg_note:nne {tag / debug }{tag-resume}{ \int_use:N \l__tag_tag_stop_int } } \cs_set_eq:NN\tagstop\tag_stop: \cs_set_eq:NN\tagstart\tag_start: -\cs_set_protected:Npn \tag_stop:n #1 +\cs_set_protected:Npn \tag_suspend:n #1 { - \msg_note:nnee {tag / debug }{tag-stop}{ \int_use:N \l__tag_tag_stop_int }{#1} + \msg_note:nnee {tag / debug }{tag-suspend} + { \int_use:N \l__tag_tag_stop_int }{\exp_not:n{#1}} \int_incr:N \l__tag_tag_stop_int \bool_set_false:N \l__tag_active_struct_bool \bool_set_false:N \l__tag_active_mc_bool \bool_set_false:N \l__tag_active_socket_bool \__tag_stop_para_ints: } -\cs_set_protected:Npn \tag_start:n #1 +\cs_set_eq:NN \tag_stop:n \tag_suspend:n +\cs_set_protected:Npn \tag_resume:n #1 { \int_if_zero:nF { \l__tag_tag_stop_int } { \int_decr:N \l__tag_tag_stop_int } \int_if_zero:nT { \l__tag_tag_stop_int } @@ -97,8 +75,10 @@ \bool_set_true:N \l__tag_active_socket_bool \__tag_start_para_ints: } - \msg_note:nnee {tag / debug }{tag-start}{ \int_use:N \l__tag_tag_stop_int }{#1} + \msg_note:nnee {tag / debug }{tag-resume} + { \int_use:N \l__tag_tag_stop_int }{\exp_not:n{#1}} } +\cs_set_eq:NN \tag_start:n \tag_resume:n \bool_if:NTF \g__tag_mode_lua_bool { \RequirePackage {tagpdf-debug-lua} @@ -217,20 +197,20 @@ } } } -\msg_new:nnn { tag / debug } {tag-stop} +\msg_new:nnn { tag / debug } {tag-suspend} { \int_if_zero:nTF {#1} - {Tagging~stopped} - {Tagging~(not)~stopped~(already~inactive)}\\ + {Tagging~suspended} + {Tagging~(not)~suspended~(already~inactive)}\\ level:~#1~==>~\int_eval:n{#1+1}\tl_if_empty:nF{#2}{,~label:~#2}~[\msg_line_context:] } -\msg_new:nnn { tag / debug } {tag-start} +\msg_new:nnn { tag / debug } {tag-resume} { \int_if_zero:nTF {#1} - {Tagging~restarted} - {Tagging~(not)~restarted}\\ + {Tagging~resumed} + {Tagging~(not)~resumed}\\ level:~\int_eval:n{#1+1}~==>~#1\tl_if_empty:nF{#2}{,~label:~#2}~[\msg_line_context:] } %% File: tagpdf-user.dtx @@ -279,13 +259,13 @@ { g__tag_struct_#1_prop }{#2}{#3} \prop_gput:cnn { g__tag_struct_debug_#1_prop } {#2} {#3} } -\cs_generate_variant:Nn \__tag_struct_prop_gput:nnn {nne,nee,nno} +\cs_generate_variant:Nn \__tag_struct_prop_gput:nnn {onn,nne,nee,nno} \prop_new:c { g__tag_struct_debug_1_prop } \seq_new:c { g__tag_struct_debug_kids_1_seq } \prop_gset_eq:cc { g__tag_struct_debug_1_prop }{ g__tag_struct_1_prop } \prop_gremove:cn { g__tag_struct_debug_1_prop }{Namespaces} -\cs_set_protected:Npn \__tag_struct_kid_mc_gput_right:nn #1 #2 %#1 structure num, #2 MCID absnum% +\cs_set_protected:Npn \__tag_struct_kid_mc_gput_right:nn #1 #2 { \__tag_seq_gput_right:ce { g__tag_struct_kids_#1_seq } @@ -303,7 +283,8 @@ \prop_item:Nn \g__tag_struct_cont_mc_prop {#2} } } -\cs_set_protected:Npn\__tag_struct_kid_struct_gput_right:nn #1 #2 %#1 num of parent struct, #2 kid struct +\cs_set_protected:Npn\__tag_struct_kid_struct_gput_right:nn #1 #2 +%%#1 num of parent struct, #2 kid struct { \__tag_seq_gput_right:ce { g__tag_struct_kids_#1_seq } @@ -316,8 +297,22 @@ Struct~#2 } } - +\cs_set_protected:Npn\__tag_struct_kid_struct_gput_left:nn #1 #2 +%%#1 num of parent struct, #2 kid struct + { + \__tag_seq_gput_left:ce + { g__tag_struct_kids_#1_seq } + { + \pdf_object_ref_indexed:nn { __tag/struct }{ #2 } + } + \seq_gput_left:cn + { g__tag_struct_debug_kids_#1_seq } + { + Struct~#2 + } + } \cs_set_protected:Npn\__tag_struct_kid_OBJR_gput_right:nnn #1 #2 #3 +%%#1 num of parent struct,#2 obj reference,#3 page object reference { \pdf_object_unnamed_write:nn { dict } @@ -371,13 +366,6 @@ \g__tag_struct_tag_tl \g__tag_struct_tag_NS_tl \__tag_check_structure_has_tag:n { \int_use:N \c@g__tag_struct_abs_int } - \tl_if_empty:NF - \l__tag_struct_key_label_tl - { - \__tag_property_record:eV - {tagpdfstruct-\l__tag_struct_key_label_tl} - \c__tag_property_struct_clist - } \int_compare:nNnT { \l__tag_struct_stack_parent_tmpa_tl } = { -1 } { \seq_get:NNF @@ -450,6 +438,7 @@ { g__tag_struct_ \l__tag_struct_stack_parent_tmpa_tl _prop} {S} \l__tag_tmpa_tl + \quark_if_no_value:NT\l__tag_tmpa_tl{\tl_set:Nn \l__tag_tmpa_tl{UNKNOWN}} \msg_warning:nneee { tag } {role-parent-child} @@ -478,7 +467,7 @@ %record this structure as kid: %\tl_show:N \g__tag_struct_stack_current_tl %\tl_show:N \l__tag_struct_stack_parent_tmpa_tl - \__tag_struct_kid_struct_gput_right:ee + \use:c { __tag_struct_kid_struct_gput_ \l__tag_struct_addkid_tl :ee } { \l__tag_struct_stack_parent_tmpa_tl } { \g__tag_struct_stack_current_tl } %\prop_show:c { g__tag_struct_\g__tag_struct_stack_current_tl _prop } @@ -553,29 +542,29 @@ \__tag_check_if_active_struct:T { \prop_if_exist:cTF - { g__tag_struct_\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{unknown}_prop } % + { g__tag_struct_\property_ref:enn{tagpdfstruct-#1}{tagstruct}{unknown}_prop } % { \__tag_check_struct_used:n {#1} %add the label structure as kid to the current structure (can be the root) \__tag_struct_kid_struct_gput_right:ee { \g__tag_struct_stack_current_tl } - { \__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1} } + { \property_ref:enn{tagpdfstruct-#1}{tagstruct}{1} } %add the current structure to the labeled one as parents \__tag_prop_gput:cne - { g__tag_struct_\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}_prop } + { g__tag_struct_\property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}_prop } { P } { \pdf_object_ref_indexed:nn { __tag/struct } { \g__tag_struct_stack_current_tl } } \prop_gput:cne - { g__tag_struct_debug_\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}_prop } + { g__tag_struct_debug_\property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}_prop } { P } { parent~structure:~\g__tag_struct_stack_current_tl\c_space_tl=~ \g__tag_struct_tag_tl } \__tag_struct_get_parentrole:eNN - {\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}} + {\property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}} \l__tag_tmpa_tl \l__tag_tmpb_tl \__tag_check_parent_child:VVVVN diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def index 60acd57cf1b..9782383e677 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} {2024-04-12} {0.99b} +\ProvidesExplFile {tagpdf-luatex.def} {2024-09-16} {0.99f} {tagpdf~driver~for~luatex} { \fontencoding{TU}\fontfamily{lmr}\fontseries{m}\fontshape{n}\fontsize{10pt}{10pt}\selectfont @@ -46,7 +46,7 @@ \cs_set_protected:Npn \__tag_prop_gput:Nnn #1 #2 #3 { \prop_gput:Nnn #1 { #2 } { #3 } - \lua_now:e { ltx.__tag.tables.\cs_to_str:N#1 ["#2"] = "#3" } + \lua_now:e { ltx.__tag.tables.\cs_to_str:N#1 ["#2"] = "\lua_escape:n{#3}" } } \cs_set_protected:Npn \__tag_seq_gput_right:Nn #1 #2 @@ -54,7 +54,11 @@ \seq_gput_right:Nn #1 { #2 } \lua_now:e { table.insert(ltx.__tag.tables.\cs_to_str:N#1, "#2") } } - +\cs_set_protected:Npn \__tag_seq_gput_left:Nn #1 #2 + { + \seq_gput_left:Nn #1 { #2 } + \lua_now:e { table.insert(ltx.__tag.tables.\cs_to_str:N#1, "#2") } + } \cs_set:Npn \__tag_seq_item:cn #1 #2 { 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 3265398f323..e15b161e45a 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} {2024-04-12} {0.99b} +\ProvidesExplPackage {tagpdf-mc-code-generic} {2024-09-16} {0.99f} {part of tagpdf - code related to marking chunks - generic mode} \tl_new:N \l__tag_mc_ref_abspage_tl @@ -276,14 +276,14 @@ \__tag_prop_new:N \g__tag_MCID_byabspage_prop \int_new:N \g__tag_MCID_tmp_bypage_int \cs_generate_variant:Nn \__tag_mc_bdc:nn {ne} - \__tag_property_gset:nnnn {tagmcid } { now } + \property_gset:nnnn {tagmcid } { now } {0} { \int_use:N \g__tag_MCID_tmp_bypage_int } \cs_new_protected:Npn \__tag_mc_bdc_mcid:nn #1 #2 { \int_gincr:N \c@g__tag_MCID_abs_int \tl_set:Ne \l__tag_mc_ref_abspage_tl { - \__tag_property_ref:enn %3 args + \property_ref:enn %3 args { mcid-\int_use:N \c@g__tag_MCID_abs_int } 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 c5a29e7d608..cdaa00d7421 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} {2024-04-12} {0.99b} +\ProvidesExplPackage {tagpdf-mc-code-lua} {2024-09-16} {0.99f} {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 9cfda9d64bd..1e3f6a621f0 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} {2024-04-12} {0.99b} +%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2024-09-16} {0.99f} %% {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.def b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def index 73673fd39de..23ed98ec64e 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} {2024-04-12} {0.99b} +%% \ProvidesExplFile {tagpdf-ns-latex.def} {2024-09-16} {0.99f} %% {latex} {https://www.latex-project.org/ns/dflt/2022}{} title, Title, pdf2, part, Title, pdf2, 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 fb712526194..89c8e7192d8 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} {2024-04-12} {0.99b} +%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2024-09-16} {0.99f} abs,abs,mathml, and,and,mathml, annotation,annotation,mathml, 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 cdd6116f9f9..013cd0a2e91 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} {2024-04-12} {0.99b} +%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2024-09-16} {0.99f} %% {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 6c745639fdc..f00b99a5632 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} {2024-04-12} {0.99b} +%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2024-09-16} {0.99f} %% {pdf2} {http://iso.org/pdf2/ssn}{} StructTreeRoot,StructTreeRoot,pdf2,D, Document,Document,pdf2,D, 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 e04a559b1af..29dc81f79f4 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} {2024-04-12} {0.99b} +%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2024-09-16} {0.99f} ,,,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 1333fe7bda6..38f5c33947c 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} {2024-04-12} {0.99b} +%% \ProvidesExplFile {tagpdf-parent-child.csv} {2024-09-16} {0.99f} ,,,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 cc75987715d..5aec9d346da 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.99b", --TAGVERSION - date = "2024-04-12", --TAGDATE + version = "0.99f", --TAGVERSION + date = "2024-09-16", --TAGDATE description = "tagpdf lua code", license = "The LATEX Project Public License 1.3c" } @@ -53,8 +53,8 @@ ltx.__tag.page will contain page data ltx.__tag.tables contains also data from mc and struct (from older code). This needs cleaning up. There are certainly dublettes, but I don't dare yet ... ltx.__tag.func will contain (public) functions. -ltx.__tag.trace will contain tracing/loging functions. -local funktions starts with __ +ltx.__tag.trace will contain tracing/logging functions. +local functions starts with __ functions meant for users will be in ltx.tag functions @@ -67,7 +67,7 @@ functions ltx.__tag.func.store_mc_kid (mcnum,kid,page): stores the mc-kids of mcnum on page page ltx.__tag.func.store_mc_in_page(mcnum,mcpagecnt,page): stores in the page table the number of mcnum on this page ltx.__tag.func.store_struct_mcabs (structnum,mcnum): stores relations structnum<->mcnum (abs) - ltx.__tag.func.mc_insert_kids (mcnum): inserts the /K entries for mcnum by wandering throught the [kids] table + ltx.__tag.func.mc_insert_kids (mcnum): inserts the /K entries for mcnum by wandering through the [kids] table ltx.__tag.func.mark_page_elements(box,mcpagecnt,mccntprev,mcopen,name,mctypeprev) : the main function ltx.__tag.func.mark_shipout (): a wrapper around the core function which inserts the last EMC ltx.__tag.func.fill_parent_tree_line (page): outputs the entries of the parenttree for this page @@ -90,6 +90,8 @@ local iwspaceattributeid = luatexbase.new_attribute ("g__tag_interwordspace_attr local iwfontattributeid = luatexbase.new_attribute ("g__tag_interwordfont_attr") local tagunmarkedbool= token.create("g__tag_tagunmarked_bool") local truebool = token.create("c_true_bool") +local softhyphenbool = token.create("g__tag_softhyphen_bool") + local catlatex = luatexbase.registernumber("catcodetable@latex") local tableinsert = table.insert local nodeid = node.id @@ -121,6 +123,9 @@ local KERN = node.id("kern") local PENALTY = node.id("penalty") local LOCAL_PAR = node.id("local_par") local MATH = node.id("math") + +local explicit_disc = 1 +local regular_disc = 3 ltx = ltx or { } ltx.__tag = ltx.__tag or { } ltx.__tag.mc = ltx.__tag.mc or { } -- mc data @@ -826,5 +831,53 @@ function ltx.__tag.func.output_parenttree (abspage) tex.sprint(catlatex,line) end end +do + local properties = node.get_properties_table() + local is_soft_hyphen_prop = 'tagpdf.rewrite-softhyphen.is_soft_hyphen' + local hyphen_char = 0x2D + local soft_hyphen_char = 0xAD + local softhyphen_fonts = setmetatable({}, {__index = function(t, fid) + local fdir = identifiers[fid] + local format = fdir and fdir.format + local result = (format == 'opentype' or format == 'truetype') + local characters = fdir and fdir.characters + result = result and (characters and characters[soft_hyphen_char]) ~= nil + t[fid] = result + return result + end}) + local function process_softhyphen_pre(head, _context, _dir) + if softhyphenbool.mode ~= truebool.mode then return true end + for disc, sub in node.traverse_id(DISC, head) do + if sub == explicit_disc or sub == regular_disc then + for n, _ch, _f in node.traverse_char(disc.pre) do + local props = properties[n] + if not props then + props = {} + properties[n] = props + end + props[is_soft_hyphen_prop] = true + end + end + end + return true + end + + local function process_softhyphen_post(head, _context, _dir) + if softhyphenbool.mode ~= truebool.mode then return true end + for disc, sub in node.traverse_id(DISC, head) do + for n, ch, fid in node.traverse_glyph(disc.pre) do + local props = properties[n] + if softhyphen_fonts[fid] and ch == hyphen_char and props and props[is_soft_hyphen_prop] then + n.char = soft_hyphen_char + props.glyph_info = nil + end + end + end + return true + end + + luatexbase.add_to_callback('pre_shaping_filter', process_softhyphen_pre, 'tagpdf.rewrite-softhyphen') + luatexbase.add_to_callback('post_shaping_filter', process_softhyphen_post, 'tagpdf.rewrite-softhyphen') +end -- -- End of File `tagpdf.lua'. diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty index d021f6d303c..2f85934f312 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty @@ -28,8 +28,8 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf.dtx -\ProvidesExplPackage {tagpdf} {2024-04-12} {0.99b} - { A package to experiment with pdf tagging } +\ProvidesExplPackage {tagpdf} {2024-09-16} {0.99f} + { LaTeX kernel code for PDF tagging } \bool_if:nF { @@ -65,30 +65,23 @@ \ExecuteOptions{luamode} \ProcessOptions \RequirePackage{tagpdf-base} -\cs_if_free:NT \pdf_object_new_indexed:nn - { - \cs_generate_variant:Nn \pdf_object_new:n {e} - \cs_generate_variant:Nn \pdf_object_write:nnn {enn} - \cs_new_protected:Npn \pdf_object_new_indexed:nn #1 #2 - { - \pdf_object_new:e {#1/\int_eval:n{#2}} - } - \cs_new_protected:Npn \pdf_object_write_indexed:nnnn #1 #2 #3 #4 - { - \pdf_object_write:enn {#1/\int_eval:n{#2}}{#3}{#4} - } - \cs_generate_variant:Nn \pdf_object_write_indexed:nnnn {nnne} - \cs_new:Npn\pdf_object_ref_indexed:nn #1 #2 - { - \pdf_object_ref:e {#1/\int_eval:n{#2}} - } - \cs_new:Npn \__kernel_pdf_object_id_indexed:nn #1 #2 - { - \int_use:c - { c__pdf_object_ #1/\int_eval:n{#2} _int } - } - } - +\AddToHook{package/latex-lab-testphase-new-or-2/after} + { + \cs_set_protected:Npn \__fnote_gput_ref:nn #1 #2 %#1 the structure number receiving the ref #2 + { + \tag_struct_gput:nnn {#1}{ref_num}{#2} + } + } +\AddToHook{package/latex-lab-testphase-toc/after} + { + \cs_set_protected:Npn \g__tag_struct_ref_by_dest: + { + \prop_map_inline:Nn\g__tag_struct_ref_by_dest_prop + { + \tag_struct_gput:nnn {##1}{ref_dest}{##2} + } + } + } \cs_new_protected:Npn \__tag_lastpagelabel: { \legacy_if:nT { @filesw } @@ -110,6 +103,7 @@ {\__tag_lastpagelabel:} \tl_new:N \l__tag_tmpa_tl \tl_new:N \l__tag_tmpb_tl +\tl_new:N \l__tag_Ref_tmpa_tl \tl_new:N \l__tag_get_tmpc_tl \tl_new:N \l__tag_get_parent_tmpa_tl \tl_new:N \l__tag_get_parent_tmpb_tl @@ -137,6 +131,7 @@ \bool_set_true:N \l__tag_active_struct_bool \bool_new:N \l__tag_active_socket_bool \bool_new:N \g__tag_tagunmarked_bool +\bool_new:N \g__tag_softhyphen_bool \prg_generate_conditional_variant:Nnn \pdf_object_if_exist:n {e}{T,F,TF} \cs_generate_variant:Nn \pdf_object_ref:n {e} \cs_generate_variant:Nn \pdfannot_dict_put:nnn {nne} @@ -147,10 +142,6 @@ \cs_generate_variant:Nn \seq_set_split:Nnn{Nne} %** unneeded \cs_generate_variant:Nn \str_set_convert:Nnnn {Nonn, Noon, Nnon } \cs_generate_variant:Nn \clist_map_inline:nn {on} - \cs_new_eq:NN \__tag_property_new:nnnn \property_new:nnnn - \cs_new_eq:NN \__tag_property_gset:nnnn \property_gset:nnnn - \cs_new_eq:NN \__tag_property_ref:nnn \property_ref:nnn - \cs_new_eq:NN \__tag_property_ref:nn \property_ref:nn \cs_new_protected:Npn \__tag_property_record:nn #1#2 { \@bsphack @@ -158,29 +149,29 @@ \@esphack } -\cs_generate_variant:Nn \__tag_property_ref:nnn {enn} -\cs_generate_variant:Nn \__tag_property_ref:nn {en} +\cs_generate_variant:Nn \property_ref:nnn {enn} +\cs_generate_variant:Nn \property_ref:nn {en} \cs_generate_variant:Nn \__tag_property_record:nn {en,eV} \cs_new:Npn \__tag_property_ref_lastpage:nn #1 #2 { - \__tag_property_ref:nnn {@tag@LastPage}{#1}{#2} + \property_ref:nnn {@tag@LastPage}{#1}{#2} } -\__tag_property_new:nnnn +\property_new:nnnn { tagstruct } { now } - {0} { \int_use:N \c@g__tag_struct_abs_int } -\__tag_property_new:nnnn { tagstructobj } { now } {} + {1} { \int_use:N \c@g__tag_struct_abs_int } +\property_new:nnnn { tagstructobj } { now } {} { \pdf_object_ref_indexed:nn { __tag/struct } { \c@g__tag_struct_abs_int } } -\__tag_property_new:nnnn +\property_new:nnnn { tagabspage } { shipout } {0} { \int_use:N \g_shipout_readonly_int } -\__tag_property_new:nnnn { tagmcabs } { now } +\property_new:nnnn { tagmcabs } { now } {0} { \int_use:N \c@g__tag_MCID_abs_int } \flag_new:n { __tag/mcid } -\__tag_property_new:nnnn {tagmcid } { shipout } +\property_new:nnnn {tagmcid } { shipout } {0} { \flag_height:n { __tag/mcid } } @@ -189,12 +180,14 @@ \cs_set_eq:NN \__tag_seq_new:N \seq_new:N \cs_set_eq:NN \__tag_prop_gput:Nnn \prop_gput:Nnn \cs_set_eq:NN \__tag_seq_gput_right:Nn \seq_gput_right:Nn +\cs_set_eq:NN \__tag_seq_gput_left:Nn \seq_gput_left:Nn \cs_set_eq:NN \__tag_seq_item:cn \seq_item:cn \cs_set_eq:NN \__tag_prop_item:cn \prop_item:cn \cs_set_eq:NN \__tag_seq_show:N \seq_show:N \cs_set_eq:NN \__tag_prop_show:N \prop_show:N \cs_generate_variant:Nn \__tag_prop_gput:Nnn { Nen , Nee, Nne , cnn, cen, cne, cno, cnx} \cs_generate_variant:Nn \__tag_seq_gput_right:Nn { Ne , No, cn, ce } +\cs_generate_variant:Nn \__tag_seq_gput_left:Nn { ce } \cs_generate_variant:Nn \__tag_prop_new:N { c } \cs_generate_variant:Nn \__tag_seq_new:N { c } \cs_generate_variant:Nn \__tag_seq_show:N { c } @@ -221,7 +214,7 @@ } \cs_set_eq:NN\tagstop\tag_stop: \cs_set_eq:NN\tagstart\tag_start: -\cs_set_protected:Npn \tag_stop:n #1 +\cs_set_protected:Npn \tag_suspend:n #1 { \int_incr:N \l__tag_tag_stop_int \bool_set_false:N \l__tag_active_struct_bool @@ -229,7 +222,8 @@ \bool_set_false:N \l__tag_active_socket_bool \__tag_stop_para_ints: } -\cs_set_protected:Npn \tag_start:n #1 +\cs_set_eq:NN \tag_stop:n \tag_suspend:n +\cs_set_protected:Npn \tag_resume:n #1 { \int_if_zero:nF { \l__tag_tag_stop_int } { \int_decr:N \l__tag_tag_stop_int } \int_if_zero:nT { \l__tag_tag_stop_int } @@ -240,6 +234,7 @@ \__tag_start_para_ints: } } +\cs_set_eq:NN \tag_start:n \tag_resume:n \keys_define:nn { __tag / setup } { activate/mc .bool_gset:N = \g__tag_active_mc_bool, @@ -273,6 +268,8 @@ activate/tagunmarked .bool_gset:N = \g__tag_tagunmarked_bool, activate/tagunmarked .initial:n = true, tagunmarked .bool_gset:N = \g__tag_tagunmarked_bool, + activate/softhyphen .bool_gset:N = \g__tag_softhyphen_bool, + activate/softhyphen .initial:n = true, page/tabsorder .choice:, page/tabsorder / row .code:n = \pdfmanagement_add:nnn { Page } {Tabs}{/R}, @@ -326,6 +323,11 @@ { structure~with~label~#1~is~unknown~rerun} \msg_new:nnn { tag } {struct-show-closing} { closing~structure~#1~tagged~\use:e{\prop_item:cn{g__tag_struct_#1_prop}{S}} } +\msg_new:nnn { tag } {struct-Ref-unknown} + { + #1~has~no~related~structure.\\ + /Ref~not~updated. + } \msg_new:nnn { tag } {tree-struct-still-open} { There~are~still~open~structures~on~the~stack!\\ @@ -432,7 +434,7 @@ \cs_new_protected:Npn \__tag_check_struct_used:n #1 %#1 label { \prop_get:cnNT - {g__tag_struct_\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{unknown}_prop} + {g__tag_struct_\property_ref:enn{tagpdfstruct-#1}{tagstruct}{unknown}_prop} {P} \l__tag_tmpa_tl { @@ -565,7 +567,7 @@ { \int_compare:nT { - \__tag_property_ref:enn + \property_ref:enn {mcid-####1} {tagabspage} {-1} @@ -576,7 +578,7 @@ \seq_gput_right:Ne \l_tmpa_seq { Page##1-####1- - \__tag_property_ref:enn + \property_ref:enn {mcid-####1} {tagmcid} {-1} @@ -646,7 +648,7 @@ { \__tag_check_if_active_struct:T { - \tl_set:Ne \l__tag_tmpa_tl { \__tag_property_ref:nnn{tagpdf-#1}{tagmcabs}{} } + \tl_set:Ne \l__tag_tmpa_tl { \property_ref:nnn{tagpdf-#1}{tagmcabs}{} } \tl_if_empty:NTF\l__tag_tmpa_tl { \msg_warning:nnn {tag} {mc-label-unknown} {#1} @@ -668,12 +670,12 @@ \tag_mc_end_push: \tag_mc_begin:n {artifact=#1} \group_begin: - \tag_stop:n{artifact-group} + \tag_suspend:n{artifact-group} } \cs_set_protected:Npn \tag_mc_artifact_group_end: { - \tag_start:n{artifact-group} + \tag_resume:n{artifact-group} \group_end: \tag_mc_end: \tag_mc_begin_pop:n{} @@ -756,30 +758,6 @@ }, } %% File: tagpdf.dtx -\cs_if_free:NT \pdf_object_new_indexed:nn - { - \cs_generate_variant:Nn \pdf_object_new:n {e} - \cs_generate_variant:Nn \pdf_object_write:nnn {enn} - \cs_new_protected:Npn \pdf_object_new_indexed:nn #1 #2 - { - \pdf_object_new:e {#1/\int_eval:n{#2}} - } - \cs_new_protected:Npn \pdf_object_write_indexed:nnnn #1 #2 #3 #4 - { - \pdf_object_write:enn {#1/\int_eval:n{#2}}{#3}{#4} - } - \cs_generate_variant:Nn \pdf_object_write_indexed:nnnn {nnne} - \cs_new:Npn\pdf_object_ref_indexed:nn #1 #2 - { - \pdf_object_ref:e {#1/\int_eval:n{#2}} - } - \cs_new:Npn \__kernel_pdf_object_id_indexed:nn #1 #2 - { - \int_use:c - { c__pdf_object_ #1/\int_eval:n{#2} _int } - } - } - \bool_if:NTF \g__tag_mode_lua_bool { \RequirePackage {tagpdf-mc-code-lua} @@ -925,6 +903,7 @@ { \l__tag_tmpa_tl } + \prop_gput:cnn { g__tag_struct_1_prop } {S}{ /StructTreeRoot } } \cs_new_protected:Npn \__tag_tree_write_structelements: { @@ -960,11 +939,11 @@ { %mcid####1 \int_compare:nT - {\__tag_property_ref:enn{mcid-####1}{tagabspage}{-1}=##1} %mcid is on current page + {\property_ref:enn{mcid-####1}{tagabspage}{-1}=##1} %mcid is on current page {% yes \prop_put:Nee \l__tag_tmpa_prop - {\__tag_property_ref:enn{mcid-####1}{tagmcid}{-1}} + {\property_ref:enn{mcid-####1}{tagmcid}{-1}} {\prop_item:Nn \g__tag_mc_parenttree_prop {####1}} } } @@ -1547,19 +1526,31 @@ { \hook_gput_code:nnn {begindocument}{tagpdf} { - \cs_if_exist:NT \chapter - { - \prop_map_inline:cn{g__tag_role_NS_latex-book_prop} - { - \__tag_role_add_tag:ne {#1}{\use_i:nn #2\c_empty_tl\c_empty_tl} - } - } + \bool_lazy_and:nnT + { + \cs_if_exist_p:N \chapter + } + { + \cs_if_exist_p:N \c@chapter + } + { + \prop_map_inline:cn{g__tag_role_NS_latex-book_prop} + { + \__tag_role_add_tag:ne {#1}{\use_i:nn #2\c_empty_tl\c_empty_tl} + } + } } } { \hook_gput_code:nnn {begindocument}{tagpdf} { - \cs_if_exist:NT \chapter + \bool_lazy_and:nnT + { + \cs_if_exist_p:N \chapter + } + { + \cs_if_exist_p:N \c@chapter + } { \prop_map_inline:cn{g__tag_role_NS_latex-book_prop} { @@ -1972,7 +1963,7 @@ T, %title, value in () or <> Lang, %language Alt, % value in () or <> - E, % abreviation + E, % abbreviation ActualText, AF, %pdf 2.0, array of dict, associated files NS, %pdf 2.0, dict, namespace @@ -1983,8 +1974,12 @@ \tl_new:N \g__tag_struct_tag_NS_tl \tl_new:N \l__tag_struct_roletag_tl \tl_new:N \l__tag_struct_roletag_NS_tl -\tl_new:N \l__tag_struct_key_label_tl +\prop_new_linked:N \g__tag_struct_label_num_prop + \bool_new:N \l__tag_struct_elem_stash_bool +\tl_new:N \l__tag_struct_addkid_tl +\tl_set:Nn \l__tag_struct_addkid_tl {right} + \prop_new_linked:N \g__tag_struct_ref_by_dest_prop \cs_new:Npn \__tag_struct_output_prop_aux:nn #1 #2 %#1 num, #2 key { @@ -2008,7 +2003,7 @@ \__tag_prop_gput:cnn { g__tag_struct_#1_prop }{#2}{#3} } -\cs_generate_variant:Nn \__tag_struct_prop_gput:nnn {nne,nee,nno} +\cs_generate_variant:Nn \__tag_struct_prop_gput:nnn {onn,nne,nee,nno} \tl_gset:Nn \g__tag_struct_stack_current_tl {1} \cs_new:Npn \__tag_pdf_name_e:n #1{\pdf_name_from_unicode_e:n{#1}} @@ -2105,11 +2100,11 @@ /Type \c_space_tl /MCR \c_space_tl /Pg \c_space_tl - \pdf_pageobject_ref:n { \__tag_property_ref:enn{mcid-#1}{tagabspage}{1} } - /MCID \c_space_tl \__tag_property_ref:enn{mcid-#1}{tagmcid}{1} + \pdf_pageobject_ref:n { \property_ref:enn{mcid-#1}{tagabspage}{1} } + /MCID \c_space_tl \property_ref:enn{mcid-#1}{tagmcid}{1} >> } -\cs_new_protected:Npn \__tag_struct_kid_mc_gput_right:nn #1 #2 %#1 structure num, #2 MCID absnum% +\cs_new_protected:Npn \__tag_struct_kid_mc_gput_right:nn #1 #2 { \__tag_seq_gput_right:ce { g__tag_struct_kids_#1_seq } @@ -2123,7 +2118,8 @@ } } \cs_generate_variant:Nn \__tag_struct_kid_mc_gput_right:nn {ne} -\cs_new_protected:Npn\__tag_struct_kid_struct_gput_right:nn #1 #2 %#1 num of parent struct, #2 kid struct +\cs_new_protected:Npn\__tag_struct_kid_struct_gput_right:nn #1 #2 +%%#1 num of parent struct, #2 kid struct { \__tag_seq_gput_right:ce { g__tag_struct_kids_#1_seq } @@ -2131,11 +2127,21 @@ \pdf_object_ref_indexed:nn { __tag/struct }{ #2 } } } - \cs_generate_variant:Nn \__tag_struct_kid_struct_gput_right:nn {ee} -\cs_new_protected:Npn\__tag_struct_kid_OBJR_gput_right:nnn #1 #2 #3 %#1 num of parent struct, - %#2 obj reference - %#3 page object reference +\cs_new_protected:Npn\__tag_struct_kid_struct_gput_left:nn #1 #2 +%%#1 num of parent struct, #2 kid struct + { + \__tag_seq_gput_left:ce + { g__tag_struct_kids_#1_seq } + { + \pdf_object_ref_indexed:nn { __tag/struct }{ #2 } + } + } +\cs_generate_variant:Nn \__tag_struct_kid_struct_gput_left:nn {ee} +\cs_new_protected:Npn\__tag_struct_kid_OBJR_gput_right:nnn #1 #2 #3 + + +%%#1 num of parent struct,#2 obj reference,#3 page object reference { \pdf_object_unnamed_write:nn { dict } @@ -2239,30 +2245,43 @@ } } -\cs_new_protected:Npn \__tag_struct_get_dict_content:nN #1 #2 %#1: stucture num +\cs_new_protected:Npn \__tag_struct_get_dict_content:nN #1 #2 %#1: structure num { \tl_clear:N #2 \prop_map_inline:cn { g__tag_struct_#1_prop } { - \tl_put_right:Ne #2 + \cs_if_exist_use:cTF {__tag_struct_format_##1:nnN} + { + {##1}{##2}#2 + } { - \cs_if_exist_use:cTF {__tag_struct_format_##1:nn} - {{##1}{##2}} - {\c_space_tl/##1~##2} + \tl_put_right:Ne #2 { \c_space_tl/##1~##2 } } } } -\cs_new:Nn\__tag_struct_format_rolemap:nn{} -\cs_new:Nn\__tag_struct_format_parentrole:nn{} +\cs_new:Nn\__tag_struct_format_rolemap:nnN{} +\cs_new:Nn\__tag_struct_format_parentrole:nnN{} -\cs_new:Nn\__tag_struct_format_Ref:nn{\c_space_tl/#1~[#2]} +\cs_new_protected:Nn\__tag_struct_format_Ref:nnN + { + \tl_put_right:Nn #3 { ~/#1~[ } %] + \clist_map_inline:nn{ #2 } + { + ##1 #3 + } + \tl_put_right:Nn #3 + { %[ + \c_space_tl] + } + } \cs_new_protected:Npn \__tag_struct_write_obj:n #1 % #1 is the struct num { \prop_if_exist:cTF { g__tag_struct_#1_prop } { \prop_get:cnNF { g__tag_struct_#1_prop } {P}\l__tag_tmpb_tl { - \prop_gput:cne { g__tag_struct_#1_prop } {P}{\pdf_object_ref_indexed:nn { __tag/struct }{1}} + \prop_gput:cne { g__tag_struct_#1_prop } {P} + {\pdf_object_ref_indexed:nn { __tag/struct }{1}} \prop_gput:cne { g__tag_struct_#1_prop } {S}{/Artifact} \seq_if_empty:cF {g__tag_struct_kids_#1_seq} { @@ -2288,8 +2307,9 @@ \msg_error:nnn { tag } { struct-no-objnum } { #1} } } -\cs_new_protected:Npn \__tag_struct_insert_annot:nn #1 #2 %#1 object reference to the annotation/xform - %#2 structparent number +\cs_new_protected:Npn \__tag_struct_insert_annot:nn #1 #2 + %#1 object reference to the annotation/xform + %#2 structparent number { \bool_if:NT \g__tag_active_struct_bool { @@ -2311,7 +2331,8 @@ #1 % } { - \pdf_pageobject_ref:n { \__tag_property_ref:nnn {@tag@objr@page@#2 }{ tagabspage }{1} } + \pdf_pageobject_ref:n + { \property_ref:nnn {@tag@objr@page@#2 }{ tagabspage }{1} } } % add the parent obj number to the parent tree: \exp_args:Nne @@ -2320,7 +2341,8 @@ #2 } { - \pdf_object_ref_indexed:nn { __tag/struct }{ \l__tag_struct_stack_parent_tmpa_tl } + \pdf_object_ref_indexed:nn + { __tag/struct }{ \l__tag_struct_stack_parent_tmpa_tl } } % increase the int: \int_gincr:N \c@g__tag_parenttree_obj_int @@ -2341,7 +2363,8 @@ \socket_new:nn { tag/struct/tag }{1} \socket_new_plug:nnn { tag/struct/tag }{ latex-tags } { - \seq_set_split:Nne \l__tag_tmpa_seq { / } {#1/\prop_item:Ne\g__tag_role_tags_NS_prop{#1}} + \seq_set_split:Nne \l__tag_tmpa_seq { / } + {#1/\prop_item:Ne\g__tag_role_tags_NS_prop{#1}} \tl_gset:Ne \g__tag_struct_tag_tl { \seq_item:Nn\l__tag_tmpa_seq {1} } \tl_gset:Ne \g__tag_struct_tag_NS_tl{ \seq_item:Nn\l__tag_tmpa_seq {2} } \__tag_check_structure_tag:N \g__tag_struct_tag_tl @@ -2349,10 +2372,12 @@ \socket_new_plug:nnn { tag/struct/tag }{ pdf-tags } { - \seq_set_split:Nne \l__tag_tmpa_seq { / } {#1/\prop_item:Ne\g__tag_role_tags_NS_prop{#1}} + \seq_set_split:Nne \l__tag_tmpa_seq { / } + {#1/\prop_item:Ne\g__tag_role_tags_NS_prop{#1}} \tl_gset:Ne \g__tag_struct_tag_tl { \seq_item:Nn\l__tag_tmpa_seq {1} } \tl_gset:Ne \g__tag_struct_tag_NS_tl{ \seq_item:Nn\l__tag_tmpa_seq {2} } - \__tag_role_get:VVNN \g__tag_struct_tag_tl\g__tag_struct_tag_NS_tl\l__tag_tmpa_tl\l__tag_tmpb_tl + \__tag_role_get:VVNN + \g__tag_struct_tag_tl \g__tag_struct_tag_NS_tl \l__tag_tmpa_tl \l__tag_tmpb_tl \tl_gset:Ne \g__tag_struct_tag_tl {\l__tag_tmpa_tl} \tl_gset:Ne \g__tag_struct_tag_NS_tl{\l__tag_tmpb_tl} \__tag_check_structure_tag:N \g__tag_struct_tag_tl @@ -2361,7 +2386,14 @@ \keys_define:nn { __tag / struct } { - label .tl_set:N = \l__tag_struct_key_label_tl, + label .code:n = + { + \prop_gput:Nee\g__tag_struct_label_num_prop + {#1}{\int_use:N \c@g__tag_struct_abs_int} + \__tag_property_record:eV + {tagpdfstruct-#1} + \c__tag_property_struct_clist + }, stash .bool_set:N = \l__tag_struct_elem_stash_bool, parent .code:n = { @@ -2380,6 +2412,7 @@ } }, parent .default:n = {-1}, +firstkid .code:n = { \tl_set:Nn \l__tag_struct_addkid_tl {left} }, tag .code:n = % S property { \socket_use:nn { tag/struct/tag }{#1} @@ -2446,16 +2479,58 @@ { Lang } { (#1) } }, + } +\cs_new_protected:Npn \__tag_struct_Ref_obj:nN #1 #2 %#1 a object reference + { + \tl_put_right:Ne#2 + { + \c_space_tl#1 + } + } + +\cs_new_protected:Npn \__tag_struct_Ref_label:nN #1 #2 %#1 a label + { + \prop_get:NnNTF \g__tag_struct_label_num_prop {#1} \l__tag_tmpb_tl + { + \tl_put_right:Ne#2 + { + \c_space_tl\tag_struct_object_ref:e{ \l__tag_tmpb_tl } + } + } + { + \msg_warning:nnn {tag}{struct-Ref-unknown}{Label~'#1'} + } + } +\cs_new_protected:Npn \__tag_struct_Ref_dest:nN #1 #2 %#1 a dest name + { + \prop_get:NnNTF \g__tag_struct_dest_num_prop {#1} \l__tag_tmpb_tl + { + \tl_put_right:Ne#2 + { + \c_space_tl\tag_struct_object_ref:e{ \l__tag_tmpb_tl } + } + } + { + \msg_warning:nnn {tag}{struct-Ref-unknown}{Destination~'#1'} + } + } +\cs_new_protected:Npn \__tag_struct_Ref_num:nN #1 #2 %#1 a structure number + { + \tl_put_right:Ne#2 + { + \c_space_tl\tag_struct_object_ref:e{ #1 } + } + } + +\keys_define:nn { __tag / struct } + { ref .code:n = % ref property { - \tl_clear:N\l__tag_tmpa_tl \clist_map_inline:on {#1} { - \tl_put_right:Ne \l__tag_tmpa_tl - {~\__tag_property_ref:en{tagpdfstruct-##1}{tagstructobj} } + \tag_struct_gput:nne + {\int_use:N \c@g__tag_struct_abs_int}{ref_label}{ ##1 } } - \__tag_struct_gput_data_ref:ee - { \int_use:N \c@g__tag_struct_abs_int } {\l__tag_tmpa_tl} }, E .code:n = % E property { @@ -2499,7 +2574,7 @@ } \cs_generate_variant:Nn \__tag_struct_add_inline_AF:nn {on} -\cs_new_protected:Npn \__tag_struct_add_AF:nn #1 #2 % #1 struct num #2 object reference +\cs_new_protected:Npn \__tag_struct_add_AF:nn #1 #2 { \tl_if_exist:cTF { @@ -2525,7 +2600,8 @@ { \pdf_object_if_exist:eTF {#1} { - \__tag_struct_add_AF:ee { \int_use:N \c@g__tag_struct_abs_int }{\pdf_object_ref:e {#1}} + \__tag_struct_add_AF:ee + { \int_use:N \c@g__tag_struct_abs_int }{\pdf_object_ref:e {#1}} \__tag_struct_prop_gput:nne { \int_use:N \c@g__tag_struct_abs_int } { AF } @@ -2638,13 +2714,6 @@ \g__tag_struct_tag_tl \g__tag_struct_tag_NS_tl \__tag_check_structure_has_tag:n { \int_use:N \c@g__tag_struct_abs_int } - \tl_if_empty:NF - \l__tag_struct_key_label_tl - { - \__tag_property_record:eV - {tagpdfstruct-\l__tag_struct_key_label_tl} - \c__tag_property_struct_clist - } \int_compare:nNnT { \l__tag_struct_stack_parent_tmpa_tl } = { -1 } { \seq_get:NNF @@ -2717,6 +2786,7 @@ { g__tag_struct_ \l__tag_struct_stack_parent_tmpa_tl _prop} {S} \l__tag_tmpa_tl + \quark_if_no_value:NT\l__tag_tmpa_tl{\tl_set:Nn \l__tag_tmpa_tl{UNKNOWN}} \msg_warning:nneee { tag } {role-parent-child} @@ -2745,7 +2815,7 @@ %record this structure as kid: %\tl_show:N \g__tag_struct_stack_current_tl %\tl_show:N \l__tag_struct_stack_parent_tmpa_tl - \__tag_struct_kid_struct_gput_right:ee + \use:c { __tag_struct_kid_struct_gput_ \l__tag_struct_addkid_tl :ee } { \l__tag_struct_stack_parent_tmpa_tl } { \g__tag_struct_stack_current_tl } %\prop_show:c { g__tag_struct_\g__tag_struct_stack_current_tl _prop } @@ -2797,22 +2867,22 @@ \__tag_check_if_active_struct:T { \prop_if_exist:cTF - { g__tag_struct_\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{unknown}_prop } % + { g__tag_struct_\property_ref:enn{tagpdfstruct-#1}{tagstruct}{unknown}_prop } % { \__tag_check_struct_used:n {#1} %add the label structure as kid to the current structure (can be the root) \__tag_struct_kid_struct_gput_right:ee { \g__tag_struct_stack_current_tl } - { \__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1} } + { \property_ref:enn{tagpdfstruct-#1}{tagstruct}{1} } %add the current structure to the labeled one as parents \__tag_prop_gput:cne - { g__tag_struct_\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}_prop } + { g__tag_struct_\property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}_prop } { P } { \pdf_object_ref_indexed:nn { __tag/struct } { \g__tag_struct_stack_current_tl } } \__tag_struct_get_parentrole:eNN - {\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}} + {\property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}} \l__tag_tmpa_tl \l__tag_tmpb_tl \__tag_check_parent_child:VVVVN @@ -2897,7 +2967,7 @@ \pdf_object_ref_indexed:nn {__tag/struct}{ #1 } } \cs_generate_variant:Nn \tag_struct_object_ref:n {e} -\cs_new_protected:Npn \tag_struct_gput:nnn #1 #2 #3 +\cs_set_protected:Npn \tag_struct_gput:nnn #1 #2 #3 { \cs_if_exist_use:cF {__tag_struct_gput_data_#2:nn} { %warning?? @@ -2906,19 +2976,44 @@ {#1}{#3} } \cs_generate_variant:Nn \tag_struct_gput:nnn {ene,nne} -\cs_new_protected:Npn \__tag_struct_gput_data_ref:nn #1 #2 - % #1 receiving struct num, #2 list of object ref +\cs_new_protected:Npn \__tag_struct_gput_data_ref_aux:nnn #1 #2 #3 + % #1 receiving struct num, #2 key word #3 value { - \prop_get:cnN - { g__tag_struct_#1_prop } - {Ref} - \l__tag_get_tmpc_tl - \__tag_struct_prop_gput:nne - { #1 } - { Ref } - { \quark_if_no_value:NF\l__tag_get_tmpc_tl { \l__tag_get_tmpc_tl\c_space_tl }#2 } + \prop_get:cnNTF + { g__tag_struct_#1_prop } + {Ref} + \l__tag_get_tmpc_tl + { + \tl_put_right:No \l__tag_get_tmpc_tl + {\cs:w __tag_struct_Ref_#2:nN \cs_end: {#3},} + } + { + \tl_set:No \l__tag_get_tmpc_tl + {\cs:w __tag_struct_Ref_#2:nN \cs_end: {#3},} + } + \__tag_struct_prop_gput:nno + { #1 } + { Ref } + { \l__tag_get_tmpc_tl } } -\cs_generate_variant:Nn \__tag_struct_gput_data_ref:nn {ee} +\cs_new_protected:Npn \__tag_struct_gput_data_ref:nn #1 #2 + { + \__tag_struct_gput_data_ref_aux:nnn {#1}{obj}{#2} + } +\cs_new_protected:Npn \__tag_struct_gput_data_ref_label:nn #1 #2 + { + \__tag_struct_gput_data_ref_aux:nnn {#1}{label}{#2} + } +\cs_new_protected:Npn \__tag_struct_gput_data_ref_dest:nn #1 #2 + { + \__tag_struct_gput_data_ref_aux:nnn {#1}{dest}{#2} + } +\cs_new_protected:Npn \__tag_struct_gput_data_ref_num:nn #1 #2 + { + \__tag_struct_gput_data_ref_aux:nnn {#1}{num}{#2} + } + +\cs_generate_variant:Nn \__tag_struct_gput_data_ref:nn {ee,no} \cs_new_protected:Npn \tag_struct_insert_annot:nn #1 #2 %#1 should be an object reference %#2 struct parent num { @@ -3040,6 +3135,7 @@ }, } %% File: tagpdf-space.dtx +\bool_new:N\l__tag_showspaces_bool \keys_define:nn { __tag / setup } { activate/spaces .choice:, @@ -3446,9 +3542,9 @@ {\tagmcbegin{tag=Lbl}} {#1} } - \tag_stop:n{hangfrom} + \tag_suspend:n{hangfrom} \hangindent \wd\@tempboxa\noindent - \tag_start:n{hangfrom} + \tag_resume:n{hangfrom} \tagmcbegin{}\box\@tempboxa\tagmcend\tagstructend\tagmcbegin{} } } @@ -3699,11 +3795,11 @@ \bool_gset_false:N \g__tag_in_mc_bool } \tag_mc_begin:n {artifact} - \tag_stop:n{headfoot} + \tag_suspend:n{headfoot} } \cs_new_protected:Npn \__tag_exclude_headfoot_end: { - \tag_start:n{headfoot} + \tag_resume:n{headfoot} \tag_mc_end: \bool_if:NTF \g__tag_mode_lua_bool { @@ -3727,12 +3823,12 @@ } \tag_struct_begin:n{tag=Artifact,attribute-class=__tag/attr/#1} \tag_mc_begin:n {artifact=#1} - \tag_stop:n{headfoot} + \tag_suspend:n{headfoot} } \cs_new_protected:Npn \__tag_exclude_struct_headfoot_end: { - \tag_start:n{headfoot} + \tag_resume:n{headfoot} \tag_mc_end: \tag_struct_end: \bool_if:NTF \g__tag_mode_lua_bool diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty index 38a5f0196d4..81ce196e8e7 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty @@ -1,5 +1,5 @@ %\RequirePackage[enable-debug]{expl3}[2018/06/14] -\ProvidesExplPackage {tagpdfdocu-patches} {2024-04-12} {0.99b} +\ProvidesExplPackage {tagpdfdocu-patches} {2024-09-16} {0.99f} {patches/commands for the tagpdf documentation} \RequirePackage{etoolbox,xpatch} @@ -33,7 +33,7 @@ \else \addpenalty\@secpenalty\addvspace{1.5ex}% \fi - {\tagpdfsetup{paratag=H10}\parindent \z@ + {\tagpdfsetup{para/maintag=P,para/tag=Strong}\parindent \z@ \setlength{\parfillskip}{\z@ plus 1fil}% \raggedright\normalfont\bfseries\nobreak \nobreak\interlinepenalty \@M #1\par\nobreak% @@ -82,17 +82,13 @@ % } \ExplSyntaxOff -% ======== tikzpicture ========== -% TODO this needs some investigation: it messes up the stack if one add paraOff - -\AddToHook{env/tikzpicture/begin}{} %======== tcolorbox ======== % 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. % we force also a \par and add a div structure, to avoid clashes with the block -% tagging code. This needs revisting! +% tagging code. This needs revisiting! \AddToHook{env/tcolorbox/before}{\par\tagstructbegin{tag=Div}} \AddToHook{env/tcolorbox/begin}{\tagpdfparaOff \tcbset{before upper=\tagpdfparaOn}} @@ -138,22 +134,6 @@ % ======= footnote ======== % done in testphase code -% ======= bibliography ======== -% biblatex. Creates some empty mc-chunks. -% no internal patches, but redefining begentry/finentry is not safe. -% better hook is needed. - - -\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 .... @@ -167,30 +147,147 @@ \let\tagstructend\relax }}{} -%====== picture ======= +%====== tikz picture ======= +% first draft to tag. The main problem is to handle paragraphs. One +\ExplSyntaxOn +\cs_new_protected:Npn\__tag_tikz_savepos:n #1 + { + \tex_savepos:D + \tikz@resetexpandcount% + \tikz@scan@one@point\pgfutil@firstofone(current~bounding~box.north~east)\relax + \pgf@pos@transform{\pgf@x}{\pgf@y}% + \property_record:nn{#1}{xpos,ypos,abspage} + \property_record:nn{#1-tr}{pgfx,pgfy} + \tikz@scan@one@point\pgfutil@firstofone(current~bounding~box.south~west)\relax + \pgf@pos@transform{\pgf@x}{\pgf@y}% + \property_record:nn{#1-bl}{pgfx,pgfy} + \tex_savepos:D + } +\cs_generate_variant:Nn \__tag_tikz_savepos:n {e} + +\NewProperty{pgfx}{now}{0} + { + \dim_compare:nNnTF {\dim_abs:n {\pgf@x}} > {15999pt} + { 0 } + { \dim_to_decimal_in_sp:n{\pgf@x} } + } +\NewProperty{pgfy}{now}{0} + { + \dim_compare:nNnTF {\dim_abs:n {\pgf@y}} > {15999pt} + { 0 } + { \dim_to_decimal_in_sp:n{\pgf@y} } + } + +\cs_new_protected:Npn \__tag_tikz_getbbox: + { + \int_gincr:N\g__tag_graphic_int + \tl_set:Ne\l__tag_graphic_currentlabel_tl {__tag_graphic_\int_use:N \g__tag_graphic_int} + \tl_gset:Ne\g__tag_graphic_lx_tl + { + \dim_to_decimal_in_bp:n + { \property_ref:een {\l__tag_graphic_currentlabel_tl}{xpos}{0}sp + + \property_ref:een {\l__tag_graphic_currentlabel_tl-bl}{pgfx}{0}sp + } + } + \tl_gset:Ne\g__tag_graphic_ly_tl + { + \dim_to_decimal_in_bp:n + { \property_ref:een {\l__tag_graphic_currentlabel_tl}{ypos}{0}sp + + \property_ref:een {\l__tag_graphic_currentlabel_tl-bl}{pgfy}{0}sp + } + } + \tl_gset:Ne\g__tag_graphic_ux_tl + { + \dim_to_decimal_in_bp:n + { \property_ref:een {\l__tag_graphic_currentlabel_tl}{xpos}{0}sp + + \property_ref:een {\l__tag_graphic_currentlabel_tl-tr}{pgfx}{0}sp + } + } + \tl_gset:Ne\g__tag_graphic_uy_tl + { + \dim_to_decimal_in_bp:n + { \property_ref:een {\l__tag_graphic_currentlabel_tl}{ypos}{0}sp + + \property_ref:een {\l__tag_graphic_currentlabel_tl-tr}{pgfy}{0}sp + } + } + } -% PAC3 complained that the BBox is missing, so we are cheating for now -% and add a fix size. -\tagpdfsetup - { - newattribute = - {bbox}{/O /Layout /BBox [0 0 100 100]} +\cs_new_protected:Npn \__tag_graphic_tikz_begin_picture: + { + \tag_mc_end_push: + \bool_if:NTF \l__tag_graphic_artifact_bool + { \tagmcbegin{artifact} } + { + \__tag_tikz_getbbox: + \tagstructbegin{tag=Figure,alt=\l__tag_graphic_alt_tl}\tagmcbegin{} + \__tag_prop_gput:cne + { g__tag_struct_\int_eval:n {\c@g__tag_struct_abs_int}_prop } + { A } + { + << + /O /Layout /BBox~ + [ + \g__tag_graphic_lx_tl\c_space_tl + \g__tag_graphic_ly_tl\c_space_tl + \g__tag_graphic_ux_tl\c_space_tl + \g__tag_graphic_uy_tl + ] + >> + } + \bool_if:NT\l__tag_graphic_debug_bool + { + \__tag_graphic_show_bbox:VVVVne + \g__tag_graphic_lx_tl + \g__tag_graphic_ly_tl + \g__tag_graphic_ux_tl + \g__tag_graphic_uy_tl + {red} + {\int_use:N\g__tag_graphic_int} + } + } + \SuspendTagging{tikz} } -% ======= maketitle - -\renewcommand\maketitle{% - \tagstructbegin{tag=Title} - \begin{center}% - \let\thanks\footnote - \makeatletter - \huge \@title \par - \vskip .5em - \@author \par - \vskip 1em% - \@date \par - \end{center}% - \tagstructend} +\cs_new_protected:Npn \__tag_graphic_tikz_end_picture: + { + \ResumeTagging{tikz}\tagmcend + \bool_if:NF \l__tag_graphic_artifact_bool + { + \tagstructend + \__tag_tikz_savepos:e {__tag_graphic_\int_use:N \g__tag_graphic_int} + } + \tag_mc_begin_pop:n{} + } + +\tikzset + { + every~picture/.style= + { + artifact, + execute~at~begin~picture=\__tag_graphic_tikz_begin_picture:, + execute~at~end~picture=\__tag_graphic_tikz_end_picture: + } + } +\AddToHook{env/tikzpicture/before}{\leavevmode} + +\tikzset + { + alt/.code= + { + \bool_set_false:N \l__tag_graphic_artifact_bool + \tl_set:Nn \l__tag_graphic_alt_tl{#1} + } + } +\tikzset + { + artifact/.code= + \bool_set_true:N \l__tag_graphic_artifact_bool + } + +\ExplSyntaxOff + + + \endinput |