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.

Tooltips can be generated with pdfcomment package. However, they lead to some weird behavior if one clicks on a tooltiped item: the item becomes highlighted and "checked" (checked in Acrobat Reader 9 in Debian and Acrobat Reader X in Windows XP). So, it looks more like a "checkbox":

tooltip, with tooltip area highlighted and ticked

See an example below

\documentclass{article}
\usepackage{pdfcomment} 

\newcommand\MyShortCut[3]{\newcommand{#1}{\pdftooltip{#2}{#3}}}

\MyShortCut{\textthing}{tooltip here}{just an example}
\MyShortCut{\Td}{\tau_\textrm{d}}{reptation time}
\MyShortCut{\Tr}{\tau_\textrm{R}}{Rouse time}

\begin{document}
Use pdflatex to compile, then open in Acrobat Reader and
put the mouse pointer above $\tau$'s

\[
\Td = 3 Z \Tr
\]

Or in text \textthing.

\end{document}

Question: is there a better way to achieve my goal: to have a tooltip when a mouse pointer is over a piece of text or a variable? Without any side effects, like the ones described above. Ideally, with hyperref only, so I do not need to load extra packages (\href does something similar).

share|improve this question
    
Have a look at this question: tex.stackexchange.com/questions/32314/… –  Marco Daniel Nov 13 '11 at 19:06
    
@Marco Daniel : Thanks for the tip. I saw that question but it does not solve the problem. Actually, the pdfcomment example there suffers from the same phenomenon as I have explained above. –  amorua Nov 13 '11 at 19:58
    
I this post the package fancytooltips is listed. Is this package an alternative? –  Marco Daniel Nov 14 '11 at 6:15
    
@Marco Daniel : No, fancytooltips is not an alternative, because of two points. First of all, it would be really an overkill for simple text-only tooltips I need. Secondly, it works only with Javascript enabled in AcroRead, whereas simple tooltips I need is a feature of PDF, which does not require Javascript (due to security reasons, it is a good idea to switch off Javascript in AcroRead, what many people, including myself, do). –  amorua Nov 14 '11 at 6:48

1 Answer 1

up vote 5 down vote accepted

This bug has been fixed in version 2.3a of pdfcomment, which is available on CTAN and can be obtained by updating your TeX distribution. The manual fix provided in this answer is not necessary any more!

Apparently there's a bug in pdfcomment which causes the weird appearance of the tooltips: There is a spurious slash in the specification of the field flags (pdfcomment.sty, l. 2967), so Adobe Reader uses the default value for this property and creates a checkbox instead of the desired pushbutton. The following example includes a fix for this:

\documentclass{article}
\usepackage{pdfcomment}
% Fix incorrect display of tooltips (http://tex.stackexchange.com/a/74340/3323)
\makeatletter
\renewcommand{\pc@annot@tooltip}%
{%
  /TU (\pc@pdfenc@contents)\space%
  /T (tooltip \thezref@unique)\space%
  /C [0 0 0]\space%
  /FT/Btn\space%
  /Ff 65536\space%
  /H/N\space%
}%
\makeatother

\newcommand\MyShortCut[3]{\newcommand{#1}{\pdftooltip{#2}{#3}}}

\MyShortCut{\textthing}{tooltip here}{just an example}
\MyShortCut{\Td}{\tau_\textrm{d}}{reptation time}
\MyShortCut{\Tr}{\tau_\textrm{R}}{Rouse time}

\begin{document}
Use pdflatex to compile, then open in Acrobat Reader and
put the mouse pointer above $\tau$'s

\[
\Td = 3 Z \Tr
\]

Or in text \textthing.

\end{document}

Tooltip appearance:

tooltip without strange highlighting or checkboxes

Like this, no strange boxes are shown around the tooltip area on hover, and it's not possible to highlight or tick it.

share|improve this answer
    
Thanks for looking into the sources - and understanding them ;-) So the different behaviour of other PDF readers may also caused of this. Some one needs to inform Josef Kleber (@josef here on TeX.sx). –  Speravir Sep 27 '12 at 20:58
1  
Josef is informed ;-) There's a bugfix version at Bitbucket: bitbucket.org/kleberj/pdfcomment/raw/b5bf3fe6ece7/dev/tex/latex/… There will be a new release to Bitbucket and CTAN soon! –  Josef Sep 28 '12 at 10:37
    
@Josef: Oh, nice. Say him thank you! ;-) –  Speravir Sep 28 '12 at 16:49

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.