# Can we get maths in PDFs that can be copy-pasted and screen-read?

Mathematics in PDFs can be cumbersome for any purpose but reading or printing. In particular, copying mathematics in order to use it in another document, and screen-reading for visually impaired consumers.

Both issues can be solved using the accsup package; see

Since both solutions use the same mechanism, it is not clear how to achieve both at the same time, or if that is even possible.

Can we annotate formulae in PDFs so that they can be copy-pasted nicely and read by screen-reading software?

• Actually, formulas which are typeset using unicode-math, can be copied and pasted pretty well. – Sergei Golovan Feb 8 '17 at 7:48
• Only an idea: What about annotating MathML formulars? – Schweinebacke Feb 8 '17 at 7:51
• You mean, using accsup to annotate formulae with their MathML equivalent? That would not really solve bullet one (but solve another problem, I guess), and I don't know if it solves bullet two. Do screen readers deal well with MathML? – Raphael Feb 8 '17 at 7:56
• thanks for raising this concern. one thing that this will require in any event is for the author of the document both to be aware of the problem and to care. there's a significant lack of either concern in the author community, from my observation. suggestions for consciousness raising welcome. – barbara beeton Feb 8 '17 at 14:12
• @barbarabeeton As for the (La)TeX community, easy tools and exposure to them through, say, TUG articles can help. We can do little to raise awareness with authors, though; that's a job for groups representing those who are impaired in some way. (I note again and again with some anger that not even red-green blindness is considered by default, neither by authors nor package maintainers. Default plotting colors, anyone?) – Raphael Feb 8 '17 at 14:27

I use my answer at the OP's cited link, In which way have fake spaces made it to actual use?, to embed the detokenized math for copy/pasting. In addition, here, I use the pdfcomment package to add textual comments with the \copypaste invocations. The Acrobat pdf accessibility reader will read out loud the contents of the sticky notes (though the order of reading may be a bit strange). However, the sticky notes will not affect the copy/paste of the file.

\documentclass{article}
\usepackage{accsupp,pdfcomment}
\newcommand\copypaste[2]{%
\BeginAccSupp{method=escape,ActualText={\detokenize{#1}}}%
\pdfcomment{#2}#1%
\EndAccSupp{}%
}
\begin{document}
What I have is \copypaste{$x^2 + y^2 = z^2$}{Pythagorean formula} and
\copypaste{$\frac{1}{2}$}{a fraction}.
Try to copy/paste me.
\copypaste{$y = \frac{\cos{x}}{1+\cos{x}}$}{A display style trigonometric equation}
\end{document}


• Sweet! For a one-size-fits-all PDF we'd want to hide the comment bubbles, I guess. – Raphael Dec 20 '17 at 15:57
• @Raphael Yes, I haven't quite figured out how to do that, though the package documentation will allow them to be placed in the margins if that would help. – Steven B. Segletes Dec 20 '17 at 16:41