hyperref (optional) before \usepackage[acronym]{glossaries}, call \makeglossaries in the preamble, define entries with \newglossaryentry and \newacronym, cite them in the text with \gls{key}, and print the lists with \printglossary and \printglossary[type=\acronymtype,title=Acronyms]. Compile with pdflatex, run makeglossaries, and run pdflatex twice more—or use \makenoidxglossaries or the acronym package when you want to avoid an external tool pass.
Basic glossary and acronym list
Pass theacronym option to glossaries to create a separate acronym list alongside the main glossary. (Without [acronym], \newacronym still works, but entries go into the main glossary and \acronymtype refers to main.) When using hyperlinks, load hyperref before glossaries so \gls{...} references become clickable links to the glossary.
glossary-basic.tex
Ready to use this syntax? Continue in the browser editor when you want to adapt the example in a real project.Open LaTeX Cloud Studio
On first use, \gls{api} prints the long form followed by the short form in parentheses: Application Programming Interface (API). Subsequent \gls{api} calls print only API. Each printed list sorts entries alphabetically and appends the page numbers where each entry appeared.
Defining and referencing entries
Define glossary terms in the preamble with\newglossaryentry{label}{name={...}, description={...}}. Add plural={...} whenever the plural does not follow the default rule of appending s (for example, name=matrix, plural=matrices). Define abbreviations with \newacronym{label}{short}{long}.
In the document body, choose the command that matches the case, number, or expansion you need:
With
[acronym], you can print the acronym list with \printacronyms (equivalent to \printglossary[type=\acronymtype], titled Acronyms), or print every defined glossary in one call with \printglossaries. Pass package options nonumberlist to omit page numbers and nopostdot to remove the trailing period after each description.
glossary-commands.tex
Build sequence and sorting without makeglossaries
With \makeglossaries and \printglossary, run four commands locally on the command line:
pdflatex run writes the unsorted glossary files (.glo, .acn) and style file (.ist). makeglossaries (a Perl script; makeglossaries-lite is a Lua alternative when Perl is not installed) runs makeindex on each glossary to produce .gls and .acr. The two follow-up pdflatex passes insert the formatted lists and settle page numbers and hyperlinks.
If your build environment does not run makeglossaries, replace \makeglossaries with \makenoidxglossaries and \printglossary with \printnoidxglossary. TeX then sorts the entries itself across normal pdflatex passes with no external tool required (slower on large glossaries and limited to basic ASCII alphabetical order rather than locale collation, so accented letters such as é sort after z):
glossary-noidx.tex
glossaries and acronym are pre-installed. Because LaTeX Cloud Studio does not configure an automatic makeglossaries rule in its build pipeline, use \makenoidxglossaries with \printnoidxglossary—or the acronym package below—when compiling directly in the browser editor.
Lightweight alternative: the acronym package
When a paper or thesis only needs an abbreviation list (no separate term definitions and no automatic sorting), the acronym package requires only two pdflatex passes and no external tool.
List your abbreviations in display order inside
\begin{acronym}[WIDEST], where WIDEST sets the label column width. Pass [printonlyused] to hide entries that are never referenced in the text (below, HTML is defined to set the column width but omitted from the printed list).
acronym-package.tex
Common mistakes
- Loading
hyperrefafterglossaries:glossarieschecks whetherhyperrefis already loaded when\usepackage{glossaries}executes. Loadinghyperrefafterwards produces no error, but silently disables clickable glossary links. Always loadhyperrefbeforeglossaries. - Forgetting
\makeglossaries: Without\makeglossaries, no.istor.glofile is written andmakeglossariesfails withNo \@istfilename found in 'main.aux'.andDid you remember to use \makeglossaries?. - Unused entries missing from the glossary:
glossariesonly prints entries referenced via\gls{...}(or its variants). Add\glsadd{key}for a specific term or\glsaddallto include every defined entry. - Forgetting to run
makeglossaries: Runningpdflatexalone with\makeglossariescompletes without error, but omits the glossary because.glsand.acrdo not exist. Runmakeglossaries <jobname>followed bypdflatextwice, or switch to\makenoidxglossaries.
Related pages
- Creating indexes in LaTeX
- Hyperlinks in LaTeX
- Table of contents
- Cross-referencing
- Bibliography management with BibTeX
main.tex with the complete example (glossary-noidx.tex or acronym-package.tex).