Use of starred \ac commands in the acronym package

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}

enter image description here

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".


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:

enter image description here

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}

Tags:

Acronyms