I was asked a question during a LaTeX how-to session which I did not have a good answer for. The person asking is interested in accessibility software which is able to read LaTeX formatted equations in a meaningful way.


        x^2 + y^2 = z^2

When the document is read by the Okular screenreader, it sounds like:

x two plus y two equals z two

but what we really are showing should sound like:

x squared plus y squared equals z squared

Such accessibility options are available for other equation editors, such as MathJax. This question was asked before, but closed due to unclear questioning. So allow me to produce specific questions:

Is there:

  1. A PDF reader which interprets mathematical conventions such as superscripts and symbols in a mathematically meaningful way?
  2. An external tool which reads equations out loud directly from the LaTeX style?
  3. A tool within LaTeX which can add comments to a PDF versions of the document which are invisible, yet listenable? (similar to alt text in images)
  • 1
    In the core pdf is not accessible. The pdf contains only symbols without mathematical meaning so only rather simple equations are read in a sensible way. It is possible (with tagpdf or Accsup and other packages) to add more info but it unclear if and how screen readers makes use of them and which mark-up they want. My questions to NVDA about this wasn't answered. – Ulrike Fischer Oct 12 '18 at 18:47
  • I've been playing with the pdfcomment package. I can add an alternate version but not turn off the original. – John Kormylo Oct 13 '18 at 13:47
  • 1
    A number of projects have faltered due to poor funding some still standing are MathPlayer and lambdaproject.org both mentioned here researchgate.net/post/… – user170109 Oct 13 '18 at 19:09
  • There are 162 hits on this forum for "to speech" and 688 for "accessibility" however horses for courses if you want pdf readers to hear the true page content I would suggest adding tagged wave files with acrobat – user170109 Oct 13 '18 at 19:41
  • 1
    Documentation for the axessibility package which adds LaTeX code as hidden comments to pdf files suggests that it works with the NVDA and JAWS screen readers. – Matthew Towers Apr 29 '19 at 13:11

Using my new tokcycle package (https://www.ctan.org/pkg/tokcycle )...I find the result pleasingly legible, when read audibly via the Adobe Reader.

This MWE relies on you having a new enough LaTeX installation to support the new \expanded primitive. If not, you can, for the time being, change the \tcremap[x] in the \speakifytext definition to \tcremap[1] and also change the \noexpand\pauseafter (2 instances) to \pauseafter. The net effect of this change is that the token register \cytoks that holds the transformed text, will contain things like \tcmapto^ rather than , raised to the power. That is to say, the transformation occurs when the token register is typeset, rather than before being placed into the token register.

  \expandafter\def\csname tcmapto\string#2\endcsname{\text{#3 }#1}}
  \expandafter\def\csname tcmapto\string#2\endcsname{#3#1}}
\newcommand*\tcremap[2][1]{\ifcsname tcmapto\string#2\endcsname
  \addcytoks[#1]{\csname tcmapto\string#2\endcsname}\else\addcytoks{#2}\fi}
\tcmapto[] ({, left paren,}
\tcmapto[] ){, right paren ,}
\tcmapto   ^{, raised to the power}
\tcmapto   _{, sub}
\tcmaptomacro[] \frac\readfrac
\newcommand\readfrac[2]{\text{, the fraction, } #1 \text{, divided by, }#2%
  \text{, end fraction, }}
\section{Making \LaTeX{} Math Audibly Legible}
We use the new tokcycle package to transform math symbols into spoken text.
See if you agree.
       x_i^2 + y^2 = (z^2 + 1)
Or this one:
       Z = \frac{x+1}{2}

enter image description here

Just remove the two lines, \speakifytext and \endspeakifytext, and recover the original output.

enter image description here

See also this question, which I find related: In which way have fake spaces made it to actual use?

  • This answer has good prospects, but I am having trouble verifying your solution independently. It looks like \speakifytext is not defined in the CTAN version of your package. Is this correct or have I missed something? – WesH Aug 23 '19 at 18:55
  • @WesH \speakifytext is defined in the MWE via \tokcycleenvironment\speakifytext {\tcremap[x]{##1}} {\processtoks{##1}} {\tcremap[1]{##1}} {\addcytoks{##1}} – Steven B. Segletes Aug 23 '19 at 19:00
  • so it is, yet it may be doing something funny to the equation environment. I'm getting multiple undefined control sequences for the math at each -eme so the error text, in order, is: "x_", "x_i^", "x_i^2 + y^", and so on. – WesH Aug 23 '19 at 19:06
  • @WesH Let me download the CTAN version and see if it matches my local version. – Steven B. Segletes Aug 23 '19 at 19:07
  • 1
    The discussion in chat resulted in discovering an error which arises in pdftex versions lower than v1.50. This is an excellent solution to the problem posed by the original question. Please do not be offended if I do not mark the question as "solved" so we invite more potential solutions to be reported. – WesH Aug 23 '19 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.