texlive[65341] Master/texmf-dist: tagpdf (23dec22)

commits+karl at tug.org commits+karl at tug.org
Fri Dec 23 22:05:03 CET 2022


Revision: 65341
          http://tug.org/svn/texlive?view=revision&revision=65341
Author:   karl
Date:     2022-12-23 22:05:03 +0100 (Fri, 23 Dec 2022)
Log Message:
-----------
tagpdf (23dec22)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/tagpdf/README.md
    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-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/source/latex/tagpdf/tagpdf.ins
    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.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.lua
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf-parent-child-2.csv
    trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf-parent-child.csv
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-data.dtx
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-inline.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

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tagpdf/README.md	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/doc/latex/tagpdf/README.md	2022-12-23 21:05:03 UTC (rev 65341)
@@ -1,6 +1,6 @@
 #tagpdf — A package to create tagged pdf
-Packageversion: 0.97 
-Packagedate: 2022/08/24
+Packageversion: 0.98 
+Packagedate: 2022/12/22
 Author: Ulrike Fischer
 
 ## License

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

Added: trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf-parent-child-2.csv
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf-parent-child-2.csv	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf-parent-child-2.csv	2022-12-23 21:05:03 UTC (rev 65341)
@@ -0,0 +1,81 @@
+%%
+%% This is file `tagpdf-parent-child-2.csv',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% tagpdf-data.dtx  (with options: `parent-child-2')
+%% 
+%% Copyright (C) 2019-2022 Ulrike Fischer
+%% 
+%% It may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License (LPPL), either version 1.3c of
+%% this license or (at your option) any later version.  The latest
+%% version of this license is in the file:
+%% 
+%%    https://www.latex-project.org/lppl.txt
+%% 
+%% This file is part of the "tagpdf bundle" (The Work in LPPL)
+%% and all files in that bundle must be distributed together.
+%% 
+%% File: tagpdf-data.dtx
+%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2022-12-22} {0.98}
+,,,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,∅
+Art,1.7,grouping,∅,0..n,0..n,∅,‡,‡,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,0..n,∅,∅,∅,0..n,∅
+Part,both,grouping,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅,0..n,∅,∅,∅,∅,0..n,∅,∅,∅,∅*,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Div,both,grouping,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,∅,0..n,∅,∅,∅,∅,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,0..n,∅,0..n,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Sect,both,grouping,∅,0..n,0..n,0..n,‡,‡,0..n,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,0..n,∅,∅,∅,0..n,∅
+Aside,2.0,grouping,∅,0..n,0..n,0..n,‡,‡,0..n,∅,∅,‡,∅,∅,∅,0..n,0..n,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+BlockQuote,1.7,grouping?,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,∅,0..n,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+NonStruct,both,grouping,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,∅
+TOC,1.7,grouping,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,0..n,0..n,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+TOCI,1.7,TOC,∅,∅,∅,∅,‡,‡,∅,∅,∅,‡,0..n,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+Index,1.7,grouping?,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,∅,0..n,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Private,1.7,grouping,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,∅
+P,both,block,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,0..n,0..n,0..n,0..n,∅,∅,0..n,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Hn,both,block,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+H,both,block,∅,0..1,0..1,0..1,‡,‡,0..1,0..1,0..1,‡,∅,∅,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..1,∅,∅,0..1,0..1,∅,∅,∅,0..1,0..1,0..1,∅,∅,0..1,∅
+Title,2.0,grouping!block,∅,0..n,0..n,0..n,‡,‡,0..n,∅,0..n,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+Sub,2.0,inline,∅,∅,∅,∅,‡,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,0..n,∅*,0..n,∅,∅,0..n,∅
+Quote,1.7,inline,∅,∅,∅,∅,‡,‡,∅,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Note,1.7,inline,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Reference,1.7,inline,∅,∅,∅,∅,‡,‡,∅,0..n,0..n,‡,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅*,∅*,∅,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+BibEntry,1.7,inline,∅,∅,∅,∅,‡,‡,∅,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Lbl,both,inline,∅,∅,∅,0..n,‡,‡,0..n,0..n,0..n,‡,∅,0..n,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,0..n,∅,0..n,∅,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Code,1.7,inline,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,∅*,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Em,2.0,inline,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Strong,2.0,inline,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Span,both,inline,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Link,both,grouping!block!inline,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Annot,both,grouping!block!inline,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Form,both,grouping!block!inline,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅*,∅*,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Ruby,both,inline,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+RB,both,inline,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,[a],∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+RT,both,inline,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,[a],∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+RP,both,inline,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,[a],∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+Warichu,both,inline,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+WT,both,inline,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,[b],∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+WP,both,inline,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,[b],∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+FENote,2.0,grouping!block!inline,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+L,both,block!inline,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,0..n,0..n,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+LI,both,in L,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+LBody,both,in LI,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+Table,both,block,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+TR,both,Table,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,∅,∅,∅,0..n,∅
+TH,both,Table,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+TD,both,Table,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+THead,both,Table,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..1,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+TBody,both,Table,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+TFoot,both,Table,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..1,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+Caption,both,grouping!block,∅,∅,∅,0..n,‡,‡,0..n,0..1,0..1,‡,0..1,0..1,0..n,0..n,0..1,∅,∅,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,0..1,∅,∅,∅,∅,∅,∅,∅,∅*,0..1,∅,0..1,0..1,∅,∅,∅,∅,∅,∅,∅,0..1,0..1,∅,∅,0..n,∅
+Figure,both,grouping!block!inline,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,∅*,∅,∅,∅,∅,∅,∅,c,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Formula,both,grouping!block!inline,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,∅*,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Artifact,2.0,grouping!block!inline,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,∅
+math,2.0,?,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅
+mathml,2.0,?,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,0..n,0..n,∅
+MC,both,---,∅,∅,∅,∅,∅,∅,∅,0..n,0..n,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,‡,‡,‡,0..n,‡,‡,0..n,∅,0..n,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,∅
+%% 
+%%
+%% End of file `tagpdf-parent-child-2.csv'.


Property changes on: trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf-parent-child-2.csv
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf-parent-child.csv
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf-parent-child.csv	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf-parent-child.csv	2022-12-23 21:05:03 UTC (rev 65341)
@@ -0,0 +1,71 @@
+%%
+%% This is file `tagpdf-parent-child.csv',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% tagpdf-data.dtx  (with options: `parent-child')
+%% 
+%% Copyright (C) 2019-2022 Ulrike Fischer
+%% 
+%% It may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License (LPPL), either version 1.3c of
+%% this license or (at your option) any later version.  The latest
+%% version of this license is in the file:
+%% 
+%%    https://www.latex-project.org/lppl.txt
+%% 
+%% This file is part of the "tagpdf bundle" (The Work in LPPL)
+%% and all files in that bundle must be distributed together.
+%% 
+%% File: tagpdf-data.dtx
+%% \ProvidesExplFile {tagpdf-parent-child.csv} {2022-12-22} {0.98}
+,,,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,∅,∅
+Part,both,grouping,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,0..n,0..n,∅,0..n,∅,0..n,∅,∅,∅,∅,0..n,∅,∅*,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,0..n,0..n,0..n,∅
+Div,both,grouping,∅,0..n,0..n,‡,‡,0..n,0..n,‡,0..n,0..n,0..n,0..n,∅,0..n,∅,0..n,∅,∅,∅,∅,0..n,∅,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,0..n,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Sect,both,grouping,∅,0..n,0..n,‡,‡,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,∅,∅
+BlockQuote,1.7,grouping?,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,∅,0..n,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,0..n,0..n,0..n,∅
+NonStruct,both,grouping,∅,0..n,0..n,‡,‡,0..n,0..n,‡,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅
+TOC,1.7,grouping,∅,0..n,0..n,‡,‡,0..n,0..n,‡,0..n,0..n,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+TOCI,1.7,TOC,∅,∅,∅,‡,‡,∅,∅,‡,0..n,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+Index,1.7,grouping?,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,∅,0..n,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Private,1.7,grouping,∅,0..n,0..n,‡,‡,0..n,0..n,‡,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅
+P,both,block,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,0..n,0..n,0..n,∅,0..n,∅,0..n,∅,∅,∅,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Hn,both,block,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+H,both,block,∅,0..1,0..1,‡,‡,0..1,0..1,‡,∅,∅,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..1,∅,∅,0..1,0..1,∅,∅,∅,0..1,0..1,0..1,∅
+Quote,1.7,inline,∅,∅,∅,‡,‡,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Note,1.7,inline,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Reference,1.7,inline,∅,∅,∅,‡,‡,∅,0..n,‡,∅,0..n,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅*,∅*,∅,0..n,0..n,0..n,∅,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+BibEntry,1.7,inline,∅,∅,∅,‡,‡,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Lbl,both,inline,∅,∅,0..n,‡,‡,0..n,0..n,‡,∅,0..n,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Code,1.7,inline,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Span,both,inline,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Link,both,grouping!block!inline,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Annot,both,grouping!block!inline,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Form,both,grouping!block!inline,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,∅*,∅*,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Ruby,both,inline,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+RB,both,inline,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,[a],∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+RT,both,inline,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,[a],∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+RP,both,inline,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,[a],∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+Warichu,both,inline,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+WT,both,inline,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,[b],∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+WP,both,inline,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,[b],∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+L,both,block!inline,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,0..n,0..n,∅,0..n,∅,∅,0..n,∅,∅,∅,∅,∅,∅*,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,0..n,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+LI,both,in L,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+LBody,both,in LI,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+Table,both,block,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,0..n,0..n,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+TR,both,Table,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,∅,∅
+TH,both,Table,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅
+TD,both,Table,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅
+THead,both,Table,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..1,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+TBody,both,Table,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+TFoot,both,Table,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..1,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+Caption,both,grouping!block,∅,∅,0..n,‡,‡,0..n,0..1,‡,0..1,0..1,0..n,0..n,∅,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,0..1,∅,∅,∅,∅,∅,∅,∅,0..1,∅,0..1,0..1,∅,∅,∅,∅,∅,∅,∅,0..1,0..1,∅
+Figure,both,grouping!block!inline,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅*,∅,∅,∅,∅,∅,∅,c,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Formula,both,grouping!block!inline,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+MC,both,---,∅,∅,∅,∅,∅,∅,0..n,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,‡,‡,‡,0..n,‡,‡,∅,0..n,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+%% 
+%%
+%% End of file `tagpdf-parent-child.csv'.


Property changes on: trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf-parent-child.csv
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
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	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf.tex	2022-12-23 21:05:03 UTC (rev 65341)
@@ -1,15 +1,15 @@
 % !Mode:: "TeX:DE:UTF-8:Main"
-%\PassOptionsToPackage{check-declarations,enable-debug}{expl3}
+\PassOptionsToPackage{check-declarations,enable-debug}{expl3}
 %\RequirePackage{pdfmanagement-testphase}
-\DocumentMetadata{pdfversion=2.0,lang=en-UK,testphase=phase-II}
+\DocumentMetadata{pdfversion=2.0,lang=en-UK,testphase=phase-II,testphase=toc-tagging,testphase=sec-tagging,pdfstandard=a-2b}
 
 \makeatletter
-\def\UlrikeFischer at package@version{0.97}
-\def\UlrikeFischer at package@date{2022-08-24}
+\def\UlrikeFischer at package@version{0.98}
+\def\UlrikeFischer at package@date{2022-12-22}
 \makeatother
 
-\documentclass[DIV=12,parskip=half-,bibliography=totoc]{scrartcl}
-
+\documentclass[DIV=12,parskip=half-,bibliography=totoc,a4paper]{article}
+\usepackage{geometry}
 \usepackage[english]{babel}
 
 \usepackage{unicode-math}
@@ -20,7 +20,7 @@
 %\patchcmd{\MT at get@prot}{\noindent}{\RawNoindent}{}{\fail}
 \makeatother
 
-\usepackage{scrlayer-scrpage}
+%\usepackage{scrlayer-scrpage}
 
 \usepackage[autostyle]{csquotes}
 \usepackage[style=numeric,hyperref=false]{biblatex}
@@ -41,7 +41,7 @@
 \tikzset{operator/.style = {font=\footnotesize\ttfamily, anchor=base,draw, rounded corners,node distance=4mm and 4mm}}
 
 
-\usepackage{enumitem,xpatch}
+\usepackage{enumitem}
 
 \usepackage{listings}
 \lstset{basicstyle=\ttfamily, columns=fullflexible,language=[LaTeX]TeX,
@@ -56,7 +56,6 @@
  %show-spaces
  }
 
-\usepackage{hyperxmp}
 \usepackage[pdfdisplaydoctitle=true,%hyperfootnotes=false,
             ]{hyperref}
 
@@ -63,8 +62,6 @@
  \hypersetup{
   pdftitle={The tagpdf package, v\csname UlrikeFischer at package@version\endcsname},
   pdfauthor=Ulrike Fischer,
-  pdfaconformance=a,
-  pdfuapart=1,
   colorlinks}
 
 \tcbuselibrary{documentation}
@@ -79,7 +76,7 @@
 \usepackage{tagpdfdocu-patches}
 
 
-\cfoot*{\pagemark}
+%\cfoot*{\pagemark}
 
 %
 
@@ -89,8 +86,6 @@
 \date{\csname UlrikeFischer at package@date\endcsname}
 \author{Ulrike Fischer\thanks{fischer at troubleshooting-tex.de}}
 
-\tagpdfsetup{paratagging,paratagging-show}
-
 \usepackage{shortvrb}
 \MakeShortVerb|
 
@@ -97,20 +92,15 @@
 \begin{document}
 
 \tagstructbegin{tag=Title}
-\tagmcbegin{tag=Title}
-
-\begin{center}%\let\thanks\par
+\begin{center}%
+\let\thanks\footnote
 \makeatletter
-  \usekomafont{title}{\huge \@title \par}
-
-  \vskip .5em
-  \usekomafont{author}{\@author \par}
-
-  \vskip 1em%
-  \usekomafont{date}{\@date \par}%
-
+\huge \@title \par
+\vskip .5em
+\@author \par
+\vskip 1em%
+\@date \par
 \end{center}%
- \tagmcend
 \tagstructend
 
 
@@ -147,9 +137,13 @@
 \tagstructend
 
 
+\tagtool{sec-add-grouping=false}
+
 \tableofcontents
 
+\tagtool{sec-add-grouping}
 
+
 \section{Introduction}
 
 Since many years the creation of accessible \PDF{}-files with \LaTeX\ which conform to the PDF/UA standard has been on the agenda of \TeX-meetings. Many people agree that this is important and Ross Moore has done quite some work on it. There is also a TUG-mailing list and a webpage \parencite{tugaccess} dedicated to this theme.
@@ -250,7 +244,7 @@
 To make the package usable examples are needed: examples that demonstrate how various structures can be tagged and which patches are needed, examples for the test suite, examples that demonstrates problems.
 
 
-\begin{tcolorbox}[before upper=\tagpdfparaOn]
+\begin{tcolorbox}
 Feedback, contribuations and corrections are welcome!
 \end{tcolorbox}
 
@@ -299,7 +293,7 @@
 \item \textbf{Breaking change!} The argument of \texttt{newattribute} option should no longer add the dictionary bracket \verb+<<..>>+, they are added by the code.
 
 
-\item \textbf{Breaking change!} The package now requires the new PDF management as provided for now by the package \texttt{pdfmanagement-testphase}. \texttt{pdfmanagement-testphase},
+\item \textbf{Breaking change!} The package now requires the new PDF management as provided for now by the package \pkg{pdfmanagement-testphase}. \pkg{pdfmanagement-testphase},
 prepares the ground for better support for tagged PDF in \LaTeX{}.
 It is part of a larger project to automatically generate tagged PDF \url{https://www.latex-project.org/news/2020/11/30/tagged-pdf-FS-study/}
 
@@ -348,7 +342,8 @@
 
 \item \textbf{More engines supported} The generic mode of \pkg{tagpdf} now works
 (theoretically, it is not much tested) with all engines supported
-by the pdfmanagement. So compilations with Xe\LaTeX{} or with dvips should work. But it should be noted that
+by the \PDF\ management. 
+So compilations with Xe\LaTeX{} or with dvips should work. But it should be noted that
 these engines and backends don't support the |interspaceword| option. With Xe\LaTeX{} it is perhaps possible
 implement something with |\XeTeXinterchartoks|, but for the dvips route I don't see an option (apart from lots
 of manual macros everywhere).
@@ -439,11 +434,34 @@
 \item Small bug fixes.
 \end{itemize}
 
+\subsection{Changes in version 0.98}
+
+\begin{itemize}
+\item The declarations of tag namespaces have been externalized and are now
+read from files when \pkg{tagpdf} is loaded. 
+
+\item The \PDF{} format (and some of the standards) declare various parent-child rules for
+structure tags. A first step to implement this rules and check if they are fullfilled have
+been done. More information can be found in section~\ref{sec:parent-child}.
+
+\item As a side effect of the new rule checking, the requirements for new tags
+ have been tightened: Adding a new tag with add-new-tag now requires that the target role is 
+    defined. Unknown roles error. 
+    
+\item |\tagmcbegin| no longer requires that a tag is set, instead if will pick up
+the tag name from the surrounding structure. 
+
+\item Structure destination are now created also with \PDF \textless\,2.0. They shouldn't harm and
+can improve the html export.
+
+\end{itemize}
+
+
 \subsection{Proof of concept: the tagging of the documentation itself}
 
 Starting with version 0.6 the documentation itself has been tagged. The tagging wasn't (and isn't) in no way perfect. The validator from Adobe didn't complain, but PAX3 wanted alternative text for all links (no idea why) and so I put everywhere simple text like \enquote{link} and \enquote{ref}. The links to footnotes gave warnings, so I disabled them. I used types from the \PDF{} version 1.7, mostly as I have no idea what should be used for code in 2.0. Margin notes were simply wrong \ldots
 
-The tagging has been improved and automated over time in sync with improvements and new features in the LaTeX kernel and the pdfmanagement code.
+The tagging has been improved and automated over time in sync with improvements and new features in the LaTeX kernel and the \PDF\ management code.
 
 But even if the documentation passed the tests of the validators:  as mentioned above passing a formal test doesn't mean that the content is really good and usable. I have a lot doubts that the code parts are really readable. The bibliography and the references must be improved. The user commands used for the tagging and also some of the patches used are still rather crude. So there is lot space for improvement.
 
@@ -467,11 +485,16 @@
 the \texttt{testphase} key is documented in \texttt{documentmetadata-support-doc.pdf} which
 is part of the \texttt{latex-lab} bundle.
 
+Various parts of the code differentiate between \PDF{} version 2.0 and lower versions. If 
+\PDF{} 2.0 is wanted it is required to set the version early in the \cs{DocumentMetadata}
+command so that \pkg{tagpdf} can pick up the correct code path. 
+
 \begin{lstlisting}
 \DocumentMetadata
  {
   % testphase = phase-I, % tagging without paragraph tagging
   testphase = phase-II % tagging with paragraph tagging and other new stuff.
+  % pdfversion = 2.0   % pdfversion must be set here.
  }
 \documentclass{article}
 \begin{document}
@@ -481,11 +504,12 @@
 
 \minisec{Activation needed!}
 
-The package can also be loaded normally with |\usepackage| (but it is
-still required to use \cs{DocumentMetadata} to load the pdfmanagement) but
+It is not recommended anymore, but 
+the package can also be loaded normally with |\usepackage| (but it is
+still required to use \cs{DocumentMetadata} to load the \PDF\ management) but
 it will then -- apart from loading more packages and defining a lot of things -- not do much. You will have to \emph{activate} it with \verb+\tagpdfsetup+.
 
-The pdfmanagement loaded with \cs{DocumentMetadata} will in any case load \texttt{tagpdf-base} a
+The \PDF\ management loaded with \cs{DocumentMetadata} will in any case load \texttt{tagpdf-base} a
 small package that provides no-op versions of the main tagging commands.
 
 Most commands do nothing if tagging is not activated, but in case a test is needed a command (with the usual p,T,F variants) is provided:
@@ -500,7 +524,7 @@
 %TODO think about tagging of the keys. Aside? Header?
 
 
-The package has two different modes: The \textbf{generic mode} works (in theory, currently only tested with pdftex and luatex) probably with all engines, the \textbf{lua mode} only with luatex. The differences between both modes  will be described later. The mode can be set with package options:
+The package has two different modes: The \textbf{generic mode} works (in theory, currently only fully tested with pdflatex) probably with all engines, the \textbf{lua mode} only with lualatex. The differences between both modes  will be described later. The mode can be set with package options:
 
 \DescribeKey{luamode}
 
@@ -594,29 +618,59 @@
 \end{lstlisting}
 
 
-From this stream one can extract the characters and their placement on the page but not their semantic meaning  (the first line is actually a section heading, the last the page number). And while in the example the order is correct there is actually no guaranty that the stream contains the text in the order it should be read.
+From this stream one can extract the characters and their placement on the page 
+but not their semantic meaning  (the first line is actually a section heading, 
+the last the page number). And while in the example the order is correct 
+there is actually no guaranty that the stream contains the text in the order 
+it should be read.
 
-Tagging means to enrich the \PDF{} with information about the \emph{semantic} meaning and the \emph{reading order}. (Tagging can do more, one can also store all sorts of layout information like font properties and indentation with tags. But as I already wrote this package concentrates on the part of tagging that is needed to improve accessibility.)
+Tagging means to enrich the \PDF{} with information about the \emph{semantic} 
+meaning and the \emph{reading order}. (Tagging can do more, one can also 
+store all sorts of layout information like font properties and indentation 
+with tags. But as I already wrote this package concentrates on the part of 
+tagging that is needed to improve accessibility.)
 
 
-
-
 \subsection{Three tasks}
 
 
-
 To tag a \PDF{} three tasks must be  carried out:
 
 \begin{enumerate}
 \item
- \textbf{The mark-content-task}:\sidenote{mc-task} The document must add \enquote{labels} to the page stream which allows to identify and reference the various chunks of text and other content.  This is the most difficult part of tagging -- both for the document writer but also for the package code. At first there can be quite many chunks as every one is a leaf node of the structure and so often a rather small unit.  At second the chunks must be defined page-wise -- and this is not easy when you don't know where the page breaks are. Also in a standard document a lot text is created automatically, e.g. the toc, references, citations, list numbers etc and it is not always easy to mark them correctly.
+ \textbf{The mark-content-task}:\sidenote{mc-task} The document must add 
+ \enquote{labels} to the page stream which allows to identify and reference 
+ the various chunks of text and other content.  
+ This is the most difficult part of tagging -- both for the document writer 
+ but also for the package code. At first there can be quite many 
+ chunks as every one is a leaf node of the structure and so often a rather 
+ small unit.  At second the chunks must be defined page-wise -- and 
+ this is not easy when you don't know where the page breaks are. 
+ Also in a standard document a lot text is created automatically, e.g. 
+ the toc, references, citations, list numbers etc and it is not always 
+ easy to mark them correctly.
 
-\item
-  \textbf{The structure-task}:\sidenote{struct-task}  The document must declare the structure. This means marking the start and end of semantically connected portions of the document (correctly nested as a tree). This too means some work for the document writer, but less than for the mc-task: at first quite often the mc-task and the structure-task can be combined, e.g. when you mark up a list number or a tabular cell or a section header; at second one doesn't have to worry about page breaks so quite often one can patch standard environments to declare the structure. On the other side a number of structures end in \LaTeX\ only implicitly -- e.g. an item ends at the next item, so getting the \PDF{} structure right still means that additional mark up must be added.
+\item \textbf{The structure-task}:\sidenote{struct-task}  The document must 
+    declare the structure. This means marking the start and end of 
+    semantically connected portions of the document (correctly nested as a 
+    tree). This too means some work for the document writer, but less than 
+    for the mc-task: at first quite often the mc-task and the 
+    structure-task can be combined, e.g. when you mark up a list number or 
+    a tabular cell or a section header; at second one doesn't have to worry 
+    about page breaks so quite often one can patch standard environments to 
+    declare the structure. On the other side a number of structures end in 
+    \LaTeX\ only implicitly -- e.g. an item ends at the next item, so 
+    getting the \PDF{} structure right still means that additional mark up 
+    must be added. 
 
 
-\item
- \textbf{The tree management}:\sidenote{tree-task} At last the structure must be written into the \PDF{}. For every structure an object of type \texttt{StructElem} must be  created and flushed with keys for the parents and the kids. A parenttree must be created to get a reference from the mc-chunks to the parent structure. A rolemap must be written. And a number of dictionary entries. All this is hopefully done automatically and correctly by the package \ldots.
+\item \textbf{The tree management}:\sidenote{tree-task} At last the 
+    structure must be written into the \PDF{}. For every structure an 
+    object of type \texttt{StructElem} must be  created and flushed with 
+    keys for the parents and the kids. A parenttree must be created to get 
+    a reference from the mc-chunks to the parent structure. A rolemap must 
+    be written. And a number of dictionary entries. All this is hopefully 
+    done automatically and correctly by the package \ldots. 
 
 \end{enumerate}
 
@@ -679,9 +733,9 @@
 
 \end{tcolorbox}
 
-\tagstructbegin{tag=Caption}\tagmcbegin{tag=Caption}
-\caption{Schematical description of the relation between marked content in the page stream and the structure}
-\tagmcend\tagstructend
+\tagstructbegin{tag=Caption}\tagmcbegin{tag=Caption} \caption{Schematical 
+description of the relation between marked content in the page stream and the 
+structure} \tagmcend\tagstructend 
 
 \end{figure}
 
@@ -692,10 +746,18 @@
 
 
 
-To be able to refer to parts of the text in the structure, the text in the page stream must get \enquote{labels}. In the \PDF{} reference they are called \enquote{marked content}. The three main variants needed here are:
+To be able to refer to parts of the text in the structure, the text in the 
+page stream must get \enquote{labels}. In the \PDF{} reference they are 
+called \enquote{marked content}. The three main variants needed here are: 
 
 \begin{description}
-\item[Artifacts] They are marked with of a pair of keywords, \texttt{BMC} and \texttt{EMC} which surrounds the text. \texttt{BMC} has a single prefix argument, the fix tag name \texttt{/Artifact}. Artifacts should be used for irrelevant text and page content that should be ignored in the structure. Sadly it is often not possible to leave such text simply unmarked -- the accessibility tests in Acrobat and other validators complain.
+\item[Artifacts] They are marked with of a pair of keywords, \texttt{BMC} 
+    and \texttt{EMC} which surrounds the text. \texttt{BMC} has a single 
+    prefix argument, the fix tag name \texttt{/Artifact}. Artifacts should 
+    be used for irrelevant text and page content that should be ignored in 
+    the structure. Sadly it is often not possible to leave such text simply 
+    unmarked -- the accessibility tests in Acrobat and other validators 
+    complain. 
 
 
 \begin{lstlisting}
@@ -708,8 +770,11 @@
 
 
 
-\item[Artifacts with a type]
-They are marked with of a pair of keywords, \texttt{BDC} and \texttt{EMC} which surrounds the text. \texttt{BDC} has two arguments: again the tag name \texttt{/Artifact} and a following dictionary which allows to specify the suppressed info. Text in header and footer can e.g. be declared as pagination like this:
+\item[Artifacts with a type] They are marked with of a pair of keywords, 
+    \texttt{BDC} and \texttt{EMC} which surrounds the text. \texttt{BDC} 
+    has two arguments: again the tag name \texttt{/Artifact} and a 
+    following dictionary which allows to specify the suppressed info. Text 
+    in header and footer can e.g. be declared as pagination like this: 
 
 
 \begin{lstlisting}
@@ -721,10 +786,19 @@
 
 
 
-\item[Content]  Content is marked also with of a pair of keywords, \texttt{BDC} and \texttt{EMC}. The first argument of \texttt{BDC} is a tag name which describes the structural type of the text\footnote{There is quite some redundancy in the specification here. The structural type is also set in the structure tree. One wonders if it isn't enough to use  always \texttt{/SPAN} here.}
-    Examples are \texttt{/P} (paragraph), \texttt{/H2} (heading), \texttt{/TD} (table cell). The reference mentions a number of standard types but it is possible to add more or to use different names.
+\item[Content]  Content is marked also with of a pair of keywords, 
+    \texttt{BDC} and \texttt{EMC}. The first argument of \texttt{BDC} is a 
+    tag name which describes the structural type of the text\footnote{There 
+    is quite some redundancy in the specification here. The structural type 
+    is also set in the structure tree. One wonders if it isn't enough to 
+    use  always \texttt{/SPAN} here.} Examples are \texttt{/P} (paragraph), 
+    \texttt{/H2} (heading), \texttt{/TD} (table cell). The reference 
+    mentions a number of standard types but it is possible to add more or 
+    to use different names. 
 
-In the second argument of \texttt{BDC} -- in the property dictionary -- more data can be stored. \emph{Required} is an \texttt{/MCID}-key which takes an integer as a value:
+In the second argument of \texttt{BDC} -- in the property dictionary -- more 
+data can be stored. \emph{Required} is an \texttt{/MCID}-key which takes an 
+integer as a value: 
 
 
 \begin{lstlisting}
@@ -734,10 +808,15 @@
 \end{lstlisting}
 
 
-This integer is used to identify the chunk when building the structure tree. The chunks are numbered by page starting with 0. As the numbers are also used as an index in an array they shouldn't be \enquote{holes} in the numbering system
-(It is perhaps possible to handle a numbering scheme not starting by 0 and having holes, but it will enlarge the \PDF{} as one would need dummy objects.).
+This integer is used to identify the chunk when building the structure 
+tree. The chunks are numbered by page starting with 0. As the numbers are 
+also used as an index in an array they shouldn't be \enquote{holes} in the 
+numbering system (It is perhaps possible to handle a numbering scheme not 
+starting by 0 and having holes, but it will enlarge the \PDF{} as one would 
+need dummy objects.). 
 
-It is possible to add more entries to the property dictionary, e.g. a title, alternative text or a local language setting.
+It is possible to add more entries to the property dictionary, e.g. a 
+title, alternative text or a local language setting. 
 \end{description}
 
 
@@ -754,8 +833,11 @@
 This sounds easy. But there are quite a number of traps, mostly with pdfLaTeX:
 
 \begin{enumerate}[beginpenalty=10000]
-  \item \PDF{} is a page oriented format. And this means that the start \texttt{BDC}/\texttt{BMC}  and the corresponding end \texttt{EMC} must be on the same page.
-  So marking e.g. a section title like in the following example won't always work  as the literal before the section could end on the previous page:
+  \item \PDF{} is a page oriented format. And this means that the start 
+      \texttt{BDC}/\texttt{BMC}  and the corresponding end \texttt{EMC} 
+      must be on the same page. So marking e.g. a section title like in the 
+      following example won't always work  as the literal before the 
+      section could end on the previous page: 
 
 
 \begin{lstlisting}
@@ -765,92 +847,154 @@
 \end{lstlisting}
 
 
-  Using the literals \emph{inside} the section argument is better, but then one has to take care that they don't wander into the header and the toc.
+  Using the literals \emph{inside} the section argument is better, but then 
+  one has to take care that they don't wander into the header and the toc. 
 
-  \item
-  Literals are \enquote{whatsits} nodes and can change spacing, page and line breaking. The literal \emph{behind} the section in the previous example could e.g. lead to a lonely section title at the end of the page.
+  \item Literals are \enquote{whatsits} nodes and can change spacing, page 
+      and line breaking. The literal \emph{behind} the section in the 
+      previous example could e.g. lead to a lonely section title at the end 
+      of the page. 
 
-  \item
-   The \texttt{/MCID} numbers must be unique on a page. So you can't use the literal in a saved box that you reuse in various places. This is e.\,g. a problem with \texttt{longtable} as it saves the table header and footer in a box.
+  \item The \texttt{/MCID} numbers must be unique on a page. So you can't 
+      use the literal in a saved box that you reuse in various places. This 
+      is e.\,g. a problem with \texttt{longtable} as it saves the table 
+      header and footer in a box. 
 
-  \item
-  The  \texttt{/MCID}-chunks are leaf nodes in the structure tree, so they shouldn't be nested.
+  \item The  \texttt{/MCID}-chunks are leaf nodes in the structure tree, so 
+      they shouldn't be nested. 
 
-  \item
-  Often text in a document is created automatically or moved around: entries in the table of contents, index, bibliography and more. To mark these text chunks correctly one has to analyze the code creating such content to find suitable places to inject the literals.
+  \item Often text in a document is created automatically or moved around: 
+      entries in the table of contents, index, bibliography and more. To 
+      mark these text chunks correctly one has to analyze the code creating 
+      such content to find suitable places to inject the literals. 
 
-  \item
-  The literals are inserted directly and not at shipout. This means that due to the asynchronous page breaking of \TeX\ the MCID-number can be wrong even if the counter is reset at every page. This package uses in generic mode a label-ref-system to get around this problem. This sadly means that often at least three compilations are needed until everything has settled down.
+  \item The literals are inserted directly and not at shipout. This means 
+      that due to the asynchronous page breaking of \TeX\ the MCID-number 
+      can be wrong even if the counter is reset at every page. This package 
+      uses in generic mode a label-ref-system to get around this problem. 
+      This sadly means that often at least three compilations are needed 
+      until everything has settled down. 
 
-  It can actually be worse: If the text is changed after the MCID-numbers have been assigned, and
-  a new mc-chunk is inserted in the middle of the page, then all the numbers have to be recalculated
-  and that requires again a number of compilations until it really settles down again.
-  Internal references are especially problematic here, as the first compilation
-  typically creates a non-link |??|, and only the second inserts the structure and the new mc.
-  When the reference system in LaTeX will be extended, care will be taken to ensure that already the dummy text builds a chunk.
-  Until then the advice is to first compile the document and resolve all cross-reference and to activate tagging only at the end.
+  It can actually be worse: If the text is changed after the MCID-numbers 
+  have been assigned, and a new mc-chunk is inserted in the middle of the 
+  page, then all the numbers have to be recalculated and that requires 
+  again a number of compilations until it really settles down again. 
+  Internal references are especially problematic here, as the first 
+  compilation typically creates a non-link |??|, and only the second 
+  inserts the structure and the new mc. When the reference system in LaTeX 
+  will be extended, care will be taken to ensure that already the dummy 
+  text builds a chunk. Until then the advice is to first compile the 
+  document and resolve all cross-reference and to activate tagging only at 
+  the end. 
 
 
-  \item
-  There exist environments which process their content more than once -- examples are \texttt{align} and \texttt{tabularx}.
+  \item There exist environments which process their content more than once 
+      -- examples are \texttt{align} and \texttt{tabularx}. 
        So one has to check for doublettes and holes in the counting system.
 
 
-  \item
-  \PDF{} is a page oriented format. And this means that the start and the end marker must be on the same page \ldots\ \emph{so what to do with normal paragraphs that split over pages??}. This question will be discussed in subsection~\ref{sec:splitpara}.
+  \item \PDF{} is a page oriented format. And this means that the start and 
+      the end marker must be on the same page \ldots\ \emph{so what to do 
+      with normal paragraphs that split over pages??}. This question will 
+      be discussed in subsection~\ref{sec:splitpara}. 
 \end{enumerate}
 
 
 \subsubsection{Generic mode versus lua mode in the mc-task}
 
-While in generic mode the commands insert the literals directly and so have all the problems described above the lua mode works quite differently: The tagging commands don't insert literals but set some \emph{attributes} which are attached to all the following nodes. When the page is shipped out some lua code is called which wanders through the shipout box and injects the literals at the places where the attributes changes.
+While in generic mode the commands insert the literals directly and so have 
+all the problems described above the lua mode works quite differently: The 
+tagging commands don't insert literals but set some \emph{attributes} which 
+are attached to all the following nodes. When the page is shipped out some 
+lua code is called which wanders through the shipout box and injects the 
+literals at the places where the attributes changes. 
 
 This means that quite a number of problems mentioned above are not relevant for the lua mode:
 
-\begin{enumerate}
-\item Pagebreaks between start and end of the marker are \emph{not} a problem. So you can mark a complete paragraph. If a pagebreak occur directly after an start marker or before an end marker this can lead to empty chunks in the \PDF{} and so bloat up \PDF{} a bit, but this is imho not really a problem (compared to the size increase by the rest of the tagging).
-\item The commands don't insert literals directly and so affect line and page breaking much less.
-\item The numbering of the MCID are done at shipout, so no label/ref system is needed.
-\item The code can do some marking automatically. Currently everything that has not been marked up by the document is marked as artifact.
-\end{enumerate}
+\begin{enumerate} 
+\item Pagebreaks between start and end of the marker are 
+\emph{not} a problem. So you can mark a complete paragraph. If a pagebreak 
+occur directly after an start marker or before an end marker this can lead to 
+empty chunks in the \PDF{} and so bloat up \PDF{} a bit, but this is imho not 
+really a problem (compared to the size increase by the rest of the tagging). 
 
+\item The commands don't insert literals directly and so affect line and page 
+breaking much less. 
 
+\item The numbering of the MCID are done at shipout, so no label/ref system 
+    is needed. 
+    
+\item The code can do some marking automatically. Currently everything that 
+    has not been marked up by the document is marked as artifact. 
+\end{enumerate} 
 
 
+
+
 \subsubsection{Commands to mark content and chunks}
 
 
-In generic mode\sidenote{Generic mode only} is vital that the end command is executed on the same page as the begin command. So think carefully how to place them.
-For strategies how to handle paragraphs that split over pages see subsection~\ref{sec:splitpara}.
+In generic mode\sidenote{Generic mode only} is vital that the end command is 
+executed on the same page as the begin command. So think carefully how to 
+place them. For strategies how to handle paragraphs that split over pages see 
+subsection~\ref{sec:splitpara}. 
 
 \begin{docCommand}{tagmcbegin}{\marg{key-val-list}}\end{docCommand}
 \begin{docCommand}{tag_mc_begin:n}{\marg{key-val-list}}\end{docCommand}
 
 
-These commands insert the begin of the marked content code in the \PDF{}. They don't start a paragraph. \emph{They don't start a group}.
-Such markers should not be nested. The command will warn you if this happens.
+These commands insert the begin of the marked content code in the \PDF{}. 
+They don't start a paragraph. \emph{They don't start a group}. Such markers 
+should not be nested. The command will warn you if this happens. 
 
 The key-val list understands the following keys:
 
 \begin{description}
-  \item[\PrintKeyName{tag}]
-  This is required, unless you use the \PrintKeyName{artifact} key. The value of the key is normally one of the standard type listed in section \ref{sec:new-tag} (without a slash at the begin, this is added by the code). It is possible to setup new tags, see the same section. The value of the key is expanded, so it can be a command. The expansion is passed unchanged to the \PDF{}, so it should with a starting slash give a valid \PDF{} name  (some ascii with numbers like \texttt{H4} is fine).
+  \item[\PrintKeyName{tag}] This key is optional. By default the tag name 
+      of the surrounding structure is used, which normally should be fine. 
+      But if needed the name can be set explicitly with this key. The value 
+      of the key is typically one of the standard type listed in section 
+      \ref{sec:new-tag} (without a slash at the begin, this is added by the 
+      code). It is possible to setup new tags, see the same section. The 
+      value of the key is expanded, so it can be a command. The expansion 
+      is passed unchanged to the \PDF{}, so it should with a starting slash 
+      give a valid \PDF{} name  (some ascii with numbers like \texttt{H4} 
+      is fine). 
 
-  \item[\PrintKeyName{artifact}]
-  This will setup the marked content as an artifact. The key should be used for content that should be ignored. The key can take one of the values \PrintKeyName{pagination}, \PrintKeyName{pagination/header}, \PrintKeyName{pagination/footer}, \PrintKeyName{layout},  \PrintKeyName{page},  \PrintKeyName{background} and \PrintKeyName{notype} (this is the default). Text in the header and footer should normally be marked with \PrintKeyName{artifact=pagination} or \PrintKeyName{pagination/header}, \PrintKeyName{pagination/footer} but
-  simply artifact (as it is now done automatically) should be ok too.
+  \item[\PrintKeyName{artifact}] This will setup the marked content as an 
+      artifact. The key should be used for content that should be ignored. 
+      The key can take one of the values \PrintKeyName{pagination}, 
+      \PrintKeyName{pagination/header}, \PrintKeyName{pagination/footer}, 
+      \PrintKeyName{layout},  \PrintKeyName{page},  
+      \PrintKeyName{background} and \PrintKeyName{notype} (this is the 
+      default). Text in the header and footer should normally be marked 
+      with \PrintKeyName{artifact=pagination} or 
+      \PrintKeyName{pagination/header}, \PrintKeyName{pagination/footer} 
+      but simply artifact (as it is now done automatically) should be ok 
+      too. 
 
-  It is not quite clear if rules and other decorative graphical objects needs to be marked up as artifacts. Acrobat seems not to mind if not, but PAC~3 complained.
+  It is not quite clear if rules and other decorative graphical objects 
+  needs to be marked up as artifacts. Acrobat seems not to mind if not, but 
+  PAC~3 complained. 
 
-  The validators complain if some text is not marked up, but it is not quite clear if this is a serious problem.
+  The validators complain if some text is not marked up, but it is not 
+  quite clear if this is a serious problem. 
 
-  The\sidenote{lua mode only} lua mode will mark up everything unmarked as \texttt{artifact=notype}. You can suppress this behaviour by setting the tagpdfsetup key \texttt{tagunmarked} to false. See section \ref{ssec:setup}.
+  The\sidenote{lua mode only} lua mode will mark up everything unmarked as 
+  \texttt{artifact=notype}. You can suppress this behaviour by setting the 
+  tagpdfsetup key \texttt{tagunmarked} to false. See section 
+  \ref{ssec:setup}. 
 
-  \item[\PrintKeyName{stash}]
-   Normally marked content will be stored in the \enquote{current} structure. This may not be what you want. As an example you may perhaps want to put a marginnote behind or before the paragraph it is in the tex-code. With this boolean key the content is marked but not stored in the kid-key of the current structure.
+  \item[\PrintKeyName{stash}] Normally marked content will be stored in the 
+      \enquote{current} structure. This may not be what you want. As an 
+      example you may perhaps want to put a marginnote behind or before the 
+      paragraph it is in the tex-code. With this boolean key the content is 
+      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 with the previous key). Internally the label name will start with \texttt{tagpdf-}.
+  \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 
+      with the previous key). Internally the label name will start with 
+      \texttt{tagpdf-}. 
 
   \item[\PrintKeyName{alt}]
    This key inserts an \texttt{/Alt} value in the property dictionary of the BDC operator. See section~\ref{sec:alt}. The value is handled as verbatim string, commands are not expanded but the value will be expanded first once (so works like the key \texttt{alttext-o} in previous versions which has been removed).
@@ -865,10 +1009,15 @@
 
 
 
-  \item[\PrintKeyName{actualtext}]
-  This key inserts an \texttt{/ActualText} value in the property dictionary of the BDC operator. See section~\ref{sec:alt}. The value is handled as verbatim string, commands are not expanded but the value will be expanded first once (so works like the key \texttt{actualtext-o} in previous versions which has been removed).
+  \item[\PrintKeyName{actualtext}] This key inserts an \texttt{/ActualText} 
+      value in the property dictionary of the BDC operator. See 
+      section~\ref{sec:alt}. The value is handled as verbatim string, 
+      commands are not expanded but the value will be expanded first once 
+      (so works like the key \texttt{actualtext-o} in previous versions 
+      which has been removed). 
 
-  That means that you can do something like in the following listing and and it will insert \verb+X+ (hex encoded)  in the \PDF{}.
+  That means that you can do something like in the following listing and 
+  and it will insert \verb+X+ (hex encoded)  in the \PDF{}. 
 
 
   \begin{lstlisting}
@@ -876,11 +1025,14 @@
    \tagmcbegin{tag=Span,actualtext=\myactualtext}
   \end{lstlisting}
 
-  According to the PDF reference, \texttt{/ActualText} should only be used on marked content sequence of type Span. This is not enforced by the code currently.
+  According to the PDF reference, \texttt{/ActualText} should only be used 
+  on marked content sequence of type Span. This is not enforced by the code 
+  currently. 
 
 
-  \item[\PrintKeyName{raw}]
-  This key allows you to add more entries to the properties dictionary. The value must be correct, low-level \PDF{}. E.g. \verb+raw=/Alt (Hello)+ will insert an alternative Text.
+  \item[\PrintKeyName{raw}] This key allows you to add more entries to the 
+      properties dictionary. The value must be correct, low-level \PDF{}. 
+      E.g. \verb+raw=/Alt (Hello)+ will insert an alternative Text. 
 \end{description}
 
 
@@ -887,7 +1039,12 @@
 \begin{docCommand}{tagmcend}{}\end{docCommand}
 \begin{docCommand}{tag_mc:end}{}\end{docCommand}
 
-These commands insert the end code of the marked content. They don't end a group and it doesn't matter if they are in another group as the starting commands. In generic mode both commands check if there has been a begin marker and issue a warning if not. In luamode it is often possible to omit the command, as the effect of the begin command ends  with a new \verb+\tagmcbegin+ anyway.
+These commands insert the end code of the marked content. They don't end a 
+group and it doesn't matter if they are in another group as the starting 
+commands. In generic mode both commands check if there has been a begin 
+marker and issue a warning if not. In luamode it is often possible to omit 
+the command, as the effect of the begin command ends  with a new 
+\verb+\tagmcbegin+ anyway. 
 
 
 % no longer relevant
@@ -913,7 +1070,9 @@
 \begin{docCommand}{tag_mc_use:n}{}\end{docCommand}
 
 
-These commands allow you to record a marked content that you stashed away into the current structure. Be aware that a marked content can be used only once -- the command will warn you if you try to use it a second time.
+These commands allow you to record a marked content that you stashed away 
+into the current structure. Be aware that a marked content can be used only 
+once -- the command will warn you if you try to use it a second time. 
 
 
 \begin{docCommand}{tag_mc_end_push:}{}\end{docCommand}
@@ -1205,7 +1364,7 @@
 Please note
 
 \begin{itemize}
-\item The code requires a pdfmanagement-testphase version v0.95i or newer.
+\item The code requires a \pkg{pdfmanagement-testphase} version v0.95i or newer.
 \item Typically you will need more compilations than previously, don't rely on the rerun messages, but if something looks wrong
 rerun.
 \item The code relies on that related |\tagmcbegin| and |\tagmcend| are in the same boxing level. If one is in a box (which hides the marks) and the other in the main galley, things will go wrong.
@@ -1324,7 +1483,7 @@
   % By default a structure is added as kid to the currently active structure.
    With the parent key one can choose another parent. The value is a structure number which
    must refer to an already existing, previously created structure. Such a structure
-   number can for example be have been stored with \cs{tag\_get:n}, but one can also use
+   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 it.
 
@@ -1648,14 +1807,20 @@
 That means that a type can have more than one \enquote{meaning} depending on the name space it belongs to.
 |section (name space A)| and |section (name space B)| are two different types.
 
-At second PDF 2.0 still requires that a tagged PDF maps all types to a standard type, but now there are three sets of standard types (The meanings of the PDF types can be looked up in the \PDF{}-references \parencite{pdfspec-iso32000-1,pdfspec-iso32000-2_2020}):
+At second PDF 2.0 still requires that a tagged PDF maps all types to a 
+standard type, but now there are three sets of standard types (The meanings 
+of the PDF types can be looked up in the \PDF{}-references 
+\parencite{pdfspec-iso32000-1,pdfspec-iso32000-2_2020}): 
 
 \begin{enumerate}
 \item The \emph{standard structure namespace for PDF 1.7}, also called the \emph{default standard structure namespace}. The public name of the namespace is |tag/NS/pdf|. This can be used to reference
     the namespace e.g. in attributes. These are the structure names from PDF 1.7:
 \ExplSyntaxOn
-\clist_use:Nn \c__tag_role_sttags_pdf_pdfII_clist {,\c_space_tl}
-,~ \clist_use:Nn\c__tag_role_sttags_only_pdf_clist {,\c_space_tl}
+\clist_clear:N\l_tmpa_clist
+\prop_map_inline:cn 
+  { g__tag_role_NS_pdf_prop }
+  { \clist_put_right:Nn \l_tmpa_clist {#1} }
+\clist_use:Nn \l_tmpa_clist {,\c_space_tl }
 \ExplSyntaxOff
 
 \item The \emph{standard structure namespace for PDF 2.0}.
@@ -1663,11 +1828,27 @@
 the namespace e.g. in attributes.
 These are more or less same types as in PDF. The following types have been removed from this set:\\
 \ExplSyntaxOn
-\clist_use:Nn\c__tag_role_sttags_only_pdf_clist {,\c_space_tl}\\
+\clist_clear:N\l_tmpa_clist
+\prop_map_inline:cn { g__tag_role_NS_pdf_prop }
+ { 
+  \prop_if_in:cnF 
+    { g__tag_role_NS_pdf2_prop }
+    {#1}
+    { \clist_put_right:Nn \l_tmpa_clist {#1} } 
+ }
+\clist_use:Nn \l_tmpa_clist {,\c_space_tl }\\
 \ExplSyntaxOff
 and the following are new:\\
 \ExplSyntaxOn
-\clist_use:Nn \c__tag_role_sttags_only_pdfII_clist {,\c_space_tl}
+\clist_clear:N\l_tmpa_clist
+\prop_map_inline:cn { g__tag_role_NS_pdf2_prop }
+ { 
+  \prop_if_in:cnF 
+    { g__tag_role_NS_pdf_prop }
+    {#1}
+    { \clist_put_right:Nn \l_tmpa_clist {#1}  } 
+ }
+\clist_use:Nn \l_tmpa_clist {,\c_space_tl }
 \ExplSyntaxOff
 
 \item MathML 3.0 as an \emph{other namespaces}.
@@ -1684,10 +1865,16 @@
 
 \begin{description}
 \item[\PrintKeyName{tag}] This is the name of the new type as it should then be used in \cs{tagstructbegin}.
-\item[\PrintKeyName{namespace}] This is the namespace of the new type. The value should be a shorthand of a namespace. The allowed values are currently |pdf|, |pdf2|, |mathml| and |user|. The default value (and recommended value for a new tag) is |user|. The public name of the user namespace is |tag/NS/user|. This can be used to reference
-    the namespace e.g. in attributes.
-\item[\PrintKeyName{role}] This is the type the tag should be mapped too. In a PDF 1.7 or earlier this is normally a type from the |pdf| set, in PDF 2.0 from the |pdf|, |pdf2| and |mathml| set. It can also be a user type, or a still unknown type. The PDF format allows mapping to be done transitively. But you should be aware that tagpdf can't (or more precisely won't) check such unusual role mapping. It lies in the responsability of the author to ensure here that every type is correctly role mapped.
-\item[\PrintKeyName{role-namespace}] If the role is a known type the default value is the default namespace: |pdf2| for all types in this set, |pdf| for the type which exist only in PDF 1.7,  |mathml| for the MathML types, and  for previously defined user types whatever namespace has been set there. If the role is unknown, |user| is used and the code hopes that the type will be defined later.
+\item[\PrintKeyName{tag-namespace}] This is the namespace of the new type. 
+    The value should be a shorthand of a namespace. The allowed values are 
+    currently |pdf|, |pdf2|, |mathml| and |user|. The default value (and 
+    recommended value for a new tag) is |user|. The public name of the user 
+    namespace is |tag/NS/user|. This can be used to reference the namespace 
+    e.g. in attributes. 
+\item[\PrintKeyName{role}] This is the type the tag should be mapped too. In a PDF 1.7 or earlier this is normally a type from the |pdf| set, in PDF 2.0 from the |pdf|, |pdf2| or |mathml| set. It can also be a user type, then this user tag must have been declared before. The PDF format allows mapping to be done transitively. But you should be aware that tagpdf can't (or more precisely won't) check if some unusual role mapping makes really sense, this lies in the responsability of the author.
+    
+\item[\PrintKeyName{role-namespace}] The default value is the default namespace of the role: |pdf2| for all types in this set, |pdf| for the type which exist only in PDF 1.7,  |mathml| for the MathML types, and  for previously defined user types whatever namespace has been set there. With this key the value can be overwritten.
+    
  \item[unknown key] An unknown key is interpreted as a |tag/role|, this preserves the old syntax. So this two calls are equivalent:
 
    \begin{lstlisting}
@@ -1697,10 +1884,71 @@
 
 \end{description}
 
-The exact effects of the key depends on the PDF version. With PDF 1.7 or older the namespace keys are ignored, with PDF 2.0 the namespace keys are use to setup the correct rolemaps. The |namespace| key is also used to define the default namespace if the type is used as a role or as tag in a structure.
+The exact effects of the keys depend on the PDF version. With PDF 1.7 or older the namespace keys are ignored, with PDF 2.0 the namespace keys are use to setup the correct rolemaps. The |namespace| key is also used to define the default namespace if the type is used as a role or as tag in a structure.
 
+\subsection{The \texttt{latex} namespace}
 
+Starting with version 0.98 work has started to setup specific latex tags. In 
+\PDF{} 2.0 in form of a special name space,  with \PDF{} 1.7 or older the 
+tags are role mapped. This is work in progress and bound to change.
 
+
+\section{Checking parent-child rules}\label{sec:parent-child}
+
+The \PDF{} references formulate various rules about whether a structure can be 
+a child of another structure, e.g. a \texttt{Sect} can not be a child of \texttt{P}. 
+In the \PDF{} 1.7 reference this rules were 
+rather vage, in the \PDF{} 2.0  reference there is a quite specific matrix, 
+which sadly misses some of the tags from \PDF{} 1.7. The upcoming 
+ISO norm 32005 will 
+address this problem and extend the matrix to cover tags from 
+\PDF{} 1.7 and 2.0 (but it still misses the \texttt{math} tag and mathml 
+tags). 
+
+The rules in the matrix are not a simple allowed/not allowed. Instead some rules determine 
+that structure elements
+can appear only once in a parent, or that  additional requirements can be found in the  
+descriptions of the standard structure types, e.g. \texttt{Caption} often has
+to be the first element in the parent structure, and elements like \texttt{Part} and \texttt{Div}
+inherit restrictions from parent structures.
+External standards like \PDF/UA can add more rules.
+
+Altogether this doesn't make it easy to check if a structure tree is conformant or not without slowing down 
+the compilation a lot.
+
+With version 0.98 some first steps to do checks (and to react to the result of a change)
+have been implemented. Some checks will led to warning directly, but the majority
+will only be visible if the log-level is increased. 
+
+Typical messages will look then like this
+
+\begin{lstlisting}[mathescape]
+Package tagpdf Info: The rule between parent 'Sect (from Sect/pdf2)' 
+(tagpdf)             and child 'H10 (from H10/pdf2)' is '1 (0..n)'
+
+Package tagpdf Info: The rule between parent 'H2 (from subsection/latex)' 
+(tagpdf)             and child 'H1 (from section/latex)' is '-1 ($\emptyset$)'
+\end{lstlisting}
+
+The descriptions of the parent and childs are rather verbose as the checks have to take role mapping and name spaces into account. The result of a check is a number---negative if the relation is not allowed,
+positive if allowed. The text in the parentheses show the symbols used in the \PDF-matrix. 
+
+Be aware
+\begin{itemize}
+\item This doesn't test all rules, it only implements (hopefully correctly) the matrix.
+\item There can be differences between \PDF~1.7 and 2.0, e.g. \texttt{FENote} is rolemapped to \texttt{Note}
+in \PDF~1.7 and then has different containment rules.
+\item The special tag \texttt{MC} stands for mc-chunks, so \enquote{real content} (the matrix has containments rules for this too).
+\item  Currently there is as only negative number \texttt{\textminus1} but that is bound to change, depending on if (and how) it is possible to \enquote{repair} a disallowed parent-child relation.  
+\item Warnings can be wrong. 
+\end{itemize}
+
+
+
+
+  
+  
+
 \section{\enquote{Real} space glyphs}\label{sec:spacechars}
 
 
@@ -1745,20 +1993,20 @@
  \TeX{}live 2022  (earlier in miktex) both engines will knew new keywords which allow
  to create structure destination easily.
 
- Support for this has been already added to the pdfmanagement and \pkg{tagpdf} will make
- use of it if possible. In most cases it should simply work, but one should be aware
- that as one now has a destination that is actually tied to the content it gets more
- important to actually consider the context and the place where such destinations
- are created. It now makes a difference if the destination is created before the
- structure is opened or after so in some cases
- code that place destinations should be changed to place them inside the structure they
- belong too. .
- One also has to consider the pages connected to the destinations: The structure destination
- is bound to the page where the structure \emph{begins}, if this differ from the page of the page destination
- (e.g. if the destination is created by a \verb+\phantomsection+  in the middle of a longer paragraph)
- then be necessary to surround
- destinations with a dummy structure (a Span or an Artifact) to
- get the right page number.
+ Support for this has been already added to the \PDF\ management and 
+ \pkg{tagpdf} will make use of it if possible. In most cases it should simply 
+ work, but one should be aware that as one now has a destination that is 
+ actually tied to the content it gets more important to actually consider the 
+ context and the place where such destinations are created. It now makes a 
+ difference if the destination is created before the structure is opened or 
+ after so in some cases code that place destinations should be changed to 
+ place them inside the structure they belong too. One also has to consider 
+ the pages connected to the destinations: The structure destination is bound 
+ to the page where the structure \emph{begins}, if this differ from the page 
+ of the page destination (e.g. if the destination is created by a 
+ \verb+\phantomsection+  in the middle of a longer paragraph) then may be 
+ necessary to surround destinations with a dummy structure (a Span or an 
+ Artifact) to get the right page number. 
 
 
 
@@ -2025,4 +2273,3 @@
 
 \end{document}
 %http://msf.mathmlcloud.org/file_formats/8 %sample \PDF{} for math
-

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx	2022-12-23 21:05:03 UTC (rev 65341)
@@ -47,13 +47,13 @@
 %    }^^A
 % }
 %
-% \date{Version 0.97, released 2022-08-24}
+% \date{Version 0.98, released 2022-12-22}
 % \maketitle
 % \begin{implementation}
 %    \begin{macrocode}
 %<@@=tag>
 %<*luatex>
-\ProvidesExplFile {tagpdf-luatex.def} {2022-08-24} {0.97}
+\ProvidesExplFile {tagpdf-luatex.def} {2022-12-22} {0.98}
   {tagpdf~driver~for~luatex}
 %    \end{macrocode}
 % \section{Loading the lua}
@@ -146,6 +146,7 @@
  }
 %    \end{macrocode}
 % \end{macro}
+% 
 %    \begin{macrocode}
 %</luatex>
 %    \end{macrocode}
@@ -157,8 +158,8 @@
 
 local ProvidesLuaModule = {
     name          = "tagpdf",
-    version       = "0.97",       --TAGVERSION
-    date          = "2022-08-24", --TAGDATE
+    version       = "0.98",       --TAGVERSION
+    date          = "2022-12-22", --TAGDATE
     description   = "tagpdf lua code",
     license       = "The LATEX Project Public License 1.3c"
 }
@@ -282,6 +283,7 @@
 ltx.@@.tables   = ltx.@@.tables or  { } -- tables created with new prop and new seq.
                                         -- wasn't a so great idea ...
                                         -- g_@@_role_tags_seq used by tag<-> is in this tables!
+                                        -- used for pure lua tables too now!
 ltx.@@.page     = ltx.@@.page   or  { } -- page data, currently only i->{0->mcnum,1->mcnum,...}
 ltx.@@.trace    = ltx.@@.trace  or  { } -- show commands
 ltx.@@.func     = ltx.@@.func   or  { } -- functions
@@ -437,7 +439,28 @@
 end
 %    \end{macrocode}
 % \end{macro}
-
+%
+% \begin{variable}{ltx.@@.tables.role_tag_attribute,ltx.@@.tables.role_tag_attribute}
+% The first is a table with key a tag and value a number (the attribute)
+% The second is an array with the attribute value as key.
+%    \begin{macrocode}
+ltx.@@.tables.role_tag_attribute = {}
+ltx.@@.tables.role_attribute_tag = {}
+%    \end{macrocode}
+% \end{variable}
+% \begin{macro}{ltx.@@.func.alloctag}
+%    \begin{macrocode}
+local @@_alloctag = 
+ function (tag)
+   if not ltx.@@.tables.role_tag_attribute[tag] then    
+    table.insert(ltx.@@.tables.role_attribute_tag,tag)
+    ltx.@@.tables.role_tag_attribute[tag]=#ltx.@@.tables.role_attribute_tag
+    @@_log  ("Add "..tag.." "..ltx.@@.tables.role_tag_attribute[tag],3)    
+   end 
+ end
+ltx.@@.func.alloctag = @@_alloctag
+%    \end{macrocode}
+% \end{macro}
 % \begin{macro}
 %   {
 %    @@_get_num_from,
@@ -451,8 +474,8 @@
 %    \begin{macrocode}
 local @@_get_num_from =
  function (tag)
-  if ltx.@@.tables["g_@@_role_tags_prop"][tag] then
-    a= ltx.@@.tables["g_@@_role_tags_prop"][tag]
+  if ltx.@@.tables.role_tag_attribute[tag] then
+    a= ltx.@@.tables.role_tag_attribute[tag]
   else
     a= -1
   end
@@ -479,13 +502,13 @@
 %   }
 % These functions are the opposites to the previous function:
 % they take as argument a number (the attribute value) and return the string |tag|.
-% The first function outputs the number for lua, while the |output| function
+% The first function outputs the string for lua, while the |output| function
 % outputs to tex.
 %    \begin{macrocode}
 local @@_get_tag_from =
  function  (num)
-  if ltx.@@.tables["g_@@_role_tags_seq"][num] then
-   a = ltx.@@.tables["g_@@_role_tags_seq"][num]
+  if ltx.@@.tables.role_attribute_tag[num] then
+   a = ltx.@@.tables.role_attribute_tag[num]
   else
    a= "UNKNOWN"
   end
@@ -924,7 +947,7 @@
     elseif n.id == VLIST then -- enter the vlist
      mcopen,mcpagecnt,mccntprev,mctypeprev=
       ltx.@@.func.mark_page_elements (n,mcpagecnt,mccntprev,mcopen,"INTERNAL VLIST",mctypeprev)
-    elseif n.id == GLUE then       -- at glue real space chars are inserted, but this has
+    elseif n.id == GLUE and not n.leader then -- at glue real space chars are inserted, but this has
                                    -- been done if the previous shipout wandering, so here it is ignored
     elseif n.id == LOCAL_PAR then  -- local_par is ignored
     elseif n.id == PENALTY then    -- penalty is ignored

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx	2022-12-23 21:05:03 UTC (rev 65341)
@@ -48,7 +48,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.97, released 2022-08-24}
+% \date{Version 0.98, released 2022-12-22}
 % \maketitle
 % \begin{documentation}
 % \section{Commands}
@@ -295,7 +295,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-checks-code} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdf-checks-code} {2022-12-22} {0.98}
  {part of tagpdf - code related to checks, conditionals, debugging and messages}
 %</header>
 %    \end{macrocode}
@@ -402,9 +402,22 @@
 % Informational message shown if log-mode is high enough
 %    \begin{macrocode}
 \msg_new:nnn { tag } {struct-show-closing}
-  { closing~structure~#1~tagged~\prop_item:cn{g_@@_struct_#1_prop}{S} }
+  { closing~structure~#1~tagged~\use:e{\prop_item:cn{g_@@_struct_#1_prop}{S}} }
 %    \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.
+%    \begin{macrocode}
+\msg_new:nnn { tag } {tree-struct-still-open}
+  { 
+    There~are~still~open~structures~on~the~stack!\\
+    The~stack~contains~\seq_use:Nn\g_@@_struct_tag_stack_seq{,}.\\
+    The~structures~are~automatically~closed,\\
+    but~their~nesting~can~be~wrong.  
+  }
+%    \end{macrocode}
+% \end{macro} 
 %
 % \subsection{Attributes}
 % Not much yet, as attributes aren't used so much.
@@ -423,11 +436,30 @@
 \msg_new:nnn { tag } {role-unknown-tag} { tag~#1~is~not~known  }
 %    \end{macrocode}
 % \end{macro}
+% \begin{macro}{role-parent-child}
+%  This is info and warning message about the containment rules between child and
+%  parent tags.
+%    \begin{macrocode}
+\msg_new:nnn { tag } {role-parent-child} 
+  { The~rule~between~parent~'#1'~\\and~child~'#2'~is~#3}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{role-parent-child}
+%  This is info and warning message about the containment rules between child and
+%  parent tags.
+%    \begin{macrocode}
+\msg_new:nnn { tag } {role-remapping} 
+  { remapping~tag~to~#1 }
+%    \end{macrocode}
+% \end{macro}
 % \begin{macro}{role-tag,new-tag}
 % Info messages.
 %    \begin{macrocode}
 \msg_new:nnn { tag } {role-tag}         { mapping~tag~#1~to~role~#2  }
 \msg_new:nnn { tag } {new-tag}          { adding~new~tag~#1 }
+\msg_new:nnn { tag } {read-namespace}   { reading~namespace~definitions~tagpdf-ns-#1.def }
+\msg_new:nnn { tag } {namespace-missing}{ namespace~definitions~tagpdf-ns-#1.def~not~found }
+\msg_new:nnn { tag } {namespace-unknown}{ namespace~#1~is~not~declared }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -562,7 +594,7 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_check_structure_tag:N #1
   {
-    \prop_if_in:NoF \g_@@_role_tags_prop {#1}
+    \prop_if_in:NoF \g_@@_role_tags_NS_prop {#1}
       {
         \msg_warning:nnx { tag } {role-unknown-tag} {#1}
       }
@@ -618,10 +650,10 @@
   {
     \tl_if_empty:nTF {#2}
       {
-        \msg_warning:nnn { tag } {role-missing} {#1}
+        \msg_error:nnn { tag } {role-missing} {#1}
       }
       {
-        \prop_get:NnNTF \g_@@_role_tags_prop {#2} \l_tmpa_tl
+        \prop_get:NnNTF \g_@@_role_tags_NS_prop {#2} \l_tmpa_tl
           {
             \int_compare:nNnT {\l_@@_loglevel_int} > { 0 }
               {
@@ -629,13 +661,35 @@
               }
           }
           {
-            \msg_warning:nnn { tag } {role-unknown} {#2}
+            \msg_error:nnn { tag } {role-unknown} {#2}
           }
       }
   }
 %    \end{macrocode}
+% Similar with a namespace
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_check_add_tag_role:nnn #1 #2 #3 %#1 tag/NS, #2 role #3 namespace
+  {
+    \tl_if_empty:nTF {#2}
+      {
+        \msg_error:nnn { tag } {role-missing} {#1}
+      }
+      {
+        \prop_get:cnNTF { g_@@_role_NS_#3_prop } {#2} \l_tmpa_tl
+          {
+            \int_compare:nNnT {\l_@@_loglevel_int} > { 0 }
+              {
+                \msg_info:nnnn { tag } {role-tag} {#1} {#2/#3}
+              }
+          }
+          {
+            \msg_error:nnn { tag } {role-unknown} {#2/#3}
+          }
+      }
+  }
+%    \end{macrocode}
 % \end{macro}
-%
+
 % \subsection{Check related to mc-chunks}
 %
 % \begin{macro}{\@@_check_mc_if_nested:,\@@_check_mc_if_open:}

Added: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-data.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-data.dtx	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-data.dtx	2022-12-23 21:05:03 UTC (rev 65341)
@@ -0,0 +1,581 @@
+% \iffalse meta-comment
+%
+%% File: tagpdf-data.dtx
+%
+% Copyright (C) 2022 Ulrike Fischer
+%
+% It may be distributed and/or modified under the conditions of the
+% LaTeX Project Public License (LPPL), either version 1.3c of this
+% license or (at your option) any later version.  The latest version
+% of this license is in the file
+%
+%    https://www.latex-project.org/lppl.txt
+%
+% This file is part of the "tagpdf bundle" (The Work in LPPL)
+% and all files in that bundle must be distributed together.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the bundle can be found at
+%
+%    https://github.com/u-fischer/tagpdf
+%
+% for those people who are interested.
+%<*driver>
+\DocumentMetadata{}
+\documentclass{l3doc}
+\usepackage{array,booktabs,caption}
+\hypersetup{pdfauthor=Ulrike Fischer,
+ pdftitle=tagpdf-data module (tagpdf)}
+\begin{document}
+  \DocInput{\jobname.dtx}
+\end{document}
+%</driver>
+% \fi
+% \title{^^A
+%   The \pkg{tagpdf-data} module\\ 
+%   Data files for tag namespaces and containment rules^^A
+%   \\ Part of the tagpdf package
+% }
+%
+% \author{^^A
+%  Ulrike Fischer\thanks
+%    {^^A
+%      E-mail:
+%        \href{mailto:fischer at troubleshooting-tex.de}
+%          {fischer at troubleshooting-tex.de}^^A
+%    }^^A
+% }
+%
+% \date{Version 0.98, released 2022-12-22}
+% \maketitle
+% \begin{documentation}
+% This files contains a various data files which are read in
+% by \pkg{tagpdf} to setup name spaces and  rules for tag relationships.
+% 
+% \end{documentation}
+% \begin{implementation}
+% \section{The LaTeX namespace}
+% This is the main new namespace. It is bound to change a lot!
+% It lists the new tag, the rolemap and the namespace of the rolemap.
+%    \begin{macrocode}
+%<*ns-latex>
+%% \ProvidesExplFile {tagpdf-ns-latex.def} {2022-12-22} {0.98}
+%% {latex} {https://www.latex-project.org/ns/dflt/2022}{}
+title,        Title,    pdf2,
+part,         Title,    pdf2,
+section,      H1,       pdf2, 
+subsection,   H2,       pdf2,
+subsubsection,H3,       pdf2,
+paragraph,    H4,       pdf2, 
+subparagraph, H5,       pdf2,
+itemize,      L,        pdf2,
+enumerate,    L,        pdf2,
+description,  L,        pdf2,
+item,         LI,       pdf2,
+itemlabel,    Lbl,      pdf2,
+itembody,     LBody,    pdf2,
+footnote,     FENote,   pdf2,
+footnotemark, Lbl,      pdf2,
+footnotelabel,Lbl,      pdf2,
+%</ns-latex>
+%    \end{macrocode}
+% \section{The LaTeX-book namespace}
+% This changes the rolemapping of some tags for heading with
+% to values more suitable in book classes. 
+% It is bound to change
+%    \begin{macrocode}
+%<*ns-latex-book>
+%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2022-12-22} {0.98}
+%% {latex-book} {https://www.latex-project.org/ns/book/2022}{}
+chapter,       H1,pdf2,
+section,       H2,pdf2,
+subsection,    H3,pdf2,
+subsubsection, H4,pdf2,
+paragraph,     H5,pdf2,
+subparagraph,  H6,pdf2,
+%</ns-latex-book>
+%    \end{macrocode}
+% \section{The LaTeX-inline namespace}
+% This degrades the rolemapping of some tags. It is an experimental name space.
+% It can disappear again if it doesn't look usefull.
+% It is bound to change a lot!
+%    \begin{macrocode}
+%<*ns-latex-inline>
+%% \ProvidesExplFile {tagpdf-ns-latex-inline.def} {2022-12-22} {0.98}
+%% {latex-inline} {https://www.latex-project.org/ns/inline/2022}{}
+chapter,       Span, pdf2,    
+section,       Span, pdf2,
+subsection,    Span, pdf2,
+subsubsection, Span, pdf2,
+paragraph,     Span, pdf2,
+subparagraph,  Span, pdf2,
+P,             Span, pdf2,
+%</ns-latex-inline>
+%    \end{macrocode}
+% \section{The pdf namespace data}
+%    \begin{macrocode}
+%<*ns-pdf>
+%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2022-12-22} {0.98}
+%%  {pdf}   {http://iso.org/pdf/ssn}{}
+StructTreeRoot,,,D,
+Document,,,D,   
+Part,,,G,       
+Sect,,,G,       
+Div,,,G,        
+Caption,,,GB,    
+NonStruct,,,G,  
+H,,,B,
+H1,,,B,
+H2,,,B,
+H3,,,B,
+H4,,,B,
+H5,,,B,
+H6,,,B,
+P,,,B,
+L,,,BI,           
+LI,,,L,          
+Lbl,,,I,         
+LBody,,,L,       
+Table,,,B,
+TR,,,T,          
+TH,,,T,          
+TD,,,T,          
+THead,,,T,       
+TBody,,,T,       
+TFoot,,,T,       
+Span,,,I,        
+Link,,,GBI,        
+Annot,,,GBI,
+Figure,,,GBI,
+Formula,,,GBI,
+Form,,,GBI,
+Ruby,,,I,
+RB,,,I,
+RT,,,I,
+Warichu,,,I,
+WT,,,I,
+WP,,,I,
+Artifact,,,GBI, 
+Art,,,,G,  % only pdf, types unclear, needs correction later       
+BlockQuote,,,G, %or GB?
+TOC,,,G,        
+TOCI,,,G,       
+Index,,,G,
+Private,,,G,
+Quote,,,I,      
+Note,,,GBI, % I in reference, but        
+Reference,,,B, %  
+BibEntry,,,B, %   
+Code,,,I, %
+%</ns-pdf>
+%    \end{macrocode}
+% \section{The pdf 2.0 namespace data}
+%    \begin{macrocode}
+%<*ns-pdf2>
+%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2022-12-22} {0.98} 
+%%  {pdf2}  {http://iso.org/pdf2/ssn}{}
+Document,,,D,   
+Part,,,G,       
+Sect,,,G,       
+Div,,,G,        
+Caption,,,GB,    
+NonStruct,,,G,  
+H,,,B,
+H1,,,B,
+H2,,,B,
+H3,,,B,
+H4,,,B,
+H5,,,B,
+H6,,,B,
+P,,,B,
+L,,,BI,           
+LI,,,L,          
+Lbl,,,I,         
+LBody,,,L,       
+Table,,,B,
+TR,,,T,          
+TH,,,T,          
+TD,,,T,          
+THead,,,T,       
+TBody,,,T,       
+TFoot,,,T,       
+Span,,,I,        
+Link,,,GBI,        
+Annot,,,GBI,
+Figure,,,GBI,
+Formula,,,GBI,
+Form,,,GBI,
+Ruby,,,I,
+RB,,,I,
+RT,,,I,
+Warichu,,,I,
+WT,,,I,
+WP,,,I,
+Artifact,,,GBI, 
+DocumentFragment,Art,    pdf,D, %rest only pdf2
+Aside,           Note,   pdf,G,
+H7,              H6,     pdf,B,
+H8,              H6,     pdf,B, 
+H9,              H6,     pdf,B,
+H10,             H6,     pdf,B,
+Title,           P,      pdf,GB,
+FENote,          Note,   pdf,GBI,
+Sub,             Span,   pdf,I,
+Em,              Span,   pdf,I,
+Strong,          Span,   pdf,I, 
+%</ns-pdf2>
+%    \end{macrocode}
+% \section{The mathml namespace data}
+%    \begin{macrocode}
+%<*ns-mathml>
+%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2022-12-22} {0.98}
+% {mathml}{http://www.w3.org/1998/Math/MathML}{}
+abs,,,
+and,,,
+annotation,,,
+apply,,,
+approx,,,
+arccos,,,
+arccosh,,,
+arccot,,,
+arccoth,,,
+arccsc,,,
+arccsch,,,
+arcsec,,,
+arcsech,,,
+arcsin,,,
+arcsinh,,,
+arctan,,,
+arctanh,,,
+arg,,,
+bind,,,
+bvar,,,
+card,,,
+cartesianproduct,,,
+cbytes,,,
+ceiling,,,
+cerror,,,
+ci,,,
+cn,,,
+codomain,,,
+complexes,,,
+compose,,,
+condition,,,
+conjugate,,,
+cos,,,
+cosh,,,
+cot,,,
+coth,,,
+cs,,,
+csc,,,
+csch,,,
+csymbol,,,
+curl,,,
+declare,,,
+degree,,,
+determinant,,,
+diff,,,
+divergence,,,
+divide,,,
+domain,,,
+domainofapplication,,,
+emptyset,,,
+eq,,,
+equivalent,,,
+eulergamma,,,
+exists,,,
+exp,,,
+exponentiale,,,
+factorial,,,
+factorof,,,
+false,,,
+floor,,,
+fn,,,
+forall,,,
+gcd,,,
+geq,,,
+grad,,,
+gt,,,
+ident,,,
+image,,,
+imaginary,,,
+imaginaryi,,,
+implies,,,
+in,,,
+infinity,,,
+int,,,
+integers,,,
+intersect,,,
+interval,,,
+inverse,,,
+lambda,,,
+laplacian,,,
+lcm,,,
+leq,,,
+limit,,,
+ln,,,
+log,,,
+logbase,,,
+lowlimit,,,
+lt,,,
+maction,,,
+maligngroup,,,
+malignmark,,,
+math,,,
+matrix,,,
+matrixrow,,,
+max,,,
+mean,,,
+median,,,
+menclose,,,
+merror,,,
+mfenced,,,
+mfrac,,,
+mglyph,,,
+mi,,,
+min,,,
+minus,,,
+mlabeledtr,,,
+mlongdiv,,,
+mmultiscripts,,,
+mn,,,
+mo,,,
+mode,,,
+moment,,,
+momentabout,,,
+mover,,,
+mpadded,,,
+mphantom,,,
+mprescripts,,,
+mroot,,,
+mrow,,,
+ms,,,
+mscarries,,,
+mscarry,,,
+msgroup,,,
+msline,,,
+mspace,,,
+msqrt,,,
+msrow,,,
+mstack,,,
+mstyle,,,
+msub,,,
+msubsup,,,
+msup,,,
+mtable,,,
+mtd,,,
+mtext,,,
+mtr,,,
+munder,,,
+munderover,,,
+naturalnumbers,,,
+neq,,,
+none,,,
+not,,,
+notanumber,,,
+notin,,,
+notprsubset,,,
+notsubset,,,
+or,,,
+otherwise,,,
+outerproduct,,,
+partialdiff,,,
+pi,,,
+piece,,,
+piecewise,,,
+plus,,,
+power,,,
+primes,,,
+product,,,
+prsubset,,,
+quotient,,,
+rationals,,,
+real,,,
+reals,,,
+reln,,,
+rem,,,
+root,,,
+scalarproduct,,,
+sdev,,,
+sec,,,
+sech,,,
+selector,,,
+semantics,,,
+sep,,,
+set,,,
+setdiff,,,
+share,,,
+sin,,,
+sinh,,,
+subset,,,
+sum,,,
+tan,,,
+tanh,,,
+tendsto,,,
+times,,,
+transpose,,,
+true,,,
+union,,,
+uplimit,,,
+variance,,,
+vector,,,
+vectorproduct,,,
+xor,,,
+%</ns-mathml>
+%    \end{macrocode}
+% \section{Rule naming}
+% \begin{macro}{\c_@@_role_rules_prop}
+% These two properties map the rule strings to numbers and back.
+% There are in tagpdf-data.dtx near the csv files for easier maintainance.
+%    \begin{macrocode}
+%<*package>
+\prop_const_from_keyval:Nn \c_@@_role_rules_prop
+ {
+    0..n = 1,
+    0..1 = 2,
+    1    = 3, %StructTreeRoot, not really needed
+    [a]  = 4, %ruby
+    [b]  = 5, %warichu
+    c    = 6, % WP ??
+    ‡    = 7, % Part,Div,NonStruct -> "check parent"
+    ∅*   = 8, % or negative by default?
+    ∅    = -1,
+ }
+%in debug??
+\prop_const_from_keyval:Nn \c_@@_role_rules_num_prop
+ {
+   1 = 0..n,
+   2 = 0..1,
+   3 = 1   , %StructTreeRoot, not really needed
+   4 = [a] , %ruby
+   5 = [b] , %warichu
+   6 = c   , % WP ??
+   7 = ‡   , % Part,Div,NonStruct -> "check parent"
+   8 = ∅*  , % or negative by default?
+  -1 = ∅ ,
+ }
+%</package>
+%    \end{macrocode}
+% \end{macro}
+% \section{The parent-child rules for pdf <2.0}
+% This csv contains the parent-child matrix for pdf <2.0.
+% The values are currently the strings used in the PDF reference.
+% This will perhaps change in future.
+%    \begin{macrocode}
+%<*parent-child>
+%% \ProvidesExplFile {tagpdf-parent-child.csv} {2022-12-22} {0.98}
+,,,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,∅,∅
+Part,both,grouping,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,0..n,0..n,∅,0..n,∅,0..n,∅,∅,∅,∅,0..n,∅,∅*,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,0..n,0..n,0..n,∅
+Div,both,grouping,∅,0..n,0..n,‡,‡,0..n,0..n,‡,0..n,0..n,0..n,0..n,∅,0..n,∅,0..n,∅,∅,∅,∅,0..n,∅,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,0..n,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Sect,both,grouping,∅,0..n,0..n,‡,‡,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,∅,∅
+BlockQuote,1.7,grouping?,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,∅,0..n,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,0..n,0..n,0..n,∅
+NonStruct,both,grouping,∅,0..n,0..n,‡,‡,0..n,0..n,‡,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅
+TOC,1.7,grouping,∅,0..n,0..n,‡,‡,0..n,0..n,‡,0..n,0..n,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+TOCI,1.7,TOC,∅,∅,∅,‡,‡,∅,∅,‡,0..n,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+Index,1.7,grouping?,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,∅,0..n,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Private,1.7,grouping,∅,0..n,0..n,‡,‡,0..n,0..n,‡,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅
+P,both,block,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,0..n,0..n,0..n,∅,0..n,∅,0..n,∅,∅,∅,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Hn,both,block,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+H,both,block,∅,0..1,0..1,‡,‡,0..1,0..1,‡,∅,∅,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..1,∅,∅,0..1,0..1,∅,∅,∅,0..1,0..1,0..1,∅
+Quote,1.7,inline,∅,∅,∅,‡,‡,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Note,1.7,inline,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Reference,1.7,inline,∅,∅,∅,‡,‡,∅,0..n,‡,∅,0..n,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅*,∅*,∅,0..n,0..n,0..n,∅,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+BibEntry,1.7,inline,∅,∅,∅,‡,‡,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Lbl,both,inline,∅,∅,0..n,‡,‡,0..n,0..n,‡,∅,0..n,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Code,1.7,inline,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Span,both,inline,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Link,both,grouping!block!inline,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Annot,both,grouping!block!inline,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Form,both,grouping!block!inline,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,∅*,∅*,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Ruby,both,inline,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+RB,both,inline,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,[a],∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+RT,both,inline,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,[a],∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+RP,both,inline,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,[a],∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+Warichu,both,inline,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+WT,both,inline,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,[b],∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+WP,both,inline,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,[b],∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+L,both,block!inline,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,0..n,0..n,∅,0..n,∅,∅,0..n,∅,∅,∅,∅,∅,∅*,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,0..n,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+LI,both,in L,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+LBody,both,in LI,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+Table,both,block,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,0..n,0..n,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+TR,both,Table,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,∅,∅
+TH,both,Table,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅
+TD,both,Table,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅
+THead,both,Table,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..1,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+TBody,both,Table,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+TFoot,both,Table,∅,∅,∅,∅,‡,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..1,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅
+Caption,both,grouping!block,∅,∅,0..n,‡,‡,0..n,0..1,‡,0..1,0..1,0..n,0..n,∅,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,0..1,∅,∅,∅,∅,∅,∅,∅,0..1,∅,0..1,0..1,∅,∅,∅,∅,∅,∅,∅,0..1,0..1,∅
+Figure,both,grouping!block!inline,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅*,∅,∅,∅,∅,∅,∅,c,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+Formula,both,grouping!block!inline,∅,0..n,0..n,‡,‡,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+MC,both,---,∅,∅,∅,∅,∅,∅,0..n,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,‡,‡,‡,0..n,‡,‡,∅,0..n,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅
+%</parent-child>
+%    \end{macrocode}
+% \section{The parent-child rules for pdf <2.0}
+% This csv contains the parent-child matrix for pdf <2.0.
+% The values are currently the strings used in the PDF reference.
+% This will perhaps change in future.
+%    \begin{macrocode}
+%<*parent-child-2>
+%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2022-12-22} {0.98}
+,,,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,∅
+Art,1.7,grouping,∅,0..n,0..n,∅,‡,‡,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,0..n,∅,∅,∅,0..n,∅
+Part,both,grouping,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅,0..n,∅,∅,∅,∅,0..n,∅,∅,∅,∅*,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Div,both,grouping,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,∅,0..n,∅,∅,∅,∅,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,0..n,∅,0..n,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Sect,both,grouping,∅,0..n,0..n,0..n,‡,‡,0..n,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,0..n,∅,∅,∅,0..n,∅
+Aside,2.0,grouping,∅,0..n,0..n,0..n,‡,‡,0..n,∅,∅,‡,∅,∅,∅,0..n,0..n,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+BlockQuote,1.7,grouping?,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,∅,0..n,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+NonStruct,both,grouping,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,∅
+TOC,1.7,grouping,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,0..n,0..n,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+TOCI,1.7,TOC,∅,∅,∅,∅,‡,‡,∅,∅,∅,‡,0..n,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+Index,1.7,grouping?,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,∅,0..n,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Private,1.7,grouping,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,∅
+P,both,block,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,0..n,0..n,0..n,0..n,∅,∅,0..n,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Hn,both,block,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+H,both,block,∅,0..1,0..1,0..1,‡,‡,0..1,0..1,0..1,‡,∅,∅,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..1,∅,∅,0..1,0..1,∅,∅,∅,0..1,0..1,0..1,∅,∅,0..1,∅
+Title,2.0,grouping!block,∅,0..n,0..n,0..n,‡,‡,0..n,∅,0..n,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+Sub,2.0,inline,∅,∅,∅,∅,‡,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,0..n,∅*,0..n,∅,∅,0..n,∅
+Quote,1.7,inline,∅,∅,∅,∅,‡,‡,∅,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Note,1.7,inline,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Reference,1.7,inline,∅,∅,∅,∅,‡,‡,∅,0..n,0..n,‡,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅*,∅*,∅,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+BibEntry,1.7,inline,∅,∅,∅,∅,‡,‡,∅,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Lbl,both,inline,∅,∅,∅,0..n,‡,‡,0..n,0..n,0..n,‡,∅,0..n,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,0..n,∅,0..n,∅,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Code,1.7,inline,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,∅*,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Em,2.0,inline,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Strong,2.0,inline,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Span,both,inline,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Link,both,grouping!block!inline,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Annot,both,grouping!block!inline,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Form,both,grouping!block!inline,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅*,∅*,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Ruby,both,inline,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+RB,both,inline,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,[a],∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+RT,both,inline,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,[a],∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+RP,both,inline,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,[a],∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+Warichu,both,inline,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+WT,both,inline,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,[b],∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+WP,both,inline,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,[b],∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+FENote,2.0,grouping!block!inline,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+L,both,block!inline,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,0..n,0..n,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+LI,both,in L,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+LBody,both,in LI,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+Table,both,block,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+TR,both,Table,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,∅,∅,∅,0..n,∅
+TH,both,Table,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+TD,both,Table,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+THead,both,Table,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..1,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+TBody,both,Table,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+TFoot,both,Table,∅,∅,∅,∅,∅,‡,∅,∅,∅,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..1,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅
+Caption,both,grouping!block,∅,∅,∅,0..n,‡,‡,0..n,0..1,0..1,‡,0..1,0..1,0..n,0..n,0..1,∅,∅,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅*,0..1,∅,∅,∅,∅,∅,∅,∅,∅*,0..1,∅,0..1,0..1,∅,∅,∅,∅,∅,∅,∅,0..1,0..1,∅,∅,0..n,∅
+Figure,both,grouping!block!inline,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,∅*,∅,∅,∅,∅,∅,∅,c,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Formula,both,grouping!block!inline,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,∅*,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,∅,0..n,∅
+Artifact,2.0,grouping!block!inline,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,0..n,0..n,0..n,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,∅,∅,0..n,∅
+math,2.0,?,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,∅
+mathml,2.0,?,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,0..n,0..n,∅
+MC,both,---,∅,∅,∅,∅,∅,∅,∅,0..n,0..n,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,0..n,‡,‡,‡,0..n,‡,‡,0..n,∅,0..n,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,0..n,∅,0..n,0..n,∅
+%</parent-child-2>
+% \end{implementation}
+% \PrintIndex


Property changes on: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-data.dtx
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-generic.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-generic.dtx	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-generic.dtx	2022-12-23 21:05:03 UTC (rev 65341)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.97, released 2022-08-24}
+% \date{Version 0.98, released 2022-12-22}
 % \maketitle
 % \begin{documentation}
 % \end{documentation}
@@ -55,11 +55,11 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*generic>
-\ProvidesExplPackage {tagpdf-mc-code-generic} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdf-mc-code-generic} {2022-12-22} {0.98}
  {part of tagpdf - code related to marking chunks - generic mode}
 %</generic>
 %<*debug>
-\ProvidesExplPackage {tagpdf-debug-generic} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdf-debug-generic} {2022-12-22} {0.98}
  {part of tagpdf - debugging code related to marking chunks - generic mode}
 %</debug>
 %    \end{macrocode}
@@ -683,6 +683,11 @@
         \group_begin: %hm
         \@@_check_mc_if_nested:
         \bool_gset_true:N \g_@@_in_mc_bool
+%    \end{macrocode}
+% set default MC tags to structure:
+%    \begin{macrocode}
+        \tl_set_eq:NN \l_@@_mc_key_tag_tl \g_@@_struct_tag_tl
+        \tl_gset_eq:NN\g_@@_mc_key_tag_tl \g_@@_struct_tag_tl        
         \keys_set:nn { @@ / mc } {#1}
         \bool_if:NTF \l_@@_mc_artifact_bool
           { %handle artifact
@@ -703,6 +708,23 @@
               }
             \bool_if:NF \l_@@_mc_key_stash_bool
               {
+                \exp_args:NV\@@_struct_get_tag_info:nNN 
+                    \g_@@_struct_stack_current_tl 
+                    \l_@@_tmpa_tl
+                    \l_@@_tmpb_tl
+                 \@@_check_parent_child:VVnnN
+                 \l_@@_tmpa_tl \l_@@_tmpb_tl
+                 {MC}{}
+                 \l_@@_parent_child_check_tl 
+                \int_compare:nNnT {\l_@@_parent_child_check_tl}<{0}
+                 {
+                    \msg_warning:nnxxx 
+                     { tag } 
+                     {role-parent-child} 
+                     { \g_@@_struct_tag_tl/\g_@@_struct_tag_NS_tl  } 
+                     { MC~(=~real content) }
+                     { 'not~allowed'. }  
+                 }    
                 \@@_mc_handle_stash:x { \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	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-luacode.dtx	2022-12-23 21:05:03 UTC (rev 65341)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.97, released 2022-08-24}
+% \date{Version 0.98, released 2022-12-22}
 % \maketitle
 % \begin{implementation}
 % The code is splitted into three parts: code shared by all engines,
@@ -86,7 +86,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*luamode>
-\ProvidesExplPackage {tagpdf-mc-code-lua} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdf-mc-code-lua} {2022-12-22} {0.98}
   {tagpdf - mc code only for the luamode }
 %</luamode>
 %    \end{macrocode}
@@ -182,8 +182,7 @@
 %    ,\@@_mc_lua_set_mc_type_attr:o
 %    ,\@@_mc_lua_unset_mc_type_attr:
 %  }
-% This takes a tag name, and sets the attributes to the related number.
-% It is not decided yet if this will be global or local, see the global-mc option.
+% This takes a tag name, and sets the attributes globally to the related number.
 %    \begin{macrocode}
 \cs_new:Nn \@@_mc_lua_set_mc_type_attr:n % #1 is a tag name
   {
@@ -300,6 +299,15 @@
         \bool_set_false:N\l_@@_mc_artifact_bool
         \tl_clear:N \l_@@_mc_key_properties_tl
         \int_gincr:N \c at g_@@_MCID_abs_int
+%    \end{macrocode}
+% set the default tag to the structure:
+%    \begin{macrocode}
+        \tl_set_eq:NN \l_@@_mc_key_tag_tl \g_@@_struct_tag_tl
+        \tl_gset_eq:NN\g_@@_mc_key_tag_tl \g_@@_struct_tag_tl  
+        \lua_now:e
+          {
+            ltx.@@.func.store_mc_data(\@@_get_mc_abs_cnt:,"tag","\g_@@_struct_tag_tl")
+          }                     
         \keys_set:nn { @@ / mc }{ label={}, #1 }
         %check that a tag or artifact has been used
         \@@_check_mc_tag:N \l_@@_mc_key_tag_tl
@@ -315,6 +323,23 @@
            % if not stashed record the absolute number
             \bool_if:NF \l_@@_mc_key_stash_bool
               {
+                \exp_args:NV\@@_struct_get_tag_info:nNN 
+                    \g_@@_struct_stack_current_tl 
+                    \l_@@_tmpa_tl
+                    \l_@@_tmpb_tl               
+                \@@_check_parent_child:VVnnN
+                 \l_@@_tmpa_tl \l_@@_tmpb_tl
+                 {MC}{}
+                 \l_@@_parent_child_check_tl 
+                \int_compare:nNnT {\l_@@_parent_child_check_tl}<{0}
+                 {
+                   \msg_warning:nnxxx 
+                     { tag } 
+                     {role-parent-child} 
+                     { \g_@@_struct_tag_tl/\g_@@_struct_tag_NS_tl  } 
+                     { MC~(=~real content) }
+                     { 'not~allowed'. } 
+                 }    
                 \@@_mc_handle_stash:x { \@@_get_mc_abs_cnt: }
               }
           }

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-shared.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-shared.dtx	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-shared.dtx	2022-12-23 21:05:03 UTC (rev 65341)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.97, released 2022-08-24}
+% \date{Version 0.98, released 2022-12-22}
 % \maketitle
 % \begin{documentation}
 % \section{Public Commands}
@@ -174,7 +174,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-mc-code-shared} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdf-mc-code-shared} {2022-12-22} {0.98}
   {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	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx	2022-12-23 21:05:03 UTC (rev 65341)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.97, released 2022-08-24}
+% \date{Version 0.98, released 2022-12-22}
 % \maketitle
 % \begin{documentation}
 % \begin{function}
@@ -55,32 +55,35 @@
 %    tag (rolemap-key),
 %    namespace (rolemap-key),
 %    role (rolemap-key),
-%    role-namespace (rolemap-key)
+%    role-namespace (rolemap-key),
 %  }
-% This key can be used in \cs{tagpdfsetup} to declare and rolemap new tags.
+% The \texttt{add-new-tag} key can be used in \cs{tagpdfsetup} to declare and rolemap new tags.
 % It takes as value a key-value list or a simple |new-tag/old-tag|.
 %
 % The key-value list knows the following keys:
 % \begin{description}
-% \item[\texttt{tag}] This is the name of the new type as it should then be used in \cs{tagstructbegin}.
-% \item[\texttt{namespace}] This is the namespace of the new type.
+% \item[\texttt{tag}] This is the name of the new tag as it should 
+% then be used in \cs{tagstructbegin}.
+% \item[\texttt{namespace}] This is the namespace of the new tag.
 %   The value should be a shorthand of a namespace.
-%   The allowed values are currently |pdf|, |pdf2|, |mathml| and |user|.
+%   The allowed values are currently |pdf|, |pdf2|, |mathml|,|latex|, |latex-book| and |user|.
 %   The default value (and recommended value for a new tag) is |user|.
 %   The public name of the user namespace is |tag/NS/user|. This can be used to reference
 %   the namespace e.g. in attributes.
-% \item[\texttt{role}] This is the type the tag should be mapped too.
-%  In a PDF 1.7 or earlier this is normally a type from the |pdf| set,
+% \item[\texttt{role}] This is the tag the tag should be mapped too.
+%  In a PDF 1.7 or earlier this is normally a tag from the |pdf| set,
 %  in PDF 2.0 from the |pdf|, |pdf2| and |mathml| set.
-%  It can also be a user type, or a still unknown type.
+%  It can also be a user tag. The tag must be declared before, as the code retrieves
+%  the class of the new tag from it. 
 %  The PDF format allows mapping to be done transitively.
 %  But tagpdf can't/won't check such unusual role mapping.
-% \item[\texttt{role-namespace}] If the role is a known type
-%  the default value is the default namespace of this type.
-%  If the role is unknown, |user| is used and
-%  the code hopes that the type will be defined later. With this key a specific
-%  namespace can be forced.
+% \item[\texttt{role-namespace}] If the role is a known tag
+%  the default value is the default namespace of this tag.
+%  With this key a specific namespace can be forced.  
 % \end{description}
+% 
+% Namespaces are mostly a PDF 2.0 property, but it doesn't harm to 
+% set them also in a PDF 1.7 or earlier.
 % \end{function}
 % \end{documentation}
 % \begin{implementation}
@@ -87,74 +90,187 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-roles-code} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdf-roles-code} {2022-12-22} {0.98}
  {part of tagpdf - code related to roles and structure names}
 %</header>
 %    \end{macrocode}
 % \section{Code related to roles and structure names}
-% \subsection{Variables}
-% Tags have both a name (a string) and a number (for the lua attribute).
-% Testing a name is easier with a prop, while accessing with a number is
-% better done with a seq. So both are used and must be kept in sync if a new
-% tag is added. The number is only relevant for the MC type, tags with the same
-% name from different names spaces can have the same number.
-% \begin{variable}{\g_@@_role_tags_seq,\g_@@_role_tags_prop}
 %    \begin{macrocode}
 %<*package>
-\@@_seq_new:N  \g_@@_role_tags_seq  %to get names (type/NS) from numbers
-\@@_prop_new:N \g_@@_role_tags_prop %to get numbers  from names (type/NS)
 %    \end{macrocode}
-% \end{variable}
+%
+% 
+% \subsection{Variables}
+% Tags are used in structures (\cs{tagstructbegin}) and mc-chunks (\cs{tagmcbegin}). 
+% 
+% They have a name (a string), in lua a number (for the lua attribute), and 
+% in PDF 2.0 belong to one or more name spaces, with one being the default
+% name space.
+% 
+% Tags of structures are classified, e.g. as grouping, 
+% inline or block level structure (and a few special classes like lists and tables),
+% and must follow containments rules depending on their classification 
+% (for example a inline structure can not contain
+% a block level structure). New tags inherit their 
+% classification from their rolemapping to the standard namespaces (\texttt{pdf} 
+% and/or \texttt{pdf2}). 
+% We store this classification as it will probably 
+% be needed for tests but currently the data is not much used. 
+% The classification for math (and the containment rules) 
+% is unclear currently and so not set.
+% 
+% The attribute number is only relevant in lua and only for the MC chunks 
+% (so tags with the same name from different names spaces can have the same number), 
+% and so only stored if luatex is detected. 
+% 
+% Due to the namespaces the storing and processing of tags and there data
+% are different in various places for PDF~2.0 and PDF~<2.0, which makes 
+% things a bit difficult and leads to some duplications. Perhaps at some time
+% there should be a clear split.
+% 
+% This are the main variables used by the code:
+% \begin{description}
+% \item[\cs{g_@@_role_tags_NS_prop}] 
+% This is the core list of tag names. It uses tags as keys
+% and the shorthand (e.g. pdf2, or mathml) of the default name space as value. 
+% 
+% In pdf 2.0 the value is needed in the structure dictionaries.
+% 
+% \item[\cs{g_@@_role_tags_class_prop}]
+% This contains for each tag a classification type. It is used in pdf <2.0.
+% 
+% \item[\cs{g_@@_role_NS_prop}] This contains the names spaces. The
+% values are the object references. They are used in pdf 2.0.
+%
+% \item[\cs{g_@@_role_rolemap_prop}]
+% This contains for each tag the role to a standard tag. 
+% It is used in pdf<2.0 for tag checking and to fill at the end the 
+% RoleMap dictionary.
+% 
+% \item[\texttt{g\_@@\_role/RoleMap\_dict}] This dictionary contains 
+% the standard rolemaps. It is relevant only for pdf <2.0. 
+% 
+% \item[\cs{g_@@_role_NS_<ns>_prop}] This prop contains the tags of
+% a name space and their role. The props are also use for 
+% remapping. As value they contain two brace groups: tag and namespace.
+% In pdf <2.0 the namespace is empty. 
+% 
+% \item[\cs{g_@@_role_NS_<ns>_class_prop}]   
+% This prop contains the tags of
+% a name space and their type. The value is only needed for pdf 2.0.      
+% 
+% \item[\cs{g_@@_role_index_prop}]   
+% This prop contains the standard tags (pdf in pdf<2.0,
+% pdf,pdf2 + mathml in pdf 2.0) as keys, the values are a two-digit
+% number. These numbers are used to get the containment rule of two tags
+% from the intarray.
+% 
+%\item[\cs{l_@@_role_debug_prop}] This property is used to pass some info
+% around for info messages or debugging.      
+% \end{description} 
+%
+%
 % \begin{variable}{\g_@@_role_tags_NS_prop}
-% in pdf 2.0 tags belong to a name space. For every tag we store a default
-% name space.
-% The keys are the tags, the value shorthands like pdf2, or mathml.
+% This is the core list of tag names. It uses tags as keys
+% and the shorthand (e.g. pdf2, or mathml) of the default name space as value.
+% We store the default name space also in pdf <2.0, even if not needed: 
+% it doesn't harm and simplifies the code. 
 % There is no need to access this from lua, so we use the standard prop commands.
 %    \begin{macrocode}
-\prop_new:N    \g_@@_role_tags_NS_prop %to namespace info
+\prop_new:N    \g_@@_role_tags_NS_prop 
 %    \end{macrocode}
 % \end{variable}
+%
+% \begin{variable}{\g_@@_role_tags_class_prop}
+% With pdf 2.0 we store the class in the NS dependant props. 
+% With pdf <2.0 we store for now the type(s) of a tag in a common
+% prop. 
+% Tags that are rolemapped should get the type from
+% the target.
+%    \begin{macrocode}
+\prop_new:N    \g_@@_role_tags_class_prop 
+%    \end{macrocode}
+% \end{variable}
+% 
 % \begin{variable}{\g_@@_role_NS_prop}
-% The standard names spaces are the following. The keys are the name
-% tagpdf will use,  the urls are the identifier in the namespace object.
+% This holds the list of supported name spaces.
+% The keys are the name tagpdf will use, the values the object reference. 
+% The urls identifier are stored in related dict object.
 % \begin{description}
 % \item[mathml] http://www.w3.org/1998/Math/MathML
 % \item[pdf2]   http://iso.org/pdf2/ssn
 % \item[pdf]    http://iso.org/pdf/ssn (default)
 % \item[user]   \cs{c_@@_role_userNS_id_str} (random id, for user tags)
+% \item[latex]  https://www.latex-project.org/ns/dflt/2022
+% \item[latex-book] https://www.latex-project.org/ns/book/2022
+% \item[latex-inline]     https://www.latex-project.org/ns/inline/2022
 % \end{description}
 % More namespaces are possible and
-% their objects references and the ones of the namespaces must be collected
+% their objects references and their rolemaps must be collected
 % so that an array can be written to the StructTreeRoot at the end (see tagpdf-tree).
-% We use a prop to store also the object reference as it will be needed rather
+% We use a prop to store the object reference as it will be needed rather
 % often.
 %    \begin{macrocode}
-\prop_new:N \g_@@_role_NS_prop % collect namespaces
+\prop_new:N \g_@@_role_NS_prop 
 %    \end{macrocode}
 % \end{variable}
-%
-% We need also a bunch of temporary variables:
+% 
+% \begin{variable}{\g_@@_role_index_prop}
+% This prop contains the standard tags (pdf in pdf<2.0,
+% pdf,pdf2 + mathml in pdf 2.0) as keys, the values are a two-digit
+% number. These numbers are used to get the containment rule of two tags
+% from the intarray.
+%    \begin{macrocode}
+\prop_new:N \g_@@_role_index_prop
+%    \end{macrocode}
+% \end{variable}
+% \begin{variable}{\l_@@_role_debug_prop}
+% This variable is used to pass more infos to debug messages. 
+%    \begin{macrocode}
+\prop_new:N \l_@@_role_debug_prop
+%    \end{macrocode}
+% \end{variable}
+% We need also a bunch of temporary variables.
 % \begin{variable}
 %  {
-%     \l_@@_role_tag_tmpa_tl
+%     ,\l_@@_role_tag_tmpa_tl
 %     ,\l_@@_role_tag_namespace_tmpa_tl
 %     ,\l_@@_role_role_tmpa_tl
-%     ,\l_@@_role_role_namespace_tmpa_tl
+%     ,\l_@@_role_role_namespace_tmpa_tl      
+%     ,\l_@@_role_tmpa_seq
 %  }
 %    \begin{macrocode}
 \tl_new:N \l_@@_role_tag_tmpa_tl
 \tl_new:N \l_@@_role_tag_namespace_tmpa_tl
 \tl_new:N \l_@@_role_role_tmpa_tl
-\tl_new:N \l_@@_role_role_namespace_tmpa_tl
+\tl_new:N \l_@@_role_role_namespace_tmpa_tl  
+\seq_new:N\l_@@_role_tmpa_seq
 %    \end{macrocode}
 % \end{variable}
-% \subsection{Namesspaces}
-% The following commands setups a names space. Namespace dictionaries can
+% 
+% \subsection{Namespaces}
+% The following commands setups a name space. 
+% With pdf version $<$2.0 this is only a prop with the 
+% rolemap. With pdf 2.0 a dictionary must be set up. 
+% Such a name space dictionaries can
 % contain an optional |/Schema| and |/RoleMapNS| entry. We only reserve the
 % objects but delay the writing to the finish code, where we can test if the
-% keys and the name spaces are actually needed
+% keys and the name spaces are actually needed.
 % This commands setups objects for the name space and its rolemap. It also
-% initialize a prop to collect the rolemaps if needed.
+% initialize a dict to collect the rolemaps if needed, and a property
+% with the tags of the name space and their rolemapping for loops.
+% It is unclear if a reference to a schema file will be ever needed, 
+% but it doesn't harm \ldots.
+% 
+% \begin{variable}{g_@@_role/RoleMap_dict,\g_@@_role_rolemap_prop}
+% This is the object which contains the normal RoleMap. It is probably not
+% needed in pdf 2.0 but currently kept.
+%    \begin{macrocode}
+\pdfdict_new:n {g_@@_role/RoleMap_dict}
+\prop_new:N \g_@@_role_rolemap_prop
+%    \end{macrocode}
+% \end{variable}
+% 
 % \begin{function}{\@@_role_NS_new:nnn}
 %  \begin{syntax}
 %   \cs{@@_role_NS_new:nnn}\Arg{shorthand}\Arg{URI-ID}{Schema}
@@ -162,38 +278,51 @@
 % \end{function}
 % \begin{macro}{\@@_role_NS_new:nnn}
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_role_NS_new:nnn #1 #2 #3
-  {
-    \pdf_object_new:n {tag/NS/#1}
-    \pdfdict_new:n     {g_@@_role/Namespace_#1_dict}
-    \pdf_object_new:n {@@/RoleMapNS/#1}
-    \pdfdict_new:n     {g_@@_role/RoleMapNS_#1_dict}
-    \pdfdict_gput:nnn
-      {g_@@_role/Namespace_#1_dict}
-      {Type}
-      {/Namespace}
-    \pdf_string_from_unicode:nnN{utf8/string}{#2}\l_tmpa_str
-    \tl_if_empty:NF \l_tmpa_str
-      {
-        \pdfdict_gput:nnx
-          {g_@@_role/Namespace_#1_dict}
-          {NS}
-          {\l_tmpa_str}
-      }
-    %RoleMapNS is added in tree
-    \tl_if_empty:nF  {#3}
-     {
-       \pdfdict_gput:nnx{g_@@_role/Namespace_#1_dict}
-        {Schema}{#3}
-     }
-    \prop_gput:Nnx \g_@@_role_NS_prop {#1}{\pdf_object_ref:n{tag/NS/#1}~}
-  }
+\pdf_version_compare:NnTF < {2.0}
+ {
+   \cs_new_protected:Npn \@@_role_NS_new:nnn #1 #2 #3
+    {
+      \prop_new:c { g_@@_role_NS_#1_prop }
+      \prop_new:c { g_@@_role_NS_#1_class_prop }
+      \prop_gput:Nnx \g_@@_role_NS_prop {#1}{}
+    }
+ }
+ {
+  \cs_new_protected:Npn \@@_role_NS_new:nnn #1 #2 #3
+    {
+      \prop_new:c { g_@@_role_NS_#1_prop }
+      \prop_new:c { g_@@_role_NS_#1_class_prop }
+      \pdf_object_new:n {tag/NS/#1}      
+      \pdfdict_new:n     {g_@@_role/Namespace_#1_dict}
+      \pdf_object_new:n {@@/RoleMapNS/#1}
+      \pdfdict_new:n     {g_@@_role/RoleMapNS_#1_dict}
+      \pdfdict_gput:nnn
+        {g_@@_role/Namespace_#1_dict}
+        {Type}
+        {/Namespace}
+      \pdf_string_from_unicode:nnN{utf8/string}{#2}\l_@@_tmpa_str
+      \tl_if_empty:NF \l_@@_tmpa_str
+        {
+          \pdfdict_gput:nnx
+            {g_@@_role/Namespace_#1_dict}
+            {NS}
+            {\l_@@_tmpa_str}
+        }
+      %RoleMapNS is added in tree
+      \tl_if_empty:nF  {#3}
+       {
+         \pdfdict_gput:nnx{g_@@_role/Namespace_#1_dict}
+          {Schema}{#3}
+       }
+      \prop_gput:Nnx \g_@@_role_NS_prop {#1}{\pdf_object_ref:n{tag/NS/#1}~}
+    }
+ }  
 %    \end{macrocode}
 % \end{macro}
 % We need an id for the user space. For the tests it should be possible
 % to set it to a fix value. So we use random numbers which can
 % be fixed by setting a seed. We fake a sort of
-% GUID but not try to be really exact as it doesn't matter ...
+% GUID but do not try to be really exact as it doesn't matter ...
 %
 % \begin{variable}{\c_@@_role_userNS_id_str}
 %    \begin{macrocode}
@@ -213,423 +342,126 @@
   }
 %    \end{macrocode}
 % \end{variable}
-% Now we setup the standard names spaces. Currently only if we detect pdf2.0 but
-% this will perhaps have to change if the structure code gets to messy.
+% Now we setup the standard names spaces. 
+% The mathml space is currently only loaded for pdf 2.0.
 %    \begin{macrocode}
-\pdf_version_compare:NnT > {1.9}
-  {
-    \@@_role_NS_new:nnn {pdf}   {http://iso.org/pdf/ssn}{}
-    \@@_role_NS_new:nnn {pdf2}  {http://iso.org/pdf2/ssn}{}
+\@@_role_NS_new:nnn {pdf}   {http://iso.org/pdf/ssn}{}
+\@@_role_NS_new:nnn {pdf2}  {http://iso.org/pdf2/ssn}{}
+\pdf_version_compare:NnF < {2.0}
+  {    
     \@@_role_NS_new:nnn {mathml}{http://www.w3.org/1998/Math/MathML}{}
-    %\@@_role_NS_new:nnn {latex} {https://www.latex-project.org/ns/2022}{}
-    \exp_args:Nnx
-    \@@_role_NS_new:nnn {user}{\c_@@_role_userNS_id_str}{}
-  }
+  }  
+\@@_role_NS_new:nnn {latex} {https://www.latex-project.org/ns/dflt/2022}{}
+\@@_role_NS_new:nnn {latex-book} {https://www.latex-project.org/ns/book/2022}{}
+\@@_role_NS_new:nnn {latex-inline} {https://www.latex-project.org/ns/inline/2022}{}
+\exp_args:Nnx
+  \@@_role_NS_new:nnn {user}{\c_@@_role_userNS_id_str}{}
 %    \end{macrocode}
 %
-% \subsection{Data}
-% In this section we setup the standard data.
-% At first the list of structure types. We split them in three lists,
-% the tags with which are both in the pdf and pdf2 namespace,
-% the one only in pdf and the one with the tags only in pdf2.
-% We also define a rolemap for the pdfII only type to pdf so that
-% they can always be used.
-% \begin{variable}
-%   {
-%     \c_@@_role_sttags_pdf_pdfII_clist,
-%     \c_@@_role_sttags_only_pdf_clist,
-%     \c_@@_role_sttags_only_pdfII_clist,
-%     \c_@@_role_sttags_mathml_clist,
-%     \c_@@_role_sttags_pdfII_to_pdf_prop
-%   }
+% \subsection{Adding a new tag}
+% Both when reading the files and when setting up a tag manually
+% we have to store data in various places.
+% 
+% \begin{macro}{\@@_role_alloctag:nnn}
+% This command allocates a new tag without role mapping. In the 
+% lua backend it will also record the attribute value.
 %    \begin{macrocode}
-%
-\clist_const:Nn \c_@@_role_sttags_pdf_pdfII_clist
+\pdf_version_compare:NnTF < {2.0}
   {
-    Document,   %A complete document. This is the root element
-                %of any structure tree containing
-                %multiple parts or multiple articles.
-    Part,       %A large-scale division of a document.
-    Sect,       %A container for grouping related content elements.
-    Div,        %A generic block-level element or group of elements
-    Caption,    %A brief portion of text describing a table or figure.
-    Index,
-    NonStruct,  %probably not needed
-    H,
-    H1,
-    H2,
-    H3,
-    H4,
-    H5,
-    H6,
-    P,
-    L,           %list
-    LI,          %list item (around label and list item body)
-    Lbl,         %list label
-    LBody,       %list item body
-    Table,
-    TR,          %table row
-    TH,          %table header cell
-    TD,          %table data cell
-    THead,       %table header (n rows)
-    TBody,       %table rows
-    TFoot,       %table footer
-    Span,        %generic inline marker
-    Link,        %
-    Annot,
-    Figure,
-    Formula,
-    Form,
-    % ruby warichu etc ..
-    Ruby,
-    RB,
-    RT,
-    Warichu,
-    WT,
-    WP,
-    Artifact % only MC-tag ?...
+   \sys_if_engine_luatex:TF
+    {
+      \cs_new_protected:Npn \@@_role_alloctag:nnn #1 #2 #3 %#1 tagname, ns, type
+       {
+         \lua_now:e { ltx.@@.func.alloctag ('#1') }
+         \prop_gput:Nnn \g_@@_role_tags_NS_prop   {#1}{#2}
+         \prop_gput:cnn {g_@@_role_NS_#2_prop}  {#1}{{}{}}
+         \prop_gput:Nnn \g_@@_role_tags_class_prop {#1}{#3}
+         \prop_gput:cnn {g_@@_role_NS_#2_class_prop}  {#1}{--UNUSED--}
+       }      
+    }
+    {   
+      \cs_new_protected:Npn \@@_role_alloctag:nnn #1 #2 #3
+       {
+         \prop_gput:Nnn \g_@@_role_tags_NS_prop   {#1}{#2}
+         \prop_gput:cnn {g_@@_role_NS_#2_prop}  {#1}{{}{}}
+         \prop_gput:Nnn \g_@@_role_tags_class_prop {#1}{#3}
+         \prop_gput:cnn {g_@@_role_NS_#2_class_prop}  {#1}{--UNUSED--}
+       } 
+    }   
   }
-
-\clist_const:Nn \c_@@_role_sttags_only_pdf_clist
- {
-   Art,        %A relatively self-contained body of text
-               %constituting a single narrative or exposition
-   BlockQuote, %A portion of text consisting of one or more paragraphs
-               %attributed to someone other than the author of the
-               %surrounding text.
-   TOC,        %A list made up of table of contents item entries
-               %(structure tag TOCI; see below) and/or other
-               %nested table of contents entries
-   TOCI,       %An individual member of a table of contents.
-               %This entry's children can be any of the following structure  tags:
-               %Lbl,Reference,NonStruct,P,TOC
-   Index,
-   Private,
-   Quote,       %inline quote
-   Note,        %footnote, endnote. Lbl can be child
-   Reference,   %A citation to content elsewhere in the document.
-   BibEntry,    %bibentry
-   Code
- }
-
-\clist_const:Nn \c_@@_role_sttags_only_pdfII_clist
- {
-   DocumentFragment
-   ,Aside
-   ,H7
-   ,H8
-   ,H9
-   ,H10
-   ,Title
-   ,FENote
-   ,Sub
-   ,Em
-   ,Strong
-   ,Artifact
- }
-
-\clist_const:Nn \c_@@_role_sttags_mathml_clist
- {
-   abs
-   ,and
-   ,annotation
-   ,apply
-   ,approx
-   ,arccos
-   ,arccosh
-   ,arccot
-   ,arccoth
-   ,arccsc
-   ,arccsch
-   ,arcsec
-   ,arcsech
-   ,arcsin
-   ,arcsinh
-   ,arctan
-   ,arctanh
-   ,arg
-   ,bind
-   ,bvar
-   ,card
-   ,cartesianproduct
-   ,cbytes
-   ,ceiling
-   ,cerror
-   ,ci
-   ,cn
-   ,codomain
-   ,complexes
-   ,compose
-   ,condition
-   ,conjugate
-   ,cos
-   ,cosh
-   ,cot
-   ,coth
-   ,cs
-   ,csc
-   ,csch
-   ,csymbol
-   ,curl
-   ,declare
-   ,degree
-   ,determinant
-   ,diff
-   ,divergence
-   ,divide
-   ,domain
-   ,domainofapplication
-   ,emptyset
-   ,eq
-   ,equivalent
-   ,eulergamma
-   ,exists
-   ,exp
-   ,exponentiale
-   ,factorial
-   ,factorof
-   ,false
-   ,floor
-   ,fn
-   ,forall
-   ,gcd
-   ,geq
-   ,grad
-   ,gt
-   ,ident
-   ,image
-   ,imaginary
-   ,imaginaryi
-   ,implies
-   ,in
-   ,infinity
-   ,int
-   ,integers
-   ,intersect
-   ,interval
-   ,inverse
-   ,lambda
-   ,laplacian
-   ,lcm
-   ,leq
-   ,limit
-   ,ln
-   ,log
-   ,logbase
-   ,lowlimit
-   ,lt
-   ,maction
-   ,maligngroup
-   ,malignmark
-   ,math
-   ,matrix
-   ,matrixrow
-   ,max
-   ,mean
-   ,median
-   ,menclose
-   ,merror
-   ,mfenced
-   ,mfrac
-   ,mglyph
-   ,mi
-   ,min
-   ,minus
-   ,mlabeledtr
-   ,mlongdiv
-   ,mmultiscripts
-   ,mn
-   ,mo
-   ,mode
-   ,moment
-   ,momentabout
-   ,mover
-   ,mpadded
-   ,mphantom
-   ,mprescripts
-   ,mroot
-   ,mrow
-   ,ms
-   ,mscarries
-   ,mscarry
-   ,msgroup
-   ,msline
-   ,mspace
-   ,msqrt
-   ,msrow
-   ,mstack
-   ,mstyle
-   ,msub
-   ,msubsup
-   ,msup
-   ,mtable
-   ,mtd
-   ,mtext
-   ,mtr
-   ,munder
-   ,munderover
-   ,naturalnumbers
-   ,neq
-   ,none
-   ,not
-   ,notanumber
-   ,notin
-   ,notprsubset
-   ,notsubset
-   ,or
-   ,otherwise
-   ,outerproduct
-   ,partialdiff
-   ,pi
-   ,piece
-   ,piecewise
-   ,plus
-   ,power
-   ,primes
-   ,product
-   ,prsubset
-   ,quotient
-   ,rationals
-   ,real
-   ,reals
-   ,reln
-   ,rem
-   ,root
-   ,scalarproduct
-   ,sdev
-   ,sec
-   ,sech
-   ,selector
-   ,semantics
-   ,sep
-   ,set
-   ,setdiff
-   ,share
-   ,sin
-   ,sinh
-   ,subset
-   ,sum
-   ,tan
-   ,tanh
-   ,tendsto
-   ,times
-   ,transpose
-   ,true
-   ,union
-   ,uplimit
-   ,variance
-   ,vector
-   ,vectorproduct
-   ,xor
- }
-
-\prop_const_from_keyval:Nn \c_@@_role_sttags_pdfII_to_pdf_prop
   {
-    DocumentFragment = Art,
-    Aside = Note,
-    Title = H1,
-    Sub   = Span,
-    H7    = H6 ,
-    H8    = H6 ,
-    H9    = H6 ,
-    H10   = H6,
-    FENote= Note,
-    Em    = Span,
-    Strong= Span,
-  }
-%    \end{macrocode}
-% \end{variable}
-% We fill the structure tags in to the seq. We allow all pdf1.7 and pdf2.0,
-% and role map if needed the 2.0 tags.
-%    \begin{macrocode}
-% get tag name from number: \seq_item:Nn \g_@@_role_tags_seq { n }
-% get tag number from name: \prop_item:Nn \g_@@_role_tags_prop { name }
-
-\clist_map_inline:Nn \c_@@_role_sttags_pdf_pdfII_clist
-  {
-    \@@_seq_gput_right:Nn \g_@@_role_tags_seq { #1 }
-    \prop_gput:Nnn \g_@@_role_tags_NS_prop    { #1 }{ pdf2 }
-  }
-\clist_map_inline:Nn \c_@@_role_sttags_only_pdf_clist
-  {
-    \@@_seq_gput_right:Nn \g_@@_role_tags_seq { #1 }
-    \prop_gput:Nnn \g_@@_role_tags_NS_prop    { #1 }{ pdf }
-  }
-\clist_map_inline:Nn \c_@@_role_sttags_only_pdfII_clist
-  {
-    \@@_seq_gput_right:Nn \g_@@_role_tags_seq { #1 }
-    \prop_gput:Nnn \g_@@_role_tags_NS_prop    { #1 }{ pdf2 }
-  }
-\pdf_version_compare:NnT > {1.9}
-  {
-     \clist_map_inline:Nn \c_@@_role_sttags_mathml_clist
+   \sys_if_engine_luatex:TF
+    {
+      \cs_new_protected:Npn \@@_role_alloctag:nnn #1 #2 #3 %#1 tagname, ns, type
        {
-         \@@_seq_gput_right:Nn \g_@@_role_tags_seq { #1 }
-         \prop_gput:Nnn \g_@@_role_tags_NS_prop    { #1 }{ mathml }
-       }
-  }
+         \lua_now:e { ltx.@@.func.alloctag ('#1') }
+         \prop_gput:Nnn \g_@@_role_tags_NS_prop   {#1}{#2}
+         \prop_gput:cnn {g_@@_role_NS_#2_prop}  {#1}{{}{}}
+         \prop_gput:Nnn \g_@@_role_tags_class_prop {#1}{--UNUSED--}
+         \prop_gput:cnn {g_@@_role_NS_#2_class_prop}  {#1}{#3}
+       }      
+    }
+    {   
+      \cs_new_protected:Npn \@@_role_alloctag:nnn #1 #2 #3
+       {
+         \prop_gput:Nnn \g_@@_role_tags_NS_prop   {#1}{#2}
+         \prop_gput:cnn {g_@@_role_NS_#2_prop}  {#1}{{}{}}
+         \prop_gput:Nnn \g_@@_role_tags_class_prop {#1}{--UNUSED--}
+         \prop_gput:cnn {g_@@_role_NS_#2_class_prop}  {#1}{#3}
+       } 
+    }   
+  }   
+\cs_generate_variant:Nn  \@@_role_alloctag:nnn {nnV}   
 %    \end{macrocode}
-% For luatex and the MC we need a name/number relation.
-% The name space is not relevant.
-%    \begin{macrocode}
-\int_step_inline:nnnn { 1 }{ 1 }{ \seq_count:N \g_@@_role_tags_seq }
-  {
-    \@@_prop_gput:Nxn \g_@@_role_tags_prop
-      {
-        \seq_item:Nn \g_@@_role_tags_seq  { #1 }
-      }
-      { #1 }
-  }
-%    \end{macrocode}
+% \end{macro}
 %
-% \subsection{Adding new tags and rolemapping}
+% \subsubsection{pdf 1.7 and earlier}
 %
-% \subsubsection{pdf 1.7 and earlier}
-% With this versions only RoleMap is filled.
-% At first the dictionary:
-% \begin{variable}{g_@@_role/RoleMap_dict}
-%    \begin{macrocode}
-\pdfdict_new:n {g_@@_role/RoleMap_dict}
-%    \end{macrocode}
-% \end{variable}
 % \begin{macro}{\@@_role_add_tag:nn}
 % The pdf 1.7 version has only two arguments: new and rolemap name.
-% To make pdf 2.0 types usable we directly define a rolemapping for them.
-%
+% The role must be an existing tag and should not be empty.
+% We allow to change the role of an existing tag: as the rolemap is written
+% at the end not confusion can happen.
 %    \begin{macrocode}
-\cs_new_protected:Nn \@@_role_add_tag:nn %(new) name, reference to old
+\cs_new_protected:Nn \@@_role_add_tag:nn % (new) name, reference to old
   {
-    \prop_if_in:NnF \g_@@_role_tags_prop {#1}
+%    \end{macrocode}
+% checks and messages
+%    \begin{macrocode}
+    \@@_check_add_tag_role:nn {#1}{#2}
+    \prop_if_in:NnF \g_@@_role_tags_NS_prop {#1}
       {
         \int_compare:nNnT {\l_@@_loglevel_int} > { 0 }
           {
             \msg_info:nnn { tag }{new-tag}{#1}
           }
-         \@@_seq_gput_right:Nn \g_@@_role_tags_seq { #1 }
-         \@@_prop_gput:Nnx \g_@@_role_tags_prop    { #1 }
-           {
-             \seq_count:N \g_@@_role_tags_seq
-           }
-         \prop_gput:Nnn \g_@@_role_tags_NS_prop    { #1 }{ user }
       }
-    \@@_check_add_tag_role:nn {#1}{#2}
+%    \end{macrocode}
+% now the addition
+%    \begin{macrocode}
+    \prop_get:NnN \g_@@_role_tags_class_prop {#2}\l_@@_tmpa_tl
+    \quark_if_no_value:NT \l_@@_tmpa_tl 
+      {
+        \tl_set:Nn\l_@@_tmpa_tl{--UNKNOWN--}
+      }        
+    \@@_role_alloctag:nnV {#1}{user}\l_@@_tmpa_tl  
+%    \end{macrocode}
+% We resolve rolemapping recursively so that all targets are stored as standard
+% tags.
+%    \begin{macrocode}
     \tl_if_empty:nF { #2 }
       {
-        \pdfdict_gput:nnx {g_@@_role/RoleMap_dict}
-          {#1}
-          {\pdf_name_from_unicode_e:n{#2}}
+        \prop_get:NnN \g_@@_role_rolemap_prop {#2}\l_@@_tmpa_tl
+        \quark_if_no_value:NTF \l_@@_tmpa_tl
+          {          
+            \prop_gput:Nnx \g_@@_role_rolemap_prop {#1}{\tl_to_str:n{#2}}
+          }
+          {
+            \prop_gput:NnV \g_@@_role_rolemap_prop {#1}\l_@@_tmpa_tl
+          }          
       }
   }
-\cs_generate_variant:Nn \@@_role_add_tag:nn {VV}
-
-\pdf_version_compare:NnT < {2.0}
-  {
-     \prop_map_inline:Nn \c_@@_role_sttags_pdfII_to_pdf_prop
-       {
-         \@@_role_add_tag:nn {#1}{#2}
-       }
-  }
-
+\cs_generate_variant:Nn \@@_role_add_tag:nn {VV,ne}
 %    \end{macrocode}
 % \end{macro}
 % \subsubsection{The pdf 2.0 version}
@@ -639,17 +471,17 @@
 %    \begin{macrocode}
 \cs_new_protected:Nn \@@_role_add_tag:nnnn %tag/namespace/role/namespace
   {
+    \@@_check_add_tag_role:nnn {#1/#2}{#3}{#4}
     \int_compare:nNnT {\l_@@_loglevel_int} > { 0 }
       {
         \msg_info:nnn { tag }{new-tag}{#1}
       }
-    \@@_seq_gput_right:Nn \g_@@_role_tags_seq { #1 }
-    \@@_prop_gput:Nnx \g_@@_role_tags_prop    { #1 }
-       {
-         \seq_count:N \g_@@_role_tags_seq
-       }
-    \prop_gput:Nnn \g_@@_role_tags_NS_prop    { #1 }{ #2 }
-    \@@_check_add_tag_role:nn {#1}{#3}
+    \prop_get:cnN { g_@@_role_NS_#4_class_prop } {#3}\l_@@_tmpa_tl
+    \quark_if_no_value:NT \l_@@_tmpa_tl 
+      {
+        \tl_set:Nn\l_@@_tmpa_tl{--UNKNOWN--}
+      }         
+    \@@_role_alloctag:nnV {#1}{#2}\l_@@_tmpa_tl   
     \pdfdict_gput:nnx {g_@@_role/RoleMapNS_#2_dict}{#1}
        {
          [
@@ -658,10 +490,697 @@
            \pdf_object_ref:n {tag/NS/#4}
          ]
        }
+%    \end{macrocode}
+% We resolve rolemapping recursively so that all targets are stored as standard
+% tags for the tests.
+%    \begin{macrocode}
+    \tl_if_empty:nF { #2 }
+      {
+        \prop_get:cnN { g__tag_role_NS_#4_prop } {#3}\l_@@_tmpa_tl
+        \quark_if_no_value:NTF \l_@@_tmpa_tl
+          {          
+            \prop_gput:cnx { g__tag_role_NS_#2_prop } {#1}
+              {{\tl_to_str:n{#3}}{\tl_to_str:n{#4}}}
+          }
+          {
+            \prop_gput:cno { g__tag_role_NS_#2_prop } {#1}{\l_@@_tmpa_tl}
+          }          
+      }       
    }
 \cs_generate_variant:Nn \@@_role_add_tag:nnnn {VVVV}
 %    \end{macrocode}
 % \end{macro}
+% 
+% \subsection{Helper command to read the data from files}
+% In this section we setup the helper command to read namespace files.
+
+% \begin{macro}{\@@_role_read_namespace_line:nw}
+% This command will process a line in the name space file.
+% The first argument is the name of the name space. 
+% The definition differ for pdf 2.0. as we have proper name spaces there.
+% With pdf<2.0 not special name spaces shouldn't update the default role or add to the rolemap
+% again. We use a boolean here.
+%    \begin{macrocode}
+\bool_new:N\l_@@_role_update_bool
+\bool_set_true:N \l_@@_role_update_bool
+%    \end{macrocode}
+% 
+%    \begin{macrocode}
+\pdf_version_compare:NnTF < {2.0}
+ {
+  \cs_new_protected:Npn \@@_role_read_namespace_line:nw #1#2,#3,#4,#5,#6\q_stop %
+   % #1 NS, #2 tag, #3 rolemap, #4 NS rolemap #5 type
+    {
+      \tl_if_empty:nF { #2 }
+       {
+        \bool_if:NTF \l_@@_role_update_bool
+         {
+          \tl_if_empty:nTF {#5}
+            {
+              \prop_get:NnN \g_@@_role_tags_class_prop  {#3}\l_@@_tmpa_tl
+              \quark_if_no_value:NT \l_@@_tmpa_tl 
+                {
+                  \tl_set:Nn\l_@@_tmpa_tl{--UNKNOWN--}
+                } 
+            }
+            {              
+              \tl_set:Nn \l_@@_tmpa_tl {#5} 
+            }             
+          \@@_role_alloctag:nnV {#2}{#1}\l_@@_tmpa_tl
+          \tl_if_empty:nF {#3} 
+           { 
+            \@@_role_add_tag:nn {#2}{#3} 
+           }  
+          \prop_gput:cnn {g_@@_role_NS_#1_prop}  {#2}{{#3}{}}   
+         }
+         {
+           \prop_gput:cnn {g_@@_role_NS_#1_prop}  {#2}{{#3}{}}
+           \prop_gput:cnn {g_@@_role_NS_#1_class_prop}  {#2}{--UNUSED--}
+         }       
+       }     
+    }
+ }  
+ {
+   \cs_new_protected:Npn \@@_role_read_namespace_line:nw #1#2,#3,#4,#5,#6\q_stop %
+    % #1 NS, #2 tag, #3 rolemap, #4 NS rolemap #5 type
+    {
+      \tl_if_empty:nF {#2}
+       {
+        \tl_if_empty:nTF {#5}
+         {
+           \prop_get:cnN { g_@@_role_NS_#4_class_prop } {#3}\l_@@_tmpa_tl
+           \quark_if_no_value:NT \l_@@_tmpa_tl 
+             {
+               \tl_set:Nn\l_@@_tmpa_tl{--UNKNOWN--}
+             } 
+         }
+         {
+           \tl_set:Nn \l_@@_tmpa_tl {#5}
+         }     
+        \@@_role_alloctag:nnV {#2}{#1}\l_@@_tmpa_tl
+        \bool_lazy_and:nnT
+           { ! \tl_if_empty_p:n {#3} }{! \str_if_eq_p:nn {#1}{pdf2}} 
+           {
+            \@@_role_add_tag:nnnn {#2}{#1}{#3}{#4}
+            \prop_gput:cnn {g_@@_role_NS_#1_prop}  {#2}{{#3}{#4}}
+           }            
+       }     
+    }
+ }  
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@@_role_read_namespace:n}
+% This command reads the namespace file.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_role_read_namespace:n #1 %name of namespace
+  { 
+    \prop_if_exist:cF {g__tag_role_NS_#1_prop}
+      { \msg_warning:nnn {tag}{namespace-unknown}{#1} }
+    \file_if_exist:nTF { tagpdf-ns-#1.def}
+     { 
+       \ior_open:Nn \g_tmpa_ior {tagpdf-ns-#1.def}
+       \msg_info:nnn {tag}{read-namespace}{#1}
+       \ior_map_inline:Nn \g_tmpa_ior 
+         {
+           \@@_role_read_namespace_line:nw {#1} ##1,,,,\q_stop 
+         }
+       \ior_close:N\g_tmpa_ior    
+     }
+     {
+      \msg_warning:nnn{tag}{namespace-missing}{#1}
+     }
+  }   
+   
+%    \end{macrocode}
+% \end{macro}
+%
+
+% 
+% \subsection{Reading the default data}
+% The order is important as we want pdf2 and latex as default.
+%    \begin{macrocode}
+\@@_role_read_namespace:n {pdf}
+\@@_role_read_namespace:n {pdf2}
+\pdf_version_compare:NnF < {2.0}
+  {\@@_role_read_namespace:n {mathml}} 
+\bool_set_false:N\l_@@_role_update_bool
+\@@_role_read_namespace:n {latex-inline} 
+\@@_role_read_namespace:n {latex-book}  
+\bool_set_true:N\l_@@_role_update_bool
+\@@_role_read_namespace:n {latex}
+\@@_role_read_namespace:n {pdf}
+\@@_role_read_namespace:n {pdf2}
+%    \end{macrocode}
+%
+% But is the class provides a \cs{chapter} command then we switch 
+%    \begin{macrocode}
+\pdf_version_compare:NnTF < {2.0}
+  {
+    \hook_gput_code:nnn {begindocument}{tagpdf}
+      {
+        \cs_if_exist:NT \chapter
+           {
+             \prop_map_inline:cn{g_@@_role_NS_latex-book_prop}
+               {
+                 \@@_role_add_tag:ne {#1}{\use_i:nn #2\c_empty_tl\c_empty_tl}
+               }
+           }
+      }
+  }
+  {
+    \hook_gput_code:nnn {begindocument}{tagpdf}
+      {
+        \cs_if_exist:NT \chapter
+         {
+           \prop_map_inline:cn{g_@@_role_NS_latex-book_prop}
+             {
+               \prop_gput:Nnn \g_@@_role_tags_NS_prop    { #1 }{ latex-book }
+             }
+         }
+      }  
+  }
+%    \end{macrocode}
+% \subsection{Parent-child rules}
+% PDF define various rules about which tag can be a child of another tag.
+% The following code implements the matrix to allow to use it in tests.
+% \begin{variable}{\g_@@_role_parent_child_intarray}
+% This intarray will store the rule as a number. For parent nm and child ij 
+% (n,m,i,j digits) the rule is at position nmij. As we have around 56 tags,
+% we need roughly a size 6000.
+%    \begin{macrocode}
+\intarray_new:Nn \g_@@_role_parent_child_intarray {6000}
+%    \end{macrocode}
+% \end{variable}
+% \begin{macro}{\c_@@_role_rules_prop,\c_@@_role_rules_num_prop}
+% These two properties map the rule strings to numbers and back.
+% There are in tagpdf-data.dtx near the csv files for easier maintenance.
+% \end{macro}
+% 
+% \begin{macro}{\@@_store_parent_child_rule:nnn}
+% The helper command is used to store the rule. 
+% It assumes that parent and child are given as 2-digit number!
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_store_parent_child_rule:nnn #1 #2 #3 % num parent, num child, #3 string
+  {
+    \intarray_gset:Nnn \g_@@_role_parent_child_intarray 
+      { #1#2 }{0\prop_item:Nn\c_@@_role_rules_prop{#3}}
+  }  
+%    \end{macrocode}
+% \end{macro}
+% 
+% \subsubsection{Reading in the csv-files}
+% This counter will be used to identify the first (non-comment) line
+%    \begin{macrocode}
+\int_zero:N  \l_@@_tmpa_int
+%    \end{macrocode}
+% Open the file depending on the PDF version
+%    \begin{macrocode}
+\pdf_version_compare:NnTF < {2.0}
+  {
+    \ior_open:Nn \g_tmpa_ior {tagpdf-parent-child.csv}
+  }
+  {
+    \ior_open:Nn \g_tmpa_ior {tagpdf-parent-child-2.csv}
+  }  
+%    \end{macrocode}
+
+%  Now the main loop over the file
+%    \begin{macrocode}
+\ior_map_inline:Nn \g_tmpa_ior 
+  { 
+%    \end{macrocode}
+% ignore lines containing only comments
+%    \begin{macrocode}
+    \tl_if_empty:nF{#1}
+      {
+%    \end{macrocode}
+% count the lines ...
+%    \begin{macrocode}      
+        \int_incr:N\l_@@_tmpa_int 
+%    \end{macrocode}
+%  put the line into a seq. Attention! empty cells are dropped.
+%    \begin{macrocode}
+        \seq_set_from_clist:Nn\l_@@_tmpa_seq { #1 } 
+        \int_compare:nNnTF {\l_@@_tmpa_int}=1
+%    \end{macrocode}
+% This handles the header line. It gives the tags 2-digit numbers
+%    \begin{macrocode}
+          {         
+            \seq_map_indexed_inline:Nn \l_@@_tmpa_seq
+              {
+                \prop_gput:Nnx\g_@@_role_index_prop 
+                  {##2}
+                  {\int_compare:nNnT{##1}<{10}{0}##1}           
+              }  
+          }
+%    \end{macrocode}
+% now the data lines.
+%    \begin{macrocode}
+         {
+           \seq_set_from_clist:Nn\l_@@_tmpa_seq { #1 }
+%    \end{macrocode}
+% get the name of the child tag from the first column
+%    \begin{macrocode}
+           \seq_pop_left:NN\l_@@_tmpa_seq\l_@@_tmpa_tl
+%    \end{macrocode}
+% get the number of the child, and store it in  \cs{l_@@_tmpb_tl}
+%    \begin{macrocode}
+           \prop_get:NVN \g_@@_role_index_prop \l_@@_tmpa_tl \l_@@_tmpb_tl
+%    \end{macrocode}
+% remove column 2+3
+%    \begin{macrocode}
+           \seq_pop_left:NN\l_@@_tmpa_seq\l_@@_tmpa_tl
+           \seq_pop_left:NN\l_@@_tmpa_seq\l_@@_tmpa_tl
+%    \end{macrocode}
+% Now map over the rest. The index \verb+##1+ gives us the 
+% number of the parent, \verb+##2+ is the data.
+%    \begin{macrocode}
+           \seq_map_indexed_inline:Nn \l_@@_tmpa_seq 
+             {       
+               \exp_args:Nnx 
+               \@@_store_parent_child_rule:nnn {##1}{\l_@@_tmpb_tl}{ ##2 }       
+             }        
+         }
+      } 
+  }
+%    \end{macrocode}
+% close the read handle.
+%    \begin{macrocode}
+\ior_close:N\g_tmpa_ior 
+%    \end{macrocode}
+% The Root,
+% Hn and mathml tags are special and need to be added explicitly
+%    \begin{macrocode}
+\prop_get:NnN\g_@@_role_index_prop{StructTreeRoot}\l_@@_tmpa_tl
+\prop_gput:Nnx\g_@@_role_index_prop{Root}{\l_@@_tmpa_tl}
+\prop_get:NnN\g_@@_role_index_prop{Hn}\l_@@_tmpa_tl
+\pdf_version_compare:NnTF < {2.0}
+  {
+    \int_step_inline:nn{6}
+      {
+        \prop_gput:Nnx\g_@@_role_index_prop{H#1}{\l_@@_tmpa_tl}
+      }
+  }
+  {
+    \int_step_inline:nn{10}
+      {
+        \prop_gput:Nnx\g_@@_role_index_prop{H#1}{\l_@@_tmpa_tl}
+      }
+%    \end{macrocode}
+% all mathml tags are currently handled identically
+%    \begin{macrocode}
+    \prop_get:NnN\g_@@_role_index_prop {mathml}\l_@@_tmpa_tl
+    \prop_get:NnN\g_@@_role_index_prop {math}\l_@@_tmpb_tl
+    \prop_map_inline:Nn \g_@@_role_NS_mathml_prop  
+      {
+        \prop_gput:NnV\g_@@_role_index_prop{#1}\l_@@_tmpa_tl
+      }  
+    \prop_gput:NnV\g_@@_role_index_prop{math}\l_@@_tmpb_tl    
+  }    
+%    \end{macrocode}
+%
+% \subsubsection{Retrieving the parent-child rule}
+% 
+% \begin{macro}{\l_@@_role_real_parent_tl}
+%  Part, Div and NonStruct have no own rules, instead
+%  the parent(s) have to be inspected. To store this real parent
+%  we use this tlvar
+%    \begin{macrocode}
+\tl_new:N \l_@@_role_real_parent_tl 
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\@@_role_get_parent_child_rule:nnN}
+%  This command retrieves the rule (as a number) and stores it in the tl-var.
+%  TODO check temporary variables. Check if the tl-var should be fix.
+%  The arguments should be standard tags for which a rule exist and
+%  role mapping should have already be done.
+%    \begin{macrocode}
+\tl_new:N \l_@@_parent_child_check_tl
+\cs_new_protected:Npn \@@_role_get_parent_child_rule:nnN #1 #2 #3
+  % #1 parent (string) #2 child (string) #3 tl for state
+  {
+     \tl_set:Nn \l_@@_role_real_parent_tl {#1}
+%    \end{macrocode}
+% 
+%    \begin{macrocode}
+     \prop_get:NnN \g_@@_role_index_prop{#1}\l_@@_tmpa_tl
+     \prop_get:NnN \g_@@_role_index_prop{#2}\l_@@_tmpb_tl
+     \bool_lazy_and:nnTF 
+       { ! \quark_if_no_value_p:N \l_@@_tmpa_tl }
+       { ! \quark_if_no_value_p:N \l_@@_tmpb_tl }
+       {
+%    \end{macrocode}
+% Get the rule from the intarray
+%    \begin{macrocode}
+         \tl_set:Nx#3 
+           { 
+             \intarray_item:Nn 
+              \g_@@_role_parent_child_intarray 
+              {\l_@@_tmpa_tl\l_@@_tmpb_tl}
+           }
+%    \end{macrocode}
+% If the state is ‡ we have to check the parents from the stack and
+% use the first which is not Part, Div or NonStruct
+%    \begin{macrocode}
+         \int_compare:nNnT  
+           {#3} = {\prop_item:Nn\c_@@_role_rules_prop{‡}}  
+           {
+             \seq_set_eq:NN   \l_@@_role_tmpa_seq \g_@@_struct_tag_stack_seq
+%    \end{macrocode}
+% we must take the current child from the stack if is already there, 
+% depending on location the check is called, this could also remove the 
+% parent, but that is ok too.
+%    \begin{macrocode}
+             \seq_pop_left:NN \l_@@_role_tmpa_seq\l_@@_get_tmpc_tl             
+             \seq_map_inline:Nn\l_@@_role_tmpa_seq
+               {
+                 \tl_if_in:nnF {-Part-Div-NonStruct-}{-##1-}
+                   {  
+                     \tl_set:Nn\l_@@_role_real_parent_tl {##1}
+                     \int_zero:N\l_@@_tmpa_int
+                     \@@_role_get_parent_child_rule:nnN {##1}{#2}#3
+                     \int_set:Nn\l_@@_tmpa_int{1}
+                     \seq_map_break:
+                   }
+               } 
+           }
+%    \end{macrocode}
+%   This is the message, this can perhaps go into debug mode.
+%    \begin{macrocode}
+         \group_begin:
+         \int_compare:nNnT {\l_@@_tmpa_int*\l_@@_loglevel_int} > { 0 }
+           {      
+             \prop_get:NVNF\c_@@_role_rules_num_prop #3 \l_@@_tmpa_tl
+               {
+                 \tl_set:Nn \l_@@_tmpa_tl {unknown}
+               }
+             \tl_set:Nn \l_@@_tmpb_tl {#1}
+             \msg_note:nnxxx 
+               { tag } 
+               { role-parent-child } 
+               { #1
+                 \tl_if_eq:NNTF\l_@@_tmpb_tl\l_@@_role_real_parent_tl
+                   {
+                     \bool_lazy_and:nnT 
+                      {
+                        \prop_if_in_p:Nn \l_@@_role_debug_prop {parent}
+                      }
+                      {
+                        !\str_if_eq_p:ee {#1}{\prop_item:Nn\l_@@_role_debug_prop {parent}}
+                      }  
+                      {
+                        \c_space_tl (from~\prop_item:Nn\l_@@_role_debug_prop {parent})
+                      }                                    
+                   }
+                   {
+                     \c_space_tl(inherited~from~\l_@@_role_real_parent_tl)
+                   }  
+               } 
+               { 
+                 #2 
+                 \bool_lazy_and:nnT 
+                   {
+                     \prop_if_in_p:Nn \l_@@_role_debug_prop {child}
+                   }
+                   {
+                     !\str_if_eq_p:ee {#2}{\prop_item:Nn\l_@@_role_debug_prop {child}}
+                   }  
+                   {
+                     \c_space_tl (from~\prop_item:Nn\l_@@_role_debug_prop {child})
+                   }                                   
+               }
+               { '#3~(\l_@@_tmpa_tl)' }   
+           }  
+           \group_end: 
+       }
+       {         
+         \tl_set:Nn#3 {0}
+         \msg_warning:nnxxx 
+           { tag } 
+           {role-parent-child} 
+           { #1 } 
+           { #2 }
+           { unknown! }  
+       }
+  }  
+\cs_generate_variant:Nn\@@_role_get_parent_child_rule:nnN {VVN}   
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{@@_check_parent_child:nnnnN}
+% This is the main command. 
+% It has to retrieve the standard tags for a comparison.
+% In pdf 2.0 the name spaces of the tags are relevant, so we
+% have arguments for them, but in pdf <2.0 they are ignored and can
+% be left empty.
+%    \begin{macrocode}
+\pdf_version_compare:NnTF < {2.0}
+  {
+   \cs_new_protected:Npn \@@_check_parent_child:nnnnN #1 #2 #3 #4 #5
+     {
+%    \end{macrocode}
+% for debugging messages we store the arguments.
+%    \begin{macrocode}
+       \prop_put:Nnn \l_@@_role_debug_prop {parent} {#1} 
+       \prop_put:Nnn \l_@@_role_debug_prop {child}  {#3}  
+%    \end{macrocode}
+% get the standard tags through rolemapping if needed
+% at first the parent
+%    \begin{macrocode}
+       \prop_get:NnNTF \g_@@_role_index_prop {#1}\l_@@_tmpa_tl
+         {
+           \tl_set:Nn \l_@@_tmpa_tl {#1}
+         }
+         {           
+           \prop_get:NnNF \g_@@_role_rolemap_prop {#1}\l_@@_tmpa_tl 
+             { 
+               \tl_set:Nn \l_@@_tmpa_tl {\q_no_value}
+             }
+         }    
+%    \end{macrocode}
+% now the child
+%    \begin{macrocode}
+       \prop_get:NnNTF \g_@@_role_index_prop {#3}\l_@@_tmpb_tl
+         {
+           \tl_set:Nn \l_@@_tmpb_tl {#3}
+         }
+         {
+           \prop_get:NnNF \g_@@_role_rolemap_prop {#3}\l_@@_tmpb_tl 
+             {                
+               \tl_set:Nn \l_@@_tmpb_tl {\q_no_value}
+             }
+         } 
+%    \end{macrocode}
+% if we got tags for parent and child we call the checking command
+%    \begin{macrocode}
+       \bool_lazy_and:nnTF 
+         { ! \quark_if_no_value_p:N \l_@@_tmpa_tl }
+         { ! \quark_if_no_value_p:N \l_@@_tmpb_tl }     
+         {  
+           \@@_role_get_parent_child_rule:VVN \l_@@_tmpa_tl \l_@@_tmpb_tl #5
+         }   
+         {
+           \tl_set:Nn #5 {0}
+           \msg_warning:nnxxx 
+            { tag } 
+            {role-parent-child} 
+            { #1 } 
+            { #3 }
+            { unknown! }  
+         }
+     }
+   \cs_new_protected:Npn \@@_check_parent_child:nnN #1#2#3 
+     {
+       \@@_check_parent_child:nnnnN {#1}{}{#2}{}#3
+     }  
+  }
+%    \end{macrocode}
+% and now the pdf 2.0 version
+% The version with three arguments retrieves the default 
+% names space and then calls the full command. 
+% Not sure if this will ever be needed but we leave it for now. 
+%    \begin{macrocode}
+  {
+   \cs_new_protected:Npn \@@_check_parent_child:nnN #1 #2 #3
+     { 
+       \prop_get:NnN\g_@@_role_tags_NS_prop {#1}\l_@@_role_tag_namespace_tmpa_tl  
+       \prop_get:NnN\g_@@_role_tags_NS_prop {#2}\l_@@_role_tag_namespace_tmpb_tl
+       \str_if_eq:nnT{#2}{MC}{\tl_clear:N \l_@@_role_tag_namespace_tmpb_tl}
+       \bool_lazy_and:nnTF 
+         { ! \quark_if_no_value_p:N \l_@@_role_tag_namespace_tmpa_tl }
+         { ! \quark_if_no_value_p:N \l_@@_role_tag_namespace_tmpb_tl } 
+         {
+           \@@_check_parent_child:nVnVN 
+             {#1}\l_@@_role_tag_namespace_tmpa_tl   
+             {#2}\l_@@_role_tag_namespace_tmpb_tl   
+             #3
+         }        
+         {
+           \tl_set:Nn #3 {0}
+           \msg_warning:nnxxx 
+            { tag } 
+            {role-parent-child} 
+            { #1 } 
+            { #2 }
+            { unknown! }  
+         }
+     }
+%    \end{macrocode}
+% and now the real command.
+%    \begin{macrocode}
+   \cs_new_protected:Npn \@@_check_parent_child:nnnnN #1 #2 #3 #4 #5 %tag,NS,tag,NS, tl var
+      { 
+        \prop_put:Nnn \l_@@_role_debug_prop {parent} {#1/#2} 
+        \prop_put:Nnn \l_@@_role_debug_prop {child}  {#3/#4}       
+%    \end{macrocode}
+%  If the namespace is empty, we assume a standard tag,
+%  otherwise we retrieve the rolemapping from the namespace
+%    \begin{macrocode} 
+        \tl_if_empty:nTF  {#2}
+          {   
+            \tl_set:Nn \l_@@_tmpa_tl {#1}
+          } 
+          {           
+            \prop_get:cnNTF 
+               { g_@@_role_NS_#2_prop }
+               {#1}
+               \l_@@_tmpa_tl
+               {
+                 \tl_set:Nx \l_@@_tmpa_tl {\tl_head:N\l_@@_tmpa_tl}
+                 \tl_if_empty:NT\l_@@_tmpa_tl
+                   {
+                     \tl_set:Nn \l_@@_tmpa_tl {#1}
+                   } 
+               }
+               { 
+                 \tl_set:Nn \l_@@_tmpa_tl {\q_no_value}
+               }  
+          }            
+%    \end{macrocode}
+% and the same for the child
+%  If the namespace is empty, we assume a standard tag,
+%  otherwise we retrieve the rolemapping from the namespace
+%    \begin{macrocode}
+        \tl_if_empty:nTF  {#4}
+          {   
+            \tl_set:Nn \l_@@_tmpb_tl {#3}
+          } 
+          { 
+            \prop_get:cnNTF 
+              { g_@@_role_NS_#4_prop }
+              {#3}
+              \l_@@_tmpb_tl
+              {
+                \tl_set:Nx \l_@@_tmpb_tl { \tl_head:N\l_@@_tmpb_tl }
+                \tl_if_empty:NT\l_@@_tmpb_tl
+                  {
+                    \tl_set:Nn \l_@@_tmpb_tl {#3}
+                  }             
+              }
+              { 
+                \tl_set:Nn \l_@@_tmpb_tl {\q_no_value}
+              } 
+          }         
+%    \end{macrocode}
+% and now get the relation
+%    \begin{macrocode}
+       \bool_lazy_and:nnTF 
+         { ! \quark_if_no_value_p:N \l_@@_tmpa_tl }
+         { ! \quark_if_no_value_p:N \l_@@_tmpb_tl }     
+         {  
+           \@@_role_get_parent_child_rule:VVN \l_@@_tmpa_tl \l_@@_tmpb_tl #5
+         }   
+         {
+           \tl_set:Nn #5 {0}
+           \msg_warning:nnxxx 
+            { tag } 
+            {role-parent-child} 
+            { #1 } 
+            { #3 }
+            { unknown! }  
+         }
+     }     
+  }
+\cs_generate_variant:Nn\@@_check_parent_child:nnN {VVN}  
+\cs_generate_variant:Nn\@@_check_parent_child:nnnnN {VVVVN,nVnVN,VVnnN}  
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsection{Remapping of tags}
+% In some context it can be necessary to remap or replace the tags. 
+% That means instead of tag=H1 or tag=section one wants the effect of tag=Span.
+% Or instead of tag=P one wants tag=Code.
+% 
+% The following command provide some general interface for this.
+% The core idea is that before a tag is set it is fed through a function
+% that can change it. We want to be able to chain such functions,
+% so all of them manipulate the same variables.
+% 
+% \begin{variable}{\l_@@_role_remap_tag_tl,\l_@@_role_remap_NS_tl}
+%    \begin{macrocode}
+\tl_new:N \l_@@_role_remap_tag_tl
+\tl_new:N \l_@@_role_remap_NS_tl
+%    \end{macrocode}
+% \end{variable}
+% \begin{macro}{\@@_role_remap:}
+% This function is used in the structure and the mc code before using a tag. By default it
+% does nothing with the tl vars. Perhaps this should be a hook?
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_role_remap: {  } 
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_role_remap_id: }
+% This is copy in case we have to restore the main command.
+%    \begin{macrocode}
+\cs_set_eq:NN \@@_role_remap_id: \@@_role_remap:
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\@@_role_remap_inline:}
+% The mapping is meant to \enquote{degrade} tags, e.g. if used
+% inside some complex object. 
+% The pdf<2.0 code maps the tag to the new role, the pdf 2.0 code only
+% switch the NS.
+%    \begin{macrocode}
+\pdf_version_compare:NnTF < {2.0}
+  {
+    \cs_new_protected:Npn \@@_role_remap_inline:
+      {
+        \prop_get:cVNT { g__tag_role_NS_latex-inline_prop }\l_@@_role_remap_tag_tl\l_@@_tmpa_tl
+          {
+            \tl_set:Nx\l_@@_role_remap_tag_tl
+              {
+                \exp_last_unbraced:NV\use_i:nn \l_@@_tmpa_tl
+              }
+            \tl_set:Nx\l_@@_role_remap_NS_tl 
+              {
+                \exp_last_unbraced:NV\use_ii:nn \l_@@_tmpa_tl
+              }
+          }
+        \int_compare:nNnT {\l_@@_loglevel_int} > { 0 }
+          {
+            \msg_note:nnx { tag } { role-remapping }{ \l_@@_role_remap_tag_tl }
+          }  
+      }
+  }
+  {
+    \cs_new_protected:Npn \@@_role_remap_inline:
+      {
+        \prop_get:cVNT { g__tag_role_NS_latex-inline_prop }\l_@@_role_remap_tag_tl\l_@@_tmpa_tl
+          {
+            \tl_set:Nn\l_@@_role_remap_NS_tl {latex-inline}
+          }
+        \int_compare:nNnT {\l_@@_loglevel_int} > { 0 }
+          {
+            \msg_note:nnx { tag } { role-remapping }{ \l_@@_role_remap_tag_tl/latex-inline }
+          }  
+      }    
+  }    
+%    \end{macrocode}
+% \end{macro}
+%
 % \subsection{Key-val user interface}
 %  The user interface uses the key |add-new-tag|, which takes either a
 %  keyval list as argument, or a tag/role.

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx	2022-12-23 21:05:03 UTC (rev 65341)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.97, released 2022-08-24}
+% \date{Version 0.98, released 2022-12-22}
 % \maketitle
 % \begin{documentation}
 % \begin{function}{interwordspace (setup-key)}
@@ -64,7 +64,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-space-code} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdf-space-code} {2022-12-22} {0.98}
  {part of tagpdf - code related to real space chars}
 %</header>
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx	2022-12-23 21:05:03 UTC (rev 65341)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.97, released 2022-08-24}
+% \date{Version 0.98, released 2022-12-22}
 % \maketitle
 % \begin{documentation}
 % \section{Public Commands}
@@ -242,7 +242,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-struct-code} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdf-struct-code} {2022-12-22} {0.98}
  {part of tagpdf - code related to storing structure}
 %</header>
 %    \end{macrocode}
@@ -298,6 +298,14 @@
 %    \end{macrocode}
 % \end{variable}
 %
+% \begin{variable}{\g_@@_struct_tag_NS_prop}
+% For the parent-child check, we need the tag and NS of every structure
+%    \begin{macrocode}
+\prop_new:N\g_@@_struct_tag_NS_prop
+%    \end{macrocode}
+% \end{variable}
+%
+%
 % \begin{variable}{\g_@@_struct_stack_current_tl,\l_@@_struct_stack_parent_tmpa_tl}
 % The global variable will hold the current structure number. It is already
 % defined in \texttt{tagpdf-base}.
@@ -399,6 +407,28 @@
 \bool_new:N \l_@@_struct_elem_stash_bool
 %    \end{macrocode}
 % \end{variable}
+% 
+% \subsection{Variables used by tagging code of basic elements}
+%
+% \begin{variable}{\g_@@_struct_dest_num_prop}
+% This variable records for (some or all, not clear yet)
+% destination names the related structure number to allow
+% to reference them in a Ref. The key is the destination.
+% It is currently used by the toc-tagging and sec-tagging code.
+%    \begin{macrocode}
+\prop_new:N \g_@@_struct_dest_num_prop
+%    \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\g_@@_struct_ref_by_dest_prop}
+% This variable contains structures whose Ref key should be updated
+% at the end to point to structured related with this destination.
+% As this is probably need in other places too, it is not only a toc-variable.
+%    \begin{macrocode}
+\prop_new:N \g_@@_struct_ref_by_dest_prop
+%    \end{macrocode}
+% \end{variable} 
+% 
 % \section{Commands}
 %
 % The properties must be in some places handled expandably.
@@ -442,7 +472,11 @@
 %    \begin{macrocode}
 \tl_gset:Nn \g_@@_struct_stack_current_tl {0}
 %    \end{macrocode}
-
+% \begin{macro}{\@@_pdf_name_e:n}
+%    \begin{macrocode}
+\cs_new:Npn \@@_pdf_name_e:n #1{\pdf_name_from_unicode_e:n{#1}}
+%    \end{macrocode}
+% \end{macro}
 %
 % \begin{variable}{g_@@_struct_0_prop,g_@@_struct_kids_0_seq}
 %    \begin{macrocode}
@@ -450,13 +484,17 @@
 \@@_new_output_prop_handler:n {0}
 \@@_seq_new:c  { g_@@_struct_kids_0_seq }
 
-\@@_prop_gput:cnn
+\@@_prop_gput:cnx
   { g_@@_struct_0_prop }
   { Type }
-  { /StructTreeRoot }
+  { \pdf_name_from_unicode_e:n {StructTreeRoot} }
 
+\@@_prop_gput:cnx
+  { g_@@_struct_0_prop }
+  { S }
+  { \pdf_name_from_unicode_e:n {StructTreeRoot} }
 
-
+\prop_gput:Nnn \g_@@_struct_tag_NS_prop {0}{{StructTreeRoot}{pdf}}
 %    \end{macrocode}
 % Namespaces are pdf 2.0 but it doesn't harm
 % to have an empty entry. We could add a test, but if the code moves into
@@ -468,6 +506,65 @@
   { \pdf_object_ref:n { @@/tree/namespaces } }
 %    \end{macrocode}
 % \end{variable}
+% 
+% \subsection{Filling in the tag info}
+
+% \begin{macro}{\@@_struct_set_tag_info:nnn }
+% This adds or updates the tag info to a structure given by a number. 
+% We need also the original data, so we store both.
+%    \begin{macrocode}
+\pdf_version_compare:NnTF < {2.0}
+ {
+   \cs_new_protected:Npn \@@_struct_set_tag_info:nnn #1 #2 #3
+     %#1 structure number, #2 tag, #3 NS
+     { 
+       \@@_prop_gput:cnx
+         { g_@@_struct_#1_prop }         
+         { S }
+         { \pdf_name_from_unicode_e:n {#2}  } %
+       \prop_gput:Nnn \g_@@_struct_tag_NS_prop {#1}{{#2}{#3}}  
+     }
+ }     
+ {     
+   \cs_new_protected:Npn \@@_struct_set_tag_info:nnn #1 #2 #3
+     {  
+       \@@_prop_gput:cnx
+         { g_@@_struct_#1_prop }
+         { S }
+         { \pdf_name_from_unicode_e:n {#2} } %
+       \prop_get:NnNT \g_@@_role_NS_prop {#3} \l_@@_get_tmpc_tl
+         {
+           \@@_prop_gput:cnx
+             { g_@@_struct_#1_prop }
+             { NS }
+             { \l_@@_get_tmpc_tl } %
+         }
+       \prop_gput:Nnn \g_@@_struct_tag_NS_prop {#1}{{#2}{#3}}   
+     } 
+ }     
+\cs_generate_variant:Nn \@@_struct_set_tag_info:nnn {eVV}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\cc}
+%  We also need a way to get the tag info back from parent structures.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_struct_get_tag_info:nNN #1 #2 #3 
+   %#1 struct num, #2 tlvar for tag , #3 tlvar for NS
+    {        
+       \prop_get:NnNTF \g_@@_struct_tag_NS_prop {#1}\l_@@_get_tmpc_tl
+         {
+           \tl_set:Nx #2{\exp_last_unbraced:NV\use_i:nn  \l_@@_get_tmpc_tl}
+           \tl_set:Nx #3{\exp_last_unbraced:NV\use_ii:nn \l_@@_get_tmpc_tl}
+         }         
+         {
+           \tl_clear:N#2
+           \tl_clear:N#3
+         }
+    }
+\cs_generate_variant:Nn\@@_struct_get_tag_info:nNN {eNN}    
+%    \end{macrocode}
+% \end{macro}
 % \subsection{Handlings kids}
 % Commands to store the kids. Kids in a structure can be a reference to a mc-chunk,
 % an object reference to another structure element, or a object reference to an
@@ -857,21 +954,10 @@
     parent .default:n    = {-1},
     tag   .code:n        = % S property
       {
-        \seq_set_split:Nne \l_@@_tmpa_seq { / } {#1/\prop_item:No\g__tag_role_tags_NS_prop{#1}}
-        \tl_gset:Nx \g_@@_struct_tag_tl    { \seq_item:Nn\l_@@_tmpa_seq {1} }
-        \tl_gset:Nx \g_@@_struct_tag_NS_tl { \seq_item:Nn\l_@@_tmpa_seq {2} }
+        \seq_set_split:Nne \l_@@_tmpa_seq { / } {#1/\prop_item:Ne\g__tag_role_tags_NS_prop{#1}}
+        \tl_gset:Nx \g_@@_struct_tag_tl   { \seq_item:Nn\l_@@_tmpa_seq {1} }
+        \tl_gset:Nx \g_@@_struct_tag_NS_tl{ \seq_item:Nn\l_@@_tmpa_seq {2} }  
         \@@_check_structure_tag:N \g_@@_struct_tag_tl
-        \@@_prop_gput:cnx
-         { g_@@_struct_\int_eval:n {\c at g_@@_struct_abs_int}_prop }
-         { S }
-         { \pdf_name_from_unicode_e:n{ \g_@@_struct_tag_tl} } %
-       \prop_get:NVNT \g_@@_role_NS_prop\g_@@_struct_tag_NS_tl\l_@@_tmpa_tl
-         {
-           \@@_prop_gput:cnx
-            { g_@@_struct_\int_eval:n {\c at g_@@_struct_abs_int}_prop }
-            { NS }
-            { \l_@@_tmpa_tl } %
-         }
       },
     title .code:n        = % T property
       {
@@ -1114,7 +1200,13 @@
           { /StructElem }
         \tl_set:Nn \l_@@_struct_stack_parent_tmpa_tl {-1}
         \keys_set:nn { @@ / struct} { #1 }
-        \@@_check_structure_has_tag:n { \int_eval:n {\c at g_@@_struct_abs_int} }
+%    \end{macrocode}
+%    \begin{macrocode}
+        \@@_struct_set_tag_info:eVV 
+          { \int_eval:n {\c at g_@@_struct_abs_int} }
+           \g_@@_struct_tag_tl               
+           \g_@@_struct_tag_NS_tl   
+        \@@_check_structure_has_tag:n { \int_eval:n {\c at g_@@_struct_abs_int} }           
         \tl_if_empty:NF
           \l_@@_struct_key_label_tl
           {
@@ -1139,7 +1231,43 @@
         %\seq_show:N   \g_@@_struct_stack_seq
         \bool_if:NF
           \l_@@_struct_elem_stash_bool
-          {%set the  parent
+          {
+%    \end{macrocode}
+%  check if the tag can be used inside the parent. It only makes sense,
+%  if the structure is actually used here, so it is guarded by the stash boolean.
+%  For now we ignore the namespace! 
+%    \begin{macrocode}
+            \@@_struct_get_tag_info:eNN  
+              {\l_@@_struct_stack_parent_tmpa_tl}
+              \l_@@_get_parent_tmpa_tl
+              \l_@@_get_parent_tmpb_tl
+            \@@_check_parent_child:VVVVN
+              \l_@@_get_parent_tmpa_tl
+              \l_@@_get_parent_tmpb_tl
+              \g_@@_struct_tag_tl               
+              \g_@@_struct_tag_NS_tl  
+              \l_@@_parent_child_check_tl             
+            \int_compare:nNnT {\l_@@_parent_child_check_tl}<0
+              {
+                \msg_warning:nnxxx 
+                 { tag } 
+                 {role-parent-child} 
+                 { \l_@@_get_parent_tmpa_tl/\l_@@_get_parent_tmpb_tl } 
+                 { \g_@@_struct_tag_tl/\g_@@_struct_tag_NS_tl  }
+                 { not~allowed~(struct~\g_@@_struct_stack_current_tl) }  
+                \cs_set_eq:NN \l_@@_role_remap_tag_tl \g_@@_struct_tag_tl 
+                \cs_set_eq:NN \l_@@_role_remap_NS_tl \g_@@_struct_tag_NS_tl               
+                \@@_role_remap:
+                \cs_gset_eq:NN \g_@@_struct_tag_tl \l_@@_role_remap_tag_tl 
+                \cs_gset_eq:NN  \g_@@_struct_tag_NS_tl \l_@@_role_remap_NS_tl
+                \@@_struct_set_tag_info:eVV 
+                  { \int_eval:n {\c at g_@@_struct_abs_int} }
+                    \g_@@_struct_tag_tl               
+                    \g_@@_struct_tag_NS_tl                                 
+              }
+%    \end{macrocode}
+% Set the Parent.
+%    \begin{macrocode}
             \@@_prop_gput:cnx
               { g_@@_struct_\int_eval:n {\c at g_@@_struct_abs_int}_prop }
               { P }
@@ -1202,7 +1330,7 @@
 %<base>\cs_new_protected:Npn \tag_struct_use:n #1 {}
 %<*package>
 \cs_set_protected:Npn \tag_struct_use:n #1 %#1 is the label
-  {
+  { 
     \@@_check_if_active_struct:T
       {
         \prop_if_exist:cTF
@@ -1220,6 +1348,33 @@
               {
                 \pdf_object_ref:e { @@/struct/\g_@@_struct_stack_current_tl }
               }
+%    \end{macrocode}
+%   check if the tag is allowed as child. Here we have to retrieve the 
+%   tag info for the child, while the data for the parent is in 
+%   the global tl-vars:
+%    \begin{macrocode}
+             \@@_struct_get_tag_info:eNN  
+              {\__tag_ref_value:enn{tagpdfstruct-#1}{tagstruct}{0}}
+              \l_@@_tmpa_tl
+              \l_@@_tmpb_tl
+            \@@_check_parent_child:VVVVN
+              \g_@@_struct_tag_tl               
+              \g_@@_struct_tag_NS_tl  
+              \l_@@_tmpa_tl
+              \l_@@_tmpb_tl               
+              \l_@@_parent_child_check_tl             
+            \int_compare:nNnT {\l_@@_parent_child_check_tl}<0
+              {
+                \cs_set_eq:NN \l_@@_role_remap_tag_tl \g_@@_struct_tag_tl 
+                \cs_set_eq:NN \l_@@_role_remap_NS_tl \g_@@_struct_tag_NS_tl               
+                \@@_role_remap:
+                \cs_gset_eq:NN \g_@@_struct_tag_tl \l_@@_role_remap_tag_tl 
+                \cs_gset_eq:NN  \g_@@_struct_tag_NS_tl \l_@@_role_remap_NS_tl
+                \@@_struct_set_tag_info:eVV 
+                  { \int_eval:n {\c at g_@@_struct_abs_int} }
+                    \g_@@_struct_tag_tl               
+                    \g_@@_struct_tag_NS_tl                                 
+              }
           }
           {
             \msg_warning:nnn{ tag }{struct-label-unknown}{#1}
@@ -1271,11 +1426,11 @@
      \prop_get:cnN
         { g_@@_struct_#1_prop }
         {Ref}
-        \l_@@_tmpb_tl
+        \l_@@_get_tmpc_tl
      \@@_prop_gput:cnx
         { g_@@_struct_#1_prop }
         { Ref }
-        { \quark_if_no_value:NF\l_@@_tmpb_tl { \l_@@_tmpb_tl\c_space_tl }#2 }
+        { \quark_if_no_value:NF\l_@@_get_tmpc_tl { \l_@@_get_tmpc_tl\c_space_tl }#2 }
     }
 \cs_generate_variant:Nn \@@_struct_gput_data_ref:nn {ee}
 %    \end{macrocode}
@@ -1319,7 +1474,7 @@
 % \section{Attributes and attribute classes}
 %    \begin{macrocode}
 %<*header>
-\ProvidesExplPackage {tagpdf-attr-code} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdf-attr-code} {2022-12-22} {0.98}
   {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	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-tree.dtx	2022-12-23 21:05:03 UTC (rev 65341)
@@ -47,13 +47,13 @@
 %    }^^A
 % }
 %
-% \date{Version 0.97, released 2022-08-24}
+% \date{Version 0.98, released 2022-12-22}
 % \maketitle
 % \begin{implementation}
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-tree-code} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdf-tree-code} {2022-12-22} {0.98}
  {part of tagpdf - code related to writing trees and dictionaries to the pdf}
 %</header>
 %    \end{macrocode}
@@ -81,6 +81,21 @@
       }
   }
 %    \end{macrocode}
+% \subsection{Check structure}
+% \begin{macro}{\@@_tree_final_checks:}
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_tree_final_checks:
+ {
+   \int_compare:nNnF {\seq_count:N\g_@@_struct_stack_seq}={1}
+    {
+      \msg_warning:nn {tag}{tree-struct-still-open}
+      \int_step_inline:nnn{2}{\seq_count:N\g_@@_struct_stack_seq}
+       {\tag_struct_end:}
+    }
+ }
+%    \end{macrocode}
+% \end{macro}
+% 
 % \subsection{Catalog: MarkInfo and StructTreeRoot}
 % The StructTreeRoot and the MarkInfo entry must be added to the catalog.
 % We do it late so that we can win, but before the pdfmanagement hook.
@@ -109,19 +124,35 @@
 % \begin{macro}{\@@_tree_write_structtreeroot:}
 % This writes out the root object.
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_tree_write_structtreeroot:
-  {
-     \@@_prop_gput:cnx
-       { g_@@_struct_0_prop }
-       { ParentTree }
-       { \pdf_object_ref:n { @@/tree/parenttree } }
-     \@@_prop_gput:cnx
-       { g_@@_struct_0_prop }
-       { RoleMap }
-       { \pdf_object_ref:n { @@/tree/rolemap } }
-     \@@_struct_write_obj:n { 0 }
-  }
+\pdf_version_compare:NnTF < {2.0}   
+ { 
+   \cs_new_protected:Npn \@@_tree_write_structtreeroot:
+     {
+        \@@_prop_gput:cnx
+          { g_@@_struct_0_prop }
+          { ParentTree }
+          { \pdf_object_ref:n { @@/tree/parenttree } }
+        \@@_prop_gput:cnx
+          { g_@@_struct_0_prop }
+          { RoleMap }
+          { \pdf_object_ref:n { @@/tree/rolemap } }       
+        \@@_struct_write_obj:n { 0 }
+     }
+ } 
 %    \end{macrocode}
+% no RoleMap in pdf 2.0
+%    \begin{macrocode}
+ {
+   \cs_new_protected:Npn \@@_tree_write_structtreeroot:
+     {
+        \@@_prop_gput:cnx
+          { g_@@_struct_0_prop }
+          { ParentTree }
+          { \pdf_object_ref:n { @@/tree/parenttree } }
+        \@@_struct_write_obj:n { 0 }
+     }  
+ } 
+%    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}{\@@_tree_write_structelements:}
@@ -300,7 +331,10 @@
 % \begin{variable}{@@/tree/rolemap}
 % At first we reserve again an object.
 %    \begin{macrocode}
-\pdf_object_new:n { @@/tree/rolemap }
+\pdf_version_compare:NnT < {2.0}
+  {
+    \pdf_object_new:n { @@/tree/rolemap }
+  }  
 %    \end{macrocode}
 % \end{variable}
 %
@@ -308,13 +342,26 @@
 % This writes out the rolemap, basically it simply pushes out
 % the dictionary which has been filled in the role module.
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_tree_write_rolemap:
+\pdf_version_compare:NnTF < {2.0}
   {
-    \pdf_object_write:nnx  { @@/tree/rolemap }{dict}
-      {
+   \cs_new_protected:Npn \@@_tree_write_rolemap:
+    {     
+      \prop_map_inline:Nn\g_@@_role_rolemap_prop
+        {
+          \pdfdict_gput:nnx {g_@@_role/RoleMap_dict}
+            {##1}
+            {\pdf_name_from_unicode_e:n{##2}}
+        }
+      \pdf_object_write:nnx  { @@/tree/rolemap }{dict}
+       {
         \pdfdict_use:n{g_@@_role/RoleMap_dict}
-      }
+       }
+    }
   }
+  {
+    \cs_new_protected:Npn \@@_tree_write_rolemap:{}
+  }
+    
 %    \end{macrocode}
 % \end{macro}
 %
@@ -360,10 +407,10 @@
 % \end{macro}
 % \subsection{Namespaces}
 % Namespaces are handle in the role module, here is the code to write them out.
-% Namespaces are only relevant for pdf2.0 but we don't care, it doesn't harm.
+% Namespaces are only relevant for pdf2.0.
 % \begin{variable}{@@/tree/namespaces}
 %    \begin{macrocode}
-\pdf_object_new:nn{ @@/tree/namespaces }{array}
+\pdf_object_new:n { @@/tree/namespaces }
 %    \end{macrocode}
 % \end{variable}
 % \begin{macro}{\@@_tree_write_namespaces:}
@@ -370,26 +417,29 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_tree_write_namespaces:
   {
-    \prop_map_inline:Nn \g_@@_role_NS_prop
-      {
-        \pdfdict_if_empty:nF {g_@@_role/RoleMapNS_##1_dict}
-          {
-            \pdf_object_write:nnx {@@/RoleMapNS/##1}{dict}
-              {
-                \pdfdict_use:n {g_@@_role/RoleMapNS_##1_dict}
-              }
-            \pdfdict_gput:nnx{g_@@_role/Namespace_##1_dict}
-              {RoleMapNS}{\pdf_object_ref:n {@@/RoleMapNS/##1}}
-          }
-        \pdf_object_write:nnx{tag/NS/##1}{dict}
-          {
-             \pdfdict_use:n {g_@@_role/Namespace_##1_dict}
-          }
-      }
-    \pdf_object_write:nx {@@/tree/namespaces} %array
-      {
-        \prop_map_tokens:Nn \g_@@_role_NS_prop{\use_ii:nn}
-      }
+   \pdf_version_compare:NnF < {2.0}
+    {
+      \prop_map_inline:Nn \g_@@_role_NS_prop
+        {
+          \pdfdict_if_empty:nF {g_@@_role/RoleMapNS_##1_dict}
+            {
+              \pdf_object_write:nnx {@@/RoleMapNS/##1}{dict}
+                {
+                  \pdfdict_use:n {g_@@_role/RoleMapNS_##1_dict}
+                }
+              \pdfdict_gput:nnx{g_@@_role/Namespace_##1_dict}
+                {RoleMapNS}{\pdf_object_ref:n {@@/RoleMapNS/##1}}
+            }
+          \pdf_object_write:nnx{tag/NS/##1}{dict}
+            {
+               \pdfdict_use:n {g_@@_role/Namespace_##1_dict}
+            }
+        }
+      \pdf_object_write:nnx {@@/tree/namespaces}{array}
+        {
+          \prop_map_tokens:Nn \g_@@_role_NS_prop{\use_ii:nn}
+        }
+    }  
   }
 %    \end{macrocode}
 % \end{macro}
@@ -404,6 +454,7 @@
     \bool_if:NT\g_@@_active_tree_bool
       {
         \hook_use:n {tagpdf/finish/before}
+        \@@_tree_final_checks:
         \@@_tree_write_parenttree:
         \@@_tree_write_rolemap:
         \@@_tree_write_classmap:

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx	2022-12-23 21:05:03 UTC (rev 65341)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.97, released 2022-08-24}
+% \date{Version 0.98, released 2022-12-22}
 % \maketitle
 % \begin{documentation}
 % \section{Setup commands}
@@ -246,7 +246,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-user} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdf-user} {2022-12-22} {0.98}
   {tagpdf - user commands}
 %</header>
 %    \end{macrocode}
@@ -520,8 +520,10 @@
 % \subsection{Structure destinations}
 % In TeXlive 2022 pdftex and luatex will offer support for structure destinations.
 % The  pdfmanagement has already backend support. We activate them if the
-% prerequisites are there: The pdf version should be 2.0, structures should be activated,
+% prerequisites are there: structures should be activated,
 % the code in the pdfmanagement must be there.
+% Structure destinations are actually PDF 2.0  only but they don't harm in 
+% older PDF and can improve html export. 
 %    \begin{macrocode}
 \AddToHook{begindocument/before}
   {
@@ -530,7 +532,6 @@
         { \g_@@_active_struct_dest_bool }
         { \g_@@_active_struct_bool }
         { \cs_if_exist_p:N \pdf_activate_structure_destination: }
-        { ! \pdf_version_compare_p:Nn < {2.0} }
       }
       {
         \tl_set:Nn \l_pdf_current_structure_destination_tl { __tag/struct/\g__tag_struct_stack_current_tl }
@@ -559,7 +560,7 @@
 %  Probably one should add some checks if we are already in a paragraph.
 %
 %
-%  \begin{macro}{\l_@@_para_bool,\l_@@_para_show_bool,\g_@@_para_int}
+%  \begin{macro}{\l_@@_para_bool,\l_@@_para_show_bool,\g_@@_para_int,\l_@@_para_tag_default_tl}
 %  At first some variables.
 %    \begin{macrocode}
 \bool_new:N \l_@@_para_bool
@@ -566,8 +567,10 @@
 \bool_new:N \l_@@_para_show_bool
 \int_new:N  \g_@@_para_begin_int
 \int_new:N  \g_@@_para_end_int
+\tl_new:N   \l_@@_para_tag_default_tl
+\tl_set:Nn  \l_@@_para_tag_default_tl { P }
 \tl_new:N   \l_@@_para_tag_tl
-\tl_set:Nn  \l_@@_para_tag_tl { P }
+\tl_set:Nn  \l_@@_para_tag_tl { \l_@@_para_tag_default_tl }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -603,7 +606,7 @@
           \llap{\color_select:n{red}\tiny\int_use:N\g_@@_para_begin_int\ }
           \tag_mc_end:
         }
-       \tag_mc_begin:n {tag=\l_@@_para_tag_tl}
+       \tag_mc_begin:n {}
      }
   }
 \AddToHook{para/end}

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx	2022-12-23 21:05:03 UTC (rev 65341)
@@ -92,7 +92,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*package>
-\ProvidesExplPackage {tagpdf} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdf} {2022-12-22} {0.98}
   { A package to experiment with pdf tagging }
 
 \bool_if:nF
@@ -118,7 +118,7 @@
 %    \end{macrocode}
 %<*debug>
 %    \begin{macrocode}
-\ProvidesExplPackage {tagpdf-debug} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdf-debug} {2022-12-22} {0.98}
   { debug code for tagpdf }
 \@ifpackageloaded{tagpdf}{}{\PackageWarning{tagpdf-debug}{tagpdf~not~loaded,~quitting}\endinput}
 %    \end{macrocode}
@@ -159,7 +159,7 @@
 %    \end{macrocode}
 %    \begin{macrocode}
 %<*base>
-\ProvidesExplPackage {tagpdf-base} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdf-base} {2022-12-22} {0.98}
   {part of tagpdf - provide base, no-op versions of the user commands }
 %</base>
 %    \end{macrocode}
@@ -180,48 +180,7 @@
  }
 %</base>
 %    \end{macrocode}
-% \section{Temporary code}
-% This is code which will be removed when proper support exists in LaTeX
-% It writes only dictionaries!
-% \subsection{Faster object writing}
-%    \begin{macrocode}
-%<*package>
-\cs_if_free:NT \pdf_object_write:nnn
- {
-   \cs_new_protected:Npn \pdf_object_new:n #1
-     { \pdf_object_new:nn{#1}{dict} }
-   \cs_new_protected:Npn \pdf_object_write:nnn #1#2#3
-     {
-       \pdf_object_write:nn {#1}{#3}
-     }
-  \str_if_eq:VnT \c_sys_backend_str {pdftex}
-    {
-      \cs_set_protected:Npn \pdf_object_write:nnn #1#2#3
-        {
-         \tex_immediate:D \tex_pdfobj:D
-          useobjnum ~
-         \int_use:c
-          { c__pdf_backend_object_ \tl_to_str:n {#1} _int }
-          { << ~ \exp_not:n {#3} ~ >> }
-        }
-    }
-  \str_if_eq:VnT \c_sys_backend_str {luatex}
-    {
-      \cs_set_protected:Npn \pdf_object_write:nnn #1#2#3
-        {
-          \tex_immediate:D \tex_pdfextension:D obj ~
-            useobjnum ~
-            \int_use:c
-            { c__pdf_backend_object_ \tl_to_str:n {#1} _int }
-            { << ~ \exp_not:n {#3} ~ >> }
-        }
-     }
- }
-\cs_generate_variant:Nn \pdf_object_write:nnn {nnx}
 
-%</package>
-%    \end{macrocode}
-
 % \subsection{a LastPage label}
 % See also issue \#2 in Accessible-xref
 % \begin{macro}{\@@_lastpagelabel:}
@@ -276,7 +235,10 @@
 % \begin{variable}
 %  {
 %    \l_@@_tmpa_tl,
-%    \l_@@_tmpb_tl
+%    \l_@@_tmpb_tl,
+%    \l_@@_get_tmpc_tl,    
+%    \l_@@_get_parent_tmpa_tl
+%    \l_@@_get_parent_tmpb_tl    
 %    \l_@@_tmpa_str,
 %    \l_@@_tmpa_prop,
 %    \l_@@_tmpa_seq,
@@ -290,6 +252,9 @@
 %    \begin{macrocode}
 \tl_new:N    \l_@@_tmpa_tl
 \tl_new:N    \l_@@_tmpb_tl
+\tl_new:N    \l_@@_get_tmpc_tl
+\tl_new:N    \l_@@_get_parent_tmpa_tl
+\tl_new:N    \l_@@_get_parent_tmpb_tl
 \str_new:N   \l_@@_tmpa_str
 \prop_new:N  \l_@@_tmpa_prop
 \seq_new:N   \l_@@_tmpa_seq
@@ -386,7 +351,7 @@
 \cs_generate_variant:Nn \pdffile_embed_stream:nnn {nxx,oxx}
 \cs_generate_variant:Nn \prop_gput:Nnn {Nxx,Nen}
 \cs_generate_variant:Nn \prop_put:Nnn  {Nxx}
-\cs_generate_variant:Nn \prop_item:Nn {No}
+\cs_generate_variant:Nn \prop_item:Nn {No,Ne}
 \cs_generate_variant:Nn \ref_label:nn { nv }
 \cs_generate_variant:Nn \seq_set_split:Nnn{Nne}
 \cs_generate_variant:Nn \str_set_convert:Nnnn {Nonn, Noon, Nnon }

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf.ins	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf.ins	2022-12-23 21:05:03 UTC (rev 65341)
@@ -62,6 +62,7 @@
         \from{tagpdf-mc-shared.dtx}{shared}
         \from{tagpdf.dtx}{mcloading}
         \from{tagpdf-tree.dtx}{package}
+        \from{tagpdf-data.dtx}{package} %should be before the roles code
         \from{tagpdf-roles.dtx}{package}
         \from{tagpdf-struct.dtx}{package}%contains also the attr code.
         \from{tagpdf-space.dtx}{package}
@@ -88,6 +89,24 @@
 \generate
   {\file{tagpdf-mc-code-lua.sty}{\from{tagpdf-mc-luacode.dtx}{luamode}}}
 
+\generate
+  {\file{tagpdf-ns-pdf.def}{\from{tagpdf-data.dtx}{ns-pdf}}}
+\generate
+  {\file{tagpdf-ns-pdf2.def}{\from{tagpdf-data.dtx}{ns-pdf2}}}
+\generate
+  {\file{tagpdf-ns-mathml.def}{\from{tagpdf-data.dtx}{ns-mathml}}}
+\generate
+  {\file{tagpdf-ns-latex.def}{\from{tagpdf-data.dtx}{ns-latex}}}
+\generate
+  {\file{tagpdf-ns-latex-book.def}{\from{tagpdf-data.dtx}{ns-latex-book}}}
+\generate
+  {\file{tagpdf-ns-latex-inline.def}{\from{tagpdf-data.dtx}{ns-latex-inline}}}
+\generate
+  {\file{tagpdf-parent-child.csv}{\from{tagpdf-data.dtx}{parent-child}}}
+\generate
+  {\file{tagpdf-parent-child-2.csv}{\from{tagpdf-data.dtx}{parent-child-2}}}
+
+
 % check later if the mc-code uses debug guards too.
 \generate
   {\file{tagpdf-debug.sty}
@@ -117,4 +136,6 @@
 }
 \def\currentpostamble{\defaultpostamble}%
 \generate{\file{tagpdf.lua}   {\from{tagpdf-backend.dtx}{lua}}}
+
+
 \endbatchfile

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty	2022-12-23 21:05:03 UTC (rev 65341)
@@ -24,7 +24,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf.dtx
-\ProvidesExplPackage {tagpdf-base} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdf-base} {2022-12-22} {0.98}
   {part of tagpdf - provide base, no-op versions of the user commands }
 \AddToHook{begindocument}
  {

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty	2022-12-23 21:05:03 UTC (rev 65341)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-mc-generic.dtx
-\ProvidesExplPackage {tagpdf-debug-generic} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdf-debug-generic} {2022-12-22} {0.98}
  {part of tagpdf - debugging code related to marking chunks - generic mode}
 \cs_set_protected:Npn \tag_mc_begin:n #1 %#1 keyval
   {
@@ -29,6 +29,8 @@
         \group_begin: %hm
         \__tag_check_mc_if_nested:
         \bool_gset_true:N \g__tag_in_mc_bool
+        \tl_set_eq:NN \l__tag_mc_key_tag_tl \g__tag_struct_tag_tl
+        \tl_gset_eq:NN\g__tag_mc_key_tag_tl \g__tag_struct_tag_tl
         \keys_set:nn { __tag / mc } {#1}
         \bool_if:NTF \l__tag_mc_artifact_bool
           { %handle artifact
@@ -49,6 +51,23 @@
               }
             \bool_if:NF \l__tag_mc_key_stash_bool
               {
+                \exp_args:NV\__tag_struct_get_tag_info:nNN
+                    \g__tag_struct_stack_current_tl
+                    \l__tag_tmpa_tl
+                    \l__tag_tmpb_tl
+                 \__tag_check_parent_child:VVnnN
+                 \l__tag_tmpa_tl \l__tag_tmpb_tl
+                 {MC}{}
+                 \l__tag_parent_child_check_tl
+                \int_compare:nNnT {\l__tag_parent_child_check_tl}<{0}
+                 {
+                    \msg_warning:nnxxx
+                     { tag }
+                     {role-parent-child}
+                     { \g__tag_struct_tag_tl/\g__tag_struct_tag_NS_tl  }
+                     { MC~(=~real content) }
+                     { 'not~allowed'. }
+                 }
                 \__tag_mc_handle_stash:x { \int_use:N \c at g__tag_MCID_abs_int }
               }
           }

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty	2022-12-23 21:05:03 UTC (rev 65341)
@@ -26,7 +26,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf.dtx
-\ProvidesExplPackage {tagpdf-debug} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdf-debug} {2022-12-22} {0.98}
   { debug code for tagpdf }
 \@ifpackageloaded{tagpdf}{}{\PackageWarning{tagpdf-debug}{tagpdf~not~loaded,~quitting}\endinput}
 \prop_gput:Nnn \g_msg_module_type_prop { tag / debug} {}
@@ -139,6 +139,10 @@
           { /StructElem }
         \tl_set:Nn \l__tag_struct_stack_parent_tmpa_tl {-1}
         \keys_set:nn { __tag / struct} { #1 }
+        \__tag_struct_set_tag_info:eVV
+          { \int_eval:n {\c at g__tag_struct_abs_int} }
+           \g__tag_struct_tag_tl
+           \g__tag_struct_tag_NS_tl
         \__tag_check_structure_has_tag:n { \int_eval:n {\c at g__tag_struct_abs_int} }
         \tl_if_empty:NF
           \l__tag_struct_key_label_tl
@@ -160,7 +164,35 @@
         %\seq_show:N   \g__tag_struct_stack_seq
         \bool_if:NF
           \l__tag_struct_elem_stash_bool
-          {%set the  parent
+          {
+            \__tag_struct_get_tag_info:eNN
+              {\l__tag_struct_stack_parent_tmpa_tl}
+              \l__tag_get_parent_tmpa_tl
+              \l__tag_get_parent_tmpb_tl
+            \__tag_check_parent_child:VVVVN
+              \l__tag_get_parent_tmpa_tl
+              \l__tag_get_parent_tmpb_tl
+              \g__tag_struct_tag_tl
+              \g__tag_struct_tag_NS_tl
+              \l__tag_parent_child_check_tl
+            \int_compare:nNnT {\l__tag_parent_child_check_tl}<0
+              {
+                \msg_warning:nnxxx
+                 { tag }
+                 {role-parent-child}
+                 { \l__tag_get_parent_tmpa_tl/\l__tag_get_parent_tmpb_tl }
+                 { \g__tag_struct_tag_tl/\g__tag_struct_tag_NS_tl  }
+                 { not~allowed~(struct~\g__tag_struct_stack_current_tl) }
+                \cs_set_eq:NN \l__tag_role_remap_tag_tl \g__tag_struct_tag_tl
+                \cs_set_eq:NN \l__tag_role_remap_NS_tl \g__tag_struct_tag_NS_tl
+                \__tag_role_remap:
+                \cs_gset_eq:NN \g__tag_struct_tag_tl \l__tag_role_remap_tag_tl
+                \cs_gset_eq:NN  \g__tag_struct_tag_NS_tl \l__tag_role_remap_NS_tl
+                \__tag_struct_set_tag_info:eVV
+                  { \int_eval:n {\c at g__tag_struct_abs_int} }
+                    \g__tag_struct_tag_tl
+                    \g__tag_struct_tag_NS_tl
+              }
             \__tag_prop_gput:cnx
               { g__tag_struct_\int_eval:n {\c at g__tag_struct_abs_int}_prop }
               { P }

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def	2022-12-23 21:05:03 UTC (rev 65341)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-backend.dtx
-\ProvidesExplFile {tagpdf-luatex.def} {2022-08-24} {0.97}
+\ProvidesExplFile {tagpdf-luatex.def} {2022-12-22} {0.98}
   {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	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty	2022-12-23 21:05:03 UTC (rev 65341)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-mc-generic.dtx
-\ProvidesExplPackage {tagpdf-mc-code-generic} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdf-mc-code-generic} {2022-12-22} {0.98}
  {part of tagpdf - code related to marking chunks - generic mode}
 \__tag_prop_new:N \g__tag_MCID_byabspage_prop
 
@@ -339,6 +339,8 @@
         \group_begin: %hm
         \__tag_check_mc_if_nested:
         \bool_gset_true:N \g__tag_in_mc_bool
+        \tl_set_eq:NN \l__tag_mc_key_tag_tl \g__tag_struct_tag_tl
+        \tl_gset_eq:NN\g__tag_mc_key_tag_tl \g__tag_struct_tag_tl
         \keys_set:nn { __tag / mc } {#1}
         \bool_if:NTF \l__tag_mc_artifact_bool
           { %handle artifact
@@ -359,6 +361,23 @@
               }
             \bool_if:NF \l__tag_mc_key_stash_bool
               {
+                \exp_args:NV\__tag_struct_get_tag_info:nNN
+                    \g__tag_struct_stack_current_tl
+                    \l__tag_tmpa_tl
+                    \l__tag_tmpb_tl
+                 \__tag_check_parent_child:VVnnN
+                 \l__tag_tmpa_tl \l__tag_tmpb_tl
+                 {MC}{}
+                 \l__tag_parent_child_check_tl
+                \int_compare:nNnT {\l__tag_parent_child_check_tl}<{0}
+                 {
+                    \msg_warning:nnxxx
+                     { tag }
+                     {role-parent-child}
+                     { \g__tag_struct_tag_tl/\g__tag_struct_tag_NS_tl  }
+                     { MC~(=~real content) }
+                     { 'not~allowed'. }
+                 }
                 \__tag_mc_handle_stash:x { \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	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty	2022-12-23 21:05:03 UTC (rev 65341)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-mc-luacode.dtx
-\ProvidesExplPackage {tagpdf-mc-code-lua} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdf-mc-code-lua} {2022-12-22} {0.98}
   {tagpdf - mc code only for the luamode }
 \hook_gput_code:nnn{begindocument}{tagpdf/mc}
   {
@@ -178,6 +178,12 @@
         \bool_set_false:N\l__tag_mc_artifact_bool
         \tl_clear:N \l__tag_mc_key_properties_tl
         \int_gincr:N \c at g__tag_MCID_abs_int
+        \tl_set_eq:NN \l__tag_mc_key_tag_tl \g__tag_struct_tag_tl
+        \tl_gset_eq:NN\g__tag_mc_key_tag_tl \g__tag_struct_tag_tl
+        \lua_now:e
+          {
+            ltx.__tag.func.store_mc_data(\__tag_get_mc_abs_cnt:,"tag","\g__tag_struct_tag_tl")
+          }
         \keys_set:nn { __tag / mc }{ label={}, #1 }
         %check that a tag or artifact has been used
         \__tag_check_mc_tag:N \l__tag_mc_key_tag_tl
@@ -193,6 +199,23 @@
            % if not stashed record the absolute number
             \bool_if:NF \l__tag_mc_key_stash_bool
               {
+                \exp_args:NV\__tag_struct_get_tag_info:nNN
+                    \g__tag_struct_stack_current_tl
+                    \l__tag_tmpa_tl
+                    \l__tag_tmpb_tl
+                \__tag_check_parent_child:VVnnN
+                 \l__tag_tmpa_tl \l__tag_tmpb_tl
+                 {MC}{}
+                 \l__tag_parent_child_check_tl
+                \int_compare:nNnT {\l__tag_parent_child_check_tl}<{0}
+                 {
+                   \msg_warning:nnxxx
+                     { tag }
+                     {role-parent-child}
+                     { \g__tag_struct_tag_tl/\g__tag_struct_tag_NS_tl  }
+                     { MC~(=~real content) }
+                     { 'not~allowed'. }
+                 }
                 \__tag_mc_handle_stash:x { \__tag_get_mc_abs_cnt: }
               }
           }

Added: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def	2022-12-23 21:05:03 UTC (rev 65341)
@@ -0,0 +1,32 @@
+%%
+%% This is file `tagpdf-ns-latex-book.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% tagpdf-data.dtx  (with options: `ns-latex-book')
+%% 
+%% Copyright (C) 2019-2022 Ulrike Fischer
+%% 
+%% It may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License (LPPL), either version 1.3c of
+%% this license or (at your option) any later version.  The latest
+%% version of this license is in the file:
+%% 
+%%    https://www.latex-project.org/lppl.txt
+%% 
+%% This file is part of the "tagpdf bundle" (The Work in LPPL)
+%% and all files in that bundle must be distributed together.
+%% 
+%% File: tagpdf-data.dtx
+%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2022-12-22} {0.98}
+%% {latex-book} {https://www.latex-project.org/ns/book/2022}{}
+chapter,       H1,pdf2,
+section,       H2,pdf2,
+subsection,    H3,pdf2,
+subsubsection, H4,pdf2,
+paragraph,     H5,pdf2,
+subparagraph,  H6,pdf2,
+%% 
+%%
+%% End of file `tagpdf-ns-latex-book.def'.


Property changes on: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-inline.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-inline.def	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-inline.def	2022-12-23 21:05:03 UTC (rev 65341)
@@ -0,0 +1,33 @@
+%%
+%% This is file `tagpdf-ns-latex-inline.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% tagpdf-data.dtx  (with options: `ns-latex-inline')
+%% 
+%% Copyright (C) 2019-2022 Ulrike Fischer
+%% 
+%% It may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License (LPPL), either version 1.3c of
+%% this license or (at your option) any later version.  The latest
+%% version of this license is in the file:
+%% 
+%%    https://www.latex-project.org/lppl.txt
+%% 
+%% This file is part of the "tagpdf bundle" (The Work in LPPL)
+%% and all files in that bundle must be distributed together.
+%% 
+%% File: tagpdf-data.dtx
+%% \ProvidesExplFile {tagpdf-ns-latex-inline.def} {2022-12-22} {0.98}
+%% {latex-inline} {https://www.latex-project.org/ns/inline/2022}{}
+chapter,       Span, pdf2,
+section,       Span, pdf2,
+subsection,    Span, pdf2,
+subsubsection, Span, pdf2,
+paragraph,     Span, pdf2,
+subparagraph,  Span, pdf2,
+P,             Span, pdf2,
+%% 
+%%
+%% End of file `tagpdf-ns-latex-inline.def'.


Property changes on: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-inline.def
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def	2022-12-23 21:05:03 UTC (rev 65341)
@@ -0,0 +1,42 @@
+%%
+%% This is file `tagpdf-ns-latex.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% tagpdf-data.dtx  (with options: `ns-latex')
+%% 
+%% Copyright (C) 2019-2022 Ulrike Fischer
+%% 
+%% It may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License (LPPL), either version 1.3c of
+%% this license or (at your option) any later version.  The latest
+%% version of this license is in the file:
+%% 
+%%    https://www.latex-project.org/lppl.txt
+%% 
+%% This file is part of the "tagpdf bundle" (The Work in LPPL)
+%% and all files in that bundle must be distributed together.
+%% 
+%% File: tagpdf-data.dtx
+%% \ProvidesExplFile {tagpdf-ns-latex.def} {2022-12-22} {0.98}
+%% {latex} {https://www.latex-project.org/ns/dflt/2022}{}
+title,        Title,    pdf2,
+part,         Title,    pdf2,
+section,      H1,       pdf2,
+subsection,   H2,       pdf2,
+subsubsection,H3,       pdf2,
+paragraph,    H4,       pdf2,
+subparagraph, H5,       pdf2,
+itemize,      L,        pdf2,
+enumerate,    L,        pdf2,
+description,  L,        pdf2,
+item,         LI,       pdf2,
+itemlabel,    Lbl,      pdf2,
+itembody,     LBody,    pdf2,
+footnote,     FENote,   pdf2,
+footnotemark, Lbl,      pdf2,
+footnotelabel,Lbl,      pdf2,
+%% 
+%%
+%% End of file `tagpdf-ns-latex.def'.


Property changes on: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def	2022-12-23 21:05:03 UTC (rev 65341)
@@ -0,0 +1,216 @@
+%%
+%% This is file `tagpdf-ns-mathml.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% tagpdf-data.dtx  (with options: `ns-mathml')
+%% 
+%% Copyright (C) 2019-2022 Ulrike Fischer
+%% 
+%% It may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License (LPPL), either version 1.3c of
+%% this license or (at your option) any later version.  The latest
+%% version of this license is in the file:
+%% 
+%%    https://www.latex-project.org/lppl.txt
+%% 
+%% This file is part of the "tagpdf bundle" (The Work in LPPL)
+%% and all files in that bundle must be distributed together.
+%% 
+%% File: tagpdf-data.dtx
+%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2022-12-22} {0.98}
+abs,,,
+and,,,
+annotation,,,
+apply,,,
+approx,,,
+arccos,,,
+arccosh,,,
+arccot,,,
+arccoth,,,
+arccsc,,,
+arccsch,,,
+arcsec,,,
+arcsech,,,
+arcsin,,,
+arcsinh,,,
+arctan,,,
+arctanh,,,
+arg,,,
+bind,,,
+bvar,,,
+card,,,
+cartesianproduct,,,
+cbytes,,,
+ceiling,,,
+cerror,,,
+ci,,,
+cn,,,
+codomain,,,
+complexes,,,
+compose,,,
+condition,,,
+conjugate,,,
+cos,,,
+cosh,,,
+cot,,,
+coth,,,
+cs,,,
+csc,,,
+csch,,,
+csymbol,,,
+curl,,,
+declare,,,
+degree,,,
+determinant,,,
+diff,,,
+divergence,,,
+divide,,,
+domain,,,
+domainofapplication,,,
+emptyset,,,
+eq,,,
+equivalent,,,
+eulergamma,,,
+exists,,,
+exp,,,
+exponentiale,,,
+factorial,,,
+factorof,,,
+false,,,
+floor,,,
+fn,,,
+forall,,,
+gcd,,,
+geq,,,
+grad,,,
+gt,,,
+ident,,,
+image,,,
+imaginary,,,
+imaginaryi,,,
+implies,,,
+in,,,
+infinity,,,
+int,,,
+integers,,,
+intersect,,,
+interval,,,
+inverse,,,
+lambda,,,
+laplacian,,,
+lcm,,,
+leq,,,
+limit,,,
+ln,,,
+log,,,
+logbase,,,
+lowlimit,,,
+lt,,,
+maction,,,
+maligngroup,,,
+malignmark,,,
+math,,,
+matrix,,,
+matrixrow,,,
+max,,,
+mean,,,
+median,,,
+menclose,,,
+merror,,,
+mfenced,,,
+mfrac,,,
+mglyph,,,
+mi,,,
+min,,,
+minus,,,
+mlabeledtr,,,
+mlongdiv,,,
+mmultiscripts,,,
+mn,,,
+mo,,,
+mode,,,
+moment,,,
+momentabout,,,
+mover,,,
+mpadded,,,
+mphantom,,,
+mprescripts,,,
+mroot,,,
+mrow,,,
+ms,,,
+mscarries,,,
+mscarry,,,
+msgroup,,,
+msline,,,
+mspace,,,
+msqrt,,,
+msrow,,,
+mstack,,,
+mstyle,,,
+msub,,,
+msubsup,,,
+msup,,,
+mtable,,,
+mtd,,,
+mtext,,,
+mtr,,,
+munder,,,
+munderover,,,
+naturalnumbers,,,
+neq,,,
+none,,,
+not,,,
+notanumber,,,
+notin,,,
+notprsubset,,,
+notsubset,,,
+or,,,
+otherwise,,,
+outerproduct,,,
+partialdiff,,,
+pi,,,
+piece,,,
+piecewise,,,
+plus,,,
+power,,,
+primes,,,
+product,,,
+prsubset,,,
+quotient,,,
+rationals,,,
+real,,,
+reals,,,
+reln,,,
+rem,,,
+root,,,
+scalarproduct,,,
+sdev,,,
+sec,,,
+sech,,,
+selector,,,
+semantics,,,
+sep,,,
+set,,,
+setdiff,,,
+share,,,
+sin,,,
+sinh,,,
+subset,,,
+sum,,,
+tan,,,
+tanh,,,
+tendsto,,,
+times,,,
+transpose,,,
+true,,,
+union,,,
+uplimit,,,
+variance,,,
+vector,,,
+vectorproduct,,,
+xor,,,
+%% 
+%%
+%% End of file `tagpdf-ns-mathml.def'.


Property changes on: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def	2022-12-23 21:05:03 UTC (rev 65341)
@@ -0,0 +1,76 @@
+%%
+%% This is file `tagpdf-ns-pdf.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% tagpdf-data.dtx  (with options: `ns-pdf')
+%% 
+%% Copyright (C) 2019-2022 Ulrike Fischer
+%% 
+%% It may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License (LPPL), either version 1.3c of
+%% this license or (at your option) any later version.  The latest
+%% version of this license is in the file:
+%% 
+%%    https://www.latex-project.org/lppl.txt
+%% 
+%% This file is part of the "tagpdf bundle" (The Work in LPPL)
+%% and all files in that bundle must be distributed together.
+%% 
+%% File: tagpdf-data.dtx
+%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2022-12-22} {0.98}
+%%  {pdf}   {http://iso.org/pdf/ssn}{}
+StructTreeRoot,,,D,
+Document,,,D,
+Part,,,G,
+Sect,,,G,
+Div,,,G,
+Caption,,,GB,
+NonStruct,,,G,
+H,,,B,
+H1,,,B,
+H2,,,B,
+H3,,,B,
+H4,,,B,
+H5,,,B,
+H6,,,B,
+P,,,B,
+L,,,BI,
+LI,,,L,
+Lbl,,,I,
+LBody,,,L,
+Table,,,B,
+TR,,,T,
+TH,,,T,
+TD,,,T,
+THead,,,T,
+TBody,,,T,
+TFoot,,,T,
+Span,,,I,
+Link,,,GBI,
+Annot,,,GBI,
+Figure,,,GBI,
+Formula,,,GBI,
+Form,,,GBI,
+Ruby,,,I,
+RB,,,I,
+RT,,,I,
+Warichu,,,I,
+WT,,,I,
+WP,,,I,
+Artifact,,,GBI,
+Art,,,,G,  % only pdf, types unclear, needs correction later
+BlockQuote,,,G, %or GB?
+TOC,,,G,
+TOCI,,,G,
+Index,,,G,
+Private,,,G,
+Quote,,,I,
+Note,,,GBI, % I in reference, but
+Reference,,,B, %
+BibEntry,,,B, %
+Code,,,I, %
+%% 
+%%
+%% End of file `tagpdf-ns-pdf.def'.


Property changes on: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def	2022-12-23 21:05:03 UTC (rev 65341)
@@ -0,0 +1,75 @@
+%%
+%% This is file `tagpdf-ns-pdf2.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% tagpdf-data.dtx  (with options: `ns-pdf2')
+%% 
+%% Copyright (C) 2019-2022 Ulrike Fischer
+%% 
+%% It may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License (LPPL), either version 1.3c of
+%% this license or (at your option) any later version.  The latest
+%% version of this license is in the file:
+%% 
+%%    https://www.latex-project.org/lppl.txt
+%% 
+%% This file is part of the "tagpdf bundle" (The Work in LPPL)
+%% and all files in that bundle must be distributed together.
+%% 
+%% File: tagpdf-data.dtx
+%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2022-12-22} {0.98}
+%%  {pdf2}  {http://iso.org/pdf2/ssn}{}
+Document,,,D,
+Part,,,G,
+Sect,,,G,
+Div,,,G,
+Caption,,,GB,
+NonStruct,,,G,
+H,,,B,
+H1,,,B,
+H2,,,B,
+H3,,,B,
+H4,,,B,
+H5,,,B,
+H6,,,B,
+P,,,B,
+L,,,BI,
+LI,,,L,
+Lbl,,,I,
+LBody,,,L,
+Table,,,B,
+TR,,,T,
+TH,,,T,
+TD,,,T,
+THead,,,T,
+TBody,,,T,
+TFoot,,,T,
+Span,,,I,
+Link,,,GBI,
+Annot,,,GBI,
+Figure,,,GBI,
+Formula,,,GBI,
+Form,,,GBI,
+Ruby,,,I,
+RB,,,I,
+RT,,,I,
+Warichu,,,I,
+WT,,,I,
+WP,,,I,
+Artifact,,,GBI,
+DocumentFragment,Art,    pdf,D, %rest only pdf2
+Aside,           Note,   pdf,G,
+H7,              H6,     pdf,B,
+H8,              H6,     pdf,B,
+H9,              H6,     pdf,B,
+H10,             H6,     pdf,B,
+Title,           P,      pdf,GB,
+FENote,          Note,   pdf,GBI,
+Sub,             Span,   pdf,I,
+Em,              Span,   pdf,I,
+Strong,          Span,   pdf,I,
+%% 
+%%
+%% End of file `tagpdf-ns-pdf2.def'.


Property changes on: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua	2022-12-23 21:05:03 UTC (rev 65341)
@@ -24,8 +24,8 @@
 
 local ProvidesLuaModule = {
     name          = "tagpdf",
-    version       = "0.97",       --TAGVERSION
-    date          = "2022-08-24", --TAGDATE
+    version       = "0.98",       --TAGVERSION
+    date          = "2022-12-22", --TAGDATE
     description   = "tagpdf lua code",
     license       = "The LATEX Project Public License 1.3c"
 }
@@ -123,6 +123,7 @@
 ltx.__tag.tables   = ltx.__tag.tables or  { } -- tables created with new prop and new seq.
                                         -- wasn't a so great idea ...
                                         -- g__tag_role_tags_seq used by tag<-> is in this tables!
+                                        -- used for pure lua tables too now!
 ltx.__tag.page     = ltx.__tag.page   or  { } -- page data, currently only i->{0->mcnum,1->mcnum,...}
 ltx.__tag.trace    = ltx.__tag.trace  or  { } -- show commands
 ltx.__tag.func     = ltx.__tag.func   or  { } -- functions
@@ -214,11 +215,21 @@
  end
  return subtype
 end
-
+ltx.__tag.tables.role_tag_attribute = {}
+ltx.__tag.tables.role_attribute_tag = {}
+local __tag_alloctag =
+ function (tag)
+   if not ltx.__tag.tables.role_tag_attribute[tag] then
+    table.insert(ltx.__tag.tables.role_attribute_tag,tag)
+    ltx.__tag.tables.role_tag_attribute[tag]=#ltx.__tag.tables.role_attribute_tag
+    __tag_log  ("Add "..tag.." "..ltx.__tag.tables.role_tag_attribute[tag],3)
+   end
+ end
+ltx.__tag.func.alloctag = __tag_alloctag
 local __tag_get_num_from =
  function (tag)
-  if ltx.__tag.tables["g__tag_role_tags_prop"][tag] then
-    a= ltx.__tag.tables["g__tag_role_tags_prop"][tag]
+  if ltx.__tag.tables.role_tag_attribute[tag] then
+    a= ltx.__tag.tables.role_tag_attribute[tag]
   else
     a= -1
   end
@@ -236,8 +247,8 @@
 end
 local __tag_get_tag_from =
  function  (num)
-  if ltx.__tag.tables["g__tag_role_tags_seq"][num] then
-   a = ltx.__tag.tables["g__tag_role_tags_seq"][num]
+  if ltx.__tag.tables.role_attribute_tag[num] then
+   a = ltx.__tag.tables.role_attribute_tag[num]
   else
    a= "UNKNOWN"
   end
@@ -534,7 +545,7 @@
     elseif n.id == VLIST then -- enter the vlist
      mcopen,mcpagecnt,mccntprev,mctypeprev=
       ltx.__tag.func.mark_page_elements (n,mcpagecnt,mccntprev,mcopen,"INTERNAL VLIST",mctypeprev)
-    elseif n.id == GLUE then       -- at glue real space chars are inserted, but this has
+    elseif n.id == GLUE and not n.leader then -- at glue real space chars are inserted, but this has
                                    -- been done if the previous shipout wandering, so here it is ignored
     elseif n.id == LOCAL_PAR then  -- local_par is ignored
     elseif n.id == PENALTY then    -- penalty is ignored

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty	2022-12-23 21:05:03 UTC (rev 65341)
@@ -9,6 +9,7 @@
 %% tagpdf-mc-shared.dtx  (with options: `shared')
 %% tagpdf.dtx  (with options: `mcloading')
 %% tagpdf-tree.dtx  (with options: `package')
+%% tagpdf-data.dtx  (with options: `package')
 %% tagpdf-roles.dtx  (with options: `package')
 %% tagpdf-struct.dtx  (with options: `package')
 %% tagpdf-space.dtx  (with options: `package')
@@ -27,7 +28,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf.dtx
-\ProvidesExplPackage {tagpdf} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdf} {2022-12-22} {0.98}
   { A package to experiment with pdf tagging }
 
 \bool_if:nF
@@ -57,40 +58,7 @@
 \ProcessOptions
 \RequirePackage{l3ref-tmp}
 \RequirePackage{tagpdf-base}
-\cs_if_free:NT \pdf_object_write:nnn
- {
-   \cs_new_protected:Npn \pdf_object_new:n #1
-     { \pdf_object_new:nn{#1}{dict} }
-   \cs_new_protected:Npn \pdf_object_write:nnn #1#2#3
-     {
-       \pdf_object_write:nn {#1}{#3}
-     }
-  \str_if_eq:VnT \c_sys_backend_str {pdftex}
-    {
-      \cs_set_protected:Npn \pdf_object_write:nnn #1#2#3
-        {
-         \tex_immediate:D \tex_pdfobj:D
-          useobjnum ~
-         \int_use:c
-          { c__pdf_backend_object_ \tl_to_str:n {#1} _int }
-          { << ~ \exp_not:n {#3} ~ >> }
-        }
-    }
-  \str_if_eq:VnT \c_sys_backend_str {luatex}
-    {
-      \cs_set_protected:Npn \pdf_object_write:nnn #1#2#3
-        {
-          \tex_immediate:D \tex_pdfextension:D obj ~
-            useobjnum ~
-            \int_use:c
-            { c__pdf_backend_object_ \tl_to_str:n {#1} _int }
-            { << ~ \exp_not:n {#3} ~ >> }
-        }
-     }
- }
-\cs_generate_variant:Nn \pdf_object_write:nnn {nnx}
 
-
  \cs_new_protected:Npn \__tag_lastpagelabel:
    {
      \legacy_if:nT { @filesw }
@@ -129,6 +97,9 @@
 
 \tl_new:N    \l__tag_tmpa_tl
 \tl_new:N    \l__tag_tmpb_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
 \str_new:N   \l__tag_tmpa_str
 \prop_new:N  \l__tag_tmpa_prop
 \seq_new:N   \l__tag_tmpa_seq
@@ -158,7 +129,7 @@
 \cs_generate_variant:Nn \pdffile_embed_stream:nnn {nxx,oxx}
 \cs_generate_variant:Nn \prop_gput:Nnn {Nxx,Nen}
 \cs_generate_variant:Nn \prop_put:Nnn  {Nxx}
-\cs_generate_variant:Nn \prop_item:Nn {No}
+\cs_generate_variant:Nn \prop_item:Nn {No,Ne}
 \cs_generate_variant:Nn \ref_label:nn { nv }
 \cs_generate_variant:Nn \seq_set_split:Nnn{Nne}
 \cs_generate_variant:Nn \str_set_convert:Nnnn {Nonn, Noon, Nnon }
@@ -318,13 +289,27 @@
 \msg_new:nnn { tag } {struct-label-unknown}
   { structure~with~label~#1~is~unknown~rerun}
 \msg_new:nnn { tag } {struct-show-closing}
-  { closing~structure~#1~tagged~\prop_item:cn{g__tag_struct_#1_prop}{S} }
+  { closing~structure~#1~tagged~\use:e{\prop_item:cn{g__tag_struct_#1_prop}{S}} }
+\msg_new:nnn { tag } {tree-struct-still-open}
+  {
+    There~are~still~open~structures~on~the~stack!\\
+    The~stack~contains~\seq_use:Nn\g__tag_struct_tag_stack_seq{,}.\\
+    The~structures~are~automatically~closed,\\
+    but~their~nesting~can~be~wrong.
+  }
 \msg_new:nnn { tag } {attr-unknown}  { attribute~#1~is~unknown}
 \msg_new:nnn { tag } {role-missing}     { tag~#1~has~no~role~assigned  }
 \msg_new:nnn { tag } {role-unknown}     { role~#1~is~not~known  }
 \msg_new:nnn { tag } {role-unknown-tag} { tag~#1~is~not~known  }
+\msg_new:nnn { tag } {role-parent-child}
+  { The~rule~between~parent~'#1'~\\and~child~'#2'~is~#3}
+\msg_new:nnn { tag } {role-remapping}
+  { remapping~tag~to~#1 }
 \msg_new:nnn { tag } {role-tag}         { mapping~tag~#1~to~role~#2  }
 \msg_new:nnn { tag } {new-tag}          { adding~new~tag~#1 }
+\msg_new:nnn { tag } {read-namespace}   { reading~namespace~definitions~tagpdf-ns-#1.def }
+\msg_new:nnn { tag } {namespace-missing}{ namespace~definitions~tagpdf-ns-#1.def~not~found }
+\msg_new:nnn { tag } {namespace-unknown}{ namespace~#1~is~not~declared }
 \msg_new:nnn { tag } {tree-mcid-index-wrong}
   {something~is~wrong~with~the~mcid--rerun}
 \msg_new:nnn { tag } {sys-no-interwordspace}
@@ -380,7 +365,7 @@
   }
 \cs_new_protected:Npn \__tag_check_structure_tag:N #1
   {
-    \prop_if_in:NoF \g__tag_role_tags_prop {#1}
+    \prop_if_in:NoF \g__tag_role_tags_NS_prop {#1}
       {
         \msg_warning:nnx { tag } {role-unknown-tag} {#1}
       }
@@ -412,10 +397,10 @@
   {
     \tl_if_empty:nTF {#2}
       {
-        \msg_warning:nnn { tag } {role-missing} {#1}
+        \msg_error:nnn { tag } {role-missing} {#1}
       }
       {
-        \prop_get:NnNTF \g__tag_role_tags_prop {#2} \l_tmpa_tl
+        \prop_get:NnNTF \g__tag_role_tags_NS_prop {#2} \l_tmpa_tl
           {
             \int_compare:nNnT {\l__tag_loglevel_int} > { 0 }
               {
@@ -423,10 +408,30 @@
               }
           }
           {
-            \msg_warning:nnn { tag } {role-unknown} {#2}
+            \msg_error:nnn { tag } {role-unknown} {#2}
           }
       }
   }
+\cs_new_protected:Npn \__tag_check_add_tag_role:nnn #1 #2 #3 %#1 tag/NS, #2 role #3 namespace
+  {
+    \tl_if_empty:nTF {#2}
+      {
+        \msg_error:nnn { tag } {role-missing} {#1}
+      }
+      {
+        \prop_get:cnNTF { g__tag_role_NS_#3_prop } {#2} \l_tmpa_tl
+          {
+            \int_compare:nNnT {\l__tag_loglevel_int} > { 0 }
+              {
+                \msg_info:nnnn { tag } {role-tag} {#1} {#2/#3}
+              }
+          }
+          {
+            \msg_error:nnn { tag } {role-unknown} {#2/#3}
+          }
+      }
+  }
+
 \cs_new_protected:Npn \__tag_check_mc_if_nested:
   {
     \__tag_mc_if_in:T
@@ -718,6 +723,15 @@
           }
       }
   }
+\cs_new_protected:Npn \__tag_tree_final_checks:
+ {
+   \int_compare:nNnF {\seq_count:N\g__tag_struct_stack_seq}={1}
+    {
+      \msg_warning:nn {tag}{tree-struct-still-open}
+      \int_step_inline:nnn{2}{\seq_count:N\g__tag_struct_stack_seq}
+       {\tag_struct_end:}
+    }
+ }
 \pdf_object_new:n { __tag/struct/0 }
 \hook_gput_code:nnn{shipout/lastpage}{tagpdf}
   {
@@ -730,18 +744,31 @@
           { \pdf_object_ref:n { __tag/struct/0 } }
       }
   }
-\cs_new_protected:Npn \__tag_tree_write_structtreeroot:
-  {
-     \__tag_prop_gput:cnx
-       { g__tag_struct_0_prop }
-       { ParentTree }
-       { \pdf_object_ref:n { __tag/tree/parenttree } }
-     \__tag_prop_gput:cnx
-       { g__tag_struct_0_prop }
-       { RoleMap }
-       { \pdf_object_ref:n { __tag/tree/rolemap } }
-     \__tag_struct_write_obj:n { 0 }
-  }
+\pdf_version_compare:NnTF < {2.0}
+ {
+   \cs_new_protected:Npn \__tag_tree_write_structtreeroot:
+     {
+        \__tag_prop_gput:cnx
+          { g__tag_struct_0_prop }
+          { ParentTree }
+          { \pdf_object_ref:n { __tag/tree/parenttree } }
+        \__tag_prop_gput:cnx
+          { g__tag_struct_0_prop }
+          { RoleMap }
+          { \pdf_object_ref:n { __tag/tree/rolemap } }
+        \__tag_struct_write_obj:n { 0 }
+     }
+ }
+ {
+   \cs_new_protected:Npn \__tag_tree_write_structtreeroot:
+     {
+        \__tag_prop_gput:cnx
+          { g__tag_struct_0_prop }
+          { ParentTree }
+          { \pdf_object_ref:n { __tag/tree/parenttree } }
+        \__tag_struct_write_obj:n { 0 }
+     }
+ }
 \cs_new_protected:Npn \__tag_tree_write_structelements:
   {
     \int_step_inline:nnnn {1}{1}{\c at g__tag_struct_abs_int}
@@ -844,14 +871,30 @@
         /Nums\c_space_tl [\l__tag_parenttree_content_tl]
       }
   }
-\pdf_object_new:n { __tag/tree/rolemap }
-\cs_new_protected:Npn \__tag_tree_write_rolemap:
+\pdf_version_compare:NnT < {2.0}
   {
-    \pdf_object_write:nnx  { __tag/tree/rolemap }{dict}
-      {
+    \pdf_object_new:n { __tag/tree/rolemap }
+  }
+\pdf_version_compare:NnTF < {2.0}
+  {
+   \cs_new_protected:Npn \__tag_tree_write_rolemap:
+    {
+      \prop_map_inline:Nn\g__tag_role_rolemap_prop
+        {
+          \pdfdict_gput:nnx {g__tag_role/RoleMap_dict}
+            {##1}
+            {\pdf_name_from_unicode_e:n{##2}}
+        }
+      \pdf_object_write:nnx  { __tag/tree/rolemap }{dict}
+       {
         \pdfdict_use:n{g__tag_role/RoleMap_dict}
-      }
+       }
+    }
   }
+  {
+    \cs_new_protected:Npn \__tag_tree_write_rolemap:{}
+  }
+
 \cs_new_protected:Npn \__tag_tree_write_classmap:
   {
     \tl_clear:N \l__tag_tmpa_tl
@@ -885,29 +928,32 @@
           { \pdf_object_ref:n { __tag/tree/classmap }  }
       }
   }
-\pdf_object_new:nn{ __tag/tree/namespaces }{array}
+\pdf_object_new:n { __tag/tree/namespaces }
 \cs_new_protected:Npn \__tag_tree_write_namespaces:
   {
-    \prop_map_inline:Nn \g__tag_role_NS_prop
-      {
-        \pdfdict_if_empty:nF {g__tag_role/RoleMapNS_##1_dict}
-          {
-            \pdf_object_write:nnx {__tag/RoleMapNS/##1}{dict}
-              {
-                \pdfdict_use:n {g__tag_role/RoleMapNS_##1_dict}
-              }
-            \pdfdict_gput:nnx{g__tag_role/Namespace_##1_dict}
-              {RoleMapNS}{\pdf_object_ref:n {__tag/RoleMapNS/##1}}
-          }
-        \pdf_object_write:nnx{tag/NS/##1}{dict}
-          {
-             \pdfdict_use:n {g__tag_role/Namespace_##1_dict}
-          }
-      }
-    \pdf_object_write:nx {__tag/tree/namespaces} %array
-      {
-        \prop_map_tokens:Nn \g__tag_role_NS_prop{\use_ii:nn}
-      }
+   \pdf_version_compare:NnF < {2.0}
+    {
+      \prop_map_inline:Nn \g__tag_role_NS_prop
+        {
+          \pdfdict_if_empty:nF {g__tag_role/RoleMapNS_##1_dict}
+            {
+              \pdf_object_write:nnx {__tag/RoleMapNS/##1}{dict}
+                {
+                  \pdfdict_use:n {g__tag_role/RoleMapNS_##1_dict}
+                }
+              \pdfdict_gput:nnx{g__tag_role/Namespace_##1_dict}
+                {RoleMapNS}{\pdf_object_ref:n {__tag/RoleMapNS/##1}}
+            }
+          \pdf_object_write:nnx{tag/NS/##1}{dict}
+            {
+               \pdfdict_use:n {g__tag_role/Namespace_##1_dict}
+            }
+        }
+      \pdf_object_write:nnx {__tag/tree/namespaces}{array}
+        {
+          \prop_map_tokens:Nn \g__tag_role_NS_prop{\use_ii:nn}
+        }
+    }
   }
 \hook_new:n {tagpdf/finish/before}
 \cs_new_protected:Npn \__tag_finish_structure:
@@ -915,6 +961,7 @@
     \bool_if:NT\g__tag_active_tree_bool
       {
         \hook_use:n {tagpdf/finish/before}
+        \__tag_tree_final_checks:
         \__tag_tree_write_parenttree:
         \__tag_tree_write_rolemap:
         \__tag_tree_write_classmap:
@@ -936,41 +983,83 @@
          }
       }
   }
+%% File: tagpdf-data.dtx
+\prop_const_from_keyval:Nn \c__tag_role_rules_prop
+ {
+    0..n = 1,
+    0..1 = 2,
+    1    = 3, %StructTreeRoot, not really needed
+    [a]  = 4, %ruby
+    [b]  = 5, %warichu
+    c    = 6, % WP ??
+    ‡    = 7, % Part,Div,NonStruct -> "check parent"
+    ∅*   = 8, % or negative by default?
+    ∅    = -1,
+ }
+\prop_const_from_keyval:Nn \c__tag_role_rules_num_prop
+ {
+   1 = 0..n,
+   2 = 0..1,
+   3 = 1   , %StructTreeRoot, not really needed
+   4 = [a] , %ruby
+   5 = [b] , %warichu
+   6 = c   , % WP ??
+   7 = ‡   , % Part,Div,NonStruct -> "check parent"
+   8 = ∅*  , % or negative by default?
+  -1 = ∅ ,
+ }
 %% File: tagpdf-roles.dtx
-\__tag_seq_new:N  \g__tag_role_tags_seq  %to get names (type/NS) from numbers
-\__tag_prop_new:N \g__tag_role_tags_prop %to get numbers  from names (type/NS)
-\prop_new:N    \g__tag_role_tags_NS_prop %to namespace info
-\prop_new:N \g__tag_role_NS_prop % collect namespaces
+\prop_new:N    \g__tag_role_tags_NS_prop
+\prop_new:N    \g__tag_role_tags_class_prop
+\prop_new:N \g__tag_role_NS_prop
+\prop_new:N \g__tag_role_index_prop
+\prop_new:N \l__tag_role_debug_prop
 \tl_new:N \l__tag_role_tag_tmpa_tl
 \tl_new:N \l__tag_role_tag_namespace_tmpa_tl
 \tl_new:N \l__tag_role_role_tmpa_tl
 \tl_new:N \l__tag_role_role_namespace_tmpa_tl
-\cs_new_protected:Npn \__tag_role_NS_new:nnn #1 #2 #3
-  {
-    \pdf_object_new:n {tag/NS/#1}
-    \pdfdict_new:n     {g__tag_role/Namespace_#1_dict}
-    \pdf_object_new:n {__tag/RoleMapNS/#1}
-    \pdfdict_new:n     {g__tag_role/RoleMapNS_#1_dict}
-    \pdfdict_gput:nnn
-      {g__tag_role/Namespace_#1_dict}
-      {Type}
-      {/Namespace}
-    \pdf_string_from_unicode:nnN{utf8/string}{#2}\l_tmpa_str
-    \tl_if_empty:NF \l_tmpa_str
-      {
-        \pdfdict_gput:nnx
-          {g__tag_role/Namespace_#1_dict}
-          {NS}
-          {\l_tmpa_str}
-      }
-    %RoleMapNS is added in tree
-    \tl_if_empty:nF  {#3}
-     {
-       \pdfdict_gput:nnx{g__tag_role/Namespace_#1_dict}
-        {Schema}{#3}
-     }
-    \prop_gput:Nnx \g__tag_role_NS_prop {#1}{\pdf_object_ref:n{tag/NS/#1}~}
-  }
+\seq_new:N\l__tag_role_tmpa_seq
+\pdfdict_new:n {g__tag_role/RoleMap_dict}
+\prop_new:N \g__tag_role_rolemap_prop
+\pdf_version_compare:NnTF < {2.0}
+ {
+   \cs_new_protected:Npn \__tag_role_NS_new:nnn #1 #2 #3
+    {
+      \prop_new:c { g__tag_role_NS_#1_prop }
+      \prop_new:c { g__tag_role_NS_#1_class_prop }
+      \prop_gput:Nnx \g__tag_role_NS_prop {#1}{}
+    }
+ }
+ {
+  \cs_new_protected:Npn \__tag_role_NS_new:nnn #1 #2 #3
+    {
+      \prop_new:c { g__tag_role_NS_#1_prop }
+      \prop_new:c { g__tag_role_NS_#1_class_prop }
+      \pdf_object_new:n {tag/NS/#1}
+      \pdfdict_new:n     {g__tag_role/Namespace_#1_dict}
+      \pdf_object_new:n {__tag/RoleMapNS/#1}
+      \pdfdict_new:n     {g__tag_role/RoleMapNS_#1_dict}
+      \pdfdict_gput:nnn
+        {g__tag_role/Namespace_#1_dict}
+        {Type}
+        {/Namespace}
+      \pdf_string_from_unicode:nnN{utf8/string}{#2}\l__tag_tmpa_str
+      \tl_if_empty:NF \l__tag_tmpa_str
+        {
+          \pdfdict_gput:nnx
+            {g__tag_role/Namespace_#1_dict}
+            {NS}
+            {\l__tag_tmpa_str}
+        }
+      %RoleMapNS is added in tree
+      \tl_if_empty:nF  {#3}
+       {
+         \pdfdict_gput:nnx{g__tag_role/Namespace_#1_dict}
+          {Schema}{#3}
+       }
+      \prop_gput:Nnx \g__tag_role_NS_prop {#1}{\pdf_object_ref:n{tag/NS/#1}~}
+    }
+ }
 \str_const:Nx \c__tag_role_userNS_id_str
   { data:,
     \int_to_Hex:n{\int_rand:n {65535}}
@@ -985,397 +1074,580 @@
     \int_to_Hex:n{\int_rand:n {16777215}}
     \int_to_Hex:n{\int_rand:n {16777215}}
   }
-\pdf_version_compare:NnT > {1.9}
+\__tag_role_NS_new:nnn {pdf}   {http://iso.org/pdf/ssn}{}
+\__tag_role_NS_new:nnn {pdf2}  {http://iso.org/pdf2/ssn}{}
+\pdf_version_compare:NnF < {2.0}
   {
-    \__tag_role_NS_new:nnn {pdf}   {http://iso.org/pdf/ssn}{}
-    \__tag_role_NS_new:nnn {pdf2}  {http://iso.org/pdf2/ssn}{}
     \__tag_role_NS_new:nnn {mathml}{http://www.w3.org/1998/Math/MathML}{}
-    %\__tag_role_NS_new:nnn {latex} {https://www.latex-project.org/ns/2022}{}
-    \exp_args:Nnx
-    \__tag_role_NS_new:nnn {user}{\c__tag_role_userNS_id_str}{}
   }
-\clist_const:Nn \c__tag_role_sttags_pdf_pdfII_clist
+\__tag_role_NS_new:nnn {latex} {https://www.latex-project.org/ns/dflt/2022}{}
+\__tag_role_NS_new:nnn {latex-book} {https://www.latex-project.org/ns/book/2022}{}
+\__tag_role_NS_new:nnn {latex-inline} {https://www.latex-project.org/ns/inline/2022}{}
+\exp_args:Nnx
+  \__tag_role_NS_new:nnn {user}{\c__tag_role_userNS_id_str}{}
+\pdf_version_compare:NnTF < {2.0}
   {
-    Document,   %A complete document. This is the root element
-                %of any structure tree containing
-                %multiple parts or multiple articles.
-    Part,       %A large-scale division of a document.
-    Sect,       %A container for grouping related content elements.
-    Div,        %A generic block-level element or group of elements
-    Caption,    %A brief portion of text describing a table or figure.
-    Index,
-    NonStruct,  %probably not needed
-    H,
-    H1,
-    H2,
-    H3,
-    H4,
-    H5,
-    H6,
-    P,
-    L,           %list
-    LI,          %list item (around label and list item body)
-    Lbl,         %list label
-    LBody,       %list item body
-    Table,
-    TR,          %table row
-    TH,          %table header cell
-    TD,          %table data cell
-    THead,       %table header (n rows)
-    TBody,       %table rows
-    TFoot,       %table footer
-    Span,        %generic inline marker
-    Link,        %
-    Annot,
-    Figure,
-    Formula,
-    Form,
-    % ruby warichu etc ..
-    Ruby,
-    RB,
-    RT,
-    Warichu,
-    WT,
-    WP,
-    Artifact % only MC-tag ?...
+   \sys_if_engine_luatex:TF
+    {
+      \cs_new_protected:Npn \__tag_role_alloctag:nnn #1 #2 #3 %#1 tagname, ns, type
+       {
+         \lua_now:e { ltx.__tag.func.alloctag ('#1') }
+         \prop_gput:Nnn \g__tag_role_tags_NS_prop   {#1}{#2}
+         \prop_gput:cnn {g__tag_role_NS_#2_prop}  {#1}{{}{}}
+         \prop_gput:Nnn \g__tag_role_tags_class_prop {#1}{#3}
+         \prop_gput:cnn {g__tag_role_NS_#2_class_prop}  {#1}{--UNUSED--}
+       }
+    }
+    {
+      \cs_new_protected:Npn \__tag_role_alloctag:nnn #1 #2 #3
+       {
+         \prop_gput:Nnn \g__tag_role_tags_NS_prop   {#1}{#2}
+         \prop_gput:cnn {g__tag_role_NS_#2_prop}  {#1}{{}{}}
+         \prop_gput:Nnn \g__tag_role_tags_class_prop {#1}{#3}
+         \prop_gput:cnn {g__tag_role_NS_#2_class_prop}  {#1}{--UNUSED--}
+       }
+    }
   }
+  {
+   \sys_if_engine_luatex:TF
+    {
+      \cs_new_protected:Npn \__tag_role_alloctag:nnn #1 #2 #3 %#1 tagname, ns, type
+       {
+         \lua_now:e { ltx.__tag.func.alloctag ('#1') }
+         \prop_gput:Nnn \g__tag_role_tags_NS_prop   {#1}{#2}
+         \prop_gput:cnn {g__tag_role_NS_#2_prop}  {#1}{{}{}}
+         \prop_gput:Nnn \g__tag_role_tags_class_prop {#1}{--UNUSED--}
+         \prop_gput:cnn {g__tag_role_NS_#2_class_prop}  {#1}{#3}
+       }
+    }
+    {
+      \cs_new_protected:Npn \__tag_role_alloctag:nnn #1 #2 #3
+       {
+         \prop_gput:Nnn \g__tag_role_tags_NS_prop   {#1}{#2}
+         \prop_gput:cnn {g__tag_role_NS_#2_prop}  {#1}{{}{}}
+         \prop_gput:Nnn \g__tag_role_tags_class_prop {#1}{--UNUSED--}
+         \prop_gput:cnn {g__tag_role_NS_#2_class_prop}  {#1}{#3}
+       }
+    }
+  }
+\cs_generate_variant:Nn  \__tag_role_alloctag:nnn {nnV}
+\cs_new_protected:Nn \__tag_role_add_tag:nn % (new) name, reference to old
+  {
+    \__tag_check_add_tag_role:nn {#1}{#2}
+    \prop_if_in:NnF \g__tag_role_tags_NS_prop {#1}
+      {
+        \int_compare:nNnT {\l__tag_loglevel_int} > { 0 }
+          {
+            \msg_info:nnn { tag }{new-tag}{#1}
+          }
+      }
+    \prop_get:NnN \g__tag_role_tags_class_prop {#2}\l__tag_tmpa_tl
+    \quark_if_no_value:NT \l__tag_tmpa_tl
+      {
+        \tl_set:Nn\l__tag_tmpa_tl{--UNKNOWN--}
+      }
+    \__tag_role_alloctag:nnV {#1}{user}\l__tag_tmpa_tl
+    \tl_if_empty:nF { #2 }
+      {
+        \prop_get:NnN \g__tag_role_rolemap_prop {#2}\l__tag_tmpa_tl
+        \quark_if_no_value:NTF \l__tag_tmpa_tl
+          {
+            \prop_gput:Nnx \g__tag_role_rolemap_prop {#1}{\tl_to_str:n{#2}}
+          }
+          {
+            \prop_gput:NnV \g__tag_role_rolemap_prop {#1}\l__tag_tmpa_tl
+          }
+      }
+  }
+\cs_generate_variant:Nn \__tag_role_add_tag:nn {VV,ne}
+\cs_new_protected:Nn \__tag_role_add_tag:nnnn %tag/namespace/role/namespace
+  {
+    \__tag_check_add_tag_role:nnn {#1/#2}{#3}{#4}
+    \int_compare:nNnT {\l__tag_loglevel_int} > { 0 }
+      {
+        \msg_info:nnn { tag }{new-tag}{#1}
+      }
+    \prop_get:cnN { g__tag_role_NS_#4_class_prop } {#3}\l__tag_tmpa_tl
+    \quark_if_no_value:NT \l__tag_tmpa_tl
+      {
+        \tl_set:Nn\l__tag_tmpa_tl{--UNKNOWN--}
+      }
+    \__tag_role_alloctag:nnV {#1}{#2}\l__tag_tmpa_tl
+    \pdfdict_gput:nnx {g__tag_role/RoleMapNS_#2_dict}{#1}
+       {
+         [
+           \pdf_name_from_unicode_e:n{#3}
+           \c_space_tl
+           \pdf_object_ref:n {tag/NS/#4}
+         ]
+       }
+    \tl_if_empty:nF { #2 }
+      {
+        \prop_get:cnN { g__tag_role_NS_#4_prop } {#3}\l__tag_tmpa_tl
+        \quark_if_no_value:NTF \l__tag_tmpa_tl
+          {
+            \prop_gput:cnx { g__tag_role_NS_#2_prop } {#1}
+              {{\tl_to_str:n{#3}}{\tl_to_str:n{#4}}}
+          }
+          {
+            \prop_gput:cno { g__tag_role_NS_#2_prop } {#1}{\l__tag_tmpa_tl}
+          }
+      }
+   }
+\cs_generate_variant:Nn \__tag_role_add_tag:nnnn {VVVV}
 
-\clist_const:Nn \c__tag_role_sttags_only_pdf_clist
+\bool_new:N\l__tag_role_update_bool
+\bool_set_true:N \l__tag_role_update_bool
+\pdf_version_compare:NnTF < {2.0}
  {
-   Art,        %A relatively self-contained body of text
-               %constituting a single narrative or exposition
-   BlockQuote, %A portion of text consisting of one or more paragraphs
-               %attributed to someone other than the author of the
-               %surrounding text.
-   TOC,        %A list made up of table of contents item entries
-               %(structure tag TOCI; see below) and/or other
-               %nested table of contents entries
-   TOCI,       %An individual member of a table of contents.
-               %This entry's children can be any of the following structure  tags:
-               %Lbl,Reference,NonStruct,P,TOC
-   Index,
-   Private,
-   Quote,       %inline quote
-   Note,        %footnote, endnote. Lbl can be child
-   Reference,   %A citation to content elsewhere in the document.
-   BibEntry,    %bibentry
-   Code
+  \cs_new_protected:Npn \__tag_role_read_namespace_line:nw #1#2,#3,#4,#5,#6\q_stop %
+   % #1 NS, #2 tag, #3 rolemap, #4 NS rolemap #5 type
+    {
+      \tl_if_empty:nF { #2 }
+       {
+        \bool_if:NTF \l__tag_role_update_bool
+         {
+          \tl_if_empty:nTF {#5}
+            {
+              \prop_get:NnN \g__tag_role_tags_class_prop  {#3}\l__tag_tmpa_tl
+              \quark_if_no_value:NT \l__tag_tmpa_tl
+                {
+                  \tl_set:Nn\l__tag_tmpa_tl{--UNKNOWN--}
+                }
+            }
+            {
+              \tl_set:Nn \l__tag_tmpa_tl {#5}
+            }
+          \__tag_role_alloctag:nnV {#2}{#1}\l__tag_tmpa_tl
+          \tl_if_empty:nF {#3}
+           {
+            \__tag_role_add_tag:nn {#2}{#3}
+           }
+          \prop_gput:cnn {g__tag_role_NS_#1_prop}  {#2}{{#3}{}}
+         }
+         {
+           \prop_gput:cnn {g__tag_role_NS_#1_prop}  {#2}{{#3}{}}
+           \prop_gput:cnn {g__tag_role_NS_#1_class_prop}  {#2}{--UNUSED--}
+         }
+       }
+    }
  }
-
-\clist_const:Nn \c__tag_role_sttags_only_pdfII_clist
  {
-   DocumentFragment
-   ,Aside
-   ,H7
-   ,H8
-   ,H9
-   ,H10
-   ,Title
-   ,FENote
-   ,Sub
-   ,Em
-   ,Strong
-   ,Artifact
+   \cs_new_protected:Npn \__tag_role_read_namespace_line:nw #1#2,#3,#4,#5,#6\q_stop %
+    % #1 NS, #2 tag, #3 rolemap, #4 NS rolemap #5 type
+    {
+      \tl_if_empty:nF {#2}
+       {
+        \tl_if_empty:nTF {#5}
+         {
+           \prop_get:cnN { g__tag_role_NS_#4_class_prop } {#3}\l__tag_tmpa_tl
+           \quark_if_no_value:NT \l__tag_tmpa_tl
+             {
+               \tl_set:Nn\l__tag_tmpa_tl{--UNKNOWN--}
+             }
+         }
+         {
+           \tl_set:Nn \l__tag_tmpa_tl {#5}
+         }
+        \__tag_role_alloctag:nnV {#2}{#1}\l__tag_tmpa_tl
+        \bool_lazy_and:nnT
+           { ! \tl_if_empty_p:n {#3} }{! \str_if_eq_p:nn {#1}{pdf2}}
+           {
+            \__tag_role_add_tag:nnnn {#2}{#1}{#3}{#4}
+            \prop_gput:cnn {g__tag_role_NS_#1_prop}  {#2}{{#3}{#4}}
+           }
+       }
+    }
  }
+\cs_new_protected:Npn \__tag_role_read_namespace:n #1 %name of namespace
+  {
+    \prop_if_exist:cF {g__tag_role_NS_#1_prop}
+      { \msg_warning:nnn {tag}{namespace-unknown}{#1} }
+    \file_if_exist:nTF { tagpdf-ns-#1.def}
+     {
+       \ior_open:Nn \g_tmpa_ior {tagpdf-ns-#1.def}
+       \msg_info:nnn {tag}{read-namespace}{#1}
+       \ior_map_inline:Nn \g_tmpa_ior
+         {
+           \__tag_role_read_namespace_line:nw {#1} ##1,,,,\q_stop
+         }
+       \ior_close:N\g_tmpa_ior
+     }
+     {
+      \msg_warning:nnn{tag}{namespace-missing}{#1}
+     }
+  }
 
-\clist_const:Nn \c__tag_role_sttags_mathml_clist
- {
-   abs
-   ,and
-   ,annotation
-   ,apply
-   ,approx
-   ,arccos
-   ,arccosh
-   ,arccot
-   ,arccoth
-   ,arccsc
-   ,arccsch
-   ,arcsec
-   ,arcsech
-   ,arcsin
-   ,arcsinh
-   ,arctan
-   ,arctanh
-   ,arg
-   ,bind
-   ,bvar
-   ,card
-   ,cartesianproduct
-   ,cbytes
-   ,ceiling
-   ,cerror
-   ,ci
-   ,cn
-   ,codomain
-   ,complexes
-   ,compose
-   ,condition
-   ,conjugate
-   ,cos
-   ,cosh
-   ,cot
-   ,coth
-   ,cs
-   ,csc
-   ,csch
-   ,csymbol
-   ,curl
-   ,declare
-   ,degree
-   ,determinant
-   ,diff
-   ,divergence
-   ,divide
-   ,domain
-   ,domainofapplication
-   ,emptyset
-   ,eq
-   ,equivalent
-   ,eulergamma
-   ,exists
-   ,exp
-   ,exponentiale
-   ,factorial
-   ,factorof
-   ,false
-   ,floor
-   ,fn
-   ,forall
-   ,gcd
-   ,geq
-   ,grad
-   ,gt
-   ,ident
-   ,image
-   ,imaginary
-   ,imaginaryi
-   ,implies
-   ,in
-   ,infinity
-   ,int
-   ,integers
-   ,intersect
-   ,interval
-   ,inverse
-   ,lambda
-   ,laplacian
-   ,lcm
-   ,leq
-   ,limit
-   ,ln
-   ,log
-   ,logbase
-   ,lowlimit
-   ,lt
-   ,maction
-   ,maligngroup
-   ,malignmark
-   ,math
-   ,matrix
-   ,matrixrow
-   ,max
-   ,mean
-   ,median
-   ,menclose
-   ,merror
-   ,mfenced
-   ,mfrac
-   ,mglyph
-   ,mi
-   ,min
-   ,minus
-   ,mlabeledtr
-   ,mlongdiv
-   ,mmultiscripts
-   ,mn
-   ,mo
-   ,mode
-   ,moment
-   ,momentabout
-   ,mover
-   ,mpadded
-   ,mphantom
-   ,mprescripts
-   ,mroot
-   ,mrow
-   ,ms
-   ,mscarries
-   ,mscarry
-   ,msgroup
-   ,msline
-   ,mspace
-   ,msqrt
-   ,msrow
-   ,mstack
-   ,mstyle
-   ,msub
-   ,msubsup
-   ,msup
-   ,mtable
-   ,mtd
-   ,mtext
-   ,mtr
-   ,munder
-   ,munderover
-   ,naturalnumbers
-   ,neq
-   ,none
-   ,not
-   ,notanumber
-   ,notin
-   ,notprsubset
-   ,notsubset
-   ,or
-   ,otherwise
-   ,outerproduct
-   ,partialdiff
-   ,pi
-   ,piece
-   ,piecewise
-   ,plus
-   ,power
-   ,primes
-   ,product
-   ,prsubset
-   ,quotient
-   ,rationals
-   ,real
-   ,reals
-   ,reln
-   ,rem
-   ,root
-   ,scalarproduct
-   ,sdev
-   ,sec
-   ,sech
-   ,selector
-   ,semantics
-   ,sep
-   ,set
-   ,setdiff
-   ,share
-   ,sin
-   ,sinh
-   ,subset
-   ,sum
-   ,tan
-   ,tanh
-   ,tendsto
-   ,times
-   ,transpose
-   ,true
-   ,union
-   ,uplimit
-   ,variance
-   ,vector
-   ,vectorproduct
-   ,xor
- }
 
-\prop_const_from_keyval:Nn \c__tag_role_sttags_pdfII_to_pdf_prop
+\__tag_role_read_namespace:n {pdf}
+\__tag_role_read_namespace:n {pdf2}
+\pdf_version_compare:NnF < {2.0}
+  {\__tag_role_read_namespace:n {mathml}}
+\bool_set_false:N\l__tag_role_update_bool
+\__tag_role_read_namespace:n {latex-inline}
+\__tag_role_read_namespace:n {latex-book}
+\bool_set_true:N\l__tag_role_update_bool
+\__tag_role_read_namespace:n {latex}
+\__tag_role_read_namespace:n {pdf}
+\__tag_role_read_namespace:n {pdf2}
+\pdf_version_compare:NnTF < {2.0}
   {
-    DocumentFragment = Art,
-    Aside = Note,
-    Title = H1,
-    Sub   = Span,
-    H7    = H6 ,
-    H8    = H6 ,
-    H9    = H6 ,
-    H10   = H6,
-    FENote= Note,
-    Em    = Span,
-    Strong= Span,
+    \hook_gput_code:nnn {begindocument}{tagpdf}
+      {
+        \cs_if_exist:NT \chapter
+           {
+             \prop_map_inline:cn{g__tag_role_NS_latex-book_prop}
+               {
+                 \__tag_role_add_tag:ne {#1}{\use_i:nn #2\c_empty_tl\c_empty_tl}
+               }
+           }
+      }
   }
-
-\clist_map_inline:Nn \c__tag_role_sttags_pdf_pdfII_clist
   {
-    \__tag_seq_gput_right:Nn \g__tag_role_tags_seq { #1 }
-    \prop_gput:Nnn \g__tag_role_tags_NS_prop    { #1 }{ pdf2 }
+    \hook_gput_code:nnn {begindocument}{tagpdf}
+      {
+        \cs_if_exist:NT \chapter
+         {
+           \prop_map_inline:cn{g__tag_role_NS_latex-book_prop}
+             {
+               \prop_gput:Nnn \g__tag_role_tags_NS_prop    { #1 }{ latex-book }
+             }
+         }
+      }
   }
-\clist_map_inline:Nn \c__tag_role_sttags_only_pdf_clist
+\intarray_new:Nn \g__tag_role_parent_child_intarray {6000}
+\cs_new_protected:Npn \__tag_store_parent_child_rule:nnn #1 #2 #3 % num parent, num child, #3 string
   {
-    \__tag_seq_gput_right:Nn \g__tag_role_tags_seq { #1 }
-    \prop_gput:Nnn \g__tag_role_tags_NS_prop    { #1 }{ pdf }
+    \intarray_gset:Nnn \g__tag_role_parent_child_intarray
+      { #1#2 }{0\prop_item:Nn\c__tag_role_rules_prop{#3}}
   }
-\clist_map_inline:Nn \c__tag_role_sttags_only_pdfII_clist
+\int_zero:N  \l__tag_tmpa_int
+\pdf_version_compare:NnTF < {2.0}
   {
-    \__tag_seq_gput_right:Nn \g__tag_role_tags_seq { #1 }
-    \prop_gput:Nnn \g__tag_role_tags_NS_prop    { #1 }{ pdf2 }
+    \ior_open:Nn \g_tmpa_ior {tagpdf-parent-child.csv}
   }
-\pdf_version_compare:NnT > {1.9}
   {
-     \clist_map_inline:Nn \c__tag_role_sttags_mathml_clist
-       {
-         \__tag_seq_gput_right:Nn \g__tag_role_tags_seq { #1 }
-         \prop_gput:Nnn \g__tag_role_tags_NS_prop    { #1 }{ mathml }
-       }
+    \ior_open:Nn \g_tmpa_ior {tagpdf-parent-child-2.csv}
   }
-\int_step_inline:nnnn { 1 }{ 1 }{ \seq_count:N \g__tag_role_tags_seq }
+
+\ior_map_inline:Nn \g_tmpa_ior
   {
-    \__tag_prop_gput:Nxn \g__tag_role_tags_prop
+    \tl_if_empty:nF{#1}
       {
-        \seq_item:Nn \g__tag_role_tags_seq  { #1 }
+        \int_incr:N\l__tag_tmpa_int
+        \seq_set_from_clist:Nn\l__tag_tmpa_seq { #1 }
+        \int_compare:nNnTF {\l__tag_tmpa_int}=1
+          {
+            \seq_map_indexed_inline:Nn \l__tag_tmpa_seq
+              {
+                \prop_gput:Nnx\g__tag_role_index_prop
+                  {##2}
+                  {\int_compare:nNnT{##1}<{10}{0}##1}
+              }
+          }
+         {
+           \seq_set_from_clist:Nn\l__tag_tmpa_seq { #1 }
+           \seq_pop_left:NN\l__tag_tmpa_seq\l__tag_tmpa_tl
+           \prop_get:NVN \g__tag_role_index_prop \l__tag_tmpa_tl \l__tag_tmpb_tl
+           \seq_pop_left:NN\l__tag_tmpa_seq\l__tag_tmpa_tl
+           \seq_pop_left:NN\l__tag_tmpa_seq\l__tag_tmpa_tl
+           \seq_map_indexed_inline:Nn \l__tag_tmpa_seq
+             {
+               \exp_args:Nnx
+               \__tag_store_parent_child_rule:nnn {##1}{\l__tag_tmpb_tl}{ ##2 }
+             }
+         }
       }
-      { #1 }
   }
-\pdfdict_new:n {g__tag_role/RoleMap_dict}
-\cs_new_protected:Nn \__tag_role_add_tag:nn %(new) name, reference to old
+\ior_close:N\g_tmpa_ior
+\prop_get:NnN\g__tag_role_index_prop{StructTreeRoot}\l__tag_tmpa_tl
+\prop_gput:Nnx\g__tag_role_index_prop{Root}{\l__tag_tmpa_tl}
+\prop_get:NnN\g__tag_role_index_prop{Hn}\l__tag_tmpa_tl
+\pdf_version_compare:NnTF < {2.0}
   {
-    \prop_if_in:NnF \g__tag_role_tags_prop {#1}
+    \int_step_inline:nn{6}
       {
-        \int_compare:nNnT {\l__tag_loglevel_int} > { 0 }
-          {
-            \msg_info:nnn { tag }{new-tag}{#1}
-          }
-         \__tag_seq_gput_right:Nn \g__tag_role_tags_seq { #1 }
-         \__tag_prop_gput:Nnx \g__tag_role_tags_prop    { #1 }
-           {
-             \seq_count:N \g__tag_role_tags_seq
-           }
-         \prop_gput:Nnn \g__tag_role_tags_NS_prop    { #1 }{ user }
+        \prop_gput:Nnx\g__tag_role_index_prop{H#1}{\l__tag_tmpa_tl}
       }
-    \__tag_check_add_tag_role:nn {#1}{#2}
-    \tl_if_empty:nF { #2 }
+  }
+  {
+    \int_step_inline:nn{10}
       {
-        \pdfdict_gput:nnx {g__tag_role/RoleMap_dict}
-          {#1}
-          {\pdf_name_from_unicode_e:n{#2}}
+        \prop_gput:Nnx\g__tag_role_index_prop{H#1}{\l__tag_tmpa_tl}
       }
+    \prop_get:NnN\g__tag_role_index_prop {mathml}\l__tag_tmpa_tl
+    \prop_get:NnN\g__tag_role_index_prop {math}\l__tag_tmpb_tl
+    \prop_map_inline:Nn \g__tag_role_NS_mathml_prop
+      {
+        \prop_gput:NnV\g__tag_role_index_prop{#1}\l__tag_tmpa_tl
+      }
+    \prop_gput:NnV\g__tag_role_index_prop{math}\l__tag_tmpb_tl
   }
-\cs_generate_variant:Nn \__tag_role_add_tag:nn {VV}
-
-\pdf_version_compare:NnT < {2.0}
+\tl_new:N \l__tag_role_real_parent_tl
+\tl_new:N \l__tag_parent_child_check_tl
+\cs_new_protected:Npn \__tag_role_get_parent_child_rule:nnN #1 #2 #3
+  % #1 parent (string) #2 child (string) #3 tl for state
   {
-     \prop_map_inline:Nn \c__tag_role_sttags_pdfII_to_pdf_prop
+     \tl_set:Nn \l__tag_role_real_parent_tl {#1}
+     \prop_get:NnN \g__tag_role_index_prop{#1}\l__tag_tmpa_tl
+     \prop_get:NnN \g__tag_role_index_prop{#2}\l__tag_tmpb_tl
+     \bool_lazy_and:nnTF
+       { ! \quark_if_no_value_p:N \l__tag_tmpa_tl }
+       { ! \quark_if_no_value_p:N \l__tag_tmpb_tl }
        {
-         \__tag_role_add_tag:nn {#1}{#2}
+         \tl_set:Nx#3
+           {
+             \intarray_item:Nn
+              \g__tag_role_parent_child_intarray
+              {\l__tag_tmpa_tl\l__tag_tmpb_tl}
+           }
+         \int_compare:nNnT
+           {#3} = {\prop_item:Nn\c__tag_role_rules_prop{‡}}
+           {
+             \seq_set_eq:NN   \l__tag_role_tmpa_seq \g__tag_struct_tag_stack_seq
+             \seq_pop_left:NN \l__tag_role_tmpa_seq\l__tag_get_tmpc_tl
+             \seq_map_inline:Nn\l__tag_role_tmpa_seq
+               {
+                 \tl_if_in:nnF {-Part-Div-NonStruct-}{-##1-}
+                   {
+                     \tl_set:Nn\l__tag_role_real_parent_tl {##1}
+                     \int_zero:N\l__tag_tmpa_int
+                     \__tag_role_get_parent_child_rule:nnN {##1}{#2}#3
+                     \int_set:Nn\l__tag_tmpa_int{1}
+                     \seq_map_break:
+                   }
+               }
+           }
+         \group_begin:
+         \int_compare:nNnT {\l__tag_tmpa_int*\l__tag_loglevel_int} > { 0 }
+           {
+             \prop_get:NVNF\c__tag_role_rules_num_prop #3 \l__tag_tmpa_tl
+               {
+                 \tl_set:Nn \l__tag_tmpa_tl {unknown}
+               }
+             \tl_set:Nn \l__tag_tmpb_tl {#1}
+             \msg_note:nnxxx
+               { tag }
+               { role-parent-child }
+               { #1
+                 \tl_if_eq:NNTF\l__tag_tmpb_tl\l__tag_role_real_parent_tl
+                   {
+                     \bool_lazy_and:nnT
+                      {
+                        \prop_if_in_p:Nn \l__tag_role_debug_prop {parent}
+                      }
+                      {
+                        !\str_if_eq_p:ee {#1}{\prop_item:Nn\l__tag_role_debug_prop {parent}}
+                      }
+                      {
+                        \c_space_tl (from~\prop_item:Nn\l__tag_role_debug_prop {parent})
+                      }
+                   }
+                   {
+                     \c_space_tl(inherited~from~\l__tag_role_real_parent_tl)
+                   }
+               }
+               {
+                 #2
+                 \bool_lazy_and:nnT
+                   {
+                     \prop_if_in_p:Nn \l__tag_role_debug_prop {child}
+                   }
+                   {
+                     !\str_if_eq_p:ee {#2}{\prop_item:Nn\l__tag_role_debug_prop {child}}
+                   }
+                   {
+                     \c_space_tl (from~\prop_item:Nn\l__tag_role_debug_prop {child})
+                   }
+               }
+               { '#3~(\l__tag_tmpa_tl)' }
+           }
+           \group_end:
        }
+       {
+         \tl_set:Nn#3 {0}
+         \msg_warning:nnxxx
+           { tag }
+           {role-parent-child}
+           { #1 }
+           { #2 }
+           { unknown! }
+       }
   }
-
-\cs_new_protected:Nn \__tag_role_add_tag:nnnn %tag/namespace/role/namespace
+\cs_generate_variant:Nn\__tag_role_get_parent_child_rule:nnN {VVN}
+\pdf_version_compare:NnTF < {2.0}
   {
-    \int_compare:nNnT {\l__tag_loglevel_int} > { 0 }
+   \cs_new_protected:Npn \__tag_check_parent_child:nnnnN #1 #2 #3 #4 #5
+     {
+       \prop_put:Nnn \l__tag_role_debug_prop {parent} {#1}
+       \prop_put:Nnn \l__tag_role_debug_prop {child}  {#3}
+       \prop_get:NnNTF \g__tag_role_index_prop {#1}\l__tag_tmpa_tl
+         {
+           \tl_set:Nn \l__tag_tmpa_tl {#1}
+         }
+         {
+           \prop_get:NnNF \g__tag_role_rolemap_prop {#1}\l__tag_tmpa_tl
+             {
+               \tl_set:Nn \l__tag_tmpa_tl {\q_no_value}
+             }
+         }
+       \prop_get:NnNTF \g__tag_role_index_prop {#3}\l__tag_tmpb_tl
+         {
+           \tl_set:Nn \l__tag_tmpb_tl {#3}
+         }
+         {
+           \prop_get:NnNF \g__tag_role_rolemap_prop {#3}\l__tag_tmpb_tl
+             {
+               \tl_set:Nn \l__tag_tmpb_tl {\q_no_value}
+             }
+         }
+       \bool_lazy_and:nnTF
+         { ! \quark_if_no_value_p:N \l__tag_tmpa_tl }
+         { ! \quark_if_no_value_p:N \l__tag_tmpb_tl }
+         {
+           \__tag_role_get_parent_child_rule:VVN \l__tag_tmpa_tl \l__tag_tmpb_tl #5
+         }
+         {
+           \tl_set:Nn #5 {0}
+           \msg_warning:nnxxx
+            { tag }
+            {role-parent-child}
+            { #1 }
+            { #3 }
+            { unknown! }
+         }
+     }
+   \cs_new_protected:Npn \__tag_check_parent_child:nnN #1#2#3
+     {
+       \__tag_check_parent_child:nnnnN {#1}{}{#2}{}#3
+     }
+  }
+  {
+   \cs_new_protected:Npn \__tag_check_parent_child:nnN #1 #2 #3
+     {
+       \prop_get:NnN\g__tag_role_tags_NS_prop {#1}\l__tag_role_tag_namespace_tmpa_tl
+       \prop_get:NnN\g__tag_role_tags_NS_prop {#2}\l__tag_role_tag_namespace_tmpb_tl
+       \str_if_eq:nnT{#2}{MC}{\tl_clear:N \l__tag_role_tag_namespace_tmpb_tl}
+       \bool_lazy_and:nnTF
+         { ! \quark_if_no_value_p:N \l__tag_role_tag_namespace_tmpa_tl }
+         { ! \quark_if_no_value_p:N \l__tag_role_tag_namespace_tmpb_tl }
+         {
+           \__tag_check_parent_child:nVnVN
+             {#1}\l__tag_role_tag_namespace_tmpa_tl
+             {#2}\l__tag_role_tag_namespace_tmpb_tl
+             #3
+         }
+         {
+           \tl_set:Nn #3 {0}
+           \msg_warning:nnxxx
+            { tag }
+            {role-parent-child}
+            { #1 }
+            { #2 }
+            { unknown! }
+         }
+     }
+   \cs_new_protected:Npn \__tag_check_parent_child:nnnnN #1 #2 #3 #4 #5 %tag,NS,tag,NS, tl var
       {
-        \msg_info:nnn { tag }{new-tag}{#1}
+        \prop_put:Nnn \l__tag_role_debug_prop {parent} {#1/#2}
+        \prop_put:Nnn \l__tag_role_debug_prop {child}  {#3/#4}
+        \tl_if_empty:nTF  {#2}
+          {
+            \tl_set:Nn \l__tag_tmpa_tl {#1}
+          }
+          {
+            \prop_get:cnNTF
+               { g__tag_role_NS_#2_prop }
+               {#1}
+               \l__tag_tmpa_tl
+               {
+                 \tl_set:Nx \l__tag_tmpa_tl {\tl_head:N\l__tag_tmpa_tl}
+                 \tl_if_empty:NT\l__tag_tmpa_tl
+                   {
+                     \tl_set:Nn \l__tag_tmpa_tl {#1}
+                   }
+               }
+               {
+                 \tl_set:Nn \l__tag_tmpa_tl {\q_no_value}
+               }
+          }
+        \tl_if_empty:nTF  {#4}
+          {
+            \tl_set:Nn \l__tag_tmpb_tl {#3}
+          }
+          {
+            \prop_get:cnNTF
+              { g__tag_role_NS_#4_prop }
+              {#3}
+              \l__tag_tmpb_tl
+              {
+                \tl_set:Nx \l__tag_tmpb_tl { \tl_head:N\l__tag_tmpb_tl }
+                \tl_if_empty:NT\l__tag_tmpb_tl
+                  {
+                    \tl_set:Nn \l__tag_tmpb_tl {#3}
+                  }
+              }
+              {
+                \tl_set:Nn \l__tag_tmpb_tl {\q_no_value}
+              }
+          }
+       \bool_lazy_and:nnTF
+         { ! \quark_if_no_value_p:N \l__tag_tmpa_tl }
+         { ! \quark_if_no_value_p:N \l__tag_tmpb_tl }
+         {
+           \__tag_role_get_parent_child_rule:VVN \l__tag_tmpa_tl \l__tag_tmpb_tl #5
+         }
+         {
+           \tl_set:Nn #5 {0}
+           \msg_warning:nnxxx
+            { tag }
+            {role-parent-child}
+            { #1 }
+            { #3 }
+            { unknown! }
+         }
+     }
+  }
+\cs_generate_variant:Nn\__tag_check_parent_child:nnN {VVN}
+\cs_generate_variant:Nn\__tag_check_parent_child:nnnnN {VVVVN,nVnVN,VVnnN}
+\tl_new:N \l__tag_role_remap_tag_tl
+\tl_new:N \l__tag_role_remap_NS_tl
+\cs_new_protected:Npn \__tag_role_remap: {  }
+\cs_set_eq:NN \__tag_role_remap_id: \__tag_role_remap:
+\pdf_version_compare:NnTF < {2.0}
+  {
+    \cs_new_protected:Npn \__tag_role_remap_inline:
+      {
+        \prop_get:cVNT { g__tag_role_NS_latex-inline_prop }\l__tag_role_remap_tag_tl\l__tag_tmpa_tl
+          {
+            \tl_set:Nx\l__tag_role_remap_tag_tl
+              {
+                \exp_last_unbraced:NV\use_i:nn \l__tag_tmpa_tl
+              }
+            \tl_set:Nx\l__tag_role_remap_NS_tl
+              {
+                \exp_last_unbraced:NV\use_ii:nn \l__tag_tmpa_tl
+              }
+          }
+        \int_compare:nNnT {\l__tag_loglevel_int} > { 0 }
+          {
+            \msg_note:nnx { tag } { role-remapping }{ \l__tag_role_remap_tag_tl }
+          }
       }
-    \__tag_seq_gput_right:Nn \g__tag_role_tags_seq { #1 }
-    \__tag_prop_gput:Nnx \g__tag_role_tags_prop    { #1 }
-       {
-         \seq_count:N \g__tag_role_tags_seq
-       }
-    \prop_gput:Nnn \g__tag_role_tags_NS_prop    { #1 }{ #2 }
-    \__tag_check_add_tag_role:nn {#1}{#3}
-    \pdfdict_gput:nnx {g__tag_role/RoleMapNS_#2_dict}{#1}
-       {
-         [
-           \pdf_name_from_unicode_e:n{#3}
-           \c_space_tl
-           \pdf_object_ref:n {tag/NS/#4}
-         ]
-       }
-   }
-\cs_generate_variant:Nn \__tag_role_add_tag:nnnn {VVVV}
+  }
+  {
+    \cs_new_protected:Npn \__tag_role_remap_inline:
+      {
+        \prop_get:cVNT { g__tag_role_NS_latex-inline_prop }\l__tag_role_remap_tag_tl\l__tag_tmpa_tl
+          {
+            \tl_set:Nn\l__tag_role_remap_NS_tl {latex-inline}
+          }
+        \int_compare:nNnT {\l__tag_loglevel_int} > { 0 }
+          {
+            \msg_note:nnx { tag } { role-remapping }{ \l__tag_role_remap_tag_tl/latex-inline }
+          }
+      }
+  }
 \keys_define:nn { __tag / tag-role }
   {
     ,tag .tl_set:N = \l__tag_role_tag_tmpa_tl
@@ -1441,6 +1713,7 @@
 \seq_gpush:Nn \g__tag_struct_stack_seq {0}
 \seq_new:N    \g__tag_struct_tag_stack_seq
 \seq_gpush:Nn \g__tag_struct_tag_stack_seq {Root}
+\prop_new:N\g__tag_struct_tag_NS_prop
 \tl_new:N     \l__tag_struct_stack_parent_tmpa_tl
 
 \seq_const_from_clist:Nn \c__tag_struct_StructTreeRoot_entries_seq
@@ -1484,6 +1757,8 @@
 \tl_new:N \g__tag_struct_tag_NS_tl
 \tl_new:N \l__tag_struct_key_label_tl
 \bool_new:N \l__tag_struct_elem_stash_bool
+\prop_new:N \g__tag_struct_dest_num_prop
+\prop_new:N \g__tag_struct_ref_by_dest_prop
 \cs_new:Npn \__tag_struct_output_prop_aux:nn #1 #2 %#1 num, #2 key
   {
     \prop_if_in:cnT
@@ -1502,20 +1777,71 @@
       }
   }
 \tl_gset:Nn \g__tag_struct_stack_current_tl {0}
-
+\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_gput:cnn
+\__tag_prop_gput:cnx
   { g__tag_struct_0_prop }
   { Type }
-  { /StructTreeRoot }
+  { \pdf_name_from_unicode_e:n {StructTreeRoot} }
 
 \__tag_prop_gput:cnx
   { g__tag_struct_0_prop }
+  { S }
+  { \pdf_name_from_unicode_e:n {StructTreeRoot} }
+
+\prop_gput:Nnn \g__tag_struct_tag_NS_prop {0}{{StructTreeRoot}{pdf}}
+\__tag_prop_gput:cnx
+  { g__tag_struct_0_prop }
   { Namespaces }
   { \pdf_object_ref:n { __tag/tree/namespaces } }
+
+\pdf_version_compare:NnTF < {2.0}
+ {
+   \cs_new_protected:Npn \__tag_struct_set_tag_info:nnn #1 #2 #3
+     %#1 structure number, #2 tag, #3 NS
+     {
+       \__tag_prop_gput:cnx
+         { g__tag_struct_#1_prop }
+         { S }
+         { \pdf_name_from_unicode_e:n {#2}  } %
+       \prop_gput:Nnn \g__tag_struct_tag_NS_prop {#1}{{#2}{#3}}
+     }
+ }
+ {
+   \cs_new_protected:Npn \__tag_struct_set_tag_info:nnn #1 #2 #3
+     {
+       \__tag_prop_gput:cnx
+         { g__tag_struct_#1_prop }
+         { S }
+         { \pdf_name_from_unicode_e:n {#2} } %
+       \prop_get:NnNT \g__tag_role_NS_prop {#3} \l__tag_get_tmpc_tl
+         {
+           \__tag_prop_gput:cnx
+             { g__tag_struct_#1_prop }
+             { NS }
+             { \l__tag_get_tmpc_tl } %
+         }
+       \prop_gput:Nnn \g__tag_struct_tag_NS_prop {#1}{{#2}{#3}}
+     }
+ }
+\cs_generate_variant:Nn \__tag_struct_set_tag_info:nnn {eVV}
+\cs_new_protected:Npn \__tag_struct_get_tag_info:nNN #1 #2 #3
+   %#1 struct num, #2 tlvar for tag , #3 tlvar for NS
+    {
+       \prop_get:NnNTF \g__tag_struct_tag_NS_prop {#1}\l__tag_get_tmpc_tl
+         {
+           \tl_set:Nx #2{\exp_last_unbraced:NV\use_i:nn  \l__tag_get_tmpc_tl}
+           \tl_set:Nx #3{\exp_last_unbraced:NV\use_ii:nn \l__tag_get_tmpc_tl}
+         }
+         {
+           \tl_clear:N#2
+           \tl_clear:N#3
+         }
+    }
+\cs_generate_variant:Nn\__tag_struct_get_tag_info:nNN {eNN}
 \cs_new:Npn \__tag_struct_mcid_dict:n #1 %#1 MCID absnum
   {
      <<
@@ -1757,21 +2083,10 @@
     parent .default:n    = {-1},
     tag   .code:n        = % S property
       {
-        \seq_set_split:Nne \l__tag_tmpa_seq { / } {#1/\prop_item:No\g__tag_role_tags_NS_prop{#1}}
-        \tl_gset:Nx \g__tag_struct_tag_tl    { \seq_item:Nn\l__tag_tmpa_seq {1} }
-        \tl_gset:Nx \g__tag_struct_tag_NS_tl { \seq_item:Nn\l__tag_tmpa_seq {2} }
+        \seq_set_split:Nne \l__tag_tmpa_seq { / } {#1/\prop_item:Ne\g__tag_role_tags_NS_prop{#1}}
+        \tl_gset:Nx \g__tag_struct_tag_tl   { \seq_item:Nn\l__tag_tmpa_seq {1} }
+        \tl_gset:Nx \g__tag_struct_tag_NS_tl{ \seq_item:Nn\l__tag_tmpa_seq {2} }
         \__tag_check_structure_tag:N \g__tag_struct_tag_tl
-        \__tag_prop_gput:cnx
-         { g__tag_struct_\int_eval:n {\c at g__tag_struct_abs_int}_prop }
-         { S }
-         { \pdf_name_from_unicode_e:n{ \g__tag_struct_tag_tl} } %
-       \prop_get:NVNT \g__tag_role_NS_prop\g__tag_struct_tag_NS_tl\l__tag_tmpa_tl
-         {
-           \__tag_prop_gput:cnx
-            { g__tag_struct_\int_eval:n {\c at g__tag_struct_abs_int}_prop }
-            { NS }
-            { \l__tag_tmpa_tl } %
-         }
       },
     title .code:n        = % T property
       {
@@ -1982,6 +2297,10 @@
           { /StructElem }
         \tl_set:Nn \l__tag_struct_stack_parent_tmpa_tl {-1}
         \keys_set:nn { __tag / struct} { #1 }
+        \__tag_struct_set_tag_info:eVV
+          { \int_eval:n {\c at g__tag_struct_abs_int} }
+           \g__tag_struct_tag_tl
+           \g__tag_struct_tag_NS_tl
         \__tag_check_structure_has_tag:n { \int_eval:n {\c at g__tag_struct_abs_int} }
         \tl_if_empty:NF
           \l__tag_struct_key_label_tl
@@ -2003,7 +2322,35 @@
         %\seq_show:N   \g__tag_struct_stack_seq
         \bool_if:NF
           \l__tag_struct_elem_stash_bool
-          {%set the  parent
+          {
+            \__tag_struct_get_tag_info:eNN
+              {\l__tag_struct_stack_parent_tmpa_tl}
+              \l__tag_get_parent_tmpa_tl
+              \l__tag_get_parent_tmpb_tl
+            \__tag_check_parent_child:VVVVN
+              \l__tag_get_parent_tmpa_tl
+              \l__tag_get_parent_tmpb_tl
+              \g__tag_struct_tag_tl
+              \g__tag_struct_tag_NS_tl
+              \l__tag_parent_child_check_tl
+            \int_compare:nNnT {\l__tag_parent_child_check_tl}<0
+              {
+                \msg_warning:nnxxx
+                 { tag }
+                 {role-parent-child}
+                 { \l__tag_get_parent_tmpa_tl/\l__tag_get_parent_tmpb_tl }
+                 { \g__tag_struct_tag_tl/\g__tag_struct_tag_NS_tl  }
+                 { not~allowed~(struct~\g__tag_struct_stack_current_tl) }
+                \cs_set_eq:NN \l__tag_role_remap_tag_tl \g__tag_struct_tag_tl
+                \cs_set_eq:NN \l__tag_role_remap_NS_tl \g__tag_struct_tag_NS_tl
+                \__tag_role_remap:
+                \cs_gset_eq:NN \g__tag_struct_tag_tl \l__tag_role_remap_tag_tl
+                \cs_gset_eq:NN  \g__tag_struct_tag_NS_tl \l__tag_role_remap_NS_tl
+                \__tag_struct_set_tag_info:eVV
+                  { \int_eval:n {\c at g__tag_struct_abs_int} }
+                    \g__tag_struct_tag_tl
+                    \g__tag_struct_tag_NS_tl
+              }
             \__tag_prop_gput:cnx
               { g__tag_struct_\int_eval:n {\c at g__tag_struct_abs_int}_prop }
               { P }
@@ -2069,6 +2416,28 @@
               {
                 \pdf_object_ref:e { __tag/struct/\g__tag_struct_stack_current_tl }
               }
+             \__tag_struct_get_tag_info:eNN
+              {\__tag_ref_value:enn{tagpdfstruct-#1}{tagstruct}{0}}
+              \l__tag_tmpa_tl
+              \l__tag_tmpb_tl
+            \__tag_check_parent_child:VVVVN
+              \g__tag_struct_tag_tl
+              \g__tag_struct_tag_NS_tl
+              \l__tag_tmpa_tl
+              \l__tag_tmpb_tl
+              \l__tag_parent_child_check_tl
+            \int_compare:nNnT {\l__tag_parent_child_check_tl}<0
+              {
+                \cs_set_eq:NN \l__tag_role_remap_tag_tl \g__tag_struct_tag_tl
+                \cs_set_eq:NN \l__tag_role_remap_NS_tl \g__tag_struct_tag_NS_tl
+                \__tag_role_remap:
+                \cs_gset_eq:NN \g__tag_struct_tag_tl \l__tag_role_remap_tag_tl
+                \cs_gset_eq:NN  \g__tag_struct_tag_NS_tl \l__tag_role_remap_NS_tl
+                \__tag_struct_set_tag_info:eVV
+                  { \int_eval:n {\c at g__tag_struct_abs_int} }
+                    \g__tag_struct_tag_tl
+                    \g__tag_struct_tag_NS_tl
+              }
           }
           {
             \msg_warning:nnn{ tag }{struct-label-unknown}{#1}
@@ -2095,11 +2464,11 @@
      \prop_get:cnN
         { g__tag_struct_#1_prop }
         {Ref}
-        \l__tag_tmpb_tl
+        \l__tag_get_tmpc_tl
      \__tag_prop_gput:cnx
         { g__tag_struct_#1_prop }
         { Ref }
-        { \quark_if_no_value:NF\l__tag_tmpb_tl { \l__tag_tmpb_tl\c_space_tl }#2 }
+        { \quark_if_no_value:NF\l__tag_get_tmpc_tl { \l__tag_get_tmpc_tl\c_space_tl }#2 }
     }
 \cs_generate_variant:Nn \__tag_struct_gput_data_ref:nn {ee}
 
@@ -2447,7 +2816,6 @@
         { \g__tag_active_struct_dest_bool }
         { \g__tag_active_struct_bool }
         { \cs_if_exist_p:N \pdf_activate_structure_destination: }
-        { ! \pdf_version_compare_p:Nn < {2.0} }
       }
       {
         \tl_set:Nn \l_pdf_current_structure_destination_tl { __tag/struct/\g__tag_struct_stack_current_tl }
@@ -2466,8 +2834,10 @@
 \bool_new:N \l__tag_para_show_bool
 \int_new:N  \g__tag_para_begin_int
 \int_new:N  \g__tag_para_end_int
+\tl_new:N   \l__tag_para_tag_default_tl
+\tl_set:Nn  \l__tag_para_tag_default_tl { P }
 \tl_new:N   \l__tag_para_tag_tl
-\tl_set:Nn  \l__tag_para_tag_tl { P }
+\tl_set:Nn  \l__tag_para_tag_tl { \l__tag_para_tag_default_tl }
 \keys_define:nn { __tag / setup }
   {
     paratagging      .bool_set:N = \l__tag_para_bool,
@@ -2486,7 +2856,7 @@
           \llap{\color_select:n{red}\tiny\int_use:N\g__tag_para_begin_int\ }
           \tag_mc_end:
         }
-       \tag_mc_begin:n {tag=\l__tag_para_tag_tl}
+       \tag_mc_begin:n {}
      }
   }
 \AddToHook{para/end}

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty	2022-12-23 21:04:23 UTC (rev 65340)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty	2022-12-23 21:05:03 UTC (rev 65341)
@@ -1,145 +1,86 @@
 %\RequirePackage[enable-debug]{expl3}[2018/06/14]
-\ProvidesExplPackage {tagpdfdocu-patches} {2022-08-24} {0.97}
+\ProvidesExplPackage {tagpdfdocu-patches} {2022-12-22} {0.98}
  {patches/commands for the tagpdf documentation}
-\RequirePackage{etoolbox}
+\RequirePackage{etoolbox,xpatch}
 
-%%%%%
-% tableofcontents
-% no internal patches, but KOMA-only solution
-% TODO it must be checked how best practice is now for the table of contents.
-%%%%%
+%vLogos
 
-
-\AfterTOCHead{\tag_struct_begin:n{tag=TOC}}
-\AfterStartingTOC{\tag_struct_end:} %end TOC
-%Marking the toc entries
-%around the whole entry so only structure:
-\newcommand\tagscrtocentry[1]{\tag_struct_begin:n{tag=TOCI}#1\tag_struct_end:}
-
-%leaf so structure and mc:
-\newcommand\tagscrtocpagenumber[1]
- {
-   \tag_struct_begin:n{tag=Reference}
-   \tag_mc_begin:n{tag=Reference}
-   #1
-   \tag_mc_end:
- \tag_struct_end:
- }
-
-
-\DeclareTOCStyleEntry[
-   entryformat=\tagscrtocentry,
-   pagenumberformat=\tagscrtocpagenumber]{tocline}{section}
-\DeclareTOCStyleEntry[
-   entryformat=\tagscrtocentry,
-   pagenumberformat=\tagscrtocpagenumber]{tocline}{subsection}
-\DeclareTOCStyleEntry[
-   entryformat=\tagscrtocentry,
-   pagenumberformat=\tagscrtocpagenumber]{tocline}{subsubsection}
-\DeclareTOCStyleEntry[
-   entryformat=\tagscrtocentry,
-   pagenumberformat=\tagscrtocpagenumber]{tocline}{paragraph}
-
-
-% \IfStr{#3} doesnt like a \label ...
-\renewcommand{\addtocentrydefault}[3]{%
-% \Ifstr{#3}{}{}
-%   {%
-   \Ifstr{#2}{}
-    {%
-     \addcontentsline{toc}{#1}
-      {%
-       \protect\nonumberline
-       \tagstructbegin{tag=P}%
-       \tagmcbegin{tag=P}%
-        #3%
+\ExplSyntaxOn
+\DeclareRobustCommand\TeX{
+  \tag_mc_end_push:
+   \tag_struct_begin:n{tag=Span,alt=TeX,actualtext=TeX}
+    \tagmcbegin{}
+    \kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@
+    \tagmcend
+   \tag_struct_end:
+  \tag_mc_begin_pop:n{}}
+\DeclareRobustCommand{\LaTeX}{
+  {
+   \tag_mc_end_push:
+   \tag_struct_begin:n{tag=Span,alt=LaTeX,actualtext=LaTeX}
+    \tagmcbegin{}
+     L\kern-.36em%
+     \sbox\z@ T%
+         \vbox to\ht\z@{\hbox{\check at mathfonts
+                              \fontsize\sf at size\z@
+                              \math at fontsfalse\selectfont
+                              A}%
+                        \vss}%
+        }%
+        \kern-.15em%
+        \TeX
        \tagmcend
-       \tagstructend
-      }%
-    }%
-    {%
-    \addcontentsline{toc}{#1}{%
-     \tagstructbegin{tag=Lbl}%
-     \tagmcbegin{tag=Lbl}%
-     \protect\numberline{#2}%
-     \tagmcend\tagstructend
-     \tagstructbegin{tag=P}%
-     \tagmcbegin{tag=P}%
-      #3%
-     \tagmcend
-     \tagstructend
-     }%
-    }%
-  %}
-}%
+      \tag_struct_end:
+      \tag_mc_begin_pop:n{}      
+        }
 
-% the dots must be marked too
 
-\renewcommand*{\TOCLineLeaderFill}[1][.]{
-  \leaders\hbox{$\m at th
-    \mkern \@dotsep mu\hbox{\tag_mc_begin:n{artifact}#1\tag_mc_end:}\mkern \@dotsep
-    mu$}\hfill
-}
+% textbf
 
-%%%%%%%%%
-% Sectioning commands
-% no internal patches, but KOMA-only solution
-%%%%%%%%
+\AddToHook{cmd/textbf/before}
+  {\leavevmode\tag_mc_end_push:\tag_struct_begin:n{tag=Strong}\tagmcbegin{}}
 
-% the structure should be opened rather early to catch the refstepcounter!
-\AddtoDoHook{heading/begingroup}{\tagpdfparaOff\use_none:n}
-\cs_new_protected:Npn \__tag_struct_section_begin:n #1 {\tagstructbegin{tag=\prop_item:Nn\g_tag_section_level_prop{#1}}}
-\AddtoDoHook{heading/postinit}{\__tag_struct_section_begin:n}
-\AddtoDoHook{heading/endgroup}{\tagstructend\use_none:n}
+\AddToHook{cmd/textbf/after}
+  {\tag_mc_end:\tag_struct_end:\tag_mc_begin_pop:n{}}
+  
+  
+\newcommand\minisec[1]{%
+    \if at noskipsec \leavevmode \fi
+    \par
+    \@afterindentfalse
+    \if at nobreak
+      \everypar{}%
+    \else
+      \addpenalty\@secpenalty\addvspace{1.5ex}%
+    \fi
+  {\tagpdfsetup{paratag=H10}\parindent \z@    
+   \setlength{\parfillskip}{\z@ plus 1fil}%
+    \raggedright\normalfont\bfseries\nobreak
+    \nobreak\interlinepenalty \@M #1\par\nobreak%
+  }\nobreak
+  \@afterheading
+}                    
 
-\prop_new:N    \g_tag_section_level_prop
-\prop_gput:Nnn \g_tag_section_level_prop {section}{H1}
-\prop_gput:Nnn \g_tag_section_level_prop {subsection}{H2}
-\prop_gput:Nnn \g_tag_section_level_prop {subsubsection}{H3}
-\prop_gput:Nnn \g_tag_section_level_prop {paragraph}{H4}
 
-\renewcommand{\sectionlinesformat}[4]
- {
-  \@hangfrom
-   {\hskip #2
-    %\tl_if_empty:nF{#3}
-    \tl_if_in:nnF{\@empty}{#3}
-    {
-     \tag_mc_begin:n    {tag=\prop_item:Nn\g_tag_section_level_prop{#1}}
-     #3
-     \tag_mc_end:
-    }
-   }
-   {\tag_mc_begin:n    {tag=\prop_item:Nn\g_tag_section_level_prop{#1}}
-    #4
-    \tag_mc_end:}%
- }
-
-% minisec is simply P,  so we let paratagging handle this.
-% But we add a strong structure
-% TODO: Should changed to H6 as it is no longer required to have H6 only after H5
-% but need to check how to disable paratagging ...
-\cs_new:Nn \__tag_docu_tag_minisec:n
-{
-  \tag_struct_begin:n {tag=Strong}
-  \tag_mc_begin:n{tag=Strong}
-  #1
-  \tag_mc_end:
-  \tag_struct_end:
-}
-%
-\addtokomafont{minisec}{\__tag_docu_tag_minisec:n}
-
-
+      
 %%%%
 %% Lists
 %% patches enumitem internals!
 %%%%
-\AddToHook{env/itemize/begin}{\par\tagstructbegin{tag=L}}%\par is needed to close the paragraph before.
+\tagpdfsetup
+  {
+     newattribute =
+        {itemize}{/O /List /ListNumbering/Unordered},
+     newattribute =
+        {enumerate}{/O /List /ListNumbering/Ordered},        
+     newattribute =
+        {description}{/O /List /ListNumbering/Description},            
+  }
+\AddToHook{env/itemize/begin}{\par\tagstructbegin{tag=L,attribute-class=itemize}}%\par is needed to close the paragraph before.
 \AddToHook{env/itemize/end}{\par\tagstructend\tagstructend\tagstructend}%LBody,LI,L
-\AddToHook{env/enumerate/begin}{\par\tagstructbegin{tag=L}}
+\AddToHook{env/enumerate/begin}{\par\tagstructbegin{tag=L,attribute-class=enumerate}}
 \AddToHook{env/enumerate/end}{\par\tagstructend\tagstructend\tagstructend}%LBody,LI,L
-\AddToHook{env/description/begin}{\par\tagstructbegin{tag=L}}
+\AddToHook{env/description/begin}{\par\tagstructbegin{tag=L,attribute-class=description}}
 \AddToHook{env/description/end}{\par\tagstructend\tagstructend\tagstructend}%LBody,LI,L
 
 \newcommand\tag at enit@format at preset[1]{%
@@ -151,7 +92,7 @@
    \tagstructend\tagstructend} % for the LBody/LI
   \tagstructbegin{tag=LI}
   \tagstructbegin{tag=Lbl}
-  \tagmcbegin{tag=Lbl}
+  \tagmcbegin{}
     #1
   \tagmcend
   \tagstructend
@@ -161,6 +102,7 @@
 \ExplSyntaxOff
 \xpatchcmd\enit at preset{\@firstofone}{\tag at enit@format at preset}{}{\fail}
 %close mc from paratagging and reopen ...
+% this disturbs someone docCommand which has then a MC outside a P.
 \xpatchcmd\@item{\box\@labels}{\tagmcend \box\@labels \tagmcbegin{tag=P}}{}{\fail}
 \ExplSyntaxOn
 
@@ -170,20 +112,22 @@
   \def\enit at format{%
    \tagstructbegin{tag=LI}%
    \tagstructbegin{tag=Lbl}%
-   \tagmcbegin{tag=Lbl}%
+   \tagmcbegin{}%
    #1\tagmcend}}
 
 
 % listings + verbatim
 % the paragraph code could create span around the lines ...
-% it is quite unclear if Code is a sensible structure as it no longer exists in pdf 2.0
+% we use Code for every line.
 
-\AddToHook{env/lstlisting/begin}{\tagpdfparaOff\tagstructbegin{tag=Code}\tagmcbegin{tag=Code}}
-\AddToHook{env/lstlisting/end}{\tagmcend\tagstructend}
+\AddToHook{env/lstlisting/begin}{\tagpdfsetup{paratag=Code}}
+\AddToHook{env/lstlisting/end}{}
 
-\AddToHook{env/verbatim/begin}{\tagpdfparaOff\tagstructbegin{tag=Code}\tagmcbegin{tag=Code}}
-\AddToHook{env/verbatim/end}{\tagmcend\tagstructend}
+\AddToHook{env/verbatim/begin}{\tagpdfsetup{paratag=Code}}
+\AddToHook{env/verbatim/end}{}
 
+\AddToHook{env/docCommand/begin}{\tagstructbegin{tag=P}\tagpdfsetup{paratag=Code}}
+\AddToHook{env/docCommand/end}  {\tagstructend}
 
 % ======== marginnote ==========
 % TODO marginnote has a bug (a \par is missing) so it messes up tagging.
@@ -209,12 +153,9 @@
 %\tcbset{before~upper=\tagpdfparaOn}
 \AddToHook{env/tcolorbox/begin}{\tagpdfparaOff \tcbset{before~upper=\tagpdfparaOn}}
 \AddToHook{env/docCommand/begin}{\tagpdfparaOff \tcbset{before~upper=\tagpdfparaOn}}
-
- %locally for now
-
-
+\ExplSyntaxOff
 % ======= footnote ========
-% TODO
+% done in testphase code
 
 % ======= bibliography ========
 % biblatex. Creates some empty mc-chunks.
@@ -221,7 +162,7 @@
 % no internal patches, but redefining begentry/finentry is not safe.
 % better hook is needed.
 
-\newbibmacro*{begentry}{\tagstructbegin{tag=BibEntry}\tagmcbegin{tag=BibEntry}}
+\newbibmacro*{begentry}{\tagstructbegin{tag=BibEntry}\tagmcbegin{}}
 \newbibmacro*{finentry}{\finentry\tagmcend\tagstructend}
 
 % ====== hyperref ========
@@ -228,13 +169,14 @@
 % this should probably go into tagpdf, but it is related to
 % problem of pdf strings and context ....
 
-\@ifpackageloaded{hyperref}{%
-\pdfstringdefDisableCommands{
- \let\tagstructbegin\@gobble
- \let\tagmcbegin\@gobble
- \let\tagmcend\relax
- \let\tagstructend\relax
-}}{}
+\AddToHook{package/hyperref/after}
+ {%
+  \pdfstringdefDisableCommands{%
+   \let\tagstructbegin\@gobble
+   \let\tagmcbegin\@gobble
+   \let\tagmcend\relax
+   \let\tagstructend\relax
+ }}{}
 
 
 %====== pictures ========
@@ -243,46 +185,7 @@
 \tagpdfsetup
   {
      newattribute =
-        {bbox}{/O /Layout /BBox [0~0~100~100]}
+        {bbox}{/O /Layout /BBox [0 0 100 100]}
   }
 
-%%%%%
-%======== Role maps =========
-%%%%%
-\tagpdfsetup{ add-new-tag=Title/H1,add-new-tag=Strong/Span }
-
-
-
 \endinput
-
-% ==========================
-% now unneeded commands
-
-% we need a command which simply starts a paragraph \TagP^,
-% a "continuation" variant which closes the previous paragraph (\TagP),
-% and a final end.
-
-\NewDocumentCommand\TagP{t{^}}
- {
-  \tag_mc_if_in:T { \tag_mc_end: }
-  \IfBooleanF{#1}
-  {
-    \tag_struct_end:
-  }
-  \tag_struct_begin:n{tag=P}
-  \tag_mc_begin:n{tag=P}
- }
-% close a mc and one structure
-
-\NewDocumentCommand\TagPend{}
- {
-  \tag_mc_if_in:T { \tag_mc_end: }
-  \tag_struct_end:
- }
-
-
- \ExplSyntaxOn
-\newcommand\showcurrentstruct{\prop_show:c { g__tag_struct_\g__tag_struct_stack_current_tl _prop }}
-
-
-\ExplSyntaxOff



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