[Tex/LaTex] Hover text for images in LaTeX using pdfLaTeX


How to put a hovering title text for images (like the title attribute in HTML <img> tags) in LaTeX file using pdfLaTeX?

Best Answer

PDF viewers are not web browsers. There is no builtin reaction to a mouse hovering over an image, or a special tag or code to insert what it should show when it does.

Heck, even web browsers aren't required to exhibit this behavior. ALT text derives from the early days on the web when some web browsers couldn't show graphics, or people on slow connections turned them off; it put something in place of the images. It is retained, I think, mainly for visually impaired people who use text to speech technology to get information from webpages. The tooltip behavior is just a convention certain browsers adopted to make this text available even when graphics were possible. The w3's spec of the alt text attribute says nothing about tooltips.

If you want to replicate this behavior, you'll have to use a tooltip package like fancytooltips or cooltooltips. However, because the behavior is replicated using JavaScript, it'll only work in PDF viewers which suppport JavaScript, like Adobe Reader and Acrobat. (Even some users of these problems turn off JavaScript for security reasons.)

If instead you're aiming at a visually impaired audience, I would just put a text caption on the image.