This page allows you to create a demonstration PDF from a complex two-column LaTeX document including a table of contents, mathematical formulae and theorem, graphics, marginal notes, footnotes, a code display, a bibliography, and generated cross references and citations. To generate Tagged PDF on your own system you’ll need a recent LaTeX distribution.
To enable standards-conforming Tagged PDF output, simply add at the
very beginning of the document, i.e., before \documentclass
, a
\DocumentMetadata
declaration. It takes one argument, a key-value
list.
The first four keys in the document metadata declaration below set
necessary document metadata, including main document language, PDF version and the
ISO-standardized subset(s) of PDF to which the document should comply.
The final tagging-setup
key controls the details of the tagging used:
use Associated Files or Structure Elements for formulas,
and the verbatim-alt
test module (which improves the reading of verbatim code—this is still under development and not yet fully integrated).
LaTeX leverages two distinct options for including MathML in PDF documents that include math formulae.
Both are valid methods (as defined in ISO 32000-2, PDF’s specification), but many reader software applications do not yet fully support these features in PDF 2.0. We hope that more PDF software producers will soon enable access to MathML in PDF files.
At present, the LuaTeX engine can automatically produce MathML tags from LaTeX source and can support either method. pdfTeX only supports the Associated Files method, with the data for the AF files prepared in a separate step.
Simply click the “Generate Tagged PDF” button below the following example code, or edit the example document before generating a PDF. Please keep your example relatively small to avoid overburdening the free service we’re providing here. If you prefer a smaller demonstration file, that’s available.
\DocumentMetadata{
lang = en,
pdfversion = 2.0,
pdfstandard = UA-2,
pdfstandard = A-4,
tagging-setup = {math/setup=mathml-SE, extra-modules={verbatim-alt}}
}
\input{stem-article-2col}
\DocumentMetadata{
lang = en,
pdfversion = 2.0,
pdfstandard = UA-2,
pdfstandard = A-4f,
tagging-setup = {math/setup=mathml-AF, extra-modules={verbatim-alt}}
}
\input{stem-article-2col}
stem-article-2col.tex
as used above)You can edit the document in the box below and then use one of the compile buttons above to see the effects of your changes.
\documentclass[a4paper,twocolumn]{article} \usepackage{unicode-math} \usepackage{graphicx} \usepackage{amsthm} \newtheorem{theorem}{Theorem} \usepackage[colorlinks]{hyperref} \addtolength\marginparwidth{1.3cm} \addtolength\textheight{-5\baselineskip} \addtolength\paperheight{-5\baselineskip} % stub if not tagging \providecommand\tagpdfsetup[1]{} \begin{document} \title{A Two Column Example} \date{2025-03-13} \author{The \LaTeX\ Team} \pagestyle{headings} \maketitle \begin{abstract} An example document showing automatic tagging of typical structures found in a \LaTeX\ document, including titles, sections, theorems, lists, citation lists and mathematics. A two column layout is used, the tagging enables the reading order to correctly follow the flow of text through the columns. \end{abstract} \tableofcontents \section{Introduction} This document shows a typical two-column document incorporating tables, figures and mathematics. Apart from two commands at the start to enable tagging, and a small amount of additional markup to give alternative texts for graphics inclusion, and to specify the heading rows of tables.% \footnote{The current tagging markup for tables is temporary and a new interface for tagging tables will be developed.} The document just uses standard \LaTeX\ markup that would be used in any \LaTeX\ document since the 1980s. \section{Document structures} \subsection{Mathematics} Let $p$ be a prime, then \[n^p=n \mod p\] An aligned set of equations: \begin{align} f(x)&=\sin x + \cos x & f'(x) &=\cos x - \sin x \\ g(x)&=2\cos x & g'(x) &= -2\sin x \end{align} Matrices. \[ \begin{pmatrix}1&2\\3&4\end{pmatrix} \begin{pmatrix}1&1\\0&1\end{pmatrix} = \begin{pmatrix}1&3\\3&7\end{pmatrix} \] \subsection{Lists} Lists often occur in documents. \begin{itemize} \item They may be unordered bullet lists \item Or may be numbered lists. \begin{enumerate} \item lists may also be nested in an outer list \item \label{item-a}items within such a list may be referenced. \end{enumerate} \end{itemize} Here we reference item~\ref{item-a}. \subsection{Figures and Tables} Small images may be shown inline \includegraphics[height=1em,alt=small skull in a diamond]{ghsystem_skull.jpg} and small tables may be shown within the paragraph: \begin{center} \tagpdfsetup{table/header-rows={1,2}} \begin{tabular}{lr} \multicolumn{2}{c}{Example}\\ Name&Value\\ This& 11 \\ That & 2 \end{tabular} \end{center} Larger\marginpar{\raggedright Marginal notes are usually placed in the outer margin.} figures such as Figure~\ref{float} are usually placed in a \emph{float} to be positioned at a suitable place to help with column and page breaking. \begin{figure} \centering \includegraphics[alt=example image A,width=.9\linewidth]{example-image-a} \caption{\label{float}Larger image set as a \emph{float}} \end{figure} \subsection{Theorems} \begin{theorem}[Fermat's last] If $n>2$ Then there are no integers $a$, $b$, $c$ such that $a^n+b^n=c^n$. \end{theorem} \subsection{Verbatim} Some documents require verbatim code blocks to be displayed. \begin{verbatim} main( ) { printf("hello, world"); } \end{verbatim} \section{Citations} It is also possible to cite works from a bib\TeX\ database, here we cite \cite{Knuth:TB5-1-67} and \cite{Hoekwater:TB28-3-312} from the \texttt{tugboat.bib} sample file distributed with bib\TeX. \bibliographystyle{plain} \raggedright \bibliography{tugboat} \end{document}
Your demonstration PDF will, by default, be generated via a standard TeXLive 2025 lualatex-dev
.
Two configurations are provided, they input the same document but differently configure
the way MathML is encoded. The first uses
MathML tags in the output PDF’s tag tree. In the second, LaTeX will instead
associate each math expression in the PDF with an embedded and
associated MathML file. One could edit this example to add math/setup={mathml-AF,tex-AF}
to the tagging-setup
key, and then in addition a file containing the TeX source would be associated with each formula.
The “Generate tagged PDF” button runs (Lua)LaTeX at texlive.net (see texlive.net help). Once the PDF is generated links are provided allowing you to view or download the resulting PDF, or open it at ngpdf.com (see ngPDF help), where the Tagged PDF may be viewed together with an HTML representation derived from the PDF using the MathML associated with each math formula.
These examples run using the texlive.net and ngpdf.com services provided by DANTE and Duallab respectively. Please do not over use the services, they are not set up to process heavy loads but are intended just to run small examples in order to show how to use LaTeX to generate tagged PDF. The submitted TeX source is deleted after the PDF is generated. The generated PDF is deleted after one hour.
To generate Tagged PDF on your own system you’ll need a recent LaTeX distribution.
We’ve made some videos of how various combinations of technology vocalize this document.