LaTeX Acronyms
Define once, use everywhere with auto first-use expansion. Two packages: acronym (simple) or glossaries (powerful).
The simple way: acronym package
\usepackage{acronym}
% Define acronyms (typically in preamble or beginning of document)
\begin{acronym}
\acro{NLP}{Natural Language Processing}
\acro{ML}{Machine Learning}
\acro{API}{Application Programming Interface}
\end{acronym}
\begin{document}
% In body text:
We use \ac{NLP} techniques. % first use: "Natural Language Processing (NLP) techniques"
Our \ac{NLP} pipeline... % later: "Our NLP pipeline..."
\acl{ML} % always long: "Machine Learning"
\acs{ML} % always short: "ML"
\acf{ML} % always full: "Machine Learning (ML)"
\acp{API} % plural: "APIs"
\end{document}The powerful way: glossaries package
\usepackage{glossaries}
\makeglossaries
% Define
\newacronym{NLP}{NLP}{Natural Language Processing}
\newacronym{ML}{ML}{Machine Learning}
\begin{document}
% In body
\gls{NLP} works well. % first: "Natural Language Processing (NLP) works well."
\gls{NLP} also... % later: "NLP also..."
\printglossaries % print the list
\end{document}
% Compile sequence:
% pdflatex → makeglossaries main → pdflatex → pdflatexAcronym package commands reference
| Command | Output for \acro{NLP}{Natural Language Processing} |
|---|---|
| \ac{NLP} | First use: "Natural Language Processing (NLP)"; later: "NLP" |
| \acs{NLP} | Always: "NLP" |
| \acl{NLP} | Always: "Natural Language Processing" |
| \acf{NLP} | Always: "Natural Language Processing (NLP)" |
| \acp{NLP} | Plural form: "NLPs" |
| \Ac{NLP} | Capitalized first letter (sentence start) |
| \acresetall | Reset first-use tracking (next \\ac shows full form again) |
Common patterns
List of acronyms at the front
% After abstract, before main body
\section*{List of Acronyms}
\begin{acronym}[XXXXX] % XXXXX is the longest acronym for tab stop
\acro{NLP}{Natural Language Processing}
\acro{ML}{Machine Learning}
\acro{API}{Application Programming Interface}
\end{acronym}
% Now \ac{NLP} works throughout the document and the list above is a referenceReset per chapter
\chapter{Introduction}
% \ac{NLP} expands fully here on first use
\acresetall % reset for next chapter
\chapter{Methods}
% \ac{NLP} expands fully again on first use hereCommon mistakes
- Defining acronyms inline. Define once in preamble, use everywhere. Don't mix definitions and use.
- Forgetting
\makeglossaries. Required when using the glossaries package; without it, no list appears. - Mixing
\acand\gls. They're different packages — pick one. - Hard-coding the expansion. Don't write "Natural Language Processing (NLP)" manually each first use — defeats the point of automation.
- Plural with manual 's'. Use
\acpfor plurals; don't write\ac{NLP}s(would render as "Natural Language Processings" on first use, which is wrong).
Typst doesn't have a built-in acronym package, but you can write a small function: #let acronym(short, long) = state(short, true).update(false). Or use the @preview/acrostiche community package.
Frequently Asked Questions
Two main packages. (1) acronym (simpler): \usepackage{acronym}, \begin{acronym} \acro{NLP}{Natural Language Processing} \end{acronym}. Use with \ac{NLP}. (2) glossaries (more powerful): \newacronym{NLP}{NLP}{Natural Language Processing}, use with \gls{NLP}. Both auto-expand on first use.
First time you write \ac{NLP} (acronym package) or \gls{NLP} (glossaries), it expands to 'Natural Language Processing (NLP)'. Subsequent uses produce just 'NLP'. The package tracks first use automatically — you don't manage the state yourself.
The acronym package. \usepackage{acronym}, then \begin{acronym} \acro{NLP}{Natural Language Processing} \acro{ML}{Machine Learning} \end{acronym}. Use with \ac{NLP} in body text. Variants: \acs{NLP} (always short), \acl{NLP} (always long), \acf{NLP} (always full form). Less powerful than glossaries but enough for many papers.
With acronym package: \printacronyms or wrap definitions in \begin{acronym}[longest_label] ... \end{acronym} where the list prints in document order. With glossaries: \printglossaries (after running makeglossaries). Lists appear sorted alphabetically by default with glossaries.
Reset first-use tracking with \acresetall (acronym package) or \glsresetall (glossaries). Useful when each chapter should have its own first-use expansion. Place at chapter starts or before specific sections.
acronym package: \acp{NLP} produces 'NLPs' (with s). \acfp{NLP} for full plural. glossaries: \glspl{NLP} for plural. For irregular plurals (acronyms ending in s), specify: \newacronym[plural=Mice]{mouse}{mice}{the rodent}.
Wrap in extra braces: \acro{H2SO4}{Sulfuric Acid (H\textsubscript{2}SO\textsubscript{4})}. For math content: \acro{D}{Distance ($d$)}. The expansion text accepts any LaTeX commands.
acronym package: \begin{acronym}[XXXXX] where XXXXX is the longest expected acronym (sets indent). Gives clean tabbed list. glossaries: \setglossarystyle{altlist} or \setglossarystyle{long} for different layouts. Many built-in styles available.
Quick rule: just acronyms? Use acronym. Acronyms PLUS terminology glossary PLUS symbol list? Use glossaries. acronym is one-package-one-purpose simple. glossaries is the swiss army knife. For a typical paper with 5-10 acronyms, acronym package is enough.