LaTeX → Tagged PDF

LaTeX → Tagged PDF

This page documents a workflow for producing tagged PDF documents from LaTeX source files.


1. Set Up Your Document Once

By setting up your preamble in a certain way, you can ensure that all of your math notation is represented/embedded as MathML for accessibility, with no changes to your writing.

1.1. Required: Use LuaLaTeX and TeX Live 2025 or Later

LuaLaTeX is the only engine that can automatically generate MathML for equations and integrate it into tagged PDFs. Other engines such as pdfLaTeX require manual MathML files or fallback methods. LuaLaTeX exists in previous versions of TeX Live, but accessibility features are fragmented and require workarounds.

Visit the TeX Users Group website to download TeX Live.

Screenshot of TeX Shop showing engine selection
Selecting LuaLaTeX in TeXShop (TeX Live)

1.2. Add document metadata and enable tagging

Paste the code below before anything else, including your documentclass.

\DocumentMetadata{ lang = en-US, tagging = on, tagging-setup = {math/setup=mathml-SE} } \tagpdfsetup{math/alt/use}

1.3. Add packages if needed

Depending on what is in your document, add:

\usepackage{graphicx} % If you have figures. Required to include images; supports alt text with tagging. \usepackage{hyperref} % If you have links or headings. Creates link objects, PDF bookmarks, and navigation.

2. Writing Habits

A few changes to your TeX authoring habits will ensure maximum benefit from the tagging functionality.

2.1. Use structural commands

Use semantic commands, not manual formatting:

  • \section, \subsection, \subsubsection, not \textbfor \Large

  • \begin{itemize}/ \begin{enumerate}, not manual dashes or numbers.

  • \title{} and \maketitle

2.2. Add alt text for images

Use the graphicx package and provide alternative text. If your image is decorative, mark it as an artifact.

\includegraphics[width=\linewidth,alt={Graph of y equals x squared showing upward curve}]{graph.png} \includegraphics[width=.5\linewidth,artifact]{sillypicture.png}

2.3. Format tables properly

If your table is a data table, meaning that there is a consistent relationship across rows and each cell’s meaning depends on its column header, then you should tag your first row as a header row.

\tagpdfsetup{table/header-rows={1}} \begin{tabular}{l|r} Item & Quantity \\\hline Desks & 40 \\ Chairs & 45 \end{tabular}

Other “rules” for tables:

  • Use tables only for structured data, and avoid using tables for layout if possible.

  • Keep tables simple (avoid merged cells and nested tables)

  • Ensure content is readable from left to right, top to bottom.

2.4. Write clear link text

Make link text descriptive and self-contained.

\href{https://www.latex-project.org}{LaTeX Project website} % Displays "LaTeX Project website" \url{https://example.com} % Displays raw HTML

2.5. Use color carefully

  • Ensure sufficient contrast between text/foreground and background.

    • You want a contrast ratio of 4.5:1. You can test colors you are already using via WebAIM Contrast Checker.

    • There are a variety of tools that can help you generate a new high-contrast palette.

  • Do not rely on color alone to convey meaning. Use labels, patterns, or text in addition to color.

Two graphs of regions comparing opacity-based shading vs. pattern-based encoding
Opacity-based shading vs. pattern-based encoding.

Download example: Compile with LuaLaTeX.


3. Check Your Output

Recommended for verification. Required if the document is shared publicly or used in instruction.

  • Export the PDF

    • Compile with LuaLaTeX

    • Confirm no errors or missing elements

  • Run an Accessibility Checker. Recommended tools:

    • Ally (Canvas integration): Fast, high-level feedback that flags common issues like images, structure, and contrast.

    • Adobe Acrobat Accessibility Checker: More detailed, PDF-focused feedback. Inspect tags, reading order, and document structure.


4. Sample Document


5. Further Reading

https://esail.tamu.edu/faculty-tutorials/accessible-latex-pdf-ua-2-overleaf-2025/
Creating Accessible LaTeX PDFs: PDF/UA-2 Compliance in Overleaf (December 2025) - eSAILEssential guide for academics to generate accessible PDF/UA-2 documents from LaTeX (Overleaf), covering crucial preamble, package, and element-tagging configurations for accessible math.
https://docs.overleaf.com/writing-and-editing/creating-accessible-pdfs
Creating accessible PDFs in LaTeX | Overleaf docsThis page describes LaTeX accessibility in Overleaf and relevant considerations.
https://latex3.github.io/tagging-project/
mathematics computation
The LaTeX Tagging ProjectCentral hub for the LaTeX Tagged PDF project, providing documentation, guidelines, and status tracking for producing accessible, tagged PDFs with LaTeX.
https://webaim.org/articles/contrast/
assorted-color smoke
LABEL
Contrast and Color AccessibilityUnderstanding WCAG 2 Contrast and Color Requirements