latex3 / tagging-project

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

Tables: How to handle empty par-like cells? #750

Closed giovanni111 closed 3 weeks ago

giovanni111 commented 3 weeks ago

array.sty's mechanism to tag par-like table cells using \insert@pcolumn works pretty good. But I get a problem when such a cell is empty. tagpdf then warns me that the Relation is not allowed (struct 12, /TR --> struct 14), and the PDF seems no to be UA-valid because <Div> is outside <TD>.

I assume empty par-like cells should in principle be possible, but I don't know how to handle them.

Note that with the following redefinition, the resulting PDF will be UA-valid:

\DocumentMetadata{
  pdfversion  = 1.7,pdfstandard = ua-1,
  testphase   = {phase-III,title,table}}
\documentclass{book}
\makeatletter
\def\insert@notagcolumn{%
   \the@toks \the \@tempcnta
   \ignorespaces \@sharp \unskip
   \the@toks \the \count@ \relax}
\def\@classz{\@classx
   \@tempcnta \count@
   \prepnext@tok
   \@addtopreamble{\ifcase \@chnum
      \hfil
      \hskip1sp%
      \d@llarbegin
      \insert@column
      \d@llarend \do@row@strut \hfil \or
      \hskip1sp\d@llarbegin \insert@column \d@llarend \do@row@strut \hfil \or
      \hfil\hskip1sp\d@llarbegin \insert@column \d@llarend \do@row@strut \or
    \UseTaggingSocket{tbl/pcell/begin}\setbox\ar@mcellbox\vbox
    \@startpbox{\@nextchar}\insert@notagcolumn \@endpbox
    \ar@align@mcell
    \do@row@strut \UseTaggingSocket{tbl/pcell/end}\or
   \UseTaggingSocket{tbl/pcell/begin}\vtop \@startpbox{\@nextchar}\insert@notagcolumn \@endpbox\do@row@strut\UseTaggingSocket{tbl/pcell/end}\or
   \UseTaggingSocket{tbl/pcell/begin}\vbox \@startpbox{\@nextchar}\insert@notagcolumn \@endpbox\do@row@strut\UseTaggingSocket{tbl/pcell/end}%
  \fi}\prepnext@tok}
\makeatother
\title{Tabellen}
\pagestyle{empty}
\begin{document}
\begin{tabular}{p{1em}}
  a \\
  \\
\end{tabular}
\end{document}
u-fischer commented 3 weeks ago

This has already been resolved. Compile with latex-dev (lualatex-dev or pdflatex-dev) or wait for the next release (in a few days).

giovanni111 commented 3 weeks ago

Perfect! Thank you!

FrankMittelbach commented 3 weeks ago

With tagging it is always useful to try the -dev formats as a lot of updates happen and the main releases only happen twice a year.