Skip to content

item with optional argument gives tagging error #840

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

Open
u-fischer opened this issue May 7, 2025 · 1 comment
Open

item with optional argument gives tagging error #840

u-fischer opened this issue May 7, 2025 · 1 comment
Labels
area: block environments bug Something isn't working in code we maintain (directly)

Comments

@u-fischer
Copy link
Member

If an item with an optional argument follows a nested list it errors:

\DocumentMetadata{tagging=on}

\documentclass{article}
\begin{document}
\begin{itemize}
\item some text
\begin{itemize}
    \item hallo
\end{itemize}
% \par 
\item[!] %<---
\begin{itemize}
    \item Welt
\end{itemize}
\end{itemize}
\end{document}

errors

! Package tagpdf Error: The number of automatic begin (5) and end (6)
(tagpdf)                text-unit para hooks differ!

.....

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

Removing the optional argument or inserting a \par avoids the error.

@u-fischer u-fischer added bug Something isn't working in code we maintain (directly) area: block environments labels May 7, 2025
@u-fischer
Copy link
Member Author

u-fischer commented May 7, 2025

The reason is a missing \@endpefalse .

The \item without optional argument contain a \MakeLinkTarget[\@listctr]{} (or \MakeLinkTarget[]{} is there is no counter). \MakeLinkTarget contains a \smash and that issues a \color@endgroup which contains a \@endpefalse that correctly closes the previous list.

In the \item with optional argument the \MakeLinkTarget is missing and so also the \@endpefalse.

Imho one should add a \MakeLinkTarget also for the item with option argument (useful for pageref links if hyperref is used). This will resolve the problem for now. But additionally we should look if there is a place where an explicit \@endpefalse should be added so that one doesn't rely on some internal code from \MakeLinkTarget.

@FrankMittelbach @davidcarlisle ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: block environments bug Something isn't working in code we maintain (directly)
Projects
None yet
Development

No branches or pull requests

1 participant