7

Is there a way to load a hidden image into a pdf output document that will show up when the user moves the cursor over a relevant piece of text?

E.g., a pdf file generated by tex contains

this arbitrary block of text

and when you move your cursor over it, a picture appears near the cursor.

11

You can use fancytooltips; this requires Acrobat Reader to work. A little example:

Create a file image.tex like this:

\documentclass{article}
\usepackage{graphicx}
\usepackage[createtips]{fancytooltips}

\begin{document}

\keytip{a}{\includegraphics[height=4cm]{example-image-a}}
\clearpage

\end{document}

process this file to get a file image.pdf. In the same folder, create another file (the "main" file), like this:

\documentclass{article}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage[filename=image,mouseover,noextratext,movetips]{fancytooltips}
\usepackage{lipsum}% just to generate text for the example

\begin{document}

\lipsum[4]
\tooltip{this is the designated text}{a}
\lipsum[4]

\end{document}

The string used for filename has to be the same as the name of the pdf file containing the tooltip. Process this document; when you hover over this is the designated text the image will appear in a tooltip.

An image of the resulting PDF file with the cursor away from the designated text:

enter image description here

and an image once the cursor hovers over the text:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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