# Mouseover events in beamer: hovering on \eqref and a comment containing the original equation popping up

This idea came into my mind while I was listening to a speaker presenting his results in a seminar, he used lots of equation references in his later slides, however I can't remember which equation he was referencing to for he gave several models during an earlier stage of the presentation.

We could use hyperref to get hyperlinks on the \eqref, but clicking it would go back to the original page where the equation was labeled, and somehow interrupt the presentation.

I have several workarounds in mind: (1) exploit the \pause option as the overlay, once hitting space, the referenced equation would show. (2) use tikz to insert a minipage into the frame that contains the referenced equation.

However, both solutions require the referenced equation taking up spaces in the current slide the presenter is on, the best solution is still I said in the question title: mouse over the \eqref number, then a comment popping up showing the equation.

My google-fu leads me to a package called comment, however I didn't find any nice examples of how to use that package to produce beautiful slides.

Hence I wonder is it possible to produce some mouseover events like the title said, or any other workarounds are welcome too.

-
Good question, will be intresting, if someone knows how to solve it. In my edit I deleted your "Thanks in advance". While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. –  Kurt Nov 11 '12 at 23:13
The package fancytooltips may be of interest. Related: fancytooltips –  Qrrbrbirlbel Nov 12 '12 at 0:46
@Kurt Thanks Kurt, also I added the fancytooltips tag. –  Shuhao Cao Nov 13 '12 at 17:38
@Qrrbrbirlbel Thanks! Tag added. –  Shuhao Cao Nov 13 '12 at 17:39

## The following is for people who have the stable version of TeXLive which ships out with version 1.8 of fancytooltips.

(For newer versions and other TeX distributions see below.)

Here is a possibility using fancytooltips package by robert.marik.cz, who is also a regular in this site. See also related topic: Showing the bibliographic entry in a popup when you hover over the citation key where robert demonstrated the package.

Here is the sample code. The text was taken from http://en.wikipedia.org/wiki/Argument_principle

## Code

\documentclass[10pt]{beamer}

\usetheme{EastLansing}
\setbeamertemplate{theorems}[numbered]
\usepackage{amsthm,amsmath,graphicx,color}

\usepackage{tikz}
\PassOptionsToPackage{naturalnames}{hyperref}

\usepackage[inactive,blur=0.6, fixcolor]{fancytooltips}

\begin{document}

\FancyHook % Redefines \ref and \eqref commands to work with preview. See manual by running texdoc fancytooltips in your terminal

\title{A sample beamer presentation}
\author{Shuhao Cao}

\begin{frame}
\maketitle
\end{frame}

\begin{frame}
\begin{theorem}[Argument Principle]
If $f(z)$ is a meromorphic function inside and on some closed contour $C$, and $f$ has no zeros or poles on $C$, then
$$\label{eq:1} \oint \frac{f'(z)}{f(z)} dz = 2\pi i(N-P)$$
\end{theorem}
\end{frame}

\begin{frame}
$N$ and $P$ of Equation \eqref{eq:1} denote respectively the number of zeros and poles of $f(z)$ inside the contour $C$, with each zero and pole counted as many times as its multiplicity, respectively order, indicates.
\end{frame}

\end{document}


Save this as file, say myfile.tex

Now, in your terminal, cd to your working directory. In order for the tool tips to work, you have to use the bundled script. You also have to download the Acrotex Education Bundle. For manual installing the needed package, you can download eforms and insdljs from the author's site: http://www.math.uakron.edu/~dpstory/webeq.html.

bash fancy-preview myfile

Do not include the .tex file extension.

You can also use the option mouseover so that the equation will pop up by just hovering over the reference.

## For version 1.12 dated 2012/06/12

The option preview for fancytooltips replaces the command \FancyHook. You can try the following code. The script fancy-previewis a Perl file, now. The AcroTeX packages are still needed (see above).

%For fancyequations version 1.12
\documentclass[10pt]{beamer}

\usetheme{EastLansing}
\setbeamertemplate{theorems}[numbered]
\usepackage{amsthm,amsmath,graphicx,color}

\usepackage{tikz}
\usepackage{hyperref}

\usepackage[inactive,mouseover,blur=0.6, fixcolor,preview]{fancytooltips}

\begin{document}

%\FancyHook % Redefines \ref and \eqref commands to work with preview. See manual by running texdoc fancytooltips in your terminal

\title{A sample beamer presentation}
\author{Shuhao Cao}

\begin{frame}
\maketitle
\end{frame}

\begin{frame}
\begin{theorem}[Argument Principle]
If $f(z)$ is a meromorphic function inside and on some closed contour $C$, and $f$ has no zeros or poles on $C$, then
$$\label{eq:1} \oint \frac{f'(z)}{f(z)} dz = 2\pi i(N-P)$$
\end{theorem}
\end{frame}

\begin{frame}
$N$ and $P$ of Equation \eqref{eq:1} denote respectively the number of zeros and poles of $f(z)$ inside the contour $C$, with each zero and pole counted as many times as its multiplicity, respectively order, indicates.
\end{frame}

\end{document}


Compiling breaks in my machine with bash fancy-preview myfile but compiles fine with perl fancy-preview myfile.

-
What about miktex users on windows? What should be used instead of bash? –  Harish Kumar Nov 12 '12 at 1:51
@HarishKumar I have update my answer :) –  hpesoj626 Nov 12 '12 at 3:40
Thanks and +1 :-) –  Harish Kumar Nov 12 '12 at 12:39
Works perfectly!!!!! Greatly appreciated. –  Shuhao Cao Nov 13 '12 at 17:39
@Speravir It looks finer and neater. –  hpesoj626 Nov 17 '12 at 5:00

• As already mentioned you need an installation of a Perl distribution, see in my answer to MiKTeX and Perl scripts (and one Python script). Unfortunately you must additonally install the module Config::IniFiles by hand:
In Strawberry Perl you go into the command line tool “CPAN Client” (can be reached over the start menu) and execute upgrade Config::IniFiles (the case of letters is relevant!). If ready press q for quitting the tool.
In ActivePerl it is unluckily more complicated: Open the Perl Package Manager (found in the start menu), activate the view of all packages by clicking on the grey box in the toolbar or the according point in the menu “View” (or the right keyboard shortcut). Then search for Config-IniFiles (with - instead of the doubled colons) and mark this. After that press the + key or mark the box with this sign on it, and at last start the installation by clicking on the green arrow in the toolbar or with the keys Ctrl + Enter. Exit with the usual methods (keyboard shortcut is Ctrl + q).

• The “AcroteX” bundle is only pre-installed in a full MiKTeX installation. If you opted for a basic installation, you need to manually install this bundle with the MiKTeX Package Manager.

For the next steps you need a local texmf tree, if you not yet have created one, see Create a local texmf tree in MiKTeX.

• The package fancytooltips requires the package ocg. It is part of asymptote, and this is neither part of basic MiKTeX nor can be installed with the Package Manager. The best would be to install the whole asymptote stuff, but if you are really sure, that you will only need ocg, I give you a solution here: Download http://mirror.ctan.org/graphics/asymptote/doc/ocg.sty and put it in a recently created path <localtexmf>\tex\latex\asymptote\.

Update: Since MiKTeX update from Dec 5 2012 you can (and perhaps should) use the new package ocg-p. A cite from documentation:

Important: If packages are used, which use the original ocg package then the ocg-p should be loaded after these packages. The ocg environment from the ocg package is replaced in this case.

For a full Asymptote installation see Using Asymptote with MiKTeX.

• The extensionless perl file fancy-preview must also be installed from other resources. You can download it from the website of the developer http://user.mendelu.cz/marik/fancy-preview/ (scroll to “Installation” at the very end). Put it in <localtexmf>\scripts\fancytooltips\.

Now create an empty file in <localtexmf>\bin\. You can name it, as you want, as long the extension is .bat or .cmd, but the best is to give it the same name like the perl name, as I did here.

Copy the following and paste it into fancy-preview.bat:

@echo off
SETLOCAL

SET FPrevBAT=%~dp0
SET FPrevPATH=%FPrevBAT:~0,-5%\scripts\fancytooltips

perl %FPrevPATH%\fancy-preview %*


Two remarks: First, when you save the file in Notepad or Wordpad, make sure, that there is no automatic appending of TXT extension – save the file name with double quotes: "fancy-preview.bat". Second, this will only work with these paths as given by me.

After you‘ve refreshed the file name data base (FNDB) in MiKTeX, you can try the example shown in hpesoj626’s answer: In your workdir execute from the Windows Command Prompt fancy-preview <example>, note the execution without any prepended perl.

-
+1 :........... –  Harish Kumar Dec 2 '12 at 1:24
So, basically, you need to be a computer programmer. –  User 17670 Apr 5 '13 at 14:51
@User17670 Why? I am not. –  Speravir Apr 5 '13 at 16:34
Well, as much as I'd like to have fancy-preview on my document (with 200+ equations), it just seems impenetrably difficult to set-up. –  User 17670 Apr 5 '13 at 18:06