Note that glossaries-extra provides an extra indexing option (bib2gls) which isn’t available with just the base glossaries package.
If you require multilingual support you must also install the relevant language module. Each language module is called glossaries-, where is the root language name. For example, glossaries-french or glossaries-german. If a language module is required, the glossaries package will automatically try to load it and will give a warning if the module isn’t found. See §1.5 for further details. If there isn’t any support available for your language, use the nolangwarn package option to suppress the warning and provide your own translations. (For example, use the title key in \printglossary
.)
1f631 If you’re freaking out at the size of this manual, start with “The glossaries package: a guide for beginners”. You should find it in the same directory as this document or try
texdoc glossariesbeginOnce you’ve got to grips with the basics, then come back to this manual to find out how to adjust the settings.
The glossaries bundle includes the following documentation:
- The glossaries package: a guide for beginners
- If you want some brief information and examples to get you going, start with the guide for beginners.
- User Manual for glossaries.sty (glossaries-user.pdf)
- This document is the main user guide for the glossaries package.
- Documented Code for glossaries (glossaries-code.pdf)
- Advanced users wishing to know more about the inner workings of all the packages provided in the glossaries bundle should read “Documented Code for glossaries v4.54”.
- CHANGES
- Change log.
- README.md
- Package summary.
- Depends.txt
- List of all packages unconditionally required by glossaries. Other unlisted packages may be required under certain circumstances. For help on installing packages see, for example, How do I update my TeX distribution? or (for Linux users) Updating TeX on Linux.
- •glossaries-extra and bib2gls: An Introductory Guide.
- •glossaries FAQ
- •glossaries gallery
- •a summary of all glossary styles provided by glossaries and glossaries-extra
- •glossaries performance (comparing document build times for the different options provided by glossaries and glossaries-extra).
- •Using LaTeX to Write a PhD Thesis (chapter 6).
- •Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build
- •The glossaries-extra package
- •bib2gls
If an example shows the icon 📥🖹 then you can click on that icon to try downloading the example source code from a location relative to this document. You can also try using:
The glossaries package is provided to assist generating lists of terms, symbols or acronyms. For convenience, these lists are all referred to as glossaries in this manual. The terms, symbols and acronyms are collectively referred to as glossary entries.
The package has a certain amount of flexibility, allowing the user to customize the format of the glossary and define multiple glossaries. It also supports glossary styles that include an associated symbol (in addition to a name and description) for each glossary entry.
There is provision for loading a database of glossary entries. Only those entries indexed in the document will be displayed in the glossary. (Unless you use Option 5, which doesn’t use any indexing but will instead list all defined entries in order of definition.)
It’s not necessary to actually have a glossary in the document. You may be interested in using this package just as means to consistently format certain types of terms, such as acronyms, or you may prefer to have descriptions scattered about the document and be able to easily link to the relevant description (Option 6).
Note the difference in the way the abbreviation (HTML) and symbol (\(\pi \)) are defined in the two above examples. The abbreviations, postdot and stylemods options are specific to glossaries-extra. Other options are passed to the base glossaries package.
One of the strengths of the glossaries package is its flexibility, however the drawback of this is the necessity of having a large manual that covers all the various settings. If you are daunted by the size of the manual, try starting off with the much shorter guide for beginners.
This document uses the glossaries-extra package with bib2gls (Option 4). For example, when viewing the PDF version of this document in a hyperlinked-enabled PDF viewer (such as Adobe Reader or Okular) if you click on the word “indexing” you’ll be taken to the entry in the main glossary where there’s a brief description of the term. This is the way the glossaries mechanism works. An indexing application (bib2gls in this case) is used to generate the sorted list of terms. The indexing applications are CLI tools, which means they can be run directly from a command prompt or terminal, or can be integrated into some text editors, or you can use a build tool such as arara to run them.
In addition to standard glossaries, this document has “standalone” definitions (Option 6). For example, if you click on the command
Neither of the above two examples require an indexing application. The first is just using the glossaries package for consistent formatting, and there is no list. The second has lists but they are unsorted (see Option 5).
The remainder of this introductory section covers the following:
In addition to the examples provided in this document, there are some sample documents provided with the glossaries package. They are described in §18.
The glossaries package comes with a number of sample documents that illustrate the various functions. These are listed in §18.
The following rollback releases are available:
If you rollback using latexrelease to an earlier date, then you will need to specify v4.46 for glossaries as there are no earlier rollback versions available. You may want to consider using one of the historic TeX Live Docker images instead. See, for example, Legacy Documents and TeX Live Docker Images.
If you use hyperref and glossaries, you must load hyperref first (although, in general, hyperref should be loaded after other packages).
Occasionally you may find that certain packages need to be loaded after packages that are required by glossaries but need to also be loaded before glossaries. For example, a package might need to be loaded after amsgen but before hyperref (which needs to be loaded before glossaries). In which case, load the required package first (for example, amsgen), then , and finally load glossaries.
Some packages don’t work with some glossary styles. For example, classicthesis doesn’t work with the styles that use the description environment, such as the list style. Since this is the default style, the glossaries package checks for classicthesis and will change the default to the index style if it has been loaded.
Some packages conflict with a package that’s required by a glossary style style package. For example, xtab conflicts with supertabular, which is required by glossary-super. In this case, ensure the problematic glossary style package isn’t loaded. For example, use the nosuper option and (with glossaries-extra) don’t use stylemods=super or stylemods=all. The glossaries package now (v4.50+) checks for xtab and will automatically implement nosuper if it has been loaded.
The language-support is implemented using tracklang. This needs to know the document languages that have to be supported. It currently (version 1.6 at the time of writing) can’t detect the use of
The tracklang package is also able to pick up languages passed as package options to babel or translator, provided they were loaded before tracklang. For example,
In the event that tracklang can’t pick up the required languages, it’s also possible to identify them with the languages option. For example:
The basic idea behind the glossaries package is that you first define your entries (terms, symbols or acronyms). Then you can reference these within your document (analogous to
An overview of Options 1–5 is given in Table 1.1. Option 6 is omitted from the table as it doesn’t produce a list. For a more detailed comparison of the various methods, see the glossaries performance page. If, for some reason, you want to know what indexing option is in effect, you can test the value of:
Strictly speaking, Options 5 and 6 aren’t actually indexing options as no indexing is performed. In the case of Option 5, all defined entries are listed in order of definition. In the case of Option 6, the entry hypertargets and descriptions are manually inserted at appropriate points in the document. These two options are included here for completeness and for comparison with the actual indexing options.
This option isn’t generally recommended for reasons given below. It’s best used with sort=use (order of use) or sort=def (order of definition).
This option doesn’t require an external indexing application but, with the default alphabetic sorting, it’s very slow with severe limitations. If you want a sorted list, it doesn’t work well for extended Latin alphabets or non-Latin alphabets. However, if you use the sanitizesort=false package option (the default for Option 1) then the standard LaTeX accent commands will be ignored, so if an entry’s name is set to
If you have any other kinds of commands that don’t expand to ASCII characters, such as
This option works best with the sort=def or sort=use setting. For any other setting, be prepared for a long document build time, especially if you have a lot of entries defined. This option is intended as a last resort for alphabetical sorting. This option allows a mixture of sort methods. (For example, sorting by word order for one glossary and order of use for another.) This option is not suitable for hierarchical glossaries and does not form ranges in the location lists. If you really can’t use an indexing application consider using Option 5 instead.
Summary:
This option uses a CLI application called makeindex to sort the entries. This application comes with all modern TeX distributions, but it’s hard-coded for the non-extended Latin alphabet. It can’t correctly sort accent commands (such as
This option works best if you want to sort entries according to the English alphabet and you don’t want to install Perl or Java. This method can also work with the restricted shell escape since makeindex is considered a trusted application, which means you should be able to use the automake=immediate or automake=true package option provided the shell escape hasn’t been completely disabled.
This method can form ranges in the number list but only accepts limited number formats:
This option does not allow a mixture of sort methods. All glossaries must be sorted according to the same method: word/letter ordering or order of use or order of definition. If you need word ordering for one glossary and letter ordering for another you’ll have to explicitly call makeindex for each glossary type.
Summary:
If you have used package options such as symbols there will also be other sets of files corresponding to the extra glossaries that were created by those options.
If you don’t know how to use the command prompt, then you can probably access makeindex via your text editor, but each editor has a different method of doing this. See Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build for some examples.
Alternatively, run makeindex indirectly via the makeglossaries script:
The simplest approach is to use arara and add the following comment lines to the start of your document:
The default sort is word order (“sea lion” comes before “seal”). If you want letter ordering you need to add the -l switch:
This option uses a CLI application called xindy to sort the entries. This application is more flexible than makeindex and is able to sort extended Latin alphabets or non-Latin alphabets, however it does still have some limitations.
The xindy application comes with both TeX Live and MikTeX, but since xindy is a Perl script, you will also need to install Perl, if you don’t already have it. In a similar way to Option 2, this option involves making LaTeX write the glossary information to a temporary file which xindy reads. Then xindy writes a new file containing the code to typeset the glossary. Then
This is the best option with just the base glossaries package if you want to sort according to a language other than English or if you want non-standard location lists, but it can require some setting up (see §14). There are some problems with certain sort values:
All glossaries must be sorted according to the same method (word/letter ordering, order of use, or order of definition).
Summary:
If you have used package options such as symbols there will also be other sets of files corresponding to the extra glossaries that were created by those options.
It’s much simpler to use makeglossaries instead:
There’s no benefit in using makeglossaries-lite with xindy. (Remember that xindy is a Perl script so if you can use xindy then you can also use makeglossaries, and if you don’t want to use makeglossaries because you don’t want to install Perl, then you can’t use xindy either.) If you don’t know how to use the command prompt, then you can probably access xindy or makeglossaries via your text editor, but each editor has a different method of doing this. See Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build for some examples.
Again, a convenient method is to use arara and add the follow comment lines to the start of your document:
The default sort is word order (“sea lion” comes before “seal”). If you want letter ordering you need to add the order=letter package option:
All entries must be provided in one or more bib files. (See the bib2gls user manual for the required format.) In this example, the terms “parrot”, “duck”, “puffin” and “penguin” are defined using
The glossaries-extra package needs to be loaded with the record package option:
Each resource set is loaded with
If you want to ensure that all entries are selected, even if they haven’t been referenced in the document, then add the option selection=all. (There are also ways of filtering the selection or you can even have a random selection by shuffling and truncating the list. See the bib2gls user manual for further details.)
The glossary is displayed using:
Unlike Options 2 and 3, this method doesn’t create a file containing the typeset glossary but simply determines which entries are needed for the document, their associated locations and (if required) their associated letter group. This option allows a mixture of sort methods. For example, sorting by word order for one glossary and order of use for another or even sorting one block of the glossary differently to another block in the same glossary. See bib2gls gallery: sorting.
This method supports Unicode and uses the Common Locale Data Repository, which provides more extensive language support than xindy. (Except for Klingon, which is supported by xindy, but not by the CLDR.) The locations in the number list may be in any format. If bib2gls can deduce a numerical value it will attempt to form ranges otherwise it will simply list the locations.
Summary:
See glossaries-extra and bib2gls: An Introductory Guide or the bib2gls user manual for further details of this method, and also Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build.
The result is different from the previous examples. Now all entries are listed in the glossary, including “penguin” which hasn’t been referenced in the document, and the list is in the order that the entries were defined. There are no number lists.
The
The glossaries-extra package requires entries to be defined in the preamble by default. It’s possible to remove this restriction, but bear in mind that any entries defined after
The glossary is displayed using:
This method will display all defined entries, regardless of whether or not they have been used in the document. Note that this uses the same command for displaying the glossary as Option 4. This is because bib2gls takes advantage of this method by defining the wanted entries in the required order and setting the locations (and letter group information, if required). See the glossaries-extra manual for further details.
Therefore, the above example document has a glossary containing the entries: parrot, duck, puffin, penguin, \(\alpha \) and ARPANET (in that order). Note that the “penguin” entry has been included even though it wasn’t referenced in the document.
This just requires a single LaTeX call:
See the glossaries-extra documentation for further details of this method.
You can either define entries in the preamble (or in an external file loaded with
Or you can use bib2gls if you want to manage a large database of terms. For example:
In both cases, there’s no need to load all the glossary styles packages, as they’re not required, so I’ve used the nostyles package option to prevent them from being loaded.
In the first case, you just need to define the terms (preferably in the preamble or in a file that’s input in the preamble). No external tool is required. Just run LaTeX as normal. (Twice to ensure that the table of contents is up to date.)
In the second case, you need the record package option (as in Option 4) since bib2gls is needed to select the required entries, but you don’t need a sorted list:
Remember that for this second case you need to run bib2gls as per Option 4:
For both cases (with or without bib2gls), instead of listing all the entries using
(Instead of using
The symbol (if required) can be displayed with either
In normal document text,
The
If you want to test if the symbol field has been set, you need to use
In both of the above examples, the section titles start with a lowercase character (because the name value is all lowercase in entry definitions). You can apply automatic case change with the glossname category attribute. For example:
In the second example, you can instead use bib2gls to apply a case change. For example, to apply sentence case to the name field:
In the first example (without bib2gls) you can do this manually. For example:
Note that if you use the default save-locations=true with bib2gls, it’s possible to combine Options 4 and 6 to have both standalone definitions and an index. In this case, a glossary style is required. In the example below, I’ve use bookindex, which is provided in the glossary-bookindex package (bundled with glossaries-extra). I don’t need any of the other style packages, so I can still keep the nostyles option and just load glossary-bookindex:
The bookindex style doesn’t show the description, so only the name and location is displayed. Remember that the name has had a case change so it now starts with an initial capital. If you feel this is inappropriate for the index, you can adjust the bookindex style so that it uses the text field instead. For example:
Note that on the first LaTeX run none of the entries will be defined. Once they are defined, the page numbers may shift due to the increased amount of document text. You may therefore need to repeat the document build to ensure the page numbers are correct.
If there are extra terms that need to be included in the index that don’t have a description, you can define them with
In addition to the sample files described in §18, glossaries also provides some files containing lorum ipsum dummy entries. These are provided for testing purposes and are on TeX’s path (in tex/latex/glossaries/test-entries) so they can be included via
The sample file glossary-lipsum-examples.tex in the doc/latex/glossaries/samples directory uses all these files. See also glossaries gallery.
As from version 1.17, the glossaries package can be used with xindy as well as makeindex. If you are writing in a language that uses an extended Latin alphabet or non-Latin alphabet it’s best to use Option 3 (xindy) or Option 4 (bib2gls) as makeindex (Option 2) is hard-coded for the non-extended Latin alphabet and Option 1 can only perform limited ASCII comparisons.
This means that with Options 3 or 4 you are not restricted to the A, …, Z letter groups. If you want to use xindy, remember to use the xindy package option. For example:
If you want to use bib2gls, you need to use the record option with glossaries-extra and supply the definitions in bib files. (See the bib2gls user manual for further details.)
With old versions of mfirstuc (pre v2.08), if you use a UTF-8 character at the start of an entry name, you must place it in a group, or it will cause a problem for sentence case commands (e.g.
If you are using xindy or bib2gls, the application needs to know the encoding of the tex file. This information is added to the aux file and can be picked up by makeglossaries and bib2gls. If you use xindy explicitly instead of via
If you have the double-quote character (
In general, it’s best not to use babel’s shorthands in entry definitions. For example:
The fixed names are produced using the commands listed in Table 1.2. If you aren’t using a language package such as babel or polyglossia that uses caption hooks, you can just redefine these commands as appropriate. If you are using babel or polyglossia, you need to use their caption hooks to change the defaults. See changing the words babel uses or read the babel or polyglossia documentation. If you have loaded babel, then glossaries will attempt to load translator, unless you have used the notranslate, translate=false or translate=babel package options. If the translator package is loaded, the translations are provided by dictionary files (for example, glossaries-dictionary-English.dict). See the translator package for advice on changing translations provided by translator dictionaries. If you can’t work out how to modify these dictionary definitions, try switching to babel’s interface using translate=babel:
As from version 4.12, multilingual support is provided by separate language modules that need to be installed in addition to installing the glossaries package. You only need to install the modules for the languages that you require. If the language module has an unmaintained status, you can volunteer to take over the maintenance by contacting me at http://www.dickimaw-books.com/contact.html. The translator dictionary files for glossaries are now provided by the appropriate language module. For further details about information specific to a given language, please see the documentation for that language module.
Examples of use:
Due to the varied nature of glossaries, it’s likely that the predefined translations may not be appropriate. If you are using the babel package and the glossaries package option translate=babel, you need to be familiar with the advice given in changing the words babel uses. If you are using the translator package, then you can provide your own dictionary with the necessary modifications (using
Your custom dictionary doesn’t have to be just a translation from English to another language. You may prefer to have a dictionary for a particular type of document. For example, suppose your institution’s in-house reports have to have the glossary labelled as “Nomenclature” and the location list should be labelled “Location”, then you can create a file called, say, myinstitute-glossaries-dictionary-English.dict that contains the following:
If you are using babel and don’t want to use the translator interface, you can use the package option translate=babel. For example:
Note that xindy and bib2gls provide much better multi-lingual support than makeindex, so I recommend that you use Options 2 or 3 if you have glossary entries that contain non-Latin characters. See §14 for further details on xindy, and see the bib2gls user manual for further details of that application.
The glossaries package now uses the tracklang package to determine which language modules need to be loaded. If you want to create a new language module, you should first read the tracklang documentation.
To create a new language module, you need to at least create two files called: glossaries-.ldf and glossaries-dictionary-.dict where is the root language name (for example,
Here’s an example of glossaries-dictionary-English.dict:
Here’s an example of glossaries-english.ldf:
The suffixes used to generate the plural forms when the plural hasn’t been specified are given by
If you want to add a regional variation, create a file called glossaries--.ldf, where is the ISO language code and is the ISO country code. For example, glossaries-en-GB.ldf. This file can load the root language file and make the appropriate changes, for example:
If the translations includes non-Latin characters, it’s a good idea to provide code that’s independent of the input encoding. Remember that while some users may use UTF-8 (and it’s now the default encoding with modern LaTeX kernels), others may use Latin-1 or any other supported encoding, but while users won’t appreciate you enforcing your preference on them, it’s useful to provide a UTF-8 version.
The glossaries-irish.ldf file provides this as follows:
There are now two extra files: glossaries-irish-noenc.ldf (no encoding information) and glossaries-irish-utf8.ldf (UTF-8).
These both define
If this section seriously confuses you, and you can’t work out how to run external tools like makeglossaries or makeindex, you can try using the automake package option, described in §2.5, but you will need TeX’s shell escape enabled. See also Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build.
In order to generate a sorted glossary with compact number lists, it is necessary to use an external indexing application as an intermediate step (unless you have chosen Option 1, which uses TeX to do the sorting or Option 5, which doesn’t perform any sorting). It is this application that creates the file containing the code required to typeset the glossary. If this step is omitted, the glossaries will not appear in your document. The two indexing applications that are most commonly used with LaTeX are makeindex and xindy. As from version 1.17, the glossaries package can be used with either of these applications. Previous versions were designed to be used with makeindex only. With the glossaries-extra package, you can also use bib2gls as the indexing application. (See the glossaries-extra and bib2gls user manuals for further details.) Note that xindy and bib2gls have much better multi-lingual support than makeindex, so xindy or bib2gls are recommended if you’re not writing in English. Commands that only have an effect when xindy is used are described in §14.
The glossaries package comes with the Perl script makeglossaries which will run makeindex or xindy on all the indexing files using a customized style file (which is created by
The advantages of using makeglossaries:
As from version 4.16, the glossaries package also comes with a Lua script called makeglossaries-lite. This is a trimmed-down alternative to the makeglossaries Perl script. It doesn’t have some of the options that the Perl version has and it doesn’t attempt to diagnose any problems, but since modern TeX distributions come with LuaTeX (and therefore have a Lua interpreter) you don’t need to install anything else in order to use makeglossaries-lite so it’s an alternative to makeglossaries if you want to use Option 2 (makeindex).
If things go wrong and you can’t work out why your glossaries aren’t being generated correctly, you can use makeglossariesgui as a diagnostic tool. Once you’ve fixed the problem, you can then go back to using makeglossaries or makeglossaries-lite.
Whilst I strongly recommended that you use the makeglossaries Perl script or the makeglossaries-lite Lua script, it is possible to use the glossaries package without using those applications. However, note that some commands and package options have no effect if you explicitly run makeindex/xindy. These are listed in Table 1.3.
Below, references to makeglossaries can usually be substituted with makeglossaries-lite, except where noted otherwise.
If any of your entries use an entry that is not referenced outside the glossary (for example, the entry is only referenced in the description of another entry), you will need to do an additional makeglossaries, makeindex or xindy run, as appropriate. For example, suppose you have defined the following entries:
Likewise, an additional makeglossaries and LaTeX run may be required if the document pages shift with re-runs. For example, if the page numbering is not reset after the table of contents, the insertion of the table of contents on the second LaTeX run may push glossary entries across page boundaries, which means that the number lists in the glossary may need updating.
The examples in this document assume that you are accessing makeglossaries, xindy or makeindex via a terminal. Windows users can use the command prompt which is usually accessed via the Start➜All Programs menu or Start➜All Programs➜Accessories menu or Start➜Windows System.
Alternatively, your text editor may have the facility to create a function that will call the required application. See Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build.
If any problems occur, remember to check the transcript files (e.g. glg or alg) for messages.
The makeglossaries script picks up the relevant information from the auxiliary (aux) file and will either call xindy or makeindex, depending on the supplied information. Therefore, you only need to pass the document’s name without the extension to makeglossaries. For example, if your document is called myDoc.tex, type the following in your terminal:
Windows users: TeX Live on Windows has its own internal Perl interpreter and provides makeglossaries.exe as a convenient wrapper for the makeglossaries Perl script. MikTeX also provides a wrapper makeglossaries.exe but doesn’t provide a Perl interpreter (as far as I know), which is still required even if you run MikTeX’s makeglossaries.exe, so with MikTeX you’ll need to install Perl. There’s more information about this at MikTeX and Perl scripts (and one Python script).
Some of the options are only applicable to makeindex and some are only applicable to xindy.
The multiple encap warning is where different location encap values (location formats) are used on the same location for the same entry. For example:
There’s no similar check for xindy as xindy won’t produce any warning and will simply discard duplicates.
If you want to use an application that is capable of reading makeindex files (including support for makeindex style files via -s), then you can use -m to specify the alternative application to use instead of makeindex. Note that both xindex and texindy can read makeindex files using the default makeindex syntax but, as of the time of writing this, they don’t support makeindex style files.
The following switches may be used to override settings written to the aux file.
The Lua alternative to the makeglossaries Perl script requires a Lua interpreter, which should already be available if you have a modern TeX distribution that includes LuaTeX. Lua is a light-weight, cross-platform scripting language, but because it’s light-weight it doesn’t have the full-functionality of heavy-weight scripting languages, such as Perl. The makeglossaries-lite script is therefore limited by this and some of the options available to the makeglossaries Perl script aren’t available here. (In particular the -d option.) Whilst it may be possible to implement those features by requiring Lua packages, this would defeat the purpose of providing this script for those don’t want the inconvenience of learning how to install interpreters or their associated packages.
The makeglossaries-lite script can be invoked in the same way as makeglossaries. For example, if your document is called myDoc.tex, then do
Some of the options are only applicable to makeindex and some are only applicable to xindy.
The following switches may be used to override settings written to the aux file.
xindy comes with TeX Live. It has also been added to MikTeX, but if you don’t have it installed, see How to use Xindy with MikTeX.
If you want to use xindy to process the glossary files, you must make sure you have used the xindy package option:
To run xindy type the following in your terminal (all on one line):
For example, if your document is called myDoc.tex and you are using UTF-8 encoding in English, then type the following in your terminal:
Note that this just creates the
Note that if you use makeglossaries instead, you can replace all those calls to xindy with just one call to makeglossaries:
If you want to use makeindex explicitly, you must make sure that you haven’t used the xindy package option or the glossary entries will be written in the wrong format. To run makeindex, type the following in your terminal:
For example, if your document is called myDoc.tex, then type the following at the terminal:
Note that if you use makeglossaries instead, you can replace all those calls to makeindex with just one call to makeglossaries:
The information needed to determine whether to use xindy, makeindex or bib2gls is stored in the aux file. This information can be gathered by a front-end, editor or script to make the glossaries where appropriate. This section describes how the information is stored in the auxiliary file.
The file extension of the indexing files used for each defined glossary (not including any ignored glossaries) are given by:
The indexing application’s style file is specified by:
For example, with arara you can easily determine whether to run makeglossaries:
Word or letter ordering is specified by:
If xindy should be used, the language for each glossary is specified by:
The codepage (file encoding) for all glossaries is specified by:
If Option 1 has been used, the aux file will contain
If you need to gather labels for auto-completion, the writeglslabels package option will create a file containing the labels of all defined entries (regardless of whether or not the entry has been used in the document). As from v4.47, there is a similar option writeglslabelnames that writes both the label and name (separated by a tab).
For example, with arara you can easily determine whether or not to run bib2gls:
Remember that with bib2gls, the glossary entries will never be defined on the first LaTeX call (because their definitions are contained in the glstex file created by bib2gls). You can also pick up labels from the records in aux file, which will be in the form:
This section describes the available glossaries package options. You may omit the
The debug=showtargets option will additionally use:
The font used by both
The purpose of the debug mode can be demonstrated with the following example document:
Without
This situation doesn’t cause any errors or warnings as it’s perfectly legitimate for a user to want to use glossaries to format the entries (for example, to show a different form on first use) but not display any glossaries (or the user may prefer to use the unsorted Options 5 or 6). It’s also possible that the user may want to temporarily comment out
Therefore
The debug mode, enabled with the debug option,
With all options except Options 1 and 414, another write register is required if the glsdefs file is needed to save document definitions. With both Options 1 and 4, no write registers are required (document definitions aren’t permitted and indexing information is written to the aux file). If you really need document definitions but you want to minimise the number of write registers then consider using docdef=restricted with glossaries-extra.
There are only a limited number of write registers, and if you have a large number of glossaries or if you are using a class or other packages that create a lot of external files, you may exceed the maximum number of available registers. If savewrites is set, the glossary information will be stored in token registers until the end of the document when they will be written to the external files.
By way of comparison, sample-multi2.tex provided with bib2gls has a total of 15 glossaries. With Options 2 or 3, this would require 46 associated files and 16 write registers. (These figures don’t include standard files and registers provided by the kernel or hyperref, such as aux and out.) With bib2gls, no write registers are required and there are only 10 associated files for that particular document (9 resource files and 1 transcript file).
See §1.5.1 for further details.
Note that nohypertypes overrides hyperfirst=true. This option only affects commands that check the first use flag, such as the
The hyperfirst setting applies to all glossary types (unless identified by nohypertypes or defined with
It may be that you only want to suppress hyperlinks for just the acronyms (where the first use explains the meaning of the acronym) but not for ordinary glossary entries (where the first use is identical to subsequent use). In this case, you can use hyperfirst=false and apply
Alternatively you can redefine the hook
Note that this hook isn’t used by the commands that don’t check the first use flag, such as
Only available with glossaries-extra, the value for this option may be one of:
Only available with glossaries-extra, this option governs the use of
This option indicates the sectional unit to use for the glossary. The value should be the control sequence name without the leading backslash or following star (for example, just
The default behaviour is for the glossary heading to use
Example:
The start of each glossary adds information to the page header via
You can test if this option has been set using:
If you use this option (and are using a glossary style that supports this option) then you can reference the entry number within the document using:
The glossaryentry counter can be reset back to zero with:
The value of the glossaryentry counter can be displayed with:
If you want to test whether or not this option is currently enabled, use the conditional:
If you want the counter reset at the start of each glossary, you can modify the glossary preamble (
As with the entrycounter option, you can reference the number within the document using
The glossarysubentry counter can be reset back to zero with:
The glossarysubentry counter can be simultaneously incremented and labelled (using
The value of the glossarysubentry counter can be displayed with:
If you want to test whether or not this option is currently enabled, use the conditional:
This setting may only be used for styles that are defined when the glossaries package is loaded. This will usually be the styles in the packages glossary-list, glossary-long, glossary-super or glossary-tree, unless they have been suppressed through options such as nostyles. Style packages can also be loaded by the stylemods option provided by glossaries-extra.
Alternatively, you can set the style later using:
Remember that number list includes any cross-references, so suppressing the number list will also hide the cross-references (in which case, you may want to use seeautonumberlist).
This option will redefine:
The default setting is nopostdot=false for the base glossaries package and nopostdot=true for glossaries-extra.
This option is only relevant for glossary styles that use the conditional:
Loads the glossaries-extra-stylemods package, which patches the predefined glossary styles. The argument is optional. If present, this will also load glossary- for each .sty in the comma-separated . See the glossaries-extra manual for further details.
This option may take one of the following values:
For example, if you want to temporarily comment out
Only applicable to makeindex and xindy. As from v4.50, the initial setting is now esclocations=false. Previously it was esclocations=true.
Both makeindex and xindy are fussy about the location syntax (makeindex more so than xindy) so, if esclocations=true, the glossaries package will try to ensure that special characters are escaped, which allows for the location to be substituted for a format that’s more acceptable to the indexing application. This requires a bit of trickery to circumvent the problem posed by TeX’s asynchronous output routine, which can go wrong and also adds to the complexity of the document build.
If you’re sure that your locations will always expand to an acceptable format (or you’re prepared to post-process the glossary file before passing it to the relevant indexing application) then use esclocations=false to avoid the complex escaping of location values. This is now the default.
If, however, your locations (for example,
This conditional can be switched on with:
If you are using makeindex and your location expands to content in the form
This isn’t an issue for Options 1 or 4 as the locations are written to the aux file and both methods use LaTeX syntax, so no conversion is required.
You can test if this setting is on using the conditional:
You can customise the default behaviour by redefining
For example, suppose you only want to index the first use for entries in the
With the glossaries-extra package it’s possible to only index first use for particular categories. For example, if you only want this enabled for abbreviations then you can set the indexonlyfirst attribute for the abbreviation and, if appropriate, acronym categories. (Instead of using the indexonlyfirst package option.) See the glossaries-extra manual for further details.
This option is only available with glossaries-extra. If true, this will automatically index (
This option is only available with glossaries-extra. The base glossaries package always implements autoseeindex=true.
If true, this makes the see and seealso keys automatically index the entry (with
This option is only available with glossaries-extra. See glossaries-extra manual for further details. A brief summary of available values:
This option is only available with glossaries-extra. If true, this option will cause the default location counter to automatically switch to equation when inside a numbered equation environment.
This option is only available with glossaries-extra. If true, this option will cause the default location counter to automatically switch to the corresponding counter when inside a float. (Remember that with floats it’s the
This option is only available with glossaries-extra. This valueless option is primarily intended for use with bib2gls and hyperref allowing the page location hyperlink target to be set to the relevant point within the page (rather than the top of the page). Unexpected results will occur with other indexing methods. See glossaries-extra manual for further details.
This section is mostly for Options 2 and 3. Only the sort and order options are applicable for Option 1.
The default for Options 2 and 3 is sanitizesort=true, and the default for Option 1 is sanitizesort=false.
Both sort=def and sort=use zero-pad the sort key to a six digit number using:
Note that the group styles (such as listgroup) are incompatible with the sort=use and sort=def options.
When the standard sort option is in use, you can hook into the sort mechanism by redefining:
The other arguments, glossary type and the entry label for the current entry. Note that will always be a control sequence, but will be in the form used in the first argument of
For Option 1, the sort option can be used in
For Options 2 or 3, I can set sort=standard (which is the default), and I can either define all my
The first method can be achieved as follows:
First, define two commands to set the person’s name:
Now the entries can be defined:
If you use Option 1, this setting will be used if you use sort=standard in the optional argument of
You may omit this package option if you are using Option 2 as this is the default. It’s available in case you need to override the effect of an earlier occurrence of xindy in the package option list.
This package option may additionally have a value that is a xindy. See §14 for further details on using xindy with the glossaries package.
You can test if this option has been set using the conditional:
The
The makeglossaries script has a set of mappings of known babel language names to xindy language names, but new babel dialect names may not be included. The makeglossaries-lite script doesn’t have this feature (but there’s no benefit in use makeglossaries-lite instead of makeglossaries when using xindy). The automake=option that calls xindy explicitly also doesn’t use any mapping.
However, even if the appropriate mapping is available,
For example:
If this option doesn’t seem to work, open the log file in your text editor and search for “
If you change the package option to:
If the document is compiled in unrestricted mode, the corresponding line in the log file should now be:
If you are using xindy, then automake=makegloss is a better option that this one. Either way, you will need Perl and the unrestricted mode, but with makeglossaries you get the benefit of the language mappings and diagnostics.
Naturally, if there’s a particular reason why the class or package insists on a specific indexing method, for example, it’s an editorial requirement, then you will need to abide by that decision.
This option may be passed in the standard document class option list or passed using
For example, suppose the class customclass.cls automatically loads glossaries and does
Note that restoring these commands doesn’t necessarily mean that they can be used. It just means that their normal behaviour given the current settings will apply. For example, if you use the record=only or record=nameref options with glossaries-extra then you can’t use
You may also use:
If you don’t use the
If you use Option 1, you need to use:
If you use Option 1, you need to use:
If you use Option 1, you need to use:
Since the index isn’t designed for terms with descriptions, you might also want to disable the hyperlinks for this glossary using the package option nohypertypes=index or the command
The example file sample-index.tex illustrates the use of the index package option.
If you are using Option 1, you need to use
If the acronym package option is used,
Make sure you have at least v1.42 of glossaries-extra if you use the acronym (or acronyms) package option with the extension package to avoid a bug that interferes with the abbreviation style.
This valueless option provided by glossaries-extra creates a new glossary type with the label
By default, if the list is empty when
If you have other lists of acronyms, you can specify them as a comma-separated list in the value of acronymlists. For example, if you use the acronym package option but you also want the
If the list is changed after
You can determine if a glossary has been identified as being a list of acronyms using:
The package options listed in this section were deprecated in version 4.02 (2013-12-05) and have now been removed. You will need to use rollback with them (see §1.1). These options started generating warnings in version 4.47 (2021-09-20) and as from version 4.50 will now generate an error unless you use rollback.
If you want to change the acronym style, use
Other available options that don’t fit any of the above categories are described below.
Only available with glossaries-extra, this option loads the glossaries-accsupp package, which needs to be loaded either before glossaries-extra or while glossaries-extra is loaded to ensure both packages are properly integrated.
Only available with glossaries-extra, this option loads the glossaries-prefix package.
This option may be used to suppress the boilerplate text generated by
The value may be either expanded or unexpanded and performs the same function as mfirstuc’s expanded and unexpanded package options. Note that there’s no value corresponding to mfirstuc’s other package option.
The default is mfirstuc=unexpanded to safeguard against glossary styles that convert the description to sentence case. With older versions of mfirstuc (pre v2.08), fragile commands in the description would not have been affected by the case change, but now, if the entire description is passed to
Compatibility mode for old documents created using version 2.07 or below. This option is now only available with rollback (see §1.1).
The redefinitions of these commands was removed in v4.10, but unfortunately it turned out that some packages had hacked the internal commands provided by glossaries and no longer worked when they were removed, so they were restored in v4.41 with this option to undo the effect with kernelglossredefs=true as the default. As from v4.50, the default is now kernelglossredefs=false.
The only glossary-related commands provided by the LaTeX kernel are
In general, if possible, it’s best to stick with just one package that provides a glossary mechanism. (The glossaries package does check for the doc package and patches
Some of the options described above may also be set after the glossaries package has been loaded using
In the preamble you need to indicate which method you want to use to generate the glossary (or glossaries). The available options with both glossaries and glossaries-extra are summarized in §1.3. This chapter documents Options 1, 2 and 3, which are provided by the base package. See the glossaries-extra and bib2gls manuals for the full documentation of the other options.
If you don’t need to display any glossaries, for example, if you are just using the glossaries package to enable consistent formatting, then skip ahead to §4.
The command
The command
The
The default name for the customised style file is given by
There is a hook near the end of
If you use the
Remember that if you switch to xindy, this will no longer be valid code.
You can suppress the creation of the customised xindy or makeindex style file using:
If you have a custom xdy file created when using glossaries version 2.07 (2010-0710) or below, you will need to use rollback and the compatible-2.07 package option with it. However, that is now so dated and the LaTeX kernel has changed significantly since that time that you may need to use a legacy distribution (see Legacy Documents and TeX Live Docker Images).
Each glossary entry is assigned a number list that lists all the locations in the document where that entry was used. By default, the location refers to the page number but this may be overridden using the counter package option. The default form of the location number assumes a full stop compositor (for example, 1.2), but if your location numbers use a different compositor (for example, 1-2) you need to set this using
An invalid page number will also cause xindy to fail with a “did not match any location-class” warning. This is also something that makeglossaries will check for and will provided diagnostic information, but it won’t attempt to make any correction.
If you use Option 3, you can have a different compositor for page numbers starting with an upper case alphabetical character using:
Acronyms are covered in §6 but they use the same underlying mechanism as all the other glossary entries, so it’s a good idea to read this chapter first. The keys provided for
All glossary entries must be defined before they are used, so it is better to define them in the document preamble to ensure this. In fact, some commands such as
Bear in mind that with docdef=restricted, the entries must be defined before any entries are used, including when they are displayed in the glossary (for example, with
Only those entries that are indexed in the document (using any of the commands described in §5.1, §10 or §11) will appear in the glossary. See §8 to find out how to display the glossary.
New glossary entries are defined using the command:
If you have a long description that needs to span multiple paragraphs, use the following instead:
There are also commands that will only define the entry if it hasn’t already been defined:
For all the above commands, the first argument, entry. This can’t contain any non-expandable or fragile commands. The reason for this restriction is that the label is used to construct internal commands that store the associated information (similarly to commands like
The second argument, description and either name or parent. The description is set in the third argument of
As is typical with
This key is automatically set by
You may prefer to use acronyms (§6) or the abbreviations or the category post-link hook (
Although it is possible to use first in the optional argument of
Although it is possible to use plural in the optional argument of
Although it is possible to use firstplural in the optional argument of
You can also override the sort key by redefining
Option 1 by default strips the standard LaTeX accents (that is, accents generated by core LaTeX commands) from the name key when it sets the sort key. So with Option 1:
With Options 2 and 3, the default value of sort will either be set to the name key (if sanitizesort=true) or it will set it to the expansion of the name key (if sanitizesort=false).
Take care if you use Option 1 and the name contains fragile commands. You will either need to explicitly set the sort key or use the sanitizesort=true package option (unless you use the def or use sort methods).
Six keys are provided for any additional information the user may want to specify. (For example, an associated dimension or an alternative plural or some other grammatical construct.) Alternatively, you can add new keys using
This key works by adding
With Option 1, this key saves the appropriate command in the prenumberlist internal field, which is used by
For example:
Note that while it’s possible to put the cross-reference in the description instead, for example:
The referenced entry should be supplied as the value to this key. If you want to override the “see” tag, you can supply the new tag in square brackets before the label. For example see={[see also]{anotherlabel}}.
You can override this for individual glossary entries using nonumberlist={false}. Alternatively, you can use the seeautonumberlist package option. For further details, see §11.
Since it’s useful to suppress the indexing while working on a draft document, consider using the seenoindex package option to warn about or ignore the see key while
If you use the see key, you may want to consider using the glossaries-extra package which additionally provides a seealso and alias key. If you want to avoid the automatic indexing triggered by the see key, consider using Option 4. See also the FAQ item Why does the see key automatically index the entry?
The following keys are reserved for
The supplementary packages glossaries-prefix (§16) and glossaries-accsupp (§17) provide additional keys.
With older LaTeX kernels and pre-2.08 versions of mfirstuc, if the name starts with non-Latin character, you need to group the character, otherwise it will cause a problem for commands like
Note that in the above UTF-8 examples, you will also need to supply the sort key if you are using Options 1 or 2 whereas xindy (Option 3) is usually able to sort non-Latin characters correctly.
You may have noticed from above that you can specify the plural form when you define an entry. If you omit this, the plural will be obtained by appending:
For example:
If you are writing in a language that supports multiple plurals (for a given term) then use the plural key for one of them and one of the user keys to specify the other plural form. For example:
Alternatively, you can define your own keys using
If you are using a language that usually forms plurals by appending a different letter, or sequence of letters, you can redefine
You can use the six user keys to provide alternatives, such as participles. For example:
Alternatively, you can define your own keys using
You can define your own custom keys using the commands described in this section. There are two types of keys: those for use within the document and those to store information used behind the scenes by other commands.
For example, if you want to add a key that indicates the associated unit for a term, you might want to reference this unit in your document. In this case use
In both cases, a new command
A custom key that can be used in the document is defined using:
These entries can later be used in the document:
A custom key that can be used for simply storing information is defined using:
This is essentially the same as
Here I can define a new key that determines whether the term is actually an acronym rather than some other form of abbreviation. I’m going to call this key abbrtype (since type already exists):
Now I can define a style that looks up the value of this new key to determine how to display the full form:
Since it may be a bit confusing to use
For a complete document, see the sample file sample-storage-abbr.tex.
In the above example, if
The new acronym style has a minor modification that forces the user to specify a description. In the previous example, the line:
Once this new style has been set, the new acronyms can be defined using the optional argument to set the description:
No change is required for the definition of
We can also accommodate contractions in a similar manner to the initialisms:
Since the custom acronym style just checks if abbrtype is “acronym”, the contractions will be treated the same as the initialisms, but the style could be modified by a further test of the abbrtype value if required.
To test regular non-abbreviated entries, I’ve also defined a simple word:
Now for a new glossary style that provides information about the abbreviation (in addition to the description):
If the entry has an short/long value, the full form is supplied in parentheses and
With this style set, the “apple” entry is simply displayed in the glossary as:
For a complete document, see sample-storage-abbr-desc.tex.
When you define new glossary entries expansion is performed by default, except for the name, description, descriptionplural, symbol, symbolplural and sort keys (these keys all have expansion suppressed via
You can switch expansion on or off for individual keys using:
Any keys that haven’t had the expansion explicitly set using
If your entries contain any fragile commands, I recommend you switch off expansion via
A sub-entry is created by setting the parent key. These will normally be sorted so that they are placed immediately after their parent entry. However, some sort methods aren’t suitable when there are sub-entries. In particular, sub-entries are problematic with Option 1, and with Option 5 the sub-entries must be defined immediately after their parent entry (rather than at any point after the parent entry has been defined).
The hierarchical level indicates the sub-entry level. An entry with no parent (a top level entry) is a hierarchical level 0 entry. An entry with a parent has a hierarchical level that’s one more than its parent’s level. The level is calculated when an entry is defined.
There are two different types of sub-entries: those that have the same name as their parent (homographs, see §4.5.2) and those that establish a hierarchy (see §4.5.1). Both types are considered hierarchical entries from the point of view of the glossaries package and the indexing applications, but typically homographs will have the name key obtained from the parent, rather than have it explicitly set, and have a maximum hierarchical level of 1.
Not all glossary styles support hierarchical entries and may display all the entries in a flat format. Of the styles that support sub-entries, some display the sub-entry’s name whilst others don’t. Therefore you need to ensure that you use a suitable style. (See §13 for a list of predefined glossary styles.) If you want level 1 sub-entries automatically numbered (in glossary styles that support it) use the subentrycounter package option (see §2.3 for further details).
Note that the parent entry will automatically be added to the glossary if any of its child entries are used in the document. If the parent entry is not referenced in the document, it will not have a number list. Note also that makeindex has a restriction on the maximum hierarchical depth.
To create a glossary with hierarchical divisions, you need to first define the division, which will be a top level (level 0) entry, and then define the sub-entries using the relevant higher level entry as the value of the parent key. (In a hierarchical context, a higher level indicates a numerically smaller level number, so level 0 is one level higher than level 1.) The top level entry may represent, for example, a topic or classification. A level 1 entry may represent, for example, a sub-topic or sub-classification.
Suppose I want a glossary of mathematical symbols that are divided into Greek letters and Roman letters. Then I can define the divisions as follows:
Note that in this example, the top level entries don’t need a description so I have set the descriptions to
I can now define my sub-entries as follows:
Sub-entries that have the same name as the parent entry don’t need to have the name key explicitly set. For example, the word “glossary” can mean a list of technical words or a collection of glosses. In both cases the plural is “glossaries”. So first define the parent entry:
Now define the two different meanings of the word with the parent key set to the above parent entry label:
In the above example, the plural form for both of the child entries is the same as the parent entry, so the plural key was not required for the child entries. However, if the sub-entries have different plurals, they will need to be specified. For example:
You can store all your glossary entry definitions in another file and use:
This is a preamble-only command. You may also use
Now suppose I have a file myacronyms.tex that contains:
If you want to use
Note that only those entries that have been indexed in the text will appear in the relevant glossaries. Note also that
Remember that you can use
You can move an entry from one glossary to another using:
Note that no check is performed to determine the existence of the target glossary. If you want to move an entry to a glossary that’s skipped by
Originally,
To overcome the first two problems, as from version 4.0 the glossaries package modifies the definition of
There are drawbacks to this mechanism: if you modify an entry definition, you need a second run to see the effect of your modification in
Version 4.47 has introduced changes that have removed some of the issues involved, and there are now warning messages if there is an attempt to multiply define the same entry label.
The glossaries-extra package provides a setting (but not for Options 1 or 4) that allows
§4.8.1 above covers technical issues that can cause your document to have compilation errors or produce incorrect output. This section focuses on good writing practice. The main reason cited by users wanting to define entries within the document environment rather than in the preamble is that they want to write the definition as they type in their document text. This suggests a “stream of consciousness” style of writing that may be acceptable in certain literary genres but is inappropriate for factual documents.
When you write technical documents, regardless of whether it’s a PhD thesis or an article for a journal or proceedings, you must plan what you write in advance. If you plan in advance, you should have a fairly good idea of the type of terminology that your document will contain, so while you are planning, create a new file with all your entry definitions. If, while you’re writing your document, you remember another term you need, then you can switch over to your definition file and add it. Most text editors have the ability to have more than one file open at a time. The other advantage to this approach is that if you forget the label, you can look it up in the definition file rather than searching through your document text to find the definition.
Once you have defined a glossary entry using a command such as
Some of these commands are more complicated than others. Many of them are robust and can’t be used in fully expandable contexts, such as in PDF bookmarks.
The commands are broadly divided into:
The text which appears at the point in the document when using any of the commands described in §5.1.2 or §5.1.3 is referred to as the link text (even if there are no hyperlinks). These commands also add content to an external indexing file that is used to generate the relevant entry line in the glossary. This information includes an associated location that is added to the number list for that entry. By default, the location refers to the page number. For further information on number lists, see §12. These external indexing file need to be post-processed by makeindex or xindy if you have chosen Options 2 or 3. If you don’t use
Note that repeated use of these commands for the same entry can cause the number list to become quite long, which may not be particular helpful to the reader. In this case, you can use the non-indexing commands described in §5.2 or you can use the glossaries-extra package, which provides a means to suppress the automated indexing of the commands listed in this chapter. (For example, in this manual, common terms such as glossary have too many references in the document to list them all in their number list in the index. They have a custom key created with
Aside from problems with expansion issues, PDF bookmarks and possible nested hyperlinks in the table of contents (or list of whatever) any use of the commands described in §5.1.2 will have their first use flag unset when they appear in the table of contents (or list of whatever) which is usually too soon and will not match the actual heading or caption in the document if there is a different first/subsequent use.
The above warning is particularly important if you are using the glossaries package in conjunction with the hyperref package. Instead, use one of the expandable commands listed in §5.2 (such as
If you want the link text to produce a hyperlink to the corresponding entry line in the glossary, you should load the hyperref package before the glossaries package. That’s what I’ve done in this manual, so if you encounter a hyperlinked term, such as link text, you can click on the word or phrase and it will take you to a brief description in this document’s glossary or you can click on a command name, such as
These are limitations of the DVI format not of the glossaries package.
It may be that you only want terms in certain glossaries to have hyperlinks, but not for other glossaries. In this case, you can use the package option nohypertypes to identify the glossary lists that shouldn’t have hyperlinked link text. See §2.1 for further details.
The way the link text is displayed depends on
Each entry has an associated conditional referred to as the first use flag. Some of the commands described in this chapter automatically unset this flag and can also use it to determine what text should be displayed. These types of commands are the
The
The keys listed below are available for the optional first argument of the
This section describes the
Apart from
Don’t use any of the
Take care using these commands within commands or environments that are processed multiple times as this can confuse the first use flag query and state change. This includes frames with overlays in beamer and the tabularx environment provided by tabularx. The glossaries package automatically deals with this issue in amsmath’s align environment. You can apply a patch to tabularx by placing the command
Most of the commands below have case-changing variants to convert the link text to sentence case or all caps. The sentence case conversion is performed by
The case-changing variants:
There are plural forms that are analogous to
For example:
Since the actual text is being supplied, any case-changing can be placed in the argument. For example:
This section describes the commands that don’t change or reference the first use flag. As described above, these commands all have a star-variant (hyper=false) and a plus-variant (hyper=true) and have an optional first argument that is a = list. These commands also don’t use
Additional commands for acronyms are described in §6. (Additional commands for abbreviations are described in the glossaries-extra manual.)
Apart from
The case-changing variants are:
There’s no equivalent command for title case, but you can use the more generic command
The case-changing variants are:
The case-changing variants are:
The case-changing variants are:
The case-changing variants are:
The case-changing variants are:
The case-changing variants are:
The case-changing variants are:
The case-changing variants are:
The case-changing variants are:
The case-changing variants are:
The case-changing variants are:
The case-changing variants are:
The default entry format (display style) of the link text for the
You can redefine
In the remainder of this section,
Within
You can also access the entry’s glossary type using:
If you want to know if the calling command used to reference the entry was used with the star (
Note that this doesn’t take into account if the hyper key was used to override the default setting, so this command shouldn’t be used to guess whether or not the hyperlink is on for this reference. This command is therefore of limited use. If you want to make the star or plus behave differently, you can try
Note that you can also use commands such as
The commands
If you only want to make minor modifications to
The acronym styles use a similar method to adjust the formatting. For example, the long-short style implements:
(Note that I’ve used
All of the link text will be formatted according to
For a complete document, see the sample file sample-entryfmt.tex.
Remember that if you use the symbol key, you need to use a glossary style that displays the symbol, as many of the styles ignore it.
Both the
There is also a hook (the post-link hook) that’s implemented at the end:
If you load hyperref prior to loading the glossaries package, the
You can disable or enable hyperlinks using:
You can disable just the first use links using the package option hyperfirst=false. Note that this option only affects the
Now the first use won’t have hyperlinked text, but will be followed by a footnote. See the sample file sample-FnDesc.tex for a complete document.
Note that the hyperfirst option applies to all defined glossaries. It may be that you only want to disable the hyperlinks on first use for glossaries that have a different form on first use (such as list of acronyms). This can be achieved by noting that since the entries that require hyperlinking for all instances have identical first and subsequent text, they can be unset via
For more complex requirements, you might find it easier to switch off all hyperlinks via
See the sample file sample-nomathhyper.tex for a complete document.
Next I redefine the hook
See the sample file sample-chap-hyperfirst.tex for a complete document.
The commands described in this section display entry details without adding any information to the glossary. They don’t use
If you want to title case a field, you can use:
For example, to convert the description to title case for the entry identified by the label “sample”:
If you want a hyperlink to an entry’s line in the glossary but don’t want the indexing or formatting associated with the
The following commands in form form
There are also commands in the form
The next two commands,
If you need to parse the number list, split it into groups based on the location counter, or extract a primary location then Option 4 (bib2gls) is your best option.
This command is at its simplest with Option 4, where it just displays the value of the location internal field that’s set by bib2gls in the glstex file. This will use the delimiters supplied by bib2gls (
With Option 1,
With Options 2 and 3, you will need the savenumberlist package option, which will attempt to gather the number list information when the glossary file is input by
As with
With Option 1, the number list information is stored in the loclist internal field, which is in the format of an etoolbox internal list. So with Option 1,
If hyperref has been loaded,
Acronyms internally use
The way the acronym is displayed on first use is governed by the acronym style that’s identified with
Acronyms are defined using:
The
Note that the same restrictions on
The optional argument
For example, you may need to supply description (when used with one of the styles that require a description, described in §6.2) or you can override plural forms of or using the shortplural or longplural keys. For example:
As with plural, if longplural is missing, it’s obtained by appending
If you want to use one of the small caps acronym styles, described in §6.2, you need to use lowercase characters for the shortened form:
Recall from the warning in §4 that you should avoid using the
For example, suppose you have defined:
Instead, consider doing:
It may be that you want the long, short or full form regardless of whether or not the acronym has already been used in the document. You can do so with the commands described in this section.
The
All caveats that apply to the
The optional arguments are the same as those for the
There are also analogous case-changing variants:
There are also plural versions:
There are also analogous case-changing variants:
Again there are also plural versions:
There are also analogous case-changing variants:
The plural version is:
If you find the above commands too cumbersome to write, you can use the shortcuts package option to activate the shorter command names listed in Table 6.1.
It is also possible to access the long and short forms without indexing using commands analogous to
An similar command is available for the full form:
The analogous plural commands are:
The acronym style is set using:
For example:
Unpredictable results will occur if you try to use multiple styles since each acronym style redefines commands like
The
Unlike the original pre-4.02 behaviour of
In both the old and new implementation, the text key is set to the short form. Since the first isn’t set with the new form, it will default to the value of the text key. This means that with the new implementation,
When you use
The glossaries package provides a number of predefined acronym styles. These styles apply:
The predefined small caps styles that contain “sc” in their name (for example long-sc-short) redefine
The predefined glossary styles that contain “sm” in their name (for example long-sm-short) redefine
The remaining predefined styles redefine
When acronyms are defined,
The name key is set to
The type key is set to
The shortplural is set to the short form appended by:
If the shortplural key is set in the optional argument of
The longplural is set to the long form appended by
Some styles set the description key to the long form, but others don’t. If you use a style that doesn’t set it, you will have to supply the description in the optional argument of
With the “long (short)” styles, acronyms are displayed in the form:
They also set
Note that the default Computer Modern fonts don’t support bold small caps, so another font is required. For example:
The sample file sampleFnAcrDesc.tex illustrates this example.
With the “short (long)” styles, acronyms are displayed in the form:
They also set
With these styles, the
With these styles, the
You may find that the predefined acronym styles that come with the glossaries package don’t suit your requirements. In this case you can define your own style using:
If the style is likely to be used with a mixed glossary (that is, entries in that glossary are defined both with
The third argument,
Note that
Within
As with all token registers, you can obtain the value of the register with
It may be that you want to define a new acronym style that’s based on an existing style. Within of the new style, you can use
Within
For example, the long-sc-short acronym style is based on the long-short style with minor modifications:
Let’s suppose it’s possible that I may have a mixed glossary. I can check this in the second argument ( ) of
Now let’s suppose that commands such as
First, the non-linking commands:
The style also needs to redefine
An alternative approach is to set
Finally, this style needs to switch off hyperlinks on first use to avoid nested links:
Now I need to specify that I want to use this new style:
Once the acronym style has been set, I can define my acronyms:
The sample file sample-custom-acronym.tex illustrates this example.
This example uses
There are two ways to do this. The first is to create a style that doesn’t use
The complete document is contained in the sample file sample-font-abbr.tex.
Some writers and publishing houses have started to drop full stops (periods) from uppercase initials but may still retain them for lowercase abbreviations, while others may still use them for both upper and lowercase. This can cause complications. Chapter 12 of The TeXbook discusses the spacing between words but, briefly, the default behaviour of TeX is to assume that an uppercase character followed by a full stop and space is an abbreviation, so the space is the default inter-word space whereas a lowercase character followed by a full stop and space is a word occurring at the end of a sentence, which requires an inter-sentence space (which may or may not be the same as an inter-word space). In the event that this isn’t true, you need to make a manual adjustment using
For example:
This situation is a bit problematic for glossaries. The full stops can form part of the argument of
The next example shows one way of achieving this.
It’s possible that I may also want acronyms or contractions (without full stops) in my document, so I need some way to differentiate between them. Here I’m going to use the same method as in Example 12 where a new field is defined to indicate the type of abbreviation:
Remember that internal commands within the document file (rather than in a class or package) need to be placed between
This also works on first use when the style is set to one of the ( ) styles but it will fail with the ( ) styles as in this case the terminating full stop shouldn’t be discarded. Since
The other thing to consider is what to do with plurals. One possibility is to check for plural use within
The complete document is contained in the sample file sample-dot-abbr.tex.
The list of acronyms is just like any other type of glossary and can be displayed on its own using the appropriate
For example, Option 1:
Alternatively, the list of acronyms can be displayed with all the other glossaries using
The remaining indexing methods require glossaries-extra, which has its own abbreviation commands that are incompatible with the base acronym commands.
Users of the obsolete glossary package may recall that the syntax used to define new acronyms has changed with the replacement glossaries package. In addition, the old glossary package created the command
In order to facilitate migrating from the old glossary package to the new one, the glossaries package provides the command:
The glossaries package doesn’t load the xspace package since there are both advantages and disadvantages to using
To illustrate this, suppose I define the acronym “abc” as follows:
When using the
The former can be achieved by one of the following commands:
The latter can be achieved by one of the following commands:
The above commands are for the specific entry identified by the argument . You can also reset or unset all entries for a given glossary or multiple glossaries using:
The optional argument glossary labels. If omitted, the list of all non-ignored glossaries is assumed.
For example, to reset all entries in the
You can determine whether an entry’s first use flag is set with
For example, the frame environment in beamer processes its argument for each overlay. This means that the first use flag will be unset on the first overlay and subsequent overlays will use the subsequent use form.
Consider the following example:
On the first overlay,
These are non-optimal, but the beamer class is too complex for me to provide a programmatic solution. Other potentially problematic environments are some tabular-like environments (but not tabular itself) that process the contents in order to work out the column widths and then reprocess the contents to do the actual typesetting.
The amsmath environments, such as align, also process their contents multiple times, but the glossaries package now checks for this. For tabularx, you need to explicitly patch it by placing
It’s possible to keep track of how many times an entry is used. That is, how many times the first use flag is unset. Note that the supplemental glossaries-extra package improves this function and also provides per-unit counting, which isn’t available with the glossaries package.
To enable this function, use:
The currcount field keeps track of how many times
The behaviour of the reset commands depend on the conditional:
The prevcount field stores the final value of the currcount field from the previous run. This value is read from the aux file at the beginning of the document environment.
You can access these fields using
For example:
When you enable the entry count using
If you don’t use
If you have enabled entry counting with
The formatting command
This means that if the previous count for the given entry was 1, the entry won’t be hyperlinked with the
Remember that since these commands use
In
All defined glossaries may be displayed using the appropriate command, such as
Option 1 (must be used with
The following is an iterative command:
Options 2 and 3 (must be used with
The following is an iterative command:
Options 4 and 5 (glossaries-extra only):
The reason this command works with bib2gls is because bib2gls writes the entry definitions in the glstex file in the order obtained by the sort resource option, and bib2gls will only include the entries that match the required selection criteria.
With Option 5 (that is, without bib2gls) the result will be in the order the entries were defined in the tex file. There’s no attempt to gather child entries (see §4.5). This means that if you don’t define child entries immediately after their parent, you will have a strange result (depending on the glossary style).
As with
The following is an iterative command:
The glossaries-extra package also provides
All the individual glossary commands
After the options have been set, the following command will be defined:
These options may be used in the optional argument of the
If you don’t get an error with sort=use and sort=def but you do get an error with one of the other sort options, then you probably need to use the sanitizesort=true package option or make sure none of the entries have fragile commands in their sort field.
For a locale-sensitive sort, you must use either xindy (Option 3) or bib2gls (Option 4). Note that bib2gls provides many other sort options.
The word and letter order sort methods use datatool’s
This option is useful with
This section describes the commands that are used to display the glossary. If you want to suppress the number lists you can use the nonumberlist option. If you want to save the number lists for some other purpose outside of the glossary, you can use the savenumberlist option. If you want information about an entry’s parent then you can use
If you’re trying to work out how to parse the glossary in order to gather indexing information, consider using bib2gls instead, which stores all the indexing information, such as location lists and letter group labels, in internal fields. It can also store lists of sibling entries or child entries. If you really want to input the glossary file in order to gather information obtained by makeindex or xindy without actually displaying anything (by redefining the markup commands to not produce any text), use
The glossary is always started with:
If memoir has been loaded,
If ucmark=true, the case change will be applied using
So if you want to redefine the way the header mark is set for the glossaries, you need to redefine
With hyperref and unnumbered section headings,
Occasionally you may find that another package defines
The
This means that if neither title nor toctitle are set, the glossary’s associated title will be used for both. If only title is used, then it will also apply to the table of contents title, and if only toctitle is used, then
After the heading, but before the main body of the glossary, is the glossary preamble which is given by:
You can globally assign a preamble to a specific glossary with:
There is also a postamble at the end of each glossary which is given by:
The actual glossary content is contained within the theglossary environment, which will typically be in the form:
The entire number list for each entry is encapsulated with:
With Option 1, this command is preceded by:
If you want to suppress the number list for a particular entry, you can add the following to the entry’s description:
Similarly, if you want to override the nonumberlist option to ensure that the next number list is shown, then use:
The theglossary environment, and the other commands (
A new glossary can be defined using:
The arguments files for that glossary, is the default title for this new glossary, and the final optional argument specifies which location counter to use for the associated number lists (see also §12). If not specified, the default location counter will be the one identified in the counter option, if that option is used, otherwise it will be the page counter.
The first optional argument indexing application’s transcript file (this information is used by makeglossaries which picks up the information from the aux file and also by the automake option). If omitted, glg is used.
The file extensions only apply to Options 2 and 3. For the other options, the indexing information is written to the aux file for Options 1 and 4. No input file is required for Option 1 and Option 4 always has the glstex file extension. Since the file extensions are only relevant for Options 2 and 3, there is a starred version that omits those arguments:
It may be that you have some terms that are so common that they don’t need to be listed. In this case, you can define a special type of glossary that doesn’t create any associated files. This is referred to as an “ignored glossary” and it’s ignored by commands that iterate over all the glossaries, such as
An ignored glossary can’t be displayed with
You can test if a glossary is an ignored one using:
Note that the
The acronym (or acronyms) package option is equivalent to:
The symbols package option creates a new glossary with the label
See §1.5.1 if you want to redefine
It is possible to
This command is particularly useful to create an explicit range that covers an entire section or block of text that might otherwise end up with a long, ragged number list. For example, suppose I have defined an entry with the label “set”:
This can be done with an explicit range:
To add all entries that have been defined, use:
If you want to ensure that all entry are added to the glossary, but only want the locations of entries that have actually been used in the document, then you can use:
This command implements:
This means that
Alternatively, the selection=all resource option can be used, which will ensure all entries are selected but only those indexed with one or more non-ignored locations will have a location list.
Base glossaries package only:
This is just an example. In general, think twice before you add this kind of duplication. If all information (short, long and description) can be provided in a single list, it’s redundant to provide a second list unless any of the short forms start with a different letter to the associated long form, which may make it harder to lookup.
There are several ways of cross-referencing entry in the glossaries:
This command is essentially performing:
This means that
For example:
You therefore need to ensure that you use the cross-referenced term with the commands described in §5.1 or §10.
The “see” tag is produce using
In both cases 2 and 3 above, the cross-referenced information appears in the number list, whereas in case 1, the cross-referenced information appears in the description. (See the sample-crossref.tex example file that comes with this package.) This means that in cases 2 and 3, the cross-referencing information won’t appear if you have suppressed the number list. In this case, you will need to activate the number list for the given entries using nonumberlistfalse. Alternatively, if you just use the see key instead of
When you use either the see key or the
The list of labels is formatted by:
Each entry item in the list is formatted with:
However, the original definition is more appropriate in some ways, as it makes more sense for the cross-reference to show the name as it appears in the glossary, except for acronyms which could have wide names if the long form is included. So in v4.50, which had major compatibility-breaking changes to remove the unconditional dependency on the now deprecated textcase package, the original use of name was restored for non-acronyms, which brings it into line with glossaries-extra.
For example, to make the cross-referenced list use small caps with the text (not name) field:
Each entry in the glossary has an associated number list (or location list). By default, these numbers (the entry locations) refer to the pages on which that entry has been indexed (using any of the commands described in §5.1 and §10) and will also include any cross-references obtained with
The locations in the number list are separated with:
The number list can be suppressed using the nonumberlist package option, or an alternative counter can be set as the default using the counter package option. The glossaries-extra package additionally provides the equations and floats options that can be used to automatically switch the location counter in certain environments.
Number lists are more common with indexes rather than glossaries (although you can use the glossaries package for indexes as well). However, Options 2 and 3 makes use of makeindex or xindy to hierarchically sort and collate the entries. These applications are readily available with most modern TeX distributions, but because they are both designed as indexing applications they both require that terms either have a valid location or a cross-reference.
If you’re not interested in the locations, each entry only needs to be indexed once, so consider using indexonlyfirst, which can improve the document build time by only indexing the first use of each term.
The
With Option 4, the indexing is performed by bib2gls, which was specifically designed for the glossaries-extra package. So it will allow empty or unusual locations. (As from bib2gls v3.0, empty locations will be converted to ignored locations.) Additionally, the selection=all resource option option will select all entries without adding an unwanted location to the number list. If bib2gls can deduce a numerical value for a location, it will attempt to form a range over consecutive locations, otherwise it won’t try to form a range and the location will just form an individual item in the list.
Option 1 also allows any location but it doesn’t form ranges. Any empty locations or location with the glsignore format will result in an invisible location in the number list.
The location encap or format is the encapsulating command used to format an entry location. That is, it’s a command that takes an argument that will be the location.
The “encap” usually refers to the control sequence name without the leading backslash (such as textbf) and is essentially the same as the makeindex encap value that can be provided within the standard
There is a special format:
If you want to apply more than one style to a given location (for example, bold and italic) you will need to create a command that applies both formats. For example:
In this document, standard location format refer to the standard text block commands such as
If you are using hyperlinks and you want to change the font of the hyperlinked location don’t use
The
If you want to make a new location format that supports hyperlinks, you will need to define a command which takes one argument and use that with the location encapsulated with
Remember that if you use xindy, you will need to add this to the list of location xindy attributes:
Complications can arise if you use different encap values for the same location. For example, suppose on page 10 you have both the default glsnumberformat and hyperbf encaps. While it may seem apparent that hyperbf should override glsnumberformat in this situation, the indexing application may not know it. This is therefore something you need to be careful about if you use the format key or if you use a command that implicitly sets it.
In the case of xindy, it only accepts one encap (according to the order of precedence given in the xindy module) and discards the others for identical locations (for the same entry). This can cause a problem if a discarded location forms the start or end of a range.
In the case of makeindex, it accepts different encaps for the same location, but warns about it (“multiple encaps”). This leads to a number list with the same location repeated in different formats. If you use the makeglossaries Perl script with Option 2 it will detect makeindex’s warning and attempt to fix the problem, ensuring that the glsnumberformat encap always has the least precedence unless it includes a range identifier. Other conflicting encaps will have the last one override earlier ones for the same location with range identifiers taking priority. If you actually want the repeat, you can disable this feature with the -e switch.
No discard occurs with Option 1 so again you get the same location repeated in different formats. With Option 4, bib2gls will discard according to order of precedence, giving priority to start and end ranges. (See the bib2gls manual for further details.)
The default location format is:
Each location within
The location counter, which first have to be set with:
The
The
The initial hook to disable the problematic commands is:
Any leftover robust or protected commands will end up sanitized to prevent an obscure error from occurring, but an invalid target name is likely to result. See §12.5 for an example.
The use of
There are two types of ranges: explicit and implicit. Neither are supported with Option 1. Both are supported by Options 2, 3 and 4. Implicit ranges can be switched off using the appropriate option for the required indexing application. The start and end of a range is separated with:
As with
Implicit ranges are formed by concatenating a sequence of three or more consecutive locations. For example, if an entry is indexed on pages 3, 4, 5, and 6, this will be compacted into “3–6”.
With Option 3, you can vary the minimum sequence length using
With both makeindex and xindy (Options 2 and 3), you can replace the separator and the closing number at the end of the range using:
For example:
Each location in an entry’s number list is the result of indexing the entry at the point in the document that corresponds to the location (typically where a command such as
The syntax of the location must be valid for the given indexing application if you use Options 2 or 3. In the case of makeindex, the syntax is quite restricted. The location may be a digit (
The following locations are valid, assuming the default full stop compositor:
In the case of xindy, the location syntax must be declared in the xdy style file. This covers both the way that the location appears in the indexing file as a result of protected expansion but also the counter used to obtain the location, and is described in more detail in §14.3. The standard digit (
If a location doesn’t match any declared syntax, a warning will be written to xindy’s transcript file (glg):
Additional problems can occur with xindy if any of xindy’s special characters occur in the location. This includes the backslash
If esclocationstrue, an attempt will be made to hack commands like
The following hook is used during the protected write:
Both Options 1 and 4 write the indexing information in the aux file and will accept any location syntax (that’s valid in a LaTeX document). In the case of Option 4, bib2gls will try parsing the location and if it fits a common pattern that allows it to obtain a numeric value, then it will be able to form an implicit range (if required), otherwise it will accept the location but not form any implicit ranges.
With Options 1–4 (except with record=nameref) the location anchor isn’t included in the indexing information. If a hyperlink is required for the location, the target (anchor name) has to be constructed from the location. The hyperref package provides
The assumption here is that
The prefix is found as follows:
In this step,
Unfortunately, not all definitions of
The page precedence indicates the location ordering within the number list based on the location syntax. For example, if an entry has been indexed on pages 5, 7, i and ii, then the number list will be “i, ii, 5, 7” with the default order of precedence.
With makeindex, the default precedence is
With xindy, the precedence is given by the order the location classes are listed in
Since neither Options 1 and 4 recognise specific location classes, they have no concept of page precedence. They will both create location lists that are in the same order as the locations were indexed, which means they will match the order those locations occur in the document. However, with bib2gls, it’s possible to gather the locations into sub-groups according to the associated counter or split off locations with identified primary formats. See the bib2gls manual for further details.
The default location counter is the page counter, the value of which is obtained with
This works fine with Options 1 and 4 since neither of those options have any restrictions on the location syntax (provided that it’s valid LaTeX code). With bib2gls, if it can’t work out a numeric value for the location then it simply won’t be able to form a range. Additionally, bib2gls v3.0+, converts an empty location into an ignored location, which means the entry will still be selected so that it can be included in the glossary, but it won’t cause a spurious comma or en-dash as there won’t be an invisible location in the number list.
The only problematic locations with Options 1 and 4 are where hyperlinks are required but the target name can’t be formed from the prefix, counter and location information (see §12.3). The best solution with bib2gls in this case is to use record=nameref, which saves the actual target name in the indexing record. With Option 1 you will have to redefine
With Options 2 and 3, the location must expand to content that is compatible with the indexing application’s syntax. The syntax for makeindex is quite restrictive and is described in §12.3.
For example,
Similarly, if the page compositor hasn’t been correctly identified, then it can also result in an invalid location. For example:
In both of the above examples, using makeglossaries will help the document build to complete without the entries disappearing from the glossary, however the resulting number list may look strange. If you are using nonumberlist then this isn’t a problem.
If you don’t use makeglossaries but explicitly call makeindex then you won’t have those corrections, and some or all of your entries may be omitted from the glossary. In which case, you will have to adjust the location so that it fits makeindex’s syntax even if you have nonumberlist. In the case of the invalid page compositor problem, you can simply use
Other problems occur with commands that don’t fully expand, which results in LaTeX markup in the location in the indexing file. For example, if babel is used with spanish, lowercase Roman numerals (which may occur in the front matter) will expand to the internal command
The double-quote (
The indexing data is contained in the arguments of:
The syntax for the second argument 12.3. The syntax for the first argument is in the form:
By default, makeindex uses
You may remember from §12.1 that the format option specifies the encap, which I claimed was essentially the same as the encap with
The way that makeindex works is that it will write
So from makeindex’s point of view, the real encap in the above example is the literal string:
In the above example, the location has ended up as
That means that this example will trigger a message from makeindex which will be written to the glg transcript file:
If you run makeglossaries instead of running makeindex explicitly, then makeglossaries will search the glg transcript for the “( line, and if entries accepted, rejected)” is greater than 0 it will attempt to diagnose and fix the problem.
Messages about the “second argument” (as in “Illegal space within numerals in second argument”) indicate that the problem is with the location, so makeglossaries will search the locations for content that matches
Following this correction, the number list for the “sample” entry now contains:
In the above example, the location command is
This become more complicated if hyperref is added to the document (before glossaries). Now
Here’s a modified example that has an implicit range in the front matter and an explicit range in the main matter.
The default definition of
The case change occurs as a result of the fake small caps, but since
I can redefine
The
If the number list doesn’t contain any ranges, then the above redefinition of
Instead of redefining
This will successfully construct the anchor names
If you’re not using makeglossaries and are either calling makeindex explicitly or via makeglossaries-lite or with the automake option, then you will need to find another way of converting problematic location into a form that won’t be discarded by makeindex. This is quite difficult if the problematic content is inside
The earlier example can be rewritten to (sort of!) work without makeglossaries:
This ensures that the locations are valid in the glo file, so makeindex will process it without losing any rejecting any entry lines. The hyperlink targets will also be correct. The only problem now is that the front matter locations will be in uppercase in the glossary.
The above problems are all due to makeindex having a restrictive location syntax. With xindy, you can define location classes for custom locations. Unfortunately, the backslash
The sample file samplexdy.tex provides a custom page format that uses a robust command called
If you use makeglossaries rather than running xindy directly, makeglossaries will detect the warning and provide some diagnostic information:
Returning to the earlier babel-spanish example, if it’s converted to use xindy instead of makeindex, a similar problem arises. For example, simply adding the xindy package option:
The
You can iterate over an entry’s loclist field using:
The third argument
For example, if on page 12 I have:
Internally,
The markup used in the glossary is described in §8.2. §13.2 describes how to define a new glossary style. Commands that may be used in styles, but should not be redefined by styles, are described in §§13.2.1 & 13.2.2. The commands that should be redefined by the glossary style are described in §13.2.3.
Glossary styles typically use
By default,
For example, the tree style displays the name as follows:
The list style displays the name in the option argument of
The long style displays the name in the first column of a longtable:
Glossary styles will typically display the description with
There’s no analogous font command for the description or symbol, but the glossaries-extra package provides the glossdescfont and glosssymbolfont attributes to change the font according to the entry’s category.
Some styles may supply their own helper commands (such as
Some styles support groups. These may simply insert a vertical gap between groups, but some may also include a heading with the group title. The base glossaries package only has a simple mechanism for obtaining the title from the group label via
The predefined styles can accommodate numbered top level (level 0) and level 1 entries. See the package options entrycounter, counterwithin and subentrycounter described in §2.3. There is a summary of available styles in Table 13.1. You can view samples of all the predefined styles at dickimaw-books.com/gallery/glossaries-styles/. Note that glossaries-extra provides additional styles in the supplementary packages glossary-bookindex, glossary-topic and glossary-longextra. See the glossaries-extra manual for further details.
The group title is obtained using
The tabular-like styles that allow multi-line descriptions and number lists use the length:
These will need to be changed using
Note that if you use the style key in the optional argument to
All the styles except for the three- and four-column styles and the listdotted style use the post-description hook:
Alternatively, you can use the package option nopostdot to suppress this full stop. This is implemented by default with glossaries-extra. You can switch it back on with nopostdot=false or postdot=or you can use postpunc for a different punctuation character.
The glossary styles described in this section are all defined in the package glossary-list. Since they all use the description environment, they are governed by the same parameters as that environment. These styles all ignore the entry’s symbol. Note that these styles will automatically be available unless you use the nolist or nostyles package options.
There is an initialisation hook that provides a patch if the gettitlestring package is loaded, since this is used by hyperref.
If nogroupskip=false, the
For the styles that should group headings, the group title is encapsulated with:
For the styles that have a navigation line, the line is formatted according to:
The closest matching non-list style is the index style.
The closest matching non-list style is the index style with the following adjustment:
A non-list alternative is to use the index style with
The glossary styles described in this section are all defined in the package glossary-long. Since they all use the longtable environment, they are governed by the same parameters as that environment. Note that these styles will automatically be available unless you use the nolong or nostyles package options. These styles fully justify the description and number list columns. If you want ragged right formatting instead, use the analogous styles described in §13.1.3. If you want to incorporate rules from the booktabs package, try the styles described in §13.1.4.
Groups are separated with a blank row unless nogroupskip is used before the style is set. For example:
The long style uses the longtable environment (defined by the longtable package). It has two columns: the first column contains the entry’s name and the second column contains the description followed by the number list. The entry’s symbol is ignored. The width of the first column is governed by the widest entry in that column. The width of the second column is governed by the length
The longborder style is like long but has horizontal and vertical lines around it.
The longheader style is like long but has a header row. You may prefer the long-booktabs style instead.
The longheaderborder style is like longheader but has horizontal and vertical lines around it. The long-booktabs style is generally better.
The long3col style is like long but has three columns. The first column contains the entry’s name, the second column contains the description and the third column contains the number list. The entry’s symbol is ignored. The width of the first column is governed by the widest entry in that column, the width of the second column is governed by the length
The long3colborder style is like the long3col style but has horizontal and vertical lines around it.
The long3colheader style is like long3col but has a header row. You may prefer the long3col-booktabs style instead.
The long3colheaderborder style is like long3colheader but has horizontal and vertical lines around it. The long3col-booktabs style is generally better.
The long4col style is like long3col but has an additional column in which the entry’s associated symbol appears. This style is used for brief single line descriptions. The column widths are governed by the widest entry in the given column. Use altlong4col for multi-line descriptions.
The long4colborder style is like the long4col style but has horizontal and vertical lines around it.
The long4colheader style is like long4col but has a header row. You may prefer the long4col-booktabs style instead.
The long4colheaderborder style is like long4colheader but has horizontal and vertical lines around it.
The altlong4col style is like long4col but allows multi-line descriptions and number lists. The width of the description column is governed by the length
The altlong4colborder style is like the long4colborder but allows multi-line descriptions and number lists.
The altlong4colheader style is like long4colheader but allows multi-line descriptions and number lists. You may prefer the altlong4col-booktabs style instead.
The altlong4colheaderborder style is like long4colheaderborder but allows multi-line descriptions and number lists.
The glossary styles described in this section are all defined in the package glossary-longragged. These styles are analogous to those defined in glossary-long but the multiline columns are left justified instead of fully justified. Since these styles all use the longtable environment, they are governed by the same parameters as that environment. The glossary-longragged package additionally requires the array package. Note that these styles will only be available if you explicitly load glossary-longragged:
With glossaries-extra, you can load both the package and style with the style and stylemods options. For example:
As with the glossary-long styles, groups are separated with a blank row unless nogroupskip is used before the style is set. For example:
The longragged style has two columns: the first column contains the entry’s name and the second column contains the (left-justified) description followed by the number list. The entry’s symbol is ignored. The width of the first column is governed by the widest entry in that column. The width of the second column is governed by the length
The longraggedborder style is like longragged but has horizontal and vertical lines around it.
The longraggedheader style is like longragged but has a header row. You may prefer the longragged-booktabs style instead.
The longraggedheaderborder style is like longraggedheader but has horizontal and vertical lines around it.
The longragged3col style is like longragged but has three columns. The first column contains the entry’s name, the second column contains the (left justified) description and the third column contains the (left justified) number list. The entry’s symbol is ignored. The width of the first column is governed by the widest entry in that column, the width of the second column is governed by the length
The longragged3colborder style is like the longragged3col style but has horizontal and vertical lines around it.
The longragged3colheader style is like longragged3col but has a header row. You may prefer the longragged3col-booktabs style instead.
The longragged3colheaderborder style is like longragged3colheader but has horizontal and vertical lines around it.
The altlongragged4col style is like longragged3col but has an additional column in which the entry’s associated symbol appears. The width of the description column is governed by the length
The altlongragged4colborder style is like the altlongragged4col but has horizontal and vertical lines around it.
The altlongragged4colheader style is like altlongragged4col but has a header row. You may prefer the altlongragged4col-booktabs style instead.
The altlongragged4colheaderborder style is like altlongragged4colheader but has horizontal and vertical lines around it.
The glossary styles described in this section are all defined in the package glossary-longbooktabs.
Since these styles all use the longtable environment, they are governed by the same parameters as that environment. The glossary-longbooktabs package automatically loads the glossary-long (§13.1.2) and glossary-longragged (§13.1.3) packages. Note that these styles will only be available if you explicitly load glossary-longbooktabs:
With glossaries-extra, you can load both the package and style with the style and stylemods options. For example:
As with the glossary-long styles, groups are separated with a blank row unless nogroupskip is used before the style is set. For example:
These styles are similar to the “header” styles in the glossary-long and glossary-longragged packages, but they add the rules provided by the booktabs package,
Alternatively, you can restore the original longtable behaviour with:
The penalty check is tested with:
With the default nogroupskip=false,
This style is similar to the longheader style but adds rules above and below the header (
This style is similar to the long3colheader style but adds rules as per long-booktabs.
This style is similar to the long4colheader style but adds rules as above.
This style is similar to the altlong4colheader style but adds rules as above.
This style is similar to the longraggedheader style but adds rules as above.
This style is similar to the longragged3colheader style but adds rules as above.
This style is similar to the altlongragged4colheader style but adds rules as above.
The glossary styles described in this section are all defined in the package glossary-super. Since they all use the supertabular environment, they are governed by the same parameters as that environment. Note that these styles will automatically be available unless you use the nosuper or nostyles package options. In general, the longtable environment is better, but there are some circumstances where it is better to use supertabular. (For example, with the flowfram package.) These styles fully justify the description and number list columns. If you want ragged right formatting instead, use the analogous styles described in §13.1.6.
As with the glossary-long styles, groups are separated with a blank row unless nogroupskip is used before the style is set. For example:
The super style uses the supertabular environment (defined by the supertabular package). It has two columns: the first column contains the entry’s name and the second column contains the description followed by the number list. The entry’s symbol is ignored. The width of the first column is governed by the widest entry in that column. The width of the second column is governed by the length
The superborder style is like super but has horizontal and vertical lines around it.
The superheader style is like super but has a header row.
The superheaderborder style is like superheader but has horizontal and vertical lines around it.
The super3col style is like super but has three columns. The first column contains the entry’s name, the second column contains the description and the third column contains the number list. The entry’s symbol is ignored. The width of the first column is governed by the widest entry in that column. The width of the second column is governed by the length
The super3colborder style is like the super3col style but has horizontal and vertical lines around it.
The super3colheader style is like super3col but has a header row.
The super3colheaderborder style is like the super3colheader style but has horizontal and vertical lines around it.
The super4col style is like super3col but has an additional column in which the entry’s associated symbol appears. This style is designed for entries with brief single line descriptions. The column widths are governed by the widest entry in the given column. Use altsuper4col for multi-line descriptions.
The super4colborder style is like the super4col style but has horizontal and vertical lines around it.
The super4colheader style is like super4col but has a header row.
The super4colheaderborder style is like the super4colheader style but has horizontal and vertical lines around it.
The altsuper4col style is like super4col but allows multi-line descriptions and number lists. The width of the description column is governed by the length
The altsuper4colborder style is like the super4colborder style but allows multi-line descriptions and number lists.
The altsuper4colheader style is like super4colheader but allows multi-line descriptions and number lists.
The altsuper4colheaderborder style is like super4colheaderborder but allows multi-line descriptions and number lists.
The glossary styles described in this section are all defined in the package glossary-superragged. These styles are analogous to those defined in glossary-super but the multiline columns are left justified instead of fully justified. Since these styles all use the supertabular environment, they are governed by the same parameters as that environment. The glossary-superragged package additionally requires the array package. Note that these styles will only be available if you explicitly load glossary-superragged:
With glossaries-extra, you can load both the package and style with the style and stylemods options. For example:
As with the glossary-long styles, groups are separated with a blank row unless nogroupskip is used before the style is set. For example:
The superragged style uses the supertabular environment (defined by the supertabular package). It has two columns: the first column contains the entry’s name and the second column contains the (left justified) description followed by the number list. The entry’s symbol is ignored. The width of the first column is governed by the widest entry in that column. The width of the second column is governed by the length
The superraggedborder style is like superragged but has horizontal and vertical lines around it.
The superraggedheader style is like superragged but has a header row.
The superraggedheaderborder style is like superraggedheader but has horizontal and vertical lines around it.
The superragged3col style is like superragged but has three columns. The first column contains the entry’s name, the second column contains the (left justified) description and the third column contains the (left justified) number list. The entry’s symbol is ignored. The width of the first column is governed by the widest entry in that column. The width of the second column is governed by the length
The superragged3colborder style is like the superragged3col style but has horizontal and vertical lines around it.
The superragged3colheader style is like superragged3col but has a header row.
The superragged3colheaderborder style is like the above but has horizontal and vertical lines around it.
The altsuperragged4col style is like superragged3col but has an additional column in which the entry’s associated symbol appears. The column widths for the name and symbol column are governed by the widest entry in the given column.
The altsuperragged4colborder style is like the altsuperragged4col style but has horizontal and vertical lines around it.
The altsuperragged4colheader style is like altsuperragged4col but has a header row.
The altsuperragged4colheaderborder style is like the above but has horizontal and vertical lines around it.
The glossary styles described in this section are all defined in the package glossary-tree. These styles are designed for hierarchical glossaries but can also be used with glossaries that don’t have sub-entries. These styles will display the entry’s symbol if it has been set. Note that these styles will automatically be available unless you use the notree or nostyles package options.
These styles all format the entry name using:
Note that this is different from
With the exception of the alttree style (and those derived from it), the space before the description for top-level entries is produced with
With the exception of the treenoname and alttree styles (and those derived from them), the space before the description for child entries is produced with
The index style is similar to the way standard indices are usually formatted in that it has a hierarchical structure up to three levels (the main level plus two sub-levels). If the symbol is present it is set in parentheses after the name and before the description. Sub-entries are indented and also include the name, the symbol in brackets (if present) and the description. Groups are separated using
Each main level item is started with
The level 2 entries are started with
Note that the index style automatically sets
The index style isn’t suitable for multi-paragraph descriptions, but this limitation can be overcome by redefining the above commands. For example:
The indexgroup style is similar to the index style except that each group has a heading obtained using
The indexhypergroup style is like indexgroup but has a set of links to the glossary groups. The navigation line is the same as that for listhypergroup, described above, but is formatted using
The tree style is similar to the index style except that it can have arbitrary hierarchical levels. (Note that makeindex is limited to three levels, so you will need to use another indexing method if you want more than three levels.) Each sub-level is indented according to the length
Note that the name, symbol (if present) and description are placed in the same paragraph block. If you want the name to be apart from the description, use the alttree style instead. (See below.)
The treegroup style is similar to the tree style except that each group has a heading.
The treehypergroup style is like treegroup but has a set of links to the glossary groups. The navigation line is the same as that for listhypergroup, described above, but is formatted using
The treenoname style is like the tree style except that the name for each sub-entry is ignored.
The treenonamegroup style is similar to the treenoname style except that each group has a heading.
The treenonamehypergroup style is like treenonamegroup but has a set of links to the glossary groups. The navigation line is the same as that for listhypergroup, described above, but is formatted using
The alttree style is similar to the tree style except that the indentation for each level is determined by the width of the text specified by
This requires keeping track of which entry has the widest name, which may not be practical for large glossaries. Instead you can use:
For example, to have the same name width for all glossaries:
For each level, the name is placed to the left of the paragraph block containing the symbol (optional) and the description. If the symbol is present, it is placed in parentheses before the description.
The name is placed inside a left-aligned
The alttreegroup is like the alttree style except that each group has a heading.
The alttreehypergroup style is like alttreegroup but has a set of links to the glossary groups.
The glossary-mcols package provides tree-like glossary styles that are in the multicols environment (defined by the multicol package). The style names are as their analogous tree styles (as defined in §13.1.7) but are prefixed with “mcol”. For example, the mcolindex style is essentially the index style but put in a multicols environment. For the complete list, see Table 13.2. The glossary-tree package is automatically loaded by glossary-mcols (even if the notree package option is used when loading glossaries). The formatting commands
Note that these styles will only be available if you explicitly load glossary-mcols:
With glossaries-extra, you can load both the package and style with the style and stylemods options. For example:
The default number of columns is 2, but can be changed by redefining:
The styles with a navigation line, such as mcoltreehypergroup, now have a variant (as from v4.22) with “hypergroup” replaced with “spannav” in the style name. The original “hypergroup” styles place the navigation line at the start of the first column. The newer “spannav” styles put the navigation line in the optional argument of the multicols environment so that it spans across all the columns.
This section covers the glossary-inline package that supplies the inline style. This is a glossary style that is designed for in-line use (as opposed to block styles, such as lists or tables). This style doesn’t display the number list.
Note that this style will only be available if you explicitly load glossary-inline:
With glossaries-extra, you can load both the package and style with the style and stylemods options. For example:
You will most likely need to redefine
The group skip command
The inline style is governed by the following commands.
For example, if you want the name to appear in small caps:
This style needs to know if an entry has any children. This test is performed with:
Sub-entry names are formatted according to:
If the description is empty or has been suppressed (according to
For example, if you want a colon between the name and the description:
The sub-entry description is formatted according to:
The markup used in the glossary is described in §8.2. Commands that may be used by styles, but should not be redefined by styles, are described in §§13.2.1 & 13.2.2. The commands that should be redefined by the glossary style are described in §13.2.3.
If the predefined glossary styles don’t fit your requirements, you can define your own style using:
A style may inherit from an existing style by starting
For example, the indexgroup style is basically the same as the index style, except for the definition of
These commands are typically used in style definitions but should not be modified by the style. See §13.2.2 for hyperlinks to group headings.
In order to support the entrycounter=option, a style needs to use:
For example, the list style defines
In order to support the subentrycounter=option, a style needs to use:
For example, the index style has:
The style will typically also create the target to enable hyperlinks from an entry reference within the document (created with commands like
The target is created with:
glossary styles that support groups can obtain the group title with:
The commands listed in this section should all be redefined by every glossary style. However, a style may be based on another style, in which case the style definitions should start with
Note that
The rest of the contents of the theglossary environment is divided into letter group blocks. Each block starts with the group heading:
With Options 1, 2 and 3, groups only related to top level (level 0) entries.
After the group heading, each top level (level 0) entry line within the group is formatted with:
The
Each sub-entry line is formatted with:
The glossary styles will typically redefine
Similarly,
Between each letter group block (that is, before all instances of
For example, the list style defines
If you want a completely new style, you will need to redefine all of the commands and the environment listed above in this section.
For example, suppose you want each entry to start with a bullet point. This means that the glossary should be placed in the itemize environment, so theglossary should start and end that environment. Let’s also suppose that you don’t want anything between the glossary groups (so
Variations:
If you want to define a new style that is a slightly modified version of an existing style, you can use
Suppose each entry not only has an associated symbol, but also units (stored in user1) and dimension (stored in user2). Then you can define a glossary style that displays each entry in a longtable as follows:
If you want to use xindy to sort the glossary, you must use the package option xindy:
§1.6 covers how to use the external indexing application, and §12.3 covers the issues involved in the location syntax. This section covers the commands provided by the glossaries package that allow you to adjust the xindy style file (xdy) and parameters.
To assist writing information to the xindy style file, the glossaries package provides the following commands:
For example, a newline character is specified in a xindy style file using
In addition, if you are using a package that makes
If you want greater control over the xindy style file than is available through the LaTeX commands provided by the glossaries package, you will need to edit the xindy style file. In which case, you must use
The xdy file created by
When you use xindy, you need to specify the language and encoding used (unless you have written your own custom xindy style file that defines the relevant alphabet and sort rules). If you use makeglossaries, this information is obtained from the document’s auxiliary (aux) file. The makeglossaries script attempts to find the xindy language name given your document settings, which may not match the babel or polyglossia name, using set of known mappings.
The default is to use
In the event that makeglossaries gets the language name wrong or if xindy doesn’t support that language, then you can specify the required language using:
The default codepage will be obtained from the value of
Again, makeglossaries will try to adjust the codepage for known cases, but it may get it wrong. Neither makeglossaries-lite nor the automake option will make those adjustments.
If the default is incorrect, you can specify the correct codepage using:
In the event that you want one glossary sorted with
If you write your own custom xindy style file that includes the language settings, you need to set the language to nothing:
If you use xindy, the glossaries package needs to know which counters you will be using in the number list in order to correctly format the xindy style file. Counters specified using the counter package option or the option of
Xindy attributes normally correspond to the encap when using the standard
The most likely xindy attributes (such as
Note that
This command is provided for each counter that has been identified either by the counter package option, the option for
Take care if you have multiple instances of the same location with different formats. The duplicate locations will be discarded according to the order in which the attributes are listed. Consider defining semantic commands to use for primary references. For example:
If the locations include robust or protected formatting commands, then you need to add a location style using the appropriate xindy syntax using:
Note that if I have further decided to use the hyperref package and want to redefine
Suppose I want a rather eccentric page numbering system that’s represented by the number of dots on dice. The stix package provides
The sample file samplexdy.tex, which comes with the glossaries package, uses the default page counter for locations, and it uses the default
Suppose I want the page numbers written as words rather than digits and I use the fmtcount package to do this. I can redefine
The internal definition of
A more recent change to fmtcount (v3.03) now puts three instances of
Instead of directly using
The sample file samplexdy3.tex illustrates this.
In the number list, the locations are sorted according to the list of provided location classes. The default ordering is:
This ordering can be changed using:
If a number list consists of a sequence of consecutive numbers, the range will be concatenated. The number of consecutive locations that causes a range formation defaults to 2, but can be changed using:
The glossary is divided into groups according to the first letter of the sort key. The glossaries package also adds a number group by default, unless you suppress it in the xindy package option. For example:
With the default glsnumbers=true, the number group will be placed before the “A” letter group. This is done in the
If you are not using a Roman alphabet, you need to change this with:
A starred version of this command was added to v4.33 which sanitized xdy file to protect it from expansion with inputenc. This shouldn’t be necessary with recent LaTeX kernels.
Alternatively you can use:
For example:
This section describes the utility commands provided with the base glossaries package.
The hyperref package needs to be loaded before glossaries to ensure that the commands provided by hyperref are only used if they have been defined.
The commands that normally create a hyperlink will use:
The internal command used by
The internal command used by
The corresponding command that’s used to link to this target is:
Both the above target and link commands have a corresponding hook that does nothing by default. These commands are not used if hyperlinks have been disabled (or if hyperref has not been loaded).
The “value” part of the label (that is, the text produced with
These commands may be used to perform a case change.
An expandable command that converts uppercase (all caps). This is used by commands such as
An expandable command that converts lowercase. This isn’t used by the glossaries package, but you may find it useful with acronym or abbreviation font commands for small caps styles. This command is affected by
This command is used by sentence case commands, such as
This command is actually defined by mfirstuc v2.08+, but if an old version of mfirstuc is installed, the glossaries package will provide the same command. This command is affected by
Converts sentence case. This is used by commands such as
The default definition is to use the robust
Note that
The reason for the use of
This is because the LaTeX3 kernel command used by
Suppose a document created with mfirstuc v2.07 had something like:
However, with mfirstuc v2.08 and mfirstuc=expanded this would end up as:
The use of
Converts title case. The default definition is to use the robust
This uses
This uses
This uses
This uses
This checks if the glossary given by exists (that is, if it has been defined). If it does exist is performed, otherwise .
The unstarred form will treat ignored glossaries as non-existent. The starred form will consider them as existing. So both forms will do if was defined by
For example, given:
This checks if the glossary entry given by exists. If it does exist then is performed, otherwise this does . Simply uses etoolbox’s
Tests the entry’s first use flag. If the entry has been used, will be done, otherwise (if the entry has been defined) will be done. If the entry isn’t defined, then an undefined error will occur and neither nor will be done (see §7).
This means that
This does entries in the same glossary as had parent={. This is inefficient and time-consuming if there are a large number of entries defined. Uses }
This does parent field is non-empty for the entry identified by . Uses
A robust command that does symbol field is non-empty and not
A robust command that does long field is non-empty and not
A robust command that does short field is non-empty and not
Expands to description is empty for the entry identified by , otherwise expands to . Compare with:
There are also commands available for arbitrary fields. Some may allow the field to be identified by its corresponding key (such as description) but some require the internal field label (such as desc). See Table 4.1 for the internal field labels that correspond to each key. If you provide your own keys, for example with
This robust command tests the value of the field given by internal field label.
If the field value is empty or
Within
The result may vary depending on whether or not expansion was on for the given field when the entry was defined (see §4.4). For example:
The reverse happens in the following:
You can test if the value of a field is equal to the replacement text of a command using:
For example:
The second case produces “FALSE” since the value of the useri field (“
If we add:
There is a similar command that requires the control sequence name (without the leading backslash) instead of the actual control sequence:
Sometimes it’s necessary to measure the width or height of some text. For example,
Measuring can be performed using
The following measuring commands locally disable indexing, the unset/reset commands, and
You can test if content is inside an area that’s being measured with:
If tabularx is loaded, its
In addition to the commands described in §5.2, the commands described in this section may also be used to fetch field information.
This robust command fetches the value of the field identified by its internal field label for the entry identified by and stores it in the given command . An error will occur if the entry doesn’t exist or if the field hasn’t been defined.
This command simply assigns the supplied command internal field label for the entry identified by . This differs from
For example, to store the description for the entry whose label is “apple” in the control sequence
You can change the value of a given field using one of the following commands. Note that these commands only change the value of the given field. They have no affect on any related field. For example, if you change the value of the text field, it won’t modify the value given by the name, plural, first or any other related key.
In all the four related commands below, internal field label. The argument is the new value of the field. Both the entry and field must already be defined. If you want internal fields that don’t require a corresponding key to be defined, you will need the supplementary commands provided by glossaries-extra.
The glossaries-prefix package that comes with the glossaries package provides additional keys that can be used as prefixes. For example, if you want to specify determiners (such as “a”, “an” or “the”). The glossaries-prefix package automatically loads the glossaries package and has the same package options.
The extra keys for
The prefix associated with the text key. This defaults to nothing.
The prefix associated with the plural key. This defaults to nothing.
The prefix associated with the first key. If omitted, this defaults to the value of the prefix key.
The prefix associated with the firstplural key. If omitted, this defaults to the value of the prefixplural key.
Note that I’ve had to explicitly insert a space after the prefix since there’s no designated separator between the prefix and the term being referenced. This not only means that you can vary between a breaking space and non-breaking space, but also allows for the possibility of prefixes that shouldn’t have a space, such as:
In the event that you always require a space between the prefix and the term, then you can instead redefine
The prefixes can also be used with acronyms. For example:
The glossaries-prefix package provides convenient commands to use these prefixes with commands such as
Each of the following commands
The all caps commands
The sentence case commands
The usual
The prefixfirst key on first use or the prefix key on subsequent use.
The prefixfirstplural key on first use or the prefixplural key on subsequent use.
As
As
The prefixfirst key on first use or the prefix key on subsequent use.
The prefixfirstplural key on first use or the prefixplural key on subsequent use.
This package also provides the commands described below, none of which perform any check to determine the entry’s existence.
There are also variants that convert to sentence case. As with command like
Limited accessibility support is provided by the accompanying glossaries-accsupp package, but note that this package is experimental. This package automatically loads the glossaries package. Any options are passed to glossaries (if it hasn’t already been loaded). For example:
The glossaries-accsupp package defines additional keys that may be used when defining glossary entries. If a key isn’t set, then there will be not accessibility support for the corresponding field.
The value of this key is the replacement text corresponding to the name key.
The value of this key is the replacement text corresponding to the text key.
The value of this key is the replacement text corresponding to the first key.
The value of this key is the replacement text corresponding to the plural key.
The value of this key is the replacement text corresponding to the firstplural key.
The value of this key is the replacement text corresponding to the symbol key.
The value of this key is the replacement text corresponding to the symbolplural key.
The value of this key is the replacement text corresponding to the description key. The corresponding internal field label is descaccess.
The value of this key is the replacement text corresponding to the descriptionplural key. The corresponding internal field label is descpluralaccess.
The value of this key is the replacement text corresponding to the long key.
The value of this key is the replacement text corresponding to the longplural key.
The value of this key is the replacement text corresponding to the short key.
If you define acronyms with
The value of this key is the replacement text corresponding to the shortplural key.
The value of this key is the replacement text corresponding to the user1 key. The corresponding internal field label is useriaccess.
The value of this key is the replacement text corresponding to the user2 key. The corresponding internal field label is useriiaccess.
The value of this key is the replacement text corresponding to the user3 key. The corresponding internal field label is useriiiaccess.
The value of this key is the replacement text corresponding to the user4 key. The corresponding internal field label is userivaccess.
The value of this key is the replacement text corresponding to the user5 key. The corresponding internal field label is uservaccess.
The value of this key is the replacement text corresponding to the user6 key. The corresponding internal field label is userviaccess.
For example:
The sample file sampleaccsupp.tex illustrates the glossaries-accsupp package.
The
There are two commands pre-defined:
These helper commands all internally use:
The PDF element tag. The PDF specification identifies three different types of replacement text:
You can define your own custom helper commands for specific fields that require them. For example:
These robust commands are all in the form
There are commands analogous to
Currently there’s only support for accsupp. If you want to experiment with another package that provides accessibility support, define the following command before glossaries-accsupp is loaded:
The glossaries package is provided with some sample documents that illustrate the various functions. These should be located in the samples subdirectory (folder) of the glossaries documentation directory. This location varies according to your operating system and TeX distribution. You can use texdoc to locate the main glossaries documentation. For example:
If you can’t find the sample files on your computer, they are also available from your nearest CTAN mirror at http://mirror.ctan.org/macros/latex/contrib/glossaries/samples/. Each sample file listed below has a hyperlink to the file’s location on the CTAN mirror.
The glossaries-extra package and bib2gls provide some additional sample files. There are also examples in the Dickimaw Books Gallery.
If you prefer to use UTF-8 aware engines (xelatex or lualatex) remember that you’ll need to switch from fontenc & inputenc to fontspec where appropriate.
If you get any errors or unexpected results, check that you have up-to-date versions of all the required packages. (Search the log file for lines starting with “
Note that if the file name contains spaces, you will need to use the double-quote character to delimit the name.
The acronym package option creates a second glossary with the label
If for some reason you don’t want to use makeglossaries or makeglossaries-lite and you want the acronym package option then the complete build process is:
There are three other files that can be used as minimal working examples: mwe-gls.tex, mwe-acr.tex and mwe-acr-desc.tex.
Next, replace:
If you prefer to replace
As mentioned earlier, the acronym package option creates a new glossary with the label
You may instead prefer to use the abbreviations package option, which creates a new glossary with the label
If you use both the acronym and abbreviations package options then
The abbreviation style command must go before
sampleDB.tex This document illustrates how to load external files containing the glossary entry definitions. It also illustrates how to define a new glossary type. This document has the number list suppressed and uses
Instead of using makeglossaries you need to use bib2gls when you build the document:
If you want letter groups, you need to use the --group switch:
See also bib2gls gallery: sorting, glossaries-extra and bib2gls: An Introductory Guide and the bib2gls user manual.
sampleAcr.tex This document has some sample acronyms. It also adds the glossary to the table of contents, so an extra run through LaTeX is required to ensure the document is up to date:
Note that if the glossary is at the start of the document and spans across multiple pages, then this can cause the locations to be shifted. In that case, an extra makeglossaries and LaTeX call are required. In this particular example, the glossary is at the end of the document so it’s not a problem. It’s also not a problem for a glossary at the start of the document if the page numbering is reset at the end of the glossary. For example, if the glossary is at the end of the front matter in a book-style document.
This document uses
If you want to use glossaries-prefix, you can simply add the prefix package option.
Note that the toc package option has been dropped. This is the default with glossaries-extra, so it doesn’t need to be specified now. The document build is now shorter:
The other different default setting is the post-description punctuation. The base package has nopostdot=false as the default. This means that a full stop (period) is automatically inserted after the description in the glossary. The extension package has nopostdottrue as the default. If you want the original behaviour then you can use nopostdot=false or the shorter synonym postdot.
The glossaries-extra package has different abbreviation handling that’s far more flexible than that provided by the base glossaries package. The style now needs to be set with
Finally, you need to replace
Again the style command needs to be changed:
As with the previous example, if you prefer to use
The glossaries-extra package provides two additional cross-referencing keys seealso and alias, so
Finally, as with the previous example, you need to replace
Next replace
If the sort field is missing (which should usually be the case), then both
Remember to delete any
Note that it’s now much easier to revert back to the descriptionless style used in sampleAcr.tex:
You may prefer to use the short-sc-postfootnote-desc style instead. There are subtle differences between the postfootnote and footnote set of styles. Try changing the abbreviation style to short-sc-footnote and compare the position of the footnote marker with the two styles.
This modified sample file now has a shorter build:
The short-sc-footnote-desc abbreviation style is the closest match to the requirement, so replace the
Next some adjustments need to be made to fit the new requirements. The name needs to be
You may prefer to replace
In the original sampleCustomAcr.tex source code, I started the description with a capital:
If you prefer to use
In the original sample-FnDesc.tex file, the entry format was adjusted with:
The first paragraph in the document is:
It would look tidier if the footnote marker could be shifted after the full stop. “First use: sample.¹” This can easily be achieved with a minor modification:
This new custom style now needs to be set:
The name now needs to be the long form followed by the short form in parentheses, but note the new requirement that the short form should now be in all caps not small caps and the long form should start with a capital letter.
The category key is set to “initials” for the initialisms (which are defined with the custom
The first use is governed by the retainfirstuseperiod category attribute. If set, the period won’t be discarded if it follows the first use of commands like
The insertdots category attribute can automatically insert dots into the short form with a final space factor adjustment:
The custom helper command defined in the example needs to be slightly modified:
The “laser” definition remains unchanged:
See the glossaries-extra user manual for further details about category attributes and post-link hooks.
Finally, the
You may notice that the spacing after “e.g.” and “i.e.” isn’t correct. This is similar to the sample-dot-abbr.tex example where the space factor needs adjusting. In this case I’ve inserted the dots manually (rather than relying on the insertdots attribute). You can either remove the dots and use insertdots with discardperiod:
You don’t have to use the acronym category. You may prefer a different label that fits better semantically. For example:
Unfortunately it’s not always possible to split the link name into a prefix and location. That happens with the equation counter in certain classes, such as the report class (which is used in this example). This means that it’s necessary to redefine
Each glossary entry represents a mathematical symbol. This means that with Options 1, 2 and 3 it’s necessary to use the sort key. For example:
Note that the sort key has been omitted. This is because it typically shouldn’t be used. The difference between using
Next replace
Finally, replace
The link text here is almost identical to the description. The only difference is that the description starts with a capital (sentence case). If it started with a lowercase character instead, I could simply use
It’s a bit cumbersome typing
There are three other instances of
With the base glossaries package, one simple solution that works for this example is to save just the function symbol in the symbol field, for example:
The glossaries-extra package provides another possibility. It requires a command that takes a single argument, for example:
Another approach is to store the parameterless function in the symbol key (as earlier) and have a more generic command that uses this symbol. This requires the entry label, which can be obtained with
So the entry now needs the parameterless function in symbol and the control sequence name of this generic command in user1. For example:
You may want to consider providing helper commands to make the functions easier to define. For example:
Note that in
Now
Similarly
Note that bib2gls allows you to separate the locations in the number list into different groups according to the counter used for the location. This can be done with the loc-counters resource option. It’s also possible to identify primary formats (such as hyperbf used in this example) using the primary-location-formats option. The primary locations can then be given a more prominent position in the number list. See the bib2gls user manual for further details.
In this case, it’s caused by three references to the “ident” entry in section 2.1:
If you use the makeglossaries Perl script it will detect the warnings in the makeindex transcript file and attempt to fix the conflict by removing entries from the glo file:
If you use makeglossaries-lite or call makeindex directly then the problem won’t be fixed and the glossary will end up with the rather odd number list for the identity matrix entry consisting of three references to section 2.1: the first in the default font, followed by bold (hyperbf) and then italic (hyperit), which results in 2.1, 2.1, 2.1. If you use makeglossaries then only the bold entry (2.1) will be present. However, if you don’t want the problem corrected, call makeglossaries with the -e switch.
If you switch to xindy:
With bib2gls, you can supply rules to deal with location format conflicts, as illustrated below.
The entry definitions now need to be converted into bib2gls format and saved in a bib file (say, entries.bib). You can use convertgls2bib:
Next replace
Finally, replace
It would be better if the conflict could be merged into a single location that was both bold and italic. To achieve this, it’s first necessary to define a command that produces this effect:
If you try out this example, notice the difference between record=only and record=nameref. If you use the latter, the locations will now be the section titles rather than the section numbers. If you use the record=nameref setting you can customize the location by defining the command:
In this case the counter is section, so the command should be
See also sampleSort.tex in §18.5, which has three glossaries.
(The optional argument is the file extension of the indexing transcript file, which glossaries doesn’t need to know about (unless automake is used), but it writes the information to the aux file for the benefit of makeglossaries and makeglossaries-lite.)
If you switch to a different indexing option then these file extensions aren’t required, in which case it’s simpler to use the starred form:
This example uses a label prefixing system to differentiate between the different types of entries. (If you use babel with a language that makes
The glossaries-extra package provides a way of defining commands like
If you want to convert this document to use bib2gls, remember that you need the record or record=nameref option. For example:
Now you can replace
Regardless of how many resource sets the document contains, only one bib2gls call is required:
You may notice that the ordering in the notations list has changed from the original. This is because the sort field was automatically removed by convertgls2bib, so the entries are now sorted according to the name field (since they are defined with
For this trivial document, this kind of dual entry is redundant and unnecessarily leads the reader down a trail, first to the list of acronyms and from there the reader then has to go to the
There are, however, uses for repeating entries across multiple lists. For example, this user manual defines all described commands (such as
With
Assuming that your entries.bib file just contains
Then remove the definition of
If, instead, your entries.bib file contains separate
Dual entries make much more sense when one entry is for a glossary with the description displayed but no number list (or just a primary location), and the other is for the index without the description but with a number list. This can be created by replacing
Unlike the previous example (sample-dual.tex), there’s no link between these two entries. If the document only uses
This would be more flexible, and much briefer, if these entries were defined using bib2gls’s dual entry system combined with the glossaries-prefix package:
With
Now that the determiner has been moved out of the description, it won’t show in the glossary. However, it’s possible to include it by providing a command to encapsulate the description (which can also apply the language change as well).
Remember to remove
Other refinements that you might like to make include using
In the document (samplePeople.tex) you now need to delete
This again leads to a list sorted by surname. The reason this works is because bib2gls only sees the definition of
See also the “Examples” chapter of the bib2gls user manual, which provides another “people” example and Aliases.
In this example, the sort hook is adjusted to ensure the list of notation is sorted according to the order of definition. A new counter is defined to keep track of the entry number:
The custom counter and redefinition of
This means that makeindex only needs to process the
The document build doesn’t need the third LaTeX call now (since none of the glossaries extend beyond a page break):
If you are explicitly calling makeindex then you need to drop the call for the
For this example, it’s simpler to split the entries into different files according to the glossary type. This can be done with the --split-on-type or -t switch:
Finally, replace the lines that display the glossaries with:
In this case, I have one resource command that processes two glossaries (
See also sampleNtn.tex, bib2gls gallery: sorting and the bib2gls user manual for more examples.
One of the entries has its name encapsulated with a semantic command:
The homograph entries “glossary” and “bravo” are defined as sub-entries that inherit the name from the parent entry. The parent entry doesn’t have a description, but with the default nopostdot=false setting this will lead to a spurious dot. This can be removed by adding
Since the child entries have the same name as the parent, this means that the child entries will have duplicate sort values unless the default is changed with the sort key:
You may now want to consider replacing
You may have noticed that some of the descriptions include the plural form, but it’s not done very consistently. For example:
With glossaries-extra, you can remove this parenthetical material and implement it using the category post-description hook instead. For example, the above definitions become:
The “bravo” homographs are an oddity where the singular form is identical but the plural is different (“bravos” and “bravoes”). In the original, both descriptions included the plural term. The above modifications drop the display of the regular “bravos” plural (for the “bravocry” term) and only show the “bravoes” plural (for the “bravoruffian” term). In this particular case it might be useful to show the regular plural in order to highlight the difference.
While it’s straightforward to access an entry’s parent label (with
With bib2gls, it’s possible to save this information with the save-child-count and save-sibling-count, which not only save the total but also save the child or sibling labels in an etoolbox internal list. This makes the information much faster to access and also only includes the labels of those entries that have actually been indexed.
In the above, the comment line:
Note that this assumes that the parent entry hasn’t had the plural form explicitly set to “bravoes” instead of the default “bravos”. In that case, the parent entry would show the plural but the “bravoruffian” child entry wouldn’t show the plural (since this case would led to the empty code block identified with the comment “child and parent plurals the same”). The “bravoes” plural form would instead be shown for the parent, which wouldn’t look right.
If you don’t use bib2gls or if you use it without the save-sibling-count resource option then the sibling information won’t be available.
The sort field typically shouldn’t be set when using bib2gls, so convertgls2bib strips it. If the sort field is missing, bib2gls will obtain it from the sort fallback for that entry type. In this case,
Therefore the “Perl” entry is simply defined as:
The homograph entries have also had their sort fields omitted:
This means that the sort value for both these child entries is “glossary”. When bib2gls encounters identical sort values it acts according to its identical-sort-action setting. The default action is to sort by the label using a simple string comparison. In this case, it would put “glossarycol” before “glossarylist”. In the original document, the sort value was manually chosen to ensure that the entries are ordered according to first use. This ordering can easily be obtained by changing bib2gls’s identical sort action (requires at least bib2gls v2.0):
Note that this is a better solution than in the original example. If I edit the document so that “glossarycol” is used first, then the ordering will be updated accordingly, but with the original example, the sort keys would need to be manually changed.
The remainder of the document preamble (that is, the definition of
Finally, replace
Note that you can’t use the order=letter package option with bib2gls. Instead use the break-at=none resource option:
This sample document doesn’t require any of the tabular styles so I’ve prevented those packages from being loaded with nolong and nosuper. The reduces the overall package loading and reduces the potential of package conflict.
This is obviously a contrived example since it’s strange to have the symbol names (such as “Sigma”) in the glossary. The purpose is to demonstrate the alttreehypergroup with an entry that’s noticeably wider than the others in the same hierarchical level. A more sensible document would have the symbol in the name key.
This example document is using top-level entries for topics without descriptions. This means that the descriptions simply contain
In order to distinguish between the child entries, which are symbols, and the parent entries, which are topics, it’s useful to give these two different types of entries different categories. The topics can use the default general category, but the symbol entries can be assigned to a different category. The value of the category key must be a label. For example:
There is some redundancy caused by a parenthetical note after the first use in some of the symbol entries. For example:
With glossaries-extra, it’s now possible to use the topic styles provided with the glossary-topic package:
Since there’s no description for the top-level entries, the topic style ignores the widest name setting for the top-level, so I can just have the level 1 setting:
This means that the
This produces the same result as with just glossaries-extra and makeglossaries. However, there are some modifications that can be made to the bib file to make it neater.
The top-level entries are defined as:
Now let’s assume that the symbol entries are defined in a more rational manner, with the actual symbol in the name field. For example:
If you make these changes and rebuild the document, you’ll find that the order has changed. Now the “sigma” entry is before the “pi” entry. This is because bib2gls is obtaining the sort values from the name field, which is the sort fallback for
If you change
You can further tidy the bib file by removing the category fields. For example:
You can make the bib files even more flexible by introducing field and entry aliases with field-aliases and entry-type-aliases. See the bib2gls manual for further details.
Note that “marrow” is included in the glossary even though it hasn’t been referenced in the text. This is because the see key automatically triggers
In order to prevent the “marrow” entry from being automatically being added to the glossary as a result of the cross-reference, you can use autoseeindex=false to prevent the automatic indexing triggered by the see key (or the seealso key provided by glossaries-extra).
Note that the “fruit” entry is still included even though it hasn’t been used in the document. This is because it was explicitly indexed with
The entries that contains see[
The original example redefines the cross-referencing format to use small caps:
Now change the selection criteria:
The fruit and zucchini use the see key which is a simple redirection for the reader. There’s no number list for either of these entries. Whereas marrow uses the seealso key, which is typically intended as a supplement to a number list but in this case there are no locations as marrow hasn’t been used in the text.
With at least v2.0, there’s an alternative:
The entries are then defined as follows:
Each custom key is provided a set of commands analogous to
If you find yourself wanting to create a lot of custom keys that produce minor variations of existing keys (such as different tenses) you may find it simpler to just use
The document build is now:
The custom storage key is called abbrtype which defaults to “word” if not explicitly set. Its value can be accessed with the provided custom command
This essentially forms a very similar function to the glossaries-extra package’s category key, which is also defined as a storage key:
Most of the earlier makeindex sample files can be adapted to use xindy instead by adding the xindy package option. Situations that you need to be careful about are when the sort value (obtained from the name if the sort key is omitted) contains commands (such as name={
This document has an exotic numbering system which requires the package option esclocations=true. Before glossaries v4.50, this was the default setting, but the default is now esclocations=false, so this package option now needs to be set explicitly.
By default, this document will create a xindy style file called samplexdy.xdy, but if you uncomment the lines
To create the document do:
This document creates a new command to use with the format key in the optional argument of commands like
In order to illustrate unusual location formats, this sample document provides a command called
An associated command
This custom location format also needs to be identified in the xdy file so that xindy can recognise it and determine how to form ranges if required.
When xindy creates the associated indexing files, the locations will be written using:
Remember that in both cases, the second argument #2 is in the form
If you want to try out the samplexdy-mc.xdy file, the entries starting with “Mac” or “Mc” will be placed in their own “Mc” letter group. Ideally it should be possible to do this simply with
This “Mc” group is suitable for names like “Maclaurin” but not for “Mach”. To prevent this, the sort key for that value is set to lower case:
The definitions of
The entries all need to be converted to the bib format required by bib2gls.
Finally, replace
This results in a slightly different ordering from the original document (without the “Mc” letter group). In the original example, “Mach number” was listed before “Mach, Ernest”. The modified document now has “Mach, Ernest” before “Mach number”. This difference is due to bib2gls’s default break-at=word setting, which marks word boundaries with the
If you want the “Mc” letter group, it can be obtained by providing a custom sort rule:
One way to get around this problem is to define a custom command to help identify genuine “Mc”/“Mac” prefixes with names that happen to start with “Mac”. For example:
So add the first definition of
The custom sort rule needs to be modified:
Other alternatives include moving
The document build is:
With unusual numbering systems, it’s sometimes better to use record=nameref:
If you remove the xindy option from sampleutf8.tex and do:
The entries need to be converted to the bib format required by bib2gls:
Next replace
Iterative commands like
Finally, replace
The document language, if it has been set, is also added to the aux file when the record option is used. In this case, no language package has been used, so bib2gls will fallback on the system’s default locale. If no sort method is set, the entries will be sorted according to the document language, if set, or the default locale. You can specify a specific locale using the sort key with a locale tag identifier. For example:
Notice also how the number lists can’t be compacted into ranges. For example, the list “1, 2, 3” would be converted to “1–3” with a proper indexing application (Options 2 or 3 or, with glossaries-extra, Option 4).
The larger the list of entries, the longer the document build time. This method is very inefficient for large glossaries. See Gallery: glossaries performance for a comparison.
This example uses the long4colheaderborder. This style doesn’t allow multi-line descriptions. You may prefer to use altlong4colheaderborder with long descriptions. However, in either case a style that uses booktabs is preferable. For example, long4col-booktabs or altlongragged4col-booktabs. Note that this requires glossary-longbooktabs, which needs to be explicitly loaded. The style can only be set once this package has been loaded:
This document contains both commands:
Note that you can’t use
If you switch to Option 1 (replace
This method works much better than using the savenumberlist option because bib2gls saves the formatted number list in the location field (which is provided by glossaries-extra for the benefit of bib2gls) and the unformatted number list in the loclist internal field (which is also used by Option 1).
With Options 2 and 3, both makeindex and xindy simply create a file containing the commands to typeset the glossary, which is input by
bib2gls, on the other hand, doesn’t write a file containing the glossary. It writes a file containing the entry definitions and uses internal fields to save the indexing information. The glossary is then displayed with
The
Note the difference if you use the record=nameref package option instead of just record.
With bib2gls v2.0+, you don’t need to manually insert the spaces at the end of the prefixes. Instead you can instruct bib2gls to insert them. To try this out, remove the trailing
Note that this example document is provided to demonstrate glossaries-accsupp as succinctly as possible. The resulting document isn’t fully accessible as it’s not tagged. See the accessibility and tagpdf packages for further information about tagging documents.
It’s not essential to use glossaries-accsupp. You can simply insert the replacement text directly into the field values. For example:
The acronym style is set using:
By way of comparison, there are some entries that are technically abbreviations but are defined using
The next entry is a symbol (the integration symbol \(\int \)). This could be defined simply as:
It would be better if the actual text was the Unicode character 0x222B. This would not only assist the text-to-speech system but also make it easier to copy and paste the text. The simplest method is to identify the character by its hexadecimal code, but in order to do this the
In order to determine whether to use “E”, “ActualText” or “Alt” for a particular field, glossaries-accsupp will check if the command
This means that in order to simply set symbolaccess to the hexadecimal character code, I need to provide a command called
The final entry has an image stored in the user1 key. (The image file is provided with the mwe package.) This should use “Alt” instead of “ActualText” so I need to define
The PDF can be inspected either by uncompressing the file and viewing it in a text editor or you can use a tool such as the PDFDebugger provided with PDFBox. If you do this you will find content like:
The first use of
If the
The style command
You may notice a slight difference from the original example if you use a version of glossaries-extra between 1.42 and 1.48. The shortaccess field shows ( ) instead of just . This is because glossaries-extra v1.42 redefined
Now that the extension package is being used, there are some other modifications that would tidy up the code and fix a few issues.
The “Doctor” and “Drive” entries should really be defined as abbreviations but they shouldn’t be expanded on first use. The short-nolong style can achieve this and it happens to be the default style for the acronym category. This means that you can simply replace the “Doctor” definition with:
The “Drive” entry can be similarly defined but it has the awkward terminating full stop. This means that I had to omit the end of sentence terminator in:
The category is simply a label that’s used in the construction of some internal command names. This means that it must be fully expandable, but I can choose whatever label I like (general, abbreviation, acronym, index, symbol and number are used by various commands provided by glossaries-extra).
In this case, I’ve decided to have a category called shortdotted to indicate an abbreviation that ends with a dot but only the short form is shown on first use:
The “e.g.” abbreviation similarly ends with a dot. It’s not usual to write “for example (e.g.)” in a document, so it really ought to have the same shortdotted category, but it has a long-short form for illustrative purposes in this test document. In this case I need to choose another category so that I can apply a different style. For example:
To further illustrate categories, let’s suppose the symbol and image should be in the name field instead of the symbol and user1 fields. Now the
I could provide category+field versions, such as
In addition to the sample files listed in §18, the glossaries package comes with some minimal example files, minimalgls.tex, mwe-gls.tex, mwe-acr.tex and mwe-acr-desc.tex, which can be used for testing. These should be located in the samples subdirectory (folder) of the glossaries documentation directory. The location varies according to your operating system and TeX installation. For example, on Linux it may be in /usr/local/texlive/2022/texmf-dist/doc/latex/glossaries/. The makeglossariesgui application can also be used to test for various problems. Further information on debugging LaTeX code is available at http://www.dickimaw-books.com/latex/minexample/.
If you have any problems, please first consult the glossaries FAQ. If that doesn’t help, try posting your query to somewhere like the comp.text.tex newsgroup, the LaTeX Community Forum or TeX on StackExchange. Bug reports can be submitted via my package bug report form.
Earlier versions of glossaries used this technique to write information to the files used by the indexing applications to prevent problems caused by fragile commands. Now, this is only used for the sort key.
Accessibility text corresponding to the name field. §17; 376
Behaves in a similar manner to see={[
The entry’s category (must be a simple label). §4; 135
If set, the value indicates the location counter to use by default when indexing this entry (overrides the counter associated with the glossary or the counter package option). §4; 135
The entry’s description, as displayed in the glossary. If required in the text, use
Accessibility text corresponding to the description field. §17; 377
The plural form of the entry’s description, if applicable. If omitted, this is set to the same value as the description, since descriptions tend not to be a singular entity. §4; 129
Accessibility text corresponding to the descriptionplural field. §17; 377
The entry’s text, as displayed on first use of
Accessibility text corresponding to the first field. §17; 377
The entry’s plural form, as displayed on first use of plural
Accessibility text corresponding to the firstplural field. §17; 377
The group label that identifies which letter group the entry belongs to. This key is only available with the record=only and record=nameref options, and is set by bib2gls, if invoked with --group or -g. Although this has a key, this is considered an internal key assigned by bib2gls as a by-product of sorting. Explicit use without reference to the order of entries can result in fragmented groups. The corresponding title can be set with
The formatted location list used by the “unsrt” family of commands. This key is only available with the record option and is set by bib2gls unless save-locationsfalse is set. Although it has an associated key, it’s usually considered an internal field.
A field that is set by
Accessibility text corresponding to the long field. §17; 377
As long but the plural form. §4; 135
Accessibility text corresponding to the longplural field. §17; 378
The entry’s name, as displayed in the glossary. This typically isn’t used outside of the glossary (the text and plural keys are used instead). However, if there is a need to specifically display the entry name, use
If set, suppress the location list for this entry. This is done by adding
The label of the entry’s parent (from which the entry’s hierarchical level is obtained). §4; 128
The entry’s plural form, as displayed on subsequent use of plural
Accessibility text corresponding to the plural field. §17; 377
The subsequent use singular prefix. §16; 368
The first use singular prefix. §16; 368
The first use plural prefix. §16; 368
The subsequent use plural prefix. §16; 368
With the base glossaries package this simply triggers an automatic cross-reference with
Behaves in a similar manner to see={[
A field that is set by
Accessibility text corresponding to the short field. §17; 378
As short but the plural form. The default is obtained by appending the acronym or abbreviation plural suffix. §4; 135
Accessibility text corresponding to the shortplural field. §17; 378
Specifies the value to use for sorting (overrides the default). This key is usually required for xindy if the name key only contains commands (for example, the entry is a symbol), but explicitly using this key in other contexts can break certain sort methods. Don’t use the sort field with bib2gls . §4; 130
The entry’s associated symbol (optional), which can be displayed with
Accessibility text corresponding to the symbol field. §17; 377
The plural form of the symbol, if applicable, which can be displayed with
Accessibility text corresponding to the symbolplural field. §17; 377
The entry’s text, as displayed on subsequent use of
Accessibility text corresponding to the text field. §17; 377
Assigns the entry to the glossary identified by . §4; 132
A generic field, which can be displayed with
Accessibility text corresponding to the user1 field. §17; 378
A generic field, which can be displayed with
Accessibility text corresponding to the user2 field. §17; 378
A generic field, which can be displayed with
Accessibility text corresponding to the user3 field. §17; 378
A generic field, which can be displayed with
Accessibility text corresponding to the user4 field. §17; 378
A generic field, which can be displayed with
Accessibility text corresponding to the user5 field. §17; 379
A generic field, which can be displayed with
Accessibility text corresponding to the user6 field. §17; 379
The location counter. §5.1.1; 162
The encap or control sequence name (without the leading backslash) that should be used to encapsulate the entry location. §5.1.1; 161
Determines whether or not the link text should have a hyperlink (provided hyperlinks are supported). §5.1.1; 161
Determines whether the hyperlink should be inside or outside of
If true use
If true this option will suppress indexing. If you are using bib2gls, you may want to consider using format=glsignore to prevent a location but ensure that the entry is selected. §5.1.1; 162
Determines whether or not to unset the first use flag after the link text. The value may be one of:
The prefix to use for the entry’s hyperlink target. §5.1.1; 163
Determines whether or not to reset the entry before the link text. Allowed values: none (no reset), local (localise the reset) and global. §5.1.1; 163
Determines whether or not to unset the entry before the link text. Allowed values: none (no unset), local (localise the unset) and global. §5.1.1; 163
The name of the control sequence to use instead of
Set the hyper location to this value instead of obtaining it from
Set the location to this value instead of obtaining it from the location counter. §5.1.1; 163
Only available with
Determines whether to do the indexing before or after the link text. Allowed values: before and after. §5.1.1; 162
If true, enable the entry counter. §8; 240
If true, treats all entries as though they have the same hierarchical level (the value of leveloffset). This option is only available for the “unsrt” commands. §8; 243
Enables letter group formation. This option is only available for the “unsrt” commands. Note that no groups will be formed when invoking bib2gls with the default --no-group, regardless of this setting. §8; 243
Adds
Set or increment the hierarchical level offset. If starts with
If true, suppress the gap implemented by some glossary styles between groups. §8; 240
Suppress the location list. Note that nonumberlist=true will have no effect with the save-locationsfalse resource option as there won’t be any location lists to display. Likewise if
If true, suppress the post-description punctuation. §8; 240
Indicates whether or not glossary section headers will be numbered and also if they should automatically be labelled. The numberedsection package option will change the default setting to match. §8; 240
Redefines
Only available with
Case-sensitive sort. 242
Order of definition. 241
Letter order. 242
Case-insensitive sort. 241
Word or letter order according to the order package option. 242
Order of use. 241
Word order. 242
Use the glossary style. §8; 240
If true, enable the sub-entry counter. §8; 240
If true, each entry in the glossary should have a hypertarget created, if supported by the glossary style and if hyperlinks are enabled. §8; 242
Sets the glossary title (overriding the default). §8; 239
Sets the glossary toc title (overriding the default). §8; 239
Identifies the glossary to display. §8; 239
Both the first use and subsequent use only show the long form and the description must be supplied. §6.2.1.5; 207
Both the first use and subsequent use only show the long form. §6.2.1.5; 207
A list style using the description environment with the entry’s description starting on a new line. §13.1.1; 298
A list style using the description environment with the entry’s description starting on a new line with letter group headings. §13.1.1; 298
A list style using the description environment with the entry’s description starting on a new line with letter group headings and a navigation line. §13.1.1; 298
A tabular style using longtable with 4 columns allowing for multi-lined descriptions, a header row and rules. §13.1.4; 307
A tabular style using longtable with 4 columns allowing a multiline description. §13.1.2; 302
A tabular style using longtable with 4 columns allowing a multiline description with border lines. §13.1.2; 302
A tabular style using longtable with 4 columns allowing a multiline description with a header row. §13.1.2; 302
A tabular style using longtable with 4 columns allowing a multiline description with a header row and border lines. §13.1.2; 302
A tabular style using longtable with 4 columns, a header row and rules, and ragged right formatting for the description. §13.1.4; 307
A tabular style using longtable with 4 columns and ragged right formatting for the description. §13.1.3; 304
A tabular style using longtable with 4 columns and ragged right formatting for the description and border lines. §13.1.3; 305
A tabular style using longtable with 4 columns and ragged right formatting for the description, and a header row. §13.1.3; 305
A tabular style using longtable with 4 columns and ragged right formatting for the description, border lines and a header row. §13.1.3; 305
A tabular style using supertabular with 4 columns allowing multiline descriptions. §13.1.5; 310
A tabular style using supertabular with 4 columns and a header row allowing multiline descriptions. §13.1.5; 310
A tabular style using supertabular with 4 columns, a header row and border lines allowing multiline descriptions. §13.1.5; 310
A tabular style using supertabular with 4 columns and ragged right formatting for the description. §13.1.6; 312
A tabular style using supertabular with 4 columns and border lines, and ragged right formatting for the description. §13.1.6; 312
A tabular style using supertabular with 4 columns and a header row, and ragged right formatting for the description. §13.1.6; 312
A tabular style using supertabular with 4 columns, a header row and border lines, and ragged right formatting for the description. §13.1.6; 312
A hierarchical style that shows the name, description and, if set, the symbol. The name is set in a box whose width is given by the widest name that has to be identified with
A hierarchical style with letter group headings that shows the name, description and, if set, the symbol. The name is set in a box whose width is given by the widest name that has to be identified with
A hierarchical style with letter group headings and navigation line that shows the name, description and, if set, the symbol. The name is set in a box whose width is given by the widest name that has to be identified with
Designed for indexes, the description isn’t shown.
A style similar to standard indexes but also shows the description and, if set, the symbol. §13.1.7; 314
A style similar to standard indexes with letter group headings but also shows the description and, if set, the symbol. §13.1.7; 315
A style similar to standard indexes with letter group headings and a navigation line but also shows the description and, if set, the symbol. §13.1.7; 315
An inline homograph style. §13.1.9; 320
A list style using the description environment. §13.1.1; 297
A list style with a dotted leader between the name and description. §13.1.1; 298
A list style using the description environment with letter group headings. §13.1.1; 298
A list style using the description environment with letter group headings and a navigation line. §13.1.1; 298
A tabular style using longtable with 2 columns a header row and rules. §13.1.4; 307
Tabular style with 4 columns.
Tabular style with 2 columns.
A tabular style using longtable with 2 columns. §13.1.2; 300
A tabular style using longtable with 3 columns a header row and rules. §13.1.4; 307
A tabular style using longtable with 3 columns. §13.1.2; 301
A tabular style using longtable with 3 columns and border lines. §13.1.2; 301
A tabular style using longtable with 3 columns and a header row. §13.1.2; 301
A tabular style using longtable with 3 columns, a header row and border lines. §13.1.2; 301
A tabular style using longtable with 4 columns a header row and rules. §13.1.4; 307
A tabular style using longtable with 4 columns. §13.1.2; 301
A tabular style using longtable with 4 columns and border lines. §13.1.2; 301
A tabular style using longtable with 4 columns and a header row. §13.1.2; 301
A tabular style using longtable with 4 columns, a header row and border lines. §13.1.2; 302
A tabular style using longtable with 2 columns and border lines. §13.1.2; 300
A tabular style using longtable with 2 columns and a header row. §13.1.2; 300
A tabular style using longtable with 2 columns, a header row and border lines. §13.1.2; 300
A tabular style using longtable with 2 columns, a header row and rules, and ragged right formatting for the description. §13.1.4; 307
A tabular style using longtable with 2 columns and ragged right formatting for the description. §13.1.3; 303
A tabular style using longtable with 3 columns, a header row and rules, and ragged right formatting for the description. §13.1.4; 307
A tabular style using longtable with 3 columns and ragged right formatting for the description. §13.1.3; 304
A tabular style using longtable with 3 columns and ragged right formatting for the description and border lines. §13.1.3; 304
A tabular style using longtable with 3 columns and ragged right formatting for the description, and a header row. §13.1.3; 304
A tabular style using longtable with 3 columns and ragged right formatting for the description, border lines and a header row. §13.1.3; 304
A tabular style using longtable with 2 columns and ragged right formatting for the description and border lines. §13.1.3; 303
A tabular style using longtable with 2 columns and ragged right formatting for the description, and a header row. §13.1.3; 304
A tabular style using longtable with 2 columns and ragged right formatting for the description, border lines and a header row. §13.1.3; 304
A multicolumn hierarchical style that shows the name, description and, if set, the symbol. The name is set in a box whose width is given by the widest name that has to be identified with
A multicolumn hierarchical style with letter group headings that shows the name, description and, if set, the symbol. The name is set in a box whose width is given by the widest name that has to be identified with
A hierarchical style with letter group headings and navigation line at the start of the first column that shows the name, description and, if set, the symbol. The name is set in a box whose width is given by the widest name that has to be identified with
A hierarchical style with letter group headings and navigation line spanning all columns that shows the name, description and, if set, the symbol. The name is set in a box whose width is given by the widest name that has to be identified with
A multicolumn style similar to standard indexes but also shows the description and, if set, the symbol. §13.1.8; Table 13.2
A multicolumn style similar to standard indexes with letter group headings but also shows the description and, if set, the symbol. §13.1.8; Table 13.2
A multicolumn style similar to standard indexes with letter group headings and a navigation line at the start of the first column but also shows the description and, if set, the symbol. §13.1.8; Table 13.2
A multicolumn style similar to standard indexes with letter group headings and a navigation line spanning all columns but also shows the description and, if set, the symbol. §13.1.8; Table 13.2
A multicolumn hierarchical style that shows the name, description and, if set, the symbol. §13.1.8; Table 13.2
A multicolumn hierarchical style with letter group headings that shows the name, description and, if set, the symbol. §13.1.8; Table 13.2
A multicolumn hierarchical style with letter group headings and navigation line at the start of the first column that shows the name, description and, if set, the symbol. §13.1.8; Table 13.2
A multicolumn homograph style that shows the top-level name, description and, if set, the symbol, but omits the name for sub-entries. §13.1.8; Table 13.2
A multicolumn homograph style with letter group headings that shows the top-level name, description and, if set, the symbol, but omits the name for sub-entries. §13.1.8; Table 13.2
A multicolumn homograph style with letter group headings and navigation line at the start of the first column that shows the top-level name, description and, if set, the symbol, but omits the name for sub-entries. §13.1.8; Table 13.2
A multicolumn homograph style with letter group headings and navigation line spanning all columns that shows the top-level name, description and, if set, the symbol, but omits the name for sub-entries. §13.1.8; Table 13.2
A multicolumn hierarchical style with letter group headings and navigation line spanning all columns that shows the name, description and, if set, the symbol. §13.1.8; Table 13.2
A list style with just the name for top-level entries and a dotted leader between the name and description for sub-entries. §13.1.1; 299
A tabular style using supertabular with 2 columns. §13.1.5; 308
A tabular style using supertabular with 3 columns. §13.1.5; 309
A tabular style using supertabular with 3 columns and border lines. §13.1.5; 309
A tabular style using supertabular with 3 columns and a header row. §13.1.5; 309
A tabular style using supertabular with 3 columns, a header row and border lines. §13.1.5; 309
A tabular style using supertabular with 4 columns. §13.1.5; 309
A tabular style using supertabular with 4 columns and border lines. §13.1.5; 309
A tabular style using supertabular with 4 columns and a header row. §13.1.5; 309
A tabular style using supertabular with 4 columns, a header row and border lines. §13.1.5; 309
A tabular style using supertabular with 2 columns and border lines. §13.1.5; 308
A tabular style using supertabular with 2 columns and a header row. §13.1.5; 308
A tabular style using supertabular with 2 columns, a header row and border lines. §13.1.5; 308
A tabular style using supertabular with 2 columns and ragged right formatting for the description. §13.1.6; 311
A tabular style using supertabular with 3 columns and ragged right formatting for the description. §13.1.6; 312
A tabular style using supertabular with 3 columns and border lines, and ragged right formatting for the description. §13.1.6; 312
A tabular style using supertabular with 3 columns and a header row, and ragged right formatting for the description. §13.1.6; 312
A tabular style using supertabular with 3 columns, a header row and border lines, and ragged right formatting for the description. §13.1.6; 312
A tabular style using supertabular with 2 columns and border lines, and ragged right formatting for the description. §13.1.6; 311
A tabular style using supertabular with 2 columns and a header row, and ragged right formatting for the description. §13.1.6; 311
A tabular style using supertabular with 2 columns, a header row and border lines, and ragged right formatting for the description. §13.1.6; 311
Designed for paragraph length top-level descriptions.
Designed for paragraph length top-level descriptions with sub-entries in multiple columns.
A hierarchical style that shows the name, description and, if set, the symbol. §13.1.7; 315
A hierarchical style with letter group headings that shows the name, description and, if set, the symbol. §13.1.7; 315
A hierarchical style with letter group headings and navigation line that shows the name, description and, if set, the symbol. §13.1.7; 315
A homograph style that shows the top-level name, description and, if set, the symbol, but omits the name for sub-entries. §13.1.7; 315
A homograph style with letter group headings that shows the top-level name, description and, if set, the symbol, but omits the name for sub-entries. §13.1.7; 315
A homograph style with letter group headings and navigation line that shows the top-level name, description and, if set, the symbol, but omits the name for sub-entries. §13.1.7; 316
This command is written to the aux file for the benefit of makeglossaries and makeglossaries-lite. The indicates the xindy codepage. §1.7.1; 69
This command is written to the aux file to provide the information for
This command is written to the aux file for the benefit of makeglossaries and makeglossaries-lite. The should be either
This command is written to the aux file to provide the
This command is written to the aux file to provide the
This command is written to the aux file to provide the
This command is written to the aux file for the benefit of makeglossaries and makeglossaries-lite. The is the name of the style file. §1.7.1; 68
This command is written to the aux file for the benefit of makeglossaries and makeglossaries-lite. The arguments indicate the file extensions associated with the given glossary. §1.7.1; 67
This command is written to the aux file for the benefit of makeglossaries and makeglossaries-lite. The is the language to pass to xindy for the given glossary. §1.7.1; 68
Expands to the title of the
A synonym for
A synonym for
A synonym for
A synonym for
A synonym for
A synonym for
A synonym for
A synonym for
A synonym for
A synonym for
A synonym for
A synonym for
As
As
References the acronym identified by . The text produced shows the full form, formatted according to the acronym style. With glossaries-extra, use
Used by
Used by
Used by
Deprecated with the introduction of
As
As
As
Used by
Used by
Used by
Deprecated with the introduction of
As
As
References the acronym identified by . The text produced is obtained from the long value. The argument will be inserted at the end of the link text. This command does not alter or depend on the first use flag. With glossaries-extra, use
As
As
References the acronym identified by . The text produced is obtained from the longplural value. The argument will be inserted at the end of the link text. This command does not alter or depend on the first use flag. With glossaries-extra, use
Used by acronym styles that require an additional description to determine what information is displayed in the name.
Used by acronym styles to format the acronym name. §6; 200
Used to encapsulate the acronym short form on subsequent use. §6.2.1; 201
Provided by glossaries if it hasn’t already been defined. Used as the default title for the glossary created by the acronyms option. §1.5.1; Table 1.2
Used by acronym styles in the acronym sort key. §6; 201
Expands to the label of the default acronym glossary. The acronym or acronyms package option will redefine this to
Suffix used in the default shortplural value by
As
As
References the acronym identified by . The text produced is obtained from the short value, formatted according to the acronym style. The argument will be inserted at the end of the link text. This command does not alter or depend on the first use flag. With glossaries-extra, use
As
As
References the acronym identified by . The text produced is obtained from the shortplural value, formatted according to the acronym style. The argument will be inserted at the end of the link text. This command does not alter or depend on the first use flag. With glossaries-extra, use
A synonym for
A synonym for
A synonym for
A synonym for
Adds the redefinition of
A shortcut that supplies file extensions based on the
Provided by glossaries if it hasn’t already been defined.
Locally appends preamble for the glossary identified by . If is omitted,
Delimiter used between locations in the location list, except for the last pair.
Delimiter used between the last pair of locations in the location list.
Converts title case, where may contain text-block commands. The starred form only permits a text-block command at the start of the argument. Limitations apply, see the mfirstuc documentation for further details, either:
Converts title case. Limitations apply, see the mfirstuc documentation for further details, either:
Like
Like
Format used by
Format used by
Like
Like
Format used by
Format used by
Defined by the
Deprecated with the introduction of
Deprecated with the introduction of
Identifies the list of glossaries as lists of acronyms. §2; 114
Deprecated with the introduction of
This was originally used to define a format the way the link text was displayed on first use by the
This was originally used to define a format the way the link text was displayed on first use by the
Defines the display format used by the
Provides the shortcut commands for acronyms. §2; 115
Used as a separator between locations. §12; 264
Used between the start and end of a location range. §12; 270
Deprecated with the introduction of
Deprecated with the introduction of
Provided by glossaries if it hasn’t already been defined. Used as a column header for some of the tabular-like glossary styles. §1.5.1; Table 1.2
Deprecated with the introduction of
Does
Formats the comma-separated list datatool documentation for further details, either:
Does datatool documentation for further details, either:
Deprecated with the introduction of
Provided by glossaries if it hasn’t already been defined. Used as a column header for some of the tabular-like glossary styles. §1.5.1; Table 1.2
Used to encapsulate the acronym short form on first use. §6.2.1; 201
Deprecated with the introduction of
Iterates overall all lists of abbreviations, defines the command
Iterates overall all glossaries that have been declared lists of acronyms, defines the command to the current label and does . §15; 356
Iterates overall all the glossary labels given in the argument, defines the command to the current label and does . If the optional argument is omitted, the list of all non-ignored glossaries is assumed. §15; 356
Does
Iterates over all entries in the given glossary and, at each iteration, defines the command to the current entry label and does . The optional argument is the glossary label and defaults to
As
Used by
Expands to the additional keys that need to be provided to
As
Used by
Expands to the prefix used for entry targets. §13.2.1; 325
Change allowed options that are defined or modified by the glossaries-extra package. Note that some options can only be passed as package options.
This isn’t actually defined as a command but is used as a keyword for makeindex. §12; 278
Encapsulations the number list in the glossary and is also used to save the number list with the savenumberlist option. This command is redefined by options such as nonumberlist or commands like
Does the header code after
Only provided if it hasn’t already been defined for backward-compatibility. Use
Provided by glossaries if it hasn’t already been defined. Used as the default title for glossaries without a specified title. May already be defined by a language package. §1.5.1; Table 1.2
Used at the end of the glossary. §8; 247
Used at the start of the glossary. This will be locally redefined to the preamble associated with the current glossary, if one has been set. §8; 246
Used to display the glossary heading. §8; 244
Sets the default glossary style to . Deprecated in v3.08a and removed in v4.50. Now only available with rollback. Use
Defined by
Defined by
Redefined by the glossary styles to display top level (level 0) entries. §13.2.3; 330
As
Used within glossary styles to display the description. §13.2.1; 326
As
Used within glossary styles to display the name encapsulated with
Behaves like
As
Used within glossary styles to display the symbol. §13.2.1; 326
As
As
References the entry identified by first use. The argument may be inserted at the end of the link text or may be inserted at a different point (for example, after the long form on first use for some acronym or abbreviation styles. For the first optional argument, see
Used by
Expands to the accessibility support engine. This command may be defined before glossaries-accsupp is loaded. §17; 386
Font formatting command for the short form, initialised by the abbreviation style.
Applies accessibility attribute for the given . This internally uses the accessibility support provided by accsupp. §17; 380
The sentence case version of
If accessibility support was enabled when glossaries-extra was loaded (accsupp) this will display the value of the long key with the accessibility support enabled for that key (longaccess). If there is no accessibility support, this just uses
The sentence case version of
If accessibility support was enabled when glossaries-extra was loaded (accsupp) this will display the value of the longplural key with the accessibility support enabled for that key (longpluralaccess). If there is no accessibility support, this just uses
If accessibility support was enabled when glossaries-extra was loaded (accsupp) this will display the value of the name key with the accessibility support enabled for that key (access). If there is no accessibility support, this just uses
If accessibility support was enabled when glossaries-extra was loaded (accsupp) this will display the value of the short key with the accessibility support enabled for that key (shortaccess). If there is no accessibility support, this just uses
If accessibility support was enabled when glossaries-extra was loaded (accsupp) this will display the value of the shortplural key with the accessibility support enabled for that key (shortpluralaccess). If there is no accessibility support, this just uses
Applies
Short plural suffix, this command is changed by acronym styles. §6; 191
Uses a non-breakable space if the short form is less than 3em. This command is redefined by glossaries-extra to use
Expands to the maximum width used by
Indexes the entry identified by §10; 253
Iterates over all non-ignored glossaries (or all those listed in the types option) and indexes each entry in the glossary. The optional argument are passed to
Iterates over all glossaries listed in (all all non-ignored glossaries if omitted) and indexes each entry (with format=glsignore) that hasn’t been used. This command can’t be used with bib2gls. Use the selection=all resource option instead. §10; 254
Does
Defines a new glossary entry key with the given default value and commands that are analogous to
Adds a new xindy letter group, identified by and defined by . This information is written to the xdy file that’s created by
Provides a new glossary entry key with a default value and a command for simply accessing the value (without indexing or hyperlinks). The starred version switches on field expansion for the given key. §4.3.2; 141
Adds the xindy attributes associated with to the xdy style file. §14; 340
Identifies all the location counters required in the document. §14; 340
Adds the given location syntax to the xdy style file. §14; 341
Adds a required xindy file to the xdy style file. §14; 337
Expands to the prefix for the label used by numberedsection=autolabel and numberedsection=nameref. §2; 82
Expands to
Just does
Defined by the
Expands to the entry’s category.
Used to clear the page at the start of a glossary. §8; 245
Expands to (a literal closing brace). §14; 336
The default counter as specified by the counter option. §2; 90
Assigned at the start of each entry item within the glossary. This command may be used by glossary hooks, such as
Conditional commands such as
Placeholder command that expands to the text provided in
Identifies the list of glossaries that should have hyperlinks suppressed. §2; 109
The default value for the shortaccess key when defining acronyms with
Expands to the label of the default glossary, which is normally
Defines post-description hook associated with the category identified by the label .
Defines post-link hook associated with the category identified by the label .
This command is written to the glsdefs file to define the given entry using the definition provided in the document environment on the previous LaTeX run.
As
As
References the entry identified by description value. The argument will be inserted at the end of the link text. This command does not alter or depend on the first use flag. For the first optional argument, see
As
As
As
Does descriptionaccess replacement text (if set). §17; 382
Does descriptionpluralaccess replacement text (if set). §17; 382
A length register used to set the width of the description column for tabular-like styles. §13; 293
Disables hyperlinks (may be scoped to localise the effect). §15; §5.1.6; 179, 351
As
References the entry identified by link text. This command unsets the first use flag (use
This was originally used to format the way the link text was displayed on first use by the
This was originally used to format the way the link text was displayed on first use by the
Formats the location list for the given entry. Redefined by glossaries-extra-bib2gls to obtain the location list from the location field. §5.2.0; 187
Creates a hyperlink to the given target using
Hook used by
Creates a hypertarget, and includes the debugging information if debug=showtargets. This uses
Hook used by
Does entry given by exists. If the entry doesn’t exist, this will generate an error. §15; 358
Similar to
Like
Does entry given by does not exist. If the entry does exist, this will generate an error. §15; 358
Used instead of
Sanitizes the sort value if sanitizesort=true. §2; 99
Enables entry counting. §7; 231
Enables hyperlinks (may be scoped to localise the effect). §15; §5.1.6; 179, 351
As
Expands to the value of the access field. §17; 384
Defined by
Sets
Displays the formatted value of the glossaryentry counter or does nothing if entrycounter=false. §2; 85
Expands to the prefix used by
Sets
Expands to the current entry count running total or 0 if not available (needs to be enabled with
Partially robust command that displays the value of the description field with sentence case applied. As from glossaries v4.50, this command can expand in PDF bookmarks. Outside of PDF bookmarks it will expand to a robust internal command. §5.2.0; 185
Simply expands to the value of the description field. Does nothing if the entry hasn’t been defined. May be used in expandable contexts provided that the description field doesn’t contain any fragile commands. §5.2.0; 185
Expands to the value of the descaccess field. §17; 384
Partially robust command that displays the value of the descriptionplural field with sentence case applied. As from glossaries v4.50, this command can expand in PDF bookmarks. Outside of PDF bookmarks it will expand to a robust internal command. §5.2.0; 185
Simply expands to the value of the descriptionplural field. Does nothing if the entry hasn’t been defined. May be used in expandable contexts provided that the descriptionplural field doesn’t contain any fragile commands. §5.2.0; 185
Expands to the value of the descpluralaccess field. §17; 385
Partially robust command that displays the value of the first field with sentence case applied. As from glossaries v4.50, this command can expand in PDF bookmarks. Outside of PDF bookmarks it will expand to a robust internal command. §5.2.0; 184
Simply expands to the value of the first field. Does nothing if the entry hasn’t been defined. May be used in expandable contexts provided that the first field doesn’t contain any fragile commands. §5.2.0; 184
Expands to the value of the firstaccess field. §17; 384
Partially robust command that displays the value of the firstplural field with sentence case applied. As from glossaries v4.50, this command can expand in PDF bookmarks. Outside of PDF bookmarks it will expand to a robust internal command. §5.2.0; 184
Simply expands to the value of the firstplural field. Does nothing if the entry hasn’t been defined. May be used in expandable contexts provided that the firstplural field doesn’t contain any fragile commands. §5.2.0; 184
Expands to the value of the firstpluralaccess field. §17; 384
The default display format used by the
As
As
Displays the singular full form of the acronym identified by , without hyperlinks or indexing. This command is redefined by acronym styles to match the style format. §6; 198
As
As
Displays the plural full form of the acronym identified by , without hyperlinks or indexing. This command is redefined by acronym styles to match the style format. §6; 198
Used for top level (level 0) entries in glossary styles to increment and display the entry counter if entrycounter=true. §13.2.1; 324
Displays the value of the long field with sentence case applied. Does nothing if the entry hasn’t been defined. As from glossaries v4.50, this command can expand in PDF bookmarks. Outside of PDF bookmarks it will expand to a robust internal command. §6; 197
Simply expands to the value of the long field. Does nothing if the entry hasn’t been defined. May be used in expandable contexts provided that the long field doesn’t contain any fragile commands. §6; 196
Expands to the value of the longaccess field. §17; 385
Displays the value of the longplural field with sentence case applied. Does nothing if the entry hasn’t been defined. As from glossaries v4.50, this command can expand in PDF bookmarks. Outside of PDF bookmarks it will expand to a robust internal command. §6, §7; 197, 234
Simply expands to the value of the longplural field. Does nothing if the entry hasn’t been defined. May be used in expandable contexts provided that the longplural field doesn’t contain any fragile commands. §6; 197
Expands to the value of the longpluralaccess field. §17; 385
Partially robust command that displays the value of the name field with sentence case applied. As from glossaries v4.50, this command can expand in PDF bookmarks. Outside of PDF bookmarks it will expand to a robust internal command. §5.2.0; 184
Simply expands to the value of the name key. Does nothing if the entry hasn’t been defined. May be used in expandable contexts provided that the name key doesn’t contain any fragile commands. §5.2.0; 183
Displays the location list for the given entry. Redefined by glossaries-extra-bib2gls to obtain the location list from the location field. §5.2.0; 187
Expands to the value of the parent field. Expands to nothing if the parent field hasn’t been set and expands to
Partially robust command that displays the value of the plural field with sentence case applied. As from glossaries v4.50, this command can expand in PDF bookmarks. Outside of PDF bookmarks it will expand to a robust internal command. §5.2.0; 184
Simply expands to the value of the plural field. Does nothing if the entry hasn’t been defined. May be used in expandable contexts provided that the plural field doesn’t contain any fragile commands. §5.2.0; 184
Expands to the value of the pluralaccess field. §17; 384
As
Expands to the value of the prefix field. §16; 372
As
Expands to the value of the prefixfirst field. §16; 373
As
Expands to the value of the prefixfirstplural field. §16; 373
As
Expands to the value of the prefixplural field. §16; 373
Expands to the final entry count total from the previous LaTeX run or if 0 if not available (needs to be enabled with
Displays the value of the short field with sentence case applied. Does nothing if the entry hasn’t been defined. As from glossaries v4.50, this command can expand in PDF bookmarks. Outside of PDF bookmarks it will expand to a robust internal command. §6; 198
Simply expands to the value of the short field. Does nothing if the entry hasn’t been defined. May be used in expandable contexts provided that the short field doesn’t contain any fragile commands. §6; 197
Expands to the value of the shortaccess field. §17; 385
Displays the value of the shortplural field with sentence case applied. Does nothing if the entry hasn’t been defined. As from glossaries v4.50, this command can expand in PDF bookmarks. Outside of PDF bookmarks it will expand to a robust internal command.
Simply expands to the value of the shortplural field. Does nothing if the entry hasn’t been defined. May be used in expandable contexts provided that the shortplural field doesn’t contain any fragile commands.
Expands to the value of the shortpluralaccess field. §17; 385
Simply expands to the value of the sort key. Does nothing if the entry hasn’t been defined. §15; 366
Partially robust command that displays the value of the symbol field with sentence case applied. As from glossaries v4.50, this command can expand in PDF bookmarks. Outside of PDF bookmarks it will expand to a robust internal command. §5.2.0; 185
Simply expands to the value of the symbol field. Does nothing if the entry hasn’t been defined. May be used in expandable contexts provided that the symbol field doesn’t contain any fragile commands. §5.2.0; 185
Expands to the value of the symbolaccess field. §17; 384
Partially robust command that displays the value of the symbolplural field with sentence case applied. As from glossaries v4.50, this command can expand in PDF bookmarks. Outside of PDF bookmarks it will expand to a robust internal command. §5.2.0; 185
Simply expands to the value of the symbolplural field. Does nothing if the entry hasn’t been defined. May be used in expandable contexts provided that the symbolplural field doesn’t contain any fragile commands. §5.2.0; 185
Expands to the value of the symbolpluralaccess field. §17; 384
Partially robust command that displays the value of the text field with sentence case applied. As from glossaries v4.50, this command can expand in PDF bookmarks. Outside of PDF bookmarks it will expand to a robust internal command. §5.2.0; 184
Simply expands to the value of the text field. Does nothing if the entry hasn’t been defined. May be used in expandable contexts provided that the text field doesn’t contain any fragile commands. §5.2.0; 184
Expands to the value of the textaccess field. §17; 384
Applies title case to the given field using
Simply expands to the value of the type key. Does nothing if the entry hasn’t been defined. §15; 365
Partially robust command that displays the value of the user1 field with sentence case applied. As from glossaries v4.50, this command can expand in PDF bookmarks. Outside of PDF bookmarks it will expand to a robust internal command. §5.2.0; 186
Simply expands to the value of the user1 field. Does nothing if the entry hasn’t been defined. May be used in expandable contexts provided that the user1 field doesn’t contain any fragile commands. §5.2.0; 185
Expands to the value of the user1access field. §17; 385
Partially robust command that displays the value of the user2 field with sentence case applied. As from glossaries v4.50, this command can expand in PDF bookmarks. Outside of PDF bookmarks it will expand to a robust internal command. §5.2.0; 186
Simply expands to the value of the user2 field. Does nothing if the entry hasn’t been defined. May be used in expandable contexts provided that the user2 field doesn’t contain any fragile commands. §5.2.0; 186
Expands to the value of the user2access field. §17; 385
Partially robust command that displays the value of the user3 field with sentence case applied. As from glossaries v4.50, this command can expand in PDF bookmarks. Outside of PDF bookmarks it will expand to a robust internal command. §5.2.0; 186
Simply expands to the value of the user3 field. Does nothing if the entry hasn’t been defined. May be used in expandable contexts provided that the user3 field doesn’t contain any fragile commands. §5.2.0; 186
Expands to the value of the user3access field. §17; 385
Partially robust command that displays the value of the user4 field with sentence case applied. As from glossaries v4.50, this command can expand in PDF bookmarks. Outside of PDF bookmarks it will expand to a robust internal command. §5.2.0; 186
Simply expands to the value of the user4 field. Does nothing if the entry hasn’t been defined. May be used in expandable contexts provided that the user4 field doesn’t contain any fragile commands. §5.2.0; 186
Expands to the value of the user4access field. §17; 386
Partially robust command that displays the value of the user5 field with sentence case applied. As from glossaries v4.50, this command can expand in PDF bookmarks. Outside of PDF bookmarks it will expand to a robust internal command. §5.2.0; 186
Simply expands to the value of the user5 field. Does nothing if the entry hasn’t been defined. May be used in expandable contexts provided that the user5 field doesn’t contain any fragile commands. §5.2.0; 186
Expands to the value of the user5access field. §17; 386
Partially robust command that displays the value of the user6 field with sentence case applied. As from glossaries v4.50, this command can expand in PDF bookmarks. Outside of PDF bookmarks it will expand to a robust internal command. §5.2.0; 187
Simply expands to the value of the user6 field. Does nothing if the entry hasn’t been defined. May be used in expandable contexts provided that the user6 field doesn’t contain any fragile commands. §5.2.0; 186
Expands to the value of the user6access field. §17; 386
Expand values when assigning fields during entry definition (except for specific fields that are overridden by
If defined, used by
If glossaries-extra has been loaded, this command will first check for the existence of the command
Locally assigns the internal field label ) for the entry identified by . Produces an error (or warning with undefaction=warn) if the entry or field doesn’t exist. Note that this doesn’t update any associated fields. §15; 367
Locally assigns the full expansion of internal field label ) for the entry identified by . Produces an error (or warning with undefaction=warn) if the entry or field doesn’t exist. Note that this doesn’t update any associated fields. §15; 367
Fetches the value of the given field for the given entry and stores it in the command internal field label) hasn’t been defined. Uses
As
As
Finds and sets the widest name for all top-level entries in the given glossaries. If the optional argument is omitted, the list of all non-ignored glossaries is assumed. §13.1.7; 316
Finds and sets the widest name for all entries that have been marked as used with hierarchical level less than or equal to 2 in the given glossaries.
Finds and sets the widest name for all top-level entries that have been marked as used in the given glossaries.
As
As
References the entry identified by first value. The argument will be inserted at the end of the link text. This command does not alter or depend on the first use flag. If you have defined the entry with
Short form font used by the small caps “sc” abbreviation styles on first use.
Does firstaccess replacement text (if set).
Formatting command for the first use long form used by the footnote abbreviation styles.
As
As
References the entry identified by firstplural value. The argument will be inserted at the end of the link text. This command does not alter or depend on the first use flag. If you have defined the entry with
Does firstpluralaccess replacement text (if set). §17; 382
For use within captions or section titles to display the formatted first.
For use within captions or section titles to display the formatted sentence case long form.
For use within captions or section titles to display the formatted name.
For use within captions or section titles to display the formatted short form.
For use within captions or section titles to display the formatted text.
The generic acronym display format used by the
The generic display format used by the
Robust command that determines the title associated with §13.2.1; 327
Redefined by glossary styles to show, if applicable, the title associated with the letter group identified by . §13.2.3; 330
Redefined by glossary styles to produce a vertical gap between letter groups, if applicable. §13.2.3; 331
Sets the header mark for the glossary. §8; 244
Sets
Sets
Creates a hyperlink to the given entry with the hyperlink text provided in the optional argument. If omitted, the default is
Used as a separator by
This will encapsulate each location with a hyperlink, if supported. This may be used as a location encap. The argument may be a single location or locations delimited by
This was originally used in
Defined by the
Defined by the
Does translate=true and the glossaries-dictionary-.dict file has been loaded, otherwise does .
Does nothing. When used as a location encap, this signifies to bib2gls that the entry is required but the location shouldn’t be added to the location list. With other indexing methods, this simply creates an invisible location. §12; 265
Indicates what indexing option has been chosen. §1; 9
Sets
Sets
Formats the description, symbol and location list for top-level entries. §13.1.9; 322
Hook at the start of
Used to format the symbol and location list when the description is suppressed. §13.1.9; 322
Used to test if the entry has any children. §13.1.9; 321
Creates the target for top level (level 0) entries and may be used to adjust the format of the name. §13.1.9; 321
Separator used between a top level (level 0) parent and its first child entry. §13.1.9; 320
Hook used between a top level (level 0) entry and its first sub-entry. §13.1.9; 322
Separator used between top level (level 0) entries. §13.1.9; 320
Formats the description, symbol and location list for child entries. §13.1.9; 322
Creates the target for sub entries and may be used to adjust the format of the name. §13.1.9; 322
Separator used between sub-entries. §13.1.9; 320
Placeholder command that expands to the
A token register used by
Placeholder command that expands to the entry label. §5.1.4; 174
May be used in the definition of
Hook used by
Expands to the prefix used for the label created by
Expands to the value part of the label created by
A token register used by
Fetches the value of the given field (identified by its internal label ) for the entry given by and stores it in the command . §15; 366
As
References the entry identified by link text. This command does not alter or depend on the first use flag (use
Hook used when checking whether or not to switch off hyperlinks on first use. §2; 77
Hook implemented after setting the options passed to the
Hook implemented before setting the options passed to the
Defined by the
A length register used by listdotted. §13.1.1; 299
Used by
Used to encapsulate the group title. §13.1.1; 297
Used to disable problematic commands at the start the list styles to provide better integration with gettitlestring. §13.1.1; 296
Used in styles like listhypergroup to display the navigation line. §13.1.1; 297
Locally resets the first use flag. §7; 226
Locally resets the first use flag for all entries in whose labels are listed in the comma-separated list. If the optional argument is omitted, the list of all non-ignored glossaries is assumed. §7; 226
Locally unsets the first use flag. §7; 226
Locally unsets the first use flag for all entries in whose labels are listed in the comma-separated list. If the optional argument is omitted, the list of all non-ignored glossaries is assumed. §7; 227
Used by makeglossaries when repairing problematic locations with makeindex. §12; 281
Does longaccess replacement text (if set). §17; 383
Font formatting command for the long form, initialised by the abbreviation style.
Does longpluralaccess replacement text (if set). §17; 383
A token register used by
Converts lowercase using the modern LaTeX3 case-changing command, which is expandable. §15; 353
Penalty check used by
Used by
Expands to the number of columns for the “mcol” styles. §13.1.8; 318
Measures the depth of
Measures the height of
Measures the width of
If mfirstuc v2.08+ is installed, this will use
If mfirstuc v2.08+ is installed, this will use
If mfirstuc v2.08+ is installed, this will use
Moves the entry identified by glossary identified by . §4.7.0; 155
As
As
References the entry identified by name value. The argument will be inserted at the end of the link text. This command does not alter or depend on the first use flag. For the first optional argument, see
Does access replacement text (if set). §17; 382
Used by
Used by
Creates a hyperlink to the given group, where the target name is obtained from
Expands to the anchor for the given group. §13.2.2; 328
Used to create a hyper target for a group in order to support styles that have navigation links to glossary groups. Note that if you only want to change the way that the target is created, redefine
Displays a simple glossary group navigation line with the items separated by
Used by
Does nothing outside of
Don’t expand values when assigning fields during entry definition (except for specific fields that are overridden by
Used to display an individual location within the number list when
Handler macro used by
Displays the location list by iterating over the loclist field with the
Handler macro used by
List loop handler used by
Used before the number list for Option 1. By default it expands to the value of the prenumberlist internal field, if set. §8; 248
Does nothing outside of
The default format for entry locations. If hyperlinks are defined, this will use
Iterates over the loclist internal field. §12; 288
Provided by glossaries if it hasn’t already been defined. The title associated with the
Separator used by
Separator used by
Expands to (a literal open brace). §14; 336
A length register used to set the width of the location list column for tabular-like styles. §13; 293
Paragraph break (for instances where
Applies a patch to longtable to check for instances of the group skip occurring at a page break.
Patches tabularx (if it has been loaded) to prevent the first use flag from being unset while tabularx is calculating the column widths. §15; 365
The definition of
Expands to (a literal percent character). §14; 336
As
As
As
As
As
References the entry identified by plural value. The argument will be inserted at the end of the link text. This command does not alter or depend on the first use flag. If you have defined the entry with
Does pluralaccess replacement text (if set). §17; 382
Suffix used to obtain default plurals. §4; 137
A hook that is usually placed after the description in glossary styles. Some of the styles provided with the glossaries package don’t use this hook. The glossaries-extra-stylemods redefines those styles to include the hook. The default definition of this command tests for the nopostdot option, but the postpunc option redefines the command to implement the chosen punctuation. §2, §13; 91, 295
Used at the end of the theglossary environment. §13.1.9; 321
Formats the top-level entry’s description, symbol and location list.
Formats the child entry’s description, symbol and location list.
A post-link hook used after all the
Separator between the prefix and the term. §16; 370
Hook used with sort=standard to adjust the default sort value (with
Shortcut for
Shortcut for
Expands to
For use with entrycounter and subentrycounter, this references the value of the glossaryentry or glossarysubentry counter associated with the glossary entry identified by . If entrycounter=false and subentrycounter=false, this simply uses
Globally resets the first use flag. §7; 226
Globally resets the first use flag for all entries in whose labels are listed in the comma-separated list. If the optional argument is omitted, the list of all non-ignored glossaries is assumed. §7; 226
Sets the
Sets the
Resets glossaryentry back to zero if entrycounter=true. §2; 84
Resets
Resets glossarysubentry back to zero if entrycounter=true. §2; 86
Reverses the effect of
Indexes the entry identified by as a general cross-reference to the entries identified in the comma-separated list . The optional argument is the textual tag that’s inserted before the cross-reference list and defaults to
Used to format the see cross-reference in the location list. This requires a location argument for makeindex even though it isn’t required. The default definition is
Used by
Used by
Used by
Iterates over a comma-separated list of entry labels
Used by
Used by sentence case commands, such as
Sets the compositor for locations that start with an uppercase alphabetical character. §3; 125
Locally sets the given attribute to for the given category.
Sets the location compositor for the indexing style file created by
Indicates that the given field should always have its value expanded when the entry is defined. This overrides
Indicates that the given field should always have its value expanded when the entry is defined. This overrides
Set makeindex’s quote character (used for escaping special characters) to . §1.5.0; 45
The suffix for two consecutive locations. §12; 271
The suffix for three or more consecutive locations. §12; 271
Used by
Indicates that hierarchical level. §13.1.7; 316
Adds indexing style file. §3; 123
Sets the xindy codepage. This information is written to the aux file for makeglossaries to pick up. It has no effect if xindy is called explicitly. §14; 339
Identifies the first letter group to occur after the number group. §14; 349
Sets the xindy language for the given glossary. This information is written to the aux file for makeglossaries to pick up. It has no effect if xindy is called explicitly. §14; 338
May be used to change the ordering of location class names. §14; 348
Sets the minimum number of consecutive locations to form an implicit range. The value may be “none” to indicate no range formation. §14; 348
Sets the relative location of the number group. §14; 350
Resets the list of required xindy files. §14; 337
Does shortaccess replacement text (if set). §17; 382
Applies attribute for using
Applies attribute for using
Does shortpluralaccess replacement text (if set). §17; 383
A token register used by
Used by
Used with debug=showtargets to show the target. §2; 72
Used by
Used by
Used by
Used by
Used by
Essentially does
Increments glossaryentry with
Increments glossarysubentry with
Sets
Displays the formatted value of the glossarysubentry counter or does nothing if subentrycounter=false. §2; 87
Sets
Used for level 1 entries in glossary styles to increment and display the sub-entry counter if subentrycounter=true. §13.2.1; 324
Used to format sub-group headings.
As
As
References the entry identified by symbol value. The argument will be inserted at the end of the link text. This command does not alter or depend on the first use flag. For the first optional argument, see
Does symbolaccess replacement text (if set). §17; 382
Produces a simple navigation set of links for just the symbols and number groups separated by
As
As
As
Does symbolpluralaccess replacement text (if set). §17; 382
Provided by glossaries if it hasn’t already been defined. The title associated with the
Used by glossary styles to create a hypertarget (if enabled) for the entry (identified by ). The is usually
If hyperref has been loaded, this uses
As
As
References the entry identified by text value. The argument will be inserted at the end of the link text. This command does not alter or depend on the first use flag. If you have defined the entry with
Does textaccess replacement text (if set). §17; 382
Used by the
If
Expands to
Sets
Sets
Space inserted before child descriptions. §13.1.7; 313
Used to format the group title for the treegroup and indexgroup styles. §13.1.7; 313
Length register used by the tree style. §13.1.7; 315
Used to indent the top-level entries for the index styles. §13.1.7; 314
Creates the box for the name with styles like alttree. §13.1.7; 317
Used to format the name for the tree and index styles. §13.1.7; 313
Used to format the navigation element for styles like treehypergroup. §13.1.7; 313
Space inserted before top-level descriptions. §13.1.7; 313
Used to indent the level 1 entries for the index styles. §13.1.7; 314
Used to indent the level 2 entries for the index styles. §13.1.7; 314
Placeholder command that expands to the entry’s glossary type. §5.1.4; 174
Sets
Sets
For use in expandable contexts where the field value is required but the contents should not be expanded. The field should be identified by its internal field label. Expands to nothing with no error or warning if the entry or field aren’t defined. §15; 366
Globally unsets the first use flag. §7; 226
Globally unsets the first use flag for all entries in whose labels are listed in the comma-separated list. If the optional argument is omitted, the list of all non-ignored glossaries is assumed. §7; 226
Suffix used to obtain the default shortplural value with the base small caps acronym styles. §6.2.1; 202
Converts uppercase using the modern LaTeX3 case-changing command, which is expandable. §15; 353
Implements the entry format part of the given acronym style (the code supplied in the argument of
Implements the style definitions part of the given acronym style (the code supplied in the argument of
As
As
References the entry identified by user1 value. The argument will be inserted at the end of the link text. This command does not alter or depend on the first use flag. For the first optional argument, see
Does user1access replacement text (if set). §17; 383
As
As
References the entry identified by user2 value. The argument will be inserted at the end of the link text. This command does not alter or depend on the first use flag. For the first optional argument, see
Does user2access replacement text (if set). §17; 383
As
As
References the entry identified by user3 value. The argument will be inserted at the end of the link text. This command does not alter or depend on the first use flag. For the first optional argument, see
Does user3access replacement text (if set). §17; 383
As
As
References the entry identified by user4 value. The argument will be inserted at the end of the link text. This command does not alter or depend on the first use flag. For the first optional argument, see
Does user4access replacement text (if set). §17; 383
As
As
References the entry identified by user5 value. The argument will be inserted at the end of the link text. This command does not alter or depend on the first use flag. For the first optional argument, see
Does user5access replacement text (if set). §17; 383
As
As
References the entry identified by user6 value. The argument will be inserted at the end of the link text. This command does not alter or depend on the first use flag. For the first optional argument, see
Does user6access replacement text (if set). §17; 383
Sets
Sets
Hook used to locally disable problematic commands whilst constructing the anchor for
Hook used to locally disable problematic commands whilst writing the location to the indexing file with Options 2 and 3. §12; 274
Must be expandable. May be used to alter the location suffix whilst constructing the anchor for
Used to encapsulate the location in the hyperlink text for
The write register used to create the indexing style file. §3; 123
Hook used when writing entries to the glsdefs file after all the = information has been written and before the end brace that closes the final argument of
Does indexonlyfirst=true and the entry identified by has been marked as used. §2; 94
Used with xindy for location formats. §14; 340
This command is written to the aux file for the benefit of makeglossaries and makeglossaries-lite. §1.7.1; 68
This command is written to the aux file to provide the indexing information for bib2gls. §1.7.3; 70
This command is written to the aux file to provide the indexing information for bib2gls when the record=nameref option is used. §1.7.3; 70
This command is written to the aux file to provide the
This command is written to the aux file to provide the resource options for bib2gls. §1.7.3; 69
This command is written to the aux file to provide the file encoding information for bib2gls.
Command that produces the footnote for the footnote abbreviation styles, such as footnote and postfootnote.
Expands to the label of the default abbreviation glossary. The abbreviations package option will redefine this to
Used by the bookindex style to display a top-level entry’s name.
If defined, used by
If defined, used by
Copies the entry to the internal glossary list for the given glossary. The starred version performs a global change. The unstarred version can be localised. Only for use with the “unsrt” family of commands.
If defined, used with record=name to format locations associated with .
If
Iterates over the given field’s value using etoolbox’s
Formats the value of the given field, which should be an etoolbox internal list, using the same list handler macro as datatool’s
Behaves like
Expands to the name of the used by
Expands to the name value for styles like short-footnote-desc.
Expands to the sort value for footnote styles like short-footnote-desc.
Iterates over the comma-separated list stored in the given field (identified by its internal label) for the entry identified by and performs
As
As
References the abbreviation identified by . The text produced is obtained from the short and long values, formatted according to the abbreviation style associated with the entry’s category. The argument will be inserted at the end of the link text. This command does not alter or depend on the first use flag. The format produced by this command may not match the format produced by the first use of
As
As
As
Separator used by the parenthetical inline full and also for some display full forms.
A shortcut that expands to the ignorable rules, combining diacritic rules, hyphen rules, general punctuation rules, digit rules, and fraction rules.
Expands to the A–G subset of General Latin I sort rules.
Expands to the N–Z subset of General Latin I sort rules.
Obtains the title corresponding to the group identified by and stores the result in the control sequence .
Used for standalone entries to display the name with
Displays the entry’s hierarchical name.
Compares the numeric value stored in the given field with
Tests if the entry given by field identified by its internal label set to .
Tests if the numeric value stored in the given field is non-zero.
Expandable command that tests if the given field (identified by its internal label) is undefined for the entry given by . Internally uses etoolbox’s
Tests if the field identified by its internal label for the entry given by is defined and is not empty. This is like
Tests if the value in the childcount field is non-zero (using
Does used, otherwise does . Note that this command will generate an error or warning (according to undefaction) if the entry hasn’t been defined, but will still do . §15; 359
Initialised by the
Like
A shortcut that expands to the control rules, space rules and non-printable rules.
Used by
Used by
Used by
Used by
For use with bib2gls, this both sets up the resource options (which bib2gls can detect from the aux file) and inputs the glstex file created by bib2gls.
Locally assigns the given title group identified by .
As
As
References the abbreviation identified by . The text produced is obtained from the long value, formatted according to the abbreviation style associated with the entry’s category. The argument will be inserted at the end of the link text. This command does not alter or depend on the first use flag.
As
As
As
Defines the command
Like
Defines a new glossary entry with the given label, type set to
Defines a new glossary entry with the given label, type set to
When placed at the end of the description, this switches off the post-description punctuation (inserted automatically via options such as postdot) but doesn’t suppress the post-description hook. Does nothing outside of the glossary.
For use in headings and captions (instead of the
Used to encapsulate
May be used within a post-link hook to display the symbol in parentheses on first use.
An additional post-link hook that supports categories.
If local unset for repeat entries has been enabled with
Sets
Assigns internal label for the entry identified by . An error (or warning with undefaction=warn) occurs if the entry hasn’t been defined.
Globally assigns the given title group identified by .
Overrides the options that should be implemented by the plus (
Overrides the options that should be implemented by the star (
As
As
References the abbreviation identified by . The text produced is obtained from the short value, formatted according to the abbreviation style associated with the entry’s category. The argument will be inserted at the end of the link text. This command does not alter or depend on the first use flag. For the first optional argument, see
As
As
Enables unset buffering. The starred version doesn’t check for duplicates.
Stops buffering. The starred version performs a global unset.
Allows repeat entries within the buffering code to be locally unset before the link text.
Implements the
Implements the
Expands to the value of the given field (identified by its internal label ) for the entry given by . Expands to
If hyperlinks are supported this does
If hyperlinks are supported this does
If hyperlinks are supported this does
If hyperlinks are supported this does
If hyperlinks are supported this does
If hyperlinks are supported this does
If hyperlinks are supported this does
If hyperlinks are supported this does
If hyperlinks are supported this does
If hyperlinks are supported this does
If the glossary given by exists, this does , otherwise it does . The unstarred form treats ignored glossaries as non-existent. The starred form (v4.46+) will do if matches an ignored glossary. §15; 357
Does description field is just
Conditional corresponding to the entrycounter option. §2; 85
Tests if the value of the given field is equal to the replacement text of the command given by the control sequence name etoolbox’s
Tests if the value of the given field is equal to the replacement text of the given command etoolbox’s
Tests if the value of the given field is equal to the given string using etoolbox’s
An expandable test to determine if the entry is undefined or the field is undefined or empty. The internal label. Internally uses etoolbox’s
Does glossary to find one that has the entry identified in its parent field. A more efficient approach can be achieved with bib2gls and the save-child-count resource option. §15; 359
Does description field is set otherwise does . §15; 360
If the field identified by either its key or its internal field label for the entry identified by is set and non-empty, this sets
Does long field is set otherwise does . §15; 359
Does parent field is set otherwise does . §15; 359
Expands to prefix field is non-empty. §16; 372
Expands to prefixfirst field is non-empty. §16; 372
Expands to prefixfirstplural field is non-empty. §16; 372
Expands to prefixplural field is non-empty. §16; 372
Does short field is set otherwise does . §15; 360
Does symbol field is set otherwise does . §15; 359
Conditional corresponding to the hyperfirst option.
Conditional corresponding to the indexonlyfirst option. §2; 93
Conditional set by the nogroupskip option. §2; 91
Conditional that determines whether or not the reset commands should reset the entry count stored in currcount to zero. §7; 231
Conditional corresponding to the subentrycounter option. §2; 87
Conditional corresponding to the toc option. §2; 79
Conditional corresponding to the ucmark option. §2; 81
Does entry has been marked as used, does if the entry is marked as unused, and does neither if the entry hasn’t been defined (but will generate an error). §15; 358
If esclocations=true and this conditional is true, then some primitives will be locally redefined while indexing occurs in order to escape special characters in the location without prematurely expanding
Conditional that, if true, indicates that xindy should be used. §2; 103
A conditional used by the predefined abbreviation styles to determine whether the
Does glossary identified by has been defined as an ignored glossary, otherwise does . §9; 251
Provided by various packages, including glossary-list and glossary-tree, this creates a vertical space. §13.1.1; 297
Locally assigns
Defines a new glossary entry with the given label. The second argument is a comma-separated list of glossary entry keys. The third argument is the description, which may include paragraph breaks. §4; 127
As
Robust command that converts the first character of uppercase (sentence case) unless starts with a command, in which case it will attempt to apply the case change to the first character of the first argument following the command, if the command is followed by a group. As from mfirstuc v2.08, this command internally uses
Opens the associated indexing files that need to be processed by makeindex or xindy. This command has an optional argument with glossaries-extra. §3; 122
Sets up all non-ignored glossaries so that they can be displayed with
This command was used by
Identifies a mapping from the command
Locally identifies
Locally identifies
Fully expands uppercase. Unlike
Defines a new entry that represents an abbreviation. This internally uses
Defines an abbreviation style, which can be set with
This command is provided by the base glossaries package to define a new acronym but it’s redefined by glossaries-extra to use
Hook used by
Defines an acronym style for use with the base glossaries package’s acronym mechanism. These styles are not compatible with glossaries-extra. The part is the code used as the entry format definition within
Defines a glossary identified by (which can be referenced by the type key when defining an entry). The will be used when displaying the glossary (using commands like
A shortcut that supplies file extensions based on the glossary label:
Defines a new glossary entry with the given label. The second argument is a comma-separated list of glossary entry keys. §4; 126
Defines a new glossary style called . §13.2.0; 323
Defines a glossary that should be ignored by iterative commands, such as
Defines a new glossary entry with the given label, type set to
Prevents
When placed at the end of the description, this switches off the post-description hook (including the post-description punctuation). Does nothing outside of the glossary. §4; 128
Defines an acronym using the syntax of the old glossary package. §6.4.0; 224
Provided by glossaries if it hasn’t already been defined. Used as the page list column header for some of the tabular-like glossary styles. §1.5.1; Table 1.2
As
As
Similar to
As
As
Similar to
As
Locally prepends preamble for the glossary identified by . If is omitted,
Shortcut for
Shortcut for
Iterates over all non-ignored glossaries and does
Displays the glossary by inputting a file created by makeindex or xindy. Must be used with
Shortcut provided by the index package option that simply does
Iterates over all non-ignored glossaries and does
Displays the glossary by obtaining the indexing information from the aux file and using TeX to sort and collate. Must be used with
Shortcut for
Shortcut for
Shortcut for
Iterates over all non-ignored glossaries and does
Displays the glossary by iterating over all entries associated with the given glossary (in the order in which they were added to the glossary). Group headers will only be inserted if the group key has been defined and has been set (typically with the record option and bib2gls). Location lists will only be shown if the location or loclist fields have been set (typically by bib2gls). §8; 238
Similar to
As
As
Used at the start of a glossaries language definition file (ldf) to declare the file and version details.
As
Redefines the glossary style called . §13.2.0; 323
Indicates that the language definition file (ldf) corresponding to the given language should be loaded, if it hasn’t already been loaded.
Used as a cross-reference tag. The default value is
Provided by glossaries if it hasn’t already been defined. May already be defined by a language package.
Sets the current abbreviation style to for the category identified by . If the optional argument is omitted, abbreviation is assumed.
Sets the list of acronym lists (overriding any that have previously been identified). §2; 115
Deprecated with the introduction of
Sets the acronym style. Don’t use with glossaries-extra. §6; 199
Deprecated with the introduction of
Deprecated with the introduction of
Deprecated with the introduction of
Deprecated with the introduction of
Deprecated with the introduction of
Deprecated with the introduction of
Deprecated with the introduction of
Deprecated with the introduction of
Deprecated with the introduction of
Deprecated with the introduction of
Sets up the hypertarget prefix and location counter for use with
Deprecated with the introduction of
Deprecated with the introduction of
Globally sets the preamble for the glossary identified by to . If is omitted,
Equivalent to the package option section=. §2; 80
Sets the default glossary style to . §2; 88
Deprecated with the introduction of
Deprecated with the introduction of
Sets the file name of the makeindex or xindy style file that’s created by
Change allowed options that are defined by the base glossaries package. Note that some options can only be passed as package options. To change options defined or modified by the glossaries-extra package, use
Deprecated with the introduction of
Redefined by the glossary styles to display child entries. §13.2.3; 330
Provided by glossaries if it hasn’t already been defined. Used as a column header for some of the tabular-like glossary styles. §1.5.1; Table 1.2
Displays the value of the glossaryentry counter. §2; 85
Displays the value of the glossarysubentry counter. §2; 87
Writes the makeindex/xindy style file. This command is used by
Passes the argument to
As
Redefined by the glossary styles to format the glossary according to the style specifications. The entire glossary content (not including the section header, preamble and postamble) is contained within this environment. §13.2.3; 329
Extension package that loads glossaries, provides additional commands, and modifies some of the base glossaries commands to integrate them with the new commands or to make them more flexible.
Provides a new glossary with the label
Loads glossaries-accsupp. §2; 119
Indicates whether or not to enable automatic indexing of see and seealso fields. §2; 95
Determines whether or not
As restricted but creates the glsdefs file for atom’s autocomplete support. 79
Don’t allow
Allow
Allow
Automatically switch the location counter to equation when inside a numbered equation environment. §2; 96
Automatically switch the location counter to the corresponding counter when inside a floating environment. §2; 96
Defines the index counter wrglossary and implements counter=wrglossary. §2; 96
If true, automatically indexes cross references at the end of the document. §2; 95
Determines whether or not to display warning text if the external indexing file hasn’t been generated due to an incomplete build. §2; 119
A shortcut for nopostdot=false.
An alternative to postdot, this can be used to insert a different punctuation character after the description.
Loads glossaries-prefix. §2; 119
Indicates whether or not bib2gls is being used (in which case entry indexing is performed by adding bib2gls records in the aux file). §2; 95
Performs a mixture of bib2gls records in the aux file (to select entries from a bib file) and makeindex/xindy indexing in their associated files. This option is best avoided. 96
Entry indexing is performed by adding bib2gls nameref records in the aux file. Glossaries should be displayed with the “unsrt” family of commands. 96
Entry indexing is performed as per the base glossaries package, using either
Entry indexing is performed by adding bib2gls records in the aux file. Glossaries should be displayed with the “unsrt” family of commands. 95
Loads glossaries-extra-stylemods with the given options. If stylemods=default then no options are passed to glossaries-extra-stylemods. §2; 91
Indicates whether to trigger an error or warning if an unknown entry label is referenced. §2; 78
Trigger an error if an unknown entry label is referenced. 78
Trigger a warning if an unknown entry label is referenced. 78
Base package. This package will be implicitly loaded by glossaries-prefix, glossaries-accsupp and glossaries-extra. §1; 2
If true, provides a new glossary with the label
Identifies the glossaries that contain acronyms (defined with the base glossaries packages acronym mechanism). §2; 114
Provides a new glossary with the label
Indicates whether or not to attempt to use TeX’s shell escape to run an indexing application. §2; 104
Use the shell escape to run makeindex or xindy at the end of the document. 106, 106
Don’t use the shell escape. 106
Use the shell escape to run makeindex or xindy before
Use the shell escape to run makeglossaries-lite before
Use the shell escape to run makeglossaries before
Deprecated synonym for automake=delayed. 106
Synonym for automake=makegloss. §2; 107
Synonym for automake=lite. §2; 107
Option removed in version 4.50. Now only available with rollback. §2; 119
Option removed in version 4.50. Now only available with rollback. §2; 119
Sets the default location counter. §2; 90
Sets the parent counter for glossaryentry. §2; 85
Adds markers to the document for debugging purposes. §2; 72
Disable debugging actions. 72
Implements debug=true and also shows accessibility information in the document. 73
Implements debug=true and also shows target markers in the document. 72
Writes
Deprecated in version 4.02 (2013-12-05) and removed in version 4.50. Now only available with rollback. §2; 116
Disables
Deprecated in version 4.02 (2013-12-05) and removed in version 4.50. Now only available with rollback. §2; 118
Enables the entry counter for top-level entries. §2; 84
If true, escapes locations before indexing. §2; 92
Deprecated in version 4.02 (2013-12-05) and removed in version 4.50. Now only available with rollback. §2; 118
If false, this option will suppress hyperlinks on first use for the
Provides a new glossary with the label
Indicates whether or not to only index the first use. §2; 93
Indicates whether or not to redefined the kernel glossary commands
Don’t redefine
Redefine
Redefine
Implements translate=babel and adds the supplied languages to tracklang’s list of tracked languages. §2; 76
Indicates that the indexing should be performed by makeindex (default). §2; 102
The value may be either expanded or unexpanded and performs the same function as mfirstuc’s expanded and unexpanded package options. Note that there’s no value corresponding to mfirstuc’s other package option. §2; 119
If true, suppress the gap between letter groups in the glossaries by default. §2; 91
Counteracts the index option. §2; 112
Identifies the list of glossaries that should have hyperlinks suppressed. §2; 108
Suppresses the warning if no language support is found. §2; 71
Don’t load glossary-list, which is normally loaded automatically. Note that if glossaries is loaded before glossaries-extra, then this option should be passed directly to glossaries not glossaries-extra otherwise it will be too late to implement. §2; 89
Don’t load glossary-long, which is normally loaded automatically. Note that if glossaries is loaded before glossaries-extra, then this option should be passed directly to glossaries not glossaries-extra otherwise it will be too late to implement. §2; 88
Prevents the definition of the
Set no location lists as the default for all glossaries. May be overridden for individual glossaries with nonumberlist=true. §2; 90
If true, suppresses the automatic insertion of a full stop after each entry’s description in the glossary (for styles that support this). The default is nopostdot=true for glossaries-extra and nopostdot=false for just glossaries. §2; 91
Suppresses a warning if theglossary or
Don’t load the default set of predefined styles. Note that if glossaries is loaded before glossaries-extra, then this option should be passed directly to glossaries not glossaries-extra otherwise it will be too late to implement. §2; 89
Don’t load glossary-super, which is normally loaded automatically. Note that if glossaries is loaded before glossaries-extra, then this option should be passed directly to glossaries not glossaries-extra otherwise it will be too late to implement. §2; 88
Equivalent to translate=false. §2; 76
Don’t load glossary-tree, which is normally loaded automatically. Note that if glossaries is loaded before glossaries-extra, then this option should be passed directly to glossaries not glossaries-extra otherwise it will be too late to implement. §2; 89
Indicates whether or not glossary section headers will be numbered and also if they should automatically be labelled. §2; 81
Use numbered sectional units for glossaries and automatically add a label based on the glossary label. 81
Use unnumbered sectional units for glossaries. 81
Use unnumbered sectional units for glossaries and automatically add a label based on the glossary label. 83
Use numbered sectional units for glossaries but no label. 81
If true (and toc=true), includes
Provides a new glossary with the label
Indicates whether word or letter order should be used. With Options 2 and 3, this information is written to the aux file, where it can be picked up by makeglossaries. This option will have no effect if you call makeindex or xindy explicitly. §2; 101
Letter order (“seal” before “sea lion”). 101
Word order (“sea lion” before “seal”). 101
Cancels the effect of disablemakegloss. §2; 108
Indicates whether the default sort value should be sanitized (only applicable with sort=standard). §2; 97
If true, save number lists. Only applicable with Options 2 and 3 as Options 1 and 4 have the number list stored in the loclist field and Option 4 also has the formatted number list in the location field. §2; 83
If true, indexing information is stored until the end of the document to reduce the number of write registers. §2; 75
Indicates which section heading command to use for the glossary. The value may be one of the standard sectioning command’s control sequence name (without the leading backslash), such as
Automatically adds nonumberlist={false} to any entries with the see key set. §2; 90
Indicates what to do if the see key is used before the associated indexing files have been opened by
Triggers an error if the see key is used before
Does nothing if the see key is used before
Triggers a warning if the see key is used before
Defines various shortcut commands. Has additional values with glossaries-extra. §2; 115
Deprecated in version 4.02 (2013-12-05) and removed in version 4.50. Now only available with rollback. §2; 117
Deprecated in version 4.02 (2013-12-05) and removed in version 4.50. Now only available with rollback. §2; 117
Indicates how the sort key should automatically be assigned if not explicitly provided (for
Sets the sort key to an empty value. Use this option if no indexing is required for a slightly faster build. 98
Use the (zero-padded) order of definition as the default for the sort key. 98
Don’t process the sort key. Use this option if no indexing is required for a slightly faster build. 97
Use the value of the name key as the default for the sort key and implement the
Use the (zero-padded) order of use as the default for the sort key. 98
Sets the default glossary style to . §2; 88
Enables the entry counter for level 1 entries. §2; 86
Provides a new glossary with the label
If true, each glossary will be automatically added to the table of contents. The default is toc=false with glossaries and toc=true with glossaries-extra. §2; 79
Indicates how multilingual support should be provided, if applicable. §2; 75
Uses babel’s language hooks to implement multilingual support (default for glossaries-extra if babel has been detected). 76
Don’t implement multilingual support (default if no language package has been detected). 76
Uses translator’s language hooks to implement multilingual support (default for glossaries if a language package has been detected). 76
Indicates whether or not to use all caps in the glossary header. §2; 81
Creates a file called
Creates a file called
Indicates that the indexing should be performed by xindy. §2; 102
Sets the xindy codepage. Defaults to
Indicates whether or not to add the
Sets the xindy language module. Only applicable if you use makeglossaries or automake. §2; 103
Equivalent to xindy with no value. §2; 104
Equivalent to xindy={glsnumbers=false}. §2; 104
List of Tables
List of Examples
texdoc -l glossaries-user-example
where is the example number zero-padded to three digits to find out if the example files are installed on your device. 1. Introduction
(This is a trivial example. For a real document I recommend you use siunitx for units.)
\documentclass
{article}
\usepackage
[
sort=none % no sorting or indexing required
]
{glossaries}
\newglossaryentry
{cafe}% label
{% definition:
name={café},
description={small restaurant selling refreshments}
}
\setacronymstyle
{long-short}
\newacronym
{html}% label
{HTML}% short form
{hypertext markup language}% long form
\newglossaryentry
{pi}% label
{% definition:
name={\ensuremath
{\pi
}},
description={Archimedes' Constant}
}
\newglossaryentry
{distance}% label
{% definition:
name={distance},
description={the length between two points},
symbol={m}
}
\begin{document}
First use: \gls
{cafe}, \gls
{html}, \gls
{pi}.
Next use: \gls
{cafe}, \gls
{html}, \gls
{pi}.
\Gls
{distance} (\glsentrydesc
{distance}) is measured in
\glssymbol
{distance}.
\end{document}
\documentclass
{article}
\usepackage
[
sort=none,% no sorting or indexing required
abbreviations,% create list of abbreviations
symbols,% create list of symbols
postdot, % append a full stop after the descriptions
stylemods,style=index % set the default glossary style
]{glossaries-extra}
\newglossaryentry
% glossaries.sty
{cafe}% label
{% definition:
name={café},
description={small restaurant selling refreshments}
}
\setabbreviationstyle
{long-short}% glossaries-extra.sty
\newabbreviation
% glossaries-extra.sty
{html}% label
{HTML}% short form
{hypertext markup language}% long form
% requires glossaries-extra.sty 'symbols' option
\glsxtrnewsymbol
[description={Archimedes' constant}]% options
{pi}% label
{\ensuremath
{\pi
}}% symbol
\newglossaryentry
% glossaries.sty
{distance}% label
{% definition:
name={distance},
description={the length between two points},
symbol={m}
}
\begin{document}
First use: \gls
{cafe}, \gls
{html}, \gls
{pi}.
Next use: \gls
{cafe}, \gls
{html}, \gls
{pi}.
\Gls
{distance} is measured in \glssymbol
{distance}.
\printunsrtglossaries
% list all defined entries
\end{document}
\newabbreviation
and stylemods, are only available with the glossaries-extra package. There are also some commands and options (such as \makeglossaries
and symbols) that are provided by the base glossaries package but are redefined by the glossaries-extra package. See the glossaries-extra user manual for further details of those commands. \gls
, the hyperlink will take you to main part of the document where the command is described. The index and summaries are also glossaries. The technique used is too complicated to describe in this manual, but an example can be found in “bib2gls: Standalone entries and repeated lists (a little book of poisons)” TUGboat, Volume 43 (2022), No. 1.
1.1. Rollback
This is the last version that uses an internal comma-separated list for the hyper group information in glossary-hypernav. Version 4.53 has switched to using a sequence.\usepackage
{glossaries}[=v4.52]
Note that this should also rollback mfirstuc to version 2.07 if you have a later version installed.\usepackage
{glossaries}[=v4.49]
\usepackage
{glossaries}[=v4.46]
1.2. Integrating Other Packages and Known Issues
\usepackage
{amsgen}% load before
\usepackage
{ }% must be loaded after amsgen
\usepackage
{hyperref}% load after
\usepackage
{glossaries}% load after hyperref
\babelprovide
. The tracklang package is able to pick up known language labels from the document class options, for example:
The above doesn’t load babel or polyglossia or translator, but the translate=true setting will ensure that tracklang is loaded and the language-sensitive command provided by glossaries will use the definitions in glossaries-german.ldf (which needs to be installed separately, see §1.5) because tracklang can pick up the german document class option.\documentclass
[german]{article}
\usepackage
[translate=true]{glossaries}
The tracklang package used to be able to detect languages identified by polyglossia’s \usepackage
[french]{babel}
\usepackage
[translate=babel]{glossaries}
\setmainlanguage
and \setotherlanguage
, but tracklang v1.5 can’t with newer versions of polyglossia. You will need to upgrade to tracklang v1.6+ to allow this to work again.\usepackage
[nil]{babel}
\babelprovide
{french}
\usepackage
[languages=french]{glossaries}
1.3. Indexing Options
\cite
or \ref
). You can also, optionally, display a list of the entries you have referenced in your document (the glossary). This last part, displaying the glossary, is the part that most new users find difficult. There are three options available with the base glossaries package (Options 1–3). The glossaries-extra extension package provides two extra options for lists (Options 4 and 5) as well as an option for standalone descriptions within the document body (Option 6).
If the sort=none or sort=clear options are used, \ifglsxindy
xindy\else
makeindex\fi
\glsindexingsetting
will be redefined to none
. If \makeglossaries
is used \glsindexingsetting
will be updated to either makeindex
or xindy
as appropriate (that is, the conditional will no longer be part of the definition). If \makenoidxglossaries
is used then \glsindexingsetting
will be updated to noidx
. This means that \glsindexingsetting
can’t be fully relied on until the start of the document environment. (If you are using glossaries-extra v1.49+, then this command will also be updated to take the record setting into account.)\makeglossaries
into your class or package code. Aside from forcing the user into a particular indexing method, it means that they’re unable to use any commands that must come before \makeglossaries
(such as \newglossary
) and they can’t switch off the indexing whilst working on a draft document. (If you are using a class or package that has done this, pass the disablemakegloss option to glossaries. For example, via the document class options.)
Option
1
2
3
4
5
Requires glossaries-extra?
✖
✖
✖
✔
✔
Requires an external application?
✖
✔
✔
✔
✖
Requires Perl?
✖
✖
✔
✖
✖
Requires Java?
✖
✖
✖
✔
✖
Can sort extended Latin alphabets or non-Latin alphabets?
✖∗
✖
✔
✔
N/A
Efficient sort algorithm?
✖
✔
✔
✔
N/A
Can use a different sort method for each glossary?
✔
✖†
✖†
✔
N/A
Any problematic sort values?
✔
✔
✔
✖
✖‡
Are entries with identical sort values treated as separate unique entries?
✔
✔
✖§
✔
✔
Can automatically form ranges in the location lists?
✖
✔
✔
✔
✖
Can have non-standard locations in the location lists?
✔
✖
✔⧫
✔
✔¶
Maximum hierarchical depth (style-dependent)
∞#
3
∞
∞
∞
\glsdisplaynumberlist
reliable? ✔
✖
✖
✔
✖
\newglossaryentry
allowed in document environment? (Not recommended.) ✖
✔
✔
✖※
✔⁑
Requires additional write registers?
✖
✔
✔
✖
✖★
Default value of sanitizesort package option
false
true
true
true✾
true✾
\AA
is treated the same as A.1.3.1. Option 1 (“noidx”)
You can place all your entry definitions in a separate file and load it in the document preamble with \documentclass
{article}
\usepackage
[style=indexgroup]{glossaries}
\makenoidxglossaries
% use TeX to sort
\newglossaryentry
{parrot}{name={parrot},
description={a brightly coloured tropical bird}}
\newglossaryentry
{duck}{name={duck},
description={a waterbird}}
\newglossaryentry
{puffin}{name={puffin},
description={a seabird with a brightly coloured bill}}
\newglossaryentry
{penguin}{name={penguin},
description={a flightless black and white seabird}}
% a symbol:
\newglossaryentry
{alpha}{name={\ensuremath
{\alpha
}},
sort={alpha},description={a variable}}
% an acronym:
\setacronymstyle
{short-long}
\newacronym
{arpanet}{ARPANET}{Advanced Research Projects Agency Network}
\begin{document}
\Gls
{puffin}, \gls
{duck} and \gls
{parrot}.
\gls
{arpanet} and \gls
{alpha}.
Next use: \gls
{arpanet}.
\printnoidxglossary
\end{document}
\loadglsentries
(after \makenoidxglossaries
). Note that six entries have been defined but only five are referenced (indexed) in the document so only those five appear in the glossary.
This uses the indexgroup style, which puts a heading at the start of each letter group. The letter group is determined by the first character of the sort value. For a preview of all available styles, see Gallery: Predefined Styles. The number 1 after each description is the number list (or location list). This is the list of locations (page numbers, in this case) where the entry was indexed. In this example, all entries were indexed on page 1.
then the sort value will default to \'
eliteelite
if sanitizesort=false is used and will default to the literal string \’elite if sanitizesort=true is used. \alpha
, then you must use sanitizesort=true or change the sort method (sort=use or sort=def) in the package options or explicitly set the sort key when you define the relevant entries, as shown in the above example which has: \newglossaryentry
{alpha}{name={\ensuremath
{\alpha
}},
sort={alpha},description={a variable}
}
\glsxtrnewsymbol
, which automatically sets the sort key to the entry label (instead of the name).
to your preamble (before you start defining your entries, as described in §4).\makenoidxglossaries
where you want your list of entries to appear (described in §8). Alternatively, to display all glossaries use the iterative command: \printnoidxglossary
\printnoidxglossaries
1.3.2. Option 2 (makeindex)
Example 4 demonstrates a simple document that requires makeindex:
You can place all your entry definitions in a separate file and load it in the preamble with \documentclass
{article}
\usepackage
[style=indexgroup]{glossaries}
\makeglossaries
% open indexing files
\newglossaryentry
{parrot}{name={parrot},
description={a brightly coloured tropical bird}}
\newglossaryentry
{duck}{name={duck},
description={a waterbird}}
\newglossaryentry
{puffin}{name={puffin},
description={a seabird with a brightly coloured bill}}
\newglossaryentry
{penguin}{name={penguin},
description={a flightless black and white seabird}}
% a symbol:
\newglossaryentry
{alpha}{name={\ensuremath
{\alpha
}},
sort={alpha},description={a variable}}
% an acronym:
\setacronymstyle
{short-long}
\newacronym
{arpanet}{ARPANET}{Advanced Research Projects Agency Network}
\begin{document}
\Gls
{puffin}, \gls
{duck} and \gls
{parrot}.
\gls
{arpanet} and \gls
{alpha}.
Next use: \gls
{arpanet}.
\printglossary
\end{document}
\loadglsentries
(after \makeglossaries
). The result is the same as for Example 3.
\'
or \c
) and fails with UTF-8 characters, especially for any sort values that start with a UTF-8 character (as it separates the octets resulting in an invalid file encoding). This process involves making LaTeX write the glossary information to a temporary file which makeindex reads. Then makeindex writes a new file containing the code to typeset the glossary. Then \printglossary
reads this file in on the next run.\makeglossaries
) that adjusts the special characters and input keyword and also ensures that the resulting file (which is input by \printglossary
) adheres to the glossary style. If you want to use an alternative, you will need to ensure that it can honour the settings in the ist file. \arabic
, \roman
, \Roman
, \alph
and \Alph
.
You’ll need to repeat the last step if you have used the toc option (unless you’re using glossaries-extra) to ensure the section heading is added to the table of contents. You’ll also need to repeat steps 5 and 6 if you have any cross-references which can’t be indexed until the indexing file has been created.\GlsSetQuote
. For example:
This must be used before \GlsSetQuote
{+}
\makeglossaries
. Note that if you are using babel, the shorthands aren’t enabled until the start of the document, so you won’t be able to use the shorthands in definitions that occur in the preamble.
to your preamble (before you start defining your entries, as described in §4).\makeglossaries
where you want your list of entries to appear (described in §8). Alternatively, to display all glossaries use the iterative command: \printglossary
\printglossaries
makeindex -s myDoc.ist -o myDoc.gls myDoc.glo
(Replace myDoc
with the base name of your LaTeX document file. Avoid spaces in the file name if possible.)makeglossaries myDoc
Note that the file extension isn’t supplied in this case. (Replace makeglossaries with makeglossaries-lite if you don’t have Perl installed.) This will pick up all the file extensions from the aux file and run makeindex the appropriate number of times with all the necessary switches.% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
(Replace makeglossaries
with makeglossarieslite
in the second line above if you don’t have Perl installed. Note that there’s no hyphen in this case.)makeindex -l -s myDoc.ist -o myDoc.gls myDoc.glo
(See §1.6.4 for further details on using makeindex explicitly.) If you use makeglossaries or makeglossaries-lite then use the order=letter package option and the -l option will be added automatically.1.3.3. Option 3 (xindy)
Example 5 demonstrates a simple document that requires xindy:
You can place all your entry definitions in a separate file and load it in the preamble with \documentclass
{article}
\usepackage
[xindy,style=indexgroup]{glossaries}
\makeglossaries
% open indexing files
\newglossaryentry
{parrot}{name={parrot},
description={a brightly coloured tropical bird}}
\newglossaryentry
{duck}{name={duck},
description={a waterbird}}
\newglossaryentry
{puffin}{name={puffin},
description={a seabird with a brightly coloured bill}}
\newglossaryentry
{penguin}{name={penguin},
description={a flightless black and white seabird}}
% a symbol:
\newglossaryentry
{alpha}{name={\ensuremath
{\alpha
}},
sort={alpha},description={a variable}}
% an acronym:
\setacronymstyle
{short-long}
\newacronym
{arpanet}{ARPANET}{Advanced Research Projects Agency Network}
\begin{document}
\Gls
{puffin}, \gls
{duck} and \gls
{parrot}.
\gls
{arpanet} and \gls
{alpha}.
Next use: \gls
{arpanet}.
\printglossary
\end{document}
\loadglsentries
(after \makeglossaries
). The result is the same as for Example 3 and Example 4.
\printglossary
reads this file in on the next run.
In these problematic cases, you must set the sort field explicitly, as in the above example which has: $
and braces {
}
from the sort value, which is usually desired but this can cause the sort value to collapse to an empty string which xindy forbids.
\newglossaryentry
{alpha}{name={\ensuremath
{\alpha
}},
sort={alpha},description={a variable}
}
\glsxtrnewsymbol
, which automatically sets the sort key to the entry label (instead of the name).
If you are using a non-Latin script you’ll also need to either switch off the creation of the number group: \usepackage
[xindy]{glossaries}
or use either \usepackage
[xindy={glsnumbers=false}]{glossaries}
(to indicate the first letter group to follow the digits) or \GlsSetXdyFirstLetterAfterDigits
{ }
to indicate where the number group should be placed (see §14).\GlsSetXdyNumberGroupOrder
{ }\makeglossaries
to your preamble (before you start defining your entries, as described in §4).xindy -L english -C utf8 -I xindy -M myDoc -t myDoc.glg -o myDoc.gls myDoc.glo
(Replace myDoc
with the base name of your LaTeX document file. Avoid spaces in the file name. If necessary, also replace english
with the name of your language and utf8
with your input encoding, for example, -L german -C din5007-utf8
.)makeglossaries myDoc
Note that the file extension isn’t supplied in this case. This will pick up all the file extensions from the aux file and run xindy the appropriate number of times with all the necessary switches.% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
(and return to the previous step). This option is picked up by makeglossaries. If you are explicitly using xindy then you’ll need to add \usepackage
[xindy,order=letter]{glossaries}
-M ord/letorder
to the options list. See §1.6.3 for further details on using xindy explicitly.1.3.4. Option 4 (bib2gls)
Note that the abbreviation style must be set before \documentclass
{article}
\usepackage
[record,style=indexgroup]{glossaries-extra}
\setabbreviationstyle
{short-long}
% data in sample-entries.bib:
\GlsXtrLoadResources
[src={sample-entries}]
\begin{document}
\Gls
{puffin}, \gls
{duck} and \gls
{parrot}.
\gls
{arpanet} and \gls
{alpha}.
Next use: \gls
{arpanet}.
\printunsrtglossary
\end{document}
\GlsXtrLoadResources
. The file sample-entries.bib contains:
The result is slightly different from the previous examples. Letter groups aren’t created by default with bib2gls so, even though the glossary style supports letter groups, there’s no group information.
@entry
{parrot,
name={parrot},
description={a brightly coloured tropical bird}
}
@entry
{duck,
name={duck},
description={a waterbird}
}
@entry
{puffin,
name={puffin},
description={a seabird with a brightly coloured bill}
}
@entry
{penguin,
name={penguin},
description={a flightless black and white seabird}
}
@symbol
{alpha,
name={\ensuremath
{\alpha
}},
description={a variable}
}
@abbreviation
{arpanet,
short={ARPANET},
long={Advanced Research Projects Agency Network}
}
@atentry
, the symbol alpha (\(\alpha \)) is defined using @symbol
and the abbreviation “ARPANET” is defined using @abbreviation
.@entry
, @symbol
, @abbreviation
) has a particular field that’s used for the sort value by default (name, the label, short). You will break this mechanism if you explicitly use the sort key. See bib2gls gallery: sorting for examples.
or (equivalently) \usepackage
[record]{glossaries-extra}
or (with glossaries-extra v1.37+ and bib2gls v1.8+): \usepackage
[record=only]{glossaries-extra}
The record=nameref option is the best method if you are using hyperref.\usepackage
[record=nameref]{glossaries-extra}
\GlsXtrLoadResources
. For example:
The bib files are identified as a comma-separated list in the value of the src key. The sort option identifies the sorting method. This may be a locale identifier for alphabetic sorting, but there are other sort methods available, such as character code or numeric. One resource set may cover multiple glossaries or one glossary may be split across multiple resource sets, forming logical sub-blocks.\GlsXtrLoadResources
[% definitions in entries1.bib and entries2.bib:
src={entries1,entries2},
sort={de-CH-1996}% sort according to this locale
]
Alternatively all glossaries can be displayed using the iterative command: \printunsrtglossary
The document is built using: \printunsrtglossaries
pdflatex myDoc
bib2gls myDoc
pdflatex myDoc
If letter groups are required, you need the --group switch: bib2gls --group myDoc
or with arara: % arara: bib2gls: { group: on }
(You will also need an appropriate glossary style.)
\usepackage
[record]{glossaries-extra}
\GlsXtrLoadResources
to identify the bib file(s) and bib2gls options. The bib extension may be omitted: \GlsXtrLoadResources
[src={terms.bib,abbreviations.bib},sort=en]
where you want your list of entries to appear. Alternatively to display all glossaries use the iterative command: \printunsrtglossary
\printunsrtglossaries
1.3.5. Option 5 (“unsrt”)
You can place all your entry definitions in a separate file and load it in the preamble with \documentclass
{article}
\usepackage
[style=indexgroup]{glossaries-extra}
\newglossaryentry
{parrot}{name={parrot},
description={a brightly coloured tropical bird}}
\newglossaryentry
{duck}{name={duck},
description={a waterbird}}
\newglossaryentry
{puffin}{name={puffin},
description={a seabird with a brightly coloured bill}}
\newglossaryentry
{penguin}{name={penguin},
description={a flightless black and white seabird}}
% a symbol:
\newglossaryentry
{alpha}{name={\ensuremath
{\alpha
}},
description={a variable}}
% an abbreviation:
\setabbreviationstyle
{short-long}
\newabbreviation
{arpanet}{ARPANET}{Advanced Research Projects Agency Network}
\begin{document}
\Gls
{puffin}, \gls
{duck} and \gls
{parrot}.
\gls
{arpanet} and \gls
{alpha}.
Next use: \gls
{arpanet}.
\printunsrtglossary
\end{document}
\loadglsentries
. There’s no “activation” command (such as \makeglossaries
for Options 2 and 3). \printunsrtglossary
command simply iterates over the set of all defined entries associated with the given glossary and lists them in the order of definition. This means that child entries must be defined immediately after their parent entry if they must be kept together in the glossary. Some glossary styles indent entries that have a parent but it’s the indexing application that ensures the child entries are listed immediately after the parent. If you’re opting to use this manual approach then it’s your responsibility to define the entries in the correct order.\printunsrtglossary
won’t be listed.
Alternatively all glossaries can be displayed using the iterative command: \printunsrtglossary
\printunsrtglossaries
pdflatex myDoc
unless the glossary needs to appear in the table of contents, in which case a second run is required: pdflatex myDoc
pdflatex myDoc
(Naturally if the document also contains citations, and so on, then additional steps are required. Similarly for all the other options above.)1.3.6. Option 6 (“standalone”)
or \glsentryname
{ }
to display the entry name.) Instead of creating a list, this has standalone definitions throughout the document. The entry name may or may not be in a section heading.\Glsentryname
{ }\loadglsentries
), as with Option 5.
This allows the references to hyperlink to the standalone definitions rather than to a glossary.
\documentclass
{article}
\usepackage
[colorlinks]{hyperref}
\usepackage
[sort=none,
nostyles% <- no glossary styles are required
]{glossaries-extra}
\newglossaryentry
{set}{name={set},
description={a collection of any kind of objects},
symbol={\ensuremath
{\mathcal
{S}}}
}
\newglossaryentry
{function}{name={function},
description={a rule that assigns every element in the domain \gls
{set} to an element in the range \gls
{set}},
symbol={\ensuremath
{f(x)}}
}
\newcommand
*{\termdef
}[1]{%
\section
{\glsxtrglossentry
{#1} \glsentrysymbol
{#1}}%
\begin{quote}
\em
\Glsentrydesc
{#1}.\end{quote}
%
}
\begin{document}
\tableofcontents
\section
{Introduction}
Sample document about \glspl
{function} and \glspl
{set}.
\termdef
{set}
More detailed information about \glspl
{set} with examples.
\termdef
{function}
More detailed information about \glspl
{function} with examples.
\end{document}
Where the file terms.bib contains: \documentclass
{article}
\usepackage
[colorlinks]{hyperref}
\usepackage
[record,
nostyles% <- no glossary styles are required
]{glossaries-extra}
\GlsXtrLoadResources
[src={terms},sort=none,save-locations=false]
\newcommand
*{\termdef
}[1]{%
\section
{\glsxtrglossentry
{#1} \glossentrysymbol
{#1}}%
\glsadd
{#1}% <- index this entry
\begin{quote}
\em
\Glsentrydesc
{#1}.\end{quote}
%
}
\begin{document}
\tableofcontents
\section
{Introduction}
Sample document about \glspl
{function} and \glspl
{set}.
\termdef
{set}
More detailed information about \glspl
{set} with examples.
\termdef
{function}
More detailed information about \glspl
{function} with examples.
\end{document}
The advantage in this approach (with @entry
{set,
name={set},
description={a collection of any kind of objects},
symbol={\ensuremath
{\mathcal
{S}}}
}
@entry
{function,
name={function},
description={a rule that assigns every element in the domain \gls
{set} to an element in the range \gls
{set}},
symbol={\ensuremath
{f(x)}}
}
\loadglsentries
or bib2gls) is that you can use an existing database of entries shared across multiple documents, ensuring consistent notation for all of them.pdflatex myDoc
pdflatex myDoc
This will ensure that any entries indexed in the document (through commands like \GlsXtrLoadResources
[src={terms},sort=none]
\gls
or \glsadd
) will be selected by bib2gls, but it will skip the sorting step. (The chances are you probably also won’t need location lists either. If so, you can add the option save-locations=false.)pdflatex myDoc
bib2gls myDoc
pdflatex myDoc
pdflatex myDoc
\printunsrtglossary
, you use
where you want the name (and anchor with hyperref) to appear in the document. This will allow the link text created by commands like \glsxtrglossentry
{ }\gls
to link to that point in the document. The description can simply be displayed with
or \glsentrydesc
{ }
, as in the above examples. In both examples, I’ve defined a custom command \Glsentrydesc
{label}\termdef
to simplify the code and ensure consistency. Extra styling, such as placing the description in a coloured frame, can be added to this custom definition as required.\glsentrydesc
or \Glsentrydesc
, you can use
, which will obey category attributes such as glossdesc and glossdescfont. See the glossaries-extra manual for further details.)\glossentrydesc
{ }
or \glsentrysymbol
{ }
. In the first example, I’ve used \glossentrysymbol
{ }\glsentrysymbol
. In the second I’ve used \glossentrysymbol
. The latter is necessary with bib2gls if the symbol needs to go in a section title as the entries aren’t defined on the first LaTeX run.\glsentrysymbol
will silently do nothing if the entry hasn’t been defined, but when used in a section heading it will expand to an undefined internal command when written to the aux file, which triggers an error. \glossentrysymbol
command performs an existence check, which triggers a warning if the entry is undefined. (All entries will be undefined before the first bib2gls call.) You need at least glossaries-extra v1.42 to use this command in a section title. (\glossentrysymbol
is defined by the base glossaries package but is redefined by glossaries-extra.) If hyperref has been loaded, this will use \texorpdfstring
to allow a simple expansion for the PDF bookmarks (see the glossaries-extra user manual for further details).\ifglshassymbol
outside of the section title. For example: \ifglshassymbol
{#1}%
{\section
{\glsxtrglossentry
{#1} \glossentrysymbol
{#1}}}
{\section
{\glsxtrglossentry
{#1}}}
or (for title-case) \glssetcategoryattribute
{general}{glossname}{firstuc}
However, this won’t apply the case change in the table of contents or bookmarks. Instead you can use helper commands provided by glossaries-extra v1.49+ but make sure you have up-to-date versions of glossaries and mfirstuc.\glssetcategoryattribute
{general}{glossname}{title}
(Or name-case-change=title for title case.) This copies the name value to the text field and then applies a case change to the name field (leaving the text field unchanged). The name in the section titles now starts with a capital but the link text produced by commands like \GlsXtrLoadResources
[src={terms},
sort=none,save-locations=false,
replicate-fields={name=text},
name-case-change=firstuc
]
\gls
is still lowercase.
A more automated solution can be obtained with the standalone helper commands for the PDF bookmark and heading text (glossaries-extra v1.49+).\newglossaryentry
{set}{name={Set},text={set},
description={a collection of any kind of objects},
symbol={\ensuremath
{\mathcal
{S}}}
}
I also need to sort the entries, so the resource command is now: \usepackage
[record=nameref,% <- using bib2gls
nostyles,% <- don't load default style packages
stylemods=bookindex,% <- load glossary-bookindex.sty
style=bookindex% <- set the default style to 'bookindex'
]{glossaries-extra}
At the end of the document, I can add the glossary: \GlsXtrLoadResources
[src={terms},% definitions in terms.bib
sort=en-GB,% sort by this locale
replicate-fields={name=text},
name-case-change=firstuc
]
Note that I’ve had to switch off the hypertargets with target=false (otherwise there would be duplicate targets). If you want letter group headings you need to use the --group switch: \printunsrtglossary
[title=Index,target=false]
bib2gls --group myDoc
or if you are using arara: % arara: bib2gls: { group: on }
See the glossaries-extra user manual for further details about this style.\renewcommand
*{\glsxtrbookindexname
}[1]{%
\glossentrynameother
{#1}{text}}
@index
in the bib file. For example:
They can be used in the document as usual: @index
{element}
@index
{member,alias={element}}
The objects that make up a set are the
See glossaries-extra and bib2gls: An Introductory Guide or the bib2gls user manual for further details.\glspl
{element}
or \glspl
{member}.
1.4. Dummy Entries for Testing
\input
or \loadglsentries
. The glossaries-extra package provides bib versions of all these files for use with bib2gls. The files are as follows:\newglossaryentry
{lorem}{name={lorem},description={ipsum}}
\newglossaryentry
{loremipsum}{name={lorem ipsum},
description={dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris.}}
\longnewglossaryentry
{loremi-ii}{name={lorem 1--2}}%
{%
Lorem ipsum ...
Nam dui ligula...
}
\newglossaryentry
{alpha}{name={alpha},
symbol={\ensuremath
{\alpha
}},
description={Quisque ullamcorper placerat ipsum.}}
\newglossaryentry
{sym.alpha}{sort={alpha},
name={\ensuremath
{\alpha
}},
description={Quisque ullamcorper placerat ipsum.}}
There are also some level 1 entries, which may or may not have the symbol and user keys set. For example: \newglossaryentry
{sample-a}
{name={a name},
description={a description},
symbol={\ensuremath
{\alpha
}},
user1={A},
user2={1},
user3={i},
user4={A-i},
user5={25.2020788573521},
user6={1585-11-06}}
There are no deeper hierarchical entries. Where set, the user1 key is an uppercase letter (A–Z), the user2 key is an integer, the user3 key is a lowercase Roman numeral, the user4 key is in the form - where is either an upper or lowercase letter (a–z or A–Z) and is either an upper or lowercase Roman numeral. The user5 key is a random number (in the range \((-50,+50)\) for top level (level 0) entries and \((-1,+1)\) for child entries). The user6 key is a random date between 1000-01-01 and 2099-12-31.\newglossaryentry
{sample-b-0}
{parent={sample-b},
name={b/0 name},
description={child 0 of b},
symbol={\ensuremath
{\sigma
}},
user2={0},
user4={a-i}}
\longnewglossaryentry
{sedfeugiat}{name={sed feugiat},
user1={example-image}}%
{%
Cum sociis natoque...
Etiam...
}
\newacronym
[type={\glsdefaulttype
}]{lid}{LID}{lorem ipsum
dolor}
\newacronym
is redefined to use \newabbreviation
with the category key set to acronym (rather than the default abbreviation). This means that you need to set the abbreviation style for the acronym category. For example: \setabbreviationstyle
[acronym]{long-short}
\newacronym
[type={\glsdefaulttype
},
description={fringilla a, euismod sodales, sollicitudin vel, wisi}]{ndl}{NDL}{nam dui ligula}
\newacronym
is redefined to use \newabbreviation
with the category key set to acronym (rather than the default abbreviation). This means that you need to set the abbreviation style for the acronym category. For example: \setabbreviationstyle
[acronym]{long-short-desc}
\newacronym
[type={\glsdefaulttype
},user1={love itself}]
{li}{LI}{lorem ipsum}
\newacronym
is redefined to use \newabbreviation
with the category key set to acronym (rather than the default abbreviation). This means that you need to set the abbreviation style for the acronym category. For example: \setabbreviationstyle
[acronym]{long-short-user}
\newglossaryentry
{sedmattis}{name={sed mattis},
description={erat sit amet}}
\newglossaryentry
{gravida}{parent={sedmattis},
name={gravida},description={malesuada}}
\newglossaryentry
{scelerisque}{name={scelerisque},
description={at}}
\newglossaryentry
{vestibulum}{parent={scelerisque},
description={eu, nulla}}
\newglossaryentry
{longsedmattis}{name={sed mattis},
description={erat sit amet dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris.}}
\newglossaryentry
{longgravida}{parent={longsedmattis},name={gravida},
description={malesuada libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo.}}
\newglossaryentry
{hiersedmattis}{name={sed mattis},user1={example-image},
description={Erat sit amet dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Ut pellentesque augue sed urna. Vestibulum diam eros, fringilla et, consectetuer eu, nonummy id, sapien. Nullam at lectus. In sagittis ultrices mauris. Curabitur malesuada erat sit amet massa. Fusce blandit. Aliquam erat volutpat.}}
\longnewglossaryentry
{hierloremi-ii}
{name={lorem 1--2},parent={hiersedmattis}}%
{%
Lorem ipsum ...
Nam dui ligula...
}
\newglossaryentry
{fusce}{name={fusce},
description={suscipit cursus sem},user1={article-minimal}}
\newglossaryentry
{aenean-url}{name={aenean},
description={adipiscing auctor est},
user1={http://uk.tug.org/}}
\newglossaryentry
{alias-lorem}{name={alias-lorem},
description={ipsum},alias={lorem}}
\newglossaryentry
{amet}{name={amet},description={consectetuer},
see={dolor}}
\newglossaryentry
{arcu}name={arcu},description={libero},
seealso={placerat,vitae,curabitur}
1.5. Multi-Lingual Support
\babelprovide
. In the event that tracklang can’t detect the language, use the languages package option. See §1.2 and also Localisation with tracklang.tex for further details.
If you are using a non-Latin script, you may need the xindynoglsnumbers=option or use \documentclass
[french]{article}
\usepackage
[utf8]{inputenc}
\usepackage
[T1]{fontenc}
\usepackage
{babel}
\usepackage
[xindy]{glossaries}
\GlsSetXdyFirstLetterAfterDigits
to indicate the first letter group that should follow the number group.\Gls
). For example: % mfirstuc v2.07:
This isn’t necessary with glossaries v4.50+ and mfirstuc v2.08+. \newglossaryentry
{elite}{name={{é}lite},
description={select group or class}}
% mfirstuc v2.08:
\newglossaryentry
{elite}{name={élite},
description={select group or class}}
\makeglossaries
, you may need to specify the encoding using the -C option. Read the xindy manual for further details of this option."
) as an active character (for example, a babel shorthand) and you want to use makeindex’s -g option, you’ll need to change makeindex’s quote character using: ?
(question mark), |
(pipe) or !
(exclamation mark). For example:
This must be done before \GlsSetQuote
{+}
\makeglossaries
and any entry definitions. It’s only applicable for makeindex. This option in conjunction with ngerman will also cause makeglossaries to use the -g switch when invoking makeindex.\documentclass
{article}
\usepackage
[ngerman]{babel}
\usepackage
{glossaries}
\GlsSetQuote
{+}
\makeglossaries
\newglossaryentry
{rna}{name=ribonukleinsäure,
sort={ribonukleins"aure},
description={eine Nukleinsäure}}
\begin{document}
\gls
{rna}
\printglossaries
\end{document}
1.5.1. Changing the Fixed Names
and then use babel’s caption hook mechanism. Note that if you pass the language options directly to babel rather that using the document class options or otherwise passing the same options to translator, then translator won’t pick up the language and no dictionaries will be loaded and babel’s caption hooks will be used instead.\documentclass
[english,french]{article}
\usepackage
{babel}
\usepackage
[translate=babel]{glossaries}
Command Name
Translator Key Word
Purpose
\glossaryname
Glossary
Title of the main glossary.
\acronymname
Acronyms
Title of the list of acronyms (when used with package option acronym).
\entryname
Notation (glossaries)
Header for first column in the glossary (for 2, 3 or 4 column glossaries that support headers).
\descriptionname
Description (glossaries)
Header for second column in the glossary (for 2, 3 or 4 column glossaries that support headers).
\symbolname
Symbol (glossaries)
Header for symbol column in the glossary for glossary styles that support this option.
\pagelistname
Page List (glossaries)
Header for the page list column in the glossary for glossaries that support this option.
\glssymbolsgroupname
Symbols (glossaries)
Header for symbols section of the glossary for glossary styles that support this option.
\glsnumbersgroupname
Numbers (glossaries)
Header for numbers section of the glossary for glossary styles that support this option.
(translator is automatically loaded).\documentclass
[english,french]{article}
\usepackage
{babel}
\usepackage
{glossaries}
(translator isn’t loaded). The glossaries-extra package has translate=babel as the default if babel has been loaded.\documentclass
[english,french]{article}
\usepackage
{babel}
\usepackage
[translate=babel]{glossaries}
\documentclass
{article}
\usepackage
{polyglossia}
\setmainlanguage
{english}
\usepackage
{glossaries}
\deftranslation
) and load it using \usedictionary
. If you simply want to change the title of a glossary, you can use the title key in commands like \printglossary
(but not the iterative commands like \printglossaries
).\deftranslation
in the preamble. It should be put in your personal dictionary instead (as in the example below). See the translator documentation for further details.
You can now load it using: \ProvidesDictionary
{myinstitute-glossaries-dictionary}{English}
\deftranslation
{Glossary}{Nomenclature}
\deftranslation
{Page List (glossaries)}{Location}
(Make sure that myinstitute-glossaries-dictionary-English.dict can be found by TeX.) If you want to share your custom dictionary, you can upload it to CTAN.\usedictionary
{myinstitute-glossaries-dictionary}
\documentclass
[british]{article}
\usepackage
{babel}
\usepackage
[translate=babel]{glossaries}
\addto
\captionsbritish
{%
\renewcommand
*{\glossaryname
}{List of Terms}%
\renewcommand
*{\acronymname
}{List of Acronyms}%
}
1.5.2. Creating a New Language Module
english
) and is the language name used by translator (for example, English
).
You can use this as a template for your dictionary file. Change \ProvidesDictionary
{glossaries-dictionary}{English}
\providetranslation
{Glossary}{Glossary}
\providetranslation
{Acronyms}{Acronyms}
\providetranslation
{Notation (glossaries)}{Notation}
\providetranslation
{Description (glossaries)}{Description}
\providetranslation
{Symbol (glossaries)}{Symbol}
\providetranslation
{Page List (glossaries)}{Page List}
\providetranslation
{Symbols (glossaries)}{Symbols}
\providetranslation
{Numbers (glossaries)}{Numbers}
English
to the translator name for your language (so that it matches the file name glossaries-dictionary-.dict) and, for each \providetranslation
, change the second argument to the appropriate translation.
This is a somewhat longer file, but again you can use it as a template. Replace \ProvidesGlossariesLang
{english}
\glsifusedtranslatordict
{English}
{%
\addglossarytocaptions
{\CurrentTrackedLanguage
}%
\addglossarytocaptions
{\CurrentTrackedDialect
}%
}
{%
\@ifpackageloaded
{polyglossia}%
{%
\newcommand
*{\glossariescaptionsenglish
}{%
\renewcommand
*{\glossaryname
}{\textenglish
{Glossary}}%
\renewcommand
*{\acronymname
}{\textenglish
{Acronyms}}%
\renewcommand
*{\entryname
}{\textenglish
{Notation}}%
\renewcommand
*{\descriptionname
}{\textenglish
{Description}}%
\renewcommand
*{\symbolname
}{\textenglish
{Symbol}}%
\renewcommand
*{\pagelistname
}{\textenglish
{Page List}}%
\renewcommand
*{\glssymbolsgroupname
}{\textenglish
{Symbols}}%
\renewcommand
*{\glsnumbersgroupname
}{\textenglish
{Numbers}}%
}%
}%
{%
\newcommand
*{\glossariescaptionsenglish
}{%
\renewcommand
*{\glossaryname
}{Glossary}%
\renewcommand
*{\acronymname
}{Acronyms}%
\renewcommand
*{\entryname
}{Notation}%
\renewcommand
*{\descriptionname
}{Description}%
\renewcommand
*{\symbolname
}{Symbol}%
\renewcommand
*{\pagelistname
}{Page List}%
\renewcommand
*{\glssymbolsgroupname
}{Symbols}%
\renewcommand
*{\glsnumbersgroupname
}{Numbers}%
}%
}%
\ifcsdef
{captions\CurrentTrackedDialect
}
{%
\csappto
{captions\CurrentTrackedDialect
}%
{%
\glossariescaptionsenglish
}%
}%
{%
\ifcsdef
{captions\CurrentTrackedLanguage
}
{%
\csappto
{captions\CurrentTrackedLanguage
}%
{%
\glossariescaptionsenglish
}%
}%
%
%
}%
\glossariescaptionsenglish
}
\renewcommand
*{\glspluralsuffix
}{s}
\renewcommand
*{\glsacrpluralsuffix
}{\glspluralsuffix
}
\renewcommand
*{\glsupacrpluralsuffix
}{\glstextup
{\glspluralsuffix
}}
English
with the translator language label used for the dictionary file and replace english
with the root language name . Within the definition of \glossariescaptions
, replace the English text (such as “Glossaries”) with the appropriate translation.\glspluralsuffix
(for general entries). For acronyms defined with the base \newacronym
, \glsupacrpluralsuffix
is used for the small caps acronym styles where the suffix needs to be set using \glstextup
to counteract the effects of \textsc
and \glsacrpluralsuffix
for other acronym styles. There’s no guarantee when these commands will be expanded. They may be expanded on definition or they may be expanded on use, depending on the glossaries configuration.\captions
hook as that’s typically not switched used until the start of the document. This means that the suffix in effect will be for the last loaded language that redefined these commands. It’s best to initialise these commands to the most common suffix required in your document and use the plural, longplural, shortplural etc keys to override exceptions. \ProvidesGlossariesLang
{en-GB}
\RequireGlossariesLang
{english}
\glsifusedtranslatordict
{British}
{%
\addglossarytocaptions
{\CurrentTrackedLanguage
}%
\addglossarytocaptions
{\CurrentTrackedDialect
}%
}
{%
\@ifpackageloaded
{polyglossia}%
{%
% Modify \glossariescaptionsenglish
as appropriate for
% polyglossia
}%
{%
% Modify \glossariescaptionsenglish
as appropriate for
% non-polyglossia
}%
}
(Again you can use this as a template. Replace \ProvidesGlossariesLang
{irish}
\glsifusedtranslatordict
{Irish}
{%
\addglossarytocaptions
{\CurrentTrackedLanguage
}%
\addglossarytocaptions
{\CurrentTrackedDialect
}%
}
{%
\ifdefstring
{\inputencodingname
}{utf8}
{\input
{glossaries-irish-utf8.ldf}}%
{%
\ifdef
\XeTeXinputencoding
% XeTeX defaults to UTF-8
{\input
{glossaries-irish-utf8.ldf}}%
{\input
{glossaries-irish-noenc.ldf}}
}
\ifcsdef
{captions\CurrentTrackedDialect
}
{%
\csappto
{captions\CurrentTrackedDialect
}%
{%
\glossariescaptionsirish
}%
}%
{%
\ifcsdef
{captions\CurrentTrackedLanguage
}
{
\csappto
{captions\CurrentTrackedLanguage
}%
{%
\glossariescaptionsirish
}%
}%
{%
}%
}%
\glossariescaptionsirish
}
irish
with your root language label and Irish
with the translator dictionary label.)\glossariescaptionsirish
but the *-noenc.ldf file uses LaTeX accent commands:
whereas the *-utf8.ldf file replaces the accent commands with the appropriate UTF-8 characters.\@ifpackageloaded
{polyglossia}%
{%
\newcommand
*{\glossariescaptionsirish
}{%
\renewcommand
*{\glossaryname
}{\textirish
{Gluais}}%
\renewcommand
*{\acronymname
}{\textirish
{Acrainmneacha}}%
\renewcommand
*{\entryname
}{\textirish
{Ciall}}%
\renewcommand
*{\descriptionname
}{\textirish
{Tuairisc}}%
\renewcommand
*{\symbolname
}{\textirish
{Comhartha}}%
\renewcommand
*{\glssymbolsgroupname
}{\textirish
{Comhartha\'
\i
}}%
\renewcommand
*{\pagelistname
}{\textirish
{Leathanaigh}}%
\renewcommand
*{\glsnumbersgroupname
}{\textirish
{Uimhreacha}}%
}%
}%
{%
\newcommand
*{\glossariescaptionsirish
}{%
\renewcommand
*{\glossaryname
}{Gluais}%
\renewcommand
*{\acronymname
}{Acrainmneacha}%
\renewcommand
*{\entryname
}{Ciall}%
\renewcommand
*{\descriptionname
}{Tuairisc}%
\renewcommand
*{\symbolname
}{Comhartha}%
\renewcommand
*{\glssymbolsgroupname
}{Comhartha\'
\i
}%
\renewcommand
*{\pagelistname
}{Leathanaigh}%
\renewcommand
*{\glsnumbersgroupname
}{Uimhreacha}%
}%
}
1.6. Generating the Associated Glossary Files
% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
With latexmk you need to set up the required dependencies. \makeglossaries
). See §1.6.1 for further details. Perl is stable, cross-platform, open source software that is used by a number of TeX-related applications (including xindy and latexmk). Most Unix-like operating systems come with a Perl interpreter. TeX Live also comes with a Perl interpreter. As far as I know, MikTeX doesn’t come with a Perl interpreter so if you are a Windows MikTeX user you will need to install Perl if you want to use makeglossaries or xindy. Further information is available at http://www.perl.org/about.html and MikTeX and Perl scripts (and one Python script).
The first two items also apply to makeglossaries-lite.
and suppose you have \newglossaryentry
{citrusfruit}{name={citrus fruit},
description={fruit of any citrus tree. (See also \gls
{orange})}}
\newglossaryentry
{orange}{name={orange},
description={an orange coloured fruit.}}
in your document but don’t reference the “orange” entry, then the orange entry won’t appear in your glossary until you first create the glossary and then do another run of makeglossaries, makeindex or xindy. For example, if the document is called myDoc.tex, then you must do: \gls
{citrusfruit}pdflatex myDoc
makeglossaries myDoc
pdflatex myDoc
makeglossaries myDoc
pdflatex myDoc
(In the case of Option 4, bib2gls will scan the description for instances of commands like \gls
to ensure they are selected but an extra bib2gls call is required to ensure the locations are included, if location lists are required. See the and bib2gls manual for further details.)
Command or Package Option
makeindex
xindy
order=letter
use -l
use
-M ord/letorder
order=word
default
default
xindy=language={lang},codepage={code}
N/A
use
-L -C
\GlsSetXdyLanguage
{ } N/A
use
-L
\GlsSetXdyCodePage
{ } N/A
use
-C
1.6.1. Using the makeglossaries Perl Script
makeglossaries
pdflatex myDoc
makeglossaries myDoc
pdflatex myDoc
If you only want one glossary processed (for example, if you are working on a draft of a large document and want to concentrate on one specific glossary) then include the extension supplied to \newglossary
, such as glo for the main
glossary. Note that if you do specify the extension and your document has multiple glossaries defined, then makeglossaries will tell you how many glossaries have been ignored unless the -q has been used.pdflatex -output-directory myTmpDir myDoc
makeglossaries -d myTmpDir myDoc
If you explicitly use makeindex, this will cause a warning and the location list will be “1, 1”. That is, the page number will be repeated with each format. As from v2.18, makeglossaries will check for this warning and, if found, will attempt to correct the problem by removing duplicate locations and retrying. If you actually want the duplicate location, you can prevent makeglossaries from checking and correcting the duplicates with -e.\documentclass
{article}
\usepackage
{glossaries}
\makeglossaries
\newglossaryentry
{sample}{name={sample},description={an example}}
\begin{document}
\gls
{sample}, \gls
[format=textbf]{sample}.
\printglossaries
\end{document}
open()
on the piped redirection 2>&1 |
and parses the processor output to help diagnose problems. If this method fails makeglossaries will print an “Unable to fork” warning and will retry without redirection. Without this redirection, the -q switch doesn’t work as well. Some operating systems don’t support redirection.-p
to makeindex. (Ignored if xindy should be called.)-M ord/letorder
to xindy.-s
to makeindex or -M
to xindy (where is with the xdy extension removed). This will generate an error if the extension is xdy when makeindex should be called, or if the extension isn’t xdy when xindy should be called.\newglossary
).\newglossary
).1.6.2. Using the makeglossaries-lite Lua Script
makeglossaries-lite
makeglossaries-lite myDoc
Note that the arara rule doesn’t contain the hyphen: % arara: makeglossarieslite
-p
to makeindex. (Ignored if xindy should be called.)-M ord/letorder
to xindy.\newglossary
).\newglossary
).1.6.3. Using xindy explicitly (Option 3)
This is required regardless of whether you use xindy explicitly or whether it’s called implicitly via applications such as makeglossaries. This causes the glossary entries to be written in raw xindy format, so you need to use \usepackage
[xindy]{glossaries}
-I xindy
not -I tex
.xindy -L -C -I xindy -M -t .glg -o .gls .glo
where is the required language name, is the encoding, is the name of the document without the tex extension and is the name of the xindy style file without the xdy extension. The default name for this style file is xdy but can be changed via \setStyleFile
. You may need to specify the full path name depending on the current working directory. If any of the file names contain spaces, you must delimit them using double-quotes.xindy -L english -C utf8 -I xindy -M myDoc -t myDoc.glg -o myDoc.gls myDoc.glo
main
glossary. You need to do the same for each of the other glossaries (including the list of acronyms if you have used the acronym package option), substituting glg, gls and glo with the relevant extensions. For example, if you have used the acronym package option, then you would need to do: xindy -L english -C utf8 -I xindy -M myDoc -t myDoc.alg -o myDoc.acr myDoc.acn
For additional glossaries, the extensions are those supplied when you created the glossary with \newglossary
.makeglossaries myDoc
Note also that some commands and package options have no effect if you use xindy explicitly instead of using makeglossaries. These are listed in Table 1.3.1.6.4. Using makeindex explicitly (Option 2)
makeindex -s .ist -t .glg -o .gls .glo
where is the name of your document without the tex extension and ist is the name of the makeindex style file. By default, this is ist, but may be changed via \setStyleFile
. Note that there are other options, such as -l (letter ordering). See the makeindex manual for further details.makeindex -s myDoc.ist -t myDoc.glg -o myDoc.gls myDoc.glo
Note that this only creates the main
glossary. If you have additional glossaries (for example, if you have used the acronym package option) then you must call makeindex for each glossary, substituting glg, gls and glo with the relevant extensions. For example, if you have used the acronym package option, then you need to type the following in your terminal: makeindex -s myDoc.ist -t myDoc.alg -o myDoc.acr myDoc.acn
For additional glossaries, the extensions are those supplied when you created the glossary with \newglossary
.makeglossaries myDoc
Note also that some commands and package options have no effect if you use makeindex explicitly instead of using makeglossaries. These are listed in Table 1.3.1.7. Note to Front-End and Script Developers
1.7.1. MakeIndex and Xindy
main
glossary is written as:
If glossaries-extra’s hybrid method has been used (with \@newglossary
{main}{glg}{gls}{glo}
\makeglossaries
[ ]), then the sub-list of glossaries that need to be processed will be identified with:
% arara: makeglossaries if found("aux", "@istfilename")
It’s more complicated if you want to explicitly run makeindex or xindy.word
or letter
(obtained from the order package option).english
).utf8
). The above two commands are omitted if makeindex should be used.1.7.2. Entry Labels
1.7.3. Bib2Gls
% arara: bib2gls if found("aux", "glsxtr@resource")
(It gets more complicated if both \glsxtr@resource
and \@istfilename
are present as that indicates the hybrid record=hybrid option.)\glssee
):
{label}{xr list} You can also pick up the commands defined with \glsxtrnewglslike
, which are added to the aux file for bib2gls’s benefit:
If \GlsXtrSetAltModifier
is used, then the modifier is identified with:
Label prefixes (for the \dgls
set of commands) are identified with:
2. Package Options
=true
for boolean options. (For example, acronym is equivalent to acronym=true).2.1. General Options
\makeglossaries
). Note that if you use debug with any value other than false it will override this option.\makeglossaries
: wrglossary(
Note that this setting will also cancel )( )
nowarn.\glsdohypertarget
is used by commands like \glstarget
and when \glsdohyperlink
is used by commands like \gls
. In math mode or inner mode, this uses:
which typesets the target name as: [
just before the link or anchor. This uses the text-block command:
which checks for math-mode before applying the font change. In outer mode \glsshowtargetfonttext
{ }]
\glsshowtarget
uses:
which by default places the target name in the margin with a symbol produced with:
which defaults to a small right facing triangle.\glsshowtargetfonttext
and \glsshowtargetouter
is given by the declaration:
In this case, only the “sample1” entry has been indexed, even though \documentclass
{article}
\usepackage
{glossaries}
\newglossaryentry
{sample1}{name={sample1},description={example}}
\newglossaryentry
{sample2}{name={sample2},description={example}}
\glsadd
{sample2}% <- does nothing here
\makeglossaries
\begin{document}
\gls
{sample1}.
\printglossaries
\end{document}
appears in the source code. This is because \glsadd
{sample2}
has been used before the associated file is opened by \glsadd
{sample2}\makeglossaries
. Since the file isn’t open yet, the information can’t be written to it, which is why the “sample2” entry doesn’t appear in the glossary.\makeglossaries
the indexing is suppressed with Options 2 and 3 but, other than that, commands like \gls
behave as usual.\makeglossaries
in order to suppress the indexing while working on a draft version to speed compilation, or the user may prefer to use Options 1 or 4 for indexing, which don’t use \makeglossaries
.\makeglossaries
can’t be used to enable \newglossaryentry
and commands like \gls
and \glsadd
. These commands must be enabled by default. (It does, however, enable the see key as that’s a more common problem. See below.)
will write information to the log file when the indexing can’t occur because the associated file isn’t open. The message is written in the form \usepackage
[debug]{glossaries}
Package glossaries Info: wrglossary( )( ) on
input line .
where is the glossary label and is the line of text that would’ve been written to the associated file if it had been open. So if any entries haven’t appeared in the glossary but you’re sure you used commands like \glsadd
or \glsaddall
, try switching on the debug option and see if any information has been written to the log file.\addto
\captions
mechanism. If polyglossia has been loaded, glossaries-polyglossia will be loaded.\glossaryname
so that will still be translated if you have loaded babel.)pt-BR
) or one of tracklang’s known language labels (such as british
).
. If false, only subsequent use instances will have a hyperlink (if supported).\gls
*\gls
-like commands (for example, \gls
or \glsdisp
), but not the \glstext
-like commands (for example, \glslink
or \glstext
). \newignoredglossary
). It can be overridden on an individual basis by explicitly setting the hyper key when referencing an entry (or by using the plus or starred version of the referencing command).\glsunsetall
to all the regular (non-acronym) glossaries. For example: \usepackage
[acronym,hyperfirst=false]{glossaries}
% acronym and glossary entry definitions
% at the end of the preamble
\glsunsetall
[main
]
\gls
. Within the definition of this command, you can use \glslabel
to reference the entry label and \glstype
to reference the glossary type. You can also use \ifglsused
to determine if the entry has been used. You can test if an entry is an acronym by checking if it has the long key set using \ifglshaslong
(or if the short key has been set using \ifglshasshort
). For example, to switch off the hyperlink on first use just for acronyms: \renewcommand
*{\glslinkcheckfirsthyperhook
}{%
\ifglsused
{\glslabel
}{}%
{%
\ifglshaslong
{\glslabel
}{\setkeys
{glslink}{hyper=false}}%
}%
}
\glstext
. (You can, instead, redefine \glslinkpostsetkeys
, which is used by both the \gls
-like and \glstext
-like commands.)
at the end of the document. This file simply contains a list of all defined entry labels (including those in any ignored glossaries). It’s provided for the benefit of text editors that need to know labels for auto-completion. If you also want the name, use writeglslabelnames. (See also glossaries-extra’s docdef=atom package option.)\jobname
.glslabels\newglossaryentry
. Available values:\newglossaryentry
is not permitted in the document environment (default with glossaries-extra and for Option 1 with just the base glossaries package).\newglossaryentry
is only permitted in the document environment if it occurs before \printglossary
(not available for some indexing options, such as Option 4).\newglossaryentry
is permitted in the document environment where it would normally be permitted by the base glossaries package. This will create the glsdefs file if \newglossaryentry
is found in the document environment.2.2. Sectioning, Headings and TOC Options
in the final argument of \numberline
{}\addcontentsline
. This will align the table of contents entry with the numbered section titles. Note that this option has no effect with toc=false. If toc=true is used without numberline, the glossary title will be aligned with the section numbers rather than the section titles.chapter
not \chapter
or chapter*
).\chapter
, if that command exists, or \section
otherwise. The starred or unstarred form is determined by the numberedsection option.
You can omit the value if you want to use \usepackage
[section=subsection]{glossaries}
\section
:
is equivalent to \usepackage
[section]{glossaries}
You can change this value later in the document using
where is the sectional unit.\usepackage
[section=section]{glossaries}
\glsglossarymark
(see §8.2).\glsglossarymark
use all caps in the header, otherwise no case change will be applied. The default is ucmark=false, unless memoir has been loaded, in which case the default is ucmark=true.\renewcommand
{\glsglossarymark
}[1]{%
\ifglsucmark
\markright
{\glsuppercase
{#1}}%
\else
\markright
{#1}%
\fi
}
\chapter*
or \section*
).\chapter
or \section
), but no label is automatically added.\chapter
or \section
) and is assigned a label (via \label
). The label is formed from the glossary’s label prefixed with:
The default value of \glsautoprefix
is empty. For example, if you load glossaries using:
then each glossary will appear in a numbered section, and can be referenced using something like: \usepackage
[section,numberedsection=autolabel]
{glossaries}
The main glossary is in section
If you can’t decide whether to have the acronyms in the main glossary or a separate list of acronyms, you can use ~
\ref
{main} and
the list of acronyms is in section~
\ref
{acronym}.
\acronymtype
which is set to main
if the acronym option is not used and is set to acronym
if the acronym option is used. For example: The list of acronyms is in section
You can redefine the prefix if the default label clashes with another label in your document. For example: ~
\ref
{\acronymtype
}.
will add \renewcommand
*{\glsautoprefix
}{glo:}
glo:
to the automatically generated label, so you can then, for example, refer to the list of acronyms as follows: The list of acronyms is in
section
Or, if you are undecided on a prefix: ~
\ref
{glo:\acronymtype
}.
The list of acronyms is in
section
~
\ref
{\glsautoprefix
\acronymtype
}.
\chapter*
or \section*
). It’s designed for use with the nameref package. For example:
Alternatively, since nameref is automatically loaded by hyperref: \usepackage
{nameref}
\usepackage
[numberedsection=nameref]{glossaries}
Now \usepackage
{hyperref}
\usepackage
[numberedsection=nameref]{glossaries}
will display the (table of contents) section title associated with the \nameref
{main}main
glossary. As above, you can redefine \glsautoprefix
to provide a prefix for the label.2.3. Glossary Appearance Options
\glsentrynumberlist
and \glsdisplaynumberlist
in §5.2.) This setting is always true if you use Option 1 as a by-product of the way that indexing method works.\ref
if either entrycounter=true or subentrycounter=true, with the label , where is the entry’s label and is given by:
If both entrycounter=false and subentrycounter=false,
will be used instead.\gls
{ }\glsrefentry
, you must run LaTeX twice after creating the indexing files using makeglossaries, makeindex or xindy (or after creating the glstex file with bib2gls) to ensure the cross-references are up-to-date. This is because the counter can’t be incremented and labelled until the glossary is typeset. \refstepcounter
and \label
) with:
This command is within the definition of \glsentryitem
, which is typically used in glossary styles at the start of top level (level 0) entries. The argument is the entry label.
if entrycounter=true, otherwise does nothing. This is therefore more generally useful in glossary styles as it will silently do nothing if the setting isn’t on. This command is used within the definition of \theglossaryentry
.\space
\glsentryitem
.\print
option glossary.\glossarypreamble
) to use \glsresetentrycounter
. For example:
or if you are using \renewcommand
{\glossarypreamble
}{%
\glsresetentrycounter
}
\setglossarypreamble
, add it to each glossary preamble, as required. For example: \setglossarypreamble
[acronym
]{%
\glsresetentrycounter
The preamble text here for the list of acronyms.
}
\setglossarypreamble
{%
\glsresetentrycounter
The preamble text here for the main
glossary.
}
\glsentryitem
. If subentrycounter is used before entrycounter then the two counters are independent.\glsrefentry
. There are analogous commands to those for entrycounter.\glsentryitem
if entrycounter=false.\refstepcounter
and \label
) with: \glssubentryitem
if subentrycounter=true, otherwise it does nothing. The argument is the entry label and is passed to \label
is as for \glsrefentry
.
if subentrycounter=true, otherwise does nothing. This is therefore more generally useful in glossary styles as it will silently do nothing if the setting isn’t on. This command is used in \theglossarysubentry
)\space
\glssubentryitem
.\print
option glossary.\print
option glossary. (See §13 for further details.)\setglossarystyle
or the style \print
option glossary. Example:
Alternatively: \usepackage
[nostyles]{glossaries}
\usepackage
{glossary-mcols}
\setglossarystyle
{mcoltree}
\usepackage
[nostyles,stylemods=mcols,style=mcoltree]{glossaries-extra}
\print
options glossary.\newglossaryentry
or \glssee
. If you use seeautonumberlist, the see key will automatically implement nonumberlist=false for that entry. (Note this doesn’t affect \glssee
.) For further details see §11.\newglossary
or the counter key when defining an entry or by the counter option when referencing an entry.\print
options glossary.2.4. Indexing Options
(This option is only relevant with makeindex and xindy.) The see key automatically indexes the cross-referenced entry using \glssee
. This means that if this key is used in an entry definition before the relevant indexing file has been opened, the indexing can’t be performed. Since this is easy to miss, the glossaries package by default issues an error message if the see key is used before \makeglossaries
. \makeglossaries
to speed up the compilation of a draft document by omitting the indexing, you can use seenoindex=warn or seenoindex=ignore.\thepage
with the default counter=page) expand to a robust command then you may need to use esclocations=true. You may additionally need to set the following conditional to true: \thepage
. Since this hack may cause some issues and isn’t necessary for the majority of documents, this is off by default., where { } is a command (optionally preceded by
\protect
) and is a location acceptable to makeindex, then you can use makeglossaries to make a suitable adjustment without esclocations=true. See §12.5 for furthe details.\gls
-like or \glstext
-like commands are used. Note that \glsadd
will always add information to the external glossary file (since that’s the purpose of that command).\glsreset
after an entry has been indexed will cause that entry to be indexed multiple times if it’s used again after the reset. Likewise unsetting the first use flag before an entry has been indexed will prevent it from being indexed (unless specifically indexed with \glsadd
). \glswriteentry
is:
This does unless indexonlyfirst=true and the entry identified by has been marked as used\newcommand
*{\glswriteentry
}[2]{%
\ifglsindexonlyfirst
\ifglsused
{#1}{}{#2}%
\else
#2%
\fi
}
acronym
glossary and not in the main
(or any other) glossary:
Here I’ve used \renewcommand
*{\glswriteentry
}[2]{%
\ifthenelse
\equal
{\glsentrytype
{#1}}{acronym}
{\ifglsused
{#1}{}{#2}}%
{#2}%
}
\ifthenelse
to ensure the arguments of \equal
are fully expanded before the comparison is made. There are other methods of performing an expanded string comparison, which you may prefer to use.\glsadd
) any cross-referenced entries that haven’t been marked as used at the end of the document. Note that this increases the document build time. See glossaries-extra manual for further details.\glssee
) when the entry is defined. This means that any entry with the see (or seealso) key will automatically be added to the glossary. See the glossaries-extra manual for further details.\caption
command that increments the counter so the location will be incorrect if an entry is indexed within the float before the caption.)2.5. Sorting Options
\GlsXtrLoadResources
not with the sort package option. There’s no sorting with Options 5 and 6.
The sort value () must be sanitized before writing it to the indexing file, otherwise LaTeX will try to interpret it as a parameter reference. If, on the other hand, you want the sort value expanded, you need to switch off the sanitization. For example, suppose you do: \newglossaryentry
{hash}{name={\#
},sort={},
description={hash symbol}}
and you actually want \newcommand
{\mysortvalue
}{AAA}
\newglossaryentry
{sample}{%
name={sample},
sort={\mysortvalue
},
description={an example}}
\mysortvalue
expanded, so that the entry is sorted according to AAA
, then use the package option sanitizesortfalse.\printnoidxglossary
. If you have multiple glossaries in your document and you are using Option 1, only use the package options sort=def or sort=use if you want to set this sort method for all your glossaries.\makeglossaries
(Options 2 or 3) or \makenoidxglossaries
(Option 1). It omits the code used to sanitize or escape the sort value, since it’s not required. This can help to improve the document build speed, especially if there are a large number of entries. This setting may be used if no glossary is required or if \printunsrtglossary
is used (Option 5). If you want an unsorted glossary with bib2gls, use the resource option sort=none instead. This option will redefine \glsindexingsetting
to none
.\printunsrtglossary
with Option 5. See the glossaries-extra manual for further details. This option will redefine \glsindexingsetting
to none
. The remaining sort options listed below don’t change \glsindexingsetting
.\newglossaryentry
(if present) or the name key (if sort key is missing).\glsprestandardsort
just does:
which sanitizes if sanitizesort=true (or does nothing if sanitizesort=false).\newglossaryentry
.\glsprestandardsort
won’t affect any entries that have already been defined and will have no effect at all if you use another sort setting. main
, acronym
and notation
, and let’s suppose I want the main
and acronym
glossaries to be sorted alphabetically, but the notation
type should be sorted in order of definition. \printnoidxglossary
: \printnoidxglossary
[sort=word]
\printnoidxglossary
[type=acronym
,sort=word]
\printnoidxglossary
[type=notation,sort=def]
main
and acronym
entries, then redefine \glsprestandardsort
to set to an incremented integer, and then define all my notation
entries. Alternatively, I can redefine \glsprestandardsort
to check for the glossary type and only modify if is notation
.
The second method can be achieved as follows: \newcounter
{sortcount}
\renewcommand
{\glsprestandardsort
}[3]{%
\stepcounter
{sortcount}%
\edef
#1{\glssortnumberfmt
{\arabic
{sortcount}}}%
}
(\newcounter
{sortcount}
\renewcommand
{\glsprestandardsort
}[3]{%
\ifdefstring
{#2}{notation}%
{%
\stepcounter
{sortcount}%
\edef
#1{\glssortnumberfmt
{\arabic
{sortcount}}}%
}%
{%
\glsdosanitizesort
}%
}
\ifdefstring
is defined by the etoolbox package, which is automatically loaded by glossaries.) For a complete document, see the sample file sampleSort.tex. \name
{first-name}{surname} that you can use in the name key when you define the entry, but hook into the standard sort mechanism to temporarily redefine \name
while the sort value is being set.
and \newcommand
{\sortname
}[2]{#2, #1}
\newcommand
{\textname
}[2]{#1 #2}
\name
needs to be initialised to \textname
:
Now redefine \let
\name
\textname
\glsprestandardsort
so that it temporarily sets \name
to \sortname
and expands the sort value, then sets \name
to \textname
so that the person’s name appears as in the text:
(The somewhat complicate use of \renewcommand
{\glsprestandardsort
}[3]{%
\let
\name
\sortname
\edef
#1{\expandafter
\expandonce
\expandafter
{#1}}%
\let
\name
\textname
\glsdosanitizesort
}
\expandafter
etc helps to protect fragile commands, but care is still needed.)
For a complete document, see the sample file samplePeople.tex. \newglossaryentry
{joebloggs}name={\name
{Joe}{Bloggs}},
description={some information about Joe Bloggs}
\newglossaryentry
{johnsmith}{name={\name
{John}{Smith}},
description={some information about John Smith}}
\printnoidxglossary
:
Alternatively, you can specify the order for individual glossaries: \printnoidxglossary
[sort=standard]
\printnoidxglossary
[sort=word]
\printnoidxglossary
[type=acronym
,sort=letter]
\makeglossaries
otherwise the syntax in the glossary files will be incorrect. If this conditional is false, it means that any option other than Option 3 is in effect. (If you need to know which indexing option is in effect, check the definition of \glsindexingsetting
instead.)\languagename
but note that this may not be correct as xindy has a different labelling system to babel and polyglossia. \languagename
may still not expand to the language required for the glossary. In which case, you need to specify the correct xindy language. For example:
If you have multiple glossaries in different languages, use \usepackage
[brazilian,english]{babel}
\usepackage
[xindy=language=portuguese]{glossaries}
\GlsSetXdyLanguage
to set the language for each glossary.\inputencodingname
. As from v4.50, if \inputencodingname
isn’t defined, UTF-8 is assumed (which is identified by the label utf8
). If this is incorrect, you will need to use the codepage option but make sure you use the xindy codepage label (for example, cp1252
or latin9
). See the xindy documentation for further details.ij-as-y-utf8
or din5007-utf8
. See §14.2. \usepackage
[xindy=language=english,codepage=cp1252]
{glossaries}
\GlsSetXdyNumberGroupOrder
.\GlsSetXdyLanguage
and \GlsSetXdyCodePage
if the defaults are inappropriate (see §14.2.)
Then the document build is now: \usepackage
[automake]{glossaries}
\makeglossaries
\newglossaryentry
{sample}{name={sample},description={an example}}
\begin{document}
\gls
{sample}
\printglossaries
\end{document}
pdflatex myDoc
pdflatex myDoc
This will run makeindex on every LaTeX run. If you have a large glossary with a complex document build, this can end up being more time-consuming that simply running makeindex (either explicitly or via makeglossaries) the minimum number of required times.runsystem
”. For example, if the document is in a file called myDoc.tex and it has:
and you run LaTeX in restricted mode, then if call was successful, you should find the following line in the file myDoc.log: \usepackage
[automake]{glossaries}
runsystem(makeindex -s myDoc.ist -t myDoc.glg -o myDoc.gls myDoc.glo)...executed safely (allowed).
The parentheses immediately after “runsystem
” show how the command was called. The bit after the three dots ...
indicates whether or not the command was run and, if so, whether it was successful. In the above case, it has “executed safely (allowed)”. This means that it was allowed to run in restricted mode because makeindex is on the list of trusted applications.
and rerun LaTeX in restricted mode, then the line in myDoc.log will now be: \usepackage
[automake=makegloss]{glossaries}
runsystem(makeglossaries myDoc)...disabled (restricted).
This indicates that an attempt was made to run makeglossaries (rather than a direct call to makeindex), which isn’t permitted in restricted mode. There will be a similar message with automake=lite or if the xindy option is used. These cases require the unrestricted shell escape. runsystem
” to find out exactly what system calls are being attempted. runsystem(makeglossaries myDoc)...executed.
This means that makeglossaries was run. If it has “failed” instead of “executed”, then it means there was a fatal error. Note that just because the log file has “executed” doesn’t mean that the application ran without a problem as there may have been some warnings or non-fatal errors. If you get any unexpected results, check the indexing application’s transcript file (for example, the glg file, myDoc.glg in the above, for the main
glossary).\thepage
is correct.) Unfortunately, there are situations where the delayed write never occurs, for example, if there are floats on the final page. In those cases, it’s better to use an immediate write (any of the following options).\makeglossaries
using an immediate write. This ensures that the indexing files are read by the indexing application before they are opened (which will clear their content).\makeglossaries
using an immediate write if the aux file exists. On the one hand, it’s better to use makeglossaries as it has some extra diagnostic functions, but on the other hand it both requires Perl and the unrestricted shell escape.\makeglossaries
using an immediate write if the aux file exists. There’s little benefit in this option over automake=immediate and it has the added disadvantage of requiring the unrestricted mode.\makeglossaries
and \makenoidxglossaries
should be disabled. This option is provided in the event that you have to use a class or package that disregards the advice in §1.3 and automatically performs \makeglossaries
or \makenoidxglossaries
but you don’t want this. (For example, you want to use a different indexing method or you want to disable indexing while working on a draft document.)\PassOptionsToPackage
before glossaries is loaded. Note that this does nothing if \makeglossaries
or \makenoidxglossaries
has already been used whilst enabled.\setupglossaries
. It issues a warning if \makeglossaries
or \makenoidxglossaries
has already been used whilst enabled. Note that this option removes the check for \nofiles
, as this option is an indication that the output files are actually required.\makeglossaries
but you need an extra glossary, which has to be defined before \makeglossaries
, then you can do:
or \documentclass
[disablemakegloss]{customclass}
\newglossary*
{functions}{Functions}
\setupglossaries
{restoremakegloss}
\makeglossaries
\PassOptionsToPackage
{disablemakegloss}{glossaries}
\documentclass
{customclass}
\newglossary*
{functions}{Functions}
\setupglossaries
{restoremakegloss}
\makeglossaries
\makeglossaries
or \makenoidxglossaries
regardless of restoremakegloss.2.6. Glossary Type Options
\gls
etc shouldn’t have hyperlinks by default. Make sure you enclose the value in braces if it contains any commas. Example:
As illustrated above, the glossary doesn’t need to exist when you identify it in nohypertypes.\usepackage
[acronym,nohypertypes={acronym
,notation}]
{glossaries}
\newglossary
[nlg]{notation}{not}{ntn}{Notation}
main
glossary and associated glo file, if unrequired. Note that if you use this option, you must create another glossary in which to put all your entries (either via the acronym (or acronyms) package option described in §2.7 or via the symbols, numbers or index options described in §2.9 or via \newglossary
described in §9). Even if you don’t intend to display the glossary, a default glossary is still required.main
glossary and you don’t use this option to suppress its creation, makeglossaries will produce a warning: Warning: File ' .glo' is empty.
Have you used any entries defined in glossary '
If you did actually want to use the main
'?
Remember to use package option 'nomain' if
you don't want to use the main
glossary.
main
glossary and you see this warning, check that you have referenced the entries in that glossary via commands such as \gls
.symbols
via
It also defines
which is a synonym for \newglossary
[slg]{symbols
}{sls}{slo}{\glssymbolsgroupname
}
\printglossary
[type=symbols
, ]
to display the list of symbols.\printnoidxglossary
[type=symbols
, ]
symbols
glossary and don’t intend to use the main
glossary. \glsxtrnewsymbol
as a convenient shortcut method for defining symbols. See the glossaries-extra manual for further details. numbers
via
It also defines
which is a synonym for \newglossary
[nlg]{numbers
}{nls}{nlo}{\glsnumbersgroupname
}
\printglossary
[type=numbers
, ]
to display the list of numbers.\printnoidxglossary
[type=numbers
, ]
numbers
glossary and don’t intend to use the main
glossary. \glsxtrnewnumber
as a convenient shortcut method for defining numbers. See the glossaries-extra manual for further details. index
via
It also defines
which is a synonym for \newglossary
[ilg]{index
}{ind}{idx}{\indexname
}
and
which is a synonym for \newglossaryentry
{ }{type={index
},name={entry-label},
description={\nopostdesc
}, }
\printglossary
[type=index
, ]
to display this glossary.\printnoidxglossary
[type=index
, ]
index
glossary and don’t intend to use the main
glossary. Note that you can’t mix this option with \index
. Either use glossaries for the indexing or use a custom indexing package, such as makeidx, imakeidx. (You can, of course, load one of those packages and load glossaries without the index package option.)
However, it can also be useful to link to the index in order to look up the term’s location list to find other parts of the document where it might be used. For example, this manual will have a hyperlink to the index for general terms, such as “table of contents”, or general commands, such as \GlsDeclareNoHyperList
{index
}
\index
, that aren’t defined anywhere in the document.\setupglossaries
.2.7. Acronym and Abbreviation Options
If true, this creates a new glossary with the label acronym
. This is equivalent to:
It will also provide (if not already defined)
that’s equivalent to \newglossary
[alg]{acronym
}{acr}{acn}{\acronymname
}
\printglossary
[type=acronym
, ]
to display the list of acronyms.\printnoidxglossary
[type=acronym
, ]
\acronymtype
is set to acronym
otherwise it is set to \glsdefaulttype
(which is normally the main
glossary.) Entries that are defined using \newacronym
are placed in the glossary whose label is given by \acronymtype
, unless another glossary is explicitly specified with the type key.acronym
glossary. (That is, you don’t intend to use the main
glossary.) abbreviations
and sets the command \glsxtrabbrvtype
to this. If the acronym option hasn’t also been used, then \acronymtype
will be set to \glsxtrabbrvtype
. This enables both \newacronym
and \newabbreviation
to use the same glossary.abbreviations
using:
The label can be accessed with \newglossary
[glg-abr]{abbreviations
}{gls-abr}{glo-abr}{\abbreviationsname
}
\glsxtrabbrvtype
, which is analogous to \acronymtype
. See glossaries-extra manual for further details.\setacronymstyle
. (It also enables \forallacronyms
to work.)\setacronymstyle
is used then it will automatically add \acronymtype
to the list. main
glossary to also contain a list of acronyms, you can do:
No check is performed to determine if the listed glossaries exist, so you can add glossaries you haven’t defined yet. For example: \usepackage
[acronym,acronymlists=main
]{glossaries}
You can use
instead of or in addition to the acronymlists option. This will add the glossaries given in to the list of glossaries that are identified as lists of acronyms. To replace the list of acronym lists with a new list use:
\usepackage
[acronym,acronymlists={main
,acronym2}]
{glossaries}
\newglossary
[alg2]{acronym2}{acr2}{acn2}%
{Statistical Acronyms}
\setacronymstyle
then it will result in inconsistencies in the formatting. If this does happen, and is for some reason unavoidable (such as \setacronymstyle
occurring in a package that loads glossaries), you will need to set the entry format to match the style: \DeclareAcronymList
{ }
\defglsentryfmt
[ ]{\GlsUseAcrEntryDispStyle
}{ }
2.8. Deprecated Acronym Style Options
\setacronymstyle
instead. See §6 for further details.\newacronym
to allow a description. This option may be replaced by:
or (with smallcaps) \setacronymstyle
{long-short-desc}
or (with smaller) \setacronymstyle
{long-sc-short-desc}
or (with footnote) \setacronymstyle
{long-sm-short-desc}
or (with footnote and smallcaps) \setacronymstyle
{footnote-desc}
or (with footnote and smaller) \setacronymstyle
{footnote-sc-desc}
or (with dua) \setacronymstyle
{footnote-sm-desc}
\setacronymstyle
{dua-desc}
\newacronym
and the way that acronyms are displayed. This option may be replaced by:
or (with description) \setacronymstyle
{long-sc-short}
or (with description and footnote) \setacronymstyle
{long-sc-short-desc}
\setacronymstyle
{footnote-sc-desc}
\newacronym
and the way that acronyms are displayed. This option may be replaced by:
or (with description) \setacronymstyle
{long-sm-short}
or (with description and footnote) \setacronymstyle
{long-sm-short-desc}
\setacronymstyle
{footnote-sm-desc}
\newacronym
and the way that acronyms are displayed. This option may be replaced by:
or (with smallcaps) \setacronymstyle
{footnote}
or (with smaller) \setacronymstyle
{footnote-sc}
or (with description) \setacronymstyle
{footnote-sm}
or (with smallcaps and description) \setacronymstyle
{footnote-desc}
or (with smaller and description) \setacronymstyle
{footnote-sc-desc}
\setacronymstyle
{footnote-sm-desc}
\newacronym
so that acronyms are always expanded. This option may be replaced by:
or (with description) \setacronymstyle
{dua}
\setacronymstyle
{dua-desc}
2.9. Other Options
\printglossary
if the indexing file is missing.\MFUsentencecase
, it will be expanded, which could break existing documents.\makeglossary
and \glossary
) are redefined in terms of the glossaries package’s commands. However, they were never documented in this user manual, and the conversion guide (“Upgrading from the glossary package to the glossaries package”) explicitly discourages their use.\glossary
and \makeglossary
. If they have been previously redefined by kernelglossredefs their original definitions (at the time glossaries was loaded) will be restored.\glossary
and \makeglossary
, but their use will trigger warnings.\glossary
and \makeglossary
without any warnings.\makeglossary
and \glossary
. Other packages or classes may provide additional glossary-related commands or environments that conflict with glossaries (such as \printglossary
and theglossary). These non-kernel commands aren’t affected by this package option, and you will have to find some way to resolve the conflict if you require both glossary mechanisms. (The glossaries package will override the existing definitions of \printglossary
and theglossary.)\PrintChanges
.)2.10. Setting Options After the Package is Loaded
\setupglossaries
: xindy, xindygloss, xindynoglsnumbers, makeindex, nolong, nosuper, nolist, notree, nostyles, nomain, compatible-2.07, translate, notranslate, languages, acronym. These options have to be set while the package is loading, except for the xindy sub-options which can be set using commands like \GlsSetXdyLanguage
(see §14 for further details).3. Setting Up
3.1. Option 1
\makenoidxglossaries
none of the glossaries will be displayed.3.2. Options 2 and 3
\makeglossaries
none of the indexing files will be created.\makeglossaries
has an optional argument that allows you to have a hybrid of Options 1 or 2 or Options 1 or 3. See glossaries-extra manual for further details. \makeglossaries
as they are required when creating the customised style file. If you attempt to use those commands after \makeglossaries
you will generate an error. Similarly, there are some commands that must not be used before \makeglossaries
because they require the associated indexing files to be open, if those files should be created. These may not necessarily generate an error or warning as a different indexing option may be chosen that doesn’t require those files (such as Options 5 or 6). \makeglossaries
command internally uses: \relax
so that it can only be used once. In general, there should be no reason to use or alter this command.
(Option 2) or \jobname
.ist
(Option 3). This name may be changed using: \jobname
.xdy\writeist
that can be set with: \writeist
to prevent an unnecessary write register from being created in the event that neither makeindex nor xindy is required.\GlsSetWriteIstHook
hook to write extra information to the style file, make sure you use the appropriate syntax for the desired indexing application. For example, with makeindex:
This changes the page precedence and the maximum line length used by makeindex.\GlsSetWriteIstHook
{%
\write
\glswrite
{page_precedence "arnAR"}%
\write
\glswrite
{line_max 80}%
}
\writeist
to \relax
(making it do nothing) but will also update the xindy attribute list if applicable.
This command must not be used after \glsSetCompositor
{-}
\makeglossaries
. Note that with makeindex, any locations with the wrong compositor (or one that hasn’t been correctly identified with \glsSetCompositor
) will cause makeindex to reject the location with an invalid number/digit message. As from v4.50, makeglossaries will check for this message and attempt a correction, but this can result in an incorrectly formatted location in the number list. See the information about makeglossaries’s -e switch in §1.6.1 for further details.
See §12 for further information about number lists.\glsSetCompositor
{.}\glsSetAlphaCompositor
{-}
4. Defining Glossary Entries
\newglossaryentry
can also be used in the optional argument of \newacronym
, although some of them, such as first and plural, interfere with the acronym styles.\longnewglossaryentry
may only be used in the preamble. See §4.8 for a discussion of the problems with defining entries within the document instead of in the preamble. (The glossaries-extra package has an option that provides a restricted form of document definitions that avoids some of the issues discussed in §4.8.) \newglossaryentry
. Option 4 requires that definitions are provided in bib format. Options 5 and 6 work best with either preamble-only definitions or the use of the glossaries-extra package option docdef=restricted. \printunsrtglossary
) or where they appear in the table of contents or list of floats. This is essentially the same problem as defining a robust command mid-document and using it in a section title or caption.,
) or equal signs (=
) with braces to hide them from the = list parser.\longnewglossaryentry
will remove trailing spaces in the description (via \unskip
) but won’t remove leading spaces. This command also appends \nopostdesc
to the end of the description, which suppresses the post-description hook (since the terminating punctuation is more likely to be included in a multi-paragraph description). The glossaries-extra package provides a starred version of \longnewglossaryentry
that doesn’t append either \unskip
or \nopostdesc
.\label
) and therefore must be able to expand to a valid control sequence name. With modern LaTeX kernels, you should now be able to use UTF-8 characters in the label.:
) or double-quote ("
), to active characters. \longnewglossaryentry
and \longprovideglossaryentry
. With the other commands it’s set via the description key.,
) or equal sign (=
) must be enclosed in braces. Available fields are listed below. Additional fields are provided by the supplementary packages glossaries-prefix (§16) and glossaries-accsupp (§17) and also by glossaries-extra. You can also define your own custom keys (see §4.3).\nopostdesc
}. If you want a paragraph break in the description use:
or, better, use \longnewglossaryentry
. However, note that not all glossary styles support multi-line descriptions. If you are using one of the tabular-like glossary styles that permit multi-line descriptions and you really need an explicit line break, use \newline
not \\
(but in general, avoid \\
outside of tabular contexts anyway and use a ragged style if you are having problems with line breaks in a narrow column).\glsxtrnopostpunc
instead of \nopostdesc
to suppress the post-description punctuation. \gls
on subsequent use. If this field is omitted, the value of the name key is used.\newacronym
. Although it is possible to override it by using text in the optional argument of \newacronym
, it will interfere with the acronym style and cause unexpected results.\gls
. If this field is omitted, the value of the text key is used. Note that if you use \glspl
, \Glspl
, \GLSpl
, \glsdisp
before using \gls
, the first value won’t be used with \gls
.\glsdefpostlink
) provided by glossaries-extra if you would like to automatically append content on first use in a consistent manner. See, for example, Gallery: Units (glossaries-extra.sty).\newacronym
, it can interfere with the acronym style and cause unexpected results.\glspl
on subsequent use. If this field is omitted, the value is obtained by appending \glspluralsuffix
to the value of the text field.\newacronym
, it can interfere with the acronym style and cause unexpected results. Use shortplural instead, if the default value is inappropriate.\glspl
. If this field is omitted, the value is obtained from the plural key, if the first key is omitted, or by appending \glspluralsuffix
to the value of the first field, if the first field is present. Note that if you use \gls
, \Gls
, \GLS
, \glsdisp
before using \glspl
, the firstplural value won’t be used with \glspl
.\newacronym
, it can interfere with the acronym style and cause unexpected results. Use shortplural and longplural instead, if the default value is inappropriate.\relax
. Note that not all glossary styles display the symbol.
) and with Options 2 and 3, it’s strongly recommended as the indexing may fail if you don’t (see below).\ensuremath
{\alpha}\glsprestandardsort
(see §2.5).
This is equivalent to: \newglossaryentry
{elite}{
name={\'
elite},
description={select group of people}
}
Unless you use the package option sanitizesort=true, in which case it’s equivalent to: \newglossaryentry
{elite}{
name={\'
elite},
description={select group of people}
sort={elite}
}
This will place the entry before the “A” letter group since the sort value starts with a symbol (a literal backslash \newglossaryentry
{elite}{
name={\'
elite},
description={select group of people}
sort={\
'
elite},
}
\
). Note that Option 1 shouldn’t be used with UTF-8 characters. With old LaTeX kernels, it was able to convert a UTF-8 character, such as é
, to an ASCII equivalent but this is no longer possible.\alpha
}).\glsdefaulttype
is assumed unless \newacronym
is used (see §6).\glsaddkey
or \glsaddstoragekey
(see §4.3).\glsnonextpages
(nonumberlist={true}) or \glsnextpages
(nonumberlist={false}) to the indexing information for Options 2 and 3. Note that this means that if the entry is added to the glossary simply because it has an indexed descendent (and has not been indexed itself) then the first indexed sub-entry that follows will have its number list suppressed instead.\glsnoidxprenumberlist
.
after the entry has been defined. (See §11.) It was originally designed for synonyms that may not occur in the document text but needed to be included in the glossary in order to redirect the reader. Note that it doesn’t index the cross-referenced entry (or entries) as that would interfere with their number lists.\glssee
[ ]{ }{ }
This defines two entries (courgette and zucchini) and automatically adds a cross-reference from zucchini to courgette. (That is, it adds “see courgette” to zucchini’s number list.) This doesn’t automatically index courgette since this would create an unwanted location in courgette’s number list. (Page 1, if the definitions occur in the preamble.)\newglossaryentry
{courgette}{name={courgette},
description={variety of small marrow}}
\newglossaryentry
{zucchini}{name={zucchini},
description={(North American)},
see={courgette}}
this won’t index the zucchini entry, so if zucchini isn’t indexed elsewhere (with commands like \newglossaryentry
{zucchini}{name={zucchini},
description={(North American) see \gls
{courgette}}}
\gls
or \glsadd
) then it won’t appear in the glossary even if courgette does.\makeglossaries
must be used before any occurrence of \newglossaryentry
that contains the see key. \makeglossaries
is commented out.\seealsoname
and seealso={xr-list} is essentially like see={[\seealsoname
] } (Options 3 and 4 may treat these differently).\gls
so that they index the entry given by instead of the original entry. (See, for example, Gallery: Aliases.)\newglossary
(if provided) and the counter identified by the counter package option. The location counter can be overridden by the counter option when using the \gls
-like and \glstext
-like commands.\newacronym
(see §6) and also for \newabbreviation
(see the glossaries-extra manual): long, longplural, short and shortplural. You can use longplural and shortplural in the optional argument of \newacronym
(or \newabbreviation
) to override the defaults, but don’t explicitly use the long or short keys as that may interfere with acronym style (or abbreviation style).\gls
-like or \glstext
-like commands within the text, first, short or long keys (or their plural equivalent) or any other key that you plan to access through those commands. (For example, the symbol key if you intend to use \glssymbol
.) Otherwise you can up with nested links, which can cause complications. You can use them within the value of keys that won’t be accessed through those commands. For example, the description key if you don’t use \glsdesc
. Additionally, they’ll confuse the formatting placeholder commands, such as \glslabel
. The glossaries-extra package provides \glsxtrp
for this type of situation. \Gls
and \Glspl
. For example: % mfirstuc v2.07
Note that the same applies with inputenc: \newglossaryentry
{elite}{name={{\'
e}lite},
description={select group or class}}
% mfirstuc v2.07
This doesn’t apply for XeLaTeX or LuaLaTeX documents or with mfirstuc v2.08+. \newglossaryentry
{elite}{name={{é}lite},
description={select group or class}}
% mfirstuc v2.08
See the mfirstuc manual for further details.\newglossaryentry
{elite}{name={élite},
description={select group or class}}
4.1. Plurals
defines a new entry whose singular form is “cow” and plural form is “cows”. However, if you are writing in archaic English, you may want to use “kine” as the plural form, in which case you would have to do: \newglossaryentry
{cow}{name={cow},description={a fully grown female of any bovine animal}}
\newglossaryentry
{cow}{name={cow},plural={kine},
description={a fully grown female of any bovine animal}}
You can then use \newglossaryentry
{cow}{
name={cow},
description={a fully grown female of any bovine animal (plural cows, archaic plural kine)},
user1={kine}}
to produce “cows” and \glspl
{cow}
to produce “kine”. You can, of course, define an easy to remember synonym. For example: \glsuseri
{cow}
Then you don’t have to remember which key you used to store the second plural. (Be careful with using \let
\glsaltpl
\glsuseri
\let
as it doesn’t check if the command already exists.)\glsaddkey
, described in §4.3 (or simply use \glsdisp
or \glslink
with the appropriate text).\glspluralsuffix
as required. However, this must be done before the entries are defined and is unreliable for multilingual documents. For languages that don’t form plurals by simply appending a suffix, all the plural forms must be specified using the plural key (and the firstplural key where necessary). 4.2. Other Grammatical Constructs
With the above definitions, I can now define terms like this: \let
\glsing
\glsuseri
\let
\glsd
\glsuserii
\newcommand
*{\ingkey
}{user1}
\newcommand
*{\edkey
}{user2}
\newcommand
*{\newword
}[3][]{%
\newglossaryentry
{#2}{%
name={#2},%
description={#3},%
\edkey
={#2ed},%
\ingkey
={#2ing},#1%
}}
and use them in the text: \newword
{play}{to take part in activities for enjoyment}
\newword
[\edkey
={ran},\ingkey
={running}]{run}{to move fast using
the legs}
Peter is
\glsing
{play} in the park today.
Jane \glsd
{play} in the park yesterday.
Peter and Jane \glsd
{run} in the park last week.
\glsaddkey
, described below in §4.3. It may, however, be simpler just to use \glslink
or \glsdisp
with the appropriate link text.4.3. Additional Keys
\glsaddkey
described in §4.3.1. If, on the other hand, you want to add a key to indicate to a glossary style or acronym style that this entry should be formatted differently to other entries, then you can use \glsaddstoragekey
described in §4.3.2.\glsentrytext
). This can be used in an expandable context (provided any fragile commands stored in the key have been protected). The new keys must be added using \glsaddkey
or \glsaddstoragekey
before glossary entries are defined.4.3.1. Document Keys
The starred version of is the new key to use in \newglossaryentry
(or similar commands such as \longnewglossaryentry
); is the default value to use if this key isn’t used in an entry definition (this may reference the current entry label via \glslabel
, but you will have to switch on expansion via the starred version of \glsaddkey
and protect fragile commands); is the control sequence to use analogous to commands like \glsentrytext
; is the control sequence to use analogous to commands like \Glsentrytext
; is the control sequence to use analogous to commands like \glstext
; is the control sequence to use analogous to commands like \Glstext
; is the control sequence to use analogous to commands like \GLStext
.
\glsaddkey
switches on expansion for this key. The unstarred version doesn’t override the current expansion setting.% Define "ed" key:
Now I can define some entries: \glsaddkey
*
{ed}% key
{\glsentrytext
{\glslabel
}ed}% default value
{\glsentryed
}% command analogous to \glsentrytext
{\Glsentryed
}% command analogous to \Glsentrytext
{\glsed
}% command analogous to \glstext
{\Glsed
}% command analogous to \Glstext
{\GLSed
}% command analogous to \GLStext
% Define "ing" key:
\glsaddkey
*
{ing}% key
{\glsentrytext
{\glslabel
}ing}% default value
{\glsentrying
}% command analogous to \glsentrytext
{\Glsentrying
}% command analogous to \Glsentrytext
{\glsing
}% command analogous to \glstext
{\Glsing
}% command analogous to \Glstext
{\GLSing
}% command analogous to \GLStext
% No need to override defaults for this entry:
\newglossaryentry
{jump}{name={jump},description={}}
% Need to override defaults on these entries:
\newglossaryentry
{run}{name={run},
ed={ran},
ing={running},
description={}}
\newglossaryentry
{waddle}{name={waddle},
ed={waddled},
ing={waddling},
description={}}
The dog
For a complete document, see the sample file sample-newkeys.tex. \glsed
{jump} over the duck.
The duck was \glsing
{waddle} round the dog.
The dog \glsed
{run} away from the duck.
4.3.2. Storage Keys
\glsaddkey
, described above in §4.3.1.\glsaddkey
except that it doesn’t define the additional commands. You can access or update the value of your new field using the commands described in §15.6.\glsaddstoragekey
{abbrtype}% key/field name
{word}% default value if not explicitly set
{\abbrtype
}% custom command to access the value if required
Remember that the new style needs to be set before defining any terms: \newacronymstyle
{mystyle}% style name
{% Use the generic display
\ifglshaslong
{\glslabel
}{\glsgenacfmt
}{\glsgenentryfmt
}%
}%
{% Put the long form in the description
\renewcommand
*{\GenericAcronymFields
}{%
description={\the
\glslongtok
}}%
% For the full format, test the value of the "abbrtype" key.
% If it's set to "word" put the short form first with
% the long form in brackets.
\renewcommand
*{\genacrfullformat
}[2]{%
\ifglsfieldeq
{##
1}{abbrtype}{word}
{% is a proper acronym
\protect
\firstacronymfont
{\glsentryshort
{##
1}}##
2\space
(\glsentrylong
{##
1})%
}%
{% is another form of abbreviation
\glsentrylong
{##
1}##
2\space
(\protect
\firstacronymfont
{\glsentryshort
{##
1}})%
}%
}%
% sentence case version:
\renewcommand
*{\Genacrfullformat
}[2]{%
\ifglsfieldeq
{##
1}{abbrtype}{word}
{% is a proper acronym
\protect
\firstacronymfont
{\Glsentryshort
{##
1}}##
2\space
(\glsentrylong
{##
1})%
}
{% is another form of abbreviation
\Glsentrylong
{##
1}##
2\space
(\protect
\firstacronymfont
{\glsentryshort
{##
1}})%
}%
}%
% plural
\renewcommand
*{\genplacrfullformat
}[2]{%
\ifglsfieldeq
{##
1}{abbrtype}{word}%
{% is a proper acronym
\protect
\firstacronymfont
{\glsentryshortpl
{##
1}}##
2\space
(\glsentrylong
{##
1})%
}%
{% is another form of abbreviation
\glsentrylongpl
{##
1}##
2\space
(\protect
\firstacronymfont
{\glsentryshortpl
{##
1}})%
}%
}%
% plural and sentence case
\renewcommand
*{\Genplacrfullformat
}[2]{%
\ifglsfieldeq
{##
1}{abbrtype}{word}%
{% is a proper acronym
\protect
\firstacronymfont
{\Glsentryshortpl
{##
1}}##
2\space
(\glsentrylong
{##
1})%
}%
{% is another form of abbreviation
\Glsentrylongpl
{##
1}##
2\space
(\protect
\firstacronymfont
{\glsentryshortpl
{##
1}})%
}%
}%
% Just use the short form as the name part in the glossary:
\renewcommand
*{\acronymentry
}[1]{%
\acronymfont
{\glsentryshort
{##
1}}}%
% Sort by the short form:
\renewcommand
*{\acronymsort
}[2]{##
1}%
% Just use the surrounding font for the short form:
\renewcommand
*{\acronymfont
}[1]{##
1}%
% Same for first use:
\renewcommand
*{\firstacronymfont
}[1]{\acronymfont
{##
1}}%
% Default plural suffix if the plural isn't explicitly set
\renewcommand
*{\acrpluralsuffix
}{\glspluralsuffix
}%
}
\setacronymstyle
{mystyle}
\newacronym
for something that’s not technically an acronym, let’s define a new command for initialisms:
Now the entries can all be defined: \newcommand
*{\newinitialism
}[4][]{%
\newacronym
[abbrtype=initialism,#1]{#2}{#3}{#4}%
}
On first use, \newacronym
{radar}{radar}{radio detecting and ranging}
\newacronym
{laser}{laser}{light amplification by stimulated
emission of radiation}
\newacronym
{scuba}{scuba}{self-contained underwater breathing
apparatus}
\newinitialism
{dsp}{DSP}{digital signal processing}
\newinitialism
{atm}{ATM}{automated teller machine}
will produce “radar (radio detecting and ranging)” but \gls
{radar}
will produce “DSP (digital signal processing)”.\gls
{dsp}\newglossaryentry
is explicitly used (instead of through \newacronym
) the abbrtype key will be set to its default value of “word” but the \ifglshaslong
test in the custom acronym style will be false (since the long key hasn’t been set) so the display style will switch to that given by \glsgenentryfmt
and they’ll be no test performed on the abbrtype field.
This may seem a little odd for non-abbreviated entries that are defined using \glsaddstoragekey
{abbrtype}% key/field name
{acronym}% default value if not explicitly set
{\abbrtype
}% custom command to access the value if required
\newglossaryentry
directly, but \ifglshaslong
can be used to determine whether or not to reference the value of this new abbrtype field.
needs to be changed to: \renewcommand
*{\GenericAcronymFields
}{%
description={\the
\glslongtok
}}%
Additionally, to accommodate the change in the default value of the abbrtype key, all instances of \renewcommand
*{\GenericAcronymFields
}{}%
need to be changed to: \ifglsfieldeq
{##
1}{abbrtype}{word}
\ifglsfieldeq
{##
1}{abbrtype}{acronym}
\newacronym
[description={system for detecting the position and speed of aircraft, ships, etc}]{radar}{radar}{radio detecting
and ranging}
\newinitialism
but again the optional argument is required to set the description: \newinitialism
[description={mathematical manipulation of an information signal}]{dsp}{DSP}{digital signal processing}
The contractions can similarly been defined using this new command: \newcommand
*{\newcontraction
}[4][]{%
\newacronym
[abbrtype=contraction,#1]{#2}{#3}{#4}%
}
\newcontraction
[description={front part of a ship below the deck}]{focsle}{fo'c's'le}{forecastle}
\newglossaryentry
{apple}{name={apple},description={a fruit}}
This uses \newglossarystyle
{mystyle}% style name
{% base it on the "list" style
\setglossarystyle
{list}%
\renewcommand
*{\glossentry
}[2]{%
\item
[\glsentryitem
{##
1}%
\glstarget
{##
1}{\glossentryname
{##
1}}]
\ifglshaslong
{##
1}%
{ (\abbrtype
{##
1}: \glsentrylong
{##
1})\space
}{}%
\glossentrydesc
{##
1}\glspostdescription
\space
##
2}%
}
\ifglshaslong
to determine whether or not the term is an abbreviation. (An alternative is to use \ifglshasshort
. The long and short keys are only set for acronyms/abbreviations.) \abbrtype
(defined by \glsaddstoragekey
earlier) is used to indicate the type of abbreviation.
apple a fruit.
but the abbreviations are displayed in the form
laser (acronym: light amplification by stimulated emission of radiation) device that creates a narrow beam of intense light.
(for acronyms) or
DSP (initialism: digital signal processing) mathematical manipulation of an information signal.
(for initalisms) or
fo’c’s’le (contraction: forecastle) front part of a ship below the deck.
(for contractions).4.4. Expansion
\glssetnoexpandfield
).
Key
Field
sort
sortvalue
firstplural
firstpl
description
desc
descriptionplural
descplural
user1
useri
user2
userii
user3
useriii
user4
useriv
user5
userv
user6
uservi
longplural
longpl
shortplural
shortpl
\glssetexpandfield
or \glssetnoexpandfield
are governed by \glsnoexpandfields
. (This should be used before you define the entries.)\newacronym
and \newabbreviation
partially suppress expansion of some keys regardless of the above expansion settings. 4.5. Sub-Entries
\glsfieldfetch
or (with glossaries-extra) \glsxtrusefield
, but neither the level nor the parent values should be altered as it can cause inconsistencies in the sorting and glossary formatting. The indexing syntax for Options 2 and 3 is generated when the entry is first defined, so it’s too late to change the hierarchy after that, and bib2gls obtains the hierarchical information from the bib files and the resource options. Note, however, that glossaries-extra does allow the ability to locally alter the level with the leveloffset option, which is mainly intended for nested glossary. See the glossaries-extra manual for further details and also Gallery: Inner or Nested Glossaries. 4.5.1. Hierarchy
\newglossaryentry
{greekletter}{name={Greek letters},
description={\nopostdesc
}}
\newglossaryentry
romanletter{name={Roman letters},
description={\nopostdesc
}}
\nopostdesc
. This gives a blank description and suppresses the description terminator.
For a complete document, see the sample file sampletree.tex.\newglossaryentry
{pi}name={\ensuremath
{\pi
}},sort={pi},
description={ratio of the circumference of a circle to the diameter},
parent={greekletter}
\newglossaryentry
{C}{name={\ensuremath
{C}},sort={C},
description={Euler's constant},
parent={romanletter}}
4.5.2. Homographs
As in the previous example, the parent entry has no description, so the description terminator needs to be suppressed using \newglossaryentry
{glossary}{name={glossary},
description={\nopostdesc
},
plural={glossaries}}
\nopostdesc
.
Note that if I reference the parent entry (for example, \newglossaryentry
{glossarylist}{
description={list of technical words},
sort={1},
parent={glossary}}
\newglossaryentry
{glossarycol}{
description={collection of glosses},
sort={2},
parent={glossary}}
), the location will be added to the parent’s number list, whereas if I reference any of the child entries (for example, \gls
{glossary}
), the location will be added to the child entry’s number list. Note also that since the sub-entries have the same name, the sort key is required with Option 3 (xindy) and recommended with Option 2 (makeindex). You can use the subentrycounter package option to automatically number the level 1 child entries in the glossary (if you use a glossary style that supports it). See §2.3 for further details.\gls
{glossarylist}
For a complete document, see the sample file sample.tex.\newglossaryentry
{bravo}{name={bravo},
description={\nopostdesc
}}
\newglossaryentry
{bravocry}{description={cry of approval (pl. bravos)},
sort={1},
plural={bravos},
parent={bravo}}
\newglossaryentry
{bravoruffian}{description={hired ruffian or killer (pl. bravoes)},
sort={2},
plural={bravoes},
parent={bravo}}
4.6. Loading Entries From a File
\newglossaryentry
, \longnewglossaryentry
, \newacronym
etc commands. The optional argument is the name of the glossary to which those entries should belong, for those entries where the type key has been omitted (or, more specifically, for those entries whose type has been set to \glsdefaulttype
, which is what \newglossaryentry
uses by default). See sampleDB.tex for a complete example document.\newacronym
, \newabbreviation
, \newterm
, \glsxtrnewsymbol
and \glsxtrnewnumber
all set the type key to the appropriate glossary. This means that the optional argument won’t apply to those commands, unless they have type={\glsdefaulttype
}. \input
to load the file but don’t use \include
. If you find that your file is becoming unmanageably large, you may want to consider switching to bib2gls and use an application such as JabRef to manage the entry definitions.\AtBeginDocument
to \input
all your entries automatically at the start of the document, add the \AtBeginDocument
command before you load the glossaries package (and babel, if you are also loading that) to avoid the creation of the glsdefs file and any associated problems that are caused by defining commands in the document environment. (See §4.8.) Alternatively, if you are using glossaries-extra, use the docdef=restricted package option.
and suppose in my preamble I use the command: \newglossaryentry
{perl}{type={main
},
name={Perl},
description={A scripting language}}
\newglossaryentry
{tex}{name={\TeX
},
description={A typesetting language},sort={TeX}}
\newglossaryentry
{html}{type={\glsdefaulttype
},
name={html},
description={A mark up language}}
then this will add the entries “tex” and “html” to the glossary whose type is given by languages, but the entry “perl” will be added to the \loadglsentries
[languages]{myentries}
main
glossary, since it explicitly sets the type to main
.
then (supposing I have defined a new glossary type called altacronym) \newacronym
{aca}{aca}{a contrived acronym}
will add “aca” to the glossary type \loadglsentries
[altacronym]{myacronyms}
acronym
, if the package option acronym has been specified, or will add “aca” to the glossary type altacronym, if the package option acronym is not specified. This is because \acronymtype
is set to \glsdefaulttype
if the acronym package option is not used so the optional argument of \loadglsentries
will work in that case, but if the acronym option is used then \acronymtype
will be redefined to acronym
.\loadglsentries
with the acronym package option set, there are two possible solutions to this problem:
and do: \newacronym
[type={\glsdefaulttype
}]{aca}{aca}{a
contrived acronym}
\loadglsentries
[altacronym]{myacronyms}
\acronymtype
to the target glossary: \let
\orgacronymtype
\acronymtype
\renewcommand
{\acronymtype
}{altacronym}
\loadglsentries
myacronyms
\let
\acronymtype
\orgacronymtype
\loadglsentries
may only be used in the preamble.\provideglossaryentry
rather than \newglossaryentry
. Suppose you want to maintain a large database of acronyms or terms that you’re likely to use in your documents, but you may want to use a modified version of some of those entries. (Suppose, for example, one document may require a more detailed description.) Then if you define the entries using \provideglossaryentry
in your database file, you can override the definition by simply using \newglossaryentry
before loading the file. For example, suppose your file (called, say, terms.tex) contains:
but suppose your document requires a more detailed description, you can do: \provideglossaryentry
{mallard}{name={mallard},
description={a type of duck}}
Now the “mallard” definition in the terms.tex file will be ignored.\usepackage
{glossaries}
\makeglossaries
\newglossaryentry
{mallard}{name={mallard},
description={a dabbling duck where the male has a green head}}
\loadglsentries
{terms}
4.7. Moving Entries to Another Glossary
\makeglossaries
.\glsfielddef
won’t correctly move the entry, since the label needs to be removed from the old glossary’s internal list and added to the new glossary’s internal list to allow commands such as \glsaddall
and \glsunsetall
to work. \printglossaries
, then define an ignored glossary with \newignoredglossary
. (See §9.) With Options 4 and 5, it’s also possible to copy an entry to another glossary with \glsxtrcopytoglossary
. See the glossaries-extra manual for further details.4.8. Drawbacks With Defining Entries in the Document Environment
\newglossaryentry
(and \newacronym
) could only be used in the preamble. I reluctantly removed this restriction in version 1.13, but there are issues with defining commands in the document environment instead of the preamble, which is why the restriction is maintained for newer commands. This restriction is also reimposed for \newglossaryentry
by Option 1 because in that case the entries must be defined before the aux file is input. (The glossaries-extra package automatically reimposes the preamble-only restriction but provides the docdef package option to allow document definitions for Options 2 and 3 if necessary.)\GlsXtrLoadResources
, which is a preamble-only command. 4.8.1. Technical Issues
\newcommand
in the middle of the document and then moving things around so that the command is used before it has been defined.\label
and \ref
work)."
(double-quote), !
(exclamation mark), ?
(question mark), and |
(pipe). They must not be active when defining a glossary entry where they occur in the sort key (and they should be avoided in the label if they may be active at any point in the document). Additionally, the comma (,
) character and the equals (=
) character should not be active when using commands that have = arguments.\newglossaryentry
at the beginning of the document environment so that the definitions are written to an external file (\jobname
.glsdefs) which is then read in at the start of the document on the next run. This means that the entry can now be looked up in the glossary, even if the glossary occurs at the beginning of the document.\printglossary
(if it occurs at the start of the document); this method requires an extra \newwrite
, which may exceed TeX’s maximum allocation; unexpected expansion issues could occur.\newglossaryentry
to occur in the document environment but doesn’t create the glsdefs file. This circumvents some problems but it means that you can’t display any of the glossaries before all the entries have been defined (so it’s all right if all the glossaries are at the end of the document but not if any occur in the front matter).4.8.2. Good Practice Issues
5. Referencing Entries in the Document
\newglossaryentry
(§4) or \newacronym
(§6), you can refer to that entry in the document with one of the provided commands that are describe in this manual. (There are some additional commands provided by glossaries-extra.) The text produced at that point in the document (the link text) is determined by the command and can also be governed by whether or not the entry has been marked as used.
There are additional commands specific to entries defined with \gls
-like commands, §5.1.2) and those that don’t (the \glstext
-like commands, §5.1.3).\newacronym
that are described in §6.1.5.1. Links to Glossary Entries
\makeglossaries
these external files won’t be created. (Options 1 and 4 write the information to the aux file instead.)\glsaddstoragekey
that’s used to set their default indexing option.)\chapter
or \caption
.\glsentrytext
). Alternatively, provide an alternative via the optional argument to the sectioning/caption command or use hyperref’s \texorpdfstring
. Examples:
(You can use \chapter
An overview of \glsentrytext
{perl}
\chapter
[An overview of Perl]An overview of \gls
{perl}
\chapter
{An overview of \texorpdfstring
{\gls
{perl}}{Perl}}
\glstexorpdfstring
instead of \texorpdfstring
if you don’t know whether or not hyperref will be needed.) \glsfmttext
, that overcome some of the problems. \gls
, and it will take you to the relevant part of the document where the command is described or you can click on a general word or phrase, such as table of contents, and it will take you to the relevant line in the index where you can find the number list to navigate to other parts of the document that are pertinent. If, however, you click on “number list”, you’ll find it leads you to the location list entry in the index instead. This is because number list has been aliased to location list using the alias key. Whereas if you click on “page list” it will take you to the corresponding page list entry in the glossary that has a cross-reference to location list, because the see key was used instead.
Further customisation can be done via \renewcommand
*{\glstextformat
}[1]{\textsf
{#1}}
\defglsentryfmt
or by redefining \glsentryfmt
. See §5.1.4 for further details.\gls
-like commands and are described in §5.1.2. The commands that don’t reference or change the first use flag are \glstext
-like commands and are described in §5.1.3. See §7 for commands that unset (mark the entry as having been used) or reset (mark the entry as not used) the first use flag without referencing the entries.\gls
-like and \glstext
-like commands all take a first optional argument that is a comma-separated list of = options, described below. They also have a star-variant, which inserts hyper=false at the start of the list of options and a plus-variant, which inserts hyper=true at the start of the list of options. For example
is the same as \gls
*
{sample}
and \gls
[hyper=false]{sample}
is the same as \gls
+
{sample}
, whereas just \gls
[hyper=true]{sample}
will use the default hyperlink setting which depends on a number of factors (such as whether the entry is in a glossary that has been identified in the nohypertypes list). You can override the hyper key in the variant’s optional argument, for example, \gls
{sample}
but this creates redundancy and is best avoided. The glossaries-extra package provides the option to add a third custom variant and commands to override the behaviour of the star and plus variants.\gls
*
[hyper=true]{sample}
as this is likely to cause problems. By implication, this means that you should avoid using any of these commands within the text, first, short or long keys (or their plural equivalent) or any other key that you plan to access through these commands. (For example, the symbol key if you intend to use \glslink
{ }{\gls
{ }}\glssymbol
.) The glossaries-extra package provides \glsxtrp
to use instead, which helps to mitigate against nesting problems. 5.1.1. Options
\gls
-like and \glstext
-like commands. The glossaries-extra package provides additional keys. (See the glossaries-extra manual for further details.)\gls
-like command, if this is the first use and the hyperfirst=false package option has been used, then the default value is hyper=false. The hyperlink can be forced on using hyper=true unless the hyperlinks have been suppressed using \glsdisablehyper
. You must load the hyperref package before the glossaries package to ensure the hyperlinks work.\newglossary
) and the default counter identified by the counter package option. See also §12. The glossaries-extra package has additional options that affect the counter used, such as floats and equations. This manual uses the floats option to automatically switch the counter to table for any entries indexed in tables (such as those in Table 12.1).\gls
-like commands that change the entry’s first use flag. If local=true, the change to the first use flag will be localised to the current scope.\glstextformat
. Only available with glossaries-extra.\glstextformat
. Only available with glossaries-extra.\glolinkprefix
to the given value. Only available with glossaries-extra.5.1.2. The
\gls
-Like Commands (First Use Flag Queried)\gls
-like commands that unset (mark as used) the first use flag after the link text, and in most cases they use the current state of the flag to determine the text to be displayed. As described above, these commands all have a star-variant (hyper=false) and a plus-variant (hyper=true) and have an optional first argument that is a = list. These commands use \glsentryfmt
or the equivalent definition provided by \defglsentryfmt
to determine the automatically generated text and its format (see §5.1.4).\glsdisp
, the commands described in this section also have a final optional argument which may be used to insert material into the automatically generated text.\relax
or an empty set of braces {}
immediately before the opening square bracket to prevent it from being interpreted as the final argument. For example:
Use of a semantic command can also help avoid this problem. For example: \gls
{sample}[] [Editor's comment]
\gls
{sample}{} [Editor's comment]
\gls
{sample} \relax
[Editor's comment]
\newcommand
{\edcom
}[1][#1]
% later:
\gls
{sample} \edcom
{Editor's comment}
\gls
-like or \glstext
-like commands in the argument. \glspatchtabularx
in the preamble. This does nothing if tabularx hasn’t been loaded. There’s no patch available for beamer. See §7 for more details and also §15.5.\glssentencecase
and the all caps is performed by \glsuppercase
. Ensure you have at least version 2.08 of mfirstuc to use the modern LaTeX3 case-changing commands instead of the now deprecated textcase package. See the mfirstuc manual for further details.\newglossaryentry
. However, if the entry was defined using \newacronym
and \setacronymstyle
was used, then the link text will usually be determined from the long or short keys (similarly for \newabbreviation
).\gls
: \newglossaryentry
or, if the entry was defined with \newacronym
and \setacronymstyle
was used, from the longplural or shortplural keys. (Similarly for \newabbreviation
.)
and later you use it in math mode: \newglossaryentry
{Falpha}{name={F\alpha
},
description={sample}}
$
This will result in \(F_{\alpha }{}^{2}\) instead of \(F_{\alpha }^{2}\). In this situation it’s best to bring the superscript into the hyperlink using the final optional argument: \gls
{Falpha}2$
$
\gls
{Falpha}[^
2]$
\gls
, except that the is explicitly set. There’s no final optional argument as any inserted material can be added to the argument. Even though the first use flag doesn’t influence the link text, it’s still unset after the link text and so may influence the post-link hook.
This ensures that the entry is indexed and, if enabled, creates a hyperlink to the entry line in the glossary. It will also follow the display style and have the link text encapsulated with \newglossaryentry
{locationcounter}{
name={location counter},
description={...}
}
% later in the document:
The \glsdisp
{locationcounter}{counter} identifying the location.
\glstextformat
.
However, a sentence case variant is provided:
This essentially does: \glsdisp
{locationcounter}{Counters} associated with locations
The main reason for providing this command is to set up a mapping for \glsdisp
[ ]{ }{\glssentencecase
{ }}
\makefirstuc
. See the mfirstuc manual for further details about mappings.5.1.3. The
\glstext
-Like Commands (First Use Flag Not Queried)\glsentryfmt
or the equivalent definition provided by \defglsentryfmt
(see §5.1.4). They do, however, have their link text encapsulated with \glstextformat
.\glslink
, the commands described in this section also have a final optional argument which may be used to insert material into the automatically generated text. See the caveat above in §5.1.2. As with the \gls
-like commands described in §5.1.2, these commands also have case-changing variants.\glsdisp
, there’s a sentence case variant to allow a sentence case mapping to be established:
See the mfirstuc package for further details.\gls
-like or \glstext
-like commands in the argument of \glslink
. By extension, this means that you can’t use them in the value of fields that are used to form link text. \glsentrytitlecase
in combination with \glslink
. For example:
(See §5.2.)\glslink
{sample}{\glsentrytitlecase
{sample}{text}}
\gls
(or \glspl
) on first use as the link text used by \gls
may be modified through entry formatting commands like \defglsentryfmt
. (Similarly, the value of the text and plural keys don’t necessarily match the link text used by \gls
or \glspl
on subsequent use.) \glstext
or \glsfirst
instead of \glsname
, unless you have a particular need for the actual name.\glsname
with acronyms. Instead, consider using \acrlong
, \acrshort
or \acrfull
. Alternatively, for abbreviations defined with glossaries-extra, use \glsxtrlong
, \glsxtrshort
or \glsxtrfull
. 5.1.4. Changing the Format of the
\gls
-like Link Text\gls
-like commands is governed by: \glsgenentryfmt
. The glossaries-extra package redefines \glsentryfmt
to allow it to integrated with the abbreviation styles.\gls
-like commands, not the \glstext
-like commands. However, both sets of commands use \glstextformat
for the font. \glsentryfmt
(but beware of breaking abbreviations with glossaries-extra), but if you only want the change the display style for a given glossary, use: \glsentryfmt
. The optional first argument is the glossary type. This defaults to \glsdefaulttype
if omitted. The second argument is the entry format definition, which needs to use the placeholder commands described in this section.\defglsentryfmt
or to the definition of \glsentryfmt
.\glsentryfmt
is the default display style for glossary entries. Once the display style has been changed for an individual glossary using \defglsentryfmt
, redefining \glsentryfmt
won’t have an effect on that glossary, you must instead use \defglsentryfmt
again. Note that glossaries that have been identified as lists of acronyms (via the package option acronymlists or the command \DeclareAcronymList
, see §2.7) use \defglsentryfmt
to set their display style. (The glossaries-extra package provides abbreviation support within its redefinition of \glsentryfmt
.) \protected@edef
so the replacement text is the actual glossary type rather than
.\glsentrytype
{\glslabel
}\gls
, \glspl
and their case-changing variants (or empty if was omitted).\glspl
, \Glspl
or \GLSpl
was used, this command expands to otherwise it expands to .\gls
, \glspl
or \glsdisp
were used, this expands to . If the sentence case commands \Gls
or \Glspl
were used, this expands to . If the all caps commands \GLS
or \GLSpl
were used, this expands to .\glsdisp
. It’s always empty for \gls
, \glspl
and their case-changing variants. (You can use etoolbox’s \ifdefempty
to determine if \glscustomtext
is empty.)\Glsdisp
is used, \glscustomtext
will include the sentence case command (\glssentencecase
), but \glscapscase
will expand to (since \Glsdisp
simply uses \glsdisp
without modifying the placeholder commands). However, the generic \glsgenentryfmt
doesn’t use \glscapscase
(or \glsifplural
) if \glscustomtext
isn’t empty. *
) command. It may be off because the hyperref package hasn’t been loaded or because \glsdisablehyper
has been used or because the entry is in a glossary type that’s had the hyperlinks switched off (using nohypertypes) or because it’s the first use and the hyperlinks have been suppressed on first use.*
) or plus (+
) variant, you can use: \GlsXtrSetAltModifier
will make \glslinkvar
expand to .\GlsXtrSetStarModifier
or \GlsXtrSetPlusModifier
instead, if you are using glossaries-extra.\ifglsused
within (see §7), but don’t use \ifglsused
in the post-link hook.\glslabel
, \glstype
, \glsifplural
, \glscapscase
, \glsinsert
and \glscustomtext
are typically updated at the start of the \gls
-like and \glstext
-like commands so they can usually be accessed in the hook user commands, such as \glspostlinkhook
and \glslinkpostsetkeys
.\gls
within the fields that are accessed using the \gls
-like or \glstext
-like commands (such as the first, text, long or short keys) will cause a problem. The definitions of the placeholder commands can’t be scoped otherwise they won’t be available for the post-link hook, and grouping can also cause unwanted spacing issues in math mode. \glsentryfmt
, you can use the generic entry formatting command: symbols
glossary: \defglsentryfmt
[symbols
]{\glsgenentryfmt
(\glsentrysymbol
{\glslabel
})}
For each glossary that has been identified as a list of acronyms. This uses the generic entry format command \defglsentryfmt
[ ]{\ifglshaslong
{\glslabel
}{\glsgenacfmt
}{\glsgenentryfmt
}}
\glsgenentryfmt
for general entries (that don’t have the long key set), otherwise it uses the generic acronym format:
This uses the values from the long, short, longplural and shortplural keys, rather than using the text, plural, first and firstplural keys. The first use singular text is obtained via:
instead of from the first key, and the first use plural text is obtained via:
instead of from the firstplural key. In both cases, is the entry’s label and is the insert text provided in the final optional argument of commands like \gls
. The default behaviour is to do the long form (or plural long form) followed by and a space and the short form (or plural short form) in parentheses, where the short form is in the argument of \firstacronymfont
. There are also sentence case versions:
and
See §6 for details on changing the style of acronyms.\glsentryfmt
(or the formatting given by \defglsentryfmt
) is not used by the \glstext
-like commands.
and now suppose you want \newglossaryentry
{distance}{name={distance},
description={The length between two points},
symbol={km}}
to produce “distance (km)” on first use, then you can redefine \gls
{distance}\glsentryfmt
as follows: \renewcommand
*{\glsentryfmt
}%
\glsgenentryfmt
\ifglsused
{\glslabel
}{}{\space
(\glsentrysymbol
{\glslabel
})}%
\glsentrysymbol
rather than \glssymbol
to avoid nested hyperlinks.)\glstextformat
(described earlier). So if you do, say:
then \renewcommand
{\glstextformat
}[1]{\textbf
{#1}}
\renewcommand
*{\glsentryfmt
}{%
\glsgenentryfmt
\ifglsused
{\glslabel
}{}{\space
(\glsentrysymbol
{\glslabel
})}%
}
will produce “distance (km)”. This is different from using the post-link hook which is outside of \gls
{distance}\glstextformat
.
Now suppose you have defined an entry as follows: \defglsentryfmt
[notation]{\glsgenentryfmt
\ifglsused
{\glslabel
}{}{\space
(denoted \glsentrysymbol
{\glslabel
})}}
The first time you reference this entry it will be displayed as: “set (denoted \(S\))” (assuming \newglossaryentry
{set}{type={notation},
name={set},
description={A collection of objects},
symbol={\ensuremath
S}
}
\gls
was used).5.1.5. Hooks
\gls
-like and \glstext
-like commands use: \glslinkpresetkeys
.\ifglsused
in the definition of \glspostlinkhook
. The glossaries-extra package provides \glsxtrifwasfirstuse
for use in the post-link hook.\glspostlinkhook
to allow for additional hooks that can vary according to the entry’s category. If you migrate over from only using the base glossaries package to glossaries-extra and you have redefined \glspostlinkhook
, consider moving your modifications to the category post-link hook to avoid breaking the extended post-link hook features. See the glossaries-extra manual for further details. 5.1.6. Enabling and Disabling Hyperlinks to Glossary Entries
\gls
-like and \glstext
-like commands will automatically have hyperlinks to the relevant glossary entry, unless the hyper option has been switched off (either explicitly or through implicit means, such as via the nohypertypes package option).\glsenablehyper
if the commands \hyperlink
and \hypertarget
have been defined, otherwise you will get undefined control sequence errors. If the hyperref package is loaded before glossaries, \glsenablehyper
will be use automatically.\gls
-like commands that recognise the first use flag.
Now I need to redefine \usepackage
[hyperfirst=false]{glossaries}
\glsentryfmt
(see §5.1.4): \renewcommand
*{\glsentryfmt
}{%
\glsgenentryfmt
\ifglsused
{\glslabel
}{}{\footnote
{\glsentrydesc
{\glslabel
}}}%
}
\glsunsetall
(see §7) so that the hyperfirst option doesn’t get applied.main
glossary. I can load the glossaries package using:
Once all glossary entries have been defined I then do: \usepackage
[hyperfirst=false,acronym]{glossaries}
(Alternatively use the nohyperfirst category attribute with glossaries-extra.) \glsunsetall
[main
]
\glsdisablehyper
and put the hyperlinks (where required) within the definition of \glsentryfmt
(see §5.1.4) via \glshyperlink
(see §5.2).\gls
-like commands to have hyperlinks when used in text mode, but not in math mode. I can do this by adding the glossary to the list of nohypertypes and redefining \glsentryfmt
:
Note that this doesn’t affect the \GlsDeclareNoHyperList
{main
}
\renewcommand
*{\glsentryfmt
}{%
\ifmmode
\glsgenentryfmt
\else
\glsifhyperon
{\glsgenentryfmt
}% hyperlink already on
{\glshyperlink
[\glsgenentryfmt
]{\glslabel
}}%
\fi
}
\glstext
-like commands, which will have the hyperlinks off unless they’re forced on using the plus variant or with an explicit use of hypertrue.\glsaddstoragekey
(see §4.3.2) that keeps track of the chapter number that the entry was last used in:
This creates a new user command called \glsaddstoragekey
{chapter}{0}{\glschapnum
}
\glschapnum
that’s analogous to \glsentrytext
. The default value for this key is 0. I then define my glossary entries as usual.\glslinkpostsetkeys
(see §5.1.4) so that it determines the current chapter number (which is stored in \currentchap
using \edef
). This value is then compared with the value of the entry’s chapter key that I defined earlier. If they’re the same, this entry has already been used in this chapter so the hyperlink is switched off using xkeyval’s \setkeys
command. If the chapter number isn’t the same, then this entry hasn’t been used in the current chapter. The chapter field is updated using \glsfieldxdef
(§15.6) provided the user hasn’t switched off the hyperlink. (This test is performed using \glsifhyperon
.)
Note that this will be confused if you use \renewcommand
*{\glslinkpostsetkeys
}{%
\edef
\currentchap
{\arabic
{chapter}}%
\ifnum
\currentchap
=\glschapnum
{\glslabel
}\relax
\setkeys
{glslink}{hyper=false}%
\else
\glsifhyperon
{\glsfieldxdef
{\glslabel
}{chapter}{\currentchap
}}%
\fi
}
\gls
etc when the chapter counter is 0. (That is, before the first \chapter
.)5.2. Using Glossary Terms Without Indexing
\glstextformat
or the entry format, they don’t have any optional arguments, they don’t affect the first use flag and, apart from \glshyperlink
and the number list commands, they don’t produce hyperlinks.\Glsentrytext
, ensure you have at least version 2.08 of mfirstuc. Inside PDF bookmarks, those commands will expand with the sentence case applied using the expandable \MFUsentencecase
. Outside of PDF bookmarks those commands will expand to an internal robust command that applies the sentence case with \glssentencecase
(which defaults to \makefirstuc
). \glscapitalisewords
. Within PDF bookmarks, this command will expand to sentence case using the expandable \MFUsentencecase
. (The title case command \capitalisewords
isn’t expandable.)\glscapitalisewords
to use \capitalisefmtwords
instead of \capitalisewords
. See the mfirstuc manual for further details.
(If you want title-casing in your glossary style, you might want to investigate the glossaries-extra package.) This command will trigger an error if the entry is undefined.\glsentrytitlecase
{sample}{desc}
\gls
-like and \glstext
-like commands, you can use:
. Note that the hyperlink will be suppressed if you have used \glsentrytext
{ }\glsdisablehyper
or if you haven’t loaded the hyperref package.\glshyperlink
, you need to ensure that the relevant entry has been added to the glossary using any of the commands described in §5.1 or §10 otherwise you will end up with an undefined hyperlink target. \glsentry
expand to the associated field value for the entry identified by for the non-case-changing versions. Those commands don’t check if the entry has been defined. The sentence case versions \Glsentry
only expand in PDF bookmarks. In both cases, any fragile commands within the field values will need to be protected or made robust if the field values are required in a moving argument.\glossentry
for the name, description and symbol that are used by the glossary styles. Those commands will issue a warning if the entry hasn’t been defined. See §13 for further information.\glossentryname
. The corresponding sentence case command is:
\Glsentryname
with acronyms or abbreviations. Instead, consider using \Glsentrylong
, \Glsentryshort
or \Glsentryfull
. \glossentrydesc
. The corresponding sentence case command is:
\glossentrysymbol
. The corresponding sentence case command is:
\glsentrynumberlist
and \glsdisplaynumberlist
, display the entry’s number list. This information is readily available with Options 1 and 4 (where the number list is stored in the loclist or location internal fields) but not for Options 2 and 3 (where the number list is simply part of the code to typeset the glossary written in the glossary file).\bibglsdelimN
and \bibglslastDelimN
) for individual locations as well as \delimR
for ranges, as used in the glossary.\glsentrynumberlist
passes the value of the entry’s loclist internal field (that’s created when the aux file is input) to \glsnoidxloclist
(which is also used by \printnoidxglossary
). This will result in a simple list with each location separated with \delimN
, as used in the glossary. Note that this doesn’t allow for ranges (as with \printnoidxglossary
).\printglossary
. Since glossaries often occur at the end of the document, this means that the information has to be saved in the aux file for the next LaTeX run. Therefore an extra LaTeX call is required if \glsentrynumberlist
is needed with makeindex or xindy. This will use the same \delimN
and \delimR
as used in the glossary.\glsentrynumberlist
, this is again at its simplest with Option 4. This works by locally setting \bibglsdelimN
to \glsnumlistsep
and \bibglslastDelimN
to \glsnumlistlastsep
and then displaying the value of the location field. You can instead simply redefine \bibglsdelimN
and \bibglslastDelimN
as desired and use \glsentrynumberlist
.\glsdisplaynumberlist
uses etoolbox’s \forlistloop
to iterate over the field value using the handler macro: \glsdisplaynumberlist
doesn’t work with Options 2 and 3. In which case, a warning will be triggered and \glsentrynumberlist
will be used instead. Without hyperref, the savenumberlist package option is still required, and an attempt will be made to parse the formatted number list created by makeindex/xindy in order to obtain the desired result.\glsdisplaynumberlist
is fairly experimental. It works best with Option 4, works with limited results with Option 1, but for Options 2 or 3 it only works when the default location format is used (that is, with the default formatglsnumberformat). This command will only work with hyperref if you choose Options 1 or 4. 6. Acronyms and Other Abbreviations
\newglossaryentry
, so you can reference them with \gls
and \glspl
as with other entries. Whilst it is possible to simply use \newglossaryentry
explicitly with the first and text keys set to provide a full form on first use and a shortened form on subsequent use, using \newacronym
establishes a consistent format. It also makes it possible to shift the optional argument of the \gls
-like commands inside the full form, so that it is placed before the parentheses.\setacronymstyle
. This should be set before you define your acronyms. \newacronym
: \documentclass
{article}
\usepackage
{glossaries}
\setacronymstyle
{long-short}
\newacronym
{html}{HTML}{hypertext markup language}
\newacronym
{xml}{XML}{extensible markup language}
\begin{document}
First use: \gls
{html} and \gls
{xml}.
Next use: \gls
{html} and \gls
{xml}.
\end{document}
\acronymtype
} but if the acronym should go in another glossary you can set the type in the optional argument , which is added to the end of the in \newglossaryentry
.\newacronym
command also uses the long, longplural, short and shortplural keys in \newglossaryentry
to store the long and short forms and their plurals. \newacronym
with glossaries-extra, you need to first set the abbreviation style for the acronym category with: \setabbreviationstyle
[acronym]{ }
\newglossaryentry
also apply to \newacronym
(see §4). Since \newacronym
is defining the entry with \newglossaryentry
, you can use \glsreset
to reset the first use flag.\DeclareAcronymList
) if you have multiple lists of acronyms. See §2.7. Alternatively, use glossaries-extra to have better support for a mixed glossaries. \newglossaryentry
can also be used here in , but be careful about overriding any keys that are set by the acronym style, such as name, short and long.
If the first use uses the plural form, \newacronym
[longplural={diagonal matrices}]
{dm}{DM}{diagonal matrix}
will display: diagonal matrices (DMs).\glspl
{dm}\glspluralsuffix
to the singular form. The short plural shortplural is obtained (if not explicitly set in ) by appending: \newacronym
implicitly sets type={\acronymtype
}, if you want to load a file containing acronym definitions using \loadglsentries
, the optional argument that specifies the glossary will not have an effect unless you explicitly set type={\glsdefaulttype
} in the optional argument to \newacronym
. See §4.6.
The reset (\setacronymstyle
{long-short}
\newacronym
{idn}{IDN}{identification number}
\begin{document}
First use: \gls
{idn}. Next use: \gls
{idn}.
\glsreset
{idn}% reset first use
The \gls
{idn}['s] prefix is a capital letter.
Next use:
the \gls
{idn}['s] prefix is a capital letter.
\end{document}
\glsreset
) makes the next instance of \gls
behave as first use. Note also the way the final optional argument is treated.
If the acronym had simply been defined with:
then the first use of \newglossaryentry
{idn}{
nameIDN,
firstidentification number (IDN),
descriptionidentification number
}
would have placed in the after the parentheses: \gls
{idn}['s]\setacronymstyle
{long-sc-short}
\newacronym
{idn}{idn}{identification number}
\gls
-like and \glstext
-like commands within the value of keys like text and first due to complications arising from nested links. The same applies to acronyms defined using \newacronym
.
you may be tempted to do: \newacronym
{ssi}{SSI}{server side includes}
\newacronym
{html}{HTML}{hypertext markup language}
Don’t! This will break the case-changing commands, such as \newacronym
{shtml}{S\gls
{html}}{\gls
{ssi} enabled \gls
{html}}
\Gls
, it will cause inconsistencies on first use, and, if hyperlinks are enabled, will cause nested hyperlinks, and it will index the nested entries every time the dependent entry is indexed, which creates unnecessary locations. It will also confuse the commands used by the entry formatting (such as \glslabel
).
or if the font needs to match the style: \newacronym
[description={\gls
{ssi} enabled \gls
{html}}]
{shtml}{SHTML}{SSI enabled HTML}
Alternatively: \newacronym
[description={\gls
{ssi} enabled \gls
{html}}]
{shtml}{SHTML}{\acronymfont
{SSI} enabled \acronymfont
{HTML}}
Similarly for the \newacronym
[description={\gls
{ssi} enabled \gls
{html}}]
{shtml}{SHTML}
{server side includes enabled hypertext markup language}
\glstext
-like commands.6.1. Displaying the Long, Short and Full Forms (Independent of First Use)
\acr…
commands described below are part of the set of \glstext
-like commands. That is, they index and can form hyperlinks, and they don’t modify or test the first use flag. However, unlike the other \glstext
-like commands, their display is governed by \defglsentryfmt
with \glscustomtext
set to the appropriate link text. So, for example,
is similar to: \acrshort
{ }[ ]
except that the first use flag isn’t unset.\glsdisp
{%
\acronymfont
{\glsentryshort
{ }} }
\glstext
-like commands also apply to the following commands. (Including the above warning about nested links.)\glsxtr…
or \glsfmt…
commands. For example, \glsxtrshort
instead of \acrshort
or, if needed in a heading, \glsfmtshort
. (Similarly for the case-changing variants.) \glstext
-like commands, and there are similar star (*
) and plus (+
) variants that switch off or on the hyperlinks. As with the \glstext
-like commands, the link text is placed in the argument of \glstextformat
.\acronymfont
) for the acronym given by . The short form is as supplied by the short key, which \newacronym
implicitly sets.\acrshort
but uses the shortplural value.
(sentence case) and
(all caps).\newacronym
implicitly sets.\acrlong
but uses the longplural value.
(sentence case) and
(all caps).\gls
. For example, the footnote style has the long form in a footnote on the first use of \gls
but \acrfull
has the long form in parentheses instead.
Shortcut Command
Equivalent Command
\acs
\acrshort
\Acs
\Acrshort
\acsp
\acrshortpl
\Acsp
\Acrshortpl
\acl
\acrlong
\Acl
\Acrlong
\aclp
\acrlongpl
\Aclp
\Acrlongpl
\acf
\acrfull
\Acf
\Acrfull
\acfp
\acrfullpl
\Acfp
\Acrfullpl
\ac
\gls
\Ac
\Gls
\acp
\glspl
\Acp
\Glspl
\glsentrytext
(described in §5.2). These don’t include the acronym font commands, such as \acronymfont
.\newacronym
). The corresponding sentence case command is:
\newacronym
). The corresponding sentence case command is:
\glsentrylong
and \glsentryshort
, this does include \acronymfont
, so if you need to use it in a section heading, you may need to disable it in PDF bookmarks: \pdfstringdefDisableCommands
{% provided by hyperref
\let
\acronymfont
\@firstofone
\let
\firstacronymfont
\@firstofone
}
\glsentryfull
but applies sentence case.6.2. Changing the Acronym Style
\setabbreviationstyle
to set the abbreviation style. This uses a different (but more consistent) naming scheme. For example, long-noshort instead of dua. See the “Abbreviations” chapter in the glossaries-extra manual for further details. \usepackage
[acronym]{glossaries}
\makeglossaries
\setacronymstyle
{long-sc-short}
\newacronym
{html}{html}{hypertext markup language}
\newacronym
{xml}{xml}{extensible markup language}
\glsentryfull
and \genacrfullformat
that govern the way the full form is displayed. The closest you can get to different styles if you only want to use the base glossaries package is to adjust the entry format (see §5.1.4) or to provide a custom acronym style such as in Example 12.\setacronymstyle
command will redefine \newacronym
to use the newer acronym mechanism introduced in version 4.02 (2013-12-05). The older mechanism was available, but deprecated, for backward-compatibility until version 4.50 when it was removed. If the pre-4.02 acronym styles are required, you will need to use rollback. As from v4.50, if you don’t use \setacronymstyle
, the first instance of \newacronym
will automatically implement:
which is the closest match to the old default. Example 24 is a modification of the earlier Example 23 so that it uses rollback in order to demonstrate the difference: \setacronymstyle
{long-short}
This produces:
The most noticeable difference is the way the optional argument is treated with \usepackage
{glossaries}[=v4.46]% rollback to v4.46
% no \setacronymstyle
so old style used
\newacronym
{idn}{IDN}{identification number}
\begin{document}
First use: \gls
{idn}. Next use: \gls
{idn}.
\glsreset
{idn}% reset first use
The \gls
{idn}['s] prefix is a capital letter.
Next use:
the \gls
{idn}['s] prefix is a capital letter.
\end{document}
\gls
on first use (
). With the old way, \gls
{idn}['s]\newacronym
simply set firstidentification number (IDN) when it internally used \newglossaryentry
to define the acronym. The default entry format simply appends the after the value of the first key. \newacronym
, the styles set via \setacronymstyle
don’t use the first key, but instead they use \defglsentryfmt
to set a custom display style that uses the long and short keys (or their plural equivalents). This means that these styles cope better with plurals that aren’t formed by simply appending the singular form with the letter “s”. In fact, most of the predefined styles use \glsgenacfmt
and modify the definitions of commands like \genacrfullformat
. If the original behaviour is still required for some reason, use rollback.\glsfirst
will produce the same result as \glstext
. This is why you need to use \acrlong
or \acrfull
instead. Alternatively, reset the first use flag and use \gls
.\setacronymstyle
the name key is set to: \newacronym
. Protected expansion is performed on \acronymsort
when the acronym is defined.6.2.1. Predefined Acronym Styles
\acronymfont
and \firstacronymfont
as required. Usually,
simply does \firstacronymfont
{ }
. If you want the short form displayed differently on first use, you can redefine \acronymfont
{ }\firstacronymfont
after the acronym style is set.\acronymfont
to use \textsc
, which means that the short form needs to be specified in lowercase if it should be rendered in small caps. This is because small caps has small capital glyphs for lowercase letters but normal sized capital glyphs for uppercase letters, which means there’s no visual difference between a normal upright font and a small caps font if the text is in all caps. This is demonstrated in
\setacronymstyle
{long-sc-short}
\newacronym
{mathml}{MathML}{mathematical markup language}
\begin{document}
\acrshort
{mathml}
\end{document}
\glsnamefont
(see §8) to switch to medium weight if you are using a glossary style that displays entry names in bold and you have chosen an acronym style that uses \textsc
. (Alternatively, switch to a font that does support bold small caps.) \acronymfont
to use \textsmaller
.\textsmaller
. If you use one of the acronym styles that set \acronymfont
to \textsmaller
you must explicitly load the relsize package or otherwise define \textsmaller
. \acronymfont
to simply do its argument without any font change. \acrfull
and \glsentryfull
(and their plural and case-changing variants) to reflect the style. \newacronym
will set the sort key to \acronymsort
. The acronym styles redefine this to suit the style. This command must fully expand in order for the indexing application to pick up the correct sort value. If the sort key is set in the optional argument of \newacronym
, it will override this.\acronymentry
. Again, the acronym styles redefine this to suit the style. If the name key is set in the optional argument of \newacronym
, it will override this.\acronymtype
. If the type key is set in the optional argument of \newacronym
, it will override this.\glspluralsuffix
, but the small caps styles define it to:
This uses:
to cancel the effect of the small caps font command \textsc
.\newacronym
, it will override this default.\glspluralsuffix
. If the longplural key is set in the optional argument of \newacronym
, it will override this default.\newacronym
.6.2.1.1. Long (Short)
on (first use and \firstacronymfont
{ })
on subsequent use.\acronymfont
{ }
\acronymsort
so that it just expands to its first argument . This means that the acronyms are sorted according to their short form. In addition, \acronymentry
{label} is set to just the short form (enclosed in \acronymfont
) and the description key is set to the long form.\setacronymstyle
isn’t used (as from v4.50, which has removed the default deprecated style). This shows the long form followed by the short form in parentheses on first use and also with \acrfull
. This redefines \acronymfont
to simply do its argument.\acronymfont
to use \textsc
and \acrpluralsuffix
to \glsacrpluralsuffix
.\textsmaller
for the short form, so it redefines \acronymfont
to use \textsmaller
. This style will require relsize to be loaded.~
). Otherwise it will use \space
.\glsacspace
to use \glsacspacemax
instead of the hard-coded 3em, as \glsacspace
may also be useful in abbreviation styles.
and then redefine \setacronymstyle
{footnote-sc-desc}
\acronymsort
and \acronymentry
:
(I’ve used \renewcommand
*{\acronymsort
}[2]{#1}% sort by short form
\renewcommand
*{\acronymentry
}[1]{% short (long) name
\acronymfont
{\glsentryshort
{#1}}\space
(\glsentrylong
{#1})}%
\space
for extra clarity, but you can just use an actual space instead.)
The alternative is to redefine \usepackage
[T1]{fontenc}
\acronymfont
so that it always switches to medium weight to ensure the small caps setting is used. For example: \renewcommand
*{\acronymfont
}[1]{\textmd
{\scshape
#1}}
6.2.1.2. Short (Long)
on first use and \firstacronymfont
{ } ( )
on subsequent use.\acronymfont
{ }
\acronymsort
{short}{long} to just . This means that the acronyms are sorted according to their short form. In addition, \acronymentry
{label} is set to just the short form (enclosed in \acronymfont
) and the description key is set to the long form.\acrfull
. This redefines \acronymfont
to simply do its argument.\acronymfont
to use \textsc
and \acrpluralsuffix
to \glsacrpluralsuffix
.\textsmaller
for the short form, so it redefines \acronymfont
to use \textsmaller
. This style will require relsize to be loaded.6.2.1.3. Long (Short) User Supplied Description
\newacronym
. The sort value command \acronymsort
is redefined to expand to its second argument ( ), and \acronymentry
is redefined to show the long form followed by the short form in parentheses.\textsmaller
, as long-sm-short.\glsacspace
, as long-sp-short.6.2.1.4. Short (Long) User Supplied Description
\newacronym
. The sort value command \acronymsort
is redefined to expand to its second argument ( ), and \acronymentry
is redefined to show the long form followed by the short form in parentheses.\textsmaller
, as long-sm-short.6.2.1.5. Do Not Use Acronym (DUA)
\gls
-like commands always display the long form regardless of whether the entry has been first useused or not. However, \acrfull
and \glsentryfull
will display the long form followed by the short form, as per the long-short style.\acronymsort
expands to just its second argument (the long form), and \acronymentry
shows just the long form.\acronymsort
expands to just its second argument (the long form), and \acronymentry
shows just the long form.6.2.1.6. Footnote
\gls
-like commands show the short form followed by the long form in a footnote on first use. The footnote is simply added with \footnote
. The \acrfull
set of commands show the short form followed by the long form in parentheses (as per styles like short-long). The definitions of \acronymsort
and \acronymentry
are as for the “short (long)” styles described in §6.2.1.2.\acronymentry
, \acronymsort
and \acronymfont
in the same way as the short-long style\acronymentry
, \acronymsort
, \acronymfont
and \acrpluralsuffix
in the same way as the sc-short-long style\acronymentry
, \acronymsort
and \acronymfont
in the same way as the sm-short-long style\acronymentry
, \acronymsort
and \acronymfont
in the same way as the short-long-desc style\acronymentry
, \acronymsort
and \acronymfont
in the same way as the sc-short-long-desc style\acronymentry
, \acronymsort
and \acronymfont
in the same way as the sm-short-long-desc style6.2.2. Defining A Custom Acronym Style
\defglsentryfmt
. You can simply use \glsgenacfmt
or you can customize the display using commands like \ifglsused
, \glsifplural
and \glscapscase
. (See §5.1.4 for further details.)\newacronym
and \newglossaryentry
) then you can test if the entry is an acronym and use \glsgenacfmt
if it is or \glsgenentryfmt
if it isn’t. For example, the long-short style sets as
(You can use \ifglshaslong
{\glslabel
}{\glsgenacfmt
}{\glsgenentryfmt
}
\ifglshasshort
instead of \ifglshaslong
to test if the entry is an acronym if you prefer.)\acronymfont
and \genacrfullformat
.##
rather than to reference parameters in command definitions within . \setacronymstyle
redefines \glsentryfull
and \acrfullfmt
to use \genacrfullformat
(and similarly for the plural and case-changing variants). If this isn’t appropriate for the style (as in the case of styles like footnote and dua) \newacronymstyle
should redefine these commands within .\newacronymstyle
’s argument you can also redefine: \newglossaryentry
, when it’s internally called by \newacronym
. You can use the following token registers to access information passed to the arguments of \newacronym
.\the
. For example, the long-short style does:
which sets the description field to the long form of the acronym whereas the long-short-desc style does: \renewcommand
*{\GenericAcronymFields
}{%
description={\the
\glslongtok
}}
since the description needs to be specified by the user.\renewcommand
*{\GenericAcronymFields
}{}
\newacronymstyle
{long-sc-short}%
{% use the same display as long-short
\GlsUseAcrEntryDispStyle
{long-short}%
}%
{% use the same definitions as long-short
\GlsUseAcrStyleDefs
{long-short}%
% Minor modifications:
\renewcommand
{\acronymfont
}[1]{\textsc
{##
1}}%
\renewcommand
*{\acrpluralsuffix
}{\glstextup
{\glspluralsuffix
}}%
}
\gls
on first use to display:
on subsequent use: \textsc
{ }\footnote
{ : }
and in the list of acronyms, each entry will be displayed in the form: \textsc
{ }
( )
\newacronymstyle
using:
This will use \ifglshaslong
{\glslabel
}{\glsgenacfmt
}{\glsgenentryfmt
}
\glsgenentryfmt
if the entry isn’t an acronym, otherwise it will use \glsgenacfmt
. The third argument ( ) of \newacronymstyle
needs to redefine \genacrfullformat
etc so that the first use displays the short form in the text with the long form in a footnote followed by the description. This is done as follows: % No case change, singular first use:
If you think it inappropriate for the short form to be capitalised at the start of a sentence you can change the above to: \renewcommand
*{\genacrfullformat
}[2]{%
\firstacronymfont
{\glsentryshort
{##
1}}##
2%
\footnote
{\glsentrylong
{##
1}: \glsentrydesc
{##
1}}%
}%
% Sentence case, singular first use:
\renewcommand
*{\Genacrfullformat
}[2]{%
\firstacronymfont
{\Glsentryshort
{##
1}}##
2%
\footnote
{\glsentrylong
{##
1}: \glsentrydesc
{##
1}}%
}%
% No case change, plural first use:
\renewcommand
*{\genplacrfullformat
}[2]{%
\firstacronymfont
{\glsentryshortpl
{##
1}}##
2%
\footnote
{\glsentrylongpl
{##
1}: \glsentrydesc
{##
1}}%
}%
% Sentence case, plural first use:
\renewcommand
*{\Genplacrfullformat
}[2]{%
\firstacronymfont
{\Glsentryshortpl
{##
1}}##
2%
\footnote
{\glsentrylongpl
{##
1}: \glsentrydesc
{##
1}}%
}
% No case change, singular first use:
Another variation is to use \renewcommand
*{\genacrfullformat
}[2]{%
\firstacronymfont
{\glsentryshort
{##
1}}##
2%
\footnote
{\glsentrylong
{##
1}: \glsentrydesc
{##
1}}%
}%
% No case change, plural first use:
\renewcommand
*{\genplacrfullformat
}[2]{%
\firstacronymfont
{\glsentryshortpl
{##
1}}##
2%
\footnote
{\glsentrylongpl
{##
1}: \glsentrydesc
{##
1}}%
}%
\let
\Genacrfullformat
\genacrfullformat
\let
\Genplacrfullformat
\genplacrfullformat
\Glsentrylong
and \Glsentrylongpl
in the footnote instead of \glsentrylong
and \glsentrylongpl
.\glsentryfull
and \acrfull
shouldn’t use a footnote, but instead use the format: ( ). This means that the style needs to redefine \glsentryfull
, \acrfullfmt
and their plural and case-changing variants.
Now for the linking commands: \renewcommand
*{\glsentryfull
}[1]{%
\glsentrylong
{##
1}\space
(\acronymfont
{\glsentryshort
{##
1}})%
}%
\renewcommand
*{\Glsentryfull
}[1]{%
\Glsentrylong
{##
1}\space
(\acronymfont
{\glsentryshort
{##
1}})%
}%
\renewcommand
*{\glsentryfullpl
}[1]{%
\glsentrylongpl
{##
1}\space
(\acronymfont
{\glsentryshortpl
{##
1}})%
}%
\renewcommand
*{\Glsentryfullpl
}[1]{%
\Glsentrylongpl
{##
1}\space
(\acronymfont
{\glsentryshortpl
{##
1}})%
}
(This may cause problems with long hyperlinks, in which case adjust the definitions so that, for example, only the short form is inside the argument of \renewcommand
*{\acrfullfmt
}[3]{%
\glslink
[##
1]{##
2}%
\glsentrylong
{##
2}##
3\space
(\acronymfont
{\glsentryshort
{##
2}})%
%
}%
\renewcommand
*{\Acrfullfmt
}[3]{%
\glslink
[##
1]{##
2}%
\Glsentrylong
{##
2}##
3\space
(\acronymfont
{\glsentryshort
{##
2}})%
%
}%
\renewcommand
*{\ACRfullfmt
}[3]{%
\glslink
[##
1]{##
2}%
\glsuppercase
{%
\glsentrylong
{##
2}##
3\space
(\acronymfont
{\glsentryshort
{##
2}})%
}%
%
}%
\renewcommand
*{\acrfullplfmt
}[3]{%
\glslink
[##
1]{##
2}%
\glsentrylongpl
{##
2}##
3\space
(\acronymfont
{\glsentryshortpl
{##
2}})%
%
}%
\renewcommand
*{\Acrfullplfmt
}[3]{%
\glslink
[##
1]{##
2}%
\Glsentrylongpl
{##
2}##
3\space
(\acronymfont
{\glsentryshortpl
{##
2}})%
%
}%
\renewcommand
*{\ACRfullplfmt
}[3]{%
\glslink
[##
1]##
2%
\glsuppercase
{%
\glsentrylongpl
{##
2}##
3 (\acronymfont
{\glsentryshortpl
{##
2}})%
}%
%
}
\glslink
.)\acronymsort
so that the acronyms are sorted according to the long form:
If you prefer them to be sorted according to the short form you can change the above to: \renewcommand
*{\acronymsort
}[2]{##
2}
The acronym font needs to be set to \renewcommand
*{\acronymsort
}[2]{##
1}
\textsc
and the plural suffix adjusted so that the “s” suffix in the plural short form doesn’t get converted to small caps:
There are a number of ways of dealing with the format in the list of acronyms. The simplest way is to redefine \renewcommand
*{\acronymfont
}[1]{\textsc
{##
1}}%
\renewcommand
*{\acrpluralsuffix
}{\glsupacrpluralsuffix
}%
\acronymentry
to the long form followed by the upper case short form in parentheses:
(I’ve used \renewcommand
*{\acronymentry
}[1]{%
\Glsentrylong
{##
1}\space
(\glsuppercase
\glsentryshort
{##
1})}
\Glsentrylong
instead of \glsentrylong
to capitalise the name in the glossary.)\acronymentry
to just the long form and redefine \GenericAcronymFields
to set the symbol key to the short form and use a glossary style that displays the symbol in parentheses after the name (such as the tree style) like this:
I’m going to use the first approach and set \renewcommand
*{\acronymentry
}[1]{\Glsentrylong
{##
1}}%
\renewcommand
*{\GenericAcronymFields
}{%
symbol={\protect
\glsuppercase
{\the
\glsshorttok
}}}%
\GenericAcronymFields
to do nothing: \renewcommand
*{\GenericAcronymFields
}{}%
Putting this all together: \glshyperfirstfalse
\newacronymstyle
{custom-fn}% new style name
{% entry format
\ifglshaslong
{\glslabel
}{\glsgenacfmt
}{\glsgenentryfmt
}%
}%
{%
\renewcommand
*{\GenericAcronymFields
}{}%
\glshyperfirstfalse
% No case change, singular first use:
\renewcommand
*{\genacrfullformat
}[2]{%
\firstacronymfont
{\glsentryshort
{##
1}}##
2%
\footnote
{\glsentrylong
{##
1}: \glsentrydesc
{##
1}}%
}%
% Sentence case, singular first use:
\renewcommand
*{\Genacrfullformat
}[2]{%
\firstacronymfont
{\Glsentryshort
{##
1}}##
2%
\footnote
{\glsentrylong
{##
1}: \glsentrydesc
{##
1}}%
}%
% No case change, plural first use:
\renewcommand
*{\genplacrfullformat
}[2]{%
\firstacronymfont
{\glsentryshortpl
{##
1}}##
2%
\footnote
{\glsentrylongpl
{##
1}: \glsentrydesc
{##
1}}%
}%
% Sentence case, plural first use:
\renewcommand
*{\Genplacrfullformat
}[2]{%
\firstacronymfont
{\Glsentryshortpl
{##
1}}##
2%
\footnote
{\glsentrylongpl
{##
1}: \glsentrydesc
{##
1}}%
}%
% non-linking commands
\renewcommand
*{\glsentryfull
}[1]{%
\glsentrylong
{##
1}\space
(\acronymfont
{\glsentryshort
{##
1}})%
}%
\renewcommand
*{\Glsentryfull
}[1]{%
\Glsentrylong
{##
1}\space
(\acronymfont
{\glsentryshort
{##
1}})%
}%
\renewcommand
*{\glsentryfullpl
}[1]{%
\glsentrylongpl
{##
1}\space
(\acronymfont
{\glsentryshortpl
{##
1}})%
}%
\renewcommand
*{\Glsentryfullpl
}[1]{%
\Glsentrylongpl
{##
1}\space
(\acronymfont
{\glsentryshortpl
{##
1}})%
}%
% linking commands
\renewcommand
*{\acrfullfmt
}[3]{%
\glslink
[##
1]{##
2}%
\glsentrylong
{##
2}##
3\space
(\acronymfont
{\glsentryshort
{##
2}})%
%
}%
\renewcommand
*{\Acrfullfmt
}[3]{%
\glslink
[##
1]{##
2}%
\Glsentrylong
{##
2}##
3\space
(\acronymfont
{\glsentryshort
{##
2}})%
%
}%
\renewcommand
*{\ACRfullfmt
}[3]{%
\glslink
[##
1]{##
2}%
\glsuppercase
{%
\glsentrylong
{##
2}##
3\space
(\acronymfont
{\glsentryshort
{##
2}})%
}%
%
}%
\renewcommand
*{\acrfullplfmt
}[3]{%
\glslink
[##
1]{##
2}%
\glsentrylongpl
{##
2}##
3\space
(\acronymfont
{\glsentryshortpl
{##
2}})%
%
}%
\renewcommand
*{\Acrfullplfmt
}[3]{%
\glslink
[##
1]{##
2}%
\Glsentrylongpl
{##
2}##
3\space
(\acronymfont
{\glsentryshortpl
{##
2}})%
%
}%
\renewcommand
*{\ACRfullplfmt
}[3]{%
\glslink
[##
1]##
2%
\glsuppercase
{%
\glsentrylongpl
{##
2}##
3 (\acronymfont
{\glsentryshortpl
{##
2}})%
}%
%
}%
% font
\renewcommand
*{\acronymfont
}[1]{\textsc
{##
1}}%
\renewcommand
*{\acrpluralsuffix
}{\glsupacrpluralsuffix
}%
% sort
\renewcommand
*{\acronymsort
}[2]{##
2}%
% name
\renewcommand
*{\acronymentry
}[1]{%
\Glsentrylong
{##
1}\space
(\glsuppercase
\glsentryshort
{##
1})}%
}
I also need to use a glossary style that suits this acronym style, for example altlist: \setacronymstyle
{custom-fn}
\setglossarystyle
{altlist}
\newacronym
[description={set of tags for use in developing hypertext documents}]{html}{html}{Hyper
Text Markup Language}
\newacronym
[description={language used to describe the layout of a document written in a markup language}]{css}
{css}{Cascading Style Sheet}
\newacronym
can cause complications.\glsaddstoragekey
to add an extra field that can be used to store the formatting declaration (such as \em
).
This defines a new field/key called font, which defaults to nothing if it’s not explicitly set. This also defines a command called \glsaddstoragekey
{font}{}{\entryfont
}
\entryfont
that’s analogous to \glsentrytext
. A new style is then created to format acronyms that access this field.\glsgenacfmt
but instead provides a modified version that doesn’t use \acronymfont
but instead uses {
The full format given by commands such as \entryfont
{\glslabel
} }.
\genacrfullformat
need to be similarly adjusted. For example:
This will deal with commands like \renewcommand
*{\genacrfullformat
}[2]{%
\glsentrylong
{##
1}##
2\space
({\entryfont
{##
1}\glsentryshort
{##
1}})%
}%
\gls
but not commands like \acrshort
which still use \acronymfont
. Another approach is to redefine \acronymfont
to look up the required font declaration. Since \acronymfont
doesn’t take the entry label as an argument, the following will only work if \acronymfont
is used in a context where the label is provided by \glslabel
. This is true in \gls
, \acrshort
and \acrfull
. The redefinition is now:
So the new style can be defined as: \renewcommand
*{\acronymfont
}[1]{{\entryfont
{\glslabel
}##
1}}%
Remember the style needs to be set before defining the entries: \newacronymstyle
{long-font-short}
{%
\GlsUseAcrEntryDispStyle
{long-short}%
}%
{%
\GlsUseAcrStyleDefs
{long-short}%
\renewcommand
*{\genacrfullformat
}[2]{%
\glsentrylong
{##
1}##
2\space
({\entryfont
{##
1}\glsentryshort
{##
1}})%
}%
\renewcommand
*{\Genacrfullformat
}[2]{%
\Glsentrylong
{##
1}##
2\space
({\entryfont
{##
1}\glsentryshort
{##
1}})%
}%
\renewcommand
*{\genplacrfullformat
}[2]{%
\glsentrylongpl
{##
1}##
2\space
({\entryfont
{##
1}\glsentryshort
{##
1}})%
}%
\renewcommand
*{\Genplacrfullformat
}[2]{%
\Glsentrylongpl
{##
1}##
2\space
({\entryfont
{##
1}\glsentryshort
{##
1}})%
}%
\renewcommand
*{\acronymfont
}[1]{{\entryfont
{\glslabel
}##
1}}%
\renewcommand
*{\acronymentry
}[1]{{\entryfont
{##
1}\glsentryshort
{##
1}}}%
}
\setacronymstyle
{long-font-short}
\␣
(backslash space) in place of just a space character for an inter-word mid-sentence space and use \@
before the full stop to indicate the end of the sentence.I was awarded a B.Sc. and a Ph.D. (From the same place.)
is typeset as
is typeset as \ttfamily
I was awarded a B.Sc. and a Ph.D. (From the same place.)
I was awarded a B.Sc.
\
and a Ph.D\@
. (From the same place.)
\newacronym
and the B.Sc.
part can be dealt with by remembering to add \␣
\␣
(for example,
but the end of sentence case is more troublesome as you need to omit the sentence terminating full stop (to avoid two dots) which can make the source code look a little strange but you also need to adjust the space factor, which is usually done by inserting \gls
{bsc}\␣
\@
before the full stop.\glspostlinkhook
) is called at the very end of the \gls
-like and \glstext
-like commands. This can be redefined to check if the following character is a full stop. The amsgen package (which is automatically loaded by glossaries) provides an internal command called \new@ifnextchar
that can be used to determine if the given character appears next. (For more information see the amsgen documentation. Alternatively, LaTeX3 may provide a better way of doing this.)
Now I just use \glsaddstoragekey
{abbrtype}{word}{\abbrtype
}
\newcommand
*{\newabbr
}[1][]{\newacronym
[abbrtype=initials,#1]}
\newacronym
for the acronyms, for example,
and my new command \newacronym
{laser}{laser}{light amplification by stimulated
emission of radiation}
\newabbr
for initials, for example,
Within \newabbr
{eg}{e.g.}{exempli gratia}
\newabbr
{ie}{i.e.}{id est}
\newabbr
{bsc}{B.Sc.}{Bachelor of Science}
\newabbr
{ba}{B.A.}{Bachelor of Arts}
\newabbr
{agm}{A.G.M.}{annual general meeting}
\glspostlinkhook
the entry’s label can be accessed using \glslabel
and \ifglsfieldeq
can be used to determine if the current entry has the new abbrtype field set to “initials”. If it doesn’t, then nothing needs to happen, but if it does, a check is performed to see if the next character is a full stop. If it is, this signals the end of a sentence otherwise it’s mid-sentence.\makeatletter
and \makeatother
:
In the event that a full stop is found then \makeatletter
\renewcommand
{\glspostlinkhook
}{%
\ifglsfieldeq
{\glslabel
}{abbrtype}{initials}%
{\new@ifnextchar
.
\doendsentence
\doendword
}
{}%
}
\makeatother
\doendsentence
is performed, but it will be followed by the full stop, which needs to be discarded. Otherwise \doendword
will be done, but it won’t be followed by a full stop so there’s nothing to discard. The definitions for these commands are:
Now, I can just do \newcommand
{\doendsentence
}[1]{\spacefactor
=10000 }
\newcommand
{\doendword
}{\spacefactor
=1000 }
mid-sentence and \gls
{bsc}
at the end of the sentence. The terminating full stop will be discarded in the latter case, but it won’t be discarded in, say, \gls
{phd}.
as that doesn’t have the abbrtype field set to “initials”.\gls
{laser}.
\glspostlinkhook
is used after the first use flag has been unset for the entry, this can’t be fixed by simply checking with \ifglsused
. One possible solution to this is to redefine \glslinkpostsetkeys
to check for the first use flag and define a macro that can then be used in \glspostlinkhook
.\doendsentence
(using \glsifplural
) and put the full stop back if the plural has been used.6.3. Displaying the List of Acronyms
\print
glossary command, according to the indexing method.\printnoidxglossary
[type=\acronymtype
]
Or if you have used the acronym or acronyms package option: \printglossary
[type=\acronymtype
]
See §2.7.)\printacronyms
\printnoidxglossaries
(Option 1) or \printglossaries
(Options 2 or 3).6.4. Upgrading From the glossary Package
\
when defining the acronym .
In addition, \newacronym
[ ]{ }{ }{ }
\oldacronym
also defines the commands \
, which is equivalent to
, and \gls
{ }\
, which is equivalent to the *sentence case
. If is omitted, is used. Since commands names must consist only of alphabetical characters, must also only consist of alphabetical characters. Note that \Gls
{ }\
doesn’t allow you to use the first optional argument of \gls
or \Gls
―you will need to explicitly use \gls
or \Gls
to change the settings.\
unless you additionally load the xspace package, but be aware that there are some issues with using xspace. (See David Carlisle’s explanation in Drawbacks of xspace.) \xspace
in \
. If you don’t use the xspace package, then you need to explicitly force a space using \␣
(backslash space). On the other hand, you can follow the \
command with the optional text in square brackets (the final optional argument to \gls
). If you use the xspace package you don’t need to escape the spaces but you can’t use the optional argument to insert text (you will have to explicitly use \gls
to achieve that).
This will create the command \oldacronym
{abc}{example acronym}{}
\abc
and its starred version \abc*
. Table 6.2 illustrates the effect of \abc
(on subsequent use) according to whether or not the xspace package has been loaded. As can be seen from the final row in the table, the xspace package prevents the optional argument from being recognised.
\oldacronym
Code
With xspace
Without xspace
\abc.
abc.
abc.
\abc xyz
abc xyz
abcxyz
\abc
\
xyz abc xyz
abc xyz
\abc* xyz
Abc xyz
Abc xyz
\abc['s] xyz
abc [’s] xyz
abc’s xyz
7. Unsetting and Resetting Entry Flags
\gls
-like commands it is possible that you may want to use the value given by the first key, even though you have already used the glossary entry. Conversely, you may want to use the value given by the text key, even though you haven’t used the glossary entry.main
glossary and the acronym
list: \glsresetall
[main
,acronym
]
\gls
-like commands, that will unset or reset the first use flag before the link text, which will make the \gls
-like command behave as though it was the subsequent use or first use, irrespective of whether or not the entry has actually been used. \ifglsused
. With bib2gls, you may need to use \GlsXtrIfUnusedOrUndefined
instead.\gls
-like commands within an environment or command argument that gets processed multiple times as it can cause unwanted side-effects when the first use displayed text is different from subsequent use. \documentclass
{beamer}
\usepackage
{glossaries}
\newacronym
{svm}{SVM}{support vector machine}
\begin{document}
\begin{frame}
\frametitle
{Frame 1}
\begin{itemize}
\item
<+-> \gls
{svm}
\item
<+-> Stuff.
\end{itemize}
\end{frame}
\end{document}
produces “support vector machine (SVM)” and then unsets the first use flag. When the second overlay is processed, \gls
{svm}
now produces “SVM”, which is unlikely to be the desired effect. I don’t know anyway around this and I can only offer the following suggestions.\gls
{svm}
\acrfull
when you want the full version to be displayed: \documentclass
{beamer}
\usepackage
{glossaries}
\newacronym
{svm}{SVM}{support vector machine}
\glsunsetall
\begin{document}
\begin{frame}
\frametitle
{Frame 1}
\begin{itemize}
\item
<+-> \acrfull
{svm}
\item
<+-> Stuff.
\end{itemize}
\end{frame}
\end{document}
Alternatively, with glossaries-extra: \begin{frame}
\frametitle
{Frame 1}
\begin{itemize}
\item
<+-> \glsreset
{svm}\gls
{svm}
\item
<+-> Stuff.
\end{itemize}
\end{frame}
\documentclass
{beamer}
\usepackage
{glossaries-extra}
\newabbreviation
{svm}{SVM}{support vector machine}
\begin{document}
\begin{frame}
\frametitle
{Frame 1}
\begin{itemize}
\item
<+-> \gls
[prereset]{svm}
\item
<+-> Stuff.
\end{itemize}
\end{frame}
\end{document}
See the glossaries-extra manual for further details.
\documentclass
{beamer}
\usepackage
{glossaries-extra}
\newabbreviation
{svm}{SVM}{support vector machine}
\begin{document}
\GlsXtrStartUnsetBuffering
\GlsXtrUnsetBufferEnableRepeatLocal
\begin{frame}
\GlsXtrResetLocalBuffer
\frametitle
{Frame 1}
\begin{itemize}
\item
<+-> \gls
{svm}
\item
<+-> Stuff.
\end{itemize}
\end{frame}
\GlsXtrStopUnsetBuffering
\end{document}
\glspatchtabularx
in the preamble (or anywhere before the problematic use of tabularx).7.1. Counting the Number of Times an Entry has been Used (First Use Flag Unset)
\newglossaryentry
(and therefore \newacronym
) into a preamble-only command. \glsunset
is used within the document. A local unset (using \glslocalunset
) performs a local rather than global increment to currcount. Remember that not all commands use \glsunset
. Only the \gls
-like commands do this. \glsreset
and \glslocalreset
will reset the value of the currcount field back to 0. This conditional can be set to true with:
and to false with:
The default is false, as from version 4.50.
On the first LaTeX run, \documentclass
{article}
\usepackage
{glossaries}
\makeglossaries
\glsenableentrycount
\newglossaryentry
{apple}{name={apple},description={a fruit}}
\begin{document}
Total usage on previous run: \glsentryprevcount
{apple}.
\gls
{apple}. \gls
{apple}. \glsadd
{apple}\glsentrytext
{apple}.
\glslink
{apple}{apple}. \glsdisp
{apple}{apple}. \Gls
{apple}.
Number of times apple has been used: \glsentrycurrcount
{apple}.
\end{document}
produces 0. At the end of the document, \glsentryprevcount
{apple}
produces 4. This is because the only commands that have incremented the entry count are those that use \glsentryprevcount
{apple}\glsunset
. That is: \gls
, \glsdisp
and \Gls
. The other commands used in the above example, \glsadd
, \glsentrytext
and \glslink
, don’t use \glsunset
so they don’t increment the entry count. On the next LaTeX run,
now produces 4 as that was the value of the currcount field for the “apple” entry at the end of the document on the previous run.\glsentryprevcount
{apple}\glsenableentrycount
, you also enable the following commands: \gls
)
(no case-change, plural, analogous to \glspl
)
(first letter uppercase, singular, analogous to \Gls
), and
(first letter uppercase, plural, analogous to \Glspl
).\glsenableentrycount
, these commands behave like their counterparts \gls
, \glspl
, \Gls
and \Glspl
, respectively, but there will be a warning that you haven’t enabled entry counting.\glsenableentrycount
then these commands test if
equals 1. If it doesn’t then the analogous \glsentryprevcount
{ }\gls
etc will be used. If it is 1, then the first optional argument will be ignored and
will be performed, where { }{ } is a command that takes two arguments. The command used depends whether you have used \glsunset
{ }
\cgls
, \cglspl
, \cGls
or \cGlspl
.\cgls
and defaults to
if the entry given by has a long form or \glsentrylong
{ }
otherwise.\glsentryfirst
{ }
\cglspl
and defaults to
if the entry given by has a long form or \glsentrylongpl
{ }
otherwise.\glsentryfirstplural
{ }
\cGls
and defaults to
if the entry given by has a long form or \Glsentrylong
{ }
otherwise.\Glsentryfirst
{ }
\cGlspl
and defaults to { }
if the entry given by has a long form or
otherwise.\Glsentryfirstplural
{ }
\cgls
-like commands and those commands won’t index (that is, they won’t add a line to the external glossary file). If you haven’t used any of the other commands that index (such as \glsadd
or the \glstext
-like commands) then the entry won’t appear in the glossary.\glsentryprevcount
you need to run LaTeX twice to ensure they work correctly. The document build requires a second LaTeX call before running the indexing application. For example, if the document is in a file called myDoc.tex, then the document build needs to be: pdflatex myDoc
pdflatex myDoc
makeglossaries myDoc
pdflatex myDoc
\cgls
:
After a complete document build the list of acronyms only includes the entries HTML, CSS and RDSMS. The entries SQL, RDBMS and XML only have their long forms displayed and don’t have a hyperlink.
\documentclass
{article}
\usepackage
[colorlinks]{hyperref}
\usepackage
[acronym]{glossaries}
\makeglossaries
\glsenableentrycount
\setacronymstyle
{long-short}
\newacronym
{html}{HTML}{hypertext markup language}
\newacronym
{css}{CSS}{cascading style sheets}
\newacronym
{xml}{XML}{extensible markup language}
\newacronym
{sql}{SQL}{structured query language}
\newacronym
{rdbms}{RDBMS}{relational database management system}
\newacronym
{rdsms}{RDSMS}{relational data stream management system}
\begin{document}
These entries are only used once: \cgls
{sql}, \cgls
{rdbms},
\cgls
{xml}. These entries are used multiple times:
\cgls
{html}, \cgls
{html}, \cgls
{css}, \cgls
{css}, \cgls
{css},
\cgls
{rdsms}, \cgls
{rdsms}.
\printglossaries
\end{document}
8. Displaying a Glossary
\printglossary
, that matches the indexing method. These commands are collectively referred to as the \print
set of commands. glossary\newglossary
), as applicable, to see if there is a problem. With Option 1, you just need two LaTeX runs to make the glossaries appear, but you may need further runs to make the number lists up-to-date. If you have used the automake option, check the log file for “runsystem” lines (see the information about the automake option in §2.5 for further details). \makenoidxglossaries
in the document preamble): \glsdefaulttype
. This command iterates over a list of entry labels, which it will have to first sort with sort=standard. The list will only include those entries that have been indexed and the appropriate glossary markup is added within the loop. This makes it unsuitable for the tabular-like glossary styles, such as long and super.\printnoidxglossary
for each non-ignored glossary.\makeglossaries
in the document preamble): \glsdefaulttype
. This command internally inputs the associated glossary file (created by the relevant indexing application) if it exists. The glossary file contains the markup to typeset the glossary. See §1.6 for information on how to create the glossary file.\printglossary
for each non-ignored glossary.\printglossary
will just do \null
for each missing glossary to assist dictionary style documents that just use \glsaddall
without inserting any text. This use of \null
ensures that all indexing information is written before the final page is shipped out. Once the external glossary files are present \null
will no longer be used. This can cause a spurious blank page on the first LaTeX run before the glossary files have been created. Once these files are present, \null
will no longer be used and so shouldn’t cause interference for the final document. With glossaries-extra, placeholder text is used instead. \glsdefaulttype
. This command is similar to \printnoidxglossary
, in that it iterates over a list of entry labels, but in this case all defined entries within the given glossary are included and the list is in the order in which they were defined (that is, the order in which they were added to the glossary’s internal label list).\printnoidxglossary
, the glossary markup is inserted during the loop but, unlike that command, \printunsrtglossary
performs the loop outside of the glossary style, which means that there are no issues with the tabular-like styles. See the glossaries-extra manual for further details.\printunsrtglossary
for each non-ignored glossary.\print
glossary have an optional argument. Available options are listed in §8.1.8.1.
\print
Options glossary\print
glossary set of commands. Some options are available for all those commands, but those that aren’t are noted. Before the options are set, the following commands are defined to their defaults for the given glossary. They may then be redefined by applicable options.\printunsrtglossary
or \printunsrtinnerglossary
, otherwise should correspond to a glossary that was defined with \newglossary
or \altnewglossary
.\glossarytitle
). This option isn’t available with \printunsrtinnerglossary
.\glossarytoctitle
). This option isn’t available with \printunsrtinnerglossary
.\setglossarystyle
). This option isn’t available with \printunsrtinnerglossary
.\printunsrtinnerglossary
.\ifglsnogroupskip
to test for this option.\glspostdescription
.\glsrefentry
work correctly. The setting can then be switched off with this option for individual glossaries where the setting shouldn’t apply.\glsrefentry
work correctly. The setting can then be switched off with this option for individual glossaries where the setting shouldn’t apply.\glsrefentry
won’t work). In general, it’s best to enable these settings via the package options and switch them off for the glossaries where they don’t apply. \printnoidxglossary
.\dtlwordindexcompare
and \dtlletterindexcompare
handlers. The case-insensitive sort method uses datatool’s \dtlicompare
handler. The case-sensitive sort method uses datatool’s \dtlcompare
handler. See the datatool documentation for further details.
. This is an alternative to the package option numberedsection=autolabel. This option isn’t available with \label
{ }\printunsrtinnerglossary
.\gls
and \glslink
.)\printunsrtglossary
as it allows the same list (or sub-list) of entries to be displayed multiple times without causing duplicate hypertarget names.\glolinkprefix
but note this will also affect the target for any entry referenced within the glossary with commands like \gls
, \glslink
or \glshyperlink
.\glolinkprefix
(so it won’t change the hyperlinks for any entries referenced in the glossary).\printunsrtglossary
and \printunsrtinnerglossary
. If true, the “unsrt” function that creates the code for typesetting the glossary will insert letter group headers whenever a change is detected in the letter group label between entries of the same hierarchical level. See the glossaries-extra manual for further details.\printunsrtglossary
and \printunsrtinnerglossary
. It can be used to locally adjust the hierarchical level used by the glossary style. See the glossaries-extra manual for further details and also Gallery: Inner or Nested Glossaries.\printunsrtglossary
and \printunsrtinnerglossary
. It can be used to locally remove the hierarchical level used by the glossary style. See the glossaries-extra manual for further details.8.2. Glossary Markup
\ifglshasparent
(to determine if the entry has a parent) or \glsentryparent
(to expand to the parent’s label). The hierarchical level is provided in \subglossentry
(and is 0 with \glossentry
) but it’s also stored in the level internal field.\input
rather than \printglossary
.
This creates the heading. This command sets the page header with: \glossarysection
[\glossarytoctitle
]{\glossarytitle
}
If this is unsuitable for your chosen class file or page style package, you will need to redefine \glsglossarymark
{\glossarytoctitle
}
\glsglossarymark
. If \phantomsection
is defined (hyperref) then \glossarysection
will start with: \glsclearpage
\phantomsection
\chapter*
or \section*
, depending on whether or not \chapter
is defined. This can be overridden by the section package option or the \setglossarysection
command. Numbered sectional units can be obtained using the numberedsection package option. If the default unnumbered section setting is on, then the will only be added to the table of contents if the toc option is set. If numberedsection is on, the addition to the table of contents is left to the sectional command.\glossarymark
was provided for this purpose, but this command is also provided by other packages and classes, notably memoir which has a different syntax. Therefore the command \glossarymark
will only be defined if it doesn’t already exist. In which case, \glsglossarymark
will simply use \glossarymark
.\glsglossarymark
will be defined to use \markboth
otherwise, if some other class or package has defined \glossarymark
, \glsglossarymark
will be defined to use \@mkboth
(using the same definition as the glossaries package’s version of \glossarymark
).\memUChead
if memoir has been loaded, otherwise it will use \glsuppercase
.\glsglossarymark
not \glossarymark
. For example, to only change the right header:
or to prevent it from changing the headers: \renewcommand
{\glsglossarymark
}[1]{\markright
{#1}}
If you want \renewcommand
{\glsglossarymark
}[1]{}
\glsglossarymark
to use all caps in the header, use the ucmark option described below.\phantomsection
is need to create an appropriate anchor (see the hyperref manual). This will need the page cleared for \chapter*
, which is done with: \glsclearpage
will use \cleardoublepage
, if it’s defined and if the \if@openright
conditional (provided by classes with an openright option such as book and report) isn’t defined or is defined and is true, otherwise \clearpage
is used.\cleardoublepage
when it is not required. This may cause an unwanted blank page to appear before each glossary If you only want a single page cleared, you can redefine \glsclearpage
. For example:
Note that this will no longer take the section package option into account.\renewcommand
*{\glsclearpage
}{\clearpage
}
\newglossary
when the glossary was defined. The title option will redefined this command.\glsglossarymark
and the current page style).\glossarytoctitle
command is initialised to \glossarytitle
. The toctitle option will redefine this command. If neither the title nor toctitle are used, \glossarytoctitle
will be defined via: \glossarytoctitle
to the title provided in \newglossary
when the glossary was defined.\glossarytoctitle
will be defined to that value but \glossarytitle
will be the glossary’s associated title.
A glossary may have its own specific preamble. If it has one defined, then the \renewcommand
{\glossarypreamble
}{Numbers in italic
indicate primary definitions.}
\print
glossary set of commands will locally redefine \glossarypreamble
to that preamble instead. Since this change is scoped, the previous definition will be restored after the \print
glossary command.\glsdefaulttype
is used. For example:
This will set the given preamble text for just the \setglossarypreamble
{Numbers in italic
indicate primary definitions.}
main
glossary, not for any other glossary. The glossaries-extra package additionally provides:
which locally appends to the preamble for the specific glossary and
which locally prepends to the preamble for the specific glossary.\setglossarypreamble
.
(You may prefer to use the mcolalttree style if you’re not interested in the column headers or borders.) \renewcommand
*{\glossarysection
}[2][]{%
\twocolumn
[{\chapter
*{#2}}]%
\setlength
\glsdescwidth
{0.6\linewidth
}%
\glsglossarymark
{\glossarytoctitle
}%
}
\renewcommand
*{\glossarypostamble
}{\onecolumn
}
\begin{theglossary}
\glossaryheader
\glsgroupheading
{ }\relax
\glsresetentrylist
\glossentry
{ }{ }
\subglossentry
{ }{ }{ }
% …
\glsgroupskip
\glsgroupheading
{ }\relax
\glsresetentrylist
\glossentry
{ }{ }
\subglossentry
{ }{ }{ }
% …
\end{theglossary}
\glsnonextpages
, \glsnextpages
, and the nonumberlist and savenumberlist options to work. The \glossaryentrynumbers
command is reset by:
\glossaryentrynumbers
to ignore its argument and then reset itself. This means that the next number list will be suppressed. Note that if the entry doesn’t have a number list (for example, it’s a parent entry that only appears in the glossary because it has an indexed descendent entry) then the next number list will be for the first child entry that’s been indexed. This command does nothing outside of the glossary.\glsnonextpages
or \glsnextpages
to the indexing information before \glossentry
or \subglossentry
with Options 2 and 3. With Option 1, the relevant command is put in the prenumberlist internal field, but since \printnoidxglossary
only uses \glsnoidxprenumberlist
and \glossaryentrynumbers
when the loclist field is set, it won’t affect sub-entries. \glossaryheader
, \glsgroupskip
, \glsgroupheading
, \glossentry
and \subglossentry
) are all redefined by glossary styles and are described in §13.2.9. Defining New Glossaries
\print
glossary commands.
or you can use:
which is equivalent to \newglossary
[ -glg]{ }{ -gls}{ -glo}{ }[ ]
Note that in both cases distinct file extensions are defined so these commands are still useful with Options 2 and 3.\newglossary
[ -glg]{ }{ -gls}{ -glo}{ }[ ]
\printglossaries
. To define an ignored glossary, use \newignoredglossary
where is the glossary label (as above). This glossary type will automatically be added to the nohypertypes list, since there are no hypertargets for the entries in an ignored glossary. (The sample file sample-entryfmt.tex defines an ignored glossary.)\printnoidxglossary
or \printglossary
but can be displayed with \printunsrtglossary
and \printunsrtinnerglossary
.\newignoredglossary*
that doesn’t suppress hyperlinks (since ignored glossaries can be useful with bib2gls). There is also an analogous \provideignoredglossary
command. main
(default) glossary is automatically created as:
so it can be identified by the label \newglossary
{main}{gls}{glo}{\glossaryname
}
main
(unless the nomain package option is used). If the doc package has been loaded (which uses the gls and glo extensions for the change log) then the main
glossary will instead be defined as:
If you are using a class or package that similarly requires gls and glo as file extensions, you will need to use the nomain option and define your own custom glossary, but be aware of other possible conflicts, such as different definitions of commands and environments like \newglossary
[glg2]{main}{gls2}{glo2}{\glossaryname
}
\printglossary
or theglossary.
so it can be identified by the label \newglossary
[alg]{acronym
}{acr}{acn}{\acronymname
}
acronym
. If you are not sure whether the acronym option has been used, you can identify the list of acronyms by the command:
The default definition is simply \glsdefaulttype
. The acronym or acronyms option will redefine \acronymtype
to acronym
. If you want additional glossaries for use with acronyms, remember to declare them with acronymlists.symbols
using:
The numbers package option creates a new glossary with the label \newglossary
[slg]{symbols
}{sls}{slo}{\glssymbolsgroupname
}
numbers
using:
The index package option creates a new glossary with the label \newglossary
[nlg]{numbers
}{nls}{nlo}{\glsnumbersgroupname
}
index
using: \newglossary
[ilg]{index
}{ind}{idx}{\indexname
}
\makeglossaries
to ensure that the relevant output files are opened.\glossaryname
, especially if you are using a language package. (Similarly for \glssymbolsgroupname
and \glsnumbersgroupname
.) If you want to redefine \indexname
, just follow the advice in How to change LaTeX’s “fixed names”. 10. Adding an Entry to the Glossary Without Generating Text
\index
indexing an entry without \glstext
-like commands, only it doesn’t produce any text. Therefore, there is no hyper key available in but all the other base options that can be used with the \glstext
-like commands can be passed to \glsadd
. The glossaries-extra package provides addition options, such as textformat, that aren’t applicable when there’s no link text, so they are also not available. This ensures that the given entry is listed in the glossary and that the current location is included in the entry’s number list.
Suppose I have a section about sets spanning from page 3 to page 8 with repeated use of \newglossaryentry
{set}{name={set},
description={a collection}}
on pages 3, 5, 7 and 8. This will result in the number list “3, 5, 7, 8” which is a bit untidy. It would look far more compact, and better emphasize that the section of the document from page 3 to 8 covers sets, if the number list was simply “3–8”.\gls
{set}
See §12.1 for more information about the location encap.\glsadd
[format=(
]{set}
Lots of text about sets spanning page 3 to page 8.
\glsadd
[format=)
]{set}
\glsstartrange
and \glsendrange
with glossaries-extra. You can also add a subset of entries with \glsaddeach
. \glsadd
, except there is also a key types which can be used to specify which glossaries to use. This should be a comma-separated list. For example, if you only want to add all the entries belonging to the list of acronyms (specified by the glossary type \acronymtype
) and a list of notation (specified by the glossary type notation) then you can do: \glsaddall
[types={\acronymtype
,notation}]
\glsaddall
. Instead use the selection=all resource option to select all entries in the given bib files. (You can use \glsaddeach
with bib2gls.) \glsadd
and \glsaddall
add the current location to the number list. In the case of \glsaddall
, all entries in the listed glossaries will have the same location in the number list (the location at the point in the document where \glsaddall
was used, which will be page 1 if it occurs in the preamble). If you want to use \glsaddall
, it’s best to suppress the number list with the nonumberlist package option. (See sections 2.3 and 12.) \glsadd
and \glsaddall
aren’t available here. If the optional argument is omitted, the list of all non-ignored glossaries is assumed.
for each entry in each glossary listed in the optional argument if the entry has been marked as used. Since \glsadd
[format=glsignore]{ }
\glsignore
discards its argument, this effectively creates an invisible location. This is necessary because makeindex and xindy require an associated location for each line in the indexing file. (They are indexing applications not glossary applications, so they expect page numbers.)\glsaddallunused
adds
to the number list of all the unused entries. If any of those number lists have other locations (for example, the first use flags was reset before \glsignore
{ }\glsaddallunused
or only the \glstext
-like commands were used or if any indexing occurs after \glsaddallunused
) then this will cause spurious commas or en-dashes in the number list that have been placed before or after the invisible location.\glsaddallunused
, it’s best to place the command at the end of the document to ensure that all the commands you intend to use have already been used and make sure to use the \gls
-like commands and don’t issue any resets (\glsreset
etc). \glsaddallunused
with bib2gls. However, since bib2gls was designed specifically for glossaries-extra, it recognises glsignore as a special format that indicates the location shouldn’t be added to the location list but the entry should be selected. So you can index an entry with format=glsignore to ensure that the entry is selected without adding a location to the number list.
Corresponding glossaries-extra and bib2gls document code: \documentclass
{article}
\usepackage
{glossaries}
\makeglossaries
\newglossaryentry
{cat}{name={cat},description={feline}}
\newglossaryentry
{dog}{name={dog},description={canine}}
\begin{document}
\gls
{cat}.
\printglossaries
\glsaddallunused
% <- make sure dog is also listed
\end{document}
With the file entries.bib: \documentclass
{article}
\usepackage
[record]{glossaries-extra}
\GlsXtrLoadResources
[src=entries,selection=all]
\begin{document}
\gls
{cat}.
\printunsrtglossaries
\end{document}
@entry
{cat,name={cat},description={feline}}
@entry
{dog,name={dog},description={canine}}
\glsadd
to allow for an entry that should appear both in the main
glossary and in the list of acronyms. This example sets up the list of acronyms using the acronym package option:
A new command (\usepackage
[acronym]{glossaries}
\newdualentry
) is then defined to make it easier to define dual entries:
This has the following syntax: \newcommand
*{\newdualentry
}[5][]{%
\newglossaryentry
{main-#2}{name={#4},%
text={#3\glsadd
{#2}},%
description={#5},%
#1
}%
\newacronym
{#2}{#3\glsadd
{main-#2}}{#4}%
}
You can then define a new dual entry: \newdualentry
[ ]{ }{ }{ }{ }
Now you can reference the acronym with \newdualentry
{svm}% label
{SVM}% abbreviation
{support vector machine}% long form
{Statistical pattern recognition technique}% description
or you can reference the entry in the \gls
{svm}main
glossary with
.\gls
{main-svm}\glsadd
with bib2gls. (Although it can still be useful, for example with Option 6.) 11. Cross-Referencing Entries
\makeglossaries
(Options 2 or 3) or \makenoidxglossaries
(Option 1) before defining any entries that cross-reference other entries. If any of the entries that you have cross-referenced don’t appear in the glossary, check that you have put \makeglossaries
/\makenoidxglossaries
before all entry definitions. The glossaries-extra package provides better cross-reference handling.
\gls
in the entries description. For example:
Note that with this method, if you don’t use the cross-referenced term in the main part of the document, you will need two runs of makeglossaries: \newglossaryentry
{apple}{name={apple},
description={firm, round fruit. See also \gls
{pear}}}
pdflatex filename
makeglossaries filename
pdflatex filename
makeglossaries filename
pdflatex filename
This is because the \gls
in the description won’t be detected until the glossary has been created (unless the description is used elsewhere in the document with \glsentrydesc
). Take care not to use \glsdesc
(or \Glsdesc
) in this case as it will cause a nested link.\seename
.)
where is a special form of location encap that includes and . Remember from §10 that makeindex always requires a location. This special location encap discards the provided location (which \glsadd
[format=]{ }
\glssee
sets to “Z” to push the cross-reference to the end of the number list) and replaces it with the cross-reference in the form “see ”.\glssee
indexes so that appears in the glossary but it doesn’t index any of the entries listed in .
This indexes the entry identified by the label “series” and adds a location to the “series” number list that looks something like: \glssee
[see also]{series}{FourierSeries,TaylorsTheorem}
see also
(The actual format is performed with \glsentryname
{FourierSeries} \&
\glsentryname
{TaylorsTheorem}
\glsseeformat
.)
This key was provided as a simple shortcut that does: \newglossaryentry
{MaclaurinSeries}{name={Maclaurin series},
description={Series expansion},
see={TaylorsTheorem}}
This means that “MaclaurinSeries” will automatically be added to the glossary with something like \newglossaryentry
{MaclaurinSeries}{name={Maclaurin series},
description={Series expansion}}
\glssee
{MaclaurinSeries}{TaylorsTheorem}
in its number list, but “TaylorsTheorem” will need to be indexed elsewhere to ensure that it also appears in the glossary otherwise, it would end up with the preamble location (page 1) in its number list, assuming that the entry was defined in the preamble.\emph
{see} \glsentryname
{TaylorsTheorem}
\seename
, but can be overridden in specific instances using square brackets at the start of the see value. For example:
Take care if you want to use the optional argument of commands such as \newglossaryentry
{MaclaurinSeries}{name={Maclaurin series},
description={Series expansion},
see=[see also]{TaylorsTheorem}}
\newacronym
or \newterm
as the value will need to be grouped. For example:
Similarly if the value contains a list. For example: \newterm
{seal}
\newterm
[see={[see also]seal}]{sea lion}
\glossaryentry
{lemon}
{
name={lemon},
description={Yellow citrus fruit}
}
\glossaryentry
{lime}
{
name={lime},
description={Green citrus fruit}
}
\glossaryentry
{citrus}
{
name={citrus},
description={Plant in the Rutaceae family},
see={lemon,lime}
}
\glssee
, you can automatically activate the number list using the seeautonumberlist package option.11.1. Customising Cross-Reference Text
\glssee
command, the cross-referencing information will be typeset in the glossary (within the number list) according to:
Note that the argument is always ignored. (makeindex will always assign a location number, even if it’s not needed, so it needs to be discarded.) For example, if you want the tag to appear in bold, you can do: \emph
{ } \glsseelist
{ }
\renewcommand
*{\glsseeformat
}[3][\seename
]{\textbf
{#1}
\glsseelist
{#2}}
which creates a hyperlink, if enabled, to the cross-referenced entry. The hyperlink text is given by:
This does: \glshyperlink
[\glsseeitemformat
{#1}]{#1}
which uses the text field for acronyms and the name field otherwise.\ifglshasshort
{ }
{\glsentrytext
{ }}% acronym
{\glsentryname
{ }}% non-acronym
\glssee
was first introduced in v1.17, the cross-referenced entry was displayed with just \glsentryname
, but this caused problems because back then the name field had to be sanitized because it was written to the glossary file, which caused strange results if the name contained any commands. So in v3.0, the default definition was switched to using \glsentrytext
to avoid the issue. In v3.08a, the information written to the glossary file was changed and the name was no longer sanitized, but the new definition was retained for backward-compatibility.\renewcommand
{\glsseeitemformat
}[1]{%
\textsc
{\glsentrytext
{#1}}}
\glsseeitemformat
to use \glsfmttext
for abbreviations and \glsfmtname
otherwise. Additionally, it provides \glsxtrhiername
which can be used as an alternative for hierarchical entries. See the glossaries-extra manual for further details. \glsseeformat
and \glsseelist
in the main body of the text, but they won’t automatically add the cross-referenced entries to the glossary. If you want them added with that location, you can do: Some information (see also
\glsseelist
{FourierSeries,TaylorsTheorem}%
\glsadd
{FourierSeries}\glsadd
{TaylorsTheorem}).
12. Number Lists
\glssee
(or the see key).\glsaddall
command (see §10), which is used to automatically index all entries, iterates over all defined entries (in non-ignored glossaries) and does
for each entry (where is that entry’s label). This means that \glsadd
{ }\glsaddall
automatically adds the same location to every entry’s number list, which looks weird if the number list hasn’t been suppressed.12.1. Encap Values (Location Formats)
\index
command.\bfseries
) instead of a text-block command (such as \textbf
) as the effect is not guaranteed to be localised, either within the number list or throughout the glossary.
and use that command.\newcommand
*{\textbfem
}[1]{\textbf
{\emph
{#1}}}
\textbf
or \emph
or any of the commands listed in Table 12.1.\GlsAddXdyAttribute
to identify any non-standard formats that you want to use with the format key. So if you use xindy with the above example \textbfem
, you would need to add:
See §14 for further details. \GlsAddXdyAttribute
{textbfem}
\hyperpage
(provided by the hyperref package) as the locations may not refer to a page number and the location argument may contain the range delimiter \delimR
. Instead, the glossaries package provides hyperlink-supported encaps listed in Table 12.1. These commands all use \glshypernumber
(described below) and so shouldn’t be used in other contexts.\hyper
can also be used without hyperref, since \glshypernumber
will simply do its argument if \hyperlink
hasn’t been defined. In which case, only the font change will be applied.
hyperrm
serif (
\textrm
) hyperlink hypersf
sans-serif (
\textsf
) hyperlink hypertt
monospaced (
\texttt
) hyperlink hyperbf
bold (
\textbf
) hyperlink hypermd
medium weight (
\textmd
) hyperlink hyperit
italic (
\textit
) hyperlink hypersl
slanted (
\textsl
) hyperlink hyperup
upright (
\textup
) hyperlink hypersc
small caps (
\textsc
) hyperlink hyperemph
emphasized (
\emph
) hyperlink \glshypernumber
or the appropriate \hyper
command. For example, if you want the location number to be in a bold sans-serif font, you can define a command called, say, \hyperbsf
:
and then use hyperbsf as the value for the format key.\newcommand
{\hyperbsf
}[1]{\textbf
{\hypersf
{#1}}}
\hyper
commands, make sure that the argument of \hyper
is just the location. Any formatting must be outside of \hyper
(as in the above \hyperbfsf
example). \GlsAddXdyAttribute
{hyperbsf}
\delimR
or \delimN
. (Usually \delimN
won’t occur. The \delimR
separator may occur with ranges and makeindex.) Any other markup is likely to cause a problem (see §12.5).\glshypernumber
will have a hyperlink created with:
where the is the location encapsulated with:
This just does its argument by default.\hyperlink
{ }{ }
\setentrycounter
. With Option 1 the command occurs inside the definition of \glsnoidxdisplayloc
. \glswrglossdisableanchorcmds
is also used when obtaining the prefix during indexing.
For example: \glswrglossdisableanchorcmds
hook to disable problematic commands (scoped). \glswrglosslocationtarget
{ }
will essentially do: \setentrycounter
[]{page}% page counter and empty prefix
\glshypernumber
{1}
whereas \hyperlink
{page.1}1
will essentially do: \setentrycounter
[1]{equation}%
\glshypernumber
{2}
\hyperlink
{equation.1.2}2
If hyperref is loaded the definition will also include: \let
\glstexorpdfstring
\@secondoftwo
The location is encapsulated with:
This must expand but may be used to make adjustments. The default definition is to simply expand to its argument. The \let
\texorpdfstring
\@secondoftwo
\pdfstringdefPreHook
\glswrglossdisableanchorcmds
hook may be used to alter the definition if some condition is required, but bear in mind that \glswrglosslocationtarget
won’t be used when the prefix is obtained during indexing.\setentrycounter
to set the prefix and counter is necessary because the hypertarget can’t be included in the indexing information supplied to makeindex or xindy, because neither the makeindex nor xindy syntax supports it. Unfortunately, not all definitions of \theH
can be split into a prefix and location that can be recombined in this way. This problem can occur, for example, with counter=equation when it depends on the chapter counter. This can result in warnings in the form: name{ } has been referenced but does not exist, replaced by a fixed one
The sampleEq.tex sample file deals with this issue by redefining \theHequation
as follows: \renewcommand
*\theHequation
{\theHchapter
.\arabic
{equation}}
12.2. Range Formations
\index
, the characters (
and )
can be used at the start of the format value to specify the beginning and ending of a number range. They must be in matching pairs with the same encap. For example,
on one page to start the range and later: \gls
[format=(
emph]{sample}
to close the range. This will create an explicit range in the number list that’s encapsulated with \gls
[format=)
emph]{sample}
\emph
. If the default glsnumberformat should be used, you can omit it and just have the (
and )
characters.\GlsSetXdyMinRangeLength
where the argument is either the minimum number or the keyword none, which indicates that no implicit ranges should be formed. See §14.3 for further details.
Note that if you use xindy (Option 3), you will also need to set the minimum range length to 1 if you want to change these suffixes: \glsSetSuffixF
{f.}
\glsSetSuffixFF
{ff.}
If you use the hyperref package, you will need to use \GlsSetXdyMinRangeLength
{1}
\nohyperpage
in the suffix to ensure that the hyperlinks work correctly. For example: \glsSetSuffixF
{\nohyperpage
{f.}}
\glsSetSuffixFF
{\nohyperpage
{ff.}}
\glsSetSuffixF
and \glsSetSuffixFF
must be used before \makeglossaries
and have no effect if \noist
is used. 12.3. Locations
\gls
occurred). By default, this is the page number, but can be changed with the counter package option, the optional argument in \newglossary
, the counter key in \newglossaryentry
or the counter option in the \gls
-like and \glstext
-like commands (or in \glsadd
).\arabic
), upper or lowercase Roman numerals (\Roman
or \roman
) or upper or lowercase ASCII letters (\Alph
or \alph
). The syntax also allows composite locations formed by combining the allowed digits, numerals and letters with a compositor (which can be identified with \glsSetCompositor
).
The following are invalid:
\arabic
); \Roman
); \Alph
);
”: commands not permitted in locations; \textsc
{iv}\arabic
), upper or lowercase Roman numerals (\Roman
or \roman
) or upper or lowercase ASCII letters (\Alph
or \alph
) are automatically added for the page counter.WARNING: location-reference "{ }{ }" did not match any location-class! (ignored)
As with makeindex when it encounters an invalid location, xindy will drop that location, which will result in the entry being dropped from the glossary if it has no valid locations.\
character, which is particularly problematic if any robust or protected commands are written in the location as \
will have to be written to the file as
. This is quite difficult to do without prematurely expanding \\
\thepage
.\@arabic
and \@roman
to enable this, but, like all hacks, this is problematic and liable to break in awkward situations or with future releases of the LaTeX kernel or other packages. This setting is now off by default and it’s better to use the hooks below to ensure that the content written to the file is valid.\glsdohypertarget
when it tries to create hyperlinks. \glshypernumber
creates a hyperlink) a custom definition of \glswrglosslocationtextfmt
. See §12.5 for an example.\glswrglossdisablelocationcmds
hook occurs after \protected@write
sets \thepage
to \relax
. By the time \thepage
actually gets expanded when it’s written to the indexing file, any changes made within the hook will be lost. \hyperpage
for normal indexes (with \index
), but this forms the anchor from page.
which isn’t suitable with glossaries as the location counter may not be the default page. Therefore the counter is saved within the encap. A prefix is also necessary if \theH
is defined and isn’t equivalent to \the
. \theH
expands to the equivalent of
. If \the
\theH
and \the
are equivalent then will be empty.
\glswrglossdisableanchorcmds
hook to disable problematic commands (scoped).\theH
( ) and \the
( ). If ends with , so that is , then the prefix is the substring.\thepage
may be incorrect, due to TeX’s asynchronous output routine, but it will be incorrect in both and and shouldn’t occur in the prefix (unless you have an unusual numbering system that’s reset on every page, in which case you may have other problems), so it shouldn’t affect the prefix formation. When the actual write operation occurs, \thepage
should then expand correctly.
\theH
will expand in the form
. In which case a warning will occur: \the
Hyper target ` ' can't be formed by prefixing
location ` '. You need to modify the definition of
If you need the location hyperlink, you will either have to redefine \theH
otherwise you will get the warning: "`name{ . }' has been
referenced but does not exist"
\theH
or switch to Option 4 and record=nameref.12.4. Page Precedence
rnaRA
, which indicates: lowercase Roman (\roman
), numeric (\arabic
), lowercase alphabetic (\alph
), uppercase Roman (\Roman
), and uppercase alphabetic (\Alph
). This order can be changed by adding the page_precedence
parameter to the ist file. There’s no specific command provided for this, so you will need to use the \GlsSetWriteIstHook
to add this. For example: \GlsSetWriteIstHook
{%
\write
\glswrite
{page_precedence "arnAR"}%
}
define-location-class-order
within the xdy style file. This order can either be changed in a custom xdy file or can be set with \GlsSetXdyLocationClassOrder
.12.5. Problematic Locations
\thepage
. Due to TeX’s asynchronous output routine, \thepage
may be incorrect at the start of a new page. To ensure that the page number is correct, a delayed write is needed, which is what is usually done when writing information to the aux and toc files (and to indexing files).\theH
as appropriate.\thepart
is normally formatted as an uppercase Roman numeral. There’s no Roman numeral for 0 so if the part counter is 0 (that is, before the first \part
) then \thepart
will expand to nothing. This can be demonstrated in the following document:
In the above, the first instance of \documentclass
{article}
\usepackage
[counter=part]{glossaries}
\makeglossaries
\newglossaryentry
{sample}{name={sample},description={}}
\begin{document}
\gls
{sample}% part = 0
\part
{Sample Part}
\section
{Sample Section}
\gls
{sample}.
\printglossaries
\end{document}
will have an empty location. This will cause makeindex to reject the location with the following message in the transcript (assuming the document file is called myDoc.tex): \gls
{sample}!! Input index error (file = myDoc.glo, line = 1):
-- Illegal page number or page_precedence rnaRA.
If makeglossaries encounters this warning, it will replace the empty location with “0” and change the location encap to glsignore. In the above example, this will lead to an invisible location in the number list, but that’s exactly what an empty location would do if makeindex allowed it.
This will cause makeindex to reject the location with the following message in the transcript: \documentclass
{article}
\usepackage
[counter=section]{glossaries}
\makeglossaries
\newglossaryentry
{sample}{name={sample},description={}}
% default compositor is '.' not '-'
\renewcommand
{\thesection
}{\thepart
-\arabic
{section}}
\begin{document}
\part
{Sample Part}
\section
{Sample Section}
\gls
{sample}.
\printglossaries
\end{document}
!! Input index error (file = myDoc.glo, line = 1):
-- Illegal Roman number: position 2 in I-1.
If makeglossaries encounters this warning, it will replace any invalid content (the hyphen, in this case) with the page compositor specified in the ist file.\glsSetCompositor
to set the correct compositor. In the case of empty locations you will need to chose a different location counter.\es@scroman
, as in the following:
The first instance of \documentclass
{book}
\usepackage
[T1]{fontenc}
\usepackage
[spanish]{babel}
\usepackage
{glossaries}
\makeglossaries
\newglossaryentry
{sample}{name={sample},description={un ejemplo}}
\begin{document}
\frontmatter
\chapter
{Foreword}
\gls
{sample}% problem location
\mainmatter
\chapter
{Sample}
\gls
{sample}
\printglossaries
\end{document}
\gls
occurs in the front matter on page i, which in this case is formatted in faked small caps with \es@scroman
. This can be found in the glo file, which contains:
Each line in the glo file corresponds to a single indexing instance (created with \glossaryentry
{sample?\glossentry
{sample}|setentrycounter[]{page}"
\glsnumberformat
}{\es@scroman
{i}}
\glossaryentry
{sample?\glossentry
{sample}|setentrycounter[]{page}"
\glsnumberformat
}{1}
\gls
in this case)."
) is makeindex’s escape character (which can be changed with \GlsSetQuote
). It’s not necessary in the above but was added as a by-product of the internal escaping of special characters (the backslash isn’t a special character for makeindex, except in the ist file, but is for xindy).\indexentry
. The custom ist style file created by \makeglossaries
identifies \glossaryentry
as the keyword: keyword "\\glossaryentry"
or for sub-entries: ?
|
The question mark (?
!
?
|
?
) is the “actual character” and separates the sort value from the actual text that’s written to the gls file (which is input by \printglossary
).@
as the actual character but this caused a problem for early versions of glossaries where there was a greater chance of internal commands occurring in the glo file. The custom ist file identifies ?
as the actual character: actual '?'
\index
, but as can be seen from the above example, that’s not strictly speaking true. The real encap has to include \setentrycounter
so that (if hyperlinks are supported) the appropriate target name can be constructed.
in the gls (or equivalent) file. What glossaries actually needs for the hyperlinks to work is: \
{ }
where is the real formatting command name (identified in the format option).\setentrycounter
[ ]{ }\
{ }
setentrycounter[]{page}
\glsnumberformat
which is invalid, as makeindex requires the location to consist solely of digits, Roman numerals or alphabetic, optionally separated by a compositors.\es@scroman
{i}Scanning input file myDoc.glo...
!! Input index error (file = myDoc.glo, line = 1):
-- Illegal space within numerals in second argument.
.done (1 entries accepted, 1 rejected).
Sorting entries...done (0 comparisons).
Generating output file myDoc.gls....done (6 lines written, 0 warnings).
Note that 1 entry has been rejected, but it also shows 0 warnings and it has a 0 exit code, which means that it won’t interrupt the overall document build.\
{ }
(with any or no spaces after the command name and optionally preceded by \protect
). If it finds a match, it will shift into the encap with the following message: Encap/location issue: potential LaTeX commands in location detected. Attempting to remedy.
Reading myDoc.glo...
Invalid location '
The altered glo file now contains: \es@scroman
{i}' detected for entry 'sample'. Replaced with 'i'
Writing myDoc.glo...
Retrying
and makeglossaries will re-run makeindex.\glossaryentry
{sample?\glossentry
{sample}|setentrycounter[]{page}"
\glslocationcstoencap
{glsnumberformat}{es@scroman}}{i}
\glossaryentry
{sample?\glossentry
{sample}|setentrycounter[]{page}"
\glsnumberformat
}{1}
The corrected location needs to be encapsulated with both the designated encap (glsnumberformat in this case) and the formatting command that needs to be applied to the location. This is done via:
This is simply defined to do: \setentrycounter
[]{page}\glslocationcstoencap
{glsnumberformat}{es@scroman}{i}\delimN
\setentrycounter
[]{page}\glsnumberformat
{1}
This puts the intended encap (glsnumberformat in this case) closer to the location to enable it to work better with hyperlinks, although this may not always work, particularly if the command with the name expects a numerical argument.\csuse
{ }{\csuse
{ }{ }}
\es@scroman
which is provided by babel-spanish and performs fake small caps. Internal commands provided by other packages for their own private use can’t be relied upon. So the glossaries package can’t assume they will stay the same, and the above example document may produce a different result with different versions of babel. However, in this case (provided you use makeglossaries), the document will correctly end up with the number list “i, 1” for the “sample” entry in the glossary, which matches the document page numbering. If you use makeindex explicitly, the number list will simply be “1”.\glsnumberformat
uses \glshypernumber
, which needs to take into account that its argument may contain a range with the start and end location separated by \delimR
(the range delimiter), and it needs to create a separate hyperlink for each location component.
This again has problematic locations, but makeglossaries can shift the \documentclass
{book}
\usepackage
[T1]{fontenc}
\usepackage
[spanish]{babel}
\usepackage
[colorlinks]{hyperref}
\usepackage
{glossaries}
\makeglossaries
\newglossaryentry
{sample}{name={sample},description={un ejemplo}}
\begin{document}
\frontmatter
\chapter
{Foreword}
\gls
{sample}
\newpage
\gls
{sample}
\newpage
\gls
{sample}
\mainmatter
\chapter
{Sample}
\gls
[format=(
hyperbf]{sample}
\newpage
Some text
\newpage
\gls
[format=)
hyperbf]{sample}
\printglossaries
\end{document}
\es@scroman
into the encap as before. The resulting gls file has the following number list for the “sample” entry:
Both ranges have been compacted so that the range, including the \setentrycounter
[]{page}% prefix and counter
\glslocationcstoencap
{glsnumberformat}{es@scroman}{i\delimR
iii}\delimN
\setentrycounter
[]{page}% prefix and counter
\hyperbf
{1\delimR
3}
\delimR
separator, is in the argument of the encap command.\glslocationcstoencap
means that the first range is formatted according to:
This allows \es@scroman
{\glshypernumber
{i\delimR
iii}}
\glshypernumber
to detect the delimiter and split up the range so that it can apply a separate hyperlink to the start and end locations, so that it effectively becomes:
In this type of situation, the most problematic document is one where the can’t handle \es@scroman
{\hyperlink
{ }{i}\delimR
\hyperlink
{ }{iii}}
\hyperlink
in its argument and needs to be shifted into the hyperlink text. In the above example document, no actual error occurs, but there are warnings from pdfTeX: pdfTeX warning (dest): name{page.iii} has been referenced but does not exist, replaced by a fixed one
[...]
pdfTeX warning (dest): name{page.i} has been referenced but does not exist, replaced by a fixed one
This is due to the way that \glshypernumber
forms the target name. Since the actual target name isn’t saved in the indexing data, it has to be reconstituted from available information: the prefix, the counter and the location. So the targets become page.i
for location “i” and page.iii
for location “iii”. This usually works for common page formats, but it doesn’t in this case. Adding debug to hyperref’s package options reveals the following information in the transcript: Package hyperref Info: Anchor `page.I'
[...]
Package hyperref Info: Anchor `page.II'
So the correct anchors are “page.I” and “page.II”.\es@scroman
is outside of \glshypernumber
, the case change isn’t part of the location and so doesn’t affect the anchor name.\glslocationcstoencap
to swap them around:
However, now the transcript shows: \renewcommand
{\glslocationcstoencap
}[3]{\csuse
{#1}{\csuse
{#2}{#3}}}
pdfTeX warning (dest): name{page.\\protect\040\\es@scroman\040\040{i--iii}} has been referenced but does not exist, replaced by a fixed one
This is because \es@scroman
doesn’t fully expand.\glswrglossdisableanchorcmds
hook provides a workaround for the problematic command:
This will cause \appto
\glswrglossdisableanchorcmds
{\csletcs
{es@scroman}{text_uppercase:n}}
\es@scroman
to be locally redefined to just convert its argument to uppercase while the anchor is being constructed. Unfortunately this patch is only partially successful as the transcript now has: pdfTeX warning (dest): name{page.I-- III} has been referenced but does not exist, replaced by a fixed one
The problem now is that \glshypernumber
can’t split on the range delimiter, so the location is now “I--III”.\glslocationcstoencap
and the addition to \glswrglossdisableanchorcmds
will fix the hyperlink.\glslocationcstoencap
and altering \glswrglossdisableanchorcmds
, a solution that works with ranges can be achieved by redefining \glswrglosslocationtarget
to convert its argument to uppercase. You can do this with: \renewcommand
{\glswrglosslocationtarget
}[1]{\glsuppercase
{#1}}
page.I
and page.III
. It won’t affect the anchors for the main matter as digits aren’t affected by the case-changing command.\thepage
since its delayed expansion means that any attempt at locally changing the problematic within \glswrglossdisablelocationcmds
will be lost.
Note that the custom \documentclass
{book}
\usepackage
[T1]{fontenc}
\usepackage
[spanish]{babel}
\usepackage
[colorlinks]{hyperref}
\usepackage
{glossaries}
\makeglossaries
\newglossaryentry
{sample}{name={sample},description={un ejemplo}}
\newcommand
{\locthepage
}{\Roman
{page}}
\newcommand
{\delayedlocthepage
}{\expandonce
{\locthepage
}}
\appto
\glswrglossdisablelocationcmds
{\let
\thepage
\delayedlocthepage
}
\begin{document}
\frontmatter
\chapter
{Foreword}
\gls
{sample}
\newpage
\gls
{sample}
\newpage
\gls
{sample}
\mainmatter
\renewcommand
{\locthepage
}{\arabic
{page}}
\chapter
{Sample}
\gls
[format=(
hyperbf]{sample}
\newpage
Some text
\newpage
\gls
[format=)
hyperbf]{sample}
\printglossaries
\end{document}
\locthepage
command needs to be redefined after the page numbering changes at the start of the main matter.\
is a special character for xindy that indicates an escape sequence that indicates the next character should be interpreted literally, which means that any LaTeX commands that end up in the xindy indexing file must have their initial backslash escaped. This is quite tricky to do given the delayed expansion of \thepage
. If it’s expanded early in order to pre-process it then the page number could end up being incorrect.\tallynum
, which ends up in the glo file. With the default esclocations=false setting, the location for the first page is written to the file as: :locref "{}{
This results in the following message from xindy: \tallynum
{1}}"
WARNING: location-reference "{}{tallynum {1}}" did not match any location-class! (ignored)
Note that the backslash has gone from the start of tallynum
. As with makeindex, invalid locations are dropped.You may have forgotten to add a location
class with
In this case, you need to use the package option esclocations=true. This will use a hack to provide a way to escape the backslash without prematurely expanding the actual value of the page counter. As this is a hack, it may not work and can result in obscure error messages.\GlsAddXdyLocation
or you may have
the format incorrect or you may need
the package option esclocations=true.
The glo file now contains locations with \documentclass
{book}
\usepackage
[T1]{fontenc}
\usepackage
[spanish]{babel}
\usepackage
[colorlinks]{hyperref}
\usepackage
[xindy]{glossaries}
\makeglossaries
\newglossaryentry
{sample}{name={sample},description={un ejemplo}}
\begin{document}
\frontmatter
\chapter
{Foreword}
\gls
{sample}
\newpage
\gls
{sample}
\newpage
\gls
{sample}
\mainmatter
\chapter
{Sample}
\gls
[format=(
hyperbf]{sample}
\newpage
Some text
\newpage
\gls
[format=)
hyperbf]{sample}
\printglossaries
\end{document}
\es@scroman
, but as with the \tallynum
example, the leading backslash hasn’t been escaped: :locref "{}{
This needs esclocations=true to escape the backslash. \es@scroman
{i}}"
Note that this produces a different result in the glo file: \usepackage
[xindy,esclocations]{glossaries}
:locref "{}{\\protect \\es@scroman {i}}"
This results from the partial protected expansion used on \thepage
before the special characters are escaped. If you inspect the xdy file created by \makeglossaries
, you should find the following: (define-location-class "roman-page-numbers"
( :sep "{}{" :sep "
This is because the non-default behaviour of \protect
\es@scroman
{" "roman-numbers-lowercase" :sep "}" :sep "}" )
:min-range-length 2
)
\roman
has been detected and a custom location class has automatically been supplied. (Whereas with the samplexdy.tex sample file, it was necessary to provide the custom class to support \tallynum
with \GlsAddXdyLocation
.)12.6. Iterating Over Locations
\printnoidxglossary
command displays the location list using: \forlistloop
to iterate over all the locations in the list with the handler macro:
This keeps track of the previous element in the list to determine whether or not to insert the \delimN
separator. Note that it doesn’t attempt to determine whether or not any of the locations are ranges.\printunsrtglossary
command will also use \glsnoidxloclist
if the loclist field has been set but the location field hasn’t, but in general it’s better to instruct bib2gls to save the formatted location list (which is the default). where { }{ }{ }{ }
is the hypertarget prefix, is the name of the location counter, is the location encap (for example, textbf) and is the location.
where [ ]{ }{ }
is the cross-referenced textual tag (for example, “see”) and is a comma-separated list of entry labels. The final argument will always be empty, but it allows for
\glsseeformat
to be used as the handler.
and on page 18 I have: \gls
[format=textbf]{apple}
then \gls
[format=emph]{apple}
will be equivalent to: \glsnumberlistloop
{apple}{\myhandler
}
There is a predefined handler that’s used to display the number list in \myhandler
{}{page}{textbf}{12}%
\myhandler
{}{page}{emph}{18}%
\printnoidxglossary
:
This simply does:
which sets up the hyperlink information needed for \setentrycounter
[ ]{ }%
\csuse
{ }{ }
\glshypernumber
(in case it’s required by the encap) and encapsulates the location, with the provided formatting command.\glsnumberlistloop
uses etoolbox’s \forlistloop
with the handler:
The \glsnoidxdisplayloc
{ }{ }{ }{ }
\glsnumberlistloop
works by temporarily redefining \glsnoidxdisplayloc
to and \glsseeformat
to .\glsxtrfieldforlistloop
and provide your own handler that can be customized to suit record=only or record=nameref. 13. Glossary Styles
\glossentryname
to display the entry’s name, but some may use the sentence case version \Glossentryname
instead. Both encapsulate the name with: \glsentryname
or \Glsentryname
).\glsnamefont
simply displays its argument in whatever the surrounding font happens to be, but bear in mind that the glossary style may switch the font.\glossentryname
only, case-changing.
which is essentially (ignoring the hyperlink target): \glstreenamefmt
{\glstarget
{ }{\glossentryname
{ }}}
Since \glstreenamefmt
{\glsnamefont
{\glsentryname
{ }}}
\glstreenamefmt
is defined to display its argument in bold, the name will end up in bold unless \glsnamefont
is redefined to change it.\item
:
which is essentially (ignoring the entry counter and hyperlink target): \item
[\glsentryitem
{ }\glstarget
{ }{\glossentryname
{ }}]
This occurs within the description environment, which by default uses bold for the item text. However, this may be changed by various classes or packages. So the name may end up in bold or may be in some other font, such as sans-serif.\item
[\glsnamefont
{\glsentryname
{ }}]
So the only font change will come from \glsentryitem
{ }\glstarget
{ }{\glossentryname
{ }} &
\glsnamefont
, which doesn’t apply any change by default.\glossentrydesc
but may not show the symbol. If the symbol is shown, it should be displayed with \glossentrysymbol
.\glstreenamefmt
) to make it easier to adjust the formatting without having to define a new glossary style.\renewcommand
{\glsnamefont
}[1]{\textsc
{\mdseries
#1}}
\glsgetgrouptitle
, which will test if \
groupname exists where the is glssymbols
, glsnumbers
or a single character.\glsxtrsetgrouptitle
and \glsxtrlocalsetgrouptitle
to set the group title, which take precedence over \
groupname. 13.1. Predefined Styles
\glsgetgrouptitle
{label}, which is described in §13.2.
long3col*
matches long3col, long3colheader, long3colborder and long3colheaderborder). A maximum level of 0 indicates a flat glossary (sub-entries are displayed in the same way as main entries). Where the maximum level is given as ∞ there is no limit, but note that makeindex (Option 2) imposes a limit of 2 sub-levels. If the homograph column is checked, then the name is not displayed for sub-entries. If the symbol column is checked, then the symbol will be displayed.Style
Maximum Level
Homograph
Symbol
listdotted
0
sublistdotted
1
list*
1
✔
altlist*
1
✔
long*3col*
1
✔
long4col*
1
✔
✔
altlong*4col*
1
✔
✔
long*
1
✔
super*3col*
1
✔
super4col*
1
✔
✔
altsuper*4col*
1
✔
✔
super*
1
✔
*index*
2
✔
treenoname*
∞
✔
✔
*alttree*
∞
✔
*tree*
∞
✔
inline
1
✔
\setlength
if the glossary is too wide. Note that the long4col and super4col styles (and their header and border variations) don’t use these lengths as they are designed for single line entries. Instead you should use the analogous altlong4col and altsuper4col styles. If you need to explicitly create a line-break within a multi-line description in a tabular-like style it’s better to use \newline
instead of \\
(but consider using a ragged style with narrow columns).\print
glossary, it will override any previous style settings for the given glossary, so if, for example, you do
then the new definition of \renewcommand
*{\glsgroupskip
}{}% no effect
\printglossary
[style=long]
\glsgroupskip
will not have an affect for this glossary, as \glsgroupskip
is redefined by style=long. Likewise, \setglossarystyle
will also override any previous style definitions, so, again
will reset \renewcommand
*{\glsgroupskip
}% no effect
\setglossarystyle
{long}
\glsgroupskip
back to its default definition for the named glossary style (long in this case). If you want to modify the styles, either use \newglossarystyle
(described in the next section) or make the modifications after \setglossarystyle
. For example:
In this case, it’s better to use nogroupskip to suppress the gap between groups for the default styles instead of redefining \setglossarystyle
{long}
\renewcommand
*{\glsgroupskip
}{}
\glsgroupskip
.\glspostdescription
before the glossary is displayed. Alternatively, you can suppress it for a given entry by placing \nopostdesc
in the entry’s description. Note that \longnewglossaryentry
puts \nopostdesc
at the end of the description. The glossaries-extra package provides a starred version that doesn’t.13.1.1. List Styles
This patch should ensure that the combination of hyperref and entrycounter will correctly expand the entry name to the aux file. The name is expanded using:
This uses \GetTitleStringSetup
{expand}
\glsunexpandedfieldvalue
. If you need the name to fully expand, you can redefine this. For example: \newcommand
{\glslistexpandedname
}[1]{\glsentryname
{#1}}
\glsgroupskip
command creates a vertical space using: \item
so may appear bold from the item font change.\item
, which can cause a problem if the navigation line is too long, in which case you will need to redefine \glslistnavigationitem
. For example:
You may prefer to use the tree-like styles, such as treehypergroup instead.\renewcommand
*{\glslistnavigationitem
}[1]{\item
\textbf
{#1}}
\item
command (so it will usually appear in bold by default). The description follows, and then the associated number list for that entry. The symbol is ignored. If the entry has child entries, the description and number list follows (but not the name) for each child entry. Groups are separated using \indexspace
with the default nogroupskip=true.\glsgetgrouptitle
, which is described in §13.2.\glslistnavigationitem
. This requires an additional run through LaTeX to ensure the group information is up to date. Within the navigation line, each group item is separated by \glshypernavsep
.\renewcommand
{\glstreepredesc
}{%
\glstreeitem
\parindent
\hangindent
}
, followed by the name followed by a dotted line, followed by the description. Note that this style ignores both the number list and the symbol. The length
governs where the description should start. This is a flat style, so child entries are formatted in the same way as the parent entries.\item
[]
Note that this doesn’t use \renewcommand
{\glstreepredesc
}{\dotfill
}
\renewcommand
{\glstreechildpredesc
}{\dotfill
}
\glslistdottedwidth
and causes the description to be flush-right and will display the symbol, if provided. (It also doesn’t suppress the number list, but that can be achieved with the nonumberlist option.)13.1.2. Longtable Styles
Both may be combined in the same option list. For example: \usepackage
[nogroupskip]{glossaries}
\setglossarystyle
{long}
Or \usepackage
[nogroupskip,style=long]{glossaries}
The following doesn’t work: \printglossary
[nogroupskip,style=longragged]
This is because the \setglossarystyle
{long}
\printglossary
[nogroupskip]% too late
\ifglsnogroupskip
conditional needs to be outside of \glsgroupskip
with tabular-like styles, so the conditional is in the style definition to determine the appropriate definition of \glsgroupskip
.\glsdescwidth
. Child entries have a similar format to the parent entries except that their name is suppressed.\glsdescwidth
, and the width of the third column is governed by the length \glspagelistwidth
.\glsdescwidth
and the width of the number list column is governed by the length \glspagelistwidth
. The widths of the name and symbol columns are governed by the widest entry in the given column.13.1.3. Longtable Styles (Ragged Right)
\usepackage
{glossary-longragged}\usepackage
[stylemods=longragged]{glossaries-extra}
Note that you can’t set these styles using the style package option since the styles aren’t defined until after the glossaries package has been loaded. If you want to incorporate rules from the booktabs package, try the styles described in §13.1.4.\usepackage
{glossaries}
\usepackage
{glossary-longragged}
\setglossarystyle
{longragged3col}
\usepackage
[style=longragged3col,stylemods=longragged]{glossaries-extra}
Or \usepackage
[nogroupskip]{glossaries}
\usepackage
{glossary-longragged}
\setglossarystyle
{longragged}
\printglossary
[nogroupskip,style=longragged]
\glsdescwidth
. Child entries have a similar format to the parent entries except that their name is suppressed.\glsdescwidth
, and the width of the third column is governed by the length \glspagelistwidth
.\glsdescwidth
and the width of the number list column is governed by the length \glspagelistwidth
. The widths of the name and symbol columns are governed by the widest entry in the given column.13.1.4. Longtable Styles (booktabs)
\usepackage
{glossary-longbooktabs}\usepackage
[stylemods=longbooktabs]{glossaries-extra}
Note that you can’t set these styles using the style package option since the styles aren’t defined until after the glossaries package has been loaded.\usepackage
{glossaries}
\usepackage
{glossary-longbooktabs}
\usepackage
[style=long3col-booktabs,stylemods=longbooktabs]{glossaries-extra}
Or \usepackage
[nogroupskip]{glossaries}
\usepackage
{glossary-longbooktabs}
\setglossarystyle
{long-booktabs}
\printglossary
[nogroupskip,style=long-booktabs]
\toprule
, \midrule
and \bottomrule
. Additionally these styles patch the longtable environment to check for instances of the group skip occurring at a page break. If you don’t want this patch to affect any other use of longtable in your document, you can scope the effect by only setting the style through the style key in the optional argument of \print
glossary.\ifnum
\outputpenalty
=-50\vskip
-\normalbaselineskip
\relax
\fi
\glsgroupskip
will be defined to use: \noalign
{\penalty
-50\vskip
\normalbaselineskip
}
\toprule
and \midrule
) and inserts a rule at the bottom of the table (\bottomrule
).13.1.5. Supertabular Styles
Or \usepackage
[nogroupskip]{glossaries}
\setglossarystyle
{super}
Or \usepackage
[nogroupskip,style=super]{glossaries}
\printglossary
[nogroupskip,style=super]
\glsdescwidth
. Child entries have a similar format to the parent entries except that their name is suppressed.\glsdescwidth
. The width of the third column is governed by the length \glspagelistwidth
.\glsdescwidth
and the width of the number list column is governed by the length \glspagelistwidth
. The width of the name and symbol columns is governed by the widest entry in the given column.13.1.6. Supertabular Styles (Ragged Right)
\usepackage
{glossary-superragged}\usepackage
[stylemods=superragged]{glossaries-extra}
Note that you can’t set these styles using the style package option since the styles aren’t defined until after the glossaries package has been loaded.\usepackage
{glossaries}
\usepackage
{glossary-superragged}
\usepackage
[style=superragged3col,stylemods=superragged]{glossaries-extra}
Or \usepackage
[nogroupskip]{glossaries}
\usepackage
{glossary-superragged}
\setglossarystyle
{superragged}
\printglossary
[nogroupskip,style=superragged]
\glsdescwidth
. Child entries have a similar format to the parent entries except that their name is suppressed.\glsdescwidth
. The width of the third column is governed by the length \glspagelistwidth
.13.1.7. Tree-Like Styles
, but note that will include \textbf
{ }\glsnamefont
so the bold setting in \glstreenamefmt
may be counteracted by another font change in \glsnamefont
(or in \acronymfont
). The tree-like styles that also display the header use
to format the heading. This defaults to
. The tree-like styles that display navigation links to the groups (such as indexhypergroup), format the navigation line using
which defaults to \glstreenamefmt
{ }
. \glstreenamefmt
{ }\glslistnavigationitem
, provided with the styles such as listhypergroup, as that also includes \item
.\space
.\space
.\indexspace
.
at the start of the theglossary environment for backward compatibility.\let
\item
\glstreeitem
\let
\subitem
\glstreesubitem
\let
\subsubitem
\glstreesubsubitem
\renewcommand
{\glstreeitem
}{%
\parindent
0pt\par
\hangindent
40pt
\everypar
{\parindent
50pt\hangindent
40pt}}
\glsgetgrouptitle
.\glstreenavigationfmt
.\setlength
.\glstreenavigationfmt
.\glstreenavigationfmt
.\glssetwidest
hasn’t been used for a given sub-level, the level 0 widest text is used instead. If is omitted, 0 is assumed.
Alternatively, to compute the widest entry for each glossary before it’s displayed: \glsfindwidesttoplevelname
\setglossarystyle
{alttree}
\printglossaries
\renewcommand
{\glossarypreamble
}{%
\glsfindwidesttoplevelname
[\currentglossary
]}
\setglossarystyle
{alttree}
\printglossaries
\glssetwidest
command also affects the styles provided by glossary-topic. The glossaries-extra-stylemods package provides additional commands. With bib2gls, you may prefer the set-widest resource option. \makebox
, created with: \renewcommand
*{\glstreenamebox
}[2]{%
\makebox
[#1][r]{#2}%
}
13.1.8. Multicols Style
\glstreenamefmt
, \glstreegroupheaderfmt
and \glstreenavigationfmt
are all used by the corresponding glossary-mcols styles.
Note that you can’t set these styles using the style package option since the styles aren’t defined until after the glossaries package has been loaded.\usepackage
{glossaries}
\usepackage
{glossary-mcols}
\usepackage
[style=mcolindex,stylemods=mcols]{glossaries-extra}
\usepackage
{glossary-mcols}
\renewcommand
*{\glsmcols
}{3}
\setglossarystyle
{mcolindex}
glossary-mcols Style
Analogous Tree Style
mcolindex
index
mcolindexgroup
indexgroup
mcolindexhypergroup or mcolindexspannav
indexhypergroup
mcoltree
tree
mcoltreegroup
treegroup
mcoltreehypergroup or mcoltreespannav
treehypergroup
mcoltreenoname
treenoname
mcoltreenonamegroup
treenonamegroup
mcoltreenonamehypergroup or mcoltreenonamespannav
treenonamehypergroup
mcolalttree
alttree
mcolalttreegroup
alttreegroup
mcolalttreehypergroup or mcolalttreespannav
alttreehypergroup
13.1.9. In-Line Style
\usepackage
{glossary-inline}\usepackage
[stylemods=inline]{glossaries-extra}\usepackage
{glossaries}
\usepackage
{glossary-inline}
\usepackage
[style=inline,stylemods=inline]{glossaries-extra}
\glossarysection
with this style. For example, suppose you are required to have your glossaries and list of acronyms in a footnote, you can do:
Then where you need to include your glossaries as a footnote you can do: \usepackage
{glossary-inline}
\renewcommand
*{\glossarysection
}[2][]{\textbf
{#1}: }
\setglossarystyle
{inline}
\footnote
{\printglossaries
}
\glsgroupskip
is defined to do nothing, regardless of the nogroupskip option. Likewise, \glsgroupheading
is defined to do nothing. If you want to create a custom style base on the inline style that shows a heading, then add \glsinlinedopostchild
to the definition of \glsgroupheading
in case a group heading follows a child entry.\glsinlinedopostchild
. It’s provided as a user command to make it easier to add it to the start of a custom definition of \glossaryheader
to enable group headings. If you need to adjust the content between a sub-entry and the next entry, redefine \glsinlinepostchild
instead.
This is the only place that the post-description hook is used in this style.\glspostdescription
\space
and is the entry’s label. The default definition is: \glossentryname
{ }\glstarget
{ }{ }
\renewcommand
*{\glsinlinenameformat
}[2]{\glstarget
{#1}{\textsc
{#2}}}
\ifglshaschildren
, which is inefficient as it has to iterate through all entries (in the same glossary as ) to determine which ones have the given entry as a parent. This can be time-consuming for large glossaries, but the assumption here is that an inline glossary is unlikely to be used with a large set of entries. However, if you are using bib2gls with the save-child-count resource option, it’s more efficient to use \GlsXtrIfHasNonZeroChildCount
instead (particularly if you are using \printunsrtglossary
with a filtered subset). For example: \renewcommand
{\glsinlineifhaschildren
}[3]{%
\GlsXtrIfHasNonZeroChildCount
{ }{#2}{#3}%
}
\glsinlinenameformat
but a different definition:
which means that the sub-entry name is ignored.\glstarget
{ }{}
\ifglshasdesc
and \ifglsdescsuppressed
, respectively) then:
so the symbol and location list are ignored.\space
\renewcommand
*{\glsinlinedescformat
}[3]{: #1}
13.2. Defining your own glossary style
\printglossary
are designed to produce content in the PDF. If your intention is to design a style that doesn’t print any content (for example, to simply capture information) then you are likely to experience unwanted side-effects. If you just want to capture indexing information (such as locations) then a much better approach is to use bib2gls, which automatically stores this information in dedicated fields when the entry is defined. If you still really want to use a style to capture information obtained from makeindex or xindy then simply \input
the indexing file instead of using \printglossary
. \setglossarystyle
). An existing style can be redefined with:
In both cases, the second argument needs to redefine all of the commands listed in §13.2.3.\setglossarystyle
and then just redefine the commands that are different from the inherited style.\glsgroupheading
, so the style is simply defined as: \newglossarystyle
{indexgroup}{%
\setglossarystyle
{index}% inherit index
% alter the command that's different:
\renewcommand
*{\glsgroupheading
}[1]{%
\item
\glstreegroupheaderfmt
{\glsgetgrouptitle
{##
1}}%
\indexspace
}%
}
13.2.1. Commands For Use in Glossary Styles
\glsentryitem
will do:
otherwise it will do \glsstepentry
{ }\glsentrycounterlabel
\glsresetsubentrycounter
(which ensures the sub-entry counter is reset if it has been enabled with subentrycounter).\glossentry
as follows: \renewcommand
*{\glossentry
}[2]{%
\item
[\glsentryitem
{##
1}%
\glstarget
{##
1}{\glossentryname
{##
1}}]
\glossentrydesc
{##
1}\glspostdescription
\space
##
2}
otherwise it does nothing. This will typically only be used with level 1 and omitted for deeper hierarchical levels.\glsstepsubentry
{ }\glssubentrycounterlabel
The test for level 0 is redundant in this case as \renewcommand
{\subglossentry
}[3]{%
\ifcase
##
1 % level 0
\item
\or
% level 1
\subitem
\glssubentryitem
{##
2}%
\else
% all other levels
\subsubitem
\fi
\glstreenamefmt
{\glstarget
{##
2}{\glossentryname
{##
2}}}%
\ifglshassymbol
{##
2}{\space
(\glossentrysymbol
{##
2})}{}%
\glstreechildpredesc
\glossentrydesc
{##
2}\glspostdescription
\space
##
3%
}
\glossentry
will be used for top level (level 0) entries, but is provided for completeness. Note that \glssubentryitem
is only used for level 1.\gls
) to the entry line in the glossary.\glsnamefont
. Unlike \glsentryname
, this command will trigger a warning if the entry hasn’t been defined. The sentence case version is:
Both commands internally use \glsnamefont
so there’s no need to explicitly use that command in a style.\glossentryname
, case-changing. If you just use \glsentryname
, the style won’t be influenced by those attributes. \glsentrydesc
, this command will trigger a warning if the entry hasn’t been defined. The sentence case version is:
\glossentrydesc
, case-changing. If you just use \glsentrydesc
, the style won’t be influenced by those attributes. \glsentrysymbol
, this command will trigger a warning if the entry hasn’t been defined. The sentence case version is:
\glsentrysymbol
, the style won’t be influenced by that attribute.
glsnumbers
or glssymbols
and the command \
exists, then that command is used as the title. groupname\glsgetgrouptitle
to accommodate the enhanced features. 13.2.3. Glossary Style Commands
\setglossarystyle
and then only redefine the commands that should differ from the inherited style.\print
glossary sets \currentglossary
to the current glossary label, so it’s possible to create a glossary style that varies according to the glossary type, but this will generally limit its usefulness.
Immediately after \renewenvironment
{theglossary}%
{\glslistinit
\begin{description}
}{\end{description}
}
comes the header:
For example, the longheader style has: \begin{theglossary}
(Note that this is not the same as the preamble which occurs before the start of the theglossary environment and is not part of the style.)\renewcommand
*{\glossaryheader
}{%
\bfseries
\entryname
&
\bfseries
\descriptionname
\tabularnewline
\endhead
}
\glssubgroupheading
to support sub-groups, which are only available with Options 4 and 5. Glossary styles should only include a redefinition of \glssubgroupheading
if the style is specifically designed for use with glossaries-extra as the command won’t be available with just the base glossaries package. (A default definition will be provided if this command isn’t set with glossaries-extra.) \relax
, or may contain the number list encapsulated with \glossaryentrynumbers
, possibly prefixed with a pre-number list hook. If is an unbraced \relax
, that typically indicates that Options 2 or 3 were used and the entry was a parent that wasn’t indexed but has been included because it has an indexed child entry. An empty argument is more likely to be a result of Options 1, 4 or 5, in which case nothing can be inferred about whether or not the entry was actually indexed.\glossentry
. Some glossary styles redefine this command to simply use \glossentry
, in which case the glossary will have a flat (no-hierarchy) appearance, but the indexing application will still take the hierarchy into account when ordering the entries.\glossentry
and \subglossentry
to fit the style, but they should not redefine the markup in . If the style doesn’t support number lists, then the argument should simply be ignored. \glossentry
to use \glsentryitem
to support the entrycounter option, \glstarget
to create the hyperlink target, and will use \glossentryname
to format the name.\subglossentry
will typically start with \glssubentryitem
to support the subentrycounter option. Again \glstarget
is needed to create the hyperlink target. The entry name may be displayed with \glossentryname
or may be omitted to support homographs.\glsgroupheading
except for the first one) is the group skip: \ifglsnogroupskip
conditional within this command to determine whether or not to add the gap.\glsgroupskip
as follows:
This has the conditional inside the definition of \renewcommand
*{\glsgroupskip
}{\ifglsnogroupskip
\else
\indexspace
\fi
}\glsgroupskip
which allows it to be changed after the style has been set. This causes a problem for tabular-like styles, so those need to have the conditional outside of the definition. For example, the long-booktabs style has:
This requires the conditional to be set before the style definitions are performed.\ifglsnogroupskip
\renewcommand
*{\glsgroupskip
}{}%
\else
\renewcommand
*{\glsgroupskip
}{\glspenaltygroupskip
}%
\fi
\glsgroupheading
and \glsgroupskip
should do nothing) and suppose you don’t want anything to appear immediately after
(so \begin{theglossary}
\glossaryheader
should do nothing). In addition, let’s suppose the symbol should appear in brackets after the name, followed by the description and last of all the number list should appear within square brackets at the end. Then you can create this new glossary style, called, say, mylist, as follows:
Note that this style creates a flat glossary, where sub-entries are displayed in exactly the same way as the top level entries. It also hasn’t used \newglossarystyle
{mylist}{%
% put the glossary in the itemize environment:
\renewenvironment
{theglossary}%
{\begin{itemize}
}{\end{itemize}
}%
% no header after \begin{theglossary}
\renewcommand
*{\glossaryheader
}{}%
% no visual distinction between glossary groups:
\renewcommand
*{\glsgroupheading
}[1]{}%
\renewcommand
*{\glsgroupskip
}{}%
% set how each entry should appear:
\renewcommand
*{\glossentry
}[2]{%
\item
% bullet point
\glstarget
{##
1}{\glossentryname
{##
1}}% the entry name
\space
(\glossentrysymbol
{##
1})% the symbol in brackets
\space
\glossentrydesc
{##
1}% the description
\space
[##
2]% the number list in square brackets
}%
% set how sub-entries appear:
\renewcommand
*{\subglossentry
}[3]{%
\glossentry
{##
2}{##
3}}%
}
\glsentryitem
or \glssubentryitem
so it won’t be affected by the entrycounter, counterwithin or subentrycounter package options.
\Glossentryname
instead of \glossentryname
.\ifglshassymbol
(see §15): \renewcommand
*{\glossentry
}[2]{%
\item
% bullet point
\glstarget
{##
1}{\glossentryname
{##
1}}% the entry name
\ifglshassymbol
{##
1}% check if symbol exists
{%
\space
(\glossentrysymbol
{##
1})% the symbol in brackets
}%
{}% no symbol so do nothing
\space
\glossentrydesc
{##
1}% the description
\space
[##
2]% the number list in square brackets
}%
\setglossarystyle
within the second argument of \newglossarystyle
followed by whatever alterations you require. For example, suppose you want a style like the list style but you don’t want the extra vertical space created by \indexspace
between groups, then you can create a new glossary style called, say, mylist as follows:
(In this case, you can actually achieve the same effect using the list style in combination with the package option nogroupskip.) \newglossarystyle
{mylist}{%
\setglossarystyle
{list}% base this style on the list style
% make nothing happen between groups:
\renewcommand
{\glsgroupskip
}{}%
}
\newglossarystyle
{long6col}{%
% put the glossary in a longtable environment:
\renewenvironment
{theglossary}%
{\begin{longtable}
{lp{\glsdescwidth
}cccp{\glspagelistwidth
}}}%
{\end{longtable}
}%
% Set the table's header:
\renewcommand
*{\glossaryheader
}{%
\bfseries
Term &
\bfseries
Description &
\bfseries
Symbol &
\bfseries
Units &
\bfseries
Dimensions &
\bfseries
Page List
\\
\endhead
}%
% No heading between groups:
\renewcommand
*{\glsgroupheading
}[1]{}%
% top level (level 0) entries displayed in a row optionally numbered:
\renewcommand
*{\glossentry
}[2]{%
\glsentryitem
{##
1}% Entry number if required
\glstarget
{##
1}{\glossentryname
{##
1}}% Name
&
\glossentrydesc
{##
1}% Description
&
\glossentrysymbol
{##
1}% Symbol
&
\glsentryuseri
{##
1}% Units
&
\glsentryuserii
{##
1}% Dimensions
&
##
2% Page list
\tabularnewline
% end of row
}%
% Similarly for sub-entries (no sub-entry numbers)
\renewcommand
*{\subglossentry
}[3]{%
% ignoring first argument (sub-level)
\glstarget
{##
2}{\glossentryname
{##
2}}% Name
&
\glossentrydesc
{##
2}% Description
&
\glossentrysymbol
{##
2}% Symbol
&
\glsentryuseri
{##
2}% Units
&
\glsentryuserii
{##
2}% Dimensions
&
##
3% Page list
\tabularnewline
% end of row
}%
% Nothing between groups:
\renewcommand
*{\glsgroupskip
}{}%
}
14. Xindy (Option 3)
This ensures that the information is written to the indexing files using xindy’s raw syntax.\usepackage
[xindy]{glossaries}
\{
and \}
don’t expand to a simple brace character when written to a file.~
(a literal tilde).~n
so you can use
to write this correctly (or you can do \glstildechar
n
).\string
~
(literal)n\
(a literal tilde)."
(double-quote) active you can use:
, where "
"
"
is a literal character. Alternatively, you can use
to write the double-quote character. This document assumes that the double quote character has not been made active, so the examples just use \string
"
"
for clarity.\noist
to prevent the style file from being overwritten by \makeglossaries
package. For additional information about xindy, read the xindy documentation. I’m sorry I can’t provide any assistance with writing xindy style files. If you need help, I recommend you ask on the xindy mailing list.14.1. Required Styles
\makeglossaries
starts with identifying the required styles. By default, the tex style is automatically added, so the xdy file should contain: ; required styles
(require "tex.xdy")
Any additional styles can be identified in the preamble (before \makeglossaries
) with:
The styles are all stored as a comma-separated list, so you can list multiple styles within the argument, but avoid spurious spaces. You can reset the style list (for example, if a style needs to be identified before tex.xdy) with:
The argument should be a comma-separated list where, again, you need to make sure there are no spurious spaces.14.2. Language and Encodings
\languagename
. The information is written to the aux file at the start of \printglossary
, which means that it should match the language in the document at that point.\glsdefaulttype
is assumed. If a language hasn’t been set for a particular glossary then the language will be as for the default glossary.\inputencodingname
. If that command isn’t defined or is empty, utf8
is assumed. As with \languagename
, the input encoding name obtained with \inputencodingname
may not match the xindy codepage name, which may include additional information, such as ij-as-ij
(with Dutch) or din5007
(with German).
This can also be implemented as a package option: \GlsSetXdyLanguage
{dutch}
\GlsSetXdyCodePage
{ij-as-y-utf8}
\usepackage
[xindy=language=dutch,codepage=ij-as-y-utf8]{glossaries}
ij-as-y
and another with ij-as-ij
you will need to call xindy explicitly for each glossary.
(and remember to use \GlsSetXdyLanguage
{}
\noist
to prevent the style file from being overwritten).14.3. Locations and Number lists
\newglossary
are automatically taken care of, but if you plan to use a different counter in the counter key for the \gls
-like or \glstext
-like commands, then you need to identify these counters before \makeglossaries
using: \index
command where the locations are all page numbers, but the glossaries package needs to incorporate the location counter as well. For example, if the hyperbf encap is used with the section counter, then the xindy attribute will be sectionhyperbf
. This is in contrast to using makeindex, where the counter is incorporated in the encap with \setentrycounter
.pagehyperbf
) are automatically added to the xdy style file, but if you want to use another encap, you need to add it with: \GlsAddXdyAttribute
will define commands in the form: \GlsAddXdyAttribute
).\newglossary
or in the argument of \GlsAddXdyCounters
. Each command has a definition in the form:
This ensures that, if required, location hyperlinks can be supported.\setentrycounter
[ ]{ }\
{ }
\glsX
X commands may need redefining for unusual locations where the default definition won’t work with hyperlinks (see Example 39).
Then in the document: \newcommand
*{\primary
}[1]{\hyperbf
{1}}
\GlsAddXdyAttribute
{primary}
A
This will give the format=primary instance preference over the next use that doesn’t use the format key.\gls
[format=primary]{duck} is an aquatic bird.
There are lots of different types of \gls
{duck}.
but with xindy, I also need to add this as an allowed attribute: \newcommand
*{\hyperbfit
}[1]{\textit
{\hyperbf
{1}}}
Now I can use it in the optional argument of commands like \GlsAddXdyAttribute
{hyperbfit}
\gls
: Here is a
(where “sample” is the label of the required entry). \gls
[formathyperbfit]{sample} entry.
\GlsAddXdyAttribute
has no effect if \noist
is used or if \makeglossaries
is omitted. \GlsAddXdyAttribute
must be used before \makeglossaries
. Additionally, \GlsAddXdyCounters
must come before \GlsAddXdyAttribute
. \theH
either isn’t defined or is different from \the
. Be sure to also read §12.3 for some issues that you may encounter.\GlsAddXdyLocation
has no effect if \noist
is used or if \makeglossaries
is omitted. \GlsAddXdyLocation
must be used before \makeglossaries
. \thesection
as follows:
If I haven’t used the package option counter=section, then I need to specify that the section counter will be used as a location counter: \renewcommand
*{\thesection
}{[\thechapter
]\arabic
{section}}
Next I need to add the location syntax: \GlsAddXdyCounters
{section}
This assumes that \GlsAddXdyLocation
{section}{:sep "[" "arabic-numbers" :sep "]"
"arabic-numbers"
}
\thechapter
is defined as
.\arabic
{chapter}\theHsection
as:
then I need to modify the \renewcommand
*{\theHsection
}{\thepart
.\thesection
}
\renewcommand
*{\thepart
}{\Roman
{part}}
\GlsAddXdyLocation
code above to:
Since \GlsAddXdyLocation
["roman-numbers-uppercase"]{section}{:sep "["
"arabic-numbers" :sep "]" "arabic-numbers"
}
\Roman
will result in an empty string if the counter is zero, it’s a good idea to add an extra location to catch this:
This example is illustrated in the sample file samplexdy2.tex. \GlsAddXdyLocation
{zero.section}{:sep "["
"arabic-numbers" :sep "]" "arabic-numbers"
}
\usepackage
[xindy,esclocations]{glossaries}
\glswrallowprimitivemodstrue
\dicei
, …, \dicevi
that represent the six sides of a die. I can define a command that takes a number as its argument. If the number is less than seven, the appropriate \dice
command is used otherwise it does \dicevi
the required number of times with the leftover in a final \dice
. For example, the number 16 is represented by
(\(6+6+4=16\)). I’ve called this command \dicevi
\dicevi
\diceiv
\tallynum
to match the example given earlier in §12.3:
Here’s the counter command: \newrobustcmd
{\tallynum
}[1]{%
\ifnum
\number
1<7
$\csname
dice\romannumeral
1\endcsname
$%
\else
$\dicevi
$%
\expandafter
\tallynum
\expandafter
{\numexpr
1-6}%
\fi
}
The page counter representation (\newcommand
{\tally
}[1]{\tallynum
{\arabic
{1}}}
\thepage
) needs to be changed to use this command:
The \renewcommand
*{\thepage
}{\tally
{page}}
\tally
command expands to \tallynum {number}
so this needs a location class that exactly matches this format:
The space between \GlsAddXdyLocation
{tally}{%
:sep "\string
\tallynum
\space
\glsopenbrace
"
"arabic-numbers"
:sep "\glsclosebrace
"
}
\tallynum
and {number} is significant to xindy so \space
is required.\glsnumberformat
and a custom \hyperbfit
format. A new xindy location called “tallynum”, as illustrated above, is defined to make the page numbers appear as dice. In order for the location numbers to hyperlink to the relevant pages, I need to redefine the necessary \glsX
X commands:
Note that the second argument of \renewcommand
{\glsXpageXglsnumberformat
}[2]{%
\linkpagenumber
2%
}
\renewcommand
{\glsXpageXhyperbfit
}[2]{%
\textbf
{\em
\linkpagenumber
2}%
}
\newcommand
{\linkpagenumber
}[2]{\hyperlink
{page.2}{1{2}}}
\glsXpageXglsnumberformat
is in the form \tallynum{ }
so the line
does \linkpagenumber
2%
so \linkpagenumber
\tallynum
{ }
\tallynum
is the first argument of \linkpagenumber
and is the second argument. \usepackage
[xindy,esclocations]{glossaries}
\glswrallowprimitivemodstrue
\thepage
as follows:
This used to get expanded to \renewcommand
*{\thepage
}{\Numberstring
{page}}
where is the Arabic page number. This means that I needed to define a new location with the form: \protect
\Numberstringnum
{ }
and if I’d used the \GlsAddXdyLocation
{Numberstring}{:sep "\string
\protect
\space
\string
\Numberstringnum
\space
\glsopenbrace
"
"arabic-numbers" :sep "\glsclosebrace
"}
\linkpagenumber
command from the previous example, it would need three arguments (the first being \protect
): \newcommand
{\linkpagenumber
}[3]{\hyperlink
{page.3}{12{3}}}
\Numberstring
has since changed so that it now expands to
(no \Numberstringnum
{ }
\protect
). This means that the location class definition must be changed to:
and \GlsAddXdyLocation
{Numberstring}{% no \protect
now!
:sep "\string
\Numberstringnum
\space
\glsopenbrace
"
"arabic-numbers" :sep "\glsclosebrace
"}
\linkpagenumber
goes back to only two arguments:
The other change is that \newcommand
{\linkpagenumber
}[2]{\hyperlink
{page.2}{1{2}}}
\Numberstring
uses
instead of \the
\value
{ }
so it hides \expandafter
\the
\csname
c@\endcsname
\c@page
from the location escaping mechanism (see §12.3). This means that the page number may be incorrect if the indexing occurs during the output routine.\expandafter
before \the\value
which no longer hides \c@page
from the location escaping mechanism, so the page numbers should once more be correct. Further changes to the fmtcount package may cause a problem again.\Numberstring
in the definition of \thepage
, I can provide a custom command in the same form as the earlier \tally
command:
This ensures that the location will always be written to the indexing file in the form: \newcommand
{\customfmt
}[1]{\customfmtnum
{\arabic
{1}}}
\newrobustcmd
{\customfmtnum
}[1]{\Numberstringnum
{1}}
:locref "
So the location class can be defined as: \glsopenbrace
\glsclosebrace
\glsopenbrace
\string
\\
customfmtnum { }\glsclosebrace
"
\GlsAddXdyLocation
{customfmt}{
:sep "\string
\customfmtnum
\space
\glsopenbrace
"
"arabic-numbers"
:sep "\glsclosebrace
"}
roman-page-numbers
(i, ii, …); arabic-page-numbers
(1, 2, …); arabic-section-numbers
(for example, 1.1 if the compositor is a full stop or 1-1 if the compositor is a hyphen); alpha-page-numbers
(a, b, …); Roman-page-numbers
(I, II, …); Alpha-page-numbers
(A, B, …); Appendix-page-numbers
(for example, A.1 if the Alpha compositor, see \glsSetAlphaCompositor
, is a full stop or A-1 if the Alpha compositor is a hyphen); \GlsAddXdyLocation
in the order in which they were defined); see
(cross-referenced entries).
(Remember to add \GlsSetXdyLocationClassOrder
{
"arabic-page-numbers"
"arabic-section-numbers"
"roman-page-numbers"
"Roman-page-numbers"
"alpha-page-numbers"
"Alpha-page-numbers"
"Appendix-page-numbers"
"see"
}
"seealso"
if you’re using glossaries-extra.)\GlsSetXdyLocationClassOrder
has no effect if \noist
is used or if \makeglossaries
is omitted. \GlsSetXdyLocationClassOrder
must be used before \makeglossaries
.
See the xindy manual for further details on range formations.\GlsSetXdyMinRangeLength
{3}
\GlsSetXdyMinRangeLength
has no effect if \noist
is used or if \makeglossaries
is omitted. \GlsSetXdyMinRangeLength
must be used before \makeglossaries
. 14.4. Glossary Groups
Any entry that doesn’t go in one of the letter groups or the number group is placed in the default group. If you want xindy to sort the number group numerically (rather than by a string sort) then you need to use xindy’s numeric-sort module: \usepackage
[xindy=glsnumbers=false]{glossaries}
\GlsAddXdyStyle
{numeric-sort}
define-letter-group
block in the xdy file: (define-letter-group "glsnumbers"
:prefixes ("0" "1" "2" "3" "4" "5" "6" "7" "8" "9")
:before "A")
:before "A"
to :before "
. ":before "A"
to . Again, a starred version was provided to sanitize the argument, which should no longer be necessary unless "
(double-quote) is active.
will put the number group after the “Z” letter group.\GlsSetXdyNumberGroupOrder
{:after "Z"}
\noist
is used or if \makeglossaries
is omitted. \GlsSetXdyFirstLetterAfterDigits
must be used before \makeglossaries
. 15. Utilities
\glsxtrusefield
and \glsxtrfieldformatlist
. See the glossaries-extra manual for further details. 15.1. hyperref
\glshyperlink
, the \gls
-like and \glstext
-like commands and \glstarget
. This setting is the default if hyperref hasn’t been loaded.\glstarget
to create a target is just set to \@secondoftwo
.\glstarget
to create a target is set to: \hyperlink
.\hyperlink
.\glsdohypertargethook
and will simulate a label corresponding to the target. It’s primarily intended for use with \pageref
rather than \ref
as there is no corresponding counter to provide a numeric value. It is an alternative to using the entrycounter option. The label is given by , where the is obtained by expanding:
The target will be the title corresponding to the label (which can be referenced with
\nameref
). Since there is no numeric value, the text obtained with \ref
will either be empty or the name of the most recent entry in the glossary list where the hypertarget occurs. For example:
Certain commands that may occur in the argument, such as \renewcommand
{\glsdohypertargethook
}[2]{\glslabelhypertarget
{#1}{#2}}
\glossentryname
, are locally redefined during the protected write to the aux file. These redefinitions are performed by:
You can append any additional redefinitions of problematic commands to this hook.\ref
) is obtained by expanding:
if \glsentryname
\glscurrententrylabel
\glscurrententrylabel
is defined and not empty. Otherwise it expands to nothing.\texorpdfstring
if that command has been defined, otherwise it will simply expand to .15.2. Case-Changing
\GLS
and \GLStext
and is affected by \glsmfuexcl
.\glsmfuexcl
.\Glsentrytext
, when expanding in a PDF bookmark.\glsmfuexcl
.\Gls
and \Glstext
, and also by commands like \Glsentrytext
in the document text.\makefirstuc
provided by the mfirstuc package. If you need an expandable command, use \MFUsentencecase
instead.\makefirstuc
internally uses \glsmakefirstuc
, which is provided by mfirstuc. The default definition is:
The mfirstuc=expanded package option will redefine this command without \newcommand
*{\glsmakefirstuc
}[1]{\MFUsentencecase
{\unexpanded
{1}}}
\unexpanded
.\unexpanded
is mostly a backward-compatibility feature, as without it there is now the possibility for fragile commands to expand prematurely and cause an error.\MFUsentencecase
expands its argument before applying the case change. With previous versions of mfirstuc, \glsmakefirstuc
would simply apply the case change to the first token.
and a glossary style is used that performs automated sentence-casing for the description (for example, with the topic style, provided by glossaries-extra), then this would essentially do: \newglossaryentry
{sample}{
name={sample},
description={an example with a \fragilecommand
}
}
With old versions of mfirstuc, this would simply end up as: \makefirstuc
{an example with a \fragilecommand
}
so the fragile command is unaffected.\MakeTextUppercase
an example with a \fragilecommand
and the underlying \MFUsentencecase
an example with a \fragilecommand
\text_titlecase_first:n
will expand the entire argument, which will break the fragile command.\unexpanded
prevents this from happening, but if you don’t have fragile commands and you want the content to be expanded, then use mfirstuc=expanded.\capitalisewords
provided by mfirstuc. You may need to redefine this command to use \capitalisefmtwords
instead.\MFUexcl
with mfirstuc v2.08+, otherwise its defined in the same way (so it won’t affect \makefirstuc
but will affect commands like \glsuppercase
).\MFUblocker
with mfirstuc v2.08+, otherwise it simply uses \glsmfuexcl
.\MFUaddmap
with mfirstuc v2.08+, otherwise it simply does \glsmfuexcl
{ }
\glsmfublocker
{ }
\MFUblocker
if defined, otherwise it simply uses \glsmfuexcl
.15.3. Loops
\@for
command, make sure your list doesn’t have any unwanted spaces in it as they don’t get stripped. (Discussed in more detail in §2.7.2 of “LaTeX for Administrative Work”.) \forallglossaries
but only iterates over the lists of acronyms (that have previously been declared using \DeclareAcronymList
or the acronymlists package option). This command doesn’t have an optional argument. If you want to explicitly say which lists to iterate over, just use the optional argument of \forallglossaries
.\glsdefaulttype
is used.
If is omitted, the default is the list of all non-ignored glossaries. (The current glossary label can be obtained using \forallglossaries
[ ]{ }{ }
within .)\glsentrytype
{ }\glsxtrforcsvfield
to iterate over any fields that contain comma-separated lists. 15.4. Conditionals
\newglossary
, but only the starred form will do if was defined with \newignoredglossary
.
then \newignoredglossary
{common}
will produce “false true”.\ifglossaryexists
{common}{true}{false}
\ifglossaryexists
*{common}{true}{false}
\ifcsundef
so can expand.\glsdoifexists
but issues a warning rather than an error if the entry doesn’t exist.\ifglsused
is unreliable with bib2gls as no entries are defined on the first LaTeX run, which means there’s no way of determining if it has been used, so glossaries-extra provides a similar command: \ifglsused
for defined entries.\ifglshas
commands use \glsdoifexists
. In those cases, the or parts are only performed if the entry exists. Neither are done if the entry doesn’t exist. \glsdoifexists
.\GlsXtrIfHasNonZeroChildCount
. \glsdoifexists
.\relax
for the entry identified by .\relax
for the entry identified by .\relax
for the entry identified by .\nopostdesc
} for the entry identified by otherwise expands to .\glsaddkey
, then the internal label will be the same as the key.\ifcsvoid
. This means that an undefined field or an undefined entry will be considered void. An empty field value or a field set to \relax
are also considered void.\relax
, then is performed, otherwise is performed. If the field supplied is unrecognised is performed and a warning is issued. If the entry is undefined, an undefined error occurs.
will insert a comma, space and the field value if the user1 key has been set for the entry whose label is “sample”.\ifglshasfield
{useri}{sample}{, \glscurrentfieldvalue
}{}
\ifcsstring
. An error will occur if the field value is undefined or if the entry hasn’t been defined.
This will produce “TRUE” in both cases since expansion is on for the user1 key, so \documentclass
{article}
\usepackage
{glossaries}
\newcommand
*{\foo
}{FOO}
\newglossaryentry
{sample1}{name={sample1},description={an example},
user1={FOO}}
\newglossaryentry
{sample2}{name={sample2},description={an example},
user1={\foo
}}
\begin{document}
\ifglsfieldeq
{sample1}{useri}{FOO}{TRUE}{FALSE}.
\ifglsfieldeq
{sample2}{useri}{FOO}{TRUE}{FALSE}.
\end{document}
\foo
was expanded to “FOO” when “sample2” was defined. If the tests are changed to:
then this will produce “FALSE” in both cases. Now suppose expansion is switched off for the user1 key: \ifglsfieldeq
{sample1}{useri}{\foo
}{TRUE}{FALSE}.
\ifglsfieldeq
{sample2}{useri}{\foo
}{TRUE}{FALSE}.
This now produces “TRUE” for the first case (comparing “FOO” with “FOO”) and “FALSE” for the second case (comparing “\documentclass
{article}
\usepackage
{glossaries}
\newcommand
*{\foo
}{FOO}
\glssetnoexpandfield
{useri}
\newglossaryentry
{sample1}{name={sample1},description={an example},
user1={FOO}}
\newglossaryentry
{sample2}{name={sample2},description={an example},
user1={\foo
}}
\begin{document}
\ifglsfieldeq
{sample1}{useri}{FOO}{TRUE}{FALSE}.
\ifglsfieldeq
{sample2}{useri}{FOO}{TRUE}{FALSE}.
\end{document}
\foo
” with “FOO”).
This now produces “FALSE” for the first case (comparing “FOO” with “\documentclass
{article}
\usepackage
{glossaries}
\newcommand
*{\foo
}{FOO}
\glssetnoexpandfield
{useri}
\newglossaryentry
{sample1}{name={sample1},description={an example},
user1={FOO}}
\newglossaryentry
{sample2}{name={sample2},description={an example},
user1={\foo
}}
\begin{document}
\ifglsfieldeq
{sample1}{useri}{\foo
}{TRUE}{FALSE}.
\ifglsfieldeq
{sample2}{useri}{\foo
}{TRUE}{FALSE}.
\end{document}
\foo
”) and “TRUE” for the second case (comparing “\foo
” with “\foo
”).\ifglsfieldeq
but internally uses etoolbox’s \ifdefstrequal
command to perform the comparison. The argument argument must be a macro.
Here, the first case produces “TRUE” since the value of the useri field (“FOO”) is the same as the replacement text (definition) of \documentclass
{article}
\usepackage
{glossaries}
\newcommand
*{\foo
}{FOO}
\glssetnoexpandfield
{useri}
\newglossaryentry
{sample1}{name={sample1},description={an example},
user1={FOO}}
\newglossaryentry
{sample2}{name={sample2},description={an example},
user1={\foo
}}
\begin{document}
\ifglsfielddefeq
{sample1}{useri}{\foo
}{TRUE}{FALSE}.
\ifglsfielddefeq
{sample2}{useri}{\foo
}{TRUE}{FALSE}.
\end{document}
\foo
(“FOO”). We have the result “FOO
” is equal to “FOO
”.\foo
”) is not the same as the replacement text (definition) of \foo
(“FOO”). No expansion has been performed on the value of the useri field. We have the result “\foo
” is not equal to “FOO
”.
we now get “TRUE” since the value of the useri field (“\newcommand
{\FOO
}{\foo
}
\ifglsfielddefeq
{sample2}{useri}{\FOO
}{TRUE}{FALSE}.
\foo
”) is the same as the replacement text (definition) of \FOO
(“\foo
”). We have the result “\foo
” is equal to “\foo
”.\ifcsstrequal
command instead of \ifdefstrequal
.15.5. Measuring
\glsdohypertarget
measures the height of the supplied text to position the target at the top of the line instead of at the baseline (where it can cause the line to scroll up out of view). Some styles measure the width of text to assist with alignment.\settowidth
, \settoheight
and \settodepth
, but if the content being measured contains any \gls
-like or \glstext
-like commands, or if it contains commands like \glsentryitem
, it can cause duplication. (See also §7 for the problems this can cause with unsetting and resetting the first use flag.)\label
, and adjust \refstepcounter
to only locally update the counter value.\ifmeasuring@
into account.\TX@trial
command can be patched with: \gls
-like commands inside a tabularx environment, you will need to use \glspatchtabularx
in the preamble to disable unset/reset while the environment measures its content.15.6. Fetching and Updating the Value of a Field
\glsfieldfetch
in that it doesn’t test for existence. If either the field or the entry haven’t been defined, no error or warning will be trigger but will be undefined. You can then use etoolbox’s \ifdef
or \ifundef
on .\tmp
:
An alternative is to use \glsletentryfield
{\tmp
}{apple}{desc}
\ifdef
{\tmp
}description: \tmp
{no description}
\ifglshasfield
or, with glossaries-extra, \glsxtrifhasfield
.\def
to change the value of the field (so it will be localised by any grouping).\protected@csedef
to change the value of the field (so it will be localised by any grouping).\glsfieldgdef
This uses \gdef
to change the value of the field (so it will have a global effect).\protected@csxdef
to change the value of the field (so it will be localised by any grouping).16. Prefixes or Determiners
\newglossaryentry
are as follows:
Note that I’ve simply replaced glossaries from previous sample documents with glossaries-prefix. Now for a sample definition: \documentclass
{article}
\usepackage
[colorlinks]{hyperref}
\usepackage
[toc,acronym]{glossaries-prefix}
(Single letter words, such as “a” and “I” should typically not appear at the end of a line, hence the non-breakable space \newglossaryentry
{sample}{namesample,
description={an example},
prefix={a~
},
prefixplural={the\space
}
}
~
after “a” in the prefix field.)\newglossaryentry
{oeil}{name={oeil},
plural={yeux},
description={eye},
prefix={l'},
prefixplural={les\space
}}
\space
, \
(backslash space) or ~
due to the automatic spacing trimming performed in = options. \glsprefixsep
to do a space. For example: \renewcommand
{\glsprefixsep
}{\space
}
\newacronym
[
prefix={an\space
},prefixfirst={a~
}
]{svm}{SVM}{support vector machine}
\gls
. Note that the prefix is not considered part of the link text, so it’s not included in the hyperlink (where hyperlinks are enabled). The options and any star or plus modifier are passed on to the appropriate \gls
-like command. (See §5.1 for further details.)\gls
-like command.\p
essentially does
if the appropriate prefix field has been set, otherwise it simply does , where is the corresponding \glsprefixsep
\gls
-like command.\P
will convert the prefix to all caps (using \glsuppercase
) and use the all caps \gls
-like counterpart.\P
are slightly more complicated. If the appropriate prefix field has been set, then the prefix will have the case change applied and the non-case \gls
-like command will be used (\gls
or \glspl
). If the appropriate prefix field hasn’t been set, then the sentence case \gls
-like command is used (\Gls
or \Glspl
).\gls
-like optional argument and star (*
) and plus (+
) modifiers can be used with these commands, in which case they will be applied to the applicable \gls
-like command.
if is non-empty otherwise just uses \glsprefixsep
\gls
\gls
.
if is non-empty otherwise just uses \glsprefixsep
\glspl
\glspl
.
if is non-empty otherwise just uses \glsprefixsep
\gls
\Gls
.\pgls
, the prefix fields are prefixfirst on first use or the prefix on subsequent use, but the will now be obtained from the sentence case commands \Glsentryprefix
and \Glsentryprefixfirst
.
if is non-empty otherwise just uses \glsprefixsep
\glspl
\Glspl
.\pglspl
, the prefix fields are prefixfirstplural on first use or the prefixplural on subsequent use, but the will now be obtained from the sentence case commands \Glsentryprefixplural
and \Glsentryprefixfirstplural
.
if is non-empty otherwise just uses \glsuppercase
{\glsprefixsep
}\GLS
\GLS
.
if is non-empty otherwise just uses \glsuppercase
{\glsprefixsep
}\GLSpl
\GLSpl
.\pglsxtrshort
, for use in section headings. First use:
which produces: \pgls
{svm}. Next use: \pgls
{svm}.
Singular: \pgls
{sample}, \pgls
{oeil}.
Plural: \pglspl
{sample}, \pglspl
{oeil}.
\Glsentrytext
, these will use \MFUsentencecase
to expand in PDF bookmarks, but will use \glssentencecase
in the document.\glsentryprefix
with sentence case applied.\glsentryprefixplural
with sentence case applied.\glsentryprefixfirst
with sentence case applied.\glsentryprefixfirstplural
with sentence case applied.
If you want to change the prefix separator (\newglossarystyle
{plist}{%
\setglossarystyle
{list}%
\renewcommand
*{\glossentry
}[2]{%
\item
[\glsentryitem
{1}%
\glsentryprefix
{1}%
\glstarget
{1}{\glossentryname
{1}}]
\glossentrydesc
{1}\glspostdescription
\space
2}%
}
\glsprefixsep
) then the following is better:
The conditional is also useful if you want the style to use an uppercase letter at the start of the entry item: \newglossarystyle
{plist}{%
%
\renewcommand
*{\glossentry
}[2]{%
\item
[\glsentryitem
{1}%
\ifglshasprefix
{1}{\glsentryprefix
{1}\glsprefixsep
}{}%
\glstarget
{1}{\glossentryname
{1}}]
\glossentrydesc
{1}\glspostdescription
\space
2}%
}
\newglossarystyle
{plist}{%
\setglossarystyle
{list}%
\renewcommand
*{\glossentry
}[2]{%
\item
[\glsentryitem
{1}%
\glstarget
{1}%
{%
\ifglshasprefix
{1}%
{\Glsentryprefix
{1}\glsprefixsep
\glossentryname
{1}}%
{\Glossentryname
{1}}%
}]
\glossentrydesc
{1}\glspostdescription
\space
2}%
}
17. Accessibility Support
This will load glossaries with the acronym package option as well as loading glossaries-accsupp.\usepackage
[acronym]{glossaries-accsupp}
\usepackage[abbreviations,accsupp]{glossaries-extra}
This will load glossaries-extra (with the abbreviations option), glossaries and glossaries-accsupp and make appropriate patches to integrate the accessibility support with the extension commands. 17.1. Accessibility Keys
\newacronym
, the shortaccess field will automatically be set to:
Now the link text produced by \newglossaryentry
{tex}{name={\TeX
},description={Document preparation language},access={TeX}}
will be: \gls
{tex}
which is produced via \BeginAccSupp
{ActualText={TeX}}\TeX
\EndAccSupp
\glsaccessibility
. If you want to use another accessibility package, see §17.5.17.2. Incorporating Accessibility Support
\gls
-like and \glstext
-like commands have their link text adjusted to incorporate the accessibility support, if provided. A helper command is used to identify the replacement text that depends on the field name:
and
which is simply defined to use \glsaccessibility
{E}{ }{ }
\glsshortaccsupp
.
This definition requires the replacement text to be specified with the hexadecimal character code. For example: \newcommand
{\glssymbolaccsupp
}[2]{%
\glsaccessibility
[method=hex,unicode]{ActualText}{1}{2}%
}
\newglossaryentry
{int}{name={int},description={integral},
symbol={\ensuremath
{\int
}},symbolaccess={222B}
}
17.3. Incorporating the Access Field Values
They may be used to apply the supplied accessibility information to . If the relevant access field hasn’t been set, these simply do .\gls
{ accessdisplay }{ }
See the glossaries-extra manual for further details.\newcommand
*{\glsaccessname
}[1]{%
\glsnameaccessdisplay
{\glsentryname
{1}}1%
}
17.4. Obtaining the Access Field Values
\glsentrytext
if you need to obtain the value of any of the accessibility fields. Since the accessibility information isn’t intended to be typeset but should be written as a PDF string, use the expandable \MFUsentencecase
or \glsuppercase
if any case change is required.17.5. Developer’s Note
accsupp
when glossaries-accsupp loads then the accsupp package will automatically be loaded, otherwise it won’t and you’ll need to redefine \gls@accessibility
to use the appropriate accessibility commands.\glsaccessibility
. The default definition if \gls@accsupp@engine
is defined to accsupp
does:
Otherwise it simply does .\BeginAccSupp
{ , ={ }}\EndAccSupp
{}
18. Sample Documents
texdoc -l glossaries
This should display a list of all the files in the glossaries documentation directory with their full pathnames. (The GUI version of texdoc may also provide you with the information.)Package:
”.) Where hyperref is loaded you will get warnings about non-existent references that look something like: pdfTeX warning (dest): name{glo:aca} has been
referenced but does not exist, replaced by a fixed one
These warnings may be ignored on the first LaTeX run. (The destinations won’t be defined until the glossary has been created.)18.1. Basic
You should now have a complete document. The number following each entry in the glossary is the location number. By default, this is the page number where the entry was referenced.pdflatex minimalgls
in a terminal or by using the relevant button or menu item in your text editor or front-end. This will create the required associated files but you will not see the glossary in the document.makeglossaries minimalgls
otherwise use makeglossaries-lite: makeglossaries-lite minimalgls
If for some reason you want to call makeindex explicitly, you can do this in a terminal by typing (all on one line): makeindex -s minimalgls.ist -t minimalgls.glg -o minimalgls.gls minimalgls.glo
See §1.6.4 for further details on using makeindex explicitly.acronym
(which can be referenced with \acronymtype
). If you decide to enable this option then there will be a second set of indexing files that need to be processed by makeindex. If you use makeglossaries or makeglossaries-lite you don’t need to worry about it, as those scripts automatically detect which files need to be processed and will run makeindex (or xindy) the appropriate number of times.pdflatex minimalgls
makeindex -s minimalgls.ist -t minimalgls.glg -o minimalgls.gls minimalgls.glo
makeindex -s minimalgls.ist -t minimalgls.alg -o minimalgls.acr minimalgls.acn
pdflatex minimalgls
with: \usepackage
[acronym]{glossaries}
Note the different default package options. (You may omit the acronym package option in both cases if you only want a single glossary.) The glossaries-extra package internally loads the base glossaries package so you don’t need to explicitly load both (in fact, it’s better to let glossaries-extra load glossaries).\usepackage
[acronym,postdot,stylemods]{glossaries-extra}
with: \setacronymstyle
{long-short}
The optional argument acronym identifies the category that this style should be applied to. The \setabbreviationstyle
[acronym]{long-short}
\newacronym
command provided by the base glossaries package is redefined by glossaries-extra to use \newabbreviation
with the category set to acronym.\newacronym
with \newabbreviation
then the default category is abbreviation so the style should instead be:
This is actually the default category if the optional argument is omitted, so you can simply do: \setabbreviationstyle
[abbreviation]{long-short}
The long-short style is the default for the abbreviation category so you can omit this line completely if you replace \setabbreviationstyle
{long-short}
\newacronym
. (The default style for the acronym category is short-nolong, which only shows the short form on first use.)acronym
. This is independent of the acronym category. You can use the acronym package option with either \newacronym
or \newabbreviation
.abbreviations
:
This can again be used with either \usepackage
[abbreviations,postdot,stylemods]{glossaries-extra}
\newacronym
or \newabbreviation
, but the file extensions are different. This isn’t a problem if you are using makeglossaries or makeglossaries-lite. If you are explicitly calling makeindex (or xindy) then you need to modify the file extensions. See the glossaries-extra user manual for further details.\newacronym
will default to the acronym
glossary and \newabbreviation
will default to the abbreviations
glossary.
Next you need to convert the entry definitions into the bib format required by bib2gls. This can easily be done with convertgls2bib. For example: \usepackage
[record,postdot,stylemods]{glossaries-extra}
convertgls2bib --preamble-only minimalgls.tex entries.bib
This will create a file called entries.bib. Next, replace:
with: \makeglossaries
Now remove all the entry definitions in the document preamble (\GlsXtrLoadResources
[src={entries}]
\longnewglossaryentry
, \newglossaryentry
and \newacronym
or \newabbreviation
). \GlsXtrLoadResources
. For example (if you are using \newacronym
):
Finally, replace: \setabbreviationstyle
[acronym]{long-short}
\GlsXtrLoadResources
[src={entries}]
with: \printglossaries
The document build is now: \printunsrtglossaries
pdflatex minimalgls
bib2gls minimalgls
pdflatex minimalgls
\glsaddall
to add all the entries to the glossaries without referencing each one explicitly. (Note that it’s more efficient to use glossaries-extra and bib2gls if you have a large number of entries.) To create the document do: pdflatex sampleDB
makeglossaries sampleDB
pdflatex sampleDB
or pdflatex sampleDB
makeglossaries-lite sampleDB
pdflatex sampleDB
The glossary definitions are stored in the accompanying files database1.tex and database2.tex. If for some reason you want to call makeindex explicitly you must have a separate call for each glossary:
main
glossary (all on one line): makeindex -s sampleDB.ist -t sampleDB.glg -o sampleDB.gls sampleDB.glo
makeindex -s sampleDB.ist -t sampleDB.nlg -o sampleDB.not sampleDB.ntn
Note that both makeglossaries and makeglossaries-lite do this all in one call, so they not only make it easier because you don’t need to supply all the switches and remember all the extensions but they also call makeindex the appropriate number of times.
convertgls2bib database1.tex database1.bib
convertgls2bib database2.tex database2.bib
The document code then needs to be:
Note that the nonumberlist package option has been omitted. It’s not needed because there are no locations in this amended document (whereas in the original sampleDB.tex locations are created with \documentclass
{article}
\usepackage
[colorlinks,plainpages=false]{hyperref}
\usepackage
[record,postdot]{glossaries-extra}
\newglossary*
{punc}{Punctuation Characters}
\GlsXtrLoadResources
[src={database1},
selection=all,sort=en]
\GlsXtrLoadResources
[src={database2},type=punc,
selection=all,sort=letter-case]
\begin{document}
\printunsrtglossaries
\end{document}
\glsaddall
). The starred \newglossary*
is used since the makeindex/xindy extensions are now irrelevant.pdflatex sampleDB
bib2gls sampleDB
pdflatex sampleDB
Note that one bib2gls call processes all the indexing (rather than one call per glossary). Unlike makeindex and xindy, bib2gls processes each resource set in turn, but the resource sets aren’t linked to a specific glossary. Multiple glossaries may be processed in a single resource set or sub-blocks of a single glossary may be processed by multiple resource sets. In this example, there happens to be one resource set per glossary because each glossary requires a different sort method. (A locale-sensitive alphabetical sort for the first and a character code sort for the second.)bib2gls --group sampleDB
and use an appropriate glossary style.18.2. Acronyms and First Use
pdflatex sampleAcr
makeglossaries sampleAcr
pdflatex sampleAcr
pdflatex sampleAcr
(or use makeglossaries-lite).\ifglsused
to determine whether to use “a” or “an” in: … is
This clumsy bit of code can be tidied up with the glossaries-prefix package. Since that package automatically loads glossaries and passes all its options to the base package it’s possible to do a simple replacement of: \ifglsused
{svm}{an}{a} \gls
{svm} …
with: \usepackage
[style=long,toc]{glossaries}
The definition of “svm” now needs an adjustment: \usepackage
[style=long,toc]{glossaries-prefix}
The clumsy text can now simply be changed to: \newacronym
[description={statistical pattern recognition technique~
\protect
\cite
{svm}},
prefixfirst={a~
},prefix={an\space
}
]{svm}{svm}{support vector machine}
… is
\pgls
{svm} …
If you want to suppress all the other glossary style packages with nostyles, then you need to specify exactly which package (or packages) that you do want: \usepackage
[stylemods,style=long]{glossaries-extra}
(Now that glossaries-extra is being used, there are more available “long” styles in the glossary-longextra package, which you may prefer.)\usepackage
[nostyles,stylemods=long,style=long]{glossaries-extra}
pdflatex sampleAcr
makeglossaries sampleAcr
pdflatex sampleAcr
The third LaTeX call is no longer required to make the table of contents up-to-date. This is because glossaries-extra provides boilerplate text on the first LaTeX call when the indexing files are missing. This means that the glossary header is added to the toc file on the first LaTeX call, whereas with just the base glossaries package, the header isn’t present until the second LaTeX call. (As with just the base glossaries package, if the glossary occurs at the start of the document without a page reset after it then part of the build process needs repeating to ensure all referenced page numbers are up-to-date. This problem isn’t specific to the glossaries package.)\setabbreviationstyle
instead of \setacronymstyle
:
(Note the different style name long-short-sc instead of long-sc-short and the optional argument acronym.) If you prefer to replace \setabbreviationstyle
[acronym]{long-short-sc}
\newacronym
{svm}{svm}{support vector machine}
\newacronym
with \newabbreviation
then omit the optional argument:
(The optional argument of \setabbreviationstyle
{long-short-sc}
\newabbreviation
{svm}{svm}{support vector machine}
\setabbreviationstyle
is the category to which the style should be applied. If it’s omitted, abbreviation is assumed. You can therefore have different styles for different categories.)\acrshort
, \acrlong
and \acrfull
and their variants with \glsxtrshort
, \glsxtrlong
and \glsxtrfull
etc.pdflatex sampleAcrDesc
makeglossaries sampleAcrDesc
pdflatex sampleAcrDesc
pdflatex sampleAcrDesc
This document uses the acronym package option, which creates a new glossary used by \newacronym
. This leaves the default main
glossary available for general terms. However, in this case there are no general terms so the main
glossary is redundant. The nomain package option will prevent its creation. Obviously, if you decide to add some terms with \newglossaryentry
you will need to remove the nomain option as the main
glossary will now be required.\usepackage
argument. Again you can omit toc as this is the default for glossaries-extra. As in the previous example, you may want to use the patched styles. This document uses altlist which is provided by glossary-list, so the style can be patched with stylemods.
You may prefer to replace the acronym option with abbreviations, but this will change the file extensions. If you use makeglossaries or makeglossaries-lite you don’t need to worry about it.\usepackage
[acronym,nomain,style=altlist,stylemods]{glossaries-extra}
(Note the change in style name long-short-sc-desc instead of long-sc-short-desc and the optional argument acronym.) \setabbreviationstyle
[acronym]{long-short-sc-desc}
\newabbreviation
instead of \newacronym
then you need to omit the optional argument:
The original document uses: \setabbreviationstyle
{long-short-sc-desc}
to ensure that the cross-references (from the see key) use the acronym font. The new abbreviation styles don’t use \renewcommand
*{\glsseeitemformat
}[1]{%
\acronymfont
{\glsentrytext
{#1}}}
\acronymfont
so this isn’t appropriate with glossaries-extra. If you’re using at least version 1.42 of glossaries-extra, you don’t need to do anything as it automatically redefines \glsseeitemformat
to take the style formatting into account. If you have an earlier version you can redefine this command as follows:
This will just show the short form in the cross-reference. If you prefer the name instead (which includes the short and long form) you can use: \renewcommand
*{\glsseeitemformat
}[1]{%
\ifglshasshort
{#1}{\glsfmttext
{#1}}{\glsfmtname
{#1}}%
}
\renewcommand
*{\glsseeitemformat
}[1]{\glsfmtname
{#1}}
see={[see also]{svm}}
can be replaced with a more appropriate key: \newacronym
[description={Statistical pattern recognition technique using the ``kernel trick''},
seealso={svm},
]{ksvm}{ksvm}{kernel support vector machine}
\acrshort
, \acrlong
and \acrfull
etc with \glsxtrshort
, \glsxtrlong
and \glsxtrfull
etc.
Now you need to convert the acronym definitions to the bib format required by bib2gls. This can be done with: \usepackage
[acronym,nomain,style=altlist,record,postdot,stylemods]
{glossaries-extra}
convertgls2bib --preamble-only sampleAcrDesc.tex entries.bib
If you retained \newacronym
from the original example file, then the new entries.bib file will contain entries defined with @acronym
. For example:
If you switched to @acronym
{ksvm,
description={Statistical pattern recognition technique using the ``kernel trick''},
seealso={svm},
short={ksvm},
long={kernel support vector machine}
}
\newabbreviation
then the entries will instead be defined with @abbreviation
.\makeglossaries
with the resource command, but note that the abbreviation style must be set first:
Another possibility is to make \setabbreviationstyle
[acronym]{long-short-sc-desc}
\GlsXtrLoadResources
[src={entries},% terms defined in entries.bib
abbreviation-sort-fallback=long]
@acronym
behave as though it was actually @abbreviation
:
Note that the category is now abbreviation not acronym so the optional argument of \setabbreviationstyle
{long-short-sc-desc}
\GlsXtrLoadResources
[src={entries},abbreviation-sort-fallback=long,
entry-type-aliases={acronym=abbreviation}]
\setabbreviationstyle
needs to be removed.@acronym
and @abbreviation
will fallback on the short field (not the name field, which is usually set by the style and therefore not visible to bib2gls). For some styles, as in this example, it’s more appropriate to sort by the long form so the fallback is changed. (Remember that you will break this fallback mechanism if you explicitly set the sort value.) See the bib2gls manual for further details and other examples.\newacronym
or \newabbreviation
in the tex file. Finally replace \printglossary
with \printunsrtglossary
. The document build is now: pdflatex sampleAcrDesc
bib2gls sampleAcrDesc
pdflatex sampleAcrDesc
With the other options it would be necessary to delete all the description fields from the abbreviation definitions in order to omit them, but with bib2gls you can simply instruct bib2gls to ignore the description. This makes it much easier to have a large database of abbreviations for use across multiple documents that may or may not require the description.\setabbreviationstyle
[acronym]{long-short-sc}
\GlsXtrLoadResources
[src={entries},ignore-fields={description}]
\newglossaryentry
instead of \newacronym
. As with the previous example, the glossary is added to the table of contents, so an extra run through LaTeX is required: pdflatex sampleDesc
makeglossaries sampleDesc
pdflatex sampleDesc
pdflatex sampleDesc
This sample file demonstrates the use of the first and text keys but in general it’s better to use \newacronym
instead as it’s more flexible. For even greater flexibility use \newabbreviation
provided by glossaries-extra. For other variations, such as showing the symbol on first use, you may prefer to make use of the post-link category hook. For examples, see the section “Changing the Formatting” in glossaries-extra and bib2gls: An Introductory Guide.pdflatex sampleFnAcrDesc
makeglossaries sampleFnAcrDesc
pdflatex sampleFnAcrDesc
pdflatex sampleFnAcrDesc
If you want to convert this sample document to use glossaries-extra, then you just need to follow the same steps as for sampleAcr.tex with a slight modification. This time the short-sc-footnote-desc abbreviation style is needed:
The command redefinitions (performed with \setabbreviationstyle
[acronym]{short-sc-footnote-desc}
\renewcommand
) should now all be deleted as they are no longer applicable.pdflatex sampleFnAcrDesc
makeglossaries sampleFnAcrDesc
pdflatex sampleFnAcrDesc
This is because the glossaries-extra package produces boilerplate text when the indexing file is missing (on the first LaTeX run) which adds the glossary title to the table of contents (toc) file.pdflatex sampleCustomAcr
makeglossaries sampleCustomAcr
pdflatex sampleCustomAcr
pdflatex sampleCustomAcr
This is a slight variation on the previous example where the name is in the form ( ) instead of ( ), and the sort key is set to the long form instead of the short form. On first use, the footnote text is in the form : (instead of just the long form). This requires defining a \newacronym
style that inherits from the footnote-sc-desc style.
The abbreviation styles have associated helper commands that may be redefined to make minor modifications. These redefinitions should be done before the abbreviations are defined.\usepackage
[acronym,nomain,postdot,stylemods,style=altlist]
{glossaries-extra}
\setacronymstyle
command with:
Again, you may prefer short-sc-postfootnote-desc. Both styles use the same helper commands.\setabbreviationstyle
[acronym]{short-sc-footnote-desc}
This command expands when the abbreviations are defined so take care to \renewcommand
*{\glsxtrfootnotedescname
}{%
\protect
\glslongfont
{\the
\glslongtok
}%
\protect
\glsxtrfullsep
{\the
\glslabeltok
}%
\protect
\glsxtrparen
{\protect
\glsabbrvfont
{\the
\glsshorttok
}}%
}
\protect
commands that shouldn’t be expanded at that point, and make sure that the token registers that store the label, long and short values are able to expand. Similarly the sort value needs adjusting:
The footnote for all the footnote abbreviation styles is produced with: \renewcommand
*{\glsxtrfootnotedescsort
}{\the
\glslongtok
}
where is the singular or plural long form, depending on what command was used to reference the abbreviation (\glsxtrabbrvfootnote
{ }{ }
\gls
, \glspl
etc). This can simply be redefined as:
This will mimic the result from the original sample document. Note that newer versions of glossaries-extra may have additional helper commands associated with certain abbreviation styles.\renewcommand
*{\glsxtrabbrvfootnote
}[2]{\footnote
{%
#2: \glsentrydesc
{#1}}}
#2
with a reference to a specific field (or fields). For example:
As with the earlier sampleAcrDesc.tex, you need to remove or change the redefinition of \renewcommand
*{\glsxtrabbrvfootnote
}[2]{\footnote
{%
\Glsfmtlong
{#1} (\glsfmtshort
{#1}): \glsentrydesc
{#1}.}}
\glsseeitemformat
since \acronymfont
is no longer appropriate.
This leads to a capital letter after the colon in the footnote, which is undesirable, but I would like to have the description start with a capital in the glossary. The solution to this problem is easy with glossaries-extra. I start the description with a lowercase letter and set the glossdesc category attribute to firstuc to convert the description to sentence case in the glossary: \newacronym
[description={Statistical pattern recognition technique using the ``kernel trick''},
see={[see also]{svm}},
]{ksvm}{ksvm}{kernel support vector machine}
The abbreviation definitions are modified slightly: \glssetcategoryattribute
{acronym}{glossdesc}{firstuc}
Note the use of the seealso key, which is only available with glossaries-extra.\newacronym
[description={statistical pattern recognition technique using the ``kernel trick''},
seealso={svm},
]{ksvm}{ksvm}{kernel support vector machine}
\newabbreviation
instead of \newacronym
, then the category needs to be abbreviation rather than acronym:
and the style command needs to be adjusted so that it omits the optional argument. For example: \glssetcategoryattribute
{abbreviation}{glossdesc}{firstuc}
\setabbreviationstyle
{short-sc-postfootnote-desc}
pdflatex sample-FnDesc
makeglossaries sample-FnDesc
pdflatex sample-FnDesc
In order to prevent nested hyperlinks, this document uses the hyperfirst=false package option (otherwise the footnote marker hyperlink would be inside the hyperlink around the link text which would result in a nested hyperlink).\footnote
in the post-link hook won’t cause a nested link. This means that the hyperfirst=false option isn’t required: \usepackage
[postdot,stylemods]{glossaries-extra}
\gls
or \glsdesc
in the post-link hook as you can end up with infinite recursion. Use commands that don’t themselves have a post-link hook, such as \glsentrydesc
or \glossentrydesc
, instead.
This can be changed to: \renewcommand
*{\glsentryfmt
}{%
\glsgenentryfmt
\ifglsused
{\glslabel
}{}{\footnote
{\glsentrydesc
{\glslabel
}}}}
This sets the post-link hook for the general category (which is the default category for entries defined with \glsdefpostlink
{general}% category label
{\glsxtrifwasfirstuse
{\footnote
{\glsentrydesc
{\glslabel
}}}{}}
\newglossaryentry
). If I added some abbreviations (which have a different category) then this change wouldn’t apply to them.First use:
So the PDF will have the word “sample” (the link text created by \gls
{sample}.
) as a hyperlink to the entry in the glossary followed by the footnote marker, which is a hyperlink to the footnote. This is then followed by the sentence terminator. “First use: sample¹.”\gls
{sample}
You may prefer to use \glsdefpostlink
{general}% category label
{\glsxtrifwasfirstuse
{\glsxtrdopostpunc
{\footnote
{\glsentrydesc
{\glslabel
}}}}%
{}%
}
\glossentrydesc
instead of \glsentrydesc
. This will obey the glossdesc category attribute. If you append \glspostdescription
, you can also pick up the postdot package option. For example:
Alternatively, you could just use \glssetcategoryattribute
{general}{glossdesc}{firstuc}
\glsdefpostlink
{general}% category label
{\glsxtrifwasfirstuse
{\glsxtrdopostpunc
{\footnote
{%
\glossentrydesc
{\glslabel
}\glspostdescription
}}}%
{}%
}
\Glsentrydesc
and explicitly append the full stop.pdflatex sample-custom-acronym
makeglossaries sample-custom-acronym
pdflatex sample-custom-acronym
In this case, a style is defined to show the short form in the text with the long form and description in a footnote on first use. The long form is used for the sort value. The short form is displayed in small caps in the main part of the document but in uppercase in the list of acronyms. (So it’s a slight variation of some of the examples above.) The name is set to the long form (starting with an initial capital) followed by the all caps short form in parentheses. The final requirement is that the inline form should show the long form followed by the short form in parentheses.
(See the glossaries-extra user manual for further details.)\newabbreviationstyle
{custom-fn}%
{%
\GlsXtrUseAbbrStyleSetup
{short-sc-footnote-desc}%
}%
{%
\GlsXtrUseAbbrStyleFmts
{short-sc-footnote-desc}%
\renewcommand
*{\glsxtrinlinefullformat
}[2]{%
\glsfirstlongfootnotefont
{\glsaccesslong
{##
1}%
\ifglsxtrinsertinside
##
2\fi
}%
\ifglsxtrinsertinside
\else
##
2\fi
\glsxtrfullsep
{##
1}%
\glsxtrparen
{\glsfirstabbrvscfont
{\glsaccessshort
{##
1}}}%
}%
\renewcommand
*{\glsxtrinlinefullplformat
}[2]{%
\glsfirstlongfootnotefont
{\glsaccesslongpl
{##
1}%
\ifglsxtrinsertinside
##
2\fi
} \ifglsxtrinsertinside
\else
##
2\fi
\glsxtrfullsep
{##
1}%
\glsxtrparen
{\glsfirstabbrvscfont
{\glsaccessshortpl
{##
1}}}%
} \renewcommand
*{\Glsxtrinlinefullformat
}[2]{%
\glsfirstlongfootnotefont
{\Glsaccesslong
{##
1}%
\ifglsxtrinsertinside
##
2\fi
}%
\ifglsxtrinsertinside
\else
##
2\fi
\glsxtrfullsep
{##
1}%
\glsxtrparen
{\glsfirstabbrvscfont
{\glsaccessshort
{##
1}}}%
}%
\renewcommand
*{\Glsxtrinlinefullplformat
}[2]{%
\glsfirstlongfootnotefont
{\Glsaccesslongpl
{##
1}%
\ifglsxtrinsertinside
##
2\fi
}%
\ifglsxtrinsertinside
\else
##
2\fi
\glsxtrfullsep
{##
1}%
\glsxtrparen
{\glsfirstabbrvscfont
{\glsaccessshortpl
{##
1}}}%
}%
}
Remember that if you decide to use \setabbreviationstyle
[acronym]{custom-fn}
\newabbreviation
instead of \newacronym
then the category will be abbreviation not acronym:
This custom style simply adjusts the inline full form. There are other adjustments to be made that apply to the inherited style. (The alternative is to design a new style from scratch.) The footnote contains the long form followed by the description. This is the same as the modification to an earlier example: \setabbreviationstyle
{custom-fn}
As with sampleCustomAcr.tex, if you specifically want the singular long form then you can ignore the second argument. For example: \renewcommand
*{\glsxtrabbrvfootnote
}[2]{\footnote
{#2:
\glsentrydesc
{#1}.}}
\renewcommand
*{\glsxtrabbrvfootnote
}[2]{\footnote
{\Glsfmtlong
{#1}: \glsentrydesc
{#1}.}}
The inherited abbreviation style uses the short form as the sort value by default. This needs to be changed to the long form: \renewcommand
*{\glsxtrfootnotedescname
}{%
\protect
\glsfirstlongfootnotefont
{\makefirstuc
{\the
\glslongtok
}}
(\protect
\glsuppercase
{\the
\glsshorttok
})%
}
\renewcommand
*{\glsxtrfootnotedescsort
}{\the
\glslongtok
}
pdflatex sample-dot-abbr
makeglossaries sampledot-abbrf
pdflatex sample-dot-abbr
This example creates a custom storage key that provides a similar function to glossaries-extra’s category key.
can now be removed.\glsaddstoragekey
{abbrtype}{word}{\abbrtype
}
\newacr
command). The abbreviation styles can be set with:
The discardperiod category attribute will discard any full stop (period) following commands like \setabbreviationstyle
[acronym]{long-short}
\setabbreviationstyle
[initials]{long-short}
\gls
:
(If you want to use the noshortplural attribute then you will also need to set the pluraldiscardperiod attribute.)\glssetcategoryattribute
{initials}{discardperiod}{true}
\gls
. This is useful for styles where the first use doesn’t end with the short form. In this case, the first use of the long-short style ends with a closing parenthesis, so the end of sentence might be clearer if the period is retained: \glssetcategoryattribute
{initials}{retainfirstuseperiod}{true}
\glssetcategoryattribute
{initials}{insertdots}{true}
The definitions need to be slightly modified to work with the insertdots attribute: \newcommand
*{\newabbr
}[1][]{%
\newabbreviation
[category=initials,#1]}
(This makes it much easier to change your mind if you decide at a later date to omit the dots, especially if you are storing all your definitions in a file that’s shared across multiple documents, but note the need to group “Sc”.)\newabbr
{eg}{eg}{eg}
\newabbr
{ie}{ie}{ie}
\newabbr
{bsc}{B{Sc}}{Bachelor of Science}
\newabbr
{ba}{BA}{BA}
\newabbr
{agm}{AGM}{AGM}
The remaining code in the document preamble must now be removed. (It will interfere with glossaries-extra’s category post-link hooks.) No change is required in the document body.\newacronym
{laser}{laser}{light amplification by stimulated
emission of radiation}
pdflatex sample-font-abbr
makeglossaries sample-font-abbr
pdflatex sample-font-abbr
The acronym mechanism provided by the base glossaries package isn’t well suited to having a mixture of styles. This example provides a workaround that involves defining a new storage key with \glsaddstoragekey
that’s used to hold the font declaration (such as \em
).
A new custom acronym style is defined that fetches the font information from this new key so that it can be applied to the acronym. Some helper commands are also provided to define the different types of acronyms: \glsaddstoragekey
{font}{}{\entryfont
}
This makes the first use of \newcommand
*{\newitabbr
}[1][]{\newacronym
[font=\em
,#1]}
\newcommand
*{\newupabbr
}{\newacronym
}
\newitabbr
{eg}{e.g.}{exempli gratia}
\newupabbr
{bsc}{BSc}{Bachelor of Science}
appear as “exempli gratia (e.g.)” whereas the first use of \gls
{eg}
is “Bachelor of Science (BSc)”.\gls
{bsc}\usepackage
command needs adjusting:
The custom storage key can now be removed and also the custom acronym style. Now replace the \usepackage
[postdot,stylemods]{glossaries-extra}
\setacronymstyle
line with:
and change the definition of the helper commands: \setabbreviationstyle
[acronym]{long-short-em}
Note that the \newcommand
*{\newitabbr
}{\newacronym
}
\newcommand
*{\newupabbr
}{\newabbreviation
}
font=\em,
part has been removed from the definition of the first command and the second command uses \newabbreviation
instead of \newacronym
. This means that \newitabbr
will default to category={acronym} and \newupabbr
will default to category={abbreviation}. The default style for the abbreviation category is long-short, which is the required style for this example. This just means that only the acronym category needs to have the style set (with the above \setabbreviationstyle
command).\acrshort
, \acrlong
and \acrfull
commands need to be replaced with \glsxtrshort
, \glsxtrlong
and \glsxtrfull
.
Or you can manually insert the space factor adjustment with \glssetcategoryattribute
{acronym}{insertdots}{true}
\glssetcategoryattribute
{acronym}{discardperiod}{true}
\newitabbr
{eg}{eg}{exempli gratia}
\newitabbr
{ie}{ie}{id est}
\@
and only use the discardperiod attribute: \glssetcategoryattribute
{acronym}{discardperiod}{true}
\newitabbr
{eg}{e.g.\@
}{exempli gratia}
\newitabbr
{ie}{i.e.\@
}{id est}
\setabbreviationstyle
[latinabbr]{long-short-em}
\newcommand
*{\newlatinabbr
}[1][]{\newabbreviation
[category={latinabbr},#1]}
\glssetcategoryattribute
{latinabbr}{insertdots}{true}
\glssetcategoryattribute
{latinabbr}{discardperiod}{true}
\newlatinabbr
{eg}{e.g.\@
}{exempli gratia}
\newlatinabbr
{ie}{i.e.\@
}{id est}
18.3. Non-Page Locations
pdflatex sampleEq
makeglossaries sampleEq
pdflatex sampleEq
The glossaries package provides some location formats, such as hyperrm and hyperbf, that allow the locations in the number list to hyperlink to the appropriate place in the document (if hyperref has been used). Since it’s not possible to include the hyperlink name in the indexing information with makeindex and xindy, the glossaries package has to reform the name from a prefix and the location value.\theHequation
so that it has a format that fits the requirement:
If you don’t do this, the equation locations in the glossary won’t form valid hyperlinks.\renewcommand
*\theHequation
{\theHchapter
.\arabic
{equation}}
\newglossaryentry
{Gamma}{name={\ensuremath
{\Gamma
(z)}},
description={Gamma function},sort={Gamma}}
\theHequation
is still required. If record=nameref is used instead then the redefinition of \theHequation
isn’t required. You may also want to use the stylemods and postdot options:
The entries now need to be converted into the bib format required by bib2gls, which can be done with convertgls2bib: \usepackage
[record=nameref,stylemods,postdot,
ucmark,style=long3colheader,counter=equation]{glossaries-extra}
convertgls2bib --preamble-only sampleEq.tex entries.bib
This will create a file called entries.bib that starts: % Encoding: UTF-8
You may prefer to change @entry
{Gamma,
name={\ensuremath
{\Gamma
(z)}},
description={Gamma function}
}
@entry
to @symbol
. (This should be easy to do with your text editor’s search and replace function.)@entry
and @symbol
is that with @entry
the sort value will be obtained from the name but with @symbol
the sort value will be obtained from the label. If you explicitly use the sort key then you will break this behaviour. (If you try this example out, notice the difference in the ordering if you switch between @entry
and @symbol
. See also bib2gls gallery: sorting.)\makeglossaries
with:
If you have used record=nameref then you can remove the redefinition of \GlsXtrLoadResources
[src={entries}]
\theHequation
. Next remove all the lines defining the glossary entries (since they’re now defined in the bib file). \printglossary
with \printunsrtglossary
:
The rest of the document remains unchanged (unless you want to use \printunsrtglossary
[title={Index of Special Functions and Notations}]
\glsxtrfmt
as described in the following example).pdflatex sampleEqPg
makeglossaries sampleEqPg
pdflatex sampleEqPg
pdflatex sampleEqPg
As with the previous example, entries are defined like this:
The counter=equation package option is used to set the default indexing counter to equation. This means that it has to be changed for indexing outside of any numbered equation. For example: \newglossaryentry
{Gamma}name={\ensuremath
{\Gamma
(z)}},
description={Gamma function},sort={Gamma}
I’ve set the format to hyperbf to indicate that this is a primary reference. (Note that I’m using hyperbf not textbf in order to include a hyperlink in the location.)\glslink
[format=hyperbf,counter=page]{Gamma}{gamma function}
\glsdesc
instead of \glslink
. If I change the entry descriptions so that they all start with a lowercase letter then I would need to create a custom glossary style that used \Glossentrydesc
instead of \glossentrydesc
.
The entries are now all defined so that the description starts with a lowercase letter (except for the descriptions that start with a proper noun). For example: \usepackage
[style=long3colheader,postdot,stylemods,
counter=equation]{glossaries-extra}
The glossdesc category attribute needs setting: \newglossaryentry
{Gamma}{name={\ensuremath
{\Gamma
(z)}},
description={gamma function},sort={Gamma}}
This means that I can now use \glssetcategoryattribute
{general}{glossdesc}{firstuc}
\glsdesc
instead of \glslink
.[format=hyperbf,counter=page]
for each primary reference, but glossaries-extra provides a convenient way of having a third modifier for commands like \gls
and \glstext
. This needs to be a single punctuation character (but not *
or +
which are already in use). For example:
Now \GlsXtrSetAltModifier
{!}{format=hyperbf,counter=page}
is equivalent to: \glsdesc
!{Gamma}
So the text at the start of the “Gamma Functions” chapter is now just: \glsdesc
[format=hyperbf,counter=page]{Gamma}
The
which is much more compact. Similar changes can be made for the other instance of \glsdesc
!{Gamma} is defined as
\glslink
where the link text is just the description: The
\glsdesc
!{erf} is defined as
\glslink
, such as:
If I just use \glslink
{Gamma}{\Gamma
(x+1)}
then I would get \(\Gamma (z)\) as the link text. For entries like this that represent functions with variable parameters it would be more convenient (and help with consistency) if a command was available to easily replace the parameters.\gls
{Gamma}
and then use: \newglossaryentry
{Gamma}{name={\ensuremath
{\Gamma
(z)}},
symbol={\ensuremath
{\Gamma
}},
description={gamma function},sort={Gamma}}
(which includes the function parameter inside the link text) or just: \glssymbol
{Gamma}[(\Gamma
(x+1))]
(which has the function parameter after the link text). This is a convenient approach where the extra material can simply follow the symbol, and it can also be used with glossaries-extra.\glssymbol
{Gamma}(\Gamma
(x+1))
The control sequence name (the command name without the leading backslash) is stored in the field identified by the command \newcommand
{\Gammafunction
}[1]{\Gamma
(#1)}
\GlsXtrFmtField
(this should be the internal field name not the key name, see Table 4.1). The default is useri which corresponds to the user1 key. This means that the “Gamma” entry would need to be defined with user1={Gammafunction}. With this approach, each function entry would need a separate associated command.\glslabel
within the link text:
(Obviously, this command can’t be used outside of the link text or post-link hooks since it uses \newcommand
{\entryfunc
}[1]{\glsentrysymbol
{\glslabel
}(#1)}
\glslabel
.)
(This doesn’t need to be done for the “C” and “G” entries since they’re constants not functions.)\newglossaryentry
{Gamma}{name={\ensuremath
{\Gamma
(z)}},
symbol={\ensuremath
{\Gamma
}},user1={entryfunc},
description={gamma function},sort={Gamma}}
The entries can now be defined using this custom \newcommand
{\func
}[2]{#1(#2)}
\newcommand
{\entryfunc
}[1]{\func
{\glsentrysymbol
{\glslabel
}}{#1}}
\newcommand
{\newfunc
}[5][]{%
\newglossaryentry
{#2}{name={\ensuremath
{\func
{#3}{#4}}},
symbol={#3},
user1={entryfunc},
description={#5},
sort={#2},#1
}%
}
\newfunc
command. For example: \newfunc
{Gamma}{\Gamma
}{z}{gamma function}
\newfunc
[sort={gamma1}]{gamma}{\gamma
}{\alpha
,x}{lower
incomplete gamma function}
\newfunc
[sort={Gamma2}]{iGamma}{\Gamma
}{\alpha
,x}{upper
incomplete gamma function}
\newfunc
the symbol key doesn’t have its value encapsulated with \ensuremath
so \glssymbol
will need to explicitly be placed in math mode. If you switch to a glossary style that displays the symbol, you will either need to adjust the definition of \newfunc
to use \ensuremath
in the symbol field or you can add the encapsulation with the glosssymbolfont category attribute.
can simply be replaced with \glslink
{Znu}{Z_\nu}
(no parameter is required in this case). For the other cases, where the parameter is different from that given in the text field (which is obtained from the name), you can use \glssymbol
{Znu}\glsxtrfmt
. For example,
can now be replaced with: \glslink
{Gamma}{\Gamma(x+1)}
This effectively works like \glsxtrfmt
{Gamma}{x+1}
\glslink
but omits the post-link hook. (See the glossaries-extra user manual for further details.)\glsxtrfmt
within the argument of another \glsxtrfmt
command (or inside any other link text).
can now be replaced with: \glslink
{Gamma}{\Gamma(\alpha)}
Note that it’s still possible to use: \glsxtrfmt
{Gamma}{\alpha
}
You may prefer to define a helper command that makes it easier to switch between your preferred method. For example: \glssymbol
{Gamma}[(\alpha
)]
or: \newcommand
*{\Fn
}[3][]{\glssymbol
[#1]{#2}[(#3)]}
\newcommand
*{\Fn
}[3][]{\glsxtrfmt
[#1]{#2}{#3}}
\newcommand
so it will be able to parse the custom \newfunc
commands.pdflatex sampleSec
makeglossaries sampleSec
pdflatex sampleSec
pdflatex sampleSec
Note that there are conflicting location formats, which trigger a warning from makeindex: ## Warning (input = sampleSec.glo, line = 6; output = sampleSec.gls, line = 9):
-- Conflicting entries: multiple encaps for the same page under same key.
## Warning (input = sampleSec.glo, line = 2; output = sampleSec.gls, line = 10):
-- Conflicting entries: multiple encaps for the same page under same key.
This is the result of indexing an entry multiple times for the same location with different values of the format key (encaps). (makeindex assumes that the location is a page number)\gls
[format=hyperit]{ident}
\glspl
{ident} % default format=glsnumberformat
\gls
*[format=hyperbf]{ident}
Multiple encaps detected. Attempting to remedy.
Reading sampleSec.glo...
Writing sampleSec.glo...
Retrying
(Range formats have highest precedence. The default glsnumberformat has the lowest precedence.)
then the conflict will be resolved using the number format attribute list order of priority. In this case, glsnumberformat has the highest priority. This means that only the upright medium weight entry (2.1) will be present. The simplest way of altering this is to provide your own custom format. For example: \usepackage
[xindy,style=altlist,toc,counter=section]{glossaries}
and change \newcommand
*{\primary
}[1]{\hyperit
{#1}}
\GlsAddXdyAttribute
{primary}
to \gls
[format=hyperit]
etc. This will give format=primary the highest priority. (It’s also better practice to provide this kind of semantic command.)\gls
[format=primary]\usepackage
[style=altlist,postdot,stylemods,counter=section]
{glossaries-extra}
convertgls2bib --preamble-only sampleSec.tex entries.bib
\makeglossaries
with:
and remove all the \GlsXtrLoadResources
[src={entries}]
\newglossaryentry
commands.\printglossaries
with \printunsrtglossaries
. The document build is now: pdflatex sampleSec
bib2gls sampleSec
pdflatex sampleSec
As with the original example, there’s still a location format conflict, which bib2gls warns about: Warning: Entry location conflict for formats: hyperbf and hyperit
Discarding: {ident}{}{section}{hyperbf}{2.1}
Conflicts with: {ident}{}{section}{hyperit}{2.1}
This means that it has discarded the bold location and kept the italic one. (As with makeglossaries, range formats have the highest priority and glsnumberformat has the lowest.)
Now bib2gls needs to be invoked with the appropriate mapping with the --map-format or -m switch: \newcommand
*{\hyperbfit
}[1]{\textbf
{\hyperit
{#1}}}
bib2gls -m "hyperbf:hyperbfit,hyperit:hyperbfit" sampleSec
If you are using arara the directive should be: % arara: bib2gls: { mapformats: [ [hyperbf, hyperbfit],
% arara: --> [hyperit, hyperbfit] ] }
\glsxtr
locfmt{ }{ }
\glsxtrsectionlocfmt
. It takes two arguments: the first is the location and the second is the title. For example:
(The only command of this type that is defined by default is the one for the equation counter, \newcommand
*{\glsxtrsectionlocfmt
}[2]{\S
#1 #2}
\glsxtrequationlocfmt
.) Make sure that you have at least version 1.42 of glossaries-extra.18.4. Multiple Glossaries
pdflatex sampleNtn
makeglossaries sampleNtn
pdflatex sampleNtn
pdflatex sampleNtn
Note that if you want to call makeindex explicitly instead of using the makeglossaries or makeglossaries-lite scripts then you need to call makeindex twice:
This document creates a new glossary using: main
glossary (all on one line): makeindex -s sampleNtn.ist -t sampleNtn.glg -o sampleNtn.gls sampleNtn.glo
makeindex -s sampleNtn.ist -t sampleNtn.nlg -o sampleNtn.not sampleNtn.ntn
This defines a glossary that can be identified with the label “notation” with the default title “Notation”. The other arguments are the file extensions required with Options 2 and 3. For those two options, the glossaries package needs to know the input and output files required by makeindex or xindy. \newglossary
[nlg]{notation}{not}{ntn}{Notation}
\newglossary*
{notation}{Notation}
:
(colon) active you will need to change the prefix.) For example, the term “set” is defined as:
and the set notation is defined as: \newglossaryentry
{gls:set}{name={set},
description={A collection of distinct objects}}
Notice that the latter description contains \newglossaryentry
{not:set}{type={notation},
name={\ensuremath
{\mathcal
{S}}},
description={A \gls
{gls:set}},sort={S}}
\gls
. This means you shouldn’t use \glsdesc
with this entry otherwise you will end up with nested links.
There are convenient shortcuts for common fields: \glsxtrp
{ }{ }
(for the short field) and \glsps
{ }
(for the text field). So the set notation definition can be modified: \glspt
{ }
This will stop the inner reference from causing interference if you use \newglossaryentry
{not:set}{type={notation},
name={\ensuremath
{\mathcal
{S}}},
description={A \glspt
{gls:set}},sort={S}}
\glsdesc
. It will also suppress indexing within the glossary but will have a hyperlink (if hyperref is used).\gls
that automatically insert a prefix. For example:
(there’s no point providing commands for plural or case-changing with symbols). Now \glsxtrnewgls
{not:}{\sym
}
\glsxtrnewglslike
{gls:}{\term
}{\termpl
}{\Term
}{\Termpl
}
can be replaced with \gls
{not:set}\sym{set}
and
can be replaced with \gls
{gls:set}\term{set}
.
As with earlier examples, convertgls2bib can be used to convert the entry definitions into the required bib format. You may prefer to split the entries into separate files according to type. (Requires at least bib2gls v2.0.) This is useful if you want to reuse a large database of entries across multiple documents as it doesn’t lock you into using a specific glossary. For example: \usepackage
[record,postdot,stylemods]{glossaries-extra}
convertgls2bib --split-on-type --preamble-only sampleNtn.tex entries.bib
This will create a file called entries.bib that contains the entries that didn’t have a type assigned in the original file, such as:
It will also create a file called notation.bib that contains the entries that had the type set to “notation” in the original file, such as: @entry
{gls:set,
name={set},
description={A collection of distinct objects}
}
Note that the type field has been removed. The above entry in the notation.bib file references a term in the entries.bib file. It’s possible to strip all the prefixes from the bib files and get bib2gls to automatically insert them. In which case, this cross-reference needs adjusting to indicate that it’s referring to an entry in another file. This can be done with one of the special ext prefixes: .@entry
{not:set,
name={\ensuremath
{\mathcal
{S}}},
description={A \glspt
{gls:set}}
}
The corresponding term in the entries.bib file is now: @entry
{set,
name={\ensuremath
{\mathcal
{S}}},
description={A \glspt
{ext1.set}}
}
@entry
{set,
name={set},
description={A collection of distinct objects}
}
\makeglossaries
with:
Remove all the \GlsXtrLoadResources
[src={entries},label-prefix={gls:}]
\GlsXtrLoadResources
[src={notation},type=notation,
label-prefix={not:},ext-prefixes={gls:}]
\newglossaryentry
definitions and replace \printglossaries
with \printunsrtglossaries
.pdflatex sampleNtn
bib2gls sampleNtn
pdflatex sampleNtn
@entry
). You can use your text editor’s search and replace function to replace all instances of @entry
with @symbol
in the notations.bib file so that, for example, the “set” definition becomes:
Now these @symbol
{set,
name={\ensuremath
{\mathcal
{S}}},
description={A \glspt
{ext1.set}}
}
@symbol
entries will be sorted according to their label. (The original label in the bib file, not the prefixed label.) This will put them in the same order as the original document. (See the “Examples” chapter of the bib2gls user manual for examples of varying the sorting and also bib2gls gallery: sorting.)main
glossary. To create the document do: pdflatex sample-dual
makeglossaries sample-dual
pdflatex sample-dual
This defines a custom command \newdualentry
that defines two entries at once (a normal entry and an acronym). It uses \glsadd
to ensure that if one is used then the other is automatically indexed:
A sample dual entry is defined with this command: \newcommand
*{\newdualentry
}[5][]{%
% main entry:
\newglossaryentry
{main-#2}{name={#4},%
text={#3\glsadd
{#2}},%
description={#5},%
#1% additional options for main entry
}%
% acronym:
\newacronym
{#2}{#3\glsadd
{main-#2}}{#4}%
}
This defines an acronym with the label “svm” that can be referenced with \newdualentry
{svm}% label
{SVM}% short form
{support vector machine}% long form
{Statistical pattern recognition technique}% description
but it also defines an entry with the label “main-svm”. This isn’t used in the document with \gls
{svm}\gls
but it’s automatically added from the
code in the short form of “svm”.\glsadd
{main-svm}main
glossary to look up the description. It’s better to simply include the description in the list of acronyms.\gls
) as glossary entries. They appear in the command summary (where the syntax is given with a brief description and the principle location in the document where the command is described) and they also appear in the index (where just the name and location list is shown).
Next, the definition needs to be converted to the bib format required by bib2gls. If you do: \usepackage
[record,postdot,stylemods,acronym]{glossaries-extra}
convertgls2bib --preamble-only sample-dual.tex entries.bib
then convertgls2bib will report the following: Overriding default definition of
This is because convertgls2bib has its own internal definition of \newdualentry
with custom
definition. (Change \newcommand
to \providecommand
if you want
\newdualentry
[options]{label}{short}{long}{description}
converted to @dualabbreviationentry
.)
\newdualentry
, but if it encounters a new definition that will override its default. If you want to retain convertgls2bib’s definition (recommended) then just replace \newcommand
with \providecommand
in the document source and rerun convertgls2bib.\providecommand
, the new entries.bib file created by convertgls2bib contains:
If @dualabbreviationentry
{svm,
short={SVM},
description={Statistical pattern recognition technique},
long={support vector machine}
}
\newcommand
is retained, it will instead contain:
In the first case, bib2gls creates two linked entries using its primary-dual mechanism. In the second case, bib2gls creates two entries that simply reference each other.@entry
{main-svm,
name={support vector machine},
description={Statistical pattern recognition technique},
text={SVM\glsadd
{svm}}
}
@acronym
{svm,
short={SVM\glsadd
{main-svm}},
long={support vector machine}
}
@dualabbreviationentry
, now replace \makeglossaries
with: \GlsXtrLoadResources
[src={entries},% entries.bib
type=acronym
,dual-type=main
,dual-prefix={main-}]
\newdualentry
and the entry definition. Finally, replace \printglossaries
with \printunsrtglossaries
. The document build is: pdflatex sample-dual
bib2gls sample-dual
pdflatex sample-dual
@entry
and @acronym
, then you need:
If you need number lists, the document build is now \setabbreviationstyle
[acronym]{long-short}
\GlsXtrLoadResources
[src={entries}]
pdflatex sample-dual
bib2gls sample-dual
pdflatex sample-dual
bib2gls sample-dual
pdflatex sample-dual
and this time bib2gls complains about the use of \glsadd
within the short and text fields as this can be problematic. (The extra bib2gls and LaTeX calls are to ensure the number list is up to date for the “main-svm” entry, which can only be indexed with \glsadd
after “svm” has been defined.)@dualabbreviationentry
with @dualindexabbreviation
:
This can be mixed with @dualindexabbreviation
{svm,
description={Statistical pattern recognition technique},
short={SVM},
long={support vector machine}
}
@index
terms for example:
The document needs modifying: @index
{machlearn,
name={machine learning}
}
See the bib2gls manual for further details.\documentclass
{article}
\usepackage
[record,postdot,
nostyles,stylemods=bookindex,list,% only want bookindex and list styles
acronym]{glossaries-extra}
\setabbreviationstyle
{long-short-desc}
\GlsXtrLoadResources
[src={entries},% entries.bib
dual-type=acronym
,
label-prefix={idx.},dual-prefix={},
combine-dual-locations={primary}]
\glsxtrnewglslike
{idx.}{\idx
}{\idxpl
}{\Idx
}{\Idxpl
}
\begin{document}
\gls
{svm} and \idx
{machlearn}.
\printunsrtglossary
[type=\acronymtype
,style=altlist]
\printunsrtglossary
[style=bookindex,title={Index}]
\end{document}
pdflatex sample-langdict
makeglossaries sample-langdict
pdflatex sample-langdict
This example uses the nomain package option to prevent the creation of the main
glossary. This means that the document must provide its own glossaries:
This means that if you want to call makeindex explicitly you need to take these new extensions into account: \newglossary
[glg]{english}{gls}{glo}{English to French}
\newglossary
[flg]{french}{flx}{flo}{French to English}
makeindex -s sample-langdict.ist -t sample-langdict.glg -o sample-langdict.gls sample-langdict.glo
makeindex -s sample-langdict.ist -t sample-langdict.flg -o sample-langdict.flx sample-langdict.flo
As with the previous example, this document provides a custom command that defines two related entries:
This has the syntax: \newcommand
*{\newword
}[4]{%
\newglossaryentry
{en-#1}{type={english},name={#2},description={#3 #4}}%
\newglossaryentry
{fr-#1}{type={french},name={#3 #4},text={#4},sort={#4},
description={#2}}%
}
(Note that this trivial example doesn’t take plurals into account.) This custom command will define two terms with labels \newword
{ }{ }{ }{ }
en-
(for the English term) and fr-
(for the French term). So
is equivalent to: \newword
{cat}{cat}{le}{chat}
\newglossaryentry
{en-cat}{type={english},name={cat},description={le chat}}
\newglossaryentry
{fr-cat}{type={french},name={le chat},sort={chat},
description={cat}}
, then the “en-cat” entry will appear in the english glossary but the “fr-cat” entry won’t appear in the french one.\gls
{en-cat}
You don’t need to worry about file extensions now, so it’s simpler to use the starred \usepackage
[record,prefix,postdot,stylemods,nomain]{glossaries-extra}
\newglossary*
:
Next the entries need to be converted to the bib format required by bib2gls: \newglossary
*{english}{English to French}
\newglossary
*{french}{French to English}
convertgls2bib --preamble-only --ignore-type sample-langdict.tex entries.bib
This creates the file entries.bib that contains entries defined like:
(Note that the sort and type fields have been omitted.)@entry
{en-cat,
name={cat},
description={le chat}
}
@entry
{fr-cat,
name={le chat},
description={cat},
text={chat}
}
Similarly for the “chair” entry: @dualentry
{cat,
name={chat},
description={cat},
prefix={le},
prefixplural={les}
}
@dualentry
{chair,
name={chaise},
description={chair},
prefix={la},
prefixplural={les}
}
@dualentry
, the English and French terms are now automatically linked from bib2gls’s point of view. If only one is referenced in the document, the other will also be added by default.\GlsXtrLoadResources
[src={entries},% entries.bib
append-prefix-field={space},
category={same as type},dual-category={same as type},
label-prefix={en-},dual-prefix={fr-},
type=english,dual-type=french,
sort=en,dual-sort=fr]
\newcommand
{\FrEncap
}[1]{%
\foreignlanguage
{french}{\glsentryprefix
{\glscurrententrylabel
}#1}}
\newcommand
{\EnEncap
}[1]{\foreignlanguage
{english}{#1}}
\glssetcategoryattribute
{english}{glossnamefont}{EnEncap}
\glssetcategoryattribute
{english}{glossdescfont}{FrEncap}
\glssetcategoryattribute
{french}{glossnamefont}{FrEncap}
\glssetcategoryattribute
{french}{glossdescfont}{EnEncap}
\makeglossaries
, the definition of \newword
and the entry definitions from the document preamble, and replace \printglossary
with: \printunsrtglossary
\glsxtrnewglslike
so you don’t have to worry about the label prefix (“en-” and “fr-”). See the glossaries-extra manual for further details.pdflatex sample-index
makeglossaries sample-index
pdflatex sample-index
makeglossaries sample-index
pdflatex sample-index
18.5. Sorting
pdflatex samplePeople
makeglossaries samplePeople
pdflatex samplePeople
pdflatex samplePeople
This provides two commands for typesetting a name:
where the first argument contains the forenames and the second is the surname. The first command is the one required for sorting the name and the second is the one required for displaying the name in the document. A synonym is then defined: \newcommand
{\sortname
}[2]{#2, #1}
\newcommand
{\textname
}[2]{#1 #2}
This command defaults to the display name command (\let
\name
\textname
\textname
) but is temporarily redefined to the sort name command (\sortname
) within the sort field assignment hook:
The people are defined using the custom \renewcommand
{\glsprestandardsort
}[3]{%
\let
\name
\sortname
\edef
#1{\expandafter
\expandonce
\expandafter
{#1}}%
\let
\name
\textname
\glsdosanitizesort
}
\name
command:
Since \newglossaryentry
{joebloggs}{name={\name
{Joe}{Bloggs}},
description={\nopostdesc
}}
\name
is temporarily changed while the sort key is being assigned, the sort value for this entry ends up as “Bloggs, Joe”, but the name appears in the document as “Joe Bloggs”.
Next it’s necessary to convert the entry definitions to the bib format required by bib2gls. You can simply do: \usepackage
[record,stylemods,style=listgroup]{glossaries-extra}
convertgls2bib --preamble-only samplePeople people.bib
which will create a file called people.bib that contains definitions like:
However, you may prefer to use the --index-conversion (-i) switch: @entry
{joebloggs,
name={\name
{Joe}{Bloggs}},
description={\nopostdesc
}
}
convertgls2bib -i --preamble-only samplePeople people.bib
This will discard the description field and use @index
instead of @entry
if the description is either empty or simply set to \nopostdesc
or \glsxtrnopostpunc
. The people.bib file now contains definitions like:
Regardless of which approach you used to create the bib file, you now need to edit it to provide a definition of the custom @index
{joebloggs,
name={\name
{Joe}{Bloggs}}
}
\name
command for bib2gls’s use:
Note the use of @preamble
{"\providecommand
{\name
}[2]{#2, #1}"}
\providecommand
instead of \newcommand
.\makeglossaries
, the definitions of \sortname
, \textname
, \name
, \glsprestandardsort
, and all the entry definitions. Then add the following to the document preamble:
Next, use your text editor’s search and replace function to substitute all instances of \newcommand
{\name
}[2]{#1 #2}
\GlsXtrLoadResources
[src={people}]
\glsentrytext
in the chapter headings with \glsfmttext
. For example:
Finally, replace \chapter
{\glsfmttext
{joebloggs}}
\printglossaries
with:
The document build is now: \printunsrtglossaries
pdflatex samplePeople
bib2gls samplePeople
pdflatex samplePeople
pdflatex samplePeople
The third LaTeX call is required to ensure that the PDF bookmarks are up to date, as the entries aren’t defined until after the bib2gls run (which is why you have to use \glsfmttext
instead of \glsentrytext
).\name
provided in @preamble
, but the document uses the definition of \name
provided before \GlsXtrLoadResources
. The use of \providecommand
in @preamble
prevents \name
from being redefined within the document.pdflatex sampleSort
makeglossaries sampleSort
pdflatex sampleSort
pdflatex sampleSort
This document has three glossaries (main
, acronym
and a custom notation
), so if you want to use makeindex explicitly you will need to have three makeindex calls with the appropriate file extensions: pdflatex sampleSort
makeindex -s sampleSort.ist -t sampleSort.alg -o sampleSort.acr sampleSort.acn
makeindex -s sampleSort.ist -t sampleSort.glg -o sampleSort.gls sampleSort.glo
makeindex -s sampleSort.ist -t sampleSort.nlg -o sampleSort.not sampleSort.ntn
pdflatex sampleSort
pdflatex sampleSort
It’s much simpler to just use makeglossaries or makeglossaries-lite.
The sort hook is then redefined to increment this counter and assign the sort key to that numerical value, but only for the \newcounter
{sortcount}
notation
glossary. The other two glossaries have their sort keys assigned as normal:
This means that makeindex will sort the notation in numerical order.\renewcommand
{\glsprestandardsort
}[3]%
\ifdefstring
{#2}{notation}%
{%
\stepcounter
{sortcount}%
\edef
#1{\glssortnumberfmt
{\arabic
{sortcount}}}%
}%
{%
\glsdosanitizesort
}%
Either remove \usepackage
[postdot,stylemods,acronym]{glossaries-extra}
\setacronymstyle
and replace all instances of \newacronym
with \newabbreviation
or replace:
with: \setacronymstyle
{long-short}
\setabbreviationstyle
[acronym]{long-short}
\glsprestandardsort
can now be removed. The file extensions for the custom notation glossary are no longer relevant so the glossary definition can be changed to:
The \newglossary*
{notation}{Notation}
\makeglossaries
command now needs to be adjusted to indicate which glossaries need to be processed by makeindex:
Finally, \makeglossaries
[main
,acronym
]
\printglossaries
needs to be replaced with:
Note that the notation glossary, which hasn’t been listed in the optional argument of \printglossary
\printacronyms
\printnoidxglossary
[type=notation,sort=def]
\makeglossaries
, must be displayed with \printnoidxglossary
.main
and acronym
glossaries. No actual sorting is performed for the notation
glossary because, when used with sort=def, \printnoidxglossary
simply iterates over the list of entries that have been indexed.pdflatex sampleSort
makeglossaries sampleSort
pdflatex sampleSort
This time makeglossaries will include the message: only processing subset '
This means that although makeglossaries has noticed the main
,acronym
'
notation
glossary, it will be skipped.notation
glossary: pdflatex sampleSort
makeindex -s sampleSort.ist -t sampleSort.alg -o sampleSort.acr sampleSort.acn
makeindex -s sampleSort.ist -t sampleSort.glg -o sampleSort.gls sampleSort.glo
pdflatex sampleSort
Next the entry definitions need to be convert to the bib format required by bib2gls.\usepackage
[record,postdot,stylemods,acronym]{glossaries-extra}
convertgls2bib -t --preamble-only sampleSort.tex entries.bib
This will create three files:
After the definition of the \newglossaryentry
. For example: @entry
{gls:set,
name={set},
description={A collection of distinct objects}
}
\newacronym
. For example:
If you changed @acronym
{zfc,
short={ZFC},
long={Zermelo-Fraenkel set theory}
}
\newacronym
to \newabbreviation
then @abbreviation
will be used instead: @abbreviation
{zfc,
short={ZFC},
long={Zermelo-Fraenkel set theory}
}
You may prefer to replace @entry
{not:set,
name={$\mathcal
{S}$},
description={A set},
text={\mathcal
{S}}
}
@entry
with @symbol
in this file. notation
glossary (\newglossary
), add: % abbreviation style must be set first:
Delete the remainder of the document preamble (\setabbreviationstyle
[acronym]{long-short}
\GlsXtrLoadResources
[src={entries,abbreviations}]
\GlsXtrLoadResources
[src={notation},% notation.bib
type=notation,sort=unsrt]
\makeglossaries
and entry definitions).
The build process is now: \printunsrtglossaries
pdflatex sampleSort
bib2gls sampleSort
pdflatex sampleSort
main
and acronym
) at the same time. The entries in these glossaries are ordered alphabetically. The second resource command processes the notation
glossary but the entries in this glossary aren’t sorted (and so will appear in the order of definition within the bib file).18.6. Child Entries
\glsrefentry
, so an extra LaTeX run is required: pdflatex sample
makeglossaries sample
pdflatex sample
pdflatex sample
You can see the difference between word and letter ordering if you add the package option order=letter. (Note that this will only have an effect if you use makeglossaries or makeglossaries-lite. If you use makeindex explicitly, you will need to use the -l switch to indicate letter ordering.)
This means that this entry needs to have the sort key set otherwise makeindex will assign it to the “symbol” group, since it starts with a backslash (which makeindex simply treats as punctuation).\newcommand
{\scriptlang
}[1]{\textsf
{#1}}
\newglossaryentry
{Perl}{name={\scriptlang
{Perl}},sort={Perl},
description={A scripting language}}
\nopostdesc
to the description, which suppresses the post-description hook for that entry.
(Remember that the entries are sorted hierarchically.) This will place “glossarylist” before “glossarycol”, but both will come immediately after their parent “glossary” entry.\newglossaryentry
{glossary}{name={glossary},
description={\nopostdesc
},plural={glossaries}}
\newglossaryentry
{glossarycol}{
description={collection of glosses},
sort={2},
parent={glossary}% parent label
}
\newglossaryentry
{glossarylist}{
description={list of technical words},
sort={1},
parent={glossary}% parent label
}
\usepackage
[postdot,stylemods,style=treenonamegroup,order=word,
subentrycounter]{glossaries-extra}
\nopostdesc
in the descriptions with \glsxtrnopostpunc
(using your text editor’s search and replace function). This suppresses the post-description punctuation but not the category post-description hook.
which has the parenthetical material at the start of the description with emphasis, \newglossaryentry
{cow}{name={cow},
plural={cows},% not required as this is the default
user1={kine},
description={(\emph
{pl.}\
cows, \emph
{archaic} kine) an adult female of any bovine animal}
}
which has the parenthetical material at the end of the description without emphasis even though it’s a regular plural, \newglossaryentry
{bravocry}{
description={cry of approval (pl.\
bravos)},
sort={1},
parent={bravo}
}
which has the parenthetical material at the end of the description without emphasis, and \newglossaryentry
{bravoruffian}{
description={hired ruffian or killer (pl.\
bravoes)},
sort={2},
plural={bravoes},
parent={bravo}}
which doesn’t show the plural in the description.\newglossaryentry
{glossary}{name={glossary},
description={\nopostdesc
},
plural={glossaries}}
The post-description hook for the general category can now be set: \newglossaryentry
{cow}{name={cow},
user1={kine},
description={an adult female of any bovine animal}
}
\newglossaryentry
{bravocry}{
description={cry of approval},
sort={1},
parent={bravo}
}
\newglossaryentry
{bravoruffian}{
description={hired ruffian or killer},
sort={2},
plural={bravoes},
parent={bravo}}
\newglossaryentry
{glossary}{name={glossary},
description={\glsxtrnopostpunc
},
plural={glossaries}}
(If you try this example out, notice the difference for the “glossary” entry if you use \glsdefpostdesc
{general}{%
% Has the user1 key been set?
\glsxtrifhasfield
{useri}{\glscurrententrylabel
}%
{\space
(\emph
{pl.}\
\glsentryplural
{\glscurrententrylabel
},
\emph
{archaic} \glscurrentfieldvalue
)%
}%
{%
% The user1 key hasn't been set. Is the plural the same as the
% singular form with the plural suffix appended?
\GlsXtrIfXpFieldEqXpStr
{plural}{\glscurrententrylabel
}%
{\glsentrytext
{\glscurrententrylabel
}\glspluralsuffix
}%
{%
% Sibling check with bib2gls (see below)
}%
{%
% The plural isn't the default. Does this entry have a parent?
\ifglshasparent
{\glscurrententrylabel
} {%
% This entry has a parent.
% Are the plurals for the child and parent the same?
\GlsXtrIfXpFieldEqXpStr
{plural}{\glscurrententrylabel
}%
{\glsentryplural
{\glsentryparent
{\glscurrententrylabel
}}}%
{}% child and parent plurals the same
{%
\space
(\emph
{pl.}\
\glsentryplural
{\glscurrententrylabel
})%
}%
} {\space
(\emph
{pl.}\
\glsentryplural
{\glscurrententrylabel
})}%
}%
}%
}
\nopostdesc
and then replace it with \glsxtrnopostpunc
.) See the glossaries-extra user manual for further details and also glossaries-extra and bib2gls: An Introductory Guide.\glsentryparent
) it’s much harder to access entry’s children or siblings. The \ifglshaschildren
command has to iterate over all entries to determine if any have a parent that matches the given label. This is obviously very time-consuming if you have a large database of entries. It also doesn’t provide a way of determining whether or not the child entries have been indexed.% Sibling check with bib2gls (see below)
indicates where to put the extra code. If you switch to bib2gls and make sure to use save-sibling-count then you can insert the following code in the block above where that comment is:
This uses a custom handler that’s defined as follows: \GlsXtrIfFieldNonZero
{siblingcount}{\glscurrententrylabel
}%
{% siblingcount field value non-zero
\glsxtrfieldforlistloop
% iterate over internal list
{\glscurrententrylabel
} % entry label
{siblinglist} % label of field containing list
{\siblinghandler
} % loop handler
}%
{}% siblingcount field value 0 or empty or missing
The \newcommand
{\siblinghandler
}[1]{%
\GlsXtrIfXpFieldEqXpStr
*{plural}{\glscurrententrylabel
}%
{\glsentryplural
{#1}}%
{}% current entry's plural same as sibling's plural
{%
\space
(\emph
{pl.}\
\glsentryplural
{\glscurrententrylabel
})%
\listbreak
}%
}
\listbreak
command is provided by etoolbox and is used for prematurely exiting a loop. The handler tests if the sibling’s plural field is identical to the current entry’s plural field. If they are the same, it does nothing. If they are different, it displays the current entry’s plural and breaks the loop.
Next the entry definitions need to be converted to the bib format required by bib2gls. This can be done with convertgls2bib: \usepackage
[record,postdot,stylemods,style=treenonamegroup,
subentrycounter]{glossaries-extra}
convertgls2bib --preamble-only sample.tex entries.
The semantic command may be moved to the bib file’s preamble to ensure it’s defined: @preamble
{"\providecommand
{\scriptlang
}[1]{\textsf
{#1}}"}
@entry
has the name field as the sort fallback. If this is also missing then its value is obtained from the parent’s name field (see bib2gls gallery: sorting for other examples).
This isn’t a problem for bib2gls. In this case, the command has been provided in the @entry
{Perl,
name={\scriptlang
{Perl}},
description={A scripting language}
}
@preamble
, but bib2gls strips font information so the sort value becomes “Perl”. If the definition isn’t placed in @preamble
then bib2gls will simply ignore the command (as xindy does) so the sort value will still end up as “Perl”.@entry
{glossarycol,
parent={glossary},
description={collection of glosses}
}
@entry
{glossarylist,
parent={glossary},
description={list of technical words}
}
This command should replace \GlsXtrLoadResources
[src={entries},identical-sort-action=use]
\makeglossaries
. If you want the sibling information (see earlier), then you need to remember to add save-sibling-count to the list of options.\scriptlang
and all the entry definitions) should now be removed.\printglossaries
with \printunsrtglossaries
. The document build is now: pdflatex sample
bib2gls --group sample
pdflatex sample
pdflatex sample
Note use of the --group (or -g) switch, which is needed to support the treenonamegroup style. The third LaTeX call is needed because the document contains \glsrefentry
.\GlsXtrLoadResources
[src={entries},identical-sort-action=use,
break-at=none
]
pdflatex sample-inline
makeglossaries sample-inline
pdflatex sample-inline
pdflatex sample-inline
If you want to convert this document to glossaries-extra, follow the same procedure as above. If you want to use bib2gls then you don’t need the --group switch since no letter groups are required.pdflatex sampletree
makeglossaries sampletree
pdflatex sampletree
The document uses the alttreehypergroup glossary style, which needs to know the widest name for each hierarchical level. This has been assigned manually in the document preamble with \glssetwidest
:
(Level 0 is the top-most level. That is, entries that don’t have a parent.) It’s possible to get glossaries to compute the widest top-level entry with \glssetwidest
{Roman letters} % level 0 widest name
\glssetwidest
[1]{Sigma} % level 1 widest name
\glsfindwidesttoplevelname
but this will iterate over all top-level entries, regardless of whether or not they appear in the glossary. If you have a large database of entries, this will firstly take time and secondly the width may be too large due to an unindexed entry with a big name.
(This example glossary is actually better suited for one of the topic styles provided with glossary-topic, see below.)\usepackage
[style=alttreehypergroup,nolong,nosuper]
{glossaries}
The stylemods package not only patches the original styles provided by the base glossaries package (such as glossary-tree used in this example) but also provides extra helper commands. In this case, it provides additional commands to calculate the widest name. For example, instead of manually setting the widest entry with \usepackage
[style=alttreehypergroup,postdot,nostyles,
stylemods=tree]{glossaries-extra}
\glssetwidest
, you could add the following before the glossary:
This will only take into account the entries that have actually been used in the document, but it can still be time-consuming if you have a large number of entries.\glsFindWidestUsedTopLevelName
\glsFindWidestUsedLevelTwo
\nopostdesc
to prevent the post-description punctuation from being automatically inserted. For example:
With glossaries-extra, you can convert this to \newglossaryentry
{greekletter}{name={Greek letters},
text={Greek letter},
description={\nopostdesc
}}
\glsxtrnopostpunc
which will prevent the post-description punctuation without interfering with the category post-description hook.\newglossaryentry
{C}{name={C},
description={Euler's constant},
category={symbol},
parent={romanletter}}
With glossaries-extra this can be dealt with through the category post-link hook: \newglossaryentry
{pi}{name={pi},
text={\ensuremath
{\pi
}},
first={\ensuremath
{\pi
} (lowercase pi)},
description={Transcendental number},
parent={greekletter}}
The parenthetical material is now stored in the user1 key. For example: \glsdefpostlink
{symbol}{%
\glsxtrifwasfirstuse
{% first use
\glsxtrifhasfield
{useri}{\glslabel
}%
{ (\glscurrentfieldvalue
)}{}%
}%
{}% not first use
}
The category post-description link is also set to ensure that the symbol is displayed after the description in the glossary: \newglossaryentry
{sigma}{name={Sigma},
text={\ensuremath
\Sigma
},
user1={uppercase sigma},
description={Used to indicate summation},
parent={greekletter}}
These modifications only affect entries with the category set to symbol.\glsdefpostdesc
{symbol}{\space
($\glsentrytext
{\glscurrententrylabel
}$)}
The topic style is designed for this kind of hierarchy where all the top-level entries don’t have descriptions. This means that the \usepackage
[style=topic,postdot,nostyles,stylemods={tree,topic}]
{glossaries-extra}
\nopostdesc
and \glsxtrnopostpunc
commands aren’t required. The top-level entries can simply be defined as:
I’ve now loaded both the glossary-tree and glossary-topic packages (via stylemods={tree,topic}). The glossary-topic package can be used without glossary-tree, in which case it will behave more like the normal tree rather than alttree styles (but with different indentation and no description in the top-level). However, if you use \newglossaryentry
{greekletter}{name={Greek letters},
text={Greek letter}, description={}}
\newglossaryentry
{romanletter}{name={Roman letters},
text={Roman letter}, description={}}
\glssetwidest
(provided by glossary-tree) then the topic style will behave more like alttree.\glssetwidest
[1]Sigma
Next convert the entries to the bib format required by bib2gls: \usepackage
[record,style=topic,postdot,nostyles,stylemods={tree,topic}]
{glossaries-extra}
convertgls2bib --preamble-only sampletree.tex entries.bib
Now replace \makeglossaries
with:
I’ve used the set-widest option here to get bib2gls to compute the widest name. (Obviously, it can only do this if it can correctly interpret any commands contained in the name field.)\GlsXtrLoadResources
[src=entries,set-widest]
\glssetwidest
commands can now be removed completely. All the \newglossaryentry
commands also need to be removed from the document preamble. Finally, \printglossaries
needs to be replaced with \printunsrtglossaries
. The document build is now: pdflatex sampletree
bib2gls sampletree
pdflatex sampletree
This is a direct translation from the @entry
{greekletter,
name={Greek letters},
description={},
text={Greek letter}
}
@entry
{romanletter,
name={Roman letters},
description={},
text={Roman letter}
}
\newglossaryentry
commands (after switching to the topic style). There’s a more appropriate entry type:
The @indexplural
{greekletter,
text={Greek letter}
}
@indexplural
{romanletter,
text={Roman letter}
}
@indexplural
entry type doesn’t require the description and will set the name field to the same as the plural field. Since the plural field hasn’t been set it’s obtained by appending “s” to the text field.
The category post-description hook (provided with @entry
{sigma,
user1={uppercase sigma},
parent={greekletter},
description={Used to indicate summation},
name={\ensuremath
{\Sigma
}},
category={symbol}
}
@entry
{C,
parent={romanletter},
name={\ensuremath
{C}},
description={Euler's constant},
category={symbol}
}
\glsdefpostdesc
) should now be removed from the document.@entry
. This means that the sort values end up as \(\Sigma \) and \(\pi \) (bib2gls recognises the commands \Sigma
and \pi
and converts them to the Unicode characters 0x1D6F4 and 0x1D70B).@entry
to @symbol
then you will once again get the order from the original example (“pi” before “Sigma”). This is because the sort fallback for @symbol
is the label not the name. (Remember that the sort fallback is only used if the sort field isn’t set. If you explicitly set the sort field then no fallback is required. See bib2gls gallery: sorting.)
You can then assign the category in the resource set: @symbol
{sigma,
user1={uppercase sigma},
parent={greekletter},
description={Used to indicate summation},
name={\ensuremath
{\Sigma
}}
}
This means that all the entries defined with \GlsXtrLoadResources
[src=entries,set-widest,category={same as entry}]
@symbol
will have the category set to symbol and all the entries defined with @indexplural
will have the category set to indexplural. (Only the symbol category is significant in this example.)18.7. Cross-Referencing
pdflatex sample-crossref
makeglossaries sample-crossref
pdflatex sample-crossref
The document provides a command \alsoname
to produce some fixed text, which can be changed as appropriate (usually within a language hook):
I’ve used \providecommand
{\alsoname
}{see also}
\providecommand
as some packages define this command. This is used to create a “see also” cross-reference with the see key: \newglossaryentry
{apple}{name={apple},description={firm, round fruit},
see={[\alsoname
]{pear}}}
\newglossaryentry
{marrow}{name={marrow},
description={long vegetable with thin green skin and white flesh},
see={[\alsoname
]courgette}}
\glssee
which indexes the term. This behaviour is intended for documents where only the terms that are actually required in the document are defined. It’s not suitable for a large database of terms shared across multiple documents that may or may not be used in a particular document. In that case, you may want to consider using glossaries-extra (see below).
The document build is the same, but now the “marrow” and “zucchini” entries aren’t present in the document.\usepackage
[autoseeindex=false,postdot,stylemods]{glossaries-extra}
\glssee
not via the see key.\alsoname
] can be converted to use the seealso key:
(The provided \newglossaryentry
{apple}{name={apple},description={firm, round fruit},
seealso={pear}}
\newglossaryentry
{marrow}{name={marrow},
description={long vegetable with thin green skin and white flesh},
seealso={courgette}}
\alsoname
definition may be removed.)
This will still produce the desired effect with glossaries-extra for this simple example but, as with sampleAcrDesc.tex, this redefinition isn’t necessary if you have at least glossaries-extra v1.42.\renewcommand
{\glsseeitemformat
}[1]{\textsc
{\glsentryname
{#1}}}
Next the entry definitions need to be converted to the bib format required by bib2gls. \usepackage
[record,postdot,stylemods]{glossaries-extra}
convertgls2bib sample-crossref.tex entries.bib
If you have at least v2.0 then convertgls2bib will absorb the cross-referencing information supplied by:
into the “fruit” definition: \glssee
{fruit}{pear,apple,banana}
Now remove @entry
{fruit,
see={pear,apple,banana},
name={fruit},
description={sweet, fleshy product of plant containing seed}
}
\makeglossaries
and all the entry definition commands (including \glssee
from the document preamble) and add:
Finally, replace \GlsXtrLoadResources
[src=entries]
\printglossaries
with \printunsrtglossaries
. The document build is now: pdflatex sample-crossref
bib2gls sample-crossref
pdflatex sample-crossref
The glossary now contains: apple, banana, courgette and pear. Note that it doesn’t contain fruit, zucchini or marrow.
The glossary now includes fruit, zucchini and marrow.\GlsXtrLoadResources
[src=entries,
selection={recorded and deps and see}]
In this case, the glossary includes fruit and zucchini but not marrow.\GlsXtrLoadResources
[src=entries,
selection={recorded and deps and see not also}]
18.8. Custom Keys
\glsaddkey
). There are two custom keys ed, where the default value is the text field with “ed” appended, and ing, where the default value is the text field with “ing” appended. Since the default value in both cases references the text field, the starred version \glsaddkey*
is required to ensure that the default value is expanded on definition if no alternative has been provided.\newglossaryentry
{jump}{name={jump},description={}}
\newglossaryentry
{run}{name={run},
ed={ran},
ing={running},
description={}}
\newglossaryentry
{waddle}{name=waddle,
ed={waddled},
ing={waddling},
description={}}
\glsentrytext
, that allows the key value to be accessed, and \glstext
that allows the key value to be access with indexing and hyperlinking (where applicable).\glsdisp
. When editing the document source, it’s usually simpler to read: The dog
than \glsdisp
{jump}{jumped} over the duck.
The dog
\glsed
{jump} over the duck.
Next convert the entry definitions to the bib format required by bib2gls: \usepackage
[record]{glossaries-extra}
convertgls2bib --index-conversion --preamble-only sample-newkeys.tex entries.bib
The --index-conversion switch requires at least v2.0 and will convert entries without a description (or where the description is simply \nopostdesc
or \glsxtrnopostpunc
) to @index
instead of @entry
. This means that the new entries.bib file will contain:
Now replace @index
{jump,
name={jump}
}
@index
{run,
ing = {running},
name={run},
ed = {ran}
}
@index
{waddle,
ing = {waddling},
name={waddle},
ed = {waddled}
}
\makeglossaries
with
and delete the \GlsXtrLoadResources
[src=entries]
\newglossaryentry
commands. Finally replace \printglossaries
with \printunsrtglossaries
.pdflatex sample-newkeys
bib2gls sample-newkeys
pdflatex sample-newkeys
Note that there’s no need for the nonumberlist package option when you don’t use bib2gls’s --group switch.
This document illustrates how add custom storage keys (using \glsaddstoragekey
). The document build is: pdflatex sample-storage-abbr
makeglossaries sample-storage-abbr
pdflatex sample-storage-abbr
\abbrtype
.
A custom acronym style is then defined that checks the value of this key and makes certain adjustments depending on whether or not its value is the default “word”.\glsaddstoragekey
{abbrtype}{word}{\abbrtype
}
\glsaddstoragekey
{category}{general}{\glscategory
}
\documentclass
{article}
\usepackage
[postdot]{glossaries-extra}
\makeglossaries
\setabbreviationstyle
[acronym]{short-long}
\newacronym
{radar}{radar}{radio detecting and ranging}
\newacronym
{laser}{laser}{light amplification by stimulated
emission of radiation}
\newacronym
{scuba}{scuba}{self-contained underwater breathing
apparatus}
\newabbreviation
{dsp}{DSP}{digital signal processing}
\newabbreviation
{atm}{ATM}{automated teller machine}
\begin{document}
First use: \gls
{radar}, \gls
{laser}, \gls
{scuba}, \gls
{dsp},
\gls
{atm}.
Next use: \gls
{radar}, \gls
{laser}, \gls
{scuba}, \gls
{dsp},
\gls
{atm}.
\printglossaries
\end{document}
\glsaddstoragekey
and hook into the \gls
-like and \glstext
-like mechanism used to determine whether or not to hyperlink an entry. The document build is: pdflatex sample-chap-hyperfirst
makeglossaries sample-chap-hyperfirst
pdflatex sample-chap-hyperfirst
This example creates a storage key called “chapter” used to store the chapter number.
It’s initialised to 0 and the \glsaddstoragekey
{chapter}{0}{\glschapnum
}
\glslinkpostsetkeys
hook is used to check this value against the current chapter number. If the values are the same then the hyperlink is switched off, otherwise the key value is updated unless the hyperlink has been switched off (through the optional argument of commands like \gls
and \glstext
).
Since this key isn’t intended for use when the entry is being defined, it would be more appropriate to simply use an internal field that doesn’t have an associated key or helper command, but \renewcommand
*{\glslinkpostsetkeys
}{%
\edef
\currentchap
{\arabic
{chapter}}%
\ifnum
\currentchap
=\glschapnum
{\glslabel
}\relax
\setkeys
{glslink}{hyper=false}%
\else
\glsifhyperon
{\glsfieldxdef
{\glslabel
}{chapter}{\currentchap
}}{}%
\fi
}
\glsfieldxdef
requires the existence of the field. The glossaries-extra package provides utility commands designed to work on internal fields that don’t have an associated key and may not have had a value assigned.
The custom storage key (provided with \usepackage
[postdot]{glossaries-extra}
\glsaddstoragekey
) can be removed, and the \glslinkpostsetkeys
hook can be changed to:
The field name is still called “chapter” but there’s no longer an associated key or command.\renewcommand
*{\glslinkpostsetkeys
}{%
\edef
\currentchap
{\arabic
{chapter}}%
\GlsXtrIfFieldEqNum
*{chapter}{\glslabel
}{\currentchap
}
{%
\setkeys
{glslink}{hyper=false}%
}%
{%
\glsifhyperon
{\xGlsXtrSetField
{\glslabel
}{chapter}{\currentchap
}}{}%
}%
}
18.9. Xindy (Option 3)
\pi
}) or is identical to another value (or is identical after xindy has stripped all commands and braces). This section describes sample documents that use features which are unavailable with makeindex.
it will set the style file to samplexdy-mc.xdy instead. This provides an additional letter group for entries starting with “Mc” or “Mac”. If you use makeglossaries or makeglossaries-lite, you don’t need to supply any additional information. If you don’t use makeglossaries, you will need to specify the required information. Note that if you set the style file to samplexdy-mc.xdy you must also specify \setStyleFile
{samplexdy-mc}
\noist
\GlsSetXdyLanguage
{}
\noist
, otherwise the glossaries package will overwrite samplexdy-mc.xdy and you will lose the “Mc” letter group.pdflatex samplexdy
makeglossaries samplexdy
pdflatex samplexdy
If you don’t have Perl installed then you can’t use makeglossaries, but you also can’t use xindy! However, if for some reason you want to call xindy explicitly instead of using makeglossaries (or makeglossaries-lite):
xindy -L english -C utf8 -I xindy -M samplexdy -t samplexdy.glg -o samplexdy.gls samplexdy.glo
xindy -I xindy -M samplexdy-mc -t samplexdy.glg -o samplexdy.gls samplexdy.glo
\gls
to format the location in the number list. The usual type of definition when a hyperlinked location is required should use one of the \hyper
commands listed in Table 12.1:
Unfortunately, this definition doesn’t work for this particular document and some adjustments are needed (see below). As a result of the adjustments, this command doesn’t actually get used by TeX, even though \newcommand
*{\hyperbfit
}[1]{\textit
{\hyperbf
{#1}}}
hyperbfit
is used in the format key. It does, however, need to be identified as an attribute so that xindy can recognise it:
This will add information to the xdy file when it’s created by \GlsAddXdyAttribute
{hyperbfit}
\makeglossaries
. If you prevent the creation of this file with \noist
then you will need to add the attribute to your custom xdy file (see the provided samplexdy-mc.xdy file).\tallynum
{ } that represents its numerical argument with a die or dice where the dots add up to :
This command needs to be robust to prevent it from being expanded when it’s written to any of the auxiliary files. The \newrobustcmd
*{\tallynum
}[1]{%
\ifnum
\number
#1<7
$\csname
dice\romannumeral
#1\endcsname
$%
\else
$\dicevi
$%
\expandafter
\tallynum
\expandafter
{\numexpr
#1-6}%
\fi
}
\dicei
, …, \dicevi
commands are provided by the stix package, so that needs to be loaded.\tally
{ } is defined that formats the value of the named according to \tallynum
:
(This shouldn’t be robust as it needs the counter value to expand.) The page numbers are altered to use this format (by redefining \newcommand
*{\tally
}[1]{\tallynum
{\arabic
{#1}}}
\thepage
).
Again this information is written to the xdy file by \GlsAddXdyLocation
{tally}{% tally location format
:sep "\string
\tallynum
\space
\glsopenbrace
"
"arabic-numbers"
:sep "\glsclosebrace
"
}
\makeglossaries
so if you use \noist
then you need to manually add it to your custom xdy file.
In this case: \glsX
X{ }{ }
or \glsXpageXglsnumberformat
{}{\tallynum
{ }}
This means that although \glsXpageXhyperbfit
{}{\tallynum
{ }}
\hyperbf
is designed to create hyperlinked locations, the presence of \tallynum
interferes with it. In order to make the hyperlinks work correctly, the definitions of \glsXpageXhyperbfit
need to be redefined in order to grab the number part in order to work out the location’s numeric value. If the value of \tally
is changed so that it expands differently then these modifications won’t work.
: \tally
{ }
These need a command that can grab the actual number and correctly encapsulate it: \renewcommand
{\glsXpageXglsnumberformat
}[2]{%
\linkpagenumber
#2%
}
\renewcommand
{\glsXpageXhyperbfit
}[2]{%
\textbf
{\em
\linkpagenumber
#2}%
}
\newcommand
{\linkpagenumber
}[2]{\hyperlink
{page.#2}{#1{#2}}}
\GlsAddLetterGroup
(and not require a custom xdy file) but unfortunately the “M” letter group will have already been defined and take precedence over “Mc”, which is why a custom file is required and the normal language module must be suppressed: \setStyleFile
{samplexdy-mc}
\noist
\GlsSetXdyLanguage
{}
\newglossaryentry
{mach}{name={Mach, Ernst},
first={Ernst Mach},text={Mach},
sort={mach, Ernst},
description={Czech/Austrian physicist and philosopher}}
The xindy-only commands can now all be removed (attribute \usepackage
[record,postdot]{glossaries-extra}
\GlsAddXdyAttribute
, location \GlsAddXdyLocation
, language \GlsSetXdyLanguage
, location encaps \glsX
X and the custom helper \linkpagenumber
). Also \noist
and \setStyleFile
aren’t relevant with bib2gls and so should be removed.\hyperbfit
should be retained (as well as \tallynum
, \tally
and the redefinition of \thepage
).convertgls2bib --preamble-only samplexdy.tex entries.bib
Next replace \makeglossaries
with:
and remove all the entry definitions from the document preamble. Use the search and replace function on your text editor to replace all instances of \GlsXtrLoadResources
[src=entries]
\glsentryfirst
with \glsfmtfirst
, and all instances of \glsentryname
with \glsfmtname
.\printglossaries
with \printunsrtglossaries
. The document build is now: pdflatex samplexdy
bib2gls --group samplexdy
pdflatex samplexdy
|
(pipe) character, so the sort values for bib2gls are Mach|Earnest|
and Mach|number|
. See the bib2gls manual for further details of this option, and also see the examples chapter of that manual for alternative approaches when creating entries that contain people’s names.
Unfortunately, as with xindy, this puts “Mach” into the “Mc” letter group. (See the glossaries-extra manual for details about the sort rule commands.)\GlsXtrLoadResources
[src=entries,
sort=custom,
sort-rule={}\glsxtrGeneralInitRules
<\glsxtrGeneralLatinAtoGrules
<h,H<i,I<j,J<k,K<l,L<Mc=Mac<m,M
<\glsxtrGeneralLatinNtoZrules
]
but not for “Mach”: @entry
{mcadam,
name={\Mac
{Mc}Adam, John Loudon},
description={Scottish engineer},
text={McAdam},
first={John Loudon McAdam}
}
@entry
{maclaurin,
name={\Mac
{Mac}laurin, Colin},
description={Scottish mathematician best known for the \gls
{maclaurinseries}},
text={Maclaurin},
first={Colin Maclaurin}
}
With LaTeX, this command should simply do its argument: @entry
{mach,
name={Mach, Ernst},
description={Czech/Austrian physicist and philosopher},
text={Mach},
first={Ernst Mach}
}
However, when bib2gls works out the sort value, it needs to be defined with something unique that won’t happen to occur at the start of another term. For example: \newcommand
{\Mac
}[1]{#1}
(Remember that break-at=word will strip spaces and punctuation so don’t include them unless you switch to break-at=none.)\providecommand
{\Mac
}[1]{MC}
\Mac
to the tex file and modify entries.bib so that it includes the second definition:
Then modify the “Mc”/“Mac” entries as appropriate (see the above “McAdam” and “Maclaurin” examples).@preamble
{"\providecommand
{\Mac
}[1]{MC}"}
This will create a “Mc” letter group that only includes the names that start with the custom \GlsXtrLoadResources
[src=entries,
write-preamble=false,
sort=custom,
sort-rule=\glsxtrGeneralInitRules
<\glsxtrGeneralLatinAtoGrules
<h,H<i,I<j,J<k,K<l,L<MC<m,M <\glsxtrGeneralLatinNtoZrules
]
\Mac
command.@preamble
into a separate bib file, so that you can choose whether or not to include it. See the “Examples” chapter of the bib2gls user manual for further examples.pdflatex samplexdy2
makeglossaries samplexdy2
pdflatex samplexdy2
The explicit xindy call is: xindy -L english -C utf8 -I xindy -M samplexdy2 -t samplexdy2.glg -o samplexdy2.gls samplexdy2.glo
This example uses the section counter with xindy:
The document employs an eccentric section numbering system for illustrative purposes. The section numbers are prefixed by the chapter number in square brackets: \usepackage
[xindy,counter=section]{glossaries}
Parts use Roman numerals: \renewcommand
*{\thesection
}{[\thechapter
]\arabic
{section}}
The section hyperlink name includes the part: \renewcommand
*{\thepart
}{\Roman
{part}}
This custom numbering scheme needs to be identified in the xdy file: \renewcommand
*{\theHsection
}{\thepart
.\thesection
}
If the part is 0 then \GlsAddXdyLocation
["roman-numbers-uppercase"]{section}{:sep "["
"arabic-numbers" :sep "]" "arabic-numbers"
}
\thepart
will be empty (there isn’t a zero Roman numeral). An extra case is needed to catch this:
Note that this will stop xindy giving a warning, but the location hyperlinks will be invalid if no \GlsAddXdyLocation
{zero.section}{:sep "["
"arabic-numbers" :sep "]" "arabic-numbers"
}
\part
is used.
Next remove the \usepackage
[record,counter=section]{glossaries-extra}
\GlsAddXdyLocation
commands and convert the entry definitions to the bib format required by bib2gls: convertgls2bib --preamble-only samplexdy2.tex entries.bib
Now replace \makeglossaries
with:
and remove the \GlsXtrLoadResources
[src=entries]
\newglossaryentry
commands. Finally, replace \printglossaries
with \printunsrtglossaries
.pdflatex samplexdy2
bib2gls samplexdy2
pdflatex samplexdy2
In this case, the locations will be the actual section headings, rather than the section number. In order to make the number appear instead you need to define: \usepackage
[record=nameref,counter=section]{glossaries-extra}
(Make sure you have at least v1.42 of glossaries-extra.) See also the earlier sampleSec.tex. \newcommand
*{\glsxtrsectionlocfmt
}[2]{#1}
\Numberstring
from the fmtcount package to format the page numbers instead of the \tally
command from the earlier example.pdflatex sampleutf8
makeglossaries sampleutf8
pdflatex sampleutf8
The explicit xindy call is (no line breaks): xindy -L english -C utf8 -I xindy -M sampleutf8 -t sampleutf8.glg -o sampleutf8.gls sampleutf8.glo
pdflatex sampleutf8
makeglossaries sampleutf8
pdflatex sampleutf8
or pdflatex sampleutf8
makeglossaries-lite sampleutf8
pdflatex sampleutf8
you will see that the entries that start with an extended Latin character now appear in the symbols group, and the word “manœuvre” is now after “manor” instead of before it. If you want to explicitly call makeindex (no line breaks): makeindex -s sampleutf8.ist -t sampleutf8.glg -o sampleutf8.gls sampleutf8.glo
Note that you don’t need the nonumberlist option with bib2gls. You can instruct bib2gls to simply not save the number lists, but in this case there won’t be any locations as there’s no actual indexing.\usepackage
[record,postdot,stylemods,style=listgroup]{glossaries-extra}
convertgls2bib --preamble-only --texenc UTF-8 --bibenc UTF-8 sampleutf8.tex entries.bib
Note the first line of the entries.bib file: % Encoding: UTF-8
This is the encoding of the bib file. It doesn’t have to match the encoding of the tex file, but it’s generally better to be consistent. When bib2gls parses this file, it will look for this encoding line. (If the --texenc and --bibenc switches aren’t used, convertgls2bib will assume your Java default encoding. See the bib2gls manual for further details.)\makeglossaries
with:
and remove all the \GlsXtrLoadResources
[src=entries,selection=all]
\newglossaryentry
commands.\glsaddall
don’t work with bib2gls. Instead, you can select all entries using the selection=all option. This is actually better than \glsaddall
, which enforces the selection of all entries by indexing each entry. As a result, with makeindex and xindy (and Option 1), every entry will have the same location (which is the location of the \glsaddall
command, in this case page 1). With selection=all, bib2gls will automatically selection all entries even if they don’t have any records (indexing information) so in this case there are no number lists.\printglossaries
with \printunsrtglossaries
. The build process is now: pdflatex sampleutf8
bib2gls --group sampleutf8
pdflatex sampleutf8
bib2gls picks up the encoding of the tex file from the aux file:
If you experience any encoding issues, check the aux file for this command and check the bib file for the encoding comment line. Also check bib2gls’s glg transcript file for encoding messages, which should look like: \glsxtr@texencoding
{utf8}
TeX character encoding: UTF-8
(Swiss German new orthography) or: \GlsXtrLoadResources
[src=entries,selection=all,sort=de-CH-1996]
(Icelandic).\GlsXtrLoadResources
[src=entries,selection=all,sort=is]
18.10. No Indexing Application (Option 1)
pdflatex sample-noidxapp
pdflatex sample-noidxapp
With old LaTeX kernels and old versions of mfirstuc, it was necessary to group the accent command that occurs at the start of the name:
This used to be necessary to allow the term to work with \newglossaryentry
{elite}{%
name={{\'
e}lite},% mfirstuc v2.07
description={select group of people}
}
\Gls
. With a new kernel and latest versions of glossaries and mfirstuc, this should no longer be necessary. \newglossaryentry
{elite}{%
name={\'
elite},% mfirstuc v2.08
description={select group of people}
}
pdflatex sample-noidxapp-utf8
pdflatex sample-noidxapp-utf8
This method is unsuitable for sorting languages with extended Latin alphabets or non-Latin alphabets. Use Options 3 or 4 instead.18.11. Other
pdflatex sample4col
makeglossaries sample4col
pdflatex sample4col
or pdflatex sample4col
makeglossaries-lite sample4col
pdflatex sample4col
The vertical gap between entries is the gap created at the start of each letter group. This can be suppressed using the nogroupskip package option. (If you switch to bib2gls, simply omit the --group command line option.)\usepackage
{glossaries}
\usepackage
{glossary-longbooktabs}
\setglossarystyle
{altlongragged4col-booktabs}
The glossaries-extra package provides additional styles, including more “long” styles with the glossary-longextra package. For example, the long-name-desc-sym-loc style: \usepackage
[style=altlongragged4col-booktabs,stylemods=longbooktabs]
{glossaries-extra}
If you use the stylemods option with an argument, you may prefer to use it with nostyles to prevent unwanted styles from being automatically loaded. For example: \usepackage
[style=long-name-desc-sym-loc,stylemods=longextra]
{glossaries-extra}
See also the gallery of predefined styles.\usepackage
[style=long-name-desc-sym-loc,nostyles,stylemods=longextra]
{glossaries-extra}
pdflatex sample-numberlist
makeglossaries sample-numberlist
pdflatex sample-numberlist
pdflatex sample-numberlist
This uses the savenumberlist package option, which enables \glsentrynumberlist
and \glsdisplaynumberlist
(with limitations). The location counter is set to chapter, so the number list refers to the chapter numbers.
The number list can’t be obtained until makeindex (or xindy) has created the indexing file. The number list is picked up when this file is input by \usepackage
[savenumberlist,counter=chapter]{glossaries}
\printglossary
and is then saved in the aux file so that it’s available on the next LaTeX run.This is a
Without hyperref, the first list shows as “1–3, 5 & 6” and the second list shows as “1–3, 5, 6”.\gls
{sample} document. \Glspl
{sample}
are discussed in chapters \glsdisplaynumberlist
{sample}
(or \glsentrynumberlist
{sample}).
\glsdisplaynumberlist
with hyperref and Options 2 or 3. If you do, you will get the warning: Package glossaries Warning:
Now both lists show as “1–3, 5, 6”.\glsdisplaynumberlist
doesn't work with hyperref.
Using \glsentrynumberlist
instead
\makeglossaries
with \makenoidxglossaries
and replace \printglossaries
with \printnoidxglossaries
), then the document build is simply: pdflatex sample-numberlist
pdflatex sample-numberlist
Now \glsdisplaynumberlist
works with hyperref, however there are no ranges, so the first list shows as “1, 2, 3, 5, & 6” and the second list shows as “1, 2, 3, 4, 5, 6”.
Note that the savenumberlist option is no longer required. Next convert the entry to the bib format required by bib2gls: \usepackage
[record,counter=chapter]{glossaries-extra}
convertgls2bib sample-numberlist.tex entries.bib
Replace \makeglossaries
with:
and remove the \GlsXtrLoadResources
[src=entries]
\newglossaryentry
command from the document preamble. Finally, replace \printglossaries
with \printunsrtglossaries
. The build process is now: pdflatex sample-numberlist
bib2gls sample-numberlist
pdflatex sample-numberlist
Now both ranges and hyperlinks work. The first list shows “1–3, 5, & 6” and the second list shows “1–3, 5, 6”. You can also use:
which will show the complete list without ranges “1, 2, 3, 5 & 6”.\glsxtrfieldformatlist
{sample}{loclist}
\printglossary
. This means that it’s quite hard to gather information obtained by the indexing application.\printunsrtglossary
, which simply iterates over all defined entries and fetches the required information from those internal fields.\glsdisplaynumberlist
and \glsentrynumberlist
commands are redefined by glossaries-extra-bib2gls to simply access the location field. However, if you want a complete list without ranges you can use:
In this example, this produces “1, 2, 3, 5 & 6”. \glsxtrfieldformatlist
{sample}{loclist}
\glsentryfmt
. The document build is: pdflatex sample-nomathhyper
makeglossaries sample-nomathhyper
pdflatex sample-nomathhyper
This disables the hyperlinks for the main
glossary with:
and then redefines \GlsDeclareNoHyperList
{main
}
\glsentryfmt
so that it adds a hyperlink if not in maths mode and the hyperlinks haven’t been forced off (with the hyper=false key).\usepackage
{glossaries-extra}
\makeglossaries
\renewcommand
{\glslinkpresetkeys
}{%
\ifmmode
\setkeys
{glslink}{hyper=false}\fi
}
% entry definition
pdflatex sample-entryfmt
makeglossaries sample-entryfmt
pdflatex sample-entryfmt
This redefines \glsentryfmt
to add the symbol on first use:
Note the use of \renewcommand
*{\glsentryfmt
}{%
\glsgenentryfmt
\ifglsused
{\glslabel
}{}{\space
(\glsentrysymbol
{\glslabel
})}%
}
\glsentrysymbol
not \glssymbol
(which would result in nested link text).
Note that in this case the symbol is now outside of the hyperlink.\usepackage
[stylemods,style=tree]{glossaries-extra}
\makeglossaries
\glsdefpostlink
{unit}{\glsxtrpostlinkAddSymbolOnFirstUse
}
\newglossaryentry
{distance}{
category={unit},
name={distance},
description={The length between two points},
symbol={km}}
pdflatex sample-prefix
makeglossaries sample-prefix
pdflatex sample-prefix
pdflatex sample-prefix
Remember that the default separator between the prefix and \gls
(or one of its variants) is empty, so if a space is required it must be inserted at the end of the prefix. However, the xkeyval package (which is used to parse the = lists) trims leading and trailing space from the values, so an ordinary space character will be lost. \newglossaryentry
{sample}{name={sample},
description={an example},
prefix={a~
},
prefixplural={the\space
}}
\newglossaryentry
{oeil}{name={oeil},
plural={yeux},
description={eye},
prefix={l'},
prefixplural={les\space
}}
(Alternatively load glossaries-prefix after glossaries-extra.) The rest of the document is the same as for the base glossaries package, unless you want to switch to using bib2gls.\usepackage
[prefix,postdot,acronym]{glossaries-extra}
Next convert the entries into the bib format required by bib2gls: \usepackage
[record,prefix,postdot,acronym]{glossaries-extra}
convertgls2bib --preamble-only sample-prefix.tex entries.bib
Replace \makeglossaries
with
remove the entry definitions from the document preamble, and replace \setabbreviationstyle
[acronym]{long-short}
\GlsXtrLoadResources
[src=entries]
with \printglossary
[style=plist]
\printacronyms
The document build is now: \printunsrtglossary
[style=plist]
\printunsrtacronyms
pdflatex sample-prefix
bib2gls sample-prefix
pdflatex sample-prefix
\space
and non-breaking space (~
) from the entries.bib file:
Now add the append-prefix-field={space or nbsp} resource option: @entry
{sample,
prefix={a},
name={sample},
description={an example},
prefixplural={the}
}
@entry
{oeil,
plural={yeux},
prefix={l'},
name={oeil},
description={eye},
prefixplural={les}
}
@acronym
{svm,
prefixfirst={a},
prefix={an},
short={SVM},
long={support vector machine}
}
See the bib2gls manual for further details.\GlsXtrLoadResources
[src=entries,append-prefix-field={space or nbsp}]
This provides additional keys that aren’t available with just the base package, which may be used to provide replacement text. The replacement text is inserted using accsupp’s \usepackage
[acronym]{glossaries-accsupp}
\BeginAccSupp
and \EndAccSupp
commands. See the accsupp package for further details of those commands.
However, this can cause interference (especially with case-changing). With glossaries-accsupp it’s possible to obtain the field values without the accessibility information if required. (If in the future \newglossaryentry
{Drive}{
name={\BeginAccSupp
{Actual=Drive}Dr.\EndAccSupp
{}},
description={Drive}
}
\newglossaryentry
{image}{name={sample image},
description={an example image},
user1={\protect
\BeginAccSupp
{Alt={a boilerplate image used in examples}}\protect
\includegraphics
[height=20pt]{example-image}\protect
\EndAccSupp
{}}
}
\includegraphics
is given extra options to provide replacement text then the image example here won’t be necessary. However, the example can be adapted for images created with TeX code.)
The first acronym is straightforward: \setacronymstyle
{long-short}
The shortaccess replacement text is automatically set to the long form. The next acronym is awkward as the long form contains formatting commands which can’t be included in the replacement text. This means that the shortaccess key must be supplied: \newacronym
{eg}{e.g.}{for example}
In the above two cases, the short form obtained in \newacronym
[shortaccess={TiKZ ist kein Zeichenprogramm}]
{tikz}{Ti\emph
{k}Z}{Ti\emph
{k}Z ist \emph
{kein} Zeichenprogramm}
\gls
will use the “E” PDF element.\newglossaryentry
instead of \newacronym
. The replacement text is provided in the access key:
These will use the “ActualText” PDF element (not “E”).\newglossaryentry
{Doctor}{name={Dr},description={Doctor},access={Doctor}}
\newglossaryentry
{Drive}{name={Dr.},plural={Drvs},description={Drive},
access={Drive}}
and then referenced in the text like this: \newglossaryentry
{int}{name={int},description={integral},
symbol={\ensuremath
{\int
}}}
Symbol:
This results in the text “Symbol: integral (\(\int \)).” However if you copy and paste this from the PDF you will find the resulting text is “Symbol: int (R).” This is what’s actually read out by the text-to-speech system.\gls
{int} (\glssymbol
{int}).
\BeginAccSupp
command needs to have the options adjusted.\gls
accsupp exists (where is the internal field label, see Table 4.1). Only two of these commands are predefined: \glsshortaccsupp
and \glsshortplaccsupp
, which is why the shortaccess field uses “E”. If the given command doesn’t exist then the generic \glsaccsupp
command is used instead.\glssymbolaccsupp
:
Now I can adjust the definition of the “int” entry: \newcommand
{\glssymbolaccsupp
}[2]{%
\glsaccessibility
[method=hex,unicode]{ActualText}{#1}{#2}%
}
\newglossaryentry
{int}{name={int},description={integral},
symbol={\ensuremath
{\int
}},symbolaccess={222B}
}
\glsuseriaccsupp
:
The image description is provided in the user1access key: \newcommand
{\glsuseriaccsupp
}[2]{%
\glsaccessibility
{Alt}{#1}{#2}%
}
(Note the need to protect the fragile \newglossaryentry
{sampleimage}{name={sample image},
description={an example image},
user1={\protect
\includegraphics
[height=20pt]{example-image}},
user1access={a boilerplate image used in examples}
}
\includegraphics
. The alternative is to use \glsnoexpandfields
before defining the command. See §4.4.)
/Span << /ActualText (Doctor) >> BDC
BT
/F8 9.9626 Tf
73.102 697.123 Td
[ (Dr) ] TJ
ET
EMC
This shows that “ActualText” was used for
. The integral symbol (\(\int \)) created with \gls
{Doctor}
is: \glssymbol
{int}
/Span << /ActualText (\376\377"+) >> BDC
BT
/F1 9.9626 Tf
97.732 650.382 Td
[ (R) ] TJ
ET
EMC
Again, “ActualText” has been used, but the character code has been supplied. The image created with
is: \glsuseri
{sampleimage}
/Span << /Alt (a boilerplate image used in examples) >> BDC
1 0 0 1 106.588 618.391 cm
q
0.08301 0 0 0.08301 0 0 cm
q
1 0 0 1 0 0 cm
/Im1 Do
Q
Q
EMC
This shows that “Alt” has been used.
produces the long form (not reproduced here) followed by the short form: \gls
{eg}
/Span << /E (for example) >> BDC
BT
/F8 9.9626 Tf
161.687 563.624 Td
[ (e.g.) ] TJ
ET
EMC
The subsequent use also has the “E” element:
/Span << /E (for example) >> BDC
BT
/F8 9.9626 Tf
118.543 551.669 Td
[ (e.g.) ] TJ
ET
EMC
Similarly for
. You can also use the debug=showaccsupp package option. This will show the replacement text in the document, but note that this is the content before it’s processed by \acrshort
{eg}\BeginAccSupp
.\setacronymstyle
command is removed (or commented out) then the result would be different. The first use of \gls
uses “E” for the short form but the subsequent use has “ActualText” instead. This is because without \setacronymstyle
the original acronym mechanism is used, which is less sophisticated than the newer acronym mechanism that’s triggered with \setacronymstyle
.
I’m switching from \usepackage
[abbreviations,accsupp]{glossaries-extra}
\newacronym
to \newabbreviation
, which means that the default category is abbreviation and also the file extensions are different. If you are using makeglossaries or makeglossaries-lite you don’t need to worry about it. However, if you’re not using those helper scripts then you will need to adjust the file extensions in your document build process.
needs to be replaced with: \setacronymstyle
{long-short}
This is actually the default so you can simply delete the \setabbreviationstyle
{long-short}
\setacronymstyle
line. Substitute the two instances of \newacronym
with \newabbreviation
. For example:
Note that for the “tikz” entry you can now remove the explicit assignment of shortaccess with glossaries-extra v1.42 as it will strip formatting commands like \newabbreviation
{eg}{e.g.}{for example}
\emph
:
It’s also necessary to replace \newabbreviation
{tikz}{Ti\emph
{k}Z}{Ti\emph
{k}Z ist \emph
{kein} Zeichenprogramm}
\acrshort
, \acrlong
and \acrfull
with \glsxtrshort
, \glsxtrlong
and \glsxtrfull
.\glsdefaultshortaccess
to include the short form. The original definition was restored in glossaries v1.49.
The first use of \newacronym
{Doctor}{Dr}{Doctor}
is just “Dr”. This means that the “E” PDF element will be used instead of “ActualText”. Now I don’t need to supply the accessibility text as its obtained from the long form.\gls
{Doctor}
This looks odd when reading the document source and it’s easy to forgot. This is very similar to the situation in the sample-dot-abbr.tex example. I can again use the discardperiod category attribute, but I need to assign a different category so that it doesn’t interfere with the “Doctor” entry.\gls
{Doctor} Smith lives at 2, Blueberry \gls
{Drive}
In the sample-dot-abbr.tex example, I also used the insertdots attribute to automatically insert the dots and add the space factor (which is adjusted if discardperiod discards a period). In this case I’m inserting the dot manually so I’ve also added the space factor with \setabbreviationstyle
[shortdotted]{short-nolong-noreg}
\glssetcategoryattribute
{shortdotted}{discardperiod}{true}
\newabbreviation
[category={shortdotted}]{Drive}{Dr.\@
}{Drive}
\@
in case the abbreviation is used mid-sentence. For example:
(The spacing is more noticeable if you first switch to a monospaced font with \gls
{Doctor} Smith lives at 2, Blueberry \gls
{Drive}. Next sentence.
\gls
{Doctor} Smith lives at 2, Blueberry \gls
{Drive} end of sentence.
\ttfamily
.)\setabbreviationstyle
[longshortdotted]{long-short}
\glssetcategoryattribute
{longshortdotted}{discardperiod}{true}
\newabbreviation
[category={longshortdotted}]{e.g.}{e.g.\@
}{for example}
\glssymbolaccsupp
and \glsuseriaccsupp
commands won’t be used. I can’t deal with both cases if I just provide \glsnameaccsupp
. \glsxtrsymbolnameaccsupp
, but remember that this only covers accessing the name field, which is typically only done in the glossary. I would also need similar commands for the first, firstplural, text and plural keys. This is quite complicated, but since I don’t need to worry about any of the other fields it’s simpler to just provide the \glsxtr
accsupp version:
If it’s necessary to provide support for additional fields, then the category+field command \newcommand
{\glsxtrsymbolaccsupp
}[2]{%
\glsaccessibility
[method=hex,unicode]{ActualText}{#1}{#2}%
}
\newcommand
{\glsxtrimageaccsupp
}[2]{%
\glsaccessibility
{Alt}{#1}{#2}%
}
\newglossaryentry
{int}{category={symbol},
name={\ensuremath
{\int
}},access={222B},
description={integral}
}
\newglossaryentry
{sampleimage}{category={image},
description={an example image},
name={\protect
\includegraphics
[height=20pt]{example-image}},
access={a boilerplate image used in examples}
}
\glsxtr
accsupp could be used to override the more general category command \glsxtr
accsupp.pdflatex sample-ignored
makeglossaries sample-ignored
pdflatex sample-ignored
A new ignored glossary is defined with:
There are no associated files with an ignored glossary. An entry is defined with this as its glossary type: \newignoredglossary
{common}
Note that the description key isn’t required. This term may be referenced with \newglossaryentry
{commonex}{type={common},name={common term}}
\gls
(which is useful for consistent formatting) but it won’t be indexed.\glsenableentrycount
and \cgls
(described in §7.1) so that acronyms only used once don’t appear in the list of acronyms. The document build is: pdflatex sample-entrycount
pdflatex sample-entrycount
makeglossaries sample-entrycount
pdflatex sample-entrycount
Note the need to call LaTeX twice before makeglossaries, and then a final LaTeX call is required at the end.19. Troubleshooting
Symbols
Terms
Ensure that you have at least mfirstuc v2.08 for improved case-changing performed by new LaTeX3 commands. See the mfirstuc manual for further details.\GLS
and \GLStext
. All letters in the given text are converted to uppercase (capitals). The actual case-conversion is performed by \glsuppercase
.\Gls
and \Glstext
. Only the first letter is converted to uppercase. The case-conversion for the \gls
-like and \glstext
-like commands is performed via \glssentencecase
, which is simply defined to use the robust \makefirstuc
. Commands such as \Glsentrytext
also use \glssentencecase
in the document but use the expandable \MFUsentencecase
in PDF bookmarks.\glsentrytitlecase
. The first letter of each word is converted to uppercase. The case-conversion is performed using \glscapitalisewords
in the document text, but commands designed for use in section headings, use the expandable \MFUsentencecase
in PDF bookmarks.\glslowercase
is provided for use in modifying acronym or abbreviation commands to convert the short form to lowercase for small caps styles, but isn’t actually used by any of the commands provided by glossaries. This command should be preferred to the robust \MakeLowercase
if expansion is required.\gls
-like and \glstext
-like commands will create a hyperlink to this line.\gls
-like, \glstext
-like or \glsadd
commands. An entry may have multiple locations that form a list. See also §12.3.\gls
-like commands (which can adjust their behaviour according to whether or not this flag is true). The conditional is true if the entry hasn’t been used by one of these commands (or if the flag has been reset) and false if it has been used (or if the flag has been unset).\gls
-like commands.\printglossary
or \printunsrtglossary
(which may or may not be ordered alphabetically) or a glossary is a set of entry labels where the set is identified by the glossary label or type.\gls
-like\gls
and \glsdisp
that change the first use flag. These commands index the entry (if indexing is enabled), create a hyperlink to the entry’s glossary listing (if enabled) and unset the first use flag. These commands end with the post-link hook.\glstext
-like\glstext
and \glslink
that don’t change the first use flag. These commands index the entry (if indexing is enabled) and create a hyperlink to the entry’s glossary listing (if enabled). These commands end with the post-link hook.\glsfieldfetch
or \glsxtrusefield
, but neither the level nor the parent values should be altered as it will cause inconsistencies in the sorting and glossary formatting. See also §4.5.\newignoredglossary
. These glossaries are omitted by iterative commands, such as \printglossaries
and \printunsrtglossaries
. An ignored glossary can only be displayed with \printunsrtglossary
.\printunsrtglossary
. See the glossaries-extra manual for further details.\GlsXtrLoadResources
.\GlsXtrLoadResources
.f
, o
, o
. Depending on the font, the backslash character may appear as a dash when used in the main document text, so foo will appear as: —foo. textsc{ }
to produce small capitals. This uses a font where lowercase letters have a small capital design. Uppercase letters have the standard height and there’s no noticeable difference with uppercase characters in corresponding non-small caps fonts. This means that for a small caps appearance, you need to use lowercase letters in the argument. The relsize package provides textsmaller{ }
which simulates small caps by reducing the size of the font, so in this case the contents of should be uppercase (otherwise the effect is simply smaller lowercase letters). Some fonts don’t support small caps combined with bold or slanted properties. In this case, there will be a font substitution warning and one of the properties (such as small caps or slanted) will be dropped.'e
(é). That is, the character can be produced without the need to load a particular package.Glossary Entry Keys Summary
These are options that can be passed to commands that define entries, such as \newglossaryentry
or \newacronym
.\seealsoname
] } but also sets up aliasing which makes the link text hyperlink to instead. §4; 135\glsdesc
(if indexing and hyperlinks are required) or \glsentrydesc
. Glossary styles should use \glossentrydesc
and \glspostdescription
to incorporate the post-description hook. §4; 128\gls
-like commands. Note that using an acronym style or post-link hooks is a more flexible approach. If omitted, this value is assumed to be the same as the text key. §4; 129\gls
-like commands, such as \glspl
. If this key is omitted, then the value will either be the same as the plural field, if the first key wasn’t used, or the value will be taken from the first key with \glspluralsuffix
appended. §4; 130\glsxtrsetgrouptitle
, although this is more commonly done implicitly within the glstex file. See also Gallery: Logical Glossary Divisions (type vs group vs parent).\newacronym
(and \newabbreviation
) to the entry’s long (unabbreviated) form. It typically shouldn’t be used explicitly with \newglossaryentry
as \newacronym
(and \newabbreviation
) makes other modifications to ensure that when the entry is referenced with the \gls
-like commands, it will obey the appropriate acronym style (or abbreviation style). If you are using bib2gls then this field should be used in the bib file when defining abbreviations. §4; 135\glsname
(if indexing and hyperlinks are required) or \glsentryname
. Glossary styles should use \glossentryname
rather than explicitly using \glsentryname
. §4; 128\glsnonextpages
or \glsnextpages
to the indexing information for Options 2 and 3 or to the prenumberlist field for Option 1. §4; 132\gls
-like commands, such as \glspl
. This should be the appropriate plural form of the value provided by the text key. If omitted, this value is assumed to be the value of the text key with \glspluralsuffix
appended. §4; 129\glssee
. The glossaries-extra package additionally saves the value. Use autoseeindex=false to prevent the automatic cross-reference. The defaults to \seename
and should be a comma-separated list of entries that have already been defined. §4; 133\seealsoname
] }. §4; 134\newacronym
to the entry’s short (abbreviated) form. It typically shouldn’t be used explicitly with \newglossaryentry
as \newacronym
(and \newabbreviation
) makes other modifications to ensure that when the entry is referenced with the \gls
-like commands, it will obey the appropriate acronym style (or abbreviation style). If you are using bib2gls then this field should be used in the bib file when defining abbreviations. §4; 135\glssymbol
(if indexing and hyperlinks are required) or with \glsentrysymbol
. §4; 130\glssymbolplural
(if indexing and hyperlinks are required) or with \glsentrysymbolplural
. If omitted, this value is set to the same as the symbol key (since symbols usually don’t have a plural form). §4; 130\gls
-like commands. If omitted, this value is assumed to be the same as the name key. §4; 129\glsuseri
(if indexing and hyperlinks are required) or with \glsentryuseri
. §4; 132\glsuserii
(if indexing and hyperlinks are required) or with \glsentryuserii
. §4; 132\glsuseriii
(if indexing and hyperlinks are required) or with \glsentryuseriii
. §4; 132\glsuseriv
(if indexing and hyperlinks are required) or with \glsentryuseriv
. §4; 132\glsuserv
(if indexing and hyperlinks are required) or with \glsentryuserv
. §4; 132\glsuservi
(if indexing and hyperlinks are required) or with \glsentryuservi
. §4; 132
Most (but not all) of these options can be used in the optional argument of all the \gls
-Like and \glstext
-Like Options Summary\gls
-like, \glstext
-like and \glsadd
commands.\glstextformat
. §5.1.1; 162\glslocalunset
to unset the first use flag, otherwise use \glsunset
(only applies to \gls
-like commands). §5.1.1; 162global
, local
or none
(only applies to \gls
-like commands). §5.1.1; 163\glstextformat
to encapsulate the link text. §5.1.1; 162\theH
. §5.1.1; 163\glsaddall
, the value is the list of glossaries to iterate over. §10; 254
Most (but not all) of these options can be used in the optional argument of all the \print
Options Summary glossary\print
glossary commands.
to the start of the glossary (after the title). §8; 242\label
{ }++
then the current offset is incremented by the given amount otherwise the current offset is set to . For example, an entry with a normal hierarchical level of 1 will be treated as though it has hierarchical level \(1+ \). This option is only available for the “unsrt” commands. §8; 243\printunsrtglossary
is used without bib2gls. §8; 240\glolinkprefix
to . §8; 242\printnoidxglossary
, this indicates how the glossary should be ordered. §8; 241Acronym Style Summary
The style should be set with \setacronymstyle
before the first instance of \newacronym
.Glossary Styles Summary
The default style may be set with \setglossarystyle
or with the style package option. The default style can be overridden for individual glossaries with the style option. For a summary of all available styles, see Gallery: Predefined Styles.\glssetwidest
. §13.1.7; 316\glssetwidest
. §13.1.7; 317\glssetwidest
. §13.1.7; 317\glssetwidest
. §13.1.8; Table 13.2\glssetwidest
. §13.1.8; Table 13.2\glssetwidest
. §13.1.8; Table 13.2\glssetwidest
. §13.1.8; Table 13.2Command Summary
@
\printnoidxglossary
. §1.7.1; 69letter
or word
. §1.7.1; 68\GlsXtrSetAltModifier
information for bib2gls. §1.7.3; 70\glsxtrnewglslike
information for bib2gls. §1.7.3; 70\dgls
information for bib2gls. §1.7.3; 70A
abbreviations
glossary. The default is “Abbreviations” or \acronymname
if babel has been detected.\Gls
defined by the shortcuts package option. §6; Table 6.1\gls
defined by the shortcuts package option. §6; Table 6.1\Acrfull
defined by the shortcuts package option. §6; Table 6.1\acrfull
defined by the shortcuts package option. §6; Table 6.1\Acrfullpl
defined by the shortcuts package option. §6; Table 6.1\acrfullpl
defined by the shortcuts package option. §6; Table 6.1\Acrlong
defined by the shortcuts package option. §6; Table 6.1\acrlong
defined by the shortcuts package option. §6; Table 6.1\Acrlongpl
defined by the shortcuts package option. §6; Table 6.1\acrlongpl
defined by the shortcuts package option. §6; Table 6.1\Glspl
defined by the shortcuts package option. §6; Table 6.1\glspl
defined by the shortcuts package option. §6; Table 6.1\acrfull
but all caps. §6; 196\acrfull
but sentence case. §6; 196\glsxtrfull
instead. For the first optional argument, see \glslink
options. §6; 196\ACRfull
to format the full form. This command is redefined by acronym styles.\Acrfull
to format the full form. This command is redefined by acronym styles.\acrfull
to format the full form. This command is redefined by acronym styles.\setacronymstyle
but used in the initial definition of commands like \glsentryfmt
before they are redefined by the acronym style. This may be removed in a future release.\acrfullpl
but all caps. §6; 196\acrfullpl
but sentence case. §6; 196\acrfull
but shows the full plural form of an acronym. With glossaries-extra, use \glsxtrfullpl
instead. For the first optional argument, see \glslink
options. §6; 196\ACRfullpl
to format the full form. This command is redefined by acronym styles.\Acrfullpl
to format the full form. This command is redefined by acronym styles.\acrfullpl
to format the full form. This command is redefined by acronym styles.\setacronymstyle
but used in the initial definition of commands like \acrfullfmt
before they are redefined by the acronym style. This may be removed in a future release.\acrlong
but converts the link text to all caps. §6; 195\acrlong
but converts the link text to sentence case. §6; 195\glsxtrlong
instead. For the first optional argument, see \glslink
options. §6; 195\acrlongpl
but converts the link text to all caps. §6; 196\acrlongpl
but converts the link text to sentence case. §6; 195\glsxtrlongpl
instead. For the first optional argument, see \glslink
options. §6; 195acronym
. The glossaries-extra package’s abbreviations option will redefine this to \glsxtrabbrvtype
if acronyms/acronym isn’t used. §9; 252\newacronym
. §6.2.1; 202\acrshort
but converts the link text to all caps. §6; 195\acrshort
but converts the link text to sentence case. §6; 194\glsxtrshort
instead. For the first optional argument, see \glslink
options. §6; 194\acrshortpl
but converts the link text to all caps. §6; 195\acrshortpl
but converts the link text to sentence case. §6; 195\glsxtrshortpl
instead. For the first optional argument, see \glslink
options. §6; 195\Acrshort
defined by the shortcuts package option. §6; Table 6.1\acrshort
defined by the shortcuts package option. §6; Table 6.1\Acrshortpl
defined by the shortcuts package option. §6; Table 6.1\acrshortpl
defined by the shortcuts package option. §6; Table 6.1\glossaryname
to \captions
if translator has been loaded (does nothing if translator hasn’t been loaded).
§9; 251\newglossary
[ -glg]{ }{ -gls}{ }{ }[ ]\glsdefaulttype
is assumed. §8; 247B
C
texdoc mfirstuc
or visit ctan.org/pkg/mfirstuc.texdoc mfirstuc
or visit ctan.org/pkg/mfirstuc.\Gls
but hooks into the entry counting mechanism. §7; 233\gls
but hooks into the entry counting mechanism. §7; 232\cGls
if the entry was only used once on the previous run. §7; 234\cgls
if the entry was only used once on the previous run. §7; 233\Glspl
but hooks into the entry counting mechanism. §7; 233\glspl
but hooks into the entry counting mechanism. §7; 232\cGlspl
if the entry was only used once on the previous run. §7; 234\cglspl
if the entry was only used once on the previous run. §7; 233\print
glossary commands to the current glossary label. §8; 239\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \newacronymstyle
and \setacronymstyle
.\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \newacronymstyle
and \setacronymstyle
.D
\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \setacronymstyle
.\gls
-like commands. Deprecated in v3.11a and removed in v4.50. Use rollback if backward-compatibility required, but it’s better to switch to \defglsentryfmt
.\gls
-like commands. Deprecated in v3.11a and removed in v4.50. Use rollback if backward-compatibility required, but it’s better to switch to \defglsentryfmt
.\gls
-like commands for entries assigned to the glossary identified by (\glsdefaulttype
if omitted). §5.1.4; 173\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \setacronymstyle
.\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \setacronymstyle
.\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \setacronymstyle
.
for the first prefix in the prefix list that matches a defined entry.\gls
[ ]{ {entry-label}}[ ]texdoc datatool
or visit ctan.org/pkg/datatool.texdoc datatool
or visit ctan.org/pkg/datatool.\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \setacronymstyle
.E
F
\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \setacronymstyle
.\forglsentries
for each glossary. The optional argument is a comma-separated list of glossary labels. If omitted, all non-ignored glossaries is assumed. §15; 356\glsdefaulttype
if omitted. This command can’t be used with bib2gls since there are no defined entries until bib2gls has selected them and added them to the glstex file. §15; 356G
\genacrfullformat
but sentence case. §5.1.4; 177\glsgenacfmt
to display the acronym singular full form on first use. Redefined by acronym styles. §5.1.4; 176\newglossaryentry
when called by \newacronym
. For example, the description key. §6.2.2; 209\genplacrfullformat
but sentence case. §5.1.4; 177\glsgenacfmt
to display the acronym plural full form on first use. Redefined by acronym styles. §5.1.4; 176Glo
\glsnonextpages
. §8; 248
. §13.2.3; 329\begin{theglossary}
\glsglossarymark
instead. §8; 244\setglossarystyle
instead.\print
glossary to the current glossary’s title. §8; 245\print
glossary to the current glossary’s title for the table of contents (if toctrue). §8; 245\glossentrydesc
but sentence case. §13.2.1; 326\glossentryname
but sentence case. §13.2.1; 326\glsnamefont
. §13.2.1; 325\glossentryname
but uses the given field (identified by its internal label) instead of name.\glossentrysymbol
but sentence case. §13.2.1; 326Gls
\gls
but converts the link text to all caps. §5.1.2; 165\gls
but converts the link text to sentence case. §5.1.2; 165\glslink
options. §5.1.2; 164\glsaccessibility
to provide the accessibility support. §17; 386\glsaccesslong
.\glsentrylong
.\glsaccesslongpl
.\glsentrylongpl
.\glsentryname
.\glsentryshort
.\glsentryshortpl
.\glsaccessibility
. §17; 379\glsacspacemax
instead of the hard-coded 3em. §6.2.1.1; 204\glsacspace
. This is a macro not a register. The default is 3em
.\glsadd
. This command can’t be used with bib2gls. Use the selection=all resource option instead. §10; 254
for each label in the supplied comma-separated list.\glsadd
[ ]{ }\glsentrytext
( ), \Glsentrytext
( ), \glstext
( ), \Glstext
( ), \GLStext
( ). The starred version switches on field expansion for the given key. §4.3.1; 139\makeglossaries
.\
(a literal backslash). §14; 336\capitalisewords
but may be redefined to use \capitalisefmtwords
, if required. §15; 355\gls
-like commands to expand to if the calling command wasn’t a case-changing command (\gls
or \glspl
), to for sentence case commands (\Gls
or \Glspl
) or to for all caps commands (\GLS
or \GLSpl
). §5.1.4; 174\glspostdescription
, to reference the current entry.\ifglshasfield
set this to the field’s value for use within the code. §15; 361\glsdisp
. §5.1.4; 174\newacronym
. §17; 378main
but if nomain is used, it will be the label of the first glossary to be defined.\glsdesc
but converts the link text to all caps. §5.1.3; 170\glsdesc
but converts the link text to sentence case. Use \Glossentrydesc
within custom glossary styles instead of this command. §5.1.3; 170\glslink
options. Use \glossentrydesc
within custom glossary styles instead of this command. §5.1.3; 170\glsdescplural
but converts the link text to all caps.\glsdescplural
but converts the link text to sentence case.\glsdesc
but for the descriptionplural field.\glsdisp
but converts to sentence case. §5.1.2; 166\glslink
instead, if the first use flag should not be altered). This command is considered a \gls
-like command. For the first optional argument, see \glslink
options. §5.1.2; 166\gls
-like commands. Deprecated in v3.11a and removed in v4.50. Use rollback if backward-compatibility required, but it’s better to switch to \glsentryfmt
.\gls
-like commands. Deprecated in v3.11a and removed in v4.50. Use rollback if backward-compatibility required, but it’s better to switch to \glsentryfmt
.\hyperlink
, and includes the debugging information if debug=showtargets. §15; 352\glsdohyperlink
. Does nothing by default. §15; 352\hypertarget
but measures the height of so that the target can be placed at the top of instead of along the baseline. §15; 351\glsdohypertarget
. Does nothing by default. §15; 352\ifglsentryexists
, this does if the entry given by exists. If the entry doesn’t it exist, this does and generates an error. §15; 358\glsdoifexists
, but always warns (no error) if the entry doesn’t exist. §15; 358\glsdohyperlink
when hyperlinks are disabled. This simply expands to . §15; 351\glsstartrange
but with the end range marker )
.\setentrycounter
to its argument. §12; 268\ifglsentrycounter
to false. §2; 85\glsrefentry
. §2; 84\ifglsentrycounter
to true. §2; 85\glsenableentrycount
). §7; 231\gls
-like commands. This command is redefined by the glossaries-extra package. §5.1.4; 173\glsentryfull
but all caps.\glsentryfull
but sentence case. §6; 198\glsentryfullpl
but all caps.\glsentryfullpl
but sentence case. §6; 198\relax
if the entry hasn’t been defined. §15; 366\glsentryprefix
but sentence case. §16; 373\glsentryprefixfirst
but sentence case. §16; 373\glsentryprefixfirstplural
but sentence case. §16; 373\glsentryprefixplural
but sentence case. §16; 373\glsenableentrycount
). §7; 231\glscapitalisewords
or sentence case in PDF bookmarks. §5.2.0; 182\glssetnoexpandfield
). §4.4.0; 148\glsfieldaccsupp
for the accessibility support for the internal field label given by . §17; 379\glsxtr
accsupp. If that command doesn’t exist or if glossaries-extra hasn’t been loaded, it then checks for the existence of \gls
(for example, accsupp\glsshortaccsupp
). Failing that it will use \glsaccsupp
. Whichever command is found first, is performed. { }{ }§17; 379
\glsdoifexists
. §15; 366\glsfielddef
but does a global assignment.\glsfieldedef
but does a global assignment. §15; 367\glsfirst
but converts the link text to all caps. §5.1.3; 168\glsfirst
but converts link text to sentence case. §5.1.3; 168\newacronym
consider using \acrfull
(or \glsxtrfull
with glossaries-extra) for the full form or \acrlong
(or \glsxtrlong
with glossaries-extra) for the long form instead. §5.1.3; 168\glsfirstplural
but converts the link text to all caps. §5.1.3; 169\glsfirstplural
but converts the link text to sentence case. §5.1.3; 169\newacronym
consider using \acrfullpl
(or \glsxtrfullpl
with glossaries-extra) for the full form or \acrlongpl
(or \glsxtrlongpl
with glossaries-extra) for the long form instead. For the first optional argument, see \glslink
options. §5.1.3; 169\gls
-like commands. §5.1.4; 176\gls
-like commands. §5.1.4; 176\ifglshyperfirst
to false.\ifglshyperfirst
to true.
. §5.2.0; 183\glsentrytext
{ }\glsnavigation
. §13.2.2; 328\delimR
or \delimN
. This command should not be used outside of location lists as it requires additional information in order to correctly form the hyperlinks. §12; 268\glsgenentryfmt
to test if the hyper option was set. Deprecated in v4.08 and removed in v4.50. Use \glsifhyperon
instead.\gls
-like commands to expand to if the hyperlink setting is on for the current reference. Otherwise it expands to . §5.1.4; 175\gls
-like commands to expand to if the calling command was a plural form (for example, \glspl
) and to for the other commands. §5.1.4; 174\ifglsindexonlyfirst
to false. §2; 94\ifglsindexonlyfirst
to true. §2; 93\glossentry
that finishes off the previous child entry, if the current top level (level 0) entry follows a child entry. This command is redefined within \glossentry
to use \glsinlinepostchild
after a top level (level 0) entry if that entry has any children. §13.1.9; 320\gls
-like commands. §5.1.4; 174\newacronym
(and \newabbreviation
) to store the supplied in the optional argument. §6.2.2; 209\glsdohypertargethook
to simulate a label corresponding to the target where the label is given by
. §15; 352\glslabelhypertargetprefix
\glslabelhypertarget
to locally redefine problematic commands. §15; 353\glslabelhypertarget
. §15; 352\glslabelhypertarget
. §15; 353\newacronym
(and \newabbreviation
) to store the entry label. §6.2.2; 209\glslink
but converts to sentence case. §5.1.3; 167\glsdisp
instead, if the first use flag needs to be unset). This command is considered a \glstext
-like command. For the first optional argument, see \glslink
options. §5.1.3; 167\gls
-like and \glstext
-like commands. §5.1.5; 178\gls
-like and \glstext
-like commands.\gls
-like commands test if the unmodified, starred (*
) or plus (+
) command was used. §5.1.4; 175\glslistinit
to provide better integration with gettitlestring. §13.1.1; 297\newacronym
(and \newabbreviation
) to store the supplied long form. §6.2.2; 209\glspatchLToutput
. §13.1.4; 306\makefirstuc
to perform the actual case-change. As from mfirstuc v2.08+ this just uses \MFUsentencecase
. Despite the “gls” prefix in the command name, this command is provided by mfirstuc, but dates back to when mfirstuc was part of the glossaries package.\settodepth
but temporarily switches off indexing, unset/reset and labelling. §15; 365\settoheight
but temporarily switches off indexing, unset/reset and labelling. §15; 364\settowidth
but temporarily switches off indexing, unset/reset and labelling. §15; 365\MFUaddmap
, otherwise it will use \glsmfuexcl
instead. See §15.2 for further details. §15; 355\MFUblocker
, otherwise it will use \glsmfuexcl
instead. See §15.2 for further details. §15; 355\MFUexcl
, otherwise it will implement something similar. §15; 355\glsname
but converts the link text to all caps. §5.1.3; 169\glsname
but converts the link text to sentence case. Use \Glossentryname
within custom glossary styles instead of this command. §5.1.3; 169\glslink
options. Use \glossentryname
within custom glossary styles instead of this command. §5.1.3; 169\glossentryname
to apply a font change to the name. §13; 291\glsnavhypertarget
to create the hypertarget for the given group. §13.2.2; 328\glsnavhyperlinkname
. §13.2.2; 328\glsnavhypergroupdotarget
instead. §13.2.2; 327\glshypernavsep
. §13.2.2; 328\glsnavigation
to create the hyperlink for the given group (with the title corresponding to the group label). §13.2.2; 328\print
glossary. Within the glossary, this redefines \glossaryentrynumbers
to do its argument and then reset itself. §8; 249\glssetexpandfield
). §4.4.0; 148\printnoidxglossary
formats the number list. §12; 289\glsdisplaynumberlist
with Option 1. §5.2.0; 188\glsnoidxloclisthandler
handler. §12; 288\glsnoidxloclist
. §12; 288\glsnumberlistloop
. §12; 290\print
glossary. Within the glossary, this redefines \glossaryentrynumbers
to ignore its argument and then reset itself. §8; 248\glshypernumber
otherwise it will simply display its argument, which may be a single location, or locations delimited by \delimR
or \delimN
. §12; 267glsnumbers
letter group. Also used as the title for the glossary created with the numbers package option. §1.5.1; Table 1.2\glsdisplaynumberlist
between the last two locations. §5.2.0; 187\glsdisplaynumberlist
between all but the last two locations. §5.2.0; 187\par
can’t be used directly). §4; 128\glsgroupskip
with nogroupskip=false for the glossary-longbooktabs styles. §13.1.4; 306\glspl
but converts the link text to all caps. §5.1.2; 165\glspl
but converts the link text to sentence case. §5.1.2; 165\gls
but uses the relevant plural form. §5.1.2; 165\glsplural
but converts the link text to all caps. §5.1.3; 169\glsplural
but converts the link text to sentence case. §5.1.3; 168\newacronym
consider using \acrshortpl
(or \glsxtrshortpl
with glossaries-extra) instead. §5.1.3; 168\gls
-like and \glstext
-like commands. This is redefined by glossaries-extra to use \glsxtrpostlinkhook
. §5.1.5; 179\makeglossaries
or \makenoidxglossaries
only). §2; 99
.\glsxtrp
{short}{ }
.\glsxtrp
{text}{ }"
"
, where the "
is a literal character. §14; 337\gls
otherwise it uses \ref
. §2; 84\ifglsresetcurrcount
conditional to \iffalse
. §7; 231\ifglsresetcurrcount
conditional to \iftrue
. §7; 231\glossaryentrynumbers
. §8; 248\glspatchLToutput
. §13.1.4; 306\seename
. §11; 258
. §11; 261\emph
{ } \glsseelist
{ }\glsseelist
to format each entry item. This adds a hyperlink, if enabled, to the appropriate entry line in the glossary with the text obtained with \glsseeitemformat
. §11; 262\glsseeitem
to produce the hyperlink text. §11; 262\glsseelist
as a separator between the final pair. §11; 262\glsseeitem
. The separators are \glsseelastsep
(between the penultimate and last items) and \glsseesep
(between all the other items). §11; 262\glsseelist
as a separator between each entry except the last pair. §11; 262\Gls
, to perform the case change. This is simply defined to use \makefirstuc
. §15; 354\makeglossaries
. §3; 124\glsnoexpandfields
. §4.4.0; 148\glsexpandfields
. §4.4.0; 148\print
glossary to set the table of contents title for the given glossary if a title hasn’t been supplied with toctitle or title. §8; 246\glsaccessibility
for the short field. §17; 380\glsaccessibility
for the shortplural field. §17; 380\newacronym
(and \newabbreviation
) to store the supplied short form. §6.2.2; 209\glsshowtarget
in outer mode. §2; 73\glsshowtargetfonttext
and \glsshowtargetouter
to set the font. §2; 73\glsshowtargetinner
to set the font. §2; 73\glsshowtarget
in math mode and inner mode. §2; 72\glsshowtarget
in outer mode. §2; 73\glsshowtargetouter
to mark the target. §2; 73
where can either be provided by the format key in .\glsaddeach
[ ,format=(
]{ }\refstepcounter
if entrycounter=true. §2; 84\refstepcounter
if subentrycounter=true. §2; 87\ifglssubentrycounter
to false. §2; 87\ifglssubentrycounter
to true. §2; 87\glssymbol
but converts the link text to all caps. §5.1.3; 170\glssymbol
but converts the link text to sentence case. Use \Glossentrysymbol
within custom glossary styles instead of this command. §5.1.3; 170\glslink
options. Use \glossentrysymbol
within custom glossary styles instead of this command. §5.1.3; 170\glshypernavsep
. §13.2.2; 329\glssymbolplural
but converts the link text to all caps.\glssymbolplural
but converts the link text to sentence case.\glssymbol
but for the symbolplural field.glssymbols
letter group. Also used as the title for the glossary created with the symbols package option. §1.5.1; Table 1.2\glossentryname
{ }, but it can be something else. §13.2.1; 325\texorpdfstring
otherwise it just expands to . §15; 353\glstext
but converts the link text to all caps. §5.1.3; 168\glstext
but converts the first character of the link text to sentence case. §5.1.3; 167\newacronym
consider using \acrshort
for the short form (or \glsxtrshort
with glossaries-extra). For the first optional argument, see \glslink
options. §5.1.3; 167\gls
-like and \glstext
-like commands to format the link text. §5; 160\textulc
is defined, this will use that command, otherwise it will use \textup
to cancel the effect of the small caps font command \textsc
. §6.2.1; 203~
(a literal tilde character). §14; 336\ifglstoc
to false. §2; 79\ifglstoc
to true. §2; 79\ifglsucmark
to false.\ifglsucmark
to true.\newacronymstyle
). §6.2.2; 209\newacronymstyle
). §6.2.2; 210\glsuseri
but converts the link text to all caps. §5.1.3; 171\glsuseri
but converts the link text to sentence case. §5.1.3; 171\glslink
options. §5.1.3; 171\glsuserii
but converts the link text to all caps. §5.1.3; 171\glsuserii
but converts the link text to sentence case. §5.1.3; 171\glslink
options. §5.1.3; 171\glsuseriii
but converts the link text to all caps. §5.1.3; 171\glsuseriii
but converts the link text to sentence case. §5.1.3; 171\glslink
options. §5.1.3; 171\glsuseriv
but converts the link text to all caps. §5.1.3; 172\glsuseriv
but converts the link text to sentence case. §5.1.3; 172\glslink
options. §5.1.3; 172\glsuserv
but converts the link text to all caps. §5.1.3; 172\glsuserv
but converts the link text to sentence case. §5.1.3; 172\glslink
options. §5.1.3; 172\glsuservi
but converts the link text to all caps. §5.1.3; 172\glsuservi
but converts the link text to sentence case. §5.1.3; 172\glslink
options. §5.1.3; 172\ifglswrallowprimitivemods
to false. §2; 93\ifglswrallowprimitivemods
to true. §2; 93\glshypernumber
. §12; 269\glshypernumber
. §12; 269\glshypernumber
. §12; 268\glsdefs@newdocentry
.Glsxtr
\glssee
information for bib2gls. §1.7.3; 70abbreviations
.\glsfieldaccsupp
for the accessibility support for the category identified by .\glsfieldaccsupp
for the accessibility support for the category identified by and the internal field label given by .\forlistcsloop
.\DTLformatlist
.
where the control sequence name is obtained from a designated field.\glslink
[ ]{ }{\{ } }\glsxtrfmt
. for each element of the list. { }
\glsxtrfull
but converts the link text to all caps.\glsxtrfull
but converts the link text to sentence case.
, depending on the abbreviation style.\gls
{ }\glsxtrfullpl
but converts the link text to all caps.\glsxtrfullpl
but converts the link text to sentence case.\glsxtrfull
but for the plural form.\glossentryname
, with appropriate hooks.\ifcsundef
command.\ifglshasfield
but doesn’t produce a warning if the entry or field doesn’t exist. This sets \glscurrentfieldvalue
to the field value and does if its defined and not empty, otherwise it does . The unstarred version adds implicit grouping to make nesting easier. The starred version doesn’t (to make assignments easier).\GlsXtrIfFieldNonZero
). This requires the save-child-count resource option.\gls
-like and \glstext
-like commands, this expands to if the calling command was considered the first use, otherwise it expands to . This command may be used within the post-link hook (where it’s too late to test the first use flag with \ifglsused
).\GlsXtrIfFieldEqStr
but first (protected) expands both the field value and the supplied .\Glsxtrfull
to display the sentence case inline full form (defined by the abbreviation style).\glsxtrfull
to display the inline full form (defined by the abbreviation style).\Glsxtrfullpl
to display the plural sentence case inline full form (defined by the abbreviation style).\glsxtrfullpl
to display the plural inline full form (defined by the abbreviation style).\glsxtrlong
but converts the link text to all caps.\glsxtrlong
but converts the link text to sentence case.\glsxtrlongpl
but converts the link text to all caps.\glsxtrlongpl
but converts the link text to sentence case.\glsxtrlong
but the text produced is obtained from the longplural value.
.\gls
[ , ]{ }\glsxtrnewgls
but provides plural and sentence case commands as well.numbers
, the category set to number
, the name set to and the sort set to . The optional argument is a comma-separated list of glossary entry keys, which can be used to override the defaults.symbols
, the category set to symbol
, the name set to and the sort set to . The optional argument is a comma-separated list of glossary entry keys, which can be used to override the defaults.\gls
-like or \glstext
-like commands). This command is designed to expand to the field value if used in a PDF bookmark and can also expand to a more appropriate command if it ends up in the page header. Note that there’s no option argument.\GlsXtrUnsetBufferEnableRepeatLocal
, this will locally reset all entries that are in the buffer that hadn’t been marked as used before the function was enabled.\gls
-like and \glstext
-like commands that will automatically implement the given options.+
) modifier for \gls
-like and \glstext
-like commands.*
) modifier for \gls
-like and \glstext
-like commands.\glsxtrshort
but converts the link text to all caps.\glsxtrshort
but converts the link text to sentence case.\glslink
options.\glsxtrshortpl
but converts the link text to sentence case.\glsxtrshort
but the text produced is obtained from the shortplural value.\relax
if the entry or field are undefined.H
\textbf{
otherwise it just does \glshypernumber
{ }}\textbf{ }
. Table 12.1\emph{
otherwise it just does \glshypernumber
{ }}\emph{ }
. Table 12.1\textit{
otherwise it just does \glshypernumber
{ }}\textit{ }
. Table 12.1\textmd{
otherwise it just does \glshypernumber
{ }}\textmd{ }
. Table 12.1\textrm{
otherwise it just does \glshypernumber
{ }}\textrm{ }
. Table 12.1\textsc{
otherwise it just does \glshypernumber
{ }}\textsc{ }
. Table 12.1\textsf{
otherwise it just does \glshypernumber
{ }}\textsf{ }
. Table 12.1\textsl{
otherwise it just does \glshypernumber
{ }}\textsl{ }
. Table 12.1\texttt{
otherwise it just does \glshypernumber
{ }}\texttt{ }
. Table 12.1\textup{
otherwise it just does \glshypernumber
{ }}\textup{ }
. Table 12.1I
\nopostdesc
otherwise does . §15; 360\ifcsstrequal
. Triggers an error if the given field (identified by its internal field label) hasn’t been defined. Uses \glsdoifexists
. §15; 364\ifdefstrequal
. Triggers an error if the given field (identified by its internal field label) hasn’t been defined. Uses \glsdoifexists
. §15; 363\ifcsstring
. Triggers an error if the given field (identified by its internal field label) hasn’t been defined. Uses \glsdoifexists
. §15; 361\ifcsvoid
command. §15; 360\glscurrentfieldvalue
to the field value and does otherwise it does . §15; 360\thepage
. §2; 93L
\glsdefaulttype
to and inputs . If the optional argument is omitted, the default glossary is assumed. Note that if any entries with have the type key set (including implicitly in commands like \newabbreviation
), then this will override the type given in the optional argument. §4.6.0; 152\longnewglossaryentry
but does nothing if the entry is already defined. §4; 127M
\MFUsentencecase
to perform the actual case change. See the mfirstuc documentation for further details, either: texdoc mfirstuc
or visit ctan.org/pkg/mfirstuc.\printnoidxglossary
. §3; 122\makefirstuc
to convert its argument to all caps and was redefined by glossaries to use \MakeTextUppercase
, but with mfirstuc v2.08+ and glossaries v4.50+ this command is instead defined to use the LaTeX3 all caps command, which is expandable. This command is no longer used by \makefirstuc
(which instead uses \MFUsentencecase
). The glossaries (v4.50+) and glossaries-extra (v1.49+) packages now use \glsuppercase
for the all caps commands, such as \Gls
.\makefirstuc
and also identifies as a blocker. Mappings and blockers aren’t supported by \MFUsentencecase
, so both and are identified as exclusions for \MFUsentencecase
.\makefirstuc
and an exclusion for \MFUsentencecase
(which doesn’t support blockers).\makefirstuc
and \MFUsentencecase
.\makefirstuc
, this command is expandable, but only recognises commands identified as exclusions. See the mfirstuc documentation for further details. This command is provided by glossaries-extra v1.49+ if an old version of mfirstuc is detected. §15; 354N
\newglossaryentry
and any provided options (glossary entry keys) given in will be appended. The category is set to abbreviation by default, but may be overridden in . The appropriate style should be set before the abbreviation is defined with \setabbreviationstyle
.\setabbreviationstyle
.\newabbreviation
with the category key set to acronym. With just the base glossaries package, use \setacronymstyle
to set the style. With glossaries-extra, use
to set the style that governs \setabbreviationstyle
[acronym]{ }\newacronym
. §6; 190\newacronym
just before the entry is defined by \newglossaryentry
.\defglsentryfmt
. The is the code that redefines the acronym formatting commands, such as \genacrfullformat
, and the additional fields command \GenericAcronymFields
. §6.2.2; 208\printglossary
), but this title can be overridden by the title option. The optional indicates which counter should be used by default for the location when indexing any entries that have been assigned to this glossary. (This can be overridden by the counter option.) The other arguments are file extensions for use with makeindex or xindy. These arguments aren’t relevant for other indexing options (in which case, you may prefer to use \newglossary*
). §9; 250
§9; 250\newglossary
[ -glg]{ }{ -gls}{ }{ }[ ]\printglossaries
. This glossary has no associated indexing files and has hyperlinks disabled. You can use an ignored glossary for common terms or acronyms or abbreviations that don’t need to be included in any listing (but you may want these terms defined as entries to allow automated formatting with the \gls
-like commands). An ignored glossary can’t be displayed with \printglossary
but may be displayed with the “unsrt” family of commands, such as \printunsrtglossary
. The glossaries-extra package provides a starred form of this command.index
, the name set to and the description set to \nopostdesc
. The optional argument is a comma-separated list of glossary entry keys, which can be used to override the defaults. §2; 111\makeglossaries
from creating the default indexing application style file. §3; 124O
P
\pgls
but all caps. §16; 371\pgls
but sentence case. §16; 371\gls
but inserts the appropriate prefix, if provided. §16; 370\pgls
but all caps. §16; 371\pgls
but sentence case. §16; 371\glspl
but inserts the appropriate prefix, if provided. §16; 370\glsxtrshort
but inserts the prefix field and separator in front if set.\glsdefaulttype
is assumed. §8; 247
.\printglossary
[type=\glsxtrabbrvtype
]
. §2; 113\printglossary
[type=\acronymtype
]
for each glossary. §8; 238\printglossary
[type=]\makeglossaries
and either makeindex or xindy. §8; 237
. §2; 112\printglossary
[type=index]
for each glossary. §8; 237\printnoidxglossary
[type=]\makenoidxglossaries
or with the glossaries not identified in the optional argument of \makeglossaries
when using the hybrid method. This method can be very slow and has limitations. §8; 237
. §2; 111\printglossary
[type=numbers]
. §2; 110\printglossary
[type=symbols
]
.\printunsrtglossary
[type=\acronymtype
]
for each glossary. §8; 238\printunsrtglossary
[type=]\printunsrtglossary
but doesn’t contain the code that starts and ends the glossary (such as beginning and ending the theglossary environment). See the glossaries-extra manual for further details. §8; 239\newglossaryentry
but does nothing if the entry is already defined. §4; 127\newignoredglossary
but does nothing if the glossary has already been defined.R
\newacronymstyle
but redefines an existing acronym style.S
\alsoname
, if that command has been defined, or “see also”.\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \setacronymstyle
.\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \newacronymstyle
and \setacronymstyle
.\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use
.\setacronymstyle
{long-short}\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \setacronymstyle
.\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \setacronymstyle
.\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \setacronymstyle
.\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \setacronymstyle
.\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \setacronymstyle
.\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \setacronymstyle
.\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \setacronymstyle
.\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \newacronymstyle
and \setacronymstyle
.\glshypernumber
. §12; 268\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \setacronymstyle
.\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \setacronymstyle
.\glsdefaulttype
is assumed. §8; 246\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \setacronymstyle
.\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \setacronymstyle
.\makeglossaries
. §3; 123\glossariesextrasetup
. §2; 121\setacronymstyle
. Removed in v4.50. Use rollback if backward-compatibility required or use \setacronymstyle
.T
W
\makeglossaries
and then disabled. §3; 123X
\capitalisefmtwords
but with the first token in expanded. The starred version uses the starred version of \capitalisefmtwords
.\GlsXtrSetField
but expands the value and uses a global assignment.Environment Summary
Package Option Summary
abbreviations
and title given by \abbreviationsname
, redefines \glsxtrabbrvtype
to abbreviations
, redefines \acronymtype
to \glsxtrabbrvtype
(unless the acronym or acronyms option has been used), and provides \printabbreviations
. §2; 114\newglossaryentry
is permitted in the document environment. §2; 78\newglossaryentry
in the document environment. 79\newglossaryentry
in the document environment, but only before any glossaries. 79\newglossaryentry
in the document environment if the base glossaries package would allow it. 79\makeglossaries
or \makenoidxglossaries
. 95acronym
and title given by \acronymname
, redefines \acronymtype
to acronym
, and provides \printacronyms
. §2; 113acronym
, redefines \acronymtype
to acronym
, and provides \printacronyms
. §2; 114\makeglossaries
opens the associated indexing files. 107\makeglossaries
opens the associated indexing files. §2; 107, 107\makeglossaries
opens the associated indexing files. §2; 107, 107wrglossary(
to the )( )log file if there is an attempt to index an entry before the associated indexing file has been opened (makeindex and xindy only). With glossaries-extra, this setting will also display the label of any undefined entries that are referenced in the document. 72\makeglossaries
. §2; 107\gls
-like commands. §2; 76index
and the title \indexname
, and provides \printindex
and \newterm
. §2; 111\glossary
and \makeglossary
. §2; 120\glossary
and \makeglossary
. 120\glossary
and \makeglossary
without any warnings. 120\glossary
and \makeglossary
but their use will trigger a warning. 120main
glossary. You will need to define another glossary to use instead. For example, with the acronyms package option. §2; 109\printglossary
have already been defined (which indicates that the document class or another package also provides a mechanism for creating a glossary that could potentially conflict with glossaries). This option is automatically implemented with glossaries-extra. §2; 71\numberline
when adding a glossary to the table of contents. §2; 80numbers
and the title \glsnumbersgroupname
, and provides \printnumbers
. With glossaries-extra, this additionally defines \glsxtrnewnumber
. §2; 111chapter
or section
. §2; 80\makeglossaries
. §2; 92\makeglossaries
. 92\makeglossaries
. 92\makeglossaries
. 92\makeglossaries
and \makenoidxglossaries
only). §2; 97\glsprestandardsort
hook. 98symbols
and the title \glssymbolsgroupname
, and provides \printsymbols
. With glossaries-extra, this additionally defines \glsxtrnewsymbol
. §2; 110
that contains all defined entry labels and names (for the benefit of auto-completion tools). §2; 78\jobname
.glslabels
that contains all defined entry labels (for the benefit of auto-completion tools). §2; 78\jobname
.glslabelsutf8
if \inputencodingname
isn’t defined. Only applicable if you use makeglossaries or automake. §2; 103glsnumbers
letter group. §2; 104Index
Symbols
\$
@
\@gobble
A
\acrfull
§6; Table 6.1; 170, 196, 200–207 passim, 212, 218, 228, 396, 398, 411, 492, 540, 541, 542, 581B
C
D
E
F
G
Glo
Gls
\glsdefaulttype
113, 132, 152, 154, 173, 191, 237–239, 246, 252, 338, 356, 512, 520, 544–552 passim, 562, 618, 636, 642, 648\glsentrytext
§5.2.0; 139, 159, 181–184 passim, 196, 218, 232, 263, 384, 438, 447, 461, 559, 575, 584Glsxtr
H
I
J
L
M
\makeglossaries
§3; 5, 9, 10, 14–21 passim, 27, 44, 45, 56, 68–74 passim, 92, 97, 103, 107, 108, 122–124, 134, 155, 158, 237, 252, 258, 272, 278, 287, 337–342 passim, 348–350, 399, 414, 421, 426, 430, 435–443 passim, 450, 455, 460, 463, 467–470 passim, 474, 476, 481, 485, 560, 599, 602, 637, 640, 643, 649–660 passim\MakeUppercase
\mark-both
N
\newabbreviation
5, 39, 40, 113, 135, 149, 152, 164, 165, 389–391, 396–403 passim, 407, 411, 440, 442, 491, 493, 508, 510, 587–591 passim, 605, 636, 638, 639\newacronym
§6; 39, 40, 52, 113–118 passim, 126–135 passim, 144, 149, 152, 156, 158, 164, 165, 189–209 passim, 218–221 passim, 230, 260, 378, 389–391, 396–403 passim, 407, 411, 440, 442, 488, 491, 506–510 passim, 521, 544, 553, 562, 581, 582, 587–591 passim, 598, 605, 609, 639\newglossary
§9; 10, 59–67 passim, 90, 109, 135, 162, 237, 239, 245, 246, 250, 272, 339, 340, 357, 443, 639\newglossaryentry
§4; Table 1.1; 30, 74, 78, 79, 90, 97–99, 126, 134, 139, 144, 145, 152–158 passim, 164, 165, 189, 190, 200, 208, 209, 230, 272, 368, 369, 391, 396, 400, 405, 422, 427, 442, 455, 456, 463, 474, 476, 481–488 passim, 506–510 passim, 553, 638, 639, 640, 644, 652\NoCaseChange
\nopostdesc
§4; 127, 128, 150, 151, 296, 360, 437, 444–447 passim, 453, 454, 462, 631, 640, \glsxtrnopostpunc
O
P
\printglossaries
§8; 16, 48, 156, 223, 238, 251, 422, 427, 430, 438, 441, 451, 455, 460, 463, 470, 474, 476, 481, 501, 640, 642\printglossary
§8; a, 15–19 passim, 48, 79, 119, 120, 157, 187, 237, 238, 243, 251, 252, 279, 323, 338, 399, 414, 435, 480, 482, 501, 639–642 passim, 643, 658\printnoidxglossary
§8; 13, 97–102 passim, 187, 237–241 passim, 249, 251, 288, 289, 441, 518, 538, 594, 637, 643\printunsrtglossaries
§8; 25–29 passim, 238, 422, 427, 430, 451, 455, 460, 463, 470, 474, 476, 481, 501, 644\printunsrtglossary
§8; 23–29 passim, 33, 97, 98, 126, 238–243 passim, 251, 288, 321, 399, 414, 431, 482, 501, 503, 518, 640, 643, 644R
S
\setacronymstyle
§6; 114–116, 164, 165, 189, 199–203 passim, 208, 396, 401, 411, 440, 491, 521, 542, 548–552, 639, 646, 647–649T
U
W
X
1This style was supplied by Axel Menzel.