davidcarlisle / dpctex

Assorted TeX packages
93 stars 30 forks source link

support for tagging in colortbl #47

Closed u-fischer closed 3 months ago

u-fischer commented 6 months ago

tagging of \multicolumn currently fails as colortbl redefines the new definition in array.sty (LaTeX 2024-06-01)

This here should resolve this:

\DocumentMetadata{testphase={phase-III,table},pdfversion=1.7,uncompress}
\documentclass{article}
\usepackage{colortbl}
\makeatletter\ExplSyntaxOn
\IfFormatAtLeastTF{2024-06-01}{%
\long\def\multicolumn#1#2#3{%
   \multispan{#1}\begingroup
   \tbl_update_multicolumn_cell_data:n {#1}
   \def\@addamp{\if@firstamp \@firstampfalse \else
                \@preamerr 5\fi}%
   \@mkpream{#2}\@addtopreamble\@empty
   \endgroup
   \UseTaggingSocket{tbl/colspan}{#1}%
   \def\@sharp{#3}%
   \let\CT@cell@color\relax
   \let\CT@column@color\relax
   \let\CT@do@color\relax
   \@arstrut \@preamble
   \null
   \ignorespaces}}{}  
\ExplSyntaxOff
\begin{document}
\begin{tabular}{ll}
\multicolumn{2}{l}{\cellcolor{red}Test multicolumn}\\
\rowcolor{green} A & B \\
\end{tabular}

\end{document}

(An alternative would be to add the \let commands directly to array.sty?)