logo

LaTeX Tagging Project

Tagging Examples

Generic example

Configuration of headings

Tagging of graphics

Tagging of tables

Tagging of math

Checking the package status

Parent-child warnings

Unbalanced para structures

Still open structures

This page allows selected LaTeX tagging examples to be processed with LaTeX to produce PDF which may then be viewed or validated to the PDF/UA-2 accessibility standard.

Validation is provided by the open source veraPDF validator hosted at texlive.net and by the LaTeX project show-pdf-tags validation hosted on the same server. A link is provided to open the generated PDF at ngPDF. ngPDF is provided free of charge by its authors.

The examples are presented in an online editor to allow you to experiment and change the examples. The resulting TeX files are not stored and all generated PDF are deleted from the server after an hour. The current public release of lualatex-dev from TeXLive is used to process all examples.

1. Generic example

% !TEX lualatex-dev
\DocumentMetadata{
 tagging=on,
 pdfstandard=ua-2,
 tagging-setup={math/setup=mathml-SE} %or mathml-AF
}
\documentclass{article}
\usepackage{unicode-math}
\title{Tagging Prototype}
\begin{document}

\section{Example}
Some text
\begin{itemize}
\item one
\item two
\end{itemize}
\[
ax^2+b^x+c=0
\]
\end{document}

2. Configuration of headings

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

\documentclass{article}
\usepackage{lua-unicode-math}
\usepackage{xcolor}
\usepackage{hyperref}

\title{Configure headings}

\EditInstance{heading}{section}{heading-decls=\color{red}}

\begin{document}
\section{A duck}

\section
  [
    placement    =top, %at top of page
    number-format=\fbox{\theheading},
    prefix       =Part~,
    title-decls  =\scshape,
    toc          =TOC,
    bookmark     =BOOKMARK
  ]
  {The Bear}


\end{document}


3. Tagging of graphics

Graphics can be

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

\documentclass{article}
\usepackage{lua-unicode-math}
\usepackage{graphicx,tikzducks,hawkdraw,todonotes,pdfpages}
\usepackage{lettrine}
\usepackage[skip=2\baselineskip]{parskip}

\title{Tagging of graphics}
\begin{document}

A graphic with an alternative text: 
\includegraphics[alt=a duck,width=2cm]{example-image-duck}

\includegraphics[actualtext=A,height=2\baselineskip]{example-image-a}
 graphic representing a text

A hidden graphics (artifact) \includegraphics[artifact,width=1cm]{example-image}

\lettrine[image=true,actualtext=I]{letter-I}{t is a truth universally} acknowledged, that a single man in possession of a good fortune, must be in want of a wife.

\begin{hawkdraw}[alt=a circle]
\fill[color fill={blue}](0cm,0cm) circle[radius={0.5cm}] ;
\end{hawkdraw}

\tikz[alt=A duck]{\duck}

Most graphic packages now support the keys \texttt{alt}, \texttt{actualtext} and \texttt{artifact}\todo{Check that!}

\includepdf[pages=1,alt=A duck]{example-image-duck}
\end{document}


4. Tagging of tables

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

\documentclass{article}
\usepackage{graphics}
\usepackage{lua-unicode-math}

\title{Tagging of tables}

\begin{document}

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

\begin{tabular}{llll}
  &               &\textbf{Lemon} & \textbf{Banana} \\\hline 
\tagpdfsetup{table/multirow=3}%
\raisebox{-1.5\normalbaselineskip}[0pt][0pt]{\rotatebox{90}{\textbf{data}}}  
  &\textbf{Color} &   red         & yellow    \\
  &\textbf{Flavor}&  \multicolumn{2}{c}{sweet} \\ 
  &\textbf{Form}  &  round        & curved
\end{tabular}

% later perhaps 
%\begin{tabular}[header-rows=1,header-columns=1]{lll}
\end{document}


5. Tagging of math

% !TEX lualatex-dev
\DocumentMetadata
  {
    lang=en-US,
    pdfstandard=ua-2,
    tagging=on,
    tagging-setup={math/setup=mathml-SE}
  }
%\tagpdfsetup{math/alt/use} % alt text, not recommended!
\documentclass{article}
\usepackage{lua-unicode-math}

\title{Tagging of Math}

\begin{document}
\section{Quadratic Formula}
The solutions to $ax^2+bx+c=0$ are
\[
x=\frac{-b \pm \sqrt{b^2-4ac}}{2a}
\]

\section{Arithmetic}
Absolute values.
\[ \lvert -1\rvert = 1 \]


\section{Matrix Multiplication}
\[
  \begin{pmatrix}
    1&2\\3&4
  \end{pmatrix}
  \begin{pmatrix}
    1&1\\0&1
  \end{pmatrix}
   =
  \begin{pmatrix}
    1&3\\3&7
  \end{pmatrix}
\]


\section{Simultaneous Equations}
The equations
\begin{align}
  2x+y&=3\\
  x-y&=0
\end{align}
have solution $x=y=1$.
\end{document}


6. Checking the package status

\DocumentMetadata{
 tagging=on,
 check-tagging-status
}
\documentclass{article}
\usepackage{titlesec}
\usepackage{listings}

\title{Tagging status}
\begin{document}
bla bla 
\end{document}

7. Parent-child warnings from faulty nesting of structures

The nesting of structures has to comply to parent-child rules declared in ISO/TS 32005. The code warns if it detects a faulty nesting.

%

\DocumentMetadata{
 pdfstandard=ua-2,
 tagging=on,
 tagging-setup={math/setup=mathml-SE},
 lang = en,
 }
\documentclass[acmsmall]{acmart}

\setcopyright{acmlicensed}
\copyrightyear{2018}
\acmYear{2018}
\acmDOI{XXXXXXX.XXXXXXX}

%% These commands are for a JOURNAL article.
\acmJournal{JACM}
\acmVolume{37}
\acmNumber{4}
\acmArticle{111}
\acmMonth{8}

\begin{document}

\title{The Name of the Title Is Hope}

\author{Ben Trovato}
\authornote{Both authors contributed equally to this research.}%<-------
\email{trovato@corporation.com} 
\orcid{1234-5678-9012}
\author{G.K.M. Tobin}
\correspondingauthor
\authornotemark[1]
\email{webmaster@marysville-ohio.com}
\affiliation{%
  \institution{Institute for Clarity in Documentation}
  \city{Dublin}
  \state{Ohio}
  \country{USA}
}


\begin{abstract}
  A clear and well-documented \LaTeX\ document is presented as an
  article formatted for publication by ACM in a conference proceedings
  or journal publication. Based on the ``acmart'' document class, this
  article presents and explains many of the common variations, as well
  as many of the formatting elements an author may use in the
  preparation of the documentation of their work.
\end{abstract}


\received{20 February 2007}
\received[revised]{12 March 2009}
\received[accepted]{5 June 2009}

\maketitle


\section{Introduction}
ACM's consolidated article template, introduced in 2017, provides a
consistent \LaTeX\ style for use across ACM publications, and
incorporates accessibility and metadata-extraction functionality
necessary for future Digital Library endeavors. Numerous ACM and
SIG-specific \LaTeX\ templates have been examined, and their unique
features incorporated into this single new template.


\end{document}
%

8. Errors from unbalanced para structures

Paragraphs are automatically tagged, but not every \par should lead to a structure so the code suppresses the tagging in a number of places. The code errors if this leads to an inconsistent number of begins and ends of paragraph structures.

\DocumentMetadata{
 tagging=on,
 pdfstandard=ua-2,
 check-tagging-status
}
\documentclass{article}

\usepackage{listings}

\title{Listing Examples}
\begin{document}

\section{Python code}

\begin{lstlisting}[language=python]
import os
os.listdir()
\end{lstlisting}

\end{document}

9. Warnings about still open structures

% !TEX lualatex-dev
\DocumentMetadata
  {
    lang=en-US,
    pdfversion=2.0,
    pdfstandard=ua-2,
    tagging=on,
  }

\documentclass{article}

\usepackage{moreverb}

\title{moreverb tagging test}

\begin{document}

\begin{listing}{1}
&*( <{^_ a	bc
\end{listing}

\end{document}