Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppressing tagging after resuming results in error #104

Open
T-F-S opened this issue Jul 8, 2024 · 2 comments
Open

Suppressing tagging after resuming results in error #104

T-F-S opened this issue Jul 8, 2024 · 2 comments

Comments

@T-F-S
Copy link

T-F-S commented Jul 8, 2024

Testing your supposed tagging suppression in T-F-S/tcolorbox#283 (comment) I encountered a compilation error, if one suppressed code part is followed by another one.

The following code gives a MWE without tcolorbox and without tikzpicture, but with the same errors:

\DocumentMetadata{
  lang        = de,
  pdfversion  = 2.0,
  pdfstandard = ua-2,
  pdfstandard = a-4f,
  testphase   =
  {
    phase-III,
  },
  uncompress,
}

%\tagpdfsetup{tabsorder=structure}

\documentclass[]{article}

\ExplSyntaxOn
\makeatletter

\NewSocket{tagsupport/tcb/drawing/begin}{0}
\NewSocket{tagsupport/tcb/drawing/end}{0}
\NewSocketPlug{tagsupport/tcb/drawing/begin}{suspend}
 {\tag_mc_end_push:\tag_mc_begin:n{artifact}}
\NewSocketPlug{tagsupport/tcb/drawing/end}{resume}
 {\tag_mc_end:\tag_mc_begin_pop:n{}}
\AssignSocketPlug{tagsupport/tcb/drawing/begin}{suspend}
\AssignSocketPlug{tagsupport/tcb/drawing/end}{resume}

\NewDocumentCommand \dummy {}
  {
    \UseTaggingSocket{tcb/drawing/begin}
    \SuspendTagging{tcb/drawing}
    Dummy
    \ResumeTagging{tcb/drawing}
    \UseTaggingSocket{tcb/drawing/end}
  }

\makeatother
\ExplSyntaxOff

\begin{document}

abc

\dummy
\dummy
\dummy

efg

\end{document}

Package tagpdf Warning: there is no mc to end at 4

! Package tagpdf Error: there is no open structure on the stack

@u-fischer
Copy link
Member

You need to correctly "balance" the para/begin and para/end code when you stop tagging (and generally too). In your example you are suspending tagging before you start the paragraph, in vmode, but you then resume it inside the paragraph.

It compiles fine if you add a \leavevmode:

\NewDocumentCommand \dummy {}
  {
    \leavevmode 
    \UseTaggingSocket{tcb/drawing/begin}
    \SuspendTagging{tcb/drawing}
    Dummy
    \ResumeTagging{tcb/drawing}
    \UseTaggingSocket{tcb/drawing/end}
  }

Or a \par:

\NewDocumentCommand \dummy {}
  {
    \UseTaggingSocket{tcb/drawing/begin}
    \SuspendTagging{tcb/drawing}
    Dummy\par
    \ResumeTagging{tcb/drawing}
    \UseTaggingSocket{tcb/drawing/end}
  }

@T-F-S
Copy link
Author

T-F-S commented Jul 8, 2024

I see. This seems to be true even for \clearpage. The following code also needs \leavevmode to work:

\NewDocumentCommand \dummy {}
  {
    \clearpage
    \leavevmode%  deletion gives an error
    \UseTaggingSocket{tcb/drawing/begin}
    \SuspendTagging{tcb/drawing}
    Dummy
    \ResumeTagging{tcb/drawing}
    \UseTaggingSocket{tcb/drawing/end}
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants