latex3 / tagpdf

Tagging support code for LaTeX
59 stars 7 forks source link

Clash with Microtype #49

Closed michal-h21 closed 8 months ago

michal-h21 commented 2 years ago

Hello Ulrike,

I've run to a clash between Tagpdf and Microtype when I use the quotation environment. Here is a MWE:

\RequirePackage{pdfmanagement-testphase}
\DeclareDocumentMetadata
{
testphase = tagpdf, % load
activate = tagging % activate and create the document structure
}
\documentclass{article}
\usepackage{microtype}
\begin{document}
\begin{quotation}
Hello world
\end{quotation}

\end{document}

This results in multiple errors like this:

! LaTeX3 Error: Control sequence \g__tag_struct_2_prop already defined.

For immediate help type H <return>.
 ...                                              

l.11 He
     llo world
? r
OK, entering \nonstopmode...

! LaTeX3 Error: Control sequence \__tag_struct_output_prop_2:n already
(LaTeX3)        defined.

The same error happens with both LuaLaTeX and PDFLaTeX. The document compiles without errors when I remove Microtype, or when I remove the quotation environment.

u-fischer commented 2 years ago

yes, implicit lists are a problem for tagging anyway, but microtype additionally patches \item in a way that breaks it completly.

We will have to analyze and coordinate the tagging and microtype needs here. For now you should either use \usepackage[nopatch=item]{microtype}, or disable para tagging with \AddToHook{env/quotation/begin}{\tagpdfparaOff}.

Side remark: we are in the process of moving some code into the kernel and the loading commands will change (get simpler).

michal-h21 commented 2 years ago

Thank you Ulrike, \usepackage[nopatch=item]{microtype} works for the actual document where I discovered this issue. These package clashes are always pain to fix, so I am glad that a workaround already exists.

u-fischer commented 2 years ago

I will leave that open for now, as it is an issue we will have to handle at some time.

u-fischer commented 2 years ago

@michal-h21 Imho the right fix is \patchcmd{\MT@get@prot}{\noindent}{\RawNoindent}{}{\fail} and I reported that in the microtype tracker.

michal-h21 commented 2 years ago

@u-fischer thank you for the investigation and fix.

hpvd commented 1 year ago

seems to be solved, see: https://github.com/schlcht/microtype/issues/8

u-fischer commented 8 months ago

Updated example below seems to work fine, so I'm closing this issue.

\DocumentMetadata
{
testphase = phase-III, % load
}
\documentclass{article}
\usepackage{microtype}
\begin{document}
\begin{quotation}
Hello world
\end{quotation}

\end{document}