Generating accessible PDFs in LaTeX: or how I learned to worry and hate the machinelatex rant
Note: This is a rant. Technical information may be better found in another post. However, I’ve not seen anyone do this, so…
I recently had to submit a PDF to my university for a poster detailing my research this semester. (This research went nowhere, by the way. Unfortunate.) IU requires that all PDFs be accessible, and I have no issues with this at all! I already provide alt-text for all my images that I post on social media, and I even get mildly annoyed at people who don’t; so why would this post even be necessary–
Note: The process of creating an accessible PDF requires the installation of Adobe Acrobat Pro. IU Students and Staff may download the latest version of Adobe Acrobat Pro from IUware.
accessibility package: “can’t you just get it from CTAN?”
The usual response to missing some kind of crucial document feature is to grab some package from
CTAN that automagically (blegh) manages to add the feature to your document. There’s pretty much
only one option on CTAN that does this, called
accessibility. The issue is that
was part of a 2007 thesis, and is explicitly designed for use on very specific document classes that
I’m not using. It was adopted by Andy Clifton and published to CTAN much later, and doesn’t follow
the current PDF accessibility guidelines, doesn’t have all the features required, and also,
according to the author in a Stackexchange post:
Releasing accessibility to CTAN has shown that unfortunately there are now quite some problems with it. When it was developed back in the early 2010s it worked a lot better, and it looks to be very sensitive to developments in other packages. It no longer compiles a basic MWE reliably.
Because of this I no longer think that accessibility is fit for purpose, and I will be contacting CTAN to look into getting it taken off CTAN (if possible).
Unfortunately, there is literally no other option, so broken deathbound package it is! Surely it’ll Just Work(tm), right?
ERROR: Undefined control sequence. --- TeX said --- <recently read> \pdfobj l.33 \pdfobj reserveobjnum%
So it doesn’t work with XeTeX (or LuaLaTeX for that matter), you explicitly have to use PDFLaTeX.
And even when you do, I experienced an error about the PDF version, so I had to explicitly download
accessibility.sty, comment out the line involving
pdfminorversion, and then compile it. By some
magic stroke of luck, it worked.
Verifying the PDF’s accessibility, and character encoding
There’s no way to do this on Linux! I ended up having to RDP into a Windows machine from my uni in
order to get a license for Acrobat (also because I don’t want to run Windows on my laptop). I
dropped the PDF in, and there were numerous things that
accessibility didn’t pick up (although
basic things like alt-text, etc were fine). Acrobat(TM)(R)(C) was able to solve most of these
issues, but there was one issue: character encoding. It wasn’t required by WCAG, though, so I
submitted it anyway.
It got rejected, as my university goes beyond WCAG to passing everything in Acrobat’s test suite.
To fix character encoding, I needed the
fontenc package, which, well, makes sense. I also had to
try a metric ton of fonts (and I can’t use TTF or OTF, as I’m stuck with PDFLaTeX). I ended up using
Regardless, even after changing the fonts and going through all of this, I ended up with character encoding issues, and Acrobat noted that they were on three “words”: all the character λ (lambda) in math mode. I ended up having to replace all instances of λ with the literal word “lambda”, and then my character encoding issues were fixed. At this point, I was so tired I just took my losses.
TL;DR: How to generate an accessible PDF in LaTeX
Quit while you’re ahead. I’m so tired.
I have no issues with making accessible content. I have a lot of issues with using broken packages from 2007 and proprietary software to do it.