diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/tagpdf/tagpdf-pdftex.def |
Initial commit
Diffstat (limited to 'macros/latex/contrib/tagpdf/tagpdf-pdftex.def')
-rw-r--r-- | macros/latex/contrib/tagpdf/tagpdf-pdftex.def | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/macros/latex/contrib/tagpdf/tagpdf-pdftex.def b/macros/latex/contrib/tagpdf/tagpdf-pdftex.def new file mode 100644 index 0000000000..55e9e0c3b8 --- /dev/null +++ b/macros/latex/contrib/tagpdf/tagpdf-pdftex.def @@ -0,0 +1,128 @@ +\ProvidesExplFile {tagpdf-pdftex.def} {2019/07/02} {0.61} + {tagpdf~driver~for~pdftex} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%% driver (pdflatex) commands +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% these should be in expl3!!! +\cs_new:Nn \__uftag_pdf_startlink:{ \pdfstartlink } +\cs_new:Nn \__uftag_pdf_endlink: { \pdfendlink } +\cs_new:Nn \__uftag_pdf_lastlink: { \pdflastlink } +\cs_new:Nn \__uftag_pdf_catalog: { \pdfcatalog } + + +% needed for \str_set_convert:Nnon +\tl_new:N \g__uftag_inputencoding_tl +\tl_gset:Nn \g__uftag_inputencoding_tl {utf8} + + +%literal +\cs_new:Nn \__uftag_pdfliteral_page:n { \__uftag_tex_pdfliteral:D page { #1} } +\cs_new:Nn \__uftag_pdfcatalog:n { \__uftag_tex_pdfcatalog:D { #1 } } + +% reserve an object num and store the number +\cs_new:Nn \__uftag_pdfreserveobjnum:N % #1 = macro name to be populated with object number + { + \__uftag_tex_pdfobj:D reserveobjnum + \tl_set:Nx #1 { \int_use:N \__uftag_tex_pdflastobj:D }% + } + +% add content to an object num stored in a macro +\cs_new:Nn \__uftag_pdfuseobjnum:Nn + { + % #1 = macro containing the object number + % #2 = object contents, as valid PDF + % should #2 be filtered through \pdfstringdef ??? + \__uftag_tex_immediate:D \__uftag_tex_pdfobj:D useobjnum~#1~{#2}% + } + +\cs_new:Nn \__uftag_pdfuseobjnum:nn + { + % #1 = a number the object number + % #2 = object contents, as valid PDF + % should #2 be filtered through \pdfstringdef ??? + \__uftag_check_record_pdfobj_num:n {#1} + \__uftag_tex_immediate:D \__uftag_tex_pdfobj:D useobjnum~#1~{#2}% + } + +% obj num of the dictionary for a page: +% the page count starts by 1 +% pages can referenced before they are actually created +% no error if the page later doesn't exist +\cs_new:Nn \__uftag_store_pdfpageref:Nn + { + % #1 = macro name to be populated with current page object number + % #2 = number or counter identifying the required page + \tl_set:Nx #1 { \__uftag_tex_pdfpageref:D #2}% + } + +% a global version of the command +\cs_new:Nn \__uftag_gstore_pdfpageref:Nn + { + \tl_gset:Nx #1 { \__uftag_tex_pdfpageref:D #2}% + } + +\cs_new:Nn \__uftag_pdfobj:Nn + { + % #1 = macro name to refer to this object + % #2 = object contents, as valid PDF + % should #2 be filtered through \pdfstringdef ??? + \__uftag_tex_immediate:D \__uftag_tex_pdfobj:D { #2 } + \tl_set:Nx #1 {\int_use:N \__uftag_tex_pdflastobj:D }% + } + +% pdfpage**s**attr: for all pages +%% is global needed? Yes. Without it the setting is lost if issued in a group +% +\cs_new:Nn \__uftag_gset_pdfpagesattr:n + { + \__uftag_tex_global:D \__uftag_tex_pdfpagesattr:D { #1 } + } + +\cs_new:Nn \__uftag_gadd_pdfpagesattr:n + { + \exp_args:No \__uftag_gset_pdfpagesattr:n { \__uftag_tex_the:D \__uftag_tex_pdfpagesattr:D #1 } + } + +% pdfpageattr for one page +% I must avoid to overwrite other entries, +% And I must avoid to add more and more /StructParens +% do we need an immediate version?? +\cs_new:Nn \__uftag_gset_pdfpageattr:n + { + \__uftag_tex_global:D \__uftag_tex_pdfpageattr:D { #1 } + } + +\cs_new:Nn \__uftag_gadd_pdfpageattr:n + { + \exp_args:No \__uftag_gset_pdfpageattr:n { \__uftag_tex_the:D \__uftag_tex_pdfpageattr:D #1} + } + +\cs_new:Nn \__uftag_get_pdfpageattr:N + { + \tl_set:No #1 { \__uftag_tex_the:D \__uftag_tex_pdfpageattr:D } + } + + +% These commands are only aliases for pdflatex but are defined differently with luatex +% to get also lua tables. +\cs_set_eq:NN \__uftag_prop_new:N \prop_new:N + +\cs_set_eq:NN \__uftag_seq_new:N \seq_new:N + +\cs_set_eq:NN \__uftag_prop_gput:Nnn \prop_gput:Nnn + +\cs_set_eq:NN \__uftag_seq_gput_right:Nn \seq_gput_right:Nn + +\cs_set_eq:NN \__uftag_seq_item:cn \seq_item:cn + +\cs_set_eq:NN \__uftag_prop_item:cn \prop_item:cn + +\cs_set_eq:NN \__uftag_seq_show:N \seq_show:N + +\cs_set_eq:NN \__uftag_prop_show:N \prop_show:N + + + +\endinput |