With apologies, I do not have any LaTeX domain knowledge, therefore this issue will be a conversation between various instances of Claude.
TL;DR: there are paths forward, but the current recommendation is to use footnotes and not margin notes in order to produce accessible PDFs using LaTeX.
Errors:
StructTreeRoot shall not contain <P>/<Caption>/<Figure>/<Table>/<Div>/<Part>
The structure tree root shall contain a single Document structure element
<P> shall not contain <Aside>/<Part>/<P>
Cause: All these tests use margin layout (.column-margin or column: margin).
Quarto's filters generate:
\marginnote{\begin{footnotesize}...\end{footnotesize}} for text
(src/resources/filters/layout/latex.lua:215-238)
\begin{marginfigure}...\end{marginfigure} for figures
(src/resources/filters/layout/latex.lua:554)
\begin{margintable}...\end{margintable} for tables
(src/resources/filters/layout/latex.lua:643-663)
These come from the sidenotes and marginnote LaTeX packages (injected at
src/resources/filters/layout/meta.lua:106-116). These packages predate PDF
tagging and don't cooperate with tagpdf:
\marginnote creates content in a separate output stream that escapes the
Document structure element entirely, placing children at StructTreeRoot.
tagpdf assigns an <Aside> role to margin content but nests it inside an
active <P> context, which is invalid per PDF/UA-2.
- The result is structure elements (
<P>, <Caption>, <Figure>, etc.) appearing
directly under StructTreeRoot instead of inside <Document>.
Files:
| File |
Margin content |
2024/05/06/9582.qmd |
Multiple .column-margin divs with figures and text |
2024/06/24/10112.qmd |
R table with column: margin |
typst/margin-layout/margin-figure-crossref-interleaved.qmd |
Figures with .column-margin class |
article-layout/tables/compute-table-margin.qmd |
R table with column: margin |
2022/09/30/caption-footnotes/test.qmd |
Also affected (uses figure captions; see section 3) |
Problem in: LaTeX packages (sidenotes/marginnote). These packages are not
tag-aware. Fixing this requires either:
- Upstream patches to
sidenotes/marginnote for tagpdf compatibility
- A different LaTeX approach for margin content when tagging is enabled
- Skipping UA-2 validation for margin-layout tests until the ecosystem catches up
With apologies, I do not have any LaTeX domain knowledge, therefore this issue will be a conversation between various instances of Claude.
TL;DR: there are paths forward, but the current recommendation is to use footnotes and not margin notes in order to produce accessible PDFs using LaTeX.
Errors:
StructTreeRoot shall not contain <P>/<Caption>/<Figure>/<Table>/<Div>/<Part>The structure tree root shall contain a single Document structure element<P> shall not contain <Aside>/<Part>/<P>Cause: All these tests use margin layout (
.column-marginorcolumn: margin).Quarto's filters generate:
\marginnote{\begin{footnotesize}...\end{footnotesize}}for text(
src/resources/filters/layout/latex.lua:215-238)\begin{marginfigure}...\end{marginfigure}for figures(
src/resources/filters/layout/latex.lua:554)\begin{margintable}...\end{margintable}for tables(
src/resources/filters/layout/latex.lua:643-663)These come from the
sidenotesandmarginnoteLaTeX packages (injected atsrc/resources/filters/layout/meta.lua:106-116). These packages predate PDFtagging and don't cooperate with
tagpdf:\marginnotecreates content in a separate output stream that escapes theDocument structure element entirely, placing children at StructTreeRoot.
tagpdfassigns an<Aside>role to margin content but nests it inside anactive
<P>context, which is invalid per PDF/UA-2.<P>,<Caption>,<Figure>, etc.) appearingdirectly under StructTreeRoot instead of inside
<Document>.Files:
2024/05/06/9582.qmd.column-margindivs with figures and text2024/06/24/10112.qmdcolumn: margintypst/margin-layout/margin-figure-crossref-interleaved.qmd.column-marginclassarticle-layout/tables/compute-table-margin.qmdcolumn: margin2022/09/30/caption-footnotes/test.qmdProblem in: LaTeX packages (
sidenotes/marginnote). These packages are nottag-aware. Fixing this requires either:
sidenotes/marginnotefortagpdfcompatibility