An Acronym Environment for L^{A}TEX 2ε^{∗}

Tobias Oetiker

March 10, 1999

1 Introduction

When writing a paper on cellular mobile radio I started to used a lot of acronyms. This can be very disturbing for the reader, as he might not know all the used acronyms. To help the reader I kept a list of all the acronyms at the end of my paper.

This package makes sure, that all acronyms used in the text are spelled out in full at least once.

2 The user interface

The package provides several commands and one environment for dealing with acronyms.

2.1 Acronyms in the Text

\ac To enter an acronym inside the text, use the

\ac{acronym}

command. The first time you use an acronym, the full name of the acronym along with the acronym in brackets will be printed. If you specify the footnote option while loading the package, the full name of the acronym is printed as a footnote. The next time you access the the acronym only the acronym will be printed.

\acf If later in the text again the Full Name of the acronym should be printed, use the command

\acf{acronym}

to access the acronym. It stands for “acronym full” and it always prints the full name and the acronym in brackets.

\acs To get the short version of the acronym, use the command

\acs{acronym}

\acl Gives you the expanded Acronym without even mentioning the acronym.

\acl{acronym}

∗This file has version v1.3 last revised 1996/09/19

2.2 Defining Acronyms

acronym With the acronym environment you define all the acronyms used throughout your

document. It is possible to add a longer description to each acronym definition. \acro In the acronym environment, acronyms are defined with the

\acro{acronym}{Full Name} Explanation

command. As a whole it accts like \item[acronym]Full Name Explanation in the description environment. All acronym definitions are added to the .aux file. Therefore they are available from start-up in the next run. And the acronym definitions can be anywhere in the text.

\acrodef If you want to define acronyms which do not appear in the acronym environment, you can use the

\acrodef{acronym}{Full Name}

command. Acronyms defined with \acrodef are also saved in the .aux file.

3 An example file

1 ⟨∗acrotest⟩

 2 \documentclass{article}
 3 \usepackage{acronym}
 4 \begin{document}
 5 \section{Intro}
 6 In the early nineties, \acs{GSM} was deployed in many European
 7 countries. \ac{GSM} offered for the first time international
 8 roaming for mobile subscribers. The \acs{GSM}'s use of \ac{TDMA} as
 9 its communication standard was debated at length. And every now
10 and then there are big discussion whether \ac{CDMA} should have
11 been chosen over \ac{TDMA}.

12

13 If you want to know more about \acf{GSM}, \acf{TDMA}, \acf{CDMA}
14 and \ac{oa}, just read a book about mobile communication.
15 \section{Acronyms}
16 \begin{acronym}
17 \acro{GSM}{Global System for Mobile communication}.
18  \acs{GSM} is the new standard for digital cellular
19  communication in Europe.
20 \acro{TDMA}{Time Division Multiple Access}.
21  Some would say, that this is not as good as \ac{CDMA}.
22 \acro{CDMA}{Code Division Multiple Access}. The spread spectrum
23  modulation used in the Qualcomm system.
24 \acrodef{oa}{other acronyms}
25 \end{acronym}
26 \end{document}

27 ⟨/acrotest⟩

4 The implementation

First we test that we got the right format and name the package.

28 ⟨∗acronym⟩

29 \NeedsTeXFormat{LaTeX2e}[1994/06/01]
30 \ProvidesPackage{acronym}

Define you acronyms with \acrodef{acronym}{Full Name}

31 \newcommand{\newacro}[2]{\expandafter\gdef\csname fn@#1\endcsname{#2}}
32 \newcommand{\acrodef}[2]{

\exandafter first expands the commands after the \def and then executes

\def

The acronym definition is also written to .aux.

33 \newacro{#1}{#2}%
34 \write\@auxout{\string\newacro{#1}{#2}}%

35 }

I like to have a list off all acronyms I used in my document. Therefore you can define you acronyms inside the acronym environment. Not only stating the name of the acronym, but optionally also giving an explanation on it.

 \begin{acronym}
 \acro{CDMA}{Code Division Multiple Access}. The Qualcomm thing
 \end{acronym}

36 \newenvironment{acronym}%
37 {\begin{description}
38  \providecommand{\acro}[2]{%
39  \acrodef{##1}{##2}%
40  \item[##1] ##2}}
41 {\end{description}}

This is to get just the acronym. If it is not defined, tha acronym is printed fat with an exclamation mark at the end.

42 \newcommand{\acs}[1]{%
43 \expandafter\ifx\csname fn@#1\endcsname\relax%
44 \textbf{#1!}%
45 \PackageWarning{acronym}{Acronym `#1' is not defined}%
46 \expandafter\gdef\csname fn@#1\endcsname{\textbf{#1!}}
47 \else%
48 #1%
49 \fi}

The first time an acronym is accessed its Full Name (FN) is printed. The next time just (FN). This is done by \gdefineing the \ac@FN to x after its first use. \acf always prints the Full Name (FN).

50 \newcommand{\acf}[1]%
51 {\csname fn@#1\endcsname{}\nolinebreak[3] (\acs{#1})}%
52 \DeclareOption{footnote}{%
53 \renewcommand{\acf}[1]%
54 {\acs{#1}\footnote{\csname fn@#1\endcsname}}%

55 }

56 \newcommand{\acl}[1]{\csname fn@#1\endcsname{}}%

57 \ProcessOptions
58 \newcommand{\ac}[1]{%
59 \expandafter\ifx\csname ac@#1\endcsname\relax%
60 \acf{#1}%
61 \expandafter\gdef\csname ac@#1\endcsname{x}%
62 \else%
63 \acs{#1}%
64 \fi}
65 \endinput

66 ⟨/acronym⟩