# Are mouse over definitions of acronyms possible?

I have a lot of acronyms in my thesis and I am using the acro package. I would like to know if there is an option to make it possible for the acronyms within the thesis to display a mouse over definition, this is obviously only a function useful for the PDF output file, is there a possibility to make them display the long name if the mouse is hovered over the acronym term?

(FIXED) Edit: problem using the \tooltip macro (FIXED)

To AlexG I encountered a problem with using the \tooltip macro whereby you get the following overlapping of acronyms:

I can't work out why or how to fix it, but its an essential flaw of the \tooltip macro as, when I remove it it disappears: please feel free to play around with this MWE:

\documentclass[a4paper,11pt]{scrreprt}

\usepackage{acro}

\usepackage{tensor}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The re-defining of the acronym entering commands \ac for the normal form, \acp for the plural form of the acronym, \acl, \aclp
\let\acorig\ac
\let\acporig\acp
\def\ac#1{\acifused{#1}{\tooltip*[black]{\acs{#1}}{\acl{#1}}}{\acorig{#1}}}
\def\acp#1{\acifused{#1}{\tooltip*[black]{\acsp{#1}}{\aclp{#1}}}{\acporig{#1}}}

%%%%%%%%%% THE LONG ASS MACRO
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%        (starred variant is not draggable)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{media9}[2014/02/06]
\usepackage{xcolor}
\usepackage{calc}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc}
\newlength{\whatsleft}
\newlength{\tipshift}

\ExplSyntaxOn
\let\tpPdfAnnot\mix_pdfannot:nnnn\def\tpPdfLastAnn{\g_mix_pdflastann_tl}
\let\tpPdfXform\mix_pdfxform:n\def\tpPdfLastXform{\g_mix_pdflastxform_tl}
\let\tpInsertAcroForm\mix_insert_acroform:
\ExplSyntaxOff

\makeatletter
\NewDocumentCommand{\tooltip}{sO{blue}mO{yellow!20}m}{{%
\leavevmode%
/Subtype/Screen%
/AA<<%
/E<</S/JavaScript/JS(%
var fd=this.getField('tip.\thetcnt');%
\IfBooleanTF{#1}{fd.display=display.visible;}{%
if(typeof(click\thetcnt)=='undefined'){%
var click\thetcnt=false;%
var fdor\thetcnt=fd.rect;var dragging\thetcnt=false;%
}%
if(fd.display==display.hidden){%
fd.delay=true;fd.display=display.visible;fd.delay=false;%
}%
}%
this.dirty=false;%
)>>%
/X<</S/JavaScript/JS(%
\IfBooleanTF{#1}{fd.display=display.hidden;}{%
if(!click\thetcnt&&!dragging\thetcnt){fd.display=display.hidden;}%
if(!dragging\thetcnt){click\thetcnt=false;}this.dirty=false;%
}%
)>>%
\IfBooleanF{#1}{%
/U<</S/JavaScript/JS(click\thetcnt=true;this.dirty=false;)>>%
/PC<</S/JavaScript/JS (%
var fd=this.getField('tip.\thetcnt');%
try{fd.rect=fdor\thetcnt;}catch(e){}%
fd.display=display.hidden;this.dirty=false;%
)>>%
}%
>>%
}{{\color{#2}#3}}%
\sbox\tiptext{\fcolorbox{black}{#4}{#5}}%
\edef\twd{\the\wd\tiptext}%
\edef\tht{\the\ht\tiptext}%
\edef\tdp{\the\dp\tiptext}%
\measureremainder{\whatsleft}%
\tipshift=0pt%
\ifdim\whatsleft<\twd\setlength\tipshift{\whatsleft-\twd}\fi%
\hspace{\tipshift}\tpPdfXform{\tiptext}%
\raisebox{\heightof{#3}}[0pt][0pt]{\makebox[0pt][l]{%
\tpPdfAnnot{\twd}{\tht}{\tdp}{%
/Subtype/Widget/FT/Btn/Ff 65536/T (tip.\thetcnt)/F 3%
/MK<</TP 1/I \tpPdfLastXform/IF<</S/A/FB true/A [0.0 0.0]>>>>%
\IfBooleanF{#1}{%
/AA <<%
/U <<%
/S/JavaScript/JS(%
var fd=event.target;%
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;%
fdr[0]+=dX;fdr[1]+=dY;fdr[2]+=dX;fdr[3]+=dY;%
fd.rect=fdr;mX=nX;mY=nY;%
};%
if(!dragging\thetcnt){%
dragging\thetcnt=true;Int=app.setInterval("drag()",1);%
}%
else{app.clearInterval(Int);dragging\thetcnt=false;}%
this.dirty=false;%
)%
>>%
>>%
}%
}%
\xdef\@anim@fields{\@anim@fields\space\tpPdfLastAnn}
\tpInsertAcroForm
}}%
\stepcounter{tcnt}%
}}
\makeatother
\newsavebox\tiptext\newcounter{tcnt}
\newcommand{\measureremainder}[1]{%
\begin{tikzpicture}[overlay,remember picture]
\path let \p0 = (0,0), \p1 = (current page text area.east) in
[/utils/exec={\pgfmathsetlength#1{\x1-\x0}\global#1=#1}];
\end{tikzpicture}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DEFINED ACRONYMS
\DeclareAcronym{pwr}{
short = PWR ,
short-plural = s ,
long = Pressurised Water Reactor ,
long-plural = s ,
class = reactor ,
}

\DeclareAcronym{ebr}{
short = EBR-I ,
short-plural =  ,
long = Experimental Breeder Reactor I ,
long-plural =  ,
class = reac.exist ,
}

\DeclareAcronym{vhtr}{
short = VHTR ,
short-plural = s ,
long = Very High Temperature Reactor ,
long-plural = s ,
class = reactor ,
}

\DeclareAcronym{sfr}{
short = SFR ,
short-plural = s ,
long = Sodium Fast Reactor ,
long-plural = s ,
class = reactor ,
}

\DeclareAcronym{heu}{
short = HEU ,
short-plural =  ,
long = High Enriched Uranium ,
long-plural =  ,
class = reac.term ,
}

\DeclareAcronym{leu}{
short = LEU ,
short-plural =  ,
long = Low Enriched Uranium ,
long-plural =  ,
class = reac.term ,
}

\DeclareAcronym{htgr}{
short = HTGR ,
short-plural = s ,
long = High Temperature Gas cooled Reactor ,
long-plural = s ,
alt = HTR ,
class = reactor ,
}

\begin{document}

The flexibility of fuel cycle use is one of the attractive features presented by \acp{htgr}. Initially \acp{htgr} took advantage of the efficient uranium-thorium fuel cycle which combined \ac{heu} as fissile fuel with fertile thorium that would breed fissile \nuclide[233][92]{U} during operation. With the non-proliferation treaty in force by 1970 a \ac{leu} fuel cycle was designed and adopted to avoid diversion of fissile material.

\end{document}

-
fancytooltips, cooltooltips and pdfcomment can create pop-ups I think. – Torbjørn T. Feb 20 '14 at 12:17
– doncherry Feb 20 '14 at 12:25
In addition to the packages mentioned by @TorbjørnT., the \tooltip macro for draggable tooltips which supports all known output drivers. – AlexG Feb 20 '14 at 12:54
I'll have a look into it tomorrow. – AlexG Feb 20 '14 at 21:20
\tooltip code has been fixed. – AlexG Feb 21 '14 at 9:27

Here is an example using the previously defined \tooltip command. Some user macros from the Acro package needed to be redefined to insert the tooltips only after first use:

For Acronyms in black and non-draggable tip boxes use

\def\ac#1{\acifused{#1}{\tooltip*[black]{\acs{#1}}{\acl{#1}}}{\acorig{#1}}}
\def\acp#1{\acifused{#1}{\tooltip*[black]{\acsp{#1}}{\aclp{#1}}}{\acporig{#1}}}


\def\ac#1{\acifused{#1}{\tooltip{\acs{#1}}{\acl{#1}}}{\acorig{#1}}}
\def\acp#1{\acifused{#1}{\tooltip{\acsp{#1}}{\aclp{#1}}}{\acporig{#1}}}


in the code below.

The complete code:

\documentclass[a6paper,12pt]{scrbook}
%\documentclass[12pt]{scrbook}
\usepackage{acro}
\DeclareAcronym{cd}{ short={CD}, long={Compact Disc}, short-plural={s}, long-plural={s} }
\DeclareAcronym{mc}{ short={MC}, long={Musicassette}, short-plural={s}, long-plural={s} }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%re-defining \ac, \acp
\let\acorig\ac
\let\acporig\acp
\def\ac#1{\acifused{#1}{\tooltip{\acs{#1}}{\acl{#1}}}{\acorig{#1}}}
\def\acp#1{\acifused{#1}{\tooltip{\acsp{#1}}{\aclp{#1}}}{\acporig{#1}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% tooltips with LaTeX
%
%   non-draggable version:
%
% for Evince (visible on click, not draggable)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{xparse,pdfbase,ocgbase}
\usepackage{xcolor,calc}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc}

\ExplSyntaxOn
\let\tpPdfAnnot\pbs_pdfannot:nnnn\let\tpPdfLastAnn\pbs_pdflastann:
\let\tpAppendToFields\pbs_appendtofields:n
\def\tpPdfXform{\pbs_pdfxform:nnn{1}{1}}
\let\tpPdfLastXform\pbs_pdflastxform:
\ExplSyntaxOff

\makeatletter
\NewDocumentCommand{\tooltip}{ssO{blue}mO{yellow!20}m}{{%
\leavevmode%
\IfBooleanT{#1}{%
\ocgbase@new@ocg{tipOCG.\thetcnt}{%
/Print<</PrintState/OFF>>/Export<</ExportState/OFF>>%
}{false}%
\xdef\tpTipOcg{\ocgbase@last@ocg}%
}%
\IfBooleanTF{#2}{%
/Subtype/Link/Border [0 0 0]/A <</S/SetOCGState/State [/Toggle \tpTipOcg]>>
}{%
/Subtype/Screen%
\IfBooleanTF{#1}{%
/AA<<%
/E<</S/SetOCGState/State [/ON \tpTipOcg]>>%
/X<</S/SetOCGState/State [/OFF \tpTipOcg]>>%
>>%
}{
/AA<<%
/E<</S/JavaScript/JS(%
var fd=this.getField('tip.\thetcnt');%
\IfBooleanF{#1}{%
if(typeof(click\thetcnt)=='undefined'){%
var click\thetcnt=false;%
var fdor\thetcnt=fd.rect;var dragging\thetcnt=false;%
}%
}%
if(fd.display==display.hidden){%
fd.delay=true;fd.display=display.visible;fd.delay=false;%
}%
this.dirty=false;%
)>>%
/X<</S/JavaScript/JS(%
if(!click\thetcnt&&!dragging\thetcnt){fd.display=display.hidden;}%
if(!dragging\thetcnt){click\thetcnt=false;}%
this.dirty=false;%
)>>%
/U<</S/JavaScript/JS(click\thetcnt=true;this.dirty=false;)>>%
/PC<</S/JavaScript/JS (%
var fd=this.getField('tip.\thetcnt');%
try{fd.rect=fdor\thetcnt;}catch(e){}%
fd.display=display.hidden;this.dirty=false;%
)>>%
/PO<</S/JavaScript/JS(this.dirty=false;)>>%
>>%
}
}%
}{{\color{#3}#4}}%
\sbox\tiptext{\fcolorbox{black}{#5}{#6}}%
\edef\twd{\the\wd\tiptext}%
\edef\tht{\the\ht\tiptext}%
\edef\tdp{\the\dp\tiptext}%
\measureremainder{\whatsleft}\tipshift=0pt%
\ifdim\whatsleft<\twd\setlength\tipshift{\whatsleft-\twd}\fi%
\tpPdfXform{\tiptext}%
\raisebox{\heightof{#4}+\tdp}[0pt][0pt]{\makebox[0pt][l]{\hspace{\tipshift}%
\tpPdfAnnot{\twd}{\tht}{\tdp}{%
/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]>>>>%
\IfBooleanTF{#1}{%
/Ff 65537/OC \tpTipOcg%
}{%
/Ff 65536/F 3%
/AA <<%
/U <<%
/S/JavaScript/JS(%
var fd=event.target;%
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;%
fdr[0]+=dX;fdr[1]+=dY;fdr[2]+=dX;fdr[3]+=dY;%
fd.rect=fdr;mX=nX;mY=nY;%
};%
if(!dragging\thetcnt){%
dragging\thetcnt=true;Int=app.setInterval("drag()",1);%
}%
else{app.clearInterval(Int);dragging\thetcnt=false;}%
this.dirty=false;%
)%
>>%
>>%
}%
}%
\tpAppendToFields{\tpPdfLastAnn}%
}}%
\stepcounter{tcnt}%
}}
\makeatother
\newsavebox\tiptext\newcounter{tcnt}
\newlength{\whatsleft}\newlength{\tipshift}
\newcommand{\measureremainder}[1]{%
\begin{tikzpicture}[overlay,remember picture]
\path let \p0 = (0,0), \p1 = (current page.east) in
[/utils/exec={\pgfmathsetlength#1{\x1-\x0}\global#1=#1}];
\end{tikzpicture}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\acp{mc} and \acp{cd} are media for recording music. The \ac{mc} appeared about 15 years earlier than the \ac{cd}.
\end{document}

-
That is brilliant, thank you so much its pretty much exactly what I was hoping for!! so by using the \tooltip* I am able to make them non draggable. Just one more question, how can I make them appear black? I would like the acronyms not stand out from the text please. – Fiztban Feb 20 '14 at 13:59
Ah worked it out just need to add the \tooltip*[black]{...}{...} I get a permanent error is that normal? – Fiztban Feb 20 '14 at 14:02
@Fiztban: No error here. Perhaps old version of media9 at your end? Get media9.sty from CTAN and place it into your current directory, or better run the package updater if you are using TeXLive-2013 or MikTeX-2.9. – AlexG Feb 20 '14 at 14:11
@Fiztban: Some months ago I posted the method for Linux and X11 on Meta. – AlexG Feb 20 '14 at 14:31
@Fiztban: The bug you reported has been fixed. – AlexG Feb 21 '14 at 9:25

Update 2015-09-08:

As of version 2.1 acro supports tooltips directly. They can be activated in two ways:

1. simply set the option \acsetup{tooltip=true}. This will load the pdfcomment package and use \pdftooltip as command for creating tooltips.
2. set the option \acsetup{tooltip-cmd = <macro>} to a tooltip-creating macro of your liking.

As a general rule tooltips are only ever inserted for short forms of acronyms and never for the long form. Nesting is supported in the following way: tooltips of the “inner” acronyms are disabled and the one of the “outer” acronym is used.

The insertion can be checked visually by defining a macro

\providecommand\tooltip[2]{[PDF:#1][tooltip:#2]}


and use it via \acsetup{tooltip-cmd = \tooltip}.

\documentclass{article}

\usepackage{acro}

\providecommand\tooltip[2]{[PDF:#1][tooltip:#2]}
\acsetup{
tooltip-cmd = \tooltip ,
}

\DeclareAcronym{m}{
short        = {m},
long         = {milli},
short-plural = {},
long-plural  = {},
class        = {SI-prefix},
tooltip      = milli
}

\DeclareAcronym{g}{
short        = {g},
long         = {gramm},
short-plural = {},
long-plural  = {},
class        = {SI-unit-derived},
tooltip      = gramm
}

\DeclareAcronym{mg}{
short        = {\acs{m}\acs{g}},
long         = {\Acl{m}\acl{g}},
short-plural = {},
long-plural  = {},
class        = {SI-unit-derived},
}

\begin{document}

\ac{g}\par
\ac{g}\par
\Ac{g}

\bigskip

\ac{m}\par
\acp{m}\par
\Acp{m}

\bigskip

\ac{mg}\par
\ac{mg}\par
\acf{mg}

\end{document}


Original answer – for versions up to 1.6:

The code below adds a tooltip property to acronyms that allows to specify the hover text for an acronym if it should differ from the long form. If not specified the long form is used. The code takes care that the tooltips are inserted for the short forms and the alternative forms but not on first use and not in the list of acronyms. This is done by redefining the corresponding internal commands.

The code uses the pdfcomment package and its \pdftooltip macro for generating the tooltips as an example. AlexG's \tooltip macro can just as easily be used, though, which means the integration into acro is independent from a tooltip generating package/code. Below the macro that needs to be adjusted is shown.

(I'm thinking of adding something like this to acro... but I'd like some feedback first. So far the feedback isn't overly enthusiastic...).

General usage

\documentclass{article}
\usepackage{pdfcomment}

\usepackage{acro}
\ExplSyntaxOn
...
\ExplSyntaxOff

% long form used as tooltip text:
\DeclareAcronym{cd}{
short = {CD},
long  = {Compact Disc}
}
% custom tooltip text:
\DeclareAcronym{mc}{
short   = {MC},
long    = {Music Cassette},
tooltip = {my mouse-over text}
}

\begin{document}

\ac{cd} \ac{mc}\par\vspace{1cm}
\ac{cd} \ac{mc}

\end{document}


If another package/code for tooltips should be used then the definition in the code below

% #1: printed text
% #2: tool tip text
\cs_new_protected:Npn \acro_tooltip:nn #1#2
{ \pdftooltip {#1} {#2} }


Here's the complete code

\documentclass{article}
\usepackage{pdfcomment}

\usepackage{acro}
\ExplSyntaxOn
\prop_new:N \l__acro_tooltip_prop

\cs_new_protected:Npn \__acro_declare_tooltip:nn #1#2
{
\__acro_key_check:nn { #1 } { tooltip }
\prop_put:Nnn \l__acro_tooltip_prop { #1 } { #2 }
}
\cs_generate_variant:Nn \__acro_declare_tooltip:nn { V }

\keys_define:nn { acro / declare-acronym }
{
tooltip .code:n =
\__acro_declare_tooltip:Vn \l__acro_current_key_tl { #1 } ,
}

\cs_new_protected:Npn \acro_write_tooltip:nnn #1#2#3
{
\prop_get:NnNTF \l__acro_tooltip_prop { #1 } \l__acro_tmpc_tl
{ \acro_tooltip:nn { #2 } { \l__acro_tmpc_tl } }
{ \acro_tooltip:nn { #2 } { #3 } }
}
\cs_generate_variant:Nn \acro_write_tooltip:nnn { nnV }

\cs_set_protected:Npn \acro_use:n #1
{
% get the acronym and the plural settings:
\acro_get:n { #1 }
\acro_is_used:nTF { #1 }
{
% this is not the first time
\__acro_indefinite:nn { #1 } { short }
\__acro_acc_supp:nn
{ #1 }
{
\acro_write_tooltip:nnn
{ #1 }
{ \__acro_write_short:V \l__acro_short_tl }
{ \l__acro_long_tl }
}
\acro_after:n { #1 }
}
{
% this is the first time
\bool_gset_true:c { g__acro_#1_first_use_bool }
\__acro_is_single:nTF { #1 }
{
\__acro_indefinite:nn { #1 } { long }
\__acro_write_long:NV \l__acro_long_format_tl \l__acro_long_tl
}
{
\UseInstance { acro-first } { \l__acro_first_instance_tl }
{ #1 }
{ \l__acro_short_tl }
{ \l__acro_long_tl }
}
}
}

\cs_set_protected:Npn \acro_short:n #1
{
\acro_get:n { #1 }
\acro_is_used:n { #1 }
\__acro_indefinite:nn { #1 } { short }
\__acro_is_single:nT { #1 }
\__acro_acc_supp:nn
{ #1 }
{
\acro_write_tooltip:nnn
{ #1 }
{ \__acro_write_short:V \l__acro_short_tl }
{ \l__acro_long_tl }
}
\acro_after:n { #1 }
}

\cs_set_protected:Npn \acro_alt:n #1
{
\acro_get:n { #1 }
\acro_is_used:n { #1 }
\__acro_indefinite:nn { #1 } { alt }
\__acro_is_single:nT { #1 }
\__acro_acc_supp:nn
{ #1 }
{
\acro_write_tooltip:nnn
{ #1 }
{ \__acro_write_short:V \l__acro_alt_tl }
{ \l__acro_long_tl }
}
\acro_after:n { #1 }
}

% use whatever command you like here:
% #1: printed text
% #2: tool tip text
\cs_new_protected:Npn \acro_tooltip:nn #1#2
{ \pdftooltip {#1} {#2} }

\ExplSyntaxOff

\DeclareAcronym{cd}{
short = {CD},
long  = {Compact Disc}
}
\DeclareAcronym{mc}{
short   = {MC},
long    = {Music Cassette},
tooltip = {my mouse-over text}
}

\begin{document}

\ac{cd} \ac{mc}\par\vspace{1cm}
\ac{cd} \ac{mc}

\aca{cd} \aca{mc}

\acs{cd} \acs{mc}

\end{document}

-
Hello @cgnieder I just realised you are the author of the acro package. I have been experimenting with your code which does not present the problem the \tooltip macro presents when integrated into the \ac redefinition (see my initial question's edit). It runs pretty smoothly though as feedback the first two things that I can offer for improvement are 1) the tooltip click box is smaller than the word itself, I think if it were slightly bigger it would be a feature that people would stumble across in a PDF more easily 2) the macro does not treat alternative \aca commands. I will offer more – Fiztban Feb 20 '14 at 21:39
I will keep you posted of any other feedback I can give while using the macro. Thank you for sharing it! I think it would be a lovely addition to the acro package. – Fiztban Feb 20 '14 at 21:42
@Fiztban I can't help with the tooltips themselves: they are created by the pdfcomment in my code. But the package provides lot's of options so it should be possible to customize the output. You could even use any other package to create the tooltips (or use AlexG's code) by changing the definition \cs_new_protected:Npn \acro_tooltip:nn #1#2 { \pdftooltip {#1} {#2} }. (My code above mainly provides an integration of a tooltip functionality into acro.) As for \aca: I'm aware of that. Also \acs and some others. The above is a draft of changes that could be integrated into acro – clemens Feb 20 '14 at 21:50
Thank you for explaining your code, I am learning a lot since last week when I started so I appreciate the time you have taken. My feedback was simply what I could offer with my beginners view of LaTeX, I will experiment with other tooltips though your code suits me perfectly for the time being. Thank you – Fiztban Feb 20 '14 at 23:04
@Fiztban I added support for \aca and \acs and friends – clemens Feb 21 '14 at 9:54

According to the Bitbucket issue tracker, for versions 2.0b or greater the code of clemens' answer reduces to:

\documentclass{article}
\usepackage{pdfcomment}

\usepackage{acro}
\ExplSyntaxOn
\acro_declare_simple_key:n {tooltip}

\cs_new_protected:Npn \acro_write_tooltip:nnn #1#2#3
{
\prop_get:NnNTF \l__acro_tooltip_prop {#1} \l__acro_tmpa_tl
{ \acro_tooltip:nV {#2} \l__acro_tmpa_tl }
{ \acro_tooltip:nn {#2} {#3} }
}
\cs_generate_variant:Nn \acro_write_tooltip:nnn { nnV }

% use whatever command you like for creating tooltips here:
% #1: printed text
% #2: tool tip text
\cs_new_protected:Npn \acro_tooltip:nn #1#2
{ \pdftooltip {#1} {#2} }
\cs_generate_variant:Nn \acro_tooltip:nn { nV }

\cs_set_protected:Npn \acro_write_compact:nn #1#2
{
\acro_get_ending_form:nn {#1} {#2}
\acro_acc_supp:nn
{#1}
{
\acro_write_tooltip:nnn
{#1}
{
\use:c {acro_write_#2:nv} {#1} {l__acro_#2_tl}
\acro_endings:nn {#1} {#2}
}
{ \l__acro_long_tl }
}
}
\ExplSyntaxOff

\DeclareAcronym{cd}{
short = {CD},
long  = {Compact Disc}
}
\DeclareAcronym{mc}{
short   = {MC},
long    = {Music Cassette},
tooltip = {my mouse-over text}
}

\begin{document}

\ac{cd} \ac{mc}\par\vspace{1cm}
\ac{cd} \ac{mc}

\aca{cd} \aca{mc}

\acs{cd} \acs{mc}

\end{document}

-
If you are who I think you are you seem to have two disctinct accounts, tex.stackexchange.com/users/85774 and tex.stackexchange.com/users/82471. The stackexchange staff can merge them for you: stackoverflow.com/help/merging-accounts – clemens Aug 31 '15 at 15:58
I dont know why but the code you just gave does not post mouse overs – Fiztban Sep 1 '15 at 21:55
@Fiztban I got it confirmed that mouse over tooltips are produced with above definition. It does not work for the first appearance of the acronyms due to a missing usage of \acro_write_compact:nn in acro. This will be fixed in the next release. – clemens Sep 7 '15 at 10:44
I now know why it wasn't working, the package was not updating even though MikTeX said it had been, a re-install and then a later manual update worked. – Fiztban Sep 8 '15 at 10:35

As of version 2.1, code can be reduced to

\documentclass{article}

\usepackage[tooltip]{acro}

\DeclareAcronym{cd}{
short = {CD},
long  = {Compact Disc}
}
\DeclareAcronym{mc}{
short   = {MC},
long    = {Music Cassette},
tooltip = {my mouse-over text}
}

\begin{document}

\ac{cd} \ac{mc}\par\vspace{1cm}
\ac{cd} \ac{mc}

\aca{cd} \aca{mc}

\acs{cd} \acs{mc}

\end{document}


I got mouse-overs in all eight cases.

See 256627 for the case of nested acronyms.

-
IMHO you should update your other answer instead of posting a new one – especially since the other answer is obsolete now. Do you really have three accounts? – clemens Sep 8 '15 at 10:28
So pdfcomment is no longer needed for this to work? – Fiztban Sep 8 '15 at 10:39
@Fiztban yes, it still is required. Have a look at my updated answer where I explain what v2.1 does – clemens Sep 8 '15 at 10:43