20
0

paper_template: enable tagging, add alt text and header row examples

Switches to \DocumentMetadata{tagging=on} for the reasons described in
the previous commit; the structure tree went from /Document plus eleven
/Link nodes to three headings, twenty paragraphs, a tagged list and the
abstract as a block quote.

Adds a worked example of the two things tagging cannot do for an
author. A data table carries \tagpdfsetup{table/header-rows={1}}, which
makes its first row TH rather than TD so a screen reader can announce
which column a value belongs to. A commented-out figure shows the alt=
argument to \includegraphics, which is what gets announced in place of
an image; it is left commented so the template does not have to ship a
binary, and mentions [artifact] for decorative images.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-13 18:15:48 -07:00
parent 0a43387d2e
commit 331b6525af

View File

@@ -1,7 +1,16 @@
% Tagged PDF (PDF/UA-2) accessibility setup. The article class works % Tagged PDF (PDF/UA-2) accessibility setup. The article class works
% with the LaTeX tagging-project, so we use the full \DocumentMetadata % with the LaTeX tagging project, so we use the full \DocumentMetadata
% path here. % path here.
%
% tagging=on is what actually builds the structure tree: it loads the
% kernel code that tags paragraphs, headings, lists, tables, and
% floats. Declaring pdfstandard=ua-2 on its own only writes the claim
% into the metadata; without tagging=on the PDF is marked as UA-2 but
% carries no structure for a screen reader to read. This needs TeX
% Live 2025 or later --- on Overleaf, set it in Menu > Settings >
% TeX Live version.
\DocumentMetadata{ \DocumentMetadata{
tagging=on,
pdfversion=2.0, pdfversion=2.0,
pdfstandard=ua-2, pdfstandard=ua-2,
lang=en-US, lang=en-US,
@@ -10,8 +19,6 @@
\documentclass[12pt]{article} \documentclass[12pt]{article}
\usepackage{cdsc-paper} \usepackage{cdsc-paper}
\usepackage{tagpdf}
\tagpdfsetup{activate-all}
\usepackage{fontspec} \usepackage{fontspec}
% fontspec disables the classic TeX input ligatures by default % fontspec disables the classic TeX input ligatures by default
@@ -201,6 +208,51 @@ brown fox jumps over the lazy dog. The quick brown fox jumps over the
lazy dog. The quick brown fox jumps over the lazy dog. The quick brown lazy dog. The quick brown fox jumps over the lazy dog. The quick brown
fox jumps over the lazy dog \citep{989866}. fox jumps over the lazy dog \citep{989866}.
\section{Accessible Figures and Tables}
Table~\ref{tab:example} shows a data table whose header row is tagged,
and the commented-out block below it shows a figure carrying alt text.
Both are here as worked examples; delete them along with this section
when you start writing.
% ACCESSIBILITY: every figure needs an alt= description, which is what
% a screen reader announces in place of the image. Describe what the
% reader is meant to take from the figure rather than naming it: "Edit
% counts rising sharply after 2005" tells them something, "Figure 1"
% does not. The caption is read separately, so alt text that repeats
% the caption is wasted. For a purely decorative image, use
% \includegraphics[artifact]{...} instead, which keeps it out of the
% reading order entirely.
%
% \begin{figure}
% \centering
% \includegraphics[width=0.6\linewidth,
% alt={Edit counts by year, rising sharply after 2005}]{figure.pdf}
% \caption{A caption, which is read separately from the alt text.}
% \label{fig:example}
% \end{figure}
% ACCESSIBILITY: header-rows tells the tagging code which rows are
% headers, so their cells become TH rather than TD and a screen reader
% can announce the column a value belongs to. Without it, a data table
% reads as an undifferentiated grid of numbers. Set it for each table
% that has headers; use {1,2} if two rows are headers.
\tagpdfsetup{table/header-rows={1}}
\begin{table}
\centering
\begin{tabular}{lr}
Item & Quantity \\ \hline
Widgets & 42 \\
Gadgets & 13
\end{tabular}
\caption{A data table whose first row is tagged as headers.}
\label{tab:example}
\end{table}
% A table used only to position things on the page, rather than to
% present data, should be marked so assistive software skips its
% structure: \tagpdfsetup{table/tagging=presentation}
% bibliography here % bibliography here
\setcounter{biburlnumpenalty}{9001} \setcounter{biburlnumpenalty}{9001}
\printbibliography[title = {References}, heading=secbib] \printbibliography[title = {References}, heading=secbib]