Jump to content

Accessible LaTeX

From Swarthmore Knowledge Base

Accessible LaTeX

It is possible to create accessible documents using LaTeX. The key is to make tagged files, which means the output contains a structure including headings, lists, tables, math equations, alternative text for images, and metadata for title and language. The structure allows assistive technology to properly navigate and read the file.

Setup

The most straightforward setup is to use a newer LaTeX install (2026 or later) and set LuaLaTeX as the compiler.

Add \DocumentMetadata

At the very top of the document, add the following:

\DocumentMetadata{
  lang=en-US,
  tagging=on,
  pdfstandard=ua-2,
  tagging-setup={
    math/setup=mathml-SE
  }
}

This tells LaTeX to:

  • Set the language metadata to US English.
  • Use tagging (structure) for the output.
  • Output to PDF/UA-2 (PDF 2.0 for Universal Accessibility). This allows inclusion of MathML in a PDF.
  • Embed the structured math within the document.

Add Table Headings

Adding \tagpdfsetup{table/header-rows={1}} ensures that the first row of a table is labeled as a header row.

\begin{table}[htbp]
  \caption{Values of $f(x) = x^2$}
  \tagpdfsetup{table/header-rows={1}}
  
  \begin{tabular}{cc}
    \toprule
    \textbf{$x$} & \textbf{$f(x)$} \\
    \midrule
    $1$ & $1$ \\
    $2$ & $4$ \\
    \bottomrule
  \end{tabular}
\end{table}

Adjust as needed for multiple row and column headings.

\tagpdfsetup{ table/header-rows={1, 2}, table/header-columns={1} }

Use Sections

Use sectioning commands (e.g., \section, \subsection, \chapter) to define the structure of your document instead of just using a larger font size.

Add Alternative Text to Images

For images, include alt text with a description of the image.

\includegraphics[height=4cm,alt={Front view of Parrish Hall, Swarthmore College}]{parrish.jpg}

For purely decorative images, use the artifact option.

\includegraphics[artifact]{squiggle.jpg}

Alt text guidelines from math professor Timothy Prescott of University of North Dakota.

PDF Output

For PDF output, compile your LaTeX as normal using the setup described above (new LaTeX install and LuaLaTeX compiler).

HTML Output

For HTML output, the easiest method is to use Overleaf and export the file as HTML (Download > Export as HTML). Overleaf uses a program called Pandoc to convert LaTeX to HTML. It works well for simple LaTeX but may not produce the expected results if using complex content or less common packages.

Limitations

  • Currently, support for MathML in PDF/UA-2 varies depending on the screen reader:
    • best with NVDA
    • experience may vary with JAWS
    • Voice Over, Windows Narrator, and Adobe Read Out Loud do not work yet
  • Many accessibility checkers don't support PDF/UA-2 yet.
  • Not all LaTeX packages support tagging.
  • Accessibility options increase LaTeX compilation time. If this is a problem, turn off tagging in \DocumentMetadata while working, and turn it back on for the final output.

Accessible LaTeX Resources