Accessibility in the LATEX kernel — experiments intagged PDF
Chris Rowley Ulrike Fischer
LATEX3 Team

August 2019, TUG Meeting — Palo Alto, USA

Accessibility in the LATEX kernel — experiments in tagged PDF
Chris Rowley, Ulrike Fischer

LATEX3 TeamOutline of talkI Accessibility of PDF
I “tagging” pdf: micro-introduction to the internals of a pdf file
I Experimental package: tagpdf
I Current status
I Future work

Accessibility in the LATEX kernel — experiments in tagged PDF
Chris Rowley, Ulrike Fischer

LATEX3 Team

Accessible pdfStandards
I PDF 1.7: equivalent to an ISO standard
I The PDF/UA: restrictions for Accessibility
I PDF 2.0: an emerging standard
PDF/UA mandates:
I “Tagged pdf”, with two major components:
I A Structure Hierarchy . . . like LATEX(or Context, or HTML, or even MS-Word if used correctly)
I The text/content streams (from classic PDF):“formatted content” plus, for tagged pdf,
. . . “marked content” sections
I The links:
from the Structure Elements in the Structure Hierarchy
tothe relevant bits of “marked content”
Accessibility in the LATEX kernel — experiments in tagged PDF
Chris Rowley, Ulrike Fischer

LATEX3 TeamMore important stuff: not in this talk
PDF/UA standard also requires, for example:
I Unicode mapping: Font slots 7→ Unicode slot
I document metadata in pdf file
I math, images, etc: “alt-text”
I specifies treatment of links (in tagpdf package)
I many design- and code-level “implementation details”
I detailed requirements of pdf,
— such as an explicit char 32 (space) to delimit words
Many other issues, for example:
I reflowing (very important for small screens)
I Math . . . Nothing in this talk! << SMILEY >>Accessibility in the LATEX kernel — experiments in tagged PDF
Chris Rowley, Ulrike Fischer

LATEX3 Team

Structure of a pdf file

I Everything is . . . PDF Objects !
I Examples of important objects:
I dictionaries: key-value (property) lists
I text stream (within each page)
I structure tree: nodes (NodeObj) are either
I root node
I structure element (node of tree):dictionary object containing refs to other nodes, parent
I leaf nodes contain references, where each ref is to:— a page— a “marked part” of its text stream

Accessibility in the LATEX kernel — experiments in tagged PDF
Chris Rowley, Ulrike Fischer

LATEX3 Team

Tagging code – add Marked Text within text stream ofpage
For Reference Only!
stream/H <<MCID 0>> BDC
BT/F17 14.3462 Tf 124.802 706.129 Td [(0.1)-1100(Section)]TJET
EMC/P <<MCID 1>> BDC
BT/F15 9.9626 Tf 0 -21.819 Td [(hallo)]TJET
EMC/Artifact <</Type /Pagination>> BDC
BT
169.365 -593.872 Td [(1)]TJET
EMCAccessibility in the LATEX kernel — experiments in tagged PDF
endstream
Chris Rowley, Ulrike Fischer LATEX3 Team

Tagging code – add Marked Text within text stream ofpage
For Reference Only!
stream/H <<MCID 0>> BDC
BT/F17 14.3462 Tf 124.802 706.129 Td [(0.1)-1100(Section)]TJ
ET
EMC/P <<MCID 1>> BDC
BT/F15 9.9626 Tf 0 -21.819 Td [(hallo)]TJET
EMC/Artifact <</Type /Pagination>> BDC
BT
169.365 -593.872 Td [(1)]TJET
EMC
Accessibility in the LATEX kernel — experiments in tagged PDF
endstream
Chris Rowley, Ulrike Fischer LATEX3 Team

Tagging code – add structure objects with references
to Page Objects and Marked Text
For Reference Only!
1 0 obj<< /Type /StructTreeRoot /K 4 0 R/ParentTree 2 0 R /RoleMap 3 0 R>>
endobj
4 0 obj<< /Type /StructElem /S /Document /P 1 0 R/K [5 0 R 7 0 R]>>
endobj
5 0 obj<< /Type /StructElem /S /H1 /P 4 0 R/K <</Type /MCR /Pg 6 0 R /MCID 0>>>>endobj
7 0 obj<< /Type /StructElem /S /P /P 4 0 R/K <</Type /MCR /Pg 6 0 R /MCID 1>>>>endobjAccessibility in the LATEX kernel — experiments in tagged PDF
Chris Rowley, Ulrike Fischer

LATEX3 Team

Tagging – structure tree nodes with refsroot (obj 1)
document (obj 4)
section (obj 5)

paragraph (obj 7)

PageObj 6 >> MCID 0

PageObj 6 >> MCID 1

Accessibility in the LATEX kernel — experiments in tagged PDF
Chris Rowley, Ulrike Fischer

LATEX3 TeamCurrent work: package
Experimental package: tagpdf
I uses existing “hooks” etc.
I contains code basis for some “kernel stuff”
I Experimental !!
. . . So it needs experimenters:
I author users:
what is really needed in an accessible doc?
I package maintainers/writers:
what is needed to make conversion of a
package as easy as possible?

I Purposes:
I allow experiments to identify problems of tagging
and the other accessibility requirements
I experiment with code basis for expl3 / latex kernel
Accessibility in the LATEX kernel — experiments in tagged PDF
Chris Rowley, Ulrike Fischer

LATEX3 TeamCurrent status: packageFeatures:
I Provides low-level mark-up commands to:I add structure element nodes to the structure tree
I add “marked content” tags to the content stream
I add to the structure tree nodes all the pointers to the marked
content associated to that node

I Sets up links as required
I Supports the input of document metatdata

Accessibility in the LATEX kernel — experiments in tagged PDF
Chris Rowley, Ulrike Fischer

LATEX3 Team

Package Features (Contd)
I Usage: very good documentation in tagpdf.pdf,
Including:
I lists of known problems and future work;
I descriptions of how pdf works
I How to ask questions, via Github!
I Feedback, lots please!

I Engines status:
lualatex Works okay:
the documentation in tagpdf.pdf has beentagged with it and Ulrike writes that‘the result is not perfect but it passes validation’
pdflatex Currently, manual intervention is needed at
page breaks
Accessibility in the LATEX kernel — experiments in tagged PDF
Chris Rowley, Ulrike Fischer

LATEX3 TeamInto the kernel: automation support
I In the “dev” branch only!!
I Current work needs “hooks”, “configuration points”:
I all “mark-up” needs them: sections, section-heads, lists/items,
toc entries, +++ !!
— in kernel + in all packages
I “internal processes”, such as tabular or page-makeup, alsoneed them
I Use Author’s “LATEX document tags”:
needs rolemap, parenttree, etc . . .
I methods for adding tagging information when declaring anddefining environments(and “structure commands”)

I Automate insertion of “marked content” into text streams:
I identification problems;
I line- and page-break problems.
Accessibility in the LATEX kernel — experiments in tagged PDF
Chris Rowley, Ulrike Fischer

LATEX3 TeamFuture work
Still working to find more/better solutions, in areas such as:
I how to tag “paragraphs” and similar structures,and elements “within paragraphs”
I remove the need for two-passes when using current PDFtex
engine (use TEX’s marks?)
I compatibility with existing packages that extend thepossibilities
to produce pdf material
I document core data (language, pdf version, pdf standard, . . . )must be declared in a well defined place, and very early:— Before the “documentclass line” in a well defined place

Accessibility in the LATEX kernel — experiments in tagged PDF
Chris Rowley, Ulrike Fischer

LATEX3 TeamThe EndI Summary
I Call for ideas, experimenters for package
I Collaboration with Adobe
I Thanks to TUG and DANTE,. . . and to everyone for listening!

Accessibility in the LATEX kernel — experiments in tagged PDF
Chris Rowley, Ulrike Fischer

LATEX3 Team