Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
    
You want to mimic <img> HTML tag? –  xport Jan 6 '11 at 10:25
    
What are you hoping to achieve? A tooltip that shows up when the mouse hovers over it? Or something that happens when you compile the document without the files being there? –  frabjous Jan 6 '11 at 16:52
    
yes when the mouse hovers over it. But not using tooltip –  S. Murugan Jan 7 '11 at 6:22
    
@S. Murugan: you’re confusing the alt and the title attribute. alt is displayed if the browser cannot display the image. It is not displayed (except in Internet Explorer) when the mouse hovers over the image. That’s the title tag. –  Konrad Rudolph Jan 7 '11 at 17:13
add comment

1 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.

share|improve this answer
    
Note my answer makes less sense now that the question has changed to discuss title= rather than alt=. :-( –  frabjous Jan 7 '11 at 20:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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