13

(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:


enter image description here


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:


enter image description here


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):

  1. 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)?
  2. Which applications are accessing this construct at all? Is there a free screen reader or whatever which would access it?
  3. How could I validate whether I got this construct technically correct?
  4. 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}

enter image description here

enter image description here

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.

9
  • 1
    It seems that all facilities outlined in Section 14.9 of ISO32000 (language, alternative descriptions, replacement text, expansions) are directed to using a text-to-speech engine, and not to allow for alternative visual representations of page content.
    – AlexG
    May 19, 2014 at 7:39
  • @AlexG Is there some other PDF construct (short of JavaScript) to emulate <abbr>? May 19, 2014 at 7:54
  • 1
    A JavaScript free solution, based on OCGs and which works in AR and Evince: tex.stackexchange.com/a/164186. The acronym must be clicked, though, to show the expansion. The Mouse-Over/Exit version (no click required) is AR-only, but is still JavaScript-free: Comment out the /Subtype/Link line and enable the commented lines below.
    – AlexG
    May 19, 2014 at 8:22
  • 1
    I will do that asap.
    – AlexG
    May 19, 2014 at 8:40
  • 1
    @StephanLehmke Maybe a bit late, but \pdftooltip just boxes any material (text, graphic, ...) and just uses the size and position to calculate where to place the tooltop. If want to have light gray underline, you are free to do it on your own, e.g. in \myulpdftt!
    – Josef
    May 21, 2014 at 9:45

1 Answer 1

7

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.

1
  • Thank you! This sounds like a final word on the matter :-) Still I'll wait a while with accepting to see if any second opinion crops up! May 19, 2014 at 13:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .