Using the correct indefinite article with acronyms and their full forms

I am using the acronym package so as to automatically expand acronyms when they are first used. For example, I can simply type \ac{RMS}, and LaTeX automatically expands this to "Resource Management System (RMS)" or "RMS".

However, a problem occurs when using indefinite articles. The most common style, Abbreviation verbalised, requires the use of "a Resource" and "an RMS". Is there an easy way to deal with this in LaTeX?

Otherwise, have you seen articles where they use Word verbalised style?

-

2 Answers

You can use the test that \ac uses to test for first use but make it make other texts, an and a here: (Please in future provide a working example, it would have made it much easier to answer).

\documentclass{article}

\usepackage{acronym}

\newacro{RMS}[RMS]{Resource Management System}

\makeatletter
\def\acrousedTF#1{%
\expandafter\ifx\csname ac@#1\endcsname\AC@used%
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi}
\makeatother

\begin{document}

zzzz \acrousedTF{RMS}{an}{a} \ac{RMS}  zzzz \acrousedTF{RMS}{an}{a}  \ac{RMS}
\end{document}

-
I guess you could save yourself some keystrokes defining \def\acart#1{\acrousedTF{#1}{an}{a} \ac{#1}} –  Seamus Jul 17 '12 at 22:17

This feature is available directly in the acronym package and I assume this was not the case when your question and David Carlisle's answer were posted. As you use \newacro (as opposed to \acro and \acrodef; see your linked PDF for the differences), David's example can be changed to

\documentclass{article}

\usepackage{acronym}

\newacro{RMS}[RMS]{Resource Management System}
\newacroindefinite{RMS}{an}{a}

\begin{document}

zzzz \iac{RMS}  zzzz \iac{RMS}
\end{document}


This gives you the same output as David's code and now you can simply use \iac and \Iac for lower and upper case indefinite articles. Note that - as far as I know - no special commands for forced formats like \acf, \acl, \acs come with the package.

Update: Note that using the acronym package with hyperref will make the indefinite article AND the acronym hyperrefs to the table of acronyms when using \iac. Further, also when using hyperref, there seems to be a bug when using \Iac multiple times on the same acronym that gives compiler errors. You can use this fix to get rid of these problems.

-