\documentclass[report,inlinetitle,widecs]{nlctdoc} \usepackage{alltt} \usepackage{hologo} \usepackage[colorlinks, hyperindex=false, pdfauthor={Nicola L.C. Talbot}, pdftitle={glossaries-extra.sty: an extension to the glossaries package}, pdfkeywords={LaTeX,package,glossary,abbreviations}]{hyperref} \usepackage[nogroupskip,nonumberlist]{glossaries-extra} \makeglossaries \GlsXtrEnableEntryUnitCounting{general}{0}{page} \renewcommand*{\glsxtrifcounttrigger}[3]{#3} \renewcommand*{\glslinkcheckfirsthyperhook}{% \ifnum\glsentrycurrcount\glslabel>0 \setkeys{glslink}{hyper=false}% \fi } \newcommand*{\XeLaTeX}{\hologo{XeLaTeX}} \newcommand*{\LuaLaTeX}{\hologo{LuaLaTeX}} \newcommand*{\pdfLaTeX}{\hologo{pdfLaTeX}} \IndexPrologue{\chapter*{\indexname} \addcontentsline{toc}{chapter}{\indexname}% \markboth{\indexname}{\indexname}} \renewcommand*{\main}[1]{\hyperpage{#1}} \newcommand*{\htextbf}[1]{\textbf{\hyperpage{#1}}} \glssetcategoryattribute{general}{indexname}{htextbf} \glssetcategoryattribute{general}{dualindex}{main} \newglossaryentry{xindy}{ name={\appfmt{xindy}}, sort={xindy}, description={An flexible indexing application with multilingual support written in Perl.} } \newglossaryentry{makeindex}{% name={\appfmt{makeindex}},% sort={makeindex},% description={An indexing application.}, } \newglossaryentry{makeglossaries}{% name={\appfmt{makeglossaries}},% sort={makeglossaries},% description={A custom designed Perl script interface provided with the \styfmt{glossaries} package to run \gls{xindy} or \gls{makeindex} according to the document settings.}} \newglossaryentry{makeglossaries-lite.lua}{% name={\appfmt{makeglossaries-lite.lua}\index{makeglossaries-lite.lua=\appfmt{makeglossaries-lite.lua}|htextbf}},% sort={makeglossaries-lite.lua},% text={\appfmt{makeglossaries-lite.lua}\iapp{makeglossaries-lite.lua}},% description={A custom designed Lua script interface to \gls{xindy} and \gls{makeindex} provided with the \styfmt{glossaries} package. This is a cut-down alternative to the Perl \appfmt{makeglossaries} script. If you have Perl installed, use the Perl script instead. Note that TeX Live creates a symbolic link called \texttt{makeglossaries-lite} (without the \texttt{.lua} extension) to the actual \texttt{makeglossaries-lite.lua} script.} } \newglossaryentry{bib2gls}{% name={\appfmt{bib2gls}\index{bib2gls=\appfmt{bib2gls}|htextbf}},% sort={bib2gls},% text={\appfmt{bib2gls}\iapp{bib2gls}},% description={A command line Java application that selects entries from a .bib file and converts them to glossary definitions. At the time of writing, this application is still under development. Further details at: \url{https://github.com/nlct/bib2gls}.}% } \newglossaryentry{numberlist}{% name={number list},% description={A list of \glspl{entrylocation} (also called a location list). The number list can be suppressed using the \pkgopt{nonumberlist} package option.} } \newglossaryentry{entrylocation}{% name={entry location},% description={The location of the entry in the document. This defaults to the page number on which the entry appears. An entry may have multiple locations.} } \newglossaryentry{locationlist}{% name={location list},% description={A list of \glspl{entrylocation}. See \gls{numberlist}.}% } \newglossaryentry{linktext}{% name={link-text}, description={The text produced by commands such as \ics{gls}. It may or may not have a hyperlink to the glossary.} } \let\glsd\glsuseri \let\glsation\glsuserii \newglossaryentry{firstuseflag}{% name={first use flag}, description={A conditional that determines whether or not the entry has been used according to the rules of \gls{firstuse}.}% } \newglossaryentry{firstusetext}{% name={first use text}, description={The text that is displayed on \gls{firstuse}, which is governed by the \gloskey{first} and \gloskey{firstplural} keys of \ics{newglossaryentry}. (May be overridden by \ics{glsdisp}.)}% } \newglossaryentry{firstuse}{% name={first use}, user1={first used}, see={firstuseflag,firstusetext}, description={The first time a glossary entry is used (from the start of the document or after a reset) with one of the following commands: \ics{gls}, \ics{Gls}, \ics{GLS}, \ics{glspl}, \ics{Glspl}, \ics{GLSpl} or \ics{glsdisp}.}% } \setcounter{IndexColumns}{2} \newrobustcmd*{\eq}{\protect=}% hide from makeindex \newcommand*{\igloskey}[2][newglossaryentry]{\icsopt{#1}{#2}} \newcommand*{\gloskey}[2][newglossaryentry]{\csopt{#1}{#2}} \newcommand*{\glostyle}[1]{\textsf{#1}\index{glossary styles:>#1={\protect\sffamily#1}|main}} \newcommand*{\acrstyle}[1]{\textsf{#1}\index{acronym styles (glossaries):>#1={\protect\ttfamily#1}|main}} \newcommand*{\abbrstyle}[1]{\textsf{#1}\index{abbreviation styles:>#1={\protect\sffamily#1}|main}} \newcommand*{\depabbrstyle}[1]{\textsf{#1}\index{abbreviation styles (deprecated):>#1={\protect\sffamily#1}|main}} \newcommand*{\category}[1]{\textsf{#1}\index{categories:>#1={\protect\sffamily#1}|main}} \newcommand*{\catattr}[1]{\textsf{#1}\index{category attributes:>#1={\protect\sffamily#1}|main}} \newcommand*{\postlinkcat}{% \cs{glsxtrpostlink}\meta{category}% \index{glsxtrpostlinkcategory=\cs{glsxtrpostlink}\meta{category}|hyperpage}% } \setlength\marginparwidth{70pt} \begin{document} \DeleteShortVerb{\|} \MakeShortVerb{"} \title{glossaries-extra.sty v1.12: an extension to the glossaries package} \author{Nicola L.C. Talbot\\[10pt] Dickimaw Books\\ \url{http://www.dickimaw-books.com/}} \date{2017-02-03} \maketitle \begin{abstract} The \styfmt{glossaries-extra} package is an extension to the \styfmt{glossaries} package, providing additional features. Some of the features provided by this package are only available with \styfmt{glossaries} version 4.19 (or above). This document assumes familiarity with the \styfmt{glossaries} package. \end{abstract} \begin{important} Since \styfmt{glossaries-extra} internally loads the \styfmt{glossaries} package, you also need to have \styfmt{glossaries} installed and all the packages that \styfmt{glossaries} depends on (including, but not limited to, \sty{tracklang}, \sty{mfirstuc}, \sty{etoolbox}, \sty{xkeyval} (at least version dated 2006/11/18), \sty{textcase}, \sty{xfor}, \sty{datatool-base} and \sty{amsgen}. These packages are all available in the current \TeX\ Live and Mik\TeX\ distributions. If any of them are missing, please update your \TeX\ distribution using your update manager. (For help on this see, for example, \href{http://tex.stackexchange.com/questions/55437/how-do-i-update-my-tex-distribution}{How do I update my \TeX\ distribution?} or \href{http://tex.stackexchange.com/questions/14925/updating-tex-on-linux}{Updating \TeX\ on Linux}.) \end{important} Additional resources: \begin{itemize} \item The \styfmt{glossaries-extra} documented code \href{http://mirrors.ctan.org/macros/latex/contrib/glossaries-extra/glossaries-extra-code.pdf}{glossaries-extra-code.pdf}. \item The \href{http://www.dickimaw-books.com/gallery/#glossaries-extra}{\styfmt{glossaries-extra} gallery}. \item \href{http://www.latex-community.org/know-how/latex/55-latex-general/263-glossaries-nomenclature-lists-of-symbols-and-acronyms}{Glossaries, Nomenclature, Lists of Symbols and Acronyms}. \item \href{https://github.com/nlct/bib2gls}{bib2gls} \end{itemize} \tableofcontents \chapter{Introduction} \label{sec:intro} The \styfmt{glossaries} package is a flexible package, but it's also a heavy-weight package that uses a lot of resources. As package developer, I'm caught between those users who complain about the drawbacks of a heavy-weight package with a large user manual and those users who want more features (which necessarily adds to the package weight and manual size). The \styfmt{glossaries-extra} package is an attempt to provide a~compromise for this conflict. Version 4.22 of the \styfmt{glossaries} package is the last version to incorporate new features.\footnote{4.21 was originally intended as the last release of \styfmt{glossaries} to incorporate new features, but a few new minor features slipped in with some bug fixes in v4.21.} Future versions of \styfmt{glossaries} will just be bug fixes. New features will instead be added to \styfmt{glossaries-extra}. This means that the base \styfmt{glossaries} package won't increase in terms of package loading time and allocation of resources, but those users who do want extra features available will have more of a chance of getting their feature requests accepted. \section{Package Defaults} \label{sec:defaults} I'm not happy with some of the default settings assumed by the \styfmt{glossaries} package, and, judging from code I've seen, other users also seem unhappy with them, as certain package options are often used in questions posted on various sites. I can't change the default behaviour of \styfmt{glossaries} as it would break backward compatibility, but since \styfmt{glossaries-extra} is a separate package, I have decided to implement some of these commonly-used options by default. You can switch them back if they're not appropriate. The new defaults are: \begin{itemize} \item \pkgopt[true]{toc} (add the glossaries to the table of contents). Use \pkgopt[false]{toc} to switch this back off. \item \pkgopt[true]{nopostdot} (suppress the terminating full stop after the description in the glossary). Use \pkgopt[false]{nopostdot} to restore the terminating full stop (period). \item \pkgopt[true]{noredefwarn} (suppress the warnings that occur when the \env{theglossary} environment and \cs{printglossary} are redefined while \styfmt{glossaries} is loading). To restore the warnings, use \pkgopt[false]{noredefwarn}. Note that this won't have any effect if the \styfmt{glossaries} package has already been loaded before you use the \styfmt{glossaries-extra} package. \item If \sty{babel} has been loaded, the \pkgopt[babel]{translate} option is switched on. To revert to using the \sty{translator} interface, use \pkgopt[true]{translate}. There is no change to the default if \sty{babel} hasn't been loaded. \end{itemize} The examples below illustrate the difference in explicit package options between \styfmt{glossaries} and \styfmt{glossaries-extra}. There may be other differences resulting from modifications to commands provided by \styfmt{glossaries} (see \sectionref{sec:modifications}). \begin{enumerate} \item \begin{verbatim} \documentclass{article} \usepackage{glossaries-extra} \end{verbatim} This is like: \begin{verbatim} \documentclass{article} \usepackage[toc,nopostdot]{glossaries} \usepackage{glossaries-extra} \end{verbatim} \item \begin{verbatim} \documentclass[british]{article} \usepackage{babel} \usepackage{glossaries-extra} \end{verbatim} This is like: \begin{verbatim} \documentclass[british]{article} \usepackage{babel} \usepackage[toc,nopostdot,translate=babel]{glossaries} \usepackage{glossaries-extra} \end{verbatim} \item \begin{verbatim} \documentclass{memoir} \usepackage{glossaries-extra} \end{verbatim} This is like: \begin{verbatim} \documentclass{memoir} \usepackage[toc,nopostdot,noredefwarn]{glossaries} \usepackage{glossaries-extra} \end{verbatim} \emph{However} \begin{verbatim} \documentclass{memoir} \usepackage{glossaries} \usepackage{glossaries-extra} \end{verbatim} This is like: \begin{verbatim} \documentclass{memoir} \usepackage[toc,nopostdot]{glossaries} \usepackage{glossaries-extra} \end{verbatim} Since by the time \styfmt{glossaries-extra} has been loaded, \styfmt{glossaries} has already redefined \cls{memoir}'s glossary-related commands. \end{enumerate} Another noticeable change is that by default \cs{printglossary} will now display information text in the document if the external glossary file doesn't exist. This is explanatory text to help new users who can't work out what to do next to complete the document build. Once the document is set up correctly and the external files have been generated, this text will disappear. This change is mostly likely to be noticed by users with one or more redundant empty glossaries who ignore transcript messages, explicitly use \gls{makeindex}\slash\gls{xindy} on just the non-empty glossary (or glossaries) and use the iterative \ics{printglossaries} command instead of \ics{printglossary}. For example, consider the following: \begin{verbatim} \documentclass{article} \usepackage[acronym]{glossaries} \makeglossaries \newacronym{laser}{laser}{light amplification by stimulated emission of radiation} \begin{document} \gls{laser} \printglossaries \end{document} \end{verbatim} The above document will only display the list of acronyms at the place where \ics{printglossaries} occurs. However it will also attempt to input the \texttt{.gls} file associated with the \texttt{main} glossary. If you use \gls{makeglossaries}, you'll get the warning message: \begin{verbatim} Warning: File 'test.glo' is empty. Have you used any entries defined in glossary 'main'? Remember to use package option 'nomain' if you don't want to use the main glossary. \end{verbatim} (where the original file is called \texttt{test.tex}) but if you simply call \gls{makeindex} directly to generate the \texttt{.acr} file (without attempting to create the \texttt{.gls} file) then the transcript file will always contain the message: \begin{verbatim} No file test.gls. \end{verbatim} This doesn't occur with \gls{makeglossaries} as it will create the \texttt{.gls} file containing the single command \cs{null}. If you simply change from \styfmt{glossaries} to \styfmt{glossaries-extra} in this document, you'll find a change in the resulting PDF if you don't use \gls{makeglossaries} and you only generate the \texttt{.acr} file with \gls{makeindex}. The transcript file will still contain the message about the missing \texttt{.gls}, but now you'll also see information in the actual PDF document. The simplest remedy is to follow the advice inserted into the document at that point, which is to add the \pkgopt{nomain} package option: \begin{verbatim} \documentclass{article} \usepackage[nomain,acronym]{glossaries-extra} \makeglossaries \newacronym{laser}{laser}{light amplification by stimulated emission of radiation} \begin{document} \gls{laser} \printglossaries \end{document} \end{verbatim} \section{New or Modified Package Options} \label{sec:pkgopts} If you haven't already loaded \styfmt{glossaries}, you can use any of the package options provided by \styfmt{glossaries} when you load \styfmt{glossaries-extra} and they will automatically be passed to \styfmt{glossaries} (which \styfmt{glossaries-extra} will load). If \styfmt{glossaries} has already been loaded, then those options will be passed to \ics{setupglossaries}, but remember that not all of the \styfmt{glossaries} package options may be used in that command. \begin{important} This section only lists options that are either unrecognised by the \styfmt{glossaries} package or are a modified version of options of the same name provided by \styfmt{glossaries}. See the \styfmt{glossaries} user manual for details about the unmodified options. \end{important} The new and modified options provided by \styfmt{glossaries-extra} are described below: \begin{description} \item[{\pkgopt{accsupp}}] Load the \sty{glossaries-accsupp} package (if not already loaded). If you want to define styles that can interface with the accessibility support provided by \sty{glossaries-accsupp} use the \cs{glsaccess\meta{xxx}} type of commands instead of \cs{glsentry\meta{xxx}} (for example, \ics{glsaccesstext} instead of \ics{glsentrytext}). If \sty{glossaries-accsupp} hasn't been loaded those commands are equivalent (for example, \cs{glsaccesstext} just does \cs{glsentrytext}) but if it has been loaded, then the \cs{glsaccess\meta{xxx}} commands will add the accessibility information. (See \sectionref{sec:accsupp} for further details.) Note that the \pkgopt{accsupp} option can only be used as a~package option (not through \ics{glossariesextrasetup}) since the \sty{glossaries-accsupp} package must be loaded before \styfmt{glossaries-extra} if it's required. \item[{\pkgopt{stylemods}}] This is a \meta{key}=\meta{value} option used to load the \sty{glossaries-extra-stylemods} package. The value may be a comma-separated list of options to pass to that package. (Remember to group \meta{value} if it contains any commas.) The value may be omitted if no options need to be passed. See \sectionref{sec:glosstylemods} for further details. \item[{\pkgopt{undefaction}}] This is a \meta{key}=\meta{value} option, which has two allowed values: \pkgoptfmt{warn} and \pkgoptfmt{error}. This indicates what to do if an undefined glossary entry is referenced. The default behaviour is \pkgopt[error]{undefaction}, which produces an error message (the default for \styfmt{glossaries}). You can switch this to a warning message (and ?? appearing in the text) with \pkgopt[warn]{undefaction}. \begin{important} Undefined entries can't be picked up by any commands that iterate over a glossary list. This includes \ics{forglsentries} and \ics{glsaddall}. \end{important} \item[{\pkgopt{record}}]\label{opt:record}(New to v1.08.) This is a \meta{key}=\meta{value} option, which has three allowed values: \pkgoptfmt{off} (default), \pkgoptfmt{only} and \pkgoptfmt{alsoindex}. If the value is omitted \pkgoptfmt{only} is assumed. The option is provided for the benefit of \gls{bib2gls} (see \sectionref{sec:bib2gls}). The option may only be set in the preamble. The \pkgopt[off]{record} option switches off the recording, as per the default behaviour. It implements \pkgopt[error]{undefaction}. The other values switch on the recording and also \pkgopt[warn]{undefaction}, but \pkgopt[only]{record} will also switch off the indexing mechanism (even if \cs{makeglossaries} or \cs{makenoidxglossaries} has been used) whereas \pkgopt[alsoindex]{record} will both record and index. With the recording on, any of the commands that would typically index the entry (such as \cs{gls}, \cs{glstext} or \cs{glsadd}) will add a \cs{glsxtr@record} entry to the \texttt{.aux} file. \gls{bib2gls} can then read these lines to find out which entries have been used. (Remember that commands like \cs{glsentryname} don't index, so any use of these commands won't add a corresponding \cs{glsxtr@record} entry to the \texttt{.aux} file.) See \sectionref{sec:bib2gls} for further details. \item[{\pkgopt{docdef}}] This option governs the use of \cs{newglossaryentry}. It was originally a boolean option, but as from version 1.06, it can now take one of three values (if the value is omitted, \pkgoptfmt{true} is assumed): \begin{itemize} \item[{\pkgopt[false]{docdef}}] \ics{newglossaryentry} is not permitted in the \env{document} environment (default). \item[{\pkgopt[true]{docdef}}] \cs{newglossaryentry} behaves as it does in the base \styfmt{glossaries} package. That is, where its use is permitted in the \env{document} environment, it uses the \texttt{.glsdefs} temporary file to store the entry definitions so that on the next \LaTeX\ run the entries are defined at the beginning of the \env{document} environment. This allows the entry information to be referenced in the glossary, even if the glossary occurs before \cs{newglossaryentry}. (For example, when the glossary is displayed in the front matter.) This method of saving the definitions for the next \LaTeX\ run has drawbacks that are detailed in the \styfmt{glossaries} user manual. \item[{\pkgopt[restricted]{docdef}}] (new to version 1.06) \ics{newglossaryentry} is permitted in the \env{document} environment without using the \texttt{.glsdefs} file. This means that all entries must be defined before the glossary is displayed, but it avoids the complications associated with saving the entry details in a temporary file. You will still need to take care about any changes made to characters that are required by the \meta{key}=\meta{value} mechanism (that is, the comma and equal sign) and any \gls{makeindex} or \gls{xindy} character that occurs in the \gloskey{sort} key or label. If any of those characters are made active in the document, then it can cause problems with the entry definition. This option will allow \cs{newglossaryentry} to be used in the document with \cs{makenoidxglossaries}, but note that \cs{longnewglossaryentry} remains a preamble-only command. With this option, if an entry appears in the glossary before it has been defined, an error will occur (or a warning if the \pkgopt[warn]{undefaction} option is used.) If you edit your document and either remove an entry or change its label, you may need to delete the document's temporary files (such as the \texttt{.aux} and \texttt{.gls} files). \end{itemize} The \styfmt{glossaries} package allows \cs{newglossaryentry} within the \env{document} environment (when used with \gls{makeindex} or \gls{xindy}) but the user manual warns against this usage. By default the \styfmt{glossaries-extra} package \emph{prohibits} this, only allowing definitions within the preamble. If you are really determined to define entries in the \env{document} environment, despite all the associated drawbacks, you can restore this with \pkgopt[true]{docdef}. Note that this doesn't change the prohibitions that the \styfmt{glossaries} package has in certain circumstances (for example, when using \qt{option~1}). See the \styfmt{glossaries} user manual for further details. A better option if document definitions are required is \pkgopt[restricted]{docdef}. Only use \pkgopt[true]{docdef} if document definitions are necessary and one or more of the glossaries occurs in the front matter. \begin{sloppypar} This option affects commands that internally use \cs{newglossaryentry}, such as \cs{newabbreviation}, but not the \qt{on-the-fly} commands described in \sectionref{sec:onthefly}. \end{sloppypar} \item[{\pkgopt{nomissingglstext}}] This is a boolean option. If true, this will suppress the warning text that will appear in the document if the external glossary files haven't been generated due to an incomplete document build. However, it's probably simpler just to fix whatever has caused the failure to build the external file or files. \item[{\pkgopt{indexcrossrefs}}] This is a boolean option. If \pkgoptfmt{true}, this will automatically index any cross-referenced entries that haven't been marked as used at the end of the document. Note that this necessarily adds to the overall document build time, especially if you have defined a large number of entries, so this defaults to \pkgoptfmt{false}, but it will be automatically switched on if you use the \gloskey{see} key in any entries. To force it off, even if you use the \gloskey{see} key, you need to explicitly set \pkgopt{indexcrossrefs} to \pkgoptfmt{false}. Note that \gls{bib2gls} can automatically find dependent entries when it parses the \texttt{.bib} source file. The \pkgopt{record} option automatically implements \pkgopt[false]{indexcrossrefs}. \item[{\pkgopt{abbreviations}}] This option has no value and can't be cancelled. If used, it will automatically create a new glossary with the label \texttt{abbreviations} and redefines \cs{glsxtrabbrvtype} to this label. In addition, it defines a shortcut command \begin{definition}[\DescribeMacro\printabbreviations] \cs{printabbreviations}\oarg{options} \end{definition} which is equivalent to \begin{alltt} \cs{printglossary}[type=\cs{glsxtrabbrvtype},\meta{options}] \end{alltt} The title of the new glossary is given by \begin{definition}[\DescribeMacro\abbreviationsname] \cs{abbreviationsname} \end{definition} If this command is already defined, it's left unchanged. Otherwise it's defined to \qt{Abbreviations} if \sty{babel} hasn't been loaded or \cs{acronymname} if \sty{babel} has been loaded. However, if you're using \sty{babel} it's likely you will need to change this. (See \sectionref{sec:lang} for further details.) \begin{important} If you don't use the \pkgopt{abbreviations} package option, the \cs{abbreviationsname} command won't be defined (unless it's defined by an included language file). \end{important} If the \pkgopt{abbreviations} option is used and the \pkgopt{acronym} option provided by the \styfmt{glossaries} package hasn't been used, then \ics{acronymtype} will be set to \ics{glsxtrabbrvtype} so that acronyms defined with \ics{newacronym} can be added to the list of abbreviations. If you want acronyms in the \texttt{main} glossary and other abbreviations in the \texttt{abbreviations} glossary then you will need to redefine \cs{acronymtype} to \texttt{main}: \begin{verbatim} \renewcommand*{\acronymtype}{main} \end{verbatim} Note that there are no analogous options to the \styfmt{glossaries} package's \pkgopt{acronymlists} option (or associated commands) as the abbreviation mechanism is handled differently with \styfmt{glossaries-extra}. \item[{\pkgopt{symbols}}] This is passed to \styfmt{glossaries} but will additionally define \begin{definition}[\DescribeMacro\glsxtrnewsymbol] \cs{glsxtrnewsymbol}\oarg{options}\marg{label}\marg{symbol} \end{definition} which is equivalent to \begin{alltt} \cs{newglossaryentry}\marg{label}\{name=\marg{symbol}, sort=\marg{label},type=symbols,category=symbol,\meta{options}\} \end{alltt} Note that the \gloskey{sort} key is set to the \meta{label} not the \meta{symbol} as the symbol will likely contain commands. \item[{\pkgopt{numbers}}] This is passed to \styfmt{glossaries} but will additionally define \begin{definition}[\DescribeMacro\glsxtrnewnumber] \cs{glsxtrnewnumber}\oarg{options}\marg{number} \end{definition} which is equivalent to \begin{alltt} \cs{newglossaryentry}\marg{label}\{name=\marg{number}, sort=\marg{label},type=numbers,category=number,\meta{options}\} \end{alltt} \item[{\pkgopt{shortcuts}}] Unlike the \styfmt{glossaries} package option of the same name, this option isn't boolean but has multiple values: \begin{itemize} \item \pkgopt[acronyms]{shortcuts} (or \pkgopt[acro]{shortcuts}): set the shortcuts provided by the \styfmt{glossaries} package for acronyms (such as \cs{ac}). \item \pkgopt[abbreviations]{shortcuts} (or \pkgopt[abbr]{shortcuts}): set the abbreviation shortcuts provided by \styfmt{glossaries-extra}. (See \sectionref{sec:abbrshortcuts}.) These settings don't switch on the acronym shortcuts provided by the \styfmt{glossaries} package. \item \pkgopt[other]{shortcuts}: set the \qt{other} shortcut commands, but not the shortcut commands for abbreviations or the acronym shortcuts provided by \styfmt{glossaries}. The \qt{other} shortcuts are: \begin{itemize} \item \ics{newentry} equivalent to \ics{newglossaryentry} \item \ics{newsym} equivalent to \ics{glsxtrnewsymbol} (see the \pkgopt{symbols} option). \item \ics{newnum} equivalent to \ics{glsxtrnewnumber} (see the \pkgopt{numbers} option). \end{itemize} \item \pkgopt[all]{shortcuts} (or \pkgopt[true]{shortcuts}): define all the shortcut commands. \item \pkgopt[none]{shortcuts} (or \pkgopt[false]{shortcuts}): don't define any of the shortcut commands (default). \end{itemize} Note that multiple invocations of the \pkgopt{shortcuts} option \emph{within the same option list} will override each other. \end{description} After the \styfmt{glossaries-extra} package has been loaded, you can set available options using \begin{definition}[\DescribeMacro\glossariesextrasetup] \cs{glossariesextrasetup}\marg{options} \end{definition} The \pkgopt{abbreviations} and \pkgopt{docdef} options may only be used in the preamble. Additionally, \pkgopt{docdef} can't be used after \ics{makenoidxglossaries}. \chapter{Modifications to Existing Commands and Styles} \label{sec:modifications} The commands used by \styfmt{glossaries} to automatically produce an error if an entry is undefined (such as \ics{glsdoifexists}) are changed to take the \pkgopt{undefaction} option into account. The \ics{newignoredglossary}\marg{type} command now (as from v1.11) has a starred version that doesn't automatically switch off the hyperlinks. This starred version may be used with the \catattr{targeturl} attribute to create a link to an external URL. (See \sectionref{sec:categories} for further details.) As from v1.12 both the starred and unstarred version check that the glossary doesn't already exist. (The \styfmt{glossaries} package omits this check.) You can now provide an ignored glossary with: \begin{definition}[\DescribeMacro\provideignoredglossary] \cs{provideignoredglossary}\marg{type} \end{definition} which will only define the glossary if it doesn't already exist. This also has a starred version that doesn't automatically switch off hyperlinks. The individual glossary displaying commands \ics{printglossary}, \ics{printnoidxglossary} and \cs{printunsrtglossary} have an extra key \gloskey[printglossary]{target}. This is a boolean key which can be used to switch off the automatic hypertarget for each entry. Unlike \cs{glsdisablehyper} this doesn't switch off hyperlinks, so any cross-references within the glossary won't be affected. This is a way of avoiding duplicate target warnings if a glossary needs to be displayed multiple times. The \cs{newglossaryentry} command has two new keys: \begin{itemize} \item \gloskey{category}, which sets the category label for the given entry. By default this is \texttt{general}. See \sectionref{sec:categories} for further information about categories. \item \gloskey{alias}, which allows an entry to be alias to another entry. See \sectionref{sec:alias} for further details. \end{itemize} The \cs{longnewglossaryentry} command now has a starred version (as from v1.12) that doesn't automatically insert \begin{verbatim} \leavevmode\unskip\nopostdesc \end{verbatim} at the end of the description field. \begin{definition}[\DescribeMacro\longnewglossaryentry] \cs{longnewglossaryentry}*\marg{label}\marg{options}\marg{description} \end{definition} The \gloskey{descriptionplural} key is left unset unless explicitly set in \meta{options}. The unstarred version no longer hard-codes the above code (which removes trailing space and suppresses the post-description hook) but instead uses: \begin{definition}[\DescribeMacro\glsxtrpostlongdescription] \cs{glsxtrpostlongdescription} \end{definition} This can be redefined to allow the post-description hook to work but retain the \cs{unskip} part if required. For example: \begin{verbatim} \renewcommand*{\glsxtrpostlongdescription}{\leavevmode\unskip} \end{verbatim} This will discarded unwanted trailing space at the end of the description but won't suppress the post-description hook. The unstarred version also alters the base \sty{glossaries} package's treatment of the \gloskey{descriptionplural} key. Since a plural description doesn't make much sense for multi-paragraph descriptions, the default behaviour with \sty{glossaries-extra}'s \cs{longnewglossaryentry} is to simply leave the plural description unset unless explicitly set using the \gloskey{descriptionplural} key. The \styfmt{glossaries.sty} version of this command sets the description's plural form to the same as the singular.\footnote{The \gloskey{descriptionplural} key is a throwback to the base package's original acronym mechanism before the introduction of the \gloskey{long} and \gloskey{short} keys, where the long form was stored in the \gloskey{description} field and the short form was stored in the \gloskey{symbol} field.} Note that this modified unstarred version doesn't append \cs{glsxtrpostlongdescription} to the description's plural form. The \ics{newterm} command (defined through the \pkgopt{index} package option) is modified so that the category defaults to \category{index}. The \ics{newacronym} command is modified to use the new abbreviation interface provided by \styfmt{glossaries-extra}. (See \sectionref{sec:abbreviations}.) The \cs{makeglossaries} command now has an optional argument. \begin{definition}[\DescribeMacro\makeglossaries] \cs{makeglossaries}\oarg{list} \end{definition} If \meta{list} is empty, \cs{makeglossaries} behaves as per its original definition in the \styfmt{glossaries} package, otherwise \meta{list} can be a comma-separated list of glossaries that need processing with an external indexing application. It should then be possible to use \cs{printglossary} for those glossaries listed in \meta{list} and \cs{printnoidxglossary} for the other glossaries. (See the accompanying file \texttt{sample-mixedsort.tex} for an example.) \begin{important} If you use the optional argument \meta{list}, you can't define entries in the document (even with the \pkgopt{docdef} option). \end{important} You will need at least version 2.20 of \gls{makeglossaries} or at least version 1.3 of the Lua alternative \gls{makeglossaries-lite.lua} (both distributed with \styfmt{glossaries} v4.27) to allow for this use of \cs{makeglossaries}\oarg{list}. Alternatively, use the \pkgopt{automake} option. \section{Entry Indexing} \label{sec:wrglossary} The \styfmt{glossaries-extra} package provides an extra key for commands like \cs{gls} and \cs{glstext} called \gloskey[glslink]{noindex}. This is a boolean key. If true, this suppresses the indexing. (That is, it prevents \cs{gls} or whatever from adding a line to the external glossary file.) This is more useful than the \pkgopt{indexonlyfirst} package option provided by \styfmt{glossaries}, as the \gls{firstuse} might not be the most pertinent use. (If you want to apply \pkgopt{indexonlyfirst} to selected entries, rather than all of them, you can use the \catattr{indexonlyfirst} attribute, see \sectionref{sec:categories} for further details.) Note that the \gloskey[glslink]{noindex} key isn't available for \ics{glsadd} (and \ics{glsaddall}) since the whole purpose of that command is to index an entry. There is a new hook that's used each time indexing information is written to the external glossary files: \begin{definition}[\DescribeMacro\glsxtrdowrglossaryhook] \cs{glsxtrdowrglossaryhook}\marg{label} \end{definition} where \meta{label} is the entry's label. This does nothing by default but may be redefined. (See, for example, the accompanying sample file \texttt{sample-indexhook.tex}, which uses this hook to determine which entries haven't been indexed.) The value of the \gloskey{see} key is now saved as a field. This isn't the case with \styfmt{glossaries}, where the \gloskey{see} attribute is simply used to directly write a line to the corresponding glossary file and is then discarded. This is why the \gloskey{see} key can't be used before \ics{makeglossaries} (since the file hasn't been opened yet). It's also the reason why the \gloskey{see} key doesn't have any effect when used in entries that are defined in the \env{document} environment. Since the value isn't saved, it's not available when the \texttt{.glsdefs} file is created at the end of the document and so isn't available at the start of the \env{document} environment on the next run. This modification allows \styfmt{glossaries-extra} to provide \begin{definition}[\DescribeMacro\glsxtraddallcrossrefs] \cs{glsxtraddallcrossrefs} \end{definition} which is used at the end of the document to automatically add any unused cross-references unless the package option \pkgopt{indexcrossrefs} was set to false. As a by-product of this enhancement, the \gloskey{see} key will now work for entries defined in the \env{document} environment, but it's still best to define entries in the preamble, and the \gloskey{see} key still can't perform any indexing before the file has been opened by \cs{makeglossaries}. Note that \styfmt{glossaries} v4.24 introduced the \pkgopt{seenoindex} package option, which can be used to suppress the error when the \gloskey{see} key is used before \cs{makeglossaries}, so \pkgopt[ignore]{seenoindex} will allow the \gloskey{see} value to be stored even though it may not be possible to index it at that point. As from version 1.06, you can display the cross-referenced information for a given entry using \begin{definition}[\DescribeMacro\glsxtrusesee] \cs{glsxtrusesee}\marg{label} \end{definition} This internally uses \begin{definition}[\DescribeMacro\glsxtruseseeformat] \cs{glsxtruseseeformat}\marg{tag}\marg{xr list} \end{definition} where \meta{tag} and \meta{xr list} are obtained from the value of the entry's \gloskey{see} field (if non-empty). By default, this just does \cs{glsseeformat}\oarg{tag}\marg{xr list}\verb|{}|, which is how the cross-reference is displayed in the \gls{numberlist}. Note that \cs{glsxtrusesee} does nothing if the \gloskey{see} field hasn't been set for the entry given by \meta{label}. Suppose you want to suppress the \gls*{numberlist} using \pkgopt{nonumberlist}. This will automatically prevent the cross-references from being displayed. The \pkgopt{seeautonumberlist} package option will automatically enable the \gls*{numberlist} for entries that have the \gloskey{see} key set, but this will also show the rest of the \gls*{numberlist}. Another approach in this situation is to use the post description hook with \cs{glsxtrusesee} to append the cross-reference after the description. For example: \begin{verbatim} \renewcommand*{\glsxtrpostdescgeneral}{% \ifglshasfield{see}{\glscurrententrylabel} {, \glsxtrusesee{\glscurrententrylabel}}% {}% } \end{verbatim} Now the cross-references can appear even though the \gls{numberlist} has been suppressed. \section{Entry Display Style Modifications} \label{sec:entryfmtmods} Recall from the \styfmt{glossaries} package that commands such as \cs{gls} display text at that point in the document (optionally with a hyperlink to the relevant line in the glossary). This text is referred to as the \qt{\gls{linktext}} regardless of whether or not it actually has a hyperlink. The actual text and the way it's displayed depends on the command used (such as \cs{gls}) and the entry format. The default entry format (\ics{glsentryfmt}) used in the \gls{linktext} by commands like \ics{gls}, \ics{glsxtrfull}, \ics{glsxtrshort} and \ics{glsxtrlong} (but not commands like \ics{glslink}, \ics{glsfirst} and \cs{glstext}) is changed by \styfmt{glossaries-extra} to test for regular entries, which are determined as follows: \begin{itemize} \item If an entry is assigned to a category that has the \catattr{regular} attribute set (see \sectionref{sec:categories}), the entry is considered a~regular entry, even if it has a~value for the \gloskey{short} key. In this case \cs{glsentryfmt} uses \ics{glsgenentryfmt} (provided by \styfmt{glossaries}), which uses the \gloskey{first} (or \gloskey{firstplural}) value on \gls{firstuse} and the \gloskey{text} (or \gloskey{plural}) value on subsequent use. \item An entry that doesn't have a~value for the \gloskey{short} key is assumed to be a~regular entry, even if the \catattr{regular} attribute isn't set to \qt{true} (since it can't be an abbreviation without the short form). In this case \cs{glsentryfmt} uses \ics{glsgenentryfmt}. \item If an entry does has a~value for the \gloskey{short} key and hasn't been marked as a~regular entry through the \catattr{regular} attribute, it's not considered a regular entry. In this case \cs{glsentryfmt} uses \ics{glsxtrgenabbrvfmt} (defined by \styfmt{glossaries-extra}) which is governed by the abbreviation style (see \sectionref{sec:abbrstyle}). \end{itemize} This means that entries with a short form can be treated as regular entries rather than abbreviations if it's more appropriate for the desired style. As from version 1.04, \ics{glsentryfmt} now puts \ics{glsgenentry} in the argument of the new command \begin{definition}[\DescribeMacro\glsxtrregularfont] \cs{glsxtrregularfont}\marg{text} \end{definition} This just does its argument \meta{text} by default. This means that if you want regular entries in a different font but don't want that font to apply to abbreviations, then you can redefine \cs{glsxtrregularfont}. This is more precise than changing \ics{glstextformat} which will be applied to all linking commands for all entries. For example: \begin{verbatim} \renewcommand*{\glsxtrregularfont}[1]{\textsf{#1}} \end{verbatim} You can access the label through \cs{glslabel}. For example, you can query the category: \begin{verbatim} \renewcommand*{\glsxtrregularfont}[1]{% \glsifcategory{\glslabel}{general}{\textsf{#1}}{#1}} \end{verbatim} or query the category attribute: \begin{verbatim} \glssetcategoryattribute{general}{font}{sf} \renewcommand*{\glsxtrregularfont}[1]{% \glsifattribute{\glslabel}{font}{sf}{\textsf{#1}}{#1}} \end{verbatim} or use the attribute to store the control sequence name: \begin{verbatim} \glssetcategoryattribute{general}{font}{textsf} \glssetcategoryattribute{acronym}{font}{emph} \renewcommand*{\glsxtrregularfont}[1]{% \glshasattribute{\glslabel}{font}% {\csuse{\glsgetattribute{\glslabel}{font}}{#1}}% {#1}% } \end{verbatim} (Remember the category and attribute settings will only queried here for \catattr{regular} entries, so if the abbreviation style for the \category{acronym} category in the above example changes the regular attribute to \qt{false}, \cs{glsxtrregularfont} will no longer apply.) The \cs{glspostlinkhook} provided by the \styfmt{glossaries} package to insert information after the \gls{linktext} produced by commands like \cs{gls} and \cs{glstext} is redefined to \begin{definition}[\DescribeMacro\glsxtrpostlinkhook] \cs{glsxtrpostlinkhook} \end{definition} This command will discard a following full stop (period) if the \catattr{discardperiod} attribute is set to \qt{true} for the current entry's category. It will also do \begin{definition}[\DescribeMacro\glsxtrpostlink] \cs{glsxtrpostlink} \end{definition} if a full stop hasn't be discarded and \begin{definition}[\DescribeMacro\glsxtrpostlinkendsentence] \cs{glsxtrpostlinkendsentence} \end{definition} if a full stop has been discarded. \begin{important} Avoid the use of \cs{gls}-like and \cs{glstext}-like commands within the post-link hook as they will cause interference. Consider using commands like \cs{glsentrytext}, \cs{glsaccesstext} or \cs{glsxtrp} (\sectionref{sec:nested}) instead. \end{important} By default \cs{glsxtrpostlink} just does \postlinkcat\ if it exists, where \meta{category} is the category label for the current entry. (For example, for the \category{general} category, \cs{glsxtrpostlinkgeneral} if it has been defined.) \begin{sloppypar} The sentence-ending hook is slightly more complicated. If the command \postlinkcat\ is defined the hook will do that and then insert a full stop with the space factor adjusted to match the end of sentence. If \postlinkcat\ hasn't been defined, the space factor is adjusted to match the end of sentence. This means that if you have, for example, an entry that ends with a full stop, a redundant following full stop will be discarded and the space factor adjusted (in case the entry is in uppercase) unless the entry is followed by additional material, in which case the following full stop is no longer redundant and needs to be reinserted. \end{sloppypar} There are some convenient commands you might want to use when customizing the post-\gls{linktext} category hooks: \begin{definition}[\DescribeMacro\glsxtrpostlinkAddDescOnFirstUse] \cs{glsxtrpostlinkAddDescOnFirstUse} \end{definition} This will add the description in parentheses on \gls{firstuse}. For example, suppose you want to append the description in parentheses on \gls{firstuse} for entries in the \category{symbol} category: \begin{verbatim} \newcommand*{\glsxtrpostlinksymbol}{% \glsxtrpostlinkAddDescOnFirstUse } \end{verbatim} \begin{definition}[\DescribeMacro\glsxtrpostlinkAddSymbolOnFirstUse] \cs{glsxtrpostlinkAddSymbolOnFirstUse} \end{definition} This will append the symbol (if defined) in parentheses on \gls{firstuse}. If you want to provide your own custom format be aware that you can't use \ics{ifglsused} within the post-\gls{linktext} hook as by this point the \gls{firstuseflag} will have been unset. Instead you can use \begin{definition}[\DescribeMacro\glsxtrifwasfirstuse] \cs{glsxtrifwasfirstuse}\marg{true}\marg{false} \end{definition} This will do \meta{true} if the last used entry was the \gls{firstuse} for that entry, otherwise it will do \meta{false}. (Requires at least \styfmt{glossaries} v4.19 to work properly.) This command is locally set by commands like \cs{gls}, so don't rely on it outside of the post-\gls{linktext} hook. \begin{important} Note that commands like \ics{glsfirst} and \ics{glsxtrfull} fake \gls{firstuse} for the benefit of the post-\gls{linktext} hooks by setting \cs{glsxtrifwasfirstuse} to \cs{@firstoftwo}. (Although, depending on the styles in use, they may not exactly match the text produced by \ics{gls}-like commands on \gls{firstuse}.) However, the \abbrstyle{short-postfootnote} style alters \cs{glsxtrfull} so that it fakes non-\gls{firstuse} otherwise the inline full format would include the footnote, which is inappropriate. \end{important} For example, if you want to place the description in a footnote after the \gls{linktext} on \gls{firstuse} for the \category{general} category: \begin{verbatim} \newcommand*{\glsxtrpostlinkgeneral}{% \glsxtrifwasfirstuse{\footnote{\glsentrydesc{\glslabel}}}{}% } \end{verbatim} The \abbrstyle{short-postfootnote} abbreviation style uses the post-\gls{linktext} hook to place the footnote after trailing punctuation characters. You can set the default options used by \ics{glslink}, \ics{gls} etc with: \begin{definition}[\DescribeMacro\GlsXtrSetDefaultGlsOpts] \cs{GlsXtrSetDefaultGlsOpts}\marg{options} \end{definition} For example, if you mostly don't want to index entries then you can do: \begin{verbatim} \GlsXtrSetDefaultGlsOpts{noindex} \end{verbatim} and then use, for example, \verb|\gls[noindex=false]{sample}| when you actually want the location added to the \gls{numberlist}. These defaults may be overridden by other settings (such as category attributes) in addition to any settings passed in the option argument of commands like \cs{glslink} and \cs{gls}. Note that if you don't want \emph{any} indexing, just omit \cs{makeglossaries} and \cs{printglossaries} (or analogous commands). Commands like \ics{gls} have star (\texttt{*}) and plus (\texttt{+}) modifiers as a short cut for \texttt{hyper=false} and \texttt{hyper=true}. The \styfmt{glossaries-extra} package provides a way to add a third modifier, if required, using \begin{definition}[\DescribeMacro\GlsXtrSetAltModifier] \cs{GlsXtrSetAltModifier}\marg{char}\marg{options} \end{definition} where \meta{char} is the character used as the modifier and \meta{options} is the default set of options (which may be overridden). Note that \meta{char} must be a single character (not a UTF-8 character, unless you are using \XeLaTeX\ or \LuaLaTeX). \begin{important} When choosing the character \meta{char} take care of any changes in category code. \end{important} Example: \begin{verbatim} \GlsXtrSetAltModifier{!}{noindex} \end{verbatim} This means that \verb|\gls!{sample}| will be equivalent to \verb|\gls[noindex]{sample}|. It's not possible to mix modifiers. For example, if you want to do \begin{verbatim} \gls[noindex,hyper=false]{sample} \end{verbatim} you can use \verb|\gls*[noindex]{sample}| or \verb|\gls![hyper=false]{sample}| but you can't combine the \texttt{*} and \texttt{!} modifiers. \Glspl{locationlist} displayed with \cs{printnoidxglossary} internally use \begin{definition}[\DescribeMacro\glsnoidxdisplayloc] \cs{glsnoidxdisplayloc}\marg{prefix}\marg{counter}\marg{format}\marg{location} \end{definition} This command is provided by \styfmt{glossaries}, but is modified by \styfmt{glossaries-extra} to check for the start and end range formation identifiers \verb|(| and \verb|)| which are discarded to obtain the actual control sequence name that forms the location formatting command. If the range identifiers aren't present, this just uses \begin{definition}[\DescribeMacro\glsxtrdisplaysingleloc] \cs{glsxtrdisplaysingleloc}\marg{format}\marg{location} \end{definition} otherwise it uses \begin{definition}[\DescribeMacro\glsxtrdisplaystartloc] \cs{glsxtrdisplaystartloc}\marg{format}\marg{location} \end{definition} for the start of a range (where the identifier has been stripped from \meta{format}) or \begin{definition}[\DescribeMacro\glsxtrdisplayendloc] \cs{glsxtrdisplayendloc}\marg{format}\marg{location} \end{definition} for the end of a range (where the identifier has been stripped from \meta{format}). By default the start range command saves the format in \begin{definition}[\DescribeMacro\glsxtrlocrangefmt] \cs{glsxtrlocrangefmt} \end{definition} and does \begin{display} \cs{glsxtrdisplaysingleloc}\marg{format}\marg{location} \end{display} (If the format is empty, it will be replaced with \texttt{glsnumberformat}.) The end command checks that the format matches the start of the range, does \begin{definition}[\DescribeMacro\glsxtrdisplayendlochook] \cs{glsxtrdisplayendlochook}\marg{format}\marg{location} \end{definition} (which does nothing by default), followed by \begin{display} \cs{glsxtrdisplaysingleloc}\marg{format}\marg{location} \end{display} and then sets \cs{glsxtrlocrangefmt} to empty. This means that the list \begin{verbatim} \glsnoidxdisplayloc{}{page}{(textbf}{1}, \glsnoidxdisplayloc{}{page}{textbf}{1}, \glsnoidxdisplayloc{}{page}{)textbf}{1}. \end{verbatim} doesn't display any differently from \begin{verbatim} \glsnoidxdisplayloc{}{page}{textbf}{1}, \glsnoidxdisplayloc{}{page}{textbf}{1}, \glsnoidxdisplayloc{}{page}{textbf}{1}. \end{verbatim} but it does make it easier to define your own custom list handler that can accommodate the ranges. \section{Entry Counting Modifications} \label{sec:entrycountmods} The \ics{glsenableentrycount} command is modified to allow for the \catattr{entrycount} attribute. This means that you not only need to enable entry counting with \cs{glsenableentrycount}, but you also need to set the appropriate attribute (see \sectionref{sec:categories}). For example, instead of just doing: \begin{verbatim} \glsenableentrycount \end{verbatim} you now need to do: \begin{verbatim} \glsenableentrycount \glssetcategoryattribute{abbreviation}{entrycount}{1} \end{verbatim} This will enable the entry counting for entries in the \category{abbreviation} category, but any entries assigned to other categories will be unchanged. Further information about entry counting, including the new per-unit feature, is described in \sectionref{sec:entrycount}. \section{Plurals} Some languages, such as English, have a general rule that plurals are formed from the singular with a suffix appended. This isn't an absolute rule. There are plenty of exceptions (for example, geese, children, churches, elves, fairies, sheep). The \sty{glossaries} package allows the \gloskey{plural} key to be optional when defining entries. In some cases a plural may not make any sense (for example, the term is a symbol) and in some cases the plural may be identical to the singular. To make life easier for languages where the majority of plurals can simply be formed by appending a suffix to the singular, the \sty{glossaries} package sets lets the \gloskey{plural} field default to the value of the \gloskey{text} field with \ics{glspluralsuffix} appended. This command is defined to be just the letter \qt{s}. This means that the majority of terms don't need to have the \gloskey{plural} supplied as well, and you only need to use it for the exceptions. For languages that don't have this general rule, the \gloskey{plural} field will always need to be supplied, where needed. There are other plural fields, such as \gloskey{firstplural}, \gloskey{longplural} and \gloskey{shortplural}. Again, if you are using a language that doesn't have a simple suffix rule, you'll have to supply the plural forms if you need them (and if a plural makes sense in the context). If these fields are omitted, the \sty{glossaries} package follows these rules: \begin{itemize} \item If \gloskey{firstplural} is missing, then \cs{glspluralsuffix} is appended to the \gloskey{first} field, if that field has been supplied. If the \gloskey{first} field hasn't been supplied but the \gloskey{plural} field has been supplied, then the \gloskey{firstplural} field defaults to the \gloskey{plural} field. If the \gloskey{plural} field hasn't been supplied, then both the \gloskey{plural} and \gloskey{firstplural} fields default to the \gloskey{text} field (or \gloskey{name}, if no \gloskey{text} field) with \cs{glspluralsuffix} appended. \item If the \gloskey{longplural} field is missing, then \cs{glspluralsuffix} is appended to the \gloskey{long} field, if the \gloskey{long} field has been supplied. \item If the \gloskey{shortplural} field is missing then, \emph{with the base \sty{glossaries} acronym mechanism}, \ics{acrpluralsuffix} is appended to the \gloskey{short} field. \end{itemize} This \emph{last case is changed} with \styfmt{glossaries-extra}. With this extension package, the \gloskey{shortplural} field defaults to the \gloskey{short} field with \ics{abbrvpluralsuffix} appended unless overridden by category attributes. This suffix command is set by the abbreviation styles. This means that every time an abbreviation style is implemented, \cs{abbrvpluralsuffix} is redefined. In most cases its redefined to use \begin{definition}[\DescribeMacro\glsxtrabbrvpluralsuffix] \cs{glsxtrabbrvpluralsuffix} \end{definition} which defaults to just \cs{glspluralsuffix}. Some of the abbreviation styles have their own command for the plural suffix, such as \cs{glsxtrscsuffix} which is defined as: \begin{verbatim} \newcommand*{\glsxtrscsuffix}{\glstextup{\glsxtrabbrvpluralsuffix}} \end{verbatim} So if you want to completely strip all the plural suffixes used for abbreviations then you need to redefine \cs{glsxtrabbrvpluralsuffix} \emph{not} \cs{abbrvpluralsuffix}, which changes with the style. Redefining \cs{acrpluralsuffix} will have no affect, since it's not used by the new abbreviation mechanism. If you require a mixture (for example, in a multilingual document), there are two attributes that affect the short plural suffix formation. The first is \catattr{aposplural} which uses the suffix \begin{verbatim} '\abbrvpluralsuffix \end{verbatim} That is, an apostrophe followed by \cs{abbrvpluralsuffix} is appended. The second attribute is \catattr{noshortplural} which suppresses the suffix and simply sets \gloskey{shortplural} to the same as \gloskey{short}. \section{Nested Links} \label{sec:nested} Complications arise when you use \ics{gls} in the value of the \gloskey{name} field (or \gloskey{text} or \gloskey{first} fields, if set). This tends to occur with abbreviations that extend other abbreviations. For example, SHTML is an abbreviation for SSI enabled HTML, where SSI is an abbreviation for Server Side Includes and HTML is an abbreviation for Hypertext Markup Language. Things can go wrong if we try the following with the \styfmt{glossaries} package: \begin{verbatim} \newacronym{ssi}{SSI}{Server Side Includes} \newacronym{html}{HTML}{Hypertext Markup Language} \newacronym{shtml}{S\gls{html}}{\gls{ssi} enabled \gls{html}} \end{verbatim} The main problems are: \begin{enumerate} \item\label{itm:nestedfirstucprob} The first letter upper casing commands, such as \ics{Gls}, won't work for the \texttt{shtml} entry on \gls{firstuse} if the long form is displayed before the short form (which is the default abbreviation style). This will attempt to do \begin{verbatim} \gls{\uppercase ssi} enabled \gls{html} \end{verbatim} which just doesn't work. Grouping the \verb|\gls{ssi}| doesn't work either as this will effectively try to do \begin{verbatim} \uppercase{\gls{ssi}} enabled \gls{html} \end{verbatim} This will upper case the label \texttt{ssi} so the entry won't be recognised. This problem will also occur if you use the all capitals version, such as \ics{GLS}. \item\label{itm:nonexpandprob} The long and abbreviated forms accessed through \ics{glsentrylong} and \ics{glsentryshort} are no longer expandable and so can't be used be used in contexts that require this, such as PDF bookmarks. \item\label{itm:nestedsortprob} The nested commands may end up in the \gloskey{sort} key, which will confuse the indexing. \item\label{itm:inconsistentfirstuseprob} The \texttt{shtml} entry produces inconsistent results depending on whether the \texttt{ssi} or \texttt{html} entries have been used. Suppose both \texttt{ssi} and \texttt{html} are used before \texttt{shtml}. For example: \begin{verbatim} This section discusses \gls{ssi}, \gls{html} and \gls{shtml}. \end{verbatim} This produces: \begin{quote} This section discusses server side includes (SSI), hypertext markup language (HTML) and SSI enabled HTML (SHTML). \end{quote} So the \gls{firstuse} of the \texttt{shtml} entry produces \qt{SSI enabled HTML (SHTML)}. Now let's suppose the \texttt{html} entry is used before the \texttt{shtml} but the \texttt{ssi} entry is used after the \texttt{shtml} entry, for example: \begin{verbatim} The sample files are either \gls{html} or \gls{shtml}, but let's first discuss \gls{ssi}. \end{verbatim} This produces: \begin{quote} The sample files are either hypertext markup language (HTML) or server side includes (SSI) enabled HTML (SHTML), but let’s first discuss SSI. \end{quote} So the \gls{firstuse} of the \texttt{shtml} entry now produces \qt{server side includes (SSI) enabled HTML (SHTML)}, which looks a bit strange. Now let's suppose the \texttt{shtml} entry is used before (or without) the other two entries: \begin{verbatim} This article is an introduction to \gls{shtml}. \end{verbatim} This produces: \begin{quote} This article is an introduction to server side includes (SSI) enabled hypertext markup language (HTML) (SHTML). \end{quote} So the \gls{firstuse} of the \texttt{shtml} entry now produces \qt{server side includes (SSI) enabled hypertext markup language (HTML) (SHTML)}, which is even more strange. This is all aggravated by setting the style using the \styfmt{glossaries} package's \cs{setacronymstyle}. For example: \begin{verbatim} \setacronymstyle{long-short} \end{verbatim} as this references the label through the use of \cs{glslabel} when displaying the long and short forms, but this value changes with each use of \cs{gls}, so instead of displaying \qt{(SHTML)} at the end of the \gls{firstuse}, it now displays \qt{(HTML)}, since \cs{glslabel} has been changed to \texttt{html} by \verb|\gls{html}|. Another oddity occurs if you reset the \texttt{html} entry between uses of the \texttt{shtml} entry. For example: \begin{verbatim} \gls{shtml} ... \glsreset{html}\gls{shtml} \end{verbatim} The next use of \texttt{shtml} produces \qt{Shypertext markup language (HTML)}, which is downright weird. Even without this, the short form has nested formatting commands, which amount to \verb|\acronymfont{S\acronymfont{HTML}}|. This may not be a problem for some styles, but if you use one of the \qt{sm} styles (that use \ics{textsmaller}), this will produce an odd result. \item\label{itm:indexingprob} Each time the \texttt{shtml} entry is used, the \texttt{html} entry will also be indexed and marked as used, and on \gls{firstuse} this will happen to both the \texttt{ssi} and \texttt{html} entries. This kind of duplication in the location list isn't usually particularly helpful to the reader. \item\label{itm:nestedhyplinkprob} If \sty{hyperref} is in use, you'll get nested hyperlinks and there's no consistent way of dealing with this across the available PDF viewers. If on the \gls{firstuse} case, the user clicks on the \qt{HTML} part of the \qt{SSI enabled HTML (SHTML)} link, they may be directed to the HTML entry in the glossary or they may be directed to the SHTML entry in the glossary. \end{enumerate} For these reasons it's better to use the simple expandable commands like \ics{glsentrytext} or \ics{glsentryshort} in the definition of other entries (although that doesn't fix the first problem). Alternatively use something like: \begin{verbatim} \newacronym [description={\acrshort{ssi} enabled \acrshort{html}}] {shtml}{SHTML}{SSI enabled HTML} \end{verbatim} with \styfmt{glossaries} or: \begin{verbatim} \newabbreviation [description={\glsxtrshort{ssi} enabled \glsxtrshort{html}}] {shtml}{SHTML}{SSI enabled HTML} \end{verbatim} with \styfmt{glossaries-extra}. This fixes all the above listed problems (as long as you don't use \ics{glsdesc}). Note that replacing \cs{gls} with \cs{acrshort} in the original example may fix the \gls{firstuse} issue, but it doesn't fix any of the other problems listed above. If it's simply that you want to use the abbreviation font, you can use \cs{glsabbrvfont}: \begin{verbatim} \setabbreviationstyle{long-short-sc} \newabbreviation{ssi}{ssi}{server-side includes} \newabbreviation{html}{html}{hypertext markup language} \newabbreviation{shtml}{shtml}{\glsabbrvfont{ssi} enabled \glsabbrvfont{html}} \end{verbatim} This will pick up the font style setting of the outer entry (shtml, in the above case). This isn't a problem in the above example as all the abbreviations use the same style. However if you're really determined to use \ics{gls} in a field that may be included within some \gls{linktext}, \styfmt{glossaries-extra} patches internals used by the linking commands so that if \cs{gls} (or plural or case changing variants) occurs in the \gls{linktext} it will behave as though you used \texttt{\ics{glstext}[hyper=false,noindex]} instead. Grouping is also added so that, for example, when \verb|\gls{shtml}| is used for the first time the long form \begin{verbatim} \gls{ssi} enabled \gls{html} \end{verbatim} is treated as \begin{verbatim} {\glstext[hyper=false,noindex]{ssi}} enabled {\glstext[hyper=false,noindex]{html}} \end{verbatim} This overcomes problems~\ref{itm:inconsistentfirstuseprob}, \ref{itm:indexingprob} and \ref{itm:nestedhyplinkprob} listed above, but still doesn't fix problems~\ref{itm:nestedfirstucprob} and \ref{itm:nonexpandprob}. Problem~\ref{itm:nestedsortprob} usually won't be an issue as most abbreviation styles set the \gloskey{sort} key to the short form, so using these commands in the long form but not the short form will only affect entries with a style that sorts according to the long form (such as \abbrstyle{long-noshort-desc}). Additionally, any instance of the long form commands, such as \ics{glsxtrlong} or \ics{acrlong} will be temporarily redefined to just use \begin{alltt} \{\ics{glsentrylong}\marg{label}\meta{insert}\} \end{alltt} (or case-changing versions). Similarly the short form commands, such as \ics{glsxtrshort} or \ics{acrshort} will use \ics{glsentryshort} in the argument of either \cs{glsabbrvfont} (for \cs{glsxtrshort}) or \cs{acronymfont} (for \cs{acrshort}). So if the \texttt{shtml} entry had instead been defined as: \begin{verbatim} \newacronym{shtml}{SHTML}{\acrshort{ssi} enabled \acrshort{html}} \end{verbatim} then (using the \abbrstyle{long-short} style) the \gls{firstuse} will be like \begin{verbatim} {\acronymfont{\glsentryshort{ssi}}} enabled {\acronymfont{\glsentryshort{html}}} (SHTML) \end{verbatim} whereas if the entry is defined as: \begin{verbatim} \newabbreviation{shtml}{SHTML}{\glsxtrshort{ssi} enabled \glsxtrshort{html}} \end{verbatim} then the \gls{firstuse} will be like: \begin{verbatim} {\glsabbrvfont{\glsentryshort{ssi}}} enabled {\glsabbrvfont{\glsentryshort{html}}} (SHTML) \end{verbatim} Note that the first optional argument of \cs{acrshort} or \cs{glsxtrshort} is ignored in this context. (The final optional argument will be inserted, if present.) The abbreviation style that governs \ics{glsabbrvfont} will be set for \ics{glsxtrshort}. Note that \cs{acrshort} doesn't set the abbreviation style. Alternatively you can use: \begin{definition}[\DescribeMacro\glsxtrp] \cs{glsxtrp}\marg{field}\marg{label} \end{definition} where \meta{field} is the field label and corresponds to a command in the form \cs{gls}\meta{field} (e.g.\ \cs{glstext}) or in the form \cs{glsxtr}\meta{field} (e.g.\ \cs{glsxtrshort}). There's a shortcut command for the most common fields: \begin{definition}[\DescribeMacro\glsps] \cs{glsps}\marg{label} \end{definition} which is equivalent to \verb|\glsxtrp{short}|\marg{label}, and \begin{definition}[\DescribeMacro\glspt] \cs{glspt}\marg{label} \end{definition} which is equivalent to \verb|\glsxtrp{text}|\marg{label}. The \cs{glsxtrp} command behaves much like the \cs{glsfmt}\meta{field} commands described in \sectionref{sec:headtitle} but the post-link hook is also suppressed and extra grouping is added. It automatically sets \gloskey[glslink]{hyper} to \texttt{false} and \gloskey[glslink]{noindex} to \texttt{true}. If you want to change this, you can use \begin{definition}[\DescribeMacro\glsxtrsetpopts] \cs{glsxtrsetpopts}\marg{options} \end{definition} For example: \begin{verbatim} \glsxtrsetpopts{hyper=false} \end{verbatim} will just switch off the hyperlinks but not the indexing. Be careful using this command or you can end up back to the original problem of nested links. The hyper link is re-enabled within glossaries. This is done through the command: \begin{definition}[\DescribeMacro\glossxtrsetpopts] \cs{glossxtrsetpopts} \end{definition} which by default just does \begin{verbatim} \glsxtrsetpopts{noindex} \end{verbatim} You can redefine this if you want to adjust the setting when \cs{glsxtrp} is used in the glossary. For example: \begin{verbatim} \renewcommand{\glossxtrsetpopts}{\glsxtrsetpopts{noindex=false}} \end{verbatim} For example, \begin{verbatim} \glsxtrp{short}{ssi} \end{verbatim} is equivalent to \begin{verbatim} {\let\glspostlinkhook\relax \glsxtrshort[hyper=false,noindex]{ssi}[]% } \end{verbatim} in the main body of the document or \begin{verbatim} {\let\glspostlinkhook\relax \glsxtrshort[noindex]{ssi}[]% } \end{verbatim} inside the glossary. (Note the post-link hook is locally disabled.) If \verb|\glsxtrp{short}{ssi}| occurs in a sectioning mark, it's equivalent to \begin{verbatim} {\glsxtrheadshort{ssi}} \end{verbatim} (which recognises the \catattr{headuc} attribute.) If \sty{hyperref} has been loaded, then the bookmark will use \cs{glsentry}\meta{field} (\verb|\glsentryshort{ssi}| in the above example). There are similar commands \begin{definition}[\DescribeMacro\Glsxtrp] \cs{Glsxtrp}\marg{field}\marg{label} \end{definition} for first letter upper case and \begin{definition}[\DescribeMacro\Glsxtrp] \cs{GLSxtrp}\marg{field}\marg{label} \end{definition} for all upper case. \begin{important} If you use any of the case-changing commands, such as \ics{Gls} or \ics{Glstext}, (either all caps or first letter upper casing) don't use any of the linking commands, such as \ics{gls} or \ics{glstext}, in the definition of entries for any of the fields that may be used by those case-changing commands. \end{important} You can, with care, protect against issue~\ref{itm:nestedfirstucprob} by inserting an empty group at the start if the long form starts with a command that breaks the first letter uppercasing commands like \cs{Gls}, but you still won't be able to use the all caps commands, such as \cs{GLS}. If you \emph{really need} nested commands, the safest method is \begin{verbatim} \newabbreviation{shtml}{shtml}{{}\glsxtrp{short}{ssi} enabled \glsxtrp{short}{html}} \end{verbatim} but be aware that it may have some unexpected results occasionally. Example document: \begin{verbatim} \documentclass{report} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{slantsc} \usepackage[colorlinks]{hyperref} \usepackage[nopostdot=false]{glossaries-extra} \makeglossaries \setabbreviationstyle{long-short-sc} \newabbreviation{ssi}{ssi}{server-side includes} \newabbreviation{html}{html}{hypertext markup language} \newabbreviation{shtml}{shtml}{{}\glsps{ssi} enabled {}\glsps{html}} \pagestyle{headings} \glssetcategoryattribute{abbreviation}{headuc}{true} \glssetcategoryattribute{abbreviation}{glossdesc}{title} \begin{document} \tableofcontents \chapter{\glsfmtfull{shtml}} First use: \gls{shtml}, \gls{ssi} and \gls{html}. Next use: \gls{shtml}, \gls{ssi} and \gls{html}. \newpage Next page. \printglossaries \end{document} \end{verbatim} \section{Acronym Style Modifications} \label{sec:acronymmods} The \styfmt{glossaries-extra} package provides a new way of dealing with abbreviations and redefines \ics{newacronym} to use \cs{newabbreviation} (see \sectionref{sec:abbreviations}). The simplest way to update a document that uses \cs{newacronym} from \styfmt{glossaries} to \styfmt{glossaries-extra} is do just add \begin{verbatim} \setabbreviationstyle[acronym]{long-short} \end{verbatim} before you define any entries. For example, the following document using just \styfmt{glossaries} \begin{verbatim} \documentclass{article} \usepackage[acronym,nopostdot,toc]{glossaries} \makeglossaries \setacronymstyle{long-short} \newacronym{html}{HTML}{hypertext markup language} \begin{document} \gls{html} \printglossaries \end{document} \end{verbatim} can be easily adapted to use \styfmt{glossaries-extra}: \begin{verbatim} \documentclass{article} \usepackage[acronym]{glossaries-extra} \makeglossaries \setabbreviationstyle[acronym]{long-short} \newacronym{html}{HTML}{hypertext markup language} \begin{document} \gls{html} \printglossaries \end{document} \end{verbatim} Table~\ref{tab:acrabbrvstyles} lists the nearest equivalent \styfmt{glossaries-extra} abbreviation styles for the predefined acronym styles provided by \styfmt{glossaries}, but note that the new styles use different formatting commands. See \sectionref{sec:predefabbrvstyles} for further details. \begin{table}[htbp] \caption[Old Acronym Styles Verses New Abbreviation Styles]{Old Acronym Styles \cs{setacronymstyle}\marg{old-style-name} Verses New Abbreviation Styles \cs{setabbreviationstyle}\oarg{category}\marg{new-style-name}} \label{tab:acrabbrvstyles} \centering \begin{tabular}{@{}p{\dimexpr0.3\textwidth-2\tabcolsep}p{0.7\textwidth}@{}} \bfseries Old Style Name & \bfseries New Style Name\\ \acrstyle{long-sc-short} & \abbrstyle{long-short-sc}\\ \acrstyle{long-sm-short} & \abbrstyle{long-short-sm}\\ \acrstyle{long-sp-short} & \abbrstyle{long-short} \newline with \ttfamily\cs{renewcommand}\{\cs{glsxtrfullsep}\}[1]\{\cs{glsacspace}\{\#1\}\}\\ \acrstyle{short-long} & \abbrstyle{short-long}\\ \acrstyle{sc-short-long} & \abbrstyle{short-sc-long}\\ \acrstyle{sm-short-long} & \abbrstyle{short-sm-long}\\ \acrstyle{long-short-desc} & \abbrstyle{long-short-desc}\\ \acrstyle{long-sc-short-desc} & \abbrstyle{long-short-sc-desc}\\ \acrstyle{long-sm-short-desc} & \abbrstyle{long-short-sm-desc}\\ \acrstyle{long-sp-short-desc} & \abbrstyle{long-short-desc} \newline with \ttfamily\cs{renewcommand}\{\cs{glsxtrfullsep}\}[1]\{\cs{glsacspace}\{\#1\}\}\\ \acrstyle{short-long-desc} & \abbrstyle{short-long-desc}\\ \acrstyle{sc-short-long-desc} & \abbrstyle{short-sc-long-desc}\\ \acrstyle{sm-short-long-desc} & \abbrstyle{short-sm-long-desc}\\ \acrstyle{dua} & \abbrstyle{long-noshort}\\ \acrstyle{dua-desc} & \abbrstyle{long-noshort-desc}\\ \acrstyle{footnote} & \abbrstyle{short-footnote}\\ \acrstyle{footnote-sc} & \abbrstyle{short-sc-footnote}\\ \acrstyle{footnote-sm} & \abbrstyle{short-sm-footnote}\\ \acrstyle{footnote-desc} & \abbrstyle{short-footnote-desc}\\ \acrstyle{footnote-sc-desc} & \abbrstyle{short-sc-footnote-desc}\\ \acrstyle{footnote-sm-desc} & \abbrstyle{short-sm-footnote-desc} \end{tabular} \end{table} The reason for introducing the new style of abbreviation commands provided by \styfmt{glossaries-extra} is because the original acronym commands provided by \styfmt{glossaries} are too restrictive to work with the internal modifications made by \styfmt{glossaries-extra}. However, if you really want to restore the generic acronym function provided by \styfmt{glossaries} you can use \begin{definition}[\DescribeMacro\RestoreAcronyms] \cs{RestoreAcronyms} \end{definition} (before any use of \cs{newacronym}). \cs{RestoreAcronyms} should not be used in combination with the newer \styfmt{glossaries-extra} abbreviations. Don't combine old and new style entries with the same \gloskey{type}. The original \styfmt{glossaries} acronym mechanism doesn't work well with the newer \styfmt{glossaries-extra} commands. \begin{important} If you use \cs{RestoreAcronyms}, don't use any of the commands provided by \styfmt{glossaries-extra} intended for abbreviations (such as \ics{glsxtrshort} or \ics{glsfmtshort}) with entries defined via \ics{newacronym} as it will cause unexpected results. \end{important} In general, there's rarely any need for \cs{RestoreAcronyms}. If you have a document that uses \ics{newacronymstyle}, then it's best to either stick with just \styfmt{glossaries} for that document or define an equivalent abbreviation style with \ics{newabbreviationstyle}. (See \sectionref{sec:newabbrvstyle} for further details.) \begin{definition}[\DescribeMacro\glsacspace] \cs{glsacspace}\marg{label} \end{definition} The space command \cs{glsacspace} used by the \acrstyle{long-sp-short} acronym style provided by \styfmt{glossaries} is modified so that it uses \begin{definition}[\DescribeMacro\glsacspacemax] \cs{glsacspacemax} \end{definition} instead of the hard-coded 3em. This is a command not a length and so can be changed using \cs{renewcommand}. Any of the new abbreviation styles that use \ics{glsxtrfullsep} (such as \abbrstyle{long-short}) can easily be changed to use \cs{glsacspace} with \begin{verbatim} \renewcommand*{\glsxtrfullsep}[1]{\glsacspace{#1}} \end{verbatim} The \gls{firstuse} acronym font command \begin{definition}[\firstacronymfont] \cs{firstacronymfont}\marg{text} \end{definition} is redefined to use the \gls{firstuse} abbreviation font command \ics{glsfirstabbrvfont}. This will be reset if you use \cs{RestoreAcronyms}. The subsequent use acronym font command \begin{definition}[\acronymfont] \cs{acronymfont}\marg{text} \end{definition} is redefined to use the subsequent use abbreviation font command \ics{glsabbrvfont}. This will be reset if you use \cs{RestoreAcronyms}. \section{Glossary Style Modifications} \label{sec:glosstylemods} The default value of \ics{glslistdottedwidth} is changed so that it's set at the start of the document (if it hasn't been changed in the preamble). This should take into account situations where \cs{hsize} isn't set until the start of the document. \subsection{Style Hooks} \label{sec:stylehooks} The commands \ics{glossentryname} and \ics{glossentrydesc} are modified to take into account the \catattr{glossname}, \catattr{glossdesc} and \catattr{glossdescfont} attributes (see \sectionref{sec:categories}). This means you can make simple case-changing modifications to the name and description without defining a new glossary style. There is a hook after \ics{glossentryname} and \ics{Glossentryname}: \begin{definition}[\DescribeMacro\glsxtrpostnamehook] \cs{glsxtrpostnamehook}\marg{label} \end{definition} By default this checks the \catattr{indexname} attribute. If the attribute exists for the category to which the label belongs, then the name is automatically indexed using \begin{definition} \ics{glsxtrdoautoindexname}\marg{label}\texttt{\{indexname\}} \end{definition} See \sectionref{sec:autoindex} for further details. \begin{sloppypar} As from version 1.04, the post-name hook \cs{glsxtrpostnamehook} will also use \cs{glsxtrpostname}\meta{category} if it exists. You can use \ics{glscurrententrylabel} to obtain the entry label with the definition of this command. For example, suppose you are using a glossary style the doesn't display the symbol, you can insert the symbol after the name for a particular category, say, the \qt{symbol} category: \end{sloppypar} \begin{verbatim} \newcommand*{\glsxtrpostnamesymbol}{\space (\glsentrysymbol{\glscurrententrylabel})} \end{verbatim} The post-description code used within the glossary is modified so that it also does \begin{definition}[\DescribeMacro\glsxtrpostdescription] \cs{glsxtrpostdescription} \end{definition} This occurs before the original \cs{glspostdescription}, so if the \pkgopt[false]{nopostdot} option is used, it will be inserted before the terminating full stop. This new command will do \cs{glsxtrpostdesc\meta{category}} if it exists, where \meta{category} is the category label associated with the current entry. For example \cs{glsxtrpostdescgeneral} for entries with the category set to \category{general} or \cs{glsxtrpostdescacronym} for entries with the category set to \category{acronym}. Since both \cs{glossentry} and \cs{subglossentry} set \begin{definition}[\DescribeMacro\glscurrententrylabel] \cs{glscurrententrylabel} \end{definition} to the label for the current entry, you can use this within the definition of these post-description hooks if you need to reference the label. For example, suppose you want to insert the plural form in brackets after the description in the glossary, but only for entries in the \category{general} category, then you could do: \begin{verbatim} \renewcommand{\glsxtrpostdescgeneral}{\space (plural: \glsentryplural{\glscurrententrylabel})} \end{verbatim} This means you don't have to define a custom glossary style, which you may find more complicated. (It also allows more flexibility if you decide to change the underlying glossary style.) \begin{important} This feature can't be used for glossary styles that ignore \cs{glspostdescription} or if you redefine \cs{glspostdescription} without including \cs{glsxtrpostdescription}. (For example, if you redefine \cs{glspostdescription} to do nothing instead of using the \pkgopt{nopostdot} option to suppress the terminating full stop.) See \sectionref{sec:stylemods} to patch the predefined styles provided by \styfmt{glossaries} that are missing \cs{glspostdescription}. \end{important} \subsection{Number List} \label{sec:glosstylenumlist} The \gls{numberlist} is now placed inside the argument of \begin{definition}[\DescribeMacro\GlsXtrFormatLocationList] \cs{GlsXtrFormatLocationList}\marg{number list} \end{definition} This is internally used by \cs{glossaryentrynumbers}. The \pkgopt{nonumberlist} option redefines \cs{glossaryentrynumbers} so that it doesn't display the \gls{numberlist}, but it still saves the \gls{numberlist} in case it's required. \begin{important} If you want to suppress the \gls{numberlist} always use the \pkgopt{nonumberlist} option instead of redefining \cs{glossaryentrynumbers} to do nothing. \end{important} If you want to, for example, change the font for the entire \gls{numberlist} then redefine \cs{GlsXtrFormatLocationList} as appropriate. Don't modify \cs{glossaryentrynumbers}. Sometimes users like to insert \qt{page} or \qt{pages} in front of the \gls{numberlist}. This is quite fiddly to do with the base \styfmt{glossaries} package, but \styfmt{glossaries-extra} provides a way of doing this. First you need to enable this option and specify the text to display using: \begin{definition}[\DescribeMacro\GlsXtrEnablePreLocationTag] \cs{GlsXtrEnablePreLocationTag}\marg{page}\marg{pages} \end{definition} where \meta{page} is the text to display if the \gls{numberlist} only contains a single location and \meta{pages} is the text to display otherwise. For example: \begin{verbatim} \GlsXtrEnablePreLocationTag{Page: }{Pages: } \end{verbatim} An extra run is required when using this command. \begin{important} Use \texttt{glsignore} not \texttt{@gobble} as the format if you want to suppress the page number (and only index the entry once). \end{important} See the accompanying sample file \texttt{sample-pages.tex}. Note that \gls{bib2gls} can be instructed to insert a prefix at the start of non-empty location lists, which can be used as an alternative to \cs{GlsXtrEnablePreLocationTag}. \subsection{The \styfmt{glossaries-extra-stylemods} Package} \label{sec:stylemods} As from v1.02, \styfmt{glossaries-extra} now includes the package \sty{glossaries-extra-stylemods} that will redefine the predefined styles to include the post-description hook (for those that are missing it). You will need to make sure the styles have already been defined before loading \styfmt{glossaries-extra}. For example: \begin{verbatim} \usepackage{glossaries-extra} \usepackage{glossary-longragged} \usepackage{glossaries-extra-stylemods} \end{verbatim} Alternatively you can load \texttt{glossary-}\meta{name}\texttt{.sty} at the same time by passing \meta{name} as a package option to \sty{glossaries-extra-stylemods}. For example: \begin{verbatim} \usepackage{glossaries-extra} \usepackage[longragged]{glossaries-extra-stylemods} \end{verbatim} Another option is to use the \pkgopt{stylemods} key when you load \styfmt{glossaries-extra}. You can omit a value if you only want to use the predefined styles that are automatically loaded by \styfmt{glossaries} (for example, the \glostyle{long3col} style): \begin{verbatim} \usepackage[style=long3col,stylemods]{glossaries-extra} \end{verbatim} Or the value of \pkgopt{stylemods} may be a comma-separated list of the style package identifiers. For example: \begin{verbatim} \usepackage[style=mcoltree,stylemods=mcols]{glossaries-extra} \end{verbatim} Remember to group the value if it contains any commas: \begin{verbatim} \usepackage[stylemods={mcols,longbooktabs}]{glossaries-extra} \end{verbatim} Note that the \glostyle{inline} style is dealt with slightly differently. The original definition provided by the \sty{glossary-inline} package uses \cs{glspostdescription} at the end of the glossary (not after each entry description) within the definition of \cs{glspostinline}. The style modification changes this so that \cs{glspostinline} just does a full stop followed by space factor adjustment, and the description \cs{glsinlinedescformat} and sub-entry description formats \cs{glsinlinesubdescformat} are redefined to include \cs{glsxtrpostdescription} (not \cs{glspostdescription}). This means that the modified \glostyle{inline} style isn't affected by the \pkgopt{nopostdot} option, but the post-description category hook can still be used. As from version 1.05, the \styfmt{glossaries-extra-stylemods} package provides some additional commands for use with the \glostyle{alttree} style to make it easier to modify. These commands are only defined if the \sty{glossary-tree} package has already been loaded, which is typically the case unless the \pkgopt{notree} option has been used when loading \styfmt{glossaries}. \begin{definition}[\DescribeMacro\eglssetwidest] \cs{eglssetwidest}\oarg{level}\marg{name} \end{definition} This is like \cs{glssetwidest} (provided by \sty{glossary-tree}) but performs a protected expansion on \meta{name}. This has a localised effect. For a global setting, use \begin{definition}[\DescribeMacro\xglssetwidest] \cs{xglssetwidest}\oarg{level}\marg{name} \end{definition} The widest entry value can later be retrieved using \begin{definition}[\DescribeMacro\glsgetwidestname] \cs{glsgetwidestname} \end{definition} for the top-level entries and \begin{definition}[\DescribeMacro\glsgetwidestsubname] \cs{glsgetwidestsubname}\marg{level} \end{definition} for sub-entries, where \meta{level} is the level number. The command \cs{glsfindwidesttoplevelname} provided by \sty{glossary-tree} has a CamelCase synonym: \begin{definition}[\DescribeMacro\glsFindWidestTopLevelName] \cs{glsFindWidestTopLevelName}\oarg{glossary list} \end{definition} Similar commands are also provided: \begin{definition}[\DescribeMacro\glsFindWidestUsedTopLevelName] \cs{glsFindWidestUsedTopLevelName}\oarg{glossary list} \end{definition} This has an additional check that the entry has been used. Naturally this is only useful if the glossaries that use the \glostyle{alttree} style occur at the end of the document. This command should be placed just before the start of the glossary. (Alternatively, place it at the end of the document and save the value in the auxiliary file for the next run.) \begin{definition}[\DescribeMacro\glsFindWidestUsedAnyName] \cs{glsFindWidestUsedAnyName}\oarg{glossary list} \end{definition} This is like the previous command but if doesn't check the \gloskey{parent} key. This is useful if all levels should have the same width for the name. \begin{definition}[\DescribeMacro\glsFindWidestAnyName] \cs{glsFindWidestAnyName}\oarg{glossary list} \end{definition} This is like the previous command but doesn't check if the entry has been used. \begin{definition}[\DescribeMacro\glsFindWidestUsedLevelTwo] \cs{glsFindWidestUsedLevelTwo}\oarg{glossary list} \end{definition} This is like \cs{glsFindWidestUsedTopLevelName} but also sets the first two sub-levels as well. Any entry that has a great-grandparent is ignored. \begin{definition}[\DescribeMacro\glsFindWidestLevelTwo] \cs{glsFindWidestLevelTwo}\oarg{glossary list} \end{definition} This is like the previous command but doesn't check if the entry has been used. \begin{definition}[\DescribeMacro\glsFindWidestUsedAnyNameSymbol] \cs{glsFindWidestUsedAnyNameSymbol}\oarg{glossary list}\marg{register} \end{definition} This is like \cs{glsFindWidestUsedAnyName} but also measures the symbol. The length of the widest symbol is stored in \meta{register}. \begin{definition}[\DescribeMacro\glsFindWidestAnyNameSymbol] \cs{glsFindWidestAnyNameSymbol}\oarg{glossary list}\marg{register} \end{definition} This is like the previous command but it doesn't check if the entry has been used. \begin{definition}[\DescribeMacro\glsFindWidestUsedAnyNameSymbolLocation] \cs{glsFindWidestUsedAnyNameSymbolLocation}\oarg{glossary list}\marg{symbol register}\marg{location register} \end{definition} This is like \cs{glsFindWidestUsedAnyNameSymbol} but also measures the \gls{numberlist}. This requires \ics{glsentrynumberlist} (see the \styfmt{glossaries} user manual). The length of the widest symbol is stored in \meta{symbol register} and the length of the widest \gls*{numberlist} is stored in \meta{location register}. \begin{definition}[\DescribeMacro\glsFindWidestAnyNameSymbolLocation] \cs{glsFindWidestAnyNameSymbolLocation}\oarg{glossary list}\marg{symbol register}\marg{location register} \end{definition} This is like the previous command but it doesn't check if the entry has been used. \begin{definition}[\DescribeMacro\glsFindWidestUsedAnyNameLocation] \cs{glsFindWidestUsedAnyNameLocation}\oarg{glossary list}\marg{register} \end{definition} This is like \cs{glsFindWidestUsedAnyNameSymbolLocation} but doesn't measure the symbol. The length of the widest \gls{numberlist} is stored in \meta{register}. \begin{definition}[\DescribeMacro\glsFindWidestAnyNameLocation] \cs{glsFindWidestAnyNameLocation}\oarg{glossary list}\marg{register} \end{definition} This is like the previous command but doesn't check if the entry has been used. The layout of the symbol, description and \gls{numberlist} is governed by \begin{definition}[\DescribeMacro\glsxtralttreeSymbolDescLocation] \cs{glsxtralttreeSymbolDescLocation}\marg{label}\marg{number list} \end{definition} for top-level entries and \begin{definition}[\DescribeMacro\glsxtralttreeSubSymbolDescLocation] \cs{glsxtralttreeSubSymbolDescLocation}\marg{label}\marg{number list} \end{definition} for sub-entries. There is now a user level command that performs the initialisation for the \glostyle{alttree} style: \begin{definition}[\DescribeMacro\glsxtralttreeInit] \cs{glsxtralttreeInit} \end{definition} The paragraph indent for subsequent paragraphs in multi-paragraph descriptions is provided by the length \begin{definition}[\DescribeMacro\glsxtrAltTreeIndent] \cs{glsxtrAltTreeIndent} \end{definition} For additional commands that are available with the \glostyle{alttree} style, see the documented code (\texttt{glossaries-extra-code.pdf}). For examples, see the accompanying sample files \texttt{sample-alttree.tex}, \texttt{sample-alttree-sym.tex} and \texttt{sample-alttree-marginpar.tex}. \chapter{Abbreviations} \label{sec:abbreviations} Abbreviations include acronyms (words formed from initial letters, such as \qt{laser}), initialisms (initial letters of a phrase, such as \qt{html}, that aren't pronounced as words) and contractions (where parts of words are omitted, often replaced by an apostrophe, such as \qt{don't}). The \qt{acronym} code provided by the \styfmt{glossaries} package is misnamed as it's more often than not used for initialisms instead. Acronyms tend not to be \emph{expanded} on \gls{firstuse} (although they may need to be \emph{described} for readers unfamiliar with the term). They are therefore more like a regular term, which may or may not require a description in the glossary. The \styfmt{glossaries-extra} package corrects this misnomer, and provides better abbreviation handling, with \begin{definition}[\DescribeMacro\newabbreviation] \cs{newabbreviation}\oarg{options}\marg{label}\marg{short}\marg{long} \end{definition} This sets the \gloskey{category} key to \texttt{abbreviation} by default, but that value may be overridden in \meta{options}. The category may have attributes that modify the way abbreviations are defined. For example, the \catattr{insertdots} attribute will automatically insert full stops (periods) into \meta{short} or the \catattr{noshortplural} attribute will set the default value of the \gloskey{shortplural} key to just \meta{short} (without appending the plural suffix). See \sectionref{sec:categories} for further details. See \sectionref{sec:nested} regarding the pitfalls of using commands like \ics{gls} or \ics{glsxtrshort} within \meta{short} or \meta{long}. \begin{important} Make sure that you set the category attributes before defining new abbreviations or they may not be correctly applied. \end{important} The \ics{newacronym} command provided by the \styfmt{glossaries} package is redefined by \styfmt{glossaries-extra} to use \cs{newabbreviation} with the \gloskey{category} set to \texttt{acronym} (see also \sectionref{sec:acronymmods}) so \begin{definition}[\DescribeMacro\newacronym] \cs{newacronym}\oarg{options}\marg{label}\marg{short}\marg{long} \end{definition} is now equivalent to \begin{display}\raggedright\ttfamily \cs{newabbreviation}[type=\cs{acronymtype},category=acronym,\meta{options}]\marg{label}\marg{short}\marg{long} \end{display} \begin{sloppypar} The \cs{newabbreviation} command is superficially similar to the \styfmt{glossaries} package's \cs{newacronym} but you can apply different styles to different categories. The default style is \abbrstyle{short-nolong} for entries in the \category{acronym} category and \abbrstyle{short-long} for entries in the \category{abbreviation} category. (These aren't the same as the acronym styles provided by the \styfmt{glossaries} package, although they may produce similar results.) \end{sloppypar} The short form is displayed within commands like \cs{gls} using \begin{definition}[\DescribeMacro\glsfirstabbrvfont] \cs{glsfirstabbrvfont}\marg{short-form} \end{definition} on \gls{firstuse} and \begin{definition}[\DescribeMacro\glsabbrvfont] \cs{glsabbrvfont}\marg{short-form} \end{definition} for subsequent use. \begin{important} These commands (\cs{glsfirstabbrvfont} and \cs{glsabbrvfont}) are reset by the abbreviation styles and whenever an abbreviation is used by commands like \cs{gls} (but not by commands like \ics{glsentryshort}) so don't try redefining them outside of an abbreviation style. \end{important} If you use the \abbrstyle{long-short} style, \cs{glsabbrvfont} is redefine to use \begin{definition}[\DescribeMacro\glsabbrvdefaultfont] \cs{glsabbrvdefaultfont}\marg{text} \end{definition} whereas the \abbrstyle{long-short-sc} style redefines \cs{glsabbrvfont} to use \cs{glsxtrscfont}. If you want to use a different font-changing command you can either redefine \cs{glsabbrvdefaultfont} and use one of the base styles, such as \abbrstyle{long-short}, or define a new style in a similar manner to the \qt{sc}, \qt{sm} or \qt{em} styles. Similarly the basic styles redefine \cs{glsfirstabbrvfont} to use \begin{definition}[\DescribeMacro\glsfirstabbrvdefaultfont] \cs{glsfirstabbrvdefaultfont}\marg{short-form} \end{definition} whereas the font modifier styles, such as \abbrstyle{long-short-sc}, use their own custom command, such as \cs{glsfirstscfont}. The commands that display the full form for abbreviations use \cs{glsfirstabbrvfont} to display the short form and \begin{definition}[\DescribeMacro\glsfirstlongfont] \cs{glsfirstlongfont}\marg{long-form} \end{definition} to display the long form on \gls{firstuse} or for the inline full format. Commands like \cs{glsxtrlong} use \begin{definition}[\DescribeMacro\glslongfont] \cs{glslongfont}\marg{long-form} \end{definition} instead. As with \ics{glsabbrvfont}, this command is changed by all styles. Currently all predefined abbreviation styles, except the \qt{long-em} (emphasize long form) versions, provided by \styfmt{glossaries-extra} redefine \cs{glsfirstlongfont} to use \begin{definition}[\DescribeMacro\glsfirstlongdefaultfont] \cs{glsfirstlongdefaultfont}\marg{long-form} \end{definition} and \cs{glslongfont} to use \begin{definition}[\DescribeMacro\glslongdefaultfont] \cs{glslongdefaultfont}\marg{long-form} \end{definition} You can redefine these command if you want to change the font used by the long form for all your abbreviations (except for the emphasize-long styles), or you can define your own abbreviation style that provides a different format for only those abbreviations defined with that style. The \qt{long-em} (emphasize long) styles use \begin{definition}[\DescribeMacro\glsfirstlongemfont] \cs{glsfirstlongemfont}\marg{long-form} \end{definition} instead of \cs{glsfirstlongdefaultfont}\marg{long-form} and \begin{definition}[\DescribeMacro\glslongemfont] \cs{glslongemfont}\marg{long-form} \end{definition} instead of \cs{glslongdefaultfont}\marg{long-form}. The first form \cs{glsfirstlongemfont} is initialised to use \cs{glslongemfont}. Note that by default inserted material (provided in the final optional argument of commands like \cs{gls}), is placed outside the font command in the predefined styles. To move it inside, use: \begin{definition}[\DescribeMacro\glsxtrinsertinsidetrue] \cs{glsxtrinsertinsidetrue} \end{definition} This applies to all the predefined styles. For example: \begin{verbatim} \setabbreviationstyle{long-short} \renewcommand*{\glsfirstlongdefaultfont}[1]{\emph{#1}} \glsxtrinsertinsidetrue \end{verbatim} This will make the long form and the inserted text emphasized, whereas the default (without \cs{glsxtrinsertinsidetrue}) would place the inserted text outside of the emphasized font. Note that for some styles, such as the \abbrstyle{short-long}, the inserted text would be placed inside the font command for the short form (rather than the long form in the above example). There are two types of full forms. The display full form, which is used on \gls{firstuse} by commands like \ics{gls} and the inline full form, which is used by commands like \ics{glsxtrfull}. For some of the abbreviation styles, such as \abbrstyle{long-short}, the display and inline forms are the same. In the case of styles such as \abbrstyle{short-nolong} or \abbrstyle{short-footnote}, the display and inline full forms are different. These formatting commands aren't stored in the \gloskey{short}, \gloskey{shortplural}, \gloskey{long} or \gloskey{longplural} fields, which means they won't be used within commands like \cs{glsentryshort} (but they are used within commands like \cs{glsxtrshort} and \cs{glsfmtshort}). Note that \ics{glsxtrlong} and the case-changing variants don't use \cs{glsfirstlongfont}. \section{Tagging Initials} \label{sec:tagging} If you would like to tag the initial letters in the long form such that those letters are underlined in the glossary but not in the main part of the document, you can use \begin{definition}[\DescribeMacro\GlsXtrEnableInitialTagging] \cs{GlsXtrEnableInitialTagging}\marg{categories}\marg{cs} \end{definition} before you define your abbreviations. This command (robustly) defines \meta{cs} (a control sequence) to accept a single argument, which is the letter (or letters) that needs to be tagged. The normal behaviour of this command within the document is to simply do its argument, but in the glossary it's activated for those categories that have the \catattr{tagging} attribute set to \qt{true}. For those cases it will use \begin{definition}[\DescribeMacro\glsxtrtagfont] \cs{glsxtrtagfont}\marg{text} \end{definition} This command defaults to \ics{underline}\marg{text} but may be redefined as required. The control sequence \meta{cs} can't already be defined when used with the unstarred version of \cs{GlsXtrEnableInitialTagging} for safety reasons. The starred version will overwrite any previous definition of \meta{cs}. As with redefining any commands, ensure that you don't redefine something important. In fact, just forget the existence of the starred version and let's pretend I didn't mention it. The first argument of \cs{GlsXtrEnableInitialTagging} is a comma-separated list of category names. The \catattr{tagging} attribute will automatically be set for those categories. You can later set this attribute for other categories (see \sectionref{sec:categories}) but this must be done before the glossary is displayed. The accompanying sample file \texttt{sample-mixtures.tex} uses initial tagging for both the \category{acronym} and \category{abbreviation} categories: \begin{verbatim} \GlsXtrEnableInitialTagging{acronym,abbreviation}{\itag} \end{verbatim} This defines the command \cs{itag} which can be used in the definitions. For example: \begin{verbatim} \newacronym [description={a system for detecting the location and speed of ships, aircraft, etc, through the use of radio waves}% description of this term ] {radar}% identifying label {radar}% short form (i.e. the word) {\itag{ra}dio \itag{d}etection \itag{a}nd \itag{r}anging} \newabbreviation{xml}{XML} {e\itag{x}tensible \itag{m}arkup \itag{l}anguage} \end{verbatim} The underlining of the tagged letters only occurs in the glossary and then only for entries with the \catattr{tagging} attribute set. \section{Abbreviation Styles} \label{sec:abbrstyle} The abbreviation style must be set before abbreviations are defined using: \begin{definition}[\DescribeMacro\setabbreviationstyle] \cs{setabbreviationstyle}\oarg{category}\marg{style-name} \end{definition} where \meta{style-name} is the name of the style and \meta{category} is the category label (\texttt{abbreviation} by default). New abbreviations will pick up the current style according to their given category. If there is no style set for the category, the fallback is the style for the \texttt{abbreviation} category. Some styles may automatically modify one or more of the attributes associated with the given category. For example, the \abbrstyle{long-noshort} and \abbrstyle{short-nolong} styles set the \catattr{regular} attribute to \texttt{true}. \begin{important} If you want to apply different styles to groups of abbreviations, assign a different category to each group and set the style for the given category. \end{important} Note that \ics{setacronymstyle} is disabled by \styfmt{glossaries-extra}. Use \begin{alltt} \cs{setabbreviationstyle}[acronym]\marg{style-name} \end{alltt} instead. The original acronym interface can be restored with \ics{RestoreAcronyms} (see \sectionref{sec:acronymmods}). However the original acronym interface is incompatible with all the commands described here. Abbreviations can be used with the standard \styfmt{glossaries} commands, such as \ics{gls}, but don't use the acronym commands like \ics{acrshort} (which use \ics{acronymfont}). The short form can be produced with: \begin{definition}[\DescribeMacro\glsxtrshort] \cs{glsxtrshort}\oarg{options}\marg{label}\oarg{insert} \end{definition} (Use this instead of \ics{acrshort}.) The long form can be produced with \begin{definition}[\DescribeMacro\glsxtrlong] \cs{glsxtrlong}\oarg{options}\marg{label}\oarg{insert} \end{definition} (Use this instead of \ics{acrlong}.) The \emph{inline} full form can be produced with \begin{definition}[\DescribeMacro\glsxtrfull] \cs{glsxtrfull}\oarg{options}\marg{label}\oarg{insert} \end{definition} (This this instead of \ics{acrfull}.) As mentioned earlier, the inline full form may not necessarily match the format used on \gls{firstuse} with \cs{gls}. For example, the \abbrstyle{short-nolong} style only displays the short form on \gls{firstuse}, but the full form will display the long form followed by the short form in parentheses. \begin{important} If you want to use an abbreviation in a chapter or section title, use the commands described in \sectionref{sec:headtitle} instead. \end{important} The arguments \meta{options}, \meta{label} and \meta{insert} are the same as for commands such as \cs{glstext}. There are also analogous case-changing commands: First letter upper case short form: \begin{definition}[\DescribeMacro\Glsxtrshort] \cs{Glsxtrshort}\oarg{options}\marg{label}\oarg{insert} \end{definition} First letter upper case long form: \begin{definition}[\DescribeMacro\Glsxtrlong] \cs{Glsxtrlong}\oarg{options}\marg{label}\oarg{insert} \end{definition} First letter upper case inline full form: \begin{definition}[\DescribeMacro\Glsxtrfull] \cs{Glsxtrfull}\oarg{options}\marg{label}\oarg{insert} \end{definition} All upper case short form: \begin{definition}[\DescribeMacro\Glsxtrshort] \cs{GLSxtrshort}\oarg{options}\marg{label}\oarg{insert} \end{definition} All upper case long form: \begin{definition}[\DescribeMacro\Glsxtrlong] \cs{GLSxtrlong}\oarg{options}\marg{label}\oarg{insert} \end{definition} All upper case inline full form: \begin{definition}[\DescribeMacro\GLSxtrfull] \cs{GLSxtrfull}\oarg{options}\marg{label}\oarg{insert} \end{definition} Plural forms are also available. Short form plurals: \begin{definition}[\DescribeMacro\glsxtrshortpl] \cs{glsxtrshortpl}\oarg{options}\marg{label}\oarg{insert} \end{definition} \begin{definition}[\DescribeMacro\Glsxtrshortpl] \cs{Glsxtrshortpl}\oarg{options}\marg{label}\oarg{insert} \end{definition} \begin{definition}[\DescribeMacro\GLSxtrshortpl] \cs{GLSxtrshortpl}\oarg{options}\marg{label}\oarg{insert} \end{definition} Long form plurals: \begin{definition}[\DescribeMacro\glsxtrlongpl] \cs{glsxtrlongpl}\oarg{options}\marg{label}\oarg{insert} \end{definition} \begin{definition}[\DescribeMacro\Glsxtrlongpl] \cs{Glsxtrlongpl}\oarg{options}\marg{label}\oarg{insert} \end{definition} \begin{definition}[\DescribeMacro\GLSxtrlongpl] \cs{GLSxtrlongpl}\oarg{options}\marg{label}\oarg{insert} \end{definition} Full form plurals: \begin{definition}[\DescribeMacro\glsxtrfullpl] \cs{glsxtrfullpl}\oarg{options}\marg{label}\oarg{insert} \end{definition} \begin{definition}[\DescribeMacro\Glsxtrfullpl] \cs{Glsxtrfullpl}\oarg{options}\marg{label}\oarg{insert} \end{definition} \begin{definition}[\DescribeMacro\GLSxtrfullpl] \cs{GLSxtrfullpl}\oarg{options}\marg{label}\oarg{insert} \end{definition} \begin{important} Be careful about using \cs{glsentryfull}, \cs{Glsentryfull}, \cs{glsentryfullpl} and \cs{Glsentryfullpl}. These commands will use the currently applied style rather than the style in use when the entry was defined. If you have mixed styles, you'll need to use \ics{glsxtrfull} instead. Similarly for \cs{glsentryshort} etc. \end{important} \section{Shortcut Commands} \label{sec:abbrshortcuts} The abbreviation shortcut commands can be enabled using the package option \pkgopt[abbreviation]{shortcuts} (or \pkgopt[abbr]{shortcuts}). This defines the commands listed in \tableref{tab:abbrshortcuts}. \begin{table}[htbp] \caption{Abbreviation Shortcut Commands} \label{tab:abbrshortcuts} \centering \begin{tabular}{ll} \bfseries Shortcut & \bfseries Equivalent Command\\ \ics{ab} & \ics{cgls}\\ \ics{abp} & \ics{cglspl}\\ \ics{as} & \ics{glsxtrshort}\\ \ics{asp} & \ics{glsxtrshortpl}\\ \ics{al} & \ics{glsxtrlong}\\ \ics{alp} & \ics{glsxtrlongpl}\\ \ics{af} & \ics{glsxtrfull}\\ \ics{afp} & \ics{glsxtrfullpl}\\ \ics{As} & \ics{Glsxtrshort}\\ \ics{Asp} & \ics{Glsxtrshortpl}\\ \ics{Al} & \ics{Glsxtrlong}\\ \ics{Alp} & \ics{Glsxtrlongpl}\\ \ics{Af} & \ics{Glsxtrfull}\\ \ics{Afp} & \ics{Glsxtrfullpl}\\ \ics{AS} & \ics{GLSxtrshort}\\ \ics{ASP} & \ics{GLSxtrshortpl}\\ \ics{AL} & \ics{GLSxtrlong}\\ \ics{ALP} & \ics{GLSxtrlongpl}\\ \ics{AF} & \ics{GLSxtrfull}\\ \ics{AFP} & \ics{GLSxtrfullpl}\\ \ics{newabbr} & \ics{newabbreviation} \end{tabular} \end{table} \section{Predefined Abbreviation Styles} \label{sec:predefabbrvstyles} There are two types of abbreviation styles: those that treat the abbreviation as a regular entry (so that \ics{gls} uses \ics{glsgenentryfmt}) and those that don't treat the abbreviation as a regular entry (so that \ics{gls} uses \ics{glsxtrgenabbrvfmt}). The regular entry abbreviation styles set the \catattr{regular} attribute to \qt{true} for the category assigned to each abbreviation with that style. This means that on \gls{firstuse}, \ics{gls} uses the value of the \gloskey{first} field and on subsequent use \ics{gls} uses the value of the \gloskey{text} field (and analogously for the plural and case-changing versions). The \gloskey{short} and \gloskey{long} fields are set as appropriate and may be accessed through commands like \ics{glsxtrshort}. The other abbreviation styles don't modify the \catattr{regular} attribute. The \gloskey{first} and \gloskey{text} fields (and their plural forms) are set and can be accessed through commands like \cs{glsfirst}, but they aren't used by commands like \ics{gls}, which instead use the short form (stored in the \gloskey{short} key) and the display full format (through commands like \ics{glsxtrfullformat} that are defined by the style). In both cases, the \gls{firstuse} of \ics{gls} may not match the text produced by \ics{glsfirst} (and likewise for the plural and case-changing versions). \begin{important} For the \qt{sc} styles that use \ics{textsc}, be careful about your choice of fonts as some only have limited support. For example, you may not be able to combine bold and small-caps. I recommend that you at least use the \sty{fontenc} package with the \pkgoptfmt{T1} option or something similar. \end{important} The \qt{sc} styles all use \begin{definition}[\DescribeMacro\glsxtrscfont] \cs{glsxtrscfont}\marg{text} \end{definition} which is defined as \begin{verbatim} \newcommand*{\glsxtrscfont}[1]{\textsc{#1}} \end{verbatim} and \begin{definition}[\DescribeMacro\glsxtrfirstscfont] \cs{glsxtrfirstscfont}\marg{text} \end{definition} which is defined as \begin{verbatim} \newcommand*{\glsxtrfirstscfont}[1]{\glsxtrscfont{#1}} \end{verbatim} The default plural suffix for the short form is set to \begin{definition}[\DescribeMacro\glsxtrscsuffix] \cs{glsxtrscsuffix} \end{definition} This just defined as \begin{verbatim} \newcommand*{\glsxtrscsuffix}{\glstextup{\glspluralsuffix}} \end{verbatim} The \ics{glstextup} command is provided by \styfmt{glossaries} and is used to switch off the small caps font for the suffix. If you override the default short plural using the \gloskey{shortplural} key when you define the abbreviation you will need to make the appropriate adjustment if necessary. (Remember that the default plural suffix behaviour can be modified through the use of the \catattr{aposplural} and \catattr{noshortplural} attributes. See \sectionref{sec:categories} for further details.) Remember that \cs{textsc} renders \emph{lowercase} letters as small capitals. Uppercase letters are rendered as normal uppercase letters, so if you specify the short form in uppercase, you won't get small capitals unless you redefine \cs{glsxtrscfont} to convert its argument to lowercase. For example: \begin{verbatim} \renewcommand*{\glsxtrscfont}[1]{\textsc{\MakeLowercase{#1}}} \end{verbatim} The \qt{sm} styles all use \begin{definition}[\DescribeMacro\glsxtrsmfont] \cs{glsxtrsmfont}\marg{text} \end{definition} This is defined as: \begin{verbatim} \newcommand*{\glsxtrsmfont}[1]{\textsmaller{#1}} \end{verbatim} and \begin{definition}[\DescribeMacro\glsxtrfirstsmfont] \cs{glsxtrfirstsmfont}\marg{text} \end{definition} which is defined as \begin{verbatim} \newcommand*{\glsxtrfirstsmfont}[1]{\glsxtrsmfont{#1}} \end{verbatim} If you want to use this style, you must explicitly load the \sty{relsize} package which defines the \ics{textsmaller} command. If you want to easily switch between the \qt{sc} and \qt{sm} styles, you may find it easier to redefine this command to convert to upper case: \begin{verbatim} \renewcommand*{\glsxtrsmfont}[1]{\textsmaller{\MakeTextUppercase{#1}}} \end{verbatim} The default plural suffix for the short form is set to \begin{definition}[\DescribeMacro\glsxtrsmsuffix] \cs{glsxtrsmsuffix} \end{definition} This just does \ics{glspluralsuffix}. The \qt{em} styles all use \begin{definition}[\DescribeMacro\glsabbrvemfont] \cs{glsabbrvemfont}\marg{text} \end{definition} which is defined as: \begin{verbatim} \newcommand*{\glsabbrvemfont}[1]{\emph{#1}} \end{verbatim} and \begin{definition}[\DescribeMacro\glsfirstabbrvemfont] \cs{glsfirstabbrvemfont}\marg{text} \end{definition} which is defined as: \begin{verbatim} \newcommand*{\glsfirstabbrvemfont}[1]{\glsabbrvemfont{#1}} \end{verbatim} Some of the styles use \begin{definition}[\DescribeMacro\glsxtrfullsep] \cs{glsxtrfullsep}\marg{label} \end{definition} as a separator between the long and short forms. This is defined as a space by default, but may be changed as required. For example: \begin{verbatim} \renewcommand*{\glsxtrfullsep}[1]{~} \end{verbatim} or \begin{verbatim} \renewcommand*{\glsxtrfullsep}[1]{\glsacspace{#1}} \end{verbatim} The new naming scheme for abbreviation styles is as follows: \begin{itemize} \item \meta{field1}[\texttt{-}\meta{modifier1}]\texttt{-}\meta{field2}[\texttt{-}\meta{modifier2}][\texttt{-user}] This is for the parenthetical styles. The \texttt{-}\meta{modifier} parts may be omitted. These styles display \meta{field1} followed by \meta{field2} in parentheses. If \meta{field2} starts with \qt{no} then the parenthetical element is omitted from the display style but is included in the inline style. If the \texttt{-}\meta{modifier} part is present, then the field has a font changing command applied to it. If the \texttt{-user} part is present, then the \gloskey{user1} value, if provided, is inserted into the parenthetical material . (The field used for the inserted material may be changed.) Examples: \begin{itemize} \item\abbrstyle{long-noshort-sc}: \meta{field1} is the long form, the short form is set in smallcaps but omitted in the display style. \item\abbrstyle{long-em-short-em}: both the long form and the short form are emphasized. The short form is in parentheses. \item\abbrstyle{long-short-em}: the short form is emphasized but not the long form. The short form is in parentheses. \item\abbrstyle{long-short-user}: if the \gloskey{user1} key has been set, this produces the style \meta{long} (\meta{short}, \meta{user1}) otherwise it just produces \meta{long} (\meta{short}). \end{itemize} \item \meta{field1}[\texttt{-}\meta{modifier1}]\texttt{-}[\texttt{post}]\texttt{footnote} The display style uses \meta{field1} followed by a footnote with the other field in it. If \texttt{post} is present then the footnote is placed after the \gls{linktext} using the post-link hook. The inline style does \meta{field1} followed by the other field in parentheses. If \texttt{-}\meta{modifier1} is present, \meta{field1} has a font-changing command applied to it. Examples: \begin{itemize} \item \abbrstyle{short-footnote}: short form in the text with the long form in the footnote. \item \abbrstyle{short-sc-postfootnote}: short form in smallcaps with the long form in the footnote outside of the \gls{linktext}. \end{itemize} \begin{important} Take care with the footnote styles. Remember that there are some situations where \ics{footnote} doesn't work. \end{important} \item \meta{style}\texttt{-desc} Like \meta{style} but the \gloskey{description} key must be provided when defining abbreviations with this style. Examples: \begin{itemize} \item \abbrstyle{short-long-desc}: like \abbrstyle{short-long} but requires a description. \item \abbrstyle{short-em-footnote-desc}: like \abbrstyle{short-em-footnote} but requires a description. \end{itemize} \end{itemize} Not all combinations that fit the above syntax are provided. Pre-version 1.04 styles that didn't fit this naming scheme are either provided with a synonym (where the former name wasn't ambiguous) or provided with a deprecated synonym (where the former name was confusing). The deprecated style names generate a warning using: \begin{definition}[\DescribeMacro\GlsXtrWarnDeprecatedAbbrStyle] \cs{GlsXtrWarnDeprecatedAbbrStyle}\marg{old-name}\marg{new-name} \end{definition} where \meta{old-name} is the deprecated name and \meta{new-name} is the preferred name. You can suppress these warnings by redefining this command to do nothing. \subsection{Predefined Abbreviation Styles that Set the Regular Attribute} \label{sec:predefregabbrvstyles} The following abbreviation styles set the \catattr{regular} attribute to \qt{true} for all categories that have abbreviations defined with any of these styles. \begin{description} \item[\abbrstyle{short-nolong}] This only displays the short form on \gls{firstuse}. The \gloskey{name} is set to the short form. The \gloskey{description} is set to the long form. The inline full form displays \meta{short} (\meta{long}). The long form on its own can be displayed through commands like \ics{glsxtrlong}. \item[\abbrstyle{short}] A synonym for \abbrstyle{short-nolong}. \item[\abbrstyle{short-sc-nolong}] Like \abbrstyle{short-nolong} but redefines \cs{glsabbrvfont} to use \ics{glsxtrscfont}. \item[\abbrstyle{short-sc}] A synonym for \abbrstyle{short-sc-nolong} \item[\abbrstyle{short-sm-nolong}] Like \abbrstyle{short-nolong} but redefines \cs{glsabbrvfont} to use \ics{glsxtrsmfont}. \item[\abbrstyle{short-sm}] A synonym for \abbrstyle{short-sm-nolong}. \item[\abbrstyle{short-em-nolong}] Like \abbrstyle{short-nolong} but redefines \cs{glsabbrvfont} to use \ics{glsxtremfont}. \item[\abbrstyle{short-em}] A synonym for \abbrstyle{short-em-nolong} \item[\abbrstyle{short-nolong-desc}] Like the \abbrstyle{short-nolong} style, but the \gloskey{name} is set to the full form and the \gloskey{description} must be supplied by the user. You may prefer to use the \abbrstyle{short-nolong} style with the post-description hook set to display the long form and override the \gloskey{description} key. (See the sample file \texttt{sample-acronym-desc.tex}.) \item[\abbrstyle{short-desc}] A synonym for \abbrstyle{short-nolong-desc}. \item[\abbrstyle{short-sc-nolong-desc}] Like \abbrstyle{short-nolong} but redefines \cs{glsabbrvfont} to use \ics{glsxtrscfont}. \item[\abbrstyle{short-sc-desc}] A synonym for \abbrstyle{short-sc-nolong-desc}. \item[\abbrstyle{short-sm-nolong-desc}] Like \abbrstyle{short-nolong-desc} but redefines \cs{glsabbrvfont} to use \ics{glsxtrsmfont}. \item[\abbrstyle{short-sm-desc}] A synonym for \abbrstyle{short-sm-nolong-desc}. \item[\abbrstyle{short-em-nolong-desc}] Like \abbrstyle{short-nolong-desc} but redefines \cs{glsabbrvfont} to use \ics{glsxtremfont}. \item[\abbrstyle{short-em-desc}] A synonym for \abbrstyle{short-em-nolong-desc}. \item[\abbrstyle{long-noshort-desc}] This style only displays the long form, regardless of first or subsequent use of commands \ics{gls}. The short form may be accessed through commands like \ics{glsxtrshort}. The inline full form displays \meta{long} (\meta{short}). The \gloskey{name} and \gloskey{sort} keys are set to the long form and the \gloskey{description} must be provided by the user. The predefined glossary styles won't display the short form. You can use the post-description hook to automatically append the short form to the description. The inline full form will display \meta{long} (\meta{short}). \item[\abbrstyle{long-desc}] A synonym for \abbrstyle{long-noshort-desc}. \item[\abbrstyle{long-noshort-sc-desc}] Like the \abbrstyle{long-noshort-desc} style but the short form (accessed through commands like \ics{glsxtrshort}) use \ics{glsxtrscfont}. (This style was originally called \depabbrstyle{long-desc-sc}. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.) \item[\abbrstyle{long-noshort-sm-desc}] Like \abbrstyle{long-noshort-desc} but redefines \cs{glsabbrvfont} to use \ics{glsxtrsmfont}. (This style was originally called \depabbrstyle{long-desc-sm}. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.) \item[\abbrstyle{long-noshort-em-desc}] Like \abbrstyle{long-noshort-desc} but redefines \cs{glsabbrvfont} to use \ics{glsxtremfont}. The long form isn't emphasized. (This style was originally called \depabbrstyle{long-desc-em}. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.) \item[\abbrstyle{long-em-noshort-em-desc}] New to version 1.04, like \abbrstyle{long-noshort-desc} but redefines \cs{glsabbrvfont} to use \ics{glsxtremfont}. The long form uses \ics{glsfirstlongemfont} and \ics{glslongemfont}. \item[\abbrstyle{long-noshort}] This style doesn't really make sense if you don't use the short form anywhere in the document, but is provided for completeness. This is like the \abbrstyle{long-noshort-desc} style, but the \gloskey{name} and \gloskey{sort} keys are set to the short form and the \gloskey{description} is set to the long form. \item[\abbrstyle{long}] A synonym for \abbrstyle{long-noshort} \item[\abbrstyle{long-noshort-sc}] Like the \abbrstyle{long-noshort} style but the short form (accessed through commands like \ics{glsxtrshort}) use \ics{glsxtrscfont}. (This style was originally called \depabbrstyle{long-sc}. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.) \item[\abbrstyle{long-noshort-sm}] Like \abbrstyle{long-noshort} but redefines \cs{glsabbrvfont} to use \ics{glsxtrsmfont}. (This style was originally called \depabbrstyle{long-sm}. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.) \item[\abbrstyle{long-noshort-em}] This style is like \abbrstyle{long-noshort} but redefines \cs{glsabbrvfont} to use \ics{glsxtremfont}. The long form isn't emphasized. (This style was originally called \depabbrstyle{long-em}. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.) \item[\abbrstyle{long-em-noshort-em}] New to version 1.04, this style is like \abbrstyle{long-noshort} but redefines \cs{glsabbrvfont} to use \ics{glsxtremfont}, \cs{glsfirstlongfont} to use \cs{glsfirstlongemfont} and \cs{glslongfont} to use \cs{glslongemfont}. The short form isn't used by commands like \ics{gls}, but can be obtained using \ics{glsxtrshort}. \end{description} \subsection{Predefined Abbreviation Styles that Don't Set the Regular Attribute} \label{sec:predefnonregabbrvstyles} The following abbreviation styles will set the \catattr{regular} attribute to \qt{false} if it has previously been set. If it hasn't already been set, it's left unset. Other attributes may also be set, depending on the style. \begin{description} \item[\abbrstyle{long-short}] On \gls{firstuse}, this style uses the format \meta{long} (\meta{short}). The inline and display full forms are the same. The \gloskey{name} and \gloskey{sort} keys are set to the short form. (The \gloskey{name} key additionally includes the font command \cs{glsabbrvfont}.) The \gloskey{description} is set to the long form. The long and short forms are separated by \cs{glsxtrfullsep}. If you want to insert material within the parentheses (such as a~translation), try the \abbrstyle{long-short-user} style. \item[\abbrstyle{long-short-sc}] Like \abbrstyle{long-short} but redefines \cs{glsabbrvfont} to use \ics{glsxtrscfont}. \item[\abbrstyle{long-short-sm}] Like \abbrstyle{long-short} but redefines \cs{glsabbrvfont} to use \ics{glsxtrsmfont}. \item[\abbrstyle{long-short-em}] Like \abbrstyle{long-short} but redefines \cs{glsabbrvfont} to use \ics{glsxtremfont}. \item[\abbrstyle{long-em-short-em}] New to version 1.04, this style is like \abbrstyle{long-short-em} but redefines \cs{glsfirstlongfont} to use \ics{glsfirstlongemfont}. \item[\abbrstyle{long-short-user}] This style was introduced in version 1.04. It's like the \abbrstyle{long-short} style but additional information can be inserted into the parenthetical material. This checks the value of the field given by \begin{definition}[\DescribeMacro\glsxtruserfield] \cs{glsxtruserfield} \end{definition} (which defaults to \texttt{useri}) using \ics{ifglshasfield} (provided by \styfmt{glossaries}). If the field hasn't been set, the style behaves like the \abbrstyle{long-short} style and produces \meta{long} (\meta{short}) but if the field has been set, the contents of that field are inserted within the parentheses in the form \meta{long} (\meta{short}, \meta{field-value}). The format is governed by \begin{definition}[\DescribeMacro\glsxtruserparen] \cs{glsxtruserparen}\marg{text}\marg{label} \end{definition} where \meta{text} is the short form (for the \abbrstyle{long-short-user} style) or the long form (for the \abbrstyle{short-long-user} style). This command first inserts a space using \cs{glsxtrfullsep} and then the parenthetical content. The \meta{text} argument includes the font formatting command, \cs{glsfirstabbrvfont}\marg{short} in the case of the \abbrstyle{long-short-user} style and \cs{glsfirstlongfont}\marg{long} in the case of the \abbrstyle{short-long-user} style. For example: \begin{verbatim} \setabbreviationstyle[acronym]{long-short-user} \newacronym{tug}{TUG}{\TeX\ User Group} \newacronym [user1={German Speaking \TeX\ User Group}] {dante}{DANTE}{Deutschsprachige Anwendervereinigung \TeX\ e.V} \end{verbatim} On first use, \verb|\gls{tug}| will appear as: \begin{quote} \TeX\ User Group (TUG) \end{quote} whereas \verb|\gls{dante}| will appear as: \begin{quote} Deutschsprachige Anwendervereinigung \TeX\ e.V (DANTE, German Speaking \TeX\ User Group) \end{quote} The short form is formatted according to \begin{definition}[\DescribeMacro\glsabbrvuserfont] \cs{glsabbrvuserfont}\marg{text} \end{definition} and the plural suffix is given by \begin{definition}[\DescribeMacro\glsxtrusersuffix] \cs{glsxtrusersuffix} \end{definition} These may be redefined as appropriate. For example, if you want a~smallcaps style, you can just set these commands to those used by the \abbrstyle{long-short-sc} style: \begin{verbatim} \renewcommand{\glsabbruserfont}[1]{\glsxtrscfont{#1}} \renewcommand{\glsxtrusersuffix}{\glsxtrscsuffix} \end{verbatim} \item[\abbrstyle{long-short-desc}] On \gls{firstuse}, this style uses the format \meta{long} (\meta{short}). The inline and display full forms are the same. The \gloskey{name} is set to the full form. The \gloskey{sort} key is set to \meta{long} (\meta{short}). Before version 1.04, this was incorrectly set to the short form. If you want to revert back to this you can redefine \begin{definition}[\DescribeMacro\glsxtrlongshortdescsort] \cs{glsxtrlongshortdescsort} \end{definition} For example: \begin{verbatim} \renewcommand*{\glsxtrlongshortdescsort}{\the\glsshorttok} \end{verbatim} The \gloskey{description} must be supplied by the user. The long and short forms are separated by \cs{glsxtrfullsep}. \item[\abbrstyle{long-short-sc-desc}] Like \abbrstyle{long-short-desc} but redefines \cs{glsabbrvfont} to use \ics{glsxtrscfont}. \item[\abbrstyle{long-short-sm-desc}] Like \abbrstyle{long-short-desc} but redefines \cs{glsabbrvfont} to use \ics{glsxtrsmfont}. \item[\abbrstyle{long-short-em-desc}] Like \abbrstyle{long-short-desc} but redefines \cs{glsabbrvfont} to use \ics{glsxtremfont}. \item[\abbrstyle{long-em-short-em-desc}] New to version 1.04, this style is like \abbrstyle{long-short-em-desc} but redefines \cs{glsfirstlongfont} to use \ics{glsfirstlongemfont}. \item[\abbrstyle{long-short-user-desc}] New to version 1.04, this style is like a~cross between the \abbrstyle{long-short-desc} style and the \abbrstyle{long-short-user} style. The display and inline forms are as for \abbrstyle{long-short-user} and the \gloskey{name} key is as \abbrstyle{long-short-desc}. The \gloskey{description} key must be supplied in the optional argument of \cs{newabbreviation} (or \cs{newacronym}). The \gloskey{sort} key is set to \meta{long} (\meta{short}) as per the \abbrstyle{long-short-desc} style. \item[\abbrstyle{short-long}] On \gls{firstuse}, this style uses the format \meta{short} (\meta{long}). The inline and display full forms are the same. The \gloskey{name} and \gloskey{sort} keys are set to the short form. The \gloskey{description} is set to the long form. The short and long forms are separated by \cs{glsxtrfullsep}. If you want to insert material within the parentheses (such as a~translation), try the \abbrstyle{short-long-user} style. \item[\abbrstyle{short-sc-long}] Like \abbrstyle{short-long} but redefines \cs{glsabbrvfont} to use \ics{glsxtrscfont}. \item[\abbrstyle{short-sm-long}] Like \abbrstyle{short-long} but redefines \cs{glsabbrvfont} to use \ics{glsxtrsmfont}. \item[\abbrstyle{short-em-long}] Like \abbrstyle{short-long} but redefines \cs{glsabbrvfont} to use \ics{glsxtremfont}. \item[\abbrstyle{short-em-long-em}] New to version 1.04, this style is like \abbrstyle{short-em-long} but redefines \cs{glsfirstlongfont} to use \ics{glsfirstlongemfont}. \item[\abbrstyle{short-long-user}] New to version 1.04. This style is like the \abbrstyle{long-short-user} style but with the long and short forms switched. The parenthetical material is governed by the same command \ics{glsxtruserparen}, but the first argument supplied to it is the long form instead of the short form. \item[\abbrstyle{short-long-desc}] On \gls{firstuse}, this style uses the format \meta{short} (\meta{long}). The inline and display full forms are the same. The \gloskey{name} is set to the full form. The \gloskey{description} must be supplied by the user. The short and long forms are separated by \cs{glsxtrfullsep}. \item[\abbrstyle{short-sc-long-desc}] Like \abbrstyle{short-long-desc} but redefines \cs{glsabbrvfont} to use \ics{glsxtrscfont}. \item[\abbrstyle{short-sm-long-desc}] Like \abbrstyle{short-long-desc} but redefines \cs{glsabbrvfont} to use \ics{glsxtrsmfont}. \item[\abbrstyle{short-em-long-desc}] Like \abbrstyle{short-long-desc} but redefines \cs{glsabbrvfont} to use \ics{glsxtremfont}. \item[\abbrstyle{short-em-long-em-desc}] New to version 1.04, this style is like \abbrstyle{short-em-long-desc} but redefines \cs{glsfirstlongfont} to use \ics{glsfirstlongemfont}. \item[\abbrstyle{short-long-user-desc}] New to version 1.04, this style is like a~cross between the \abbrstyle{short-long-desc} style and the \abbrstyle{short-long-user} style. The display and inline forms are as for \abbrstyle{short-long-user} and the \gloskey{name} key is as \abbrstyle{short-long-desc}. The \gloskey{description} key must be supplied in the optional argument of \cs{newabbreviation} (or \cs{newacronym}). \item[\abbrstyle{short-footnote}] On \gls{firstuse}, this style displays the short form with the long form as a footnote. This style automatically sets the \catattr{nohyperfirst} attribute to \qt{true} for the supplied category, so the \gls{firstuse} won't be hyperlinked (but the footnote marker may be, if the \sty{hyperref} package is used). The inline full form uses the \meta{short} (\meta{long}) style. The \gloskey{name} is set to the short form. The \gloskey{description} is set to the long form. As from version 1.05, all the footnote styles use: \begin{definition}[\DescribeMacro\glsfirstlongfootnotefont] \cs{glsfirstlongfootnotefont}\marg{text} \end{definition} to format the long form on \gls{firstuse} or for the full form and \begin{definition}[\DescribeMacro\glslongfootnotefont] \cs{glslongfootnotefont}\marg{text} \end{definition} to format the long form elsewhere (for example, when used with \cs{glsxtrlong}). As from version 1.07, all the footnote styles use: \begin{definition}[\DescribeMacro\glsxtrabbrvfootnote] \cs{glsxtrabbrvfootnote}\marg{label}\marg{long} \end{definition} By default, this just does \ics{footnote}\marg{long} (the first argument is ignored). For example, to make the footnote text link to the relevant place in the glossary: \begin{verbatim} \renewcommand{\glsxtrabbrvfootnote}[2]{% \footnote{\glshyperlink[#2]{#1}}% } \end{verbatim} or to include the short form with a hyperlink: \begin{verbatim} \renewcommand{\glsxtrabbrvfootnote}[2]{% \footnote{\glshyperlink[\glsfmtshort{#1}]{#1}: #2}% } \end{verbatim} Note that I haven't used commands like \cs{glsxtrshort} to avoid interference (see \sectionref{sec:entryfmtmods} and \sectionref{sec:nested}). \item[\abbrstyle{footnote}] A synonym for \abbrstyle{short-footnote}. \item[\abbrstyle{short-sc-footnote}] Like \abbrstyle{short-footnote} but redefines \cs{glsabbrvfont} to use \ics{glsxtrscfont}. (This style was originally called \depabbrstyle{footnote-sc}. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.) \item[\abbrstyle{short-sc-footnote}] Like \abbrstyle{short-footnote} but redefines \cs{glsabbrvfont} to use \ics{glsxtrsmfont}. (This style was originally called \depabbrstyle{footnote-sm}. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.) \item[\abbrstyle{short-em-footnote}] Like \abbrstyle{short-footnote} but redefines \cs{glsabbrvfont} to use \ics{glsxtremfont}. (This style was originally called \depabbrstyle{footnote-em}. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.) \item[\abbrstyle{short-postfootnote}] This is similar to the \abbrstyle{short-footnote} style but doesn't modify the category attribute. Instead it changes \postlinkcat\ to insert the footnote after the \gls{linktext} on \gls{firstuse}. This will also defer the footnote until after any following punctuation character that's recognised by \ics{glsxtrifnextpunc}. The inline full form uses the \meta{short} (\meta{long}) style. The \gloskey{name} is set to the short form. The \gloskey{description} is set to the long form. Note that this style will change \cs{glsxtrfull} (and it's variants) so that it fakes non-\gls{firstuse}. (Otherwise the footnote would appear after the inline form.) \item[\abbrstyle{postfootnote}] A synonym for \abbrstyle{short-postfootnote}. \item[\abbrstyle{short-sc-postfootnote}] Like \abbrstyle{short-postfootnote} but redefines \cs{glsabbrvfont} to use \ics{glsxtrscfont}. (This style was originally called \depabbrstyle{postfootnote-sc}. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.) \item[\abbrstyle{short-sm-postfootnote}] Like \abbrstyle{short-postfootnote} but redefines \cs{glsabbrvfont} to use \ics{glsxtrsmfont}. (This style was originally called \depabbrstyle{postfootnote-sm}. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.) \item[\abbrstyle{short-em-postfootnote}] Like \abbrstyle{short-postfootnote} but redefines \cs{glsabbrvfont} to use \ics{glsxtremfont}. (This style was originally called \depabbrstyle{postfootnote-em}. Renamed in version 1.04, but original name retained as a deprecated synonym for backward-compatibility.) \item[\abbrstyle{short-postlong-user}] This style was introduced in version 1.12. It's like the \abbrstyle{short-long-user} style but defers the parenthetical material to after the link-text. This means that you don't have such a long hyperlink (which can cause problems for the DVI \LaTeX\ format) and it also means that the user supplied material can include a hyperlink to another location. \item[\abbrstyle{short-postlong-user-desc}] This style was introduced in version 1.12. It's like the above \abbrstyle{short-postlong-user} style but the \gloskey{description} must be specified. \item[\abbrstyle{long-postshort-user}] This style was introduced in version 1.12. It's like the above \abbrstyle{short-postlong-user} style but the long form is shown first and the short form is in the parenthetical material (as for \abbrstyle{long-short-user}) style. \item[\abbrstyle{long-postshort-user-desc}] This style was introduced in version 1.12. It's like the above \abbrstyle{long-postshort-user} style but the \gloskey{description} must be specified. \end{description} \section{Defining New Abbreviation Styles} \label{sec:newabbrvstyle} New abbreviation styles may be defined using: \begin{definition}[\DescribeMacro\newabbreviationstyle] \cs{newabbreviationstyle}\marg{name}\marg{setup}\marg{fmts} \end{definition} \begin{sloppypar}\noindent where \meta{name} is the name of the new style (as used in the mandatory argument of \ics{setabbreviationstyle}). This is similar but not identical to the \styfmt{glossaries} package's \ics{newacronymstyle} command. \end{sloppypar} \begin{important} You can't use styles defined by \cs{newacronymstyle} with \styfmt{glossaries-extra} unless you have reverted \ics{newacronym} back to its generic definition from \styfmt{glossaries} (using \ics{RestoreAcronyms}). The acronym styles from the \styfmt{glossaries} package can't be used with abbreviations defined with \cs{newabbreviation}. \end{important} The \meta{setup} argument deals with the way the entry is defined and may set attributes for the given abbreviation category. This argument should redefine \begin{definition}[\DescribeMacro\CustomAbbreviationFields] \cs{CustomAbbreviationFields} \end{definition} to set the entry fields including the \gloskey{name} (defaults to the short form if omitted), \gloskey{sort}, \gloskey{first}, \gloskey{firstplural}. Other fields may also be set, such as \gloskey{text}, \gloskey{plural} and \gloskey{description}. \begin{important} \cs{CustomAbbreviationFields} is expanded by \cs{newabbreviation} so take care to protect commands that shouldn't be expanded. \end{important} For example, the \abbrstyle{long-short} style has the following in \meta{setup}: \begin{verbatim} \renewcommand*{\CustomAbbreviationFields}{% name={\protect\glsabbrvfont{\the\glsshorttok}}, sort={\the\glsshorttok}, first={\protect\glsfirstlongfont{\the\glslongtok}% \protect\glsxtrfullsep{\the\glslabeltok}% (\protect\glsfirstabbrvfont{\the\glsshorttok})},% firstplural={\protect\glsfirstlongfont{\the\glslongpltok}% \protect\glsxtrfullsep{\the\glslabeltok}% (\protect\glsfirstabbrvfont{\the\glsshortpltok})},% plural={\protect\glsabbvfont{\the\glsshortpltok}},% description={\the\glslongtok}}% \end{verbatim} Note that the \gloskey{first} and \gloskey{firstplural} are set even though they're not used by \cs{gls}. The \meta{setup} argument may also redefine \begin{definition}[\DescribeMacro\GlsXtrPostNewAbbreviation] \cs{GlsXtrPostNewAbbreviation} \end{definition} which can be used to assign attributes. (This will automatically be initialised to do nothing.) For example, the \abbrstyle{short-footnote} includes the following in \meta{setup}: \begin{verbatim} \renewcommand*{\GlsXtrPostNewAbbreviation}{% \glssetattribute{\the\glslabeltok}{nohyperfirst}{true}% \glshasattribute{\the\glslabeltok}{regular}% {% \glssetattribute{\the\glslabeltok}{regular}{false}% }% {}% }% \end{verbatim} This sets the \catattr{nohyperfirst} attribute to \qt{true}. It also unsets the \catattr{regular} attribute if it has previously been set. Note that the \catattr{nohyperfirst} attribute doesn't get unset by other styles, so take care not to switch styles for the same category. You can access the short, long, short plural and long plural values through the following token registers. Short value (defined by \styfmt{glossaries}): \begin{definition}[\DescribeMacro\glsshorttok] \cs{glsshorttok} \end{definition} Short plural value (defined by \styfmt{glossaries-extra}): \begin{definition}[\DescribeMacro\glsshortpltok] \cs{glsshortpltok} \end{definition} (This may be the default value or, if provided, the value provided by the user through the \gloskey{shortplural} key in the optional argument of \ics{newabbreviation}.) Long value (defined by \styfmt{glossaries}): \begin{definition}[\DescribeMacro\glslongtok] \cs{glslongtok} \end{definition} Long plural value (defined by \styfmt{glossaries-extra}): \begin{definition}[\DescribeMacro\glslongpltok] \cs{glslongpltok} \end{definition} (This may be the default value or, if provided, the value provided by the user through the \gloskey{longplural} key in the optional argument of \ics{newabbreviation}.) There are two other registers available that are defined by \styfmt{glossaries}: \begin{definition}[\DescribeMacro\glslabeltok] \cs{glslabeltok} \end{definition} which contains the entry's label and \begin{definition}[\DescribeMacro\glskeylisttok] \cs{glskeylisttok} \end{definition} which contains the values provided in the optional argument of \ics{newabbreviation}. Remember put \cs{the} in front of the register command as in the examples above. The category label can be access through the command (not a register): \begin{definition}[\DescribeMacro\glscategorylabel] \cs{glscategorylabel} \end{definition} This may be used inside the definition of \cs{GlsXtrPostNewAbbreviation}. If you want to base a style on an existing style, you can use \begin{definition}[\DescribeMacro\GlsXtrUseAbbrStyleSetup] \cs{GlsXtrUseAbbrStyleSetup}\marg{name} \end{definition} where \meta{name} is the name of the existing style. For example, the \abbrstyle{short-sc-footnote} and \abbrstyle{short-sm-footnote} styles both simply use \begin{verbatim} \GlsXtrUseAbbrStyleSetup{short-footnote} \end{verbatim} within \meta{setup}. The \meta{fmts} argument deals with the way the entry is displayed in the document. This argument should redefine the following commands: The default suffix for the plural short form (if not overridden by the \gloskey{shortplural} key): \begin{definition}[\DescribeMacro\abbrvpluralsuffix] \cs{abbrvpluralsuffix} \end{definition} (Note that this isn't used for the plural long form, which just uses the regular \cs{glspluralsuffix}.) The font used for the short form on \gls{firstuse} or in the full forms: \begin{definition}[\DescribeMacro\glsfirstabbrvfont] \cs{glsfirstabbrvfont}\marg{text} \end{definition} The font used for the short form on subsequent use or through commands like \ics{glsxtrshort}: \begin{definition}[\DescribeMacro\glsabbrvfont] \cs{glsabbrvfont}\marg{text} \end{definition} The font used for the long form on \gls{firstuse} or in the full forms: \begin{definition}[\DescribeMacro\glsfirstlongfont] \cs{glsfirstlongfont}\marg{text} \end{definition} The font used for the long form in commands like \cs{glsxtrlong} use: \begin{definition}[\DescribeMacro\glslongfont] \cs{glslongfont}\marg{text} \end{definition} Display full form singular no case-change (used by \ics{gls} on \gls{firstuse} for abbreviations without the \catattr{regular} attribute set): \begin{definition}[\DescribeMacro\glsxtrfullformat] \cs{glsxtrfullformat}\marg{label}\marg{insert} \end{definition} Display full form singular first letter converted to upper case (used by \ics{Gls} on \gls{firstuse} for abbreviations without the \catattr{regular} attribute set): \begin{definition}[\DescribeMacro\Glsxtrfullformat] \cs{Glsxtrfullformat}\marg{label}\marg{insert} \end{definition} Display full form plural no case-change (used by \ics{glspl} on \gls{firstuse} for abbreviations without the \catattr{regular} attribute set): \begin{definition}[\DescribeMacro\glsxtrfullplformat] \cs{glsxtrfullplformat}\marg{label}\marg{insert} \end{definition} Display full form plural first letter converted to upper case (used by \ics{Glspl} on \gls{firstuse} for abbreviations without the \catattr{regular} attribute set): \begin{definition}[\DescribeMacro\Glsxtrfullplformat] \cs{Glsxtrfullplformat}\marg{label}\marg{insert} \end{definition} In addition \meta{fmts} may also redefine the following commands that govern the inline full formats. If the style doesn't redefine them, they will default to the same as the display full forms. Inline singular no case-change (used by \ics{glsentryfull}, \ics{glsxtrfull} and \ics{GLSxtrfull}): \begin{definition}[\DescribeMacro\glsxtrinlinefullformat] \cs{glsxtrinlinefullformat}\marg{label}\marg{insert} \end{definition} Inline singular first letter converted to upper case (used by \ics{Glsentryfull} and \ics{Glsxtrfull}): \begin{definition}[\DescribeMacro\Glsxtrinlinefullformat] \cs{Glsxtrinlinefullformat}\marg{label}\marg{insert} \end{definition} Inline plural no case-change (used by \ics{glsentryfullpl}, \ics{glsxtrfullpl} and \ics{GLSxtrfullpl}): \begin{definition}[\DescribeMacro\glsxtrinlinefullplformat] \cs{glsxtrinlinefullplformat}\marg{label}\marg{insert} \end{definition} Inline plural first letter converted to upper case (used by \ics{Glsentryfullpl} and \ics{Glsxtrfullpl}): \begin{definition}[\DescribeMacro\Glsxtrinlinefullplformat] \cs{Glsxtrinlinefullplformat}\marg{label}\marg{insert} \end{definition} If you want to provide support for \sty{glossaries-accsupp} use the following \cs{glsaccess\meta{xxx}} commands (\sectionref{sec:accsupp}) within the definitions of \cs{glsxtrfullformat} etc instead of the analogous \cs{glsentry}\meta{xxx} commands. (If you don't use \sty{glossaries-accsupp}, they will just do the corresponding \cs{glsentry}\meta{xxx} command.) For example, the \abbrstyle{short-long} style has the following in \meta{fmts}: \begin{verbatim} \renewcommand*{\abbrvpluralsuffix}{\glspluralsuffix}% \renewcommand*{\glsabbrvfont}[1]{\glsabbrvdefaultfont{##1}}% \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}% \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% \renewcommand*{\glsxtrfullformat}[2]{% \glsfirstabbrvfont{\glsaccessshort{##1}}##2\glsxtrfullsep{##1}% (\glsfirstlongfont{\glsaccesslong{##1}})% }% \renewcommand*{\glsxtrfullplformat}[2]{% \glsfirstabbrvfont{\glsaccessshortpl{##1}}##2\glsxtrfullsep{##1}% (\glsfirstlongfont{\glsaccesslongpl{##1}})% }% \renewcommand*{\Glsxtrfullformat}[2]{% \glsfirstabbrvfont{\Glsaccessshort{##1}}##2\glsxtrfullsep{##1}% (\glsfirstlongfont{\glsaccesslong{##1}})% }% \renewcommand*{\Glsxtrfullplformat}[2]{% \glsfirstabbrvfont{\Glsaccessshortpl{##1}}##2\glsxtrfullsep{##1}% (\glsfirstlongfont{\glsaccesslongpl{##1}})% }% \end{verbatim} Since the inline full commands aren't redefined, they default to the same as the display versions. If you want to base a style on an existing style, you can use \begin{definition}[\DescribeMacro\GlsXtrUseAbbrStyleFmts] \cs{GlsXtrUseAbbrStyleFmts}\marg{name} \end{definition} within \meta{fmts}, where \meta{name} is the name of the existing style. For example, the \abbrstyle{short-sc-long} style has the following in \meta{fmts}: \begin{verbatim} \GlsXtrUseAbbrStyleFmts{short-long}% \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}% \renewcommand*{\glsabbrvfont}[1]{\glsxtrscfont{##1}}% \end{verbatim} and the \abbrstyle{short-sm-long} style has: \begin{verbatim} \GlsXtrUseAbbrStyleFmts{short-long-desc}% \renewcommand*{\glsabbrvfont}[1]{\glsxtrsmfont{##1}}% \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}% \end{verbatim} The simplest examples of creating a new style based on an existing style are the \qt{em} styles, such as the \abbrstyle{short-em-long} style, which is defined as: \begin{verbatim} \newabbreviationstyle {short-em-long}% label {% setup \GlsXtrUseAbbrStyleSetup{short-long}% }% {% fmts \GlsXtrUseAbbrStyleFmts{short-long}% \renewcommand*{\glsabbrvfont}[1]{\glsxtremfont{##1}}% } \end{verbatim} \chapter{Entries in Sectioning Titles, Headers, Captions and Contents} \label{sec:headtitle} The \styfmt{glossaries} user manual cautions against using commands like \cs{gls} in chapter or section titles. The principle problems are: \begin{itemize} \item if you have a table of contents, the \gls{firstuseflag} will be unset in the contents rather than later in the document; \item if you have the location lists displayed in the glossary, unwanted locations will be added to it corresponding to the table of contents (if present) and every page that contains the entry in the page header (if the page style in use adds the chapter or section title to the header); \item if the page style in use adds the chapter or section title to the header and attempts to convert it to upper case, the entry label (in the argument of \cs{gls} etc) will be converted to upper case and the entry won't be recognised; \item if you use \sty{hyperref}, commands like \cs{gls} can't be expanded to a simple string and only the label will appear in the PDF bookmark (with a warning from \sty{hyperref}); \item if you use \sty{hyperref}, you will end up with nested hyperlinks in the table of contents. \end{itemize} Similar problems can also occur with captions (except for the page header and bookmark issues). To get around all these problems, the \styfmt{glossaries} user manual recommends using the expandable non-hyperlink commands, such as \ics{glsentrytext} (for regular entries) or \ics{glsentryshort} (for abbreviations). This is the simplest solution, but doesn't allow for special formatting that's applied to the entry through commands like \cs{glstext} or \cs{glsxtrshort}. This means that if, for example, you are using one of the abbreviation styles that uses \ics{textsc} then the short form displayed with \cs{glsentryshort} won't use small caps. If you only have one abbreviation style in use, you can explicitly enclose \cs{glsentryshort}\marg{label} in the argument of \cs{glsabbrvfont}, like this: \begin{verbatim} \chapter{A Chapter about \glsabbrvfont{\glsentryshort{html}}} \end{verbatim} Or, if you are using \sty{hyperref}: \begin{verbatim} \chapter{A Chapter about \texorpdfstring{\glsabbrvfont{\glsentryshort{html}}}{\glsentryshort{html}}} \end{verbatim} Since this is a bit cumbersome, you might want to define a new command to do this for you. However, if you have mixed styles this won't work as commands like \cs{gls} and \cs{glsxtrshort} redefine \cs{glsabbrvfont} to match the entry's style before displaying it. In this case, the above example doesn't take into account the shifting definitions of \cs{glsabbrvfont} and will use whatever happens to be the last abbreviation style in use. More complicated solutions interfere with the upper casing used by the standard page styles that display the chapter or section title in the page header using \ics{MakeUppercase}. The \styfmt{glossaries-extra} package tries to resolve this by modifying \ics{markright} and \ics{markboth}. If you don't like this change, you can restore their former definitions using \begin{definition}[\DescribeMacro\glsxtrRevertMarks] \cs{glsxtrRevertMarks} \end{definition} In this case, you'll have to use the \styfmt{glossaries} manual's recommendations of either simply using \cs{glsentryshort} (as above) or use the sectioning command's option argument to provide an alternative for the table of contents and page header. For example: \begin{verbatim} \chapter[A Chapter about \glsentryshort{html}]{A Chapter about \gls{html}} \end{verbatim} If you don't revert the mark commands back with \cs{glsxtrRevertMarks}, you can use the commands described below in the argument of sectioning commands. You can still use them even if the mark commands have been reverted, but only where they don't conflict with the page style. The commands listed below all use \ics{texorpdfstring} if \sty{hyperref} has been loaded so that the expandable non-formatted version is added to the PDF bookmarks. Note that since the commands that convert the first letter to upper case aren't expandable, the non-case-changing version is used for the bookmarks. These commands essentially behave as though you have used \cs{glsxtrshort} (or equivalent) with the options \gloskey[glslink]{noindex} and \gloskey[glslink]{hyper\eq false}. The text produced won't be converted to upper case in the page headings by default. If you want the text converted to upper case you need to set the \catattr{headuc} attribute to \qt{true} for the appropriate category. \begin{important} If you use one of the \ics{textsc} styles, be aware that the default fonts don't provide bold small-caps or italic small-caps. This means that if the chapter or section title style uses bold, this may override the small-caps setting, in which case the abbreviation will just appear as lower case bold. If the heading style uses italic, the abbreviation may appear in upright small-caps, \emph{even if you have set the \catattr{headuc} attribute} since the all-capitals form still uses \cs{glsabbrvfont}. You may want to consider using the \sty{slantsc} package in this case. \end{important} Display the short form: \begin{definition}[\DescribeMacro\glsfmtshort] \cs{glsfmtshort}\marg{label} \end{definition} Display the plural short form: \begin{definition}[\DescribeMacro\glsfmtshortpl] \cs{glsfmtshortpl}\marg{label} \end{definition} First letter upper case singular short form: \begin{definition}[\DescribeMacro\Glsfmtshort] \cs{Glsfmtshort}\marg{label} \end{definition} (No case-change applied to PDF bookmarks.) First letter upper case plural short form: \begin{definition}[\DescribeMacro\Glsfmtshortpl] \cs{Glsfmtshortpl}\marg{label} \end{definition} (No case-change applied to PDF bookmarks.) Display the long form: \begin{definition}[\DescribeMacro\glsfmtlong] \cs{glsfmtlong}\marg{label} \end{definition} Display the plural long form: \begin{definition}[\DescribeMacro\glsfmtlongpl] \cs{glsfmtlongpl}\marg{label} \end{definition} First letter upper case singular long form: \begin{definition}[\DescribeMacro\Glsfmtlong] \cs{Glsfmtlong}\marg{label} \end{definition} (No case-change applied to PDF bookmarks.) First letter upper case plural long form: \begin{definition}[\DescribeMacro\Glsfmtlongpl] \cs{Glsfmtlongpl}\marg{label} \end{definition} (No case-change applied to PDF bookmarks.) There are similar commands for the full form, but note that these use the \emph{inline} full form, which may be different from the full form used by \cs{gls}. Display the full form: \begin{definition}[\DescribeMacro\glsfmtfull] \cs{glsfmtfull}\marg{label} \end{definition} Display the plural full form: \begin{definition}[\DescribeMacro\glsfmtfullpl] \cs{glsfmtfullpl}\marg{label} \end{definition} First letter upper case singular full form: \begin{definition}[\DescribeMacro\Glsfmtfull] \cs{Glsfmtfull}\marg{label} \end{definition} (No case-change applied to PDF bookmarks.) First letter upper case plural full form: \begin{definition}[\DescribeMacro\Glsfmtfullpl] \cs{Glsfmtfullpl}\marg{label} \end{definition} (No case-change applied to PDF bookmarks.) There are also equivalent commands for the value of the \gloskey{text} field: \begin{definition}[\DescribeMacro\glsfmttext] \cs{glsfmttext}\marg{label} \end{definition} First letter converted to upper case: \begin{definition}[\DescribeMacro\Glsfmttext] \cs{Glsfmttext}\marg{label} \end{definition} (No case-change applied to PDF bookmarks.) The plural equivalents: \begin{definition}[\DescribeMacro\glsfmtplural] \cs{glsfmtplural}\marg{label} \end{definition} and \begin{definition}[\DescribeMacro\Glsfmtplural] \cs{Glsfmtplural}\marg{label} \end{definition} Similarly for the value of the \gloskey{first} field: \begin{definition}[\DescribeMacro\glsfmtfirst] \cs{glsfmtfirst}\marg{label} \end{definition} First letter converted to upper case: \begin{definition}[\DescribeMacro\Glsfmtfirst] \cs{Glsfmtfirst}\marg{label} \end{definition} (No case-change applied to PDF bookmarks.) The plural equivalents: \begin{definition}[\DescribeMacro\glsfmtfirstpl] \cs{glsfmtfirstpl}\marg{label} \end{definition} and \begin{definition}[\DescribeMacro\Glsfmtfirstpl] \cs{Glsfmtfirstpl}\marg{label} \end{definition} \chapter{Categories} \label{sec:categories} Each entry defined by \ics{newglossaryentry} (or commands that internally use it such as \ics{newabbreviation}) is assigned a category through the \gloskey{category} key. You may add any category that you like, but since the category is a label used in the creation of some control sequences, avoid problematic characters within the category label. (So take care if you have \sty{babel} shorthands on that make some characters active.) The use of categories can give you more control over the way entries are displayed in the text or glossary. Note that an entry's category is independent of the glossary type. Be careful not to confuse \gloskey{category} with \gloskey{type}. The default category assumed by \cs{newglossaryentry} is labelled \category{general}. Abbreviations defined with \cs{newabbreviation} have the category set to \category{abbreviation} by default. Abbreviations defined with \cs{newacronym} have the category set to \category{acronym} by default. Additionally, if you have enabled \ics{newterm} with the \pkgopt{index} package option that command will set the category to \category{index} by default. If you have enabled \ics{glsxtrnewsymbol} with the \pkgopt{symbols} package option, that command will set the category to \category{symbol}. If you have enabled \ics{glsxtrnewnumber} with the \pkgopt{numbers} package option, that command will set the category to \category{number}. You can obtain the category label for a given entry using \begin{definition}[\DescribeMacro\glscategory] \cs{glscategory}\marg{label} \end{definition} This is equivalent to commands like \cs{glsentryname} and so may be used in an expandable context. No error is generated if the entry doesn't exist. You can test the category for a given entry using \begin{definition}[\DescribeMacro\glsifcategory] \cs{glsifcategory}\marg{entry-label}\marg{category-label}\marg{true part}\marg{false part} \end{definition} This is equivalent to \begin{alltt} \ics{ifglsfieldeq}\marg{entry-label}\{category\}\marg{category-label}\marg{true part}\marg{false part} \end{alltt} so any restrictions that apply to \cs{ifglsfieldeq} also apply to \cs{glsifcategory}. Each category may have a set of attributes. For example, the \category{general} and \category{acronym} categories have the attribute \catattr{regular} set to \qt{true} to indicate that all entries with either of those categories are regular entries (as opposed to abbreviations). This attribute is accessed by \cs{glsentryfmt} to determine whether to use \cs{glsgenentryfmt} or \cs{glsxtrgenabbrvfmt}. Other attributes recognised by \styfmt{glossaries-extra} are: \begin{description} \item[\catattr{nohyperfirst}] When using commands like \ics{gls} this will automatically suppress the hyperlink on \gls{firstuse} for entries with a category that has this attribute set to \qt{true}. (This settings can be overridden by explicitly setting the \gloskey[glslink]{hyper} key on or off in the optional argument of commands like \cs{gls}.) As from version 1.07, \cs{glsfirst}, \cs{Glsfirst}, \cs{GLSfirst} and their plural versions (which should ideally behave in a similar way to the \gls{firstuse} of \cs{gls} or \cs{glspl}) now honour this attribute (but not the package-wide \pkgopt[false]{hyperfirst} option, which matches the behaviour of \sty{glossaries}). If you want commands these \cs{glsfirst} etc commands to ignore the \catattr{nohyperfirst} attribute then just redefine \begin{definition}[\DescribeMacro\glsxtrchecknohyperfirst] \cs{glsxtrchecknohyperfirst}\marg{label} \end{definition} to do nothing. \item[\catattr{nohyper}] When using commands like \ics{gls} this will automatically suppress the hyperlink for entries with a category that has this attribute set to \qt{true}. (This settings can be overridden by explicitly setting the \gloskey[glslink]{hyper} key on or off in the optional argument of commands like \cs{gls}.) \item[\catattr{indexonlyfirst}] This is similar to the \pkgopt{indexonlyfirst} package option but only for entries that have a category with this attribute set to \qt{true}. \item[\catattr{discardperiod}] If set to \qt{true}, the post-\gls{linktext} hook will discard a~full stop (period) that follows \emph{non-plural} commands like \cs{gls} or \cs{glstext}. (Provided for entries such as abbreviations that end with a full stop.) Note that this can cause a problem if you access a field that doesn't end with a full stop. For example: \begin{verbatim} \newabbreviation [user1={German Speaking \TeX\ User Group}] {dante}{DANTE e.V.}{Deutschsprachige Anwendervereinigung \TeX\ e.V.} \end{verbatim} Here the \gloskey{short} and \gloskey{long} fields end with a full stop, but the \gloskey{user1} field doesn't. The simplest solution in this situation is to put the sentence terminator in the final optional argument. For example: \begin{verbatim} \glsuseri{dante}[.] \end{verbatim} This will bring the punctuation character inside the \gls{linktext} and it won't be discarded. \item[\catattr{pluraldiscardperiod}] If this attribute is set to \qt{true} \emph{and} the \catattr{discardperiod} attribute is set to \qt{true}, this will behave as above for the plural commands like \cs{glspl} or \cs{glsplural}. \item[\catattr{retainfirstuseperiod}] If this attribute is set to \qt{true} then the full stop won't be discarded for \gls{firstuse} instances, even if \catattr{discardperiod} or \catattr{pluraldiscardperiod} are set. This is useful for \meta{short} (\meta{long}) abbreviation styles where only the short form has a trailing full stop.. \item[\catattr{insertdots}] If this attribute is set to \qt{true} any entry defined using \ics{newabbreviation} will automatically have full stops (periods) inserted after each letter. The entry will be defined with those dots present as though they had been present in the \meta{short} argument of \cs{newabbreviation} (rather than inserting them every time the entry is used). The short plural form defaults to the new dotted version of the original \meta{short} form with the plural suffix appended. \begin{important} If you explicitly override the short plural using the \gloskey{shortplural} key, you must explicitly insert the dots yourself (since there's no way for the code to determine if the plural has a suffix that shouldn't be followed by a dot). \end{important} This attribute is best used with the \catattr{discardperiod} attribute set to \qt{true}. \item[\catattr{aposplural}] If this attribute is set to \qt{true}, \ics{newabbreviation} will insert an apostrophe (') before the plural suffix for the \emph{short} plural form (unless explicitly overridden with the \gloskey{shortplural} key). The long plural form is unaffected by this setting. \item[\catattr{noshortplural}] If this attribute is set to \qt{true}, \ics{newabbreviation} won't append the plural suffix for the short plural form. This means the \gloskey{short} and \gloskey{shortplural} values will be the same unless explicitly overridden. \emph{The \catattr{aposplural} attribute trumps the \catattr{noshortplural} attribute.} \item[\catattr{headuc}] If this attribute is set to \qt{true}, commands like \ics{glsfmtshort} will use the upper case version in the page headers. \item[\catattr{tagging}] If this attribute is set to \qt{true}, the tagging command defined by \ics{GlsXtrEnableInitialTagging} will be activated to use \ics{glsxtrtagfont} in the glossary (see \sectionref{sec:tagging}). \item[\catattr{entrycount}] Unlike the above attributes, this attribute isn't boolean but instead must be an integer value and is used in combination with \ics{glsenableentrycount} (see \sectionref{sec:entrycountmods}). Leave blank or undefined for categories that shouldn't have this facility enabled. The value of this attribute is used by \ics{glsxtrifcounttrigger} to determine how commands such as \ics{cgls} should behave. With \styfmt{glossaries}, commands like \cs{cgls} use \cs{cglsformat} only if the previous usage count for that entry was equal to~1. With \styfmt{glossaries-extra} the test is now for entries that have the \catattr{entrycount} attribute set and where the previous usage count for that entry is less than or equal to the value of that attribute. \item[\catattr{glossdesc}] The \ics{glossentrydesc} command (used in the predefined glossary styles) is modified by \styfmt{glossaries-extra} to check for this attribute. The attribute may have one of the following values: \begin{itemize} \item \texttt{firstuc}: the first letter of the description will be converted to upper case (using \ics{Glsentrydesc}). \item \texttt{title}: the description will be used in the argument of the title casing command \ics{capitalisewords} (provided by \sty{mfirstuc}). If you want to use a different command you can redefine: \begin{definition}[\DescribeMacro\glsxtrfieldtitlecasecs] \cs{glsxtrfieldtitlecasecs}\marg{phrase cs} \end{definition} For example: \begin{verbatim} \newcommand*{\glsxtrfieldtitlecasecs}[1]{\xcapitalisefmtwords*{#1}} \end{verbatim} (Note that the argument to \cs{glsxtrfieldtitlecasecs} will be a control sequence whose replacement text is the entry's description, which is why \cs{xcapitalisefmtwords} is needed instead of \cs{capitalisefmtwords}.) \end{itemize} Any other values of this attribute are ignored. Remember that there are design limitations for both the first letter uppercasing and the title casing commands. See the \sty{mfirstuc} user manual for further details. \item[\catattr{glossdescfont}] (New to version 1.04) In addition to the above, the modified \ics{glossentrydesc} command also checks this attribute. If set, it should be the name of a control sequence (without the leading backslash) that takes one argument. This control sequence will be applied to the description text. For example: \begin{verbatim} \glssetcategoryattribute{general}{glossdescfont}{emph} \end{verbatim} \item[\catattr{glossname}] As \catattr{glossdesc} but applies to \ics{glossentryname}. Additionally, if this attribute is set to \qt{uc} the name is converted to all capitals. \item[\catattr{indexname}] If set, the \cs{glsxtrpostnamehook} hook used at the end of \ics{glossentyname} will index the entry using \ics{index}. See \sectionref{sec:autoindex} for further details. \item[\catattr{glossnamefont}] (New to version 1.04) In addition to the above, the modified \ics{glossentryname} command also checks this attribute. If set, it should be the name of a control sequence (without the leading backslash) that takes one argument. This control sequence will be applied to the name text. For example: \begin{verbatim} \glssetcategoryattribute{general}{glossnamefont}{emph} \end{verbatim} Note that this overrides \cs{glsnamefont} which will only be used if this attribute hasn't been set. Remember that glossary styles may additionally apply a font change, such as the list styles which put the name in the optional argument of \cs{item}. \item[\catattr{dualindex}] If set, whenever a glossary entry has information written to the external glossary file through commands like \ics{gls} and \ics{glsadd}, a~corresponding line will be written to the indexing file using \ics{index}. See \sectionref{sec:autoindex} for further details. \item[\catattr{targeturl}] If set, the hyperlink generated by commands like \cs{gls} will be set to the URL provided by this attributes value. For example: \begin{verbatim} \glssetcategoryattribute{general}{targeturl}{master-doc.pdf} \end{verbatim} (See also the accompanying sample file \texttt{sample-external.tex}.) If the URL contains awkward characters (such as \verb|%| or \verb|~|) remember that the base \styfmt{glossaries} package provides commands like \ics{glspercentchar} and \cs{glstildechar} that expand to literal characters. If you want to a named anchor within the target URL (notionally adding \texttt{\#}\meta{name} to the URL), then you also need to set \catattr{targetname} to the anchor \meta{name}. You may use \cs{glslabel} within \meta{name} which is set by commands like \cs{gls} to the entry's label. All the predefined glossary styles start each entry listing with \cs{glstarget} which sets the anchor to \verb|\glolinkprefix\glslabel|, so if you want entries to link to glossaries in the URL given by \catattr{targeturl}, you can just do: \begin{verbatim} \glssetcategoryattribute{general}{targetname}{\glolinkprefix\glslabel} \end{verbatim} (If the target document changed \cs{glolinkprefix} then you will need to adjust the above as appropriate.) If the anchor is in the form \meta{name1}\texttt{.}\meta{name2} then use \catattr{targetname} for the \meta{name2} part and \catattr{targetcategory} for the \meta{name1} part. For example: \begin{verbatim} \glssetcategoryattribute{general}{targeturl}{master-doc.pdf} \glssetcategoryattribute{general}{targetcategory}{page} \glssetcategoryattribute{general}{targetname}{7} \end{verbatim} will cause all link text for \texttt{general} entries to link to \texttt{master-doc.pdf\#page.7} (page 7 of that PDF). If you want a mixture in your document of entries that link to an internal glossary and entries that link to an external URL then you can use the starred form of \ics{newignoredglossary} for the external list. For example: \begin{verbatim} \newignoredglossary*{external} \glssetcategoryattribute{external}{targeturl}{master-doc.pdf} \glssetcategoryattribute{general}{targetname}{\glolinkprefix\glslabel} \newglossaryentry{sample}{name={sample},description={local example}} \newglossaryentry{sample2}{name={sample2}, type=external, category=external, description={external example}} \end{verbatim} \end{description} An attribute can be set using: \begin{definition}[\DescribeMacro\glssetcategoryattribute] \cs{glssetcategoryattribute}\marg{category-label}\marg{attribute-label}\marg{value} \end{definition} where \meta{category-label} is the category label, \meta{attribute-label} is the attribute label and \meta{value} is the new value for the attribute. There is a shortcut version to set the \catattr{regular} attribute to \qt{true}: \begin{definition}[\DescribeMacro\glssetregularcategory] \cs{glssetregularcategory}\marg{category-label} \end{definition} If you need to lookup the category label for a particular entry, you can use the shortcut command: \begin{definition}[\DescribeMacro\glssetattribute] \cs{glssetattribute}\marg{entry-label}\marg{attribute-label}\marg{value} \end{definition} This uses \cs{glssetcategoryattribute} with \cs{glscategory} to set the attribute. Note that this will affect all other entries that share this entry's category. You can fetch the value of an attribute for a particular category using: \begin{definition}[\DescribeMacro\glsgetcategoryattribute] \cs{glsgetcategoryattribute}\marg{category-label}\marg{attribute-label} \end{definition} Again there is a shortcut if you need to lookup the category label for a given entry: \begin{definition}[\DescribeMacro\glsgetattribute] \cs{glsgetattribute}\marg{entry-label}\marg{attribute-label} \end{definition} You can test if an attribute has been assigned to a given category using: \begin{definition}[\DescribeMacro\glshascategoryattribute] \cs{glshascategoryattribute}\marg{category-label}\marg{attribute-label}\marg{true code}\marg{false code} \end{definition} This uses \sty{etoolbox}'s \cs{ifcsvoid} and does \meta{true code} if the attribute has been set and isn't blank and isn't \cs{relax}. The shortcut if you need to lookup the category label from an entry is: \begin{definition}[\DescribeMacro\glshasattribute] \cs{glshasattribute}\marg{entry-label}\marg{attribute-label}\marg{true code}\marg{false code} \end{definition} You can test the value of an attribute for a particular category using: \begin{definition}[\DescribeMacro\glsifcategoryattribute] \cs{glsifcategoryattribute}\marg{category-label}\marg{attribute-label}\marg{value} \marg{true-part}\marg{false-part} \end{definition} This tests if the attribute (given by \meta{attribute-label}) for the category (given by \meta{category-label}) is set and equal to \meta{value}. If true, \meta{true-part} is done. If the attribute isn't set or is set but isn't equal to \meta{value}, \meta{false part} is done. For example: \begin{verbatim} \glsifcategoryattribute{general}{nohyper}{true}{NO HYPER}{HYPER} \end{verbatim} This does \qt{NO HYPER} if the \category{general} category has the \catattr{nohyper} attribute set to \texttt{true} otherwise if does \qt{HYPER}. With boolean-style attributes like \catattr{nohyper}, make sure you always test for \texttt{true} not \texttt{false} in case the attribute hasn't been set. Again there's a shortcut if you need to lookup the category label from a particular entry: \begin{definition}[\DescribeMacro\glsifattribute] \cs{glsifattribute}\marg{entry-label}\marg{attribute-label}\marg{value}\marg{true-part} \marg{false-part} \end{definition} There's also a shortcut to determine if a particular category has the \catattr{regular} attribute set to \qt{true}: \begin{definition}[\DescribeMacro\glsifregularcategory] \cs{glsifregularcategory}\marg{category-label}\marg{true-part}\marg{false-part} \end{definition} Alternatively, if you need to lookup the category for a particular entry: \begin{definition}[\DescribeMacro\glsifregular] \cs{glsifregular}\marg{entry-label}\marg{true-part}\marg{false-part} \end{definition} Note that if the \catattr{regular} attribute hasn't be set, the above do \meta{false-part}. There are also reverse commands that test if the \catattr{regular} attribute has been set to \qt{false}: \begin{definition}[\DescribeMacro\glsifnotregularcategory] \cs{glsifnotregularcategory}\marg{category-label}\marg{true-part}\marg{false-part} \end{definition} or for a particular entry: \begin{definition}[\DescribeMacro\glsifnotregular] \cs{glsifnotregular}\marg{entry-label}\marg{true-part}\marg{false-part} \end{definition} Again, if the \catattr{regular} attribute hasn't been set, the above do \meta{false-part}, so these reverse commands aren't logically opposite in the strict sense. You can iterate through all entries with a given category using: \begin{definition} \cs{glsforeachincategory}\oarg{glossary-labels}\marg{category-label} \marg{glossary-cs}\marg{label-cs}\marg{body} \end{definition} This iterates through all entries in the glossaries identified by the comma-separated list \meta{glossary-labels} that have the category given by \meta{category-label} and performs \meta{body} for each match. Within \meta{body}, you can use \meta{glossary-cs} and \meta{label-cs} (which much be control sequences) to access the current glossary and entry label. If \meta{glossary-labels} is omitted, all glossaries are assumed. Similarly, you can iterate through all entries that have a category with a given attribute using: \begin{definition}[\DescribeMacro\glsforeachwithattribute] \cs{glsforeachwithattribute}\oarg{glossary-labels}\marg{attribute-label} \marg{attribute-value}\marg{glossary-cs}\marg{label-cs}\marg{body} \end{definition} This will do \meta{body} for each entry that has a category with the attribute \meta{attribute-label} set to \meta{attribute-value}. The remaining arguments are as the previous command. You can change the category for a particular entry using the standard glossary field changing commands, such as \ics{glsfielddef}. Alternatively, you can use \begin{definition}[\DescribeMacro\glsxtrsetcategory] \cs{glsxtrsetcategory}\marg{entry-labels}\marg{category-label} \end{definition} This will change the category to \meta{category-label} for each entry listed in the comma-separated list \meta{entry-labels}. This command uses \ics{glsfieldxdef} so it will expand \meta{category-label} and make the change global. You can also change the category for all entries with a glossary or glossaries using: \begin{definition}[\DescribeMacro\glsxtrsetcategoryforall] \cs{glsxtrsetcategoryforall}\marg{glossary-labels}\marg{category-label} \end{definition} where \meta{glossary-labels} is a comma-separated list of glossary labels. \chapter{Entry Counting} \label{sec:entrycount} As mentioned in \sectionref{sec:entrycountmods}, \styfmt{glossaries-extra} modifies the \ics{glsenableentrycount} command to allow for the \catattr{entrycount} attribute. This means that you not only need to enable entry counting with \ics{glsenableentrycount}, but you also need to set the appropriate attribute (see \sectionref{sec:categories}). \begin{important} Remember that entry counting only counts the number of times an entry is used by commands that change the \gls{firstuseflag}. (That is, all those commands that mark the entry as having been used.) There are many commands that don't modify this flag and they won't contribute to the entry use count. \end{important} With \styfmt{glossaries-extra}, you may use \ics{cgls} instead of \ics{gls} even if you haven't enabled entry counting. You will only get a warning if you use \cs{glsenableentrycount} without setting the \catattr{entrycount} attribute. (With \styfmt{glossaries}, commands like \ics{cgls} will generate a warning if \cs{glsenableentrycount} hasn't been used.) The abbreviation shortcut \ics{ab} uses \cs{cgls} (see \sectionref{sec:abbrshortcuts}) unlike the acronym shortcut \ics{ac} which uses \cs{gls}. All upper case versions (not provided by \styfmt{glossaries}) are also available: \begin{definition}[\DescribeMacro\cGLS] \cs{cGLS}\oarg{options}\marg{label}\oarg{insert} \end{definition} and \begin{definition}[\DescribeMacro\cGLSpl] \cs{cGLSpl}\oarg{options}\marg{label}\oarg{insert} \end{definition} These are analogous to \cs{cgls} and \cs{cglspl} but they use \begin{definition}[\DescribeMacro\cGLSformat] \cs{cGLSformat}\marg{label}\marg{insert} \end{definition} and \begin{definition}[\DescribeMacro\cGLSplformat] \cs{cGLSplformat}\marg{label}\marg{insert} \end{definition} which convert the analogous \cs{cglsformat} and \cs{cglsplformat} to upper case. Just using \styfmt{glossaries}: \begin{verbatim} \documentclass{article} \usepackage{glossaries} \makeglossaries \glsenableentrycount \newacronym{html}{HTML}{hypertext markup language} \newacronym{xml}{XML}{extensible markup language} \begin{document} Used once: \cgls{html}. Used twice: \cgls{xml} and \cgls{xml}. \printglossaries \end{document} \end{verbatim} If you switch to \styfmt{glossaries-extra} you must set the \catattr{entrycount} attribute: \begin{verbatim} \documentclass{article} \usepackage{glossaries-extra} \makeglossaries \glsenableentrycount \glssetcategoryattribute{abbreviation}{entrycount}{1} \newabbreviation{html}{HTML}{hypertext markup language} \newabbreviation{xml}{XML}{extensible markup language} \begin{document} Used once: \cgls{html}. Used twice: \cgls{xml} and \cgls{xml}. \printglossaries \end{document} \end{verbatim} When activated with \cs{glsenableentrycount}, commands such as \ics{cgls} now use \begin{definition}[\DescribeMacro\glsxtrifcounttrigger] \cs{glsxtrifcounttrigger}\marg{label}\marg{trigger code}\marg{normal code} \end{definition} to determine if the entry trips the entry count trigger. The \meta{trigger code} uses commands like \cs{cglsformat} and unsets the \gls{firstuseflag}. The \meta{normal code} is the code that would ordinarily be performed by whatever the equivalent command is (for example, \cs{cgls} will use \cs{cglsformat} in \meta{trigger code} but the usual \cs{gls} behaviour in \meta{normal code}). The default definition is: \begin{verbatim} \newcommand*{\glsxtrifcounttrigger}[3]{% \glshasattribute{#1}{entrycount}% {% \ifnum\glsentryprevcount{#1}>\glsgetattribute{#1}{entrycount}\relax #3% \else #2% \fi }% {#3}% } \end{verbatim} This means that if an entry is assigned to a category that has the \catattr{entrycount} attribute then the \meta{trigger code} will be used if the previous count value (the number of times the entry was used on the last run) is greater than the value of the attribute. For example, to trigger normal use if the previous count value is greater than four: \begin{verbatim} \glssetcategoryattribute{abbreviation}{entrycount}{4} \end{verbatim} There is a convenient command provided to enable entry counting, set the \catattr{entrycount} attribute and redefine \ics{gls}, etc to use \ics{cgls} etc: \begin{definition}[\DescribeMacro\GlsXtrEnableEntryCounting] \cs{GlsXtrEnableEntryCounting}\marg{categories}\marg{value} \end{definition} The first argument \meta{categories} is a comma-separated list of categories. For each category, the \catattr{entrycount} attribute is set to \meta{value}. In addition, this does: \begin{verbatim} \renewcommand*{\gls}{\cgls}% \renewcommand*{\Gls}{\cGls}% \renewcommand*{\glspl}{\cglspl}% \renewcommand*{\Glspl}{\cGlspl}% \renewcommand*{\GLS}{\cGLS}% \renewcommand*{\GLSpl}{\cGLSpl}% \end{verbatim} This makes it easier to enable entry-counting on existing documents. If you use \cs{GlsXtrEnableEntryCounting} more than once, subsequent uses will just set the \catattr{entrycount} attribute for each listed category. The above example document can then become: \begin{verbatim} \documentclass{article} \usepackage{glossaries-extra} \makeglossaries \GlsXtrEnableEntryCounting{abbreviation}{1} \newabbreviation{html}{HTML}{hypertext markup language} \newabbreviation{xml}{XML}{extensible markup language} \begin{document} Used once: \gls{html}. Used twice: \gls{xml} and \gls{xml}. \printglossaries \end{document} \end{verbatim} The standard entry-counting function describe above counts the number of times an entry has been marked as used throughout the document. (The reset commands will reset the total back to zero.) If you prefer to count per sectional-unit, you can use \begin{definition}[\DescribeMacro\GlsXtrEnableEntryUnitCounting] \cs{GlsXtrEnableEntryUnitCounting}\marg{categories}\marg{value}\marg{counter-name} \end{definition} where \meta{categories} is a comma-separated list of categories to which this feature should be applied, \meta{value} is the trigger value and \meta{counter-name} is the name of the counter used by the sectional unit. \begin{important} Due to the asynchronous nature of \TeX's output routine, discrepancies will occur in page spanning paragraphs if you use the \ctr{page} counter. \end{important} Note that you can't use both the document-wide counting and the per-unit counting in the same document. The counter value is used as part of a label, which means that \cs{the}\meta{counter-name} needs to be expandable. Since \sty{hyperref} also has a similar requirement and provides \cs{theH}\meta{counter-name} as an expandable alternative, \styfmt{glossaries-extra} will use \cs{theH}\meta{counter-name} if it exists otherwise it will use \cs{the}\meta{counter-name}. The per-unit counting function uses two attributes: \catattr{entrycount} (as before) and \catattr{unitcount} (the name of the counter). Both the original document-wide counting mechanism and the per-unit counting mechanism provide a command that can be used to access the current count value for this run: \begin{definition}[\DescribeMacro\glsentrycurrcount] \cs{glsentrycurrcount}\marg{label} \end{definition} and the final value from the previous run: \begin{definition}[\DescribeMacro\glsentryprevcount] \cs{glsentryprevcount}\marg{label} \end{definition} In the case of the per-unit counting, this is the final value \emph{for the current unit}. In both commands \meta{label} is the entry's label. The per-unit counting mechanism additionally provides: \begin{definition}[\DescribeMacro\glsentryprevtotalcount] \cs{glsentryprevtotalcount}\marg{label} \end{definition} which gives the sum of all the per-unit totals from the previous run for the entry given by \meta{label}, and \begin{definition}[\DescribeMacro\glsentryprevmaxcount] \cs{glsentryprevmaxcount}\marg{label} \end{definition} which gives the maximum per-unit total from the previous run. The above two commands are unavailable for the document-wide counting. Example of per-unit counting, where the unit is the chapter: \begin{verbatim} \documentclass{report} \usepackage{glossaries-extra} \GlsXtrEnableEntryUnitCounting{abbreviation}{2}{chapter} \makeglossaries \newabbreviation{html}{HTML}{hypertext markup language} \newabbreviation{css}{CSS}{cascading style sheet} \newglossaryentry{sample}{name={sample},description={sample}} \begin{document} \chapter{Sample} Used once: \gls{html}. Used three times: \gls{css} and \gls{css} and \gls{css}. Used once: \gls{sample}. \chapter{Another Sample} Used once: \gls{css}. Used twice: \gls{html} and \gls{html}. \printglossaries \end{document} \end{verbatim} In this document, the \texttt{css} entry is used three times in the first chapter. This is more than the trigger value of 2, so \verb|\gls{css}| is expanded on \gls{firstuse} with the short form used on subsequent use, and the \texttt{css} entries in that chapter are added to the glossary. In the second chapter, the \texttt{css} entry is only used once, which trips the suppression trigger, so in that chapter, the long form is used and \verb|\gls{css}| doesn't get a line added to the glossary file. The \texttt{html} is used a total of three times, but the expansion and indexing suppression trigger is tripped in both chapters because the per-unit total (1 for the first chapter and 2 for the second chapter) is less than or equal to the trigger value. The \texttt{sample} entry has only been used once, but it doesn't trip the indexing suppression because it's in the \category{general} category, which hasn't been listed in \cs{GlsXtrEnableEntryUnitCounting}. The per-unit entry counting can be used for other purposes. In the following example document the trigger value is set to zero, which means the index suppression won't be triggered, but the unit entry count is used to automatically suppress the hyperlink for commands like \ics{gls} by modifying the hook \begin{definition}[\DescribeMacro\glslinkcheckfirsthyperhook] \cs{glslinkcheckfirsthyperhook} \end{definition} which is used at the end of the macro the determines whether or not to suppress the hyperlink. \begin{verbatim} \documentclass{article} \usepackage[colorlinks]{hyperref} \usepackage{glossaries-extra} \makeglossaries \GlsXtrEnableEntryUnitCounting{general}{0}{page} \newglossaryentry{sample}{name={sample},description={an example}} \renewcommand*{\glslinkcheckfirsthyperhook}{% \ifnum\glsentrycurrcount\glslabel>0 \setkeys{glslink}{hyper=false}% \fi } \begin{document} A \gls{sample} entry. Next use: \gls{sample}. \newpage Next page: \gls{sample}. Again: \gls{sample}. \printglossaries \end{document} \end{verbatim} This only produces a hyperlink for the first instance of \verb|\gls{sample}| on each page. The earlier warning about using the \ctr{page} counter still applies. If the first instance of \cs{gls} occurs at the top of the page within a paragraph that started on the previous page, then the count will continue from the previous page. \chapter{Auto-Indexing} \label{sec:autoindex} It's possible that you may also want a normal index as well as the glossary, and you may want entries to automatically be added to the index (as in this document). There are two attributes that govern this: \catattr{indexname} and \catattr{dualindex}. \begin{sloppypar} The \ics{glsxtrpostnamehook} macro, used at the end of \ics{glossentryname} and \ics{Glossentryname}, checks the \catattr{indexname} attribute for the category associated with that entry. Since \cs{glossentryname} is used in the default glossary styles, this makes a convenient way of automatically indexing each entry name at its location in the glossary without fiddling around with the value of the \gloskey{name} key. \end{sloppypar} The internal macro used by the \styfmt{glossaries} package to write the information to the external glossary file is modified to check for the \catattr{dualindex} attribute. In both cases, the indexing is done through \begin{definition}[\DescribeMacro\glsxtrdoautoindexname] \cs{glsxtrdoautoindexname}\marg{label}\marg{attribute-label} \end{definition} This uses the standard \ics{index} command with the sort value taken from the entry's \gloskey{sort} key and the actual value set to \cs{glsentryname}\marg{label}. If the value of the attribute given by \meta{attribute-label} is \qt{true}, no encap will be added, otherwise the encap will be the attribute value. For example: \begin{verbatim} \glssetcategoryattribute{general}{indexname}{textbf} \end{verbatim} will set the encap to \texttt{textbf} which will display the relevant page number in bold whereas \begin{verbatim} \glssetcategoryattribute{general}{dualindex}{true} \end{verbatim} won't apply any formatting to the page number in the index. \begin{important} The location used in the index will always be the page number not the counter used in the glossary. (Unless some other loaded package has modified the definition of \cs{index} to use some thing else.) \end{important} By default the \gloskey[glslink]{format} key won't be used with the \catattr{dualindex} attribute. You can allow the \gloskey[glslink]{format} key to override the attribute value by using the preamble-only command: \begin{definition}[\DescribeMacro\GlsXtrEnableIndexFormatOverride] \cs{GlsXtrEnableIndexFormatOverride} \end{definition} If you use this command and \sty{hyperref} has been loaded, then the \env{theindex} environment will be modified to redefine \ics{glshypernumber} to allow formats that use that command. \begin{important} The \catattr{dualindex} attribute will still be used on subsequent use even if the \catattr{indexonlyfirst} attribute (or \pkgopt{indexonlyfirst} package option) is set. However, the \catattr{dualindex} attribute will honour the \gloskey[glslink]{noindex} key. \end{important} The \cs{glsxtrdoautoindexname} command will attempt to escape any of \ics{makeindex}'s special characters, but there may be special cases where it fails, so take care. This assumes the default \gls{makeindex} actual, level, quote and encap values (unless any of the commands \ics{actualchar}, \ics{levelchar}, \ics{quotechar} or \ics{encapchar} have been defined before \styfmt{glossaries-extra} is loaded). If this isn't the case, you can use the following preamble-only commands to set the correct characters. \begin{important} Be very careful of possible shifting category codes! \end{important} \begin{definition}[\DescribeMacro\GlsXtrSetActualChar] \cs{GlsXtrSetActualChar}\marg{char} \end{definition} Set the actual character to \meta{char}. \begin{definition}[\DescribeMacro\GlsXtrSetLevelChar] \cs{GlsXtrSetLevelChar}\marg{char} \end{definition} Set the level character to \meta{char}. \begin{definition}[\DescribeMacro\GlsXtrSetEscChar] \cs{GlsXtrSetEscChar}\marg{char} \end{definition} Set the escape (quote) character to \meta{char}. \begin{definition}[\DescribeMacro\GlsXtrSetEncapChar] \cs{GlsXtrSetEncapChar}\marg{char} \end{definition} Set the encap character to \meta{char}. \chapter{On-the-Fly Document Definitions} \label{sec:onthefly} \begin{important} The commands described here may superficially look like \meta{word}\cs{index}\marg{word}, but they behave rather differently. If you want to use \cs{index} then just use \cs{index}. \end{important} The \styfmt{glossaries} package advises against defining entries in the \env{document} environment. As mentioned in \sectionref{sec:pkgopts} above, this ability is disabled by default with \styfmt{glossaries-extra} but can be enabled using the \pkgopt{docdefs} package options. Although this can be problematic, the \styfmt{glossaries-extra} package provides a way of defining and using entries within the \env{document} environment without the tricks used with the \pkgopt{docdefs} option. \emph{There are limitations with this approach, so take care with it.} This function is disabled by default, but can be enabled using the preamble-only command: \begin{definition}[\DescribeMacro\GlsXtrEnableOnTheFly] \cs{GlsXtrEnableOnTheFly} \end{definition} When used, this defines the commands described below. \begin{important} The commands \cs{glsxtr}, \cs{glsxtrpl}, \cs{Glsxtr} and \cs{Glsxtrpl} can't be used after the glossaries have been displayed (through \ics{printglossary} etc). It's best not to mix these commands with the standard glossary commands, such as \cs{gls} or there may be unexpected results. \end{important} \begin{definition}[\DescribeMacro\glsxtr] \cs{glsxtr}\oarg{gls-options}\oarg{dfn-options}\marg{label} \end{definition} If an entry with the label \meta{label} has already been defined, this just does \cs{gls}\oarg{gls-options}\marg{label}. If \meta{label} hasn't been defined, this will define the entry using: \begin{alltt} \cs{newglossaryentry}\marg{label}\{name=\marg{label}, category=\cs{glsxtrcat}, description=\{\cs{nopostdesc}\}, \meta{dfn-options}\} \end{alltt} \begin{important} The \meta{label} must contain any non-expandable commands, such as formatting commands or problematic characters. If the term requires any of these, they must be omitted from the \meta{label} and placed in the \gloskey{name} key must be provided in the optional argument \meta{dfn-options}. \end{important} The second optional argument \meta{dfn-options} should be empty if the entry has already been defined, since it's too late for them. If it's not empty, a~warning will be generated with \begin{definition}[\DescribeMacro\GlsXtrWarning] \cs{GlsXtrWarning}\marg{dfn-options}\marg{label} \end{definition} For example, this warning will be generated on the second instance of \cs{glsxtr} below: \begin{verbatim} \glsxtr[][plural=geese]{goose} % ... later \glsxtr[][plural=geese]{goose} \end{verbatim} If you are considering doing something like: \begin{verbatim} \newcommand*{\goose}{\glsxtr[][plural=geese]{goose}} \renewcommand*{\GlsXtrWarning}[2]{} % ... later \goose\ some more text here \end{verbatim} then don't bother. It's simpler and less problematic to just define the entries in the preamble with \ics{newglossaryentry} and then use \cs{gls} in the document. There are plural and case-changing alternatives to \cs{glsxtr}: \begin{definition}[\DescribeMacro\glsxtrpl] \cs{glsxtrpl}\oarg{gls-options}\oarg{dfn-options}\marg{label} \end{definition} This is like \cs{glsxtr} but uses \cs{glspl} instead of \cs{gls}. \begin{definition}[\DescribeMacro\Glsxtr] \cs{Glsxtr}\oarg{gls-options}\oarg{dfn-options}\marg{label} \end{definition} This is like \cs{glsxtr} but uses \cs{Gls} instead of \cs{gls}. \begin{definition}[\DescribeMacro\Glsxtrpl] \cs{Glsxtrpl}\oarg{gls-options}\oarg{dfn-options}\marg{label} \end{definition} This is like \cs{glsxtr} but uses \cs{Glspl} instead of \cs{gls}. If you use UTF-8 and don't want the inconvenient of needing to use an ASCII-only label, then it's better to use \XeLaTeX\ or \LuaLaTeX\ instead of \LaTeX\ (or \pdfLaTeX). If you really desperately want to use UTF-8 entry labels without switching to \XeLaTeX\ or \LuaLaTeX\ then there is a starred version of \cs{GlsXtrEnableOnTheFly} that allows you to use UTF-8 characters in \meta{label}, but it's experimental and may not work in some cases. \begin{important} If you use the starred version of \cs{GlsXtrEnableOnTheFly} don't use any commands in the \meta{label}, even if they expand to just text. \end{important} \chapter{bib2gls: Managing Reference Databases} \label{sec:bib2gls} There is a new command line application under development called \gls{bib2gls}, which works in much the same way as \appfmt{bibtex}. Instead of storing all your entry definitions in a \texttt{.tex} and loading them using \cs{input} or \cs{loadglsentries}, the entries can instead be stored in a \texttt{.bib} file and \gls{bib2gls} can selectively write the appropriate commands to a \texttt{.glstex} file which is loaded using \cs{glsxtrresourcefile} (or \cs{GlsXtrLoadResources}). This means that you can use a reference managing system, such as JabRef, to maintain the database and it reduces the \TeX\ overhead by only defining the entries that are actually required in the document. If you currently have a \texttt{.tex} file that contains hundreds of definitions, but you only use a dozen or so in your document, then the build time is needlessly slowed by the unrequired definitions that occur when the file is input. Although \gls{bib2gls} isn't ready yet, there have been some new commands and options added to \styfmt{glossaries-extra} to help assist the integration of \gls{bib2gls} into the document build process. An example of the contents of \texttt{.bib} file that stores glossary entries that can be extracted with \gls{bib2gls}: \begin{verbatim} @entry{bird, name={bird}, description = {feathered animal}, see={[see also]{duck,goose}} } @entry{duck, name={duck}, description = {a waterbird with short legs} } @entry{goose, name="goose", plural="geese", description={a waterbird with a long neck} } \end{verbatim} The follow provides some abbreviations: \begin{verbatim} @string{ssi={server-side includes}} @string{html={hypertext markup language}} @abbreviation{shtml, short="shtml", long= ssi # " enabled " # html, description={a combination of \gls{html} and \gls{ssi}} } @abbreviation{html, short ="html", long = html, description={a markup language for creating web pages} } @abbreviation{ssi, short="ssi", long = ssi, description={a simple interpreted server-side scripting language} } \end{verbatim} Here are some symbols: \begin{verbatim} preamble{"\providecommand{\mtx}[1]{\boldsymbol{#1}}"} @symbol{M, name={$\mtx{M}$}, text={\mtx{M}}, description={a matrix} } @symbol{v, name={$\vec{v}$}, text={\vec{v}}, description={a vector} } @symbol{S, name={$\mathcal{S}$}, text={\mathcal{S}}, description={a set} } \end{verbatim} To ensure that \gls{bib2gls} can find out which entries have been used in the document, you need the \pkgopt{record} package. Option: \begin{verbatim} \usepackage[record]{glossaries-extra} \end{verbatim} If this option's value is omitted (as above), the normal indexing will be switched off, since \gls{bib2gls} can also sort the entries and collate the locations. If you still want to use an indexing application (for example, you need a custom \gls{xindy} rule), then just use \pkgopt[alsoindex]{record} and continue to use \cs{makeglossaries} and \cs{printglossary} (or \cs{printglossaries}), but instruct \gls{bib2gls} to omit sorting to save time. The \texttt{.glstex} file created by \cs{bib2gls} is loaded using: \begin{definition}[\DescribeMacro\glsxtrresourcefile] \cs{glsxtrresourcefile}\oarg{options}\marg{filename} \end{definition} (Don't include the file extension in \meta{filename}.) There's a shortcut version that sets \meta{filename} \cs{jobname}: \begin{definition}[\DescribeMacro\GlsXtrLoadResources] \cs{GlsXtrLoadResources}\oarg{options} \end{definition} On the first use, this command is a shortcut for \begin{alltt} \cs{glsxtrresourcefile}\oarg{options}\{\cs{jobname}\} \end{alltt} On subsequent use,\footnote{Version 1.11 only allowed one use of \cs{GlsXtrLoadResources} per document.}\ this command is a shortcut for \begin{alltt} \cs{glsxtrresourcefile}\oarg{options}\{\cs{jobname}-\meta{n}\} \end{alltt} where \meta{n} is the current value of \begin{definition} \cs{glsxtrresourcecount} \end{definition} which is incremented at the end of \cs{GlsXtrLoadResources}. Any advisory notes regarding \cs{glsxtrresourcefile} also apply to \cs{GlsXtrLoadResources}. The \cs{glsxtrresourcefile} command writes the line \begin{alltt} \cs{glsxtr@resource}\marg{options}\marg{filename} \end{alltt} to the \texttt{.aux} file and will input \meta{filename}\texttt{.glstex} if it exists.\footnote{v1.08 assumed \meta{filename}\texttt{.tex} but that's potentially dangerous if, for example, \meta{filename} happens to be the same as \cs{jobname}. The \texttt{.glstex} extension was enforced by version 1.11.} The options are ignored by \styfmt{glossaries-extra} but are picked up by \gls{bib2gls} and are used to supply various information, such as the name of the \texttt{.bib} files and any changes to the default behaviour. Since the \texttt{.glstex} won't exist on the first \LaTeX\ run, the \pkgopt{record} package option additionally switches on \pkgopt[warn]{undefaction}. Any use of commands like \cs{gls} or \cs{glstext} will produce ?? in the document, since they are undefined at this point. Once \gls{bib2gls} has created the \texttt{.glstex} file the references should be resolved. Note that as from v1.12, \cs{glsxtrresourcefile} temporarily switches the category code of \texttt{@} to 11 (letter) while it reads the file to allow for any internal commands stored in the location field. Since the \texttt{.glstex} file only defines those references used within the document and the definitions have been written in the order corresponding to \gls{bib2gls} sorted list, the glossaries can simply be displayed using \cs{printunsrtglossary} (or \cs{printunsrtglossaries}), described in \sectionref{sec:printunsrt}. Suppose the \texttt{.bib} examples shown above have been stored in the files \texttt{terms.bib}, \texttt{abbrvs.bib} and \texttt{symbols.bib} which may either be in the current directory or on \TeX's path. Then the document might look like: \begin{verbatim} \documentclass{article} \usepackage[record]{glossaries-extra} \setabbreviationstyle{long-short-desc} \GlsXtrLoadResources[src={terms,abbrvs,symbols}] \begin{document} \gls{bird} \gls{shtml} \gls{M} \printunsrtglossaries \end{document} \end{verbatim} The document build process (assuming the document is called \texttt{mydoc}) is: \begin{verbatim} pdflatex mydoc bib2gls mydoc pdflatex mydoc \end{verbatim} This creates a single glossary containing the entries: \texttt{bird}, \texttt{duck}, \texttt{goose}, \texttt{html}, \texttt{M}, \texttt{shtml} and \texttt{ssi} (in that order). The \texttt{bird}, \texttt{shtml} and \texttt{M} entries were added because \gls{bib2gls} detected (from the \texttt{.aux} file) that they had been used in the document. The other entries were added because \gls{bib2gls} detected (from the \texttt{.bib} files) that they are referenced by the used entries. In the case of \texttt{duck} and \texttt{goose}, they are in the \gloskey{see} field for \texttt{bird}. In the case of \texttt{ssi} and \texttt{html}, they are referenced in the \gloskey{description} field of \texttt{shtml}. These cross-referenced entries won't have a location list when the glossary is first displayed, but depending on how they are referenced, they may pick up a location list on the next document build. The entries can be separated into different glossaries with different sort methods: \begin{verbatim} \documentclass{article} \usepackage[record,abbreviations,symbols]{glossaries-extra} \setabbreviationstyle{long-short-desc} \GlsXtrLoadResources[src={terms},sort={en-GB},type=main] \glsxtrresourcefile [src={abbrvs},sort={letter-nocase},type=abbreviations] {\jobname-abr} \glsxtrresourcefile [src={symbols},sort={use},type={symbols}] {\jobname-sym} \begin{document} \gls{bird} \gls{shtml} \gls{M} \printunsrtglossaries \end{document} \end{verbatim} (By default, entries are sorted according to the operating system's locale. If this doesn't match the document language, you need to set this in the option list, for example \verb|sort=de-CH-1996| for Swiss German using the new orthography.) Note that \cs{glsaddall} doesn't work in this case as it has to iterate over the glossary lists, which will be empty on the first run and on subsequent runs will only contain those entries that have been selected by \gls{bib2gls}. Instead, if you want to add all entries to the glossary, you need to tell \gls{bib2gls} this in the options list: \begin{verbatim} \GlsXtrLoadResources[src={terms},selection={all}] \end{verbatim} The \gls{bib2gls} user manual will contain more detail. \chapter{Miscellaneous New Commands} \label{sec:miscnew} The \styfmt{glossaries} package provides \ics{glsrefentry} entry to cross-reference entries when used with the \pkgopt{entrycounter} or \pkgopt{subentrycounter} options. The \styfmt{glossaries-extra} package provides a supplementary command \begin{definition}[\DescribeMacro\glsxtrpageref] \cs{glsxtrpageref}\marg{label} \end{definition} that works in the same way except that it uses \ics{pageref} instead of \ics{ref}. You can copy an entry to another glossary using \begin{definition}[\DescribeMacro\glsxtrcopytoglossary] \cs{glsxtrcopytoglossary}\marg{entry-label}\marg{glossary-type} \end{definition} This appends \meta{entry-label} to the end of the internal list for the glossary given by \meta{glossary-type}. Be careful if you use the \sty{hyperref} package as this may cause duplicate hypertargets. You will need to change \cs{glolinkprefix} to another value or disable hyperlinks when you display the duplicate. Alternatively, use the new \gloskey[printglossary]{target} key to switch off the targets: \begin{verbatim} \printunsrtglossary[target=false] \end{verbatim} The \styfmt{glossaries} package allows you to set preamble code for a given glossary type using \cs{setglossarypreamble}. This overrides any previous setting. With \styfmt{glossaries-extra} (as from v1.12) you can instead append to the preamble using \begin{definition}[\DescribeMacro\apptoglossarypreamble] \cs{apptoglossarypreamble}\oarg{type}\marg{code} \end{definition} or prepend using \begin{definition}[\DescribeMacro\pretoglossarypreamble] \cs{pretoglossarypreamble}\oarg{type}\marg{code} \end{definition} \section{Entry Fields} \label{sec:fields} A field may now be used to store the name of a text-block command that takes a single argument. The field is given by \begin{definition}[\DescribeMacro\GlsXtrFmtField] \cs{GlsXtrFmtField} \end{definition} The default value is \texttt{\GlsXtrFmtField}. Note that the value must be the control sequence name \emph{without the initial backslash}. For example: \begin{verbatim} \newcommand*{\mtx}[1]{\boldsymbol{#1}} \newcommand*{\mtxinv}[1]{\mtx{#1}\sp{-1}} \newglossaryentry{matrix}{% name={matrix}, symbol={\ensuremath{\mtx{M}}}, plural={matrices}, user1={mtx}, description={rectangular array of values} } \newglossaryentry{identitymatrix}{% name={identity matrix}, symbol={\ensuremath{\mtx{I}}}, plural={identity matrices}, description={a diagonal matrix with all diagonal elements equal to 1 and all other elements equal to 0} } \newglossaryentry{matrixinv}{% name={matrix inverse}, symbol={\ensuremath{\mtxinv{M}}}, user1={mtxinv}, description={a square \gls{matrix} such that $\mtx{M}\mtxinv{M}=\glssymbol{identitymatrix}$} } \end{verbatim} There are two commands provided that allow you to apply the command to an argument: \begin{definition}[\DescribeMacro\glsxtrfmt] \cs{glsxtrfmt}\oarg{options}\marg{label}\marg{text} \end{definition} This effectively does \begin{alltt} \cs{glslink}\oarg{options}\marg{label}\marg{\meta{cs}\marg{text}} \end{alltt} where \meta{cs} is the command obtained from the control sequence name supplied in the provided field. If the field hasn't been set, \cs{glsxtrfmt} will simply do \meta{text}. The default \meta{options} are given by \begin{definition}[\DescribeMacro\GlsXtrFmtDefaultOptions] \cs{GlsXtrFmtDefaultOptions} \end{definition} This is defined as \texttt{\GlsXtrFmtDefaultOptions} but may be redefined as appropriate. Note that the replacement text of \cs{GlsXtrFmtDefaultOptions} is prepended to the optional argument of \cs{glslink}. For example: \begin{verbatim} \[ \glsxtrfmt{matrix}{A} \glsxtrfmt{matrixinv}{A} = \glssymbol{identitymatrix} \] \end{verbatim} If the default options are set to \texttt{noindex} then \cs{glsxtrfmt} won't index, but will create a hyperlink (if \sty{hyperref} has been loaded). This can be changed so that it also suppresses the hyperlink: \begin{verbatim} \renewcommand{\GlsXtrFmtDefaultOptions}{hyper=false,noindex} \end{verbatim} Note that \cs{glsxtrfmt} won't work with PDF bookmarks. Instead you can use \begin{definition}[\DescribeMacro\glsxtrentryfmt] \cs{glsxtrentryfmt}\marg{label}\marg{text} \end{definition} This uses \cs{texorpdfstring} and will simply expand to \meta{text} within the PDF bookmarks, but in the document it will do \meta{cs}\marg{text} if a control sequence name has been provided or just \meta{text} otherwise. The \styfmt{glossaries} package provides \cs{glsaddstoragekey} to add new keys. This command will cause an error if the key has already been defined. The \styfmt{glossaries-extra} package provides a supplementary command that will only define the key if it doesn't already exist: \begin{definition}[\DescribeMacro\glsxtrprovidestoragekey] \cs{glsxtrprovidestoragekey}\marg{key}\marg{default}\marg{cs} \end{definition} If the key has already been defined, it will still provide the command given in the third argument \meta{cs} (if it hasn't already been defined). Unlike \cs{glsaddstoragekey}, \meta{cs} may be left empty if you're happy to just use \cs{glsfieldfetch} to fetch the value of this new key. You can test if a key has been provided with: \begin{definition}[\DescribeMacro\glsxtrifkeydefined] \cs{glsxtrifkeydefined}\marg{key}\marg{true}\marg{false} \end{definition} This tests if \meta{key} is available for use in the \meta{key}=\value{value} list in the second argument of \cs{newglossaryentry} (or the optional argument of commands like \cs{newabbreviation}). The corresponding field may not have been set for any of the entries if no default was provided. There are now commands provided to set individual fields. Note that these only change the specified field, not any related fields. For example, changing the value of the \gloskey{text} field won't update the \gloskey{plural} field. \begin{definition}[\DescribeMacro\GlsXtrSetField] \cs{GlsXtrSetField}\marg{label}\marg{field}\marg{value} \end{definition} Sets the field given by \meta{field} to \meta{value} for the entry given by \meta{label}. No expansion is performed. It's not necessary for the field to have been defined as a key. You can access the value later with \cs{glsxtrusefield}. Note that \cs{glsxtrifkeydefined} only tests if a key has been defined for use with commands like \cs{newglossaryentry}. If a field without a corresponding key is assigned a value, the key remains undefined. This command is robust. \cs{GlsXtrSetField} uses \begin{definition}[\DescribeMacro\glsxtrsetfieldifexists] \cs{glsxtrsetfieldifexists}\marg{label}\marg{field}\marg{code} \end{definition} where \meta{label} is the entry label and \meta{code} is the assignment code. This command just uses \ics{glsdoifexists}\marg{label}\marg{code} (ignoring the \meta{field} argument), so by default it causes an error if the entry doesn't exist. This can be changed to a warning with \pkgopt[warn]{undefaction}. You can redefine \cs{glsxtrsetfieldifexists} to simply do \meta{code} if you want to skip the existence check. Alternatively you can instead use \begin{definition}[\DescribeMacro\glsxtrdeffield] \cs{glsxtrdeffield}\marg{label}\marg{field}\meta{arguments}\marg{replacement text} \end{definition} This simply uses \sty{etoolbox}'s \cs{csdef} without any checks. This command isn't robust. There is also a version that uses \cs{csedef} instead: \begin{definition}[\DescribeMacro\glsxtredeffield] \cs{glsxtredeffield}\marg{label}\marg{field}\meta{arguments}\marg{replacement text} \end{definition} \begin{definition}[\DescribeMacro\gGlsXtrSetField] \cs{gGlsXtrSetField}\marg{label}\marg{field}\marg{value} \end{definition} As \cs{GlsXtrSetField} but globally. \begin{definition}[\DescribeMacro\eGlsXtrSetField] \cs{eGlsXtrSetField}\marg{label}\marg{field}\marg{value} \end{definition} As \cs{GlsXtrSetField} but uses protected expansion. \begin{definition}[\DescribeMacro\xGlsXtrSetField] \cs{xGlsXtrSetField}\marg{label}\marg{field}\marg{value} \end{definition} As \cs{gGlsXtrSetField} but uses protected expansion. \begin{definition}[\DescribeMacro\GlsXtrLetField] \cs{GlsXtrLetField}\marg{label}\marg{field}\marg{cs} \end{definition} Sets the field given by \meta{field} to the replacement text of \meta{cs} for the entry given by \meta{label} (using \cs{let}). \begin{definition}[\DescribeMacro\csGlsXtrLetField] \cs{csGlsXtrLetField}\marg{label}\marg{field}\marg{cs name} \end{definition} As \cs{GlsXtrLetField} but the control sequence name is supplied instead. \begin{definition}[\DescribeMacro\GlsXtrLetFieldToField] \cs{GlsXtrLetFieldToField}\marg{label-1}\marg{field-1}\marg{label-2}\marg{field-2} \end{definition} Sets the field given by \meta{field-1} for the entry given by \meta{label-1} to the field given by \meta{field-2} for the entry given by \meta{label-2}. There's no check for the existence of \meta{label-2}, but \cs{glsxtrsetfieldifexists}\marg{label-1}\marg{field-1}\marg{code} is still used, as for \cs{GlsXtrSetField}. The \styfmt{glossaries} package provides \ics{glsfieldfetch} which can be used to fetch the value of the given field and store it in a control sequence. The \styfmt{glossaries-extra} package provides another way of accessing the field value: \begin{definition}[\DescribeMacro\glsxtrusefield] \cs{glsxtrusefield}\marg{entry-label}\marg{field-label} \end{definition} This works in the same way as commands like \cs{glsentrytext} but the field label is specified in the first argument. Note that the \meta{field-label} corresponds to the internal field tag, which isn't always the same as the key name. See Table~4.1 of the \sty{glossaries} manual. No error occurs if the entry or field haven't been defined. This command is not robust. There is also a version that converts the first letter to uppercase (analogous to \cs{Glsentrytext}): \begin{definition}[\DescribeMacro\Glsxtrusefield] \cs{Glsxtrusefield}\marg{entry-label}\marg{field-label} \end{definition} If you want to use a field to store a list that can be used as an \sty{etoolbox} internal list, you can use the following command that adds an item to the field using \sty{etoolbox}'s \cs{listcsadd}: \begin{definition}[\DescribeMacro\glsxtrfieldlistadd] \cs{glsxtrfieldlistadd}\marg{label}\marg{field}\marg{item} \end{definition} where \meta{label} is the entry's label, \meta{field} is the entry's field and \meta{item} is the item to add. There are analogous commands that use \cs{listgadd}, \cs{listeadd} and \cs{listxadd}: \begin{definition}[\DescribeMacro\glsxtrfieldlistgadd] \cs{glsxtrfieldlistgadd}\marg{label}\marg{field}\marg{item} \end{definition} \begin{definition}[\DescribeMacro\glsxtrfieldlisteadd] \cs{glsxtrfieldlisteadd}\marg{label}\marg{field}\marg{item} \end{definition} \begin{definition}[\DescribeMacro\glsxtrfieldlistxadd] \cs{glsxtrfieldlistxadd}\marg{label}\marg{field}\marg{item} \end{definition} You can then iterate over the list using: \begin{definition}[\DescribeMacro\glsxtrfielddolistloop] \cs{glsxtrfielddolistloop}\marg{label}\marg{field} \end{definition} or \begin{definition}[\DescribeMacro\glsxtrfieldforlistloop] \cs{glsxtrfieldforlistloop}\marg{label}\marg{field}\marg{handler} \end{definition} that internally use \cs{dolistcsloop} and \cs{forlistloop}, respectively. There are also commands that use \cs{ifinlistcs}: \begin{definition}[\DescribeMacro\glsxtrfieldifinlist] \cs{glsxtrfieldifinlist}\marg{label}\marg{field}\marg{item}\marg{true}\marg{false} \end{definition} and \cs{xifinlistcs} \begin{definition}[\DescribeMacro\glsxtrfieldxifinlist] \cs{glsxtrfieldxifinlist}\marg{label}\marg{field}\marg{item}\marg{true}\marg{false} \end{definition} See the \sty{etoolbox}'s user manual for further details of these commands, in particular the limitations of \cs{ifinlist}. When using the \pkgopt{record} option, in addition to recording the usual location, you can also record the current value of another counter at the same time using the preamble-only command: \begin{definition}[\DescribeMacro\GlsXtrRecordCounter] \cs{GlsXtrRecordCounter}\marg{counter name} \end{definition} For example: \begin{verbatim} \usepackage[record]{glossaries-extra} \GlsXtrRecordCounter{section} \end{verbatim} Each time an entry is referenced with commands like \cs{gls} or \cs{glstext}, the \texttt{.aux} file will not only contain the \cs{glsxtr@record} command but also \begin{alltt} \cs{glsxtr@counterrecord}\marg{label}\{section\}\marg{n} \end{alltt} where \meta{n} is the current expansion of \cs{thesection} and \meta{label} is the entry's label. On the next run, when the \texttt{.aux} file is run, this command will do \begin{alltt} \cs{glsxtrfieldlistgadd}\marg{label}\{record.\meta{counter}\}\marg{n} \end{alltt} In the above example, if \verb|\gls{bird}| is used in section~1.2 this would be \begin{verbatim} \glsxtrfieldlistgadd{bird}{record.section}{1.2} \end{verbatim} Note that there's no key corresponding to this new \texttt{record.section} field, but its value can be accessed with \cs{glsxtrfielduse} or the list can be iterated over with \cs{glsxtrfielddolistloop} etc. \section{Display All Entries Without Sorting or Indexing} \label{sec:printunsrt} \begin{definition}[\DescribeMacro\printunsrtglossary] \cs{printunsrtglossary}\oarg{options} \end{definition} This behaves like \cs{printnoidxglossary} but never sorts the entries and always lists all the defined entries for the given glossary (and doesn't require \cs{makenoidxglossaries}). There's also a starred form \begin{definition}[\DescribeMacro\printunsrtglossary*] \cs{printunsrtglossary}*\oarg{options}\marg{code} \end{definition} which is equivalent to \begin{alltt} \cs{begingroup} \meta{code}\cs{printunsrtglossary}\oarg{options}\% \cs{endgroup} \end{alltt} Note that unlike \cs{glossarypreamble}, the supplied \meta{code} is done before the glossary header. This means you now have the option to simply list all entries on the first \LaTeX\ run without the need for a post-processor, however there will be no \gls{numberlist} in this case, as that has to be set by a post-processor such as \gls{bib2gls} (see \sectionref{sec:bib2gls}). For example: \begin{verbatim} \documentclass{article} \usepackage{glossaries-extra} \newglossaryentry{zebra}{name={zebra},description={stripy animal}} \newglossaryentry{ant}{name={ant},description={an insect}} \begin{document} \gls{ant} and \gls{zebra} \printunsrtglossaries \end{document} \end{verbatim} In the above, zebra will be listed before ant as it was defined first. If you allow document definitions with the \pkgopt{docdefs} option, the document will require a second \LaTeX\ run if the entries are defined after \cs{printunsrtglossary}. The optional argument is as for \cs{printnoidxglossary} (except for the \gloskey[printnoidxglossary]{sort} key, which isn't available). All glossaries may be displayed in the order of their definition using: \begin{definition}[\DescribeMacro\printunsrtglossaries] \cs{printunsrtglossaries} \end{definition} which is analogous to \cs{printnoidxglossaries}. This just iterates over all defined glossaries (that aren't on the ignored list) and does \cs{printunsrtglossary}[type=\meta{type}]. The \cs{printunsrtglossary} command internally uses \begin{definition}[\DescribeMacro\printunsrtglossaryhandler] \cs{printunsrtglossaryhandler}\marg{label} \end{definition} for each item in the list, where \meta{label} is the current label. By default this just does \begin{definition}[\DescribeMacro\glsxtrunsrtdo] \cs{glsxtrunsrtdo}\marg{label} \end{definition} which determines whether to use \cs{glossentry} or \cs{subglossentry} and checks the \gloskey{location} and \gloskey{loclist} fields for the \gls{numberlist}. You can redefine the handler if required. \begin{important} If you redefine the handler to exclude entries, you may end up with an empty glossary. This could cause a problem for the list-based styles. \end{important} For example, if the preamble includes: \begin{verbatim} \usepackage[record,style=index]{glossaries-extra} \GlsXtrRecordCounter{section} \end{verbatim} then you can print the glossary but first redefine the handler to only select entries that include the current section number in the \texttt{record.section} field: \begin{verbatim} \renewcommand{\printunsrtglossaryhandler}[1]{% \glsxtrfieldxifinlist{#1}{record.section}{\thesection} {\glsxtrunsrtdo{#1}}% {}% } \end{verbatim} Alternatively you can use the starred form of \cs{printunsrtglossary} which will localise the change: \begin{verbatim} \printunsrtglossary*{% \renewcommand{\printunsrtglossaryhandler}[1]{% \glsxtrfieldxifinlist{#1}{record.section}{\thesection} {\glsxtrunsrtdo{#1}}% {}% }% } \end{verbatim} If you are using the \sty{hyperref} package and want to display the same glossary more than once, you can also add a temporary redefinition of \cs{glolinkprefix} to avoid duplicate hypertarget names. For example: \begin{verbatim} \printunsrtglossary*{% \renewcommand{\printunsrtglossaryhandler}[1]{% \glsxtrfieldxifinlist{#1}{record.section}{\thesection} {\glsxtrunsrtdo{#1}}% {}% }% \ifcsundef{theHsection}% {% \renewcommand*{\glolinkprefix}{record.#2.\csuse{thesection}.}% }% {% \renewcommand*{\glolinkprefix}{record.#2.\csuse{theHsection}.}% }% } \end{verbatim} If it's a short summary at the start of a section, you might also want to suppress the glossary header and add some vertical space afterwards: \begin{verbatim} \printunsrtglossary*{% \renewcommand{\printunsrtglossaryhandler}[1]{% \glsxtrfieldxifinlist{#1}{record.section}{\thesection} {\glsxtrunsrtdo{#1}}% {}% }% \ifcsundef{theHsection}% {% \renewcommand*{\glolinkprefix}{record.#2.\csuse{thesection}.}% }% {% \renewcommand*{\glolinkprefix}{record.#2.\csuse{theHsection}.}% }% \renewcommand*{\glossarysection}[2][]{}% \appto\glossarypostamble{\glspar\medskip\glspar}% } \end{verbatim} There's a shortcut command that does this: \begin{definition}[\DescribeMacro\printunsrtglossaryunit] \cs{printunsrtglossaryunit}\oarg{options}\marg{counter name} \end{definition} The above example can simply be replaced with: \begin{verbatim} \printunsrtglossaryunit{section} \end{verbatim} This shortcut command is actually defined to use \cs{printunsrtglossary*} with \begin{definition}[\DescribeMacro\printunsrtglossaryunitsetup] \cs{printunsrtglossaryunitsetup}\marg{counter name} \end{definition} so if you want to just make some minor modifications you can do \begin{verbatim} \printunsrtglossary*{\printunsrtglossaryunitsetup{section}% \renewcommand*{\glossarysection}[2][]{\subsection*{Summary}}% } \end{verbatim} which will start the list with a subsection header with the title \qt{Summary} (overriding the glossary's title). Note that this shortcut command is only available with the \pkgopt{record} (or \pkgopt[alsoindex]{record}) package option. This temporary change in the hypertarget prefix means you need to explicitly use \cs{hyperlink} to create a link to it as commands like \cs{gls} will try to link to the target created with the default definition of \cs{gloslinkprefix}. This isn't a problem if you want a primary glossary of all terms produced using just \cs{printunsrtglossary} (in the front or back matter) which can be the target for all glossary references and then just use \cs{printunsrtglossaryunit} for a quick summary at the start of a section etc. \section{Entry Aliases} \label{sec:alias} An entry can be made an alias of another entry using the \gloskey{alias} key. The value should be the label of the other term. There's no check for the other's existence when the aliased entry is defined. This is to allow the possibility of defining the other entry after the aliased entry. (For example, when used with \gls{bib2gls}.) If an entry \meta{entry-1} is made an alias of \meta{entry-2} then: \begin{itemize} \item If the \gloskey{see} field wasn't provided when \meta{entry-1} was defined, the \gloskey{alias} key will automatically trigger \begin{alltt} \cs{glssee}\marg{entry-1}\marg{entry-2} \end{alltt} \item If the \sty{hyperref} package has been loaded then \cs{gls}\marg{entry-1} will link to \meta{entry-2}'s target. (Unless the \catattr{targeturl} attribute has been set for \meta{entry-1}'s category.) \item The \gloskey[glslink]{noindex} setting will automatically be triggered when referencing \meta{entry-1} with commands like \cs{gls} or \cs{glstext}. This prevents \meta{entry-1} from have a \gls{locationlist} (aside from the cross-reference added with \cs{glssee}) unless it's been explicitly indexed with \cs{glsadd} or if the indexing has been explicitly set using \texttt{noindex=false}. \end{itemize} The index suppression trigger is performed by \begin{definition}[\DescribeMacro\glsxtrsetaliasnoindex] \cs{glsxtrsetaliasnoindex} \end{definition} This is performed after the default options provided by \ics{GlsXtrSetDefaultGlsOpts} have been set. Within the definition of \cs{glsxtrsetaliasnoindex} you can use \begin{definition}[\DescribeMacro\glsxtrindexaliased] \cs{glsxtrindexaliased} \end{definition} to index \meta{entry-2}. The index suppression command can be redefined to index the main term instead. For example: \begin{verbatim} \renewcommand{\glsxtrsetaliasnoindex}{% \glsxtrindexaliased \setkeys{glslink}{noindex}% } \end{verbatim} The value of the \gloskey{alias} field can be accessed using \begin{definition}[\DescribeMacro\glsxtralias] \cs{glsxtralias}\marg{label} \end{definition} \chapter{Supplemental Packages} \label{sec:supplemental} The \styfmt{glossaries} bundle provides additional support packages \sty{glossaries-prefix} (for prefixing) and \sty{glossaries-accsupp} (for accessibility support). These packages aren't automatically loaded. \section{Prefixes or Determiners} \label{sec:prefix} If prefixing is required, you can simply load \sty{glossaries-prefix} after \styfmt{glossaries-extra}. For example: \begin{verbatim} \documentclass{article} \usepackage{glossaries-extra} \usepackage{glossaries-prefix} \makeglossaries \newabbreviation [prefix={an\space}, prefixfirst={a~}] {svm}{SVM}{support vector machine} \begin{document} First use: \pgls{svm}. Next use: \pgls{svm}. \printglossaries \end{document} \end{verbatim} \section{Accessibility Support} \label{sec:accsupp} The \sty{glossaries-accsupp} needs to be loaded before \styfmt{glossaries-extra} or through the \pkgopt{accsupp} package option: \begin{verbatim} \usepackage[accsupp]{glossaries-extra} \end{verbatim} If you don't load \sty{glossaries-accsupp} or you load \sty{glossaries-accsupp} after \styfmt{glossaries-extra} the new \cs{glsaccess}\meta{xxx} commands described below will simply be equivalent to the corresponding \cs{glsentry}\meta{xxx} commands. The following \cs{glsaccess}\meta{xxx} commands add accessibility information wrapped around the corresponding \cs{glsentry}\meta{xxx} commands. There is no check for existence of the entry nor do any of these commands add formatting, hyperlinks or indexing information. \begin{definition}[\DescribeMacro\glsaccessname] \cs{glsaccessname}\marg{label} \end{definition} This displays the value of the \gloskey{name} field for the entry identified by \meta{label}. If the \sty{glossaries-accsupp} package isn't loaded, this is simply defined as: \begin{verbatim} \newcommand*{\glsaccessname}[1]{\glsentryname{#1}} \end{verbatim} otherwise it's defined as: \begin{verbatim} \newcommand*{\glsaccessname}[1]{% \glsnameaccessdisplay {% \glsentryname{#1}% }% {#1}% } \end{verbatim} (\ics{glsnameaccessdisplay} is defined by the \sty{glossaries-accsupp} package.) The first letter upper case version is: \begin{definition}[\DescribeMacro\Glsaccessname] \cs{Glsaccessname}\marg{label} \end{definition} Without the \sty{glossaries-accsupp} package this is just defined as: \begin{verbatim} \newcommand*{\Glsaccessname}[1]{\Glsentryname{#1}} \end{verbatim} With the \sty{glossaries-accsupp} package this is defined as: \begin{verbatim} \newcommand*{\Glsaccessname}[1]{% \glsnameaccessdisplay {% \Glsentryname{#1}% }% {#1}% } \end{verbatim} The following commands are all defined in an analogous manner. \begin{definition}[\DescribeMacro\glsaccesstext] \cs{glsaccesstext}\marg{label} \end{definition} This displays the value of the \gloskey{text} field. \begin{definition}[\DescribeMacro\Glsaccesstext] \cs{Glsaccesstext}\marg{label} \end{definition} This displays the value of the \gloskey{text} field with the first letter converted to upper case. \begin{definition}[\DescribeMacro\glsaccessplural] \cs{glsaccessplural}\marg{label} \end{definition} This displays the value of the \gloskey{plural} field. \begin{definition}[\DescribeMacro\Glsaccessplural] \cs{Glsaccessplural}\marg{label} \end{definition} This displays the value of the \gloskey{plural} field with the first letter converted to upper case. \begin{definition}[\DescribeMacro\glsaccessfirst] \cs{glsaccessfirst}\marg{label} \end{definition} This displays the value of the \gloskey{first} field. \begin{definition}[\DescribeMacro\Glsaccessfirst] \cs{Glsaccessfirst}\marg{label} \end{definition} This displays the value of the \gloskey{first} field with the first letter converted to upper case. \begin{definition}[\DescribeMacro\glsaccessfirstplural] \cs{glsaccessfirstplural}\marg{label} \end{definition} This displays the value of the \gloskey{firstplural} field. \begin{definition}[\DescribeMacro\Glsaccessfirstplural] \cs{Glsaccessfirstplural}\marg{label} \end{definition} This displays the value of the \gloskey{firstplural} field with the first letter converted to upper case. \begin{definition}[\DescribeMacro\glsaccesssymbol] \cs{glsaccesssymbol}\marg{label} \end{definition} This displays the value of the \gloskey{symbol} field. \begin{definition}[\DescribeMacro\Glsaccesssymbol] \cs{Glsaccesssymbol}\marg{label} \end{definition} This displays the value of the \gloskey{symbol} field with the first letter converted to upper case. \begin{definition}[\DescribeMacro\glsaccesssymbolplural] \cs{glsaccesssymbolplural}\marg{label} \end{definition} This displays the value of the \gloskey{symbolplural} field. \begin{definition}[\DescribeMacro\Glsaccesssymbolplural] \cs{Glsaccesssymbolplural}\marg{label} \end{definition} This displays the value of the \gloskey{symbolplural} field with the first letter converted to upper case. \begin{definition}[\DescribeMacro\glsaccessdesc] \cs{glsaccessdesc}\marg{label} \end{definition} This displays the value of the \gloskey{desc} field. \begin{definition}[\DescribeMacro\Glsaccessdesc] \cs{Glsaccessdesc}\marg{label} \end{definition} This displays the value of the \gloskey{desc} field with the first letter converted to upper case. \begin{definition}[\DescribeMacro\glsaccessdescplural] \cs{glsaccessdescplural}\marg{label} \end{definition} This displays the value of the \gloskey{descplural} field. \begin{definition}[\DescribeMacro\Glsaccessdescplural] \cs{Glsaccessdescplural}\marg{label} \end{definition} This displays the value of the \gloskey{descplural} field with the first letter converted to upper case. \begin{definition}[\DescribeMacro\glsaccessshort] \cs{glsaccessshort}\marg{label} \end{definition} This displays the value of the \gloskey{short} field. \begin{definition}[\DescribeMacro\Glsaccessshort] \cs{Glsaccessshort}\marg{label} \end{definition} This displays the value of the \gloskey{short} field with the first letter converted to upper case. \begin{definition}[\DescribeMacro\glsaccessshortpl] \cs{glsaccessshortpl}\marg{label} \end{definition} This displays the value of the \gloskey{shortplural} field. \begin{definition}[\DescribeMacro\Glsaccessshortpl] \cs{Glsaccessshortpl}\marg{label} \end{definition} This displays the value of the \gloskey{shortplural} field with the first letter converted to upper case. \begin{definition}[\DescribeMacro\glsaccesslong] \cs{glsaccesslong}\marg{label} \end{definition} This displays the value of the \gloskey{long} field. \begin{definition}[\DescribeMacro\Glsaccesslong] \cs{Glsaccesslong}\marg{label} \end{definition} This displays the value of the \gloskey{long} field with the first letter converted to upper case. \begin{definition}[\DescribeMacro\glsaccesslongpl] \cs{glsaccesslongpl}\marg{label} \end{definition} This displays the value of the \gloskey{longplural} field. \begin{definition}[\DescribeMacro\Glsaccesslongpl] \cs{Glsaccesslongpl}\marg{label} \end{definition} This displays the value of the \gloskey{longplural} field with the first letter converted to upper case. \chapter{Sample Files} \label{sec:samples} The following sample files are provided with this package: \begin{description} \item[sample.tex] Simple sample file that uses one of the dummy files provided by the \styfmt{glossaries} package for testing. \item[sample-mixture.tex] General entries, acronyms and initialisms all treated differently. \item[sample-name-font] Categories and attributes are used to customize the way different entries appear. \item[sample-abbrv.tex] General abbreviations. \item[sample-acronym.tex] Acronyms aren't initialisms and don't expand on \gls{firstuse}. \item[sample-acronym-desc.tex] Acronyms that have a separate long form and description. \item[sample-crossref.tex] Unused entries that have been cross-referenced automatically are added at the end of the document. \item[sample-indexhook.tex] Use the index hook to track which entries have been indexed (and therefore find out which ones haven't been indexed). \item[sample-footnote.tex] Footnote abbreviation style that moves the footnote marker outside of the hyperlink generated by \cs{gls} and moves it after certain punctuation characters for neatness. \item[sample-undef.tex] Warn on undefined entries instead of generating an error. \item[sample-mixed-abbrv-styles.tex] Different abbreviation styles for different entries. \item[sample-initialisms.tex] Automatically insert dots into initialisms. \item[sample-postdot.tex] Another initialisms example. \item[sample-postlink.tex] Automatically inserting text after the \gls{linktext} produced by commands like \cs{gls} (outside of hyperlink, if present). \item[sample-header.tex] Using entries in section/chapter headings. \item[sample-autoindex.tex] Using the \catattr{dualindex} and \catattr{indexname} attributes to automatically add glossary entries to the index (in addition to the glossary \gls{locationlist}). \item[sample-autoindex-hyp.tex] As previous but uses \sty{hyperref}. \item[sample-nested.tex] Using \ics{gls} within the value of the \gloskey{name} key. \item[sample-entrycount.tex] Enable entry-use counting (only index if used more than $n$ times). \item[sample-unitentrycount.tex] Enable use of per-unit entry-use counting. \item[sample-pages.tex] Insert \qt{page} or \qt{pages} before the location list. \item[sample-onelink.tex] Using the per-unit entry counting to only have one hyperlink per entry per page. \item[sample-altmodifier.tex] Set the default options for commands like \cs{gls} and add an alternative modifier. \item[sample-mixedsort.tex] Uses the optional argument of \cs{makeglossaries} to allow a mixture of \cs{printglossary} and \cs{printnoidxglossary}. \item[sample-external.tex] Uses the \catattr{targeturl} attribute to allow for entries that should link to an external URL rather than to an internal glossary. \item[sample-fmt.tex] Provides text-block commands associated with entries in order to use \cs{glsxtrfmt}. \item[sample-alias.tex] Uses the \gloskey{alias} key. (See \sectionref{sec:alias}.) \item[sample-alttree.tex] Uses the \sty{glossaries-extra-stylemods} package with the \glostyle{alttree} style (see \sectionref{sec:stylemods}). \item[sample-alttree-sym.tex] Another \glostyle{alttree} example that measures the symbol widths. \item[sample-alttree-marginpar.tex] Another \glostyle{alttree} example that puts the \gls{numberlist} in the margin. \item[sample-onthefly.tex] Using on-the-fly commands. Terms with accents must have the \gloskey{name} key explicitly set. \item[sample-onthefly-xetex.tex] Using on-the-fly commands with \XeLaTeX. Terms with UTF-8 characters don't need to have the \gloskey{name} key explicitly set. Terms that contain commands must have the \gloskey{name} key explicitly set with the commands removed from the label. \item[sample-onthefly-utf8.tex] Tries to emulate the previous sample file for use with \LaTeX\ through the starred version of \ics{GlsXtrEnableOnTheFly}. This is a bit iffy and may not always work. Terms that contain commands must have the \gloskey{name} key explicitly set with the commands removed from the label. \item[sample-accsupp.tex] Integrate \sty{glossaries-accsupp}. \item[sample-prefix.tex] Integrate \sty{glossaries-prefix}. \end{description} \chapter{Multi-Lingual Support} \label{sec:lang} There's only one command provided by \styfmt{glossaries-extra} that you're likely to want to change in your document and that's \ics{abbreviationsname} (\sectionref{sec:pkgopts}) if you use the \pkgopt{abbreviations} package option to automatically create the glossary labelled \texttt{abbreviations}. If this command doesn't already exist, it will be defined to \qt{Abbreviations} if \sty{babel} hasn't been loaded, otherwise it will be defined as \cs{acronymname} (provided by \styfmt{glossaries}). You can redefine it in the usual way. For example: \begin{verbatim} \renewcommand*{\abbreviationsname}{List of Abbreviations} \end{verbatim} Or using \sty{babel} or \sty{polyglossia} captions hook: \begin{verbatim} \appto\captionsenglish{% \renewcommand*{\abbreviationsname}{List of Abbreviations}% } \end{verbatim} Alternatively you can use the \gloskey[printglossary]{title} key when you print the list of abbreviations. For example: \begin{verbatim} \printabbreviations[title={List of Abbreviations}] \end{verbatim} or \begin{verbatim} \printglossary[type=abbreviations,title={List of Abbreviations}] \end{verbatim} The other fixed text commands are the diagnostic messages, which shouldn't appear in the final draft of your document. The \styfmt{glossaries-extra} package has the facility to load language modules if they exist, but won't warn if they don't. If you want to write your own language module, you just need to create a file called \texttt{glossariesxtr-}\meta{lang}\texttt{.ldf}, where \meta{lang} is the language name (see the \sty{tracklang} package). For example, \texttt{glossariesxtr-french.ldf}. The simplest code for this file is: \begin{verbatim} \ProvidesGlossariesExtraLang{french}[2015/12/09 v1.0] \newcommand*{\glossariesxtrcaptionsfrench}{% \def\abbreviationsname{Abr\'eviations}% } \glossariesxtrcaptionsfrench \ifcsdef{captions\CurrentTrackedDialect} {% \csappto{captions\CurrentTrackedDialect}% {% \glossariesxtrcaptionsfrench }% }% {% \ifcsdef{captions\CurrentTrackedLanguage} {% \csappto{captions\CurrentTrackedLanguage}% {% \glossariesxtrcaptionsfrench }% }% {% }% \glossariesxtrcaptionsfrench } \end{verbatim} You can adapt this for other languages by replacing all instances of the language identifier \texttt{french} and the translated text \verb|Abr\'eviations| as appropriate. This \texttt{.ldf} file then needs to be put somewhere on \TeX's path so that it can be found by \styfmt{glossaries-extra}. You might also want to consider uploading it to CTAN so that it can be useful to others. (Please don't send it to me. I already have more packages than I am able to maintain.) If you additionally want to provide translations for the diagnostic messages used when a glossary is missing, you need to redefine the following commands: \begin{definition}[\DescribeMacro\GlsXtrNoGlsWarningHead] \cs{GlsXtrNoGlsWarningHead}\marg{label}\marg{file} \end{definition} This produces the following text in English: \begin{quote} \GlsXtrNoGlsWarningHead{\meta{label}}{\meta{file}} \end{quote} \begin{definition}[\DescribeMacro\GlsXtrNoGlsWarningEmptyStart] \cs{GlsXtrNoGlsWarningEmptyStart} \end{definition} This produces the following text in English: \begin{quote} \GlsXtrNoGlsWarningEmptyStart \end{quote} \begin{definition}[\DescribeMacro\GlsXtrNoGlsWarningEmptyMain] \cs{GlsXtrNoGlsWarningEmptyMain} \end{definition} This produces the following text in English: \begin{quote} \GlsXtrNoGlsWarningEmptyMain \end{quote} \begin{definition}[\DescribeMacro\GlsXtrNoGlsWarningEmptyNotMain] \cs{GlsXtrNoGlsWarningEmptyNotMain}\marg{label} \end{definition} This produces the following text in English: \begin{quote} \GlsXtrNoGlsWarningEmptyNotMain{\meta{label}} \end{quote} \begin{definition}[\DescribeMacro\GlsXtrNoGlsWarningCheckFile] \cs{GlsXtrNoGlsWarningCheckFile}\marg{file} \end{definition} This produces the following text in English: \begin{quote} \GlsXtrNoGlsWarningCheckFile{\meta{file}} \end{quote} \begin{definition}[\DescribeMacro\GlsXtrNoGlsWarningMisMatch] \cs{GlsXtrNoGlsWarningMisMatch} \end{definition} This produces the following text in English: \begin{quote} \GlsXtrNoGlsWarningMisMatch \end{quote} \begin{definition}[\DescribeMacro\GlsXtrNoGlsWarningNoOut] \cs{GlsXtrNoGlsWarningNoOut}\marg{file} \end{definition} This produces the following text in English: \begin{quote} \GlsXtrNoGlsWarningNoOut{\meta{file}} \end{quote} \begin{definition}[\DescribeMacro\GlsXtrNoGlsWarningTail] \cs{GlsXtrNoGlsWarningTail} \end{definition} This produces the following text in English: \begin{quote} \GlsXtrNoGlsWarningTail \end{quote} \begin{definition}[\DescribeMacro\GlsXtrNoGlsWarningBuildInfo] \cs{GlsXtrNoGlsWarningBuildInfo} \end{definition} This is advice on how to generate the glossary files. See the documented code (\texttt{glossaries-extra-code.pdf}) for further details. \begin{definition}[\DescribeMacro\GlsXtrNoGlsWarningAutoMake] \cs{GlsXtrNoGlsWarningAutoMake}\marg{label} \end{definition} This is the message produced when the \pkgopt{automake} option is used, but the document needs a rerun or the shell escape setting doesn't permit the execution of the external application. This command also generates a warning in the transcript file. See the documented code for further details. \printglossaries \PrintIndex \end{document}