%% %% This is file `tagpdf-user.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% tagpdf.dtx (with options: `user') %% %% Copyright (C) 2019 Ulrike Fischer %% %% It may be distributed and/or modified under the conditions of %% the LaTeX Project Public License (LPPL), either version 1.3c of %% this license or (at your option) any later version. The latest %% version of this license is in the file: %% %% https://www.latex-project.org/lppl.txt %% %% This file is part of the "tagpdf bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% %% File: tagpdf.dtx \ProvidesExplPackage {tagpdf-user} {2021/05/14} {0.81} {tagpdf - user commands} \NewDocumentCommand \tagpdfsetup { m } { \keys_set:nn { __tag / setup } { #1 } } \cs_set_eq:NN\tagpdfifluatexTF \sys_if_engine_luatex:TF \cs_set_eq:NN\tagpdfifluatexT \sys_if_engine_luatex:T \cs_set_eq:NN\tagpdfifpdftexT \sys_if_engine_pdftex:T \bool_new:N \l__tag_stop_bool \prg_new_conditional:Nnn \__tag_if_stop: {p,T,F,TF} { \bool_if:NTF \l__tag_stop_bool { \prg_return_true: } { \prg_return_false: } } \prg_new_eq_conditional:NNn \tag_if_stop: \__tag_if_stop: {p,T,F,TF} \cs_new_protected:Npn \__tag_stop: { \bool_set_true:N \l__tag_stop_bool \cs_set_eq:NN \tag_mc_begin:n \use_none:n \cs_set_eq:NN \tag_mc_end: \prg_do_nothing: \cs_set_eq:NN \tag_mc_use:n \use_none:n \cs_set_eq:NN \tag_struct_begin:n \use_none:n \cs_set_eq:NN \tag_struct_end: \prg_do_nothing: \cs_set_eq:NN \tag_struct_use:n \use_none:n } \cs_new_protected:Npn \tag_stop_group_begin: { \group_begin: \__tag_stop: } \cs_set_eq:NN \tag_stop_group_end: \group_end: \cs_new:Npn \tagpdfget #1 { \use:c {__tag_get_data_#1: } } \cs_new:Npn \tag_get:n #1 { \use:c {__tag_get_data_#1: } } \NewDocumentCommand \tagmcifinTF { m m } { \__tag_mc_if_in:TF { #1 } { #2 } } \NewDocumentEnvironment{tagmcartifact}{m} { \tag_mc_artifact_group_begin:n { #1}\ignorespaces } { \tag_mc_artifact_group_end: } \NewDocumentCommand \tagmcbegin { m } { \tag_mc_begin:n {#1}\ignorespaces } \NewDocumentCommand \tagmcend { } { \if_mode_horizontal: \unskip \fi: % \tag_mc_end: } \NewDocumentCommand \tagmcuse { m } { \tag_mc_use:n {#1} } \NewDocumentCommand \tagstructbegin { m } { \tag_struct_begin:n {#1} } \NewDocumentCommand \tagstructend { } { \tag_struct_end: } \NewDocumentCommand \tagstructuse { m } { \tag_struct_use:n {#1} } \NewDocumentCommand\showtagpdfmcdata { O {\__tag_tag_get_mc_abs_cnt:} } { \bool_if:NT \g__tag_mode_lua_bool { \sys_if_engine_luatex:T { \directlua{ltx.__tag.trace.show_all_mc_data(#1)} } } } \NewDocumentCommand\showtagpdfattributes { } { \bool_if:NT \g__tag_mode_lua_bool { \sys_if_engine_luatex:T { \directlua { ltx.__tag.trace.log ( "showtagpdfattributes: MC=>abscnt=\__tag_get_mc_abs_cnt: =>attr=\the\l__tag_mc_cnt_attr=>tag=" .. tostring(ltx.__tag.func.get_tag_from (\the\l__tag_mc_type_attr)) .. "=\the\l__tag_mc_type_attr",0 ) } \ignorespaces } } } \NewDocumentCommand\showtagstack {} { \seq_show:N \g__tag_struct_tag_stack_seq } \sys_if_engine_luatex:T { \NewDocumentCommand\pdffakespace { } { \__tag_fakespace: } } \bool_new:N \l__tag_para_bool \bool_new:N \l__tag_para_show_bool \int_new:N \g__tag_para_int \keys_define:nn { __tag / setup } { paratagging .bool_set:N = \l__tag_para_bool, paratagging-show .bool_set:N = \l__tag_para_show_bool, } \AddToHook{para/begin} { \int_gincr:N \g__tag_para_int \bool_if:NT \l__tag_para_bool { \tag_struct_begin:n {tag=P} \bool_if:NT \l__tag_para_show_bool { \tag_mc_begin:n{artifact} \llap{\color_select:n{red}\tiny\int_use:N\g__tag_para_int\ } \tag_mc_end: } \tag_mc_begin:n {tag=P} } } \AddToHook{para/end} { \bool_if:NT \l__tag_para_bool { \tag_mc_end: \bool_if:NT \l__tag_para_show_bool { \tag_mc_begin:n{artifact} \rlap{\color_select:n{red}\tiny\ \int_use:N\g__tag_para_int} \tag_mc_end: } \tag_struct_end: } } \newcommand\tagpdfparaOn {\bool_set_true:N \l__tag_para_bool} \newcommand\tagpdfparaOff{\bool_set_false:N \l__tag_para_bool} \cs_generate_variant:Nn \pdfannot_dict_put:nnn {nnx} \hook_gput_code:nnn {pdfannot/link/URI/before} {tagpdf} { \bool_if:NT \g__tag_active_struct_bool { \tag_mc_end_push: \tag_struct_begin:n { tag=Link } \tag_mc_begin:n { tag=Link } \pdfannot_dict_put:nnx { link/URI } { StructParent } { \int_use:N\c@g__tag_parenttree_obj_int } } } \hook_gput_code:nnn {pdfannot/link/URI/after} {tagpdf} { \bool_if:NT \g__tag_active_struct_bool { \__tag_struct_finish_link: \tag_mc_end: \tag_struct_end: \tag_mc_begin_pop:n{} } } \hook_gput_code:nnn {pdfannot/link/GoTo/before} {tagpdf} { \bool_if:NT \g__tag_active_struct_bool { \tag_mc_end_push: \tag_struct_begin:n{tag=Link} \tag_mc_begin:n{tag=Link} \pdfannot_dict_put:nnx { link/GoTo } { StructParent } { \int_use:N\c@g__tag_parenttree_obj_int } } } \hook_gput_code:nnn {pdfannot/link/GoTo/after} {tagpdf} { \bool_if:NT \g__tag_active_struct_bool { \__tag_struct_finish_link: \tag_mc_end: \tag_struct_end: \tag_mc_begin_pop:n{} } } \hook_gput_code:nnn {cmd/url/before} {tagpdf} {\tag_mc_end_push:} \hook_gput_code:nnn {cmd/url/after} {tagpdf} {\tag_mc_begin_pop:n{}} \hook_gput_code:nnn {cmd/href/before} {tagpdf} {\tag_mc_end_push:} \hook_gput_code:nnn {cmd/href/after} {tagpdf} {\tag_mc_begin_pop:n{}} \hook_gput_code:nnn {cmd/hrefurl/before} {tagpdf} {\tag_mc_end_push:} \hook_gput_code:nnn {cmd/hrefurl/after} {tagpdf} {\tag_mc_begin_pop:n{}} \hook_gput_code:nnn {cmd/T@ref/before} {tagpdf} {\tag_mc_end_push:} \hook_gput_code:nnn {cmd/T@ref/after} {tagpdf} {\tag_mc_begin_pop:n{}} \hook_gput_code:nnn {cmd/T@pageref/before} {tagpdf} {\tag_mc_end_push:} \hook_gput_code:nnn {cmd/T@pageref/after} {tagpdf} {\tag_mc_begin_pop:n{}} \hook_gput_code:nnn {cmd/T@nameref/before} {tagpdf} {\tag_mc_end_push:} \hook_gput_code:nnn {cmd/T@nameref/after} {tagpdf} {\tag_mc_begin_pop:n{}} \pdfannot_dict_put:nnn { link/URI } { Contents } { (url) } \pdfannot_dict_put:nnn { link/GoTo } { Contents } { (ref) } %% %% %% End of file `tagpdf-user.sty'.