Sign up ×
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.

Is it possible to get tooltips into a LaTeX pdf?

I am working on my CV. I would like to show some more information on my electronic version once you swipe over that field with the mouse. i.e. when swiping with the mouse over education I want to show my subjects taken in undergrad through a tooltip.

Is this possible and if yes would if work for all kind of pdf readers?

share|improve this question
Is it possible? Yes. Would it work for all kinds of PDF readers? Maybe not. – Werner Jan 23 '14 at 5:37
How PDF viewers show 'hover text' is down the them, not the source (LaTeX or otherwise). Thus the best you can hope is to check with a set of viewers. – Joseph Wright Jan 23 '14 at 6:58
You have alreay tagged with an according package name, cf. also Mouseover events in beamer: hovering on \eqref and a comment containing the original equation popping up. There is at least the package pdfcomments, as well. For the PDF readers: As example SumatraPDF does not at all execute such tooltips. – Speravir Jan 23 '14 at 19:04
Also interesting: Showing the bibliographic entry in a popup when you hover over the citation key. Quite probably there are more of this. – Speravir Feb 16 '14 at 23:45

2 Answers 2

up vote 8 down vote accepted

Finally I came up with a \tooltip command that works across a small number of PDF viewers, among which is an Open-Source one. The tooltip command allows for TeX-formatted tip texts.

It comes in three variants:

%draggable tip, AR-only
\tooltip[<link colour>]{<link text>}[<tip box colour>]{<tip text>}

%starred variant for non-draggable tip text, AR-only
\tooltip*[<link colour>]{<link text>}[<tip box colour>]{<tip text>}  

%doubly-starred variant also works in Evince, on-click, not draggable
\tooltip**[<link colour>]{<link text>}[<tip box colour>]{<tip text>}

In contrast to the un-starred \tooltip command, the doubly-starred

\tooltip**[<link colour>]{<link text>}[<tip box colour>]{<tip text>}

has the following restrictions:

  1. The tip text box is not draggable.
  2. The Link must be clicked once for the tip to show up and clicked once again to go away. Mouse-over and mouse-out are not enough.

These were necessary to meet the different PDF viewer capabilities.

Tooltips that become visible on mouse-over work only in Adobe Reader and can be inserted using the un-starred (draggable tip text) and single-starred (not draggable) variant.

The result was successfully tested in Evince (open-source!), Adobe Reader and PDF-XChange Viewer. The \tooltip requires package media9, version 0.60 (2015/11/02).


enter image description here


% optimized for Adobe Reader (visible on mouse-over)
%     usage: \tooltip[<link colour>]{<link text>}[<tip box colour>]{<tip text>}
%   non-draggable version:
%     usage: \tooltip*[<link colour>]{<link text>}[<tip box colour>]{<tip text>}
% for Evince (visible on click, not draggable)
%   usage: \tooltip**[<link colour>]{<link text>}[<tip box colour>]{<tip text>}


      /Subtype/Link/Border [0 0 0]/A <</S/SetOCGState/State [/Toggle \tpTipOcg]>>
          /E<</S/SetOCGState/State [/ON \tpTipOcg]>>%
          /X<</S/SetOCGState/State [/OFF \tpTipOcg]>>%
            var fd=this.getField('tip.\thetcnt');%
                var click\thetcnt=false;%
                var fdor\thetcnt=fd.rect;var dragging\thetcnt=false;%
          /PC<</S/JavaScript/JS (%
            var fd=this.getField('tip.\thetcnt');%
      /Subtype/Widget/FT/Btn/T (tip.\thetcnt)%
      /AP<</N \tpPdfLastXform>>%
      /MK<</TP 1/I \tpPdfLastXform/IF<</S/A/FB true/A [0.0 0.0]>>>>%
        /Ff 65537/OC \tpTipOcg%
        /Ff 65536/F 3%
        /AA <<%
          /U <<%
              var mX=this.mouseX;var mY=this.mouseY;%
              var drag=function(){%
                var nX=this.mouseX;var nY=this.mouseY;%
                var dX=nX-mX;var dY=nY-mY;%
                var fdr=fd.rect;%
  \begin{tikzpicture}[overlay,remember picture]
    \path let \p0 = (0,0), \p1 = (current page.east) in
  Einstein's \tooltip**{formula}{$E=m c^2$} is well known.
  Another famous formula is due to \tooltip**{Pythagoras}{$a^2+b^2=c^2$}.

  This \tooltip{tip}{is visible only in AR} is draggable and shown on mouse-over.
share|improve this answer
What package/class provides \ocgbase@new@ocg? – 1010011010 Nov 23 at 12:11
@1010011010 ocgbase.sty (part of package ocgx2) loaded by media9.sty. – AlexG Nov 23 at 12:46

Tooltips in PDF documents are generally possible. I do know two packages; one of them you tagged yourself for your question, the other one I added, click on these tags to see, which questions were already asked in TeX.SX: & . But as Joseph Wright in a comment wrote:

How PDF viewers show 'hover text' is down the them, not the source (LaTeX or otherwise). Thus the best you can hope is to check with a set of viewers.

I can tell you, that SumatraPDF, a popular viewer for Windows, does not show any tooltip at all with “tooltip” in a strict meaning, but does show comments, when you hover with the mouse over one of them. What is supported, what not, can be seen when reading the documentation of package pdfcomment. There is a type \pdfmarkupcomment that actually almost acts like a tooltip.

See also this fixed bug in SumatraPDF Bug tracker: PDF Comments Don't Work.

share|improve this answer

Your Answer


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.