texlive[70937] Master/texmf-dist: tagpdf (13apr24)

commits+karl at tug.org commits+karl at tug.org
Sat Apr 13 22:34:02 CEST 2024


Revision: 70937
          https://tug.org/svn/texlive?view=revision&revision=70937
Author:   karl
Date:     2024-04-13 22:34:01 +0200 (Sat, 13 Apr 2024)
Log Message:
-----------
tagpdf (13apr24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/tagpdf/README.md
    trunk/Master/texmf-dist/doc/latex/tagpdf/ex-AF-file.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/ex-alt-actualtext.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/ex-attribute.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/ex-formula-problem.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/ex-list.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/ex-mc-manual-para-split-obsolete.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/ex-softhyphen.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/ex-spaceglyph-listings.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/ex-structure-obsolete.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/ex-tagpdf-template.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf-code.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf.tex
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-data.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-generic.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-luacode.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-shared.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-tree.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-lua.sty
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child-2.csv
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child.csv
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tagpdf/README.md	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/doc/latex/tagpdf/README.md	2024-04-13 20:34:01 UTC (rev 70937)
@@ -1,6 +1,6 @@
 #tagpdf — A package to create tagged pdf
-Packageversion: 0.99a 
-Packagedate: 2024/03/27
+Packageversion: 0.99b 
+Packagedate: 2024/04/12
 Author: Ulrike Fischer, LaTeX Project Team
 
 ## License

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/ex-AF-file.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/ex-alt-actualtext.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/ex-attribute.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/ex-formula-problem.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/ex-list.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/ex-mc-manual-para-split-obsolete.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/ex-softhyphen.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/ex-spaceglyph-listings.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/ex-structure-obsolete.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/ex-tagpdf-template.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf-code.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf.tex	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf.tex	2024-04-13 20:34:01 UTC (rev 70937)
@@ -16,8 +16,8 @@
  }
 \DebugBlocksOff
 \makeatletter
-\def\UlrikeFischer at package@version{0.99a}
-\def\UlrikeFischer at package@date{2024-03-27}
+\def\UlrikeFischer at package@version{0.99b}
+\def\UlrikeFischer at package@date{2024-04-12}
 \makeatother
 
 \documentclass[bibliography=totoc,a4paper]{article}
@@ -2434,6 +2434,20 @@
 \pkg{tagpdf} defines this command also for luatex -- attention if can
 perhaps insert break points.
 
+\begin{docCommands}
+ {
+  {doc name=tag_space_off:},
+  {doc name=tag_space_on:}
+ }
+\end{docCommands}
+
+The commands allow to switch on and off the insertion of space chars.
+With pdftex they map to primitive \cs{pdfinterwordspaceoff} and
+and \cs{pdfinterwordspaceon} which insert a whatsits and so act globally.
+The luatex implementation uses an attribute which is also set globally to stay
+more or less consistent with pdftex. In dvi-mode the commands do nothing.
+
+
 \section{Structure destinations}\label{sec:struct-dest}
 
  Standard destinations (anchors for internal links) consist of a

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx	2024-04-13 20:34:01 UTC (rev 70937)
@@ -47,13 +47,13 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99a, released 2024-03-27}
+% \date{Version 0.99b, released 2024-04-12}
 % \maketitle
 % \begin{implementation}
 %    \begin{macrocode}
 %<@@=tag>
 %<*luatex>
-\ProvidesExplFile {tagpdf-luatex.def} {2024-03-27} {0.99a}
+\ProvidesExplFile {tagpdf-luatex.def} {2024-04-12} {0.99b}
   {tagpdf~driver~for~luatex}
 %    \end{macrocode}
 % \section{Loading the lua}
@@ -164,8 +164,8 @@
 
 local ProvidesLuaModule = {
     name          = "tagpdf",
-    version       = "0.99a",       --TAGVERSION
-    date          = "2024-03-27", --TAGDATE
+    version       = "0.99b",       --TAGVERSION
+    date          = "2024-04-12", --TAGDATE
     description   = "tagpdf lua code",
     license       = "The LATEX Project Public License 1.3c"
 }
@@ -215,7 +215,7 @@
  ltx.@@.func.mark_shipout (): a wrapper around the core function which inserts the last EMC
  ltx.@@.func.fill_parent_tree_line (page): outputs the entries of the parenttree for this page
  ltx.@@.func.output_parenttree(): outputs the content of the parenttree
- ltx.@@.func.pdf_object_ref(name): outputs the object reference for the object name
+ ltx.@@.func.pdf_object_ref(name,index): outputs the object reference for the object name
  ltx.@@.func.markspaceon(), ltx.@@.func.markspaceoff(): (de)activates the marking of positions for space chars
  ltx.@@.trace.show_mc_data (num,loglevel): shows ltx.@@.mc[num] is the current log level is >= loglevel
  ltx.@@.trace.show_all_mc_data (max,loglevel): shows a maximum about mc's if the current log level is >= loglevel
@@ -237,9 +237,12 @@
 % The interwordfont attr is set by the function |@@_mark_spaces| too and
 % stores the font, so that we can decide which font
 % to use for the real space char.
+% The interwordspaceOff attr allows to locally suppress the insertion of
+% real space chars, e.g. when they are inserted by other means (e.g. with |\char|).
 %    \begin{macrocode}
 local mctypeattributeid  = luatexbase.new_attribute ("g_@@_mc_type_attr")
 local mccntattributeid   = luatexbase.new_attribute ("g_@@_mc_cnt_attr")
+local iwspaceOffattributeid = luatexbase.new_attribute ("g__tag_interwordspaceOff_attr")
 local iwspaceattributeid = luatexbase.new_attribute ("g_@@_interwordspace_attr")
 local iwfontattributeid  = luatexbase.new_attribute ("g_@@_interwordfont_attr")
 %    \end{macrocode}
@@ -698,17 +701,21 @@
 end
 %    \end{macrocode}
 % \end{macro}
-% \begin{macro}{@@_pdf_object_ref,ltx.@@.func.pdf_object_ref}
+% \begin{macro}{@@_pdf_object_ref}
 % This allows to reference a pdf object reserved with the l3pdf command by name.
 % The return value is |n 0 R|, if the object doesn't exist, n is 0.
-% TODO: is uses internal l3pdf commands, this should be properly supported by l3pdf
 %    \begin{macrocode}
-local function @@_pdf_object_ref (name)
-   local tokenname = 'c__pdf_object_'..name..'_int'
-   local object = token.create(tokenname).mode ..' 0 R'
+local function @@_pdf_object_ref (name,index)
+   local object
+   if ltx.pdf.object_id then
+     object = ltx.pdf.object_id (name,index) ..' 0 R'
+   else
+     local tokenname = 'c__pdf_object_'..name..'/'..index..'_int'
+     object = token.create(tokenname).mode ..' 0 R'
+   end 
    return object
 end
-ltx.@@.func.pdf_object_ref=@@_pdf_object_ref
+ltx.@@.func.pdf_object_ref = @@_pdf_object_ref
 %    \end{macrocode}
 % \end{macro}
 %
@@ -877,7 +884,10 @@
  local head = box.head
   if head then
     for n in node.traverse(head) do
-      local spaceattr = nodegetattribute(n,iwspaceattributeid)  or -1
+      local spaceattr = -1  
+      if not nodehasattribute(n,iwspaceOffattributeid) then
+        spaceattr = nodegetattribute(n,iwspaceattributeid)  or -1
+      end  
       if n.id == HLIST  then -- enter the hlist
          @@_space_chars_shipout (n)
       elseif n.id == VLIST then -- enter the vlist
@@ -1222,7 +1232,7 @@
       local structnum = ltx.@@.mc[mcnum]["parent"]
       local propname  = "g_@@_struct_"..structnum.."_prop"
       --local objref   =  ltx.@@.tables[propname]["objref"] or "XXXX"
-      local objref = @@_pdf_object_ref('@@/struct/'..structnum)
+      local objref = @@_pdf_object_ref('@@/struct',structnum)
       ltx.@@.trace.log("INFO PARENTTREE-STRUCT-OBJREF:  =====>"..
         tostring(objref),5)
       numsentry = pdfpage .. " [".. objref .. "]"
@@ -1235,7 +1245,7 @@
         local structnum = ltx.@@.mc[mcnum]["parent"] or 0
         local propname  = "g_@@_struct_"..structnum.."_prop"
         --local objref   =  ltx.@@.tables[propname]["objref"] or "XXXX"
-        local objref = @@_pdf_object_ref('@@/struct/'..structnum)
+        local objref = @@_pdf_object_ref('@@/struct',structnum)
         numsentry = numsentry .. " ".. objref
        end
       numsentry = numsentry .. "] "

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx	2024-04-13 20:34:01 UTC (rev 70937)
@@ -48,7 +48,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99a, released 2024-03-27}
+% \date{Version 0.99b, released 2024-04-12}
 % \maketitle
 % \begin{documentation}
 % \section{Commands}
@@ -331,7 +331,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-checks-code} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf-checks-code} {2024-04-12} {0.99b}
  {part of tagpdf - code related to checks, conditionals, debugging and messages}
 %</header>
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-data.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-data.dtx	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-data.dtx	2024-04-13 20:34:01 UTC (rev 70937)
@@ -47,7 +47,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99a, released 2024-03-27}
+% \date{Version 0.99b, released 2024-04-12}
 % \maketitle
 % \begin{documentation}
 % This files contains a various data files which are read in
@@ -61,7 +61,7 @@
 % latex-lab has also a namespace module, which takes precendence!
 %    \begin{macrocode}
 %<*ns-latex>
-%% \ProvidesExplFile {tagpdf-ns-latex.def} {2024-03-27} {0.99a}
+%% \ProvidesExplFile {tagpdf-ns-latex.def} {2024-04-12} {0.99b}
 %% {latex} {https://www.latex-project.org/ns/dflt/2022}{}
 title,        Title,    pdf2,
 part,         Title,    pdf2,
@@ -93,7 +93,7 @@
 % It is bound to change
 %    \begin{macrocode}
 %<*ns-latex-book>
-%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2024-03-27} {0.99a}
+%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2024-04-12} {0.99b}
 %% {latex-book} {https://www.latex-project.org/ns/book/2022}{}
 chapter,       H1,pdf2,
 section,       H2,pdf2,
@@ -107,7 +107,7 @@
 % \section{The pdf namespace data}
 %    \begin{macrocode}
 %<*ns-pdf>
-%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2024-03-27} {0.99a}
+%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2024-04-12} {0.99b}
 %%  {pdf}   {http://iso.org/pdf/ssn}{}
 StructTreeRoot,StructTreeRoot,pdf,D,
 Document,Document,pdf,D,   
@@ -175,7 +175,7 @@
 % \section{The pdf 2.0 namespace data}
 %    \begin{macrocode}
 %<*ns-pdf2>
-%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2024-03-27} {0.99a} 
+%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2024-04-12} {0.99b} 
 %%  {pdf2}  {http://iso.org/pdf2/ssn}{}
 StructTreeRoot,StructTreeRoot,pdf2,D,
 Document,Document,pdf2,D,   
@@ -232,7 +232,7 @@
 % \section{The mathml namespace data}
 %    \begin{macrocode}
 %<*ns-mathml>
-%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2024-03-27} {0.99a}
+%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2024-04-12} {0.99b}
 % {mathml}{http://www.w3.org/1998/Math/MathML}{}
 abs,abs,mathml,
 and,and,mathml,
@@ -467,7 +467,7 @@
 % This will perhaps change in future.
 %    \begin{macrocode}
 %<*parent-child>
-%% \ProvidesExplFile {tagpdf-parent-child.csv} {2024-03-27} {0.99a}
+%% \ProvidesExplFile {tagpdf-parent-child.csv} {2024-04-12} {0.99b}
 ,,,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,∅,∅
@@ -522,7 +522,7 @@
 % This will perhaps change in future.
 %    \begin{macrocode}
 %<*parent-child-2>
-%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2024-03-27} {0.99a}
+%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2024-04-12} {0.99b}
 ,,,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,∅

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-generic.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-generic.dtx	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-generic.dtx	2024-04-13 20:34:01 UTC (rev 70937)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99a, released 2024-03-27}
+% \date{Version 0.99b, released 2024-04-12}
 % \maketitle
 % \begin{documentation}
 % \end{documentation}
@@ -55,11 +55,11 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*generic>
-\ProvidesExplPackage {tagpdf-mc-code-generic} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf-mc-code-generic} {2024-04-12} {0.99b}
  {part of tagpdf - code related to marking chunks - generic mode}
 %</generic>
 %<*debug>
-\ProvidesExplPackage {tagpdf-debug-generic} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf-debug-generic} {2024-04-12} {0.99b}
  {part of tagpdf - debugging code related to marking chunks - generic mode}
 %</debug>
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-luacode.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-luacode.dtx	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-luacode.dtx	2024-04-13 20:34:01 UTC (rev 70937)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99a, released 2024-03-27}
+% \date{Version 0.99b, released 2024-04-12}
 % \maketitle
 % \begin{implementation}
 % The code is splitted into three parts: code shared by all engines,
@@ -86,11 +86,11 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*luamode>
-\ProvidesExplPackage {tagpdf-mc-code-lua} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf-mc-code-lua} {2024-04-12} {0.99b}
   {tagpdf - mc code only for the luamode }
 %</luamode>
 %<*debug>
-\ProvidesExplPackage {tagpdf-debug-lua} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf-debug-lua} {2024-04-12} {0.99b}
  {part of tagpdf - debugging code related to marking chunks - lua mode}
 %</debug>
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-shared.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-shared.dtx	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-shared.dtx	2024-04-13 20:34:01 UTC (rev 70937)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99a, released 2024-03-27}
+% \date{Version 0.99b, released 2024-04-12}
 % \maketitle
 % \begin{documentation}
 % \section{Public Commands}
@@ -181,7 +181,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-mc-code-shared} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf-mc-code-shared} {2024-04-12} {0.99b}
   {part of tagpdf - code related to marking chunks -
    code shared by generic and luamode }
 %</header>

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx	2024-04-13 20:34:01 UTC (rev 70937)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99a, released 2024-03-27}
+% \date{Version 0.99b, released 2024-04-12}
 % \maketitle
 % \begin{documentation}
 % \begin{function}
@@ -98,7 +98,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-roles-code} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf-roles-code} {2024-04-12} {0.99b}
  {part of tagpdf - code related to roles and structure names}
 %</header>
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx	2024-04-13 20:34:01 UTC (rev 70937)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99a, released 2024-03-27}
+% \date{Version 0.99b, released 2024-04-12}
 % \maketitle
 % \begin{documentation}
 % \begin{function}{activate/space (setup-key),interwordspace (deprecated)}
@@ -66,7 +66,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-space-code} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf-space-code} {2024-04-12} {0.99b}
  {part of tagpdf - code related to real space chars}
 %</header>
 %    \end{macrocode}
@@ -106,8 +106,8 @@
         \pdfglyphtounicode{space}{0020}
         \keys_define:nn { @@ / setup }
           {
-            activate/spaces/true .code:n  = { \pdfinterwordspaceon },
-            activate/spaces/false .code:n = { \pdfinterwordspaceoff },
+            activate/spaces/true .code:n  = { \AddToHook{shipout/firstpage}[tagpdf/space]{\pdfinterwordspaceon} },
+            activate/spaces/false .code:n = { \RemoveFromHook{shipout/firstpage}[tagpdf/space] },
             activate/spaces .default:n = true,
           }
       }
@@ -161,6 +161,66 @@
         \group_end:
       }
   }
+%    \end{macrocode}
+% 
+% We need also a command to interrupt the insertion of real space
+% chars in places where we want to insert manually special spaces. 
+% In pdftex this can be done with \cs{pdfinterwordspaceoff}
+% and \cs{pdfinterwordspaceon}. These commands insert whatsits
+% and this mean they act globally. In luatex a attribute is
+% used to this effect, for consistency this is also set globally.
+% 
+%
+% \begin{macro}{\tag_spacechar_on:,\tag_spacechar_off:}
+% The off command sets the attributes in luatex.
+%    \begin{macrocode}
+\cs_new_protected:Npn \tag_spacechar_off: {}
+\cs_new_protected:Npn \tag_spacechar_on: {}
+
+\sys_if_engine_luatex:T
+ {
+   \cs_set_protected:Npn \tag_spacechar_off: 
+     {
+       \lua_now:e 
+         {
+           tex.setattribute
+            (
+             "global",
+             luatexbase.attributes.g_@@_interwordspaceOff_attr,
+             1
+            )
+         }
+     }
+   \cs_set_protected:Npn \tag_spacechar_on: 
+     {
+       \lua_now:e 
+         {
+           tex.setattribute
+            (
+             "global",
+             luatexbase.attributes.g_@@_interwordspaceOff_attr,
+             -2147483647
+            )
+         }
+     }
+ }
+\sys_if_engine_pdftex:T
+  {
+    \sys_if_output_pdf:T
+      {
+       \cs_set_protected:Npn \tag_spacechar_off: 
+          {
+            \pdfinterwordspaceoff
+          }       
+        \cs_set_protected:Npn \tag_spacechar_on: 
+          {
+            \pdfinterwordspaceon
+          }         
+      }
+  }    
+%    \end{macrocode}
+% \end{macro}
+%    \begin{macrocode}
 %</package>
 %    \end{macrocode}
 % \end{macro}

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx	2024-04-13 20:34:01 UTC (rev 70937)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99a, released 2024-03-27}
+% \date{Version 0.99b, released 2024-04-12}
 % \maketitle
 % \begin{documentation}
 % \section{Public Commands}
@@ -285,7 +285,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-struct-code} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf-struct-code} {2024-04-12} {0.99b}
  {part of tagpdf - code related to storing structure}
 %</header>
 %    \end{macrocode}
@@ -297,7 +297,7 @@
 %
 %    \begin{macrocode}
 %<base>\newcounter  { g_@@_struct_abs_int }
-%<base>\int_gzero:N \c at g_@@_struct_abs_int
+%<base>\int_gset:Nn \c at g_@@_struct_abs_int { 1 }
 %    \end{macrocode}
 % \end{variable}
 %
@@ -334,7 +334,7 @@
 % When a sequence is opened it's number is put on the stack.
 %    \begin{macrocode}
 \seq_new:N    \g_@@_struct_stack_seq
-\seq_gpush:Nn \g_@@_struct_stack_seq {0}
+\seq_gpush:Nn \g_@@_struct_stack_seq {1}
 %    \end{macrocode}
 % \end{variable}
 %
@@ -365,8 +365,8 @@
 % normally it should have only one kid, e.g. the document element.
 
 % The data of the StructTreeRoot and the StructElem are in properties:
-% |\g_@@_struct_0_prop| for the root and
-% |\g_@@_struct_N_prop|, $N \geq =1$ for the other.
+% |\g_@@_struct_1_prop| for the root and
+% |\g_@@_struct_N_prop|, $N \geq =2$ for the other.
 %
 % This creates quite a number of properties, so perhaps we will have to
 % do this more efficiently in the future.
@@ -530,7 +530,7 @@
 
 % \subsection{Initialization of the StructTreeRoot}
 % The first structure element, the StructTreeRoot is special, so
-% created manually. The underlying object is |@@/struct/0| which is currently
+% created manually. The underlying object is |@@/struct/1| which is currently
 % created in the tree code (TODO move it here).
 % The |ParentTree| and |RoleMap| entries are added at begin document
 % in the tree code as they refer to object which are setup in other parts of the
@@ -538,7 +538,7 @@
 %
 %    \begin{macrocode}
 %<*package>
-\tl_gset:Nn \g_@@_struct_stack_current_tl {0}
+\tl_gset:Nn \g_@@_struct_stack_current_tl {1}
 %    \end{macrocode}
 % \begin{macro}{\@@_pdf_name_e:n}
 %    \begin{macrocode}
@@ -547,30 +547,30 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{variable}{g_@@_struct_0_prop,g_@@_struct_kids_0_seq}
+% \begin{variable}{g_@@_struct_1_prop,g_@@_struct_kids_1_seq}
 %    \begin{macrocode}
 %<*package>
-\@@_prop_new:c { g_@@_struct_0_prop }
-\@@_new_output_prop_handler:n {0}
-\@@_seq_new:c  { g_@@_struct_kids_0_seq }
+\@@_prop_new:c { g_@@_struct_1_prop }
+\@@_new_output_prop_handler:n {1}
+\@@_seq_new:c  { g_@@_struct_kids_1_seq }
 
 \@@_struct_prop_gput:nne
-  { 0 }            
+  { 1 }            
   { Type }
   { \pdf_name_from_unicode_e:n {StructTreeRoot} }
 
 \@@_struct_prop_gput:nne
-  { 0 }            
+  { 1 }            
   { S }
   { \pdf_name_from_unicode_e:n {StructTreeRoot} }
 
 \@@_struct_prop_gput:nne
-  { 0 }            
+  { 1 }            
   { rolemap }
   { {StructTreeRoot}{pdf} }
 
 \@@_struct_prop_gput:nne
-  { 0 }            
+  { 1 }            
   { parentrole }
   { {StructTreeRoot}{pdf} }
   
@@ -581,7 +581,7 @@
 \pdf_version_compare:NnF < {2.0}
  {
    \@@_struct_prop_gput:nne
-    { 0 }            
+    { 1 }            
     { Namespaces }
     { \pdf_object_ref:n { @@/tree/namespaces } }
  } 
@@ -589,10 +589,10 @@
 %    \end{macrocode}
 % In debug mode we have to copy the root manually as it is already setup:
 %    \begin{macrocode}
-%<debug>\prop_new:c { g_@@_struct_debug_0_prop }
-%<debug>\seq_new:c  { g_@@_struct_debug_kids_0_seq }
-%<debug>\prop_gset_eq:cc { g_@@_struct_debug_0_prop }{ g_@@_struct_0_prop }
-%<debug>\prop_gremove:cn { g_@@_struct_debug_0_prop }{Namespaces}   
+%<debug>\prop_new:c { g_@@_struct_debug_1_prop }
+%<debug>\seq_new:c  { g_@@_struct_debug_kids_1_seq }
+%<debug>\prop_gset_eq:cc { g_@@_struct_debug_1_prop }{ g_@@_struct_1_prop }
+%<debug>\prop_gremove:cn { g_@@_struct_debug_1_prop }{Namespaces}   
 %    \end{macrocode}
 % \end{variable}
 % 
@@ -739,7 +739,7 @@
     \@@_seq_gput_right:ce
       { g_@@_struct_kids_#1_seq }
       {
-        \pdf_object_ref:n { @@/struct/#2 }
+        \pdf_object_ref_indexed:nn { @@/struct }{ #2 }
       }
 %<debug>    \seq_gput_right:cn
 %<debug>      { g_@@_struct_debug_kids_#1_seq }
@@ -944,7 +944,7 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_struct_write_obj:n #1 % #1 is the struct num
   {
-    \pdf_object_if_exist:nTF { @@/struct/#1 }
+    \prop_if_exist:cTF { g_@@_struct_#1_prop } 
       {
 %    \end{macrocode}
 % It can happen that a structure is not used and so has not parent.
@@ -953,7 +953,7 @@
 %    \begin{macrocode}
         \prop_get:cnNF { g_@@_struct_#1_prop } {P}\l_@@_tmpb_tl
           { 
-            \prop_gput:cne { g_@@_struct_#1_prop } {P}{\pdf_object_ref:n { @@/struct/0  }}
+            \prop_gput:cne { g_@@_struct_#1_prop } {P}{\pdf_object_ref_indexed:nn { @@/struct }{1}}
             \prop_gput:cne { g_@@_struct_#1_prop } {S}{/Artifact}
             \seq_if_empty:cF {g_@@_struct_kids_#1_seq}
               {
@@ -966,14 +966,13 @@
           }              
         \@@_struct_fill_kid_key:n { #1 }
         \@@_struct_get_dict_content:nN { #1 } \l_@@_tmpa_tl
-        \exp_args:Ne
-              \pdf_object_write:nne
-                { @@/struct/#1 }
-                {dict}
-                {
-                  \l_@@_tmpa_tl\c_space_tl                            
-                  /ID~\@@_struct_get_id:n{#1}              
-                }
+        \pdf_object_write_indexed:nnne
+           { @@/struct }{ #1 }
+           {dict}
+           {
+             \l_@@_tmpa_tl\c_space_tl                            
+             /ID~\@@_struct_get_id:n{#1}              
+           }
            
       }
       {
@@ -1038,7 +1037,7 @@
             #2
           }
           {
-            \pdf_object_ref:e { @@/struct/\l_@@_struct_stack_parent_tmpa_tl }
+            \pdf_object_ref_indexed:nn { @@/struct }{ \l_@@_struct_stack_parent_tmpa_tl }
           }
         % increase the int:
         \int_gincr:N \c at g_@@_parenttree_obj_int 
@@ -1409,14 +1408,14 @@
      {
         \pdf_object_if_exist:nTF {#1}
           {
-            \@@_struct_add_AF:ee { 0 }{\pdf_object_ref:n {#1}}
+            \@@_struct_add_AF:ee { 1 }{\pdf_object_ref:n {#1}}
             \@@_struct_prop_gput:nne
-             { 0 } 
+             { 1 } 
              { AF }
              {
                [
                  \tl_use:c
-                   { g_@@_struct_0_AF_tl }
+                   { g_@@_struct_1_AF_tl }
                ]
              }
           }
@@ -1455,9 +1454,8 @@
         \@@_new_output_prop_handler:n {\int_eval:n { \c at g_@@_struct_abs_int }}
         \@@_seq_new:c  { g_@@_struct_kids_\int_eval:n { \c at g_@@_struct_abs_int }_seq}
 %<debug>         \seq_new:c { g_@@_struct_debug_kids_\int_eval:n {\c at g_@@_struct_abs_int}_seq }            
-        \exp_args:Ne
-          \pdf_object_new:n
-            { @@/struct/\int_eval:n { \c at g_@@_struct_abs_int } }
+          \pdf_object_new_indexed:nn { @@/struct }
+            { \c at g_@@_struct_abs_int }
          \@@_struct_prop_gput:nnn
             { \int_use:N \c at g_@@_struct_abs_int }          
             { Type }
@@ -1607,7 +1605,7 @@
               { \int_use:N \c at g_@@_struct_abs_int }           
               { P }
               {
-                \pdf_object_ref:e { @@/struct/\l_@@_struct_stack_parent_tmpa_tl }
+                \pdf_object_ref_indexed:nn { @@/struct} { \l_@@_struct_stack_parent_tmpa_tl }
               }
 %    \end{macrocode}
 %    \begin{macrocode}
@@ -1713,19 +1711,19 @@
             %add the label structure as kid to the current structure (can be the root)
             \@@_struct_kid_struct_gput_right:ee
               { \g_@@_struct_stack_current_tl }
-              { \@@_property_ref:enn{tagpdfstruct-#1}{tagstruct}{0} }
+              { \@@_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1} }
             %add the current structure to the labeled one as parents
             \@@_prop_gput:cne
-              { g_@@_struct_\@@_property_ref:enn{tagpdfstruct-#1}{tagstruct}{0}_prop }
+              { g_@@_struct_\@@_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}_prop }
               { P }
               {
-                \pdf_object_ref:e { @@/struct/\g_@@_struct_stack_current_tl }
+                \pdf_object_ref_indexed:nn { @@/struct } { \g_@@_struct_stack_current_tl }
               }
 %    \end{macrocode}
 % debug code
 %    \begin{macrocode}
 %<debug>           \prop_gput:cne
-%<debug>             { g_@@_struct_debug_\@@_property_ref:enn{tagpdfstruct-#1}{tagstruct}{0}_prop }
+%<debug>             { g_@@_struct_debug_\@@_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}_prop }
 %<debug>             { P }
 %<debug>             { 
 %<debug>               parent~structure:~\g_@@_struct_stack_current_tl\c_space_tl=~
@@ -1737,7 +1735,7 @@
 %   the global tl-vars:
 %    \begin{macrocode}
              \@@_struct_get_parentrole:eNN  
-              {\@@_property_ref:enn{tagpdfstruct-#1}{tagstruct}{0}}
+              {\@@_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}}
               \l_@@_tmpa_tl
               \l_@@_tmpb_tl
             \@@_check_parent_child:VVVVN
@@ -1798,7 +1796,7 @@
               { #1 }            
               { P }
               {
-                \pdf_object_ref:e { @@/struct/\g_@@_struct_stack_current_tl }
+                \pdf_object_ref_indexed:nn { @@/struct }{ \g_@@_struct_stack_current_tl }
               }
 %<debug>           \prop_gput:cne
 %<debug>             { g_@@_struct_debug_#1_prop }
@@ -1851,7 +1849,7 @@
 %<*package>
 \cs_new:Npn \tag_struct_object_ref:n #1
  {
-   \pdf_object_ref:n {@@/struct/#1}
+   \pdf_object_ref_indexed:nn {@@/struct}{ #1 }
  }
 \cs_generate_variant:Nn \tag_struct_object_ref:n {e}
 %    \end{macrocode}
@@ -1938,7 +1936,7 @@
 % \section{Attributes and attribute classes}
 %    \begin{macrocode}
 %<*header>
-\ProvidesExplPackage {tagpdf-attr-code} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf-attr-code} {2024-04-12} {0.99b}
   {part of tagpdf - code related to attributes and attribute classes}
 %</header>
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-tree.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-tree.dtx	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-tree.dtx	2024-04-13 20:34:01 UTC (rev 70937)
@@ -47,13 +47,13 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99a, released 2024-03-27}
+% \date{Version 0.99b, released 2024-04-12}
 % \maketitle
 % \begin{implementation}
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-tree-code} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf-tree-code} {2024-04-12} {0.99b}
  {part of tagpdf - code related to writing trees and dictionaries to the pdf}
 %</header>
 %    \end{macrocode}
@@ -102,19 +102,19 @@
 % If there is an OpenAction entry we must update it,
 % so that it contains also a structure destination.
 % We do it late so that we can win, but before the pdfmanagement hook.
-% \begin{macro}{@@/struct/0}
+% \begin{macro}{@@/struct/1}
 % This is the object for the root object, the StructTreeRoot
 %    \begin{macrocode}
-\pdf_object_new:n { @@/struct/0 }
+\pdf_object_new_indexed:nn { @@/struct }{ 1 }
 %    \end{macrocode}
 % \end{macro}
 % 
 % \begin{variable}{\g_@@_tree_openaction_struct_tl}
 % We need a variable that indicates which structure is wanted in the OpenAction. By default we use
-% 1 (the Document structure).
+% 2 (the Document structure).
 %    \begin{macrocode}
 \tl_new:N   \g_@@_tree_openaction_struct_tl
-\tl_gset:Nn \g_@@_tree_openaction_struct_tl {1}
+\tl_gset:Nn \g_@@_tree_openaction_struct_tl { 2 }
 %    \end{macrocode}
 % \end{variable}
 % 
@@ -155,7 +155,7 @@
                <<
                  /S/GoTo \c_space_tl 
                  /D~\l_@@_tmpa_tl\c_space_tl
-                 /SD~[\pdf_object_ref:e{__tag/struct/\g_@@_tree_openaction_struct_tl}
+                 /SD~[\pdf_object_ref_indexed:nn{@@/struct}{\g_@@_tree_openaction_struct_tl}
 %    \end{macrocode}
 % there should be always a /Fit etc in the array but better play safe here ...
 %    \begin{macrocode}
@@ -178,7 +178,7 @@
         \pdfmanagement_add:nne
           { Catalog }
           { StructTreeRoot }
-          { \pdf_object_ref:n { @@/struct/0 } }
+          { \pdf_object_ref_indexed:nn { @@/struct } { 1 } }
         \@@_tree_update_openaction:  
       }
   }
@@ -214,12 +214,12 @@
     \tl_clear:N \l_@@_tmpa_tl
     \tl_clear:N \l_@@_tmpb_tl
     \int_zero:N \l_@@_tmpa_int
-    \int_step_inline:nn {\c at g_@@_struct_abs_int}
+    \int_step_inline:nnn {2} {\c at g_@@_struct_abs_int}
       {     
         \int_incr:N\l_@@_tmpa_int
         \tl_put_right:Ne \l_@@_tmpa_tl
           {
-            \@@_struct_get_id:n{##1}~\pdf_object_ref:n{@@/struct/##1}~
+            \@@_struct_get_id:n{##1}~\pdf_object_ref_indexed:nn {@@/struct}{##1}~
           }        
         \int_compare:nNnF {\l_@@_tmpa_int}<{50} %
           {
@@ -245,7 +245,7 @@
       }
       \pdf_object_unnamed_write:ne {dict}{/Kids~[\l_@@_tmpb_tl]}
       \@@_prop_gput:cne
-          { g_@@_struct_0_prop }
+          { g_@@_struct_1_prop }
           { IDTree }
           { \pdf_object_ref_last: }
    }
@@ -259,18 +259,18 @@
 \cs_new_protected:Npn \@@_tree_write_structtreeroot:
   {
      \@@_prop_gput:cne
-       { g_@@_struct_0_prop }
+       { g_@@_struct_1_prop }
        { ParentTree }
        { \pdf_object_ref:n { @@/tree/parenttree } }
      \@@_prop_gput:cne
-       { g_@@_struct_0_prop }
+       { g_@@_struct_1_prop }
        { RoleMap }
        { \pdf_object_ref:n { @@/tree/rolemap } } 
-     \@@_struct_fill_kid_key:n { 0 }
-     \prop_gremove:cn { g_@@_struct_0_prop } {S}   
-     \@@_struct_get_dict_content:nN { 0 } \l_@@_tmpa_tl        
-     \pdf_object_write:nne
-         { @@/struct/0 }
+     \@@_struct_fill_kid_key:n { 1 }
+     \prop_gremove:cn { g_@@_struct_1_prop } {S}   
+     \@@_struct_get_dict_content:nN { 1 } \l_@@_tmpa_tl        
+     \pdf_object_write_indexed:nnne
+         { @@/struct } { 1 }
          {dict}
          {
           \l_@@_tmpa_tl            
@@ -284,7 +284,7 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_tree_write_structelements:
   {
-    \int_step_inline:nnnn {1}{1}{\c at g_@@_struct_abs_int}
+    \int_step_inline:nnnn {2}{1}{\c at g_@@_struct_abs_int}
       {
         \@@_struct_write_obj:n { ##1 }
       }
@@ -376,7 +376,7 @@
             \int_eval:n {##1-1}\c_space_tl
             [\c_space_tl %]
           }
-        \int_step_inline:nnnn
+        \int_step_inline:nnnn %####1
           {0}
           {1}
           { \prop_count:N \l_@@_tmpa_prop -1 }
@@ -385,13 +385,13 @@
               {% page#1:mcid##1:\l_@@_tmpa_tl :content
                 \tl_put_right:Ne \l_@@_parenttree_content_tl
                   {
-                    \pdf_object_if_exist:eTF { @@/struct/\l_@@_tmpa_tl }
-                     {
-                       \pdf_object_ref:e { @@/struct/\l_@@_tmpa_tl }
-                     }
-                     {
-                       null
-                     }
+                    \prop_if_exist:cTF  { g_@@_struct_ \l_@@_tmpa_tl _prop  }
+                      {
+                        \pdf_object_ref_indexed:nn { @@/struct }{ \l_@@_tmpa_tl }
+                      }
+                      {
+                        null
+                      }
                     \c_space_tl
                   }
               }
@@ -535,7 +535,7 @@
           {dict}
           { \l_@@_tmpa_tl }
         \@@_prop_gput:cne
-          { g_@@_struct_0_prop }
+          { g_@@_struct_1_prop }
           { ClassMap }
           { \pdf_object_ref:n { @@/tree/classmap }  }
       }

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx	2024-04-13 20:34:01 UTC (rev 70937)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99a, released 2024-03-27}
+% \date{Version 0.99b, released 2024-04-12}
 % \maketitle
 % \begin{documentation}
 % \section{Setup commands}
@@ -309,7 +309,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-user} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf-user} {2024-04-12} {0.99b}
   {tagpdf - user commands}
 %</header>
 %    \end{macrocode}
@@ -653,7 +653,7 @@
                    { } { }       
           }
       }    
-    ,debug/structures .default:n = 0
+    ,debug/structures .default:n = 1
   }
 %</debug>  
 %    \end{macrocode}
@@ -707,8 +707,8 @@
       { \g_@@_active_struct_bool }
       {
         \tl_set:Nn \l_pdf_current_structure_destination_tl 
-           { _@@/struct/\g_@@_struct_stack_current_tl }
-        \pdf_activate_structure_destination:
+           { {@@/struct}{\g_@@_struct_stack_current_tl }}
+        \pdf_activate_indexed_structure_destination:
       }
    }
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx	2024-04-13 20:34:01 UTC (rev 70937)
@@ -87,7 +87,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*package>
-\ProvidesExplPackage {tagpdf} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf} {2024-04-12} {0.99b}
   { A package to experiment with pdf tagging }
 
 \bool_if:nF
@@ -113,7 +113,7 @@
 %    \end{macrocode}
 %<*debug>
 %    \begin{macrocode}
-\ProvidesExplPackage {tagpdf-debug} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf-debug} {2024-04-12} {0.99b}
   { debug code for tagpdf }
 \@ifpackageloaded{tagpdf}{}{\PackageWarning{tagpdf-debug}{tagpdf~not~loaded,~quitting}\endinput}
 %    \end{macrocode}
@@ -136,7 +136,7 @@
 % we define a base package with dummy functions
 %    \begin{macrocode}
 %<*base>
-\ProvidesExplPackage {tagpdf-base} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf-base} {2024-04-12} {0.99b}
   {part of tagpdf - provide base, no-op versions of the user commands }
 %</base>
 %    \end{macrocode} 
@@ -184,7 +184,34 @@
  }
 %</base>
 %    \end{macrocode}
+% \subsection{Indexed objects}
+% 2024-04-11: Temporary code! Can be removed after the next expl3 release!
+%    \begin{macrocode}
+\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 }       
+     }  
+ }
 
+%    \end{macrocode}
 % \subsection{a LastPage label}
 % See also issue \#2 in Accessible-xref
 % \begin{macro}{\@@_lastpagelabel:}
@@ -404,10 +431,7 @@
   {0} { \int_use:N \c at g_@@_struct_abs_int }
 \@@_property_new:nnnn  { tagstructobj } { now }  {}
   {
-    \pdf_object_if_exist:eT {@@/struct/\int_use:N \c at g__tag_struct_abs_int}
-      {
-        \pdf_object_ref:e{@@/struct/\int_use:N \c at g_@@_struct_abs_int}
-      }
+     \pdf_object_ref_indexed:nn { @@/struct } { \c at g_@@_struct_abs_int }
   }
 \@@_property_new:nnnn  
   { tagabspage } { shipout } 

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty	2024-04-13 20:34:01 UTC (rev 70937)
@@ -25,7 +25,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf.dtx
-\ProvidesExplPackage {tagpdf-base} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf-base} {2024-04-12} {0.99b}
   {part of tagpdf - provide base, no-op versions of the user commands }
 \AddToHook{begindocument}
  {
@@ -38,6 +38,29 @@
      \cs_new_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:{}
@@ -64,7 +87,7 @@
 \cs_new_protected:Npn \tag_mc_begin_pop:n #1 {}
 %% File: tagpdf-struct.dtx
 \newcounter  { g__tag_struct_abs_int }
-\int_gzero:N \c at g__tag_struct_abs_int
+\int_gset:Nn \c at g__tag_struct_abs_int { 1 }
 \tl_new:N  \g__tag_struct_stack_current_tl
 \tl_gset:Nn \g__tag_struct_stack_current_tl {\int_use:N\c at g__tag_struct_abs_int}
 \prop_new_linked:N \g__tag_struct_dest_num_prop

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty	2024-04-13 20:34:01 UTC (rev 70937)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-mc-generic.dtx
-\ProvidesExplPackage {tagpdf-debug-generic} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf-debug-generic} {2024-04-12} {0.99b}
  {part of tagpdf - debugging code related to marking chunks - generic mode}
 \cs_set_protected:Npn \tag_mc_begin:n #1 %#1 keyval
   {

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-lua.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-lua.sty	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-lua.sty	2024-04-13 20:34:01 UTC (rev 70937)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-mc-luacode.dtx
-\ProvidesExplPackage {tagpdf-debug-lua} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf-debug-lua} {2024-04-12} {0.99b}
  {part of tagpdf - debugging code related to marking chunks - lua mode}
 \cs_set_protected:Npn \__tag_mc_handle_stash:n #1 %1 mcidnum
   {

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty	2024-04-13 20:34:01 UTC (rev 70937)
@@ -26,11 +26,34 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf.dtx
-\ProvidesExplPackage {tagpdf-debug} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf-debug} {2024-04-12} {0.99b}
   { 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:
   {
@@ -243,7 +266,7 @@
                    { } { }
           }
       }
-    ,debug/structures .default:n = 0
+    ,debug/structures .default:n = 1
   }
 %% File: tagpdf-mc-shared.dtx
 
@@ -258,10 +281,10 @@
  }
 \cs_generate_variant:Nn \__tag_struct_prop_gput:nnn {nne,nee,nno}
 
-\prop_new:c { g__tag_struct_debug_0_prop }
-\seq_new:c  { g__tag_struct_debug_kids_0_seq }
-\prop_gset_eq:cc { g__tag_struct_debug_0_prop }{ g__tag_struct_0_prop }
-\prop_gremove:cn { g__tag_struct_debug_0_prop }{Namespaces}
+\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%
   {
     \__tag_seq_gput_right:ce
@@ -285,7 +308,7 @@
     \__tag_seq_gput_right:ce
       { g__tag_struct_kids_#1_seq }
       {
-        \pdf_object_ref:n { __tag/struct/#2 }
+        \pdf_object_ref_indexed:nn { __tag/struct }{ #2 }
       }
     \seq_gput_right:cn
       { g__tag_struct_debug_kids_#1_seq }
@@ -323,9 +346,8 @@
         \__tag_new_output_prop_handler:n {\int_eval:n { \c at g__tag_struct_abs_int }}
         \__tag_seq_new:c  { g__tag_struct_kids_\int_eval:n { \c at g__tag_struct_abs_int }_seq}
          \seq_new:c { g__tag_struct_debug_kids_\int_eval:n {\c at g__tag_struct_abs_int}_seq }
-        \exp_args:Ne
-          \pdf_object_new:n
-            { __tag/struct/\int_eval:n { \c at g__tag_struct_abs_int } }
+          \pdf_object_new_indexed:nn { __tag/struct }
+            { \c at g__tag_struct_abs_int }
          \__tag_struct_prop_gput:nnn
             { \int_use:N \c at g__tag_struct_abs_int }
             { Type }
@@ -451,7 +473,7 @@
               { \int_use:N \c at g__tag_struct_abs_int }
               { P }
               {
-                \pdf_object_ref:e { __tag/struct/\l__tag_struct_stack_parent_tmpa_tl }
+                \pdf_object_ref_indexed:nn { __tag/struct} { \l__tag_struct_stack_parent_tmpa_tl }
               }
             %record this structure as kid:
             %\tl_show:N \g__tag_struct_stack_current_tl
@@ -537,16 +559,16 @@
             %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}{0} }
+              { \__tag_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}{0}_prop }
+              { g__tag_struct_\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}_prop }
               { P }
               {
-                \pdf_object_ref:e { __tag/struct/\g__tag_struct_stack_current_tl }
+                \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}{0}_prop }
+             { g__tag_struct_debug_\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}_prop }
              { P }
              {
                parent~structure:~\g__tag_struct_stack_current_tl\c_space_tl=~
@@ -553,7 +575,7 @@
                \g__tag_struct_tag_tl
              }
              \__tag_struct_get_parentrole:eNN
-              {\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{0}}
+              {\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}}
               \l__tag_tmpa_tl
               \l__tag_tmpb_tl
             \__tag_check_parent_child:VVVVN
@@ -603,7 +625,7 @@
               { #1 }
               { P }
               {
-                \pdf_object_ref:e { __tag/struct/\g__tag_struct_stack_current_tl }
+                \pdf_object_ref_indexed:nn { __tag/struct }{ \g__tag_struct_stack_current_tl }
               }
            \prop_gput:cne
              { g__tag_struct_debug_#1_prop }

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def	2024-04-13 20:34:01 UTC (rev 70937)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-backend.dtx
-\ProvidesExplFile {tagpdf-luatex.def} {2024-03-27} {0.99a}
+\ProvidesExplFile {tagpdf-luatex.def} {2024-04-12} {0.99b}
   {tagpdf~driver~for~luatex}
 {
   \fontencoding{TU}\fontfamily{lmr}\fontseries{m}\fontshape{n}\fontsize{10pt}{10pt}\selectfont

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty	2024-04-13 20:34:01 UTC (rev 70937)
@@ -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-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf-mc-code-generic} {2024-04-12} {0.99b}
  {part of tagpdf - code related to marking chunks - generic mode}
 \tl_new:N \l__tag_mc_ref_abspage_tl
 

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty	2024-04-13 20:34:01 UTC (rev 70937)
@@ -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-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf-mc-code-lua} {2024-04-12} {0.99b}
   {tagpdf - mc code only for the luamode }
 \hook_gput_code:nnn{begindocument}{tagpdf/mc}
   {

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def	2024-04-13 20:34:01 UTC (rev 70937)
@@ -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-03-27} {0.99a}
+%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2024-04-12} {0.99b}
 %% {latex-book} {https://www.latex-project.org/ns/book/2022}{}
 chapter,       H1,pdf2,
 section,       H2,pdf2,

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def	2024-04-13 20:34:01 UTC (rev 70937)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-data.dtx
-%% \ProvidesExplFile {tagpdf-ns-latex.def} {2024-03-27} {0.99a}
+%% \ProvidesExplFile {tagpdf-ns-latex.def} {2024-04-12} {0.99b}
 %% {latex} {https://www.latex-project.org/ns/dflt/2022}{}
 title,        Title,    pdf2,
 part,         Title,    pdf2,

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def	2024-04-13 20:34:01 UTC (rev 70937)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-data.dtx
-%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2024-03-27} {0.99a}
+%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2024-04-12} {0.99b}
 abs,abs,mathml,
 and,and,mathml,
 annotation,annotation,mathml,

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def	2024-04-13 20:34:01 UTC (rev 70937)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-data.dtx
-%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2024-03-27} {0.99a}
+%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2024-04-12} {0.99b}
 %%  {pdf}   {http://iso.org/pdf/ssn}{}
 StructTreeRoot,StructTreeRoot,pdf,D,
 Document,Document,pdf,D,

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def	2024-04-13 20:34:01 UTC (rev 70937)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-data.dtx
-%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2024-03-27} {0.99a}
+%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2024-04-12} {0.99b}
 %%  {pdf2}  {http://iso.org/pdf2/ssn}{}
 StructTreeRoot,StructTreeRoot,pdf2,D,
 Document,Document,pdf2,D,

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child-2.csv
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child-2.csv	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child-2.csv	2024-04-13 20:34:01 UTC (rev 70937)
@@ -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-03-27} {0.99a}
+%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2024-04-12} {0.99b}
 ,,,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,∅

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child.csv
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child.csv	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child.csv	2024-04-13 20:34:01 UTC (rev 70937)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-data.dtx
-%% \ProvidesExplFile {tagpdf-parent-child.csv} {2024-03-27} {0.99a}
+%% \ProvidesExplFile {tagpdf-parent-child.csv} {2024-04-12} {0.99b}
 ,,,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,∅,∅

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua	2024-04-13 20:34:01 UTC (rev 70937)
@@ -24,8 +24,8 @@
 
 local ProvidesLuaModule = {
     name          = "tagpdf",
-    version       = "0.99a",       --TAGVERSION
-    date          = "2024-03-27", --TAGDATE
+    version       = "0.99b",       --TAGVERSION
+    date          = "2024-04-12", --TAGDATE
     description   = "tagpdf lua code",
     license       = "The LATEX Project Public License 1.3c"
 }
@@ -72,7 +72,7 @@
  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
  ltx.__tag.func.output_parenttree(): outputs the content of the parenttree
- ltx.__tag.func.pdf_object_ref(name): outputs the object reference for the object name
+ ltx.__tag.func.pdf_object_ref(name,index): outputs the object reference for the object name
  ltx.__tag.func.markspaceon(), ltx.__tag.func.markspaceoff(): (de)activates the marking of positions for space chars
  ltx.__tag.trace.show_mc_data (num,loglevel): shows ltx.__tag.mc[num] is the current log level is >= loglevel
  ltx.__tag.trace.show_all_mc_data (max,loglevel): shows a maximum about mc's if the current log level is >= loglevel
@@ -85,6 +85,7 @@
 
 local mctypeattributeid  = luatexbase.new_attribute ("g__tag_mc_type_attr")
 local mccntattributeid   = luatexbase.new_attribute ("g__tag_mc_cnt_attr")
+local iwspaceOffattributeid = luatexbase.new_attribute ("g__tag_interwordspaceOff_attr")
 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")
@@ -376,12 +377,17 @@
  head = node.insert_before(head,current,bdcnode)
  return head
 end
-local function __tag_pdf_object_ref (name)
-   local tokenname = 'c__pdf_object_'..name..'_int'
-   local object = token.create(tokenname).mode ..' 0 R'
+local function __tag_pdf_object_ref (name,index)
+   local object
+   if ltx.pdf.object_id then
+     object = ltx.pdf.object_id (name,index) ..' 0 R'
+   else
+     local tokenname = 'c__pdf_object_'..name..'/'..index..'_int'
+     object = token.create(tokenname).mode ..' 0 R'
+   end
    return object
 end
-ltx.__tag.func.pdf_object_ref=__tag_pdf_object_ref
+ltx.__tag.func.pdf_object_ref = __tag_pdf_object_ref
 local function __tag_show_spacemark (head,current,color,height)
  local markcolor = color or "1 0 0"
  local markheight = height or 10
@@ -498,7 +504,10 @@
  local head = box.head
   if head then
     for n in node.traverse(head) do
-      local spaceattr = nodegetattribute(n,iwspaceattributeid)  or -1
+      local spaceattr = -1
+      if not nodehasattribute(n,iwspaceOffattributeid) then
+        spaceattr = nodegetattribute(n,iwspaceattributeid)  or -1
+      end
       if n.id == HLIST  then -- enter the hlist
          __tag_space_chars_shipout (n)
       elseif n.id == VLIST then -- enter the vlist
@@ -784,7 +793,7 @@
       local structnum = ltx.__tag.mc[mcnum]["parent"]
       local propname  = "g__tag_struct_"..structnum.."_prop"
       --local objref   =  ltx.__tag.tables[propname]["objref"] or "XXXX"
-      local objref = __tag_pdf_object_ref('__tag/struct/'..structnum)
+      local objref = __tag_pdf_object_ref('__tag/struct',structnum)
       ltx.__tag.trace.log("INFO PARENTTREE-STRUCT-OBJREF:  =====>"..
         tostring(objref),5)
       numsentry = pdfpage .. " [".. objref .. "]"
@@ -797,7 +806,7 @@
         local structnum = ltx.__tag.mc[mcnum]["parent"] or 0
         local propname  = "g__tag_struct_"..structnum.."_prop"
         --local objref   =  ltx.__tag.tables[propname]["objref"] or "XXXX"
-        local objref = __tag_pdf_object_ref('__tag/struct/'..structnum)
+        local objref = __tag_pdf_object_ref('__tag/struct',structnum)
         numsentry = numsentry .. " ".. objref
        end
       numsentry = numsentry .. "] "

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty	2024-04-13 20:34:01 UTC (rev 70937)
@@ -28,7 +28,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf.dtx
-\ProvidesExplPackage {tagpdf} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdf} {2024-04-12} {0.99b}
   { A package to experiment with pdf tagging }
 
 \bool_if:nF
@@ -65,6 +65,29 @@
 \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 }
+     }
+ }
 
 \cs_new_protected:Npn \__tag_lastpagelabel:
   {
@@ -148,10 +171,7 @@
   {0} { \int_use:N \c at g__tag_struct_abs_int }
 \__tag_property_new:nnnn  { tagstructobj } { now }  {}
   {
-    \pdf_object_if_exist:eT {__tag/struct/\int_use:N \c at g__tag_struct_abs_int}
-      {
-        \pdf_object_ref:e{__tag/struct/\int_use:N \c at g__tag_struct_abs_int}
-      }
+     \pdf_object_ref_indexed:nn { __tag/struct } { \c at g__tag_struct_abs_int }
   }
 \__tag_property_new:nnnn
   { tagabspage } { shipout }
@@ -736,6 +756,29 @@
       },
   }
 %% 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
   {
@@ -768,9 +811,9 @@
     }
    \msg_note:nn {tag}{tree-statistic}
  }
-\pdf_object_new:n { __tag/struct/0 }
+\pdf_object_new_indexed:nn { __tag/struct }{ 1 }
 \tl_new:N   \g__tag_tree_openaction_struct_tl
-\tl_gset:Nn \g__tag_tree_openaction_struct_tl {1}
+\tl_gset:Nn \g__tag_tree_openaction_struct_tl { 2 }
 \keys_define:nn { __tag / setup }
  {
    viewer/startstructure .code:n =
@@ -794,7 +837,7 @@
                <<
                  /S/GoTo \c_space_tl
                  /D~\l__tag_tmpa_tl\c_space_tl
-                 /SD~[\pdf_object_ref:e{__tag/struct/\g__tag_tree_openaction_struct_tl}
+                 /SD~[\pdf_object_ref_indexed:nn{__tag/struct}{\g__tag_tree_openaction_struct_tl}
                       \int_compare:nNnTF{ \seq_count:N \l__tag_tmpa_seq } > {1}
                        { /\seq_item:Nn\l__tag_tmpa_seq{2} }
                        { ] }
@@ -811,7 +854,7 @@
         \pdfmanagement_add:nne
           { Catalog }
           { StructTreeRoot }
-          { \pdf_object_ref:n { __tag/struct/0 } }
+          { \pdf_object_ref_indexed:nn { __tag/struct } { 1 } }
         \__tag_tree_update_openaction:
       }
   }
@@ -828,12 +871,12 @@
     \tl_clear:N \l__tag_tmpa_tl
     \tl_clear:N \l__tag_tmpb_tl
     \int_zero:N \l__tag_tmpa_int
-    \int_step_inline:nn {\c at g__tag_struct_abs_int}
+    \int_step_inline:nnn {2} {\c at g__tag_struct_abs_int}
       {
         \int_incr:N\l__tag_tmpa_int
         \tl_put_right:Ne \l__tag_tmpa_tl
           {
-            \__tag_struct_get_id:n{##1}~\pdf_object_ref:n{__tag/struct/##1}~
+            \__tag_struct_get_id:n{##1}~\pdf_object_ref_indexed:nn {__tag/struct}{##1}~
           }
         \int_compare:nNnF {\l__tag_tmpa_int}<{50} %
           {
@@ -859,7 +902,7 @@
       }
       \pdf_object_unnamed_write:ne {dict}{/Kids~[\l__tag_tmpb_tl]}
       \__tag_prop_gput:cne
-          { g__tag_struct_0_prop }
+          { g__tag_struct_1_prop }
           { IDTree }
           { \pdf_object_ref_last: }
    }
@@ -866,18 +909,18 @@
 \cs_new_protected:Npn \__tag_tree_write_structtreeroot:
   {
      \__tag_prop_gput:cne
-       { g__tag_struct_0_prop }
+       { g__tag_struct_1_prop }
        { ParentTree }
        { \pdf_object_ref:n { __tag/tree/parenttree } }
      \__tag_prop_gput:cne
-       { g__tag_struct_0_prop }
+       { g__tag_struct_1_prop }
        { RoleMap }
        { \pdf_object_ref:n { __tag/tree/rolemap } }
-     \__tag_struct_fill_kid_key:n { 0 }
-     \prop_gremove:cn { g__tag_struct_0_prop } {S}
-     \__tag_struct_get_dict_content:nN { 0 } \l__tag_tmpa_tl
-     \pdf_object_write:nne
-         { __tag/struct/0 }
+     \__tag_struct_fill_kid_key:n { 1 }
+     \prop_gremove:cn { g__tag_struct_1_prop } {S}
+     \__tag_struct_get_dict_content:nN { 1 } \l__tag_tmpa_tl
+     \pdf_object_write_indexed:nnne
+         { __tag/struct } { 1 }
          {dict}
          {
           \l__tag_tmpa_tl
@@ -885,7 +928,7 @@
   }
 \cs_new_protected:Npn \__tag_tree_write_structelements:
   {
-    \int_step_inline:nnnn {1}{1}{\c at g__tag_struct_abs_int}
+    \int_step_inline:nnnn {2}{1}{\c at g__tag_struct_abs_int}
       {
         \__tag_struct_write_obj:n { ##1 }
       }
@@ -930,7 +973,7 @@
             \int_eval:n {##1-1}\c_space_tl
             [\c_space_tl %]
           }
-        \int_step_inline:nnnn
+        \int_step_inline:nnnn %####1
           {0}
           {1}
           { \prop_count:N \l__tag_tmpa_prop -1 }
@@ -939,13 +982,13 @@
               {% page#1:mcid##1:\l__tag_tmpa_tl :content
                 \tl_put_right:Ne \l__tag_parenttree_content_tl
                   {
-                    \pdf_object_if_exist:eTF { __tag/struct/\l__tag_tmpa_tl }
-                     {
-                       \pdf_object_ref:e { __tag/struct/\l__tag_tmpa_tl }
-                     }
-                     {
-                       null
-                     }
+                    \prop_if_exist:cTF  { g__tag_struct_ \l__tag_tmpa_tl _prop  }
+                      {
+                        \pdf_object_ref_indexed:nn { __tag/struct }{ \l__tag_tmpa_tl }
+                      }
+                      {
+                        null
+                      }
                     \c_space_tl
                   }
               }
@@ -1045,7 +1088,7 @@
           {dict}
           { \l__tag_tmpa_tl }
         \__tag_prop_gput:cne
-          { g__tag_struct_0_prop }
+          { g__tag_struct_1_prop }
           { ClassMap }
           { \pdf_object_ref:n { __tag/tree/classmap }  }
       }
@@ -1894,7 +1937,7 @@
 
 \__tag_prop_new:N  \g__tag_struct_cont_mc_prop
 \seq_new:N    \g__tag_struct_stack_seq
-\seq_gpush:Nn \g__tag_struct_stack_seq {0}
+\seq_gpush:Nn \g__tag_struct_stack_seq {1}
 \seq_new:N    \g__tag_struct_tag_stack_seq
 \seq_gpush:Nn \g__tag_struct_tag_stack_seq {{Root}{StructTreeRoot}}
 \tl_new:N     \l__tag_struct_stack_parent_tmpa_tl
@@ -1967,29 +2010,29 @@
  }
 \cs_generate_variant:Nn \__tag_struct_prop_gput:nnn {nne,nee,nno}
 
-\tl_gset:Nn \g__tag_struct_stack_current_tl {0}
+\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}}
-\__tag_prop_new:c { g__tag_struct_0_prop }
-\__tag_new_output_prop_handler:n {0}
-\__tag_seq_new:c  { g__tag_struct_kids_0_seq }
+\__tag_prop_new:c { g__tag_struct_1_prop }
+\__tag_new_output_prop_handler:n {1}
+\__tag_seq_new:c  { g__tag_struct_kids_1_seq }
 
 \__tag_struct_prop_gput:nne
-  { 0 }
+  { 1 }
   { Type }
   { \pdf_name_from_unicode_e:n {StructTreeRoot} }
 
 \__tag_struct_prop_gput:nne
-  { 0 }
+  { 1 }
   { S }
   { \pdf_name_from_unicode_e:n {StructTreeRoot} }
 
 \__tag_struct_prop_gput:nne
-  { 0 }
+  { 1 }
   { rolemap }
   { {StructTreeRoot}{pdf} }
 
 \__tag_struct_prop_gput:nne
-  { 0 }
+  { 1 }
   { parentrole }
   { {StructTreeRoot}{pdf} }
 
@@ -1996,7 +2039,7 @@
 \pdf_version_compare:NnF < {2.0}
  {
    \__tag_struct_prop_gput:nne
-    { 0 }
+    { 1 }
     { Namespaces }
     { \pdf_object_ref:n { __tag/tree/namespaces } }
  }
@@ -2085,7 +2128,7 @@
     \__tag_seq_gput_right:ce
       { g__tag_struct_kids_#1_seq }
       {
-        \pdf_object_ref:n { __tag/struct/#2 }
+        \pdf_object_ref_indexed:nn { __tag/struct }{ #2 }
       }
   }
 
@@ -2215,11 +2258,11 @@
 \cs_new:Nn\__tag_struct_format_Ref:nn{\c_space_tl/#1~[#2]}
 \cs_new_protected:Npn \__tag_struct_write_obj:n #1 % #1 is the struct num
   {
-    \pdf_object_if_exist:nTF { __tag/struct/#1 }
+    \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:n { __tag/struct/0  }}
+            \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}
               {
@@ -2232,14 +2275,13 @@
           }
         \__tag_struct_fill_kid_key:n { #1 }
         \__tag_struct_get_dict_content:nN { #1 } \l__tag_tmpa_tl
-        \exp_args:Ne
-              \pdf_object_write:nne
-                { __tag/struct/#1 }
-                {dict}
-                {
-                  \l__tag_tmpa_tl\c_space_tl
-                  /ID~\__tag_struct_get_id:n{#1}
-                }
+        \pdf_object_write_indexed:nnne
+           { __tag/struct }{ #1 }
+           {dict}
+           {
+             \l__tag_tmpa_tl\c_space_tl
+             /ID~\__tag_struct_get_id:n{#1}
+           }
 
       }
       {
@@ -2278,7 +2320,7 @@
             #2
           }
           {
-            \pdf_object_ref:e { __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 at g__tag_parenttree_obj_int
@@ -2545,14 +2587,14 @@
      {
         \pdf_object_if_exist:nTF {#1}
           {
-            \__tag_struct_add_AF:ee { 0 }{\pdf_object_ref:n {#1}}
+            \__tag_struct_add_AF:ee { 1 }{\pdf_object_ref:n {#1}}
             \__tag_struct_prop_gput:nne
-             { 0 }
+             { 1 }
              { AF }
              {
                [
                  \tl_use:c
-                   { g__tag_struct_0_AF_tl }
+                   { g__tag_struct_1_AF_tl }
                ]
              }
           }
@@ -2571,9 +2613,8 @@
         \__tag_prop_new:c  { g__tag_struct_\int_eval:n { \c at g__tag_struct_abs_int }_prop }
         \__tag_new_output_prop_handler:n {\int_eval:n { \c at g__tag_struct_abs_int }}
         \__tag_seq_new:c  { g__tag_struct_kids_\int_eval:n { \c at g__tag_struct_abs_int }_seq}
-        \exp_args:Ne
-          \pdf_object_new:n
-            { __tag/struct/\int_eval:n { \c at g__tag_struct_abs_int } }
+          \pdf_object_new_indexed:nn { __tag/struct }
+            { \c at g__tag_struct_abs_int }
          \__tag_struct_prop_gput:nnn
             { \int_use:N \c at g__tag_struct_abs_int }
             { Type }
@@ -2699,7 +2740,7 @@
               { \int_use:N \c at g__tag_struct_abs_int }
               { P }
               {
-                \pdf_object_ref:e { __tag/struct/\l__tag_struct_stack_parent_tmpa_tl }
+                \pdf_object_ref_indexed:nn { __tag/struct} { \l__tag_struct_stack_parent_tmpa_tl }
               }
             %record this structure as kid:
             %\tl_show:N \g__tag_struct_stack_current_tl
@@ -2762,16 +2803,16 @@
             %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}{0} }
+              { \__tag_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}{0}_prop }
+              { g__tag_struct_\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}_prop }
               { P }
               {
-                \pdf_object_ref:e { __tag/struct/\g__tag_struct_stack_current_tl }
+                \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}{0}}
+              {\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}}
               \l__tag_tmpa_tl
               \l__tag_tmpb_tl
             \__tag_check_parent_child:VVVVN
@@ -2821,7 +2862,7 @@
               { #1 }
               { P }
               {
-                \pdf_object_ref:e { __tag/struct/\g__tag_struct_stack_current_tl }
+                \pdf_object_ref_indexed:nn { __tag/struct }{ \g__tag_struct_stack_current_tl }
               }
              \__tag_struct_get_parentrole:eNN
               {#1}
@@ -2853,7 +2894,7 @@
   }
 \cs_new:Npn \tag_struct_object_ref:n #1
  {
-   \pdf_object_ref:n {__tag/struct/#1}
+   \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
@@ -3024,8 +3065,8 @@
         \pdfglyphtounicode{space}{0020}
         \keys_define:nn { __tag / setup }
           {
-            activate/spaces/true .code:n  = { \pdfinterwordspaceon },
-            activate/spaces/false .code:n = { \pdfinterwordspaceoff },
+            activate/spaces/true .code:n  = { \AddToHook{shipout/firstpage}[tagpdf/space]{\pdfinterwordspaceon} },
+            activate/spaces/false .code:n = { \RemoveFromHook{shipout/firstpage}[tagpdf/space] },
             activate/spaces .default:n = true,
           }
       }
@@ -3071,6 +3112,50 @@
         \group_end:
       }
   }
+\cs_new_protected:Npn \tag_spacechar_off: {}
+\cs_new_protected:Npn \tag_spacechar_on: {}
+
+\sys_if_engine_luatex:T
+ {
+   \cs_set_protected:Npn \tag_spacechar_off:
+     {
+       \lua_now:e
+         {
+           tex.setattribute
+            (
+             "global",
+             luatexbase.attributes.g__tag_interwordspaceOff_attr,
+             1
+            )
+         }
+     }
+   \cs_set_protected:Npn \tag_spacechar_on:
+     {
+       \lua_now:e
+         {
+           tex.setattribute
+            (
+             "global",
+             luatexbase.attributes.g__tag_interwordspaceOff_attr,
+             -2147483647
+            )
+         }
+     }
+ }
+\sys_if_engine_pdftex:T
+  {
+    \sys_if_output_pdf:T
+      {
+       \cs_set_protected:Npn \tag_spacechar_off:
+          {
+            \pdfinterwordspaceoff
+          }
+        \cs_set_protected:Npn \tag_spacechar_on:
+          {
+            \pdfinterwordspaceon
+          }
+      }
+  }
 %% File: tagpdf-user.dtx
 
 
@@ -3270,8 +3355,8 @@
       { \g__tag_active_struct_bool }
       {
         \tl_set:Nn \l_pdf_current_structure_destination_tl
-           { __tag/struct/\g__tag_struct_stack_current_tl }
-        \pdf_activate_structure_destination:
+           { {__tag/struct}{\g__tag_struct_stack_current_tl }}
+        \pdf_activate_indexed_structure_destination:
       }
    }
 

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty	2024-04-13 20:33:49 UTC (rev 70936)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty	2024-04-13 20:34:01 UTC (rev 70937)
@@ -1,5 +1,5 @@
 %\RequirePackage[enable-debug]{expl3}[2018/06/14]
-\ProvidesExplPackage {tagpdfdocu-patches} {2024-03-27} {0.99a}
+\ProvidesExplPackage {tagpdfdocu-patches} {2024-04-12} {0.99b}
  {patches/commands for the tagpdf documentation}
 \RequirePackage{etoolbox,xpatch}
 



More information about the tex-live-commits mailing list.