summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/glossaries/glossaries-user.tex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-02-15 03:01:17 +0000
committerNorbert Preining <norbert@preining.info>2020-02-15 03:01:17 +0000
commit6e362e815ea119b3f6db97b21c10fee3279b5c6b (patch)
tree536b6a92aa0abbc06d83b0b03850caeebf82d65e /macros/latex/contrib/glossaries/glossaries-user.tex
parentdc072b1cb0427be056e747cdbfd6b7a4f1e02e56 (diff)
CTAN sync 202002150301
Diffstat (limited to 'macros/latex/contrib/glossaries/glossaries-user.tex')
-rw-r--r--macros/latex/contrib/glossaries/glossaries-user.tex9124
1 files changed, 7638 insertions, 1486 deletions
diff --git a/macros/latex/contrib/glossaries/glossaries-user.tex b/macros/latex/contrib/glossaries/glossaries-user.tex
index 41dc516ee7..a8465c911f 100644
--- a/macros/latex/contrib/glossaries/glossaries-user.tex
+++ b/macros/latex/contrib/glossaries/glossaries-user.tex
@@ -1,12 +1,13 @@
-\documentclass[report,inlinetitle,widecs]{nlctdoc}
+\documentclass[report,inlinetitle,noprint,wbprompt,x11names]{nlctdoc}
-\usepackage[inner=0.5in,includemp]{geometry}
+\usepackage[inner=0.25in,outer=0.5in,includemp]{geometry}
\usepackage{array}
\usepackage{alltt}
\usepackage{pifont}
\usepackage{textcomp}
\usepackage{amssymb}
+\usepackage{accsupp}
\ifpdf
\usepackage{lmodern}
\usepackage{mathpazo}
@@ -17,10 +18,12 @@
\newcommand{\grimace}{{\fontencoding {U}\fontfamily{futs}\selectfont \char77}}
\providecommand{\XeLaTeX}{XeLaTeX}
\providecommand{\XeTeX}{XeTeX}
+ \providecommand{\LuaLaTeX}{LuaLaTeX}
\fi
\usepackage[colorlinks,
bookmarks,
linkcolor=blue,
+ urlcolor=Magenta4,
hyperindex=false,
pdfauthor={Nicola L.C. Talbot},
pdftitle={User Manual for glossaries.sty},
@@ -58,31 +61,157 @@
\end{ttfamily}
}
-\ifpdf
-\else
+\renewcommand{\nlctdocmainencap}{}
+
+\makeglossaries
+
+\renewcommand{\importantfmt}{}
+\renewcommand{\importantsymbolfont}[1]{\textcolor{red}{\bfseries\Huge#1}}
+
+\newcommand*{\xtrfont}[1]{\textcolor{teal}{#1}}
+
+\newcommand*{\codecomment}[1]{\emph{\rmfamily\color{gray}#1}}
+
+\makeatletter
+\@nlctdoc@if@usingtexht
+{
% Need an extra line break in the html version
% (Don't have time to fiddle with cfg files!)
\renewcommand*{\glossentry}[2]{%
\item[\glsentryitem{#1}\glstarget{#1}{\glossentryname{#1}}]\mbox{}\newline
\glossentrydesc{#1}\glspostdescription\space #2\newline}%
-\fi
+ \newcommand*{\htmldoc}[2]{\href{#2.html}{\qt{#1}}}
+ \newcommand{\glsxtrnote}{\HCode{<br/><span style="float: left; font-size: small; border: solid 2px green; margin-right: 1em; ">}\gls{glossaries-extra}\HCode{</span>}}
+ \newcommand{\bibglsnote}{\HCode{<span style="float: left; font-size: small; border: solid 2px green; margin-right: 1em;">}\gls{bib2gls}\HCode{</span>}}
+ \newenvironment{xtr}%
+ {\par
+ \HCode{<div title="glossaries-extra.sty" style="border: solid 2pt green;">}}%
+ {\HCode{</div>}\par\noindent}
+ \newenvironment{bib2gls}%
+ {\par
+ \HCode{<div title="bib2gls" style="border: solid 2pt green;">}}%
+ {\HCode{</div>}\par\noindent}
+
+ \newcommand{\commandpromptnote}{}
+ \newcommand{\maincommandpromptnote}{}
+ \newenvironment{important*}{\begin{important}\importantpar}{\end{important}}
+ \renewcommand{\S}{\HCode{&\#167;}}
+ \newcommand{\strong}[1]{\HCode{<strong>}#1\HCode{</strong>}}
+ \newcommand*{\linkanchor}[1]{\HCode{<a title="anchor" style="font-size: x-small; text-decoration: none;" href="\##1">&\#128279;</a>}}
+}
+{
+ \externaldocument{glossaries-code}
+ \renewcommand{\idxmarker}{\textsuperscript{\xtrfont{\textdagger}}}
+ \newcommand*{\htmldoc}[2]{\qt{#1}}
+ \newcommand{\glsxtrnote}{%
+ \leavevmode\marginpar{\glslink{glossaries-extra}{\xtrfont{\footnotesize\styfmt{glossaries-extra.sty}}}}%
+ }
+ \newcommand{\bibglsnote}{%
+ \leavevmode\marginpar{{\footnotesize\glslink{bib2gls}{\xtrfont{\appfmt{bib2gls}}}}}%
+ }
+ \newenvironment{xtr}[1][\glsxtrnote]%
+ {%
+ \def\xtrmarginnote{#1}%
+ \setlength{\fboxrule}{4pt}%
+ \setlength\defwidth{\linewidth}%
+ \addtolength\defwidth{-2\fboxsep}%
+ \addtolength\defwidth{-2\fboxrule}%
+ \begin{lrbox}{\defsbox}%
+ \begin{minipage}[t]{\defwidth}%
+ \setlength\parindent{1em}%
+ \noindent\ignorespaces
+ }%
+ {%
+ \end{minipage}%
+ \end{lrbox}%
+ \par\vskip10pt\noindent
+ \xtrmarginnote
+ \fcolorbox{teal}{white}{\usebox{\defsbox}}\par\vskip10pt
+ \noindent\ignorespacesafterend
+ }
+ \newenvironment{bib2gls}{\begin{xtr}[\bibglsnote]}{\end{xtr}}
+ \newcommand{\commandpromptnote}{The \texttt{\bfseries\$} symbol in the instructions
+ indicates the command prompt. It should be omitted when copying the text. }
+ \newcommand{\maincommandpromptnote}{The command prompt is indicated with
+ \texttt{\bfseries\$} in this documentation. Don't type that character when
+ copying examples. }
+
+ \def\verbatim@font{\MacroFont}
+
+ \newenvironment{important*}%
+ {%
+ \renewcommand{\importantsymbolfont}[1]{\textcolor{red}{\bfseries\huge##1}}%
+ \begin{important}\importantpar[-2][-1ex]%
+ }%
+ {\end{important}}
+ \newcommand{\strong}{\textbf}
+ \newcommand{\linkanchor}[1]{}
+}
+\renewcommand*{\@isty}[1]{\index{#1 package=\styfmt{#1}
+ package|hyperpage}}
+\renewcommand*{\s@isty}[1]{\index{#1 package=\doidxmarker\styfmt{#1}
+ package|hyperpage}}
+\renewcommand*{\@icls}[1]{\index{#1 class=\clsfmt{#1}
+ class|hyperpage}}
+\renewcommand*{\s@icls}[1]{\index{#1 class=\doidxmarker\clsfmt{#1}
+ class|hyperpage}}
-\makeglossaries
+\renewrobustcmd*{\iterm}[1]{\index{#1|hyperpage}}
+\makeatother
\renewcommand*{\main}[1]{\hyperpage{#1}}
\newcommand*{\htextbf}[1]{\textbf{\hyperpage{#1}}}
\newcommand*{\itermdef}[1]{\index{#1|htextbf}}
\newcommand{\itempar}[1]{\item[{#1}]\mbox{}\par}
+\newcommand{\Index}[1]{#1\index{#1|hyperpage}}
+
+\newcommand{\xtrpkgoptdef}[1]{\hypertarget{pkgopt:#1}{\pkgopt*{#1}}}
\newcommand{\pkgoptdef}[1]{\hypertarget{pkgopt:#1}{\pkgopt{#1}}}
+\newcommand{\deppkgoptdef}[1]{\hypertarget{pkgopt:#1}{\deprecatedpkgopt{#1}}}
+
+\newcommand{\pkgoptsec}[2][]{%
+ \pdfbookmark[2]{#2}{pkgopt.#2}
+ \ifstrempty{#1}%
+ {\subsection*{\protect\pkgoptdef{#2}}}%
+ {\subsection*{\protect\pkgoptdef{#2}\pkgoptfmt{=\protect\marg{#1}}}}%
+}
+
+\newcommand{\deppkgoptsec}[2][]{%
+ \pdfbookmark[2]{#2}{pkgopt.#2}
+ \ifstrempty{#1}%
+ {\subsection*{\protect\deppkgoptdef{#2}}}%
+ {\subsection*{\protect\deppkgoptdef{#2}\pkgoptfmt{=\marg{#1}}}}%
+}
+
+\newcommand{\xtrpkgoptsec}[2][]{%
+ \pdfbookmark[2]{#2 (glossaries-extra.sty)}{pkgopt.#2}
+ \ifstrempty{#1}%
+ {\subsection*{\protect\xtrfont{\protect\xtrpkgoptdef{#2} (glossaries-extra.sty)}}}%
+ {\subsection*{\protect\xtrfont{\protect\xtrpkgoptdef{#2}\pkgoptfmt{=\protect\marg{#1}}
+ (glossaries-extra.sty)}}}%
+}
\newcommand{\glslike}{\hyperref[sec:gls-like]{\cs{gls}-like}}
\newcommand{\glstextlike}{\hyperref[sec:glstext-like]{\cs{glstext}-like}}
+\newcommand{\gallery}[2]{\href{https://www.dickimaw-books.com/gallery/#1}{#2}}
+\newcommand{\galleryurl}[1]{\gallery{#1}{\nolinkurl{https://www.dickimaw-books.com/gallery/#1}}}
+\newcommand{\gallerytopic}[1]{\galleryurl{\##1}}
+
+\newcommand*{\bibglsgallery}[2][\gallerytitle]{%
+ \def\gallerytitle{#2}%
+ \gallery{index.php?label=bib2gls-#2}{\appfmt{bib2gls} gallery: \gallerytitle}}
+
+\newcommand*{\bibglsbegin}{%
+ \href{http://mirrors.ctan.org/support/bib2gls/bib2gls-begin.pdf}{\styfmt{glossaries-extra} and \appfmt{bib2gls}: An Introductory Guide}}
+
\IndexPrologue{\chapter*{\indexname}
\addcontentsline{toc}{chapter}{\indexname}%
- \markboth{\indexname}{\indexname}}
+ \markboth{\indexname}{\indexname}
+ \par\idxmarker Requires \gls{glossaries-extra}.
+}
\longnewglossaryentry{indexingapp}%
{
@@ -110,7 +239,7 @@
interface. That is, an application that doesn't have any windows,
buttons or menus and can be run in
\href{http://www.dickimaw-books.com/latex/novices/html/terminal.html}{a command
- prompt or terminal}.
+ prompt or terminal}. \maincommandpromptnote
}
\longnewglossaryentry{xindy}{%
@@ -120,27 +249,44 @@
}%
{%
A flexible \gls{indexingapp} with multilingual
- support written in Perl.
+ support written in Perl. See \opt3.
}
\newglossaryentry{makeindex}{%
name={\appfmt{makeindex}\index{makeindex=\appfmt{makeindex}|htextbf}},%
sort={makeindex},%
text={\appfmt{makeindex}\iapp{makeindex}},%
-description={An \gls{indexingapp}.}
+description={An \gls{indexingapp}. See \opt2.}
}
\newglossaryentry{bib2gls}{%
-name={\appfmt{bib2gls}\index{bib2gls=\appfmt{bib2gls}|htextbf}},%
+name={\appfmt{bib2gls}\index{bib2gls=\doidxmarker\appfmt{bib2gls}|htextbf}},%
sort={bib2gls},%
-text={\appfmt{bib2gls}\iapp{bib2gls}},%
+text={\appfmt{bib2gls}\iapp*{bib2gls}},%
description={An \gls{indexingapp} that combines two functions in
-one: (1) fetches entry definition from a \texttt{.bib} file
-based on information provided in the \texttt{.aux} file (similar
+one: (1) fetches entry definition from a \filetype{bib} file
+based on information provided in the \filetype{aux} file (similar
to \appfmt{bibtex}); (2) hierarchically sorts and collates location
-lists (similar to \appfmt{makeindex} and \appfmt{xindy}).
-This application is designed for use with \styfmt{glossaries-extra}
-and can't be used with just the base \styfmt{glossaries} package.}
+lists (similar to \gls{makeindex} and \gls{xindy}).
+This application is designed for use with \gls{glossaries-extra}
+and can't be used with just the base \styfmt{glossaries} package.
+See \opt4.}
+}
+
+\newglossaryentry{convertgls2bib}{%
+name={\appfmt{convertgls2bib}\index{convertgls2bib=\doidxmarker\appfmt{convertgls2bib}|htextbf}},%
+sort={convertgls2bib},%
+text={\appfmt{convertgls2bib}\iapp*{convertgls2bib}},%
+description={An application provided with \gls{bib2gls} that
+converts \filetype{tex} files containing entry definitions to
+\filetype{bib} files suitable for use with \gls{bib2gls}.
+This application is designed for files that just contain entry
+definitions, but it can work on a complete document file.
+However, there will be a lot of \qt{undefined command} warnings as
+\gls{convertgls2bib} only has a limited set of known commands. You
+can limit it so that it only parses the preamble with the
+\texttt{-{}-preamble-only} switch (requires at least \gls{bib2gls}
+v2.0).}
}
\newglossaryentry{makeglossaries}{%
@@ -162,7 +308,7 @@ text={\appfmt{makeglossaries-lite}\iapp{makeglossaries-lite}},%
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
+\gls{makeglossaries} script. If you have Perl installed, use the
Perl script instead. This script is actually distributed with the
file name \texttt{makeglossaries-lite.lua}, but \TeX~Live
(on Unix-like systems) creates a symbolic link
@@ -215,6 +361,26 @@ description={The text produced by commands such as \ics{gls}. It may
or may not be a hyperlink to the glossary.}
}
+\newglossaryentry{smallcaps}{%
+ name={Small caps\itermdef{small caps}},
+ sort={small caps},
+ text={small caps\iterm{small caps}},
+ description={Small capitals. The \LaTeX\ kernel provides
+ \ics{textsc}\marg{text} to produce small capitals. This uses a
+ font where lowercase letters have a small capital design.
+ Uppercase letters have the standard height and there's no
+ noticeable difference with uppercase characters in corresponding non-small caps fonts.
+ This means that for a small caps appearance, you need to use lowercase letters in the
+ \meta{text} argument. The \isty{relsize} package provides
+ \ics{textsmaller}\marg{text} which simulates small caps by reducing the size
+ of the font, so in this case the contents of \meta{text} should be
+ uppercase (otherwise the effect is simply smaller lowercase
+ letters). Some fonts don't support small caps combined with bold or slanted
+ properties. In this case, there will be a font substitution
+ warning and one of the properties (such as small caps or slanted) will be
+ dropped.}
+}
+
\let\glsd\glsuseri
\let\glsation\glsuserii
@@ -288,7 +454,7 @@ user2={sanitization\protect\iterm{sanitize}}%
sort={extended Latin character},
description={A character that's created by combining \glspl{latinchar}
to form ligatures (e.g.\ \ae) or by applying diacritical marks
- to a~\gls*{latinchar} or characters (e.g.\ \'a or \o).
+ to a~\gls*{latinchar} or characters (e.g.\ \'a).
See also \gls{nonlatinchar}.}
}
@@ -345,9 +511,6 @@ user2={sanitization\protect\iterm{sanitize}}%
\styfmt{glossaries-extra} package installed.}
}
-\ifpdf
-\externaldocument{glossaries-code}
-\fi
\doxitem{Option}{option}{package options}
\doxitem{GlsKey}{key}{glossary keys}
@@ -372,17 +535,18 @@ user2={sanitization\protect\iterm{sanitize}}%
\newcommand*{\fnsym}[1]{\textsuperscript{\fnsymmark{%
\ifcase#1\or \textasteriskcentered \or \textdagger
\or \textdaggerdbl \or \textsection
- \or $\lozenge$ \or \textparagraph
+ \or $\lozenge$\or \textparagraph
\or \#\or {\fontfamily{cmr}\selectfont\textreferencemark}%
\or \@nlctdoc@if@usingtexht{\HCode{&\#x2051;}}{\shortstack{*\\[-1.5ex]*}}%
- \or $\star$
+ \or $\star$%
\or \ding{94}%
\else
\number#1
\fi
}}}%
-\newcommand*{\optionlabel}[1]{%
- \@glstarget{option#1}{Option~#1}}
+\newrobustcmd*{\optionlabel}[1]{\@glstarget{option#1}{Option~#1}}
+
+\newcommand*{\plabel}[2][]{\linkanchor{#2}\protected@edef\@currentlabelname{#1}\label{#2}}
\makeatother
\newcounter{option}
@@ -390,7 +554,7 @@ user2={sanitization\protect\iterm{sanitize}}%
\def\opttitle{\appfmt{#2}}%
\refstepcounter{option}%
\pdfbookmark[2]{Option~\theoption\space (#2)}{option\theoption}%
- \subsection*{\protect\optionlabel{\theoption} (#1)}%
+ \subsection*{\linkanchor{option\theoption}\optionlabel{\theoption} (#1)}%
}
\newcommand*{\opt}[1]{\hyperlink{option#1}{Option~#1}}
@@ -398,7 +562,9 @@ user2={sanitization\protect\iterm{sanitize}}%
or~\hyperlink{option#2}{#2}}
\newcommand*{\optsand}[2]{Options~\hyperlink{option#1}{#1}
and~\hyperlink{option#2}{#2}}
+\newcommand*{\optsto}[2]{Options~\hyperlink{option#1}{#1}--\hyperlink{option#2}{#2}}
+\renewcommand*{\idxmarkedfont}{\xtrfont}
\newcommand*{\ifirstuse}{\iterm{first use}}
\newcommand*{\ifirstuseflag}{\iterm{first use>flag}}
@@ -419,42 +585,97 @@ and~\hyperlink{option#2}{#2}}
\newcommand*{\mkglsopt}[1]{\texttt{-#1}\index{makeglossaries=\appfmt{makeglossaries}>#1=\texttt{-#1}|hyperpage}}
+\newcommand*{\bibglsopt}[1]{\xtrfont{\texttt{-{}#1}}\index{bib2gls=\doidxmarker\appfmt{bib2gls}>#1=\texttt{-{}#1}|hyperpage}}
+\newcommand*{\bibglslongopt}[1]{\bibglsopt{-#1}}
+
+\renewcommand{\csoptfmt}{\texttt}
+
\newcommand*{\igloskey}[2][newglossaryentry]{\icsopt{#1}{#2}}
\newcommand*{\gloskey}[2][newglossaryentry]{\csopt{#1}{#2}}
-\newcommand*{\optfmt}[1]{\textsf{#1}}
-\newcommand*{\field}[1]{\optfmt{#1}\index{internal fields:>#1=\protect\optfmt{#1}|main}}
+
+\newcommand*{\ixtrgloskey}[2][newglossaryentry]{\icsopt*{#1}{#2}}
+\newcommand*{\xtrgloskey}[2][newglossaryentry]{\xtrfont{\csopt*{#1}{#2}}}
+
+\newcommand*{\printglosskey}[2][]{\icsopt{printglossary}{#2}%
+ \ifstrempty{#1}{\csoptfmt{#2}}{\csoptfmt{#2=#1}}%
+}
+
+\newcommand*{\printnoidxglosskey}[2][]{\icsopt{printnoidxglossary}{#2}%
+ \ifstrempty{#1}{\csoptfmt{#2}}{\csoptfmt{#2=#1}}%
+}
+
+\newcommand*{\xtrprintglosskey}[2][]{\icsopt*{printglossary}{#2}%
+ \xtrfont{\ifstrempty{#1}{\csoptfmt{#2}}{\csoptfmt{#2=#1}}}%
+}
+
+\newcommand*{\iresourceopt}[1]{\icsopt+{GlsXtrLoadResources}{#1}}
+\newcommand*{\resourceopt}[2][]{%
+ \xtrfont{\csoptfmt{#2}}\ifstrempty{#1}{}{\csoptfmt{\dequals#1}}%
+ \icsopt+{GlsXtrLoadResources}{#2}%
+}
+
+\newcommand*{\atentry}[1]{\xtrfont{\texttt{@#1}}%
+ \index{bib2gls entry types=\doidxmarker\appfmt{bib2gls} entry types>#1=\texttt{@#1}|hyperpage}}
+
+\newcommand*{\xtrcs}[1]{\xtrfont{\cs{#1}}}
+
+\newcommand*{\field}[1]{\csoptfmt{#1}\index{internal fields:>#1=\protect\csoptfmt{#1}|main}}
+\newcommand*{\xtrfield}[1]{\xtrfont{\csoptfmt{#1}}\index{internal fields:>#1=\doidxmarker\protect\csoptfmt{#1}|main}}
\newcommand*{\glostyle}[1]{\textsf{#1}\index{glossary styles:>#1={\protect\ttfamily#1}|main}}
+\newcommand*{\xtrglostyle}[1]{\xtrfont{\textsf{#1}}\index{glossary styles:>#1=\doidxmarker{\protect\ttfamily#1}|main}}
+
\newcommand*{\acrstyle}[1]{\textsf{#1}\index{acronym styles:>#1={\protect\ttfamily#1}|main}}
+\newcommand*{\abbrstyle}[1]{\xtrfont{\textsf{#1}}\index{abbreviation styles:=\doidxmarker abbreviation styles:>#1={\protect\ttfamily#1}|main}}
+\newcommand*{\cat}[1]{\xtrfont{\textsf{#1}}\index{categories=\doidxmarker categories>#1={\protect\ttfamily#1}|main}}
+
+\makeatletter
+\@nlctdoc@if@usingtexht
+{
+ \newcommand*{\icatattrs}[1][]{\index{category attributes=\doidxmarker category attributes#1|main}}
+ \newcommand*{\ixindyattrs}[1][]{\index{xindy attributes=xindy attributes#1|main}}
+ \index{attributes|see{category attributes or xindy attributes}}
+}
+{
+\newcommand{\icatattrs}[1][]{\index{category attributes=\protect\doidxmarker\protect\glsdohypertarget{catattr}{category attributes}:#1|main}}
+
+\newcommand*{\ixindyattrs}[1][]{\index{xindy attributes=\protect\glsdohypertarget{xindyattr}{xindy attributes}#1|main}}
+
+\index{attributes|see{\protect\hyperlink{catattr}{category attributes} (\styfmt{glossaries-extra}) or \protect\hyperlink{xindyattr}{xindy attributes}\protect\hfill}}
+}
+
+\makeatletter
+
+\newcommand*{\optfmt}[1]{\textsf{#1}}
+\newcommand*{\attr}[1]{\xtrfont{\optfmt{#1}}\icatattrs[>#1=\optfmt{#1}]{}}
+\newcommand*{\xindyattr}[1]{\texttt{#1}\ixindyattrs[>#1=\texttt{#1}]{}}
+
+\newrobustcmd{\mirrorsamplefile}[1]{%
+ \href{http://mirrors.ctan.org/macros/latex/contrib/glossaries/samples/#1}{\nolinkurl{#1}}%
+}
\newcounter{sample}
\newcommand{\exitem}[2][sample]{%
- \item[\texttt{#1#2.tex}]%
- \refstepcounter{sample}\label{ex:#1#2}}
-
-\newenvironment{samplelist}%
-{\begin{description}}%
-{\end{description}}
+ \par
+ \pdfbookmark[2]{#1#2.tex}{exfile.#1#2}%
+ \refstepcounter{sample}%
+ \subsection*{\plabel[#1#2.tex]{ex:#1#2}\mirrorsamplefile{#1#2.tex}}%
+}
\newcommand*{\samplefile}[2][sample]{%
\hyperref[ex:#1#2]{\texttt{#1#2.tex}}}
-\ifpdf
- \newcommand*{\htmldoc}[2]{\qt{#1}}
-\else
- \newcommand*{\htmldoc}[2]{\href{#2.html}{\qt{#1}}}
-\fi
\begin{document}
\MakeShortVerb{"}
\DeleteShortVerb{\|}
- \title{User Manual for glossaries.sty v4.44}
+ \title{User Manual for glossaries.sty v4.45}
\author{Nicola L.C. Talbot\\%
- \url{http://www.dickimaw-books.com/}}
+ \href{http://www.dickimaw-books.com/contact}{\nolinkurl{dickimaw-books.com/contact}}}
- \date{2019-12-06}
+ \date{2020-02-13}
\maketitle
\begin{abstract}
@@ -462,16 +683,19 @@ The \styfmt{glossaries} package provides a means to define terms or
abbreviations or symbols that can be referenced within your document.
Sorted lists with collated \glslink{entrylocation}{locations} can be
generated either using \TeX\ or using a supplementary \gls{indexingapp}.
+Sample documents are provided with the \styfmt{glossaries} package.
+These are listed in \sectionref{sec:samples}.
+\end{abstract}
+\begin{xtr}
Additional features not provided here may be available through
the extension package \gls{glossaries-extra} which, if required,
needs to be installed separately. New features will be added to
\gls*{glossaries-extra}. Versions of the \styfmt{glossaries}
-package after v4.21 will mostly be just bug fixes. Note that
-\gls{glossaries-extra} provides an extra indexing option
-(\gls{bib2gls}) which isn't available with just the base
-\sty{glossaries} package.
-\end{abstract}
+package after v4.21 will mostly be just bug fixes or minor
+maintenance. Note that \gls{glossaries-extra} provides an extra indexing option
+(\gls{bib2gls}) which isn't available with just the base \styfmt{glossaries} package.
+\end{xtr}
If you require multilingual support you must also separately install
the relevant language module. Each language module is distributed
@@ -545,35 +769,32 @@ package.
\item[\url{glossaries-code.pdf}]
Advanced users wishing to know more about the inner workings of all the
packages provided in the \styfmt{glossaries} bundle should read
-\qt{Documented Code for glossaries v4.44}.
+\qt{Documented Code for glossaries v4.45}.
\item[INSTALL] Installation instructions.
\item[CHANGES] Change log.
-\item[README] Package summary.
+\item[README.md] Package summary.
\end{description}
Related resources:
\begin{itemize}
-\item \styfmt{glossaries-extra} and \gls{bib2gls}: An Introductory
-Guide. (\href{http://mirrors.ctan.org/support/bib2gls/bib2gls-begin.pdf}{\texttt{bib2gls-begin.pdf}}).
-
+\item \bibglsbegin.
\item \href{http://www.dickimaw-books.com/faqs/glossariesfaq.html}{\styfmt{glossaries}
FAQ}
-\item \href{http://www.dickimaw-books.com/gallery/#glossaries}{\styfmt{glossaries}
-gallery}
+\item \gallerytopic{glossaries}{\styfmt{glossaries} gallery}
\item
-\href{http://www.dickimaw-books.com/gallery/glossaries-styles/}{a
-summary of all glossary styles provided by \styfmt{glossaries}}
+\gallery{glossaries-styles/}{a summary of all glossary styles provided by \styfmt{glossaries} and
+\gls*{glossaries-extra}}
\item
-\href{http://www.dickimaw-books.com/gallery/glossaries-performance.shtml}{\styfmt{glossaries}
+\gallery{glossaries-performance.shtml}{\styfmt{glossaries}
performance} (comparing document build times for the different
-options provided by \styfmt{glossaries} and \styfmt{glossaries-extra}).
+options provided by \styfmt{glossaries} and \gls{glossaries-extra}).
\item \href{http://www.dickimaw-books.com/latex/thesis/}{Using LaTeX to Write a PhD Thesis}
(chapter 6).
@@ -587,12 +808,13 @@ options provided by \styfmt{glossaries} and \styfmt{glossaries-extra}).
\item \href{http://ctan.org/pkg/bib2gls}{\appfmt{bib2gls}}
\end{itemize}
-\begin{important}
+\begin{important*}
If you use \sty{hyperref} and \styfmt{glossaries}, you must load
-\sty{hyperref} \emph{first}. Similarly the \sty{doc} package must
+\sty{hyperref} \emph{first} (although \sty{hyperref} should be
+loaded after most other packages). Similarly the \sty{doc} package must
also be loaded before \styfmt{glossaries}. (If \sty{doc} is loaded,
the file extensions for the default main glossary are changed to
-\filetype{gls2}, \filetype{glo2} and \filetype{.glg2} to avoid
+\filetype{gls2}, \filetype{glo2} and \filetype{glg2} to avoid
conflict with \sty{doc}'s changes
glossary.)\hypertarget{pdflatexnote}{}%
@@ -603,10 +825,15 @@ encounter problems where you have long hyperlinks or hyperlinks in
subscripts or superscripts. This is an issue with the DVI format not
with \styfmt{glossaries}. If you really need to use the DVI format
and have a problem with hyperlinks in maths mode, I recommend you use
-\gls{glossaries-extra} with the \texttt{hyperoutside} and
-\texttt{textformat} attributes set to appropriate values
+\gls{glossaries-extra} with the \attr{hyperoutside} and
+\attr{textformat} attributes set to appropriate values
for problematic entries.
-\end{important}
+\end{important*}
+
+\strong{The \styfmt{glossaries} package replaces the \styfmt{glossary}
+package which is now obsolete.} Please see the document
+\qtdocref{Upgrading from the glossary package to the glossaries
+package}{glossary2glossaries} for assistance in upgrading.
\clearpage
\pdfbookmark[0]{Contents}{contents}
@@ -628,64 +855,154 @@ for problematic entries.
The \styfmt{glossaries} package is provided to assist generating
lists of terms, symbols or abbreviations. (For convenience, these
-lists are all referred to as glossaries in this manual.)
+lists are all referred to as glossaries in this manual. The terms,
+symbols and abbreviations are collectively referred to as entries.)
The package has a certain amount of flexibility, allowing the
user to customize the format of the glossary and define multiple
glossaries. It also supports glossary styles that
-include symbols (in addition to a name and description) for glossary
-entries. There is provision for loading a database of glossary
-terms. Only those terms indexed\footnote{That is, if the term has been
+include an associated symbol (in addition to a name and description)
+for each glossary entry.
+
+There is provision for loading a database of glossary entries. Only
+those entries indexed\footnote{That is, if the entry has been
referenced using any of the commands described in
\sectionref{sec:glslink} and \sectionref{sec:glsadd} or via
\ics{glssee} (or the \gloskey{see} key) or commands such as
-\ics{acrshort}.}\ in the document will be added to the glossary.
+\ics{acrshort} or \ics*{glsxtrshort}.}\ in the document will be displayed in the glossary.
+(Unless you use \opt5, which doesn't use any indexing but will
+instead list all defined entries in order of definition.)
-The \styfmt{glossaries-extra} package, which is distributed as a
-separated bundle, extends the capabilities of
-the \styfmt{glossaries} package. The simplest document can be
-created with \styfmt{glossaries-extra} (which internally loads the
-\styfmt{glossaries} package):
+It's not necessary to actually have a glossary in the document. You may be
+interested in using this package just as means to consistently
+format certain types of terms, such as abbreviations, or you may
+prefer to have descriptions scattered about the document and be able
+to easily link to the relevant description (\opt6).
+
+The simplest document is one without a glossary:
\begin{verbatim}
\documentclass{article}
-
\usepackage[
- sort=none,% no sorting or indexing required
- abbreviations,% create list of abbreviations
- symbols,% create list of symbols
- postdot % append a full stop after the descriptions
-]{glossaries-extra}
+ sort=none % no sorting or indexing required
+]
+{glossaries}
-\newglossaryentry % provided by glossaries.sty
+\newglossaryentry
{cafe}% label
{% definition:
name={caf\'e},
description={small restaurant selling refreshments}
}
-\newabbreviation % provided by glossaries-extra.sty
+\setacronymstyle{long-short}
+
+\newacronym
{html}% label
{HTML}% short form
{hypertext markup language}% long form
-\glsxtrnewsymbol % provided by glossaries-extra.sty 'symbols' option
- [description={Archimedes' constant}]% options
+\newglossaryentry
{pi}% label
- {\ensuremath{\pi}}% symbol
+ {% definition:
+ name={\ensuremath{\pi}},
+ description={Archimedes' Constant}
+ }
+
+\newglossaryentry
+ {distance}% label
+ {% definition:
+ name={distance},
+ description={the length between two points},
+ symbol={m}
+ }
\begin{document}
First use: \gls{cafe}, \gls{html}, \gls{pi}.
Next use: \gls{cafe}, \gls{html}, \gls{pi}.
-\printunsrtglossaries % list all defined entries
+\Gls{distance} (\glsentrydesc{distance}) is measured in
+\glssymbol{distance}.
\end{document}
\end{verbatim}
+(This is a trivial example. For a real document I recommend you use
+\sty{siunitx} for units.)
-\textbf{The \styfmt{glossaries} package replaces the \sty{glossary}
-package which is now obsolete.} Please see the document
-\qtdocref{Upgrading from the glossary package to the glossaries
-package}{glossary2glossaries} for assistance in upgrading.
+\glsxtrnote
+The \gls{glossaries-extra} package, which is distributed as a
+separate bundle, extends the capabilities of
+the \styfmt{glossaries} package. The simplest document with a glossary can be
+created with \gls{glossaries-extra} (which internally loads the
+\styfmt{glossaries} package):
+\begin{verbatim}
+\documentclass{article}
+\end{verbatim}
+\begin{alltt}
+\cs{usepackage}[
+ sort=none,% no sorting or indexing required
+ \xtrfont{abbreviations},% create list of abbreviations
+ symbols,% create list of symbols
+ \xtrfont{postdot}, % append a full stop after the descriptions
+ \xtrfont{stylemods},style=index % set the default glossary style
+]\mgroup{glossaries-extra}
+\end{alltt}
+\begin{verbatim}
+\newglossaryentry % provided by glossaries.sty
+ {cafe}% label
+ {% definition:
+ name={caf\'e},
+ description={small restaurant selling refreshments}
+ }
+\end{verbatim}
+\begin{alltt}
+\% provided by glossaries-extra.sty:
+\ics*{setabbreviationstyle}\mgroup{long-short}
+
+\ics*{newabbreviation} \% provided by glossaries-extra.sty
+ \mgroup{html}\% label
+ \mgroup{HTML}\% short form
+ \mgroup{hypertext markup language}\% long form
+
+\% provided by glossaries-extra.sty 'symbols' option:
+\ics*{glsxtrnewsymbol}
+ [description=\mgroup{Archimedes' constant}]\% options
+ \mgroup{pi}\% label
+ \mgroup{\cs{ensuremath}\mgroup{\cs{pi}}}\% symbol
+\end{alltt}
+\begin{verbatim}
+\newglossaryentry % provided by glossaries.sty
+ {distance}% label
+ {% definition:
+ name={distance},
+ description={the length between two points},
+ symbol={m}
+ }
-One of the strengths of this package is its flexibility, however
+\begin{document}
+First use: \gls{cafe}, \gls{html}, \gls{pi}.
+Next use: \gls{cafe}, \gls{html}, \gls{pi}.
+
+\Gls{distance} is measured in \glssymbol{distance}.
+\end{verbatim}
+\begin{alltt}
+\ics*{printunsrtglossaries} \% list all defined entries
+\cs{end}\mgroup{document}
+\end{alltt}
+Note the difference in the way the abbreviation (HTML) and symbol
+(\ensuremath{\pi}) are defined in the two above examples. The
+\pkgopt*{abbreviations}, \pkgopt*{postdot} and \pkgopt*{stylemods}
+options are specific to \gls{glossaries-extra}. Other options are
+passed to the base \styfmt{glossaries} package.
+
+\begin{xtr}
+In this document, commands and options displayed in teal, such as
+\xtrcs{newabbreviation} and \pkgopt*{stylemods}, are only available with
+the \gls{glossaries-extra} package. There are also some commands and options (such
+as \cs{makeglossaries} and \pkgopt{symbols}) that are provided by the
+base \styfmt{glossaries} package but are redefined by the
+\gls{glossaries-extra} package. See the \gls{glossaries-extra} user
+manual for further details of those commands.
+\end{xtr}
+
+One of the strengths of the \styfmt{glossaries} package is its flexibility, however
the drawback of this is the necessity of having a large manual
that covers all the various settings. If you are daunted by the
size of the manual, try starting off with the much shorter
@@ -694,8 +1011,9 @@ size of the manual, try starting off with the much shorter
\begin{important}
There's a~common misconception that you have to have Perl installed
in order to use the \styfmt{glossaries} package. Perl is \emph{not}
-a~requirement but it does increase the available options,
-particularly if you use an \gls{exlatinalph} or a~\gls{nonlatinalph}.
+a~requirement (as demonstrated by the above examples) but it does
+increase the available options, particularly if you use an \gls{exlatinalph}
+or a~\gls{nonlatinalph}.
\end{important}
This document uses the \styfmt{glossaries} package. For example,
@@ -710,6 +1028,11 @@ which means they can be run directly from a command prompt or terminal, or can
be integrated into some text editors, or you can use a build tool
such as \app{arara} to run them.
+Neither of the above two examples require an \gls{indexingapp}. The
+first is just using the \styfmt{glossaries} package for consistent
+formatting, and there is no list. The second has lists but they are
+unsorted (see \opt5).
+
The remainder of this introductory section covers the following:
\begin{itemize}
\item \sectionref{sec:indexingoptions} lists the available indexing
@@ -740,11 +1063,17 @@ you can reference these within your document (like \cs{cite} or
you have referenced in your document (the glossary). This last part,
displaying the glossary, is the part that most new users find
difficult. There are three options available with the base
-\styfmt{glossaries} package and two further options with the
-extension package \gls{glossaries-extra}.
-An overview of these options is given in
-\tableref{tab:options}.
+\styfmt{glossaries} package (\optsto13). The \gls{glossaries-extra} extension
+package provides two extra options for lists (\optsand45) as well as an option for
+standalone descriptions within the document body (\opt6).
+
+An overview of \optsto15 is given in \tableref{tab:options}.
+\opt6 is omitted from the table as it doesn't produce a list. For a
+more detailed comparison of the various methods, see the
+\gallery{glossaries-performance.shtml}{\styfmt{glossaries}
+performance page}.
+\begin{important}
If you are developing a class or package that loads
\styfmt{glossaries}, I recommend that you don't force the user into
a particular indexing method by adding an unconditional \cs{makeglossaries}
@@ -753,10 +1082,14 @@ particular indexing method, it means that they're unable to use any
commands that must come before \cs{makeglossaries} (such as
\cs{newglossary}) and they can't switch off the indexing whilst
working on a draft document.
+\end{important}
-For a comparison of the various methods when used with large entry
-sets or when used with symbols such as \cs{alpha}, see the
-\href{http://www.dickimaw-books.com/gallery/glossaries-performance.shtml}{\styfmt{glossaries} performance page}.
+Strictly speaking, \optsand56 aren't actually indexing options as no
+indexing is performed. In the case of \opt5, all defined entries are
+listed in order of definition. In the case of \opt6, the entry
+hypertargets and descriptions are manually inserted at appropriate
+points in the document. These two options are included here for
+completeness and for comparison with the actual indexing options.
\begin{table}[htbp]
\caption{Glossary Options: Pros and Cons}
@@ -819,27 +1152,49 @@ sets or when used with symbols such as \cs{alpha}, see the
\fnsym{1} Strips standard \LaTeX\ accents
(that is, accents generated by core \LaTeX\ commands) so,
for example, \ics{AA} is treated the same as A.\par
- \fnsym{2} Only with the hybrid method provided with \sty{glossaries-extra}.\par
+ \fnsym{2} Only with the hybrid method provided with \gls{glossaries-extra}.\par
\fnsym{3} Provided \pkgopt[none]{sort} is used.\par
\fnsym{4} Entries with the same sort value are merged.\par
\fnsym{5} Requires some setting up.\par
\fnsym{6} The locations must be set explicitly
-through the custom \field{location} field provided by
+through the custom \xtrfield{location} field provided by
\styfmt{glossaries-extra}.\par
\fnsym{7} Unlimited but unreliable.\par
- \fnsym{8} Entries are defined in \texttt{.bib}
+ \fnsym{8} Entries are defined in \filetype{bib}
format. \cs{newglossaryentry} should not be used explicitly.\par
- \fnsym{9} Provided \pkgoptfmt{docdefs=true} or
-\pkgoptfmt{docdefs=restricted} but not recommended.\par
- \fnsym{10} Provided \pkgoptfmt{docdefs=false} or
-\pkgoptfmt{docdefs=restricted}.\par
- \fnsym{11} Irrelevant with \pkgopt[none]{sort}. (The \optfmt{record=only}
+ \fnsym{9} Provided \pkgopt+{true}{docdef} or
+ \pkgopt+{restricted}{docdef} but not recommended.\par
+ \fnsym{10} Provided \pkgopt+{false}{docdef} or
+ \pkgopt+{restricted}{docdef}.\par
+ \fnsym{11} Irrelevant with \pkgopt[none]{sort}. (The \pkgopt+{only}{record}
option automatically switches this on.)
\par
\end{table}
\optionsec[\TeX]{TeX}
+Example Document:
+\begin{verbatim}
+\documentclass{article}
+\usepackage{glossaries}
+\end{verbatim}
+\begin{alltt}
+\strong{\ics{makenoidxglossaries}} \% use TeX to sort
+\end{alltt}
+\begin{verbatim}
+\newglossaryentry{sample}{name={sample},
+ description={an example}}
+\begin{document}
+\gls{sample}.
+\end{verbatim}
+\begin{alltt}
+\strong{\ics{printnoidxglossary}}
+\cs{end}\mgroup{document}
+\end{alltt}
+You can place all your entry definitions in a separate file
+and load it in the preamble with \ics{loadglsentries} (\emph{after}
+\ics{makenoidxglossaries}).
+
This option doesn't require an external \gls{indexingapp} but, with
the default alphabetic sorting, it's very slow with severe limitations.
If you want a sorted list, it doesn't work well for
@@ -856,15 +1211,20 @@ such as \cs{alpha} or \cs{si}, then you must use
(\pkgopt[use]{sort} or \pkgopt[def]{sort}) in the package options
or explicitly set the \gloskey{sort} key when you define the
relevant entries. For example:
-\begin{verbatim}
-\newglossaryentry{alpha}{name={\ensuremath{\alpha}},
- sort={alpha},description={...}}
-\end{verbatim}
+\begin{alltt}
+\ics{newglossaryentry}\mgroup{alpha}\mgroup{name=\mgroup{\cs{ensuremath}\mgroup{\cs{alpha}}},
+ \strong{sort=\mgroup{alpha}},description=\mgroup{...}}
+\end{alltt}
+\begin{xtr}
+The \gls{glossaries-extra} package has a modified \pkgopt{symbols}
+package option that provides \ics*{glsxtrnewsymbol}, which automatically sets the
+\gloskey{sort} key to the entry label (instead of the \gloskey{name}).
+\end{xtr}
This option works best with the \pkgopt[def]{sort} or
\pkgopt[use]{sort} setting. For any
other setting, be prepared for a long document build time,
-especially if you have a lot of entries defined. \textbf{This
+especially if you have a lot of entries defined. \strong{This
option is intended as a last resort for alphabetical sorting.}
This option allows a mixture of sort methods. (For example,
sorting by word order for one glossary and order of use for another.)
@@ -896,20 +1256,29 @@ not form ranges in the \glspl{numberlist}. If you really can't use an
the \qt{typeset} or \qt{build} or \qt{PDF\LaTeX} button in your editor.
\end{enumerate}
-Complete example:
+\optionsec{makeindex}
+
+Example document:
\begin{verbatim}
\documentclass{article}
\usepackage{glossaries}
-\makenoidxglossaries % use TeX to sort
-\newglossaryentry{sample}{name={sample},
- description={an example}}
+\end{verbatim}
+\begin{alltt}
+\strong{\ics{makeglossaries}} \% open glossary files
+\end{alltt}
+\begin{verbatim}
+\newglossaryentry{sample}{name={sample},
+ description={an example}}
\begin{document}
\gls{sample}.
-\printnoidxglossary
-\end{document}
\end{verbatim}
-
-\optionsec{makeindex}
+\begin{alltt}
+\strong{\ics{printglossary}}
+\cs{end}\mgroup{document}
+\end{alltt}
+You can place all your entry definitions in a separate file
+and load it in the preamble with \ics{loadglsentries} (\emph{after}
+\ics{makeglossaries}).
This option uses a~\gls{cli} application called \gls{makeindex} to sort
the entries. This application comes with all modern \TeX\ distributions,
@@ -924,12 +1293,11 @@ to typeset the glossary. Then \cs{printglossary} reads this file in
on the next run.
This option works best if you want to sort entries according to the
-English alphabet and you don't want to install Perl (or Java or
-you don't want to use \gls{glossaries-extra}). This method can
-also work with the restricted shell escape since \gls{makeindex}
-is considered a trusted application. (So you should be able to
-use the \pkgopt{automake} package option provided the shell
-escape hasn't been completely disabled.)
+English alphabet and you don't want to install Perl or Java. This
+method can also work with the restricted shell escape since
+\gls{makeindex} is considered a trusted application. (So you should
+be able to use the \pkgopt{automake} package option provided the
+shell escape hasn't been completely disabled.)
This method can form ranges in the \gls{numberlist} but only
accepts limited number formats: \cs{arabic}, \cs{roman},
@@ -941,10 +1309,15 @@ word\slash letter ordering or order of use or order of definition.
If you need word ordering for one glossary and letter ordering
for another you'll have to explicitly call \gls{makeindex} for
each glossary type.
-(The \sty{glossaries-extra} package allows a hybrid mix of
+
+\begin{xtr}
+The \gls{glossaries-extra} package allows a hybrid mix of
\optsand12 to provide word\slash letter ordering with \opt2 and order
-of use\slash definition with \opt1. See the \sty{glossaries-extra}
-documentation for further details.)
+of use\slash definition with \opt1. See the \gls{glossaries-extra}
+documentation for further details. See also the
+\gls{glossaries-extra} alternative to \samplefile{Sort} in
+\sectionref{sec:samplessort}.
+\end{xtr}
\begin{enumerate}
\item If you want to use \gls{makeindex}['s] \mkidxopt{g} option
@@ -977,74 +1350,109 @@ to your preamble (before you start
\end{verbatim}
\item Run \LaTeX\ on your document. This creates files with the
- extensions \texttt{.glo} and \texttt{.ist} (for example, if your
+ extensions \filetype{glo} and \filetype{ist} (for example, if your
\LaTeX\ document is called \texttt{myDoc.tex}, then you'll have
two extra files called \texttt{myDoc.glo} and \texttt{myDoc.ist}).
If you look at your document at this point, you won't see the
glossary as it hasn't been created yet. (If you use
- \sty{glossaries-extra} you'll see the section heading and some
+ \gls{glossaries-extra} you'll see the section heading and some
boilerplate text.)
- \item Run \gls{makeindex} with the \texttt{.glo} file as the
+ If you have used package options such as \pkgopt{symbols} there
+ will also be other sets of files corresponding to the extra
+ glossaries that were created by those options.
+
+ \item\plabel{makeindex.run} Run \gls{makeindex} with the \texttt{.glo} file as the
input file and the \texttt{.ist} file as the style so that
it creates an output file with the extension \texttt{.gls}. If
you have access to a terminal or a command prompt (for example, the
MSDOS command prompt for Windows users or the bash console for
Unix-like users) then you need to run the command:
-\begin{verbatim}
+\begin{prompt}
makeindex -s myDoc.ist -o myDoc.gls myDoc.glo
-\end{verbatim}
+\end{prompt}
(Replace \texttt{myDoc} with the base name of your \LaTeX\
- document file. Avoid spaces in the file name if possible.) If you don't know
- how to use the command prompt, then you can probably access
+ document file. Avoid spaces in the file name if possible.
+ The \textbf{\ttfamily\$} symbol indicates the command prompt and should be omitted.)
+
+\begin{important}
+The file extensions vary according to the glossary \gloskey{type}.
+See \sectionref{sec:makeindexapp} for further details.
+\gls{makeindex} must be called for each set of files.
+\end{important}
+
+ If you don't know how to use the command prompt, then you can probably access
\gls{makeindex} via your text editor, but each editor has a
- different method of doing this, so I~can't give a~general
- description. You will have to check your editor's manual. The
- simplest approach is to use \app{arara} and add the following
+ different method of doing this. See \href{https://www.dickimaw-books.com/latex/buildglossaries/}{Incorporating
+makeglossaries or makeglossaries-lite or bib2gls into the document
+build} for some examples.
+
+ Alternatively, run \gls{makeindex} indirectly via the
+\gls{makeglossaries} script:
+\begin{prompt}
+makeglossaries myDoc
+\end{prompt}
+ Note that the file extension isn't supplied in this case.
+ (Replace \gls{makeglossaries} with \gls{makeglossaries-lite.lua} if
+ you don't have Perl installed.)
+ This will pick up all the file extensions from the
+ \filetype{aux} file and run \gls{makeindex} the appropriate number
+ of times with all the necessary switches.
+
+ The simplest approach is to use \app{arara} and add the following
comment lines to the start of your document:
\begin{alltt}
-\% arara:\ pdflatex
-\% arara:\ makeglossaries
-\% arara:\ pdflatex
+\% arara: pdflatex
+\% arara: makeglossaries
+\% arara: pdflatex
\end{alltt}
- (Replace \texttt{makeglossaries} with
- \texttt{makeglossaries-lite} if you don't have Perl installed.)
+ (Replace \texttt{makeglossaries} with \texttt{makeglossarieslite} in the
+ second line above if you don't have Perl installed. Note that
+ there's no hyphen in this case.)
The default sort is word order (\qt{sea lion} comes before \qt{seal}).
If you want letter ordering you need to add the \mkidxopt{l}
switch:
-\begin{verbatim}
+\begin{prompt}
makeindex -l -s myDoc.ist -o myDoc.gls myDoc.glo
-\end{verbatim}
+\end{prompt}
(See \sectionref{sec:makeindexapp} for further details on using
\gls*{makeindex} explicitly.) If you use \gls{makeglossaries}
or \gls{makeglossaries-lite.lua} then use the \pkgopt[letter]{order}
package option and the \mkidxopt{l} option will be added
automatically.
- \item Once you have successfully completed the previous step,
- you can now run \LaTeX\ on your document again. You'll need to
- repeat the process if you have used the \pkgopt{toc} option
- (unless you're using \sty{glossaries-extra}) to ensure the
- section heading is added to the table of contents. You'll also
- need to repeat the process if you have any cross-references
- which can't be indexed until the glossary file has been created.
+ \item\plabel{makeindex.relatex} Once you have successfully completed the previous step,
+ you can now run \LaTeX\ on your document again.
\end{enumerate}
+You'll need to repeat the last step if you have used the
+\pkgopt{toc} option (unless you're using \gls{glossaries-extra}) to
+ensure the section heading is added to the table of contents.
+You'll also need to repeat steps~\ref{makeindex.run} and~\ref{makeindex.relatex}
+if you have any cross-references which can't be indexed until the glossary file has
+been created.
-Complete example:
+\optionsec{xindy}
+
+Example document:
+\begin{alltt}
+\cs{documentclass}\mgroup{article}
+\cs{usepackage}[\strong{xindy}]\mgroup{glossaries}
+\strong{\ics{makeglossaries}} \% open glossary files
+\end{alltt}
\begin{verbatim}
-\documentclass{article}
-\usepackage{glossaries}
-\makeglossaries % open glossary files
\newglossaryentry{sample}{name={sample},
description={an example}}
\begin{document}
\gls{sample}.
-\printglossary
-\end{document}
\end{verbatim}
-
-\optionsec{xindy}
+\begin{alltt}
+\strong{\ics{printglossary}}
+\cs{end}\mgroup{document}
+\end{alltt}
+You can place all your entry definitions in a separate file
+and load it in the preamble with \ics{loadglsentries} (\emph{after}
+\ics{makeglossaries}).
This option uses a~\gls{cli} application called
\gls{xindy} to sort the entries. This application is more flexible than
@@ -1076,17 +1484,25 @@ some problems with certain sort values:
\end{itemize}
In these problematic cases, you must set the \gloskey{sort} field
explicitly. For example:
-\begin{verbatim}
-\newglossaryentry{alpha}{name={\ensuremath{\alpha}},
- sort={alpha},description={...}}
-\end{verbatim}
+\begin{alltt}
+\cs{newglossaryentry}\mgroup{alpha}\mgroup{name=\mgroup{\cs{ensuremath}\mgroup{\cs{alpha}}},
+ \strong{sort=\mgroup{alpha},}description=\mgroup{...}}
+\end{alltt}
+\begin{xtr}
+The \gls{glossaries-extra} package has a modified \pkgopt{symbols}
+package option that provides \ics*{glsxtrnewsymbol}, which automatically sets the
+\gloskey{sort} key to the entry label (instead of the \gloskey{name}).
+\end{xtr}
All glossaries must be sorted according to the same method
(word/letter ordering, order of use, or order of definition).
-(The \sty{glossaries-extra} package allows a hybrid mix of
+
+\begin{xtr}
+The \gls{glossaries-extra} package allows a hybrid mix of
\optsand13 to provide word\slash letter ordering with \opt3 and order
-of use\slash definition with \opt1. See the \sty{glossaries-extra}
-documentation for further details.)
+of use\slash definition with \opt1. See the \gls{glossaries-extra}
+documentation for further details.
+\end{xtr}
\begin{enumerate}
\item Add the \pkgopt{xindy} option to the \styfmt{glossaries}
@@ -1099,7 +1515,8 @@ package option list:
\begin{verbatim}
\usepackage[xindy={glsnumbers=false}]{glossaries}
\end{verbatim}
- or use either \cs{GlsSetXdyFirstLetterAfterDigits}\marg{letter} or
+ or use either \cs{GlsSetXdyFirstLetterAfterDigits}\marg{letter} (to indicate the
+first letter group to follow the digits) or
\cs{GlsSetXdyNumberGroupOrder}\marg{spec} to indicate where the number
group should be placed (see \sectionref{sec:xindy}).
@@ -1107,14 +1524,18 @@ package option list:
defining your entries, as described in \sectionref{sec:newglosentry}).
\item Run \LaTeX\ on your document. This creates files with the
- extensions \texttt{.glo} and \texttt{.xdy} (for example, if your
+ extensions \filetype{glo} and \filetype{xdy} (for example, if your
\LaTeX\ document is called \texttt{myDoc.tex}, then you'll have
two extra files called \texttt{myDoc.glo} and \texttt{myDoc.xdy}).
If you look at your document at this point, you won't see the
glossary as it hasn't been created yet. (If you're using the
- extension package \sty{glossaries-extra}, you'll see the section
+ \gls{glossaries-extra} extension package, you'll see the section
header and some boilerplate text.)
+ If you have used package options such as \pkgopt{symbols} there
+ will also be other sets of files corresponding to the extra
+ glossaries that were created by those options.
+
\item Run \gls{xindy} with the \texttt{.glo} file as the
input file and the \texttt{.xdy} file as a~module so that
it creates an output file with the extension \texttt{.gls}. You
@@ -1123,19 +1544,31 @@ package option list:
MSDOS command prompt for Windows users or the bash console for
Unix-like users) then you need to run the command (all on one
line):
-\begin{verbatim}
-xindy -L english -C utf8 -I xindy -M myDoc
--t myDoc.glg -o myDoc.gls myDoc.glo
-\end{verbatim}
+\begin{prompt}
+xindy -L english -C utf8 -I xindy -M myDoc -t myDoc.glg -o myDoc.gls myDoc.glo
+\end{prompt}
(Replace \texttt{myDoc} with the base name of your \LaTeX\
document file. Avoid spaces in the file name. If necessary, also replace
\texttt{english} with the name of your language and \texttt{utf8}
with your input encoding, for example,
\xdyopt{L}\texttt{ german }\xdyopt{C}\texttt{ din5007-utf8}.)
- Note that it's much simpler to use \gls{makeglossaries} instead:
-\begin{verbatim}
+
+\begin{important}
+The file extensions vary according to the glossary \gloskey{type}.
+See \sectionref{sec:xindyapp} for further details.
+\gls{xindy} must be called for each set of files.
+\end{important}
+
+ It's much simpler to use \gls{makeglossaries} instead:
+\begin{prompt}
makeglossaries myDoc
-\end{verbatim}
+\end{prompt}
+ Note that the file extension isn't supplied in this case.
+ This will pick up all the file extensions from the
+ \filetype{aux} file and run \gls{xindy} the appropriate number
+ of times with all the necessary switches.
+
+ There's no benefit in using \gls{makeglossaries-lite.lua} with \gls{xindy}.
(Remember that \gls{xindy} is a Perl script so if you can use
\gls{xindy} then you can also use \gls{makeglossaries}, and if
you don't want to use \gls{makeglossaries} because you don't
@@ -1143,14 +1576,16 @@ makeglossaries myDoc
If you don't know how to use the command prompt, then you can
probably access \gls{xindy} or \gls{makeglossaries} via your text editor,
- but each editor has a different method of doing this, so I~can't give
- a~general description. You will have to check your editor's manual. Again,
- a convenient method is to use \appfmt{arara} and add the follow comment
+ but each editor has a different method of doing this. See \href{https://www.dickimaw-books.com/latex/buildglossaries/}{Incorporating
+makeglossaries or makeglossaries-lite or bib2gls into the document
+build} for some examples.
+
+ Again, a convenient method is to use \appfmt{arara} and add the follow comment
lines to the start of your document:
\begin{alltt}
-\% arara:\ pdflatex
-\% arara:\ makeglossaries
-\% arara:\ pdflatex
+\% arara: pdflatex
+\% arara: makeglossaries
+\% arara: pdflatex
\end{alltt}
The default sort is word order (\qt{sea lion} comes before \qt{seal}).
@@ -1166,139 +1601,193 @@ makeglossaries myDoc
\gls*{xindy} explicitly.
\item Once you have successfully completed the previous step,
- you can now run \LaTeX\ on your document again. As with the
- previous option, you may need to repeat the process to ensure
- the table of contents and cross-references are resolved.
+ you can now run \LaTeX\ on your document again. As with
+ \gls{makeindex} (\opt2), you may need to repeat the previous
+ step and this step to ensure the table of contents and cross-references are resolved.
\end{enumerate}
-Complete example:
-\begin{verbatim}
-\documentclass{article}
-\usepackage[xindy]{glossaries}
-\makeglossaries % open glossary files
-\newglossaryentry{sample}{name={sample},
- description={an example}}
-\begin{document}
-\gls{sample}.
-\printglossary
-\end{document}
-\end{verbatim}
-
\optionsec{bib2gls}
-This option is only available with the extension package
-\gls{glossaries-extra}. This method uses \gls{bib2gls} to both
-fetch entry definitions from \texttt{.bib} files and to
-hierarchically sort and collate.
+\glsxtrnote
+This option is only available with the \gls{glossaries-extra} extension package.
+This method uses \gls{bib2gls} to both fetch entry definitions from
+\filetype{bib} files and to hierarchically sort and collate.
-All entries must be provided in one or more \texttt{.bib} files.
-(See the \gls{bib2gls} user manual for the required format.) The
-\sty{glossaries-extra} package needs to be loaded with the
-\pkgoptfmt{record} package option
-\begin{verbatim}
-\usepackage[record]{glossaries-extra}
-\end{verbatim}
+Example document:
+\begin{alltt}
+\cs{documentclass}\mgroup{article}
+\cs{usepackage}[\xtrfont{record=nameref}]\mgroup{glossaries-extra}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=\mgroup{entries}]
+\cs{begin}\mgroup{document}
+\cs{gls}\mgroup{sample}, \cs{gls}\mgroup{alpha}, \cs{gls}\mgroup{html}.
+\ics*{printunsrtglossary}
+\cs{end}\mgroup{document}
+\end{alltt}
+where the file \texttt{entries.bib} contains:
+\begin{alltt}
+\atentry{entry}\mgroup{sample,
+ name=\mgroup{sample},
+ description=\mgroup{an example}
+}
+\atentry{symbol}\mgroup{alpha,
+ name=\mgroup{\cs{ensuremath}\mgroup{\cs{alpha}}},
+ description=\mgroup{...}
+}
+\atentry{abbreviation}\mgroup{html,
+ short=\mgroup{HTML},
+ long=\mgroup{hypertext markup language}
+}
+\end{alltt}
+
+All entries must be provided in one or more \filetype{bib} files.
+See the \gls{bib2gls} user manual for the required format.
+
+\begin{important}
+Note that the \gloskey{sort} key should not be used. Each entry type
+(\atentry{entry}, \atentry{symbol}, \atentry{abbreviation}) has a
+particular field that's used for the sort value by default
+(\gloskey{name}, the label, \gloskey{short}). You will break this
+mechanism if you explicitly use the \gloskey{sort} key. See
+\bibglsgallery{sorting} for examples.
+\end{important}
+
+The \gls{glossaries-extra} package needs to be loaded with the
+\pkgopt*{record} package option:
+\begin{alltt}
+\cs{usepackage}[\xtrfont{record}]\mgroup{glossaries-extra}
+\end{alltt}
or (equivalently)
-\begin{verbatim}
-\usepackage[record=only]{glossaries-extra}
-\end{verbatim}
+\begin{alltt}
+\cs{usepackage}[\xtrfont{record=only}]\mgroup{glossaries-extra}
+\end{alltt}
+or (with at least \gls{glossaries-extra} v1.37 and \gls{bib2gls} v1.8):
+\begin{alltt}
+\cs{usepackage}[\xtrfont{record=nameref}]\mgroup{glossaries-extra}
+\end{alltt}
+The \pkgopt+{nameref}{record} option is the best method.
+
(It's possible to use a hybrid of this method and \optsor23 with
-\pkgoptfmt{record=alsoindex} but in general there is little need
+\pkgopt+{alsoindex}{record} but in general there is little need
for this and it complicates the build process.)
-Each resource set is loaded with \cs{GlsXtrLoadResources}\oarg{options}.
+Each resource set is loaded with \ics*{GlsXtrLoadResources}\oarg{options}.
For example:
-\begin{verbatim}
-\GlsXtrLoadResources
-[% definitions in entries1.bib and entries2.bib:
- src={entries1,entries2},
- sort={de-CH-1996}% sort according to this locale
+\begin{alltt}
+\ics*{GlsXtrLoadResources}
+[\% definitions in entries1.bib and entries2.bib:
+ \resourceopt{src}=\mgroup{entries1,entries2},
+ \resourceopt{sort}=\mgroup{de-CH-1996}\% sort according to this locale
]
-\end{verbatim}
-You can have multiple resource commands.
-
-The glossary is displayed using
-\begin{verbatim}
-\printunsrtglossary
-\end{verbatim}
+\end{alltt}
+The \filetype{bib} files are identified as a comma-separated list in the
+value of the \resourceopt{src} key. The \resourceopt{sort} option
+identifies the sorting method. This may be a locale identifier for
+alphabetic sorting, but there are other sort methods available, such
+as character code or numeric. One resource set may cover multiple
+glossaries or one glossary may be split across multiple resource
+sets, forming logical sub-blocks.
+
+If you want to ensure that all entries are selected, even if
+they haven't been referenced in the document, then add the option
+\resourceopt[all]{selection}. (There are also ways of filtering the
+selection or you can even have a random selection by shuffling and
+truncating the list. See the \gls{bib2gls} user manual for further details.)
+
+The glossary is displayed using:
+\begin{alltt}
+\ics*{printunsrtglossary}
+\end{alltt}
Alternatively all glossaries can be displayed using the iterative
command:
-\begin{verbatim}
-\printunsrtglossaries
-\end{verbatim}
-The document is build using:
-\begin{verbatim}
+\begin{alltt}
+\ics*{printunsrtglossaries}
+\end{alltt}
+The document is built using:
+\begin{prompt}
pdflatex myDoc
bib2gls myDoc
pdflatex myDoc
-\end{verbatim}
-If letter groups are required, you need the \verb|--group| switch:
-\begin{verbatim}
-bib2gls --group myDoc
-\end{verbatim}
+\end{prompt}
+If letter groups are required, you need the \bibglslongopt{group} switch:
+\begin{prompt}
+bib2gls -{}-group myDoc
+\end{prompt}
+or with \app{arara}:
+\begin{alltt}
+\% arara: bib2gls: \mgroup{ group: on }
+\end{alltt}
+(You will also need an appropriate glossary style.)
+
Unlike \optsand23, this method doesn't create a file containing
the typeset glossary but simply determines which entries are
needed for the document, their associated locations and (if
required) their associated letter group. This option allows
-a mixture of sort methods. (For example, sorting by word order
+a mixture of sort methods. For example, sorting by word order
for one glossary and order of use for another or even sorting
one block of the glossary differently to another block in the
-same glossary.)
+same glossary. See \bibglsgallery{sorting}.
+
+This method supports Unicode and uses the Common Locale Data
+Repository, which provides more extensive language support than
+\gls{xindy}.\footnote{Except for Klingon, which is supported by
+\gls{xindy}, but not by the CLDR.}\ The locations in the
+\gls{numberlist} may be in any format. If \gls{bib2gls} can deduce a
+numerical value it will attempt to form ranges otherwise it will
+simply list the locations.
+
+See \bibglsbegin\ or the \gls{bib2gls} user manual for further
+details of this method, and
+also \href{https://www.dickimaw-books.com/latex/buildglossaries/}{Incorporating
+makeglossaries or makeglossaries-lite or bib2gls into the document
+build}.
-This method supports Unicode and (with at least Java~8) uses
-the Common Locale Data Repository, which provides more extensive
-language support than \gls{xindy}.\footnote{Except for Klingon,
-which is supported by \gls{xindy}, but not by the
-CLDR.}\ The locations in the
-\gls{numberlist} may be in any format. If \gls{bib2gls} can
-deduce a numerical value it will attempt to form ranges otherwise
-it will simply list the locations.
+\optionsec[no sorting]{no sorting}
-Complete example:
+\glsxtrnote
+This option is only available with the extension package
+\gls{glossaries-extra}. No \gls{indexingapp} is required.
+
+Example document:
\begin{verbatim}
\documentclass{article}
-\usepackage[record]{glossaries-extra}
-\GlsXtrLoadResources[src={entries}]
+\usepackage[sort=none]{glossaries-extra}
+\newglossaryentry{sample}{name={sample},
+ description={an example}}
+\newglossaryentry{alpha}{name={\ensuremath{\alpha}},
+ description={...}}
\begin{document}
\gls{sample}.
-\printunsrtglossary
-\end{document}
-\end{verbatim}
-where \texttt{entries.bib} contains
-\begin{verbatim}
-@entry{sample,
- name={sample},
- description={an example}
-}
\end{verbatim}
-See the \gls{bib2gls} user manual for further details.
-
-\optionsec[no sorting]{no sorting}
+\begin{alltt}
+\ics*{printunsrtglossary}
+\cs{end}\mgroup{document}
+\end{alltt}
-This option is only available with the extension package
-\gls{glossaries-extra}. No \gls{indexingapp} is required. This
-method is best used with the package option \pkgopt[none]{sort}.
-\begin{verbatim}
-\usepackage[sort=none]{glossaries-extra}
-\end{verbatim}
-There's no \qt{activation} command (such as \cs{makeglossaries}
+This method is best used with the package option \pkgopt[none]{sort}
+(as shown above). There's no \qt{activation} command (such as \cs{makeglossaries}
for \optsand23).
All entries must be defined before the glossary is displayed
(preferably in the preamble) in the required order, and child
entries must be defined immediately after their parent entry
-if they must be kept together in the glossary
-
-The glossary is displayed using
-\begin{verbatim}
-\printunsrtglossary
-\end{verbatim}
+if they must be kept together in the glossary. (Some glossary styles
+indent entries that have a parent but it's the \gls{indexingapp}
+that ensures the child entries are listed immediately after the
+parent. If you're opting to use this manual approach then it's your
+responsibility to define the entries in the correct order.) You can
+place all your entry definitions in a separate file
+and load it in the preamble with \ics{loadglsentries}.
+
+The glossary is displayed using:
+\begin{alltt}
+\ics*{printunsrtglossary}
+\end{alltt}
Alternatively all glossaries can be displayed using the iterative
command:
-\begin{verbatim}
-\printunsrtglossaries
-\end{verbatim}
+\begin{alltt}
+\ics*{printunsrtglossaries}
+\end{alltt}
This will display \emph{all} defined entries, regardless of
whether or not they have been used in the document. The
\glspl{numberlist} have to be set explicitly otherwise they won't
@@ -1307,601 +1796,347 @@ glossary as \opt4. This is because \gls{bib2gls} takes advantage
of this method by defining the wanted entries in the required order and
setting the locations (and letter group information, if required).
-This just requires a single \LaTeX\ call
-\begin{verbatim}
+Therefore, the above example document has a glossary containing the
+entries: sample and $\alpha$ (in that order). Note that
+the \texttt{alpha} entry has been included even though it wasn't
+referenced in the document.
+
+This just requires a single \LaTeX\ call:
+\begin{prompt}
pdflatex myDoc
-\end{verbatim}
+\end{prompt}
unless the glossary needs to appear in the table of contents, in which case
-a second run is required.
-\begin{verbatim}
+a second run is required:
+\begin{prompt}
pdflatex myDoc
pdflatex myDoc
-\end{verbatim}
+\end{prompt}
(Naturally if the document also contains citations, and so on,
then additional steps are required. Similarly for all the other
options above.)
-Complete example:
-\begin{verbatim}
-\documentclass{article}
-\usepackage[sort=none]{glossaries-extra}
-\newglossaryentry{sample}{name={sample},
- description={an example}}
-\begin{document}
-\gls{sample}.
-\printunsrtglossary
-\end{document}
-\end{verbatim}
-See the \sty{glossaries-extra} documentation for
-further details.
-
-\section{Sample Documents}
-\label{sec:samples}
+See the \gls{glossaries-extra} documentation for further details of this method.
-The \styfmt{glossaries} package is provided with some sample
-documents that illustrate the various functions. These should
-be located in the \texttt{samples} subdirectory (folder) of the
-\styfmt{glossaries} documentation directory. This location varies
-according to your operating system and \TeX\ distribution. You
-can use \texttt{texdoc} to locate the main glossaries documentation.
-For example, in a
-\href{http://www.dickimaw-books.com/latex/novices/html/terminal.html}{terminal or command prompt}, type:
-\begin{prompt}
-texdoc -l glossaries
-\end{prompt}
-This should display a list of all the files in the glossaries
-documentation directory with their full pathnames. (The GUI version
-of \texttt{texdoc} may also provide you with the information.)
+\optionsec[standalone]{standalone}
-If you can't find the sample files on your computer, they are also available
-from your nearest CTAN mirror at
-\url{http://mirror.ctan.org/macros/latex/contrib/glossaries/samples/}.
+\glsxtrnote
+This option is only available with the \gls{glossaries-extra}
+extension package.\footnote{You can just use the base
+\styfmt{glossaries} package for the first case, but it's less
+convenient. You'd have to manually insert the entry target before
+the sectioning command and use \ics{glsentryname}\marg{label} or
+\ics{Glsentryname}\marg{label} to display the entry name.} Instead
+of creating a list, this has standalone definitions throughout the
+document. The entry name may or may not be in a section heading.
-The sample documents are listed below\footnote{Note that although I've written
-\texttt{latex} in this section, it's better to use \texttt{pdflatex}, where
-possible, for the reasons given \hyperlink{pdflatexnote}{earlier}.}
-If you prefer to use UTF-8 aware engines (\texttt{xelatex} or
-\texttt{lualatex}) remember that you'll need to switch from
-\styfmt{fontenc} \& \styfmt{inputenc} to \styfmt{fontspec} where
-appropriate. The \gls{glossaries-extra} package provides some
-additional sample files.
-
-\begin{samplelist}
-\exitem[minimal]{gls} This document is a
-minimal working example. You can test your installation using this
-file. To create the complete document you will need to do the
-following steps:
- \begin{enumerate}
- \item Run \texttt{minimalgls.tex} through \LaTeX\ either by
- typing
-\begin{prompt}
-latex minimalgls
-\end{prompt}
- in a terminal or by using the relevant button or menu item in
- your text editor or front-end. This will create the required
- associated files but you will not see the glossary. If you use
- PDF\LaTeX\ you will also get warnings about non-existent
- references that look something like:
+You can either define entries in the document preamble (or in an external file loaded with
+\ics{loadglsentries}), as with \opt5, for example:
\begin{verbatim}
-pdfTeX warning (dest): name{glo:aca} has been
-referenced but does not exist,
-replaced by a fixed one
-\end{verbatim}
- These warnings may be ignored on the first run.
-
- If you get a \verb"Missing \begin{document}" error, then
- it's most likely that your version of \sty{xkeyval} is
- out of date. Check the log file for a warning of that nature.
- If this is the case, you will need to update the \styfmt{xkeyval}
- package.
-
- \item If you have Perl installed, run \gls{makeglossaries} on the document (\sectionref{sec:makeglossaries}). This can
- be done on a terminal by typing
-\begin{prompt}
-makeglossaries minimalgls
-\end{prompt}
- otherwise do
-\begin{prompt}
-makeglossaries-lite minimalgls
-\end{prompt}
- If for some reason you want to call \gls{makeindex} explicitly, you can do this
- in a terminal by typing (all on one line):
-\begin{prompt}
-makeindex -s minimalgls.ist -t minimalgls.glg -o minimalgls.gls minimalgls.glo
-\end{prompt}
- (See \sectionref{sec:makeindexapp} for further details on using
- \gls*{makeindex} explicitly.)
-
- Note that if the file name contains spaces, you will need to use
- the double-quote character to delimit the name.
-
- \item Run \texttt{minimalgls.tex} through \LaTeX\ again (as step~1)
- \end{enumerate}
-You should now have a complete document. The number following
-each entry in the glossary is the location number. By default, this
-is the page number where the entry was referenced.
-
-There are three other files that can be used as a
-\href{http://www.dickimaw-books.com/latex/minexample/}{minimal working
-example}: \texttt{mwe-gls.tex}, \texttt{mwe-acr.tex} and
-\texttt{mwe-acr-desc.tex}.
-
-\exitem{-noidxapp} This document illustrates how to use the
-\styfmt{glossaries} package without an external \gls{indexingapp} (\opt1).
-To create the complete document, you need to do:
-\begin{prompt}
-latex sample-noidxapp
-latex sample-noidxapp
-\end{prompt}
-
-\exitem{-noidxapp-utf8} As the previous example, except that it uses
-the \sty{inputenc} package.
-To create the complete document, you need to do:
-\begin{prompt}
-latex sample-noidxapp-utf8
-latex sample-noidxapp-utf8
-\end{prompt}
+\documentclass{article}
-\exitem{4col} This document illustrates
-a four column glossary where the entries have a symbol in addition
-to the name and description. To create the complete document, you
-need to do:
-\begin{prompt}
-latex sample4col
-makeglossaries sample4col
-latex sample4col
-\end{prompt}
-or
-\begin{prompt}
-latex sample4col
-makeglossaries-lite sample4col
-latex sample4col
-\end{prompt}
-The vertical gap between entries is the
-gap created at the start of each group. This can be suppressed
-using the \pkgopt{nogroupskip} package option.
+\usepackage[colorlinks]{hyperref}
+\usepackage[sort=none,
+ nostyles% <- no glossary styles are required
+ ]{glossaries-extra}
-\exitem{Acr} This document has some
-sample abbreviations. It also adds the glossary to the table of contents,
-so an extra run through \LaTeX\ is required to ensure the document
-is up to date:
-\begin{prompt}
-latex sampleAcr
-makeglossaries sampleAcr
-latex sampleAcr
-latex sampleAcr
-\end{prompt}
-(or use \gls{makeglossaries-lite.lua}).
+\newglossaryentry{set}{name={set},
+ description={a collection of any kind of objects},
+ symbol={\ensuremath{\mathcal{S}}}
+}
-\exitem{AcrDesc} This is similar to
-the previous example, except that the abbreviations have an associated
-description. As with the previous example, the glossary is added to
-the table of contents, so an extra run through \LaTeX\ is required:
-\begin{prompt}
-latex sampleAcrDesc
-makeglossaries sampleAcrDesc
-latex sampleAcrDesc
-latex sampleAcrDesc
-\end{prompt}
+\newglossaryentry{function}{name={function},
+ description={a rule that assigns every element in the
+ domain \gls{set} to an element in the range \gls{set}},
+ symbol={\ensuremath{f(x)}}
+}
+\end{verbatim}
+\begin{alltt}
+\cs{newcommand}*\mgroup{\cs{termdef}}[1]\mgroup{\%
+ \cs{section}\mgroup{\ics*{glsxtrglossentry}\mgroup{\#1} \ics{glsentrysymbol}\mgroup{\#1}}\%
+ \cs{begin}\mgroup{quote}\cs{em}\ics{Glsentrydesc}\mgroup{\#1}.\cs{end}\mgroup{quote}\%
+}
+\end{alltt}
+\begin{verbatim}
+\begin{document}
+\tableofcontents
-\exitem{Desc} This is similar to the
-previous example, except that it defines the abbreviations using
-\ics{newglossaryentry} instead of \ics{newacronym}. As with the
-previous example, the glossary is added to the table of contents, so
-an extra run through \LaTeX\ is required:
-\begin{prompt}
-latex sampleDesc
-makeglossaries sampleDesc
-latex sampleDesc
-latex sampleDesc
-\end{prompt}
+\section{Introduction}
+Sample document about \glspl{function} and \glspl{set}.
-\exitem{CustomAcr} This document has some sample abbreviations with a
-custom acronym style. It also adds the glossary to the table of
-contents, so an extra run through \LaTeX\ is required:
-\begin{prompt}
-latex sampleCustomAcr
-makeglossaries sampleCustomAcr
-latex sampleCustomAcr
-latex sampleCustomAcr
-\end{prompt}
+\termdef{set}
-\exitem{FnAcrDesc} This is similar to \samplefile{AcrDesc}, except that it
-uses the \acrstyle{footnote-sc-desc} style. As with the previous example,
-the glossary is added to the table of contents, so an extra run through
-\LaTeX\ is required:
-\begin{prompt}
-latex sampleFnAcrDesc
-makeglossaries sampleFnAcrDesc
-latex sampleFnAcrDesc
-latex sampleFnAcrDesc
-\end{prompt}
+More detailed information about \glspl{set} with examples.
-\exitem{-FnDesc} This example
-defines a custom display format that puts the description in a
-footnote on first use.
-\begin{prompt}
-latex sample-FnDesc
-makeglossaries sample-FnDesc
-latex sample-FnDesc
-\end{prompt}
+\termdef{function}
-\exitem{-custom-acronym}
-This document illustrates how to define your own acronym style if
-the predefined styles don't suit your requirements.
-\begin{prompt}
-latex sample-custom-acronym
-makeglossaries sample-custom-acronym
-latex sample-custom-acronym
-\end{prompt}
+More detailed information about \glspl{function} with examples.
-\exitem{-crossref}
-This document illustrates how to cross-reference entries in the
-glossary.
-\begin{prompt}
-latex sample-crossref
-makeglossaries sample-crossref
-latex sample-crossref
-\end{prompt}
-
-\exitem{-dot-abbr} This document illustrates how to use the
-post link hook to adjust the space factor after abbreviations.
-\begin{prompt}
-latex sample-dot-abbr
-makeglossaries sampledot-abbrf
-latex sample-dot-abbr
-\end{prompt}
-
-\exitem{DB} This document illustrates how
-to load external files containing the glossary definitions. It also
-illustrates how to define a new glossary type. This document has the
-\gls{numberlist} suppressed and uses \ics{glsaddall} to add all
-the entries to the glossaries without referencing each one
-explicitly. To create the document do:
-\begin{prompt}
-latex sampleDB
-makeglossaries sampleDB
-latex sampleDB
-\end{prompt}
-or
-\begin{prompt}
-latex sampleDB
-makeglossaries-lite sampleDB
-latex sampleDB
-\end{prompt}
-The glossary definitions are stored in the accompanying files
-\texttt{database1.tex} and \texttt{database2.tex}. If for some
-reason you want to call \gls{makeindex} explicitly you must
-have a separate call for each glossary:
-\begin{enumerate}
-\item Create the main glossary (all on one line):
-\begin{prompt}\raggedright
-makeindex -s sampleDB.ist -t sampleDB.glg -o sampleDB.gls sampleDB.glo
-\end{prompt}
-\item Create the secondary glossary (all on one line):
-\begin{prompt}\raggedright
-makeindex -s sampleDB.ist -t sampleDB.nlg -o sampleDB.not sampleDB.ntn
-\end{prompt}
-Note that both \gls{makeglossaries} and \gls{makeglossaries-lite.lua} do
-this all in one call, so they not only make it easier because you
-don't need to supply all the switches and remember all the
-extensions but they also call \gls{makeindex} the appropriate number of times.
-\end{enumerate}
-
-\exitem{Eq} This document illustrates how
-to change the location to something other than the page number. In
-this case, the \texttt{equation} counter is used since all glossary
-entries appear inside an \env{equation} environment. To create
-the document do:
-\begin{prompt}
-latex sampleEq
-makeglossaries sampleEq
-latex sampleEq
-\end{prompt}
+\end{document}
+\end{verbatim}
+Or you can use \gls{bib2gls} if you want to manage a large
+database of terms. For example (requires \gls{glossaries-extra} v1.42, see below):
+\begin{alltt}
+\cs{documentclass}\mgroup{article}
-\exitem{EqPg} This is similar to the
-previous example, but the \glspl{numberlist} are a
-mixture of page numbers and equation numbers. This example adds the
-glossary to the table of contents, so an extra \LaTeX\ run is
-required:
-\begin{prompt}
-latex sampleEqPg
-makeglossaries sampleEqPg
-latex sampleEqPg
-latex sampleEqPg
-\end{prompt}
+\cs{usepackage}[colorlinks]\mgroup{hyperref}
+\cs{usepackage}[\xtrfont{record},
+ nostyles\% <- no glossary styles are required
+ ]\mgroup{glossaries-extra}
-\exitem{Sec} This document also
-illustrates how to change the location to something other than the
-page number. In this case, the \texttt{section} counter is used.
-This example adds the glossary to the table of contents, so an extra
-\LaTeX\ run is required:
-\begin{prompt}
-latex sampleSec
-makeglossaries sampleSec
-latex sampleSec
-latex sampleSec
-\end{prompt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=terms,\resourceopt{sort}=none,\resourceopt{save-locations}=false]
-\exitem{Ntn} This document illustrates
-how to create an additional glossary type. This example adds the
-glossary to the table of contents, so an extra \LaTeX\ run is
-required:
-\begin{prompt}
-latex sampleNtn
-makeglossaries sampleNtn
-latex sampleNtn
-latex sampleNtn
-\end{prompt}
-Note that if you want to call \gls{makeindex} explicitly instead of
-using \gls{makeglossaries} or \gls{makeglossaries-lite.lua} then you
-need to call \gls{makeindex} twice:
-\begin{enumerate}
-\item Create the main glossary (all on one line):
-\begin{prompt}\raggedright
-makeindex -s sampleNtn.ist -t sampleNtn.glg -o sampleNtn.gls sampleNtn.glo
-\end{prompt}
-\item Create the secondary glossary (all on one line):
-\begin{prompt}\raggedright
-makeindex -s sampleNtn.ist -t sampleNtn.nlg -o sampleNtn.not sampleNtn.ntn
-\end{prompt}
-\end{enumerate}
+\cs{newcommand}*\mgroup{\cs{termdef}}[1]\mgroup{\%
+ \cs{section}\mgroup{\ics*{glsxtrglossentry}\mgroup{\#1} \strong{\ics{glossentrysymbol}}\mgroup{\#1}}\%
+ \ics{glsadd}\mgroup{\#1}\% <- index this entry
+ \cs{begin}\mgroup{quote}\cs{em}\ics{Glsentrydesc}\mgroup{\#1}.\cs{end}\mgroup{quote}\%
+}
+\end{alltt}
+\begin{verbatim}
+\begin{document}
+\tableofcontents
-\exitem{} This document illustrates some of
-the basics, including how to create child entries that use the same
-name as the parent entry. This example adds the glossary to the
-table of contents and it also uses \ics{glsrefentry}, so an extra \LaTeX\
-run is required:
-\begin{prompt}
-latex sample
-makeglossaries sample
-latex sample
-latex sample
-\end{prompt}
-You can see the difference between word and letter ordering if you
-substitute \pkgopt[word]{order} with \pkgopt[letter]{order}. (Note
-that this will only have an effect if you use
-\gls{makeglossaries} or \gls{makeglossaries-lite.lua}.
-If you use \gls{makeindex} explicitly, you will need to use the
-\mkidxopt{l} switch to indicate letter ordering.)
+\section{Introduction}
+Sample document about \glspl{function} and \glspl{set}.
-\exitem{-inline} This document is
-like \texttt{sample.tex}, above, but uses the \glostyle{inline}
-glossary style to put the glossary in a footnote.
+\termdef{set}
-\exitem{tree} This document illustrates
-a hierarchical glossary structure where child entries have different
-names to their corresponding parent entry. To create the document
-do:
-\begin{prompt}
-latex sampletree
-makeglossaries sampletree
-latex sampletree
-\end{prompt}
+More detailed information about \glspl{set} with examples.
-\exitem{-dual} This document
-illustrates how to define an entry that both appears in the list of
-acronyms and in the main glossary. To create the document do:
-\begin{prompt}
-latex sample-dual
-makeglossaries sample-dual
-latex sample-dual
-\end{prompt}
+\termdef{function}
-\exitem{-langdict} This document
-illustrates how to use the glossaries package to create English
-to French and French to English dictionaries. To create the document
-do:
-\begin{prompt}
-latex sample-langdict
-makeglossaries sample-langdict
-latex sample-langdict
-\end{prompt}
+More detailed information about \glspl{function} with examples.
-\exitem{xdy} This document illustrates
-how to use the \styfmt{glossaries} package with \gls{xindy} instead
-of \gls{makeindex}. The document uses UTF8 encoding (with the
-\sty{inputenc} package). The encoding is picked up by
-\gls{makeglossaries}. By default, this document will create a
-\gls{xindy} style file called \texttt{samplexdy.xdy}, but if you
-uncomment the lines
-\begin{verbatim}
-\setStyleFile{samplexdy-mc}
-\noist
-\GlsSetXdyLanguage{}
+\end{document}
\end{verbatim}
-it will set the style file to \texttt{samplexdy-mc.xdy} instead.
-This provides an additional letter group for entries starting with
-\qt{Mc} or \qt{Mac}. If you use \gls{makeglossaries} or
-\gls{makeglossaries-lite.lua}, you don't
-need to supply any additional information. If you don't use
-\gls*{makeglossaries}, you will need to specify the required
-information. Note that if you set the style file to
-\texttt{samplexdy-mc.xdy} you must also specify \ics{noist},
-otherwise the \styfmt{glossaries} package will overwrite
-\texttt{samplexdy-mc.xdy} and you will lose the \qt{Mc} letter
-group.
-
-To create the document do:
-\begin{prompt}
-latex samplexdy
-makeglossaries samplexdy
-latex samplexdy
-\end{prompt}
-If you don't have Perl installed then you can't use
-\gls{makeglossaries}, but you also can't use \gls{xindy}!
-However, if for some reason you want to call
-\gls{xindy} explicitly instead of using \gls{makeglossaries} (or
-\gls{makeglossaries-lite.lua}):
-\begin{itemize}
-\item if you are using the default style file \texttt{samplexdy.xdy}, then
-do (no line breaks):
-\begin{prompt}\raggedright
-xindy -L english -C utf8 -I xindy -M samplexdy -t samplexdy.glg -o samplexdy.gls samplexdy.glo
-\end{prompt}
-\item if you are using \texttt{samplexdy-mc.xdy}, then do
-(no line breaks):
-\begin{prompt}\raggedright
-xindy -I xindy -M samplexdy-mc -t samplexdy.glg -o samplexdy.gls samplexdy.glo
-\end{prompt}
-\end{itemize}
-
-\exitem{xdy2} This document illustrates
-how to use the \styfmt{glossaries} package where the location
-numbers don't follow a standard format. This example will only work
-with \gls{xindy}. To create the document do:
-\begin{prompt}
-pdflatex samplexdy2
-makeglossaries samplexdy2
-pdflatex samplexdy2
-\end{prompt}
-The explicit \gls{xindy} call is:
-\begin{prompt}\raggedright
-xindy -L english -C utf8 -I xindy -M samplexdy2 -t samplexdy2.glg -o samplexdy2.gls samplexdy2.glo
-\end{prompt}
-See \sectionref{sec:xindyloc} for further details.
-
-\exitem{xdy3} This document is like \samplefile{xdy} but uses the
-command \cs{Numberstring} from the \sty{fmtcount} package to
-format the page numbers.
-
-\exitem{utf8} This is another example
-that uses \gls{xindy}. Unlike \gls{makeindex},
-\gls{xindy} can cope with \glspl{nonlatinchar}. This
-document uses UTF8 encoding. To create the document do:
+Where the file \texttt{terms.bib} contains:
+\begin{alltt}
+\atentry{entry}\mgroup{set,
+ name=\mgroup{set},
+ description=\mgroup{a collection of any kind of objects},
+ symbol=\mgroup{\cs{ensuremath}\mgroup{\cs{mathcal}\mgroup{S}}}
+}
+\atentry{entry}\mgroup{function,
+ name=\mgroup{function},
+ description=\mgroup{a rule that assigns every element in the domain
+ \cs{gls}\mgroup{set} to an element in the range \cs{gls}\mgroup{set}},
+ symbol=\mgroup{\cs{ensuremath}\mgroup{f(x)}}
+}
+\end{alltt}
+The advantage in this approach (with \ics{loadglsentries} or
+\gls{bib2gls}) is that you can use an existing database of
+entries shared across multiple documents, ensuring consistent
+notation for all of them.
+
+In both cases, there's no need to load all the glossary styles
+packages, as they're not required, so I've used the
+\pkgopt{nostyles} package option to prevent them from being loaded.
+
+In the first case, you need the \pkgopt[none]{sort} package option
+(as in \opt5) and then define the terms in the preamble. No external tool is
+required. Just run \LaTeX\ as normal. (Twice to ensure that the
+table of contents is up to date.)
\begin{prompt}
-latex sampleutf8
-makeglossaries sampleutf8
-latex sampleutf8
-\end{prompt}
-The explicit \gls{xindy} call is
-(no line breaks):
-\begin{prompt}\raggedright
-xindy -L english -C utf8 -I xindy -M sampleutf8 -t sampleutf8.glg -o sampleutf8.gls sampleutf8.glo
+pdflatex myDoc
+pdflatex myDoc
\end{prompt}
-If you remove the \pkgopt{xindy} option from \texttt{sampleutf8.tex}
-and do:
-\begin{prompt}
-latex sampleutf8
-makeglossaries sampleutf8
-latex sampleutf8
-\end{prompt}
-or
-\begin{prompt}
-latex sampleutf8
-makeglossaries-lite sampleutf8
-latex sampleutf8
-\end{prompt}
-you will see that the entries that start with an \gls{exlatinchar}
-now appear in the symbols group, and the word \qt{man\oe uvre} is now
-after \qt{manor} instead of before it. If you want to explicitly
-call \gls{makeindex} (no line breaks):
-\begin{prompt}\raggedright
-makeindex -s sampleutf8.ist -t sampleutf8.glg -o sampleutf8.gls sampleutf8.glo
-\end{prompt}
+In the second case, you need the \pkgopt*{record} package
+option (as in \opt4) since \gls{bib2gls} is needed to select the
+required entries, but you don't need a sorted list:
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=\mgroup{terms},\strong{\xtrfont{sort}=none}]
+\end{alltt}
+This will ensure that any entries indexed in the document (through
+commands like \ics{gls} or \ics{glsadd}) will be selected by
+\gls{bib2gls}, but it will skip the sorting step.
+(The chances are you probably also won't need location lists either.
+If so, you can add the option \resourceopt[false]{save-locations}.)
-\exitem{-index} This document uses
-the \styfmt{glossaries} package to create both a glossary and an
-index. This requires two \gls{makeglossaries} (or
-\gls{makeglossaries-lite.lua}) calls to ensure the
-document is up to date:
+Remember that for this second case you need to run \gls{bib2gls} as per \opt4:
\begin{prompt}
-latex sample-index
-makeglossaries sample-index
-latex sample-index
-makeglossaries sample-index
-latex sample-index
+pdflatex myDoc
+bib2gls myDoc
+pdflatex myDoc
+pdflatex myDoc
\end{prompt}
-\exitem{-newkeys} This document illustrates how add custom keys
-(using \cs{glsaddkey}).
-
-\exitem{-storage-abbr} This document illustrates how add custom
-storage keys (using \cs{glsaddstoragekey}).
-
-\exitem{-storage-abbr-desc} An extension of the previous example
-where the user needs to provide a~description.
+For both cases (with or without \gls{bib2gls}), instead of listing
+all the entries using \xtrcs{printunsrtglossary}, you use
+\ics*{glsxtrglossentry}\marg{label} where you want the name (and
+anchor with \sty{hyperref}) to appear in the document. This will
+allow the \gls{linktext} created by commands like \cs{gls} to link
+to that point in the document. The description can simply be
+displayed with \ics{glsentrydesc}\marg{label} or
+\ics{Glsentrydesc}\marg{label}, as in the above examples. In both
+examples, I've defined a custom command \cs{termdef} to simplify the
+code and ensure consistency. Extra styling, such as placing the
+description in a coloured frame, can be added to this custom
+definition as required.
+
+(Instead of using \cs{glsentrydesc} or \cs{Glsentrydesc}, you can use
+\ics{glossentrydesc}\marg{label}, which will obey attributes such as
+\attr{glossdesc} and \attr{glossdescfont}. See the \gls{glossaries-extra}
+manual for further details.)
-\exitem{-chap-hyperfirst} This document illustrates how to add
-a~custom key using \cs{glsaddstoragekey} and hook into the \glslike\
-and \glstextlike\ mechanism used to determine whether or not to
-hyperlink an entry.
+The symbol (if required) can be displayed with either
+\ics{glsentrysymbol}\marg{label} or \ics{glossentrysymbol}\marg{label}.
+In the first example, I've used \cs{glsentrysymbol}. In the
+second I've used \ics{glossentrysymbol}. The latter is
+necessary with \gls{bib2gls} if the symbol needs to go in a
+section title as the entries aren't defined on the first \LaTeX\ run.
+
+In normal document text, \cs{glsentrysymbol} will silently do nothing
+if the entry hasn't been defined, but when used in a section heading
+it will expand to an undefined internal command when written to the
+\filetype{aux} file, which triggers an error.
+
+The \ics{glossentrysymbol} command performs an existence check,
+which triggers a warning if the entry is undefined. (All entries
+will be undefined before the first \gls{bib2gls} call.) You need at
+least \gls{glossaries-extra} v1.42 to use this command in a section
+title.\footnote{\cs{glossentrysymbol} is defined by the base
+\styfmt{glossaries} package but is redefined by
+\gls{glossaries-extra}.} If \sty{hyperref} has been loaded, this
+will use \ics{texorpdfstring} to allow a simple expansion for the
+PDF bookmarks (see the \gls{glossaries-extra} user manual for
+further details).
-\exitem{-font-abbr} This document illustrates how to different fonts
-for abbreviations within the style.
+If you want to test if the \gloskey{symbol} field has been set, you
+need to use \ics{ifglshassymbol} outside of the section title. For
+example:
+\begin{alltt}
+\cs{ifglshassymbol}\mgroup{\#1}\%
+\mgroup{\cs{section}\mgroup{\xtrcs{glsxtrglossentry}\mgroup{\#1} \cs{glossentrysymbol}\mgroup{\#1}}}
+\mgroup{\cs{section}\mgroup{\xtrcs{glsxtrglossentry}\mgroup{\#1}}}
+\end{alltt}
-\exitem{-numberlist} This document illustrates how to reference the
-\gls{numberlist} in the document text. This requires an additional
-\LaTeX\ run:
-\begin{prompt}
-latex sample-numberlist
-makeglossaries sample-numberlist
-latex sample-numberlist
-latex sample-numberlist
-\end{prompt}
+In both of the above examples, the section titles start with a lowercase
+character (because the \gloskey{name} value is all lowercase in
+entry definitions). You can apply automatic case-change with the
+\attr{glossname} attribute. For example:
+\begin{alltt}
+\ics*{glssetcategoryattribute}\mgroup{general}\mgroup{glossname}\mgroup{firstuc}
+\end{alltt}
+or (for title-case)
+\begin{alltt}
+\ics*{glssetcategoryattribute}\mgroup{general}\mgroup{glossname}\mgroup{title}
+\end{alltt}
+However, this won't apply the case-change in the table of contents
+or bookmarks.
-\exitem{People} This document illustrates how you can hook into the
-standard sort mechanism to adjust the way the sort key is set. This
-requires an additional run to ensure the table of contents is
-up-to-date:
-\begin{prompt}
-latex samplePeople
-makeglossaries samplePeople
-latex samplePeople
-latex samplePeople
-\end{prompt}
+In the second example, you can instead use \gls{bib2gls} to apply a
+case-change:
+\begin{alltt}
+\cs{GlsXtrLoadResources}[\resourceopt{src}=terms,
+ \resourceopt{sort}=none,\resourceopt{save-locations}=false\strong{,
+ \resourceopt{replicate-fields}=\mgroup{name=text},
+ \xtrfont{name-case-change}=firstuc}
+]
+\end{alltt}
+(Or \resourceopt[title]{name-case-change} for title-case.)
+This copies the \gloskey{name} value to the \gloskey{text} field and
+then applies a case-change to the \gloskey{name} field (leaving the
+\gloskey{text} field unchanged). The name in the section titles now
+starts with a capital but the \gls{linktext} produced by commands like
+\ics{gls} is still lowercase.
+
+In the first example (without \gls{bib2gls}) you need to do this
+manually. For example:
+\begin{alltt}
+\cs{newglossaryentry}\mgroup{set}\mgroup{name=\mgroup{\strong{S}et},\strong{text=\mgroup{set}},
+ description=\mgroup{a collection of any kind of objects},
+ symbol=\mgroup{\cs{ensuremath}\mgroup{\cs{mathcal}\mgroup{S}}}
+}
+\end{alltt}
-\exitem{Sort} This is another document that illustrates how to hook
-into the standard sort mechanism. An additional run is required to
-ensure the table of contents is up-to-date:
+Note that if you use the default \resourceopt[true]{save-locations}
+with \gls{bib2gls}, it's possible to combine \optsand46 to have both standalone
+definitions and an index. Now I do need a glossary style. In this
+case I'm going to use \xtrglostyle{bookindex}, which is provided in
+the \sty{glossary-bookindex} package (bundled with
+\gls{glossaries-extra}). I don't need any of the other style
+packages, so I can still keep the \pkgopt{nostyles} option and just
+load \sty{glossary-bookindex}:
+\begin{alltt}
+\cs{usepackage}[\xtrfont{record=nameref},\% <- using bib2gls
+ nostyles,\% <- don't load default style packages
+ \xtrfont{stylemods=bookindex},\% <- load glossary-bookindex.sty
+ style=\xtrfont{bookindex}\% <- set the default style to 'bookindex'
+]\mgroup{glossaries-extra}
+\end{alltt}
+I also need to sort the entries, so the resource command is now:
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=terms,\% definitions in terms.bib
+ \resourceopt{sort}=en-GB,\% sort by this locale
+ \resourceopt{replicate-fields}=\mgroup{name=text},
+ \xtrfont{name-case-change}=\mgroup{firstuc}
+]
+\end{alltt}
+At the end of the document, I can add the glossary:
+\begin{alltt}
+\ics*{printunsrtglossary}[title=Index,target=false]
+\end{alltt}
+Note that I've had to switch off the hypertargets with
+\xtrprintglosskey[false]{target} (otherwise there would be duplicate
+targets). If you want letter group headings you need to use the
+\bibglslongopt{group} switch:
\begin{prompt}
-latex sampleSort
-makeglossaries sampleSort
-latex sampleSort
-latex sampleSort
+bib2gls -{}-group myDoc
\end{prompt}
+or if you are using \app{arara}:
+\begin{alltt}
+\% arara: bib2gls: \mgroup{ group: on }
+\end{alltt}
-\exitem{-nomathhyper} This document illustrates how to selectively
-enable and disable entry hyperlinks in \ics{glsentryfmt}.
-
-\exitem{-entryfmt} This document illustrates how to change the
-way an entry is displayed in the text.
-
-\exitem{-prefix} This document illustrates the use of the
-\sty{glossaries-prefix} package. An additional run is required to
-ensure the table of contents is up-to-date:
-\begin{prompt}
-latex sample-prefix
-makeglossaries sample-prefix
-latex sample-prefix
-latex sample-prefix
-\end{prompt}
+The \xtrglostyle{bookindex} style doesn't show the
+description, so only the name and location is displayed. Remember
+that the name has had a case-conversion so it now starts with an
+initial capital. If you feel this is inappropriate for the index,
+you can adjust the \xtrglostyle{bookindex} style so that it uses
+the \gloskey{text} field instead. For example:
+\begin{alltt}
+\cs{renewcommand}*\mgroup{\ics*{glsxtrbookindexname}}[1]\mgroup{\%
+ \ics*{glossentrynameother}\mgroup{\#1}\mgroup{text}}
+\end{alltt}
+See the \gls{glossaries-extra} user manual for further details about
+this style.
-\exitem{accsupp} This document
-uses the experimental \sty{glossaries-accsupp} package. The
-symbol is set to the replacement text. Note that some PDF
-viewers don't use the accessibility support. Information
-about the \styfmt{glossaries-accsupp} package can be found in
-\sectionref{sec:accsupp}.
+Note that on the first \LaTeX\ run none of the entries will be
+defined. Once they are defined, the page numbers may shift due to
+the increased amount of document text. You may therefore need to
+repeat the document build to ensure the page numbers are correct.
-\exitem{-ignored} This document defines an ignored glossary for
-common terms that don't need a definition.
+If there are extra terms that need to be included in the index that
+don't have a description, you can define them with \atentry{index}
+in the \filetype{bib} file. For example:
+\begin{alltt}
+\atentry{index}\mgroup{element}
+\atentry{index}\mgroup{member,\xtrgloskey{alias}=\mgroup{element}}
+\end{alltt}
+They can be used in the document as usual:
+\begin{verbatim}
+The objects that make up a set are the \glspl{element}
+or \glspl{member}.
+\end{verbatim}
+See \bibglsbegin\ or the \gls{bib2gls} user manual for further
+details.
-\exitem{-entrycount} This document uses \ics{glsenableentrycount}
-and \ics{cgls} (described in \sectionref{sec:enableentrycount})
-so that acronyms only used once don't appear in the list of
-acronyms.
-\end{samplelist}
+The \styfmt{glossaries} package comes with a number of sample
+documents that illustrate the various functions. These are listed in
+\sectionref{sec:samples}.
\section{Dummy Entries for Testing}
\label{sec:lipsum}
-In addition to the sample files described above, \sty{glossaries} also provides
-some files containing lorum ipsum dummy entries. These are provided
-for testing purposes and are on \TeX's path (in
-\texttt{tex\slash latex\slash glossaries\slash test-entries}) so they can be included
-via \ics{input} or \ics{loadglsentries}. The files are as follows:
+In addition to the sample files described above, \sty{glossaries}
+also provides some files containing lorum ipsum dummy entries. These
+are provided for testing purposes and are on \TeX's path (in
+\texttt{tex\slash latex\slash glossaries\slash test-entries}) so
+they can be included via \ics{input} or \ics{loadglsentries}. The
+\gls{glossaries-extra} package provides \filetype{bib} versions of
+all these files for use with \gls{bib2gls}. The files are as
+follows:
+
\begin{description}
\item[example-glossaries-brief.tex] These entries all have brief
descriptions. For example:
@@ -1920,7 +2155,15 @@ mauris.}}
\end{verbatim}
\item[example-glossaries-multipar.tex] These entries all have
-multi-paragraph descriptions.
+multi-paragraph descriptions. For example:
+\begin{verbatim}
+\longnewglossaryentry{loremi-ii}{name={lorem 1--2}}%
+{%
+Lorem ipsum ...
+
+Nam dui ligula...
+}
+\end{verbatim}
\item[example-glossaries-symbols.tex] These entries all use the
\gloskey{symbol} key. For example:
@@ -1943,6 +2186,17 @@ description={Quisque ullamcorper placerat ipsum.}}
\gloskey{user1} key to store the name of an image file. (The images
are provided by the \sty{mwe} package and should be on \TeX's path.)
One entry doesn't have an associated image to help test for a~missing key.
+The descriptions are long to allow for tests with the text wrapping
+around the image. For example:
+\begin{verbatim}
+\longnewglossaryentry{sedfeugiat}{name={sed feugiat},
+user1={example-image}}%
+{%
+Cum sociis natoque...
+
+Etiam...
+}
+\end{verbatim}
\item[example-glossaries-acronym.tex] These entries are all
abbreviations. For example:
@@ -1950,8 +2204,20 @@ abbreviations. For example:
\newacronym[type=\glsdefaulttype]{lid}{LID}{lorem ipsum
dolor}
\end{verbatim}
+\begin{xtr}
+If you use the \gls{glossaries-extra} extension package, then
+\ics{newacronym} is redefined to use \ics*{newabbreviation}
+with the \xtrgloskey{category} key set to \texttt{acronym} (rather
+than the default \texttt{abbreviation}). This means that you need to
+set the abbreviation style for the \texttt{acronym} category. For
+example:
+\begin{verbatim}
+\setabbreviationstyle[acronym]{long-short}
+\end{verbatim}
+\end{xtr}
-\item[example-glossaries-acronym-desc.tex] These entries are all
+\item[example-glossaries-acronym-desc.tex] This file contains
+entries that are all
abbreviations that use the \gloskey{description} key.
For example:
\begin{verbatim}
@@ -1959,6 +2225,17 @@ For example:
description={fringilla a, euismod sodales,
sollicitudin vel, wisi}]{ndl}{NDL}{nam dui ligula}
\end{verbatim}
+\begin{xtr}
+If you use the \gls{glossaries-extra} extension package, then
+\ics{newacronym} is redefined to use \ics*{newabbreviation}
+with the \xtrgloskey{category} key set to \texttt{acronym} (rather
+than the default \texttt{abbreviation}). This means that you need to
+set the abbreviation style for the \texttt{acronym} category. For
+example:
+\begin{verbatim}
+\setabbreviationstyle[acronym]{long-short-desc}
+\end{verbatim}
+\end{xtr}
\item[example-glossaries-acronyms-lang.tex] These entries are all
abbreviations, where some of them have a~translation supplied in the
@@ -1968,6 +2245,17 @@ For example:
\newacronym[type=\glsdefaulttype,user1={love itself}]
{li}{LI}{lorem ipsum}
\end{verbatim}
+\begin{xtr}
+If you use the \gls{glossaries-extra} extension package, then
+\ics{newacronym} is redefined to use \ics*{newabbreviation}
+with the \xtrgloskey{category} key set to \texttt{acronym} (rather
+than the default \texttt{abbreviation}). This means that you need to
+set the abbreviation style for the \texttt{acronym} category. For
+example:
+\begin{verbatim}
+\setabbreviationstyle[acronym]{long-short-user}
+\end{verbatim}
+\end{xtr}
\item[example-glossaries-parent.tex] These are hierarchical entries
where the child entries use the \gloskey{name} key.
@@ -1986,6 +2274,9 @@ For example:
\begin{verbatim}
\newglossaryentry{scelerisque}{name={scelerisque},
description={at}}
+
+\newglossaryentry{vestibulum}{parent={scelerisque},
+ description={eu, nulla}}
\end{verbatim}
\item[example-glossaries-cite.tex] These entries use the
@@ -2010,22 +2301,52 @@ For example:
\end{verbatim}
\end{description}
-The sample file \texttt{glossary-lipsum-examples.tex} in the
+The sample file \mirrorsamplefile{glossary-lipsum-examples.tex} in the
\texttt{doc\slash latex\slash glossaries\slash samples} directory
-uses all these files. See also
-\url{http://www.dickimaw-books.com/gallery/#glossaries}.
-The \sty{glossaries-extra} package provides additional test files.
+uses all these files. See also \gallerytopic{glossaries}.
+
+\glsxtrnote
+The \gls{glossaries-extra} package provides the additional test
+file:
+\begin{description}
+\item[example-glossaries-xr.tex] These entries use the \gloskey{see}
+key provided by the base \styfmt{glossaries} package and also the
+\xtrgloskey{alias} and \xtrgloskey{seealso} keys that require
+\gls{glossaries-extra}. For example:
+\begin{verbatim}
+\newglossaryentry{alias-lorem}{name={alias-lorem},
+ description={ipsum},alias={lorem}}
+
+\newglossaryentry{amet}{name={amet},description={consectetuer},
+ see={dolor}}
+
+\newglossaryentry{arcu}{name={arcu},description={libero},
+ seealso={placerat,vitae,curabitur}}
+\end{verbatim}
+\end{description}
\section{Multi-Lingual Support}
\label{sec:languages}
+\begin{important}
+The \styfmt{glossaries} package uses the \styfmt{tracklang} package
+to determine the document languages. Unfortunately, because there
+isn't a standard language identification framework provided with
+\LaTeX, \styfmt{tracklang} isn't always able to detect the selected
+languages either as a result of using an unknown interface or where
+the interface doesn't provide a way of detecting the language.
+See
+\href{https://www.dickimaw-books.com/latex/tracklang/}{Localisation
+with \texttt{tracklang.tex}} for further details.
+\end{important}
+
As from version 1.17, the \styfmt{glossaries} package can be
used with \gls{xindy} as well as \gls{makeindex}. If you
are writing in a language that uses an \gls{exlatinalph} or
\gls{nonlatinalph} it's best to use \opt3 (\gls*{xindy})
or \opt4 (\gls{bib2gls})
as \gls*{makeindex} (\opt2) is hard-coded for the non-extended
-\gls{latinalph} and \opt1 can performed limited ASCII comparisons.
+\gls{latinalph} and \opt1 can only perform limited ASCII comparisons.
This means that with \optsor34 you are not restricted to the A,
\ldots, Z letter groups. If you want to use \gls*{xindy}, remember
@@ -2038,13 +2359,13 @@ to use the \pkgopt{xindy} package option. For example:
\usepackage[xindy]{glossaries}
\end{verbatim}
If you want to use \gls*{bib2gls}, you need to use the
-\pkgopt{record} option with \sty{glossaries-extra} and supply the
-definitions in \texttt{.bib} files. (See the \gls{bib2gls} user
+\pkgopt*{record} option with \gls{glossaries-extra} and supply the
+definitions in \filetype{bib} files. (See the \gls{bib2gls} user
manual for further details.)
\begin{important}
Note that although a~\gls{nonlatinchar}, such as \'e, looks like a plain
-character in your \filetype{.tex} file, with standard \LaTeX\ it's actually a~macro and can therefore
+character in your \filetype{tex} file, with standard \LaTeX\ it's actually a~macro and can therefore
cause expansion problems. You may need to switch off the field
expansions with \cs{glsnoexpandfields}. This issue doesn't occur
with \XeLaTeX\ or Lua\LaTeX.
@@ -2055,17 +2376,15 @@ character at the start of an entry name, you must place it in a group,
or it will cause a problem for commands that convert the first letter
to upper case (e.g.\ \ics{Gls}). For example:
\begin{alltt}
-\verb|\newglossaryentry}{elite}{name={{|\'e\verb|}lite},|
-description=\verb|{select group or class}}|
+\cs{newglossaryentry}\mgroup{elite}\mgroup{name=\mgroup{\mgroup{\'e}lite},
+description=\mgroup{select group or class}}
\end{alltt}
-(With newer versions of \sty{mfirstuc} and \sty{datatool-base} you
-may be able to omit this grouping.)
For further details, see the \qt{UTF-8} section in the
\sty{mfirstuc} user manual.
If you are using \gls{xindy} or \gls{bib2gls}, the application needs
-to know the encoding of the \filetype{.tex} file. This information
-is added to the \filetype{.aux} file and can be picked up by
+to know the encoding of the \filetype{tex} file. This information
+is added to the \filetype{aux} file and can be picked up by
\gls{makeglossaries} and \gls{bib2gls}. If you use
\gls{xindy} explicitly instead of via \gls*{makeglossaries},
you may need to specify the encoding using the \xdyopt{C}
@@ -2073,7 +2392,8 @@ option. Read the \gls*{xindy} manual for further details of this
option.
As from v4.24, if you are writing in German (for example, using the \sty{ngerman}
-package\footnote{deprecated, use \styfmt{babel} instead} or \sty{babel} with the \pkgopt{ngerman} package option),
+package\footnote{deprecated, use \styfmt{babel} instead} or
+\sty{babel} with the \pkgoptfmt{ngerman} package option),
and you want to use \gls{makeindex}['s] \mkidxopt{g} option, you'll
need to change \gls{makeindex}['s] quote character using:
\begin{definition}[\DescribeMacro\GlsSetQuote]
@@ -2126,8 +2446,8 @@ in entry definitions. For example:
\end{verbatim}
The \sty{ngerman} package has the shorthands on in the preamble, so
-they can be used if \cs{GlsSetQuote} has changed the \gls{makeindex}
-quote character. Example:
+they can be used in definitions if \cs{GlsSetQuote} has been used to
+change the \gls{makeindex} quote character. Example:
\begin{verbatim}
\documentclass{article}
@@ -2156,7 +2476,7 @@ The fixed names are produced using the commands listed in
package such as \sty{babel} or \sty{polyglossia} that uses caption
hooks, you can just redefine these commands as appropriate. If you
are using \sty{babel} or \sty{polyglossia}, you need to use their
-caption hooks to change the defaults. See \urlref{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=latexwords}{changing
+caption hooks to change the defaults. See \href{https://texfaq.org/FAQ-latexwords}{changing
the words babel uses} or read the \sty{babel} or \sty{polyglossia}
documentation. If you have loaded \sty{babel}, then \sty{glossaries}
will attempt to load \sty{translator}, unless you have used the
@@ -2239,7 +2559,9 @@ Examples of use:
\usepackage{babel}
\usepackage[translate=babel]{glossaries}
\end{verbatim}
-(\sty{translator} isn't loaded).
+(\sty{translator} isn't loaded). The \gls{glossaries-extra} package
+has \pkgopt[babel]{translate} as the default if \sty{babel} has been
+loaded.
\item Using \sty{polyglossia}:
\begin{verbatim}
@@ -2254,7 +2576,7 @@ Examples of use:
Due to the varied nature of glossaries, it's likely that the
predefined translations may not be appropriate. If you are using the
\sty{babel} package and the \styfmt{glossaries} package option \pkgopt[babel]{translate}, you need to be familiar with the advice given in
-\urlref{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=latexwords}{changing
+\href{https://texfaq.org/FAQ-latexwords}{changing
the words babel uses}. If you are using the \sty{translator}
package, then you can provide your own dictionary with the necessary
modifications (using \cs{deftranslation}) and load it using
@@ -2326,8 +2648,8 @@ to create a new language module, you should first read the
\sty{tracklang} documentation.
To create a new language module, you need to at least create two
-files: \texttt{glossaries-}\meta{lang}\texttt{.ldf} and
-\texttt{glossaries-dictionary-}\meta{Lang}\texttt{.dict} where
+files called: \texttt{glossaries\dhyphen}\meta{lang}\texttt{.}\filetype{ldf} and
+\texttt{glossaries-dictionary-}\meta{Lang}\texttt{.}\filetype{dict} where
\meta{lang} is the root language name (for example,
\texttt{english}) and \meta{Lang} is the language name used by
\sty{translator} (for example, \texttt{English}).
@@ -2348,7 +2670,7 @@ Here's an example of \texttt{glossaries-dictionary-English.dict}:
You can use this as a template for your dictionary file. Change
\texttt{English} to the \sty{translator} name for your language
(so that it matches the file name
-\texttt{glossaries-dictionary-}\meta{Lang}\texttt{.dict})
+\texttt{glossaries\dhyphen dictionary\dhyphen }\meta{Lang}\texttt{.dict})
and, for each \cs{providetranslation}, change the second argument to
the appropriate translation.
@@ -2419,21 +2741,22 @@ definition of \cs{glossariescaptions}\meta{lang}, replace the
English text (such as \qt{Glossaries}) with the appropriate
translation.
+\importantpar
\label{pluralsuffix}%
-\textbf{Note:} the suffixes used to generate the plural forms when
-the plural hasn't been specified are given by
-\cs{glspluralsuffix} (for general entries) and
-\cs{glsupacrpluralsuffix} for acronyms where the suffix needs to be
-set using \cs{glstextup} to counteract the effects of \cs{textsc}
-and \cs{glsacrpluralsuffix} for other acronym styles. There's no
-guarantee when these commands will be expanded. They may be expanded
-on definition or they may be expanded on use, depending on the
-\styfmt{glossaries} configuration.
+The suffixes used to generate the plural forms when the plural
+hasn't been specified are given by \cs{glspluralsuffix} (for general
+entries). For abbreviations defined with \cs{newacronym},
+\cs{glsupacrpluralsuffix} is used for acronyms where the suffix
+needs to be set using \cs{glstextup} to counteract the effects of
+\cs{textsc} and \cs{glsacrpluralsuffix} for other acronym styles.
+There's no guarantee when these commands will be expanded. They may
+be expanded on definition or they may be expanded on use, depending
+on the \styfmt{glossaries} configuration.
\begin{important}
Therefore these plural suffix command definitions
aren't included in the caption mechanism as that's typically not switched on
-until the start of the document. \textbf{This means that the suffix in
+until the start of the document. \strong{This means that the suffix in
effect will be for the last loaded language that redefined these
commands.} It's best to initialise these commands to the most common
suffix required in your document and use the \gloskey{plural},
@@ -2517,8 +2840,9 @@ The \texttt{glossaries-irish.ldf} file provides this as follows:
your root language label and \texttt{Irish} with the
\sty{translator} dictionary label.)
-There are now two extra files: \texttt{glossaries-irish-noenc.ldf}
-and \texttt{glossaries-irish-utf8.ldf}.
+There are now two extra files: \nolinkurl{glossaries-irish-noenc.ldf}
+(no encoding information)
+and \nolinkurl{glossaries-irish-utf8.ldf} (UTF-8).
These both define \cs{glossariescaptionsirish} but the \texttt{*-noenc.ldf} uses
\LaTeX\ accent commands:
@@ -2560,14 +2884,18 @@ the appropriate UTF-8 characters.
This section is only applicable if you have chosen \optsor23. You can
ignore this section if you have chosen any of the other options. If you want to
alphabetically sort your entries always remember to use the
-\gloskey{sort} key if the \gloskey{name} contains any \LaTeX\ commands.
+\gloskey{sort} key if the \gloskey{name} contains any \LaTeX\
+commands (except if you're using \gls{bib2gls}).
\end{important}
If this section seriously confuses you, and you can't work out how
to run external tools like \gls{makeglossaries} or \gls{makeindex}, you can try using
the \pkgopt{automake} package option, described in
\sectionref{sec:pkgopts-sort}, but you will need \TeX's shell escape
-enabled.
+enabled. See also
+\href{https://www.dickimaw-books.com/latex/buildglossaries/}{Incorporating
+makeglossaries or makeglossaries-lite or bib2gls into the document
+build}.
In order to generate a sorted glossary with compact
\glspl{numberlist}, it is necessary to use an external
@@ -2575,14 +2903,14 @@ In order to generate a sorted glossary with compact
\opt1, which uses \TeX\ to do the sorting or \opt5, which doesn't
perform any sorting). It is this application
that creates the file containing the code required to typeset the
-glossary. \textbf{If this step is omitted, the glossaries will not
+glossary. \strong{If this step is omitted, the glossaries will not
appear in your document.} The two \glspl*{indexingapp} that are most
commonly used with \LaTeX\ are \gls{makeindex} and \gls{xindy}. As
from version 1.17, the \styfmt{glossaries} package can be used with
either of these applications. Previous versions were designed to be
-used with \gls*{makeindex} only. With the \sty{glossaries-extra} package, you
+used with \gls*{makeindex} only. With the \gls{glossaries-extra} package, you
can also use \gls{bib2gls} as the indexing application. (See
-the \sty{glossaries-extra} and \gls{bib2gls} user manuals for
+the \gls{glossaries-extra} and \gls{bib2gls} user manuals for
further details.) Note that \gls*{xindy} and \gls*{bib2gls} have much
better multi-lingual support than \gls*{makeindex}, so \gls*{xindy}
or \gls*{bib2gls} are recommended if you're not writing in English.
@@ -2639,8 +2967,8 @@ file and see if you can work it out from the \gls*{makeindex} or
problem.\footnote{Added to version \gls{makeglossaries} 2.18.} This
correction is only provided by \gls{makeglossaries} when
\gls{makeindex} is used since \gls{xindy} uses the order of the
-attributes list to determine which format should take precedence.
-(See \cs{GlsAddXdyAttribute} in \sectionref{sec:xindyloc}.)
+\ixindyattrs attributes list to determine which format should take precedence.
+(see \sectionref{sec:xindyloc}.)
\end{itemize}
@@ -2697,16 +3025,17 @@ of \gls{makeglossaries}, \gls{makeindex} or \gls{xindy}.
For example, if the document is called \texttt{myDoc.tex}, then
you must do:
\begin{prompt}
-latex myDoc
+pdflatex myDoc
makeglossaries myDoc
-latex myDoc
+pdflatex myDoc
makeglossaries myDoc
-latex myDoc
+pdflatex myDoc
\end{prompt}
-(Note that if you use \gls{glossaries-extra}, this will be done
-automatically for you if the \pkgoptfmt{indexcrossrefs} feature is
-enabled. See the \gls*{glossaries-extra} user guide for further
-details.)
+(In the case of \opt4, \gls{bib2gls} will scan the description for
+instances of commands like \cs{gls} to ensure they are selected but
+an extra \gls{bib2gls} call is required to ensure the locations are
+included, if locations lists are required. See the
+and \gls{bib2gls} manual for further details.)
Likewise, an additional \gls{makeglossaries} and \LaTeX\ run
may be required if the document pages shift with re-runs. For
@@ -2729,7 +3058,7 @@ makeglossaries or makeglossaries-lite or bib2gls into the document
build}.
If any problems occur, remember to check the transcript files
-(e.g.\ \filetype{.glg} or \filetype{.alg}) for messages.
+(e.g.\ \filetype{glg} or \filetype{alg}) for messages.
\begin{table}[htbp]
\caption[Commands and package options that have no effect when
@@ -2758,16 +3087,16 @@ use \xdyopt{C} \meta{code}
\label{sec:makeglossariesapp}
The \gls{makeglossaries} script picks up the relevant information
-from the auxiliary (\filetype{.aux}) file and will either call
+from the auxiliary (\filetype{aux}) file and will either call
\gls{xindy} or \gls{makeindex}, depending on the supplied
information. Therefore, you only need to pass the document's name
without the extension to \gls*{makeglossaries}. For example, if your
document is called \texttt{myDoc.tex}, type the following in your
terminal:
\begin{prompt}
-latex myDoc
+pdflatex myDoc
makeglossaries myDoc
-latex myDoc
+pdflatex myDoc
\end{prompt}
You may need to explicitly load \gls{makeglossaries} into Perl:
\begin{prompt}
@@ -2798,8 +3127,8 @@ that doesn't support this form of redirection, then you can use the
the fallback method without attempting the redirection. Without this
redirection, the \mkglsopt{q} (quiet) switch doesn't work as well.
-You can specify in which directory the \filetype{.aux},
-\filetype{.glo} etc files are located using the \texttt{-d} switch.
+You can specify in which directory the \filetype{aux},
+\filetype{glo} etc files are located using the \texttt{-d} switch.
For example:
\begin{prompt}
pdflatex -output-directory myTmpDir myDoc
@@ -2836,17 +3165,12 @@ attempt to correct the problem by removing duplicate locations and
retrying. There's no similar check for \gls{xindy} as \gls*{xindy}
won't produce any warning and will simply discard duplicates.
-The \gls{makeglossaries} script contains POD (Plain Old
-Documentation). If you want, you can create a man page for
-\gls*{makeglossaries} using \app{pod2man} and move the
-resulting file onto the man path. Alternatively do
-\texttt{makeglossaries -{}-help} for a list of all options or
-\texttt{makeglossaries -{}-version} for the version number.
+For a complete list of options do \texttt{makeglossaries -{}-help}.
\begin{important}
When upgrading the \styfmt{glossaries} package, make sure you also
upgrade your version of \gls{makeglossaries}. The current version is
-4.44.
+4.45.
\end{important}
\subsection{Using the makeglossaries-lite Lua Script}
@@ -2865,7 +3189,7 @@ here. (In particular the \mkglsopt{d} option.)
\begin{important}
Note that \TeX~Live on Unix-like systems creates a
symbolic link called \texttt{makeglossaries-lite} (without the
-\texttt{.lua} extension) to the actual
+\filetype{lua} extension) to the actual
\texttt{makeglossaries-lite.lua} script, so you may not need to
supply the extension.
\end{important}
@@ -2881,9 +3205,9 @@ or
makeglossaries-lite myDoc
\end{prompt}
-\emph{Some} of the options available with \gls{makeglossaries} are
-also available with \gls{makeglossaries-lite.lua}. For a complete list of
-available options, do
+\emph{Some} of the options available with the Perl
+\gls{makeglossaries} script are also available with the Lua \gls{makeglossaries-lite.lua}
+script. For a complete list of available options, do
\begin{prompt}
makeglossaries-lite.lua -{}-help
\end{prompt}
@@ -2918,9 +3242,9 @@ xindy -L \meta{language} -C \meta{encoding} -I xindy -M \meta{style} -t \meta{ba
\end{prompt}
where \meta{language} is the required language name, \meta{encoding}
is the encoding, \meta{base} is the name of the document without the
-\filetype{.tex} extension and \meta{style} is the name of the
-\gls{xindy} style file without the \filetype{.xdy} extension.
-The default name for this style file is \meta{base}\filetype{.xdy}
+\filetype{tex} extension and \meta{style} is the name of the
+\gls{xindy} style file without the \filetype{xdy} extension.
+The default name for this style file is \meta{base}\filetype{xdy}
but can be changed via \ics{setStyleFile}\marg{style}. You may need
to specify the full path name depending on the current working
directory. If any of the file names contain spaces, you must delimit
@@ -2936,8 +3260,8 @@ xindy -L english -C utf8 -I xindy -M myDoc -t myDoc.glg -o myDoc.gls myDoc.glo
Note that this just creates the main glossary. You need to do
the same for each of the other glossaries (including the
list of acronyms if you have used the \pkgopt{acronym}
-package option), substituting \filetype{.glg}, \filetype{.gls}
-and \filetype{.glo} with the relevant extensions. For example,
+package option), substituting \filetype{glg}, \filetype{gls}
+and \filetype{glo} with the relevant extensions. For example,
if you have used the \pkgopt{acronym} package option, then
you would need to do:
\begin{prompt}
@@ -2971,9 +3295,9 @@ your terminal:
makeindex -s \meta{style}.ist -t \meta{base}.glg -o \meta{base}.gls \meta{base}.glo
\end{prompt}
where \meta{base} is the name of your document without the
-\filetype{.tex} extension and \meta{style}\filetype{.ist} is the
+\filetype{tex} extension and \meta{style}\filetype{ist} is the
name of the \gls{makeindex} style file. By default, this is
-\meta{base}\filetype{.ist}, but may be changed via
+\meta{base}\filetype{ist}, but may be changed via
\ics{setStyleFile}\marg{style}. Note that there are other options,
such as \mkidxopt{l} (letter ordering). See the \gls*{makeindex}
manual for further details.
@@ -2987,7 +3311,7 @@ Note that this only creates the main glossary. If you have
additional glossaries (for example, if you have used the
\pkgopt{acronym} package option) then you must call
\gls{makeindex} for each glossary, substituting
-\filetype{.glg}, \filetype{.gls} and \filetype{.glo} with the
+\filetype{glg}, \filetype{gls} and \filetype{glo} with the
relevant extensions. For example, if you have used the
\pkgopt{acronym} package option, then you need to type the
following in your terminal:
@@ -3008,18 +3332,19 @@ you use \gls*{makeindex} explicitly instead of using
\gls{makeglossaries}. These are listed in
\tableref{tab:makeglossariesCmds}.
-
-\subsection{Note to Front-End and Script Developers}
+\section{Note to Front-End and Script Developers}
\label{sec:notedev}
-The information needed to determine whether to use \gls{xindy}
-or \gls{makeindex} and the information needed to call those
-applications is stored in the auxiliary file. This information can
-be gathered by a front-end, editor or script to make the glossaries
-where appropriate. This section describes how the information is
-stored in the auxiliary file.
+The information needed to determine whether to use \gls{xindy},
+\gls{makeindex} or \gls{bib2gls} is stored in the \filetype{aux}
+file. This information can be gathered by a front-end, editor or
+script to make the glossaries where appropriate. This section
+describes how the information is stored in the auxiliary file.
-The file extensions used by each defined glossary are given by
+\subsection{MakeIndex and Xindy}
+\label{sec:notedev.makeindex.xindy}
+
+The file extensions used by each defined (but not ignored) glossary are given by
\begin{definition}[\DescribeMacro{\@newglossary}]
\cs{@newglossary}\marg{label}\marg{log}\marg{out-ext}\marg{in-ext}
\end{definition}
@@ -3029,24 +3354,45 @@ where \meta{in-ext} is the extension of the
extension of the \emph{\gls*{indexingapp}['s]} output file (the
input file from the \styfmt{glossaries} package's point of view) and
\meta{log} is the extension of the \gls*{indexingapp}['s] transcript
-file. The label for the glossary is also given for information
-purposes only, but is not required by the \glspl*{indexingapp}. For
+file. The label for the glossary is also given. This isn't required
+with \gls{makeindex}, but with \gls{xindy} it's needed to pick up
+the associated language and encoding (see below). For
example, the information for the default main glossary is written
as:
\begin{verbatim}
\@newglossary{main}{glg}{gls}{glo}
\end{verbatim}
+If \gls{glossaries-extra}['s] hybrid method has been used (with
+\cs{makeglossaries}\oarg{sub-list}), then the sub-list
+of glossaries that need to be processed will be identified with:
+\begin{alltt}
+\ics*{glsxtr@makeglossaries}\marg{list}
+\end{alltt}
The \gls{indexingapp}['s] style file is specified by
\begin{definition}[\DescribeMacro{\@istfilename}]
\cs{@istfilename}\marg{filename}
\end{definition}
The file extension indicates whether to use \gls{makeindex}
-(\filetype{.ist}) or \gls{xindy} (\filetype{.xdy}). Note that
+(\filetype{ist}) or \gls{xindy} (\filetype{xdy}). Note that
the glossary information is formatted differently depending on
which \gls*{indexingapp} is supposed to be used, so it's
important to call the correct one.
+For example, with \app{arara} you can easily determine whether to run \gls{makeglossaries}:
+\begin{alltt}
+\% arara: makeglossaries if found("aux", "@istfilename")
+\end{alltt}
+It's more complicated if you want to explicitly run \gls{makeindex}
+or \gls{xindy}
+
+\begin{important}
+Note that if you choose to explicitly call \gls{makeindex} or
+\gls{xindy} then the user will miss out on the diagnostic
+information and the encap-clash fix that \gls{makeglossaries} also
+provides.
+\end{important}
+
Word or letter ordering is specified by:
\begin{definition}[\DescribeMacro{\@glsorder}]
\cs{@glsorder}\marg{order}
@@ -3064,15 +3410,76 @@ the root language (e.g.\ \texttt{english}) and \meta{code}
is the encoding (e.g.\ \texttt{utf8}). These commands are omitted
if \gls{makeindex} should be used.
-If \opt1 has been used, the \texttt{.aux} file will contain
-\begin{definition}
+If \opt1 has been used, the \filetype{aux} file will contain
+\begin{definition}[\DescribeMacro\@gls@reference]
\cs{@gls@reference}\marg{type}\marg{label}\marg{location}
\end{definition}
-for every time an entry has been referenced. If \opt4 has been
-used, the \texttt{.aux} file will contain one or more instances of
-\begin{definition}
-\cs{glsxtr@resource}\marg{options}\marg{basename}
-\end{definition}
+for every time an entry has been referenced.
+
+\subsection{Entry Labels}
+\label{sec:notedev.labels}
+
+If you need to gather labels for auto-completion, the
+\pkgopt{writeglslabels} package option will create a file containing
+the labels of all defined entries (regardless of whether or not the
+entry has been used in the document). The \gls{glossaries-extra}
+package also provides \pkgopt+{atom}{docdef}, which will create the
+\filetype{glsdefs} file but will act like \pkgopt+{restricted}{docdef}.
+
+\subsection{Bib2Gls}
+\label{sec:notedev.bib2gls}
+
+\bibglsnote
+If \opt4 has been used, the \filetype{aux} file will contain one or more instances of
+\begin{alltt}
+\ics*{glsxtr@resource}\marg{options}\marg{basename}
+\end{alltt}
+where \meta{basename} is the basename of the \filetype{glstex} file
+that needs to be created by \gls{bib2gls}. If \texttt{src\dequals\marg{bib
+list}} isn't present in \meta{options} then \meta{basename} also
+indicates the name of the associated \filetype{bib} file.
+
+For example, with \app{arara} you can easily determine whether or
+not to run \gls{bib2gls}:
+\begin{alltt}
+\% arara: bib2gls if found("aux", "glsxtr@resource")
+\end{alltt}
+(It gets more complicated if both \ics*{glsxtr@resource} and
+\cs{@istfilename} are present as that indicates the hybrid
+\pkgopt+{alsoindex}{record} option.)
+
+Remember that with \gls{bib2gls}, the entries will never be defined
+on the first \LaTeX\ call (because their definitions are contained
+in the \filetype{glstex} file created by \gls{bib2gls}). You can
+also pick up labels from the records in \filetype{aux} file, which
+will be in the form:
+\begin{alltt}
+\ics*{glsxtr@record}\marg{label}\marg{h-prefix}\marg{counter}\marg{format}\marg{loc}
+\end{alltt}
+or (with \pkgopt+{nameref}{record})
+\begin{alltt}
+\ics*{glsxtr@record@nameref}\marg{label}\marg{href prefix}\marg{counter}\marg{format}\marg{location}\marg{title}\marg{href anchor}\marg{href value}
+\end{alltt}
+or (with \cs{glssee})
+\begin{alltt}
+\ics*{glsxtr@recordsee}\marg{label}\marg{xr list}
+\end{alltt}
+You can also pick up the commands defined with
+\ics*{glsxtrnewglslike}, which are added to the \filetype{aux} file
+for \gls{bib2gls}['s] benefit:
+\begin{alltt}
+\ics*{@glsxtr@newglslike}\marg{label-prefix}\marg{cs}
+\end{alltt}
+If \ics*{GlsXtrSetAltModifier} is used, then the modifier is
+identified with:
+\begin{alltt}
+\ics*{@glsxtr@altmodifier}\marg{character}
+\end{alltt}
+Label prefixes (for the \ics*{dgls} set of commands) are identified
+with:
+\begin{alltt}
+\ics*{@glsxtr@prefixlabellist}\marg{list}
+\end{alltt}
\chapter{Package Options}
\label{sec:pkgopts}
@@ -3080,8 +3487,15 @@ used, the \texttt{.aux} file will contain one or more instances of
This section describes the available \styfmt{glossaries} package
options. You may omit the \texttt{=true} for boolean options. (For
example, \pkgopt{acronym} is equivalent to \pkgopt[true]{acronym}).
+
+\begin{xtr}
The \gls{glossaries-extra} package has additional options described
-in the \gls*{glossaries-extra} manual.
+in the \gls*{glossaries-extra} manual. The extension package also
+has some different default settings to the base package. Those that
+are available at the time of writing are included here. Future
+versions of \gls{glossaries-extra} may have additional package
+options or new values for existing settings that aren't listed here.
+\end{xtr}
\begin{important}
Note that \meta{key}=\meta{value} package options can't be passed via the
@@ -3095,63 +3509,90 @@ package. Options that aren't \meta{key}=\meta{value} (such as
\section{General Options}
\label{sec:pkgopts-general}
-\begin{description}
-\item[\pkgoptdef{nowarn}] This suppresses all warnings generated by
+\pkgoptsec{nowarn} This suppresses all warnings generated by
the \styfmt{glossaries} package. Don't use this option if you're new to using
\styfmt{glossaries} as the warnings are designed to help detect
common mistakes (such as forgetting to use \ics{makeglossaries}).
-Note that the \pkgopt[true]{debug} and \pkgopt[showtargets]{debug} will override this option.
+Note that if you use \pkgopt{debug} with any value other than
+\pkgoptfmt{false} it will override this option.
-\item[\pkgoptdef{nolangwarn}] This suppresses the warning generated by
+\pkgoptsec{nolangwarn} This suppresses the warning generated by
a missing language module.
-\item[\pkgoptdef{noredefwarn}] If you load \styfmt{glossaries} with
+\pkgoptsec{noredefwarn} If you load \styfmt{glossaries} with
a~class or another package that already defines glossary related
commands, by default \styfmt{glossaries} will warn you that it's
redefining those commands. If you are aware of the consequences of
using \styfmt{glossaries} with that class or package and you don't
want to be warned about it, use this option to suppress those
warnings. Other warnings will still be issued unless you use the
-\pkgopt{nowarn} option described above.
-
-\item[\pkgoptdef{debug}] Introduced in version 4.24.
-The default setting is \pkgopt[false]{debug}.
-This was a boolean option but as from v4.32 it now accepts the
-values: \pkgoptfmt{false}, \pkgoptfmt{true} and
-\pkgoptfmt{showtargets}. If no value is given, \pkgopt[true]{debug} is assumed.
-Both \pkgopt[true]{debug} and \pkgopt[showtargets]{debug}
-switch on the debug mode (and will automatically
-cancel the \pkgopt{nowarn} option). The \pkgopt[showtargets]{debug}
-option will additionally use
+\pkgopt{nowarn} option described above. (This option is
+automatically switched on by \gls{glossaries-extra}.)
+
+\pkgoptsec[value]{debug} Introduced in version 4.24. The default
+setting is \pkgopt[false]{debug}. The following values are
+available: \pkgoptfmt{false}, \pkgoptfmt{true},
+\pkgoptfmt{showtargets} (v4.32+) and \pkgoptfmt{showaccsupp}
+(v4.45+). If no value is given, \pkgopt[true]{debug} is assumed.
+
+\begin{xtr}
+The \gls{glossaries-extra} package provides extra values
+\pkgoptval*{showwrgloss}{debug}, that may be used to show where
+the indexing is occurring, and \pkgoptval*{all}{debug}, which
+switches on all debugging options. See the \gls{glossaries-extra}
+manual for further details.
+\end{xtr}
+
+All values other than \pkgopt[false]{debug} switch on the debug mode
+(and will automatically cancel the \pkgopt{nowarn} option). The
+\pkgopt[showtargets]{debug} option will additionally use:
\begin{definition}[\DescribeMacro\glsshowtarget]
\cs{glsshowtarget}\marg{target name}
\end{definition}
-to show the hypertarget or hyperlink name in the margin when
+to show the hypertarget or hyperlink name when
\cs{glsdohypertarget} is used by commands like \cs{glstarget}
and when \cs{glsdohyperlink} is used by commands like \cs{gls}.
-This puts the information in the margin using \ics{marginpar} unless
-math mode or inner mode are detected, in which case it puts the
-information in line enclosed by square brackets. The
-\gls{glossaries-extra} package provides an additional setting that
-may be used to show where the indexing is occurring. See the
-\gls{glossaries-extra} manual for further details.
+In math mode or inner mode, this puts the target name in square
+brackets just before the link or anchor. In outer mode it uses:
+\begin{definition}[\DescribeMacro\glsshowtargetouter]
+\cs{glsshowtargetouter}\marg{label}
+\end{definition}
+which by default places the target name in the margin. The font is
+given by:
+\begin{definition}[\DescribeMacro\glsshowtargetfont]
+\cs{glsshowtargetfont}
+\end{definition}
+The default definition is \verb|\ttfamily\small|. This command is
+included in the definition of \cs{glsshowtargetouter}, so if you
+want to redefine that command remember to include the font. For
+example:
+\begin{verbatim}
+\renewcommand*{\glsshowtargetouter}[1]{%
+ {\glsshowtargetfont [#1]}}
+\end{verbatim}
+
+Similarly, the \pkgopt[showaccsupp]{debug} will add the
+accessibility support information using:
+\begin{definition}[\DescribeMacro\glsshowaccsupp]
+\cs{glsshowaccsupp}\marg{options}\marg{tag}\marg{replacement text}
+\end{definition}
+This internally uses \ics{glsshowtarget}. This option is provided
+for use with \sty{glossaries-accsupp}.
The purpose of the debug mode can be demonstrated with
the following example document:
-\begin{verbatim}
-\documentclass{article}
-\usepackage{glossaries}
-\newglossaryentry{sample1}{name={sample1},
- description={example}}
-\newglossaryentry{sample2}{name={sample2},
- description={example}}
-\glsadd{sample2}
-\makeglossaries
-\begin{document}
-\gls{sample1}.
-\printglossaries
-\end{document}
-\end{verbatim}
+\begin{alltt}
+\cs{documentclass}\mgroup{article}
+\cs{usepackage}\mgroup{glossaries}
+\cs{newglossaryentry}\mgroup{sample1}\mgroup{name=\mgroup{sample1},description=\mgroup{example}}
+\cs{newglossaryentry}\mgroup{sample2}\mgroup{name=\mgroup{sample2},description=\mgroup{example}}
+\strong{\ics{glsadd}}\mgroup{sample2}\% <- does nothing here
+\strong{\ics{makeglossaries}}
+\cs{begin}\mgroup{document}
+\cs{gls}\mgroup{sample1}.
+\cs{printglossaries}
+\cs{end}\mgroup{document}
+\end{alltt}
In this case, only the \texttt{sample1} entry has been indexed, even
though \verb|\glsadd{sample2}| appears in the source code.
This is because \verb|\glsadd{sample2}| has been used before the
@@ -3159,19 +3600,23 @@ associated file is opened by \ics{makeglossaries}. Since the file
isn't open yet, the information can't be written to it, which is why
the \texttt{sample2} entry doesn't appear in the glossary.
+Without \cs{makeglossaries} the indexing is suppressed with \optsand23 but, other
+than that, commands like \cs{gls} behave as usual.
+
This situation doesn't cause any errors or warnings as it's
perfectly legitimate for a user to want to use \styfmt{glossaries}
to format the entries (e.g.\ abbreviation expansion) but not display
-any lists of terms, abbreviations, symbols etc.
-Without \cs{makeglossaries} the indexing is suppressed but, other
-than that, commands like \cs{gls} behave as usual. It's also
-possible that the user may want to temporarily comment out
+any lists of terms, abbreviations, symbols etc (or the user may
+prefer to use the unsorted \optsor56).
+It's also possible that the user may want to temporarily comment out
\cs{makeglossaries} in order to suppress the indexing while working
-on a draft version to speed compilation. Therefore
-\cs{makeglossaries} can't be used to enable \cs{newglossaryentry}
-and \cs{glsadd}. They must be enabled by default. (It does, however,
-enable the \gloskey{see} key as that's a more common problem. See
-below.)
+on a draft version to speed compilation, or the user may
+prefer to use \optsor14 for indexing, which don't use \cs{makeglossaries}.
+
+Therefore \cs{makeglossaries} can't be used to enable
+\cs{newglossaryentry} and commands like \cs{gls} and \cs{glsadd}.
+These commands must be enabled by default. (It does, however, enable
+the \gloskey{see} key as that's a more common problem. See below.)
The debug mode, enabled with the \pkgopt{debug} option,
\begin{verbatim}
@@ -3191,99 +3636,28 @@ glossary but you're sure you used commands like \cs{glsadd}
or \cs{glsaddall}, try switching on the \pkgopt{debug} option
and see if any information has been written to the log file.
-\item[\pkgoptdef{seenoindex}] Introduced in version 4.24, this option
-may take one of three values: \pkgoptfmt{error}, \pkgoptfmt{warn} or
-\pkgoptfmt{ignore}. The \gloskey{see} key automatically indexes the
-cross-referenced entry using \cs{glsadd}. This means that it suffers
-from the same problem as the above. If used before the relevant
-glossary file has been opened, the indexing can't be performed.
-Since this is easy to miss, the \styfmt{glossaries} package by
-default issues an error message if the \gloskey{see} key is used
-before \cs{makeglossaries}. This option allows you to change the
-error into just a warning (\pkgopt[warn]{seenoindex}) or
-ignore it (\pkgopt[ignore]{seenoindex}) if, for example, you want
-to temporarily comment out \cs{makeglossaries} to speed up the
-compilation of a draft document by omitting the indexing.
-
-\item[\pkgoptdef{nomain}] This suppresses the creation of the main
-glossary and associated \texttt{.glo} file, if unrequired. Note that
-if you use this option, you must create another glossary in which to
-put all your entries (either via the \pkgopt{acronym} (or
-\pkgopt{acronyms}) package option described in
-\sectionref{sec:pkgopts-acronym} or via the \pkgopt{symbols},
-\pkgopt{numbers} or \pkgopt{index} options described in
-\sectionref{sec:pkgopts-other} or via \ics{newglossary} described in
-\sectionref{sec:newglossary}).
-
-\begin{important}
-If you don't use the main glossary and you don't use this option,
-\gls{makeglossaries} will produce a warning.
-\end{important}
-\begin{alltt}
-Warning: File '\emph{filename}.glo' is empty.
-Have you used any entries defined in glossary
-'main'?
-Remember to use package option 'nomain' if
-you don't want to use the main glossary.
-\end{alltt}
-If you did actually want to use the main glossary and you see this
-warning, check that you have referenced the entries in that glossary
-via commands such as \ics{gls}.
-
-\item[\pkgoptdef{sanitizesort}] This is a boolean option that
-determines whether or not to \gls{sanitize} the sort value when
-writing to the external glossary file. For example, suppose you
-define an entry as follows:
-\begin{verbatim}
-\newglossaryentry{hash}{name={\#},sort={#},
- description={hash symbol}}
-\end{verbatim}
-The sort value (\verb|#|) must be sanitized before writing it to the
-glossary file, otherwise \LaTeX\ will try to interpret it as a
-parameter reference. If, on the other hand, you want the sort value
-expanded, you need to switch off the sanitization. For example,
-suppose you do:
-\begin{verbatim}
-\newcommand{\mysortvalue}{AAA}
-\newglossaryentry{sample}{%
- name={sample},
- sort={\mysortvalue},
- description={an example}}
-\end{verbatim}
-and you actually want \cs{mysortvalue} expanded, so that the entry
-is sorted according to \texttt{AAA}, then use the package option
-\pkgopt[false]{sanitizesort}.
-
-The default for \optsand23 is \pkgopt[true]{sanitizesort}, and the
-default for \opt1 is \pkgopt[false]{sanitizesort}.
-
-\item[\pkgoptdef{esclocations}] This is a boolean option. (The default
-is \pkgopt[true]{esclocations}, but \ics{makenoidxglossaries}
-changes it to \pkgopt[false]{esclocations}.) Both \gls{makeindex} and \gls{xindy}
-are fussy about the location formats (\gls{makeindex} more so than
-\gls{xindy}) so the \styfmt{glossaries} package tries to ensure that
-special characters are escaped and allows for the location to be
-substituted for a format that's more acceptable to the indexing
-application. This requires a bit of trickery to circumvent the
-problem posed by \TeX's asynchronous output routine, which can go
-wrong and also adds to the complexity of the document build.
-
-If you're sure that your locations will always expand to an
-acceptable format (or you're prepared to post-process the glossary
-file before passing it to the relevant indexing application) then
-use \pkgopt[false]{esclocations} to avoid the complex escaping
-of location values. (See \ifpdf section~\ref*{sec:wrgloss}\fi \qt{Writing information to associated files} in the documented
-code for further details.)
-
-\item[\pkgoptdef{savewrites}] This is a boolean option to minimise the
+\pkgoptsec[boolean]{savewrites} This is a boolean option to minimise the
number of write registers used by the \styfmt{glossaries} package.
-(Default is \pkgopt[false]{savewrites}.) There are only a limited
-number of write registers, and if you have a large number of
-glossaries or if you are using a class or other packages that
-create a lot of external files, you may exceed the maximum number
-of available registers. If \pkgopt{savewrites} is set, the glossary
-information will be stored in token registers until the end of the
-document when they will be written to the external files.
+The default is \pkgopt[false]{savewrites}. With \optsand23, one
+write register is required per (non-ignored) glossary and one for
+the style file.
+
+With all options except \optsand14, another write register is
+required if the \filetype{docdefs} file is needed to save document
+definitions. With both \optsand14, no write registers are required
+(document definitions aren't permitted and indexing information is
+written to the \filetype{aux} file). If you really need document
+definitions but you want to minimise the number of write registers
+then consider using \pkgopt+{restricted}{docdef} with
+\gls{glossaries-extra}.
+
+There are only a limited number of write registers, and if you have
+a large number of glossaries or if you are using a class or other
+packages that create a lot of external files, you may exceed the
+maximum number of available registers. If \pkgopt{savewrites} is
+set, the glossary information will be stored in token registers
+until the end of the document when they will be written to the
+external files.
\begin{important}
This option can significantly slow document compilation and may
@@ -3293,11 +3667,17 @@ output routine. As an alternative, you can use the \sty{scrwfile}
package (part of the KOMA-Script bundle) and not use this option.
\end{important}
-You can also reduce the number of write registers by using
-\optsor14 or by ensuring you define all your glossary entries in the
-preamble.
-
-\begin{important}
+By way of comparison, \nolinkurl{sample-multi2.tex}
+provided with \gls{bib2gls} has a total of 15 glossaries. With
+\optsor23, this would require 46 associated files and 16
+write registers.\footnote{These figures don't include standard files
+and registers provided by the kernel or \sty{hyperref}, such as
+\filetypefmt{aux} and \filetypefmt{out}.} With
+\gls{bib2gls}, no write registers are required and there are only 10
+associated files for that particular document (9 resource files and
+1 transcript file).
+
+\importantpar[-2][-1ex]
If you want to use \TeX's \ics{write18} mechanism to call
\gls{makeindex} or \gls{xindy} from your document and use
\pkgopt{savewrites}, you must create the external files with
@@ -3310,13 +3690,14 @@ document to avoid rewriting the files. For example:
-t \jobname.glg -o \jobname.gls \jobname}
\let\glswritefiles\relax
\end{verbatim}
-\end{important}
+
+\noindent
In general, this package option is best avoided.
-\item[\pkgoptdef{translate}] This can take the following values:
+\pkgoptsec[value]{translate} This can take the following values:
\begin{description}
- \item[{\pkgopt[true]{translate}}] If \sty{babel} has been loaded
+ \item[{\pkgoptval{true}{translate}}] If \sty{babel} has been loaded
and the \sty{translator} package is installed, \sty{translator}
will be loaded and the translations will be provided by the
\sty{translator} package interface. You can modify the
@@ -3328,12 +3709,12 @@ In general, this package option is best avoided.
\sty{polyglossia} has been loaded, \sty{glossaries-polyglossia}
will be loaded.
- \item[{\pkgopt[false]{translate}}] Don't provide translations, even
+ \item[{\pkgoptval{false}{translate}}] Don't provide translations, even
if \sty{babel} or \sty{polyglossia} has been loaded.
(Note that \sty{babel} provides the command \ics{glossaryname}
so that will still be translated if you have loaded \sty{babel}.)
- \item[{\pkgopt[babel]{translate}}] Don't load the \sty{translator}
+ \item[{\pkgoptval{babel}{translate}}] Don't load the \sty{translator}
package. Instead load \sty{glossaries-babel}.
\begin{important}
@@ -3351,32 +3732,19 @@ specified, \pkgopt[true]{translate} is assumed if \sty{babel},
\sty{polyglossia} or \sty{translator} have been loaded. Otherwise
\pkgopt[false]{translate} is assumed.
+\begin{xtr}
+With \gls{glossaries-extra}, if \sty{babel} is detected then
+\pkgopt[babel]{translate} is automatically passed to the base
+\sty{glossaries} package.
+\end{xtr}
+
See \sectionref{sec:fixednames} for further details.
-\item[\pkgoptdef{notranslate}] This is equivalent to
+\pkgoptsec{notranslate} This is equivalent to
\pkgopt[false]{translate} and may be passed via the document class
options.
-\item[\pkgoptdef{nohypertypes}] Use this option if you have multiple
-glossaries and you want to suppress the entry hyperlinks for a
-particular glossary or glossaries. The value of this option should
-be a comma-separated list of glossary types where \ics{gls} etc
-shouldn't have hyperlinks by default. Make sure you enclose the
-value in braces if it contains any commas. Example:
-\begin{verbatim}
-\usepackage[acronym,nohypertypes={acronym,notation}]
- {glossaries}
-\newglossary[nlg]{notation}{not}{ntn}{Notation}
-\end{verbatim}
-The values must be fully expanded, so \textbf{don't} try
-\texttt{nohypertypes\discretionary{}{}{}=\ics{acronymtype}}. You may also use
-\begin{definition}
-\ics{GlsDeclareNoHyperList}\marg{list}
-\end{definition}
-instead or additionally.
-See \sectionref{sec:glslink} for further details.
-
-\item[\pkgoptdef{hyperfirst}] This is a boolean option that specifies
+\pkgoptsec[boolean]{hyperfirst} This is a boolean option that specifies
whether each term has a hyperlink on \firstuse. The default is
\pkgopt[true]{hyperfirst} (terms on \gls{firstuse} have a hyperlink,
unless explicitly suppressed using starred versions of commands
@@ -3435,63 +3803,67 @@ Note that this hook isn't used by the commands that don't check the
\ics{glslinkpostsetkeys}, which is used by both the \glslike\ and
\glstextlike\ commands.)
-\item[\pkgoptdef{indexonlyfirst}] This is a boolean option that specifies
-whether to only add information to the external glossary file on
-\gls{firstuse}. The default is \pkgopt[false]{indexonlyfirst},
-which will add a line to the file every time one of the
-\glslike\ or \glstextlike\ commands are used. Note that \ics{glsadd}
-will always add information to the external glossary
-file\footnote{bug fix in v4.16 has corrected the code to ensure
-this.}\ (since that's the purpose of that command).
+The \gls{glossaries-extra} package provides a method of disabling
+the \gls{firstuse} hyperlink according to the entry's associated
+category. For example, if you only to switch off the \gls{firstuse}
+hyperlink for abbreviations and acronyms then you simply need to set
+the \attr{nohyperfirst} attribute for the \texttt{abbreviation}
+and \texttt{acronym} categories. (Instead of using the
+\pkgopt{nohyperfirst} package option.) See the
+\gls{glossaries-extra} manual for further details.
-You can customise this by redefining
-\begin{definition}[\DescribeMacro\glswriteentry]
-\cs{glswriteentry}\marg{label}\marg{wr-code}
-\end{definition}
-where \meta{label} is the entry's label and \meta{wr-code} is the
-code that writes the entry's information to the external file.
-The default definition of \cs{glswriteentry} is:
-\begin{verbatim}
-\newcommand*{\glswriteentry}[2]{%
- \ifglsindexonlyfirst
- \ifglsused{#1}{}{#2}%
- \else
- #2%
- \fi
-}
-\end{verbatim}
-This checks the \pkgopt{indexonlyfirst} package option (using
-\cs{ifglsindexonlyfirst}) and does \meta{wr-code} if this is
-\pkgoptfmt{false} otherwise it only does \meta{wr-code} of the entry
-hasn't been used.
+\pkgoptsec{writeglslabels} This is a valueless option that
+will create a file called \cs{jobname}\texttt{.}\filetype{glslabels} at the end
+of the document. This file simply contains a list of all defined
+entry labels (including those in any ignored glossaries). It's
+provided for the benefit of text editors that need to know labels
+for \Index{auto-completion}. (See also \gls{glossaries-extra}['s]
+\pkgopt+{atom}{docdef} package option.)
-For example, suppose you only want to index the first use for
-entries in the \texttt{acronym} glossary and not in the
-\texttt{main} (or any other) glossary:
-\begin{verbatim}
-\renewcommand*{\glswriteentry}[2]{%
- \ifthenelse{\equal{\glsentrytype{#1}}{acronym}}
- {\ifglsused{#1}{}{#2}}%
- {#2}%
-}
-\end{verbatim}
-Here I've used \cs{ifthenelse} to ensure the arguments of
-\cs{equal} are fully expanded before the comparison is made.
+\begin{bib2gls}
+Note that with \gls{bib2gls} the file will only contain the entries
+that \gls{bib2gls} has selected from the \filetype{bib} files.
+\end{bib2gls}
-\item[\pkgoptdef{savenumberlist}] This is a boolean option that
-specifies whether or not to gather and store the \gls{numberlist}
-for each entry. The default is \pkgopt[false]{savenumberlist}. (See
-\ics{glsentrynumberlist} and \ics{glsdisplaynumberlist} in
-\sectionref{sec:glsnolink}.) This is always true if you
-use \opt1.
+\xtrpkgoptsec[value]{undefaction}
+
+The value may be one of:
+\begin{description}
+ \item[\pkgoptfmt{error}] generate an error if a referenced entry is
+ undefined (default, and only available setting with just
+ \styfmt{glossaries});
+ \item[\pkgoptfmt{warn}] only warn if a referenced entry is
+ undefined (automatically activated with \opt4).
+\end{description}
+\xtrpkgoptsec[value]{docdef}
+
+This option governs the use of \cs{newglossaryentry}. Available
+values:
+\begin{description}
+\item[\pkgoptfmt{false}] \cs{newglossaryentry} is not permitted in
+the \env{document} environment (default with \gls{glossaries-extra}
+and for \opt1 with just the base \styfmt{glossaries} package);
+
+\item[\pkgoptfmt{restricted}] \cs{newglossaryentry} is only permitted in
+the \env{document} environment if it occurs before
+\cs{printglossary} (not available for some indexing options);
+
+\item[\pkgoptfmt{atom}] as \pkgoptfmt{restricted} but creates the
+\filetype{docdefs} file for use by \app{atom} (without the
+limitations of \pkgopt+{true}{docdef});
+
+\item[\pkgoptfmt{true}] \cs{newglossaryentry} is permitted in the
+\env{document} environment where it would normally be permitted by
+the base \styfmt{glossaries} package. This will create the
+\filetype{docdefs} file if \cs{newglossaryentry} is found in the
+\env{document} environment.
\end{description}
\section{Sectioning, Headings and TOC Options}
\label{sec:pkgopts-sec}
-\begin{description}
-\item[\pkgoptdef{toc}] Add the glossaries to the table of contents.
+\pkgoptsec[boolean]{toc} Add the glossaries to the table of contents.
Note that an extra \LaTeX\ run is required with this option.
Alternatively, you can switch this function on and off using
\begin{definition}[\DescribeMacro{\glstoctrue}]
@@ -3501,8 +3873,12 @@ and
\begin{definition}[\DescribeMacro{\glstocfalse}]
\cs{glstocfalse}
\end{definition}
+The default value is \pkgopt[false]{toc} for the base
+\styfmt{glossaries} package and \pkgopt[true]{toc} for
+\gls{glossaries-extra}.
-\item[\pkgoptdef{numberline}] When used with \pkgopt{toc}, this will
+\pkgoptsec[boolean]{numberline} When used with the above
+\pkgopt[true]{toc} option, this will
add \ics{numberline}\verb|{}| in the final argument of
\ics{addcontentsline}. This will align the table of contents entry
with the numbered section titles. Note that this option has no
@@ -3510,16 +3886,22 @@ effect if the \pkgopt{toc} option is omitted. If \pkgopt{toc} is
used without \pkgopt{numberline}, the title will be aligned with
the section numbers rather than the section titles.
-\item[\pkgoptdef{section}] This is a \meta{key}=\meta{value} option. Its
-value should be the name of a sectional unit (e.g.\ chapter).
-This will make the glossaries appear in the named sectional unit,
-otherwise each glossary will appear in a chapter, if chapters
-exist, otherwise in a section. Unnumbered sectional units will be used
-by default. Example:
+\pkgoptsec[value]{section}
+
+This option indicates the sectional unit to use for the glossary.
+The value should be the control sequence \emph{name} without the
+leading backslash or following star (e.g.\ just \texttt{chapter}
+not \cs{chapter} or \texttt{chapter*}).
+
+The default behaviour is for the glossary heading to use
+\cs{chapter}, if that command exists, or \cs{section} otherwise. The
+starred or unstarred form is determined by the \pkgopt{numberedsection} option.
+
+Example:
\begin{verbatim}
\usepackage[section=subsection]{glossaries}
\end{verbatim}
-You can omit the value if you want to use sections, i.e.\
+You can omit the value if you want to use \cs{section}, i.e.\
\begin{verbatim}
\usepackage[section]{glossaries}
\end{verbatim}
@@ -3559,10 +3941,11 @@ be fixed by redefining \DescribeMacro\glsclearpage\cs{glsclearpage}:
\renewcommand*{\glsclearpage}{\clearpage}
\end{verbatim}
-\item[\pkgoptdef{ucmark}] This is a boolean option (default:
+\pkgoptsec[boolean]{ucmark} This is a boolean option. The default is
\pkgopt[false]{ucmark}, unless \cls{memoir} has been loaded, in
-which case it defaults to \pkgopt[true]{ucmark}). If
-set, \ics{glsglossarymark} uses
+which case the default is \pkgopt[true]{ucmark}.
+
+If set, \ics{glsglossarymark} uses
\ics{MakeTextUppercase}\footnote{Actually it uses
\ics{mfirstucMakeUppercase} which is set to \sty{textcase}'s \cs{MakeTextUppercase}
by the
@@ -3570,8 +3953,8 @@ by the
\ics{makefirstuc}. (The \sty{textcase} package is automatically
loaded by \styfmt{glossaries}.)}.
You can test whether this option has been set or not using
-\begin{definition}[\DescribeMacro\ifglsucmark]
-\cs{ifglsucmark} \meta{true part}\cs{else} \meta{false part}\cs{fi}
+\begin{definition}
+\ics{ifglsucmark} \meta{true part}\cs{else} \meta{false part}\cs{fi}
\end{definition}
For example:
\begin{verbatim}
@@ -3582,10 +3965,10 @@ For example:
\markright{#1}%
\fi}
\end{verbatim}
-If \cls{memoir} has been loaded and \pkgopt{ucfirst} is set, then
+If \cls{memoir} has been loaded and \pkgopt{ucmark} is set, then
\cls{memoir}'s \ics{memUChead} is used.
-\item[\pkgoptdef{numberedsection}]
+\pkgoptsec[value]{numberedsection}
The glossaries are placed in unnumbered sectional units by default,
but this can be changed using \pkgopt{numberedsection}. This option can take
one of the following values:
@@ -3658,13 +4041,26 @@ associated with the \texttt{main} glossary. As above, you can
redefine \cs{glsautoprefix} to provide a prefix for the label.
\end{itemize}
-\end{description}
-
\section{Glossary Appearance Options}
\label{sec:pkgopts-printglos}
-\begin{description}
-\item[\pkgoptdef{entrycounter}] This is a boolean option. (Default
+\pkgoptsec[boolean]{savenumberlist} This is a boolean option that
+specifies whether or not to gather and store the \gls{numberlist}
+for each entry. The default is \pkgopt[false]{savenumberlist}. (See
+\ics{glsentrynumberlist} and \ics{glsdisplaynumberlist} in
+\sectionref{sec:glsnolink}.) This is always true if you
+use \opt1.
+
+\begin{bib2gls}
+If you use the \pkgopt*{record} option (with either no value or
+\pkgopt+{only}{record} or \pkgopt+{nameref}{record}) then this
+package option has no effect. With \gls{bib2gls}, the
+\glspl{numberlist} are automatically saved with the default
+\resourceopt[true]{save-locations} and
+\resourceopt[true]{save-loclist} resource settings.
+\end{bib2gls}
+
+\pkgoptsec[boolean]{entrycounter} This is a boolean option. (Default
is \pkgopt[false]{entrycounter}.) If set, each main (level~0)
glossary entry will be numbered when using the standard glossary
styles. This option creates the counter
@@ -3690,7 +4086,7 @@ creating the glossary files using \gls{makeglossaries},
up-to-date.
\end{important}
-\item[\pkgoptdef{counterwithin}] This is a \meta{key}=\meta{value}
+\pkgoptsec[value]{counterwithin} This is a \meta{key}=\meta{value}
option where \meta{value} is the name of a counter. If used, this
option will automatically set \pkgopt[true]{entrycounter} and the
\ctr{glossaryentry} counter will be reset every time \meta{value} is
@@ -3705,7 +4101,7 @@ counter used in the glossary's sectioning command.
\end{important}
If you want the counter reset at the start of each glossary, you can
-redefine \ics{glossarypreamble} to use
+modify the glossary preamble (\ics{glossarypreamble}) to use
\begin{definition}[\DescribeMacro{\glsresetentrycounter}]
\cs{glsresetentrycounter}
\end{definition}
@@ -3728,7 +4124,7 @@ glossary preamble, as required. For example:
}
\end{verbatim}
-\item[\pkgoptdef{subentrycounter}] This is a boolean option. (Default
+\pkgoptsec[boolean]{subentrycounter} This is a boolean option. (Default
is \pkgopt[false]{subentrycounter}.) If set, each level~1
glossary entry will be numbered when using the standard glossary
styles. This option creates the counter
@@ -3739,7 +4135,7 @@ reference the number within the document using
\ics{glsrefentry}\marg{label} where \meta{label} is the label
associated with the sub-entry.
-\item[\pkgoptdef{style}] This is a \meta{key}=\meta{value} option.
+\pkgoptsec[value]{style} This is a \meta{key}=\meta{value} option.
(Default is \pkgopt[list]{style}, unless \sty{classicthesis}
has been loaded, in which case the default is \pkgopt[index]{style}.) Its value should be the name of
the glossary style to use. This key may only be used for styles
@@ -3751,7 +4147,7 @@ set the style using
\end{definition}
(See \sectionref{sec:styles} for further details.)
-\item[\pkgoptdef{nolong}] This prevents the \styfmt{glossaries} package
+\pkgoptsec{nolong} This prevents the \styfmt{glossaries} package
from automatically loading \sty{glossary-long} (which means that
the \sty{longtable} package also won't be loaded). This reduces
overhead by not defining unwanted styles and commands. Note that if
@@ -3759,7 +4155,7 @@ you use this option, you won't be able to use any of the
glossary styles defined in the \styfmt{glossary-long} package (unless
you explicitly load \sty{glossary-long}).
-\item[\pkgoptdef{nosuper}] This prevents the \styfmt{glossaries} package
+\pkgoptsec{nosuper} This prevents the \styfmt{glossaries} package
from automatically loading \sty{glossary-super} (which means that
the \sty{supertabular} package also won't be loaded). This reduces
overhead by not defining unwanted styles and commands. Note that if
@@ -3767,7 +4163,7 @@ you use this option, you won't be able to use any of the
glossary styles defined in the \styfmt{glossary-super} package
(unless you explicitly load \sty{glossary-super}).
-\item[\pkgoptdef{nolist}] This prevents the \styfmt{glossaries} package
+\pkgoptsec{nolist} This prevents the \styfmt{glossaries} package
from automatically loading \sty{glossary-list}. This reduces
overhead by not defining unwanted styles. Note that if
you use this option, you won't be able to use any of the
@@ -3778,7 +4174,7 @@ Note that since the default style is \glostyle{list} (unless
also need to use the \pkgopt{style} option to set the style to
something else.
-\item[\pkgoptdef{notree}] This prevents the \styfmt{glossaries} package
+\pkgoptsec{notree} This prevents the \styfmt{glossaries} package
from automatically loading \sty{glossary-tree}. This reduces
overhead by not defining unwanted styles. Note that if
you use this option, you won't be able to use any of the
@@ -3787,7 +4183,7 @@ glossary styles defined in the \styfmt{glossary-tree} package
\sty{classicthesis} has been loaded, the default style is
\glostyle{index}, which is provided by \sty{glossary-tree}.
-\item[\pkgoptdef{nostyles}] This prevents all the predefined styles
+\pkgoptsec{nostyles} This prevents all the predefined styles
from being loaded. If you use this option, you need to load a
glossary style package (such as \sty{glossary-mcols}). Also if you
use this option, you can't use the \pkgopt{style} package option.
@@ -3800,7 +4196,7 @@ Instead you must either use \ics{setglossarystyle}\marg{style} or the
\setglossarystyle{mcoltree}
\end{verbatim}
-\item[\pkgoptdef{nonumberlist}] This option will suppress the
+\pkgoptsec{nonumberlist} This option will suppress the
associated \glspl{numberlist} in the glossaries (see also
\sectionref{sec:numberlists}). Note that if you use \optsor23
(\gls{makeindex} or \gls{xindy}) then the locations must still be
@@ -3811,7 +4207,7 @@ indexed. Remember that \gls{numberlist} includes any
cross-references, so suppressing the \gls{numberlist} will also hide
the cross-references (see below).
-\item[\pkgoptdef{seeautonumberlist}] If you suppress the
+\pkgoptsec{seeautonumberlist} If you suppress the
\glspl{numberlist} with \pkgopt{nonumberlist}, described above, this
will also suppress any cross-referencing information supplied by the
\gloskey{see} key in \ics{newglossaryentry} or \ics{glssee}. If you
@@ -3820,30 +4216,252 @@ automatically implement \gloskey{nonumberlist=false} for that entry.
(Note this doesn't affect \cs{glssee}.) For further details see
\sectionref{sec:crossref}.
-\item[\pkgoptdef{counter}] This is a \meta{key}=\meta{value} option.
+\pkgoptsec[value]{counter} This is a \meta{key}=\meta{value} option.
(Default is \pkgopt[page]{counter}.) The value should be the name of
the default counter to use in the \glspl{numberlist}
(see \sectionref{sec:numberlists}).
-\item[\pkgoptdef{nopostdot}] This is a boolean option. If no value is
-specified, \texttt{true} is assumed. When set to \texttt{true}, this
-option suppresses the default post description dot used by some of
-the predefined styles. The default setting is
-\pkgopt[false]{nopostdot}.
-
-\item[\pkgoptdef{nogroupskip}] This is a boolean option. If no value is
-specified, \texttt{true} is assumed. When set to \texttt{true}, this
-option suppresses the default vertical gap between groups used by
+\pkgoptsec[boolean]{nopostdot} This is a boolean option. If no value is
+specified, \pkgoptval{true}{nopostdot} is assumed. When set to
+\pkgoptval{true}{nopostdot}, this option suppresses the default post
+description dot used by some of the predefined styles.
+
+The default setting is \pkgopt[false]{nopostdot} for the base
+\styfmt{glossaries} package and \pkgopt[true]{nopostdot} for
+\gls{glossaries-extra}.
+
+\begin{xtr}
+The \gls{glossaries-extra} package provides \pkgopt*{postdot}, which
+is equivalent to \pkgopt[false]{nopostdot}, and also
+\pkgopt*{postpunc}, which allows you to choose a different
+punctuation character.
+\end{xtr}
+
+\pkgoptsec[boolean]{nogroupskip} This is a boolean option. If no value is
+specified, \pkgoptfmt{true} is assumed. When set to \pkgoptfmt{true}, this
+option suppresses the default vertical gap between letter groups used by
some of the predefined styles. The default setting is
\pkgopt[false]{nogroupskip}.
+\begin{bib2gls}
+If you are using \gls{bib2gls} without the \texttt{-{}-group} (or
+\texttt{-g}) switch then you don't need to use
+\pkgoptfmt{nogroupskip\dequals true} as there won't be any letter
+groups.
+\end{bib2gls}
+
+\xtrpkgoptsec[list]{stylemods}
+
+Load the \sty{glossaries-extra-stylemods} package and patch the
+predefined styles. The \meta{list} argument is optional. If present,
+this will also load \styfmt{glossary-\meta{element}.sty} for each
+\meta{element} in the comma-separated \meta{list}.
+
+\section{Indexing Options}
+\label{sec:pkgopts-indexing}
+
+\pkgoptsec[value]{seenoindex} Introduced in version 4.24, this option
+may take one of three values: \pkgoptfmt{error}, \pkgoptfmt{warn} or
+\pkgoptfmt{ignore}. The \gloskey{see} key automatically indexes the
+cross-referenced entry using \cs{glsadd}. This means that if this
+key is used in an entry definition before the relevant
+glossary file has been opened, the indexing can't be performed.
+Since this is easy to miss, the \styfmt{glossaries} package by
+default issues an error message if the \gloskey{see} key is used
+before \ics{makeglossaries}. This option allows you to change the
+error into just a warning (\pkgopt[warn]{seenoindex}) or
+ignore it (\pkgopt[ignore]{seenoindex}) if, for example, you want
+to temporarily comment out \cs{makeglossaries} to speed up the
+compilation of a draft document by omitting the indexing.
+
+\pkgoptsec[boolean]{esclocations} This is a boolean option. The
+default is \pkgopt[true]{esclocations}, which is needed for
+\optsand23. With \opt1 \ics{makenoidxglossaries} changes it to
+\pkgopt[false]{esclocations}. With \opt4 (\gls{bib2gls}), this
+setting is ignored.
+
+Both \gls{makeindex} and \gls{xindy} are fussy about the location
+formats (\gls{makeindex} more so than \gls{xindy}) so the
+\styfmt{glossaries} package tries to ensure that special characters
+are escaped and allows for the location to be substituted for a
+format that's more acceptable to the indexing application. This
+requires a bit of trickery to circumvent the problem posed by \TeX's
+asynchronous output routine, which can go wrong and also adds to the
+complexity of the document build.
+
+If you're sure that your locations will always expand to an
+acceptable format (or you're prepared to post-process the glossary
+file before passing it to the relevant indexing application) then
+use \pkgopt[false]{esclocations} to avoid the complex escaping of
+location values. (See \ifpdf section~\ref*{sec:wrgloss} \fi
+\qt{Writing information to associated files} in the documented code
+for further details.)
+
+This isn't an issue for \optsor14 as the locations are written to
+the \filetype{aux} file so no syntax conversion is required.
+
+\pkgoptsec[boolean]{indexonlyfirst} This is a boolean option that specifies
+whether to only add information to the external glossary file on
+\gls{firstuse}. The default is \pkgopt[false]{indexonlyfirst},
+which will add a line to the file every time one of the
+\glslike\ or \glstextlike\ commands are used. Note that \ics{glsadd}
+will always add information to the external glossary
+file\footnote{bug fix in v4.16 has corrected the code to ensure
+this.}\ (since that's the purpose of that command).
+
+\begin{important}
+Resetting the \gls{firstuseflag} with commands like
+\ics{glsreset} after an entry has been indexed will cause that entry to be
+indexed multiple times if it's used again after the reset.
+Likewise unsetting the \gls{firstuseflag} before an entry has been
+indexed will prevent it from being indexed (unless specifically
+indexed with \cs{glsadd}).
+\end{important}
+
+You can customise this by redefining
+\begin{definition}[\DescribeMacro\glswriteentry]
+\cs{glswriteentry}\marg{label}\marg{wr-code}
+\end{definition}
+where \meta{label} is the entry's label and \meta{wr-code} is the
+code that writes the entry's information to the external file.
+The default definition of \cs{glswriteentry} is:
+\begin{verbatim}
+\newcommand*{\glswriteentry}[2]{%
+ \ifglsindexonlyfirst
+ \ifglsused{#1}{}{#2}%
+ \else
+ #2%
+ \fi
+}
+\end{verbatim}
+This checks the \pkgopt{indexonlyfirst} package option (using
+\cs{ifglsindexonlyfirst}) and does \meta{wr-code} if this is
+\pkgoptfmt{false} otherwise it only does \meta{wr-code} of the entry
+hasn't been used.
+
+For example, suppose you only want to index the first use for
+entries in the \texttt{acronym} glossary and not in the
+\texttt{main} (or any other) glossary:
+\begin{verbatim}
+\renewcommand*{\glswriteentry}[2]{%
+ \ifthenelse{\equal{\glsentrytype{#1}}{acronym}}
+ {\ifglsused{#1}{}{#2}}%
+ {#2}%
+}
+\end{verbatim}
+Here I've used \cs{ifthenelse} to ensure the arguments of
+\cs{equal} are fully expanded before the comparison is made.
+
+With the \gls{glossaries-extra} package it's possible to only index
+\gls{firstuse} for particular categories. For example, if you only
+want this enabled for abbreviations and acronyms then you can set
+the \attr{indexonlyfirst} attribute for the \texttt{abbreviation}
+and \texttt{acronym} categories. (Instead of using the
+\pkgopt{indexonlyfirst} package option.) See the
+\gls{glossaries-extra} manual for further details.
+
+\xtrpkgoptsec[boolean]{indexcrossrefs}
+
+If \pkgoptfmt{true}, this will automatically index any
+cross-referenced entries that haven't been marked as used at the end
+of the document. Increases document build time. See
+\gls{glossaries-extra} manual for further details.
+
+\xtrpkgoptsec[boolean]{autoseeindex}
+
+If \pkgoptfmt{true}, makes the \gloskey{see} and
+\xtrgloskey{seealso} keys automatically index the cross-reference
+when the entry is defined (default, and the only option with just
+the base \styfmt{glossaries} package).
+
+\xtrpkgoptsec[value]{record}
+
+If not \pkgoptfmt{off}, this option indicates that \gls{bib2gls}
+is required. If the value is omitted, \pkgoptfmt{only} is assumed. Permitted values:
+\begin{description}
+\item[\pkgoptfmt{off}] \gls{bib2gls} isn't being used;
+
+\item[\pkgoptfmt{only}] \gls{bib2gls} is being used to fetch entries
+from a \filetype{bib} file, to sort the entries and collate the
+\glspl{numberlist}, where the location information is the same as
+for \optsto13;
+
+\item[\pkgoptfmt{nameref}] like \pkgoptfmt{only} but provides extra
+information that allows the associated title to be used instead of
+the location number;
+
+\item[\pkgoptfmt{alsoindex}] a hybrid approach where \gls{bib2gls}
+is begin used to fetch entries from a \filetype{bib} file but
+\gls{makeindex} or \gls{xindy} are used for the indexing. This
+requires a more complicated document build and isn't recommended.
\end{description}
+See \gls{glossaries-extra} manual for further details.
+
+\xtrpkgoptsec[boolean]{equations}
+
+If \pkgoptfmt{true}, this option will cause the default location
+counter to automatically switch to \texttt{equation} when inside a
+numbered equation environment.
+
+\xtrpkgoptsec[boolean]{floats}
+
+If \pkgoptfmt{true}, this option will cause the default location
+counter to automatically switch to the corresponding counter when inside a
+float. (Remember that with floats it's the \cs{caption} command that
+increments the counter so the location will be incorrect if an entry
+is indexed within the float before the caption.)
+
+\xtrpkgoptsec{indexcounter}
+
+This valueless option is primarily intended for use with
+\gls{bib2gls} and \sty{hyperref} allowing the page location
+hyperlink to the relevant point in the page (rather than the top of
+the page). Unexpected results will occur with other indexing
+methods. See \gls{glossaries-extra} manual for further details.
\section{Sorting Options}
\label{sec:pkgopts-sort}
-\begin{description}
-\item[\pkgoptdef{sort}] If you use \optsor23, this package option is
+This section is mostly for \optsand23. Only the \pkgopt{sort} and
+\pkgopt{order} options are applicable for \opt1.
+
+\begin{xtr}
+With \optsto46, only \pkgopt[none]{sort} is applicable (and this is
+automatically implemented by \pkgopt+{only}{record} and
+\pkgopt+{nameref}{record}). With \gls{bib2gls}, the sort method
+is provided in the optional argument of \ics*{GlsXtrLoadResources}
+not with the \pkgoptfmt{sort} package option. There's no sorting
+with \optsand56.
+\end{xtr}
+
+\pkgoptsec[boolean]{sanitizesort} This is a boolean option that
+determines whether or not to \gls{sanitize} the sort value when
+writing to the external glossary file. For example, suppose you
+define an entry as follows:
+\begin{verbatim}
+\newglossaryentry{hash}{name={\#},sort={#},
+ description={hash symbol}}
+\end{verbatim}
+The sort value (\verb|#|) must be sanitized before writing it to the
+glossary file, otherwise \LaTeX\ will try to interpret it as a
+parameter reference. If, on the other hand, you want the sort value
+expanded, you need to switch off the sanitization. For example,
+suppose you do:
+\begin{verbatim}
+\newcommand{\mysortvalue}{AAA}
+\newglossaryentry{sample}{%
+ name={sample},
+ sort={\mysortvalue},
+ description={an example}}
+\end{verbatim}
+and you actually want \cs{mysortvalue} expanded, so that the entry
+is sorted according to \texttt{AAA}, then use the package option
+\pkgopt[false]{sanitizesort}.
+
+The default for \optsand23 is \pkgopt[true]{sanitizesort}, and the
+default for \opt1 is \pkgopt[false]{sanitizesort}.
+
+\pkgoptsec[value]{sort} If you use \optsor23, this package option is
the only way of specifying how to sort the glossaries. Only \opt1
allows you to specify sort methods for individual glossaries
via the \gloskey[printnoidxglossary]{sort} key in the optional
@@ -3884,11 +4502,13 @@ and is only for documents that don't use \cs{makeglossaries} (\optsor23)
or \cs{makenoidxglossaries} (\opt1). It omits the code used to sanitize
or escape the sort value, since it's not required. This can help to
improve the document build speed, especially if there are a large
-number of entries. This option
+number of entries.
+
+This option
can't be used with \cs{printglossary} or \cs{printnoidxglossary}
(or the iterative versions \cs{printglossaries} or
\cs{printnoidxglossaries}). It may be used with
-\sty{glossaries-extra}'s \cs{printunsrtglossary} (\opt5).
+\gls{glossaries-extra}'s \cs{printunsrtglossary} (\opt5).
\end{itemize}
Note that the group styles (such as \glostyle{listgroup}) are
incompatible with the \pkgopt[use]{sort} and \pkgopt[def]{sort}
@@ -3930,8 +4550,8 @@ I want the \texttt{main} and \texttt{acronym} glossaries to be
sorted alphabetically, but the \texttt{notation} type should be
sorted in order of definition.
-For \opt1, I~just need to set the \gloskey[printnoidxglossary]{sort} key in
-the optional argument of \ics{printnoidxglossary}:
+For \opt1, the \gloskey[printnoidxglossary]{sort} option can be
+used in \ics{printnoidxglossary}:
\begin{verbatim}
\printnoidxglossary[sort=word]
\printnoidxglossary[type=acronym,sort=word]
@@ -4021,12 +4641,12 @@ Now the entries can be defined:
For a complete document, see the sample file \samplefile{People}.
\end{example}
-\item[\pkgoptdef{order}] This may take two values:
+\pkgoptsec[value]{order} This may take two values:
\pkgoptval{word}{order} or \pkgoptval{letter}{order}. The default
is word ordering.
\begin{important}
-Note that the \pkgopt{order} option has no effect if you don't use
+Note that with \optsand23, the \pkgopt{order} option has no effect if you don't use
\gls{makeglossaries}.
\end{important}
@@ -4042,24 +4662,29 @@ Alternatively, you can specify the order for individual glossaries:
\printnoidxglossary[type=acronym,sort=letter]
\end{verbatim}
-\item[\pkgoptdef{makeindex}] (\opt2) The glossary information and
+\begin{bib2gls}
+With \gls{bib2gls}, use the \resourceopt{break-at} option
+in \ics*{GlsXtrLoadResources} instead of \pkgoptfmt{order}.
+\end{bib2gls}
+
+\pkgoptsec{makeindex} (\opt2) The glossary information and
indexing style file will be written in \gls{makeindex} format. If
you use \gls{makeglossaries}, it will automatically detect that it
needs to call \gls*{makeindex}. If you don't use
\gls*{makeglossaries}, you need to remember to use \gls*{makeindex}
not \gls{xindy}. The indexing style file will been given
-a~\filetype{.ist} extension.
+a~\filetype{ist} extension.
You may omit this package option if you are using \opt2 as this is the
default. It's available in case you need to override the effect of an earlier
occurrence of \pkgopt{xindy} in the package option list.
-\item[\pkgoptdef{xindy}] (\opt3) The glossary information and indexing style
+\pkgoptsec{xindy} (\opt3) The glossary information and indexing style
file will be written in \gls{xindy} format. If you use
\gls{makeglossaries}, it will automatically detect that it needs to
call \gls*{xindy}. If you don't use \gls*{makeglossaries}, you need to
remember to use \gls*{xindy} not \gls{makeindex}. The indexing style
-file will been given a \filetype{.xdy} extension.
+file will been given a \filetype{xdy} extension.
This package option may additionally have a value that
is a \meta{key}=\meta{value} comma-separated list to override the
@@ -4079,17 +4704,17 @@ language, codepage and number group settings are unchanged. See
\sectionref{sec:xindy} for further details on using \gls{xindy} with
the \styfmt{glossaries} package.
-\item[\pkgoptdef{xindygloss}] (\opt3) This is equivalent to
+\pkgoptsec{xindygloss} (\opt3) This is equivalent to
\verb|xindy={}| (that is, the \pkgopt{xindy} option without any value
supplied) and may be used as a document class option. The language
and code page can be set via \ics{GlsSetXdyLanguage} and
\ics{GlsSetXdyCodePage} (see \sectionref{sec:langenc}.)
-\item[\pkgoptdef{xindynoglsnumbers}] (\opt3) This is equivalent to
+\pkgoptsec{xindynoglsnumbers} (\opt3) This is equivalent to
\verb|xindy={glsnumbers=false}| and may be used as a document class
option.
-\item[\pkgoptdef{automake}] This is option was introduced to
+\pkgoptsec[value]{automake} This is option was introduced to
version 4.08 as a boolean option. As from version 4.42 it may now
take three values: \texttt{false} (default), \texttt{true}
or \texttt{immediate}. If no option is supplied, \texttt{immediate}
@@ -4139,13 +4764,225 @@ those who can't work out how to incorporate the \gls*{indexingapp}
into their document build. The default value for this option is
\pkgopt[false]{automake}.
-\end{description}
+\pkgoptsec{disablemakegloss} This valueless option
+indicates that \ics{makeglossaries} and \ics{makenoidxglossaries}
+should be disabled. This option is provided in the event that you
+have to use a class or package that disregards the advice in
+\sectionref{sec:indexingoptions} and automatically performs
+\ics{makeglossaries} or \ics{makenoidxglossaries} but you don't want
+this. (For example, you want to use a different indexing method or
+you want to disable indexing while working on a draft
+document.)
+
+This option may be passed in the standard document class option list
+or passed using \cs{PassOptionsToPackage} before \sty{glossaries} is
+loaded. Note that this does nothing if
+\ics{makeglossaries} or \ics{makenoidxglossaries} has already
+been used whilst enabled.
+
+\pkgoptsec{restoremakegloss} Cancels the effect of
+\pkgopt{disablemakegloss}. This option may be used in
+\cs{setupglossaries}. It issues a warning if \ics{makeglossaries} or
+\ics{makenoidxglossaries} has already been used whilst enabled.
+For example, suppose the class \clsfmt{customclass.cls}
+automatically loads \styfmt{glossaries} and does \cs{makeglossaries}
+but you need an extra glossary, which has to be defined before
+\cs{makeglossaries}, then you can do:
+\begin{verbatim}
+\documentclass[disablemakegloss]{customclass}
+\newglossary*{functions}{Functions}
+\setupglossaries{restoremakegloss}
+\makeglossaries
+\end{verbatim}
+or
+\begin{verbatim}
+\PassOptionsToPackage{disablemakegloss}{glossaries}
+\documentclass{customclass}
+\newglossary*{functions}{Functions}
+\setupglossaries{restoremakegloss}
+\makeglossaries
+\end{verbatim}
+
+Note that restoring these commands doesn't necessarily mean that they can be
+used. It just means that their normal behaviour given the current
+settings will apply. For example, if you use the \pkgopt+{only}{record}
+or \pkgopt+{nameref}{record} options with \gls{glossaries-extra}
+then you can't use \cs{makeglossaries} or \cs{makenoidxglossaries}
+regardless of \pkgopt{restoremakegloss}.
+
+\section{Glossary Type Options}
+\label{sec:pkgopts-type}
+
+\pkgoptsec[list]{nohypertypes} Use this option if you have multiple
+glossaries and you want to suppress the entry hyperlinks for a
+particular glossary or glossaries. The value of this option should
+be a comma-separated list of glossary types where \ics{gls} etc
+shouldn't have hyperlinks by default. Make sure you enclose the
+value in braces if it contains any commas. Example:
+\begin{verbatim}
+\usepackage[acronym,nohypertypes={acronym,notation}]
+ {glossaries}
+\newglossary[nlg]{notation}{not}{ntn}{Notation}
+\end{verbatim}
+The values must be fully expanded, so \strong{don't} try
+\texttt{nohypertypes\discretionary{}{}{}=\ics{acronymtype}}. You may also use
+\begin{definition}
+\ics{GlsDeclareNoHyperList}\marg{list}
+\end{definition}
+instead or additionally.
+See \sectionref{sec:glslink} for further details.
+
+\pkgoptsec{nomain} This suppresses the creation of the main
+glossary and associated \filetype{glo} file, if unrequired. Note that
+if you use this option, you must create another glossary in which to
+put all your entries (either via the \pkgopt{acronym} (or
+\pkgopt{acronyms}) package option described in
+\sectionref{sec:pkgopts-acronym} or via the \pkgopt{symbols},
+\pkgopt{numbers} or \pkgopt{index} options described in
+\sectionref{sec:pkgopts-other} or via \ics{newglossary} described in
+\sectionref{sec:newglossary}).
-\section{Acronym Options}
+\begin{important}
+If you don't use the main glossary and you don't use this option,
+\gls{makeglossaries} will produce a warning.
+\end{important}
+\begin{alltt}
+Warning: File '\emph{filename}.glo' is empty.
+Have you used any entries defined in glossary
+'main'?
+Remember to use package option 'nomain' if
+you don't want to use the main glossary.
+\end{alltt}
+If you did actually want to use the main glossary and you see this
+warning, check that you have referenced the entries in that glossary
+via commands such as \ics{gls}.
+
+\pkgoptsec{symbols} This valueless option defines a new glossary type with
+the label \texttt{symbols} via
+\begin{verbatim}
+\newglossary[slg]{symbols}{sls}{slo}{\glssymbolsgroupname}
+\end{verbatim}
+It also defines
+\begin{definition}[\DescribeMacro\printsymbols]
+\cs{printsymbols}\oarg{options}
+\end{definition}
+which is a synonym for
+\begin{alltt}
+\ics{printglossary}[type=symbols,\meta{options}]
+\end{alltt}
+
+If you use \opt1, you need to use:
+\begin{alltt}
+\ics{printnoidxglossary}[type=symbols,\meta{options}]
+\end{alltt}
+to display the list of symbols.
+
+\begin{important}
+Remember to use the \pkgopt{nomain} package option if you're only
+interested in using this \texttt{symbols} glossary and don't intend
+to use the \texttt{main} glossary.
+\end{important}
+
+\begin{xtr}
+The \gls{glossaries-extra} package has a slightly modified
+version of this option which additionally provides \ics*{glsxtrnewsymbol}
+as a convenient shortcut method for defining symbols. See the
+\gls{glossaries-extra} manual for further details.
+\end{xtr}
+
+\pkgoptsec{numbers} This valueless option defines a new glossary type with
+the label \texttt{numbers} via
+\begin{verbatim}
+\newglossary[nlg]{numbers}{nls}{nlo}{\glsnumbersgroupname}
+\end{verbatim}
+It also defines
+\begin{definition}[\DescribeMacro\printnumbers]
+\cs{printnumbers}\oarg{options}
+\end{definition}
+which is a synonym for
+\begin{alltt}
+\ics{printglossary}[type=numbers,\meta{options}]
+\end{alltt}
+
+If you use \opt1, you need to use:
+\begin{alltt}
+\ics{printnoidxglossary}[type=numbers,\meta{options}]
+\end{alltt}
+to display the list of numbers.
+
+\begin{important}
+Remember to use the \pkgopt{nomain} package option if you're only
+interested in using this \texttt{numbers} glossary and don't intend
+to use the \texttt{main} glossary.
+\end{important}
+
+\begin{xtr}
+The \gls{glossaries-extra} package has a slightly modified
+version of this option which additionally provides \ics*{glsxtrnewnumber}
+as a convenient shortcut method for defining numbers. See the
+\gls{glossaries-extra} manual for further details.
+\end{xtr}
+
+\pkgoptsec{index} This valueless option defines a new glossary type with
+the label \texttt{index} via
+\begin{verbatim}
+\newglossary[ilg]{index}{ind}{idx}{\indexname}%
+\end{verbatim}
+It also defines
+\begin{definition}[\DescribeMacro\newterm]
+\cs{newterm}\oarg{options}\marg{term}
+\end{definition}
+which is a synonym for
+\begin{alltt}
+\ics{newglossaryentry}\marg{term}[type=index,name=\marg{term},%
+description=\ics{nopostdesc},\meta{options}]
+\end{alltt}
+and
+\begin{definition}[\DescribeMacro\printindex]
+\cs{printindex}\oarg{options}
+\end{definition}
+which is a synonym for
+\begin{alltt}
+\ics{printglossary}[type=index,\meta{options}]
+\end{alltt}
+
+If you use \opt1, you need to use:
+\begin{alltt}
+\ics{printnoidxglossary}[type=index,\meta{options}]
+\end{alltt}
+to display this glossary.
+
+\begin{important}
+Remember to use the \pkgopt{nomain} package option if you're only
+interested in using this \texttt{index} glossary and don't intend to
+use the \texttt{main} glossary. Note that you
+can't mix this option with \ics{index}. Either use
+\styfmt{glossaries} for the indexing or use a~custom indexing
+package, such as \sty{makeidx}, \sty{index} or \sty{imakeidx}.
+(You can, of course, load one of those packages and
+load \styfmt{glossaries} without the \pkgopt{index} package option.)
+\end{important}
+
+Since the index isn't designed for terms with descriptions, you
+might also want to disable the hyperlinks for this glossary using
+the package option \pkgopt[index]{nohypertypes} or the command
+\begin{display}
+\ics{GlsDeclareNoHyperList}\verb|{index}|
+\end{display}
+
+The example file \samplefile{-index} illustrates the use of the
+\pkgopt{index} package option.
+
+\pkgoptsec{noglossaryindex} This valueless option switches off \pkgopt{index}
+if \pkgopt{index} has been passed implicitly (for example,
+through global document options). This option can't be used
+in \cs{setupglossaries}.
+
+
+\section{Acronym and Abbreviation Options}
\label{sec:pkgopts-acronym}
-\begin{description}
-\item[\pkgoptdef{acronym}] This creates a new glossary with the
+\pkgoptsec[boolean]{acronym} If true, this creates a new glossary with the
label \texttt{acronym}. This is equivalent to:
\begin{verbatim}
\newglossary[alg]{acronym}{acr}{acn}{\acronymname}
@@ -4183,11 +5020,36 @@ interested in using this \texttt{acronym} glossary. (That is, you
don't intend to use the \texttt{main} glossary.)
\end{important}
-\item[\pkgoptdef{acronyms}] This is equivalent to
+\begin{xtr}
+The \gls{glossaries-extra} extension package comes with an analogous
+\pkgopt*{abbreviations} option, which creates a new glossary with
+the label \texttt{abbreviations} and sets the command
+\ics*{glsxtrabbrvtype} to this. If the \pkgopt{acronym} option hasn't
+also been used, then \ics{acronymtype} will be set to
+\ics*{glsxtrabbrvtype}. This enables both \ics{newacronym} and
+\ics*{newabbreviation} to use the same glossary.
+
+Make sure you have at least v1.42 of \gls{glossaries-extra} if you
+use the \pkgopt{acronym} (or \pkgopt{acronyms}) package option with
+the extension package to avoid a bug that interferes with the
+abbreviation style.
+\end{xtr}
+
+\pkgoptsec{acronyms} This is equivalent to
\pkgopt[true]{acronym} and may be used in the document class option
list.
-\item[\pkgoptdef{acronymlists}] By default, only the \cs{acronymtype}
+\xtrpkgoptsec{abbreviations}
+
+This valueless option creates a new glossary type using:
+\begin{verbatim}
+\newglossary[glg-abr]{abbreviations}{gls-abr}{glo-abr}{\abbreviationsname}
+\end{verbatim}
+The label can be accessed with \ics*{glsxtrabbrvtype}, which is
+analogous to \cs{acronymtype}. See \gls{glossaries-extra} manual for
+further details.
+
+\pkgoptsec[value]{acronymlists} By default, only the \cs{acronymtype}
glossary is considered to be a list of acronyms. If you have other
lists of acronyms, you can specify them as a comma-separated list
in the value of \pkgopt{acronymlists}. For example, if you use the
@@ -4222,13 +5084,21 @@ of acronyms using:
\cs{glsIfListOfAcronyms}\marg{label}\marg{true part}\marg{false part}
\end{definition}
-\item[\pkgoptdef{shortcuts}] This option provides shortcut commands
+\begin{xtr}
+This option is incompatible with \gls{glossaries-extra}['s]
+abbreviation mechanism.
+\end{xtr}
+
+\pkgoptsec{shortcuts} This option provides shortcut commands
for acronyms. See \sectionref{sec:acronyms} for further details.
Alternatively you can use:
\begin{definition}[\DescribeMacro\DefineAcronymSynonyms]
\cs{DefineAcronymSynonyms}
\end{definition}
-\end{description}
+
+\begin{xtr}
+The \gls{glossaries-extra} package provides additional shortcuts.
+\end{xtr}
\subsection{Deprecated Acronym Style Options}
\label{sec:pkgopts-old-acronym}
@@ -4237,54 +5107,53 @@ The package options listed in this section are now deprecated but
are kept for backward-compatibility. Use \ics{setacronymstyle}
instead. See \sectionref{sec:acronyms} for further details.
-\begin{description}
-\item[\pkgoptdef{description}] This option changes the definition of
+\deppkgoptsec{description} This option changes the definition of
\ics{newacronym} to allow a description.
This option may be replaced by
\begin{verbatim}
\setacronymstyle{long-short-desc}
\end{verbatim}
-or (with \pkgopt{smallcaps})
+or (with \deprecatedpkgopt{smallcaps})
\begin{verbatim}
\setacronymstyle{long-sc-short-desc}
\end{verbatim}
-or (with \pkgopt{smaller})
+or (with \deprecatedpkgopt{smaller})
\begin{verbatim}
\setacronymstyle{long-sm-short-desc}
\end{verbatim}
-or (with \pkgopt{footnote})
+or (with \deprecatedpkgopt{footnote})
\begin{verbatim}
\setacronymstyle{footnote-desc}
\end{verbatim}
-or (with \pkgopt{footnote} and \pkgopt{smallcaps})
+or (with \deprecatedpkgopt{footnote} and \deprecatedpkgopt{smallcaps})
\begin{verbatim}
\setacronymstyle{footnote-sc-desc}
\end{verbatim}
-or (with \pkgopt{footnote} and \pkgopt{smaller})
+or (with \deprecatedpkgopt{footnote} and \deprecatedpkgopt{smaller})
\begin{verbatim}
\setacronymstyle{footnote-sm-desc}
\end{verbatim}
-or (with \pkgopt{dua})
+or (with \deprecatedpkgopt{dua})
\begin{verbatim}
\setacronymstyle{dua-desc}
\end{verbatim}
-\item[\pkgoptdef{smallcaps}] This option changes the definition of
+\deppkgoptsec{smallcaps} This option changes the definition of
\ics{newacronym} and the way that acronyms are displayed.
This option may be replaced by:
\begin{verbatim}
\setacronymstyle{long-sc-short}
\end{verbatim}
-or (with \pkgopt{description})
+or (with \deprecatedpkgopt{description})
\begin{verbatim}
\setacronymstyle{long-sc-short-desc}
\end{verbatim}
-or (with \pkgopt{description} and \pkgopt{footnote})
+or (with \deprecatedpkgopt{description} and \deprecatedpkgopt{footnote})
\begin{verbatim}
\setacronymstyle{footnote-sc-desc}
\end{verbatim}
-\item[\pkgoptdef{smaller}] This option changes the definition of
+\deppkgoptsec{smaller} This option changes the definition of
\ics{newacronym} and the way that acronyms are displayed.
\begin{important}
If you use this option, you will need to include the \sty{relsize}
@@ -4295,186 +5164,79 @@ This option may be replaced by:
\begin{verbatim}
\setacronymstyle{long-sm-short}
\end{verbatim}
-or (with \pkgopt{description})
+or (with \deprecatedpkgopt{description})
\begin{verbatim}
\setacronymstyle{long-sm-short-desc}
\end{verbatim}
-or (with \pkgopt{description} and \pkgopt{footnote})
+or (with \deprecatedpkgopt{description} and \deprecatedpkgopt{footnote})
\begin{verbatim}
\setacronymstyle{footnote-sm-desc}
\end{verbatim}
-\item[\pkgoptdef{footnote}] This option changes the definition of
+\deppkgoptsec{footnote} This option changes the definition of
\ics{newacronym} and the way that acronyms are displayed.
This option may be replaced by:
\begin{verbatim}
\setacronymstyle{footnote}
\end{verbatim}
-or (with \pkgopt{smallcaps})
+or (with \deprecatedpkgopt{smallcaps})
\begin{verbatim}
\setacronymstyle{footnote-sc}
\end{verbatim}
-or (with \pkgopt{smaller})
+or (with \deprecatedpkgopt{smaller})
\begin{verbatim}
\setacronymstyle{footnote-sm}
\end{verbatim}
-or (with \pkgopt{description})
+or (with \deprecatedpkgopt{description})
\begin{verbatim}
\setacronymstyle{footnote-desc}
\end{verbatim}
-or (with \pkgopt{smallcaps} and \pkgopt{description})
+or (with \deprecatedpkgopt{smallcaps} and \deprecatedpkgopt{description})
\begin{verbatim}
\setacronymstyle{footnote-sc-desc}
\end{verbatim}
-or (with \pkgopt{smaller} and \pkgopt{description})
+or (with \deprecatedpkgopt{smaller} and \deprecatedpkgopt{description})
\begin{verbatim}
\setacronymstyle{footnote-sm-desc}
\end{verbatim}
-
-\item[\pkgoptdef{dua}] This option changes the definition of
+\deppkgoptsec{dua} This option changes the definition of
\ics{newacronym} so that acronyms are always expanded.
This option may be replaced by:
\begin{verbatim}
\setacronymstyle{dua}
\end{verbatim}
-or (with \pkgopt{description})
+or (with \deprecatedpkgopt{description})
\begin{verbatim}
\setacronymstyle{dua-desc}
\end{verbatim}
-\end{description}
-
\section{Other Options}
\label{sec:pkgopts-other}
Other available options that don't fit any of the above categories
-are:
-\begin{description}
-\item[\pkgoptdef{symbols}] This option defines a new glossary type with
-the label \texttt{symbols} via
-\begin{verbatim}
-\newglossary[slg]{symbols}{sls}{slo}{\glssymbolsgroupname}
-\end{verbatim}
-It also defines
-\begin{definition}[\DescribeMacro\printsymbols]
-\cs{printsymbols}\oarg{options}
-\end{definition}
-which is a synonym for
-\begin{alltt}
-\ics{printglossary}[type=symbols,\meta{options}]
-\end{alltt}
+are described below.
-If you use \opt1, you need to use:
-\begin{alltt}
-\ics{printnoidxglossary}[type=symbols,\meta{options}]
-\end{alltt}
-to display the list of symbols.
-
-\begin{important}
-Remember to use the \pkgopt{nomain} package option if you're only
-interested in using this \texttt{symbols} glossary and don't intend
-to use the \texttt{main} glossary.
-\end{important}
-
-The \styfmt{glossaries-extra} package has a slightly modified
-version of this option which additionally provides \ics{glsxtrnewsymbol}
-as a convenient shortcut method for defining symbols. See the
-\styfmt{glossaries-extra} manual for further details.
-
-\item[\pkgoptdef{numbers}] This option defines a new glossary type with
-the label \texttt{numbers} via
-\begin{verbatim}
-\newglossary[nlg]{numbers}{nls}{nlo}{\glsnumbersgroupname}
-\end{verbatim}
-It also defines
-\begin{definition}[\DescribeMacro\printnumbers]
-\cs{printnumbers}\oarg{options}
-\end{definition}
-which is a synonym for
-\begin{alltt}
-\ics{printglossary}[type=numbers,\meta{options}]
-\end{alltt}
-
-If you use \opt1, you need to use:
-\begin{alltt}
-\ics{printnoidxglossary}[type=numbers,\meta{options}]
-\end{alltt}
-to display the list of numbers.
-
-\begin{important}
-Remember to use the \pkgopt{nomain} package option if you're only
-interested in using this \texttt{numbers} glossary and don't intend
-to use the \texttt{main} glossary.
-\end{important}
-
-The \styfmt{glossaries-extra} package has a slightly modified
-version of this option which additionally provides \ics{glsxtrnewnumber}
-as a convenient shortcut method for defining numbers. See the
-\styfmt{glossaries-extra} manual for further details.
-
-\item[\pkgoptdef{index}] This option defines a new glossary type with
-the label \texttt{index} via
-\begin{verbatim}
-\newglossary[ilg]{index}{ind}{idx}{\indexname}%
-\end{verbatim}
-It also defines
-\begin{definition}[\DescribeMacro\newterm]
-\cs{newterm}\oarg{options}\marg{term}
-\end{definition}
-which is a synonym for
-\begin{alltt}
-\ics{newglossaryentry}\marg{term}[type=index,name=\marg{term},%
-description=\ics{nopostdesc},\meta{options}]
-\end{alltt}
-and
-\begin{definition}[\DescribeMacro\printindex]
-\cs{printindex}\oarg{options}
-\end{definition}
-which is a synonym for
-\begin{alltt}
-\ics{printglossary}[type=index,\meta{options}]
-\end{alltt}
+\xtrpkgoptsec{accsupp}
-If you use \opt1, you need to use:
-\begin{alltt}
-\ics{printnoidxglossary}[type=index,\meta{options}]
-\end{alltt}
-to display this glossary.
+Load the \sty{glossaries-accsupp} package.
-\begin{important}
-Remember to use the \pkgopt{nomain} package option if you're only
-interested in using this \texttt{index} glossary and don't intend to
-use the \texttt{main} glossary. Note that you
-can't mix this option with \ics{index}. Either use
-\styfmt{glossaries} for the indexing or use a~custom indexing
-package, such as \sty{makeidx}, \sty{index} or \sty{imakeidx}.
-(You can, of course, load one of those packages and
-load \styfmt{glossaries} without the \pkgopt{index} package option.)
-\end{important}
+\xtrpkgoptsec{prefix}
-Since the index isn't designed for terms with descriptions, you
-might also want to disable the hyperlinks for this glossary using
-the package option \pkgopt[index]{nohypertypes} or the command
-\begin{display}
-\ics{GlsDeclareNoHyperList}\verb|{index}|
-\end{display}
+Load the \sty{glossaries-prefix} package.
-The example file \samplefile{-index} illustrates the use of the
-\pkgopt{index} package option.
+\xtrpkgoptsec[boolean]{nomissingglstext}
-\item[\pkgoptdef{noglossaryindex}] This option switches off \pkgopt{index}
-if \pkgopt{index} has been passed implicitly (for example,
-through global document options). This option can't be used
-in \cs{setupglossaries}.
+This option may be used to suppress the boilerplate text generated
+by \cs{printglossary} if the glossary file is missing.
-\item[\pkgoptdef{compatible-2.07}] Compatibility mode for old documents
+\pkgoptsec[boolean]{compatible-2.07} Compatibility mode for old documents
created using version 2.07 or below.
-\item[\pkgoptdef{compatible-3.07}] Compatibility mode for old documents
+\pkgoptsec[boolean]{compatible-3.07} Compatibility mode for old documents
created using version 3.07 or below.
-\item[\pkgoptdef{kernelglossredefs}] As a legacy from the precursor
+\pkgoptsec[value]{kernelglossredefs} As a legacy from the precursor
\sty{glossary} package, the standard glossary commands provided
by the \LaTeX\ kernel (\cs{makeglossary} and \cs{glossary}) are
redefined in terms of the \styfmt{glossaries} package's commands.
@@ -4503,7 +5265,7 @@ This option may take one of three values: \pkgoptfmt{true}
previous definitions) or \pkgoptfmt{nowarn} (redefine without
warnings, not recommended).
-Note that the only glossary-related commands provided by the \LaTeX\
+The only glossary-related commands provided by the \LaTeX\
kernel are \cs{makeglossary} and \cs{glossary}. Other packages
or classes may provide additional glossary-related commands or
environments that conflict with \styfmt{glossaries} (such as
@@ -4517,8 +5279,6 @@ In general, if possible, it's best to stick with just one package that
provides a glossary mechanism. (The \styfmt{glossaries} package does
check for the \sty{doc} package and patches \cs{PrintChanges}.)
-\end{description}
-
\section{Setting Options After the Package is Loaded}
\label{sec:setupglossaries}
@@ -4527,7 +5287,7 @@ Some of the options described above may also be set after the
\begin{definition}[\DescribeMacro{\setupglossaries}]
\cs{setupglossaries}\marg{key-val list}
\end{definition}
-The following package options \textbf{can't} be used in
+The following package options \strong{can't} be used in
\cs{setupglossaries}: \pkgopt{xindy}, \pkgopt{xindygloss},
\pkgopt{xindynoglsnumbers}, \pkgopt{makeindex},
\pkgopt{nolong}, \pkgopt{nosuper}, \pkgopt{nolist},
@@ -4542,7 +5302,7 @@ using commands like \ics{GlsSetXdyLanguage} (see
If you need to use this command, use it as soon as
possible after loading \styfmt{glossaries} otherwise you might
end up using it too late for the change to take effect. For example,
-if you try changing the acronym styles (such as \pkgopt{smallcaps})
+if you try changing the acronym styles (such as \deprecatedpkgopt{smallcaps})
after you have started defining your acronyms, you are likely to get
unexpected results. If you try changing the sort option after you have
started to define entries, you may get unexpected results.
@@ -4566,7 +5326,7 @@ The command
\end{definition}
must be placed in the preamble. This sets up the internal commands
required to make \opt1 work.
-\textbf{If you omit \cs{makenoidxglossaries} none of
+\strong{If you omit \cs{makenoidxglossaries} none of
the glossaries will be displayed.}
\section[Options 2 and 3]{\ifpdf\optsand23\else Options 2 and 3\fi}
@@ -4577,22 +5337,26 @@ The command
\cs{makeglossaries}
\end{definition}
must be placed in the preamble in order to create the customised
-\gls{makeindex} (\filetype{.ist}) or \gls{xindy} (\filetype{.xdy})
+\gls{makeindex} (\filetype{ist}) or \gls{xindy} (\filetype{xdy})
style file (for \optsor23, respectively) and to ensure that glossary
entries are written to the appropriate output files.
-\textbf{If you omit \cs{makeglossaries} none of
+\strong{If you omit \cs{makeglossaries} none of
the glossary files will be created.}
-\begin{important}
+\begin{xtr}
+If you are using \gls{glossaries-extra}, \cs{makeglossaries} has an
+optional argument that allows you to have a hybrid of \optsor12 or
+\optsor13. See \gls{glossaries-extra} manual for further details.
+\end{xtr}
+
+\importantpar
Note that some of the commands provided by the \styfmt{glossaries}
package must not be used after \cs{makeglossaries} as they are
required when creating the customised style file. If you attempt
to use those commands after \cs{makeglossaries} you will generate
an error.
-
Similarly, there are some commands that must not be used before
\cs{makeglossaries}.
-\end{important}
You can suppress the creation of the customised \gls{xindy}
or \gls{makeindex} style file using
@@ -4601,14 +5365,14 @@ or \gls{makeindex} style file using
\end{definition}
That this command must not be used after \cs{makeglossaries}.
\begin{important}
-Note that if you have a custom \filetype{.xdy} file created when using
+Note that if you have a custom \filetype{xdy} file created when using
\styfmt{glossaries} version 2.07 or below, you will need to use the
\pkgopt{compatible-2.07} package option with it.
\end{important}
The default name for the customised style file is given by
-\ics{jobname}\filetype{.ist} (\opt2) or
-\ics{jobname}\filetype{.xdy} (\opt3). This name may be
+\ics{jobname}\filetype{ist} (\opt2) or
+\ics{jobname}\filetype{xdy} (\opt3). This name may be
changed using:
\begin{definition}[\DescribeMacro{\setStyleFile}]
\cs{setStyleFile}\marg{name}
@@ -4662,8 +5426,8 @@ definitions that avoids some of the issues discussed in
\begin{important}
\opt1 enforces the preamble-only restriction on
\ics{newglossaryentry}. \opt4 requires that definitions are provided
-in \texttt{.bib} format. \opt5 requires either preamble-only
-definitions or the use of the \sty{glossaries-extra} package option
+in \filetype{bib} format. \opt5 requires either preamble-only
+definitions or the use of the \gls{glossaries-extra} package option
\optfmt{docdef=restricted}.
\end{important}
@@ -4682,8 +5446,7 @@ New glossary entries are defined using the command:
This is a short command, so values in \meta{key-val list} can't
contain any paragraph breaks. Take care to enclose values containing
any commas (\texttt{,}) or equal signs (\texttt{=}) with braces to hide them
-from the key=value list parser. Be careful to ensure that no
-spurious spaces are included at the start and end of the braces.
+from the key=value list parser.
If you have a long description that
needs to span multiple paragraphs, use
@@ -4694,10 +5457,9 @@ list}\marg{long description}
instead. Note that this command may only be used in the preamble.
Be careful of unwanted spaces. \cs{longnewglossaryentry}
will remove trailing spaces in the description (via \cs{unskip})
-but won't remove leading spaces (otherwise it would interfere with
-commands like \cs{Glsentrydesc}). This command also appends
+but won't remove leading spaces. This command also appends
\cs{nopostdesc} to the end of the description, which suppresses the
-post-description hook. The \sty{glossaries-extra} package provides
+post-description hook. The \gls{glossaries-extra} package provides
a starred version of \cs{longnewglossaryentry} that doesn't append
either \cs{unskip} or \cs{nopostdesc}.
@@ -4714,7 +5476,7 @@ list}\marg{long description}
(These are both preamble-only commands.)
For all the above commands, the first argument, \meta{label}, must be
-a~unique label with which to identify this entry. \textbf{This can't contain
+a~unique label with which to identify this entry. \strong{This can't contain
any non-expandable commands or active characters.} The reason for
this restriction is that the label is used to construct internal commands
that store the associated information (similarly to commands
@@ -4759,15 +5521,15 @@ alphabetically, otherwise the entries can't be sorted correctly.
\end{important}
\item[{\gloskey{description}}] A brief description of this term (to
-appear in the glossary). Within this value, you can use
+appear in the glossary). Within this value, you can use:
\begin{definition}[\DescribeMacro{\nopostdesc}]
\cs{nopostdesc}
\end{definition}
to suppress the
description terminator for this entry. For example, if this
entry is a parent entry that doesn't require a description, you
-can do \verb|description={\nopostdesc}|. If you want a paragraph
-break in the description use
+can do \texttt{description\dequals\mgroup{\cs{nopostdesc}}}. If you want a paragraph
+break in the description use:
\begin{definition}[\DescribeMacro{\glspar}]
\cs{glspar}
\end{definition}
@@ -4777,6 +5539,11 @@ descriptions. If you are using one of the tabular-like glossary
styles that permit multi-line descriptions, use \ics{newline}
not \verb"\\" if you want to force a line break.
+\begin{xtr}
+With \gls{glossaries-extra}, use \ics*{glsxtrnopostpunc} instead of
+\cs{nopostdesc} to suppress the post-description punctuation.
+\end{xtr}
+
\item[{\gloskey{parent}}] The label of the parent entry. Note that
the parent entry must be defined before its sub-entries.
See \sectionref{sec:subentries} for further details.
@@ -4812,7 +5579,8 @@ that if you use \ics{gls}, \ics{Gls}, \ics{GLS}, \cs{glsdisp} before
using \ics{glspl}, the \gloskey{firstplural} value won't be used
with \ics{glspl}.
-\textbf{Note:} prior to version 1.13, the default value of
+\importantpar
+Note: prior to version 1.13, the default value of
\gloskey{firstplural} was always taken by appending \qt{s} to the
\gloskey{first} key, which meant that you had to specify both
\gloskey{plural} and \gloskey{firstplural}, even if you hadn't
@@ -4836,6 +5604,14 @@ general, it's best to use the \gloskey{sort} key if the
You can also override the \gloskey{sort} key by redefining
\ics{glsprestandardsort} (see \sectionref{sec:pkgopts-sort}).
+\begin{bib2gls}
+The \gloskey{sort} key shouldn't be used with \gls{bib2gls}. It has
+a system of fallbacks that allow different types of entries to
+obtain the sort value from the most relevant field. See the
+\gls{bib2gls} manual for further details and see also
+\bibglsgallery{sorting}.
+\end{bib2gls}
+
\opt1 by default strips the \glslink{latexexlatinchar}{standard
\LaTeX\ accents} (that is, accents generated by core \LaTeX\ commands) from the
\gloskey{name} key when it sets the \gloskey{sort} key. So with
@@ -4868,27 +5644,27 @@ sort value starts with a symbol.
Similarly if you use the \sty{inputenc} package:
\begin{alltt}
-\verb|\newglossaryentry{elite}{%|
- name=\verb|{{|\'e\verb|}|lite\verb|}|,
- description=\verb|{select group of people}|
-\verb|}|
+\cs{newglossaryentry}\mgroup{elite}\mgroup{\%
+ name=\mgroup{\mgroup{\'e}lite},
+ description=\mgroup{select group of people}
+}
\end{alltt}
This is equivalent to
\begin{alltt}
-\verb|\newglossaryentry{elite}{%|
- name=\verb|{{|\'e\verb|}|lite\verb|}|,
- description=\verb|{select group of people}|,
+\cs{newglossaryentry}\mgroup{elite}\mgroup{\%
+ name=i\mgroup{\mgroup{\'e}lite},
+ description=\mgroup{select group of people},
sort=elite
-\verb|}|
+}
\end{alltt}
Unless you use the package option \pkgopt[true]{sanitizesort}, in
which case it's equivalent to:
\begin{alltt}
-\verb|\newglossaryentry{elite}{%|
- name=\verb|{{|\'e\verb|}|lite\verb|}|,
- description=\verb|{select group of people}|,
+\cs{newglossaryentry}\mgroup{elite}\mgroup{\%
+ name=\mgroup{\mgroup{\'e}lite},
+ description=\mgroup{select group of people},
sort=\'elite
-\verb|}|
+}
\end{alltt}
Again, this will place the entry before the \qt{A} group.
@@ -4901,7 +5677,7 @@ will set it to the expansion of the \gloskey{name} key (if
Take care with \gls{xindy} (\opt3): if you have entries with the same
\gloskey{sort} value they will be treated as the
same entry. If you use \gls{xindy} and aren't using the \texttt{def}
-or \texttt{use} sort methods, \textbf{always} use the \gloskey{sort}
+or \texttt{use} sort methods, \strong{always} use the \gloskey{sort}
key for entries where the name just consists of a control sequence
(for example \texttt{name=\{\cs{alpha}\}}).
@@ -4936,7 +5712,7 @@ glossary}, but will not automatically add the cross-referenced entry.
The referenced entry should be supplied as the value to this key.
If you want to override the \qt{see} tag, you can supply the new
tag in square brackets before the label. For example
-\verb|see=[see also]{anotherlabel}|. \textbf{Note that if you have
+\verb|see=[see also]{anotherlabel}|. \strong{Note that if you have
suppressed the \gls{numberlist}, the cross-referencing information
won't appear in the glossary, as it forms part of the
\gls*{numberlist}.} You can override this for individual
@@ -4966,12 +5742,44 @@ provides a \texttt{seealso} and \texttt{alias} key. If you want to
avoid the automatic indexing triggered by the \gloskey{see} key,
consider using \opt4.
+\item[{\xtrgloskey{seealso}}]
+This key is only available with \gls{glossaries-extra} and is
+similar to \gloskey{see} but it doesn't allow for the optional tag.
+The \gls{glossaries-extra} package provides \ics*{seealsoname} and
+\texttt{seealso=\marg{list}} is essentially like
+\texttt{see=[\ics*{seealsoname}]\meta{list}} (\optsand34 may treat
+these differently).
+
+\item[{\xtrgloskey{alias}}]
+This key is only available with \gls{glossaries-extra} and is
+another form of cross-referencing. An entry can be aliased to
+another entry with \texttt{alias=\marg{label}}. This behaves like
+\texttt{see=\marg{label}} but also alters the behaviour of commands
+like \cs{gls} so that they index the entry given by \meta{label}
+instead of the original entry. More variations with the key are
+available with \gls{bib2gls}.
+
+\item[\xtrgloskey{category}]
+This key is only available with \gls{glossaries-extra} and is used
+to assign a category to the entry. The value should be a label that
+can be used to identify the category. See
+\gls{glossaries-extra} manual for further details.
+
\end{description}
The following keys are reserved for \ics{newacronym} (see
-\sectionref{sec:acronyms}): \gloskey{long}, \gloskey{longplural},
+\sectionref{sec:acronyms}) and also for \ics*{newabbreviation} (see the
+\gls{glossaries-extra} manual): \gloskey{long}, \gloskey{longplural},
\gloskey{short} and \gloskey{shortplural}.
+\begin{bib2gls}
+There are also special internal field names used by \gls{bib2gls}.
+See the \gls{bib2gls} manual for further details.
+\end{bib2gls}
+
+The supplementary packages \styfmt{glossaries-prefix} (\sectionref{sec:prefix}) and
+\styfmt{glossaries-accsupp} (\sectionref{sec:accsupp}) provide additional keys.
+
\begin{important}
Avoid using any of the \glslike\ or \glstextlike\ commands within
the \gloskey{text}, \gloskey{first}, \gloskey{short} or
@@ -4998,8 +5806,8 @@ description={select group or class}}
Note that the same applies if you are using the \sty{inputenc}
package:
\begin{alltt}
-\verb|\newglossaryentry{elite}{name={{|\'e\verb|}lite},|
-description=\verb|{select group or class}}|
+\cs{newglossaryentry}\mgroup{elite}\mgroup{name=\mgroup{\mgroup{\'e}lite},
+description=\mgroup{select group or class}}
\end{alltt}
(This doesn't apply for \XeLaTeX\ documents using the \sty{fontspec}
package. For further details, see the \qt{UTF-8} section in the
@@ -5702,7 +6510,7 @@ automatically at the start of the document, add the
\cs{AtBeginDocument} command \emph{before} you load the
\sty{glossaries} package (and \sty{babel}, if you are also loading
that) to avoid the creation of the
-\filetype{.glsdefs} file and any associated problems that are caused
+\filetype{glsdefs} file and any associated problems that are caused
by defining commands in the \env{document} environment.
(See \sectionref{sec:docdefs}.)
\end{important}
@@ -5731,8 +6539,8 @@ the entry \texttt{perl} will be added to the main glossary, since
it explicitly sets the type to \texttt{main}.
\end{example}
-\textbf{Note:} if you use \ics{newacronym} (see
-\sectionref{sec:acronyms}) the type is set as
+\importantpar
+Note: if you use \ics{newacronym} (see \sectionref{sec:acronyms}) the type is set as
\verb|type=\acronymtype| unless you explicitly override it. For
example, if my file \texttt{myacronyms.tex} contains:
\begin{verbatim}
@@ -5875,7 +6683,7 @@ To overcome the first two problems, as from version 4.0 the
\styfmt{glossaries} package modifies the definition of
\cs{newglossaryentry} at the beginning of the \env{document}
environment so that the definitions are written to an external file
-(\cs{jobname}\filetype{.glsdefs}) which is then read in at the start
+(\cs{jobname}\filetype{glsdefs}) which is then read in at the start
of the document on the next run. The entry will then only be defined
in the \env{document} environment if it doesn't already exist. This
means that the entry can now be looked up in the glossary, even if
@@ -5886,12 +6694,12 @@ definition, you need a second run to see the effect of your
modification; this method requires an extra \cs{newwrite}, which may
exceed \TeX's maximum allocation; unexpected expansion issues could
occur; the \gloskey{see} key isn't stored, which means it can't be
-added to the \filetype{.glsdefs} file when it's created at the end of the
+added to the \filetype{glsdefs} file when it's created at the end of the
document (and therefore won't be present on subsequent runs).
The \gls{glossaries-extra} package provides a setting (but only for
\optsand23) that allows \cs{newglossaryentry} to occur in the
-document environment but doesn't create the \filetype{.glsdefs}
+document environment but doesn't create the \filetype{glsdefs}
file. This circumvents some problems but it means that you can't
display any of the glossaries before all the entries have been
defined (so it's all right if all the glossaries are at the end of
@@ -6035,7 +6843,7 @@ range encaps. (See the \gls{bib2gls} manual for further details.)
Neither \opt1 nor \opt4 care about the location syntax as long as
it's valid \LaTeX\ code (and doesn't contain fragile commands). In
both cases, the indexing is performed by writing a line to the
-\texttt{.aux} file. The write operation is deferred to avoid the
+\filetype{aux} file. The write operation is deferred to avoid the
problems associated with \TeX's asynchronous output routine.
(See, for example,
\href{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=oddpage}{Finding
@@ -6167,7 +6975,10 @@ this provided the inner command is expandable.)
If the inner macro (as given by \verb|\|\meta{internal cs name}) contains
non-expandable commands then you may need to redefine
\cs{gls}\meta{internal cs name}\texttt{page} after using
-\cs{glsaddprotectedpagefmt}\marg{internal cs name}. This command doesn't take any arguments
+\begin{alltt}
+\cs{glsaddprotectedpagefmt}\marg{internal cs name}
+\end{alltt}
+This command doesn't take any arguments
as \emph{the location is assumed to be given by \cs{c@page}} because
that's the only occasion this command should be used. For example,
suppose now my page counter format uses small caps Roman numerals:
@@ -6208,7 +7019,7 @@ combined with
will now have lowercase Roman numerals in the location list
(see \sectionref{sec:xindyloc} for further details on that command).
Take care of the backslashes. The location (which ends up in
-the ":locref" attribute) needs \verb|\\| but the location class
+the \xindyattr{:locref} attribute) needs \verb|\\| but the location class
(identified with \cs{GlsAddXdyLocation}) just has a single
backslash. Note that this example will cause problems if your
locations should be hyperlinks.
@@ -6375,7 +7186,7 @@ information}. For example, if you are using \app{makeindex}:
\write\glswrite{line_max 80}%
}
\end{verbatim}
-This changes the page type precedence\index{page type precedence} and the maximum line length
+This changes the page type precedence\index{page type precedence|main} and the maximum line length
used by \app{makeindex}.
Remember that if you switch to \app{xindy}, this will no longer be
@@ -6400,7 +7211,7 @@ the page number. For further information on number lists, see
post-processed by \gls{makeindex} or \gls{xindy} unless you have
chosen \optsor14. If you don't use \ics{makeglossaries} these external
files won't be created. (\optsand14 write the information to the
-\filetype{.aux} file.)
+\filetype{aux} file.)
Note that repeated use of these commands for the same entry can
cause the \gls{numberlist} to become quite long, which may not be
@@ -6587,7 +7398,10 @@ If you are using hyperlinks and you want to change the font of the
hyperlinked location, don't use \ics{hyperpage} (provided by the
\sty{hyperref} package) as the locations may not refer to a page
number. Instead, the \styfmt{glossaries} package provides number
-formats listed in \tableref{tab:hyperxx}.
+formats listed in \tableref{tab:hyperxx}. These commands are
+designed to work with the particular location formats created by
+\gls{makeindex} and \gls{xindy} and shouldn't be used in other
+contexts.
\begin{table}[htbp]
\caption{Predefined Hyperlinked Location Formats}
@@ -6620,11 +7434,21 @@ sans-serif font, you can define a command called, say,
\begin{verbatim}
\newcommand{\hyperbsf}[1]{\textbf{\hypersf{#1}}}
\end{verbatim}
-and then use \texttt{hyperbsf} as the value for the \gloskey{format}
+and then use \texttt{hyperbsf} as the value for the \gloskey[glslink]{format}
key.\footnote{See also \ifpdf section~\ref*{sec:code:printglos} \fi
\qt{Displaying the glossary} in the documented code,
-\texttt{glossaries-code.pdf}.} Remember that if you use \gls{xindy}, you
-will need to add this to the list of location attributes:
+\texttt{glossaries-code.pdf}.}
+
+\begin{important}
+When defining a custom location format command that uses one of the
+\csmeta{hyper}{xx}{} commands, make sure that the argument of
+\csmeta{hyper}{xx}{} is just the location. Any formatting must be
+outside of \csmeta{hyper}{xx}{} (as in the above \cs{hyperbfsf}
+example).
+\end{important}
+
+Remember that if you use \gls{xindy}, you
+will need to add this to the list of location \ixindyattrs attributes:
\begin{verbatim}
\GlsAddXdyAttribute{hyperbsf}
\end{verbatim}
@@ -6639,10 +7463,40 @@ entry's \gls{firstuseflag}. If \texttt{local=true}, the change to
the \gls*{firstuseflag} will be localised to the current scope. The
default is \texttt{local=false}.
+\item[{\xtrgloskey[glslink]{noindex}}] This is a boolean key that
+suppresses the indexing. Only available with \gls{glossaries-extra}.
+
+\item[{\xtrgloskey[glslink]{hyperoutside}}] This is a boolean key that
+determines whether to put the hyperlink outside of \ics{glstextformat}.
+Only available with \gls{glossaries-extra}.
+
+\item[{\xtrgloskey[glslink]{wrgloss}}] This key determines
+whether to index before (\texttt{wrgloss\dequals before}) or after
+(\texttt{wrgloss\dequals after}) the \gls{linktext}.
+Only available with \gls{glossaries-extra}.
+
+\item[{\xtrgloskey[glslink]{textformat}}] This key identifies the
+name of the control sequence to encapsulate the \gls{linktext}
+instead of the default \ics{glstextformat}.
+Only available with \gls{glossaries-extra}.
+
+\item[{\xtrgloskey[glslink]{prefix}}] This key locally redefines
+\ics{glolinkprefix} to the given value.
+Only available with \gls{glossaries-extra}.
+
+\item[{\xtrgloskey[glslink]{thevalue}}] This key explicitly sets the
+location.
+Only available with \gls{glossaries-extra}.
+
+\item[{\xtrgloskey[glslink]{theHvalue}}] This key explicitly sets the
+hyperlink location.
+Only available with \gls{glossaries-extra}.
+
\end{description}
\begin{important}
-The \gls{linktext} isn't scoped by default. Any unscoped
+The \gls{linktext} isn't scoped by default with just the base
+\styfmt{glossaries} package. Any unscoped
declarations in the \gls{linktext} may affect subsequent text.
\end{important}
@@ -6655,7 +7509,6 @@ to determine the text to be displayed. As described above, these
commands all have a star-variant (\texttt{hyper=false}) and
a plus-variant (\texttt{hyper=true}) and have an
optional first argument that is a \meta{key}=\meta{value} list.
-
These commands use \ics{glsentryfmt} or the equivalent definition provided by
\ics{defglsentryfmt} to determine the automatically generated text
and its format (see \sectionref{sec:glsdisplay}).
@@ -6826,7 +7679,7 @@ Now the \gls{linktext} will be set to:
\glsentrytext{\MakeUppercase sample} two
\end{verbatim}
This will generate an error because there's no entry with the label
-given by \verb|\MakeUppercase sample|. The best solution here is to
+\qt{\texttt{\cs{MakeUppercase} sample}}. The best solution here is to
write the term out in the \gloskey{text} field and use the command
in the \gloskey{name} field. If you don't use \cs{glsname} anywhere
in your document, you can use \cs{gls} in the \gloskey{name} field:
@@ -7175,6 +8028,12 @@ There are also analogous uppercasing commands:
\section{Changing the format of the link text}
\label{sec:glsdisplay}
+\begin{xtr}
+The \gls{glossaries-extra} package provides ways of altering the
+format according to the category. See the \gls{glossaries-extra}
+manual for further details.
+\end{xtr}
+
The default format of the \gls{linktext} for the \glslike\ commands
is governed by\footnote{\ics{glsdisplayfirst} and \ics{glsdisplay} are now
deprecated. Backwards compatibility should be preserved but
@@ -7259,7 +8118,11 @@ is in a glossary type that's had the hyperlinks switched off (using
\pkgopt{nohypertypes}) or because it's the \firstuse\ and the
hyperlinks have been suppressed on first use.
-Note that \ics{glsifhyper} is now deprecated.
+\begin{important}
+The \cs{glsifhyperon} command should be used instead of
+\ics{glsifhyper}, which is now deprecated (and no longer documented).
+\end{important}
+
If you want to know if the command used to reference
this entry was used with the star or plus variant, you can use:
\begin{definition}[\DescribeMacro\glslinkvar]
@@ -7277,7 +8140,7 @@ Note that you can also use commands such as \ics{ifglsused} within
the definition of \cs{glsentryfmt} (see \sectionref{sec:glsunset}).
The commands \ics{glslabel}, \ics{glstype}, \ics{glsifplural},
-\ics{glscapscase}, \ics{glscustomtext} and \ics{glsinsert} are
+\ics{glscapscase}, \ics{glsinsert} and \ics{glscustomtext} are
typically updated at the start of the \glslike\ and \glstextlike\
commands so they can usually be accessed in the hook user commands,
such as \ics{glspostlinkhook} and \ics{glslinkpostsetkeys}.
@@ -7303,7 +8166,7 @@ This uses the above commands to display just the \gloskey{first},
\gloskey{text}, \gloskey{plural} or \gloskey{firstplural} keys
(or the custom text) with the insert text appended.
-Alternatively, if want to change the entry format for abbreviations
+Alternatively, if you want to change the entry format for abbreviations
(defined via \ics{newacronym}) you can use:
\begin{definition}[\DescribeMacro{\glsgenacfmt}]
\cs{glsgenacfmt}
@@ -7618,7 +8481,7 @@ To add all entries that have been defined, use:
The optional argument is the same as for \cs{glsadd}, except
there is also a key \gloskey[glsaddall]{types} which can be
used to specify which glossaries to use. This should be a
-comma separated list. For example, if you only want to add
+comma-separated list. For example, if you only want to add
all the entries belonging to the list of acronyms (specified by
the glossary type \ics{acronymtype}) and a list of
notation (specified by the glossary type \texttt{notation}) then you can
@@ -7626,6 +8489,9 @@ do:
\begin{verbatim}
\glsaddall[types={\acronymtype,notation}]
\end{verbatim}
+If you are using \gls{bib2gls} with \gls{glossaries-extra}, you
+can't use \cs{glsaddall}. Instead use the \optfmt{selection=all}
+resource option to select all entries in the given \filetype{bib} files.
\begin{important}
Note that \cs{glsadd} and \cs{glsaddall} add the current location to
@@ -7641,15 +8507,54 @@ that have already been used:
\begin{definition}[\DescribeMacro\glsaddallunused]
\cs{glsaddallunused}\oarg{list}
\end{definition}
-This command uses \cs{glsadd}\texttt{[format=@gobble]} which will
+This command uses \cs{glsadd}\texttt{[format=glsignore]} which will
ignore this location in the number list. The optional argument
\meta{list} is a comma-separated list of glossary types. If omitted,
it defaults to the list of all defined glossaries.
+\begin{important}
If you want to use \cs{glsaddallunused}, it's best to place the
command at the end of the document to ensure that all the commands
you intend to use have already been used. Otherwise you could end up
with a spurious comma or dash in the location list.
+\end{important}
+
+With \gls{glossaries-extra} and \gls{bib2gls}, \texttt{glsignore}
+indicates an \qt{ignored location} which influences selection but
+isn't added to the location list. In this case, if you use
+\optfmt{selection=all} then only those entries that have been
+explicitly indexed in the document will have location lists. The
+other entries that were selected as a result of
+\optfmt{selection=all} won't have location lists.
+
+Base \sty{glossaries} package only:
+\begin{verbatim}
+\documentclass{article}
+\usepackage{glossaries}
+\makeglossaries
+\newglossaryentry{cat}{name={cat},description={feline}}
+\newglossaryentry{dog}{name={dog},description={canine}}
+\begin{document}
+\gls{cat}.
+\printglossaries
+\glsaddallunused % <- make sure dog is also listed
+\end{document}
+\end{verbatim}
+Corresponding \gls{glossaries-extra} and \gls{bib2gls} document code:
+\begin{verbatim}
+\documentclass{article}
+\usepackage[record]{glossaries-extra}
+\GlsXtrLoadResources[src={entries},selection=all]
+\begin{document}
+\gls{cat}.
+\printunsrtglossaries
+\end{document}
+\end{verbatim}
+With the file \texttt{entries.bib}:
+\begin{verbatim}
+@entry{cat,name={cat},description={feline}}
+@entry{dog,name={dog},description={canine}}
+\end{verbatim}
\begin{example}{Dual Entries}{ex:dual}
The example file \samplefile{-dual} makes use of \cs{glsadd} to
@@ -7684,6 +8589,12 @@ You can then define a new dual entry:
\end{verbatim}
Now you can reference the acronym with \verb|\gls{svm}| or you can
reference the entry in the main glossary with \verb|\gls{main-svm}|.
+
+Note that with \gls{bib2gls}, there are special dual entry types
+that implement this behaviour. That is, if an entry is referenced
+then its corresponding dual entry will automatically be selected as
+well. So there is less need for \cs{glsadd} with \gls{bib2gls}.
+(Although it can still be useful, as shown in \opt6.)
\end{example}
\chapter{Cross-Referencing Entries}
@@ -7712,13 +8623,13 @@ description={firm, round fruit. See also \gls{pear}}}
Note that with this method, if you don't use the cross-referenced term
in the main part of the document, you will need two runs of
\gls{makeglossaries}:
-\begin{verbatim}
-latex filename
+\begin{prompt}
+pdflatex filename
makeglossaries filename
-latex filename
+pdflatex filename
makeglossaries filename
-latex filename
-\end{verbatim}
+pdflatex filename
+\end{prompt}
\item As described in \sectionref{sec:newglosentry}, you can use the
\gloskey{see} key when you define the entry. For example:
@@ -7893,7 +8804,8 @@ For example:
\glsentrytitlecase{sample}{desc}
\end{verbatim}
(If you want title-casing in your glossary style, you might want to
-investigate the \sty{glossaries-extra} package.)
+investigate the \gls{glossaries-extra} package.) This command will
+trigger an error if the entry is undefined.
Note that this command has the same limitations as \cs{makefirstuc} which is
used by commands like \cs{Gls} and \cs{Glsentryname} to upper-case
@@ -7999,7 +8911,9 @@ existence of \meta{label}.
\cs{Glsentrydesc}\marg{label}
\end{definition}
These commands display the description for the glossary entry given
-by \meta{label}. \cs{Glsentrydesc} makes the first letter upper case.
+by \meta{label}.
+
+\cs{Glsentrydesc} makes the first letter upper case.
The first form is expandable (unless the value of that key contains unexpandable
commands). The second form is not expandable. Neither checks for the
existence of \meta{label}.
@@ -8038,7 +8952,9 @@ existence of \meta{label}.
\cs{Glsentrysymbol}\marg{label}
\end{definition}
These commands display the symbol for the glossary entry given by
-\meta{label}. \cs{Glsentrysymbol} makes the first letter upper case.
+\meta{label}.
+
+\cs{Glsentrysymbol} makes the first letter upper case.
The first form is expandable (unless the value of that key contains unexpandable
commands). The second form is not expandable. Neither checks for the
existence of \meta{label}.
@@ -8131,7 +9047,7 @@ the existence of \meta{label}.
\cs{glshyperlink}\oarg{link text}\marg{label}
\end{definition}
This command provides a hyperlink to the glossary entry given by
-\meta{label} \textbf{but does not add any information to the
+\meta{label} \strong{but does not add any information to the
glossary file}. The link text is given by
\ics{glsentrytext}\marg{label} by default\footnote{versions before
3.0 used \ics{glsentryname} as the default, but this could cause
@@ -8193,32 +9109,47 @@ glossary} in the documented code (\texttt{glossaries-code.pdf}).
All defined glossaries may be displayed using:
\begin{description}
-\itempar{\opt1:}
-\begin{definition}[\DescribeMacro{\printnoidxglossaries}]
+\item[\opt1:]
+(Must be used with \ics{makenoidxglossaries} in the preamble.)
+\begin{definition}[\DescribeMacro\printnoidxglossaries]
\cs{printnoidxglossaries}
\end{definition}
-(Must be used with \ics{makenoidxglossaries} in the preamble.)
-\itempar{\optsand23:}
-\begin{definition}[\DescribeMacro{\printglossaries}]
+\item[\optsand23:]
+(Must be used with \ics{makeglossaries} in the preamble.)
+\begin{definition}[\DescribeMacro\printglossaries]
\cs{printglossaries}
\end{definition}
-(Must be used with \ics{makeglossaries} in the preamble.)
\end{description}
These commands will display all the glossaries in the order in which
-they were defined. Note that, in the case of \optsand23, no
-glossaries will appear until you have either used the Perl script
-\gls{makeglossaries} or Lua script \gls{makeglossaries-lite.lua} or
-have directly used \gls{makeindex} or \gls{xindy} (as described in
-\sectionref{sec:makeglossaries}). (While the external files are
-missing, these commands will just do \cs{null} for each missing
-glossary to assist dictionary style documents that just use
-\cs{glsaddall} without inserting any text. If you use
-\gls{glossaries-extra}, it will insert a heading and boilerplate text when the
+they were defined.
+
+Note that, in the case of \optsand23, no glossaries will appear
+until you have either used the Perl script \gls{makeglossaries} or
+Lua script \gls{makeglossaries-lite.lua} or have directly used
+\gls{makeindex} or \gls{xindy} (as described in
+\sectionref{sec:makeglossaries}).
+
+\begin{important}
+While the external files are missing, \cs{printglossary} will just do
+\ics{null} for each missing glossary to assist dictionary style
+documents that just use \cs{glsaddall} without inserting any text.
+This use of \ics{null} ensures that all indexing information is
+written before the final page is shipped out. Once the external
+files are present \cs{null} will no longer be used. This can cause a
+spurious blank page on the first \LaTeX\ run before the glossary
+files have been created. Once these files are present, \cs{null}
+will no longer be used and so shouldn't cause interference for the
+final document.
+\end{important}
+
+\begin{xtr}
+If you use \gls{glossaries-extra}, it will insert a heading and boilerplate text when the
external files are missing. The extension package also provides
\cs{printunsrtglossaries} as an alternative. See the
-\gls{glossaries-extra} manual for further details.)
+\gls{glossaries-extra} manual for further details.
+\end{xtr}
If the glossary still does not appear after you re-\LaTeX\ your
document, check the \gls*{makeindex}\slash\gls*{xindy} log files to
@@ -8337,6 +9268,36 @@ If you don't get an error with \texttt{sort=use} and
options, then you probably need to use the
\pkgopt[true]{sanitizesort} package option or make sure none of the
entries have fragile commands in their \gloskey{sort} field.
+
+\item[{\xtrprintglosskey[\marg{label}]{label}}]
+This key is only available with \gls{glossaries-extra} and labels
+the glossary with \cs{label}\marg{label}. This is an alternative to
+the package option \pkgopt[autolabel]{numberedsection}
+
+\item[\xtrprintglosskey{target}] This is a boolean key only
+available with \gls{glossaries-extra}, which can be used to switch
+off the automatic hypertarget for each entry. (This refers to the
+target used by commands like \cs{gls} and \cs{glslink}.)
+
+This option is useful with \ics*{printunsrtglossary} as it allows
+the same list (of sub-list) of entries to be displayed multiple
+times without causing duplicate hypertarget names.
+
+\item[{\xtrprintglosskey[\marg{prefix}]{prefix}}]
+This key is only available with \gls{glossaries-extra} and provides
+another way of avoiding duplicate hypertarget names is to use a
+different prefix for those names. This locally redefines
+\ics{glolinkprefix} but note this will also affect the target for any entry
+referenced within the glossary with commands like \cs{gls},
+\cs{glslink} or \cs{glshypertarget}.
+
+\item[{\xtrprintglosskey[\marg{prefix}]{targetnameprefix}}]
+This key is only available with \gls{glossaries-extra}.
+This is similar to the \pkgoptfmt{prefix} option, but it alters the prefix of
+the hypertarget anchors without changing \ics{glslinkprefix} (so it
+won't change the hyperlinks for any entries referenced in the
+glossary).
+
\end{description}
By default, the glossary is started either by \ics{chapter*} or by
@@ -8423,7 +9384,7 @@ bold.
If you want to change the font for the description, or if you
only want to change the name font for some types of entries
but not others, you might want to consider using the
-\sty{glossaries-extra} package.
+\gls{glossaries-extra} package.
\begin{example}{Changing the Font Used to Display Entry Names in the
Glossary}{ex:glsnamefont}
@@ -8449,7 +9410,7 @@ This ensures that the glossary information is written in
\gls{indexingapp}, and \sectionref{sec:locationsyntax} covers the
issues involved in the location syntax. This section covers the
commands provided by the \styfmt{glossaries} package that allow you
-to adjust the \gls{xindy} style file (\filetype{.xdy}) and
+to adjust the \gls{xindy} style file (\filetype{xdy}) and
parameters.
To assist writing information to the \gls{xindy} style
@@ -8509,7 +9470,7 @@ and encoding used (unless you have written your own custom
\gls*{xindy} style file that defines the relevant alphabet
and sort rules). If you use \gls{makeglossaries},
this information is obtained from the document's auxiliary
-(\filetype{.aux}) file. The \gls{makeglossaries} script attempts to
+(\filetype{aux}) file. The \gls{makeglossaries} script attempts to
find the root language given your document settings, but in the
event that it gets it wrong or if \gls*{xindy} doesn't support
that language, then you can specify the required language using:
@@ -8575,7 +9536,7 @@ counter in the \gloskey[glslink]{counter} key for commands like
\end{definition}
where \meta{counter list} is a comma-separated list of counter names.
-The most likely attributes used in the \gloskey[glslink]{format}
+The most likely \ixindyattrs attributes used in the \gloskey[glslink]{format}
key (\locfmt{textrm}, \locfmt{hyperrm} etc) are automatically added
to the \gls{xindy} style file, but if you want to use another
attribute, you need to add it using:
@@ -8587,7 +9548,7 @@ the \gloskey[glslink]{format} key.
Take care if you have multiple instances of the same location with
different formats. The duplicate locations will be discarded
-according to the order in which the attributes are listed. Consider
+according to the order in which the \ixindyattrs attributes are listed. Consider
defining semantic commands to use for primary references. For
example:
\begin{verbatim}
@@ -8609,7 +9570,7 @@ command that will do this:
\newcommand*{\hyperbfit}[1]{\textit{\hyperbf{#1}}}
\end{verbatim}
but with \gls{xindy}, I also need to add this as an allowed
-attribute:
+\ixindyattrs attribute:
\begin{verbatim}
\GlsAddXdyAttribute{hyperbfit}
\end{verbatim}
@@ -9052,6 +10013,13 @@ glossary type will automatically be added to the
the entries in an ignored glossary.
(The sample file \samplefile{-entryfmt} defines an ignored glossary.)
+\begin{xtr}
+The \gls{glossaries-extra} package provides a starred version of
+this command that allows hyperlinks (since ignored glossaries can be
+useful with \gls{bib2gls}). There is also an analogous
+\ics*{provideignoredglossary} command.
+\end{xtr}
+
You can test if a glossary is an ignored one using:
\begin{definition}[\DescribeMacro\ifignoredglossary]
\cs{ifignoredglossary}\marg{name}\marg{true}\marg{false}
@@ -9111,9 +10079,11 @@ change LaTeX’s \qt{fixed names}}.
\chapter{Acronyms and Other Abbreviations}
\label{sec:acronyms}
-The \sty{glossaries-extra} package provides superior
+\begin{xtr}
+The \gls{glossaries-extra} package provides superior
abbreviation handling. You may want to consider using that
package instead of the commands described here.
+\end{xtr}
\begin{important}
Note that although this chapter uses the term \qt{acronym}, you can also
@@ -9124,8 +10094,8 @@ should be \qt{Abbreviations} rather than \qt{Acronyms}) then
you can change the title either by redefining \ics{acronymname} (see
\sectionref{sec:languages}) or by using the \gloskey[printglossary]{title}
in the optional argument of \ics{printglossary} (or
-\ics{printacronym}). Alternatively consider using the
-\sty{glossaries-extra} package's \pkgoptfmt{abbreviations}
+\ics{printacronyms}). Alternatively consider using the
+\gls{glossaries-extra} package's \pkgopt*{abbreviations}
option instead.
\end{important}
@@ -9192,7 +10162,7 @@ changed by the associated language files, but they can't be added to
the usual caption hooks as there's no guarantee when they'll be
expanded (as \hyperref[pluralsuffix]{discussed earlier}).
A different approach is used by \styfmt{glossaries-extra}, which has
-category attributes to determine whether or not to append a suffix
+\icatattrs category attributes to determine whether or not to append a suffix
when forming the default value of \gloskey{shortplural}.
Since \ics{newacronym} uses \ics{newglossaryentry}, you can use
@@ -9215,7 +10185,7 @@ The following defines the abbreviation IDN:
\end{verbatim}
\verb|\gls{idn}| will produce \qt{identification number (IDN)} on
\firstuse\ and \qt{IDN} on subsequent uses. If you want to use one
-of the smallcaps acronym styles, described in
+of the \gls{smallcaps} acronym styles, described in
\sectionref{sec:setacronymstyle}, you need to use lower case
characters for the shortened form:
\begin{verbatim}
@@ -9246,7 +10216,7 @@ you may be tempted to do:
\begin{verbatim}
\newacronym{shtml}{S\gls{html}}{\gls{ssi} enabled \gls{html}}
\end{verbatim}
-\textbf{Don't!} This will break the case-changing commands, such
+\strong{Don't!} This will break the case-changing commands, such
as \ics{Gls}, it will cause inconsistencies on \firstuse, and,
if hyperlinks are enabled, will cause nested hyperlinks. It will
also confuse the commands used by the entry formatting (such as
@@ -9267,7 +10237,7 @@ or
\end{verbatim}
Similarly for the \glstextlike\ commands.
-Other approaches are available with \sty{glossaries-extra}.
+Other approaches are available with \gls{glossaries-extra}.
See the section \qt{Nested Links} in the \styfmt{glossaries-extra}
user manual.
@@ -9357,8 +10327,8 @@ This is a shortcut for
which by default does
\begin{alltt}
\cs{acrfullformat}
- \{\cs{acrlong}\oarg{options}\marg{label}\marg{insert}\}
- \{\cs{acrshort}\oarg{options}\marg{label}\}
+ \mgroup{\cs{acrlong}\oarg{options}\marg{label}\marg{insert}}
+ \mgroup{\cs{acrshort}\oarg{options}\marg{label}}
\end{alltt}
where
\begin{definition}[\DescribeMacro\acrfullformat]
@@ -9515,7 +10485,7 @@ using the \gls{glossaries-extra} package, which has better
abbreviation management.
\end{important}
-Note that unlike the default behaviour of \cs{newacronym}, the
+Unlike the default behaviour of \cs{newacronym}, the
styles used via \cs{setacronymstyle} don't use the \gloskey{first}
or \gloskey{text} keys, but instead they use \ics{defglsentryfmt} to
set a~custom format that uses the \gloskey{long} and \gloskey{short}
@@ -9568,7 +10538,7 @@ in lower case. \ifpdf Remember that \verb|\textsc{abc}| produces
\hypertarget{boldsc}{}%
\begin{important}%
-Some fonts don't support bold smallcaps, so you may need to redefine
+Some fonts don't support bold \gls{smallcaps}, so you may need to redefine
\ics{glsnamefont} (see \sectionref{sec:printglossary}) to switch to
medium weight if you are using a glossary style that displays entry
names in bold and you have chosen an acronym style that uses
@@ -9737,14 +10707,17 @@ and then redefine \ics{acronymsort} and \ics{acronymentry}:
(I've used \cs{space} for extra clarity, but you can just use an
actual space instead.)
-Since the default Computer Modern fonts don't support bold
-smallcaps, I'm also going to redefine \ics{acronymfont} so that it
-always switches to medium weight to ensure the smallcaps setting is
-used:
+Note that the default Computer Modern fonts don't support bold
+\gls{smallcaps}, so another font is required. For example:
+\begin{verbatim}
+\usepackage[T1]{fontenc}
+\end{verbatim}
+The alternative is to redefine \ics{acronymfont} so that it
+always switches to medium weight to ensure the \gls{smallcaps} setting is
+used. For example:
\begin{verbatim}
\renewcommand*{\acronymfont}[1]{\textmd{\scshape #1}}
\end{verbatim}
-This isn't necessary if you use a font that supports bold smallcaps.
The sample file \samplefile{FnAcrDesc} illustrates this
example.
@@ -10006,7 +10979,7 @@ change the above to:
\end{verbatim}
The acronym font needs to be set to \ics{textsc} and the plural
suffix adjusted so that the \qt{s} suffix in the plural short form
-doesn't get converted to smallcaps:
+doesn't get converted to \gls{smallcaps}:
\begin{verbatim}
\renewcommand*{\acronymfont}[1]{\textsc{##1}}%
\renewcommand*{\acrpluralsuffix}{\glstextup{\glspluralsuffix}}%
@@ -10288,8 +11261,7 @@ before the full stop.
The next example shows one way of achieving this.
(Note that the supplemental \gls{glossaries-extra} package provides a much
simpler way of doing this, which you may prefer to use. See the
-\href{http://www.dickimaw-books.com/gallery/sample-initialisms.shtml}{initialisms
-example}.)
+\gallery{sample-initialisms.shtml}{initialisms example}.)
\begin{example}{Abbreviations with Full Stops (Periods)}{ex:dotabbr}
As from version 4.16, there's now a hook (\ics{glspostlinkhook})
@@ -10458,7 +11430,8 @@ names consisting of alphabetical characters. This is also true for
using \sty{xspace}.\footnotemark
\end{important}
\footnotetext{See David Carlisle's explanation in
-\url{http://tex.stackexchange.com/questions/86565/drawbacks-of-xspace}}
+\href{http://tex.stackexchange.com/questions/86565/drawbacks-of-xspace}{Drawbacks
+of xspace}}
The \styfmt{glossaries} package doesn't load the \sty{xspace} package
since there are both advantages and disadvantages to using
@@ -10642,6 +11615,13 @@ checks for this. For \sty{tabularx}, you need to explicitly patch it
by placing \cs{glspatchtabularx} in the preamble (or anywhere
before the problematic use of \envfmt{tabularx}).
+\begin{xtr}
+If you need to use commands like \cs{gls} in any problematic context
+that interferes with the \gls{firstuseflag}, then you can try using
+the buffering system provided with \gls{glossaries-extra}. See the
+\qt{First Use Flag} section of the \gls{glossaries-extra} manual.
+\end{xtr}
+
\section{Counting the Number of Times an Entry has been Used (First Use
Flag Unset)}
\label{sec:enableentrycount}
@@ -10676,7 +11656,7 @@ to zero (where \cs{glslocalreset} performs a~local change).
The \texttt{prevcount} field stores the final value of the
\texttt{currcount} field \emph{from the previous run}. This value is
-read from the \texttt{.aux} file at the beginning of the
+read from the \filetype{aux} file at the beginning of the
\env{document} environment.
You can access these fields using
@@ -10687,8 +11667,11 @@ for the \texttt{currcount} field, and
\begin{definition}[\DescribeMacro\glsentryprevcount]
\cs{glsentryprevcount}\marg{label}
\end{definition}
-for the \texttt{prevcount} field. \textbf{These commands are
-only defined if you have used \cs{glsenableentrycount}.}
+for the \texttt{prevcount} field.
+
+\begin{important}
+These commands are only defined if you have used \cs{glsenableentrycount}.
+\end{important}
For example:
\begin{verbatim}
@@ -10866,6 +11849,11 @@ synonym. For example
\let\ac\cgls
\end{verbatim}
+\begin{bib2gls}
+With \gls{bib2gls} there's an analogous record counting set of
+commands. See \gls{glossaries-extra} and \gls{bib2gls} manuals for further details.
+\end{bib2gls}
+
\chapter{Glossary Styles}
\label{sec:styles}
@@ -10879,8 +11867,7 @@ with a number of pre-defined glossary styles, described in
best suits your type of glossary or, if none of them suit your
document, you can defined your own style (see
\sectionref{sec:newglossarystyle}). There are some examples
-of glossary styles available at
-\url{http://www.dickimaw-books.com/gallery/#glossaries}.
+of glossary styles available at \gallerytopic{glossaries}.
The glossary style can be set using the \gloskey[printglossary]{style} key in the optional
argument to \ics{printnoidxglossary} (\opt1) or \ics{printglossary}
@@ -10896,9 +11883,15 @@ is automatically loaded by the \styfmt{glossaries} package.
You can use the lorum ipsum dummy entries provided in the
accompanying
-\texttt{example-glossaries-*.tex} files (described in
+\texttt{example\dhyphen glossaries\dhyphen *.tex} files (described in
\sectionref{sec:lipsum}) to test the different styles.
+\begin{xtr}
+The \sty{glossaries-extra-stylemods} package provided with
+\gls{glossaries-extra} patches the predefined styles. There also
+more styles available with \gls{glossaries-extra}.
+\end{xtr}
+
\section{Predefined Styles}
\label{sec:predefinedstyles}
@@ -10909,7 +11902,7 @@ package options \pkgopt{entrycounter}, \pkgopt{counterwithin} and
\sectionref{sec:pkgopts-printglos}. There is a summary
of available styles in \tableref{tab:styles}.
You can view samples of all the predefined styles at
-\url{http://www.dickimaw-books.com/gallery/glossaries-styles/}.
+\galleryurl{glossaries-styles/}.
Note that \gls{glossaries-extra} provides additional styles
in the supplementary packages \sty{glossary-bookindex} and
\sty{glossary-longnoloc}. See the \gls{glossaries-extra} manual for
@@ -10967,10 +11960,15 @@ be displayed.}
\end{table}
The tabular-like styles that allow multi-line descriptions and page
-lists use the length \DescribeMacro{\glsdescwidth}\cs{glsdescwidth}
+lists use the length
+\begin{definition}[\DescribeMacro{\glsdescwidth}]
+\cs{glsdescwidth}
+\end{definition}
to set the width of the description column and the length
-\DescribeMacro{\glspagelistwidth}\cs{glspagelistwidth} to set the
-width of the page list column.\footnote{These lengths will not be
+\begin{definition}[\DescribeMacro{\glspagelistwidth}]
+\cs{glspagelistwidth}
+\end{definition}
+to set the width of the page list column.\footnote{These lengths will not be
available if you use both the \pkgopt{nolong} and \pkgopt{nosuper}
package options or if you use the \pkgopt{nostyles} package option
unless you explicitly load the relevant package.}
@@ -11033,15 +12031,15 @@ a comma) you will need to redefine \cs{glspostdescription} before
the glossary is displayed. Alternatively, you can suppress it for a
given entry by placing \ics{nopostdesc} in the entry's description.
Note that \ics{longnewglossaryentry} puts \cs{nopostdesc} at the end
-of the description. The \sty{glossaries-extra} package provides a
+of the description. The \gls{glossaries-extra} package provides a
starred version that doesn't.
As from version 3.03 you can now use the package option
\pkgopt{nopostdot} to suppress this full stop. This is the better
-option if you want to use the \sty{glossaries-extra} package.
+option if you want to use the \gls{glossaries-extra} package.
The \sty{glossaries-extra-stylemods} package provides some
adjustments some of to the predefined styles listed here, allowing
-for greater flexibility. See the \sty{glossaries-extra}
+for greater flexibility. See the \gls{glossaries-extra}
documentation for further details.
\subsection{List Styles}
@@ -11580,7 +12578,7 @@ style is like \glostyle{superragged3col} but has a header row.
\item[superragged3colheaderborder] The
\glostyle{superragged3colheaderborder} style is like
-\glostyle{superragged3colheader} but has horizontal and vertical
+the above but has horizontal and vertical
lines around it.
\item[altsuperragged4col] The \glostyle{altsuperragged4col} style is
@@ -11600,7 +12598,7 @@ lines around it.
\item[altsuperragged4colheaderborder] The
\glostyle{altsuperragged4colheaderborder} style is like
-\glostyle{altsuperragged4colheader} but has horizontal and vertical
+the above but has horizontal and vertical
lines around it.
\end{description}
@@ -11635,7 +12633,9 @@ the navigation line using
\begin{definition}[\DescribeMacro\glstreenavigationfmt]
\cs{glstreenavigationfmt}\marg{text}
\end{definition}
-which defaults to \cs{glstreenamefmt}\marg{text}. Note that this is
+which defaults to \cs{glstreenamefmt}\marg{text}.
+
+Note that this is
different from \cs{glslistnavigationitem}, provided with the styles
such as \glostyle{listhypergroup}, as that also includes \cs{item}.
@@ -11945,7 +12945,7 @@ This is used to format the entry name and defaults to
\cs{glstarget}\marg{label}\marg{name}, where \meta{name} is provided
in the form \cs{glossentryname}\marg{label} and \meta{label} is the
entry's label. For example, if you want the name to appear in
-smallcaps:
+\gls{smallcaps}:
\begin{verbatim}
\renewcommand*{\glsinlinenameformat}[2]{\glstarget{#1}{\textsc{#2}}}
\end{verbatim}
@@ -12001,7 +13001,9 @@ needs to redefine all of the following:
\env{theglossary}
\end{definition}
This environment defines how the main body of the glossary should
-be typeset. Note that this does not include the section heading,
+be typeset.
+
+Note that this does not include the section heading,
the glossary preamble (defined by \ics{glossarypreamble}) or the
glossary postamble (defined by \ics{glossarypostamble}). For example,
the \glostyle{list} style uses the \env{description} environment,
@@ -12071,8 +13073,10 @@ redefines \cs{glsgroupheading} as follows:
\renewcommand*{\glsgroupheading}[1]{%
\item[\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}]}
\end{verbatim}
-See also \cs{glsgroupskip} below. (Note that command definitions within
-\ics{newglossarystyle} must use \verb|##1| instead of \verb|#1| etc.)
+See also \cs{glsgroupskip} below.
+
+Note that command definitions within
+\ics{newglossarystyle} must use \verb|##1| instead of \verb|#1| etc.
\begin{definition}[\DescribeMacro{\glsgroupskip}]
\cs{glsgroupskip}
@@ -12334,6 +13338,11 @@ that displays each entry in a \env{longtable} as follows:
This section describes some utility commands. Additional commands
can be found in the documented code (glossaries-code.pdf).
+\begin{xtr}
+The \gls{glossaries-extra} package provides extra utility commands.
+See the \qt{Utilities} section of the \gls{glossaries-extra} manual.
+\end{xtr}
+
\section{Loops}
\label{sec:loops}
@@ -12680,6 +13689,25 @@ instead of \cs{ifdefstrequal}.
\section{Fetching and Updating the Value of a Field}
\label{sec:fetchset}
+In addition to the commands described in \sectionref{sec:glsnolink},
+the following may also be used to fetch field information.
+\begin{definition}[\DescribeMacro\glsentrytype]
+\cs{glsentrytype}\marg{label}
+\end{definition}
+Expands to the entry's glossary type. No existence check is
+performed.
+
+\begin{definition}[\DescribeMacro\glsentryparent]
+\cs{glsentryparent}\marg{label}
+\end{definition}
+Expands to the label of the entry's parent. No existence check is
+performed.
+
+\begin{definition}[\DescribeMacro\glsentrysort]
+\cs{glsentrysort}\marg{label}
+\end{definition}
+Expands to the entry's sort value. No existence check is performed.
+
You can fetch the value of a given field and store it in a control
sequence using:
\begin{definition}[\DescribeMacro\glsfieldfetch]
@@ -12758,7 +13786,7 @@ the \gloskey{prefixplural} key.
\begin{example}{Defining Determiners}{ex:determiners}
Here's the start of my example document:
\begin{verbatim}
-documentclass{article}
+\documentclass{article}
\usepackage[colorlinks]{hyperref}
\usepackage[toc,acronym]{glossaries-prefix}
@@ -12775,8 +13803,11 @@ non-breakable space after \qt{a} in the \gloskey{prefix} field.}:
prefixplural={the\space}%
}
\end{verbatim}
-Note that I've had to explicitly insert a~space after the prefix.
-This allows for the possibility of prefixes that shouldn't have a~space,
+Note that I've had to explicitly insert a~space after the prefix
+since there's no designated separator between the prefix and the
+term being referenced. This not only means that you can vary between
+a breaking space and non-breaking space, but also
+allows for the possibility of prefixes that shouldn't have a~space,
such as:
\begin{verbatim}
\newglossaryentry{oeil}{name={oeil},
@@ -12790,6 +13821,16 @@ a~spacing command, such as \cs{space}, \verb*|\ | (backslash space) or
\verb|~| due to the automatic spacing trimming performed in
\meta{key}=\meta{value} options.
+In the event that you always require a space between the prefix and
+the term, then you can instead redefine
+\begin{definition}[\DescribeMacro\glsprefixsep]
+\cs{glsprefixsep}
+\end{definition}
+to do a space. (This command does nothing by default.) For example:
+\begin{verbatim}
+\renewcommand{\glsprefixsep}{\space}
+\end{verbatim}
+
The prefixes can also be used with acronyms. For example:
\begin{verbatim}
\newacronym
@@ -12895,7 +13936,7 @@ non-empty value for the \gloskey{prefixfirst} key.
\cs{ifglshasprefixfirstplural}\marg{label}\marg{true part}\marg{false part}
\end{definition}
Does \meta{true part} if the entry identified by \meta{label} has a
-non-empty value for the \gloskey{prefixfirstplural} key.
+non-empty value for the \csoptfmt{prefix\-first\-plural} key.
\begin{definition}[\DescribeMacro\glsentryprefix]
\cs{glsentryprefix}\marg{label}
@@ -12955,11 +13996,39 @@ before the name:
\setglossarystyle{list}%
\renewcommand*{\glossentry}[2]{%
\item[\glsentryitem{##1}%
- \Glsentryprefix{##1}%
+ \glsentryprefix{##1}%
+ \glstarget{##1}{\glossentryname{##1}}]
+ \glossentrydesc{##1}\glspostdescription\space ##2}%
+}
+\end{verbatim}
+If you want to change the prefix separator (\cs{glsprefixsep}) then
+the following is better:
+\begin{verbatim}
+\newglossarystyle{plist}{%
+ \setglossarystyle{list}%
+ \renewcommand*{\glossentry}[2]{%
+ \item[\glsentryitem{##1}%
+ \ifglshasprefix{##1}{\glsentryprefix{##1}\glsprefixsep}{}%
\glstarget{##1}{\glossentryname{##1}}]
\glossentrydesc{##1}\glspostdescription\space ##2}%
}
\end{verbatim}
+The conditional is also useful if you want the style to use an
+uppercase letter at the start of the entry item:
+\begin{verbatim}
+\newglossarystyle{plist}{%
+ \setglossarystyle{list}%
+ \renewcommand*{\glossentry}[2]{%
+ \item[\glsentryitem{##1}%
+ \glstarget{##1}%
+ {%
+ \ifglshasprefix{##1}%
+ {\Glsentryprefix{##1}\glsprefixsep\glossentryname{##1}}%
+ {\Glossentryname{##1}}%
+ }]
+ \glossentrydesc{##1}\glspostdescription\space ##2}%
+}
+\end{verbatim}
\end{example}
\chapter{Accessibility Support}\label{sec:accsupp}
@@ -12967,10 +14036,30 @@ before the name:
Limited accessibility support is provided by the accompanying
\sty{glossaries-accsupp} package, but note that this package is
experimental and it requires the \sty{accsupp} package
-which is also listed as experimental. This package defines
+which is also listed as experimental. This package automatically
+loads the \sty{glossaries} package. Any options are passed to
+\sty{glossaries} (if it hasn't already been loaded). For example:
+\begin{verbatim}
+\usepackage[acronym]{glossaries-accsupp}
+\end{verbatim}
+This will load \sty{glossaries} with the \pkgopt{acronym} package
+option as well as loading \sty{glossaries-accsupp}.
+
+If you are using the \gls{glossaries-extra} extension package, you
+need to load \gls{glossaries-extra} with the \pkgopt*{accsupp}
+package option. For example:
+\begin{verbatim}
+\usepackage[abbreviations,accsupp]{glossaries-extra}
+\end{verbatim}
+This will load \gls{glossaries-extra} (with the
+\pkgopt*{abbreviations} option), \sty{glossaries} and
+\sty{glossaries-accsupp} and make appropriate patches to integrate
+the accessibility support with the extension commands.
+
+The \sty{glossaries-accsupp} package defines
additional keys that may be used when defining glossary entries.
The keys are as follows:
-\begin{description}
+\begin{description}\raggedright
\item[{\gloskey{access}}] The replacement text corresponding to
the \gloskey{name} key.
@@ -13010,22 +14099,5085 @@ the \gloskey{longplural} key (used by \ics{newacronym}).
\item[{\gloskey{shortpluralaccess}}] The replacement text corresponding to
the \gloskey{shortplural} key (used by \ics{newacronym}).
+\item[{\gloskey{user1access}}] The replacement text corresponding to
+the \gloskey{user1} key.
+
+\item[{\gloskey{user2access}}] The replacement text corresponding to
+the \gloskey{user2} key.
+
+\item[{\gloskey{user3access}}] The replacement text corresponding to
+the \gloskey{user3} key.
+
+\item[{\gloskey{user4access}}] The replacement text corresponding to
+the \gloskey{user4} key.
+
+\item[{\gloskey{user5access}}] The replacement text corresponding to
+the \gloskey{user5} key.
+
+\item[{\gloskey{user6access}}] The replacement text corresponding to
+the \gloskey{user6} key.
\end{description}
For example:
\begin{verbatim}
\newglossaryentry{tex}{name={\TeX},description={Document
preparation language},access={TeX}}
\end{verbatim}
-Now \verb|\gls{tex}| will be equivalent to
+Now the \gls{linktext} produced by \verb|\gls{tex}| will be:
\begin{verbatim}
-\BeginAccSupp{ActualText=TeX}\TeX\EndAccSupp{}
+\BeginAccSupp{ActualText={TeX}}\TeX\EndAccSupp{}
\end{verbatim}
The sample file \samplefile{accsupp} illustrates the
\sty{glossaries-accsupp} package.
+If you prefer to use \sty{accessibility} or \sty{tagpdf} instead of
+\sty{accsupp} then you'll need to define \cs{gls@accsupp@engine} and
+\cs{gls@accessibility} before loading \sty{glossaries-accsupp}. See
+\ifpdf section~\ref*{sec:code:accsupp} \else the section
+\qt{Accessibility Support}\fi in the documented code for further
+details.
+
+The PDF specification identifies three different types of
+replacement text:
+\begin{description}
+\item[Alt] Description of some content that's non-textual (for
+example, an image). A word break is assumed after the content.
+\item[ActualText] A character or sequence of characters that
+replaces textual content (for example, a dropped capital, a
+ligature or a symbol). No word break is assumed after the content.
+\item[E] Expansion of an abbreviation to avoid ambiguity (for
+example, \qt{St} could be short for \qt{saint} or \qt{street}).
+\end{description}
+
+\begin{important}
+Many PDF viewers don't actually support any type of replacement text. Some may
+support \qt{ActualText} but not \qt{Alt} or \qt{E}.
+\href{https://pdfbox.apache.org/}{PDFBox}'s \qt{PDFDebugger} tool
+can be used to inspect the PDF content to make sure that the
+replacement text has been correctly set.
+\end{important}
+
+If you define abbreviations with \ics{newacronym}, the
+\gloskey{shortaccess} field will automatically be set to:
+\begin{definition}[\DescribeMacro\glsdefaultshortaccess]
+\cs{glsdefaultshortaccess}\marg{long}\marg{short}
+\end{definition}
+With the base \styfmt{glossaries} package this just expands to
+\meta{long}. With \gls{glossaries-extra} this expands to \meta{long}
+(\meta{short}). This command must be fully expandable. It expands
+when the abbreviation is defined.
+
+As from \sty{glossaries-accsupp} v4.45, the helper command used to
+identify the replacement text depends on the field name. Previous
+versions just used:
+\begin{definition}[\DescribeMacro\glsaccsupp]
+\cs{glsaccsupp}\marg{replacement}\marg{content}
+\end{definition}
+for all fields. This is defined to use \texttt{ActualText}, which is
+appropriate for symbols but not for abbreviations.
+
+As from v4.45, there's a new helper command:
+\begin{definition}[\DescribeMacro\glsfieldaccsupp]
+\cs{glsfieldaccsupp}\marg{replacement}\marg{content}\marg{field}\marg{label}
+\end{definition}
+This will use \csmeta{gls}{field}{accsupp} if it's defined otherwise
+it will just use \cs{glsaccsupp}. There are just two of these field
+commands for \gloskey{short} and \gloskey{shortplural}:
+\begin{definition}[\DescribeMacro\glsshortaccsupp]
+\cs{glsshortaccsupp}\marg{replacement}\marg{content}
+\end{definition}
+which is like \cs{glsaccsupp} but uses \texttt{E} instead of
+\texttt{ActualText} and
+\begin{definition}[\DescribeMacro\glsshortplaccsupp]
+\cs{glsshortplaccsupp}\marg{replacement}\marg{content}
+\end{definition}
+which just does \cs{glsshortaccsupp}\marg{replacement}\marg{content}.
+Note that \meta{field} indicates the \emph{internal} field name
+(such as \texttt{shortpl}) not the key name (such as
+\texttt{shortplural}). See \tableref{tab:fieldmap}.
+
+Rather than explicitly using \ics{BeginAccSupp}, these helper
+commands can use:
+\begin{definition}[\DescribeMacro\glsaccessibility]
+\cs{glsaccessibility}\oarg{options}\marg{tag}\marg{value}\marg{content}
+\end{definition}
+where \meta{tag} is one of \texttt{E}, \texttt{Alt} or
+\texttt{ActualText}. The replacement text for \meta{content} should be provided in
+\meta{value}.
+This does:
+\begin{alltt}
+\ics{BeginAccSupp}\mgroup{\meta{tag}=\marg{value},\meta{options}}\meta{content}\ics{EndAccSupp}\mgroup{}
+\end{alltt}
+but it also provides debugging information if \pkgopt[showaccsupp]{debug} is used.
+If you explicitly use \cs{BeginAccSupp} instead of this command then
+the debugging support won't be available.
+
+You can define your own custom helper commands for specific fields
+that require them. For example:
+\begin{verbatim}
+\newcommand{\glssymbolaccsupp}[2]{%
+ \glsaccessibility[method=hex,unicode]{ActualText}{#1}{#2}%
+}
+\end{verbatim}
+This definition requires the replacement text to be specified with
+the hexadecimal character code. For example:
+\begin{verbatim}
+\newglossaryentry{int}{name={int},description={integral},
+ symbol={\ensuremath{\int}},symbolaccess={222B}
+}
+\end{verbatim}
+
+If you are using \gls{glossaries-extra}, then \cs{glsfieldaccsupp}
+will first test for the existence of
+\csmetameta*{glsxtr}{category}{}{field}{accsupp}
+and \csmeta*{glsxtr}{category}{accsupp} and then for
+\csmeta{gls}{field}{accsupp}. For example:
+\begin{verbatim}
+\usepackage{siunitx}
+\usepackage[accsupp]{glossaries-extra}
+
+\glsnoexpandfields
+
+\newcommand{\glsxtrsymbolaccsupp}[2]{%
+ \glsaccessibility[method=hex,unicode]{ActualText}{#1}{#2}%
+}
+
+\newcommand{\glsxtrunitaccsupp}[2]{\glsaccessibility{E}{#1}{#2}}
+
+\newglossaryentry{cm}{name={\si{\centi\metre}},
+ access={centimetre},
+ description={centimetre},
+ category=unit
+}
+
+\newglossaryentry{int}{name={\ensuremath{\int}},access={222B},
+ description={integral},category={symbol}
+}
+\end{verbatim}
+The above uses the \csmeta*{glsxtr}{category}{accsupp} form that
+doesn't include the field name. Remember that if you want to supply
+a command specifically for the \gloskey{name} field then it won't be
+picked up by the \gloskey{text}, \gloskey{plural}, \gloskey{firstplural} and
+\gloskey{first} fields. You'd need to supply them all. For example:
+\begin{verbatim}
+\newcommand{\glsnameaccsupp}[2]{%
+ \glsaccessibility[method=hex,unicode]{ActualText}{#1}{#2}%
+}
+\newcommand{\glstextaccsupp}{\glsnameaccsupp}
+\newcommand{\glspluralaccsupp}{\glsnameaccsupp}
+\newcommand{\glsfirstaccsupp}{\glsnameaccsupp}
+\newcommand{\glsfirstplaccsupp}{\glsnameaccsupp}
+\end{verbatim}
+
See \ifpdf section~\ref*{sec:code:accsupp} in \fi the documented code
(\texttt{glossaries-code.pdf}) for further details. I~recommend
-that you also read the \sty{accsupp} documentation.
+that you also read the \sty{accsupp} documentation. See also the
+\sty{accessibility} and \sty{tagpdf} packages.
+
+\chapter{Sample Documents}
+\label{sec:samples}
+
+The \styfmt{glossaries} package is provided with some sample
+documents that illustrate the various functions. These should
+be located in the \texttt{samples} subdirectory (folder) of the
+\styfmt{glossaries} documentation directory. This location varies
+according to your operating system and \TeX\ distribution. You
+can use \texttt{texdoc} to locate the main glossaries documentation.
+For example, in a
+\href{http://www.dickimaw-books.com/latex/novices/html/terminal.html}{terminal or command prompt}, type:
+\begin{prompt}
+texdoc -l glossaries
+\end{prompt}
+This should display a list of all the files in the \styfmt{glossaries}
+documentation directory with their full pathnames. (The GUI version
+of \texttt{texdoc} may also provide you with the information.)
+
+If you can't find the sample files on your computer, they are also available
+from your nearest CTAN mirror at
+\url{http://mirror.ctan.org/macros/latex/contrib/glossaries/samples/}.
+Each sample file listed below has a hyperlink to the file's location on
+the CTAN mirror.
+
+The \gls{glossaries-extra} package and \gls{bib2gls}
+provide some additional sample files. There are also examples in the
+\gallery{}{Dickimaw Books Gallery}.
+
+If you prefer to use UTF-8 aware engines (\texttt{xelatex} or
+\texttt{lualatex}) remember that you'll need to switch from
+\styfmt{fontenc} \& \styfmt{inputenc} to \styfmt{fontspec} where
+appropriate.
+
+\commandpromptnote
+If you get any errors or unexpected results, check that you have up-to-date versions of
+all the required packages. (Search the log file for lines starting
+with \qt{\texttt{Package:\ }}.) Where \sty{hyperref} is loaded you will
+get warnings about non-existent references that look something like:
+\begin{verbatim}
+pdfTeX warning (dest): name{glo:aca} has been
+referenced but does not exist, replaced by a fixed one
+\end{verbatim}
+These warnings may be ignored on the first \LaTeX\ run. (The
+destinations won't be defined until the glossary has been created.)
+
+\section{Basic}
+\label{sec:samplesbasic}
+
+\exitem[minimal]{gls} This document is a
+minimal working example. You can test your installation using this
+file. To create the complete document you will need to do the
+following steps:
+ \begin{enumerate}
+ \item Run \texttt{minimalgls.tex} through \LaTeX\ either by
+ typing
+\begin{prompt}
+pdflatex minimalgls
+\end{prompt}
+ in a terminal or by using the relevant button or menu item in
+ your text editor or front-end. This will create the required
+ associated files but you will not see the glossary in the document.
+
+ \item If you have Perl installed, run \gls{makeglossaries} on the document (\sectionref{sec:makeglossaries}). This can
+ be done on a terminal by typing:
+\begin{prompt}
+makeglossaries minimalgls
+\end{prompt}
+ otherwise do:
+\begin{prompt}
+makeglossaries-lite minimalgls
+\end{prompt}
+ If for some reason you want to call \gls{makeindex} explicitly, you can do this
+ in a terminal by typing (all on one line):
+\begin{prompt}
+makeindex -s minimalgls.ist -t minimalgls.glg -o minimalgls.gls minimalgls.glo
+\end{prompt}
+ See \sectionref{sec:makeindexapp} for further details on using
+ \gls*{makeindex} explicitly.
+
+ Note that if the file name contains spaces, you will need to use
+ the double-quote character to delimit the name.
+
+ \item Run \texttt{minimalgls.tex} through \LaTeX\ again (as step~1)
+ \end{enumerate}
+You should now have a complete document. The number following
+each entry in the glossary is the location number. By default, this
+is the page number where the entry was referenced.
+
+The \pkgopt{acronym} package option creates a second glossary with
+the label \texttt{acronym} (which can be referenced with
+\cs{acronymtype}). If you decide to enable this option then there
+will be a second set of glossary files that need to be processed by
+\gls{makeindex}. If you use \gls{makeglossaries} or
+\gls{makeglossaries-lite.lua} you don't need to worry about it, as
+those scripts automatically detect which files need to be processed
+and will run \gls{makeindex} (or \gls{xindy}) the appropriate number
+of times.
+
+If for some reason you don't want to use \gls{makeglossaries} or
+\gls{makeglossaries-lite.lua} and you want the \pkgopt{acronym}
+package option then the complete build process is:
+\begin{prompt}
+pdflatex minimalgls
+makeindex -s minimalgls.ist -t minimalgls.glg -o minimalgls.gls minimalgls.glo
+makeindex -s minimalgls.ist -t minimalgls.alg -o minimalgls.acr minimalgls.acn
+pdflatex minimalgls
+\end{prompt}
+
+There are three other files that can be used as
+\href{http://www.dickimaw-books.com/latex/minexample/}{minimal working
+examples}: \mirrorsamplefile{mwe-gls.tex}, \mirrorsamplefile{mwe-acr.tex} and
+\mirrorsamplefile{mwe-acr-desc.tex}.
+
+\glsxtrnote
+If you want to try out the \gls{glossaries-extra} extension package,
+you need to replace the package loading line:
+\begin{alltt}
+\cs{usepackage}[acronym]\mgroup{\strong{glossaries}}
+\end{alltt}
+with:
+\begin{alltt}
+\cs{usepackage}[acronym\strong{,\xtrfont{postdot},\xtrfont{stylemods}}]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+Note the different default package options. (You may omit the
+\pkgopt{acronym} package option in both cases if you only want a
+single glossary.) The \gls{glossaries-extra} package internally
+loads the base \styfmt{glossaries} package so you don't need to
+explicitly load both (in fact, it's better to let
+\gls{glossaries-extra} load \styfmt{glossaries}).
+
+Next, replace:
+\begin{alltt}
+\cs{setacronymstyle}\mgroup{long-short}
+\end{alltt}
+with:
+\begin{alltt}
+\ics*{setabbreviationstyle}[\strong{acronym}]\mgroup{long-short}
+\end{alltt}
+The optional argument \cat{acronym} identifies the category that
+this style should be applied to. The \cs{newacronym} command
+provided by the base \styfmt{glossaries} package is redefined by
+\gls{glossaries-extra} to use \ics*{newabbreviation} with the category
+set to \cat{acronym}.
+
+If you prefer to replace \cs{newacronym} with \ics*{newabbreviation}
+then the default category is \cat{abbreviation} so the style should
+instead be:
+\begin{alltt}
+\ics*{setabbreviationstyle}[\strong{abbreviation}]\mgroup{long-short}
+\end{alltt}
+This is actually the default category if the optional argument is
+omitted, so you can simply do:
+\begin{alltt}
+\ics*{setabbreviationstyle}\mgroup{long-short}
+\end{alltt}
+The \abbrstyle{long-short} style is the default for the
+\cat{abbreviation} category so you can omit this line completely if
+you replace \cs{newacronym}. (The default style for the
+\cat{acronym} category is \abbrstyle{short-nolong}, which only shows
+the short form on \gls{firstuse}.)
+
+As mentioned earlier, the \pkgopt{acronym} package option creates a
+new glossary with the label \texttt{acronym}. This is independent of
+the \cat{acronym} category. You can use the \pkgopt{acronym}
+package option with either \cs{newacronym} or \ics*{newabbreviation}.
+
+You may instead prefer to use the \pkgopt*{abbreviations} package
+option, which creates a new glossary with the label \texttt{abbreviations}:
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{abbreviations}},\xtrfont{postdot},\xtrfont{stylemods}]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+This can again be used with either \cs{newacronym} or
+\ics*{newabbreviation}, but the file extensions are different. This
+isn't a problem if you are using \gls{makeglossaries} or
+\gls{makeglossaries-lite.lua}. If you are explicitly calling
+\gls{makeindex} (or \gls{xindy}) then you need to modify the file
+extensions.
+See the \gls{glossaries-extra} user manual for further details.
+
+If you use both the \pkgopt{acronym} and \pkgopt*{abbreviations}
+package options then \cs{newacronym} will default to the
+\texttt{acronym} glossary and \ics*{newabbreviation} will default to
+the \texttt{abbreviations} glossary.
+
+\bibglsnote
+If you want to try \gls{bib2gls}, you first need to convert the
+document to use \gls{glossaries-extra} as described above. Then add
+the \pkgopt*{record} package option. For example:
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{record}},\xtrfont{postdot},\xtrfont{stylemods}]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+Next you need to convert the entry definitions into the
+\filetype{bib} format required by \gls{bib2gls}. This can easily be
+done with \gls{convertgls2bib}. For example:
+\begin{prompt}
+convertgls2bib -{}-preamble-only minimalgls.tex entries.bib
+\end{prompt}
+This will create a file called \strong{\nolinkurl{entries.bib}}. Next, replace:
+\begin{alltt}
+\cs{makeglossaries}
+\end{alltt}
+with:
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=\strong{entries}]
+\end{alltt}
+Now remove all the entry definitions in the preamble
+(\cs{longnewglossaryentry}, \cs{newglossaryentry} and \cs{newacronym}
+or \cs{newabbreviation}).
+
+The abbreviation style command
+must go before \ics*{GlsXtrLoadResources}. For example (if you are
+using \cs{newacronym}):
+\begin{alltt}
+\ics*{setabbreviationstyle}[acronym]\mgroup{long-short}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries]
+\end{alltt}
+Finally, replace:
+\begin{verbatim}
+\printglossaries
+\end{verbatim}
+with:
+\begin{alltt}
+\ics*{printunsrtglossaries}
+\end{alltt}
+The document build is now:
+\begin{prompt}
+pdflatex minimalgls
+bib2gls minimalgls
+pdflatex minimalgls
+\end{prompt}
+
+\exitem{DB} This document illustrates how
+to load external files containing the glossary definitions. It also
+illustrates how to define a new glossary type. This document has the
+\gls{numberlist} suppressed and uses \hyperref[sec:glsadd]{\ics{glsaddall}} to add all
+the entries to the glossaries without referencing each one
+explicitly. (Note that it's more efficient to use
+\gls{glossaries-extra} and \gls{bib2gls} if you have a large number
+of entries.) To create the document do:
+\begin{prompt}
+pdflatex sampleDB
+makeglossaries sampleDB
+pdflatex sampleDB
+\end{prompt}
+or
+\begin{prompt}
+pdflatex sampleDB
+makeglossaries-lite sampleDB
+pdflatex sampleDB
+\end{prompt}
+The glossary definitions are stored in the accompanying files
+\mirrorsamplefile{database1.tex} and \mirrorsamplefile{database2.tex}. If for some
+reason you want to call \gls{makeindex} explicitly you must
+have a separate call for each glossary:
+\begin{enumerate}
+\item Create the main glossary (all on one line):
+\begin{prompt}
+makeindex -s sampleDB.ist -t sampleDB.glg -o sampleDB.gls sampleDB.glo
+\end{prompt}
+\item Create the secondary glossary (all on one line):
+\begin{prompt}
+makeindex -s sampleDB.ist -t sampleDB.nlg -o sampleDB.not sampleDB.ntn
+\end{prompt}
+Note that both \gls{makeglossaries} and \gls{makeglossaries-lite.lua} do
+this all in one call, so they not only make it easier because you
+don't need to supply all the switches and remember all the
+extensions but they also call \gls{makeindex} the appropriate number of times.
+\end{enumerate}
+
+\bibglsnote
+If you want to switch to using \gls{bib2gls} with \gls{glossaries-extra}, you can convert
+\mirrorsamplefile{database1.tex} and \mirrorsamplefile{database2.tex} to \filetype{bib}
+files using \gls{convertgls2bib}:
+\begin{prompt}
+convertgls2bib database1.tex database1.bib
+convertgls2bib database2.tex database2.bib
+\end{prompt}
+The document code then needs to be:
+\begin{alltt}
+\cs{documentclass}\mgroup{article}
+
+\cs{usepackage}[colorlinks,plainpages=false]\mgroup{hyperref}
+\cs{usepackage}[\strong{\xtrfont{record}},\xtrfont{postdot}]\mgroup{\strong{glossaries-extra}}
+
+\strong{\ics{newglossary*}}\mgroup{punc}\mgroup{Punctuation Characters}
+
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=\mgroup{database1},
+ \strong{\xtrfont{selection}=all},\resourceopt{sort}=en]
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=\mgroup{database2},\strong{\xtrfont{type}=punc,}
+ \strong{\xtrfont{selection}=all},\resourceopt{sort}=letter-case]
+
+\cs{begin}\mgroup{document}
+\xtrfont{\cs{print\strong{unsrt}glossaries}}
+\cs{end}\mgroup{document}
+\end{alltt}
+Note that the \pkgopt{nonumberlist} package option has been omitted.
+It's not needed because there are no locations in this amended
+document (whereas in the original \samplefile{DB} locations are
+created with \cs{glsaddall}). The starred \ics{newglossary*} is used
+since the \gls{makeindex}/\gls{xindy} extensions are now irrelevant.
+
+Instead of using \gls{makeglossaries} you need to use \gls{bib2gls}
+when you build the document:
+\begin{prompt}
+pdflatex sampleDB
+bib2gls sampleDB
+pdflatex sampleDB
+\end{prompt}
+Note that one \gls{bib2gls} call processes all the indexing (rather
+than one call per glossary). Unlike \gls{makeindex} and \gls{xindy},
+\gls{bib2gls} processes each resource set in turn, but the resource
+sets aren't linked to a specific glossary. Multiple glossaries may
+be processed in a single resource set or sub-blocks of a single
+glossary may be processed by multiple resource sets. In this
+example, there happens to be one resource set per glossary because
+each glossary requires a different sort method. (A locale-sensitive
+alphabetical sort for the first and a character code sort for the
+second.)
+
+If you want letter groups, you need to use the \bibglslongopt{group}
+switch:
+\begin{prompt}
+bib2gls -{}-group sampleDB
+\end{prompt}
+and use an appropriate glossary style.
+
+See also \bibglsgallery{sorting}, \bibglsbegin\ and the \gls{bib2gls} user manual.
+
+\section{Acronyms and First Use}
+\label{sec:sampleacronyms}
+
+\exitem{Acr} This document has some
+sample abbreviations. It also adds the glossary to the table of contents,
+so an extra run through \LaTeX\ is required to ensure the document
+is up to date:
+\begin{prompt}
+pdflatex sampleAcr
+makeglossaries sampleAcr
+pdflatex sampleAcr
+pdflatex sampleAcr
+\end{prompt}
+(or use \gls{makeglossaries-lite.lua}).
+
+Note that if the glossary is at the start of the document
+and spans across multiple pages, then this can cause the locations
+to be shifted. In that case, an extra \gls{makeglossaries} and
+\LaTeX\ call are required. In this particular example, the glossary
+is at the end of the document so it's not a problem. It's also not a
+problem for a glossary at the start of the document if the page
+numbering is reset at the end of the glossary. For example, if the
+glossary is at the end of the front matter in a book-style document.
+
+This document uses \ics{ifglsused} to determine whether to use
+\qt{a} or \qt{an} in:
+\begin{alltt}
+\ldots\ is \ics{ifglsused}\mgroup{svm}\mgroup{an}\mgroup{a} \cs{gls}\mgroup{svm} \ldots
+\end{alltt}
+This clumsy bit of code can be tidied up with the
+\sty{glossaries-prefix} package. Since that package automatically
+loads \styfmt{glossaries} and passes all its options to the base
+package it's possible to do a simple replacement of:
+\begin{verbatim}
+\usepackage[style=long,toc]{glossaries}
+\end{verbatim}
+with:
+\begin{alltt}
+\cs{usepackage}[style=long,toc]\mgroup{\strong{glossaries-prefix}}
+\end{alltt}
+The definition of \texttt{svm} now needs an adjustment:
+\begin{alltt}
+\ics{newacronym}[description=\mgroup{statistical pattern recognition
+technique\string~\cs{protect}\cs{cite}\mgroup{svm}},
+\strong{prefixfirst=\mgroup{a\string~},prefix=\mgroup{an\ics{space}}}
+]\mgroup{svm}\mgroup{svm}\mgroup{support vector machine}
+\end{alltt}
+The clumsy text can now simply be changed to:
+\begin{alltt}
+\ldots\ is \ics{pgls}\mgroup{svm} \ldots
+\end{alltt}
+
+\glsxtrnote
+If you want to convert this sample document to use \gls{glossaries-extra},
+you may want the patched version of the styles provided in \sty{glossary-long},
+in which case you can also add \pkgopt*{stylemods}:
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{stylemods},}style=long]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+If you want to suppress all the other glossary style packages with
+\pkgopt{nostyles}, then you need to specify exactly which package
+(or packages) that you do want:
+\begin{alltt}
+\cs{usepackage}[\strong{nostyles,}\xtrfont{stylemods\strong{=long}},style=long]\mgroup{glossaries-extra}
+\end{alltt}
+(Now that \gls{glossaries-extra} is being used, there are more
+available \qt{long} styles in the \sty*{glossary-longextra} package,
+which you may prefer.)
+
+If you want to use \sty{glossaries-prefix}, you can either load it
+after \gls{glossaries-extra} or (with at least
+\gls{glossaries-extra} v1.42) you can simply use the
+\pkgopt*{prefix} package option.
+
+Note that the \pkgopt{toc} package option has been dropped. This is
+the default with \gls{glossaries-extra}, so it doesn't need to be
+specified now. The document build is now shorter:
+\begin{prompt}
+pdflatex sampleAcr
+makeglossaries sampleAcr
+pdflatex sampleAcr
+\end{prompt}
+The third \LaTeX\ call is no longer required to make the table of
+contents up-to-date. This is because \gls{glossaries-extra} provides
+boilerplate text on the first \LaTeX\ call when the glossary files
+are missing. This means that the glossary header is added to the
+\filetype{toc} file on the first \LaTeX\ call, whereas with just the
+base \styfmt{glossaries} package, the header isn't present until the
+second \LaTeX\ call. (As with just the base \styfmt{glossaries}
+package, if the glossary occurs at the start of the document without
+a page reset after it then part of the build process needs repeating
+to ensure all referenced page numbers are up-to-date. This problem isn't
+specific to the \sty{glossaries} package.)
+
+The other different default setting is the post-description
+punctuation. The base package has \pkgopt[false]{nopostdot} as the
+default. This means that a full stop (period) is automatically
+inserted after the description in the glossary. The extension
+package has \pkgopt[true]{nopostdot} as the default. If you want the
+original behaviour then you can use \pkgopt[false]{nopostdot} or the
+shorter synonym \pkgopt*{postdot}.
+
+The \gls{glossaries-extra} package has different
+abbreviation handling that's far more flexible than that provided by
+the base \styfmt{glossaries} package. The style now needs to be set with
+\ics*{setabbreviationstyle} instead of \ics{setacronymstyle}:
+\begin{alltt}
+\strong{\ics*{setabbreviationstyle}[acronym]\mgroup{long-short-sc}}
+\ics{newacronym}\mgroup{svm}\mgroup{svm}\mgroup{support vector machine}
+\end{alltt}
+(Note the different style name \abbrstyle{long-short-sc} instead of
+\acrstyle{long-sc-short} and the optional argument \cat{acronym}.) If you
+prefer to replace \ics{newacronym} with \ics*{newabbreviation} then
+omit the optional argument:
+\begin{alltt}
+\ics*{setabbreviationstyle}\mgroup{long-short-sc}
+\ics*{newabbreviation}\mgroup{svm}\mgroup{svm}\mgroup{support vector machine}
+\end{alltt}
+(The optional argument of \ics*{setabbreviationstyle} is the
+category to which the style should be applied. If it's omitted,
+\cat{abbreviation} is assumed. You can therefore have different
+styles for different categories.)
+
+Finally, you need to replace \ics{acrshort}, \ics{acrlong} and
+\ics{acrfull} and their variants with \ics*{glsxtrshort}, \ics*{glsxtrlong} and
+\ics*{glsxtrfull} etc.
+
+\exitem{AcrDesc} This is similar to
+the previous example, except that the abbreviations have an associated
+description. As with the previous example, the glossary is added to
+the table of contents, so an extra run through \LaTeX\ is required:
+\begin{prompt}
+pdflatex sampleAcrDesc
+makeglossaries sampleAcrDesc
+pdflatex sampleAcrDesc
+pdflatex sampleAcrDesc
+\end{prompt}
+This document uses the \pkgopt{acronym} package option, which
+creates a new glossary used by \cs{newacronym}. This leaves the
+default \texttt{main} glossary available for general terms. However,
+in this case there are no general terms so the \texttt{main}
+glossary is redundant. The \pkgopt{nomain} package option will
+prevent its creation. Obviously, if you decide to add some terms
+with \cs{newglossaryentry} you will need to remove the
+\pkgopt{nomain} option as the \texttt{main} glossary will now be
+required.
+
+\glsxtrnote
+As with the previous example, if you want to convert this document
+to use \gls{glossaries-extra} you need to make a few modifications.
+The most obvious one is to replace \texttt{glossaries} with
+\texttt{glossaries-extra} in the \cs{usepackage} argument. Again you
+can omit \pkgopt{toc} as this is the default for
+\gls{glossaries-extra}. As in the previous example, you may want to
+use the patched styles. This document uses \glostyle{altlist} which
+is provided by \sty{glossary-list}, so the style can be patched with
+\pkgopt*{stylemods}.
+\begin{alltt}
+\cs{usepackage}[acronym,nomain,style=altlist\strong{,\xtrfont{stylemods}}]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+You may prefer to replace the \pkgopt{acronym} option with
+\pkgopt*{abbreviations}, but this will change the file extensions.
+If you use \gls{makeglossaries} or \gls{makeglossaries-lite.lua} you
+don't need to worry about it.
+
+Again the style command needs to be changed:
+\begin{alltt}
+\ics*{setabbreviationstyle}[acronym]\mgroup{long-short-sc-desc}
+\end{alltt}
+(Note the change in style name \abbrstyle{long-short-sc-desc}
+instead of \acrstyle{long-sc-short-desc} and the optional argument \cat{acronym}.)
+
+As with the previous example, if
+you prefer to use \ics*{newabbreviation} instead of \ics{newacronym}
+then you need to omit the optional argument:
+\begin{alltt}
+\ics*{setabbreviationstyle}\mgroup{long-short-sc-desc}
+\end{alltt}
+The original document uses:
+\begin{alltt}
+\cs{renewcommand}*\mgroup{\ics{glsseeitemformat}}[1]\mgroup{\%
+ \ics{acronymfont}\mgroup{\ics{glsentrytext}\mgroup{\#1}}}
+\end{alltt}
+to ensure that the cross-references (from the \gloskey{see} key) use
+the acronym font. The new abbreviation styles don't
+use \ics{acronymfont} so this isn't appropriate with
+\gls{glossaries-extra}. If you're using at least version 1.42 of
+\gls{glossaries-extra}, you don't need to do anything as it
+automatically redefines \ics{glsseeitemformat} to take the style
+formatting into account. If you have an earlier version you can
+redefine this command as follows:
+\begin{alltt}
+\cs{renewcommand}*\mgroup{\ics{glsseeitemformat}}[1]\mgroup{\%
+ \ics{ifglshasshort}\mgroup{\#1}\mgroup{\ics*{glsfmttext}\mgroup{\#1}}\mgroup{\ics*{glsfmtname}\mgroup{\#1}}\%
+}
+\end{alltt}
+This will just show the short form in the cross-reference. If you
+prefer the name instead (which includes the short and long form) you can use:
+\begin{alltt}
+\cs{renewcommand}*\mgroup{\ics{glsseeitemformat}}[1]\mgroup{\ics*{glsfmtname}\mgroup{\#1}}
+\end{alltt}
+
+The \gls{glossaries-extra} package provides two additional
+cross-referencing keys \xtrgloskey{seealso} and \xtrgloskey{alias},
+so \texttt{\gloskey{see}=\mgroup{[see also]\mgroup{svm}}}
+can be replaced with a more appropriate key:
+\begin{alltt}
+\ics{newacronym}[description=\mgroup{Statistical pattern recognition
+technique using the ``kernel trick''},
+\strong{\xtrgloskey{seealso}=\mgroup{svm}},
+]\mgroup{ksvm}\mgroup{ksvm}\mgroup{kernel support vector machine}
+\end{alltt}
+
+Finally, as with the previous example, you need to replace
+\ics{acrshort}, \ics{acrlong} and \ics{acrfull} etc with
+\ics*{glsxtrshort}, \ics*{glsxtrlong} and \ics*{glsxtrfull} etc.
+
+\bibglsnote
+If you want to convert this document so that it uses \gls{bib2gls},
+you first need to convert it to use \gls{glossaries-extra}, as above,
+but remember that you now need the \pkgopt*{record} option:
+\begin{alltt}
+\cs{usepackage}[acronym,nomain,style=altlist,\strong{\xtrfont{record},\xtrfont{postdot},\xtrfont{stylemods}}]
+\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+Now you need to convert the abbreviation definitions to the \filetype{bib}
+format required by \gls{bib2gls}. This can be done with:
+\begin{prompt}
+convertgls2bib -{}-preamble-only sampleAcrDesc.tex entries.bib
+\end{prompt}
+If you retained \ics{newacronym} from the original example file,
+then the new \nolinkurl{entries.bib} file will contain entries
+defined with \atentry{acronym}. For example:
+\begin{alltt}
+\atentry{acronym}\mgroup{ksvm,
+ description = \mgroup{Statistical pattern recognition technique
+ using the ``kernel trick''},
+ \xtrfont{seealso} = \mgroup{svm},
+ short = \mgroup{ksvm},
+ long = \mgroup{kernel support vector machine}
+}
+\end{alltt}
+If you switched to \ics*{newabbreviation} then the entries will
+instead be defined with \atentry{abbreviation}.
+
+Next replace \cs{makeglossaries} with the resource command, but note
+that the abbreviation style must be set first:
+\begin{alltt}
+\strong{\ics*{setabbreviationstyle}[acronym]\mgroup{long-short-sc-desc}}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,\% terms defined in entries.bib
+ \strong{\xtrfont{abbreviation-sort-fallback}=long}]
+\end{alltt}
+Another possibility is to make \atentry{acronym} behave as though it
+was actually \atentry{abbreviation}:
+\begin{alltt}
+\strong{\ics*{setabbreviationstyle}\mgroup{long-short-sc-desc}}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,\resourceopt{abbreviation-sort-fallback}=long\strong{,
+ entry-type-aliases=\mgroup{acronym=abbreviation}}]
+\end{alltt}
+Note that the category is now \cat{abbreviation} not \cat{acronym} so the optional
+argument of \ics*{setabbreviationstyle} needs adjusting.
+
+If the \gloskey{sort} field is missing (which should usually be the
+case), then both \atentry{acronym} and \atentry{abbreviation} will
+fallback on the \gloskey{short} field (not the \gloskey{name} field,
+which is usually set by the style and therefore not visible to
+\gls{bib2gls}). For some styles, as in this example, it's more
+appropriate to sort by the long form so the fallback is changed.
+(Remember that you will break this fallback mechanism if you
+explicitly set the sort value.) See the \gls{bib2gls} manual for
+further details and other examples.
+
+Remember to delete any \cs{newacronym} or \cs{newabbreviation} in
+the \filetype{tex} file.
+Finally replace \cs{printglossary} with \ics*{printunsrtglossary}.
+The document build is now:
+\begin{prompt}
+pdflatex sampleAcrDesc
+bib2gls sampleAcrDesc
+pdflatex sampleAcrDesc
+\end{prompt}
+
+Note that it's now much easier to revert back to the descriptionless
+style used in \samplefile{Acr}:
+\begin{alltt}
+\ics*{setabbreviationstyle}[acronym]\mgroup{\strong{long-short-sc}}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries\strong{,\resourceopt{ignore-fields}=description}]
+\end{alltt}
+With the other options it would be necessary to delete all the
+\gloskey{description} fields from the abbreviation definitions in
+order to omit them, but with \gls{bib2gls} you can simply instruct
+\gls{bib2gls} to ignore the description. This makes it much easier
+to have a large database of abbreviations for use across multiple
+documents that may or may not require the description.
+
+\exitem{Desc} This is similar to the
+previous example, except that it defines the abbreviations using
+\ics{newglossaryentry} instead of \ics{newacronym}. As with the
+previous example, the glossary is added to the table of contents, so
+an extra run through \LaTeX\ is required:
+\begin{prompt}
+pdflatex sampleDesc
+makeglossaries sampleDesc
+pdflatex sampleDesc
+pdflatex sampleDesc
+\end{prompt}
+This sample file demonstrates the use of the \gloskey{first} and
+\gloskey{text} keys but in general it's better to use
+\ics{newacronym} instead as it's more flexible. For even greater
+flexibility use \ics*{newabbreviation} provided by \gls{glossaries-extra}.
+For other variations, such as showing the symbol on \gls{firstuse},
+you may prefer to make use of the post-link category hook. For
+examples, see the section \qt{Changing the Formatting} in \bibglsbegin.
+
+\exitem{FnAcrDesc} This document has some sample abbreviations that
+use the \acrstyle{footnote-sc-desc} acronym style. As with the previous example,
+the glossary is added to the table of contents, so an extra run through
+\LaTeX\ is required:
+\begin{prompt}
+pdflatex sampleFnAcrDesc
+makeglossaries sampleFnAcrDesc
+pdflatex sampleFnAcrDesc
+pdflatex sampleFnAcrDesc
+\end{prompt}
+\glsxtrnote
+If you want to convert this sample document to use
+\gls{glossaries-extra}, then you just need to follow the same steps
+as for \samplefile{Acr} with a slight modification. This time the
+\abbrstyle{short-sc-footnote-desc} abbreviation style is needed:
+\begin{alltt}
+\ics*{setabbreviationstyle}[acronym]\mgroup{short-sc-footnote-desc}
+\end{alltt}
+The command redefinitions (performed with \cs{renewcommand}) should
+now all be deleted as they are no longer applicable.
+
+You may prefer to use the \abbrstyle{short-sc-postfootnote-desc}
+style instead. There are subtle differences between the \abbrstyle{postfootnote} and
+\abbrstyle{footnote} set of styles. Try changing the abbreviation style to
+\abbrstyle{short-sc-footnote} and compare the location of the footnote marker
+with the two styles.
+
+This modified sample file now has a shorter build:
+\begin{prompt}
+pdflatex sampleFnAcrDesc
+makeglossaries sampleFnAcrDesc
+pdflatex sampleFnAcrDesc
+\end{prompt}
+This is because the \gls{glossaries-extra} package produces
+boilerplate text when the glossary file is missing (on the first
+\LaTeX\ run) which adds the glossary title to the table of contents
+(\filetype{toc}) file.
+
+\exitem{CustomAcr} This document has some sample abbreviations with a
+custom acronym style. It also adds the glossary to the table of
+contents, so an extra run through \LaTeX\ is required:
+\begin{prompt}
+pdflatex sampleCustomAcr
+makeglossaries sampleCustomAcr
+pdflatex sampleCustomAcr
+pdflatex sampleCustomAcr
+\end{prompt}
+This is a slight variation on the previous example where the name is
+in the form \meta{long} (\meta{short}) instead of \meta{short}
+(\meta{long}), and the \gloskey{sort} key is set to the long form
+instead of the short form. On \gls{firstuse}, the footnote text is
+in the form \meta{long}: \meta{description} (instead of just the
+long form). This requires defining a new acronym
+style that inherits from the \acrstyle{footnote-sc-desc} style.
+
+\glsxtrnote
+The conversion to \gls{glossaries-extra} starts in much the same way
+as the previous examples:
+\begin{alltt}
+\cs{usepackage}[acronym,nomain,\strong{\xtrfont{postdot},\xtrfont{stylemods},}style=altlist]
+\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+The abbreviation styles have associated helper commands that may be
+redefined to make minor modifications. These redefinitions should be
+done before the abbreviations are defined.
+
+The \abbrstyle{short-sc-footnote-desc} abbreviation style is the closest match
+to the requirement, so replace the \cs{setacronymstyle} command
+with:
+\begin{alltt}
+\ics*{setabbreviationstyle}[acronym]\mgroup{short-sc-footnote-desc}
+\end{alltt}
+Again, you may prefer \abbrstyle{short-sc-postfootnote-desc}. Both
+styles use the same helper commands.
+
+Next some adjustments need to be made to fit the new requirements.
+The name needs to be \meta{long} (\meta{short}):
+\begin{alltt}
+\cs{renewcommand}*\mgroup{\ics*{glsxtrfootnotedescname}}\mgroup{\%
+ \cs{protect}\strong{\ics*{glslongfont}\mgroup{\cs{the}\ics{glslongtok}}}\%
+ \cs{protect}\ics*{glsxtrfullsep}\mgroup{\cs{the}\ics{glslabeltok}}\%
+ \cs{protect}\ics*{glsxtrparen}\mgroup{\cs{protect}\strong{\ics*{glsabbrvfont}\mgroup{\cs{the}\ics{glsshorttok}}}}\%
+}
+\end{alltt}
+This command expands when the abbreviations are defined so take care
+to \cs{protect} commands that shouldn't be expanded at that point,
+and make sure that the token registers that store the label, long
+and short values are able to expand. Similarly the sort value needs
+adjusting:
+\begin{alltt}
+\cs{renewcommand}*\mgroup{\ics*{glsxtrfootnotedescsort}}\mgroup{\strong{\cs{the}\ics{glslongtok}}}
+\end{alltt}
+The footnote for all the footnote abbreviation styles is produced
+with:
+\begin{alltt}
+\ics*{glsxtrabbrvfootnote}\marg{label}\marg{text}
+\end{alltt}
+where \meta{text} is the singular or plural long form, depending on
+what command was used to reference the abbreviation (\cs{gls},
+\cs{glspl} etc). This can simply be redefined as:
+\begin{alltt}
+\cs{renewcommand}*\mgroup{\ics*{glsxtrabbrvfootnote}}[2]\mgroup{\ics{footnote}\mgroup{\%
+ \#2: \ics{glsentrydesc}\mgroup{\#1}}}
+\end{alltt}
+This will mimic the result from the original sample document.
+
+You may prefer to replace \verb|#2| with a reference to a
+specific field (or fields). For example:
+\begin{alltt}
+\cs{renewcommand}*\mgroup{\ics*{glsxtrabbrvfootnote}}[2]\mgroup{\ics{footnote}\mgroup{\%
+ \ics*{Glsfmtlong}\mgroup{\#1} (\ics*{glsfmtshort}\mgroup{\#1}): \ics{glsentrydesc}\mgroup{\#1}.}}
+\end{alltt}
+As with the earlier \samplefile{AcrDesc}, you need to remove or change the redefinition of
+\ics{glsseeitemformat} since \cs{acronymfont} is no longer appropriate.
+
+In the original \texttt{sampleCustomAcr.tex} source code, I started
+the description with a capital:
+\begin{verbatim}
+\newacronym[description={Statistical pattern recognition
+technique using the ``kernel trick''},
+see={[see also]{svm}},
+]{ksvm}{ksvm}{kernel support vector machine}
+\end{verbatim}
+This leads to a capital letter after the colon in the footnote,
+which is undesirable, but I would like to have the description start
+with a capital in the glossary. The solution to this problem is
+easy with \gls{glossaries-extra}. I start the description with a
+lowercase letter and set the \attr{glossdesc} attribute to
+\optfmt{firstuc}:
+\begin{alltt}
+\ics*{glssetcategoryattribute}\mgroup{acronym}\mgroup{glossdesc}\mgroup{firstuc}
+\end{alltt}
+The abbreviation definitions are modified slightly:
+\begin{alltt}
+\ics{newacronym}[description=\mgroup{\strong{s}tatistical pattern recognition
+technique using the ``kernel trick''},
+\strong{\xtrgloskey{seealso}=\mgroup{svm}},
+]\mgroup{ksvm}\mgroup{ksvm}\mgroup{kernel support vector machine}
+\end{alltt}
+Note the use of the \xtrgloskey{seealso} key, which is only
+available with \gls{glossaries-extra}.
+
+If you prefer to use \ics*{newabbreviation} instead of
+\ics{newacronym}, then the category needs to be
+\cat{abbreviation} rather than \cat{acronym}:
+\begin{alltt}
+\ics*{glssetcategoryattribute}\mgroup{\strong{abbreviation}}\mgroup{glossdesc}\mgroup{firstuc}
+\end{alltt}
+and the style command needs to be adjusted so that it omits the
+optional argument. For example:
+\begin{alltt}
+\ics*{setabbreviationstyle}\mgroup{short-sc-postfootnote-desc}
+\end{alltt}
+
+\exitem{-FnDesc} This example
+defines a custom display format that puts the description in a
+footnote on \gls{firstuse}.
+\begin{prompt}
+pdflatex sample-FnDesc
+makeglossaries sample-FnDesc
+pdflatex sample-FnDesc
+\end{prompt}
+In order to prevent nested hyperlinks, this document uses the
+\pkgopt[false]{hyperfirst} package option (otherwise the footnote
+marker hyperlink would be inside the hyperlink around the
+\gls{linktext} which would result in a nested hyperlink).
+
+\glsxtrnote
+The \gls{glossaries-extra} package has category post-link hooks that
+make it easier to adjust the formatting. The post-link hook is
+placed after the hyperlink around the \gls{linktext}, so a hyperlink
+created by \ics{footnote} in the post-link hook won't cause a nested
+link. This means that the \pkgopt[false]{hyperfirst} option isn't
+required:
+\begin{alltt}
+\cs{usepackage}[\xtrfont{postdot},\xtrfont{stylemods}]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+
+\begin{important}
+Never use commands like \cs{gls} or \cs{glsdesc} in the post-link
+hook as you can end up with infinite recursion. Use commands that
+don't themselves have a post-link hook, such as \cs{glsentrydesc} or
+\cs{glossentrydesc}, instead.
+\end{important}
+
+In the original \texttt{sample-FnDesc.tex} file, the format was
+adjusted with:
+\begin{alltt}
+\cs{renewcommand}*\mgroup{\ics{glsentryfmt}}\mgroup{\%
+ \ics{glsgenentryfmt}
+ \ics{ifglsused}\mgroup{\ics{glslabel}}\mgroup{}\mgroup{\ics{footnote}\mgroup{\ics{glsentrydesc}\mgroup{\ics{glslabel}}}}%
+}
+\end{alltt}
+This can be changed to:
+\begin{alltt}
+\ics*{glsdefpostlink}
+\mgroup{general}\% category label
+\mgroup{\ics*{glsxtrifwasfirstuse}\mgroup{\ics{footnote}\mgroup{\ics{glsentrydesc}\mgroup{\ics{glslabel}}}}\mgroup{}}
+\end{alltt}
+This sets the post-link hook for the \cat{general} category
+(which is the default category for entries defined with \ics{newglossaryentry}). If I
+added some abbreviations (which have a different category) then this
+change wouldn't apply to them.
+
+The first paragraph in the document is:
+\begin{verbatim}
+First use: \gls{sample}.
+\end{verbatim}
+So the PDF will have the word \qt{sample} (the \gls{linktext}
+created by \verb|\gls{sample}|) as a hyperlink to the entry in the
+glossary followed by the footnote marker, which is a hyperlink to
+the footnote. This is then followed by the sentence terminator.
+\qt{First use: sample\textsuperscript{1}.}
+
+It would look tidier if the footnote marker could be shifted after
+the full stop. \qt{First use: sample.\textsuperscript{1}}
+This can easily be achieved with a minor modification:
+\begin{alltt}
+\ics*{glsdefpostlink}
+\mgroup{general}\% category label
+\mgroup{\ics*{glsxtrifwasfirstuse}
+ \mgroup{\ics*{glsxtrdopostpunc}\mgroup{\ics{footnote}\mgroup{\ics{glsentrydesc}\mgroup{\ics{glslabel}}}}}\%
+ \mgroup{}\%
+}
+\end{alltt}
+You may prefer to use \ics{glossentrydesc} instead of
+\ics{glsentrydesc}. This will obey the \attr{glossdesc} attribute.
+If you append \ics{glspostdescription}, you can also pick up the
+\pkgopt*{postdot} package option. For example:
+\begin{alltt}
+\ics*{glssetcategoryattribute}\mgroup{general}\mgroup{glossdesc}\mgroup{firstuc}
+
+\ics*{glsdefpostlink}
+\mgroup{general}\% category label
+\mgroup{\ics*{glsxtrifwasfirstuse}
+ \mgroup{\ics*{glsxtrdopostpunc}\mgroup{\ics{footnote}\mgroup{\%
+ \strong{\ics{glossentrydesc}}\mgroup{\ics{glslabel}}\strong{\ics{glspostdescription}}}}}\%
+ \mgroup{}\%
+}
+\end{alltt}
+Alternatively, you could just use \ics{Glsentrydesc} and explicitly
+append the full stop.
+
+\exitem{-custom-acronym}
+This document illustrates how to define your own acronym style if
+the predefined styles don't suit your requirements.
+\begin{prompt}
+pdflatex sample-custom-acronym
+makeglossaries sample-custom-acronym
+pdflatex sample-custom-acronym
+\end{prompt}
+In this case, a style is defined to show the short form in the text
+with the long form and description in a footnote on \gls{firstuse}.
+The long form is used for the \gloskey{sort} value.
+The short form is displayed in \gls{smallcaps} in the main part of the
+document but in uppercase in the list of acronyms. (So it's a slight
+variation of some of the examples above.) The \gloskey{name} is set
+to the long form (starting with an initial capital) followed by the
+all caps short form in parentheses. The final requirement is that
+the inline form should show the long form followed by the short form
+in parentheses.
+
+\glsxtrnote
+As with \samplefile{FnAcrDesc}, the \abbrstyle{short-sc-footnote-desc}
+and \abbrstyle{short-sc-postfootnote-desc} abbreviation styles produce
+almost the required effect so one of those can be used as a starting point.
+However the final requirement doesn't fit. It's now necessary to actually define a custom
+abbreviation style, but it can mostly inherit from the
+\abbrstyle{short-sc-footnote-desc} or \abbrstyle{short-sc-postfootnote-desc} style:
+\begin{alltt}
+\ics*{newabbreviationstyle}\mgroup{custom-fn}\%
+\mgroup{\%
+ \ics*{GlsXtrUseAbbrStyleSetup}\mgroup{short-sc-footnote-desc}\%
+}\%
+\mgroup{\%
+ \ics*{GlsXtrUseAbbrStyleFmts}\mgroup{short-sc-footnote-desc}\%
+ \cs{renewcommand}*\mgroup{\ics*{glsxtrinlinefullformat}}[2]\mgroup{\%
+ \strong{\ics*{glsfirstlongfootnotefont}}\mgroup{\strong{\ics*{glsaccesslong}\mgroup{\#\#1}}\%
+ \ics*{ifglsxtrinsertinside}\#\#2\cs{fi}}\%
+ \ics*{ifglsxtrinsertinside}\cs{else}\#\#2\cs{fi}\ics*{glsxtrfullsep}\mgroup{\#\#1}\%
+ \ics*{glsxtrparen}\mgroup{\strong{\ics*{glsfirstabbrvscfont}\mgroup{\ics*{glsaccessshort}\mgroup{\#\#1}}}}\%
+ }\%
+ \cs{renewcommand}*\mgroup{\ics*{glsxtrinlinefullplformat}}[2]\mgroup{\%
+ \strong{\ics*{glsfirstlongfootnotefont}}\mgroup{\strong{\ics*{glsaccesslongpl}\mgroup{\#\#1}}\%
+ \ics*{ifglsxtrinsertinside}\#\#2\cs{fi}}%
+ \ics*{ifglsxtrinsertinside}\cs{else}\#\#2\cs{fi}\ics*{glsxtrfullsep}\mgroup{\#\#1}\%
+ \ics*{glsxtrparen}\mgroup{\strong{\ics*{glsfirstabbrvscfont}\mgroup{\ics*{glsaccessshortpl}\mgroup{\#\#1}}}}\%
+ }%
+ \cs{renewcommand}*\mgroup{\ics*{Glsxtrinlinefullformat}}[2]\mgroup{\%
+ \strong{\ics*{glsfirstlongfootnotefont}}\mgroup{\strong{\ics*{Glsaccesslong}\mgroup{\#\#1}}\%
+ \ics*{ifglsxtrinsertinside}\#\#2\cs{fi}}\%
+ \ics*{ifglsxtrinsertinside}\cs{else}\#\#2\cs{fi}\ics*{glsxtrfullsep}\mgroup{\#\#1}\%
+ \ics*{glsxtrparen}\mgroup{\strong{\ics*{glsfirstabbrvscfont}\mgroup{\ics*{glsaccessshort}\mgroup{\#\#1}}}}\%
+ }\%
+ \cs{renewcommand}*\mgroup{\ics*{Glsxtrinlinefullplformat}}[2]\mgroup{\%
+ \strong{\ics*{glsfirstlongfootnotefont}}\mgroup{\strong{\ics*{Glsaccesslongpl}\mgroup{\#\#1}}\%
+ \ics*{ifglsxtrinsertinside}\#\#2\cs{fi}}\%
+ \ics*{ifglsxtrinsertinside}\cs{else}\#\#2\cs{fi}\ics*{glsxtrfullsep}\mgroup{\#\#1}\%
+ \ics*{glsxtrparen}\mgroup{\strong{\ics*{glsfirstabbrvscfont}\mgroup{\ics*{glsaccessshortpl}\mgroup{\#\#1}}}}\%
+ }\%
+}
+\end{alltt}
+(See the \gls{glossaries-extra} user manual for further details.)
+
+This new custom style now needs to be set:
+\begin{alltt}
+\ics*{setabbreviationstyle}[acronym]\mgroup{custom-fn}
+\end{alltt}
+Remember that if you decide to use \ics*{newabbreviation} instead
+of \ics{newacronym} then the category will be \cat{abbreviation} not \cat{acronym}:
+\begin{alltt}
+\ics*{setabbreviationstyle}\mgroup{custom-fn}
+\end{alltt}
+This custom style simply adjusts the inline full form. There are other
+adjustments to be made that apply to the inherited style. (The alternative is to
+design a new style from scratch.) The footnote contains the long form followed by the
+description. This is the same as the modification to an earlier
+example:
+\begin{alltt}
+\cs{renewcommand}*\mgroup{\ics*{glsxtrabbrvfootnote}}[2]\mgroup{\ics{footnote}\mgroup{\#2:
+\ics{glsentrydesc}\mgroup{\#1}.}}
+\end{alltt}
+As with \samplefile{CustomAcr}, if you specifically
+want the singular long form then you can ignore the second argument.
+For example:
+\begin{alltt}
+\cs{renewcommand}*\mgroup{\ics*{glsxtrabbrvfootnote}}[2]\mgroup{\ics{footnote}
+ \mgroup{\ics*{Glsfmtlong}\mgroup{\#1}: \ics{glsentrydesc}\mgroup{\#1}.}}
+\end{alltt}
+
+The \gloskey{name} now needs to be the long form followed by the
+short form in parentheses, but note the new requirement that the
+short form should now be in all capitals not \gls{smallcaps} and the
+long form should start with a capital letter.
+\begin{alltt}
+\cs{renewcommand}*\mgroup{\ics*{glsxtrfootnotedescname}}\mgroup{\%
+ \cs{protect}\ics*{glsfirstlongfootnotefont}
+ \mgroup{\ics{makefirstuc}\mgroup{\cs{the}\ics{glslongtok}}}
+ (\cs{protect}\ics{MakeTextUppercase}\mgroup{\cs{the}\ics{glsshorttok}})\%
+}
+\end{alltt}
+The inherited abbreviation style uses the short form as the
+\gloskey{sort} value by default. This needs to be changed to the long form:
+\begin{alltt}
+\cs{renewcommand}*\mgroup{\ics*{glsxtrfootnotedescsort}}\mgroup{\cs{the}\strong{\ics{glslongtok}}}
+\end{alltt}
+
+\begin{bib2gls}
+If you want to switch to using \gls{bib2gls}, remember to set the
+abbreviation style before the resource command and change the
+default sort fallback field to \gloskey{long}, as with
+\samplefile{AcrDesc}.
+\end{bib2gls}
+
+\exitem{-dot-abbr} This document illustrates how to use the base
+post link hook to adjust the space factor after abbreviations.
+\begin{prompt}
+pdflatex sample-dot-abbr
+makeglossaries sampledot-abbrf
+pdflatex sample-dot-abbr
+\end{prompt}
+This example creates a custom storage key that provides a similar
+function to \gls{glossaries-extra}['s] \xtrgloskey{category} key.
+
+\glsxtrnote
+This example is much simpler with \gls{glossaries-extra}. The custom
+storage key, which is defined using:
+\begin{alltt}
+\ics{glsaddstoragekey}\mgroup{abbrtype}\mgroup{word}\mgroup{\cs{abbrtype}}
+\end{alltt}
+can now be removed.
+
+The \xtrgloskey{category} key is set to \texttt{initials} for
+the initialisms (which are defined with the custom \cs{newacr}
+command). The abbreviation styles can be set with:
+\begin{alltt}
+\ics*{setabbreviationstyle}[acronym]\mgroup{long-short}
+\ics*{setabbreviationstyle}[initials]\mgroup{long-short}
+\end{alltt}
+The \attr{discardperiod} attribute will discard any full stop
+(period) following commands like \cs{gls}:
+\begin{alltt}
+\ics*{glssetcategoryattribute}\mgroup{initials}\mgroup{discardperiod}\mgroup{true}
+\end{alltt}
+(If you want to use the \attr{noshortplural} attribute then you will
+also need to set the \attr{pluraldiscardperiod} attribute.)
+
+The \gls{firstuse} is governed by the \attr{retainfirstuseperiod}
+attribute. If set, the period won't be discarded if it follows the
+\gls{firstuse} of commands like \cs{gls}. This is useful for styles
+where the \gls{firstuse} doesn't end with the short form. In this
+case, the \gls{firstuse} of the \abbrstyle{long-short} style ends
+with a closing parenthesis, so the end of sentence might be clearer
+if the period is retained:
+\begin{alltt}
+\ics*{glssetcategoryattribute}\mgroup{initials}\mgroup{retainfirstuseperiod}\mgroup{true}
+\end{alltt}
+
+The \attr{insertdots} attribute can automatically insert dots into
+the short form with a final space factor adjustment:
+\begin{alltt}
+\ics*{glssetcategoryattribute}\mgroup{initials}\mgroup{insertdots}\mgroup{true}
+\end{alltt}
+
+The custom helper command defined in the example needs to be
+slightly modified:
+\begin{alltt}
+\cs{newcommand}*\mgroup{\cs{newabbr}}[1][]\mgroup{\%
+ \strong{\ics*{newabbreviation}}[\strong{\xtrfont{category}}=initials,\#1]}
+\end{alltt}
+The definitions need to be slightly modified to work with the
+\attr{insertdots} attribute:
+\begin{alltt}
+\cs{newabbr}\mgroup{eg}\mgroup{\strong{eg}}\mgroup{eg}
+\cs{newabbr}\mgroup{ie}\mgroup{\strong{ie}}\mgroup{ie}
+\cs{newabbr}\mgroup{bsc}\mgroup{\strong{B\mgroup{Sc}}}\mgroup{Bachelor of Science}
+\cs{newabbr}\mgroup{ba}\mgroup{\strong{BA}}\mgroup{BA}
+\cs{newabbr}\mgroup{agm}\mgroup{\strong{AGM}}\mgroup{AGM}
+\end{alltt}
+(This makes it much easier to change your mind if you decide at a
+later date to omit the dots, especially if you are storing all your
+definitions in a file that's shared across multiple documents, but
+note the need to group \qt{Sc}.)
+
+The \qt{laser} definition remains unchanged:
+\begin{verbatim}
+\newacronym{laser}{laser}{light amplification by stimulated
+emission of radiation}
+\end{verbatim}
+The remaining code in the preamble must now be removed. (It will
+interfere with \gls{glossaries-extra}['s] category post-link hooks.)
+No change is required in the document body.
+
+See the \gls{glossaries-extra} user manual for further details about
+category attributes and post-link hooks.
+
+\exitem{-font-abbr} This document illustrates how to have different fonts
+for abbreviations within the style. The document build is:
+\begin{prompt}
+pdflatex sample-font-abbr
+makeglossaries sample-font-abbr
+pdflatex sample-font-abbr
+\end{prompt}
+The acronym mechanism provided by the base \styfmt{glossaries}
+package isn't well suited to having a mixture of styles. This
+example provides a workaround that involves defining a new storage
+key with \ics{glsaddstoragekey} that's used to hold the font
+declaration (such as \cs{em}).
+\begin{verbatim}
+\glsaddstoragekey{font}{}{\entryfont}
+\end{verbatim}
+A new custom acronym style is defined that fetches the font
+information from this new key so that it can be applied to the
+abbreviation. Some helper commands are also provided to define the
+different types of abbreviation:
+\begin{verbatim}
+\newcommand*{\newitabbr}[1][]{\newacronym[font=\em,#1]}
+\newcommand*{\newupabbr}{\newacronym}
+
+\newitabbr{eg}{e.g.}{exempli gratia}
+\newupabbr{bsc}{BSc}{Bachelor of Science}
+\end{verbatim}
+This makes the \gls{firstuse} of \verb|\gls{eg}| appear as \qt{exempli
+gratia (\emph{e.g.})} whereas the \gls{firstuse} of \verb|\gls{bsc}|
+is \qt{Bachelor of Science (BSc)}.
+
+\glsxtrnote
+This example document is much simpler with \gls{glossaries-extra}.
+First the \cs{usepackage} command needs adjusting:
+\begin{alltt}
+\cs{usepackage}[\xtrfont{postdot},\xtrfont{stylemods}]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+The custom storage key can now be removed and also the custom
+acronym style. Now replace the \ics{setacronymstyle} line with:
+\begin{alltt}
+\ics*{setabbreviationstyle}[acronym]\mgroup{long-short-em}
+\end{alltt}
+and change the definition of the helper commands:
+\begin{alltt}
+\cs{newcommand}*\mgroup{\cs{newitabbr}}\mgroup{\ics{newacronym}}
+\cs{newcommand}*\mgroup{\cs{newupabbr}}\mgroup{\strong{\ics*{newabbreviation}}}
+\end{alltt}
+Note that the \verb|font=\em,| part has been removed from the
+definition of the first command and the second command uses
+\ics*{newabbreviation} instead of \ics{newacronym}. This means that
+\cs{newitabbr} will default to
+\xtrgloskey{category}\csoptfmt{=acronym} and \cs{newupabbr} will
+default to \xtrgloskey{category}\csoptfmt{=abbreviation}. The
+default style for the \cat{abbreviation} category is
+\abbrstyle{long-short}, which is the required style for this
+example. This just means that only the \cat{acronym} category needs
+to have the style set (with the above \ics*{setabbreviationstyle}
+command).
+
+Finally, the \ics{acrshort}, \ics{acrlong} and \cs{acrfull} commands
+need to be replaced with \ics*{glsxtrshort}, \ics*{glsxtrlong} and
+\ics*{glsxtrfull}.
+
+You may notice that the spacing after \qt{e.g\@.} and \qt{i.e\@.}
+isn't correct. This is similar to the \samplefile{-dot-abbr} example
+where the space factor needs adjusting. In this case I've inserted
+the dots manually (rather than relying on the \attr{insertdots}
+attribute). You can either remove the dots and use \attr{insertdots}
+with \attr{discardperiod}:
+\begin{alltt}
+\ics*{glssetcategoryattribute}\mgroup{acronym}\mgroup{insertdots}\mgroup{true}
+\ics*{glssetcategoryattribute}\mgroup{acronym}\mgroup{discardperiod}\mgroup{true}
+
+\cs{newitabbr}\mgroup{eg}\mgroup{\strong{eg}}\mgroup{exempli gratia}
+\cs{newitabbr}\mgroup{ie}\mgroup{\strong{ie}}\mgroup{id est}
+\end{alltt}
+Or you can manually insert the space factor adjustment and only use
+the \attr{discardperiod} attribute:
+\begin{alltt}
+\ics*{glssetcategoryattribute}\mgroup{acronym}\mgroup{discardperiod}\mgroup{true}
+
+\cs{newitabbr}\mgroup{eg}\mgroup{e.g.\strong{\ics{@}}}\mgroup{exempli gratia}
+\cs{newitabbr}\mgroup{ie}\mgroup{i.e.\strong{\ics{@}}}\mgroup{id est}
+\end{alltt}
+
+You don't have to use the \cat{acronym} category. You may prefer a
+different label that fits better semantically. For example:
+\begin{alltt}
+\ics*{setabbreviationstyle}[\strong{latinabbr}]\mgroup{long-short-em}
+\cs{newcommand}*\mgroup{\cs{new\strong{latin}abbr}}[1][]\mgroup{\ics*{newabbreviation}[\xtrfont{category}=\strong{latinabbr},\#1]}
+\ics*{glssetcategoryattribute}\mgroup{\strong{latinabbr}}\mgroup{insertdots}\mgroup{true}
+\ics*{glssetcategoryattribute}\mgroup{\strong{latinabbr}}\mgroup{discardperiod}\mgroup{true}
+
+\cs{new\strong{latin}abbr}\mgroup{eg}\mgroup{e.g.\strong{\ics{@}}}\mgroup{exempli gratia}
+\cs{new\strong{latin}abbr}\mgroup{ie}\mgroup{i.e.\strong{\ics{@}}}\mgroup{id est}
+\end{alltt}
+
+\section{Non-Page Locations}
+\label{sec:samplecounter}
+
+\exitem{Eq} This document illustrates how
+to change the location to something other than the page number. In
+this case, the \ctrfmt{equation} counter is used since all glossary
+entries appear inside an \env{equation} environment. To create
+the document do:
+\begin{prompt}
+pdflatex sampleEq
+makeglossaries sampleEq
+pdflatex sampleEq
+\end{prompt}
+The \styfmt{glossaries} package provides some location formats, such
+as \ics{hyperrm} and \ics{hyperbf}, that allow the locations in the \gls{numberlist}
+to hyperlink to the appropriate place in the document (if
+\sty{hyperref} has been used). Since it's not possible to include
+the hyperlink name in the indexing information with \gls{makeindex}
+and \gls{xindy}, the \styfmt{glossaries} package has to reform the
+name from a prefix and the location value.
+
+Unfortunately it's not always possible to split the link name into a
+prefix and location. That happens with the \ctrfmt{equation}
+counter in certain classes, such as the \clsfmt{report} class (which
+is used in this example). This means that it's necessary to redefine
+\ics{theHequation} so that it has a format that fits the requirement:
+\begin{verbatim}
+\renewcommand*\theHequation{\theHchapter.\arabic{equation}}
+\end{verbatim}
+If you don't do this, the equation locations in the glossary won't
+form valid hyperlinks.
+
+Each glossary entry represents a mathematical symbol. This means
+that with \optsto13 it's necessary to use the \gloskey{sort} key.
+For example:
+\begin{alltt}
+\cs{newglossaryentry}\mgroup{Gamma}\mgroup{name=\cs{ensuremath}\mgroup{\cs{Gamma}(z)},
+description=Gamma function,\strong{sort=Gamma}}
+\end{alltt}
+
+\bibglsnote
+If you want to switch to using \gls{bib2gls}, the first change you
+need to make is to switch from explicitly loading
+\styfmt{glossaries} to loading \gls{glossaries-extra} with the
+\pkgopt*{record} package option. If \pkgopt+{only}{record} (or
+\pkgopt*{record} without a value) is used, then the above
+redefinition of \cs{theHequation} is still required. If
+\pkgopt+{nameref}{record} is used instead then the redefinition of
+\cs{theHequation} isn't required. You may also want to use the
+\pkgopt*{stylemods} and \pkgopt*{postdot} options:
+\begin{alltt}
+\cs{usepackage}[\strong{\strong{\xtrfont{record=nameref}},\xtrfont{stylemods},\xtrfont{postdot}},
+ ucmark,style=long3colheader,counter=equation]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+The entries now need to be converted into the \filetype{bib} format required
+by \gls{bib2gls}, which can be done with \gls{convertgls2bib}:
+\begin{prompt}
+convertgls2bib -{}-preamble-only sampleEq.tex entries.bib
+\end{prompt}
+This will create a file called \nolinkurl{entries.bib} that starts:
+\begin{alltt}
+\% Encoding: UTF-8
+\atentry{entry}\mgroup{Gamma,
+ name = \mgroup{\cs{ensuremath}\mgroup{\cs{Gamma}(z)}},
+ description = \mgroup{Gamma function}
+}
+\end{alltt}
+You may prefer to change \atentry{entry} to \atentry{symbol}. (This
+should be easy to do with your text editor's search and replace
+function.)
+
+Note that the \gloskey{sort} key has been omitted. This is because
+it typically shouldn't be used. The difference between using
+\atentry{entry} and \atentry{symbol} is that with \atentry{entry}
+the sort value will be obtained from the \gloskey{name} but with
+\atentry{symbol} the sort value will be obtained from the label.
+If you explicitly use the \gloskey{sort} key then you will break
+this behaviour. (If you try this example out, notice the difference
+in the ordering if you switch between \atentry{entry} and
+\atentry{symbol}. See also \bibglsgallery{sorting}.)
+
+Next replace \cs{makeglossaries} with:
+\begin{alltt}
+\strong{\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries]}
+\end{alltt}
+If you have used \pkgopt+{nameref}{record} then you can remove the
+redefinition of \cs{theHequation}. Next remove all the lines
+defining the glossary entries (since they're now defined in the
+\filetype{bib} file).
+
+Finally, replace \ics{printglossary} with \ics*{printunsrtglossary}:
+\begin{alltt}
+\strong{\ics*{printunsrtglossary}}[title=\mgroup{Index of Special Functions and
+Notations}]
+\end{alltt}
+The rest of the document remains unchanged (unless you want to use
+\ics*{glsxtrfmt} as described in the following example).
+
+\exitem{EqPg} This is similar to the previous example, but the \glspl{numberlist} are a
+mixture of page numbers and equation numbers. This example adds the
+glossary to the table of contents, so an extra \LaTeX\ run is
+required:
+\begin{prompt}
+pdflatex sampleEqPg
+makeglossaries sampleEqPg
+pdflatex sampleEqPg
+pdflatex sampleEqPg
+\end{prompt}
+As with the previous example, entries are defined like this:
+\begin{verbatim}
+\newglossaryentry{Gamma}{name=\ensuremath{\Gamma(z)},
+description=Gamma function,sort=Gamma}
+\end{verbatim}
+The \pkgopt[equation]{counter} package option is used to set the
+default indexing counter to \ctrfmt{equation}. This means that it
+has to be changed for indexing outside of any numbered equation. For
+example:
+\begin{verbatim}
+\glslink[format=hyperbf,counter=page]{Gamma}{gamma function}
+\end{verbatim}
+I've set the \gloskey[glslink]{format} to \locfmt{hyperbf} to indicate that
+this is a primary reference. (Note that I'm using \ics{hyperbf} not
+\ics{textbf} in order to include a hyperlink in the location.)
+
+The \gls{linktext} here is almost identical to the
+description. The only difference is that the description starts with
+a capital. If it started with a lowercase character instead, I could
+simply use \ics{glsdesc} instead of \ics{glslink}. If I change the
+entry descriptions so that they all start with a lowercase letter
+then I would need to create a custom glossary style that used
+\ics{Glossentrydesc} instead of \ics{glossentrydesc}.
+
+\glsxtrnote
+If I switch to using \gls{glossaries-extra} I wouldn't need a new
+glossary style. Instead I could just use the \attr{glossdesc}
+attribute to perform the case change. Remember that the first change
+to make is to replace \styfmt{glossaries} with
+\gls{glossaries-extra}:
+\begin{alltt}
+\cs{usepackage}[style=long3colheader,\strong{\xtrfont{postdot},\xtrfont{stylemods}},
+ counter=equation]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+The entries are now all defined so that the description starts with
+a lowercase letter (except for the descriptions that start with a
+proper noun). For example:
+\begin{alltt}
+\ics{newglossaryentry}\mgroup{Gamma}\mgroup{name=\cs{ensuremath}\mgroup{\cs{Gamma}(z)},
+description=\strong{g}amma function,sort=Gamma}
+\end{alltt}
+The \attr{glossdesc} attribute needs setting:
+\begin{alltt}
+\ics*{glssetcategoryattribute}\mgroup{general}\mgroup{glossdesc}\mgroup{firstuc}
+\end{alltt}
+This means that I can now use \ics{glsdesc} instead of \ics{glslink}.
+
+It's a bit cumbersome typing \texttt{[format=hyperbf,counter=page]}
+for each primary reference, but \gls{glossaries-extra} provides a
+convenient way of having a third modifier for commands like \cs{gls}
+and \cs{glstext}. This needs to be a single punctuation character
+(but not \texttt{*} or \texttt{+} which are already in use). For
+example:
+\begin{alltt}
+\ics*{GlsXtrSetAltModifier}\mgroup{\strong{!}}\mgroup{format=hyperbf,counter=page}
+\end{alltt}
+Now \texttt{\ics{glsdesc}\strong{!}\mgroup{Gamma}} is equivalent to:
+\begin{alltt}
+\ics{glsdesc}[format=hyperbf,counter=page]\mgroup{Gamma}
+\end{alltt}
+So the text at the start of the \qt{Gamma Functions} chapter is now
+just:
+\begin{alltt}
+The \ics{glsdesc}!\mgroup{Gamma} is defined as
+\end{alltt}
+which is much more compact. Similar changes can be made for the
+other instance of \ics{glslink} where the \gls{linktext} is just
+the description:
+\begin{alltt}
+The \ics{glsdesc}!\mgroup{erf} is defined as
+\end{alltt}
+
+There are three other instances of \ics{glslink}, such as:
+\begin{alltt}
+\ics{glslink}\mgroup{Gamma}\mgroup{\cs{Gamma}(x+1)}
+\end{alltt}
+If I just use \verb|\gls{Gamma}| then I would get $\Gamma(z)$ as the
+\gls{linktext}. For entries like this that represent functions with
+variable parameters it would be more convenient (and help with
+consistency) if a command was available to easily replace the
+parameters.
+
+With the base \styfmt{glossaries} package, one simple solution that
+works for this example is to save just the function symbol in the
+\gloskey{symbol} field, for example:
+\begin{alltt}
+\ics{newglossaryentry}\mgroup{Gamma}\mgroup{name=\cs{ensuremath}\mgroup{\cs{Gamma}(z)},
+\strong{symbol=\mgroup{\cs{ensuremath}\mgroup{\cs{Gamma}}},}
+description=gamma function,sort=Gamma}
+\end{alltt}
+and then use:
+\begin{alltt}
+\strong{\ics{glssymbol}}\mgroup{Gamma}\strong[(\cs{Gamma}(x+1))\strong]
+\end{alltt}
+(which includes the function parameter inside the \gls{linktext}) or just:
+\begin{alltt}
+\ics{glssymbol}\mgroup{Gamma}(\cs{Gamma}(x+1))
+\end{alltt}
+(which has the function parameter after the \gls{linktext}).
+This is a convenient approach where the extra material can simply
+follow the symbol, and it can also be used with \gls{glossaries-extra}.
+
+The \gls{glossaries-extra} package provides another possibility. It
+requires a command that takes a single argument, for example:
+\begin{verbatim}
+\newcommand{\Gammafunction}[1]{\Gamma(#1)}
+\end{verbatim}
+The control sequence name (the command name without the leading
+backslash) is stored in the field identified by the command \ics*{GlsXtrFmtField}
+(this should be the internal field name not the key name, see \tableref{tab:fieldmap}). The
+default is \field{useri} which corresponds to the \gloskey{user1}
+key. This means that the \texttt{Gamma} entry would need to be
+defined with \texttt{user1=Gammafunction}. With this approach, each
+function entry would need a separate associated command.
+
+Another approach is to store the parameterless function in the
+\gloskey{symbol} key (as earlier) and have a more generic command that uses this
+symbol. This requires the entry label, which can be obtained with
+\cs{glslabel} within the \gls{linktext}:
+\begin{alltt}
+\cs{newcommand}\mgroup{\cs{entryfunc}}[1]\mgroup{\ics{glsentrysymbol}\mgroup{\ics{glslabel}}(\#1)}
+\end{alltt}
+(Obviously, this command can't be used outside of the \gls{linktext}
+or post-link hooks since it uses \ics{glslabel}.)
+
+So the entry now needs the parameterless function in
+\gloskey{symbol} and the control sequence name of this generic
+command in \gloskey{user1}. For example:
+\begin{alltt}
+\ics{newglossaryentry}\mgroup{Gamma}\mgroup{name=\cs{ensuremath}\mgroup{\cs{Gamma}(z)},
+\strong{symbol=\mgroup{\cs{ensuremath}\mgroup{\cs{Gamma}}},user1=entryfunc,}
+description=gamma function,sort=Gamma}
+\end{alltt}
+(This doesn't need to be done for the \texttt{C} and \texttt{G}
+entries since they're constants not functions.)
+
+You may want to consider providing helper commands to make the
+functions easier to define. For example:
+\begin{verbatim}
+\newcommand{\func}[2]{#1(#2)}
+\newcommand{\entryfunc}[1]{\func{\glsentrysymbol{\glslabel}}{#1}}
+\newcommand{\newfunc}[5][]{%
+ \newglossaryentry{#2}{name={\ensuremath{\func{#3}{#4}}},
+ symbol={#3},
+ user1={entryfunc},
+ description={#5},
+ sort={#2},#1
+ }%
+}
+\end{verbatim}
+The entries can now be defined using this custom \cs{newfunc}
+command. For example:
+\begin{verbatim}
+\newfunc{Gamma}{\Gamma}{z}{gamma function}
+\newfunc[sort=gamma1]{gamma}{\gamma}{\alpha,x}{lower
+ incomplete gamma function}
+\newfunc[sort=Gamma2]{iGamma}{\Gamma}{\alpha,x}{upper
+ incomplete gamma function}
+\end{verbatim}
+
+Note that in \cs{newfunc} the \gloskey{symbol} key doesn't have its value
+encapsulated with \ics{ensuremath} so \cs{glssymbol} will need to explicitly be
+placed in math mode. If you switch to a glossary style that displays
+the symbol, you will either need to adjust the definition of
+\cs{newfunc} to use \ics{ensuremath} in the \gloskey{symbol} field
+or you can add the encapsulation with the \attr{glosssymbolfont}
+attribute.
+
+Now \verb|\glslink{Znu}{Z_\nu}| can simply be replaced with
+\texttt{\ics{glssymbol}\mgroup{Znu}} (no parameter is required in
+this case). For the other cases, where the parameter is different
+from that given in the \gloskey{text} field (which is obtained from
+the \gloskey{name}), you can use \ics*{glsxtrfmt}. For example,
+\texttt{\cs{glslink}\mgroup{Gamma}\mgroup{\cs{Gamma}(x+1)}} can now be replaced with:
+\begin{alltt}
+\ics*{glsxtrfmt}\mgroup{Gamma}\mgroup{x+1}
+\end{alltt}
+This effectively works like \cs{glslink} but omits the post-link hook.
+(See the \gls{glossaries-extra} user manual for further details.)
+
+\begin{important}
+Don't use \ics*{glsxtrfmt} within the argument of another \ics*{glsxtrfmt} command
+(or inside any other \gls{linktext}).
+\end{important}
+
+Similarly \verb|\glslink{Gamma}{\Gamma(\alpha)}|
+can now be replaced with:
+\begin{alltt}
+\ics*{glsxtrfmt}\mgroup{Gamma}\mgroup{\cs{alpha}}
+\end{alltt}
+Note that it's still possible to use:
+\begin{alltt}
+\ics{glssymbol}\mgroup{Gamma}[(\cs{alpha})]
+\end{alltt}
+You may prefer to define a helper command that makes it easier to
+switch between your preferred method. For example:
+\begin{verbatim}
+\newcommand*{\Fn}[3][]{\glssymbol[#1]{#2}[(#3)]}
+\end{verbatim}
+or:
+\begin{alltt}
+\cs{newcommand}*\mgroup{\cs{Fn}}[3][]\mgroup{\ics*{glsxtrfmt}[\#1]\mgroup{\#2}\mgroup{\#3}}
+\end{alltt}
+
+\bibglsnote
+If you want to convert this example so that it works with \gls{bib2gls}, first
+convert it to use \gls{glossaries-extra} (as described above), and
+then follow the instructions from \samplefile{Eq}. The
+\gls{convertgls2bib} application recognises \cs{newcommand} so it
+will be able to parse the custom \cs{newfunc} commands.
+
+Note that \gls{bib2gls} allows you to separate the locations in the \gls{numberlist}
+into different groups according to the counter used for the
+location. This can be done with the \resourceopt{loc-counters}
+resource option. It's also possible to identify primary formats
+(such as \locfmt{hyperbf} used in this example) using the
+\resourceopt{primary-location-formats} option. The primary locations
+can then be given a more prominent position in the
+\gls{numberlist}. See the \gls{bib2gls} user manual for further
+details.
+
+\exitem{Sec} This document also
+illustrates how to change the location to something other than the
+page number. In this case, the \texttt{section} counter is used.
+This example adds the glossary to the table of contents, so an extra
+\LaTeX\ run is required:
+\begin{prompt}
+pdflatex sampleSec
+makeglossaries sampleSec
+pdflatex sampleSec
+pdflatex sampleSec
+\end{prompt}
+Note that there are conflicting location formats, which trigger a
+warning from \gls{makeindex}:
+\begin{verbatim}
+## Warning (input = sampleSec.glo, line = 6; output =
+sampleSec.gls, line = 9):
+ -- Conflicting entries: multiple encaps for the same page
+under same key.
+
+## Warning (input = sampleSec.glo, line = 2; output =
+sampleSec.gls, line = 10):
+ -- Conflicting entries: multiple encaps for the same page
+under same key.
+\end{verbatim}
+This is the result of indexing an entry multiple times for the same
+location\footnote{\gls{makeindex} assumes that the location is a
+page number} with different values of the \gloskey[glslink]{format} key. In this case,
+it's caused by three references to the \texttt{ident} entry in section~2.1:
+\begin{verbatim}
+\gls[format=hyperit]{ident}
+\glspl{ident} % default format=glsnumberformat
+\gls*[format=hyperbf]{ident}
+\end{verbatim}
+
+If you use the \gls{makeglossaries} Perl script it will detect the warnings in the
+\gls{makeindex} transcript file and attempt to fix the conflict by
+removing entries from the \filetype{glo} file:
+\begin{verbatim}
+Multiple encaps detected. Attempting to remedy.
+Reading sampleSec.glo...
+Writing sampleSec.glo...
+Retrying
+\end{verbatim}
+(Range formats have highest precedence. The default \locfmt{glsnumberformat}
+has the lowest precedence.)
+
+If you use \gls{makeglossaries-lite.lua} or call
+\gls{makeindex} directly then the problem won't be fixed and the
+glossary will end up with the rather odd \gls{numberlist} for the
+identity matrix entry consisting of three references to section 2.1:
+the first in the default font, followed by bold (\locfmt{hyperbf})
+and then italic (\locfmt{hyperit}), which results in 2.1,
+\textbf{2.1}, \textit{2.1}. If you use \gls{makeglossaries} then
+only the bold entry (\textbf{2.1}) will be present.
+
+If you switch to \gls{xindy}:
+\begin{alltt}
+\cs{usepackage}[\strong{xindy},style=altlist,toc,counter=section]\mgroup{glossaries}
+\end{alltt}
+then the conflict will be resolved using the number format attribute
+list order of priority. In this case, \locfmt{glsnumberformat} has
+the highest priority. This means that only the upright medium weight entry
+(2.1) will be present. The simplest way of altering this is to
+provide your own custom format. For example:
+\begin{alltt}
+\cs{newcommand}*\mgroup{\strong{\cs{primary}}}[1]\mgroup{\ics{hyperit}\mgroup{\#1}}
+\ics{GlsAddXdyAttribute}\mgroup{\strong{primary}}
+\end{alltt}
+and change \verb|\gls[format=hyperit]| to \texttt{\cs{gls}[format=\strong{primary}]} etc.
+This will give \csoptfmt{\gloskey[glslink]{format}=\locfmt{primary}} the highest priority.
+(It's also better practice to provide this kind of semantic command.)
+
+With \gls{bib2gls}, you can supply rules to deal with location format
+conflicts, as illustrated below.
+
+\bibglsnote
+In order to switch to \gls{bib2gls}, first replace
+\styfmt{glossaries} with \gls{glossaries-extra}, and add the \pkgopt*{record}
+package option. Remember that \gls{glossaries-extra} has a different
+set of defaults and you may also want to patch the predefined base styles.
+For example:
+\begin{alltt}
+\cs{usepackage}[style=altlist,\strong{\xtrfont{postdot},\xtrfont{stylemods}},counter=section]
+\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+
+The entry definitions now need to be converted into \gls{bib2gls}
+format and saved in a \filetype{bib} file (say, \texttt{entries.bib}). You can use
+\gls{convertgls2bib}:
+\begin{prompt}
+convertgls2bib -{}-preamble-only sampleSec.tex entries.bib
+\end{prompt}
+
+Next replace \ics{makeglossaries} with:
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[src=entries]
+\end{alltt}
+and remove all the \cs{newglossaryentry} commands.
+
+Finally, replace \ics{printglossaries} with \ics*{printunsrtglossaries}.
+The document build is now:
+\begin{prompt}
+pdflatex sampleSec
+bib2gls sampleSec
+pdflatex sampleSec
+\end{prompt}
+As with the original example, there's still a location format
+conflict, which \gls{bib2gls} warns about:
+\begin{verbatim}
+Warning: Entry location conflict for formats: hyperbf and hyperit
+Discarding: {ident}{}{section}{hyperbf}{2.1}
+Conflicts with: {ident}{}{section}{hyperit}{2.1}
+\end{verbatim}
+This means that it has discarded the bold location and kept the
+italic one. (As with \gls{makeglossaries}, range formats have the
+highest priority and \locfmt{glsnumberformat} has the lowest.)
+
+It would be better if the conflict could be merged into
+a single location that was both bold and italic. To achieve this,
+it's first necessary to define a command that produces this effect:
+\begin{alltt}
+\cs{newcommand}*\mgroup{\ics{hyperbfit}}[1]\mgroup{\cs{textbf}\mgroup{\cs{hyperit}\mgroup{\#1}}}
+\end{alltt}
+Now \gls{bib2gls} needs to be invoked with the appropriate mapping
+with the \bibglslongopt{map-format} or \bibglsopt{m} switch:
+\begin{prompt}
+bib2gls -m \glsquote{hyperbf:hyperbfit,hyperit:hyperbfit} sampleSec
+\end{prompt}
+If you are using \app{arara} the directive should be:
+\begin{alltt}
+\% arara: bib2gls: \mgroup{ mapformats: [ [hyperbf, hyperbfit],
+\% arara: -{}-> [hyperit, hyperbfit] ] }
+\end{alltt}
+
+If you try out this example, notice the difference between
+\pkgopt+{only}{record} and \pkgopt+{nameref}{record}. If you use the
+latter, the locations will now be the section titles rather than the
+section numbers. If you use the \optfmt{nameref} setting you can customize the
+location by defining the command:
+\begin{alltt}
+\csmeta*{glsxtr}{counter}{locfmt}\marg{location}\marg{title}
+\end{alltt}
+
+In this case the counter is \ctrfmt{section}, so the command should be
+\ics*{glsxtrsectionlocfmt}. It takes two arguments: the first is the
+location and the second is the title. For example:
+\begin{alltt}
+\cs{newcommand}*\mgroup{\ics*{glsxtrsectionlocfmt}}[2]\mgroup{\ics{S}\#1 \#2}
+\end{alltt}
+(The only command of this type that is defined by default is the one
+for the \ctrfmt{equation} counter, \ics*{glsxtrequationlocfmt}.) Make sure
+that you have at least version 1.42 of \gls{glossaries-extra}.
+
+\section{Multiple Glossaries}
+\label{sec:samplestype}
+
+See also \samplefile{Sort} in \sectionref{sec:samplessort}, which
+has three glossaries.
+
+\exitem{Ntn} This document illustrates
+how to create an additional glossary type. This example adds the
+glossary to the table of contents, so an extra \LaTeX\ run is
+required:
+\begin{prompt}
+pdflatex sampleNtn
+makeglossaries sampleNtn
+pdflatex sampleNtn
+pdflatex sampleNtn
+\end{prompt}
+Note that if you want to call \gls{makeindex} explicitly instead of
+using the \gls{makeglossaries} or \gls{makeglossaries-lite.lua}
+scripts then you need to call \gls{makeindex} twice:
+\begin{enumerate}
+\item Create the main glossary (all on one line):
+\begin{prompt}
+makeindex -s sampleNtn.ist -t sampleNtn.glg -o sampleNtn.gls sampleNtn.glo
+\end{prompt}
+\item Create the secondary glossary (all on one line):
+\begin{prompt}
+makeindex -s sampleNtn.ist -t sampleNtn.nlg -o sampleNtn.not sampleNtn.ntn
+\end{prompt}
+\end{enumerate}
+This document creates a new glossary using:
+\begin{alltt}
+\ics{newglossary}[nlg]\mgroup{notation}\mgroup{not}\mgroup{ntn}\mgroup{Notation}
+\end{alltt}
+This defines a glossary that can be identified with the label
+\texttt{notation} with the default title \qt{Notation}. The other
+arguments are the file extensions required with \optsand23. For those
+two options, the \styfmt{glossaries} package needs to know the input
+and output files required by \gls{makeindex} or \gls{xindy}.
+
+(The optional argument is the file extension of the indexing transcript
+file, which \styfmt{glossaries} doesn't need to know about, but it
+writes the information to the \filetype{aux} file for the benefit of
+\gls{makeglossaries} and \gls{makeglossaries-lite.lua}.)
+
+If you switch to a different indexing option then these file extensions
+aren't required, in which case it's simpler to use the starred form:
+\begin{alltt}
+\ics{newglossary*}\mgroup{notation}\mgroup{Notation}
+\end{alltt}
+
+This example uses a label prefixing system\footnote{If you use
+\sty{babel} with a language that makes the colon character
+\texttt{:} active you will need to change the prefix.}\ to differentiate
+between the different types of entries. For example, the term
+\qt{set} is defined as:
+\begin{verbatim}
+\newglossaryentry{gls:set}{name=set,
+description={A collection of distinct objects}}
+\end{verbatim}
+and the set notation is defined as:
+\begin{verbatim}
+\newglossaryentry{not:set}{type=notation,
+name={\ensuremath{\mathcal{S}}},
+description={A \gls{gls:set}},sort={S}}
+\end{verbatim}
+Notice that the latter description contains \cs{gls}. This means
+you shouldn't use \ics{glsdesc} with this entry otherwise you will
+end up with nested links.
+
+\glsxtrnote
+The \gls{glossaries-extra} package provides a command for use in
+within field values to prevent nested \gls{linktext}:
+\begin{alltt}
+\ics*{glsxtrp}\marg{field}\marg{label}
+\end{alltt}
+There are convenient shortcuts for common fields:
+\texttt{\ics*{glsps}\marg{label}} (for the \gloskey{short} field) and
+\texttt{\ics*{glspt}\marg{label}} (for the \gloskey{text}
+field). So the set notation definition can be modified:
+\begin{alltt}
+\cs{newglossaryentry}\mgroup{not:set}\mgroup{type=notation,
+name=\mgroup{\cs{ensuremath}\mgroup{\cs{mathcal}\mgroup{S}}},
+description=\mgroup{A \strong{\ics*{glspt}\mgroup{gls:set}}},sort={S}}
+\end{alltt}
+This will stop the inner reference from causing interference if you use \ics{glsdesc}.
+It will also suppress indexing within the glossary but will have a
+hyperlink (if \styfmt{hyperref} is used).
+
+The \gls{glossaries-extra} package provides a way of defining
+commands like \cs{gls} that automatically insert a prefix. For
+example:
+\begin{alltt}
+\ics*{glsxtrnewgls}\mgroup{not:}\mgroup{\cs{sym}}
+\ics*{glsxtrnewglslike}\mgroup{gls:}\mgroup{\cs{term}}\mgroup{\cs{termpl}}\mgroup{\cs{Term}}\mgroup{\cs{Termpl}}
+\end{alltt}
+(there's no point providing commands for plural or case-changing with
+symbols). Now \verb|\gls{not:set}| can be replaced with \verb|\sym{set}| and
+\verb|\gls{gls:set}| can be replaced with \verb|\term{set}|.
+
+\bibglsnote
+These two commands are primarily provided for the benefit of \gls{bib2gls} as
+the information is written to the \filetype{aux} file. This allows
+\gls{bib2gls} to recognise the custom commands if they have been
+used in the \filetype{bib} files. When combined with
+\resourceopt{label-prefix} and \resourceopt{ext-prefixes} (see
+below) this makes it much simpler to change the prefixes if
+necessary.
+
+If you want to convert this document to use \gls{bib2gls}, remember
+that you need the \pkgopt*{record} or \pkgopt+{nameref}{record}
+option. For example:
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{record},}\xtrfont{postdot},\xtrfont{stylemods}]\mgroup{glossaries-extra}
+\end{alltt}
+As with earlier examples, \gls{convertgls2bib} can be used to
+convert the entry definitions into the required \filetype{bib} format.
+You may prefer to split the entries into separate files according to
+type.\footnote{Requires at least \gls{bib2gls} v2.0.} This is useful
+if you want to reuse a large database of
+entries across multiple documents as it doesn't lock you into using
+a specific glossary. For example:
+\begin{prompt}
+convertgls2bib -{}-split-on-type -{}-preamble-only sampleNtn.tex entries.bib
+\end{prompt}
+This will create a file called \nolinkurl{entries.bib} that contains
+the entries that didn't have a \gloskey{type} assigned in the original
+file, such as:
+\begin{alltt}
+\atentry{entry}\mgroup{gls:set,
+ name = \mgroup{set},
+ description = \mgroup{A collection of distinct objects}
+}
+\end{alltt}
+It will also create a file called \nolinkurl{notation.bib} that
+contains the entries that had the \gloskey{type} set to
+\texttt{notation} in the original file, such as:
+\begin{alltt}
+\atentry{entry}\mgroup{not:set,
+ name = \mgroup{\cs{ensuremath}\mgroup{\cs{mathcal}\mgroup{S}}},
+ description = \mgroup{A \ics*{glspt}\mgroup{gls:set}}
+}
+\end{alltt}
+Note that the \gloskey{type} field has been removed. The above entry
+in the \nolinkurl{notation.bib} file references a term in the
+\nolinkurl{entries.bib} file. It's possible to strip all the
+prefixes from the \filetype{bib} files and get \gls{bib2gls} to
+automatically insert them. In which case, this cross-reference needs
+adjusting to indicate that it's referring to an entry in another
+file. This can be done with one of the special
+\xtrfont{\texttt{ext\meta{n}.}}\ prefixes:
+\begin{alltt}
+\atentry{entry}\mgroup{\strong{set},
+ name = \mgroup{\cs{ensuremath}\mgroup{\cs{mathcal}\mgroup{S}}},
+ description = \mgroup{A \ics*{glspt}\mgroup{\strong{\xtrfont{ext1.}}set}}
+}
+\end{alltt}
+The corresponding term in the \nolinkurl{entries.bib} file is now:
+\begin{alltt}
+\atentry{entry}\mgroup{\strong{set},
+ name = \mgroup{set},
+ description = \mgroup{A collection of distinct objects}
+}
+\end{alltt}
+
+Now you can replace \cs{makeglossaries} with:
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=\mgroup{entries},\strong{\xtrfont{label-prefix}=\mgroup{gls:}}]
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=\mgroup{notation},\resourceopt{type}=notation,
+ \strong{\xtrfont{label-prefix}=\mgroup{not:},\xtrfont{ext-prefixes}=\mgroup{gls:}}]
+\end{alltt}
+Remove all the \cs{newglossaryentry} definitions and replace \cs{printglossaries} with
+\ics*{printunsrtglossaries}.
+
+Regardless of how many resource sets the document contains, only one
+\gls{bib2gls} call is required:
+\begin{prompt}
+pdflatex sampleNtn
+bib2gls sampleNtn
+pdflatex sampleNtn
+\end{prompt}
+
+You may notice that the ordering in the notations list has changed
+from the original. This is because the \gloskey{sort} field was
+automatically removed by \gls{convertgls2bib}, so the entries are
+now sorted according to the \gloskey{name} field (since they are
+defined with \atentry{entry}). You can use your text editor's search
+and replace function to replace all instances of \atentry{entry}
+with \atentry{symbol} in the \nolinkurl{notations.bib} file so that,
+for example, the \texttt{set} definition becomes:
+\begin{alltt}
+\strong{\atentry{symbol}}\mgroup{set,
+ name = \mgroup{\cs{ensuremath}\mgroup{\cs{mathcal}\mgroup{S}}},
+ description = \mgroup{A \ics*{glspt}\mgroup{\xtrfont{ext1.}set}}
+}
+\end{alltt}
+Now these \atentry{symbol} entries will be sorted according to their
+label. (The original label in the \filetype{bib} file, not the
+prefixed label.) This will put them in the same order as the original
+document. (See the \qt{Examples} chapter of
+the \gls{bib2gls} user manual for examples of varying the sorting
+and also \bibglsgallery{sorting}.)
+
+\exitem{-dual} This document
+illustrates how to define an entry that both appears in the list of
+acronyms and in the main glossary. To create the document do:
+\begin{prompt}
+pdflatex sample-dual
+makeglossaries sample-dual
+pdflatex sample-dual
+\end{prompt}
+This defines a custom command \ics{newdualentry} that defines two entries at once (a
+normal entry and an abbreviation). It uses \ics{glsadd} to ensure
+that if one is used then the other is automatically indexed:
+\begin{verbatim}
+\newcommand*{\newdualentry}[5][]{%
+ % main entry:
+ \newglossaryentry{main-#2}{name={#4},%
+ text={#3\glsadd{#2}},%
+ description={#5},%
+ #1% additional options for main entry
+ }%
+ % abbreviation:
+ \newacronym{#2}{#3\glsadd{main-#2}}{#4}%
+}
+\end{verbatim}
+A sample dual entry is defined with this command:
+\begin{verbatim}
+\newdualentry{svm}% label
+ {SVM}% abbreviation
+ {support vector machine}% long form
+ {Statistical pattern recognition technique}% description
+\end{verbatim}
+This defines an acronym with the label \texttt{svm} that can be
+referenced with \verb|\gls{svm}| but it also defines an entry with
+the label \texttt{main-svm}. This isn't used in the document with
+\cs{gls} but it's automatically added from the
+\texttt{\cs{glsadd}\mgroup{main-svm}} in the short form of
+\texttt{svm}.
+
+For this trivial document, this kind of dual entry is redundant and
+unnecessarily leads the reader down a trail, first to the list of
+acronyms and from there the reader then has to go to the main
+glossary to look up the description. It's better to simply include
+the description in the list of acronyms.
+
+\bibglsnote
+If you want to switch over to \gls{bib2gls}, first change to
+\gls{glossaries-extra}:
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{record}},\xtrfont{postdot},\xtrfont{stylemods},acronym]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+Next, the definition needs to be converted to the \filetype{bib}
+format required by \gls{bib2gls}. If you do:
+\begin{prompt}
+convertgls2bib -{}-preamble-only sample-dual.tex entries.bib
+\end{prompt}
+then \gls{convertgls2bib} will report the following:
+\begin{verbatim}
+Overriding default definition of \newdualentry with custom
+definition. (Change \newcommand to \providecommand if you want
+\newdualentry[options]{label}{short}{long}{description}
+converted to @dualabbreviationentry.)
+\end{verbatim}
+This is because \gls{convertgls2bib} has its own internal definition
+of \cs{newdualentry}, but if it encounters a new definition that
+will override its default. If you want to retain
+\gls{convertgls2bib}['s] definition (recommended) then just replace
+\cs{newcommand} with \cs{providecommand} in the document source and
+rerun \gls{convertgls2bib}.
+
+With \cs{providecommand}, the new \nolinkurl{entries.bib} file
+created by \gls{convertgls2bib} contains:
+\begin{alltt}
+\atentry{dualabbreviationentry}\mgroup{svm,
+ short = \mgroup{SVM},
+ description = \mgroup{Statistical pattern recognition technique},
+ long = \mgroup{support vector machine}
+}
+\end{alltt}
+If \cs{newcommand} is retained, it will instead contain:
+\begin{alltt}
+\atentry{entry}\mgroup{main-svm,
+ name = \mgroup{support vector machine},
+ description = \mgroup{Statistical pattern recognition technique},
+ text = \mgroup{SVM\cs{glsadd}\mgroup{svm}}
+}
+
+\atentry{acronym}\mgroup{svm,
+ short = \mgroup{SVM\cs{glsadd}\mgroup{main-svm}},
+ long = \mgroup{support vector machine}
+}
+\end{alltt}
+In the first case, \gls{bib2gls} creates two linked entries using
+its primary-dual mechanism. In the second case, \gls{bib2gls}
+creates two entries that simply reference each other.
+
+Assuming that your \nolinkurl{entries.bib} file just contains
+\atentry{dualabbreviationentry},
+now replace \cs{makeglossaries} with:
+\begin{alltt}
+\cs{GlsXtrLoadResources}[\resourceopt{src}=entries,\% entries.bib
+ \resourceopt{type}=acronym,\resourceopt{dual-type}=main,\resourceopt{dual-prefix}=\mgroup{main-}]
+\end{alltt}
+
+Then remove the definition of \cs{newdualentry} and the entry
+definition. Finally, replace \cs{printglossaries} with
+\ics*{printunsrtglossaries}.
+The document build is:
+\begin{prompt}
+pdflatex sample-dual
+bib2gls sample-dual
+pdflatex sample-dual
+\end{prompt}
+
+If, instead, your \nolinkurl{entries.bib} file contains separate
+\atentry{entry} and \atentry{acronym}, then you need:
+\begin{alltt}
+\ics*{setabbreviationstyle}[acronym]\mgroup{long-short}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries]
+\end{alltt}
+If you need \glspl{numberlist}, the document build is now
+\begin{prompt}
+pdflatex sample-dual
+bib2gls sample-dual
+pdflatex sample-dual
+bib2gls sample-dual
+pdflatex sample-dual
+\end{prompt}
+and this time \gls{bib2gls} complains about the use of \ics{glsadd}
+within the \gloskey{short} and \gloskey{text} fields as this can be
+problematic. (The extra \gls{bib2gls} and \LaTeX\ calls are
+to ensure the \gls{numberlist} is up to date for the
+\texttt{main-svm} entry, which can only be indexed with \cs{glsadd}
+after \texttt{svm} has been defined.)
+
+Dual entries make much more sense when one entry is for a glossary
+with the description displayed but no \gls{numberlist}, and the
+other is for the index without the description but with a
+\gls{numberlist}. This can be created with by replacing
+\atentry{dualabbreviationentry} with \atentry{dualindexabbreviation}:
+\begin{alltt}
+\atentry{dualindexabbreviation}\mgroup{svm,
+ description = \mgroup{Statistical pattern recognition technique},
+ short = \mgroup{SVM},
+ long = \mgroup{support vector machine}
+}
+\end{alltt}
+This can be mixed with \atentry{index} terms for example:
+\begin{alltt}
+\atentry{index}\mgroup{machlearn,
+ name=\mgroup{machine learning}
+}
+\end{alltt}
+The document needs modifying:
+\begin{alltt}
+\cs{documentclass}\mgroup{article}
+
+\ics{usepackage}[\xtrfont{record},\xtrfont{postdot},
+ nostyles,\xtrfont{stylemods}=\mgroup{\xtrfont{bookindex},list},\% only want bookindex and list styles
+ acronym]\mgroup{glossaries-extra}
+
+\ics*{setabbreviationstyle}\mgroup{long-short-desc}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,\% entries.bib
+ \resourceopt{dual-type}=acronym,
+ \xtrfont{label-prefix}=\mgroup{\strong{idx.}},\resourceopt{dual-prefix}=\mgroup{},
+ \resourceopt{combine-dual-locations}=\mgroup{primary}]
+
+\ics*{glsxtrnewglslike}\mgroup{\strong{idx.}}\mgroup{\strong{\cs{idx}}}\mgroup{\cs{idxpl}}\mgroup{\cs{Idx}}\mgroup{\cs{Idxpl}}
+
+\cs{begin}\mgroup{document}
+\cs{gls}\mgroup{svm} and \strong{\cs{idx}}\mgroup{machlearn}.
+
+\ics*{printunsrtglossary}[type=\acronymtype,style=altlist]
+\ics*{printunsrtglossary}[style=bookindex,title=\mgroup{Index}]
+\cs{end}\mgroup{document}
+\end{alltt}
+See the \gls{bib2gls} manual for further details.
+
+\exitem{-langdict} This document
+illustrates how to use the glossaries package to create English
+to French and French to English dictionaries. To create the document
+do:
+\begin{prompt}
+pdflatex sample-langdict
+makeglossaries sample-langdict
+pdflatex sample-langdict
+\end{prompt}
+This example uses the \pkgopt{nomain} package option to prevent the
+creation of the \texttt{main} glossary. This means that the document
+must provide its own glossaries:
+\begin{verbatim}
+\newglossary[glg]{english}{gls}{glo}{English to French}
+\newglossary[flg]{french}{flx}{flo}{French to English}
+\end{verbatim}
+This means that if you want to call \gls{makeindex} explicitly
+you need to take these new extensions into account:
+\begin{prompt}
+makeindex -s sample-langdict.ist -t sample-langdict.glg -o sample-langdict.gls sample-langdict.glo
+makeindex -s sample-langdict.ist -t sample-langdict.flg -o sample-langdict.flx sample-langdict.flo
+\end{prompt}
+As with the previous example, this document provides a custom
+command that defines two related entries:
+\begin{verbatim}
+\newcommand*{\newword}[4]{%
+ \newglossaryentry{en-#1}{type=english,name={#2},description={#3 #4}}%
+ \newglossaryentry{fr-#1}{type=french,name={#3 #4},text={#4},sort={#4},
+ description={#2}}%
+}
+\end{verbatim}
+This has the syntax:
+\begin{alltt}
+\cs{newword}\marg{label}\marg{english}\marg{determiner}\marg{french}
+\end{alltt}
+(Note that this trivial example doesn't take plurals into account.)
+This custom command will define two terms with labels \texttt{en-\meta{label}} (for
+the English term) and \texttt{fr-\meta{label}} (for the French term).
+So
+\begin{verbatim}
+\newword{cat}{cat}{le}{chat}
+\end{verbatim}
+is equivalent to:
+\begin{verbatim}
+\newglossaryentry{en-cat}{type=english,name={cat},description={le chat}}
+\newglossaryentry{fr-cat}{type=french,name={le chat},sort={chat},
+ description={cat}}
+\end{verbatim}
+
+Unlike the previous example (\samplefile{-dual}), there's no link
+between these two entries. If the document only uses
+\verb|\gls{en-cat}|, then the \texttt{en-cat} entry will appear in the
+\texttt{english} glossary but the \texttt{fr-cat} entry won't
+appear in the \texttt{french} one.
+
+\bibglsnote
+If you want to switch to \gls{bib2gls} then you first need to
+convert the document so that it uses \gls{glossaries-extra}, but
+include the \pkgopt*{prefix} option to ensure that
+\sty{glossaries-prefix} is also loaded:
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{record},\xtrfont{prefix}},\xtrfont{postdot},\xtrfont{stylemods},nomain]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+You don't need to worry about file extensions now, so it's simpler
+to use the starred form of \cs{newglossary}:
+\begin{alltt}
+\cs{newglossary}\strong{*}\mgroup{english}\mgroup{English to French}
+\cs{newglossary}\strong{*}\mgroup{french}\mgroup{French to English}
+\end{alltt}
+Next the entries need to be converted to the \filetype{bib} format
+required by \gls{bib2gls}:
+\begin{prompt}
+convertgls2bib -{}-only-preamble sample-langdict.tex entries.bib
+\end{prompt}
+This creates the file \nolinkurl{entries.bib} that contains entries
+defined like:
+\begin{alltt}
+\atentry{entry}\mgroup{en-cat,
+ name = \mgroup{cat},
+ description = \mgroup{le chat},
+ type = \mgroup{english}
+}
+
+\atentry{entry}\mgroup{fr-cat,
+ name = \mgroup{le chat},
+ description = \mgroup{cat},
+ text = \mgroup{chat},
+ type = \mgroup{french}
+}
+\end{alltt}
+(Note that the \gloskey{sort} field has been omitted.)
+
+This would be more flexible, and much briefer, if these entries were
+defined using \gls{bib2gls}['s] dual entry system combined with the
+\sty{glossaries-prefix} package:
+\begin{alltt}
+\atentry{dualentry}\mgroup{cat,
+ name = \mgroup{chat},
+ description = \mgroup{cat},
+ \gloskey{prefix} = \mgroup{le},
+ \gloskey{prefixplural} = \mgroup{les}
+}
+\end{alltt}
+Similarly for the \qt{chair} entry:
+\begin{alltt}
+\atentry{dualentry}\mgroup{chair,
+ name = \mgroup{chaise},
+ description = \mgroup{chair},
+ \gloskey{prefix} = \mgroup{la},
+ \gloskey{prefixplural} = \mgroup{les}
+}
+\end{alltt}
+
+With \atentry{dualentry}, the English and French terms are now
+automatically linked from \gls{bib2gls}['s] point of view. If only one
+is referenced in the document, the other will also be added by default.
+
+Now that the determiner has been moved out of the description, it
+won't show in the glossary. However, it's possible to include it by
+providing a command to encapsulate the description (which can also
+apply the language change as well).
+
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,\% entries.bib
+ \xtrfont{append-prefix-field}=\mgroup{space},
+ \resourceopt{category}=\mgroup{same as type},\resourceopt{dual-category}=\mgroup{same as type},
+ \xtrfont{label-prefix}=\mgroup{en-},\resourceopt{dual-prefix}=\mgroup{fr-},
+ \resourceopt{type}=english,\resourceopt{dual-type}=french,
+ \resourceopt{sort}=en,\resourceopt{dual-sort}=fr]
+
+\cs{newcommand}\mgroup{\cs{FrEncap}}[1]\mgroup{\%
+ \ics{foreignlanguage}\mgroup{french}\mgroup{\ics{glsentryprefix}\mgroup{\ics{glscurrententrylabel}}\#1}}
+\cs{newcommand}\mgroup{\cs{EnEncap}}[1]\mgroup{\ics{foreignlanguage}\mgroup{english}\mgroup{\#1}}
+
+\ics*{glssetcategoryattribute}\mgroup{english}\mgroup{glossnamefont}\mgroup{EnEncap}
+\ics*{glssetcategoryattribute}\mgroup{english}\mgroup{glossdescfont}\mgroup{FrEncap}
+\ics*{glssetcategoryattribute}\mgroup{french}\mgroup{glossnamefont}\mgroup{FrEncap}
+\ics*{glssetcategoryattribute}\mgroup{french}\mgroup{glossdescfont}\mgroup{EnEncap}
+\end{alltt}
+
+Remember to remove \cs{makeglossaries}, the definition of \cs{newword} and
+the entry definitions from the document preamble, and
+replace \cs{printglossary} with:
+\begin{alltt}
+\ics*{printunsrtglossary}
+\end{alltt}
+
+Other refinements that you might like to make include using
+\ics*{glsxtrnewglslike} so you don't have to worry about the label
+prefix (\qt{en-} and \qt{fr-}).
+
+\exitem{-index} This document uses
+the \styfmt{glossaries} package to create both a glossary and an
+index. This requires two \gls{makeglossaries} (or
+\gls{makeglossaries-lite.lua}) calls to ensure the
+document is up to date:
+\begin{prompt}
+pdflatex sample-index
+makeglossaries sample-index
+pdflatex sample-index
+makeglossaries sample-index
+pdflatex sample-index
+\end{prompt}
+
+\section{Sorting}
+\label{sec:samplessort}
+
+\exitem{People} This document illustrates how you can hook into the
+standard sort mechanism to adjust the way the sort key is set. This
+requires an additional run to ensure the table of contents is
+up-to-date:
+\begin{prompt}
+pdflatex samplePeople
+makeglossaries samplePeople
+pdflatex samplePeople
+pdflatex samplePeople
+\end{prompt}
+This provides two commands for typesetting a name:
+\begin{verbatim}
+\newcommand{\sortname}[2]{#2, #1}
+\newcommand{\textname}[2]{#1 #2}
+\end{verbatim}
+where the first argument contains the forenames and the second is the
+surname. The first command is the one required for sorting the name
+and the second is the one required for displaying the name in the
+document. A synonym is then defined:
+\begin{verbatim}
+\let\name\textname
+\end{verbatim}
+This command defaults to the display name command (\cs{textname})
+but is temporarily redefined to the sort name command (\cs{sortname})
+within the \gloskey{sort} field assignment hook:
+\begin{alltt}
+\cs{renewcommand}\mgroup{\ics{glsprestandardsort}}[3]\mgroup{\%
+ \strong{\cs{let}\cs{name}\cs{sortname}}
+ \cs{edef}\#1\mgroup{\cs{expandafter}\cs{expandonce}\cs{expandafter}\mgroup{#1}}\%
+ \strong{\cs{let}\cs{name}\cs{textname}}
+ \ics{glsdosanitizesort}
+}
+\end{alltt}
+The people are defined using the custom \cs{name} command:
+\begin{alltt}
+\cs{newglossaryentry}\mgroup{joebloggs}\mgroup{name=\mgroup{\strong{\cs{name}}\mgroup{Joe}\mgroup{Bloggs}},
+ description=\mgroup{\cs{nopostdesc}}}
+\end{alltt}
+Since \cs{name} is temporarily changed while the \gloskey{sort} key
+is being assigned, the sort value for this entry ends up as
+\qt{Bloggs, Joe}, but the name appears in the document as \qt{Joe Bloggs}.
+
+\bibglsnote
+If you want to use \gls{bib2gls}, you first need to convert the
+document to use \gls{glossaries-extra} but make sure you include the
+\pkgopt*{record} option:
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{record}},\xtrfont{stylemods},style=listgroup]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+Next it's necessary to convert the entry definitions to the
+\filetype{bib} format required by \gls{bib2gls}. You can simply do:
+\begin{prompt}
+convertgls2bib -{}-preamble-only samplePeople people.bib
+\end{prompt}
+which will create a file called \nolinkurl{people.bib} that contains
+definitions like:
+\begin{alltt}
+\atentry{entry}\mgroup{joebloggs,
+ name = \mgroup{\cs{name}\mgroup{Joe}\mgroup{Bloggs}},
+ description = \mgroup{\ics{nopostdesc}}
+}
+\end{alltt}
+However, you may prefer to use the \texttt{-{}-index-conversion}
+(\texttt{-i}) switch:
+\begin{prompt}
+convertgls2bib -i -{}-preamble-only samplePeople people.bib
+\end{prompt}
+This will discard the \gloskey{description} field and use
+\atentry{index} instead of \atentry{entry} if the
+\gloskey{description} is either empty or simply set to \ics{nopostdesc} or
+\ics*{glsxtrnopostpunc}. The \nolinkurl{people.bib} file now
+contains definitions like:
+\begin{alltt}
+\atentry{index}\mgroup{joebloggs,
+ name = \mgroup{\cs{name}\mgroup{Joe}\mgroup{Bloggs}}
+}
+\end{alltt}
+Regardless of which approach you used to create the \filetype{bib}
+file, you now need to edit it to provide a definition of the custom
+\cs{name} command for \gls{bib2gls}['s] use:
+\begin{alltt}
+\atentry{preamble}\mgroup{"\strong{\ics{providecommand}}\mgroup{\cs{name}}[2]\mgroup{\#2, \#1}"}
+\end{alltt}
+Note the use of \cs{providecommand} instead of \cs{newcommand}.
+
+In the document (\nolinkurl{samplePeople.tex}) you now need to
+delete \cs{makeglossaries}, the definitions of \cs{sortname},
+\cs{textname}, \cs{name}, \cs{glsprestandardsort}, and all the entry
+definitions. Then add the following to the document preamble:
+\begin{alltt}
+\cs{newcommand}\mgroup{\cs{name}}[2]\mgroup{\#1 \#2}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=people]
+\end{alltt}
+Next, use your text editor's search and replace function to
+subsitute all instances of \cs{glsentrytext} in the chapter
+headings with \ics*{glsfmttext}. For example:
+\begin{alltt}
+\ics{chapter}\mgroup{\strong{\ics*{glsfmttext}}\mgroup{joebloggs}}
+\end{alltt}
+Finally, replace \cs{printunsrtglossaries} with:
+\begin{alltt}
+\ics*{printunsrtglossaries}
+\end{alltt}
+The document build is now:
+\begin{prompt}
+pdflatex samplePeople
+bib2gls samplePeople
+pdflatex samplePeople
+pdflatex samplePeople
+\end{prompt}
+The third \LaTeX\ call is required to ensure that the PDF bookmarks
+are up to date, as the entries aren't defined until after the
+\gls{bib2gls} run (which is why you have to use \ics*{glsfmttext}
+instead of \cs{glsentrytext}).
+
+This again leads to a list sorted by surname. The reason this works
+is because \gls{bib2gls} only sees the definition of \cs{name}
+provided in \atentry{preamble}, but the document uses the definition
+of \cs{name} provided before \cs{GlsXtrLoadResources}. The use of
+\ics{providecommand} in \atentry{preamble} prevents \cs{name} from
+being redefined within the document.
+
+See also the \qt{Examples} chapter of the \gls{bib2gls} user manual,
+which provides another \qt{people} example.
+
+\exitem{Sort} This is another document that illustrates how to hook
+into the standard sort mechanism. An additional run is required to
+ensure the table of contents is up-to-date:
+\begin{prompt}
+pdflatex sampleSort
+makeglossaries sampleSort
+pdflatex sampleSort
+pdflatex sampleSort
+\end{prompt}
+This document has three glossaries (\texttt{main}, \texttt{acronym}
+and a custom \texttt{notation}), so if you want to use
+\gls{makeindex} explicitly you will need to have three
+\gls{makeindex} calls with the appropriate file extensions:
+\begin{prompt}
+pdflatex sampleSort
+makeindex -s sampleSort.ist -t sampleSort.alg -o sampleSort.acr sampleSort.acn
+makeindex -s sampleSort.ist -t sampleSort.glg -o sampleSort.gls sampleSort.glo
+makeindex -s sampleSort.ist -t sampleSort.nlg -o sampleSort.not sampleSort.ntn
+pdflatex sampleSort
+pdflatex sampleSort
+\end{prompt}
+It's much simpler to just use \gls{makeglossaries} or \gls{makeglossaries-lite.lua}.
+
+In this example, the sort hook is adjusted to ensure the list of
+notation is sorted according to the order of definition. A new
+counter is defined to keep track of the entry number:
+\begin{verbatim}
+\newcounter{sortcount}
+\end{verbatim}
+The sort hook is then redefined to increment this counter and assign
+the sort key to that numerical value, but only for the
+\texttt{notation} glossary. The other two glossaries have their sort
+keys assigned as normal:
+\begin{verbatim}
+\renewcommand{\glsprestandardsort}[3]{%
+ \ifdefstring{#2}{notation}%
+ {%
+ \stepcounter{sortcount}%
+ \edef#1{\glssortnumberfmt{\arabic{sortcount}}}%
+ }%
+ {%
+ \glsdosanitizesort
+ }%
+}
+\end{verbatim}
+This means that \gls{makeindex} will sort the notation in numerical order.
+
+\glsxtrnote
+If you want to convert this document to use \gls{glossaries-extra},
+a much simpler approach is available with its hybrid method. First
+change the package loading line to:
+\begin{alltt}
+\cs{usepackage}[\xtrfont{postdot},\xtrfont{stylemods},acronym]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+Either remove \cs{setacronymstyle} and replace all instances of
+\cs{newacronym} with \ics*{newabbreviation} or replace:
+\begin{verbatim}
+\setacronymstyle{long-short}
+\end{verbatim}
+with:
+\begin{alltt}
+\ics*{setabbreviationstyle}[acronym]\mgroup{long-short}
+\end{alltt}
+
+The custom counter and redefinition of \cs{glsprestandardsort} can now
+be removed. The file extensions for the custom \texttt{notation}
+glossary are no longer relevant so the glossary definition can be
+changed to:
+\begin{alltt}
+\cs{newglossary\strong{*}}\mgroup{notation}\mgroup{Notation}
+\end{alltt}
+The \ics{makeglossaries} command now needs to be adjusted to
+indicate which glossaries need to be processed by \gls{makeindex}:
+\begin{alltt}
+\cs{makeglossaries}\strong{[main,acronym]}
+\end{alltt}
+Finally, \ics{printglossaries} needs to be replaced with:
+\begin{alltt}
+\cs{printglossary}
+\cs{printacronyms}
+\cs{print\strong{noidx}glossary}[type=notation\strong{,sort=def}]
+\end{alltt}
+Note that the \texttt{notation} glossary, which hasn't been listed in the optional
+argument of \cs{makeglossaries}, must be displayed with \ics{printnoidxglossary}.
+
+This means that \gls{makeindex} only needs to process the
+\texttt{main} and \texttt{acronym} glossaries. No actual sorting is
+performed for the \texttt{notation} glossary because, when used with
+\printnoidxglosskey[def]{sort}, \cs{printnoidxglossary} simply
+iterates over the list of entries that have been indexed.
+
+The document build doesn't need the third \LaTeX\ call now (since
+none of the glossaries extend beyond a page break):
+\begin{prompt}
+pdflatex sampleSort
+makeglossaries sampleSort
+pdflatex sampleSort
+\end{prompt}
+This time \gls{makeglossaries} will include the message:
+\begin{verbatim}
+only processing subset 'main,acronym'
+\end{verbatim}
+This means that although \gls{makeglossaries} has noticed the \texttt{notation} glossary,
+it will be skipped.
+
+If you are explicitly calling \gls{makeindex} then you need to drop the call
+for the \texttt{notation} glossary:
+\begin{prompt}
+pdflatex sampleSort
+makeindex -s sampleSort.ist -t sampleSort.alg -o sampleSort.acr sampleSort.acn
+makeindex -s sampleSort.ist -t sampleSort.glg -o sampleSort.gls sampleSort.glo
+pdflatex sampleSort
+\end{prompt}
+
+\bibglsnote
+If you prefer to use \gls{bib2gls}, the package loading line needs
+to be changed to:
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{record}},\xtrfont{postdot},\xtrfont{stylemods},acronym]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+Next the entry definitions need to be convert to the \filetype{bib}
+format required by \gls{bib2gls}.
+
+For this example, it's simpler to split the entries into different files according
+to the glossary type. This can be done with the
+\texttt{-{}-split-on-type} or \texttt{-t} switch:
+\begin{prompt}
+convertgls2bib -t -{}-preamble-only sampleSort.tex entries.bib
+\end{prompt}
+This will create three files:
+\begin{description}
+\item[\nolinkurl{entries.bib}] which contains the entries that were
+defined with \ics{newglossaryentry}. For example:
+\begin{alltt}
+\atentry{entry}\mgroup{gls:set,
+ name = {set},
+ description = {A collection of distinct objects}
+}
+\end{alltt}
+
+\item[\nolinkurl{abbreviations.bib}] which contains the entries that
+were defined with \ics{newacronym}. For example:
+\begin{alltt}
+\atentry{acronym}\mgroup{zfc,
+ short = \mgroup{ZFC},
+ long = \mgroup{Zermelo-Fraenkel set theory}
+}
+\end{alltt}
+If you changed \ics{newacronym} to \ics*{newabbreviation} then
+\atentry{abbreviation} will be used instead:
+\begin{alltt}
+\atentry{abbreviation}\mgroup{zfc,
+ short = \mgroup{ZFC},
+ long = \mgroup{Zermelo-Fraenkel set theory}
+}
+\end{alltt}
+
+\item[\nolinkurl{notation.bib}] which contains the entries that were
+defined with \texttt{\gloskey{type}=notation}. For example:
+\begin{alltt}
+\atentry{entry}\mgroup{not:set,
+ name = \mgroup{\$\cs{mathcal}\mgroup{S}\$},
+ description = \mgroup{A set},
+ text = \mgroup{\cs{mathcal}\mgroup{S}}
+}
+\end{alltt}
+You may prefer to replace \atentry{entry} with \atentry{symbol}
+in this file.
+\end{description}
+\emph{After} the definition of the \texttt{notation} glossary
+(\cs{newglossary}), add:
+\begin{alltt}
+\% abbreviation style must be set first:
+\ics*{setabbreviationstyle}[acronym]\mgroup{long-short}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=\mgroup{entries,abbreviations}]
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=\mgroup{notation},\% notation.bib
+ \strong{\xtrfont{type}=notation},\resourceopt{sort}=\strong{unsrt}]
+\end{alltt}
+Delete the remainder of the preamble (\cs{makeglossaries} and entry
+definitions).
+
+Finally, replace the lines that display the glossaries with:
+\begin{alltt}
+\ics*{printunsrtglossaries}
+\end{alltt}
+The build process is now:
+\begin{prompt}
+pdflatex sampleSort
+bib2gls sampleSort
+pdflatex sampleSort
+\end{prompt}
+
+In this case, I have one resource command that processes two
+glossaries (\texttt{main} and \texttt{acronym}) at the same time.
+The entries in these glossaries are ordered alphabetically.
+The second resource command processes the \texttt{notation} glossary but
+the entries in this glossary aren't sorted (and so will appear in
+the order of definition within the \filetype{bib} file).
+
+See also \samplefile{Ntn}, \bibglsgallery{sorting} and the \gls{bib2gls} user manual
+for more examples.
+
+\section{Child Entries}
+\label{sec:samplesparent}
+
+\exitem{} This document illustrates some of
+the basics, including how to create child entries that use the same
+name as the parent entry. This example adds the glossary to the
+table of contents and it also uses \ics{glsrefentry}, so an extra \LaTeX\
+run is required:
+\begin{prompt}
+pdflatex sample
+makeglossaries sample
+pdflatex sample
+pdflatex sample
+\end{prompt}
+You can see the difference between word and letter ordering if you
+add the package option \pkgopt[letter]{order}. (Note
+that this will only have an effect if you use
+\gls{makeglossaries} or \gls{makeglossaries-lite.lua}.
+If you use \gls{makeindex} explicitly, you will need to use the
+\mkidxopt{l} switch to indicate letter ordering.)
+
+One of the entries has its name encapsulated with a semantic command:
+\begin{alltt}
+\cs{newcommand}\mgroup{\strong{\cs{scriptlang}}}[1]\mgroup{\cs{textsf}\mgroup{\#1}}
+
+\cs{newglossaryentry}\mgroup{Perl}\mgroup{name=\strong{\cs{scriptlang}}\mgroup{Perl},\strong{sort=Perl,}
+description=\mgroup{A scripting language}}
+\end{alltt}
+This means that this entry needs to have the \gloskey{sort} key set
+otherwise \gls{makeindex} will assign it to the \qt{symbol} letter
+group, since it starts with a backslash (which \gls{makeindex}
+simply treats as punctuation).
+
+The homograph entries \qt{glossary} and \qt{bravo} are defined as
+sub-entries that inherit the name from the parent entry. The parent
+entry doesn't have a description, but with the default
+\pkgopt[false]{nopostdot} setting this will lead to a spurious dot.
+This can be removed by adding \ics{nopostdesc} to the description,
+which suppresses the post-description hook for that entry.
+
+Since the child entries have the same name as the parent, this means
+that the child entries will have duplicate sort values unless the
+default is changed with the \gloskey{sort} key:
+\begin{alltt}
+\cs{newglossaryentry}\mgroup{glossary}\mgroup{name=glossary,
+ description=\mgroup{\strong{\ics{nopostdesc}}},plural=\mgroup{glossaries}}
+
+\ics{newglossaryentry}\mgroup{glossarycol}\mgroup{
+ description=\mgroup{collection of glosses},
+ \strong{sort=\mgroup{2},}
+ parent=\mgroup{glossary}\% parent \emph{label}
+}
+
+\cs{newglossaryentry}\mgroup{glossarylist}\mgroup{
+ description=\mgroup{list of technical words},
+ \strong{sort=\mgroup{1},}
+ parent=\mgroup{glossary}\% parent \emph{label}
+}
+\end{alltt}
+(Remember that the entries are sorted hierarchically.) This will
+place \texttt{glossarylist} before \texttt{glossarycol}, but both
+will come immediately after their parent \texttt{glossary} entry.
+
+\glsxtrnote
+If you switch to using \gls{glossaries-extra}, remember that the
+default package options are different:
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{postdot},\xtrfont{stylemods}},style=treenonamegroup,order=word,
+ subentrycounter]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+
+You may now want to consider replacing \ics{nopostdesc} in the
+descriptions with \ics*{glsxtrnopostpunc} (using your
+text editor's search and replace function). This suppresses the
+post-description punctuation but not the category post-description
+hook.
+
+You may have noticed that some of the descriptions include the
+plural form, but it's not done very consistently. For example:
+\begin{verbatim}
+\newglossaryentry{cow}{name=cow,
+ plural=cows,% not required as this is the default
+ user1=kine,
+ description={(\emph{pl.}\ cows, \emph{archaic} kine) an adult
+female of any bovine animal}
+}
+\end{verbatim}
+which has the parenthetical material at the start of the
+description with emphasis,
+\begin{verbatim}
+\newglossaryentry{bravocry}{
+ description={cry of approval (pl.\ bravos)},
+ sort={1},
+ parent={bravo}
+}
+\end{verbatim}
+which has the parenthetical material at the end of the
+description without emphasis even though it's a regular plural,
+\begin{verbatim}
+\newglossaryentry{bravoruffian}{
+ description={hired ruffian or killer (pl.\ bravoes)},
+ sort={2},
+ plural={bravoes},
+ parent=bravo}
+\end{verbatim}
+which has the parenthetical material at the end of the
+description without emphasis, and
+\begin{verbatim}
+\newglossaryentry{glossary}{name=glossary,
+ description={\nopostdesc},
+ plural={glossaries}}
+\end{verbatim}
+which doesn't show the plural in the description.
+
+With \gls{glossaries-extra}, you can remove this parenthetical
+material and implement it using the category post-description hook instead.
+For example, the above definitions become:
+\begin{verbatim}
+\newglossaryentry{cow}{name=cow,
+ user1=kine,
+ description={an adult female of any bovine animal}
+}
+
+\newglossaryentry{bravocry}{
+ description={cry of approval},
+ sort={1},
+ parent={bravo}
+}
+
+\newglossaryentry{bravoruffian}{
+ description={hired ruffian or killer},
+ sort={2},
+ plural={bravoes},
+ parent=bravo}
+\end{verbatim}
+\begin{alltt}
+\cs{newglossaryentry}\mgroup{glossary}\mgroup{name=glossary,
+ description=\mgroup{\strong{\ics*{glsxtrnopostpunc}}},
+ plural=\mgroup{glossaries}}
+\end{alltt}
+The post-description hook for the \cat{general} category can now be
+set:
+\begin{alltt}
+\ics*{glsdefpostdesc}\mgroup{general}\mgroup{\%
+\codecomment{\% Has the user1 key been set?}
+ \ics*{glsxtrifhasfield}\mgroup{useri}\mgroup{\ics{glscurrententrylabel}}\%
+ \mgroup{\cs{space}(\cs{emph}\mgroup{pl.}\cs{ }\ics{glsentryplural}\mgroup{\ics{glscurrententrylabel}},
+ \cs{emph}\mgroup{archaic} \ics{glscurrentfieldvalue})\%
+ }\%
+ \mgroup{\%
+\codecomment{\% The user1 key hasn't been set. Is the plural the same as the
+\% singular form with the plural suffix appended?}
+ \ics*{GlsXtrIfXpFieldEqXpStr}\mgroup{plural}\mgroup{\ics{glscurrententrylabel}}\%
+ \mgroup{\ics{glsentrytext}\mgroup{\ics{glscurrententrylabel}}\ics{glspluralsuffix}}\%
+ \mgroup{\%
+\codecomment{\% Sibling check with \gls{bib2gls} (see below)}
+ }\%
+ \mgroup{\%
+\codecomment{\% The plural isn't the default. Does this entry have a parent?}
+ \cs{ifglshasparent}\mgroup{\cs{glscurrententrylabel}}%
+ \mgroup{\%
+\codecomment{\% This entry has a parent.
+\% Are the plurals for the child and parent the same?}
+ \ics*{GlsXtrIfXpFieldEqXpStr}\mgroup{plural}\mgroup{\cs{glscurrententrylabel}}\%
+ \mgroup{\cs{glsentryplural}\mgroup{\cs{glsentryparent}\mgroup{\cs{glscurrententrylabel}}}}\%
+ \mgroup{}\% \codecomment{child and parent plurals the same}
+ \mgroup{\%
+ \cs{space}(\cs{emph}\mgroup{pl.}\cs{ }\cs{glsentryplural}\mgroup{\cs{glscurrententrylabel}})\%
+ }\%
+ }%
+ \mgroup{\cs{space}(\cs{emph}\mgroup{pl.}\cs{ }\ics{glsentryplural}\mgroup{\ics{glscurrententrylabel}})}\%
+ }\%
+ }\%
+}
+\end{alltt}
+(If you try this example out, notice the difference for the
+\texttt{glossary} entry if you use \cs{nopostdesc} and then
+replace it with \ics*{glsxtrnopostpunc}.)
+See the \gls{glossaries-extra} user manual for further details and
+also \bibglsbegin.
+
+The \qt{bravo} homographs are an oddity where the singular form is
+identical but the plural is different (\qt{bravos} and
+\qt{bravoes}). In the original, both descriptions included the
+plural term. The above modifications drop the display of the regular
+\qt{bravos} plural (for the \texttt{bravocry} term) and only show
+the \qt{bravoes} plural (for the \texttt{bravoruffian} term). In this
+particular case it might be useful to show the regular plural in
+order to highlight the difference.
+
+While it's straightforward to access an entry's parent label (with
+\ics{glsentryparent}) it's much harder to access entry's children or
+siblings. The \ics{ifglshaschildren} command has to iterate over all
+entries to determine if any have a parent that matches the given
+label. This is obviously very time-consuming if you have a large
+database of entries. It also doesn't provide a way of determining
+whether or not the child entries have been indexed.
+
+With \gls{bib2gls}, it's possible to save this information with the
+\resourceopt{save-child-count} and \resourceopt{save-sibling-count},
+which not only save the total but also save the child or sibling
+labels in an \sty{etoolbox} internal list. This makes the
+information much faster to access and also only includes the labels of
+those entries that have actually been indexed.
+
+In the above, the comment line:
+\begin{alltt}
+\codecomment{\% Sibling check with \gls{bib2gls} (see below)}
+\end{alltt}
+indicates where to put the extra code. If you switch to
+\gls{bib2gls} and make sure to use \resourceopt{save-sibling-count}
+then you can insert the following code in the block above where that
+comment is:
+\begin{alltt}
+\ics*{GlsXtrIfFieldNonZero}\mgroup{siblingcount}\mgroup{\cs{glscurrententrylabel}}\%
+\mgroup{\% \codecomment{\xtrfield{siblingcount} field value non-zero}
+ \ics*{glsxtrfieldforlistloop} \% \codecomment{iterate over internal list}
+ \mgroup{\cs{glscurrententrylabel}}\% \codecomment{entry label}
+ \mgroup{siblinglist}\% \codecomment{label of field containing list}
+ \mgroup{\cs{siblinghandler}}\% \codecomment{loop handler}
+}\%
+\mgroup{}\% \codecomment{\xtrfield{siblingcount} field value 0 or empty or missing}
+\end{alltt}
+This uses a custom handler that's defined as follows:
+\begin{alltt}
+\cs{newcommand}\mgroup{\cs{siblinghandler}}[1]\mgroup{\%
+ \ics*{GlsXtrIfXpFieldEqXpStr}*\mgroup{plural}\mgroup{\cs{glscurrententrylabel}}\%
+ \mgroup{\cs{glsentryplural}\mgroup{\#1}}\%
+ \mgroup{}\% \codecomment{current entry's plural same as sibling's plural}
+ \mgroup{\%
+ \cs{space}(\cs{emph}\mgroup{pl.}\cs{ }\cs{glsentryplural}\mgroup{\cs{glscurrententrylabel}})\%
+ \ics{listbreak}
+ }%
+}
+\end{alltt}
+The \cs{listbreak} command is provided by \sty{etoolbox} and is used
+for prematurely exiting a loop. The handler tests if the sibling's
+\gloskey{plural} field is identical to the current entry's \gloskey{plural}
+field. If they are the same, it does nothing. If they are different,
+it displays the current entry's plural and breaks the loop.
+
+Note that this assumes that the parent entry hasn't had the plural
+form explicitly set to \qt{bravoes} instead of the default
+\qt{bravos}. In that case, the parent entry would show the plural
+but the \texttt{bravoruffian} child entry wouldn't show the plural (since
+this case would led to the empty code block identified with the
+comment \qt{child and parent plurals the same}). The \qt{bravoes}
+plural form would instead be shown for the parent, which wouldn't
+look right.
+
+If you don't use \gls{bib2gls} or if you use it without the
+\resourceopt{save-sibling-count} resource option then the sibling
+information won't be available.
+
+\bibglsnote
+In order to switch to using \gls{bib2gls}, it's first necessary to
+switch to using \gls{glossaries-extra} (as above). Remember that the
+\pkgopt*{record} option is required:
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{record},}\xtrfont{postdot},\xtrfont{stylemods},style=treenonamegroup,
+subentrycounter]\mgroup{glossaries-extra}
+\end{alltt}
+Next the entry definitions need to be converted to the
+\filetype{bib} format required by \gls{bib2gls}. This can be done
+with \gls{convertgls2bib}:
+\begin{alltt}
+convertgls2bib -{}-preamble-only sample.tex entries.
+\end{alltt}
+The semantic command may be moved to the \filetype{bib} file to
+ensure it's defined:
+\begin{alltt}
+\atentry{preamble}\mgroup{"\cs{providecommand}\mgroup{\cs{scriptlang}}[1]\mgroup{\cs{textsf}\mgroup{\#1}}"}
+\end{alltt}
+
+The \gloskey{sort} field typically shouldn't be set when using
+\gls{bib2gls}, so \gls{convertgls2bib} strips it.
+If the \gloskey{sort} field is missing, \gls{bib2gls} will obtain it
+from the sort fallback for that entry type. In this case,
+\atentry{entry} has the \gloskey{name} field as the sort fallback.
+If this is also missing then its value is obtained from the parent's
+\gloskey{name} field (see \bibglsgallery{sorting} for other examples).
+
+Therefore the \qt{Perl} entry is simply defined as:
+\begin{alltt}
+\atentry{entry}\mgroup{Perl,
+ name = \mgroup{\cs{scriptlang}\mgroup{Perl}},
+ description = \mgroup{A scripting language}
+}
+\end{alltt}
+This isn't a problem for \gls{bib2gls}. In this case, the command
+has been provided in the \atentry{preamble}, but \gls{bib2gls}
+strips font information so the sort value becomes \texttt{Perl}.
+If the definition isn't placed in \atentry{preamble} then
+\gls{bib2gls} will simply ignore the command (as \gls{xindy} does)
+so the sort value will still end up as \texttt{Perl}.
+
+The homograph entries have also had their \gloskey{sort} fields omitted:
+\begin{alltt}
+\atentry{entry}\mgroup{glossarycol,
+ parent = \mgroup{glossary},
+ description = \mgroup{collection of glosses}
+}
+
+\atentry{entry}\mgroup{glossarylist,
+ parent = \mgroup{glossary},
+ description = \mgroup{list of technical words}
+}
+\end{alltt}
+
+This means that the sort value for both these child entries is
+\qt{glossary}. When \gls{bib2gls} encounters identical sort values
+it acts according to its \resourceopt{identical-sort-action} setting.
+The default action is to sort by the label using a simple string
+comparison. In this case, it would put \texttt{glossarycol} before
+\texttt{glossarylist}. In the original document, the \gloskey{sort}
+value was manually chosen to ensure that the entries are ordered
+according to \gls{firstuse}. This ordering can easily be obtained
+by changing \gls{bib2gls}['s] identical sort action (requires at
+least \gls{bib2gls} v2.0):
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=\mgroup{entries},\strong{\xtrfont{identical-sort-action}=use}]
+\end{alltt}
+This command should replace \cs{makeglossaries}. If you want the
+sibling information (see earlier), then you need to remember to add
+\resourceopt{save-sibling-count} to the list of options.
+
+Note that this is a better solution than in the original example. If
+I edit the document so that \texttt{glossarycol} is used first, then
+the ordering will be updated accordingly, but with the original
+example, the \gloskey{sort} keys would need to be manually changed.
+
+The remainder of the preamble (that is, the definition of
+\cs{scriptlang} and all the entry definitions) should now be
+removed.
+
+Finally, replace \cs{printglossaries} with \ics*{printunsrtglossaries}.
+The document build is now:
+\begin{prompt}
+pdflatex sample
+bib2gls -{}-group sample
+pdflatex sample
+pdflatex sample
+\end{prompt}
+Note use of the \bibglslongopt{group} (or \bibglsopt{g}) switch, which is needed
+to support the \glostyle{treenonamegroup} style. The third \LaTeX\
+call is needed because the document contains \ics{glsrefentry}.
+
+Note that you can't use the \pkgopt[letter]{order} package option
+with \gls{bib2gls}. Instead use the \resourceopt[none]{break-at}
+resource option:
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=\mgroup{entries},\xtrfont{identical-sort-action}=use,
+ \strong{\xtrfont{break-at}=none}
+]
+\end{alltt}
+
+\exitem{-inline} This document is
+like \texttt{sample.tex}, above, but uses the \glostyle{inline}
+glossary style to put the glossary in a footnote. The document build
+is:
+\begin{prompt}
+pdflatex sample-inline
+makeglossaries sample-inline
+pdflatex sample-inline
+pdflatex sample-inline
+\end{prompt}
+If you want to convert this document to \gls{glossaries-extra},
+follow the same procedure as above. If you want to use \gls{bib2gls}
+then you don't need the \bibglslongopt{group} switch since no letter
+groups are required.
+
+\exitem{tree} This document illustrates
+a hierarchical glossary structure where child entries have different
+names to their corresponding parent entry. To create the document
+do:
+\begin{prompt}
+pdflatex sampletree
+makeglossaries sampletree
+pdflatex sampletree
+\end{prompt}
+The document uses the \glostyle{alttreehypergroup} glossary style,
+which needs to know the widest name for each hierarchical level.
+This has been assigned manually in the preamble with
+\ics{glssetwidest}:
+\begin{verbatim}
+\glssetwidest{Roman letters} % level 0 widest name
+\glssetwidest[1]{Sigma} % level 1 widest name
+\end{verbatim}
+(Level~0 is the top-most level. That is, entries that don't have a
+parent.) It's possible to get \styfmt{glossaries} to compute the
+widest top-level entry with \ics{glsfindwidesttoplevelname} but this
+will iterate over all top-level entries, regardless of whether or
+not they appear in the glossary. If you have a large database of
+entries, this will firstly take time and secondly the width may be
+too large due to an unindexed entry with a big name.
+
+This sample document doesn't require any of the tabular styles so I've
+prevented those packages from being loaded with \pkgopt{nolong} and
+\pkgopt{nosuper}. The reduces the overall package loading.
+\begin{alltt}
+\cs{usepackage}[style=alttreehypergroup,\strong{nolong,nosuper}]
+\mgroup{glossaries}
+\end{alltt}
+(This example glossary is actually better suited for one of the
+topic styles provided with \sty*{glossary-topic}, see below.)
+
+This is obviously a contrived example since it's strange to have the
+symbol names (such as \qt{Sigma}) in the glossary. The purpose is to
+demonstrate the \glostyle{alttreehypergroup} with an entry that's
+noticeably wider than the others in the same hierarchical level. A
+more sensible document would have the symbol in the \gloskey{name}
+key.
+
+\glsxtrnote
+If you want to switch to \gls{glossaries-extra}, then you can
+instead use a combination of \pkgopt{nostyles} and
+\pkgopt*{stylemods}:
+\begin{alltt}
+\cs{usepackage}[style=alttreehypergroup,\xtrfont{postdot},\strong{nostyles,
+\xtrfont{stylemods=tree}}]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+The \pkgopt*{stylemods} package not only patches the original styles
+provided by the base \styfmt{glossaries} package (such as
+\sty{glossary-tree} used in this example) but also provides extra
+helper commands. In this case, it provides additional commands to
+calculate the widest name. For example, instead of manually setting
+the widest entry with \ics{glssetwidest}, you could add the
+following before the glossary:
+\begin{alltt}
+\ics*{glsFindWidestUsedTopLevelName}
+\ics*{glsFindWidestUsedLevelTwo}
+\end{alltt}
+This will only take into account the entries that have actually been
+used in the document, but it can still be time-consuming if you have
+a large number of entries.
+
+\begin{important}
+Note that the glossary must be at the end of the document (after all
+required entries have been used) with this method. The alternative
+is to perform the calculation at the end of the document and save
+the results in the \filetype{aux} file for the next run.
+\end{important}
+
+This example document is using top-level entries for topics without
+descriptions. This means that the descriptions simply contain
+\ics{nopostdesc} to prevent the post-description punctuation from
+being automatically inserted. For example:
+\begin{verbatim}
+\newglossaryentry{greekletter}{name={Greek letters},
+text={Greek letter},
+description={\nopostdesc}}
+\end{verbatim}
+With \gls{glossaries-extra}, you can convert this to
+\ics*{glsxtrnopostpunc} which will prevent the post-description
+punctuation without interfering with the category post-description
+hook.
+
+In order to distinguish between the child entries, which are
+symbols, and the parent entries, which are topics, it's useful to
+give these two different types of entries different categories. The
+topics can use the default \cat{general} category, but the symbol
+entries can be assigned to a different category. The value of the
+\xtrgloskey{category} key must be a label. For example:
+\begin{alltt}
+\cs{newglossaryentry}\mgroup{C}\mgroup{name=\mgroup{C},
+description=\mgroup{Euler's constant},
+\strong{\xtrfont{category}=symbol,}
+parent=romanletter}
+\end{alltt}
+
+There is some redundancy caused by a parenthetical note after the \gls{firstuse} in some
+of the symbol entries. For example:
+\begin{verbatim}
+\newglossaryentry{pi}{name={pi},
+text={\ensuremath{\pi}},
+first={\ensuremath{\pi} (lowercase pi)},
+description={Transcendental number},
+parent=greekletter}
+\end{verbatim}
+With \gls{glossaries-extra} this can be dealt with through the category post-link hook:
+\begin{alltt}
+\ics*{glsdefpostlink}\mgroup{symbol}\mgroup{\%
+ \ics*{glsxtrifwasfirstuse}
+ \mgroup{\% first use
+ \ics*{glsxtrifhasfield}\mgroup{useri}\mgroup{\ics{glslabel}}\%
+ \mgroup{ (\ics{glscurrentfieldvalue})}\mgroup{}\%
+ }\%
+ \mgroup{}\% not first use
+}
+\end{alltt}
+The parenthetical material is now stored in the \gloskey{user1} key.
+For example:
+\begin{alltt}
+\cs{newglossaryentry}\mgroup{sigma}\mgroup{name={Sigma},
+text=\mgroup{\cs{ensuremath}{\cs{Sigma}}},
+\strong{user1=\mgroup{uppercase sigma},}
+description=\mgroup{Used to indicate summation},
+parent=greekletter}
+\end{alltt}
+The category post-description link is also set to ensure that the symbol is
+displayed after the description in the glossary:
+\begin{alltt}
+\ics*{glsdefpostdesc}\mgroup{symbol}\mgroup{\cs{space}
+ (\$\ics{glsentrytext}\mgroup{\ics{glscurrententrylabel}}\$)}
+\end{alltt}
+These modifications only affect entries with the
+\xtrgloskey{category} set to \cat{symbol}.
+
+With \gls{glossaries-extra}, it's now possible to use the topic
+styles provided with the \sty*{glossary-topic} package:
+\begin{alltt}
+\cs{usepackage}[style=\strong{\xtrfont{topic}},\xtrfont{postdot},\strong{nostyles,\xtrfont{stylemods=\mgroup{tree\strong{,topic}}}}]
+\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+The \xtrglostyle{topic} style is designed for this kind of hierarchy
+where all the top-level entries don't have descriptions. This means
+that the \ics{nopostdot} and \ics*{glsxtrnopostpunc} commands aren't
+required. The top-level entries can simply be defined as:
+\begin{alltt}
+\cs{newglossaryentry}\mgroup{greekletter}\mgroup{name=\mgroup{Greek letters},
+text=\mgroup{Greek letter}, description=\mgroup{}}
+
+\cs{newglossaryentry}\mgroup{romanletter}\mgroup{name=\mgroup{Roman letters},
+text=\mgroup{Roman letter}, description=\mgroup{}}
+\end{alltt}
+I've now loaded both the \sty{glossary-tree} and
+\sty{glossary-topic} packages
+(via \pkgopt*{stylemods}\optfmt{\dequals\mgroup{tree\dcomma topic}}). The
+\sty{glossary-topic} package can be used without
+\sty{glossary-tree}, in which case it will behave more like the
+normal \glostyle{tree} rather than \glostyle{alttree} styles (but
+with different indentation and no description in the top-level).
+However, if you use \ics{glssetwidest} (provided by
+\sty{glossary-tree}) then the \xtrglostyle{topic} style will behave
+more like \glostyle{alttree}.
+
+Since there's no description for the top-level entries, the
+\xtrglostyle{topic} style ignores the widest name setting for the
+top-level, so I can just have the level~1 setting:
+\begin{verbatim}
+\glssetwidest[1]{Sigma}
+\end{verbatim}
+
+\bibglsnote
+If you want to convert this document so that it uses \gls{bib2gls},
+you first need to convert it to using \gls{glossaries-extra}, as
+described above, but remember that you now need the \pkgopt*{record}
+option.
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{record},}style=topic,\xtrfont{postdot},nostyles,\xtrfont{stylemods=\mgroup{tree,topic}}]
+\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+Next convert the entries to the \filetype{bib} format required by
+\gls{bib2gls}:
+\begin{prompt}
+convertgls2bib -{}-preamble-only sampletree.tex entries.bib
+\end{prompt}
+Now replace \cs{makeglossaries} with:
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,\strong{\xtrfont{set-widest}}]
+\end{alltt}
+I've used the \resourceopt{set-widest} option here to get
+\gls{bib2gls} to compute the widest name. (Obviously, it can only do
+this if it can correctly interpret any commands contained in the
+\gloskey{name} field.)
+
+This means that the \ics{glssetwidest} commands can now be removed
+completely. All the \cs{newglossaryentry} commands also need to be removed from
+the preamble. Finally, \cs{printunsrtglossaries} needs to be
+replaced with \ics*{printunsrtglossaries}. The document build is now:
+\begin{prompt}
+pdflatex sampletree
+bib2gls sampletree
+pdflatex sampletree
+\end{prompt}
+
+This produces the same result as with just \gls{glossaries-extra}
+and \gls{makeglossaries}. However, there are some modifications that
+can be made to the \filetype{bib} file to make it neater.
+
+The top-level entries are defined as:
+\begin{alltt}
+\atentry{entry}\mgroup{greekletter,
+ name = \mgroup{Greek letters},
+ description = \mgroup{},
+ text = \mgroup{Greek letter}
+}
+
+\atentry{entry}\mgroup{romanletter,
+ name = \mgroup{Roman letters},
+ description = \mgroup{},
+ text = \mgroup{Roman letter}
+}
+\end{alltt}
+This is a direct translation from the \cs{newglossaryentry} commands
+(after switching to the \xtrglostyle{topic} style). There's a more
+appropriate entry type:
+\begin{alltt}
+\atentry{indexplural}\mgroup{greekletter,
+ text = \mgroup{Greek letter}
+}
+
+\atentry{indexplural}\mgroup{romanletter,
+ text = \mgroup{Roman letter}
+}
+\end{alltt}
+The \atentry{indexplural} entry type doesn't require the
+\gloskey{description} and will set the \gloskey{name} field to the
+same as the \gloskey{plural} field. Since the \gloskey{plural} field
+hasn't been set it's obtained by appending \qt{s} to the
+\gloskey{text} field.
+
+Now let's assume that the symbol entries are defined in a more
+rational manner, with the actual symbol in the \gloskey{name} field.
+For example:
+\begin{alltt}
+\atentry{entry}\mgroup{sigma,
+ user1 = \mgroup{uppercase sigma},
+ parent = \mgroup{greekletter},
+ description = \mgroup{Used to indicate summation},
+ \strong{name = \mgroup{\cs{ensuremath}\mgroup{\cs{Sigma}}}},
+ category = \mgroup{symbol}
+}
+
+\atentry{entry}\mgroup{C,
+ parent = \mgroup{romanletter},
+ name = \mgroup{\cs{ensuremath}\mgroup{C}},
+ description = \mgroup{Euler's constant},
+ category = \mgroup{symbol}
+}
+\end{alltt}
+The category post-description hook (provided with
+\ics*{glsdefpostdesc}) should now be removed from the document.
+
+If you make these changes and rebuild the document, you'll find that
+the order has changed. Now the \texttt{sigma} entry is before the
+\texttt{pi} entry. This is because \gls{bib2gls} is obtaining the
+sort values from the \gloskey{name} field, which is the sort
+fallback for \atentry{entry}. This means that the sort values end up
+as $\Sigma$ and $\pi$ (\gls{bib2gls} recognises the commands
+\ics{Sigma} and \ics{pi} and converts them to the Unicode characters
+0x1D6F4 and 0x1D70B).
+
+If you change \atentry{entry} to \atentry{symbol} then you will once
+again get the order from the original example (\texttt{pi} before
+\texttt{Sigma}). This is because the sort fallback for
+\atentry{symbol} is the label not the \gloskey{name}. (Remember that
+the sort fallback is only used if the \gloskey{sort} field isn't
+set. If you explicitly set the \gloskey{sort} field then no fallback
+is required. See \bibglsgallery{sorting}.)
+
+You can further tidy the \filetype{bib} file by removing the
+\xtrgloskey{category} fields. For example:
+\begin{alltt}
+\atentry{symbol}\mgroup{sigma,
+ user1 = \mgroup{uppercase sigma},
+ parent = \mgroup{greekletter},
+ description = \mgroup{Used to indicate summation},
+ name = \mgroup{\cs{ensuremath}\mgroup{\cs{Sigma}}}
+}
+\end{alltt}
+You can then assign the \xtrgloskey{category} in the resource set:
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,\xtrfont{set-widest},\strong{\xtrfont{category}=\mgroup{same as entry}}]
+\end{alltt}
+This means that all the entries defined with \atentry{symbol} will
+have the \xtrgloskey{category} set to \texttt{symbol} and all the
+entries defined with \atentry{indexplural} will have the
+\xtrgloskey{category} set to \texttt{indexplural}. (Only the
+\cat{symbol} category is significant in this example.)
+
+You can make the \filetype{bib} files even more flexible by
+introducing field and entry aliases with \resourceopt{field-aliases}
+and \resourceopt{entry-type-aliases}. See the \gls{bib2gls} manual
+for further details.
+
+\section{Cross-Referencing}
+\label{sec:samplescrossref}
+
+\exitem{-crossref}
+This document illustrates how to cross-reference entries in the
+glossary.
+\begin{prompt}
+pdflatex sample-crossref
+makeglossaries sample-crossref
+pdflatex sample-crossref
+\end{prompt}
+The document provides a command \ics{alsoname} to produce some fixed text, which can be
+changed as appropriate (usually within a language hook):
+\begin{verbatim}
+\providecommand{\alsoname}{see also}
+\end{verbatim}
+I've used \cs{providecommand} as some packages define this command.
+This is used to create a \qt{see also} cross-reference with the
+\gloskey{see} key:
+\begin{verbatim}
+\newglossaryentry{apple}{name=apple,description={firm, round fruit},
+see=[\alsoname]{pear}}
+
+\newglossaryentry{marrow}{name={marrow},
+ description={long vegetable with thin green skin and white flesh},
+ see={[\alsoname]courgette}}
+\end{verbatim}
+
+Note that \qt{marrow} is included in the glossary even though it
+hasn't been referenced in the text. This is because the
+\gloskey{see} key automatically triggers \ics{glssee} which indexes
+the term. This behaviour is intended for documents where only the
+terms that are actually required in the document are defined. It's
+not suitable for a large database of terms shared across multiple
+documents that may or may not be used in a particular document. In
+that case, you may want to consider using \gls{glossaries-extra}
+(see below).
+
+\glsxtrnote
+This example is quite simple to convert to \gls{glossaries-extra}.
+If you want the dot after the description, you need the
+\pkgopt[false]{nopostdot} or \pkgopt*{postdot} package option. You
+may also want to consider using the \pkgopt*{stylemods} option.
+
+In order to prevent the \qt{marrow} entry from being automatically
+being added to the glossary as a result of the cross-reference, you
+can use \pkgopt+{false}{autoseeindex} to prevent the automatic
+indexing triggered by the \gloskey{see} key (or the
+\xtrgloskey{seealso} key provided by \gls{glossaries-extra}).
+
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{autoseeindex}=false},\xtrfont{postdot},\xtrfont{stylemods}]\mgroup{glossaries-extra}
+\end{alltt}
+The document build is the same, but now the \qt{marrow} and
+\qt{zucchini} entries aren't present in the document.
+
+Note that the \qt{fruit} entry is still included even though it
+hasn't been used in the document. This is because it was explicitly
+indexed with \ics{glssee} not via the \gloskey{see} key.
+
+The entries that contains \texttt{see=[\cs{alsoname}]}
+can be converted to use the \xtrgloskey{seealso} key:
+\begin{alltt}
+\cs{newglossaryentry}\mgroup{apple}\mgroup{name=apple,description=\mgroup{firm, round fruit},
+\strong{\xtrfont{seealso}=\mgroup{pear}}}
+
+\cs{newglossaryentry}\mgroup{marrow}\mgroup{name=\mgroup{marrow},
+ description=\mgroup{long vegetable with thin green skin and white flesh},
+ \strong{\xtrfont{seealso}=\mgroup{courgette}}}
+\end{alltt}
+(The provided \cs{alsoname} definition may be removed.)
+
+The original example redefines the cross-referencing format to use
+\gls{smallcaps}:
+\begin{alltt}
+\cs{renewcommand}\mgroup{\ics{glsseeitemformat}}[1]\mgroup{\cs{textsc}\mgroup{\ics{glsentryname}\mgroup{\#1}}}
+\end{alltt}
+This will still produce the desired effect with \gls{glossaries-extra} for
+this simple example but, as with \samplefile{AcrDesc},
+this redefinition isn't necessary if you have at least
+\gls{glossaries-extra} v1.42.
+
+\bibglsnote
+If you want to switch to \gls{bib2gls} then you first need to switch
+to \gls{glossaries-extra}, as described above, but you now need the
+\pkgopt*{record} option but no longer need the
+\pkgopt+{false}{autoseeindex} option:
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{record}},\xtrfont{postdot},\xtrfont{stylemods}]\mgroup{glossaries-extra}
+\end{alltt}
+Next the entry definitions need to be converted to the
+\filetype{bib} format required by \gls{bib2gls}.
+\begin{prompt}
+convertgls2bib sample-crossref.tex entries.bib
+\end{prompt}
+If you have at least v2.0 then \gls{convertgls2bib} will absorb the
+cross-referencing information supplied by:
+\begin{verbatim}
+\glssee{fruit}{pear,apple,banana}
+\end{verbatim}
+into the \texttt{fruit} definition:
+\begin{alltt}
+\atentry{entry}\mgroup{fruit,
+ see = \mgroup{pear,apple,banana},
+ name = \mgroup{fruit},
+ description = \mgroup{sweet, fleshy product of plant containing seed}
+}
+\end{alltt}
+Now remove \cs{makeglossaries} and all the entry definition commands
+(including \cs{glssee} from the preamble) and add:
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries.bib]
+\end{alltt}
+Finally, replace \cs{printglossaries} with
+\ics*{printunsrtglossaries}. The document build is now:
+\begin{prompt}
+pdflatex sample-crossref
+bib2gls sample-crossref
+pdflatex sample-crossref
+\end{prompt}
+The glossary now contains: apple, banana, courgette and pear. Note
+that it doesn't contain fruit, zucchini or marrow.
+
+Now change the selection criteria:
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries.bib,
+ \strong{\xtrfont{selection}=\mgroup{recorded and deps and see}}]
+\end{alltt}
+The glossary now includes fruit, zucchini and marrow.
+
+The fruit and zucchini use the \gloskey{see} key which is a simple
+redirection for the reader. There's no \gls{numberlist} for either
+of these entries. Whereas marrow uses the \xtrgloskey{seealso} key,
+which is typically intended as a supplement to a \gls{numberlist}
+but in this case there are no locations as marrow hasn't been used
+in the text.
+
+With at least v2.0, there's an alternative:
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries.bib,
+ \resourceopt{selection}=\mgroup{recorded and deps and see\strong{ not also}}]
+\end{alltt}
+In this case, the glossary includes fruit and zucchini but not marrow.
+
+
+\section{Custom Keys}
+\label{sec:samplescustomkeys}
+
+\exitem{-newkeys} This document illustrates how add custom keys
+(using \ics{glsaddkey}). There are two custom keys \texttt{ed}, where
+the default value is the \gloskey{text} field with \qt{ed} appended,
+and \texttt{ing}, where the default value is the \gloskey{text}
+field with \qt{ing} appended. Since the default value in both cases
+references the \gloskey{text} field, the starred version
+\cs{glsaddkey*} is required to ensure that the default value is expanded on
+definition if no alternative has been provided.
+
+The entries are then defined as follows:
+\begin{verbatim}
+\newglossaryentry{jump}{name={jump},description={}}
+
+\newglossaryentry{run}{name={run},%
+ ed={ran},%
+ ing={running},
+ description={}}
+
+\newglossaryentry{waddle}{name={waddle},%
+ ed={waddled},%
+ ing={waddling},%
+ description={}}
+\end{verbatim}
+
+Each custom key is provided a set of commands analogous to
+\cs{glsentrytext}, that allows the key value to be accessed, and
+\cs{glstext} that allows the key value to be access with indexing
+and hyperlinking (where applicable).
+
+If you find yourself wanting to create a lot of custom keys that
+produce minor variations of existing keys (such as different tenses)
+you may find it simpler to just use \cs{glsdisp}. When editing the
+document source, it's usually simpler to read:
+\begin{verbatim}
+The dog \glsdisp{jump}{jumped} over the duck.
+\end{verbatim}
+than
+\begin{verbatim}
+The dog \glsed{jump} over the duck.
+\end{verbatim}
+
+\bibglsnote
+If you want to convert this document to use \gls{bib2gls}, you first
+need to switch to \gls{glossaries-extra}, but remember that you need
+the \pkgopt*{record} option:
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{record}}]{\strong{glossaries-extra}}
+\end{alltt}
+Next convert the entry definitions to the \filetype{bib} format
+required by \gls{bib2gls}:
+\begin{prompt}
+convertgls2bib -{}-index-conversion -{}-preamble-only sample-newkeys.tex entries.bib
+\end{prompt}
+The \texttt{-{}-index-conversion} switch requires at least v2.0 and
+will convert entries without a description (or where the description
+is simply \ics{nopostdesc} or \ics*{glsxtrnopostpunc}) to
+\atentry{index} instead of \atentry{entry}. This means that the
+new \nolinkurl{entries.bib} file will contain:
+\begin{alltt}
+\atentry{index}\mgroup{jump,
+ name = \mgroup{jump}
+}
+
+\atentry{index}\mgroup{run,
+ ing = \mgroup{running},
+ name = \mgroup{run},
+ ed = \mgroup{ran}
+}
+
+\atentry{index}\mgroup{waddle,
+ ing = \mgroup{waddling},
+ name = \mgroup{waddle},
+ ed = \mgroup{waddled}
+}
+\end{alltt}
+Now replace \cs{makeglossaries} with
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries]
+\end{alltt}
+and delete the \cs{newglossaryentry} commands. Finally replace
+\cs{printglossaries} with \ics*{printunsrtglossaries}.
+
+The document build is now:
+\begin{prompt}
+pdflatex sample-newkeys
+bib2gls sample-newkeys
+pdflatex sample-newkeys
+\end{prompt}
+Note that there's no need for the \pkgopt{nonumberlist} package
+option when you don't use \gls{bib2gls}['s] \texttt{-{}-group}
+switch.
+
+\exitem{-storage-abbr} This document illustrates how add custom
+storage keys (using \cs{glsaddstoragekey}). The document build is:
+\begin{prompt}
+pdflatex sample-storage-abbr
+makeglossaries sample-storage-abbr
+pdflatex sample-storage-abbr
+\end{prompt}
+
+The custom storage key is called \texttt{abbrtype} which defaults
+to \texttt{word} if not explicitly set. Its value can be accessed
+with the provided custom command \cs{abbrtype}.
+\begin{alltt}
+\ics{glsaddstoragekey}\mgroup{abbrtype}\mgroup{word}\mgroup{\cs{abbrtype}}
+\end{alltt}
+A custom abbreviation style is then defined that checks the value of
+this key and makes certain adjustments depending on whether or not
+its value is the default \texttt{word}.
+
+This essentially forms a very similar function to the
+\gls{glossaries-extra} package's \xtrgloskey{category} key, which is
+also defined as a storage key:
+\begin{alltt}
+\cs{glsaddstoragekey}\mgroup{category}\mgroup{general}\mgroup{\ics*{glscategory}}
+\end{alltt}
+
+\glsxtrnote
+This document is much simpler with the \gls{glossaries-extra}
+package:
+\begin{alltt}
+\cs{documentclass}\mgroup{article}
+\cs{usepackage}[\xtrfont{postdot}]\mgroup{\strong{glossaries-extra}}
+\cs{makeglossaries}
+\ics*{setabbreviationstyle}[\strong{acronym}]\mgroup{short-long}
+\ics{newacronym}\mgroup{radar}\mgroup{radar}\mgroup{radio detecting and ranging}
+\ics{newacronym}\mgroup{laser}\mgroup{laser}\mgroup{light amplification by stimulated
+emission of radiation}
+\ics{newacronym}\mgroup{scuba}\mgroup{scuba}\mgroup{self-contained underwater breathing
+apparatus}
+
+\ics*{newabbreviation}\mgroup{dsp}\mgroup{DSP}\mgroup{digital signal processing}
+\ics*{newabbreviation}\mgroup{atm}\mgroup{ATM}\mgroup{automated teller machine}
+
+\cs{begin}\mgroup{document}
+
+First use: \cs{gls}\mgroup{radar}, \cs{gls}\mgroup{laser}, \cs{gls}\mgroup{scuba}, \cs{gls}\mgroup{dsp},
+\cs{gls}\mgroup{atm}.
+
+Next use: \cs{gls}\mgroup{radar}, \cs{gls}\mgroup{laser}, \cs{gls}\mgroup{scuba}, \cs{gls}\mgroup{dsp},
+\cs{gls}\mgroup{atm}.
+
+\cs{printglossaries}
+\cs{end}\mgroup{document}
+\end{alltt}
+
+\exitem{-storage-abbr-desc} An extension of the previous example
+where the user needs to provide a~description.
+
+\exitem{-chap-hyperfirst} This document illustrates how to add
+a~custom key using \cs{glsaddstoragekey} and hook into the \glslike\
+and \glstextlike\ mechanism used to determine whether or not to
+hyperlink an entry.
+The document build is:
+\begin{prompt}
+pdflatex sample-chap-hyperfirst
+makeglossaries sample-chap-hyperfirst
+pdflatex sample-chap-hyperfirst
+\end{prompt}
+This example creates a storage key called \texttt{chapter} used to store the chapter
+number.
+\begin{alltt}
+\ics{glsaddstoragekey}\mgroup{\strong{chapter}}\mgroup{0}\mgroup{\strong{\cs{glschapnum}}}
+\end{alltt}
+It's initialised to 0 and the \ics{glslinkpostsetkeys} hook is used
+to check this value against the current chapter number. If the
+values are the same then the hyperlink is switched off, otherwise
+the key value is updated unless the hyperlink has been switched off
+(through the optional argument of commands like \cs{gls} and \cs{glstext}).
+\begin{alltt}
+\cs{renewcommand}*\mgroup{\ics{glslinkpostsetkeys}}\mgroup{\%
+ \cs{edef}\cs{currentchap}\mgroup{\cs{arabic}\mgroup{chapter}}\%
+ \cs{ifnum}\cs{currentchap}=\strong{\cs{glschapnum}}\mgroup{\cs{glslabel}}\cs{relax}
+ \cs{setkeys}\mgroup{glslink}\mgroup{hyper=false}\%
+ \cs{else}
+ \ics{glsifhyperon}\mgroup{\ics{glsfieldxdef}\mgroup{\cs{glslabel}}\mgroup{\strong{chapter}}\mgroup{\cs{currentchap}}}\mgroup{}\%
+ \cs{fi}
+}
+\end{alltt}
+Since this key isn't intended for use when the entry is being
+defined, it would be more appropriate to simply use an internal
+field that doesn't have an associated key or helper command, but
+\ics{glsfieldxdef} requires the existence of the field. The
+\gls{glossaries-extra} package provides utility commands designed to
+work on internal fields that don't have an associated key and may
+not have had a value assigned.
+
+\glsxtrnote
+If you want to switch to \gls{glossaries-extra} you need to change
+the package loading line:
+\begin{alltt}
+\cs{usepackage}[\xtrfont{postdot}]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+The custom storage key (provided with \cs{glsaddstoragekey}) can be
+removed, and the \ics{glslinkpostsetkeys} hook can be changed to:
+\begin{alltt}
+\cs{renewcommand}*\mgroup{\ics{glslinkpostsetkeys}}\mgroup{\%
+ \cs{edef}\cs{currentchap}\mgroup{\cs{arabic}\mgroup{chapter}}\%
+ \strong{\ics*{GlsXtrIfFieldEqNum}*}\mgroup{\strong{chapter}}\mgroup{\cs{glslabel}}\mgroup{\cs{currentchap}}
+ \mgroup{\%
+ \cs{setkeys}\mgroup{glslink}\mgroup{hyper=false}\%
+ }\%
+ \mgroup{%
+ \ics{glsifhyperon}\mgroup{\strong{\ics*{xGlsXtrSetField}}\mgroup{\cs{glslabel}}\mgroup{\strong{chapter}}\mgroup{\cs{currentchap}}}\mgroup{}\%
+ }%
+}
+\end{alltt}
+The field name is still called \texttt{chapter} but there's no
+longer an associated key or command.
+
+\section{Xindy (Option 3)}
+\label{sec:samplesxindy}
+
+Most of the earlier \gls{makeindex} sample files can be adapted to
+use \gls{xindy} instead by adding the \pkgopt{xindy} package option.
+Situations that you need to be careful about are when the sort value
+(obtained from the \gloskey{name} if the \gloskey{sort} key is
+omitted) contains commands (such as \verb|name={\pi}|) or is identical
+to another value (or is identical after \gls{xindy} has stripped all
+commands and braces). This section describes sample documents that
+use features which are unavailable with \gls{makeindex}.
+
+\exitem{xdy} The document uses UTF8 encoding (with the
+\sty{inputenc} package). This is information that needs to be passed
+to \gls{xindy}, so the encoding is picked up by \gls{makeglossaries}
+from the \filetype{aux} file.
+
+By default, this document will create a \gls{xindy} style file called
+\nolinkurl{samplexdy.xdy}, but if you uncomment the lines
+\begin{verbatim}
+\setStyleFile{samplexdy-mc}
+\noist
+\GlsSetXdyLanguage{}
+\end{verbatim}
+it will set the style file to \texttt{samplexdy-mc.xdy} instead.
+This provides an additional letter group for entries starting with
+\qt{Mc} or \qt{Mac}. If you use \gls{makeglossaries} or
+\gls{makeglossaries-lite.lua}, you don't
+need to supply any additional information. If you don't use
+\gls*{makeglossaries}, you will need to specify the required
+information. Note that if you set the style file to
+\nolinkurl{samplexdy-mc.xdy} you must also specify \ics{noist},
+otherwise the \styfmt{glossaries} package will overwrite
+\nolinkurl{samplexdy-mc.xdy} and you will lose the \qt{Mc} letter
+group.
+
+To create the document do:
+\begin{prompt}
+pdflatex samplexdy
+makeglossaries samplexdy
+pdflatex samplexdy
+\end{prompt}
+If you don't have Perl installed then you can't use
+\gls{makeglossaries}, but you also can't use \gls{xindy}!
+However, if for some reason you want to call
+\gls{xindy} explicitly instead of using \gls{makeglossaries} (or
+\gls{makeglossaries-lite.lua}):
+\begin{itemize}
+\item if you are using the default style file \nolinkurl{samplexdy.xdy}, then
+do (no line breaks):
+\begin{prompt}
+xindy -L english -C utf8 -I xindy -M samplexdy -t samplexdy.glg -o samplexdy.gls samplexdy.glo
+\end{prompt}
+\item if you are using \nolinkurl{samplexdy-mc.xdy}, then do
+(no line breaks):
+\begin{prompt}
+xindy -I xindy -M samplexdy-mc -t samplexdy.glg -o samplexdy.gls samplexdy.glo
+\end{prompt}
+\end{itemize}
+
+This document creates a new command to use with the
+\gloskey[glslink]{format} key in the optional argument of commands
+like \cs{gls} to format the location in the \gls{numberlist}.
+The usual type of definition when a hyperlinked location is required
+should use one of the \csmeta{hyper}{xx}{} commands listed in
+\tableref{tab:hyperxx}:
+\begin{verbatim}
+\newcommand*{\hyperbfit}[1]{\textit{\hyperbf{#1}}}
+\end{verbatim}
+Unfortunately, this definition doesn't work for this particular
+document and some adjustments are needed (see below). As a result of
+the adjustments, this command doesn't actually get used by \TeX,
+even though \texttt{hyperbfit} is used in the
+\gloskey[glslink]{format} key. It does, however, need to be
+identified as an attribute so that \gls{xindy} can recognise it:
+\begin{verbatim}
+\GlsAddXdyAttribute{hyperbfit}
+\end{verbatim}
+This will add information to the \filetype{xdy} file when it's
+created by \cs{makeglossaries}. If you prevent the creation of this
+file with \ics{noist} then you will need to add the attribute to
+your custom \filetype{xdy} file (see the provided
+\nolinkurl{samplexdy-mc.xdy} file).
+
+In order to illustrate unusual location formats, this sample
+document provides a command called \cs{tallynum}\marg{n} that represents its
+numerical argument with a die or dice where the dots add up to \meta{n}:
+\begin{verbatim}
+\newrobustcmd*{\tallynum}[1]{%
+ \ifnum\number#1<7
+ $\csname dice\romannumeral#1\endcsname$%
+ \else
+ $\dicevi$%
+ \expandafter\tallynum\expandafter{\numexpr#1-6}%
+ \fi
+}
+\end{verbatim}
+This command needs to be robust to prevent it from being expanded
+when it's written to any of the auxiliary files. The \ics{dicei},
+\ldots, \cs{dicevi} commands are provided by the \sty{stix}
+package, so that needs to be loaded.
+
+An associated command \cs{tally}\marg{counter} is defined that
+formats the value of the named \meta{counter} according to
+\cs{tallynum}:
+\begin{verbatim}
+\newcommand*{\tally}[1]{\tallynum{\arabic{#1}}}
+\end{verbatim}
+(This shouldn't be robust as it needs the counter value to expand.)
+The page numbers are altered to use this format (by redefining \ics{thepage}).
+
+This custom location format also needs to be identified in the
+\filetype{xdy} file so that \gls{xindy} can recognise it and
+determine how to form ranges if required.
+\begin{verbatim}
+\GlsAddXdyLocation{tally}{% tally location format
+ :sep "\string\tallynum\space\glsopenbrace"
+ "arabic-numbers"
+ :sep "\glsclosebrace"
+}
+\end{verbatim}
+Again this information is written to the \filetype{xdy} file by
+\cs{makeglossaries} so if you use \cs{noist} then you need to
+manually add it to your custom \filetype{xdy} file.
+
+When \gls{xindy} creates the associated glossary files, the
+locations will be written using:
+\begin{alltt}
+\csmetameta{glsX}{counter}{X}{format}{}\marg{hyper-prefix}\marg{location}
+\end{alltt}
+In this case:
+\begin{alltt}
+\cs{glsXpageXglsnumberformat}\mgroup{}\mgroup{\cs{tallynum}\marg{number}}
+\end{alltt}
+or
+\begin{alltt}
+\cs{glsXpageXhyperbfit}\mgroup{}\mgroup{\cs{tallynum}\marg{number}}
+\end{alltt}
+This means that although \cs{hyperbf} is designed to create
+hyperlinked locations, the presence of \cs{tallynum} interferes with
+it.
+In order to make the hyperlinks work correctly, the definitions of
+\cs{glsXpageXhyperbfit} need to be redefined in order to grab the
+number part in order to work out the location's numeric value. If
+the value of \cs{tally} is changed so that it expands differently
+then these modifications won't work.
+
+Remember that in both cases, the second argument \verb|#2| is in the
+form \cs{tally}\marg{n}:
+\begin{verbatim}
+\renewcommand{\glsXpageXglsnumberformat}[2]{%
+ \linkpagenumber#2%
+}
+\renewcommand{\glsXpageXhyperbfit}[2]{%
+ \textbf{\em\linkpagenumber#2}%
+}
+\end{verbatim}
+These need a command that can grab the actual number and correctly encapsulate
+it:
+\begin{verbatim}
+\newcommand{\linkpagenumber}[2]{\hyperlink{page.#2}{#1{#2}}}
+\end{verbatim}
+
+If you want to try out the \nolinkurl{samplexdy-mc.xdy} file, the
+entries starting with \qt{Mac} or \qt{Mc} will be placed in their
+own \qt{Mc} letter group. Ideally it should be possible to do this
+simply with \ics{GlsAddLetterGroup} (and not require a custom
+\filetype{xdy} file) but unfortunately the \qt{M} letter
+group will have already been defined and take precedence over
+\qt{Mc}, which is why a custom file is required and the normal
+language module must be suppressed:
+\begin{verbatim}
+\setStyleFile{samplexdy-mc}
+\noist
+\GlsSetXdyLanguage{}
+\end{verbatim}
+
+This \qt{Mc} group is suitable for names like
+\qt{Maclaurin} but not for \qt{Mach}. To prevent this, the
+\gloskey{sort} key for that value is set to lower case:
+\begin{verbatim}
+\newglossaryentry{mach}{name={Mach, Ernst},
+first={Ernst Mach},text={Mach},
+sort={mach, Ernst},
+description={Czech/Austrian physicist and philosopher}}
+\end{verbatim}
+
+\bibglsnote
+If you want to convert this document so that it uses \gls{bib2gls},
+you first need to switch to \gls{glossaries-extra} and use the
+\pkgopt*{record} package option:
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{record}},\xtrfont{postdot}]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+The \gls{xindy}-only commands can now all be removed
+(attribute \cs{GlsAddXdyAttribute}, location \cs{GlsAddXdyLocation},
+language \cs{GlsSetXdyLanguage}, location encapsulators
+\csmetameta{glsX}{counter}{X}{format}{}
+and the custom helper \cs{linkpagenumber}).
+Also \cs{noist} and \cs{setStyleFile} aren't relevant with
+\gls{bib2gls} and so should be removed.
+
+The definitions of \cs{hyperbfit} should be retained (as well as
+\cs{tallynum}, \cs{tally} and the redefinition of \cs{thepage}).
+
+The entries all need to be converted to the \filetype{bib} format
+required by \gls{bib2gls}.
+\begin{prompt}
+convertgls2bib -{}-preamble-only samplexdy.tex entries.bib
+\end{prompt}
+Next replace \cs{makeglossaries} with:
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries]
+\end{alltt}
+and remove all the entry definitions from the preamble. Use the
+search and replace function on your text editor to replace all
+instances of \ics{glsentryfirst} with \ics*{glsfmtfirst}, and all
+instances of \ics{glsentryname} with \ics*{glsfmtname}.
+
+Finally, replace \ics{printglossaries} with \ics*{printunsrtglossaries}.
+The document build is now:
+\begin{prompt}
+pdflatex samplexdy
+bib2gls -{}-group samplexdy
+pdflatex samplexdy
+\end{prompt}
+
+This results in a slightly different ordering from the original
+document (without the \qt{Mc} letter group). In the original
+example, \qt{Mach number} was listed before \qt{Mach, Ernest}. The
+modified document now has \qt{Mach, Ernest} before \qt{Mach number}.
+This difference is due to \gls{bib2gls}['s] default
+\resourceopt[word]{break-at} setting, which marks word boundaries
+with the pipe (\texttt{|}) character, so the sort values for
+\gls{bib2gls} are \texttt{Mach|Earnest|} and \texttt{Mach|number|}.
+See the \gls{bib2gls} manual for further details of this option, and
+also see the examples chapter of that manual for alternative
+approaches when creating entries that contain people's names.
+
+If you want the \qt{Mc} letter group, it can be obtained by
+providing a custom sort rule:
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,
+ \resourceopt{sort}=\strong{custom},
+ \strong{\xtrfont{sort-rule}}=\mgroup{\ics*{glsxtrcontrolrules}
+ ;\ics*{glsxtrspacerules};\ics*{glsxtrnonprintablerules}
+ ;\ics*{glsxtrcombiningdiacriticrules},\ics*{glsxtrhyphenrules}
+ <\ics*{glsxtrgeneralpuncrules}<\ics*{glsxtrdigitrules}
+ <a,A<b,B<c,C<d,D<e,E<f,F<g,G<h,H<i,I<j,J<k,K<l,L\strong{<Mc=Mac}<m,M<o,O
+ <p,P<q,Q<r,R<s,S<t,T<u,U<v,V<r,R<s,S<t,T<u,U<v,V<w,W<x,X<y,Y<z,Z
+ }
+]
+\end{alltt}
+Unfortunately, as with \gls{xindy}, this puts \qt{Mach} into the
+\qt{Mc} letter group.
+
+One way to get around this problem is to define a custom command to
+help identify genuine \qt{Mc}/\qt{Mac} prefixes with names that
+happen to start with \qt{Mac}. For example:
+\begin{alltt}
+\atentry{entry}\mgroup{mcadam,
+ name = \mgroup{\strong{\cs{Mac}\mgroup{Mc}}Adam, John Loudon},
+ description = \mgroup{Scottish engineer},
+ text = \mgroup{McAdam},
+ first = \mgroup{John Loudon McAdam}
+}
+
+\atentry{entry}\mgroup{maclaurin,
+ name = \mgroup{\strong{\cs{Mac}\mgroup{Mac}}laurin, Colin},
+ description =\mgroup{Scottish mathematician best known for the
+\cs{gls}\mgroup{maclaurinseries}},
+ text = \mgroup{Maclaurin},
+ first = \mgroup{Colin Maclaurin}
+}
+\end{alltt}
+but not for \qt{Mach}:
+\begin{alltt}
+\atentry{entry}\mgroup{mach,
+ name = \mgroup{Mach, Ernst},
+ description = \mgroup{Czech/Austrian physicist and philosopher},
+ text = \mgroup{Mach},
+ first = \mgroup{Ernst Mach}
+}
+\end{alltt}
+With \LaTeX, this command should simply do its argument:
+\begin{verbatim}
+\newcommand{\Mac}[1]{#1}
+\end{verbatim}
+However, when \gls{bib2gls} works out the \gloskey{sort} value, it
+needs to be defined with something unique that won't happen to occur
+at the start of another term. For example:
+\begin{verbatim}
+\providecommand{\Mac}[1]{MC}
+\end{verbatim}
+(Remember that \resourceopt[word]{break-at} will strip spaces
+and punctuation so don't include them unless you switch to
+\resourceopt[none]{break-at}.)
+
+So add the first definition of \cs{Mac} to the \filetype{tex} file and modify
+\nolinkurl{entries.bib} so that it includes the second definition:
+\begin{alltt}
+\atentry{preamble}\mgroup{"\cs{providecommand}\mgroup{\cs{Mac}}[1]\mgroup{MC}"}
+\end{alltt}
+Then modify the \qt{Mc}/\qt{Mac} entries as appropriate (see the
+above \qt{McAdam} and \qt{Maclaurin} examples).
+
+The custom sort rule needs to be modified:
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,
+ \strong{\xtrfont{write-preamble}=false,}
+ \resourceopt{sort}=custom,
+ \resourceopt{sort-rule}=\mgroup{\ics*{glsxtrcontrolrules}
+ ;\ics*{glsxtrspacerules};\ics*{glsxtrnonprintablerules}
+ ;\ics*{glsxtrcombiningdiacriticrules},\ics*{glsxtrhyphenrules}
+ <\ics*{glsxtrgeneralpuncrules}<\ics*{glsxtrdigitrules}
+ <a,A<b,B<c,C<d,D<e,E<f,F<g,G<h,H<i,I<j,J<k,K<l,L\strong{<MC}<m,M<o,O
+ <p,P<q,Q<r,R<s,S<t,T<u,U<v,V<r,R<s,S<t,T<u,U<v,V<w,W<x,X<y,Y<z,Z
+ }
+]
+\end{alltt}
+This will create a \qt{Mc} letter group that only includes the names
+that start with the custom \cs{Mac} command.
+
+Other alternatives include moving \atentry{preamble} into a separate
+\filetype{bib} file, so that you can choose whether or not to
+include it. See the \qt{Examples} chapter of the \gls{bib2gls} user
+manual for further examples.
+
+\exitem{xdy2} This document illustrates
+how to use the \styfmt{glossaries} package where the location
+numbers don't follow a standard format. This example will only work
+with \gls{xindy}. To create the document do:
+\begin{prompt}
+pdflatex samplexdy2
+makeglossaries samplexdy2
+pdflatex samplexdy2
+\end{prompt}
+The explicit \gls{xindy} call is:
+\begin{prompt}
+xindy -L english -C utf8 -I xindy -M samplexdy2 -t samplexdy2.glg -o samplexdy2.gls samplexdy2.glo
+\end{prompt}
+This example uses the \texttt{section} counter with \gls{xindy}:
+\begin{verbatim}
+\usepackage[xindy,counter=section]{glossaries}
+\end{verbatim}
+The document employs an eccentric section numbering system for
+illustrative purposes. The section numbers are prefixed by the
+chapter number in square brackets:
+\begin{verbatim}
+\renewcommand*{\thesection}{[\thechapter]\arabic{section}}
+\end{verbatim}
+Parts use Roman numerals:
+\begin{verbatim}
+\renewcommand*{\thepart}{\Roman{part}}
+\end{verbatim}
+The section hyperlink name includes the part:
+\begin{verbatim}
+\renewcommand*{\theHsection}{\thepart.\thesection}
+\end{verbatim}
+This custom numbering scheme needs to be identified in the
+\filetype{xdy} file:
+\begin{verbatim}
+\GlsAddXdyLocation["roman-numbers-uppercase"]{section}{:sep "["
+ "arabic-numbers" :sep "]" "arabic-numbers"
+}
+\end{verbatim}
+If the part is 0 then \cs{thepart} will be empty (there isn't a zero
+Roman numeral). An extra case is needed to catch this:
+\begin{verbatim}
+\GlsAddXdyLocation{zero.section}{:sep "["
+ "arabic-numbers" :sep "]" "arabic-numbers"
+}
+\end{verbatim}
+Note that this will stop xindy giving a warning, but the location
+hyperlinks will be invalid if no \cs{part} is used.
+
+\bibglsnote
+If you want to switch to \gls{bib2gls}, you first need to switch to
+\gls{glossaries-extra} but remember to use \pkgopt*{record} instead
+of \pkgopt{xindy}:
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{record}},counter=section]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+Next remove the \cs{GlsAddXdyLocation} commands and convert the
+entry definitions to the \filetype{bib} format required by
+\gls{bib2gls}:
+\begin{prompt}
+convertgls2bib -{}-preamble-only samplexdy2.tex entries.bib
+\end{prompt}
+Now replace \cs{makeglossaries} with:
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries]
+\end{alltt}
+and remove the \cs{newglossaryentry} commands.
+Finally, replace \cs{printglossaries} with \ics*{printunsrtglossaries}.
+
+The document build is:
+\begin{prompt}
+pdflatex samplexdy2
+bib2gls samplexdy2
+pdflatex samplexdy2
+\end{prompt}
+
+With unusual numbering systems, it's sometimes better to use \pkgopt+{nameref}{record}:
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{record}=nameref},counter=section]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+In this case, the locations will be the actual section headings,
+rather than the section number. In order to make the number appear
+instead you need to define:
+\begin{alltt}
+\cs{newcommand}*\mgroup{\ics*{glsxtrsectionlocfmt}}[2]\mgroup{\#1}
+\end{alltt}
+(Make sure you have at least v1.42 of \gls{glossaries-extra}.) See
+also the earlier \samplefile{Sec}.
+
+\exitem{xdy3} This document is very similar to
+\samplefile{xdy} but uses the command \cs{Numberstring} from the
+\sty{fmtcount} package to format the page numbers instead of the
+\cs{tally} command from the earlier example.
+
+\exitem{utf8} This is another example
+that uses \gls{xindy}. Unlike \gls{makeindex},
+\gls{xindy} can cope with \glspl{nonlatinchar}. This
+document uses UTF-8 encoding. To create the document do:
+\begin{prompt}
+pdflatex sampleutf8
+makeglossaries sampleutf8
+pdflatex sampleutf8
+\end{prompt}
+The explicit \gls{xindy} call is
+(no line breaks):
+\begin{prompt}\raggedright
+xindy -L english -C utf8 -I xindy -M sampleutf8 -t sampleutf8.glg -o sampleutf8.gls sampleutf8.glo
+\end{prompt}
+
+If you remove the \pkgopt{xindy} option from \texttt{sampleutf8.tex}
+and do:
+\begin{prompt}
+pdflatex sampleutf8
+makeglossaries sampleutf8
+pdflatex sampleutf8
+\end{prompt}
+or
+\begin{prompt}
+pdflatex sampleutf8
+makeglossaries-lite sampleutf8
+pdflatex sampleutf8
+\end{prompt}
+you will see that the entries that start with an \gls{exlatinchar}
+now appear in the symbols group, and the word \qt{man\oe uvre} is now
+after \qt{manor} instead of before it. If you want to explicitly
+call \gls{makeindex} (no line breaks):
+\begin{prompt}
+makeindex -s sampleutf8.ist -t sampleutf8.glg -o sampleutf8.gls sampleutf8.glo
+\end{prompt}
+
+\bibglsnote
+If you want to switch to \gls{bib2gls}, you first need to switch to
+\gls{glossaries-extra} but replace \pkgopt{xindy} with
+\pkgopt*{record}:
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{record}},\xtrfont{postdot},\xtrfont{stylemods},style=listgroup]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+Note that you don't need the \pkgopt{nonumberlist} option with
+\gls{bib2gls}. You can instruct \gls{bib2gls} to simply not save the
+\glspl{numberlist}, but in this case there won't be any locations as
+there's no actual indexing.
+
+The entries need to be converted to the \filetype{bib} format
+required by \gls{bib2gls}:
+\begin{prompt}
+convertgls2bib -{}-preamble-only -{}-texenc UTF-8 -{}-bibenc UTF-8 sampleutf8.tex entries.bib
+\end{prompt}
+Note the first line of the \nolinkurl{entries.bib} file:
+\begin{alltt}
+\% Encoding: UTF-8
+\end{alltt}
+This is the encoding of the \filetype{bib} file. It doesn't have to
+match the encoding of the \filetype{tex} file, but it's generally
+better to be consistent. When \gls{bib2gls} parses this file, it
+will look for this encoding line.
+(If the \texttt{-{}-texenc} and \texttt{-{}-bibenc} switches aren't
+used, \gls{convertgls2bib} will assume your system's default
+encoding. See the \gls{bib2gls} manual for further details.)
+
+Next replace \cs{makeglossaries} with:
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,\resourceopt{selection}=\strong{all}]
+\end{alltt}
+and remove all the \cs{newglossaryentry} commands.
+
+Iterative commands like \ics{glsaddall} don't work with
+\gls{bib2gls}. Instead, you can select all entries using the
+\resourceopt[all]{selection} option.
+This is actually better than \cs{glsaddall}, which enforces
+the selection of all entries by indexing each entry. As a result,
+with \gls{makeindex} and \gls{xindy} (and \opt1), every entry will
+have the same location (which is the location of the \cs{glsaddall}
+command, in this case page~1). With \resourceopt[all]{selection},
+\gls{bib2gls} will automatically selection all entries even if they
+don't have any records (indexing information) so in this case there
+are no \glspl{numberlist}.
+
+Finally, replace \cs{printglossaries} with
+\ics*{printunsrtglossaries}. The build process is now:
+\begin{prompt}
+pdflatex sampleutf8
+bib2gls -{}-group sampleutf8
+pdflatex sampleutf8
+\end{prompt}
+\gls{bib2gls} picks up the encoding of the \filetype{tex} file from
+the \filetype{aux} file:
+\begin{alltt}
+\ics*{glsxtr@texencoding}\mgroup{utf8}
+\end{alltt}
+If you experience any encoding issues, check the \filetype{aux} file for
+this command and check the \filetype{bib} file for the encoding
+comment line. Also check \gls{bib2gls}['s] \filetype{glg} transcript file
+for encoding messages, which should look like:
+\begin{verbatim}
+TeX character encoding: UTF-8
+\end{verbatim}
+
+The document language, if it has been set, is also added to the \filetype{aux} file when
+the \pkgopt{record} option is used. In this case, no language
+package has been used, so \gls{bib2gls} will fallback on the system's default
+locale. If no sort method is set, the entries will be sorted
+according to the document language, if set, or the default locale.
+You can specify a specific locale using the \resourceopt{sort} key
+with a locale tag identifier. For example:
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,\resourceopt{selection}=\strong{all},\strong{\xtrfont{sort}=de-CH-1996}]
+\end{alltt}
+(Swiss German new orthography) or:
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,\resourceopt{selection}=\strong{all},\strong{\xtrfont{sort}=is}]
+\end{alltt}
+(Icelandic).
+
+\section{No Indexing Application (Option 1)}
+\label{sec:samplesnoidx}
+
+\exitem{-noidxapp} This document illustrates how to use the
+\styfmt{glossaries} package without an external \gls{indexingapp} (\opt1).
+To create the complete document, you need to do:
+\begin{prompt}
+pdflatex sample-noidxapp
+pdflatex sample-noidxapp
+\end{prompt}
+Note the need to group the accent command that occurs at the start
+of the \gloskey{name}:
+\begin{alltt}
+\cs{newglossaryentry}\mgroup{elite}\mgroup{\%
+ name=\mgroup{\strong{\mgroup{\ics{'}e}}lite},
+ description=\mgroup{select group of people}
+}
+\end{alltt}
+This is necessary to allow the term to work with \ics{Gls}.
+Notice also how the \glspl{numberlist} can't be compacted into
+ranges. For example, the list \qt{1, 2, 3} would be converted to
+\qt{1--3} with a proper indexing application (\optsor23 or, with
+\gls{glossaries-extra}, \opt4).
+
+The larger the list of entries, the longer the document build time.
+This method is very inefficient for large glossaries. See
+\gallery{glossaries-performance.shtml}{Gallery: glossaries performance} for a comparison.
+
+\exitem{-noidxapp-utf8} As the previous example, except that it uses
+the \sty{inputenc} package.
+To create the complete document, you need to do:
+\begin{prompt}
+pdflatex sample-noidxapp-utf8
+pdflatex sample-noidxapp-utf8
+\end{prompt}
+This method is unsuitable for sorting languages with
+\glspl{exlatinalph} or \glspl{nonlatinalph}. Use \optsor34 instead.
+
+\section{Other}
+\label{sec:samplesother}
+
+\exitem{4col} This document illustrates
+a four column glossary where the entries have a symbol in addition
+to the name and description. To create the complete document, you
+need to do:
+\begin{prompt}
+pdflatex sample4col
+makeglossaries sample4col
+pdflatex sample4col
+\end{prompt}
+or
+\begin{prompt}
+pdflatex sample4col
+makeglossaries-lite sample4col
+pdflatex sample4col
+\end{prompt}
+The vertical gap between entries is the
+gap created at the start of each group. This can be suppressed
+using the \pkgopt{nogroupskip} package option. (If you switch to
+\gls{bib2gls}, simply omit the \texttt{-{}-group} command line option.)
+
+This example uses the \glostyle{long4colheaderborder}. This style
+doesn't allow multi-line descriptions. You may prefer to use
+\glostyle{altlong4colheaderborder} with long descriptions. However,
+in either case a style that uses \sty{booktabs} is preferable. For
+example, \glostyle{long4col-booktabs} or
+\glostyle{altlongragged4col-booktabs}. Note that this requires
+\sty{glossary-longbooktabs}, which needs to be explicitly loaded.
+The style can only be set once this package has been loaded:
+\begin{alltt}
+\cs{usepackage}\mgroup{glossaries}
+\cs{usepackage}\mgroup{glossary-longbooktabs}
+\cs{setglossarystyle}\mgroup{altlongragged4col-booktabs}
+\end{alltt}
+
+\glsxtrnote
+The \gls{glossaries-extra} package provides a more compact way of
+doing this with the \pkgopt*{stylemods} option:
+\begin{alltt}
+\cs{usepackage}[style=altlongragged4col-booktabs,\xtrfont{stylemods}=\strong{longbooktabs}]
+\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+The \gls{glossaries-extra} package provides additional styles,
+including more \qt{long} styles with the \sty*{glossary-longextra}
+package. For example, the \xtrglostyle{long-name-desc-sym-loc}
+style:
+\begin{alltt}
+\cs{usepackage}[style=\strong{\xtrfont{long-name-desc-sym-loc}},\xtrfont{stylemods}=\strong{longextra}]
+\mgroup{glossaries-extra}
+\end{alltt}
+If you use the \pkgopt*{stylemods} option with an argument, you may
+prefer to use it with \pkgopt{nostyles} to prevent unwanted styles
+from being automatically loaded. For example:
+\begin{alltt}
+\cs{usepackage}[style=\xtrfont{long-name-desc-sym-loc},\strong{\xtrfont{nostyles},}\xtrfont{stylemods}=longextra]
+\mgroup{glossaries-extra}
+\end{alltt}
+See also the
+\gallery{glossaries-styles/}{gallery of predefined styles}.
+
+\exitem{-numberlist} This document illustrates how to reference the
+\gls{numberlist} in the document text. This requires an additional
+\LaTeX\ run:
+\begin{prompt}
+pdflatex sample-numberlist
+makeglossaries sample-numberlist
+pdflatex sample-numberlist
+pdflatex sample-numberlist
+\end{prompt}
+This uses the \pkgopt{savenumberlist} package option, which enables
+\ics{glsentrynumberlist} and \ics{glsdisplaynumberlist}
+(with limitations). The location counter is set to
+\texttt{chapter}, so the \gls{numberlist} refers to the chapter
+numbers.
+\begin{verbatim}
+\usepackage[savenumberlist,counter=chapter]{glossaries}
+\end{verbatim}
+The \gls{numberlist} can't be obtained until \gls{makeindex} (or
+\gls{xindy}) has created the glossary file. The \gls{numberlist} is
+picked up when this file is input by \cs{printglossary} and is then
+saved in the \filetype{aux} file so that it's available on the next
+\LaTeX\ run.
+
+This document contains both commands:
+\begin{alltt}
+This is a \cs{gls}\mgroup{sample} document. \cs{Glspl}\mgroup{sample}
+are discussed in chapters~\strong{\ics{glsdisplaynumberlist}}\mgroup{sample}
+(or \strong{\ics{glsentrynumberlist}}\mgroup{sample}).
+\end{alltt}
+Without \sty{hyperref}, the first list shows as \qt{1--3, 5 \& 6}
+and the second list shows as \qt{1--3, 5, 6}.
+
+Note that you can't use \ics{glsdisplaynumberlist} with
+\sty{hyperref} and \optsor23. If you do, you will get the warning:
+\begin{verbatim}
+Package glossaries Warning: \glsdisplaynumberlist doesn't work with
+hyperref.
+Using \glsentrynumberlist instead
+\end{verbatim}
+Now both lists show as \qt{1--3, 5, 6}.
+
+If you switch to \opt1 (replace \cs{makeglossaries} with
+\cs{makenoidxglossaries} and replace \cs{printglossaries} with
+\cs{printnoidxglossaries}), then the document build is simply:
+\begin{prompt}
+pdflatex sample-numberlist
+pdflatex sample-numberlist
+\end{prompt}
+Now \ics{glsdisplaynumberlist} works with \sty{hyperref},
+however there are no ranges, so the first list shows as \qt{1,
+2, 3, 5, \& 6} and the second list shows as \qt{1, 2, 3, 4, 5, 6}.
+
+\bibglsnote
+If you want to switch to \gls{bib2gls}, you first need to switch to
+\gls{glossaries-extra} (at least v1.42) but remember to include the \pkgopt{record}
+option:
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{record}},counter=chapter]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+Note that the \pkgopt{savenumberlist} option is no longer required.
+Next convert the entry to the \filetype{bib} format required by
+\gls{bib2gls}:
+\begin{prompt}
+convertgls2bib sample-numberlist.tex entries.bib
+\end{prompt}
+Replace \cs{makeglossaries} with:
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries.bib]
+\end{alltt}
+and remove the \cs{newglossaryentry} command from the document
+preamble. Finally, replace \cs{printglossaries} with
+\ics*{printunsrtglossaries}. The build process is now:
+\begin{prompt}
+pdflatex sample-numberlist
+bib2gls sample-numberlist
+pdflatex sample-numberlist
+\end{prompt}
+Now both ranges and hyperlinks work. The first list shows \qt{1--3,
+5, \& 6} and the second list shows \qt{1--3, 5, 6}. You can also
+use:
+\begin{alltt}
+\ics*{glsxtrfieldformatlist}\mgroup{sample}\mgroup{loclist}
+\end{alltt}
+which will show the complete list without ranges \qt{1, 2, 3, 5 \&
+6}.
+
+This method works much better than using the \pkgopt{savenumberlist}
+option because \gls{bib2gls} saves the formatted \gls{numberlist} in the
+\xtrfield{location} field (which is an internal field provided by
+\gls{glossaries-extra} for the benefit of \gls{bib2gls}) and the
+unformatted \gls{numberlist} in the \field{loclist} internal field (which is
+also used by \opt1).
+
+With \optsand23, both \gls{makeindex} and \gls{xindy} simply create a
+file containing the commands to typeset the glossary, which is input
+by \cs{printglossary}. This means that it's quite hard to gather
+information obtained by the \gls{indexingapp}.
+
+\gls{bib2gls}, on the other hand, doesn't write a file containing
+the glossary. It writes a file containing the entry definitions and
+uses internal fields to save the indexing information. The glossary is
+then displayed with \ics*{printunsrtglossary}, which simply iterates
+over all defined entries and fetches the required information from
+those internal fields.
+
+The \ics{glsdisplaynumberlist} and \ics{glsentrynumberlist} commands
+are redefined by \sty{glossaries-extra-bib2gls} to simply access the
+\xtrfield{location} field.
+However, if you want a complete list without ranges you can use:
+\begin{alltt}
+\ics*{glsxtrfieldformatlist}\mgroup{sample}\mgroup{loclist}
+\end{alltt}
+In this example, this produces \qt{1, 2, 3, 5 \& 6}.
+
+Note the difference if you use the \pkgopt+{nameref}{record} package
+option instead of just \pkgopt*{record}.
+
+\exitem{-nomathhyper} This document illustrates how to selectively
+enable and disable entry hyperlinks in \ics{glsentryfmt}. The
+document build is:
+\begin{prompt}
+pdflatex sample-nomathhyper
+makeglossaries sample-nomathhyper
+pdflatex sample-nomathhyper
+\end{prompt}
+This disables the hyperlinks for the main glossary with:
+\begin{alltt}
+\ics{GlsDeclareNoHyperList}\mgroup{main}
+\end{alltt}
+and then redefines \cs{glsentryfmt} so that it adds a hyperlink if
+not in maths mode and the hyperlinks haven't been forced off (with
+the \texttt{\gloskey[glslink]{hyper}\dequals false} key).
+
+\glsxtrnote
+If you want to switch to \gls{glossaries-extra}, then you can
+instead use the hook that comes before the keys are set. The
+preamble is much simpler:
+\begin{alltt}
+\cs{usepackage}\mgroup{\strong{glossaries-extra}}
+
+\cs{makeglossaries}
+
+\cs{renewcommand}\mgroup{\strong{\ics*{glslinkpresetkeys}}}\mgroup{\%
+ \cs{ifmmode} \cs{setkeys}\mgroup{glslink}\mgroup{hyper=false}\cs{fi}
+}
+
+\% entry definition
+\end{alltt}
+
+\exitem{-entryfmt} This document illustrates how to change the
+way an entry is displayed in the text. (This is just a test
+document. For a real document, I recommend you use the \sty{siunitx}
+package to typeset units.) The document build is:
+\begin{prompt}
+pdflatex sample-entryfmt
+makeglossaries sample-entryfmt
+pdflatex sample-entryfmt
+\end{prompt}
+This redefines \ics{glsentryfmt} to add the symbol on
+\gls{firstuse}:
+\begin{alltt}
+\cs{renewcommand}*\mgroup{\cs{glsentryfmt}}\mgroup{\%
+ \ics{glsgenentryfmt}
+ \ics{ifglsused}\mgroup{\cs{glslabel}}\mgroup{}\mgroup{\cs{space} (\strong{\ics{glsentrysymbol}}\mgroup{\cs{glslabel}})}\%
+}
+\end{alltt}
+Note the use of \cs{glsentrysymbol} \emph{not} \cs{glssymbol} (which
+would result in nested \gls{linktext}).
+
+\glsxtrnote
+If you want to switch to the \gls{glossaries-extra} package, you can
+make use of the category post-link hook instead:
+\begin{alltt}
+\cs{usepackage}[\xtrfont{stylemods},style=tree]\mgroup{\strong{glossaries-extra}}
+
+\cs{makeglossaries}
+
+\ics*{glsdefpostlink}\mgroup{\strong{unit}}\mgroup{\ics*{glsxtrpostlinkAddSymbolOnFirstUse}}
+
+\cs{newglossaryentry}\mgroup{distance}\mgroup{
+\xtrfont{category}=\mgroup{\strong{unit}},
+name=distance,
+description=\mgroup{The length between two points},
+symbol=\mgroup{km}}
+\end{alltt}
+Note that in this case the symbol is now outside of the hyperlink.
+
+\exitem{-prefix} This document illustrates the use of the
+\sty{glossaries-prefix} package. An additional run is required to
+ensure the table of contents is up-to-date:
+\begin{prompt}
+pdflatex sample-prefix
+makeglossaries sample-prefix
+pdflatex sample-prefix
+pdflatex sample-prefix
+\end{prompt}
+Remember that the default separator between the prefix and \cs{gls}
+(or one of its variants) is empty, so if a space is required it must
+be inserted at the end of the prefix. However, the \sty{xkeyval}
+package (which is used to parse the \meta{key}\dequals\meta{value}
+lists) trims leading and trailing space from the values, so an
+ordinary space character will be lost.
+\begin{alltt}
+\cs{newglossaryentry}\mgroup{sample}\mgroup{name=\mgroup{sample},
+ description=\mgroup{an example},
+ prefix=\mgroup{a\strong{~}},
+ prefixplural=\mgroup{the\strong{\cs{space}}}%
+}
+
+\cs{newglossaryentry}\mgroup{oeil}\mgroup{name=\mgroup{oeil},
+ plural=\mgroup{yeux},
+ description=\mgroup{eye},
+ prefix=\mgroup{l'},
+ prefixplural=\mgroup{les\strong{\cs{space}}}}
+\end{alltt}
+
+\glsxtrnote
+If you want to convert this example to use \gls{glossaries-extra},
+then (as from v1.42) you can use the \pkgopt*{prefix} option:
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{prefix}},\xtrfont{postdot},acronym]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+(Alternatively load \sty{glossaries-prefix} after
+\gls{glossaries-extra}.) The rest of the document is the same as for
+the base \styfmt{glossaries} package, unless you want to switch to
+using \gls{bib2gls}.
+
+\bibglsnote
+If you want to switch to \gls{bib2gls}, first switch to
+\gls{glossaries-extra} (as above) but make sure you include the
+\pkgopt*{record} package option:
+\begin{alltt}
+\cs{usepackage}[\strong{\xtrfont{record}},\xtrfont{prefix},\xtrfont{postdot},acronym]\mgroup{glossaries-extra}
+\end{alltt}
+Next convert the entries into the \filetype{bib} format required by
+\gls{bib2gls}:
+\begin{prompt}
+convertgls2bib -{}-preamble-only sample-prefix.tex entries.bib
+\end{prompt}
+Replace \cs{makeglossaries} with
+\begin{alltt}
+\ics*{setabbreviationstyle}[acronym]\mgroup{long-short}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries]
+\end{alltt}
+remove the entry definitions from the preamble, and replace
+\begin{alltt}
+\cs{printglossary}[style=plist]
+\cs{printacronyms}
+\end{alltt}
+with
+\begin{alltt}
+\ics*{printunsrtglossary}[style=plist]
+\ics*{printunsrtacronyms}
+\end{alltt}
+The document build is now:
+\begin{prompt}
+pdflatex sample-prefix
+bib2gls sample-prefix
+pdflatex sample-prefix
+\end{prompt}
+
+With \gls{bib2gls} v2.0+, you don't need to manually insert the spaces at
+the end of the prefixes. Instead you can instruct \gls{bib2gls} to
+insert them. To try this out, remove the trailing \verb|~| and
+\cs{space} from the \nolinkurl{entries.bib} file:
+\begin{alltt}
+\atentry{entry}\mgroup{sample,
+ prefix = \mgroup{a},
+ name = \mgroup{sample},
+ description = \mgroup{an example},
+ prefixplural = \mgroup{the}
+}
+
+\atentry{entry}\mgroup{oeil,
+ plural = \mgroup{yeux},
+ prefix = \mgroup{l'},
+ name = \mgroup{oeil},
+ description = \mgroup{eye},
+ prefixplural = \mgroup{les}
+}
+
+\atentry{acronym}\mgroup{svm,
+ prefixfirst = \mgroup{a},
+ prefix = \mgroup{an},
+ short = \mgroup{SVM},
+ long = \mgroup{support vector machine}
+}
+\end{alltt}
+Now add the \resourceopt[\mgroup{space or nbsp}]{append-prefix-field}
+resource option:
+\begin{alltt}
+\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,\strong{\xtrfont{append-prefix-field}=\mgroup{space or nbsp}}]
+\end{alltt}
+See the \gls{bib2gls} manual for further details.
+
+\exitem{accsupp} This document uses the \sty{glossaries-accsupp} package
+(see \sectionref{sec:accsupp}). That package automatically loads
+\styfmt{glossaries} and passes all options to the base package. So
+you can load both packages at once with just:
+\begin{verbatim}
+\usepackage[acronym]{glossaries-accsupp}
+\end{verbatim}
+This provides additional keys that aren't available with just the
+base package, which may be used to provide replacement text. The
+replacement text is inserted using \sty{accsupp}'s
+\ics{BeginAccSupp} and \ics{EndAccSupp} commands. See the
+\sty{accsupp} package for further details of those commands.
+
+Note that this example document is provided to demonstrate
+\sty{glossaries-accsupp} as succinctly as possible. The resulting
+document isn't fully accessible as it's not tagged. See the
+\sty{accessibility} and \sty{tagpdf} packages for further
+information about tagging documents.
+
+It's not essential to use \sty{glossaries-accsupp}. You can simply insert the replacement
+text directly into the field values. For example:
+\begin{verbatim}
+\newglossaryentry{Drive}{
+ name={\BeginAccSupp{Actual=Drive}Dr.\EndAccSupp{}},
+ description={Drive}
+}
+\newglossaryentry{image}{name={sample image},
+ description={an example image},
+ user1={\protect\BeginAccSupp{Alt={a boilerplate image used in
+ examples}}\protect\includegraphics
+ [height=20pt]{example-image}\protect\EndAccSupp{}}
+}
+\end{verbatim}
+However, this can cause interference (especially with
+case-changing). With \sty{glossaries-accsupp} it's possible to
+obtain the field values without the accessibility information if
+required. (If in the future \cs{includegraphics} is given extra
+options to provide replacement text then the image example here
+won't be necessary. However, the example can be adapted for images
+created with \TeX\ code.)
+
+The acronym style is set using:
+\begin{verbatim}
+\setacronymstyle{long-short}
+\end{verbatim}
+The first abbreviation is straightforward:
+\begin{verbatim}
+\newacronym{eg}{e.g.}{for example}
+\end{verbatim}
+The \gloskey{shortaccess} replacement text is automatically set to
+the long form. The next abbreviation is awkward as the long form contains
+formatting commands which can't be included in the replacement text.
+This means that the \gloskey{shortaccess} key must be supplied:
+\begin{alltt}
+\cs{newacronym}[\strong{shortaccess}=\mgroup{TiKZ ist kein Zeichenprogramm}]
+\mgroup{tikz}\mgroup{Ti\cs{emph}\mgroup{k}Z}\mgroup{Ti\cs{emph}\mgroup{k}Z ist \cs{emph}\mgroup{kein} Zeichenprogramm}
+\end{alltt}
+In the above two cases, the short form obtained in \cs{gls} will use
+the \qt{E} PDF element.
+
+By way of comparison, there are some entries that are technically
+abbreviations but are defined using \ics{newglossaryentry} instead
+of \ics{newacronym}. The replacement text is provided in the
+\gloskey{access} key:
+\begin{alltt}
+\cs{newglossaryentry}\mgroup{Doctor}\mgroup{name=Dr,description=\mgroup{Doctor},\strong{access}=\mgroup{Doctor}}
+\cs{newglossaryentry}\mgroup{Drive}\mgroup{name=\mgroup{Dr.},plural=\mgroup{Drvs},description=\mgroup{Drive},
+ \strong{access}=\mgroup{Drive}}
+\end{alltt}
+These will use PDF's \qt{ActualText} element (not \qt{E}).
+
+The next entry is a symbol (the integration symbol $\int$). This
+could be defined simply as:
+\begin{verbatim}
+\newglossaryentry{int}{name={int},description={integral},
+ symbol={\ensuremath{\int}}}
+\end{verbatim}
+and then referenced in the text like this:
+\begin{verbatim}
+Symbol: \gls{int} (\glssymbol{int}).
+\end{verbatim}
+This results in the text \qt{Symbol: integral ($\int$).} However if you
+copy and paste this from the PDF you will find the resulting text is
+\qt{Symbol: int (R).} This is what's actually read out by the
+text-to-speech system.
+
+It would be better if the actual text was the Unicode character
+0x222B. This would not only assist the text-to-speech system but
+also make it easier to copy and paste the text. The simplest method
+is to identify the character by its hexadecimal code, but in order
+to do this the \ics{BeginAccSupp} command needs to have the options adjusted.
+
+In order to determine whether to use \qt{E}, \qt{ActualText} or
+\qt{Alt} for a particular field, \sty{glossaries-accsupp} will check
+if the command \csmeta{gls}{field}{accsupp} exists (where
+\meta{field} is the internal field label, see \tableref{tab:fieldmap}). Only two of
+these commands are predefined: \ics{glsshortaccsupp} and
+\ics{glsshortplaccsupp}, which is why the \gloskey{shortaccess}
+field uses \qt{E}. If the given command doesn't exist then the
+generic \ics{glsaccsupp} command is used instead.
+
+This means that in order to simply set \gloskey{symbolaccess} to the
+hexadecimal character code, I need to provide a command called
+\ics{glssymbolaccsupp}:
+\begin{alltt}
+\cs{newcommand}\mgroup{\cs{gls\strong{symbol}accsupp}}[2]\mgroup{\%
+ \ics{glsaccessibility}[\strong{method=hex,unicode}]\mgroup{\strong{ActualText}}\mgroup{\#1}\mgroup{\#2}\%
+}
+\end{alltt}
+Now I can adjust the definition of the \texttt{int} entry:
+\begin{alltt}
+\cs{newglossaryentry}\mgroup{int}\mgroup{name=\mgroup{int},description=\mgroup{integral},
+ symbol=\mgroup{\cs{ensuremath}\mgroup{\cs{int}}},\strong{symbolaccess=\mgroup{222B}}
+}
+\end{alltt}
+
+The final entry has an image stored in the \gloskey{user1} key. (The
+image file is provided with the \sty{mwe} package.) This should use
+\qt{Alt} instead of \qt{ActualText} so I need to define
+\ics{glsuseriaccsupp}:
+\begin{alltt}
+\cs{newcommand}\mgroup{\cs{gls\strong{useri}accsupp}}[2]\mgroup{\%
+ \ics{glsaccessibility}\mgroup{\strong{Alt}}\mgroup{\#1}\mgroup{\#2}\%
+}
+\end{alltt}
+The image description is provided in the \gloskey{user1access} key:
+\begin{alltt}
+\cs{newglossaryentry}\mgroup{sampleimage}\mgroup{name=\mgroup{sample image},
+ description=\mgroup{an example image},
+ user1=\mgroup{\cs{protect}\ics{includegraphics}[height=20pt]\mgroup{example-image}},
+ \strong{user1access}=\mgroup{a boilerplate image used in examples}
+}
+\end{alltt}
+(Note the need to protect the fragile \ics{includegraphics}. The alternative is
+to use \cs{glsnoexpandfields} before defining the command. See
+\sectionref{sec:expansion}.)
+
+If you try this example and inspect the PDF\footnote{You can either
+uncompress the PDF file and view it in a text editor or you can use
+a tool such as the PDFDebugger provided with
+\href{https://pdfbox.apache.org/}{PDFBox}.}\ then you will find
+content like:
+\begin{verbatim}
+/Span << /ActualText (Doctor) >> BDC
+ BT
+ /F8 9.9626 Tf
+ 73.102 697.123 Td
+ [ (Dr) ] TJ
+ ET
+EMC
+\end{verbatim}
+This shows that \qt{ActualText} was used for \verb|\gls{Doctor}|.
+The integral symbol ($\int$) created with \verb|\glssymbol{int}| is:
+\begin{verbatim}
+/Span << /ActualText (\376\377"+) >> BDC
+ BT
+ /F1 9.9626 Tf
+ 97.732 650.382 Td
+ [ (R) ] TJ
+ ET
+EMC
+\end{verbatim}
+Again, \qt{ActualText} has been used, but the character code has
+been supplied. The image created with \verb|\glsuseri{sampleimage}| is:
+\begin{verbatim}
+/Span << /Alt (a boilerplate image used in examples) >> BDC
+ 1 0 0 1 106.588 618.391 cm
+ q
+ 0.08301 0 0 0.08301 0 0 cm
+ q
+ 1 0 0 1 0 0 cm
+ /Im1 Do
+ Q
+ Q
+EMC
+\end{verbatim}
+This shows that \qt{Alt} has been used.
+
+The first use of \verb|\gls{eg}| produces the long form (not
+reproduced here) followed by the short form:
+\begin{verbatim}
+/Span << /E (for example) >> BDC
+ BT
+ /F8 9.9626 Tf
+ 161.687 563.624 Td
+ [ (e.g.) ] TJ
+ ET
+EMC
+\end{verbatim}
+The subsequent use also has the \qt{E} element:
+\begin{verbatim}
+/Span << /E (for example) >> BDC
+ BT
+ /F8 9.9626 Tf
+ 118.543 551.669 Td
+ [ (e.g.) ] TJ
+ ET
+EMC
+\end{verbatim}
+Similarly for \verb|\acrshort{eg}|. You can also use the
+\pkgopt[showaccsupp]{debug} package option. This will show the
+replacement text in the document, but note that this is the content before
+it's processed by \cs{BeginAccSupp}.
+
+If the \ics{setacronymstyle} command is removed (or commented out)
+then the result would be different. The \gls{firstuse} of \cs{gls} uses \qt{E} for
+the short form but the subsequent use has \qt{ActualText} instead.
+This is because without \ics{setacronymstyle} the original acronym
+mechanism is used, which is less sophisticated than the newer
+acronym mechanism that's triggered with \ics{setacronymstyle}.
+
+\begin{important}
+If you want to convert this example so that it uses
+\gls{glossaries-extra}, make sure you have at least version 1.42 of
+the extension package.
+\end{important}
+
+\glsxtrnote
+If you want to convert this example so that it uses
+\gls{glossaries-extra}, you need to replace the explicit loading of
+\sty{glossaries-accsupp} with an implicit load through the
+\pkgopt*{accsupp} package option:
+\begin{alltt}
+\cs{usepackage}[\xtrfont{abbreviations},\strong{\xtrfont{accsupp}}]\mgroup{\strong{glossaries-extra}}
+\end{alltt}
+I'm switching from \ics{newacronym} to \ics*{newabbreviation}, which
+means that the default category is \cat{abbreviation} and also the
+file extensions are different. If you are using \gls{makeglossaries}
+or \gls{makeglossaries-lite.lua} you don't need to worry about it.
+However, if you're not using those helper scripts then you will need
+to adjust the file extensions in your document build process.
+
+The style command \texttt{\cs{setacronymstyle}\mgroup{long-short}} needs
+to be replaced with:
+\begin{alltt}
+\ics{setabbreviationstyle}\mgroup{long-short}
+\end{alltt}
+This is actually the default so you can simply delete the
+\cs{setacronymstyle} line. Substitute the two instances of
+\ics{newacronym} with \ics*{newabbreviation}. For example:
+\begin{alltt}
+\strong{\ics*{newabbreviation}}\mgroup{eg}\mgroup{e.g.}\mgroup{for example}
+\end{alltt}
+Note that for the \texttt{tikz} entry you can now remove the explicit assignment of
+\gloskey{shortaccess} with \gls{glossaries-extra} v1.42 as it will
+strip formatting commands like \cs{emph}:
+\begin{alltt}
+\ics*{newabbreviation}
+ \mgroup{tikz}\mgroup{Ti\cs{emph}\mgroup{k}Z}\mgroup{Ti\cs{emph}\mgroup{k}Z ist \cs{emph}\mgroup{kein} Zeichenprogramm}
+\end{alltt}
+It's also necessary to replace \cs{acrshort}, \cs{acrlong} and \cs{acrfull} with
+\ics*{glsxtrshort}, \ics*{glsxtrlong} and \ics*{glsxtrfull}.
+
+You may notice a slight difference from the original example. The
+\gloskey{shortaccess} field now shows \meta{long} (\meta{short})
+instead of just \meta{long}. This is because \gls{glossaries-extra}
+redefines \ics{glsdefaultshortaccess} to include the short form.
+
+Now that the extension package is being used, there are some other
+modifications that would tidy up the code and fix a few issues.
+
+The \qt{Doctor} and \qt{Drive} entries should really be defined as
+abbreviations but they shouldn't be expanded on first use. The
+\abbrstyle{short-nolong} style can achieve this and it happens to be
+the default style for the \cat{acronym} category. This means that
+you can simply replace the \qt{Doctor} definition with:
+\begin{alltt}
+\ics{newacronym}\mgroup{Doctor}\mgroup{Dr}\mgroup{Doctor}
+\end{alltt}
+The \gls{firstuse} of \verb|\gls{Doctor}| is just \qt{Dr}. This
+means that the \qt{E} element will be used instead of \qt{ActualText}.
+Now I don't need to supply the accessibility text as its obtained
+from the long form.
+
+The \qt{Drive} entry can be similarly defined but it has the awkward
+terminating full stop. This means that I had to omit the end of
+sentence terminator in:
+\begin{verbatim}
+\gls{Doctor} Smith lives at 2, Blueberry \gls{Drive}
+\end{verbatim}
+This looks odd when reading the document source and it's easy to
+forgot. This is very similar to the situation in the
+\samplefile{-dot-abbr} example. I can again use the
+\attr{discardperiod} attribute, but I need to assign a different
+category so that it doesn't interfere with the \qt{Doctor} entry.
+
+The category is simply a label that's used in the construction of
+some internal command names. This means that it must be fully
+expandable, but I can choose whatever label I like (\cat{general},
+\cat{abbreviation}, \cat{acronym}, \cat{index}, \cat{symbol} and
+\cat{number} are used by various commands provided by
+\gls{glossaries-extra}).
+
+In this case, I've decided to have a category called \texttt{shortdotted}
+to indicate an abbreviation that ends with a
+dot but only the short form is shown on \gls{firstuse}:
+\begin{alltt}
+\ics*{setabbreviationstyle}[shortdotted]\mgroup{short-nolong-noreg}
+\ics*{glssetcategoryattribute}\mgroup{shortdotted}\mgroup{discardperiod}\mgroup{true}
+\ics*{newabbreviation}[category=shortdotted]\mgroup{Drive}\mgroup{Dr.\cs{@}}\mgroup{Drive}
+\end{alltt}
+In the \samplefile{-dot-abbr} example, I also used the
+\attr{insertdots} attribute to automatically insert the dots and add
+the space factor (which is adjusted if \attr{discardperiod} discards
+a period). In this case I'm inserting the dot manually so I've also
+added the space factor with \ics{@} in case the abbreviation is used
+mid-sentence. For example:
+\begin{verbatim}
+\gls{Doctor} Smith lives at 2, Blueberry \gls{Drive}. Next sentence.
+
+\gls{Doctor} Smith lives at 2, Blueberry \gls{Drive} end of sentence.
+\end{verbatim}
+(The spacing is more noticeable if you first switch to a monospaced
+font with \cs{ttfamily}.)
+
+The \qt{e.g.}\ abbreviation similarly ends with a dot. It's not
+usual to write \qt{for example (e.g.)}\ in a document, so it really
+ought to have the same \texttt{shortdotted} category, but it has a
+long-short form for illustrative purposes in this test document. In
+this case I need to choose another category so that I can apply a
+different style. For example:
+\begin{alltt}
+\ics*{setabbreviationstyle}[longshortdotted]\mgroup{long-short}
+\ics*{glssetcategoryattribute}\mgroup{longshortdotted}\mgroup{discardperiod}\mgroup{true}
+\ics*{newabbreviation}[category=longshortdotted]\mgroup{e.g.}\mgroup{e.g.\cs{@}}\mgroup{for
+example}
+\end{alltt}
+
+To further illustrate categories, let's suppose the symbol and image
+should be in the \gloskey{name} field instead of the
+\gloskey{symbol} and \gloskey{user1} fields. Now the
+\cs{glssymbolaccsupp} and \cs{glsuseriaccsupp} commands won't be
+used. I can't deal with both cases if I just provide
+\cs{glsnameaccsupp}.
+
+I could provide category-field versions, such as
+\xtrfont{\cs{glsxtrsymbolnameaccsupp}}, but remember that this only covers
+accessing the \gloskey{name} field, which is typically only done in
+the glossary. I would also need similar commands for the
+\gloskey{first}, \gloskey{firstplural}, \gloskey{text} and
+\gloskey{plural} keys. This is quite complicated, but since I don't
+need to worry about any of the other fields it's simpler to just
+provide the \csmeta*{glsxtr}{category}{accsupp} version:
+\begin{alltt}
+\cs{newcommand}\mgroup{\xtrfont{\cs{glsxtr\strong{symbol}accsupp}}}[2]\mgroup{\%
+ \ics{glsaccessibility}[method=hex,unicode]\mgroup{ActualText}\mgroup{\#1}\mgroup{#2}\%
+}
+\cs{newcommand}\mgroup{\xtrfont{\cs{glsxtr\strong{image}accsupp}}}[2]\mgroup{\%
+ \ics{glsaccessibility}\mgroup{Alt}\mgroup{\#1}\mgroup{\#2}\%
+}
+
+\cs{newglossaryentry}\mgroup{int}\mgroup{\strong{\xtrfont{category}=symbol},
+ \strong{name}=\mgroup{\cs{ensuremath}\mgroup{\cs{int}}},\strong{access}=\mgroup{222B},
+ description=\mgroup{integral}
+}
+
+\cs{newglossaryentry}\mgroup{sampleimage}\mgroup{\strong{\xtrfont{category}=image},
+ description=\mgroup{an example image},
+ \strong{name}=\mgroup{\cs{protect}\cs{includegraphics}[height=20pt]\mgroup{example-image}},
+ \strong{access}=\mgroup{a boilerplate image used in examples}
+}
+\end{alltt}
+If it's necessary to provide support for additional fields, then the
+category-field command \csmetameta*{glsxtr}{category}{}{field}{accsupp} could be used to
+override the more general category command \csmeta*{glsxtr}{category}{accsupp}.
+
+\exitem{-ignored} This document defines an ignored glossary for
+common terms that don't need a definition. The document build is:
+\begin{prompt}
+pdflatex sample-ignored
+makeglossaries sample-ignored
+pdflatex sample-ignored
+\end{prompt}
+A new \qt{ignored} glossary is defined with:
+\begin{alltt}
+\ics{newignoredglossary}\mgroup{common}
+\end{alltt}
+There are no associated files with an ignored glossary. An entry is defined with
+this as its glossary type:
+\begin{verbatim}
+\newglossaryentry{commonex}{type=common,name={common term}}
+\end{verbatim}
+Note that the \gloskey{description} key isn't required. This term
+may be referenced with \cs{gls} (which is useful for consistent
+formatting) but it won't be indexed.
+
+\exitem{-entrycount} This document uses \ics{glsenableentrycount}
+and \ics{cgls} (described in \sectionref{sec:enableentrycount})
+so that acronyms only used once don't appear in the list of
+acronyms. The document build is:
+\begin{prompt}
+pdflatex sample-entrycount
+pdflatex sample-entrycount
+makeglossaries sample-entrycount
+pdflatex sample-entrycount
+\end{prompt}
+Note the need to call \LaTeX\ twice before \gls{makeglossaries}, and
+then a final \LaTeX\ call is required at the end.
+
+\begin{xtr}
+The \gls{glossaries-extra} package has additions that extend this
+mechanism and comes with some other sample files related to entry counting.
+\end{xtr}
+
+\begin{bib2gls}
+If you switch to \gls{bib2gls} you can use record counting instead.
+See the \gls{bib2gls} manual for further details.
+\end{bib2gls}
\chapter{Troubleshooting}
\label{sec:trouble}