glossaries-extra.sty v1.48: an extension to the glossaries package

Nicola L.C. Talbot
 
Dickimaw Books
http://www.dickimaw-books.com/

2021-11-22

Abstract

The glossaries-extra package is an extension to the glossaries package, providing additional features. Some of the features provided by this package are only available with glossaries version 4.19 (or above). This document assumes familiarity with the glossaries package.

The file example-glossaries-xr.tex contains dummy entries with cross-references that may be used for creating minimal working examples for testing the glossaries-extra package. (The base glossaries package provides additional files, but this one needs glossaries-extra.) There are equivalent .bib files for use with bib2gls.

The glossaries-extra package uses a different set of defaults to the base glossaries package. See the Introduction for more details.

Since glossaries-extra internally loads the glossaries package, you also need to have glossaries installed and all the packages that glossaries depends on (including, but not limited to, tracklang, mfirstuc, etoolbox, xkeyval (at least version dated 2006/11/18), textcase, xfor, datatool-base and amsgen. These packages are all available in the current TeX Live and MikTeX distributions. If any of them are missing, please update your TeX distribution using your update manager. (For help on this see, for example, How do I update my TeX distribution? or Updating TeX on Linux.)

Additional resources:

Contents

1 Introduction
 1.1 Package Defaults
 1.2 New or Modified Package Options
2 Modifications to Existing Commands and Styles
 2.1 Defining Entries
 2.2 Entry Indexing
 2.3 Cross-References (“see” and “see also”)
 2.4 Entry Display Style Modifications
 2.5 Entry Counting Modifications
 2.6 First Use Flag
 2.7 Plurals
 2.8 Nested Links
 2.9 Acronym Style Modifications
 2.10 Glossaries
 2.11 Glossary Style Modifications
  2.11.1 Style Hooks
  2.11.2 Number List
  2.11.3 The glossaries-extra-stylemods Package
3 New Glossary Styles
 3.1 glossary-bookindex package
 3.2 glossary-longextra package
 3.3 glossary-topic package
4 Abbreviations
 4.1 Tagging Initials
 4.2 Abbreviation Styles
 4.3 Shortcut Commands
 4.4 Predefined Abbreviation Styles
  4.4.1 Predefined Abbreviation Styles that Set the Regular Attribute
  4.4.2 Predefined Abbreviation Styles that Don’t Set the Regular Attribute
 4.5 Defining New Abbreviation Styles
5 Entries in Sectioning Titles, Headers, Captions and Contents
 5.1 Simplistic Approach
 5.2 New Commands Designed for Chapter/Section Headings
6 Multi (or Compound) Entries
 6.1 Examples
  6.1.1 Example: Hierarchical
  6.1.2 Example: Suffix
  6.1.3 Example: Category Suffix
  6.1.4 Example: Separators
  6.1.5 Example: Skipping Elements (Fragment Element)
  6.1.6 Example: Skipping Elements (Prefix and Post-Link Hooks)
 6.2 Main and Other Elements
 6.3 Prefixes and Suffixes
 6.4 Separators
 6.5 mgls Element Hooks
 6.6 Post-Link Hook
  6.6.1 Last Element
  6.6.2 Main Element
 6.7 Multi-Entry First Use
 6.8 Multi-Entry Category
 6.9 Multi-Entry Settings
  6.9.1 Indexing
  6.9.2 Location Formats (Encaps)
  6.9.3 Post-Link Hooks
  6.9.4 Prefixes and Suffixes
  6.9.5 Skipping Elements
  6.9.6 General
 6.10 mgls Options
 6.11 Variants of mgls
  6.11.1 gls-like
  6.11.2 Abbreviations
  6.11.3 Other Fields
  6.11.4 Support for glossaries-prefix (pgls)
 6.12 Cross-References
 6.13 Additional Commands
 6.14 bib2gls
7 Categories
8 Counting References
 8.1 Entry Counting (First Use Flag)
 8.2 Link Counting
9 Auto-Indexing
10 bib2gls: Managing Reference Databases
 10.1 Selection
 10.2 Sorting and Displaying the Glossary
 10.3 The glossaries-extra-bib2gls package
  10.3.1 Supplemental Locations
  10.3.2 Nameref Record
  10.3.3 Helper Commands for Resource Options
 10.4 Supplementary Commands
 10.5 Record Counting
11 Miscellaneous New Commands
 11.1 Entry Fields
 11.2 Display All Entries Without Sorting or Indexing
  11.2.1 Hooks
  11.2.2 Filtering
 11.3 Partial Glossaries
 11.4 Standalone Entry Items
 11.5 Entry Aliases
12 On-the-Fly Document Definitions
13 Supplemental Packages
 13.1 Prefixes or Determiners
 13.2 Accessibility Support
14 Sample Files
15 Multi-Lingual Support
Glossary

1. Introduction

The glossaries package is a flexible package, but it’s also a heavy-weight package that uses a lot of resources. As package developer, I’m caught between those users who complain about the drawbacks of a heavy-weight package with a large user manual and those users who want more features (which necessarily adds to the package weight and manual size).

The glossaries-extra package is an attempt to provide a compromise for this conflict. Version 4.22 of the glossaries package is the last version to incorporate new features.1.1 Future versions of glossaries will just be bug fixes. New features will instead be added to glossaries-extra. This means that the base glossaries package won’t increase in terms of package loading time and allocation of resources, but those users who do want extra features available will have more of a chance of getting their feature requests accepted.

Top

1.1 Package Defaults

I’m not happy with some of the default settings assumed by the glossaries package, and, judging from code I’ve seen, other users also seem unhappy with them, as certain package options are often used in questions posted on various sites. I can’t change the default behaviour of glossaries as it would break backward compatibility, but since glossaries-extra is a separate package, I have decided to implement some of these commonly-used options by default. You can switch them back if they’re not appropriate.

The new defaults are:

The examples below illustrate the difference in explicit package options between glossaries and glossaries-extra. There may be other differences resulting from modifications to commands provided by glossaries (see §2 Modifications to Existing Commands and Styles).

  1. Basic defaults:
         \documentclass{article}
         \usepackage{glossaries-extra}
    

    This is like:

         \documentclass{article}
         \usepackage[toc,nopostdot]{glossaries}
         \usepackage{glossaries-extra}
    

  2. Language defaults:
         \documentclass[british]{article}
         \usepackage{babel}
         \usepackage{glossaries-extra}
    

    This is like:

         \documentclass[british]{article}
         \usepackage{babel}
         \usepackage[toc,nopostdot,translate=babel]{glossaries}
         \usepackage{glossaries-extra}
    

  3. Combined with memoir
         \documentclass{memoir}
         \usepackage{glossaries-extra}
    

    This is like:

         \documentclass{memoir}
         \usepackage[toc,nopostdot,noredefwarn]{glossaries}
         \usepackage{glossaries-extra}
    

    However

         \documentclass{memoir}
         \usepackage{glossaries}
         \usepackage{glossaries-extra}
    

    This is like:

         \documentclass{memoir}
         \usepackage[toc,nopostdot]{glossaries}
         \usepackage{glossaries-extra}
    

    Since by the time glossaries-extra has been loaded, glossaries has already redefined memoir’s glossary-related commands.

  4. Abbreviations are defined with \newabbreviation:
         \usepackage{glossaries-extra}
         \newabbreviation{svm}{SVM}{support vector machine}
         \begin{document}
         First use: \gls{svm}. Explicit full form: \glsxtrfull{svm}.
         \end{document}
    

    This is the closest to:

         \usepackage{glossaries}
         \newacronym{svm}{SVM}{support vector machine}
         \begin{document}
         First use: \gls{svm}. Explicit full form: \acrfull{svm}.
         \end{document}
    

    If you want to continue using \newacronym then you will need to change the style for the acronym category:

         \usepackage{glossaries-extra}
         \setabbreviationstyle[acronym]{long-short}
         \newacronym{svm}{SVM}{support vector machine}
         \begin{document}
         First use: \gls{svm}. Explicit full form: \glsxtrfull{svm}.
         \end{document}
    

Another noticeable change is that by default \printglossary will now display information text in the document if the external glossary file doesn’t exist. This is explanatory text to help new users who can’t work out what to do next to complete the document build. Once the document is set up correctly and the external files have been generated, this text will disappear.

This change is mostly likely to be noticed by users with one or more redundant empty glossaries who ignore transcript messages, explicitly use makeindex/xindy on just the non-empty glossary (or glossaries) and use the iterative \printglossaries command instead of \printglossary. For example, consider the following:

\documentclass{article}
\usepackage[acronym]{glossaries}
\makeglossaries
\newacronym{laser}{laser}{light amplification by stimulated
emission of radiation}
\begin{document}
\gls{laser}
\printglossaries
\end{document}

The above document will only display the list of acronyms at the place where \printglossaries occurs. However it will also attempt to input the .gls file associated with the main glossary.

If you use makeglossaries, you’ll get the warning message:

Warning: File 'test.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.

(where the original file is called test.tex) but if you simply call makeindex directly to generate the .acr file (without attempting to create the .gls file) then the transcript file will always contain the message:

No file test.gls.

This doesn’t occur with makeglossaries as it will create the .gls file containing the single command \null.

If you simply change from glossaries to glossaries-extra in this document, you’ll find a change in the resulting PDF if you don’t use makeglossaries and you only generate the .acr file with makeindex.

The transcript file will still contain the message about the missing .gls, but now you’ll also see information in the actual PDF document. The simplest remedy is to follow the advice inserted into the document at that point, which is to add the nomain package option:

\documentclass{article}
\usepackage[nomain,acronym,postdot]{glossaries-extra}
\makeglossaries
\setabbreviationstyle[acronym]{long-short}
\newacronym{laser}{laser}{light amplification by stimulated
emission of radiation}
\begin{document}
\gls{laser}
\printglossaries
\end{document}

(Note the need to set the acronym style using \setabbreviationstyle before \newacronym. See §4 Abbreviations for further details.)

Top

1.2 New or Modified Package Options

If you haven’t already loaded glossaries, you can use any of the package options provided by glossaries when you load glossaries-extra and they will automatically be passed to glossaries (which glossaries-extra will load). If glossaries has already been loaded, then those options will be passed to \setupglossaries, but remember that not all of the glossaries package options may be used in that command.

This section only lists options that are either unrecognised by the glossaries package or are a modified version of options of the same name provided by glossaries. See the glossaries user manual for details about the unmodified options.

The new and modified options provided by glossaries-extra are described below:

debug
The glossaries package has a debug option that allows the values false, true and showtargets. The debug=showtargets option was introduced to glossaries v4.32, so if you want to use this option with glossaries-extra you must make sure that your version of glossaries supports it.

The glossaries-extra package extends this option to provide the additional values debug=showwrgloss and debug=all.

The debug=showwrgloss option implements debug=true and uses


\glsxtrwrglossmark

to show a mark just before the write operation performed by the indexing commands. If you use record=hybrid there will be a mark for the write operation to the .aux file for bib2gls and a mark for the write operation to the associated glossary file for makeindex or xindy.

The debug=all option implements both debug=showtargets and debug=showwrgloss.

showtargets
This implements debug=showtargets and can also adjust the way the targets are shown. By default, any links that occur in TeX’s “outer” mode are placed in the margin according to \glsshowtargetouter (provided by the base glossaries package). This can lead to the “too many floats” error if there are multiple instances of commands like \gls in a single line. This option provides a way of changing this to an in-line annotation. Available values:
left
A marker is placed to the left of the link/target and a marginal note is used in outer mode;
right
A marker is placed to the right of the link/target and a marginal note is used in outer mode;
innerleft
A marker and annotation are placed to the left of the link/target in all modes;
innerright
A marker and annotation are placed to the right of the link/target in all modes;
annoteleft
Markers are placed on either side of the link/target and the annotation is on the left;
annoteright
Markers are placed on either side of the link/target and the annotation is on the right.
postdot
(New to version 1.12.) This option is just a shortcut for nopostdot=false.
postpunc
(New to version 1.21.) This option sets the post-description punctuation to the given value. For example: postpunc=; does
     \renewcommand{\glspostdescription}{;}

The value may also be one of the following keywords:

comma:
postpunc=comma is equivalent to
         \renewcommand{\glspostdescription}{,}

dot:
postpunc=dot is equivalent to
         \renewcommand{\glspostdescription}{.\spacefactor\sfcode`\. }

none:
postpunc=none is equivalent to
         \renewcommand{\glspostdescription}{}

The default definition is

     \newcommand*{\glspostdescription}{%
       \ifglsnopostdot\else.\spacefactor\sfcode`\. \fi
     }

where the conditional is determined by the nopostdot package option. The postpunc option removes the conditional from the definition of \glspostdescription. The package options nopostdot and postdot will restore the original definition of \glspostdescription.

The glossaries-extra-stylemods package adjusts the predefined styles that had a hard-coded \space before the number list so that they use \glsxtrprelocation instead (which is defined to \space). You can therefore redefine this command in combination with postpunc to alter the separator before the number list. For example, to have a comma followed by \hfil:

     \usepackage[postpunc=comma,stylemods]{glossaries-extra}
     \renewcommand{\glsxtrprelocation}{\hfil}

Be careful with doing this as it will look odd if the number list is missing. (With bib2gls you can instead redefine \glsxtrprelocation to do nothing and set the location prefixes with loc-prefix which will only apply if the entry has a number list.)

prefix
Load the glossaries-prefix package (if not already loaded).
accsupp
Load the glossaries-accsupp package (if not already loaded).

The glossaries-accsupp package is still experimental and so accessibility features are liable to change.

If you want to define styles that can interface with the accessibility support provided by glossaries-accsupp use the \glsaccessxxx⟩ type of commands instead of \glsentryxxx⟩ (for example, \glsaccesstext instead of \glsentrytext). If glossaries-accsupp hasn’t been loaded those commands are equivalent (for example, \glsaccesstext just does \glsentrytext) but if it has been loaded, then the \glsaccessxxx⟩ commands will add the accessibility information. (See §13.2 Accessibility Support for further details.)

Note that the accsupp option can only be used as a package option (and can’t be set with \glossariesextrasetup) since the glossaries-accsupp package must be loaded before glossaries-extra if it’s required.

stylemods
This is a ⟨key⟩=⟨value⟩ option used to load the glossaries-extra-stylemods package. The value may be a comma-separated list of options to pass to that package. (Remember to group ⟨value⟩ if it contains any commas.) The value may be omitted if no options need to be passed. See §2.11 Glossary Style Modifications for further details. There are two special keyword values: stylemods=default (equivalent to omitting the value) and stylemods=all, which loads all the predefined styles.
undefaction
This is a ⟨key⟩=⟨value⟩ option, which has two allowed values: warn and error. This indicates what to do if an undefined glossary entry is referenced. The default behaviour is undefaction=error, which produces an error message (the default for glossaries). You can switch this to a warning message (and ?? appearing in the text) with undefaction=warn.

Undefined entries can’t be picked up by any commands that iterate over a glossary list. This includes \forglsentries and \glsaddall.

Note that \ifglsused will display ?? in the document text with undefaction=warn if the entry hasn’t been defined, as the underlying boolean variable doesn’t exist and so is neither true nor false. (There will also be a warning in the transcript.) See §2.6 First Use Flag for further details.

indexcrossrefs
This is a boolean option. If true, this will automatically index any cross-referenced entries that haven’t been marked as used at the end of the document. Note that this necessarily adds to the overall document build time, especially if you have defined a large number of entries, so this defaults to false, but it will be automatically switched on if you use the see or seealso keys in any entries (unless autoseeindex=false). To force it off, even if you use the see or seealso key, you need to explicitly set indexcrossrefs to false.

Note that bib2gls can automatically find dependent entries when it parses the .bib source file. The record option automatically implements indexcrossrefs=false.

autoseeindex
(New to v1.16.) This is a boolean option. If true (default), this makes the see and seealso keys automatically index the cross-reference when an entry is defined. If false, the value of those keys will still be stored in their corresponding fields (and can be accessed using commands like \glsxtrusesee and \glsxtruseseealso) but cross-reference won’t be automatically indexed.

Note that the record=only option automatically implements autoseeindex=false.

For example, if an entry is defined as

     \newglossaryentry{foo}{name={foo},description={},see={bar,baz}}

then with autoseeindex=true, this is equivalent to

     \newglossaryentry{foo}{name={foo},description={}}
     \glssee{foo}{bar,baz}
     \glossariesextrasetup{indexcrossrefs=true}
     \GlsXtrSetField{foo}{see}{bar,baz}

but with autoseeindex=false, this is equivalent to

     \newglossaryentry{foo}{name={foo},description={}}
     \GlsXtrSetField{foo}{see}{bar,baz}

Note that indexcrossrefs isn’t automatically implemented by the presence of the see key when autoseeindex is false.

It’s therefore possible to remove the cross-references from the location lists and set their position within the glossary style.

Another method of preventing the automatic indexing is to define the entries before the external indexing files have been opened with \makeglossaries. Since the appropriate file isn’t open, the information can’t be written to it. This will need the package option seenoindex=ignore (provided by glossaries) to prevent an error occurring.

record
(New to v1.08.) This is a ⟨key⟩=⟨value⟩ option provided for the benefit of bib2gls (see §10 bib2gls: Managing Reference Databases). If you want to use bib2gls, the recommended setting is record=nameref if you have hyperlinks and record=only if you don’t have hyperlinks.

The option may only be set in the preamble and can’t be used after \GlsXtrLoadResources. If the value is missing record=only is assumed. Permitted values:

off
This is the default setting. The indexing is performed as normal using either \makeglossaries or \makenoidxglossaries. This setting implements undefaction=error.
only
The indexing (recording) is performed by bib2gls (see §10 bib2gls: Managing Reference Databases). Neither \makeglossaries nor \makenoidxglossaries is permitted. This setting implements undefaction=warn and automatically loads the supplementary glossaries-extra-bib2gls package. (There should be no need to explicitly load glossaries-extra-bib2gls.)

The glossaries should be displayed using \printunsrtglossary (or \printunsrtglossaries).

The document build process is (assuming the file is called myDoc.tex):

         pdflatex myDoc
         bib2gls myDoc
         pdflatex myDoc

If you want letter groups you will need the --group or -g switch when invoking bib2gls:

         pdflatex myDoc
         bib2gls -g myDoc
         pdflatex myDoc

Note that record=only will prevent the see from automatically implementing \glssee. (bib2gls deals with the see field.) You may explicitly use \glssee in the document, but bib2gls will ignore the cross-reference if the see field was already set for that entry.

The record=only option will automatically set the glossaries package’s sort=none option if available. (That option value was only introduced to glossaries v4.30.)

nameref
(New to v1.37 and requires bib2gls v1.8+.) This option is like record=only but additionally records the current label information given by \@currentlabel and \@currentHref, and provides a more reliable way of saving the \theHcounter⟩ for the given location. This option requires hyperref otherwise it will fall back on the usual location records. Remember that \@currentHref is always globally updated whenever \refstepcounter is used, but \@currentlabel isn’t. This can cause some undesired side-effects with some settings. Remember also that the indexcounter option increments the associated counter every time an entry is indexed, which affects this option. See §10.3.2 Nameref Record for further details.

This option is best used with counter=chapter or counter=section if you want the title included in the location list. If the indexing counter is the default page, only the location number is shown. Similarly for counter=equation (or equations=true).

alsoindex
Deprecated synonym of hybrid.
hybrid
This is a hybrid setting that uses bib2gls to fetch entry information from .bib files, but uses makeindex or xindy to create the glossary files (which are input with \printglossary). Note that this requires a slower and more complicated build process (see below).

This hybrid approach is provided for the rare instances where an existing xindy rule or module is too complicated to convert to a bib2gls rule but the entries need to be fetched from a bib file. There’s no benefit in using this option with makeindex.

Since it’s redundant to make bib2gls also sort, use sort=none in \GlsXtrLoadResources for a faster build.

This option must be used with \makeglossaries but not with its optional argument. This option should not be used with \makenoidxglossaries. You may need to change the transcript file used by bib2gls to avoid a clash with the transcript file used by makeindex or xindy. (This can be done with bib2gls’s --log-file or -t option.)

Each glossary should be displayed using \printglossary (or \printglossaries for all of them). This option is expected to be used with bib2gls’s sort=none setting and so glossaries-extra-bib2gls is not automatically loaded.

The document build process is (assuming the file is called myDoc.tex):

         pdflatex myDoc
         bib2gls myDoc
         pdflatex myDoc
         makeglossaries myDoc
         pdflatex myDoc

Note that, in this case, it’s redundant to call bib2gls with the --group or -g switch as makeindex/xindy will insert the group heading information into the corresponding glossary file. (If you want bib2gls to form the letter groups then this hybrid method is inappropriate.)

With the recording on (record=only, record=nameref or record=hybrid), any of the commands that would typically index the entry (such as \gls, \glstext or \glsadd) will add a \glsxtr@record entry to the .aux file. bib2gls can then read these lines to find out which entries have been used. (Remember that commands like \glsentryname don’t index, so any use of these commands won’t add a corresponding \glsxtr@record entry to the .aux file.) See §10 bib2gls: Managing Reference Databases for further details.

The hybrid method additionally performs the standard indexing action that’s required for makeindex or xindy to work.

equations
(New to v1.37.) This option will cause the default location counter to automatically switch to equation when inside a numbered equation environment, such as equation or align. The counter can be explicitly overridden with counter in the optional arguments of commands like \glslink or \gls as usual.
floats
(New to v1.37.) This option will cause the default location counter to automatically switch to the corresponding counter when inside a floating environment, such as figure or table. The counter can be explicitly overridden with counter in the optional arguments of commands like \glslink or \gls as usual. Remember that within floats it’s the \caption command that actually uses \refstepcounter, so indexing before the caption will result in the wrong reference. The commands for use in captions and sections, such as \glsfmttext and \glsfmtshort, don’t index. (See §5 Entries in Sectioning Titles, Headers, Captions and Contents). You may want to consider using \glsadd after the caption (not before). For example:
     \begin{figure}[htbp]
       \centering
       \includegraphics{example-image}
       \caption{Sample \glsfmttext{foobar} figure}
       \glsadd{foobar}
     \end{figure}

indexcounter
(New to v1.29.) This option (which doesn’t take a value) is primarily intended for use with bib2gls (v1.4+) and hyperref. It can be used with makeindex or xindy but it will interfere with the number list collation, so you won’t have ranges and you’ll have duplicate page numbers present (but each page number will link to the relevant part of the page where the indexing occurred). This option automatically implements counter=wrglossary.

This option works by incrementing wrglossary and adding \label. This can cause a problem if the indexing occurs in an equation environment as amsmath forbids multiple occurrences of \label (resulting in the “Multiple \label’s” error). It’s best to change the counter to page or equation when in maths mode with this option. For example:

     \renewcommand{\glslinkpresetkeys}{%
      \ifmmode \setkeys{glslink}{counter=equation}\fi}
     \renewcommand{\glsaddpresetkeys}{%
      \ifmmode \setkeys{glossadd}{counter=equation}\fi}

By default (with hyperref), the page numbers in number lists link back to the top of the relevant page (provided the format uses \glshypernumber). The indexcounter option is designed to link back to the place within the page where the indexing occurred. It does this by creating a new counter (called wrglossary) that’s incremented with \refstepcounter every time an entry is indexed (but not via cross-referencing commands, such as \glssee). A \label is placed immediately after the increment command allowing the back-referenced to be obtained with \pageref. The location, as seen by the indexing application, is the value of the wrglossary counter but this value is substituted with the page reference when number list is typeset. Since the counter is used by all entries and is incremented every time any indexing occurs, neither makeindex nor xindy can correctly collate the lists. For example, if the first term to be referenced is indexed three times on page 5 without any intervening terms then the actual locations obtained from wrglossary will be 1, 2 and 3, which xindy and makeindex will try to form into the range 1–3, but they should actually all simply appear as page 5, whereas it can actually end up with 5–5. Conversely, a range may not be formed where it would naturally occur if just the page counter was used.

Since bib2gls is designed specifically to work with glossaries-extra, bib2gls (v1.4+) will check for wrglossary locations. If the default --merge-wrglossary-records is on, then any records for the same page for a given entry will be merged. In the above example with three references on page 5, only a single record for page 5 for that entry will be added to the number list and it will link back to the first instance on that page. Whereas if you use the --no-merge-wrglossary-records switch, the number list will contain three instance of page 5, with each linking to the corresponding place on that page. In both cases, consecutive pages can form ranges, but it may look strange in the second case.

See the bib2gls documentation for the save-index-counter resource option for more details.

docdef
This option governs the use of \newglossaryentry. It was originally a boolean option, but as from version 1.06, it can now take one of the following values (if the value is omitted, true is assumed):
  • docdef=false: \newglossaryentry is not permitted in the document environment (default).
  • docdef=true: \newglossaryentry behaves as it does in the base glossaries package. That is, where its use is permitted in the document environment, it uses the .glsdefs temporary file to store the entry definitions so that on the next LaTeX run the entries are defined at the beginning of the document environment. This allows the entry information to be referenced in the glossary, even if the glossary occurs before \newglossaryentry. (For example, when the glossary is displayed in the front matter.) This method of saving the definitions for the next LaTeX run has drawbacks that are detailed in the glossaries user manual.

    Remember that if \newglossaryentry wouldn’t be allowed in the document environment with the base glossaries package, then it still won’t be allowed with docdefs=true. If your glossaries occur at the end of the document, consider using docdef=restricted instead.

  • docdef=restricted: (new to version 1.06) \newglossaryentry is permitted in the document environment without using the .glsdefs file. This means that all entries must be defined before the glossary is displayed, but it avoids the complications associated with saving the entry details in a temporary file. You will still need to take care about any changes made to characters that are required by the ⟨key⟩=⟨value⟩ mechanism (that is, the comma and equal sign) and any makeindex or xindy character that occurs in the sort key or label. If any of those characters are made active in the document, then it can cause problems with the entry definition. This option will allow \newglossaryentry to be used in the document with \makenoidxglossaries, but note that \longnewglossaryentry remains a preamble-only command.

    With this option, if an entry appears in the glossary before it has been defined, an error will occur (or a warning if the undefaction=warn option is used.) If you edit your document and either remove an entry or change its label, you may need to delete the document’s temporary files (such as the .aux and .gls files).

  • docdef=atom: (new to version 1.34) This option behaves like docdef=restricted but creates the .glsdefs file for atom’s autocomplete support. This file isn’t input by glossaries-extra and so associated problems with the use of this file are avoided, but it allows the autocomplete support to find the labels in the file. As with docdef=restricted, entries may be defined in the preamble or anywhere in the document, but they may only be referenced after they have been defined. Entries must be defined before the associated glossary is displayed.

    If you need a list of all entry labels for the use of an editor or helper script you may also want to consider the package options writeglslabels and writeglslabelnames provided by the base glossaries package. Note that with these options and docdef=atom, only the entry labels visible to LaTeX can be saved. So if you are using bib2gls you will only get the labels of the entries that are selected by bib2gls.

The glossaries package allows \newglossaryentry within the document environment (when used with makeindex or xindy) but the user manual warns against this usage. By default the glossaries-extra package prohibits this, only allowing definitions within the preamble. If you are really determined to define entries in the document environment, despite all the associated drawbacks, you can restore this with docdef=true. Note that this doesn’t change the prohibitions that the glossaries package has in certain circumstances (for example, when using “option 1”). See the glossaries user manual for further details. A better option if document definitions are required is docdef=restricted. Only use docdef=true if document definitions are necessary and one or more of the glossaries occurs in the front matter.

This option affects commands that internally use \newglossaryentry, such as \newabbreviation, but not the “on-the-fly” commands described in §12 On-the-Fly Document Definitions.

nomissingglstext
This is a boolean option. If true, this will suppress the warning written to the transcript and the warning text that will appear in the document if the external glossary files haven’t been generated due to an incomplete document build. However, it’s probably simpler just to fix whatever has caused the failure to build the external file or files.
abbreviations
This option has no value and can’t be cancelled. If used, it will automatically create a new glossary with the label abbreviations and redefines \glsxtrabbrvtype to this label. (The file extensions are glg-abr, gls-abr and glo-abr.) In addition, this option defines a shortcut command


\printabbreviations[options]

which is equivalent to

\printglossary[type=\glsxtrabbrvtype,options]
If glossaries-extra-bib2gls is also loaded then this option will additionally provide:


\printunsrtabbreviations[options]

which uses \printunsrtglossary.

The title of the new glossary is given by


\abbreviationsname

If this command is already defined, it’s left unchanged. Otherwise it’s defined to “Abbreviations” if babel hasn’t been loaded or \acronymname if babel has been loaded. However, if you’re using babel it’s likely you will need to change this. (See §15 Multi-Lingual Support for further details.)

If you don’t use the abbreviations package option, the \abbreviationsname command won’t be defined (unless it’s defined by an included language file).

If the abbreviations option is used and the acronym option provided by the glossaries package hasn’t been used, then \acronymtype will be set to \glsxtrabbrvtype so that acronyms defined with \newacronym can be added to the list of abbreviations. If you want acronyms in the main glossary and other abbreviations in the abbreviations glossary then you will need to redefine \acronymtype to main:

     \renewcommand*{\acronymtype}{main}

Note that there are no analogous options to the glossaries package’s acronymlists option (or associated commands) as the abbreviation mechanism is handled differently with glossaries-extra.

symbols
This is passed to glossaries but will additionally define


\glsxtrnewsymbol[options]{label}{symbol}

which is equivalent to

\newglossaryentry{label}{name={symbol},
 sort={label},type=symbols,category=symbol,options}
Note that the sort key is set to the ⟨label⟩ not the ⟨symbol⟩ as the symbol will likely contain commands.

If glossaries-extra-bib2gls is also loaded then this option will additionally provide:


\printunsrtsymbols[options]

which uses \printunsrtglossary.

numbers
This is passed to glossaries but will additionally define


\glsxtrnewnumber[options]{number}

which is equivalent to

\newglossaryentry{label}{name={number},
 sort={label},type=numbers,category=number,options}

If glossaries-extra-bib2gls is also loaded then this option will additionally provide:


\printunsrtnumbers[options]

which uses \printunsrtglossary.

acronyms (or acronym)
This is passed to glossaries but if glossaries-extra-bib2gls is also loaded then this option will additionally provide:


\printunsrtacronyms[options]

which uses \printunsrtglossary.

This option defines a new glossary with the label acronym not acronyms. You may find it easier to reference it with the command \acronymtype.

index
This is passed to glossaries but if glossaries-extra-bib2gls is also loaded then this option will additionally provide:


\printunsrtindex[options]

which uses \printunsrtglossary.

shortcuts
Unlike the glossaries package option of the same name, this option isn’t boolean but has multiple values:
  • shortcuts=acronyms (or shortcuts=acro): set the shortcuts provided by the glossaries package for acronyms (such as \ac). Note that the short and long forms don’t use \glsxtrshort and \glsxtrlong but use the original \acrshort and \acrlong, which don’t recognise multiple abbreviation styles. The better option with glossaries-extra is shortcuts=ac.
  • shortcuts=ac: set the shortcuts provided by the glossaries package for acronyms (such as \ac) but uses the glossaries-extra interface (such as \glsxtrshort rather than \acrshort). In this case \ac is defined as \cgls rather than \gls.
  • shortcuts=abbreviations (or shortcuts=abbr): set the abbreviation shortcuts provided by glossaries-extra. (See §4.3 Shortcut Commands.) These settings don’t switch on the acronym shortcuts provided by the glossaries package.
  • shortcuts=other: set the “other” shortcut commands, but not the shortcut commands for abbreviations or the acronym shortcuts provided by glossaries. The “other” shortcuts are:
    • \newentry equivalent to \newglossaryentry
    • \newsym equivalent to \glsxtrnewsymbol (see the symbols option).
    • \newnum equivalent to \glsxtrnewnumber (see the numbers option).
  • shortcuts=all (or shortcuts=true): implements shortcuts=ac, shortcuts=abbreviations and shortcuts=other.
  • shortcuts=none (or shortcuts=false): don’t define any of the shortcut commands (default).

Note that multiple invocations of the shortcuts option within the same option list will override each other.

After the glossaries-extra package has been loaded, you can set available options using


\glossariesextrasetup{options}

The abbreviations and docdef options may only be used in the preamble. Additionally, docdef can’t be used after \makenoidxglossaries.

Top

2. Modifications to Existing Commands and Styles

Top

2.1 Defining Entries

The glossaries package provides \nopostdesc which may be used in the description to suppress the post-description hook. The glossaries-extra package provides another command


\glsxtrnopostpunc

which has a similar function but only suppresses the post-description punctuation. It doesn’t suppress the use of \glsxtrpostdescription which allows the use of category-dependent post-description hooks. (Note that the punctuation, which is in the original base hook \glspostdescription, comes after the extended post-description hook \glsxtrpostdescription not before.) The post-description hook can counter-act the effect of \glsxtrnopostpunc using


\glsxtrrestorepostpunc

These commands have no effect outside of the glossary (except with standalone entries that use \glsxtractivatenopost and \glspostdescription, see §11.4 Standalone Entry Items).

The commands used by glossaries to automatically produce an error if an entry is undefined (such as \glsdoifexists) are changed to take the undefaction option into account.

The \newglossaryentry command has three new keys:

This apply to all entry defining commands (such as \newabbreviation).

The test file example-glossaries-xr.tex contains dummy entries with a mixture of see, alias and seealso keys for use with minimal working examples. There are also example-glossaries-*.bib files that correspond to each example-glossaries-*.tex file for testing bib2gls.

The \longnewglossaryentry command now has a starred version (as from v1.12) that doesn’t automatically insert

\leavevmode\unskip\nopostdesc

at the end of the description field.


\longnewglossaryentry*{label}{options}{description}

The descriptionplural key is left unset unless explicitly set in ⟨options⟩.

The unstarred version no longer hard-codes the above code (which removes trailing space and suppresses the post-description hook) but instead uses:


\glsxtrpostlongdescription

This can be redefined to allow the post-description hook to work but retain the \unskip part if required. For example:

\renewcommand*{\glsxtrpostlongdescription}{\leavevmode\unskip}

This will discarded unwanted trailing space at the end of the description but won’t suppress the post-description hook.

The unstarred version also alters the base glossaries package’s treatment of the descriptionplural key. Since a plural description doesn’t make much sense for multi-paragraph descriptions, the default behaviour with glossaries-extra’s \longnewglossaryentry is to simply leave the plural description unset unless explicitly set using the descriptionplural key. The glossaries.sty version of this command sets the description’s plural form to the same as the singular.2.1

Note that this modified unstarred version doesn’t append \glsxtrpostlongdescription to the description’s plural form.

The \newterm command (defined through the index package option) is modified so that the category defaults to index. The \newacronym command is modified to use the new abbreviation interface provided by glossaries-extra. (See §4 Abbreviations.)

The \makeglossaries command now has an optional argument.


\makeglossaries[list]

If ⟨list⟩ is empty, \makeglossaries behaves as per its original definition in the glossaries package, otherwise ⟨list⟩ can be a comma-separated list of glossaries that need processing with an external indexing application.

This command is not permitted with the record=only package option. Without the optional argument, it’s required with record=hybrid. With the optional argument, it’s only permitted with the default record=off.

It should then be possible to use \printglossary for those glossaries listed in ⟨list⟩ and \printnoidxglossary for the other glossaries. (See the accompanying file sample-mixedsort.tex for an example.)

If you use the optional argument ⟨list⟩, you can’t define entries in the document (even with the docdef option).

You will need at least version 2.20 of makeglossaries or at least version 1.3 of the Lua alternative makeglossaries-lite (both distributed with glossaries v4.27) to allow for this use of \makeglossaries[list]. Alternatively, use the automake option.

Top

2.2 Entry Indexing

As from version 1.31, there is a new command like \glsadd where the mandatory argument is a comma-separated list of labels:


\glsaddeach[options]{list}

This simply iterates over ⟨list⟩ and does \glsadd[options]{label} for each entry in the list.

As from version 1.37, you can make commands like \gls or \glslink automatically use \glsadd with specific options when a given format is used (identified with format={format} in the optional argument of the corresponding \gls, \glslink etc).


\GlsXtrAutoAddOnFormat[label]{format list}{glsadd options}

The optional argument ⟨label⟩ defaults to \glslabel and indicates the label to use in \glsadd and so needs to be expandable. The ⟨format list⟩ is a comma-separated list of format values that will trigger the automated adding. The ⟨glsadd options⟩ are the options to pass to \glsadd with format={format} prepended to the list.

For example, with:

\GlsXtrAutoAddOnFormat{hyperbf}{counter=chapter}

then \gls[format=hyperbf]{sample} will be equivalent to

\glsadd[format=hyperbf,counter=chapter]{sample}\gls[format=hyperbf]{sample}

Note that the explicit range markers will prevent a match unless you include them in ⟨format list⟩ (in which case, be sure to add both the start and end formats).

Here’s another example:

\GlsXtrAutoAddOnFormat[dual.\glslabel]{hyperbf}{}

In this case \gls[format=hyperbf]{sample} will now be equivalent to:

\glsadd[format=hyperbf]{dual.sample}\gls[format=hyperbf]{sample}

\GlsXtrAutoAddOnFormat is not applied to \glsadd as it could cause an infinite loop.

The glossaries-extra package provides extra keys for commands like \gls and \glstext:

noindex
This is a boolean key. If true, this suppresses the indexing. (That is, it prevents \gls or whatever from adding a line to the external glossary file.) This is more useful than the indexonlyfirst package option provided by glossaries, as the first use might not be the most pertinent use. (If you want to apply indexonlyfirst to selected entries, rather than all of them, you can use the indexonlyfirst attribute, see §7 Categories for further details.) Note that the noindex key isn’t available for \glsadd (and \glsaddall) since the whole purpose of that command is to index an entry.
wrgloss
(New to v1.14.) This is may only take the values before or after. By default, commands that both index and display link text (such as \gls, \glstext and \glslink), perform the indexing before the link text as the indexing creates a whatsit that can cause problems if it occurs after the link text. However, it may be that in some cases (such as long phrases) you may actually want the indexing performed after the link text. In this case you can use wrgloss=after for specific instances. Note that this option doesn’t have an effect if the indexing has been suppressed through other settings (such as noindex).

The default value is set up using


\glsxtrinitwrgloss

which is defined as:

     \newcommand*{\glsxtrinitwrgloss}{%
      \glsifattribute{\glslabel}{wrgloss}{after}%
      {%
        \glsxtrinitwrglossbeforefalse
      }%
      {%
        \glsxtrinitwrglossbeforetrue
      }%
     }

This sets the conditional


\ifglsxtrinitwrgloss

which is used to determine where to perform the indexing.

This means you can set the wrgloss attribute to after to automatically use this as the default for entries with that category attribute. (Note that adding wrgloss to the default options in \GlsXtrSetDefaultGlsOpts will override \glsxtrinitwrgloss.)

hyperoutside
(New to v1.21.) This is a boolean key. The default is hyperoutside=true, which puts the hyperlink outside \glstextformat, so that commands like \gls will effectively do
\hyperlink{target}{\glstextformat{link text}}
This is the same behaviour as with the base glossaries package. With hyperoutside=false, \hyperlink is placed inside the argument of \glstextformat:
\glstextformat{\hyperlink{target}{link text}}
You can use the hyperoutside category attribute to set the default for a given category. This can be combined with the use of the textformat attribute to counteract any interference caused by \hyperlink. For example:
     \glssetcategoryattribute{mathrelation}{hyperoutside}{false}

will set hyperoutside=false for all entries that are assigned to the category mathrelation and

     \glssetcategoryattribute{mathrelation}{textformat}{mathrel}

will use \mathrel instead of \glstextformat resulting in:

\mathrel{\hyperlink{target}{link text}}
for entries with the category key set to mathrelation.
textformat
This key must have a control sequence name as its value. The command formed from this name must exist and must take one argument. (Use relax for default behaviour.) If set, this overrides the textformat attribute and \glstextformat. See the soul example in §2.6 First Use Flag.
prefix
Locally redefines \glolinkprefix to the given value. It should match the prefix for the desired glossary.
thevalue
Explicitly set the location to this value (see below).
theHvalue
Set the corresponding hyperlink location (see below).

You can set the default options used by \glslink, \gls etc with:


\GlsXtrSetDefaultGlsOpts{options}

For example, if you mostly don’t want to index entries then you can do:

\GlsXtrSetDefaultGlsOpts{noindex}

and then use, for example, \gls[noindex=false]{sample} when you actually want the location added to the number list. These defaults may be overridden by other settings (such as category attributes) in addition to any settings passed in the option argument of commands like \glslink and \gls.

Note that if you don’t want any indexing, just omit \makeglossaries and \printglossaries (or analogous commands). If you want to adjust the default for wrgloss, it’s better to do this by redefining \glsxtrinitwrgloss instead.

\GlsXtrSetDefaultGlsOpts doesn’t affect \glsadd.

If you want to change the default value of format, you can instead use:


\GlsXtrSetDefaultNumberFormat{format}

This has the advantage of also working for \glsadd. For example, if you want all locations in the back matter to appear in italic (unless explicitly overridden):

\backmatter
\GlsXtrSetDefaultNumberFormat{hyperit}

Commands like \gls have star (*) and plus (+) modifiers as a short cut for hyper=false and hyper=true. The glossaries-extra package provides a way to add a third modifier, if required, using


\GlsXtrSetAltModifier{char}{options}

where ⟨char⟩ is the character used as the modifier and ⟨options⟩ is the default set of options (which may be overridden). Note that ⟨char⟩ must be a single character (not a UTF-8 character, unless you are using XƎLATEX or LuaLATEX).

When choosing the character ⟨char⟩ take care of any changes in category code.

Example:

\GlsXtrSetAltModifier{!}{noindex}

This means that \gls!{sample} will be equivalent to \gls[noindex]{sample}. It’s not possible to mix modifiers. For example, if you want to do

\gls[noindex,hyper=false]{sample}

you can use \gls*[noindex]{sample} or \gls![hyper=false]{sample} but you can’t combine the * and ! modifiers.

There is a new hook that’s used each time indexing information is written to the external glossary files:


\glsxtrdowrglossaryhook{label}

where ⟨label⟩ is the entry’s label. This does nothing by default but may be redefined. (See, for example, the accompanying sample file sample-indexhook.tex, which uses this hook to determine which entries haven’t been indexed.)

There’s also a new hook (from v1.26) that’s used immediately before the options are set by the \gls-like and \glstext-like commands:


\glslinkpresetkeys

(The base package provides \glslinkpostsetkeys that’s used immediately after the options are set.)

As from version 1.30 there are also similar hooks for \glsadd:


\glsaddpresetkeys

and


\glsaddpostsetkeys

For example, to default to using the equation counter in maths mode:

\renewcommand{\glslinkpresetkeys}{%
 \ifmmode \setkeys{glslink}{counter=equation}\fi}
\renewcommand{\glsaddpresetkeys}{%
 \ifmmode \setkeys{glossadd}{counter=equation}\fi}

In this case, the counter can be overridden with an explicit use of counter in the optional argument of \gls or \glsadd. (As from version 1.37, a simpler method is to just use the equations package option.)

Alternatively, to enforce this (overriding the option argument):

\renewcommand{\glslinkpostsetkeys}{%
 \ifmmode \setkeys{glslink}{counter=equation}\fi}
\renewcommand{\glsaddpostsetkeys}{%
 \ifmmode \setkeys{glossadd}{counter=equation}\fi}

As from version 1.14, there are two new keys for \glsadd: thevalue and theHvalue. These keys are designed for manually adding explicit locations rather than obtaining the value from the associated counter. As from version 1.19, these two keys are also available for commands like \gls and \glslink. The thevalue keys is intended primarily for adding locations in supplementary material that can’t be obtained from a counter.

The principle key thevalue is for the location value. The other key theHvalue can be used to extract a prefix value for the first argument of commands like \glsnoidxdisplayloc. Its value must be in the format ⟨prefix⟩⟨location⟩. In general, there’s little need for this key as the prefix is typically associated with a counter that can be used to form hypertargets.

If you use thevalue, you must make sure that you use an indexing application that will accept the given value.

For example, makeindex will only accept locations in the form [⟨num⟩⟨sep⟩]*⟨num⟩ where ⟨num⟩ is an arabic number (0, 1, …), roman numeral (i, ii, … or I, II, …) or a character from a, …, z or A, …, Z, and [⟨num⟩⟨sep⟩]* indicates zero or more instances of a number followed by the recognised separator character (set with \glsSetCompositor). This means that makeindex won’t accept, for example,

\glsadd[thevalue={Supplementary Material}]{sample}

This location value will be accepted by bib2gls, since it will allow any location and will only try forming ranges if the location matches any of its numerical patterns. In the case of xindy, you’ll need to add a rule that can match the value. If you’re using hyperref, you may need to use the format key to prevent a hyperlink if one can’t naturally be formed from the prefix, counter and location value.

For example, suppose the file suppl.tex contains:

\documentclass{article}
\usepackage{glossaries-extra}
\newglossaryentry{sample}{name={sample},description={an example}}
\renewcommand{\thepage}{S.\arabic{page}}
\begin{document}
First page.
\newpage
\gls{sample}.
\end{document}

This has an entry on page S.2. Suppose another document wants to include this location in the glossary. Then this can be done by setting thevalue to S.2. For example:

\documentclass{article}
\usepackage{glossaries-extra}
\makeglossaries
\newglossaryentry{sample}{name={sample},description={an example}}
\begin{document}
Some \gls{sample} text.
\printglossaries
\glsadd[thevalue={S.2}]{sample}
\end{document}

This location value will be accepted by makeindex as it’s in the form ⟨num⟩⟨sep⟩⟨num⟩.

If you want hyperlinks, things are more complicated. First you need to set the externallocation attribute to the location of the PDF file. For example:

\glssetcategoryattribute{supplemental}{externallocation}{suppl.pdf}
\newglossaryentry{sample}{category=supplemental,
 name={sample},description={an example}}

Next you need to add glsxtrsupphypernumber as the format:

\glsadd[thevalue={S.2},format=glsxtrsupphypernumber]{sample}

Both documents will need to use the hyperref package. Remember that the counter used for the location also needs to match. If \theHcounter⟩ is defined in the other document and doesn’t match in the referencing document, then you need to use theHvalue to set the appropriate value. See the accompanying sample files sample-suppl-hyp.tex and sample-suppl-main-hyp.tex for an example that uses hyperref.

The hyperlink for the supplementary location may or may not take you to the relevant place in the external PDF file depending on your PDF viewer. Some may not support external links, and some may take you to the first page or last visited page.

For example, if both sample-suppl-hyp.pdf and sample-suppl-main-hyp.pdf are in the same directory, then viewing sample-suppl-main-hyp.pdf in Evince will take you to the correct location in the linked document (when you click on the S.2 external link), but Okular will take you to the top of the first page of the linked document.

This method can only be used where there is one external source for the designated category (identified by the externallocation attribute). For multiple sources, you need to use bib2gls version 1.7+, which is the better method in general as it can automatically fetch the relevant locations from the .aux files of the designated external documents without the need to explicitly use \glsadd.

Top

2.3 Cross-References (“see” and “see also”)

The value of the see key is now saved as a field. This isn’t the case with glossaries, where the see value is simply used to directly write a line to the corresponding glossary file and is then discarded. This is why the see key can’t be used before \makeglossaries (since the file hasn’t been opened yet).

This modification allows glossaries-extra to provide


\glsxtraddallcrossrefs

which is used at the end of the document to automatically add any unused cross-references unless the package option indexcrossrefs was set to false.

Note that even though the see key will now work for entries defined in the document environment, it’s still best to define entries in the preamble, and the see key still can’t perform any indexing before the file has been opened by \makeglossaries. Note that glossaries v4.24 introduced the seenoindex package option, which can be used to suppress the error when the see key is used before \makeglossaries, so seenoindex=ignore will allow the see value to be stored even though it may not be possible to index it at that point.

As from version 1.06, you can display the cross-referenced information for a given entry using


\glsxtrusesee{label}

This internally uses


\glsxtruseseeformat{tag}{xr list}

where ⟨tag⟩ and ⟨xr list⟩ are obtained from the value of the entry’s see field (if non-empty). By default, this just does \glsseeformat[tag]{xr list}{}, which is how the cross-reference is displayed in the number list. Note that \glsxtrusesee does nothing if the see field hasn’t been set for the entry given by ⟨label⟩.

As with the base glossaries package, \glsseeformat is defined to do \emph{tag} \glsseelist{xr list}. The third argument is always ignored and is present for makeindex, which always requires a final argument to encapsulate the associated location. The command


\glsseelist{xr list}

used to iterate over the list of cross-reference labels is also unchanged from the base glossaries package, with each item in the list formatted according to:


\glsseeitem{label}

This is defined by the glossaries package to:

\glshyperlink[\glsseeitemformat{label}]{label}
So the actual formatting for each cross-referenced entry is performed by \glsseeitemformat, which is redefined by glossaries-extra, as described in §2 Modifications to Existing Commands and Styles. This now displays the value of the text field for abbreviations and the value of the name field otherwise. There’s no indication of the entry hierarchy, which could confuse the reader. Therefore, as from glossaries-extra v1.37, there are some new commands that include the hierarchical information. You may prefer to redefine \glsseeitemformat to use one of this if you have sub-entries. For example:
\renewcommand*{\glsseeitemformat}[1]{\glsxtrhiername{#1}}

The glossaries package provides


\glsseeitemformat{label}

to format items in a cross-reference list (identified with the see key or \glssee). This was originally defined to use \glsentryname{label} since it makes more sense for the cross-reference to match the way the term appears in the glossary. Unfortunately this caused a problem when the name field was sanitized, which used to be the default setting, so glossaries v3.0 changed the default definition of this command to use \glsentrytext instead. Since the name and text field are quite often the same, this change usually doesn’t have a noticeable effect. However, now that the name field is no longer sanitized (following the redesign of glossaries v4.0) it makes more sense to restore this command to its original behaviour, but to take account of abbreviations glossaries-extra redefines this as:

\renewcommand*{\glsseeitemformat}[1]{%
 \ifglshasshort{\glslabel}{\glsfmttext{#1}}{\glsfmtname{#1}}%
}

(Note that as from glossaries-extra version 1.42, this now uses \glsfmttext and \glsfmtname instead of just referencing the text and name fields. This helps to ensure that any formatting is correctly applied.)

If you want to restore the glossaries v3.0+ definition just do:

\renewcommand*{\glsseeitemformat}[1]{\glsentrytext{#1}}

The glossaries-extra package provides \glsxtrhiername and its case-changing variants that may be used within the definition of \glsseeitemformat if required. These display the hierarchy for sub-entries rather than just the name, which may be more helpful in cross-references.


\glsxtrhiername{label}

performs a recursive action:

  1. If the entry given by ⟨label⟩ has a parent, then \glsxtrhiername{parent label} is done followed by \glsxtrhiernamesep then:
  2. If the entry given by ⟨label⟩ is an abbreviation (that is, it has the short field set) then the short form is displayed (using \glsfmtshort) otherwise the name is displayed (using \glsfmtname).

The first step above is skipped if the entry doesn’t have a parent. Each level is separated by:


\glsxtrhiernamesep

which defaults to “ ”. This can be redefined as appropriate.

There are some case-changing variants:


\Glsxtrhiername{label}

The top-level has the first letter changed to upper case (either \Glsfmtshort or \Glsfmtname). There’s no case-change for sub-entries.


\GlsXtrhiername{label}

All levels have the first letter changed to upper case (either \Glsfmtshort or \Glsfmtname).


\GLSxtrhiername{label}

The top-level is converted to upper case (either \GLSfmtshort or \GLSfmtname). There’s no case-change for sub-entries.


\GLSXTRhiername{label}

All levels are converted to upper case (either \GLSfmtshort or \GLSfmtname).

Suppose you want to suppress the number list using nonumberlist. This will automatically prevent the cross-references from being displayed. The seeautonumberlist package option will automatically enable the number list for entries that have the see key set, but this will also show the rest of the number list.

Another approach in this situation is to use the post description hook with \glsxtrusesee to append the cross-reference after the description. For example:

\renewcommand*{\glsxtrpostdescgeneral}{%
 \ifglshasfield{see}{\glscurrententrylabel}
 {, \glsxtrusesee{\glscurrententrylabel}}%
 {}%
}

Now the cross-references can appear even though the number list has been suppressed.

As from v1.16, there’s a separate seealso key. Unlike see, this doesn’t have an optional part for the textual tag. The syntax seealso={xr-labels} works in much the same way as using see=[\seealsoname]{xr-labels} but the information is stored in a separate field. If you need a different tag, use the see key instead (or redefine \seealsoname or \glsxtruseseealsoformat, described below).

You can display the formatted list of cross-references stored in the seealso key using:


\glsxtruseseealso{label}

This works in much the same way as \glsxtrusesee but it internally uses


\glsxtruseseealsoformat{xr list}

For example:

\renewcommand*{\glsxtrpostdescgeneral}{%
 \ifglshasfield{see}{\glscurrententrylabel}
 {, \glsxtrusesee{\glscurrententrylabel}}%
 {}%
 \ifglshasfield{seealso}{\glscurrententrylabel}
 { (\glsxtruseseealso{\glscurrententrylabel})}%
 {}%
}

The alias key only contains a single label not a list, but if you want to ensure consistent formatting with \glsxtrusesee and \glsxtruseseealso you can use (from v1.42):


\glsxtrusealias{label}

The actual unformatted comma-separated list ⟨xr-list⟩ stored in the seealso field can be accessed with:


\glsxtrseealsolabels{label}

This will just expand to the ⟨xr-labels⟩ provided in the value of the seealso key. There’s no corresponding command to access the see field. If you really need to access it, you can use commands like \glsxtrfielduse, but remember that it may start with [tag], so it can’t be automatically treated as a simple comma-separated list.

As mentioned above, the base glossaries package provides \glsseelist, which requires a comma-separated list of labels as the argument. The argument isn’t fully expanded, so it’s not suitable to use, for example, \glsxtrseealsolabels{label} as the argument. For convenience, glossaries-extra provides


\glsxtrseelist{xr list}

which fully expands its argument and passes it to \glsseelist.

As from v1.47, glossaries-extra redefines \glsseelist to make it more flexible. The base package provides \glsseeitem{label} which is used to format each element in the list and \glsseelastsep for the separator between the final two items (\glsseesep is used between the other items). The modifications provide two additional commands:


\glsseefirstitem{label}

This defaults to \glsseeitem{label} and is used to format the first label in the list.


\glsseelastoxfordsep

This defaults to \glsseelastsep and is used if the list consists of three or more labels.

The seealso key implements the automatic indexing using


\glsxtrindexseealso{label}{xr list}

which just does

\glssee[\seealsoname]{label}{xr list}
unless the xindy option is used with glossaries v4.30+, in which case a distinct seealso cross-reference class is used instead.

The command that produces this “see also” text is


\seealsoname

If \alsoname (provided by language packages) is defined then \seealsoname will simply be defined to \alsoname otherwise it will be defined to see also.

The language-sensitive \alsoname is used by general indexing packages, such as makeidx, so if you redefine \alsoname the change will apply to normal indexes as well as glossaries. If you only want to change the text produced by the seealso key without affecting general indexing (with \index) then redefine \seealsoname instead.

Top

2.4 Entry Display Style Modifications

Recall from the glossaries package that commands such as \gls display text at that point in the document (optionally with a hyperlink to the relevant line in the glossary). This text is referred to as the “link-text” regardless of whether or not it actually has a hyperlink. The actual text and the way it’s displayed depends on the command used (such as \gls) and the entry format.

The default entry format (\glsentryfmt) used in the link-text by commands like \gls, \glsxtrfull, \glsxtrshort and \glsxtrlong (but not commands like \glslink, \glsfirst and \glstext) is changed by glossaries-extra to test for regular entries, which are determined as follows:

This means that entries with a short form can be treated as regular entries rather than abbreviations if it’s more appropriate for the desired style.

As from version 1.04, \glsentryfmt now puts \glsgenentry in the argument of the new command


\glsxtrregularfont{text}

This just does its argument ⟨text⟩ by default. This means that if you want regular entries in a different font but don’t want that font to apply to abbreviations, then you can redefine \glsxtrregularfont. This is more precise than changing \glstextformat which is applied to all linking commands for all entries, unless overridden by the textformat attribute.

For example:

\renewcommand*{\glsxtrregularfont}[1]{\textsf{#1}}

You can access the label through \glslabel. For example, you can query the category:

\renewcommand*{\glsxtrregularfont}[1]{%
 \glsifcategory{\glslabel}{general}{\textsf{#1}}{#1}}

or query the category attribute, for example, provide a custom attribute called font:

\glssetcategoryattribute{general}{font}{sf}
\renewcommand*{\glsxtrregularfont}[1]{%
 \glsifattribute{\glslabel}{font}{sf}{\textsf{#1}}{#1}}

As from version 1.21, it’s simpler to just do, for example:

\glssetcategoryattribute{general}{textformat}{textsf}

without redefining \glsxtrregularfont.

As from version 1.30, there is also a command for abbreviations that encapsulates \glsxtrgenabbrvfmt:


\glsxtrabbreviationfont{text}

This also just does its argument by default. Font changes made by abbreviation styles are within ⟨text⟩.

The \glspostlinkhook provided by the glossaries package to insert information after the link-text produced by commands like \gls and \glstext is redefined to


\glsxtrpostlinkhook

This command will discard a following full stop (period) if the discardperiod attribute is set to “true” for the current entry’s category. It will also do


\glsxtrpostlink

if a full stop hasn’t be discarded and


\glsxtrpostlinkendsentence

if a full stop has been discarded.

It may be that you want to check some other setting (rather than a category attribute) to determine whether or not to discard a following full stop. In which case you can redefine:


\glsxtrifcustomdiscardperiod{true}{false}

You can access the field’s label using \glslabel. This command should do ⟨true⟩ if the post-link hook should check if a period follows and ⟨false⟩ otherwise. The default definition is simply:

\newcommand*{\glsxtrifcustomdiscardperiod}[2]{#2}

which means that no additional checks are performed. (Only the recognised category attributes will be checked.)

Avoid the use of \gls-like and \glstext-like commands within the post-link hook as they will cause interference. Consider using commands like \glsentrytext, \glsaccesstext or \glsxtrp (§2.8 Nested Links) instead.

By default \glsxtrpostlink just does \glsxtrpostlinkcategory if it exists, where ⟨category⟩ is the category label for the current entry. (For example, for the general category, \glsxtrpostlinkgeneral if it has been defined.)

You can define the post-link hook command using \newcommand, for example:

\newcommand*{\glsxtrpostlinkgeneral}{%
 \glsxtrpostlinkAddDescOnFirstUse
}

or, as from v1.31, you can use


\glsdefpostlink{category}{definition}

This is simply a shortcut for:

\csdef{glsxtrpostlinkcategory}{definition}
Note that it doesn’t check if the command has already been defined.

The sentence-ending hook is slightly more complicated. If the command \glsxtrpostlinkcategory is defined the hook will do that and then insert a full stop with the space factor adjusted to match the end of sentence. If \glsxtrpostlinkcategory hasn’t been defined, the space factor is adjusted to match the end of sentence. This means that if you have, for example, an entry that ends with a full stop, a redundant following full stop will be discarded and the space factor adjusted (in case the entry is in uppercase) unless the entry is followed by additional material, in which case the following full stop is no longer redundant and needs to be reinserted.

There are some convenient commands you might want to use when customizing the post-link-text category hooks:


\glsxtrpostlinkAddDescOnFirstUse

This will add the description in parentheses on first use.

For example, suppose you want to append the description in parentheses on first use for entries in the symbol category:

\newcommand*{\glsxtrpostlinksymbol}{%
  \glsxtrpostlinkAddDescOnFirstUse
}


\glsxtrpostlinkAddSymbolOnFirstUse

This will append the symbol (if defined) in parentheses on first use. (Does nothing if the symbol hasn’t been set.)


\glsxtrpostlinkAddSymbolDescOnFirstUse

(New to v1.31.) On first use, this will append \space(⟨symbol⟩, ⟨description⟩) if the symbol is defined otherwise it just appends \space(⟨description⟩).

If you want to provide your own custom format be aware that you can’t use \ifglsused within the post-link-text hook as by this point the first use flag will have been unset. Instead you can use


\glsxtrifwasfirstuse{true}{false}

This will do ⟨true⟩ if the last used entry was the first use for that entry, otherwise it will do ⟨false⟩. (Requires at least glossaries v4.19 to work properly.) This command is locally set by commands like \gls, so don’t rely on it outside of the post-link-text hook.

Note that commands like \glsfirst and \glsxtrfull fake first use for the benefit of the post-link-text hooks by setting \glsxtrifwasfirstuse to \@firstoftwo. (Although, depending on the styles in use, they may not exactly match the text produced by \gls-like commands on first use.) However, the short-postfootnote style alters \glsxtrfull so that it fakes non-first use otherwise the inline full format would include the footnote, which is inappropriate.

For example, if you want to place the description in a footnote after the link-text on first use for the general category:

\newcommand*{\glsxtrpostlinkgeneral}{%
  \glsxtrifwasfirstuse{\footnote{\glsentrydesc{\glslabel}}}{}%
}

The short-postfootnote abbreviation style uses the post-link-text hook to place the footnote after trailing punctuation characters.

Top

2.5 Entry Counting Modifications

If you are using bib2gls you may find it more convenient to use the record count commands described in §10 bib2gls: Managing Reference Databases instead.

The \glsenableentrycount command is modified to allow for the entrycount attribute. This means that you not only need to enable entry counting with \glsenableentrycount, but you also need to set the appropriate attribute (see §7 Categories).

For example, instead of just doing:

\glsenableentrycount

you now need to do:

\glsenableentrycount
\glssetcategoryattribute{abbreviation}{entrycount}{1}

This will enable the entry counting for entries in the abbreviation category, but any entries assigned to other categories will be unchanged.

Further information about entry counting, including the new per-unit feature, is described in §8.1 Entry Counting (First Use Flag).

Top

2.6 First Use Flag

The glossaries package provides


\ifglsused{label}{true}{false}

to determine whether or not an entry has been used. This requires the entry to have been defined. If the entry is undefined, then the underlying boolean variable doesn’t exist and so is neither true nor false. This command will produce an error with the default undefaction=error mode and a warning with undefaction=warn and, where appropriate, displays ?? in the document text to denote an undefined reference. With both modes, neither ⟨true⟩ nor ⟨false⟩ will be performed if ⟨label⟩ doesn’t exist.

The record option automatically implements undefaction=warn since no entries will be defined until they have been selected by bib2gls. In this case, you may prefer to use:


\GlsXtrIfUnusedOrUndefined{label}{true}{false}

(new to v1.34) which does ⟨true⟩ if the entry given by ⟨label⟩ is undefined or if the entry is marked as unused. Remember that neither \ifglsused nor \GlsXtrIfUnusedOrUndefined should be used in the post-link hook as the first use flag will have already been unset before the hook is performed. (Instead, \glsxtrifwasfirstuse should be used, see §2.4 Entry Display Style Modifications.)

There are two new commands provided with version 1.31+:


\glslocalreseteach{list}

and


\glslocalunseteach{list}

These behave like \glslocalreset and \glslocalunset but the argument is a comma-separated list of labels.

The internal command used by \glsunset is modified first to allow for the changing in entry counting, described above, but also to allow for buffering pending unsets when commands like \gls are used in a context where changing a boolean variable can cause things to go wrong. One example of this is using \gls in one of the commands provided with the package. For example:

\ul{Some text about \gls{html}.}

This causes the confusing error:

Glossary entry `{html}' has not been defined.

The simplest workaround is to put \gls{html} inside the argument of \mbox. For example:

\ul{Some text about \mbox{\gls{html}}.}

This can work provided it’s not the first use of this entry. It if is, then unsetting the first use flag causes a problem and results in the error:

! Package soul Error: Reconstruction failed.

The glossaries-extra package provides a way of temporarily switching off \glsunset so that it just makes a note of the entry’s label but doesn’t actually perform the change:


\GlsXtrStartUnsetBuffering

The unstarred version doesn’t check for duplicates, so the internal list may end up with multiple occurrences of the same label. The starred version only adds a label to the internal list if it’s not already in it. Note that this buffering only applies to the global \glsunset and does not affect the local \glslocalunset.

Later you can restore \glsunset and unset all buffered labels using:


\GlsXtrStopUnsetBuffering

The starred form \GlsXtrStopUnsetBuffering* uses \glslocalunset instead. For example:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{soul}
\usepackage{glossaries-extra}
\newabbreviation{html}{HTML}{hypertext markup language}
\begin{document}
\GlsXtrStartUnsetBuffering
\ul{Some text about \mbox{\gls{html}}.}
\GlsXtrStopUnsetBuffering
Next use: \gls{html}.
\end{document}

Before you stop the unset buffering, you can iterate over the current buffer using


\GlsXtrForUnsetBufferedList{cs}

where ⟨cs⟩ is a control sequence that takes a single argument (which is the entry label). This is best used with the starred version \GlsXtrStartUnsetBuffering* to avoid duplicates.

You can discard the buffer and restore \glsunset to its normal behaviour with (new to v1.42):


\GlsXtrDiscardUnsetBuffering

Note that since the change in the first use flag now doesn’t occur until \GlsXtrStopUnsetBuffering, multiple references of the same term within the buffering zone will always be treated as first use (if the term wasn’t used before the buffering started).

There can still be a problem here as content within \mbox can’t break across a line so you may end up with an overfull line or excessive white space within the paragraph.

An alternative is to use \protect:

\GlsXtrStartUnsetBuffering
\ul{Some text about \protect\gls{html}.}
\GlsXtrStopUnsetBuffering

but the formatting (underlining in this example) won’t be applied. Another possibility is:

\usepackage[T1]{fontenc}
\usepackage{soul}
\usepackage{glossaries-extra}
\newabbreviation{html}{HTML}{hypertext markup language}
\newrobustcmd{\gul}[1]{%
  {%
   \def\glsxtrabbreviationfont##1{\GlsXtrExpandedFmt{\ul}{##1}}%
   \def\glsxtrregularfont##1{\GlsXtrExpandedFmt{\ul}{##1}}%
   #1%
  }%
}
\begin{document}
\ul{Some text about }\gls[textformat=gul]{html}.
Next use: \gls{html}.
\end{document}

This moves \gls outside of \ul and uses textformat to locally change the formatting command used by \gls (which is normally given by \glstextformat or the textformat attribute) to a custom command \gul, which locally changes the regular font and the default abbreviation font to use \ul. It then uses


\GlsXtrExpandedFmt{cs}{text}

which (protected) fully expands ⟨text⟩ before applying ⟨cs⟩, which must be a control sequence that takes a single argument. This allows \ul to move much further inside and increases its chances of working. It can still break if ⟨text⟩ expands to something that \ul can’t deal with. For example, if an abbreviation style is used that contains complex formatting or if the field value contains problematic content.

Top

2.7 Plurals

Some languages, such as English, have a general rule that plurals are formed from the singular with a suffix appended. This isn’t an absolute rule. There are plenty of exceptions (for example, geese, children, churches, elves, fairies, sheep). The glossaries package allows the plural key to be optional when defining entries. In some cases a plural may not make any sense (for example, the term is a symbol) and in some cases the plural may be identical to the singular.

To make life easier for languages where the majority of plurals can simply be formed by appending a suffix to the singular, the glossaries package lets the plural field default to the value of the text field with \glspluralsuffix appended. This command is defined to be just the letter “s”. This means that the majority of terms don’t need to have the plural supplied as well, and you only need to use it for the exceptions.

For languages that don’t have this general rule, the plural field will always need to be supplied, where needed.

There are other plural fields, such as firstplural, longplural and shortplural. Again, if you are using a language that doesn’t have a simple suffix rule, you’ll have to supply the plural forms if you need them (and if a plural makes sense in the context).

If these fields are omitted, the glossaries package follows these rules:

This last case is changed with glossaries-extra. With this extension package, the shortplural field defaults to the short field with \abbrvpluralsuffix appended unless overridden by category attributes. This suffix command is set by the abbreviation styles. This means that every time an abbreviation style is implemented, \abbrvpluralsuffix is redefined. In most cases its redefined to use


\glsxtrabbrvpluralsuffix

which defaults to just \glspluralsuffix. Some of the abbreviation styles have their own command for the plural suffix, such as \glsxtrscsuffix, so if you want to completely strip all the plural suffixes used for abbreviations then you need to redefine \glsxtrabbrvpluralsuffix not \abbrvpluralsuffix, which changes with the style. Redefining \acrpluralsuffix will have no affect, since it’s not used by the new abbreviation mechanism.

If you require a mixture (for example, in a multilingual document), there are two attributes that affect the short plural suffix formation. The first is aposplural which uses the suffix

'\abbrvpluralsuffix

That is, an apostrophe followed by \abbrvpluralsuffix is appended. The second attribute is noshortplural which suppresses the suffix and simply sets shortplural to the same as short.

Top

2.8 Nested Links

Complications arise when you use \gls in the value of the name field (or text or first fields, if set). This tends to occur with abbreviations that extend other abbreviations. For example, SHTML is an abbreviation for SSI enabled HTML, where SSI is an abbreviation for Server Side Includes and HTML is an abbreviation for Hypertext Markup Language.

Things can go wrong if we try the following with the glossaries package:

\newacronym{ssi}{SSI}{Server Side Includes}
\newacronym{html}{HTML}{Hypertext Markup Language}
\newacronym{shtml}{S\gls{html}}{\gls{ssi} enabled \gls{html}}

The main problems are:

  1. The first letter upper casing commands, such as \Gls, won’t work for the shtml entry on first use if the long form is displayed before the short form (which is the default abbreviation style). This will attempt to do
         \gls{\uppercase ssi} enabled \gls{html}
    

    which just doesn’t work. Grouping the \gls{ssi} doesn’t work either as this will effectively try to do

         \uppercase{\gls{ssi}} enabled \gls{html}
    

    This will upper case the label ssi so the entry won’t be recognised. This problem will also occur if you use the all capitals version, such as \GLS.

  2. The long and abbreviated forms accessed through \glsentrylong and \glsentryshort are no longer expandable and so can’t be used be used in contexts that require this, such as PDF bookmarks.
  3. The nested commands may end up in the sort key, which will confuse the indexing.
  4. The shtml entry produces inconsistent results depending on whether the ssi or html entries have been used. Suppose both ssi and html are used before shtml. For example:
         This section discusses \gls{ssi}, \gls{html} and \gls{shtml}.
    

    This produces:

    This section discusses server side includes (SSI), hypertext markup language (HTML) and SSI enabled HTML (SHTML).

    So the first use of the shtml entry produces “SSI enabled HTML (SHTML)”.

    Now let’s suppose the html entry is used before the shtml but the ssi entry is used after the shtml entry, for example:

         The sample files are either \gls{html} or \gls{shtml}, but let's
         first discuss \gls{ssi}.
    

    This produces:

    The sample files are either hypertext markup language (HTML) or server side includes (SSI) enabled HTML (SHTML), but let’s first discuss SSI.

    So the first use of the shtml entry now produces “server side includes (SSI) enabled HTML (SHTML)”, which looks a bit strange.

    Now let’s suppose the shtml entry is used before (or without) the other two entries:

         This article is an introduction to \gls{shtml}.
    

    This produces:

    This article is an introduction to server side includes (SSI) enabled hypertext markup language (HTML) (SHTML).

    So the first use of the shtml entry now produces “server side includes (SSI) enabled hypertext markup language (HTML) (SHTML)”, which is even more strange.

    This is all aggravated by setting the style using the glossaries package’s \setacronymstyle. For example:

         \setacronymstyle{long-short}
    

    as this references the label through the use of \glslabel when displaying the long and short forms, but this value changes with each use of \gls, so instead of displaying “(SHTML)” at the end of the first use, it now displays “(HTML)”, since \glslabel has been changed to html by \gls{html}.

    Another oddity occurs if you reset the html entry between uses of the shtml entry. For example:

         \gls{shtml} ... \glsreset{html}\gls{shtml}
    

    The next use of shtml produces “Shypertext markup language (HTML)”, which is downright weird.

    Even without this, the short form has nested formatting commands, which amount to \acronymfont{S\acronymfont{HTML}}. This may not be a problem for some styles, but if you use one of the “sm” styles (that use \textsmaller), this will produce an odd result.

  5. Each time the shtml entry is used, the html entry will also be indexed and marked as used, and on first use this will happen to both the ssi and html entries. This kind of duplication in the location list isn’t usually particularly helpful to the reader.
  6. If hyperref is in use, you’ll get nested hyperlinks and there’s no consistent way of dealing with this across the available PDF viewers. If on the first use case, the user clicks on the “HTML” part of the “SSI enabled HTML (SHTML)” link, they may be directed to the HTML entry in the glossary or they may be directed to the SHTML entry in the glossary.

For these reasons it’s better to use the simple expandable commands like \glsentrytext or \glsentryshort in the definition of other entries (although that doesn’t fix the first problem).

Alternatively use something like:

\newacronym
 [description={\acrshort{ssi} enabled \acrshort{html}}]
 {shtml}{SHTML}{SSI enabled HTML}

with glossaries or:

\newabbreviation
 [description={\glsxtrshort{ssi} enabled \glsxtrshort{html}}]
 {shtml}{SHTML}{SSI enabled HTML}

with glossaries-extra. This fixes all the above listed problems (as long as you don’t use \glsdesc). Note that replacing \gls with \acrshort in the original example may fix the first use issue, but it doesn’t fix any of the other problems listed above.

If it’s simply that you want to use the abbreviation font, you can use \glsabbrvfont:

\setabbreviationstyle{long-short-sc}
\newabbreviation{ssi}{ssi}{server-side includes}
\newabbreviation{html}{html}{hypertext markup language}
\newabbreviation{shtml}{shtml}{\glsabbrvfont{ssi} enabled
\glsabbrvfont{html}}

This will pick up the font style setting of the outer entry (shtml, in the above case). This isn’t a problem in the above example as all the abbreviations use the same style.

If the term can simply be treated as a series of previously defined entries, then consider using multi-entries (or compound sets). See §6 Multi (or Compound) Entries for further details.

However, if you’re really determined to use \gls in a field that may be included within some link-text, glossaries-extra patches internals used by the linking commands so that if \gls (or plural or case changing variants) occurs in the link-text it will behave as though you used \glstext[hyper=false,noindex] instead. Grouping is also added so that, for example, when \gls{shtml} is used for the first time the long form

\gls{ssi} enabled \gls{html}

is treated as

{\glstext[hyper=false,noindex]{ssi}} enabled
{\glstext[hyper=false,noindex]{html}}

This overcomes problems 4, 5 and 6 listed above, but still doesn’t fix problems 1 and 2. Problem 3 usually won’t be an issue as most abbreviation styles set the sort key to the short form, so using these commands in the long form but not the short form will only affect entries with a style that sorts according to the long form (such as long-noshort-desc).

Additionally, any instance of the long form commands, such as \glsxtrlong or \acrlong will be temporarily redefined to just use

{\glsentrylong{label}insert}
(or case-changing versions). Similarly the short form commands, such as \glsxtrshort or \acrshort will use \glsentryshort in the argument of either \glsabbrvfont (for \glsxtrshort) or \acronymfont (for \acrshort). So if the shtml entry had instead been defined as:
\newacronym{shtml}{SHTML}{\acrshort{ssi} enabled \acrshort{html}}

then (using the long-short style) the first use will be like

{\acronymfont{\glsentryshort{ssi}}} enabled
{\acronymfont{\glsentryshort{html}}} (SHTML)

whereas if the entry is defined as:

\newabbreviation{shtml}{SHTML}{\glsxtrshort{ssi} enabled
\glsxtrshort{html}}

then the first use will be like:

{\glsabbrvfont{\glsentryshort{ssi}}} enabled
{\glsabbrvfont{\glsentryshort{html}}} (SHTML)

Note that the first optional argument of \acrshort or \glsxtrshort is ignored in this context. (The final optional argument will be inserted, if present.) The abbreviation style that governs \glsabbrvfont will be set for \glsxtrshort. Note that \acrshort doesn’t set the abbreviation style.

Alternatively you can use:


\glsxtrp{field}{label}

where ⟨field⟩ is the field label and corresponds to a command in the form \glsfield⟩ (e.g. \glstext) or in the form \glsxtrfield⟩ (e.g. \glsxtrshort).

There’s a shortcut command for the most common fields:


\glsps{label}

which is equivalent to \glsxtrp{short}{label}, and


\glspt{label}

which is equivalent to \glsxtrp{text}{label}.

The \glsxtrp command behaves much like the \glsfmtfield⟩ commands described in §5 Entries in Sectioning Titles, Headers, Captions and Contents but the post-link hook is also suppressed and extra grouping is added. It automatically sets hyper to false and noindex to true. If you want to change this, you can use


\glsxtrsetpopts{options}

For example:

\glsxtrsetpopts{hyper=false}

will just switch off the hyperlinks but not the indexing. Be careful using this command or you can end up back to the original problem of nested links.

The hyper link is re-enabled within glossaries. This is done through the command:


\glossxtrsetpopts

which by default just does

\glsxtrsetpopts{noindex}

You can redefine this if you want to adjust the setting when \glsxtrp is used in the glossary. For example:

\renewcommand{\glossxtrsetpopts}{\glsxtrsetpopts{noindex=false}}

For example,

\glsxtrp{short}{ssi}

is equivalent to

{\let\glspostlinkhook\relax
 \glsxtrshort[hyper=false,noindex]{ssi}[]%
}

in the main body of the document or

{\let\glspostlinkhook\relax
 \glsxtrshort[noindex]{ssi}[]%
}

inside the glossary. (Note the post-link hook is locally disabled.)

If \glsxtrp{short}{ssi} occurs in a sectioning mark, it’s equivalent to

{\glsxtrheadshort{ssi}}

(which recognises the headuc attribute.)

If hyperref has been loaded, then the bookmark will use \glsentryfield⟩ (\glsentryshort{ssi} in the above example).

There are similar commands


\Glsxtrp{field}{label}

for first letter upper case and


\GLSxtrp{field}{label}

for all upper case.

If you use any of the case-changing commands, such as \Gls or \Glstext, (either all caps or first letter upper casing) don’t use any of the linking commands, such as \gls or \glstext, in the definition of entries for any of the fields that may be used by those case-changing commands.

You can, with care, protect against issue 1 by inserting an empty group at the start if the long form starts with a command that breaks the first letter uppercasing commands like \Gls, but you still won’t be able to use the all caps commands, such as \GLS.

If you really need nested commands, the safest method is

\newabbreviation{shtml}{shtml}{{}\glsxtrp{short}{ssi} enabled
\glsxtrp{short}{html}}

but be aware that it may have some unexpected results occasionally.

Example document:

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{slantsc}
\usepackage[colorlinks]{hyperref}
\usepackage[nopostdot=false]{glossaries-extra}
\makeglossaries
\setabbreviationstyle{long-short-sc}
\newabbreviation{ssi}{ssi}{server-side includes}
\newabbreviation{html}{html}{hypertext markup language}
\newabbreviation{shtml}{shtml}{{}\glsps{ssi} enabled {}\glsps{html}}
\pagestyle{headings}
\glssetcategoryattribute{abbreviation}{headuc}{true}
\glssetcategoryattribute{abbreviation}{glossdesc}{title}
\begin{document}
\tableofcontents
\chapter{\glsfmtfull{shtml}}
First use: \gls{shtml}, \gls{ssi} and \gls{html}.
Next use: \gls{shtml}, \gls{ssi} and \gls{html}.
\newpage
Next page.
\printglossaries
\end{document}

Top

2.9 Acronym Style Modifications

The glossaries-extra package provides a new way of dealing with abbreviations and redefines \newacronym to use \newabbreviation (see §4 Abbreviations). The simplest way to update a document that uses \newacronym from glossaries to glossaries-extra is do just add

\setabbreviationstyle[acronym]{long-short}

before you define any entries. If you have used commands like \acrshort, \acrlong and \acrfull, you need to substitute them with \glsxtrshort, \glsxtrlong and \glsxtrfull. (This includes plural and case-changing forms.) Your text editor’s search and replace function should help with this. If you have used the shortcuts package option then use shortcuts=ac in order to continue using the shortcut commands like \ac. With this setting, \acs will use \glsxtrshort instead of \acrshort etc.

For example, the following document using just glossaries

\documentclass{article}
\usepackage[acronym,nopostdot,toc]{glossaries}
\makeglossaries
\setacronymstyle{long-short}
\newacronym{html}{HTML}{hypertext markup language}
\begin{document}
\gls{html}
\printglossaries
\end{document}

can be easily adapted to use glossaries-extra:

\documentclass{article}
\usepackage[acronym]{glossaries-extra}
\makeglossaries
\setabbreviationstyle[acronym]{long-short}
\newacronym{html}{HTML}{hypertext markup language}
\begin{document}
\gls{html}
\printglossaries
\end{document}

Table 2.1 lists the nearest equivalent glossaries-extra abbreviation styles for the predefined acronym styles provided by glossaries, but note that the new styles use different formatting commands. See §4.4 Predefined Abbreviation Styles for further details.


Table 2.1: Old Acronym Styles \setacronymstyle{old-style-name} Verses New Abbreviation Styles \setabbreviationstyle[category]{new-style-name}

Old Style Name

New Style Name

long-sc-short

long-short-sc

long-sm-short

long-short-sm

long-sp-short

long-short
with \renewcommand{\glsxtrfullsep}[1]{\glsacspace{#1}}

short-long

short-long

sc-short-long

short-sc-long

sm-short-long

short-sm-long

long-short-desc

long-short-desc

long-sc-short-desc

long-short-sc-desc

long-sm-short-desc

long-short-sm-desc

long-sp-short-desc

long-short-desc
with \renewcommand{\glsxtrfullsep}[1]{\glsacspace{#1}}

short-long-desc

short-long-desc

sc-short-long-desc

short-sc-long-desc

sm-short-long-desc

short-sm-long-desc

dua

long-noshort

dua-desc

long-noshort-desc

footnote

short-footnote

footnote-sc

short-sc-footnote

footnote-sm

short-sm-footnote

footnote-desc

short-footnote-desc

footnote-sc-desc

short-sc-footnote-desc

footnote-sm-desc

short-sm-footnote-desc


The reason for introducing the new style of abbreviation commands provided by glossaries-extra is because the original acronym commands provided by glossaries are too restrictive to work with the internal modifications made by glossaries-extra. However, if you really want to restore the generic acronym function provided by glossaries you can use


\RestoreAcronyms

(before any use of \newacronym).

\RestoreAcronyms should not be used in combination with the newer glossaries-extra abbreviations. Don’t combine old and new style entries with the same type. The original glossaries acronym mechanism doesn’t work well with the newer glossaries-extra commands.

If you use \RestoreAcronyms, don’t use any of the commands provided by glossaries-extra intended for abbreviations (such as \glsxtrshort or \glsfmtshort) with entries defined via \newacronym as it will cause unexpected results.

In general, there’s rarely any need for \RestoreAcronyms. If you have a document that uses \newacronymstyle, then it’s best to either stick with just glossaries for that document or define an equivalent abbreviation style with \newabbreviationstyle. (See §4.5 Defining New Abbreviation Styles for further details.)


\glsacspace{label}

The space command \glsacspace used by the long-sp-short acronym style provided by glossaries is modified so that it uses


\glsacspacemax

instead of the hard-coded 3em. This is a command not a length and so can be changed using \renewcommand.

Any of the new abbreviation styles that use \glsxtrfullsep (such as long-short) can easily be changed to use \glsacspace with

\renewcommand*{\glsxtrfullsep}[1]{\glsacspace{#1}}

The first use acronym font command


\firstacronymfont{text}

is redefined to use the first use abbreviation font command \glsfirstabbrvfont. This will be reset if you use \RestoreAcronyms.

The subsequent use acronym font command


\acronymfont{text}

is redefined to use the subsequent use abbreviation font command \glsabbrvfont. This will be reset if you use \RestoreAcronyms.

Top

2.10 Glossaries

The \newignoredglossary{type} command now (as from v1.11) has a starred version that doesn’t automatically switch off the hyperlinks. This starred version may be used with the targeturl attribute to create a link to an external URL. (See §7 Categories for further details.) As from v1.12 both the starred and unstarred version check that the glossary doesn’t already exist. (The glossaries package omits this check.)

You can now provide an ignored glossary with:


\provideignoredglossary{type}

which will only define the glossary if it doesn’t already exist. This also has a starred version that doesn’t automatically switch off hyperlinks.

The individual glossary displaying commands \printglossary, \printnoidxglossary and \printunsrtglossary have extra keys:

Top

2.11 Glossary Style Modifications

The glossaries-extra-stylemods package (more conveniently loaded through the glossaries-extra stylemods option) modifies some of the predefined styles that are provided with the glossaries package. These modifications are described in more detail in §2.11.3 The glossaries-extra-stylemods Package.

The glossaries package tries to determine the group title from its label by first checking if \labelgroupname exists. If it doesn’t exist, then the title is assumed to be the same as the label. For example, when typesetting the “A” letter group, glossaries first checks if \Agroupname exists. This could potentially cause conflict with another package that may have some other meaning for \Agroupname, so glossaries-extra first checks for the existence of the internal command \glsxtr@grouptitle@label⟩ which shouldn’t clash with another package. You can set the group title using


\glsxtrsetgrouptitle{label}{title}

For example:

\glsxtrsetgrouptitle{A}{A (a)}

This uses a global assignment. If you need to scope the change you can use


\glsxtrlocalsetgrouptitle{label}{title}

Top

2.11.1 Style Hooks

The commands \glossentryname and \glossentrydesc are modified to take into account the glossname, glossnamefont, glossdesc and glossdescfont attributes (see §7 Categories). This means you can make simple font or case-changing modifications to the name and description without defining a new glossary style.

(New to version 1.42.) The command \glossentrysymbol is modified to take into account the glosssymbolfont attribute. Note that, unlike the above, there’s no corresponding attribute to change the case as it’s usually not appropriate to change the case of a symbol (and for some symbols, such as pictographs, there’s no concept of case). If \texorpdfstring has been defined \glossentrysymbol will be defined to do:

\texorpdfstring{TeX code}{PDF}
The ⟨TeX code⟩ part is robust and deals with the actual typesetting of the symbol. The ⟨PDF⟩ part is simply:


\glsentrypdfsymbol{label}

which is defined to just do \glsentrysymbol{label}. The chances are that the code in the symbol key won’t be valid in the PDF bookmarks, so you can redefine \glsentrypdfsymbol to use a more appropriate field. (If you do redefine this command, remember that it needs to fully expand.)

For example, if you are using glossaries-accsupp, you could use the symbolaccess field:

\renewcommand{\glsentrypdfsymbol}[1]{\glsentrysymbolaccess{#1}}

Alternatively, if you are using bib2gls you can use the TeX parser library to interpret a copy of the symbol field and use that. For example, with the resource options:

  replicate-fields={symbol=user1},
  interpret-fields={user1}

This stores the interpreted value of the symbol in the user1 field, so you can then do:

\renewcommand{\glsentrypdfsymbol}[1]{\glsentryuseri{#1}}

(You may need XƎLATEX or LuaLATEX with this method.) This allows \glossentrysymbol to be used in a section heading with standalone definitions.

If you want to adapt a style to use another field instead of name, you can use


\glossentrynameother{label}{field}

This behaves just like \glossentryname (that is, it obeys the glossname attribute, uses either the glossnamefont attribute or \glsnamefont to format the text, and uses the post-name hook) but it uses the given ⟨field⟩ instead of name. The ⟨field⟩ argument must be the internal field name (for example desc rather than description). See the key to field mappings table in the glossaries user manual.

There is a hook after \glossentryname and \Glossentryname:


\glsxtrpostnamehook{label}

By default this checks the indexname attribute. If the attribute exists for the category to which the label belongs, then the name is automatically indexed using


\glsxtrdoautoindexname{label}{indexname}

See §9 Auto-Indexing for further details.

As from version 1.04, the post-name hook \glsxtrpostnamehook will also use \glsxtrpostnamecategory⟩ if it exists. You can use \glscurrententrylabel to obtain the entry label with the definition of this command. For example, suppose you are using a glossary style the doesn’t display the symbol, you can insert the symbol after the name for a particular category, say, the “symbol” category:

\newcommand*{\glsxtrpostnamesymbol}{\space
 (\glsentrysymbol{\glscurrententrylabel})}

For convenience, as from v1.31, you can use


\glsdefpostname{category}{definition}

This is simply a shortcut for:

\csdef{glsxtrpostnamecategory}{definition}
Note that it doesn’t check if the command has already been defined.

As from version 1.25, the post-name hook also does


\glsextrapostnamehook{label}

(before \glsxtrpostnamecategory⟩) to allow for additional non-category related code. This does nothing by default.

The post-description code used within the glossary is modified so that it also does


\glsxtrpostdescription

This occurs before the original \glspostdescription, so if the nopostdot=false option is used, it will be inserted before the terminating full stop.

This new command will do \glsxtrpostdesccategory⟩ if it exists, where ⟨category⟩ is the category label associated with the current entry. For example \glsxtrpostdescgeneral for entries with the category set to general or \glsxtrpostdescacronym for entries with the category set to acronym. For convenience, as from v1.31, you can use


\glsdefpostdesc{category}{definition}

This is simply a shortcut for:

\csdef{glsxtrpostdesccategory}{definition}
Note that it doesn’t check if the command has already been defined.

Since both \glossentry and \subglossentry set


\glscurrententrylabel

to the label for the current entry, you can use this within the definition of these post-description hooks if you need to reference the label.

For example, suppose you want to insert the plural form in brackets after the description in the glossary, but only for entries in the general category, then you could do:

\renewcommand{\glsxtrpostdescgeneral}{\space
 (plural: \glsentryplural{\glscurrententrylabel})}

This means you don’t have to define a custom glossary style, which you may find more complicated. (It also allows more flexibility if you decide to change the underlying glossary style.)

This feature can’t be used for glossary styles that ignore \glspostdescription or if you redefine \glspostdescription without including \glsxtrpostdescription. (For example, if you redefine \glspostdescription to do nothing instead of using the nopostdot option to suppress the terminating full stop.) See §2.11.3 The glossaries-extra-stylemods Package to patch the predefined styles provided by glossaries that are missing \glspostdescription.

Top

2.11.2 Number List

The number list is now placed inside the argument of


\GlsXtrFormatLocationList{number list}

This is internally used by \glossaryentrynumbers. The nonumberlist option redefines \glossaryentrynumbers so that it doesn’t display the number list, but it still saves the number list in case it’s required.

If you want to suppress the number list always use the nonumberlist option instead of redefining \glossaryentrynumbers to do nothing.

For example, to change the font for the entire number list redefine \GlsXtrFormatLocationList as appropriate. Don’t modify \glossaryentrynumbers.

Sometimes users like to insert “page” or “pages” in front of the number list. This is quite fiddly to do with the base glossaries package, but glossaries-extra provides a way of doing this. First you need to enable this option and specify the text to display using:


\GlsXtrEnablePreLocationTag{page}{pages}

where ⟨page⟩ is the text to display if the number list only contains a single location and ⟨pages⟩ is the text to display otherwise. For example:

\GlsXtrEnablePreLocationTag{Page: }{Pages: }

An extra run is required when using this command.

Use glsignore not @gobble as the format if you want to suppress the page number (and only index the entry once).

See the accompanying sample file sample-pages.tex.

Note that bib2gls can be instructed to insert a prefix at the start of non-empty location lists, which can be used as an alternative to \GlsXtrEnablePreLocationTag.

Location lists displayed with \printnoidxglossary internally use


\glsnoidxdisplayloc{prefix}{counter}{format}{location}

This command is provided by glossaries, but is modified by glossaries-extra to check for the start and end range formation identifiers ( and ) which are discarded to obtain the actual control sequence name that forms the location formatting command.

If the range identifiers aren’t present, this just uses


\glsxtrdisplaysingleloc{format}{location}

otherwise it uses


\glsxtrdisplaystartloc{format}{location}

for the start of a range (where the identifier has been stripped from ⟨format⟩) or


\glsxtrdisplayendloc{format}{location}

for the end of a range (where the identifier has been stripped from ⟨format⟩).

By default the start range command saves the format in


\glsxtrlocrangefmt

and does
\glsxtrdisplaysingleloc{format}{location}
(If the format is empty, it will be replaced with glsnumberformat.)

The end command checks that the format matches the start of the range, does


\glsxtrdisplayendlochook{format}{location}

(which does nothing by default), followed by
\glsxtrdisplaysingleloc{format}{location}
and then sets \glsxtrlocrangefmt to empty.

This means that the list

\glsnoidxdisplayloc{}{page}{(textbf}{1},
\glsnoidxdisplayloc{}{page}{textbf}{1},
\glsnoidxdisplayloc{}{page}{)textbf}{1}.

doesn’t display any differently from

\glsnoidxdisplayloc{}{page}{textbf}{1},
\glsnoidxdisplayloc{}{page}{textbf}{1},
\glsnoidxdisplayloc{}{page}{textbf}{1}.

but it does make it easier to define your own custom list handler that can accommodate the ranges.

Top

2.11.3 The glossaries-extra-stylemods Package

As from v1.02, glossaries-extra now includes the package glossaries-extra-stylemods that will redefine the predefined styles to include the post-description hook (for those that are missing it). You will need to make sure the styles have already been defined before loading glossaries-extra. For example:

\usepackage{glossaries-extra}
\usepackage{glossary-longragged}
\usepackage{glossaries-extra-stylemods}

Alternatively you can load glossary-name.sty at the same time by passing ⟨name⟩ as a package option to glossaries-extra-stylemods. For example:

\usepackage{glossaries-extra}
\usepackage[longragged]{glossaries-extra-stylemods}

Another option is to use the stylemods key when you load glossaries-extra. You can omit a value if you only want to use the predefined styles that are automatically loaded by glossaries (for example, the long3col style):

\usepackage[style=long3col,stylemods]{glossaries-extra}

Or the value of stylemods may be a comma-separated list of the style package identifiers. For example:

\usepackage[style=mcoltree,stylemods=mcols]{glossaries-extra}

Remember to group the value if it contains any commas:

\usepackage[stylemods={mcols,longbooktabs}]{glossaries-extra}

Inline Style Note that the inline style is dealt with slightly differently. The original definition provided by the glossary-inline package uses \glspostdescription at the end of the glossary (not after each entry description) within the definition of \glspostinline. The style modification changes this so that \glspostinline just does a full stop followed by space factor adjustment, and the description \glsinlinedescformat and sub-entry description formats \glsinlinesubdescformat are redefined to include \glsxtrpostdescription (not \glspostdescription). This means that the modified inline style isn’t affected by the nopostdot option, but the post-description category hook can still be used.

Tabular Styles The tabular-like styles, such as long are adjusted so that the \ifglsnogroupskip conditional (set with nogroupskip) is moved outside of the definition of \glsgroupskip to avoid problems that cause an “Incomplete \iftrue” error with \printunsrtglossary and \printnoidxglossary. This means that if you want to change this conditional using \setupglossaries or using the nogroupskip option in \printglossary, \printnoidxglossary or \printunsrtglossary, you must also reset the glossary style.

As from version 1.21, the hard-coded \space before the number list in many of the predefined styles is replaced with


\glsxtrprelocation

This just defaults to \space but may be redefined as required. For example:

\renewcommand{\glsxtrprelocation}{\dotfill}

List Styles The list styles use


\glslistprelocation

(which defaults to \glsxtrprelocation) for top-level items and


\glslistchildprelocation

(which defaults to \glslistprelocation) for child items.

As from v1.31, the description (including the post-description hook) is governed by:


\glslistdesc{label}

for the list and altlist styles (but not the listdotted variations).

As from v1.47, the item is governed by:


\glslistitem{label}

The altlist styles use:


\glsaltlistitem{label}

which internally uses \glslistitem. The header item (for the list styles that should the group title) is governed by:


\glslistgroupheaderitem{group-label}{header code}

This ignores the ⟨group-label⟩ by default and simply places the second argument in the optional argument of \item. The ⟨header code⟩ is the formatted group title, possibly including a hypertarget. The spacing after the group item is given by:


\glslistgroupafterheader

For just the list style and its letter group variations (not the altlist or listdotted variations) the number list for child entries is followed by


\glslistchildpostlocation

which defaults to a full stop.

The default value of \glslistdottedwidth is changed so that it’s set at the start of the document (if it hasn’t been changed in the preamble). This should take into account situations where \hsize isn’t set until the start of the document.

The separator between groups (if not nogroupskip) is now given by:


\glslistgroupskip

This defaults to \indexspace with penalties to deter page breaks. This command isn’t used if nogroupskip is set.

The glossary-tree package introduced new commands in v4.22, \glstreegroupheaderfmt and \glstreenavigationfmt, which are used to format the letter group headings and the navigation elements for the appropriate styles. These two new commands are defined in terms of \glstreenamefmt since that was the command originally used for the group headings and navigation. This now allows these different elements to be defined independently, but the most common redefinition is for \glstreenamefmt to remove the bold in the name. If the bold is still required for the group heading and navigation elements, then both other commands also need redefining. To simplify matters, if \glstreenamefmt has been defined, as from v1.31 glossaries-extra-stylemods defines:


\glstreedefaultnamefmt{text}

which simply does \textbf{text} and redefines \glstreenamefmt, \glstreegroupheaderfmt and \glstreenavigationfmt all in terms of \glstreedefaultnamefmt.

This means that if you want to change all three to use a particular style you only need to redefine \glstreedefaultnamefmt, but if you only want to redefine \glstreenamefmt without affecting the other two commands, then you now can.

The separator between groups without headers is given by:


\glstreegroupskip

This defaults to just \indexspace without penalties. This command isn’t used if nogroupskip is set. (The penalties introduced in v1.41 were moved to \glstreeheadergroupskip in v1.42 as they are inappropriate when there’s no header.)

The separator between groups with headers is now given by (as from v1.42):


\glstreegroupheaderskip

This defaults to \glstreegroupskip with penalties to deter page breaks after the group heading.

The styles that display the group titles now use:


\glstreePreHeader{label}{title}

where ⟨label⟩ is the group label and ⟨title⟩ is the group title. This does nothing by default and is inserted before the group title. You can redefine it to add the group title to the PDF bookmarks. For example, if the glossary title uses \chapter then:

\renewcommand{\glstreePreHeader}[2]{%
 \pdfbookmark[1]{#2}{\currentglossary.#1}%
}

will insert section-level bookmarks. The use of \currentglossary helps to provide unique bookmark labels in the event of multiple glossaries.

The glossary-tree package provides the commands


\glstreepredesc

and


\glstreechildpredesc

(which both default to a space) and uses them in the tree-like styles, but not for the alttree style. The glossaries-extra-stylemods package modifies the alttree style so that it has equivalent hooks:


\glsalttreepredesc

and


\glsalttreechildpredesc

These do nothing by default.

The index-like and tree-like styles insert the pre-number list space with


\glstreeprelocation

(which defaults to \glsxtrprelocation) for top-level items and


\glstreechildprelocation

(which defaults to \glstreeprelocation) for child items.

As from version 1.31, the glossaries-extra-stylemods package also provides:


\glstreenonamedesc{label}

which is used by the treenoname styles to display the pre-description separator, the description and the post-description hook. Similarly for the symbol:


\glstreenonamesymbol{label}

The above are just used for top-level entries. Child entries don’t have the name or symbol displayed for the treenoname styles, so there’s only a command for the child description:


\glstreenonamechilddesc{label}

For the tree styles (but not the treenoname or alttree styles), the description is displayed using:


\glstreedesc{label}

and the symbol with:


\glstreesymbol{label}

Again the above two commands are just for top-level entries. The child entries use:


\glstreechilddesc{label}

for the description and


\glstreechildsymbol{label}

for the symbol. As from version 1.41, there are now wrapper commands for \glstreedesc and \glstreechilddesc that check for the description and symbol to determine what separator to use before the page list. These are:


\glstreeDescLoc{label}{location}

for top-level entries and


\glstreeChildDescLoc{label}{location}

for sub-entries.

If either the symbol or description is present these will use \glstreeprelocation or \glstreechildprelocation, respectively. Otherwise, both will use (from v1.42):


\glstreeNoDescSymbolPreLocation

The default is a space. This means that you could have, say, a comma followed by a space for terms that are simply an alias, but just have a space for terms that have a description that ends with a full stop (or that just have a symbol without a description) where the comma would be inappropriate.

Note that version 1.42 has corrected an error that was introduced to v1.41 that caused the name to run into the location list if there was no symbol and no description.

As from version 1.05, the glossaries-extra-stylemods package provides some additional commands for use with the alttree style to make it easier to modify. These commands are only defined if the glossary-tree package has already been loaded, which is typically the case unless the notree option has been used when loading glossaries.


\gglssetwidest[level]{name}

(New to version 1.21.) This is like \glssetwidest (provided by glossary-tree) but performs a global assignment.


\eglssetwidest[level]{name}

This is like \glssetwidest but performs a protected expansion on ⟨name⟩. This has a localised effect. For a global setting, use


\xglssetwidest[level]{name}

The following only set the value if ⟨name⟩ is wider than the current value (new to version 1.23). Local update:


\glsupdatewidest[level]{name}

Global update:


\gglsupdatewidest[level]{name}

Locale update (expands ⟨name⟩):


\eglsupdatewidest[level]{name}

Global update (expands ⟨name⟩):


\xglsupdatewidest[level]{name}

The widest entry value can later be retrieved using


\glsgetwidestname

for the top-level entries and


\glsgetwidestsubname{level}

for sub-entries, where ⟨level⟩ is the level number.

Note that if you are using bib2gls, you can use the resource option set-widest which will try to determine the widest name of all the selected entries. This isn’t guaranteed to work as it may depend on fonts or commands that bib2gls can’t replicate, but it should be suitable for names that just consist of text, and can be more efficient than iterating over all the defined entries using TeX.

The command \glsfindwidesttoplevelname provided by glossary-tree has a CamelCase synonym:


\glsFindWidestTopLevelName[glossary list]

Similar commands are also provided:


\glsFindWidestUsedTopLevelName[glossary list]

This has an additional check that the entry has been used. Naturally this is only useful if the glossaries that use the alttree style occur at the end of the document. This command should be placed just before the start of the glossary. (Alternatively, place it at the end of the document and save the value in the auxiliary file for the next run.)


\glsFindWidestUsedAnyName[glossary list]

This is like the previous command but if doesn’t check the parent key. This is useful if all levels should have the same width for the name.


\glsFindWidestAnyName[glossary list]

This is like the previous command but doesn’t check if the entry has been used.


\glsFindWidestUsedLevelTwo[glossary list]

This is like \glsFindWidestUsedTopLevelName but also sets the first two sub-levels as well. Any entry that has a great-grandparent is ignored.


\glsFindWidestLevelTwo[glossary list]

This is like the previous command but doesn’t check if the entry has been used.


\glsFindWidestUsedAnyNameSymbol[glossary list]{register}

This is like \glsFindWidestUsedAnyName but also measures the symbol. The length of the widest symbol is stored in ⟨register⟩.


\glsFindWidestAnyNameSymbol[glossary list]{register}

This is like the previous command but it doesn’t check if the entry has been used.


\glsFindWidestUsedAnyNameSymbolLocation[glossary list]{symbol register}{location register}

This is like \glsFindWidestUsedAnyNameSymbol but also measures the number list. This requires \glsentrynumberlist (see the glossaries user manual). The length of the widest symbol is stored in ⟨symbol register⟩ and the length of the widest number list is stored in ⟨location register⟩.


\glsFindWidestAnyNameSymbolLocation[glossary list]{symbol register}{location register}

This is like the previous command but it doesn’t check if the entry has been used.


\glsFindWidestUsedAnyNameLocation[glossary list]{register}

This is like \glsFindWidestUsedAnyNameSymbolLocation but doesn’t measure the symbol. The length of the widest number list is stored in ⟨register⟩.


\glsFindWidestAnyNameLocation[glossary list]{register}

This is like the previous command but doesn’t check if the entry has been used.

The layout of the symbol, description and number list is governed by


\glsxtralttreeSymbolDescLocation{label}{number list}

for top-level entries and


\glsxtralttreeSubSymbolDescLocation{label}{number list}

for sub-entries.

There is now a user level command that performs the initialisation for the alttree style:


\glsxtralttreeInit

The paragraph indent for subsequent paragraphs in multi-paragraph descriptions is provided by the length


\glsxtrAltTreeIndent

For additional commands that are available with the alttree style, see the documented code (glossaries-extra-code.pdf). See also the accompanying sample files sample-alttree.tex, sample-alttree-sym.tex and sample-alttree-marginpar.tex.

Top

3. New Glossary Styles

The glossaries-extra package comes with some new styles. The associated style package needs to be loaded. This can be done with \usepackage but it’s simpler to use the stylemods option.

Top

3.1 glossary-bookindex package

As from v1.21, glossaries-extra has a new supplementary package glossary-bookindex which provides the glossary style bookindex. This is very similar to the mcolindexgroup style but is designed for indexes, so by default only the name and location list are displayed. You can either load this package explicitly and then set the style:

\usepackage{glossaries-extra}
\usepackage{glossary-bookindex}
\setglossarystyle{bookindex}

or use both the stylemods and style options:

\usepackage[stylemods=bookindex,style=bookindex]{glossaries-extra}

The bookindex style only supports a maximum hierarchical level of 2 (top-level, level 1 and level 2). It’s primarily designed for use with bib2gls. It may be used with other indexing options, but some features may not be present and UTF-8 characters may cause a problem with non-Unicode engines in letter group headings or PDF bookmarks. (bib2gls uses numeric identifies by default to avoid these problems. If numbers show up in the group headings instead of the appropriate characters, check that you have used the record package option.)

The number of columns is given by


\glsxtrbookindexcols

which defaults to 2.

This style uses the multicols environment. If the command


\glsxtrbookindexcolspread

isn’t empty then it’s supplied as the optional argument following \begin{multicols} {n}. You can switch from multicols to multicols* by redefining


\glsxtrbookindexmulticolsenv

For example

\renewcommand{\glsxtrbookindexmulticolsenv}{multicols*}

Each top-level entry is displayed using


\glsxtrbookindexname{label}

where the entry is identified by ⟨label⟩. This just does \glossentryname{label} by default. For example, if you want the symbol to be included:

\renewcommand*{\glsxtrbookindexname}[1]{%
 \glossentryname{#1}%
 \ifglshassymbol{#1}{\space (\glossentrysymbol{#1})}{}%
}

or if you want the description (if set):

\renewcommand*{\glsxtrbookindexname}[1]{%
 \glossentryname{#1}%
 \ifglshasdesc{#1}{\space \glossentrydesc{#1}\glspostdescription}{}%
}

(which picks up the post-description hook).

Alternatively you can use the \glsxtrpostnamecategory⟩ hook to append information after the name according to the entry’s category.

Sub-entries are displayed using


\glsxtrbookindexsubname{label}

which just defaults to \glsxtrbookindexname{label}.

The separator used before the location list for top-level entries is given by


\glsxtrbookindexprelocation{label}

where ⟨label⟩ is the entry’s label. This checks if the location field has been set. If it has, it does

,\glsxtrprelocation

otherwise it just does \glsxtrprelocation (which defaults to \space). If you’re not using bib2gls, the location field won’t be set.

The separator used before the location list for sub-entries is given by


\glsxtrbookindexsubprelocation{label}

which defaults to \glsxtrbookindexprelocation{label}.

The actual location list is encapsulated with:


\glsxtrbookindexlocation{label}{location list}

for top-level entries and


\glsxtrbookindexsublocation{label}{location list}

for sub-entries. These both just do ⟨location list⟩ by default.

The separator used between a top-level parent and child entry is given by


\glsxtrbookindexparentchildsep

This defaults to \nopagebreak.

The separator used between a sub-level parent and child entry is given by


\glsxtrbookindexparentsubchildsep

This defaults to \glsxtrbookindexparentchildsep.

The separator between top-level entries is given by


\glsxtrbookindexbetween{label1}{label2}

This comes after the entry given by ⟨label1⟩, if the entry has no children, or after the last descendent otherwise, so it always comes immediately before the entry given by ⟨label2⟩ unless the entry occurs at the start of a group. This does nothing by default.

The separator between two level 1 entries is given by


\glsxtrbookindexsubbetween{label1}{label2}

The separator between two level 2 entries is given by


\glsxtrbookindexsubsubbetween{label1}{label2}

At the end of each letter group, the following hooks are done in order:


\glsxtrbookindexsubsubatendgroup{sub-sub-label}


\glsxtrbookindexsubatendgroup{sub-label}


\glsxtrbookindexatendgroup{label}

where ⟨sub-sub-label⟩ is the label of the last level 2 entry, ⟨sub-label⟩ is the label of the last level 1 entry and ⟨label⟩ is the label of the last level 0 entry.

For example, the resource option seealso=omit instructs bib2gls to omit the seealso cross-reference from the location list. (The see cross-reference will still be added unless you also have see=omit.) The seealso cross-reference can instead be appended after the child entries using:

\renewcommand{\glsxtrbookindexatendgroup}[1]{%
  \glsxtrifhasfield{seealso}{#1}{\glstreesubitem\glsxtruseseealso{#1}}{}%
}
\renewcommand{\glsxtrbookindexbetween}[2]{%
  \glsxtrbookindexatendgroup{#1}%
}%
\renewcommand{\glsxtrbookindexsubatendgroup}[1]{%
  \glsxtrifhasfield{seealso}{#1}{\glstreesubsubitem\glsxtruseseealso{#1}}{}%
}
\renewcommand{\glsxtrbookindexsubbetween}[2]{%
  \glsxtrbookindexsubatendgroup{#1}%
}
\renewcommand{\glsxtrbookindexsubsubatendgroup}[1]{%
  \glsxtrifhasfield{seealso}{#1}%
  {\glstreeitem\hspace*{40pt}\glsxtruseseealso{#1}}{}%
}
\renewcommand{\glsxtrbookindexsubsubbetween}[2]{%
  \glsxtrbookindexsubsubatendgroup{#1}%
}

This uses \glstreesubitem and \glstreesubsubitem to indent the cross-reference according to the next level down, so the cross-reference for a top-level entry is aligned with the sub-entries, and a level 1 entry has its cross-reference aligned with sub-sub-entries. In the event that a level 2 entry has a cross-reference, this is indented a bit further (but it won’t be aligned with any deeper level as the bookindex style only supports a maximum of two sub-levels).

The bookindex style uses group headings. (If you use bib2gls remember to invoke it with the --group or -g switch.) The heading will use


\glsxtrbookindexbookmark{group title}{name}

If \pdfbookmark has been defined, this will use that command to bookmark the group title. If section=chapter is set (default if chapters are defined) then this uses level 1 otherwise it uses level 2. You can redefine this command if this isn’t appropriate. If \pdfbookmark hasn’t been defined, this command does nothin.

The group heading is formatted according to


\glsxtrbookindexformatheader{group title}

which is defined as

\newcommand*{\glsxtrbookindexformatheader}[1]{%
  \par{\centering\glstreegroupheaderfmt{#1}\par}%
}

where \glstreegroupheaderfmt is provided by the glossary-tree package, which is automatically loaded. Note that the entry names aren’t encapsulated with \glstreenamefmt.

The glossary-bookindex package provides some supplementary commands that aren’t used by default, but may be used when adjusting the style. These commands should only be used within one of the \print…glossary commands. (That is, they should only be used in glossary styles.)


\glsxtrbookindexmarkentry{label}

This writes information to the .aux file that can be read on the next run to obtain the first and last entry on each page of the glossary.

You can display the first entry associated with the current page using:


\glsxtrbookindexfirstmark

and the last entry associated with the current page using:


\glsxtrbookindexlastmark

These do nothing if there are no entries marked on the current page (or if the document build isn’t up to date).

The entry is formatted using:


\glsxtrbookindexfirstmarkfmt{label}

for the first instance and


\glsxtrbookindexlastmarkfmt{label}

for the last.

These commands are designed for use in page headers or footers where the page number is stable. For example, \glsxtrbookindexname can be redefined to mark the current entry:

\renewcommand{\glsxtrbookindexname}[1]{%
  \glsxtrbookindexmarkentry{#1}%
  \glossentryname{#1}%
}

If you only want to mark the top-level entries, remember to redefine \glsxtrbookindexsubname as it defaults to \glsxtrbookindexname:

\renewcommand{\glsxtrbookindexsubname}[1]{%
  \glossentryname{#1}%
}

Then if you’re using fancyhdr you can set the page style to show the first and last entry for the current page with:

  \pagestyle{fancy}%
  \lhead{\thepage}%
  \lfoot{\glsxtrbookindexfirstmark}%
  \cfoot{}%
  \rfoot{\glsxtrbookindexlastmark}%

Top

3.2 glossary-longextra package

As from version 1.37, the glossaries-extra package comes with the supplementary package glossary-longextra that provides additional styles, listed below, that use the longtable environment. If you know that your glossary won’t span more than a page and you need to use it in a context that’s incompatible with longtable, you can instead setup these styles to use tabular instead. In order to do this you must use


\GlsLongExtraUseTabulartrue

before the style is set. For example:

\GlsLongExtraUseTabulartrue
\setglossarystyle{long-name-desc}

or

\GlsLongExtraUseTabulartrue
\printunsrtglossary[style={long-name-desc}]

If you use this setting, you can change the default vertical alignment with:


\glslongextraTabularVAlign

The default definition is c.

The column titles are formatted according to:


\glslongextraHeaderFmt{text}

which simply does \textbf{text} by default.

The name column has the title given by \entryname and the column alignment is given by:


\glslongextraNameAlign

which expands to l (left) by default.

The symbol column (where applicable) has the title given by \symbolname and the column alignment is given by:


\glslongextraSymbolAlign

which expands to c (centred) by default.

The location list column (where applicable) has the title given by \pagelistname and the column alignment is given by:


\glslongextraLocationAlign

which expands to

>{\raggedright}p{\glspagelistwidth}

by default. (Ragged-right paragraph, \glspagelistwidth is defined in glossary-long, which is automatically loaded.)

The description column has the title given by \descriptionname and the column alignment is given by:


\glslongextraDescAlign

which expands to

>{\raggedright}p{\glsdescwidth}

by default. (Ragged-right paragraph, \glsdescwidth is defined in glossary-long, which is automatically loaded.)

Unlike the long styles provided by the base glossaries package, these new styles try to determine the value of \glsdescwidth at the start of the glossary according to the number of columns provided by the style. The calculations are performed by the following commands:


\glslongextraSetDescWidth

This is used by the styles that have a name and description column. The value of \glsdescwidth is computed as:

\glsdescwidth = \linewidth- 4\tabcolsep- W

where W is a guess at the width of the name column. This is first set to the width of the name column header:

\settowidth{width}{\glslongextraHeaderFmt\entryname}
If any names in that column are larger than this, then you need to specify the widest name using:


\glslongextraSetWidest{widest name}

or


\glslongextraUpdateWidest{text}

These work like the analogous commands \glssetwidest and \glsupdatewidest provided with the alttree style, but in this case there’s no hierarchy. The default widest name is obtained from the alttree top-level name if set, otherwise it’s empty, so you can use bib2gls’s set-widest option. If you have the entry counter enabled, you will need to include this with the name for the extra material to be taken into account.

The name isn’t shown for child entries by default, but if you change this and you want to use bib2gls’s set-widest option (for bib2gls v1.8+) then you need to redefine:


\glslongextraUpdateWidestChild{level}{text}

This does nothing by default, but if you are including the child names then you need to redefine this command:

\renewcommand{\glslongextraUpdateWidestChild}[2]{%
 \glslongextraUpdateWidest{#2}%
}

If you prefer to set an explicit width for the description column then you need to redefine \glslongextraSetDescWidth. For example:

\renewcommand{\glslongextraSetDescWidth}{%
  \setlength{\glsdescwidth}{0.6\linewidth}%
}

The styles that have a name, symbol and description, \glsdescwidth is set with:


\glslongextraSymSetDescWidth

This first uses \glslongextraSetDescWidth and then subtracts 2\tabcolsep and the width of the symbol column header from \glsdescwidth. This assumes that the symbol column header is larger than any of the symbols. If this isn’t appropriate then you can redefine this command. For example:

\renewcommand{\glslongextraSymSetDescWidth}{%
  \glslongextraSetDescWidth
  \addtolength{\glsdescwidth}{-3cm}%
}

or

\renewcommand{\glslongextraSymSetDescWidth}{%
  \setlength{\glsdescwidth}{.5\linewidth}%
}

For the styles that have a name, description and location column, \glsdescwidth is set using:


\glslongextraLocSetDescWidth

This uses \glslongextraSetDescWidth and then subtracts 2\tabcolsep and \glspagelistwidth from \glsdescwidth. You can redefine this command to set both \glsdescwidth and \glspagelistwidth if appropriate.

For the styles that have a name, description, symbol and location column, \glsdescwidth is set using:


\glslongextraSymLocSetDescWidth

This uses \glslongextraSymSetDescWidth and then subtracts 2\tabcolsep and \glspagelistwidth from \glsdescwidth. Again, you can redefine this command to explicitly set both lengths.

In all cases, the top-level name is formatted according to:


\glslongextraNameFmt{label}

This does

\glsentryitem{label}\glstarget{label}{\glossentryname{label}}
which includes the entry counter (if enabled), the target and the post-name link.

The top-level description is formatted according to:


\glslongextraDescFmt{label}

This does \glossentrydesc{label} followed by the post-description hook.

The styles that have a symbol column format the symbol using:


\glslongextraSymbolFmt{label}

This just does \glossentrysymbol{label}.

The styles that have a location list column format the list using:


\glslongextraLocationFmt{label}{locations}

This just does ⟨locations⟩ and ignores the label.

The child entries have their name formatted according to:


\glslongextraSubNameFmt{level}{label}

where ⟨level⟩ is the hierarchical level. This defaults to:

\glssubentryitem{label}\glstarget{label}{\strut}
This includes the sub-entry counter (if enabled) and the target but doesn’t show the name. The child description is formatted according to:


\glslongextraSubDescFmt{level}{label}

which defaults to just \glslongextraDescFmt{label}

The child symbol is formatted (where appropriate) according to:


\glslongextraSubSymbolFmt{level}{label}

This just does \glslongextraSymbolFmt{label} by default.

The styles that have a location list column format the list for child entries using:


\glslongextraSubLocationFmtlevel{label}{locations}

This just does ⟨locations⟩ and ignores the level and label.

The letter group headings are formatted according to:


\glslongextraGroupHeading{n}{label}

which does nothing by default. The first argument ⟨n⟩ is the number of columns in the table. The second argument ⟨label⟩ is the group label (not the title, although they may happen to be the same).

This can be redefined to show the group heading. For example:

\renewcommand*{\glslongextraGroupHeading}[2]{%
  \glsxtrgetgrouptitle{#2}{\thisgrptitle}%
  \glslongextraHeaderFmt{\thisgrptitle}%
  \tabularnewline
  \noalign{\vskip\normalbaselineskip}%
}

This ignores the first argument and just puts the group title in the first column formatted according to \glslongextraHeaderFmt (to match the column header).

Remember that you can also adjust the styles through category attributes. The name column’s title is given by \entryname, the description column’s title is given by \descriptionname and (where present) the symbol column’s title is given by \symbolname, as for the other long styles that have headers.

long-name-desc This is like the longragged-booktabs style but doesn’t show the location list (regardless of the nonumberlist option). The name is shown in the first column and the description in the second.

The symbol is not displayed. The header row is produced with:


\glslongextraNameDescHeader

This essentially uses the same code as for longragged-booktabs but makes it easier to adjust the header without having to define a new style. This is defined as:

     \glslongextraNameDescTabularHeader\endhead
     \glslongextraNameDescTabularFooter\endfoot

where:


\glslongextraNameDescTabularHeader

sets up the header and


\glslongextraNameDescTabularFooter

sets up the footer. If you have setup the tabular version of this style then the above two commands are used at the start and end of the tabular environment (and \glslongextraNameDescHeader isn’t used).

For example, to simply remove the header and footer (for the default longtable version of the style):

     \renewcommand{\glslongextraNameDescHeader}{}

Or to change the name alignment to centred:

     \renewcommand{\glslongextraNameAlign}{c}

long-name-desc-loc This is like the long-name-desc style but has a third column for the location list. The longtable header is given by:


\glslongextraNameDescLocationHeader

which similarly defined in terms of the commands used for the tabular version:


\glslongextraNameDescLocationTabularHeader

and


\glslongextraNameDescLocationTabularFooter

long-desc-name This is like the long-name-desc style but swaps the columns. Note that if the entry counter is displayed it will appear at the start of the second column by default. The longtable header is formatted according to:


\glslongextraDescNameHeader

which similarly defined in terms of the commands used for the tabular version:


\glslongextraDescNameTabularHeader

and


\glslongextraDescNameTabularFooter

long-loc-desc-name This has three columns containing the location list, description and name. The longtable header is formatted according to:


\glslongextraLocationDescNameHeader

which similarly defined in terms of the commands used for the tabular version:


\glslongextraLocationDescNameTabularHeader

and


\glslongextraLocationDescNameTabularFooter

long-name-desc-sym This is has three columns, with the name in the first, the description in the second and the symbol in the third.

The longtable header row is produced with:


\glslongextraNameDescSymHeader

which similarly defined in terms of the commands used for the tabular version:


\glslongextraNameDescSymTabularHeader

and


\glslongextraNameDescSymTabularFooter

long-name-desc-sym-loc This is has four columns, with the name in the first, the description in the second, the symbol in the third and the location list in the fourth.

The longtable header row is produced with:


\glslongextraNameDescSymLocationHeader

which similarly defined in terms of the commands used for the tabular version:


\glslongextraNameDescSymLocationTabularHeader

and


\glslongextraNameDescSymLocationTabularFooter

long-name-sym-desc This is like the long-name-desc-sym but the second and third column are swapped. The longtable header row is given by:


\glslongextraNameSymDescHeader

which similarly defined in terms of the commands used for the tabular version:


\glslongextraNameSymDescTabularHeader

and


\glslongextraNameSymDescTabularFooter

long-name-sym-desc-loc This is like the long-name-desc-sym-loc but the second and third column are swapped. The longtable header row is given by:


\glslongextraNameSymDescLocationHeader

which similarly defined in terms of the commands used for the tabular version:


\glslongextraNameSymDescLocationTabularHeader

and


\glslongextraNameSymDescLocationTabularFooter

long-sym-desc-name This has the symbol in the first column, the description in the second and the name in the third. The longtable header row is given by:


\glslongextraSymDescNameHeader

which similarly defined in terms of the commands used for the tabular version:


\glslongextraSymDescNameTabularHeader

and


\glslongextraSymDescNameTabularFooter

long-loc-sym-desc-name This has the location list in the first column, symbol in the second column, the description in the third and the name in the fourth. The longtable header row is given by:


\glslongextraLocationSymDescNameHeader

which similarly defined in terms of the commands used for the tabular version:


\glslongextraLocationSymDescNameTabularHeader

and


\glslongextraLocationSymDescNameTabularFooter

long-desc-sym-name This has the description in the first column, the symbol in the second and the name in the third. The longtable header row is given by:


\glslongextraDescSymNameHeader

which similarly defined in terms of the commands used for the tabular version:


\glslongextraDescSymNameTabularHeader

and


\glslongextraDescSymNameTabularFooter

long-loc-desc-sym-name This has the location list in the first column, the description in the second column, the symbol in the third and the name in the fourth. The longtable header row is given by:


\glslongextraLocationDescSymNameHeader

which similarly defined in terms of the commands used for the tabular version:


\glslongextraLocationDescSymNameTabularHeader

and


\glslongextraLocationDescSymNameTabularFooter

Top

3.3 glossary-topic package

As from version 1.40, the glossaries-extra package comes with the supplementary package glossary-topic that provides glossary styles designed for hierarchical glossaries where the top-level entries are topic titles. This package automatically loads the multicols package. If the glossary-tree package is also loaded then commands like \glssetwidest can be used on these styles in much the same way as for the alttree style. If a widest value isn’t set then these styles behave more like the tree style.

topic
This style is similar to the tree style but the indentation doesn’t start until the second sub-item level. The top-level entries have the name displayed in a larger font with the description following in a new paragraph. This style doesn’t support the nogroupskip setting.
topicmcols
This style is like the topic style but the sub-entries are placed inside a multicols environment. The environment name is supplied in the value of the command:


\glstopicColsEnv

You can change this to the starred form. For example:

     \renewcommand{\glstopicColsEnv}{multicols*}

The number of columns is given by the command:


\glstopicCols

The default value is 2.

Both styles use the following commands.


\glstopicParIndent

This command is a length that’s used for the paragraph indentation in any multi-paragraph description for top-level entries, but not for the first paragraph (at the start of the description) which isn’t indented.


\glstopicSubIndent

This command is a length that’s used to calculate the hanging indentation for sub-entries. The level 1 sub-entries don’t indent the name. Level n sub-entries have the name indented by (n- 1)×\glstopicSubIndent. The hanging indent depends on whether or not a widest name has been set for the level.

As from v1.46, there is also a length for additional indentation used in the second paragraph onwards for child entries with multi-paragraph descriptions:


\glstopicSubItemParIndent

This is initialised to \parindent when glossary-topic is loaded.


\glstopicInit

Hook used at the start of the glossary. Does nothing by default.

Although the styles don’t support letter groups by default, if you have many topics (top-level entries) and you feel that it would help the reader to divide them up into headed letter groups, you can redefine:


\glstopicGroupHeading{group label}

This does nothing by default. If you want to redefine it, you can fetch the title corresponding to the group label with \glsxtrgetgrouptitle. For example:

\renewcommand*{\glstopicGroupHeading}[1]{%
  \glsxtrgetgrouptitle{#1}{\thisgrptitle}%
  \section*{\thisgrptitle}%
}

Remember that if you use bib2gls, you will need the --group (or -g) switch to support this.


\glstopicItem{label}{location list}

Used to format the name, symbol, description and location list for the top-level entries. This starts with a paragraph break followed by:


\glstopicPreSkip

which defaults to \medskip. There is then a hook:


\glstopicMarker{label}

which does nothing by default, but may be redefined. For example, to add a line to the table of contents. The name and symbol are set in the form of a title using:


\glstopicTitle{label}

This uses \Glossentryname which converts the first letter to upper case. If there’s a symbol, this is added in parentheses. Both name and symbol (if present) are encapsulated by


\glstopicTitleFont{text}

This uses a bold, large font by default.

If the entry has the description key set (tested with \ifglshasdesc) then a paragraph break is inserted followed by:


\glstopicMidSkip

which defaults to \smallskip. This is followed by the description which is formatted according to:


\glstopicDesc{label}

This just does \Glossentrydesc{label} followed by the post-description hook.

A paragraph break followed by:


\glstopicPostSkip

comes next regardless of whether or not the description was displayed. This defaults to \smallskip. This is then followed by:


\glstopicLoc{label}{location list}

which may be used to display the location list, but does nothing by default.

The sub-entries first set up the paragraph and hanging indentations using:


\glstopicAssignSubIndent{level}

This uses:


\glstopicAssignWidest{level}

to determine if a widest name has been set for the given level.

The sub-entry has its information displayed using:


\glstopicSubItem{level}{label}{location}

This encapsulates the name with:


\glstopicSubNameFont{text}

By default this just uses \textbf. This is followed by:


\glstopicSubItemSep

which defaults to \quad. The name and separator are passed in the ⟨text⟩ argument of:


\glstopicSubItemBox{level}{text}

If a widest name was set for the given level, this will put ⟨text⟩ inside a box of that width otherwise it just does ⟨text⟩.

This is followed by the symbol in parentheses if set. Then, if the description is set, the description and post-description hook are displayed followed by:


\glstopicSubPreLocSep

(This command isn’t used if the description isn’t set.)

Finally the location list is displayed using:


\glstopicSubLoc{label}{location}

which just does ⟨location⟩ by default.

Top

4. Abbreviations

The new abbreviation system provided by glossaries-extra is more flexible than the acronym handling provided by the base glossaries package. The glossaries-extra package modifies the underlying formatting used by \gls (and its variants) so that terms that are recognised as abbreviations can have their formatting dealt with by the style. You therefore need to select an abbreviation style that ensures that \gls (and its variants) displays the desired output. See the file sample-abbr-styles.pdf for samples of all provided abbreviation styles.

Don’t use \glsfirst, \Glsfirst or \GLSfirst with abbreviations as they aren’t flexible enough to handle some abbreviation styles and unexpected results may occur. (To a lesser degree, this also applies to \glstext etc.) Use commands like \glsfmttext, \glsfmtshort or \glsfmtlong in section headings or captions instead of \gls. If you don’t want the full form to show on first use of \gls use one of the “nolong” or “noshort” styles.

This lack of flexibility in \glsfirst can be demonstrated with the following document:

\documentclass{article}
\usepackage{glossaries-extra}
\setabbreviationstyle{footnote}
\newabbreviation{ex}{EX}{Example}
\begin{document}
Compare \gls{ex}['s] with \glsfirst{ex}['s].
\end{document}

The first use \gls has the footnote marker after the inserted material “EX’s1” but \glsfirst has it before the inserted material “EX1’s” which is inappropriate. Note that if the style is changed to postfootnote, the footnote marker appears after the inserted material as \footnote is in the post-link hook.

There are some instances where \glstext can be useful. It’s used internally by \glsfmttext, which in turn is used by \glsseelistformat if the entry has a short form. If \glsfmtshort is used, this enforces the short form, but if \glsfmttext is used, then the long form will be used for the “noshort” styles, which is more appropriate. In this particular situation, there’s no need to worry about inserted material as the final optional argument isn’t supported by \glsfmttext.

Abbreviations include acronyms (words formed from initial letters, such as “laser”), initialisms (initial letters of a phrase, such as “html”, that aren’t pronounced as words) and contractions (where parts of words are omitted, often replaced by an apostrophe, such as “don’t”). The “acronym” code provided by the glossaries package is misnamed as it’s more often than not used for initialisms instead. Acronyms tend not to be expanded on first use (although they may need to be described for readers unfamiliar with the term). They are therefore more like a regular term, which may or may not require a description in the glossary.

The glossaries-extra package corrects this misnomer, and provides better abbreviation handling, with


\newabbreviation[options]{label}{short}{long}

This sets the category key to abbreviation by default, but that value may be overridden in ⟨options⟩. The category may have attributes that modify the way abbreviations are defined. For example, the insertdots attribute will automatically insert full stops (periods) into ⟨short⟩ or the noshortplural attribute will set the default value of the shortplural key to just ⟨short⟩ (without appending the plural suffix). See §7 Categories for further details.

See §2.8 Nested Links regarding the pitfalls of using commands like \gls or \glsxtrshort within ⟨short⟩ or ⟨long⟩.

Make sure that you set the category attributes before defining new abbreviations or they may not be correctly applied.

The \newacronym command provided by the glossaries package is redefined by glossaries-extra to use \newabbreviation with the category set to acronym (see also §2.9 Acronym Style Modifications) so


\newacronym[options]{label}{short}{long}

is now equivalent to
\newabbreviation[type=\acronymtype,category=acronym,options] {label} {short} {long}

The \newabbreviation command is superficially similar to the glossaries package’s \newacronym but you can apply different styles to different categories. The default style is short-nolong for entries in the acronym category and short-long for entries in the abbreviation category. (These aren’t the same as the acronym styles provided by the glossaries package, although they may produce similar results.)

The way the abbreviations are displayed by commands like \gls varies according to the abbreviation style. The styles are set according to the entry’s category so, unlike the base glossaries package, you can have different abbreviation styles within the same glossary.

There are two types of full forms. The display full form, which is used on first use by commands like \gls and the inline full form, which is used by commands like \glsxtrfull. For some of the abbreviation styles, such as long-short, the display and inline forms are the same. In the case of styles such as short-nolong or short-footnote, the display and inline full forms are different.

These formatting commands aren’t stored in the short, shortplural, long or longplural fields, which means they won’t be used within commands like \glsentryshort (but they are used within commands like \glsxtrshort and \glsfmtshort). Note that \glsxtrlong and the case-changing variants don’t use \glsfirstlongfont.

You can apply the formatting command used for the short form to some arbitrary text using


\glsuseabbrvfont{text}{category}

where ⟨category⟩ is the category label that identifies the abbreviation style. Similarly for the formatting command use by the long form:


\glsuselongfont{text}{category}

You can’t use the acronym commands provided by the base package with the new abbreviations provided by the glossaries-extra package. The style commands that replace \setacronymstyle, \acrshort etc are described in §4.2 Abbreviation Styles. The acronymlists package option and associated commands aren’t supported. The \forallacronyms command, which iterates over all acronym lists, should be replaced with:


\forallabbreviationlists{cs}{body}

Top

4.1 Tagging Initials

If you would like to tag the initial letters in the long form such that those letters are underlined in the glossary but not in the main part of the document, you can use


\GlsXtrEnableInitialTagging{categories}{cs}

before you define your abbreviations.

This command (robustly) defines ⟨cs⟩ (a control sequence) to accept a single argument, which is the letter (or letters) that needs to be tagged. The normal behaviour of this command within the document is to simply do its argument, but in the glossary it’s activated for those categories that have the tagging attribute set to “true”. For those cases it will use


\glsxtrtagfont{text}

This command defaults to \underline{text} but may be redefined as required.

The control sequence ⟨cs⟩ can’t already be defined when used with the unstarred version of \GlsXtrEnableInitialTagging for safety reasons. The starred version will overwrite any previous definition of ⟨cs⟩. As with redefining any commands, ensure that you don’t redefine something important. In fact, just forget the existence of the starred version and let’s pretend I didn’t mention it.

The first argument of \GlsXtrEnableInitialTagging is a comma-separated list of category names. The tagging attribute will automatically be set for those categories. You can later set this attribute for other categories (see §7 Categories) but this must be done before the glossary is displayed.

The accompanying sample file sample-mixtures.tex uses initial tagging for both the acronym and abbreviation categories:

\GlsXtrEnableInitialTagging{acronym,abbreviation}{\itag}

This defines the command \itag which can be used in the definitions. For example:

\newacronym
 [description={a system for detecting the location and
 speed of ships, aircraft, etc, through the use of radio
 waves}% description of this term
 ]
 {radar}% identifying label
 {radar}% short form (i.e. the word)
 {\itag{ra}dio \itag{d}etection \itag{a}nd \itag{r}anging}
\newabbreviation{xml}{XML}
 {e\itag{x}tensible \itag{m}arkup \itag{l}anguage}

The underlining of the tagged letters only occurs in the glossary and then only for entries with the tagging attribute set.

Top

4.2 Abbreviation Styles

The abbreviation style must be set before abbreviations are defined using:


\setabbreviationstyle[category]{style-name}

where ⟨style-name⟩ is the name of the style and ⟨category⟩ is the category label (abbreviation by default). New abbreviations will pick up the current style according to their given category. If there is no style set for the category, the fallback is the style for the abbreviation category. Some styles may automatically modify one or more of the attributes associated with the given category. For example, the long-noshort and short-nolong styles set the regular attribute to true.

If you want to apply different styles to groups of abbreviations, assign a different category to each group and set the style for the given category.

Note that \setacronymstyle is disabled by glossaries-extra. Use

\setabbreviationstyle[acronym]{style-name}
instead. The original acronym interface can be restored with \RestoreAcronyms (see §2.9 Acronym Style Modifications). However the original acronym interface is incompatible with all the commands described here.

Abbreviations can be used with the standard glossaries commands, such as \gls, but don’t use the acronym commands like \acrshort (which use \acronymfont). The short form can be produced with:


\glsxtrshort[options]{label}[insert]

(Use this instead of \acrshort.)

The long form can be produced with


\glsxtrlong[options]{label}[insert]

(Use this instead of \acrlong.)

The inline full form can be produced with


\glsxtrfull[options]{label}[insert]

(This this instead of \acrfull.)

In general, it’s best not to use commands like \glsfirst for abbreviations, especially if you use the ⟨insert⟩ optional argument. Use either \gls (possibly with a reset) or \glsxtrfull.

As mentioned earlier, the inline full form may not necessarily match the format used on first use with \gls. For example, the short-nolong style only displays the short form on first use, but the full form will display the long form followed by the short form in parentheses.

If you want to use an abbreviation in a chapter or section title, use the commands described in §5 Entries in Sectioning Titles, Headers, Captions and Contents instead.

The arguments ⟨options⟩, ⟨label⟩ and ⟨insert⟩ are the same as for commands such as \glstext. There are also analogous case-changing commands:

First letter upper case short form:


\Glsxtrshort[options]{label}[insert]

First letter upper case long form:


\Glsxtrlong[options]{label}[insert]

First letter upper case inline full form:


\Glsxtrfull[options]{label}[insert]

All upper case short form:


\GLSxtrshort[options]{label}[insert]

All upper case long form:


\GLSxtrlong[options]{label}[insert]

All upper case inline full form:


\GLSxtrfull[options]{label}[insert]

Plural forms are also available.

Short form plurals:


\glsxtrshortpl[options]{label}[insert]


\Glsxtrshortpl[options]{label}[insert]


\GLSxtrshortpl[options]{label}[insert]

Long form plurals:


\glsxtrlongpl[options]{label}[insert]


\Glsxtrlongpl[options]{label}[insert]


\GLSxtrlongpl[options]{label}[insert]

Full form plurals:


\glsxtrfullpl[options]{label}[insert]


\Glsxtrfullpl[options]{label}[insert]


\GLSxtrfullpl[options]{label}[insert]

Be careful about using \glsentryfull, \Glsentryfull, \glsentryfullpl and \Glsentryfullpl. These commands will use the currently applied style rather than the style in use when the entry was defined. If you have mixed styles, you’ll need to use \glsxtrfull instead. Similarly for \glsentryshort etc.

Top

4.3 Shortcut Commands

The abbreviation shortcut commands can be enabled using the shortcuts=abbreviations package option (or shortcuts=abbr) or shortcuts=ac. (You can use both settings at the same time.) The provided shortcut commands listed in table 4.1.


Table 4.1: Abbreviation Shortcut Commands
Shortcut Shortcut Equivalent Command
(shortcuts=abbreviations)(shortcuts=ac)
\ab \ac \cgls
\abp \acp \cglspl
\as \acs \glsxtrshort
\asp \acsp \glsxtrshortpl
\al \acl \glsxtrlong
\alp \aclp \glsxtrlongpl
\af \acf \glsxtrfull
\afp \acfp \glsxtrfullpl
\Ab \Ac \cgls
\Abp \Acp \cglspl
\As \Acs \Glsxtrshort
\Asp \Acsp \Glsxtrshortpl
\Al \Acl \Glsxtrlong
\Alp \Aclp \Glsxtrlongpl
\Af \Acf \Glsxtrfull
\Afp \Acfp \Glsxtrfullpl
\AB \AC \cGLS
\ABP \ACP \cGLSpl
\AS \ACS \GLSxtrshort
\ASP \ACSP \GLSxtrshortpl
\AL \ACL \GLSxtrlong
\ALP \ACLP \GLSxtrlongpl
\AF \ACF \GLSxtrfull
\AFP \ACFP \GLSxtrfullpl
\newabbr \newabbr \newabbreviation

Top

4.4 Predefined Abbreviation Styles

There are two types of abbreviation styles: those that treat the abbreviation as a regular entry (so that \gls uses \glsgenentryfmt) and those that don’t treat the abbreviation as a regular entry (so that \gls uses \glsxtrgenabbrvfmt).

The regular entry abbreviation styles set the regular attribute to “true” for the category assigned to each abbreviation with that style. This means that on first use, \gls uses the value of the first field and on subsequent use \gls uses the value of the text field (and analogously for the plural and case-changing versions). The short and long fields are set as appropriate and may be accessed through commands like \glsxtrshort.

The other abbreviation styles don’t modify the regular attribute. The first and text fields (and their plural forms) are set and can be accessed through commands like \glsfirst, but they aren’t used by commands like \gls, which instead use the short form (stored in the short key) and the display full format (through commands like \glsxtrfullformat that are defined by the style).

In both cases, the first use of \gls may not match the text produced by \glsfirst (and likewise for the plural and case-changing versions).

The sample file sample-abbr-styles.tex demonstrates all predefined styles described here.

For the “sc” styles that use \textsc, be careful about your choice of fonts as some only have limited support. For example, you may not be able to combine bold and small-caps. I recommend that you at least use the fontenc package with the T1 option or something similar.

Many of the styles have helper commands in the form \glsxtr...name and \glsxtr...sort that are expanded within the name and sort fields when the abbreviation is defined. These commands may use the helper token registers available within \newabbreviation, such as \glsshorttok. The contents of a register can be accessed with \theregister⟩. It’s essential that these expand when the abbreviation is defined so don’t hide them behind no-expandable content if you redefine these helper commands.

The parenthetical styles, such as long-short, use


\glsxtrparen{text}

to set the parenthetical material. This just puts parentheses around the text: (⟨text⟩).

The basic abbreviation styles, such as long-short and short-long use


\glsabbrvdefaultfont{text}

for the short form. This just does ⟨text⟩ by default. (That is, no font change is applied.) On first use,


\glsfirstabbrvdefaultfont{text}

is used instead. By default, this just does \glsabbrvdefaultfont. The long form is formatted according to


\glslongdefaultfont{text}

which again just does ⟨text⟩ (no font change). On first use,


\glsfirstlongdefaultfont{text}

is used instead. This just does \glslongdefaultfont. The plural suffix used for the short form is given by


\glsxtrabbrvpluralsuffix

which defaults to \glspluralsuffix.

The small-cap styles, such as long-short-sc and short-sc-long, use


\glsabbrvscfont{text}

which uses \textsc.4.1 On first use


\glsfirstabbrvscfont{text}

is used instead. This uses \glsabbrvscfont by default. So redefine, \glsabbrvscfont to change first and subsequent uses or \glsfirstabbrvscfont to change just the first use.

The long form for the small-cap styles uses \glslongdefaultfont or \glsfirstlongdefaultfont, as with the basic style. The suffix is given by


\glsxtrscsuffix

This is defined as

\newcommand*{\glsxtrscsuffix}{\glstextup{\glsxtrabbrvpluralsuffix}}

The \glstextup command is provided by glossaries and is used to switch off the small caps font for the suffix. If you override the default short plural using the shortplural key when you define the abbreviation you will need to make the appropriate adjustment if necessary. (Remember that the default plural suffix behaviour can be modified through the use of the aposplural and noshortplural attributes. See §7 Categories for further details.)

The small styles, such as long-short-sm and short-sm-long, use


\glsabbrvsmfont{text}

which uses \textsmaller. (This requires the relsizes package, which isn’t loaded by glossaries-extra, so must be loaded explicitly.) On first use


\glsfirstabbrvsmfont{text}

is used instead. This uses \glsabbrvsmfont by default.

The long form for the smaller styles uses \glslongdefaultfont or \glsfirstlongdefaultfont, as with the basic style. The suffix is given by


\glsxtrsmsuffix

which defaults to just \glsxtrabbrvpluralsuffix.

The “short-em” (emphasize short) styles, such as long-short-em or short-em-long, use


\glsabbrvemfont{text}

On first use


\glsfirstabbrvemfont{text}

is used instead. This uses \glsabbrvemfont by default. The suffix is given by


\glsxtremsuffix

which defaults to just \glsxtrabbrvpluralsuffix. The long form is as for the basic style unless the style is a “long-em” style.

The “long-em” (emphasize long) styles, such as long-em-short-em or short-em-long-em, use


\glsfirstlongemfont{long-form}

instead of \glsfirstlongdefaultfont{long-form} and


\glslongemfont{long-form}

instead of \glslongdefaultfont{long-form}. The first form \glsfirstlongemfont is initialised to use \glslongemfont.

The user styles have similar commands:


\glsabbrvuserfont{text}

for the short form,


\glsfirstabbrvuserfont{text}

for the first use short form,


\glslonguserfont{text}

for the long form,


\glsfirstlonguserfont{text}

for the first use long form, and


\glsxtrusersuffix

for the short plural suffix.

Similarly for the hyphen styles:


\glsabbrvhyphenfont{text}

for the short form,


\glsfirstabbrvhyphenfont{text}

for the first use short form,


\glslonghyphenfont{text}

for the long form,


\glsfirstlonghyphenfont{text}

for the first use long form, and


\glsxtrhyphensuffix

for the short plural suffix.

Similarly for the “only” styles, such as long-only-short-only:


\glsabbrvonlyfont{text}

for the short form,


\glsfirstabbrvonlyfont{text}

for the first use short form,


\glslongonlyfont{text}

for the long form,


\glsfirstlongonlyfont{text}

for the first use long form, and


\glsxtronlysuffix

for the short plural suffix.

The “short-sc-only” styles, such as long-only-short-sc-only:


\glsabbrvsconlyfont{text}

for the short form (which uses \glsabbrvscfont), and


\glsfirstabbrvsconlyfont{text}

which uses \glsabbrvsconlyfont. The short plural suffix is obtained from:


\glsxtrsconlysuffix

This uses \glsxtrscsuffix. For other font types, use the one of “short-only” styles and redefine \glsabbrvonlyfont as required. (The smallcaps style is a special case as its plural suffix is awkward.)

The “postshort-sc-user” styles, such as long-postshort-sc-user:


\glsabbrvscuserfont{text}

for the short form (which uses \glsabbrvscfont), and


\glsfirstabbrvscuserfont{text}

which uses \glsabbrvscuserfont. The short plural suffix is obtained from:


\glsxtrscusersuffix

This uses \glsxtrscsuffix.

Note that by default inserted material (provided in the final optional argument of commands like \gls), is placed outside the font command in the predefined styles. To move it inside, use:


\glsxtrinsertinsidetrue

This applies to all the predefined styles. For example:

\setabbreviationstyle{long-short}
\renewcommand*{\glsfirstlongdefaultfont}[1]{\emph{#1}}
\glsxtrinsertinsidetrue

This will make the long form and the inserted text emphasized, whereas the default (without \glsxtrinsertinsidetrue) would place the inserted text outside of the emphasized font.

Note that for some styles, such as the short-long, the inserted text would be placed inside the font command for the short form (rather than the long form in the above example).

Remember that \textsc renders lowercase letters as small capitals. Uppercase letters are rendered as normal uppercase letters, so if you specify the short form in uppercase, you won’t get small capitals unless you redefine \glsabbrvscfont to convert its argument to lowercase. For example:

\renewcommand*{\glsabbrvscfont}[1]{\textsc{\MakeLowercase{#1}}}

If you want to easily switch between the “sc” and “sm” styles, you may find it easier to redefine this command to convert case:

\renewcommand*{\glsabbrvscfont}[1]{\textsc{\MakeTextLowercase{#1}}}
\renewcommand*{\glsabbrvsmfont}[1]{\textsmaller{\MakeTextUppercase{#1}}}

Some of the styles use


\glsxtrfullsep{label}

as a separator between the long and short forms. This is defined as a space by default, but may be changed as required. For example:

\renewcommand*{\glsxtrfullsep}[1]{~}

or

\renewcommand*{\glsxtrfullsep}[1]{\glsacspace{#1}}

The new naming scheme for abbreviation styles is as follows:

Not all combinations that fit the above syntax are provided. Pre-version 1.04 styles that didn’t fit this naming scheme are either provided with a synonym (where the former name wasn’t ambiguous) or provided with a deprecated synonym (where the former name was confusing). The deprecated style names generate a warning using:


\GlsXtrWarnDeprecatedAbbrStyle{old-name}{new-name}

where ⟨old-name⟩ is the deprecated name and ⟨new-name⟩ is the preferred name. You can suppress these warnings by redefining this command to do nothing.

Top

4.4.1 Predefined Abbreviation Styles that Set the Regular Attribute

The following abbreviation styles set the regular attribute to “true” for all categories that have abbreviations defined with any of these styles.

short-nolong
This only displays the short form on first use. The name is set to the short form through the command


\glsxtrshortnolongname

(Similarly for the other shortmodifier-nolongmodifier⟩ styles, unless indicated otherwise.) This command is expanded as the entry is defined, so any redefinition must be done before \newabbreviation (or \newacronym) for it to take effect. Make sure to \protect any formatting commands (or anything else that shouldn’t be expanded).

The description is set to the long form. The inline full form displays ⟨short⟩ (⟨long⟩). The long form on its own can be displayed through commands like \glsxtrlong.

short
A synonym for short-nolong.
nolong-short
Like short-nolong but the inline full form displays ⟨long⟩ (⟨short⟩).
short-sc-nolong
Like short-nolong but redefines \glsabbrvfont to use \glsabbrvscfont (which defaults to \textsc).
short-sc
A synonym for short-sc-nolong
nolong-short-sc
Like short-sc-nolong but the inline full form displays ⟨long⟩ (⟨short⟩). The name is still obtained from \glsxtrshortnolongname (similarly for the other styles in the form nolongmodifier-shortmodifier⟩ unless indicated otherwise).
short-sm-nolong
Like short-nolong but redefines \glsabbrvfont to use \glsabbrvsmfont (which defaults to \textsmaller).
short-sm
A synonym for short-sm-nolong.
nolong-short-sm
Like short-sm-nolong but the inline full form displays ⟨long⟩ (⟨short⟩).
short-em-nolong
Like short-nolong but redefines \glsabbrvfont to use \glsabbrvemfont.
short-em
A synonym for short-em-nolong
nolong-short-em
Like short-em-nolong but the inline full form displays ⟨long⟩ (⟨short⟩).
short-nolong-desc
Like the short-nolong style, but the name is set to the full form obtained by expanding


\glsxtrshortdescname

(Similarly for the other shortmodifier-nolongmodifier-desc styles, unless indicated otherwise.) This command is expanded when the entry is defined, so \protect fragile and formatting commands and only redefine this command before \newabbreviation (or \newacronym).

The description must be supplied by the user. You may prefer to use the short-nolong style with the post-description hook set to display the long form and override the description key. (See the sample file sample-acronym-desc.tex.)

short-desc
A synonym for short-nolong-desc.
short-sc-nolong-desc
Like short-nolong but redefines \glsabbrvfont to use \glsabbrvscfont (which defaults to \textsc).
short-sc-desc
A synonym for short-sc-nolong-desc.
short-sm-nolong-desc
Like short-nolong-desc but redefines \glsabbrvfont to use \glsabbrvsmfont (which defaults to \textsmaller).
short-sm-desc
A synonym for short-sm-nolong-desc.
short-em-nolong-desc
Like short-nolong-desc but redefines \glsabbrvfont to use \glsabbrvemfont.
short-em-desc
A synonym for short-em-nolong-desc.
long-noshort-desc
This style only displays the long form, regardless of first or subsequent use of commands \gls. The short form may be accessed through commands like \glsxtrshort. The inline full form displays ⟨long⟩ (⟨short⟩).

The sort key are set to the long form. The name key is also set to the long form, but this is done by expanding


\glsxtrlongnoshortdescname

(Similarly for the other longmodifier-noshortmodifier-desc styles, unless indicated otherwise.) This command should only be redefined before abbreviations are defined, and any fragile or formatting commands within it need protecting.

The description must be provided by the user. The predefined glossary styles won’t display the short form. You can use the post-description hook to automatically append the short form to the description. The inline full form will display ⟨long⟩ (⟨short⟩).

long-desc
A synonym for long-noshort-desc.
long-noshort-sc-desc
Like the long-noshort-desc style but the short form (accessed through commands like \glsxtrshort) use \glsabbrvscfont. (This style was originally called long-desc-sc. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.)
long-noshort-sm-desc
Like long-noshort-desc but redefines \glsabbrvfont to use \glsabbrvsmfont. (This style was originally called long-desc-sm. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.)
long-noshort-em-desc
Like long-noshort-desc but redefines \glsabbrvfont to use \glsabbrvemfont. The long form isn’t emphasized. (This style was originally called long-desc-em. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.)
long-em-noshort-em-desc
New to version 1.04, like long-noshort-desc but redefines \glsabbrvfont to use \glsabbrvemfont. The long form uses \glsfirstlongemfont and \glslongemfont.
long-noshort
This style doesn’t really make sense if you don’t use the short form anywhere in the document, but is provided for completeness. This is like the long-noshort-desc style, but the sort key is set to the short form. The name key is also set to the short form, but this is done by expanding


\glsxtrlongnoshortname

(Similarly for other longmodifier-noshortmodifier⟩ styles, unless indicated otherwise.) This command should only be redefined before abbreviations are defined, and fragile or formatting commands should be protected.

The description is set to the long form.

long
A synonym for long-noshort
long-noshort-sc
Like the long-noshort style but the short form (accessed through commands like \glsxtrshort) use \glsabbrvscfont. (This style was originally called long-sc. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.)
long-noshort-sm
Like long-noshort but redefines \glsabbrvfont to use \glsabbrvsmfont. (This style was originally called long-sm. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.)
long-noshort-em
This style is like long-noshort but redefines \glsabbrvfont to use \glsabbrvemfont. The long form isn’t emphasized. (This style was originally called long-em. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.)
long-em-noshort-em
New to version 1.04, this style is like long-noshort but redefines \glsabbrvfont to use \glsabbrvemfont, \glsfirstlongfont to use \glsfirstlongemfont and \glslongfont to use \glslongemfont. The short form isn’t used by commands like \gls, but can be obtained using \glsxtrshort. The related style long-em-noshort-em-noreg doesn’t set the regular attribute.

Top

4.4.2 Predefined Abbreviation Styles that Don’t Set the Regular Attribute

The following abbreviation styles will set the regular attribute to “false” if it has previously been set. If it hasn’t already been set, it’s left unset. Other attributes may also be set, depending on the style.

long-short
On first use, this style uses the format ⟨long⟩ (⟨short⟩). The inline and display full forms are the same. The sort key is set to the short form. The name is also set to the short form through


\glsxtrlongshortname

(Similarly for other longmodifier-shortmodifier⟩ styles, unless indicated otherwise.) Any redefinition of this command must come before the abbreviations are defined as it expands on definition. Make sure you protect any commands that shouldn’t be expanded. The long form can be referenced with \the\glslongtok and the short form can be referenced with \the\glsshorttok.

The description is set to the long form. The long and short forms are separated by \glsxtrfullsep. If you want to insert material within the parentheses (such as a translation), try the long-short-user style.

long-short-sc
Like long-short but redefines \glsabbrvfont to use \glsabbrvscfont.
long-short-sm
Like long-short but redefines \glsabbrvfont to use \glsabbrvsmfont.
long-short-em
Like long-short but redefines \glsabbrvfont to use \glsabbrvemfont.
long-em-short-em
New to version 1.04, this style is like long-short-em but redefines \glsfirstlongfont to use \glsfirstlongemfont.
long-only-short-only
New to version 1.17, this style only shows the long form on first use and only shows the short form on subsequent use. The inline full form \glsxtrfull shows the long form followed by the short form in parentheses. The name field is obtained from


\glsxtronlyname

Any redefinition of this command must come before the abbreviations are defined as it expands on definition. Make sure you protect any commands that shouldn’t be expanded. The long form can be referenced with \the\glslongtok and the short form can be referenced with \the\glsshorttok.

long-only-short-sc-only

New to version 1.48, this is like long-only-short-only but uses smallcaps for the short form. The name is obtained from:


\glsxtrsconlyname

long-only-short-only-desc
New to version 1.17, this style is like long-only-short-only but the user must supply the description. The name field is obtained from


\glsxtronlydescname

The sort value is obtained from:


\glsxtronlydescsort

Any redefinition of these commands must come before the abbreviations are defined as it expands on definition. Make sure you protect any commands that shouldn’t be expanded. The long form can be referenced with \the\glslongtok and the short form can be referenced with \the\glsshorttok.

long-only-short-sc-only-desc
New to version 1.48, this style is like long-only-short-only-desc but it uses smallcaps for the short form. The name is obtained from:


\glsxtrsconlydescname

This defaults to \glsxtronlydescname.

The sort value is obtained from:


\glsxtrsconlydescsort

This defaults to \glsxtronlydescsort.

long-em-noshort-em-noreg
New to version 1.17, this style is like long-em-noshort-em but doesn’t set the regular attribute.
long-short-user
This style was introduced in version 1.04. It’s like the long-short style but additional information can be inserted into the parenthetical material. This checks the value of the field given by


\glsxtruserfield

(which defaults to useri) using \ifglshasfield (provided by glossaries). If the field hasn’t been set, the style behaves like the long-short style and produces ⟨long⟩ (⟨short⟩) but if the field has been set, the contents of that field are inserted within the parentheses in the form ⟨long⟩ (⟨short⟩, ⟨field-value⟩). The format is governed by


\glsxtruserparen{text}{label}

where ⟨text⟩ is the short form (for the long-short-user style) or the long form (for the short-long-user style). This command first inserts a space using \glsxtrfullsep and then the parenthetical content (using \glsxtrparen). The description is set to


\glsuserdescription{long}{label}

The default definition ignores the ⟨label⟩ and encapsulates ⟨long⟩ with \glslonguserfont.

The name is obtained by expanding \glsxtrlongshortname (see above). The ⟨text⟩ argument includes the font formatting command, \glsfirstabbrvfont {short} in the case of the long-short-user style and \glsfirstlongfont{long} in the case of the short-long-user style.

For example:

     \setabbreviationstyle[acronym]{long-short-user}
     \newacronym{tug}{TUG}{\TeX\ User Group}
     \newacronym
      [user1={German Speaking \TeX\ User Group}]
      {dante}{DANTE}{Deutschsprachige Anwendervereinigung \TeX\ e.V}

On first use, \gls{tug} will appear as:

TeX User Group (TUG)

whereas \gls{dante} will appear as:

Deutschsprachige Anwendervereinigung TeX e.V (DANTE, German Speaking TeX User Group)

The short form is formatted according to


\glsabbrvuserfont{text}

and the plural suffix is given by


\glsxtrusersuffix

These may be redefined as appropriate. For example, if you want a smallcaps style, you can just set these commands to those used by the long-short-sc style:

     \renewcommand{\glsabbruserfont}[1]{\glsabbrvscfont{#1}}
     \renewcommand{\glsxtrusersuffix}{\glsxtrscsuffix}

long-noshort-noreg
This style is like long-noshort but it doesn’t set the regular attribute.
long-noshort-desc-noreg
This style is like long-noshort-desc but it doesn’t set the regular attribute.
long-short-desc
On first use, this style uses the format ⟨long⟩ (⟨short⟩). The inline and display full forms are the same. The name is set to the full form. The sort key is set to ⟨long⟩ (⟨short⟩). Before version 1.04, this was incorrectly set to the short form. If you want to revert back to this you can redefine


\glsxtrlongshortdescsort

For example:

     \renewcommand*{\glsxtrlongshortdescsort}{\the\glsshorttok}

The description must be supplied by the user. The long and short forms are separated by \glsxtrfullsep. The name field is obtained from


\glsxtrlongshortdescname

(Similarly for other longmodifier-shortmodifier-desc styles, unless indicated otherwise.) Any redefinition of this command must come before the abbreviations are defined as it expands on definition. Make sure you protect any commands that shouldn’t be expanded. The long form can be referenced with \the\glslongtok and the short form can be referenced with \the\glsshorttok.

long-short-sc-desc
Like long-short-desc but redefines \glsabbrvfont to use \glsabbrvscfont.
long-short-sm-desc
Like long-short-desc but redefines \glsabbrvfont to use \glsabbrvsmfont.
long-short-em-desc
Like long-short-desc but redefines \glsabbrvfont to use \glsabbrvemfont.
long-em-short-em-desc
New to version 1.04, this style is like long-short-em-desc but redefines \glsfirstlongfont to use \glsfirstlongemfont.
long-em-noshort-em-desc-noreg
New to version 1.17, this style is like long-em-noshort-em-desc but doesn’t set the regular attribute.
long-short-user-desc
New to version 1.04, this style is like a cross between the long-short-desc style and the long-short-user style. The display and inline forms are as for long-short-user and the name key is obtained from


\glsxtrlongshortuserdescname

Again, this should only be redefined before \newabbreviation (or \newacronym), and fragile and formatting commands need protecting.

The description key must be supplied in the optional argument of \newabbreviation (or \newacronym). The sort key is set to ⟨long⟩ (⟨short⟩) as per the long-short-desc style.

short-nolong-noreg
This is like short-nolong but doesn’t set the regular attribute.
nolong-short-noreg
This is like nolong-short but doesn’t set the regular attribute.
short-long
On first use, this style uses the format ⟨short⟩ (⟨long⟩). The inline and display full forms are the same. The name and sort keys are set to the short form. The description is set to the long form. The short and long forms are separated by \glsxtrfullsep. If you want to insert material within the parentheses (such as a translation), try the short-long-user style.

The name field is obtained from


\glsxtrshortlongname

(Similarly for other shortmodifier-longmodifier⟩ styles, unless indicated otherwise.) Any redefinition of this command must come before the abbreviations are defined as it expands on definition. Make sure you protect any commands that shouldn’t be expanded. The long form can be referenced with \the\glslongtok and the short form can be referenced with \the\glsshorttok.

short-sc-long
Like short-long but redefines \glsabbrvfont to use \glsabbrvscfont.
short-sm-long
Like short-long but redefines \glsabbrvfont to use \glsabbrvsmfont.
short-em-long
Like short-long but redefines \glsabbrvfont to use \glsabbrvemfont.
short-em-long-em
New to version 1.04, this style is like short-em-long but redefines \glsfirstlongfont to use \glsfirstlongemfont.
short-long-user
New to version 1.04. This style is like the long-short-user style but with the long and short forms switched. The parenthetical material is governed by the same command \glsxtruserparen, but the first argument supplied to it is the long form instead of the short form. The name field is obtained by expanding


\glsxtrshortlongname

Again, this should only be redefined before \newabbreviation (or \newacronym) and commands that should be expanded need to be protected. The description is set to \glsuserdescription{long}{label}.

short-nolong-desc-noreg
This style is like short-nolong-desc but it doesn’t set the regular attribute.
short-long-desc
On first use, this style uses the format ⟨short⟩ (⟨long⟩). The inline and display full forms are the same. The name is set to the full form. The description must be supplied by the user. The short and long forms are separated by \glsxtrfullsep. The name field is obtained from


\glsxtrshortlongdescname

(Similarly for other shortmodifier-longmodifier-desc styles, unless indicated otherwise.) Any redefinition of this command must come before the abbreviations are defined as it expands on definition. Make sure you protect any commands that shouldn’t be expanded. The long form can be referenced with \the\glslongtok and the short form can be referenced with \the\glsshorttok.

short-sc-long-desc
Like short-long-desc but redefines \glsabbrvfont to use \glsabbrvscfont.
short-sm-long-desc
Like short-long-desc but redefines \glsabbrvfont to use \glsabbrvsmfont.
short-em-long-desc
Like short-long-desc but redefines \glsabbrvfont to use \glsabbrvemfont.
short-em-long-em-desc
New to version 1.04, this style is like short-em-long-desc but redefines \glsfirstlongfont to use \glsfirstlongemfont.
short-long-user-desc
New to version 1.04, this style is like a cross between the short-long-desc style and the short-long-user style. The display and inline forms are as for short-long-user, but the name key is obtained from


\glsxtrshortlonguserdescname

Again, this should only be redefined before \newabbreviation (or \newacronym), and fragile and formatting commands need protecting.

The description key must be supplied in the optional argument of \newabbreviation (or \newacronym).

short-footnote
On first use, this style displays the short form with the long form as a footnote. This style automatically sets the nohyperfirst attribute to “true” for the supplied category, so the first use won’t be hyperlinked (but the footnote marker may be, if the hyperref package is used).

The inline full form uses the ⟨short⟩ (⟨long⟩) style. The name is set to the short form. The description is set to the long form. The name key is obtained by expanding:


\glsxtrfootnotename

(Similarly for other shortmodifier-modifierfootnote styles, unless indicated otherwise.) Again, this command should only be redefined before \newabbreviation (or \newacronym), and fragile or formatting commands should be protected from expansion.

As from version 1.05, all the footnote styles use:


\glsfirstlongfootnotefont{text}

to format the long form on first use or for the full form and


\glslongfootnotefont{text}

to format the long form elsewhere (for example, when used with \glsxtrlong).

As from version 1.07, all the footnote styles use:


\glsxtrabbrvfootnote{label}{long}

By default, this just does \footnote{long} (the first argument is ignored). For example, to make the footnote text link to the relevant place in the glossary:

     \renewcommand{\glsxtrabbrvfootnote}[2]{%
       \footnote{\glshyperlink[#2]{#1}}%
     }

or to include the short form with a hyperlink:

     \renewcommand{\glsxtrabbrvfootnote}[2]{%
       \footnote{\glshyperlink[\glsfmtshort{#1}]{#1}: #2}%
     }

Note that I haven’t used commands like \glsxtrshort to avoid interference (see §2.4 Entry Display Style Modifications and §2.8 Nested Links).

footnote
A synonym for short-footnote.
short-sc-footnote
Like short-footnote but redefines \glsabbrvfont to use \glsabbrvscfont. (This style was originally called footnote-sc. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.)
short-sc-footnote
Like short-footnote but redefines \glsabbrvfont to use \glsabbrvsmfont. (This style was originally called footnote-sm. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.)
short-em-footnote
Like short-footnote but redefines \glsabbrvfont to use \glsabbrvemfont. (This style was originally called footnote-em. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.)
short-footnote-desc
(New to v1.42.) This is similar to short-footnote, but the description must be supplied by the user. The name field is obtained from:


\glsxtrfootnotedescname

which defaults to ⟨short⟩ followed by ⟨long⟩ in parentheses, and the sort field is obtained from:


\glsxtrfootnotedescsort

which defaults to just the short form. (Similarly for other shortmodifier-[post]footnote-desc styles, unless indicated otherwise.)

Any redefinition of these commands must come before the abbreviations are defined as it expands on definition. Make sure you protect any commands that shouldn’t be expanded. The long form can be referenced with \the\glslongtok and the short form can be referenced with \the\glsshorttok.

footnote-desc
A synonym for short-footnote-desc.
short-sc-footnote-desc
Like short-footnote-desc but redefines \glsabbrvfont to use \glsabbrvscfont.
short-sm-footnote-desc
Like short-footnote-desc but redefines \glsabbrvfont to use \glsabbrvsmfont.
short-em-footnote-desc
Like short-footnote-desc but redefines \glsabbrvfont to use \glsabbrvemfont.
short-postfootnote
This is similar to the short-footnote style but doesn’t modify the category attribute. Instead it changes \glsxtrpostlinkcategory to insert the footnote after the link-text on first use. This will also defer the footnote until after any following punctuation character that’s recognised by \glsxtrifnextpunc.

The inline full form uses the ⟨short⟩ (⟨long⟩) style. The name is set to the short form. The description is set to the long form. Note that this style will change \glsxtrfull (and its variants) so that it fakes non-first use. (Otherwise the footnote would appear after the inline form.)

postfootnote
A synonym for short-postfootnote.
short-sc-postfootnote
Like short-postfootnote but redefines \glsabbrvfont to use \glsabbrvscfont. (This style was originally called postfootnote-sc. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.)
short-sm-postfootnote
Like short-postfootnote but redefines \glsabbrvfont to use \glsabbrvsmfont. (This style was originally called postfootnote-sm. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.)
short-em-postfootnote
Like short-postfootnote but redefines \glsabbrvfont to use \glsabbrvemfont. (This style was originally called postfootnote-em. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.)
short-postfootnote-desc
(New to v1.42.) This is similar to short-postfootnote, but the description must be supplied by the user. The name and sort are set as for short-footnote-desc.
postfootnote-desc
A synonym for short-postfootnote-desc.
short-sc-postfootnote-desc
Like short-postfootnote-desc but redefines \glsabbrvfont to use \glsabbrvscfont.
short-sm-postfootnote-desc
Like short-postfootnote-desc but redefines \glsabbrvfont to use \glsabbrvsmfont.
short-em-postfootnote-desc
Like short-postfootnote-desc but redefines \glsabbrvfont to use \glsabbrvemfont.
short-postlong-user
This style was introduced in version 1.12. It’s like the short-long-user style but defers the parenthetical material to after the link-text. This means that you don’t have such a long hyperlink (which can cause problems for the DVI LaTeX format) and it also means that the user supplied material can include a hyperlink to another location. The name key is obtained from \glsxtrshortlongname.
short-postlong-user-desc
This style was introduced in version 1.12. It’s like the above short-postlong-user style but the description must be specified. The name is obtained from \glsxtrshortlonguserdescname.
long-postshort-user
This style was introduced in version 1.12. It’s like the above short-postlong-user style but the long form is shown first and the short form is in the parenthetical material (as for long-short-user) style.
long-postshort-user-desc
This style was introduced in version 1.12. It’s like the above long-postshort-user style but the description must be specified. The name is obtained from \glsxtrlongshortuserdescname.
long-postshort-sc-user
This style (new to v1.48) is like long-postshort-user but uses smallcaps for the short form.
long-postshort-sc-user-desc
This style (new to v1.48) is like long-postshort-user-desc but uses smallcaps for the short form.
long-hyphen-short-hyphen
This style (new to v1.17) is designed to work with the markwords category attribute. The full form is formatted using


\glsxtrlonghyphenshort{label}{long}{short}{insert}

where ⟨insert⟩ is the inserted material provided in the final optional argument of commands like \insert. If ⟨insert⟩ start with a hyphen, then this locally redefines \glsxtrwordsep to a hyphen, which means that if the markwords attribute is set then the long form will become hyphenated. (If this attribute isn’t set, there’s no alteration to the way the long form is displayed.) The name key is obtained from \glsxtrlongshortname.

Unlike the other ⟨long⟩ (⟨short⟩) type of styles, such as long-short, this style also repeats the insertion in the parenthetical part, so that the first use form is:

\glsfirstlonghyphenfont{long}insert⟩ (\glsfirstabbrvhyphenfont{short}insert⟩)

The space before the parenthetical material is actually given by \glsxtrfullsep{label} which defaults to a space. The ⟨insert⟩ may be moved into the formatting commands according to the conditional \ifglsxtrinsertinside.

For example, if ip is defined using:

     \glssetcategoryattribute{english}{markwords}{true}
     \setabbreviationstyle[english]{long-hyphen-short-hyphen}
     \newabbreviation[category=english]{ip}{IP}{Internet Protocol}

then

     \gls{ip}[-Adressen]

will do

Internet-Protocol-Adressen (IP-Adressen)

on first use, whereas

     \gls{ip}[ Address]

will do

Internet Protocol Address (IP Address)

on first use.

Note that the hyphenation isn’t applied when using commands like \glsxtrlong. This means that

     \glsxtrlong{ip}[-Adressen]

will do

Internet Protocol-Adressen

If the markwords attribute hadn’t been set, then the first use of

     \gls{ip}[-Adressen]

would do

Internet Protocol-Adressen (IP-Adressen)

instead.

If the inserted material ⟨insert⟩ is likely to contain commands like \gls, then use long-hyphen-postshort-hyphen instead to avoid nested links.

If you want the short version in small-caps, you can just redefine \glsabbrvhyphenfont and \glsxtrhyphensuffix to use the small-caps versions. For example:

     \renewcommand{\glsabbrvhyphenfont}{\glsabbrvscfont}
     \renewcommand{\glsxtrhyphensuffix}{\glsxtrscsuffix}

Similarly for other font-changing variations.

long-hyphen-noshort-desc-noreg
New to version 1.17, this style is like long-hyphen-short-hyphen-desc except that the parenthetical part is omitted and the long form is displayed on subsequent use. The short form can be accessed with \glsxtrshort but just uses the default abbreviation font. There’s no regular version of this style as the regular form doesn’t have the flexibility to deal with the hyphen switch. The name is obtained from \glsxtrlongnoshortdescname.
long-hyphen-noshort-noreg
New to version 1.17, this style is like long-hyphen-noshort-desc-noreg but the name is set to the short form and the description is set to the long form.
long-hyphen-short-hyphen-desc

New to version 1.17. This is similar to long-hyphen-short-hyphen but the user supplies the description. The name is obtained from \glsxtrlongshortdescname.

long-hyphen-postshort-hyphen

New to version 1.17. This is similar to long-hyphen-short-hyphen but the inserted and parenthetical material are moved to the post-link hook. On first use, \gls{label}[insert] will do
\glsxtrlonghyphen{long}{label}{insert}\glsxtrposthyphenshort {label}insert
where


\glsxtrposthyphenshort{label}insert

is in the post-link hook. This uses the format:
insert⟩ (\glsfirstabbrvhyphenfont{short}isnert⟩)

The singular short form is always used here, even with \glspl. (Unlike long-hyphen-long-hyphen.)

The part in the link-text on first use:


\glsxtrlonghyphen{long}{label}{insert}

checks if ⟨insert⟩ starts with a hyphen. If it does, then \glsxtrwordsep is locally redefined to a hyphen. This command only uses ⟨insert⟩ to test if it starts with a hyphen. The actual insertion code isn’t typeset until the post-link hook and it’s also localised, which means that you can use commands like \gls in ⟨insert⟩ for this style without causing nested hyperlinks, but only for commands like \gls.

Don’t use \gls in the ⟨insert⟩ part for commands like \glsxtrfull, \glsxtrshort or \glsxtrlong.

The inline full display format used by commands like \glsxtrfull behaves differently to the first use of \gls with this style. It’s better to use \glsreset{label}\gls{label} if you want to ensure the full format.

long-hyphen-postshort-hyphen-desc

New to version 1.17. This is similar to long-hyphen-postshort-hyphen but the user supplies the description. The name is obtained from \glsxtrlongshortdescname.

short-hyphen-long-hyphen
This style (new to v1.17) is like long-hyphen-short-hyphen, except that the short form is displayed first followed by the long form in parentheses. The full form is formatted using


\glsxtrshorthyphenlong{label}{short}{long}{insert}

which behaves in an analogous way to \glsxtrlonghyphenshort. The name is obtained from \glsxtrshortlongname.

short-hyphen-long-hyphen-desc

New to version 1.17. This is similar to short-hyphen-long-hyphen but the user supplies the description. The name is obtained from \glsxtrshortlongdescname.

short-hyphen-postlong-hyphen
This style (new to v1.17) is like long-hyphen-postshort-hyphen, but the short form is displayed first followed by the long form in parentheses. On first use, \gls{label}[insert] will do
\glsxtrshorthyphen{short}{label}{insert}\glsxtrposthyphenlong {label}insert
where


\glsxtrposthyphenlong{label}insert

is in the post-link hook. These commands behave in an analogous manner to those used with long-hyphen-postshort-hyphen. The name is obtained from \glsxtrshortlongname.

Don’t use \gls in the ⟨insert⟩ part for commands like \glsxtrfull, \glsxtrshort or \glsxtrlong.

The inline full display format used by commands like \glsxtrfull behaves differently to the first use of \gls with this style. It’s better to use \glsreset{label}\gls{label} if you want to ensure the full format.

short-hyphen-postlong-hyphen-desc

New to version 1.17. This is similar to short-hyphen-postlong-hyphen but the user supplies the description. The name is obtained from \glsxtrshortlongdescname.

Top

4.5 Defining New Abbreviation Styles

New abbreviation styles may be defined using:


\newabbreviationstyle{name}{setup}{fmts}

where ⟨name⟩ is the name of the new style (as used in the mandatory argument of \setabbreviationstyle). This is similar but not identical to the glossaries package’s \newacronymstyle command.

You can’t use styles defined by \newacronymstyle with glossaries-extra unless you have reverted \newacronym back to its generic definition from glossaries (using \RestoreAcronyms). The acronym styles from the glossaries package can’t be used with abbreviations defined with \newabbreviation.

The ⟨setup⟩ argument deals with the way the entry is defined and may set attributes for the given abbreviation category. This argument should redefine


\CustomAbbreviationFields

to set the entry fields including the name (defaults to the short form if omitted), sort, first, firstplural. Other fields may also be set, such as text, plural and description.

\CustomAbbreviationFields is expanded by \newabbreviation so take care to protect commands that shouldn’t be expanded.

For example, the long-short style has the following in ⟨setup⟩:

  \renewcommand*{\CustomAbbreviationFields}{%
    name={\protect\glsabbrvfont{\the\glsshorttok}},
    sort={\the\glsshorttok},
    first={\protect\glsfirstlongfont{\the\glslongtok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvfont{\the\glsshorttok}}},%
    firstplural={\protect\glsfirstlongfont{\the\glslongpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvfont{\the\glsshortpltok}}},%
    plural={\protect\glsabbrvfont{\the\glsshortpltok}},%
    description={\the\glslongtok}}%

Note that the first and firstplural are set even though they’re not used by \gls.

The basic styles, such as long-short, use commands like \glsabbrvfont (which are redefined whenever the style formatting is set) within \CustomAbbreviationFields. Other styles, such as long-em-short-em directly use their own custom commands, such as \glsabbrvemfont. With these styles, commands like \glsabbrvfont still need to be defined as appropriate in the ⟨fmts⟩ argument even if they’re not used within \CustomAbbreviationFields.

The ⟨setup⟩ argument may also redefine


\GlsXtrPostNewAbbreviation

which can be used to assign attributes. (This will automatically be initialised to do nothing.)

For example, the short-footnote includes the following in ⟨setup⟩:

  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glssetattribute{\the\glslabeltok}{nohyperfirst}{true}%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%

This sets the nohyperfirst attribute to “true”. It also unsets the regular attribute if it has previously been set. Note that the nohyperfirst attribute doesn’t get unset by other styles, so take care not to switch styles for the same category.

You can access the short, long, short plural and long plural values through the following token registers.

Short value (defined by glossaries):


\glsshorttok

Short plural value (defined by glossaries-extra):


\glsshortpltok

(This may be the default value or, if provided, the value provided by the user through the shortplural key in the optional argument of \newabbreviation.)

Long value (defined by glossaries):


\glslongtok

Long plural value (defined by glossaries-extra):


\glslongpltok

(This may be the default value or, if provided, the value provided by the user through the longplural key in the optional argument of \newabbreviation.)

The short or long values may be modified by attributes (such as markwords). The above registers reflect the modification. If you want to access the original (unmodified) short or long form (as provided in the final two arguments of \newabbreviation), then use the commands:


\glsxtrorgshort

for the short form and


\glsxtrorglong

for the long form. (These may be useful for the sort key to avoid any formatting that may be added by the attribute setting.)

There are two other registers available that are defined by glossaries:


\glslabeltok

which contains the entry’s label and


\glskeylisttok

which contains the values provided in the optional argument of \newabbreviation.

Remember put \the in front of the register command as in the examples above. The category label can be access through the command (not a register):


\glscategorylabel

This may be used inside the definition of \GlsXtrPostNewAbbreviation.

If you want to base a style on an existing style, you can use


\GlsXtrUseAbbrStyleSetup{name}

where ⟨name⟩ is the name of the existing style. For example, the long-noshort-sc-desc style simply does

\GlsXtrUseAbbrStyleSetup{long-noshort-desc}

within ⟨setup⟩.

The ⟨fmts⟩ argument deals with the way the entry is displayed in the document. This argument should redefine the following commands.

The default suffix for the plural short form (if not overridden by the shortplural key):


\abbrvpluralsuffix

(Note that this isn’t used for the plural long form, which just uses the regular \glspluralsuffix.)

The font used for the short form on first use or in the full forms:


\glsfirstabbrvfont{text}

The font used for the short form on subsequent use or through commands like \glsxtrshort:


\glsabbrvfont{text}

The font used for the long form on first use or in the full forms:


\glsfirstlongfont{text}

The font used for the long form in commands like \glsxtrlong use:


\glslongfont{text}

Display full form singular no case-change (used by \gls on first use for abbreviations without the regular attribute set):


\glsxtrfullformat{label}{insert}

Display full form singular first letter converted to upper case (used by \Gls on first use for abbreviations without the regular attribute set):


\Glsxtrfullformat{label}{insert}

Display full form plural no case-change (used by \glspl on first use for abbreviations without the regular attribute set):


\glsxtrfullplformat{label}{insert}

Display full form plural first letter converted to upper case (used by \Glspl on first use for abbreviations without the regular attribute set):


\Glsxtrfullplformat{label}{insert}

In addition ⟨fmts⟩ may also redefine the following commands that govern the inline full formats. If the style doesn’t redefine them, they will default to the same as the display full forms.

Inline singular no case-change (used by \glsentryfull, \glsxtrfull and \GLSxtrfull):


\glsxtrinlinefullformat{label}{insert}

Inline singular first letter converted to upper case (used by \Glsentryfull and \Glsxtrfull):


\Glsxtrinlinefullformat{label}{insert}

Inline plural no case-change (used by \glsentryfullpl, \glsxtrfullpl and \GLSxtrfullpl):


\glsxtrinlinefullplformat{label}{insert}

Inline plural first letter converted to upper case (used by \Glsentryfullpl and \Glsxtrfullpl):


\Glsxtrinlinefullplformat{label}{insert}

(New to version 1.17.) You can also modify the way the subsequent use is formatted by redefining the following four commands, but these won’t be used for abbreviations with the regular attribute set. If the style doesn’t redefine these commands, the default values are used.

Singular with no case-change:


\glsxtrsubsequentfmt{label}{insert}

Singular with first letter upper case:


\Glsxtrsubsequentfmt{label}{insert}

Plural with no case-change:


\glsxtrsubsequentplfmt{label}{insert}

Plural with first letter upper case:


\Glsxtrsubsequentplfmt{label}{insert}

If you want to provide support for glossaries-accsupp use the following \glsaccessxxx⟩ commands (§13.2 Accessibility Support) within the definitions of \glsxtrfullformat etc instead of the analogous \glsentryxxx⟩ commands. (If you don’t use glossaries-accsupp, they will just do the corresponding \glsentryxxx⟩ command.)

For example, the short-long style has the following in ⟨fmts⟩:

  \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}%
  \renewcommand*{\glsabbrvfont}[1]{\glsabbrvdefaultfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfont{\glsaccesslongpl{##1}}}%
  }%

Since the inline full commands aren’t redefined, they default to the same as the display versions.

If you want to base a style on an existing style, you can use


\GlsXtrUseAbbrStyleFmts{name}

within ⟨fmts⟩, where ⟨name⟩ is the name of the existing style. For example, the long-short-desc style has the following in ⟨fmts⟩:

  \GlsXtrUseAbbrStyleFmts{long-short}%

Here’s an example of an abbreviation style that’s based on long-short that displays the short form within \textsf:

\newabbreviationstyle
{custom-sf}% label
{% setup
  \GlsXtrUseAbbrStyleSetup{short-long}%
}%
{% fmts
  \GlsXtrUseAbbrStyleFmts{short-long}%
  \renewcommand*{\glsabbrvfont}[1]{\textsf{##1}}%
}

Note that this wouldn’t work if it was instead based on one of the modified versions such as short-sc-long as they explicitly use their own formatting commands, such as \glsabbrvemfont. The base styles, such as short-long, use the more generic \glsabbrvfont etc which makes them easier to adapt than the modified styles.

For further details, see the “Abbreviations” section in the documented code (glossaries-extra-code.pdf).

Top

5. Entries in Sectioning Titles, Headers, Captions and Contents

The glossaries user manual cautions against using commands like \gls in chapter or section titles. The principle problems are:

Similar problems can also occur with captions (except for the page header and bookmark issues).

Top

5.1 Simplistic Approach

To get around all these problems, the glossaries user manual recommends using the expandable non-hyperlink commands, such as \glsentrytext (for regular entries) or \glsentryshort (for abbreviations). This is the simplest solution, but doesn’t allow for special formatting that’s applied to the entry through commands like \glstext or \glsxtrshort. This means that if, for example, you are using one of the abbreviation styles that uses \textsc then the short form displayed with \glsentryshort won’t use small caps. If you only have one abbreviation style in use, you can explicitly enclose \glsentryshort{label} in the argument of \glsabbrvfont, like this:

\chapter{A Chapter about \glsabbrvfont{\glsentryshort{html}}}

Or, if you are using hyperref:

\chapter{A Chapter about
\texorpdfstring{\glsabbrvfont{\glsentryshort{html}}}{\glsentryshort{html}}}

Since this is a bit cumbersome, you might want to define a new command to do this for you. However, if you have mixed styles this won’t work as commands like \gls and \glsxtrshort redefine \glsabbrvfont to match the entry’s style before displaying it. In this case, the above example doesn’t take into account the shifting definitions of \glsabbrvfont and will use whatever happens to be the last abbreviation style in use. More complicated solutions interfere with the upper casing used by the standard page styles that display the chapter or section title in the page header using \MakeUppercase.

The glossaries-extra package tries to resolve this by modifying \markright and \markboth and \@starttoc. If you don’t like this change, you can restore their former definitions using


\glsxtrRevertMarks

If you only want to restore \@starttoc you can use:


\glsxtrRevertTocMarks

If you restore the header or table of contents commands, you’ll have to use the glossaries manual’s recommendations of either simply using \glsentryshort (as above) or use the sectioning command’s option argument to provide an alternative for the table of contents and page header. For example:

\chapter[A Chapter about \glsentryshort{html}]{A Chapter about \gls{html}}

Alternatively, you need to find a way to insert \glsxtrmarkhook and \@glsxtrinmark at the start of the header or table of contents either scoped or afterwards cancelled with \@glsxtrnotinmark and \glsxtrrestoremarkhook.

If you don’t revert the mark commands back with \glsxtrRevertMarks, you can use the commands described below in the argument of sectioning commands. You can still use them even if the mark commands have been reverted, but only where they don’t conflict with the page style.

Top

5.2 New Commands Designed for Chapter/Section Headings

The commands listed below are designed for use in chapter or section headings. There are still limitations, but they provide a better solution. They all use \texorpdfstring if hyperref has been loaded so that the expandable non-formatted version is added to the PDF bookmarks. Note that since the commands that convert the first letter to upper case aren’t expandable, the non-case-changing version is used for the bookmarks. If the required field contains non-expandable (robust or fragile) commands that cause a problem for the bookmarks then \texorpdfstring will be needed as appropriate in that field. (Take care if the field has its value expanded before being assigned.)

These commands essentially behave as though you have used \glsxtrshort, \glstext etc with the options noindex and hyper=false. The text produced won’t be converted to upper case in the page headings by default. If you want the text converted to upper case you need to set the headuc attribute to “true” for the appropriate category.

If you use one of the \textsc styles, be aware that the default fonts don’t provide bold small-caps or italic small-caps. This means that if the chapter or section title style uses bold, this may override the small-caps setting, in which case the abbreviation will just appear as lower case bold. If the heading style uses italic, the abbreviation may appear in upright small-caps, even if you have set the headuc attribute since the all-capitals form still uses \glsabbrvfont. You may want to consider using the slantsc package in this case.

Display the short form:


\glsfmtshort{label}

Display the plural short form:


\glsfmtshortpl{label}

First letter upper case singular short form:


\Glsfmtshort{label}

(No case-change applied to PDF bookmarks.)

First letter upper case plural short form:


\Glsfmtshortpl{label}

(No case-change applied to PDF bookmarks.)

All caps singular short form:


\GLSfmtshort{label}

(No case-change applied to PDF bookmarks.)

All caps plural short form:


\Glsfmtshortpl{label}

(No case-change applied to PDF bookmarks.)

Display the long form:


\glsfmtlong{label}

Display the plural long form:


\glsfmtlongpl{label}

First letter upper case singular long form:


\Glsfmtlong{label}

(No case-change applied to PDF bookmarks.)

First letter upper case plural long form:


\Glsfmtlongpl{label}

(No case-change applied to PDF bookmarks.)

All caps singular long form:


\GLSfmtlong{label}

(No case-change applied to PDF bookmarks.)

All caps plural long form:


\GLSfmtlongpl{label}

(No case-change applied to PDF bookmarks.)

There are similar commands for the full form, but note that these use the inline full form, which may be different from the full form used by \gls. The PDF version has to be a simple fully expandable command, so one of two commands that are unrelated to the style is used instead:


\glspdffmtfull{label}

for the singular form or:


\glspdffmtfullpl{label}

for the full form. These simply do the long form followed by the short form in parentheses.

Display the full form:


\glsfmtfull{label}

Display the plural full form:


\glsfmtfullpl{label}

First letter upper case singular full form:


\Glsfmtfull{label}

(No case-change applied to PDF bookmarks.)

First letter upper case plural full form:


\Glsfmtfullpl{label}

(No case-change applied to PDF bookmarks.)

All caps singular full form:


\GLSfmtfull{label}

(No case-change applied to PDF bookmarks.)

All caps plural full form:


\GLSfmtfullpl{label}

(No case-change applied to PDF bookmarks.)

There are also equivalent commands for the value of the text field:


\glsfmttext{label}

First letter converted to upper case:


\Glsfmttext{label}

(No case-change applied to PDF bookmarks.)

All caps:


\GLSfmttext{label}

(No case-change applied to PDF bookmarks.)

The plural equivalents:


\glsfmtplural{label}

First letter upper case:


\Glsfmtplural{label}

and all caps:


\GLSfmtplural{label}

Likewise for the value of the name field:


\glsfmtname{label}

First letter converted to upper case:


\Glsfmtname{label}

(No case-change applied to PDF bookmarks.)

All caps:


\GLSfmtname{label}

(No case-change applied to PDF bookmarks.)

Similarly for the value of the first field:


\glsfmtfirst{label}

First letter converted to upper case:


\Glsfmtfirst{label}

(No case-change applied to PDF bookmarks.)

All caps:


\GLSfmtfirst{label}

(No case-change applied to PDF bookmarks.)

The plural equivalents:


\glsfmtfirstpl{label}

First letter upper case:


\Glsfmtfirstpl{label}

and all caps:


\GLSfmtfirstpl{label}

Top

6. Multi (or Compound) Entries

Nested entries (where the entry definition references other entries) are discussed in §2.8 Nested Links. This chapter deals with occasions where a term or phrase may consist of multiple sub-terms that are independently defined. (Examples in §6.1.5 Example: Skipping Elements (Fragment Element) and §6.1.6 Example: Skipping Elements (Prefix and Post-Link Hooks) provide workarounds for nested entries.)

For example, the names of bacteria, such as Clostridium botulinum and Clostridium perfringens, are made up of the genus (for example, Clostridium) and the species (for example, botulinum or perfringens). The genus is often abbreviated after first use. For example, C. botulinum. However, if the name is defined as a single term consisting of both the genus and species then it’s not possible to apply the abbreviation when a different species with the same genus is used.

Consider the following document:

\documentclass{article}
\usepackage{glossaries-extra}
\setabbreviationstyle{long-only-short-only}
\newabbreviation{cbot}{C. botulinum}{Clostridium botulinum}
\newabbreviation{cperf}{C. perfringens}{Clostridium perfringens}
\begin{document}
\gls{cbot}, \gls{cbot}, \gls{cperf}.
\end{document}

The result is:
Clostridium botulinum, C. botulinum, Clostridium perfringens.
However, it should more typically be:
Clostridium botulinum, C. botulinum, C. perfringens.
In this case, the genus should actually be a separate definition:

\documentclass{article}
\usepackage{glossaries-extra}
\setabbreviationstyle{long-only-short-only}
\newabbreviation{clostridium}{C.}{Clostridium}
\newglossaryentry{botulinum}{name={botulinum},description={}}
\newglossaryentry{perfringens}{name=perfringens,description={}}
\begin{document}
\gls{clostridium} \gls{botulinum},
\gls{clostridium} \gls{botulinum},
\gls{clostridium} \gls{perfringens}.
\end{document}

This is quite awkward to write. This chapter describes how to provide a shortcut for this kind of construct. Each term should be defined as normal (as in the above example), and a “multi-entry” label is then defined with the list of labels of the entries that need to be referenced. This is done with the command:


\multiglossaryentry[options]{multi-label}[main label]{label list}

where ⟨multi-label⟩ is the new label and ⟨label list⟩ is the list of labels (corresponding to entries that have already been defined).

The ⟨main label⟩ may be omitted, in which case the main label will be assumed to be the final element in ⟨label list⟩. If ⟨main label⟩ is present, it must also be listed in ⟨label list⟩. This is described in more detail in §6.2 Main and Other Elements.

The ⟨options⟩ are a comma-separated list of options to override the current settings and are described in §6.9 Multi-Entry Settings.

The earlier example can now be modified to include the following:

\multiglossaryentry{cbot}{clostridium,botulinum}
\multiglossaryentry{cperf}{clostridium,perfringens}

These commands must come after the definitions of clostridium, botulinum and perfringens.

Once defined, a multi-entry set can be referenced using commands like:


\mgls[options]{multi-label}[insert]

This command essentially does \gls{label} for each item in the ⟨label list⟩ (with separators, see §6.4 Separators). If the final optional argument ⟨insert⟩ is provided, it will be applied to the final (non-skipped) element in the list. So the document body in the above example, can be rewritten as:

\mgls{cbot}, \mgls{cbot}, \mgls{cperf}.

There are some variants of \mgls listed in §6.11 Variants of mgls. The available ⟨options⟩ are listed in §6.10 mgls Options. They are applied after the \multiglossaryentry options and will override settings for the individual entries.

You can’t use ⟨multi-label⟩ in commands like \gls as this label represents a set of entry labels not a single entry.

The \multiglossaryentry command will generate an error if the label has already been defined as a multi-entry. To do nothing if a multi-entry already exists, use:


\providemultiglossaryentry[options]{multi-label}[main label]{label list}

Notes and associated commands applying to \multiglossaryentry also apply to \providemultiglossaryentry unless otherwise stated.

\multiglossaryentry may be placed anywhere after the ⟨label list⟩ entries have been defined. A multi-entry label can’t be referenced (with commands like \mgls) before it has been defined.

There is limited support for docdef=true. The multi-entry definition can be picked up from the aux file on the next run to allow cross-references in any glossaries that occur at the start of the document. Any changes made with commands like \mglsSetMain won’t be carried over to the next run.

By default \multiglossaryentry will be localised to the current scope. If you want to globally define a multi-entry you need to first switch on global definitions with:


\multiglossaryentryglobaltrue

To switch back to local definitions use:


\multiglossaryentryglobalfalse

If you want to change the multi-entry options (locally) you can use:


\mglsSetOptions{multi-label}{new-options}

This removes the original options. If you want to (locally) append to the existing options, use:


\mglsAddOptions{multi-label}{new-options}

Note that \multiglossaryentry doesn’t make any adjustments to the component entries. You will need to use the parent key when you define the entries if you want a hierarchical structure in your glossary. (See the example in §6.1.1 Example: Hierarchical.)

If you don’t want the other elements in the glossary, you can suppress the indexing with indexothers=false (§6.9.1 Indexing) or put them in an ignored glossary. For example:

\newignoredglossary{common}
\newabbreviation[type=common]{clostridium}{C.}{Clostridium}

The ⟨multi-label⟩ can’t be used in commands like \gls since the label refers to a set of entry labels not to an individual entry. Similarly, an individual entry label can’t be used in commands like \mgls. It is possible (although potentially confusing) to use the same label for a multi-entry as for an individual entry (see the example in §6.1.6 Example: Skipping Elements (Prefix and Post-Link Hooks)). Context will determine which is meant, except in the case of the cross-referencing fields (see, seealso and alias) where the cross-referenced label will first be tested if it’s a known multi-entry label.

If you don’t want to have to keep track of which labels refer to multi-entries and which refer to individual entries you can use:


\GlsXtrMglsOrGls{mgls cs}{gls cs}modifier[options]{label}[insert]

where ⟨mgls cs⟩ is the \mgls-like command to use if ⟨label⟩ has been defined as a multi-entry and ⟨gls cs⟩ is the \gls-like command to use otherwise. The ⟨modifier⟩ may be omitted, otherwise it is the modifier that may be used with \mgls or \gls (*, + or the character identified with \GlsXtrSetAltModifier). The modifier and remaining options are passed to the relevant command (⟨mgls cs⟩ or ⟨gls cs⟩).

You may prefer to define your own shortcut commands for common combinations. For example:

\newcommand{\ac}{\GlsXtrMglsOrGls{\mgls}{\gls}}
\newcommand{\acpl}{\GlsXtrMglsOrGls{\mglsmainpl}{\glspl}}
\newcommand{\Ac}{\GlsXtrMglsOrGls{\Mgls}{\Gls}}
\newcommand{\Acpl}{\GlsXtrMglsOrGls{\Mglsmainpl}{\Glspl}}

Top

6.1 Examples

Top

6.1.1 Example: Hierarchical

Bacteria names are represented by the genus (for example, Clostridium) followed by the species (for example, botulinum). This example has the genus as a parent of the species.

\documentclass{article}
\usepackage[colorlinks]{hyperref}
\usepackage[stylemods=bookindex,style=bookindex]{glossaries-extra}
\makeglossaries
\newcommand{\latinname}[1]{\emph{#1}}
\glssetcategoriesattributes
 {genus,species}{textformat,glossnamefont}{latinname}
\setabbreviationstyle[genus]{long-only-short-only-desc}
\newabbreviation
 [category=genus,description={}]
 {clostridium}{C.}{Clostridium}
\newglossaryentry{botulinum}{name=botulinum,category=species,
  description={},parent=clostridium}
\newglossaryentry{perfringens}{name=perfringens,category=species,
  description={},parent=clostridium}
\newglossaryentry{tetani}{name=tetani,category=species,
  description={},parent=clostridium}
\multiglossaryentry{cbot}{clostridium,botulinum}
\multiglossaryentry{cperf}{clostridium,perfringens}
\multiglossaryentry{ctet}{clostridium,tetani}
\multiglossaryentrysetup{indexothers=false,hyper=allmain}
\begin{document}
First use:
\mgls{cbot}, \mgls{cperf}, \mgls{ctet}.
Next use:
\mgls{cbot}, \mgls{cperf}, \mgls{ctet}.
\printglossaries
\end{document}

This suppresses the indexing of the non-main elements (in this case, the genus). However the genus is included in the glossary (without a number list) because it’s the parent of the species (which are indexed).

The hyper=allmain option makes the entire content of each \mgls a hyperlink to the main entry in the glossary. The resulting document text (before the glossary) is:

First use: Clostridium botulinum, C. perfringens, C. tetani.

Next use: C. botulinum, C. perfringens, C. tetani.

Top

6.1.2 Example: Suffix

This example has a minor modification to the previous one. In this case the multi-entries are defined with a suffix:

\multiglossaryentry[firstsuffix=botulism]{cbot}{clostridium,botulinum}
\multiglossaryentry[firstsuffix={gas gangrene}]{cperf}{clostridium,perfringens}
\multiglossaryentry[firstsuffix=tetanus]{ctet}{clostridium,tetani}

The rest of the document is as in §6.1.1 Example: Hierarchical. The document text is now:

First use: Clostridium botulinum (botulism), C. perfringens (gas gangrene), C. tetani (tetanus).

Next use: C. botulinum, C. perfringens, C. tetani.

Top

6.1.3 Example: Category Suffix

This is an alternative to the previous example. Instead of storing the extra information in the firstsuffix key, the information is stored in the user1 key of the last element (the species). A category suffix is used to look up the field and append it.

\newglossaryentry{botulinum}{name=botulinum,category=species,
  user1={botulism},
  description={},parent=clostridium}
\newglossaryentry{perfringens}{name=perfringens,category=species,
  user1={gas gangrene},
  description={},parent=clostridium}
\newglossaryentry{tetani}{name=tetani,category=species,
  user1={tetanus},
  description={},parent=clostridium}
\mglsdefcategorysuffix{bacteria}{%
 \mglsisfirstuse
 {\glsxtrifhasfield{useri}{\mglslastelementlabel}{ (\glscurrentfieldvalue)}{}}%
 {}%
}
\multiglossaryentry[category=bacteria]{cbot}{clostridium,botulinum}
\multiglossaryentry[category=bacteria]{cperf}{clostridium,perfringens}
\multiglossaryentry[category=bacteria]{ctet}{clostridium,tetani}

The result is the same as the previous example.

Top

6.1.4 Example: Separators

The first example (§6.1.1 Example: Hierarchical) can be modified so that the species are also abbreviations. In this case, the separators are modified to suppress the space (\relax) if both the genus and species are abbreviated, or to use a non-breaking space ~ between the genus short form (shown on subsequent use) and the species long form (shown on first use). If the genus is showing the long form (first use) then a normal space is used.

Note that the separator attributes apply to the category of the element before the separator (not to the multi-entry category).

\glssetcategoryattribute{genus}{combinedfirstsepfirst}{\space}
\glssetcategoryattribute{genus}{combinedfirstsep}{\space}
\glssetcategoryattribute{genus}{combinedsepfirst}{~}
\glssetcategoryattribute{genus}{combinedsep}{\relax}
\setabbreviationstyle[species]{long-only-short-only-desc}
\newabbreviation[category=species,
  description={},parent=clostridium]{botulinum}{bot.}{botulinum}
\newabbreviation[category=species,
  description={},parent=clostridium]{perfringens}{per.}{perfringens}
\newabbreviation[,category=species,
  description={},parent=clostridium]{tetani}{tet.}{tetani}

This will cause a double dot at the end of the second sentence, which can be suppressed using the discardperiod and retainfirstuseperiod attributes.

\glssetcategoriesattributes{species}{discardperiod,retainfirstuseperiod}{true}

This works because the final element’s post-link hook is transferred to the multi-entry post-link hook, which can detect the sentence terminating period. If the post-link hook settings are changed, for example, to postlinks=all,mpostlink=false then the feature won’t work as the final element’s post-link hook can’t detect the period (because \gls is embedded too deeply inside the internal workings of \mgls).

The result is:

First use: Clostridium botulinum, C. perfringens, C. tetani.

Next use: C.bot., C.per., C.tet.

Top

6.1.5 Example: Skipping Elements (Fragment Element)

This example is an alternative way of dealing with nested links (see §2.8 Nested Links).

\documentclass{article}
\usepackage[colorlinks]{hyperref}
\usepackage[stylemods,style=long]{glossaries-extra}
\makeglossaries
\setabbreviationstyle{long-short-sc}
\newabbreviation{ssi}{ssi}{server-side includes}
\newabbreviation{html}{html}{hypertext markup language}
\setabbreviationstyle[combinedabbrv]{long-only-short-sc-only}
\newabbreviation
 [category=combinedabbrv,
  description={\glsxtrshort{ssi} enabled \glsxtrshort{html}}]
 {shtml-frag}{shtml}{enabled}
\glssetcategoryattribute{combinedabbrv}{multioptions}
 {usedskipothers,firstsuffix={\glsxtrshort{\mglslastmainlabel}}}
\multiglossaryentry
 [category={combinedabbrv}]
 {shtml}[shtml-frag]{ssi,shtml-frag,html}
\begin{document}
Individual elements first use: \gls{ssi} and \gls{html}.
Individual elements next use: \gls{ssi} and \gls{html}.
Multi-entry first use: \mgls{shtml}.
Multi-entry next use: \mgls{shtml}.
Resetting all\glsresetall\mglsreset{shtml}:
Multi-entry first use: \mgls{shtml}.
Multi-entry next use: \mgls{shtml}.
Individual elements: \gls{ssi} and \gls{html}.
\printglossaries
\end{document}

This uses the multioptions attribute to skip “other” elements on subsequent use. The problematic abbreviation (SHTML) is defined as a fragment that simply expands to “enabled” on first use. Note that the description has to be supplied for the glossary.

The above produces (underlining added to mark the hyperlinks):

Individual elements first use: server-side includes (ssi) and hypertext markup language (html).

Individual elements next use: ssi and html.

Multi-entry first use: ssi enabled html (shtml).

Multi-entry next use: shtml.

Resetting all:

Multi-entry first use: server-side includes (ssi) enabled hypertext markup language (html) (shtml).

Multi-entry next use: shtml.

Individual elements: ssi and html.

The key difference here from the example using \glsps at the end of §2.8 Nested Links is that the individual elements hyperlink to their respective entries in the glossary on first use of \mgls.

The problem is that with the colorlinks package option, it’s not obvious where the hyperlinks start and end. The suffix (shtml) will hyperlink to the “shtml” entry in the glossary, so the “enabled” hyperlink is redundant. The simplest fix for this is to add hyper=notmainfirst to the option list, which will prevent “enabled” from being a hyperlink.

Another problem occurs where \mgls is used before the individual elements are used, which leads to their full expansion with a confusing amount of parentheses. A simple solution is to use the option mglsopts=unsetothers, which will unset the other (not-main) elements first. This can be localised with presetlocal but \gls will then unset the first use flag globally, which means that the other elements won’t show the full form when they are first used on their on after \mgls. This can be switched to a local unset with others=local.

The complete set of options are now:

\glssetcategoryattribute{combinedabbrv}{multioptions}
 {%
  hyper=notmainfirst,
  mglsopts={presetlocal,unsetothers,others={local}},
  usedskipothers,
  firstsuffix={\glsxtrshort{\mglslastmainlabel}}
 }

This now produces (underlining added to mark the hyperlinks):

Individual elements first use: server-side includes (ssi) and hypertext markup language (html).

Individual elements next use: ssi and html.

Multi-entry first use: ssi enabled html (shtml).

Multi-entry next use: shtml.

Resetting all:

Multi-entry first use: ssi enabled html (shtml).

Multi-entry next use: shtml.

Individual elements: server-side includes (ssi) and hypertext markup language (html).

This method still has two main drawbacks: the description must be added manually and the long form can’t be accessed with \glsxtrlong. The next example provides an alternative approach.

Top

6.1.6 Example: Skipping Elements (Prefix and Post-Link Hooks)

This is a modified version of the previous example. In this case, the main element isn’t a fragment and also happens to have the same label as the multi-entry set. (\mgls{shtml} references the multi-entry label and \gls{shtml} references the individual entry.)

In this case, the nested parts are marked up with custom commands:

\newrobustcmd{\combinedpre}[1]{\glsps{#1}}
\newrobustcmd{\combinedpost}[1]{\glsps{#1}}
\newabbreviation{shtml}{shtml}
{{}\combinedpre{ssi} enabled \combinedpost{html}}

This means that it’s no longer necessary to manually insert the description and the long form can be accessed as usual with \glsxtrshort{shtml}. Note that it is necessary to define the custom commands robustly otherwise they will need to be protected against premature expansion:

\newcommand{\combinedpre}[1]{\glsps{#1}}
\newcommand{\combinedpost}[1]{\glsps{#1}}
\newabbreviation{shtml}{shtml}
{{}\protect\combinedpre{ssi} enabled \protect\combinedpost{html}}

In both cases, an initial empty group is added to guard against any first letter uppercase commands, such as \Glsxtrlong.

The abbreviations all use the long-postshort-sc-user style, which places the short form in the post-link hook on first use. The \gls post-link hook for the main element can be transferred to the \mgls post-link using:

mpostlinkelement=main

All elements have their individual post-link hooks suppressed by default. As in the previous example, the other elements can be skipped on subsequent use:

usedskipothers

Within \mgls, the nested content needs to be suppressed, which can be done by redefining the custom commands. This can be done in the multi-entry prefix. Since the entire content of \mgls (except for the final multi-entry post-link hook) occurs inside a group, this redefinition will be localised.

The complete document is as follows:

\documentclass{article}
\usepackage[colorlinks]{hyperref}
\usepackage[stylemods,style=long]{glossaries-extra}
\makeglossaries
\setabbreviationstyle{long-postshort-sc-user}
\newabbreviation{ssi}{ssi}{server-side includes}
\newabbreviation{html}{html}{hypertext markup language}
\newrobustcmd{\combinedpre}[1]{\glsps{#1}}
\newrobustcmd{\combinedpost}[1]{\glsps{#1}}
\newabbreviation{shtml}{shtml}
{{}\combinedpre{ssi} enabled \combinedpost{html}}
\glssetcategoryattribute{combinedabbrv}{multioptions}
 {%
  mpostlinkelement=main,
  usedskipothers
 }
\multiglossaryentry
 [category={combinedabbrv}]
 {shtml}[shtml]{ssi,shtml,html}
\mglsdefcategoryprefix{combinedabbrv}{%
 \renewcommand{\combinedpre}[1]{\ignorespaces}%
 \renewcommand{\combinedpost}[1]{\unskip}%
}
\begin{document}
Individual elements first use: \gls{ssi} and \gls{html}.
Individual elements next use: \gls{ssi} and \gls{html}.
Multi-entry first use: \mgls{shtml}.
Multi-entry next use: \mgls{shtml}.
Individual entry first use: \gls{shtml}.
Resetting all\glsresetall\mglsresetall:
                                                                  

                                                                  
Multi-entry first use: \mgls{shtml}.
Multi-entry next use: \mgls{shtml}.
Individual elements: \gls{ssi} and \gls{html}.
Resetting all\glsresetall\mglsresetall:
Individual entry first use: \gls{shtml}.
Multi-entry first use: \mgls{shtml}. (Wrong!)
\printglossaries
\end{document}

This now produces (underlining added to mark the hyperlinks):

Individual elements first use: server-side includes (ssi) and hypertext markup language (html).

Individual elements next use: ssi and html.

Multi-entry first use: ssi enabled html (shtml).

Multi-entry next use: shtml.

Individual entry first use: shtml.

Resetting all:

Multi-entry first use: server-side includes enabled hypertext markup language (shtml).

Multi-entry next use: shtml.

Individual elements: ssi and html.

Resetting all:

Individual entry first use: ssi enabled html (shtml).

Multi-entry first use: server-side includes shtml hypertext markup language. (Wrong!)

Note the last two paragraphs, which highlights what happens if \gls{shtml} is used before \mgls{shtml} when neither of the other elements (ssi and html) have been used. The final instance of \mgls has produced the wrong result. This is because it’s the first use of the multi-entry shtml but not the first use of the individual entry shtml.

One way around this is to modify the prefix to ensure that the main element’s first use flag matches the multi-entry’s first use flag:

\mglsdefcategoryprefix{combinedabbrv}{%
 \renewcommand{\combinedpre}[1]{\ignorespaces}%
 \renewcommand{\combinedpost}[1]{\unskip}%
 \mglsisfirstuse
 {\glslocalreset{\mglscurrentmainlabel}}%
 {\glslocalunset{\mglscurrentmainlabel}}%
}

The showtargets=annoteleft option can be used to mark up the links with the targets. For example, the first instance of \mgls{shtml} will show as:

Multi-entry first use: [glo:ssi]ssi[glo:shtml]enabled [glo:html]html(shtml).

Each entry has an individual hyperlink to its own glossary item, which may be confusing. This can be made clearer by suppressing the main element link on first use with:

hyper=notmainfirst

(as in the previous example), and adjusting the abbreviation style so that the parenthetical content in the post-link hook has a hyperlink:

\renewcommand*{\glsxtruserparen}[2]{%
  \glsxtrfullsep{#2}%
  \glsxtrparen
   {\glshyperlink[#1]{#2}%
    \ifglshasfield{\glsxtruserfield}{#2}{, \glscurrentfieldvalue}{}%
   }%
}

The remaining problem is how to deal with the possibility that \mgls{shtml} may come before the first use of the other elements. For example:

Multi-entry first use: \mgls{shtml}.
Individual elements: \gls{ssi} and \gls{html}.

This leads to:

Multi-entry first use: server-side includes enabled hypertext markup language (shtml).

Individual elements: ssi and html.

This means that the abbreviations ssi and html aren’t explained in the document text. One way around this is to only locally unset the other element first use flags:

\glssetcategoryattribute{combinedabbrv}{multioptions}
 {%
  hyper=notmainfirst,
  mpostlinkelement=main,
  usedskipothers,
  mglsopts={others={local}}
 }

With the above setting, the following:

\glsresetall\mglsresetall
Multi-entry first use: \mgls{shtml}.
Multi-entry next use: \mgls{shtml}.
Individual elements: \gls{ssi} and \gls{html}.

will now produce:

Multi-entry first use: server-side includes enabled hypertext markup language (shtml).

Multi-entry next use: shtml.

Individual elements: server-side includes (ssi) and hypertext markup language (html).

Top

6.2 Main and Other Elements

The list of labels provided in the final argument of \multiglossaryentry consists of a main element and all the other elements. If the main element isn’t identified in the optional argument, it’s assumed to be the final element in the list.

The main element allows you to determine which target to use if you want the entire content of \mgls to be a single hyperlink. You can also use the settings described in §6.9 Multi-Entry Settings to only index the main element.

You can change the main element using:


\mglsSetMain{multi-label}{new-main-label}

The new main label provided in the second argument must be in the list corresponding to ⟨multi-label⟩. This change is locally applied to the current scope. Note that if you are using bib2gls, this change in the document can’t be detected.

The main element can also be used to identify which element should be displayed in the plural with \mglsmainpl. For example:

\newglossaryentry{great}{name={great},description={}}
\newglossaryentry{little}{name={little},description={}}
\newglossaryentry{grebe}{name={grebe},description={}}
\multiglossaryentry{greatgrebe}{great,grebe}
\multiglossaryentry{littlegrebe}{little,grebe}

In the above, two multi-entries are defined: greatgrebe and littlegrebe. In both cases the main element is grebe (the last element). Using \mglspl will show the plural for all elements, but using \mglsmainpl will only use the plural for the main element (grebe). For example:

Plural all: \mglspl{greatgrebe}, \mglspl{littlegrebe}.
Plural main: \mglsmainpl{greatgrebe}, \mglsmainpl{littlegrebe}.

produces:
Plural all: greats grebes, littles grebes.
Plural main: great grebes, little grebes.

Top

6.3 Prefixes and Suffixes

A multi-entry may have associated prefixes and suffixes. These are scoped and are placed outside of the hyperlinks and encapsulating commands. They are not affected by case-changing commands, such as \Mgls. If you want a prefix to obey case-changing, use the \mpgls-like commands instead (§6.11.4 Support for glossaries-prefix (pgls)).

The prefix is inserted with:


\mglsprefix

The default definition is:

\newcommand*{\mglsprefix}{%
 \ifdefempty\mglscurrentcategory
 {\mglscurrentprefix}%
 {%
   \mglshascategoryprefix{\mglscurrentcategory}%
   {\mglsusecategoryprefix{\mglscurrentcategory}}%
   {\mglscurrentprefix}%
 }%
}

This will insert the current prefix unless there is prefix command associated with the current category.

The suffix is inserted with:


\mglssuffix

The command is defined as follows:

\newcommand*{\mglssuffix}{%
 \ifdefempty\mglscurrentcategory
 {\ifdefempty{\mglscurrentsuffix}{}{\space(\mglscurrentsuffix)}}%
 {%
   \mglshascategorysuffix{\mglscurrentcategory}%
   {\mglsusecategorysuffix{\mglscurrentcategory}}%
   {\ifdefempty{\mglscurrentsuffix}{}{\space(\mglscurrentsuffix)}}%
 }%
}

If there is a suffix associated with the current category, that will be used, otherwise if the current suffix isn’t empty this inserts a space followed by the current suffix in parentheses. You can access the label of the last (non-skipped) element with \mglslastelementlabel.

Note that in both cases the category corresponds to the multi-entry category (see §6.8 Multi-Entry Category).

To define a category-dependent prefix, use:


\mglsdefcategoryprefix{category}{definition}

You can reference the current prefix with \mglscurrentprefix.

To define a category-dependent suffix, use:


\mglsdefcategorysuffix{category}{definition}

You can reference the current suffix with \mglscurrentsuffix.

The default definition of \mglsprefix tests if there is a category prefix using:


\glshascategoryprefix{category}{true}{false}

The category prefix is used with:


\glsusecategoryprefix{category}

The default definition of \mglssuffix tests if there is a category suffix using:


\glshascategorysuffix{category}{true}{false}

The category suffix is used with:


\glsusecategorysuffix{category}

The current prefix \mglscurrentprefix and \mglscurrentsuffix are obtained as follows:

The prefix and suffix (if set) are placed outside of the hyperlink and text formatting encapsulator. They are not affected by case-changing commands such as \Mgls or \MGLS.

For example:

\setabbreviationstyle{long-only-short-only}
\newabbreviation{clostridium}{C.}{Clostridium}
\newglossaryentry{botulinum}{name=botulinum,description={}}
\multiglossaryentry[firstsuffix=botulism]
 {cbot}{clostridium,botulinum}

On first use, this produces (assuming the “clostridum” element hasn’t been used previously):

Clostridium botulinum (botulism).

On subsequent use, this produces:

C. botulinum.

Top

6.4 Separators

The separators between each instance of \gls are given by the following commands, which all take two arguments. The first argument is the label of the previous element. The second argument is the label of the following element.


\glscombinedsep{prev label}{next label}

This is inserted between two entries that have both been marked as used. The default definition is:

\newcommand*{\glscombinedsep}[2]{%
  \glshasattribute{#1}{combinedsep}%
  {\glsgetattribute{#1}{combinedsep}}%
  { }%
}

This will use the combinedsep attribute for the ⟨prev label⟩’s category, if set. Otherwise this just does a space. Note that this ignores the second argument.


\glscombinedfirstsep{prev label}{next label}

This is inserted between two entries where only the next entry has been marked as used. The default definition is:

\newcommand*{\glscombinedfirstsep}[2]{%
 \glshasattribute{#1}{combinedfirstsep}%
 {\glsgetattribute{#1}{combinedfirstsep}}%
 {\glscombinedsep{#1}{#2}}%
}

This will use the combinedfirstsep attribute for ⟨prev label⟩’s category, if set. If that attribute isn’t set, \glscombinedsep is used.


\glscombinedsepfirst{prev label}{next label}

This is inserted between two entries where only the previous entry has been marked as used. The default definition is:

\newcommand*{\glscombinedsepfirst}[2]{%
 \glshasattribute{#1}{combinedsepfirst}%
 {\glsgetattribute{#1}{combinedsepfirst}}%
 {\glscombinedsep{#1}{#2}}%
}

This will use the combinedsepfirst attribute for ⟨prev label⟩’s category, if set. If that attribute isn’t set, \glscombinedsep is used.


\glscombinedfirstsepfirst{prev label}{next label}

This is inserted between two entries where both have been marked as used. The default definition is:

\newcommand*{\glscombinedfirstsepfirst}[2]{%
 \glshasattribute{#1}{combinedfirstsepfirst}%
 {\glsgetattribute{#1}{combinedfirstsepfirst}}%
 {\glscombinedsep{#1}{#2}}%
}

This will use the combinedfirstsepfirst attribute for ⟨prev label⟩’s category, if set. If that attribute isn’t set, \glscombinedsep is used.

These commands may be redefined as required. For example, to have no space between two elements that have both been marked as used and are both abbreviations (disregarding category attributes):

\renewcommand*{\glscombinedfirstsepfirst}[2]{%
 \ifglshasshort{#1}{\ifglshasshort{#2}{}{\space}}{\space}%
}

There are some commands for redefining the above separators to common combinations.


\glssetcombinedsepabbrvnbsp

This does the following:

\renewcommand*{\glscombinedsep}[2]{%
 \glshasattribute{#1}{combinedsep}%
 {\glsgetattribute{#1}{combinedsep}}%
 {\ifhasshort{#1}{~}{ }}%
}%
\renewcommand*{\glscombinedsepfirst}[2]{%
 \glshasattribute{##1}{combinedsepfirst}%
 {\glsgetattribute{##1}{combinedsepfirst}}%
 {\ifhasshort{#1}{~}{ }}%
}%
\renewcommand*{\glscombinedfirstsep}[2]{%
 \glshasattribute{#1}{combinedfirstsep}%
 {\glsgetattribute{#1}{combinedfirstsep}}%
 { }%
}%
\renewcommand*{\glscombinedfirstsepfirst}[2]{%
  \glshasattribute{##1}{combinedfirstsepfirst}%
  {\glsgetattribute{##1}{combinedfirstsepfirst}}%
  { }%
}%

This uses a non-breakable space ~ following an abbreviation (that has already been marked as used). Note that if the associated attributes are set the commands will behave according to the attribute.


\glssetcombinedsepabbrvnone

This does the following:

\renewcommand*{\glscombinedsep}[2]{%
 \glshasattribute{#1}{combinedsep}%
 {\glsgetattribute{#1}{combinedsep}}%
 {\ifhasshort{#1}{}{\ifhasshort{#2}{}{ }}}%
}%
\renewcommand*{\glscombinedsepfirst}[2]{%
 \glshasattribute{#1}{combinedsepfirst}%
 {\glsgetattribute{#1}{combinedsepfirst}}%
 {\ifhasshort{#1}{}{ }}%
}%
\renewcommand*{\glscombinedfirstsep}[2]{%
 \glshasattribute{##1}{combinedfirstsep}%
 {\glsgetattribute{##1}{combinedfirstsep}}%
 {\ifhasshort{##2}{}{ }}%
}%
\renewcommand*{\glscombinedfirstsepfirst}[2]{%
 \glshasattribute{##1}{combinedfirstsepfirst}%
 {\glsgetattribute{##1}{combinedfirstsepfirst}}%
 { }%
}%

This does nothing if either element are abbreviations that have already been used. Note that if the associated attributes are set the commands will behave according to the attribute.


\glssetcombinedsepnarrow{width}{narrow sep}

This is rather more complicated as it measures a field value and uses ⟨narrow sep⟩ if the width is less than ⟨width⟩. The field value is determined as follows:

Note that this doesn’t take into account fonts, hooks, abbreviation styles or plural forms (e.g. \mglspl) or other field references (e.g. \mglsname). If the associated attributes are set the commands will behave according to the attribute.

Top

6.5 mgls Element Hooks

The \mgls-like commands use the following hooks:


\mglselementprehook

This is done before each (non-skipped) element. (Default does nothing.)


\mglselementposthook

This is done after each (non-skipped) element. (Default does nothing.) Note that this is different from the normal entry post-link hook \glspostlinkhook. If the individual entry post-link hook is enabled (see the postlinks key in §6.9 Multi-Entry Settings), this will go before \mglselementposthook.

The definitions of the following commands are scoped within the \mgls-like commands so they can’t be accessed elsewhere (including in the post-link hook, see §6.6 Post-Link Hook). They may be used in the above hooks or in the separator commands (described in §6.4 Separators) or in the command used to encapsulate the entire content. They can also be used in the post-link hook (see §2.4 Entry Display Style Modifications) to determine if an entry is being used within a \mgls-like command.

The multi-entry label is stored in:


\mglscurrentmultilabel

The label of the main element:


\mglscurrentmainlabel

The complete comma-separated list of elements:


\mglscurrentlist

Multi-entry options:


\mglscurrentoptions

These are the options that were used when defining the multi-entry. This doesn’t include options set with \multiglossaryentrysetup or those passed to \mgls (or whichever variant is being used).

The current multi-entry category in effect is stored in:


\mglscurrentcategory

The calling command control sequence name (e.g. “mgls” or “mglspl”) can be obtained with:


\glsxtrcurrentmglscsname

To test if the current multi-entry is the first use:


\mglsisfirstuse{true}{false}

This does ⟨true⟩ if this is the first use otherwise it does ⟨false⟩. Note that this applies to the multi-entry first use flag not the first use flags of the individual elements.

At each iteration of the loop over the element list, the following commands are set, which can be accessed in hooks such as \mglselementprehook or in hooks used by the underlying \gls etc commands. For example, if \mglscurrentlabel is defined then \gls is being used inside \mgls.

The current element label:


\mglscurrentlabel

This is a count register that is set to the element index:


\mglselementindex

The current multi-entry prefix:


\mglscurrentprefix

The current multi-entry suffix:


\mglscurrentsuffix


\mglsiflast{true}{false}

If this is the last iteration, does ⟨true⟩ otherwise does ⟨false⟩. This takes the skip options into account, so the last iteration may not necessarily be when the element index is equal to the total number of elements.

Top

6.6 Post-Link Hook

There is a hook that occurs at the end the \mgls-like commands according to the mpostlink setting (see §6.9 Multi-Entry Settings). The hook used depends on the mpostlinkelement option. These hooks can’t access the commands described in §6.5 mgls Element Hooks as the hook occurs outside of the scope in which they are defined.

The mpostlinkelement=custom option uses:


\mglscustompostlinkhook

This does nothing by default.

The mpostlinkelement=last option uses:


\mglslastelementpostlinkhook

which emulates the post-link hook of the last element.

The mpostlinkelement=main option uses:


\mglslastmainpostlinkhook

which emulates the post-link hook of the main element.

The default settings postlinks=none,mpostlink=true,mpostlinkelementlast will suppress the individual element post-link hooks (\glspostlinkhook) and do the multi-entry post-link hook for the last element (\mglslastelementpostlinkhook).

If you have the final element’s post-link hook enabled and the multi-entry post-link hook enabled (for example, postlinks=all, mpostlink=true, mpostlinkelement=last), the final element’s post-link hook will be done twice. Similarly for the main element with postlinks=all, mpostlink=true, mpostlinkelement=main.

The following commands are available for use in these hooks and may also be used in \mglssuffix.

The multi-entry label:


\mglslastmultilabel

The multi-entry category (§6.8 Multi-Entry Category):


\mglslastcategory

This will be empty if no category was assigned.


\mglswasfirstuse{true}{false}

If that was the first use of the multi-entry (§6.7 Multi-Entry First Use) this does ⟨true⟩ otherwise it does ⟨false⟩.

Top

6.6.1 Last Element

The following commands relate to the last element.

The label of the last non-skipped element:


\mglslastelementlabel

If all elements were skipped or if the multi-entry wasn’t defined, this will be empty.

Test if the last element was skipped:


\mglsiflastelementskipped{true}{false}

If the last element was skipped this does ⟨true⟩ otherwise it does ⟨false⟩. If all elements were skipped or if the multi-entry wasn’t defined, this will do ⟨true⟩.

Test if the last element was its first use:


\mglsiflastelementwasfirstuse{true}{false}

If the last non-skipped element was used for the first time this does ⟨true⟩ otherwise it does ⟨false⟩. (Corresponds to \glsxtrifwasfirstuse.) If all elements were skipped or if the multi-entry wasn’t defined, this will do ⟨true⟩.

Test if the last element was plural:


\mglsiflastelementwasplural{true}{false}

If the last non-skipped element had the plural form displayed, this does ⟨true⟩ otherwise it does ⟨false⟩. (Corresponds to \glsifplural.) If all elements were skipped or if the multi-entry wasn’t defined, this will do ⟨false⟩.

Test if the last element was had any case-changing applied:


\mglsiflastelementcapscase{no-change}{firstuc}{all caps}

Corresponds to \glscapscase of the last non-skipped element. If all elements were skipped or if the multi-entry wasn’t defined, this will do ⟨no-change⟩.

Top

6.6.2 Main Element

The following commands relate to the main element.

The label of the main element from the multi-entry that was just referenced:


\mglslastmainlabel

If the main element was skipped or if the multi-entry wasn’t defined, this will be empty. If this is the same as \mglslastelementlabel then the main element was the last element.

Test if the main element was skipped:


\mglsiflastmainskipped{true}{false}

If the main element from the multi-entry that was just referenced was skipped this does ⟨true⟩ otherwise it does ⟨false⟩. If the multi-entry wasn’t defined, this will do ⟨true⟩.

Test if the main element was its first use:


\mglsiflastmainwasfirstuse{true}{false}

If the main element was used for the first time this does ⟨true⟩ otherwise it does ⟨false⟩. (Corresponds to \glsxtrifwasfirstuse.) If the main element was skipped or if the multi-entry wasn’t defined, this will do ⟨true⟩.

Test if the main element was plural:


\mglsiflastmainwasplural{true}{false}

If the main element from the multi-entry that was just referenced had its plural form displayed this does ⟨true⟩ otherwise it does ⟨false⟩. (Corresponds to \glsifplural.) If the main element was skipped or if the multi-entry wasn’t defined, this will do ⟨false⟩.

Test if the main element was had any case-changing applied:


\mglsiflastmaincapscase{no-change}{firstuc}{all caps}

Corresponds to \glscapscase of the main element from the multi-entry that was just referenced. If the main element was skipped or if the multi-entry wasn’t defined, this will do ⟨no-change⟩.

Top

6.7 Multi-Entry First Use

Each multi-entry set has an associated first use flag. This is independent of the first use flag associated with the individual entries that make up the set. As with the \gls-like commands, \mgls unsets this flag. Unlike the \glstext-like commands, all the commands described in §6.11 Variants of mgls (including commands like \mglsname) unset this flag, even if the elements use commands like \glsname that don’t unset the entry’s first use flag.

You can determine whether or not a multi-entry set has been marked as used with:


\ifmglsused{multi-label}{true}{false}

You can (globally) unset the flag (mark the set as having been referenced) with:


\mglsunset{multi-label}

or reset it with:


\mglsreset{multi-label}

There are also local versions of these commands:


\mglslocalunset{multi-label}

and


\mglslocalreset{multi-label}

To unset all multi-entries:


\mglsunsetall

To reset all multi-entries:


\mglsresetall

Note that unsetting or resetting any of the individual element first use flags doesn’t affect the multi-entry flag. Similarly, unsetting or resetting the multi-entry flag doesn’t affect the first use flags of the individual elements.

Top

6.8 Multi-Entry Category

A multi-entry set may have an associated category set using the category key described in §6.9 Multi-Entry Settings. This isn’t set by default, but if it is set the category may have attributes set in the usual way. The multi-entry category is independent of the individual entry categories. The following attribute is recognised by commands like \mgls:

multioptions
default options to apply to any multi-entry set with the given category. These can be overridden by the first optional argument of \multiglossaryentry or by the setup key in the first optional argument of commands like \mgls.

Note that you can’t access the category or its attributes via the multi-entry label (for example, with \glshasattribute). If you need to access the current multi-entry’s category within any of the \mgls-like hooks (§6.5 mgls Element Hooks), you can obtain the category with \mglscurrentcategory and use commands like \glshascategoryattribute.

Top

6.9 Multi-Entry Settings

The settings that govern all multi-entries can be set using:


\multiglossaryentrysetup{options}

The ⟨options⟩ are the same as for \multiglossaryentry. Options may also be set according to the multi-entry category attribute multioptions.

Whenever the \mgls-like commands are used, options are applied in the following order:

  1. general options identified by \multiglossaryentrysetup;
  2. the category key is assigned if it’s in the general options, \multiglossaryentry or setup key;
  3. multioptions category attribute (if set);
  4. any options provided in the first optional argument of \multiglossaryentry;
  5. any options provided in the setup key in the first optional argument of the \mgls-like command.

These options are described below.

Top

6.9.1 Indexing

indexmain
This setting may take one of the following values:
false
don’t index the main entry;
true
index the main entry;
first
only index the main entry if it’s the first use (of the main entry).

The default is true.

indexothers
This setting may take one of the following values:
false
don’t index the other entries;
true
index the other entries;
first
only index the other entries if it’s the first use (of the non-main entry).

The default is first.

Top

6.9.2 Location Formats (Encaps)

encapmain
This setting value should be the value to pass to format for the main entry. (The location encapsulator.) The default is glsnumberformat.
encapothers
This setting value should be the value to pass to format for the other (not main) entries. (The location encapsulator.) The default is glsnumberformat.

Top

6.9.3 Post-Link Hooks

postlinks
This setting determines whether or not to enable the individual element’s post-link hook (\glspostlinkhook). The value may be one of:
none
suppress the post-link hook for all elements;
all
don’t suppress the post-link hook for all elements;
notlast
only suppress the post-link hook for the last element;
mainnotlast
suppress the post-link hook for all “other” (not main) elements and for the last element (so only the main element will have its post-link hook as long as it’s not the last element);
mainonly
suppress the post-link hook for all “other” (not main) elements;
othernotlast
suppress the post-link hook for the main element and for the last element (so only the other elements will have their post-link hook as long as the element isn’t the last one);
otheronly
suppress the post-link hook for the main element.

The default is postlinks=none.

mpostlink
This setting determines whether or not to enable the multi-entry post-link hook (§6.6 Post-Link Hook). The value may be one of:
false
suppress the multi-entry post-link hook;
true
enable the multi-entry post-link hook;
firstonly
enable the multi-entry post-link hook only for the first use of the multi-entry;
usedonly
enable the multi-entry post-link hook only for the subsequent (not first) use of the multi-entry.

The default is mpostlink=true. If the value is omitted, true is assumed.

mpostlinkelement
This setting indicates which post-link hook should be used if the multi-entry post-link hook has been enabled. Allowed values:
last
use \mglslastelementpostlinkhook (that is, use the post-link hook for the last element);
main
use \mglslastmainpostlinkhook (that is, use the post-link hook for the main element);
custom
use \mglslastcustompostlinkhook.

Note that some combinations may cause a repeated hook.

Top

6.9.4 Prefixes and Suffixes

See §6.3 Prefixes and Suffixes for more information on prefixes and suffixes. Note that the prefixes and suffixes are not affected by case-changing commands such as \Mgls or \MGLS. If you want a prefix to obey case-changing, use the \mpgls-like commands instead (§6.11.4 Support for glossaries-prefix (pgls)).

firstprefix
The prefix to use on first use of the multi-entry.
usedprefix
The prefix to use on subsequent use of the multi-entry.
firstsuffix
The suffix to use on first use of the multi-entry.
usedsuffix
The suffix to use on subsequent use of the multi-entry.

Top

6.9.5 Skipping Elements

firstskipmain
This is a boolean setting. If true, the main element will be omitted on (multi-entry) first use.
firstskipothers
This is a boolean setting. If true, the other (non-main) elements will be omitted on (multi-entry) first use.
usedskipmain
This is a boolean setting. If true, the main element will be omitted on (multi-entry) subsequent use.
usedskipothers
This is a boolean setting. If true, the other (non-main) elements will be omitted on (multi-entry) subsequent use.

The skip options apply to the multi-entry first use flag not the individual element first use. See §6.7 Multi-Entry First Use.

Note that it is technically possible to set the skip options so that both the main and the other elements are skipped. However, by default, this will generate a warning and only the final optional argument (the ⟨insert⟩) will be displayed. There won’t be a loop over all elements so the commands set at each iteration, such as \mglscurrentlabel, won’t be defined.

The warning and the insertion of the ⟨insert⟩ is done by:


\glsxtrmglsWarnAllSkipped{message}{insert}{cs}

where ⟨message⟩ is the warning message and ⟨cs⟩ is the control sequence that encapsulates the entire content (including hyperlink and the textformat setting, if enabled).

If, for some particular reason, you want this scenario, you can redefine this command to omit the warning.

Top

6.9.6 General

hyper
This setting may take one of the following values:
none
no hyperlinks;
allmain
encapsulate the entire content with a single hyperlink to the main entry’s target;
mainonly
only hyperlink the main entry;
individual
hyperlink each entry individually;
otheronly
only hyperlink the other entries;
notmainfirst
don’t hyperlink the main entry on multi-entry first use;
nototherfirst
don’t hyperlink the other entries on multi-entry first use;
notfirst
don’t hyperlink any entries on multi-entry first use.

The default is individual.

textformat
This setting value should be the control sequence name (without the leading backslash) of the command used to encapsulate the entire content. The default is @firstofone.
category
The category to apply to the multi-entry. This is independent of the categories of each of the elements. The default is no category. See §6.8 Multi-Entry Category.
mglsopts
Default options to pass to \mgls. Note that setup can’t be used within this value.

Top

6.10 mgls Options

The ⟨options⟩ for \mgls (and similar commands) are listed below. Any additional options provided will be appended to the all value. For example:

\mgls[counter=chapter]{cbot}

is equivalent to:

\mgls[all={counter=chapter}]{cbot}

Whereas:

\mgls[counter=chapter,all={counter=section}]{cbot}

is treated as:

\mgls[all={counter=section,counter=chapter}]{cbot}

which has the same effect as:

\mgls[all={counter=chapter}]{cbot}

(The descriptions below reference \gls which is used internally by \mgls. Replace this with \glspl etc as applicable for the variants, such as \mglspl.)

setup
The value should be a list of any options that can be passed to \multiglossaryentrysetup. These options will override any conflicting options that were supplied to \multiglossaryentry or \multiglossaryentrysetup. Note that mgls can’t be used within this value.
all
The value should be a list of any options that can be passed to \gls. These options will be passed to each instance of \gls and will override any conflicting setting in setup.
main
The value should be a list of any options that can be passed to \gls. These options will be passed to the instance of \gls used for the main label and will override any conflicting setting in all.
others
The value should be a list of any options that can be passed to \gls. These options will be passed to each instance of \gls used for the other (not main) labels and will override any conflicting setting in all.
hyper
a boolean option to determine whether or not to use hyperlinks (if supported). This may cause a conflict with other options, but is essentially provided to allow the starred version of \mgls to switch off all hyperlinks.
multiunset
This only applies to the multi-entry first use flag, described in §6.7 Multi-Entry First Use, not the first use flags of the elements. The value may be one of:
global globally unset the flag (default);
local locally unset the flag;
none don’t unset the flag.
presetlocal
a boolean option that governs whether or not the following options should have a local or global effect. The default is presetlocal=false (global).
resetall
a boolean option to determine whether or not to reset all entries in ⟨label listbefore using \gls. This option refers to the individual entry’s first use flag not the multi-set flag.
resetmain
a boolean option to determine whether or not to reset the main entry before using \gls. This option refers to the individual entry’s first use flag not the multi-set flag.
resetothers
a boolean option to determine whether or not to reset the other (not main) entries before using \gls. This option refers to the individual entry’s first use flag not the multi-set flag.
unsetall
a boolean option to determine whether or not to unset all entries in ⟨label listbefore using \gls. This option refers to the individual entry’s first use flag not the multi-set flag.
unsetmain
a boolean option to determine whether or not to unset the main entry before using \gls. This option refers to the individual entry’s first use flag not the multi-set flag.
unsetothers
a boolean option to determine whether or not to unset the other (not main) entries before using \gls. This option refers to the individual entry’s first use flag not the multi-set flag.

The resetoptions all use:


\mglselementreset{label}

The unsetoptions all use:


\mglselementunset{label}

These take the presetlocal into account.

An alternative way of resetting the other elements is to use:


\mglsunsetothers{multi-label}

or for a local reset:


\mglslocalunsetothers{multi-label}

Top

6.11 Variants of mgls

The commands listed in this section all behave like \mgls. These (including \mgls itself) are collectively referred to as the \mgls-like commands. All commands unset the multi-entry first use flag (unless the multiunset=none option is applied). Only those commands that use the \gls-like commands (such as \gls or \glspl) will unset the individual entry first use flag.

Top

6.11.1 gls-like


\mglspl[options]{multi-label}[insert]

This uses \glspl instead of \gls for each entry.


\mglsmainpl[options]{multi-label}[insert]

This uses \glspl instead of \gls for the main entry and \gls for all the other entries.


\Mgls[options]{multi-label}[insert]

This uses \Gls for the first entry and \gls for the other entries.


\MGls[options]{multi-label}[insert]

This uses \Gls for all entries.


\Mglspl[options]{multi-label}[insert]

This uses \Glspl for the first entry and \glspl for the other entries.


\Mglsmainpl[options]{multi-label}[insert]

The first entry starts with an upper case. The plural form is used for the main entry.


\MGlspl[options]{multi-label}[insert]

This uses \Glspl for all entries.


\MGlsmainpl[options]{multi-label}[insert]

This uses \Glspl for the main entry and \Gls for all other entries.


\MGLS[options]{multi-label}[insert]

This uses \GLS instead of \gls for each entry.


\MGLSpl[options]{multi-label}[insert]

This uses \GLSpl instead of \gls for each entry.


\MGLSmainpl[options]{multi-label}[insert]

This uses all caps for all entries and \GLSpl for the main entry.

Top

6.11.2 Abbreviations


\mglsshort[options]{multi-label}[insert]

This will use \glsxtrshort for any entries that have the short key set and will use \glstext otherwise.


\mglslong[options]{multi-label}[insert]

This will use \glsxtrlong for any entries that have the long key set and will use \glstext otherwise.


\mglsfull[options]{multi-label}[insert]

This will use \glsxtrfull for any entries that have the short key set and will use \glsfirst otherwise.


\Mglsshort[options]{multi-label}[insert]

As \mglsshort but with an initial capital on the first entry.


\Mglslong[options]{multi-label}[insert]

As \mglslong but with an initial capital on the first entry.


\Mglsfull[options]{multi-label}[insert]

As \mglsfull but with an initial capital on the first entry.

Top

6.11.3 Other Fields


\mglsname[options]{multi-label}[insert]

This uses \glsname instead of \gls for each entry.


\MGlsname[options]{multi-label}[insert]

This uses \Glsname instead of \gls for each entry.


\Mglsname[options]{multi-label}[insert]

This uses \Glsname instead of \gls for the first entry and \glsname for all the other entries.


\mglssymbol[options]{multi-label}[insert]

This uses \glssymbol if the symbol key has been set otherwise it uses \gls for each element.


\MGlssymbol[options]{multi-label}[insert]

This uses \glssymbol if the symbol key has been set otherwise it uses \Gls for each element. (Note that no case change is applied to the symbol as this usually isn’t appropriate.)


\Mglssymbol[options]{multi-label}[insert]

As above, but \Gls is only used for the first element (if it doesn’t have the symbol key set).


\mglsusefield[options]{multi-label}[insert]

Use \glsdisp{label}{field value⟩⟨insert} if the field given by:


\mglsfield

exists, otherwise use \gls. By default, this is useri (corresponding to the user1 key). If you redefine \mglsfield, you will need to use the internal name.


\Mglsusefield[options]{multi-label}[insert]

As \mglsusefield but the first element starts with an initial uppercase.


\MGlsusefield[options]{multi-label}[insert]

As \mglsusefield but each element starts with an initial uppercase.

You can use the pre-element hook \mglselementprehook to locally redefine \mglsfirst. Examples:

  1. if the multi-category is “sample” then use the user2 field otherwise use the user1 field:
         \renewcommand{\mglselementprehook}{%
           \ifdefstring{\mglscurrentcategory}{sample}%
           {\renewcommand{\mglsfield}{userii}}%
           {\renewcommand{\mglsfield}{useri}}%
         }
    

  2. if the element’s category is “sample” then use the user2 field otherwise use the user1 field:
         \renewcommand{\mglselementprehook}{%
           \glsifcategory{\mglscurrentlabel}{sample}%
           {\renewcommand{\mglsfield}{userii}}%
           {\renewcommand{\mglsfield}{useri}}%
         }
    

  3. if either the multi-entry’s category or the element’s category has the custom attribute “mglsfield” set then use it otherwise use the user1 field:
         \renewcommand{\mglselementprehook}{%
          \glshascategoryattribute{\mglscurrentcategory}{mglsfield}%
          {\renewcommand{\mglsfield}{\glsgetcategoryattribute{\mglscurrentcategory}{mglsfield}}}%
          {%
            \glshasattribute{\mglscurrentlabel}{mglsfield}%
            {\renewcommand{\mglsfield}{\glsgetattribute{\mglscurrentlabel}{mglsfield}}}%
            {\renewcommand{\mglsfield}{useri}}%
          }%
         }
    

Top

6.11.4 Support for glossaries-prefix (pgls)

If you load the glossaries-prefix package (either after glossaries-extra) or with the prefix package option, then the following commands will use one of the \pgls-like commands provided by that package. (See the glossaries user manual for further details.)

If the glossaries-prefix package hasn’t been loaded then \gls (or analogous case-changing variant) will be used instead and a warning is issued. The warning can be removed by redefining the following to do nothing:


\mpglsWarning


\mpgls[options]{multi-label}[insert]

Uses \pgls for the first element and \gls for the remaining elements.


\mpglspl[options]{multi-label}[insert]

Uses \pglspl for the first element and \glspl for the remaining elements.


\mpglsmainpl[options]{multi-label}[insert]

Only uses the plural form for the main element. The first element uses the prefixing command (\pgls or \pglspl, depending on whether the first element is the main element).


\Mpgls[options]{multi-label}[insert]

Uses \Pgls for the first element and \gls for the remaining elements.


\Mpglsmainpl[options]{multi-label}[insert]

Only uses the plural form for the main element. The first element uses the first-letter uppercase prefixing command (\Pgls or \Pglspl, depending on whether the first element is the main element).


\MPGls[options]{multi-label}[insert]

Uses \Pgls for the first element and \Gls for the remaining elements.


\MPGlspl[options]{multi-label}[insert]

Uses \Pglspl for the first element and \Glspl for the remaining elements.


\MPGlsmainpl[options]{multi-label}[insert]

Only uses the plural form for the main element. The first element uses the prefixing command (\Pgls or \Pglspl, depending on whether the first element is the main element). All elements are converted to first letter uppercase.


\MPGLS[options]{multi-label}[insert]

Uses \PGLS for the first element and \GLS for the remaining elements.


\MPGLSpl[options]{multi-label}[insert]

Uses \PGLSpl for the first element and \GLSpl for the remaining elements.


\MPGLSmainpl[options]{multi-label}[insert]

Only uses the plural form for the main element. All elements are converted to uppercase. The first element uses the prefixing command (\PGLS or \PGLSpl, depending on whether the first element is the main element).

Top

6.12 Cross-References

Multi-entry labels may be used in the cross-referencing keys see and seealso. The formatting command will use:


\mglsseefirstitem{label}

for the first item in the list (if it’s a multi-entry) and


\mglsseeitem{label}

for any subsequent items that are multi-entries. The default definition of \mglsseeitem is:

\newcommand*{\mglsseeitem}[1]{%
 \mglsname[all={noindex},setup={hyper=allmain}]{#1}%
}

This switches off indexing, sets the hyperlink to encompass the entire multi-entry content and uses the name field. The default definition of \mglsseefirstitem is simply \mglsseeitem.

For example, to use the short or text fields:

\renewcommand*{\mglsseeitem}[1]{%
 \mglsshort[all={noindex},setup={hyper=allmain}]{#1}%
}

A multi-entry label may also be used in the alias key. The hyperlink target will be the target for the main entry. For example:

\multiglossaryentry{cbot}{clostridium,botulinum}
\newglossaryentry{botox}{name=botox,description={},alias={cbot}}

In this case \gls{botox} will hyperlink to the botulinum target.

Any multi-entries used in the cross-referencing keys must be defined before the glossary is displayed. There is some support for docdef=true but not for the other docdef settings.

Top

6.13 Additional Commands

You can test if a label represents a multi-entry using:


\glsxtrifmulti{label}{true}{false}

The following command will expand to the main entry label for the given multi-entry label:


\glsxtrmultimain{multi-label}

This will expand to nothing if the supplied ⟨multi-label⟩ hasn’t been defined as a multi-entry. Similarly, for the complete label list:


\glsxtrmultilist{multi-label}

To iterate over all the list of all elements:


\mglsforelements{multi-label}{cs}{body}

This defines ⟨cs⟩ to the current element label on each iteration of the loop, which can be used to reference the label in ⟨body⟩. This internally uses \@for (patched by the xfor package).

There is a similar command that skips the main element:


\mglsforotherelements{multi-label}{cs}{body}

The total number of elements can be obtained with:


\glsxtrmultitotalelements{multi-label}

This expands to the number, if ⟨multi-label⟩ is defined, otherwise expands to nothing.

The index of the main element can be obtained with:


\glsxtrmultimainindex{multi-label}

This expands to the index, if ⟨multi-label⟩ is defined, otherwise expands to nothing. Indexing starts from 1 for the first element. The index of the final non-main element can be obtained with:


\glsxtrmultilastotherindex{multi-label}

The \multiglossaryentry command will write the label information to the aux file using:


\writemultiglossentry{options}{multi-label}{main-label}{list}

This is will write the following line to the aux file:


\@glsxtr@multientry{options}{multi-label}{main-label}{list}

This is provided to support docdef=true and also for the benefit of any tools that require the information (such as bib2gls or autocompletion tools). If it’s not required and causes too much clutter, it can be disabled by redefining \writemultiglossentry to do nothing.

Top

6.14 bib2gls

In the bib2gls v2.9+ user manual, these multi-entry sets are referred to as “compound entries” or “compound sets” to differentiate them from bib2gls’s multi-entry types (such as @dualentry).

Each instance of one of the \mgls-like commands is written to the aux file and so can be picked up by bib2gls (at least version 2.9). The resource options can be used to determine whether or not to consider the other (non-main) elements to be dependent on the main element.

With bib2gls, you can either define the compound entries in the document with \multiglossaryentry (or \providemultiglossaryentry) or you can use the @compoundset entry type in a bib file. Whichever method you use, remember that the entries that form the elements of the set must be defined first. See the bib2gls manual (v2.9+) for further details.

You can use the resource option compound-adjust-name to replace the name field of the main entry to:


\glsxtrmultientryadjustedname{sublist1}{name}{sublist2}{label}

where ⟨label⟩ is the label identifying the compound set, ⟨name⟩ was the value of the name before adjustment, ⟨sublist1⟩ is the sub-list of other element labels before the main element (empty if the main element is the first element in the list), and ⟨sublist2⟩ is the sub-list of other elements after the main element (empty if the main label is the final element).

This command is defined in glossaries-extra-bib2gls, which is automatically loaded with record=only and record=nameref. Case-changing versions of this command are also available. First letter uppercase:


\Glsxtrmultientryadjustedname{sublist1}{name}{sublist2}{label}

Title case:


\GlsXtrmultientryadjustedname{sublist1}{name}{sublist2}{label}

All uppercase:


\GLSxtrmultientryadjustedname{sublist1}{name}{sublist2}{label}

Note that this command doesn’t take the prefix or suffix into account (see §6.3 Prefixes and Suffixes).

The separator between each element in the sub-lists is produced with:


\glsxtrmultientryadjustednamesep{pre label}{post label}

The default definition just uses \glscombinedfirstsepfirst.

The separator between the last element of ⟨sublist1⟩ and the main element is produced with:


\glsxtrmultientryadjustednamepresep{pre label}{post label}

Similarly for the separator between the main element and the first element of ⟨sublist2⟩:


\glsxtrmultientryadjustednamepostsep{pre label}{post label}

These both default to \glsxtrmultientryadjustednamesep.

The ⟨name⟩ is encapsulated with:


\glsxtrmultientryadjustednamefmt{text}

This just does its argument by default. If ⟨sublist1⟩ is empty for the first letter upper case version, then ⟨name⟩ is encapsulated with:


\Glsxtrmultientryadjustednamefmt{text}

This does \makefirstuc{text} by default. For the title case version, the name is encapsulated with:


\GlsXtrmultientryadjustednamefmt{text}

This uses \glscapitalisewords (provided by glossaries v4.48+) if defined or \capitalisewords otherwise. The all uppercase version uses:


\GLSxtrmultientryadjustednamefmt{text}

This uses \mfirstucMakeUppercase by default.

Each element label in the sub-lists is encapsulated with:


\glsxtrmultientryadjustednameother{label}

This does \glsentryname{label} by default. For the first letter uppercase version (where ⟨sublist1⟩ isn’t empty), then the element label is encapsulated with:


\Glsxtrmultientryadjustednameother{label}

This does \Glsentryname{label} by default. The title case version uses:


\GlsXtrmultientryadjustednameother{label}

This does \glsentrytitlecase{label}{name} by default. The all uppercase version uses:


\GLSxtrmultientryadjustednameother{label}

This is defined as:

\newcommand*{\GLSxtrmultientryadjustednameother}[1]{%
 \mfirstucMakeUppercase{\glsentryname{#1}}}

Top

7. Categories

Each entry defined by \newglossaryentry (or commands that internally use it such as \newabbreviation) is assigned a category through the category key. You may add any category that you like, but since the category is a label used in the creation of some control sequences, avoid problematic characters within the category label. (So take care if you have babel shorthands on that make some characters active.)

The use of categories can give you more control over the way entries are displayed in the text or glossary. Note that an entry’s category is independent of the glossary type. Be careful not to confuse category with type.

For multi-entry categories, see §6.8 Multi-Entry Category.

The default category assumed by \newglossaryentry is labelled general. Abbreviations defined with \newabbreviation have the category set to abbreviation by default. Abbreviations defined with \newacronym have the category set to acronym by default.

Additionally, if you have enabled \newterm with the index package option that command will set the category to index by default. If you have enabled \glsxtrnewsymbol with the symbols package option, that command will set the category to symbol. If you have enabled \glsxtrnewnumber with the numbers package option, that command will set the category to number.

You can obtain the category label for a given entry using


\glscategory{label}

This is equivalent to commands like \glsentryname and so may be used in an expandable context. No error is generated if the entry doesn’t exist.

You can test the category for a given entry using


\glsifcategory{entry-label}{category-label}{true part}{false part}

This is equivalent to

\ifglsfieldeq{entry-label}{category}{category-label}{true
part}{false part}
so any restrictions that apply to \ifglsfieldeq also apply to \glsifcategory.

Each category may have a set of attributes. For example, the general and acronym categories have the attribute regular set to “true” to indicate that all entries with either of those categories are regular entries (as opposed to abbreviations). This attribute is accessed by \glsentryfmt to determine whether to use \glsgenentryfmt or \glsxtrgenabbrvfmt.

Other attributes recognised by glossaries-extra are:

nohyperfirst
When using commands like \gls this will automatically suppress the hyperlink on first use for entries with a category that has this attribute set to “true”. (This settings can be overridden by explicitly setting the hyper key on or off in the optional argument of commands like \gls.) As from version 1.07, \glsfirst, \Glsfirst, \GLSfirst and their plural versions (which should ideally behave in a similar way to the first use of \gls or \glspl) now honour this attribute (but not the package-wide hyperfirst=false option, which matches the behaviour of glossaries). If you want commands like \glsfirst to ignore the nohyperfirst attribute then just redefine


\glsxtrchecknohyperfirst{label}

to do nothing.

nohyper
When using commands like \gls this will automatically suppress the hyperlink for entries with a category that has this attribute set to “true”. (This settings can be overridden by explicitly setting the hyper key on or off in the optional argument of commands like \gls.)
indexonlyfirst
This is similar to the indexonlyfirst package option but only for entries that have a category with this attribute set to “true”.
wrgloss
When using commands like \gls, if this attribute is set to “after”, it will automatically implement wrgloss=after. (New to v1.14.)
discardperiod
If set to “true”, the post-link-text hook will discard a full stop (period) that follows non-plural commands like \gls or \glstext. (Provided for entries such as abbreviations that end with a full stop.) This attribute is only applicable to entries defined using \newabbreviation (or \newacronym if it’s using \newabbreviation.) This attribute doesn’t apply to the accessibility fields.

Note that this can cause a problem if you access a field that doesn’t end with a full stop. For example:

     \newabbreviation
      [user1={German Speaking \TeX\ User Group}]
      {dante}{DANTE e.V.}{Deutschsprachige Anwendervereinigung \TeX\
     e.V.}

Here the short and long fields end with a full stop, but the user1 field doesn’t. The simplest solution in this situation is to put the sentence terminator in the final optional argument. For example:

     \glsuseri{dante}[.]

This will bring the punctuation character inside the link-text and it won’t be discarded.

pluraldiscardperiod
If this attribute is set to “true” and the discardperiod attribute is set to “true”, this will behave as above for the plural commands like \glspl or \glsplural. This attribute is only applicable to entries defined using \newabbreviation (or \newacronym if it’s using \newabbreviation.)
retainfirstuseperiod
If this attribute is set to “true” then the full stop won’t be discarded for first use instances, even if discardperiod or pluraldiscardperiod are set. This is useful for ⟨short⟩ (⟨long⟩) abbreviation styles where only the short form has a trailing full stop. This attribute is only applicable to entries defined using \newabbreviation (or \newacronym if it’s using \newabbreviation.) This attribute doesn’t apply to the accessibility fields.
markwords
If this attribute is set to “true” any entry defined using \newabbreviation will automatically have spaces in the long form replaced with


\glsxtrwordsep

and each word is encapsulated with


\glsxtrword{word}

For example:

     \glssetcategoryattribute{abbreviation}{markwords}{true}
     \newabbreviation{ip}{IP}{Internet Protocol}

is essentially the same as

     \newabbreviation{ip}{IP}
     {\glsxtrword{Internet}\glsxtrwordsep\glsxtrword{Protocol}}

The “hyphen” styles, such as long-hyphen-short-hyphen, take advantage of this markup. If the inserted material (provided in the final argument of commands like \gls) starts with a hyphen then \glsxtrwordsep is locally redefined to a hyphen. (The default value is a space). Note that this only applies to commands like \gls and not like \glsxtrlong. You can provide your own localised switch, if required. For example:

     \newcommand{\hyplong}[2][]{%
      {\def\glsxtrwordsep{-}\glsxtrlong[#1]{#2}}}

This setting will also adjust the long plural. This attribute is only applicable to entries defined using \newabbreviation (or \newacronym if it’s using \newabbreviation.)

This setting may result in the \glsxtrword and \glsxtrwordsep markup ending up in the sort field, depending on the style in use.

markshortwords
This is similar to markwords but applies to the short form. (Only useful for abbreviations that contain spaces.) This attribute is only applicable to entries defined using \newabbreviation (or \newacronym if it’s using \newabbreviation.)

This setting will only adjust the short plural if the shortplural key isn’t used. This setting will take precedence over insertdots.

This setting may result in the \glsxtrword and \glsxtrwordsep markup ending up in the sort field, depending on the style in use.

insertdots
If this attribute is set to “true” any entry defined using \newabbreviation will automatically have full stops (periods) inserted after each letter. The entry will be defined with those dots present as though they had been present in the ⟨short⟩ argument of \newabbreviation (rather than inserting them every time the entry is used). The short plural form defaults to the new dotted version of the original ⟨short⟩ form with the plural suffix appended. This setting is incompatible with markshortwords. This attribute is only applicable to entries defined using \newabbreviation (or \newacronym if it’s using \newabbreviation.)

If you explicitly override the short plural using the shortplural key, you must explicitly insert the dots yourself (since there’s no way for the code to determine if the plural has a suffix that shouldn’t be followed by a dot).

This attribute is best used with the discardperiod attribute set to “true”.

aposplural
If this attribute is set to “true”, \newabbreviation will insert an apostrophe (’) before the plural suffix for the short plural form (unless explicitly overridden with the shortplural key). The long plural form is unaffected by this setting. This setting overrides noshortplural. This attribute is only applicable to entries defined using \newabbreviation (or \newacronym if it’s using \newabbreviation.) Check with your supervisor, publisher or editor if you want to use this attribute as this usage is controversial.
noshortplural
If this attribute is set to “true”, \newabbreviation won’t append the plural suffix for the short plural form. This means the short and shortplural values will be the same unless explicitly overridden. This setting is incompatible with aposplural. This attribute is only applicable to entries defined using \newabbreviation (or \newacronym if it’s using \newabbreviation.)
headuc
If this attribute is set to “true”, commands like \glsfmtshort will use the upper case version in the page headers.
tagging
If this attribute is set to “true”, the tagging command defined by \GlsXtrEnableInitialTagging will be activated to use \glsxtrtagfont in the glossary (see §4.1 Tagging Initials).
entrycount
Unlike the above attributes, this attribute isn’t boolean but instead must be an integer value and is used in combination with \glsenableentrycount (see §2.5 Entry Counting Modifications). Leave blank or undefined for categories that shouldn’t have this facility enabled. The value of this attribute is used by \glsxtrifcounttrigger to determine how commands such as \cgls should behave.

With glossaries, commands like \cgls use \cglsformat only if the previous usage count for that entry was equal to 1. With glossaries-extra the test is now for entries that have the entrycount attribute set and where the previous usage count for that entry is less than or equal to the value of that attribute.

linkcount
This attribute is set to true by \GlsXtrEnableLinkCounting (see §8.2 Link Counting).
linkcountmaster
This attribute is set to the name of the master counter by \GlsXtrEnableLinkCounting if the optional argument is provided (see §8.2 Link Counting).
glossdesc
The \glossentrydesc command (used in the predefined glossary styles) is modified by glossaries-extra to check for this attribute. The attribute may have one of the following values:
  • firstuc: the first letter of the description will be converted to upper case (using \Glsentrydesc).
  • title: the description will be used in the argument of the title casing command. If you have at least glossaries v4.48, the title casing is indirectly performed by \glscapitalisewords, which defaults to \capitalisewords (provided by mfirstuc). You can either redefine \glscapitalisewords if you want the change to also affect \glsentrytitlecase or if you only want the change to apply to the attribute case-changing then redefine:


    \glsxtrfieldtitlecasecs{phrase cs}

    For example:

             \newcommand*{\glsxtrfieldtitlecasecs}[1]{\xcapitalisefmtwords*{#1}}
    

    (Note that the argument to \glsxtrfieldtitlecasecs will be a control sequence whose replacement text is the entry’s description, which is why \xcapitalisefmtwords is needed instead of \capitalisefmtwords.)

Any other values of this attribute are ignored. Remember that there are design limitations for both the first letter uppercasing and the title casing commands. See the mfirstuc user manual for further details.

glossdescfont
(New to version 1.04) In addition to the above, the modified \glossentrydesc command also checks this attribute. If set, it should be the name of a control sequence (without the leading backslash) that takes one argument. This control sequence will be applied to the description text. For example:
     \glssetcategoryattribute{general}{glossdescfont}{emph}

glossname
As glossdesc but applies to \glossentryname. Additionally, if this attribute is set to “uc” the name is converted to all capitals.
indexname
If set, the \glsxtrpostnamehook hook used at the end of \glossentryname will index the entry using \index. See §9 Auto-Indexing for further details.
glossnamefont
(New to version 1.04) In addition to the above, the modified \glossentryname command also checks this attribute. If set, it should be the name of a control sequence (without the leading backslash) that takes one argument. This control sequence will be applied to the name text. For example:
     \glssetcategoryattribute{general}{glossnamefont}{emph}

Note that this overrides \glsnamefont which will only be used if this attribute hasn’t been set.

Remember that glossary styles may additionally apply a font change, such as the list styles which put the name in the optional argument of \item.

glosssymbolfont
(New to version 1.42.) This is similar to glossnamefont and glossdescfont but is used by \glossentrysymbol.
textformat
(New to version 1.21.) Commands like \gls and \glstext have the link text encapsulated in the argument of \glstextformat by default. If this attribute is set, the control sequence given by the attribute value will be used instead. As with the above, the attribute value should be the name (without the leading backslash) of a command that takes a single argument (the link text). Remember that the abbreviation styles may apply an additional font change.
hyperoutside
(New to v1.21.) The attribute value may be false, true or unset. If unset, true is assumed. This indicates the default setting of the hyperoutside key, described in §2.2 Entry Indexing.
dualindex
If set, whenever a glossary entry has information written to the external glossary file through commands like \gls and \glsadd, a corresponding line will be written to the indexing file using \index. See §9 Auto-Indexing for further details.
targeturl
If set, the hyperlink generated by commands like \gls will be set to the URL provided by this attributes value. For example:
     \glssetcategoryattribute{general}{targeturl}{master-doc.pdf}

(See also the accompanying sample file sample-external.tex.) If the URL contains awkward characters (such as % or ~) remember that the base glossaries package provides commands like \glspercentchar and \glstildechar that expand to literal characters.

If you want to a named anchor within the target URL (notionally adding #name⟩ to the URL), then you also need to set targetname to the anchor ⟨name⟩. You may use \glslabel within ⟨name⟩ which is set by commands like \gls to the entry’s label.

All the predefined glossary styles start each entry listing with \glstarget which sets the anchor to \glolinkprefix\glslabel, so if you want entries to link to glossaries in the URL given by targeturl, you can just do:

     \glssetcategoryattribute{general}{targetname}{\glolinkprefix\glslabel}

(If the target document changed \glolinkprefix then you will need to adjust the above as appropriate.)

If the anchor is in the form ⟨name1.name2⟩ then use targetname for the ⟨name2⟩ part and targetcategory for the ⟨name1⟩ part.

For example:

     \glssetcategoryattribute{general}{targeturl}{master-doc.pdf}
     \glssetcategoryattribute{general}{targetcategory}{page}
     \glssetcategoryattribute{general}{targetname}{7}

will cause all link text for general entries to link to master-doc.pdf#page.7 (page 7 of that PDF).

If you want a mixture in your document of entries that link to an internal glossary and entries that link to an external URL then you can use the starred form of \newignoredglossary for the external list. For example:

     \newignoredglossary*{external}
     \glssetcategoryattribute{external}{targeturl}{master-doc.pdf}
     \glssetcategoryattribute{general}{targetname}{\glolinkprefix\glslabel}
     \newglossaryentry{sample}{name={sample},description={local example}}
     \newglossaryentry{sample2}{name={sample2},
       type=external,
       category=external,
       description={external example}}

externallocation
The value should be the file name of the target document when manually indexing an external location (see §2.2 Entry Indexing). In general, it’s better to use bib2gls v1.7+ which can handle multiple external sources and doesn’t require this attribute.

If a term is defined using \newabbreviation and accessibility support has been supplied via the accsupp package option then the following attributes are also available. If shortaccess isn’t set its value will be obtained from:


\glsdefaultshortaccess{short}{long}

This is defined by glossaries-accsupp to just do ⟨long⟩ but glossaries-extra redefines it to do ⟨long⟩ (⟨short⟩). The accessinsertdots, accessaposplural and accessnoshortplural attributes below refer to the ⟨short⟩ form that’s passed to this command.

The following attributes are only applicable to entries defined using \newabbreviation (or \newacronym if it’s using \newabbreviation). They have no effect if the accsupp package option hasn’t been used.

accessinsertdots
If this attribute is set to “true” and the glossaries-accsupp package has been loaded (with the accsupp option), then this behaves like insertdots but for the ⟨short⟩ part used in the shortaccess field instead of the short field. This setting will be overridden by an explicit use of the shortaccess key in the optional argument of \newabbreviation (or \newacronym).
accessaposplural
This boolean attribute overrides aposplural for the shortpluralaccess key. Has no effect if there’s no accessibility support or if the shortaccess key hasn’t been set or if the shortpluralaccess key is explicitly set. If the aposplural is set and this attribute isn’t set and the shortaccess key is set, then the aposplural setting governs the default shortpluralaccess setting. If you want aposplural but don’t want it applied to the accessibility support, set the accessaposplural attribute to “false”. This attribute is only applicable to entries defined using \newabbreviation (or \newacronym if it’s using \newabbreviation.)
accessnoshortplural
This boolean attribute overrides noshortplural for the shortpluralaccess key. The same conditions apply as for accessaposplural. This attribute is only applicable to entries defined using \newabbreviation (or \newacronym if it’s using \newabbreviation.)
nameshortaccess
If this attribute is set to “true”, the access field (used for the name field’s accessibility support) automatically assigned if it’s not provided.
textshortaccess
Like nameshortaccess but applies to the textaccess field automatically assigned if it’s not provided.
firstshortaccess
Like nameshortaccess but applies to the firstaccess field automatically assigned if it’s not provided.
combinedfirstsep
The separator to use for \glscombinefirstsep.
combinedfirstsepfirst
The separator to use for \glscombinedfirstsepfirst.
combinedsepfirst
The separator to use for \glscombinesepfirst.
combinedsep
The separator to use for \glscombinedsep.

An attribute can be set using:


\glssetcategoryattribute{category-label}{attribute-label}{value}

where ⟨category-label⟩ is the category label, ⟨attribute-label⟩ is the attribute label and ⟨value⟩ is the new value for the attribute. This will be localised to the current scope. If you want a global definition use the following command instead.

If you want to apply the same attribute to multiple categories then use:


\glssetcategoriesattribute{category-label list}{attribute-label} {value}

This has a global effect.

If you also want to set multiple attributes to the same value, then you can use:


\glssetcategoriesattributes{category-label list}{attribute-label list}{value}

This has a global effect.

For example:

\newcommand{\latinname}[1]{\emph{#1}}
\glssetcategoriesattributes{genus,species}{textformat,glossnamefont}{latinname}

There is a shortcut version to set the regular attribute to “true”:


\glssetregularcategory{category-label}

This internally uses \glssetcategoryattribute so it has a local effect.

If you need to lookup the category label for a particular entry, you can use the shortcut command:


\glssetattribute{entry-label}{attribute-label}{value}

This uses \glssetcategoryattribute with \glscategory to set the attribute. Note that this will affect all other entries that share this entry’s category.

The above use local assignments so they can be placed inside a group to limit their definition. As from v1.47, the value can be unset using:


\glsunsetcategoryattribute{category-label}{attribute-label}

You can fetch the value of an attribute for a particular category using:


\glsgetcategoryattribute{category-label}{attribute-label}

Again there is a shortcut if you need to lookup the category label for a given entry:


\glsgetattribute{entry-label}{attribute-label}

You can test if an attribute has been assigned to a given category using:


\glshascategoryattribute{category-label}{attribute-label}{true code}{false code}

This uses etoolbox’s \ifcsvoid and does ⟨true code⟩ if the attribute has been set and isn’t blank and isn’t \relax. The shortcut if you need to lookup the category label from an entry is:


\glshasattribute{entry-label}{attribute-label}{true code}{false code}

You can test the value of an attribute for a particular category using:


\glsifcategoryattribute{category-label}{attribute-label}{value} {true-part}{false-part}

This tests if the attribute (given by ⟨attribute-label⟩) for the category (given by ⟨category-label⟩) is set and equal to ⟨value⟩. If true, ⟨true-part⟩ is done. If the attribute isn’t set or is set but isn’t equal to ⟨value⟩, ⟨false part⟩ is done.

For example:

\glsifcategoryattribute{general}{nohyper}{true}{NO HYPER}{HYPER}

This does “NO HYPER” if the general category has the nohyper attribute set to true otherwise if does “HYPER”.

With boolean-style attributes like nohyper, make sure you always test for true not false in case the attribute hasn’t been set.

Again there’s a shortcut if you need to lookup the category label from a particular entry:


\glsifattribute{entry-label}{attribute-label}{value}{true-part} {false-part}

There’s also a shortcut to determine if a particular category has the regular attribute set to “true”:


\glsifregularcategory{category-label}{true-part}{false-part}

Alternatively, if you need to lookup the category for a particular entry:


\glsifregular{entry-label}{true-part}{false-part}

Note that if the regular attribute hasn’t be set, the above do ⟨false-part⟩. There are also reverse commands that test if the regular attribute has been set to “false”:


\glsifnotregularcategory{category-label}{true-part}{false-part}

or for a particular entry:


\glsifnotregular{entry-label}{true-part}{false-part}

Again, if the regular attribute hasn’t been set, the above do ⟨false-part⟩, so these reverse commands aren’t logically opposite in the strict sense.

You can iterate through all entries with a given category using:


\glsforeachincategory[glossary-labels]{category-label} {glossary-cs} {label-cs}{body}

This iterates through all entries in the glossaries identified by the comma-separated list ⟨glossary-labels⟩ that have the category given by ⟨category-label⟩ and performs ⟨body⟩ for each match. Within ⟨body⟩, you can use ⟨glossary-cs⟩ and ⟨label-cs⟩ (which much be control sequences) to access the current glossary and entry label. If ⟨glossary-labels⟩ is omitted, all glossaries are assumed.

Similarly, you can iterate through all entries that have a category with a given attribute using:


\glsforeachwithattribute[glossary-labels]{attribute-label} {attribute-value}{glossary-cs}{label-cs}{body}

This will do ⟨body⟩ for each entry that has a category with the attribute ⟨attribute-label⟩ set to ⟨attribute-value⟩. The remaining arguments are as the previous command.

You can change the category for a particular entry using the standard glossary field changing commands, such as \glsfielddef. Alternatively, you can use


\glsxtrsetcategory{entry-labels}{category-label}

This will change the category to ⟨category-label⟩ for each entry listed in the comma-separated list ⟨entry-labels⟩. This command uses \glsfieldxdef so it will expand ⟨category-label⟩ and make the change global.

You can also change the category for all entries with a glossary or glossaries using:


\glsxtrsetcategoryforall{glossary-labels}{category-label}

where ⟨glossary-labels⟩ is a comma-separated list of glossary labels.

Top

8. Counting References

There are three basic ways of counting entry references:

  1. Counting the total number of times \glsunset is used (\glsreset resets the count and is best avoided). This is provided by the base glossaries package and is intended for documents where the term should be displayed differently if it’s only been used a certain number of times. The information has to be written to the .aux file so that it’s available on the next LaTeX run.

    This method is extended by glossaries-extra and is described in §8.1 Entry Counting (First Use Flag).

  2. Counting the total number of records. This method is only available with bib2gls and is intended for documents where the term should be displayed differently if it’s only been recorded (indexed) a certain number of times. See §10.5 Record Counting for further details.
  3. Counting the number of times the \gls-like or \glstext-like commands are used. (That is, those commands that internally use \@gls@link.) Unlike the other two methods, this just provides a running total rather than the total from the previous LaTeX run. This method is intended to make it more convenient to work with hooks like \glslinkcheckfirsthyperhook, \glslinkpostsetkeys or \glslinkpresetkeys. See §8.2 Link Counting for further details.

Top

8.1 Entry Counting (First Use Flag)

As mentioned in §2.5 Entry Counting Modifications, glossaries-extra modifies the \glsenableentrycount command to allow for the entrycount attribute. This means that you not only need to enable entry counting with \glsenableentrycount, but you also need to set the appropriate attribute (see §7 Categories).

Remember that entry counting only counts the number of times an entry is used by commands that change the first use flag. (That is, all those commands that mark the entry as having been used.) There are many commands that don’t modify this flag and they won’t contribute to the entry use count.

With glossaries-extra, you may use \cgls instead of \gls even if you haven’t enabled entry counting. You will only get a warning if you use \glsenableentrycount without setting the entrycount attribute. (With glossaries, commands like \cgls will generate a warning if \glsenableentrycount hasn’t been used.) The abbreviation shortcut \ab uses \cgls (see §4.3 Shortcut Commands). The acronym shortcut \ac uses \cgls if it’s been defined with shortcuts=ac (or shortcuts=all) but uses \gls if it’s been defined with shortcuts=acronyms (or shortcuts=acro).

All upper case versions (not provided by glossaries) are also available:


\cGLS[options]{label}[insert]

and


\cGLSpl[options]{label}[insert]

These are analogous to \cgls and \cglspl but they use


\cGLSformat{label}{insert}

and


\cGLSplformat{label}{insert}

which convert the analogous \cglsformat and \cglsplformat to upper case.

Just using glossaries:

\documentclass{article}
\usepackage{glossaries}
\makeglossaries
\glsenableentrycount
\newacronym{html}{HTML}{hypertext markup language}
\newacronym{xml}{XML}{extensible markup language}
\begin{document}
Used once: \cgls{html}.
Used twice: \cgls{xml} and \cgls{xml}.
\printglossaries
\end{document}

If you switch to glossaries-extra you must set the entrycount attribute:

\documentclass{article}
\usepackage{glossaries-extra}
\makeglossaries
\glsenableentrycount
\glssetcategoryattribute{abbreviation}{entrycount}{1}
\newabbreviation{html}{HTML}{hypertext markup language}
\newabbreviation{xml}{XML}{extensible markup language}
\begin{document}
Used once: \cgls{html}.
Used twice: \cgls{xml} and \cgls{xml}.
\printglossaries
\end{document}

When activated with \glsenableentrycount, commands such as \cgls now use


\glsxtrifcounttrigger{label}{trigger code}{normal code}

to determine if the entry trips the entry count trigger. The ⟨trigger code⟩ uses commands like \cglsformat and unsets the first use flag. The ⟨normal code⟩ is the code that would ordinarily be performed by whatever the equivalent command is (for example, \cgls will use \cglsformat in ⟨trigger code⟩ but the usual \gls behaviour in ⟨normal code⟩).

The default definition is:

\newcommand*{\glsxtrifcounttrigger}[3]{%
 \glshasattribute{#1}{entrycount}%
 {%
   \ifnum\glsentryprevcount{#1}>\glsgetattribute{#1}{entrycount}\relax
    #3%
   \else
    #2%
   \fi
 }%
 {#3}%
}

This means that if an entry is assigned to a category that has the entrycount attribute then the ⟨trigger code⟩ will be used if the previous count value (the number of times the entry was used on the last run) is greater than the value of the attribute.

For example, to trigger normal use if the previous count value is greater than four:

\glssetcategoryattribute{abbreviation}{entrycount}{4}

There is a convenient command provided to enable entry counting, set the entrycount attribute and redefine \gls, etc to use \cgls etc:


\GlsXtrEnableEntryCounting{categories}{value}

The first argument ⟨categories⟩ is a comma-separated list of categories. For each category, the entrycount attribute is set to ⟨value⟩. In addition, this does:

\renewcommand*{\gls}{\cgls}%
\renewcommand*{\Gls}{\cGls}%
\renewcommand*{\glspl}{\cglspl}%
\renewcommand*{\Glspl}{\cGlspl}%
\renewcommand*{\GLS}{\cGLS}%
\renewcommand*{\GLSpl}{\cGLSpl}%

This makes it easier to enable entry-counting on existing documents.

If you use \GlsXtrEnableEntryCounting more than once, subsequent uses will just set the entrycount attribute for each listed category.

The above example document can then become:

\documentclass{article}
\usepackage{glossaries-extra}
\makeglossaries
\GlsXtrEnableEntryCounting{abbreviation}{1}
\newabbreviation{html}{HTML}{hypertext markup language}
\newabbreviation{xml}{XML}{extensible markup language}
\begin{document}
Used once: \gls{html}.
Used twice: \gls{xml} and \gls{xml}.
\printglossaries
\end{document}

The standard entry-counting function describe above counts the number of times an entry has been marked as used throughout the document. (The reset commands will reset the total back to zero.) If you prefer to count per sectional-unit, you can use


\GlsXtrEnableEntryUnitCounting{categories}{value}{counter-name}

where ⟨categories⟩ is a comma-separated list of categories to which this feature should be applied, ⟨value⟩ is the trigger value and ⟨counter-name⟩ is the name of the counter used by the sectional unit.

Due to the asynchronous nature of TeX’s output routine, discrepancies will occur in page spanning paragraphs if you use the page counter.

Note that you can’t use both the document-wide counting and the per-unit counting in the same document.

The counter value is used as part of a label, which means that \thecounter-name⟩ needs to be expandable. Since hyperref also has a similar requirement and provides \theHcounter-name⟩ as an expandable alternative, glossaries-extra will use \theHcounter-name⟩ if it exists otherwise it will use \thecounter-name⟩.

The per-unit counting function uses two attributes: entrycount (as before) and unitcount (the name of the counter).

Both the original document-wide counting mechanism and the per-unit counting mechanism provide a command that can be used to access the current count value for this run:


\glsentrycurrcount{label}

and the final value from the previous run:


\glsentryprevcount{label}

In the case of the per-unit counting, this is the final value for the current unit. In both commands ⟨label⟩ is the entry’s label.

The per-unit counting mechanism additionally provides:


\glsentryprevtotalcount{label}

which gives the sum of all the per-unit totals from the previous run for the entry given by ⟨label⟩, and


\glsentryprevmaxcount{label}

which gives the maximum per-unit total from the previous run.

The above two commands are unavailable for the document-wide counting.

Example of per-unit counting, where the unit is the chapter:

\documentclass{report}
\usepackage{glossaries-extra}
\GlsXtrEnableEntryUnitCounting{abbreviation}{2}{chapter}
\makeglossaries
\newabbreviation{html}{HTML}{hypertext markup language}
\newabbreviation{css}{CSS}{cascading style sheet}
\newglossaryentry{sample}{name={sample},description={sample}}
\begin{document}
\chapter{Sample}
Used once: \gls{html}.
Used three times: \gls{css} and \gls{css} and \gls{css}.
Used once: \gls{sample}.
\chapter{Another Sample}
Used once: \gls{css}.
Used twice: \gls{html} and \gls{html}.
\printglossaries
\end{document}

In this document, the css entry is used three times in the first chapter. This is more than the trigger value of 2, so \gls{css} is expanded on first use with the short form used on subsequent use, and the css entries in that chapter are added to the glossary. In the second chapter, the css entry is only used once, which trips the suppression trigger, so in that chapter, the long form is used and \gls{css} doesn’t get a line added to the glossary file.

The html is used a total of three times, but the expansion and indexing suppression trigger is tripped in both chapters because the per-unit total (1 for the first chapter and 2 for the second chapter) is less than or equal to the trigger value.

The sample entry has only been used once, but it doesn’t trip the indexing suppression because it’s in the general category, which hasn’t been listed in \GlsXtrEnableEntryUnitCounting.

The per-unit entry counting can be used for other purposes. In the following example document the trigger value is set to zero, which means the index suppression won’t be triggered, but the unit entry count is used to automatically suppress the hyperlink for commands like \gls by modifying the hook


\glslinkcheckfirsthyperhook

which is used at the end of the macro the determines whether or not to suppress the hyperlink.

\documentclass{article}
\usepackage[colorlinks]{hyperref}
\usepackage{glossaries-extra}
\makeglossaries
\GlsXtrEnableEntryUnitCounting{general}{0}{page}
\newglossaryentry{sample}{name={sample},description={an example}}
\renewcommand*{\glslinkcheckfirsthyperhook}{%
  \ifnum\glsentrycurrcount\glslabel>0
   \setkeys{glslink}{hyper=false}%
  \fi
}
\begin{document}
A \gls{sample} entry.
Next use: \gls{sample}.
\newpage
Next page: \gls{sample}.
Again: \gls{sample}.
\printglossaries
\end{document}

This only produces a hyperlink for the first instance of \gls{sample} on each page.

The earlier warning about using the page counter still applies. If the first instance of \gls occurs at the top of the page within a paragraph that started on the previous page, then the count will continue from the previous page.

Top

8.2 Link Counting

As from version 1.26, an alternative method of entry counting is to count the number of times the \gls-like or \glstext-like commands are used. (The “link” in this method’s name refers to the use of the internal command \@gls@link not to \hyperlink although \@gls@link may use \hyperlink when displaying the link-text.)

To enable link counting use the preamble-only command:


\GlsXtrEnableLinkCounting[master counter]{categories}

where ⟨categories⟩ is a list of category labels. The optional argument ⟨master counter⟩ may be used to identify a master counter (which must be defined). If present, the associated link counter will be reset when the master counter is incremented. This command automatically sets the linkcount attribute for the given categories. If the optional argument is present, it also sets the linkcountmaster attribute.

When enabled, commands like \gls and \glstext increment the associated counter using


\glsxtrinclinkcounter{counter name}

This just does \stepcounter{counter name} by default but if you need \refstepcounter instead, just redefine this command:

\renewcommand*{\glsxtrinclinkcounter}[1]{\refstepcounter{#1}}

You can access the internal count register using


\GlsXtrLinkCounterValue{label}

where ⟨label⟩ is the entry’s label. This will expand to 0 if the counter hasn’t been defined.

It’s also possible to access the display value (\thecounter⟩) using


\GlsXtrTheLinkCounter{counter}

(This will expand to 0 if the counter hasn’t been defined.)

In order to conserve resources, the counter is only defined when it first needs to be incremented so terms that have been defined but haven’t been used in the document won’t have the associated count register allocated.

You can test if the counter has been defined using:


\GlsXtrIfLinkCounterDef{label}{true}{false}

where ⟨label⟩ is the entry’s label.

The counter name can be obtained using


\GlsXtrLinkCounterName{label}

This simply expands to the counter name associated with the entry given by ⟨label⟩ without any check for existence. For example, to change the display command (\thecounter⟩) using etoolbox:

\csdef{the\GlsXtrLinkCounterName{duck}}{\Roman{\GlsXtrLinkCounterName{duck}}}

This is useful if you just want to change the display for specific entries but isn’t convenient if you want to change the display for all entries. Instead, it’s simpler to redefine \GlsXtrTheLinkCounter. For example:

\renewcommand*{\GlsXtrTheLinkCounter}[1]{%
 \GlsXtrIfLinkCounterDef{#1}%
 {\Roman{\GlsXtrLinkCounterName{#1}}}%
 {0}%
}

In both cases, the redefinition should be implemented after \GlsXtrEnableLinkCounting.

Here’s an example document that uses link counting to disable the hyperlink after the first reference. This redefines \glslinkpresetkeys (which is used by both \gls and \glstext) instead of \glslinkcheckfirsthyperhook (which is used by \gls but not by \glstext).

\documentclass{article}
\usepackage[colorlinks]{hyperref}
\usepackage{glossaries-extra}
\makeglossaries
\renewcommand*{\glslinkpresetkeys}{%
 \ifnum\GlsXtrLinkCounterValue{\glslabel}>1
  \setkeys{glslink}{hyper=false}%
 \fi
}
\GlsXtrEnableLinkCounting{general}
\newglossaryentry{sample1}{name={sample1},description={an example}}
\newglossaryentry{sample2}{name={sample2},description={another example}}
\newabbreviation{ex}{ex}{example}
\begin{document}
\section{Sample Section}
\Gls{sample1}, \gls{sample2} and \gls{ex}.
\Glstext{sample1} and \gls{ex} again.
\section{Another Sample Section}
\Gls{sample1}, \gls{sample2} and \gls{ex}.
\printglossaries
\end{document}

The use of \glslinkpresetkeys means that the options can override this. For example

\gls[hyper=true]{sample1}

will override the hyper=false setting in \glslinkpresetkeys. If \glslinkpostsetkeys is used instead, the hyper=false setting will override the setting provided in the optional argument.

The abbreviation category doesn’t have the linkcount attribute set (since it’s not listed in the argument of \GlsXtrEnableLinkCounting). This means that \GlsXtrLinkCounterValue always expands to 0 for the abbreviation (ex), so the inequality test

\ifnum\GlsXtrLinkCounterValue{\glslabel}>1

will always be false. This means that the abbreviation won’t have hyper=false applied. If the test is changed to

\ifnum\GlsXtrLinkCounterValue{\glslabel}=1
\else
 \setkeys{glslink}{hyper=false}%
\fi

Then the abbreviation will always have hyper=false applied.

To reset the counter every section use the optional argument to set the master counter:

\GlsXtrEnableLinkCounting[section]{general}

Top

9. Auto-Indexing

It’s possible that you may also want a normal index as well as the glossary, and you may want entries to automatically be added to the index (as in this document). There are two attributes that govern this: indexname and dualindex.

The auto-indexing is designed for makeindex syntax. If you’ve used the xindy package option, the automatic escaping of xindy special characters in the sort field may result in an incorrect sort value for the \index command used by the auto-indexing. Note also that texindy has a fixed set of special characters (corresponding to makeindex’s defaults) that can’t be customized. You may want to consider using bib2gls and its dual entries as an alternative approach.

The \glsxtrpostnamehook macro, used at the end of \glossentryname and \Glossentryname, checks the indexname attribute for the category associated with that entry. Since \glossentryname is used in the default glossary styles, this makes a convenient way of automatically indexing each entry name at its location in the glossary without fiddling around with the value of the name key.

The internal macro used by the glossaries package to write the information to the external glossary file is modified to check for the dualindex attribute.

In both cases, the indexing is done through


\glsxtrdoautoindexname{label}{attribute-label}

This uses the standard \index command with the sort value taken from the entry’s sort key and the actual value set to \glsentryname{label}. As from v1.16, there are user-level commands available to change the sort and actual value used by the automated index.

The actual value is given by


\glsxtrautoindexentry{label}

where ⟨label⟩ is the entry’s label. The default definition is:

\newcommand*{\glsxtrautoindexentry}[1]{\string\glsentryname{#1}}

Note the use of \string to prevent \glsentryname from being expanded as it’s written to the index file.

The sort value is assigned using:


\glsxtrautoindexassignsort{cs}{label}

where ⟨label⟩ is the entry label and ⟨cs⟩ is the command which needs to be set to the sort value. The default definition is:

\newcommand*{\glsxtrautoindexassignsort}[2]{%
  \glsletentryfield{#1}{#2}{sort}%
}

After this macro is called, ⟨cs⟩ is then processed to escape any of makeindex’s special characters. Note that this escaping is only performed on the sort not on the actual value. The escaping of the sort value is performed by


\glsxtrautoindexesc

You can redefine this to do nothing if you want to omit the escaping. You may want to consider providing another field to obtain the appropriate sort value if the one provided in the sort field isn’t suitable (because it may already have had special characters escaped or it may be a numeric value in the case of sort by use or definition).

The command used to perform the actual indexing is:


\glsxtrautoindex{text}

This just does \index{text} by default.

The entry’s parent field isn’t referenced in this automated indexing.

For example, to index the value of the first key, instead of the name key:

\renewcommand*{\glsxtrautoindexentry}[1]{\string\glsentryfirst{#1}}

and if the sort value also needs to be set to the long field, if present, otherwise the sort field:

\renewcommand*{\glsxtrautoindexassignsort}[2]{%
  \ifglshaslong{#2}%
  {\glsletentryfield{#1}{#2}{long}}%
  {\glsletentryfield{#1}{#2}{sort}}%
}

If the value of the attribute given by ⟨attribute-label⟩ is “true”, no encap will be added, otherwise the encap will be the attribute value. For example:

\glssetcategoryattribute{general}{indexname}{textbf}

will set the encap to textbf which will display the relevant page number in bold whereas

\glssetcategoryattribute{general}{dualindex}{true}

won’t apply any formatting to the page number in the index.

The location used in the index will always be the page number not the counter used in the glossary. (Unless some other loaded package has modified the definition of \index to use some thing else.)

By default the format key won’t be used with the dualindex attribute. You can allow the format key to override the attribute value by using the preamble-only command:


\GlsXtrEnableIndexFormatOverride

If you use this command and hyperref has been loaded, then the theindex environment will be modified to redefine \glshypernumber to allow formats that use that command.

The dualindex attribute will still be used on subsequent use even if the indexonlyfirst attribute (or indexonlyfirst package option) is set. However, the dualindex attribute will honour the noindex key.

The \glsxtrdoautoindexname command will attempt to escape any of \makeindex’s special characters, but there may be special cases where it fails, so take care. This assumes the default makeindex actual, level, quote and encap values (unless any of the commands \actualchar, \levelchar, \quotechar or \encapchar have been defined before glossaries-extra is loaded).

If this isn’t the case, you can use the following preamble-only commands to set the correct characters.

Be very careful of possible shifting category codes!


\GlsXtrSetActualChar{char}

Set the actual character to ⟨char⟩.


\GlsXtrSetLevelChar{char}

Set the level character to ⟨char⟩.


\GlsXtrSetEscChar{char}

Set the escape (quote) character to ⟨char⟩.


\GlsXtrSetEncapChar{char}

Set the encap character to ⟨char⟩.

Top

10. bib2gls: Managing Reference Databases

There is a new command line application called bib2gls, which works in much the same way as a combination of bibtex and makeindex/xindy. Instead of storing all your entry definitions in a .tex and loading them using \input or \loadglsentries, the entries can instead be stored in a .bib file and bib2gls can selectively write the appropriate commands to a .glstex file which is loaded using \glsxtrresourcefile (or \GlsXtrLoadResources).

This means that you can use a reference managing system, such as JabRef, to maintain the database and it reduces the TeX overhead by only defining the entries that are actually required in the document. If you currently have a .tex file that contains hundreds of definitions, but you only use a dozen or so in your document, then the build time is needlessly slowed by the unrequired definitions that occur when the file is input. (You can convert an existing .tex file containing glossary definitions to a .bib file using convertgls2bib, supplied with bib2gls.)

There are some new commands and options added to glossaries-extra to help assist the integration of bib2gls into the document build process.

This chapter just provides a general overview of bib2gls. The full details and some sample documents are provided in the bib2gls manual.

An example of the contents of .bib file that stores glossary entries that can be extracted with bib2gls:

@entry{bird,
  name={bird},
  description = {feathered animal},
  see={[see also]{duck,goose}}
}
@entry{duck,
  name={duck},
  description = {a waterbird with short legs}
}
@entry{goose,
  name="goose",
  plural="geese",
  description={a waterbird with a long neck}
}

The follow provides some abbreviations:

@string{ssi={server-side includes}}
@string{html={hypertext markup language}}
@abbreviation{shtml,
  short="shtml",
  long= ssi # " enabled " # html,
  description={a combination of \gls{html} and \gls{ssi}}
}
@abbreviation{html,
  short ="html",
  long  = html,
  description={a markup language for creating web pages}
}
@abbreviation{ssi,
  short="ssi",
  long = ssi,
  description={a simple interpreted server-side scripting language}
}

Here are some symbols:

preamble{"\providecommand{\mtx}[1]{\boldsymbol{#1}}"}
@symbol{M,
  name={$\mtx{M}$},
  text={\mtx{M}},
  description={a matrix}
}
@symbol{v,
  name={$\vec{v}$},
  text={\vec{v}},
  description={a vector}
}
@symbol{S,
  name={$\mathcal{S}$},
  text={\mathcal{S}},
  description={a set}
}

To ensure that bib2gls can find out which entries have been used in the document, you need the record package option:

\usepackage[record]{glossaries-extra}

If this option’s value is omitted (as above), the normal indexing will be switched off, since bib2gls can also sort the entries and collate the locations.

If you still want to use an indexing application (for example, you need a custom xindy rule), then just use record=hybrid and continue to use \makeglossaries and \printglossary (or \printglossaries), but you also need to instruct bib2gls to omit sorting to save time and to prevent the sort key from being set.

The .glstex file created by bib2gls is loaded using:


\glsxtrresourcefile[options]{filename}

(Don’t include the file extension in ⟨filename⟩.) There’s a shortcut version (recommended over the above) that sets ⟨filename⟩ to use \jobname:


\GlsXtrLoadResources[options]

On the first use, this command is a shortcut for

\glsxtrresourcefile[options]{\jobname}
On subsequent use,10.1 this command is a shortcut for
\glsxtrresourcefile[options]{\jobname-n}
where ⟨n⟩ is the current value of


\glsxtrresourcecount

which is incremented at the end of \GlsXtrLoadResources. Any advisory notes regarding \glsxtrresourcefile also apply to \GlsXtrLoadResources.

The \glsxtrresourcefile command writes the line

\glsxtr@resource{options}{filename}
to the .aux file and will input ⟨filename.glstex if it exists.10.2

Since the .glstex file won’t exist on the first LaTeX run, the record package option additionally switches on undefaction=warn. Any use of commands like \gls or \glstext will produce ?? in the document, since the entries are undefined at this point. Once bib2gls has created the .glstex file the references should be resolved. This may cause a shift in the locations if the actual text produced once the entry is defined is significantly larger than the placeholder ?? (as this can alter the page breaking).

Note that as from v1.12, \glsxtrresourcefile temporarily switches the category code of @ to 11 (letter) while it reads the file to allow for any internal commands stored in the location field.

Top

10.1 Selection

The default behaviour is for bib2gls to select all entries that have a record in the .aux file, and any dependent entries (including parent and cross-references). The glsignore format (for example, \gls[format=glsignore]{duck}) is recognised by bib2gls as a special ignored record. This means that it will match the selection criteria but the record won’t be added to the location list. This means that you won’t get spurious commas in the location list (as can happen with the other indexing methods), so you can do, for example,

\GlsXtrSetDefaultNumberFormat{glsignore}

at the start of the front matter and

\GlsXtrSetDefaultNumberFormat{glsnumberformat}

at the start of the main matter to prevent any records in the front matter from occurring in the location lists.

Note that commands like \glsaddall and \glsaddallunused don’t work with bib2gls as the command has to iterate over the internal lists of defined entry labels, which will be empty on the first run and on subsequent runs will only contain those entries that have been selected by bib2gls.

If you want to add all entries to the glossary, you need to tell bib2gls this in the options list. For example:

\GlsXtrLoadResources[src={terms},selection={all}]

This will add all entries, regardless of whether or not they have any records in the .aux file. Those that don’t have any records will have an empty location list. See the bib2gls user manual for more details of this option.

Top

10.2 Sorting and Displaying the Glossary

There are many sorting options provided by bib2gls. The default is to sort according to the system locale. If the document has a language setting, you can use sort=doc to instruct bib2gls to sort according to that. (The language tag obtained from tracklang’s interface is written to the .aux file.) For a multilingual document you need to explicitly set the locale using a well-formed language tag. For example:

\GlsXtrLoadResources[
  src=terms, % data in terms.bib
  sort=de-DE-1996 % sort according to this locale
]

The locale-sensitive sort methods usually ignore most punctuation so for lists of symbols you may find it more appropriate to use one of the letter-base sort methods that sort according to the Unicode value of each character. Alternatively you can provide a custom rule. See the bib2gls manual for full details of all the available sort methods.

Since the .glstex file only defines those references required within the document (selected according to the selection option) and the definitions have been written in the order corresponding to bib2gls’s sorted list, the glossaries can simply be displayed using \printunsrtglossary (or \printunsrtglossaries), described in §11.2 Display All Entries Without Sorting or Indexing.

Suppose the .bib examples shown above have been stored in the files terms.bib, abbrvs.bib and symbols.bib which may either be in the current directory or on TeX’s path. Then the document might look like:

\documentclass{article}
\usepackage[record]{glossaries-extra}
\setabbreviationstyle{long-short-desc}
\GlsXtrLoadResources[src={terms,abbrvs,symbols}]
\begin{document}
\gls{bird}
\gls{shtml}
\gls{M}
\printunsrtglossaries
\end{document}

The document build process (assuming the document is called mydoc) is:

pdflatex mydoc
bib2gls mydoc
pdflatex mydoc

This creates a single glossary containing the entries: bird, duck, goose, html, M, shtml and ssi (in that order). The bird, shtml and M entries were added because bib2gls detected (from the .aux file) that they had been used in the document. The other entries were added because bib2gls detected (from the .bib files) that they are referenced by the used entries. In the case of duck and goose, they are in the see field for bird. In the case of ssi and html, they are referenced in the description field of shtml. These cross-referenced entries won’t have a location list when the glossary is first displayed, but depending on how they are referenced, they may pick up a location list on the next document build.

The entries can be separated into different glossaries with different sort methods:

\documentclass{article}
\usepackage[record,abbreviations,symbols]{glossaries-extra}
\setabbreviationstyle{long-short-desc}
\GlsXtrLoadResources[src={terms},sort={en-GB},type=main]
\GlsXtrLoadResources
 [src={abbrvs},sort={letter-nocase},type=abbreviations]
\GlsXtrLoadResources
 [src={symbols},sort={use},type={symbols}]
\begin{document}
\gls{bird}
\gls{shtml}
\gls{M}
\printunsrtglossaries
\end{document}

Or you can have multiple instance of \GlsXtrLoadResources with the same type, which will produce a glossary with ordered sub-blocks. For example:

\documentclass{article}
\usepackage[record,style=indexgroup]{glossaries-extra}
\setabbreviationstyle{long-short-desc}
\GlsXtrLoadResources
 [src={abbrvs},sort={letter-nocase},type=main,
  group={Abbreviations}]
\GlsXtrLoadResources
 [src={symbols},sort={use},type=main,
  group={Symbols}]
\GlsXtrLoadResources[src={terms},sort={en-GB},type=main]
\begin{document}
\gls{bird}
\gls{shtml}
\gls{M}
\printunsrtglossaries
\end{document}

This will result in a glossary where the first group has the title “Abbreviations”, the second group has the title “Symbols” and then follow the usual letter groups. Note that for this example to work, you must run bib2gls with the --group (or -g) switch. For example, if the document is called myDoc.tex:

pdflatex myDoc
bib2gls -g myDoc
pdflatex myDoc

The value of the group field must always be a label. You can set the corresponding title with \glsxtrsetgrouptitle (see §2.11 Glossary Style Modifications). If no title is set then the label is used as the group title.

You can provide your own custom sort rule. For example, if you are using XƎLATEX or LuaLATEX:

\GlsXtrLoadResources[
  src=terms, % entries in terms.bib
  sort=custom, % custom sort rule
  sort-rule={% required with sort=custom
  < æ;Æ < a;á;å;ä,Ä;Á;Å;Ä < b,B
  < c;ć,C;Ć < d,D < e;é,E;É < f,F < g,G
  < h,H < i;í,I;Í < j,J < l;ł,L;Ł < m,M < n,N
  < o;ö;ø,O;Ö < p,P < q,Q < r,R < s;ś,S;Ś
  < t,T < u;ú,U;Ú < v,V < w,W < x,X < y,Y <
  z;ż,Z;Ż
  }
]
Remember that if you are using inputenc then extended characters, such as é or ø, are active and will expand when written to the .aux file. So with PDFLaTeX the above would have to be changed to protect against expansion. Some of the options, including sort-rule, allow Unicode characters to be indicated in the format \uhex⟩ (or \u ⟨hex⟩) in the .aux file. bib2gls will recognise this as the character given by the hexadecimal value ⟨hex⟩. The \u also needs protection from expansion, so with a non-Unicode aware engine, the character æ needs to be written as \string\uE6 and so on. This is quite cumbersome, but you can use the shortcut \glshex E6 instead, so the above needs to be written as:
\GlsXtrLoadResources[
  src=terms, % entries in terms.bib
  sort=custom, % custom sort rule
  sort-rule={% required with sort=custom
  < \glshex E6;\glshex C6
  < a;\glshex E1;\glshex E5,\glshex E4,A;\glshex C1;\glshex C5;\glshex C4
  < b,B < c;\glshex 0107,C;\glshex 0106 < d,D
  < e;\glshex E9,E;\glshex C9 < f,F < g,G
  < h,H < i;\glshex ED,I;\glshex CD < j,J
  < l;\glshex 0142,L;\glshex 0141 < m,M < n,N
  < o;\glshex F6;\glshex F8,O;\glshex D6;\glshex D8
  < p,P < q,Q < r,R < s;\glshex 013F,S;\glshex 015A
  < t,T < u;\glshex FA,U;\glshex DA < v,V < w,W < x,X < y,Y
  < z;\glshex 017C,Z;\glshex 017B
  }]

Top

10.3 The glossaries-extra-bib2gls package

The package option record=only (or simply record) automatically loads the supplementary package glossaries-extra-bib2gls, which provides some commands that are specific to bib2gls. The package isn’t loaded by record=hybrid as that option is intended for sorting with makeindex or xindy and it is expected that the sorting will be switched off (with the resource option sort=none).

If glossaries-extra-bib2gls is loaded via the record package option then the check for associated language resource files (see §15 Multi-Lingual Support) will also search for the existence of glossariesxtr-script.ldf for each document dialect (where ⟨script⟩ is the four letter script identifier, such as Latn).

This package provides some shortcut commands that use \printunsrtglossary if the relevant package option has defined the associated glossary: \printunsrtabbreviations, \printunsrtacronyms, \printunsrtsymbols, \printunsrtnumbers and \printunsrtindex.

The savenumberlist package option doesn’t have any effect with bib2gls. The location lists are saved by default, so glossaries-extra-bib2gls patches \glsentrynumberlist and \glsdisplaynumberlist to work with the location field


\glsxtrprovidecommand{cs}[n][default]{definition}

This command is intended for use in @preamble. It’s simply defined to \providecommand in glossaries-extra-bib2gls but bib2gls’s interpreter treats it as \renewcommand. This means that you can override bib2gls’s internal definition of a command without overriding the command definition in the document (if it’s already defined before the resource file is input). For example

@preamble{"\glsxtrprovidecommand{\int}{integral}"}

This will force bib2gls to treat \int as the word “integral” to assist sorting but if this preamble code is written to the .glstex file (as it is by default) then it won’t override the current definition (provided by the kernel or redefined by a package).

The helper commands in the resource files are defined using \providecommand. For many of them, if you want to provide an alternative definition then you need to define the command before the resource file is loaded. There are a few that may be redefined afterwards but if you use \renewcommand then you will get an error on the first LaTeX run when the .glstex file doesn’t exist. In this case, you may prefer to use:


\glsrenewcommand{cs}[n][default]{definition}

This behaves like \renewcommand but only generates a warning rather than an error if the command isn’t already defined so it won’t interrupt the document build.


\GlsXtrIndexCounterLink{text}{label}

If the \hyperref command has been defined (that is, hyperref has been loaded before glossaries-extra) then this command checks for the existence of the indexcounter field. If this field is set for the entry given by ⟨label⟩, this command does \hyperref[wrglossary.value]{text}, where ⟨value⟩ is the value of the indexcounter field. If the field isn’t set or if \hyperref hasn’t been defined, this just does ⟨text⟩. This command is provided for use with the indexcounter package option combined with bib2gls’s save-index-counter resource option. See the bib2gls manual for further details (at least version 1.4).

If you use the set-widest resource option, bib2gls v1.8+ will now use:


\glsxtrSetWidest{type}{level}{text}

(if it has been defined) to set the widest name for the given glossary type and level. This allows for both the alttree style and the styles provided by glossary-longextra, which need to know the widest name.

If bib2gls can’t determine the widest name (typically because the name field consists of commands that aren’t recognised by the interpreter) then bib2gls v1.8+ will now use:


\glsxtrSetWidestFallback{max depth}{list}

(if defined). Currently the maximum hierarchical depth ⟨max depth⟩ may only be 0 or 2. This command requires commands provided by the glossaries-extra-stylemods package with the alttree style enabled. In this case, it may be simpler to just use \glssetwidest.

Top

10.3.1 Supplemental Locations


\glsxtrdisplaysupploc{prefix}{counter}{format}{src}{location}

This is used by bib2gls version 1.7+ for supplemental locations, instead of using \glsxtrsupphypernumber with the externallocation attribute. This command sets up the location counter and prefix (used in the formation of hyperlinks) and then uses


\glsxtrmultisupplocation{location}{src}{format}

to format the actual location (with an external hyperlink, if supported).

Top

10.3.2 Nameref Record

Normally locations are recorded in the .aux file in the form:


\glsxtr@record{label}{prefix}{counter}{format}{location}

The record=nameref option, which requires at least bib2gls v1.8, instead uses:


\glsxtr@record@nameref{label}{prefix}{counter}{format}{location} {title}{href}{hcounter}

where ⟨title⟩ is obtained from \@currentlabelname and ⟨href ⟩ is obtained from \@currentHref. These commands require hyperref. If they are undefined, ⟨title⟩ and ⟨href ⟩ will be left empty and bib2gls will treat it as a regular record.

Be careful with this option as ⟨href ⟩ will globally change on every instance of \refstepcounter but ⟨title⟩ won’t necessarily change. It can therefore cause unexpected behaviour.

The final argument ⟨hcounter⟩ is obtained from \theHcounter⟩ which provides the partial target name associated with the indexing counter. With the original makeindex/xindy approach, it’s not possible to include this information in the location, so the base glossaries package attempts to derive a prefix from which the ⟨hcounter⟩ value can be reconstituted by appending the prefix. Unfortunately, not all definitions of \theHcounter⟩ are in the form ⟨prefix\thecounter⟩ (most notably the equation counter with chapters) so this can fail.

Since bib2gls is customized specifically for use with glossaries-extra, it’s now possible to save ⟨hcounter⟩, so the record=nameref option does this. By providing both ⟨href ⟩ and ⟨hcounter⟩, you can determine which target you would rather use. The default is to use ⟨hcounter⟩, which will take you to the place where the corresponding counter was incremented with \refstepcounter. However, you may choose to switch to using the ⟨href ⟩ target, which will take you to the nearest target before the indexing took place.

With bib2gls v1.8+, normal locations are displayed using:


\glsnoidxdisplayloc{prefix}{counter}{format}{location}

This is provided by the base glossaries package and is simply defined to do:


\setentrycounter[prefix]{counter}\csuse{format}{location}

Earlier versions of bib2gls only used this in the loclist field and explicitly used \setentrycounter in the location field followed by \format{location}, which follows the code that’s created with the default makeindex setting. The \setentrycounter command sets up the prefix needed for \glshypernumber to reform the target name from the given location.

The locations identified by \glsxtr@record@nameref are written by bib2gls to the location list using:


\glsxtrdisplaylocnameref{prefix}{counter}{format}{location} {title}{href}{hcounter}{file}

With normal internal locations, ⟨file⟩ will always be empty. With supplemental locations, ⟨file⟩ will be the external file reference.

The default definition is:

\newcommand*{\glsxtrdisplaylocnameref}[8]{%
  \ifstrequal{#2}{equation}%
  {\glsxtrnamereflink{#3}{(#4)}{#2.#7}{#8}}%
  {%
     \ifstrempty{#5}%
     {%
       \glsxtrnamereflink{#3}{#4}{#2.#7}{#8}%
     }%
     {%
       \ifstrequal{#2}{page}%
       {\glsxtrnamereflink{#3}{#4}{#2.#7}{#8}}%
       {\glsxtrnamereflink{#3}{#5}{#2.#7}{#8}}%
     }%
  }%
}

which uses:


\glsxtrnamereflink{format}{title}{target}{file}

This ignores the ⟨prefix⟩, ⟨counter⟩ and {location} arguments and instead creates a hyperlink with the target name obtained from ⟨target⟩ (and ⟨file⟩, if not empty).

Since pages and equations typically don’t have titles, the default definition of \glsxtrdisplaylocnameref checks the counter was used as the location. If it’s page or if ⟨title⟩ is empty, then just the location is used as the hyperlink text. If the counter equation, then the text is the location in parentheses. Otherwise the text is obtained from ⟨title⟩.

If ⟨file⟩ is empty an internal link is created with:


\glsxtrfmtinternalnameref{target}{format}{title}

otherwise an external link is created with:


\glsxtrfmtexternalnameref{target}{format}{title}{file}

The ⟨file⟩ argument is set by bib2gls for supplemental locations.

Here’s alternative definition that uses the ⟨prefix⟩ and ⟨counter⟩ to reform the target name (as \glsnoidxdisplayloc) but uses the ⟨title⟩ as the hyperlink text:

\renewcommand*{\glsxtrdisplaylocnameref}[7]{%
 \glsxtrnamereflink{#3}{#5}{#6}{#7}%
}

which uses:


\glsxtrnameloclink{prefix}{counter}{format}{location}{title} {file}

This uses the same commands as \glsxtrnamereflink to produce the hyperlinks.

In both cases, the link is encapsulated with the text-block command whose name is given by ⟨format⟩, but \glshypernumber is first locally redefined to \@firstofone to prevent a conflict with the usual location hyperlink formation. This means that if the ⟨format⟩ is hyperbf then it will simply behave like textbf.

For compactness, bib2gls merges normal records if the ⟨prefix⟩, ⟨counter⟩ and ⟨location⟩ all match. (An order of precedence can be provided for format conflicts.) With nameref records, you can use the --merge-nameref-on switch provided by bib2gls v1.8+ to determine how to merge nameref records. This switch must be followed by one of the following keywords: hcounter (merge on ⟨hcounter⟩, default) href (merge on ⟨href ⟩), title (merge on ⟨title⟩) and location (merge on ⟨location⟩, as regular records). In all cases, the ⟨counter⟩ must also match.

Top

10.3.3 Helper Commands for Resource Options


\glshex

This is just defined as \string\u, which is required when you need to indicate a Unicode character in the form \uhex⟩ in some of the resource options (as illustrated above).


\glscapturedgroup

This is just defined as \string\$ and is used for the captured group reference in a replacement part of a regular expression substitution (requires at least bib2gls version 1.5). For example:

sort-replace={{([a-zA-Z])\string\.}{\glscapturedgroup1}}

This only removes a full stop that follows any of the characters a,…,z or A,…,Z.

If you use the save-child-count resource option, you can test if the childcount field is non-zero using:


\GlsXtrIfHasNonZeroChildCount{label}{true}{false}

This internally uses \GlsXtrIfFieldNonZero and will do ⟨false⟩ if the field isn’t set. Within ⟨true⟩ and ⟨false⟩ you can use \glscurrentfieldvalue to access the value. (It will be 0 in ⟨false⟩ if the field isn’t set.) As from v1.47, there is also a starred version which uses \GlsXtrIfFieldNonZero* (don’t add grouping).

A convenient shortcut for use in the entry-type-aliases setting:


\GlsXtrBibTeXEntryAliases

This provides aliases for BibTeX’s standard entry types to bib2gls’s @bibtexentry entry type (requires at least bib2gls version 1.4).

You may also want to provide storage keys for BibTeX’s standard fields rather than having to alias them all. This can be done with:


\GlsXtrProvideBibTeXFields

Note that BibTeX’s type field clashes with the glossaries package’s type key, so this command provides the key bibtextype instead. You can alias it with field-aliases=type=bibtextype in the resource options. Each storage key is provided with a convenient command to access the value in the form \glsxtrbibfield⟩. For example, \glsxtrbibaddress. The bibtextype field can be accessed with \glsxtrbibtype. Each of these commands takes the entry label as the sole argument.

The glossaries-extra-bib2gls package also provides definitions of the missing mathematical Greek commands: \Alpha, \Beta, \Epsilon, \Zeta, \Eta, \Iota, \Kappa, \Mu, \Nu, \Omicron, \Rho, \Tau, \Chi, \Digamma, \omicron. These are all defined with \providecommand, so they won’t override any definitions provided by any package loaded before glossaries-extra. Since bib2gls’s interpreter recognises these commands, using them instead of explicitly using the Latin characters with the same shape helps to keep the Greek symbols together when sorting. Similarly, if upgreek has been loaded, the missing upright Greek commands are also provided.

The remaining commands provide common rule blocks for use in the sort-rule resource option. If you want a rule for a specific locale, you can provide similar commands in a file called glossariesxtr-tag.ldf, where ⟨tag⟩ identifies the dialect, locale, region or root language. See the description of \IfTrackedLanguageFileExists in the tracklang documentation for further details. If this file is on TeX’s path and the tracklang package (automatically loaded by glossaries) detects that the document has requested that language or locale, then the file will automatically be loaded. For example, if you want to provide a rule block for Welsh, then create a file called glossariesxtr-welsh.ldf that contains:

\ProvidesGlossariesExtraLang{welsh}[2018/02/23 v1.0]
\@ifpackageloaded{glossaries-extra-bib2gls}
{
  \newcommand{\glsxtrWelshRules}{%
   \glsxtrLatinA
   \string<b,B
   \string<c,C
   \string<ch,CH
   \string<d,D
   \string<dd,DD
   \string<\glsxtrLatinE
   \string<f,F
   \string<ff,FF
   \string<g,G
   \string<ng,NG
   \string<\glsxtrLatinH
   \string<\glsxtrLatinI
   \string<j,J
   \string<\glsxtrLatinL
   \string<ll,LL
   \string<\glsxtrLatinM
   \string<\glsxtrLatinN
   \string<\glsxtrLatinO
   \string<\glsxtrLatinP
   \string<ph,PH
   \string<r,R
   \string<rh,RH
   \string<\glsxtrLatinS
   \string<\glsxtrLatinT
   \string<th,TH
   \string<u,U
   \string<w,W
   \string<y,Y
  }
}
{}% glossaries-extra-bib2gls.sty not loaded

(The use of \string is in case the < character has been made active.) You can provide more than one rule-block per local, to allow for loanwords or foreign words. For example, you could provide \glsxtrWelshIRules, \glsxtrWelshIIRules etc.

If the rules are for a particular script (independent of language or region) then they can be provided in a file given by glossariesxtr-script.ldf instead. For example, the file glossariesxtr-Cyrl.ldf could contain:

\ProvidesGlossariesExtraLang{Cyrl}[2018/02/23 v1.0]
\newcommand*{\glsxtrGeneralCyrillicIRules}{%
  % Cyrillic rules
}
\newcommand*{\glsxtrGeneralCyrillicIIRules}{%
  % an alternative set of Cyrillic rules
}

(Remember that the required document language scripts need to be tracked through the tracklang package, in order for these files to be automatically loaded. This essentially means ensuring you load the appropriate language package before tracklang is loaded by the base glossaries package or any other package that uses it. See the tracklang documentation for further details.)

Alternatively, if the rules are specific to a subject rather than a region or language, then you can provide a supplementary package. For example, if you have a package called, say, mapsymbols that provides map symbols, then the file mapsymbols.sty might contain:

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mapsymbols}
 some package or font loading stuff here to provide
 the appropriate symbols
\newcommand{\Stadium}{...}
\newcommand{\Battlefield}{...}
\newcommand{\Harbour}{...}
 etc
 Provide a rule block:
\newcommand{\MapSymbolOrder}{%
 \glshex 2694 % crossed-swords 0x2694
 \string< \glshex 2693 % anchor 0x2693
 \string< \glshex 26BD % football 0x26BD
}

and the supplementary file mapsymbols.bib can provide the appropriate definitions for bib2gls:

@preamble{"\glsxtrprovidecommand{\Harbour}{\char"2693}
\glsxtrprovidecommand{\Battlefield}{\char"2694}
\glsxtrprovidecommand{\Stadium}{\char"26BD}"}

Now both the preamble and rule block can be used in the resource set:

\usepackage{mapsymbols}% my custom package
\usepackage[record]{glossaries-extra}
\GlsXtrLoadResources[
  src={mapsymbols,% <--- my custom mapsymbols.bib
   entries% data in entries.bib
  },
  sort={custom},
  sort-rule={\glsxtrcontrolrules % control codes
 ;\glsxtrspacerules % space characters
 ;\glsxtrnonprintablerules % non-printable characters
 ;\glsxtrcombiningdiacriticrules % combining diacritics
 ,\glsxtrhyphenrules % hyphens
 <\glsxtrgeneralpuncrules % general punctuation
 <\glsxtrdigitrules % 0, ..., 9
 <\glsxtrfractionrules % fraction symbols
 <\MapSymbolOrder % <--- custom map symbols
 <\glsxtrMathItalicGreekIrules % math-greek symbols
 <\glsxtrGeneralLatinIrules % Latin letters
 }
]

The following commands are provided by glossaries-extra-bib2gls. They should be separated by the rule separator characters ; (semi-colon) or , (comma) or & (ampersand) or < (less than). See Java’s RuleBasedCollator documentation for details of the rule syntax.

For example, the following will place the mathematical Greek symbols (\alpha, \Alpha, \beta, \Beta etc) in a block before Latin characters:

sort-rule={\glsxtrcontrolrules
 ;\glsxtrspacerules
 ;\glsxtrnonprintablerules
 ;\glsxtrcombiningdiacriticrules
 ,\glsxtrhyphenrules
 <\glsxtrgeneralpuncrules
 <\glsxtrdigitrules
 <\glsxtrfractionrules
 <\glsxtrMathItalicGreekIrules
 <\glsxtrGeneralLatinIVrules
 <\glsxtrLatinAA
 <\glsxtrLatinOslash
}


\glsxtrcontrolrules

These are control characters that are usually placed at the start of a rule in the ignored section. They typically won’t occur in any sort values, but if they do they should normally be ignored.


\glsxtrspacerules

These are space characters. They typically come after the control characters with the two blocks separated by a ; (semi-colon).


\glsxtrnonprintablerules

These are non-printable characters (BOM, tabs, line feed and carriage return). They typically come after the spaces separated by a ; (semi-colon). These characters aren’t checked for by bib2gls when it determines whether or not to use the interpreter, so a TAB or newline character may end up in the sort value if it wasn’t interpreted.


\glsxtrcombiningdiacriticrules

These are combining diacritic marks which typically follow the space and non-printable blocks (separated by a semi-colon). This command is defined in terms of sub-block commands:

\newcommand*{\glsxtrcombiningdiacriticrules}{%
 \glsxtrcombiningdiacriticIrules\string;
 \glsxtrcombiningdiacriticIIrules\string;
 \glsxtrcombiningdiacriticIIIrules\string;
 \glsxtrcombiningdiacriticIVrules
}

If you prefer, you can use the sub-blocks directly in your required ordered.


\glsxtrcombiningdiacriticIrules

This contains the combining diacritics: acute, grave, breve, circumflex, caron, ring, vertical line above, diaeresis (umlaut), double acute, tilde, dot above, combining macron.


\glsxtrcombiningdiacriticIIrules

This contains the combining diacritics: short solidus overlay, cedilla, ogonek, dot below, low line, overline, hook above, double vertical line above, double grave accent, candrabindu, inverted breve, turned comma above, comma above, reversed comma above, comma above right, grave accent below, acute accent below.


\glsxtrcombiningdiacriticIIIrules

This contains the combining diacritics: left tack below, right tack below, left angle above, horn, left half ring below, up tack below, down tack below, plus sign below, minus sign below, palatalized hook below, retroflex hook below, diaresis below, ring below, comma below, vertical line below, bridge below, inverted double arch below, caron below, circumflex accent below, breve below, inverted breve below, tilde below, macron below, double low line, tilde overlay, short stroke overlay, long stroke overlay, long solidus overlay, right half ring below, inverted bridge below, square below, seagull below, x above, vertical tilde, double overline, Greek perispomeni, Greek dialytika tonos, Greek ypogegrammeni, double tilde, double inverted breve, Cyrillic titlo, Cyrillic palatalization, Cyrillic dasia pneumata, Cyrillic psili pneumata.


\glsxtrcombiningdiacriticIVrules

This contains the combining diacritics: left harpoon above, right harpoon above, long vertical line overlay, short vertical line overlay, anticlockwise arrow above, clockwise arrow above, left arrow above, right arrow above, ring overlay, clockwise ring overlay, anticlockwise ring overlay, three dots above, four dots above, enclosing circle, enclosing square, enclosing diamond, enclosing circle backslash, left right arrow above.


\glsxtrhyphenrules

This contains hyphens (including the minus sign 0x2212). This rule block typically comes after the diacritic rules separated by a comma.


\glsxtrgeneralpuncrules

This contains punctuation characters. This rule block typically comes after the hyphen rules separated by a less than (<). As with the combining diacritics, this command is defined in terms of sub-blocks which may be used directly instead if a different order is required:

\newcommand*{\glsxtrgeneralpuncrules}{%
  \glsxtrgeneralpuncIrules
  \string<\glsxtrcurrencyrules
  \string<\glsxtrgeneralpuncIIrules
}


\glsxtrgeneralpuncIrules

This is the first punctuation sub-block containing: underscore, macron, comma, semi-colon, colon, exclamation mark, inverted exclamation mark, question mark, inverted question mark, solidus, full stop, acute accent, grave accent, circumflex accent, diaersis, tilde, middle dot, cedilla, straight apostrophe, straight double quote, left guillemet, right guillemet, left parenthesis, right parenthesis, left square bracket, right square bracket, left curly bracket, right curly bracket, section sign, pilcrow sign, copyright sign, registered sign, at sign.


\glsxtrcurrencyrules

This sub-block contains some currency symbols: currency sign, Thai currency symbol baht, cent sign, colon sign, cruzeiro sign, dollar sign, dong sign, euro sign, French franc sign, lira sign, mill sign, naira sign, peseta sign, pound sign, rupee sign, new sheqel sign, won sign, yen sign.


\glsxtrgeneralpuncIIrules

This sub-block contains some other punctuation symbols: asterisk, backslash, ampersand, hash sign, percent sign, plus sign, plus-minus sign, division sign, multiplication sign, less-than sign, equals sign, greater-than sign, not sign, vertical bar (pipe), broken bar, degree sign, micron sign.


\glsxtrdigitrules

This rule block contains the Basic Latin digits (0, …, 9) and the subscript and superscript digits (0 0 etc) made equivalent to the corresponding Basic Latin digit. The digit block typically comes after the punctuation rules separated by a less than (<).


\glsxtrBasicDigitrules

This rule block contains just the Basic Latin digits (0, …, 9).


\glsxtrSubScriptDigitrules

This rule block contains just the subscript digits (0 … 9).


\glsxtrSuperScriptDigitrules

This rule block contains just the superscript digits (0 … 9).


\glsxtrfractionrules

This rule block contains vulgar fraction characters. The digit block typically comes after the digit rules separated by a less than (<).

There are a number of Latin rule blocks. Some of these included extended characters or ligatures (such as ß or œ) but they don’t include accented characters. If you require a Latin rule block that includes accented characters, digraphs, trigraphs or other extended characters, then it’s best to provide similar commands in a glossariesxtr-tag.ldf file for the particular language or region.


\glsxtrGeneralLatinIrules

This is just the basic (non-extended) Latin alphabet with the superscript and subscript Latin letters (a a etc) treated as the equivalent basic Latin letter. (If you don’t want the subscripts and superscripts included you can redefine \glsxtrLatinA etc to omit them.)


\glsxtrGeneralLatinIIrules

This is like \glsxtrGeneralLatinIrules but it includes eth (Ð) between ‘D’ and ‘E’ and eszett (ß) treated as ‘ss’.


\glsxtrGeneralLatinIIIrules

This is like \glsxtrGeneralLatinIrules but it includes eth (Ð) between ‘D’ and ‘E’ and eszett (ß) treated as ‘sz’.


\glsxtrGeneralLatinIVrules

This is like \glsxtrGeneralLatinIrules but it includes eth (Ð) between ‘D’ and ‘E’, ae-ligature (æ) is treated as ‘ae’, oe-ligature (œ) is treated as ‘oe’, eszett (ß) treated as ‘ss’ and thorn (þ) is treated as ‘th’.


\glsxtrGeneralLatinVrules

This is like \glsxtrGeneralLatinIrules but it includes eth (Ð) between ‘D’ and ‘E’, eszett (ß) treated as ‘ss’ and thorn (þ) treated as ‘th’.


\glsxtrGeneralLatinVIrules

This is like \glsxtrGeneralLatinIrules but it includes eth (Ð) between ‘D’ and ‘E’, eszett (ß) treated as ‘sz’ and thorn (þ) treated as ‘th’.


\glsxtrGeneralLatinVIIrules

This is like \glsxtrGeneralLatinIrules but it includes ae-ligature (æ) between ‘A’ and ‘B’, eth (Ð) between ‘D’ and ‘E’, insular G (Ᵹ) instead of ‘G’, oe-ligature between ‘O’ and ‘P’, long s (ſ) equivalent to ‘s’, thorn (þ) between ‘T’ and ‘U’ and wynn (Ƿ) instead of W.


\glsxtrGeneralLatinVIIIrules

This is like \glsxtrGeneralLatinIrules but ae-ligature (æ) is treated as ‘ae’, oe-ligature (œ) is treated as ‘oe’, eszett (ß) treated as ‘ss’, thorn (þ) is treated as ‘th’, Ø is treated as ‘O’ and ‘Ł’ is treated as ‘L’.


\glsxtrLatinA

A mini-rule that just covers ‘A’ but includes the sub- and superscript A.


\glsxtrLatinE

A mini-rule that just covers ‘E’ but includes the subscript E.


\glsxtrLatinH

A mini-rule that just covers ‘H’ but includes the subscript H.


\glsxtrLatinK

A mini-rule that just covers ‘K’ but includes the subscript K.


\glsxtrLatinI

A mini-rule that just covers ‘I’ but includes the superscript I.


\glsxtrLatinL

A mini-rule that just covers ‘L’ but includes the subscript L.


\glsxtrLatinM

A mini-rule that just covers ‘M’ but includes the subscript M.


\glsxtrLatinN

A mini-rule that just covers ‘N’ but includes the sub- and superscript N.


\glsxtrLatinO

A mini-rule that just covers ‘O’ but includes the sub- and superscript O.


\glsxtrLatinP

A mini-rule that just covers ‘P’ but includes the subscript P.


\glsxtrLatinS

A mini-rule that just covers ‘S’ but includes the subscript S.


\glsxtrLatinT

A mini-rule that just covers ‘T’ but includes the subscript T.


\glsxtrLatinX

A mini-rule that just covers ‘X’ but includes the subscript X.


\glsxtrLatinEszettSs

A mini-rule that just covers eszett (ß) and makes long s (ſ) followed by short ‘s’ equivalent to ‘ß’. (This is used in the above blocks that treat ‘ß’ as ‘ss’.)


\glsxtrLatinEszettSz

A mini-rule that just covers eszett (ß) and makes long s (ſ) followed by ‘z’ equivalent to ‘ß’. (This is used in the above blocks that treat ‘ß’ as ‘sz’.)


\glsxtrLatinEth

A mini-rule for eth (Ð) so you don’t need to remember the Unicode values.


\glsxtrLatinThorn

A mini-rule for thorn (þ) so you don’t need to remember the Unicode values.


\glsxtrLatinAELigature

A mini-rule for ae-ligature (æ) so you don’t need to remember the Unicode values.


\glsxtrLatinOELigature

A mini-rule for oe-ligature (œ) so you don’t need to remember the Unicode values.


\glsxtrLatinOslash

A mini-rule for ‘Ø’ so you don’t need to remember the Unicode values.


\glsxtrLatinLslash

A mini-rule for ‘Ł’ so you don’t need to remember the Unicode values.


\glsxtrLatinWynn

A mini-rule for wynn (Ƿ) so you don’t need to remember the Unicode values.


\glsxtrLatinInsularG

A mini-rule for insular G (Ᵹ) so you don’t need to remember the Unicode values.


\glsxtrLatinSchwa

A mini-rule that just covers schwa (Ə) but includes the subscript schwa. (Not used in any of the provided Latin rule blocks described above.)


\glsxtrLatinAA

A mini-rule for ‘Å’ so you don’t need to remember the Unicode values. (Not used in any of the provided Latin rule blocks described above.)


\glsxtrMathGreekIrules

A rule block for mathematical Greek (\alpha, \beta etc) and upright Greek (\upalpha, etc, from the upgreek package) characters that includes digamma (\digamma and \Digamma) between epsilon and zeta. The upright and italic versions are gathered together into the same letter group.


\glsxtrMathGreekIIrules

As \glsxtrMathGreekIrules but doesn’t include digamma.


\glsxtrMathUpGreekIrules

A rule block for upright Greek (\upalpha, etc, from the upgreek package) characters that includes digamma (\digamma and \Digamma) between epsilon and zeta.


\glsxtrMathUpGreekIIrules

A rule block for upright Greek (\upalpha, etc, from the upgreek package) that doesn’t include digamma.


\glsxtrMathItalicGreekIrules

A rule block for mathematical Greek (\alpha, \Alpha, etc) characters that includes digamma (\diagamma and \Digamma) between epsilon and zeta. Note that even though the upper case \Delta etc are actually rendered upright by LaTeX, bib2gls’s interpreter treats them as italic to help keep them close to the lower case versions.


\glsxtrMathItalicGreekIIrules

A rule block for mathematical Greek (\alpha, \Alpha, etc) characters that doesn’t include digamma.


\glsxtrMathItalicUpperGreekIrules

A rule block for upper case mathematical Greek (\Alpha, \Beta, etc) characters that includes digamma (\Digamma) between epsilon and zeta.


\glsxtrMathItalicUpperGreekIIrules

A rule block for upper case mathematical Greek (\Alpha, \Beta, etc) characters that doesn’t include digamma.


\glsxtrMathItalicLowerGreekIrules

A rule block for lower case mathematical Greek (\alpha, \beta, etc) characters that includes digamma (\digamma) between epsilon and zeta.


\glsxtrMathItalicLowerGreekIIrules

A rule block for lower case mathematical Greek (\alpha, \beta, etc) characters that doesn’t include digamma.

Additionally, there are commands in the form \glsxtrUpAlpha, \glsxtrUpBeta etc and \glsxtrMathItalicAlpha, \glsxtrMathItalicBeta etc that just cover the upper and lower case forms of a special Greek character (\Upalpha, \upalpha etc and \Alpha, \alpha etc) as well as the following:


\glsxtrMathItalicPartial

The partial derivative symbol ().


\glsxtrMathItalicNabla

The nabla symbol ().

Top

10.4 Supplementary Commands

These commands are provided by glossaries-extra for use with bib2gls.

The information provided with \GlsXtrLoadResources is written to the .aux file using

\protected@write\@auxout{\glsxtrresourceinit}{information}
where ⟨information⟩ is the information to pass to bib2gls. The command in the second argument


\glsxtrresourceinit

may be used to temporarily redefine commands before the information is written to the file. This does nothing by default, but may be redefined to allow the use of short commands for convenience. For example, with:

\renewcommand{\glsxtrresourceinit}{\let\u\glshex}

you can just use, for example, \u E6 instead of \string\uE6 in the custom rule. This redefinition of \u is scoped so its original definition is restored after the write operation.

If you have multiple resource commands and you want a default set of options you can supply them in the definition of:


\GlsXtrDefaultResourceOptions

For example:

\renewcommand{\GlsXtrDefaultResourceOptions}{selection=all}

This should be done before the resource commands.

It’s possible to specify label prefixes. For example, modifying the earlier example:

\documentclass{article}
\usepackage[record,style=indexgroup]{glossaries-extra}
\setabbreviationstyle{long-short-desc}
\GlsXtrLoadResources
 [src={abbrvs},sort={letter-nocase},type=main,
  label-prefix={abr.},
  group={Abbreviations}]
\GlsXtrLoadResources
 [src={symbols},sort={use},type=main,
  label-prefix={sym.},
  group={Symbols}]
\GlsXtrLoadResources[src={terms},sort={en-GB},type=main
  label-prefix={trm.}]
\begin{document}
\gls{trm.bird}
\gls{abr.shtml}
\gls{sym.M}
\printunsrtglossaries
\end{document}

If you do something like this, you may find it more convenient to define custom commands that set the prefix. For example:

\newcommand*{\sym}[2][]{\gls[#1]{sym.#2}}

The problem with this is that the custom command \sym doesn’t allow for modifiers (such as \gls* or \gls+). Instead you can use:


\glsxtrnewgls[default options]{prefix}{cs}

which defines the command ⟨cs⟩ that behaves like

\glsmodifier[default options,options]{prefix⟩⟨label}[insert]
For example:
\glsxtrnewgls{sym.}{\sym}

or (to default to no hyperlinks)

\glsxtrnewgls[hyper=false]{sym.}{\sym}

now you can use \sym+{M} to behave like \gls+{sym.M}.

If you also want the plural and first letter upper case versions you can use


\glsxtrnewglslike[default options]{prefix}{\gls-like cs} {\glspl-like cs}{\Gls-like cs}{\Glspl-like cs}

For example:

\glsxtrnewglslike[hyper=false]{idx.}{\idx}{\idxpl}{\Idx}{\Idxpl}

For the all caps versions:


\glsxtrnewGLSlike[default options]{prefix}{\GLS-like cs} {\GLSpl-like cs}

For example:

\glsxtrnewGLSlike[hyper=false]{idx.}{\IDX}{\IDXpl}

There’s an analogous command for \rgls:


\glsxtrnewrgls[default options]{prefix}{cs}

and for \rgls, \rglspl, \rGls and \rGlspl:


\glsxtrnewrglslike[default options]{prefix}{\rgls-like cs} {\rglspl-like cs}{\rGls-like cs}{\rGlspl-like cs}

and for the all caps:


\glsxtrnewrGLSlike[default options]{prefix}{\rGLS-like cs} {\rGLSpl-like cs}

If you provide your own custom command with just \newcommand that has syntax that starts with [options]{label}, then you can notify bib2gls using:


\glsxtridentifyglslike{prefix}{command}

This writes information to the .aux file so that bib2gls can search for the given command when looking for dependencies.

Another possibility is to set up known label prefixes, with each one identified by:


\glsxtraddlabelprefix{prefix}

These should be listed in order of precedence. Since no entries are defined on the first LaTeX run, the final prefix should be the fallback. You can prepend a prefix to the list using:


\glsxtrprependlabelprefix{prefix}

which gives it the highest order of precedence.

The ⟨prefix⟩ argument may be empty. You can clear the list with:


\glsxtrclearlabelprefixes

You can test if a prefix is already in the list with:


\glsxtrifinlabelprefixlist{prefix}{true}{false}

In general it’s best to avoid adding multiple instances of the same prefix, so you can check with this command before adding a prefix to the list. However, it can be useful to repeat a prefix at the end of the list so that it can be used as a fallback for entries that haven’t yet been defined.

With the list of possible prefixes set up (including an empty prefix if necessary), you can use:


\dgls[options]{label}[insert]

which behaves like

\gls[options]{prefix⟩⟨label}[insert]
where ⟨prefix⟩ is the first prefix in the list such that ⟨prefix⟩⟨label⟩ matches a defined entry (or the last entry in the prefix list if none match).

There are also analogous commands for the plural and case-changing versions:


\dglspl[options]{label}[insert]

(uses \glspl),


\dGls[options]{label}[insert]

(uses \Gls),


\dGlspl[options]{label}[insert]

(uses \Glspl),


\dGLS[options]{label}[insert]

(uses \GLS),


\dGLSpl[options]{label}[insert]

(uses \GLSpl),


\dglslink[options]{label}[insert]

(uses \glslink),


\dglsdisp[options]{label}[insert]

(uses \glsdisp).

These commands are essentially provided for a mixture of single and dual entries. Suppose the file entries.bib contains:

@index{duck}
@dualindexabbreviation{svm,
  short={SVM},
  long={support vector machine}
}
@dualindexsymbol{pi,
  symbol={\ensuremath{\pi}},
  description={ratio of a circle's circumference to its
    diameter}
}

and suppose the document code is:

\documentclass{article}
\usepackage{hyperref}
\usepackage[record,abbreviations,symbols]{glossaries-extra}
\newcommand{\bibglsnewdualindexsymbolsecondary}[5]{%
 \longnewglossaryentry*{#1}{name={#3},category={symbol},
   type={symbols},symbol={#4},#2}{#5}%
}
\GlsXtrLoadResources[src=entries]
\begin{document}
First use: \gls{duck}, \gls{svm}, \gls{pi}.
Next use: \gls{duck}, \gls{svm}, \gls{pi}.
\printunsrtglossaries
\end{document}

This uses the default empty primary prefix and dual. for the dual prefix, so \gls{svm} is referencing the primary entry, which is (essentially) an @index type not an abbreviation. It therefore doesn’t follow the abbreviation style, and it also hyperlinks to the index not to the list of abbreviations. Similarly for \gls{pi}, which references the primary @index entry rather than the symbol.

What’s really needed is:

\gls{duck}, \gls{dual.svm}, \gls{dual.pi}.

or with

\GlsXtrLoadResources[src=entries,
 label-prefix={idx.},
 dual-prefix={}
]

then only the entries without a dual need a prefix:

\gls{idx.duck}, \gls{svm}, \gls{pi}.

Using \glsxtrnewglslike, as earlier, this can be simplified to:

\idx{duck}, \gls{svm}, \gls{pi}.

but this requires remembering which terms have duals.

An alternative is to use \dgls instead:

\documentclass{article}
\usepackage{hyperref}
\usepackage[record,abbreviations,symbols]{glossaries-extra}
\newcommand{\bibglsnewdualindexsymbolsecondary}[5]{%
 \longnewglossaryentry*{#1}{name={#3},category={symbol},
   type={symbols},symbol={#4},#2}{#5}%
}
\GlsXtrLoadResources[src=entries]
\glsxtraddlabelprefix{dual.}
\glsxtraddlabelprefix{}
\begin{document}
First use: \dgls{duck}, \dgls{svm}, \dgls{pi}.
Next use: \dgls{duck}, \dgls{svm}, \dgls{pi}.
\printunsrtglossaries
\end{document}

On the first LaTeX call (when the .glstex file doesn’t exist), neither dual.svm nor svm exists, so \dgls uses the last prefix (which is empty in this case). This means that on the first LaTeX run, \dgls{svm} behaves like \gls{svm}, which adds a record for the primary svm entry. The default primary-dual dependency means that this will cause both the primary (svm) and dual (dual.svm) entry to be selected. The location will be added to the primary entry’s location list, unless overridden by resource options, such as combine-dual-locations.

Once bib2gls has been run and the .glstex file exists, then dual.svm exists. So \dgls{svm} will again first try dual.svm (as dual. is the first in the list of label prefixes). That now exists, so \dgls{svm} now behaves like \gls{dual.svm}, which follows the abbreviation style and hyperlinks to the list of abbreviations.

Similarly for the index-symbol combination dual.pi and pi. In the case of \dgls{duck}, the label dual.duck never exists, so that’s never selected. The empty prefix is the only one that matches, so \dgls{duck} always behaves like \gls{duck}.

If you haven’t used combine-dual-locations an extra bib2gls+LaTeX run may be required to correct the location lists.

If you change the label prefixes, remember to update the corresponding \glsxtraddlabelprefix{prefix}. If no prefixes have been added to the list (or if the list is cleared), just an empty prefix is assumed.

As from version 1.8, bib2gls provides hooks that identify the label prefixes in the .glstex file:

\bibglstertiaryprefixlabel{prefix}
\bibglsdualprefixlabel{prefix}
\bibglsprimaryprefixlabel{prefix}
These do nothing by default, but they can be defined before the resource file is loaded to set up the prefix list. For example:
\newcommand{\bibglsprimaryprefixlabel}[1]{\glsxtraddlabelprefix{#1}}
\newcommand{\bibglsdualprefixlabel}[1]{\glsxtrprependlabelprefix{#1}}
\GlsXtrLoadResources[src=entries]

Remember that this will only have an effect once the .glstex file has been created. The prefix list will be empty on the first run (which is treated as a single empty prefix). If this isn’t a suitable fallback, it may be necessary to add one after all the resource commands:

\newcommand{\bibglsprimaryprefixlabel}[1]{\glsxtraddlabelprefix{#1}}
\newcommand{\bibglsdualprefixlabel}[1]{\glsxtrprependlabelprefix{#1}}
\GlsXtrLoadResources[src=entries,label-prefix={idx.}]
\glsxtraddlabelprefix{idx.}

Although this rather defeats the purpose of using the hooks as you still have to keep track of the fallback prefix.

Top

10.5 Record Counting

As from version 1.1 of bib2gls, you can save the total record count for each entry by invoking bib2gls with the --record-count or --record-count-unit switches. These options will ensure that when each entry is written to the .glstex file bib2gls will additionally set the following internal fields for that entry:

If --record-count-unit is used then additionally:

Only use the unit counting option if the locations don’t contain any special characters. If you really need it with locations that may contain formatting commands, then you can try redefining:


\glsxtrdetoklocation{location}

so that it detokenizes ⟨location⟩ but take care when using \GlsXtrLocationRecordCount with commands like \thepage as they can end up becoming detokenized too early.

Note that the record count includes locations that bib2gls discards, such as ignored records, duplicates and partial duplicates. It doesn’t include cross-reference records. For example, if \gls{bird} is used twice on page 1, once on page 2 and fours times on page 3, and \gls[counter=section]{bird} is used once in section 3, then the total record count (stored in the recordcount field) is 2 + 1 + 4 + 1 = 8, the total for the page counter (stored in the recordcount.page field) is 2 + 1 + 4 = 7, and the total for the section counter (stored in the recordcount.section field) is 1.

With the unit counting on as well, the field recordcount.page.1 is set to 2, recordcount.page.2 is set to 1, recordcount.page.3 is set to 4 and recordcount.section.3 is set to 1.

You can access these fields using the following commands which will expand to the field value if set or to 0 if unset:


\GlsXtrTotalRecordCount{label}

This expands to the total record count for the entry given by ⟨label⟩.

\GlsXtrTotalRecordCount{bird}

expands to 8.


\GlsXtrRecordCount{label}{counter}

This expands to the counter total for the entry given by ⟨label⟩ where ⟨counter⟩ is the counter name. For example:

\GlsXtrRecordCount{bird}{page}

expands to 7 and

\GlsXtrRecordCount{bird}{section}

expands to 1.


\GlsXtrLocationRecordCount{label}{counter}{location}

This expands to the total for the given location. For example

\GlsXtrLocationRecordCount{bird}{page}{3}

expands to 4. Be careful about using \thepage in the ⟨location⟩ part. Remember that due to TeX’s asynchronous output routine, \thepage may not be correct.

There are commands analogous to the entry counting commands like \cgls and \cglsformat that are triggered by the record count. These are listed below.


\rglsmodifier[options]{label}[insert]


\rglsplmodifier[options]{label}[insert]


\rGlsmodifier[options]{label}[insert]


\rGlsplmodifier[options]{label}[insert]


\rGLSmodifier[options]{label}[insert]


\rGLSplmodifier[options]{label}[insert]

These commands check the recordcount attribute which, if set, should be a number. For example:

\glssetcategoryattribute{abbreviation}{recordcount}{1}

For convenience, you can use


\GlsXtrSetRecordCountAttribute{category list}{n}

to set the recordcount attribute to ⟨n⟩ for all the categories listed in ⟨category list⟩.

The \rgls-like commands use


\glsxtrifrecordtrigger{label}{trigger code}{normal}

to determine whether the \rgls-like command should behave like its \gls counterpart (⟨normal⟩) or whether it should instead use ⟨trigger code⟩.

This command checks if the recordcount attribute is set. If not is just does ⟨normal⟩, otherwise it tests if


\glsxtrrecordtriggervalue{label}

is greater than the value given in the recordcount attribute for that entry’s category. If true, this does ⟨normal⟩ otherwise it does ⟨trigger code⟩. The default definition of the trigger value command is:

\newcommand*{\glsxtrrecordtriggervalue}[1]{%
 \GlsXtrTotalRecordCount{#1}%
}

The ⟨trigger code⟩ part writes a record with the format set to glstriggerrecordformat (which bib2gls v1.1+ recognises as a special type of ignored location format) and does ⟨trigger format⟩. Then it unsets the first use flag. Note that it doesn’t implement the post-link hook. This ensures that the record count is correct on the next run.

The ⟨trigger format⟩ depends on the \rgls-like command used and will be one of the following:


\rglsformat{label}{insert}


\rglsplformat{label}{insert}


\rGlsformat{label}{insert}


\rGlsplformat{label}{insert}


\rGLSformat{label}{insert}


\rGLSplformat{label}{insert}

These all behave much like their \cglsformat counterparts. If the entry’s regular attribute is set or if the entry doesn’t have a long form, the first or first plural is used, otherwise the long or long plural form is used.

You can use


\glsxtrenablerecordcount

to redefine \gls, \glspl, \Gls, \Glspl, \GLS, \GLSpl to \rgls, \rglspl, \rGls, \rGlspl, \rGLS, \rGLSpl, respectively, for convenience.

If you don’t want the entries that use ⟨trigger code⟩ to appear in the glossary, you need to use the resource option trigger-type to assign them to another glossary. For example:

\documentclass{article}
\usepackage[record]{glossaries-extra}
\newignoredglossary{ignored}
\GlsXtrLoadResources[
 src=example-glossaries-acronym,
 trigger-type=ignored,
 category=abbreviation
]
\glsxtrenablerecordcount
\GlsXtrSetRecordCountAttribute{abbreviation}{1}
\begin{document}
\gls{lid}.  \gls{stc}. \gls{lid}.  \gls{aeu}.
\gls{upa}. \gls{aeu}.
\printunsrtglossaries
\end{document}

In the above, stc and upa both only have one record, so they are assigned to the ignored glossary instead of the main one.

Top

11. Miscellaneous New Commands

The glossaries package provides \glsrefentry entry to cross-reference entries when used with the entrycounter or subentrycounter options. The glossaries-extra package provides a supplementary command


\glsxtrpageref{label}

that works in the same way except that it uses \pageref instead of \ref.

You can copy an entry to another glossary using


\glsxtrcopytoglossary{entry-label}{glossary-type}

This appends ⟨entry-label⟩ to the end of the internal list for the glossary given by ⟨glossary-type⟩. Be careful if you use the hyperref package as this may cause duplicate hypertargets. You will need to change \glolinkprefix to another value or disable hyperlinks when you display the duplicate. Alternatively, use the new target key to switch off the targets:

\printunsrtglossary[target=false]

The glossaries package allows you to set preamble code for a given glossary type using \setglossarypreamble. This overrides any previous setting. With glossaries-extra (as from v1.12) you can instead append to the preamble using


\apptoglossarypreamble[type]{code}

or prepend using


\pretoglossarypreamble[type]{code}

Top

11.1 Entry Fields

A field may now be used to store the name of a text-block command that takes a single argument. The field is given by


\GlsXtrFmtField

The default value is useri. Note that the value must be the control sequence name without the initial backslash.

For example:

\newcommand*{\mtx}[1]{\boldsymbol{#1}}
\newcommand*{\mtxinv}[1]{\mtx{#1}\sp{-1}}
\newglossaryentry{matrix}{%
  name={matrix},
  symbol={\ensuremath{\mtx{M}}},
  plural={matrices},
  user1={mtx},
  description={rectangular array of values}
}
\newglossaryentry{identitymatrix}{%
  name={identity matrix},
  symbol={\ensuremath{\mtx{I}}},
  plural={identity matrices},
  description={a diagonal matrix with all diagonal elements equal to
1 and all other elements equal to 0}
}
\newglossaryentry{matrixinv}{%
  name={matrix inverse},
  symbol={\ensuremath{\mtxinv{M}}},
  user1={mtxinv},
  description={a square \gls{matrix} such that
   $\mtx{M}\mtxinv{M}=\glssymbol{identitymatrix}$}
}

There are two commands provided that allow you to apply the command to an argument:


\glsxtrfmt[options]{label}{text}

This effectively does

\glslink[default-options,options]{label}{\glsxtrfmtdisplay {cs name}{text}{}}
where ⟨cs name⟩ is the control sequence name supplied in the provided field, which must be defined to take a single required argument. Although it effectively acts like \glslink it misses out the post-link hook.

The default ⟨default-options⟩ are given by


\GlsXtrFmtDefaultOptions

This is defined as noindex but may be redefined as appropriate. Note that the replacement text of \GlsXtrFmtDefaultOptions is prepended to the optional argument of \glslink.

As from version 1.23, there’s also a starred version of this command that has a final optional argument:


\glsxtrfmt*[options]{label}{text}[insert]

Both the starred and unstarred versions use:


\glsxtrfmtdisplay{cs name}{text}{insert}

within the link text. In the case of the unstarred version ⟨insert⟩ will be empty. It will also be empty if the final option argument is missing from the starred form. If the entry given by ⟨label⟩ is undefined \glsxtrfmt and \glsxtrfmt* will issue an error (or warning if undefaction=warn). There won’t be a warning or error if the entry is defined by the given field is missing. In either case, (the entry is undefined or the field is missing) ⟨cs name⟩ will be @firstofone otherwise it will be the field value. The default definition is:

\newcommand{\glsxtrfmtdisplay}[3]{\csuse{#1}{#2}#3}

which puts ⟨text⟩ inside the argument of the control sequence and ⟨insert⟩ outside it (but it will still be inside the link text).

Remember that nested links cause a problem so avoid using commands like \gls or \glsxtrfmt within ⟨text⟩.

For example:

\[
  \glsxtrfmt{matrix}{A}
  \glsxtrfmt{matrixinv}{A}
  =
  \glssymbol{identitymatrix}
\]

If the default options are set to noindex then \glsxtrfmt won’t index, but will create a hyperlink (if hyperref has been loaded). This can be changed so that it also suppresses the hyperlink:

\renewcommand{\GlsXtrFmtDefaultOptions}{hyper=false,noindex}

Note that \glsxtrfmt won’t work with PDF bookmarks. Instead you can use


\glsxtrentryfmt{label}{text}

If hyperref is used, this uses \texorpdfstring and will expand to


\glsxtrpdfentryfmt{label}{text}

within the PDF bookmarks, but in the document it will do ⟨cs{text} if a control sequence name has been provided or just ⟨text⟩ otherwise. The PDF bookmark version simply does ⟨text⟩. It may be redefined, but remember that it needs to expand fully.

The glossaries package provides \glsaddstoragekey to add new keys. This command will cause an error if the key has already been defined. The glossaries-extra package provides a supplementary command that will only define the key if it doesn’t already exist:


\glsxtrprovidestoragekey{key}{default}{cs}

If the key has already been defined, it will still provide the command given in the third argument ⟨cs⟩ (if it hasn’t already been defined). Unlike \glsaddstoragekey, ⟨cs⟩ may be left empty if you’re happy to just use \glsfieldfetch to fetch the value of this new key.

You can test if a key has been provided with:


\glsxtrifkeydefined{key}{true}{false}

This tests if ⟨key⟩ is available for use in the ⟨key⟩= list in the second argument of \newglossaryentry (or the optional argument of commands like \newabbreviation). The corresponding field may not have been set for any of the entries if no default was provided.

There are now commands provided to set individual fields. Note that these only change the specified field, not any related values. For example, changing the value of the text field won’t update the plural field. There are also some fields that should really only be set when entries are defined (such as the parent field). Unexpected results may occur if they are subsequently changed.


\GlsXtrSetField{label}{field}{value}

Sets the field given by ⟨field⟩ to ⟨value⟩ for the entry given by ⟨label⟩. No expansion is performed. It’s not necessary for the field to have been defined as a key. You can access the value later with \glsxtrusefield. Note that \glsxtrifkeydefined only tests if a key has been defined for use with commands like \newglossaryentry. If a field without a corresponding key is assigned a value, the key remains undefined. This command is robust.

\GlsXtrSetField uses


\glsxtrsetfieldifexists{label}{field}{code}

where ⟨label⟩ is the entry label and ⟨code⟩ is the assignment code.

This command just uses \glsdoifexists{label}{code} (ignoring the ⟨field⟩ argument), so by default it causes an error if the entry doesn’t exist. This can be changed to a warning with undefaction=warn. You can redefine \glsxtrsetfieldifexists to simply do ⟨code⟩ if you want to skip the existence check. Alternatively you can instead use


\glsxtrdeffield{label}{field}arguments{replacement text}

This simply uses etoolbox’s \csdef without any checks. This command isn’t robust. There is also a version that uses \protected@csedef instead:11.1


\glsxtredeffield{label}{field}arguments{replacement text}

The following command was added to glossaries-extra v1.47 primarily for the convenience of bib2gls:


\glsxtrapptocsvfield{label}{field}{value}

There’s no check for the existence of either the entry or the field. If the entry identified by ⟨label⟩ has the given field set then this command will append a comma followed by ⟨value⟩ to the existing value, otherwise it will set the field to just ⟨value⟩. This uses \csdef or \csappto so the effect can be localised.


\gGlsXtrSetField{label}{field}{value}

As \GlsXtrSetField but globally.


\eGlsXtrSetField{label}{field}{value}

As \GlsXtrSetField but uses protected expansion.


\xGlsXtrSetField{label}{field}{value}

As \gGlsXtrSetField but uses protected expansion.


\GlsXtrLetField{label}{field}{cs}

Sets the field given by ⟨field⟩ to the replacement text of ⟨cs⟩ for the entry given by ⟨label⟩ (using \let).


\csGlsXtrLetField{label}{field}{cs name}

As \GlsXtrLetField but the control sequence name is supplied instead.


\GlsXtrLetFieldToField{label-1}{field-1}{label-2}{field-2}

Sets the field given by ⟨field-1⟩ for the entry given by ⟨label-1⟩ to the field given by ⟨field-2⟩ for the entry given by ⟨label-2⟩. There’s no check for the existence of ⟨label-2⟩, but \glsxtrsetfieldifexists{label-1}{field-1}{code} is still used, as for \GlsXtrSetField.

The glossaries package provides \ifglshasfield to determine if a field has been set. The glossaries-extra package provides a simpler version:


\glsxtrifhasfield{field}{label}{true}{false}

(New to v1.19.) Note that in this case the ⟨field⟩ must be the internal field label (for example, useri rather than user1). Unlike \ifglshasfield, this version doesn’t complain if the entry (given by ⟨label⟩) or the field don’t exist and will simply do ⟨false⟩. If the field does exist for the given entry and it’s not empty, the ⟨true⟩ part is done otherwise it does ⟨false⟩. Within ⟨true⟩ you may use


\glscurrentfieldvalue

to access the field value. This command includes grouping which scopes the ⟨true⟩ and ⟨false⟩ parts. The starred version


\glsxtrifhasfield*{field}{label}{true}{false}

omits the implicit grouping.

Be careful of keys that use \relax as the default value (such as the symbol). Use \ifglshassymbol instead.

There is also a version that simply uses \ifcsundef. It doesn’t save the field value, but can be used if you only need to check if the field is defined without accessing it:


\GlsXtrIfFieldUndef{field}{label}{true}{false}

There’s a difference between an undefined field and an unset field. An undefined field hasn’t been assigned any value (no associated internal control sequence has been defined). If a defined field has been defined to empty, then it’s considered unset. \GlsXtrIfFieldUndef implement ⟨false⟩ for a defined but empty field whereas \glsxtrifhasfield and \ifglshasfield will implement ⟨false⟩ a defined but empty field. Remember that any keys that may be used in \newglossaryentry will have a default value if not provided. In many cases, the default value is empty, so only use \GlsXtrIfFieldUndef for fields that can only be defined through commands like \GlsXtrSetField.

You can test if a field value equals a string using


\GlsXtrIfFieldEqStr{field}{label}{text}{true}{false}

If the entry exists and has the given field set to the given text then this does ⟨true⟩ otherwise it does ⟨false⟩. This uses \glsxtrifhasfield to test if the field exists and then compares the replacement text of \glscurrentfieldvalue with ⟨text⟩ using etoolbox’s \ifdefstring. Version 1.39 introduced a starred form of this command, which uses the starred form of \glsxtrifhasfield.

As from version 1.31, there’s a similar command:


\GlsXtrIfFieldEqXpStr{field}{label}{text}{true}{false}

This is like \GlsXtrIfFieldEqStr but first (protected) fully expands ⟨text⟩ (but not the field value). If you want to compare the (protected) full expansion of both the field value and ⟨text⟩ use:


\GlsXtrIfXpFieldEqXpStr{field}{label}{text}{true}{false}

Again, version 1.39 introduced a starred form of these commands, which use the starred form of \glsxtrifhasfield.

As from v1.42, you can test if the field value is contained in a comma-separated list with:


\GlsXtrIfFieldValueInCsvList{label}{field}{list}{true}{false}

The unstarred version uses the unstarred form of \glsxtrifhasfield (which adds grouping so ⟨true⟩ and ⟨false⟩ will be localised). The starred version uses \glsxtrifhasfield*. If the field value (without expansion) is contained in ⟨list⟩ then ⟨true⟩ is done otherwise ⟨false⟩ is done. If the field hasn’t been set ⟨false⟩ is done. This internally uses \DTLifinlist provided by datatool-base which performs a one level expansion on ⟨list⟩. See the datatool documentation for further details.

This command is intended for fields that contain a label. For example, to test if the category is one of a set of labels:

\GlsXtrIfFieldValueInCsvList{examplelabel}{category}%
 {abbreviation,acronym}% set of labels
 {true part}{false part}

As from v1.31, if a field represents a numeric (integer) value, you can use the following two numeric tests. If the field is set, it must expand to an integer. You may use \glscurrentfieldvalue within ⟨true⟩ or ⟨false⟩ to access the actual value. Both ⟨true⟩ and ⟨false⟩ are scoped. If the field is undefined or empty, the value is assumed to be 0, and \glscurrentfieldvalue is set accordingly. As from version 1.39, these numeric tests have starred versions. The unstarred versions add implicit grouping. The starred versions don’t.

As from v1.47 there’s a similar command:


\GlsXtrIfValueInFieldCsvList{label}{field}{value}{true}{false}

This is essentially the opposite situation where the list is stored in the given field and ⟨value⟩ is the element to find in the list. Again the unstarred versions add implicit grouping. Note that the ⟨value⟩ isn’t expanded. If you need it to be fully expanded before searching for it use:


\xGlsXtrIfValueInFieldCsvList{label}{field}{value}{true}{false}

(To add a value to a field containing a comma-separated list, use \glsxtrapptocsvfield. To iterate over the field use \glsxtrforcsvfield.)

To test if the value is non-zero:


\GlsXtrIfFieldNonZero{field}{label}{true}{false}

Alternatively, you can test if the field expands to a specific number using:


\GlsXtrIfFieldEqNum{field}{label}{n}{true}{false}

This does ⟨true⟩ if the field value equals ⟨n⟩ (using \ifnum for the comparison) otherwise it does ⟨false⟩. For a more general numeric comparison you can use:


\GlsXtrIfFieldCmpNum{field}{label}{comparison}{n}{true}{false}

where ⟨comparison⟩ is one of =, < or >.

The glossaries package provides \glsfieldfetch which can be used to fetch the value of the given field and store it in a control sequence. The glossaries-extra package provides another way of accessing the field value:


\glsxtrusefield{entry-label}{field-label}

This works in the same way as commands like \glsentrytext but the field label is specified in the first argument. Note that the ⟨field-label⟩ corresponds to the internal field tag, which isn’t always the same as the key name. See Table 4.1 of the glossaries manual. No error occurs if the entry or field haven’t been defined. This command is not robust.

There is also a version that converts the first letter to uppercase (analogous to \Glsentrytext):


\Glsxtrusefield{entry-label}{field-label}

and, as from v1.37, a command that converts the entire value to upper case:


\GLSxtrusefield{entry-label}{field-label}

If you want to use a field to store a list that can be used as an etoolbox internal list, you can use the following command that adds an item to the field using etoolbox’s \listcsadd:


\glsxtrfieldlistadd{label}{field}{item}

where ⟨label⟩ is the entry’s label, ⟨field⟩ is the entry’s field and ⟨item⟩ is the item to add. There are analogous commands that use \listgadd, \listeadd and \listxadd:


\glsxtrfieldlistgadd{label}{field}{item}


\glsxtrfieldlisteadd{label}{field}{item}


\glsxtrfieldlistxadd{label}{field}{item}

You can then iterate over the list using:


\glsxtrfielddolistloop{label}{field}

or


\glsxtrfieldforlistloop{label}{field}{handler}

that internally use \dolistcsloop and \forlistloop, respectively. You can use \listbreak to break out of the loop (see the etoolbox manual for further details).

For fields that contain comma-separated lists use \glsxtrforcsvfield instead.

New to v1.42:


\glsxtrfieldformatlist{label}{field}

Like datatool-base’s \DTLformatlist, this iterates over an (etoolbox) internal list and formats each item. Uses all the same helper commands as \DTLformatlist (the same list handler macro is used). Unlike the datatool-base command, this command has no starred version. Grouping is automatically applied.

For example, with bib2gls’s save-child-count resource option:

\newcommand*{\listchildren}[1]{%
  \GlsXtrIfFieldNonZero{childcount}{#1}%
  {child count: \glscurrentfieldvalue; children:
   \let\DTLlistformatitem\glsfmtname
   \glsxtrfieldformatlist{#1}{childlist}%
  }%
  {no children}%
}

For fields that contain a comma-separated list use \glsxtrfieldformatcsvlist instead.

There are also commands that use \ifinlistcs:


\glsxtrfieldifinlist{label}{field}{item}{true}{false}

and \xifinlistcs


\glsxtrfieldxifinlist{label}{field}{item}{true}{false}

See the etoolbox’s user manual for further details of these commands, in particular the limitations of \ifinlist.

If the field has a comma-separated list value instead, you can iterate over it using:


\glsxtrforcsvfield{label}{field}{handler}

where again ⟨handler⟩ is a control sequence that takes a single argument. Unlike the etoolbox loops, this doesn’t ignore empty elements nor does it discard leading / trailing spaces. Internally it uses \@for (modified by xfor which is automatically loaded by glossaries). The xfor package modifies the behaviour of \@for to allow the loop to be broken prematurely using \@endfortrue. The \glsxtrforcsvfield command locally defines a user level command:


\glsxtrendfor

which is just a synonym for \@endfortrue.

The loop is performed within the true part of \glsxtrifhasfield so scoping is automatically applied. If you don’t want scoping use \glsxtrforcsvfield* which will use \glsxtrifhasfield* instead but take care if you nest these starred commands as unexpected results can occur without the scoping.

New to v1.42:


\glsxtrfieldformatcsvlist{label}{field}

Like \glsxtrfieldformatcsvlist but for fields that contain comma-separated lists.

As from version 1.32, if the field given by


\GlsXtrForeignTextField

(which defaults to userii) contains a locale tag, then


\GlsXtrForeignText{entry label}{text}

can be used to encapsulate ⟨text⟩ in \foreignlanguage{dialect}{text} where ⟨dialect⟩ is obtained from the locale tag through tracklang’s \GetTrackedDialectFromLanguageTag command. You need at least tracklang v1.3.6 for this to work properly. The ⟨dialect⟩ must be one that’s tracked (which typically means that babel or polyglossia has been loaded with the appropriate setting for that language). If \foreignlanguage hasn’t been defined, this just does ⟨text⟩. For example:

\documentclass{article}
\usepackage[main=british,brazilian,ngerman]{babel}
\usepackage{glossaries-extra}
\setabbreviationstyle{long-short-user}
\newabbreviation
 [user1={Associa\c{c}\~ao Brasileria de Normas T\'ecnicas},
  user2= {pt-BR}
 ]
 {abnt}{ABNT}{Brazilian National Standards Organization}
\newabbreviation
 [user1={Deutsches Institut f\"ur Normung e.V.},
  user2={de-DE-1996}]
 {din}{DIN}{German Institute for Standardization}
\renewcommand*{\glsxtruserparen}[2]{%
  \glsxtrfullsep{#2}%
  \glsxtrparen
  {#1%
   \ifglshasfield{\glsxtruserfield}{#2}%
   {, \emph{\GlsXtrForeignText{#2}{\glscurrentfieldvalue}}}%
   {}%
  }%
}
\begin{document}
\gls{abnt}, \gls{din}.
\end{document}

When using the record option, in addition to recording the usual location, you can also record the current value of another counter at the same time using the preamble-only command:


\GlsXtrRecordCounter{counter name}

For example:

\usepackage[record]{glossaries-extra}
\GlsXtrRecordCounter{section}

Each time an entry is referenced with commands like \gls or \glstext, the .aux file will not only contain the \glsxtr@record command but also

\glsxtr@counterrecord{label}{section}{n}
where ⟨n⟩ is the current expansion of \thesection and ⟨label⟩ is the entry’s label. On the next run, when the .aux file is run, this command will do
\glsxtrfieldlistgadd{label}{record.counter}{n}
In the above example, if \gls{bird} is used in section 1.2 this would be
\glsxtrfieldlistgadd{bird}{record.section}{1.2}

Note that there’s no key corresponding to this new record.section field, but its value can be accessed with \glsxtrfielduse or the list can be iterated over with \glsxtrfielddolistloop etc.

Top

11.2 Display All Entries Without Sorting or Indexing


\printunsrtglossary[options]

This behaves like \printnoidxglossary but never sorts the entries and always lists all the defined entries for the given glossary (and doesn’t require \makenoidxglossaries). If you want to use one of the tabular-like styles with \printunsrtglossary, make sure you load glossaries-extra-stylemods which modifies the definition of \glsgroupskip to avoid the “Incomplete \iftrue” error that may otherwise occur.

There’s also a starred form


\printunsrtglossary*[options]{code}

which is equivalent to

\begingroup
 code\printunsrtglossary[options]%
\endgroup
Note that unlike \glossarypreamble, the supplied ⟨code⟩ is done before the glossary header.

This means you now have the option to simply list all entries on the first LaTeX run without the need for a post-processor, however there will be no number list in this case, as that has to be set by a post-processor such as bib2gls (see §10 bib2gls: Managing Reference Databases).

No attempt is made to gather hierarchical elements. If child entries aren’t defined immediately after their parent entry, they won’t be together in the glossary when using \printunsrtglossary.

There’s a difference in behaviour depending on whether or not the group key is defined. If not defined (default), the group label will be formed from the first letter of the name field. The corresponding group title will be obtained as discussed in §2.11 Glossary Style Modifications. This can lead to an odd effect if you are using a style that separates letter groups when the ordering isn’t alphabetical.

If the group key is defined (which it is with the record option) then the group label will be obtained from the value of that field. If the field is empty, no grouping is performed, even if the style supports it. (That is, there won’t be a header or a vertical separation.) If the group field is non-empty, then the corresponding title is obtained as described earlier.

In either case, if the groups option is set to false then no group formation will be performed.

If you want to use a different field for the group label, you can redefine


\glsxtrgroupfield

to the relevant internal field label, but the group key must still be defined (through the record option or with commands like \glsaddstoragekey) to ensure that \printunsrtglossary uses \glsxtrgroupfield. (This method is used by bib2gls for secondary entries, which have the group label stored in the secondarygroup internal field.)

If you have any entries with the see key set, you will need the glossaries package option seenoindex=ignore or seenoindex=warn to prevent an error occurring from the automated \glssee normally triggered by this key. The record=only package option will automatically deal with this.

For example:

\documentclass{article}
\usepackage{glossaries-extra}
\newglossaryentry{zebra}{name={zebra},description={stripy animal}}
\newglossaryentry{ant}{name={ant},description={an insect}}
\begin{document}
\gls{ant} and \gls{zebra}
\printunsrtglossaries
\end{document}

In the above, zebra will be listed before ant as it was defined first.

If you allow document definitions with the docdefs option, the document will require a second LaTeX run if the entries are defined after \printunsrtglossary.

The optional argument is as for \printnoidxglossary (except for the sort key, which isn’t available).

All glossaries may be displayed in the order of their definition using:


\printunsrtglossaries

which is analogous to \printnoidxglossaries. This just iterates over all defined glossaries (that aren’t on the ignored list) and does \printunsrtglossary[type=⟨type⟩].

Top

11.2.1 Hooks

To avoid complications caused by tabular-like glossary styles, \printunsrtglossary iterates over all entries in the selected glossary and appends the appropriate code to an internal command. Once the construction of this command is complete, then it’s performed to display the glossary. This puts the loop outside the style code. For convenience, there’s a hook used within the loop:


\printunsrtglossaryentryprocesshook{label}

This hook should not display any content, but may be used to perform calculations. For example, to calculate widths. Within this hook you can use:


\printunsrtglossaryskipentry

to skip the current entry. This will prevent the entry from being added to the internal command.

There’s another hook immediately before the internal command containing the glossary code is performed:


\printunsrtglossarypredoglossary

The internal command uses


\printunsrtglossaryhandler{label}

to display each item in the list, where ⟨label⟩ is the current label.

By default the handler just does


\glsxtrunsrtdo{label}

which determines whether to use \glossentry or \subglossentry and checks the location and loclist fields for the number list. If you want to use a different field to be used instead of location then redefine:


\GlsXtrLocationField

to the internal name of the desired field. For example:

\renewcommand{\GlsXtrLocationField}{primarylocation}

Note that if the given location field is undefined or unset, the handler will fallback on the loclist field.

You can instruct bib2gls to omit setting the loclist field with the resource option --save-loclist=false to prevent it from being used as a fallback.

Top

11.2.2 Filtering

You can redefine the handler used by \printunsrtglossary if required. For example, you may want to filter entries according to the category label. You can test if a label is contained in a comma-separated list of labels using:


\glsxtriflabelinlist{label}{label list}{true}{false}

The ⟨label⟩ and ⟨label list⟩ will be fully expanded.

If you redefine the handler to exclude entries, you may end up with an empty glossary. This could cause a problem for the list-based styles.

For example, if the preamble includes:

\usepackage[record,style=index]{glossaries-extra}
\GlsXtrRecordCounter{section}

then you can print the glossary but first redefine the handler to only select entries that include the current section number in the record.section field:

\renewcommand{\printunsrtglossaryhandler}[1]{%
  \glsxtrfieldxifinlist{#1}{record.section}{\thesection}
  {\glsxtrunsrtdo{#1}}%
  {}%
}

Alternatively you can use the starred form of \printunsrtglossary which will localise the change:

\printunsrtglossary*{%
  \renewcommand{\printunsrtglossaryhandler}[1]{%
    \glsxtrfieldxifinlist{#1}{record.section}{\thesection}
    {\glsxtrunsrtdo{#1}}%
    {}%
  }%
}

If you are using the hyperref package and want to display the same glossary more than once, you can also add a temporary redefinition of \glolinkprefix to avoid duplicate hypertarget names. For example:

\printunsrtglossary*{%
  \renewcommand{\printunsrtglossaryhandler}[1]{%
    \glsxtrfieldxifinlist{#1}{record.section}{\thesection}
    {\glsxtrunsrtdo{#1}}%
    {}%
  }%
  \ifcsundef{theHsection}%
  {%
    \renewcommand*{\glolinkprefix}{record.\csuse{thesection}.}%
  }%
  {%
    \renewcommand*{\glolinkprefix}{record.\csuse{theHsection}.}%
  }%
}

Note that this will cause a problem if your descriptions contain commands like \gls that need to link an entry that doesn’t appear in the summary. In this case, it’s a better approach to use:

\printunsrtglossary*{%
  \renewcommand{\printunsrtglossaryhandler}[1]{%
    \glsxtrfieldxifinlist{#1}{record.section}{\thesection}
    {\glsxtrunsrtdo{#1}}%
    {}%
  }%
  \ifcsundef{theHsection}%
  {%
    \setkeys{printgloss}{targetnameprefix={record.\csuse{thesection}.}}%
  }%
  {%
    \setkeys{printgloss}{targetnameprefix={record.\csuse{theHsection}.}}%
  }%
}

If it’s a short summary at the start of a section, you might also want to suppress the glossary header and add some vertical space afterwards:

\printunsrtglossary*{%
  \renewcommand{\printunsrtglossaryhandler}[1]{%
    \glsxtrfieldxifinlist{#1}{record.section}{\thesection}
    {\glsxtrunsrtdo{#1}}%
    {}%
  }%
  \ifcsundef{theHsection}%
  {%
    \renewcommand*{\glolinkprefix}{record.\csuse{thesection}.}%
  }%
  {%
    \renewcommand*{\glolinkprefix}{record.\csuse{theHsection}.}%
  }%
  \renewcommand*{\glossarysection}[2][]{}%
  \appto\glossarypostamble{\glspar\medskip\glspar}%
}

There’s a shortcut command that essentially does this:


\printunsrtglossaryunit[options]{counter name}

The above example can simply be replaced with:

\printunsrtglossaryunit{section}

This shortcut command is actually defined to use \printunsrtglossary* with


\printunsrtglossaryunitsetup{counter name}

so if you want to just make some minor modifications you can do

\printunsrtglossary*{\printunsrtglossaryunitsetup{section}%
  \renewcommand*{\glossarysection}[2][]{\subsection*{Summary}}%
}

which will start the list with a subsection header with the title “Summary” (overriding the glossary’s title).

Note that this shortcut command is only available with the record (or record=hybrid) package option.

This temporary change in the hypertarget prefix means you need to explicitly use \hyperlink to create a link to it as commands like \gls will try to link to the target created with the default definition of \gloslinkprefix. This isn’t a problem if you want a primary glossary of all terms produced using just \printunsrtglossary (in the front or back matter) which can be the target for all glossary references and then just use \printunsrtglossaryunit for a quick summary at the start of a section etc.

Top

11.3 Partial Glossaries

It’s possible that you may require greater customisation over the way the glossary is displayed that can’t be simply achieved with the hooks or glossary styles. This section describes a command and environment provided to assist with this, but note that they aren’t compatible with tabular-like glossary styles, such as long or super, due to their complexity and internal scoping that interferes with alignment. You will also need to take care with list styles (provided in the glossary-list package).

To get a better understanding of how this works, it’s useful to consider how a glossary with makeindex works. Here’s a simple example document:

\documentclass{article}
\usepackage{glossaries}
\makeglossaries
\newglossaryentry{cabbage}{name={cabbage},
 description={vegetable with thick green or purple leaves}}
\newglossaryentry{broccoli}{name={broccoli},
 description={vegetable with heads of small green or purple flower buds}}
\begin{document}
\Gls{cabbage} and \gls{broccoli}.
\printglossary
\end{document}

When the document is built, makeindex creates a file that contains:

\glossarysection[\glossarytoctitle]{\glossarytitle}\glossarypreamble
\begin{theglossary}\glossaryheader
\glsgroupheading{B}\relax \glsresetentrylist
\glossentry{broccoli}{location list}\glsgroupskip
\glsgroupheading{C}\relax \glsresetentrylist
\glossentry{cabbage}{location list}%
\end{theglossary}\glossarypostamble
The \printglossary command defines the commands shown above after it’s detected the glossary type, the title and style. It then inputs the file.

The \printunsrtglossary command performs the same preliminary setup but there’s no file to input. Instead it then does the section heading (\glossarysection) and preamble (\glossarypreamble) and constructs a control sequence that contains \begin{theglossary} content\end{theglossary}.

The letter group markup (\glsgroupheading and \glsgroupskip) is inserted whenever the group label changes between top-level entries. In this case, ⟨content⟩ doesn’t explicitly contain \glossentry but uses a handler function instead. For example, instead of:

\glossentry{broccoli}{location list}
the ⟨content⟩ will contain:
internal handler{broccoli}
This internal handler uses \printunsrtglossaryhandler to determine the required information (location list, hierarchical level) that’s needed to typeset the entry (using \glossentry or \subglossentry).


\begin{printunsrtglossarywrap}[options]
content\end{printunsrtglossarywrap}

The printunsrtglossarywrap environment provides a wrapper in which you can place the actual glossary code. The optional argument is the same as for \printunsrtglossary, but note that in this case the type key simply provides the glossary title and doesn’t identify the content.

This environment essentially does:

initial setup
\glossarysection[\glossarytoctitle]{\glossarytitle}\glossarypreamble
\begin{theglossary}\glossaryheader\glsresetentrylist
content
\end{theglossary}\glossarypreamble
where ⟨initial setup⟩ is much the same code as used by \printglossary and \printunsrtglossary. Most importantly, ⟨initial setup⟩ sets the current glossary style, which determines the definition of theglossary, \glossentry and \subglossentry.

Whilst it is possible to explicitly use the commands that create letter group headings and the handler within ⟨content⟩, it would be quite laborious and prone to error to do so for anything other than a very short list. This can be illustrated with the following silly example:

\begin{printunsrtglossarywrap}[style=indexgroup]%
\glsgroupheading{W}%
\gdef\glscurrententrylabel{cabbage}%
\printunsrtglossaryhandler\glscurrententrylabel
\glsgroupskip
\glsgroupheading{Z}%
\gdef\glscurrententrylabel{broccoli}%
\printunsrtglossaryhandler\glscurrententrylabel
\end{printunsrtglossarywrap}

This trivial example will work with a tabular-like style, such as long (although the group headings will be ignored). A more practical example that uses a loop within ⟨content⟩ won’t.


\printunsrtinnerglossary[options]{pre-code}{post-code}

This command is provided for use within printunsrtglossarywrap. The optional argument ⟨options⟩ is similar to \printunsrtglossary but the following keys are unavailable: title, toctitle, style, numberedsection and label.

This will do:

 \begingroup
  initial setup
  pre-code
  content
  post-code
 \endgroup
where ⟨initial setup⟩ processes the options and assigns \currentglossary, ⟨pre-code⟩ is some preliminary code and ⟨post-code⟩ is some final code before the end of the scoping. The ⟨content⟩ is the sequence of code that \printunsrtglossary would normally insert within the theglossary environment.

For example:

\begin{printunsrtglossarywrap}[style=indexgroup]
\printunsrtinnerglossary[type=main]{}{}
\end{printunsrtglossarywrap}

This produces a result very similar to that obtained with just:

\printunsrtglossary[style=indexgroup,type=main]

The first case is unsuitable for use with a tabular-style. It will also cause a problem with a list style when used with bib2gls (where the inner content will be empty on the first LaTeX run which will cause a missing \item error).

This partial glossary command is more useful when you need to apply filtering (which can be set up in the ⟨pre-code⟩ argument as in \printunsrtglossary*) or if you have multiple glossaries. For example:

\begin{printunsrtglossarywrap}[style=list]
\item[Animals]
\printunsrtinnerglossary[type=animal]{}{}
\item[Vegetables]
\printunsrtinnerglossary[type=vegetable]{}{}
\item[Minerals]
\printunsrtinnerglossary[type=mineral]{}{}
\end{printunsrtglossarywrap}

In this case, the list style doesn’t cause a problem as there will be three instances of \item on the first LaTeX run.

Here’s another example:

\begin{printunsrtglossarywrap}[style=indexgroup]
\glsgroupheading{animal}%
\printunsrtinnerglossary[type=animal]{}{}
\glsgroupskip
\glsgroupheading{vegetable}%
\printunsrtinnerglossary[type=vegetable]{}{}
\glsgroupskip
\glsgroupheading{mineral}%
\printunsrtinnerglossary[type=mineral]{}{}
\end{printunsrtglossarywrap}

Note that in both of the above cases, the inner glossaries have been arranged manually (animal, then vegetable and then mineral).

It’s also possible to use \printunsrtinnerglossary within the handler function used by \printunsrtglossary. The internal scoping within \printunsrtinnerglossary helps to reduce interference.

This is a rather more complicated example that requires bib2gls. Suppose I have a file called topictitles.bib that contains:

@indexplural{animal}
@indexplural{mineral}
@indexplural{vegetable}

And also a file called topics.bib that contains entries like:

@entry{zebra,
  name={zebra},
  description={striped African horse},
  category={animal}
}
@entry{broccoli,
  name={broccoli},
  description={vegetable with heads of small green or purple flower buds},
  category={vegetable}
}
@entry{quartz,
  name={quartz},
  description={hard mineral consisting of silica},
  category={mineral}
}

Note that the category labels in the second file match the entry labels in the first file.

The simplest way of creating a hierarchical glossary from this data is to input both files and copy the category field to the parent field:

\GlsXtrLoadResources[src={topictitles,topics},
 replicate-fields={category=parent}]

The glossary can then simply be displayed with:

\printunsrtglossary[style=indexgroup]

This will now be ordered: animal (followed by animal child entries), mineral (followed by mineral child entries), vegetable (followed by vegetable child entries).

Suppose (for some strange reason) that I now need the ordering to be vegetable, mineral, animal (that is, reverse alphabetical) but the child entries still need to be in the normal alphabetical order.

It’s not possible to use different sort methods for different hierarchical levels with bib2gls, but it is possible to simulate it.

Instead of making the entries within topics.bib children of the entries defined in topictitles.bib, I’m now going to create separate glossaries for each type:

\newignoredglossary*{animal}
\newignoredglossary*{mineral}
\newignoredglossary*{vegetable}

The entries in topictitles.bib go in the default main glossary and are sorted in reverse:

\GlsXtrLoadResources[src=topictitles,type=main,selection=all,
 sort=en-GB-reverse]

Note that I’ve selected all entries in this example. It becomes more complicated with the default selection criteria. (See the sample-nested.tex example provided with bib2gls v2.3+.)

Now the entries in topics.bib are selected but the type field is set to the category field:

\GlsXtrLoadResources[src=topics,type={same as category},selection=all,
 sort=en-GB]

The aim here is to use \printunsrtglossary to list all the entries in the main glossary (that is, all the topic titles) and use a handler that tests if there is a glossary that has the same label as the current entry label. If one exists, it’s then listed using \printunsrtinnerglossary with the level offset shifted to give a hierarchical appearance:

\newcommand{\nestedhandler}[1]{%
  \glsxtrunsrtdo{#1}%
  \ifglossaryexists*{#1}%
  {%
    \printunsrtinnerglossary[type={#1},leveloffset=++1]{}{}%
  }%
  {}%
}
\printunsrtglossary*[type=main,style=index]{%
  \let\printunsrtglossaryhandler\nestedhandler
}

I’ve used \newignoredglossary* as I don’t need to specify a title for any of those glossaries nor do I need to use those glossaries with \printunsrtglossaries. With bib2gls v2.3+, I can omit the three \newignoredglossary* lines and use the --provide-glossaries switch which will make bib2gls automatically provide any unknown glossaries (with \provideignoredglossary) in the .glstex file.

Top

11.4 Standalone Entry Items

It may be that you don’t want a list but would rather display entry details throughout the document. You can simply do \glsentryname followed by \glsentrydesc. (Remember that if you don’t want a sorted list, use sort=none to skip the construction of the sort field.) For example, in the preamble provide a custom command:

\newcommand{\displayterm}[1]{%
 \par\medskip\par\noindent
 Definition: \glsentryname{#1}.\par
 \glsentrydesc{#1}
 \par\medskip
}

define your entries

\newglossaryentry{function}{name={function},
  description={a relation or expression involving variables}
}

and then later in the text:

\displayterm{function}

However, if may be that you want to use hyperref and have commands like \gls link back to the place where the term is described. Instead of using \glsentryname use


\glsxtrglossentry{label}

where ⟨label⟩ is the entry’s label.

This is designed to behave much like the way the name is displayed in the glossary. It performs the following:

If you have used \nopostdesc or \glsxtrnopostpunc in any of your description fields, you can use


\glsxtractivatenopost

to make these commands behave as they normally do within a glossary. This needs to be placed before

\glossentrydesc{label}\glspostdescription
and scoped. Note that \glsnonextpages and \glsnextpages have no effect outside of the glossary and are not intended for use in a standalone context.

It’s also possible to select a different field (rather than using name):


\glsxtrglossentryother{header}{label}{field}

The ⟨field⟩ must be given using its internal field label which may not be the same as the key used to set the field. See the key to field mappings table in the glossaries user manual. The ⟨header⟩ argument is the code to pass to the third argument of \glsxtrtitleorpdforheading. It may be left empty in which case the default is determined as follows:

The \glsxtrglossentryother command internally uses


\GlsXtrStandaloneEntryOther{label}{field}

instead of \GlsXtrStandaloneEntryName, which uses \glossentrynameother{label} {field} instead of \glossentryname{label}.

If you have loaded the glossaries-accsupp package (through the accsupp option) then accessibility support will be provided if there’s a corresponding command

\glsfieldaccessdisplay{text}{label}
(for example, \glssymbolaccessdisplay).

This means that my custom command can be changed to:

\newcommand{\displayterm}[1]{%
 \par\medskip\par\noindent
 Definition: \glsxtrglossentry{#1}.\par
 \glsentrydesc{#1}
 \par\medskip
}

If I want numbered definitions, then I can use the package options entrycounter or subentrycounter and remove the colon:

\newcommand{\displayterm}[1]{%
 \par\medskip\par\noindent
 Definition \glsxtrglossentry{#1}.\par
 \glsentrydesc{#1}
 \par\medskip
}

The counter label uses a dot after the number by default but this can be changed to a colon:

\renewcommand*{\glsentrycounterlabel}{\theglossaryentry:\space}

It’s now possible to not only use \gls to link back to the definition but also use \glsrefentry to reference the counter and \glsxtrpageref to reference the page number.

If I want the description to behave more like it does in a glossary in need to make the following modification:

\newcommand{\displayterm}[1]{%
 \par\medskip\par\noindent
 Definition \glsxtrglossentry{#1}.\par
 \begingroup
  \glsxtractivatenopost
  \glossentrydesc{#1}\glspostdescription
 \endgroup
 \par\medskip
}

(Note the grouping to localise \glsxtractivatenopost.)

You can also use \glsxtrglossentry within section headings. For example:

\section{\glsxtrglossentry{function}}

This will use \glsentryname in PDF bookmarks (if \texorpdfstring is defined) and will use \glsxtrheadname in page headers and table of contents. (If you’re using a page style or table of contents that doesn’t use \markright or \markbook or \@starttoc then you need to insert \glsxtrmarkhook and \@glsxtrinmark at the start of the header or table of contents either scoped or afterwards cancelled with \@glsxtrnotinmark and \glsxtrrestoremarkhook.)

Top

11.5 Entry Aliases

An entry can be made an alias of another entry using the alias key. The value should be the label of the other term. There’s no check for the other’s existence when the aliased entry is defined. This is to allow the possibility of defining the other entry after the aliased entry. (For example, when used with bib2gls.)

If an entry ⟨entry-1⟩ is made an alias of ⟨entry-2⟩ then:

The index suppression trigger is performed by


\glsxtrsetaliasnoindex

This is performed after the default options provided by \GlsXtrSetDefaultGlsOpts have been set. With record=only, \glsxtrsetaliasnoindex will default to do nothing.

Within the definition of \glsxtrsetaliasnoindex you can use


\glsxtrindexaliased

to index ⟨entry-2⟩.

The index suppression command can be redefined to index the main term instead. For example:

\renewcommand{\glsxtrsetaliasnoindex}{%
 \glsxtrindexaliased
 \setkeys{glslink}{noindex}%
}

The value of the alias field can be accessed using


\glsxtralias{label}

Top

12. On-the-Fly Document Definitions

The commands described here may superficially look like ⟨word\index{word}, but they behave rather differently. If you want to use \index then just use \index.

The glossaries package advises against defining entries in the document environment. As mentioned in §1.2 New or Modified Package Options above, this ability is disabled by default with glossaries-extra but can be enabled using the docdefs package options.

Although this can be problematic, the glossaries-extra package provides a way of defining and using entries within the document environment without the tricks used with the docdefs option. There are limitations with this approach, so take care with it. This function is disabled by default, but can be enabled using the preamble-only command:


\GlsXtrEnableOnTheFly

When used, this defines the commands described below.

The commands \glsxtr, \glsxtrpl, \Glsxtr and \Glsxtrpl can’t be used after the glossaries have been displayed (through \printglossary etc). It’s best not to mix these commands with the standard glossary commands, such as \gls or there may be unexpected results.


\glsxtr[gls-options][dfn-options]{label}

If an entry with the label ⟨label⟩ has already been defined, this just does \gls [gls-options]{label}. If ⟨label⟩ hasn’t been defined, this will define the entry using:

\newglossaryentry{label}{name={label},
 category=\glsxtrcat,
 description={\nopostdesc},
 dfn-options}

The ⟨label⟩ must contain any non-expandable commands, such as formatting commands or problematic characters. If the term requires any of these, they must be omitted from the ⟨label⟩ and placed in the name key must be provided in the optional argument ⟨dfn-options⟩.

The second optional argument ⟨dfn-options⟩ should be empty if the entry has already been defined, since it’s too late for them. If it’s not empty, a warning will be generated with


\GlsXtrWarning{dfn-options}{label}

For example, this warning will be generated on the second instance of \glsxtr below:

\glsxtr[][plural=geese]{goose}
 ... later
\glsxtr[][plural=geese]{goose}

If you are considering doing something like:

\newcommand*{\goose}{\glsxtr[][plural=geese]{goose}}
\renewcommand*{\GlsXtrWarning}[2]{}
 ... later
\goose\ some more text here

then don’t bother. It’s simpler and less problematic to just define the entries in the preamble with \newglossaryentry and then use \gls in the document.

There are plural and case-changing alternatives to \glsxtr:


\glsxtrpl[gls-options][dfn-options]{label}

This is like \glsxtr but uses \glspl instead of \gls.


\Glsxtr[gls-options][dfn-options]{label}

This is like \glsxtr but uses \Gls instead of \gls.


\Glsxtrpl[gls-options][dfn-options]{label}

This is like \glsxtr but uses \Glspl instead of \gls.

If you use UTF-8 and don’t want the inconvenient of needing to use an ASCII-only label, then it’s better to use XƎLATEX or LuaLATEX instead of LaTeX (or pdfLATEX). If you really desperately want to use UTF-8 entry labels without switching to XƎLATEX or LuaLATEX then there is a starred version of \GlsXtrEnableOnTheFly that allows you to use UTF-8 characters in ⟨label⟩, but it’s experimental and may not work in some cases.

If you use the starred version of \GlsXtrEnableOnTheFly don’t use any commands in the ⟨label⟩, even if they expand to just text.

Top

13. Supplemental Packages

The glossaries bundle provides additional support packages glossaries-prefix (for prefixing) and glossaries-accsupp (for accessibility support). These packages aren’t automatically loaded.

Top

13.1 Prefixes or Determiners

If prefixing is required, you can simply load glossaries-prefix after glossaries-extra. For example:

\documentclass{article}
\usepackage{glossaries-extra}
\usepackage{glossaries-prefix}
\makeglossaries
\newabbreviation
 [prefix={an\space},
 prefixfirst={a~}]
 {svm}{SVM}{support vector machine}
\begin{document}
First use: \pgls{svm}.
Next use: \pgls{svm}.
\printglossaries
\end{document}

Top

13.2 Accessibility Support

The glossaries-accsupp package is still experimental and so accessibility features are liable to change.

The glossaries-accsupp package needs to be loaded before glossaries-extra or through the accsupp package option:

\usepackage[accsupp]{glossaries-extra}

If you don’t load glossaries-accsupp or you load glossaries-accsupp after glossaries-extra the new \glsaccessxxx⟩ commands described below will simply be equivalent to the corresponding \glsentryxxx⟩ commands. Other accessibility features, such as the attributes used by \newabbreviation also won’t work if glossaries-accsupp is loaded too late.

The following \glsaccessxxx⟩ commands add accessibility information wrapped around the corresponding \glsentryxxx⟩ commands. There is no check for existence of the entry nor do any of these commands add formatting, hyperlinks or indexing information.


\glsaccessname{label}

This displays the value of the name field for the entry identified by ⟨label⟩.

If the glossaries-accsupp package isn’t loaded, this is simply defined as:

\newcommand*{\glsaccessname}[1]{\glsentryname{#1}}

otherwise it’s defined as:

\newcommand*{\glsaccessname}[1]{%
  \glsnameaccessdisplay
  {%
    \glsentryname{#1}%
  }%
  {#1}%
}

(\glsnameaccessdisplay is defined by the glossaries-accsupp package.) The first letter upper case version is:


\Glsaccessname{label}

Without the glossaries-accsupp package this is just defined as:

\newcommand*{\Glsaccessname}[1]{\Glsentryname{#1}}

With the glossaries-accsupp package this is defined as:

\newcommand*{\Glsaccessname}[1]{%
  \glsnameaccessdisplay
  {%
    \Glsentryname{#1}%
  }%
  {#1}%
}

The following commands are all defined in an analogous manner.


\glsaccesstext{label}

This displays the value of the text field.


\Glsaccesstext{label}

This displays the value of the text field with the first letter converted to upper case.


\glsaccessplural{label}

This displays the value of the plural field.


\Glsaccessplural{label}

This displays the value of the plural field with the first letter converted to upper case.


\glsaccessfirst{label}

This displays the value of the first field.


\Glsaccessfirst{label}

This displays the value of the first field with the first letter converted to upper case.


\glsaccessfirstplural{label}

This displays the value of the firstplural field.


\Glsaccessfirstplural{label}

This displays the value of the firstplural field with the first letter converted to upper case.


\glsaccesssymbol{label}

This displays the value of the symbol field.


\Glsaccesssymbol{label}

This displays the value of the symbol field with the first letter converted to upper case.


\glsaccesssymbolplural{label}

This displays the value of the symbolplural field.


\Glsaccesssymbolplural{label}

This displays the value of the symbolplural field with the first letter converted to upper case.


\glsaccessdesc{label}

This displays the value of the description field.


\Glsaccessdesc{label}

This displays the value of the description field with the first letter converted to upper case.


\glsaccessdescplural{label}

This displays the value of the descriptionplural field.


\Glsaccessdescplural{label}

This displays the value of the descriptionplural field with the first letter converted to upper case.


\glsaccessshort{label}

This displays the value of the short field.


\Glsaccessshort{label}

This displays the value of the short field with the first letter converted to upper case.


\glsaccessshortpl{label}

This displays the value of the shortplural field.


\Glsaccessshortpl{label}

This displays the value of the shortplural field with the first letter converted to upper case.


\glsaccesslong{label}

This displays the value of the long field.


\Glsaccesslong{label}

This displays the value of the long field with the first letter converted to upper case.


\glsaccesslongpl{label}

This displays the value of the longplural field.


\Glsaccesslongpl{label}

This displays the value of the longplural field with the first letter converted to upper case.

Top

14. Sample Files

The following sample files are provided with this package:

sample.tex
Simple sample file that uses one of the dummy files provided by the glossaries package for testing.
sample-abbr-styles.tex
Demonstrates all predefined abbreviation styles.
sample-mixture.tex
General entries, acronyms and initialisms all treated differently.
sample-name-font
Categories and attributes are used to customize the way different entries appear.
sample-abbrv.tex
General abbreviations.
sample-acronym.tex
Acronyms aren’t initialisms and don’t expand on first use.
sample-acronym-desc.tex
Acronyms that have a separate long form and description.
sample-crossref.tex
Unused entries that have been cross-referenced automatically are added at the end of the document.
sample-indexhook.tex
Use the index hook to track which entries have been indexed (and therefore find out which ones haven’t been indexed).
sample-footnote.tex
Footnote abbreviation style that moves the footnote marker outside of the hyperlink generated by \gls and moves it after certain punctuation characters for neatness.
sample-undef.tex
Warn on undefined entries instead of generating an error.
sample-mixed-abbrv-styles.tex
Different abbreviation styles for different entries.
sample-initialisms.tex
Automatically insert dots into initialisms.
sample-postdot.tex
Another initialisms example.
sample-postlink.tex
Automatically inserting text after the link-text produced by commands like \gls (outside of hyperlink, if present).
sample-header.tex
Using entries in section/chapter headings.
sample-autoindex.tex
Using the dualindex and indexname attributes to automatically add glossary entries to the index (in addition to the glossary location list).
sample-autoindex-hyp.tex
As previous but uses hyperref.
sample-nested.tex
Using \gls within the value of the name key.
sample-entrycount.tex
Enable entry-use counting (only index if used more than n times, see §8.1 Entry Counting (First Use Flag)).
sample-unitentrycount.tex
Enable use of per-unit entry-use counting (§8.1 Entry Counting (First Use Flag)).
sample-onelink.tex
Using the per-unit entry counting (§8.1 Entry Counting (First Use Flag)) to only have one hyperlink per entry per page.
sample-linkcount.tex
Using link counting (§8.2 Link Counting) to only have one hyperlink per entry.
sample-pages.tex
Insert “page” or “pages” before the location list.
sample-altmodifier.tex
Set the default options for commands like \gls and add an alternative modifier.
sample-mixedsort.tex
Uses the optional argument of \makeglossaries to allow a mixture of \printglossary and \printnoidxglossary.
sample-external.tex
Uses the targeturl attribute to allow for entries that should link to an external URL rather than to an internal glossary.
sample-fmt.tex
Provides text-block commands associated with entries in order to use \glsxtrfmt.
sample-alias.tex
Uses the alias key. (See §11.5 Entry Aliases.)
sample-alttree.tex
Uses the glossaries-extra-stylemods package with the alttree style (see §2.11.3 The glossaries-extra-stylemods Package).
sample-alttree-sym.tex
Another alttree example that measures the symbol widths.
sample-alttree-marginpar.tex
Another alttree example that puts the number list in the margin.
sample-onthefly.tex
Using on-the-fly commands. Terms with accents must have the name key explicitly set.
sample-onthefly-xetex.tex
Using on-the-fly commands with XƎLATEX. Terms with UTF-8 characters don’t need to have the name key explicitly set. Terms that contain commands must have the name key explicitly set with the commands removed from the label.
sample-onthefly-utf8.tex
Tries to emulate the previous sample file for use with LaTeX through the starred version of \GlsXtrEnableOnTheFly. This is a bit iffy and may not always work. Terms that contain commands must have the name key explicitly set with the commands removed from the label.
sample-accsupp.tex
Integrate glossaries-accsupp.
sample-prefix.tex
Integrate glossaries-prefix.
sample-suppl-main.tex
Uses thevalue to reference a location in the supplementary file sample-suppl.tex.
sample-suppl-main-hyp.tex
A more complicated version to the above that uses the hyperref package to reference a location in the supplementary file sample-suppl-hyp.tex.

Top

15. Multi-Lingual Support

There’s only one command provided by glossaries-extra that you’re likely to want to change in your document and that’s \abbreviationsname (§1.2 New or Modified Package Options) if you use the abbreviations package option to automatically create the glossary labelled abbreviations. If this command doesn’t already exist, it will be defined to “Abbreviations” if babel hasn’t been loaded, otherwise it will be defined as \acronymname (provided by glossaries).

You can redefine it in the usual way. For example:

\renewcommand*{\abbreviationsname}{List of Abbreviations}

Or using babel or polyglossia captions hook:

\appto\captionsenglish{%
 \renewcommand*{\abbreviationsname}{List of Abbreviations}%
}

Alternatively you can use the title key when you print the list of abbreviations. For example:

\printabbreviations[title={List of Abbreviations}]

or

\printglossary[type=abbreviations,title={List of Abbreviations}]

The other fixed text commands are the diagnostic messages, which shouldn’t appear in the final draft of your document.

The glossaries-extra package has the facility to load language modules (whose filename is in the form glossariesxtr-language.ldf) if they exist, but won’t warn if they don’t. If glossaries-extra-bib2gls is loaded via the record package option then the check for language resource files will additionally search for an associated language script file given by glossariesxtr-script.ldf where ⟨script⟩ is the four letter script identifier, such as Latn, associated with the given dialect. There’s no warning if the associated file isn’t found. The script file is loaded after the dialect file.

If you want to write your own language module, you just need to create a file called glossariesxtr-lang.ldf, where ⟨lang⟩ identifies the language or dialect (see the tracklang package). For example, glossariesxtr-french.ldf.

The simplest code for this file is:

\ProvidesGlossariesExtraLang{french}[2015/12/09 v1.0]
\newcommand*{\glossariesxtrcaptionsfrench}{%
 \def\abbreviationsname{Abr\'eviations}%
}
\glossariesxtrcaptionsfrench
\ifcsdef{captions\CurrentTrackedDialect}
{%
  \csappto{captions\CurrentTrackedDialect}%
  {%
    \glossariesxtrcaptionsfrench
  }%
}%
{%
  \ifcsdef{captions\CurrentTrackedLanguage}
  {%
    \csappto{captions\CurrentTrackedLanguage}%
    {%
      \glossariesxtrcaptionsfrench
    }%
  }%
  {}%
}

You can adapt this for other languages by replacing all instances of the language identifier french and the translated text Abr\’eviations as appropriate. You can also use the .ldf file to provide rule blocks for a particular language for use with bib2gls’s custom sort rule. See §10.3 The glossaries-extra-bib2gls package for further details.

This .ldf file then needs to be put somewhere on TeX’s path so that it can be found by glossaries-extra. You might also want to consider uploading it to CTAN so that it can be useful to others. (Please don’t send it to me. I already have more packages than I am able to maintain.)

If you additionally want to provide translations for the diagnostic messages used when a glossary is missing, you need to redefine the following commands:


\GlsXtrNoGlsWarningHead{label}{file}

This produces the following text in English:

This document is incomplete. The external file associated with the glossary ‘⟨label⟩’ (which should be called ⟨file⟩) hasn’t been created.


\GlsXtrNoGlsWarningEmptyStart

This produces the following text in English:

This has probably happened because there are no entries defined in this glossary.


\GlsXtrNoGlsWarningEmptyMain

This produces the following text in English:

If you don’t want this glossary, add nomain to your package option list when you load glossaries-extra.sty. For example:


\GlsXtrNoGlsWarningEmptyNotMain{label}

This produces the following text in English:

Did you forget to use type=label⟩ when you defined your entries? If you tried to load entries into this glossary with \loadglsentries did you remember to use [label] as the optional argument? If you did, check that the definitions in the file you loaded all had the type set to \glsdefaulttype.


\GlsXtrNoGlsWarningCheckFile{file}

This produces the following text in English:

Check the contents of the file ⟨file⟩. If it’s empty, that means you haven’t indexed any of your entries in this glossary (using commands like \gls or \glsadd) so this list can’t be generated. If the file isn’t empty, the document build process hasn’t been completed.


\GlsXtrNoGlsWarningMisMatch

This produces the following text in English:

You need to either replace \makenoidxglossaries with \makeglossaries or replace \printglossary (or \printglossaries) with \printnoidxglossary (or \printnoidxglossaries) and then rebuild this document.


\GlsXtrNoGlsWarningNoOut{file}

This produces the following text in English:

The file ⟨file⟩ doesn’t exist. This most likely means you haven’t used \makeglossaries or you have used \nofiles. If this is just a draft version of the document, you can suppress this message using the nomissingglstext package option.


\GlsXtrNoGlsWarningTail

This produces the following text in English:

This message will be removed once the problem has been fixed.


\GlsXtrNoGlsWarningBuildInfo

This is advice on how to generate the glossary files.


\GlsXtrNoGlsWarningAutoMake{label}

This is the message produced when the automake option is used, but the document needs a rerun or the shell escape setting doesn’t permit the execution of the external application. This command also generates a warning in the transcript file.

See the documented code (glossaries-extra-code.pdf) for further details.

Top

Glossary

bib2gls
A command line Java application that selects entries from a .bib file and converts them to glossary definitions (like bibtex but also performs hierarchical sorting and collation, thus omitting the need for xindy or makeindex). Further details at: http://www.dickimaw-books.com/software/bib2gls/.
entry location
The location of the entry in the document. This defaults to the page number on which the entry appears. An entry may have multiple locations.
first use
The first time a glossary entry is used (from the start of the document or after a reset) with one of the following commands: \gls, \Gls, \GLS, \glspl, \Glspl, \GLSpl or \glsdisp.
first use flag
A conditional that determines whether or not the entry has been used according to the rules of first use.
first use text
The text that is displayed on first use, which is governed by the first and firstplural keys of \newglossaryentry. (May be overridden by \glsdisp.)
link-text
The text produced by commands such as \gls. It may or may not have a hyperlink to the glossary.
location list
A list of entry locations. See number list.
makeglossaries
A custom designed Perl script interface provided with the glossaries package to run xindy or makeindex according to the document settings.
makeglossaries-lite
A custom designed Lua script interface to xindy and makeindex provided with the glossaries package. This is a cut-down alternative to the Perl makeglossaries script. If you have Perl installed, use the Perl script instead. This script is distributed in the source code on CTAN with the file name makeglossaries-lite.lua but TeX Live on Unix-like systems creates a symbolic link called makeglossaries-lite (without the .lua extension) to the actual makeglossaries-lite.lua script, and TeX distributions on Windows convert the script to an executable makeglossaries-lite.exe.
makeindex
An indexing application.
number list
A list of entry locations (also called a location list). The number list can be suppressed using the nonumberlist package option.
xindy
An flexible indexing application with multilingual support written in Perl.

Index

A

abbreviation styles (deprecated):
    footnote-em  1
    footnote-sc  2
    footnote-sm  3
    long-desc-em  4
    long-desc-sc  5
    long-desc-sm  6
    long-em  7
    long-sc  8
    long-sm  9
    postfootnote-em  10
    postfootnote-sc  11
    postfootnote-sm  12
abbreviation styles:
    footnote  13
    footnote-desc  14
    long  15
    long-desc  16
    long-em-noshort-em  17, 18, 19
    long-em-noshort-em-desc  20, 21
    long-em-noshort-em-desc-noreg  22
    long-em-noshort-em-noreg  23, 24, 25
    long-em-short-em  26, 27, 28, 29
    long-em-short-em-desc  30
    long-hyphen-long-hyphen  31
    long-hyphen-noshort-desc-noreg  32, 33
    long-hyphen-noshort-noreg  34, 35
    long-hyphen-postshort-hyphen  36, 37, 38, 39, 40, 41
    long-hyphen-postshort-hyphen-desc  42
    long-hyphen-short-hyphen  43, 44, 45, 46, 47
    long-hyphen-short-hyphen-desc  48, 49
    long-noshort  50, 51, 52, 53, 54, 55, 56, 57, 58
    long-noshort-desc  59, 60, 61, 62, 63, 64, 65, 66, 67, 68
    long-noshort-desc-noreg  69
    long-noshort-em  70
    long-noshort-em-desc  71
    long-noshort-noreg  72
    long-noshort-sc  73, 74
    long-noshort-sc-desc  75, 76
    long-noshort-sm  77
    long-noshort-sm-desc  78
    long-only-short-only  79, 80, 81, 82
    long-only-short-only-desc  83, 84
    long-only-short-sc-only  85, 86
    long-only-short-sc-only-desc  87
    long-postshort-sc-user  88, 89, 90
    long-postshort-sc-user-desc  91
    long-postshort-user  92, 93, 94
    long-postshort-user-desc  95, 96
    long-short  97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112
    long-short-desc  113, 114, 115, 116, 117, 118, 119, 120, 121
    long-short-em  122, 123, 124, 125
    long-short-em-desc  126, 127
    long-short-sc  128, 129, 130, 131
    long-short-sc-desc  132, 133
    long-short-sm  134, 135, 136
    long-short-sm-desc  137, 138
    long-short-user  139, 140, 141, 142, 143, 144, 145, 146, 147
    long-short-user-desc  148
    nolong-short  149, 150
    nolong-short-em  151
    nolong-short-noreg  152
    nolong-short-sc  153
    nolong-short-sm  154
    postfootnote  155, 156
    postfootnote-desc  157
    short  158
    short-desc  159
    short-em  160
    short-em-desc  161
    short-em-footnote  162, 163
    short-em-footnote-desc  164, 165
    short-em-long  166, 167, 168
    short-em-long-desc  169, 170
    short-em-long-em  171, 172
    short-em-long-em-desc  173
    short-em-nolong  174, 175, 176
    short-em-nolong-desc  177, 178
    short-em-postfootnote  179
    short-em-postfootnote-desc  180
    short-footnote  181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191
    short-footnote-desc  192, 193, 194, 195, 196, 197, 198
    short-hyphen-long-hyphen  199, 200
    short-hyphen-long-hyphen-desc  201
    short-hyphen-postlong-hyphen  202, 203
    short-hyphen-postlong-hyphen-desc  204
    short-long  205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215
    short-long-desc  216, 217, 218, 219, 220, 221, 222
    short-long-user  223, 224, 225, 226, 227, 228, 229
    short-long-user-desc  230
    short-nolong  231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245
    short-nolong-desc  246, 247, 248, 249, 250
    short-nolong-desc-noreg  251
    short-nolong-noreg  252
    short-postfootnote  253, 254, 255, 256, 257, 258, 259, 260
    short-postfootnote-desc  261, 262, 263, 264, 265
    short-postlong-user  266, 267, 268
    short-postlong-user-desc  269
    short-sc  270
    short-sc-desc  271
    short-sc-footnote  272, 273, 274
    short-sc-footnote-desc  275, 276
    short-sc-long  277, 278, 279, 280
    short-sc-long-desc  281, 282
    short-sc-nolong  283, 284, 285
    short-sc-nolong-desc  286, 287
    short-sc-postfootnote  288, 289
    short-sc-postfootnote-desc  290
    short-sm  291
    short-sm-desc  292
    short-sm-footnote  293
    short-sm-footnote-desc  294, 295
    short-sm-long  296, 297, 298
    short-sm-long-desc  299, 300
    short-sm-nolong  301, 302, 303
    short-sm-nolong-desc  304, 305
    short-sm-postfootnote  306
    short-sm-postfootnote-desc  307
\abbreviationsname  308
\abbrvpluralsuffix  309
acronym styles (glossaries):
    dua  310
    dua-desc  311
    footnote  312
    footnote-desc  313
    footnote-sc  314
    footnote-sc-desc  315
    footnote-sm  316
    footnote-sm-desc  317
    long-sc-short  318
    long-sc-short-desc  319
    long-short-desc  320
    long-sm-short  321
    long-sm-short-desc  322
    long-sp-short  323, 324
    long-sp-short-desc  325
    sc-short-long  326
    sc-short-long-desc  327
    short-long  328
    short-long-desc  329
    sm-short-long  330
    sm-short-long-desc  331
amsgen package  332
amsmath package  333
\apptoglossarypreamble  334

B babel package  335, 336, 337, 338, 339, 340, 341, 342, 343
bib2gls  344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478

C categories:
    abbreviation  479, 480, 481, 482, 483
    acronym  484, 485, 486, 487, 488, 489
    general  490, 491, 492, 493, 494, 495, 496, 497
    index  498, 499
    number  500
    symbol  501, 502
category attributes:
    accessaposplural  503, 504, 505, 506
    accessinsertdots  507, 508
    accessnoshortplural  509, 510
    aposplural  511, 512, 513, 514, 515, 516, 517, 518
    combinedfirstsep  519, 520
    combinedfirstsepfirst  521, 522
    combinedsep  523, 524
    combinedsepfirst  525, 526
    discardperiod  527, 528, 529, 530, 531, 532
    dualindex  533, 534, 535, 536, 537, 538, 539
    entrycount  540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550
    externallocation  551, 552, 553, 554
    firstshortaccess  555
    glossdesc  556, 557, 558
    glossdescfont  559, 560, 561
    glossname  562, 563, 564
    glossnamefont  565, 566, 567, 568, 569
    glosssymbolfont  570, 571
    headuc  572, 573, 574, 575
    hyperoutside  576, 577
    indexname  578, 579, 580, 581, 582
    indexonlyfirst  583, 584, 585
    insertdots  586, 587, 588, 589
    linkcount  590, 591, 592
    linkcountmaster  593, 594
    markshortwords  595, 596
    markwords  597, 598, 599, 600, 601, 602
    multioptions  603, 604, 605, 606
    nameshortaccess  607
    nohyper  608, 609, 610
    nohyperfirst  611, 612, 613, 614, 615
    noshortplural  616, 617, 618, 619, 620, 621
    pluraldiscardperiod  622, 623
    recordcount  624, 625, 626, 627
    regular  628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659
    retainfirstuseperiod  660, 661
    tagging  662, 663, 664, 665
    targetcategory  666
    targetname  667, 668
    targeturl  669, 670, 671, 672, 673
    textformat  674, 675, 676, 677, 678
    textshortaccess  679
    unitcount  680
    wrgloss  681, 682
\cGLS  683
\cGLSformat  684
\cGLSpl  685
\cGLSplformat  686
convertgls2bib  687
\csGlsXtrLetField  688
\CustomAbbreviationFields  689

D datatool package  690
datatool-base package  691, 692, 693, 694
\dGLS  695
\dGls  696
\dgls  697
\dglsdisp  698
\dglslink  699
\dGLSpl  700
\dGlspl  701
\dglspl  702

E \eglssetwidest  703
\eglsupdatewidest  704
\eGlsXtrSetField  705
entry location  706, 707, 708
entrycounter package  709
equation (counter)  710, 711, 712, 713, 714
etoolbox package  715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725

F \false options
    groups  726
fancyhdr package  727
file types
    aux  728, 729, 730, 731
    bib  732, 733
    glg-abr  734
    glo-abr  735
    gls-abr  736
first use  737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795
first use flag  796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818
first use text  819, 820
fontenc package  821
\forallabbreviationlists  822

G \gglssetwidest  823
\gglsupdatewidest  824
\gGlsXtrSetField  825
glossaries package  826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845
glossaries-accsupp package  846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867
glossaries-extra package  868, 869, 870, 871, 872, 873, 874
glossaries-extra-bib2gls package  875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890
glossaries-extra-stylemods package  891, 892, 893, 894, 895, 896, 897, 898, 899, 900
glossaries-prefix package  901, 902, 903, 904, 905
\glossariesextrasetup  906
glossary styles:
    altlist  907, 908, 909
    alttree  910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924
    bookindex  925, 926, 927, 928
    index  929
    inline  930, 931
    list  932, 933, 934, 935
    listdotted  936, 937
    listhypergroup  938
    long  939, 940, 941
    long-desc-name  942
    long-desc-sym-name  943
    long-loc-desc-name  944
    long-loc-desc-sym-name  945
    long-loc-sym-desc-name  946
    long-name-desc  947, 948, 949
    long-name-desc-loc  950
    long-name-desc-sym  951, 952
    long-name-desc-sym-loc  953, 954
    long-name-sym-desc  955
    long-name-sym-desc-loc  956
    long-sym-desc-name  957
    long3col  958
    longragged-booktabs  959, 960
    mcolindexgroup  961
    super  962
    topic  963, 964
    topicmcols  965
    tree  966, 967, 968, 969, 970
    treenoname  971, 972, 973
glossary-bookindex package  974, 975
glossary-inline package  976
glossary-list package  977
glossary-long package  978, 979
glossary-longextra package  980, 981
glossary-topic package  982, 983
glossary-tree package  984, 985, 986, 987, 988, 989, 990
\glossentrynameother  991
\glossxtrsetpopts  992
\glsabbrvdefaultfont  993, 994
\glsabbrvemfont  995
\glsabbrvfont  996
\glsabbrvhyphenfont  997
\glsabbrvonlyfont  998
\glsabbrvscfont  999
\glsabbrvsconlyfont  1000
\glsabbrvscuserfont  1001
\glsabbrvsmfont  1002
\glsabbrvuserfont  1003, 1004
\Glsaccessdesc  1005
\glsaccessdesc  1006
\Glsaccessdescplural  1007
\glsaccessdescplural  1008
\Glsaccessfirst  1009
\glsaccessfirst  1010
\Glsaccessfirstplural  1011
\glsaccessfirstplural  1012
\Glsaccesslong  1013
\glsaccesslong  1014
\Glsaccesslongpl  1015
\glsaccesslongpl  1016
\Glsaccessname  1017
\glsaccessname  1018
\Glsaccessplural  1019
\glsaccessplural  1020
\Glsaccessshort  1021
\glsaccessshort  1022
\Glsaccessshortpl  1023
\glsaccessshortpl  1024
\Glsaccesssymbol  1025
\glsaccesssymbol  1026
\Glsaccesssymbolplural  1027
\glsaccesssymbolplural  1028
\Glsaccesstext  1029
\glsaccesstext  1030
\glsacspace  1031
\glsacspacemax  1032
\glsadd options
    format  1033
    theHvalue  1034, 1035
    thevalue  1036, 1037, 1038, 1039, 1040
\glsaddeach  1041
\glsaddpostsetkeys  1042
\glsaddpresetkeys  1043
\glsaltlistitem  1044
\glsalttreechildpredesc  1045
\glsalttreepredesc  1046
\glscapturedgroup  1047
\glscategory  1048
\glscategorylabel  1049
\glscombinedfirstsep  1050
\glscombinedfirstsepfirst  1051
\glscombinedsep  1052
\glscombinedsepfirst  1053
\glscurrententrylabel  1054
\glscurrentfieldvalue  1055
\glsdefaultshortaccess  1056
\glsdefpostdesc  1057
\glsdefpostlink  1058
\glsdefpostname  1059
\glsentrycurrcount  1060
\glsentrypdfsymbol  1061
\glsentryprevcount  1062
\glsentryprevmaxcount  1063
\glsentryprevtotalcount  1064
\glsextrapostnamehook  1065
\glsFindWidestAnyName  1066
\glsFindWidestAnyNameLocation  1067
\glsFindWidestAnyNameSymbol  1068
\glsFindWidestAnyNameSymbolLocation  1069
\glsFindWidestLevelTwo  1070
\glsFindWidestTopLevelName  1071
\glsFindWidestUsedAnyName  1072
\glsFindWidestUsedAnyNameLocation  1073
\glsFindWidestUsedAnyNameSymbol  1074
\glsFindWidestUsedAnyNameSymbolLocation  1075
\glsFindWidestUsedLevelTwo  1076
\glsFindWidestUsedTopLevelName  1077
\glsfirstabbrvdefaultfont  1078
\glsfirstabbrvemfont  1079
\glsfirstabbrvfont  1080
\glsfirstabbrvhyphenfont  1081
\glsfirstabbrvonlyfont  1082
\glsfirstabbrvsconlyfont  1083
\glsfirstabbrvscuserfont  1084
\glsfirstabbrvsmfont  1085
\glsfirstabbrvuserfont  1086
\glsfirstlongdefaultfont  1087
\glsfirstlongemfont  1088
\glsfirstlongfont  1089
\glsfirstlongfootnotefont  1090
\glsfirstlonghyphenfont  1091
\glsfirstlongonlyfont  1092
\glsfirstlonguserfont  1093
\GLSfmtfirst  1094
\Glsfmtfirst  1095
\glsfmtfirst  1096
\GLSfmtfirstpl  1097
\Glsfmtfirstpl  1098
\glsfmtfirstpl  1099
\GLSfmtfull  1100
\Glsfmtfull  1101
\glsfmtfull  1102
\GLSfmtfullpl  1103
\Glsfmtfullpl  1104
\glsfmtfullpl  1105
\GLSfmtlong  1106
\Glsfmtlong  1107
\glsfmtlong  1108
\GLSfmtlongpl  1109
\Glsfmtlongpl  1110
\glsfmtlongpl  1111
\GLSfmtname  1112
\Glsfmtname  1113
\glsfmtname  1114
\GLSfmtplural  1115
\Glsfmtplural  1116
\glsfmtplural  1117
\GLSfmtshort  1118
\Glsfmtshort  1119
\glsfmtshort  1120
\Glsfmtshortpl  1121, 1122
\glsfmtshortpl  1123
\GLSfmttext  1124
\Glsfmttext  1125
\glsfmttext  1126
\glsforeachwithattribute  1127
\glsgetattribute  1128
\glsgetcategoryattribute  1129
\glsgetwidestname  1130
\glsgetwidestsubname  1131
\glshasattribute  1132
\glshascategoryattribute  1133
\glshex  1134
\glsifattribute  1135
\glsifcategory  1136
\glsifcategoryattribute  1137
\glsifnotregular  1138
\glsifnotregularcategory  1139
\glsifregular  1140
\glsifregularcategory  1141
\glskeylisttok  1142
\glslabeltok  1143
\glslink options
    counter  1144, 1145
    format  1146, 1147, 1148, 1149, 1150, 1151
    hyper  1152, 1153, 1154
    hyper=false  1155
    hyperoutside  1156, 1157
    noindex  1158, 1159, 1160, 1161, 1162, 1163, 1164
    prefix  1165, 1166
    textformat  1167, 1168
    theHvalue  1169, 1170
    thevalue  1171, 1172
    wrgloss  1173, 1174, 1175, 1176
\glslinkcheckfirsthyperhook  1177
\glslinkpresetkeys  1178
\glslistchildpostlocation  1179
\glslistchildprelocation  1180
\glslistdesc  1181
\glslistgroupafterheader  1182
\glslistgroupheaderitem  1183
\glslistgroupskip  1184
\glslistitem  1185
\glslistprelocation  1186
\glslocalreseteach  1187
\glslocalunseteach  1188
\glslongdefaultfont  1189
\glslongemfont  1190
\glslongextraDescAlign  1191
\glslongextraDescFmt  1192
\glslongextraDescNameHeader  1193
\glslongextraDescNameTabularFooter  1194
\glslongextraDescNameTabularHeader  1195
\glslongextraDescSymNameHeader  1196
\glslongextraDescSymNameTabularFooter  1197
\glslongextraDescSymNameTabularHeader  1198
\glslongextraGroupHeading  1199
\glslongextraHeaderFmt  1200
\glslongextraLocationAlign  1201
\glslongextraLocationDescNameHeader  1202
\glslongextraLocationDescNameTabularFooter  1203
\glslongextraLocationDescNameTabularHeader  1204
\glslongextraLocationDescSymNameHeader  1205
\glslongextraLocationDescSymNameTabularFooter  1206
\glslongextraLocationDescSymNameTabularHeader  1207
\glslongextraLocationFmt  1208, 1209
\glslongextraLocationSymDescNameHeader  1210
\glslongextraLocationSymDescNameTabularFooter  1211
\glslongextraLocationSymDescNameTabularHeader  1212
\glslongextraLocSetDescWidth  1213
\glslongextraNameAlign  1214
\glslongextraNameDescHeader  1215
\glslongextraNameDescLocationHeader  1216
\glslongextraNameDescLocationTabularFooter  1217
\glslongextraNameDescLocationTabularHeader  1218
\glslongextraNameDescSymHeader  1219
\glslongextraNameDescSymLocationHeader  1220
\glslongextraNameDescSymLocationTabularFooter  1221
\glslongextraNameDescSymLocationTabularHeader  1222
\glslongextraNameDescSymTabularFooter  1223
\glslongextraNameDescSymTabularHeader  1224
\glslongextraNameDescTabularFooter  1225
\glslongextraNameDescTabularHeader  1226
\glslongextraNameFmt  1227
\glslongextraNameSymDescHeader  1228
\glslongextraNameSymDescLocationHeader  1229
\glslongextraNameSymDescLocationTabularFooter  1230
\glslongextraNameSymDescLocationTabularHeader  1231
\glslongextraNameSymDescTabularFooter  1232
\glslongextraNameSymDescTabularHeader  1233
\glslongextraSetDescWidth  1234
\glslongextraSetWidest  1235
\glslongextraSubDescFmt  1236
\glslongextraSubNameFmt  1237
\glslongextraSubSymbolFmt  1238
\glslongextraSymbolAlign  1239
\glslongextraSymbolFmt  1240
\glslongextraSymDescNameHeader  1241
\glslongextraSymDescNameTabularFooter  1242
\glslongextraSymDescNameTabularHeader  1243
\glslongextraSymLocSetDescWidth  1244
\glslongextraSymSetDescWidth  1245
\glslongextraTabularVAlign  1246
\glslongextraUpdateWidest  1247
\glslongextraUpdateWidestChild  1248
\GlsLongExtraUseTabulartrue  1249
\glslongfont  1250
\glslongfootnotefont  1251
\glslonghyphenfont  1252
\glslongonlyfont  1253
\glslongpltok  1254
\glslongtok  1255
\glslonguserfont  1256
\glsnoidxdisplayloc  1257
\glspdffmtfull  1258
\glspdffmtfullpl  1259
\glsps  1260
\glspt  1261
\glsrenewcommand  1262
\glsseefirstitem  1263
\glsseeitemformat  1264
\glsseelastoxfordsep  1265
\glssetattribute  1266
\glssetcategoriesattribute  1267
\glssetcategoriesattributes  1268
\glssetcategoryattribute  1269
\glssetcombinedsepabbrvnbsp  1270
\glssetcombinedsepabbrvnone  1271
\glssetcombinedsepnarrow  1272
\glssetregularcategory  1273
\glsshortpltok  1274
\glsshorttok  1275
\glstopicAssignSubIndent  1276
\glstopicAssignWidest  1277
\glstopicCols  1278
\glstopicColsEnv  1279
\glstopicDesc  1280
\glstopicGroupHeading  1281
\glstopicInit  1282
\glstopicItem  1283
\glstopicLoc  1284
\glstopicMarker  1285
\glstopicMidSkip  1286
\glstopicParIndent  1287
\glstopicPostSkip  1288
\glstopicPreSkip  1289
\glstopicSubIndent  1290
\glstopicSubItem  1291
\glstopicSubItemBox  1292
\glstopicSubItemParIndent  1293
\glstopicSubItemSep  1294
\glstopicSubLoc  1295
\glstopicSubNameFont  1296
\glstopicSubPreLocSep  1297
\glstopicTitle  1298
\glstopicTitleFont  1299
\glstreechilddesc  1300
\glstreeChildDescLoc  1301
\glstreechildpredesc  1302
\glstreechildprelocation  1303
\glstreechildsymbol  1304
\glstreedefaultnamefmt  1305
\glstreedesc  1306
\glstreeDescLoc  1307
\glstreegroupskip  1308
\glstreeheadergroupskip  1309
\glstreeNoDescSymbolPreLocation  1310
\glstreenonamechilddesc  1311
\glstreenonamedesc  1312
\glstreenonamesymbol  1313
\glstreepredesc  1314
\glstreePreHeader  1315
\glstreeprelocation  1316
\glstreesymbol  1317
\glsunsetcategoryattribute  1318
\glsupdatewidest  1319
\glsuseabbrvfont  1320
\glsuselongfont  1321
\glsuserdescription  1322
\Glsxtr  1323
\glsxtr  1324
\glsxtrabbreviationfont  1325
\glsxtrabbrvfootnote  1326
\glsxtrabbrvpluralsuffix  1327, 1328
\glsxtractivatenopost  1329
\glsxtraddallcrossrefs  1330
\glsxtraddlabelprefix  1331
\glsxtralias  1332
\glsxtrAltTreeIndent  1333
\glsxtralttreeInit  1334
\glsxtralttreeSubSymbolDescLocation  1335
\glsxtralttreeSymbolDescLocation  1336
\glsxtrapptocsvfield  1337
\GlsXtrAutoAddOnFormat  1338
\glsxtrautoindex  1339
\glsxtrautoindexassignsort  1340
\glsxtrautoindexentry  1341
\glsxtrautoindexesc  1342
\glsxtrBasicDigitrules  1343
\GlsXtrBibTeXEntryAliases  1344
\glsxtrbookindexatendgroup  1345
\glsxtrbookindexbetween  1346
\glsxtrbookindexbookmark  1347
\glsxtrbookindexcols  1348
\glsxtrbookindexcolspread  1349
\glsxtrbookindexfirstmark  1350
\glsxtrbookindexfirstmarkfmt  1351
\glsxtrbookindexformatheader  1352
\glsxtrbookindexlastmark  1353
\glsxtrbookindexlastmarkfmt  1354
\glsxtrbookindexlocation  1355
\glsxtrbookindexmarkentry  1356
\glsxtrbookindexmulticolsenv  1357
\glsxtrbookindexname  1358
\glsxtrbookindexparentchildsep  1359
\glsxtrbookindexparentsubchildsep  1360
\glsxtrbookindexprelocation  1361
\glsxtrbookindexsubatendgroup  1362
\glsxtrbookindexsubbetween  1363
\glsxtrbookindexsublocation  1364
\glsxtrbookindexsubname  1365
\glsxtrbookindexsubprelocation  1366
\glsxtrbookindexsubsubatendgroup  1367
\glsxtrbookindexsubsubbetween  1368
\glsxtrchecknohyperfirst  1369
\glsxtrclearlabelprefixes  1370
\glsxtrcombiningdiacriticIIIrules  1371
\glsxtrcombiningdiacriticIIrules  1372
\glsxtrcombiningdiacriticIrules  1373
\glsxtrcombiningdiacriticIVrules  1374
\glsxtrcombiningdiacriticrules  1375
\glsxtrcontrolrules  1376
\glsxtrcopytoglossary  1377
\glsxtrcurrencyrules  1378
\glsxtrcurrentmglscsname  1379
\GlsXtrDefaultResourceOptions  1380
\glsxtrdeffield  1381
\glsxtrdetoklocation  1382
\glsxtrdigitrules  1383
\GlsXtrDiscardUnsetBuffering  1384
\glsxtrdisplayendloc  1385
\glsxtrdisplayendlochook  1386
\glsxtrdisplaylocnameref  1387
\glsxtrdisplaysingleloc  1388
\glsxtrdisplaystartloc  1389
\glsxtrdisplaysupploc  1390
\glsxtrdoautoindexname  1391
\glsxtrdowrglossaryhook  1392
\glsxtredeffield  1393
\glsxtremsuffix  1394
\GlsXtrEnableEntryCounting  1395
\GlsXtrEnableEntryUnitCounting  1396
\GlsXtrEnableIndexFormatOverride  1397
\GlsXtrEnableInitialTagging  1398
\GlsXtrEnableLinkCounting  1399
\GlsXtrEnableOnTheFly  1400
\GlsXtrEnablePreLocationTag  1401
\glsxtrenablerecordcount  1402
\glsxtrendfor  1403
\glsxtrentryfmt  1404
\GlsXtrExpandedFmt  1405
\glsxtrfielddolistloop  1406
\glsxtrfieldforlistloop  1407
\glsxtrfieldformatcsvlist  1408
\glsxtrfieldformatlist  1409
\glsxtrfieldifinlist  1410
\glsxtrfieldlistadd  1411
\glsxtrfieldlisteadd  1412
\glsxtrfieldlistgadd  1413
\glsxtrfieldlistxadd  1414
\glsxtrfieldtitlecasecs  1415
\glsxtrfieldxifinlist  1416
\glsxtrfmt  1417
\glsxtrfmt*  1418
\GlsXtrFmtDefaultOptions  1419
\glsxtrfmtdisplay  1420
\glsxtrfmtexternalnameref  1421
\GlsXtrFmtField  1422
\glsxtrfmtinternalnameref  1423
\glsxtrfootnotedescname  1424
\glsxtrfootnotedescsort  1425
\glsxtrfootnotename  1426
\glsxtrforcsvfield  1427
\GlsXtrForeignText  1428
\GlsXtrForeignTextField  1429
\GlsXtrFormatLocationList  1430
\GlsXtrForUnsetBufferedList  1431
\glsxtrfractionrules  1432
\GLSxtrfull  1433
\Glsxtrfull  1434
\glsxtrfull  1435
\Glsxtrfullformat  1436
\glsxtrfullformat  1437
\GLSxtrfullpl  1438
\Glsxtrfullpl  1439
\glsxtrfullpl  1440
\Glsxtrfullplformat  1441
\glsxtrfullplformat  1442
\glsxtrfullsep  1443
\glsxtrGeneralLatinIIIrules  1444
\glsxtrGeneralLatinIIrules  1445
\glsxtrGeneralLatinIrules  1446
\glsxtrGeneralLatinIVrules  1447
\glsxtrGeneralLatinVIIIrules  1448
\glsxtrGeneralLatinVIIrules  1449
\glsxtrGeneralLatinVIrules  1450
\glsxtrGeneralLatinVrules  1451
\glsxtrgeneralpuncIIrules  1452
\glsxtrgeneralpuncIrules  1453
\glsxtrgeneralpuncrules  1454
\glsxtrglossentry  1455
\glsxtrglossentryother  1456
\glsxtrgroupfield  1457
\GLSXTRhiername  1458
\GLSxtrhiername  1459
\GlsXtrhiername  1460
\Glsxtrhiername  1461
\glsxtrhiername  1462
\glsxtrhiernamesep  1463
\glsxtrhyphenrules  1464
\glsxtrhyphensuffix  1465
\glsxtridentifyglslike  1466
\glsxtrifcounttrigger  1467
\glsxtrifcustomdiscardperiod  1468
\GlsXtrIfFieldCmpNum  1469
\GlsXtrIfFieldEqNum  1470
\GlsXtrIfFieldEqStr  1471
\GlsXtrIfFieldEqXpStr  1472
\GlsXtrIfFieldNonZero  1473
\GlsXtrIfFieldUndef  1474
\GlsXtrIfFieldValueInCsvList  1475
\glsxtrifhasfield  1476
\glsxtrifhasfield*  1477
\GlsXtrIfHasNonZeroChildCount  1478
\glsxtrifinlabelprefixlist  1479
\glsxtrifkeydefined  1480
\glsxtriflabelinlist  1481
\GlsXtrIfLinkCounterDef  1482
\glsxtrifmulti  1483
\glsxtrifrecordtrigger  1484
\GlsXtrIfUnusedOrUndefined  1485
\GlsXtrIfValueInFieldCsvList  1486
\glsxtrifwasfirstuse  1487
\GlsXtrIfXpFieldEqXpStr  1488
\glsxtrinclinkcounter  1489
\glsxtrindexaliased  1490
\GlsXtrIndexCounterLink  1491
\glsxtrindexseealso  1492
\glsxtrinitwrgloss  1493
\Glsxtrinlinefullformat  1494
\glsxtrinlinefullformat  1495
\Glsxtrinlinefullplformat  1496
\glsxtrinlinefullplformat  1497
\glsxtrinsertinsidetrue  1498
\glsxtrLatinA  1499
\glsxtrLatinAA  1500
\glsxtrLatinAELigature  1501
\glsxtrLatinE  1502
\glsxtrLatinEszettSs  1503
\glsxtrLatinEszettSz  1504
\glsxtrLatinEth  1505
\glsxtrLatinH  1506
\glsxtrLatinI  1507
\glsxtrLatinInsularG  1508
\glsxtrLatinK  1509
\glsxtrLatinL  1510
\glsxtrLatinLslash  1511
\glsxtrLatinM  1512
\glsxtrLatinN  1513
\glsxtrLatinO  1514
\glsxtrLatinOELigature  1515
\glsxtrLatinOslash  1516
\glsxtrLatinP  1517
\glsxtrLatinS  1518
\glsxtrLatinSchwa  1519
\glsxtrLatinT  1520
\glsxtrLatinThorn  1521
\glsxtrLatinWynn  1522
\glsxtrLatinX  1523
\GlsXtrLetField  1524
\GlsXtrLetFieldToField  1525
\GlsXtrLinkCounterName  1526
\GlsXtrLinkCounterValue  1527
\GlsXtrLoadResources  1528
\glsxtrlocalsetgrouptitle  1529
\GlsXtrLocationField  1530
\GlsXtrLocationRecordCount  1531
\glsxtrlocrangefmt  1532
\Glsxtrlong  1533, 1534
\glsxtrlong  1535
\glsxtrlonghyphen  1536
\glsxtrlonghyphenshort  1537
\glsxtrlongnoshortdescname  1538
\glsxtrlongnoshortname  1539
\GLSxtrlongpl  1540
\Glsxtrlongpl  1541
\glsxtrlongpl  1542
\glsxtrlongshortdescname  1543
\glsxtrlongshortdescsort  1544
\glsxtrlongshortname  1545
\glsxtrlongshortuserdescname  1546
\glsxtrMathGreekIIrules  1547
\glsxtrMathGreekIrules  1548
\glsxtrMathItalicGreekIIrules  1549
\glsxtrMathItalicGreekIrules  1550
\glsxtrMathItalicLowerGreekIIrules  1551
\glsxtrMathItalicLowerGreekIrules  1552
\glsxtrMathItalicNabla  1553
\glsxtrMathItalicPartial  1554
\glsxtrMathItalicUpperGreekIIrules  1555
\glsxtrMathItalicUpperGreekIrules  1556
\glsxtrMathUpGreekIIrules  1557
\glsxtrMathUpGreekIrules  1558
\GlsXtrMglsOrGls  1559
\glsxtrmglsWarnAllSkipped  1560
\GLSxtrmultientryadjustedname  1561
\GlsXtrmultientryadjustedname  1562
\Glsxtrmultientryadjustedname  1563
\glsxtrmultientryadjustedname  1564
\GLSxtrmultientryadjustednamefmt  1565
\GlsXtrmultientryadjustednamefmt  1566
\Glsxtrmultientryadjustednamefmt  1567
\glsxtrmultientryadjustednamefmt  1568
\GLSxtrmultientryadjustednameother  1569
\GlsXtrmultientryadjustednameother  1570
\Glsxtrmultientryadjustednameother  1571
\glsxtrmultientryadjustednameother  1572
\glsxtrmultientryadjustednamepostsep  1573
\glsxtrmultientryadjustednamepresep  1574
\glsxtrmultientryadjustednamesep  1575
\glsxtrmultilastotherindex  1576
\glsxtrmultilist  1577
\glsxtrmultimain  1578
\glsxtrmultimainindex  1579
\glsxtrmultisupplocation  1580
\glsxtrmultitotalelements  1581
\glsxtrnameloclink  1582
\glsxtrnamereflink  1583
\glsxtrnewgls  1584
\glsxtrnewGLSlike  1585
\glsxtrnewglslike  1586
\glsxtrnewnumber  1587
\glsxtrnewrgls  1588
\glsxtrnewrGLSlike  1589
\glsxtrnewrglslike  1590
\glsxtrnewsymbol  1591
\GlsXtrNoGlsWarningAutoMake  1592
\GlsXtrNoGlsWarningBuildInfo  1593
\GlsXtrNoGlsWarningCheckFile  1594
\GlsXtrNoGlsWarningEmptyMain  1595
\GlsXtrNoGlsWarningEmptyNotMain  1596
\GlsXtrNoGlsWarningEmptyStart  1597
\GlsXtrNoGlsWarningHead  1598
\GlsXtrNoGlsWarningMisMatch  1599
\GlsXtrNoGlsWarningNoOut  1600
\GlsXtrNoGlsWarningTail  1601
\glsxtrnonprintablerules  1602
\glsxtrnopostpunc  1603
\glsxtronlydescname  1604
\glsxtronlydescsort  1605
\glsxtronlyname  1606
\glsxtronlysuffix  1607
\glsxtrorglong  1608
\glsxtrorgshort  1609
\GLSxtrp  1610
\Glsxtrp  1611
\glsxtrp  1612
\glsxtrpageref  1613
\glsxtrparen  1614
\glsxtrpdfentryfmt  1615
\Glsxtrpl  1616
\glsxtrpl  1617
\glsxtrpostdescription  1618
\glsxtrposthyphenlong  1619
\glsxtrposthyphenshort  1620
\glsxtrpostlink  1621
\glsxtrpostlinkAddDescOnFirstUse  1622
\glsxtrpostlinkAddSymbolDescOnFirstUse  1623
\glsxtrpostlinkAddSymbolOnFirstUse  1624
\glsxtrpostlinkendsentence  1625
\glsxtrpostlinkhook  1626
\glsxtrpostlongdescription  1627
\glsxtrpostnamehook  1628
\GlsXtrPostNewAbbreviation  1629
\glsxtrprelocation  1630
\glsxtrprependlabelprefix  1631
\GlsXtrProvideBibTeXFields  1632
\glsxtrprovidecommand  1633
\glsxtrprovidestoragekey  1634
\GlsXtrRecordCount  1635
\GlsXtrRecordCounter  1636
\glsxtrrecordtriggervalue  1637
\glsxtrregularfont  1638
\glsxtrresourcefile  1639
\glsxtrresourceinit  1640
\glsxtrrestorepostpunc  1641
\glsxtrRevertMarks  1642
\glsxtrRevertTocMarks  1643
\glsxtrsconlydescname  1644
\glsxtrsconlydescsort  1645
\glsxtrsconlyname  1646
\glsxtrsconlysuffix  1647
\glsxtrscsuffix  1648
\glsxtrscusersuffix  1649
\glsxtrseealsolabels  1650
\glsxtrseelist  1651
\GlsXtrSetActualChar  1652
\glsxtrsetaliasnoindex  1653
\GlsXtrSetAltModifier  1654
\glsxtrsetcategory  1655
\glsxtrsetcategoryforall  1656
\GlsXtrSetDefaultGlsOpts  1657
\GlsXtrSetEncapChar  1658
\GlsXtrSetEscChar  1659
\GlsXtrSetField  1660
\glsxtrsetfieldifexists  1661
\glsxtrsetglossarylabel  1662
\glsxtrsetgrouptitle  1663
\GlsXtrSetLevelChar  1664
\glsxtrsetpopts  1665
\GlsXtrSetRecordCountAttribute  1666
\glsxtrSetWidest  1667
\glsxtrSetWidestFallback  1668
\Glsxtrshort  1669, 1670
\glsxtrshort  1671
\glsxtrshortdescname  1672
\glsxtrshorthyphenlong  1673
\glsxtrshortlongdescname  1674
\glsxtrshortlongname  1675, 1676
\glsxtrshortlonguserdescname  1677
\glsxtrshortnolongname  1678
\GLSxtrshortpl  1679
\Glsxtrshortpl  1680
\glsxtrshortpl  1681
\glsxtrsmsuffix  1682
\glsxtrspacerules  1683
\GlsXtrStandaloneEntryName  1684
\GlsXtrStandaloneEntryOther  1685
\GlsXtrStandaloneGlossaryType  1686
\GlsXtrStartUnsetBuffering  1687
\GlsXtrStopUnsetBuffering  1688
\glsxtrSubScriptDigitrules  1689
\Glsxtrsubsequentfmt  1690
\glsxtrsubsequentfmt  1691
\Glsxtrsubsequentplfmt  1692
\glsxtrsubsequentplfmt  1693
\glsxtrSuperScriptDigitrules  1694
\glsxtrtagfont  1695
\GlsXtrTheLinkCounter  1696
\GlsXtrTotalRecordCount  1697
\glsxtrunsrtdo  1698
\GlsXtrUseAbbrStyleFmts  1699
\GlsXtrUseAbbrStyleSetup  1700
\glsxtrusealias  1701
\GLSxtrusefield  1702
\Glsxtrusefield  1703
\glsxtrusefield  1704
\glsxtruserfield  1705
\glsxtruserparen  1706
\glsxtrusersuffix  1707, 1708
\glsxtrusesee  1709
\glsxtruseseealso  1710
\glsxtruseseeformat  1711, 1712
\GlsXtrWarnDeprecatedAbbrStyle  1713
\GlsXtrWarning  1714
\glsxtrword  1715
\glsxtrwordsep  1716
\glsxtrwrglossmark  1717

H hyperref package  1718, 1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728, 1729, 1730, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, 1741, 1742, 1743

I \ifmglsused  1744
inputenc package  1745

L link-text  1746, 1747, 1748, 1749, 1750, 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, 1760, 1761, 1762, 1763, 1764, 1765
location list  1766, 1767, 1768, 1769, 1770
\longnewglossaryentry  1771

M makeglossaries  1772, 1773, 1774, 1775, 1776
\makeglossaries  1777
makeglossaries-lite  1778, 1779
makeglossaries-lite  1780, 1781
makeidx package  1782
makeindex  1783, 1784, 1785, 1786, 1787, 1788, 1789, 1790, 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1800, 1801, 1802, 1803, 1804, 1805, 1806, 1807
makeindex  1808, 1809, 1810, 1811, 1812
memoir class  1813, 1814
mfirstuc package  1815, 1816, 1817
\MGLS  1818
\MGls  1819
\Mgls  1820
\mgls  1821
\mglscurrentcategory  1822
\mglscurrentlabel  1823
\mglscurrentlist  1824
\mglscurrentmainlabel  1825
\mglscurrentmultilabel  1826
\mglscurrentoptions  1827
\mglscurrentprefix  1828
\mglscurrentsuffix  1829
\mglscustompostlinkhook  1830
\mglsdefcategoryprefix  1831
\mglsdefcategorysuffix  1832
\mglselementindex  1833
\mglselementposthook  1834
\mglselementprehook  1835
\mglselementreset  1836
\mglselementunset  1837
\mglsfield  1838
\mglsforelements  1839
\mglsforotherelements  1840
\Mglsfull  1841
\mglsfull  1842
\mglshascategoryprefix  1843
\mglshascategorysuffix  1844
\mglsiflast  1845
\mglsiflastelementcapscase  1846
\mglsiflastelementskipped  1847
\mglsiflastelementwasfirstuse  1848
\mglsiflastelementwasplural  1849
\mglsiflastmaincapscase  1850
\mglsiflastmainskipped  1851
\mglsiflastmainwasfirstuse  1852
\mglsiflastmainwasplural  1853
\mglsisfirstuse  1854
\mglslastcategory  1855
\mglslastelementlabel  1856
\mglslastelementpostlinkhook  1857
\mglslastmainlabel  1858
\mglslastmainpostlinkhook  1859
\mglslastmultilabel  1860
\mglslocalreset  1861
\mglslocalunset  1862
\mglslocalunsetothers  1863
\Mglslong  1864
\mglslong  1865
\MGLSmainpl  1866
\MGlsmainpl  1867
\Mglsmainpl  1868
\mglsmainpl  1869
\MGlsname  1870
\Mglsname  1871
\mglsname  1872
\MGLSpl  1873
\MGlspl  1874
\Mglspl  1875
\mglspl  1876
\mglsprefix  1877
\mglsreset  1878
\mglsresetall  1879
\mglsseefirstitem  1880
\mglsseeitem  1881
\mglsSetMain  1882
\mglsSetOptions  1883, 1884
\Mglsshort  1885
\mglsshort  1886
\mglssuffix  1887
\MGlssymbol  1888
\Mglssymbol  1889
\mglssymbol  1890
\mglsunset  1891
\mglsunsetall  1892
\mglsunsetothers  1893
\mglsusecategoryprefix  1894
\mglsusecategorysuffix  1895
\MGlsusefield  1896
\Mglsusefield  1897
\mglsusefield  1898
\mglswasfirstuse  1899
\MPGLS  1900
\MPGls  1901
\Mpgls  1902
\mpgls  1903
\MPGLSmainpl  1904
\MPGlsmainpl  1905
\Mpglsmainpl  1906
\mpglsmainpl  1907
\MPGLSpl  1908
\MPGlspl  1909
\mpglspl  1910
\mpglsWarning  1911
multicols package  1912
\multiglossaryentry  1913
\multiglossaryentryglobalfalse  1914
\multiglossaryentryglobaltrue  1915
\multiglossaryentrysetup  1916

N \newabbreviation  1917
\newabbreviationstyle  1918
\newacronym  1919
\newglossaryentry options
    access  1920
    alias  1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929
    category  1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937
    counter  1938
    description  1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964
    descriptionplural  1965, 1966, 1967, 1968, 1969, 1970
    first  1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984
    firstaccess  1985
    firstplural  1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995
    group  1996, 1997, 1998, 1999, 2000, 2001
    location  2002, 2003, 2004, 2005, 2006
    loclist  2007, 2008, 2009, 2010
    long  2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021
    longplural  2022, 2023, 2024, 2025, 2026, 2027
    name  2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047, 2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087
    nameshortaccess  2088, 2089
    parent  2090, 2091, 2092, 2093, 2094
    plural  2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107
    prefix  2108
    see  2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136
    seealso  2137, 2138, 2139, 2140, 2141, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149
    short  2150, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169
    shortaccess  2170, 2171, 2172, 2173, 2174
    shortplural  2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189
    shortpluralaccess  2190, 2191, 2192, 2193
    sort  2194, 2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216
    symbol  2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225
    symbolaccess  2226
    symbolplural  2227, 2228
    text  2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245
    textaccess  2246
    type  2247, 2248, 2249, 2250, 2251
    user1  2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260
    user2  2261, 2262
number list  2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297

P package options:
    abbreviations  2298, 2299, 2300, 2301, 2302
    accsupp  2303, 2304, 2305, 2306, 2307, 2308, 2309
    acronym  2310, 2311
    acronymlists  2312, 2313
    acronyms  2314
    automake  2315, 2316
    autoseeindex  2317, 2318
        false  2319, 2320
    colorlinks  2321
    counter
        chapter  2322
        equation  2323
        section  2324
        wrglossary  2325
    debug  2326
        all  2327, 2328
        showtargets  2329, 2330, 2331
        showwrgloss  2332, 2333, 2334
        true  2335
    docdef  2336, 2337, 2338, 2339, 2340
        atom  2341, 2342
        false  2343
        restricted  2344, 2345, 2346, 2347, 2348
        true  2349, 2350, 2351, 2352, 2353, 2354
    docdefs  2355, 2356, 2357
        true  2358
    entrycounter  2359, 2360
    equations  2361, 2362
        true  2363
    floats  2364
    hyperfirst
        false  2365
    index  2366, 2367, 2368
    indexcounter  2369, 2370, 2371, 2372
    indexcrossrefs  2373, 2374, 2375, 2376
        false  2377
    indexonlyfirst  2378, 2379, 2380, 2381
    makeindex  2382
    nogroupskip  2383, 2384, 2385, 2386, 2387
    nomain  2388
    nomissingglstext  2389
    nonumberlist  2390, 2391, 2392, 2393, 2394
    nopostdot  2395, 2396, 2397, 2398
        false  2399, 2400, 2401
        true  2402
    noredefwarn
        false  2403
        true  2404
    notree  2405
    numbers  2406, 2407, 2408
    postdot  2409, 2410, 2411
    postpunc  2412, 2413, 2414
        comma  2415
        dot  2416
        none  2417
    prefix  2418, 2419
    record  2420, 2421, 2422, 2423, 2424, 2425, 2426, 2427, 2428, 2429, 2430, 2431, 2432
        hybrid  2433, 2434, 2435, 2436, 2437, 2438, 2439
        nameref  2440, 2441, 2442, 2443, 2444
        off  2445, 2446
        only  2447, 2448, 2449, 2450, 2451, 2452, 2453, 2454, 2455, 2456, 2457, 2458, 2459
    savenumberlist  2460
    section
        chapter  2461
    seeautonumberlist  2462
    seenoindex  2463
        ignore  2464, 2465
        warn  2466
    shortcuts  2467, 2468, 2469
        abbr  2470, 2471
        abbreviations  2472, 2473, 2474, 2475
        ac  2476, 2477, 2478, 2479, 2480, 2481, 2482
        acro  2483, 2484
        acronyms  2485, 2486
        all  2487, 2488
        false  2489
        none  2490
        other  2491, 2492
        true  2493
    showtargets  2494
        annoteleft  2495
    sort
        none  2496, 2497
    stylemods  2498, 2499, 2500, 2501, 2502, 2503
        all  2504
        default  2505
    subentrycounter  2506, 2507
    symbols  2508, 2509, 2510
    toc
        false  2511
        true  2512
    translate
        babel  2513
        true  2514
    undefaction  2515, 2516
        error  2517, 2518, 2519
        warn  2520, 2521, 2522, 2523, 2524, 2525, 2526, 2527, 2528
    writeglslabelnames  2529
    writeglslabels  2530
    xindy  2531, 2532
page (counter)  2533, 2534, 2535, 2536, 2537, 2538
polyglossia package  2539, 2540
\pretoglossarypreamble  2541
\printabbreviations  2542
\printglossary options
    label  2543, 2544
    nogroupskip  2545
    numberedsection  2546
    prefix  2547
    style  2548
    target  2549, 2550
    targetnameprefix  2551
    title  2552, 2553
    toctitle  2554
    type  2555
\printnoidxglossary options
    sort  2556
\printunsrtabbreviations  2557
\printunsrtacronyms  2558
\printunsrtglossaries  2559
\printunsrtglossary  2560
\printunsrtglossary options
    groups  2561, 2562
    leveloffset  2563
\printunsrtglossary*  2564
\printunsrtglossaryentryprocesshook  2565
\printunsrtglossaryhandler  2566
\printunsrtglossarypredoglossary  2567
\printunsrtglossaryskipentry  2568
\printunsrtglossaryunit  2569
\printunsrtglossaryunitsetup  2570
\printunsrtindex  2571
\printunsrtnumbers  2572
\printunsrtsymbols  2573
\provideignoredglossary  2574
\providemultiglossaryentry  2575

R relsizes package  2576
\RestoreAcronyms  2577
\rGLS  2578
\rGls  2579
\rgls  2580
\rGLSformat  2581
\rGlsformat  2582
\rglsformat  2583
\rGLSpl  2584
\rGlspl  2585
\rglspl  2586
\rGLSplformat  2587
\rGlsplformat  2588
\rglsplformat  2589

S \seealsoname  2590
\setabbreviationstyle  2591
slantsc package  2592
soul package  2593, 2594
style package  2595
subentrycounter package  2596

T texindy  2597
textcase package  2598
tracklang package  2599, 2600, 2601, 2602, 2603, 2604, 2605, 2606, 2607, 2608
translator package  2609

U upgreek package  2610, 2611, 2612, 2613

W wrglossary (counter)  2614, 2615, 2616, 2617, 2618
\writemultiglossentry  2619

X xfor package  2620, 2621, 2622, 2623
\xglssetwidest  2624
\xglsupdatewidest  2625
\xGlsXtrIfValueInFieldCsvList  2626
\xGlsXtrSetField  2627
xindy  2628, 2629, 2630, 2631, 2632, 2633, 2634, 2635, 2636, 2637, 2638, 2639, 2640, 2641, 2642, 2643, 2644, 2645, 2646, 2647
xindy  2648
xkeyval package  2649

1.14.21 was originally intended as the last release of glossaries to incorporate new features, but a few new minor features slipped in with some bug fixes in v4.21.

2.1The descriptionplural key is a throwback to the base package’s original acronym mechanism before the introduction of the long and short keys, where the long form was stored in the description field and the short form was stored in the symbol field.

4.1For compatibility with earlier versions, \glsabbrvscfont is defined to \glsxtrscfont, which is defined to use \textsc. Direct use of \glsxtrscfont is now deprecated. Likewise for similar commands.

10.1Version 1.11 only allowed one use of \GlsXtrLoadResources per document.

10.2v1.08 assumed filename.tex but that’s potentially dangerous if, for example, filenamehappens to be the same as \jobname. The .glstex extension was enforced by version 1.11.

11.1Pre version 1.28 used \csedef.