Skip to content

footnote patch breaks with tagging #59

@u-fischer

Description

@u-fischer

Description

When tagging is activated every footnote leads to an error (in all engines) in the newest current LaTeX release as we are now inserting automatically a \par token at the end of \vbox (by setting \partokencontext=2) and this leads to unbalanced tagging in constructions using \RawNoindent, e.g. like \setbox0\vbox{\RawNoindent a}.

As fix I suggest to disable tagging in such places.

Minimal example demonstrating the issue

\DocumentMetadata
  {
    lang=en-US,
    tagging=on
  }
\documentclass{article}
\usepackage{microtype}
\makeatletter
\def\MT@get@prot#1#2{%
  \begingroup
   %\SuspendTagging{\MT@get@prot}%%<---------------
    \setbox\MT@tempbox\vbox{%
      \everypar{}%
      \parfillskip=\z@skip
      \hbadness\@M
      \clubpenalty\z@
      \widowpenalty\z@
      \interlinepenalty\z@
      \@newlistfalse
      \MT@prot@hook
      \begingroup
        \MT@noindent #1\relax\MT@csq@eqgroup
      \endgroup}%
    \vbadness=\@M
    \splittopskip=\z@
    \vfuzz=\maxdimen
    \setbox\MT@tempbox\vbox{%
      \ifvbox\MT@tempbox
        \global\setbox\MT@tempbox=\vsplit\MT@tempbox to \normalbaselineskip
        \unvbox\MT@tempbox
        \global\setbox\MT@tempbox=\lastbox
      \fi
    }%
  \endgroup
  \ifhbox\MT@tempbox
    \@tempdima=\@nameuse{#2marginkern}\MT@tempbox\relax
    \expandafter\ifdim\@tempdima=\z@ \else
      \leavevmode
      \MT@vinfo{|<< adding #2 margin kern for `#1':\MessageBreak
        \the\@tempdima \on@line}%
      \kern\@tempdima
    \fi
  \fi
}

\begin{document}
text\footnote{test}
\end{document}

This errors (without the fix) in LaTeX2e <2025-11-01> with

Package tagpdf Warning: Parent-Child 'pdf2:Document' --> 'MC (realcontent)'.
(tagpdf)                Relation is not allowed! on line 189
(tagpdf)                struct 2, /Document 


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

Type <return> to continue.
 ->\tex_errmessage:D  Package tagpdf Error: there is no open structure on the stack

Type <return> to continue\use_none:n                                                
                                                                                                                                                                         
l.190 \end{document}

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions