latex3 / tagging-project

Issues related to the tagging project
https://latex3.github.io/tagging-project/
LaTeX Project Public License v1.3c
23 stars 5 forks source link

amsmath intertext problem with phase-II and phase-III (without math tagging) #77

Open krypt-n opened 1 month ago

krypt-n commented 1 month ago

I know that compatibility with amsmath is not guaranteed or expected at this point, but I stumbled upon this error in my document, which could be easy to fix.

Consider the following document

\DocumentMetadata{
    testphase={phase-II}
}
\documentclass{article}
\usepackage{amsmath}

\begin{document}
    \begin{gather*}
        A = B \\
        \intertext{where}
        B = C
    \end{gather*}
\end{document}

Compiling with current lualatex results in the following error.

This is LuaHBTeX, Version 1.18.0 (TeX Live 2024) 
 restricted system commands enabled.
(./test3.tex
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-04-11>
``` (/usr/local/texlive/2024/texmf-dist/tex/latex/latex-lab/documentmetadata-suppor t.ltx (/usr/local/texlive/2024/texmf-dist/tex/latex/pdfmanagement-testphase/pdfmanage ment-testphase.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/pdfmanagement-testphase/pdfmanage ment-testphase.ltx))) (/usr/local/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-luatex.def) (/usr/local/texlive/2024/texmf-dist/tex/latex/pdfmanagement-testphase/l3backend -testphase-luatex.def) (/usr/local/texlive/2024/texmf-dist/tex/latex/latex-lab/phase-II-latex-lab-test phase.ltx (/usr/local/texlive/2024/texmf-dist/tex/latex/latex-lab/latex-lab-testphase-new -or-1.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/etoolbox/etoolbox.sty) Patching header in \@outputpage Patching footer in \@outputpage Patching \@makecol for tagging Patching \@makecol for tagging ) (/usr/local/texlive/2024/texmf-dist/tex/latex/latex-lab/latex-lab-testphase-new -or-2.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/latex-lab/latex-lab-footnotes.ltx )) (/usr/local/texlive/2024/texmf-dist/tex/latex/tagpdf/tagpdf.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def) (/usr/local/texlive/2024/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/pdfmanagement-testphase/pdfmanage ment-firstaid.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/base/article.cls Document Class: article 2023/05/17 v1.4n Standard LaTeX document class (/usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo)) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsopn.sty)) (./test3.aux ) (/usr/local/texlive/2024/texmf-dist/tex/latex/base/ts1cmr.fd) ```
Package tagpdf Warning: Parent-Child 'P/' --> 'text-unit/user'.
(tagpdf)                Relation is not allowed (struct 4, /text --> struct 5)
(tagpdf)                on line 14

Package tagpdf Warning: Parent-Child 'P/' --> 'text/user'.
(tagpdf)                Relation is not allowed (struct 5, /text-unit -->
(tagpdf)                struct 6) on line 14

! LaTeX Error: Control sequence \g__tag_struct_5_prop already defined.

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

l.14     \end{gather*}

The same error occurs with lualatex-dev or other engines. The error also happens with \shortintertext and other amsmath environments. The error disappears when \intertext is removed or the tagging project phase is dropped to phase-I. Additionally, the error also disappears when the math option is added to the testphase (which is probably the path forward).

u-fischer commented 1 month ago

As you note yourself, you need the math testphase module for this.

FrankMittelbach commented 1 month ago

Tagging of documents involving math is not supported in testphases I to III, the fact that it didn't generate an error in testphase I doesn't indicate a regression. We have not yet integrated math tagging into any phase but kept it as a separate module as it is still under development. So for documents involving math you need to enable it explicitly for now.

krypt-n commented 1 month ago

Ah, thank you for your answers, I misunderstood the testphases. So, the fact that something like $a$ compiles at all without the math testphase module is not guaranteed.

I'd close the issue, but the label you added suggests to me that you want to keep it open.

FrankMittelbach commented 1 month ago

At some point we will integrate math directly (probably testphase IV) --- we can close then. Currently without math the testphases will try to do something with math content and often will compile, but they aren't tagging the math content as "math" and for more complicate environments/commands they may fail as in your example.