[latex3-commits] [git/LaTeX3-latex3-pdfresources] testlinkstuff: ref seems to work now too .. (20a38f9)

Ulrike Fischer fischer at troubleshooting-tex.de
Sun Mar 17 18:50:33 CET 2019


Repository : https://github.com/latex3/pdfresources
On branch  : testlinkstuff
Link       : https://github.com/latex3/pdfresources/commit/20a38f995c7834024646432e2b0d6a0c7c9a9a20

>---------------------------------------------------------------

commit 20a38f995c7834024646432e2b0d6a0c7c9a9a20
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sun Mar 17 18:50:33 2019 +0100

    ref seems to work now too ..


>---------------------------------------------------------------

20a38f995c7834024646432e2b0d6a0c7c9a9a20
 hluatex-experimental.def |  305 +++++++++++++++++++---------------------------
 pdfresources.dtx         |   43 +++++--
 test-pdfresources.tex    |    9 +-
 test-tagpdf-link.tex     |   91 +++++++++++---
 4 files changed, 242 insertions(+), 206 deletions(-)

diff --git a/hluatex-experimental.def b/hluatex-experimental.def
index afc6feb..bf2dbfc 100644
--- a/hluatex-experimental.def
+++ b/hluatex-experimental.def
@@ -103,6 +103,7 @@
  \Hy at EXPsetfilebordercolor
 }
 \ExplSyntaxOff
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \protected\def\pdfcatalog        {\pdfextension catalog }
 
@@ -110,11 +111,11 @@
 \protected\def\pdflastlink       {\numexpr\pdffeedback lastlink\relax}
 \protected\def\pdflastobj        {\numexpr\pdffeedback lastobj\relax}
 
-\protected\edef\pdflinkmargin          {\pdfvariable linkmargin}
+\protected\edef\pdflinkmargin    {\pdfvariable linkmargin}
 \protected\def\pdfliteral        {\pdfextension literal}
 
 \protected\def\pdfobj            {\pdfextension obj }
-\protected\edef\pdfcompresslevel       {\pdfvariable compresslevel}
+%\protected\edef\pdfcompresslevel       {\pdfvariable compresslevel}
 \protected\edef\pdfpageattr            {\pdfvariable pageattr}
 
 \protected\edef\pdfpageresources       {\pdfvariable pageresources}
@@ -128,11 +129,15 @@
 \protected\def\pdfoutline        {\pdfextension outline }
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+\ExplSyntaxOn
 \pdf at ifdraftmode{%
   \let\Hy at PutCatalog\ltx at gobble
 }{%
-  \let\Hy at PutCatalog\pdfcatalog
+  \let\Hy at PutCatalog \driver_pdf_catalog:n
 }
+\ExplSyntaxOff
+
+
 \ifHy at pdfpagelabels
   \def\HyPL at StorePageLabel#1{%
     \toks@\expandafter{\HyPL at Labels}%
@@ -296,126 +301,125 @@
   \edef\Hy at pdfversion{\number\Hy at pdfminorversion}%
 
 \Hy at DisableOption{pdfversion}%
+
+\ExplSyntaxOn
 \ifHy at ocgcolorlinks
-  \pdf at ifdraftmode{}{%
-    \immediate\pdfobj{%
-      <<%
-        /Type/OCG%
-        /Name(View)%
-        /Usage<<%
-          /Print<<%
-            /PrintState/OFF%
-          >>%
-          /View<<%
-            /ViewState/ON%
-          >>%
-        >>%
-      >>%
-    }%
-    \edef\OBJ at OCG@view{\the\pdflastobj\space 0 R}%
-    \immediate\pdfobj{%
-      <<%
-        /Type/OCG%
-        /Name(Print)%
-        /Usage<<%
-          /Print<<%
-            /PrintState/ON%
-          >>%
-          /View<<%
-            /ViewState/OFF%
-          >>%
-        >>%
-      >>%
-    }%
-    \edef\OBJ at OCG@print{\the\pdflastobj\space 0 R}%
-    \immediate\pdfobj{%
-      [%
-        \OBJ at OCG@view\space\OBJ at OCG@print
-      ]%
-    }%
-    \edef\OBJ at OCGs{\the\pdflastobj\space 0 R}%
-    \pdfcatalog{%
-      /OCProperties<<%
-        /OCGs \OBJ at OCGs
-        /D<<%
-          /OFF[\OBJ at OCG@print]%
-          /AS[%
-            <<%
-              /Event/View%
-              /OCGs \OBJ at OCGs
-              /Category[/View]%
-            >>%
-            <<%
-              /Event/Print%
-              /OCGs \OBJ at OCGs
-              /Category[/Print]%
-            >>%
-            <<%
-              /Event/Export%
-              /OCGs \OBJ at OCGs
-              /Category[/Print]%
-            >>%
-          ]%
-        >>%
-      >>%
-    }%
+  \pdf at ifdraftmode{}{
+    \immediate\pdfobj{
+      <<
+        /Type/OCG
+        /Name(View)
+        /Usage<<
+          /Print<<
+            /PrintState/OFF
+          >>
+          /View<<
+            /ViewState/ON
+          >>
+        >>
+      >>
+    }
+    \edef\OBJ at OCG@view{\the\pdflastobj\c_space_tl 0\c_space_tl R}%
+    \immediate\pdfobj{
+      <<
+        /Type/OCG
+        /Name(Print)
+        /Usage<<
+          /Print<<
+            /PrintState/ON
+          >>
+          /View<<
+            /ViewState/OFF
+          >>
+        >>
+      >>
+    }
+    \edef\OBJ at OCG@print{\the\pdflastobj\c_space_tl 0\c_space_tl R}
+    \immediate\pdfobj{
+      [
+        \OBJ at OCG@view\c_space_tl\OBJ at OCG@print
+      ]
+    }
+    \edef\OBJ at OCGs{\the\pdflastobj\c_space_tl 0\c_space_tl R}
+    \driver_pdf_catalog:n
+     {
+      /OCProperties<<
+        /OCGs\c_space_tl\OBJ at OCGs
+        /D<<
+          /OFF[\OBJ at OCG@print]
+          /AS[
+            <<
+              /Event/View
+              /OCGs\c_space_tl \OBJ at OCGs
+              /Category[/View]
+            >>
+            <<
+              /Event/Print
+              /OCGs\c_space_tl \OBJ at OCGs
+              /Category[/Print]
+            >>
+            <<
+              /Event/Export
+              /OCGs\c_space_tl \OBJ at OCGs
+              /Category[/Print]
+            >>
+          ]
+        >>
+      >>
+    }
     \begingroup
       \edef\x{\endgroup
-        \pdfpageresources{%
+        \pdfpageresources{
           \the\pdfpageresources
-          /Properties<<%
-            /OCView \OBJ at OCG@view
-            /OCPrint \OBJ at OCG@print
-          >>%
-        }%
-      }%
+          /Properties<<
+            /OCView\c_space_tl \OBJ at OCG@view
+            /OCPrint\c_space_tl \OBJ at OCG@print
+          >>
+        }
+      }
     \x
-  }%
-  \Hy at AtBeginDocument{%
-    \def\Hy at colorlink#1{%
+  }
+  \Hy at AtBeginDocument{
+    \def\Hy at colorlink#1{
       \begingroup
         \ifHy at ocgcolorlinks
-          \def\Hy at ocgcolor{#1}%
+          \def\Hy at ocgcolor{#1}
           \setbox0=\hbox\bgroup\color at begingroup
         \else
-          \HyColor at UseColor#1%
+          \HyColor at UseColor#1
         \fi
-    }%
-    \def\Hy at endcolorlink{%
+    }
+    \def\Hy at endcolorlink{
       \ifHy at ocgcolorlinks
         \color at endgroup\egroup
-        \mbox{%
-          \pdfliteral page{/OC/OCPrint BDC}%
-          \rlap{\copy0}%
-          \pdfliteral page{EMC/OC/OCView BDC}%
+        \mbox{
+          \pdfliteral~page{/OC/OCPrint BDC}
+          \rlap{\copy0}
+          \pdfliteral~page{EMC/OC/OCView BDC}
           \begingroup
             \expandafter\HyColor at UseColor\Hy at ocgcolor
-            \box0 %
+            \box0~
           \endgroup
-          \pdfliteral page{EMC}%
-        }%
+          \pdfliteral~page{EMC}
+        }
       \fi
       \endgroup
-    }%
-  }%
+    }
+  }
 \else
-  \Hy at DisableOption{ocgcolorlinks}%
+  \Hy at DisableOption{ocgcolorlinks}
 \fi
+\ExplSyntaxOff
+
 \def\setpdflinkmargin#1{%
   \begingroup
     \setlength{\dimen@}{#1}%
   \expandafter\endgroup
   \expandafter\pdflinkmargin\the\dimen@\relax
 }
-\ifx\pdfstartlink\@undefined% less than version 14
-  \let\pdfstartlink\pdfannotlink
-  \let\pdflinkmargin\@tempdima
-  \let\saveboxresource\pdfform
-  \let\lastsavedboxresourceindex\pdflastform
-  \let\useboxresource\pdfrefform
-\else
-  \pdflinkmargin1pt %
-\fi
+
+\pdflinkmargin1pt %
+
 \providecommand*\@pdfview{XYZ}
 \Hy at WrapperDef\new at pdflink#1{%
   \ifhmode
@@ -511,7 +515,7 @@
     \hook_put:nnnn
      { pdf }
      { startlink_link_attr }
-     { /C }{ [\tl_use:c { @#1bordercolor }] } %do I need to expand??
+     { /C }{ [\tl_use:c { @#1bordercolor }] } %do I need to expand?? seems not
    }
    {
     \hook_remove:nnn
@@ -519,14 +523,8 @@
      { startlink_link_attr }
      { /C }
    }
-   \prop_show:N\l__pdf_hook_startlink_link_attr_prop
-  \ltx at IfUndefined{@#1bordercolor}{%
-    \let\CurrentBorderColor\relax
-  }{%
-    \edef\CurrentBorderColor{\csname @#1bordercolor\endcsname}%
-  }%
   \find at pdflink{#1}{#2}#3\Hy at xspace@end
-  \close at pdflink
+  \close at EXPpdflink { link }
 }
 \ExplSyntaxOff
 
@@ -556,6 +554,7 @@
   \endgroup
 }
 \ExplSyntaxOff
+
 \def\hyper at linkfile#1#2#3{% anchor text, filename, linkname
   \begingroup
     \def\Hy at pstringF{#2}%
@@ -640,11 +639,12 @@
       }%
     \x
 
-\def\PDF at SetupDoc{%
+\ExplSyntaxOn
+\def\PDF at SetupDoc{
   \ifx\@pdfpagescrop\@empty
   \else
-    \edef\process at me{%
-      \pdfpagesattr={%
+    \edef\process at me{
+      \pdfpagesattr={
         /CropBox[\@pdfpagescrop]%
         \expandafter\ifx\expandafter\\\the\pdfpagesattr\\%
         \else
@@ -655,7 +655,7 @@
     \process at me
   \fi
   \Hy at pstringdef\Hy at pstringB{\@baseurl}%
-  \pdfcatalog{%
+  \driver_pdf_catalog:n{%
     /PageMode/\@pdfpagemode
     \ifx\@baseurl\@empty
     \else
@@ -666,16 +666,16 @@
   \else
     \ifx\@pdfstartview\@empty
     \else
-      openaction goto page\@pdfstartpage{\@pdfstartview}%
+      openaction~goto~page\@pdfstartpage{\@pdfstartview}%
     \fi
   \fi
   \edef\Hy at temp{%
-    \ifHy at pdftoolbar\else /HideToolbar true\fi
-    \ifHy at pdfmenubar\else /HideMenubar true\fi
-    \ifHy at pdfwindowui\else /HideWindowUI true\fi
-    \ifHy at pdffitwindow /FitWindow true\fi
-    \ifHy at pdfcenterwindow /CenterWindow true\fi
-    \ifHy at pdfdisplaydoctitle /DisplayDocTitle true\fi
+    \ifHy at pdftoolbar\else /HideToolbar\c_space_tl true\fi
+    \ifHy at pdfmenubar\else /HideMenubar\c_space_tl true\fi
+    \ifHy at pdfwindowui\else /HideWindowUI\c_space_tl true\fi
+    \ifHy at pdffitwindow /FitWindow\c_space_tl true\fi
+    \ifHy at pdfcenterwindow /CenterWindow\c_space_tl true\fi
+    \ifHy at pdfdisplaydoctitle /DisplayDocTitle\c_space_tl true\fi
     \Hy at UseNameKey{NonFullScreenPageMode}\@pdfnonfullscreenpagemode
     \Hy at UseNameKey{Direction}\@pdfdirection
     \Hy at UseNameKey{ViewArea}\@pdfviewarea
@@ -694,10 +694,10 @@
     \fi
     \ifx\@pdfnumcopies\@empty
     \else
-      /NumCopies \@pdfnumcopies
+      /NumCopies\c_space_tl \@pdfnumcopies
     \fi
   }%
-  \pdfcatalog{%
+  \driver_pdf_catalog:n{%
     \ifx\Hy at temp\@empty
     \else
       /ViewerPreferences<<\Hy at temp>>%
@@ -709,6 +709,8 @@
     \fi
   }%
 }
+
+\ExplSyntaxOff
 \def\PDF at FinishDoc{%
   \pdf at ifdraftmode{}{%
     \Hy at UseMaketitleInfos
@@ -826,55 +828,9 @@
     \hyper at pagehidden
   }%
 }
-\Hy at AtBeginDocument{%
-  \ifHy at setpagesize
-    \expandafter\@firstofone
-  \else
-    \expandafter\@gobble
-  \fi
-  {%
-    \@ifclassloaded{seminar}{%
-      \setlength{\pdfvariable horigin}{1truein}%
-      \setlength{\pdfvariable vorigin}{1truein}%
-      \ifportrait
-        \ifdim\paperwidth=\z@
-        \else
-          \setlength{\pagewidth}{\strip at pt\paperwidth truept}%
-        \fi
-        \ifdim\paperheight=\z@
-        \else
-          \setlength{\pageheight}{\strip at pt\paperheight truept}%
-        \fi
-      \else
-        \ifdim\paperheight=\z@
-        \else
-          \setlength{\pagewidth}{\strip at pt\paperheight truept}%
-        \fi
-        \ifdim\paperwidth=\z@
-        \else
-          \setlength{\pageheight}{\strip at pt\paperwidth truept}%
-        \fi
-      \fi
-    }{%
-      \ltx at IfUndefined{stockwidth}{%
-        \ifdim\paperwidth>\z@
-          \setlength{\pagewidth}{\paperwidth}%
-        \fi
-        \ifdim\paperheight>\z@
-          \setlength{\pageheight}{\paperheight}%
-        \fi
-      }{%
-        \ifdim\stockwidth>\z@
-          \setlength{\pagewidth}{\stockwidth}%
-        \fi
-        \ifdim\stockheight>\z@
-          \setlength{\pageheight}{\stockheight}%
-        \fi
-      }%
-    }%
-  }%
-  \Hy at DisableOption{setpagesize}%
-}
+
+%%% removed setpagesize code, should be done by kernel/graphicx
+
 \def\Acrobatmenu#1#2{%
   \Hy at Acrobatmenu{#1}{#2}{%
     \leavevmode
@@ -902,17 +858,8 @@
     \close at pdflink
   }%
 }
-\def\Hy at FixNotFirstPage{%
-  \gdef\Hy at FixNotFirstPage{%
-    \setbox\AtBeginShipoutBox=\hbox{%
-      \copy\AtBeginShipoutBox
-    }%
-  }%
-}
-\ltx at ifpackagelater{atbegshi}{2011/10/05}{%
-}{%
-  \AtBeginShipout{\Hy at FixNotFirstPage}%
-}
+%%% removed old atbegshi fix
+
 \def\@Gauge[#1]#2#3#4{% parameters, label, minimum, maximum
   \Hy at Message{Sorry, pdftex does not support FORM gauges}%
 }
diff --git a/pdfresources.dtx b/pdfresources.dtx
index c6f74f8..6ede568 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -106,6 +106,11 @@
   \pdflastlink
  }
 
+ \cs_new_protected:Nn \driver_pdf_catalog:n
+ {
+  \pdfcatalog { #1 }
+ }
+
 }
 
 \sys_if_engine_luatex:T
@@ -138,6 +143,11 @@
   \numexpr\pdffeedback lastlink\relax
  }
 
+ \cs_new_protected:Nn \driver_pdf_catalog:n
+ {
+  \pdfextension catalog { #1 }
+ }
+
 }
 
 \sys_if_engine_xetex:T
@@ -158,6 +168,7 @@
  {
   \special{pdf:eann}
  }
+ %% \cs_new_protected:Nn \driver_pdf_catalog:n ????
 }
 %    \end{macrocode}
 %
@@ -185,6 +196,7 @@
 %    \begin{macrocode}
 \cs_new_protected:Nn \pdf_startlink_user:nn %#1 type, #2 action spec
 {
+ \seq_use:cn { l__pdf_hook_startlink_#1_seq }{}
  \driver_pdf_startlink_user:nn
   {
     \prop_map_function:cN
@@ -196,6 +208,7 @@
 
 \cs_new_protected:Nn \pdf_startlink_goto_name:nn %#1 type, #2 destination
 {
+ \seq_use:cn { l__pdf_hook_startlink_#1_seq }{}
  \driver_pdf_startlink_goto_name:nn
   {
     \prop_map_function:cN
@@ -214,6 +227,7 @@
 \seq_new:N \l__pdf_hook_endlink_url_seq
 \seq_new:N \l__pdf_hook_endlink_run_seq
 \seq_new:N \l__pdf_hook_endlink_file_seq
+\seq_new:N \l__pdf_hook_endlink_link_seq
 
 \cs_new_protected:Nn \pdf_endlink:n %#1 type, e.g. url
  {
@@ -223,14 +237,22 @@
 
 
 %    \end{macrocode}
+% \subsection{Before the links}
+% Both hyperref and tagpdf wants to insert code before the \cs{pdfstartlink} so lets
+% setup hooks for this too:
+%    \begin{macrocode}
+\seq_new:N \l__pdf_hook_startlink_url_seq
+\seq_new:N \l__pdf_hook_startlink_run_seq
+\seq_new:N \l__pdf_hook_startlink_file_seq
+\seq_new:N \l__pdf_hook_startlink_link_seq
+%    \end{macrocode}
 %
-%
-% \section{Hooks}
+% \section{Hook management}
 % hooks are commands that allow users and other packages to inject code.
 %
 % \subsection{hooks with token lists}
 %  Hook code can be stored in a simple token list variable (tl). An example is e.g.
-% \verb+\@begindocumenthook+. In this case possible operations are
+% \cs{@begindocumenthook}. In this case possible operations are
 % \begin{itemize}
 % \item \emph{appending} to the hook
 % \item \emph{prepending} to the hook
@@ -244,7 +266,7 @@
 % something to the hook can get an index back.
 % In this case possible operations are
 % \begin{itemize}
-% \item \emph{appending} to the hook (\verb+\seq_put_right+),
+% \item \emph{appending} to the hook (\cs{seq_put_right}),
 % \item \emph{prepending} to the hook (need to keep track of the \enquote{zero pointer} if the user
 % should get an index back)
 % \item \emph{changing} (e.g emptying) a hook item through the index. But as this
@@ -256,7 +278,7 @@
 % It is not quite clear if the additional features of such sequence hooks are really needed
 % but the overhead is not so large, so it should be ok to use is. Probably if the type
 % is used at all, it would be sensible to drop the tl-type so that one doesn't have to define
-% \verb+\hook_put_right_tl:nnn+ and \verb+\hook_put_right_seq:nnn+ functions.
+% \cs{hook_put_right_tl:nnn} and \cs{hook_put_right_seq:nnn} functions.
 %
 % \subsection{hooks with properties}
 % Hook code can also be stored in a property (prop). Here possible operations are
@@ -278,13 +300,13 @@
 % \subsection{Naming hooks and access functions}
 % hooks are module specific. So set functions should probably do be something like
 %
-% \verb+\hook_put_right:nnn {<module>}{<hook-name>}{value}+ (seq- or tl-type)
+% \cs{hook_put_right:nnn}\verb+{<module>}{<hook-name>}{value}+ (seq- or tl-type)
 % or in the case of  properties
-% \verb+\hook_put:nnnn {<module>}{<hook-name>}{<key>}{<value>}
+% \cs{hook_put:nnnn {<module>}{<hook-name>}{<key>}{<value>}
 %
 % hooks should be manipulated only through such access functions. So their
 % name should be an internal command of the module. E.g.
-% \verb+\l__<module>_hook_<hook-name>_prop+
+% \cs{l__<module>_hook_<hook-name>_prop}
 %
 %    \begin{macrocode}
 \cs_new:Nn \hook_put_right:nnn
@@ -292,6 +314,11 @@
   \seq_put_right:cn { l__#1_hook_#2_seq } { #3 }
  }
 
+\cs_new:Nn \hook_put_left:nnn
+ {
+  \seq_put_left:cn { l__#1_hook_#2_seq } { #3 }
+ }
+
 \cs_new:Nn \hook_put:nnnn
  {
   \prop_put:cnn { l__#1_hook_#2_prop } { #3 }{ #4 }
diff --git a/test-pdfresources.tex b/test-pdfresources.tex
index e11a314..b17f04d 100644
--- a/test-pdfresources.tex
+++ b/test-pdfresources.tex
@@ -19,13 +19,16 @@
 \ExplSyntaxOff
 \usepackage{xcolor}
 \usepackage[customdriver=hluatex-experimental]{hyperref}
-\hypersetup{urlcolor=blue,linkbordercolor=blue,pdfborder={1 1 1}}
+\tracingmacros=1
+\hypersetup{urlcolor=blue,linkbordercolor=blue,pdfborder={1 1 1},pdfprintpagerange=0}
 \makeatletter
 \hypupdateattribute
-\makeatletter 
+\makeatletter\tracingmacros=1
 \begin{document}
 \section{a}\label{a}
-\tracingmacros=1 \ref{a}
+\ref{a}
+\newpage 
+blblb
 \end{document}
 %test driver link.
 \url{www.blub.de}
diff --git a/test-tagpdf-link.tex b/test-tagpdf-link.tex
index 3812a43..321db87 100644
--- a/test-tagpdf-link.tex
+++ b/test-tagpdf-link.tex
@@ -12,7 +12,7 @@
 \fi
 
 \documentclass{article}
-
+\usepackage{graphicx}
 \usepackage{tagpdf}
 \tagpdfsetup{
  activate-all,
@@ -35,13 +35,20 @@
 \makeatletter\ExplSyntaxOn
 \input{pdfresources.dtx}
 \makeatother\ExplSyntaxOff
-
+\usepackage{xcolor}
 \usepackage[customdriver=hluatex-experimental]{hyperref}
-\hypersetup{urlcolor=red,pdfborder={1 1 1}}
+\hypersetup{urlcolor=red,pdfborder={1 1 1},linkbordercolor=yellow}
 \hypupdateattribute
 
 %add hooks:
 \ExplSyntaxOn\makeatletter
+\hook_put_left:nnn
+ { pdf }
+ { startlink_url }
+ {
+   \uftag_struct_begin:n{tag=Link}
+   \uftag_mc_begin:n{tag=Link}
+ }
 \hook_put:nnnn
  { pdf }
  { startlink_url_attr }
@@ -50,25 +57,77 @@
 \hook_put_right:nnn
  { pdf }
  { endlink_url }
- { \__uftag_struct_finish_link: }
+ { 
+  \__uftag_struct_finish_link:
+   \uftag_mc_end:
+   \uftag_struct_end: 
+ }
+
+
+
+\hook_put_left:nnn
+ { pdf }
+ { startlink_link }
+ {
+   \uftag_struct_begin:n{tag=Link}
+   \uftag_mc_begin:n{tag=Link}
+ }
+\hook_put:nnnn
+ { pdf }
+ { startlink_link_attr }
+ { /StructParent }
+ { \int_use:N\c at g__uftag_parenttree_obj_int }
+\hook_put_right:nnn
+ { pdf }
+ { endlink_link }
+ { 
+  \__uftag_struct_finish_link: 
+  \uftag_mc_end:
+  \uftag_struct_end: 
+ }
+
 
 \ExplSyntaxOff
 \begin{document}
 \tagstructbegin{tag=Document}
-\leavevmode
+ \leavevmode
+ \tagstructbegin{tag=P}
+  \tagmcbegin{tag=P}
+   abc\refstepcounter{section}\label{test}
+  \tagmcend
+  \tagmcbegin{tag=P}
+   abc
+  \tagmcend 
+   \href{www.dante.de}{link linkl}
+  \tagmcbegin{tag=P} 
+   some text 
+  \tagmcend 
+   \ref{test}
+ \tagstructend %P
+ 
+%attention wrong order: 
 \tagstructbegin{tag=P}
-\tagmcbegin{tag=P}
-abc
-\tagmcend
-\tagmcbegin{tag=P}
-abc
-\tagmcend
-\tagstructbegin{tag=Link}
-\tagmcbegin{tag=Span}
-\href{www.dante.de}{link linkl}
-\tagmcend
-\tagstructend
+  \tagmcbegin{tag=P}
+   abc\refstepcounter{section}\label{test}
+  \tagmcend
+  \tagmcbegin{tag=P}
+   abc
+  %\tagmcend
+   \href{www.dante.de}{link linkl}
+  %\tagmcbegin{tag=P}
+   some text
+  %\tagmcend
+   \ref{test}
+ \tagstructend %P 
+\tagstructend %Document
+
+\end{document}
+
+
+
+
 
+%% old stuff from the tests
 \tagstructbegin{tag=Link}
 \tagmcbegin{tag=Span}
 \ExplSyntaxOn\makeatletter





More information about the latex3-commits mailing list