# Use of starred \ac commands in the acronym package

I'm trying to use the starred commands for the acronym package, i.e. \ac*, \acs*, \acl*, etc.

But, I can't seem to get the package not to set the AC@used flag (which I believe is used by the acronym package to track commands that are used in the document.

Below is a minimum working example:

\documentclass{article}

\usepackage{acronym}
\newacro{TMN}{This Means Nothing}

\begin{document}

First use works as intended:

\ac*{TMN}

But the acronym is still marked as used:

\ac*{TMN}

\end{document}


The end result is something like this:

First use works as intended:

This Means Nothing (TMN)

But the acronym is still marked as used:

TMN

Any ideas? Or should I switch to the glossaries package?

-
The using of the glossaries package is alway a good idea. One advantages is the automatic sorting of the entries. –  Marco Daniel Oct 7 '11 at 13:32
Welcome to TeX.SE. Thanks for providing a MWE as that saved me some time. –  Peter Grill Oct 16 '11 at 0:37
I think that you've misunderstood the meaning of the starred versions; see my answer. Anyway, glossaries is a much more powerful package so (as Marco said) it might be a good idea to use it.. –  Gonzalo Medina Oct 16 '11 at 1:00

It appears as we have both misinterpreted the meaning of \ac* as I too interpreted the documentation the same way. As per @GonzaloMedina's comment:

The starred versions only control if the acronym should appear in the acronyms list or not; the starred versions do not control how the acronym appears in the body of the document.

However, one way to get the desired behavior is to redefine \@ac which is copied from the acronym package, and insert a \AC@reset{#1} call in three places which seems to produce the desired results:

Note that you could use \acf to always get the full name as well.

\documentclass{article}
\usepackage{acronym}

\makeatletter
\renewcommand{\@ac}[1]{%
\ifAC@dua
\ifAC@starred\acl*{#1}\AC@reset{#1}\else\acl{#1}\fi%
\else
\expandafter\ifx\csname ac@#1\endcsname\AC@used%
\ifAC@starred\acs*{#1}\AC@reset{#1}\else\acs{#1}\fi%
\else
\ifAC@starred\acf*{#1}\AC@reset{#1}\else\acf{#1}\fi%
\fi
\fi}
\makeatother

\newacro{TMN}{This Means Nothing}
\newacro{DMS}{Does Means Something}

\begin{document}
1st use works as intended: \ac*{TMN}\par
2nd use works as intended: \ac{TMN}\par
3nd use works as intended: \ac{TMN}\par
\medskip
1st use works as intended: \ac{DMS}\par
2nd use works as intended: \ac{DMS}\par
\end{document}

-
I think that there's a misunderstanding. The starred versions only control if the acronym should appear in the acronyms list or not; the starred versions do not control how the acronym appears in the body of the document. –  Gonzalo Medina Oct 16 '11 at 1:02
@GonzaloMedina: Thanks that makes sense. I have included your comments in the answer so it is not missed when others come across this. –  Peter Grill Oct 16 '11 at 1:13

As I understand it, the starred versions don't mark an acronym as "used", but only to control if the acronym should be shown or not when the printonlyused option has been used; in every other aspect they act the same as the unstarred versions. For example: the following code won't print the acronym TMN in the list of acronyms, although for both acronyms, the first time they appear in the document, you'll see the description and the acronym, and the second time you will only see the acronym:

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

\begin{document}

\ac*{TMN}\ac*{TMN}

\ac{TMS}\ac{TMS}

\begin{acronym}
\acro{TMN}{This Means Nothing}
\acro{TMS}{This Means Something}
\end{acronym}

\end{document}


So the meaning of a starred versions is: "use it always for each occurrence of an acronym to prevent it from appearing in the list of acronyms".

-
Thanks, looks like I misinterpreted the documentation. The answer provided by @PeterGrill works perfectly. –  gandalfmuaddib Oct 22 '11 at 13:11