# Acronyms with an arrow in front of them

I'm using the acronyms package and I wonder if there's an easy way of marking acronyms as such by putting an arrow in front of them?

-
Where should the arrow appear (in the text, in the list of acronyms)? –  Gonzalo Medina May 2 '11 at 20:02
Should appear in front of the acronym (in the text) to indicate the acronym –  tim May 2 '11 at 20:18

It's a somehow unusual request. I assume that the arrow should appear between the full name and the short form of the acronym when using the \ac command. In the following example code I show how to proceed. The idea is to redefine the internal command \@ac; this implies the definition of a series of commands similar to \acf, \acf*, and \acfa to actually typeset the arrow:

\documentclass{article}
\usepackage[printonlyused,withpage]{acronym}

\makeatletter
% similar to \acf and relatives but adding an arrow between the full name and the short form
\newcommand*{\Arracf}{\AC@starredfalse\protect\Arracfa}%
\WithSuffix\newcommand\Arracf*{\AC@starredtrue\protect\Arracfa}%
\newcommand*{\Arracfa}[1]{%
\texorpdfstring{\protect\@Arracf{#1}}{\AC@acl{#1} (#1)}}
\newcommand*{\@Arracf}[1]{%
\ifAC@footnote
\acsfont{\AC@acs{#1}}%
\footnote{\AC@placelabel{#1}\AC@acl{#1}{}}%
\else
\acffont{%
\AC@placelabel{#1}\AC@acl{#1}%
$\rightarrow$\nolinebreak[3]\acfsfont{(\acsfont{\AC@acs{#1}})}%
}%
\fi
\ifAC@starred\else\AC@logged{#1}\fi}

%modification of \@ac to use \Arracf (which includes the arrow)
\renewcommand{\@ac}[1]{%
\ifAC@dua
\ifAC@starred\acl*{#1}\else\acl{#1}\fi%
\else
\expandafter\ifx\csname ac@#1\endcsname\AC@used%
\ifAC@starred\acs*{#1}\else\acs{#1}\fi%
\else
\ifAC@starred\Arracf*{#1}\else\Arracf{#1}\fi%
\fi
\fi
}
\makeatother

\begin{document}

\section{Intro}
In the early nineties, \ac{GSM} was deployed in many European
countries. \ac{GSM} offered for the first time international
roaming for mobile subscribers. The \ac{GSM}'s use of \ac{TDMA} as
its communication standard was debated at length. And every now
and then there are big discussion whether \ac{CDMA} should have
been chosen over \ac{TDMA}.

\begin{acronym}[TDMA]
\acro{CDMA}{Code Division Multiple Access}
\acro{GSM}{Global System for Mobile communication}
\acro{TDMA}{Time Division Multiple Access}
\end{acronym}

\end{document}


Disclaimer: I am not sure that the above code will behave as expected with all the variations of commands provided by the acronym package.

EDIT: the code below redefines \ac to automatically prepend an arrow for all usages of an acronym except the first (as requested in the comments):

\documentclass{article}
\usepackage[printonlyused,withpage]{acronym}

\makeatletter
%modification of \@ac to include an arrow for every use except the first
\renewcommand{\@ac}[1]{%
\ifAC@dua
\ifAC@starred\acl*{#1}\else\acl{#1}\fi%
\else
\expandafter\ifx\csname ac@#1\endcsname\AC@used%
\ifAC@starred\acs*{#1}\else\mbox{$\rightarrow$\acs{#1}}\fi%
\else
\ifAC@starred\Arracf*{#1}\else\acf{#1}\fi%
\fi
\fi
}
\makeatother

\begin{document}

\section{Intro}
In the early nineties, \ac{GSM} was deployed in many European
countries. \ac{GSM} offered for the first time international
roaming for mobile subscribers. The \ac{GSM}'s use of \ac{TDMA} as
its communication standard was debated at length. And every now
and then there are big discussion whether \ac{CDMA} should have
been chosen over \ac{TDMA}.

\begin{acronym}[TDMA]
\acro{CDMA}{Code Division Multiple Access}
\acro{GSM}{Global System for Mobile communication}
\acro{TDMA}{Time Division Multiple Access}
\end{acronym}

\end{document}


-
OKay thanks that looksp retty cool so I'll look into it further :) –  tim May 3 '11 at 9:40
Okay I tried myself to get it to work in another way, but I couldn't: What I want is the following: When an Acronym is used for the first time in the text, just display it as usual (e.g. "Graphics Processing Unit (GPU)") and for all upcoming usages of the acronym, display it not only as acronym itself (e.g. this would be "GPU"), but also prepend an arrow for all usages except the first. Thanks a lot so far! –  tim May 3 '11 at 9:53
@bjoern: I've added a second example to my answer showing how to achieve what you requested. –  Gonzalo Medina May 3 '11 at 12:10
Thanks so far, the only thing about it is: You always have to check yourself wether the acronym was already used or not. I thought this could be easier archieved automatically! –  tim May 3 '11 at 17:18
@bjoern: I've modified my second example code, so that now you can simply use (the redefined version of) \ac to automatically prepend the arrow every time the acronym is used except the first time. –  Gonzalo Medina May 3 '11 at 17:29