Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

presentation mode in table tagging can not be reverted #778

Open
u-fischer opened this issue Jan 5, 2025 · 6 comments
Open

presentation mode in table tagging can not be reverted #778

u-fischer opened this issue Jan 5, 2025 · 6 comments

Comments

@u-fischer
Copy link
Member

If one use \tagpdfsetup{table/tagging=presentation} this changes the tag names but it is not possible to revert that, which is problem if one want to nest a real table inside the presentation table.


\DocumentMetadata
  {
    lang=en-US,
    pdfversion=2.0,
    pdfstandard=ua-2,
    testphase={latest},
  }

\documentclass{book}
\usepackage{lipsum}
\begin{document}
\tagpdfsetup{table/tagging=presentation}
\begin{tabular}{p{6cm}p{6cm}}
\lipsum[1] & \lipsum[2]\\
\end{tabular}

\tagpdfsetup{table/tagging} %does not work as intended.
\begin{tabular}{ll}
abc & abc
\end{tabular}

\end{document}
@davidcarlisle
Copy link
Member

davidcarlisle commented Jan 6, 2025

Clearly not being able to revert is a bug, but changing the names already causes some issues as the table structure is lost and so it is very hard to derive a reasonable layout. eg a 4x4 layout of paragraphs may just be "presentational" but if they are tagged as four Div and so derive to a 1x4 sequence of paragraphs it is hard to maintain the meaning. It would be good to be able to generate structure elements that would eventually derive to an html table with role=presentation. (This may require adjusting some constraints from the PDF tagging specs?)

See the derived html from the code above at

https://texlive.net/ngpdfb.html?%5CDocumentMetadata%0A%20%20%7B%0A%20%20%20%20lang=en-US,%0A%20%20%20%20pdfversion=2.0,%0A%20%20%20%20pdfstandard=ua-2,%0A%20%20%20%20testphase=%7Blatest%7D,%0A%20%20%7D%0A%0A%5Cdocumentclass%7Bbook%7D%0A%5Cusepackage%7Blipsum%7D%0A%5Cbegin%7Bdocument%7D%0A%5Ctagpdfsetup%7Btable/tagging=presentation%7D%0A%5Cbegin%7Btabular%7D%7Bp%7B6cm%7Dp%7B6cm%7D%7D%0A%5Clipsum%5B1%5D%20&%20%5Clipsum%5B2%5D%5C%5C%0A%5Cend%7Btabular%7D%0A%0A%5Ctagpdfsetup%7Btable/tagging%7D%20%25does%20not%20work%20as%20intended.%0A%5Cbegin%7Btabular%7D%7Bll%7D%0Aabc%20&%20abc%0A%5Cend%7Btabular%7D%0A%0A%5Cend%7Bdocument%7D

@u-fischer
Copy link
Member Author

If I had an idea which structure in PDF correctly derives ... ;-) I have some doubt that we can use Table + some attribute in PDF.

@davidcarlisle
Copy link
Member

Shame if we can't use /Table, otherwise you'd need to somehow inject enough CSS to recreate a table layout (although my comment doesn't block this issue, more a side comment, which perhaps I should open as a separate issue so this one can be closed by the current PR)

@John02139
Copy link

John02139 commented Jan 7, 2025

This issue arose when I asked Ulrike about the tabbing environment, which is not currently supported by tagging and which might be replaced by a presentation table. In HTML4/5, alignment in tables should be managed by a CSS attribute rather than by something like <td align="left">, and HTML validators throw errors when an "alignment table" is used rather than CSS. (Similarly, two column text is supposed to be generated using div and CSS.)

For the purpose of tagging a tabbing-like layout, however, would simply using a tabular environment for the rows/columns (rather than tabs and lines) produce appropriately tagged content? The rows and columns would be arranged in td and tr. Alignments would be lost in translation to HTML, I guess. I don't know enough about the details to judge this myself.

@u-fischer
Copy link
Member Author

@John02139 The new code in latex3/latex2e#1607 will change the tagging of "presentation tables". They will have the normal table tags and set the ARIA attribute role=presentation (https://www.w3.org/WAI/ARIA/apg/practices/hiding-semantics/). This better for html derivation as it allows to keep the layout without lots of css.

Alignments would be lost in translation to HTML, I guess.

One can add an InlineAlign attribute to a table cell. For c,l and r cells that would be quite easy. For p-cells it is not so trivial to detect the alignment.

@John02139
Copy link

Thank, Ulrike, that sounds excellent. Will the addition of alignment attributes be handled automatically by the tagged latex code or by the end-user ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants