texlive[72263] Master/texmf-dist: tagpdf (12sep24)

commits+karl at tug.org commits+karl at tug.org
Thu Sep 12 22:18:35 CEST 2024


Revision: 72263
          https://tug.org/svn/texlive?view=revision&revision=72263
Author:   karl
Date:     2024-09-12 22:18:35 +0200 (Thu, 12 Sep 2024)
Log Message:
-----------
tagpdf (12sep24)

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-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/doc/latex/tagpdf/README.md	2024-09-12 20:18:35 UTC (rev 72263)
@@ -1,6 +1,6 @@
 #tagpdf — A package to create tagged pdf
-Packageversion: 0.99d 
-Packagedate: 2024/08/02
+Packageversion: 0.99e 
+Packagedate: 2024/09/11
 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-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf.tex	2024-09-12 20:18:35 UTC (rev 72263)
@@ -16,8 +16,8 @@
  }
 \DebugBlocksOff
 \makeatletter
-\def\UlrikeFischer at package@version{0.99d}
-\def\UlrikeFischer at package@date{2024-08-02}
+\def\UlrikeFischer at package@version{0.99e}
+\def\UlrikeFischer at package@date{2024-09-11}
 \makeatother
 
 \documentclass[bibliography=totoc,a4paper]{article}
@@ -1031,7 +1031,7 @@
       marked but not stored in the kid-key of the current structure. 
 
   \item[\PrintKeyName{label}] This key sets a label by which you can call 
-      the marked content later in another structure (if it has been stashed 
+      the marked content \emph{later} in another structure (if it has been stashed 
       with the previous key). Internally the label name will start with 
       \texttt{tagpdf-}. 
 
@@ -1175,10 +1175,10 @@
 
 \item \verb+struct_counter+: This returns a number and works also if
   only \pkg{tagpdf-base} has been loaded. It gives back the state of
-  the absolute structure counter and so number of the last structure
+  the absolute structure counter and so the number of the last structure
   that has been created. This can be used to detect if in a piece of
   code there are structure commands. Be aware that this is a \LaTeX{}
-  counter and so reset in some places.
+  counter and so is reset in some places.
 
 \item \verb+mc_counter+: This returns a number and works also if only
   \pkg{tagpdf-base} has been loaded. It gives back the state of the
@@ -1699,13 +1699,13 @@
     content and structures.
 
   \item[\PrintKeyName{label}] This key sets a label by which one can
-    refer to the structure. It is e.g.  used by
-    \cs{tag\_struct\_use:n} (where a real label is actually not needed
-    as you can only use structures already defined), and by the |ref|
-    key (which can refer to future structures).  Internally the label
-    name will start with \texttt{tagpdfstruct-} and it stores the two
+    refer to the structure. Currently the key writes a property whose
+    name starts with \texttt{tagpdfstruct-} to the aux-file with the two
     attributes \texttt{tagstruct} (the structure number) and
-    \texttt{tagstructobj} (the object reference).
+    \texttt{tagstructobj} (the object reference) but also stores the 
+    name and the structure number into a prop for use in the current compilation.
+    The label is e.g. used by \cs{tag\_struct\_use:n} and by the |ref|
+    key (which can refer to future structures).  
 
   \item[\PrintKeyName{parent}]  With the parent key one can choose another 
       parent. The value is a structure number which must refer to an 
@@ -1712,7 +1712,7 @@
       already existing, previously created structure. Such a structure 
       number can have been stored previously with \cs{tag\_get:n}, but one 
       can also use a label on the parent structure and then use 
-      \cs{ref\_value:nn}\verb+{tagpdfstruct-label}{tagstruct}+ to retrieve 
+      \cs{property\_ref:nn}\verb+{tagpdfstruct-label}{tagstruct}+ to retrieve 
       it. 
 
   \item[\PrintKeyName{alt}] This key inserts an \texttt{/Alt} value in the 
@@ -1852,7 +1852,9 @@
      structure.  The value should be a comma separated list of
      structure labels set with the |label| key.
      e.g. |ref={label1,label2}|. It can be used more than once in the
-     key/value argument and combines the references.
+     key/value argument and combines the references. See below 
+     in section~\ref{sec:Refkey} for an extended discussion about the |/Ref|
+     array.
 
    \item[\PrintKeyName{E}] This key sets the |/E| key, the expanded
      form of an abbreviation or an acronym (I couldn't think of a
@@ -1877,7 +1879,26 @@
 currently active structure. A structure should be used only once, if the 
 structure already has a parent you will get a warning. 
 
+\subsubsection{Updating the \texttt{Ref} key in structures}\label{sec:Refkey}
 
+Structures that cross reference other structures, e.g. citation commands, table of 
+content entries, footnote require often a \texttt{Ref} key. \texttt{Ref}
+can be added with the |ref| key of \cs{tagstructbegin} described above
+but as it is a task that often has to be done automatically in code
+there exist also a command that allows to extend the \texttt{Ref} key (and perhaps in future also other keys) later. 
+This command allows to add the value, the target structure of the \texttt{Ref} key,
+with four methods: directly as object reference, through a label name set with the |label| key, through a destination name if a \cs{MakeLinkTarget} has been used in 
+the target structure---this also works if hyperref has not been loaded---and through
+the structure number, which has been stored e.g. in a label.    
+
+\begin{docCommands}
+ {  
+  {doc name=tag_struct_gput:nnn,doc parameter=\marg{structurenumber}\marg{keyword}\marg{value}},
+ }\end{docCommands}
+
+The allowed \meta{keywords} are \texttt{ref}, \texttt{ref\_label} \texttt{ref\_dest}
+and \texttt{ref\_num}. 
+
 \subsubsection{Root structure}
 
 A document should have at least one structure which contains the whole 

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx	2024-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx	2024-09-12 20:18:35 UTC (rev 72263)
@@ -47,13 +47,13 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99d, released 2024-08-02}
+% \date{Version 0.99e, released 2024-09-11}
 % \maketitle
 % \begin{implementation}
 %    \begin{macrocode}
 %<@@=tag>
 %<*luatex>
-\ProvidesExplFile {tagpdf-luatex.def} {2024-08-02} {0.99d}
+\ProvidesExplFile {tagpdf-luatex.def} {2024-09-11} {0.99e}
   {tagpdf~driver~for~luatex}
 %    \end{macrocode}
 % \section{Loading the lua}
@@ -114,7 +114,7 @@
 \cs_set_protected:Npn \@@_prop_gput:Nnn #1 #2 #3
   {
     \prop_gput:Nnn #1 { #2 } { #3 }
-    \lua_now:e { ltx.@@.tables.\cs_to_str:N#1 ["#2"] = "#3" }
+    \lua_now:e { ltx.@@.tables.\cs_to_str:N#1 ["#2"] = "\lua_escape:n{#3}" }
   }
 
 
@@ -164,8 +164,8 @@
 
 local ProvidesLuaModule = {
     name          = "tagpdf",
-    version       = "0.99d",       --TAGVERSION
-    date          = "2024-08-02", --TAGDATE
+    version       = "0.99e",       --TAGVERSION
+    date          = "2024-09-11", --TAGDATE
     description   = "tagpdf lua code",
     license       = "The LATEX Project Public License 1.3c"
 }

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx	2024-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx	2024-09-12 20:18:35 UTC (rev 72263)
@@ -48,7 +48,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99d, released 2024-08-02}
+% \date{Version 0.99e, released 2024-09-11}
 % \maketitle
 % \begin{documentation}
 % \section{Commands}
@@ -331,11 +331,12 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-checks-code} {2024-08-02} {0.99d}
+\ProvidesExplPackage {tagpdf-checks-code} {2024-09-11} {0.99e}
  {part of tagpdf - code related to checks, conditionals, debugging and messages}
 %</header>
 %    \end{macrocode}
 % \section{Messages}
+%
 % \subsection{Messages related to mc-chunks}
 % \begin{macro}{mc-nested}
 % This message is issue is a mc is opened before the previous has been closed.
@@ -454,6 +455,18 @@
   { closing~structure~#1~tagged~\use:e{\prop_item:cn{g_@@_struct_#1_prop}{S}} }
 %    \end{macrocode}
 % \end{macro}
+% 
+% \begin{macro}{struct-Ref-unknown}
+% This message is issued at the end, when the Ref keys are updated.
+% TODO: in debug mode it should report more info about the structure.
+%    \begin{macrocode}
+\msg_new:nnn { tag } {struct-Ref-unknown}
+ {
+     #1~has~no~related~structure.\\
+    /Ref~not~updated.
+ }
+%    \end{macrocode}
+% \end{macro}
 % \begin{macro}{tree-struct-still-open}
 % Message issued at the end if there are beside Root other
 % open structures on the stack.
@@ -752,7 +765,7 @@
 \cs_new_protected:Npn \@@_check_struct_used:n #1 %#1 label
   {
     \prop_get:cnNT
-      {g_@@_struct_\@@_property_ref:enn{tagpdfstruct-#1}{tagstruct}{unknown}_prop}
+      {g_@@_struct_\property_ref:enn{tagpdfstruct-#1}{tagstruct}{unknown}_prop}
       {P}
       \l_@@_tmpa_tl
       {
@@ -940,7 +953,7 @@
           {
             \int_compare:nT
               {
-                \@@_property_ref:enn
+                \property_ref:enn
                   {mcid-####1}
                   {tagabspage}
                   {-1}
@@ -951,7 +964,7 @@
                \seq_gput_right:Ne \l_tmpa_seq
                  {
                    Page##1-####1-
-                   \@@_property_ref:enn
+                   \property_ref:enn
                      {mcid-####1}
                      {tagmcid}
                      {-1}

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-data.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-data.dtx	2024-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-data.dtx	2024-09-12 20:18:35 UTC (rev 72263)
@@ -47,7 +47,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99d, released 2024-08-02}
+% \date{Version 0.99e, released 2024-09-11}
 % \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 precedence!
 %    \begin{macrocode}
 %<*ns-latex>
-%% \ProvidesExplFile {tagpdf-ns-latex.def} {2024-08-02} {0.99d}
+%% \ProvidesExplFile {tagpdf-ns-latex.def} {2024-09-11} {0.99e}
 %% {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-08-02} {0.99d}
+%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2024-09-11} {0.99e}
 %% {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-08-02} {0.99d}
+%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2024-09-11} {0.99e}
 %%  {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-08-02} {0.99d} 
+%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2024-09-11} {0.99e} 
 %%  {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-08-02} {0.99d}
+%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2024-09-11} {0.99e}
 % {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-08-02} {0.99d}
+%% \ProvidesExplFile {tagpdf-parent-child.csv} {2024-09-11} {0.99e}
 ,,,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-08-02} {0.99d}
+%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2024-09-11} {0.99e}
 ,,,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-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-generic.dtx	2024-09-12 20:18:35 UTC (rev 72263)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99d, released 2024-08-02}
+% \date{Version 0.99e, released 2024-09-11}
 % \maketitle
 % \begin{documentation}
 % \end{documentation}
@@ -55,11 +55,11 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*generic>
-\ProvidesExplPackage {tagpdf-mc-code-generic} {2024-08-02} {0.99d}
+\ProvidesExplPackage {tagpdf-mc-code-generic} {2024-09-11} {0.99e}
  {part of tagpdf - code related to marking chunks - generic mode}
 %</generic>
 %<*debug>
-\ProvidesExplPackage {tagpdf-debug-generic} {2024-08-02} {0.99d}
+\ProvidesExplPackage {tagpdf-debug-generic} {2024-09-11} {0.99e}
  {part of tagpdf - debugging code related to marking chunks - generic mode}
 %</debug>
 %    \end{macrocode}
@@ -573,7 +573,7 @@
 %    \end{macrocode}
 % revert the attribute:
 %    \begin{macrocode}
-   \@@_property_gset:nnnn {tagmcid } { now }
+   \property_gset:nnnn {tagmcid } { now }
        {0}  { \int_use:N \g_@@_MCID_tmp_bypage_int }
    \cs_new_protected:Npn \@@_mc_bdc_mcid:nn #1 #2
      {
@@ -580,7 +580,7 @@
        \int_gincr:N \c at g_@@_MCID_abs_int
        \tl_set:Ne \l_@@_mc_ref_abspage_tl
          {
-           \@@_property_ref:enn %3 args
+           \property_ref:enn %3 args
              {
                mcid-\int_use:N \c at g_@@_MCID_abs_int
              }

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-luacode.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-luacode.dtx	2024-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-luacode.dtx	2024-09-12 20:18:35 UTC (rev 72263)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99d, released 2024-08-02}
+% \date{Version 0.99e, released 2024-09-11}
 % \maketitle
 % \begin{implementation}
 % The code is split into three parts: code shared by all engines,
@@ -86,11 +86,11 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*luamode>
-\ProvidesExplPackage {tagpdf-mc-code-lua} {2024-08-02} {0.99d}
+\ProvidesExplPackage {tagpdf-mc-code-lua} {2024-09-11} {0.99e}
   {tagpdf - mc code only for the luamode }
 %</luamode>
 %<*debug>
-\ProvidesExplPackage {tagpdf-debug-lua} {2024-08-02} {0.99d}
+\ProvidesExplPackage {tagpdf-debug-lua} {2024-09-11} {0.99e}
  {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-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-shared.dtx	2024-09-12 20:18:35 UTC (rev 72263)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99d, released 2024-08-02}
+% \date{Version 0.99e, released 2024-09-11}
 % \maketitle
 % \begin{documentation}
 % \section{Public Commands}
@@ -181,7 +181,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-mc-code-shared} {2024-08-02} {0.99d}
+\ProvidesExplPackage {tagpdf-mc-code-shared} {2024-09-11} {0.99e}
   {part of tagpdf - code related to marking chunks -
    code shared by generic and luamode }
 %</header>
@@ -328,7 +328,7 @@
   {
     \@@_check_if_active_struct:T
       {
-        \tl_set:Ne  \l_@@_tmpa_tl { \@@_property_ref:nnn{tagpdf-#1}{tagmcabs}{} }
+        \tl_set:Ne  \l_@@_tmpa_tl { \property_ref:nnn{tagpdf-#1}{tagmcabs}{} }
         \tl_if_empty:NTF\l_@@_tmpa_tl
           {
             \msg_warning:nnn {tag} {mc-label-unknown} {#1}

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx	2024-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx	2024-09-12 20:18:35 UTC (rev 72263)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99d, released 2024-08-02}
+% \date{Version 0.99e, released 2024-09-11}
 % \maketitle
 % \begin{documentation}
 % \begin{function}
@@ -98,7 +98,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-roles-code} {2024-08-02} {0.99d}
+\ProvidesExplPackage {tagpdf-roles-code} {2024-09-11} {0.99e}
  {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-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx	2024-09-12 20:18:35 UTC (rev 72263)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99d, released 2024-08-02}
+% \date{Version 0.99e, released 2024-09-11}
 % \maketitle
 % \begin{documentation}
 % \begin{function}{activate/space (setup-key),interwordspace (deprecated)}
@@ -66,7 +66,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-space-code} {2024-08-02} {0.99d}
+\ProvidesExplPackage {tagpdf-space-code} {2024-09-11} {0.99e}
  {part of tagpdf - code related to real space chars}
 %</header>
 %    \end{macrocode}
@@ -78,6 +78,7 @@
 % \begin{macro}{activate/spaces (setup-key),interwordspace (deprecated),show-spaces (deprecated)}
 %    \begin{macrocode}
 %<*package>
+\bool_new:N\l_@@_showspaces_bool
 \keys_define:nn { @@ / setup }
   {         
     activate/spaces .choice:,

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx	2024-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx	2024-09-12 20:18:35 UTC (rev 72263)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99d, released 2024-08-02}
+% \date{Version 0.99e, released 2024-09-11}
 % \maketitle
 % \begin{documentation}
 % \section{Public Commands}
@@ -120,6 +120,18 @@
 % the third the value. Currently the only keyword is \texttt{ref} which updates
 % the Ref key (an array)
 % \end{function}
+%
+% \begin{function}{\tag_struct_gput_ref:nnn}
+% \begin{syntax}
+%  \cs{tag_struct_gput_ref:nnn}\Arg{structure number}\Arg{keyword}\Arg{value}
+%  \end{syntax}
+% This is an user interface to add a Ref key to an
+% existing structure. The target structure doesn't have to exist yet
+% but can be addressed by label, destname or even num.
+% \meta{keyword} is currently either \texttt{label}, \texttt{dest}
+% or \texttt{num}. The value is then either a label name, the name of a destination
+% or a structure number.
+% \end{function}
 % 
 % \section{Public keys}
 % \subsection{Keys for the structure commands}
@@ -285,7 +297,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-struct-code} {2024-08-02} {0.99d}
+\ProvidesExplPackage {tagpdf-struct-code} {2024-09-11} {0.99e}
  {part of tagpdf - code related to storing structure}
 %</header>
 %    \end{macrocode}
@@ -442,12 +454,16 @@
 \tl_new:N \l_@@_struct_roletag_NS_tl
 %    \end{macrocode}
 % \end{variable}
-% \begin{variable}{\l_@@_struct_key_label_tl}
-% This will hold the label value.
+% \begin{variable}{\g_@@_struct_label_num_prop}
+% This will hold for every structure label the associated 
+% structure number. The prop will allow to 
+% fill the /Ref key directly at the first compilation if the ref
+% key is used.
 %    \begin{macrocode}
-\tl_new:N \l_@@_struct_key_label_tl
+\prop_new_linked:N \g_@@_struct_label_num_prop
 %    \end{macrocode}
 % \end{variable}
+
 % \begin{variable}{\l_@@_struct_elem_stash_bool}
 % This will keep track of the stash status
 %    \begin{macrocode}
@@ -696,8 +712,8 @@
       /Type \c_space_tl /MCR \c_space_tl
       /Pg
         \c_space_tl
-      \pdf_pageobject_ref:n { \@@_property_ref:enn{mcid-#1}{tagabspage}{1} }
-       /MCID \c_space_tl \@@_property_ref:enn{mcid-#1}{tagmcid}{1}
+      \pdf_pageobject_ref:n { \property_ref:enn{mcid-#1}{tagabspage}{1} }
+       /MCID \c_space_tl \property_ref:enn{mcid-#1}{tagmcid}{1}
      >>
   }
 %</package>  
@@ -907,34 +923,47 @@
     \tl_clear:N #2
     \prop_map_inline:cn { g_@@_struct_#1_prop }
       {
-        \tl_put_right:Ne #2 
-          {
 %    \end{macrocode}
 % Some keys needs the option to format the value, e.g. add brackets for an
 % array, we also need the option to ignore some entries in the properties.
-%    \begin{macrocode}        
-           \cs_if_exist_use:cTF {@@_struct_format_##1:nn}
-             {{##1}{##2}}
-             {\c_space_tl/##1~##2}
+%    \begin{macrocode}
+        \cs_if_exist_use:cTF {@@_struct_format_##1:nnN}
+          {
+            {##1}{##2}#2
           }
-      }
+          {
+            \tl_put_right:Ne #2 { \c_space_tl/##1~##2 } 
+          }
+      }    
   }
 %    \end{macrocode}
 % \end{macro}
 % 
-% \begin{macro}{\@@_struct_format_rolemap:nn,\@@_struct_format_parentrole:nn}
+% \begin{macro}{\@@_struct_format_rolemap:nnN,\@@_struct_format_parentrole:nnN}
 % This two entries should not end in the PDF.
 %    \begin{macrocode}
-\cs_new:Nn\@@_struct_format_rolemap:nn{}
-\cs_new:Nn\@@_struct_format_parentrole:nn{}
+\cs_new:Nn\@@_struct_format_rolemap:nnN{}
+\cs_new:Nn\@@_struct_format_parentrole:nnN{}
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{\@@_struct_format_Ref:nn}
-% Ref is an array, we store only the content to be able to extend it
-% so the formatting command adds the brackets:
+% \begin{macro}{\@@_struct_format_Ref:nnN}
+% Ref is an array, we store values as a clist of commands that must
+% be executed here, the formatting has to add also brackets. 
+% 
 %    \begin{macrocode}
-\cs_new:Nn\__tag_struct_format_Ref:nn{\c_space_tl/#1~[#2]}
+\cs_new_protected:Nn\@@_struct_format_Ref:nnN
+  {
+    \tl_put_right:Nn #3 { ~/#1~[ } %]
+    \clist_map_inline:nn{ #2 }
+     {
+       ##1 #3
+     }
+    \tl_put_right:Nn #3 
+     { %[
+      \c_space_tl]
+     }  
+  }
 %    \end{macrocode}
 % \end{macro}
 % \begin{macro}{\@@_struct_write_obj:n}
@@ -1028,7 +1057,7 @@
             #1 %
           }
           {
-            \pdf_pageobject_ref:n { \@@_property_ref:nnn {@tag at objr@page@#2 }{ tagabspage }{1} }
+            \pdf_pageobject_ref:n { \property_ref:nnn {@tag at objr@page@#2 }{ tagabspage }{1} }
           }
         % add the parent obj number to the parent tree:
         \exp_args:Nne
@@ -1148,7 +1177,14 @@
 %    \begin{macrocode}
 \keys_define:nn { @@ / struct }
   {
-    label .tl_set:N      = \l_@@_struct_key_label_tl,
+    label .code:n        = 
+      {
+        \prop_gput:Nee\g_@@_struct_label_num_prop 
+          {#1}{\int_use:N \c at g_@@_struct_abs_int}
+        \@@_property_record:eV
+          {tagpdfstruct-#1}
+          \c_@@_property_struct_clist  
+      },
     stash .bool_set:N    = \l_@@_struct_elem_stash_bool,
     parent .code:n       =
       {
@@ -1233,19 +1269,76 @@
           { Lang }
           { (#1) }
       },
+    }  
 %    \end{macrocode}
-% Ref is an array, the brackets are added through the formatting command.
+% Ref is rather special as it values are often
+% known only at the end of the document.
+% It therefore stores it values as
+% clist of commands which are executed at the end of the document,
+% when the structure elements are written.
+% \begin{macro}{\@@_struct_Ref_obj:nN,\@@_struct_Ref_label:nN,
+%  \@@_struct_Ref_dest:nN,\@@_struct_Ref_num:nN}
+% this commands are helper commands that are stored as clist
+% in the Ref key of a structure. They are executed when the structure
+% elements are written in  \cs{@@_struct_write_obj}. They are used
+% in \cs{@@_struct_format_Ref}. They allow to add a Ref by object reference,
+% label, destname and structure number
 %    \begin{macrocode}
+\cs_new_protected:Npn \@@_struct_Ref_obj:nN #1 #2 %#1 a object reference
+  {
+    \tl_put_right:Ne#2
+      {
+        \c_space_tl#1
+      }
+  }
+  
+\cs_new_protected:Npn \@@_struct_Ref_label:nN #1 #2 %#1 a label
+  {
+    \prop_get:NnNTF \g_@@_struct_label_num_prop {#1} \l_@@_tmpb_tl
+      {
+        \tl_put_right:Ne#2
+          {
+            \c_space_tl\tag_struct_object_ref:e{ \l_@@_tmpb_tl }
+          }
+      }    
+      {
+        \msg_warning:nnn {tag}{struct-Ref-unknown}{Label~'#1'}
+      }    
+  }
+\cs_new_protected:Npn \@@_struct_Ref_dest:nN #1 #2 %#1 a dest name
+  { 
+    \prop_get:NnNTF \g_@@_struct_dest_num_prop {#1} \l_@@_tmpb_tl
+      {
+        \tl_put_right:Ne#2
+          {
+            \c_space_tl\tag_struct_object_ref:e{ \l_@@_tmpb_tl }
+          }
+      }    
+      {
+        \msg_warning:nnn {tag}{struct-Ref-unknown}{Destination~'#1'}
+      }
+  }
+\cs_new_protected:Npn \@@_struct_Ref_num:nN #1 #2 %#1 a structure number
+  {
+    \tl_put_right:Ne#2
+      {
+        \c_space_tl\tag_struct_object_ref:e{ #1 }
+      }  
+  }
+   
+%    \end{macrocode}
+% \end{macro}
+%
+%    \begin{macrocode}
+\keys_define:nn { @@ / struct }
+  {
     ref .code:n        = % ref property
       {
-        \tl_clear:N\l_@@_tmpa_tl
         \clist_map_inline:on {#1}
           {
-            \tl_put_right:Ne \l_@@_tmpa_tl
-              {~\@@_property_ref:en{tagpdfstruct-##1}{tagstructobj} }
+            \tag_struct_gput:nne
+              {\int_use:N \c at g_@@_struct_abs_int}{ref_label}{ ##1 }
           }
-        \@@_struct_gput_data_ref:ee 
-         { \int_use:N \c at g_@@_struct_abs_int } {\l_@@_tmpa_tl}
       },
     E .code:n        = % E property
       {
@@ -1481,13 +1574,6 @@
            \g_@@_struct_tag_tl               
            \g_@@_struct_tag_NS_tl   
         \@@_check_structure_has_tag:n { \int_use:N \c at g_@@_struct_abs_int }           
-        \tl_if_empty:NF
-          \l_@@_struct_key_label_tl
-          {
-            \@@_property_record:eV
-             {tagpdfstruct-\l_@@_struct_key_label_tl}
-             \c_@@_property_struct_clist
-          }
 %    \end{macrocode}
 % The structure number of the parent is either taken from the stack or
 % has been set with the parent key.
@@ -1706,16 +1792,16 @@
     \@@_check_if_active_struct:T
       {
         \prop_if_exist:cTF
-          { g_@@_struct_\@@_property_ref:enn{tagpdfstruct-#1}{tagstruct}{unknown}_prop } %
+          { g_@@_struct_\property_ref:enn{tagpdfstruct-#1}{tagstruct}{unknown}_prop } %
           {
             \@@_check_struct_used:n {#1}
             %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}{1} }
+              { \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}{1}_prop }
+              { g_@@_struct_\property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}_prop }
               { P }
               {
                 \pdf_object_ref_indexed:nn { @@/struct } { \g_@@_struct_stack_current_tl }
@@ -1724,7 +1810,7 @@
 % debug code
 %    \begin{macrocode}
 %<debug>           \prop_gput:cne
-%<debug>             { g_@@_struct_debug_\@@_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}_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=~
@@ -1736,7 +1822,7 @@
 %   the global tl-vars:
 %    \begin{macrocode}
              \@@_struct_get_parentrole:eNN  
-              {\@@_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}}
+              {\property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}}
               \l_@@_tmpa_tl
               \l_@@_tmpb_tl
             \@@_check_parent_child:VVVVN
@@ -1853,6 +1939,7 @@
    \pdf_object_ref_indexed:nn {@@/struct}{ #1 }
  }
 \cs_generate_variant:Nn \tag_struct_object_ref:n {e}
+%</package>
 %    \end{macrocode}
 %
 % \end{macro}
@@ -1864,10 +1951,18 @@
 % adjusted to the key in question. 
 % The first argument is the number of the structure, 
 % the second a keyword referring to a function,
-% the third the value. Currently the only keyword is \texttt{ref} which updates
-% the Ref key (an array)
+% the third the value. Currently the existing keywords are all related
+% to the \texttt{Ref} key (an array). 
+% The keyword \texttt{ref} takes as value an explicit object reference to 
+% a structure. The keyword \texttt{ref_label} expects as value a label name (from
+% a label set in a \cs{tagstructbegin} command). The keyword \texttt{ref_dest}
+% expects a destination name set with \cs{MakeLinkTarget}. It then will refer to 
+% the structure in which this \cs{MakeLinkTarget} was used. At last
+% the keyword \texttt{ref_num} expects a structure number. 
 %    \begin{macrocode}
-\cs_new_protected:Npn \tag_struct_gput:nnn #1 #2 #3
+%<base>\cs_new_protected:Npn \tag_struct_gput:nnn #1 #2 #3{}
+%<*package>
+\cs_set_protected:Npn \tag_struct_gput:nnn #1 #2 #3
  {
    \cs_if_exist_use:cF {@@_struct_gput_data_#2:nn}
     { %warning??
@@ -1880,22 +1975,47 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\@@_struct_gput_data_ref:nn}
+% \begin{macro}{\@@_struct_gput_data_ref_aux:nnn}
 %    \begin{macrocode}
 %<*package>
-\cs_new_protected:Npn \@@_struct_gput_data_ref:nn #1 #2
-  % #1 receiving struct num, #2 list of object ref
+\cs_new_protected:Npn \@@_struct_gput_data_ref_aux:nnn #1 #2 #3
+  % #1 receiving struct num, #2 key word #3 value
    {
-     \prop_get:cnN
-        { g_@@_struct_#1_prop }
-        {Ref}
-        \l_@@_get_tmpc_tl
-     \@@_struct_prop_gput:nne
-        { #1 }
-        { Ref }
-        { \quark_if_no_value:NF\l_@@_get_tmpc_tl { \l_@@_get_tmpc_tl\c_space_tl }#2 }
+     \prop_get:cnNTF
+       { g_@@_struct_#1_prop }
+       {Ref}
+       \l_@@_get_tmpc_tl
+       {
+         \tl_put_right:No \l_@@_get_tmpc_tl 
+           {\cs:w @@_struct_Ref_#2:nN \cs_end: {#3},}
+       }
+       {
+         \tl_set:No \l_@@_get_tmpc_tl 
+           {\cs:w @@_struct_Ref_#2:nN \cs_end: {#3},}
+       } 
+       \@@_struct_prop_gput:nno
+         { #1 }
+         { Ref }
+         { \l_@@_get_tmpc_tl }        
     }
-\cs_generate_variant:Nn \@@_struct_gput_data_ref:nn {ee}
+\cs_new_protected:Npn \@@_struct_gput_data_ref:nn #1 #2 
+  {
+    \@@_struct_gput_data_ref_aux:nnn {#1}{obj}{#2}
+  }    
+\cs_new_protected:Npn \@@_struct_gput_data_ref_label:nn #1 #2 
+  {
+    \@@_struct_gput_data_ref_aux:nnn {#1}{label}{#2}
+  }      
+\cs_new_protected:Npn \@@_struct_gput_data_ref_dest:nn #1 #2 
+  {
+    \@@_struct_gput_data_ref_aux:nnn {#1}{dest}{#2}
+  }      
+\cs_new_protected:Npn \@@_struct_gput_data_ref_num:nn #1 #2 
+  {
+    \@@_struct_gput_data_ref_aux:nnn {#1}{num}{#2}
+  }   
+     
+\cs_generate_variant:Nn \@@_struct_gput_data_ref:nn {ee,no}
 %    \end{macrocode}
 % \end{macro}
 % \begin{macro}
@@ -1937,7 +2057,7 @@
 % \section{Attributes and attribute classes}
 %    \begin{macrocode}
 %<*header>
-\ProvidesExplPackage {tagpdf-attr-code} {2024-08-02} {0.99d}
+\ProvidesExplPackage {tagpdf-attr-code} {2024-09-11} {0.99e}
   {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-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-tree.dtx	2024-09-12 20:18:35 UTC (rev 72263)
@@ -47,13 +47,13 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99d, released 2024-08-02}
+% \date{Version 0.99e, released 2024-09-11}
 % \maketitle
 % \begin{implementation}
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-tree-code} {2024-08-02} {0.99d}
+\ProvidesExplPackage {tagpdf-tree-code} {2024-09-11} {0.99e}
  {part of tagpdf - code related to writing trees and dictionaries to the pdf}
 %</header>
 %    \end{macrocode}
@@ -118,7 +118,7 @@
 %    \end{macrocode}
 % \end{variable}
 % 
-% \begin{macro}{viewer/startpage (setup-key)}
+% \begin{macro}{viewer/startstructure (setup-key)}
 % We also need an option to setup the start structure. So we setup a key
 % which sets the variable to the current structure. This still requires
 % hyperref to do most of the job, this should perhaps be changed. 
@@ -367,11 +367,11 @@
           {
             %mcid####1
             \int_compare:nT
-              {\@@_property_ref:enn{mcid-####1}{tagabspage}{-1}=##1} %mcid is on current page
+              {\property_ref:enn{mcid-####1}{tagabspage}{-1}=##1} %mcid is on current page
               {% yes
                 \prop_put:Nee
                   \l_@@_tmpa_prop
-                  {\@@_property_ref:enn{mcid-####1}{tagmcid}{-1}}
+                  {\property_ref:enn{mcid-####1}{tagmcid}{-1}}
                   {\prop_item:Nn \g_@@_mc_parenttree_prop {####1}}
               }
           }

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx	2024-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx	2024-09-12 20:18:35 UTC (rev 72263)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.99d, released 2024-08-02}
+% \date{Version 0.99e, released 2024-09-11}
 % \maketitle
 % \begin{documentation}
 % \section{Setup commands}
@@ -309,7 +309,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-user} {2024-08-02} {0.99d}
+\ProvidesExplPackage {tagpdf-user} {2024-09-11} {0.99e}
   {tagpdf - user commands}
 %</header>
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx	2024-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx	2024-09-12 20:18:35 UTC (rev 72263)
@@ -93,8 +93,8 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*package>
-\ProvidesExplPackage {tagpdf} {2024-08-02} {0.99d}
-  { A package to experiment with pdf tagging }
+\ProvidesExplPackage {tagpdf} {2024-09-11} {0.99e}
+  { LaTeX kernel code for PDF tagging }
 
 \bool_if:nF
   {
@@ -119,7 +119,7 @@
 %    \end{macrocode}
 %<*debug>
 %    \begin{macrocode}
-\ProvidesExplPackage {tagpdf-debug} {2024-08-02} {0.99d}
+\ProvidesExplPackage {tagpdf-debug} {2024-09-11} {0.99e}
   { debug code for tagpdf }
 \@ifpackageloaded{tagpdf}{}{\PackageWarning{tagpdf-debug}{tagpdf~not~loaded,~quitting}\endinput}
 %    \end{macrocode}
@@ -142,7 +142,7 @@
 % we define a base package with dummy functions
 %    \begin{macrocode}
 %<*base>
-\ProvidesExplPackage {tagpdf-base} {2024-08-02} {0.99d}
+\ProvidesExplPackage {tagpdf-base} {2024-09-11} {0.99e}
   {part of tagpdf - provide base, no-op versions of the user commands }
 %</base>
 %    \end{macrocode} 
@@ -191,34 +191,31 @@
  }
 %</base>
 %    \end{macrocode}
-% \subsection{Indexed objects}
-% 2024-04-11: Temporary code! Can be removed after the next expl3 release!
+% \subsection{Patches related to Ref improvement}
+% 2024-09-09: Temporary code. Can be removed when the latex-lab-footnote
+% and latex-lab-toc code have been adapted to the better Ref handling.
 %    \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 }       
-     }  
- }
-
+%<*package>
+\AddToHook{package/latex-lab-testphase-new-or-2/after}
+  {
+    \cs_set_protected:Npn \__fnote_gput_ref:nn #1 #2 %#1 the structure number receiving the ref #2
+      {
+        \tag_struct_gput:nnn {#1}{ref_num}{#2}
+      }
+  }
+\AddToHook{package/latex-lab-testphase-toc/after}
+  {
+    \cs_set_protected:Npn \g_@@_struct_ref_by_dest:
+      {
+        \prop_map_inline:Nn\g_@@_struct_ref_by_dest_prop
+          {
+            \tag_struct_gput:nnn {##1}{ref_dest}{##2}
+          }
+      }
+  }  
+%</package>
 %    \end{macrocode}
+%
 % \subsection{a LastPage label}
 % See also issue \#2 in Accessible-xref
 % \begin{macro}{\@@_lastpagelabel:}
@@ -251,6 +248,7 @@
 %  {
 %    \l_@@_tmpa_tl,
 %    \l_@@_tmpb_tl,
+%    \l_@@_Ref_tmpa_tl,
 %    \l_@@_get_tmpc_tl,    
 %    \l_@@_get_parent_tmpa_tl
 %    \l_@@_get_parent_tmpb_tl    
@@ -267,6 +265,7 @@
 %    \begin{macrocode}
 \tl_new:N    \l_@@_tmpa_tl
 \tl_new:N    \l_@@_tmpb_tl
+\tl_new:N    \l_@@_Ref_tmpa_tl
 \tl_new:N    \l_@@_get_tmpc_tl
 \tl_new:N    \l_@@_get_parent_tmpa_tl
 \tl_new:N    \l_@@_get_parent_tmpb_tl
@@ -382,25 +381,11 @@
 %    \end{macrocode}
 %
 % \section{Label and Reference commands}
-% To ease transition to properties we setup internal definition. They can be replaced
-% by the property definitions once that is released.
-% %** do it!
-% \begin{macro}{\@@_property_new:nnnn,\@@_property_gset:nnnn,\@@_property_ref:nnn}
-% At first a command to define new properties
+% The code uses mostly the kernel properties but need a few local variants.
+% \begin{macro}{\@@_property_record:nn}
+% The command to record a property while preserving the spaces similar to the standard
+% \cs{label}.    
 %    \begin{macrocode}
-    \cs_new_eq:NN \@@_property_new:nnnn \property_new:nnnn
-%    \end{macrocode}
-% For the non-shipout code we need also the option to reset property
-%    \begin{macrocode}
-    \cs_new_eq:NN \@@_property_gset:nnnn \property_gset:nnnn
-%    \end{macrocode}
-% The command to reference while giving a local default.
-%    \begin{macrocode}
-    \cs_new_eq:NN \@@_property_ref:nnn \property_ref:nnn 
-    \cs_new_eq:NN \@@_property_ref:nn \property_ref:nn 
-%    \end{macrocode}
-% The command to record     
-%    \begin{macrocode}
     \cs_new_protected:Npn \@@_property_record:nn #1#2
       {
         \@bsphack
@@ -411,8 +396,8 @@
 %    \end{macrocode}
 % And a few variants
 %    \begin{macrocode}
-\cs_generate_variant:Nn \@@_property_ref:nnn {enn}
-\cs_generate_variant:Nn \@@_property_ref:nn {en}
+\cs_generate_variant:Nn \property_ref:nnn {enn}
+\cs_generate_variant:Nn \property_ref:nn  {en}
 \cs_generate_variant:Nn \@@_property_record:nn {en,eV}
 %    \end{macrocode}
 % \end{macro}
@@ -423,7 +408,7 @@
 %    \begin{macrocode}
 \cs_new:Npn \@@_property_ref_lastpage:nn #1 #2
   {
-    \@@_property_ref:nnn {@tag at LastPage}{#1}{#2}
+    \property_ref:nnn {@tag at LastPage}{#1}{#2}
   }
 %    \end{macrocode}
 %\end{macro}
@@ -440,21 +425,21 @@
 % With mc-chunks we store the absolute page number |tagabspage|,
 % the absolute id |tagmcabc|, and the id on the page |tagmcid|.
 %    \begin{macrocode}
-\@@_property_new:nnnn 
+\property_new:nnnn 
   { tagstruct } { now } 
-  {0} { \int_use:N \c at g_@@_struct_abs_int }
-\@@_property_new:nnnn  { tagstructobj } { now }  {}
+  {1} { \int_use:N \c at g_@@_struct_abs_int }
+\property_new:nnnn  { tagstructobj } { now }  {}
   {
      \pdf_object_ref_indexed:nn { @@/struct } { \c at g_@@_struct_abs_int }
   }
-\@@_property_new:nnnn  
+\property_new:nnnn  
   { tagabspage } { shipout } 
   {0} { \int_use:N \g_shipout_readonly_int }
-\@@_property_new:nnnn  { tagmcabs } { now }
+\property_new:nnnn  { tagmcabs } { now }
   {0} { \int_use:N \c at g_@@_MCID_abs_int }
 
 \flag_new:n { @@/mcid }     
-\@@_property_new:nnnn  {tagmcid } { shipout }
+\property_new:nnnn  {tagmcid } { shipout }
    {0} { \flag_height:n { @@/mcid } }
   
 %    \end{macrocode}
@@ -550,7 +535,8 @@
 %    \begin{macrocode}
 \cs_set_protected:Npn \tag_stop:n #1
   {
-%<debug>    \msg_note:nnee {tag / debug }{tag-stop}{ \int_use:N \l_@@_tag_stop_int }{#1}           
+%<debug>    \msg_note:nnee {tag / debug }{tag-stop}
+%<debug>       { \int_use:N \l_@@_tag_stop_int }{\exp_not:n{#1}}           
     \int_incr:N \l_@@_tag_stop_int
     \bool_set_false:N \l_@@_active_struct_bool
     \bool_set_false:N \l_@@_active_mc_bool
@@ -567,7 +553,8 @@
         \bool_set_true:N \l_@@_active_socket_bool
         \@@_start_para_ints:
       } 
-%<debug>    \msg_note:nnee {tag / debug }{tag-start}{ \int_use:N \l_@@_tag_stop_int }{#1}             
+%<debug>    \msg_note:nnee {tag / debug }{tag-start}
+%<debug>       { \int_use:N \l_@@_tag_stop_int }{\exp_not:n{#1}}             
   }
 %</package|debug>
 %<*base>

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty	2024-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty	2024-09-12 20:18:35 UTC (rev 72263)
@@ -25,7 +25,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf.dtx
-\ProvidesExplPackage {tagpdf-base} {2024-08-02} {0.99d}
+\ProvidesExplPackage {tagpdf-base} {2024-09-11} {0.99e}
   {part of tagpdf - provide base, no-op versions of the user commands }
 \cs_new_protected:Npn \__tag_whatsits: {}
 \AddToHook{begindocument}
@@ -39,30 +39,6 @@
      \cs_set_protected:Npn \__tag_whatsits: {\tex_special:D {} }
    }
  }
-\cs_if_free:NT \pdf_object_new_indexed:nn
- {
-   \cs_generate_variant:Nn \pdf_object_new:n {e}
-   \cs_generate_variant:Nn \pdf_object_write:nnn {enn}
-   \cs_new_protected:Npn \pdf_object_new_indexed:nn #1 #2
-     {
-       \pdf_object_new:e {#1/\int_eval:n{#2}}
-     }
-   \cs_new_protected:Npn \pdf_object_write_indexed:nnnn #1 #2 #3 #4
-     {
-       \pdf_object_write:enn {#1/\int_eval:n{#2}}{#3}{#4}
-     }
-   \cs_generate_variant:Nn \pdf_object_write_indexed:nnnn {nnne}
-   \cs_new:Npn\pdf_object_ref_indexed:nn #1 #2
-     {
-       \pdf_object_ref:e {#1/\int_eval:n{#2}}
-     }
-   \cs_new:Npn \__kernel_pdf_object_id_indexed:nn #1 #2
-     {
-       \int_use:c
-         { c__pdf_object_ #1/\int_eval:n{#2} _int }
-     }
- }
-
 \cs_new_protected:Npn \tag_stop:{}
 \cs_new_protected:Npn \tag_start:{}
 \cs_new_protected:Npn \tagstop{}
@@ -106,6 +82,7 @@
 \cs_new_protected:Npn \tag_struct_end:n{}
 \cs_new_protected:Npn \tag_struct_use:n #1 {}
 \cs_new_protected:Npn \tag_struct_use_num:n #1 {}
+\cs_new_protected:Npn \tag_struct_gput:nnn #1 #2 #3{}
 
 %% File: tagpdf-checks.dtx
 

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty	2024-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty	2024-09-12 20:18:35 UTC (rev 72263)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-mc-generic.dtx
-\ProvidesExplPackage {tagpdf-debug-generic} {2024-08-02} {0.99d}
+\ProvidesExplPackage {tagpdf-debug-generic} {2024-09-11} {0.99e}
  {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-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-lua.sty	2024-09-12 20:18:35 UTC (rev 72263)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-mc-luacode.dtx
-\ProvidesExplPackage {tagpdf-debug-lua} {2024-08-02} {0.99d}
+\ProvidesExplPackage {tagpdf-debug-lua} {2024-09-11} {0.99e}
  {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-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty	2024-09-12 20:18:35 UTC (rev 72263)
@@ -26,35 +26,11 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf.dtx
-\ProvidesExplPackage {tagpdf-debug} {2024-08-02} {0.99d}
+\ProvidesExplPackage {tagpdf-debug} {2024-09-11} {0.99e}
   { debug code for tagpdf }
 \@ifpackageloaded{tagpdf}{}{\PackageWarning{tagpdf-debug}{tagpdf~not~loaded,~quitting}\endinput}
 \prop_gput:Nnn \g_msg_module_type_prop { tag / debug} {}
 \prop_gput:Nnn \g_msg_module_name_prop { tag / debug }{tagpdf~DEBUG}
-\cs_if_free:NT \pdf_object_new_indexed:nn
- {
-   \cs_generate_variant:Nn \pdf_object_new:n {e}
-   \cs_generate_variant:Nn \pdf_object_write:nnn {enn}
-   \cs_new_protected:Npn \pdf_object_new_indexed:nn #1 #2
-     {
-       \pdf_object_new:e {#1/\int_eval:n{#2}}
-     }
-   \cs_new_protected:Npn \pdf_object_write_indexed:nnnn #1 #2 #3 #4
-     {
-       \pdf_object_write:enn {#1/\int_eval:n{#2}}{#3}{#4}
-     }
-   \cs_generate_variant:Nn \pdf_object_write_indexed:nnnn {nnne}
-   \cs_new:Npn\pdf_object_ref_indexed:nn #1 #2
-     {
-       \pdf_object_ref:e {#1/\int_eval:n{#2}}
-     }
-   \cs_new:Npn \__kernel_pdf_object_id_indexed:nn #1 #2
-     {
-       \int_use:c
-         { c__pdf_object_ #1/\int_eval:n{#2} _int }
-     }
- }
-
 \cs_set_protected:Npn \tag_stop:
   {
      \msg_note:nne {tag / debug }{tag-stop}{ \int_use:N \l__tag_tag_stop_int }
@@ -80,7 +56,8 @@
 \cs_set_eq:NN\tagstart\tag_start:
 \cs_set_protected:Npn \tag_stop:n #1
   {
-    \msg_note:nnee {tag / debug }{tag-stop}{ \int_use:N \l__tag_tag_stop_int }{#1}
+    \msg_note:nnee {tag / debug }{tag-stop}
+       { \int_use:N \l__tag_tag_stop_int }{\exp_not:n{#1}}
     \int_incr:N \l__tag_tag_stop_int
     \bool_set_false:N \l__tag_active_struct_bool
     \bool_set_false:N \l__tag_active_mc_bool
@@ -97,7 +74,8 @@
         \bool_set_true:N \l__tag_active_socket_bool
         \__tag_start_para_ints:
       }
-    \msg_note:nnee {tag / debug }{tag-start}{ \int_use:N \l__tag_tag_stop_int }{#1}
+    \msg_note:nnee {tag / debug }{tag-start}
+       { \int_use:N \l__tag_tag_stop_int }{\exp_not:n{#1}}
   }
 \bool_if:NTF \g__tag_mode_lua_bool
   {
@@ -371,13 +349,6 @@
            \g__tag_struct_tag_tl
            \g__tag_struct_tag_NS_tl
         \__tag_check_structure_has_tag:n { \int_use:N \c at g__tag_struct_abs_int }
-        \tl_if_empty:NF
-          \l__tag_struct_key_label_tl
-          {
-            \__tag_property_record:eV
-             {tagpdfstruct-\l__tag_struct_key_label_tl}
-             \c__tag_property_struct_clist
-          }
         \int_compare:nNnT { \l__tag_struct_stack_parent_tmpa_tl } = { -1 }
           {
             \seq_get:NNF
@@ -554,22 +525,22 @@
     \__tag_check_if_active_struct:T
       {
         \prop_if_exist:cTF
-          { g__tag_struct_\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{unknown}_prop } %
+          { g__tag_struct_\property_ref:enn{tagpdfstruct-#1}{tagstruct}{unknown}_prop } %
           {
             \__tag_check_struct_used:n {#1}
             %add the label structure as kid to the current structure (can be the root)
             \__tag_struct_kid_struct_gput_right:ee
               { \g__tag_struct_stack_current_tl }
-              { \__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1} }
+              { \property_ref:enn{tagpdfstruct-#1}{tagstruct}{1} }
             %add the current structure to the labeled one as parents
             \__tag_prop_gput:cne
-              { g__tag_struct_\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}_prop }
+              { g__tag_struct_\property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}_prop }
               { P }
               {
                 \pdf_object_ref_indexed:nn { __tag/struct } { \g__tag_struct_stack_current_tl }
               }
            \prop_gput:cne
-             { g__tag_struct_debug_\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}_prop }
+             { g__tag_struct_debug_\property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}_prop }
              { P }
              {
                parent~structure:~\g__tag_struct_stack_current_tl\c_space_tl=~
@@ -576,7 +547,7 @@
                \g__tag_struct_tag_tl
              }
              \__tag_struct_get_parentrole:eNN
-              {\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}}
+              {\property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}}
               \l__tag_tmpa_tl
               \l__tag_tmpb_tl
             \__tag_check_parent_child:VVVVN

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def	2024-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def	2024-09-12 20:18:35 UTC (rev 72263)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-backend.dtx
-\ProvidesExplFile {tagpdf-luatex.def} {2024-08-02} {0.99d}
+\ProvidesExplFile {tagpdf-luatex.def} {2024-09-11} {0.99e}
   {tagpdf~driver~for~luatex}
 {
   \fontencoding{TU}\fontfamily{lmr}\fontseries{m}\fontshape{n}\fontsize{10pt}{10pt}\selectfont
@@ -46,7 +46,7 @@
 \cs_set_protected:Npn \__tag_prop_gput:Nnn #1 #2 #3
   {
     \prop_gput:Nnn #1 { #2 } { #3 }
-    \lua_now:e { ltx.__tag.tables.\cs_to_str:N#1 ["#2"] = "#3" }
+    \lua_now:e { ltx.__tag.tables.\cs_to_str:N#1 ["#2"] = "\lua_escape:n{#3}" }
   }
 
 \cs_set_protected:Npn \__tag_seq_gput_right:Nn #1 #2

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-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty	2024-09-12 20:18:35 UTC (rev 72263)
@@ -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-08-02} {0.99d}
+\ProvidesExplPackage {tagpdf-mc-code-generic} {2024-09-11} {0.99e}
  {part of tagpdf - code related to marking chunks - generic mode}
 \tl_new:N \l__tag_mc_ref_abspage_tl
 
@@ -276,7 +276,7 @@
    \__tag_prop_new:N \g__tag_MCID_byabspage_prop
    \int_new:N \g__tag_MCID_tmp_bypage_int
    \cs_generate_variant:Nn \__tag_mc_bdc:nn {ne}
-   \__tag_property_gset:nnnn {tagmcid } { now }
+   \property_gset:nnnn {tagmcid } { now }
        {0}  { \int_use:N \g__tag_MCID_tmp_bypage_int }
    \cs_new_protected:Npn \__tag_mc_bdc_mcid:nn #1 #2
      {
@@ -283,7 +283,7 @@
        \int_gincr:N \c at g__tag_MCID_abs_int
        \tl_set:Ne \l__tag_mc_ref_abspage_tl
          {
-           \__tag_property_ref:enn %3 args
+           \property_ref:enn %3 args
              {
                mcid-\int_use:N \c at g__tag_MCID_abs_int
              }

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-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty	2024-09-12 20:18:35 UTC (rev 72263)
@@ -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-08-02} {0.99d}
+\ProvidesExplPackage {tagpdf-mc-code-lua} {2024-09-11} {0.99e}
   {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-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def	2024-09-12 20:18:35 UTC (rev 72263)
@@ -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-08-02} {0.99d}
+%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2024-09-11} {0.99e}
 %% {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-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def	2024-09-12 20:18:35 UTC (rev 72263)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-data.dtx
-%% \ProvidesExplFile {tagpdf-ns-latex.def} {2024-08-02} {0.99d}
+%% \ProvidesExplFile {tagpdf-ns-latex.def} {2024-09-11} {0.99e}
 %% {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-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def	2024-09-12 20:18:35 UTC (rev 72263)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-data.dtx
-%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2024-08-02} {0.99d}
+%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2024-09-11} {0.99e}
 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-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def	2024-09-12 20:18:35 UTC (rev 72263)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-data.dtx
-%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2024-08-02} {0.99d}
+%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2024-09-11} {0.99e}
 %%  {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-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def	2024-09-12 20:18:35 UTC (rev 72263)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-data.dtx
-%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2024-08-02} {0.99d}
+%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2024-09-11} {0.99e}
 %%  {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-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child-2.csv	2024-09-12 20:18:35 UTC (rev 72263)
@@ -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-08-02} {0.99d}
+%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2024-09-11} {0.99e}
 ,,,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-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child.csv	2024-09-12 20:18:35 UTC (rev 72263)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-data.dtx
-%% \ProvidesExplFile {tagpdf-parent-child.csv} {2024-08-02} {0.99d}
+%% \ProvidesExplFile {tagpdf-parent-child.csv} {2024-09-11} {0.99e}
 ,,,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-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua	2024-09-12 20:18:35 UTC (rev 72263)
@@ -24,8 +24,8 @@
 
 local ProvidesLuaModule = {
     name          = "tagpdf",
-    version       = "0.99d",       --TAGVERSION
-    date          = "2024-08-02", --TAGDATE
+    version       = "0.99e",       --TAGVERSION
+    date          = "2024-09-11", --TAGDATE
     description   = "tagpdf lua code",
     license       = "The LATEX Project Public License 1.3c"
 }

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty	2024-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty	2024-09-12 20:18:35 UTC (rev 72263)
@@ -28,8 +28,8 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf.dtx
-\ProvidesExplPackage {tagpdf} {2024-08-02} {0.99d}
-  { A package to experiment with pdf tagging }
+\ProvidesExplPackage {tagpdf} {2024-09-11} {0.99e}
+  { LaTeX kernel code for PDF tagging }
 
 \bool_if:nF
   {
@@ -65,30 +65,23 @@
 \ExecuteOptions{luamode}
 \ProcessOptions
 \RequirePackage{tagpdf-base}
-\cs_if_free:NT \pdf_object_new_indexed:nn
- {
-   \cs_generate_variant:Nn \pdf_object_new:n {e}
-   \cs_generate_variant:Nn \pdf_object_write:nnn {enn}
-   \cs_new_protected:Npn \pdf_object_new_indexed:nn #1 #2
-     {
-       \pdf_object_new:e {#1/\int_eval:n{#2}}
-     }
-   \cs_new_protected:Npn \pdf_object_write_indexed:nnnn #1 #2 #3 #4
-     {
-       \pdf_object_write:enn {#1/\int_eval:n{#2}}{#3}{#4}
-     }
-   \cs_generate_variant:Nn \pdf_object_write_indexed:nnnn {nnne}
-   \cs_new:Npn\pdf_object_ref_indexed:nn #1 #2
-     {
-       \pdf_object_ref:e {#1/\int_eval:n{#2}}
-     }
-   \cs_new:Npn \__kernel_pdf_object_id_indexed:nn #1 #2
-     {
-       \int_use:c
-         { c__pdf_object_ #1/\int_eval:n{#2} _int }
-     }
- }
-
+\AddToHook{package/latex-lab-testphase-new-or-2/after}
+  {
+    \cs_set_protected:Npn \__fnote_gput_ref:nn #1 #2 %#1 the structure number receiving the ref #2
+      {
+        \tag_struct_gput:nnn {#1}{ref_num}{#2}
+      }
+  }
+\AddToHook{package/latex-lab-testphase-toc/after}
+  {
+    \cs_set_protected:Npn \g__tag_struct_ref_by_dest:
+      {
+        \prop_map_inline:Nn\g__tag_struct_ref_by_dest_prop
+          {
+            \tag_struct_gput:nnn {##1}{ref_dest}{##2}
+          }
+      }
+  }
 \cs_new_protected:Npn \__tag_lastpagelabel:
   {
     \legacy_if:nT { @filesw }
@@ -110,6 +103,7 @@
   {\__tag_lastpagelabel:}
 \tl_new:N    \l__tag_tmpa_tl
 \tl_new:N    \l__tag_tmpb_tl
+\tl_new:N    \l__tag_Ref_tmpa_tl
 \tl_new:N    \l__tag_get_tmpc_tl
 \tl_new:N    \l__tag_get_parent_tmpa_tl
 \tl_new:N    \l__tag_get_parent_tmpb_tl
@@ -148,10 +142,6 @@
 \cs_generate_variant:Nn \seq_set_split:Nnn{Nne}  %**  unneeded
 \cs_generate_variant:Nn \str_set_convert:Nnnn {Nonn, Noon, Nnon }
 \cs_generate_variant:Nn \clist_map_inline:nn {on}
-    \cs_new_eq:NN \__tag_property_new:nnnn \property_new:nnnn
-    \cs_new_eq:NN \__tag_property_gset:nnnn \property_gset:nnnn
-    \cs_new_eq:NN \__tag_property_ref:nnn \property_ref:nnn
-    \cs_new_eq:NN \__tag_property_ref:nn \property_ref:nn
     \cs_new_protected:Npn \__tag_property_record:nn #1#2
       {
         \@bsphack
@@ -159,29 +149,29 @@
         \@esphack
       }
 
-\cs_generate_variant:Nn \__tag_property_ref:nnn {enn}
-\cs_generate_variant:Nn \__tag_property_ref:nn {en}
+\cs_generate_variant:Nn \property_ref:nnn {enn}
+\cs_generate_variant:Nn \property_ref:nn  {en}
 \cs_generate_variant:Nn \__tag_property_record:nn {en,eV}
 \cs_new:Npn \__tag_property_ref_lastpage:nn #1 #2
   {
-    \__tag_property_ref:nnn {@tag at LastPage}{#1}{#2}
+    \property_ref:nnn {@tag at LastPage}{#1}{#2}
   }
 
-\__tag_property_new:nnnn
+\property_new:nnnn
   { tagstruct } { now }
-  {0} { \int_use:N \c at g__tag_struct_abs_int }
-\__tag_property_new:nnnn  { tagstructobj } { now }  {}
+  {1} { \int_use:N \c at g__tag_struct_abs_int }
+\property_new:nnnn  { tagstructobj } { now }  {}
   {
      \pdf_object_ref_indexed:nn { __tag/struct } { \c at g__tag_struct_abs_int }
   }
-\__tag_property_new:nnnn
+\property_new:nnnn
   { tagabspage } { shipout }
   {0} { \int_use:N \g_shipout_readonly_int }
-\__tag_property_new:nnnn  { tagmcabs } { now }
+\property_new:nnnn  { tagmcabs } { now }
   {0} { \int_use:N \c at g__tag_MCID_abs_int }
 
 \flag_new:n { __tag/mcid }
-\__tag_property_new:nnnn  {tagmcid } { shipout }
+\property_new:nnnn  {tagmcid } { shipout }
    {0} { \flag_height:n { __tag/mcid } }
 
 
@@ -329,6 +319,11 @@
   { structure~with~label~#1~is~unknown~rerun}
 \msg_new:nnn { tag } {struct-show-closing}
   { closing~structure~#1~tagged~\use:e{\prop_item:cn{g__tag_struct_#1_prop}{S}} }
+\msg_new:nnn { tag } {struct-Ref-unknown}
+ {
+     #1~has~no~related~structure.\\
+    /Ref~not~updated.
+ }
 \msg_new:nnn { tag } {tree-struct-still-open}
   {
     There~are~still~open~structures~on~the~stack!\\
@@ -435,7 +430,7 @@
 \cs_new_protected:Npn \__tag_check_struct_used:n #1 %#1 label
   {
     \prop_get:cnNT
-      {g__tag_struct_\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{unknown}_prop}
+      {g__tag_struct_\property_ref:enn{tagpdfstruct-#1}{tagstruct}{unknown}_prop}
       {P}
       \l__tag_tmpa_tl
       {
@@ -568,7 +563,7 @@
           {
             \int_compare:nT
               {
-                \__tag_property_ref:enn
+                \property_ref:enn
                   {mcid-####1}
                   {tagabspage}
                   {-1}
@@ -579,7 +574,7 @@
                \seq_gput_right:Ne \l_tmpa_seq
                  {
                    Page##1-####1-
-                   \__tag_property_ref:enn
+                   \property_ref:enn
                      {mcid-####1}
                      {tagmcid}
                      {-1}
@@ -649,7 +644,7 @@
   {
     \__tag_check_if_active_struct:T
       {
-        \tl_set:Ne  \l__tag_tmpa_tl { \__tag_property_ref:nnn{tagpdf-#1}{tagmcabs}{} }
+        \tl_set:Ne  \l__tag_tmpa_tl { \property_ref:nnn{tagpdf-#1}{tagmcabs}{} }
         \tl_if_empty:NTF\l__tag_tmpa_tl
           {
             \msg_warning:nnn {tag} {mc-label-unknown} {#1}
@@ -759,30 +754,6 @@
       },
   }
 %% File: tagpdf.dtx
-\cs_if_free:NT \pdf_object_new_indexed:nn
- {
-   \cs_generate_variant:Nn \pdf_object_new:n {e}
-   \cs_generate_variant:Nn \pdf_object_write:nnn {enn}
-   \cs_new_protected:Npn \pdf_object_new_indexed:nn #1 #2
-     {
-       \pdf_object_new:e {#1/\int_eval:n{#2}}
-     }
-   \cs_new_protected:Npn \pdf_object_write_indexed:nnnn #1 #2 #3 #4
-     {
-       \pdf_object_write:enn {#1/\int_eval:n{#2}}{#3}{#4}
-     }
-   \cs_generate_variant:Nn \pdf_object_write_indexed:nnnn {nnne}
-   \cs_new:Npn\pdf_object_ref_indexed:nn #1 #2
-     {
-       \pdf_object_ref:e {#1/\int_eval:n{#2}}
-     }
-   \cs_new:Npn \__kernel_pdf_object_id_indexed:nn #1 #2
-     {
-       \int_use:c
-         { c__pdf_object_ #1/\int_eval:n{#2} _int }
-     }
- }
-
 \bool_if:NTF \g__tag_mode_lua_bool
   {
    \RequirePackage {tagpdf-mc-code-lua}
@@ -964,11 +935,11 @@
           {
             %mcid####1
             \int_compare:nT
-              {\__tag_property_ref:enn{mcid-####1}{tagabspage}{-1}=##1} %mcid is on current page
+              {\property_ref:enn{mcid-####1}{tagabspage}{-1}=##1} %mcid is on current page
               {% yes
                 \prop_put:Nee
                   \l__tag_tmpa_prop
-                  {\__tag_property_ref:enn{mcid-####1}{tagmcid}{-1}}
+                  {\property_ref:enn{mcid-####1}{tagmcid}{-1}}
                   {\prop_item:Nn \g__tag_mc_parenttree_prop {####1}}
               }
           }
@@ -1999,7 +1970,8 @@
 \tl_new:N \g__tag_struct_tag_NS_tl
 \tl_new:N \l__tag_struct_roletag_tl
 \tl_new:N \l__tag_struct_roletag_NS_tl
-\tl_new:N \l__tag_struct_key_label_tl
+\prop_new_linked:N \g__tag_struct_label_num_prop
+
 \bool_new:N \l__tag_struct_elem_stash_bool
 \prop_new_linked:N \g__tag_struct_ref_by_dest_prop
 \cs_new:Npn \__tag_struct_output_prop_aux:nn #1 #2 %#1 num, #2 key
@@ -2121,8 +2093,8 @@
       /Type \c_space_tl /MCR \c_space_tl
       /Pg
         \c_space_tl
-      \pdf_pageobject_ref:n { \__tag_property_ref:enn{mcid-#1}{tagabspage}{1} }
-       /MCID \c_space_tl \__tag_property_ref:enn{mcid-#1}{tagmcid}{1}
+      \pdf_pageobject_ref:n { \property_ref:enn{mcid-#1}{tagabspage}{1} }
+       /MCID \c_space_tl \property_ref:enn{mcid-#1}{tagmcid}{1}
      >>
   }
 \cs_new_protected:Npn \__tag_struct_kid_mc_gput_right:nn #1 #2 %#1 structure num, #2 MCID absnum%
@@ -2260,18 +2232,30 @@
     \tl_clear:N #2
     \prop_map_inline:cn { g__tag_struct_#1_prop }
       {
-        \tl_put_right:Ne #2
+        \cs_if_exist_use:cTF {__tag_struct_format_##1:nnN}
           {
-           \cs_if_exist_use:cTF {__tag_struct_format_##1:nn}
-             {{##1}{##2}}
-             {\c_space_tl/##1~##2}
+            {##1}{##2}#2
           }
+          {
+            \tl_put_right:Ne #2 { \c_space_tl/##1~##2 }
+          }
       }
   }
-\cs_new:Nn\__tag_struct_format_rolemap:nn{}
-\cs_new:Nn\__tag_struct_format_parentrole:nn{}
+\cs_new:Nn\__tag_struct_format_rolemap:nnN{}
+\cs_new:Nn\__tag_struct_format_parentrole:nnN{}
 
-\cs_new:Nn\__tag_struct_format_Ref:nn{\c_space_tl/#1~[#2]}
+\cs_new_protected:Nn\__tag_struct_format_Ref:nnN
+  {
+    \tl_put_right:Nn #3 { ~/#1~[ } %]
+    \clist_map_inline:nn{ #2 }
+     {
+       ##1 #3
+     }
+    \tl_put_right:Nn #3
+     { %[
+      \c_space_tl]
+     }
+  }
 \cs_new_protected:Npn \__tag_struct_write_obj:n #1 % #1 is the struct num
   {
     \prop_if_exist:cTF { g__tag_struct_#1_prop }
@@ -2327,7 +2311,7 @@
             #1 %
           }
           {
-            \pdf_pageobject_ref:n { \__tag_property_ref:nnn {@tag at objr@page@#2 }{ tagabspage }{1} }
+            \pdf_pageobject_ref:n { \property_ref:nnn {@tag at objr@page@#2 }{ tagabspage }{1} }
           }
         % add the parent obj number to the parent tree:
         \exp_args:Nne
@@ -2377,7 +2361,14 @@
 
 \keys_define:nn { __tag / struct }
   {
-    label .tl_set:N      = \l__tag_struct_key_label_tl,
+    label .code:n        =
+      {
+        \prop_gput:Nee\g__tag_struct_label_num_prop
+          {#1}{\int_use:N \c at g__tag_struct_abs_int}
+        \__tag_property_record:eV
+          {tagpdfstruct-#1}
+          \c__tag_property_struct_clist
+      },
     stash .bool_set:N    = \l__tag_struct_elem_stash_bool,
     parent .code:n       =
       {
@@ -2462,16 +2453,58 @@
           { Lang }
           { (#1) }
       },
+    }
+\cs_new_protected:Npn \__tag_struct_Ref_obj:nN #1 #2 %#1 a object reference
+  {
+    \tl_put_right:Ne#2
+      {
+        \c_space_tl#1
+      }
+  }
+
+\cs_new_protected:Npn \__tag_struct_Ref_label:nN #1 #2 %#1 a label
+  {
+    \prop_get:NnNTF \g__tag_struct_label_num_prop {#1} \l__tag_tmpb_tl
+      {
+        \tl_put_right:Ne#2
+          {
+            \c_space_tl\tag_struct_object_ref:e{ \l__tag_tmpb_tl }
+          }
+      }
+      {
+        \msg_warning:nnn {tag}{struct-Ref-unknown}{Label~'#1'}
+      }
+  }
+\cs_new_protected:Npn \__tag_struct_Ref_dest:nN #1 #2 %#1 a dest name
+  {
+    \prop_get:NnNTF \g__tag_struct_dest_num_prop {#1} \l__tag_tmpb_tl
+      {
+        \tl_put_right:Ne#2
+          {
+            \c_space_tl\tag_struct_object_ref:e{ \l__tag_tmpb_tl }
+          }
+      }
+      {
+        \msg_warning:nnn {tag}{struct-Ref-unknown}{Destination~'#1'}
+      }
+  }
+\cs_new_protected:Npn \__tag_struct_Ref_num:nN #1 #2 %#1 a structure number
+  {
+    \tl_put_right:Ne#2
+      {
+        \c_space_tl\tag_struct_object_ref:e{ #1 }
+      }
+  }
+
+\keys_define:nn { __tag / struct }
+  {
     ref .code:n        = % ref property
       {
-        \tl_clear:N\l__tag_tmpa_tl
         \clist_map_inline:on {#1}
           {
-            \tl_put_right:Ne \l__tag_tmpa_tl
-              {~\__tag_property_ref:en{tagpdfstruct-##1}{tagstructobj} }
+            \tag_struct_gput:nne
+              {\int_use:N \c at g__tag_struct_abs_int}{ref_label}{ ##1 }
           }
-        \__tag_struct_gput_data_ref:ee
-         { \int_use:N \c at g__tag_struct_abs_int } {\l__tag_tmpa_tl}
       },
     E .code:n        = % E property
       {
@@ -2654,13 +2687,6 @@
            \g__tag_struct_tag_tl
            \g__tag_struct_tag_NS_tl
         \__tag_check_structure_has_tag:n { \int_use:N \c at g__tag_struct_abs_int }
-        \tl_if_empty:NF
-          \l__tag_struct_key_label_tl
-          {
-            \__tag_property_record:eV
-             {tagpdfstruct-\l__tag_struct_key_label_tl}
-             \c__tag_property_struct_clist
-          }
         \int_compare:nNnT { \l__tag_struct_stack_parent_tmpa_tl } = { -1 }
           {
             \seq_get:NNF
@@ -2814,22 +2840,22 @@
     \__tag_check_if_active_struct:T
       {
         \prop_if_exist:cTF
-          { g__tag_struct_\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{unknown}_prop } %
+          { g__tag_struct_\property_ref:enn{tagpdfstruct-#1}{tagstruct}{unknown}_prop } %
           {
             \__tag_check_struct_used:n {#1}
             %add the label structure as kid to the current structure (can be the root)
             \__tag_struct_kid_struct_gput_right:ee
               { \g__tag_struct_stack_current_tl }
-              { \__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1} }
+              { \property_ref:enn{tagpdfstruct-#1}{tagstruct}{1} }
             %add the current structure to the labeled one as parents
             \__tag_prop_gput:cne
-              { g__tag_struct_\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}_prop }
+              { g__tag_struct_\property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}_prop }
               { P }
               {
                 \pdf_object_ref_indexed:nn { __tag/struct } { \g__tag_struct_stack_current_tl }
               }
              \__tag_struct_get_parentrole:eNN
-              {\__tag_property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}}
+              {\property_ref:enn{tagpdfstruct-#1}{tagstruct}{1}}
               \l__tag_tmpa_tl
               \l__tag_tmpb_tl
             \__tag_check_parent_child:VVVVN
@@ -2914,7 +2940,7 @@
    \pdf_object_ref_indexed:nn {__tag/struct}{ #1 }
  }
 \cs_generate_variant:Nn \tag_struct_object_ref:n {e}
-\cs_new_protected:Npn \tag_struct_gput:nnn #1 #2 #3
+\cs_set_protected:Npn \tag_struct_gput:nnn #1 #2 #3
  {
    \cs_if_exist_use:cF {__tag_struct_gput_data_#2:nn}
     { %warning??
@@ -2923,19 +2949,44 @@
     {#1}{#3}
  }
 \cs_generate_variant:Nn \tag_struct_gput:nnn {ene,nne}
-\cs_new_protected:Npn \__tag_struct_gput_data_ref:nn #1 #2
-  % #1 receiving struct num, #2 list of object ref
+\cs_new_protected:Npn \__tag_struct_gput_data_ref_aux:nnn #1 #2 #3
+  % #1 receiving struct num, #2 key word #3 value
    {
-     \prop_get:cnN
-        { g__tag_struct_#1_prop }
-        {Ref}
-        \l__tag_get_tmpc_tl
-     \__tag_struct_prop_gput:nne
-        { #1 }
-        { Ref }
-        { \quark_if_no_value:NF\l__tag_get_tmpc_tl { \l__tag_get_tmpc_tl\c_space_tl }#2 }
+     \prop_get:cnNTF
+       { g__tag_struct_#1_prop }
+       {Ref}
+       \l__tag_get_tmpc_tl
+       {
+         \tl_put_right:No \l__tag_get_tmpc_tl
+           {\cs:w __tag_struct_Ref_#2:nN \cs_end: {#3},}
+       }
+       {
+         \tl_set:No \l__tag_get_tmpc_tl
+           {\cs:w __tag_struct_Ref_#2:nN \cs_end: {#3},}
+       }
+       \__tag_struct_prop_gput:nno
+         { #1 }
+         { Ref }
+         { \l__tag_get_tmpc_tl }
     }
-\cs_generate_variant:Nn \__tag_struct_gput_data_ref:nn {ee}
+\cs_new_protected:Npn \__tag_struct_gput_data_ref:nn #1 #2
+  {
+    \__tag_struct_gput_data_ref_aux:nnn {#1}{obj}{#2}
+  }
+\cs_new_protected:Npn \__tag_struct_gput_data_ref_label:nn #1 #2
+  {
+    \__tag_struct_gput_data_ref_aux:nnn {#1}{label}{#2}
+  }
+\cs_new_protected:Npn \__tag_struct_gput_data_ref_dest:nn #1 #2
+  {
+    \__tag_struct_gput_data_ref_aux:nnn {#1}{dest}{#2}
+  }
+\cs_new_protected:Npn \__tag_struct_gput_data_ref_num:nn #1 #2
+  {
+    \__tag_struct_gput_data_ref_aux:nnn {#1}{num}{#2}
+  }
+
+\cs_generate_variant:Nn \__tag_struct_gput_data_ref:nn {ee,no}
 \cs_new_protected:Npn \tag_struct_insert_annot:nn #1 #2 %#1 should be an object reference
                                                         %#2 struct parent num
   {
@@ -3057,6 +3108,7 @@
     },
   }
 %% File: tagpdf-space.dtx
+\bool_new:N\l__tag_showspaces_bool
 \keys_define:nn { __tag / setup }
   {
     activate/spaces .choice:,

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty	2024-09-12 20:18:21 UTC (rev 72262)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty	2024-09-12 20:18:35 UTC (rev 72263)
@@ -1,5 +1,5 @@
 %\RequirePackage[enable-debug]{expl3}[2018/06/14]
-\ProvidesExplPackage {tagpdfdocu-patches} {2024-08-02} {0.99d}
+\ProvidesExplPackage {tagpdfdocu-patches} {2024-09-11} {0.99e}
  {patches/commands for the tagpdf documentation}
 \RequirePackage{etoolbox,xpatch}
 



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