4

I'm currently writting a big document including a glossary (\usepackage[toc,nomain,nonumberlist]{glossaries})

Is there an easy way to create automatically tooltips for the entries? So if you hower over it, it shows the explenation. When you click on it, it should still link yout to the glossary?

Maybe something like fancytooltips or pdfcomment?

4
  • 1
    No, this can not work. Both, the link and the tooltip are so called PDF annotations. These define a rectangle and an action, which will be performed after a click or a mouse-over on the defined area. In the same area one annotaion overlays the other. Links seem to have priority.
    – Josef
    Sep 2, 2014 at 14:16
  • Well that's a shame thank you for your answer
    – magu_
    Sep 2, 2014 at 14:53
  • It might be possible to add a symbol (such as a little triangle) just after the hyperlink and have the tooltip come up over that, which would separate the PDF annotations. Sep 2, 2014 at 16:14
  • Not directly want you want, but allows for general LaTeX code inside a tooltip: tex.stackexchange.com/questions/119988/…
    – user31729
    Sep 3, 2014 at 7:24

2 Answers 2

1

I used this workaround: Since I only need the tooltip for instances where the acronym is used in short form, I replace the hyperlink with the tooltip.

\usepackage[acronym,shortcuts,nopostdot,style=super,nonumberlist,toc,nogroupskip]{glossaries}

I include the shortcuts option to avoid recursive replacement by \renewcommand.

\renewcommand{\acs}[1]{\pdftooltip{\acrshort*{#1}}{\glsentrylong{#1}}}
\renewcommand{\acsp}[1]{\pdftooltip{\acrshortpl*{#1}}{\glsentrylongpl{#1}}}
0

It took a lot of fiddling around, but finally I got something that I'm happy with. We are using the amazing glossaries package (what an incredible labor of love) within overleaf to make PDF.

We include our acronyms.tex. Here is minimal example

\documentclass[10pt, journal]{IEEEtran}
\include{acronyms}
\begin{document}
Testing \tip{of} is hard. You need a big dataset because \tip{of} papers are judged critically.
However, \tip{dvs} cameras make using \tip{bmof} methods easy. \tip{dvs} cameras are cool.
\end{document}

Here is (stripped down) acronyms.tex


% our abbreviations, acronyms, etc
\usepackage[draft]{pdfcomment} % https://ctan.org/pkg/pdfcomment?lang=en 
\usepackage[hyperfirst=false,acronym,sort=none,shortcuts,nopostdot,style=super,nonumberlist,toc,nogroupskip]{glossaries}
\usepackage[dvipsnames]{xcolor} % used for colored acronyms

\glsdisablehyper % to disable hyperlinks on all acronyms

\newcommand{\accolor}[1]{\textcolor{Sepia}{#1}}
\newcommand*{\glossfirstformat}[1]{\accolor{#1}} % use to make first definition special format

%https://tex.stackexchange.com/questions/232707/modify-appearance-of-first-acronym
\newcommand*{\acfirstformat}[1]{\textcolor{Bittersweet}{\textbf{#1}}}
\newcommand*{\acplfirstformat}[1]{\textcolor{Bittersweet}{\textbf{#1}}}
\newacronymstyle{myacro}
{%
  \GlsUseAcrEntryDispStyle{long-short}%
}%
{%
  \GlsUseAcrStyleDefs{long-short}%
  \renewcommand*{\genacrfullformat}[1]{%
   \glossfirstformat{\glsentrylong{##1}}\space
   (\acfirstformat{\glsentryshort{##1}})%
  }%
  \renewcommand*{\Genacrfullformat}[2]{%
   \glossfirstformat{\Glsentrylong{##1}}\space
   (\glsentryshort{##1})%
  }%
  \renewcommand*{\genplacrfullformat}[2]{%
   \glossfirstformat{\glsentrylongpl{##1}}\space
   (\acplfirstformat{\glsentryshort{##1}})%
  }%
  \renewcommand*{\Genplacrfullformat}[2]{%
   \glossfirstformat{\Glsentrylongpl{##1}}\space
   (\glsentryshortpl{##1})%
  }%
}

\setacronymstyle{myacro}

% use for normal acronyms, gives them a PDF tooltip popup
\newcommand*{\tip}[1]{%  define our acronym command,  make it short since we use it a lot, use * for so that it is only a 'short' command
    \ifglsused{#1}{% if we used it already, then put pdftooltip
      {\pdftooltip{\accolor{\glsentryshort{#1}}}{\glsentrydesc{#1}}}%
    }{%
      \gls{#1}% otherwise put the normal gls
    }%
}%

% use for plural acronyms
\newcommand*{\tips}[1]{%  define our acronym command,  make it short since we use it a lot, use * for so that it is only a 'short' command
    \ifglsused{#1}{% if we used it already, then put pdftooltip
      {\pdftooltip{\accolor{\glsentryshortpl{#1}}}{\glsentrydescpl{#1}}}%
    }{%
      \gls{#1}% otherwise put the normal gls
    }%
}%

% sorted list of acronyms
\newacronym{dvs}{DVS}{Dynamic Vision Sensor}
\newacronym[longplural={First In First Out memories}]{fifo}{FIFO}{First In First Out memory}
\newacronym{of}{OF}{Optical Flow}

At least in Adobe Acrobat Reader and DC (but not for some reason in SumatraPDF at least on this Windows computer) it shows the tooltip popup: enter image description here

If the glossaries creator would chime in it would be great. I could not make it work without using a switch for \tip{} command that either enables glossaries output or pdfcomment.

1
  • The current Sumatra 3.2 and prerelease versions do not show the tip, but v3.0 shows it. Current Adobe Reader shows tips, but Mac PDF viewer does not. Coverage seems spotty. May 17, 2021 at 17:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .