Multiple Glossaries

Previous: Glossaries and lists.

You may have as many glossaries, lists of symbols or lists of abbreviations as you like in your document. Each glossary has an associated label that can be used to reference it. The default is to just have one glossary (labelled main). When you define an entry, you can specify which glossary it belongs to using the type key in the second argument of \newglossaryentry (or the optional argument for commands like \newacronym or \newabbreviation). If omitted, \newglossaryentry assumes type=\glsdefaulttype (where \glsdefaulttype is initially set to main).

You can add a list of acronyms using the acronym package option:


(You can also use acronyms instead of acronym.) This will create a new glossary with the label “acronym”. You can reference the list of acronyms with \acronymtype. This command is initialised to \glsdefaulttype and is redefined by the acronym/acronyms option to “acronym”. This makes it easier to switch between having a separate list of acronyms or just using the default main glossary.

Any acronyms defined using \newacronym will automatically be added to the list of acronyms rather than the main glossary if the acronym/acronyms package option is used.

If you use glossaries-extra, then the abbreviations package option works in a similar manner:


Any abbreviations defined using \newabbreviation (or \newacronym) will automatically be added to the list of abbreviations. You can even use both options with glossaries-extra:


Now, any abbreviations defined using \newabbreviation will be added to the abbreviations glossary and any defined with \newacronym will be added to the acronym glossary. You can use \acronymtype (which is internally used by \newacronym) to reference the list of acronyms and you can use \glsxtrabbrvtype to reference the list of abbreviations. There are some other options for common types of lists: symbols, numbers and index. These options are available for both glossaries and glossaries-extra, but with glossaries-extra, the symbols option will additionally define


which is equivalent to


The symbol-code argument is the LaTeX code to produce the required symbol. For example:

\glsxtrnewsymbol[description={ratio of circumference of circle to its diameter}]{pi}{\ensuremath{\pi}}

is equivalent to:

  description={ratio of circumference of circle to its diameter}}

The numbers package option (with glossaries-extra) will also define:


which is equivalent to


Note that this has slightly different syntax. Here the name defaults to the label. For example:


This is equivalent to:


If the number contains any LaTeX code then you will need to add the name key to the optional argument. For example:

\glsxtrnewnumber[description={Pythagoras' constant},name={\ensuremath{\surd 2}}]{root2}

If you need an additional glossary, for example a list of units, you need to define it using:


The glossary-label argument is a label that uniquely identifies this glossary. Again, it is best to use non-active characters such as alphanumerics (a–z, A–Z, 0–9) in the label. The title is used as the section or chapter header for that glossary.

The remaining arguments specify the extensions for the files that contain the glossary information. The in-ext argument indicates the extension of the file that is created by the indexing application. This file is read in by the glossaries package’s \printglossaries command, but obviously it can only be read once it has been created by the indexing application. (This is covered in more detail below.) The out-ext argument indicates the extension of the file that is read in by the indexing application and written out by the glossaries package. The first optional argument log-ext is the extension for the indexing transcript file.

Take care that you don’t use any extensions that might already be in use. There’s a starred version:


which sets the extensions to glossary-label-glg, glossary-label-gls and glossary-label-glo which makes it more convenient for removing these temporary files if you are able to use wildcards. For example, in Unix-like operating systems

rm *.*-{glg,gls,glo}

will remove all the temporary glossary input and output files.

This starred version (\newglossary*) is also useful if you are using \printnoidxglossary or \printunsrtglossary, which don’t require any additional files (and so the extensions are irrelevant).

Each glossary creates associated resources, so if you don’t want the main glossary, you can prevent these unnecessary resources from being used with the nomain package option, but you must provide an alternative glossary either implicitly (through packages options like symbols, acronyms or abbreviations) or explicitly (using \newglossary).

Don’t use the nomain package option if you need the main glossary.

This may sound obvious, but from time to time users copy and paste example code without realising what the package options do. If you try to define any entries when there are no defined glossaries, you’ll get the following error message:

No default glossary type
There is a second optional argument to \newglossary that isn’t covered here. See the section Defining New Glossaries in the manual for further details.

For example, suppose I want to create a list of units. I can define a glossary labelled “units” as follows:

\newglossary[glg-u]{units}{gls-u}{glo-u}{List of Units}

(the file extensions are .glg-u, .gls-u and .glo-u) or just

\newglossary*{units}{List of Units}

(the file extensions are .units-glg, .units-gls and .units-glo).

When I define an entry to go in this glossary, I need to use the type key to specify the glossary label. For example:

  description={unit of electrical resistance}}

Remember that the type and category keys are independent of each other, so I might also do (with glossaries-extra):

  description={unit of electrical resistance}}

As mentioned earlier, if the type key is omitted, \glsdefaulttype (the default glossary) is assumed. If you load entries from a file using \loadglsentries, you can assign all the entries to a particular glossary using the optional argument, but you must set the type to \glsdefaulttype if you are using commands like \newacronym or \newabbreviation.

For example, if you have a file called myabbrevs.tex:

\newacronym[type=\glsdefaulttype]{led}{LED}{light-emitting diode}

Then you can put the following, for example, in the preamble:




Note the use of \makeglossaries, which must come after \newglossary, but should come before any entry definitions. This is discussed next.

All entries must be assigned to a defined glossary. If you have some terms that are so common that they don’t require listing then you can define an “ignored glossary” using:


For example:

\newacronym[type=common]{html}{HTML}{hypertext markup language}

Next part: Glossaries with makeindex or xindy