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.

The package fancytooltips allows for layers, where a rollover by mouse over a target brings up a box of comments. I want the target to contain extended mathematical objects such as aligned equations or matrices. To restate, this is somewhat similar to having a Base and an Exponent. Base is part of the main page and Exponent is the layer that shows up if you hover on Base. I want the Base to be a set of aligned equations or a matrix.

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

The tool-tips can contain mathematical expressions. Below there's an example. I used the file following mathtips.tex document

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

\colorlet{shadecolor}{blue!20}

\begin{document}

\keytip{distrib}\begin{shaded}
\begin{align}
a ( b + c ) &= ab + ac \\
&= ba + ca \\
&= ( b + c) a
\end{align}
\end{shaded}

\clearpage

\keytip{matrix}\begin{shaded}
\[
I_3 = \begin{bmatrix}
 1 & 0 & 0 \\
 0 & 1 & 0 \\
 0 & 0 & 1 
\end{bmatrix}
\]
\end{shaded}

\end{document}

to produce a file mathtips.pdf containing the tips (I used the framed package to place the tips inside a colored box, but you can style your tips as you wish), and then, using this file c.tex

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

\begin{document}

\tooltip{Distributivity}{distrib}

\tooltip{An identity matrix}{matrix}

\end{document}

I got the document with the fancy tool-tips; some images:

enter image description here

and the tool-tips:

enter image description here

enter image description here

The \tooltip{<stuff>}{<keyword>} command uses an \hbox for <stuff>, so if you want to use displayed math in <stuff> (a set of aligned equations obtained using amsmath's align environment, for example), you will need to use the starred version \tooltip* (for in-line math material you can still use the non-starred version); consider the following simple example using the same mathtips.pdf file as before:

\documentclass{article}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage[filename=mathtips,mouseover]{fancytooltips}

\begin{document}

\tooltip{$I_3 = \begin{bmatrix}
 1 & 0 & 0 \\
 0 & 1 & 0 \\
 0 & 0 & 1 
\end{bmatrix}$}{distrib}

\tooltip*{\begin{align}
a ( b + c ) &= ab + ac \\
&= ba + ca \\
&= ( b + c) a
\end{align}}{matrix}

\end{document}

enter image description here

enter image description here

As a remark, the noextratext package option doesn't seem to work when using displayed mathematical expressions (such as those produced by align) in the first argument of \tooltips*.

share|improve this answer
    
Thanks, can we have the BASE, as the item in \tooltip{BASE}, be a collection of equations or a mtrix. So for example when you mouseover/click on that set of equations or matrix then the additional (exponent) layer shows up. I have been only able to put simple text or simple formula as BASE but not a set of equations with alignment etc. –  Maesumi May 16 '12 at 5:33
    
@Maesumi Ah, now I see what you meant. The answer is yes; please see my updated answer. –  Gonzalo Medina May 16 '12 at 13:30
    
Great. Except the second base/tooltip* with the \begin{align} does not seem to work. (The first one with the base the identity matrix works for me as in the picture you posted.) –  Maesumi May 16 '12 at 19:56
    
@Maesumi: it works for me, as you can see from the image... are you perhaps using outdated packages? –  Gonzalo Medina May 16 '12 at 22:05
    
When I hover on the second formula I do not see any popup. (Also notice that in the text of your program when you hover on matrix the distributive law is supposed to come up and when you hover on distributive laws the matrix is supposed to show.) –  Maesumi May 17 '12 at 1:30
show 3 more comments

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.