latex3 / tagging-project

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

Longtable, colortbl and tags clash #90

Closed DavidEGx closed 2 months ago

DavidEGx commented 3 months ago

Hi,

Got this latex code:

\DocumentMetadata{
  lang        = en,
  pdfversion  = 2.0,
  pdfstandard = ua-2,
  testphase   = {phase-III, table}
}

\documentclass[10pt]{article}

\usepackage{longtable}
\usepackage[table]{xcolor}

\begin{document}

\begin{longtable}{ p{0.3\textwidth} p{0.3\textwidth} }
\hline Row 1 & 105 \\
\end{longtable}

\end{document}                                        

Then I run:

$ lualatex test.tex

and got:

...
(/opt/texlive/2024/texmf-dist/tex/latex/pdfmanagement-testphase/xcolor-patches-
tmp-ltx.sty) (/opt/texlive/2024/texmf-dist/tex/latex/colortbl/colortbl.sty)
(./latest.aux) (/opt/texlive/2024/texmf-dist/tex/latex/base/ts1cmr.fd)
(/opt/texlive/2024/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
)
! Undefined control sequence.
<argument> \ERRORtbl 
          /row
l.18 \end
       {longtable}

Same thing using xelatex.

Either removing:

Make it work without any issue.

u-fischer commented 3 months ago

colortbl overwrites the \hline definition and this breaks the tagging code.

It seems to work if one handles the multispan similar to the booktabs firstaid, but there aren't many testfiles around.

(edited to use \tbl_gdecr_row_count: instead of the internal int)

\DocumentMetadata{
  lang        = en,
  pdfversion  = 2.0,
  pdfstandard = ua-2,
  testphase   = {phase-III, table},
}

\documentclass[10pt]{article}

\usepackage{longtable}
\usepackage{colortbl}

\begin{document}
\makeatletter
\ExplSyntaxOn
    \def\LT@@hline{%
      \ifx\LT@next\hline
        \global\let\LT@next\@gobble
        \ifx\CT@drsc@\relax
          \gdef\CT@LT@sep{%
            \noalign{\penalty-\@medpenalty\vskip\doublerulesep}}%
        \else
          \gdef\CT@LT@sep{%
            \multispan\LT@cols{%
              \tag_mc_begin:n{artifact}
              \CT@drsc@\leaders\hrule\@height\doublerulesep\hfill
              \tag_mc_end: \tbl_gdecr_row_count:
            }\cr}%
        \fi
      \else
        \global\let\LT@next\empty
        \gdef\CT@LT@sep{%
          \noalign{\penalty-\@lowpenalty\vskip-\arrayrulewidth}}%
      \fi
      \ifnum0=`{\fi}%
      \multispan\LT@cols
       {\tag_mc_begin:n{artifact}
        \CT@arc@\leaders\hrule\@height\arrayrulewidth\hfill
        \tag_mc_end: \tbl_gdecr_row_count:
       }\cr
      \CT@LT@sep
      \multispan\LT@cols
       {\tag_mc_begin:n{artifact}
        \CT@arc@\leaders\hrule\@height\arrayrulewidth\hfill
        \tag_mc_end: \tbl_gdecr_row_count: 
       }\cr
      \noalign{\penalty\@M}%
      \LT@next}

\ExplSyntaxOff

\begin{longtable}{ p{3cm}p{3cm}}
\hline 
Row 1 & 105 \\
\hline\hline 
\end{longtable}

\end{document}              
FrankMittelbach commented 3 months ago

so the cause is xcolor loading colrtbl, right? so we should probably change the issue title to mention colortbl and then mark for now as not fully compatible

davidcarlisle commented 2 months ago

This should be fixed by the colortbl update in the above comment, I'll release that to ctan today