39

Does anyone know of any LaTeX modules that makes the pdf output generated by pdflatex Americans with Disabilities Act of 1990 (ADA)/Section 508 compliant?

Specifics:

  • With regard to math. One simple solution is to embed the latex equation as an alt tag. Simpler, and IMO better than translating to MathML.

  • With regard to graphics. I use dot to generate the graphics. A simple solution here is to embed the .dot file as an alt tag for the figure.

Is there any way to generate alt tags with pdflatex?

David Hammen
  • 2,029
  • 2
  • Perhaps more detail: – David Hammen May 28 '11 at 12:14
  • 1
    The main concern here is making the contents of a file generated by pdflatex "accessible": Are the contents accessible to a person with disabilities? An image almost certainly is not. A typeset math equation may or may not be. Some PDF readers do a better job than others, but they all stumble on some symbols and on anything but the simplest of typesetting. Superscripts or subscripts ofttimes are not accessible. This article from six years ago gives some background to the problem: http://www.cio-dpi.gc.ca/clf-nsi/inter/inter-01-02_e.asp – David Hammen May 28 '11 at 12:20
  • From what I can see at CTAN, the answer is yes and no. Heiko Oberdiek's accsup module provides "a minimal low-level interface for programmers. Status is experimental." Low-level and experimental: Not quite what I want, but better than nothing. I'll give it a spin. (more...) – David Hammen May 28 '11 at 13:08
  • 2
    My idea is to regurgitate the contents of an equation environment (or similar) as an alt tag in the PDF. An alternative is to translate the latex math to MathML and make that the alt tag. Too much work, and the visually impaired people I work with technically would rather see latex math than MathML as an alt tag.

    As for graphics, there is no generic solution, but for graphics generated from a graphviz file there is a simple answer: Regurgitate the .dot input as an alt tag. That .dot file is after exactly what was used to generate the graphic.

    – David Hammen May 28 '11 at 13:08
  • @David Hammen You can have the reader listen to a description of the equations. I had a post for this http://tex.stackexchange.com/questions/8918/hello-world-in-pdflatex. – yannisl May 28 '11 at 13:14
  • That doesn't quite count as accessibility. Have you observed visually impaired person working with a computer? – David Hammen May 28 '11 at 19:15
  • David, in response to "IMO better than translating to MathML" then I say "IMO not". More seriously, this is a moot point: you will find people arguing both ways very strenuously. All I will say is that I would not want to have to read the raw LaTeX code of any of my equations. – Andrew Stacey May 30 '11 at 20:56
  • @Andrew: I think PDF has better accessibility support than EPUB, and that accessibility experts don't like reflowable text for the partially sighted. David: It is almost certainly possible to supply the equivalent of alt tags for equations, but it might involve hairy metadata hacking. Maybe it be done with hyperref; I'll have a look. – Charles Stewart May 31 '11 at 06:22
  • @Charles: Not got any opinion on formats, just on representations. Whatever the format, I'd rather have the equation in whatever was right for that format rather than as the raw source. I feel (as an author) that I have a reasonable chance at making the output accessible, but not at making the input accessible. – Andrew Stacey May 31 '11 at 07:11
  • Well my first attempt was a failure. I tried adding an alt tag to a figure using Oberdiek's accsup module. It did generate the pdfstring from the provided alt text, but only if I \protected the macros. (Makes sense; floats are fragile). I have yet to attack equations. (Continued) – David Hammen Jun 01 '11 at 01:01
  • I did check with a couple of visually impaired mathematicians I work with, one of whom is the project manager on one of the projects I work on. Both would rather have the latex code rather than MathML. MathML is just as bad as XML with regard to being able to be read by a human. Both are mathematicians: They write math papers, so they grok latex. To them, the latex in which a math paper (and for math papers it is always latex) is written is more readable than the pdf generated from that latex. – David Hammen Jun 01 '11 at 01:05
  • @David: Your sample is extremely biased! When you talk of "accessible mathematics", I thought you meant "accessible to visually impaired people who want to learn some mathematics" not "accessible to visually impaired mathematicians". I would not want to force someone to learn LaTeX just to be able to read mathematics. – Andrew Stacey Jun 01 '11 at 20:24
  • I work on an orbital dynamics package, soon to be CMMI-3. Our target audience for our documentation is technically literate people. The visually impaired people who will be reading our documentation are presumably familiar with LaTeX. That said, go take a look at a wikipedia article on some math-heavy topic. The alt text for equations in wikipedia is a latex math equation. Wikipedia authors uses a subset of LaTeX to write their equations. The alt tag is exactly that LaTeX code that the author wrote. It works. Other sites also use LaTeX as their alt text. – David Hammen Jun 02 '11 at 10:26
  • @David: Point taken. If you know your audience already know LaTeX then that's a special case. I don't consider your Wikipedia argument as very convincing though. The fact that they are still using images for mathematics shows that they don't take accessibility all that seriously as far as mathematics is concerned. What about people who don't need it read but need it significantly enlarged? Anyway, this isn't a great place for such a discussion. Either join me in chat, or join the blindmath mailing list, or there is a blog post on Terry Tao's blog that has some interesting comments. – Andrew Stacey Jun 02 '11 at 12:31
  • Here's something that I wrote about this on the blindmath mailing list which someone thought worth preserving on a website dedicated to accessibility in science: http://www.access2science.com/latex/StaceyLatexNote.html – Andrew Stacey Jun 02 '11 at 12:35
  • @Andrew: The problem with MathML and a player that reads it is that the players are dumb. They kinda know how to read it, but when issues arise, there is no backup except to announce the inherently unreadable MathML itself. The nice thing about LaTeX is that when the reader mumbles or otherwise stumbles, the user can force the reader to slow down, read one character at a time. Another problem of course is how to translate the LaTeX math equation into MathML. If the translation is not automatic it isn't going to happen. – David Hammen Jun 02 '11 at 13:16
  • @David: Then work on making the players smarter! There's been some discussion on this recently on the blindmath website. Translating to MathML is a solved problem; there's tex4ht and itexToMML. Presentational MathML may be more suitable. But I still think that you are confusing LaTeX with a markup language. How is a reader going to cope with \mystrangesymbol^\myothersymbol = \myweirdsymbol? – Andrew Stacey Jun 02 '11 at 13:25
  • The point I'm trying to make is that by putting the LaTeX into alt tags, you are forcing me as an author to think about accessibility when I'm writing the document. I don't want to do that, any more than I want to think about which font I'm using or whether the equation numbers go on the left or the right. Accessibility should be a product of the output, not the input. – Andrew Stacey Jun 02 '11 at 13:26
  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – Martin Schröder Jan 22 '13 at 13:59
  • @AndrewStacey Sorry you though that was taking it completely out of context. I've removed my comment as it probably was too chatty. To clarify: even if the audience is familiar with 'tex and that might be considered a reasonable way of providing an automated alt-text to an equation, I think there is very much a need for an author to actively set the alt text and make it appropriate. There will be times when alt text can be a textual description of the equation, and there will be times when the alt text needs to be a complex equation in MathML. That should be part of the author's role. – Andy Clifton Sep 18 '13 at 15:27
  • 1
    @AndyClifton (I've removed mine as well) I completely agree with you on that. Indeed, my objection is to the suggestion that the TeX that I write be made the alt text. It's just that I was objecting to that as an author, not as a reader. – Andrew Stacey Sep 18 '13 at 18:04
  • @MartinSchröder - It's been a while since I revisited this question. I (reluctantly) accepted one of the answers a while ago. Reluctantly: To me this is not a solved problem. – David Hammen Oct 01 '13 at 12:48
  • 1
    @AndyClifton - One of the many beauties of TeX/LaTeX is that it separates content from appearance. As an author, I shouldn't care how things appear. Making it look nice -- that's the engine's job. Ideally, making it sound nice should also be the engine's job, including equations. In this ideal world, the engine would automagically construct a default alt-text for equations. The author should only need to get involved when that default isn't adequate. – David Hammen Oct 01 '13 at 13:01
  • @AndrewStacey: actually, re: Wikipedia, there are several options; at present, these are "Always render PNG", "Leave it as TeX (for text browsers)", and "MathJax (experimental; best for most browsers)". – SamB Jan 20 '14 at 23:53
  • @SamB Note the dates! My comment about Wikipedia was written in 2011. – Andrew Stacey Jan 21 '14 at 08:02
  • @AndrewStacey: as far as I can remember, they had several options even back then. (I'm pretty sure they used to have MathML instead of MathJax, though.) – SamB Jan 21 '14 at 22:45
  • @SamB Not being an experienced user of Wikipedia, I can only go on what I see. I have seen some pages recently with some form of non-image mathematics, but the majority are still rendering as images and when I wrote that comment then certainly I had never seen a page with mathematics do anything otherwise. – Andrew Stacey Jan 23 '14 at 10:42
  • @AndrewStacey: Yeah, I think it still defaults to PNG, but some people use plain HTML for simple equations for some strange reason. – SamB Jan 23 '14 at 21:04
  • 1
    @AndrewStacey It's been a while since I asked this question (a long, long while), but I finally received an answer that I didn't have qualms accepting. – David Hammen Jan 06 '23 at 01:00
  • Thanks for drawing my attention to it - much appreciated. – Andrew Stacey Jan 06 '23 at 17:16

6 Answers6

17

There is an German Diplomarbeit "Accessibility-Erhöhung von LaTeX-Dokumenten" by Babett Schalitz, written in German language in the year 2007. In English the title is something like: "Better accessibility for LaTeX documents". A German "Diplomarbeit" is more than a bachelor. She wrote a prototype package accessibility.sty. Unfortunatly is the given url http://www.babs.gmxhome.de/da_pdftex/accessibility.sty yet not reachable (the url http://www.babs.gmxhome.de/download/da_pdftex/accessibility.sty works now again, so that the package is downloadable). The link to documentation (the thesis) does not work ...

Mensch
  • 65,388
10

This is not so much an answer to my question as it is a refinement of what needs to be done. It is too long and too heavily formatted to fit in as a comment.

The challenges in making a document accessible are

  • Graphics. Graphics are inherently inaccessible as-is. One way of making a graphic accessible is to provide an adequate description of the graphic in the main body of the document. Another is to provide some alternative text (PDF and HTML both have alternative text capabilities) that somehow make the graphic accessible. While the LaTeX machinery obviously cannot provide that explanatory text, it should provide the authoring tools that enable a document author to provide an alternative explanation.
  • Tables. Tables can be quite accessible as-is. Whether or not they are depends on

    • The mechanism used to create the table: Are the tables typeset by painting the cell contents at a certain place on the page or are they typeset using some construct? (I don't know how pdflatex generates tables. I'll look into that.)
    • Whether the table is overly-tuned for sighted readers. "Professional" tables that use \multicolumn to conjoin columns, extra vertical space to separate items in a table, etc., are visually appealing but are not quite as accessible as plain old vanilla tables.
  • Equations. My thought is to capture the LaTeX code used to make the equation as the alternative text. This is exactly how wikipedia.org makes the mathematical equations in some wikipedia article accessible.
  • Ligatures. This one might well be the toughest challenge of all. Those ligatures on which Knuth spent so much effort come across as an unreadable character in a PDF document generated by LaTeX. The problem I see is that the treatment of ligatures is so very deep inside TeX itself. To solve the problem, words that contain ligatures need to have an ActualText tag that spells the word out as-is in text.
David Hammen
  • 2,029
  • 1
    Regarding ligatures: I sent a request for comments to the authors of JAWS (one of the more popular readers) about how to make ligatures accessible with their software. If I get a response from them, I will ask them to join in on the discussion in this question. – David Hammen Jun 02 '11 at 13:11
  • 11
    This isn't a discussion forum and isn't the appropriate place for such. I think that these matters are extremely important and completely agree that the current state of affairs is inadequate, but here is not the place to discuss that. Here is where to find out what the current state of affairs is (to the best of someone's knowledge), and to find out how to do a particular thing. – Andrew Stacey Jun 02 '11 at 13:22
  • The ligatures as-is text could also fix copying text from pdfs, which copies ligatures right now. – Neil G Aug 06 '12 at 15:55
  • 1
    I thought the problem with ligatures was that PDF and/or PDF readers don't have a concept of ligatures as presentation forms for sequences of characters? At least, I'm not aware of any ambiguous ligatures commonly used with TeX. Hyphenation, on the other hand, I suspect the TeX engine/format itself really would need to supply more information about ... – SamB Jan 23 '14 at 21:10
8

To the best of my knowledge, (1) Ross Moore is working on this and (2) nothing is production ready yet.

but coming soon, it will be. http://www.tug.org/tug2009/preprints/moore.pdf

Update Ross Moore's published paper is at http://www.tug.org/TUGboat/tb30-2/tb95moore.pdf

Andrew Swann
  • 95,762
Tim A
  • 1,945
6

Try the \pdfcomment package. There's an option to add a tool tip to the PDF using \pdftooltip{item}{tooltip}, where the item can be a float (e.g. \pdftooltip{\includegraphics[]{}}{description of my figure}).

The overall process that I've settled on to produce 508-compliant documents is to

  1. Produce a high-quality PDF from LaTeX which includes all of the tooltips
  2. Run the PDF through the tagging tool that is provided by Adobe Acrobat X (Adobe how-to).
Sebastiano
  • 54,118
Andy Clifton
  • 3,699
  • it should be noted that although this method passes automated testing for accessibility, the tags might not have a good structure. – Andy Clifton Nov 18 '14 at 23:56
  • That suggests that if this is not actually accessible because by some measure the structure is not good, doesn't that suggest that whatever automated testing currently is going on is unfinished? Why not build tests that capture the style/structure of a good tag system?

    I imagine that @ttscoff would have some thoughts about this too, given that he's working on a book about tagging systems.

    – mpacer Jun 27 '15 at 09:33
  • Link to the Adobe how-to is now broken. – Spacedman Jul 04 '19 at 12:09
5

The article "Making accessible documents using LaTeX," by Eric Larson and Isabel Vogt, in Notices American Math. Soc. vol 70, no 1, 2023, may be of interest. It seems to be freely available for reading:

https://www.ams.org/journals/notices/202301/rnoti-p68.pdf?adat=January%202023&trk=2606&cat=career&galt=none

murray
  • 7,944
4

Accessible PDF is supposed to be tagged PDF and follow the upcoming PDF/UA standard. There is currently no package or system that generates tagged PDF from LaTeX input I know of. But there is hope: ConTeXt can create tagged PDF.

  • 2
    Yes and no. One example in section 508 of how to make a graphic accessible is to provide a good description of the graphic in the text. If a picture truly is worth 1000 words, there had better be 1000 words somewhere that describe the picture. If that somewhere is in the text of the article, the article is compliant without having to resort to technical means of making the content accessible. That said, I don't want to write a text-based description of every equation I write. – David Hammen Jun 02 '11 at 08:40
  • 1
    Yes, ConTeXt can create tagged PDF. But the tags are not logical. I.e. there are no paragraphs. And what @DavidHammen says is true too. I am not convinced that there will ever be a 100% solution. – tanGIS Apr 13 '20 at 16:24