User Manual for glossaries.sty v4.55
Nicola L.C. Talbot
dickimaw-books.com/contact
2024-11-01

Abstract
The glossaries package provides a means to define terms or acronyms or symbols that can be referenced within your document. Sorted lists with collated locations can be generated either using TeX or using a supplementary indexing application. Sample documents are provided with the glossaries package. These are listed in §18.

Additional features not provided here may be available through the extension package glossaries-extra which, if required, needs to be installed separately. New features will be added to glossaries-extra. Versions of the glossaries package after v4.21 will mostly be just bug fixes or minor maintenance. The most significant updates to the glossaries package since then is version 4.50, which involved the integration of mfirstuc v2.08 and the phasing out the use of the now deprecated textcase package, and version 4.55, which involved the integration of datatool-base v3.0.

Note that glossaries-extra provides an extra indexing option (bib2gls) which isn’t available with just the base glossaries package.

If you require multilingual support you must also install the relevant language module. Each language module is called glossaries-language, where language is the root language name. For example, glossaries-french or glossaries-german. If a language module is required, the glossaries package will automatically try to load it and will give a warning if the module isn’t found. See §1.5 for further details. If there isn’t any support available for your language, use the nolangwarn package option to suppress the warning and provide your own translations. (For example, use the title key in \printglossary.)

Documents have wide-ranging styles when it comes to presenting glossaries or lists of terms or notation. People have their own preferences and to a large extent this is determined by the kind of information that needs to go in the glossary. They may just have symbols with terse descriptions or they may have long technical words with complicated descriptions. The glossaries package is flexible enough to accommodate such varied requirements, but this flexibility comes at a price: a big manual.

😱 If you’re freaking out at the size of this manual, start with “The glossaries package: a guide for beginners”. You should find it in the same directory as this document or try

texdoc glossariesbegin
Once you’ve got to grips with the basics, then come back to this manual to find out how to adjust the settings.

The glossaries bundle includes the following documentation:

The glossaries package: a guide for beginners
If you want some brief information and examples to get you going, start with the guide for beginners.

User Manual for glossaries.sty (glossaries-user.pdf)

This document is the manual for the glossaries package and is divided into two parts: Part I is the user guide that describes all available commands and options with examples. Part II has alphabetical summaries of those commands and options for quick reference.

Documented Code for glossaries (glossaries-code.pdf)

Advanced users wishing to know more about the inner workings of all the packages provided in the glossaries bundle should read “Documented Code for glossaries v4.55”.

CHANGES
Change log.

README.md

Package summary.

Depends.txt

List of all packages unconditionally required by glossaries. Other unlisted packages may be required under certain circumstances. For help on installing packages see, for example, How do I update my TeX distribution? or (for Linux users) Updating TeX on Linux.

Related resources:

If you use hyperref and glossaries, you must load hyperref first (although, in general, hyperref should be loaded after other packages).

List of Tables[link]

List of Examples[link]

If an example shows the icon 📥🖹 then you can click on that icon to try downloading the example source code from a location relative to this document. You can also try using:

texdoc -l glossaries-user-examplennn
where nnn is the example number zero-padded to three digits to find out if the example files are installed on your device.

I. User Guide[link]

1. Introduction[link]

\usepackage[options]{glossaries}

The glossaries package is provided to assist generating lists of terms, symbols or acronyms. For convenience, these lists are all referred to as glossaries in this manual. The terms, symbols and acronyms are collectively referred to as glossary entries.

The package has a certain amount of flexibility, allowing the user to customize the format of the glossary and define multiple glossaries. It also supports glossary styles that include an associated symbol (in addition to a name and description) for each glossary entry.

There is provision for loading a database of glossary entries. Only those entries indexed in the document will be displayed in the glossary. (Unless you use Option 5, which doesn’t use any indexing but will instead list all defined entries in order of definition.)

It’s not necessary to actually have a glossary in the document. You may be interested in using this package just as means to consistently format certain types of terms, such as acronyms, or you may prefer to have descriptions scattered about the document and be able to easily link to the relevant description (Option 6).

Example 1 demonstrates a basic document without a glossary. For simplicity, the article class is used and the only package loaded is glossaries. Note that the terms must be defined before they can be referenced in the document:
\documentclass{article}
\usepackage[
  sort=none % no sorting or indexing required
]
{glossaries}

\newglossaryentry
 {cafe}% label
 {% definition:
   name={café},
   description={small restaurant selling
refreshments}
 }

\setacronymstyle{long-short}
\newacronym
 {html}% label
 {HTML}% short form
 {hypertext markup language}% long form

\newglossaryentry
 {pi}% label
 {% definition:
   name={\ensuremath{\pi}},
   description={Archimedes' Constant}
 }

\newglossaryentry
 {distance}% label
 {% definition:
   name={distance},
   description={the length between two points},
   symbol={m}
 }

\begin{document}
First use: \gls{cafe}, \gls{html}, \gls{pi}.
Next use: \gls{cafe}, \gls{html}, \gls{pi}.

\Gls{distance} 
(\glsentrydesc{distance}) 
is measured in \glssymbol{distance}.
\end{document}
(This is a trivial example. For a real document I recommend you use siunitx for units.)
Example 1: Simple document with no glossary 📥🖹 📥🖺

Example document that defines some glossary entries and references them in the text..

The glossaries-extra package, which is distributed as a separate bundle, extends the capabilities of the glossaries package. The simplest document with a glossary can be created with glossaries-extra (which internally loads the glossaries package). Example 2 demonstrates this:
\documentclass{article}
\usepackage[
 sort=none,% no sorting or indexing required
 abbreviations,% create list of abbreviations
 symbols,% create list of symbols
 postdot, % append a full stop after the descriptions
 stylemods,style=index % set the glossary style
]{glossaries-extra}

\newglossaryentry % glossaries.sty
 {cafe}% label
 {% definition:
   name={café},
   description={small restaurant selling
refreshments}
 }

\setabbreviationstyle{long-short}% glossaries-extra.sty

\newabbreviation % glossaries-extra.sty
 {html}% label
 {HTML}% short form
 {hypertext markup language}% long form

% requires glossaries-extra.sty 'symbols' option

\glsxtrnewsymbol 
 [description={Archimedes' constant}]% options
 {pi}% label
 {\ensuremath{\pi}}% symbol

\newglossaryentry % glossaries.sty
 {distance}% label
 {% definition:
   name={distance},
   description={the length between two points},
   symbol={m}
 }

\begin{document}
First use: \gls{cafe}, \gls{html}, \gls{pi}.
Next use: \gls{cafe}, \gls{html}, \gls{pi}.

\Gls{distance} is measured in \glssymbol{distance}.
\printunsrtglossaries % list all defined entries
\end{document}

Example 2: Simple document with unsorted glossaries 📥🖹 📥🖺

Example document that defines some glossary entries, references them in the text, and displays three simple unsorted glossaries..

Note the difference in the way the abbreviation (HTML) and symbol (\(\pi \)) are defined in the two above examples. The abbreviations, postdot and stylemods options are specific to glossaries-extra. Other options are passed to the base glossaries package.

In this user manual, commands and options displayed in tan, such as \newabbreviation and stylemods, are only available with the glossaries-extra package. There are also some commands and options (such as \makeglossaries and symbols) that are provided by the base glossaries package but are redefined by the glossaries-extra package. See the glossaries-extra user manual for further details of those commands.

One of the strengths of the glossaries package is its flexibility, however the drawback of this is the necessity of having a large manual that covers all the various settings. If you are daunted by the size of the manual, try starting off with the much shorter guide for beginners.

There’s a common misconception that you have to have Perl installed in order to use the glossaries package. Perl is not a requirement (as demonstrated by the above examples). It’s only required if you want to use xindy or makeglossaries. Perl is used by other TeX-related applications, such as latexmk, so you may already have it installed. If you want to use bib2gls, you will need to have the Java runtime environment installed. Java is used by other TeX-related applications, such as arara and JabRef, so you may already have it installed.

This user manual uses the glossaries-extra package with bib2gls (Option 4). For example, when viewing the PDF version of this document in a hyperlinked-enabled PDF viewer (such as Adobe Reader or Okular) if you click on the word indexing you’ll be taken to the entry in the main glossary where there’s a brief description of the term. This is the way that the glossaries mechanism works. An indexing application (bib2gls in this case) is used to generate the sorted list of terms. The indexing applications are CLI tools, which means they can be run directly from a command prompt or terminal, or can be integrated into some text editors, or you can use a build tool such as arara to run them.

In addition to standard glossaries, this document has “standalone” definitions (Option 6). For example, if you click on the command \gls, the hyperlink will take you to the main part of the document where the command is described. The index and summaries are also glossaries. The technique used is too complicated to describe in this manual, but an example can be found in bib2gls: Standalone entries and repeated lists (a little book of poisons)” TUGboat, Volume 43 (2022), No. 1.

Neither of the above two examples require an indexing application. The first is just using the glossaries package for consistent formatting, and there is no list. The second has lists but they are unsorted (see Option 5).

The remainder of this introductory section covers the following:

In addition to the examples provided in this document, there are some sample documents provided with the glossaries package. They are described in §18.

1.1. Rollback[link]

The following rollback releases are available:

If you rollback using latexrelease to an earlier date, then you will need to specify v4.46 for glossaries as there are no earlier rollback versions available. You may want to consider using one of the historic TeX Live Docker images instead. See, for example, Legacy Documents and TeX Live Docker Images.

1.2. Integrating Other Packages and Known Issues[link]

If you use hyperref and glossaries, you must load hyperref first (although, in general, hyperref should be loaded after other packages).

Occasionally you may find that certain packages need to be loaded after packages that are required by glossaries but need to also be loaded before glossaries. For example, a package X might need to be loaded after amsgen but before hyperref (which needs to be loaded before glossaries). In which case, load the required package first (for example, amsgen), then X, and finally load glossaries.

\usepackage{amsgen}% load before X
\usepackage{X}% must be loaded after amsgen
\usepackage{hyperref}% load after X
\usepackage{glossaries}% load after hyperref

Some packages don’t work with some glossary styles. For example, classicthesis doesn’t work with the styles that use the description environment, such as the list style. Since this is the default style, the glossaries package checks for classicthesis and will change the default to the index style if it has been loaded.

Some packages conflict with a package that’s required by a glossary style style package. For example, xtab conflicts with supertabular, which is required by glossary-super. In this case, ensure the problematic glossary style package isn’t loaded. For example, use the nosuper option and (with glossaries-extra) don’t use stylemods=super or stylemods=all. The glossaries package now (v4.50+) checks for xtab and will automatically implement nosuper if it has been loaded.

The language-support is implemented using tracklang. See §1.5 for further details.

1.3. Indexing Options[link]

The basic idea behind the glossaries package is that you first define your entries (terms, symbols or acronyms). Then you can reference these within your document (analogous to \cite or \ref). You can also, optionally, display a list of the entries you have referenced in your document (the glossary). This last part, displaying the glossary, is the part that most new users find difficult. There are three options available with the base glossaries package (Options 13). The glossaries-extra extension package provides two extra options for lists (Options 4 and 5) as well as an option for standalone descriptions within the document body (Option 6).

An overview of Options 15 is given in Table 1.1. Option 6 is omitted from the table as it doesn’t produce a list. For a more detailed comparison of the various methods, see the glossaries performance page. If, for some reason, you want to know what indexing option is in effect, you can test the expansion of:

\glsindexingsetting
The definition is initialised to:
\ifglsxindy xindy\else makeindex\fi
If the sort=none or sort=clear options are used, \glsindexingsetting will be redefined to none. If \makeglossaries is used \glsindexingsetting will be updated to either makeindex or xindy as appropriate (that is, the conditional will no longer be part of the definition). If \makenoidxglossaries is used then \glsindexingsetting will be updated to noidx. This means that \glsindexingsetting can’t be fully relied on until the start of the document environment. (If you are using glossaries-extra v1.49+, then this command will also be updated to take the record setting into account.)

If you are developing a class or package that loads glossaries, I recommend that you don’t force the user into a particular indexing method by adding an unconditional \makeglossaries into your class or package code. Aside from forcing the user into a particular indexing method, it means that they’re unable to use any commands that must come before \makeglossaries (such as \newglossary) and they can’t switch off the indexing whilst working on a draft document. (If you are using a class or package that has done this, pass the disablemakegloss option to glossaries. For example, via the document class options.)

Strictly speaking, Options 5 and 6 aren’t actually indexing options as no indexing is performed. In the case of Option 5, all defined entries are listed in order of definition. In the case of Option 6, the entry hypertargets and descriptions are manually inserted at appropriate points in the document. These two options are included here for completeness and for comparison with the actual indexing options.

Table 1.1: Glossary Options: Pros and Cons
Option 1 2 3 4 5
Requires glossaries-extra?
Requires an external application?
Requires Perl?
Requires Java?
Designed for glossaries[-extra]?
Can sort extended Latin alphabets or non-Latin alphabets? N/A
Efficient sort algorithm? N/A
Can use a different sort method for each glossary? N/A
Any problematic sort values? N/A
Are entries with identical sort values treated as separate unique entries? §
Can automatically form ranges in the location lists?
Can have non-standard locations in the location lists?
Maximum hierarchical depth (style-dependent) # 3
\glsdisplaynumberlist reliable?
\newglossaryentry allowed in document environment? (Not recommended.)
Requires additional write registers?
Default value of sanitizesort package option false true true true true

Both makeindex and xindy are general purpose indexing applications developed independently of glossaries and glossaries-extra.
Localisation support may be available via datatool.
Only with the hybrid method provided with glossaries-extra.
§Entries with the same sort value are merged.
Requires some setting up.
The locations must be set explicitly through the custom location field provided by glossaries-extra.
#Unlimited but unreliable.
Entries are defined in bib format. \newglossaryentry should not be used explicitly.
Provided docdef=true or docdef=restricted but not recommended.
Provided docdef=false or docdef=restricted.
Irrelevant with sort=none. (The record=only option automatically switches this on.)

1.3.1. Option 1 (“noidx”)[link]

This option isn’t generally recommended as it’s slow, doesn’t automatically provide localisation support, and can’t form location ranges. It’s best used with sort=use (order of use) or sort=def (order of definition) with no location lists. For alphabetical sorting, ensure you have at least version 3.0 of datatool and, where available, datatool localisation support. If an older version is detected, a slower, less efficient sort method will be used.

Example 3 demonstrates this method:
\documentclass{article}
\usepackage[style=indexgroup]{glossaries}
\makenoidxglossaries % use TeX to sort
\newglossaryentry{parrot}{name={parrot}, 
  description={a brightly coloured tropical bird}}
\newglossaryentry{duck}{name={duck}, 
  description={a waterbird}}
\newglossaryentry{puffin}{name={puffin},
  description={a seabird with a brightly coloured bill}}
\newglossaryentry{penguin}{name={penguin}, 
  description={a flightless black and white seabird}}
% a symbol:
\newglossaryentry{alpha}{name={\ensuremath{\alpha}},
 sort={alpha},description={a variable}}
% an acronym:
\setacronymstyle{short-long}
\newacronym{arpanet}{ARPANET}{Advanced Research Projects Agency Network}
\begin{document}
\Gls{puffin}, \gls{duck} and \gls{parrot}.
\gls{arpanet} and \gls{alpha}.
Next use: \gls{arpanet}.
\printnoidxglossary
\end{document}
You can place all your entry definitions in a separate file and load it in the document preamble with \loadglsentries (after \makenoidxglossaries). Note that six entries have been defined but only five are referenced (indexed) in the document so only those five appear in the glossary.
Example 3: Simple document that uses TeX to sort entries 📥🖹 📥🖺

Example document that defines some entries, references a subset of them in the document and displays a sorted list of the referenced entries: alpha, ARPANET, duck, parrot and puffin. There are three letter groups, headed A, D and P.

This uses the indexgroup style, which puts a heading at the start of each letter group. The letter group is determined by the first character of the sort value. For a preview of all available styles, see Gallery: Predefined Styles. The number 1 after each description is the number list (or location list). This is the list of locations (page numbers, in this case) where the entry was indexed. In this example, all entries were indexed on page 1.

As from version 4.55, the glossaries package will check for a new command added to datatool-base v3.0, that provides better sorting. The method is faster and works better with UTF-8 characters. See the datatool v3.0+ documentation, in particular the sections on localisation and on sorting lists.

This option doesn’t require an external indexing application but, with the default alphabetic sorting and old versions of datatool, it’s very slow with severe limitations, particularly if the sort value contains extended Latin characters or non-Latin characters. However, if you have both datatool v3.0+ and datatool-english installed, and at least glossaries v4.55, then make sure you specify the locale. For example:

\usepackage[locales=en]{datatool-base}
\usepackage{glossaries}
Or:
\usepackage[locales=en]{glossaries}
Other languages will need to have the appropriate datatool localisation support provided. Examples are provided in the datatool manual. In general, it’s best to use xindy or bib2gls if you need to sort terms that use an extended Latin alphabet or non-Latin alphabet.

If you have any commands that cause problems when expanding, such as \alpha, then you must use sanitizesort=true or change the sort method (sort=use or sort=def) in the package options or explicitly set the sort key when you define the relevant entries, as shown in the above example which has:

\newglossaryentry{alpha}{name={\ensuremath{\alpha}},
 sort={alpha},description={a variable}
}

The glossaries-extra package has a modified symbols package option that provides \glsxtrnewsymbol, which automatically sets the sort key to the entry label (instead of the name).

This option works best with the sort=def or sort=use setting. For any other setting, be prepared for a long document build time, especially if you have a lot of entries defined. This option is intended as a last resort for alphabetical sorting. This option allows a mixture of sort methods. (For example, sorting by word order for one glossary and order of use for another.) This option can be problematic with hierarchical glossaries and does not form ranges in the location lists. If you really can’t use an indexing application consider using Option 5 instead.

Summary:

  1. 1.Add
    \makenoidxglossaries
    
    to your preamble (before you start defining your entries, as described in §4).

  2. 2.Put
    \printnoidxglossary
    
    where you want your list of entries to appear (described in §8). Alternatively, to display all glossaries use the iterative command:
    \printnoidxglossaries
    

  3. 3.Run LaTeX twice on your document. (As you would do to make a table of contents appear.) For example, click twice on the “typeset” or “build” or “pdfLaTeX” button in your editor.

1.3.2. Option 2 (makeindex)[link]

Since makeindex was designed for indexes, it doesn’t fully integrate with the glossaries package, which has more complex use cases than a simple index. A better solution is to use bib2gls which is developed alongside glossaries-extra and so provides better integration.

Example 4 demonstrates a simple document that requires makeindex:
\documentclass{article}
\usepackage[style=indexgroup]{glossaries}
\makeglossaries % open indexing files
\newglossaryentry{parrot}{name={parrot}, 
  description={a brightly coloured tropical bird}}
\newglossaryentry{duck}{name={duck}, 
  description={a waterbird}}
\newglossaryentry{puffin}{name={puffin},
  description={a seabird with a brightly coloured bill}}
\newglossaryentry{penguin}{name={penguin}, 
  description={a flightless black and white seabird}}
% a symbol:
\newglossaryentry{alpha}{name={\ensuremath{\alpha}},
 sort={alpha},description={a variable}}
% an acronym:
\setacronymstyle{short-long}
\newacronym{arpanet}{ARPANET}{Advanced Research Projects Agency Network}
\begin{document}
\Gls{puffin}, \gls{duck} and \gls{parrot}.
\gls{arpanet} and \gls{alpha}.
Next use: \gls{arpanet}.
\printglossary
\end{document}
You can place all your entry definitions in a separate file and load it in the preamble with \loadglsentries (after \makeglossaries). The result is the same as for Example 3.
Example 4: Simple document that uses makeindex to sort entries 📥🖹 📥🖺

Example document that defines some entries, references a subset of them in the document and displays a sorted list of the referenced entries: alpha, ARPANET, duck, parrot and puffin. There are three letter groups, headed A, D and P.

This option uses a CLI application called makeindex to sort the entries. This application comes with all modern TeX distributions, but it’s hard-coded for the non-extended Latin alphabet. It can’t correctly sort accent commands (such as \' or \c) and fails with UTF-8 characters, especially for any sort values that start with a UTF-8 character (as it separates the octets resulting in an invalid file encoding). This process involves making LaTeX write the glossary information to a temporary file which makeindex reads. Then makeindex writes a new file containing the code to typeset the glossary. Then \printglossary reads this file in on the next run.

There are other applications that can read makeindex files, such as texindy and xindex, but the glossaries package uses a customized ist style file (created by \makeglossaries) that adjusts the special characters and input keyword and also ensures that the resulting file (which is input by \printglossary) adheres to the glossary style. If you want to use an alternative, you will need to ensure that it can honour the settings in the ist file or find some way to convert the ist file into an equivalent set of instructions.

This option works best if you want to sort entries according to the Basic Latin alphabet and you don’t want to install Perl or Java. This method can also work with the restricted shell escape since makeindex is considered a trusted application, which means you should be able to use the automake=immediate or automake=true package option provided the shell escape hasn’t been completely disabled.

This method can form ranges in the number list but only accepts limited number formats: \arabic, \roman, \Roman, \alph and \Alph.

This option does not allow a mixture of sort methods. All glossaries must be sorted according to the same method: word/letter ordering or order of use or order of definition. If you need word ordering for one glossary and letter ordering for another you’ll have to explicitly call makeindex for each glossary type.

The glossaries-extra package allows a hybrid mix of Options 1 and 2 to provide word/letter ordering with Option 2 and order of use/definition with Option 1. See the glossaries-extra documentation for further details. See also the glossaries-extra alternative to sampleSort.tex in §18.5.

Summary:

  1. 1.If you want to use makeindex’s -g option you must change the quote character using \GlsSetQuote. For example:
    \GlsSetQuote{+}
    
    This must be used before \makeglossaries. Note that if you are using babel, the shorthands aren’t enabled until the start of the document, so you won’t be able to use the shorthands in definitions that occur in the preamble.

  2. 2.Add
    \makeglossaries
    
    to your preamble (before you start defining your entries, as described in §4).

  3. 3.Put
    \printglossary
    
    where you want your list of entries to appear (described in §8). Alternatively, to display all glossaries use the iterative command:
    \printglossaries
    

  4. 4.Run LaTeX on your document. This creates files with the extensions glo and ist (for example, if your LaTeX document is called myDoc.tex, then you’ll have two extra files called myDoc.glo and myDoc.ist). If you look at your document at this point, you won’t see the glossary as it hasn’t been created yet. (If you use glossaries-extra you’ll see the section heading and some boilerplate text.)

    If you have used package options such as symbols there will also be other sets of files corresponding to the extra glossaries that were created by those options.

  5. 5. Run makeindex with the glo file as the input file and the ist file as the style so that it creates an output file with the extension gls:
    makeindex -s myDoc.ist -o myDoc.gls myDoc.glo
    
    (Replace myDoc with the base name of your LaTeX document file. Avoid spaces in the file name if possible.)

    The file extensions vary according to the glossary type. See §1.6.4 for further details. makeindex must be called for each set of files.

    If you don’t know how to use the command prompt, then you can probably access makeindex via your text editor, but each editor has a different method of doing this. See Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build for some examples.

    Alternatively, run makeindex indirectly via the makeglossaries script:

    makeglossaries myDoc
    
    Note that the file extension isn’t supplied in this case. (Replace makeglossaries with makeglossaries-lite if you don’t have Perl installed.) This will pick up all the file extensions from the aux file and run makeindex the appropriate number of times with all the necessary switches.

    The simplest approach is to use arara and add the following comment lines to the start of your document:

    % arara: pdflatex
    % arara: makeglossaries
    % arara: pdflatex
    
    (Replace makeglossaries with makeglossarieslite in the second line above if you don’t have Perl installed. Note that there’s no hyphen in this case.)

    The default sort is word order (“sea lion” comes before “seal”). If you want letter ordering you need to add the -l switch:

    makeindex -l -s myDoc.ist -o myDoc.gls myDoc.glo
    
    (See §1.6.4 for further details on using makeindex explicitly.) If you use makeglossaries or makeglossaries-lite then use the order=letter package option and the -l option will be added automatically.

  6. 6. Once you have successfully completed the previous step, you can now run LaTeX on your document again.
You’ll need to repeat the last step if you have used the toc option (unless you’re using glossaries-extra) to ensure the section heading is added to the table of contents. You’ll also need to repeat steps 5 and 6 if you have any cross-references which can’t be indexed until the indexing file has been created.

1.3.3. Option 3 (xindy)[link]

Since xindy was designed for indexes, it doesn’t fully integrate with the glossaries package, which has more complex use cases than a simple index. A better solution is to use bib2gls which is developed alongside glossaries-extra and so provides better integration. See the xindy home page http://www.xindy.org/ for the xindy documentation, and links to the mailing list and issue tracker.

Example 5 demonstrates a simple document that requires xindy:
\documentclass{article}
\usepackage[xindy,style=indexgroup]{glossaries}
\makeglossaries % open indexing files
\newglossaryentry{parrot}{name={parrot}, 
  description={a brightly coloured tropical bird}}
\newglossaryentry{duck}{name={duck}, 
  description={a waterbird}}
\newglossaryentry{puffin}{name={puffin},
  description={a seabird with a brightly coloured bill}}
\newglossaryentry{penguin}{name={penguin}, 
  description={a flightless black and white seabird}}
% a symbol:
\newglossaryentry{alpha}{name={\ensuremath{\alpha}},
 sort={alpha},description={a variable}}
% an acronym:
\setacronymstyle{short-long}
\newacronym{arpanet}{ARPANET}{Advanced Research Projects Agency Network}
\begin{document}
\Gls{puffin}, \gls{duck} and \gls{parrot}.
\gls{arpanet} and \gls{alpha}.
Next use: \gls{arpanet}.
\printglossary
\end{document}
You can place all your entry definitions in a separate file and load it in the preamble with \loadglsentries (after \makeglossaries). The result is the same as for Example 3 and Example 4.
Example 5: Simple document that uses xindy to sort entries 📥🖹 📥🖺

Example document that defines some entries, references a subset of them in the document and displays a sorted list of the referenced entries: alpha, ARPANET, duck, parrot and puffin. There are three letter groups, headed A, D and P.

This option uses a CLI application called xindy to sort the entries. This application is more flexible than makeindex and is able to sort extended Latin alphabets or non-Latin alphabets, however it does still have some limitations. (See Example 9 for an example with UTF-8 characters.)

The xindy application comes with both TeX Live and MikTeX, but since xindy is a Perl script, you will also need to install Perl, if you don’t already have it. In a similar way to Option 2, this option involves making LaTeX write the glossary information to a temporary file which xindy reads. Then xindy writes a new file containing the code to typeset the glossary. Then \printglossary reads this file in on the next run.

This is the best option with just the base glossaries package if you want to sort according to a language other than English or if you want non-standard location lists, but it can require some setting up (see §14). There are some problems with certain sort values:

In these problematic cases, you must set the sort field explicitly, as in the above example which has:
\newglossaryentry{alpha}{name={\ensuremath{\alpha}},
 sort={alpha},description={a variable}
}
The glossaries-extra package has a modified symbols package option that provides \glsxtrnewsymbol, which automatically sets the sort key to the entry label (instead of the name).

All glossaries must be sorted according to the same method (word/letter ordering, order of use, or order of definition).

The glossaries-extra package allows a hybrid mix of Options 1 and 3 to provide word/letter ordering with Option 3 and order of use/definition with Option 2. See the glossaries-extra documentation for further details.

Summary:

  1. 1.Add the xindy option to the glossaries package option list:
    \usepackage[xindy]{glossaries}
    
    If you are using a non-Latin script you’ll also need to either switch off the creation of the number group:
    \usepackage[xindy={glsnumbers=false}]{glossaries}
    
    or use either \GlsSetXdyFirstLetterAfterDigits{letter} (to indicate the first letter group to follow the digits) or \GlsSetXdyNumberGroupOrder{spec} to indicate where the number group should be placed (see §14).

  2. 2.Add \makeglossaries to your preamble (before you start defining your entries, as described in §4).

  3. 3.Run LaTeX on your document. This creates files with the extensions glo and xdy (for example, if your LaTeX document is called myDoc.tex, then you’ll have two extra files called myDoc.glo and myDoc.xdy). If you look at your document at this point, you won’t see the glossary as it hasn’t been created yet. (If you’re using the glossaries-extra extension package, you’ll see the section header and some boilerplate text.)

    If you have used package options such as symbols there will also be other sets of files corresponding to the extra glossaries that were created by those options.

  4. 4.Run xindy with the glo file as the input file and the xdy file as a module so that it creates an output file with the extension gls. You also need to set the language name and input encoding, as follows (all on one line):
    xindy -L english -C utf8 -I xindy -M myDoc -t myDoc.glg -o myDoc.gls myDoc.glo
    
    (Replace myDoc with the base name of your LaTeX document file. Avoid spaces in the file name. If necessary, also replace english with the name of your language and utf8 with your input encoding, for example, -L german -C din5007-utf8.)

    The file extensions vary according to the glossary type. See §1.6.3 for further details. xindy must be called for each set of files.

    It’s much simpler to use makeglossaries instead:

    makeglossaries myDoc
    
    Note that the file extension isn’t supplied in this case. This will pick up all the file extensions from the aux file and run xindy the appropriate number of times with all the necessary switches.

    There’s no benefit in using makeglossaries-lite with xindy. (Remember that xindy is a Perl script so if you can use xindy then you can also use makeglossaries, and if you don’t want to use makeglossaries because you don’t want to install Perl, then you can’t use xindy either.) If you don’t know how to use the command prompt, then you can probably access xindy or makeglossaries via your text editor, but each editor has a different method of doing this. See Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build for some examples.

    Again, a convenient method is to use arara and add the follow comment lines to the start of your document:

    % arara: pdflatex
    % arara: makeglossaries
    % arara: pdflatex
    

    The default sort is word order (“sea lion” comes before “seal”). If you want letter ordering you need to add the order=letter package option:

    \usepackage[xindy,order=letter]{glossaries}
    
    (and return to the previous step). This option is picked up by makeglossaries. If you are explicitly using xindy then you’ll need to add -M ord/letorder to the options list. See §1.6.3 for further details on using xindy explicitly.

  5. 5.Once you have successfully completed the previous step, you can now run LaTeX on your document again. As with makeindex (Option 2), you may need to repeat the previous step and this step to ensure the table of contents and cross-references are resolved.

1.3.4. Option 4 (bib2gls)[link]

This option is only available with the glossaries-extra extension package. This method uses bib2gls to both fetch entry definitions from bib files and to hierarchically sort and collate. The bib2gls application is designed specifically for, and developed alongside, the glossaries-extra package.

Example 6 demonstrates a simple document that requires bib2gls:
\documentclass{article}
\usepackage[record,style=indexgroup]{glossaries-extra}
\setabbreviationstyle{short-long}
% data in sample-entries.bib:
\GlsXtrLoadResources[src={sample-entries}]
\begin{document}
\Gls{puffin}, \gls{duck} and \gls{parrot}.
\gls{arpanet} and \gls{alpha}.
Next use: \gls{arpanet}.
\printunsrtglossary
\end{document}
Note that the abbreviation style must be set before \GlsXtrLoadResources. The file sample-entries.bib contains:
@entry{parrot,
 name={parrot}, 
 description={a brightly coloured tropical bird}
}
@entry{duck,
 name={duck}, 
 description={a waterbird}
}
@entry{puffin,
 name={puffin},
 description={a seabird with a brightly
coloured bill}
}
@entry{penguin,
 name={penguin}, 
 description={a flightless black and white seabird}
}
@symbol{alpha,
 name={\ensuremath{\alpha}},
 description={a variable}
}
@abbreviation{arpanet,
  short={ARPANET},
  long={Advanced Research Projects Agency Network}
}
The result is slightly different from the previous examples. Letter groups aren’t created by default with bib2gls so, even though the glossary style supports letter groups, there’s no group information. This can be added by invoking bib2gls with the --group switch.
Example 6: Simple document that uses bib2gls to sort entries 📥🖹 📥🖺

Example document that defines some entries, references a subset of them in the document and displays a sorted list of the referenced entries: alpha, ARPANET, duck, parrot and puffin. There are no letter groups.

All entries must be provided in one or more bib files. (See the bib2gls user manual for the required format.) In this example, the terms “parrot”, “duck”, “puffin” and “penguin” are defined using @atentry, the symbol alpha (\(\alpha \)) is defined using @symbol and the abbreviation “ARPANET” is defined using @abbreviation. See Example 10 for an example with UTF-8 content.

Note that the sort key should not be used. Each entry type (@entry, @symbol, @abbreviation) has a particular field that’s used for the sort value by default (name, the label, short). You will break this mechanism if you explicitly use the sort key. See bib2gls gallery: sorting for examples.

The glossaries-extra package needs to be loaded with the record package option:

\usepackage[record]{glossaries-extra}
or (equivalently)
\usepackage[record=only]{glossaries-extra}
or (with glossaries-extra v1.37+ and bib2gls v1.8+):
\usepackage[record=nameref]{glossaries-extra}
The record=nameref option is the best method if you are using hyperref.

Each resource set is loaded with \GlsXtrLoadResources. For example:

\GlsXtrLoadResources
[% definitions in entries1.bib and entries2.bib:
 src={entries1,entries2},
 sort={de-CH-1996}% sort according to this locale
]
The bib files are identified as a comma-separated list in the value of the src key. The sort option identifies the sorting method. This may be a locale identifier for alphabetic sorting, but there are other sort methods available, such as character code or numeric. One resource set may cover multiple glossaries or one glossary may be split across multiple resource sets, forming logical sub-blocks.

If you want to ensure that all entries are selected, even if they haven’t been referenced in the document, then add the option selection=all. (There are also ways of filtering the selection or you can even have a random selection by shuffling and truncating the list. See the bib2gls user manual for further details.)

The glossary is displayed using:

\printunsrtglossary
Alternatively all glossaries can be displayed using the iterative command:
\printunsrtglossaries
The document is built using:
pdflatex myDoc
bib2gls myDoc
pdflatex myDoc
If letter groups are required, you need the --group switch:
bib2gls --group myDoc
or with arara:
% arara: bib2gls: { group: on }
(You will also need an appropriate glossary style.)

Unlike Options 2 and 3, this method doesn’t create a file containing the typeset glossary but simply determines which entries are needed for the document, their associated locations and (if required) their associated letter group. This option allows a mixture of sort methods. For example, sorting by word order for one glossary and order of use for another or even sorting one block of the glossary differently to another block in the same glossary. See bib2gls gallery: sorting.

This method supports Unicode and uses the CLDR, which provides more extensive language support than xindy. (Except for Klingon, which is supported by xindy, but not by the CLDR.) The locations in the number list may be in any format. If bib2gls can deduce a numerical value it will attempt to form ranges otherwise it will simply list the locations.

Summary:

  1. 1.Use glossaries-extra with the record package option:
    \usepackage[record]{glossaries-extra}
    

  2. 2.Use \GlsXtrLoadResources to identify the bib file(s) and bib2gls options. The bib extension may be omitted:
    \GlsXtrLoadResources[src={terms.bib,abbreviations.bib},sort=en]
    

  3. 3.Put
    \printunsrtglossary
    
    where you want your list of entries to appear. Alternatively to display all glossaries use the iterative command:
    \printunsrtglossaries
    

  4. 4.Run LaTeX on your document.

  5. 5.Run bib2gls with just the document base name.

  6. 6.Run LaTeX on your document.

See glossaries-extra and bib2gls: An Introductory Guide or the bib2gls user manual for further details of this method, and also Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build.

1.3.5. Option 5 (“unsrt”)[link]

This option is only available with the extension package glossaries-extra. No indexing application is required.

Example 7 demonstrates this method:
\documentclass{article}
\usepackage[style=indexgroup]{glossaries-extra}
\newglossaryentry{parrot}{name={parrot}, 
  description={a brightly coloured tropical bird}}
\newglossaryentry{duck}{name={duck}, 
  description={a waterbird}}
\newglossaryentry{puffin}{name={puffin},
  description={a seabird with a brightly coloured bill}}
\newglossaryentry{penguin}{name={penguin}, 
  description={a flightless black and white seabird}}
% a symbol:
\newglossaryentry{alpha}{name={\ensuremath{\alpha}},
 description={a variable}}
% an abbreviation:
\setabbreviationstyle{short-long}
\newabbreviation{arpanet}{ARPANET}{Advanced Research Projects Agency Network}
\begin{document}
\Gls{puffin}, \gls{duck} and \gls{parrot}.
\gls{arpanet} and \gls{alpha}.
Next use: \gls{arpanet}.
\printunsrtglossary
\end{document}
You can place all your entry definitions in a separate file and load it in the preamble with \loadglsentries. There’s no “activation” command (such as \makeglossaries for Options 2 and 3).

The result is different from the previous examples. Now all entries are listed in the glossary, including “penguin” which hasn’t been referenced in the document, and the list is in the order that the entries were defined. There are no number lists.

Example 7: Simple document with an unsorted list of all defined entries 📥🖹 📥🖺

Example document that defines some entries, references a subset of them in the document and displays an unsorted list of the defined entries: parrot, duck, puffin, penguin, alpha and ARPANET. There are four letter groups with a repeated letter: P, D, P, A.

Note that the letter groups are fragmented because the list isn’t in alphabetical order, so there are two “P” letter groups.

The \printunsrtglossary command simply iterates over the set of all defined entries associated with the given glossary and lists them in the order of definition. This means that child entries must be defined immediately after their parent entry if they must be kept together in the glossary. Some glossary styles indent entries that have a parent but it’s the indexing application that ensures the child entries are listed immediately after the parent. If you’re opting to use this manual approach then it’s your responsibility to define the entries in the correct order.

The glossaries-extra package requires entries to be defined in the preamble by default. It’s possible to remove this restriction, but bear in mind that any entries defined after \printunsrtglossary won’t be listed.

The glossary is displayed using:

\printunsrtglossary
Alternatively all glossaries can be displayed using the iterative command:
\printunsrtglossaries

This method will display all defined entries, regardless of whether or not they have been used in the document. Note that this uses the same command for displaying the glossary as Option 4. This is because bib2gls takes advantage of this method by defining the wanted entries in the required order and setting the locations (and letter group information, if required). See the glossaries-extra manual for further details.

Therefore, the above example document has a glossary containing the entries: parrot, duck, puffin, penguin, \(\alpha \) and ARPANET (in that order). Note that the “penguin” entry has been included even though it wasn’t referenced in the document.

This just requires a single LaTeX call:

pdflatex myDoc
unless the glossary needs to appear in the table of contents, in which case a second run is required:
pdflatex myDoc
pdflatex myDoc
(Naturally if the document also contains citations, and so on, then additional steps are required. Similarly for all the other options above.)

See the glossaries-extra documentation for further details of this method.

1.3.6. Option 6 (“standalone”)[link]

This option is only available with the glossaries-extra extension package. (You can just use the base glossaries package for the first case, but it’s less convenient. You’d have to manually insert the entry target before the sectioning command and use \glsentryname{label} or \Glsentryname{label} to display the entry name.) Instead of creating a list, this has standalone definitions throughout the document. The entry name may or may not be in a section heading.

You can either define entries in the preamble (or in an external file loaded with \loadglsentries), as with Option 5, or use bib2gls if you want to manage a large database of terms.

Example 8 demonstrates standalone definitions without bib2gls:
\documentclass{article}

\usepackage[colorlinks]{hyperref}
\usepackage[sort=none,
   nostyles% <- no glossary styles are required
 ]{glossaries-extra}

\newglossaryentry{set}{name={set},
  description={a collection of any kind of objects},
  symbol={\ensuremath{\mathcal{S}}}
}

\newglossaryentry{function}{name={function},
  description={a rule that assigns every element in the 
  domain \gls{set} to an element in the range \gls{set}},
  symbol={\ensuremath{f(x)}}
}
\newcommand*{\termdef}[1]{% 
  \section{\Glsxtrglossentry{#1} \glsentrysymbol{#1}}% 
  \begin{quote}\em\Glsentrydesc{#1}.\end{quote}% 
}
\begin{document}
\tableofcontents

\section{Introduction}
Sample document about \glspl{function} and \glspl{set}.

\termdef{set}

More detailed information about \glspl{set} with examples.

\termdef{function}

More detailed information about \glspl{function} with examples.

\end{document}
This allows the references to hyperlink to the standalone definitions rather than to a glossary.
Example 8: Simple document with standalone entries 📥🖹 📥🖺

Example document that defines entries and displays them in the document..

The above example can be modified to use bib2gls if the terms are defined in one or more bib files:

\documentclass{article}

\usepackage[colorlinks]{hyperref}
\usepackage[record,
   nostyles% <- no glossary styles are required
  ]{glossaries-extra}

\GlsXtrLoadResources[src={terms},sort=none,save-locations=false]

\newcommand*{\termdef}[1]{% 
  \section{\Glsxtrglossentry{#1} \glossentrysymbol{#1}}% 
  \glsadd{#1}% <- index this entry
  \begin{quote}\em\Glsentrydesc{#1}.\end{quote}% 
}
\begin{document}
\tableofcontents

\section{Introduction}
Sample document about \glspl{function} and \glspl{set}.

\termdef{set}

More detailed information about \glspl{set} with examples.

\termdef{function}

More detailed information about \glspl{function} with examples.
\end{document}
Where the file terms.bib contains:
@entry{set,
  name={set},
  description={a collection of any kind of objects},
  symbol={\ensuremath{\mathcal{S}}}
}
@entry{function,
  name={function},
  description={a rule that assigns every element in the domain
  \gls{set} to an element in the range \gls{set}},
  symbol={\ensuremath{f(x)}}
}
The advantage in this approach (with \loadglsentries or bib2gls) is that you can use an existing database of entries shared across multiple documents, ensuring consistent notation for all of them.

In both cases, there’s no need to load all the glossary styles packages, as they’re not required, so I’ve used the nostyles package option to prevent them from being loaded.

In the first case, you just need to define the terms (preferably in the preamble or in a file that’s input in the preamble). No external tool is required. Just run LaTeX as normal. (Twice to ensure that the table of contents is up to date.)

pdflatex myDoc
pdflatex myDoc

In the second case, you need the record package option (as in Option 4) since bib2gls is needed to select the required entries, but you don’t need a sorted list:

\GlsXtrLoadResources[src={terms},sort=none]
This will ensure that any entries indexed in the document (through commands like \gls or \glsadd) will be selected by bib2gls, but it will skip the sorting step. (The chances are you probably also won’t need location lists either. If so, you can add the option save-locations=false.)

Remember that for this second case you need to run bib2gls as per Option 4:

pdflatex myDoc
bib2gls myDoc
pdflatex myDoc
pdflatex myDoc

For both cases (with or without bib2gls), instead of listing all the entries using \printunsrtglossary, you use \glsxtrglossentry{label} where you want the name (and anchor with hyperref) to appear in the document. This will allow the link text created by commands like \gls to link to that point in the document. The description can simply be displayed with \glsentrydesc{label} or \Glsentrydesc{label}, as in the above examples. In both examples, I’ve defined a custom command \termdef to simplify the code and ensure consistency. Extra styling, such as placing the description in a coloured frame, can be added to this custom definition as required.

(Instead of using \glsentrydesc or \Glsentrydesc, you can use \glossentrydesc{label}, which will obey category attributes such as glossdesc and glossdescfont. See the glossaries-extra manual for further details.)

The symbol (if required) can be displayed with either \glsentrysymbol{label} or \glossentrysymbol{label}. In the first example, I’ve used \glsentrysymbol. In the second I’ve used \glossentrysymbol. The latter is necessary with bib2gls if the symbol needs to go in a section title as the entries aren’t defined on the first LaTeX run.

In normal document text, \glsentrysymbol will silently do nothing if the entry hasn’t been defined, but when used in a section heading it will expand to an undefined internal command when written to the aux file, which triggers an error.

The \glossentrysymbol command performs an existence check, which triggers a warning if the entry is undefined. (All entries will be undefined before the first bib2gls call.) You need at least glossaries-extra v1.42 to use this command in a section title. (\glossentrysymbol is defined by the base glossaries package but is redefined by glossaries-extra.) If hyperref has been loaded, this will use \texorpdfstring to allow a simple expansion for the PDF bookmarks (see the glossaries-extra user manual for further details).

If you want to test if the symbol field has been set, you need to use \ifglshassymbol outside of the section title. For example:

\ifglshassymbol{#1}% 
{\section{\glsxtrglossentry{#1} \glossentrysymbol{#1}}}
{\section{\glsxtrglossentry{#1}}}

In both of the above examples, the section titles start with a lowercase character (because the name value is all lowercase in entry definitions). You can apply automatic case change with the glossname category attribute. For example:

\glssetcategoryattribute{general}{glossname}{firstuc}
or (for title-case)
\glssetcategoryattribute{general}{glossname}{title}
However, this won’t apply the case change in the table of contents or bookmarks. Instead you can use helper commands provided by glossaries-extra v1.49+ but make sure you have up-to-date versions of glossaries and mfirstuc.

In the second example, you can instead use bib2gls to apply a case change. For example, to apply sentence case to the name field:

\GlsXtrLoadResources[src={terms},
 sort=none,save-locations=false,
 replicate-fields={name=text},
 name-case-change=firstuc
]
(Or name-case-change=title for title case.) This copies the name value to the text field and then applies a case change to the name field (leaving the text field unchanged). The name in the section titles now starts with a capital but the link text produced by commands like \gls is still lowercase.

In the first example (without bib2gls) you can do this manually. For example:

\newglossaryentry{set}{name={Set},text={set},
  description={a collection of any kind of objects},
  symbol={\ensuremath{\mathcal{S}}}
}
A more automated solution can be obtained with the standalone helper commands for the PDF bookmark and heading text (glossaries-extra v1.49+).

Note that if you use the default save-locations=true with bib2gls, it’s possible to combine Options 4 and 6 to have both standalone definitions and an index. In this case, a glossary style is required. In the example below, I’ve use bookindex, which is provided in the glossary-bookindex package (bundled with glossaries-extra). I don’t need any of the other style packages, so I can still keep the nostyles option and just load glossary-bookindex:

\usepackage[record=nameref,% <- using bib2gls
 nostyles,% <- don't load default style packages
 stylemods=bookindex,% <- load glossary-bookindex.sty
 style=bookindex% <- set the default style to 'bookindex'
]{glossaries-extra}
I also need to sort the entries, so the resource command is now:
\GlsXtrLoadResources[src={terms},% definitions in terms.bib
 sort=en-GB,% sort by this locale
 replicate-fields={name=text},
 name-case-change=firstuc
]
At the end of the document, I can add the glossary:
\printunsrtglossary[title=Index,target=false]
Note that I’ve had to switch off the hypertargets with target=false (otherwise there would be duplicate targets). If you want letter group headings you need to use the --group switch:
bib2gls --group myDoc
or if you are using arara:
% arara: bib2gls: { group: on }

The bookindex style doesn’t show the description, so only the name and location is displayed. Remember that the name has had a case change so it now starts with an initial capital. If you feel this is inappropriate for the index, you can adjust the bookindex style so that it uses the text field instead. For example:

\renewcommand*{\glsxtrbookindexname}[1]{% 
  \glossentrynameother{#1}{text}}
See the glossaries-extra user manual for further details about this style.

Note that on the first LaTeX run none of the entries will be defined. Once they are defined, the page numbers may shift due to the increased amount of document text. You may therefore need to repeat the document build to ensure the page numbers are correct.

If there are extra terms that need to be included in the index that don’t have a description, you can define them with @index in the bib file. For example:

@index{element}
@index{member,alias={element}}
They can be used in the document as usual:
The objects that make up a set are the \glspl{element}
or \glspl{member}.
See glossaries-extra and bib2gls: An Introductory Guide or the bib2gls user manual for further details.

1.4. Dummy Entries for Testing[link]

In addition to the sample files described in §18, glossaries also provides some files containing lorum ipsum dummy entries. These are provided for testing purposes and are on TeX’s path (in tex/latex/glossaries/test-entries) so they can be included via \input or \loadglsentries. The glossaries-extra package provides bib versions of all these files for use with bib2gls. The files are as follows:

🗋 example-glossaries-brief.tex
These entries all have brief descriptions. For example:
\newglossaryentry{lorem}{name={lorem},description={ipsum}}

🗋 example-glossaries-utf8.tex
This file is based on example-glossaries-brief.tex but random characters have been converted to accented characters to test UTF-8 support.

🗋 example-glossaries-long.tex
These entries all have long descriptions. For example:
\newglossaryentry{loremipsum}{name={lorem ipsum},
description={dolor sit amet, consectetuer adipiscing 
elit. Ut purus elit, vestibulum ut, placerat ac, 
adipiscing vitae, felis. Curabitur dictum gravida 
mauris.}}

🗋 example-glossaries-multipar.tex
These entries all have multi-paragraph descriptions. For example:
\longnewglossaryentry{loremi-ii}{name={lorem 1--2}}% 
{% 
Lorem ipsum ...

Nam dui ligula...
}

🗋 example-glossaries-symbols.tex
These entries all use the symbol key. For example:
\newglossaryentry{alpha}{name={alpha},
symbol={\ensuremath{\alpha}},
description={Quisque ullamcorper placerat ipsum.}}

🗋 example-glossaries-symbolnames.tex
Similar to the previous file but the symbol key isn’t used. Instead the symbol is stored in the name key. For example:
\newglossaryentry{sym.alpha}{sort={alpha},
name={\ensuremath{\alpha}},
description={Quisque ullamcorper placerat ipsum.}}

🗋 example-glossaries-user.tex
The top level (level 0) entries have the symbol key and all user1, …, user6 keys set. For example:
\newglossaryentry{sample-a}
{name={a name},
description={a description},
symbol={\ensuremath{\alpha}},
user1={A},
user2={1},
user3={i},
user4={A-i},
user5={25.2020788573521},
user6={1585-11-06}}
There are also some level 1 entries, which may or may not have the symbol and user keys set. For example:
\newglossaryentry{sample-b-0}
{parent={sample-b},
name={b/0 name},
description={child 0 of b},
symbol={\ensuremath{\sigma}},
user2={0},
user4={a-i}}
There are no deeper hierarchical entries. Where set, the user1 key is an uppercase letter (A–Z), the user2 key is an integer, the user3 key is a lowercase Roman numeral, the user4 key is in the form alpha-roman where alpha is either an upper or lowercase letter (a–z or A–Z) and roman is either an upper or lowercase Roman numeral. The user5 key is a random number (in the range \((-50,+50)\) for top level (level 0) entries and \((-1,+1)\) for child entries). The user6 key is a random date between 1000-01-01 and 2099-12-31.

🗋 example-glossaries-images.tex
These entries use the user1 key to store the name of an image file. (The images are provided by the mwe package and should be on TeX’s path.) One entry doesn’t have an associated image to help test for a missing key. The descriptions are long to allow for tests with the text wrapping around the image. For example:
\longnewglossaryentry{sedfeugiat}{name={sed feugiat},
user1={example-image}}% 
{% 
Cum sociis natoque...

Etiam...
}

🗋 example-glossaries-acronym.tex
These entries are all acronyms. For example:
\newacronym[type={\glsdefaulttype}]{lid}{LID}{lorem ipsum 
dolor}
If you use the glossaries-extra extension package, then \newacronym is redefined to use \newabbreviation with the category key set to acronym (rather than the default abbreviation). This means that you need to set the abbreviation style for the acronym category. For example:
\setabbreviationstyle[acronym]{long-short}

🗋 example-glossaries-acronym-desc.tex
This file contains entries that are all acronyms that use the description key. For example:
\newacronym[type={\glsdefaulttype},
  description={fringilla a, euismod sodales,
  sollicitudin vel, wisi}]{ndl}{NDL}{nam dui ligula}
If you use the glossaries-extra extension package, then \newacronym is redefined to use \newabbreviation with the category key set to acronym (rather than the default abbreviation). This means that you need to set the abbreviation style for the acronym category. For example:
\setabbreviationstyle[acronym]{long-short-desc}

🗋 example-glossaries-acronyms-lang.tex
These entries are all acronyms, where some of them have a translation supplied in the user1 key. For example:
\newacronym[type={\glsdefaulttype},user1={love itself}]
 {li}{LI}{lorem ipsum}
If you use the glossaries-extra extension package, then \newacronym is redefined to use \newabbreviation with the category key set to acronym (rather than the default abbreviation). This means that you need to set the abbreviation style for the acronym category. For example:
\setabbreviationstyle[acronym]{long-short-user}

🗋 example-glossaries-parent.tex
These are hierarchical entries where the child entries use the name key. For example:
\newglossaryentry{sedmattis}{name={sed mattis},
description={erat sit amet}}

\newglossaryentry{gravida}{parent={sedmattis},
  name={gravida},description={malesuada}}

🗋 example-glossaries-childnoname.tex
These are hierarchical entries where the child entries don’t use the name key. For example:
\newglossaryentry{scelerisque}{name={scelerisque},
  description={at}}

\newglossaryentry{vestibulum}{parent={scelerisque},
  description={eu, nulla}}

🗋 example-glossaries-longchild.tex
These entries all have long descriptions and there are some child entries. For example:
\newglossaryentry{longsedmattis}{name={sed mattis},
 description={erat sit amet dolor sit amet, consectetuer adipiscing elit. 
 Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. 
 Curabitur dictum gravida mauris.}}

\newglossaryentry{longgravida}{parent={longsedmattis},name={gravida},
 description={malesuada libero, nonummy eget, consectetuer id, vulputate a, 
 magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique
senectus et netus et malesuada fames ac turpis egestas. Mauris ut
leo.}}

🗋 example-glossaries-childmultipar.tex
This consists of parent entries with single paragraph descriptions and child entries with multi-paragraph descriptions. Some entries have the user1 key set to the name of an image file provided by the mwe package. For example:
\newglossaryentry{hiersedmattis}{name={sed mattis},user1={example-image},
 description={Erat sit amet dolor sit amet, consectetuer adipiscing elit. 
 Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur
dictum gravida mauris. Ut pellentesque augue sed urna. Vestibulum
diam eros, fringilla et, consectetuer eu, nonummy id, sapien. Nullam
at lectus. In sagittis ultrices mauris. Curabitur malesuada erat sit
amet massa. Fusce blandit. Aliquam erat volutpat.}}

\longnewglossaryentry{hierloremi-ii}
{name={lorem 1--2},parent={hiersedmattis}}% 
{% 
Lorem ipsum ...

Nam dui ligula...
}

🗋 example-glossaries-cite.tex
These entries use the user1 key to store a citation key (or comma-separated list of citation keys). The citations are defined in xampl.bib, which should be available on all modern TeX distributions. One entry doesn’t have an associated citation to help test for a missing key. For example:
\newglossaryentry{fusce}{name={fusce},
description={suscipit cursus sem},user1={article-minimal}}

🗋 example-glossaries-url.tex
These entries use the user1 key to store an URL associated with the entry. For example:
\newglossaryentry{aenean-url}{name={aenean},
 description={adipiscing auctor est},
 user1={http://uk.tug.org/}}

The sample file glossary-lipsum-examples.tex in the doc/latex/glossaries/samples directory uses all these files. See also glossaries gallery.

The glossaries-extra package provides the additional test file:
🗋 example-glossaries-xr.tex
These entries use the see key provided by the base glossaries package and also the alias and seealso keys that require glossaries-extra. For example:
\newglossaryentry{alias-lorem}{name={alias-lorem},
 description={ipsum},alias={lorem}}

\newglossaryentry{amet}{name={amet},description={consectetuer},
 see={dolor}}

\newglossaryentry{arcu}name={arcu},description={libero},
 seealso={placerat,vitae,curabitur}

1.5. Multi-Lingual Support[link]

The glossaries package uses the tracklang package to determine the document languages. Unfortunately, because there isn’t a standard language identification framework provided with LaTeX, tracklang isn’t always able to detect the selected languages either as a result of using an unknown interface or where the interface doesn’t provide a way of detecting the language. In particular, tracklang currently (version 1.6.1 at the time of writing) can’t pick up languages specified using babel’s \babelprovide. In the event that tracklang can’t detect the language, use the languages or locales package option. See §1.2 and also Localisation with tracklang.tex for further details.

For example (using babel):

\documentclass{article}
\usepackage[german]{babel}
\usepackage{glossaries}
This can pick up the language setting but will also automatically load translator. Compare this with:
\documentclass{article}
\usepackage[german]{babel}
\usepackage{glossaries-extra}
This will pick up the language setting but won’t automatically load translator.

In both the above cases, tracklang will automatically be loaded and the language-sensitive commands provided by glossaries will use the definitions in glossaries-german.ldf (which needs to be installed separately).

In the event that tracklang can’t pick up the required languages, it’s also possible to identify them with the languages or locales option. For example:

\usepackage[nil]{babel}
\babelprovide{french}
\usepackage[languages={french}]{glossaries}

Another example (no language package):

\documentclass[german]{article}
\usepackage[translate=true]{glossaries}
The above document doesn’t load babel or polyglossia or translator, but the translate=true setting will ensure that tracklang is loaded, which will pick up the document class option.

Alternatively, using the locales package option:

\usepackage[locales={de-DE,en-GB}]{glossaries}
This will required both glossaries-german.ldf and glossaries-english.ldf to be installed. Note that the locales option is a synonym of the languages option, but semantically locales makes more sense when using language identifiers that include regions.

Note that if another package has already been loaded that uses tracklang, then the list of supported locales will be picked up from that package. For example:

\usepackage[de-DE,en-GB]{datetime2}
\usepackage{glossaries}

The best method to sort terms that use an extended Latin alphabet or non-Latin alphabet is with glossaries-extra and bib2gls. This means using a bib file to store the entry data (see Option 4). If you prefer to only use the base glossaries package, then xindy (Option 3) is the best option, but be aware that xindy is a general purpose indexing application that’s developed independently of glossaries (as opposed to bib2gls, which is specifically designed for, and developed alongside, glossaries-extra and therefore provides better integration).

Note also that bib2gls can support any language provided by the CLDR, whereas xindy only has a limited number of built-in languages (although more can be added).

If you are using a non-Latin script with xindy, you may need the xindynoglsnumbers option or use \GlsSetXdyFirstLetterAfterDigits to indicate the first letter group that should follow the number group.

Example 9 demonstrates a document with UTF-8 characters that requires xindy. If you try this example and encounter errors, check that you have an up-to-date TeX distribution. Note that with the modern LaTeX kernel, the default encoding is assumed to be UTF-8 so I haven’t bothered loading the inputenc package.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[main=english,brazilian]{babel}
\usepackage[xindy]{glossaries}
Note the use of the xindy package option, which ensures that all the indexing information is written in the correct format.

This example is a multilingual document so a second glossary is defined for the Brazilian terms:

\newglossary*{dictionary}{\glossaryname}
I could just supply the actual title, but using the language-sensitive \glossaryname (which is also the title provided for the main glossary) demonstrates the language support.

This document will need to have both glossaries-english and glossaries-portuges installed in addition to the base glossaries package.

To ensure that the files required by xindy are opened:

\makeglossaries
Now define some English terms:
\newglossaryentry{élite}{name={élite},
description={select group or class}}
\newglossaryentry{elephant}{name={elephant},
description={large animal with trunk and tusks}}
\newglossaryentry{elk}{name={elk}, description={large deer}}
And here are the terms that need to go in the custom “dictionary” glossary:
\newglossaryentry{água}{name={água},
type={dictionary},
description={water}}
\newglossaryentry{árvore}{name={árvore},
type={dictionary},
description={tree}}
\newglossaryentry{ano}{name={ano},
type={dictionary},
description={year}}
The main body of the document contains references using the labels provided in the first argument of \newglossaryentry and the glossary lists are placed at the desired location, at the end of each section:
\begin{document}
\section{English}
An \gls{elk} and an \gls{elephant} belonged to an 
\gls{élite} group.

\printglossary

\selectlanguage{brazilian}
\section{Brasileiro}
A \gls{árvore} tive \gls{água} este \gls{ano}.

\printglossary[type=dictionary]
\end{document}
If the document is saved in the file myDoc.tex then the document build is:
pdflatex myDoc
makeglossaries myDoc
pdflatex myDoc
Example 9: UTF-8 and xindy 📥🖹 📥🖺

Example document that defines a term with a UTF-8 character.

Example 10 is a modification of the previous example which uses bib2gls (and therefore requires glossaries-extra). The entry data must now be provided in one or more bib files. For example, the file sample-utf8-en.bib contains:
% Encoding: UTF-8
@entry{élite,
 name={élite},
 description={select group or class}
}

@entry{elephant,
 name={elephant},
 description={large animal with trunk and tusks}
}

@entry{elk,
 name={elk},
 description={large deer}
}
and the file sample-utf8-pt.bib contains:
% Encoding: UTF-8
@entry{água,
 name={água},
 description={water}
}

@entry{árvore,
 name={árvore},
 description={tree}
}

@entry{ano,
 name={ano},
 description={year}
}

The document now requires glossaries-extra with the record option:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[main=english,brazilian]{babel}
\usepackage[record]{glossaries-extra}
As before a custom glossary is defined:
\newglossary*{dictionary}{\glossaryname}
Instead of using \makeglossaries, the document now needs:
\GlsXtrLoadResources[
 sort=en,% sort according to English language rules
 src={sample-utf8-en}% data in sample-utf8-en.bib
]
\GlsXtrLoadResources[
 sort=pt-BR,% sort according to pt-BR language rules
 src={sample-utf8-pt},% data in sample-utf8-pt.bib
 type=dictionary
]
The main body of the document is similar to the previous example, but a different command is needed to display the glossary.
\begin{document}
\section{English}
An \gls{elk} and an \gls{elephant} belonged to an 
\gls{élite} group.

\printunsrtglossary

\selectlanguage{brazilian}
\section{Brasileiro}
A \gls{árvore} tive \gls{água} este \gls{ano}.

\printunsrtglossary[type=dictionary]
\end{document}
The document build is slightly different:
pdflatex myDoc
bib2gls myDoc
pdflatex myDoc
Example 10: UTF-8 and bib2gls 📥🖹 📥🖺

Example UTF-8 document that defines terms in bib files.

Note that although a non-Latin character, such as é, looks like a plain character in your tex file, with pdfLaTeX it’s actually a macro and can therefore cause problems. (This issue doesn’t occur with XeLaTeX or LuaLaTeX which both natively support UTF-8.) Recent versions of the LaTeX kernel have made significant improvements in handling UTF-8. To ensure you have the best UTF-8 support, use at least mfirstuc v2.08+ with glossaries v4.50+ (and, if required, glossaries-extra v1.49+). With old TeX distributions, you can’t use UTF-8 characters in labels.

With old versions of mfirstuc (pre v2.08), if you use a UTF-8 character at the start of an entry name, you must place it in a group, or it will cause a problem for sentence case commands (e.g. \Gls). For example:

% mfirstuc v2.07:
\newglossaryentry{elite}{name={{é}lite},
description={select group or class}}
This isn’t necessary with glossaries v4.50+ and mfirstuc v2.08+, and with a newer LaTeX kernel the UTF-8 character may occur in the label:
% mfirstuc v2.08:
\newglossaryentry{élite}{name={élite},
description={select group or class}}

If you are using xindy or bib2gls, the application needs to know the encoding of the tex file. This information is added to the aux file and can be picked up by makeglossaries and bib2gls.

Note that makeindex doesn’t support UTF-8 so, although it can be used with some Latin alphabet languages, you will need to ensure that the sort value doesn’t contain any UTF-8. If you have the double-quote character (") as an active character (for example, a babel shorthand) and you want to use makeindex’s -g (German) option, you’ll need to change makeindex’s quote character using:

\GlsSetQuote{character}

Note that character may not be one of ? (question mark), | (pipe) or ! (exclamation mark). For example:
\GlsSetQuote{+}
This must be done before \makeglossaries and any entry definitions. It’s only applicable for makeindex. This option in conjunction with ngerman will also cause makeglossaries to use the -g switch when invoking makeindex. For example:
\documentclass{article}

\usepackage[ngerman]{babel}
\usepackage{glossaries}

\GlsSetQuote{+}

\makeglossaries

\newglossaryentry{rna}{name=ribonukleinsäure,
  sort={ribonukleins"aure},
  description={eine Nukleinsäure}}

\begin{document}
\gls{rna}

\printglossaries
\end{document}

1.5.1. Changing the Fixed Names[link]

The fixed names are produced using the commands listed in Table 1.2. If you aren’t using a language package such as babel or polyglossia that uses caption hooks, you can just redefine these commands as appropriate. If you are using babel or polyglossia, you need to use their caption hooks to change the defaults. See changing the words babel uses or read the babel or polyglossia documentation. If you have loaded babel, then glossaries will attempt to load translator, unless you have used the notranslate, translate=false or translate=babel package options.

The glossaries-extra package defaults to translate=babel if babel has been loaded.

If the translator package is loaded, the translations are provided by dictionary files (for example, glossaries-dictionary-English.dict). See the translator package for advice on changing translations provided by translator dictionaries. If you can’t work out how to modify these dictionary definitions, try switching to babel’s interface using translate=babel:

\documentclass[english,french]{article}
\usepackage{babel}
\usepackage[translate=babel]{glossaries}
and then use babel’s caption hook mechanism. Note that if you pass the language options directly to babel rather that using the document class options or otherwise passing the same options to translator, then translator won’t pick up the language and no dictionaries will be loaded and babel’s caption hooks will be used instead.

Table 1.2: Customised Text
Command Name Translator Key Word Purpose
\glossaryname Glossary Title of the main glossary.
\acronymname Acronyms Title of the list of acronyms (when used with package option acronym).
\entryname Notation (glossaries) Header for first column in the glossary (for 2, 3 or 4 column glossaries that support headers).
\descriptionname Description (glossaries) Header for second column in the glossary (for 2, 3 or 4 column glossaries that support headers).
\symbolname Symbol (glossaries) Header for symbol column in the glossary for glossary styles that support this option.
\pagelistname Page List (glossaries) Header for the page list column in the glossary for glossaries that support this option.
\glssymbolsgroupname Symbols (glossaries) Header for symbols section of the glossary for glossary styles that support this option.
\glsnumbersgroupname Numbers (glossaries) Header for numbers section of the glossary for glossary styles that support this option.

As from version 4.12, multilingual support is provided by separate language modules that need to be installed in addition to installing the glossaries package. You only need to install the modules for the languages that you require. If the language module has an unmaintained status, you can volunteer to take over the maintenance by contacting me at https://www.dickimaw-books.com/contact. The translator dictionary files for glossaries are now provided by the appropriate language module. For further details about information specific to a given language, please see the documentation for that language module.

Examples of use:

Due to the varied nature of glossaries, it’s likely that the predefined translations may not be appropriate. If you are using the babel package and the glossaries package option translate=babel, you need to be familiar with the advice given in changing the words babel uses. If you are using the translator package, then you can provide your own dictionary with the necessary modifications (using \deftranslation) and load it using \usedictionary. If you simply want to change the title of a glossary, you can use the title key in commands like \printglossary (but not the iterative commands like \printglossaries).

Note that the translator dictionaries are loaded at the beginning of the document, so it won’t have any effect if you put \deftranslation in the preamble. It should be put in your personal dictionary instead (as in the example below). See the translator documentation for further details.

Your custom dictionary doesn’t have to be just a translation from English to another language. You may prefer to have a dictionary for a particular type of document. For example, suppose your institution’s in-house reports have to have the glossary labelled as “Nomenclature” and the location list should be labelled “Location”, then you can create a file called, say, myinstitute-glossaries-dictionary-English.dict that contains the following:

\ProvidesDictionary{myinstitute-glossaries-dictionary}{English}
\deftranslation{Glossary}{Nomenclature}
\deftranslation{Page List (glossaries)}{Location}
You can now load it using:
\usedictionary{myinstitute-glossaries-dictionary}
(Make sure that myinstitute-glossaries-dictionary-English.dict can be found by TeX.) If you want to share your custom dictionary, you can upload it to CTAN.

If you are using babel and don’t want to use the translator interface, you can use the package option translate=babel. For example:

\documentclass[british]{article}

\usepackage{babel}
\usepackage[translate=babel]{glossaries}

\addto\captionsbritish{% 
  \renewcommand*{\glossaryname}{List of Terms}% 
  \renewcommand*{\acronymname}{List of Acronyms}% 
}

Note that xindy and bib2gls provide much better multi-lingual support than makeindex, so I recommend that you use Options 2 or 3 if you have glossary entries that contain non-Latin characters. See §14 for further details on xindy, and see the bib2gls user manual for further details of that application.

1.5.2. Creating a New Language Module[link]

The glossaries package now uses the tracklang package to determine which language modules need to be loaded. If you want to create a new language module, you should first read the tracklang documentation.

To create a new language module, you need to at least create two files called: glossaries-lang.ldf and glossaries-dictionary-Lang.dict where lang is the root language name (for example, english) and Lang is the language name used by translator (for example, English).

Here’s an example of glossaries-dictionary-English.dict:

\ProvidesDictionary{glossaries-dictionary}{English}

\providetranslation{Glossary}{Glossary}
\providetranslation{Acronyms}{Acronyms}
\providetranslation{Notation (glossaries)}{Notation}
\providetranslation{Description (glossaries)}{Description}
\providetranslation{Symbol (glossaries)}{Symbol}
\providetranslation{Page List (glossaries)}{Page List}
\providetranslation{Symbols (glossaries)}{Symbols}
\providetranslation{Numbers (glossaries)}{Numbers}
You can use this as a template for your dictionary file. Change English to the translator name for your language (so that it matches the file name glossaries-dictionary-Lang.dict) and, for each \providetranslation, change the second argument to the appropriate translation.

Here’s an example of glossaries-english.ldf:

\ProvidesGlossariesLang{english}

\glsifusedtranslatordict{English}
{% 
  \addglossarytocaptions{\CurrentTrackedLanguage}% 
  \addglossarytocaptions{\CurrentTrackedDialect}% 
}
{% 
  \@ifpackageloaded{polyglossia}% 
  {% 
    \newcommand*{\glossariescaptionsenglish}{% 
      \renewcommand*{\glossaryname}{\textenglish{Glossary}}% 
      \renewcommand*{\acronymname}{\textenglish{Acronyms}}% 
      \renewcommand*{\entryname}{\textenglish{Notation}}% 
      \renewcommand*{\descriptionname}{\textenglish{Description}}% 
      \renewcommand*{\symbolname}{\textenglish{Symbol}}% 
      \renewcommand*{\pagelistname}{\textenglish{Page List}}% 
      \renewcommand*{\glssymbolsgroupname}{\textenglish{Symbols}}% 
      \renewcommand*{\glsnumbersgroupname}{\textenglish{Numbers}}% 
    }% 
  }% 
  {% 
    \newcommand*{\glossariescaptionsenglish}{% 
      \renewcommand*{\glossaryname}{Glossary}% 
      \renewcommand*{\acronymname}{Acronyms}% 
      \renewcommand*{\entryname}{Notation}% 
      \renewcommand*{\descriptionname}{Description}% 
      \renewcommand*{\symbolname}{Symbol}% 
      \renewcommand*{\pagelistname}{Page List}% 
      \renewcommand*{\glssymbolsgroupname}{Symbols}% 
      \renewcommand*{\glsnumbersgroupname}{Numbers}% 
    }% 
  }% 
  \ifcsdef{captions\CurrentTrackedDialect}
  {% 
    \csappto{captions\CurrentTrackedDialect}% 
    {% 
      \glossariescaptionsenglish
    }% 
  }% 
  {% 
    \ifcsdef{captions\CurrentTrackedLanguage}
    {% 
      \csappto{captions\CurrentTrackedLanguage}% 
      {% 
        \glossariescaptionsenglish
      }% 
    }% 
    % 
    % 
  }% 
  \glossariescaptionsenglish
}
\renewcommand*{\glspluralsuffix}{s}
\renewcommand*{\glsacrpluralsuffix}{\glspluralsuffix}
\renewcommand*{\glsupacrpluralsuffix}{\glstextup{\glspluralsuffix}}
This is a somewhat longer file, but again you can use it as a template. Replace English with the translator language label Lang used for the dictionary file and replace english with the root language name lang. Within the definition of \glossariescaptionslang, replace the English text (such as “Glossaries”) with the appropriate translation.

The suffixes used to generate the plural forms when the plural hasn’t been specified are given by \glspluralsuffix (for general entries). For acronyms defined with the base \newacronym, \glsupacrpluralsuffix is used for the small caps acronym styles where the suffix needs to be set using \glstextup to counteract the effects of \textsc and \glsacrpluralsuffix for other acronym styles. There’s no guarantee when these commands will be expanded. They may be expanded on definition or they may be expanded on use, depending on the glossaries configuration.

Therefore these plural suffix command definitions aren’t included in the \captionslanguage hook as that’s typically not implemented until the start of the document. This means that the suffix in effect will be for the last loaded language that redefined these commands. It’s best to initialise these commands to the most common suffix required in your document and use the plural, longplural, shortplural etc keys to override exceptions.

If you want to add a regional variation, create a file called glossaries-iso-lang-iso-region.ldf, where iso-lang is the ISO language code and iso-region is the ISO country code. For example, glossaries-en-GB.ldf. This file can load the root language file and make the appropriate changes, for example:

\ProvidesGlossariesLang{en-GB}
 \RequireGlossariesLang{english}
 \glsifusedtranslatordict{British}
 {% 
   \addglossarytocaptions{\CurrentTrackedLanguage}% 
   \addglossarytocaptions{\CurrentTrackedDialect}% 
 }
 {% 
   \@ifpackageloaded{polyglossia}% 
   {% 
     % Modify \glossariescaptionsenglish as appropriate for
     % polyglossia
   }% 
   {% 
     % Modify \glossariescaptionsenglish as appropriate for
     % non-polyglossia
   }% 
 }

If the translations includes non-Latin characters, it’s a good idea to provide code that’s independent of the input encoding. Remember that while some users may use UTF-8 (and it’s now the default encoding with modern LaTeX kernels), others may use Latin-1 or any other supported encoding, but while users won’t appreciate you enforcing your preference on them, it’s useful to provide a UTF-8 version.

The glossaries-irish.ldf file provides this as follows:

\ProvidesGlossariesLang{irish}

\glsifusedtranslatordict{Irish}
{% 
  \addglossarytocaptions{\CurrentTrackedLanguage}% 
  \addglossarytocaptions{\CurrentTrackedDialect}% 
}
{% 
  \ifdefstring{\inputencodingname}{utf8}
  {\input{glossaries-irish-utf8.ldf}}% 
  {% 
    \ifdef\XeTeXinputencoding% XeTeX defaults to UTF-8
    {\input{glossaries-irish-utf8.ldf}}% 
    {\input{glossaries-irish-noenc.ldf}}
  }
  \ifcsdef{captions\CurrentTrackedDialect}
  {% 
    \csappto{captions\CurrentTrackedDialect}% 
    {% 
      \glossariescaptionsirish
    }% 
  }% 
  {% 
    \ifcsdef{captions\CurrentTrackedLanguage}
    {
      \csappto{captions\CurrentTrackedLanguage}% 
      {% 
        \glossariescaptionsirish
      }% 
    }% 
    {% 
    }% 
  }% 
  \glossariescaptionsirish
}
(Again you can use this as a template. Replace irish with your root language label and Irish with the translator dictionary label.)

There are now two extra files: glossaries-irish-noenc.ldf (no encoding information) and glossaries-irish-utf8.ldf (UTF-8).

These both define \glossariescaptionsirish but the *-noenc.ldf file uses LaTeX accent commands:

\@ifpackageloaded{polyglossia}% 
{% 
  \newcommand*{\glossariescaptionsirish}{% 
    \renewcommand*{\glossaryname}{\textirish{Gluais}}% 
    \renewcommand*{\acronymname}{\textirish{Acrainmneacha}}% 
    \renewcommand*{\entryname}{\textirish{Ciall}}% 
    \renewcommand*{\descriptionname}{\textirish{Tuairisc}}% 
    \renewcommand*{\symbolname}{\textirish{Comhartha}}% 
    \renewcommand*{\glssymbolsgroupname}{\textirish{Comhartha\'\i}}% 
    \renewcommand*{\pagelistname}{\textirish{Leathanaigh}}% 
    \renewcommand*{\glsnumbersgroupname}{\textirish{Uimhreacha}}% 
  }% 
}% 
{% 
  \newcommand*{\glossariescaptionsirish}{% 
    \renewcommand*{\glossaryname}{Gluais}% 
    \renewcommand*{\acronymname}{Acrainmneacha}% 
    \renewcommand*{\entryname}{Ciall}% 
    \renewcommand*{\descriptionname}{Tuairisc}% 
    \renewcommand*{\symbolname}{Comhartha}% 
    \renewcommand*{\glssymbolsgroupname}{Comhartha\'\i}% 
    \renewcommand*{\pagelistname}{Leathanaigh}% 
    \renewcommand*{\glsnumbersgroupname}{Uimhreacha}% 
  }% 
}
whereas the *-utf8.ldf file replaces the accent commands with the appropriate UTF-8 characters.

1.6. Generating the Associated Glossary Files[link]

This section is only applicable if you have chosen Options 2 or 3. You can ignore this section if you have chosen any of the other options. (For Option 4, see the bib2gls manual for details.) If you want to alphabetically sort your entries always remember to use the sort key if the name contains any LaTeX commands (except if you’re using bib2gls).

If this section seriously confuses you, and you can’t work out how to run external tools like makeglossaries or makeindex, you can try using the automake package option, described in §2.5, but you will need TeX’s shell escape enabled. See also Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build. Since makeindex is on the trusted list, the restricted shell escape may be used, which is safer than the unrestricted mode. For example:

\usepackage[automake]{glossaries}
\makeglossaries
If the document source is in the file myDoc.tex then this requires:
pdflatex -shell-restricted myDoc
pdflatex -shell-restricted myDoc
(you may find that -shell-restricted is the default for your system, in which case it may be omitted). Whereas:
\usepackage[xindy,automake]{glossaries}
\makeglossaries
requires:
pdflatex -shell-escape myDoc
pdflatex -shell-escape myDoc
Be aware that this unrestricted mode is a security risk, so it’s best avoided.

In order to generate a sorted glossary with compact number lists, it is necessary to use an external indexing application as an intermediate step (Option 1, which uses TeX to do the sorting, can’t compact number lists). It is this application that creates the file containing the code required to typeset the glossary. If this step is omitted, the glossaries will not appear in your document.

The two oldest indexing applications most commonly used with LaTeX are makeindex and xindy. The glossaries package can be used with either of these applications. Any other application that can support makeindex’s syntax and style file may be used instead of makeindex. Simply follow the makeindex instructions and substitute the call to makeindex with the appropriate call to the alternative.

Commands that only have an effect when xindy is used are described in §14.

This is a multi-stage process, but there are methods of automating document compilation using applications such as latexmk and arara. With arara you can just add special comments to your document source:
% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
With latexmk you need to set up the required dependencies.

The glossaries package comes with the Perl script makeglossaries which will run makeindex or xindy on all the indexing files using a customized style file (which is created by \makeglossaries). See §1.6.1 for further details. Perl is stable, cross-platform, open source software that is used by a number of TeX-related applications (including xindy and latexmk). Most Unix-like operating systems come with a Perl interpreter. TeX Live also comes with a Perl interpreter. As far as I know, MikTeX doesn’t come with a Perl interpreter so if you are a Windows MikTeX user you will need to install Perl if you want to use makeglossaries or xindy. Further information is available at http://www.perl.org/about.html and MikTeX and Perl scripts (and one Python script).

The advantages of using makeglossaries:

The first two items also apply to makeglossaries-lite.

As from version 4.16, the glossaries package also comes with a Lua script called makeglossaries-lite. This is a trimmed-down alternative to the makeglossaries Perl script. It doesn’t have some of the options that the Perl version has and it doesn’t attempt to diagnose any problems, but since modern TeX distributions come with LuaTeX (and therefore have a Lua interpreter) you don’t need to install anything else in order to use makeglossaries-lite so it’s an alternative to makeglossaries if you want to use Option 2 (makeindex).

If things go wrong and you can’t work out why your glossaries aren’t being generated correctly, you can use makeglossariesgui as a diagnostic tool. Once you’ve fixed the problem, you can then go back to using makeglossaries or makeglossaries-lite.

Whilst I strongly recommended that you use the makeglossaries Perl script or the makeglossaries-lite Lua script, it is possible to use the glossaries package without using those applications. However, note that some commands and package options have no effect if you explicitly run makeindex/xindy. These are listed in Table 1.3.

If you are choosing not to use makeglossaries because you don’t want to install Perl, you will only be able to use makeindex as xindy also requires Perl. (Other useful Perl scripts include epstopdf and latexmk, so it’s well-worth the effort to install Perl.) Alternatively, if you have Java installed, switch to glossaries-extra and bib2gls.

Below, references to makeglossaries can usually be substituted with makeglossaries-lite, except where noted otherwise.

If any of your entries use an entry that is not referenced outside the glossary (for example, the entry is only referenced in the description of another entry), you will need to do an additional makeglossaries, makeindex or xindy run, as appropriate. For example, suppose you have defined the following entries:

\newglossaryentry{citrusfruit}{name={citrus fruit},
description={fruit of any citrus tree. (See also 
\gls{orange})}}

\newglossaryentry{orange}{name={orange},
description={an orange coloured fruit.}}
and suppose you have \gls{citrusfruit} in your document but don’t reference the “orange” entry, then the orange entry won’t appear in your glossary until you first create the glossary and then do another run of makeglossaries, makeindex or xindy. For example, if the document is called myDoc.tex, then you must do:
pdflatex myDoc
makeglossaries myDoc
pdflatex myDoc
makeglossaries myDoc
pdflatex myDoc
(In the case of Option 4, bib2gls will scan the description for instances of commands like \gls to ensure they are selected but an extra bib2gls call is required to ensure the locations are included, if location lists are required. See the bib2gls manual for further details.)

Likewise, an additional makeglossaries and LaTeX run may be required if the document pages shift with re-runs. For example, if the page numbering is not reset after the table of contents, the insertion of the table of contents on the second LaTeX run may push glossary entries across page boundaries, which means that the number lists in the glossary may need updating.

The examples in this document assume that you are accessing makeglossaries, xindy or makeindex via a terminal. Windows users can use the command prompt which is usually accessed via the StartAll Programs menu or StartAll ProgramsAccessories menu or StartWindows System.

Alternatively, your text editor may have the facility to create a function that will call the required application. See Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build.

If any problems occur, remember to check the transcript files (e.g. glg or alg) for messages.

Table 1.3: Commands and package options that have no effect when using xindy or makeindex explicitly
Command or Package Option makeindex xindy
order=letter use -l use -M ord/letorder
order=word default default
xindy={language={lang},codepage={code}} N/A use -L lang -C code
\GlsSetXdyLanguage{lang} N/A use -L lang
\GlsSetXdyCodePage{code} N/A use -C code

1.6.1. Using the makeglossaries Perl Script[link]

makeglossaries options aux-file

The makeglossaries script picks up the relevant information from the auxiliary (aux) file and will either call xindy or makeindex, depending on the supplied information. Therefore, you only need to pass the document’s name without the extension to makeglossaries. For example, if your document is called myDoc.tex, type the following in your terminal:

pdflatex myDoc
makeglossaries myDoc
pdflatex myDoc
If you only want one glossary processed (for example, if you are working on a draft of a large document and want to concentrate on one specific glossary) then include the out-ext extension supplied to \newglossary, such as glo for the main glossary. Note that if you do specify the extension and your document has multiple glossaries defined, then makeglossaries will tell you how many glossaries have been ignored unless the -q switch has been used.

Windows users: TeX Live on Windows has its own internal Perl interpreter and provides makeglossaries.exe as a convenient wrapper for the makeglossaries Perl script. MikTeX also provides a wrapper makeglossaries.exe but doesn’t provide a Perl interpreter (as far as I know), which is still required even if you run MikTeX’s makeglossaries.exe, so with MikTeX you’ll need to install Perl. There’s more information about this at MikTeX and Perl scripts (and one Python script).

When upgrading the glossaries package, make sure you also upgrade your version of makeglossaries. The current version is 4.55.

Some of the options are only applicable to makeindex and some are only applicable to xindy.

--help
Shows a summary of all available options.

--version
Shows the version details.

-n
Dry run mode. This doesn’t actually run makeindex/xindy but just prints the command it would execute based on the information given in the aux file and the supplied options.

-d directory
Instructs makeglossaries to change to the given directory, which should be where the aux, glo etc files are located. For example:
pdflatex -output-directory myTmpDir myDoc
makeglossaries -d myTmpDir myDoc

-e
Don’t check for multiple encaps (only applicable with makeindex). By default, if you are using makeindex, makeglossaries will check the makeindex transcript for multiple encap warnings.

The multiple encap warning is where different location encap values (location formats) are used on the same location for the same entry. For example:

\documentclass{article}

\usepackage{glossaries}
\makeglossaries

\newglossaryentry{sample}{name={sample},description={an example}}

\begin{document}
\gls{sample}, \gls[format=textbf]{sample}.
\printglossaries
\end{document}
If you explicitly use makeindex, this will cause a warning and the location list will be “1, 1”. That is, the page number will be repeated with each format. As from v2.18, makeglossaries will check for this warning and, if found, will attempt to correct the problem by removing duplicate locations and retrying. If you actually want the duplicate location, you can prevent makeglossaries from checking and correcting the duplicates with -e.

There’s no similar check for xindy as xindy won’t produce any warning and will simply discard duplicates.

-q
Suppresses messages. The makeglossaries script attempts to fork the makeindex/xindy process using open() on the piped redirection 2>&1 | and parses the processor output to help diagnose problems. If this method fails makeglossaries will print an “Unable to fork” warning and will retry without redirection. Without this redirection, the -q switch doesn’t work as well. Some operating systems don’t support redirection.

-Q
Suppresses the “Unable to fork” warning.

-k
Don’t attempt redirection.

-m applicationinitial: makeindex
The makeindex application. Only the name is required if it’s on the operating system’s path, otherwise the full path name will be needed.

If you want to use an application that is capable of reading makeindex files (including support for makeindex style files via -s), then you can use -m to specify the alternative application to use instead of makeindex. Note that both xindex and texindy can read makeindex files using the default makeindex syntax but, as of the time of writing this, they don’t support makeindex style files.

-x applicationinitial: xindy
The xindy application. Only the name is required if it’s on the operating system’s path, otherwise the full path name will be needed.

-c
Compress intermediate blanks. This will pass -c to makeindex. (Ignored if xindy should be called.)

-r
Disable implicit page range formation. This will pass -r to makeindex. (Ignored if xindy should be called.)

-p num
Set the starting page number. This will pass -p num to makeindex. (Ignored if xindy should be called.)

The following switches may be used to override settings written to the aux file.

-l
Use letter ordering. This will pass -l to makeindex or -M ord/letorder to xindy.

-L language
The language to pass to xindy. (Ignored if makeindex should be called.)

-g
Employ German word ordering. This will pass -g to makeindex. (Ignored if xindy should be called.)

-s filename
Set the style file. This will pass -s filename to makeindex or -M basename to xindy (where basename is filename with the xdy extension removed). This will generate an error if the extension is xdy when makeindex should be called, or if the extension isn’t xdy when xindy should be called.

-o filename
Sets the output file name. Note that this should only be used when only one glossary should be processed. The default is to set the output filename to the basename supplied to makeglossaries with the extension associated with the glossary (the in-ext argument of \newglossary).

-t filename
Sets the transcript file name. Note that this should only be used when only one glossary should be processed. The default is to set the transcript filename to the basename supplied to makeglossaries with the extension associated with the glossary (the log-ext argument of \newglossary).

1.6.2. Using the makeglossaries-lite Lua Script[link]

makeglossaries-lite options aux-file

The Lua alternative to the makeglossaries Perl script requires a Lua interpreter, which should already be available if you have a modern TeX distribution that includes LuaTeX. Lua is a light-weight, cross-platform scripting language, but because it’s light-weight it doesn’t have the full-functionality of heavy-weight scripting languages, such as Perl. The makeglossaries-lite script is therefore limited by this and some of the options available to the makeglossaries Perl script aren’t available here. (In particular the -d option.) Whilst it may be possible to implement those features by requiring Lua packages, this would defeat the purpose of providing this script for those don’t want the inconvenience of learning how to install interpreters or their associated packages.

The script is actually supplied as makeglossaries-lite.lua but TeX distributions on Windows convert this to an executable wrapper makeglossaries-lite.exe and TeX Live on Unix-like systems provide a symbolic link without the extension.

The makeglossaries-lite script can be invoked in the same way as makeglossaries. For example, if your document is called myDoc.tex, then do

makeglossaries-lite myDoc
Note that the arara rule doesn’t contain the hyphen:
% arara: makeglossarieslite

Some of the options are only applicable to makeindex and some are only applicable to xindy. There’s no equivalent to the -d available to makeglossaries but it may work if you prefix the basename with the path.

--help
Shows a summary of all available options.

--version
Shows the version details.

-n
Dry run mode. This doesn’t actually run makeindex/xindy but just prints the command it would execute based on the information given in the aux file and the supplied options.

-q
Quiet mode. This suppresses some but not all messages.

-m applicationinitial: makeindex
The makeindex application. Only the name is required if it’s on the operating system’s path, otherwise the full path name will be needed.

-x applicationinitial: xindy
The xindy application. Only the name is required if it’s on the operating system’s path, otherwise the full path name will be needed.

-c
Compress intermediate blanks. This will pass -c to makeindex. (Ignored if xindy should be called.)

-r
Disable implicit page range formation. This will pass -r to makeindex. (Ignored if xindy should be called.)

-p num
Set the starting page number. This will pass -p num to makeindex. (Ignored if xindy should be called.)

The following switches may be used to override settings written to the aux file.

-l
Use letter ordering. This will pass -l to makeindex or -M ord/letorder to xindy.

-L language
The language to pass to xindy. (Ignored if makeindex should be called.)

-g
Employ German word ordering. This will pass -g to makeindex. (Ignored if xindy should be called.)

-s filename
Set the style file.

-o filename
Sets the output file name. Note that this should only be used when only one glossary should be processed. The default is to set the output filename to the basename supplied to makeglossaries with the extension associated with the glossary (the in-ext argument of \newglossary).

-t filename
Sets the transcript file name. Note that this should only be used when only one glossary should be processed. The default is to set the transcript filename to the basename supplied to makeglossaries with the extension associated with the glossary (the log-ext argument of \newglossary).

1.6.3. Using xindy explicitly (Option 3)[link]

xindy comes with TeX Live. It has also been added to MikTeX, but if you don’t have it installed, see How to use Xindy with MikTeX.

If you want to use xindy to process the glossary files, you must make sure you have used the xindy package option:

\usepackage[xindy]{glossaries}
This is required regardless of whether you use xindy explicitly or whether it’s called implicitly via applications such as makeglossaries. This causes the glossary entries to be written in raw xindy format, so you need to use -I xindy not -I tex.

To run xindy type the following in your terminal (all on one line):

xindy -L language -C encoding -I xindy -M style -t base.glg -o base.gls base.glo
where language is the required language name, encoding is the encoding, base is the name of the document without the tex extension and style is the name of the xindy style file without the xdy extension. The default name for this style file is basexdy but can be changed via \setStyleFile. As usual for command line applications, if any of the file names contain spaces, you must delimit them using double-quotes.

For example, if your document is called myDoc.tex and you are using UTF-8 encoding in English, then type the following in your terminal:

xindy -L english -C utf8 -I xindy -M myDoc -t myDoc.glg -o myDoc.gls myDoc.glo

Note that this just creates the main glossary. You need to do the same for each of the other glossaries (including the list of acronyms if you have used the acronym package option), substituting glg, gls and glo with the relevant extensions. For example, if you have used the acronym package option, then you would need to do:

xindy -L english -C utf8 -I xindy -M myDoc -t myDoc.alg -o myDoc.acr myDoc.acn
For additional glossaries, the extensions are those supplied when you created the glossary with \newglossary.

Note that if you use makeglossaries instead, you can replace all those calls to xindy with just one call to makeglossaries:

makeglossaries myDoc
Note also that some commands and package options have no effect if you use xindy explicitly instead of using makeglossaries. These are listed in Table 1.3.

1.6.4. Using makeindex explicitly (Option 2)[link]

If you want to use makeindex explicitly, you must make sure that you haven’t used the xindy package option or the glossary entries will be written in the wrong format. To run makeindex, type the following in your terminal:

makeindex -s style.ist -t base.glg -o base.gls base.glo
where base is the name of your document without the tex extension and styleist is the name of the makeindex style file. By default, this is baseist, but may be changed via \setStyleFile. Note that there are other options, such as -l (letter ordering). See the makeindex manual for further details.

For example, if your document is called myDoc.tex, then type the following at the terminal:

makeindex -s myDoc.ist -t myDoc.glg -o myDoc.gls myDoc.glo
Note that this only creates the main glossary. If you have additional glossaries (for example, if you have used the acronym package option) then you must call makeindex for each glossary, substituting glg, gls and glo with the relevant extensions. For example, if you have used the acronym package option, then you need to type the following in your terminal:
makeindex -s myDoc.ist -t myDoc.alg -o myDoc.acr myDoc.acn
For additional glossaries, the extensions are those supplied when you created the glossary with \newglossary.

Note that if you use makeglossaries instead, you can replace all those calls to makeindex with just one call to makeglossaries:

makeglossaries myDoc
Note also that some commands and package options have no effect if you use makeindex explicitly instead of using makeglossaries. These are listed in Table 1.3.

1.7. Note to Front-End and Script Developers[link]

The information needed to determine whether to use xindy, makeindex or bib2gls is stored in the aux file. This information can be gathered by a front-end, editor or script to make the glossaries where appropriate. This section describes how the information is stored in the auxiliary file. See also Decyphering the Aux File Commands Provided by glossaries.sty and glossaries-extra.sty.

1.7.1. MakeIndex and Xindy[link]

The file extension of the indexing files used for each defined glossary (not including any ignored glossaries) are given by:

\@newglossary{glossary-label}{log}{out-ext}{in-ext}
where in-ext is the extension of the indexing application’s input file (the output file from the glossaries package’s point of view), such as glo, out-ext is the extension of the indexing application’s output file (the input file from the glossaries package’s point of view), such as gls, and log is the extension of the indexing application’s transcript file, such as glg. The label for the glossary is also given. This isn’t required with makeindex, but with xindy it’s needed to pick up the associated language and encoding (see below). For example, the information for the default main glossary is written as:
\@newglossary{main}{glg}{gls}{glo}
If glossaries-extra’s hybrid method has been used (with \makeglossaries[sub-list]), then the sub-list of glossaries that need to be processed will be identified with:
\glsxtr@makeglossaries{label-list}

The indexing application’s style file is specified by:

\@istfilename{filename}
The file extension indicates whether to use makeindex (ist) or xindy (xdy). Note that the glossary information has a different syntax depending on which indexing application is supposed to be used, so it’s important to call the correct one.

For example, with arara you can easily determine whether to run makeglossaries:

% arara: makeglossaries if found("aux", "@istfilename")
It’s more complicated if you want to explicitly run makeindex or xindy.

Note that if you choose to explicitly call makeindex or xindy then the user will miss out on the diagnostic information and the encap-clash fix that makeglossaries also provides.

Word or letter ordering is specified by:

\@glsorder{order}
where order can be either word or letter (obtained from the order package option).

If xindy should be used, the language for each glossary is specified by:

\@xdylanguage{glossary-label}{language}
where glossary-label identifies the glossary and language is the root language (for example, english).

The codepage (file encoding) for all glossaries is specified by:

\@gls@codepage{code-page}
where code is the encoding (for example, utf8). The above two commands are omitted if makeindex should be used.

If Option 1 has been used, the aux file will contain

\@gls@reference{type}{label}{location}
for every time an entry has been referenced.

1.7.2. Entry Labels[link]

If you need to gather labels for auto-completion, the writeglslabels package option will create a file containing the labels of all defined entries (regardless of whether or not the entry has been used in the document). As from v4.47, there is a similar option writeglslabelnames that writes both the label and name (separated by a tab).

The glossaries-extra package also provides docdef=atom, which will create the glsdefs file but will act like docdef=restricted.

1.7.3. Bib2Gls[link]

If Option 4 has been used, the aux file will contain one or more instances of:
\glsxtr@resource{options}{basename}
where basename is the basename of the glstex file that needs to be created by bib2gls. If src={bib list} isn’t present in options then basename also indicates the name of the associated bib file.

For example, with arara you can easily determine whether or not to run bib2gls:

% arara: bib2gls if found("aux", "glsxtr@resource")
(It gets more complicated if both \glsxtr@resource and \@istfilename are present as that indicates the hybrid record=hybrid option.)

Remember that with bib2gls, the glossary entries will never be defined on the first LaTeX call (because their definitions are contained in the glstex file created by bib2gls). You can also pick up labels from the records in aux file, which will be in the form:

\glsxtr@record{label}{h-prefix}{counter}{format}{loc}
or (with record=nameref):
\glsxtr@record@nameref{label}{href prefix}{counter}{format}{location}{title}{href anchor}{href value}
or (with \glssee):
\glsxtr@recordsee{label}{xr list}
You can also pick up the commands defined with \glsxtrnewglslike, which are added to the aux file for bib2gls’s benefit:
\@glsxtr@newglslike{label-prefix}{cs}
If \GlsXtrSetAltModifier is used, then the modifier is identified with:
\@glsxtr@altmodifier{character}
Label prefixes (for the \dgls set of commands) are identified with:
\@glsxtr@prefixlabellist{list}

2. Package Options[link]

This section describes the available glossaries package options. You may omit the =true for boolean options. (For example, acronym is equivalent to acronym=true).

The glossaries-extra package has additional options described in the glossaries-extra manual. The extension package also has some different default settings to the base package. Those that are available at the time of writing are included here. Future versions of glossaries-extra may have additional package options or new values for existing settings that aren’t listed here.

Note that key=value package options can’t be passed via the document class options. (This includes options where the value part may be omitted, such as acronym.) This is a general limitation not restricted to the glossaries package. Options that aren’t key=value (such as makeindex) may be passed via the document class options.

2.1. General Options[link]

nowarn
This suppresses all warnings generated by the glossaries package. Don’t use this option if you’re new to using glossaries as the warnings are designed to help detect common mistakes (such as forgetting to use \makeglossaries). Note that if you use debug with any value other than false it will override this option.

nolangwarn
This suppresses the warning generated by a missing language module.

noredefwarn
If you load glossaries with a class or another package that already defines glossary related commands, by default glossaries will warn you that it’s redefining those commands. If you are aware of the consequences of using glossaries with that class or package and you don’t want to be warned about it, use this option to suppress those warnings. Other warnings will still be issued unless you use the nowarn option described above. (This option is automatically switched on by glossaries-extra.)

debug=valueinitial: false
Debugging mode may write information to the transcript file or add markers to the document. The following values are available:
debug=false
Switches off debugging mode.

debug=true
This will write the following line to the transcript file if any attempt at indexing occurs before the associated files have been opened by \makeglossaries:
wrglossary(glossary-type)(indexing info)
Note that this setting will also cancel nowarn.

debug=showtargets
As debug=true but also adds a marker where the glossary-related hyperlinks and targets occur in the document.

The debug=showtargets option will additionally use:

\glsshowtarget{target name}
to show the hypertarget or hyperlink name when \glsdohypertarget is used by commands like \glstarget and when \glsdohyperlink is used by commands like \gls. In math mode or inner mode, this uses:
\glsshowtargetinner{target name}
which typesets the target name as:
[\glsshowtargetfonttext{target name}]
just before the link or anchor. This uses the text-block command:
\glsshowtargetfonttext{text}
which checks for math-mode before applying the font change. In outer mode \glsshowtarget uses:
\glsshowtargetouter{target name}
which by default places the target name in the margin with a symbol produced with:
\glsshowtargetsymbol{target name}
which defaults to a small right facing triangle.

The font used by both \glsshowtargetfonttext and \glsshowtargetouter is given by the declaration:

\glsshowtargetfontinitial: \ttfamily\footnotesize

debug=showaccsupp
As debug=true but also adds a marker where the glossary-related accessibility information occurs (see glossaries-accsupp) using:
\glsshowaccsupp{options}{PDF element}{value}

The glossaries-extra package provides extra values debug=showwrgloss, that may be used to show where the indexing is occurring, and debug=all, which switches on all debugging options. See the glossaries-extra manual for further details.

The purpose of the debug mode can be demonstrated with the following example document:

\documentclass{article}
\usepackage{glossaries}
\newglossaryentry{sample1}{name={sample1},description={example}}
\newglossaryentry{sample2}{name={sample2},description={example}}
\glsadd{sample2}% <- does nothing here
\makeglossaries
\begin{document}
\gls{sample1}.
\printglossaries
\end{document}
In this case, only the “sample1” entry has been indexed, even though \glsadd{sample2} appears in the source code. This is because \glsadd{sample2} has been used before the associated file is opened by \makeglossaries. Since the file isn’t open yet, the information can’t be written to it, which is why the “sample2” entry doesn’t appear in the glossary.

Without \makeglossaries the indexing is suppressed with Options 2 and 3 but, other than that, commands like \gls behave as usual.

This situation doesn’t cause any errors or warnings as it’s perfectly legitimate for a user to want to use glossaries to format the entries (for example, to show a different form on first use) but not display any glossaries (or the user may prefer to use the unsorted Options 5 or 6). It’s also possible that the user may want to temporarily comment out \makeglossaries in order to suppress the indexing while working on a draft version to speed compilation, or the user may prefer to use Options 1 or 4 for indexing, which don’t use \makeglossaries.

Therefore \makeglossaries can’t be used to enable \newglossaryentry and commands like \gls and \glsadd. These commands must be enabled by default. (It does, however, enable the see key as that’s a more common problem. See below.)

The debug mode, enabled with the debug option,

\usepackage[debug]{glossaries}
will write information to the log file when the indexing can’t occur because the associated file isn’t open. The message is written in the form
Package glossaries Info: wrglossary(type)(text) on
input line line number.
where type is the glossary label and text is the line of text that would’ve been written to the associated file if it had been open. So if any entries haven’t appeared in the glossary but you’re sure you used commands like \glsadd or \glsaddall, try switching on the debug option and see if any information has been written to the log file.

savewrites=booleandefault: true; initial: false
This is a boolean option to minimise the number of write registers used by the glossaries package. The default is savewrites=false. With Options 2 and 3, one write register is required per (non-ignored) glossary and one for the style file.

In general, this package option is best avoided.

With all options except Options 1 and 414, another write register is required if the glsdefs file is needed to save document definitions. With both Options 1 and 4, no write registers are required (document definitions aren’t permitted and indexing information is written to the aux file). If you really need document definitions but you want to minimise the number of write registers then consider using docdef=restricted with glossaries-extra.

There are only a limited number of write registers, and if you have a large number of glossaries or if you are using a class or other packages that create a lot of external files, you may exceed the maximum number of available registers. If savewrites is set, the glossary information will be stored in token registers until the end of the document when they will be written to the external files.

This option can significantly slow document compilation and may cause the indexing to fail. Page numbers in the number list will be incorrect on page boundaries due to TeX’s asynchronous output routine. As an alternative, you can use the scrwfile package (part of the KOMA-Script bundle) and not use this option.

By way of comparison, sample-multi2.tex provided with bib2gls has a total of 15 glossaries. With Options 2 or 3, this would require 46 associated files and 16 write registers. (These figures don’t include standard files and registers provided by the kernel or hyperref, such as aux and out.) With bib2gls, no write registers are required and there are only 10 associated files for that particular document (9 resource files and 1 transcript file).

If you want to use TeX’s shell escape to call makeindex or xindy from your document and use savewrites, then use automake=immediate or automake=makegloss or automake=lite.

translate=valuedefault: true; initial: varies
This can take one of the values listed below. If no supported language package has been loaded the default is translate=false otherwise the default is translate=true for the base glossaries package and translate=babel for glossaries-extra.

If babel has been loaded and the translator package is installed, translator will be loaded and the translations will be provided by the translator package interface. You can modify the translations by providing your own dictionary. If the translator package isn’t installed and babel is loaded, the glossaries-babel package will be loaded and the translations will be provided using babel’s \addto\captionslanguage mechanism. If polyglossia has been loaded, glossaries-polyglossia will be loaded.

Don’t provide translations, even if babel or polyglossia has been loaded. (Note that babel provides the command \glossaryname so that will still be translated if you have loaded babel.)

Don’t load the translator package. Instead load glossaries-babel.

I recommend you use translate=babel if you have any problems with the translations or with PDF bookmarks, but to maintain backward compatibility, if babel has been loaded the default is translate=true.

See §1.5.1 for further details.

notranslate
This is equivalent to translate=false and may be passed via the document class options.

languages
This automatically implements translate=babel (which means that translator won’t automatically be loaded) but will also add the list of languages to tracklang’s list of tracked languages. Each element in the list may be an ISO language tag (such as pt-BR) or one of tracklang’s known language labels (such as british).

localesalias: languages
Synonym of languages.

hyperfirst=booleandefault: true; initial: true
If true, terms on first use will have a hyperlink, if supported, unless the hyperlink is explicitly suppressed using starred versions of commands such as \gls*. If false, only subsequent use instances will have a hyperlink (if supported).

Note that nohypertypes overrides hyperfirst=true. This option only affects commands that check the first use flag, such as the \gls-like commands (for example, \gls or \glsdisp), but not the \glstext-like commands (for example, \glslink or \glstext).

The hyperfirst setting applies to all glossary types (unless identified by nohypertypes or defined with \newignoredglossary). It can be overridden on an individual basis by explicitly setting the hyper key when referencing an entry (or by using the plus or starred version of the referencing command).

It may be that you only want to suppress hyperlinks for just the acronyms (where the first use explains the meaning of the acronym) but not for ordinary glossary entries (where the first use is identical to subsequent use). In this case, you can use hyperfirst=false and apply \glsunsetall to all the regular (non-acronym) glossaries. For example:

\usepackage[acronym,hyperfirst=false]{glossaries}
% acronym and glossary entry definitions

% at the end of the preamble
\glsunsetall[main]

Alternatively you can redefine the hook

\glslinkcheckfirsthyperhook
which is used by the commands that check the first use flag, such as \gls. Within the definition of this command, you can use \glslabel to reference the entry label and \glstype to reference the glossary type. You can also use \ifglsused to determine if the entry has been used. You can test if an entry is an acronym by checking if it has the long key set using \ifglshaslong (or if the short key has been set using \ifglshasshort). For example, to switch off the hyperlink on first use just for acronyms:
\renewcommand*{\glslinkcheckfirsthyperhook}{% 
 \ifglsused{\glslabel}{}% 
 {% 
   \ifglshaslong{\glslabel}{\setkeys{glslink}{hyper=false}}% 
 }% 
}

Note that this hook isn’t used by the commands that don’t check the first use flag, such as \glstext. (You can, instead, redefine \glslinkpostsetkeys, which is used by both the \gls-like and \glstext-like commands.)

The glossaries-extra package provides a method of disabling the first use hyperlink according to the entry’s associated category. For example, if you only want to switch off the first use hyperlink for abbreviations then you simply need to set the nohyperfirst attribute for the abbreviation and, if appropriate, acronym categories. (Instead of using the hyperfirst package option.) See the glossaries-extra manual for further details.

writeglslabels
This option will create a file called \jobname.glslabels at the end of the document. This file simply contains a list of all defined entry labels (including those in any ignored glossaries). It’s provided for the benefit of text editors that need to know labels for auto-completion. If you also want the name, use writeglslabelnames. (See also glossaries-extra’s docdef=atom package option.)

Note that with bib2gls the file will only contain the entries that bib2gls has selected from the bib files.

writeglslabelnames
Similar to writeglslabels but writes both the label and name (separated by a tab).

undefaction=valueinitial: error

Only available with glossaries-extra, the value for this option may be one of:

Generates an error if a referenced entry is undefined (default, and the only available setting with just the base glossaries package).

Only warns if a referenced entry is undefined (automatically activated with Option 4).

docdef=valuedefault: true; initial: false

Only available with glossaries-extra, this option governs the use of \newglossaryentry. Available values:

docdef=false
This setting means that \newglossaryentry is not permitted in the document environment (default with glossaries-extra and for Option 1 with just the base glossaries package).

docdef=restricted
This setting means that \newglossaryentry is only permitted in the document environment if it occurs before \printglossary (not available for some indexing options, such as Option 4).

This setting is as docdef=restricted but creates the glsdefs file for use by atom (without the limitations of docdef=true).

This setting means that \newglossaryentry is permitted in the document environment where it would normally be permitted by the base glossaries package. This will create the glsdefs file if \newglossaryentry is found in the document environment.

2.2. Sectioning, Headings and TOC Options[link]

toc=booleandefault: true; initial: varies
Adds the glossaries to the table of contents (toc file). Note that an extra LaTeX run is required with this option. Alternatively, you can switch this function on and off using
\glstoctrue
and
\glstocfalse
You can test whether or not this option is set using:
\ifglstoc true\else false\fiinitial: \iffalse
The default value is toc=false for the base glossaries package and toc=true for glossaries-extra.

numberline=booleandefault: true; initial: false
When used with toc=true option, this will add \numberline{} in the final argument of \addcontentsline. This will align the table of contents entry with the numbered section titles. Note that this option has no effect with toc=false. If toc=true is used without numberline, the glossary title will be aligned with the section numbers rather than the section titles.

section=namedefault: section

This option indicates the sectional unit to use for the glossary. The value name should be the control sequence name without the leading backslash or following star (for example, just chapter not \chapter or chapter*).

The default behaviour is for the glossary heading to use \chapter, if that command exists, or \section otherwise. The starred or unstarred form is determined by the numberedsection option.

Example:

\usepackage[section=subsection]{glossaries}
You can omit the value if you want to use \section:
\usepackage[section]{glossaries}
is equivalent to
\usepackage[section=section]{glossaries}
You can change this value later in the document using
\setglossarysectionname
where name is the sectional unit.

The start of each glossary adds information to the page header via \glsglossarymark (see §8.2).

ucmark=booleandefault: true; initial: varies
If ucmark=true, this will make \glsglossarymark use all caps in the header, otherwise no case change will be applied. The default is ucmark=false, unless memoir has been loaded, in which case the default is ucmark=true.

You can test if this option has been set using:

\ifglsucmark true\else false\fiinitial: varies
For example:
\renewcommand{\glsglossarymark}[1]{% 
  \ifglsucmark
    \markright{\glsuppercase{#1}}% 
  \else
    \markright{#1}% 
  \fi}

numberedsection=valuedefault: nolabel; initial: false
The glossaries are placed in unnumbered sectional units by default, but this can be changed using numberedsection. This option can take one of the following values:

No number, that is, use the starred form of sectioning command (for example, \chapter* or \section*).

Use a numbered section, that is, the unstarred form of sectioning command (for example, \chapter or \section), but no label is automatically added.

Use numbered sections with automatic labelling. Each glossary uses the unstarred form of a sectioning command (for example, \chapter or \section) and is assigned a label (via \label). The label is formed from the glossary’s label prefixed with:
\glsautoprefix
The default value of \glsautoprefix is empty. For example, if you load glossaries using:
\usepackage[section,numberedsection=autolabel]
  {glossaries}
then each glossary will appear in a numbered section, and can be referenced using something like:
The main glossary is in section~\ref{main} and 
the list of acronyms is in section~\ref{acronym}.
If you can’t decide whether to have the acronyms in the main glossary or a separate list of acronyms, you can use \acronymtype which is set to main if the acronym option is not used and is set to acronym if the acronym option is used. For example:
The list of acronyms is in section~\ref{\acronymtype}.
You can redefine the prefix if the default label clashes with another label in your document. For example:
\renewcommand*{\glsautoprefix}{glo:}
will add glo: to the automatically generated label, so you can then, for example, refer to the list of acronyms as follows:
The list of acronyms is in 
section~\ref{glo:\acronymtype}.
Or, if you are undecided on a prefix:
The list of acronyms is in 
section~\ref{\glsautoprefix\acronymtype}.

This setting is like numberedsection=autolabel but uses an unnumbered sectioning command (for example, \chapter* or \section*). It’s designed for use with the nameref package. For example:
\usepackage{nameref}
\usepackage[numberedsection=nameref]{glossaries}
Alternatively, since nameref is automatically loaded by hyperref:
\usepackage{hyperref}
\usepackage[numberedsection=nameref]{glossaries}
Now \nameref{main} will display the (table of contents) section title associated with the main glossary. As above, you can redefine \glsautoprefix to provide a prefix for the label.

2.3. Glossary Appearance Options[link]

savenumberlist=booleandefault: true; initial: false

Options 2 and 3 only
This is a boolean option that specifies whether or not to gather and store the number list for each entry. The default is savenumberlist=false with Options 2 and 3. (See \glsentrynumberlist and \glsdisplaynumberlist in §5.2.) This setting is always true if you use Option 1 as a by-product of the way that indexing method works.

If you use the record option (with either no value or record=only or record=nameref) then this package option has no effect. With bib2gls, the number lists are automatically saved with the default save-locations=true and save-loclist=true resource settings.

entrycounter=booleandefault: true; initial: false
If set, this will create the counter:
glossaryentry
Each top level (level 0) entry will increment and display that counter at the start of the entry line when using glossary styles that support this setting. Note that if you also use subentrycounter the option order makes a difference. If entrycounter is specified first, the sub-entry counter will be dependent on the glossaryentry counter.

If you use this option (and are using a glossary style that supports this option) then you can reference the entry number within the document using:

\glsrefentry{label}
where label is the label associated with that glossary entry. This will use \ref if either entrycounter=true or subentrycounter=true, with the label prefixlabel, where label is the entry’s label and prefix is given by:
\GlsEntryCounterLabelPrefixinitial: glsentry-
If both entrycounter=false and subentrycounter=false, \gls{label} will be used instead.

If you use \glsrefentry, you must run LaTeX twice after creating the indexing files using makeglossaries, makeindex or xindy (or after creating the glstex file with bib2gls) to ensure the cross-references are up-to-date. This is because the counter can’t be incremented and labelled until the glossary is typeset.

The glossaryentry counter can be reset back to zero with:

\glsresetentrycounter
This does nothing if entrycounter=false. The glossaryentry counter can be simultaneously incremented and labelled (using \refstepcounter and \label) with:
\glsstepentry{label}
This command is within the definition of \glsentryitem, which is typically used in glossary styles at the start of top level (level 0) entries. The argument is the entry label.

The value of the glossaryentry counter can be displayed with:

\theglossaryentry

This command is defined when the glossaryentry counter is defined, so won’t be available otherwise. The formatted value is more usually displayed with:
\glsentrycounterlabel
This will do \theglossaryentry.\space if entrycounter=true, otherwise does nothing. This is therefore more generally useful in glossary styles as it will silently do nothing if the setting isn’t on. This command is used within the definition of \glsentryitem.

If you want to test whether or not this option is currently enabled, use the conditional:

\ifglsentrycounter true\else false\fiinitial: \iffalse
You can later switch it off using:
\glsentrycounterfalse
and switch it back on with:
\glsentrycountertrue
but note that this won’t define glossaryentry if entrycounter=true wasn’t used initially. You can also locally enable or disable this option for a specific glossary using the entrycounter \printglossary option.

counterwithin=parent-counter
If used, this option will automatically set entrycountertrue and the glossaryentry counter will be reset every time parent-counter is incremented. An empty value indicates that glossaryentry has no parent counter (but glossaryentry will still be defined).

The glossaryentry counter isn’t automatically reset at the start of each glossary, except when glossary section numbering is on and the counter used by counterwithin is the same as the counter used in the glossary’s sectioning command.

If you want the counter reset at the start of each glossary, you can modify the glossary preamble (\glossarypreamble) to use \glsresetentrycounter. For example:

\renewcommand{\glossarypreamble}{% 
  \glsresetentrycounter
}
or if you are using \setglossarypreamble, add it to each glossary preamble, as required. For example:
\setglossarypreamble[acronym]{% 
  \glsresetentrycounter
  The preamble text here for the list of acronyms.
}
\setglossarypreamble{% 
  \glsresetentrycounter
  The preamble text here for the main glossary.
}

subentrycounter=booleandefault: true; initial: false
If set, each level 1 glossary entry will be numbered at the start of its entry line when using glossary styles that support this option. This option creates the counter
glossarysubentry
If the entrycounter option is used before subentrycounter, then glossarysubentry will be added to the reset list for glossaryentry. If subentrycounter is used without entrycounter then the glossarysubentry counter will be reset by \glsentryitem. If subentrycounter is used before entrycounter then the two counters are independent.

There’s no support for deeper hierarchical levels. Some styles, such as those that don’t support any hierarchy, may not support this setting or, for those that only support level 0 and level 1, may use this setting for all child entries.

As with the entrycounter option, you can reference the number within the document using \glsrefentry. There are analogous commands to those for entrycounter.

The glossarysubentry counter can be reset back to zero with:

\glsresetsubentrycounter
This does nothing if subentrycounter=false. This command is used within the definition of \glsentryitem if entrycounter=false.

The glossarysubentry counter can be simultaneously incremented and labelled (using \refstepcounter and \label) with:

\glsstepsubentry{label}
This command is used in \glssubentryitem if subentrycounter=true, otherwise it does nothing. The argument is the entry label and is passed to \label is as for \glsrefentry.

The value of the glossarysubentry counter can be displayed with:

\theglossarysubentry

This command is defined when the glossarysubentry counter is defined, so won’t be available otherwise. The formatted value is more usually displayed with:
\glssubentrycounterlabel
This will do \theglossarysubentry)\space if subentrycounter=true, otherwise does nothing. This is therefore more generally useful in glossary styles as it will silently do nothing if the setting isn’t on. This command is used in \glssubentryitem.

If you want to test whether or not this option is currently enabled, use the conditional:

\ifglssubentrycounter true\else false\fiinitial: \iffalse
You can later switch it off using:
\glssubentrycounterfalse
and switch it back on with:
\glssubentrycountertrue
but note that this won’t define glossarysubentry if subentrycounter=true wasn’t used initially. You can also locally enable or disable this option for a specific glossary using the subentrycounter \printglossary option.

style=style-nameinitial: varies
This option sets the default glossary style to style-name. This is initialised to style=list unless classicthesis has been loaded, in which case the default is style=index. (The styles that use the description environment, such as the list style, are incompatible with classicthesis.)

This setting may only be used for styles that are defined when the glossaries package is loaded. This will usually be the styles in the packages glossary-list, glossary-long, glossary-super or glossary-tree, unless they have been suppressed through options such as nostyles. Style packages can also be loaded by the stylemods option provided by glossaries-extra.

Alternatively, you can set the style later using:

\setglossarystyle{style-name}
or use the style \printglossary option. (See §13 for further details.)

nolong
This prevents the glossaries package from automatically loading glossary-long (which means that the longtable package also won’t be loaded). This reduces overhead by not defining unwanted styles and commands. Note that if you use this option, you won’t be able to use any of the glossary styles defined in the glossary-long package (unless you explicitly load glossary-long).

Some style packages implicitly load glossary-long, so this package may still end up being loaded even if you use nolong.

nosuper
This prevents the glossaries package from automatically loading glossary-super (which means that the supertabular package also won’t be loaded). This reduces overhead by not defining unwanted styles and commands. Note that if you use this option, you won’t be able to use any of the glossary styles defined in the glossary-super package (unless you explicitly load glossary-super).

This option is automatically implemented if xtab has been loaded as it’s incompatible with supertabular. This option is also automatically implemented if supertabular isn’t installed.

nolist
This prevents the glossaries package from automatically loading glossary-list. This reduces overhead by not defining unwanted styles. Note that if you use this option, you won’t be able to use any of the glossary styles defined in the glossary-list package (unless you explicitly load glossary-list). Note that since the default style is list (unless classicthesis has been loaded), you will also need to use the style option to set the style to something else.

notree
This prevents the glossaries package from automatically loading glossary-tree. This reduces overhead by not defining unwanted styles. Note that if you use this option, you won’t be able to use any of the glossary styles defined in the glossary-tree package (unless you explicitly load glossary-tree). Note that if classicthesis has been loaded, the default style is index, which is provided by glossary-tree.

Some style packages implicitly load glossary-tree, so this package may still end up being loaded even if you use notree.

nostyles
This prevents all the predefined styles from being loaded. If you use this option, you need to load a glossary style package (such as glossary-mcols). Also if you use this option, you can’t use the style package option (unless you use stylemods with glossaries-extra). Instead you must either use \setglossarystyle or the style \printglossary option. Example:
\usepackage[nostyles]{glossaries}
\usepackage{glossary-mcols}
\setglossarystyle{mcoltree}
Alternatively:
\usepackage[nostyles,stylemods=mcols,style=mcoltree]{glossaries-extra}

nonumberlist
This option will suppress the associated number lists in the glossaries (see also §12). This option can also be locally switched on or off for a specific glossary with the nonumberlist \printglossary options.

Note that if you use Options 2 or 3 (makeindex or xindy) then the locations must still be valid even if this setting is on. This package option merely prevents the number list from being displayed, but both makeindex and xindy still require a location or cross-reference for each term that’s indexed.

Remember that number list includes any cross-references, so suppressing the number list will also hide the cross-references (in which case, you may want to use seeautonumberlist).

With bib2gls, it’s more efficient to use save-locations=false in the resource options if no locations are required.

seeautonumberlist
If you suppress the number lists with nonumberlist, described above, this will also suppress any cross-referencing information supplied by the see key in \newglossaryentry or \glssee. If you use seeautonumberlist, the see key will automatically implement nonumberlist=false for that entry. (Note this doesn’t affect \glssee.) For further details see §11.

counter=counter-nameinitial: page
This setting indicates that counter-name should be the default counter to use in the number lists (see §12). This option can be overridden for a specific glossary by the counter optional argument of \newglossary or the counter key when defining an entry or by the counter option when referencing an entry.

This option will redefine:

\glscounterinitial: page
to counter-name.

nopostdot=booleandefault: true; initial: true
If true, this option suppresses the default terminating full stop in glossary styles that use the post-description hook \glspostdescription.

The default setting is nopostdot=false for the base glossaries package and nopostdot=true for glossaries-extra.

The glossaries-extra package provides postdot, which is equivalent to nopostdot=false, and also postpunc, which allows you to choose a different punctuation character.

nogroupskip=booleandefault: true; initial: false
If true, this option suppresses the default vertical gap between letter groups used by some of the predefined glossary styles. This option can also be locally switched on or off for a specific glossary with the nogroupskip \printglossary options.

This option is only relevant for glossary styles that use the conditional:

\ifglsnogroupskip true\else false\fiinitial: \iffalse
to test for this setting.

If you are using bib2gls without the --group (or -g) switch then this option is irrelevant as there won’t be any letter groups.

stylemods=listdefault: default

Loads the glossaries-extra-stylemods package, which patches the predefined glossary styles. The list argument is optional. If present, this will also load glossary-element.sty for each element in the comma-separated list. See the glossaries-extra manual for further details.

2.4. Indexing Options[link]

seenoindex=valueinitial: error
(This option is only relevant with makeindex and xindy.) The see key automatically indexes the cross-referenced entry using \glssee. This means that if this key is used in an entry definition before the relevant indexing file has been opened, the indexing can’t be performed. Since this is easy to miss, the glossaries package by default issues an error message if the see key is used before \makeglossaries.

This option may take one of the following values:

This is the default setting that issues an error message.

This setting will trigger a warning rather than an error.

This setting will do nothing.

For example, if you want to temporarily comment out \makeglossaries to speed up the compilation of a draft document by omitting the indexing, you can use seenoindex=warn or seenoindex=ignore.

esclocations=booleandefault: true; initial: false

Only applicable to makeindex and xindy. As from v4.50, the initial setting is now esclocations=false. Previously it was esclocations=true.

Both makeindex and xindy are fussy about the location syntax (makeindex more so than xindy) so, if esclocations=true, the glossaries package will try to ensure that special characters are escaped, which allows for the location to be substituted for a format that’s more acceptable to the indexing application. This requires a bit of trickery to circumvent the problem posed by TeX’s asynchronous output routine, which can go wrong and also adds to the complexity of the document build.

If you’re sure that your locations will always expand to an acceptable format (or you’re prepared to post-process the glossary file before passing it to the relevant indexing application) then use esclocations=false to avoid the complex escaping of location values. This is now the default.

If, however, your locations (for example, \thepage with the default counter=page) expand to a robust command then you may need to use esclocations=true. You may additionally need to set the following conditional to true:

\ifglswrallowprimitivemods true\else false\fiinitial: \iffalse
which will locally redefine some primitives in order to escape special characters without prematurely expanding \thepage. Since this hack may cause some issues and isn’t necessary for the majority of documents, this is off by default.

This conditional can be switched on with:

\glswrallowprimitivemodstrue
but remember that it will have no effect with esclocations=false. If can be switched off with:
\glswrallowprimitivemodsfalse

If you are using makeindex and your location expands to content in the form cs {num}, where cs is a command (optionally preceded by \protect) and num is a location acceptable to makeindex, then you can use makeglossaries to make a suitable adjustment without esclocations=true. See §12.5 for furthe details.

This isn’t an issue for Options 1 or 4 as the locations are written to the aux file and both methods use LaTeX syntax, so no conversion is required.

indexonlyfirst=booleandefault: true; initial: false
If true, this setting will only index on first use. The default setting indexonlyfirst=false, will index the entry every time one of the \gls-like or \glstext-like commands are used. Note that \glsadd will always add information to the external glossary file (since that’s the purpose of that command).

You can test if this setting is on using the conditional:

\ifglsindexonlyfirst true\else false\fiinitial: \iffalse
This setting can also be switched on with:
\glsindexonlyfirsttrue
and off with:
\glsindexonlyfirstfalse

Resetting the first use flag with commands like \glsreset after an entry has been indexed will cause that entry to be indexed multiple times if it’s used again after the reset. Likewise unsetting the first use flag before an entry has been indexed will prevent it from being indexed (unless specifically indexed with \glsadd).

You can customise the default behaviour by redefining

\glswriteentry{label}{indexing code}
where label is the entry’s label and indexing code is the code that writes the entry’s information to the external file. The default definition of \glswriteentry is:
\newcommand*{\glswriteentry}[2]{% 
  \ifglsindexonlyfirst
    \ifglsused{#1}{}{#2}% 
  \else
    #2% 
  \fi
}
This does indexing code unless indexonlyfirst=true and the entry identified by label has been marked as used

For example, suppose you only want to index the first use for entries in the acronym glossary and not in the main (or any other) glossary:

\renewcommand*{\glswriteentry}[2]{% 
 \ifthenelse\equal{\glsentrytype{#1}}{acronym}
 {\ifglsused{#1}{}{#2}}% 
 {#2}% 
}
Here I’ve used \ifthenelse to ensure the arguments of \equal are fully expanded before the comparison is made. There are other methods of performing an expanded string comparison, which you may prefer to use.

With the glossaries-extra package it’s possible to only index first use for particular categories. For example, if you only want this enabled for abbreviations then you can set the indexonlyfirst attribute for the abbreviation and, if appropriate, acronym categories. (Instead of using the indexonlyfirst package option.) See the glossaries-extra manual for further details.

indexcrossrefs=booleandefault: true; initial: true

This option is only available with glossaries-extra. If true, this will automatically index (\glsadd) any cross-referenced entries that haven’t been marked as used at the end of the document. Note that this increases the document build time. See glossaries-extra manual for further details.

Note that bib2gls can automatically find dependent entries when it parses the bib file. Use the selection option to determine the selection of dependencies.

autoseeindex=booleandefault: true; initial: true

This option is only available with glossaries-extra. The base glossaries package always implements autoseeindex=true.

If true, this makes the see and seealso keys automatically index the entry (with \glssee) when the entry is defined. This means that any entry with the see (or seealso) key will automatically be added to the glossary. See the glossaries-extra manual for further details.

With bib2gls, use the selection resource option to determine the selection of dependencies.

record=valuedefault: only; initial: off

This option is only available with glossaries-extra. See glossaries-extra manual for further details. A brief summary of available values:

This default setting indicates that bib2gls isn’t being used.

This setting indicates that bib2gls is being used to fetch entries from one or more bib files, to sort the entries and collate the number lists, where the location information is the same as for Options 1, 2 and 3.

record=nameref
This setting is like record=only but provides extra information that allows the associated title to be used instead of the location number and provides better support for hyperlinked locations.

record=hybrid
This setting indicates a hybrid approach where bib2gls is used to fetch entries from one or more bib files but makeindex or xindy are used for the indexing. This requires a more complicated document build and isn’t recommended.

equations=booleandefault: true; initial: false

This option is only available with glossaries-extra. If true, this option will cause the default location counter to automatically switch to equation when inside a numbered equation environment.

floats=booleandefault: true; initial: false

This option is only available with glossaries-extra. If true, this option will cause the default location counter to automatically switch to the corresponding counter when inside a float. (Remember that with floats it’s the \caption command that increments the counter so the location will be incorrect if an entry is indexed within the float before the caption.)

indexcounter

This option is only available with glossaries-extra. This valueless option is primarily intended for use with bib2gls and hyperref allowing the page location hyperlink target to be set to the relevant point within the page (rather than the top of the page). Unexpected results will occur with other indexing methods. See glossaries-extra manual for further details.

2.5. Sorting Options[link]

This section is mostly for Options 2 and 3. Only the sort and order options are applicable for Option 1.

With Options 4, 5 and 6, only sort=none is applicable (and this is automatically implemented by record=only and record=nameref). With bib2gls, the sort method is provided in the optional argument of \GlsXtrLoadResources not with the sort package option. There’s no sorting with Options 5 and 6.

sanitizesort=booleandefault: true; initial: varies
This option determines whether or not to sanitize the sort value when writing to the external indexing file. For example, suppose you define an entry as follows:
\newglossaryentry{hash}{name={\#},sort={},
 description={hash symbol}}
The sort value () must be sanitized before writing it to the indexing file, otherwise LaTeX will try to interpret it as a parameter reference. If, on the other hand, you want the sort value expanded, you need to switch off the sanitization. For example, suppose you do:
\newcommand{\mysortvalue}{AAA}
\newglossaryentry{sample}{% 
  name={sample},
  sort={\mysortvalue},
  description={an example}}
and you actually want \mysortvalue expanded, so that the entry is sorted according to AAA, then use the package option sanitizesortfalse.

The default for Options 2 and 3 is sanitizesort=true, and the default for Option 1 is sanitizesort=false.

sort=valueinitial: standard
If you use Options 2 or 3, this package option is the only way of specifying how to sort the glossaries. Only Option 1 allows you to specify sort methods for individual glossaries via the sort key in the optional argument of \printnoidxglossary. If you have multiple glossaries in your document and you are using Option 1, only use the package options sort=def or sort=use if you want to set this sort method for all your glossaries.

sort=none
This setting is only for documents that don’t use \makeglossaries (Options 2 or 3) or \makenoidxglossaries (Option 1). It omits the code used to sanitize or escape the sort value, since it’s not required. This can help to improve the document build speed, especially if there are a large number of entries. This setting may be used if no glossary is required or if \printunsrtglossary is used (Option 5). If you want an unsorted glossary with bib2gls, use the resource option sort=none instead. This option will redefine \glsindexingsetting to none.

This option will still assign the sort key to its default value. It simply doesn’t process it. If you want the sort key set to an empty value instead, use sort=clear instead.

sort=clear
As sort=none but sets the sort key to an empty value. This will affect letter group formations in \printunsrtglossary with Option 5. See the glossaries-extra manual for further details. This option will redefine \glsindexingsetting to none. The remaining sort options listed below don’t change \glsindexingsetting.

Entries are sorted in the order in which they were defined. With Option 1, this is implemented by simply iterating over all defined entries so there’s no actual sorting. With Options 2 and 3, sorting is always performed (since that’s the purpose of makeindex and xindy). This means that to obtain a list in order of definition, the sort key is assigned a numeric value that’s incremented whenever a new entry is defined.

Entries are sorted according to the order in which they are used in the document. With Option 1, this order is obtained by iterating over a list that’s formed with the aux file is input at the start of the document. With Options 2 and 3, again the sort key is assigned a numeric value, but in this case the value is incremented, and the sort key is assigned, the first time an entry is indexed.

Both sort=def and sort=use zero-pad the sort key to a six digit number using:

\glssortnumberfmt{number}
This can be redefined, if required, before the entries are defined (in the case of sort=def) or before the entries are used (in the case of sort=use).

Note that the group styles (such as listgroup) are incompatible with the sort=use and sort=def options.

sort=standard
Entries are sorted according to the value of the sort key used in \newglossaryentry (if present) or the name key (if sort key is missing).

When the standard sort option is in use, you can hook into the sort mechanism by redefining:

\glsprestandardsort{sort cs}{type}{entry-label}
where sort cs is a temporary control sequence that stores the sort value (which was either explicitly set via the sort key or implicitly set via the name key) before any escaping of the makeindex/xindy special characters is performed. By default \glsprestandardsort just does:
\glsdosanitizesort

which sanitizes sort cs if sanitizesort=true (or does nothing if sanitizesort=false).

The other arguments, type and entry-label, are the glossary type and the entry label for the current entry. Note that type will always be a control sequence, but label will be in the form used in the first argument of \newglossaryentry.

Redefining \glsprestandardsort won’t affect any entries that have already been defined and will have no effect at all if you use another sort setting.

Example 11: Mixing Alphabetical and Order of Definition Sorting
Suppose I have three glossaries: main, acronym and notation, and let’s suppose I want the main and acronym glossaries to be sorted alphabetically, but the notation type should be sorted in order of definition.

For Option 1, the sort option can be used in \printnoidxglossary:

\printnoidxglossary[sort=word]
\printnoidxglossary[type=acronym,sort=word]
\printnoidxglossary[type=notation,sort=def]

For Options 2 or 3, I can set sort=standard (which is the default), and I can either define all my main and acronym entries, then redefine \glsprestandardsort to set sort cs to an incremented integer, and then define all my notation entries. Alternatively, I can redefine \glsprestandardsort to check for the glossary type and only modify sort cs if type is notation.

The first method can be achieved as follows:

\newcounter{sortcount}

\renewcommand{\glsprestandardsort}[3]{% 
  \stepcounter{sortcount}% 
  \edef#1{\glssortnumberfmt{\arabic{sortcount}}}% 
}
The second method can be achieved as follows:
\newcounter{sortcount}

\renewcommand{\glsprestandardsort}[3]{% 
  \ifdefstring{#2}{notation}% 
  {% 
     \stepcounter{sortcount}% 
     \edef#1{\glssortnumberfmt{\arabic{sortcount}}}% 
  }% 
  {% 
     \glsdosanitizesort
  }% 
}
(\ifdefstring is defined by the etoolbox package, which is automatically loaded by glossaries.) For a complete document, see the sample file sampleSort.tex.

Example 12: Customizing Standard Sort (Options 2 or 3)
Suppose you want a glossary of people and you want the names listed as first-name surname in the glossary, but you want the names sorted by surname, first-name. You can do this by defining a command called, say, \name{first-name}{surname} that you can use in the name key when you define the entry, but hook into the standard sort mechanism to temporarily redefine \name while the sort value is being set.

First, define two commands to set the person’s name:

\newcommand{\sortname}[2]{#2, #1}
\newcommand{\textname}[2]{#1 #2}
and \name needs to be initialised to \textname:
\let\name\textname
Now redefine \glsprestandardsort so that it temporarily sets \name to \sortname and expands the sort value, then sets \name to \textname so that the person’s name appears as first-name surname in the text:
\renewcommand{\glsprestandardsort}[3]{% 
 \let\name\sortname
 \edef#1{\expandafter\expandonce\expandafter{#1}}% 
 \let\name\textname
 \glsdosanitizesort
}
(The somewhat complicate use of \expandafter etc helps to protect fragile commands, but care is still needed.)

Now the entries can be defined:

\newglossaryentry{joebloggs}name={\name{Joe}{Bloggs}},
  description={some information about Joe Bloggs}

\newglossaryentry{johnsmith}{name={\name{John}{Smith}},
  description={some information about John Smith}}
For a complete document, see the sample file samplePeople.tex.

orderinitial: word
This may take two values:

order=word
Word order (“sea lion” before “seal”).

order=letter
Letter order (“seal” before “sea lion”).

Note that with Options 2 and 3, the order option has no effect if you explicitly call makeindex or xindy.

If you use Option 1, this setting will be used if you use sort=standard in the optional argument of \printnoidxglossary:

\printnoidxglossary[sort=standard]
Alternatively, you can specify the order for individual glossaries:
\printnoidxglossary[sort=word]
\printnoidxglossary[type=acronym,sort=letter]

With bib2gls, use the break-at option in \GlsXtrLoadResources instead of order.

makeindex

The glossary information and indexing style file will be written in makeindex format. If you use makeglossaries or makeglossaries-lite, it will automatically detect that it needs to call makeindex. If you don’t use makeglossaries, you need to remember to use makeindex not xindy. The indexing style file will been given a ist extension.

You may omit this package option if you are using Option 2 as this is the default. It’s available in case you need to override the effect of an earlier occurrence of xindy in the package option list.

xindy={options}

The glossary information and indexing style file will be written in xindy format. If you use makeglossaries, it will automatically detect that it needs to call xindy. If you don’t use makeglossaries, you need to remember to use xindy not makeindex. The indexing style file will been given a xdy extension.

This package option may additionally have a value that is a key=value comma-separated list to override some default options. Note that these options are irrelevant if you explicitly call xindy. See §14 for further details on using xindy with the glossaries package.

You can test if this option has been set using the conditional:

\ifglsxindy true\else false\fiinitial: \iffalse
Note that this conditional should not be changed after \makeglossaries otherwise the syntax in the glossary files will be incorrect. If this conditional is false, it means that any option other than Option 3 is in effect. (If you need to know which indexing option is in effect, check the definition of \glsindexingsetting instead.)

The options value may be omitted. If set, it should be a key=value list, where the following three options may be used:

language={value}
The language module to use, which is passed to xindy with the -L switch. The default is obtained from \languagename but note that this may not be correct as xindy has a different labelling system to babel and polyglossia.

The makeglossaries script has a set of mappings of known babel language names to xindy language names, but new babel dialect names may not be included. The makeglossaries-lite script doesn’t have this feature (but there’s no benefit in use makeglossaries-lite instead of makeglossaries when using xindy). The automake=option that calls xindy explicitly also doesn’t use any mapping.

However, even if the appropriate mapping is available, \languagename may still not expand to the language required for the glossary. In which case, you need to specify the correct xindy language. For example:

\usepackage[brazilian,english]{babel}
\usepackage[xindy=language=portuguese]{glossaries}
If you have multiple glossaries in different languages, use \GlsSetXdyLanguage to set the language for each glossary.

codepage={value}
The codepage is the file encoding for the xindy files and is passed to xindy with the -C switch. The default codepage is obtained from \inputencodingname. As from v4.50, if \inputencodingname isn’t defined, UTF-8 is assumed (which is identified by the label utf8). If this is incorrect, you will need to use the codepage option but make sure you use the xindy codepage label (for example, cp1252 or latin9). See the xindy documentation for further details.

The codepage may not simply be the encoding but may include a sorting rule, such as ij-as-y-utf8 or din5007-utf8. See §14.2.

For example:

\usepackage[xindy=language=english,codepage=cp1252]
  {glossaries}

glsnumbers={boolean}default: true; initial: true
If true, this option will define the number group in the xindy style file, which by default will be placed before the “A” letter group. If you don’t want this letter group, set this option to false. Note that the “A” letter group is only available with Latin alphabets, so if you are using a non-Latin alphabet, you will either need to switch off the number group or identify the letter group that it should come before with \GlsSetXdyNumberGroupOrder.

xindygloss

This is equivalent to xindy without any value supplied and may be used as a document class option. The language and code page can be set via \GlsSetXdyLanguage and \GlsSetXdyCodePage if the defaults are inappropriate (see §14.2.)

xindynoglsnumbers

This is equivalent to xindy={glsnumbers=false} and may be used as a document class option.

automake=valuedefault: immediate; initial: false
This option will attempt to use the shell escape to run the appropriate indexing application. You will still need to run LaTeX twice. For example, if the document in the file myDoc.tex contains:
\usepackage[automake]{glossaries}
\makeglossaries
\newglossaryentry{sample}{name={sample},description={an example}}
\begin{document}
\gls{sample}
\printglossaries
\end{document}
Then the document build is now:
pdflatex myDoc
pdflatex myDoc
This will run makeindex on every LaTeX run. If you have a large glossary with a complex document build, this can end up being more time-consuming that simply running makeindex (either explicitly or via makeglossaries) the minimum number of required times.

Note that you will need to have the shell escape enabled (restricted mode for a direct call to makeindex and unrestricted mode for xindy, makeglossaries or makeglossaries-lite). If you switch this option on and you are using LuaLaTeX, then the shellesc package will be loaded.

If this option doesn’t seem to work, open the log file in your text editor and search for “runsystem”. For example, if the document is in a file called myDoc.tex and it has:

\usepackage[automake]{glossaries}
and you run LaTeX in restricted mode, then if call was successful, you should find the following line in the file myDoc.log:
runsystem(makeindex -s myDoc.ist -t myDoc.glg -o myDoc.gls myDoc.glo)...executed safely (allowed).
The parentheses immediately after “runsystem” show how the command was called. The bit after the three dots ... indicates whether or not the command was run and, if so, whether it was successful. In the above case, it has “executed safely (allowed)”. This means that it was allowed to run in restricted mode because makeindex is on the list of trusted applications.

If you change the package option to:

\usepackage[automake=makegloss]{glossaries}
and rerun LaTeX in restricted mode, then the line in myDoc.log will now be:
runsystem(makeglossaries myDoc)...disabled (restricted).
This indicates that an attempt was made to run makeglossaries (rather than a direct call to makeindex), which isn’t permitted in restricted mode. There will be a similar message with automake=lite or if the xindy option is used. These cases require the unrestricted shell escape.

Think carefully before enabling unrestricted mode. Do you trust all the packages your document is loading (either explicitly or implicitly via another package)? Do you trust any code that you have copied and pasted from some third party? First compile your document in restricted mode (or with the shell escape disabled) and search the log file for “runsystem” to find out exactly what system calls are being attempted.

If the document is compiled in unrestricted mode, the corresponding line in the log file should now be:

runsystem(makeglossaries myDoc)...executed.
This means that makeglossaries was run. If it has “failed” instead of “executed”, then it means there was a fatal error. Note that just because the log file has “executed” doesn’t mean that the application ran without a problem as there may have been some warnings or non-fatal errors. If you get any unexpected results, check the indexing application’s transcript file (for example, the glg file, myDoc.glg in the above, for the main glossary).

No attempt is made to use the shell escape.

This is now a deprecated synonym for automake=delayed. This used to be the default if the value to automake wasn’t supplied, but the default switched to the less problematic automake=immediate in version 4.50.

automake=delayed
A direct call to makeindex or xindy (as appropriate) for each non-empty glossary will be made at the end of the document using a delayed write to ensure that the glossary files are complete. (It’s necessary to delay writing to the indexing files in order to ensure that \thepage is correct.) Unfortunately, there are situations where the delayed write never occurs, for example, if there are floats on the final page. In those cases, it’s better to use an immediate write (any of the following options).

automake=immediate
A direct call to makeindex or xindy (as appropriate) for each non-empty glossary will be made at the start of \makeglossaries using an immediate write. This ensures that the indexing files are read by the indexing application before they are opened (which will clear their content).

If you are using xindy, then automake=makegloss is a better option that this one. Either way, you will need Perl and the unrestricted mode, but with makeglossaries you get the benefit of the language mappings and diagnostics.

automake=makegloss
A call to makeglossaries will be made at the start of \makeglossaries using an immediate write if the aux file exists. On the one hand, it’s better to use makeglossaries as it has some extra diagnostic functions, but on the other hand it both requires Perl and the unrestricted shell escape.

A call to makeglossaries-lite will be made at the start of \makeglossaries using an immediate write if the aux file exists. There’s little benefit in this option over automake=immediate and it has the added disadvantage of requiring the unrestricted mode.

automakeglossalias: makegloss
This valueless option is equivalent to automake=makegloss.

automakeglosslitealias: lite
This valueless option is equivalent to automake=lite.

disablemakegloss
This valueless option indicates that \makeglossaries and \makenoidxglossaries should be disabled. This option is provided in the event that you have to use a class or package that disregards the advice in §1.3 and automatically performs \makeglossaries or \makenoidxglossaries but you don’t want this. (For example, you want to use a different indexing method or you want to disable indexing while working on a draft document.)

Naturally, if there’s a particular reason why the class or package insists on a specific indexing method, for example, it’s an editorial requirement, then you will need to abide by that decision.

This option may be passed in the standard document class option list or passed using \PassOptionsToPackage before glossaries is loaded. Note that this does nothing if \makeglossaries or \makenoidxglossaries has already been used whilst enabled.

restoremakegloss
Cancels the effect of disablemakegloss. This option may be used in \setupglossaries. It issues a warning if \makeglossaries or \makenoidxglossaries has already been used whilst enabled. Note that this option removes the check for \nofiles, as this option is an indication that the output files are actually required.

For example, suppose the class customclass.cls automatically loads glossaries and does \makeglossaries but you need an extra glossary, which has to be defined before \makeglossaries, then you can do:

\documentclass[disablemakegloss]{customclass}
\newglossary*{functions}{Functions}
\setupglossaries{restoremakegloss}
\makeglossaries
or
\PassOptionsToPackage{disablemakegloss}{glossaries}
\documentclass{customclass}
\newglossary*{functions}{Functions}
\setupglossaries{restoremakegloss}
\makeglossaries

Note that restoring these commands doesn’t necessarily mean that they can be used. It just means that their normal behaviour given the current settings will apply. For example, if you use the record=only or record=nameref options with glossaries-extra then you can’t use \makeglossaries or \makenoidxglossaries regardless of restoremakegloss.

2.6. Glossary Type Options[link]

nohypertypes={list}
Use this option if you have multiple glossaries and you want to suppress the entry hyperlinks for a particular glossary or glossaries. The value of this option should be a comma-separated list of glossary types where \gls etc shouldn’t have hyperlinks by default. Make sure you enclose the value in braces if it contains any commas. Example:
\usepackage[acronym,nohypertypes={acronym,notation}]
  {glossaries}
\newglossary[nlg]{notation}{not}{ntn}{Notation}
As illustrated above, the glossary doesn’t need to exist when you identify it in nohypertypes.

The values must be fully expanded, so don’t try, for example, nohypertypes=\acronymtype.

You may also use:

\GlsDeclareNoHyperList{list}
instead or additionally. See §5.1 for further details.

The glossaries-extra package has the nohyper category attribute which will suppress the hyperlink for entries with the given category, which can be used as an alternative to suppressing the hyperlink on a per-glossary basis.

nomain
This suppresses the creation of the main glossary and associated glo file, if unrequired. Note that if you use this option, you must create another glossary in which to put all your entries (either via the acronym (or acronyms) package option described in §2.7 or via the symbols, numbers or index options described in §2.9 or via \newglossary described in §9). Even if you don’t intend to display the glossary, a default glossary is still required.

If you don’t use the main glossary and you don’t use this option to suppress its creation, makeglossaries will produce a warning:

Warning: File 'filename.glo' is empty.
Have you used any entries defined in glossary 'main'?
Remember to use package option 'nomain' if 
you don't want to use the main glossary.
If you did actually want to use the main glossary and you see this warning, check that you have referenced the entries in that glossary via commands such as \gls.

symbols
This valueless option defines a new glossary type with the label symbols via
\newglossary[slg]{symbols}{sls}{slo}{\glssymbolsgroupname}
It also defines
\printsymbols[options]

which is a synonym for
\printglossary[type=symbols,options]

If you use Option 1, you need to use:

\printnoidxglossary[type=symbols,options]
to display the list of symbols.

Remember to use the nomain package option if you’re only interested in using this symbols glossary and don’t intend to use the main glossary.

The glossaries-extra package has a slightly modified version of this option which additionally provides \glsxtrnewsymbol as a convenient shortcut method for defining symbols. See the glossaries-extra manual for further details.

numbers
This valueless option defines a new glossary type with the label numbers via
\newglossary[nlg]{numbers}{nls}{nlo}{\glsnumbersgroupname}
It also defines
\printnumbers[options]

which is a synonym for
\printglossary[type=numbers,options]

If you use Option 1, you need to use:

\printnoidxglossary[type=numbers,options]
to display the list of numbers.

Remember to use the nomain package option if you’re only interested in using this numbers glossary and don’t intend to use the main glossary.

The glossaries-extra package has a slightly modified version of this option which additionally provides \glsxtrnewnumber as a convenient shortcut method for defining numbers. See the glossaries-extra manual for further details.

index
This valueless option defines a new glossary type with the label index via
\newglossary[ilg]{index}{ind}{idx}{\indexname}
It also defines
\newterm[key=value list]{entry-label}

which is a synonym for
\newglossaryentry{entry-label}{type={index},name={entry-label},
description={\nopostdesc},options}
and
\printindex[options] v4.02+

which is a synonym for
\printglossary[type=index,options]

If you use Option 1, you need to use:

\printnoidxglossary[type=index,options]
to display this glossary.

Remember to use the nomain package option if you’re only interested in using this index glossary and don’t intend to use the main glossary. Note that you can’t mix this option with \index. Either use glossaries for the indexing or use a custom indexing package, such as makeidx, imakeidx. (You can, of course, load one of those packages and load glossaries without the index package option.)

Since the index isn’t designed for terms with descriptions, you might also want to disable the hyperlinks for this glossary using the package option nohypertypes=index or the command

\GlsDeclareNoHyperList{index}
However, it can also be useful to link to the index in order to look up the term’s location list to find other parts of the document where it might be used. For example, this manual will have a hyperlink to the index for general terms, such as table of contents, or general commands, such as \index, that aren’t defined anywhere in the document.

The example file sample-index.tex illustrates the use of the index package option.

noglossaryindex
This valueless option switches off index if index has been passed implicitly (for example, through global document options). This option can’t be used in \setupglossaries.

2.7. Acronym and Abbreviation Options[link]

acronym=booleandefault: true; initial: false
If true, this creates a new glossary with the label acronym. This is equivalent to:
\newglossary[alg]{acronym}{acr}{acn}{\acronymname}
It will also provide (if not already defined)
\printacronyms[options]

that’s equivalent to
\printglossary[type=acronym,options]

If you are using Option 1, you need to use

\printnoidxglossary[type=acronym,options]
to display the list of acronyms.

If the acronym package option is used, \acronymtype is set to acronym otherwise it is set to \glsdefaulttype (which is normally the main glossary.) Entries that are defined using \newacronym are placed in the glossary whose label is given by \acronymtype, unless another glossary is explicitly specified with the type key.

Remember to use the nomain package option if you’re only interested in using this acronym glossary. (That is, you don’t intend to use the main glossary.)

The glossaries-extra extension package comes with an analogous abbreviations option, which creates a new glossary with the label abbreviations and sets the command \glsxtrabbrvtype to this. If the acronym option hasn’t also been used, then \acronymtype will be set to \glsxtrabbrvtype. This enables both \newacronym and \newabbreviation to use the same glossary.

Make sure you have at least v1.42 of glossaries-extra if you use the acronym (or acronyms) package option with the extension package to avoid a bug that interferes with the abbreviation style.

acronyms
This is equivalent to acronym=true and may be used in the document class option list.

abbreviations

This valueless option provided by glossaries-extra creates a new glossary type with the label abbreviations using:

\newglossary[glg-abr]{abbreviations}{gls-abr}{glo-abr}{\abbreviationsname}
The label can be accessed with \glsxtrabbrvtype, which is analogous to \acronymtype. See glossaries-extra manual for further details.

acronymlists={label-list}
This option is used to identify the glossaries that contain acronyms so that they can have their entry format adjusted by \setacronymstyle. (It also enables \forallacronyms to work.)

By default, if the list is empty when \setacronymstyle is used then it will automatically add \acronymtype to the list.

If you have other lists of acronyms, you can specify them as a comma-separated list in the value of acronymlists. For example, if you use the acronym package option but you also want the main glossary to also contain a list of acronyms, you can do:

\usepackage[acronym,acronymlists=main]{glossaries}
No check is performed to determine if the listed glossaries exist, so you can add glossaries you haven’t defined yet. For example:
\usepackage[acronym,acronymlists={main,acronym2}]
  {glossaries}
\newglossary[alg2]{acronym2}{acr2}{acn2}% 
  {Statistical Acronyms}
You can use
\DeclareAcronymList{list}
instead of or in addition to the acronymlists option. This will add the glossaries given in list to the list of glossaries that are identified as lists of acronyms. To replace the list of acronym lists with a new list use:
\SetAcronymLists{list}

If the list is changed after \setacronymstyle then it will result in inconsistencies in the formatting. If this does happen, and is for some reason unavoidable (such as \setacronymstyle occurring in a package that loads glossaries), you will need to set the entry format to match the style:

\DeclareAcronymList{glossary-label}
\defglsentryfmt[glossary-label]{\GlsUseAcrEntryDispStyle}{style-name}

You can determine if a glossary has been identified as being a list of acronyms using:

\glsIfListOfAcronyms{glossary-label}{true}{false}

This option and associated commands are incompatible with glossaries-extra’s abbreviation mechanism. Lists of abbreviations don’t need identifying.

shortcuts={boolean}default: false; initial: false
This option provides shortcut commands for acronyms. See §6 for further details. Alternatively you can use:
\DefineAcronymSynonyms

The glossaries-extra package provides additional shortcuts.

2.8. Deprecated Acronym Style Options[link]

The package options listed in this section were deprecated in version 4.02 (2013-12-05) and have now been removed. You will need to use rollback with them (see §1.1). These options started generating warnings in version 4.47 (2021-09-20) and as from version 4.50 will now generate an error unless you use rollback.

If you want to change the acronym style, use \setacronymstyle instead. See §6 for further details.

description🗑
This option changed the definition of \newacronym to allow a description. This option may be replaced by:
\setacronymstyle{long-short-desc}
or (with smallcaps)
\setacronymstyle{long-sc-short-desc}
or (with smaller)
\setacronymstyle{long-sm-short-desc}
or (with footnote)
\setacronymstyle{footnote-desc}
or (with footnote and smallcaps)
\setacronymstyle{footnote-sc-desc}
or (with footnote and smaller)
\setacronymstyle{footnote-sm-desc}
or (with dua)
\setacronymstyle{dua-desc}

smallcaps🗑
This option changed the definition of \newacronym and the way that acronyms are displayed. This option may be replaced by:
\setacronymstyle{long-sc-short}
or (with description)
\setacronymstyle{long-sc-short-desc}
or (with description and footnote)
\setacronymstyle{footnote-sc-desc}

smaller🗑
This option changed the definition of \newacronym and the way that acronyms are displayed. This option may be replaced by:
\setacronymstyle{long-sm-short}
or (with description)
\setacronymstyle{long-sm-short-desc}
or (with description and footnote)
\setacronymstyle{footnote-sm-desc}

footnote🗑
This option changed the definition of \newacronym and the way that acronyms are displayed. This option may be replaced by:
\setacronymstyle{footnote}
or (with smallcaps)
\setacronymstyle{footnote-sc}
or (with smaller)
\setacronymstyle{footnote-sm}
or (with description)
\setacronymstyle{footnote-desc}
or (with smallcaps and description)
\setacronymstyle{footnote-sc-desc}
or (with smaller and description)
\setacronymstyle{footnote-sm-desc}

This option changed the definition of \newacronym so that acronyms are always expanded. This option may be replaced by:
\setacronymstyle{dua}
or (with description)
\setacronymstyle{dua-desc}

2.9. Other Options[link]

Other available options that don’t fit any of the above categories are described below.

accsupp

Only available with glossaries-extra, this option loads the glossaries-accsupp package, which needs to be loaded either before glossaries-extra or while glossaries-extra is loaded to ensure both packages are properly integrated.

prefix

Only available with glossaries-extra, this option loads the glossaries-prefix package.

nomissingglstext=booleandefault: true; initial: false

This option may be used to suppress the boilerplate text generated by \printglossary if the indexing file is missing.

mfirstuc=valueinitial: unexpanded

The value may be either expanded or unexpanded and performs the same function as mfirstuc’s expanded and unexpanded package options. Note that there’s no value corresponding to mfirstuc’s other package option.

The default is mfirstuc=unexpanded to safeguard against glossary styles that convert the description to sentence case. With older versions of mfirstuc (pre v2.08), fragile commands in the description would not have been affected by the case change, but now, if the entire description is passed to \MFUsentencecase, it will be expanded, which could break existing documents.

compatible-2.07🗑

Compatibility mode for old documents created using version 2.07 or below. This option is now only available with rollback (see §1.1).

compatible-3.07🗑
Compatibility mode for old documents created using version 3.07 or below. This option is now only available with rollback (see §1.1).

kernelglossredefs=valuedefault: true; initial: false
As a legacy from the precursor glossary package, the standard glossary commands provided by the LaTeX kernel (\makeglossary and \glossary) are redefined in terms of the glossaries package’s commands. However, they were never documented in this user manual, and the conversion guide (“Upgrading from the glossary package to the glossaries package”) explicitly discourages their use.

The redefinitions of these commands was removed in v4.10, but unfortunately it turned out that some packages had hacked the internal commands provided by glossaries and no longer worked when they were removed, so they were restored in v4.41 with this option to undo the effect with kernelglossredefs=true as the default. As from v4.50, the default is now kernelglossredefs=false.

Don’t redefine \glossary and \makeglossary. If they have been previously redefined by kernelglossredefs their original definitions (at the time glossaries was loaded) will be restored.

Redefine \glossary and \makeglossary, but their use will trigger warnings.

Redefine \glossary and \makeglossary without any warnings.

The only glossary-related commands provided by the LaTeX kernel are \makeglossary and \glossary. Other packages or classes may provide additional glossary-related commands or environments that conflict with glossaries (such as \printglossary and theglossary). These non-kernel commands aren’t affected by this package option, and you will have to find some way to resolve the conflict if you require both glossary mechanisms. (The glossaries package will override the existing definitions of \printglossary and theglossary.)

In general, if possible, it’s best to stick with just one package that provides a glossary mechanism. (The glossaries package does check for the doc package and patches \PrintChanges.)

2.10. Setting Options After the Package is Loaded[link]

Some of the options described above may also be set after the glossaries package has been loaded using

\setupglossaries{options}
The following package options can’t be used in \setupglossaries: xindy, xindygloss, xindynoglsnumbers, makeindex, nolong, nosuper, nolist, notree, nostyles, nomain, compatible-2.07, translate, notranslate, languages, acronym. These options have to be set while the package is loading, except for the xindy sub-options which can be set using commands like \GlsSetXdyLanguage (see §14 for further details).

If you need to use this command, use it as soon as possible after loading glossaries otherwise you might end up using it too late for the change to take effect. If you try changing the sort option after you have started to define entries, you may get unexpected results.

3. Setting Up[link]

In the preamble you need to indicate which method you want to use to generate the glossary (or glossaries). The available options with both glossaries and glossaries-extra are summarized in §1.3. This chapter documents Options 1, 2 and 3, which are provided by the base package. See the glossaries-extra and bib2gls manuals for the full documentation of the other options.

If you don’t need to display any glossaries, for example, if you are just using the glossaries package to enable consistent formatting, then skip ahead to §4.

3.1. Option 1[link]

The command

\makenoidxglossaries

must be placed in the document preamble. This sets up the internal commands required to make Option 1 work. If you omit \makenoidxglossaries none of the glossaries will be displayed.

3.2. Options 2 and 3[link]

The command

\makeglossaries

must be placed in the document preamble in order to create the customised makeindex (ist) or xindy (xdy) style file (for Options 2 or 3, respectively) and to ensure that glossary entries are written to the appropriate output files. If you omit \makeglossaries none of the indexing files will be created.

If you are using glossaries-extra, \makeglossaries has an optional argument that allows you to have a hybrid of Options 1 or 2 or Options 1 or 3. See glossaries-extra manual for further details.

Note that some of the commands provided by the glossaries package must not be used after \makeglossaries as they are required when creating the customised style file. If you attempt to use those commands after \makeglossaries you will generate an error. Similarly, there are some commands that must not be used before \makeglossaries because they require the associated indexing files to be open, if those files should be created. These may not necessarily generate an error or warning as a different indexing option may be chosen that doesn’t require those files (such as Options 5 or 6).

The \makeglossaries command internally uses:

\writeist
to create the custom makeindex/xindy style file. This command disables itself by setting itself to \relax so that it can only be used once. In general, there should be no reason to use or alter this command.

The default name for the customised style file is given by \jobname.ist (Option 2) or \jobname.xdy (Option 3). This name may be changed using:

\setStyleFile{name}
where name is the name of the style file without the extension.

There is a hook near the end of \writeist that can be set with:

\GlsSetWriteIstHook{code}
The code will be performed while the style file is still open, which allows additional content to be added to it. The associated write register is:
\glswrite
Note that this register is defined by \writeist to prevent an unnecessary write register from being created in the event that neither makeindex nor xindy is required.

If you use the \GlsSetWriteIstHook hook to write extra information to the style file, make sure you use the appropriate syntax for the desired indexing application. For example, with makeindex:

\GlsSetWriteIstHook{% 
 \write\glswrite{page_precedence "arnAR"}% 
 \write\glswrite{line_max 80}% 
}
This changes the page precedence and the maximum line length used by makeindex.

Remember that if you switch to xindy, this will no longer be valid code.

You can suppress the creation of the customised xindy or makeindex style file using:

\noist
This is provided in the event that you want to supply your own customized style file that can’t be replicated with the available options and commands provided by the glossaries package. This command sets \writeist to \relax (making it do nothing) but will also update the xindy attribute list if applicable.

If you have a custom xdy file created when using glossaries version 2.07 (2010-0710) or below, you will need to use rollback and the compatible-2.07 package option with it. However, that is now so dated and the LaTeX kernel has changed significantly since that time that you may need to use a legacy distribution (see Legacy Documents and TeX Live Docker Images).

Each glossary entry is assigned a number list that lists all the locations in the document where that entry was used. By default, the location refers to the page number but this may be overridden using the counter package option. The default form of the location number assumes a full stop compositor (for example, 1.2), but if your location numbers use a different compositor (for example, 1-2) you need to set this using

\glsSetCompositor{character}
{symbol} For example:
\glsSetCompositor{-}
This command must not be used after \makeglossaries. Note that with makeindex, any locations with the wrong compositor (or one that hasn’t been correctly identified with \glsSetCompositor) will cause makeindex to reject the location with an invalid number/digit message. As from v4.50, makeglossaries will check for this message and attempt a correction, but this can result in an incorrectly formatted location in the number list. See the information about makeglossaries’s -e switch in §1.6.1 for further details.

An invalid page number will also cause xindy to fail with a “did not match any location-class” warning. This is also something that makeglossaries will check for and will provided diagnostic information, but it won’t attempt to make any correction.

If you use Option 3, you can have a different compositor for page numbers starting with an upper case alphabetical character using:

\glsSetAlphaCompositor{character}

This command is only available with xindy. For example, if you want number lists containing a mixture of A-1 and 2.3 style formats, then do:
\glsSetCompositor{.}\glsSetAlphaCompositor{-}
See §12 for further information about number lists.

4. Defining Glossary Entries[link]

If you want to use bib2gls, entries must be defined in bib files using the syntax described in the bib2gls user manual.

Acronyms are covered in §6 but they use the same underlying mechanism as all the other glossary entries, so it’s a good idea to read this chapter first. The keys provided for \newglossaryentry can also be used in the optional argument of \newacronym, although some of them, such as first and plural, interfere with the acronym styles.

All glossary entries must be defined before they are used, so it is better to define them in the document preamble to ensure this. In fact, some commands such as \longnewglossaryentry may only be used in the preamble. See §4.8 for a discussion of the problems with defining entries within the document instead of in the preamble. (The glossaries-extra package has an option that provides a restricted form of document definitions that avoids some of the issues discussed in §4.8.)

Option 1 enforces the preamble-only restriction on \newglossaryentry. Option 4 requires that definitions are provided in bib format. Options 5 and 6 work best with either preamble-only definitions or the use of the glossaries-extra package option docdef=restricted.

Bear in mind that with docdef=restricted, the entries must be defined before any entries are used, including when they are displayed in the glossary (for example, with \printunsrtglossary) or where they appear in the table of contents or list of floats. This is essentially the same problem as defining a robust command mid-document and using it in a section title or caption.

Only those entries that are indexed in the document (using any of the commands described in §5.1, §10 or §11) will appear in the glossary. See §8 to find out how to display the glossary.

New glossary entries are defined using the command:

\newglossaryentry{entry-label}{key=value list}
This is a short command, so values in key=value list can’t contain any paragraph breaks. Take care to enclose values containing any commas (,) or equal signs (=) with braces to hide them from the key=value list parser.

If you have a long description that needs to span multiple paragraphs, use the following instead:

\longnewglossaryentry{entry-label}{key=value list}{description}
Note that this command may only be used in the preamble (regardless of docdef).

Be careful of unwanted spaces.

\longnewglossaryentry will remove trailing spaces in the description (via \unskip) but won’t remove leading spaces. This command also appends \nopostdesc to the end of the description, which suppresses the post-description hook (since the terminating punctuation is more likely to be included in a multi-paragraph description). The glossaries-extra package provides a starred version of \longnewglossaryentry that doesn’t append either \unskip or \nopostdesc.

There are also commands that will only define the entry if it hasn’t already been defined:

\provideglossaryentry{entry-label}{key=value list}
and
\longprovideglossaryentry{entry-label}{key=value list}{description}
(These are both preamble-only commands.)

For all the above commands, the first argument, entry-label, must be a unique label with which to identify this entry. This can’t contain any non-expandable or fragile commands. The reason for this restriction is that the label is used to construct internal commands that store the associated information (similarly to commands like \label) and therefore must be able to expand to a valid control sequence name. With modern LaTeX kernels, you should now be able to use UTF-8 characters in the label.

Be careful of babel’s options that change certain punctuation characters, such as colon (:) or double-quote ("), to active characters.

The second argument, key=value list, is a key=value list that supplies the relevant information about this entry. There are two required fields: description and either name or parent. The description is set in the third argument of \longnewglossaryentry and \longprovideglossaryentry. With the other commands it’s set via the description key.

As is typical with key=value lists, values that contain a comma (,) or equal sign (=) must be enclosed in braces. Available fields are listed below. Additional fields are provided by the supplementary packages glossaries-prefix16) and glossaries-accsupp17) and also by glossaries-extra. You can also define your own custom keys (see §4.3).

name={text}
The name of the entry (as it will appear in the glossary). If this key is omitted and the parent key is supplied, this value will be the same as the parent’s name.

If the name key contains any commands, you must also use the sort key (described below) if you intend sorting the entries alphabetically with Options 1, 2 or 3, otherwise the entries can’t be sorted correctly.

description={text}
A brief description of this term (to appear in the glossary). Within this value, you can use:
\nopostdesc
to suppress the description terminator for this entry. For example, if this entry is a parent entry that doesn’t require a description, you can do description={\nopostdesc}. If you want a paragraph break in the description use:
\glspar
or, better, use \longnewglossaryentry. However, note that not all glossary styles support multi-line descriptions. If you are using one of the tabular-like glossary styles that permit multi-line descriptions and you really need an explicit line break, use \newline not \\ (but in general, avoid \\ outside of tabular contexts anyway and use a ragged style if you are having problems with line breaks in a narrow column).

With glossaries-extra, use \glsxtrnopostpunc instead of \nopostdesc to suppress the post-description punctuation.

parent=parent-label
This key establishes the entry’s hierarchical level. The value must be the label of the parent entry (not the name, although they may be the same). The parent-label value must match the entry-label used when the parent entry was defined. See §4.5 for further details.

The parent entry must be defined before it’s referenced in the parent key of another entry.

descriptionplural={text}
The plural form of the description, if required. If omitted, the value is set to the same as the description key.

text={text}
How this entry will appear in the document text when using \gls on subsequent use. If this field is omitted, the value of the name key is used.

This key is automatically set by \newacronym. Although it is possible to override it by using text in the optional argument of \newacronym, it will interfere with the acronym style and cause unexpected results.

first={first}
How the entry will appear in the document text on first use with \gls. If this field is omitted, the value of the text key is used. Note that if you use \glspl, \Glspl, \GLSpl, \glsdisp before using \gls, the first value won’t be used with \gls.

You may prefer to use acronyms6) or the abbreviations or the category post-link hook (\glsdefpostlink) provided by glossaries-extra if you would like to automatically append content on first use in a consistent manner. See, for example, Gallery: Units (glossaries-extra.sty).

Although it is possible to use first in the optional argument of \newacronym, it can interfere with the acronym style and cause unexpected results.

plural={text}
How the entry will appear in the document text when using \glspl on subsequent use. If this field is omitted, the value is obtained by appending \glspluralsuffix to the value of the text field.

Although it is possible to use plural in the optional argument of \newacronym, it can interfere with the acronym style and cause unexpected results. Use shortplural instead, if the default value is inappropriate.

firstplural={text}
How the entry will appear in the document text on first use with \glspl. If this field is omitted, the value is obtained from the plural key, if the first key is omitted, or by appending \glspluralsuffix to the value of the first field, if the first field is present. Note that if you use \gls, \Gls, \GLS, \glsdisp before using \glspl, the firstplural value won’t be used with \glspl.

Although it is possible to use firstplural in the optional argument of \newacronym, it can interfere with the acronym style and cause unexpected results. Use shortplural and longplural instead, if the default value is inappropriate.

Prior to version 1.13, the default value of firstplural was always taken by appending “s” to the first key, which meant that you had to specify both plural and firstplural, even if you hadn’t used the first key.

symbol={symbol}initial: \relax
This field is provided to allow the user to specify an associated symbol. If omitted, the value is set to \relax. Note that not all glossary styles display the symbol.

symbolplural={symbol plural}
This is the plural form of the symbol. If omitted, the value is set to the same as the symbol key.

sort=valueinitial: entry name
This value indicates the text to be used by the sort comparator when ordering all the glossary entries. If omitted, the value is given by the name field unless one of the package options sort=def and sort=use have been used. With Option 2 it’s best to use the sort key if the name contains commands (for example, \ensuremath{\alpha}) and with Options 2 and 3, it’s strongly recommended as the indexing may fail if you don’t (see below).

You can also override the sort key by redefining \glsprestandardsort (see §2.5).

The sort key shouldn’t be used with bib2gls. It has a system of fallbacks that allow different types of entries to obtain the sort value from the most relevant field. See the bib2gls manual for further details, and see also bib2gls gallery: sorting.

Option 1 by default strips the standard LaTeX accents (that is, accents generated by core LaTeX commands) from the name key when it sets the sort key. So with Option 1:

\newglossaryentry{elite}{
  name={\'elite},
  description={select group of people}
}
This is equivalent to:
\newglossaryentry{elite}{
  name={\'elite},
  description={select group of people}
  sort={elite}
}
Unless you use the package option sanitizesort=true, in which case it’s equivalent to:
\newglossaryentry{elite}{
  name={\'elite},
  description={select group of people}
  sort={\'elite},
}
This will place the entry before the “A” letter group since the sort value starts with a symbol (a literal backslash \). Note that Option 1 shouldn’t be used with UTF-8 characters. With old LaTeX kernels, it was able to convert a UTF-8 character, such as é, to an ASCII equivalent but this is no longer possible.

With Options 2 and 3, the default value of sort will either be set to the name key (if sanitizesort=true) or it will set it to the expansion of the name key (if sanitizesort=false).

Take care with xindy (Option 3): if you have entries with the same sort value they will be treated as the same entry. If you use xindy and aren’t using the def or use sort methods, always use the sort key for entries where the name just consists of commands (for example name={\alpha}).

Take care if you use Option 1 and the name contains fragile commands. You will either need to explicitly set the sort key or use the sanitizesort=true package option (unless you use the def or use sort methods).

type=glossary-labelinitial: \glsdefaulttype
This specifies the label of the glossary in which this entry belongs. If omitted, the default glossary identified by \glsdefaulttype is assumed unless \newacronym is used (see §6).

Six keys are provided for any additional information the user may want to specify. (For example, an associated dimension or an alternative plural or some other grammatical construct.) Alternatively, you can add new keys using \glsaddkey or \glsaddstoragekey (see §4.3).

user1={text}
The first user key.

user2={text}
The second user key.

user3={text}
The third user key.

user4={text}
The fourth user key.

user5={text}
The fifth user key.

user6={text}
The sixth user key.

nonumberlist={boolean}default: true; initial: false
If the value is missing or is true, this will suppress the number list just for this entry. Conversely, if you have used the package option nonumberlist=true, you can activate the number list just for this entry with nonumberlist={false}. (See §12.)

This key works by adding \glsnonextpages (nonumberlist={true}) or \glsnextpages (nonumberlist={false}) to the indexing information for Options 2 and 3. Note that this means that if the entry is added to the glossary simply because it has an indexed descendent (and has not been indexed itself) then the first indexed sub-entry that follows will have its number list suppressed instead.

With Option 1, this key saves the appropriate command in the prenumberlist internal field, which is used by \glsnoidxprenumberlist.

see={[tag]xr-list}
This key essentially provides a convenient shortcut that performs
\glssee[tag]{entry-label}{xr-list}
after the entry has been defined. (See §11.) It was originally designed for synonyms that may not occur in the document text but needed to be included in the glossary in order to redirect the reader. Note that it doesn’t index the cross-referenced entry (or entries) as that would interfere with their number lists.

Using the see key will automatically add this entry to the glossary, but will not automatically add the cross-referenced entry.

For example:

\newglossaryentry{courgette}{name={courgette},
  description={variety of small marrow}}
\newglossaryentry{zucchini}{name={zucchini},
  description={(North American)},
  see={courgette}}
This defines two entries (courgette and zucchini) and automatically adds a cross-reference from zucchini to courgette. (That is, it adds see courgette” to zucchini’s number list.) This doesn’t automatically index courgette since this would create an unwanted location in courgette’s number list. (Page 1, if the definitions occur in the preamble.)

Note that while it’s possible to put the cross-reference in the description instead, for example:

\newglossaryentry{zucchini}{name={zucchini},
  description={(North American) see \gls{courgette}}}
this won’t index the zucchini entry, so if zucchini isn’t indexed elsewhere (with commands like \gls or \glsadd) then it won’t appear in the glossary even if courgette does.

The referenced entry should be supplied as the value to this key. If you want to override the “see” tag, you can supply the new tag in square brackets before the label. For example see={[see also]{anotherlabel}}.

If you have suppressed the number list, the cross-referencing information won’t appear in the glossary, as it forms part of the number list.

You can override this for individual glossary entries using nonumberlist={false}. Alternatively, you can use the seeautonumberlist package option. For further details, see §11.

For Options 2 and 3, \makeglossaries must be used before any occurrence of \newglossaryentry that contains the see key.

Since it’s useful to suppress the indexing while working on a draft document, consider using the seenoindex package option to warn about or ignore the see key while \makeglossaries is commented out.

If you use the see key, you may want to consider using the glossaries-extra package which additionally provides a seealso and alias key. If you want to avoid the automatic indexing triggered by the see key, consider using Option 4. See also the FAQ item Why does the see key automatically index the entry?

The analogous bib2gls see, seealso and alias fields have a slightly different meaning. The selection resource option determines the behaviour.

seealso={xr-list}
This key is only available with glossaries-extra and is similar to see but it doesn’t allow for the optional tag. The glossaries-extra package provides \seealsoname and seealso={xr-list} is essentially like see={[\seealsoname]xr-list} (Options 3 and 4 may treat these differently).

alias={xr-label}
This key is only available with glossaries-extra and is another form of cross-referencing. An entry can be aliased to another entry with alias={other-label}. This behaves like see={other-label} but also alters the behaviour of commands like \gls so that they index the entry given by label instead of the original entry. (See, for example, Gallery: Aliases.)

More variations with the alias key are available with bib2gls.

counter={counter-name}
This key will set the default location counter for the given entry. This will override the counter assigned to the entry’s glossary in the final optional argument of \newglossary (if provided) and the counter identified by the counter package option. The location counter can be overridden by the counter option when using the \gls-like and \glstext-like commands.

category=category-labelinitial: general
This key is only available with glossaries-extra and is used to assign a category to the entry. The value should be a label that can be used to identify the category. See glossaries-extra manual for further details.

The following keys are reserved for \newacronym (see §6) and also for \newabbreviation (see the glossaries-extra manual): long, longplural, short and shortplural. You can use longplural and shortplural in the optional argument of \newacronym (or \newabbreviation) to override the defaults, but don’t explicitly use the long or short keys as that may interfere with acronym style (or abbreviation style).

There are also special internal field names used by bib2gls. See the bib2gls manual for further details.

The supplementary packages glossaries-prefix16) and glossaries-accsupp17) provide additional keys.

Avoid using any of the \gls-like or \glstext-like commands within the text, first, short or long keys (or their plural equivalent) or any other key that you plan to access through those commands. (For example, the symbol key if you intend to use \glssymbol.) Otherwise you can up with nested links, which can cause complications. You can use them within the value of keys that won’t be accessed through those commands. For example, the description key if you don’t use \glsdesc. Additionally, they’ll confuse the formatting placeholder commands, such as \glslabel. The glossaries-extra package provides \glsxtrp for this type of situation.

With older LaTeX kernels and pre-2.08 versions of mfirstuc, if the name starts with non-Latin character, you need to group the character, otherwise it will cause a problem for commands like \Gls and \Glspl. For example:

% mfirstuc v2.07
\newglossaryentry{elite}{name={{\'e}lite},
description={select group or class}}
Note that the same applies with inputenc:
% mfirstuc v2.07
\newglossaryentry{elite}{name={{é}lite},
description={select group or class}}
This doesn’t apply for XeLaTeX or LuaLaTeX documents or with mfirstuc v2.08+.
% mfirstuc v2.08
\newglossaryentry{elite}{name={élite},
description={select group or class}}
See the mfirstuc manual for further details.

Note that in the above UTF-8 examples, you will also need to supply the sort key if you are using Options 1 or 2 whereas xindy (Option 3) is usually able to sort non-Latin characters correctly.

4.1. Plurals[link]

You may have noticed from above that you can specify the plural form when you define an entry. If you omit this, the plural will be obtained by appending:

\glspluralsuffixinitial: s
to the singular form. This command may expand when the entry is defined, if expansion is on for the relevant keys, or may not expand until the entry is referenced, if expansion is off or if the suffix has been hidden inside non-expanding context (which can happen when defining acronyms or abbreviations).

For example:

\newglossaryentry{cow}{name={cow},description={a fully grown
female of any bovine animal}}
defines a new entry whose singular form is “cow” and plural form is “cows”. However, if you are writing in archaic English, you may want to use “kine” as the plural form, in which case you would have to do:
\newglossaryentry{cow}{name={cow},plural={kine},
description={a fully grown female of any bovine animal}}

If you are writing in a language that supports multiple plurals (for a given term) then use the plural key for one of them and one of the user keys to specify the other plural form. For example:

\newglossaryentry{cow}{
  name={cow},
  description={a fully grown female of any bovine animal 
               (plural cows, archaic plural kine)},
  user1={kine}}
You can then use \glspl{cow} to produce “cows” and \glsuseri{cow} to produce “kine”. You can, of course, define an easy to remember synonym. For example:
\let\glsaltpl\glsuseri
Then you don’t have to remember which key you used to store the second plural. (Be careful with using \let as it doesn’t check if the command already exists.)

Alternatively, you can define your own keys using \glsaddkey, described in §4.3 (or simply use \glsdisp or \glslink with the appropriate text).

If you are using a language that usually forms plurals by appending a different letter, or sequence of letters, you can redefine \glspluralsuffix as required. However, this must be done before the entries are defined and is unreliable for multilingual documents. For languages that don’t form plurals by simply appending a suffix, all the plural forms must be specified using the plural key (and the firstplural key where necessary).

4.2. Other Grammatical Constructs[link]

You can use the six user keys to provide alternatives, such as participles. For example:

\let\glsing\glsuseri
\let\glsd\glsuserii

\newcommand*{\ingkey}{user1}
\newcommand*{\edkey}{user2}

\newcommand*{\newword}[3][]{% 
  \newglossaryentry{#2}{% 
   name={#2},% 
   description={#3},% 
   \edkey={#2ed},% 
   \ingkey={#2ing},#1% 
  }}
With the above definitions, I can now define terms like this:
\newword{play}{to take part in activities for enjoyment}
\newword[\edkey={ran},\ingkey={running}]{run}{to move fast using 
the legs}
and use them in the text:
Peter is \glsing{play} in the park today.

Jane \glsd{play} in the park yesterday.

Peter and Jane \glsd{run} in the park last week.

Alternatively, you can define your own keys using \glsaddkey, described below in §4.3. It may, however, be simpler just to use \glslink or \glsdisp with the appropriate link text.

4.3. Additional Keys[link]

You can define your own custom keys using the commands described in this section. There are two types of keys: those for use within the document and those to store information used behind the scenes by other commands.

For example, if you want to add a key that indicates the associated unit for a term, you might want to reference this unit in your document. In this case use \glsaddkey described in §4.3.1. If, on the other hand, you want to add a key to indicate to a glossary style or acronym style that this entry should be formatted differently to other entries, then you can use \glsaddstoragekey described in §4.3.2.

In both cases, a new command no link cs will be defined that can be used to access the value of this key (analogous to commands such as \glsentrytext). This can be used in an expandable context (provided any fragile commands stored in the key have been protected). The new keys must be added using \glsaddkey or \glsaddstoragekey before glossary entries are defined.

4.3.1. Document Keys[link]

A custom key that can be used in the document is defined using:

\glsaddkey{key}{default value}{no link cs}{no link ucfirst cs}{link cs}{link ucfirst cs}{link allcaps cs}
where the arguments are as follows:
key is the new key to use in \newglossaryentry (or similar commands such as \longnewglossaryentry); default value is the default value to use if this key isn’t used in an entry definition (this may reference the current entry label via \glslabel, but you will have to switch on expansion via the starred version of \glsaddkey and protect fragile commands); no link cs is the control sequence to use analogous to commands like \glsentrytext; no link ucfirst cs is the control sequence to use analogous to commands like \Glsentrytext; link cs is the control sequence to use analogous to commands like \glstext; link ucfirst cs is the control sequence to use analogous to commands like \Glstext; link allcaps cs is the control sequence to use analogous to commands like \GLStext.
The starred version of \glsaddkey switches on expansion for this key. The unstarred version doesn’t override the current expansion setting.

Example 13: Defining Custom Keys
Suppose I want to define two new keys, ed and ing, that default to the entry text followed by “ed” and “ing”, respectively. The default value will need expanding in both cases, so I need to use the starred form:
% Define "ed" key:
 \glsaddkey*
  {ed}% key
  {\glsentrytext{\glslabel}ed}% default value
  {\glsentryed}% command analogous to \glsentrytext
  {\Glsentryed}% command analogous to \Glsentrytext
  {\glsed}% command analogous to \glstext
  {\Glsed}% command analogous to \Glstext
  {\GLSed}% command analogous to \GLStext

% Define "ing" key:
 \glsaddkey*
  {ing}% key
  {\glsentrytext{\glslabel}ing}% default value
  {\glsentrying}% command analogous to \glsentrytext
  {\Glsentrying}% command analogous to \Glsentrytext
  {\glsing}% command analogous to \glstext
  {\Glsing}% command analogous to \Glstext
  {\GLSing}% command analogous to \GLStext
Now I can define some entries:
% No need to override defaults for this entry:
\newglossaryentry{jump}{name={jump},description={}}

% Need to override defaults on these entries:
\newglossaryentry{run}{name={run},
  ed={ran},
  ing={running},
  description={}}

\newglossaryentry{waddle}{name={waddle},
  ed={waddled},
  ing={waddling},
  description={}}

These entries can later be used in the document:

The dog \glsed{jump} over the duck.

The duck was \glsing{waddle} round the dog.

The dog \glsed{run} away from the duck.
For a complete document, see the sample file sample-newkeys.tex.

4.3.2. Storage Keys[link]

A custom key that can be used for simply storing information is defined using:

\glsaddstoragekey{key}{default value}{no link cs}
where the arguments are as the first three arguments of \glsaddkey, described above in §4.3.1.

This is essentially the same as \glsaddkey except that it doesn’t define the additional commands. You can access or update the value of your new field using the commands described in §15.6.

Example 14: Defining Custom Storage Key (Acronyms and Initialisms)
Suppose I want to define acronyms (an abbreviation that is pronounced as a word) and other forms of abbreviations, such as initialisms, but I want them all in the same glossary and I want the acronyms on first use to be displayed with the short form followed by the long form in parentheses, but the opposite way round for other forms of abbreviations. (The glossaries-extra package provides a simpler way of achieving this.)

Here I can define a new key that determines whether the term is actually an acronym rather than some other form of abbreviation. I’m going to call this key abbrtype (since type already exists):

\glsaddstoragekey
 {abbrtype}% key/field name
 {word}% default value if not explicitly set
 {\abbrtype}% custom command to access the value if required

Now I can define a style that looks up the value of this new key to determine how to display the full form:

\newacronymstyle
 {mystyle}% style name
 {% Use the generic display
   \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% 
 }% 
 {% Put the long form in the description
   \renewcommand*{\GenericAcronymFields}{% 
       description={\the\glslongtok}}% 
   % For the full format, test the value of the "abbrtype" key.
   % If it's set to "word" put the short form first with
   % the long form in brackets.
   \renewcommand*{\genacrfullformat}[2]{% 
    \ifglsfieldeq{##1}{abbrtype}{word}
    {% is a proper acronym
      \protect\firstacronymfont{\glsentryshort{##1}}##2\space
       (\glsentrylong{##1})% 
    }% 
    {% is another form of abbreviation
     \glsentrylong{##1}##2\space
      (\protect\firstacronymfont{\glsentryshort{##1}})% 
    }% 
   }% 
   % sentence case version:
   \renewcommand*{\Genacrfullformat}[2]{% 
    \ifglsfieldeq{##1}{abbrtype}{word}
    {% is a proper acronym
      \protect\firstacronymfont{\Glsentryshort{##1}}##2\space
       (\glsentrylong{##1})% 
    }
    {% is another form of abbreviation
     \Glsentrylong{##1}##2\space
      (\protect\firstacronymfont{\glsentryshort{##1}})% 
    }% 
   }% 
   % plural
   \renewcommand*{\genplacrfullformat}[2]{% 
    \ifglsfieldeq{##1}{abbrtype}{word}% 
    {% is a proper acronym
      \protect\firstacronymfont{\glsentryshortpl{##1}}##2\space
       (\glsentrylong{##1})% 
    }% 
    {% is another form of abbreviation
     \glsentrylongpl{##1}##2\space
      (\protect\firstacronymfont{\glsentryshortpl{##1}})% 
    }% 
  }% 
  % plural and sentence case
  \renewcommand*{\Genplacrfullformat}[2]{% 
    \ifglsfieldeq{##1}{abbrtype}{word}% 
    {% is a proper acronym
      \protect\firstacronymfont{\Glsentryshortpl{##1}}##2\space
       (\glsentrylong{##1})% 
    }% 
    {% is another form of abbreviation
     \Glsentrylongpl{##1}##2\space
      (\protect\firstacronymfont{\glsentryshortpl{##1}})% 
    }% 
  }% 
  % Just use the short form as the name part in the glossary:
  \renewcommand*{\acronymentry}[1]{% 
     \acronymfont{\glsentryshort{##1}}}% 
  % Sort by the short form:
  \renewcommand*{\acronymsort}[2]{##1}% 
  % Just use the surrounding font for the short form:
  \renewcommand*{\acronymfont}[1]{##1}% 
  % Same for first use:
  \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}% 
  % Default plural suffix if the plural isn't explicitly set
  \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% 
 }
Remember that the new style needs to be set before defining any terms:
\setacronymstyle{mystyle}

Since it may be a bit confusing to use \newacronym for something that’s not technically an acronym, let’s define a new command for initialisms:

\newcommand*{\newinitialism}[4][]{% 
  \newacronym[abbrtype=initialism,#1]{#2}{#3}{#4}% 
}
Now the entries can all be defined:
\newacronym{radar}{radar}{radio detecting and ranging}
\newacronym{laser}{laser}{light amplification by stimulated
emission of radiation}
\newacronym{scuba}{scuba}{self-contained underwater breathing
apparatus}
\newinitialism{dsp}{DSP}{digital signal processing}
\newinitialism{atm}{ATM}{automated teller machine}
On first use, \gls{radar} will produce “radar (radio detecting and ranging)” but \gls{dsp} will produce “DSP (digital signal processing)”.

For a complete document, see the sample file sample-storage-abbr.tex.

In the above example, if \newglossaryentry is explicitly used (instead of through \newacronym) the abbrtype key will be set to its default value of “word” but the \ifglshaslong test in the custom acronym style will be false (since the long key hasn’t been set) so the display style will switch to that given by \glsgenentryfmt and they’ll be no test performed on the abbrtype field.

Example 15: Defining Custom Storage Key (Acronyms and Non-Acronyms with Descriptions)
The previous example can be modified if the description also needs to be provided. Here I’ve changed “word” to “acronym”:
\glsaddstoragekey
 {abbrtype}% key/field name
 {acronym}% default value if not explicitly set
 {\abbrtype}% custom command to access the value if required
This may seem a little odd for non-abbreviated entries that are defined using \newglossaryentry directly, but \ifglshaslong can be used to determine whether or not to reference the value of this new abbrtype field.

The new acronym style has a minor modification that forces the user to specify a description. In the previous example, the line:

\renewcommand*{\GenericAcronymFields}{% 
     description={\the\glslongtok}}% 
needs to be changed to:
\renewcommand*{\GenericAcronymFields}{}% 
Additionally, to accommodate the change in the default value of the abbrtype key, all instances of
\ifglsfieldeq{##1}{abbrtype}{word}
need to be changed to:
\ifglsfieldeq{##1}{abbrtype}{acronym}

Once this new style has been set, the new acronyms can be defined using the optional argument to set the description:

\newacronym[description={system for detecting the position and
speed of aircraft, ships, etc}]{radar}{radar}{radio detecting
and ranging}

No change is required for the definition of \newinitialism but again the optional argument is required to set the description:

\newinitialism[description={mathematical manipulation of an
information signal}]{dsp}{DSP}{digital signal processing}

We can also accommodate contractions in a similar manner to the initialisms:

\newcommand*{\newcontraction}[4][]{% 
  \newacronym[abbrtype=contraction,#1]{#2}{#3}{#4}% 
}
The contractions can similarly been defined using this new command:
\newcontraction[description={front part of a ship below the
deck}]{focsle}{fo'c's'le}{forecastle}

Since the custom acronym style just checks if abbrtype is “acronym”, the contractions will be treated the same as the initialisms, but the style could be modified by a further test of the abbrtype value if required.

To test regular non-abbreviated entries, I’ve also defined a simple word:

\newglossaryentry{apple}{name={apple},description={a fruit}}

Now for a new glossary style that provides information about the abbreviation (in addition to the description):

\newglossarystyle
 {mystyle}% style name
 {% base it on the "list" style
   \setglossarystyle{list}% 
   \renewcommand*{\glossentry}[2]{% 
     \item[\glsentryitem{##1}% 
          \glstarget{##1}{\glossentryname{##1}}]
       \ifglshaslong{##1}% 
       { (\abbrtype{##1}: \glsentrylong{##1})\space}{}% 
       \glossentrydesc{##1}\glspostdescription\space ##2}% 
 }
This uses \ifglshaslong to determine whether or not the term is an abbreviation. (An alternative is to use \ifglshasshort. The long and short keys are only set for acronyms/abbreviations.)

If the entry has an short/long value, the full form is supplied in parentheses and \abbrtype (defined by \glsaddstoragekey earlier) is used to indicate the type of abbreviation.

With this style set, the “apple” entry is simply displayed in the glossary as:

apple a fruit.
but the abbreviations are displayed in the form
laser (acronym: light amplification by stimulated emission of radiation) device that creates a narrow beam of intense light.
(for acronyms) or
DSP (initialism: digital signal processing) mathematical manipulation of an information signal.
(for initalisms) or
fo’c’s’le (contraction: forecastle) front part of a ship below the deck.
(for contractions).

For a complete document, see sample-storage-abbr-desc.tex.

4.4. Expansion[link]

When you define new glossary entries expansion is performed by default, except for the name, description, descriptionplural, symbol, symbolplural and sort keys (these keys all have expansion suppressed via \glssetnoexpandfield).

You can switch expansion on or off for individual keys using:

\glssetexpandfield{field}
or
\glssetnoexpandfield{field}
respectively, where field is the internal field label corresponding to the key. In most cases, this is the same as the name of the key except for those listed in Table 4.1.

Table 4.1: Key to Field Mappings
Key Field
sort sortvalue
firstplural firstpl
description desc
descriptionplural descplural
user1 useri
user2 userii
user3 useriii
user4 useriv
user5 userv
user6 uservi
longplural longpl
shortplural shortpl

Any keys that haven’t had the expansion explicitly set using \glssetexpandfield or \glssetnoexpandfield are governed by

\glsexpandfields
and
\glsnoexpandfields

If your entries contain any fragile commands, I recommend you switch off expansion via \glsnoexpandfields. (This should be used before you define the entries.)

Both \newacronym and \newabbreviation partially suppress expansion of some keys regardless of the above expansion settings.

4.5. Sub-Entries[link]

A sub-entry is created by setting the parent key. These will normally be sorted so that they are placed immediately after their parent entry. However, some sort methods aren’t suitable when there are sub-entries. In particular, sub-entries are problematic with Option 1, and with Option 5 the sub-entries must be defined immediately after their parent entry (rather than at any point after the parent entry has been defined).

The hierarchical level indicates the sub-entry level. An entry with no parent (a top level entry) is a hierarchical level 0 entry. An entry with a parent has a hierarchical level that’s one more than its parent’s level. The level is calculated when an entry is defined.

The hierarchical level is stored in the level internal field. It can be accessed using commands like \glsfieldfetch or (with glossaries-extra) \glsxtrusefield, but neither the level nor the parent values should be altered as it can cause inconsistencies in the sorting and glossary formatting. The indexing syntax for Options 2 and 3 is generated when the entry is first defined, so it’s too late to change the hierarchy after that, and bib2gls obtains the hierarchical information from the bib files and the resource options. Note, however, that glossaries-extra does allow the ability to locally alter the level with the leveloffset option, which is mainly intended for nested glossary. See the glossaries-extra manual for further details and also Gallery: Inner or Nested Glossaries.

There are two different types of sub-entries: those that have the same name as their parent (homographs, see §4.5.2) and those that establish a hierarchy (see §4.5.1). Both types are considered hierarchical entries from the point of view of the glossaries package and the indexing applications, but typically homographs will have the name key obtained from the parent, rather than have it explicitly set, and have a maximum hierarchical level of 1.

Not all glossary styles support hierarchical entries and may display all the entries in a flat format. Of the styles that support sub-entries, some display the sub-entry’s name whilst others don’t. Therefore you need to ensure that you use a suitable style. (See §13 for a list of predefined glossary styles.) If you want level 1 sub-entries automatically numbered (in glossary styles that support it) use the subentrycounter package option (see §2.3 for further details).

Note that the parent entry will automatically be added to the glossary if any of its child entries are used in the document. If the parent entry is not referenced in the document, it will not have a number list. Note also that makeindex has a restriction on the maximum hierarchical depth.

4.5.1. Hierarchy[link]

To create a glossary with hierarchical divisions, you need to first define the division, which will be a top level (level 0) entry, and then define the sub-entries using the relevant higher level entry as the value of the parent key. (In a hierarchical context, a higher level indicates a numerically smaller level number, so level 0 is one level higher than level 1.) The top level entry may represent, for example, a topic or classification. A level 1 entry may represent, for example, a sub-topic or sub-classification.

Example 16: Hierarchical Divisions—Greek and Roman Mathematical Symbols

Suppose I want a glossary of mathematical symbols that are divided into Greek letters and Roman letters. Then I can define the divisions as follows:

\newglossaryentry{greekletter}{name={Greek letters},
description={\nopostdesc}}

\newglossaryentryromanletter{name={Roman letters},
description={\nopostdesc}}

Note that in this example, the top level entries don’t need a description so I have set the descriptions to \nopostdesc. This gives a blank description and suppresses the description terminator.

I can now define my sub-entries as follows:

\newglossaryentry{pi}name={\ensuremath{\pi}},sort={pi},
description={ratio of the circumference of a circle to 
the diameter},
parent={greekletter}

\newglossaryentry{C}{name={\ensuremath{C}},sort={C},
description={Euler's constant},
parent={romanletter}}
For a complete document, see the sample file sampletree.tex.

If you want to switch to Option 5, you will need to move the definitions of the sub-entries to immediately after the definition of their parent entry. So, in this case, “pi” needs to be defined after “greekletter” and before “romanletter”.

4.5.2. Homographs[link]

Sub-entries that have the same name as the parent entry don’t need to have the name key explicitly set. For example, the word “glossary” can mean a list of technical words or a collection of glosses. In both cases the plural is “glossaries”. So first define the parent entry:

\newglossaryentry{glossary}{name={glossary},
description={\nopostdesc},
plural={glossaries}}
As in the previous example, the parent entry has no description, so the description terminator needs to be suppressed using \nopostdesc.

Now define the two different meanings of the word with the parent key set to the above parent entry label:

\newglossaryentry{glossarylist}{
description={list of technical words},
sort={1},
parent={glossary}}

\newglossaryentry{glossarycol}{
description={collection of glosses},
sort={2},
parent={glossary}}
Note that if I reference the parent entry (for example, \gls{glossary}), the location will be added to the parent’s number list, whereas if I reference any of the child entries (for example, \gls{glossarylist}), the location will be added to the child entry’s number list. Note also that since the sub-entries have the same name, the sort key is required with Option 3 (xindy) and recommended with Option 2 (makeindex). You can use the subentrycounter package option to automatically number the level 1 child entries in the glossary (if you use a glossary style that supports it). See §2.3 for further details.

In the above example, the plural form for both of the child entries is the same as the parent entry, so the plural key was not required for the child entries. However, if the sub-entries have different plurals, they will need to be specified. For example:

\newglossaryentry{bravo}{name={bravo},
description={\nopostdesc}}

\newglossaryentry{bravocry}{description={cry of approval 
(pl. bravos)},
sort={1},
plural={bravos},
parent={bravo}}

\newglossaryentry{bravoruffian}{description={hired 
ruffian or killer (pl. bravoes)},
sort={2},
plural={bravoes},
parent={bravo}}
For a complete document, see the sample file sample.tex.

4.6. Loading Entries From a File[link]

You can store all your glossary entry definitions in another file and use:

\loadglsentries[type]{filename}
where filename is the name of the file containing all the \newglossaryentry, \longnewglossaryentry, \newacronym etc commands. The optional argument type is the name of the glossary to which those entries should belong, for those entries where the type key has been omitted (or, more specifically, for those entries whose type has been set to \glsdefaulttype, which is what \newglossaryentry uses by default). See sampleDB.tex for a complete example document.

Commands like \newacronym, \newabbreviation, \newterm, \glsxtrnewsymbol and \glsxtrnewnumber all set the type key to the appropriate glossary. This means that the type optional argument won’t apply to those commands, unless they have type={\glsdefaulttype}.

This is a preamble-only command. You may also use \input to load the file but don’t use \include. If you find that your file is becoming unmanageably large, you may want to consider switching to bib2gls and use an application such as JabRef to manage the entry definitions.

If you want to use \AtBeginDocument to \input all your entries automatically at the start of the document, add the \AtBeginDocument command before you load the glossaries package (and babel, if you are also loading that) to avoid the creation of the glsdefs file and any associated problems that are caused by defining commands in the document environment. (See §4.8.) Alternatively, if you are using glossaries-extra, use the docdef=restricted package option.

Example 17: Loading Entries from Another File
Suppose I have a file called myentries.tex which contains:
\newglossaryentry{perl}{type={main},
name={Perl},
description={A scripting language}}

\newglossaryentry{tex}{name={\TeX},
description={A typesetting language},sort={TeX}}

\newglossaryentry{html}{type={\glsdefaulttype},
name={html},
description={A mark up language}}
and suppose in my preamble I use the command:
\loadglsentries[languages]{myentries}
then this will add the entries “tex” and “html” to the glossary whose type is given by languages, but the entry “perl” will be added to the main glossary, since it explicitly sets the type to main.

Now suppose I have a file myacronyms.tex that contains:

\newacronym{aca}{aca}{a contrived acronym}
then (supposing I have defined a new glossary type called altacronym)
\loadglsentries[altacronym]{myacronyms}
will add “aca” to the glossary type acronym, if the package option acronym has been specified, or will add “aca” to the glossary type altacronym, if the package option acronym is not specified. This is because \acronymtype is set to \glsdefaulttype if the acronym package option is not used so the optional argument of \loadglsentries will work in that case, but if the acronym option is used then \acronymtype will be redefined to acronym.

If you want to use \loadglsentries with the acronym package option set, there are two possible solutions to this problem:

  1. 1.Change myacronyms.tex so that entries are defined in the form:
    \newacronym[type={\glsdefaulttype}]{aca}{aca}{a 
    contrived acronym}
    
    and do:
    \loadglsentries[altacronym]{myacronyms}
    

  2. 2.Temporarily change \acronymtype to the target glossary:
    \let\orgacronymtype\acronymtype
    \renewcommand{\acronymtype}{altacronym}
    \loadglsentriesmyacronyms
    \let\acronymtype\orgacronymtype
    

Note that only those entries that have been indexed in the text will appear in the relevant glossaries. Note also that \loadglsentries may only be used in the preamble.

Don’t use the see key in a large file of entries that may or may not be indexed in the document. Similarly for seealso and alias with glossaries-extra. If you need them and you need a large database of entries, consider switching to bib2gls.

Remember that you can use \provideglossaryentry rather than \newglossaryentry. Suppose you want to maintain a large database of acronyms or terms that you’re likely to use in your documents, but you may want to use a modified version of some of those entries. (Suppose, for example, one document may require a more detailed description.) Then if you define the entries using \provideglossaryentry in your database file, you can override the definition by simply using \newglossaryentry before loading the file. For example, suppose your file (called, say, terms.tex) contains:

\provideglossaryentry{mallard}{name={mallard},
 description={a type of duck}}
but suppose your document requires a more detailed description, you can do:
\usepackage{glossaries}
\makeglossaries

\newglossaryentry{mallard}{name={mallard},
 description={a dabbling duck where the male has a green head}}

\loadglsentries{terms}
Now the “mallard” definition in the terms.tex file will be ignored.

4.7. Moving Entries to Another Glossary[link]

You can move an entry from one glossary to another using:

\glsmoveentry{entry-label}{target glossary label}
where entry-label is the unique label identifying the required entry and target glossary label is the unique label identifying the glossary in which to put the entry. If you are using Options 2 or 3, entries shouldn’t be moved after the indexing files have been opened by \makeglossaries.

Simply changing the value of the type field using a command like \glsfielddef won’t correctly move the entry, since the label needs to be removed from the old glossary’s internal list and added to the new glossary’s internal list to allow commands such as \glsaddall and \glsunsetall to work.

Note that no check is performed to determine the existence of the target glossary. If you want to move an entry to a glossary that’s skipped by \printglossaries, then define an ignored glossary with \newignoredglossary. (See §9.) With Options 4 and 5, it’s also possible to copy an entry to another glossary with \glsxtrcopytoglossary. See the glossaries-extra manual for further details.

Unpredictable results may occur if you move an entry to a different glossary from its parent or children.

4.8. Drawbacks With Defining Entries in the Document Environment[link]

Originally, \newglossaryentry (and \newacronym) could only be used in the preamble. I reluctantly removed this restriction in version 1.13, but there are issues with defining commands in the document environment instead of the preamble, which is why the restriction is maintained for newer commands. This restriction is also reimposed for \newglossaryentry by Option 1 because in that case the entries must be defined before the aux file is input. (The glossaries-extra package automatically reimposes the preamble-only restriction but provides the docdef package option to allow document definitions for Options 2 and 3 if necessary.)

With Option 4, all entry data should be supplied in bib files. From bib2gls’s point of view, the entries are defined in the bib files. From TeX’s point of view, the entries are defined in the glstex files that are input by \GlsXtrLoadResources, which is a preamble-only command.

4.8.1. Technical Issues[link]

  1. 1.If you define an entry mid-way through your document, but subsequently shuffle sections around, you could end up using an entry before it has been defined. This is essentially the same problem as defining a command with \newcommand in the middle of the document and then moving things around so that the command is used before it has been defined.

  2. 2.Entry information is required when displaying the glossary. If this occurs at the start of the document, but the entries aren’t defined until later, then the entry details are being looked up before the entry has been defined. This means that it’s not possible to display the content of the glossary unless the entry definitions are saved on the previous LaTeX run and can be picked up at the start of the document environment on the next run (in a similar way that \label and \ref work).

  3. 3.If you use a package, such as babel, that makes certain characters active at the start of the document environment, there can be a problem if those characters have a special significance when defining glossary entries. These characters include " (double-quote), ! (exclamation mark), ? (question mark), and | (pipe). They must not be active when defining a glossary entry where they occur in the sort key (and they should be avoided in the label if they may be active at any point in the document). Additionally, the comma (,) character and the equals (=) character should not be active when using commands that have key=value arguments.

To overcome the first two problems, as from version 4.0 the glossaries package modifies the definition of \newglossaryentry at the beginning of the document environment so that the definitions are written to an external file (\jobname.glsdefs) which is then read in at the start of the document on the next run. This means that the entry can now be looked up in the glossary, even if the glossary occurs at the beginning of the document.

There are drawbacks to this mechanism: if you modify an entry definition, you need a second run to see the effect of your modification in \printglossary (if it occurs at the start of the document); this method requires an extra \newwrite, which may exceed TeX’s maximum allocation; unexpected expansion issues could occur.

Version 4.47 has introduced changes that have removed some of the issues involved, and there are now warning messages if there is an attempt to multiply define the same entry label.

The glossaries-extra package provides a setting (but not for Options 1 or 4) that allows \newglossaryentry to occur in the document environment but doesn’t create the glsdefs file. This circumvents some problems but it means that you can’t display any of the glossaries before all the entries have been defined (so it’s all right if all the glossaries are at the end of the document but not if any occur in the front matter).

4.8.2. Good Practice Issues[link]

§4.8.1 above covers technical issues that can cause your document to have compilation errors or produce incorrect output. This section focuses on good writing practice. The main reason cited by users wanting to define entries within the document environment rather than in the preamble is that they want to write the definition as they type in their document text. This suggests a “stream of consciousness” style of writing that may be acceptable in certain literary genres but is inappropriate for factual documents.

When you write technical documents, regardless of whether it’s a PhD thesis or an article for a journal or proceedings, you must plan what you write in advance. If you plan in advance, you should have a fairly good idea of the type of terminology that your document will contain, so while you are planning, create a new file with all your entry definitions. If, while you’re writing your document, you remember another term you need, then you can switch over to your definition file and add it. Most text editors have the ability to have more than one file open at a time. The other advantage to this approach is that if you forget the label, you can look it up in the definition file rather than searching through your document text to find the definition.

5. Referencing Entries in the Document[link]

Once you have defined a glossary entry using a command such as \newglossaryentry4) or \newacronym6), you can refer to that entry in the document with one of the provided commands that are describe in this manual. (There are some additional commands provided by glossaries-extra.) The text produced at that point in the document (the link text) is determined by the command and can also be governed by whether or not the entry has been marked as used.

Some of these commands are more complicated than others. Many of them are robust and can’t be used in fully expandable contexts, such as in PDF bookmarks.

The commands are broadly divided into:

  1. 1.Those that display text in the document (where the formatting can be adjusted by a style or hook) and also index the entry (so that it’s added to the glossary) are described in §5.1. This set of commands can be further sub-divided into those that mark the entry as having been used (the \gls-like commands, §5.1.2) and those that don’t (the \glstext-like commands, §5.1.3).

  2. 2.Those that display text in the document without indexing or applying any additional formatting (§5.2). These typically aren’t robust or can partially expand so that they can be used in PDF bookmarks (with a few exceptions).
There are additional commands specific to entries defined with \newacronym that are described in §6.1.