# Lightbox in Latex

Is there a package or simple code for a lightbox in LaTeX? (I'd like to display the solutions of some math problems in a clever way.)

Could hyperref be used to prompt a small pdf or jpeg and have it be overlaid on the original pdf document (without the lightbox effect)?

-
For the second cuestion , the fancytooltips or cooltooltips packages could be useful. –  Gonzalo Medina Jun 12 '11 at 0:07
Excellent! Thanks. ;) –  user02138 Jun 12 '11 at 0:32

The fancytooltips of cooltooltips could be useful. A little example using fancytooltips:

First you need to create a .pdf file containing the \keytips commands (one \keytip per page) and the text for the tooltips that will be used by the fancytooltips package. To create this .pdf document you can use LaTeX: in this example I used a file (called soltips.tex) having the following aspect

\documentclass{article}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage[createtips]{fancytooltips}
\usepackage{framed}

\begin{document}

\keytip{factorx}
\begin{align*}
8x^2 - 32 &= 8(x^2 - 4) \\
&= 8(x - 2)(x + 2).
\end{align*}

\newpage

\keytip{factora}
\begin{align*}
a^2 + 8a + 16 &=  a^2 + 8a + 4^2 \\
&= (a + 4)(a + 4) \\
&= (a + 4)^2.
\end{align*}

\end{document}


Compile this file in the standard way to generate the file soltips.pdf containing the solutions, one on each page, nicely shaded, and with their corresponding \keytip command. The resulting .pdf file has to be in the same directory containing your main .tex file (the one containing the problems).

Now, your main document containing the problems has to be something like the following (note that the value for the filename key is exactly the name of the .pdf file obtained in the previous step):

\documentclass{article}
\usepackage{amsthm}
\usepackage{xcolor}
\usepackage[filename=soltips,mouseover]{fancytooltips}

\theoremstyle{definition}
\newtheorem{prob}{Problem}

\begin{document}

\begin{prob}
Factor $8x^2 - 32$.
\end{prob}
\noindent\tooltip{Solution}{factorx}

\begin{prob}
Factor $ax^2 + 8a + 16$.
\end{prob}
\noindent\tooltip{Solution}{factora}

\end{document}


Compile this file in the standard way and you'll see your solutions with a blue balloon; if you move the mouse pointer to the active area, a tooltip will open displaying the corresponding answer.

Some remarks:

1) Of course, you can obtain fancyer tooltips by changing the aspect of the solutions in the file soltips.pdf.

2) This approach doesn't work in all PDF viewers, since it requires cooperation with JavaScripts; you have to use Adobe Reader or Adobe Acrobat to see the tooltips.

-