(I hope this is at least marginally on topic)
When I use the <abbr>
tag in HTML, the abbreviation and its expansion are marked by the browser:
But if I mark an abbreviation and its expansion with the accsupp
package like this:
\documentclass{article}
\pdfcompresslevel 0
\usepackage{accsupp}
\begin{document}
Trying out the \BeginAccSupp{method=plain,unicode,E={accessibility
support}}\texttt{accsupp}\EndAccSupp{} package.
\end{document}
then I have yet not found a way to make the expansion text visible in the PDF viewer:
I have looked in the PDF and the BDC
construct looks OK.
The PDF reference only talks about screen readers and such, so maybe this simply isn't meant to be viewed?
Still, I find it strange there should be no means to get at the expansion text from the viewer.
Remark: I've seen the question Are mouse over definitions of acronyms possible? but it deals with explicitly programming tooltips in JavaScript. This would be a last resort for me if I can't find a way to utilise the existing PDF construct.
Update: Let me formulate my question(s) a little broader (and maybe more precise):
- Is there any way to access the expansion text given in the
BDC
construct shown above from a PDF viewer (and if yes, which viewer)? - Which applications are accessing this construct at all? Is there a free screen reader or whatever which would access it?
- How could I validate whether I got this construct technically correct?
- Are there alternatives? What would be the PDF-Standard conforming way to implement HTMLs
<abbr>
tag in PDF (short of JavaScript programming)?
Update 2
With respect to @AlexG's answer, I have now played with the pdfcomment
package, with almost completely satisfying results:
\documentclass{article}
\pdfcompresslevel 0
\usepackage{accsupp}
\usepackage{pdfcomment}
\usepackage{xcolor}
\definecolor{underlinecolor}{gray}{0.9}
\begin{document}
Trying out the \BeginAccSupp{method=plain,unicode,E={accessibility
support}}%
\pdfmarkupcomment[color=underlinecolor,markup=Squiggly,borderstyle=dashed]{\texttt{accsupp}}{accessibility support}%
\EndAccSupp{} package.
\bigskip
Trying out the \BeginAccSupp{method=plain,unicode,E={accessibility
support}}%
\pdftooltip{\texttt{accsupp}}{accessibility support}%
\EndAccSupp{} package.
\end{document}
After looking at the implementation of \pdfmarkupcomment
, I've decided to go with \pdftooltip
. I would prefer also having the possibility to highlight the abbreviated word (like in the HTML display), but \pdfmarkupcomment
uses SOUL, and this is a little insecure to my taste.
Furthermore, I'm still a little disappointed that I didn't find any method to validate whether the BDC
construct produced by accsupp
has any effect at all. I opened the PDF in Acrobat Professional and enabled tagging, but still I could find no trace of the "abbreviation" anywhere.
Best Answer
The
accsupp
package implements the accessibility features defined in the PDF specification IS0-32000, Section 14.9. These features are aimed at improving readability of PDF documents for visually impaired readers and are therefore directed at properly configuring a text-to-speech engine of the target PDF viewer for representing the given content in an audible way.In order to visually display an alternative text, the
pdfcomment
package, and the\pdftooltip
macro thereof could be used. For formatted text, the method suggested in https://tex.stackexchange.com/a/164186 could be an option. It is a JavaScript free, OCG-based (PDF Layers) solution and works in a small number of PDF viewers (including Open-Source Evince). However, the highlighted page content must be clicked to show the alternative text. Mouse-Over/Exit gestures to show/hide the alternative text are also possible (still without using JavaScript) but are AdobeReader-only. For this to work, the line/Subtype/Link
must be commented out in the suggested code and the lines below must be enabled instead.