%\iffalse
% glossaries.dtx generated using makedtx version 1.2 (c) Nicola Talbot
% Command line args:
%   -comment ".*\.perl"
%   -comment ".*\.tex"
%   -src "glossaries\.sty\Z=>glossaries.sty"
%   -src "glossaries-prefix.sty\Z=>glossaries-prefix.sty"
%   -src "(glossary-.+)\.(sty)\Z=>\1.\2"
%   -src "(glossaries-compatible-207)\.(sty)\Z=>\1.\2"
%   -src "(glossaries-compatible-307)\.(sty)\Z=>\1.\2"
%   -src "(glossaries-accsupp)\.(sty)\Z=>\1.\2"
%   -src "(glossaries-babel)\.(sty)\Z=>\1.\2"
%   -src "(glossaries-polyglossia)\.(sty)\Z=>\1.\2"
%   -src "(example-glossaries-.*\.tex)\Z=>\1"
%   -src "(glossaries-2020-03-19\.sty)\Z=>\1"
%   -src "(.*\.perl)\Z=>\1"
%   -codetitle "Main Package Code"
%   -macrocode ".*\.perl"
%   -macrocode ".*\.tex"
%   -author "Nicola Talbot"
%   -doc "glossaries-manual.tex"
%   -setambles ".*\.perl=>\nopreamble\nopostamble"
%   -setambles ".*\.tex=>\nopreamble\nopostamble"
%   -section "chapter"
%   glossaries
% Created on 2021/11/1 18:45
%\fi
%\iffalse
%<*package>
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%</package>
%\fi
% \iffalse
% Doc-Source file to use with LaTeX2e
% Copyright (C) 2021 Nicola Talbot, all rights reserved.
% \fi
% \iffalse
%<*driver>
\documentclass[report]{nlctdoc}

\DeleteShortVerb{|}

\iffalse
glossaries-manual.tex is a stub file used by makedtx to create
glossaries.dtx
\fi

\usepackage{alltt}
\usepackage{pifont}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[colorlinks,
            bookmarks,
            hyperindex=false,
            pdfauthor={Nicola L.C. Talbot},
            pdftitle={glossaries.sty: LaTeX2e Package to Assist Generating Glossaries},
            pdfkeywords={LaTeX,package,glossary,acronyms}]{hyperref}
\usepackage{glossaries-extra}

\RecordChanges
\setlength\IndexMin{100pt}

\makeglossaries

\renewcommand*{\main}[1]{\underline{\hyperpage{#1}}}
\renewcommand*{\usage}[1]{\textit{\hyperpage{#1}}}
\newcommand*{\htextbf}[1]{\textbf{\hyperpage{#1}}}
\newcommand*{\itermdef}[1]{\index{#1|htextbf}}

\newglossaryentry{xindy}{
  name={\appfmt{xindy}\index{xindy|htextbf}},
  sort={xindy},
  text={\protect\app{xindy}},
  description={An flexible indexing application with multilingual
  support written in Perl}
}

\newglossaryentry{makeindex}{%
  name={\appfmt{makeindex}\index{makeindex|htextbf}},%
  sort={makeindex},%
  text={\protect\app{makeindex}},%
  description={An indexing application},
}

\let\glsd\glsuseri
\let\glsation\glsuserii

\newglossaryentry{firstuse}{%
  name={First use\ifirstuse},
  sort={first use},%
  text={first use},%
  user1={first used},
  description={The first time a glossary entry is used (from the start
  of the document or after a reset) with one of the
  following commands: \ics{gls}, \ics{Gls}, \ics{GLS}, \ics{glspl},
  \ics{Glspl}, \ics{GLSpl} or \ics{glsdisp}.
  \glsseeformat{firstuseflag,firstusetext}{}\nopostdesc}%
}

\newglossaryentry{firstuseflag}{%
name={First use flag\ifirstuseflag},
sort={first use flag},%
text={first use flag},%
description={A conditional that determines whether or not the entry
has been used according to the rules of \gls{firstuse}}%
}

\newglossaryentry{firstusetext}{%
name={First use text\ifirstusetext},
sort={first use text},%
text={first use text},%
description={The text that is displayed on \gls{firstuse}, which is
governed by the \gloskey{first} and \gloskey{firstplural} keys of
\ics{newglossaryentry}. (May be overridden by
\ics{glsdisp}.)\nopostdesc}%
}

\doxitem{Option}{option}{package options}
\doxitem{GlsKey}{key}{glossary keys}
\doxitem{Style}{style}{glossary styles}
\doxitem{Counter}{counter}{glossary counters}
\doxitem{AcrStyle}{acrstyle}{acronym styles}

\setcounter{IndexColumns}{2}

\CheckSum{34319}

\newcommand*{\ifirstuse}{\iterm{first use}}
\newcommand*{\firstuse}{\gls{firstuse}}
\newcommand*{\firstuseflag}{\gls{firstuseflag}}
\newcommand*{\firstusetext}{\gls{firstusetext}}

\newcommand*{\ifirstuseflag}{\iterm{first use>flag}}
\newcommand*{\ifirstusetext}{\iterm{first use>text}}

\newcommand*{\istkey}[1]{\appfmt{#1}\index{makeindex=\appfmt{makeindex}>#1=\texttt{#1}|hyperpage}}
\newcommand*{\locfmt}[1]{\texttt{#1}\SpecialMainIndex{#1}}
\newcommand*{\mkidxspch}{\index{makeindex=\appfmt{makeindex}>special characters|hyperpage}}

\newcommand*{\igloskey}[2][newglossaryentry]{\icsopt{#1}{#2}}
\newcommand*{\gloskey}[2][newglossaryentry]{\csopt{#1}{#2}}

\newcommand*{\glostyle}[1]{\textsf{#1}\index{glossary styles:>#1={\protect\ttfamily#1}|main}}


\begin{document}
\DocInput{glossaries.dtx}
\end{document}
%</driver>
%\fi
%\MakeShortVerb{"}
%
% \title{Documented Code For glossaries v4.49}
% \author{Nicola L.C. Talbot\\[10pt]
%Dickimaw Books\\
%\url{http://www.dickimaw-books.com/}}
%
% \date{2021-11-01}
% \maketitle
%
%This is the documented code for the \styfmt{glossaries} package.
%This bundle comes with the following documentation:
%\begin{description}
%\item[\url{glossariesbegin.pdf}] 
%If you are a complete beginner, start with \qt{The glossaries
%package: a guide for beginners}.
%
%\item[\url{glossary2glossaries.pdf}] 
%If you are moving over from the obsolete \sty{glossary} package, 
%read \qt{Upgrading from the glossary package to the
%glossaries package}.
%
%\item[\url{glossaries-user.pdf}]
%For the main user guide, read \qt{glossaries.sty v4.49:
%\LaTeX2e\ Package to Assist Generating Glossaries}.
%
%\item[\url{mfirstuc-manual.pdf}]
%The commands provided by the \sty{mfirstuc} package are briefly
%described in \qt{mfirstuc.sty: uppercasing first letter}.
%
%\item[glossaries-code.pdf]
%This document is for advanced users wishing to know more about the
%inner workings of the \styfmt{glossaries} package.
%
%\item[INSTALL] Installation instructions.
%
%\item[CHANGES] Change log.
%
%\item[README.md] Package summary.
%
%\end{description}
%
%The user level commands described in the user manual
%(glossaries-user.pdf) may be considered ``future-proof''. Even if
%they become deprecated, they should still work for
%old documents (although they may not work in a document that also
%contains new commands introduced since the old commands were
%deprecated, and you may need to specify a compatibility mode).
%
%The internal commands in \emph{this} document that aren't documented in the
%\emph{user manual} should not be considered future-proof and are liable to
%change. If you want a new user level command, you can post a feature
%request at \url{http://www.dickimaw-books.com/feature-request.html}.
%If you are a package writer wanting to integrate your package with
%\styfmt{glossaries}, it's better to request a new user level command
%than to hack these internals.
%
%\tableofcontents
%
%\StopEventually{%
%  \printglossaries
%  \PrintChanges
%  \PrintIndex
%}
%
%
%
%\chapter{Main Package Code}
%\iffalse
%    \begin{macrocode}
%<*glossaries.sty>
%    \end{macrocode}
%\fi
%\label{sec:code}
% \section{Package Definition}
% This package requires \LaTeXe.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
%    \end{macrocode}
% Rollback releases:
%    \begin{macrocode}
\DeclareRelease{v4.46}{2020-03-19}{glossaries-2020-03-19.sty}
\DeclareCurrentRelease{v4.49}{2021-11-01}
%    \end{macrocode}
% Declare package:
%    \begin{macrocode}
\ProvidesPackage{glossaries}[2021/11/01 v4.49 (NLCT)]
%    \end{macrocode}
%\changes{4.18}{2015-09-09}{split mfirstuc into separate bundle}
% Required packages:
%    \begin{macrocode}
\RequirePackage{ifthen}
\RequirePackage{xkeyval}[2006/11/18]
\RequirePackage{mfirstuc}
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{Now requires textcase}
% The \sty{textcase} package has much better case changing handling,
% so use \cs{MakeTextUppercase} instead of \cs{MakeUppercase}
%    \begin{macrocode}
\RequirePackage{textcase}
\renewcommand*{\mfirstucMakeUppercase}{\MakeTextUppercase}%
%    \end{macrocode}
%    \begin{macrocode}
\RequirePackage{xfor}
%    \end{macrocode}
%\changes{3.04}{2012-11-18}{added datatool-base as a required
%package}
%    \begin{macrocode}
\RequirePackage{datatool-base}
%    \end{macrocode}
%\changes{1.1}{2008-02-22}{amsgen now loaded (\cs{new@ifnextchar} needed)}
% Need to use \cs{new@ifnextchar} instead of \cs{@ifnextchar} in 
% commands that have a final optional argument (such as \ics{gls})
% so require \isty{amsgen}.
% Thanks to Morten~H\o gholm for suggesting this. (This has
% replaced using the \sty{xspace} package.)
%    \begin{macrocode}
\RequirePackage{amsgen}
%    \end{macrocode}
%\changes{3.0}{2011-04-02}{etoolbox now loaded}
% As from v3.0, now loading \sty{etoolbox} (this is now redundant as
% \sty{datatool-base} loads \sty{etoolbox}):
%    \begin{macrocode}
\RequirePackage{etoolbox}
%    \end{macrocode}
%\changes{3.04}{2012-11-18}{Added check for doc package}
% Check if \sty{doc} has been loaded.
%\begin{macro}{\if@gls@docloaded}
%    \begin{macrocode}
\newif\if@gls@docloaded
%    \end{macrocode}
%\end{macro}
%    \begin{macrocode}
\@ifpackageloaded{doc}%
{%
  \@gls@docloadedtrue
}%
{%
  \@ifclassloaded{nlctdoc}{\@gls@docloadedtrue}{\@gls@docloadedfalse}%
}
\if@gls@docloaded
%    \end{macrocode}
% \cs{doc} has been loaded, so some modifications need to be made to
% ensure both packages can work together. The amount of conflict has
% been reduced as from v4.11 and no longer involves patching
% internal commands.
%
%\cs{PrintChanges} needs to use \sty{doc}'s version of
%\env{theglossary}, so save that.
%\begin{macro}{\glsorg@theglossary}
%\changes{3.04}{2012-11-18}{new}
%    \begin{macrocode}
  \let\glsorg@theglossary\theglossary
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsorg@endtheglossary}
%\changes{3.04}{2012-11-18}{new}
%    \begin{macrocode}
  \let\glsorg@endtheglossary\endtheglossary
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\PrintChanges}
% Now redefine \cs{PrintChanges} so that it uses the original
% \env{theglossary} environment.
%\changes{3.04}{2012-11-18}{new}
%    \begin{macrocode}
  \let\glsorg@PrintChanges\PrintChanges
  \renewcommand{\PrintChanges}{%
    \begingroup
      \let\theglossary\glsorg@theglossary
      \let\endtheglossary\glsorg@endtheglossary
      \glsorg@PrintChanges
    \endgroup
  }
%    \end{macrocode}
%\end{macro}
% End of doc stuff.
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
% \section{Package Options}\label{sec:pkgopt}
%\begin{option}{debug}
%\changes{4.24}{2016-05-27}{new}
% Switch on debug mode. This will also cancel the \pkgopt{nowarn}
% option. This is now a choice key.
%\changes{4.45}{2020-02-13}{added debug=showaccsupp}
%\changes{4.41}{2018-07-23}{changed \cs{val} and \cs{nr} to
%\cs{gls@debug@val} and \cs{gls@debug@nr}}
%    \begin{macrocode}
\newif\if@gls@debug
\define@choicekey{glossaries.sty}{debug}[\gls@debug@val\gls@debug@nr]%
 {true,false,showtargets,showaccsupp}[true]{%
  \ifcase\gls@debug@nr\relax
    % debug=true
    \@gls@debugtrue
    \renewcommand*{\GlossariesWarning}[1]{%
      \PackageWarning{glossaries}{##1}%
    }%
    \renewcommand*{\GlossariesWarningNoLine}[1]{%
      \PackageWarningNoLine{glossaries}{##1}%
    }%
    \let\@glsshowtarget\@gobble
    \PackageInfo{glossaries}{debug mode ON (nowarn option disabled)}%
  \or
    % debug=false
    \@gls@debugfalse
    \let\@glsshowtarget\@gobble
    \let\@glsshowaccsupp\@gobblethree
    \PackageInfo{glossaries}{debug mode OFF}%
  \or
    % debug=showtargets
    \@gls@debugtrue
    \renewcommand*{\GlossariesWarning}[1]{%
      \PackageWarning{glossaries}{##1}%
    }%
    \renewcommand*{\GlossariesWarningNoLine}[1]{%
      \PackageWarningNoLine{glossaries}{##1}%
    }%
    \PackageInfo{glossaries}{debug mode ON (nowarn option disabled)}%
    \renewcommand{\@glsshowtarget}{\@@glsshowtarget}%
  \or
    % debug=showaccsupp
    \@gls@debugtrue
    \renewcommand*{\GlossariesWarning}[1]{%
      \PackageWarning{glossaries}{##1}%
    }%
    \renewcommand*{\GlossariesWarningNoLine}[1]{%
      \PackageWarningNoLine{glossaries}{##1}%
    }%
    \PackageInfo{glossaries}{debug mode ON (nowarn option disabled)}%
    \renewcommand{\@glsshowaccsupp}{\glsshowaccsupp}%
  \fi
}
%    \end{macrocode}
%\end{option}
%\begin{macro}{\glsshowtarget}
%\changes{4.32}{2017-08-24}{new}
%\changes{4.34}{2017-11-03}{modified to check for math mode and inner}
%If \pkgopt[showtargets]{debug}, show the hyperlink target name in the
%margin.
%    \begin{macrocode}
\newcommand*{\glsshowtarget}[1]{%
 \ifmmode
   \nfss@text{\glsshowtargetfont [#1]}%
 \else
   \ifinner
%    \end{macrocode}
% Grouping no longer required as new \cs{@@glsshowtarget} adds
% scoping but retained here in case any existing documents are using
% \cs{glsshowtarget} elsewhere.
%    \begin{macrocode}
     {\glsshowtargetfont [#1]}%
   \else
     \glsshowtargetouter{#1}%
   \fi
 \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsshowtargetouter}
%\changes{4.45}{2020-02-13}{new}
%    \begin{macrocode}
\newcommand*{\glsshowtargetouter}[1]{%
 \glsshowtargetsymbol\marginpar{\glsshowtargetsymbol\glsshowtargetfont #1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsshowtargetsymbol}
%\changes{4.45}{2020-02-13}{new}
%    \begin{macrocode}
\newcommand*{\glsshowtargetsymbol}{{\tiny$\triangleright$}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsshowtargetfont}
%\changes{4.45}{2020-02-13}{new}
%    \begin{macrocode}
\newcommand*{\glsshowtargetfont}{\ttfamily\footnotesize}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsshowtarget}
%\changes{4.32}{2017-08-24}{new}
%\pkgopt[showtargets]{debug} will redefine this.
%    \begin{macrocode}
\newcommand*{\@glsshowtarget}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@glsshowtarget}
%\changes{4.45}{2020-02-13}{new}
%Need to detokenize the label in the event that it contains awkward
%characters like underscores.
%    \begin{macrocode}
\newrobustcmd*{\@@glsshowtarget}[1]{%
  \begingroup
  \protected@edef\@gls@tmp{#1}%
  \@onelevel@sanitize\@gls@tmp
  \expandafter\glsshowtarget\expandafter{\@gls@tmp}%
  \endgroup
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsshowaccsupp}
%\changes{4.45}{2020-02-13}{new}
%\pkgopt[showaccsupp]{debug} will redefine this.
%    \begin{macrocode}
\newcommand*{\@glsshowaccsupp}[3]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsshowaccsupp}
%\changes{4.45}{2020-02-13}{new}
%Just use \cs{@@glsshowtarget} since it basically needs to do the
%same thing.
%    \begin{macrocode}
\newrobustcmd*{\glsshowaccsupp}[3]{%
  \ifstrempty{#1}%
  {\@@glsshowtarget{/#2 (#3)}}%
  {\@@glsshowtarget{/#2 (#3) [#1]}}%
}
%    \end{macrocode}
%\end{macro}
%
%Determine what to do if the \gloskey{see} key is used before
%\cs{makeglossaries}. The default is to produce an error.
%\begin{macro}{\@gls@see@noindex}
%\changes{4.24}{2016-05-27}{new}
%    \begin{macrocode}
\newcommand*{\@gls@see@noindex}{%
  \PackageError{glossaries}%
  {`\gls@xr@key' key may only be used after \string\makeglossaries\space
   or \string\makenoidxglossaries\space (or move
   \string\newglossaryentry\space
   definitions into the preamble)}%
  {You must use \string\makeglossaries\space
   or \string\makenoidxglossaries\space before defining
   any entries that have a `\gls@xr@key' key. It may
   be that the `see' key has been written to the .glsdefs
   file from the previous run, in which case you need to 
   move your definitions
   to the preamble if you don't want to use
   \string\makeglossaries\space
   or \string\makenoidxglossaries}%
}
%    \end{macrocode}
%\end{macro}
%\begin{option}{seenoindex}
%\changes{4.24}{2016-05-27}{new}
%\changes{4.41}{2018-07-23}{changed \cs{val} and \cs{nr} to
%\cs{gls@seenoindex@val} and \cs{gls@seenoindex@nr}}
%    \begin{macrocode}
\define@choicekey{glossaries.sty}{seenoindex}%
 [\gls@seenoindex@val\gls@seenoindex@nr]{error,warn,ignore}{%
  \ifcase\gls@seenoindex@nr
    \renewcommand*{\@gls@see@noindex}{%
      \PackageError{glossaries}%
      {`\gls@xr@key' key may only be used after \string\makeglossaries\space
       or \string\makenoidxglossaries}%
      {You must use \string\makeglossaries\space
       or \string\makenoidxglossaries\space before defining
       any entries that have a `\gls@xr@key' key}%
    }%
  \or
    \renewcommand*{\@gls@see@noindex}{%
      \GlossariesWarning{`\gls@xr@key' key ignored}%
    }%
  \or
    \renewcommand*{\@gls@see@noindex}{}%
  \fi
}
%    \end{macrocode}
%\end{option}
%
%\begin{option}{toc}
% The \pkgopt{toc} package option will add the glossaries 
% to the table of contents. This is a boolean key, if the
% value is omitted it is taken to be true.
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{toc}[true]{}
%    \end{macrocode}
%\end{option}
%\begin{option}{numberline}
%\changes{1.1}{2008-02-22}{numberline option added}
% The \pkgopt{numberline} package option adds \cs{numberline} to
% \cs{addcontentsline}. Note that this option only has an effect
% if used in with \pkgopt[true]{toc}.
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{numberline}[true]{}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@@glossarysec}
% The sectional unit used to start the glossary is stored in
% \cs{@@glossarysec}. If chapters are defined, this
% is initialised to \texttt{chapter}, otherwise it is
% initialised to \texttt{section}.
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%    \begin{macrocode}
\ifcsundef{chapter}%
  {\newcommand*{\@@glossarysec}{section}}%
  {\newcommand*{\@@glossarysec}{chapter}}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{section}
% The \pkgopt{section} key can be used to set the sectional unit.
% If no unit is specified, use \texttt{section} as the default.
% The starred form of the named sectional unit will be used.
% If you want some other way to start the glossary section (e.g.\ 
% a numbered section) you will have to redefined 
% \ics{glossarysection}.
%    \begin{macrocode}
\define@choicekey{glossaries.sty}{section}{part,chapter,section,%
subsection,subsubsection,paragraph,subparagraph}[section]{%
  \renewcommand*{\@@glossarysec}{#1}}
%    \end{macrocode}
%\end{option}
%
% Determine whether or not to use numbered sections.
%\begin{macro}{\@@glossarysecstar}
%    \begin{macrocode}
\newcommand*{\@@glossarysecstar}{*}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@@glossaryseclabel}
%    \begin{macrocode}
\newcommand*{\@@glossaryseclabel}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsautoprefix}
% Prefix to add before label if automatically generated:
%\changes{1.14}{2008-06-17}{new}
%    \begin{macrocode}
\newcommand*{\glsautoprefix}{}
%    \end{macrocode}
%\end{macro}
%\begin{option}{numberedsection}
%\changes{1.1}{2008-02-22}{numberedsection package option added}
%\changes{4.02}{2013-12-05}{added nameref option}
%\changes{4.41}{2018-07-23}{changed \cs{val} and \cs{nr} to
%\cs{gls@numberedsection@val} and \cs{gls@numberedsection@nr}}
%    \begin{macrocode}
\define@choicekey{glossaries.sty}{numberedsection}%
 [\gls@numberedsection@val\gls@numberedsection@nr]{%
false,nolabel,autolabel,nameref}[nolabel]{%
  \ifcase\gls@numberedsection@nr\relax
    \renewcommand*{\@@glossarysecstar}{*}%
    \renewcommand*{\@@glossaryseclabel}{}%
  \or
    \renewcommand*{\@@glossarysecstar}{}%
    \renewcommand*{\@@glossaryseclabel}{}%
  \or
    \renewcommand*{\@@glossarysecstar}{}%
    \renewcommand*{\@@glossaryseclabel}{%
      \label{\glsautoprefix\@glo@type}}%
  \or
    \renewcommand*{\@@glossarysecstar}{*}%
    \renewcommand*{\@@glossaryseclabel}{%
      \protected@edef\@currentlabelname{\glossarytoctitle}%
      \label{\glsautoprefix\@glo@type}}%
  \fi
}
%    \end{macrocode}
%\end{option}
%
% The default glossary style is stored in 
% \cs{@glossary@default@style}. This is initialised to
% \texttt{list}. (The \glostyle{list} style is
% defined in the accompanying \isty{glossary-list} package
% described in \autoref{sec:code:styles}.) Note that the 
% \glostyle{list} style is incompatible with \sty{classicthesis}
% so change the default to \glostyle{index} if that package has been
% loaded.
%\begin{macro}{\@glossary@default@style}
%\changes{4.26}{2016-10-12}{added check for classicthesis}
%    \begin{macrocode}
\@ifpackageloaded{classicthesis}
{\newcommand*{\@glossary@default@style}{index}}
{\newcommand*{\@glossary@default@style}{list}}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{style}
% The default glossary style can be changed using the \pkgopt{style}
% package option. The value can be the name of any
% defined glossary style. The glossary style is set at the beginning
% of the document, so you can still use the \pkgopt{style} key to
% set a style that is defined in another package. This package comes
% with some predefined styles that are defined in 
% \autoref{sec:code:styles}.
%\changes{4.31}{2017-09-10}{changed \cs{renewcommand} to \cs{def}}
%This now uses \cs{def} instead of \cs{renewcommand} as 
% \cs{@glossary@default@style} may have been set to \cs{relax}.
%    \begin{macrocode}
\define@key{glossaries.sty}{style}{%
  \def\@glossary@default@style{#1}%
}
%    \end{macrocode}
%\end{option}
%
% Each \cs{DeclareOptionX} needs a corresponding \cs{DeclareOption}
% so that it can be passed as a document class option, so define a
% command that will implement both.
%\changes{4.01}{2013-11-16}{fixed non-value options so that they can be passed to
%document class}
%\begin{macro}{\@gls@declareoption}
%    \begin{macrocode}
\newcommand*{\@gls@declareoption}[2]{%
  \DeclareOptionX{#1}{#2}%
  \DeclareOption{#1}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
% Each entry within a given glossary will have an associated
% number list. By default, this refers to the page numbers on
% which that entry has been used, but it can also refer to any counter
% used in the document (such as the section or equation counters).
% The default number list format displays the number list ``as is'':
%\begin{macro}{\glossaryentrynumbers}
%    \begin{macrocode}
\newcommand*{\glossaryentrynumbers}[1]{#1\gls@save@numberlist{#1}}
%    \end{macrocode}
%\end{macro}
%\begin{option}{nonumberlist}
% Note that the entire number list for a given entry will be
% passed to \cs{glossaryentrynumbers} so any font changes
% will also be applied to the delimiters.
% The \pkgopt{nonumberlist} package option suppresses the 
% number lists (this simply redefines 
% \cs{glossaryentrynumbers} to ignores its argument).
%    \begin{macrocode}
\@gls@declareoption{nonumberlist}{%
  \renewcommand*{\glossaryentrynumbers}[1]{\gls@save@numberlist{#1}}%
}
%    \end{macrocode}
%\end{option}
%
%\begin{option}{savenumberlist}
%\changes{3.02}{2012-05-21}{new}
% Provide means to store the number list for entries.
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{savenumberlist}[true]{}
\glssavenumberlistfalse
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@glo@seeautonumberlist}
%    \begin{macrocode}
\newcommand*\@glo@seeautonumberlist{}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{seeautonumberlist}
% Automatically activates number list for entries containing the
% \gloskey{see} key.
%\changes{3.0}{2011-04-02}{new}
%    \begin{macrocode}
\@gls@declareoption{seeautonumberlist}{%
   \renewcommand*{\@glo@seeautonumberlist}{%
      \def\@glo@prefix{\glsnextpages}%
   }%
}
%    \end{macrocode}
%\end{option}
%
%\begin{option}{esclocations}
% When using \gls{makeindex} or \gls{xindy}, the locations may need
% to be adjusted to ensure they're in a format that's allowed by the
% indexing application. This involves a bit of hackery and isn't
% needed if the locations are all guaranteed to be in the correct
% form (or if the user is prepared to post-process the glossary file before
% calling the relevant indexing application) so \pkgopt[false]{esclocations}
% will switch off this mechanism allowing for a faster and more
% stable approach.
%\changes{4.33}{2017-09-20}{new}
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{esclocations}[true]{}
\glsesclocationstrue
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@gls@loadlong}
%\changes{1.18}{2009-01-14}{new}
%    \begin{macrocode}
\newcommand*{\@gls@loadlong}{\RequirePackage{glossary-long}}
%    \end{macrocode}
%\end{macro}
%\begin{option}{nolong}
%\changes{1.18}{2009-01-14}{new}
% This option prevents \isty{glossary-long} from being loaded.
% This means that the glossary styles that use the 
% \env{longtable} environment will not be available. This option
% is provided to reduce overhead caused by loading unrequired
% packages.
%    \begin{macrocode}
\@gls@declareoption{nolong}{\renewcommand*{\@gls@loadlong}{}}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@gls@loadsuper}
%\changes{1.18}{2009-01-14}{new}
% The \isty{glossary-super} package isn't loaded if
% \isty{supertabular} isn't installed.
%    \begin{macrocode}
\IfFileExists{supertabular.sty}{%
  \newcommand*{\@gls@loadsuper}{\RequirePackage{glossary-super}}}{%
  \newcommand*{\@gls@loadsuper}{}}
%    \end{macrocode}
%\end{macro}
%\begin{option}{nosuper}
%\changes{1.18}{2009-01-14}{new}
% This option prevents \isty{glossary-super} from being loaded.
% This means that the glossary styles that use the 
% \env{supertabular} environment will not be available. This option
% is provided to reduce overhead caused by loading unrequired
% packages.
%    \begin{macrocode}
\@gls@declareoption{nosuper}{\renewcommand*{\@gls@loadsuper}{}}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@gls@loadlist}
%\changes{1.18}{2009-01-14}{new}
%    \begin{macrocode}
\newcommand*{\@gls@loadlist}{\RequirePackage{glossary-list}}
%    \end{macrocode}
%\end{macro}
%\begin{option}{nolist}
%\changes{1.18}{2009-01-14}{new}
% This option prevents \isty{glossary-list} from being loaded
% (to reduce overheads if required). Naturally, the styles defined
% in \isty{glossary-list} will not be available if this option
% is used. If the style is still set to \glostyle{list}, the default
% must be set to \cs{relax}.
%\changes{4.31}{2017-08-10}{added check for \qt{list} style}
%    \begin{macrocode}
\@gls@declareoption{nolist}{%
 \renewcommand*{\@gls@loadlist}{%
  \ifdefstring{\@glossary@default@style}{list}%
  {\let\@glossary@default@style\relax}%
  {}%
 }%
}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@gls@loadtree}
%\changes{1.18}{2009-01-14}{new}
%    \begin{macrocode}
\newcommand*{\@gls@loadtree}{\RequirePackage{glossary-tree}}
%    \end{macrocode}
%\end{macro}
%\begin{option}{notree}
%\changes{1.18}{2009-01-14}{new}
% This option prevents \isty{glossary-tree} from being loaded
% (to reduce overheads if required). Naturally, the styles defined
% in \isty{glossary-tree} will not be available if this option
% is used.
%    \begin{macrocode}
\@gls@declareoption{notree}{\renewcommand*{\@gls@loadtree}{}}
%    \end{macrocode}
%\end{option}
%
%\begin{option}{nostyles}
%\changes{1.18}{2009-01-14}{new}
% Provide an option to suppress all the predefined styles (in the
% event that the user has custom styles that are not dependent
% on the predefined styles).
%    \begin{macrocode}
\@gls@declareoption{nostyles}{%
  \renewcommand*{\@gls@loadlong}{}%
  \renewcommand*{\@gls@loadsuper}{}%
  \renewcommand*{\@gls@loadlist}{}%
  \renewcommand*{\@gls@loadtree}{}%
  \let\@glossary@default@style\relax
}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\glspostdescription}
% The description terminator is given by \cs{glspostdescription}
% (except for the 3 and 4 column styles). This is a full stop
% by default.
%\changes{3.07}{2013-07-05}{Added spacefactor code}
% The spacefactor is adjusted in case the description ends with an
% upper case letter. (Patch provided by Michael Pock.)
%    \begin{macrocode}
\newcommand*{\glspostdescription}{%
  \ifglsnopostdot\else.\spacefactor\sfcode`\. \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{option}{nopostdot}
% Boolean option to suppress post description dot
%\changes{3.03}{2012/09/21}{new}
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{nopostdot}[true]{}
\glsnopostdotfalse
%    \end{macrocode}
%\end{option}
%\begin{option}{nogroupskip}
% Boolean option to suppress vertical space between groups in the
% pre-defined styles.
%\changes{3.03}{2012/09/21}{new}
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{nogroupskip}[true]{}
\glsnogroupskipfalse
%    \end{macrocode}
%\end{option}
%
%\begin{option}{ucmark}
% Boolean option to determine whether or not to use
% use upper case in definition of \ics{glsglossarymark}
%\changes{3.02}{2012-05-21}{new}
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{ucmark}[true]{}
%    \end{macrocode}
%\changes{3.13a}{2013-11-05}{added check for memoir}
%    \begin{macrocode}
\@ifclassloaded{memoir}
{%
  \glsucmarktrue
}%
{%
  \glsucmarkfalse
}
%    \end{macrocode}
%\end{option}
%
%\begin{counter}{glossaryentry}
%\changes{3.0}{2011-04-02}{new}
% If the \pkgopt{entrycounter} package option has been used, define
% a counter to number each level~0 entry.
% This is now defined by an internal command for consistency.
%\end{counter}
%
%\begin{macro}{\@gls@define@glossaryentrycounter}
%\changes{4.38}{2018-05-10}{new}
%    \begin{macrocode}
\newcommand*{\@gls@define@glossaryentrycounter}{%
  \ifglsentrycounter
%    \end{macrocode}
%\changes{4.38}{2018-05-10}{added check for existence of glossaryentry counter}
%Define the \ctr{glossaryentry} counter if it doesn't already exist.
%    \begin{macrocode}
    \ifundef\c@glossaryentry
    {%
      \ifx\@gls@counterwithin\@empty
        \newcounter{glossaryentry}%
      \else
        \newcounter{glossaryentry}[\@gls@counterwithin]%
      \fi
      \def\theHglossaryentry{\currentglossary.\theglossaryentry}%
    }%
    {}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{entrycounter}
% Defines a counter that can be used in the standard glossary styles
% to number each (main) entry. If true, this will define a counter called
% \ctr{glossaryentry}.
%\changes{3.0}{2011-04-02}{new}
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{entrycounter}[true]{}
\glsentrycounterfalse
%    \end{macrocode}
%\end{option}
%
%\begin{option}{counterwithin}
% This option can be used to set a parent counter for
% \ctr{glossaryentry}. This option automatically sets
% \pkgopt[true]{entrycounter}.
%\changes{3.0}{2011-04-02}{new}
%    \begin{macrocode}
\define@key{glossaries.sty}{counterwithin}{%
  \renewcommand*{\@gls@counterwithin}{#1}%
  \glsentrycountertrue
  \@gls@define@glossaryentrycounter
}
%    \end{macrocode}
%\end{option}
%\begin{macro}{\@gls@counterwithin}
%\changes{3.0}{2011-04-02}{new}
% The default value is no parent counter:
%    \begin{macrocode}
\newcommand*{\@gls@counterwithin}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{counter}{glossarysubentry}
%\changes{3.0}{2011-04-02}{new}
% If the \pkgopt{subentrycounter} package option has been used, define
% a counter to number each level~1 entry. This is now defined by an
% internal command for consistency.
%\end{counter}
%\begin{macro}{\@gls@define@glossarysubentrycounter}
%\changes{4.38}{2018-05-10}{new}
%    \begin{macrocode}
\newcommand{\@gls@define@glossarysubentrycounter}{%
%    \end{macrocode}
%Check if counter already defined.
%    \begin{macrocode}
  \ifundef\c@glossarysubentry
  {%
    \ifglssubentrycounter
      \ifglsentrycounter
        \newcounter{glossarysubentry}[glossaryentry]%
      \else
        \newcounter{glossarysubentry}%
      \fi
%    \end{macrocode}
%\changes{4.38}{2018-05-10}{prepended \cs{currentglossary}\texttt{.} to
%\cs{theHglossarysubentry} and removed spurious eol space}
%As with \cs{theHglossaryentry}, this starts with
%\cs{currentglossary}\texttt{.} to help avoid duplicate hyper targets.
%    \begin{macrocode}
      \def\theHglossarysubentry{\currentglossary.\currentglssubentry.\theglossarysubentry}%
    \fi
  }%
  {}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{subentrycounter}
% Define a counter that can be used in the standard glossary styles
% to number each level~1 entry. If true, this will define a counter called
% \ctr{glossarysubentry}.
%\changes{3.0}{2011-04-02}{new}
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{subentrycounter}[true]{}
\glssubentrycounterfalse
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@glo@default@sorttype}
% Initialise default sort for \cs{printnoidxglossary}
%    \begin{macrocode}
\newcommand*{\@glo@default@sorttype}{standard}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{sort}
%\changes{3.0}{2011-04-02}{new}
% Define the sort method: \pkgopt[standard]{sort} (default),
% \pkgopt[def]{sort} (order of definition) or
% \pkgopt[use]{sort} (order of use). If no indexing required, use
% \pkgopt[none]{sort}.
%    \begin{macrocode}
\define@choicekey{glossaries.sty}{sort}{standard,def,use,none}{%
  \renewcommand*{\@glo@default@sorttype}{#1}%
  \csname @gls@setupsort@#1\endcsname
}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\glsprestandardsort}
%\changes{3.13a}{2013-11-05}{new}
%\begin{definition}
%\cs{glsprestandardsort}\marg{sort cs}\marg{type}\marg{label}
%\end{definition}
% Allow user to hook into sort mechanism. The first argument
% \meta{sort cs} is the temporary control sequence containing the
% sort value before it has been sanitized and had
% \gls{makeindex}\slash\gls{xindy} special characters escaped.
%    \begin{macrocode}
\newcommand*{\glsprestandardsort}[3]{%
  \glsdosanitizesort
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glo@check@sortallowed}
%\changes{4.30}{2017-06-11}{new}
%    \begin{macrocode}
\newcommand*{\@glo@check@sortallowed}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@setupsort@standard}
%\changes{3.0}{2011-04-02}{new}
% Set up the macros for default sorting.
%    \begin{macrocode}
\newcommand*{\@gls@setupsort@standard}{%
%    \end{macrocode}
% Store entry information when it's defined.
%    \begin{macrocode}
  \def\do@glo@storeentry{\@glo@storeentry}%
%    \end{macrocode}
% No count register required for standard sort.
%    \begin{macrocode}
  \def\@gls@defsortcount##1{}%
%    \end{macrocode}
% Sort according to sort key (\cs{@glo@sort}) if provided otherwise 
% sort according to the entry's name (\cs{@glo@name}).
% (First argument glossary type, second argument entry label.)
%    \begin{macrocode}
  \def\@gls@defsort##1##2{%
    \ifx\@glo@sort\@glsdefaultsort
      \let\@glo@sort\@glo@name
    \fi
%    \end{macrocode}
%\changes{3.03}{2012/09/21}{used \cs{@gls@sanitizesort}}
%\changes{3.13a}{2013-11-05}{moved \cs{@gls@santizesort} to
%\cs{glsprestandardsort}}
%    \begin{macrocode}
    \let\glsdosanitizesort\@gls@sanitizesort
    \glsprestandardsort{\@glo@sort}{##1}{##2}%
    \expandafter\protected@xdef\csname glo@##2@sort\endcsname{\@glo@sort}%
  }%
%    \end{macrocode}
% Don't need to do anything when the entry is used.
%    \begin{macrocode}
  \def\@gls@setsort##1{}%
%    \end{macrocode}
% This sort option is allowed with \cs{makeglossaries} and
% \cs{makenoidxglossaries}.
%    \begin{macrocode}
  \let\@glo@check@sortallowed\@gobble
}
%    \end{macrocode}
% Set standard sort as the default:
%    \begin{macrocode}
\@gls@setupsort@standard
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glssortnumberfmt}
%\changes{3.0}{2011-04-02}{new}
% Format the number used as the sort key by \pkgopt[def]{sort} and
% \pkgopt[use]{sort}. Defaults to six digit numbering.
%    \begin{macrocode}
\newcommand*\glssortnumberfmt[1]{%
  \ifnum#1<100000 0\fi
  \ifnum#1<10000 0\fi
  \ifnum#1<1000 0\fi
  \ifnum#1<100 0\fi
  \ifnum#1<10 0\fi
  \number#1%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@setupsort@def}
%\changes{3.0}{2011-04-02}{new}
% Set up the macros for order of definition sorting.
%    \begin{macrocode}
\newcommand*{\@gls@setupsort@def}{%
%    \end{macrocode}
% Store entry information when it's defined.
%    \begin{macrocode}
  \def\do@glo@storeentry{\@glo@storeentry}%
%    \end{macrocode}
% Defined count register associated with the glossary.
%    \begin{macrocode}
  \def\@gls@defsortcount##1{%
    \expandafter\global
    \expandafter\newcount\csname glossary@##1@sortcount\endcsname
  }%
%    \end{macrocode}
% Increment count register associated with the glossary and use as
% the sort key.
%    \begin{macrocode}
  \def\@gls@defsort##1##2{%
%    \end{macrocode}
% It may be that the sort order was changed after the glossary was
% defined, so check if the count register has been defined.
%\changes{4.30}{2017-06-11}{added check for register}
%    \begin{macrocode}
    \ifcsundef{glossary@##1@sortcount}%
    {\@gls@defsortcount{##1}}%
    {}%
    \expandafter\global\expandafter
    \advance\csname glossary@##1@sortcount\endcsname by 1\relax
    \expandafter\protected@xdef\csname glo@##2@sort\endcsname{%
       \expandafter\glssortnumberfmt
         {\csname glossary@##1@sortcount\endcsname}}%
  }%
%    \end{macrocode}
% Don't need to do anything when the entry is used.
%    \begin{macrocode}
  \def\@gls@setsort##1{}%
%    \end{macrocode}
% This sort option is allowed with \cs{makeglossaries} and
% \cs{makenoidxglossaries}.
%    \begin{macrocode}
  \let\@glo@check@sortallowed\@gobble
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@setupsort@use}
%\changes{3.0}{2011-04-02}{new}
% Set up the macros for order of use sorting.
%    \begin{macrocode}
\newcommand*{\@gls@setupsort@use}{%
%    \end{macrocode}
% Don't store entry information when it's defined.
%    \begin{macrocode}
  \let\do@glo@storeentry\@gobble
%    \end{macrocode}
% Defined count register associated with the glossary.
%    \begin{macrocode}
  \def\@gls@defsortcount##1{%
    \expandafter\global
    \expandafter\newcount\csname glossary@##1@sortcount\endcsname
  }%
%    \end{macrocode}
% Initialise the sort key to empty.
%    \begin{macrocode}
  \def\@gls@defsort##1##2{%
    \expandafter\gdef\csname glo@##2@sort\endcsname{}%
  }%
%    \end{macrocode}
% If the sort key hasn't been set, increment the counter associated
% with the glossary and set the sort key.
%    \begin{macrocode}
  \def\@gls@setsort##1{%
%    \end{macrocode}
% Get the parent, if one exists
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
    \protected@edef\@glo@parent{\csname glo@##1@parent\endcsname}%
%    \end{macrocode}
% Set the information for the parent entry if not already done.
%    \begin{macrocode}
    \ifx\@glo@parent\@empty
    \else
      \expandafter\@gls@setsort\expandafter{\@glo@parent}%
    \fi
%    \end{macrocode}
% Set index information for this entry
%    \begin{macrocode}
    \protected@edef\@glo@type{\csname glo@##1@type\endcsname}%
    \protected@edef\@gls@tmp{\csname glo@##1@sort\endcsname}%
    \ifx\@gls@tmp\@empty
      \expandafter\global\expandafter
      \advance\csname glossary@\@glo@type @sortcount\endcsname by 1\relax
      \expandafter\protected@xdef\csname glo@##1@sort\endcsname{%
         \expandafter\glssortnumberfmt
           {\csname glossary@\@glo@type @sortcount\endcsname}}%
      \@glo@storeentry{##1}%
    \fi
  }%
%    \end{macrocode}
% This sort option is allowed with \cs{makeglossaries} and
% \cs{makenoidxglossaries}.
%    \begin{macrocode}
  \let\@glo@check@sortallowed\@gobble
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@setupsort@none}
%\changes{4.30}{2017-06-11}{new}
% Slightly improves efficiency in the event that no indexing is
% required.
%    \begin{macrocode}
\newcommand*{\@gls@setupsort@none}{%
%    \end{macrocode}
% Don't store entry index information.
%    \begin{macrocode}
  \def\do@glo@storeentry##1{}%
%    \end{macrocode}
% No count register required for standard sort.
%    \begin{macrocode}
  \def\@gls@defsortcount##1{}%
%    \end{macrocode}
% Don't modify sort value.
%    \begin{macrocode}
  \def\@gls@defsort##1##2{%
    \expandafter\global\expandafter\let\csname glo@##2@sort\endcsname\@glo@sort
  }%
%    \end{macrocode}
% Don't need to do anything when the entry is used.
%    \begin{macrocode}
  \def\@gls@setsort##1{}%
%    \end{macrocode}
% This sort option isn't allowed with \cs{makeglossaries} or
% \cs{makenoidxglossaries}.
%    \begin{macrocode}
  \renewcommand\@glo@check@sortallowed[1]{\PackageError{glossaries}
   {Option sort=none not allowed with \string##1}%
   {(Use sort=def instead)}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdefmain}
%\changes{2.01}{2009 May 30}{new}
%\changes{3.04}{2012-11-18}{added check for doc package}
% Define the main glossary. This will be the first glossary to
% be displayed when using \ics{printglossaries}. The default
% extensions conflict if used with \sty{doc}, so provide different
% extensions if \sty{doc} loaded. (If these extensions are
% inappropriate, use \pkgopt{nomain} and manually define the main
% glossary with the desired extensions.)
%    \begin{macrocode}
\newcommand*{\glsdefmain}{%
  \if@gls@docloaded
    \newglossary[glg2]{main}{gls2}{glo2}{\glossaryname}%
  \else
    \newglossary{main}{gls}{glo}{\glossaryname}%
  \fi
%    \end{macrocode}
% Define hook to set the toc title when \sty{translator} is in use.
%\changes{4.06}{2014-03-12}{added hook to set toc title}
%    \begin{macrocode}
  \newcommand*{\gls@tr@set@main@toctitle}{%
    \translatelet{\glossarytoctitle}{Glossary}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
% Keep track of the default glossary. This is initialised to
% the main glossary, but can be changed if for some reason
% you want to make a secondary glossary the main glossary. This
% affects any commands that can optionally take a glossary name
% as an argument (or as the value of the 
% \gloskey{type}\igloskey[printglossary]{type} key in 
%a key-value list). This was mainly done so that 
% \ics{loadglsentries} can temporarily change 
% \cs{glsdefaulttype} while it loads a file containing
% new glossary entries (see \autoref{sec:load}).
%\begin{macro}{\glsdefaulttype}
%    \begin{macrocode}
\newcommand*{\glsdefaulttype}{main}
%    \end{macrocode}
%\end{macro}
% Keep track of which glossary the acronyms are in. This is 
% initialised to \cs{glsdefaulttype}, but is changed by
% the \pkgopt{acronym} package option.
%\begin{macro}{\acronymtype}
%    \begin{macrocode}
\newcommand*{\acronymtype}{\glsdefaulttype}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{nomain}
%\changes{2.01}{2009 May 30}{added nomain package option}
% The \pkgopt{nomain} option suppress the creation of the main 
% glossary.
%    \begin{macrocode}
\@gls@declareoption{nomain}{%
   \let\glsdefaulttype\relax
   \renewcommand*{\glsdefmain}{}%
}
%    \end{macrocode}
%\end{option}
%
%\begin{option}{acronym}
% The \pkgopt{acronym} option sets an associated conditional 
% which is used in \autoref{sec:code:acronym} to determine whether
% or not to define a separate glossary for acronyms.
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{acronym}[true]{%
  \ifglsacronym
    \renewcommand{\@gls@do@acronymsdef}{%
      \DeclareAcronymList{acronym}%
      \newglossary[alg]{acronym}{acr}{acn}{\acronymname}%
      \renewcommand*{\acronymtype}{acronym}%
%    \end{macrocode}
% Define hook to set the toc title when \sty{translator} is in use.
%\changes{4.06}{2014-03-12}{added hook to set toc title}
%    \begin{macrocode}
      \newcommand*{\gls@tr@set@acronym@toctitle}{%
        \translatelet{\glossarytoctitle}{Acronyms}%
      }%
    }%
  \else
    \let\@gls@do@acronymsdef\relax
  \fi
}
%    \end{macrocode}
%\end{option}
%\begin{macro}{\printacronyms}
% Define \cs{printacronyms} at the start of the document if
% \pkgopt{acronym} is set and compatibility mode isn't on and
% \cs{printacronyms} hasn't already been defined.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifglsacronym
    \ifbool{glscompatible-3.07}%
    {}%
    {%
      \providecommand*{\printacronyms}[1][]{%
        \printglossary[type=\acronymtype,#1]}%
    }%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@do@acronymsdef}
% Set default value
%    \begin{macrocode}
\newcommand*{\@gls@do@acronymsdef}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{acronyms}
%\changes{3.14a}{2013-11-12}{new}
% Provide a synonym for \pkgopt[true]{acronym} that can be passed
% via the document class options.
%    \begin{macrocode}
\@gls@declareoption{acronyms}{%
  \glsacronymtrue
%    \end{macrocode}
%\changes{4.45}{2020-02-13}{changed \cs{renewcommand} to \cs{def}}
%    \begin{macrocode}
  \def\@gls@do@acronymsdef{%
     \DeclareAcronymList{acronym}%
     \newglossary[alg]{acronym}{acr}{acn}{\acronymname}%
     \renewcommand*{\acronymtype}{acronym}%
%    \end{macrocode}
% Define hook to set the toc title when \sty{translator} is in use.
%\changes{4.06}{2014-03-12}{added hook to set toc title}
%    \begin{macrocode}
      \newcommand*{\gls@tr@set@acronym@toctitle}{%
        \translatelet{\glossarytoctitle}{Acronyms}%
      }%
   }%
}
%    \end{macrocode}
%\end{option}
%\begin{macro}{\@glsacronymlists}
%\changes{2.04}{2009-11-10}{new}
% Comma-separated list of glossary labels indicating which 
% glossaries contain acronyms. Note that \ics{SetAcronymStyle}
% must be used after adding labels to this macro.
%    \begin{macrocode}
\newcommand*{\@glsacronymlists}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@addtoacronynlists}
%    \begin{macrocode}
\newcommand*{\@addtoacronymlists}[1]{%
  \ifx\@glsacronymlists\@empty
    \protected@xdef\@glsacronymlists{#1}%
  \else
    \protected@xdef\@glsacronymlists{\@glsacronymlists,#1}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\DeclareAcronymList}
%\changes{2.04}{2009-11-10}{new}%
% Identifies the named glossary as a list of acronyms and adds
% to the list. (Doesn't check if the glossary exists, but checks
% if label already in list. Use \ics{SetAcronymStyle} after
% identifying all the acronym lists.)
%    \begin{macrocode}
\newcommand*{\DeclareAcronymList}[1]{%
  \glsIfListOfAcronyms{#1}{}{\@addtoacronymlists{#1}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsIfListOfAcronyms}
%\begin{definition}
%\cs{glsIfListOfAcronyms}\marg{label}\marg{true part}\marg{false part}
%\end{definition}
% Determines if the glossary with the given label has been identified
% as being a list of acronyms.
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
\newcommand{\glsIfListOfAcronyms}[1]{%
  \protected@edef\@do@gls@islistofacronyms{%
    \noexpand\@gls@islistofacronyms{#1}{\@glsacronymlists}}%
  \@do@gls@islistofacronyms
}
%    \end{macrocode}
% Internal command requires label and list to be expanded:
%    \begin{macrocode}
\newcommand{\@gls@islistofacronyms}[4]{%
  \def\gls@islistofacronyms##1,#1,##2\end@gls@islistofacronyms{%
     \def\@gls@before{##1}\def\@gls@after{##2}}%
  \gls@islistofacronyms,#2,#1,\@nil\end@gls@islistofacronyms
  \ifx\@gls@after\@nnil
%    \end{macrocode}
% Not found
%    \begin{macrocode}
    #4%
  \else
%    \end{macrocode}
% Found
%    \begin{macrocode}
    #3%
  \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\if@glsisacronymlist}
% Convenient boolean.
%    \begin{macrocode}
\newif\if@glsisacronymlist
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\gls@checkisacronymlist}
% Sets the above boolean if argument is a label representing 
% a list of acronyms.
%    \begin{macrocode}
\newcommand*{\gls@checkisacronymlist}[1]{%
   \glsIfListOfAcronyms{#1}%
     {\@glsisacronymlisttrue}{\@glsisacronymlistfalse}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\SetAcronymLists}
%\changes{2.04}{2009-11-10}{new}%
% Sets the ``list of acronyms'' list. Argument must be a
% comma-separated list of glossary labels. (Doesn't check at this
% point if the glossaries exists.)
%    \begin{macrocode}
\newcommand*{\SetAcronymLists}[1]{%
  \renewcommand*{\@glsacronymlists}{#1}%
}
%    \end{macrocode}
%\end{macro}
%\begin{option}{acronymlists}
%\changes{2.04}{2009-11-10}{new}%
%\changes{3.11a}{2013-10-15}{replaced \cs{@addtoacronymlists} with
%\cs{DeclareAcronymList}}
%    \begin{macrocode}
\define@key{glossaries.sty}{acronymlists}{%
  \DeclareAcronymList{#1}%
}
%    \end{macrocode}
%\end{option}
%
% The default counter associated with the numbers in the glossary
% is stored in \cs{glscounter}. This is initialised to the 
% page counter. This is used as the default counter when a
% new glossary is defined, unless a different counter is specified
% in the optional argument to \ics{newglossary} (see
% \autoref{sec:newglos}).
%\begin{macro}{\glscounter}
%    \begin{macrocode}
\newcommand{\glscounter}{page}
%    \end{macrocode}
%\end{macro}
%\begin{option}{counter}
% The \pkgopt{counter} option changes the default counter. (This
% just redefines \cs{glscounter}.)
%    \begin{macrocode}
\define@key{glossaries.sty}{counter}{%
  \renewcommand*{\glscounter}{#1}%
}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@gls@nohyperlist}
%\changes{3.05}{2013/04/21}{new}
%    \begin{macrocode}
\newcommand*{\@gls@nohyperlist}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\GlsDeclareNoHyperList}
%\changes{3.05}{2013/04/21}{new}
%    \begin{macrocode}
\newcommand*{\GlsDeclareNoHyperList}[1]{%
  \ifdefempty\@gls@nohyperlist
  {%
     \renewcommand*{\@gls@nohyperlist}{#1}%
  }%
  {%
     \appto\@gls@nohyperlist{,#1}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{nohypertypes}
%\changes{3.05}{2013/04/21}{new}
%    \begin{macrocode}
\define@key{glossaries.sty}{nohypertypes}{%
  \GlsDeclareNoHyperList{#1}%
}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\GlossariesWarning}
% Prints a warning message.
%    \begin{macrocode}
\newcommand*{\GlossariesWarning}[1]{%
  \PackageWarning{glossaries}{#1}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\GlossariesWarningNoLine}
% Prints a warning message without the line number.
%    \begin{macrocode}
\newcommand*{\GlossariesWarningNoLine}[1]{%
  \PackageWarningNoLine{glossaries}{#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glosortentrieswarning}
%\changes{4.30}{2017-06-11}{new}
%Warn user that sorting may take a long time. This is actually an
%informational message rather than a warning so just use 
%\cs{typeout}.
%    \begin{macrocode}
\newcommand{\glosortentrieswarning}{%
 \typeout{Using TeX to sort glossary entries---this may
 take a while}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{nowarn}
% Define package option to suppress warnings
%    \begin{macrocode}
\@gls@declareoption{nowarn}{%
  \if@gls@debug
    \GlossariesWarning{Warnings can't be suppressed in debug mode}%
  \else
    \renewcommand*{\GlossariesWarning}[1]{}%
    \renewcommand*{\GlossariesWarningNoLine}[1]{}%
    \renewcommand*{\glosortentrieswarning}{}%
    \renewcommand*{\@gls@missinglang@warn}[2]{}%
  \fi
}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@gls@missinglang@warn}
%\changes{4.33}{2017-09-20}{new}
%Missing language warning.
%    \begin{macrocode}
\newcommand*{\@gls@missinglang@warn}[2]{%
  \PackageWarningNoLine{glossaries}%
  {No language module detected for `#1'.\MessageBreak
  Language modules need to be installed separately.\MessageBreak
  Please check on CTAN for a bundle called\MessageBreak
  `glossaries-#2' or similar}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{nolangwarn}
% Suppress warning if language support not found.
%    \begin{macrocode}
\@gls@declareoption{nolangwarn}{%
  \renewcommand*{\@gls@missinglang@warn}[2]{}%
}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@gls@warnonglossdefined}
%\changes{4.04}{2014-03-06}{new}
% Issue a warning if overriding \cs{printglossary}
%    \begin{macrocode}
\newcommand*{\@gls@warnonglossdefined}{%
  \GlossariesWarning{Overriding \string\printglossary}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@warnontheglossdefined}
%\changes{4.04}{2014-03-06}{new}
% Issue a warning if overriding \env{theglossary}
%    \begin{macrocode}
\newcommand*{\@gls@warnontheglossdefined}{%
  \GlossariesWarning{Overriding `theglossary' environment}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{noredefwarn}
% Suppress warning on redefinition of \cs{printglossary}
%    \begin{macrocode}
\@gls@declareoption{noredefwarn}{%
  \renewcommand*{\@gls@warnonglossdefined}{}%
  \renewcommand*{\@gls@warnontheglossdefined}{}%
}
%    \end{macrocode}
%\end{option}
%
% As from version 3.08a, the only information written to the external
% glossary files are the label and sort values. Therefore, now, the
% only sanitize option that makes sense is the one for the sort key.
% so the sanitize option is now deprecated and there is only a
% \pkgopt{sanitizesort} option.
%
%\begin{macro}{\@gls@sanitizedesc}
%    \begin{macrocode}
\newcommand*{\@gls@sanitizedesc}{%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glssetexpandfield}
%\changes{3.13a}{2013-11-05}{new}
%\begin{definition}
%\cs{glssetexpandfield}\marg{field}
%\end{definition}
% Sets field to always expand.
%    \begin{macrocode}
\newcommand*{\glssetexpandfield}[1]{%
  \csdef{gls@assign@#1@field}##1##2{%
    \@@gls@expand@field{##1}{#1}{##2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glssetnoexpandfield}
%\changes{3.13a}{2013-11-05}{new}
%\begin{definition}
%\cs{glssetnoexpandfield}\marg{field}
%\end{definition}
% Sets field to never expand.
%    \begin{macrocode}
\newcommand*{\glssetnoexpandfield}[1]{%
  \csdef{gls@assign@#1@field}##1##2{%
    \@@gls@noexpand@field{##1}{#1}{##2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@assign@type@field}
%\changes{3.10a}{2013-09-28}{new}
%\changes{3.13a}{2013-11-05}{changed to use \cs{glssetexpandfield}}
% The type must always be expandable.
%    \begin{macrocode}
\glssetexpandfield{type}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@assign@desc@field}
%\changes{3.08a}{2013-09-28}{new}
%\changes{3.13a}{2013-11-05}{changed to use \cs{glssetnoexpandfield}}
% The description is not expanded by default:
%    \begin{macrocode}
\glssetnoexpandfield{desc}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\gls@assign@descplural@field}
%\changes{3.08a}{2013-09-28}{new}
%\changes{3.13a}{2013-11-05}{changed to use \cs{glssetnoexpandfield}}
%    \begin{macrocode}
\glssetnoexpandfield{descplural}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@sanitizename}
%    \begin{macrocode}
\newcommand*{\@gls@sanitizename}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\gls@assign@name@field}
%\changes{3.13a}{2013-11-05}{changed to use \cs{glssetnoexpandfield}}
% Don't expand name by default.
%    \begin{macrocode}
\glssetnoexpandfield{name}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@sanitizesymbol}
%    \begin{macrocode}
\newcommand*{\@gls@sanitizesymbol}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@assign@symbol@field}
%\changes{3.13a}{2013-11-05}{changed to use \cs{glssetnoexpandfield}}
% Don't expand symbol by default.
%    \begin{macrocode}
\glssetnoexpandfield{symbol}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@assign@symbolplural@field}
%\changes{3.13a}{2013-11-05}{changed to use \cs{glssetnoexpandfield}}
%\changes{3.09a}{2013-10-09}{new}
%    \begin{macrocode}
\glssetnoexpandfield{symbolplural}
%    \end{macrocode}
%\end{macro}
%
% Sanitizing stuff:
%\begin{macro}{\@gls@sanitizesort}
%\changes{3.03}{2012/09/21}{new}
%    \begin{macrocode}
\newcommand*{\@gls@sanitizesort}{%
  \ifglssanitizesort
    \@@gls@sanitizesort
  \else
    \@@gls@nosanitizesort
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@gls@sanitizesort}
%\changes{4.04}{2014-03-06}{new}
%    \begin{macrocode}
\newcommand*\@@gls@sanitizesort{%
  \@onelevel@sanitize\@glo@sort
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@gls@nosanitizesort}
%\changes{4.04}{2014-03-06}{new}
%    \begin{macrocode}
\newcommand*{\@@gls@nosanitizesort}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@gls@noidx@sanitizesort}
%\changes{4.04}{2014-03-06}{new}
% Remove braces around first character (if present) before
% sanitizing.
%    \begin{macrocode}
\newcommand*\@gls@noidx@sanitizesort{%
  \ifdefvoid\@glo@sort
  {}%
  {%
    \expandafter\@@gls@noidx@sanitizesort\@glo@sort\gls@end@sanitizesort
  }%
}
\def\@@gls@noidx@sanitizesort#1#2\gls@end@sanitizesort{%
  \def\@glo@sort{#1#2}%
  \@onelevel@sanitize\@glo@sort
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@gls@noidx@nosanitizesort}
%\changes{4.04}{2014-03-06}{new}
%    \begin{macrocode}
\newcommand*{\@@gls@noidx@nosanitizesort}{%
  \ifdefvoid\@glo@sort
  {}%
  {%
    \expandafter\@@gls@noidx@no@sanitizesort\@glo@sort\gls@end@sanitizesort
  }%
}
\def\@@gls@noidx@no@sanitizesort#1#2\gls@end@sanitizesort{%
  \bgroup
    \glsnoidxstripaccents
    \protected@xdef\@@glo@sort{#1#2}%
  \egroup
  \let\@glo@sort\@@glo@sort
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsnoidxstripaccents}
%\changes{4.04}{2014-03-06}{new}
%This strips accents by redefining the standard accent commands to
%just do their argument. (This will be localised since
%\cs{glsnoidxstripaccents} is used within a group.) Anything outside
%this standard set really shouldn't be using
%\cs{makenoidxglossaries}. It's much better to use \app{xindy} or
%\app{bib2gls} with the correct language setting.
%    \begin{macrocode}
\newcommand*\glsnoidxstripaccents{%
  \let\IeC\@firstofone
  \let\add@accent@\@secondoftwo
  \let\@text@composite@x\@secondoftwo
  \let\@tabacckludge\@secondoftwo
  \expandafter\def\csname \encodingdefault-cmd\endcsname##1##2##3{##3}%
  \expandafter\def\csname OT1-cmd\endcsname##1##2##3{##3}%
  \expandafter\def\csname T1-cmd\endcsname##1##2##3{##3}%
  \expandafter\def\csname PD1-cmd\endcsname##1##2##3{##3}%
  \let\'\@firstofone
  \let\`\@firstofone
  \let\^\@firstofone
  \let\"\@firstofone
  \let\u\@firstofone
  \let\t\@firstofone
  \let\d\@firstofone
  \let\r\@firstofone
  \let\=\@firstofone
  \let\.\@firstofone
  \let\~\@firstofone
  \let\v\@firstofone
  \let\H\@firstofone
  \let\c\@firstofone
  \let\b\@firstofone
%    \end{macrocode}
%\changes{4.30}{2017-06-11}{added \cs{a}}
%    \begin{macrocode}
  \let\a\@secondoftwo
  \def\AE{AE}%
  \def\ae{ae}%
  \def\OE{OE}%
  \def\oe{oe}%
  \def\AA{AA}%
  \def\aa{aa}%
  \def\L{L}%
  \def\l{l}%
  \def\O{O}%
  \def\o{o}%
  \def\SS{SS}%
  \def\ss{ss}%
  \def\th{th}%
%    \end{macrocode}
%\changes{4.30}{2017-06-11}{added \cs{TH}, \cs{dh} and \cs{DH}}
%    \begin{macrocode}
  \def\TH{TH}%
  \def\dh{dh}%
  \def\DH{DH}%
}
%    \end{macrocode}
%\changes{4.43}{2019-09-28}{add check for LaTeX version 2019/10/01}
%Need to check if the LaTeX kernel is at least version 2019/10/01 as
%that changes the way that UTF-8 characters expand.
%    \begin{macrocode}
\@ifl@t@r\fmtversion{2019/10/01}
{%
 \appto\glsnoidxstripaccents{\let\UTFviii@two@octets\UTFviii@two@octets@combine}%
}
{}
%    \end{macrocode}
%\end{macro}
%
% Before defining the \pkgopt{sanitize} package option, The 
% key-value list for the \pkgopt{sanitize} value needs to be defined.
% These are all boolean keys. If they are not given a value, assume
% \texttt{true}.
%
%    \begin{macrocode}
\define@boolkey[gls]{sanitize}{description}[true]{%
  \GlossariesWarning{sanitize={description} package option deprecated}%
  \ifgls@sanitize@description
    \glssetnoexpandfield{desc}%
    \glssetnoexpandfield{descplural}%
  \else
    \glssetexpandfield{desc}%
    \glssetexpandfield{descplural}%
  \fi
}
%    \end{macrocode}
%    \begin{macrocode}
\define@boolkey[gls]{sanitize}{name}[true]{%
  \GlossariesWarning{sanitize={name} package option deprecated}%
  \ifgls@sanitize@name
    \glssetnoexpandfield{name}%
  \else
    \glssetexpandfield{name}%
  \fi
}
%    \end{macrocode}
%    \begin{macrocode}
\define@boolkey[gls]{sanitize}{symbol}[true]{%
  \GlossariesWarning{sanitize={symbol} package option deprecated}%
  \ifgls@sanitize@symbol
    \glssetnoexpandfield{symbol}%
    \glssetnoexpandfield{symbolplural}%
  \else
    \glssetexpandfield{symbol}%
    \glssetexpandfield{symbolplural}%
  \fi
}
%    \end{macrocode}
%
%\begin{option}{sanitizesort}
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{sanitizesort}[true]{%
  \ifglssanitizesort
    \glssetnoexpandfield{sortvalue}%
    \renewcommand*{\@gls@noidx@setsanitizesort}{%
      \glssanitizesorttrue
      \glssetnoexpandfield{sortvalue}%
    }%
  \else
    \glssetexpandfield{sortvalue}%
    \renewcommand*{\@gls@noidx@setsanitizesort}{%
      \glssanitizesortfalse
      \glssetexpandfield{sortvalue}%
    }%
  \fi
}
%    \end{macrocode}
% Default setting:
%    \begin{macrocode}
\glssanitizesorttrue
\glssetnoexpandfield{sortvalue}%
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@gls@noidx@setsanitizesort}
% Default behaviour for \ics{makenoidxglossaries} is
% sanitizesort=false.
%    \begin{macrocode}
\newcommand*{\@gls@noidx@setsanitizesort}{%
  \glssanitizesortfalse
  \glssetexpandfield{sortvalue}%
}
%    \end{macrocode}
%\end{macro}
%
%    \begin{macrocode}
\define@choicekey[gls]{sanitize}{sort}{true,false}[true]{%
  \setbool{glssanitizesort}{#1}%
  \ifglssanitizesort
    \glssetnoexpandfield{sortvalue}%
  \else
    \glssetexpandfield{sortvalue}%
  \fi
  \GlossariesWarning{sanitize={sort} package option
    deprecated. Use sanitizesort instead}%
}
%    \end{macrocode}
%
%\begin{option}{sanitize}
% \changes{4.02}{2013-12-05}{fixed bug that caused an error here}
% \changes{4.11}{2014-09-01}{fixed backward compatibility support of
% deprecated sanitize=none option}
%    \begin{macrocode}
\define@key{glossaries.sty}{sanitize}[description=true,symbol=true,name=true]{%
  \ifthenelse{\equal{#1}{none}}%
  {%
    \GlossariesWarning{sanitize package option deprecated}%
    \glssetexpandfield{name}%
    \glssetexpandfield{symbol}%
    \glssetexpandfield{symbolplural}%
    \glssetexpandfield{desc}%
    \glssetexpandfield{descplural}%
  }%
  {%
    \setkeys[gls]{sanitize}{#1}%
  }%
}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\ifglstranslate}
% As from version 3.13a, the \pkgopt{translator} package option is a
% choice rather than boolean option so now need to define
% conditional:
%    \begin{macrocode}
\newif\ifglstranslate
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@notranslatorhook}
%\changes{3.13a}{2013-11-05}{new}
%\changes{4.12}{2014-11-22}{removed}
%\cs{@gls@notranslatorhook} has been removed.
%\end{macro}
%\begin{macro}{\@gls@usetranslator}
%\changes{4.12}{2014-11-22}{new}
%    \begin{macrocode}
\newcommand*\@gls@usetranslator{%
%    \end{macrocode}
% \sty{polyglossia} tricks \cs{@ifpackageloaded} into thinking that
% \sty{babel} has been loaded, so check for \sty{polyglossia} as well.
%    \begin{macrocode}
  \@ifpackageloaded{polyglossia}%
  {%
     \let\glsifusetranslator\@secondoftwo
  }%
  {%
    \@ifpackageloaded{babel}%
    {%
        \IfFileExists{translator.sty}%
        {%
           \RequirePackage{translator}%
           \let\glsifusetranslator\@firstoftwo
        }%
        {}%
    }%
    {}%
  }%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsifusedtranslatordict}
%\changes{4.12}{2014-11-22}{new}
% Checks if given \sty{translator} dictionary has been loaded.
%    \begin{macrocode}
\newcommand{\glsifusedtranslatordict}[3]{%
  \glsifusetranslator
  {\ifcsdef{ver@glossaries-dictionary-#1.dict}{#2}{#3}}%
  {#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{notranslate}
%\changes{3.14a}{2013-11-12}{new}
% Provide a synonym for \pkgopt[false]{translate} that can be passed
% via the document class.
%    \begin{macrocode}
\@gls@declareoption{notranslate}{%
  \glstranslatefalse
  \let\@gls@usetranslator\relax
  \let\glsifusetranslator\@secondoftwo
}
%    \end{macrocode}
%\end{option}
%
%\begin{option}{translate}
%\changes{1.1}{2008-02-22}{translate option added}
% Define \pkgopt{translate} option. If false don't set up
% multi-lingual support.
%\changes{4.41}{2018-07-23}{changed \cs{val} and \cs{nr} to
%\cs{gls@translate@val} and \cs{gls@translate@nr}}
%    \begin{macrocode}
\define@choicekey{glossaries.sty}{translate}%
  [\gls@translate@val\gls@translate@nr]%
  {true,false,babel}[true]%
  {%
    \ifcase\gls@translate@nr\relax
      \glstranslatetrue
      \renewcommand*\@gls@usetranslator{%
        \@ifpackageloaded{polyglossia}%
        {%
           \let\glsifusetranslator\@secondoftwo
        }%
        {%
          \@ifpackageloaded{babel}%
          {%
            \IfFileExists{translator.sty}%
            {%
               \RequirePackage{translator}%
               \let\glsifusetranslator\@firstoftwo
            }%
            {}%
          }%
          {}%
        }%
      }%
    \or
      \glstranslatefalse
      \let\@gls@usetranslator\relax
      \let\glsifusetranslator\@secondoftwo
    \or
      \glstranslatetrue
      \let\@gls@usetranslator\relax
      \let\glsifusetranslator\@secondoftwo
    \fi
  }
%    \end{macrocode}
%\end{option}
% Set the default value:
%    \begin{macrocode}
\glstranslatefalse
\let\glsifusetranslator\@secondoftwo
\@ifpackageloaded{translator}%
{%
  \glstranslatetrue
  \let\glsifusetranslator\@firstoftwo
}%
{%
  \@for\gls@thissty:=tracklang,babel,ngerman,polyglossia\do
  {
    \@ifpackageloaded{\gls@thissty}%
    {%
      \glstranslatetrue
      \@endfortrue
    }%
    {}%
  }
}
%    \end{macrocode}
%
%\begin{option}{indexonlyfirst}
%\changes{3.02}{2012-05-21}{new}
% Set whether to only index on first use.
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{indexonlyfirst}[true]{}
\glsindexonlyfirstfalse
%    \end{macrocode}
%\end{option}
%
%\begin{option}{hyperfirst}
%\changes{2.03}{2009-09-23}{new}
% Set whether or not terms should have a hyperlink on first use.
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{hyperfirst}[true]{}
\glshyperfirsttrue
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@gls@setacrstyle}
% Keep track of whether an acronym style has been set (for the
% benefit of \cs{setupglossaries}):
%    \begin{macrocode}
\newcommand*{\@gls@setacrstyle}{}
%    \end{macrocode}
%\end{macro}
%\begin{option}{footnote}
% Set the long form of the acronym in footnote on first use.
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[glsacr]{footnote}[true]{%
  \ifbool{glsacrdescription}%
  {}%
  {%
    \renewcommand*{\@gls@sanitizedesc}{}%
  }%
  \renewcommand*{\@gls@setacrstyle}{\SetAcronymStyle}%
}
%    \end{macrocode}
%\end{option}
%\begin{option}{description}
% Allow acronyms to have a description (needs to be set using
% the \gloskey{description} key in the optional argument of
% \ics{newacronym}).
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[glsacr]{description}[true]{%
  \renewcommand*{\@gls@sanitizesymbol}{}%
  \renewcommand*{\@gls@setacrstyle}{\SetAcronymStyle}%
}
%    \end{macrocode}
%\end{option}
%\begin{option}{smallcaps}
% Define \ics{newacronym} to set the short form in small capitals.
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[glsacr]{smallcaps}[true]{%
  \renewcommand*{\@gls@sanitizesymbol}{}%
  \renewcommand*{\@gls@setacrstyle}{\SetAcronymStyle}%
}
%    \end{macrocode}
%\end{option}
%\begin{option}{smaller}
% Define \ics{newacronym} to set the short form using \cs{smaller}
% which obviously needs to be defined by loading the appropriate
% package.
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[glsacr]{smaller}[true]{%
  \renewcommand*{\@gls@sanitizesymbol}{}%
  \renewcommand*{\@gls@setacrstyle}{\SetAcronymStyle}%
}
%    \end{macrocode}
%\end{option}
%\begin{option}{dua}
% Define \ics{newacronym} to always use the long forms 
% (i.e.\ don't use acronyms)
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[glsacr]{dua}[true]{%
  \renewcommand*{\@gls@sanitizesymbol}{}%
  \renewcommand*{\@gls@setacrstyle}{\SetAcronymStyle}%
}
%    \end{macrocode}
%\end{option}
%\begin{option}{shotcuts}
% Define acronym shortcuts.
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[glsacr]{shortcuts}[true]{}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\glsorder}
% Stores the glossary ordering. This may either be \qt{word}
% or \qt{letter}. This passes the relevant information to
% \app{makeglossaries}. The default is word ordering.
%    \begin{macrocode}
\newcommand*{\glsorder}{word}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glsorder}
% The ordering information is written to the auxiliary file
% for \app{makeglossaries}, so ignore the auxiliary 
% information.
%    \begin{macrocode}
\newcommand*{\@glsorder}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{order}
%\changes{1.17}{2008-12-26}{order package option added}
%    \begin{macrocode}
\define@choicekey{glossaries.sty}{order}{word,letter}{%
  \def\glsorder{#1}}
%    \end{macrocode}
%\end{option}
%
%\changes{1.17}{2008-12-26}{added xindy support}
%\begin{macro}{\ifglsxindy}
%\changes{1.17}{2008-12-26}{new}
% Provide boolean to determine whether \gls{xindy} or
% \gls{makeindex} will be used to sort the glossaries.
%    \begin{macrocode}
\newif\ifglsxindy
%    \end{macrocode}
%\end{macro}
% The default is \app{makeindex}:
%    \begin{macrocode}
\glsxindyfalse
%    \end{macrocode}
%
%\begin{option}{makeindex}
% Define package option to specify that \app{makeindex} will 
% be used to sort the glossaries:
%    \begin{macrocode}
\@gls@declareoption{makeindex}{\glsxindyfalse}
%    \end{macrocode}
%\end{option}
%
% The \pkgopt{xindy} package option may have a value which in
% turn can be a key=value list. First define the keys for this
% sub-list. The boolean "glsnumbers" determines whether to
% automatically add the \texttt{glsnumbers} letter group.
%    \begin{macrocode}
\define@boolkey[gls]{xindy}{glsnumbers}[true]{}
\gls@xindy@glsnumberstrue
%    \end{macrocode}
%
%\begin{macro}{\@xdy@main@language}
%\changes{3.06}{2013/06/17}{Changed back to using \cs{languagename}}
% Define what language to use for each glossary type (if a
% language is not defined for a particular glossary type
% the language specified for the main glossary is used.)
%    \begin{macrocode}
\def\@xdy@main@language{\languagename}%
%    \end{macrocode}
%\end{macro}
% Define key to set the language
%    \begin{macrocode}
\define@key[gls]{xindy}{language}{\def\@xdy@main@language{#1}}
%    \end{macrocode}
%
%\begin{macro}{\gls@codepage}
% Define the code page. If \ics{inputencodingname} is defined
% use that, otherwise have initialise with no codepage.
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%    \begin{macrocode}
\ifcsundef{inputencodingname}{%
  \def\gls@codepage{}}{%
  \def\gls@codepage{\inputencodingname}
}
%    \end{macrocode}
% Define a key to set the code page.
%    \begin{macrocode}
\define@key[gls]{xindy}{codepage}{\def\gls@codepage{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{xindy}
% Define package option to specify that \app{xindy} will be 
% used to sort the glossaries:
%    \begin{macrocode}
\define@key{glossaries.sty}{xindy}[]{%
  \glsxindytrue
  \setkeys[gls]{xindy}{#1}%
}
%    \end{macrocode}
%\end{option}
%
%\begin{option}{xindygloss}
%\changes{3.14a}{2013-11-12}{new}
% Provide a synonym for \pkgopt[]{xindy} that can be passed via the
% document class options.
%    \begin{macrocode}
\@gls@declareoption{xindygloss}{%
  \glsxindytrue
}
%    \end{macrocode}
%\end{option}
%
%\begin{option}{xindynoglsnumbers}
%\changes{4.02}{2013-12-05}{new}
% Provide a synonym for \texttt{xindy={glsnumbers=false}} that can
% be passed via the document class options.
%    \begin{macrocode}
\@gls@declareoption{xindynoglsnumbers}{%
  \glsxindytrue
  \gls@xindy@glsnumbersfalse
}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@domakeglossaries}
%\changes{4.45}{2020-02-13}{new}
%    \begin{macrocode}
\providecommand{\@domakeglossaries}[1]{#1}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{disablemakegloss}
%\changes{4.45}{2020-02-13}{new}
%Provide a way of disabling \cs{makeglossaries}. For example, if a
%class or package explicitly uses \cs{makeglossaries}. This is a
%valueless option to allow it to be passed through the document
%class option list.
%    \begin{macrocode}
\@gls@declareoption{disablemakegloss}{%
  \ifdefequal\makeglossaries\@no@makeglossaries
  {%
    \GlossariesWarning{Option `disablemakegloss' has no effect
    (\string\makenoidxglossaries\space has already been used)}%
  }%
  {%
    \ifdefequal\@makeglossary\@gobble
    {%
      \GlossariesWarning{Option `disablemakegloss' has no effect
      (\string\makeglossaries\space has already been used)}%
    }%
    {%
      \renewcommand{\@domakeglossaries}[1]{%
        \PackageInfo{glossaries}{\string\makeglossaries\space and 
          \string\makenoidxglossaries\space have been disabled}%
      }%
    }%
  }%
}
%    \end{macrocode}
%\end{option}
%\begin{option}{restoremakegloss}
%\changes{4.45}{2020-02-13}{new}
%Cancel the effect of \pkgopt{disablemakegloss}.
%    \begin{macrocode}
\@gls@declareoption{restoremakegloss}{%
  \ifdefequal\makeglossaries\@no@makeglossaries
  {%
    \GlossariesWarning{Option `restoremakegloss' has no effect
    (\string\makenoidxglossaries\space has already been used)}%
  }%
  {%
    \ifdefequal\@makeglossary\@gobble
    {%
      \GlossariesWarning{Option `restoremakegloss' has no effect
      (\string\makeglossaries\space has already been used)}%
    }%
    {%
      \PackageInfo{glossaries}{\string\makeglossaries\space and 
        \string\makenoidxglossaries\space have been restored}%
      \let\@domakeglossaries\@firstofone
    }%
  }%
}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@do@write@glslabels}
%\changes{4.45}{2020-02-13}{new}
%    \begin{macrocode}
\newcommand*{\@do@write@glslabels}{%
 \AtEndDocument{\@@do@write@glslabels}%
 \let\@do@write@glslabels\relax
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@do@write@glslabels}
%\changes{4.45}{2020-02-13}{new}
%\changes{4.47}{2021-09-20}{fully expand list}
%    \begin{macrocode}
\newcommand*{\@@do@write@glslabels}{%
  \newwrite\@gls@labelsfile
  \immediate\openout\@gls@labelsfile=\jobname.glslabels
  \protected@edef\@gls@fulllist{\@glo@types}%
  \ifdefempty{\@ignored@glossaries}{}%
   {\protected@eappto\@gls@fulllist{,\@ignored@glossaries}}%
  \forallglsentries[\@gls@fulllist]{\@glsentry}%
  {%
    \ifdefempty{\@glsentry}{}%
    {%
      \ifx\do@write@glslabelsname\@gobble
        \def\@gls@thisentryname{}%
      \else
        \letcs{\@gls@thisentryname}{glo@\glsdetoklabel{\@glsentry}@name}%
        \@onelevel@sanitize\@gls@thisentryname
      \fi
      \immediate\write\@gls@labelsfile
         {\@glsentry\do@write@glslabelsname{\@gls@thisentryname}}%
    }%
  }%
  \immediate\closeout\@gls@labelsfile
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\do@write@glslabelsname}
%\changes{4.47}{2021-09-20}{new}
% Support for additionally writing the name as well as the label.
% Let to \cs{@gobble} if name not required and to
% \cs{@write@glslabelsname} if required.
%    \begin{macrocode}
\newcommand*{\do@write@glslabelsname}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@write@glslabelsname}
%\changes{4.47}{2021-09-20}{new}
%    \begin{macrocode}
\begingroup
\catcode`\^^I12
\gdef\@write@glslabelsname#1{^^I#1}
\endgroup
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{writeglslabels}
%\changes{4.45}{2020-02-13}{new}
%This option will write all entry labels (including those in ignored
%glossaries) to the file \cs{jobname}\texttt{.glslabels}. This file
%may be used by text editors for label auto-completion.
%    \begin{macrocode}
\@gls@declareoption{writeglslabels}{\@do@write@glslabels
 \let\do@write@glslabelsname\@gobble}
%    \end{macrocode}
%\end{option}
%\begin{option}{writeglslabelnames}
%\changes{4.47}{2021-09-20}{new}
%As the above but also writes the name.
%    \begin{macrocode}
\@gls@declareoption{writeglslabelnames}{\@do@write@glslabels
 \let\do@write@glslabelsname\@write@glslabelsname}
%    \end{macrocode}
%\end{option}
%\begin{macro}{\ifglsautomake}
%\changes{4.42}{2019-01-06}{now defined explicitly instead of through
%boolean key}
%    \begin{macrocode}
\newif\ifglsautomake
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@automake@nr}
%\changes{4.42}{2019-01-06}{new}
%    \begin{macrocode}
\newcommand{\gls@automake@nr}{1}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{automake}
%\changes{4.08}{2014-07-30}{new}
%\changes{4.42}{2019-01-06}{switch from boolean to choice}
% If this setting is on, automatically run
% \gls{makeindex}\slash\gls{xindy} at the end of the document.
% Must be used with \ics{makeglossaries}.
% Default is false. As from v4.42, this is now a choice rather than
% boolean key.
%    \begin{macrocode}
\define@choicekey{glossaries.sty}{automake}%
  [\gls@automake@val\gls@automake@nr]{true,false,immediate}[true]{%
  \ifnum\gls@automake@nr=1\relax
   \glsautomakefalse
  \else
   \glsautomaketrue
  \fi
  \ifglsautomake
    \renewcommand*{\@gls@doautomake}{%
      \PackageError{glossaries}{You must use
      \string\makeglossaries\space with automake=true}
      {%
         Either remove the automake=true setting or
         add \string\makeglossaries\space to your document preamble.%
      }%
    }%
  \else
    \renewcommand*{\@gls@doautomake}{}%
  \fi
}
\glsautomakefalse
%    \end{macrocode}
%\end{option}
%\begin{macro}{\@gls@doautomake}
%\changes{4.08}{2014-07-30}{new}
%    \begin{macrocode}
\newcommand*{\@gls@doautomake}{}
\AtEndDocument{\@gls@doautomake}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{savewrites}
%\changes{3.0}{2011-04-02}{new}
% The \pkgopt{savewrites} package option is provided to save on 
% the number of write registers.
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{savewrites}[true]{%
  \ifglssavewrites
    \renewcommand*{\glswritefiles}{\@glswritefiles}%
  \else
    \let\glswritefiles\@empty
  \fi
}
%    \end{macrocode}
%\end{option}
% Set default:
%\changes{4.03}{2014-01-17}{changed default to \cs{@empty} instead
%of \cs{relax}}
%    \begin{macrocode}
\glssavewritesfalse
\let\glswritefiles\@empty
%    \end{macrocode}
%
%\begin{option}{compatible-3.07}
%\changes{3.11a}{2013-10-15}{cnew}
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{compatible-3.07}[true]{}
\boolfalse{glscompatible-3.07}
%    \end{macrocode}
%\end{option}
%
%\begin{option}{compatible-2.07}
%\changes{3.0}{2011-04-02}{compatible-2.07 option added}
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{compatible-2.07}[true]{%
%    \end{macrocode}
% Also set 3.07 compatibility if this option is set.
%\changes{3.14a}{2013-11-12}{added check for 2.07 before setting 3.07
%compatibility}
%    \begin{macrocode}
  \ifbool{glscompatible-2.07}%
  {%
    \booltrue{glscompatible-3.07}%
  }%
  {}%
}
\boolfalse{glscompatible-2.07}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\gls@original@makeglossary}
%Store the original definition.
%\changes{4.41}{2018-07-23}{new}
%    \begin{macrocode}
\let\gls@original@makeglossary\makeglossary
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@original@glossary}
%Store the original definition.
%\changes{4.41}{2018-07-23}{new}
%    \begin{macrocode}
\let\gls@original@glossary\glossary
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\makeglossary}
% The \cs{makeglossary} command is redefined to be
% identical to \cs{makeglossaries}. (This is done partly to 
% reinforce the message that you must either use 
% \cs{@makeglossary} for all the glossaries or for none 
% of them, but is also a legacy from the old \styfmt{glossary} package.)
%\changes{4.41}{2018-07-23}{added warning}
%    \begin{macrocode}
\def\makeglossary{%
 \GlossariesWarning{Use of \string\makeglossary\space with
 glossaries.sty is \MessageBreak deprecated. Use \string\makeglossaries\space
 instead. If you \MessageBreak need the original definition of
 \string\makeglossary\space use \MessageBreak the package options
 kernelglossredefs=false (to \MessageBreak restore the former definition of
 \string\makeglossary) and \MessageBreak nomain (if the file extensions cause a
 conflict)}%
 \makeglossaries
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@override@glossary}
%\changes{4.41}{2018-07-23}{new}
%    \begin{macrocode}
\newcommand*{\@gls@override@glossary}[1][main]{%
 \GlossariesWarning{Use of \string\glossary\space with
 glossaries.sty is deprecated. \MessageBreak Indexing should be performed
 with the user level \MessageBreak commands, such as \string\gls\space or
 \string\glsadd. If you need the \MessageBreak original definition of
 \string\glossary\space use the package \MessageBreak options
  kernelglossredefs=false (to restore the \MessageBreak former definition of
 \string\glossary) and nomain (if the \MessageBreak file extensions cause a
 conflict)}%
 \gls@glossary{#1}%
}
%    \end{macrocode}
%\end{macro}
%
% In v4.10, the redefinition of \cs{glossary} was removed since it
% was never intended as a user level command (and wasn't documented
% in the user manual), however it seems there are packages that have 
% hacked the internal macros used by \styfmt{glossaries} and no longer 
% work with this redefinition removed, so it's been restored in v4.11 
% but is not used at all by \styfmt{glossaries}. 
% (This may be removed or moved to a compatibility mode in future.)
% As from v4.41, the use of \cs{glossary} now triggers a warning.
% The package option \pkgopt[nowarn]{kernelglossredefs} may be used to
% remove the warning, but it's better not to use \cs{glossary}.
%\begin{macro}{\glossary}
%\changes{4.41}{2018-07-23}{added warning}
%    \begin{macrocode}
\if@gls@docloaded
\else
  \def\glossary{\@gls@override@glossary}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{kernelglossredefs}
%\changes{4.41}{2018-07-23}{new}
%The \sty{glossaries} package redefines the kernel commands
%\cs{makeglossary} and \cs{glossary} as a legacy action from the
%former \sty{glossary} package. In hindsight that wasn't a good idea
%as it's possible that the \sty{glossaries} package may need to be
%used with another class or package that needs these commands.
%Neither of these commands are documented in the main user manual
%and their use is not encouraged. The preferred commands are
%\cs{makeglossaries} (to open all associated glossary files) and
%\cs{gls}, \cs{glstext} etc or \cs{glsadd} for indexing.
%    \begin{macrocode}
\define@choicekey{glossaries.sty}{kernelglossredefs}%
 [\gls@debug@val\gls@debug@nr]{true,false,nowarn}[true]%
{%
  \ifcase\gls@debug@nr\relax
   \def\glossary{\@gls@override@glossary}%
   \def\makeglossary{%
    \GlossariesWarning{Use of \string\makeglossary\space with
    glossaries.sty is deprecated. Use \string\makeglossaries\space
    instead. If you need the original definition of
    \string\makeglossary\space use the package options
    kernelglossredefs=false (to prevent redefinition of
    \string\makeglossary) and nomain (if the file extensions cause a
    conflict)}%
    \makeglossaries
   }%
  \or
    \let\glossary\gls@original@glossary
    \let\makeglossary\gls@original@makeglossary
  \or
    \def\makeglossary{\makeglossaries}%
    \renewcommand*{\@gls@override@glossary}[1][main]{%
       \gls@glossary{##1}%
    }%
  \fi
}
%    \end{macrocode}
%\end{option}
%
%\begin{option}{symbols}
% Create a \qt{symbols} glossary type
%\changes{3.11a}{2013-10-15}{new}
%    \begin{macrocode}
\@gls@declareoption{symbols}{%
  \let\@gls@do@symbolsdef\@gls@symbolsdef
}
%    \end{macrocode}
% Default is not to define the symbols glossary:
%    \begin{macrocode}
\newcommand*{\@gls@do@symbolsdef}{}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@gls@symbolsdef}
%\changes{4.02}{2013-12-05}{new}
%    \begin{macrocode}
\newcommand*{\@gls@symbolsdef}{%
  \newglossary[slg]{symbols}{sls}{slo}{\glssymbolsgroupname}%
  \newcommand*{\printsymbols}[1][]{\printglossary[type=symbols,##1]}%
%    \end{macrocode}
% Define hook to set the toc title when \sty{translator} is in use.
%\changes{4.06}{2014-03-12}{added hook to set toc title}
%    \begin{macrocode}
  \newcommand*{\gls@tr@set@symbols@toctitle}{%
    \translatelet{\glossarytoctitle}{Symbols (glossaries)}%
  }%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{numbers}
% Create a \qt{symbols} glossary type
%\changes{3.11a}{2013-10-15}{new}
%    \begin{macrocode}
\@gls@declareoption{numbers}{%
  \let\@gls@do@numbersdef\@gls@numbersdef
}
%    \end{macrocode}
% Default is not to define the numbers glossary:
%    \begin{macrocode}
\newcommand*{\@gls@do@numbersdef}{}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@gls@numbersdef}
%\changes{4.02}{2013-12-05}{new}
%    \begin{macrocode}
\newcommand*{\@gls@numbersdef}{%
  \newglossary[nlg]{numbers}{nls}{nlo}{\glsnumbersgroupname}%
  \newcommand*{\printnumbers}[1][]{\printglossary[type=numbers,##1]}%
%    \end{macrocode}
% Define hook to set the toc title when \sty{translator} is in use.
%\changes{4.06}{2014-03-12}{added hook to set toc title}
%    \begin{macrocode}
  \newcommand*{\gls@tr@set@numbers@toctitle}{%
    \translatelet{\glossarytoctitle}{Numbers (glossaries)}%
  }%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{index}
% Create an \qt{index} glossary type
%\changes{4.02}{2013-12-05}{new}
%    \begin{macrocode}
\@gls@declareoption{index}{%
  \ifx\@gls@do@indexdef\@empty
    \let\@gls@do@indexdef\@gls@indexdef
  \fi
}
%    \end{macrocode}
%\end{option}
%\begin{option}{noglossaryindex}
% Counteract \pkgopt{index} if it happens to be globally used in the document class.
%\changes{4.42}{2019-01-06}{new}
%    \begin{macrocode}
\@gls@declareoption{noglossaryindex}{%
  \let\@gls@do@indexdef\relax
}
%    \end{macrocode}
%\end{option}
% Default is not to define index glossary:
%    \begin{macrocode}
\newcommand*{\@gls@do@indexdef}{}
%    \end{macrocode}
%
%\begin{macro}{\@gls@indexdef}
%\changes{4.02}{2013-12-05}{new}
%\cs{indexname} isn't set by \sty{glossaries}.
%    \begin{macrocode}
\newcommand*{\@gls@indexdef}{%
  \newglossary[ilg]{index}{ind}{idx}{\indexname}%
  \newcommand*{\printindex}[1][]{\printglossary[type=index,##1]}%
  \newcommand*{\newterm}[2][]{%
    \newglossaryentry{##2}%
    {type={index},name={##2},description={\nopostdesc},##1}}
  \let\@gls@do@indexdef\relax
}%
%    \end{macrocode}
%\end{macro}
%
% Process package options. First process any options that have been
% passed via the document class.
%    \begin{macrocode}
\@for\CurrentOption :=\@declaredoptions\do{%
  \ifx\CurrentOption\@empty
  \else
    \@expandtwoargs
      \in@ {,\CurrentOption ,}{,\@classoptionslist,\@curroptions,}%
    \ifin@
      \@use@ption
      \expandafter \let\csname ds@\CurrentOption\endcsname\@empty
    \fi
  \fi
}
%    \end{macrocode}
% Now process options passed to the package:
%    \begin{macrocode}
\ProcessOptionsX
%    \end{macrocode}
% Load backward compatibility stuff:
%    \begin{macrocode}
\RequirePackage{glossaries-compatible-307}
%    \end{macrocode}
%
%\begin{macro}{\setupglossaries}
%\changes{3.11a}{2013-10-15}{new}
% Provide way to set options after package has been loaded. However,
% some options must be set before \cs{ProcessOptionsX}, so they have
% to be disabled:
%    \begin{macrocode}
\disable@keys{glossaries.sty}{compatible-2.07,%
 xindy,xindygloss,xindynoglsnumbers,makeindex,%
 acronym,translate,notranslate,nolong,nosuper,notree,nostyles,%
 nomain,noglossaryindex}
%    \end{macrocode}
%Now define \cs{setupglossaries}:
%    \begin{macrocode}
\newcommand*{\setupglossaries}[1]{%
  \renewcommand*{\@gls@setacrstyle}{}%
  \ifglsacrshortcuts
    \def\@gls@setupshortcuts{\glsacrshortcutstrue}%
  \else
    \def\@gls@setupshortcuts{%
      \ifglsacrshortcuts
        \DefineAcronymSynonyms
      \fi
    }%
  \fi
  \glsacrshortcutsfalse
  \let\@gls@do@numbersdef\relax
  \let\@gls@do@symbolssdef\relax
  \let\@gls@do@indexdef\relax
  \let\@gls@do@acronymsdef\relax
  \ifglsentrycounter
    \let\@gls@doentrycounterdef\relax
  \else
    \let\@gls@doentrycounterdef\@gls@define@glossaryentrycounter
  \fi
  \ifglssubentrycounter
    \let\@gls@dosubentrycounterdef\relax
  \else
    \let\@gls@dosubentrycounterdef\@gls@define@glossarysubentrycounter
  \fi
  \setkeys{glossaries.sty}{#1}%
  \@gls@setacrstyle
  \@gls@setupshortcuts
  \@gls@do@acronymsdef
  \@gls@do@numbersdef
  \@gls@do@symbolssdef
  \@gls@do@indexdef
  \@gls@doentrycounterdef
  \@gls@dosubentrycounterdef
}
%    \end{macrocode}
%\end{macro}
%
% If chapters are defined and the user has requested the
% section counter as a package option, \cs{@chapter} will
% be modified so 
% that it adds a \texttt{section.}\meta{n}\texttt{.0} target, 
% otherwise entries placed before the first section of a chapter
% will have undefined links.
%
% The same problem will also occur if a lower sectional unit is
% used, but this is less likely to happen. If it does, or if
% you change \cs{glscounter} to "section" later, you
% will have to specify a different counter for the entries
% that give rise to a \texttt{name}"{"\meta{section-level}"."\meta{n}".0}"
% non-existent warning (e.g. "\gls[counter=chapter]{label}").
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%    \begin{macrocode}
\ifthenelse{\equal{\glscounter}{section}}%
{%
  \ifcsundef{chapter}{}%
  {%
    \let\@gls@old@chapter\@chapter
    \def\@chapter[#1]#2{\@gls@old@chapter[{#1}]{#2}%
    \ifcsundef{hyperdef}{}{\hyperdef{section}{\thesection}{}}}%
  }%
}%
{}
%    \end{macrocode}
%
%\begin{macro}{\@gls@onlypremakeg}
% Some commands only have an effect when used before 
% \ics{makeglossaries}. So define a list of commands that
% should be disabled after \ics{makeglossaries}
%    \begin{macrocode}
\newcommand*{\@gls@onlypremakeg}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@onlypremakeg}
% Adds the specified control sequence to the list of commands that
% must be disabled after \ics{makeglossaries}.
%    \begin{macrocode}
\newcommand*{\@onlypremakeg}[1]{%
  \ifx\@gls@onlypremakeg\@empty
     \def\@gls@onlypremakeg{#1}%
  \else
     \expandafter\toks@\expandafter{\@gls@onlypremakeg}%
     \edef\@gls@onlypremakeg{\the\toks@,\noexpand#1}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@disable@onlypremakeg}
% Disable all commands listed in \cs{@gls@onlypremakeg}
%    \begin{macrocode}
\newcommand*{\@disable@onlypremakeg}{%
\@for\@thiscs:=\@gls@onlypremakeg\do{%
   \expandafter\@disable@premakecs\@thiscs%
}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@disable@premakecs}
% Disables the given command.
%    \begin{macrocode}
\newcommand*{\@disable@premakecs}[1]{%
  \def#1{\PackageError{glossaries}{\string#1\space may only be
  used before \string\makeglossaries}{You can't use
  \string#1\space after \string\makeglossaries}}%
}
%    \end{macrocode}
%\end{macro}
%
%\section{Predefined Text}\label{sec:predefinednames}
% Set up default textual tags that are used by this
% package. Some of the names may already be defined (e.g.\ by
% \isty{babel}) so \cs{providecommand} is used.
%
% Main glossary title:
%\begin{macro}{\glossaryname}
%    \begin{macrocode}
\providecommand*{\glossaryname}{Glossary}
%    \end{macrocode}
%\end{macro}
% The title for the "acronym" glossary type (which is defined if 
% \pkgopt{acronym} package option is used) is given by
% \cs{acronymname}. If the \pkgopt{acronym}
% package option is not used, \cs{acronymname} won't be used.
%\begin{macro}{\acronymname}
%    \begin{macrocode}
\providecommand*{\acronymname}{Acronyms}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glssettoctitle}
% Sets the TOC title for the given glossary.
%\changes{1.15}{2008-08-15}{new}
%    \begin{macrocode}
\newcommand*{\glssettoctitle}[1]{%
 \def\glossarytoctitle{\csname @glotype@#1@title\endcsname}}
%    \end{macrocode}
%\end{macro}
%
% The following commands provide text for the headers used by 
% some of the tabular-like glossary 
% styles. Whether or not they get used in the glossary depends on
% the glossary style.
%\begin{macro}{\entryname}
%    \begin{macrocode}
\providecommand*{\entryname}{Notation}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\descriptionname}
%    \begin{macrocode}
\providecommand*{\descriptionname}{Description}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\symbolname}
%    \begin{macrocode}
\providecommand*{\symbolname}{Symbol}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\pagelistname}
%    \begin{macrocode}
\providecommand*{\pagelistname}{Page List}
%    \end{macrocode}
%\end{macro}
% Labels for \app{makeindex}'s symbol and number groups:
%\begin{macro}{\glssymbolsgroupname}
%    \begin{macrocode}
\providecommand*{\glssymbolsgroupname}{Symbols}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsnumbersgroupname}
%    \begin{macrocode}
\providecommand*{\glsnumbersgroupname}{Numbers}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glspluralsuffix}
% The default plural is formed by appending \cs{glspluralsuffix} to
% the singular form.
%    \begin{macrocode}
\newcommand*{\glspluralsuffix}{s}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsacrpluralsuffix}
% Default plural suffix for acronyms
%\changes{4.12}{2014-11-22}{new}
%    \begin{macrocode}
\newcommand*{\glsacrpluralsuffix}{\glspluralsuffix}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsupacrpluralsuffix}
%\changes{4.12}{2014-11-22}{new}
%    \begin{macrocode}
\newcommand*{\glsupacrpluralsuffix}{\glstextup{\glsacrpluralsuffix}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\seename}
%    \begin{macrocode}
\providecommand*{\seename}{see}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\andname}
%    \begin{macrocode}
\providecommand*{\andname}{\&}
%    \end{macrocode}
%\end{macro}
% Add multi-lingual support\changes{1.08}{2007-10-13}{Added 
% babel support}. Thanks to everyone who contributed to the
% translations from both comp.text.tex and via email.
%\begin{macro}{\RequireGlossariesLang}
%\changes{4.12}{2014-11-22}{new}
%    \begin{macrocode}
\newcommand*{\RequireGlossariesLang}[1]{%
  \@ifundefined{ver@glossaries-#1.ldf}{\input{glossaries-#1.ldf}}{}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ProvidesGlossariesLang}
%\changes{4.12}{2014-11-22}{new}
%    \begin{macrocode}
\newcommand*{\ProvidesGlossariesLang}[1]{%
  \ProvidesFile{glossaries-#1.ldf}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\addglossarytocaptions}
% Does nothing if \sty{translator} hasn't been loaded.
%    \begin{macrocode}
\newcommand*{\addglossarytocaptions}[1]{}
%    \end{macrocode}
%\end{macro}
%
% As from v4.12, multlingual support has been split off into
% independently-maintained language modules.
%    \begin{macrocode}
\ifglstranslate
%    \end{macrocode}
% Load \sty{tracklang}
%    \begin{macrocode}
  \RequirePackage{tracklang}
%    \end{macrocode}
% Load \sty{translator} if required.
%    \begin{macrocode}
  \@gls@usetranslator
%    \end{macrocode}
% If using \isty{translator}, \ics{glossaryname} should be defined
% in terms of \ics{translate}, but if babel is also loaded, it will
% redefine \cs{glossaryname} whenever the language is set, so 
% override it. (Don't use \ics{addto} as \isty{polyglossia} doesn't
% define it.)
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%    \begin{macrocode}
  \@ifpackageloaded{translator}
  {%
%    \end{macrocode}
% If the language options have been specified through the
% document class, then \sty{translator} can pick them up. If not,
% \sty{translator} will default to English and any language
% option passed to \sty{babel} won't be detected, so if
% \cs{trans@languages} is just \texttt{English} and \cs{bbl@loaded}
% isn't simply \texttt{english}, then don't use the \sty{translator}
% dictionaries.
%    \begin{macrocode}
    \ifboolexpr
    {
      test {\ifdefstring{\trans@languages}{English}}
      and not
      test {\ifdefstring{bbl@loaded}{english}}
    }
    {%
      \let\glsifusetranslator\@secondoftwo
    }%
    {%
       \usedictionary{glossaries-dictionary}%
       \renewcommand*{\addglossarytocaptions}[1]{%
         \ifcsundef{captions#1}{}%
         {%
           \expandafter\let\expandafter\@gls@tmp\csname captions#1\endcsname
           \expandafter\toks@\expandafter{\@gls@tmp
             \renewcommand*{\glossaryname}{\translate{Glossary}}%
           }%
           \expandafter\edef\csname captions#1\endcsname{\the\toks@}%
         }%
       }%
    }%
  }%
  {}%
%    \end{macrocode}
% Check for tracked languages
%    \begin{macrocode}
  \AnyTrackedLanguages
  {%
    \ForEachTrackedDialect{\this@dialect}{%
      \IfTrackedLanguageFileExists{\this@dialect}%
      {glossaries-}% prefix
      {.ldf}%
      {%
        \RequireGlossariesLang{\CurrentTrackedTag}%
      }%
      {%
        \@gls@missinglang@warn\this@dialect\CurrentTrackedLanguage
      }%
    }%
  }%
  {}%
%    \end{macrocode}
% if using \sty{translator} use translator interface.
%    \begin{macrocode}
  \glsifusetranslator
  {%
    \renewcommand*{\glssettoctitle}[1]{%
      \ifcsdef{gls@tr@set@#1@toctitle}%
      {%
        \csuse{gls@tr@set@#1@toctitle}%
      }%
      {%
        \def\glossarytoctitle{\csname @glotype@#1@title\endcsname}%
      }%
    }%
    \renewcommand*{\glossaryname}{\translate{Glossary}}%
    \renewcommand*{\acronymname}{\translate{Acronyms}}%
    \renewcommand*{\entryname}{\translate{Notation (glossaries)}}%
    \renewcommand*{\descriptionname}{%
      \translate{Description (glossaries)}}%
    \renewcommand*{\symbolname}{\translate{Symbol (glossaries)}}%
    \renewcommand*{\pagelistname}{%
      \translate{Page List (glossaries)}}%
    \renewcommand*{\glssymbolsgroupname}{%
      \translate{Symbols (glossaries)}}%
    \renewcommand*{\glsnumbersgroupname}{%
      \translate{Numbers (glossaries)}}%
  }{}%
\fi
%    \end{macrocode}
%
%\begin{macro}{\nopostdesc}
% Provide a means to suppress description terminator for a given
% entry. (Useful for entries with no description.) Has no
% effect outside the glossaries.
%\changes{1.17}{2008-12-26}{new}
%\changes{3.05}{2013-04-21}{made robust}
%    \begin{macrocode}
\DeclareRobustCommand*{\nopostdesc}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@nopostdesc}
% Suppress next description terminator.
%    \begin{macrocode}
\newcommand*{\@nopostdesc}{%
  \let\org@glspostdescription\glspostdescription
  \def\glspostdescription{%
    \let\glspostdescription\org@glspostdescription}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@no@post@desc}
% Used for comparison purposes.
%    \begin{macrocode}
\newcommand*{\@no@post@desc}{\nopostdesc}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glspar}
% Provide means of having a paragraph break in glossary entries
%    \begin{macrocode}
\newcommand{\glspar}{\par}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\setStyleFile}
% Sets the style file. The relevant extension is appended.
%    \begin{macrocode}
\newcommand{\setStyleFile}[1]{%
  \renewcommand*{\gls@istfilebase}{#1}%
%    \end{macrocode}
% Just in case \cs{istfilename} has been modified.
%    \begin{macrocode}
  \ifglsxindy
    \def\istfilename{\gls@istfilebase.xdy}
  \else
    \def\istfilename{\gls@istfilebase.ist}
  \fi
}
%    \end{macrocode}
% This command only has an effect prior to using
% \ics{makeglossaries}.
%    \begin{macrocode}
\@onlypremakeg\setStyleFile
%    \end{macrocode}
%\end{macro}
%
% The name of the \app{makeindex} or \app{xindy} style file
% is given by \cs{istfilename}. This file is 
% created by \ics{writeist} (which is used by 
% \ics{makeglossaries}) so
% redefining this command will only have an effect if it is 
% done \emph{before} \cs{makeglossaries}. As from v1.17, use
% \ics{setStyleFile} instead of directly redefining \cs{istfilename}.
%\begin{macro}{\istfilename}
%\changes{1.17}{2008-12-26}{added xindy support}
%    \begin{macrocode}
\ifglsxindy
  \def\istfilename{\gls@istfilebase.xdy}
\else
  \def\istfilename{\gls@istfilebase.ist}
\fi
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\gls@istfilebase}
%\changes{4.08}{2014-07-30}{new}
%    \begin{macrocode}
\newcommand*{\gls@istfilebase}{\jobname}
%    \end{macrocode}
%\end{macro}
% The \app{makeglossaries} Perl script picks up this name
% from the auxiliary file. If the name ends with \filetype{.xdy}
% it calls \app{xindy} otherwise it calls \app{makeindex}.
% Since its not required by
% \LaTeX, \cs{@istfilename} ignores its argument.
%\begin{macro}{\@istfilename}
%    \begin{macrocode}
\newcommand*{\@istfilename}[1]{}
%    \end{macrocode}
%\end{macro}
%
% This command is the value of the \istkey{page\_compositor}
% \app{makeindex} key. Again, any redefinition of this command 
% must take place \emph{before} \cs{writeist} otherwise it 
% will have no effect. As from 1.17, use \ics{glsSetCompositor}
% instead of directly redefining \cs{glscompositor}.
%\begin{macro}{\glscompositor}
%    \begin{macrocode}
\newcommand*{\glscompositor}{.}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsSetCompositor}
% Sets the compositor.
%    \begin{macrocode}
\newcommand*{\glsSetCompositor}[1]{%
  \renewcommand*{\glscompositor}{#1}}
%    \end{macrocode}
% Only use before \ics{makeglossaries}
%    \begin{macrocode}
\@onlypremakeg\glsSetCompositor
%    \end{macrocode}
%\end{macro}
%
% (The page compositor is usually defined as a dash when using
% \app{makeindex}, but most of the standard counters used
% by \LaTeX\ use a full stop as the compositor, which is why I
% have used it as the default.) If \app{xindy} is used 
% \cs{glscompositor} only affects the \texttt{arabic-page-numbers}
% location class.
%\begin{macro}{\@glsAlphacompositor}
% This is only used by \app{xindy}. It specifies the
% compositor to use when location numbers are in the form
% \meta{letter}\meta{compositor}\meta{number}. For example,
% if \cs{@glsAlphacompositor} is set to ``.'' then it allows
% locations such as A.1 whereas if \cs{@glsAlphacompositor} is
% set to ``-'' then it allows locations such as A-1.
%    \begin{macrocode}
\newcommand*{\@glsAlphacompositor}{\glscompositor}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsSetAlphaCompositor}
% Sets the alpha compositor.
%    \begin{macrocode}
\ifglsxindy
  \newcommand*\glsSetAlphaCompositor[1]{%
     \renewcommand*\@glsAlphacompositor{#1}}
\else
  \newcommand*\glsSetAlphaCompositor[1]{%
    \glsnoxindywarning\glsSetAlphaCompositor}
\fi
%    \end{macrocode}
% Can only be used before \ics{makeglossaries}
%    \begin{macrocode}
\@onlypremakeg\glsSetAlphaCompositor
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@suffixF}
%\changes{1.17}{2008-12-26}{new}
% Suffix to use for a two page list. This overrides the separator
% and the closing page number if set to something other than
% an empty macro.
%    \begin{macrocode}
\newcommand*{\gls@suffixF}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsSetSuffixF}
%\changes{1.17}{2008-12-26}{new}
% Sets the suffix to use for a two page list.
%    \begin{macrocode}
\newcommand*{\glsSetSuffixF}[1]{%
  \renewcommand*{\gls@suffixF}{#1}}
%    \end{macrocode}
% Only has an effect when used before \ics{makeglossaries}
%    \begin{macrocode}
\@onlypremakeg\glsSetSuffixF
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@suffixFF}
%\changes{1.17}{2008-12-26}{new}
% Suffix to use for a three page list. This overrides the separator
% and the closing page number if set to something other than
% an empty macro.
%    \begin{macrocode}
\newcommand*{\gls@suffixFF}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsSetSuffixFF}
%\changes{1.17}{2008-12-26}{new}
% Sets the suffix to use for a three page list.
%    \begin{macrocode}
\newcommand*{\glsSetSuffixFF}[1]{%
  \renewcommand*{\gls@suffixFF}{#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsnumberformat}
% The command \cs{glsnumberformat} indicates the default
% format for the page numbers in the glossary. (Note that this
% is not the same as \ics{glossaryentrynumbers}, but applies
% to individual numbers or groups of numbers within an entry's
% associated number list.) If hyperlinks are defined, it will use
% \ics{glshypernumber}, otherwise it will simply display its 
% argument ``as is''.
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%    \begin{macrocode}
\ifcsundef{hyperlink}%
{%
  \newcommand*{\glsnumberformat}[1]{#1}%
}%
{%
  \newcommand*{\glsnumberformat}[1]{\glshypernumber{#1}}%
}
%    \end{macrocode}
%\end{macro}
%
% Individual numbers in an entry's associated number list are
% delimited using \cs{delimN} (which corresponds to the 
% \istkey{delim\_n} \app{makeindex} keyword). The default value
% is a comma followed by a space.
%\begin{macro}{\delimN}
%    \begin{macrocode}
\newcommand{\delimN}{, }
%    \end{macrocode}
%\end{macro}
% A range of numbers within an entry's associated number list is
% delimited using \cs{delimR} (which corresponds to the
% \istkey{delim\_r} \app{makeindex} keyword). The default is
% an en-dash.
%\begin{macro}{\delimR}
%    \begin{macrocode}
\newcommand{\delimR}{--}
%    \end{macrocode}
%\end{macro}
%
% The glossary preamble is given by \cs{glossarypreamble}. This
% will appear after the glossary sectioning command, and before the
% \env{theglossary} environment. It is designed to allow the
% user to add information pertaining to the glossary (e.g.\ ``page
% numbers in italic indicate the primary definition'') therefore 
% \cs{glossarypremable} shouldn't be affected by the glossary
% style. (So if you define your own glossary style, don't have it 
% change \cs{glossarypreamble}.) The preamble is empty by
% default. If you have multiple glossaries, and you want a 
% different preamble for each glossary, you will need to use
% \ics{printglossary} for each glossary type, instead of 
% \ics{printglossaries}, and redefine \cs{glossarypreamble}
% before each \ics{printglossary}.
%\begin{macro}{\glossarypreamble}
%\changes{3.07}{2013-07-05}{modified to work with
%\cs{setglossarypreamble}}
%    \begin{macrocode}
\newcommand*{\glossarypreamble}{%
  \csuse{@glossarypreamble@\currentglossary}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\setglossarypreamble}
%\begin{definition}
%\cs{setglossarypreamble}\oarg{type}\marg{text}
%\end{definition}
% Code provided by Michael Pock.
%\changes{3.07}{2013-07-05}{new}
%\changes{4.46}{2020-03-19}{switched to starred form of \cs{ifglossaryexists}}
%    \begin{macrocode}
\newcommand{\setglossarypreamble}[2][\glsdefaulttype]{%
  \ifglossaryexists*{#1}%
  {\csgdef{@glossarypreamble@#1}{#2}}%
  {\GlossariesWarning{Glossary `#1' is not defined}}%
}
%    \end{macrocode}
%\end{macro}
%
%
% The glossary postamble is given by \cs{glossarypostamble}.
% This is provided to allow the user to
% add something after the end of the \env{theglossary}
% environment (again, this shouldn't be affected by the
% glossary style). It is, of course, possible to simply add the
% text after \ics{printglossary}, but if you only want the
% postamble to appear after the first glossary, but not after 
% subsequent glossaries, you can do something like:
%\begin{verbatim}
%\renewcommand{\glossarypostamble}{For a complete list of terms
%see \cite{blah}\gdef\glossarypreamble{}}
%\end{verbatim}
%\begin{macro}{\glossarypostamble}
%    \begin{macrocode}
\newcommand*{\glossarypostamble}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glossarysection}
% The sectioning command that starts a glossary is given by
% \cs{glossarysection}. (This does not form part of the
% glossary style, and so should not be changed by a glossary
% style.) If \ics{phantomsection}
% is defined, it uses \cs{\@p@glossarysection}, otherwise it
% uses \cs{@glossarysection}.
%\changes{1.05}{2007-08-10}{added \cs{@mkboth} to
%\cs{glossarysection}}
%\changes{2.02}{2009-07-13}{changed \cs{@mkboth} to
%\cs{glossarymark}}
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%    \begin{macrocode}
\newcommand*{\glossarysection}[2][\@gls@title]{%
  \def\@gls@title{#2}%
  \ifcsundef{phantomsection}%
  {%
    \@glossarysection{#1}{#2}%
  }%
  {%
    \@p@glossarysection{#1}{#2}%
  }%
%    \end{macrocode}
%\changes{3.13a}{2013-11-05}{changed \cs{glossarymark} to \cs{glsglossarymark}}
%    \begin{macrocode}
  \glsglossarymark{\glossarytoctitle}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsglossarymark}
%\changes{2.02}{2009-07-13}{New}
%\changes{2.03}{2009-09-23}{Added check to see if it's already 
%defined}
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%\changes{3.11a}{2013-10-15}{replaced \cs{MakeUppercase} with
%\cs{mfirstucMakeUppercase}}
%\changes{3.13a}{2013-11-05}{renamed \cs{glossarymark} to
%\cs{glsglossarymark} to avoid conflict with memoir}
% Sets the header mark for the glossary. Takes the glossary short
% (TOC) title as the argument.
%    \begin{macrocode}
\ifcsundef{glossarymark}%
{%
  \newcommand{\glsglossarymark}[1]{\glossarymark{#1}}
}%
{%
  \@ifclassloaded{memoir}
  {%
    \newcommand{\glsglossarymark}[1]{%
      \ifglsucmark
        \markboth{\memUChead{#1}}{\memUChead{#1}}%
      \else
        \markboth{#1}{#1}%
      \fi
    }
  }%
  {%
    \newcommand{\glsglossarymark}[1]{%
      \ifglsucmark
        \@mkboth{\mfirstucMakeUppercase{#1}}{\mfirstucMakeUppercase{#1}}%
      \else
        \@mkboth{#1}{#1}%
      \fi
    }
  }
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glossarymark}
% Provided for backward compatibility:
%    \begin{macrocode}
\providecommand{\glossarymark}[1]{%
  \ifglsucmark
    \@mkboth{\mfirstucMakeUppercase{#1}}{\mfirstucMakeUppercase{#1}}%
  \else
    \@mkboth{#1}{#1}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
% The required sectional unit is given by \cs{@@glossarysec}
% which was defined by the \pkgopt{section} package option. The
% starred form of the command is chosen. If you don't want any sectional
% command, you will need to redefine \cs{glossarysection}.
% The sectional unit can be changed, if different sectional units
% are required.
%\begin{macro}{\setglossarysection}
%\changes{1.1}{2008-02-22}{new}
%    \begin{macrocode}
\newcommand*{\setglossarysection}[1]{%
\setkeys{glossaries.sty}{section=#1}}
%    \end{macrocode}
%\end{macro}
%
%The command \cs{@glossarysection} indicates how to start
% the glossary section if \ics{phantomsection} is not defined.
%\begin{macro}{\@glossarysection}
%\changes{1.1}{2008-02-22}{numbered sections and auto label added}
%\changes{4.07}{2014-04-04}{added optional argument when using unstarred
%version}
%    \begin{macrocode}
\newcommand*{\@glossarysection}[2]{%
  \ifdefempty\@@glossarysecstar
  {%
    \csname\@@glossarysec\endcsname[#1]{#2}%
  }%
  {%
    \csname\@@glossarysec\endcsname*{#2}%
    \@gls@toc{#1}{\@@glossarysec}%
  }%
%    \end{macrocode}
% Do automatic labelling if required
%    \begin{macrocode}
  \@@glossaryseclabel
}
%    \end{macrocode}
%\end{macro}
%
% As \cs{@glossarysection}, but put in 
% \ics{phantomsection}, and swap where \cs{@gls@toc} goes. 
% If using chapters do a \cs{clearpage}. This ensures that
% the hyper link from the table of contents leads to the line above
% the heading, rather than the line below it.
%\begin{macro}{\@p@glossarysection}
%\changes{1.1}{2008-02-22}{numbered sections and auto label added}
%    \begin{macrocode}
\newcommand*{\@p@glossarysection}[2]{%
  \glsclearpage
  \phantomsection
  \ifdefempty\@@glossarysecstar
  {%
    \csname\@@glossarysec\endcsname{#2}%
  }%
  {%
    \@gls@toc{#1}{\@@glossarysec}%
      \csname\@@glossarysec\endcsname*{#2}%
  }%
%    \end{macrocode}
% Do automatic labelling if required
%    \begin{macrocode}
  \@@glossaryseclabel
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@doclearpage}
%The \cs{gls@doclearpage} command is used to issue a
% \cs{clearpage} (or \cs{cleardoublepage}) depending
% on whether the glossary sectional unit is a chapter. If the
% sectional unit is something else, do nothing.
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%\changes{3.07}{2013-07-05}{added check for openright}
%    \begin{macrocode}
\newcommand*{\gls@doclearpage}{%
  \ifthenelse{\equal{\@@glossarysec}{chapter}}%
  {%
    \ifcsundef{cleardoublepage}%
    {%
      \clearpage
    }%
    {%
      \ifcsdef{if@openright}%
      {%
         \if@openright
           \cleardoublepage
         \else
           \clearpage
         \fi
      }%
      {%
         \cleardoublepage
      }%
    }%
  }%
  {}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsclearpage}
% This just calls \cs{gls@doclearpage}, but it makes it easier to
% have a user command so that the user can override it.
%\changes{1.19}{2009-03-02}{new}
%    \begin{macrocode}
\newcommand*{\glsclearpage}{\gls@doclearpage}
%    \end{macrocode}
%\end{macro}
%
% The glossary is added to the table of contents if glstoc flag set.
% If it is set, \cs{@gls@toc} will add a line to the 
% \filetype{.toc} file, otherwise it will do nothing.
% (The first argument to \cs{@gls@toc} is the title for the
% table of contents, the second argument is the sectioning type.) 
%\begin{macro}{\@gls@toc}
%\changes{1.1}{2008-02-22}{numberline added}
%\changes{4.12}{2014-11-22}{added \cs{protect} to \cs{numberline}}
%    \begin{macrocode}
\newcommand*{\@gls@toc}[2]{%
  \ifglstoc
    \ifglsnumberline
      \addcontentsline{toc}{#2}{\protect\numberline{}#1}%
    \else
      \addcontentsline{toc}{#2}{#1}%
    \fi
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\section{Xindy}
% This section defines commands that only have an effect if
% \app{xindy} is used to sort the glossaries.
%\begin{macro}{\glsnoxindywarning}
% Issues a warning if \app{xindy} hasn't been specified.
% These warnings can be suppressed by redefining 
% \cs{glsnoxindywarning} to ignore its argument
%    \begin{macrocode}
\newcommand*{\glsnoxindywarning}[1]{%
  \GlossariesWarning{Not in xindy mode --- ignoring \string#1}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsnomakeindexwarning}
%\changes{4.24}{2016-05-27}{new}
% Reverse for commands that may only be used with \app{makeindex}.
%    \begin{macrocode}
\newcommand*{\glsnomakeindexwarning}[1]{%
  \GlossariesWarning{Not in makeindex mode --- ignoring \string#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@xdyattributes}
% Define list of attributes (\cs{string} is used in case
% the double quote character has been made active)
%    \begin{macrocode}
\ifglsxindy
  \edef\@xdyattributes{\string"default\string"}%
\fi
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@xdyattributelist}
% Comma-separated list of attributes.
%\changes{3.0}{2011-04-02}{new}
%    \begin{macrocode}
\ifglsxindy
  \edef\@xdyattributelist{}%
\fi
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@xdylocref}
% Define list of markup location references.
%    \begin{macrocode}
\ifglsxindy
  \def\@xdylocref{}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@ifinlist}
%\changes{3.0}{2011-04-02}{new}
%    \begin{macrocode}
\newcommand*{\@gls@ifinlist}[4]{%
  \def\@do@ifinlist##1,#1,##2\end@doifinlist{%
    \def\@gls@listsuffix{##2}%
    \ifx\@gls@listsuffix\@empty
       #4%
    \else
       #3%
    \fi
  }%
  \@do@ifinlist,#2,#1,\end@doifinlist
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsAddXdyCounters}
%\changes{3.0}{2011-04-02}{new}
% Need to know all the counters that will be used in location
% numbers for Xindy. Argument may be a single counter name or a
% comma-separated list of counter names.
%    \begin{macrocode}
\ifglsxindy
  \newcommand*{\@xdycounters}{\glscounter}
  \newcommand*\GlsAddXdyCounters[1]{%
    \@for\@gls@ctr:=#1\do{%
%    \end{macrocode}
% Check if already in list before adding.
%    \begin{macrocode}
       \edef\@do@addcounter{%
          \noexpand\@gls@ifinlist{\@gls@ctr}{\@xdycounters}{}%
          {%
             \noexpand\edef\noexpand\@xdycounters{\@xdycounters,%
               \noexpand\@gls@ctr}%
          }%
       }%
       \@do@addcounter
    }
  }
%    \end{macrocode}
% Only has an effect before \ics{writeist}:
%    \begin{macrocode}
  \@onlypremakeg\GlsAddXdyCounters
\else
  \newcommand*\GlsAddXdyCounters[1]{%
    \glsnoxindywarning\GlsAddXdyAttribute
  }
\fi
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@disabled@glsaddxdycounters}
% Counters must all be identified before adding attributes.
%    \begin{macrocode}
\newcommand*\@disabled@glsaddxdycounters{%
   \PackageError{glossaries}{\string\GlsAddXdyCounters\space
   can't be used after \string\GlsAddXdyAttribute}{Move all
   occurrences of \string\GlsAddXdyCounters\space before the first
   instance of \string\GlsAddXdyAttribute}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsAddXdyAttribute}
% Adds an attribute.
%    \begin{macrocode}
\ifglsxindy
%    \end{macrocode}
% First define internal command that adds an attribute for a given
% counter (2nd argument is the counter):
%    \begin{macrocode}
  \newcommand*\@glsaddxdyattribute[2]{%
%    \end{macrocode}
% Add to xindy attribute list
%    \begin{macrocode}
    \edef\@xdyattributes{\@xdyattributes ^^J \string"#1\string" ^^J
      \string"#2#1\string"}%
%    \end{macrocode}
% Add to xindy markup location.
%    \begin{macrocode}
    \expandafter\toks@\expandafter{\@xdylocref}%
    \edef\@xdylocref{\the\toks@ ^^J%
      (markup-locref
      :open \string"\glstildechar n%
        \expandafter\string\csname glsX#2X#1\endcsname
        \string" ^^J
      :close \string"\string" ^^J
      :attr \string"#2#1\string")}%
%    \end{macrocode}
% Define associated attribute command
% \cs{glsX}\meta{counter}"X"\meta{attribute}\marg{Hprefix}\marg{n}
%    \begin{macrocode}
    \expandafter\gdef\csname glsX#2X#1\endcsname##1##2{%
       \setentrycounter[##1]{#2}\csname #1\endcsname{##2}%
    }%
  }
%    \end{macrocode}
% High-level command:
%    \begin{macrocode}
  \newcommand*\GlsAddXdyAttribute[1]{%
%    \end{macrocode}
% Add to comma-separated attribute list
%    \begin{macrocode}
    \ifx\@xdyattributelist\@empty
      \edef\@xdyattributelist{#1}%
    \else
      \edef\@xdyattributelist{\@xdyattributelist,#1}%
    \fi
%    \end{macrocode}
% Iterate through all specified counters and add counter-dependent
% attributes:
%    \begin{macrocode}
    \@for\@this@counter:=\@xdycounters\do{%
      \protected@edef\gls@do@addxdyattribute{%
        \noexpand\@glsaddxdyattribute{#1}{\@this@counter}%
      }
      \gls@do@addxdyattribute
    }%
%    \end{macrocode}
% All occurrences of \cs{GlsAddXdyCounters} must be used before this
% command
%    \begin{macrocode}
    \let\GlsAddXdyCounters\@disabled@glsaddxdycounters
  }
%    \end{macrocode}
% Only has an effect before \ics{writeist}:
%    \begin{macrocode}
  \@onlypremakeg\GlsAddXdyAttribute
\else
  \newcommand*\GlsAddXdyAttribute[1]{%
    \glsnoxindywarning\GlsAddXdyAttribute}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@addpredefinedattributes}
% Add known attributes for all defined counters
%    \begin{macrocode}
\ifglsxindy
\newcommand*{\@gls@addpredefinedattributes}{%
  \GlsAddXdyAttribute{glsnumberformat}
  \GlsAddXdyAttribute{textrm}
  \GlsAddXdyAttribute{textsf}
  \GlsAddXdyAttribute{texttt}
  \GlsAddXdyAttribute{textbf}
  \GlsAddXdyAttribute{textmd}
  \GlsAddXdyAttribute{textit}
  \GlsAddXdyAttribute{textup}
  \GlsAddXdyAttribute{textsl}
  \GlsAddXdyAttribute{textsc}
  \GlsAddXdyAttribute{emph}
  \GlsAddXdyAttribute{glshypernumber}
  \GlsAddXdyAttribute{hyperrm}
  \GlsAddXdyAttribute{hypersf}
  \GlsAddXdyAttribute{hypertt}
  \GlsAddXdyAttribute{hyperbf}
  \GlsAddXdyAttribute{hypermd}
  \GlsAddXdyAttribute{hyperit}
  \GlsAddXdyAttribute{hyperup}
  \GlsAddXdyAttribute{hypersl}
  \GlsAddXdyAttribute{hypersc}
  \GlsAddXdyAttribute{hyperemph}
%    \end{macrocode}
%\changes{4.12}{2014-11-22}{Added glsignore attribute}
%    \begin{macrocode}
  \GlsAddXdyAttribute{glsignore}
}
\else
  \let\@gls@addpredefinedattributes\relax
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@xdyuseralphabets}
% List of additional alphabets
%    \begin{macrocode}
\def\@xdyuseralphabets{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\GlsAddXdyAlphabet}
% \cs{GlsAddXdyAlphabet}\marg{name}\marg{definition}
% adds a new alphabet called \meta{name}. The definition
% must use \app{xindy} syntax.
%    \begin{macrocode}
\ifglsxindy
  \newcommand*{\GlsAddXdyAlphabet}[2]{%
  \edef\@xdyuseralphabets{%
    \@xdyuseralphabets ^^J
    (define-alphabet "#1" (#2))}}
\else
  \newcommand*{\GlsAddXdyAlphabet}[2]{%
     \glsnoxindywarning\GlsAddXdyAlphabet}
\fi
%    \end{macrocode}
%\end{macro}
%
% This code is only required for xindy:
%    \begin{macrocode}
\ifglsxindy
%    \end{macrocode}
%
%\begin{macro}{\@gls@xdy@locationlist}
%\changes{3.0}{2011-04-02}{new}
% List of predefined location names.
%    \begin{macrocode}
  \newcommand*{\@gls@xdy@locationlist}{%
     roman-page-numbers,%
     Roman-page-numbers,%
     arabic-page-numbers,%
     alpha-page-numbers,%
     Alpha-page-numbers,%
     Appendix-page-numbers,%
     arabic-section-numbers%
  }
%    \end{macrocode}
%\end{macro}
% Each location class \meta{name} has the format stored in 
% \cs{@gls@xdy@Lclass@}\meta{name}. Set up predefined
% formats.
%
%\begin{macro}{\@gls@xdy@Lclass@roman-page-numbers}
% Lower case Roman numerals (i, ii, \ldots). In the event that
% \ics{roman} has been redefined to produce a fancy form of
% roman numerals, attempt to work out how it will be written
% to the output file.
%    \begin{macrocode}
  \protected@edef\@gls@roman{\@roman{0\string" 
      \string"roman-numbers-lowercase\string" :sep \string"}}%
  \@onelevel@sanitize\@gls@roman
  \edef\@gls@tmp{\string" \string"roman-numbers-lowercase\string"
       :sep \string"}%
  \@onelevel@sanitize\@gls@tmp
  \ifx\@gls@tmp\@gls@roman
    \expandafter
      \edef\csname @gls@xdy@Lclass@roman-page-numbers\endcsname{%
        \string"roman-numbers-lowercase\string"%
      }%
  \else
     \expandafter
      \edef\csname @gls@xdy@Lclass@roman-page-numbers\endcsname{
        :sep \string"\@gls@roman\string"%
      }%
  \fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@xdy@Lclass@Roman-page-numbers}
% Upper case Roman numerals (I, II, \ldots).
%    \begin{macrocode}
  \expandafter\def\csname @gls@xdy@Lclass@Roman-page-numbers\endcsname{%
    \string"roman-numbers-uppercase\string"%
  }%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@xdy@Lclass@arabic-page-numbers}
% Arabic numbers (1, 2, \ldots).
%    \begin{macrocode}
  \expandafter\def\csname @gls@xdy@Lclass@arabic-page-numbers\endcsname{%
    \string"arabic-numbers\string"%
  }%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@xdy@Lclass@alpha-page-numbers}
% Lower case alphabetical (a, b, \ldots).
%    \begin{macrocode}
  \expandafter\def\csname @gls@xdy@Lclass@alpha-page-numbers\endcsname{%
    \string"alpha\string"%
  }%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@xdy@Lclass@Alpha-page-numbers}
% Upper case alphabetical (A, B, \ldots).
%    \begin{macrocode}
  \expandafter\def\csname @gls@xdy@Lclass@Alpha-page-numbers\endcsname{%
    \string"ALPHA\string"%
  }%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@xdy@Lclass@Appendix-page-numbers}
% Appendix style locations (e.g.\ A-1, A-2, \ldots, B-1, B-2,
% \ldots). The separator is given by \ics{@glsAlphacompositor}.
%    \begin{macrocode}
  \expandafter\def\csname @gls@xdy@Lclass@Appendix-page-numbers\endcsname{%
    \string"ALPHA\string"
    :sep \string"\@glsAlphacompositor\string"
    \string"arabic-numbers\string"%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@xdy@Lclass@arabic-section-numbers}
% Section number style locations (e.g.\ 1.1, 1.2, \ldots). The
% compositor is given by \ics{glscompositor}.
%    \begin{macrocode}
  \expandafter\def\csname @gls@xdy@Lclass@arabic-section-numbers\endcsname{%
    \string"arabic-numbers\string"
     :sep \string"\glscompositor\string"
    \string"arabic-numbers\string"%
  }%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@xdyuserlocationdefs}
% List of additional location definitions
% (separated by "^^J")
%    \begin{macrocode}
  \def\@xdyuserlocationdefs{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@xdyuserlocationnames}
% List of additional user location names
%    \begin{macrocode}
  \def\@xdyuserlocationnames{}
%    \end{macrocode}
%\end{macro}
%
% End of xindy-only block:
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
%\begin{macro}{\@xdycrossrefhook}
%\changes{4.30}{2017-06-11}{new}
%Hook used after writing cross-reference class information.
%    \begin{macrocode}
\ifglsxindy
 \newcommand\@xdycrossrefhook{}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsAddXdyLocation}
% \cs{GlsAddXdyLocation}\oarg{prefix-loc}\marg{name}\marg{definition}
% Define a new location called \meta{name}. The definition
% must use \app{xindy} syntax. (Note that this doesn't
% check to see if the location is already defined. That is left
% to \app{xindy} to complain about.)
%    \begin{macrocode}
\ifglsxindy
   \newcommand*{\GlsAddXdyLocation}[3][]{%
     \def\@gls@tmp{#1}%
     \ifx\@gls@tmp\@empty
       \edef\@xdyuserlocationdefs{%
          \@xdyuserlocationdefs ^^J%
          (define-location-class \string"#2\string"^^J\space\space
          \space(:sep \string"{}\glsopenbrace\string" #3 
                 :sep \string"\glsclosebrace\string"))
       }%
     \else
       \edef\@xdyuserlocationdefs{%
          \@xdyuserlocationdefs ^^J%
          (define-location-class \string"#2\string"^^J\space\space
          \space(:sep "\glsopenbrace"
                 #1
                 :sep "\glsclosebrace\glsopenbrace" #3
                 :sep "\glsclosebrace"))
       }%
     \fi
%    \end{macrocode}
%\changes{4.30}{2017-06-11}{bug fix: changed \#1 to \#2}
%    \begin{macrocode}
     \edef\@xdyuserlocationnames{%
        \@xdyuserlocationnames^^J\space\space\space
        \string"#2\string"}%
   }
%    \end{macrocode}
% Only has an effect before \ics{writeist}:
%    \begin{macrocode}
  \@onlypremakeg\GlsAddXdyLocation
\else
   \newcommand*{\GlsAddXdyLocation}[2]{%
     \glsnoxindywarning\GlsAddXdyLocation}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@xdylocationclassorder}
% Define location class order
%\changes{4.30}{2017-06-11}{bug fix: changed \cs{edef} to \cs{def}}
%    \begin{macrocode}
\ifglsxindy
  \def\@xdylocationclassorder{^^J\space\space\space
    \string"roman-page-numbers\string"^^J\space\space\space
    \string"arabic-page-numbers\string"^^J\space\space\space
    \string"arabic-section-numbers\string"^^J\space\space\space
    \string"alpha-page-numbers\string"^^J\space\space\space 
    \string"Roman-page-numbers\string"^^J\space\space\space
    \string"Alpha-page-numbers\string"^^J\space\space\space
    \string"Appendix-page-numbers\string"
    \@xdyuserlocationnames^^J\space\space\space
    \string"see\string"
   }
\fi
%    \end{macrocode}
%\end{macro}
% Change the location order.
%\begin{macro}{\GlsSetXdyLocationClassOrder}
%    \begin{macrocode}
\ifglsxindy
  \newcommand*\GlsSetXdyLocationClassOrder[1]{%
    \def\@xdylocationclassorder{#1}}
\else
  \newcommand*\GlsSetXdyLocationClassOrder[1]{%
    \glsnoxindywarning\GlsSetXdyLocationClassOrder}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@xdysortrules}
% Define sort rules
%    \begin{macrocode}
\ifglsxindy
  \def\@xdysortrules{}
\fi
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\GlsAddSortRule}
% Add a sort rule
%    \begin{macrocode}
\ifglsxindy
  \newcommand*\GlsAddSortRule[2]{%
    \expandafter\toks@\expandafter{\@xdysortrules}%
    \protected@edef\@xdysortrules{\the\toks@ ^^J
     (sort-rule \string"#1\string" \string"#2\string")}%
  }
\else
  \newcommand*\GlsAddSortRule[2]{%
    \glsnoxindywarning\GlsAddSortRule}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@xdyrequiredstyles}
% Define list of required styles (this should be a comma-separated
% list of \app{xindy} styles)
%    \begin{macrocode}
\ifglsxindy
  \def\@xdyrequiredstyles{tex}
\fi
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\GlsAddXdyStyle}
% Add a \app{xindy} style to the list of required styles
%    \begin{macrocode}
\ifglsxindy
  \newcommand*\GlsAddXdyStyle[1]{%
    \edef\@xdyrequiredstyles{\@xdyrequiredstyles,#1}}%
\else
  \newcommand*\GlsAddXdyStyle[1]{%
    \glsnoxindywarning\GlsAddXdyStyle}
\fi
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\GlsSetXdyStyles}
% Reset the list of required styles
%    \begin{macrocode}
\ifglsxindy
  \newcommand*\GlsSetXdyStyles[1]{%
    \edef\@xdyrequiredstyles{#1}}
\else
  \newcommand*\GlsSetXdyStyles[1]{%
    \glsnoxindywarning\GlsSetXdyStyles}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\findrootlanguage}
%\changes{3.06}{2013/06/17}{Obsoleted}
% This used to determine the root language, using a~bit of trickery
% since \sty{babel} doesn't supply the information, but now that
% \sty{babel} is once again actively maintained, we can't do this
% any more, so \cs{findrootlanguage} is no longer available. Now
% provide a command that does nothing (in case it's been patched),
% but this may be removed completely in the future.
%    \begin{macrocode}
\newcommand*{\findrootlanguage}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@xdylanguage}
% The \app{xindy} language setting is required by 
% \app{makeglossaries}, so provide a command for 
% \app{makeglossaries} to pick up the information
% from the auxiliary file.  This command is not needed by the 
% \sty{glossaries} package, so define it to ignore its arguments.
%    \begin{macrocode}
\def\@xdylanguage#1#2{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsSetXdyLanguage}
% Define a command that allows the user to set the language
% for a given glossary type. The first argument indicates the
% glossary type. If omitted the main glossary is assumed.
% This uses the unstarred form of \cs{ifglossaryexists} because
% ignored glossaries can't be used with xindy.
%    \begin{macrocode}
\ifglsxindy
  \newcommand*\GlsSetXdyLanguage[2][\glsdefaulttype]{%
  \ifglossaryexists{#1}{%
    \expandafter\def\csname @xdy@#1@language\endcsname{#2}%
  }{%
    \PackageError{glossaries}{Can't set language type for
    glossary type `#1' --- no such glossary}{%
    You have specified a glossary type that doesn't exist}}}
\else
  \newcommand*\GlsSetXdyLanguage[2][]{%
    \glsnoxindywarning\GlsSetXdyLanguage}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@codepage}
% The \app{xindy} codepage setting is required by 
% \app{makeglossaries}, so provide a command for 
% \app{makeglossaries} to pick up the information
% from the auxiliary file.  This command is not needed by the 
% \sty{glossaries} package, so define it to ignore its arguments.
%    \begin{macrocode}
\def\@gls@codepage#1#2{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsSetXdyCodePage}
% Define command to set the code page.
%    \begin{macrocode}
\ifglsxindy
  \newcommand*{\GlsSetXdyCodePage}[1]{%
    \renewcommand*{\gls@codepage}{#1}%
  }
%    \end{macrocode}
%\changes{3.07}{2013-07-05}{Added check for fontspec}
% Suggested by egreg:
%    \begin{macrocode}
  \AtBeginDocument{%
    \ifx\gls@codepage\@empty
      \@ifpackageloaded{fontspec}{\def\gls@codepage{utf8}}{}%
    \fi
  }
\else
  \newcommand*{\GlsSetXdyCodePage}[1]{%
    \glsnoxindywarning\GlsSetXdyCodePage}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@xdylettergroups}
% Store letter group definitions.
%    \begin{macrocode}
\ifglsxindy
  \ifgls@xindy@glsnumbers
    \def\@xdylettergroups{(define-letter-group
       \string"glsnumbers\string"^^J\space\space\space
       :prefixes (\string"0\string" \string"1\string"
       \string"2\string" \string"3\string" \string"4\string"
       \string"5\string" \string"6\string" \string"7\string"
       \string"8\string" \string"9\string")^^J\space\space\space
       \@xdynumbergrouporder)}
  \else
    \def\@xdylettergroups{}
  \fi
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsAddLetterGroup}
% Add a new letter group. The first argument is the name
% of the letter group. The second argument is the \app{xindy}
% code specifying prefixes and ordering.
%    \begin{macrocode}
  \newcommand*\GlsAddLetterGroup[2]{%
    \expandafter\toks@\expandafter{\@xdylettergroups}%
    \protected@edef\@xdylettergroups{\the\toks@^^J%
    (define-letter-group \string"#1\string"^^J\space\space\space#2)}%
  }%
%    \end{macrocode}
%\end{macro}
%
%\section{Loops and conditionals}
%\begin{macro}{\forallglossaries}
% To iterate through all glossaries (or comma-separated list of
% glossary names given in optional argument) use:
%\begin{definition}
% \cs{forallglossaries}\oarg{glossary list}\marg{cmd}\marg{code}
%\end{definition}
% where \meta{cmd} is
% a control sequence which will be set to the name of the
% glossary in the current iteration.
%\changes{2.01}{2009 May 30}{replaced \cs{ifthenelse} with \cs{ifx}}
%    \begin{macrocode}
\newcommand*{\forallglossaries}[3][\@glo@types]{%
  \@for#2:=#1\do{\ifx#2\@empty\else#3\fi}%
}
%    \end{macrocode}
%\end{macro}

%\begin{macro}{\forallacronyms}
%\changes{4.08}{2014-07-30}{new}
%    \begin{macrocode}
\newcommand*{\forallacronyms}[2]{%
  \@for#1:=\@glsacronymlists\do{\ifx#1\@empty\else#2\fi}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\forglsentries}
% To iterate through all entries in a given glossary use:
%\begin{definition}
%\cs{forglsentries}\oarg{type}\marg{cmd}\marg{code}
%\end{definition}
%where \meta{type} is the glossary label and \meta{cmd} is a
% control sequence which will be set to the entry label in the
% current iteration.
%\changes{2.01}{2009 May 30}{replaced \cs{ifthenelse} with \cs{ifx}}
%\changes{3.11a}{2013-10-15}{replaced \cs{ifx} with \cs{ifdefempty}}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
\newcommand*{\forglsentries}[3][\glsdefaulttype]{%
  \protected@edef\@@glo@list{\csname glolist@#1\endcsname}%
  \@for#2:=\@@glo@list\do
  {%
    \ifdefempty{#2}{}{#3}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\forallglsentries}
% To iterate through all glossary entries over all glossaries listed
% in the optional argument (the default is all glossaries) use:
%\begin{definition}
% \cs{forallglsentries}\oarg{glossary list}\marg{cmd}\marg{code}
%\end{definition}
% Within \cs{forallglsentries}, the current glossary type
% is given by \cs{@@this@glo@}.
%    \begin{macrocode}
\newcommand*{\forallglsentries}[3][\@glo@types]{%
  \expandafter\forallglossaries\expandafter[#1]{\@@this@glo@}%
  {%
    \forglsentries[\@@this@glo@]{#2}{#3}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ifglossaryexists}
% To check to see if a glossary exists use:
%\begin{definition}
%\cs{ifglossaryexists}\marg{type}\marg{true-text}\marg{false-text}
%\end{definition}
%where \meta{type} is the glossary's label.
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%\changes{4.46}{2020-03-19}{added starred form}
%The unstarred form will do \meta{false-text} for ignored
%glossaries. The starred form will do \meta{true-text} for ignored
%glossaries.
%    \begin{macrocode}
\newcommand{\ifglossaryexists}{%
  \@ifstar\s@ifglossaryexists\@ifglossaryexists
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@ifglossaryexists}
%\changes{4.46}{2020-03-19}{new}
% Unstarred form only tests the existence of non-ignored glossaries.
%    \begin{macrocode}
\newcommand{\@ifglossaryexists}[3]{%
  \ifcsundef{@glotype@#1@out}{#3}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\s@ifglossaryexists}
%\changes{4.46}{2020-03-19}{new}
% Starred form includes ignored glossaries.
%    \begin{macrocode}
\newcommand{\s@ifglossaryexists}[3]{%
  \ifcsundef{glolist@#1}{#3}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
% Since the label is used to form the name of control sequences, by
% default UTF8 etc characters can't be used in the label. A possible
% workaround is to use \ics{scantokens}, but commands such as
% \ics{glsentrytext} will no longer be usable in sectioning, caption
% etc commands. If the user really wants to be able to construct a
% label with UTF8 characters, allow them the means to do so (but on
% their own head be it, if they then use entries in \ics{section}
% etc). This can be done via:
%\begin{verbatim}
%\renewcommand*{\glsdetoklabel}[1]{\scantokens{#1\noexpand}}
%\end{verbatim}
% (Note, don't use \ics{detokenize} or it will cause commands like
% \ics{glsaddall} to fail.)
% Since redefining \cs{glsdetoklabel} can cause things to go
% badly wrong, I'm not going to mention it in the main user guide.
% Only advanced users who know what they're doing ought to attempt
% it.
%\begin{macro}{\glsdetoklabel}
%\changes{4.03}{2014-01-20}{new}
%    \begin{macrocode}
\newcommand*{\glsdetoklabel}[1]{#1}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ifglsentryexists}
% To check to see if a glossary entry has been defined use:
%\begin{definition}
% \cs{ifglsentryexists}\marg{label}\marg{true text}\marg{false text}
%\end{definition}
%where \meta{label} is the entry's label.
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand{\ifglsentryexists}[3]{%
  \ifcsundef{glo@\glsdetoklabel{#1}@name}{#3}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ifglsused}
% To determine if given glossary entry has been 
% used in the document text yet use:
%\begin{definition}
% \cs{ifglsused}\marg{label}\marg{true text}\marg{false text}
%\end{definition}
% where \meta{label} is the entry's label.
% If true it will do \meta{true text}
% otherwise it will do \meta{false text}.
%\changes{3.11a}{2013-10-15}{replaced \cs{ifthenelse} with
%\cs{ifbool}}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\ifglsused}[3]{%
  \ifbool{glo@\glsdetoklabel{#1}@flag}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%The following two commands will cause an error if the given
% condition fails:
%
%\begin{macro}{\glsdoifexists}
%\begin{definition}
%\cs{glsdoifexists}\marg{label}\marg{code}
%\end{definition}
% Generate an error if entry specified by \meta{label} doesn't 
% exists, otherwise do \meta{code}.
%    \begin{macrocode}
\newcommand{\glsdoifexists}[2]{%
  \ifglsentryexists{#1}{#2}{%
    \PackageError{glossaries}{Glossary entry `\glsdetoklabel{#1}' 
    has not been defined}{You need to define a glossary entry before you
    can use it.}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdoifnoexists}
%\cs{glsdoifnoexists}\marg{label}\marg{code}\par
% The opposite: only do second argument if the entry doesn't
% exists. Generate an error message if it exists.
%    \begin{macrocode}
\newcommand{\glsdoifnoexists}[2]{%
  \ifglsentryexists{#1}{%
    \PackageError{glossaries}{Glossary entry `\glsdetoklabel{#1}' has already
    been defined}{}}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdoifexistsorwarn}
%\begin{definition}
%\cs{glsdoifexistsorwarn}\marg{label}\marg{code}
%\end{definition}
% Generate a warning if entry specified by \meta{label} doesn't 
% exists, otherwise do \meta{code}.
%\changes{4.03}{2014-01-20}{new}
%    \begin{macrocode}
\newcommand{\glsdoifexistsorwarn}[2]{%
  \ifglsentryexists{#1}{#2}{%
    \GlossariesWarning{Glossary entry `\glsdetoklabel{#1}'
      has not been defined}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdoifexistsordo}
%\begin{definition}
%\cs{glsdoifexistsordo}\marg{label}\marg{code}\marg{undef code}
%\end{definition}
% Generate an error and do \meta{undef code} if entry specified by \meta{label} doesn't 
% exists, otherwise do \meta{code}.
%\changes{4.19}{2015-11-22}{new}
%    \begin{macrocode}
\newcommand{\glsdoifexistsordo}[3]{%
  \ifglsentryexists{#1}{#2}{%
    \PackageError{glossaries}{Glossary entry `\glsdetoklabel{#1}' 
    has not been defined}{You need to define a glossary entry before you
    can use it.}%
    #3%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\doifglossarynoexistsordo}
%\begin{definition}
%\cs{doifglossarynoexistsordo}\marg{label}\marg{code}\marg{else code}
%\end{definition}
%\changes{4.19}{2015-11-22}{new}
%If glossary given by \meta{label} doesn't exist do \meta{code}
%otherwise generate an error and do \meta{else code}.
%\changes{4.46}{2020-03-19}{switched to starred form of \cs{ifglossaryexists}}
%    \begin{macrocode}
\newcommand{\doifglossarynoexistsordo}[3]{%
  \ifglossaryexists*{#1}%
  {%
    \PackageError{glossaries}{Glossary type `#1' already exists}{}%
    #3%
  }%
  {#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ifglshaschildren}
%\begin{definition}
%\cs{ifglshaschildren}\marg{label}\marg{true part}\marg{false part}
%\end{definition}
%This is inefficient as it has to search through all entries to find
%out which ones have the given entry as its parent. It's much easier
%to use \app{bib2gls} and get it to store the list of children that
%have been indexed (which is likely to be more useful).
%\changes{3.02}{2012-05-21}{new}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.45}{2020-02-13}{made robust}
%    \begin{macrocode}
\newrobustcmd{\ifglshaschildren}[3]{%
  \glsdoifexists{#1}%
  {%
     \def\do@glshaschildren{#3}%
%    \end{macrocode}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
     \protected@edef\@gls@thislabel{\glsdetoklabel{#1}}%
     \expandafter\forglsentries\expandafter
       [\csname glo@\@gls@thislabel @type\endcsname]
     {\glo@label}%
     {%
       \letcs\glo@parent{glo@\glo@label @parent}%
       \ifdefequal\@gls@thislabel\glo@parent
       {%
         \def\do@glshaschildren{#2}%
         \@endfortrue
       }%
       {}%
     }%
     \do@glshaschildren
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ifglshasparent}
%\begin{definition}
% \cs{ifglshasparent}\marg{label}\marg{true part}\marg{false part}
%\end{definition}
%\changes{3.02}{2012-05-21}{new}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand{\ifglshasparent}[3]{%
  \glsdoifexists{#1}%
  {%
    \ifcsempty{glo@\glsdetoklabel{#1}@parent}{#3}{#2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ifglshasdesc}
%\cs{ifglshasdesc}\marg{label}\marg{true part}\marg{false part}
%\changes{3.08a}{2013-09-28}{new}
%\changes{3.11a}{2013-10-15}{replaced \cs{ifdefempty} with
%\cs{ifcsempty}}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\ifglshasdesc}[3]{%
  \ifcsempty{glo@\glsdetoklabel{#1}@desc}%
  {#3}%
  {#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ifglsdescsuppressed}
%\cs{ifglsdescsuppressed}\marg{label}\marg{true part}\marg{false part}
%\changes{3.08a}{2013-09-28}{new}
% Does \meta{true part} if the description is just \cs{nopostdesc}
% otherwise does \meta{false part}.
%\changes{4.03}{2014-01-20}{fixed typo}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\ifglsdescsuppressed}[3]{%
  \ifcsequal{glo@\glsdetoklabel{#1}@desc}{@no@post@desc}%
  {#2}%
  {#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ifglshassymbol}
%\cs{ifglshassymbol}\marg{label}\marg{true part}\marg{false part}
%\changes{3.08a}{2013-09-28}{new}
%\changes{3.09a}{2013-10-09}{changed test to check for
%\cs{@gls@default@symbol}}
%\changes{3.11a}{2013-10-15}{replaced \cs{ifdefempty} with
%\cs{ifcsempty}}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.03}{2014-01-20}{replaced \cs{ifcsempty} with
%\cs{ifdefempty} and replaced \cs{ifx} with \cs{ifdefequal}}
%\changes{4.45}{2020-02-13}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\ifglshassymbol}[3]{%
  \letcs{\@glo@symbol}{glo@\glsdetoklabel{#1}@symbol}%
  \ifdefempty\@glo@symbol
  {#3}%
  {%
    \ifdefequal\@glo@symbol\@gls@default@value
    {#3}%
    {#2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ifglshaslong}
%\cs{ifglshaslong}\marg{label}\marg{true part}\marg{false part}
%\changes{3.11a}{2013-10-15}{new}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.45}{2020-02-13}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\ifglshaslong}[3]{%
  \letcs{\@glo@long}{glo@\glsdetoklabel{#1}@long}%
  \ifdefempty\@glo@long
  {#3}%
  {%
    \ifdefequal\@glo@long\@gls@default@value
    {#3}%
    {#2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ifglshasshort}
%\cs{ifglshasshort}\marg{label}\marg{true part}\marg{false part}
%\changes{3.11a}{2013-10-15}{new}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.45}{2020-02-13}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\ifglshasshort}[3]{%
  \letcs{\@glo@short}{glo@\glsdetoklabel{#1}@short}%
  \ifdefempty\@glo@short
  {#3}%
  {%
    \ifdefequal\@glo@short\@gls@default@value
    {#3}%
    {#2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ifglshasfield}
%\changes{4.03}{2014-01-20}{new}
%\begin{definition}
%\cs{ifglshasfield}\marg{field}\marg{label}\marg{true part}\marg{false
%part}
%\end{definition}
%\changes{4.45}{2020-02-13}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\ifglshasfield}[4]{%
  \glsdoifexists{#2}%
  {%
    \letcs{\@glo@thisvalue}{glo@\glsdetoklabel{#2}@#1}%
%    \end{macrocode}
% First check supplied field label is defined.
%    \begin{macrocode}
    \ifdef\@glo@thisvalue
    {%
%    \end{macrocode}
% Is defined, so now check if empty.
%    \begin{macrocode}
      \ifdefempty\@glo@thisvalue
      {%
%    \end{macrocode}
% Is empty, so doesn't have field set.
%    \begin{macrocode}
        #4%
      }%
      {%
%    \end{macrocode}
% Not empty, so check if set to \cs{@gls@default@value}
%    \begin{macrocode}
        \ifdefequal\@glo@thisvalue\@gls@default@value
        {%
%    \end{macrocode}
% Value is set to the default value.
%    \begin{macrocode}
          #4%
        }%
        {%
%    \end{macrocode}
% Non-empty, non-default value. Allow user to access this value
% through \cs{glscurrentfieldvalue}.
%\changes{4.23}{2016-04-30}{added \cs{glscurrentfieldvalue}}
%    \begin{macrocode}
         \let\glscurrentfieldvalue\@glo@thisvalue
         #3%
        }%
      }%
    }%
    {%
%    \end{macrocode}
% Field given isn't defined, so check if mapping exists.
%    \begin{macrocode}
       \@gls@fetchfield{\@gls@thisfield}{#1}%
%    \end{macrocode}
% If \cs{@gls@thisfield} is defined, we've found a map. If not, the
% field supplied doesn't exist.
%    \begin{macrocode}
       \ifdef\@gls@thisfield
       {%
%    \end{macrocode}
% Is defined, so now check if empty.
%    \begin{macrocode}
         \letcs{\@glo@thisvalue}{glo@\glsdetoklabel{#2}@\@gls@thisfield}%
         \ifdefempty\@glo@thisvalue
         {%
%    \end{macrocode}
% Is empty so field hasn't been set.
%    \begin{macrocode}
           #4%
         }%
         {%
%    \end{macrocode}
% Isn't empty so check if it's been set to \cs{@gls@default@value}.
%    \begin{macrocode}
           \ifdefequal\@glo@thisvalue\@gls@default@value
           {%
%    \end{macrocode}
% Value is set to the default value.
%    \begin{macrocode}
             #4%
           }%
           {%
%    \end{macrocode}
% Non-empty, non-default value. Allow user to access this value
% through \cs{glscurrentfieldvalue}.
%\changes{4.23}{2016-04-30}{added \cs{glscurrentfieldvalue}}
%    \begin{macrocode}
            \let\glscurrentfieldvalue\@glo@thisvalue
            #3%
           }%
         }%
       }%
       {%
%    \end{macrocode}
% Not defined.
%    \begin{macrocode}
         \GlossariesWarning{Unknown entry field `#1'}%
         #4%
       }%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glscurrentfieldvalue}
%\changes{4.23}{2016-04-30}{new}
%    \begin{macrocode}
\newcommand*{\glscurrentfieldvalue}{}
%    \end{macrocode}
%\end{macro}
%
%\section{Defining new glossaries}\label{sec:newglos}
% A comma-separated list of glossary names is stored
% in \cs{@glo@types}. When a new glossary type
% is created, its identifying name is added to this list.
% This is used by commands that iterate through all glossaries
% (such as \ics{makeglossaries} and \ics{printglossaries}).
%\begin{macro}{\@glo@types}
%    \begin{macrocode}
\newcommand*{\@glo@types}{,}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@provide@newglossary}
%\changes{3.10a}{2013-10-13}{new}
% If the user removes the glossary package from their document,
% ensure the next run doesn't throw a load of undefined control
% sequence errors when the aux file is parsed.
%    \begin{macrocode}
\newcommand*\@gls@provide@newglossary{%
  \protected@write\@auxout{}{\string\providecommand\string\@newglossary[4]{}}%
%    \end{macrocode}
% Only need to do this once.
%    \begin{macrocode}
  \let\@gls@provide@newglossary\relax
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\defglsentryfmt}
%\changes{3.11a}{2013-10-15}{new}
% Allow different glossaries to have different display styles.
%    \begin{macrocode}
\newcommand*{\defglsentryfmt}[2][\glsdefaulttype]{%
  \csgdef{gls@#1@entryfmt}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@doentryfmt}
%\changes{3.11a}{2013-10-15}{new}
%    \begin{macrocode}
\newcommand*{\gls@doentryfmt}[1]{\csuse{gls@#1@entryfmt}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@forbidtexext}
%\changes{4.08}{2014-07-30}{new}
% As a security precaution, don't allow the user to specify a `tex'
% extension for any of the glossary files. (Just in case a seriously
% confused novice user doesn't know what they're doing.) The
% argument must be a control sequence whose replacement text is the
% requested extension.
%    \begin{macrocode}
\newcommand*{\@gls@forbidtexext}[1]{%
 \ifboolexpr{test {\ifdefstring{#1}{tex}}
          or test {\ifdefstring{#1}{TEX}}}
 {%
   \def#1{nottex}%
   \PackageError{glossaries}%
    {Forbidden `.tex' extension replaced with `.nottex'}%
    {I'm sorry, I can't allow you to do something so reckless.\MessageBreak
     Don't use `.tex' as an extension for a temporary file.}%
 }%
 {%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@gobbleopt}
% Discard optional argument.
%\changes{4.19}{2015-11-22}{new}
%    \begin{macrocode}
\newcommand*{\gls@gobbleopt}{\new@ifnextchar[{\@gls@gobbleopt}{}}
\def\@gls@gobbleopt[#1]{}
%    \end{macrocode}
%\end{macro}
%
% A new glossary type is defined using \cs{newglossary}.
% Syntax:
%\begin{definition}
%\cs{newglossary}\oarg{log-ext}\marg{name}\marg{in-ext}\marg{out-ext}%
%\marg{title}\oarg{counter}
%\end{definition}
% where \meta{log-ext} is the extension of the \app{makeindex}
% transcript file, \meta{in-ext} is the extension of the glossary 
% input file (read in by \ics{printglossary} and created by
% \app{makeindex}), \meta{out-ext} is the extension of the
% glossary output file which is read in by \app{makeindex} 
% (lines are written to this file by the \ics{glossary} command),
% \meta{title} is the title of the glossary that is used in
% \ics{glossarysection} and
% \meta{counter} is the default counter to be used by entries
% belonging to this glossary. The \app{makeglossaries} Perl
% script reads in the relevant extensions from the auxiliary file,
% and passes the appropriate file names and switches to 
% \app{makeindex}.
%\begin{macro}{\newglossary}
%\changes{4.08}{2014-07-30}{added starred version}
%    \begin{macrocode}
\newcommand*{\newglossary}{\@ifstar\s@newglossary\ns@newglossary}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\s@newglossary}
% The starred version will construct the extension based on the
% label.
%\changes{4.08}{2014-07-30}{new}
%    \begin{macrocode}
\newcommand*{\s@newglossary}[2]{%
 \ns@newglossary[#1-glg]{#1}{#1-gls}{#1-glo}{#2}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\ns@newglossary}
%\changes{4.08}{2014-07-30}{new}
% Define the unstarred version.
%    \begin{macrocode}
\newcommand*{\ns@newglossary}[5][glg]{%
 \doifglossarynoexistsordo{#2}%
 {%
%    \end{macrocode}
% Check if default has been set
%    \begin{macrocode}
  \ifundef\glsdefaulttype
  {%
    \gdef\glsdefaulttype{#2}%
  }{}%
%    \end{macrocode}
% Add this to the list of glossary types:
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
  \toks@{#2}\protected@edef\@glo@types{\@glo@types\the\toks@,}%
%    \end{macrocode}
% Define a comma-separated list of labels for this glossary type, 
% so that all the entries for this glossary can be reset with a 
% single command. When a new entry is created, its label is added
% to this list.
%    \begin{macrocode}
  \expandafter\gdef\csname glolist@#2\endcsname{,}%
%    \end{macrocode}
% Store the file extensions:
%\changes{4.08}{2014-07-30}{added \cs{@glotype@\meta{name}@log}}
%    \begin{macrocode}
  \expandafter\edef\csname @glotype@#2@log\endcsname{#1}%
  \expandafter\edef\csname @glotype@#2@in\endcsname{#3}%
  \expandafter\edef\csname @glotype@#2@out\endcsname{#4}%
  \expandafter\@gls@forbidtexext\csname @glotype@#2@log\endcsname
  \expandafter\@gls@forbidtexext\csname @glotype@#2@in\endcsname
  \expandafter\@gls@forbidtexext\csname @glotype@#2@out\endcsname
%    \end{macrocode}
% Store the title:
%    \begin{macrocode}
  \expandafter\def\csname @glotype@#2@title\endcsname{#5}%
%    \end{macrocode}
%\changes{3.10a}{2013-10-13}{added \cs{@gls@provide@newglossary}}
%    \begin{macrocode}
  \@gls@provide@newglossary
  \protected@write\@auxout{}{\string\@newglossary{#2}{#1}{#3}{#4}}%
%    \end{macrocode}
% How to display this entry in the document text (uses
% \cs{glsentry} by
% default). This can be redefined by the user later if required
% (see \ics{defglsentry}). This
% may already have been defined if this has been specified as 
% a list of acronyms.
%\changes{2.04}{2009-11-10}{added check to determine if 
% \cs{gls@\meta{type}@display} and \cs{gls@\meta{type}@displayfirst}
% have been defined.}
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%\changes{3.11a}{2013-10-15}{replaced \cs{glsdisplay} and
%\cs{glsdisplayfirst} with \cs{glsentryfmt}}
%    \begin{macrocode}
  \ifcsundef{gls@#2@entryfmt}%
  {%
    \defglsentryfmt[#2]{\glsentryfmt}%
  }%
  {}%
%    \end{macrocode}
% Define sort counter if required:
%\changes{3.0}{2011-04-02}{added \cs{@gls@defsortcount}}
%    \begin{macrocode}
  \@gls@defsortcount{#2}%
%    \end{macrocode}
% Find out if the final optional argument has been specified, and
% use it to set the counter associated with this glossary. (Uses
% \ics{glscounter} if no optional argument is present.)
%    \begin{macrocode}
  \@ifnextchar[{\@gls@setcounter{#2}}%
    {\@gls@setcounter{#2}[\glscounter]}%
 }%
 {%
   \gls@gobbleopt
 }%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\altnewglossary}
%\changes{2.06}{2010-06-14}{new}
%    \begin{macrocode}
\newcommand*{\altnewglossary}[3]{%
  \newglossary[#2-glg]{#1}{#2-gls}{#2-glo}{#3}%
}
%    \end{macrocode}
%\end{macro}
% Only define new glossaries in the preamble:
%    \begin{macrocode}
\@onlypreamble{\newglossary}
%    \end{macrocode}
% Only define new glossaries before \ics{makeglossaries}
%    \begin{macrocode}
\@onlypremakeg\newglossary
%    \end{macrocode}
%\cs{@newglossary} is used to specify the file extensions
% for the \app{makeindex} input, output and transcript files.
% It is written to the auxiliary file by \ics{newglossary}.
% Since it is not used by \LaTeX, \cs{@newglossary} simply
% ignores its arguments.
%\begin{macro}{\@newglossary}
%    \begin{macrocode}
\newcommand*{\@newglossary}[4]{}
%    \end{macrocode}
%\end{macro}
% Store counter to be used for given glossary type (the first
% argument is the glossary label, the second argument is the name 
% of the counter):
%\begin{macro}{\@gls@setcounter}
%    \begin{macrocode}
\def\@gls@setcounter#1[#2]{%
  \expandafter\def\csname @glotype@#1@counter\endcsname{#2}%
%    \end{macrocode}
% Add counter to xindy list, if not already added:
%    \begin{macrocode}
  \ifglsxindy
    \GlsAddXdyCounters{#2}%
  \fi
}
%    \end{macrocode}
%\end{macro}
% Get counter associated with given glossary (the argument is
% the glossary label):
%\begin{macro}{\@gls@getcounter}
%    \begin{macrocode}
\newcommand*{\@gls@getcounter}[1]{%
 \csname @glotype@#1@counter\endcsname
}
%    \end{macrocode}
%\end{macro}
%
% Define the main glossary. This will be the first glossary to
% be displayed when using \ics{printglossaries}.
%    \begin{macrocode}
\glsdefmain
%    \end{macrocode}
% Define the \qt{acronym} glossaries if required.
%    \begin{macrocode}
\@gls@do@acronymsdef
%    \end{macrocode}
% Define the \qt{symbols}, \qt{numbers} and \qt{index} glossaries if required.
%    \begin{macrocode}
\@gls@do@symbolsdef
\@gls@do@numbersdef
\@gls@do@indexdef
%    \end{macrocode}
%
%\begin{macro}{\newignoredglossary}
% Creates a new glossary that doesn't have associated files.
% This glossary is ignored by any commands that iterate over
% glossaries, such as \ics{printglossaries}, and won't work with
% commands like \ics{printglossary}. It's intended for entries that
% are so commonly-known they don't require a glossary.
%\changes{4.08}{2014-07-30}{new}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
\newcommand*{\newignoredglossary}[1]{%
  \ifdefempty\@ignored@glossaries
  {%
    \protected@edef\@ignored@glossaries{#1}%
  }%
  {%
    \protected@eappto\@ignored@glossaries{,#1}%
  }%
  \csgdef{glolist@#1}{,}%
  \ifcsundef{gls@#1@entryfmt}%
  {%
    \defglsentryfmt[#1]{\glsentryfmt}%
  }%
  {}%
  \ifdefempty\@gls@nohyperlist
  {%
     \renewcommand*{\@gls@nohyperlist}{#1}%
  }%
  {%
     \protected@eappto\@gls@nohyperlist{,#1}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@ignored@glossaries}
% List of ignored glossaries.
%\changes{4.08}{2014-07-30}{new}
%    \begin{macrocode}
\newcommand*{\@ignored@glossaries}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ifignoredglossary}
% Tests if the given glossary is an ignored glossary.
% Expansion is used in case the first argument is a control
% sequence.
%\changes{4.08}{2014-07-30}{new}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
\newcommand*{\ifignoredglossary}[3]{%
  \protected@edef\@gls@igtype{#1}%
  \expandafter\DTLifinlist\expandafter
    {\@gls@igtype}{\@ignored@glossaries}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\section{Defining new entries}\label{sec:newentry}
% New glossary entries are defined using \cs{newglossaryentry}.
% This command requires a label and a key-value list that defines
% the relevant information for that entry. The definition for these
% keys follows. Note that the \gloskey{name},
% \gloskey{description} and \gloskey{symbol} keys will be
% sanitized later, depending on the value of the package option
% \pkgopt{sanitize} (this means that if some of the keys haven't
% been defined, they can be constructed from the \gloskey{name}
% and \gloskey{description} key before they are sanitized).
%
%
%\begin{key}{name}
%The \gloskey{name} key indicates the name
% of the term being defined. This is how the term will appear in
% the glossary. The \gloskey{name} key is required when defining
% a new glossary entry.
%    \begin{macrocode}
\define@key{glossentry}{name}{%
\def\@glo@name{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{description}
% The \gloskey{description} key is usually only used in
% the glossary, but can be made to appear in the text by redefining
% \ics{glsentryfmt} or using \ics{defglsentryfmt}. The 
% \gloskey{description} key is required when
% defining a new glossary entry. If a long description is required,
% use \ics{longnewglossaryentry} instead of \ics{newglossaryentry}.
%    \begin{macrocode}
\define@key{glossentry}{description}{%
\def\@glo@desc{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{descriptionplural}
% \changes{1.12}{2008-03-08}{new}
%    \begin{macrocode}
\define@key{glossentry}{descriptionplural}{%
\def\@glo@descplural{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{sort}
% The \gloskey{sort} key needs to be sanitized here 
% (the sort key is provided for \app{makeindex}'s benefit, 
% not for use in the document). The \gloskey{sort} key is optional
% when defining a new glossary entry. If omitted, the value 
% is given by \meta{name} \meta{description}.
%\changes{1.18}{2009-01-14}{moved sanitization to
%\cs{newglossaryentry}}
%    \begin{macrocode}
\define@key{glossentry}{sort}{%
\def\@glo@sort{#1}}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{text}
% The \gloskey{text} key determines how the term should appear when
% used in the document (i.e.\ outside of the glossary). If omitted, 
% the value of the \gloskey{name} key is used instead.
%    \begin{macrocode}
\define@key{glossentry}{text}{%
\def\@glo@text{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{plural}
% The \gloskey{plural} key determines how the plural form of the term
% should be displayed in the document. If omitted, the plural is
% constructed by appending \ics{glspluralsuffix} to the value of the 
% \gloskey{text} key.
%    \begin{macrocode}
\define@key{glossentry}{plural}{%
\def\@glo@plural{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{first}
% The \gloskey{first} key determines how the entry should be displayed
% in the document when it is first used. If omitted, it is taken
% to be the same as the value of the \gloskey{text} key.
%    \begin{macrocode}
\define@key{glossentry}{first}{%
\def\@glo@first{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{firstplural}
% The \gloskey{firstplural} key is used to set the plural form for
% first use, in the event that the plural is required the first 
% time the term is used. If omitted, it is constructed by 
% appending \ics{glspluralsuffix} to the value of the \gloskey{first} key.
%    \begin{macrocode}
\define@key{glossentry}{firstplural}{%
\def\@glo@firstplural{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{macro}{\@gls@default@value}
%\changes{3.09a}{2013-10-09}{new}
%    \begin{macrocode}
\newcommand*{\@gls@default@value}{\relax}
%    \end{macrocode}
%\end{macro}
%
%\begin{key}{symbol}
% The \gloskey{symbol} key is ignored by most of the predefined
% glossary styles, and defaults to \cs{relax} if omitted. 
% It is provided for glossary styles that require an associated 
% symbol, as well as a name and description. To make this value 
% appear in the glossary, you need to redefine 
% \ics{glossentry}.
% If you want this value to appear in the text when the term is used 
% by commands like \ics{gls}, you will need to change
% \ics{glsentryfmt} (or use for \ics{defglsentryfmt} individual glossaries).
%    \begin{macrocode}
\define@key{glossentry}{symbol}{%
\def\@glo@symbol{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{symbolplural}
% \changes{1.12}{2008-03-08}{new}
%    \begin{macrocode}
\define@key{glossentry}{symbolplural}{%
\def\@glo@symbolplural{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{type}
% The \gloskey{type} key specifies to which glossary this
% entry belongs. If omitted, the default glossary is used.
%    \begin{macrocode}
\define@key{glossentry}{type}{%
\def\@glo@type{#1}}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{counter}
% The \gloskey{counter} key specifies the name of the counter 
% associated with this glossary entry:
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%    \begin{macrocode}
\define@key{glossentry}{counter}{%
  \ifcsundef{c@#1}%
  {%
    \PackageError{glossaries}%
    {There is no counter called `#1'}%
    {%
      The counter key should have the name of a valid counter 
      as its value%
    }%
  }%
  {%
    \def\@glo@counter{#1}%
  }%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{see}
% The \gloskey{see} key specifies a list of cross-references
% \changes{1.17}{2008-12-26}{new}
% \changes{3.0}{2011-04-02}{added \cs{@glo@seeautonumberlist}}
%\changes{3.13a}{2013-11-05}{added \cs{gls@checkseeallowed}}
%    \begin{macrocode}
\define@key{glossentry}{see}{%
  \gls@set@xr@key{see}{\@glo@see}{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{macro}{\gls@set@xr@key}
%\changes{4.30}{2017-06-11}{new}
%\begin{definition}
%\cs{gls@set@xr@key}\marg{key name}\marg{cs}\marg{value}
%\end{definition}
%Assign a cross-reference key.
%    \begin{macrocode}
\newcommand*{\gls@set@xr@key}[3]{%
  \renewcommand*{\gls@xr@key}{#1}%
  \gls@checkseeallowed
  \def#2{#3}%
  \@glo@seeautonumberlist
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@xr@key}
%\changes{4.30}{2017-06-11}{new}
%    \begin{macrocode}
\newcommand*{\gls@xr@key}{see}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@checkseeallowed}
%\changes{3.13a}{2013-11-05}{new}
%    \begin{macrocode}
\newcommand*{\gls@checkseeallowed}{%
 \@gls@see@noindex
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@checkseeallowed@preambleonly}
%\changes{4.20}{2015-11-30}{new}
%    \begin{macrocode}
\newcommand*{\gls@checkseeallowed@preambleonly}{%
  \GlossariesWarning
  {`\gls@xr@key' key doesn't have any effect when used in the document
   environment. Move the definition to the preamble 
    after \string\makeglossaries\space
   or \string\makenoidxglossaries}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{key}{parent}
% The \gloskey{parent} key specifies the parent entry, if
% required.
% \changes{1.17}{2008-12-26}{new}
%    \begin{macrocode}
\define@key{glossentry}{parent}{%
\def\@glo@parent{#1}}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{nonumberlist}
% The \gloskey{nonumberlist} key suppresses or activates the number list
% for the given entry.
%\changes{1.17}{2008-12-26}{new}
%\changes{3.0}{2011-04-02}{now boolean}
%\changes{4.41}{2018-07-23}{changed \cs{val} and \cs{nr} to
%\cs{gls@nonumberlist@val} and \cs{gls@nonumberlist@nr}}
%    \begin{macrocode}
\define@choicekey{glossentry}{nonumberlist}%
 [\gls@nonumberlist@val\gls@nonumberlist@nr]{true,false}[true]%
{%
  \ifcase\gls@nonumberlist@nr\relax
    \def\@glo@prefix{\glsnonextpages}%
    \@gls@savenonumberlist{true}%
  \else
    \def\@glo@prefix{\glsnextpages}%
    \@gls@savenonumberlist{false}%
  \fi
}
%    \end{macrocode}
%\end{key}
%
%\begin{macro}{\@gls@savenonumberlist}
%\changes{4.25}{2016-06-09}{new}
%The \gloskey{nonumberlist} option isn't saved by default (as it
%just sets the prefix) which isn't a problem when the entries are
%defined in the preamble, but causes a problem when entries are
%defined in the document. In this case, the value needs to be saved
%so that it can be written to the \texttt{.glsdefs} file.
%    \begin{macrocode}
\newcommand*{\@gls@savenonumberlist}[1]{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@initnonumberlist}
%\changes{4.25}{2016-06-09}{new}
%    \begin{macrocode}
\newcommand*{\@gls@initnonumberlist}{}%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@initnonumberlist}
%\changes{4.25}{2016-06-09}{new}
%    \begin{macrocode}
\newcommand*{\@gls@storenonumberlist}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@enablesavenonumberlist}
%\changes{4.25}{2016-06-09}{new}
% Allow the \gloskey{nonumberlist} value to be saved.
%    \begin{macrocode}
\newcommand*{\@gls@enablesavenonumberlist}{%
  \renewcommand*{\@gls@initnonumberlist}{%
    \undef\@glo@nonumberlist
  }%
  \renewcommand*{\@gls@savenonumberlist}[1]{%
    \def\@glo@nonumberlist{##1}%
  }%
  \renewcommand*{\@gls@storenonumberlist}[1]{%
    \ifdef\@glo@nonumberlist
    {%
      \cslet{glo@\glsdetoklabel{##1}@nonumberlist}{\@glo@nonumberlist}%
    }%
    {}%
  }%
  \appto\@gls@keymap{,{nonumberlist}{nonumberlist}}%
}
%    \end{macrocode}
%\end{macro}
%
% Define some generic user keys. (Additional keys can be added by
% the user.)
%\begin{key}{user1}
%    \begin{macrocode}
\define@key{glossentry}{user1}{%
  \def\@glo@useri{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{user2}
%    \begin{macrocode}
\define@key{glossentry}{user2}{%
  \def\@glo@userii{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{user3}
%    \begin{macrocode}
\define@key{glossentry}{user3}{%
  \def\@glo@useriii{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{user4}
%    \begin{macrocode}
\define@key{glossentry}{user4}{%
  \def\@glo@useriv{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{user5}
%    \begin{macrocode}
\define@key{glossentry}{user5}{%
  \def\@glo@userv{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{user6}
%    \begin{macrocode}
\define@key{glossentry}{user6}{%
  \def\@glo@uservi{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{short}
%\changes{3.0}{2011-04-02}{new}
% This key is provided for use by \ics{newacronym}. It's not
% designed for general purpose use, so isn't described in the user
% manual.
%    \begin{macrocode}
\define@key{glossentry}{short}{%
  \def\@glo@short{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{shortplural}
%\changes{3.0}{2011-04-02}{new}
% This key is provided for use by \ics{newacronym}.
%    \begin{macrocode}
\define@key{glossentry}{shortplural}{%
  \def\@glo@shortpl{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{long}
%\changes{3.0}{2011-04-02}{new}
% This key is provided for use by \ics{newacronym}.
%    \begin{macrocode}
\define@key{glossentry}{long}{%
  \def\@glo@long{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{longplural}
%\changes{3.0}{2011-04-02}{new}
% This key is provided for use by \ics{newacronym}.
%    \begin{macrocode}
\define@key{glossentry}{longplural}{%
  \def\@glo@longpl{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{macro}{\@glsnoname}
% \changes{1.17}{2008-12-26}{new}
% Define command to generate error if \gloskey{name} key is missing.
%    \begin{macrocode}
\newcommand*{\@glsnoname}{%
  \PackageError{glossaries}{name key required in 
  \string\newglossaryentry\space for entry `\@glo@label'}{You 
  haven't specified the entry name}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glsnodesc}
% \changes{3.10a}{2013-10-13}{new}
% Define command to generate error if \gloskey{description} key is missing.
%    \begin{macrocode}
\newcommand*\@glsnodesc{%
  \PackageError{glossaries}
  {%
    description key required in \string\newglossaryentry\space
    for entry `\@glo@label'%
  }%
  {%
    You haven't specified the entry description%
  }%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsdefaultplural}
% \changes{1.17}{2008-12-26}{new}
%\changes{3.10a}{2013-10-13}{Obsolete}
% Now obsolete. Don't use.
%    \begin{macrocode}
\newcommand*{\@glsdefaultplural}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@missingnumberlist}
%\changes{3.02}{2012-05-21}{new}
% Define a command to generate warning when numberlist not set.
%    \begin{macrocode}
\newcommand*{\@gls@missingnumberlist}[1]{%
  ??%
  \ifglssavenumberlist
    \GlossariesWarning{Missing number list for entry `#1'. 
     Maybe makeglossaries + rerun required}%
  \else
    \PackageError{glossaries}%
    {Package option `savenumberlist=true' required}%
    {%
      You must use the `savenumberlist' package option
      to reference location lists.%
    }%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsdefaultsort}
% Define command to set default sort.
% \changes{1.17}{2008-12-26}{new}
%    \begin{macrocode}
\newcommand*{\@glsdefaultsort}{\@glo@name}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@level}
% Register to increment entry levels.
%    \begin{macrocode}
\newcount\gls@level
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@noexpand@field}
%    \begin{macrocode}
\newcommand{\@@gls@noexpand@field}[3]{%
 \expandafter\global\expandafter
    \let\csname glo@#1@#2\endcsname#3%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@noexpand@fields}
%    \begin{macrocode}
\newcommand{\@gls@noexpand@fields}[4]{%
  \ifcsdef{gls@assign@#3@field}
  {%
     \ifdefequal{#4}{\@gls@default@value}%
     {%
       \edef\@gls@value{\expandonce{#1}}%
       \csuse{gls@assign@#3@field}{#2}{\@gls@value}%
     }%
     {%
       \csuse{gls@assign@#3@field}{#2}{#4}%
     }%
  }%
  {%
    \ifdefequal{#4}{\@gls@default@value}%
    {%
       \edef\@gls@value{\expandonce{#1}}%
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{Fixed bug \texttt{expand} replaced with
%\texttt{noexpand}}
%    \begin{macrocode}
       \@@gls@noexpand@field{#2}{#3}{\@gls@value}%
    }%
    {%
      \@@gls@noexpand@field{#2}{#3}{#4}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@@gls@expand@field}
%    \begin{macrocode}
\newcommand{\@@gls@expand@field}[3]{%
 \expandafter
   \protected@xdef\csname glo@#1@#2\endcsname{#3}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{@gls@expand@fields}
%    \begin{macrocode}
\newcommand{\@gls@expand@fields}[4]{%
  \ifcsdef{gls@assign@#3@field}
  {%
     \ifdefequal{#4}{\@gls@default@value}%
     {%
       \edef\@gls@value{\expandonce{#1}}%
       \csuse{gls@assign@#3@field}{#2}{\@gls@value}%
     }%
     {%
       \expandafter\@gls@startswithexpandonce#4\relax\relax\gls@endcheck
       {%
         \@@gls@expand@field{#2}{#3}{#4}%
       }%
       {%
         \csuse{gls@assign@#3@field}{#2}{#4}%
       }%
     }%
  }%
  {%
    \ifdefequal{#4}{\@gls@default@value}%
    {%
      \@@gls@expand@field{#2}{#3}{#1}%
    }%
    {%
      \@@gls@expand@field{#2}{#3}{#4}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@startswithexpandonce}
%    \begin{macrocode}
\def\@gls@expandonce{\expandonce}
\def\@gls@startswithexpandonce#1#2\gls@endcheck#3#4{%
  \def\@gls@tmp{#1}%
  \ifdefequal{\@gls@expandonce}{\@gls@tmp}{#3}{#4}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\gls@assign@field}
%\begin{definition}
%\cs{gls@assign@field}\marg{def value}\marg{label}\marg{field}\marg{tmp
%cs}
%\end{definition}
% Assigns an entry field. Expansion performed by default (except for
% name, symbol and description where backward compatibility required).
% If \meta{tmp cs} is \meta{@gls@default@value}, \meta{def value} is
% used instead.
%\changes{3.08a}{2013-09-28}{new}
%    \begin{macrocode}
\let\gls@assign@field\@gls@expand@fields
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsexpandfields}
%\changes{3.08a}{2013-09-28}{new}
% Fully expand values when assigning fields (except for specific
% fields that are overridden by \cs{glssetnoexpandfield}).
%    \begin{macrocode}
\newcommand*{\glsexpandfields}{%
  \let\gls@assign@field\@gls@expand@fields
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsnoexpandfields}
%\changes{3.08a}{2013-09-28}{new}
% Don't expand values when assigning fields (except for specific
% fields that are overridden by \cs{glssetexpandfield}).
%    \begin{macrocode}
\newcommand*{\glsnoexpandfields}{%
  \let\gls@assign@field\@gls@noexpand@fields
}
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{\newglossaryentry}
% Define \cs{newglossaryentry}%
% \marg{label} \marg{key-val list}. 
% There are two required fields in \meta{key-val list}: 
% \gloskey{name} (or \gloskey{parent}) and 
% \gloskey{description}. (See above.)
%\changes{3.0}{2011-04-02}{replaced \cs{DeclareRobustCommand} with
%\cs{newrobustcmd}}
%    \begin{macrocode}
\newrobustcmd{\newglossaryentry}[2]{%
%    \end{macrocode}
% Check to see if this glossary entry has already been defined:
%    \begin{macrocode}
  \glsdoifnoexists{#1}%
  {%
     \gls@defglossaryentry{#1}{#2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@defdocnewglossaryentry}
%\changes{4.14}{2015-02-28}{new}
% The definition of \cs{newglossaryentry} is changed at the start of
% the \env{document} environment. As from v4.47 the \gloskey{see}
% key now works in the \env{document} environment.
%\changes{4.47}{2021-09-20}{removed see warning}
%    \begin{macrocode}
\newcommand*{\gls@defdocnewglossaryentry}{%
  \let\newglossaryentry\new@glossaryentry
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\provideglossaryentry}
% Like \cs{newglossaryentry} but does nothing if the entry has
% already been defined.
%\changes{3.14a}{2013-11-12}{new}
%    \begin{macrocode}
\newrobustcmd{\provideglossaryentry}[2]{%
  \ifglsentryexists{#1}%
  {}%
  {%
    \gls@defglossaryentry{#1}{#2}%
  }%
}
\@onlypreamble{\provideglossaryentry}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@glsdefs@labellist}
%\changes{4.47}{2021-09-20}{new}
% List of labels of entries defined in \texttt{.glsdefs} file.
%    \begin{macrocode}
\newcommand*{\gls@glsdefs@labellist}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@glsdefs@addlabel}
%\changes{4.47}{2021-09-20}{new}
% Save label of entry defined in \texttt{.glsdefs} file.
%    \begin{macrocode}
\newcommand*{\gls@glsdefs@addlabel}[1]{\listxadd{\gls@glsdefs@labellist}{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@docdef@labellist}
%\changes{4.47}{2021-09-20}{new}
% List of labels of entries defined in the \env{document} environment.
%    \begin{macrocode}
\newcommand*{\gls@docdef@labellist}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@docdef@addlabel}
%\changes{4.47}{2021-09-20}{new}
% Save label of entry defined in the \env{document} environment.
%    \begin{macrocode}
\newcommand*{\gls@docdef@addlabel}[1]{\listxadd{\gls@docdef@labellist}{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\new@glossaryentry}
%\changes{3.10a}{2013-10-13}{new}
% For use in document environment. This opens the \texttt{.glsdefs}
% file, if not already open, so that the entry definition can be
% saved for the next \LaTeX\ run. This means that any glossaries at
% the start of the document can access the entry information.
%    \begin{macrocode}
\newrobustcmd{\new@glossaryentry}[2]{%
  \ifundef\@gls@deffile
  {%
     \global\newwrite\@gls@deffile
     \immediate\openout\@gls@deffile=\jobname.glsdefs
  }%
  {}%
%    \end{macrocode}
%\changes{4.47}{2021-09-20}{allow overwrite if defined in \texttt{.glsdefs}}
% Don't check for existence since if the entry has been defined in
% the \texttt{.glsdefs} it will need to be redefined in case the
% entry has been updated, but keep track of which entries have been
% defined in the document environment to prevent duplicate
% definitions.
%    \begin{macrocode}
  \ifglsentryexists{#1}%
  {%
    \xifinlist{#1}{\gls@docdef@labellist}%
    {%
%    \end{macrocode}
% This entry has already been defined in the document environment.
%    \begin{macrocode}
      \GlossariesWarning{Entry `#1' has already been defined in the 
        document environment (ignoring new definition)}%
    }%
    {%
      \xifinlist{#1}{\gls@glsdefs@labellist}%
      {%
%    \end{macrocode}
% This entry was defined in the \texttt{.glsdefs} file so update the
% definition in case it has been changed.
%    \begin{macrocode}
       \gls@defglossaryentry{#1}{#2}%
       \gls@docdef@addlabel{#1}%
       \@gls@writedef{#1}%
      }%
      {%
%    \end{macrocode}
% This entry wasn't defined in the \texttt{.glsdefs} file so it must
% have been defined in the preamble.
%    \begin{macrocode}
        \GlossariesWarning{Entry `#1' has already been defined in 
         the preamble (in which case remove the duplicate definition)
         or you have just updated to glossaries.sty
         v4.47 (in which case delete `\jobname.glsdefs')}%
      }%
    }%
  }%
  {%
%    \end{macrocode}
% This entry hasn't been defined (new entry since last build).
%    \begin{macrocode}
     \gls@defglossaryentry{#1}{#2}%
     \gls@docdef@addlabel{#1}%
     \@gls@writedef{#1}%
  }%
}
%    \end{macrocode}
%At the start of the document input the \texttt{.glsdefs} file if it
%exists. This is now done by \cs{gls@begindocdefs}, which is
%redefined by \sty{glossaries-extra}, so that
%this step can be skipped to avoid loading an obsolete
%\texttt{.glsdefs} file if the user switches to
%\sty{glossaries-extra} with \texttt{docdef=restricted}. 
%    \begin{macrocode}
\AtBeginDocument{\gls@begindocdefs}
%    \end{macrocode}
%The end of the document needs to check if the \texttt{.glsdefs}
%file has been opened, in which case it needs to be closed.
%    \begin{macrocode}
\AtEndDocument{\ifdef\@gls@deffile{\closeout\@gls@deffile}{}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@begindocdefs}
%\changes{4.37}{2018-04-07}{new}
%Input the \verb|.glsdefs| file if it exists and enable document
%definitions if permitted.
%    \begin{macrocode}
\newcommand*{\gls@begindocdefs}{%
  \@gls@enablesavenonumberlist
  \edef\@gls@restoreat{\noexpand\catcode`\noexpand\@=\number\catcode`\@\relax}%
  \makeatletter
  \InputIfFileExists{\jobname.glsdefs}{}{}%
  \@gls@restoreat
  \undef\@gls@restoreat
  \gls@defdocnewglossaryentry
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdefs@newdocentry}
%\changes{4.47}{2021-09-20}{new}
% Used to define entries in the \texttt{.glsdefs} file.
%    \begin{macrocode}
\newcommand*{\glsdefs@newdocentry}[2]{%
  \ifglsentryexists{#1}%
  {\GlossariesWarning{entry `#1' has already been defined in the preamble
    (if you have moved the definition there from the document
     environment, delete \jobname.glsdefs)}}%
  {%
    \gls@glsdefs@addlabel{#1}%
    \gls@defglossaryentry{#1}{#2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@writedef}
%\changes{3.10a}{2013-10-13}{new}
% Writes glossary entry definition to \cs{@gls@deffile}.
% Allow for the possibility that the entry definition may have been
% moved from the document environment to the preamble, so warn
% rather than generate an error.
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.47}{2021-09-20}{added a warning if entry has already been
%defined}
%    \begin{macrocode}
\newcommand*{\@gls@writedef}[1]{%
  \immediate\write\@gls@deffile
  {%
    \string\glsdefs@newdocentry{\glsdetoklabel{#1}}\glspercentchar^^J%
    \expandafter\@gobble\string\{\glspercentchar%
  }%
%    \end{macrocode}
% Write key value information:
%    \begin{macrocode}
  \@for\@gls@map:=\@gls@keymap\do
  {%
    \letcs\glo@value{glo@\glsdetoklabel{#1}@\expandafter\@secondoftwo\@gls@map}%
    \ifdef\glo@value
    {%
      \@onelevel@sanitize\glo@value
      \immediate\write\@gls@deffile
      {%
        \expandafter\@firstoftwo\@gls@map
          =\expandafter\@gobble\string\{\glo@value\expandafter\@gobble\string\},%
          \glspercentchar
      }%
    }%
    {}%
  }%
%    \end{macrocode}
% Provide hook:
%    \begin{macrocode}
  \glswritedefhook
  \immediate\write\@gls@deffile
  {%
    \glspercentchar^^J%
    \expandafter\@gobble\string\}\glspercentchar^^J%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@keymap}
%\changes{3.10a}{2013-10-13}{new}
% List of entry definition key names and corresponding tag in
% control sequence used to store the value.
%    \begin{macrocode}
\newcommand*{\@gls@keymap}{%
  {name}{name},%
  {sort}{sortvalue},% unescaped sort value
  {type}{type},%
  {first}{first},%
  {firstplural}{firstpl},%
  {text}{text},%
  {plural}{plural},%
  {description}{desc},%
  {descriptionplural}{descplural},%
  {symbol}{symbol},%
  {symbolplural}{symbolplural},%
  {user1}{useri},%
  {user2}{userii},%
  {user3}{useriii},%
  {user4}{useriv},%
  {user5}{userv},%
  {user6}{uservi},%
  {long}{long},%
  {longplural}{longpl},%
  {short}{short},%
  {shortplural}{shortpl},%
  {counter}{counter},%
  {parent}{parent}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@fetchfield}
%\changes{4.03}{2014-01-20}{new}
%\begin{definition}
%\cs{@gls@fetchfield}\marg{cs}\marg{field}
%\end{definition}
% Fetches the internal field label from the given user \meta{field} and
% stores in \meta{cs}.
%    \begin{macrocode}
\newcommand*{\@gls@fetchfield}[2]{%
%    \end{macrocode}
% Ensure user field name is fully expanded
%    \begin{macrocode}
  \edef\@gls@thisval{#2}%
%    \end{macrocode}
% Iterate through known mappings until we find the one for this
% field.
%    \begin{macrocode}
  \@for\@gls@map:=\@gls@keymap\do{%
   \edef\@this@key{\expandafter\@firstoftwo\@gls@map}%
   \ifdefequal{\@this@key}{\@gls@thisval}%
   {%
%    \end{macrocode}
% Found it.
%    \begin{macrocode}
     \edef#1{\expandafter\@secondoftwo\@gls@map}%
%    \end{macrocode}
% Break out of loop.
%    \begin{macrocode}
     \@endfortrue
   }%
   {}%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaddstoragekey}
%\begin{definition}
%\cs{glsaddstoragekey}\marg{key}\marg{default value}\marg{no link cs}
%\end{definition}
%\changes{4.16}{2015-06-18}{new}
% Similar to \cs{glsaddkey} but intended for keys whose values
% aren't explicitly used in the document, but might be required
% behind the scenes by other commands.
%    \begin{macrocode}
\newcommand*{\glsaddstoragekey}{\@ifstar\@sglsaddstoragekey\@glsaddstoragekey}
%    \end{macrocode}
% Starred version switches on expansion for this key.
%    \begin{macrocode}
\newcommand*{\@sglsaddstoragekey}[1]{%
  \key@ifundefined{glossentry}{#1}%
  {%
    \expandafter\newcommand\expandafter*\expandafter
     {\csname gls@assign@#1@field\endcsname}[2]{%
       \@@gls@expand@field{##1}{#1}{##2}%
     }%
  }%
  {}%
  \@glsaddstoragekey{#1}%
}
%    \end{macrocode}
% Unstarred version doesn't override default expansion.
%    \begin{macrocode}
\newcommand*{\@glsaddstoragekey}[3]{%
%    \end{macrocode}
% Check the specified key doesn't already exist.
%    \begin{macrocode}
  \key@ifundefined{glossentry}{#1}%
  {%
%    \end{macrocode}
% Set up the key.
%    \begin{macrocode}
    \define@key{glossentry}{#1}{\csdef{@glo@#1}{##1}}%
    \appto\@gls@keymap{,{#1}{#1}}%
%    \end{macrocode}
% Set the default value.
%    \begin{macrocode}
    \appto\@newglossaryentryprehook{\csdef{@glo@#1}{#2}}%
%    \end{macrocode}
% Assignment code.
%    \begin{macrocode}
    \appto\@newglossaryentryposthook{%
      \letcs{\@glo@tmp}{@glo@#1}%
      \gls@assign@field{#2}{\@glo@label}{#1}{\@glo@tmp}%
    }%
%    \end{macrocode}
% Define the no-link commands.
%    \begin{macrocode}
    \newcommand*{#3}[1]{\@gls@entry@field{##1}{#1}}%
  }%
  {%
    \PackageError{glossaries}{Key `#1' already exists}{}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaddkey}
%\begin{definition}
%\cs{glsaddkey}\marg{key}\marg{default value}\marg{no link cs}\marg{no link ucfirst
%cs}\marg{link cs}\marg{link ucfirst cs}\marg{link allcaps cs}
%\end{definition}
%\changes{3.12a}{2013-10-16}{new}
% Allow user to add their own custom keys.
%    \begin{macrocode}
\newcommand*{\glsaddkey}{\@ifstar\@sglsaddkey\@glsaddkey}
%    \end{macrocode}
% Starred version switches on expansion for this key.
%    \begin{macrocode}
\newcommand*{\@sglsaddkey}[1]{%
  \key@ifundefined{glossentry}{#1}%
  {%
    \expandafter\newcommand\expandafter*\expandafter
     {\csname gls@assign@#1@field\endcsname}[2]{%
       \@@gls@expand@field{##1}{#1}{##2}%
     }%
  }%
  {}%
  \@glsaddkey{#1}%
}
%    \end{macrocode}
% Unstarred version doesn't override default expansion.
%    \begin{macrocode}
\newcommand*{\@glsaddkey}[7]{%
%    \end{macrocode}
% Check the specified key doesn't already exist.
%    \begin{macrocode}
  \key@ifundefined{glossentry}{#1}%
  {%
%    \end{macrocode}
% Set up the key.
%    \begin{macrocode}
    \define@key{glossentry}{#1}{\csdef{@glo@#1}{##1}}%
    \appto\@gls@keymap{,{#1}{#1}}%
%    \end{macrocode}
% Set the default value.
%    \begin{macrocode}
    \appto\@newglossaryentryprehook{\csdef{@glo@#1}{#2}}%
%    \end{macrocode}
% Assignment code.
%    \begin{macrocode}
    \appto\@newglossaryentryposthook{%
      \letcs{\@glo@tmp}{@glo@#1}%
      \gls@assign@field{#2}{\@glo@label}{#1}{\@glo@tmp}%
    }%
%    \end{macrocode}
% Define the no-link commands.
%    \begin{macrocode}
    \newcommand*{#3}[1]{\@gls@entry@field{##1}{#1}}%
    \newcommand*{#4}[1]{\@Gls@entry@field{##1}{#1}}%
%    \end{macrocode}
% Now for the commands with links. First the version with no case
% change:
%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@field@link}}
%    \begin{macrocode}
    \ifcsdef{@gls@user@#1@}%
    {%
       \PackageError{glossaries}%
       {Can't define `\string#5' as helper command 
        `\expandafter\string\csname @gls@user@#1@\endcsname' already exists}%
       {}%
    }%
    {%
%    \end{macrocode}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%\changes{4.08}{2014-07-30}{removed \cs{@sgls@user@\meta{key}}}
%\changes{4.09}{2014-08-12}{fixed bug in user commands}
%    \begin{macrocode}
      \expandafter\newcommand\expandafter*\expandafter
        {\csname @gls@user@#1\endcsname}[2][]{%
          \new@ifnextchar[%
            {\csuse{@gls@user@#1@}{##1}{##2}}%
            {\csuse{@gls@user@#1@}{##1}{##2}[]}}%
      \csdef{@gls@user@#1@}##1##2[##3]{%
        \@gls@field@link{##1}{##2}{#3{##2}##3}%
      }%
      \newrobustcmd*{#5}{%
        \expandafter\@gls@hyp@opt\csname @gls@user@#1\endcsname}%
    }%
%    \end{macrocode}
% Next the version with the first letter converted to upper case:
%    \begin{macrocode}
    \ifcsdef{@Gls@user@#1@}%
    {%
       \PackageError{glossaries}%
       {Can't define `\string#6' as helper command 
        `\expandafter\string\csname @Gls@user@#1@\endcsname' already exists}%
       {}%
    }%
    {%
%    \end{macrocode}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%\changes{4.08}{2014-07-30}{removed \cs{@sGls@user@\meta{key}}}
%    \begin{macrocode}
      \expandafter\newcommand\expandafter*\expandafter
        {\csname @Gls@user@#1\endcsname}[2][]{%
          \new@ifnextchar[%
            {\csuse{@Gls@user@#1@}{##1}{##2}}%
            {\csuse{@Gls@user@#1@}{##1}{##2}[]}}%
      \csdef{@Gls@user@#1@}##1##2[##3]{%
        \@gls@field@link{##1}{##2}{#4{##2}##3}%
      }%
      \newrobustcmd*{#6}{%
        \expandafter\@gls@hyp@opt\csname @Gls@user@#1\endcsname}%
    }%
%    \end{macrocode}
% Finally the all caps version:
%    \begin{macrocode}
    \ifcsdef{@GLS@user@#1@}%
    {%
       \PackageError{glossaries}%
       {Can't define `\string#7' as helper command 
        `\expandafter\string\csname @GLS@user@#1@\endcsname' already exists}%
       {}%
    }%
    {%
%    \end{macrocode}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%\changes{4.08}{2014-07-30}{removed \cs{@sGLS@user@\meta{key}}}
%    \begin{macrocode}
      \expandafter\newcommand\expandafter*\expandafter
        {\csname @GLS@user@#1\endcsname}[2][]{%
          \new@ifnextchar[%
            {\csuse{@GLS@user@#1@}{##1}{##2}}%
            {\csuse{@GLS@user@#1@}{##1}{##2}[]}}%
      \csdef{@GLS@user@#1@}##1##2[##3]{%
        \@gls@field@link{##1}{##2}{\mfirstucMakeUppercase{#3{##2}##3}}%
      }%
      \newrobustcmd*{#7}{%
        \expandafter\@gls@hyp@opt\csname @GLS@user@#1\endcsname}%
    }%
  }%
  {%
    \PackageError{glossaries}{Key `#1' already exists}{}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsfieldxdef}
%\begin{definition}
%\cs{glsfieldxdef}\marg{label}\marg{field}\marg{definition}
%\end{definition}
%\changes{4.16}{2015-07-08}{new}
%\changes{4.42}{2019-01-06}{changed from \cs{edef} to \cs{protected@csxdef}}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
\newcommand{\glsfieldxdef}[3]{%
 \glsdoifexists{#1}%
 {%
   \protected@edef\@glo@label{\glsdetoklabel{#1}}%
   \ifcsdef{glo@\@glo@label @#2}%
   {%
      \protected@csxdef{glo@\@glo@label @#2}{#3}%
   }%
   {%
      \PackageError{glossaries}{Key `#2' doesn't exist}{}%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsfieldedef}
%\begin{definition}
%\cs{glsfieldedef}\marg{label}\marg{field}\marg{definition}
%\end{definition}
%\changes{4.16}{2015-07-08}{new}
%\changes{4.42}{2019-01-06}{changed from \cs{edef} to \cs{protected@csedef}}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
\newcommand{\glsfieldedef}[3]{%
 \glsdoifexists{#1}%
 {%
   \protected@edef\@glo@label{\glsdetoklabel{#1}}%
   \ifcsdef{glo@\@glo@label @#2}%
   {%
      \protected@csedef{glo@\@glo@label @#2}{#3}%
   }%
   {%
      \PackageError{glossaries}{Key `#2' doesn't exist}{}%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsfieldgdef}
%\begin{definition}
%\cs{glsfieldgdef}\marg{label}\marg{field}\marg{definition}
%\end{definition}
%\changes{4.16}{2015-07-08}{new}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
\newcommand{\glsfieldgdef}[3]{%
 \glsdoifexists{#1}%
 {%
   \protected@edef\@glo@label{\glsdetoklabel{#1}}%
   \ifcsdef{glo@\@glo@label @#2}%
   {%
      \expandafter\gdef\csname glo@\@glo@label @#2\endcsname{#3}%
   }%
   {%
      \PackageError{glossaries}{Key `#2' doesn't exist}{}%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsfielddef}
%\begin{definition}
%\cs{glsfielddef}\marg{label}\marg{field}\marg{definition}
%\end{definition}
%\changes{4.16}{2015-07-08}{new}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
\newcommand{\glsfielddef}[3]{%
 \glsdoifexists{#1}%
 {%
   \protected@edef\@glo@label{\glsdetoklabel{#1}}%
   \ifcsdef{glo@\@glo@label @#2}%
   {%
      \expandafter\def\csname glo@\@glo@label @#2\endcsname{#3}%
   }%
   {%
      \PackageError{glossaries}{Key `#2' doesn't exist}{}%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsfieldfetch}
%\begin{definition}
%\cs{glsfieldfetch}\marg{label}\marg{field}\marg{cs}
%\end{definition}
%\changes{4.16}{2015-07-08}{new}
% Fetches the value of the given field and stores in the given
% control sequence.
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
\newcommand{\glsfieldfetch}[3]{%
 \glsdoifexists{#1}%
 {%
   \protected@edef\@glo@label{\glsdetoklabel{#1}}%
   \ifcsdef{glo@\@glo@label @#2}%
   {%
      \letcs#3{glo@\@glo@label @#2}%
   }%
   {%
      \PackageError{glossaries}{Key `#2' doesn't exist}{}%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsunexpandedfieldvalue}
%\changes{4.48}{2021-10-19}{new}
%\begin{definition}
%\cs{glsunexpandedfieldvalue}\marg{label}\marg{field}
%\end{definition}
%For use in expandable contexts where the field value is required,
%but the contents should not be expanded. The \meta{field} argument
%must be the internal field name.
%    \begin{macrocode}
\newcommand*{\glsunexpandedfieldvalue}[2]{%
  \ifcsname glo@\glsdetoklabel{#1}@#2\endcsname
   \expandafter\expandonce\csname glo@\glsdetoklabel{#1}@#2\expandafter\endcsname
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ifglsfieldeq}
%\begin{definition}
%\cs{ifglsfieldeq}\marg{label}\marg{field}\marg{string}\marg{true}\marg{false}
%\end{definition}
%\changes{4.16}{2015-07-08}{new}
% Tests if the value of the given field is equal to the given
% string.
%    \begin{macrocode}
\newcommand{\ifglsfieldeq}[5]{%
 \glsdoifexists{#1}%
 {%
   \protected@edef\@glo@label{\glsdetoklabel{#1}}%
   \ifcsdef{glo@\@glo@label @#2}%
   {%
      \ifcsstring{glo@\@glo@label @#2}{#3}{#4}{#5}%
   }%
   {%
      \PackageError{glossaries}{Key `#2' doesn't exist}{}%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ifglsfielddefeq}
%\begin{definition}
%\cs{ifglsfielddefeq}\marg{label}\marg{field}\marg{command}\marg{true}\marg{false}
%\end{definition}
%\changes{4.16}{2015-07-08}{new}
% Tests if the value of the given field is equal to the replacement
% text of the given command.
%    \begin{macrocode}
\newcommand{\ifglsfielddefeq}[5]{%
 \glsdoifexists{#1}%
 {%
   \protected@edef\@glo@label{\glsdetoklabel{#1}}%
   \ifcsdef{glo@\@glo@label @#2}%
   {%
      \expandafter\ifdefstrequal
       \csname glo@\@glo@label @#2\endcsname{#3}{#4}{#5}%
   }%
   {%
      \PackageError{glossaries}{Key `#2' doesn't exist}{}%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ifglsfieldcseq}
%\begin{definition}
%\cs{ifglsfieldcseq}\marg{label}\marg{field}\marg{cs name}\marg{true}\marg{false}
%\end{definition}
%\changes{4.16}{2015-07-08}{new}
%As above but uses \cs{ifcsstrequal} instead of \cs{ifdefstrequal}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
\newcommand{\ifglsfieldcseq}[5]{%
 \glsdoifexists{#1}%
 {%
   \protected@edef\@glo@label{\glsdetoklabel{#1}}%
   \ifcsdef{glo@\@glo@label @#2}%
   {%
      \ifcsstrequal{glo@\@glo@label @#2}{#3}{#4}{#5}%
   }%
   {%
      \PackageError{glossaries}{Key `#2' doesn't exist}{}%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glswritedefhook}
%\changes{3.10a}{2013-10-13}{new}
%    \begin{macrocode}
\newcommand*{\glswritedefhook}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\gls@assign@desc}
%\changes{3.11a}{2013-10-15}{new}
%    \begin{macrocode}
\newcommand*{\gls@assign@desc}[1]{%
  \gls@assign@field{}{#1}{desc}{\@glo@desc}%
  \gls@assign@field{\@glo@desc}{#1}{descplural}{\@glo@descplural}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\longnewglossaryentry}
%\changes{3.11a}{2013-10-15}{new}
%    \begin{macrocode}
\newcommand{\longnewglossaryentry}[3]{%
  \glsdoifnoexists{#1}%
  {%
     \bgroup
       \let\@org@newglossaryentryprehook\@newglossaryentryprehook
       \long\def\@newglossaryentryprehook{%
         \long\def\@glo@desc{#3\leavevmode\unskip\nopostdesc}%
         \@org@newglossaryentryprehook
       }%
       \renewcommand*{\gls@assign@desc}[1]{%
          \global\cslet{glo@\glsdetoklabel{#1}@desc}{\@glo@desc}%
          \global\cslet{glo@\glsdetoklabel{#1}@descplural}{\@glo@desc}%
        }
       \gls@defglossaryentry{#1}{#2}%
     \egroup
  }
}
%    \end{macrocode}
% Only allowed in the preamble. (Otherwise a long description could
% cause problems when writing the entry definition to the temporary
% file.)
%    \begin{macrocode}
\@onlypreamble{\longnewglossaryentry}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\longprovideglossaryentry}
%\changes{3.14a}{2013-11-12}{new}
% As the above but only defines the entry if it doesn't already
% exist.
%    \begin{macrocode}
\newcommand{\longprovideglossaryentry}[3]{%
  \ifglsentryexists{#1}{}%
  {\longnewglossaryentry{#1}{#2}{#3}}%
}
\@onlypreamble{\longprovideglossaryentry}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@defglossaryentry}
%\begin{definition}
%\cs{gls@defglossaryentry}\marg{label}\marg{key-val list}
%\end{definition}
% Defines a new entry without checking if it already exists.
%\changes{3.10a}{2013-10-13}{new}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand{\gls@defglossaryentry}[2]{%
%    \end{macrocode}
% Prevent any further use of \cs{GlsSetQuote}:
%    \begin{macrocode}
  \let\GlsSetQuote\gls@nosetquote
%    \end{macrocode}
% Store label
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
  \protected@edef\@glo@label{\glsdetoklabel{#1}}%
%    \end{macrocode}
% \changes{3.12a}{2013-10-16}{added \cs{glslabel}}
% Provide a means for user defined keys to reference the label:
%    \begin{macrocode}
  \let\glslabel\@glo@label
%    \end{macrocode}
% Set up defaults. If the \gloskey{name} or \gloskey{description}
% keys are omitted, an error will be generated.
%    \begin{macrocode}
  \let\@glo@name\@glsnoname
  \let\@glo@desc\@glsnodesc
%    \end{macrocode}
% \changes{1.12}{2008-03-08}{descriptionplural support added}
%    \begin{macrocode}
  \let\@glo@descplural\@gls@default@value
%    \end{macrocode}
%    \begin{macrocode}
  \let\@glo@type\@gls@default@value
  \let\@glo@symbol\@gls@default@value
%    \end{macrocode}
% \changes{1.12}{2008-03-08}{symbolplural support added}
%    \begin{macrocode}
  \let\@glo@symbolplural\@gls@default@value
%    \end{macrocode}
%    \begin{macrocode}
  \let\@glo@text\@gls@default@value
%    \end{macrocode}
%    \begin{macrocode}
  \let\@glo@plural\@gls@default@value
%    \end{macrocode}
% \changes{1.13}{2008-05-10}{Changed default first value}
% Using \cs{let} instead of \cs{def} to make later comparison
% avoid expansion issues. (Thanks to Ulrich~Diez for suggesting
% this.)
% \changes{1.16}{2008-08-27}{Changed def to let}
%\changes{3.10a}{2013-10-13}{Changed to using \cs{@gls@default@value}}
%    \begin{macrocode}
  \let\@glo@first\@gls@default@value
%    \end{macrocode}
% \changes{1.12}{2008-03-08}{Changed default first plural to be first
% key with s appended (was text key with s appended)}
% \changes{1.13}{2008-05-10}{Changed default firstplural value}
%    \begin{macrocode}
  \let\@glo@firstplural\@gls@default@value
%    \end{macrocode}
% Set the default sort:
%\changes{3.10a}{2013-10-13}{Changed to using \cs{@gls@default@value}}
%\changes{1.05}{2007-08-10}{Changed the default value of the sort
% key to just the value of the name key}%
%\changes{1.18}{2009-01-14}{Changed default value of sort
% to \cs{@glsdefaultsort}}
%    \begin{macrocode}
  \let\@glo@sort\@gls@default@value
%    \end{macrocode}
% Set the default counter:
%    \begin{macrocode}
  \let\@glo@counter\@gls@default@value
%    \end{macrocode}
%\changes{1.17}{2008-12-26}{added see key}
%    \begin{macrocode}
  \def\@glo@see{}%
%    \end{macrocode}
%\changes{1.17}{2008-12-26}{added parent key}
%    \begin{macrocode}
  \def\@glo@parent{}%
%    \end{macrocode}
%\changes{1.17}{2008-12-26}{added nonumberlist key}
%    \begin{macrocode}
  \def\@glo@prefix{}%
%    \end{macrocode}
% Initialise nonumberlist setting if we're in the \env{document}
% environment.
%    \begin{macrocode}
  \@gls@initnonumberlist
%    \end{macrocode}
%\changes{2.04}{2009-11-10}{added user1-6 keys}
%    \begin{macrocode}
  \def\@glo@useri{}%
  \def\@glo@userii{}%
  \def\@glo@useriii{}%
  \def\@glo@useriv{}%
  \def\@glo@userv{}%
  \def\@glo@uservi{}%
%    \end{macrocode}
%\changes{3.0}{2011-04-02}{added short and long keys}
%    \begin{macrocode}
  \def\@glo@short{}%
  \def\@glo@shortpl{}%
  \def\@glo@long{}%
  \def\@glo@longpl{}%
%    \end{macrocode}
% Add start hook in case another package wants to add extra keys.
%    \begin{macrocode}
  \@newglossaryentryprehook
%    \end{macrocode}
% Extract key-val information from third parameter:
%    \begin{macrocode}
  \setkeys{glossentry}{#2}%
%    \end{macrocode}
%\changes{3.14a}{2013-11-12}{added check for existence of default glossary}
% Check there is a default glossary. 
%    \begin{macrocode}
  \ifundef\glsdefaulttype
  {%
     \PackageError{glossaries}%
     {No default glossary type (have you used `nomain' by mistake?)}%
     {If you use package option `nomain' you must define
      a new glossary before you can define entries}%
  }%
  {}%
%    \end{macrocode}
% Assign type. This must be fully expandable
%\changes{4.03}{2014-01-20}{replaced \#1 with \cs{@glo@label}}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
  \gls@assign@field{\glsdefaulttype}{\@glo@label}{type}{\@glo@type}%
  \protected@edef\@glo@type{\glsentrytype{\@glo@label}}%
%    \end{macrocode}
% Check to see if this glossary type has been defined, if it has,
% add this label to the relevant list, otherwise generate an error.
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%    \begin{macrocode}
  \ifcsundef{glolist@\@glo@type}%
  {%
      \PackageError{glossaries}%
      {Glossary type `\@glo@type' has not been defined}%
      {You need to define a new glossary type, before making entries
       in it}%
  }%
  {%
%    \end{macrocode}
%\changes{4.08}{2014-07-30}{added check for ignored glossary}
% Check if it's an ignored glossary
%    \begin{macrocode}
    \ifignoredglossary\@glo@type
      {%
%    \end{macrocode}
% The description may be omitted for an entry in an ignored
% glossary.
%    \begin{macrocode}
      \ifx\@glo@desc\@glsnodesc
        \let\@glo@desc\@empty
      \fi
    }%
    {%
    }%
    \protected@edef\@glolist@{\csname glolist@\@glo@type\endcsname}%
%    \end{macrocode}
%\changes{1.46}{2021-09-20}{changed \cs{xdef} to \cs{protected@xdef}}
%    \begin{macrocode}
    \expandafter\protected@xdef\csname glolist@\@glo@type\endcsname{%
      \@glolist@{\@glo@label},}%
  }%
%    \end{macrocode}
% Initialise level to 0.
%    \begin{macrocode}
  \gls@level=0\relax
%    \end{macrocode}
% Has this entry been assigned a parent?
%    \begin{macrocode}
  \ifx\@glo@parent\@empty
%    \end{macrocode}
% Doesn't have a parent. Set \cs{glo@}\meta{label}"@parent" to
% empty.
%    \begin{macrocode}
    \expandafter\gdef\csname glo@\@glo@label @parent\endcsname{}%
  \else
%    \end{macrocode}
% Has a parent. Check to ensure this entry isn't its own parent.
%\changes{4.03}{2014-01-20}{replaced \cs{ifthenelse} with
%\cs{ifdefequal}}
%    \begin{macrocode}
    \ifdefequal\@glo@label\@glo@parent%
    {%
      \PackageError{glossaries}{Entry `\@glo@label' can't be its own parent}{}%
      \def\@glo@parent{}%
      \expandafter\gdef\csname glo@\@glo@label @parent\endcsname{}%
    }%
    {%
%    \end{macrocode}
% Check the parent exists:
%    \begin{macrocode}
      \ifglsentryexists{\@glo@parent}%
      {%
%    \end{macrocode}
% Parent exists. Set \cs{glo@}\meta{label}"@parent".
%\changes{1.46}{2021-09-20}{changed \cs{xdef} to \cs{protected@xdef}}
%    \begin{macrocode}
        \expandafter\protected@xdef\csname glo@\@glo@label @parent\endcsname{%
           \@glo@parent}%
%    \end{macrocode}
% Determine level.
%    \begin{macrocode}
        \gls@level=\csname glo@\@glo@parent @level\endcsname\relax
        \advance\gls@level by 1\relax
%    \end{macrocode}
% If name hasn't been specified, use same as the parent name
%    \begin{macrocode}
        \ifx\@glo@name\@glsnoname
          \expandafter\let\expandafter\@glo@name
           \csname glo@\@glo@parent @name\endcsname
%    \end{macrocode}
% If name and plural haven't been specified, use same as the parent
%    \begin{macrocode}
          \ifx\@glo@plural\@gls@default@value
            \expandafter\let\expandafter\@glo@plural
               \csname glo@\@glo@parent @plural\endcsname
          \fi
        \fi
      }%
      {%
%    \end{macrocode}
% Parent doesn't exist, so issue an error message and change this
% entry to have no parent
%    \begin{macrocode}
        \PackageError{glossaries}%
        {%
          Invalid parent `\@glo@parent'
          for entry `\@glo@label' - parent doesn't exist%
        }%
        {%
          Parent entries must be defined before their children%
        }%
        \def\@glo@parent{}%
        \expandafter\gdef\csname glo@\@glo@label @parent\endcsname{}%
      }%
    }%
  \fi
%    \end{macrocode}
% Set the level for this entry
%    \begin{macrocode}
  \expandafter\xdef\csname glo@\@glo@label @level\endcsname{\number\gls@level}%
%    \end{macrocode}
% Define commands associated with this entry:
%    \begin{macrocode}
  \gls@assign@field{\@glo@name}{\@glo@label}{sortvalue}{\@glo@sort}%
  \letcs\@glo@sort{glo@\@glo@label @sortvalue}%
  \gls@assign@field{\@glo@name}{\@glo@label}{text}{\@glo@text}%
  \expandafter\gls@assign@field\expandafter
     {\csname glo@\@glo@label @text\endcsname\glspluralsuffix}%
     {\@glo@label}{plural}{\@glo@plural}%
  \expandafter\gls@assign@field\expandafter
     {\csname glo@\@glo@label @text\endcsname}%
     {\@glo@label}{first}{\@glo@first}%
%    \end{macrocode}
%\changes{3.14a}{2013-11-12}{set the default for firstplural to be the value
%of plural}
%\changes{4.0}{2013-11-14}{added check for first key}
% If \gloskey{first} has been specified, make the default by appending
% \cs{glspluralsuffix}, otherwise make the default the value of the 
% \gloskey{plural} key.
%    \begin{macrocode}
  \ifx\@glo@first\@gls@default@value
    \expandafter\gls@assign@field\expandafter
       {\csname glo@\@glo@label @plural\endcsname}%
       {\@glo@label}{firstpl}{\@glo@firstplural}%
  \else
    \expandafter\gls@assign@field\expandafter
       {\csname glo@\@glo@label @first\endcsname\glspluralsuffix}%
       {\@glo@label}{firstpl}{\@glo@firstplural}%
  \fi
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{Fixed default counter if none supplied}
%    \begin{macrocode}
  \ifcsundef{@glotype@\@glo@type @counter}%
  {%
    \def\@glo@defaultcounter{\glscounter}%
  }%
  {%
    \letcs\@glo@defaultcounter{@glotype@\@glo@type @counter}%
  }%
  \gls@assign@field{\@glo@defaultcounter}{\@glo@label}{counter}{\@glo@counter}%
  \gls@assign@field{}{\@glo@label}{useri}{\@glo@useri}%
  \gls@assign@field{}{\@glo@label}{userii}{\@glo@userii}%
  \gls@assign@field{}{\@glo@label}{useriii}{\@glo@useriii}%
  \gls@assign@field{}{\@glo@label}{useriv}{\@glo@useriv}%
  \gls@assign@field{}{\@glo@label}{userv}{\@glo@userv}%
  \gls@assign@field{}{\@glo@label}{uservi}{\@glo@uservi}%
  \gls@assign@field{}{\@glo@label}{short}{\@glo@short}%
  \gls@assign@field{}{\@glo@label}{shortpl}{\@glo@shortpl}%
  \gls@assign@field{}{\@glo@label}{long}{\@glo@long}%
  \gls@assign@field{}{\@glo@label}{longpl}{\@glo@longpl}%
  \ifx\@glo@name\@glsnoname
    \@glsnoname
    \let\@gloname\@gls@default@value
  \fi
  \gls@assign@field{}{\@glo@label}{name}{\@glo@name}%
%    \end{macrocode}
%\changes{3.02}{2012-05-21}{added numberlist element}
% Set default numberlist if not defined:
%    \begin{macrocode}
  \ifcsundef{glo@\@glo@label @numberlist}%
  {%
    \csxdef{glo@\@glo@label @numberlist}{%
       \noexpand\@gls@missingnumberlist{\@glo@label}}%
  }%
  {}%
%    \end{macrocode}
% Store nonumberlist setting if we're in the \env{document}
% environment.
%    \begin{macrocode}
  \@gls@storenonumberlist{\@glo@label}%
%    \end{macrocode}
% The smaller and smallcaps options set the description to 
% \cs{@glo@first}. Need to check for this, otherwise it won't get
% expanded if the description gets sanitized.
%\changes{1.15}{2008-08-15}{check for \cs{@glo@first} in description}%
%    \begin{macrocode}
  \def\@glo@@desc{\@glo@first}%
  \ifx\@glo@desc\@glo@@desc
    \let\@glo@desc\@glo@first
  \fi
  \ifx\@glo@desc\@glsnodesc
    \@glsnodesc
    \let\@glodesc\@gls@default@value
  \fi
  \gls@assign@desc{\@glo@label}%
%    \end{macrocode}
%\changes{1.18}{2009-01-14}{moved sort sanitization to
% \cs{newglossaryentry}}
%\changes{3.0}{2011-04-02}{added \cs{@gls@defsort}}
% Set the sort key for this entry:
%    \begin{macrocode}
  \@gls@defsort{\@glo@type}{\@glo@label}%
%    \end{macrocode}
%\changes{1.15}{2008-08-15}{check for \cs{@glo@text} in symbol}%
%    \begin{macrocode}
  \def\@glo@@symbol{\@glo@text}%
  \ifx\@glo@symbol\@glo@@symbol
    \let\@glo@symbol\@glo@text
  \fi
  \gls@assign@field{\relax}{\@glo@label}{symbol}{\@glo@symbol}%
  \expandafter
    \gls@assign@field\expandafter
    {\csname glo@\@glo@label @symbol\endcsname}
    {\@glo@label}{symbolplural}{\@glo@symbolplural}%
%    \end{macrocode}
% Define an associated boolean variable to determine whether this
% entry has been used yet (needs to be defined globally):
%\changes{1.46}{2021-09-20}{changed \cs{xdef} to \cs{protected@xdef}}
%    \begin{macrocode}
  \expandafter\protected@xdef\csname glo@\@glo@label @flagfalse\endcsname{%
    \noexpand\global
      \noexpand\let\expandafter\noexpand
        \csname ifglo@\@glo@label @flag\endcsname\noexpand\iffalse
  }%
  \expandafter\protected@xdef\csname glo@\@glo@label @flagtrue\endcsname{%
    \noexpand\global
      \noexpand\let\expandafter\noexpand
        \csname ifglo@\@glo@label @flag\endcsname\noexpand\iftrue
  }%
  \csname glo@\@glo@label @flagfalse\endcsname
%    \end{macrocode}
% Sort out any cross-referencing if required.
%\changes{4.04}{2014-03-06}{replaced \cs{ifx} with \cs{ifdefvoid}}
%    \begin{macrocode}
  \@glo@autosee
%    \end{macrocode}
% Determine and store main part of the entry's index format.
%\changes{1.17}{2008-12-26}{Stored main part of entry 
% format when entry
% is defined}%
%    \begin{macrocode}
  \ifignoredglossary\@glo@type
  {%
    \csdef{glo@\@glo@label @index}{}%
  }
  {%
    \do@glo@storeentry{\@glo@label}%
  }%
%    \end{macrocode}
% Define entry counters if enabled:
%    \begin{macrocode}
  \@newglossaryentry@defcounters
%    \end{macrocode}
% Add end hook in case another package wants to add extra keys.
%    \begin{macrocode}
  \@newglossaryentryposthook
}
%    \end{macrocode}
%\changes{1.13}{2008-05-10}{Removed restriction on only using
% \cs{newglossaryentry} in the preamble}
%\end{macro}
%
%\begin{macro}{\@glo@autosee}
%\changes{4.30}{2017-06-11}{new}
%Automatically implement \cs{glssee}.
%    \begin{macrocode}
\newcommand*{\@glo@autosee}{%
  \ifdefvoid\@glo@see{}%
  {%
    \protected@edef\@do@glssee{%
      \noexpand\@gls@fixbraces\noexpand\@glo@list\@glo@see\noexpand\@nil
      \noexpand\expandafter\noexpand\@glssee\noexpand\@glo@list{\@glo@label}}%
    \@do@glssee
  }%
  \@glo@autoseehook
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glo@autoseehook}
%\changes{4.30}{2017-06-11}{new}
%    \begin{macrocode}
\newcommand*{\@glo@autoseehook}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@newglossaryentryprehook}
% Allow extra information to be added to glossary entries:
%\changes{2.04}{2009-11-10}{new}
%    \begin{macrocode}
\newcommand*{\@newglossaryentryprehook}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@newglossaryentryposthook}
% Allow extra information to be added to glossary entries:
%\changes{2.04}{2009-11-10}{new}
%    \begin{macrocode}
\newcommand*{\@newglossaryentryposthook}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@newglossaryentry@defcounters}
%\changes{4.14}{2015-02-28}{new}
%    \begin{macrocode}
\newcommand*{\@newglossaryentry@defcounters}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsmoveentry}
%\changes{3.02}{2012-05-21}{new}
% Moves entry whose label is given by first argument to the glossary
% named in the second argument.
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
\newcommand*{\glsmoveentry}[2]{%
  \protected@edef\@glo@thislabel{\glsdetoklabel{#1}}%
  \protected@edef\glo@type{\csname glo@\@glo@thislabel @type\endcsname}%
  \def\glo@list{,}%
  \forglsentries[\glo@type]{\glo@label}%
   {%
%    \end{macrocode}
%\changes{4.03}{2014-01-20}{replaced \cs{ifthenelse} with
%\cs{ifdefequal}}
%    \begin{macrocode}
     \ifdefequal\@glo@thislabel\glo@label
       {}{\protected@eappto\glo@list{\glo@label,}}%
   }%
  \cslet{glolist@\glo@type}{\glo@list}%
  \csdef{glo@\@glo@thislabel @type}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glossaryentryfield}
% Indicate what command should be used to display each entry in
% the glossary. (This enables the \sty{glossaries-accsupp} package
% to use \cs{accsuppglossaryentryfield} instead.)
%\changes{2.04}{2009-11-10}{new}
%\changes{3.08a}{2013-09-28}{switched to \cs{glossentry}}
%    \begin{macrocode}
\ifglsxindy
  \newcommand*{\@glossaryentryfield}{\string\\glossentry}
\else
  \newcommand*{\@glossaryentryfield}{\string\glossentry}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glossarysubentryfield}
% Indicate what command should be used to display each subentry in
% the glossary. (This enables the \sty{glossaries-accsupp} package
% to use \cs{accsuppglossarysubentryfield} instead.)
%\changes{2.04}{2009-11-10}{new}
%\changes{3.08a}{2013-09-28}{switched to \cs{subglossentry}}
%    \begin{macrocode}
\ifglsxindy
  \newcommand*{\@glossarysubentryfield}{%
    \string\\subglossentry}
\else
  \newcommand*{\@glossarysubentryfield}{%
    \string\subglossentry}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glo@storeentry}
%\begin{definition}
%\cs{@glo@storeentry}\marg{label}
%\end{definition}
%\changes{1.17}{2008-12-26}{new}
% Determine the format to write the entry in the glossary 
% output (\filetype{.glo}) file.
% The argument is the entry's label (should already have been
% de-tok'ed if required).
% The result is stored in \cs{glo@}\meta{label}"@index", where
% \meta{label} is the entry's label. (This doesn't include
% any formatting or location information.)
%    \begin{macrocode}
\newcommand{\@glo@storeentry}[1]{%
%    \end{macrocode}
% Escape makeindex/xindy special characters in the label:
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
  \protected@edef\@glo@esclabel{#1}%
  \@gls@checkmkidxchars\@glo@esclabel
%    \end{macrocode}
% Get the sort string and escape any special characters
%    \begin{macrocode}
  \protected@edef\@glo@sort{\csname glo@#1@sort\endcsname}%
  \@gls@checkmkidxchars\@glo@sort
%    \end{macrocode}
% Same again for the name string.
%\changes{3.08a}{2013-09-28}{no longer need to check for special characters
%in any of the fields other than sort}
% Escape any special characters in the prefix
%    \begin{macrocode}
  \@gls@checkmkidxchars\@glo@prefix
%    \end{macrocode}
% Get the parent, if one exists
%    \begin{macrocode}
  \protected@edef\@glo@parent{\csname glo@#1@parent\endcsname}%
%    \end{macrocode}
% Write the information to the glossary file.
%    \begin{macrocode}
  \ifglsxindy
%    \end{macrocode}
% Store using \app{xindy} syntax.
%    \begin{macrocode}
    \ifx\@glo@parent\@empty
%    \end{macrocode}
% Entry doesn't have a parent
%\changes{3.08a}{2013-09-28}{updated for \cs{glossentry}}
%    \begin{macrocode}
      \expandafter\protected@xdef\csname glo@#1@index\endcsname{%
       (\string"\@glo@sort\string" %
       \string"\@glo@prefix\@glossaryentryfield{\@glo@esclabel}\string") %
      }%
    \else
%    \end{macrocode}
% Entry has a parent
%    \begin{macrocode}
      \expandafter\protected@xdef\csname glo@#1@index\endcsname{%
        \csname glo@\@glo@parent @index\endcsname
        (\string"\@glo@sort\string" %
        \string"\@glo@prefix\@glossarysubentryfield
           {\csname glo@#1@level\endcsname}{\@glo@esclabel}\string") %
       }%
    \fi
  \else
%    \end{macrocode}
% Store using \app{makeindex} syntax.
%    \begin{macrocode}
    \ifx\@glo@parent\@empty
%    \end{macrocode}
% Sanitize \cs{@glo@prefix}
%    \begin{macrocode}
      \@onelevel@sanitize\@glo@prefix
%    \end{macrocode}
% Entry doesn't have a parent
%    \begin{macrocode}
      \expandafter\protected@xdef\csname glo@#1@index\endcsname{%
        \@glo@sort\@gls@actualchar\@glo@prefix
        \@glossaryentryfield{\@glo@esclabel}%
      }%
    \else
%    \end{macrocode}
% Entry has a parent
%    \begin{macrocode}
      \expandafter\protected@xdef\csname glo@#1@index\endcsname{%
        \csname glo@\@glo@parent @index\endcsname\@gls@levelchar
        \@glo@sort\@gls@actualchar\@glo@prefix
        \@glossarysubentryfield
          {\csname glo@#1@level\endcsname}{\@glo@esclabel}%
      }%
    \fi
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\section{Resetting and unsetting entry flags}
% Each glossary entry is assigned a conditional of the form
%\cs{ifglo@}\meta{label}\texttt{@flag} which determines
% whether or not the entry has been used (see also 
% \ics{ifglsused} defined below). These flags can
% be set and unset using the following macros, but first we need to
% know if we're in \sty{amsmath}'s \env{align} environment's
% measuring pass.
%
%\begin{macro}{\gls@ifnotmeasuring}
%\changes{3.08a}{2013-09-28}{new}
%    \begin{macrocode}
\AtBeginDocument{%
  \@ifpackageloaded{amsmath}%
  {\let\gls@ifnotmeasuring\@gls@ifnotmeasuring}%
  {}%
}
\newcommand*{\@gls@ifnotmeasuring}[1]{%
  \ifmeasuring@
  \else
    #1%
  \fi
}
\newcommand*\gls@ifnotmeasuring[1]{#1}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glspatchtabularx}
%\changes{4.28}{2017-01-07}{new}
%Patch \cs{TX@trial} (as per David Carlisle's answer in
%\url{http://tex.stackexchange.com/a/94895}). This does nothing
%if \cs{TX@trial} hasn't been defined.
%    \begin{macrocode}
\def\@gls@patchtabularx#1\hbox#2#3!!{%
  \def\TX@trial##1{#1\hbox{\let\glsunset\@gobble#2}#3}%
}
\newcommand*\glspatchtabularx{%
 \ifdef\TX@trial
 {%
   \expandafter\@gls@patchtabularx\TX@trial{##1}!!%
   \let\glspatchtabularx\relax
 }%
 {}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsreset}
% The command \cs{glsreset}\marg{label} can be used
% to set the entry flag to indicate that it hasn't been used yet. The
% required argument is the entry label.
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.14}{2015-02-28}{switched to \cs{@glsreset}}
%    \begin{macrocode}
\newcommand*{\glsreset}[1]{%
  \gls@ifnotmeasuring
  {%
    \glsdoifexists{#1}%
    {%
       \@glsreset{#1}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glslocalreset}
% As above, but with only a local effect:
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.14}{2015-02-28}{switched to \cs{@glslocalreset}}
%    \begin{macrocode}
\newcommand*{\glslocalreset}[1]{%
  \gls@ifnotmeasuring
  {%
    \glsdoifexists{#1}%
    {%
       \@glslocalreset{#1}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsunset}
% The command \cs{glsunset}\marg{label} can be used to
% set the entry flag to indicate that it has been used. The required
% argument is the entry label.
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.14}{2015-02-28}{switched to \cs{@glsunset}}
%    \begin{macrocode}
\newcommand*{\glsunset}[1]{%
  \gls@ifnotmeasuring
  {%
    \glsdoifexists{#1}%
    {%
      \@glsunset{#1}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glslocalunset}
% As above, but with only a local effect:
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.14}{2015-02-28}{switched to \cs{@glslocalunset}}
%    \begin{macrocode}
\newcommand*{\glslocalunset}[1]{%
  \gls@ifnotmeasuring
  {%
    \glsdoifexists{#1}%
    {%
      \@glslocalunset{#1}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glslocalunset}
% Local unset. This defaults to just \cs{@@glslocalunset} but is changed
% by \cs{glsenableentrycount}.
%\changes{4.14}{2015-02-28}{new}
%    \begin{macrocode}
\newcommand*{\@glslocalunset}{\@@glslocalunset}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@glslocalunset}
%\changes{4.14}{2015-02-28}{new}
% Local unset without checks.
%    \begin{macrocode}
\newcommand*{\@@glslocalunset}[1]{%
   \expandafter\let\csname ifglo@\glsdetoklabel{#1}@flag\endcsname\iftrue
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsunset}
% Global unset. This defaults to just \cs{@@glsunset} but is changed
% by \cs{glsenableentrycount}.
%\changes{4.14}{2015-02-28}{new}
%    \begin{macrocode}
\newcommand*{\@glsunset}{\@@glsunset}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@glsunset}
%\changes{4.14}{2015-02-28}{new}
% Global unset without checks.
%    \begin{macrocode}
\newcommand*{\@@glsunset}[1]{%
  \expandafter\global\csname glo@\glsdetoklabel{#1}@flagtrue\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glslocalreset}
% Local reset. This defaults to just \cs{@@glslocalreset} but is changed
% by \cs{glsenableentrycount}.
%\changes{4.14}{2015-02-28}{new}
%    \begin{macrocode}
\newcommand*{\@glslocalreset}{\@@glslocalreset}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@glslocalreset}
%\changes{4.14}{2015-02-28}{new}
% Local reset without checks.
%    \begin{macrocode}
\newcommand*{\@@glslocalreset}[1]{%
   \expandafter\let\csname ifglo@\glsdetoklabel{#1}@flag\endcsname\iffalse
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsreset}
% Global reset. This defaults to just \cs{@@glsreset} but is changed
% by \cs{glsenableentrycount}.
%\changes{4.14}{2015-02-28}{new}
%    \begin{macrocode}
\newcommand*{\@glsreset}{\@@glsreset}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@glsreset}
%\changes{4.14}{2015-02-28}{new}
% Global reset without checks.
%    \begin{macrocode}
\newcommand*{\@@glsreset}[1]{%
  \expandafter\global\csname glo@\glsdetoklabel{#1}@flagfalse\endcsname
}
%    \end{macrocode}
%\end{macro}
%
% Reset all entries for the named glossaries (supplied in a 
% comma-separated list). 
% Syntax: \cs{glsresetall}\oarg{glossary-list}
%\begin{macro}{\glsresetall}
%    \begin{macrocode}
\newcommand*{\glsresetall}[1][\@glo@types]{%
  \forallglsentries[#1]{\@glsentry}%
  {%
     \glsreset{\@glsentry}%
  }%
}
%    \end{macrocode}
%\end{macro}
% As above, but with only a local effect:
%\begin{macro}{\glslocalresetall}
%    \begin{macrocode}
\newcommand*{\glslocalresetall}[1][\@glo@types]{%
  \forallglsentries[#1]{\@glsentry}%
  {%
    \glslocalreset{\@glsentry}%
  }%
}
%    \end{macrocode}
%\end{macro}
% Unset all entries for the named glossaries (supplied in a 
% comma-separated list). 
% Syntax: \cs{glsunsetall}\oarg{glossary-list}
%\begin{macro}{\glsunsetall}
%    \begin{macrocode}
\newcommand*{\glsunsetall}[1][\@glo@types]{%
  \forallglsentries[#1]{\@glsentry}%
  {%
    \glsunset{\@glsentry}%
  }%
}
%    \end{macrocode}
%\end{macro}
% As above, but with only a local effect:
%\begin{macro}{\glslocalunsetall}
%    \begin{macrocode}
\newcommand*{\glslocalunsetall}[1][\@glo@types]{%
  \forallglsentries[#1]{\@glsentry}%
  {%
    \glslocalunset{\@glsentry}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\section{Keeping Track of How Many Times an Entry Has Been Unset}
%Version 4.14 introduced \cs{glsenableentrycount} that keeps track
%of how many times an entry is marked as used. The counter is reset
%back to zero when the first use flag is reset. Note that although
%the word ``counter'' is used here, it's not an actual \LaTeX\
%counter or even an explicit \TeX\ count register but is just a
%macro. Any of the commands that use \cs{glsunset} or
%\cs{glslocalunset}, such as \cs{gls}, will automatically increment this value.
%Commands that don't modify the first use flag (such as \cs{glstext}
%or \cs{glsentrytext}) don't modify this value.
%
%\begin{macro}{\@@newglossaryentry@defcounters}
%\changes{4.14}{2015-02-28}{new}
% Define entry fields to keep track of how many times that entry has
% been marked as used.
%    \begin{macrocode}
\newcommand*{\@@newglossaryentry@defcounters}{%
  \csdef{glo@\@glo@label @currcount}{0}%
  \csdef{glo@\@glo@label @prevcount}{0}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsenableentrycount}
%\changes{4.14}{2015-02-28}{new}
% Enables tracking of how many times an entry has been marked as
% used.
%    \begin{macrocode}
\newcommand*{\glsenableentrycount}{%
%    \end{macrocode}
% Enable new entry fields.
%    \begin{macrocode}
  \let\@newglossaryentry@defcounters\@@newglossaryentry@defcounters
%    \end{macrocode}
% Disable \cs{newglossaryentry} in the \env{document} environment.
%    \begin{macrocode}
  \renewcommand*{\gls@defdocnewglossaryentry}{%
    \renewcommand*\newglossaryentry[2]{%
      \PackageError{glossaries}{\string\newglossaryentry\space
      may only be used in the preamble when entry counting has
      been activated}{If you use \string\glsenableentrycount\space
      you must place all entry definitions in the preamble not in
      the document environment}%
    }%
  }%
%    \end{macrocode}
% Define commands \ics{glsentrycurrcount} and \ics{glsentryprevcount} to
% access these new fields. Default to zero if undefined.
%    \begin{macrocode}
  \newcommand*{\glsentrycurrcount}[1]{%
   \ifcsundef{glo@\glsdetoklabel{##1}@currcount}%
   {0}{\@gls@entry@field{##1}{currcount}}%
  }%
  \newcommand*{\glsentryprevcount}[1]{%
   \ifcsundef{glo@\glsdetoklabel{##1}@prevcount}%
   {0}{\@gls@entry@field{##1}{prevcount}}%
  }%
%    \end{macrocode}
% Make the unset and reset functions also increment or reset the
% entry counter.
%    \begin{macrocode}
  \renewcommand*{\@glsunset}[1]{%
    \@@glsunset{##1}%
    \@gls@increment@currcount{##1}%
  }%
  \renewcommand*{\@glslocalunset}[1]{%
    \@@glslocalunset{##1}%
    \@gls@local@increment@currcount{##1}%
  }%
  \renewcommand*{\@glsreset}[1]{%
    \@@glsreset{##1}%
    \csgdef{glo@\glsdetoklabel{##1}@currcount}{0}%
  }%
  \renewcommand*{\@glslocalreset}[1]{%
    \@@glslocalreset{##1}%
    \csdef{glo@\glsdetoklabel{##1}@currcount}{0}%
  }%
%    \end{macrocode}
% Alter behaviour of \cs{cgls}. (Only global unset is used if
% previous count was one as it doesn't make sense to have a~local
% unset here given that the previous count was global.)
%    \begin{macrocode}
 \def\@cgls@##1##2[##3]{%
   \ifnum\glsentryprevcount{##2}=1\relax
     \cglsformat{##2}{##3}%
     \glsunset{##2}%
   \else
     \@gls@{##1}{##2}[##3]%
   \fi
 }%
%    \end{macrocode}
% Similarly for the analogous commands. No case change plural:
%    \begin{macrocode}
 \def\@cglspl@##1##2[##3]{%
   \ifnum\glsentryprevcount{##2}=1\relax
     \cglsplformat{##2}{##3}%
     \glsunset{##2}%
   \else
     \@glspl@{##1}{##2}[##3]%
   \fi
 }%
%    \end{macrocode}
% First letter uppercase singular:
%    \begin{macrocode}
 \def\@cGls@##1##2[##3]{%
   \ifnum\glsentryprevcount{##2}=1\relax
     \cGlsformat{##2}{##3}%
     \glsunset{##2}%
   \else
     \@Gls@{##1}{##2}[##3]%
   \fi
 }%
%    \end{macrocode}
% First letter uppercase plural:
%    \begin{macrocode}
 \def\@cGlspl@##1##2[##3]{%
   \ifnum\glsentryprevcount{##2}=1\relax
     \cGlsplformat{##2}{##3}%
     \glsunset{##2}%
   \else
     \@Glspl@{##1}{##2}[##3]%
   \fi
 }%
%    \end{macrocode}
% Write information to aux file at the end of the document
%    \begin{macrocode}
  \AtEndDocument{\@gls@write@entrycounts}%
%    \end{macrocode}
% Fetch previous count information from aux file. (No check here to
% determine if the entry is still defined.)
%    \begin{macrocode}
  \renewcommand*{\@gls@entry@count}[2]{%
    \csgdef{glo@\glsdetoklabel{##1}@prevcount}{##2}%
  }%
%    \end{macrocode}
% \cs{glsenableentrycount} may only be used once and only in the
% preamble.
%    \begin{macrocode}
  \let\glsenableentrycount\relax
}
\@onlypreamble\glsenableentrycount
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@increment@currcount}
%\changes{4.14}{2015-02-28}{new}
%    \begin{macrocode}
\newcommand*{\@gls@increment@currcount}[1]{%
  \csxdef{glo@\glsdetoklabel{#1}@currcount}{%
   \number\numexpr\glsentrycurrcount{#1}+1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@local@increment@currcount}
%\changes{4.14}{2015-02-28}{new}
%    \begin{macrocode}
\newcommand*{\@gls@local@increment@currcount}[1]{%
  \csedef{glo@\glsdetoklabel{#1}@currcount}{%
   \number\numexpr\glsentrycurrcount{#1}+1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@write@entrycounts}
%\changes{4.14}{2015-02-28}{new}
% Write the entry counts to the aux file. Use \cs{immediate} since
% this occurs right at the end of the document. Only write
% information for entries that have been used. (Some users have a
% file containing vast numbers of entries, many of which may not be
% used. There's no point writing information about the entries that
% haven't been used and it will only slow things down.)
%    \begin{macrocode}
\newcommand*{\@gls@write@entrycounts}{%
  \immediate\write\@auxout
    {\string\providecommand*{\string\@gls@entry@count}[2]{}}%
  \forallglsentries{\@glsentry}{%
    \ifglsused{\@glsentry}%
    {\immediate\write\@auxout
      {\string\@gls@entry@count{\@glsentry}{\glsentrycurrcount{\@glsentry}}}}%
    {}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@entry@count}
%\changes{4.14}{2015-02-28}{new}
% Default behaviour is to ignore arguments. Activated by
% \cs{glsenableentrycount}.
%    \begin{macrocode}
\newcommand*{\@gls@entry@count}[2]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\cgls}
%\changes{4.14}{2015-02-28}{new}
% Define command that works like \cs{gls} but behaves differently if
% the entry count function is enabled. (If not enabled, it behaves
% the same as \cs{gls} but issues a warning.)
%    \begin{macrocode}
\newrobustcmd*{\cgls}{\@gls@hyp@opt\@cgls}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@cgls}
%\changes{4.14}{2015-02-28}{new}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@cgls}[2][]{%
  \new@ifnextchar[{\@cgls@{#1}{#2}}{\@cgls@{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@cgls@}
%\changes{4.14}{2015-02-28}{new}
% Read in the final optional argument. This defaults to same behaviour
% as \cs{gls} but issues a warning.
%    \begin{macrocode}
\def\@cgls@#1#2[#3]{%
 \GlossariesWarning{\string\cgls\space is defaulting to
   \string\gls\space since you haven't enabled entry counting}%
 \@gls@{#1}{#2}[#3]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\cglsformat}
%\changes{4.14}{2015-02-28}{new}
% Format used by \cs{cgls} if entry only used once on previous run.
% The first argument is the label, the second argument is the insert
% text.
%    \begin{macrocode}
\newcommand*{\cglsformat}[2]{%
  \ifglshaslong{#1}{\glsentrylong{#1}}{\glsentryfirst{#1}}#2%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\cGls}
%\changes{4.14}{2015-02-28}{new}
% Define command that works like \cs{Gls} but behaves differently if
% the entry count function is enabled. (If not enabled, it behaves
% the same as \cs{Gls} but issues a warning.)
%    \begin{macrocode}
\newrobustcmd*{\cGls}{\@gls@hyp@opt\@cGls}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@cGls}
%\changes{4.14}{2015-02-28}{new}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@cGls}[2][]{%
  \new@ifnextchar[{\@cGls@{#1}{#2}}{\@cGls@{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@cGls@}
%\changes{4.14}{2015-02-28}{new}
% Read in the final optional argument. This defaults to same behaviour
% as \cs{Gls} but issues a warning.
%    \begin{macrocode}
\def\@cGls@#1#2[#3]{%
 \GlossariesWarning{\string\cGls\space is defaulting to
   \string\Gls\space since you haven't enabled entry counting}%
 \@Gls@{#1}{#2}[#3]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\cGlsformat}
%\changes{4.14}{2015-02-28}{new}
% Format used by \cs{cGls} if entry only used once on previous run.
% The first argument is the label, the second argument is the insert
% text.
%    \begin{macrocode}
\newcommand*{\cGlsformat}[2]{%
  \ifglshaslong{#1}{\Glsentrylong{#1}}{\Glsentryfirst{#1}}#2%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\cglspl}
%\changes{4.14}{2015-02-28}{new}
% Define command that works like \cs{glspl} but behaves differently if
% the entry count function is enabled. (If not enabled, it behaves
% the same as \cs{glspl} but issues a warning.)
%    \begin{macrocode}
\newrobustcmd*{\cglspl}{\@gls@hyp@opt\@cglspl}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@cglspl}
%\changes{4.14}{2015-02-28}{new}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@cglspl}[2][]{%
  \new@ifnextchar[{\@cglspl@{#1}{#2}}{\@cglspl@{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@cglspl@}
%\changes{4.14}{2015-02-28}{new}
% Read in the final optional argument. This defaults to same behaviour
% as \cs{glspl} but issues a warning.
%    \begin{macrocode}
\def\@cglspl@#1#2[#3]{%
 \GlossariesWarning{\string\cglspl\space is defaulting to
   \string\glspl\space since you haven't enabled entry counting}%
 \@glspl@{#1}{#2}[#3]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\cglsplformat}
%\changes{4.14}{2015-02-28}{new}
% Format used by \cs{cglspl} if entry only used once on previous run.
% The first argument is the label, the second argument is the insert
% text.
%    \begin{macrocode}
\newcommand*{\cglsplformat}[2]{%
  \ifglshaslong{#1}{\glsentrylongpl{#1}}{\glsentryfirstplural{#1}}#2%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\cGlspl}
%\changes{4.14}{2015-02-28}{new}
% Define command that works like \cs{Glspl} but behaves differently if
% the entry count function is enabled. (If not enabled, it behaves
% the same as \cs{Glspl} but issues a warning.)
%    \begin{macrocode}
\newrobustcmd*{\cGlspl}{\@gls@hyp@opt\@cGlspl}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@cglspl}
%\changes{4.14}{2015-02-28}{new}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@cGlspl}[2][]{%
  \new@ifnextchar[{\@cGlspl@{#1}{#2}}{\@cGlspl@{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@cGlspl@}
%\changes{4.14}{2015-02-28}{new}
% Read in the final optional argument. This defaults to same behaviour
% as \cs{Glspl} but issues a warning.
%    \begin{macrocode}
\def\@cGlspl@#1#2[#3]{%
 \GlossariesWarning{\string\cGlspl\space is defaulting to
   \string\Glspl\space since you haven't enabled entry counting}%
 \@Glspl@{#1}{#2}[#3]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\cGlsplformat}
%\changes{4.14}{2015-02-28}{new}
% Format used by \cs{cGlspl} if entry only used once on previous run.
% The first argument is the label, the second argument is the insert
% text.
%    \begin{macrocode}
\newcommand*{\cGlsplformat}[2]{%
  \ifglshaslong{#1}{\Glsentrylongpl{#1}}{\Glsentryfirstplural{#1}}#2%
}
%    \end{macrocode}
%\end{macro}
%
% \section{Loading files containing glossary entries}
%\label{sec:load}
% Glossary entries can be defined in an external file.
% These external files can contain \ics{newglossaryentry}
% and \ics{newacronym} commands.\footnote{and any other valid 
%\LaTeX\ code that can be used in the preamble.}
%\begin{definition}
% \cs{loadglsentries}\oarg{type}\marg{filename}
%\end{definition}
% This command will input the file using \cs{input}.
% The optional argument specifies to which glossary the
% entries should be assigned if they haven't used the \gloskey{type}
% key. If the optional argument is not specified, the default
% glossary is used. Only those entries used in the document (via
% \ics{glslink}, \ics{gls}, \ics{glspl} and uppercase
% variants or \ics{glsadd} and \ics{glsaddall} 
% will appear in the glossary). The mandatory argument is 
% the filename (with or without .tex extension).
%\begin{macro}{\loadglsentries}
%    \begin{macrocode}
\newcommand*{\loadglsentries}[2][\@gls@default]{%
  \let\@gls@default\glsdefaulttype
  \def\glsdefaulttype{#1}\input{#2}%
  \let\glsdefaulttype\@gls@default
}
%    \end{macrocode}
%\end{macro}
% \cs{loadglsentries} can only be used in the preamble:
%    \begin{macrocode}
\@onlypreamble{\loadglsentries}
%    \end{macrocode}
%
%\section{Using glossary entries in the text}
%\label{sec:code:glslink}
%
% Any term that has been defined using \ics{newglossaryentry}
% (or \ics{newacronym}) can be displayed in the text 
% (i.e.\ outside of the glossary) using
% one of the commands defined in this section. Unless you use
% \ics{glslink}, the way the term appears in the text is
% determined by \ics{glsdisplayfirst} (if it is the first
% time the term has been used) or \ics{glsdisplay} (for
% subsequent use). Any formatting commands (such as \cs{textbf}
% is governed by \ics{glstextformat}. By default this just 
% displays the \term{link text} ``as is''.
%\changes{1.04}{2007-08-03}{Added \cs{glstextformat}}%
%\begin{macro}{\glstextformat}
%    \begin{macrocode}
\newcommand*{\glstextformat}[1]{#1}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryfmt}
% As from version 3.11a, the way in which an entry is displayed is now
% governed by \cs{glsentryfmt}. This doesn't take any arguments. The
% required information is set by commands like \cs{gls}.
% To ensure backward compatibility, the default use the old
% \cs{glsdisplay} and \cs{glsdisplayfirst} style of commands
%    \begin{macrocode}
\newcommand*{\glsentryfmt}{%
  \@@gls@default@entryfmt\glsdisplayfirst\glsdisplay
}
%    \end{macrocode}
% Format that provides backwards compatibility:
%    \begin{macrocode}
\newcommand*{\@@gls@default@entryfmt}[2]{%
  \ifdefempty\glscustomtext
  {%
    \glsifplural
    {%
%    \end{macrocode}
% Plural form
%    \begin{macrocode}
      \glscapscase
      {%
%    \end{macrocode}
% Don't adjust case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
          #2{\glsentryplural{\glslabel}}%
            {\glsentrydescplural{\glslabel}}%
            {\glsentrysymbolplural{\glslabel}}{\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          #1{\glsentryfirstplural{\glslabel}}%
            {\glsentrydescplural{\glslabel}}%
            {\glsentrysymbolplural{\glslabel}}{\glsinsert}%
        }%
      }%
      {%
%    \end{macrocode}
% Make first letter upper case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use. (Expansion was used in version 3.07 and below
% in case the name wasn't the first thing to be displayed, but now
% the user can sort out the upper casing in \ics{defglsentryfmt},
% which avoids the issues caused by fragile commands.)
%    \begin{macrocode}
          \ifbool{glscompatible-3.07}%
          {%
            \protected@edef\@glo@etext{%
              #2{\glsentryplural{\glslabel}}%
                {\glsentrydescplural{\glslabel}}%
                {\glsentrysymbolplural{\glslabel}}{\glsinsert}}%
            \xmakefirstuc\@glo@etext
          }%
          {%
            #2{\Glsentryplural{\glslabel}}%
              {\glsentrydescplural{\glslabel}}%
              {\glsentrysymbolplural{\glslabel}}{\glsinsert}%
          }%
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          \ifbool{glscompatible-3.07}%
          {%
            \protected@edef\@glo@etext{%
              #1{\glsentryfirstplural{\glslabel}}%
                {\glsentrydescplural{\glslabel}}%
                {\glsentrysymbolplural{\glslabel}}{\glsinsert}}%
            \xmakefirstuc\@glo@etext
          }%
          {%
            #1{\Glsentryfirstplural{\glslabel}}%
              {\glsentrydescplural{\glslabel}}%
              {\glsentrysymbolplural{\glslabel}}{\glsinsert}%
          }%
        }%
      }%
      {%
%    \end{macrocode}
% Make all upper case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
          \mfirstucMakeUppercase{#2{\glsentryplural{\glslabel}}%
            {\glsentrydescplural{\glslabel}}%
            {\glsentrysymbolplural{\glslabel}}{\glsinsert}}%
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          \mfirstucMakeUppercase{#1{\glsentryfirstplural{\glslabel}}%
            {\glsentrydescplural{\glslabel}}%
            {\glsentrysymbolplural{\glslabel}}{\glsinsert}}%
        }%
      }%
    }%
    {%
%    \end{macrocode}
% Singular form
%    \begin{macrocode}
      \glscapscase
      {%
%    \end{macrocode}
% Don't adjust case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
          #2{\glsentrytext{\glslabel}}%
            {\glsentrydesc{\glslabel}}%
            {\glsentrysymbol{\glslabel}}{\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          #1{\glsentryfirst{\glslabel}}%
            {\glsentrydesc{\glslabel}}%
            {\glsentrysymbol{\glslabel}}{\glsinsert}%
        }%
      }%
      {%
%    \end{macrocode}
% Make first letter upper case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
          \ifbool{glscompatible-3.07}%
          {%
            \protected@edef\@glo@etext{%
              #2{\glsentrytext{\glslabel}}%
                {\glsentrydesc{\glslabel}}%
                {\glsentrysymbol{\glslabel}}{\glsinsert}}%
            \xmakefirstuc\@glo@etext
          }%
          {%
            #2{\Glsentrytext{\glslabel}}%
              {\glsentrydesc{\glslabel}}%
              {\glsentrysymbol{\glslabel}}{\glsinsert}%
          }%
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          \ifbool{glscompatible-3.07}%
          {%
            \protected@edef\@glo@etext{%
              #1{\glsentryfirst{\glslabel}}%
                {\glsentrydesc{\glslabel}}%
                {\glsentrysymbol{\glslabel}}{\glsinsert}}%
              \xmakefirstuc\@glo@etext
          }%
          {%
            #1{\Glsentryfirst{\glslabel}}%
              {\glsentrydesc{\glslabel}}%
              {\glsentrysymbol{\glslabel}}{\glsinsert}%
          }%
        }%
      }%
      {%
%    \end{macrocode}
% Make all upper case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
          \mfirstucMakeUppercase{#2{\glsentrytext{\glslabel}}%
            {\glsentrydesc{\glslabel}}%
            {\glsentrysymbol{\glslabel}}{\glsinsert}}%
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          \mfirstucMakeUppercase{#1{\glsentryfirst{\glslabel}}%
            {\glsentrydesc{\glslabel}}%
            {\glsentrysymbol{\glslabel}}{\glsinsert}}%
        }%
      }%
    }%
  }%
  {%
%    \end{macrocode}
% Custom text provided in \cs{glsdisp}
%    \begin{macrocode}
    \ifglsused{\glslabel}%
    {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
      #2{\glscustomtext}%
        {\glsentrydesc{\glslabel}}%
        {\glsentrysymbol{\glslabel}}{}%
    }%
    {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
      #1{\glscustomtext}%
        {\glsentrydesc{\glslabel}}%
        {\glsentrysymbol{\glslabel}}{}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsgenentryfmt}
% Define a generic format that just uses the first, text, plural or
% first plural keys (or the custom text) with the insert text appended.
%\changes{3.11a}{2013-10-15}{new}
%    \begin{macrocode}
\newcommand*{\glsgenentryfmt}{%
  \ifdefempty\glscustomtext
  {%
    \glsifplural
    {%
%    \end{macrocode}
% Plural form
%    \begin{macrocode}
      \glscapscase
      {%
%    \end{macrocode}
% Don't adjust case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
          \glsentryplural{\glslabel}\glsinsert
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          \glsentryfirstplural{\glslabel}\glsinsert
        }%
      }%
      {%
%    \end{macrocode}
% Make first letter upper case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use.
%    \begin{macrocode}
           \Glsentryplural{\glslabel}\glsinsert
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
           \Glsentryfirstplural{\glslabel}\glsinsert
        }%
      }%
      {%
%    \end{macrocode}
% Make all upper case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
          \mfirstucMakeUppercase
             {\glsentryplural{\glslabel}\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          \mfirstucMakeUppercase
             {\glsentryfirstplural{\glslabel}\glsinsert}%
        }%
      }%
    }%
    {%
%    \end{macrocode}
% Singular form
%    \begin{macrocode}
      \glscapscase
      {%
%    \end{macrocode}
% Don't adjust case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
          \glsentrytext{\glslabel}\glsinsert
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          \glsentryfirst{\glslabel}\glsinsert
        }%
      }%
      {%
%    \end{macrocode}
% Make first letter upper case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
           \Glsentrytext{\glslabel}\glsinsert
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          \Glsentryfirst{\glslabel}\glsinsert
        }%
      }%
      {%
%    \end{macrocode}
% Make all upper case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
          \mfirstucMakeUppercase{\glsentrytext{\glslabel}\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          \mfirstucMakeUppercase{\glsentryfirst{\glslabel}\glsinsert}%
        }%
      }%
    }%
  }%
  {%
%    \end{macrocode}
% Custom text provided in \cs{glsdisp}. (The insert is most likely
% to be empty at this point.)
%    \begin{macrocode}
    \glscustomtext\glsinsert
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsgenacfmt}
%\changes{4.02}{2013-12-05}{new}
% Define a generic acronym format that uses the \gloskey{long} and 
% \gloskey{short} keys (or their plurals) and \ics{acrfullformat},
% \ics{firstacronymfont} and \ics{acronymfont}.
%    \begin{macrocode}
\newcommand*{\glsgenacfmt}{%
  \ifdefempty\glscustomtext
  {%
    \ifglsused\glslabel
    {%
%    \end{macrocode}
% Subsequent use:
%    \begin{macrocode}
      \glsifplural
      {%
%    \end{macrocode}
% Subsequent plural form:
%    \begin{macrocode}
        \glscapscase
        {%
%    \end{macrocode}
% Subsequent plural form, don't adjust case:
%    \begin{macrocode}
          \acronymfont{\glsentryshortpl{\glslabel}}\glsinsert
        }%
        {%
%    \end{macrocode}
% Subsequent plural form, make first letter upper case:
%    \begin{macrocode}
          \acronymfont{\Glsentryshortpl{\glslabel}}\glsinsert
        }%
        {%
%    \end{macrocode}
% Subsequent plural form, all caps:
%    \begin{macrocode}
          \mfirstucMakeUppercase
            {\acronymfont{\glsentryshortpl{\glslabel}}\glsinsert}%
        }%
      }%
      {%
%    \end{macrocode}
% Subsequent singular form
%    \begin{macrocode}
        \glscapscase
        {%
%    \end{macrocode}
% Subsequent singular form, don't adjust case:
%    \begin{macrocode}
          \acronymfont{\glsentryshort{\glslabel}}\glsinsert
        }%
        {%
%    \end{macrocode}
% Subsequent singular form, make first letter upper case:
%    \begin{macrocode}
          \acronymfont{\Glsentryshort{\glslabel}}\glsinsert
        }%
        {%
%    \end{macrocode}
% Subsequent singular form, all caps:
%    \begin{macrocode}
          \mfirstucMakeUppercase
            {\acronymfont{\glsentryshort{\glslabel}}\glsinsert}%
        }%
      }%
    }%
    {%
%    \end{macrocode}
% First use:
%    \begin{macrocode}
      \glsifplural
      {%
%    \end{macrocode}
% First use plural form:
%    \begin{macrocode}
        \glscapscase
        {%
%    \end{macrocode}
% First use plural form, don't adjust case:
%    \begin{macrocode}
          \genplacrfullformat{\glslabel}{\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use plural form, make first letter upper case:
%    \begin{macrocode}
          \Genplacrfullformat{\glslabel}{\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use plural form, all caps:
%    \begin{macrocode}
          \mfirstucMakeUppercase
            {\genplacrfullformat{\glslabel}{\glsinsert}}%
        }%
      }%
      {%
%    \end{macrocode}
% First use singular form
%    \begin{macrocode}
        \glscapscase
        {%
%    \end{macrocode}
% First use singular form, don't adjust case:
%    \begin{macrocode}
          \genacrfullformat{\glslabel}{\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use singular form, make first letter upper case:
%    \begin{macrocode}
          \Genacrfullformat{\glslabel}{\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use singular form, all caps:
%    \begin{macrocode}
          \mfirstucMakeUppercase
           {\genacrfullformat{\glslabel}{\glsinsert}}%
        }%
      }%
    }%
  }%
  {%
%    \end{macrocode}
% User supplied text.
%    \begin{macrocode}
    \glscustomtext
  }%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\genacrfullformat}
%\changes{4.02}{2013-12-05}{new}
%\begin{definition}
%\cs{genacrfullformat}\marg{label}\marg{insert}
%\end{definition}
% The full format used by \cs{glsgenacfmt} (singular).
%    \begin{macrocode}
\newcommand*{\genacrfullformat}[2]{%
   \glsentrylong{#1}#2\space
   (\protect\firstacronymfont{\glsentryshort{#1}})%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Genacrfullformat}
%\changes{4.02}{2013-12-05}{new}
%\begin{definition}
%\cs{Genacrfullformat}\marg{label}\marg{insert}
%\end{definition}
% As above but makes the first letter upper case.
%    \begin{macrocode}
\newcommand*{\Genacrfullformat}[2]{%
  \protected@edef\gls@text{\genacrfullformat{#1}{#2}}%
  \xmakefirstuc\gls@text
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\genplacrfullformat}
%\changes{4.02}{2013-12-05}{new}
%\begin{definition}
%\cs{genplacrfullformat}\marg{label}\marg{insert}
%\end{definition}
% The full format used by \cs{glsgenacfmt} (plural).
%    \begin{macrocode}
\newcommand*{\genplacrfullformat}[2]{%
   \glsentrylongpl{#1}#2\space
   (\protect\firstacronymfont{\glsentryshortpl{#1}})%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Genplacrfullformat}
%\changes{4.02}{2013-12-05}{new}
%\begin{definition}
%\cs{Genplacrfullformat}\marg{label}\marg{insert}
%\end{definition}
% As above but makes the first letter upper case.
%    \begin{macrocode}
\newcommand*{\Genplacrfullformat}[2]{%
  \protected@edef\gls@text{\genplacrfullformat{#1}{#2}}%
  \xmakefirstuc\gls@text
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdisplayfirst}
% Deprecated. Kept for backward compatibility.
%\changes{3.11a}{2013-10-15}{obsoleted}
%    \begin{macrocode}
\newcommand*{\glsdisplayfirst}[4]{#1#4}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdisplay}
% Deprecated. Kept for backward compatibility.
%\changes{3.11a}{2013-10-15}{obsoleted}
%    \begin{macrocode}
\newcommand*{\glsdisplay}[4]{#1#4}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\defglsdisplay}
%\changes{3.11a}{2013-10-15}{obsoleted}
% Deprecated. Kept for backward compatibility.
%    \begin{macrocode}
\newcommand*{\defglsdisplay}[2][\glsdefaulttype]{%
  \GlossariesWarning{\string\defglsdisplay\space is now obsolete.^^J
  Use \string\defglsentryfmt\space instead}%
  \expandafter\def\csname gls@#1@display\endcsname##1##2##3##4{#2}%
  \edef\@gls@doentrydef{%
    \noexpand\defglsentryfmt[#1]{%
      \noexpand\ifcsdef{gls@#1@displayfirst}%
      {%
        \noexpand\@@gls@default@entryfmt
          {\noexpand\csuse{gls@#1@displayfirst}}%
          {\noexpand\csuse{gls@#1@display}}%
      }%
      {%
        \noexpand\@@gls@default@entryfmt
          {\noexpand\glsdisplayfirst}%
          {\noexpand\csuse{gls@#1@display}}%
      }%
    }%
  }%
  \@gls@doentrydef
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\defglsdisplayfirst}
% Deprecated. Kept for backward compatibility.
%\changes{3.11a}{2013-10-15}{obsoleted}
%    \begin{macrocode}
\newcommand*{\defglsdisplayfirst}[2][\glsdefaulttype]{%
  \GlossariesWarning{\string\defglsdisplayfirst\space is now obsolete.^^J
  Use \string\defglsentryfmt\space instead}%
  \expandafter\def\csname gls@#1@displayfirst\endcsname##1##2##3##4{#2}%
  \edef\@gls@doentrydef{%
    \noexpand\defglsentryfmt[#1]{%
      \noexpand\ifcsdef{gls@#1@display}%
      {%
        \noexpand\@@gls@default@entryfmt
          {\noexpand\csuse{gls@#1@displayfirst}}%
          {\noexpand\csuse{gls@#1@display}}%
      }%
      {%
%    \end{macrocode}
%\changes{4.04}{2014-03-06}{fixed unwanted space}
%    \begin{macrocode}
        \noexpand\@@gls@default@entryfmt
          {\noexpand\csuse{gls@#1@displayfirst}}%
          {\noexpand\glsdisplay}%
      }%
    }%
  }%
  \@gls@doentrydef
}
%    \end{macrocode}
%\end{macro}
%
%\subsubsection{Links to glossary entries}
% The links to glossary entries all have a first optional 
% argument that can be used to change the format and counter
% of the associated entry number. Except for \cs{glslink}
% and \cs{glsdisp},
% the commands like \cs{gls} have a final optional
% argument that can be used to insert additional text in the
% link (this will usually be appended, but can be redefined using
% \ics{defglsentryfmt}). 
% It goes against the \LaTeX\ norm to have an optional
% argument after the mandatory arguments, but it makes more
% sense to write, say, \verb|\gls{label}['s]| rather than, say,
% \verb|\gls[append='s]{label}|. Since these control sequences
% are defined to include the final square bracket, spaces
% will be ignored after them. This is likely to lead to
% confusion as most users would not expect, say, "\gls{"\meta{label}"}"
% to ignore following spaces, so \cs{new@ifnextchar} from the 
% \isty{amsgen} package is required.
%
% The following keys can be used in the first optional 
% argument. The \gloskey[glslink]{counter} key checks that the 
% value is the name of a valid counter.
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%    \begin{macrocode}
\define@key{glslink}{counter}{%
  \ifcsundef{c@#1}%
  {%
    \PackageError{glossaries}%
    {There is no counter called `#1'}%
    {%
       The counter key should have the name of a valid counter 
       as its value%
    }%
  }%
  {%
    \def\@gls@counter{#1}%
  }%
}
%    \end{macrocode}
% The value of the \gloskey[glslink]{format} key should be the name of a 
% command (without the initial backslash) that has a single mandatory 
% argument which can be used to format the associated entry
% number.
%    \begin{macrocode}
\define@key{glslink}{format}{%
  \def\@glsnumberformat{#1}}
%    \end{macrocode}
% The \gloskey[glslink]{hyper} key is a boolean key, it can either have the 
% value true or false, and indicates whether or not to make a 
% hyperlink to the relevant glossary entry. If hyper is false, an 
% entry will still be made in the glossary, but the given text 
% won't be a hyperlink.
%    \begin{macrocode}
\define@boolkey{glslink}{hyper}[true]{}
%    \end{macrocode}
%\changes{4.08}{2014-07-30}{explicitly initialise hyper key}
% Initialise hyper key.
%    \begin{macrocode}
\ifdef{\hyperlink}{\KV@glslink@hypertrue}{\KV@glslink@hyperfalse}
%    \end{macrocode}
%\changes{3.04}{2012-11-18}{added local key}
% The \gloskey[glslink]{local} key is a boolean key. If true this
% indicates that commands such as \ics{gls} should only do a local
% reset rather than a global one.
%    \begin{macrocode}
\define@boolkey{glslink}{local}[true]{}
%    \end{macrocode}
%
% The original \cs{glsifhyper} command isn't particularly useful
% as it makes more sense to check the actual hyperlink setting
% rather than testing whether the starred or unstarred version
% has been used. Therefore, as from version 4.08, \cs{glsifhyper}
% is deprecated in favour of \ics{glsifhyperon}. In case there is
% a particular need to know whether the starred or unstarred version
% was used, provide a new command that determines whether the
% *-version, +-version or unmodified version was used.
%\begin{definition}
%\cs{glslinkvar}\marg{unmodified case}\marg{star case}\marg{plus case}
%\end{definition}
%\begin{macro}{\glslinkvar}
%\changes{4.08}{2014-07-30}{new}
% Initialise to unmodified case.
%    \begin{macrocode}
\newcommand*{\glslinkvar}[3]{#1}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsifhyper}
% Now deprecated.
%\changes{4.08}{2014-07-30}{deprecated}
%    \begin{macrocode}
\newcommand*{\glsifhyper}[2]{%
 \glslinkvar{#1}{#2}{#1}%
 \GlossariesWarning{\string\glsifhyper\space is deprecated. Did
  you mean \string\glsifhyperon\space or \string\glslinkvar?}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@hyp@opt}
% Used by the commands such as \cs{glslink} to determine whether to
% modify the hyper option.
%\changes{4.08}{2014-07-30}{new}
%    \begin{macrocode}
\newcommand*{\@gls@hyp@opt}[1]{%
 \let\glslinkvar\@firstofthree
 \let\@gls@hyp@opt@cs#1\relax
 \@ifstar{\s@gls@hyp@opt}%
 {\@ifnextchar+{\@firstoftwo{\p@gls@hyp@opt}}{#1}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\s@gls@hyp@opt}
% Starred version
%\changes{4.08}{2014-07-30}{new}
%    \begin{macrocode}
\newcommand*{\s@gls@hyp@opt}[1][]{%
 \let\glslinkvar\@secondofthree
 \@gls@hyp@opt@cs[hyper=false,#1]}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\p@gls@hyp@opt}
% Plus version
%\changes{4.08}{2014-07-30}{new}
%    \begin{macrocode}
\newcommand*{\p@gls@hyp@opt}[1][]{%
 \let\glslinkvar\@thirdofthree
 \@gls@hyp@opt@cs[hyper=true,#1]}
%    \end{macrocode}
%\end{macro}
%
%Syntax:
%\begin{definition}
% \cs{glslink}\oarg{options}\marg{label}\marg{text}
%\end{definition}
% Display \meta{text} in the document, and add the entry information
% for \meta{label} into the relevant glossary. The optional
% argument should be a key value list using the \texttt{glslink}
% keys defined above.
%
% There is also a starred version:
%\begin{definition}
% \cs{glslink*}\oarg{options}\marg{label}\marg{text}
%\end{definition}
% which is equivalent to 
% \cs{glslink}"[hyper=false,"\meta{options}"]"\marg{label}\marg{text}
%
% First determine which version is being used:
%\begin{macro}{\glslink}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\glslink}{%
 \@gls@hyp@opt\@gls@@link
}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sgls@link}}
%\begin{macro}{\@gls@@link}
%\changes{2.03}{2009-09-23}{new}
% The main part of the business is in \cs{@gls@link}
% which shouldn't check if the term is defined as it's called by
% \cs{gls} etc which also perform that check.
%    \begin{macrocode}
\newcommand*{\@gls@@link}[3][]{%
  \glsdoifexistsordo{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\relax
    \@gls@link[#1]{#2}{#3}%
  }{%
%    \end{macrocode}
% Display the specified text. (The entry doesn't exist so
% there's nothing to link it to.)
%    \begin{macrocode}
    \glstextformat{#3}%
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glspostlinkhook}
%\changes{4.16}{2015-07-08}{new}
%    \begin{macrocode}
\newcommand*{\glspostlinkhook}{}
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{\@gls@link@checkfirsthyper}
% Check for first use and switch off \gloskey[glslink]{hyper} key
% if hyperlink not wanted. (Should be off if first use and
% hyper=false is on or if first use and both the entry is in an acronym
% list and the acrfootnote setting is on.)
% This assumes the glossary type is stored in \cs{glstype} and the
% label is stored in \cs{glslabel}.
%\changes{4.08}{2014-07-30}{new}
%    \begin{macrocode}
\newcommand*{\@gls@link@checkfirsthyper}{%
  \ifglsused{\glslabel}%
  {%
  }%
  {%
    \gls@checkisacronymlist\glstype
    \ifglshyperfirst
      \if@glsisacronymlist
        \ifglsacrfootnote
           \KV@glslink@hyperfalse
        \fi
      \fi
    \else
       \KV@glslink@hyperfalse
    \fi
  }%
%    \end{macrocode}
% Allow user to hook into this
%    \begin{macrocode}
  \glslinkcheckfirsthyperhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glslinkcheckfirsthyperhook}
% Allow used to hook into the \cs{@gls@link@checkfirsthyper} macro
%\changes{4.08}{2014-07-30}{new}
%    \begin{macrocode}
\newcommand*{\glslinkcheckfirsthyperhook}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glslinkpostsetkeys}
%\changes{4.16}{2015-07-08}{new}
%    \begin{macrocode}
\newcommand*{\glslinkpostsetkeys}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsifhyperon}
%\changes{4.16}{2015-07-08}{moved definition of \cs{glsifhyperon}}
% Check the value of the \gloskey[glslink]{hyper} key:
%    \begin{macrocode}
\newcommand{\glsifhyperon}[2]{\ifKV@glslink@hyper#1\else#2\fi}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\do@glsdisablehyperinlist}
% Disable hyperlink if in the ``nohyper'' list.
%\changes{4.19}{2015-11-22}{new}
%    \begin{macrocode}
\newcommand*{\do@glsdisablehyperinlist}{%
  \expandafter\DTLifinlist\expandafter{\glstype}{\@gls@nohyperlist}%
    {\KV@glslink@hyperfalse}{}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@setdefault@glslink@opts}
% Hook to set default options for \cs{@glslink}.
%\changes{4.20}{2015-11-30}{new}
%    \begin{macrocode}
\newcommand*{\@gls@setdefault@glslink@opts}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@link}
%\changes{1.07}{2007-09-13}{fixed bug caused by \cs{theglsentrycounter} setting the page number too soon}
%\changes{1.15}{2008-08-15}{added \cs{glslabel}}
%    \begin{macrocode}
\def\@gls@link[#1]#2#3{%
%    \end{macrocode}
%\changes{2.03}{2009-09-23}{Moved entry existence check to 
% avoid duplicate code}
% Inserting \cs{leavevmode} suggested by Donald~Arseneau (avoids
% problem with tabularx).
%\changes{2.03}{2009-09-23}{added \cs{leavevmode}}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
    \leavevmode
    \protected@edef\glslabel{\glsdetoklabel{#2}}%
%    \end{macrocode}
% Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label}
%\changes{4.03}{2014-01-20}{moved \cs{@gls@link@opts} and
%\cs{@gls@link@label} to \cs{@gls@link}}
%    \begin{macrocode}
    \def\@gls@link@opts{#1}%
    \let\@gls@link@label\glslabel
%    \end{macrocode}
%    \begin{macrocode}
    \def\@glsnumberformat{glsnumberformat}%
    \protected@edef\@gls@counter{\csname glo@\glslabel @counter\endcsname}%
%    \end{macrocode}
%\changes{3.05}{2013-04-21}{added check for ``nohypertypes''}%
%\changes{3.07}{2013-07-05}{fixed bug that failed to find entry in list}%
% If this is in one of the ``nohypertypes'' glossaries, suppress the
% hyperlink by default
%\changes{4.08}{2014-07-30}{renamed \cs{gls@type} to \cs{glstype}}
%    \begin{macrocode}
    \protected@edef\glstype{\csname glo@\glslabel @type\endcsname}%
%    \end{macrocode}
%\changes{4.08}{2014-07-30}{removed redundancy}
% Save original setting
%    \begin{macrocode}
    \let\org@ifKV@glslink@hyper\ifKV@glslink@hyper
%    \end{macrocode}
% Set defaults:
%\changes{4.20}{2015-11-30}{added \cs{@gls@setdefault@glslink@opts}}
%    \begin{macrocode}
    \@gls@setdefault@glslink@opts
%    \end{macrocode}
% Switch off hyper setting if the glossary type has been identified
% in nohyperlist.
%    \begin{macrocode}
    \do@glsdisablehyperinlist
%    \end{macrocode}
% Macros must set this before calling \cs{@gls@link}. The
% commands that check the first use flag should set this to
% \cs{@gls@link@checkfirsthyper} otherwise it should be set to
% \cs{relax}.
%    \begin{macrocode}
    \do@gls@link@checkfirsthyper
    \setkeys{glslink}{#1}%
%    \end{macrocode}
% Add a hook for the user to customise things after the keys have
% been set.
%    \begin{macrocode}
    \glslinkpostsetkeys
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{moved definition of \cs{glsifhyperon}
%outside of this macro}
% Store the entry's counter in \cs{theglsentrycounter}
%\changes{3.0}{2011-04-02}{added \cs{@gls@saveentrycounter}}
%    \begin{macrocode}
    \@gls@saveentrycounter
%    \end{macrocode}
%\changes{3.0}{2011-04-02}{added \cs{@gls@setsort}}
% Define sort key if necessary:
%    \begin{macrocode}
    \@gls@setsort{\glslabel}%
%    \end{macrocode}
%\changes{2.01}{2009 May 30}{moved \cs{@do@wrglossary} before term is displayed
% to prevent unwanted whatsit}
% (De-tok'ing done by \cs{@@do@wrglossary})
%    \begin{macrocode}
    \@do@wrglossary{#2}%
    \ifKV@glslink@hyper
      \@glslink{\glolinkprefix\glslabel}{\glstextformat{#3}}%
    \else
%    \end{macrocode}
%\changes{3.13a}{2013-11-05}{removed \cs{relax}}
%\changes{4.20}{2015-11-30}{added \cs{glsdonohyperlink} when hyperlink is
%suppressed}
%    \begin{macrocode}
      \glsdonohyperlink{\glolinkprefix\glslabel}{\glstextformat{#3}}%
    \fi
%    \end{macrocode}
% Restore original setting
%    \begin{macrocode}
    \let\ifKV@glslink@hyper\org@ifKV@glslink@hyper
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glolinkprefix}
%    \begin{macrocode}
\newcommand*{\glolinkprefix}{glo:}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentrycounter}
% Set default value of entry counter
%\changes{3.02}{2012-05-21}{set default value}
%    \begin{macrocode}
\def\glsentrycounter{\glscounter}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@saveentrycounter}
%\changes{3.0}{2011-04-02}{new}
% Need to check if using \ctr{equation} counter in \env{align}
% environment:
%    \begin{macrocode}
\newcommand*{\@gls@saveentrycounter}{%
  \def\@gls@Hcounter{}%
%    \end{macrocode}
% Are we using \ctr{equation} counter?
%    \begin{macrocode}
  \ifthenelse{\equal{\@gls@counter}{equation}}%
  {
%    \end{macrocode}
% If we're in \env{align} environment, \cs{xatlevel@} will be defined.
% (Can't test for \cs{@currenvir} as may be inside an inner
% environment.)
%    \begin{macrocode}
    \ifcsundef{xatlevel@}%
    {%
      \edef\theglsentrycounter{\expandafter\noexpand
        \csname the\@gls@counter\endcsname}%
    }%
    {%
      \ifx\xatlevel@\@empty
        \edef\theglsentrycounter{\expandafter\noexpand
          \csname the\@gls@counter\endcsname}%
      \else
        \savecounters@
        \advance\c@equation by 1\relax
          \edef\theglsentrycounter{\csname the\@gls@counter\endcsname}%
%    \end{macrocode}
% Check if hyperref version of this counter
%    \begin{macrocode}
        \ifcsundef{theH\@gls@counter}%
        {%
           \def\@gls@Hcounter{\theglsentrycounter}%
        }%
        {%
          \def\@gls@Hcounter{\csname theH\@gls@counter\endcsname}%
        }%
        \protected@edef\theHglsentrycounter{\@gls@Hcounter}%
        \restorecounters@
      \fi
    }%
  }%
  {%
%    \end{macrocode}
% Not using \ctr{equation} counter so no special measures:
%    \begin{macrocode}
    \edef\theglsentrycounter{\expandafter\noexpand
      \csname the\@gls@counter\endcsname}%
  }%
%    \end{macrocode}
% Check if hyperref version of this counter
%    \begin{macrocode}
  \ifx\@gls@Hcounter\@empty
    \ifcsundef{theH\@gls@counter}%
    {%
       \def\theHglsentrycounter{\theglsentrycounter}%
    }%
    {%
      \protected@edef\theHglsentrycounter{\expandafter\noexpand
        \csname theH\@gls@counter\endcsname}%
    }%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\changes{1.01}{2007-05-17}{Added range facility in format key}%
%\begin{macro}{\@set@glo@numformat}
% Set the formatting information in the format required by 
% \app{makeindex}. The first argument is the format specified
% by the user (via the format key), the second argument is the
% name of the counter used to indicate the location, the third
% argument is a control sequence which stores the required format
% and the fourth argument (new to v3.0) is the hyper-prefix.
%\changes{3.0}{2010/03/31}{added 4th argument}
%    \begin{macrocode}
\def\@set@glo@numformat#1#2#3#4{%
  \expandafter\@glo@check@mkidxrangechar#3\@nil
  \protected@edef#1{%
    \@glo@prefix setentrycounter[#4]{#2}%
    \expandafter\string\csname\@glo@suffix\endcsname
  }%
  \@gls@checkmkidxchars#1%
}
%    \end{macrocode}
%\end{macro}
% Check to see if the given string starts with a ( or ). If it
% does set \cs{@glo@prefix} to the starting character,
% and \cs{@glo@suffix} to the rest (or "glsnumberformat"
% if there is nothing else),
% otherwise set \cs{@glo@prefix} to nothing and
% \cs{@glo@suffix} to all of it.
%    \begin{macrocode}
\def\@glo@check@mkidxrangechar#1#2\@nil{%
\if#1(\relax
  \def\@glo@prefix{(}%
  \if\relax#2\relax
    \def\@glo@suffix{glsnumberformat}%
  \else
    \def\@glo@suffix{#2}%
  \fi
\else
  \if#1)\relax
    \def\@glo@prefix{)}%
    \if\relax#2\relax
      \def\@glo@suffix{glsnumberformat}%
    \else
      \def\@glo@suffix{#2}%
  \fi
  \else
    \def\@glo@prefix{}\def\@glo@suffix{#1#2}%
  \fi
\fi}
%    \end{macrocode}
%
%\begin{macro}{\@gls@escbsdq}
% Escape backslashes and double quote marks. The argument must be
% a control sequence.
%    \begin{macrocode}
\newcommand*{\@gls@escbsdq}[1]{%
  \def\@gls@checkedmkidx{}%
  \let\gls@xdystring=#1\relax
  \@onelevel@sanitize\gls@xdystring
  \edef\do@gls@xdycheckbackslash{%
    \noexpand\@gls@xdycheckbackslash\gls@xdystring\noexpand\@nil
    \@backslashchar\@backslashchar\noexpand\null}%
  \do@gls@xdycheckbackslash
  \expandafter\@gls@updatechecked\@gls@checkedmkidx{\gls@xdystring}%
  \def\@gls@checkedmkidx{}%
  \expandafter\@gls@xdycheckquote\gls@xdystring\@nil""\null
  \expandafter\@gls@updatechecked\@gls@checkedmkidx{\gls@xdystring}%
%    \end{macrocode}
%\changes{3.04}{2012-11-18}{unsanitize \cs{gls@numberpage},
%\cs{gls@alphpage}, \cs{gls@Alphpage} and \cs{gls@romanpage}}
% Unsanitize \cs{gls@numberpage}, \cs{gls@alphpage},
% \cs{gls@Alphpage} and \cs{glsromanpage} (thanks to David~Carlise
% for the suggestion.)
%    \begin{macrocode}
  \@for\@gls@tmp:=\gls@protected@pagefmts\do
  {%
    \edef\@gls@sanitized@tmp{\expandafter\@gobble\string\\\expandonce\@gls@tmp}%
    \@onelevel@sanitize\@gls@sanitized@tmp
    \edef\gls@dosubst{%
      \noexpand\DTLsubstituteall\noexpand\gls@xdystring
      {\@gls@sanitized@tmp}{\expandonce\@gls@tmp}%
    }%
    \gls@dosubst
  }%
%    \end{macrocode}
% Assign to required control sequence
%    \begin{macrocode}
  \let#1=\gls@xdystring
}
%    \end{macrocode}
%\end{macro}
% Catch special characters\mkidxspch\ (argument must be a
% control sequence):
%\begin{macro}{\@gls@checkmkidxchars}
%    \begin{macrocode}
\newcommand{\@gls@checkmkidxchars}[1]{%
  \ifglsxindy
    \@gls@escbsdq{#1}%
  \else
    \def\@gls@checkedmkidx{}%
    \expandafter\@gls@checkquote#1\@nil""\null
    \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
    \def\@gls@checkedmkidx{}%
    \expandafter\@gls@checkescquote#1\@nil\"\"\null
    \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
    \def\@gls@checkedmkidx{}%
    \expandafter\@gls@checkescactual#1\@nil\?\?\null
    \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
    \def\@gls@checkedmkidx{}%
    \expandafter\@gls@checkactual#1\@nil??\null
    \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
    \def\@gls@checkedmkidx{}%
    \expandafter\@gls@checkbar#1\@nil||\null
    \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
    \def\@gls@checkedmkidx{}%
    \expandafter\@gls@checkescbar#1\@nil\|\|\null
    \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
    \def\@gls@checkedmkidx{}%
    \expandafter\@gls@checklevel#1\@nil!!\null
    \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
%    \end{macrocode}
%\changes{4.47}{2021-09-20}{added check for \cs{"!} and backslash}
%    \begin{macrocode}
    \def\@gls@checkedmkidx{}%
    \expandafter\@gls@checkesclevel#1\@nil\!\!\null
    \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
    \def\@gls@checkedmkidx{}%
    \edef\@do@gls@checkesc{%
       \noexpand\@gls@checkesc\expandonce{#1}\noexpand\@nil
         \@backslashchar\@backslashchar\noexpand\null
    }%
    \@do@gls@checkesc
    \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
  \fi
}
%    \end{macrocode}
%\end{macro}
% Update the control sequence and strip trailing \cs{@nil}:
%\begin{macro}{\@gls@updatechecked}
%    \begin{macrocode}
\def\@gls@updatechecked#1\@nil#2{\def#2{#1}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@tmpb}
%\changes{1.1}{2008-02-22}{changed \cs{toksdef} to \cs{newtoks}}
% Define temporary token
%    \begin{macrocode}
\newtoks\@gls@tmpb
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@checkquote}
% Replace \verb|"| with \verb|""| since \verb|"| is a makeindex
% special character\mkidxspch.
%    \begin{macrocode}
\def\@gls@checkquote#1"#2"#3\null{%
  \@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
  \toks@={#1}%
  \ifx\null#2\null
   \ifx\null#3\null
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
    \def\@@gls@checkquote{\relax}%
   \else
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
      \@gls@quotechar\@gls@quotechar\@gls@quotechar\@gls@quotechar}%
    \def\@@gls@checkquote{\@gls@checkquote#3\null}%
   \fi
  \else
   \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
     \@gls@quotechar\@gls@quotechar}%
   \ifx\null#3\null
     \def\@@gls@checkquote{\@gls@checkquote#2""\null}%
   \else
     \def\@@gls@checkquote{\@gls@checkquote#2"#3\null}%
   \fi
  \fi
  \@@gls@checkquote
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@checkescquote}
% Do the same for \verb|\"|:
%    \begin{macrocode}
\def\@gls@checkescquote#1\"#2\"#3\null{%
  \@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
  \toks@={#1}%
  \ifx\null#2\null
   \ifx\null#3\null
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
    \def\@@gls@checkescquote{\relax}%
   \else
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
      \@gls@quotechar\string\"\@gls@quotechar
      \@gls@quotechar\string\"\@gls@quotechar}%
    \def\@@gls@checkescquote{\@gls@checkescquote#3\null}%
   \fi
  \else
   \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
     \@gls@quotechar\string\"\@gls@quotechar}%
   \ifx\null#3\null
     \def\@@gls@checkescquote{\@gls@checkescquote#2\"\"\null}%
   \else
     \def\@@gls@checkescquote{\@gls@checkescquote#2\"#3\null}%
   \fi
  \fi
\@@gls@checkescquote
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@checkescactual}
% Similarly for \verb|\?| (which is replaces @ as 
% \app{makeindex}'s special character):
%    \begin{macrocode}
\def\@gls@checkescactual#1\?#2\?#3\null{%
 \@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
 \toks@={#1}%
 \ifx\null#2\null
   \ifx\null#3\null
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
    \def\@@gls@checkescactual{\relax}%
   \else
     \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
     \@gls@quotechar\string\"\@gls@actualchar
     \@gls@quotechar\string\"\@gls@actualchar}%
     \def\@@gls@checkescactual{\@gls@checkescactual#3\null}%
   \fi
  \else
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
    \@gls@quotechar\string\"\@gls@actualchar}%
    \ifx\null#3\null
      \def\@@gls@checkescactual{\@gls@checkescactual#2\?\?\null}%
    \else
      \def\@@gls@checkescactual{\@gls@checkescactual#2\?#3\null}%
   \fi
  \fi
\@@gls@checkescactual
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@checkescbar}
% Similarly for \verb"\|":
%    \begin{macrocode}
\def\@gls@checkescbar#1\|#2\|#3\null{%
  \@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
  \toks@={#1}%
  \ifx\null#2\null
   \ifx\null#3\null
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
    \def\@@gls@checkescbar{\relax}%
   \else
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
      \@gls@quotechar\string\"\@gls@encapchar
      \@gls@quotechar\string\"\@gls@encapchar}%
    \def\@@gls@checkescbar{\@gls@checkescbar#3\null}%
   \fi
  \else
   \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
     \@gls@quotechar\string\"\@gls@encapchar}%
   \ifx\null#3\null
    \def\@@gls@checkescbar{\@gls@checkescbar#2\|\|\null}%
   \else
    \def\@@gls@checkescbar{\@gls@checkescbar#2\|#3\null}%
   \fi
  \fi
\@@gls@checkescbar
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@checkesclevel}
% Similarly for \verb"\!":
%    \begin{macrocode}
\def\@gls@checkesclevel#1\!#2\!#3\null{%
  \@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
  \toks@={#1}%
  \ifx\null#2\null
   \ifx\null#3\null
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
    \def\@@gls@checkesclevel{\relax}%
   \else
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
      \@gls@quotechar\string\"\@gls@levelchar
      \@gls@quotechar\string\"\@gls@levelchar}%
    \def\@@gls@checkesclevel{\@gls@checkesclevel#3\null}%
   \fi
  \else
   \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
     \@gls@quotechar\string\"\@gls@levelchar}%
   \ifx\null#3\null
    \def\@@gls@checkesclevel{\@gls@checkesclevel#2\!\!\null}%
   \else
    \def\@@gls@checkesclevel{\@gls@checkesclevel#2\!#3\null}%
   \fi
  \fi
\@@gls@checkesclevel
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@checkbar}
% and for \verb"|":
%    \begin{macrocode}
\def\@gls@checkbar#1|#2|#3\null{%
  \@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
  \toks@={#1}%
  \ifx\null#2\null
   \ifx\null#3\null
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
    \def\@@gls@checkbar{\relax}%
   \else
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
      \@gls@quotechar\@gls@encapchar\@gls@quotechar\@gls@encapchar}%
    \def\@@gls@checkbar{\@gls@checkbar#3\null}%
   \fi
  \else
   \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
     \@gls@quotechar\@gls@encapchar}%
   \ifx\null#3\null
     \def\@@gls@checkbar{\@gls@checkbar#2||\null}%
   \else
     \def\@@gls@checkbar{\@gls@checkbar#2|#3\null}%
   \fi
  \fi
  \@@gls@checkbar
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@checklevel}
% and for \verb"!":
%    \begin{macrocode}
\def\@gls@checklevel#1!#2!#3\null{%
  \@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
  \toks@={#1}%
  \ifx\null#2\null
    \ifx\null#3\null
      \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
      \def\@@gls@checklevel{\relax}%
    \else
      \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
      \@gls@quotechar\@gls@levelchar\@gls@quotechar\@gls@levelchar}%
      \def\@@gls@checklevel{\@gls@checklevel#3\null}%
    \fi
  \else
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
    \@gls@quotechar\@gls@levelchar}%
    \ifx\null#3\null
      \def\@@gls@checklevel{\@gls@checklevel#2!!\null}%
    \else
      \def\@@gls@checklevel{\@gls@checklevel#2!#3\null}%
    \fi
  \fi
  \@@gls@checklevel
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@checkactual}
% and for \verb"?":
%    \begin{macrocode}
\def\@gls@checkactual#1?#2?#3\null{%
  \@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
  \toks@={#1}%
  \ifx\null#2\null
    \ifx\null#3\null
      \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
      \def\@@gls@checkactual{\relax}%
     \else
      \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
        \@gls@quotechar\@gls@actualchar\@gls@quotechar\@gls@actualchar}%
      \def\@@gls@checkactual{\@gls@checkactual#3\null}%
     \fi
    \else
     \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
       \@gls@quotechar\@gls@actualchar}%
     \ifx\null#3\null
       \def\@@gls@checkactual{\@gls@checkactual#2??\null}%
     \else
       \def\@@gls@checkactual{\@gls@checkactual#2?#3\null}%
     \fi
    \fi
  \@@gls@checkactual
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@checkesc}
% and for \verb"\":
%\changes{4.47}{2021-09-20}{new}
%    \begin{macrocode}
\bgroup
\catcode`\|0\relax
\catcode`\\12\relax
|gdef|@gls@checkesc#1\#2\#3|null{%
  |@gls@tmpb=|expandafter{|@gls@checkedmkidx}%
  |toks@={#1}%
  |ifx|null#2|null
    |ifx|null#3|null
      |edef|@gls@checkedmkidx{|the|@gls@tmpb|the|toks@}%
      |def|@@gls@checkesc{|relax}%
     |else
      |edef|@gls@checkedmkidx{|the|@gls@tmpb|the|toks@
        |@gls@quotechar|@backslashchar|@gls@quotechar|@backslashchar}%
      |def|@@gls@checkesc{|@gls@checkesc#3|null}%
     |fi
    |else
     |edef|@gls@checkedmkidx{|the|@gls@tmpb|the|toks@
       |@gls@quotechar|@backslashchar}%
     |ifx|null#3|null
       |def|@@gls@checkesc{|@gls@checkesc#2\\|null}%
     |else
       |def|@@gls@checkesc{|@gls@checkesc#2\#3|null}%
     |fi
    |fi
  |@@gls@checkesc
}
|egroup
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{\@gls@xdycheckquote}
% As before but for use with \app{xindy}
%    \begin{macrocode}
\def\@gls@xdycheckquote#1"#2"#3\null{%
  \@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
  \toks@={#1}%
  \ifx\null#2\null
    \ifx\null#3\null
      \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
      \def\@@gls@xdycheckquote{\relax}%
     \else
      \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
        \string\"\string\"}%
      \def\@@gls@xdycheckquote{\@gls@xdycheckquote#3\null}%
     \fi
    \else
     \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
       \string\"}%
     \ifx\null#3\null
       \def\@@gls@xdycheckquote{\@gls@xdycheckquote#2""\null}%
     \else
       \def\@@gls@xdycheckquote{\@gls@xdycheckquote#2"#3\null}%
     \fi
    \fi
  \@@gls@xdycheckquote
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@xdycheckbackslash}
% Need to escape all backslashes for \app{xindy}.
% Define command that will define \cs{@gls@xdycheckbackslash}
%    \begin{macrocode}
\edef\def@gls@xdycheckbackslash{%
 \noexpand\def\noexpand\@gls@xdycheckbackslash##1\@backslashchar
   ##2\@backslashchar##3\noexpand\null{%
  \noexpand\@gls@tmpb=\noexpand\expandafter
    {\noexpand\@gls@checkedmkidx}%
  \noexpand\toks@={##1}%
  \noexpand\ifx\noexpand\null##2\noexpand\null
   \noexpand\ifx\noexpand\null##3\noexpand\null
    \noexpand\edef\noexpand\@gls@checkedmkidx{%
       \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@}%
    \noexpand\def\noexpand\@@gls@xdycheckbackslash{\relax}%
   \noexpand\else
    \noexpand\edef\noexpand\@gls@checkedmkidx{%
      \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@
    \@backslashchar\@backslashchar\@backslashchar\@backslashchar}%
  \noexpand\def\noexpand\@@gls@xdycheckbackslash{%
     \noexpand\@gls@xdycheckbackslash##3\noexpand\null}%
   \noexpand\fi
  \noexpand\else
   \noexpand\edef\noexpand\@gls@checkedmkidx{%
     \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@
   \@backslashchar\@backslashchar}%
 \noexpand\ifx\noexpand\null##3\noexpand\null
   \noexpand\def\noexpand\@@gls@xdycheckbackslash{%
      \noexpand\@gls@xdycheckbackslash##2\@backslashchar
      \@backslashchar\noexpand\null}%
   \noexpand\else
     \noexpand\def\noexpand\@@gls@xdycheckbackslash{%
        \noexpand\@gls@xdycheckbackslash##2\@backslashchar
           ##3\noexpand\null}%
   \noexpand\fi
  \noexpand\fi
  \noexpand\@@gls@xdycheckbackslash
 }%
}
%    \end{macrocode}
% Now go ahead and define \cs{@gls@xdycheckbackslash}
%    \begin{macrocode}
\def@gls@xdycheckbackslash
%    \end{macrocode}
%\end{macro}

%\begin{macro}{\glsdohypertarget}
%\changes{4.08}{2014-07-30}{new}
%    \begin{macrocode}
\newlength\gls@tmplen
\newcommand*{\glsdohypertarget}[2]{%
  \@glsshowtarget{#1}%
  \settoheight{\gls@tmplen}{#2}%
  \raisebox{\gls@tmplen}{\hypertarget{#1}{}}#2%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsdohyperlink}
%\changes{4.08}{2014-07-30}{new}
%    \begin{macrocode}
\newcommand*{\glsdohyperlink}[2]{%
 \@glsshowtarget{#1}%
 \hyperlink{#1}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdonohyperlink}
%\changes{4.20}{2015-11-30}{new}
%    \begin{macrocode}
\newcommand*{\glsdonohyperlink}[2]{#2}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glslink}
% If \ics{hyperlink} is not defined \cs{@glslink} 
% ignores its first argument and just does the second argument,
% otherwise it is equivalent to \ics{hyperlink}.
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%    \begin{macrocode}
\ifcsundef{hyperlink}%
{%
  \let\@glslink\glsdonohyperlink
}%
{%
  \let\@glslink\glsdohyperlink
}
%    \end{macrocode}
%\end{macro}
%\changes{1.12}{2008-03-08}{added check for \cs{hypertarget} separate
% to \cs{hyperlink} (memoir defines \cs{hyperlink} but not
% \cs{hypertarget})}
%\begin{macro}{\@glstarget}
% If \ics{hypertarget} is not defined, \cs{@glstarget}
% ignores its first argument and just does the second argument,
% otherwise it is equivalent to \ics{hypertarget}.
%\changes{1.16}{2008-08-27}{raised the hypertarget so the target text doesn't
% scroll off the top of the page}
%    \begin{macrocode}
\ifcsundef{hypertarget}%
{%
  \let\@glstarget\@secondoftwo
}%
{%
  \let\@glstarget\glsdohypertarget
}
%    \end{macrocode}
%\end{macro}
%
% Glossary hyperlinks can be disabled using \cs{glsdisablehyper}
% (effect can be localised):
%\begin{macro}{\glsdisablehyper}
%\changes{4.08}{2014-07-30}{added \cs{KV@glslink@hyperfalse}
% to definition}
%    \begin{macrocode}
\newcommand{\glsdisablehyper}{%
  \KV@glslink@hyperfalse
  \let\@glslink\glsdonohyperlink
  \let\@glstarget\@secondoftwo
}
%    \end{macrocode}
%\end{macro}
% Glossary hyperlinks can be enabled using \cs{glsenablehyper}
% (effect can be localised):
%\begin{macro}{\glsenablehyper}
%\changes{4.08}{2014-07-30}{added \cs{KV@glslink@hypertrue}
% to definition}
%    \begin{macrocode}
\newcommand{\glsenablehyper}{%
 \KV@glslink@hypertrue
 \let\@glslink\glsdohyperlink
 \let\@glstarget\glsdohypertarget
}
%    \end{macrocode}
%\end{macro}
%
%
% Provide some convenience commands if not already defined:
%\changes{4.08}{2014-07-30}{removed \cs{@thirdofthree} (defined in kernel)}
%    \begin{macrocode}
\providecommand{\@firstofthree}[3]{#1}
\providecommand{\@secondofthree}[3]{#2}
%    \end{macrocode}
%
%Syntax:
%\begin{definition}
% \cs{gls}\oarg{options}\marg{label}\oarg{insert text}
%\end{definition}
% Link to glossary entry using singular form. The link text
% is taken from the value of the \gloskey{text} or \gloskey{first}
% keys used when the entry was defined.
%
%  The first optional argument is a key-value list, the same as
% \ics{glslink}\igloskey[glslink]{hyper}\igloskey[glslink]{format}\igloskey[glslink]{counter}, 
% the mandatory argument is the entry label. 
% After the mandatory argument, there is another optional argument 
% to insert extra text in the link text (the location of the inserted
% text is governed by \ics{glsdisplay} and 
% \ics{glsdisplayfirst}). As with \cs{glslink}
% there is a starred version which is the same as the unstarred 
% version but with the \gloskey[glslink]{hyper} key set to \texttt{false}.
% (Additional options can also be specified 
% in the first optional argument.)
%
% First determine which version is being used:
%\begin{macro}{\gls}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\gls}{\@gls@hyp@opt\@gls}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sgls}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%\begin{macro}{\@gls}
%    \begin{macrocode}
\newcommand*{\@gls}[2][]{%
  \new@ifnextchar[{\@gls@{#1}{#2}}{\@gls@{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@gls@#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{add \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glscustomtext} and \cs{glsinsert}}
%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in
%\cs{@gls@link})}
%    \begin{macrocode}
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@firstofthree
    \let\glscustomtext\@empty
    \def\glsinsert{#3}%
%    \end{macrocode}
%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}}
%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%\changes{3.11a}{2013-10-15}{change to using \cs{glsentryfmt} style
%commands}
% Note that \cs{@gls@link} sets \cs{glstype}.
%    \begin{macrocode}
    \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}%
%    \end{macrocode}
% Call \cs{@gls@link}.
% If \pkgopt{footnote} package option has been used and the glossary
% type is \cs{acronymtype}, suppress 
% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst}
% package option is used.
%\changes{1.16}{2008-08-27}{Test glossary type is
%\cs{acronymtype} in addition to
%checking if footnote option has been used}
%\changes{2.03}{2009-09-23}{Added check for hyperfirst}
%\changes{2.04}{2009-11-10}{Changed test to check if glossary type
%has been identified as a list of acronyms}
%\changes{4.08}{2014-07-30}{moved check for first use to
%\cs{@gls@link}}
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\@glo@text}%
%    \end{macrocode}
% Indicate that this entry has now been used
%    \begin{macrocode}
    \ifKV@glslink@local
      \glslocalunset{#2}%
    \else
      \glsunset{#2}%
    \fi
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
% \cs{Gls} behaves like \cs{gls}, but the first letter
% of the link text is converted to uppercase (note that if the
% first letter has an accent, the accented letter will need to
% be grouped when you define the entry). It is mainly intended
% for terms that start a sentence:
%\begin{macro}{\Gls}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Gls}{\@gls@hyp@opt\@Gls}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGls}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Gls}[2][]{%
  \new@ifnextchar[{\@Gls@{#1}{#2}}{\@Gls@{#1}{#2}[]}%
}
%    \end{macrocode}
%\begin{macro}{\@Gls@}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Gls@#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper
%    \end{macrocode}
%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in
%\cs{@gls@link})}
%\changes{3.11a}{2013-10-15}{add \cs{glsifplural},
% \cs{glscapscase}, \cs{glscustomtext} and \cs{glsinsert}}
%    \begin{macrocode}
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@secondofthree
    \let\glscustomtext\@empty
    \def\glsinsert{#3}%
%    \end{macrocode}
%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}}
%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}}
%\changes{4.08}{2014-07-30}{moved check for first use to
%\cs{@gls@link}}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%\changes{3.11a}{2013-10-15}{change to using \cs{glsentryfmt} style
%commands}
% Note that \cs{@gls@link} sets \cs{glstype}.
%    \begin{macrocode}
    \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}%
%    \end{macrocode}
% Call \cs{@gls@link}
% If \pkgopt{footnote} package option has been used and the glossary
% type is \cs{acronymtype}, suppress 
% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst}
% package option is used.
%\changes{1.16}{2008-08-27}{Test glossary type is
%\cs{acronymtype} in addition to
%checking if footnote option has been used}
%\changes{2.03}{2009-09-23}{Added check for hyperfirst}
%\changes{2.04}{2009-11-10}{Changed test to check if glossary type
%has been identified as a list of acronyms}
%\changes{3.11a}{2013-10-15}{removed \cs{makefirstuc} (now dealt
%with in \cs{glsentryfmt})}
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\@glo@text}%
%    \end{macrocode}
% Indicate that this entry has now been used
%    \begin{macrocode}
    \ifKV@glslink@local
      \glslocalunset{#2}%
    \else
      \glsunset{#2}%
    \fi
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
% \cs{GLS} behaves like \ics{gls}, but the link
% text is converted to uppercase:
%\changes{3.01}{2011-04-12}{made robust}
%\begin{macro}{\GLS}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\GLS}{\@gls@hyp@opt\@GLS}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGLS}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLS}[2][]{%
  \new@ifnextchar[{\@GLS@{#1}{#2}}{\@GLS@{#1}{#2}[]}%
}
%    \end{macrocode}
%\begin{macro}{\@GLS@}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLS@#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper
%    \end{macrocode}
%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in
%\cs{@gls@link})}
%\changes{3.11a}{2013-10-15}{add \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glscustomtext} and \cs{glsinsert}}
%    \begin{macrocode}
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@thirdofthree
    \let\glscustomtext\@empty
    \def\glsinsert{#3}%
%    \end{macrocode}
%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}}
%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}}
%\changes{4.08}{2014-07-30}{moved check for first use to
%\cs{@gls@link}}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text}).
%\changes{3.11a}{2013-10-15}{change to using \cs{glsentryfmt} style
%commands}
% Note that \cs{@gls@link} sets \cs{glstype}.
%    \begin{macrocode}
    \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}%
%    \end{macrocode}
% Call \cs{@gls@link}
% If \pkgopt{footnote} package option has been used and the glossary
% type is \cs{acronymtype}, suppress 
% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst}
% package option is used.
%\changes{1.16}{2008-08-27}{Test glossary type is
%\cs{acronymtype} in addition to
%checking if footnote option has been used}
%\changes{2.03}{2009-09-23}{Added check for hyperfirst}
%\changes{2.04}{2009-11-10}{Changed test to check if glossary type
%has been identified as a list of acronyms}
%\changes{3.11a}{2013-10-15}{removed \cs{MakeUppercase} (now moved
%to \cs{glsentryfmt})}
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\@glo@text}%
%    \end{macrocode}
% Indicate that this entry has now been used
%    \begin{macrocode}
    \ifKV@glslink@local
      \glslocalunset{#2}%
    \else
      \glsunset{#2}%
    \fi
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
% \cs{glspl} behaves in the same way as \ics{gls} except
% it uses the plural form.
%\begin{macro}{\glspl}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\glspl}{\@gls@hyp@opt\@glspl}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sglspl}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glspl}[2][]{%
  \new@ifnextchar[{\@glspl@{#1}{#2}}{\@glspl@{#1}{#2}[]}%
}
%    \end{macrocode}
%\begin{macro}{\@glspl@}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glspl@#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper
%    \end{macrocode}
%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in
%\cs{@gls@link})}
%\changes{3.11a}{2013-10-15}{add \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glscustomtext} and \cs{glsinsert}}
%    \begin{macrocode}
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@firstofthree
    \let\glscustomtext\@empty
    \def\glsinsert{#3}%
%    \end{macrocode}
%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}}
%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}}
%\changes{4.08}{2014-07-30}{moved check for first use to
%\cs{@gls@link}}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%\changes{1.12}{2008-03-08}{now uses \cs{glsentrydescplural} and
% \cs{glsentrysymbolplural} instead of \cs{glsentrydesc} and
% \cs{glsentrysymbol}}
%\changes{3.11a}{2013-10-15}{change to using \cs{glsentryfmt} style
%commands}
% Note that \cs{@gls@link} sets \cs{glstype}.
%    \begin{macrocode}
    \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}%
%    \end{macrocode}
% Call \cs{@gls@link}.
% If \pkgopt{footnote} package option has been used and the glossary
% type is \cs{acronymtype}, suppress 
% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst}
% package option is used.
%\changes{1.16}{2008-08-27}{Test glossary type is
%\cs{acronymtype} in addition to
%checking if footnote option has been used}
%\changes{2.03}{2009-09-23}{Added check for hyperfirst}
%\changes{2.04}{2009-11-10}{Changed test to check if glossary type
%has been identified as a list of acronyms}
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\@glo@text}%
%    \end{macrocode}
% Indicate that this entry has now been used
%    \begin{macrocode}
    \ifKV@glslink@local
      \glslocalunset{#2}%
    \else
      \glsunset{#2}%
    \fi
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
% \cs{Glspl} behaves in the same way as \ics{glspl}, except
% that the first letter of the link text is converted to uppercase
% (as with \ics{Gls}, if the first letter has an accent, it
% will need to be grouped).
%\begin{macro}{\Glspl}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Glspl}{\@gls@hyp@opt\@Glspl}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGlspl}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glspl}[2][]{%
  \new@ifnextchar[{\@Glspl@{#1}{#2}}{\@Glspl@{#1}{#2}[]}%
}
%    \end{macrocode}
%\begin{macro}{\@Glspl@}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glspl@#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper
%    \end{macrocode}
%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in
%\cs{@gls@link})}
%\changes{3.11a}{2013-10-15}{add \cs{glsifplural},
% \cs{glscapscase}, \cs{glscustomtext} and \cs{glsinsert}}
%    \begin{macrocode}
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@secondofthree
    \let\glscustomtext\@empty
    \def\glsinsert{#3}%
%    \end{macrocode}
%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}}
%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}}
%\changes{4.08}{2014-07-30}{moved check for first use to
%\cs{@gls@link}}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text}). This needs to be expanded so that the
% \cs{@glo@text} can be passed to \cs{xmakefirstuc}.
%\changes{1.12}{2008-03-08}{now uses \cs{glsentrydescplural} and
% \cs{glsentrysymbolplural} instead of \cs{glsentrydesc} and
% \cs{glsentrysymbol}}
%\changes{3.11a}{2013-10-15}{change to using \cs{glsentryfmt} style
%commands}
% Note that \cs{@gls@link} sets \cs{glstype}.
%    \begin{macrocode}
    \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}%
%    \end{macrocode}
% Call \cs{@gls@link}.
% If \pkgopt{footnote} package option has been used and the glossary
% type is \cs{acronymtype}, suppress 
% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst}
% package option is used.
%\changes{1.16}{2008-08-27}{Test glossary type is
%\cs{acronymtype} in addition to
%checking if footnote option has been used}
%\changes{2.03}{2009-09-23}{Added check for hyperfirst}
%\changes{2.04}{2009-11-10}{Changed test to check if glossary type
%has been identified as a list of acronyms}
%\changes{3.11a}{2013-10-15}{removed \cs{makefirstuc} (now dealt
%with in \cs{glsentryfmt})}
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\@glo@text}%
%    \end{macrocode}
% Indicate that this entry has now been used
%    \begin{macrocode}
    \ifKV@glslink@local
      \glslocalunset{#2}%
    \else
      \glsunset{#2}%
    \fi
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
% \cs{GLSpl} behaves like \ics{glspl} except that all the
% link text is converted to uppercase.
%\begin{macro}{\GLSpl}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\GLSpl}{\@gls@hyp@opt\@GLSpl}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGLSpl}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSpl}[2][]{%
  \new@ifnextchar[{\@GLSpl@{#1}{#2}}{\@GLSpl@{#1}{#2}[]}%
}
%    \end{macrocode}
%\begin{macro}{\@GLSpl}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLSpl@#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper
%    \end{macrocode}
%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in
%\cs{@gls@link})}
%\changes{3.11a}{2013-10-15}{add \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glscustomtext} and \cs{glsinsert}}
%    \begin{macrocode}
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@thirdofthree
    \let\glscustomtext\@empty
    \def\glsinsert{#3}%
%    \end{macrocode}
%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}}
%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}}
%\changes{4.08}{2014-07-30}{moved check for first use to
%\cs{@gls@link}}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%\changes{1.12}{2008-03-08}{now uses \cs{glsentrydescplural} and
% \cs{glsentrysymbolplural} instead of \cs{glsentrydesc} and
% \cs{glsentrysymbol}}
%\changes{3.11a}{2013-10-15}{change to using \cs{glsentryfmt} style
%commands}
% Note that \cs{@gls@link} sets \cs{glstype}.
%    \begin{macrocode}
    \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}%
%    \end{macrocode}
% Call \cs{@gls@link}.
% If \pkgopt{footnote} package option has been used and the glossary
% type is \cs{acronymtype}, suppress 
% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst}
% package option is used.
%\changes{1.16}{2008-08-27}{Test glossary type is
%\cs{acronymtype} in addition to
%checking if footnote option has been used}
%\changes{2.03}{2009-09-23}{Added check for hyperfirst}
%\changes{2.04}{2009-11-10}{Changed test to check if glossary type
%has been identified as a list of acronyms}
%\changes{3.11a}{2013-10-15}{removed \cs{MakeUppercase} as now dealt
%with in \cs{glsentryfmt}}
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\@glo@text}%
%    \end{macrocode}
% Indicate that this entry has now been used
%    \begin{macrocode}
    \ifKV@glslink@local
      \glslocalunset{#2}%
    \else
      \glsunset{#2}%
    \fi
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdisp}
%\changes{1.19}{2009-03-02}{new}
%\cs{glsdisp}\oarg{options}\marg{label}\marg{text}
% This is like \cs{gls} except that the link text is provided.
% This differs from \cs{glslink} in that it uses 
% \cs{glsdisplay} or \cs{glsdisplayfirst} and unsets the first use
% flag.
%
% First determine if we are using the starred form:
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\glsdisp}{\@gls@hyp@opt\@glsdisp}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sglsdisp}}
% Defined the un-starred form.
%\begin{macro}{\@glsdisp}
%    \begin{macrocode}
\newcommand*{\@glsdisp}[3][]{%
  \glsdoifexists{#2}{%
%    \end{macrocode}
%\changes{2.05}{2010-02-06}{Added closing brace. Patch provided by Sergiu Dotenco}
%    \begin{macrocode}
    \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper
%    \end{macrocode}
%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in
%\cs{@gls@link})}
%\changes{3.11a}{2013-10-15}{add \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glscustomtext} and \cs{glsinsert}}
%    \begin{macrocode}
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@firstofthree
    \def\glscustomtext{#3}%
    \def\glsinsert{}%
%    \end{macrocode}
%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}}
%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}}
%\changes{4.08}{2014-07-30}{moved check for first use to
%\cs{@gls@link}}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%\changes{3.11a}{2013-10-15}{change to using \cs{glsentryfmt} style
%commands}
% Note that \cs{@gls@link} sets \cs{glstype}.
%    \begin{macrocode}
    \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}%
%    \end{macrocode}
% Call \cs{@gls@link}.
% If \pkgopt{footnote} package option has been used and the glossary
% type is \cs{acronymtype}, suppress 
% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst}
% package option is used.
%\changes{1.16}{2008-08-27}{Test glossary type is
%\cs{acronymtype} in addition to
%checking if footnote option has been used}
%\changes{2.03}{2009-09-23}{Added check for hyperfirst}
%\changes{2.04}{2009-11-10}{Changed test to check if glossary type
%has been identified as a list of acronyms}
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\@glo@text}%
%    \end{macrocode}
% Indicate that this entry has now been used
%\changes{2.05}{2010-02-06}{Removed spurious brace. Patch provided by Sergiu Dotenco}
%    \begin{macrocode}
    \ifKV@glslink@local
      \glslocalunset{#2}%
    \else
      \glsunset{#2}%
    \fi
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@link@nocheckfirsthyper}
%\changes{4.19}{2015-11-22}{new}
% Instead of just setting \cs{do@gls@link@checkfirsthyper} to
% \cs{relax} in \cs{@gls@field@link}, set it to
% \cs{@gls@link@nocheckfirsthyper} in case some other action needs
% to take place.
%    \begin{macrocode}
\newcommand*{\@gls@link@nocheckfirsthyper}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@field@link}
%\changes{4.03}{2014-01-20}{new}
%\changes{4.08}{2014-07-30}{added assignment of \cs{do@gls@link@checkfirsthyper}}
%    \begin{macrocode}
\newcommand{\@gls@field@link}[3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \@gls@link[#1]{#2}{#3}%
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
% \cs{glstext} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{text} key and it doesn't mark the entry as
% used.
%\begin{macro}{\glstext}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\glstext}{\@gls@hyp@opt\@glstext}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sglstext}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glstext}[2][]{%
  \new@ifnextchar[{\@glstext@{#1}{#2}}{\@glstext@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentrytext}}
%    \begin{macrocode}
\def\@glstext@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentrytext{#2}#3}%
}
%    \end{macrocode}
%
% \cs{GLStext} behaves like \cs{glstext} except the text is converted
% to uppercase.
%\begin{macro}{\GLStext}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\GLStext}{\@gls@hyp@opt\@GLStext}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGLStext}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLStext}[2][]{%
  \new@ifnextchar[{\@GLStext@{#1}{#2}}{\@GLStext@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%    \begin{macrocode}
\def\@GLStext@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentrytext{#2}#3}}%
}
%    \end{macrocode}
%
% \cs{Glstext} behaves like \cs{glstext} except that the first letter
% of the text is converted to uppercase.
%\begin{macro}{\Glstext}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Glstext}{\@gls@hyp@opt\@Glstext}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGlstext}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glstext}[2][]{%
  \new@ifnextchar[{\@Glstext@{#1}{#2}}{\@Glstext@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{Changed to just use \cs{Glsentrytext}}
%    \begin{macrocode}
\def\@Glstext@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentrytext{#2}#3}%
}
%    \end{macrocode}
%
% \cs{glsfirst} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{first} key and it doesn't mark the entry as
% used.
%\begin{macro}{\glsfirst}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\glsfirst}{\@gls@hyp@opt\@glsfirst}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sglsfirst}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsfirst}[2][]{%
  \new@ifnextchar[{\@glsfirst@{#1}{#2}}{\@glsfirst@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryfirst}}
%    \begin{macrocode}
\def\@glsfirst@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentryfirst{#2}#3}%
}
%    \end{macrocode}
%
% \cs{Glsfirst} behaves like \ics{glsfirst} except it displays the 
% first letter in uppercase.
%\begin{macro}{\Glsfirst}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Glsfirst}{\@gls@hyp@opt\@Glsfirst}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGlsfirst}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsfirst}[2][]{%
  \new@ifnextchar[{\@Glsfirst@{#1}{#2}}{\@Glsfirst@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentryfirst}}
%    \begin{macrocode}
\def\@Glsfirst@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentryfirst{#2}#3}%
}
%    \end{macrocode}
%
% \cs{GLSfirst} behaves like \ics{Glsfirst} except it displays the 
% text in uppercase.
%\begin{macro}{\GLSfirst}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\GLSfirst}{\@gls@hyp@opt\@GLSfirst}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGLSfirst}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSfirst}[2][]{%
  \new@ifnextchar[{\@GLSfirst@{#1}{#2}}{\@GLSfirst@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryfirst}}
%    \begin{macrocode}
\def\@GLSfirst@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryfirst{#2}#3}}%
}
%    \end{macrocode}
%
% \cs{glsplural} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{plural} key and it doesn't mark the entry as
% used.
%\begin{macro}{\glsplural}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\glsplural}{\@gls@hyp@opt\@glsplural}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sglsplural}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsplural}[2][]{%
  \new@ifnextchar[{\@glsplural@{#1}{#2}}{\@glsplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryplural}}
%    \begin{macrocode}
\def\@glsplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentryplural{#2}#3}%
}
%    \end{macrocode}
%
% \cs{Glsplural} behaves like \ics{glsplural} except that the first
% letter is converted to uppercase.
%\begin{macro}{\Glsplural}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Glsplural}{\@gls@hyp@opt\@Glsplural}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGlsplural}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsplural}[2][]{%
  \new@ifnextchar[{\@Glsplural@{#1}{#2}}{\@Glsplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentryplural}}
%    \begin{macrocode}
\def\@Glsplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentryplural{#2}#3}%
}
%    \end{macrocode}
%
% \cs{GLSplural} behaves like \ics{glsplural} except that the 
% text is converted to uppercase.
%\begin{macro}{\GLSplural}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\GLSplural}{\@gls@hyp@opt\@GLSplural}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGLSplural}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSplural}[2][]{%
  \new@ifnextchar[{\@GLSplural@{#1}{#2}}{\@GLSplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryplural}}
%    \begin{macrocode}
\def\@GLSplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryplural{#2}#3}}%
}
%    \end{macrocode}
%
% \cs{glsfirstplural} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{firstplural} key and it doesn't mark the entry as
% used.
%\begin{macro}{\glsfirstplural}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\glsfirstplural}{\@gls@hyp@opt\@glsfirstplural}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sglsfirstplural}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsfirstplural}[2][]{%
  \new@ifnextchar[{\@glsfirstplural@{#1}{#2}}{\@glsfirstplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use
%\cs{glsentryfirstplural}}
%    \begin{macrocode}
\def\@glsfirstplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentryfirstplural{#2}#3}%
}
%    \end{macrocode}
%
% \cs{Glsfirstplural} behaves like \ics{glsfirstplural} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glsfirstplural}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Glsfirstplural}{\@gls@hyp@opt\@Glsfirstplural}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGlsfirstplural}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsfirstplural}[2][]{%
  \new@ifnextchar[{\@Glsfirstplural@{#1}{#2}}{\@Glsfirstplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use
%\cs{Glsentryfirstplural}}
%    \begin{macrocode}
\def\@Glsfirstplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentryfirstplural{#2}#3}%
}
%    \end{macrocode}
%
% \cs{GLSfirstplural} behaves like \ics{glsfirstplural} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSfirstplural}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\GLSfirstplural}{\@gls@hyp@opt\@GLSfirstplural}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGLSfirstplural}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSfirstplural}[2][]{%
  \new@ifnextchar[{\@GLSfirstplural@{#1}{#2}}{\@GLSfirstplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use
%\cs{glsentryfirstplural}}
%    \begin{macrocode}
\def\@GLSfirstplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryfirstplural{#2}#3}}%
}
%    \end{macrocode}
%
% \cs{glsname} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{name} key and it doesn't mark the entry as
% used.
%\begin{macro}{\glsname}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\glsname}{\@gls@hyp@opt\@glsname}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sglsname}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsname}[2][]{%
  \new@ifnextchar[{\@glsname@{#1}{#2}}{\@glsname@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryname}}
%    \begin{macrocode}
\def\@glsname@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentryname{#2}#3}%
}
%    \end{macrocode}
%
% \cs{Glsname} behaves like \ics{glsname} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glsname}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Glsname}{\@gls@hyp@opt\@Glsname}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGlsname}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsname}[2][]{%
  \new@ifnextchar[{\@Glsname@{#1}{#2}}{\@Glsname@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentryname}}
%    \begin{macrocode}
\def\@Glsname@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentryname{#2}#3}%
}
%    \end{macrocode}
%
% \cs{GLSname} behaves like \ics{glsname} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSname}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\GLSname}{\@gls@hyp@opt\@GLSname}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGLSname}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSname}[2][]{%
  \new@ifnextchar[{\@GLSname@{#1}{#2}}{\@GLSname@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryname}}
%    \begin{macrocode}
\def\@GLSname@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryname{#2}#3}}%
}
%    \end{macrocode}
%
% \cs{glsdesc} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{description} key and it doesn't mark the entry
% as used.
%\begin{macro}{\glsdesc}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\glsdesc}{\@gls@hyp@opt\@glsdesc}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sglsdesc}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsdesc}[2][]{%
  \new@ifnextchar[{\@glsdesc@{#1}{#2}}{\@glsdesc@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentrydesc}}
%    \begin{macrocode}
\def\@glsdesc@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentrydesc{#2}#3}%
}
%    \end{macrocode}
%
% \cs{Glsdesc} behaves like \ics{glsdesc} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glsdesc}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Glsdesc}{\@gls@hyp@opt\@Glsdesc}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGlsdesc}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsdesc}[2][]{%
  \new@ifnextchar[{\@Glsdesc@{#1}{#2}}{\@Glsdesc@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentrydesc}}
%    \begin{macrocode}
\def\@Glsdesc@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentrydesc{#2}#3}%
}
%    \end{macrocode}
%
% \cs{GLSdesc} behaves like \ics{glsdesc} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSdesc}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\GLSdesc}{\@gls@hyp@opt\@GLSdesc}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGLSdesc}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSdesc}[2][]{%
  \new@ifnextchar[{\@GLSdesc@{#1}{#2}}{\@GLSdesc@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentrydesc}}
%    \begin{macrocode}
\def\@GLSdesc@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentrydesc{#2}#3}}%
}
%    \end{macrocode}
%
% \cs{glsdescplural} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{descriptionplural} key and it doesn't mark the entry
% as used.
%\begin{macro}{\glsdescplural}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\glsdescplural}{\@gls@hyp@opt\@glsdescplural}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sglsdescplural}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsdescplural}[2][]{%
  \new@ifnextchar[{\@glsdescplural@{#1}{#2}}{\@glsdescplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use
%\cs{glsentrydescplural}}
%    \begin{macrocode}
\def\@glsdescplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentrydescplural{#2}#3}%
}
%    \end{macrocode}
%
% \cs{Glsdescplural} behaves like \ics{glsdescplural} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glsdescplural}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Glsdescplural}{\@gls@hyp@opt\@Glsdescplural}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGlsdescplural}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsdescplural}[2][]{%
  \new@ifnextchar[{\@Glsdescplural@{#1}{#2}}{\@Glsdescplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use
%\cs{Glsentrydescplural}}
%    \begin{macrocode}
\def\@Glsdescplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentrydescplural{#2}#3}%
}
%    \end{macrocode}
%
% \cs{GLSdescplural} behaves like \ics{glsdescplural} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSdescplural}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\GLSdescplural}{\@gls@hyp@opt\@GLSdescplural}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGLSdescplural}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSdescplural}[2][]{%
  \new@ifnextchar[{\@GLSdescplural@{#1}{#2}}{\@GLSdescplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use
%\cs{glsentrydescplural}}
%    \begin{macrocode}
\def\@GLSdescplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentrydescplural{#2}#3}}%
}
%    \end{macrocode}
%
% \cs{glssymbol} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{symbol} key and it doesn't mark the entry as
% used.
%\begin{macro}{\glssymbol}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\glssymbol}{\@gls@hyp@opt\@glssymbol}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sglssymbol}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glssymbol}[2][]{%
  \new@ifnextchar[{\@glssymbol@{#1}{#2}}{\@glssymbol@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentrysymbol}}
%    \begin{macrocode}
\def\@glssymbol@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentrysymbol{#2}#3}%
}
%    \end{macrocode}
%
% \cs{Glssymbol} behaves like \ics{glssymbol} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glssymbol}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Glssymbol}{\@gls@hyp@opt\@Glssymbol}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGlssymbol}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glssymbol}[2][]{%
  \new@ifnextchar[{\@Glssymbol@{#1}{#2}}{\@Glssymbol@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentrysymbol}}
%    \begin{macrocode}
\def\@Glssymbol@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentrysymbol{#2}#3}%
}
%    \end{macrocode}
%
% \cs{GLSsymbol} behaves like \ics{glssymbol} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSsymbol}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\GLSsymbol}{\@gls@hyp@opt\@GLSsymbol}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGLSsymbol}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSsymbol}[2][]{%
  \new@ifnextchar[{\@GLSsymbol@{#1}{#2}}{\@GLSsymbol@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentrysymbol}}
%    \begin{macrocode}
\def\@GLSsymbol@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentrysymbol{#2}#3}}%
}
%    \end{macrocode}
%
% \cs{glssymbolplural} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{symbolplural} key and it doesn't mark the entry as
% used.
%\begin{macro}{\glssymbolplural}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\glssymbolplural}{\@gls@hyp@opt\@glssymbolplural}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sglssymbolplural}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glssymbolplural}[2][]{%
  \new@ifnextchar[{\@glssymbolplural@{#1}{#2}}{\@glssymbolplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use
%\cs{glsentrysymbolplural}}
%    \begin{macrocode}
\def\@glssymbolplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentrysymbolplural{#2}#3}%
}
%    \end{macrocode}
%
% \cs{Glssymbolplural} behaves like \ics{glssymbolplural} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glssymbolplural}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Glssymbolplural}{\@gls@hyp@opt\@Glssymbolplural}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGlssymbolplural}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glssymbolplural}[2][]{%
  \new@ifnextchar[{\@Glssymbolplural@{#1}{#2}}{\@Glssymbolplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use
%\cs{Glsentrysymbolplural}}
%    \begin{macrocode}
\def\@Glssymbolplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentrysymbolplural{#2}#3}%
}
%    \end{macrocode}
%
% \cs{GLSsymbolplural} behaves like \ics{glssymbolplural} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSsymbolplural}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\GLSsymbolplural}{\@gls@hyp@opt\@GLSsymbolplural}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGLSsymbolplural}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSsymbolplural}[2][]{%
  \new@ifnextchar[{\@GLSsymbolplural@{#1}{#2}}{\@GLSsymbolplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter}
%\changes{3.11a}{2013-10-15}{changed to just use
%\cs{glsentrysymbolplural}}
%    \begin{macrocode}
\def\@GLSsymbolplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentrysymbolplural{#2}#3}}%
}
%    \end{macrocode}
%
% \cs{glsuseri} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{user1} key and it doesn't mark the entry
% as used.
%\begin{macro}{\glsuseri}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\glsuseri}{\@gls@hyp@opt\@glsuseri}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sglsuseri}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsuseri}[2][]{%
  \new@ifnextchar[{\@glsuseri@{#1}{#2}}{\@glsuseri@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuseri}}
%    \begin{macrocode}
\def\@glsuseri@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentryuseri{#2}#3}%
}
%    \end{macrocode}
%
% \cs{Glsuseri} behaves like \ics{glsuseri} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glsuseri}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Glsuseri}{\@gls@hyp@opt\@Glsuseri}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGlsuseri}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsuseri}[2][]{%
  \new@ifnextchar[{\@Glsuseri@{#1}{#2}}{\@Glsuseri@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentryuseri}}
%    \begin{macrocode}
\def\@Glsuseri@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentryuseri{#2}#3}%
}
%    \end{macrocode}
%
% \cs{GLSuseri} behaves like \ics{glsuseri} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSuseri}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\GLSuseri}{\@gls@hyp@opt\@GLSuseri}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGLSuseri}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSuseri}[2][]{%
  \new@ifnextchar[{\@GLSuseri@{#1}{#2}}{\@GLSuseri@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuseri}}
%    \begin{macrocode}
\def\@GLSuseri@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryuseri{#2}#3}}%
}
%    \end{macrocode}
%
% \cs{glsuserii} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{user2} key and it doesn't mark the entry
% as used.
%\begin{macro}{\glsuserii}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\glsuserii}{\@gls@hyp@opt\@glsuserii}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sglsuserii}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsuserii}[2][]{%
  \new@ifnextchar[{\@glsuserii@{#1}{#2}}{\@glsuserii@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuserii}}
%    \begin{macrocode}
\def\@glsuserii@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentryuserii{#2}#3}%
}
%    \end{macrocode}
%
% \cs{Glsuserii} behaves like \ics{glsuserii} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glsuserii}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Glsuserii}{\@gls@hyp@opt\@Glsuserii}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGlsuserii}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsuserii}[2][]{%
  \new@ifnextchar[{\@Glsuserii@{#1}{#2}}{\@Glsuserii@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentryuserii}}
%    \begin{macrocode}
\def\@Glsuserii@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentryuserii{#2}#3}%
}
%    \end{macrocode}
%
% \cs{GLSuserii} behaves like \ics{glsuserii} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSuserii}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\GLSuserii}{\@gls@hyp@opt\@GLSuserii}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGLSuserii}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSuserii}[2][]{%
  \new@ifnextchar[{\@GLSuserii@{#1}{#2}}{\@GLSuserii@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuserii}}
%    \begin{macrocode}
\def\@GLSuserii@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryuserii{#2}#3}}%
}
%    \end{macrocode}
%
% \cs{glsuseriii} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{user3} key and it doesn't mark the entry
% as used.
%\begin{macro}{\glsuseriii}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\glsuseriii}{\@gls@hyp@opt\@glsuseriii}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sglsuseriii}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsuseriii}[2][]{%
  \new@ifnextchar[{\@glsuseriii@{#1}{#2}}{\@glsuseriii@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuseriii}}
%    \begin{macrocode}
\def\@glsuseriii@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentryuseriii{#2}#3}%
}
%    \end{macrocode}
%
% \cs{Glsuseriii} behaves like \ics{glsuseriii} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glsuseriii}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Glsuseriii}{\@gls@hyp@opt\@Glsuseriii}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGlsuseriii}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsuseriii}[2][]{%
  \new@ifnextchar[{\@Glsuseriii@{#1}{#2}}{\@Glsuseriii@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentryuseriii}}
%    \begin{macrocode}
\def\@Glsuseriii@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentryuseriii{#2}#3}%
}
%    \end{macrocode}
%
% \cs{GLSuseriii} behaves like \ics{glsuseriii} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSuseriii}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\GLSuseriii}{\@gls@hyp@opt\@GLSuseriii}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGLSuseriii}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSuseriii}[2][]{%
  \new@ifnextchar[{\@GLSuseriii@{#1}{#2}}{\@GLSuseriii@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuseriii}}
%    \begin{macrocode}
\def\@GLSuseriii@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryuseriii{#2}#3}}%
}
%    \end{macrocode}
%
% \cs{glsuseriv} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{user4} key and it doesn't mark the entry
% as used.
%\begin{macro}{\glsuseriv}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\glsuseriv}{\@gls@hyp@opt\@glsuseriv}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sglsuseriv}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsuseriv}[2][]{%
  \new@ifnextchar[{\@glsuseriv@{#1}{#2}}{\@glsuseriv@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuseriv}}
%    \begin{macrocode}
\def\@glsuseriv@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentryuseriv{#2}#3}%
}
%    \end{macrocode}
%
% \cs{Glsuseriv} behaves like \ics{glsuseriv} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glsuseriv}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Glsuseriv}{\@gls@hyp@opt\@Glsuseriv}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGlsuseriv}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsuseriv}[2][]{%
  \new@ifnextchar[{\@Glsuseriv@{#1}{#2}}{\@Glsuseriv@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentryuseriv}}
%    \begin{macrocode}
\def\@Glsuseriv@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentryuseriv{#2}#3}%
}
%    \end{macrocode}
%
% \cs{GLSuseriv} behaves like \ics{glsuseriv} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSuseriv}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\GLSuseriv}{\@gls@hyp@opt\@GLSuseriv}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGLSuseriv}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSuseriv}[2][]{%
  \new@ifnextchar[{\@GLSuseriv@{#1}{#2}}{\@GLSuseriv@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuseriv}}
%    \begin{macrocode}
\def\@GLSuseriv@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryuseriv{#2}#3}}%
}
%    \end{macrocode}
%
% \cs{glsuserv} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{user5} key and it doesn't mark the entry
% as used.
%\begin{macro}{\glsuserv}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\glsuserv}{\@gls@hyp@opt\@glsuserv}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sglsuserv}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsuserv}[2][]{%
  \new@ifnextchar[{\@glsuserv@{#1}{#2}}{\@glsuserv@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuserv}}
%    \begin{macrocode}
\def\@glsuserv@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentryuserv{#2}#3}%
}
%    \end{macrocode}
%
% \cs{Glsuserv} behaves like \ics{glsuserv} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glsuserv}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Glsuserv}{\@gls@hyp@opt\@Glsuserv}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGlsuserv}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsuserv}[2][]{%
\new@ifnextchar[{\@Glsuserv@{#1}{#2}}{\@Glsuserv@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentryuserv}}
%    \begin{macrocode}
\def\@Glsuserv@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentryuserv{#2}#3}%
}
%    \end{macrocode}
%
% \cs{GLSuserv} behaves like \ics{glsuserv} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSuserv}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\GLSuserv}{\@gls@hyp@opt\@GLSuserv}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGLSuserv}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSuserv}[2][]{%
\new@ifnextchar[{\@GLSuserv@{#1}{#2}}{\@GLSuserv@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuserv}}
%    \begin{macrocode}
\def\@GLSuserv@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryuserv{#2}#3}}%
}
%    \end{macrocode}
%
% \cs{glsuservi} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{user6} key and it doesn't mark the entry
% as used.
%\begin{macro}{\glsuservi}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\glsuservi}{\@gls@hyp@opt\@glsuservi}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sglsuservi}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsuservi}[2][]{%
  \new@ifnextchar[{\@glsuservi@{#1}{#2}}{\@glsuservi@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuservi}}
%    \begin{macrocode}
\def\@glsuservi@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentryuservi{#2}#3}%
}
%    \end{macrocode}
%
% \cs{Glsuservi} behaves like \ics{glsuservi} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glsuservi}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Glsuservi}{\@gls@hyp@opt\@Glsuservi}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGlsuservi}}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsuservi}[2][]{%
  \new@ifnextchar[{\@Glsuservi@{#1}{#2}}{\@Glsuservi@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentryuservi}}
%    \begin{macrocode}
\def\@Glsuservi@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentryuservi{#2}#3}%
}
%    \end{macrocode}
%
% \cs{GLSuservi} behaves like \ics{glsuservi} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSuservi}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\GLSuservi}{\@gls@hyp@opt\@GLSuservi}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sGLSuservi}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSuservi}[2][]{%
  \new@ifnextchar[{\@GLSuservi@{#1}{#2}}{\@GLSuservi@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuservi}}
%    \begin{macrocode}
\def\@GLSuservi@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryuservi{#2}#3}}%
}
%    \end{macrocode}
%
% Now deal with acronym related keys. First the short form:
%\begin{macro}{\acrshort}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\acrshort}{\@gls@hyp@opt\ns@acrshort}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sacrshort}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@acrshort}[2][]{%
  \new@ifnextchar[{\@acrshort{#1}{#2}}{\@acrshort{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@acrshort#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
%    \end{macrocode}
%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment}
%    \begin{macrocode}
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}}
%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in
%\cs{@gls@link})}
%    \begin{macrocode}
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\glsentryshort{#2}}#3%
    }%
%    \end{macrocode}
%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}}
%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}}
% Call \cs{@gls@link}
% Note that \cs{@gls@link} sets \cs{glstype}.
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%
%\begin{macro}{\Acrshort}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Acrshort}{\@gls@hyp@opt\ns@Acrshort}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sAcrshort}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@Acrshort}[2][]{%
  \new@ifnextchar[{\@Acrshort{#1}{#2}}{\@Acrshort{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Acrshort#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
%    \end{macrocode}
%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment}
%    \begin{macrocode}
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}}
%    \begin{macrocode}
    \def\glslabel{#2}%
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@secondofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\Glsentryshort{#2}}#3%
    }%
%    \end{macrocode}
%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}}
%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}}
% Call \cs{@gls@link}
% Note that \cs{@gls@link} sets \cs{glstype}.
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%
%\begin{macro}{\ACRshort}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\ACRshort}{\@gls@hyp@opt\ns@ACRshort}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sACRshort}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@ACRshort}[2][]{%
  \new@ifnextchar[{\@ACRshort{#1}{#2}}{\@ACRshort{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@ACRshort#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
%    \end{macrocode}
%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment}
%    \begin{macrocode}
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}}
%    \begin{macrocode}
    \def\glslabel{#2}%
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@thirdofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \mfirstucMakeUppercase{\acronymfont{\glsentryshort{#2}}#3}%
    }%
%    \end{macrocode}
%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}}
%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}}
% Call \cs{@gls@link}
% Note that \cs{@gls@link} sets \cs{glstype}.
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%
% Short plural:
%\begin{macro}{\acrshortpl}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\acrshortpl}{\@gls@hyp@opt\ns@acrshortpl}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sacrshortpl}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@acrshortpl}[2][]{%
  \new@ifnextchar[{\@acrshortpl{#1}{#2}}{\@acrshortpl{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@acrshortpl#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
%    \end{macrocode}
%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment}
%    \begin{macrocode}
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}}
%    \begin{macrocode}
    \def\glslabel{#2}%
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\glsentryshortpl{#2}}#3%
    }%
%    \end{macrocode}
%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}}
%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}}
% Call \cs{@gls@link}
% Note that \cs{@gls@link} sets \cs{glstype}.
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%
%\begin{macro}{\Acrshortpl}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Acrshortpl}{\@gls@hyp@opt\ns@Acrshortpl}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sAcrshortpl}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@Acrshortpl}[2][]{%
  \new@ifnextchar[{\@Acrshortpl{#1}{#2}}{\@Acrshortpl{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Acrshortpl#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
%    \end{macrocode}
%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment}
%    \begin{macrocode}
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}}
%    \begin{macrocode}
    \def\glslabel{#2}%
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@secondofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\Glsentryshortpl{#2}}#3%
    }%
%    \end{macrocode}
%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}}
%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}}
% Call \cs{@gls@link}
% Note that \cs{@gls@link} sets \cs{glstype}.
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%
%\begin{macro}{\ACRshortpl}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\ACRshortpl}{\@gls@hyp@opt\ns@ACRshortpl}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sACRshortpl}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@ACRshortpl}[2][]{%
  \new@ifnextchar[{\@ACRshortpl{#1}{#2}}{\@ACRshortpl{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@ACRshortpl#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
%    \end{macrocode}
%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment}
%    \begin{macrocode}
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}}
%    \begin{macrocode}
    \def\glslabel{#2}%
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@thirdofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \mfirstucMakeUppercase{\acronymfont{\glsentryshortpl{#2}}#3}%
    }%
%    \end{macrocode}
%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}}
%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}}
% Call \cs{@gls@link}
% Note that \cs{@gls@link} sets \cs{glstype}.
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%
%\begin{macro}{\acrlong}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\acrlong}{\@gls@hyp@opt\ns@acrlong}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sacrlong}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@acrlong}[2][]{%
  \new@ifnextchar[{\@acrlong{#1}{#2}}{\@acrlong{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@acrlong#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
%    \end{macrocode}
%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment}
%    \begin{macrocode}
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}}
%    \begin{macrocode}
    \def\glslabel{#2}%
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
%    \end{macrocode}
%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}}
% Bug fix v4.02 removed \cs{acronymfont} from \cs{glscustomtext}
% (\cs{acronymfont} only designed for short form).
% \changes{4.02}{2013-12-05}{Removed \cs{acronymfont}}
%    \begin{macrocode}
    \def\glscustomtext{%
      \glsentrylong{#2}#3%
    }%
%    \end{macrocode}
%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}}
% Call \cs{@gls@link}
% Note that \cs{@gls@link} sets \cs{glstype}.
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%
%\begin{macro}{\Acrlong}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Acrlong}{\@gls@hyp@opt\ns@Acrlong}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sAcrlong}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@Acrlong}[2][]{%
  \new@ifnextchar[{\@Acrlong{#1}{#2}}{\@Acrlong{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Acrlong#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
%    \end{macrocode}
%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment}
%    \begin{macrocode}
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}}
%    \begin{macrocode}
    \def\glslabel{#2}%
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@secondofthree
    \let\glsinsert\@empty
%    \end{macrocode}
%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}}
% Bug fix v4.02 removed \cs{acronymfont} from \cs{glscustomtext}
% (\cs{acronymfont} only designed for short form).
% \changes{4.02}{2013-12-05}{Removed \cs{acronymfont}}
%    \begin{macrocode}
    \def\glscustomtext{%
      \Glsentrylong{#2}#3%
    }%
%    \end{macrocode}
%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}}
% Call \cs{@gls@link}.
% Note that \cs{@gls@link} sets \cs{glstype}.
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%
%\begin{macro}{\ACRlong}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\ACRlong}{\@gls@hyp@opt\ns@ACRlong}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sACRlong}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@ACRlong}[2][]{%
  \new@ifnextchar[{\@ACRlong{#1}{#2}}{\@ACRlong{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@ACRlong#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
%    \end{macrocode}
%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment}
%    \begin{macrocode}
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}}
%    \begin{macrocode}
    \def\glslabel{#2}%
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@thirdofthree
    \let\glsinsert\@empty
%    \end{macrocode}
%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}}
% Bug fix v4.02 removed \cs{acronymfont} from \cs{glscustomtext}
% (\cs{acronymfont} only designed for short form).
% \changes{4.02}{2013-12-05}{Removed \cs{acronymfont}}
%    \begin{macrocode}
    \def\glscustomtext{%
      \mfirstucMakeUppercase{\glsentrylong{#2}#3}%
    }%
%    \end{macrocode}
%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}}
% Call \cs{@gls@link}.
% Note that \cs{@gls@link} sets \cs{glstype}.
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%
% Short plural:
%\begin{macro}{\acrlongpl}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\acrlongpl}{\@gls@hyp@opt\ns@acrlongpl}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sacrlongpl}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@acrlongpl}[2][]{%
  \new@ifnextchar[{\@acrlongpl{#1}{#2}}{\@acrlongpl{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@acrlongpl#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
%    \end{macrocode}
%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment}
%    \begin{macrocode}
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}}
%    \begin{macrocode}
    \def\glslabel{#2}%
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
%    \end{macrocode}
%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}}
% Bug fix v4.02 removed \cs{acronymfont} from \cs{glscustomtext}
% (\cs{acronymfont} only designed for short form).
% \changes{4.02}{2013-12-05}{Removed \cs{acronymfont}}
%    \begin{macrocode}
    \def\glscustomtext{%
      \glsentrylongpl{#2}#3%
    }%
%    \end{macrocode}
%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}}
% Call \cs{@gls@link}.
% Note that \cs{@gls@link} sets \cs{glstype}.
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%
%\begin{macro}{\Acrlongpl}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Acrlongpl}{\@gls@hyp@opt\ns@Acrlongpl}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sAcrlongpl}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@Acrlongpl}[2][]{%
  \new@ifnextchar[{\@Acrlongpl{#1}{#2}}{\@Acrlongpl{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Acrlongpl#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
%    \end{macrocode}
%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment}
%    \begin{macrocode}
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}}
%    \begin{macrocode}
    \def\glslabel{#2}%
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@secondofthree
    \let\glsinsert\@empty
%    \end{macrocode}
%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}}
% Bug fix v4.02 removed \cs{acronymfont} from \cs{glscustomtext}
% (\cs{acronymfont} only designed for short form).
% \changes{4.02}{2013-12-05}{Removed \cs{acronymfont}}
%    \begin{macrocode}
    \def\glscustomtext{%
      \Glsentrylongpl{#2}#3%
    }%
%    \end{macrocode}
%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}}
% Call \cs{@gls@link}.
% Note that \cs{@gls@link} sets \cs{glstype}.
%\changes{4.15}{2015-03-16}{bug fix replaced \cs{@glo@type} with \cs{glstype}}
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%
%\begin{macro}{\ACRlongpl}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\ACRlongpl}{\@gls@hyp@opt\ns@ACRlongpl}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \cs{@sACRlongpl}}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@ACRlongpl}[2][]{%
  \new@ifnextchar[{\@ACRlongpl{#1}{#2}}{\@ACRlongpl{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@ACRlongpl#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
%    \end{macrocode}
%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment}
%    \begin{macrocode}
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}}
%    \begin{macrocode}
    \def\glslabel{#2}%
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@thirdofthree
    \let\glsinsert\@empty
%    \end{macrocode}
%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}}
% Bug fix v4.02 removed \cs{acronymfont} from \cs{glscustomtext}
% (\cs{acronymfont} only designed for short form).
% \changes{4.02}{2013-12-05}{Removed \cs{acronymfont}}
%    \begin{macrocode}
    \def\glscustomtext{%
      \mfirstucMakeUppercase{\glsentrylongpl{#2}#3}%
    }%
%    \end{macrocode}
%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}}
% Call \cs{@gls@link}.
% Note that \cs{@gls@link} sets \cs{glstype}.
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%
% \subsubsection{Displaying entry details without adding
% information to the glossary}
%\label{sec:code:glsnolink}
% 
% These commands merely display entry information without adding
% entries in the associated file or having hyperlinks.
%
%\begin{macro}{\@gls@entry@field}
% Generic version.
%\changes{4.03}{2014-01-20}{new}
%\begin{definition}
%\cs{@gls@entry@field}\marg{label}\marg{field}
%\end{definition}
%    \begin{macrocode}
\newcommand*{\@gls@entry@field}[2]{%
  \csname glo@\glsdetoklabel{#1}@#2\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsletentryfield}
%\changes{4.07}{2014-04-04}{new}
%\begin{definition}
%\cs{glsletentryfield}\marg{cs}\marg{label}\marg{field}
%\end{definition}
%    \begin{macrocode}
\newcommand*{\glsletentryfield}[3]{%
  \letcs{#1}{glo@\glsdetoklabel{#2}@#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Gls@entry@field}
% Generic first letter uppercase version.
%\changes{4.03}{2014-01-20}{new}
%\begin{definition}
%\cs{@Gls@entry@field}\marg{label}\marg{field}
%\end{definition}
%    \begin{macrocode}
\newcommand*{\@Gls@entry@field}[2]{%
  \glsdoifexistsordo{#1}%
  {%
    \letcs\@glo@text{glo@\glsdetoklabel{#1}@#2}%
    \ifdef\@glo@text
    {%
      \xmakefirstuc{\@glo@text}%
    }%
    {%
      ??\PackageError{glossaries}{The field `#2' doesn't exist for glossary 
      entry `\glsdetoklabel{#1}'}{Check you have correctly spelt the entry
      label and the field name}%
    }%
  }%
  {%
    ??%
  }%
}
%    \end{macrocode}
%\end{macro}
%
% Get the entry name (as specified by the \gloskey{name} key
% when the entry was defined). The argument
% is the label associated with the entry. Note that unless you
% used \texttt{name=false} in the \pkgopt{sanitize} package option 
% you may get unexpected results if the \gloskey{name} key contains 
% any commands.
%\begin{macro}{\glsentryname}
%    \begin{macrocode}
\newcommand*{\glsentryname}[1]{\@gls@entry@field{#1}{name}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryname}
%\changes{3.09a}{2013-10-09}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\Glsentryname}[1]{%
  \@Gls@entryname{#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Gls@entryname}
%\changes{4.10}{2014-08-27}{new}
% This is a workaround in the event that the user defies the warning
% in the manual about not using \cs{Glsname} or \cs{Glsentryname} with acronyms.
% First the default behaviour:
%    \begin{macrocode}
\newcommand*{\@Gls@entryname}[1]{%
  \@Gls@entry@field{#1}{name}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@Gls@acrentryname}
%\changes{4.10}{2014-08-27}{new}
% Now the behaviour when \cs{setacronymstyle} is used:
%    \begin{macrocode}
\newcommand*{\@Gls@acrentryname}[1]{%
  \ifglshaslong{#1}%
  {%
    \letcs\@glo@text{glo@\glsdetoklabel{#1}@name}%
%    \end{macrocode}
%\cs{@gls@getbody} is defined by \sty{mfirstuc} (which used to be
%part of \styfmt{glossaries}).
%    \begin{macrocode}
    \expandafter\@gls@getbody\@glo@text{}\@nil
    \expandafter\ifx\@gls@body\glsentrylong\relax
      \expandafter\Glsentrylong\@gls@rest
    \else
      \expandafter\ifx\@gls@body\glsentryshort\relax
        \expandafter\Glsentryshort\@gls@rest
      \else
        \expandafter\ifx\@gls@body\acronymfont\relax
%    \end{macrocode}
% Temporarily make \cs{glsentryshort} behave like
% \cs{Glsentryshort}. (This is on the assumption that the argument
% of \cs{acronymfont} is \cs{glsentryshort}\marg{label}, as that's
% the behaviour of the predefined acronym styles.)
% This is scoped to localise the effect of the assignment.
%    \begin{macrocode}
         {%
            \let\glsentryshort\Glsentryshort
            \@glo@text
         }%
        \else
%    \end{macrocode}
%\changes{4.45}{2020-02-13}{added check for \cs{glsshortaccessdisplay}}
%    \begin{macrocode}
          \expandafter\ifx\@gls@body\glsshortaccessdisplay\relax
            {%
              \let\glsentryshort\Glsentryshort
              \@glo@text
            }%
          \else
            \xmakefirstuc{\@glo@text}%
          \fi
        \fi
      \fi
    \fi
  }%
  {%
%    \end{macrocode}
% Not an acronym
%    \begin{macrocode}
    \@Gls@entry@field{#1}{name}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
% Get the entry description (as specified by the 
% \gloskey{description} when the entry was defined). The argument
% is the label associated with the entry. Note that unless you
% used \texttt{description=false} in the \pkgopt{sanitize} package 
% option you may get unexpected results if the \gloskey{description} 
% key contained any commands.
%\begin{macro}{\glsentrydesc}
%    \begin{macrocode}
\newcommand*{\glsentrydesc}[1]{\@gls@entry@field{#1}{desc}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentrydesc}
%\changes{3.09a}{2013-10-09}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\Glsentrydesc}[1]{%
  \@Gls@entry@field{#1}{desc}%
}
%    \end{macrocode}
%\end{macro}
% Plural form:
%\begin{macro}{\glsentrydescplural}
%\changes{1.12}{2008-03-08}{New}
%    \begin{macrocode}
\newcommand*{\glsentrydescplural}[1]{%
  \@gls@entry@field{#1}{descplural}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentrydescplural}
%\changes{1.12}{2008-03-08}{New}
%\changes{3.09a}{2013-10-09}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\Glsentrydescplural}[1]{%
  \@Gls@entry@field{#1}{descplural}%
}
%    \end{macrocode}
%\end{macro}
%
% Get the entry text, as specified by the \gloskey{text} key when
% the entry was defined. The argument
% is the label associated with the entry:
%\begin{macro}{\glsentrytext}
%    \begin{macrocode}
\newcommand*{\glsentrytext}[1]{\@gls@entry@field{#1}{text}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentrytext}
%\changes{3.09a}{2013-10-09}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\Glsentrytext}[1]{%
  \@Gls@entry@field{#1}{text}%
}
%    \end{macrocode}
%\end{macro}
%
% Get the plural form:
%\begin{macro}{\glsentryplural}
%    \begin{macrocode}
\newcommand*{\glsentryplural}[1]{%
  \@gls@entry@field{#1}{plural}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryplural}
%\changes{3.09a}{2013-10-09}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\Glsentryplural}[1]{%
  \@Gls@entry@field{#1}{plural}%
}
%    \end{macrocode}
%\end{macro}
%
% Get the symbol associated with this entry. The argument
% is the label associated with the entry.
%\begin{macro}{\glsentrysymbol}
%    \begin{macrocode}
\newcommand*{\glsentrysymbol}[1]{%
  \@gls@entry@field{#1}{symbol}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentrysymbol}
%\changes{3.09a}{2013-10-09}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\Glsentrysymbol}[1]{%
  \@Gls@entry@field{#1}{symbol}%
}
%    \end{macrocode}
%\end{macro}
% Plural form:
%\begin{macro}{\glsentrysymbolplural}
%\changes{1.12}{2008-03-08}{New}
%    \begin{macrocode}
\newcommand*{\glsentrysymbolplural}[1]{%
  \@gls@entry@field{#1}{symbolplural}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentrysymbolplural}
%\changes{1.12}{2008-03-08}{New}
%\changes{3.09a}{2013-10-09}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\Glsentrysymbolplural}[1]{%
  \@Gls@entry@field{#1}{symbolplural}%
}
%    \end{macrocode}
%\end{macro}
%
% Get the entry text to be used when the entry is first used in
% the document (as specified by the \gloskey{first} key when
% the entry was defined).
%\begin{macro}{\glsentryfirst}
%    \begin{macrocode}
\newcommand*{\glsentryfirst}[1]{%
  \@gls@entry@field{#1}{first}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryfirst}
%\changes{3.09a}{2013-10-09}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\Glsentryfirst}[1]{%
  \@Gls@entry@field{#1}{first}%
}
%    \end{macrocode}
%\end{macro}
%
% Get the plural form (as specified by the \gloskey{firstplural}
% key when the entry was defined).
%\begin{macro}{\glsentryfirstplural}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\glsentryfirstplural}[1]{%
  \@gls@entry@field{#1}{firstpl}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryfirstplural}
%\changes{3.09a}{2013-10-09}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\Glsentryfirstplural}[1]{%
  \@Gls@entry@field{#1}{firstpl}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glscapitalisewords}
%\changes{4.48}{2021-10-19}{new}
% Make it easier to switch from \cs{capitalisewords} to
% \cs{capitalisefmtwords}.
%    \begin{macrocode}
\newcommand{\glscapitalisewords}[1]{%
  \capitalisewords{#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentrytitlecase}
%\changes{4.22}{2016-04-19}{new}
%\changes{4.45}{2020-02-13}{added existence check}
%    \begin{macrocode}
\newrobustcmd*{\@glsentrytitlecase}[2]{%
  \glsdoifexists{#1}%
  {%
    \glsfieldfetch{#1}{#2}{\@gls@value}%
    \expandafter\glscapitalisewords\expandafter{\@gls@value}%
  }%
}
\ifdef\texorpdfstring
{
  \newcommand*{\glsentrytitlecase}[2]{%
    \texorpdfstring
      {\@glsentrytitlecase{#1}{#2}}%
      {\@gls@entry@field{#1}{#2}}%
  }
}
{
  \newcommand*{\glsentrytitlecase}[2]{\@glsentrytitlecase{#1}{#2}}
}
%    \end{macrocode}
%\end{macro}
%
% Display the glossary type with which this entry is associated
% (as specified by the \gloskey{type} key used when the entry was 
% defined)
%\begin{macro}{\glsentrytype}
%    \begin{macrocode}
\newcommand*{\glsentrytype}[1]{\@gls@entry@field{#1}{type}}
%    \end{macrocode}
%\end{macro}
%
% Display the sort text used for this entry. Note that the 
% \gloskey{sort} key is sanitize, so unexpected results may 
% occur if the \gloskey{sort} key contained commands.
%\begin{macro}{\glsentrysort}
%    \begin{macrocode}
\newcommand*{\glsentrysort}[1]{%
  \@gls@entry@field{#1}{sort}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryparent}
%Expands to the label of the entry's parent.
%\changes{4.45}{2020-02-13}{new}
%    \begin{macrocode}
\newcommand*{\glsentryparent}[1]{%
  \@gls@entry@field{#1}{parent}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryuseri}
% Get the first user key (as specified by the 
% \gloskey{user1} when the entry was defined). The argument
% is the label associated with the entry.
%\changes{2.04}{2009-11-10}{new}
%    \begin{macrocode}
\newcommand*{\glsentryuseri}[1]{%
  \@gls@entry@field{#1}{useri}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryuseri}
%\changes{2.04}{2009-11-10}{new}
%\changes{3.09a}{2013-10-09}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\Glsentryuseri}[1]{%
  \@Gls@entry@field{#1}{useri}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryuserii}
% Get the second user key (as specified by the 
% \gloskey{user2} when the entry was defined). The argument
% is the label associated with the entry.
%\changes{2.04}{2009-11-10}{new}
%    \begin{macrocode}
\newcommand*{\glsentryuserii}[1]{%
  \@gls@entry@field{#1}{userii}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryuserii}
%\changes{2.04}{2009-11-10}{new}
%\changes{3.09a}{2013-10-09}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\Glsentryuserii}[1]{%
  \@Gls@entry@field{#1}{userii}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryuseriii}
% Get the third user key (as specified by the 
% \gloskey{user3} when the entry was defined). The argument
% is the label associated with the entry.
%\changes{2.04}{2009-11-10}{new}
%    \begin{macrocode}
\newcommand*{\glsentryuseriii}[1]{%
  \@gls@entry@field{#1}{useriii}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryuseriii}
%\changes{2.04}{2009-11-10}{new}
%\changes{3.09a}{2013-10-09}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\Glsentryuseriii}[1]{%
  \@Gls@entry@field{#1}{useriii}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryuseriv}
% Get the fourth user key (as specified by the 
% \gloskey{user4} when the entry was defined). The argument
% is the label associated with the entry.
%\changes{2.04}{2009-11-10}{new}
%    \begin{macrocode}
\newcommand*{\glsentryuseriv}[1]{%
  \@gls@entry@field{#1}{useriv}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryuseriv}
%\changes{2.04}{2009-11-10}{new}
%\changes{3.09a}{2013-10-09}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\Glsentryuseriv}[1]{%
  \@Gls@entry@field{#1}{useriv}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryuserv}
% Get the fifth user key (as specified by the 
% \gloskey{user5} when the entry was defined). The argument
% is the label associated with the entry.
%\changes{2.04}{2009-11-10}{new}
%    \begin{macrocode}
\newcommand*{\glsentryuserv}[1]{%
  \@gls@entry@field{#1}{userv}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryuserv}
%\changes{2.04}{2009-11-10}{new}
%\changes{3.09a}{2013-10-09}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\Glsentryuserv}[1]{%
  \@Gls@entry@field{#1}{userv}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryuservi}
% Get the sixth user key (as specified by the 
% \gloskey{user6} when the entry was defined). The argument
% is the label associated with the entry.
%\changes{2.04}{2009-11-10}{new}
%    \begin{macrocode}
\newcommand*{\glsentryuservi}[1]{%
  \@gls@entry@field{#1}{uservi}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryuservi}
%\changes{2.04}{2009-11-10}{new}
%\changes{3.09a}{2013-10-09}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\Glsentryuservi}[1]{%
  \@Gls@entry@field{#1}{uservi}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryshort}
% Get the short key (as specified by the 
% \gloskey{short} the entry was defined). The argument
% is the label associated with the entry.
%\changes{3.0}{2011-04-02}{new}
%    \begin{macrocode}
\newcommand*{\glsentryshort}[1]{\@gls@entry@field{#1}{short}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryshort}
%\changes{3.0}{2011-04-02}{new}
%\changes{3.09a}{2013-10-09}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\Glsentryshort}[1]{%
  \@Gls@entry@field{#1}{short}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryshortpl}
% Get the short plural key (as specified by the 
% \gloskey{shortplural} the entry was defined). The argument
% is the label associated with the entry.
%\changes{3.0}{2011-04-02}{new}
%    \begin{macrocode}
\newcommand*{\glsentryshortpl}[1]{\@gls@entry@field{#1}{shortpl}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryshortpl}
%\changes{3.0}{2011-04-02}{new}
%\changes{3.09a}{2013-10-09}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\Glsentryshortpl}[1]{%
  \@Gls@entry@field{#1}{shortpl}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentrylong}
% Get the long key (as specified by the 
% \gloskey{long} the entry was defined). The argument
% is the label associated with the entry.
%\changes{3.0}{2011-04-02}{new}
%    \begin{macrocode}
\newcommand*{\glsentrylong}[1]{\@gls@entry@field{#1}{long}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentrylong}
%\changes{3.0}{2011-04-02}{new}
%\changes{3.09a}{2013-10-09}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\Glsentrylong}[1]{%
  \@Gls@entry@field{#1}{long}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentrylongpl}
% Get the long plural key (as specified by the 
% \gloskey{longplural} the entry was defined). The argument
% is the label associated with the entry.
%\changes{3.0}{2011-04-02}{new}
%    \begin{macrocode}
\newcommand*{\glsentrylongpl}[1]{\@gls@entry@field{#1}{longpl}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentrylongpl}
%\changes{3.0}{2011-04-02}{new}
%\changes{3.09a}{2013-10-09}{made robust}
%    \begin{macrocode}
\newrobustcmd*{\Glsentrylongpl}[1]{%
  \@Gls@entry@field{#1}{longpl}%
}
%    \end{macrocode}
%\end{macro}
%
% Short cut macros to access full form:
%\begin{macro}{\glsentryfull}
%\changes{3.13a}{2013-11-05}{changed to use \cs{acrfullformat}}
%\changes{4.02}{2013-12-05}{bug fix: added missing \cs{acronymfont}}
%    \begin{macrocode}
\newcommand*{\glsentryfull}[1]{%
  \acrfullformat{\glsentrylong{#1}}{\acronymfont{\glsentryshort{#1}}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryfull}
%\changes{3.09a}{2013-10-09}{made robust}
%\changes{3.02}{2012-05-21}{fixed bug (replaced \cs{glsentryshortpl}
%with \cs{glsentryshort})}
%\changes{3.13a}{2013-11-05}{changed to use \cs{acrfullformat}}
%\changes{4.02}{2013-12-05}{bug fix: added missing \cs{acronymfont}}
%    \begin{macrocode}
\newrobustcmd*{\Glsentryfull}[1]{%
  \acrfullformat{\Glsentrylong{#1}}{\acronymfont{\glsentryshort{#1}}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentryfullpl}
%\changes{3.02}{2012-05-21}{fixed bug (replaced \cs{glsentryshort}
%with \cs{glsentryshortpl})}
%\changes{3.13a}{2013-11-05}{changed to use \cs{acrfullformat}}
%\changes{4.02}{2013-12-05}{bug fix: added missing \cs{acronymfont}}
%    \begin{macrocode}
\newcommand*{\glsentryfullpl}[1]{%
  \acrfullformat{\glsentrylongpl{#1}}{\acronymfont{\glsentryshortpl{#1}}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryfullpl}
%\changes{3.09a}{2013-10-09}{made robust}
%\changes{3.13a}{2013-11-05}{changed to use \cs{acrfullformat}}
%\changes{4.02}{2013-12-05}{bug fix: added missing \cs{acronymfont}}
%    \begin{macrocode}
\newrobustcmd*{\Glsentryfullpl}[1]{%
  \acrfullformat{\Glsentrylongpl{#1}}{\acronymfont{\glsentryshortpl{#1}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentrynumberlist}
%\changes{3.02}{2012-05-21}{new}
%Displays the number list as is.
%    \begin{macrocode}
\newcommand*{\glsentrynumberlist}[1]{%
  \glsdoifexists{#1}%
  {%
    \@gls@entry@field{#1}{numberlist}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdisplaynumberlist}
%\changes{3.02}{2012-05-21}{new}
% Formats the number list for the given entry label.
% Doesn't work with hyperref.
%    \begin{macrocode}
\@ifpackageloaded{hyperref} {%
  \newcommand*{\glsdisplaynumberlist}[1]{%
    \GlossariesWarning
    {%
      \string\glsdisplaynumberlist\space
      doesn't work with hyperref.^^JUsing
      \string\glsentrynumberlist\space instead%
    }%
    \glsentrynumberlist{#1}%
  }%
}%
{%
  \newcommand*{\glsdisplaynumberlist}[1]{%
    \glsdoifexists{#1}%
    {%
      \bgroup
%    \end{macrocode}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
         \protected@edef\@glo@label{\glsdetoklabel{#1}}%
         \let\@org@glsnumberformat\glsnumberformat
         \def\glsnumberformat##1{##1}%
         \protected@edef\the@numberlist{%
           \csname glo@\@glo@label @numberlist\endcsname}%
         \def\@gls@numlist@sep{}%
         \def\@gls@numlist@nextsep{}%
         \def\@gls@numlist@lastsep{}%
         \def\@gls@thislist{}%
         \def\@gls@donext@def{}%
         \renewcommand\do[1]{%
           \protected@edef\@gls@thislist{%
             \@gls@thislist
             \noexpand\@gls@numlist@sep 
             ##1%
           }%
           \let\@gls@numlist@sep\@gls@numlist@nextsep
           \def\@gls@numlist@nextsep{\glsnumlistsep}%
           \@gls@donext@def
           \def\@gls@donext@def{%
             \def\@gls@numlist@lastsep{\glsnumlistlastsep}%
           }%
         }%
         \expandafter \glsnumlistparser \expandafter{\the@numberlist}%
         \let\@gls@numlist@sep\@gls@numlist@lastsep
         \@gls@thislist
      \egroup
    }%
  }
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsnumlistsep}
%\changes{3.02}{2012-05-19}{new}
%    \begin{macrocode}
\newcommand*{\glsnumlistsep}{, }
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsnumlistlastsep}
%\changes{3.02}{2012-05-19}{new}
%    \begin{macrocode}
\newcommand*{\glsnumlistlastsep}{ \& }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glshyperlink}
% Provide a hyperlink to a glossary entry without adding information
% to the glossary file. The entry needs to be added using a 
% command like \ics{glslink} or \ics{glsadd} to ensure that
% the target is defined. The first (optional) argument specifies
% the link text. The entry name is used by default. The second
% argument is the entry label.
%\changes{1.17}{2008-12-26}{new}
%\changes{3.0}{2011-04-02}{changed default from \cs{glsentryname}
%to \cs{glsentrytext}}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\glshyperlink}[2][\glsentrytext{\@glo@label}]{%
 \def\@glo@label{#2}%
 \@glslink{\glolinkprefix\glsdetoklabel{#2}}{#1}}
%    \end{macrocode}
%\end{macro}
%
%\section{Adding an entry to the glossary without generating
% text}
% The following keys are provided for \cs{glsadd} and 
% \cs{glsaddall}:
%    \begin{macrocode}
\define@key{glossadd}{counter}{\def\@gls@counter{#1}}
%    \end{macrocode}
%\changes{2.07}{2010-07-10}{glsadd format key stored in \cs{@glsnumberformat}
%(was mistakenly stored in \cs{@glo@format})}
%    \begin{macrocode}
\define@key{glossadd}{format}{\def\@glsnumberformat{#1}}
%    \end{macrocode}
% This key is only used by \cs{glsaddall}:
%    \begin{macrocode}
\define@key{glossadd}{types}{\def\@glo@type{#1}}
%    \end{macrocode}
%
%\begin{definition}
%\cs{glsadd}\oarg{options}\marg{label}
%\end{definition}
% Add a term to the glossary without generating any link text. 
% The optional argument indicates which counter to use, 
% and how to format it (using a key-value list)
% the second argument is the entry label. Note that \meta{options}
% only has two keys: \gloskey[glsadd]{counter} and \gloskey[glsadd]{format} (the \gloskey[glsaddall]{types} key will be ignored).
%\begin{macro}{\glsadd}
%\changes{1.07}{2007-09-13}{fixed bug caused by \cs{theglsentrycounter} setting the page number too soon}
%\changes{2.04}{2009-11-10}{fixed bug that ignored counter}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.12}{2014-11-22}{added check for vertical mode}
%    \begin{macrocode}
\newrobustcmd*{\glsadd}[2][]{%
%    \end{macrocode}
% Need to move to horizontal mode if not already in it, but only if
% not in preamble.
%    \begin{macrocode}
  \@gls@adjustmode
  \glsdoifexists{#2}%
  {%
    \def\@glsnumberformat{glsnumberformat}%
%    \end{macrocode}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
    \protected@edef\@gls@counter{\csname glo@\glsdetoklabel{#2}@counter\endcsname}%
    \setkeys{glossadd}{#1}%
%    \end{macrocode}
% Store the entry's counter in \cs{theglsentrycounter}
%\changes{3.0}{2011-04-02}{added \cs{@gls@saveentrycounter}}
%\changes{4.16}{2015-07-08}{changed \cs{@do@wrglossary} to
%\cs{@@do@wrglossary}}
%    \begin{macrocode}
    \@gls@saveentrycounter
%    \end{macrocode}
% Define sort key if necessary:
%\changes{4.35}{2017-11-14}{added \cs{@gls@setsort} (in case of
%\pkgopt[use]{sort})}
%    \begin{macrocode}
    \@gls@setsort{#2}%
%    \end{macrocode}
% This should use \cs{@@do@wrglossary} rather than
% \cs{@do@wrglossary} since the whole point of \cs{glsadd} is to add
% a line to the glossary.
%    \begin{macrocode}
    \@@do@wrglossary{#2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@adjustmode}
%\changes{4.12}{2014-11-22}{new}
%    \begin{macrocode}
\newcommand*{\@gls@adjustmode}{}
\AtBeginDocument{\renewcommand*{\@gls@adjustmode}{\ifvmode\mbox{}\fi}}
%    \end{macrocode}
%\end{macro}
%
%\begin{definition}
%\cs{glsaddall}\oarg{option list}
%\end{definition}
% Add all terms defined for the listed glossaries (without displaying
% any text). If \gloskey[glsaddall]{types} key is omitted, apply to all
% glossary types.
%\begin{macro}{\glsaddall}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
\newrobustcmd*{\glsaddall}[1][]{%
  \protected@edef\@glo@type{\@glo@types}%
  \setkeys{glossadd}{#1}%
  \forallglsentries[\@glo@type]{\@glo@entry}{%
    \glsadd[#1]{\@glo@entry}%
  }%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsaddallunused}
%\begin{definition}
%\cs{glsaddallunused}\oarg{glossary type}
%\end{definition}
% Add all used terms defined for the listed glossaries (without displaying
% any text). If optional argument is omitted, apply to all
% glossary types. This should typically go at the end of the
% document.
%\changes{3.08a}{2013-09-28}{new}
%\changes{3.13a}{2013-11-05}{set default to \cs{@glo@types}}
%\changes{4.12}{2014-11-22}{replaced @gobble with glsignore}
%    \begin{macrocode}
\newrobustcmd*{\glsaddallunused}[1][\@glo@types]{%
 \forallglsentries[#1]{\@glo@entry}%
 {%
    \ifglsused{\@glo@entry}{}{\glsadd[format=glsignore]{\@glo@entry}}%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsignore}
%\changes{4.12}{2014-11-22}{new}
%    \begin{macrocode}
\newcommand*{\glsignore}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\section{Creating associated files}
% The \cs{writeist} command creates the associated 
% customized \filetype{.ist} \app{makeindex} style file.
% While defining this command, some characters have their 
% catcodes temporarily changed to ensure they get written to 
% the \filetype{.ist} file correctly. The \app{makeindex} 
% actual character (usually "@") is redefined to be a "?", to allow 
% internal commands to be written to the glossary file output file.
%
% The special characters\mkidxspch\ are stored in \cs{@gls@actualchar},
% \cs{@gls@encapchar}, \cs{@glsl@levelchar} and
% \cs{@gls@quotechar} to make them easier to use later,
% but don't change these values, because the characters are
% encoded in the command definitions that are used to escape
% the special characters (which means that the user no longer
% needs to worry about \app{makeindex} special characters).
%
% The symbols and numbers label for group headings are hardwired into
% the \filetype{.ist} file as \texttt{glssymbols} and 
% \texttt{glsnumbers}, the group titles can be translated 
% (so that \ics{glssymbolsgroupname} replaces \texttt{glssymbols}
% and \ics{glsnumbersgroupname} replaces \texttt{glsnumbers})
% using the command \ics{glsgetgrouptitle} which is
% defined in \isty{glossary-hypernav}. This is done to prevent
% any problem characters in \ics{glssymbolsgroupname}
% and \ics{glsnumbersgroupname} from breaking hyperlinks.
%
%\begin{macro}{\glsopenbrace}
% Define \cs{glsopenbrace} to make it easier to write an opening 
% brace to a file.
%    \begin{macrocode}
\edef\glsopenbrace{\expandafter\@gobble\string\{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsclosebrace}
% Define \cs{glsclosebrace} to make it easier to write an opening 
% brace to a file.
%    \begin{macrocode}
\edef\glsclosebrace{\expandafter\@gobble\string\}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsbackslash}
%\changes{4.11}{2014-09-01}{new}
% Define \cs{glsbackslash} to make it easier to write a backslash to a file.
%    \begin{macrocode}
\edef\glsbackslash{\expandafter\@gobble\string\\}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsquote}
% Define command that makes it easier to write quote marks to
% a file in the event that the double quote character has been
% made active.
%    \begin{macrocode}
\edef\glsquote#1{\string"#1\string"}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glspercentchar}
%\changes{4.10}{2014-08-27}{new}
% Define \cs{glspercentchar} to make it easier to write a percent
% character to a file.
%    \begin{macrocode}
\edef\glspercentchar{\expandafter\@gobble\string\%}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glstildechar}
%\changes{4.10}{2014-08-27}{new}
% Define \cs{glstildechar} to make it easier to write a tilde
% character to a file.
%    \begin{macrocode}
\edef\glstildechar{\string~}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsfirstletter}
% Define the first letter to come after the digits 0,\ldots,9.
% Only required for \app{xindy}.
%    \begin{macrocode}
\ifglsxindy
  \newcommand*{\@glsfirstletter}{A}
\fi
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\GlsSetXdyFirstLetterAfterDigits}
%\changes{4.33}{2017-09-20}{added starred version}
% Sets the first letter to come after the digits 0,\ldots,9.
%The starred version sanitizes.
%    \begin{macrocode}
\newcommand*{\GlsSetXdyFirstLetterAfterDigits}{%
  \@ifstar\s@GlsSetXdyFirstLetterAfterDigits\@GlsSetXdyFirstLetterAfterDigits}
\ifglsxindy
  \newcommand*{\@GlsSetXdyFirstLetterAfterDigits}[1]{%
    \renewcommand*{\@glsfirstletter}{#1}}
  \newcommand*{\s@GlsSetXdyFirstLetterAfterDigits}[1]{%
    \renewcommand*{\@glsfirstletter}{#1}%
    \@onelevel@sanitize\@glsfirstletter
  }
\else
  \newcommand*{\@GlsSetXdyFirstLetterAfterDigits}[1]{%
    \glsnoxindywarning\GlsSetXdyFirstLetterAfterDigits}
  \newcommand*{\s@GlsSetXdyFirstLetterAfterDigits}{%
    \@GlsSetXdyFirstLetterAfterDigits
  }
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@xdynumbergrouporder}
% Specifies the order of the number group.
%    \begin{macrocode}
\ifglsxindy
  \newcommand*{\@xdynumbergrouporder}{:before \string"\@glsfirstletter\string"}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsSetXdyNumberGroupOrder}
%\changes{4.33}{2017-09-20}{new}
% Sets the relative location of the number group.
%The starred version sanitizes.
%    \begin{macrocode}
\newcommand*{\GlsSetXdyNumberGroupOrder}[1]{%
 \@ifstar\s@GlsSetXdyNumberGroupOrder\@GlsSetXdyNumberGroupOrder
}
\ifglsxindy
  \newcommand*{\@GlsSetXdyNumberGroupOrder}[1]{%
    \renewcommand*{\@xdynumbergrouporder}{#1}%
  }
  \newcommand*{\s@GlsSetXdyNumberGroupOrder}[1]{%
    \renewcommand*{\@xdynumbergrouporder}{#1}%
    \@onelevel@sanitize\@xdynumbergrouporder
  }
\else
  \newcommand*{\@GlsSetXdyNumberGroupOrder}[1]{%
    \glsnoxindywarning\GlsSetXdyNumberGroupOrder}
  \newcommand*{\s@GlsSetXdyNumberGroupOrder}{%
    \@GlsSetXdyNumberGroupOrder}
\fi
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{\@glsminrange}
% Define the minimum number of successive location references
% to merge into a range.
%    \begin{macrocode}
\newcommand*{\@glsminrange}{2}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\GlsSetXdyMinRangeLength}
% Set the minimum range length. The value must either be "none"
% or a positive integer. The \sty{glossaries} package doesn't
% check if the argument is valid, that is left to \app{xindy}.
%    \begin{macrocode}
\ifglsxindy
  \newcommand*{\GlsSetXdyMinRangeLength}[1]{%
    \renewcommand*{\@glsminrange}{#1}}
\else
  \newcommand*{\GlsSetXdyMinRangeLength}[1]{%
    \glsnoxindywarning\GlsSetXdyMinRangeLength}
\fi
%    \end{macrocode}
%\end{macro}

%\begin{macro}{\writeist}
%\changes{1.17}{2008-12-26}{added xindy support}
%\changes{1.01}{2007-05-17}{Added spaces after \cs{delimN} and
%\cs{delimR} in ist file}%
%\changes{3.0}{2011-04-02}{modified to support new format}
%    \begin{macrocode}
\ifglsxindy
%    \end{macrocode}
% Code to use if \app{xindy} is required.
%    \begin{macrocode}
  \def\writeist{%
%    \end{macrocode}
% Define write register if not already defined
%\changes{4.04}{2014-03-06}{checked for definition of \cs{glswrite}}
%    \begin{macrocode}
    \ifundef{\glswrite}{\newwrite\glswrite}{}%
%    \end{macrocode}
% Update attributes list
%    \begin{macrocode}
    \@gls@addpredefinedattributes
%    \end{macrocode}
% Open the file.
%    \begin{macrocode}
    \openout\glswrite=\istfilename
%    \end{macrocode}
% Write header comment at the start of the file
%    \begin{macrocode}
    \write\glswrite{;; xindy style file created by the glossaries
        package}%
    \write\glswrite{;; for document '\jobname' on 
       \the\year-\the\month-\the\day}%
%    \end{macrocode}
% Specify the required styles
%    \begin{macrocode}
    \write\glswrite{^^J; required styles^^J}
    \@for\@xdystyle:=\@xdyrequiredstyles\do{%
         \ifx\@xdystyle\@empty
         \else
           \protected@write\glswrite{}{(require 
             \string"\@xdystyle.xdy\string")}%
         \fi
    }%
%    \end{macrocode}
% List the allowed attributes (possible values used by the
% \gloskey{format} key)
%    \begin{macrocode}
    \write\glswrite{^^J%
       ; list of allowed attributes (number formats)^^J}%
    \write\glswrite{(define-attributes ((\@xdyattributes)))}%
%    \end{macrocode}
% Define any additional alphabets
%    \begin{macrocode}
    \write\glswrite{^^J; user defined alphabets^^J}%
    \write\glswrite{\@xdyuseralphabets}%
%    \end{macrocode}
% Define location classes.
%    \begin{macrocode}
    \write\glswrite{^^J; location class definitions^^J}%
%    \end{macrocode}
% As from version 3.0, locations are now specified as
% \marg{Hprefix}\marg{number}, so need to add all possible
% combinations of location types.
%    \begin{macrocode}
    \@for\@gls@classI:=\@gls@xdy@locationlist\do{%
%    \end{macrocode}
% Case where \meta{Hprefix} is empty:
%    \begin{macrocode}
      \protected@write\glswrite{}{(define-location-class
        \string"\@gls@classI\string"^^J\space\space\space
        (
          :sep "{}{"
          \csname @gls@xdy@Lclass@\@gls@classI\endcsname\space
          :sep "}"
        )
        ^^J\space\space\space
        :min-range-length \@glsminrange^^J%
        )
      }%
%    \end{macrocode}
% Nested iteration over all classes:
%    \begin{macrocode}
      {%
        \@for\@gls@classII:=\@gls@xdy@locationlist\do{%
          \protected@write\glswrite{}{(define-location-class
            \string"\@gls@classII-\@gls@classI\string"
              ^^J\space\space\space
            (
              :sep "{"
              \csname @gls@xdy@Lclass@\@gls@classII\endcsname\space
              :sep "}{"
              \csname @gls@xdy@Lclass@\@gls@classI\endcsname\space
              :sep "}"
            )
            ^^J\space\space\space
            :min-range-length \@glsminrange^^J%
            )
          }%
        }%
      }%
    }%
%    \end{macrocode}
% User defined location classes (needs checking for new location format).
%    \begin{macrocode}
    \write\glswrite{^^J; user defined location classes}%
    \write\glswrite{\@xdyuserlocationdefs}%
%    \end{macrocode}
% Cross-reference class. (The unverified option is used as the
% cross-references are supplied using the list of labels along with
% the optional argument for \ics{glsseeformat} which
% \app{xindy} won't recognise.)
%    \begin{macrocode}
    \write\glswrite{^^J; define cross-reference class^^J}%
    \write\glswrite{(define-crossref-class \string"see\string"
        :unverified )}%
%    \end{macrocode}
% Define how cross-references should be displayed. This adds an
% empty set of braces after the cross-referencing information 
% allowing for the final argument of \cs{glsseeformat} which
% gets ignored. (When using \app{makeindex} this final argument
% contains the location information which is not required.)
%    \begin{macrocode}
    \write\glswrite{(markup-crossref-list
         :class \string"see\string"^^J\space\space\space
         :open \string"\string\glsseeformat\string"
         :close \string"{}\string")}%
%    \end{macrocode}
% Provide hook to write extra material here (used by
% \sty{glossaries-extra} to define a seealso class).
%    \begin{macrocode}
    \@xdycrossrefhook
%    \end{macrocode}
% List the order to sort the classes.
%    \begin{macrocode}
    \write\glswrite{^^J; define the order of the location classes}%
    \write\glswrite{(define-location-class-order
         (\@xdylocationclassorder))}%
%    \end{macrocode}
% Specify what to write to the start and end of the glossary file.
%    \begin{macrocode}
    \write\glswrite{^^J; define the glossary markup^^J}%
%    \end{macrocode}
%\changes{3.0}{2011-04-02}{added xindy-only macro definitions to
%glossary open tag}
%    \begin{macrocode}
    \write\glswrite{(markup-index^^J\space\space\space
        :open \string"\string
        \glossarysection[\string\glossarytoctitle]{\string
        \glossarytitle}\string\glossarypreamble}%
%    \end{macrocode}
% Add all the xindy-only macro definitions (needed to prevent errors
% in the event that the user changes from \pkgopt{xindy} to
% \pkgopt{makeindex})
%    \begin{macrocode}
    \@for\@this@ctr:=\@xdycounters\do{%
      {%
        \@for\@this@attr:=\@xdyattributelist\do{%
           \protected@write\glswrite{}{\string\providecommand*%
             \expandafter\string
             \csname glsX\@this@ctr X\@this@attr\endcsname[2]%
             {%
                \string\setentrycounter
                  [\expandafter\@gobble\string\#1]{\@this@ctr}%
                \expandafter\string
                \csname\@this@attr\endcsname
                  {\expandafter\@gobble\string\#2}%
             }%
           }%
        }%
      }%
    }%
%    \end{macrocode}
% Add the end part of the open tag and the rest of the markup-index
% information:
%    \begin{macrocode}
    \write\glswrite{%
        \string\begin
        {theglossary}\string\glossaryheader\glstildechar n\string" ^^J\space
        \space\space:close \string"\glspercentchar\glstildechar n\string
          \end{theglossary}\string\glossarypostamble
          \glstildechar n\string" ^^J\space\space\space
        :tree)}%
%    \end{macrocode}
% Specify what to put between letter groups
%    \begin{macrocode}
    \write\glswrite{(markup-letter-group-list
        :sep \string"\string\glsgroupskip\glstildechar n\string")}%
%    \end{macrocode}
% Specify what to put between entries
%    \begin{macrocode}
    \write\glswrite{(markup-indexentry
        :open \string"\string\relax \string\glsresetentrylist
           \glstildechar n\string")}%
%    \end{macrocode}
% Specify how to format entries
%    \begin{macrocode}
    \write\glswrite{(markup-locclass-list :open 
       \string"\glsopenbrace\string\glossaryentrynumbers
         \glsopenbrace\string\relax\space \string"^^J\space\space\space
       :sep \string", \string"
       :close \string"\glsclosebrace\glsclosebrace\string")}%
%    \end{macrocode}
% Specify how to separate location numbers
%    \begin{macrocode}
    \write\glswrite{(markup-locref-list
       :sep \string"\string\delimN\space\string")}%
%    \end{macrocode}
% Specify how to indicate location ranges
%    \begin{macrocode}
    \write\glswrite{(markup-range
       :sep \string"\string\delimR\space\string")}%
%    \end{macrocode}
% Specify 2-page and 3-page suffixes, if defined.
% First, the values must be sanitized to write them explicity.
%    \begin{macrocode}
    \@onelevel@sanitize\gls@suffixF
    \@onelevel@sanitize\gls@suffixFF
%    \end{macrocode}
%    \begin{macrocode}
    \ifx\gls@suffixF\@empty
    \else
      \write\glswrite{(markup-range
        :close "\gls@suffixF" :length 1 :ignore-end)}%
    \fi
    \ifx\gls@suffixFF\@empty
    \else
      \write\glswrite{(markup-range
        :close "\gls@suffixFF" :length 2 :ignore-end)}%
    \fi
%    \end{macrocode}
% Specify how to format locations.
%    \begin{macrocode}
    \write\glswrite{^^J; define format to use for locations^^J}%
    \write\glswrite{\@xdylocref}%
%    \end{macrocode}
% Specify how to separate letter groups.
%    \begin{macrocode}
    \write\glswrite{^^J; define letter group list format^^J}%
    \write\glswrite{(markup-letter-group-list
       :sep \string"\string\glsgroupskip\glstildechar n\string")}%
%    \end{macrocode}
% Define letter group headings.
%    \begin{macrocode}
    \write\glswrite{^^J; letter group headings^^J}%
    \write\glswrite{(markup-letter-group 
        :open-head \string"\string\glsgroupheading
        \glsopenbrace\string"^^J\space\space\space
        :close-head \string"\glsclosebrace\string")}%
%    \end{macrocode}
% Define additional letter groups.
%    \begin{macrocode}
    \write\glswrite{^^J; additional letter groups^^J}%
    \write\glswrite{\@xdylettergroups}%
%    \end{macrocode}
% Define additional sort rules
%    \begin{macrocode}
    \write\glswrite{^^J; additional sort rules^^J}
    \write\glswrite{\@xdysortrules}%
%    \end{macrocode}
%Hook for any additional information:
%    \begin{macrocode}
    \@gls@writeisthook
%    \end{macrocode}
% Close the style file
%    \begin{macrocode}
    \closeout\glswrite
%    \end{macrocode}
% Suppress any further calls.
%    \begin{macrocode}
    \let\writeist\relax
  }
\else
%    \end{macrocode}
% Code to use if \app{makeindex} is required.
%\changes{2.01}{2009 May 30}{removed item\_02 - no such makeindex key}
%\changes{4.04}{2014-03-06}{checked for definition of \cs{glswrite}}
%    \begin{macrocode}
  \edef\@gls@actualchar{\string?}
  \edef\@gls@encapchar{\string|}
  \edef\@gls@levelchar{\string!}
  \edef\@gls@quotechar{\string"}%
  \let\GlsSetQuote\gls@nosetquote
  \def\writeist{\relax
   \ifundef{\glswrite}{\newwrite\glswrite}{}\relax
   \openout\glswrite=\istfilename
    \write\glswrite{\glspercentchar\space makeindex style file
      created by the glossaries package}
    \write\glswrite{\glspercentchar\space for document
      '\jobname' on \the\year-\the\month-\the\day}
    \write\glswrite{actual '\@gls@actualchar'}
    \write\glswrite{encap '\@gls@encapchar'}
    \write\glswrite{level '\@gls@levelchar'}
    \write\glswrite{quote '\@gls@quotechar'}
    \write\glswrite{keyword \string"\string\\glossaryentry\string"}
    \write\glswrite{preamble \string"\string\\glossarysection[\string
      \\glossarytoctitle]{\string\\glossarytitle}\string
      \\glossarypreamble\string\n\string\\begin{theglossary}\string
      \\glossaryheader\string\n\string"}
    \write\glswrite{postamble \string"\string\%\string\n\string
      \\end{theglossary}\string\\glossarypostamble\string\n
      \string"}
    \write\glswrite{group_skip \string"\string\\glsgroupskip\string\n
      \string"}
    \write\glswrite{item_0 \string"\string\%\string\n\string"}
    \write\glswrite{item_1 \string"\string\%\string\n\string"}
    \write\glswrite{item_2 \string"\string\%\string\n\string"}
    \write\glswrite{item_01 \string"\string\%\string\n\string"}
    \write\glswrite{item_x1
      \string"\string\\relax \string\\glsresetentrylist\string\n
      \string"}
    \write\glswrite{item_12 \string"\string\%\string\n\string"}
    \write\glswrite{item_x2
      \string"\string\\relax \string\\glsresetentrylist\string\n
      \string"}
%    \end{macrocode}
%\changes{2.05}{2010-02-06}{Added \cs{string} before opening 
% and closing braces. Patch provided by Segiu Dotenco}
%    \begin{macrocode}
    \write\glswrite{delim_0 \string"\string\{\string
      \\glossaryentrynumbers\string\{\string\\relax \string"}
    \write\glswrite{delim_1 \string"\string\{\string
      \\glossaryentrynumbers\string\{\string\\relax \string"}
    \write\glswrite{delim_2 \string"\string\{\string
      \\glossaryentrynumbers\string\{\string\\relax \string"}
    \write\glswrite{delim_t \string"\string\}\string\}\string"}
    \write\glswrite{delim_n \string"\string\\delimN \string"}
    \write\glswrite{delim_r \string"\string\\delimR \string"}
    \write\glswrite{headings_flag 1}
    \write\glswrite{heading_prefix 
       \string"\string\\glsgroupheading\string\{\string"}
    \write\glswrite{heading_suffix
       \string"\string\}\string\\relax
       \string\\glsresetentrylist \string"}
    \write\glswrite{symhead_positive \string"glssymbols\string"}
    \write\glswrite{numhead_positive \string"glsnumbers\string"}
    \write\glswrite{page_compositor \string"\glscompositor\string"}
    \@gls@escbsdq\gls@suffixF
    \@gls@escbsdq\gls@suffixFF
    \ifx\gls@suffixF\@empty
    \else
      \write\glswrite{suffix_2p \string"\gls@suffixF\string"}
    \fi
    \ifx\gls@suffixFF\@empty
    \else
      \write\glswrite{suffix_3p \string"\gls@suffixFF\string"}
    \fi
%    \end{macrocode}
%Hook for any additional information:
%    \begin{macrocode}
    \@gls@writeisthook
%    \end{macrocode}
% Close the file and disable \cs{writeist}.
%    \begin{macrocode}
    \closeout\glswrite
    \let\writeist\relax
  }
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsSetWriteIstHook}
%\changes{4.24}{2016-05-27}{new}
%Allow user to append information to the style file.
%    \begin{macrocode}
\newcommand*{\GlsSetWriteIstHook}[1]{\renewcommand*{\@gls@writeisthook}{#1}}
\@onlypremakeg\GlsSetWriteIstHook
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@writeisthook}
%    \begin{macrocode}
\newcommand*{\@gls@writeisthook}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsSetQuote}
%\changes{4.24}{2016-05-27}{new}
%Allow user to set the \app{makeindex} quote character. This is primarily for 
%\sty{ngerman} users who want to use \app{makeindex}'s -g option.
%    \begin{macrocode}
\ifglsxindy
 \newcommand*{\GlsSetQuote}[1]{\glsnomakeindexwarning\GlsSetQuote}
 \newcommand*{\gls@nosetquote}[1]{\glsnomakeindexwarning\GlsSetQuote}
\else
 \newcommand*{\GlsSetQuote}[1]{\edef\@gls@quotechar{\string#1}%
%    \end{macrocode}
% If German is in use, set
% the extra \app{makeindex} option so \app{makeglossaries} can pick
% it up.
%    \begin{macrocode}
    \@ifpackageloaded{tracklang}%
    {%
      \IfTrackedLanguage{german}%
      {%
        \def\@@gls@extramakeindexopts{-g}%
      }%
      {}%
    }%
    {}%
%    \end{macrocode}
% Need to redefine \cs{@gls@checkquote}
%    \begin{macrocode}
   \edef\@gls@docheckquotedef{%
     \noexpand\def\noexpand\@gls@checkquote####1#1####2#1####3\noexpand\null{%
       \noexpand\@gls@tmpb=\noexpand\expandafter{\noexpand\@gls@checkedmkidx}%
       \noexpand\toks@={####1}%
       \noexpand\ifx\noexpand\null####2\noexpand\null
        \noexpand\ifx\noexpand\null####3\noexpand\null
         \noexpand\edef\noexpand\@gls@checkedmkidx{%
           \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@}%
         \noexpand\def\noexpand\@@gls@checkquote{\noexpand\relax}%
        \noexpand\else
         \noexpand\edef\noexpand\@gls@checkedmkidx{%
           \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@
           \noexpand\@gls@quotechar\noexpand\@gls@quotechar
           \noexpand\@gls@quotechar\noexpand\@gls@quotechar}%
         \noexpand\def\noexpand\@@gls@checkquote{%
           \noexpand\@gls@checkquote####3\noexpand\null}%
        \noexpand\fi
       \noexpand\else
        \noexpand\edef\noexpand\@gls@checkedmkidx{%
          \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@
          \noexpand\@gls@quotechar\noexpand\@gls@quotechar}%
        \noexpand\ifx\noexpand\null####3\noexpand\null
          \noexpand\def\noexpand\@@gls@checkquote{%
            \noexpand\@gls@checkquote####2#1#1\noexpand\null}%
        \noexpand\else
          \noexpand\def\noexpand\@@gls@checkquote{%
            \noexpand\@gls@checkquote####2#1####3\noexpand\null}%
        \noexpand\fi
       \noexpand\fi
       \noexpand\@@gls@checkquote
     }%
   }%
   \@gls@docheckquotedef
   \edef\@gls@docheckquotedef{%
     \noexpand\renewcommand{\noexpand\@gls@checkmkidxchars}[1]{%
       \noexpand\def\noexpand\@gls@checkedmkidx{}%
       \noexpand\expandafter\noexpand\@gls@checkquote####1\noexpand\@nil
         #1#1\noexpand\null
       \noexpand\expandafter\noexpand\@gls@updatechecked
         \noexpand\@gls@checkedmkidx{####1}%
       \noexpand\def\noexpand\@gls@checkedmkidx{}%
       \noexpand\expandafter\noexpand\@gls@checkescquote####1\noexpand\@nil
         \expandonce{\csname#1\endcsname}\expandonce{\csname#1\endcsname}%
         \noexpand\null
       \noexpand\expandafter\noexpand\@gls@updatechecked
         \noexpand\@gls@checkedmkidx{####1}%
       \noexpand\def\noexpand\@gls@checkedmkidx{}%
       \noexpand\expandafter\noexpand\@gls@checkescactual####1\noexpand\@nil
         \noexpand\?\noexpand\?\noexpand\null
       \noexpand\expandafter\noexpand\@gls@updatechecked
         \noexpand\@gls@checkedmkidx{####1}%
       \noexpand\def\noexpand\@gls@checkedmkidx{}%
       \noexpand\expandafter\noexpand\@gls@checkactual####1\noexpand\@nil
         \noexpand?\noexpand?\noexpand\null
       \noexpand\expandafter\noexpand\@gls@updatechecked
         \noexpand\@gls@checkedmkidx{####1}%
       \noexpand\def\noexpand\@gls@checkedmkidx{}%
       \noexpand\expandafter\noexpand\@gls@checkbar####1\noexpand\@nil
         \noexpand|\noexpand|\noexpand\null
       \noexpand\expandafter\noexpand\@gls@updatechecked
         \noexpand\@gls@checkedmkidx{####1}%
       \noexpand\def\noexpand\@gls@checkedmkidx{}%
       \noexpand\expandafter\noexpand\@gls@checkescbar####1\noexpand\@nil
         \noexpand\|\noexpand\|\noexpand\null
       \noexpand\expandafter\noexpand\@gls@updatechecked
         \noexpand\@gls@checkedmkidx{####1}%
       \noexpand\def\noexpand\@gls@checkedmkidx{}%
       \noexpand\expandafter\noexpand\@gls@checklevel####1\noexpand\@nil
         \noexpand!\noexpand!\noexpand\null
       \noexpand\expandafter\noexpand\@gls@updatechecked
         \noexpand\@gls@checkedmkidx{####1}%
%    \end{macrocode}
%\changes{4.47}{2021-09-20}{added check for \cs{"!}}
%    \begin{macrocode}
       \noexpand\def\noexpand\@gls@checkedmkidx{}%
       \noexpand\expandafter\noexpand\@gls@checkesclevel####1\noexpand\@nil
         \noexpand\!\noexpand\!\noexpand\null
       \noexpand\expandafter\noexpand\@gls@updatechecked
         \noexpand\@gls@checkedmkidx{####1}%
%    \end{macrocode}
%\changes{4.47}{2021-09-20}{added check for backslash}
%    \begin{macrocode}
       \noexpand\def\noexpand\@gls@checkedmkidx{}%
       \noexpand\expandafter\noexpand\@gls@checkesc####1\noexpand\@nil
         \@backslashchar\@backslashchar\noexpand\null
       \noexpand\expandafter\noexpand\@gls@updatechecked
         \noexpand\@gls@checkedmkidx{####1}%
     }%
   }%
   \@gls@docheckquotedef
   \edef\@gls@docheckquotedef{%
     \noexpand\def\noexpand\@gls@checkescquote####1%
       \expandonce{\csname#1\endcsname}####2\expandonce{\csname#1\endcsname}%
       ####3\noexpand\null{%
       \noexpand\@gls@tmpb=\noexpand\expandafter{\noexpand\@gls@checkedmkidx}%
       \noexpand\toks@={####1}%
       \noexpand\ifx\noexpand\null####2\noexpand\null
        \noexpand\ifx\noexpand\null####3\noexpand\null
         \noexpand\edef\noexpand\@gls@checkedmkidx{%
           \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@}%
         \noexpand\def\noexpand\@@gls@checkescquote{\noexpand\relax}%
         \noexpand\else
         \noexpand\edef\noexpand\@gls@checkedmkidx{%
           \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@
           \noexpand\@gls@quotechar\noexpand\string\expandonce{%
             \csname#1\endcsname}\noexpand\@gls@quotechar
           \noexpand\@gls@quotechar\noexpand\string\expandonce{%
             \csname#1\endcsname}\noexpand\@gls@quotechar}%
         \noexpand\def\noexpand\@@gls@checkescquote{%
           \noexpand\@gls@checkescquote####3\noexpand\null}%
        \noexpand\fi
        \noexpand\else
        \noexpand\edef\noexpand\@gls@checkedmkidx{%
          \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@
          \noexpand\@gls@quotechar\noexpand\string
            \expandonce{\csname#1\endcsname}\noexpand\@gls@quotechar}%
        \noexpand\ifx\noexpand\null####3\noexpand\null
          \noexpand\def\noexpand\@@gls@checkescquote{%
           \noexpand\@gls@checkescquote####2\expandonce{\csname#1\endcsname}%
           \expandonce{\csname#1\endcsname}\noexpand\null}%
        \noexpand\else
          \noexpand\def\noexpand\@@gls@checkescquote{%
            \noexpand\@gls@checkescquote####2\expandonce{\csname#1\endcsname}%
            ####3\noexpand\null}%
        \noexpand\fi
       \noexpand\fi
      \noexpand\@@gls@checkescquote
     }%
   }%
   \@gls@docheckquotedef
 }
 \newcommand*{\gls@nosetquote}[1]{\PackageError{glossaries}%
   {\string\GlsSetQuote\space not permitted here}%
   {Move \string\GlsSetQuote\space earlier in the preamble, as
    soon as possible after glossaries.sty has been loaded}}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@extramakeindexopts}
%\changes{4.24}{2016-05-27}{new}
%    \begin{macrocode}
\newcommand*{\@gls@extramakeindexopts}[1]{}
%    \end{macrocode}
%\end{macro}
%
%The command \cs{noist} will suppress the creation of
% the \filetype{.ist} file. Obviously you need to use this
% command before \cs{writeist} to have any effect.
%\begin{macro}{\noist}
%    \begin{macrocode}
\newcommand{\noist}{%
%    \end{macrocode}
% Update attributes list
%    \begin{macrocode}
  \@gls@addpredefinedattributes
  \let\writeist\relax
}
%    \end{macrocode}
%\end{macro}
%
% \cs{@makeglossary} is an internal command that takes an 
% argument indicating the glossary type. This command will 
% create the glossary file required by \app{makeindex} for the
% given glossary type, using the extension supplied by the
% \meta{out-ext} parameter used in \ics{newglossary} 
% (and it will also activate the \ics{glossary} command, 
% and create the customized \filetype{.ist} \app{makeindex} 
% style file). 
%
% Note that you can't use \cs{@makeglossary} for only some of the
% defined glossaries (with just the base \styfmt{glossaries} package). You either need 
% to have a \cs{makeglossaries} for all glossaries or none (otherwise 
% you will end up with a situation where \TeX\ is trying to write to a non-existant
% file). The relevant glossary must be defined prior to using \cs{@makeglossary}.
% \sty{glossaries-extra} allows for a hybrid approach.
%\begin{macro}{\@makeglossary}
%Unstarred form of \cs{ifglossaryexists} is used as
%\cs{@makeglossary} can't be used with an ignored glossary.
%    \begin{macrocode}
\newcommand*{\@makeglossary}[1]{%
  \ifglossaryexists{#1}%
  {%
%    \end{macrocode}
% Only create a new write if \pkgopt[false]{savewrites} otherwise
% create a token to collect the information.
%\changes{3.0}{2010-07-12}{Added check for \pkgopt{savewrites}}
%    \begin{macrocode}
    \ifglssavewrites
      \expandafter\newtoks\csname glo@#1@filetok\endcsname
    \else
      \expandafter\newwrite\csname glo@#1@file\endcsname
      \expandafter\@glsopenfile\csname glo@#1@file\endcsname{#1}%
    \fi
    \@gls@renewglossary
    \writeist
  }%
  {%
    \PackageError{glossaries}%
    {Glossary type `#1' not defined}%
    {New glossaries must be defined before using \string\makeglossaries}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsopenfile}
% Open write file associated with the given glossary.
%    \begin{macrocode}
\newcommand*{\@glsopenfile}[2]{%
  \immediate\openout#1=\jobname.\csname @glotype@#2@out\endcsname
  \PackageInfo{glossaries}{Writing glossary file
     \jobname.\csname @glotype@#2@out\endcsname}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@closegls}
%\changes{4.08}{2014-07-30}{new}
%    \begin{macrocode}
\newcommand*{\@closegls}[1]{%
  \closeout\csname glo@#1@file\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@automake}
%\changes{4.08}{2014-07-30}{new}
%Unstarred form of \cs{ifglossaryexists} is used as
%\cs{@gls@automake} can't be used with an ignored glossary.
%    \begin{macrocode}
\ifglsxindy
 \newcommand*{\@gls@automake}[1]{%
   \ifglossaryexists{#1}
   {%
     \@closegls{#1}%
     \ifdefstring{\glsorder}{letter}%
      {\def\@gls@order{-M ord/letorder }}%
      {\let\@gls@order\@empty}%
     \ifcsundef{@xdy@#1@language}%
      {\let\@gls@langmod\@xdy@main@language}%
      {\letcs\@gls@langmod{@xdy@#1@language}}%
     \edef\@gls@dothiswrite{\noexpand\write18{xindy 
       -I xindy
       \@gls@order 
       -L \@gls@langmod\space
       -M \gls@istfilebase\space
       -C \gls@codepage\space
       -t \jobname.\csuse{@glotype@#1@log}
       -o \jobname.\csuse{@glotype@#1@in}
       \jobname.\csuse{@glotype@#1@out}}%
     }%
     \@gls@dothiswrite
   }%
   {%
     \GlossariesWarning{Can't make glossary `#1', it doesn't exist}%
   }%
 }
\else
 \newcommand*{\@gls@automake}[1]{%
   \ifglossaryexists{#1}
   {%
     \@closegls{#1}%
     \ifdefstring{\glsorder}{letter}%
      {\def\@gls@order{-l }}%
      {\let\@gls@order\@empty}%
     \edef\@gls@dothiswrite{\noexpand\write18{makeindex \@gls@order 
       -s \istfilename\space
       -t \jobname.\csuse{@glotype@#1@log}
       -o \jobname.\csuse{@glotype@#1@in}
       \jobname.\csuse{@glotype@#1@out}}%
     }%
     \@gls@dothiswrite
   }%
   {%
     \GlossariesWarning{Can't make glossary `#1', it doesn't exist}%
   }%
 }
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@automake@immediate}
%\changes{4.42}{2019-01-06}{new}
%Unstarred form of \cs{ifglossaryexists} is used as
%\cs{@gls@automake@immediate} can't be used with an ignored glossary.
%    \begin{macrocode}
\ifglsxindy
 \newcommand*{\@gls@automake@immediate}[1]{%
   \ifglossaryexists{#1}
   {%
     \IfFileExists{\jobname.\csuse{@glotype@#1@out}}%
     {%
       \ifdefstring{\glsorder}{letter}%
        {\def\@gls@order{-M ord/letorder }}%
        {\let\@gls@order\@empty}%
       \ifcsundef{@xdy@#1@language}%
        {\let\@gls@langmod\@xdy@main@language}%
        {\letcs\@gls@langmod{@xdy@#1@language}}%
       \edef\@gls@dothiswrite{\noexpand\immediate\noexpand\write18{xindy 
         -I xindy
         \@gls@order 
         -L \@gls@langmod\space
         -M \gls@istfilebase\space
         -C \gls@codepage\space
         -t \jobname.\csuse{@glotype@#1@log}
         -o \jobname.\csuse{@glotype@#1@in}
         \jobname.\csuse{@glotype@#1@out}}%
       }%
       \@gls@dothiswrite
     }%
     {\GlossariesWarning{can't automake `#1': \jobname.\csuse{@glotype@#1@out}
      doesn't exist. Rerun may be required}}%
   }%
   {%
     \GlossariesWarning{Can't make glossary `#1', it doesn't exist}%
   }%
 }
\else
 \newcommand*{\@gls@automake@immediate}[1]{%
   \ifglossaryexists{#1}
   {%
     \IfFileExists{\jobname.\csuse{@glotype@#1@out}}%
     {%
       \ifdefstring{\glsorder}{letter}%
        {\def\@gls@order{-l }}%
        {\let\@gls@order\@empty}%
       \edef\@gls@dothiswrite{\noexpand\immediate\noexpand\write18{makeindex \@gls@order 
         -s \istfilename\space
         -t \jobname.\csuse{@glotype@#1@log}
         -o \jobname.\csuse{@glotype@#1@in}
         \jobname.\csuse{@glotype@#1@out}}%
       }%
       \@gls@dothiswrite
     }%
     {\GlossariesWarning{can't automake `#1': \jobname.\csuse{@glotype@#1@out}
      doesn't exist. Rerun may be required}}%
   }%
   {%
     \GlossariesWarning{Can't make glossary `#1', it doesn't exist}%
   }%
 }
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\warn@nomakeglossaries}
% Issue warning that \cs{makeglossaries} hasn't been used.
%    \begin{macrocode}
\newcommand*{\@warn@nomakeglossaries}{}
%    \end{macrocode}
% Only use this if warning if \cs{printglossary} has been used
% without \cs{makeglossaries}
%    \begin{macrocode}
\newcommand*{\warn@nomakeglossaries}{\@warn@nomakeglossaries}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@@automake@immediate}
%\changes{4.42}{2019-01-06}{new}
%    \begin{macrocode}
\newcommand{\@gls@@automake@immediate}{%
 \ifnum\gls@automake@nr=2\relax
   \@for\@gls@type:=\@glo@types\do{%
      \ifdefempty{\@gls@type}{}%
      {\@gls@automake@immediate{\@gls@type}}%
   }%
   \glsautomakefalse
   \renewcommand*{\@gls@doautomake}{}%
 \fi
}
%    \end{macrocode}
%\end{macro}
%
% \cs{makeglossaries} will use \cs{@makeglossary}
% for each glossary type that has been defined.  New glossaries
% need to be defined before using \cs{makeglossary}, so
% have \cs{makeglossaries} redefine \cs{newglossary}
% to prevent it being used afterwards.
%\begin{macro}{\makeglossaries}
%    \begin{macrocode}
\newcommand*{\makeglossaries}{%
 \@domakeglossaries
 {%
%    \end{macrocode}
%If automake=immediate setting is on, use the shell escape now.
%    \begin{macrocode}
   \@gls@@automake@immediate
%    \end{macrocode}
% Define the write used for style file also used for all other output files
% if \pkgopt[true]{savewrites}.
%\changes{4.04}{2014-03-06}{Moved definition of \cs{glswrite} to
%\cs{makeglossaries}}
%    \begin{macrocode}
  \ifundef{\glswrite}{\newwrite\glswrite}{}%
%    \end{macrocode}
%\changes{3.10a}{2013-10-13}{Added providecommand code to aux file}
% If the user removes the glossary package from their document,
% ensure the next run doesn't throw a load of undefined control
% sequence errors when the aux file is parsed.
%    \begin{macrocode}
  \protected@write\@auxout{}{\string\providecommand\string\@glsorder[1]{}}
  \protected@write\@auxout{}{\string\providecommand\string\@istfilename[1]{}}
%    \end{macrocode}
%If \cs{@@gls@extramakeindexopts} has been defined, write it:
%    \begin{macrocode}
  \ifundef\@@gls@extramakeindexopts
  {}%
  {%
    \protected@write\@auxout{}{\string\providecommand
       \string\@gls@extramakeindexopts[1]{}}
    \protected@write\@auxout{}{\string\@gls@extramakeindexopts
      {\@@gls@extramakeindexopts}}%
  }%
%    \end{macrocode}
% Write the name of the style file to the aux file 
% (needed by \app{makeglossaries})
%    \begin{macrocode}
  \protected@write\@auxout{}{\string\@istfilename{\istfilename}}%
  \protected@write\@auxout{}{\string\@glsorder{\glsorder}}
%    \end{macrocode}
% Iterate through each glossary type and activate it.
%    \begin{macrocode}
  \@for\@glo@type:=\@glo@types\do{%
    \ifthenelse{\equal{\@glo@type}{}}{}{%
    \@makeglossary{\@glo@type}}%
  }%
%    \end{macrocode}
% New glossaries must be created before \cs{makeglossaries} 
% so disable \ics{newglossary}.
%    \begin{macrocode}
  \renewcommand*\newglossary[4][]{%
  \PackageError{glossaries}{New glossaries
  must be created before \string\makeglossaries}{You need
  to move \string\makeglossaries\space after all your 
  \string\newglossary\space commands}}%
%    \end{macrocode}
% Any subsequence instances of this command should have no effect.
% The deprecated \cs{makeglossary} is not redefined here as it either
% implements \cs{makeglossaries} or has been restored to its original
% definition (in which case it shouldn't be changed).
%\changes{4.41}{2018-07-23}{removed redefinition of \cs{makeglossary}}
%\changes{4.45}{2020-02-13}{let \cs{@makeglossary} to \cs{@gobble}
%instead of \cs{relax}}
%    \begin{macrocode}
  \let\@makeglossary\@gobble
  \let\makeglossaries\relax
%    \end{macrocode}
% Disable all commands that have no effect after \cs{makeglossaries}
%    \begin{macrocode}
  \@disable@onlypremakeg
%    \end{macrocode}
% Allow \gloskey{see} key:
%    \begin{macrocode}
  \let\gls@checkseeallowed\relax
%    \end{macrocode}
% Suppress warning about no \cs{makeglossaries}
%    \begin{macrocode}
  \let\warn@nomakeglossaries\relax
%    \end{macrocode}
% Activate warning about missing \cs{printglossary}
%    \begin{macrocode}
  \let\warn@noprintglossary\@makeglossaries@warn@noprintglossary
%    \end{macrocode}
% Declare list parser for \cs{glsdisplaynumberlist}
%\changes{3.02}{2012-05-21}{added list parser}
%    \begin{macrocode}
  \ifglssavenumberlist
    \edef\@gls@dodeflistparser{\noexpand\DeclareListParser
      {\noexpand\glsnumlistparser}{\delimN}}%
    \@gls@dodeflistparser
  \fi
%    \end{macrocode}
% Prevent user from also using \cs{makenoidxglossaries}
%    \begin{macrocode}
  \let\makenoidxglossaries\@no@makeglossaries
%    \end{macrocode}
% Prohibit sort key in printgloss family:
%    \begin{macrocode}
  \renewcommand*{\@printgloss@setsort}{%
    \let\@glo@assign@sortkey\@glo@no@assign@sortkey
  }%
%    \end{macrocode}
% Check the automake setting:
%    \begin{macrocode}
  \ifglsautomake
    \renewcommand*{\@gls@doautomake}{%
      \@for\@gls@type:=\@glo@types\do{%
        \ifdefempty{\@gls@type}{}%
        {\@gls@automake{\@gls@type}}%
      }%
    }%
  \fi
%    \end{macrocode}
% Check the sort setting:
%    \begin{macrocode}
  \@glo@check@sortallowed\makeglossaries
 }%
}
%    \end{macrocode}
%\changes{4.02}{2013-13-05}{made preamble only}
% Must occur in the preamble:
%    \begin{macrocode}
\@onlypreamble{\makeglossaries}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@makeglossaries@warn@noprintglossary}
%\changes{4.47}{??}{new}
%    \begin{macrocode}
\newcommand\@makeglossaries@warn@noprintglossary{%
  \ifdefstring{\@glo@types}{,}%
  {%
    \GlossariesWarningNoLine{No glossaries have been defined}%
  }%
  {%
    \GlossariesWarningNoLine{No \string\printglossary\space 
      or \string\printglossaries\space
      found. ^^J(Remove \string\makeglossaries\space if you 
      don't want any glossaries.) ^^JThis document will not 
      have a glossary}%
  }%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glswrite}
% The definition of \cs{glswrite} has now been moved to 
% \cs{makeglossaries} so that it's only defined if needed.
%\end{macro}
%
% If \ics{makeglossaries} hasn't been used, issue a warning.
% Also issue a warning if neither \ics{printglossaries} nor
% \ics{printglossary} have been used.
%    \begin{macrocode}
\AtEndDocument{%
  \warn@nomakeglossaries
  \warn@noprintglossary
}
%    \end{macrocode}
%
%\begin{macro}{\makenoidxglossaries}
%\changes{4.04}{2014-03-06}{new}
% Analogous to \cs{makeglossaries} this activates the commands
% needed for \cs{printnoidxglossary}
%    \begin{macrocode}
\newcommand*{\makenoidxglossaries}{%
 \@domakeglossaries
 {%
%    \end{macrocode}
% Redefine empty glossary warning:
%    \begin{macrocode}
  \renewcommand{\@gls@noref@warn}[1]{%
    \GlossariesWarning{Empty glossary for
    \string\printnoidxglossary[type={##1}].
    Rerun may be required (or you may have forgotten to use 
    commands like \string\gls)}%
  }%
%    \end{macrocode}
% Don't escape makeindex/xindy characters:
%    \begin{macrocode}
  \let\@gls@checkmkidxchars\@gobble
%    \end{macrocode}
% Don't escape locations:
%\changes{4.40}{2018-06-01}{added esclocations=false}
%    \begin{macrocode}
  \glsesclocationsfalse
%    \end{macrocode}
% Write glossary information to aux instead of glossary files
%    \begin{macrocode}
  \let\@@do@@wrglossary\gls@noidxglossary
%    \end{macrocode}
% Switch on group headings that use the character code:
%    \begin{macrocode}
  \let\@gls@getgrouptitle\@gls@noidx@getgrouptitle
%    \end{macrocode}
% Allow \gloskey{see} key:
%    \begin{macrocode}
  \let\gls@checkseeallowed\relax
%    \end{macrocode}
% Redefine cross-referencing macro:
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
  \renewcommand{\@do@seeglossary}[2]{%
    \protected@edef\@gls@label{\glsdetoklabel{##1}}%
    \protected@write\@auxout{}{%
      \string\@gls@reference
        {\csname glo@\@gls@label @type\endcsname}%
        {\@gls@label}%
        {%
          \string\glsseeformat##2{}%
        }%
    }%
  }%
%    \end{macrocode}
% If user removes the glossaries package from their document, ensure
% the next run doesn't throw a load of undefined control sequence
% errors when the aux file is parsed.
%    \begin{macrocode}
  \AtBeginDocument
  {%
    \write\@auxout{\string\providecommand\string\@gls@reference[3]{}}%
  }%
%    \end{macrocode}
% Change warning about no glossaries
%    \begin{macrocode}
  \def\warn@noprintglossary{%
    \GlossariesWarningNoLine{No \string\printnoidxglossary\space 
      or \string\printnoidxglossaries ^^J
      found. (Remove \string\makenoidxglossaries\space if you
      don't want any glossaries.)^^JThis document will not have a glossary}%
  }%
%    \end{macrocode}
% Suppress warning about no \cs{makeglossaries}
%    \begin{macrocode}
  \let\warn@nomakeglossaries\relax
%    \end{macrocode}
% Prevent user from also using \cs{makeglossaries}
%    \begin{macrocode}
  \let\makeglossaries\@no@makeglossaries
%    \end{macrocode}
% Allow sort key in printgloss family:
%    \begin{macrocode}
  \renewcommand*{\@printgloss@setsort}{%
    \let\@glo@assign@sortkey\@@glo@assign@sortkey
%    \end{macrocode}
% Initialise default sort order:
%    \begin{macrocode}
    \def\@glo@sorttype{\@glo@default@sorttype}%
  }%
%    \end{macrocode}
% All entries must be defined in the preamble:
%    \begin{macrocode}
  \renewcommand*\new@glossaryentry[2]{%
    \PackageError{glossaries}{Glossary entries must be
     defined in the preamble^^Jwhen you use
     \string\makenoidxglossaries}%
    {Either move your definitions to the preamble or use
     \string\makeglossaries}%
  }%
%    \end{macrocode}
% Redefine \ics{glsentrynumberlist}
%    \begin{macrocode}
  \renewcommand*{\glsentrynumberlist}[1]{%
    \letcs{\@gls@loclist}{glo@\glsdetoklabel{##1}@loclist}%
    \ifdef\@gls@loclist
    {%
      \glsnoidxloclist{\@gls@loclist}%
    }%
    {%
      ??\glsdoifexists{##1}%
      {%
        \GlossariesWarning{Missing location list for `##1'. Either
          a rerun is required or you haven't referenced the entry}%
      }%
    }%
  }%
%    \end{macrocode}
% Redefine \ics{glsdisplaynumberlist}
%    \begin{macrocode}
  \renewcommand*{\glsdisplaynumberlist}[1]{%
    \letcs{\@gls@loclist}{glo@\glsdetoklabel{##1}@loclist}%
    \ifdef\@gls@loclist
    {%
      \def\@gls@noidxloclist@sep{%
        \def\@gls@noidxloclist@sep{%
          \def\@gls@noidxloclist@sep{%
            \glsnumlistsep
          }%
          \def\@gls@noidxloclist@finalsep{\glsnumlistlastsep}%
        }%
      }%
      \def\@gls@noidxloclist@finalsep{}%
      \def\@gls@noidxloclist@prev{}%
      \forlistloop{\glsnoidxdisplayloclisthandler}{\@gls@loclist}%
      \@gls@noidxloclist@finalsep
      \@gls@noidxloclist@prev
    }%
    {%
      ??\glsdoifexists{##1}%
      {%
        \GlossariesWarning{Missing location list for `##1'. Either
          a rerun is required or you haven't referenced the entry}%
      }%
    }%
  }%
%    \end{macrocode}
% Provide a generic way of iterating through the number list:
%    \begin{macrocode}
  \renewcommand*{\glsnumberlistloop}[3]{%
    \letcs{\@gls@loclist}{glo@\glsdetoklabel{##1}@loclist}%
    \let\@gls@org@glsnoidxdisplayloc\glsnoidxdisplayloc
    \let\@gls@org@glsseeformat\glsseeformat
    \let\glsnoidxdisplayloc##2\relax
    \let\glsseeformat##3\relax
    \ifdef\@gls@loclist
    {%
      \forlistloop{\glsnoidxnumberlistloophandler}{\@gls@loclist}%
    }%
    {%
      ??\glsdoifexists{##1}%
      {%
        \GlossariesWarning{Missing location list for `##1'. Either
          a rerun is required or you haven't referenced the entry}%
      }%
    }%
    \let\glsnoidxdisplayloc\@gls@org@glsnoidxdisplayloc
    \let\glsseeformat\@gls@org@glsseeformat
  }%
%    \end{macrocode}
% Modify sanitize sort function
%    \begin{macrocode}
  \let\@@gls@sanitizesort\@gls@noidx@sanitizesort
  \let\@@gls@nosanitizesort\@@gls@noidx@nosanitizesort
  \@gls@noidx@setsanitizesort
%    \end{macrocode}
% Check sort option allowed.
%    \begin{macrocode}
  \@glo@check@sortallowed\makenoidxglossaries
 }%
}
%    \end{macrocode}
% Preamble-only command:
%    \begin{macrocode}
\@onlypreamble{\makenoidxglossaries}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsnumberlistloop}
%\begin{definition}
%\cs{glsnumberlistloop}\marg{label}\marg{handler}
%\end{definition}
%    \begin{macrocode}
\newcommand*{\glsnumberlistloop}[2]{%
   \PackageError{glossaries}{\string\glsnumberlistloop\space
    only works with \string\makenoidxglossaries}{}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsnoidxnumberlistloophandler}
% Handler macro for \cs{glsnumberlistloop}.
% (The argument should be in the form
% \cs{glsnoidxdisplayloc}\marg{prefix}\marg{counter}\marg{format}\marg{n})
%    \begin{macrocode}
\newcommand*{\glsnoidxnumberlistloophandler}[1]{%
  #1%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@no@makeglossaries}
%\changes{4.04}{2014-03-06}{new}
% Can't use both \cs{makeglossaries} and \cs{makenoidxglossaries}
%    \begin{macrocode}
\newcommand*{\@no@makeglossaries}{%
  \PackageError{glossaries}{You can't use both
  \string\makeglossaries\space and \string\makenoidxglossaries}%
  {Either use one or other (or none) of those commands but not both
  together.}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@noref@warn}
%\changes{4.04}{2014-03-06}{new}
% Warning when no instances of \cs{@gls@reference} found.
%    \begin{macrocode}
\newcommand{\@gls@noref@warn}[1]{%
  \GlossariesWarning{\string\makenoidxglossaries\space
   is required to make \string\printnoidxglossary[type={#1}] work}%
}
%    \end{macrocode}
%\end{macro}
%
%\section{Writing information to associated files}
%\label{sec:wrgloss}
%
%\begin{macro}{\gls@noidxglossary}
% Write the glossary information to the aux file (for the `noidx'
% method):
%    \begin{macrocode}
\newcommand*{\gls@noidxglossary}{%
  \protected@write\@auxout{}{%
    \string\@gls@reference
      {\csname glo@\@gls@label @type\endcsname}%
      {\@gls@label}%
      {\string\glsnoidxdisplayloc
        {\@glo@counterprefix}%
        {\@gls@counter}%
        {\@glsnumberformat}%
        {\@glslocref}%
      }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\istfile}
%\changes{3.0}{2011-04-02}{deprecated}
%\changes{4.40}{2018-06-01}{changed \cs{def} to \cs{providecommand}}
% Deprecated.
%    \begin{macrocode}
\providecommand\istfile{\glswrite}
%    \end{macrocode}
%\end{macro}
%
% At the end of the document, the files should be created if
% \pkgopt[true]{savewrites}.
%    \begin{macrocode}
\AtEndDocument{%
  \glswritefiles
}
%    \end{macrocode}
%\begin{macro}{\@glswritefiles}
% Only write the files if \pkgopt[true]{savewrites}.
%\changes{3.14a}{2013-11-12}{renamed \cs{glswritefiles} to
%\cs{@glswritefiles} and used ``savewrites'' option to set
%\cs{glswritefiles}}
%    \begin{macrocode}
\newcommand*{\@glswritefiles}{%
%    \end{macrocode}
% Iterate through all the glossaries.
%\changes{3.01}{2011-04-12}{added check for empty glossaries}
%\changes{3.02}{2012-05-21}{added check for existence of token
% in case \cs{makeglossaries has been omitted}}
%    \begin{macrocode}
  \forallglossaries{\@glo@type}{%
%    \end{macrocode}
% Check for empty glossaries (patch provided by Patrick H\"acker)
%    \begin{macrocode}
     \ifcsundef{glo@\@glo@type @filetok}%
     {%
        \def\gls@tmp{}%
     }%
     {%
        \edef\gls@tmp{\expandafter\the
           \csname glo@\@glo@type @filetok\endcsname}%
     }%
     \ifx\gls@tmp\@empty
        \ifx\@glo@type\glsdefaulttype
          \GlossariesWarningNoLine{Glossary `\@glo@type' has no
             entries.^^JRemember to use package option `nomain' if
you
             don't want to^^Juse the main glossary}%
        \else
          \GlossariesWarningNoLine{Glossary `\@glo@type' has no
             entries}%
        \fi
     \else
        \@glsopenfile{\glswrite}{\@glo@type}%
        \immediate\write\glswrite{%
           \expandafter\the
             \csname glo@\@glo@type @filetok\endcsname}%
        \immediate\closeout\glswrite
     \fi
  }%
}
%    \end{macrocode}
%\end{macro}
%
% As from v4.10, the \cs{glossary} command isn't 
% used by the \styfmt{glossaries} package. Since the
% user isn't expected to use this command (as \styfmt{glossaries}
% takes care of the particular format required for
% \gls{makeindex}\slash\gls{xindy}) there's no need for a user level
% command. Using a custom internal command prevents any conflict
% with other packages (and with the \cs{mark} mechanism).
%
% The associated number should be stored in \cs{theglsentrycounter}
% before using \cs{gls@glossary}.
%\begin{macro}{\gls@glossary}
%    \begin{macrocode}
\newcommand*{\gls@glossary}[1]{%
  \@gls@glossary{#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@glossary}
%\begin{definition}
%\cs{@gls@glossary}\marg{type}\marg{indexing info}
%\end{definition}
% (In v4.10, \cs{@glossary} was redefined to \cs{@gls@glossary} to
% avoid conflict with other packages.)
% Initially define internal \cs{@gls@glossary} to ignore its argument.
% Indexing will be enabled when \cs{@gls@glossary} is redefined by 
% \cs{@makeglossary}.
%
% This command was originally 
% defined to do \cs{@index}\marg{indexing info} so that it behaved
% much like \cs{index}. The definition was then changed to
% use \cs{index} as \cls{memoir} changes the definition of
% \cs{@index}. (Thanks to Dan Luecking for pointing this out.)
%\changes{1.17}{2008-12-26}{changed definition to use
%\cs{index} instead of \cs{@index}}
%\changes{4.10}{2014-08-27}{Renamed \cs{@glossary} to \cs{@gls@glossary}}
%\changes{4.24}{2016-05-27}{added check for debug mode}
%
%However, if normal indexing is enabled (for example with \cs{makeindex}) but no
%glossary lists are required (so \cs{@makeglossary} isn't used),
%then \cs{index} will cause a problem here.
%The \cs{@index} trick allows for special characters within 
%\meta{indexing info} (so you can do, for example, \verb|\index{%@\%}|), 
%and the original design of \cs{@glossary} here
%was actually a legacy from the old \styfmt{glossary} package. With
%the \styfmt{glossaries} package, the indexing information supplied in
%the second argument is more constrained and just consists of the sort
%value (given by the \gloskey{sort} key), the actual value
%(given by \cs{glossentry}\marg{label} or
%\cs{subglossentry}\marg{level}\marg{label}), and the format. This means that
%there's no need to worry about special characters appearing in the
%second argument as they can't be in the label or sort value. (If
%they are in the sort value then the category code would've needed
%to be changed when the entry was defined or \cs{glspercentchar}
%would be needed with the sort sanitization switched off.)
%This means that it's safe to simply ignore the second argument.
%\changes{4.36}{2018-03-07}{removed \cs{index}}
%    \begin{macrocode}
\newcommand*{\@gls@glossary}[2]{%
  \if@gls@debug
    \PackageInfo{glossaries}{wrglossary(#1)(#2)}%
  \fi
}
%    \end{macrocode}
%\end{macro}
% This is a convenience command to set \cs{@gls@glossary}.
% It's used by \cs{@makeglossary} and then redefined to
% do nothing, as it only needs to be done once.
%\begin{macro}{\@gls@renewglossary}
%    \begin{macrocode}
\newcommand{\@gls@renewglossary}{%
  \gdef\@gls@glossary##1{\@bsphack\begingroup\gls@wrglossary{##1}}%
  \let\@gls@renewglossary\@empty
}
%    \end{macrocode}
%\end{macro}
% The \cs{gls@wrglossary} command is defined to have
% two arguments. The first argument is the glossary type, 
% the second argument is the glossary entry 
% (the format of which is set in \cs{glslink}).
%\begin{macro}{\gls@wrglossary}
%\changes{1.17}{2008-12-26}{modified to allow for xindy support}
%\changes{3.0}{2010-07-12}{modified to take into account
%\pkgopt{savewrites}}
%\changes{4.11}{2014-09-01}{renamed from \cs{@wrglossary} to
%\cs{gls@wrglossary}}
%    \begin{macrocode}
\newcommand*{\gls@wrglossary}[2]{%
  \ifglssavewrites
    \protected@edef\@gls@tmp{\the\csname glo@#1@filetok\endcsname#2}%
    \expandafter\global\expandafter\csname glo@#1@filetok\endcsname
       \expandafter{\@gls@tmp^^J}%
  \else
%    \end{macrocode}
%\changes{3.02}{2012-05-21}{added check for glossary file defined}%
%    \begin{macrocode}
    \ifcsdef{glo@#1@file}%
    {%
      \expandafter\protected@write\csname glo@#1@file\endcsname{%
        \gls@disablepagerefexpansion}{#2}%
    }%
    {%
       \ifignoredglossary{#1}{}%
       {%
          \GlossariesWarning{No file defined for glossary `#1'}%
       }%
    }%
  \fi
  \endgroup\@esphack
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@do@wrglossary}
%\changes{3.02}{2012-05-21}{changed \cs{@do@wr@glossary} to test for
%\pkgopt{indexonlyfirst} option; put old \cs{@do@wr@glossary} code
%into \cs{@@do@wrglossary}}
%    \begin{macrocode}
\newcommand*{\@do@wrglossary}[1]{%
  \glswriteentry{#1}{\@@do@wrglossary{#1}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glswriteentry}
%\changes{4.16}{2015-07-08}{new}
% Provide a user level command so the user can customize whether or
% not a line should be added to the glossary. The arguments are the
% label and the code that writes to the glossary file.
%    \begin{macrocode}
\newcommand*{\glswriteentry}[2]{%
  \ifglsindexonlyfirst
    \ifglsused{#1}{}{#2}%
  \else
    #2%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@protected@pagefmts}
%\changes{3.04}{2012-11-18}{new}
%\changes{3.05}{2013-04-21}{added Roman to list}
% List of page formats to be protected against expansion.
%\changes{4.22}{2016-04-19}{added arabic to list}
%    \begin{macrocode}
\newcommand{\gls@protected@pagefmts}{\gls@numberpage,\gls@alphpage,%
 \gls@Alphpage,\gls@romanpage,\gls@Romanpage,\gls@arabicpage}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\gls@disablepagerefexpansion}
%\changes{3.04}{2012-11-18}{new}
%    \begin{macrocode}
\newcommand*{\gls@disablepagerefexpansion}{%
  \@for\@gls@this:=\gls@protected@pagefmts\do
  {%
    \expandafter\let\@gls@this\relax
  }%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\gls@alphpage}
%\changes{3.04}{2012-11-18}{new}
%    \begin{macrocode}
\newcommand*{\gls@alphpage}{\@alph\c@page}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\gls@Alphpage}
%\changes{3.04}{2012-11-18}{new}
%    \begin{macrocode}
\newcommand*{\gls@Alphpage}{\@Alph\c@page}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\gls@numberpage}
%\changes{3.04}{2012-11-18}{new}
%    \begin{macrocode}
\newcommand*{\gls@numberpage}{\number\c@page}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\gls@arabicpage}
%\changes{4.22}{2016-04-19}{new}
%    \begin{macrocode}
\newcommand*{\gls@arabicpage}{\@arabic\c@page}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\gls@romanpage}
%\changes{3.04}{2012-11-18}{new}
%    \begin{macrocode}
\newcommand*{\gls@romanpage}{\romannumeral\c@page}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\gls@Romanpage}
%\changes{3.05}{2013-04-21}{new}
%    \begin{macrocode}
\newcommand*{\gls@Romanpage}{\@Roman\c@page}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaddprotectedpagefmt}
%\begin{definition}
%\cs{glsaddprotectedpagefmt}\marg{cs name}
%\end{definition}
% Added a page format to the list of protected page formats.
% The argument should be the name (without a backslash) of the
% command that takes a \TeX\ register as the argument 
% (\verb|\|\meta{csname}\verb|\c@page| must be valid).
%\changes{4.11}{2014-09-01}{new}
%\changes{1.46}{2021-09-20}{changed \cs{eappto} to \cs{protected@eappto}}
%    \begin{macrocode}
\newcommand*{\glsaddprotectedpagefmt}[1]{%
  \protected@eappto\gls@protected@pagefmts{,\expandonce{\csname gls#1page\endcsname}}%
  \csedef{gls#1page}{\expandonce{\csname#1\endcsname}\noexpand\c@page}%
  \protected@eappto\@wrglossarynumberhook{%
    \noexpand\let\expandonce{\csname org@gls#1\endcsname}%
      \expandonce{\csname#1\endcsname}%
    \noexpand\def\expandonce{\csname#1\endcsname}{%
      \noexpand\@wrglossary@pageformat
         \expandonce{\csname gls#1page\endcsname}%
         \expandonce{\csname org@gls#1\endcsname}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@wrglossarynumberhook}
% Hook used by \cs{@@do@wrglossary}
%    \begin{macrocode}
\newcommand*\@wrglossarynumberhook{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@wrglossary@pageformat}
%    \begin{macrocode}
\newcommand{\@wrglossary@pageformat}[3]{%
  \ifx#3\c@page #1\else #2#3\fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@do@wrglossary}
%\changes{4.33}{2017-09-20}{changed to check for \pkgopt{esclocations}}
% Write the glossary entry in the appropriate format.
%    \begin{macrocode}
\newcommand*{\@@do@wrglossary}[1]{%
  \ifglsesclocations
    \@@do@esc@wrglossary{#1}%
  \else
    \@@do@noesc@wrglossary{#1}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@do@noesc@wrglossary}
%\changes{4.33}{2017-09-20}{new}
% Write the glossary entry in the appropriate format.
% The locations don't need to be pre-processed before writing the
% information to the glossary file, but the prefix still needs to be
% found.
%    \begin{macrocode}
\newcommand*{\@@do@noesc@wrglossary}[1]{%
%    \end{macrocode}
% Don't fully expand yet.
%    \begin{macrocode}
  \expandafter\def\expandafter\@glslocref\expandafter{\theglsentrycounter}%
  \expandafter\def\expandafter\@glsHlocref\expandafter{\theHglsentrycounter}%
%    \end{macrocode}
% Find the prefix if \cs{@glsHlocref} and \cs{@glslocref} aren't the same.
%    \begin{macrocode}
  \ifx\@glsHlocref\@glslocref
    \def\@glo@counterprefix{}%
  \else
%    \end{macrocode}
% The value of the counter isn't important here as it's the prefix
% that's of interest. (\cs{c@page} will have the same value in
% both \cs{theglsentrycounter} and \cs{theHglsentrycounter} at this
% point, even if it hasn't been updated yet. The page number is not
% expected to occur in the prefix.)
%    \begin{macrocode}
    \protected@edef\@do@gls@getcounterprefix{\noexpand\@gls@getcounterprefix
      {\@glslocref}{\@glsHlocref}%
    }%
    \@do@gls@getcounterprefix
  \fi
%    \end{macrocode}
% De-tok label if required.
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
  \protected@edef\@gls@label{\glsdetoklabel{#1}}%
%    \end{macrocode}
% Write the information to file:
%    \begin{macrocode}
  \@@do@@wrglossary
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ifglswrallowprimitivemods}
%\changes{4.22}{2016-04-19}{new}
% Conditional to determine whether or not \cs{@@do@esc@wrglossary}
% should be allowed to temporarily redefine \cs{the} and
% \cs{number}.
%    \begin{macrocode}
\newif\ifglswrallowprimitivemods
\glswrallowprimitivemodstrue
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@do@esc@wrglossary}
%\changes{4.33}{2017-09-20}{renamed from \cs{@@do@esc@wrglossary}}
%\changes{1.17}{2008-12-26}{new}
% Write the glossary entry in the appropriate format.
% (Need to set \cs{@glsnumberformat} and \cs{@gls@counter} prior to use.)
% The argument is the entry's label.
%\changes{3.0}{2011-04-02}{modified to use new format}
%This is far more complicated with \app{xindy} than with other
%indexing methods. There are two necessary but
%conflicting requirements with \app{xindy}:
%\begin{enumerate}
%\item all backslashes in the location must be escaped;
%\item \cs{c@page} can't be prematurely expanded.
%\end{enumerate}
% (With \app{makeindex} there's the remote possibility that the page
% compositor is a \app{makeindex} special character, so that would
% also need to be escaped.)
%
%For example, suppose \cs{thepage} is defined as
%\begin{verbatim}
%\renewcommand{\thepage}{\tally{page}}
%\newcommand{\tally}[1]{\tallynum{\expandafter\the\csname c@#1\endcsname}}
%\end{verbatim}
%where \cs{tallynum} is a robust command that takes a number as its
%argument. With all indexing methods other than \app{xindy}, a
%deferred write with \cs{thepage} as the location will expand to 
%\cs{tallynum}\marg{n} where \meta{n} is the page number. Since the
%write is deferred, the page number is correct. (\app{makeindex}
%won't accept this location format, but \cs{makenoidxglossaries}
%and \app{bib2gls} are quite happy with it.) Unfortunately, this
%fails with \app{xindy} because \app{xindy} interprets this location
%as \texttt{tallynum}\marg{n} because \cs{t} represents a
%the character \qt{t}. The location must be written as
%\verb|\\tallynum|\marg{n}.
%
%This means that the location
%\verb|\tally{page}| must be expanded and then the backslashes must
%be doubled. Unfortunately \cs{c@page} mustn't be expanded until the
%deferred write is performed, so the location actually needs to be
%expanded to \verb|\tallynum{\the\c@page}| but the backslashes in
%\verb|\the\c@page| mustn't be escaped. All other backslashes must be
%escaped. (In this case, only the backslash in \cs{tallynum} but the
%location format may include other control sequences.) The code
%below works on the assumption that commands like \cs{tally} are
%defined in the form
%\begin{verbatim}
%\newcommand{\tally}[1]{\tallynum{\expandafter\the\csname c@#1\endcsname}}
%\end{verbatim}
%(note the use of \cs{expandafter} and \cs{name})
%or in the form
%\begin{verbatim}
%\newcommand{\tally}[1]{\tallynum{\arabic{#1}}}
%\end{verbatim}
%In the second case, \cs{arabic} is one of the known commands that's
%temporarily adjusted to prevent \cs{c@page} from being prematurely
%expanded. In the first case, \cs{the} is temporarily modified
%(unless \cs{glswrallowprimitivemodsfalse}) to
%check if it's followed by \cs{c@page}. The \cs{expandafter} ensures
%that it is. If \cs{tally} is defined in another way that hides
%\cs{c@page} for example using \verb|\the\value{#1}| then the
%process fails.
%
%With \app{makeindex}, \cs{tallynum} needs to expand to just the
%decimal number while writing the location to the glossary file,
%otherwise \app{makeindex} will reject it. This can
%be done by defining \cs{glstallypage} so that \cs{tally} can
%locally be set to \cs{arabic} while expansion is occurring. Again, \cs{c@page}
%must be protected from expansion until the deferred write occurs.
%
%The expansion before the write occurs also allows the hyper prefix
%to be determined where \cs{theH}\meta{counter} is defined in the
%form \meta{prefix}\verb|.|\cs{the}\meta{counter}. It's possible (although
%again unlikely) that a \app{makeindex} character might occur in the
%prefix, which therefore needs escaping. The prefix is passed as the
%optional argument of \cs{setentrycounter} which is needed by commands like
%\cs{glshypernumber} to create a hyperlink for a given counter (like
%\cs{hyperpage} but for an arbitrary counter).
%
%    \begin{macrocode}
\newcommand*{\@@do@esc@wrglossary}[1]{% please read documented code!
  \begingroup
%    \end{macrocode}
% First a bit of hackery to prevent premature
% expansion of \cs{c@page}. Store original definitions (scoped):
%\changes{3.04}{2012-11-18}{modified to compensate for possible
%incorrect page number}
%\changes{4.22}{2016-04-19}{added check for \cs{@arabic}}
%    \begin{macrocode}
    \let\gls@orgthe\the
    \let\gls@orgnumber\number
    \let\gls@orgarabic\@arabic
    \let\gls@orgromannumeral\romannumeral
    \let\gls@orgalph\@alph
    \let\gls@orgAlph\@Alph
    \let\gls@orgRoman\@Roman
%    \end{macrocode}
% Redefine:
%\changes{3.05}{2013-04-21}{add Roman case. Fixed bugs in the else statements}
%\changes{4.22}{2016-04-19}{added test to allow temporary primitive
%modifications and added arabic case}
%    \begin{macrocode}
    \ifglswrallowprimitivemods
%    \end{macrocode}
%The redefinition of \cs{the} to use \cs{expandafter} solves the
%problem of \verb|\the\csname c@|\meta{counter}\verb|\endcsname| but
%is only a partial solution to the problem of \verb|\the\value|. 
%With \cs{value}, \cs{c@page} is too deeply hidden and will be
%expanded too soon, but at least there won't be an error.
%\changes{4.33}{2017-09-20}{added \cs{gls@the} and \cs{gls@number}}
%    \begin{macrocode}
      \def\gls@the##1{%
        \ifx##1\c@page \gls@numberpage\else\gls@orgthe##1\fi}%
      \def\the{\expandafter\gls@the}%
      \def\gls@number##1{%
        \ifx##1\c@page \gls@numberpage\else\gls@orgnumber##1\fi}%
      \def\number{\expandafter\gls@number}%
    \fi
    \def\@arabic##1{%
      \ifx##1\c@page \gls@arabicpage\else\gls@orgarabic##1\fi}%
    \def\romannumeral##1{%
      \ifx##1\c@page \gls@romanpage\else\gls@orgromannumeral##1\fi}%
    \def\@Roman##1{%
      \ifx##1\c@page \gls@Romanpage\else\gls@orgRoman##1\fi}%
    \def\@alph##1{%
      \ifx##1\c@page \gls@alphpage\else\gls@orgalph##1\fi}%
    \def\@Alph##1{%
      \ifx##1\c@page \gls@Alphpage\else\gls@orgAlph##1\fi}%
%    \end{macrocode}
% Add hook to allow for other number formats:
%\changes{4.11}{2014-09-01}{added hook}
%    \begin{macrocode}
   \@wrglossarynumberhook
%    \end{macrocode}
% Prevent expansion:
%    \begin{macrocode}
    \gls@disablepagerefexpansion
%    \end{macrocode}
% Now store location in \cs{@glslocref}:
%    \begin{macrocode}
    \protected@xdef\@glslocref{\theglsentrycounter}%
  \endgroup
%    \end{macrocode}
% Escape any special characters. It's possible that with
% \app{makeindex} the separator might be a \app{makeindex} special character.
% Although not likely, it still needs to be taken into account.
%    \begin{macrocode}
  \@gls@checkmkidxchars\@glslocref
%    \end{macrocode}
% Check if the hyper-location is the same as the location and set
% the hyper prefix.
%\changes{3.0}{2011-04-02}{added check for hyper location prefix}
%    \begin{macrocode}
  \expandafter\ifx\theHglsentrycounter\theglsentrycounter\relax
    \def\@glo@counterprefix{}%
  \else
    \protected@edef\@glsHlocref{\theHglsentrycounter}%
    \@gls@checkmkidxchars\@glsHlocref
    \edef\@do@gls@getcounterprefix{\noexpand\@gls@getcounterprefix
      {\@glslocref}{\@glsHlocref}%
    }%
    \@do@gls@getcounterprefix
  \fi
%    \end{macrocode}
% De-tok label if required
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
  \protected@edef\@gls@label{\glsdetoklabel{#1}}%
%    \end{macrocode}
% Write the information to file:
%    \begin{macrocode}
  \@@do@@wrglossary
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@do@@wrglossary}
%    \begin{macrocode}
\newcommand*{\@@do@@wrglossary}{%
%    \end{macrocode}
% Determine whether to use \app{xindy} or \app{makeindex}
% syntax
%    \begin{macrocode}
  \ifglsxindy
%    \end{macrocode}
% Need to determine if the formatting information starts with
% a ( or ) indicating a range.
%    \begin{macrocode}
    \expandafter\@glo@check@mkidxrangechar\@glsnumberformat\@nil
    \def\@glo@range{}%
    \expandafter\if\@glo@prefix(\relax
      \def\@glo@range{:open-range}%
    \else
      \expandafter\if\@glo@prefix)\relax
        \def\@glo@range{:close-range}%
      \fi
    \fi
%    \end{macrocode}
% Write to the glossary file using \app{xindy} syntax.
%    \begin{macrocode}
    \gls@glossary{\csname glo@\@gls@label @type\endcsname}{%
    (indexentry :tkey (\csname glo@\@gls@label @index\endcsname)
%    \end{macrocode}
%\changes{3.02}{2012-05-21}{changed \cs{@glslocref} to \cs{theglsentrycounter}}
%\changes{3.04}{2012-11-18}{changed \cs{theglsentrycounter} back to \cs{@glslocref}}
%    \begin{macrocode}
      :locref \string"{\@glo@counterprefix}{\@glslocref}\string" %
      :attr \string"\@gls@counter\@glo@suffix\string"
      \@glo@range
    )
    }%
  \else
%    \end{macrocode}
% Convert the format information into the format required for
% \app{makeindex}
%    \begin{macrocode}
    \@set@glo@numformat{\@glo@numfmt}{\@gls@counter}{\@glsnumberformat}%
      {\@glo@counterprefix}%
%    \end{macrocode}
% Write to the glossary file using \app{makeindex} syntax.
%    \begin{macrocode}
    \gls@glossary{\csname glo@\@gls@label @type\endcsname}{%
    \string\glossaryentry{\csname glo@\@gls@label @index\endcsname
      \@gls@encapchar\@glo@numfmt}{\@glslocref}}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@getcounterprefix}
% Get the prefix that needs to be prepended to counter in order to
% get the hyper counter. (For example, with the standard
% \cls{article} class and \sty{hyperref}, \ics{theequation} needs to
% be prefixed with \meta{section num}|.| to get the equivalent
% \ics{theHequation}.) NB this assumes that the prefix ends with a
% dot, which is the standard. (Otherwise it makes the xindy location
% classes more complicated.)
%    \begin{macrocode}
\newcommand*\@gls@getcounterprefix[2]{%
  \edef\@gls@thisloc{#1}\edef\@gls@thisHloc{#2}%
  \ifx\@gls@thisloc\@gls@thisHloc
    \def\@glo@counterprefix{}%
  \else
    \def\@gls@get@counterprefix##1.#1##2\end@getprefix{%
      \def\@glo@tmp{##2}%
      \ifx\@glo@tmp\@empty
        \def\@glo@counterprefix{}%
      \else
        \def\@glo@counterprefix{##1}%
      \fi
    }%
    \@gls@get@counterprefix#2.#1\end@getprefix
%    \end{macrocode}
% Warn if no prefix can be formed.
%\changes{4.04}{2014-03-04}{added warning if no prefix can be formed}
%    \begin{macrocode}
    \ifx\@glo@counterprefix\@empty
      \GlossariesWarning{Hyper target `#2' can't be formed by
       prefixing^^Jlocation `#1'. You need to modify the
       definition of \string\theH\@gls@counter^^Jotherwise you
       will get the warning: "`name{\@gls@counter.#1}' has been^^J
       referenced but does not exist"}%
    \fi
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\section{Glossary Entry Cross-References}
%\begin{macro}{\@do@seeglossary}
%\changes{1.17}{2008-12-26}{new}
% Write the glossary entry with a cross reference.
% The first argument is the entry's label, the second must be in
% the form \oarg{tag}\marg{list}, where \meta{tag} is a tag
% such as ``see'' and \meta{list} is a list of labels.
%\changes{3.0}{2011-04-02}{Sanitize and escape cross-referencing
%information}
%    \begin{macrocode}
\newcommand{\@do@seeglossary}[2]{%
\def\@gls@xref{#2}%
\@onelevel@sanitize\@gls@xref
\@gls@checkmkidxchars\@gls@xref
\ifglsxindy
  \gls@glossary{\csname glo@#1@type\endcsname}{%
    (indexentry
      :tkey (\csname glo@#1@index\endcsname)
      :xref (\string"\@gls@xref\string")
      :attr \string"see\string"
    )
  }%
\else
  \gls@glossary{\csname glo@#1@type\endcsname}{%
  \string\glossaryentry{\csname glo@#1@index\endcsname
  \@gls@encapchar glsseeformat\@gls@xref}{Z}}%
\fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@fixbraces}
% If no optional argument is specified, list needs to be enclosed
% in a set of braces.
%    \begin{macrocode}
\def\@gls@fixbraces#1#2#3\@nil{%
  \ifx#2[\relax
   \@@gls@fixbraces#1#2#3\@end@fixbraces
  \else
    \def#1{{#2#3}}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@@gls@fixbraces}
%    \begin{macrocode}
\def\@@gls@fixbraces#1[#2]#3\@end@fixbraces{%
  \def#1{[#2]{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glssee}
%\cs{glssee}\marg{label}\marg{cross-ref list}
%\changes{1.17}{2008-12-26}{new}
%\changes{3.08a}{2013-09-28}{made robust}
%\changes{4.45}{2020-02-13}{switched to \cs{newrobustcmd}}
%    \begin{macrocode}
\newrobustcmd*{\glssee}[3][\seename]{%
  \@do@seeglossary{#2}{[#1]{#3}}}
\newcommand*{\@glssee}[3][\seename]{%
  \glssee[#1]{#3}{#2}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsseeformat}
%\changes{1.17}{2008-12-26}{new}
%\changes{3.08a}{2013-09-28}{made robust}
% The first argument specifies what tag to use (e.g.\ ``see''),
% the second argument is a comma-separated list of labels.
% The final argument (the location) is ignored.
%\changes{4.45}{2020-02-13}{switched to \cs{newrobustcmd}}
%    \begin{macrocode}
\newrobustcmd*{\glsseeformat}[3][\seename]{%
  \emph{#1} \glsseelist{#2}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsseelist}
%\cs{glsseelist}\marg{list} formats list of entry labels.
%\changes{3.08a}{2013-09-28}{made robust}
%\changes{4.45}{2020-02-13}{switched to \cs{newrobustcmd}}
%    \begin{macrocode}
\newrobustcmd*{\glsseelist}[1]{%
%    \end{macrocode}
% If there is only one item in the list, set the last separator
% to do nothing.
%    \begin{macrocode}
  \let\@gls@dolast\relax
%    \end{macrocode}
% Don't display separator on the first iteration of the loop
%    \begin{macrocode}
  \let\@gls@donext\relax
%    \end{macrocode}
% Iterate through the labels
%    \begin{macrocode}
  \@for\@gls@thislabel:=#1\do{%
%    \end{macrocode}
% Check if on last iteration of loop
%    \begin{macrocode}
    \ifx\@xfor@nextelement\@nnil
      \@gls@dolast
    \else
      \@gls@donext
    \fi
%    \end{macrocode}
% Display the entry for this label.
% (Expanding label as it's a temporary control sequence that's used
% elsewhere.)
%\changes{4.03}{2014-01-20}{added \cs{expandafter} commands}
%    \begin{macrocode}
    \expandafter\glsseeitem\expandafter{\@gls@thislabel}%
%    \end{macrocode}
% Update separators
%    \begin{macrocode}
    \let\@gls@dolast\glsseelastsep
    \let\@gls@donext\glsseesep
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsseelastsep}
% Separator to use between penultimate and ultimate entries in a
% cross-referencing list.
%    \begin{macrocode}
\newcommand*{\glsseelastsep}{\space\andname\space}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsseesep}
% Separator to use between entries in a cross-referencing list.
%    \begin{macrocode}
\newcommand*{\glsseesep}{, }
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsseeitem}
%\cs{glsseeitem}\marg{label} formats individual entry in a 
% cross-referencing list.
%\changes{3.0}{2011-04-02}{hyperlink uses \cs{glsseeitemformat} instead
%of \cs{glsentryname}}
%\changes{3.08a}{2013-09-28}{made robust}
%\changes{4.45}{2020-02-13}{switched to \cs{newrobustcmd}}
%    \begin{macrocode}
\newrobustcmd*{\glsseeitem}[1]{\glshyperlink[\glsseeitemformat{#1}]{#1}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsseeitemformat}
%\changes{3.0}{2011-04-02}{new}
% As from v3.0, default is to use \ics{glsentrytext} instead of
% \ics{glsentryname}. (To avoid problems with the \gloskey{name} key being
% sanitized, although this is no longer a problem now.)
%    \begin{macrocode}
\newcommand*{\glsseeitemformat}[1]{\glsentrytext{#1}}
%    \end{macrocode}
%\end{macro}
%
% \section{Displaying the glossary}\label{sec:code:printglos}
% An individual glossary is displayed in the text using
% \cs{printglossary}\oarg{key-val list}. If the 
% \gloskey[printglossary]{type} key is omitted, the default glossary is displayed.
% The optional argument can be used to specify an alternative
% glossary, and can also be used to set the style, title and
% entry in the table of contents. Available keys are defined below.
%
%\begin{macro}{\gls@save@numberlist}
%\changes{3.02}{2012-05-21}{new}
% Provide command to store number list.
%    \begin{macrocode}
\newcommand*{\gls@save@numberlist}[1]{%
  \ifglssavenumberlist
    \toks@{#1}%
%    \end{macrocode}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
    \protected@edef\@do@writeaux@info{%
        \noexpand\csgdef{glo@\glscurrententrylabel @numberlist}{\the\toks@}%
    }%
    \@onelevel@sanitize\@do@writeaux@info
    \protected@write\@auxout{}{\@do@writeaux@info}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\warn@noprintglossary}
% Warn the user if they have forgotten \ics{printglossaries}
% or \ics{printglossary}. (Will be suppressed if there is at
% least one occurrence of \ics{printglossary}. There is no check
% to ensure that there is a \ics{printglossary} for each defined
% glossary.)
%\changes{4.04}{2014-03-06}{Activate warning in \cs{makeglossaries}}
%    \begin{macrocode}
\newcommand*{\warn@noprintglossary}{}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\printglossary}
%\changes{1.17}{2008-12-26}{added print language to aux file}
%\changes{1.15}{2008-08-15}{changed the way the TOC title is set}
%\changes{1.17}{2008-12-26}{added check to determine if
%\cs{printglossary} is already
% defined}
% The TOC title needs to be processed in a different manner
% to the main title in case the \sty{translator} and \sty{hyperref} packages
% are both being used.
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%    \begin{macrocode}
\ifcsundef{printglossary}{}%
{%
%    \end{macrocode}
% If \cs{printglossary} is already defined, issue a warning
% and undefine it.
%    \begin{macrocode}
  \@gls@warnonglossdefined
  \undef\printglossary
}
%    \end{macrocode}
% Neither \cs{printglossary} nor \cs{printnoidxglossary} can work
% with an ignored glossary (since ignored glossaries normally
% suppress indexing and there's no associated file for
% \gls{makeindex}/\gls{xindy} to process). However \cs{printunsrtglossary} can be used
% with an ignored glossary, so provide a command to warn if the
% glossary doesn't exist or is an ignored glossary.
%\begin{macro}{\@printgloss@checkexists@noignored}
%\changes{4.46}{2020-03-19}{new}
%    \begin{macrocode}
\newcommand*{\@printgloss@checkexists@noignored}[2]{%
  \@ifglossaryexists{#1}%
  {#2}%
  {%
    \ifignoredglossary{#1}%
    {\GlossariesWarning{Glossary `#1' is an ignored glossary}}%
    {\GlossariesWarning{Glossary `#1' doesn't exist}}%
  }%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@printgloss@checkexists@allowignored}
%\changes{4.46}{2020-03-19}{new}
%For use with \cs{printunsrtglossary}.
%    \begin{macrocode}
\newcommand*{\@printgloss@checkexists@allowignored}[2]{%
  \s@ifglossaryexists{#1}%
  {#2}%
  {\GlossariesWarning{Glossary `#1' doesn't exist}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@printgloss@checkexists}
%\changes{4.46}{2020-03-19}{new}
%    \begin{macrocode}
\let\@printgloss@checkexists\@printgloss@checkexists@noignored
%    \end{macrocode}
%\end{macro}
%
%
% \cs{printglossary} has an optional argument. The default
% value is to set the glossary type to the main glossary.
%\changes{4.04}{2014-03-06}{changed to use new \cs{@printglossary}}
%    \begin{macrocode}
\newcommand*{\printglossary}[1][type=\glsdefaulttype]{%
  \let\@printgloss@checkexists\@printgloss@checkexists@noignored
  \@printglossary{#1}{\@print@glossary}%
}
%    \end{macrocode}
%\end{macro}
%
% The \cs{printglossaries} command will do \cs{printglossary}
% for each glossary type that has been defined. It is better
% to use \cs{printglossaries} rather than individual
% \cs{printglossary} commands to ensure that you don't forget
% any new glossaries you may have created. It also makes it easier to
% chop and change the value of the \pkgopt{acronym} package option.
% However, if you want to list the glossaries in a different order,
% or if you want to set the title or table of contents entry, or
% if you want to use different glossary styles for each glossary, you
% will need to use \cs{printglossary} explicitly for each
% glossary type.
%\begin{macro}{\printglossaries}
%    \begin{macrocode}
\newcommand*{\printglossaries}{%
  \forallglossaries{\@@glo@type}{\printglossary[type=\@@glo@type]}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\printnoidxglossary}
%\changes{4.04}{2014-03-06}{new}
% Provide an alternative to \cs{printglossary} that doesn't require
% an external indexing application. Entries won't be sorted and the
% location list will be empty.
%    \begin{macrocode}
\newcommand*{\printnoidxglossary}[1][type=\glsdefaulttype]{%
  \let\@printgloss@checkexists\@printgloss@checkexists@noignored
  \@printglossary{#1}{\@print@noidx@glossary}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\printnoidxglossaries}
% Analogous to \cs{printglossaries}
%\changes{4.04}{2014-03-06}{new}
%    \begin{macrocode}
\newcommand*{\printnoidxglossaries}{%
  \forallglossaries{\@@glo@type}{\printnoidxglossary[type=\@@glo@type]}%
}
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{\@printgloss@setsort}
% Initialise to do nothing.
%\changes{4.04}{2014-03-06}{new}
%    \begin{macrocode}
\newcommand*{\@printgloss@setsort}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@preglossaryhook}
%\changes{4.19}{2015-11-22}{new}
%    \begin{macrocode}
\newcommand*{\@gls@preglossaryhook}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@printglossary}
%\changes{4.04}{2014-03-06}{new}
% Sets up the glossary for either \cs{printglossary} or
% \cs{printnoidxglossary}. The first argument is the options list,
% the second argument is the handler macro that
% deals with the actual glossary. This is also used by
% \sty{glossaries-extra}'s \ics{printunsrtglossary} which may be
% used with an ignored glossary.
%    \begin{macrocode}
\newcommand{\@printglossary}[2]{%
%    \end{macrocode}
% Set up defaults.
%    \begin{macrocode}
  \def\@glo@type{\glsdefaulttype}%
  \def\glossarytitle{\csname @glotype@\@glo@type @title\endcsname}%
%    \end{macrocode}
%\changes{3.03}{2012/09/21}{allow title to override default toctitle}
%    \begin{macrocode}
  \def\glossarytoctitle{\glossarytitle}%
  \let\org@glossarytitle\glossarytitle
%    \end{macrocode}
%\changes{4.21}{2016-01-24}{warn if no style has been set}
%    \begin{macrocode}
  \def\@glossarystyle{%
    \ifx\@glossary@default@style\relax
      \GlossariesWarning{No default glossary style provided \MessageBreak
        for the glossary `\@glo@type'. \MessageBreak
        Using deprecated fallback. \MessageBreak
        To fix this set the style with \MessageBreak
        \string\setglossarystyle\space or use the \MessageBreak
        style key=value option}%
    \fi
  }%
  \def\gls@dotoctitle{\glssettoctitle{\@glo@type}}%
%    \end{macrocode}
% Store current value of \ics{glossaryentrynumbers}. (This may
% be changed via the optional argument)
%    \begin{macrocode}
  \let\@org@glossaryentrynumbers\glossaryentrynumbers
%    \end{macrocode}
% Localise the effects of the optional argument
%    \begin{macrocode}
  \bgroup
%    \end{macrocode}
% Activate or deactivate sort key:
%    \begin{macrocode}
   \@printgloss@setsort
%    \end{macrocode}
% Determine settings specified in the optional argument.
%    \begin{macrocode}
   \setkeys{printgloss}{#1}%
%    \end{macrocode}
% Does the glossary exist?
%\changes{4.46}{2020-03-19}{replaced \cs{ifglossaryexists} with
%\cs{@printgloss@checkexists}}
%    \begin{macrocode}
   \@printgloss@checkexists{\@glo@type}%
   {%
%    \end{macrocode}
% If title has been set, but toctitle hasn't, make toctitle the same
% as given title (rather than the title used when the glossary was
% defined)
%\changes{3.0}{2011-04-02}{make toctitle default to title}
%    \begin{macrocode}
    \ifx\glossarytitle\org@glossarytitle
    \else
      \expandafter\let\csname @glotype@\@glo@type @title\endcsname
                    \glossarytitle
    \fi
%    \end{macrocode}
% Allow a high-level user command to indicate the current glossary
%\changes{3.0}{2011-04-02}{added \cs{currentglossary}}
%    \begin{macrocode}
    \let\currentglossary\@glo@type
%    \end{macrocode}
%Enable individual number lists to be suppressed.
%    \begin{macrocode}
    \let\org@glossaryentrynumbers\glossaryentrynumbers
    \let\glsnonextpages\@glsnonextpages
%    \end{macrocode}
% Enable individual number list to be activated:
%\changes{3.0}{2011-04-02}{added \cs{glsnextpages}}
%    \begin{macrocode}
    \let\glsnextpages\@glsnextpages
%    \end{macrocode}
% Enable suppression of description terminators.
%    \begin{macrocode}
    \let\nopostdesc\@nopostdesc
%    \end{macrocode}
% Set up the entry for the TOC
%    \begin{macrocode}
    \gls@dotoctitle
%    \end{macrocode}
% Set the glossary style
%    \begin{macrocode}
    \@glossarystyle
%    \end{macrocode}
%\changes{3.02}{2012-05-21}{add a way to fetch current entry label}
% Added a way to fetch the current entry label (v3.08 updated for
% new \cs{glossentry} and \cs{subglossentry}, but this is now only
% needed for backward compatibility):
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{1.46}{2021-09-20}{changed \cs{xdef} to \cs{protected@xdef}}
%    \begin{macrocode}
    \let\gls@org@glossaryentryfield\glossentry
    \let\gls@org@glossarysubentryfield\subglossentry
    \renewcommand{\glossentry}[1]{%
      \protected@xdef\glscurrententrylabel{\glsdetoklabel{##1}}%
      \gls@org@glossaryentryfield{##1}%
    }%
    \renewcommand{\subglossentry}[2]{%
      \protected@xdef\glscurrententrylabel{\glsdetoklabel{##2}}%
      \gls@org@glossarysubentryfield{##1}{##2}%
    }%
%    \end{macrocode}
%\changes{4.19}{2015-11-22}{added \cs{@gls@preglossaryhook}}
%    \begin{macrocode}
    \@gls@preglossaryhook
%    \end{macrocode}
% Now do the handler macro that deals with the actual glossary:
%    \begin{macrocode}
    #2%
   }%
%    \end{macrocode}
% End the current scope
%    \begin{macrocode}
  \egroup
%    \end{macrocode}
% Reset \ics{glossaryentrynumbers}
%    \begin{macrocode}
  \global\let\glossaryentrynumbers\@org@glossaryentrynumbers
%    \end{macrocode}
% Suppress warning about no \ics{printglossary}
%\changes{2.02}{2007-07-13}{suppressed warning globally rather than locally}
%    \begin{macrocode}
  \global\let\warn@noprintglossary\relax
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@print@glossary}
%\changes{4.04}{2014-03-06}{new}
% Internal workings of \cs{printglossary} dealing with reading the
% external file.
%    \begin{macrocode}
\newcommand{\@print@glossary}{%
%    \end{macrocode}
% Some macros may end up being expanded into internals in the
% glossary, so need to make @ a letter. (Unlikely to be a problem
% since v3.08a but kept for backward compatibility.)
%    \begin{macrocode}
  \makeatletter
%    \end{macrocode}
% Input the glossary file, if it exists.
%    \begin{macrocode}
  \@input@{\jobname.\csname @glotype@\@glo@type @in\endcsname}%
%    \end{macrocode}
% If the glossary file doesn't exist, do \cs{null}. (This ensures
% that the page is shipped out and all write commands are done.)
% This might produce an empty page, but at this point the document
% isn't complete, so it shouldn't matter.
%    \begin{macrocode}
  \IfFileExists{\jobname.\csname @glotype@\@glo@type @in\endcsname}%
  {}%
  {\null}%
%    \end{macrocode}
% If \app{xindy} is being used, need to write the language
% dependent information to the \filetype{.aux} file for
% \app{makeglossaries}.
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%\changes{3.04}{2012-11-18}{Moved aux write to end of document to
%prevent unwanted whatsit occurring here.}
%    \begin{macrocode}
  \ifglsxindy
    \ifcsundef{@xdy@\@glo@type @language}%
    {%
      \edef\@do@auxoutstuff{%
        \noexpand\AtEndDocument{%
%    \end{macrocode}
%\changes{3.10a}{2013-10-13}{Added providecommand code to aux file}
% If the user removes the glossary package from their document,
% ensure the next run doesn't throw a load of undefined control
% sequence errors when the aux file is parsed.
%    \begin{macrocode}
          \noexpand\immediate\noexpand\write\@auxout{%
            \string\providecommand\string\@xdylanguage[2]{}}%
          \noexpand\immediate\noexpand\write\@auxout{%
            \string\@xdylanguage{\@glo@type}{\@xdy@main@language}}%
        }%
      }%
    }%
    {%
      \edef\@do@auxoutstuff{%
        \noexpand\AtEndDocument{%
          \noexpand\immediate\noexpand\write\@auxout{%
            \string\providecommand\string\@xdylanguage[2]{}}%
          \noexpand\immediate\noexpand\write\@auxout{%
            \string\@xdylanguage{\@glo@type}{\csname @xdy@\@glo@type 
              @language\endcsname}}%
        }%
      }%
    }%
    \@do@auxoutstuff
    \edef\@do@auxoutstuff{%
      \noexpand\AtEndDocument{%
%    \end{macrocode}
%\changes{3.10a}{2013-10-13}{Added providecommand code to aux file}
% If the user removes the glossaries package from their document,
% ensure the next run doesn't throw a load of undefined control
% sequence errors when the aux file is parsed.
%    \begin{macrocode}
         \noexpand\immediate\noexpand\write\@auxout{%
          \string\providecommand\string\@gls@codepage[2]{}}%
         \noexpand\immediate\noexpand\write\@auxout{%
          \string\@gls@codepage{\@glo@type}{\gls@codepage}}%
      }%
    }%
    \@do@auxoutstuff
  \fi
%    \end{macrocode}
% Activate warning if \cs{makeglossaries} hasn't been used.
%    \begin{macrocode}
  \renewcommand*{\@warn@nomakeglossaries}{%
    \GlossariesWarningNoLine{\string\makeglossaries\space
    hasn't been used,^^Jthe glossaries will not be updated}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
% The sort macros all have the syntax:
%\begin{definition}
%\cs{@glo@sortmacro@\meta{order}}\marg{type}
%\end{definition}
% where \meta{order} is the sort order as specified by the sort key
% and \meta{type} is the glossary type. (The referenced entry list
% is stored in \cs{@glsref@\meta{type}.} The actual sorting is done
% by \cs{@glo@sortentries}\marg{handler}\marg{type}.
%
%\begin{macro}{\@glo@sortentries}
%\changes{4.04}{2014-03-06}{new}
%    \begin{macrocode}
\newcommand*{\@glo@sortentries}[2]{%
  \glosortentrieswarning
  \def\@glo@sortinglist{}%
  \def\@glo@sortinghandler{#1}%
%    \end{macrocode}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
  \protected@edef\@glo@type{#2}%
  \forlistcsloop{\@glo@do@sortentries}{@glsref@#2}%
  \csdef{@glsref@#2}{}%
  \@for\@this@label:=\@glo@sortinglist\do{%
%    \end{macrocode}
% Has this entry already been added?
%    \begin{macrocode}
    \xifinlistcs{\@this@label}{@glsref@#2}%
    {}%
    {%
      \listcsxadd{@glsref@#2}{\@this@label}%
    }%
    \ifcsdef{@glo@sortingchildren@\@this@label}%
    {%
      \@glo@addchildren{#2}{\@this@label}%
    }%
    {}%
  }%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glo@addchildren}
%\changes{4.04}{2014-03-06}{new}
%\begin{definition}
%\cs{@glo@addchildren}\marg{type}\marg{parent}
%\end{definition}
%    \begin{macrocode}
\newcommand*{\@glo@addchildren}[2]{%
%    \end{macrocode}
% Scope to allow nesting.
%    \begin{macrocode}
  \bgroup
     \letcs{\@glo@childlist}{@glo@sortingchildren@#2}%
     \@for\@this@childlabel:=\@glo@childlist\do
     {%
%    \end{macrocode}
% Check this label hasn't already been added.
%    \begin{macrocode}
       \xifinlistcs{\@this@childlabel}{@glsref@#1}%
       {}%
       {%
         \listcsxadd{@glsref@#1}{\@this@childlabel}%
       }%
%    \end{macrocode}
% Does this child have children?
%    \begin{macrocode}
       \ifcsdef{@glo@sortingchildren@\@this@childlabel}%
       {%
         \@glo@addchildren{#1}{\@this@childlabel}%
       }%
       {%
       }%
     }%
  \egroup
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glo@do@sortentries}
%\changes{4.04}{2014-03-06}{new}
%    \begin{macrocode}
\newcommand*{\@glo@do@sortentries}[1]{%
  \ifglshasparent{#1}%
  {%
%    \end{macrocode}
% This entry has a parent, so add it to the child list
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
    \protected@edef\@glo@parent{\csuse{glo@\glsdetoklabel{#1}@parent}}%
    \ifcsundef{@glo@sortingchildren@\@glo@parent}%
    {%
      \csdef{@glo@sortingchildren@\@glo@parent}{}%
    }%
    {}%
    \expandafter\@glo@sortedinsert
      \csname @glo@sortingchildren@\@glo@parent\endcsname{#1}%
%    \end{macrocode}
% Has the parent been added?
%    \begin{macrocode}
    \xifinlistcs{\@glo@parent}{@glsref@\@glo@type}%
    {%
%    \end{macrocode}
% Yes, it has so do nothing.
%    \begin{macrocode}
    }%
    {%
%    \end{macrocode}
% No, it hasn't so add it now.
%    \begin{macrocode}
       \expandafter\@glo@do@sortentries\expandafter{\@glo@parent}%
    }%
  }%
  {%
    \@glo@sortedinsert{\@glo@sortinglist}{#1}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glo@sortedinsert}
%\changes{4.04}{2014-03-06}{new}
%\begin{definition}
%\cs{@glo@sortedinsert}\marg{list}\marg{entry label}
%\end{definition}
% Insert into list.
%    \begin{macrocode}
\newcommand*{\@glo@sortedinsert}[2]{%
  \dtl@insertinto{#2}{#1}{\@glo@sortinghandler}%
}%
%    \end{macrocode}
%\end{macro}
%
% The sort handlers need to be in the form required by
% \sty{datatool}'s \cs{dtl@sortlist} macro. These must set the count
% register \cs{dtl@sortresult} to either $-1$ (\#1 less than \#2), 0
% (\#1 = \#2) or $+1$ (\#1 greater than \#2).
%\begin{macro}{\@glo@sorthandler@word}
%\changes{4.04}{2014-03-06}{new}
%    \begin{macrocode}
\newcommand*{\@glo@sorthandler@word}[2]{%
  \letcs\@gls@sort@A{glo@\glsdetoklabel{#1}@sort}%
  \letcs\@gls@sort@B{glo@\glsdetoklabel{#2}@sort}%
  \edef\glo@do@compare{%
    \noexpand\dtlwordindexcompare{\noexpand\dtl@sortresult}%
    {\expandonce\@gls@sort@B}%
    {\expandonce\@gls@sort@A}%
  }%
  \glo@do@compare
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glo@sorthandler@letter}
%\changes{4.04}{2014-03-06}{new}
%    \begin{macrocode}
\newcommand*{\@glo@sorthandler@letter}[2]{%
  \letcs\@gls@sort@A{glo@\glsdetoklabel{#1}@sort}%
  \letcs\@gls@sort@B{glo@\glsdetoklabel{#2}@sort}%
  \edef\glo@do@compare{%
    \noexpand\dtlletterindexcompare{\noexpand\dtl@sortresult}%
    {\expandonce\@gls@sort@B}%
    {\expandonce\@gls@sort@A}%
  }%
  \glo@do@compare
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glo@sorthandler@case}
%\changes{4.04}{2014-03-06}{new}
% Case-sensitive sort.
%    \begin{macrocode}
\newcommand*{\@glo@sorthandler@case}[2]{%
  \letcs\@gls@sort@A{glo@\glsdetoklabel{#1}@sort}%
  \letcs\@gls@sort@B{glo@\glsdetoklabel{#2}@sort}%
  \edef\glo@do@compare{%
    \noexpand\dtlcompare{\noexpand\dtl@sortresult}%
    {\expandonce\@gls@sort@B}%
    {\expandonce\@gls@sort@A}%
  }%
  \glo@do@compare
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glo@sorthandler@nocase}
%\changes{4.04}{2014-03-06}{new}
% Case-insensitive sort.
%    \begin{macrocode}
\newcommand*{\@glo@sorthandler@nocase}[2]{%
  \letcs\@gls@sort@A{glo@\glsdetoklabel{#1}@sort}%
  \letcs\@gls@sort@B{glo@\glsdetoklabel{#2}@sort}%
  \edef\glo@do@compare{%
    \noexpand\dtlicompare{\noexpand\dtl@sortresult}%
    {\expandonce\@gls@sort@B}%
    {\expandonce\@gls@sort@A}%
  }%
  \glo@do@compare
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glo@sortmacro@word}
%\changes{4.04}{2014-03-06}{new}
% Sort macro for `word'
%    \begin{macrocode}
\newcommand*{\@glo@sortmacro@word}[1]{%
  \ifdefstring{\@glo@default@sorttype}{standard}%
  {%
    \@glo@sortentries{\@glo@sorthandler@word}{#1}%
  }%
  {%
    \PackageError{glossaries}{Conflicting sort options:^^J
     \string\usepackage[sort=\@glo@default@sorttype]{glossaries}^^J
     \string\printnoidxglossary[sort=word]}{}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glo@sortmacro@letter}
%\changes{4.04}{2014-03-06}{new}
% Sort macro for `letter'
%    \begin{macrocode}
\newcommand*{\@glo@sortmacro@letter}[1]{%
  \ifdefstring{\@glo@default@sorttype}{standard}%
  {%
    \@glo@sortentries{\@glo@sorthandler@letter}{#1}%
  }%
  {%
    \PackageError{glossaries}{Conflicting sort options:^^J
     \string\usepackage[sort=\@glo@default@sorttype]{glossaries}^^J
     \string\printnoidxglossary[sort=letter]}{}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glo@sortmacro@standard}
%\changes{4.04}{2014-03-06}{new}
% Sort macro for `standard'. (Use either `word' or `letter' order.)
%    \begin{macrocode}
\newcommand*{\@glo@sortmacro@standard}[1]{%
  \ifdefstring{\@glo@default@sorttype}{standard}%
  {%
    \ifcsdef{@glo@sorthandler@\glsorder}%
    {%
      \@glo@sortentries{\csuse{@glo@sorthandler@\glsorder}}{#1}%
    }%
    {%
      \PackageError{glossaries}{Unknown sort handler `\glsorder'}{}%
    }%
  }%
  {%
    \PackageError{glossaries}{Conflicting sort options:^^J
     \string\usepackage[sort=\@glo@default@sorttype]{glossaries}^^J
     \string\printnoidxglossary[sort=standard]}{}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glo@sortmacro@case}
%\changes{4.04}{2014-03-06}{new}
% Sort macro for `case'
%    \begin{macrocode}
\newcommand*{\@glo@sortmacro@case}[1]{%
  \ifdefstring{\@glo@default@sorttype}{standard}%
  {%
    \@glo@sortentries{\@glo@sorthandler@case}{#1}%
  }%
  {%
    \PackageError{glossaries}{Conflicting sort options:^^J
     \string\usepackage[sort=\@glo@default@sorttype]{glossaries}^^J
     \string\printnoidxglossary[sort=case]}{}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glo@sortmacro@nocase}
%\changes{4.04}{2014-03-06}{new}
% Sort macro for `nocase'
%    \begin{macrocode}
\newcommand*{\@glo@sortmacro@nocase}[1]{%
  \ifdefstring{\@glo@default@sorttype}{standard}%
  {%
    \@glo@sortentries{\@glo@sorthandler@nocase}{#1}%
  }%
  {%
    \PackageError{glossaries}{Conflicting sort options:^^J
     \string\usepackage[sort=\@glo@default@sorttype]{glossaries}^^J
     \string\printnoidxglossary[sort=nocase]}{}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glo@sortmacro@def}
%\changes{4.04}{2014-03-06}{new}
% Sort macro for `def'. The order of definition is given in 
% \cs{glolist@\meta{type}}.
%    \begin{macrocode}
\newcommand*{\@glo@sortmacro@def}[1]{%
  \def\@glo@sortinglist{}%
  \forglsentries[#1]{\@gls@thislabel}%
  {%
    \xifinlistcs{\@gls@thislabel}{@glsref@#1}%
    {%
      \listeadd{\@glo@sortinglist}{\@gls@thislabel}%
    }%
    {%
%    \end{macrocode}
% Hasn't been referenced.
%    \begin{macrocode}
    }%
  }%
  \cslet{@glsref@#1}{\@glo@sortinglist}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glo@sortmacro@def@do}
%\changes{4.04}{2014-03-06}{new}
% This won't include parent entries that haven't been referenced.
%    \begin{macrocode}
\newcommand*{\@glo@sortmacro@def@do}[1]{%
  \ifinlistcs{#1}{@glsref@\@glo@type}%
  {}%
  {%
    \listcsadd{@glsref@\@glo@type}{#1}%
  }%
  \ifcsdef{@glo@sortingchildren@#1}%
  {%
    \@glo@addchildren{\@glo@type}{#1}%
  }%
  {}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glo@sortmacro@use}
%\changes{4.04}{2014-03-06}{new}
% Sort macro for `use'. (No sorting is required, as the entries are
% already in order of use, so do nothing.)
%    \begin{macrocode}
\newcommand*{\@glo@sortmacro@use}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@print@noidx@glossary}
%\changes{4.04}{2014-03-06}{new}
% Glossary handler for \cs{printnoidxglossary} which doesn't use an
% indexing application. Since \cs{printnoidxglossary} may occur at 
% the start of the document, we can't just check if an entry has
% been used. Instead, the first pass needs to write information to
% the aux file every time an entry is referenced. This needs to be
% read in on the second run and stored in a~list corresponding to
% the appropriate glossary.
%    \begin{macrocode}
\newcommand*{\@print@noidx@glossary}{%
  \ifcsdef{@glsref@\@glo@type}%
  {%
%    \end{macrocode}
% Sort the entries:
%    \begin{macrocode}
    \ifcsdef{@glo@sortmacro@\@glo@sorttype}%
    {%
      \csuse{@glo@sortmacro@\@glo@sorttype}{\@glo@type}%
    }%
    {%
       \PackageError{glossaries}{Unknown sort handler `\@glo@sorttype'}{}%
    }%
%    \end{macrocode}
% Do the glossary heading and preamble
%    \begin{macrocode}
    \glossarysection[\glossarytoctitle]{\glossarytitle}%
    \glossarypreamble
%    \end{macrocode}
% \changes{4.29}{2017-01-19}{moved definition of
% \cs{@gls@currentlettergroup} outside of \envfmt{theglossary} environment}
%The glossary style might use a tabular-like environment, which may
%cause scoping problems when setting the current letter group.
%The predefined tabular-like styles don't support letter group
%headings, but there's nothing to stop the user from defining their
%own custom style that might, so any redefinition of this command
%within \env{theglossary} will have to be done globally.
%    \begin{macrocode}
    \def\@gls@currentlettergroup{}%
    \begin{theglossary}%
    \glossaryheader
    \glsresetentrylist
%    \end{macrocode}
% Iterate through the entries.
%    \begin{macrocode}
   \forlistcsloop{\@gls@noidx@do}{@glsref@\@glo@type}%
%    \end{macrocode}
% Finally end the glossary and do the postamble:
%    \begin{macrocode}
    \end{theglossary}%
    \glossarypostamble
  }%
  {%
    \@gls@noref@warn{\@glo@type}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glo@grabfirst}
%\changes{4.04}{2014-03-06}{new}
%This won't work for UTF-8 and \sty{inputenc}.
%    \begin{macrocode}
\def\glo@grabfirst#1#2\@nil{%
  \def\@gls@firsttok{#1}%
  \ifdefempty\@gls@firsttok
  {%
    \def\@glo@thislettergrp{0}%
  }%
  {%
%    \end{macrocode}
% Sanitize it:
%    \begin{macrocode}
    \@onelevel@sanitize\@gls@firsttok
%    \end{macrocode}
% Fetch the first letter:
%    \begin{macrocode}
    \expandafter\@glo@grabfirst\@gls@firsttok{}{}\@nil
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glo@grabfirst}
%\changes{4.04}{2014-03-06}{new}
%    \begin{macrocode}
\def\@glo@grabfirst#1#2\@nil{%
  \ifdefempty\@glo@thislettergrp
  {%
     \def\@glo@thislettergrp{glssymbols}%
  }%
  {%
    \count@=\uccode`#1\relax
    \ifnum\count@=0\relax
      \def\@glo@thislettergrp{glssymbols}%
    \else
      \ifdefstring\@glo@sorttype{case}%
      {%
         \count@=`#1\relax
      }%
      {%
      }%
      \edef\@glo@thislettergrp{\the\count@}%
    \fi
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@noidx@do}
%\changes{4.04}{2014-03-06}{new}
% Handler for list iteration used by \cs{@print@noidx@glossary}.
% The argument is the entry label. This only allows one sublevel.
%    \begin{macrocode}
\newcommand{\@gls@noidx@do}[1]{%
%    \end{macrocode}
% Get this entry's location list
%\changes{4.07}{2014-04-04}{added \cs{global} in case it's used in a
%tabular-like style}
%    \begin{macrocode}
  \global\letcs{\@gls@loclist}{glo@\glsdetoklabel{#1}@loclist}%
%    \end{macrocode}
% Does this entry have a~parent?
%    \begin{macrocode}
  \ifglshasparent{#1}%
  {%
%    \end{macrocode}
% Has a~parent.
%    \begin{macrocode}
    \gls@level=\csuse{glo@\glsdetoklabel{#1}@level}\relax
    \ifdefvoid{\@gls@loclist}
    {%
      \subglossentry{\gls@level}{#1}{}%
    }%
    {%
      \subglossentry{\gls@level}{#1}%
      {%
        \glossaryentrynumbers{\glsnoidxloclist{\@gls@loclist}}%
      }%
    }%
  }%
  {%
%    \end{macrocode}
% Doesn't have a parent
% Get this entry's sort key
%    \begin{macrocode}
    \letcs{\@gls@sort}{glo@\glsdetoklabel{#1}@sort}%
%    \end{macrocode}
% Fetch the first letter:
%    \begin{macrocode}
    \expandafter\glo@grabfirst\@gls@sort{}{}\@nil
    \ifdefequal{\@glo@thislettergrp}{\@gls@currentlettergroup}%
    {}%
    {%
%    \end{macrocode}
% Do the group header:
%    \begin{macrocode}
      \ifdefempty{\@gls@currentlettergroup}{}%
      {%
%    \end{macrocode}
%\changes{4.30}{2017-06-11}{letter group assignment made
%global}
%The group skip may start a new scope, so make a global assignment.
%    \begin{macrocode}
        \global\let\@glo@thislettergrp\@glo@thislettergrp
        \glsgroupskip
      }%
      \glsgroupheading{\@glo@thislettergrp}%
    }%
%    \end{macrocode}
%\changes{4.29}{2017-01-19}{current letter group assignment made
%global}
%    \begin{macrocode}
    \global\let\@gls@currentlettergroup\@glo@thislettergrp
%    \end{macrocode}
% Do this entry:
%    \begin{macrocode}
    \ifdefvoid{\@gls@loclist}
    {%
      \glossentry{#1}{}%
    }%
    {%
      \glossentry{#1}%
      {%
        \glossaryentrynumbers{\glsnoidxloclist{\@gls@loclist}}%
      }%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsnoidxloclist}
%\changes{4.04}{2014-03-06}{new}
%\begin{definition}
%\cs{glsnoidxloclist}\marg{list cs}
%\end{definition}
% Display location list.
%    \begin{macrocode}
\newcommand*{\glsnoidxloclist}[1]{%
  \def\@gls@noidxloclist@sep{}%
  \def\@gls@noidxloclist@prev{}%
  \forlistloop{\glsnoidxloclisthandler}{#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsnoidxloclisthandler}
%\changes{4.04}{2014-03-06}{new}
% Handler for location list iterator.
%    \begin{macrocode}
\newcommand*{\glsnoidxloclisthandler}[1]{%
  \ifdefstring{\@gls@noidxloclist@prev}{#1}%
  {%
%    \end{macrocode}
% Same as previous location so skip.
%    \begin{macrocode}
  }%
  {%
    \@gls@noidxloclist@sep
    #1%
    \def\@gls@noidxloclist@sep{\delimN}%
    \def\@gls@noidxloclist@prev{#1}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsnoidxdisplayloclisthandler}
%\changes{4.04}{2014-03-06}{new}
% Handler for location list iterator when used with
% \ics{glsdisplaynumberlist}.
%    \begin{macrocode}
\newcommand*{\glsnoidxdisplayloclisthandler}[1]{%
  \ifdefstring{\@gls@noidxloclist@prev}{#1}%
  {%
%    \end{macrocode}
% Same as previous location so skip.
%    \begin{macrocode}
  }%
  {%
    \@gls@noidxloclist@sep
    \@gls@noidxloclist@prev
    \def\@gls@noidxloclist@prev{#1}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsnoidxdisplayloc}
%\changes{4.04}{2014-03-06}{new}
%\begin{definition}
%\cs{glsnoidxdisplayloc}\marg{prefix}\marg{counter}\marg{format}\marg{location}
%\end{definition}
% Display a location in the location list.
%    \begin{macrocode}
\newcommand*\glsnoidxdisplayloc[4]{%
  \setentrycounter[#1]{#2}%
  \csuse{#3}{#4}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@reference}
%\changes{4.04}{2014-03-06}{new}
%\begin{definition}
%\cs{@gls@reference}\marg{type}\marg{label}\marg{loc}
%\end{definition}
% Identifies that a reference has been used (for use in the aux file).
% All entries must be defined in the preamble.
%    \begin{macrocode}
\newcommand*{\@gls@reference}[3]{%
%    \end{macrocode}
% Add to label list
%    \begin{macrocode}
  \glsdoifexistsorwarn{#2}%
  {%
    \ifcsundef{@glsref@#1}{\csgdef{@glsref@#1}{}}{}%
    \ifinlistcs{#2}{@glsref@#1}%
    {}%
    {\listcsgadd{@glsref@#1}{#2}}%
%    \end{macrocode}
% Add to location list
%    \begin{macrocode}
    \ifcsundef{glo@\glsdetoklabel{#2}@loclist}%
    {\csgdef{glo@\glsdetoklabel{#2}@loclist}{}}%
    {}%
    \listcsgadd{glo@\glsdetoklabel{#2}@loclist}{#3}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
% The keys that can be used in the optional argument to
% \ics{printglossary} or \ics{printnoidxglossary} are as follows:
% The \gloskey[printglossary]{type} key sets the glossary type.
%    \begin{macrocode}
\define@key{printgloss}{type}{\def\@glo@type{#1}}
%    \end{macrocode}
% The \gloskey[printglossary]{title} key sets the title used in the glossary section
% header. This overrides the title used in \ics{newglossary}.
%\changes{3.03}{2012/09/21}{allow title to set toctitle}
%    \begin{macrocode}
\define@key{printgloss}{title}{%
 \def\glossarytitle{#1}%
 \let\gls@dotoctitle\relax
}
%    \end{macrocode}
% The \gloskey[printglossary]{toctitle} sets the text used for the relevant entry 
% in the table of contents.
%    \begin{macrocode}
\define@key{printgloss}{toctitle}{%
 \def\glossarytoctitle{#1}%
 \let\gls@dotoctitle\relax
}
%    \end{macrocode}
% The \gloskey[printglossary]{style} key sets the glossary style (but only for
% the given glossary).
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%    \begin{macrocode}
\define@key{printgloss}{style}{%
  \ifcsundef{@glsstyle@#1}%
  {%
    \PackageError{glossaries}%
    {Glossary style `#1' undefined}{}%
  }%
  {%
    \def\@glossarystyle{\setglossentrycompatibility
      \csname @glsstyle@#1\endcsname}%
  }%
}
%    \end{macrocode}
% \changes{1.14}{2008-06-17}{added numberedsection key to
% \cs{printglossary}}
% The \gloskey[printglossary]{numberedsection} key determines if this
% glossary should be in a numbered section.
%\changes{4.41}{2018-07-23}{changed \cs{val} and \cs{nr} to
%\cs{gls@numberedsection@val} and \cs{gls@numberedsection@nr}}
%    \begin{macrocode}
\define@choicekey{printgloss}{numberedsection}%
 [\gls@numberedsection@val\gls@numberedsection@nr]%
 {false,nolabel,autolabel,nameref}[nolabel]%
{%
  \ifcase\gls@numberedsection@nr\relax
    \renewcommand*{\@@glossarysecstar}{*}%
    \renewcommand*{\@@glossaryseclabel}{}%
  \or
    \renewcommand*{\@@glossarysecstar}{}%
    \renewcommand*{\@@glossaryseclabel}{}%
  \or
    \renewcommand*{\@@glossarysecstar}{}%
    \renewcommand*{\@@glossaryseclabel}{\label{\glsautoprefix\@glo@type}}%
  \or
    \renewcommand*{\@@glossarysecstar}{*}%
    \renewcommand*{\@@glossaryseclabel}{%
      \protected@edef\@currentlabelname{\glossarytoctitle}%
      \label{\glsautoprefix\@glo@type}}%
  \fi
}
%    \end{macrocode}
%
%\changes{3.08a}{2013-09-28}{added nogroupskip key to \cs{printglossary}}
% The \gloskey[printglossary]{nogroupskip} key determines whether or
% not there should be a vertical gap between glossary groups.
%    \begin{macrocode}
\define@choicekey{printgloss}{nogroupskip}{true,false}[true]{%
  \csuse{glsnogroupskip#1}%
}
%    \end{macrocode}
%
%\changes{4.08}{2014-07-30}{added nopostdot option to
%\texttt{printgloss} family}
% The \gloskey[printglossary]{nopostdot} key has the same effect as
% the package option of the same name.
%    \begin{macrocode}
\define@choicekey{printgloss}{nopostdot}{true,false}[true]{%
  \csuse{glsnopostdot#1}%
}
%    \end{macrocode}
%
%\begin{macro}{\GlsEntryCounterLabelPrefix}
%\changes{4.38}{2018-05-10}{new}
%Make it easier to redefine the label prefix.
%    \begin{macrocode}
\newcommand*{\GlsEntryCounterLabelPrefix}{glsentry-}
%    \end{macrocode}
%\end{macro}
%
%The conditionals have been moved inside the appropriate commands to
%make it easier for the user to redefine them in the preamble
%and selectively switch the counter display on and off. Previously
%the helper commands were redefined by the \gloskey{entrycounter}
%option, which would counteract any earlier customisation.
%
%\changes{4.08}{2014-07-30}{added entrycounter option to
%\texttt{printgloss} family}
% The \gloskey[printglossary]{entrycounter} key is the same as the
% package option but localised to the current glossary.
%    \begin{macrocode}
\define@choicekey{printgloss}{entrycounter}{true,false}[true]{%
  \csuse{glsentrycounter#1}%
  \@gls@define@glossaryentrycounter
}
%    \end{macrocode}
%
%\changes{4.08}{2014-07-30}{added subentrycounter option to
%\texttt{printgloss} family}
% The \gloskey[printglossary]{subentrycounter} key is the same as the
% package option but localised to the current glossary.
% Note that this doesn't affect the master/slave counter attributes,
% which occurs if \pkgopt{subentrycounter} and \pkgopt{entrycounter}
% package options are set to true.
%    \begin{macrocode}
\define@choicekey{printgloss}{subentrycounter}{true,false}[true]{%
  \csuse{glssubentrycounter#1}%
  \@gls@define@glossarysubentrycounter
}
%    \end{macrocode}
%
% \changes{1.14}{2008-06-17}{added nonumberlist key to
% \cs{printglossary}}
% The \gloskey[printglossary]{nonumberlist} key determines if this
% glossary should have a number list.
%    \begin{macrocode}
\define@boolkey{printgloss}[gls]{nonumberlist}[true]{%
\ifglsnonumberlist
   \def\glossaryentrynumbers##1{}%
\else
   \def\glossaryentrynumbers##1{##1}%
\fi}
%    \end{macrocode}
%
%\changes{4.04}{2014-03-06}{added sort key to printgloss group}
% The \gloskey[printnoidxglossary]{sort} key sets the glossary sort
% handler (\cs{printnoidxglossary} only).
%    \begin{macrocode}
\define@key{printgloss}{sort}{\@glo@assign@sortkey{#1}}
%    \end{macrocode}
%
%\begin{macro}{\@glo@no@assign@sortkey}
% Issue error if used with \cs{printglossary}
%    \begin{macrocode}
\newcommand*{\@glo@no@assign@sortkey}[1]{%
   \PackageError{glossaries}{`sort' key not permitted with
   \string\printglossary}%
   {The `sort' key may only be used with \string\printnoidxglossary}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@glo@assign@sortkey}
% For use with \cs{printnoidxglossary}
%    \begin{macrocode}
\newcommand*{\@@glo@assign@sortkey}[1]{%
  \def\@glo@sorttype{#1}%
}
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{\@glsnonextpages}
%\changes{1.17}{2008-12-26}{new}%
% Suppresses the next number list only. Global assignments required
% as it may not occur in the same level of grouping as the
% next numberlist. (For example, if \cs{glsnonextpages} is place
% in the entry's description and 3 column tabular style glossary
% is used.) \cs{org@glossaryentrynumbers} needs to be set at
% the start of each glossary, in the event that
% \ics{glossaryentrynumber} is redefined.
%    \begin{macrocode}
\newcommand*{\@glsnonextpages}{%
  \gdef\glossaryentrynumbers##1{%
     \glsresetentrylist
  }%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glsnextpages}
%\changes{3.0}{2011-04-02}{new}%
% Activate the next number list only. Global assignments required
% as it may not occur in the same level of grouping as the
% next numberlist. (For example, if \cs{glsnextpages} is place
% in the entry's description and 3 column tabular style glossary
% is used.) \cs{org@glossaryentrynumbers} needs to be set at
% the start of each glossary, in the event that
% \ics{glossaryentrynumber} is redefined.
%    \begin{macrocode}
\newcommand*{\@glsnextpages}{%
  \gdef\glossaryentrynumbers##1{%
     ##1\glsresetentrylist}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsresetentrylist}
% Resets \cs{glossaryentrynumbers}
%    \begin{macrocode}
\newcommand*{\glsresetentrylist}{%
  \global\let\glossaryentrynumbers\org@glossaryentrynumbers}
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{\glsnonextpages}
% Outside of \cs{printglossary} this does nothing.
%    \begin{macrocode}
\newcommand*{\glsnonextpages}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsnextpages}
% Outside of \cs{printglossary} this does nothing.
%    \begin{macrocode}
\newcommand*{\glsnextpages}{}
%    \end{macrocode}
%\end{macro}
%
%Process \pkgopt{entrycounter} and then \pkgopt{subentrycounter}
%options (this ensures the sub-counter can pick up the main counter
%as the master if required):
%    \begin{macrocode}
\@gls@define@glossaryentrycounter
\@gls@define@glossarysubentrycounter
%    \end{macrocode}
%\begin{macro}{\glsresetsubentrycounter}
%\changes{3.0}{2011-04-02}{new}
% Resets the \ctr{glossarysubentry} counter.
%\changes{4.38}{2018-05-10}{bug fix: move conditional inside command}
%    \begin{macrocode}
\newcommand*{\glsresetsubentrycounter}{%
  \ifglssubentrycounter
    \setcounter{glossarysubentry}{0}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsresetsubentrycounter}
%\changes{3.02}{2012-05-21}{new}
%\changes{4.38}{2018-05-10}{bug fix: move conditional inside command}
% Resets the \ctr{glossaryentry} counter.
%    \begin{macrocode}
\newcommand*{\glsresetentrycounter}{%
  \ifglsentrycounter
    \setcounter{glossaryentry}{0}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsstepentry}
%\changes{3.0}{2011-04-02}{new}
% Advance the \ctr{glossaryentry} counter if in use. The argument is
% the label associated with the entry.
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.38}{2018-05-10}{bug fix: move conditional inside command}
%    \begin{macrocode}
\newcommand*{\glsstepentry}[1]{%
  \ifglsentrycounter
    \refstepcounter{glossaryentry}%
    \label{\GlsEntryCounterLabelPrefix\glsdetoklabel{#1}}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsstepsubentry}
%\changes{3.0}{2011-04-02}{new}
% Advance the \ctr{glossarysubentry} counter if in use. The argument is
% the label associated with the subentry.
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.38}{2018-05-10}{bug fix: move conditional inside command}
%    \begin{macrocode}
\newcommand*{\glsstepsubentry}[1]{%
  \ifglssubentrycounter
%    \end{macrocode}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
    \protected@edef\currentglssubentry{\glsdetoklabel{#1}}%
    \refstepcounter{glossarysubentry}%
    \label{\GlsEntryCounterLabelPrefix\currentglssubentry}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsrefentry}
%\changes{3.0}{2011-04-02}{new}
% Reference the entry or sub-entry counter if in use, otherwise just do
% \ics{gls}.
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.38}{2018-05-10}{bug fix: move conditional inside command}
%    \begin{macrocode}
\newcommand*{\glsrefentry}[1]{%
 \ifglsentrycounter
   \ref{\GlsEntryCounterLabelPrefix\glsdetoklabel{#1}}%
 \else
   \ifglssubentrycounter
     \ref{\GlsEntryCounterLabelPrefix\glsdetoklabel{#1}}%
   \else
     \gls{#1}%
   \fi
 \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentrycounterlabel}
%\changes{3.0}{2011-04-02}{new}
%\changes{4.38}{2018-05-10}{bug fix: move conditional inside command}
% Defines how to display the \ctr{glossaryentry} counter.
%    \begin{macrocode}
\newcommand*{\glsentrycounterlabel}{%
 \ifglsentrycounter
   \theglossaryentry.\space
 \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glssubentrycounterlabel}
%\changes{3.0}{2011-04-02}{new}
%\changes{4.38}{2018-05-10}{bug fix: move conditional inside command}
% Defines how to display the \ctr{glossarysubentry} counter.
%    \begin{macrocode}
\newcommand*{\glssubentrycounterlabel}{%
 \ifglssubentrycounter
   \theglossarysubentry)\space
 \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryitem}
% Step and display \ctr{glossaryentry} counter, if appropriate.
%\changes{3.0}{2011-04-02}{new}
%\changes{4.38}{2018-05-10}{bug fix: move conditional inside command}
%    \begin{macrocode}
\newcommand*{\glsentryitem}[1]{%
  \ifglsentrycounter
    \glsstepentry{#1}\glsentrycounterlabel
  \else
    \glsresetsubentrycounter
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glssubentryitem}
% Step and display \ctr{glossarysubentry} counter, if appropriate.
%\changes{3.0}{2011-04-02}{new}
%\changes{4.38}{2018-05-10}{bug fix: move conditional inside command}
%    \begin{macrocode}
\newcommand*{\glssubentryitem}[1]{%
  \ifglssubentrycounter
    \glsstepsubentry{#1}\glssubentrycounterlabel
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{environment}{theglossary}
% If the \env{theglossary} environment has 
% already been defined, a warning will be issued. 
% This environment should be redefined by glossary styles.
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%    \begin{macrocode}
\ifcsundef{theglossary}%
{%
  \newenvironment{theglossary}{}{}%
}%
{%
  \@gls@warnontheglossdefined
  \renewenvironment{theglossary}{}{}%
}
%    \end{macrocode}
%\end{environment}
%
% The glossary header is given by \cs{glossaryheader}. 
% This forms part of the glossary style, and
% must indicate what should appear immediately after the start of the
% \env{theglossary} environment. (For example, if the glossary
% uses a tabular-like environment, it may be used to set the
% header row.) Note that if you don't want a header row, the glossary
% style must redefine \cs{glossaryheader} to do nothing.
%\begin{macro}{\glossaryheader}
%    \begin{macrocode}
\newcommand*{\glossaryheader}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glstarget}
%\changes{1.18}{2009-01-14}{new}
%\begin{definition}
%\cs{glstarget}\marg{label}\marg{name}
%\end{definition}
% Provide user interface to \cs{@glstarget} to make it easier to
% modify the glossary style in the document.
%    \begin{macrocode}
\newcommand*{\glstarget}[2]{\@glstarget{\glolinkprefix#1}{#2}}
%    \end{macrocode}
%\end{macro}
%
% As from version 3.08, glossary information is now written to the
% external files using \ics{glossentry} and \ics{subglossentry}
% instead of \cs{glossaryentryfield} and \cs{glossarysubentryfield}.
% The default definition provides backward compatibility for
% glossary styles that use the old forms.
%\begin{macro}{\compatibleglossentry}
%\changes{3.08a}{2013-09-28}{new}
%\begin{definition}
% \cs{glossentry}\marg{label}\marg{page-list}
%\end{definition}
%    \begin{macrocode}
\providecommand*{\compatibleglossentry}[2]{%
  \toks@{#2}%
  \protected@edef\@do@glossentry{\noexpand\glossaryentryfield{#1}%
    {\noexpand\glsnamefont
       {\expandafter\expandonce\csname glo@#1@name\endcsname}}%
    {\expandafter\expandonce\csname glo@#1@desc\endcsname}%
    {\expandafter\expandonce\csname glo@#1@symbol\endcsname}%
    {\the\toks@}%
  }%
  \@do@glossentry
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glossentryname}
%\changes{3.08a}{2013-09-28}{new}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\glossentryname}[1]{%
  \glsdoifexistsorwarn{#1}%
  {%
    \letcs{\glo@name}{glo@\glsdetoklabel{#1}@name}%
    \expandafter\glsnamefont\expandafter{\glo@name}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glossentryname}
%\changes{3.08a}{2013-09-28}{new}
%    \begin{macrocode}
\newcommand*{\Glossentryname}[1]{%
  \glsdoifexistsorwarn{#1}%
  {%
    \glsnamefont{\Glsentryname{#1}}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glossentrydesc}
%\changes{3.08a}{2013-09-28}{new}
%    \begin{macrocode}
\newcommand*{\glossentrydesc}[1]{%
  \glsdoifexistsorwarn{#1}%
  {%
     \glsentrydesc{#1}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glossentrydesc}
%\changes{3.08a}{2013-09-28}{new}
%    \begin{macrocode}
\newcommand*{\Glossentrydesc}[1]{%
  \glsdoifexistsorwarn{#1}%
  {%
    \Glsentrydesc{#1}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glossentrysymbol}
%\changes{3.08a}{2013-09-28}{new}
%    \begin{macrocode}
\newcommand*{\glossentrysymbol}[1]{%
  \glsdoifexistsorwarn{#1}%
  {%
     \glsentrysymbol{#1}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glossentrysymbol}
%\changes{3.08a}{2013-09-28}{new}
%    \begin{macrocode}
\newcommand*{\Glossentrysymbol}[1]{%
  \glsdoifexistsorwarn{#1}%
  {%
     \Glsentrysymbol{#1}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{\compatiblesubglossentry}
%\changes{3.08a}{2013-09-28}{new}
%\begin{definition}
% \cs{subglossentry}\marg{level}\marg{label}\marg{page-list}
%\end{definition}
%    \begin{macrocode}
\providecommand*{\compatiblesubglossentry}[3]{%
  \toks@{#3}%
  \protected@edef\@do@subglossentry{\noexpand\glossarysubentryfield{\number#1}%
  {#2}%
    {\noexpand\glsnamefont
      {\expandafter\expandonce\csname glo@#2@name\endcsname}}%
    {\expandafter\expandonce\csname glo@#2@desc\endcsname}%
    {\expandafter\expandonce\csname glo@#2@symbol\endcsname}%
    {\the\toks@}%
  }%
  \@do@subglossentry
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\setglossentrycompatibility}
%\changes{3.08a}{2013-09-28}{new}
%    \begin{macrocode}
\newcommand*{\setglossentrycompatibility}{%
  \let\glossentry\compatibleglossentry
  \let\subglossentry\compatiblesubglossentry
}
\setglossentrycompatibility
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{\glossaryentryfield}
%\begin{definition}
% \cs{glossaryentryfield}\marg{label}\marg{name}\marg{description}\marg{symbol}\marg{page-list}
%\end{definition}
% This command formerly governed how each entry row should be formatted 
% in the glossary. Now deprecated.
%\changes{3.08a}{2013-09-28}{deprecated}
%    \begin{macrocode}
\newcommand{\glossaryentryfield}[5]{%
  \GlossariesWarning
  {Deprecated use of \string\glossaryentryfield.^^J
   I recommend you change to \string\glossentry.^^J
   If you've just upgraded, try removing your gls auxiliary 
   files^^J and recompile}%
  \noindent\textbf{\glstarget{#1}{#2}} #4 #3. #5\par}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glossarysubentryfield}
%\begin{definition}
% \cs{glossarysubentryfield}\marg{level}\marg{label}\marg{name}\marg{description}\marg{symbol}\marg{page-list}
%\end{definition}
% This command governs how each subentry should be formatted 
% in the glossary. Glossary styles need to redefine this command.
% Most of the predefined styles ignore \meta{symbol}. The first
% argument is a number indicating the level. (The level should
% be greater than or equal to 1.)
%    \begin{macrocode}
\newcommand*{\glossarysubentryfield}[6]{%
  \GlossariesWarning
  {Deprecated use of \string\glossarysubentryfield.^^J
   I recommend you change to \string\subglossentry.^^J
   If you've just upgraded, try removing your gls auxiliary 
   files^^J and recompile}%
  \glstarget{#2}{\strut}#4. #6\par}
%    \end{macrocode}
%\end{macro}
%
% Within each glossary, the entries form distinct groups
% which are determined by the first character of the \gloskey{sort} 
% key. When using \app{makeindex}, there will be a maximum of 28 groups: symbols, numbers,
% and the 26 alphabetical groups A, \ldots, Z\@. If you use
% \app{xindy} the groups will depend on whatever alphabet
% is used. This is determined by the language or custom
% alphabets can be created in the \app{xindy} style file.
% The command \cs{glsgroupskip} 
% specifies what to do between glossary groups. Glossary styles
% must redefine this command. (Note that \cs{glsgroupskip}
% only occurs between groups, not at the start or end of the
% glossary.)
%\begin{macro}{\glsgroupskip}
%    \begin{macrocode}
\newcommand*{\glsgroupskip}{}
%    \end{macrocode}
%\end{macro}
%
% Each of the 28 glossary groups described above is preceded by a 
% group heading.
% This is formatted by the command \cs{glsgroupheading}
% which takes one argument which is the \emph{label} assigned to that
% group (not the title). The corresponding labels are: \texttt{glssymbols},
% \texttt{glsnumbers}, \texttt{A}, \ldots, \texttt{Z}. 
% Glossary styles must redefined this command. (In between groups,
% \cs{glsgroupheading} comes immediately after \cs{glsgroupskip}.)
%\begin{macro}{\glsgroupheading}
%    \begin{macrocode}
\newcommand*{\glsgroupheading}[1]{}
%    \end{macrocode}
%\end{macro}
% It is possible to ``trick'' \app{makeindex} into
% treating entries as though they belong to the same group, 
% even if the terms don't start with the same letter, by
% modifying the \gloskey{sort} key. For example, all entries 
% belonging to one
% group could be defined so that the \gloskey{sort} key starts with an
% "a", while entries belonging to another group could be defined
% so that the \gloskey{sort} key starts with a "b", and so on. If
% you want each group to have a heading, you would then need to
% modify the translation control sequences \cs{glsgetgrouptitle}
% and \cs{glsgetgrouplabel} so that the label is translated
% into the required title (and vice-versa).
%
%\begin{definition}
%\cs{glsgetgrouptitle}\marg{label}
%\end{definition}
% This command produces the title for the glossary group
% whose label is given by \meta{label}. By default, the group
% labelled \texttt{glssymbols} produces 
% \ics{glssymbolsgroupname}, the group labelled 
% \texttt{glsnumbers} produces \ics{glsnumbersgroupname}
% and all the other groups simply produce their label.
% As mentioned above, the group labels are: \texttt{glssymbols}, \texttt{glsnumbers},
% \texttt{A}, \ldots, \texttt{Z}\@. If you want to redefine
% the group titles, you will need to redefine this command.
% Languages other than English may produce labels that are
% non-expandable, so we need to check for that otherwise it will
% create a \qt{missing \cs{endcsname} inserted} error.
%\begin{macro}{\glsgetgrouptitle}
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%\changes{3.11a}{2013-10-15}{Added check in case non-Latin alphabet
%in use}
%    \begin{macrocode}
\newcommand*{\glsgetgrouptitle}[1]{%
  \@gls@getgrouptitle{#1}{\@gls@grptitle}%
  \@gls@grptitle
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@getgrouptitle}
% Gets the group title specified by the label (first argument) and
% stores in the second argument, which must be a control sequence.
%    \begin{macrocode}
\newcommand*{\@gls@getgrouptitle}[2]{%
%    \end{macrocode}
% Even if the argument appears to be a single letter, it won't be
% considered a single letter by \cs{dtl@ifsingle} if it's an active
% character.
%    \begin{macrocode}
 \dtl@ifsingle{#1}%
 {%
   \ifcsundef{#1groupname}{\def#2{#1}}{\letcs#2{#1groupname}}%
 }%
 {%
   \ifboolexpr{test{\ifstrequal{#1}{glssymbols}}
            or test{\ifstrequal{#1}{glsnumbers}}}%
   {%
     \ifcsundef{#1groupname}{\def#2{#1}}{\letcs#2{#1groupname}}%
   }%
   {%
     \def#2{#1}%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@noidx@getgrouptitle}
%\changes{4.04}{2014-03-06}{new}
% Version for the no-indexing app option:
%    \begin{macrocode}
\newcommand*{\@gls@noidx@getgrouptitle}[2]{%
  \DTLifint{#1}%
  {\edef#2{\char#1\relax}}%
  {%
    \ifcsundef{#1groupname}{\def#2{#1}}{\letcs#2{#1groupname}}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{definition}
%\cs{glsgetgrouplabel}\marg{title}
%\end{definition}
%This command does the reverse to the previous command. The
% argument is the group title, and it produces the group label.
% Note that if you redefine \cs{glsgetgrouptitle}, you
% will also need to redefine \cs{glsgetgrouplabel}.
%\begin{macro}{\glsgetgrouplabel}
%\changes{3.05}{2013-04-21}{fixed bug (typo in \cs{equal})}
%    \begin{macrocode}
\newcommand*{\glsgetgrouplabel}[1]{%
\ifthenelse{\equal{#1}{\glssymbolsgroupname}}{glssymbols}{%
\ifthenelse{\equal{#1}{\glsnumbersgroupname}}{glsnumbers}{#1}}}
%    \end{macrocode}
%\end{macro}
%
% The command \cs{setentrycounter} sets the entry's 
% associated counter (required by 
% \cs{glshypernumber} etc.) \ics{glslink} and
% \ics{glsadd} encode the
% \ics{glossary} argument so that the relevant counter is
% set prior to the formatting command.
%\begin{macro}{\setentrycounter}
%\changes{3.0}{2011-04-02}{added optional argument}
%    \begin{macrocode}
\newcommand*{\setentrycounter}[2][]{%
  \def\@glo@counterprefix{#1}%
  \ifx\@glo@counterprefix\@empty
    \def\@glo@counterprefix{.}%
  \else
    \def\@glo@counterprefix{.#1.}%
  \fi
  \def\glsentrycounter{#2}%
}
%    \end{macrocode}
%\end{macro}
%
% The current glossary style can be set using
% \cs{setglossarystyle}\marg{style}.
%\begin{macro}{\setglossarystyle}
%\changes{3.08a}{2013-09-28}{new}
%    \begin{macrocode}
\newcommand*{\setglossarystyle}[1]{%
  \ifcsundef{@glsstyle@#1}%
  {%
    \PackageError{glossaries}{Glossary style `#1' undefined}{}%
  }%
  {%
    \csname @glsstyle@#1\endcsname
  }%
%    \end{macrocode}
%\changes{4.21}{2016-01-24}{set default style if not already set}
% Set the default style if it's not already set.
%    \begin{macrocode}
  \ifx\@glossary@default@style\relax
    \protected@edef\@glossary@default@style{#1}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glossarystyle}
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%    \begin{macrocode}
\newcommand*{\glossarystyle}[1]{%
  \ifcsundef{@glsstyle@#1}%
  {%
    \PackageError{glossaries}{Glossary style `#1' undefined}{}%
  }%
  {%
    \GlossariesWarning
    {Deprecated command \string\glossarystyle.^^J
     I recommend you switch to \string\setglossarystyle\space unless 
     you want to maintain backward compatibility}%
    \setglossentrycompatibility
    \csname @glsstyle@#1\endcsname
%    \end{macrocode}
%\changes{3.13a}{2013-11-05}{fixed bug caused by using \cs{ifdef} instead of
%\cs{ifcsdef}}
%    \begin{macrocode}
    \ifcsdef{@glscompstyle@#1}%
    {\setglossentrycompatibility\csuse{@glscompstyle@#1}}%
    {}%
  }%
%    \end{macrocode}
%\changes{4.21}{2016-01-24}{set default style if not already set}
% Set the default style if it isn't already set so that
% \cs{printglossary} can warn if the fallback style is in use.
%    \begin{macrocode}
  \ifx\@glossary@default@style\relax
    \protected@edef\@glossary@default@style{#1}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\newglossarystyle}
% New glossary styles can be defined using:
%\begin{definition}
% \cs{newglossarystyle}\marg{name}\marg{definition}
%\end{definition}
% The \meta{definition} argument should redefine 
% \env{theglossary}, \ics{glossaryheader}, 
% \ics{glsgroupheading}, \ics{glossaryentryfield} and
% \ics{glsgroupskip} (see \autoref{sec:code:styles} for the
% definitions of predefined styles). Glossary styles should not 
% redefine \ics{glossarypreamble} and 
% \ics{glossarypostamble}, as
% the user should be able to switch between styles without affecting
% the pre- and postambles.
%\changes{1.17}{2008-12-26}{made \cs{newglossarystyle} long}
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%    \begin{macrocode}
\newcommand{\newglossarystyle}[2]{%
  \ifcsundef{@glsstyle@#1}%
  {%
    \expandafter\def\csname @glsstyle@#1\endcsname{#2}%
  }%
  {%
    \PackageError{glossaries}{Glossary style `#1' is already defined}{}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\renewglossarystyle}
%\changes{3.02}{2012-05-21}{new}
%Code for this macro supplied by Marco Daniel.
%    \begin{macrocode}
\newcommand{\renewglossarystyle}[2]{%
  \ifcsundef{@glsstyle@#1}%
  {%
    \PackageError{glossaries}{Glossary style `#1' isn't already defined}{}%
  }%
  {%
    \csdef{@glsstyle@#1}{#2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
% Glossary entries are encoded so that the second argument
% to \ics{glossaryentryfield} is always specified as
% \cs{glsnamefont}\marg{name}. This allows the
% user to change the font used to display the name term
% without having to redefine \ics{glossaryentryfield}.
% The default uses the surrounding font, so in the list type
% styles (which place the name in the optional argument to
% \ics{item}) the name will appear in bold.
%\begin{macro}{\glsnamefont}
%    \begin{macrocode}
\newcommand*{\glsnamefont}[1]{#1}
%    \end{macrocode}
%\end{macro}
%
% Each glossary entry has an associated number list (usually page
% numbers) that indicate where in the document the entry has been
% used. The format for these number lists can be changed using the
% \gloskey[glslink]{format}\igloskey[glsadd]{format} key in commands like \ics{glslink}.
% The default format is given by \cs{glshypernumber}. This takes
% a single argument which may be a single number, a number range
% or a number list. The number ranges are delimited with 
% \ics{delimR}, the number lists are delimited with 
% \ics{delimN}.
%
% If the document doesn't have hyperlinks, the numbers can be
% displayed just as they are, but if the document supports 
% hyperlinks, the numbers should link to the relevant location.
% This means extracting the individual numbers from the list or
% ranges. The \isty{hyperref} package does this with the
% \ics{hyperpage} command, but this is encoded for comma and
% dash delimiters and only for the page counter, but this code needs
% to be more general. So I have adapted the code used in the
% \isty{hyperref} package.
%\begin{macro}{\glshypernumber}
%\changes{1.17}{2008-12-26}{modified to allow material 
% to be attached to location}
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%    \begin{macrocode}
\ifcsundef{hyperlink}%
{%
  \def\glshypernumber#1{#1}%
}%
{%
  \def\glshypernumber#1{\@glshypernumber#1\nohyperpage{}\@nil}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glshypernumber}
% This code was provided by Heiko~Oberdiek to allow material
% to be attached to the location.
%\changes{1.17}{2008-12-26}{new}
%    \begin{macrocode}
\def\@glshypernumber#1\nohyperpage#2#3\@nil{%
  \ifx\\#1\\%
  \else
    \@delimR#1\delimR\delimR\\%
  \fi
  \ifx\\#2\\%
  \else
    #2%
  \fi
  \ifx\\#3\\%
  \else
    \@glshypernumber#3\@nil
  \fi
}
%    \end{macrocode}
%\end{macro}
% \cs{@delimR} displays a range of numbers for the counter 
% whose name is given by 
% \cs{@gls@counter} (which must be set prior to using
% \cs{glshypernumber}).
%\begin{macro}{\@delimR}
%    \begin{macrocode}
\def\@delimR#1\delimR #2\delimR #3\\{%
\ifx\\#2\\%
  \@delimN{#1}%
\else
  \@gls@numberlink{#1}\delimR\@gls@numberlink{#2}%
\fi}
%    \end{macrocode}
%\end{macro}
% \cs{@delimN} displays a list of individual numbers, 
% instead of a range:
%\begin{macro}{\@delimN}
%    \begin{macrocode}
\def\@delimN#1{\@@delimN#1\delimN \delimN\\}
\def\@@delimN#1\delimN #2\delimN#3\\{%
\ifx\\#3\\%
  \@gls@numberlink{#1}%
\else
  \@gls@numberlink{#1}\delimN\@gls@numberlink{#2}%
\fi
}
%    \end{macrocode}
%\end{macro}
% The following code is modified from hyperref's 
% \cs{HyInd@pagelink} where
% the name of the counter being used is given by 
% \cs{@gls@counter}.
%    \begin{macrocode}
\def\@gls@numberlink#1{%
\begingroup
 \toks@={}%
 \@gls@removespaces#1 \@nil
\endgroup}
%    \end{macrocode}
%    \begin{macrocode}
\def\@gls@removespaces#1 #2\@nil{%
 \toks@=\expandafter{\the\toks@#1}%
 \ifx\\#2\\%
%    \end{macrocode}
%\changes{4.47}{2021-09-20}{changed \cs{x} to \cs{@gls@x}}
%    \begin{macrocode}
   \edef\@gls@x{\the\toks@}%
   \ifx\@gls@x\empty
   \else
%    \end{macrocode}
%\changes{3.0}{2011-04-02}{added prefix to hyperlink}
%    \begin{macrocode}
     \hyperlink{\glsentrycounter\@glo@counterprefix\the\toks@}%
               {\the\toks@}%
   \fi
 \else
   \@gls@ReturnAfterFi{%
     \@gls@removespaces#2\@nil
   }%
 \fi
}
\long\def\@gls@ReturnAfterFi#1\fi{\fi#1}
%    \end{macrocode}
%
% The following commands will switch to the
% appropriate font, and create a hyperlink, if hyperlinks are
% supported. If hyperlinks are not supported, they will just
% display their argument in the appropriate font.
%\begin{macro}{\hyperrm}
%    \begin{macrocode}
\newcommand*{\hyperrm}[1]{\textrm{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\hypersf}
%    \begin{macrocode}
\newcommand*{\hypersf}[1]{\textsf{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\hypertt}
%    \begin{macrocode}
\newcommand*{\hypertt}[1]{\texttt{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\hyperbf}
%    \begin{macrocode}
\newcommand*{\hyperbf}[1]{\textbf{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\hypermd}
%    \begin{macrocode}
\newcommand*{\hypermd}[1]{\textmd{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\hyperit}
%    \begin{macrocode}
\newcommand*{\hyperit}[1]{\textit{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\hypersl}
%    \begin{macrocode}
\newcommand*{\hypersl}[1]{\textsl{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\hyperup}
%    \begin{macrocode}
\newcommand*{\hyperup}[1]{\textup{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\hypersc}
%    \begin{macrocode}
\newcommand*{\hypersc}[1]{\textsc{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\hyperemph}
%    \begin{macrocode}
\newcommand*{\hyperemph}[1]{\emph{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%
%\section{Acronyms}\label{sec:code:acronym}
%\begin{macro}{\oldacronym}
%\begin{definition}
%\cs{oldacronym}\oarg{label}\marg{abbrv}\marg{long}\marg{key-val list}
%\end{definition}
% This emulates the way the old \isty{glossary} package defined
% acronyms. It is equivalent to \ics{newacronym}\oarg{key-val
% list}\marg{label}\marg{abbrv}\marg{long} and it additionally
% defines the command \cs{}\meta{label} which is equivalent to
% \cs{gls}\marg{label} (thus \meta{label} must only contain
% alphabetical characters). If \meta{label} is omitted, \meta{abbrv}
% is used. This only emulates the syntax of the old \isty{glossary} 
% package. The way the acronyms appear in the list of acronyms is 
% determined by the definition of \ics{newacronym} and the
% glossary style.
%
% Note that \cs{}\meta{label} can't have an optional
% argument if the \isty{xspace} package is loaded. If 
% \isty{xspace} hasn't been loaded then you can do
% \cs{}\meta{label}\oarg{insert} but you can't do 
% \cs{}\meta{label}\oarg{key-val list}. For example if you define the
% acronym svm, then you can do "\svm['s]" but you can't do
% "\svm[format=textbf]". If the \isty{xspace} package is loaded,
% "\svm['s]" will appear as "svm ['s]" which is unlikely to be
% the desired result. In this case, you will need to use 
% \cs{gls} explicitly, e.g.\ "\gls{svm}['s]". Note that it is
% up to the user to load \isty{xspace} if desired.
%\changes{1.18}{2009-01-14}{new}
%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with
%\cs{ifcsundef}}
%    \begin{macrocode}
\newcommand{\oldacronym}[4][\gls@label]{%
  \def\gls@label{#2}%
  \newacronym[#4]{#1}{#2}{#3}%
  \ifcsundef{xspace}%
  {%
    \expandafter\edef\csname#1\endcsname{%
      \noexpand\@ifstar{\noexpand\Gls{#1}}{\noexpand\gls{#1}}%
    }%
  }%
  {%
    \expandafter\edef\csname#1\endcsname{%
      \noexpand\@ifstar{\noexpand\Gls{#1}\noexpand\xspace}{%
      \noexpand\gls{#1}\noexpand\xspace}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{definition}
% \cs{newacronym}\oarg{key-val list}\marg{label}\marg{abbrev}\marg{long}
%\end{definition}
% This is a quick way of defining acronyms,
% using \ics{newglossaryentry} with the appropriate
% values. It sets the
% glossary type to \ics{acronymtype} which will be
% "acronym" if the package option \pkgopt{acronym} has
% been used, otherwise it will be the default glossary.
% Since \cs{newacronym} merely calls \ics{newglossaryentry},
% the acronym is treated like any other glossary entry.
%
% If you prefer a different format, you
% can redefine \cs{newacronym} as required. The optional 
% argument can be used to override any of the settings.
%
% This is just a stub. It's redefined by commands like
% \cs{SetDefaultAcronymStyle}.
%\begin{macro}{\newacronym}
%    \begin{macrocode}
  \newcommand{\newacronym}[4][]{}
%    \end{macrocode}
%\changes{1.13}{2008-05-10}{Removed restriction on only using
% \cs{newacronym} in the preamble}
%\end{macro}
% Set up some convenient short cuts. These need to be changed if
% \cs{newacronym} is changed (or if the \gloskey{description} key
% is changed).
%
%\begin{macro}{\acrpluralsuffix}
%\changes{1.13}{2008-05-10}{New}
% Plural suffix used by \cs{newacronym}. This just defaults to
% \cs{glspluralsuffix} but is changed to include \cs{textup} 
% if the smallcaps option is used, so that the suffix doesn't appear
% in small caps as it doesn't look right. For example, 
% \textsc{abcs} looks as though the ``s'' is part of the acronym, but
% \textsc{abc}s looks as though the ``s'' is a plural suffix. Since
% the entire text \texttt{abcs} is set in \cs{textsc}, \cs{textup}
% is need to cancel it out.
%    \begin{macrocode}
\newcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}
%    \end{macrocode}
%\end{macro}
% If \sty{garamondx} has been loaded, need to use \cs{textulc}
% instead of \cs{textup}.
%\begin{macro}{\glstextup}
%\changes{3.09a}{2013-10-09}{new}
%    \begin{macrocode}
\newrobustcmd*{\glstextup}[1]{\ifdef\textulc{\textulc{#1}}{\textup{#1}}}
%    \end{macrocode}
%\end{macro}
%
% The following are defined for compatibility with version 2.07 and
% earlier.
%\begin{macro}{\glsshortkey}
%    \begin{macrocode}
\newcommand*{\glsshortkey}{short}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsshortpluralkey}
%    \begin{macrocode}
\newcommand*{\glsshortpluralkey}{shortplural}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glslongkey}
%    \begin{macrocode}
\newcommand*{\glslongkey}{long}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glslongpluralkey}
%    \begin{macrocode}
\newcommand*{\glslongpluralkey}{longplural}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\acrfull}
% Full form of the acronym.
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\acrfull}{\@gls@hyp@opt\ns@acrfull}
%    \end{macrocode}
%\changes{4.08}{2014-07-30}{removed \cs{@sacrfull}}
%\changes{3.0}{2011-04-02}{added starred version}
%    \begin{macrocode}
\newcommand*\ns@acrfull[2][]{%
  \new@ifnextchar[{\@acrfull{#1}{#2}}%
                  {\@acrfull{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@acrfull}
%\changes{4.02}{2013-12-05}{now using \cs{acrfullfmt}}
% Low-level macro:
%    \begin{macrocode}
\def\@acrfull#1#2[#3]{%
%    \end{macrocode}
% Make it easier for acronym styles to change this:
%    \begin{macrocode}
  \acrfullfmt{#1}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
% Using \cs{acrlinkfullformat} and \cs{acrfullformat} is now
% deprecated as it can cause complications with the first letter
% upper case variants, but the package needs to provide backward
% compatibility support.
%
%\begin{macro}{\acrfullfmt}
%\changes{4.02}{2013-12-05}{new}
% No case change full format.
%    \begin{macrocode}
\newcommand*{\acrfullfmt}[3]{%
  \acrlinkfullformat{\@acrlong}{\@acrshort}{#1}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\acrlinkfullformat}
% Format for full links like \ics{acrfull}. Syntax:
% \cs{acrlinkfullformat}\marg{long cs}\marg{short
% cs}\marg{options}\marg{label}\marg{insert}
%    \begin{macrocode}
\newcommand{\acrlinkfullformat}[5]{%
  \acrfullformat{#1{#3}{#4}[#5]}{#2{#3}{#4}[]}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\acrfullformat}
% Default full form is \meta{long} \parg{short}.
%\changes{3.01}{2011-04-12}{removed \cs{acronymfont} as it should
%already be set in the second argument.}
%    \begin{macrocode}
\newcommand{\acrfullformat}[2]{#1\glsspace(#2)}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsspace}
% Robust space to ensure it's written to the \texttt{.glsdefs} file.
%\changes{4.08}{2014-07-30}{new}
%    \begin{macrocode}
\newrobustcmd{\glsspace}{\space}
%    \end{macrocode}
%\end{macro}
%
% Default format for full acronym
%\begin{macro}{\Acrfull}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Acrfull}{\@gls@hyp@opt\ns@Acrfull}
%    \end{macrocode}
%\changes{3.0}{2011-04-02}{added starred version}
%\changes{4.08}{2014-07-30}{removed \cs{@sAcrfull}}
%    \begin{macrocode}
\newcommand*\ns@Acrfull[2][]{%
  \new@ifnextchar[{\@Acrfull{#1}{#2}}%
                  {\@Acrfull{#1}{#2}[]}%
}
%    \end{macrocode}
% Low-level macro:
%    \begin{macrocode}
\def\@Acrfull#1#2[#3]{%
%    \end{macrocode}
% Make it easier for acronym styles to change this:
%    \begin{macrocode}
  \Acrfullfmt{#1}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Acrfullfmt}
%\changes{4.02}{2013-12-05}{new}
% First letter upper case full format.
%    \begin{macrocode}
\newcommand*{\Acrfullfmt}[3]{%
  \acrlinkfullformat{\@Acrlong}{\@acrshort}{#1}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ACRfull}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\ACRfull}{\@gls@hyp@opt\ns@ACRfull}
%    \end{macrocode}
%\changes{3.0}{2011-04-02}{added starred version}
%\changes{4.08}{2014-07-30}{removed \cs{s@ACRfull}}
%    \begin{macrocode}
\newcommand*\ns@ACRfull[2][]{%
  \new@ifnextchar[{\@ACRfull{#1}{#2}}%
                  {\@ACRfull{#1}{#2}[]}%
}
%    \end{macrocode}
% Low-level macro:
%    \begin{macrocode}
\def\@ACRfull#1#2[#3]{%
%    \end{macrocode}
% Make it easier for acronym styles to change this:
%    \begin{macrocode}
  \ACRfullfmt{#1}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ACRfullfmt}
%\changes{4.02}{2013-12-05}{new}
% All upper case full format.
%    \begin{macrocode}
\newcommand*{\ACRfullfmt}[3]{%
  \acrlinkfullformat{\@ACRlong}{\@ACRshort}{#1}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%
% Plural:
%\begin{macro}{\acrfullpl}
%\changes{1.13}{2008-05-10}{new}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\acrfullpl}{\@gls@hyp@opt\ns@acrfullpl}
%    \end{macrocode}
%\changes{3.0}{2011-04-02}{added starred version}
%\changes{4.08}{2014-07-30}{removed \cs{s@acrfullpl}}
%    \begin{macrocode}
\newcommand*\ns@acrfullpl[2][]{%
  \new@ifnextchar[{\@acrfullpl{#1}{#2}}%
                  {\@acrfullpl{#1}{#2}[]}%
}
%    \end{macrocode}
% Low-level macro:
%    \begin{macrocode}
\def\@acrfullpl#1#2[#3]{%
%    \end{macrocode}
% Make it easier for acronym styles to change this:
%    \begin{macrocode}
  \acrfullplfmt{#1}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\acrfullplfmt}
%\changes{4.02}{2013-12-05}{new}
% No case change plural full format.
%    \begin{macrocode}
\newcommand*{\acrfullplfmt}[3]{%
  \acrlinkfullformat{\@acrlongpl}{\@acrshortpl}{#1}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Acrfullpl}
%\changes{1.13}{2008-05-10}{new}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\Acrfullpl}{\@gls@hyp@opt\ns@Acrfullpl}
%    \end{macrocode}
%\changes{4.08}{2014-07-30}{removed \cs{s@Acrfullpl}}
%\changes{3.0}{2011-04-02}{added starred version}
%    \begin{macrocode}
\newcommand*\ns@Acrfullpl[2][]{%
  \new@ifnextchar[{\@Acrfullpl{#1}{#2}}%
                  {\@Acrfullpl{#1}{#2}[]}%
}
%    \end{macrocode}
% Low-level macro:
%    \begin{macrocode}
\def\@Acrfullpl#1#2[#3]{%
%    \end{macrocode}
% Make it easier for acronym styles to change this:
%    \begin{macrocode}
  \Acrfullplfmt{#1}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Acrfullplfmt}
%\changes{4.02}{2013-12-05}{new}
% First letter upper case plural full format.
%\changes{4.07}{2014-04-04}{fixed no case change bug}
%    \begin{macrocode}
\newcommand*{\Acrfullplfmt}[3]{%
  \acrlinkfullformat{\@Acrlongpl}{\@acrshortpl}{#1}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{\ACRfullpl}
%\changes{1.13}{2008-05-10}{new}
%\changes{3.01}{2011-04-12}{made robust}
%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd*{\ACRfullpl}{\@gls@hyp@opt\ns@ACRfullpl}
%    \end{macrocode}
%\changes{3.0}{2011-04-02}{added starred version}
%\changes{4.08}{2014-07-30}{removed \cs{s@ACRfullpl}}
%    \begin{macrocode}
\newcommand*\ns@ACRfullpl[2][]{%
  \new@ifnextchar[{\@ACRfullpl{#1}{#2}}%
                  {\@ACRfullpl{#1}{#2}[]}%
}
%    \end{macrocode}
% Low-level macro:
%    \begin{macrocode}
\def\@ACRfullpl#1#2[#3]{%
%    \end{macrocode}
% Make it easier for acronym styles to change this:
%    \begin{macrocode}
  \ACRfullplfmt{#1}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ACRfullplfmt}
%\changes{4.02}{2013-12-05}{new}
% All upper case plural full format.
%    \begin{macrocode}
\newcommand*{\ACRfullplfmt}[3]{%
  \acrlinkfullformat{\@ACRlongpl}{\@ACRshortpl}{#1}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\section{Predefined acronym styles}
%\begin{macro}{\acronymfont}
%This is only used with the additional acronym styles:
%    \begin{macrocode}
\newcommand{\acronymfont}[1]{#1}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\firstacronymfont}
%This is only used with the additional acronym styles:
%\changes{1.14}{2008-06-17}{new}
%    \begin{macrocode}
\newcommand{\firstacronymfont}[1]{\acronymfont{#1}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\acrnameformat}
% The styles that allow an additional description use 
% \cs{acrnameformat}\marg{short}\marg{long} to determine what
% information is displayed in the name.
%    \begin{macrocode}
\newcommand*{\acrnameformat}[2]{\acronymfont{#1}}
%    \end{macrocode}
%\end{macro}
%
% Define some tokens used by \cs{newacronym}:
%\begin{macro}{\glskeylisttok}
%    \begin{macrocode}
\newtoks\glskeylisttok
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glslabeltok}
%    \begin{macrocode}
\newtoks\glslabeltok
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsshorttok}
%    \begin{macrocode}
\newtoks\glsshorttok
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glslongtok}
%    \begin{macrocode}
\newtoks\glslongtok
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\newacronymhook}
% Provide a hook for \cs{newacronym}:
%    \begin{macrocode}
\newcommand*{\newacronymhook}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\SetGenericNewAcronym}
% New improved version of setting the acronym style.
%\changes{4.02}{2013-12-05}{new}
%    \begin{macrocode}
\newcommand*{\SetGenericNewAcronym}{%
%    \end{macrocode}
% Change the behaviour of \cs{Glsentryname} to workaround expansion
% issues that cause a problem for \cs{makefirstuc}
%    \begin{macrocode}
  \let\@Gls@entryname\@Gls@acrentryname
%    \end{macrocode}
% Change the way acronyms are defined:
%    \begin{macrocode}
  \renewcommand{\newacronym}[4][]{%
    \ifdefempty{\@glsacronymlists}%
    {%
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
    }%
    {}%
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \protected@edef\@do@newglossaryentry{%
      \noexpand\newglossaryentry{\the\glslabeltok}%
      {%
        type=\acronymtype,%
        name={\expandonce{\acronymentry{##2}}},%
        sort={\acronymsort{\the\glsshorttok}{\the\glslongtok}},%
        text={\the\glsshorttok},%
        short={\the\glsshorttok},%
        shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
        long={\the\glslongtok},%
        longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
        \GenericAcronymFields,%
        \the\glskeylisttok
      }%
    }%
    \@do@newglossaryentry
  }%
%    \end{macrocode}
% Make sure that \ics{acrfull} etc reflects the new style:
%    \begin{macrocode}
  \renewcommand*{\acrfullfmt}[3]{%
    \glslink[##1]{##2}{\genacrfullformat{##2}{##3}}}%
  \renewcommand*{\Acrfullfmt}[3]{%
    \glslink[##1]{##2}{\Genacrfullformat{##2}{##3}}}%
  \renewcommand*{\ACRfullfmt}[3]{%
    \glslink[##1]{##2}{%
      \mfirstucMakeUppercase{\genacrfullformat{##2}{##3}}}}%
  \renewcommand*{\acrfullplfmt}[3]{%
    \glslink[##1]{##2}{\genplacrfullformat{##2}{##3}}}%
  \renewcommand*{\Acrfullplfmt}[3]{%
    \glslink[##1]{##2}{\Genplacrfullformat{##2}{##3}}}%
  \renewcommand*{\ACRfullplfmt}[3]{%
    \glslink[##1]{##2}{%
      \mfirstucMakeUppercase{\genplacrfullformat{##2}{##3}}}}%
%    \end{macrocode}
% Make sure that \ics{glsentryfull} etc reflects the new style:
%    \begin{macrocode}
  \renewcommand*{\glsentryfull}[1]{\genacrfullformat{##1}{}}%
  \renewcommand*{\Glsentryfull}[1]{\Genacrfullformat{##1}{}}%
  \renewcommand*{\glsentryfullpl}[1]{\genplacrfullformat{##1}{}}%
  \renewcommand*{\Glsentryfullpl}[1]{\Genplacrfullformat{##1}{}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GenericAcronymFields}
%\changes{4.02}{2013-12-05}{new}
% Fields used by \cs{SetGenericNewAcronym} that can be changed by
% the acronym style.
%    \begin{macrocode}
\newcommand*{\GenericAcronymFields}{description={\the\glslongtok}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\acronymentry}
%\changes{4.02}{2013-12-05}{new}
%\begin{definition}
%\cs{acronymentry}\marg{label}
%\end{definition}
% Display style for the name field in the list of acronyms.
%    \begin{macrocode}
\newcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{#1}}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\acronymsort}
%\begin{definition}
%\cs{acronymsort}\marg{short}\marg{long}
%\end{definition}
% Default sort format for acronyms.
%    \begin{macrocode}
\newcommand*{\acronymsort}[2]{#1}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\setacronymstyle}
%\changes{4.02}{2013-12-05}{new}
%\begin{definition}
%\cs{setacronymstyle}\marg{style name}
%\end{definition}
%    \begin{macrocode}
\newcommand*{\setacronymstyle}[1]{%
  \ifcsundef{@glsacr@dispstyle@#1}
  {%
    \PackageError{glossaries}{Undefined acronym style `#1'}{}%
  }%
  {%
    \ifdefempty{\@glsacronymlists}%
    {%
      \DeclareAcronymList{\acronymtype}%
    }%
    {}%
    \SetGenericNewAcronym
    \GlsUseAcrStyleDefs{#1}%
    \@for\@gls@type:=\@glsacronymlists\do{%
      \defglsentryfmt[\@gls@type]{\GlsUseAcrEntryDispStyle{#1}}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\newacronymstyle}
%\changes{4.02}{2013-12-05}{new}
%\begin{definition}
%\cs{newacronymstyle}\marg{style name}\marg{entry format
%definition}\marg{display definitions}
%\end{definition}
% Defines a new acronym style called \meta{style name}.
%    \begin{macrocode}
\newcommand*{\newacronymstyle}[3]{%
  \ifcsdef{@glsacr@dispstyle@#1}%
  {%
    \PackageError{glossaries}{Acronym style `#1' already exists}{}%
  }%
  {%
    \csdef{@glsacr@dispstyle@#1}{#2}%
    \csdef{@glsacr@styledefs@#1}{#3}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\renewacronymstyle}
% Redefines the given acronym style.
%\changes{4.03}{2014-01-20}{new}
%    \begin{macrocode}
\newcommand*{\renewacronymstyle}[3]{%
  \ifcsdef{@glsacr@dispstyle@#1}%
  {%
    \csdef{@glsacr@dispstyle@#1}{#2}%
    \csdef{@glsacr@styledefs@#1}{#3}%
  }%
  {%
    \PackageError{glossaries}{Acronym style `#1' doesn't exist}{}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsUseAcrEntryDispStyle}
%\changes{4.02}{2013-12-05}{new}
%    \begin{macrocode}
\newcommand*{\GlsUseAcrEntryDispStyle}[1]{\csuse{@glsacr@dispstyle@#1}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\GlsUseAcrStyleDefs}
%\changes{4.02}{2013-12-05}{new}
%    \begin{macrocode}
\newcommand*{\GlsUseAcrStyleDefs}[1]{\csuse{@glsacr@styledefs@#1}}
%    \end{macrocode}
%\end{macro}
%
%Predefined acronym styles:
%\begin{acrstyle}{long-short}
%\changes{4.02}{2013-12-05}{new}
% \meta{long} (\meta{short}) acronym style.
%    \begin{macrocode}
\newacronymstyle{long-short}%
{%
%    \end{macrocode}
% Check for long form in case this is a mixed glossary.
%    \begin{macrocode}
  \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}%
}%
{%
  \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}%
  \renewcommand*{\genacrfullformat}[2]{%
   \glsentrylong{##1}##2\space
   (\protect\firstacronymfont{\glsentryshort{##1}})%
  }%
  \renewcommand*{\Genacrfullformat}[2]{%
   \Glsentrylong{##1}##2\space
   (\protect\firstacronymfont{\glsentryshort{##1}})%
  }%
  \renewcommand*{\genplacrfullformat}[2]{%
   \glsentrylongpl{##1}##2\space
   (\protect\firstacronymfont{\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\Genplacrfullformat}[2]{%
   \Glsentrylongpl{##1}##2\space
   (\protect\firstacronymfont{\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}%
  \renewcommand*{\acronymsort}[2]{##1}%
  \renewcommand*{\acronymfont}[1]{##1}%
  \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{long-sp-short}
%\changes{4.16}{2015-07-08}{new}
% Similar to the previous style but allows the space between the
% long and short form to be customized.
%    \begin{macrocode}
\newacronymstyle{long-sp-short}%
{%
%    \end{macrocode}
% Check for long form in case this is a mixed glossary.
%    \begin{macrocode}
  \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}%
}%
{%
  \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}%
  \renewcommand*{\genacrfullformat}[2]{%
   \glsentrylong{##1}##2\glsacspace{##1}%
   (\protect\firstacronymfont{\glsentryshort{##1}})%
  }%
  \renewcommand*{\Genacrfullformat}[2]{%
   \Glsentrylong{##1}##2\glsacspace{##1}%
   (\protect\firstacronymfont{\glsentryshort{##1}})%
  }%
  \renewcommand*{\genplacrfullformat}[2]{%
   \glsentrylongpl{##1}##2\glsacspace{##1}%
   (\protect\firstacronymfont{\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\Genplacrfullformat}[2]{%
   \Glsentrylongpl{##1}##2\glsacspace{##1}%
   (\protect\firstacronymfont{\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}%
  \renewcommand*{\acronymsort}[2]{##1}%
  \renewcommand*{\acronymfont}[1]{##1}%
  \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{macro}{\glsacspace}
%\changes{4.16}{2015-07-08}{new}
% Space between long and short form for the above style.
% This uses a non-breakable space if the short form is less than
% 3em, otherwise it uses a regular space.
%    \begin{macrocode}
\newcommand*{\glsacspace}[1]{%
  \settowidth{\dimen@}{(\firstacronymfont{\glsentryshort{#1}})}%
  \ifdim\dimen@<3em~\else\space\fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{acrstyle}{short-long}
%\changes{4.02}{2013-12-05}{new}
% \meta{short} (\meta{long}) acronym style.
%    \begin{macrocode}
\newacronymstyle{short-long}%
{%
%    \end{macrocode}
% Check for long form in case this is a mixed glossary.
%    \begin{macrocode}
  \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}%
}%
{%
  \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}%
  \renewcommand*{\genacrfullformat}[2]{%
   \protect\firstacronymfont{\glsentryshort{##1}}##2\space
   (\glsentrylong{##1})%
  }%
  \renewcommand*{\Genacrfullformat}[2]{%
   \protect\firstacronymfont{\Glsentryshort{##1}}##2\space
   (\glsentrylong{##1})%
  }%
  \renewcommand*{\genplacrfullformat}[2]{%
   \protect\firstacronymfont{\glsentryshortpl{##1}}##2\space
   (\glsentrylongpl{##1})%
  }%
  \renewcommand*{\Genplacrfullformat}[2]{%
   \protect\firstacronymfont{\Glsentryshortpl{##1}}##2\space
   (\glsentrylongpl{##1})%
  }%
%    \end{macrocode}
%\changes{4.03}{2014-01-20}{commented spurious EOL}
%    \begin{macrocode}
  \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}%
  \renewcommand*{\acronymsort}[2]{##1}%
  \renewcommand*{\acronymfont}[1]{##1}%
  \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{long-sc-short}
%\changes{4.02}{2013-12-05}{new}
% \meta{long} (\cs{textsc}\marg{short}) acronym style.
%    \begin{macrocode}
\newacronymstyle{long-sc-short}%
{%
  \GlsUseAcrEntryDispStyle{long-short}%
}%
{%
  \GlsUseAcrStyleDefs{long-short}%
  \renewcommand{\acronymfont}[1]{\textsc{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{long-sm-short}
%\changes{4.02}{2013-12-05}{new}
% \meta{long} (\cs{textsmaller}\marg{short}) acronym style.
%    \begin{macrocode}
\newacronymstyle{long-sm-short}%
{%
  \GlsUseAcrEntryDispStyle{long-short}%
}%
{%
  \GlsUseAcrStyleDefs{long-short}%
  \renewcommand{\acronymfont}[1]{\textsmaller{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{sc-short-long}
%\changes{4.02}{2013-12-05}{new}
% \meta{short} (\cs{textsc}\marg{long}) acronym style.
%    \begin{macrocode}
\newacronymstyle{sc-short-long}%
{%
  \GlsUseAcrEntryDispStyle{short-long}%
}%
{%
  \GlsUseAcrStyleDefs{short-long}%
  \renewcommand{\acronymfont}[1]{\textsc{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{sm-short-long}
%\changes{4.02}{2013-12-05}{new}
% \meta{short} (\cs{textsmaller}\marg{long}) acronym style.
%    \begin{macrocode}
\newacronymstyle{sm-short-long}%
{%
  \GlsUseAcrEntryDispStyle{short-long}%
}%
{%
  \GlsUseAcrStyleDefs{short-long}%
  \renewcommand{\acronymfont}[1]{\textsmaller{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{long-short-desc}
%\changes{4.02}{2013-12-05}{new}
% \meta{long} (\marg{short}) acronym style that has an
% accompanying description (which the user needs to supply).
%    \begin{macrocode}
\newacronymstyle{long-short-desc}%
{%
  \GlsUseAcrEntryDispStyle{long-short}%
}%
{%
  \GlsUseAcrStyleDefs{long-short}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{long-sp-short-desc}
%\changes{4.02}{2013-12-05}{new}
% \meta{long} (\marg{short}) acronym style that has an
% accompanying description (which the user needs to supply).
% The space between the long and short form is given by
% \cs{glsacspace}.
%    \begin{macrocode}
\newacronymstyle{long-sp-short-desc}%
{%
  \GlsUseAcrEntryDispStyle{long-sp-short}%
}%
{%
  \GlsUseAcrStyleDefs{long-sp-short}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glsentrylong{##1}\glsacspace{##1}(\acronymfont{\glsentryshort{##1}})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{long-sc-short-desc}
%\changes{4.02}{2013-12-05}{new}
% \meta{long} (\cs{textsc}\marg{short}) acronym style that has an
% accompanying description (which the user needs to supply).
%    \begin{macrocode}
\newacronymstyle{long-sc-short-desc}%
{%
  \GlsUseAcrEntryDispStyle{long-sc-short}%
}%
{%
  \GlsUseAcrStyleDefs{long-sc-short}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{long-sm-short-desc}
%\changes{4.02}{2013-12-05}{new}
% \meta{long} (\cs{textsmaller}\marg{short}) acronym style that has an
% accompanying description (which the user needs to supply).
%    \begin{macrocode}
\newacronymstyle{long-sm-short-desc}%
{%
  \GlsUseAcrEntryDispStyle{long-sm-short}%
}%
{%
  \GlsUseAcrStyleDefs{long-sm-short}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{short-long-desc}
%\changes{4.02}{2013-12-05}{new}
% \meta{short} (\marg{long}) acronym style that has an
% accompanying description (which the user needs to supply).
%    \begin{macrocode}
\newacronymstyle{short-long-desc}%
{%
  \GlsUseAcrEntryDispStyle{short-long}%
}%
{%
  \GlsUseAcrStyleDefs{short-long}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{sc-short-long-desc}
%\changes{4.02}{2013-12-05}{new}
% \meta{long} (\cs{textsc}\marg{short}) acronym style that has an
% accompanying description (which the user needs to supply).
%    \begin{macrocode}
\newacronymstyle{sc-short-long-desc}%
{%
  \GlsUseAcrEntryDispStyle{sc-short-long}%
}%
{%
  \GlsUseAcrStyleDefs{sc-short-long}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{sm-short-long-desc}
%\changes{4.02}{2013-12-05}{new}
% \meta{long} (\cs{textsmaller}\marg{short}) acronym style that has an
% accompanying description (which the user needs to supply).
%    \begin{macrocode}
\newacronymstyle{sm-short-long-desc}%
{%
  \GlsUseAcrEntryDispStyle{sm-short-long}%
}%
{%
  \GlsUseAcrStyleDefs{sm-short-long}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{dua}
%\changes{4.02}{2013-12-05}{new}
% \meta{long} only acronym style.
%    \begin{macrocode}
\newacronymstyle{dua}%
{%
%    \end{macrocode}
% Check for long form in case this is a mixed glossary.
%    \begin{macrocode}
  \ifdefempty\glscustomtext
  {%
    \ifglshaslong{\glslabel}%
    {%
      \glsifplural
      {%
%    \end{macrocode}
% Plural form:
%    \begin{macrocode}
        \glscapscase
        {%
%    \end{macrocode}
% Plural form, don't adjust case:
%    \begin{macrocode}
          \glsentrylongpl{\glslabel}\glsinsert
        }%
        {%
%    \end{macrocode}
% Plural form, make first letter upper case:
%    \begin{macrocode}
          \Glsentrylongpl{\glslabel}\glsinsert
        }%
        {%
%    \end{macrocode}
% Plural form, all caps:
%    \begin{macrocode}
          \mfirstucMakeUppercase
            {\glsentrylongpl{\glslabel}\glsinsert}%
        }%
      }%
      {%
%    \end{macrocode}
% Singular form
%    \begin{macrocode}
        \glscapscase
        {%
%    \end{macrocode}
% Singular form, don't adjust case:
%    \begin{macrocode}
          \glsentrylong{\glslabel}\glsinsert
        }%
        {%
%    \end{macrocode}
% Subsequent singular form, make first letter upper case:
%    \begin{macrocode}
          \Glsentrylong{\glslabel}\glsinsert
        }%
        {%
%    \end{macrocode}
% Subsequent singular form, all caps:
%    \begin{macrocode}
          \mfirstucMakeUppercase
            {\glsentrylong{\glslabel}\glsinsert}%
        }%
      }%
    }%
    {%
%    \end{macrocode}
% Not an acronym:
%    \begin{macrocode}
      \glsgenentryfmt
    }%
  }%
  {\glscustomtext\glsinsert}%
}%
{%
  \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}%
%    \end{macrocode}
%\changes{4.03}{2014-01-20}{fixed bug in \cs{acrfullfmt}}
%    \begin{macrocode}
  \renewcommand*{\acrfullfmt}[3]{%
    \glslink[##1]{##2}{\glsentrylong{##2}##3\space
      (\acronymfont{\glsentryshort{##2}})}}%
  \renewcommand*{\Acrfullfmt}[3]{%
    \glslink[##1]{##2}{\Glsentrylong{##2}##3\space
      (\acronymfont{\glsentryshort{##2}})}}%
  \renewcommand*{\ACRfullfmt}[3]{%
    \glslink[##1]{##2}{%
      \mfirstucMakeUppercase{\glsentrylong{##2}##3\space
      (\acronymfont{\glsentryshort{##2}})}}}%
%    \end{macrocode}
%\changes{4.03}{2014-01-20}{fixed bug in \cs{acrfullplfmt}}
%    \begin{macrocode}
  \renewcommand*{\acrfullplfmt}[3]{%
    \glslink[##1]{##2}{\glsentrylongpl{##2}##3\space
      (\acronymfont{\glsentryshortpl{##2}})}}%
%    \end{macrocode}
%\changes{4.03}{2014-01-20}{fixed bug in \cs{Acrfullplfmt}}
%    \begin{macrocode}
  \renewcommand*{\Acrfullplfmt}[3]{%
    \glslink[##1]{##2}{\Glsentrylongpl{##2}##3\space
      (\acronymfont{\glsentryshortpl{##2}})}}%
  \renewcommand*{\ACRfullplfmt}[3]{%
    \glslink[##1]{##2}{%
      \mfirstucMakeUppercase{\glsentrylongpl{##2}##3\space
      (\acronymfont{\glsentryshortpl{##2}})}}}%
  \renewcommand*{\glsentryfull}[1]{%
    \glsentrylong{##1}\space(\acronymfont{\glsentryshort{##1}})%
  }%
  \renewcommand*{\Glsentryfull}[1]{%
    \Glsentrylong{##1}\space(\acronymfont{\glsentryshort{##1}})%
  }%
  \renewcommand*{\glsentryfullpl}[1]{%
    \glsentrylongpl{##1}\space(\acronymfont{\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\Glsentryfullpl}[1]{%
    \Glsentrylongpl{##1}\space(\acronymfont{\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}%
  \renewcommand*{\acronymsort}[2]{##1}%
  \renewcommand*{\acronymfont}[1]{##1}%
  \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{dua-desc}
%\changes{4.02}{2013-12-05}{new}
% \meta{long} only acronym style with user-supplied description.
%    \begin{macrocode}
\newacronymstyle{dua-desc}%
{%
  \GlsUseAcrEntryDispStyle{dua}%
}%
{%
  \GlsUseAcrStyleDefs{dua}%
  \renewcommand*{\GenericAcronymFields}{}%
%    \end{macrocode}
%\changes{4.03}{2014-01-20}{commented spurious EOL}
%    \begin{macrocode}
  \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentrylong{##1}}}%
  \renewcommand*{\acronymsort}[2]{##2}%
}%
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{footnote}
%\changes{4.02}{2013-12-05}{new}
% \meta{short}\cs{footnote}\marg{long} acronym style.
%    \begin{macrocode}
\newacronymstyle{footnote}%
{%
%    \end{macrocode}
% Check for long form in case this is a mixed glossary.
%    \begin{macrocode}
  \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}%
}%
{%
  \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}%
%    \end{macrocode}
% Need to ensure hyperlinks are switched off on first use:
%    \begin{macrocode}
  \glshyperfirstfalse
  \renewcommand*{\genacrfullformat}[2]{%
   \protect\firstacronymfont{\glsentryshort{##1}}##2%
   \protect\footnote{\glsentrylong{##1}}%
  }%
  \renewcommand*{\Genacrfullformat}[2]{%
   \firstacronymfont{\Glsentryshort{##1}}##2%
   \protect\footnote{\glsentrylong{##1}}%
  }%
  \renewcommand*{\genplacrfullformat}[2]{%
   \protect\firstacronymfont{\glsentryshortpl{##1}}##2%
   \protect\footnote{\glsentrylongpl{##1}}%
  }%
  \renewcommand*{\Genplacrfullformat}[2]{%
   \protect\firstacronymfont{\Glsentryshortpl{##1}}##2%
   \protect\footnote{\glsentrylongpl{##1}}%
  }%
  \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}%
  \renewcommand*{\acronymsort}[2]{##1}%
  \renewcommand*{\acronymfont}[1]{##1}%
  \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}%
%    \end{macrocode}
% Don't use footnotes for \ics{acrfull}:
%    \begin{macrocode}
  \renewcommand*{\acrfullfmt}[3]{%
    \glslink[##1]{##2}{\acronymfont{\glsentryshort{##2}}##3\space
      (\glsentrylong{##2})}}%
  \renewcommand*{\Acrfullfmt}[3]{%
    \glslink[##1]{##2}{\acronymfont{\Glsentryshort{##2}}##3\space
      (\glsentrylong{##2})}}%
  \renewcommand*{\ACRfullfmt}[3]{%
    \glslink[##1]{##2}{%
      \mfirstucMakeUppercase{\acronymfont{\glsentryshort{##2}}##3\space
      (\glsentrylong{##2})}}}%
  \renewcommand*{\acrfullplfmt}[3]{%
    \glslink[##1]{##2}{\acronymfont{\glsentryshortpl{##2}}##3\space
      (\glsentrylongpl{##2})}}%
  \renewcommand*{\Acrfullplfmt}[3]{%
    \glslink[##1]{##2}{\acronymfont{\Glsentryshortpl{##2}}##3\space
      (\glsentrylongpl{##2})}}%
  \renewcommand*{\ACRfullplfmt}[3]{%
    \glslink[##1]{##2}{%
      \mfirstucMakeUppercase{\acronymfont{\glsentryshortpl{##2}}##3\space
      (\glsentrylongpl{##2})}}}%
%    \end{macrocode}
% Similarly for \ics{glsentryfull} etc:
%    \begin{macrocode}
  \renewcommand*{\glsentryfull}[1]{%
     \acronymfont{\glsentryshort{##1}}\space(\glsentrylong{##1})}%
  \renewcommand*{\Glsentryfull}[1]{%
     \acronymfont{\Glsentryshort{##1}}\space(\glsentrylong{##1})}%
  \renewcommand*{\glsentryfullpl}[1]{%
     \acronymfont{\glsentryshortpl{##1}}\space(\glsentrylongpl{##1})}%
  \renewcommand*{\Glsentryfullpl}[1]{%
     \acronymfont{\Glsentryshortpl{##1}}\space(\glsentrylongpl{##1})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{footnote-sc}
%\changes{4.02}{2013-12-05}{new}
% \cs{textsc}\marg{short}\cs{footnote}\marg{long} acronym style.
%    \begin{macrocode}
\newacronymstyle{footnote-sc}%
{%
  \GlsUseAcrEntryDispStyle{footnote}%
}%
{%
  \GlsUseAcrStyleDefs{footnote}%
  \renewcommand{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}
  \renewcommand{\acronymfont}[1]{\textsc{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}%
}%
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{footnote-sm}
%\changes{4.02}{2013-12-05}{new}
% \cs{textsmaller}\marg{short}\cs{footnote}\marg{long} acronym style.
%    \begin{macrocode}
\newacronymstyle{footnote-sm}%
{%
  \GlsUseAcrEntryDispStyle{footnote}%
}%
{%
  \GlsUseAcrStyleDefs{footnote}%
  \renewcommand{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}
  \renewcommand{\acronymfont}[1]{\textsmaller{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}%
}%
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{footnote-desc}
%\changes{4.02}{2013-12-05}{new}
% \meta{short}\cs{footnote}\marg{long} acronym style that has an
% accompanying description (which the user needs to supply).
%    \begin{macrocode}
\newacronymstyle{footnote-desc}%
{%
  \GlsUseAcrEntryDispStyle{footnote}%
}%
{%
  \GlsUseAcrStyleDefs{footnote}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{footnote-sc-desc}
%\changes{4.02}{2013-12-05}{new}
% \cs{textsc}\marg{short}\cs{footnote}\marg{long} acronym style that has an
% accompanying description (which the user needs to supply).
%    \begin{macrocode}
\newacronymstyle{footnote-sc-desc}%
{%
  \GlsUseAcrEntryDispStyle{footnote-sc}%
}%
{%
  \GlsUseAcrStyleDefs{footnote-sc}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{footnote-sm-desc}
%\changes{4.02}{2013-12-05}{new}
% \cs{textsmaller}\marg{short}\cs{footnote}\marg{long} acronym style that has an
% accompanying description (which the user needs to supply).
%    \begin{macrocode}
\newacronymstyle{footnote-sm-desc}%
{%
  \GlsUseAcrEntryDispStyle{footnote-sm}%
}%
{%
  \GlsUseAcrStyleDefs{footnote-sm}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%
%
%\begin{macro}{\DefineAcronymSynonyms}
%\changes{2.04}{2009-11-10}{new}
%    \begin{macrocode}
\newcommand*{\DefineAcronymSynonyms}{%
%    \end{macrocode}
%\end{macro}
% Short form
%\begin{macro}{\acs}
%    \begin{macrocode}
  \let\acs\acrshort
%    \end{macrocode}
%\end{macro}
% First letter uppercase short form
%\begin{macro}{\Acs}
%    \begin{macrocode}
  \let\Acs\Acrshort
%    \end{macrocode}
%\end{macro}
% Plural short form
%\begin{macro}{\acsp}
%    \begin{macrocode}
  \let\acsp\acrshortpl
%    \end{macrocode}
%\end{macro}
% First letter uppercase plural short form
%\begin{macro}{\Acsp}
%    \begin{macrocode}
  \let\Acsp\Acrshortpl
%    \end{macrocode}
%\end{macro}
% Long form
%\begin{macro}{\acl}
%    \begin{macrocode}
  \let\acl\acrlong
%    \end{macrocode}
%\end{macro}
% Plural long form
%\begin{macro}{\aclp}
%    \begin{macrocode}
  \let\aclp\acrlongpl
%    \end{macrocode}
%\end{macro}
% First letter upper case long form
%\begin{macro}{\Acl}
%    \begin{macrocode}
  \let\Acl\Acrlong
%    \end{macrocode}
%\end{macro}
% First letter upper case plural long form
%\begin{macro}{\Aclp}
%    \begin{macrocode}
  \let\Aclp\Acrlongpl
%    \end{macrocode}
%\end{macro}
% Full form
%\begin{macro}{\acf}
%    \begin{macrocode}
  \let\acf\acrfull
%    \end{macrocode}
%\end{macro}
% Plural full form
%\begin{macro}{\acfp}
%    \begin{macrocode}
  \let\acfp\acrfullpl
%    \end{macrocode}
%\end{macro}
% First letter upper case full form
%\begin{macro}{\Acf}
%    \begin{macrocode}
  \let\Acf\Acrfull
%    \end{macrocode}
%\end{macro}
% First letter upper case plural full form
%\begin{macro}{\Acfp}
%    \begin{macrocode}
  \let\Acfp\Acrfullpl
%    \end{macrocode}
%\end{macro}
% Standard form
%\begin{macro}{\ac}
%    \begin{macrocode}
  \let\ac\gls
%    \end{macrocode}
%\end{macro}
% First upper case standard form
%\begin{macro}{\Ac}
%    \begin{macrocode}
  \let\Ac\Gls
%    \end{macrocode}
%\end{macro}
% Standard plural form
%\begin{macro}{\acp}
%    \begin{macrocode}
  \let\acp\glspl
%    \end{macrocode}
%\end{macro}
% Standard first letter upper case plural form
%\begin{macro}{\Acp}
%    \begin{macrocode}
  \let\Acp\Glspl
%    \end{macrocode}
%\end{macro}
%    \begin{macrocode}
}
%    \end{macrocode}
% Define synonyms if required
%    \begin{macrocode}
\ifglsacrshortcuts
  \DefineAcronymSynonyms
\fi
%    \end{macrocode}
%
% These commands for setting the style are now deprecated but are
% kept for backward compatibility.
%
%\begin{macro}{\SetDefaultAcronymDisplayStyle}
% Sets the default acronym display style for given glossary.
%\changes{2.04}{2009-11-10}{new}
%\changes{3.11a}{2013-10-15}{changed to use \cs{defglsentryfmt}}
%    \begin{macrocode}
\newcommand*{\SetDefaultAcronymDisplayStyle}[1]{%
  \defglsentryfmt[#1]{\glsgenentryfmt}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\DefaultNewAcronymDef}
% Sets up the acronym definition for the default style.
% The information is provided by the tokens \cs{glslabeltok},
% \cs{glsshorttok}, \cs{glslongtok} and \cs{glskeylisttok}.
%    \begin{macrocode}
\newcommand*{\DefaultNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\the\glsshorttok},%
      sort={\the\glsshorttok},%
      text={\the\glsshorttok},%
      first={\acrfullformat{\the\glslongtok}{\the\glsshorttok}},%
      plural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      firstplural={\acrfullformat{\noexpand\expandonce\noexpand\@glo@longpl}%
                                 {\noexpand\expandonce\noexpand\@glo@shortpl}},%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      description={\the\glslongtok},%
      descriptionplural={\noexpand\expandonce\noexpand\@glo@longpl},%
%    \end{macrocode}
% Remaining options specified by the user:
%    \begin{macrocode}
      \the\glskeylisttok
    }%
  }%
  \let\@org@gls@assign@firstpl\gls@assign@firstpl
  \let\@org@gls@assign@plural\gls@assign@plural
  \let\@org@gls@assign@descplural\gls@assign@descplural
  \def\gls@assign@firstpl##1##2{%
    \@@gls@expand@field{##1}{firstpl}{##2}%
  }%
  \def\gls@assign@plural##1##2{%
    \@@gls@expand@field{##1}{plural}{##2}%
  }%
  \def\gls@assign@descplural##1##2{%
    \@@gls@expand@field{##1}{descplural}{##2}%
  }%
  \@do@newglossaryentry
  \let\gls@assign@firstpl\@org@gls@assign@firstpl
  \let\gls@assign@plural\@org@gls@assign@plural
  \let\gls@assign@symbolplural\@org@gls@assign@symbolplural
%    \end{macrocode}
% If expansion is switched off, the default plurals won't be properly set.
%    \begin{macrocode}
  \@@gls@noexpand@assign@default@plurals
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@@gls@noexpand@assign@default@plurals}
%\changes{4.47}{2021-09-20}{new}
%    \begin{macrocode}
\newcommand*{\@@gls@noexpand@assign@default@plurals}{%
  \expandafter\ifx\csname glo@\the\glslabeltok @plural\endcsname\@@gls@@default@acr@plural
    \csxdef{glo@\the\glslabeltok @plural}{\expandonce\@glo@shortpl}%
  \fi
  \expandafter\ifx\csname glo@\the\glslabeltok @firstpl\endcsname\@@gls@@default@acr@firstplural
    \csxdef{glo@\the\glslabeltok @firstpl}{%
      \expandonce\@glo@longpl\glsspace(\expandonce\@glo@shortpl)}%
  \fi
  \expandafter\ifx\csname glo@\the\glslabeltok @descplural\endcsname\@@gls@@default@acr@descplural
    \csxdef{glo@\the\glslabeltok @descplural}{\expandonce\@glo@longpl}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@@gls@@default@acr@plural}
%\changes{4.47}{2021-09-20}{new}
%    \begin{macrocode}
\newcommand*{\@@gls@@default@acr@plural}{\expandonce\@glo@shortpl}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@@gls@@default@acr@firstplural}
%\changes{4.47}{2021-09-20}{new}
%    \begin{macrocode}
\newcommand*{\@@gls@@default@acr@firstplural}{%
 \expandonce\@glo@longpl\glsspace(\expandonce\@glo@shortpl)%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@@gls@@default@acr@descplural}
%\changes{4.47}{2021-09-20}{new}
%    \begin{macrocode}
\newcommand*{\@@gls@@default@acr@descplural}{\expandonce\@glo@longpl}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SetDefaultAcronymStyle}
%\changes{2.04}{2009-11-10}{new}
% Set up the default acronym style:
%    \begin{macrocode}
\newcommand*{\SetDefaultAcronymStyle}{%
%    \end{macrocode}
% Set the display style:
%    \begin{macrocode}
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetDefaultAcronymDisplayStyle{\@gls@type}%
  }%
%    \end{macrocode}
% Set up the definition of \cs{newacronym}:
%    \begin{macrocode}
  \renewcommand{\newacronym}[4][]{%
%    \end{macrocode}
% If user is just using the main glossary and hasn't identified it
% as a list of acronyms, then update. (This is done to ensure 
% backwards compatibility with versions prior to 2.04).
%    \begin{macrocode}
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetDefaultAcronymDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \DefaultNewAcronymDef
  }%
  \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\acrfootnote}
%\changes{3.0}{2011-04-02}{new}
% Used by the footnote acronym styles.
%    \begin{macrocode}
\newcommand*{\acrfootnote}[3]{\acrlinkfootnote{#1}{#2}{#3}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\acrlinkfootnote}
%\changes{3.0}{2011-04-02}{new}
%    \begin{macrocode}
\newcommand*{\acrlinkfootnote}[3]{%
  \footnote{\glslink[#1]{#2}{#3}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\acrnolinkfootnote}
%\changes{3.0}{2011-04-02}{new}
%    \begin{macrocode}
\newcommand*{\acrnolinkfootnote}[3]{%
  \footnote{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\SetDescriptionFootnoteAcronymDisplayStyle}
% Sets the acronym display style for given glossary for the
% description and footnote combination.
%\changes{2.04}{2009-11-10}{new}
%\changes{3.0}{2011-04-02}{expanded options link options}
%\changes{3.11a}{2013-10-15}{updated to use \cs{defglsentryfmt}}
%    \begin{macrocode}
\newcommand*{\SetDescriptionFootnoteAcronymDisplayStyle}[1]{%
  \defglsentryfmt[#1]{%
%    \end{macrocode}
%\changes{4.02}{2013-12-05}{Moved check for empty custom text to prevent
%unwanted parenthetical material}
%    \begin{macrocode}
    \ifdefempty\glscustomtext
    {%
      \ifglsused{\glslabel}%
      {%
        \acronymfont{\glsgenentryfmt}%
      }%
      {%
        \firstacronymfont{\glsgenentryfmt}%
        \ifglshassymbol{\glslabel}%
        {%
          \expandafter\protect\expandafter\acrfootnote\expandafter
           {\@gls@link@opts}{\@gls@link@label}%
           {%
            \glsifplural
              {\glsentrysymbolplural{\glslabel}}%
              {\glsentrysymbol{\glslabel}}%
           }%
        }%
      }%
    }%
    {\glscustomtext\glsinsert}%
  }%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\DescriptionFootnoteNewAcronymDef}
%    \begin{macrocode}
\newcommand*{\DescriptionFootnoteNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\noexpand\acronymfont{\the\glsshorttok}},%
      sort={\the\glsshorttok},%
      first={\the\glsshorttok},%
      firstplural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      text={\the\glsshorttok},%
      plural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      symbol={\the\glslongtok},%
      symbolplural={\noexpand\expandonce\noexpand\@glo@longpl},%
      \the\glskeylisttok
    }%
  }%
  \let\@org@gls@assign@firstpl\gls@assign@firstpl
  \let\@org@gls@assign@plural\gls@assign@plural
  \let\@org@gls@assign@symbolplural\gls@assign@symbolplural
  \def\gls@assign@firstpl##1##2{%
    \@@gls@expand@field{##1}{firstpl}{##2}%
  }%
  \def\gls@assign@plural##1##2{%
    \@@gls@expand@field{##1}{plural}{##2}%
  }%
  \def\gls@assign@symbolplural##1##2{%
    \@@gls@expand@field{##1}{symbolplural}{##2}%
  }%
  \@do@newglossaryentry
  \let\gls@assign@plural\@org@gls@assign@plural
  \let\gls@assign@firstpl\@org@gls@assign@firstpl
  \let\gls@assign@symbolplural\@org@gls@assign@symbolplural
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SetDescriptionFootnoteAcronymStyle}
% If a description and footnote are both required, store the long form 
% in the \gloskey{symbol} key. Store the short form in \gloskey{text}
% key. Note that since the long form is stored in the symbol key,
% if you want the long form to appear in the list of acronyms, you
% need to use a glossary style that displays the symbol key.
% This style was deprecated with the introduction of
% \cs{newacronymstyle}.
%\changes{4.47}{2021-09-20}{added deprecated warnings}
%    \begin{macrocode}
\newcommand*{\SetDescriptionFootnoteAcronymStyle}{%
  \ifglsacrsmallcaps
    \@gls@deprecated@acr@warning{footnote,smallcaps,description}%
      {footnote-sc-desc}{short-sc-footnote-desc}%
  \else
    \ifglsacrsmaller
      \@gls@deprecated@acr@warning{footnote,smaller,description}%
       {footnote-sm-desc}{short-sm-footnote-desc}%
    \else
      \@gls@deprecated@acr@warning{footnote,description}%
       {footnote-desc}{short-footnote-desc}%
    \fi
  \fi
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetDescriptionFootnoteAcronymDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \DescriptionFootnoteNewAcronymDef
  }%
%    \end{macrocode}
%
% If \pkgopt{footnote} package option is specified, set the first
% use to append the long form (stored in \gloskey{symbol}) as a 
% footnote.
%\changes{1.12}{2008-03-08}{Added \cs{protect} before \cs{footnote}
% and \cs{glslink}}
%    \begin{macrocode}
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetDescriptionFootnoteAcronymDisplayStyle{\@gls@type}%
  }%
%    \end{macrocode}
% Redefine \ics{acronymfont} if small caps required. The plural suffix
% is set in an upright font so that it remains in normal lower case,
% otherwise it looks as though it's part of the acronym.
%\changes{1.19}{2009-03-02}{changed \cs{acronymfont} to use
%\cs{textsmaller} instead
%of \cs{smaller}}
%    \begin{macrocode}
  \ifglsacrsmallcaps
    \renewcommand*{\acronymfont}[1]{\textsc{##1}}%
%    \end{macrocode}
%    \begin{macrocode}
    \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}%
  \else
    \ifglsacrsmaller
      \renewcommand*{\acronymfont}[1]{\textsmaller{##1}}%
    \fi
  \fi
%    \end{macrocode}
% Check for package option clash
%    \begin{macrocode}
  \ifglsacrdua
    \PackageError{glossaries}{Option clash: `footnote' and `dua'
    can't both be set}{}%
  \fi
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\SetDescriptionDUAAcronymDisplayStyle}
% Sets the acronym display style for given glossary with 
% description and dua combination.
%\changes{2.04}{2009-11-10}{new}
%\changes{3.11a}{2013-10-15}{updated to use \cs{defglsentryfmt}}
%    \begin{macrocode}
\newcommand*{\SetDescriptionDUAAcronymDisplayStyle}[1]{%
  \defglsentryfmt[#1]{\glsgenentryfmt}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\DescriptionDUANewAcronymDef}
%    \begin{macrocode}
\newcommand*{\DescriptionDUANewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\the\glslongtok},%
      sort={\the\glslongtok},
      text={\the\glslongtok},%
      first={\the\glslongtok},%
      plural={\noexpand\expandonce\noexpand\@glo@longpl},%
      firstplural={\noexpand\expandonce\noexpand\@glo@longpl},%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      symbol={\the\glsshorttok},%
      symbolplural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      \the\glskeylisttok
    }%
  }%
  \let\@org@gls@assign@firstpl\gls@assign@firstpl
  \let\@org@gls@assign@plural\gls@assign@plural
  \let\@org@gls@assign@symbolplural\gls@assign@symbolplural
  \def\gls@assign@firstpl##1##2{%
    \@@gls@expand@field{##1}{firstpl}{##2}%
  }%
  \def\gls@assign@plural##1##2{%
    \@@gls@expand@field{##1}{plural}{##2}%
  }%
  \def\gls@assign@symbolplural##1##2{%
    \@@gls@expand@field{##1}{symbolplural}{##2}%
  }%
  \@do@newglossaryentry
  \let\gls@assign@firstpl\@org@gls@assign@firstpl
  \let\gls@assign@plural\@org@gls@assign@plural
  \let\gls@assign@symbolplural\@org@gls@assign@symbolplural
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SetDescriptionDUAAcronymStyle}
% Description, don't use acronym and no footnote. 
% Note that the short form is stored in the \gloskey{symbol} key,
% so if the short form needs to be displayed in the glossary, 
% use a style the displays the symbol.
% This style was deprecated with the introduction of
% \cs{newacronymstyle}.
%\changes{4.47}{2021-09-20}{added deprecated warning}
%    \begin{macrocode}
\newcommand*{\SetDescriptionDUAAcronymStyle}{%
  \ifglsacrsmallcaps
    \PackageError{glossaries}{Option clash: `smallcaps' and `dua'
    can't both be set}{}%
  \else
    \ifglsacrsmaller
      \PackageError{glossaries}{Option clash: `smaller' and `dua'
      can't both be set}{}%
    \fi
  \fi
  \@gls@deprecated@acr@warning{dua,description}{dua-desc}{long-noshort-desc}%
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetDescriptionDUAAcronymDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \DescriptionDUANewAcronymDef
  }%
%    \end{macrocode}
% Set display.
%    \begin{macrocode}
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetDescriptionDUAAcronymDisplayStyle{\@gls@type}%
  }%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\SetDescriptionAcronymDisplayStyle}
% Sets the acronym display style for given glossary using
% the description setting (but not \pkgopt{footnote} or \pkgopt{dua}).
%\changes{2.04}{2009-11-10}{new}
%\changes{3.07}{2013-07-05}{now using \cs{glsdoparenifnotempty}}
%\changes{3.11a}{2013-10-15}{updated to use \cs{defglsentryfmt}}
%    \begin{macrocode}
\newcommand*{\SetDescriptionAcronymDisplayStyle}[1]{%
  \defglsentryfmt[#1]{%
%    \end{macrocode}
%\changes{4.02}{2013-12-05}{Moved check for empty custom text to prevent
%unwanted parenthetical material}
%    \begin{macrocode}
    \ifdefempty\glscustomtext
    {%
      \ifglsused{\glslabel}%
      {%
%    \end{macrocode}
% Move the inserted text outside of \cs{acronymfont}
%    \begin{macrocode}
        \let\gls@org@insert\glsinsert
        \let\glsinsert\@empty
        \acronymfont{\glsgenentryfmt}\gls@org@insert
      }%
      {%
        \glsgenentryfmt
        \ifglshassymbol{\glslabel}%
          {%
             \glsifplural
             {%
               \def\@glo@symbol{\glsentrysymbolplural{\glslabel}}%
             }%
             {%
               \def\@glo@symbol{\glsentrysymbol{\glslabel}}%
             }%
             \space(\protect\firstacronymfont
             {\glscapscase
              {\@glo@symbol}
              {\@glo@symbol}
              {\mfirstucMakeUppercase{\@glo@symbol}}})%
          }%
          {}%
      }%
    }%
    {\glscustomtext\glsinsert}%
  }%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\DescriptionNewAcronymDef}
%    \begin{macrocode}
\newcommand*{\DescriptionNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\noexpand
        \acrnameformat{\the\glsshorttok}{\the\glslongtok}},%
      sort={\the\glsshorttok},%
      first={\the\glslongtok},%
      firstplural={\noexpand\expandonce\noexpand\@glo@longpl},%
      text={\the\glsshorttok},%
      plural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      symbol={\noexpand\@glo@text},%
      symbolplural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      \the\glskeylisttok}%
  }%
  \let\@org@gls@assign@firstpl\gls@assign@firstpl
  \let\@org@gls@assign@plural\gls@assign@plural
  \let\@org@gls@assign@symbolplural\gls@assign@symbolplural
  \def\gls@assign@firstpl##1##2{%
    \@@gls@expand@field{##1}{firstpl}{##2}%
  }%
  \def\gls@assign@plural##1##2{%
    \@@gls@expand@field{##1}{plural}{##2}%
  }%
  \def\gls@assign@symbolplural##1##2{%
    \@@gls@expand@field{##1}{symbolplural}{##2}%
  }%
  \@do@newglossaryentry
  \let\gls@assign@firstpl\@org@gls@assign@firstpl
  \let\gls@assign@plural\@org@gls@assign@plural
  \let\gls@assign@symbolplural\@org@gls@assign@symbolplural
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SetDescriptionAcronymStyle}
% Option \pkgopt{description} is used, but not \pkgopt{dua}
% or \pkgopt{footnote}.
% Store long form in \gloskey{first} key
% and short form in \gloskey{text} and \gloskey{symbol} key.
% The name is stored using \ics{acrnameformat} to allow the
% user to override the way the name is displayed in the
% list of acronyms.
%    \begin{macrocode}
\newcommand*{\SetDescriptionAcronymStyle}{%
  \ifglsacrsmallcaps
    \@gls@deprecated@acr@warning{smallcaps,description}%
      {long-sc-short-desc}{long-short-sc-desc}%
  \else
    \ifglsacrsmaller
      \@gls@deprecated@acr@warning{smaller,description}%
        {long-sm-short-desc}{long-short-sm-desc}%
    \else
      \@gls@deprecated@acr@warning{description}%
        {long-short-desc}{long-short-desc}%
    \fi
  \fi
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetDescriptionAcronymDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \DescriptionNewAcronymDef
  }%
%    \end{macrocode}
% Set display.
%    \begin{macrocode}
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetDescriptionAcronymDisplayStyle{\@gls@type}%
  }%
%    \end{macrocode}
% Redefine \ics{acronymfont} if small caps required. The plural suffix
% is set in an upright font so that it remains in normal lower case,
% otherwise it looks as though it's part of the acronym.
%\changes{1.19}{2009-03-02}{changed \cs{acronymfont} to use
%\cs{textsmaller} instead
%of \cs{smaller}}
%    \begin{macrocode}
  \ifglsacrsmallcaps
    \renewcommand{\acronymfont}[1]{\textsc{##1}}
    \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}%
  \else
    \ifglsacrsmaller
      \renewcommand*{\acronymfont}[1]{\textsmaller{##1}}%
    \fi
  \fi
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\SetFootnoteAcronymDisplayStyle}
% Sets the acronym display style for given glossary with
% footnote setting (but not \pkgopt{description} or \pkgopt{dua}).
%\changes{2.04}{2009-11-10}{new}
%\changes{3.11a}{2013-10-15}{updated to use \cs{defglsentryfmt}}
%    \begin{macrocode}
\newcommand*{\SetFootnoteAcronymDisplayStyle}[1]{%
  \defglsentryfmt[#1]{%
%    \end{macrocode}
%\changes{4.02}{2013-12-05}{Moved check for empty custom text to prevent
%unwanted parenthetical material}
%    \begin{macrocode}
    \ifdefempty\glscustomtext
    {%
%    \end{macrocode}
% Move the inserted text outside of \cs{acronymfont}
%    \begin{macrocode}
      \let\gls@org@insert\glsinsert
      \let\glsinsert\@empty
      \ifglsused{\glslabel}%
      {%
        \acronymfont{\glsgenentryfmt}\gls@org@insert
      }%
      {%
        \firstacronymfont{\glsgenentryfmt}\gls@org@insert
        \ifglshaslong{\glslabel}%
        {%
          \expandafter\protect\expandafter\acrfootnote\expandafter
           {\@gls@link@opts}{\@gls@link@label}%
           {%
            \glsifplural
              {\glsentrylongpl{\glslabel}}%
              {\glsentrylong{\glslabel}}%
           }%
        }%
%    \end{macrocode}
%\changes{3.13a}{2013-11-05}{fixed missing argument bug}
%    \begin{macrocode}
        {}%
      }%
    }%
    {\glscustomtext\glsinsert}%
  }%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\FootnoteNewAcronymDef}
%    \begin{macrocode}
\newcommand*{\FootnoteNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\noexpand\acronymfont{\the\glsshorttok}},%
      sort={\the\glsshorttok},%
      text={\the\glsshorttok},%
      plural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      first={\the\glsshorttok},%
      firstplural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      description={\the\glslongtok},%
      descriptionplural={\noexpand\expandonce\noexpand\@glo@longpl},%
      \the\glskeylisttok
    }%
  }%
  \let\@org@gls@assign@plural\gls@assign@plural
  \let\@org@gls@assign@firstpl\gls@assign@firstpl
  \let\@org@gls@assign@descplural\gls@assign@descplural
  \def\gls@assign@firstpl##1##2{%
    \@@gls@expand@field{##1}{firstpl}{##2}%
  }%
  \def\gls@assign@plural##1##2{%
    \@@gls@expand@field{##1}{plural}{##2}%
  }%
  \def\gls@assign@descplural##1##2{%
    \@@gls@expand@field{##1}{descplural}{##2}%
  }%
  \@do@newglossaryentry
  \let\gls@assign@plural\@org@gls@assign@plural
  \let\gls@assign@firstpl\@org@gls@assign@firstpl
  \let\gls@assign@descplural\@org@gls@assign@descplural
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SetFootnoteAcronymStyle}
% If \pkgopt{footnote} package option is specified, set the first
% use to append the long form (stored in \gloskey{description}) as a 
% footnote.
% Use the \gloskey{description} key to store the long form.
% This style was deprecated with the introduction of
% \cs{newacronymstyle}.
%\changes{4.47}{2021-09-20}{added deprecated warnings}
%    \begin{macrocode}
\newcommand*{\SetFootnoteAcronymStyle}{%
  \ifglsacrsmallcaps
    \@gls@deprecated@acr@warning{footnote,smallcaps}{footnote-sc}{short-sc-footnote}%
  \else
    \ifglsacrsmaller
      \@gls@deprecated@acr@warning{footnote,smaller}{footnote-sm}{short-sm-footnote}%
    \else
      \@gls@deprecated@acr@warning{footnote}{footnote}{short-footnote}%
    \fi
  \fi
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetFootnoteAcronymDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \FootnoteNewAcronymDef
  }%
%    \end{macrocode}
% Set display
%\changes{1.12}{2008-03-08}{Added \cs{protect} before \cs{footnote} and
% \cs{glslink}}
%    \begin{macrocode}
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetFootnoteAcronymDisplayStyle{\@gls@type}%
  }%
%    \end{macrocode}
% Redefine \ics{acronymfont} if small caps required. The plural suffix
% is set in an upright font so that it remains in normal lower case,
% otherwise it looks as though it's part of the acronym.
%\changes{1.19}{2009-03-02}{changed \cs{acronymfont} to use
%\cs{textsmaller} instead
%of \cs{smaller}}
%    \begin{macrocode}
  \ifglsacrsmallcaps
     \renewcommand*{\acronymfont}[1]{\textsc{##1}}%
     \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}%
  \else
     \ifglsacrsmaller
        \renewcommand*{\acronymfont}[1]{\textsmaller{##1}}%
     \fi
  \fi
%    \end{macrocode}
% Check for option clash
%    \begin{macrocode}
  \ifglsacrdua
     \PackageError{glossaries}{Option clash: `footnote' and `dua'
     can't both be set}{}%
  \fi
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdoparenifnotempty}
% Do a space followed by the argument if the argument doesn't expand
% to empty or \cs{relax}. If argument isn't empty (or \cs{relax}), apply 
% the macro to it given in the second argument.
%    \begin{macrocode}
\DeclareRobustCommand*{\glsdoparenifnotempty}[2]{%
  \protected@edef\gls@tmp{#1}%
  \ifdefempty\gls@tmp
  {}%
  {%
    \ifx\gls@tmp\@gls@default@value
    \else
      \space (#2{#1})%
    \fi
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\SetSmallAcronymDisplayStyle}
% Sets the acronym display style for given glossary where neither
% footnote nor description is required, but smallcaps or smaller
% specified.
%\changes{2.04}{2009-11-10}{new}
%\changes{3.11a}{2013-10-15}{updated to use \cs{defglsentryfmt}}
%    \begin{macrocode}
\newcommand*{\SetSmallAcronymDisplayStyle}[1]{%
  \defglsentryfmt[#1]{%
%    \end{macrocode}
%\changes{4.02}{2013-12-05}{Moved check for empty custom text to prevent
%unwanted parenthetical material}
%    \begin{macrocode}
    \ifdefempty\glscustomtext
    {%
%    \end{macrocode}
% Move the inserted text outside of \cs{acronymfont}
%    \begin{macrocode}
      \let\gls@org@insert\glsinsert
      \let\glsinsert\@empty
      \ifglsused{\glslabel}%
      {%
        \acronymfont{\glsgenentryfmt}\gls@org@insert
      }%
      {%
        \glsgenentryfmt
        \ifglshassymbol{\glslabel}%
        {%
          \glsifplural
          {%
            \def\@glo@symbol{\glsentrysymbolplural{\glslabel}}%
          }%
          {%
            \def\@glo@symbol{\glsentrysymbol{\glslabel}}%
          }%
          \space
            (\glscapscase
            {\firstacronymfont{\@glo@symbol}}%
            {\firstacronymfont{\@glo@symbol}}%
            {\firstacronymfont{\mfirstucMakeUppercase{\@glo@symbol}}})%
        }%
        {}%
      }%
    }%
    {\glscustomtext\glsinsert}%
  }%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SmallNewAcronymDef}
%\changes{3.02}{2012-05-21}{fixed broken short and long plural}
%    \begin{macrocode}
\newcommand*{\SmallNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\noexpand\acronymfont{\the\glsshorttok}},%
      sort={\the\glsshorttok},%
      text={\the\glsshorttok},%
%    \end{macrocode}
% Default to the short plural.
%    \begin{macrocode}
      plural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      first={\the\glslongtok},%
%    \end{macrocode}
% Default to the long plural.
%    \begin{macrocode}
      firstplural={\noexpand\expandonce\noexpand\@glo@longpl},%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      description={\noexpand\@glo@first},%
      descriptionplural={\noexpand\expandonce\noexpand\@glo@longpl},%
      symbol={\the\glsshorttok},%
%    \end{macrocode}
% Default to the short plural.
%    \begin{macrocode}
      symbolplural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      \the\glskeylisttok
    }%
  }%
  \let\@org@gls@assign@firstpl\gls@assign@firstpl
  \let\@org@gls@assign@plural\gls@assign@plural
  \let\@org@gls@assign@descplural\gls@assign@descplural
  \let\@org@gls@assign@symbolplural\gls@assign@symbolplural
  \def\gls@assign@firstpl##1##2{%
    \@@gls@expand@field{##1}{firstpl}{##2}%
  }%
  \def\gls@assign@plural##1##2{%
    \@@gls@expand@field{##1}{plural}{##2}%
  }%
  \def\gls@assign@descplural##1##2{%
    \@@gls@expand@field{##1}{descplural}{##2}%
  }%
  \def\gls@assign@symbolplural##1##2{%
    \@@gls@expand@field{##1}{symbolplural}{##2}%
  }%
  \@do@newglossaryentry
  \let\gls@assign@firstpl\@org@gls@assign@firstpl
  \let\gls@assign@plural\@org@gls@assign@plural
  \let\gls@assign@descplural\@org@gls@assign@descplural
  \let\gls@assign@symbolplural\@org@gls@assign@symbolplural
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SetSmallAcronymStyle}
% Neither footnote nor description required, but smallcaps or
% smaller specified.
% Use the \gloskey{symbol} key to store the short form and
% \gloskey{first} to store the long form.
% This style was deprecated with the introduction of
% \cs{newacronymstyle}.
%\changes{4.47}{2021-09-20}{added deprecated warnings}
%    \begin{macrocode}
\newcommand*{\SetSmallAcronymStyle}{%
  \ifglsacrsmallcaps
    \@gls@deprecated@acr@warning{smallcaps}{long-sc-short}{long-short-sc}%
  \else
    \@gls@deprecated@acr@warning{smaller}{long-sm-short}{long-short-sm}%
  \fi
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetSmallAcronymDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \SmallNewAcronymDef
  }%
%    \end{macrocode}
% Change the display since \gloskey{first} only contains long form.
%    \begin{macrocode}
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetSmallAcronymDisplayStyle{\@gls@type}%
  }%
%    \end{macrocode}
% Redefine \ics{acronymfont} if small caps required. The plural suffix
% is set in an upright font so that it remains in normal lower case,
% otherwise it looks as though it's part of the acronym.
%\changes{1.19}{2009-03-02}{changed \cs{acronymfont} to use
%\cs{textsmaller} instead
%of \cs{smaller}}
%    \begin{macrocode}
  \ifglsacrsmallcaps
    \renewcommand*{\acronymfont}[1]{\textsc{##1}}
    \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}%
  \else
    \renewcommand*{\acronymfont}[1]{\textsmaller{##1}}
  \fi
%    \end{macrocode}
% check for option clash
%    \begin{macrocode}
  \ifglsacrdua
    \ifglsacrsmallcaps
      \PackageError{glossaries}{Option clash: `smallcaps' and `dua'
      can't both be set}{}%
    \else
      \PackageError{glossaries}{Option clash: `smaller' and `dua'
      can't both be set}{}%
    \fi
  \fi
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\SetDUADisplayStyle}
% Sets the acronym display style for given glossary with dua
% setting.
%\changes{2.04}{2009-11-10}{new}
%\changes{3.11a}{2013-10-15}{updated to use \cs{defglsentryfmt}}
%    \begin{macrocode}
\newcommand*{\SetDUADisplayStyle}[1]{%
  \defglsentryfmt[#1]{\glsgenentryfmt}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\DUANewAcronymDef}
%    \begin{macrocode}
\newcommand*{\DUANewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\the\glsshorttok},%
      text={\the\glslongtok},%
      first={\the\glslongtok},%
      plural={\noexpand\expandonce\noexpand\@glo@longpl},%
      firstplural={\noexpand\expandonce\noexpand\@glo@longpl},%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      description={\the\glslongtok},%
      descriptionplural={\noexpand\expandonce\noexpand\@glo@longpl},%
      symbol={\the\glsshorttok},%
      symbolplural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      \the\glskeylisttok
    }%
  }%
  \let\@org@gls@assign@firstpl\gls@assign@firstpl
  \let\@org@gls@assign@plural\gls@assign@plural
  \let\@org@gls@assign@symbolplural\gls@assign@symbolplural
  \let\@org@gls@assign@descplural\gls@assign@descplural
  \def\gls@assign@firstpl##1##2{%
    \@@gls@expand@field{##1}{firstpl}{##2}%
  }%
  \def\gls@assign@plural##1##2{%
    \@@gls@expand@field{##1}{plural}{##2}%
  }%
  \def\gls@assign@symbolplural##1##2{%
    \@@gls@expand@field{##1}{symbolplural}{##2}%
  }%
  \def\gls@assign@descplural##1##2{%
    \@@gls@expand@field{##1}{descplural}{##2}%
  }%
  \@do@newglossaryentry
  \let\gls@assign@firstpl\@org@gls@assign@firstpl
  \let\gls@assign@plural\@org@gls@assign@plural
  \let\gls@assign@symbolplural\@org@gls@assign@symbolplural
  \let\gls@assign@descplural\@org@gls@assign@descplural
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SetDUAStyle}
% Always expand acronyms.
% This style was deprecated with the introduction of
% \cs{newacronymstyle}.
%\changes{4.47}{2021-09-20}{added deprecated warnings}
%    \begin{macrocode}
\newcommand*{\SetDUAStyle}{%
  \@gls@deprecated@acr@warning{dua}{dua}{long-noshort}%
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetDUADisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \DUANewAcronymDef
  }%
%    \end{macrocode}
% Set the display
%    \begin{macrocode}
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetDUADisplayStyle{\@gls@type}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@deprecated@acr@warning}
%\changes{4.47}{2021-09-20}{new}
%    \begin{macrocode}
\newcommand*{\@gls@deprecated@acr@warning}[3]{%
   \GlossariesWarning{Acronym style option #1 deprecated. 
   Use \string\setacronymstyle{#2} with just glossaries.sty or
   use \string\setabbreviationstyle[acronym]{#3} with
   glossaries-extra.sty}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\SetAcronymStyle}
%    \begin{macrocode}
\newcommand*{\SetAcronymStyle}{%
  \SetDefaultAcronymStyle
  \ifglsacrdescription
    \ifglsacrfootnote
      \SetDescriptionFootnoteAcronymStyle
    \else
      \ifglsacrdua
        \SetDescriptionDUAAcronymStyle
      \else
        \SetDescriptionAcronymStyle
      \fi
    \fi
  \else
    \ifglsacrfootnote
      \SetFootnoteAcronymStyle
    \else
      \ifthenelse{\boolean{glsacrsmallcaps}\OR
        \boolean{glsacrsmaller}}%
      {%
        \SetSmallAcronymStyle
      }%
      {%
        \ifglsacrdua
          \SetDUAStyle
        \fi
      }%
    \fi
  \fi
}
%    \end{macrocode}
% Set the acronym style according to the package options
%    \begin{macrocode}
\SetAcronymStyle
%    \end{macrocode}
%\end{macro}
%
% Allow user to define their own custom acronyms.
% (For compatibility with versions before v3.0, the short form is
% stored in the user1 key, the plural short form is stored in the
% user2 key, the long form is stored in the user3 key and the
% plural long form is stored in the user4 key.) Defaults to
% displaying only the acronym with the long form as the description.
%\begin{macro}{\SetCustomDisplayStyle}
% Sets the acronym display style.
%\changes{2.06}{2010-06-14}{new}
%\changes{3.11a}{2013-10-15}{updated to use \cs{defglsentryfmt}}
%    \begin{macrocode}
\newcommand*{\SetCustomDisplayStyle}[1]{%
  \defglsentryfmt[#1]{\glsgenentryfmt}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\CustomAcronymFields}
%\changes{2.06}{2010-06-14}{new}
%    \begin{macrocode}
\newcommand*{\CustomAcronymFields}{%
  name={\the\glsshorttok},%
  description={\the\glslongtok},%
  first={\acrfullformat{\the\glslongtok}{\the\glsshorttok}},%
  firstplural={\acrfullformat
    {\noexpand\glsentrylongpl{\the\glslabeltok}}%
    {\noexpand\glsentryshortpl{\the\glslabeltok}}},%
%    \end{macrocode}
% \changes{4.01}{2013-11-16}{inserted missing comma}
%    \begin{macrocode}
  text={\the\glsshorttok},%
  plural={\the\glsshorttok\noexpand\acrpluralsuffix}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\CustomNewAcronymDef}
%\changes{2.06}{2010-06-14}{new}
%    \begin{macrocode}
\newcommand*{\CustomNewAcronymDef}{%
  \protected@edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      user1={\the\glsshorttok},%
      user2={\the\glsshorttok\noexpand\acrpluralsuffix},%
      user3={\the\glslongtok},%
      user4={\the\glslongtok\noexpand\acrpluralsuffix},%
      \CustomAcronymFields,%
      \the\glskeylisttok
    }%
  }%
  \@do@newglossaryentry
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SetCustomStyle}
%\changes{2.06}{2010-06-14}{new}
%    \begin{macrocode}
\newcommand*{\SetCustomStyle}{%
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetCustomDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \CustomNewAcronymDef
  }%
%    \end{macrocode}
% Set the display
%    \begin{macrocode}
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetCustomDisplayStyle{\@gls@type}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%
% \section{Predefined Glossary Styles}\label{sec:code:styles}
% The \sty{glossaries} bundle comes with some predefined glossary
% styles. These need to be loaded now for the \pkgopt{style} option
% to use them.
%
% First, the glossary hyper-navigation commands need to be loaded.
%    \begin{macrocode}
\RequirePackage{glossary-hypernav}
%    \end{macrocode}
% The styles that use list-like environments. These are not loaded
% if the \pkgopt{nolist} option is used:
%    \begin{macrocode}
\@gls@loadlist
%    \end{macrocode}
% The styles that use the \env{longtable} environment. These are
% not loaded if the \pkgopt{nolong} package option is used.
%    \begin{macrocode}
\@gls@loadlong
%    \end{macrocode}
% The styles that use the \env{supertabular} environment. These are
% not loaded if the \pkgopt{nosuper} package option is used or if
% the \isty{supertabular} package isn't installed.
%    \begin{macrocode}
\@gls@loadsuper
%    \end{macrocode}
% The tree-like styles. These are not loaded if the \pkgopt{notree}
% package option is used.
%    \begin{macrocode}
\@gls@loadtree
%    \end{macrocode}
% The default glossary style is set according to the \pkgopt{style} package
% option, but can be overridden by \ics{glossarystyle}. The
% required style must be defined at this point.
%    \begin{macrocode}
\ifx\@glossary@default@style\relax
\else
  \setglossarystyle{\@glossary@default@style}
\fi
%    \end{macrocode}
%
%\section{Debugging Commands}
%
%\begin{macro}{\showgloparent}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showgloparent}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showgloparent}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@parent\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglolevel}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglolevel}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglolevel}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@level\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglotext}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglotext}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglotext}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@text\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showgloplural}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showgloplural}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showgloplural}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@plural\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglofirst}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglofirst}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglofirst}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@first\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglofirstpl}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglofirstpl}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglofirstpl}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@firstpl\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglotype}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglotype}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglotype}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@type\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglocounter}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglocounter}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglocounter}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@counter\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglouseri}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglouseri}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglouseri}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@useri\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglouserii}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglouserii}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglouserii}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@userii\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglouseriii}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglouseriii}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglouseriii}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@useriii\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglouseriv}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglouseriv}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglouseriv}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@useriv\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglouserv}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglouserv}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglouserv}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@userv\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglouservi}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglouservi}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglouservi}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@uservi\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showgloname}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showgloname}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showgloname}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@name\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglodesc}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglodesc}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglodesc}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@desc\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglodescplural}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglodescplural}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglodescplural}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@descplural\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglosort}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglosort}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglosort}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@sort\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglosymbol}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglosymbol}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglosymbol}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@symbol\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglosymbolplural}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglosymbolplural}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglosymbolplural}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@symbolplural\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showgloshort}
%\changes{3.11a}{2013-10-15}{new}
%\begin{definition}
%\cs{showgloshort}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showgloshort}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@short\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglolong}
%\changes{3.11a}{2013-10-15}{new}
%\begin{definition}
%\cs{showglolong}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglolong}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@long\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showgloindex}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showgloindex}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showgloindex}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@index\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showgloflag}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showgloflag}\marg{label}
%\end{definition}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showgloflag}[1]{%
  \expandafter\show\csname ifglo@\glsdetoklabel{#1}@flag\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showgloloclist}
%\changes{4.04}{2014-03-06}{new}
%\begin{definition}
%\cs{showgloloclist}\marg{label}
%\end{definition}
%    \begin{macrocode}
\newcommand*{\showgloloclist}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@loclist\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglofield}
%\changes{4.16}{2015-07-08}{new}
%\begin{definition}
%\cs{showglofield}\marg{label}\marg{field}
%\end{definition}
%    \begin{macrocode}
\newcommand*{\showglofield}[2]{%
 \csshow{glo@\glsdetoklabel{#1}@#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showacronymlists}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showacronymlists}
%\end{definition}
% Show list of glossaries that have been flagged as a list of
% acronyms.
%    \begin{macrocode}
\newcommand*{\showacronymlists}{%
   \show\@glsacronymlists
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\showglossaries}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglossaries}
%\end{definition}
% Show list of defined glossaries.
%    \begin{macrocode}
\newcommand*{\showglossaries}{%
   \show\@glo@types
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglossaryin}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglossaryin}\marg{glossary-label}
%\end{definition}
% Show the `in' extension for the given glossary.
%    \begin{macrocode}
\newcommand*{\showglossaryin}[1]{%
  \expandafter\show\csname @glotype@#1@in\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglossaryout}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglossaryout}\marg{glossary-label}
%\end{definition}
% Show the `out' extension for the given glossary.
%    \begin{macrocode}
\newcommand*{\showglossaryout}[1]{%
  \expandafter\show\csname @glotype@#1@out\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglossarytitle}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglossarytitle}\marg{glossary-label}
%\end{definition}
% Show the title for the given glossary.
%    \begin{macrocode}
\newcommand*{\showglossarytitle}[1]{%
  \expandafter\show\csname @glotype@#1@title\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglossarycounter}
%\changes{3.0}{2011-04-02}{new}
%\begin{definition}
%\cs{showglossarycounter}\marg{glossary-label}
%\end{definition}
% Show the counter for the given glossary.
%    \begin{macrocode}
\newcommand*{\showglossarycounter}[1]{%
  \expandafter\show\csname @glotype@#1@counter\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\showglossaryentries}
%\changes{3.0}{2011-04-02}{new}
%\changes{3.02}{2012-05-21}{fixed misspelt command}
%\begin{definition}
%\cs{showglossaryentries}\marg{glossary-label}
%\end{definition}
% Show the list of entry labels for the given glossary.
%    \begin{macrocode}
\newcommand*{\showglossaryentries}[1]{%
  \expandafter\show\csname glolist@#1\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\section{Compatibility with version 2.07 and below}
%
% In order to fix some bugs in v3.0, it was necessary to change the
% way information is written to the \filetype{glo} file, which also meant
% a change in the format of the Xindy style file. The compatibility
% option is meant for documents that use a customised Xindy style
% file with \ics{noist}. With the compatibility option, hopefully
% \app{xindy} will still be able to process the old document, but
% the bugs will remain. The issues in versions 2.07 and below:
%\begin{itemize}
% \item With \pkgopt{xindy}, the counter used by the entry was
% hard-coded into the Xindy style file. This meant that you couldn't
% use the \gloskey[glslink]{counter} to swap counters.
% \item With both \pkgopt{xindy} and \pkgopt{makeindex}, if used
% with \sty{hyperref} and \cs{theH}\meta{counter} was different to
% \cs{thecounter}, the link in the location number would be
% undefined.
%\end{itemize}
%    \begin{macrocode}
\csname ifglscompatible-2.07\endcsname
  \RequirePackage{glossaries-compatible-207}
\fi
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-prefix.sty>
%    \end{macrocode}
%\fi
%\chapter{Prefix Support (glossaries-prefix Code)}
%\label{sec:code:prefix}
%\changes{3.14a}{2013-11-12}{new}
% This package provides a means of adding prefixes to your glossary
% entries. For example, you may want to use \qt{a
% \cs{gls}\marg{label}} on first use but use \qt{an
% \cs{gls}\marg{label}} on subsequent use.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{glossaries-prefix}[2021/11/01 v4.49 (NLCT)]
%    \end{macrocode}
% Pass all options to \sty{glossaries}:
%    \begin{macrocode}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{glossaries}}
%    \end{macrocode}
% Process options:
%    \begin{macrocode}
\ProcessOptions
%    \end{macrocode}
% Load \sty{glossaries}:
%    \begin{macrocode}
\RequirePackage{glossaries}
%    \end{macrocode}
% Add the new keys:
%    \begin{macrocode}
\define@key{glossentry}{prefixfirst}{\def\@glo@entryprefixfirst{#1}}%
\define@key{glossentry}{prefixfirstplural}{\def\@glo@entryprefixfirstplural{#1}}%
\define@key{glossentry}{prefix}{\def\@glo@entryprefix{#1}}%
\define@key{glossentry}{prefixplural}{\def\@glo@entryprefixplural{#1}}%
%    \end{macrocode}
% Add them to \ics{@gls@keymap}:
%    \begin{macrocode}
\appto\@gls@keymap{,%
   {prefixfirst}{prefixfirst},%
   {prefixfirstplural}{prefixfirstplural},%
   {prefix}{prefix},%
   {prefixplural}{prefixplural}%
 }
%    \end{macrocode}
% Set the default values:
%    \begin{macrocode}
\appto\@newglossaryentryprehook{%
  \def\@glo@entryprefix{}%
  \def\@glo@entryprefixplural{}%
  \let\@glo@entryprefixfirst\@gls@default@value
  \let\@glo@entryprefixfirstplural\@gls@default@value
}
%    \end{macrocode}
% Set the assignment code:
%    \begin{macrocode}
\appto\@newglossaryentryposthook{%
  \gls@assign@field{}{\@glo@label}{prefix}{\@glo@entryprefix}%
  \gls@assign@field{}{\@glo@label}{prefixplural}{\@glo@entryprefixplural}%
%    \end{macrocode}
% If \gloskey{prefixfirst} has not been supplied, make it the same
% as \gloskey{prefix}.
%    \begin{macrocode}
  \expandafter\gls@assign@field\expandafter
    {\csname glo@\@glo@label @prefix\endcsname}{\@glo@label}{prefixfirst}%
    {\@glo@entryprefixfirst}%
%    \end{macrocode}
% If \gloskey{prefixfirstplural} has not been supplied, make it the same
% as \gloskey{prefixplural}.
%    \begin{macrocode}
  \expandafter\gls@assign@field\expandafter
    {\csname glo@\@glo@label @prefixplural\endcsname}{\@glo@label}%
    {prefixfirstplural}{\@glo@entryprefixfirstplural}%
}
%    \end{macrocode}
%
% Define commands to access these fields:
%\begin{macro}{\glsentryprefixfirst}
%\changes{4.45}{2020-02-13}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\glsentryprefixfirst}[1]{\csuse{glo@\glsdetoklabel{#1}@prefixfirst}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentryprefixfirstplural}
%\changes{4.45}{2020-02-13}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\glsentryprefixfirstplural}[1]{%
 \csuse{glo@\glsdetoklabel{#1}@prefixfirstplural}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentryprefix}
%\changes{4.45}{2020-02-13}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\glsentryprefix}[1]{\csuse{glo@\glsdetoklabel{#1}@prefix}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentryprefixplural}
%\changes{4.45}{2020-02-13}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\glsentryprefixplural}[1]{\csuse{glo@\glsdetoklabel{#1}@prefixplural}}
%    \end{macrocode}
%\end{macro}
%
% Now for the initial upper case variants:
%\begin{macro}{\Glsentryprefixfirst}
%\changes{4.45}{2020-02-13}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newrobustcmd*{\Glsentryprefixfirst}[1]{%
  \protected@edef\@glo@text{\csname glo@\glsdetoklabel{#1}@prefixfirst\endcsname}%
  \xmakefirstuc\@glo@text
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryprefixfirstplural}
%\changes{4.45}{2020-02-13}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newrobustcmd*{\Glsentryprefixfirstplural}[1]{%
  \protected@edef\@glo@text{\csname glo@\glsdetoklabel{#1}@prefixfirstplural\endcsname}%
  \xmakefirstuc\@glo@text
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryprefix}
%\changes{4.45}{2020-02-13}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newrobustcmd*{\Glsentryprefix}[1]{%
  \protected@edef\@glo@text{\csname glo@\glsdetoklabel{#1}@prefix\endcsname}%
  \xmakefirstuc\@glo@text
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryprefixplural}
%\changes{4.45}{2020-02-13}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newrobustcmd*{\Glsentryprefixplural}[1]{%
  \protected@edef\@glo@text{\csname glo@\glsdetoklabel{#1}@prefixplural\endcsname}%
  \xmakefirstuc\@glo@text
}
%    \end{macrocode}
%\end{macro}
%
% Define commands to determine if the prefix keys have been set:
%\begin{macro}{\ifglshasprefix}
%\changes{4.45}{2020-02-13}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\ifglshasprefix}[3]{%
  \ifcsempty{glo@\glsdetoklabel{#1}@prefix}%
  {#3}%
  {#2}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\ifglshasprefixplural}
%\changes{4.45}{2020-02-13}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\ifglshasprefixplural}[3]{%
  \ifcsempty{glo@\glsdetoklabel{#1}@prefixplural}%
  {#3}%
  {#2}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\ifglshasprefixfirst}
%\changes{4.45}{2020-02-13}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\ifglshasprefixfirst}[3]{%
  \ifcsempty{glo@\glsdetoklabel{#1}@prefixfirst}%
  {#3}%
  {#2}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\ifglshasprefixfirstplural}
%\changes{4.45}{2020-02-13}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\ifglshasprefixfirstplural}[3]{%
  \ifcsempty{glo@\glsdetoklabel{#1}@prefixfirstplural}%
  {#3}%
  {#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsprefix@record@hook}
%\changes{4.44}{2019-12-06}{new}
%Need to take into account the possibility that
%\sty{glossaries-extra} might be loaded with the \pkgopt{record}
%option.
%    \begin{macrocode}
\providecommand{\@glsprefix@record@hook}[2]{%
  \ifdef\@glsxtr@record
  {\@glsxtr@record{#1}{#2}{glslink}}%
  {}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsprefixsep}
%\changes{4.45}{2020-02-13}{new}
%Separator between prefix and term. Does nothing by default.
%    \begin{macrocode}
\newcommand{\glsprefixsep}{}
%    \end{macrocode}
%\end{macro}
%
% Define commands that insert the prefix before commands like \ics{gls}:
%\begin{macro}{\pgls}
%\changes{4.08}{2014-07-30}{changed to use \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd{\pgls}{\@gls@hyp@opt\@pgls}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \@spgls}
%\begin{macro}{\@pgls}
% Unstarred version.
%    \begin{macrocode}
\newcommand*{\@pgls}[2][]{%
  \new@ifnextchar[%
  {\@pgls@{#1}{#2}}%
  {\@pgls@{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@pgls@}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@pgls@#1#2[#3]{%
  \@glsprefix@record@hook{#1}{#2}%
  \glsdoifexists{#2}%
  {%
    \ifglsused{#2}%
    {%
      \ifglshasprefix{#2}{\glsentryprefix{#2}\glsprefixsep}{}%
    }%
    {%
      \ifglshasprefixfirst{#2}{\glsentryprefixfirst{#2}\glsprefixsep}{}%
    }%
    \@gls@{#1}{#2}[#3]%
  }%
}
%    \end{macrocode}
%\end{macro}
%
% Similarly for the plural version:
%\begin{macro}{\pglspl}
%\changes{4.08}{2014-07-30}{changed to use \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd{\pglspl}{\@gls@hyp@opt\@pglspl}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \@spglspl}
%\begin{macro}{\@pglspl}
% Unstarred version.
%    \begin{macrocode}
\newcommand*{\@pglspl}[2][]{%
  \new@ifnextchar[%
  {\@pglspl@{#1}{#2}}%
  {\@pglspl@{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@pglspl@}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@pglspl@#1#2[#3]{%
  \@glsprefix@record@hook{#1}{#2}%
  \glsdoifexists{#2}%
  {%
    \ifglsused{#2}%
    {%
      \ifglshasprefixplural{#2}{\glsentryprefixplural{#2}\glsprefixsep}{}%
    }%
    {%
      \ifglshasprefixfirstplural{#2}%
        {\glsentryprefixfirstplural{#2}\glsprefixsep}{}%
    }%
    \@glspl@{#1}{#2}[#3]%
  }%
}
%    \end{macrocode}
%\end{macro}
%
% Now for the first letter upper case versions:
%\begin{macro}{\Pgls}
%\changes{4.08}{2014-07-30}{changed to use \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd{\Pgls}{\@gls@hyp@opt\@Pgls}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \@sPgls}
%\begin{macro}{\@Pgls}
% Unstarred version.
%    \begin{macrocode}
\newcommand*{\@Pgls}[2][]{%
  \new@ifnextchar[%
  {\@Pgls@{#1}{#2}}%
  {\@Pgls@{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Pgls@}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Pgls@#1#2[#3]{%
  \@glsprefix@record@hook{#1}{#2}%
  \glsdoifexists{#2}%
  {%
    \ifglsused{#2}%
    {%
      \ifglshasprefix{#2}%
      {%
        \Glsentryprefix{#2}%
        \glsprefixsep
        \@gls@{#1}{#2}[#3]%
      }%
      {\@Gls@{#1}{#2}[#3]}%
    }%
    {%
      \ifglshasprefixfirst{#2}%
      {%
        \Glsentryprefixfirst{#2}%
        \glsprefixsep
        \@gls@{#1}{#2}[#3]%
      }%
      {\@Gls@{#1}{#2}[#3]}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
% Similarly for the plural version:
%\begin{macro}{\Pglspl}
%\changes{4.08}{2014-07-30}{changed to use \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd{\Pglspl}{\@gls@hyp@opt\@Pglspl}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \@sPglspl}
%\begin{macro}{\@Pglspl}
% Unstarred version.
%    \begin{macrocode}
\newcommand*{\@Pglspl}[2][]{%
  \new@ifnextchar[%
  {\@Pglspl@{#1}{#2}}%
  {\@Pglspl@{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Pglspl@}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Pglspl@#1#2[#3]{%
  \@glsprefix@record@hook{#1}{#2}%
  \glsdoifexists{#2}%
  {%
    \ifglsused{#2}%
    {%
      \ifglshasprefixplural{#2}%
      {%
        \Glsentryprefixplural{#2}%
        \glsprefixsep
        \@glspl@{#1}{#2}[#3]%
      }%
      {\@Glspl@{#1}{#2}[#3]}%
    }%
    {%
      \ifglshasprefixfirstplural{#2}%
      {%
        \Glsentryprefixfirstplural{#2}%
        \glsprefixsep
        \@glspl@{#1}{#2}[#3]%
      }%
      {\@Glspl@{#1}{#2}[#3]}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
% Finally the all upper case versions:
%\begin{macro}{\PGLS}
%\changes{4.08}{2014-07-30}{changed to use \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd{\PGLS}{\@gls@hyp@opt\@PGLS}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \@sPGLS}
%\begin{macro}{\@PGLS}
% Unstarred version.
%    \begin{macrocode}
\newcommand*{\@PGLS}[2][]{%
  \new@ifnextchar[%
  {\@PGLS@{#1}{#2}}%
  {\@PGLS@{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@PGLS@}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@PGLS@#1#2[#3]{%
  \@glsprefix@record@hook{#1}{#2}%
  \glsdoifexists{#2}%
  {%
    \ifglsused{#2}%
    {%
      \ifglshasprefix{#2}%
        {\mfirstucMakeUppercase{\glsentryprefix{#2}\glsprefixsep}}{}%
    }%
    {%
      \ifglshasprefixfirst{#2}%
      {\mfirstucMakeUppercase{\glsentryprefixfirst{#2}\glsprefixsep}}{}%
    }%
    \@GLS@{#1}{#2}[#3]%
  }%
}
%    \end{macrocode}
%\end{macro}
%
% Plural version:
%\begin{macro}{\PGLSpl}
%\changes{4.08}{2014-07-30}{changed to use \cs{@gls@hyp@opt}}
%    \begin{macrocode}
\newrobustcmd{\PGLSpl}{\@gls@hyp@opt\@PGLSpl}
%    \end{macrocode}
%\end{macro}
%\changes{4.08}{2014-07-30}{removed \@sPGLSpl}
%\begin{macro}{\@PGLSpl}
% Unstarred version.
%    \begin{macrocode}
\newcommand*{\@PGLSpl}[2][]{%
  \new@ifnextchar[%
  {\@PGLSpl@{#1}{#2}}%
  {\@PGLSpl@{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@PGLSpl@}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@PGLSpl@#1#2[#3]{%
  \@glsprefix@record@hook{#1}{#2}%
  \glsdoifexists{#2}%
  {%
    \ifglsused{#2}%
    {%
      \ifglshasprefixplural{#2}%
        {\mfirstucMakeUppercase{\glsentryprefixplural{#2}\glsprefixsep}}{}%
    }%
    {%
      \ifglshasprefixfirstplural{#2}%
      {\mfirstucMakeUppercase{\glsentryprefixfirstplural{#2}\glsprefixsep}}{}%
    }%
    \@GLSpl@{#1}{#2}[#3]%
  }%
}
%    \end{macrocode}
%\end{macro}
%\iffalse
%    \begin{macrocode}
%</glossaries-prefix.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossary-hypernav.sty>
%    \end{macrocode}
%\fi
%\chapter{Glossary Styles}
% \section{Glossary hyper-navigation definitions (glossary-hypernav package)}
%\label{sec:code:hypernav}
% Package Definition:
%    \begin{macrocode}
\ProvidesPackage{glossary-hypernav}[2021/11/01 v4.49 (NLCT)]
%    \end{macrocode}
%
% The commands defined in this package are provided to 
% help navigate around the groups within a glossary 
% (see \autoref{sec:code:printglos}.)
% \ics{printglossary} (and \ics{printglossaries})
% set \cs{@glo@type} to the label of the current
% glossary. This is used to create a unique hypertarget in
% the event of multiple glossaries.
%\begin{definition}
% \cs{glsnavhyperlink}\oarg{type}\marg{label}\marg{text}
%\end{definition}
% This command makes \meta{text} a hyperlink to the glossary group
% whose label is given by \meta{label} for the glossary given
% by \meta{type}.
%\begin{macro}{\glsnavhyperlink}
%\changes{1.14}{2008-06-17}{changed \cs{edef} to \cs{protected@edef}}
%\changes{1.17}{2008-12-26}{replaced \cs{hyperlink} to
%\cs{@glslink}}
%    \begin{macrocode}
\newcommand*{\glsnavhyperlink}[3][\@glo@type]{%
%    \end{macrocode}
%\changes{4.47}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
  \protected@edef\gls@grplabel{#2}\protected@edef\@gls@grptitle{#3}%
  \@glslink{\glsnavhyperlinkname{#1}{#2}}{#3}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsnavhyperlinkname}
%\changes{4.29}{2017-01-19}{new}
%Expands to the hypertarget name. The first argument is the glossary
%type. The second argument is the group label.
%    \begin{macrocode}
\newcommand*{\glsnavhyperlinkname}[2]{glsn:#1@#2}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsnavhypertarget}
%\begin{definition}
% \cs{glsnavhypertarget}\oarg{type}\marg{label}\marg{text}
%\end{definition}
% This command makes \meta{text} a hypertarget for the glossary group
% whose label is given by \meta{label} in the glossary given
% by \meta{type}. If \meta{type} is omitted, \cs{@glo@type} is
% used which is set by \ics{printglossary} to the current
% glossary label.
%\changes{1.14}{2008-06-17}{added write to aux file}
%\changes{1.15}{2008-08-15}{added check if rerun required}
%\changes{1.17}{2008-12-26}{replaced \cs{hypertarget} to
%\cs{@glstarget}}
%    \begin{macrocode}
\newcommand*{\glsnavhypertarget}[3][\@glo@type]{%
  \@glsnavhypertarget{#1}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%The actual code is now in an internal command that doesn't have an
%optional argument, which makes it easier to save and restore the
%original behaviour.
%\begin{macro}{\@glsnavhypertarget}
%\changes{4.32}{2017-08-24}{new}
%    \begin{macrocode}
\newcommand*{\@glsnavhypertarget}[3]{%
%    \end{macrocode}
% Add this group to the aux file for re-run check.
%    \begin{macrocode}
  \protected@write\@auxout{}{\string\@gls@hypergroup{#1}{#2}}%
%    \end{macrocode}
% Add the target.
%    \begin{macrocode}
  \@glstarget{\glsnavhyperlinkname{#1}{#2}}{#3}%
%    \end{macrocode}
% Check list of known groups to determine if a re-run is required.
%    \begin{macrocode}
  \expandafter\let
     \expandafter\@gls@list\csname @gls@hypergrouplist@#1\endcsname
%    \end{macrocode}
% Iterate through list and terminate loop if this group is found.
%    \begin{macrocode}
  \@for\@gls@elem:=\@gls@list\do{%
    \ifthenelse{\equal{\@gls@elem}{#2}}{\@endfortrue}{}}%
%    \end{macrocode}
% Check if list terminated prematurely.
%    \begin{macrocode}
  \if@endfor
  \else
%    \end{macrocode}
% This group was not included in the list, so issue a warning.
%    \begin{macrocode}
    \GlossariesWarningNoLine{Navigation panel 
       for glossary type `#1'^^Jmissing group `#2'}%
    \gdef\gls@hypergrouprerun{%
      \GlossariesWarningNoLine{Navigation panel 
      has changed. Rerun LaTeX}}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\gls@hypergrouprerun}
% Give a warning at the end if re-run required
%\changes{1.15}{2008-08-15}{new}
%    \begin{macrocode}
\let\gls@hypergrouprerun\relax
\AtEndDocument{\gls@hypergrouprerun}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@hypergroup}
% This adds to (or creates) the command \cs{@gls@hypergrouplist@}\meta{glossary type} 
% which lists all groups for a given glossary, so that
% the navigation bar only contains those groups that are present.
% However it requires at least 2 runs to ensure the information is
% up-to-date.
%\changes{1.14}{2008-06-17}{new}
%    \begin{macrocode}
\newcommand*{\@gls@hypergroup}[2]{%
\@ifundefined{@gls@hypergrouplist@#1}{%
   \expandafter\xdef\csname @gls@hypergrouplist@#1\endcsname{#2}%
}{%
   \expandafter\let\expandafter\@gls@tmp
      \csname @gls@hypergrouplist@#1\endcsname
   \expandafter\xdef\csname @gls@hypergrouplist@#1\endcsname{%
      \@gls@tmp,#2}%
}%
}
%    \end{macrocode}
%\end{macro}
%
% The \cs{glsnavigation} command displays a simple glossary 
% group navigation. 
% The symbol and number elements are defined separately, 
% so that they can be suppressed if need be. (In earlier verions this 
% command will produce a link to all 28 groups, but some groups
% may not be defined if there are groups that do not contain any
% terms, in which case you will get an undefined hyperlink warning.
% Version 1.14 changed this to only use labels for groups that are
% present.)
% Now for the whole navigation bit:
%\begin{macro}{\glsnavigation}
% \changes{1.14}{2008-06-17}{changed to only use labels for
% groups that are present}
%    \begin{macrocode}
\newcommand*{\glsnavigation}{%
  \def\@gls@between{}%
  \ifcsundef{@gls@hypergrouplist@\@glo@type}%
  {%
    \def\@gls@list{}%
  }%
  {%
    \expandafter\let\expandafter\@gls@list
      \csname @gls@hypergrouplist@\@glo@type\endcsname
  }%
  \@for\@gls@tmp:=\@gls@list\do{%
    \@gls@between
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{switched to using
%\cs{@gls@getgrouptitle}}
%    \begin{macrocode}
    \@gls@getgrouptitle{\@gls@tmp}{\@gls@grptitle}%
    \glsnavhyperlink{\@gls@tmp}{\@gls@grptitle}%
    \let\@gls@between\glshypernavsep
  }%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glshypernavsep}
% Separator for the hyper navigation bar.
%    \begin{macrocode}
\newcommand*{\glshypernavsep}{\space\textbar\space}
%    \end{macrocode}
%\end{macro}
% The \cs{glssymbolnav} produces a simple navigation set of
% links for just the symbol and number groups. This used to be used at
% the start of \cs{glsnavigation}. This command is no longer needed.
%\begin{macro}{\glssymbolnav}
%    \begin{macrocode}
\newcommand*{\glssymbolnav}{%
 \glsnavhyperlink{glssymbols}{\glsgetgrouptitle{glssymbols}}%
 \glshypernavsep
 \glsnavhyperlink{glsnumbers}{\glsgetgrouptitle{glsnumbers}}%
 \glshypernavsep
}
%    \end{macrocode}
%\end{macro}
%\iffalse
%    \begin{macrocode}
%</glossary-hypernav.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossary-inline.sty>
%    \end{macrocode}
%\fi
% \section{In-line Style (glossary-inline.sty)}
% This defines an in-line style where the entries are
% comma-separated with just the name and description displayed.
%    \begin{macrocode}
\ProvidesPackage{glossary-inline}[2021/11/01 v4.49 (NLCT)]
%    \end{macrocode}
%
%\begin{style}{inline}
% Define the inline style.
%    \begin{macrocode}
\newglossarystyle{inline}{%
%    \end{macrocode}
% Start of glossary sets up first empty separator between entries.
% (This is then changed by \cs{glossentry})
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {%
      \def\gls@inlinesep{}%
      \def\gls@inlinesubsep{}%
      \def\gls@inlinepostchild{}%
    }%
    {\glspostinline}%
%    \end{macrocode}
% No header:
%    \begin{macrocode}
 \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings (if heading is required, add
% \ics{glsinlinedopostchild} to start definition in case heading
% follows a child entry):
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Just display separator followed by name and description:
%\changes{3.08a}{2013-08-30}{updated inline style to use
%\cs{glossentry} and \cs{subglossentry}}
%    \begin{macrocode}
  \renewcommand{\glossentry}[2]{%
    \glsinlinedopostchild
    \gls@inlinesep
    \glsentryitem{##1}%
    \glsinlinenameformat{##1}{%
      \glossentryname{##1}%
    }%
   \ifglsdescsuppressed{##1}%
   {%
      \glsinlineemptydescformat
      {%
         \glossentrysymbol{##1}%
      }%
      {%
        ##2%
      }%
    }%
    {%
      \ifglshasdesc{##1}%
      {\glsinlinedescformat{\glossentrydesc{##1}}{\glossentrysymbol{##1}}{##2}}%
      {\glsinlineemptydescformat{\glossentrysymbol{##1}}{##2}}%
    }%
    \ifglshaschildren{##1}%
    {%
       \glsresetsubentrycounter
       \glsinlineparentchildseparator
       \def\gls@inlinesubsep{}%
       \def\gls@inlinepostchild{\glsinlinepostchild}%
    }%
    {}%
    \def\gls@inlinesep{\glsinlineseparator}%
  }%
%    \end{macrocode}
% Sub-entries display description:
%    \begin{macrocode}
  \renewcommand{\subglossentry}[3]{%
    \gls@inlinesubsep%
    \glsinlinesubnameformat{##2}{%
       \glossentryname{##2}}%
    \glssubentryitem{##2}%
    \glsinlinesubdescformat{\glossentrydesc{##2}}{\glossentrysymbol{##2}}{##3}%
    \def\gls@inlinesubsep{\glsinlinesubseparator}%
  }%
%    \end{macrocode}
% Nothing special between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{macro}{\glsinlinedopostchild}
%    \begin{macrocode}
\newcommand*{\glsinlinedopostchild}{%
    \gls@inlinepostchild
    \def\gls@inlinepostchild{}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsinlineseparator}
% Separator to use between entries.
%    \begin{macrocode}
\newcommand*{\glsinlineseparator}{;\space}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsinlinesubseparator}
% Separator to use between sub-entries.
%    \begin{macrocode}
\newcommand*{\glsinlinesubseparator}{,\space}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsinlineparentchildseparator}
% Separator to use between parent and children.
%    \begin{macrocode}
\newcommand*{\glsinlineparentchildseparator}{:\space}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsinlinepostchild}
%\changes{3.03}{2012/09/21}{new}
% Hook to use between child and next entry
%    \begin{macrocode}
\newcommand*{\glsinlinepostchild}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glspostinline}
% Terminator for inline glossary.
%\changes{3.03}{2012/09/21}{replaced ``.'' with \cs{glspostdescription}}
%    \begin{macrocode}
\newcommand*{\glspostinline}{\glspostdescription\space}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsinlinenameformat}
%\changes{3.03}{2012/09/21}{new}
% Formats the name of the entry (first argument label, second
% argument name):
%    \begin{macrocode}
\newcommand*{\glsinlinenameformat}[2]{\glstarget{#1}{#2}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsinlinedescformat}
%\changes{3.03}{2012/09/21}{new}
% Formats the entry's description, symbol and location list:
%    \begin{macrocode}
\newcommand*{\glsinlinedescformat}[3]{\space#1}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsinlineemptydescformat}
%\changes{3.03}{2012/09/21}{new}
% Formats the entry's symbol and location list when the description
% is empty:
%    \begin{macrocode}
\newcommand*{\glsinlineemptydescformat}[2]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsinlinesubnameformat}
%\changes{3.03}{2012/09/21}{new}
% Formats the name of the subentry (first argument label, second
% argument name):
%    \begin{macrocode}
\newcommand*{\glsinlinesubnameformat}[2]{\glstarget{#1}{}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsinlinesubdescformat}
%\changes{3.03}{2012/09/21}{new}
% Formats the subentry's description, symbol and location list:
%    \begin{macrocode}
\newcommand*{\glsinlinesubdescformat}[3]{#1}
%    \end{macrocode}
%\end{macro}
%
%
%\iffalse
%    \begin{macrocode}
%</glossary-inline.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossary-list-2020-03-19.sty>
%    \end{macrocode}
%\fi
% \section{Rollback v4.46 (glossary-list-2020-03-19.sty)}
% Version 4.46 preserved for rollback.
%    \begin{macrocode}
\ProvidesPackage{glossary-list}[2020/03/19 v4.46 (NLCT)]
\providecommand{\indexspace}{%
  \par \vskip 10\p@ \@plus 5\p@ \@minus 3\p@ \relax
}
\newcommand*{\glslistgroupheaderfmt}[1]{#1}
\newcommand*{\glslistnavigationitem}[1]{\item[#1]}
\newglossarystyle{list}{%
  \renewenvironment{theglossary}%
    {\begin{description}}{\end{description}}%
  \renewcommand*{\glossaryheader}{}%
  \renewcommand*{\glsgroupheading}[1]{}%
  \renewcommand*{\glossentry}[2]{%
    \item[\glsentryitem{##1}%
          \glstarget{##1}{\glossentryname{##1}}]
       \glossentrydesc{##1}\glspostdescription\space ##2}%
  \renewcommand*{\subglossentry}[3]{%
    \glssubentryitem{##2}%
    \glstarget{##2}{\strut}\space
    \glossentrydesc{##2}\glspostdescription\space ##3.}%
  \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}%
}
\newglossarystyle{listgroup}{%
  \setglossarystyle{list}%
  \renewcommand*{\glsgroupheading}[1]{%
    \item[\glslistgroupheaderfmt{\glsgetgrouptitle{##1}}]}}
\newglossarystyle{listhypergroup}{%
  \setglossarystyle{list}%
  \renewcommand*{\glossaryheader}{%
    \glslistnavigationitem{\glsnavigation}}%
  \renewcommand*{\glsgroupheading}[1]{%
    \item[\glslistgroupheaderfmt
          {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}]}}
\newglossarystyle{altlist}{%
  \setglossarystyle{list}%
  \renewcommand*{\glossentry}[2]{%
    \item[\glsentryitem{##1}%
      \glstarget{##1}{\glossentryname{##1}}]%
      \mbox{}\par\nobreak\@afterheading
      \glossentrydesc{##1}\glspostdescription\space ##2}%
  \renewcommand{\subglossentry}[3]{%
    \par
    \glssubentryitem{##2}%
    \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription\space ##3}%
}
\newglossarystyle{altlistgroup}{%
  \setglossarystyle{altlist}%
  \renewcommand*{\glsgroupheading}[1]{%
    \item[\glslistgroupheaderfmt{\glsgetgrouptitle{##1}}]}}
\newglossarystyle{altlisthypergroup}{%
  \setglossarystyle{altlist}%
  \renewcommand*{\glossaryheader}{%
    \glslistnavigationitem{\glsnavigation}}%
  \renewcommand*{\glsgroupheading}[1]{%
    \item[\glslistgroupheaderfmt
      {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}]}}
\newglossarystyle{listdotted}{%
  \setglossarystyle{list}%
  \renewcommand*{\glossentry}[2]{%
    \item[]\makebox[\glslistdottedwidth][l]{%
      \glsentryitem{##1}%
      \glstarget{##1}{\glossentryname{##1}}%
      \unskip\leaders\hbox to 2.9mm{\hss.}\hfill\strut}\glossentrydesc{##1}}%
  \renewcommand*{\subglossentry}[3]{%
    \item[]\makebox[\glslistdottedwidth][l]{%
    \glssubentryitem{##2}%
    \glstarget{##2}{\glossentryname{##2}}%
    \unskip\leaders\hbox to 2.9mm{\hss.}\hfill\strut}\glossentrydesc{##2}}%
}
\newlength\glslistdottedwidth
\setlength{\glslistdottedwidth}{.5\hsize}
\newglossarystyle{sublistdotted}{%
  \setglossarystyle{listdotted}%
  \renewcommand*{\glossentry}[2]{%
    \item[\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}}]}%
}
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossary-list-2020-03-19.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossary-list.sty>
%    \end{macrocode}
%\fi
% \section{List Style (glossary-list.sty)}
% The \isty{glossary-list} style file defines glossary styles
% that use the \env{description} environment. Note that since
% the entry name is placed in the optional argument to the
% \ics{item} command, it will appear in a bold font by
% default.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
%    \end{macrocode}
% Rollback releases:
%    \begin{macrocode}
\DeclareRelease{v4.46}{2020-03-19}{glossary-list-2020-03-19.sty}
\DeclareCurrentRelease{v4.49}{2021-11-01}
%    \end{macrocode}
%Declare package:
%    \begin{macrocode}
\ProvidesPackage{glossary-list}[2021/11/01 v4.49 (NLCT)]
%    \end{macrocode}
%\begin{macro}{\indexspace}
%\changes{4.13}{2015-02-03}{new}
% There are a few classes that don't define \cs{indexspace}, so
% provide a definition if it hasn't been defined.
%    \begin{macrocode}
\providecommand{\indexspace}{%
  \par \vskip 10\p@ \@plus 5\p@ \@minus 3\p@ \relax
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glslistgroupheaderfmt}
%\changes{4.22}{2016-04-19}{new}
% Provide a way of adjusting the format of the group headings.
%    \begin{macrocode}
\newcommand*{\glslistgroupheaderfmt}[1]{#1}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glslistnavigationitem}
%\changes{4.22}{2016-04-19}{new}
% Provide a way of adjusting the format of the navigation header.
% This puts the navigation line inside the optional argument
% of item to prevent unwanted space occurring at the start, but
% this can cause a problem if the navigation line is too long.
% With this command, it makes it easier for the user to customise
% the style without having to remember to modify \cs{glossaryheader}
% after the style has been set.
%    \begin{macrocode}
\newcommand*{\glslistnavigationitem}[1]{\item[#1]}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glslistinit}
%\changes{4.48}{2021-10-19}{new}
%\changes{4.49}{2021-11-01}{added \cs{glsnavigation}}
%Provide a way to ensure appropriate expansion of the name if
%\pkgopt{entrycounter} is used with \sty{gettitlestring}:
%    \begin{macrocode}
\newcommand{\glslistinit}{%
  \ifdef\GetTitleStringDisableCommands
  {%
    \GetTitleStringSetup{expand}%
    \GetTitleStringDisableCommands{%
      \let\glsentryitem\@gobble
      \let\glstarget\@secondoftwo
      \let\glossentryname\glslistexpandedname
      \let\glslistgroupheaderfmt\@firstofone
      \let\glsgetgrouptitle\@firstofone
      \let\glsnavhypertarget\@secondoftwo
      \let\glsnavigation\relax
    }%
  }%
  {}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glslistexpandedname}
%\changes{4.48}{2021-10-19}{new}
%    \begin{macrocode}
\newcommand{\glslistexpandedname}[1]{%
 \glsunexpandedfieldvalue{#1}{name}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{style}{list}
% The \glostyle{list} glossary style 
% uses the \env{description} environment. The group separator
% \ics{glsgroupskip} is redefined as \cs{indexspace}
% which produces a gap between groups. The glossary heading
% and the group headings do nothing. Sub-entries immediately
% follow the main entry without the sub-entry name. This style
% does not use the entry's symbol. This is used as the default
% style for the \sty{glossaries} package.
%    \begin{macrocode}
\newglossarystyle{list}{%
%    \end{macrocode}
% Use \env{description} environment:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\glslistinit\begin{description}}{\end{description}}%
%    \end{macrocode}
% No header at the start of the environment:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries start a new item in the list:
%\changes{3.08a}{2013-08-30}{updated list style to use
%\cs{glossentry} and \cs{subglossentry}}
%    \begin{macrocode}
  \renewcommand*{\glossentry}[2]{%
    \item[\glsentryitem{##1}%
          \glstarget{##1}{\glossentryname{##1}}] 
       \glossentrydesc{##1}\glspostdescription\space ##2}%
%    \end{macrocode}
% Sub-entries continue on the same line:
%\changes{4.22}{2016-04-19}{fixed missing space before description}
%    \begin{macrocode}
  \renewcommand*{\subglossentry}[3]{%
    \glssubentryitem{##2}%
    \glstarget{##2}{\strut}\space
    \glossentrydesc{##2}\glspostdescription\space ##3.}%
%    \end{macrocode}
% Add vertical space between groups:
%\changes{3.03}{2012/09/21}{added check for glsnogroupskip}
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{listgroup}
% The \glostyle{listgroup} style is like the \glostyle{list}
% style, but the glossary groups have headings.
%\changes{1.08}{2007-10-13}{changed listgroup style to use \cs{glsgetgrouptitle}}
%    \begin{macrocode}
\newglossarystyle{listgroup}{%
%    \end{macrocode}
% Base it on the \glostyle{list} style:
%    \begin{macrocode}
  \setglossarystyle{list}%
%    \end{macrocode}
% Each group has a heading:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \item[\glslistgroupheaderfmt{\glsgetgrouptitle{##1}}]}}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{listhypergroup}
% The \glostyle{listhypergroup} style is like the \glostyle{listgroup}
% style, but has a set of links to the groups at the
% start of the glossary.
%    \begin{macrocode}
\newglossarystyle{listhypergroup}{%
%    \end{macrocode}
% Base it on the \glostyle{list} style:
%    \begin{macrocode}
  \setglossarystyle{list}%
%    \end{macrocode}
% Add navigation links at the start of the environment.
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \glslistnavigationitem{\glsnavigation}}%
%    \end{macrocode}
% Each group has a heading with a hypertarget:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \item[\glslistgroupheaderfmt
          {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}]}}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlist}
% The \glostyle{altlist} glossary style is like the \glostyle{list}
% style, but places the description on a new line. Sub-entries
% follow in separate paragraphs without the sub-entry name. This
% style does not use the entry's symbol.
%    \begin{macrocode}
\newglossarystyle{altlist}{%
%    \end{macrocode}
% Base it on the \glostyle{list} style:
%    \begin{macrocode}
  \setglossarystyle{list}%
%    \end{macrocode}
% Main (level 0) entries start a new item in the list with a
% line break after the entry name:
%\changes{3.08a}{2013-08-30}{updated altlist style to use
%\cs{glossentry} and \cs{subglossentry}}
%    \begin{macrocode}
  \renewcommand*{\glossentry}[2]{%
    \item[\glsentryitem{##1}%
      \glstarget{##1}{\glossentryname{##1}}]%
%    \end{macrocode}
%\changes{3.04}{2012-11-11}{replaced \cs{newline} with paragraph break}
% Version 3.04 changed \cs{newline} to the following paragraph break
% stuff (thanks to Daniel Gebhardt for supplying the fix) to prevent
% a page break occurring at this point.
%    \begin{macrocode}
      \mbox{}\par\nobreak\@afterheading
      \glossentrydesc{##1}\glspostdescription\space ##2}%
%    \end{macrocode}
% Sub-entries start a new paragraph:
%    \begin{macrocode}
  \renewcommand{\subglossentry}[3]{%
    \par
    \glssubentryitem{##2}%
    \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription\space ##3}%
}
%    \end{macrocode}
%\end{style}
%\begin{style}{altlistgroup}
% The \glostyle{altlistgroup} glossary style is like the
% \glostyle{altlist} style, but the glossary groups have headings.
%\changes{1.08}{2007-10-13}{changed altlistgroup style to use \cs{glsgetgrouptitle}}
%    \begin{macrocode}
\newglossarystyle{altlistgroup}{%
%    \end{macrocode}
% Base it on the \glostyle{altlist} style:
%    \begin{macrocode}
  \setglossarystyle{altlist}%
%    \end{macrocode}
% Each group has a heading:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \item[\glslistgroupheaderfmt{\glsgetgrouptitle{##1}}]}}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlisthypergroup}
% The \glostyle{altlisthypergroup} glossary style is like the
% \glostyle{altlistgroup} style, but has a 
% set of links to the groups at the start of the glossary.
%    \begin{macrocode}
\newglossarystyle{altlisthypergroup}{%
%    \end{macrocode}
% Base it on the \glostyle{altlist} style:
%    \begin{macrocode}
  \setglossarystyle{altlist}%
%    \end{macrocode}
% Add navigation links at the start of the environment.
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \glslistnavigationitem{\glsnavigation}}%
%    \end{macrocode}
% Each group has a heading with a hypertarget:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \item[\glslistgroupheaderfmt
      {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}]}}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{listdotted}
% The \glostyle{listdotted} glossary style was supplied by 
% Axel~Menzel. I've modified it slightly so that the distance from
% the start of the name to the end of the dotted line is specified 
% by \cs{glslistdottedwidth}.
% Note that this style ignores the page numbers as well as the
% symbol. Sub-entries are displayed in the same way as top-level
% entries.
%    \begin{macrocode}
\newglossarystyle{listdotted}{%
%    \end{macrocode}
% Base it on the \glostyle{list} style:
%    \begin{macrocode}
  \setglossarystyle{list}%
%    \end{macrocode}
% Each main (level 0) entry starts a new item:
%\changes{3.08a}{2013-08-30}{updated listdotted style to use
%\cs{glossentry} and \cs{subglossentry}}
%    \begin{macrocode}
  \renewcommand*{\glossentry}[2]{%
    \item[]\makebox[\glslistdottedwidth][l]{%
      \glsentryitem{##1}%
      \glstarget{##1}{\glossentryname{##1}}%
      \unskip\leaders\hbox to 2.9mm{\hss.}\hfill\strut}\glossentrydesc{##1}}%
%    \end{macrocode}
% Sub entries have the same format as main entries:
%    \begin{macrocode}
  \renewcommand*{\subglossentry}[3]{%
    \item[]\makebox[\glslistdottedwidth][l]{%
    \glssubentryitem{##2}%
    \glstarget{##2}{\glossentryname{##2}}%
    \unskip\leaders\hbox to 2.9mm{\hss.}\hfill\strut}\glossentrydesc{##2}}%
}
%    \end{macrocode}
%\end{style}
%\begin{macro}{\glslistdottedwidth}
%\changes{2.01}{2009 May 30}{changed \cs{linewidth} to \cs{hsize}}
%    \begin{macrocode}
\newlength\glslistdottedwidth
\setlength{\glslistdottedwidth}{.5\hsize}
%    \end{macrocode}
%\end{macro}
%
%\begin{style}{sublistdotted}
% This style is similar to the glostyle{listdotted} style, except
% that the main entries just have the name displayed.
%    \begin{macrocode}
\newglossarystyle{sublistdotted}{%
%    \end{macrocode}
% Base it on the \glostyle{listdotted} style:
%    \begin{macrocode}
  \setglossarystyle{listdotted}%
%    \end{macrocode}
% Main (level 0) entries just display the name:
%    \begin{macrocode}
  \renewcommand*{\glossentry}[2]{%
    \item[\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}}]}%
}
%    \end{macrocode}
%\end{style}
%\iffalse
%    \begin{macrocode}
%</glossary-list.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossary-long.sty>
%    \end{macrocode}
%\fi
% \section{Glossary Styles using longtable (the glossary-long
% package)}
% The glossary styles defined in the \isty{glossary-long} package
% used the \env{longtable} environment in the glossary.
%    \begin{macrocode}
\ProvidesPackage{glossary-long}[2021/11/01 v4.49 (NLCT)]
%    \end{macrocode}
% Requires the \isty{longtable} package:
%    \begin{macrocode}
\RequirePackage{longtable}
%    \end{macrocode}
%\begin{macro}{\glsdescwidth}
% This is a length that governs the width of the description column.
% (There's a chance that the user may specify \pkgopt{nolong}
% and then load \isty{glossary-long} later, in which case 
% \cs{glsdescwidth} may have already been defined by
% \isty{glossary-super}. The same goes for \cs{glspagelistwidth}.)
%\changes{2.01}{2009 May 30}{changed \cs{linewidth} to \cs{hsize}}
%    \begin{macrocode}
\@ifundefined{glsdescwidth}{%
  \newlength\glsdescwidth
  \setlength{\glsdescwidth}{0.6\hsize}
}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glspagelistwidth}
% This is a length that governs the width of the page list column.
%\changes{2.01}{2009 May 30}{changed \cs{linewidth} to \cs{hsize}}
%    \begin{macrocode}
\@ifundefined{glspagelistwidth}{%
  \newlength\glspagelistwidth
  \setlength{\glspagelistwidth}{0.1\hsize}
}{}
%    \end{macrocode}
%\end{macro}
% 
%\begin{style}{long}
% The \glostyle{long} glossary style command which 
% uses the \env{longtable} environment:
%    \begin{macrocode}
\newglossarystyle{long}{%
%    \end{macrocode}
% Use \env{longtable} with two columns:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
     {\begin{longtable}{lp{\glsdescwidth}}}%
     {\end{longtable}}%
%    \end{macrocode}
% Do nothing at the start of the environment:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No heading between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries displayed in a row:
%\changes{3.08a}{2013-09-28}{updated to use \cs{glossentry} and
%\cs{subglossentry}}
%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}}
%    \begin{macrocode}
  \renewcommand{\glossentry}[2]{%
    \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
    \glossentrydesc{##1}\glspostdescription\space ##2\tabularnewline
  }%
%    \end{macrocode}
% Sub entries displayed on the following row without the name:
%\changes{4.22}{2016-04-19}{fixed typo in \cs{glossentrydesc}}
%    \begin{macrocode}
  \renewcommand{\subglossentry}[3]{%
     &
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription\space
     ##3\tabularnewline
  }%
%    \end{macrocode}
% Blank row between groups:
%\changes{3.03}{2012/09/21}{added check for glsnogroupskip}
%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}}
%\changes{4.23}{2016-04-30}{check for nogroupskip changed}
%The check for \pkgopt{nogroupskip} must occur outside
%\cs{glsgroupskip}
%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108})
%    \begin{macrocode}
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{ & \tabularnewline}%
  \fi
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longborder}
% The \glostyle{longborder} style is like the above, but with horizontal and
% vertical lines:
%    \begin{macrocode}
\newglossarystyle{longborder}{%
%    \end{macrocode}
% Base it on the glostyle{long} style:
%    \begin{macrocode}
  \setglossarystyle{long}%
%    \end{macrocode}
% Use \env{longtable} with two columns with vertical lines
% between each column:
%    \begin{macrocode}
  \renewenvironment{theglossary}{%
    \begin{longtable}{|l|p{\glsdescwidth}|}}{\end{longtable}}%
%    \end{macrocode}
% Place horizontal lines at the head and foot of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{\hline\endhead\hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longheader}
% The \glostyle{longheader} style is like the
% \glostyle{long} style but with a header:
%    \begin{macrocode}
\newglossarystyle{longheader}{%
%    \end{macrocode}
% Base it on the glostyle{long} style:
%    \begin{macrocode}
  \setglossarystyle{long}%
%    \end{macrocode}
% Set the table's header:
%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}}
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \bfseries \entryname & \bfseries \descriptionname\tabularnewline\endhead}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longheaderborder}
% The \glostyle{longheaderborder} style is
% like the \glostyle{long} style but with a header and border:
%    \begin{macrocode}
\newglossarystyle{longheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{longborder} style:
%    \begin{macrocode}
  \setglossarystyle{longborder}%
%    \end{macrocode}
% Set the table's header and add horizontal line to table's foot:
%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}}
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \hline\bfseries \entryname & \bfseries
    \descriptionname\tabularnewline\hline
    \endhead
    \hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{long3col}
% The \glostyle{long3col} style is like \glostyle{long} but with 3 columns
%    \begin{macrocode}
\newglossarystyle{long3col}{%
%    \end{macrocode}
% Use a \env{longtable} with 3 columns:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{lp{\glsdescwidth}p{\glspagelistwidth}}}%
    {\end{longtable}}%
%    \end{macrocode}
% No table header:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No headings between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries on a row (name in first column, 
% description in second column, page list in last column):
%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}}
%    \begin{macrocode}
  \renewcommand{\glossentry}[2]{%
    \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
    \glossentrydesc{##1} & ##2\tabularnewline
  }%
%    \end{macrocode}
% Sub-entries on a separate row (no name, description in
% second column, page list in third column):
%    \begin{macrocode}
  \renewcommand{\subglossentry}[3]{%
     & 
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}\glossentrydesc{##2} &
     ##3\tabularnewline
  }%
%    \end{macrocode}
% Blank row between groups:
%\changes{3.03}{2012/09/21}{added check for glsnogroupskip}
%\changes{4.23}{2016-04-30}{check for nogroupskip changed}
%The check for \pkgopt{nogroupskip} must occur outside
%\cs{glsgroupskip}
%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108})
%    \begin{macrocode}
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{ & & \tabularnewline}%
  \fi
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{long3colborder}
% The \glostyle{long3colborder} style is like the
% \glostyle{long3col} style but with a border:
%    \begin{macrocode}
\newglossarystyle{long3colborder}{%
%    \end{macrocode}
% Base it on the glostyle{long3col} style:
%    \begin{macrocode}
  \setglossarystyle{long3col}%
%    \end{macrocode}
% Use a \env{longtable} with 3 columns with vertical lines
% around them:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{|l|p{\glsdescwidth}|p{\glspagelistwidth}|}}%
    {\end{longtable}}%
%    \end{macrocode}
% Place horizontal lines at the head and foot of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{\hline\endhead\hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{long3colheader}
% The \glostyle{long3colheader} style is like \glostyle{long3col} but with a header row:
%    \begin{macrocode}
\newglossarystyle{long3colheader}{%
%    \end{macrocode}
% Base it on the glostyle{long3col} style:
%    \begin{macrocode}
  \setglossarystyle{long3col}%
%    \end{macrocode}
% Set the table's header:
%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}}
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \bfseries\entryname&\bfseries\descriptionname&
    \bfseries\pagelistname\tabularnewline\endhead}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{long3colheaderborder}
% The \glostyle{long3colheaderborder} style is like the above but with a border
%    \begin{macrocode}
\newglossarystyle{long3colheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{long3colborder} style:
%    \begin{macrocode}
  \setglossarystyle{long3colborder}%
%    \end{macrocode}
% Set the table's header and add horizontal line at table's foot:
%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}}
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \hline
    \bfseries\entryname&\bfseries\descriptionname&
    \bfseries\pagelistname\tabularnewline\hline\endhead
    \hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{long4col}
% The \glostyle{long4col} style has four columns where the third 
% column contains the value of the associated \gloskey{symbol} key.
%    \begin{macrocode}
\newglossarystyle{long4col}{%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{llll}}%
    {\end{longtable}}%
%    \end{macrocode}
% No table header:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries on a single row (name in first column,
% description in second column, symbol in third column, page list
% in last column):
%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}}
%    \begin{macrocode}
  \renewcommand{\glossentry}[2]{%
    \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
    \glossentrydesc{##1} &
    \glossentrysymbol{##1} &
    ##2\tabularnewline
  }%
%    \end{macrocode}
% Sub entries on a single row with no name (description in second
% column, symbol in third column, page list in last column):
%    \begin{macrocode}
  \renewcommand{\subglossentry}[3]{%
     & 
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}\glossentrydesc{##2} &
     \glossentrysymbol{##2} & ##3\tabularnewline
  }%
%    \end{macrocode}
% Blank row between groups:
%\changes{3.03}{2012/09/21}{added check for glsnogroupskip}
%\changes{4.23}{2016-04-30}{check for nogroupskip changed}
%The check for \pkgopt{nogroupskip} must occur outside
%\cs{glsgroupskip}
%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108})
%    \begin{macrocode}
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{ & & & \tabularnewline}%
  \fi
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{long4colheader}
% The \glostyle{long4colheader} style is like \glostyle{long4col} 
% but with a header row.
%    \begin{macrocode}
\newglossarystyle{long4colheader}{%
%    \end{macrocode}
% Base it on the glostyle{long4col} style:
%    \begin{macrocode}
  \setglossarystyle{long4col}%
%    \end{macrocode}
% Table has a header:
%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}}
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \bfseries\entryname&\bfseries\descriptionname&
    \bfseries \symbolname&
    \bfseries\pagelistname\tabularnewline\endhead}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{long4colborder}
% The \glostyle{long4colborder} style is like \glostyle{long4col} 
% but with a border.
%    \begin{macrocode}
\newglossarystyle{long4colborder}{%
%    \end{macrocode}
% Base it on the glostyle{long4col} style:
%    \begin{macrocode}
  \setglossarystyle{long4col}%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns surrounded by vertical
% lines:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{|l|l|l|l|}}%
    {\end{longtable}}%
%    \end{macrocode}
% Add horizontal lines to the head and foot of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{\hline\endhead\hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{long4colheaderborder}
% The \glostyle{long4colheaderborder} style is like the above but 
% with a border.
%    \begin{macrocode}
\newglossarystyle{long4colheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{long4col} style:
%    \begin{macrocode}
  \setglossarystyle{long4col}%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns surrounded by vertical
% lines:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{|l|l|l|l|}}%
    {\end{longtable}}%
%    \end{macrocode}
% Add table header and horizontal line at the table's foot:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \hline\bfseries\entryname&\bfseries\descriptionname&
    \bfseries \symbolname&
    \bfseries\pagelistname\tabularnewline\hline\endhead
    \hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlong4col}
% The \glostyle{altlong4col} style is like the \glostyle{long4col}
% style but can have multiline descriptions and page lists.
%    \begin{macrocode}
\newglossarystyle{altlong4col}{%
%    \end{macrocode}
% Base it on the glostyle{long4col} style:
%    \begin{macrocode}
   \setglossarystyle{long4col}%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns where the second and
% last columns may have multiple lines in each row:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{lp{\glsdescwidth}lp{\glspagelistwidth}}}%
    {\end{longtable}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlong4colheader}
% The \glostyle{altlong4colheader} style is like 
% \glostyle{altlong4col} but with a header row.
%    \begin{macrocode}
\newglossarystyle{altlong4colheader}{%
%    \end{macrocode}
% Base it on the glostyle{long4colheader} style:
%    \begin{macrocode}
  \setglossarystyle{long4colheader}%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns where the second and
% last columns may have multiple lines in each row:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{lp{\glsdescwidth}lp{\glspagelistwidth}}}%
    {\end{longtable}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlong4colborder}
% The \glostyle{altlong4colborder} style is like
% \glostyle{altlong4col} but with a border.
%    \begin{macrocode}
\newglossarystyle{altlong4colborder}{%
%    \end{macrocode}
% Base it on the glostyle{long4colborder} style:
%    \begin{macrocode}
   \setglossarystyle{long4colborder}%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns where the second and
% last columns may have multiple lines in each row:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{|l|p{\glsdescwidth}|l|p{\glspagelistwidth}|}}%
    {\end{longtable}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlong4colheaderborder}
% The \glostyle{altlong4colheaderborder} style is like the above but
% with a header as well as a border.
%    \begin{macrocode}
\newglossarystyle{altlong4colheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{long4colheaderborder} style:
%    \begin{macrocode}
  \setglossarystyle{long4colheaderborder}%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns where the second and
% last columns may have multiple lines in each row:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{|l|p{\glsdescwidth}|l|p{\glspagelistwidth}|}}%
    {\end{longtable}}%
}
%    \end{macrocode}
%\end{style}
%\iffalse
%    \begin{macrocode}
%</glossary-long.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossary-longbooktabs.sty>
%    \end{macrocode}
%\fi
%\section{Glossary Styles using longtable and booktabs (the
%glossary-longbooktabs) package}
% The styles here are based on David Carlisle's patch at
% \url{http://tex.stackexchange.com/a/56890}
%
%    \begin{macrocode}
\ProvidesPackage{glossary-longbooktabs}[2021/11/01 v4.49 (NLCT)]
%    \end{macrocode}
% Requires \sty{booktabs} package:
%    \begin{macrocode}
\RequirePackage{booktabs}
%    \end{macrocode}
% and the base packages for long styles:
%    \begin{macrocode}
\RequirePackage{glossary-long}
\RequirePackage{glossary-longragged}
%    \end{macrocode}
%(\sty{longtable} and \sty{array} loaded by those packages).
%
%\begin{style}{long-booktabs}
%\changes{4.21}{2016-01-24}{new}
% The \glostyle{long-booktabs} style is similar to the
% \glostyle{longheader}
% style but uses the \sty{booktabs} rules and patches
% \env{longtable} to check for group skip occurring at a page break.
%    \begin{macrocode}
\newglossarystyle{long-booktabs}{%
%    \end{macrocode}
% If the style change is scoped, the patch will only have a local
% effect, which may be useful if it conflicts with other tables in
% the document.
%    \begin{macrocode}
  \glspatchLToutput
%    \end{macrocode}
% As with the \glostyle{longheader} style, use the
% \glostyle{long} style as a base.
%    \begin{macrocode}
  \setglossarystyle{long}%
%    \end{macrocode}
% Add a header with rules.
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \toprule \bfseries \entryname & \bfseries
   \descriptionname\tabularnewline\midrule\endhead
    \bottomrule\endfoot}%
%    \end{macrocode}
% Check for the \pkgopt{nogroupskip} package option. If there should
% be a gap between groups, insert the penalty and the vertical
% space.
%\changes{4.23}{2016-04-30}{check for nogroupskip changed}
%The check for \pkgopt{nogroupskip} should occur outside
%\cs{glsgroupskip} to be on the safe side.
%    \begin{macrocode}
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}%
  \fi
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{long3col-booktabs}
%\changes{4.21}{2016-01-24}{new}
% The \glostyle{long3col-booktabs} style is similar to the
% \glostyle{long3colheader}
% style but uses the \sty{booktabs} rules and patches
% \env{longtable} to check for group skip occurring at a page break.
%    \begin{macrocode}
\newglossarystyle{long3col-booktabs}{%
%    \end{macrocode}
% If the style change is scoped, the patch will only have a local
% effect, which may be useful if it conflicts with other tables in
% the document.
%    \begin{macrocode}
  \glspatchLToutput
%    \end{macrocode}
% Use the \glostyle{long3col} style as a base.
%    \begin{macrocode}
  \setglossarystyle{long3col}%
%    \end{macrocode}
% Add a header with rules.
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \toprule \bfseries \entryname &
    \bfseries \descriptionname &
    \bfseries \pagelistname
    \tabularnewline\midrule\endhead
    \bottomrule\endfoot}%
%    \end{macrocode}
% Check for the \pkgopt{nogroupskip} package option. If there should
% be a gap between groups, insert the penalty and the vertical
% space.
%\changes{4.23}{2016-04-30}{check for nogroupskip changed}
%The check for \pkgopt{nogroupskip} should occur outside
%\cs{glsgroupskip} to be on the safe side.
%    \begin{macrocode}
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}%
  \fi
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{long4col-booktabs}
%\changes{4.21}{2016-01-24}{new}
% The \glostyle{long4col-booktabs} style is similar to the
% \glostyle{long4colheader}
% style but uses the \sty{booktabs} rules and patches
% \env{longtable} to check for group skip occurring at a page break.
%    \begin{macrocode}
\newglossarystyle{long4col-booktabs}{%
%    \end{macrocode}
% If the style change is scoped, the patch will only have a local
% effect, which may be useful if it conflicts with other tables in
% the document.
%    \begin{macrocode}
  \glspatchLToutput
%    \end{macrocode}
% Use the \glostyle{long4col} style as a base.
%    \begin{macrocode}
  \setglossarystyle{long4col}%
%    \end{macrocode}
% Add a header with rules.
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \toprule \bfseries \entryname &
    \bfseries \descriptionname &
    \bfseries \symbolname &
    \bfseries \pagelistname
    \tabularnewline\midrule\endhead
    \bottomrule\endfoot}%
%    \end{macrocode}
% Check for the \pkgopt{nogroupskip} package option. If there should
% be a gap between groups, insert the penalty and the vertical
% space.
%\changes{4.23}{2016-04-30}{check for nogroupskip changed}
%The check for \pkgopt{nogroupskip} should occur outside
%\cs{glsgroupskip} to be on the safe side.
%    \begin{macrocode}
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}%
  \fi
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlong4col-booktabs}
%\changes{4.21}{2016-01-24}{new}
% The \glostyle{altlong4col-booktabs} style is similar to the
% \glostyle{altlong4colheader}
% style but uses the \sty{booktabs} rules and patches
% \env{longtable} to check for group skip occurring at a page break.
%    \begin{macrocode}
\newglossarystyle{altlong4col-booktabs}{%
%    \end{macrocode}
%The patch \cs{glspatchLToutput} is already applied in
%\glostyle{long4col-booktabs} and so doesn't need to be here.
%\changes{4.42}{??}{removed superfluous \cs{glspatchLToutput}}
%    \begin{macrocode}
  \glspatchLToutput
%    \end{macrocode}
% Use the
% \glostyle{long4col-booktabs} style as a base.
%    \begin{macrocode}
  \setglossarystyle{long4col-booktabs}%
%    \end{macrocode}
% Change the column specifications:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{lp{\glsdescwidth}lp{\glspagelistwidth}}}%
    {\end{longtable}}%
}
%    \end{macrocode}
%\end{style}
%
% Ragged styles.
%\begin{style}{longragged-booktabs}
%\changes{4.21}{2016-01-24}{new}
% The \glostyle{longragged-booktabs} style is similar to the
% \glostyle{longragged}
% style but uses the \sty{booktabs} rules and patches
% \env{longtable} to check for group skip occurring at a page break.
%    \begin{macrocode}
\newglossarystyle{longragged-booktabs}{%
%    \end{macrocode}
% If the style change is scoped, the patch will only have a local
% effect, which may be useful if it conflicts with other tables in
% the document.
%    \begin{macrocode}
  \glspatchLToutput
%    \end{macrocode}
% Use the \glostyle{long-booktabs} style as a base.
%    \begin{macrocode}
  \setglossarystyle{long-booktabs}%
%    \end{macrocode}
% Adjust the column specification.
%    \begin{macrocode}
  \renewenvironment{theglossary}%
     {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}}}%
     {\end{longtable}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longragged3col-booktabs}
%\changes{4.21}{2016-01-24}{new}
% The \glostyle{longragged3col-booktabs} style is similar to the
% \glostyle{longragged3col}
% style but uses the \sty{booktabs} rules and patches
% \env{longtable} to check for group skip occurring at a page break.
%    \begin{macrocode}
\newglossarystyle{longragged3col-booktabs}{%
%    \end{macrocode}
% If the style change is scoped, the patch will only have a local
% effect, which may be useful if it conflicts with other tables in
% the document.
%    \begin{macrocode}
  \glspatchLToutput
%    \end{macrocode}
% Use the \glostyle{long3col-booktabs} style as a base.
%    \begin{macrocode}
  \setglossarystyle{long3col-booktabs}%
%    \end{macrocode}
% Adjust the column specification.
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}%
       >{\raggedright}p{\glspagelistwidth}}}%
    {\end{longtable}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlongragged4col-booktabs}
%\changes{4.21}{2016-01-24}{new}
% The \glostyle{altlongragged4col-booktabs} style is similar to the
% \glostyle{altlongragged4col}
% style but uses the \sty{booktabs} rules and patches
% \env{longtable} to check for group skip occurring at a page break.
%    \begin{macrocode}
\newglossarystyle{altlongragged4col-booktabs}{%
%    \end{macrocode}
% If the style change is scoped, the patch will only have a local
% effect, which may be useful if it conflicts with other tables in
% the document.
%    \begin{macrocode}
  \glspatchLToutput
%    \end{macrocode}
% Use the \glostyle{altlong4col-booktabs} style as a base.
%    \begin{macrocode}
  \setglossarystyle{altlong4col-booktabs}%
%    \end{macrocode}
% Adjust the column specification.
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}l%
       >{\raggedright}p{\glspagelistwidth}}}%
    {\end{longtable}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{macro}{\glsLTpenaltycheck}
%\changes{4.21}{2016-01-24}{new}
%    \begin{macrocode}
\newcommand*{\glsLTpenaltycheck}{%
 \ifnum\outputpenalty=-50\vskip-\normalbaselineskip\relax\fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glspenaltygroupskip}
%\changes{4.21}{2016-01-24}{new}
%    \begin{macrocode}
\newcommand{\glspenaltygroupskip}{%
  \noalign{\penalty-50\vskip\normalbaselineskip}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsrestoreLToutput}
% Provide a way of restoring \cs{LT@output} for the user.
%    \begin{macrocode}
\let\@gls@org@LT@output\LT@output
\newcommand*{\glsrestoreLToutput}{\let\LT@output\@gls@org@LT@output}
%    \end{macrocode}
%\end{macro}
%
% This is David's patch, but I've replaced the hard-coded values
% with \cs{glsLTpenaltycheck} to make it easier to adjust.
%\begin{macro}{\glspatchLToutput}
%\changes{4.21}{2016-01-24}{new}
%    \begin{macrocode}
\newcommand*{\glspatchLToutput}{%
 \renewcommand*{\LT@output}{%
   \ifnum\outputpenalty <-\@Mi
     \ifnum\outputpenalty > -\LT@end@pen
       \LT@err{floats and marginpars not allowed in a longtable}\@ehc
     \else
       \setbox\z@\vbox{\unvbox\@cclv}%
       \ifdim \ht\LT@lastfoot>\ht\LT@foot
         \dimen@\pagegoal
         \advance\dimen@-\ht\LT@lastfoot
         \ifdim\dimen@<\ht\z@
           \setbox\@cclv\vbox{\unvbox\z@\copy\LT@foot\vss}%
           \@makecol
           \@outputpage
           \setbox\z@\vbox{\box\LT@head\glsLTpenaltycheck}%
         \fi
       \fi
       \global\@colroom\@colht
       \global\vsize\@colht
       {\unvbox\z@\box\ifvoid\LT@lastfoot\LT@foot\else\LT@lastfoot\fi}%
     \fi
   \else
     \setbox\@cclv\vbox{\unvbox\@cclv\copy\LT@foot\vss}%
     \@makecol
     \@outputpage
     \global\vsize\@colroom
     \copy\LT@head
     \glsLTpenaltycheck
     \nobreak
   \fi
 }%
}
%    \end{macrocode}
%\end{macro}
%\iffalse
%    \begin{macrocode}
%</glossary-longbooktabs.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossary-longragged.sty>
%    \end{macrocode}
%\fi
% \section{Glossary Styles using longtable (the glossary-longragged
% package)}
% The glossary styles defined in the \isty{glossary-longragged} package
% used the \env{longtable} environment in the glossary and use
% ragged right formatting for the multiline columns.
%    \begin{macrocode}
\ProvidesPackage{glossary-longragged}[2021/11/01 v4.49 (NLCT)]
%    \end{macrocode}
% Requires the \isty{array} package:
%    \begin{macrocode}
\RequirePackage{array}
%    \end{macrocode}
% Requires the \isty{longtable} package:
%    \begin{macrocode}
\RequirePackage{longtable}
%    \end{macrocode}
%\begin{macro}{\glsdescwidth}
% This is a length that governs the width of the description column.
% This may have already been defined.
%    \begin{macrocode}
\@ifundefined{glsdescwidth}{%
  \newlength\glsdescwidth
  \setlength{\glsdescwidth}{0.6\hsize}
}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glspagelistwidth}
% This is a length that governs the width of the page list column.
% This may already have been defined.
%    \begin{macrocode}
\@ifundefined{glspagelistwidth}{%
  \newlength\glspagelistwidth
  \setlength{\glspagelistwidth}{0.1\hsize}
}{}
%    \end{macrocode}
%\end{macro}
% 
%\begin{style}{longragged}
% The \glostyle{longragged} glossary style is like the
% \glostyle{long} but uses ragged right formatting for the
% description column.
%    \begin{macrocode}
\newglossarystyle{longragged}{%
%    \end{macrocode}
% Use \env{longtable} with two columns:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
     {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}}}%
     {\end{longtable}}%
%    \end{macrocode}
% Do nothing at the start of the environment:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No heading between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries displayed in a row:
%\changes{3.08a}{2013-09-28}{updated to use \cs{glossentry} and
%\cs{subglossentry}}
%    \begin{macrocode}
  \renewcommand{\glossentry}[2]{%
    \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
    \glossentrydesc{##1}\glspostdescription\space ##2%
    \tabularnewline
  }%
%    \end{macrocode}
% Sub entries displayed on the following row without the name:
%    \begin{macrocode}
  \renewcommand{\subglossentry}[3]{%
     &
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}\glossentrydesc{##2}%
     \glspostdescription\space ##3%
     \tabularnewline
  }%
%    \end{macrocode}
% Blank row between groups:
%\changes{3.03}{2012/09/21}{added check for glsnogroupskip}
%\changes{4.23}{2016-04-30}{check for nogroupskip changed}
%The check for \pkgopt{nogroupskip} must occur outside
%\cs{glsgroupskip}
%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108})
%    \begin{macrocode}
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{ & \tabularnewline}%
  \fi
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longraggedborder}
% The \glostyle{longraggedborder} style is like the above, but with horizontal and
% vertical lines:
%    \begin{macrocode}
\newglossarystyle{longraggedborder}{%
%    \end{macrocode}
% Base it on the glostyle{longragged} style:
%    \begin{macrocode}
  \setglossarystyle{longragged}%
%    \end{macrocode}
% Use \env{longtable} with two columns with vertical lines
% between each column:
%    \begin{macrocode}
  \renewenvironment{theglossary}{%
    \begin{longtable}{|l|>{\raggedright}p{\glsdescwidth}|}}%
    {\end{longtable}}%
%    \end{macrocode}
% Place horizontal lines at the head and foot of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{\hline\endhead\hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longraggedheader}
% The \glostyle{longraggedheader} style is like the
% \glostyle{longragged} style but with a header:
%    \begin{macrocode}
\newglossarystyle{longraggedheader}{%
%    \end{macrocode}
% Base it on the glostyle{longragged} style:
%    \begin{macrocode}
  \setglossarystyle{longragged}%
%    \end{macrocode}
% Set the table's header:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \bfseries \entryname & \bfseries \descriptionname
    \tabularnewline\endhead}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longraggedheaderborder}
% The \glostyle{longraggedheaderborder} style is
% like the \glostyle{longragged} style but with a header and border:
%    \begin{macrocode}
\newglossarystyle{longraggedheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{longraggedborder} style:
%    \begin{macrocode}
  \setglossarystyle{longraggedborder}%
%    \end{macrocode}
% Set the table's header and add horizontal line to table's foot:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \hline\bfseries \entryname & \bfseries \descriptionname
    \tabularnewline\hline
    \endhead
    \hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longragged3col}
% The \glostyle{longragged3col} style is like \glostyle{longragged} but with 3 columns
%    \begin{macrocode}
\newglossarystyle{longragged3col}{%
%    \end{macrocode}
% Use a \env{longtable} with 3 columns:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}%
       >{\raggedright}p{\glspagelistwidth}}}%
    {\end{longtable}}%
%    \end{macrocode}
% No table header:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No headings between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries on a row (name in first column, 
% description in second column, page list in last column):
%\changes{3.08a}{2013-09-28}{updated to use \cs{glossentry} and
%\cs{subglossentry}}
%    \begin{macrocode}
  \renewcommand{\glossentry}[2]{%
    \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
    \glossentrydesc{##1} & ##2\tabularnewline
  }%
%    \end{macrocode}
% Sub-entries on a separate row (no name, description in
% second column, page list in third column):
%    \begin{macrocode}
  \renewcommand{\subglossentry}[3]{%
     & 
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}\glossentrydesc{##2} &
     ##3\tabularnewline
  }%
%    \end{macrocode}
% Blank row between groups:
%\changes{3.03}{2012/09/21}{added check for glsnogroupskip}
%\changes{4.23}{2016-04-30}{check for nogroupskip changed}
%The check for \pkgopt{nogroupskip} must occur outside
%\cs{glsgroupskip}
%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108})
%    \begin{macrocode}
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{ & & \tabularnewline}%
  \fi
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longragged3colborder}
% The \glostyle{longragged3colborder} style is like the
% \glostyle{longragged3col} style but with a border:
%    \begin{macrocode}
\newglossarystyle{longragged3colborder}{%
%    \end{macrocode}
% Base it on the glostyle{longragged3col} style:
%    \begin{macrocode}
  \setglossarystyle{longragged3col}%
%    \end{macrocode}
% Use a \env{longtable} with 3 columns with vertical lines
% around them:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{|l|>{\raggedright}p{\glsdescwidth}|%
      >{\raggedright}p{\glspagelistwidth}|}}%
    {\end{longtable}}%
%    \end{macrocode}
% Place horizontal lines at the head and foot of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{\hline\endhead\hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longragged3colheader}
% The \glostyle{longragged3colheader} style is like \glostyle{longragged3col} but with a header row:
%    \begin{macrocode}
\newglossarystyle{longragged3colheader}{%
%    \end{macrocode}
% Base it on the glostyle{longragged3col} style:
%    \begin{macrocode}
  \setglossarystyle{longragged3col}%
%    \end{macrocode}
% Set the table's header:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \bfseries\entryname&\bfseries\descriptionname&
    \bfseries\pagelistname\tabularnewline\endhead}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longragged3colheaderborder}
% The \glostyle{longragged3colheaderborder} style is like the above but with a border
%    \begin{macrocode}
\newglossarystyle{longragged3colheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{longragged3colborder} style:
%    \begin{macrocode}
  \setglossarystyle{longragged3colborder}%
%    \end{macrocode}
% Set the table's header and add horizontal line at table's foot:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \hline
    \bfseries\entryname&\bfseries\descriptionname&
    \bfseries\pagelistname\tabularnewline\hline\endhead
    \hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlongragged4col}
% The \glostyle{altlongragged4col} style is like the \glostyle{altlong4col}
% style defined in the \isty{glossary-long} package, except that
% ragged right formatting is used for the description and page list
% columns.
%    \begin{macrocode}
\newglossarystyle{altlongragged4col}{%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns where the second and
% last columns may have multiple lines in each row:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}l%
       >{\raggedright}p{\glspagelistwidth}}}%
    {\end{longtable}}%
%    \end{macrocode}
% No table header:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries on a single row (name in first column,
% description in second column, symbol in third column, page list
% in last column):
%\changes{3.08a}{2013-09-28}{updated to use \cs{glossentry} and
%\cs{subglossentry}}
%\changes{4.08}{2014-07-30}{fixed bug that displayed description instead of
%symbol}
%    \begin{macrocode}
  \renewcommand{\glossentry}[2]{%
    \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
    \glossentrydesc{##1} & \glossentrysymbol{##1} &
    ##2\tabularnewline
  }%
%    \end{macrocode}
% Sub entries on a single row with no name (description in second
% column, symbol in third column, page list in last column):
%    \begin{macrocode}
  \renewcommand{\subglossentry}[3]{%
     & 
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}\glossentrydesc{##2} &
     \glossentrysymbol{##2} & ##3\tabularnewline
  }%
%    \end{macrocode}
% Blank row between groups:
%\changes{3.03}{2012/09/21}{added check for glsnogroupskip}
%\changes{4.23}{2016-04-30}{check for nogroupskip changed}
%The check for \pkgopt{nogroupskip} must occur outside
%\cs{glsgroupskip}
%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108})
%    \begin{macrocode}
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{ & & & \tabularnewline}%
  \fi
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlongragged4colheader}
% The \glostyle{altlongragged4colheader} style is like 
% \glostyle{altlongragged4col} but with a header row.
%    \begin{macrocode}
\newglossarystyle{altlongragged4colheader}{%
%    \end{macrocode}
% Base it on the glostyle{altlongragged4col} style:
%    \begin{macrocode}
  \setglossarystyle{altlongragged4col}%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns where the second and
% last columns may have multiple lines in each row:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}l%
      >{\raggedright}p{\glspagelistwidth}}}%
    {\end{longtable}}%
%    \end{macrocode}
% Table has a header:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \bfseries\entryname&\bfseries\descriptionname&
    \bfseries \symbolname&
    \bfseries\pagelistname\tabularnewline\endhead}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlongragged4colborder}
% The \glostyle{altlongragged4colborder} style is like
% \glostyle{altlongragged4col} but with a border.
%    \begin{macrocode}
\newglossarystyle{altlongragged4colborder}{%
%    \end{macrocode}
% Base it on the glostyle{altlongragged4col} style:
%    \begin{macrocode}
   \setglossarystyle{altlongragged4col}%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns where the second and
% last columns may have multiple lines in each row:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{|l|>{\raggedright}p{\glsdescwidth}|l|%
      >{\raggedright}p{\glspagelistwidth}|}}%
    {\end{longtable}}%
%    \end{macrocode}
% Add horizontal lines to the head and foot of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{\hline\endhead\hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlongragged4colheaderborder}
% The \glostyle{altlongragged4colheaderborder} style is like the above but
% with a header as well as a border.
%    \begin{macrocode}
\newglossarystyle{altlongragged4colheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{altlongragged4col} style:
%    \begin{macrocode}
  \setglossarystyle{altlongragged4col}%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns where the second and
% last columns may have multiple lines in each row:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{|l|>{\raggedright}p{\glsdescwidth}|l|%
       >{\raggedright}p{\glspagelistwidth}|}}%
    {\end{longtable}}%
%    \end{macrocode}
% Add table header and horizontal line at the table's foot:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \hline\bfseries\entryname&\bfseries\descriptionname&
    \bfseries \symbolname&
    \bfseries\pagelistname\tabularnewline\hline\endhead
      \hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%\iffalse
%    \begin{macrocode}
%</glossary-longragged.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossary-mcols.sty>
%    \end{macrocode}
%\fi
%\section{Glossary Styles using \styfmt{multicol}
%(glossary-mcols.sty)}
%The \isty{glossary-mcols} style file defines glossary styles that
%use the \sty{multicol} package. These use the tree-like glossary
%styles in a multicol environment.
%    \begin{macrocode}
\ProvidesPackage{glossary-mcols}[2021/11/01 v4.49 (NLCT)]
%    \end{macrocode}
% Required packages:
%    \begin{macrocode}
\RequirePackage{multicol}
\RequirePackage{glossary-tree}
%    \end{macrocode}
%
%\begin{macro}{\indexspace}
%\changes{4.13}{2015-02-03}{new}
% The are a few classes that don't define \cs{indexspace}, so
% provide a definition if it hasn't been defined.
%    \begin{macrocode}
\providecommand{\indexspace}{%
  \par \vskip 10\p@ \@plus 5\p@ \@minus 3\p@ \relax
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsmcols}
% Define macro in which to store the number of columns. (Defaults to
% 2.)
%    \begin{macrocode}
\newcommand*{\glsmcols}{2}
%    \end{macrocode}
%\end{macro}
%
%\begin{style}{mcolindex}
% Multi-column index style. Same as the \glostyle{index}, but puts the
% glossary in multiple columns. (Ideally the glossary title should go in the
% optional argument of \env{multicols}, but the title isn't part of
% the glossary style.)
%    \begin{macrocode}
\newglossarystyle{mcolindex}{%
  \setglossarystyle{index}%
  \renewenvironment{theglossary}%
    {%
%    \end{macrocode}
%\changes{3.05}{2013-04-21}{replaced `2' with \cs{glsmcols}}
%    \begin{macrocode}
     \begin{multicols}{\glsmcols}
     \setlength{\parindent}{0pt}%
     \setlength{\parskip}{0pt plus 0.3pt}%
%    \end{macrocode}
%\changes{4.26}{2016-10-12}{replaced \cs{@idxitem} with
%\cs{glstreeitem}}
%    \begin{macrocode}
     \let\item\glstreeitem
     \let\subitem\glstreesubitem
     \let\subsubitem\glstreesubsubitem
    }%
    {\end{multicols}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{mcolindexgroup}
% As \glostyle{mcolindex} but has headings:
%    \begin{macrocode}
\newglossarystyle{mcolindexgroup}{%
 \setglossarystyle{mcolindex}%
 \renewcommand*{\glsgroupheading}[1]{%
    \item\glstreegroupheaderfmt{\glsgetgrouptitle{##1}}\indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{mcolindexhypergroup}
% The \glostyle{mcolindexhypergroup} style is like the
% \glostyle{mcolindexgroup} style but has hyper navigation.
%    \begin{macrocode}
\newglossarystyle{mcolindexhypergroup}{%
%    \end{macrocode}
% Base it on the glostyle{mcolindex} style:
%    \begin{macrocode}
  \setglossarystyle{mcolindex}%
%    \end{macrocode}
% Put navigation links to the groups at the start of the glossary:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \item\glstreenavigationfmt{\glsnavigation}\indexspace}%
%    \end{macrocode}
% Add a heading for each group (with a target). The group's title is
% in bold followed by a vertical gap.
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \item\glstreegroupheaderfmt
      {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}%
    \indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{mcolindexspannav}
%\changes{4.22}{2016-04-19}{new}
% Similar to \glostyle{mcolindexhypergroup}, but puts the navigation
% line
% in the optional argument of \env{multicols}.
%    \begin{macrocode}
\newglossarystyle{mcolindexspannav}{%
  \setglossarystyle{index}%
  \renewenvironment{theglossary}%
    {%
%    \end{macrocode}
%\changes{3.05}{2013-04-21}{replaced `2' with \cs{glsmcols}}
%    \begin{macrocode}
     \begin{multicols}{\glsmcols}[\noindent\glstreenavigationfmt{\glsnavigation}]
     \setlength{\parindent}{0pt}%
     \setlength{\parskip}{0pt plus 0.3pt}%
%    \end{macrocode}
%\changes{4.26}{2016-10-12}{replaced \cs{@idxitem} with
%\cs{glstreeitem}}
%    \begin{macrocode}
     \let\item\glstreeitem}%
    {\end{multicols}}%
%    \end{macrocode}
% Add a heading for each group (with a target). The group's title is
% in bold followed by a vertical gap.
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \item\glstreegroupheaderfmt
      {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}%
    \indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{mcoltree}
% Multi-column index style. Same as the \glostyle{tree}, but puts the
% glossary in multiple columns.
%    \begin{macrocode}
\newglossarystyle{mcoltree}{%
  \setglossarystyle{tree}%
  \renewenvironment{theglossary}%
  {%
%    \end{macrocode}
%\changes{3.05}{2013-04-21}{replaced `2' with \cs{glsmcols}}
%    \begin{macrocode}
     \begin{multicols}{\glsmcols}
     \setlength{\parindent}{0pt}%
     \setlength{\parskip}{0pt plus 0.3pt}%
  }%
  {\end{multicols}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{mcoltreegroup}
% Like the \glostyle{mcoltree} style but the glossary groups have
% headings.
%    \begin{macrocode}
\newglossarystyle{mcoltreegroup}{%
%    \end{macrocode}
% Base it on the glostyle{mcoltree} style:
%    \begin{macrocode}
  \setglossarystyle{mcoltree}%
%    \end{macrocode}
% Each group has a heading (in bold) followed by a vertical gap):
%    \begin{macrocode}
  \renewcommand{\glsgroupheading}[1]{\par
    \noindent\glstreegroupheaderfmt{\glsgetgrouptitle{##1}}\par\indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{mcoltreehypergroup}
% The \glostyle{mcoltreehypergroup} style is like the
% \glostyle{treegroup}
% style, but has a set of links to the groups at the
% start of the glossary.
%    \begin{macrocode}
\newglossarystyle{mcoltreehypergroup}{%
%    \end{macrocode}
% Base it on the glostyle{mcoltree} style:
%    \begin{macrocode}
  \setglossarystyle{mcoltree}%
%    \end{macrocode}
% Put navigation links to the groups at the start of the
% \env{theglossary} environment:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \par\noindent\glstreenavigationfmt{\glsnavigation}\par\indexspace}%
%    \end{macrocode}
% Each group has a heading (in bold with a target) followed by a 
% vertical gap):
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \par\noindent
    \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par
    \indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{mcoltreespannav}
%\changes{4.22}{2016-04-19}{new}
% Similar to the \glostyle{mcoltreehypergroup} style but the
% navigation line is put in the optional argument of the
% \env{multicols} environment.
%    \begin{macrocode}
\newglossarystyle{mcoltreespannav}{%
  \setglossarystyle{tree}%
  \renewenvironment{theglossary}%
  {%
%    \end{macrocode}
%\changes{3.05}{2013-04-21}{replaced `2' with \cs{glsmcols}}
%    \begin{macrocode}
     \begin{multicols}{\glsmcols}[\noindent\glstreenavigationfmt{\glsnavigation}]
     \setlength{\parindent}{0pt}%
     \setlength{\parskip}{0pt plus 0.3pt}%
  }%
  {\end{multicols}}%
%    \end{macrocode}
% Each group has a heading (in bold with a target) followed by a 
% vertical gap):
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \par\noindent
    \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par
    \indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{mcoltreenoname}
% Multi-column index style. Same as the \glostyle{treenoname}, but puts the
% glossary in multiple columns.
%    \begin{macrocode}
\newglossarystyle{mcoltreenoname}{%
  \setglossarystyle{treenoname}%
  \renewenvironment{theglossary}%
  {%
%    \end{macrocode}
%\changes{3.05}{2013-04-21}{replaced `2' with \cs{glsmcols}}
%    \begin{macrocode}
     \begin{multicols}{\glsmcols}
     \setlength{\parindent}{0pt}%
     \setlength{\parskip}{0pt plus 0.3pt}%
  }%
  {\end{multicols}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{mcoltreenonamegroup}
% Like the \glostyle{mcoltreenoname} style but the glossary groups have
% headings.
%    \begin{macrocode}
\newglossarystyle{mcoltreenonamegroup}{%
%    \end{macrocode}
% Base it on the glostyle{mcoltreenoname} style:
%    \begin{macrocode}
  \setglossarystyle{mcoltreenoname}%
%    \end{macrocode}
% Give each group a heading:
%    \begin{macrocode}
  \renewcommand{\glsgroupheading}[1]{\par
    \noindent\glstreegroupheaderfmt{\glsgetgrouptitle{##1}}\par\indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{mcoltreenonamehypergroup}
% The \glostyle{mcoltreenonamehypergroup} style is like the
% \glostyle{mcoltreenonamegroup}
% style, but has a set of links to the groups at the
% start of the glossary.
%    \begin{macrocode}
\newglossarystyle{mcoltreenonamehypergroup}{%
%    \end{macrocode}
% Base it on the glostyle{mcoltreenoname} style:
%    \begin{macrocode}
  \setglossarystyle{mcoltreenoname}%
%    \end{macrocode}
% Put navigation links to the groups at the start of the
% \env{theglossary} environment:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \par\noindent\glstreenavigationfmt{\glsnavigation}\par\indexspace}%
%    \end{macrocode}
% Each group has a heading (in bold with a target) followed by a 
% vertical gap):
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \par\noindent
    \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par
    \indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{mcoltreenonamespannav}
%\changes{4.22}{2016-04-19}{new}
% Similar to the \glostyle{mcoltreenonamehypergroup} style but the
% navigation line is put in the optional argument of the
% \env{multicols} environment.
%    \begin{macrocode}
\newglossarystyle{mcoltreenonamespannav}{%
  \setglossarystyle{treenoname}%
  \renewenvironment{theglossary}%
  {%
     \begin{multicols}{\glsmcols}[\noindent\glstreenavigationfmt{\glsnavigation}]
     \setlength{\parindent}{0pt}%
     \setlength{\parskip}{0pt plus 0.3pt}%
  }%
  {\end{multicols}}%
%    \end{macrocode}
% Each group has a heading (in bold with a target) followed by a 
% vertical gap):
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \par\noindent
    \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par
    \indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{mcolalttree}
% Multi-column index style. Same as the \glostyle{alttree}, but puts the
% glossary in multiple columns.
%    \begin{macrocode}
\newglossarystyle{mcolalttree}{%
  \setglossarystyle{alttree}%
  \renewenvironment{theglossary}%
  {%
%    \end{macrocode}
%\changes{3.05}{2013-04-21}{replaced `2' with \cs{glsmcols}}
%    \begin{macrocode}
     \begin{multicols}{\glsmcols}
     \def\@gls@prevlevel{-1}%
     \mbox{}\par
  }%
  {\par\end{multicols}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{mcolalttreegroup}
% Like the \glostyle{mcolalttree} style but the glossary groups have
% headings.
%    \begin{macrocode}
\newglossarystyle{mcolalttreegroup}{%
%    \end{macrocode}
% Base it on the glostyle{mcolalttree} style:
%    \begin{macrocode}
  \setglossarystyle{mcolalttree}%
%    \end{macrocode}
% Give each group a heading.
%    \begin{macrocode}
  \renewcommand{\glsgroupheading}[1]{\par
    \def\@gls@prevlevel{-1}%
    \hangindent0pt\relax
    \parindent0pt\relax
    \glstreegroupheaderfmt{\glsgetgrouptitle{##1}}\par\indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{mcolalttreehypergroup}
% The \glostyle{mcolalttreehypergroup} style is like the 
% \glostyle{mcolalttreegroup} style, but has a set of links to the 
% groups at the start of the glossary.
%    \begin{macrocode}
\newglossarystyle{mcolalttreehypergroup}{%
%    \end{macrocode}
% Base it on the glostyle{mcolalttree} style:
%    \begin{macrocode}
  \setglossarystyle{mcolalttree}%
%    \end{macrocode}
% Put the navigation links in the header
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \par
    \def\@gls@prevlevel{-1}%
    \hangindent0pt\relax
    \parindent0pt\relax
    \glstreenavigationfmt{\glsnavigation}\par\indexspace}%
%    \end{macrocode}
% Put a hypertarget at the start of each group
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \par
    \def\@gls@prevlevel{-1}%
    \hangindent0pt\relax
    \parindent0pt\relax
    \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par
    \indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{mcolalttreespannav}
%\changes{4.22}{2016-04-19}{new}
% Similar to the \glostyle{mcolalttreehypergroup} style but the
% navigation line is put in the optional argument of the
% \env{multicols} environment.
%    \begin{macrocode}
\newglossarystyle{mcolalttreespannav}{%
  \setglossarystyle{alttree}%
  \renewenvironment{theglossary}%
  {%
     \begin{multicols}{\glsmcols}[\noindent\glstreenavigationfmt{\glsnavigation}]
     \def\@gls@prevlevel{-1}%
     \mbox{}\par
  }%
  {\par\end{multicols}}%
%    \end{macrocode}
% Put a hypertarget at the start of each group
%\changes{4.34}{2017-11-03}{removed spurious space}
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \par
    \def\@gls@prevlevel{-1}%
    \hangindent0pt\relax
    \parindent0pt\relax
    \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par
    \indexspace}%
}
%    \end{macrocode}
%\end{style}
%

%\iffalse
%    \begin{macrocode}
%</glossary-mcols.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossary-super.sty>
%    \end{macrocode}
%\fi
% \section{Glossary Styles using supertabular environment (glossary-super package)}
% The glossary styles defined in the \isty{glossary-super} package
% use the \env{supertabular} environment.
%    \begin{macrocode}
\ProvidesPackage{glossary-super}[2021/11/01 v4.49 (NLCT)]
%    \end{macrocode}
% Requires the \isty{supertabular} package:
%    \begin{macrocode}
\RequirePackage{supertabular}
%    \end{macrocode}
%\begin{macro}{\glsdescwidth}
% This is a length that governs the width of the description column.
% This may already have been defined if \isty{glossary-long}
% has been loaded.\changes{2.01}{2009 May 30}{changed \cs{linewidth}
% to \cs{hsize}}
%    \begin{macrocode}
\@ifundefined{glsdescwidth}{%
  \newlength\glsdescwidth
  \setlength{\glsdescwidth}{0.6\hsize}
}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glspagelistwidth}
% This is a length that governs the width of the page list column.
% This may already have been defined if \isty{glossary-long}
% has been loaded.\changes{2.01}{2009 May 30}{changed \cs{linewidth}
% to \cs{hsize}}
%    \begin{macrocode}
\@ifundefined{glspagelistwidth}{%
  \newlength\glspagelistwidth
  \setlength{\glspagelistwidth}{0.1\hsize}
}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{style}{super}
% The \glostyle{super} glossary style uses the
% \env{supertabular} environment
% (it uses lengths defined in the \isty{glossary-long} package.)
%    \begin{macrocode}
\newglossarystyle{super}{%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% two columns and no head or tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{}\tabletail{}%
     \begin{supertabular}{lp{\glsdescwidth}}}%
    {\end{supertabular}}%
%    \end{macrocode}
% Do nothing at the start of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries put in a row (name in first column,
% description and page list in second column):
%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}}
%    \begin{macrocode}
  \renewcommand{\glossentry}[2]{%
    \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
    \glossentrydesc{##1}\glspostdescription\space ##2\tabularnewline
  }%
%    \end{macrocode}
% Sub entries put in a row (no name, description and page list
% in second column):
%\changes{4.0}{2013-11-14}{fixed typo in \cs{subglossentry} (\cs{glossentrydesc})}
%    \begin{macrocode}
  \renewcommand{\subglossentry}[3]{%
     & 
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription\space
     ##3\tabularnewline
  }%
%    \end{macrocode}
% Blank row between groups:
%\changes{3.03}{2012/09/21}{added check for glsnogroupskip}
%\changes{4.23}{2016-04-30}{check for nogroupskip changed}
%The check for \pkgopt{nogroupskip} must occur outside
%\cs{glsgroupskip}
%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108})
%    \begin{macrocode}
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{& \tabularnewline}%
  \fi
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{superborder}
% The \glostyle{superborder} style is like the above, but with 
% horizontal and vertical lines:
%    \begin{macrocode}
\newglossarystyle{superborder}{%
%    \end{macrocode}
% Base it on the glostyle{super} style:
%    \begin{macrocode}
  \setglossarystyle{super}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% two columns and a horizontal line in the head and tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline}\tabletail{\hline}%
     \begin{supertabular}{|l|p{\glsdescwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{superheader}
% The \glostyle{superheader} style is like the
% \glostyle{super} style, but with a header:
%    \begin{macrocode}
\newglossarystyle{superheader}{%
%    \end{macrocode}
% Base it on the glostyle{super} style:
%    \begin{macrocode}
  \setglossarystyle{super}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% two columns, a header and no tail:
%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}}
%    \begin{macrocode}
\renewenvironment{theglossary}%
  {\tablehead{\bfseries \entryname & 
   \bfseries\descriptionname\tabularnewline}%
   \tabletail{}%
   \begin{supertabular}{lp{\glsdescwidth}}}%
  {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{superheaderborder}
% The \glostyle{superheaderborder} style is like
% the \glostyle{super} style but with a header and border:
%    \begin{macrocode}
\newglossarystyle{superheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{super} style:
%    \begin{macrocode}
  \setglossarystyle{super}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% two columns, a header and horizontal lines above and below the
% table:
%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}}
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline\bfseries \entryname &
       \bfseries \descriptionname\tabularnewline\hline}%
     \tabletail{\hline}
     \begin{supertabular}{|l|p{\glsdescwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{super3col}
% The \glostyle{super3col} style is like the \glostyle{super} 
% style, but with 3 columns:
%    \begin{macrocode}
\newglossarystyle{super3col}{%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% three columns and no head or tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{}\tabletail{}%
     \begin{supertabular}{lp{\glsdescwidth}p{\glspagelistwidth}}}%
    {\end{supertabular}}%
%    \end{macrocode}
% Do nothing at the start of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries on a row (name in first column, 
% description in second column, page list in last column):
%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}}
%    \begin{macrocode}
  \renewcommand{\glossentry}[2]{%
    \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
    \glossentrydesc{##1} & ##2\tabularnewline
  }%
%    \end{macrocode}
% Sub entries on a row (no name, description in second column,
% page list in last column):
%    \begin{macrocode}
  \renewcommand{\subglossentry}[3]{%
     & 
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}\glossentrydesc{##2} &
     ##3\tabularnewline
  }%
%    \end{macrocode}
% Blank row between groups:
%\changes{3.03}{2012/09/21}{added check for glsnogroupskip}
%\changes{4.23}{2016-04-30}{check for nogroupskip changed}
%The check for \pkgopt{nogroupskip} must occur outside
%\cs{glsgroupskip}
%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108})
%    \begin{macrocode}
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{& & \tabularnewline}%
  \fi
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{super3colborder}
% The \glostyle{super3colborder} style is like the
% \glostyle{super3col} style, but with a border:
%    \begin{macrocode}
\newglossarystyle{super3colborder}{%
%    \end{macrocode}
% Base it on the glostyle{super3col} style:
%    \begin{macrocode}
  \setglossarystyle{super3col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% three columns and a horizontal line in the head and tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline}\tabletail{\hline}%
     \begin{supertabular}{|l|p{\glsdescwidth}|p{\glspagelistwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{super3colheader}
% The \glostyle{super3colheader} style is like 
% the \glostyle{super3col} style but with a header row:
%    \begin{macrocode}
\newglossarystyle{super3colheader}{%
%    \end{macrocode}
% Base it on the glostyle{super3col} style:
%    \begin{macrocode}
  \setglossarystyle{super3col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% three columns, a header and no tail:
%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}}
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\bfseries\entryname&\bfseries\descriptionname&
       \bfseries\pagelistname\tabularnewline}\tabletail{}%
     \begin{supertabular}{lp{\glsdescwidth}p{\glspagelistwidth}}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{super3colheaderborder}
% The \glostyle{super3colheaderborder} style is like
% the \glostyle{super3col} style but with a header and border:
%    \begin{macrocode}
\newglossarystyle{super3colheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{super3colborder} style:
%    \begin{macrocode}
  \setglossarystyle{super3colborder}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% three columns, a header with horizontal lines and a horizontal
% line in the tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline
        \bfseries\entryname&\bfseries\descriptionname&
        \bfseries\pagelistname\tabularnewline\hline}%
     \tabletail{\hline}%
     \begin{supertabular}{|l|p{\glsdescwidth}|p{\glspagelistwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{super4col}
% The \glostyle{super4col} glossary style has four columns,
% where the third column contains the value of the
% corresponding \gloskey{symbol} key used when that entry
% was defined.
%    \begin{macrocode}
\newglossarystyle{super4col}{%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns and no head or tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{}\tabletail{}%
     \begin{supertabular}{llll}}{%
     \end{supertabular}}%
%    \end{macrocode}
% Do nothing at the start of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries on a row with the name in the first
% column, description in second column, symbol in third column
% and page list in last column:
%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}}
%\changes{4.22}{2016-04-19}{fixed bug in \cs{glossentry}}
%    \begin{macrocode}
  \renewcommand{\glossentry}[2]{%
    \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
    \glossentrydesc{##1} &
    \glossentrysymbol{##1} & ##2\tabularnewline
  }%
%    \end{macrocode}
% Sub entries on a row with no name, the description in the second
% column, symbol in third column and page list in last column:
%    \begin{macrocode}
  \renewcommand{\subglossentry}[3]{%
     & 
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}\glossentrydesc{##2} &
     \glossentrysymbol{##2} & ##3\tabularnewline
  }%
%    \end{macrocode}
% Blank row between groups:
%\changes{3.03}{2012/09/21}{added check for glsnogroupskip}
%\changes{4.23}{2016-04-30}{check for nogroupskip changed}
%The check for \pkgopt{nogroupskip} must occur outside
%\cs{glsgroupskip}
%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108})
%    \begin{macrocode}
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{& & & \tabularnewline}%
  \fi
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{super4colheader}
% The \glostyle{super4colheader} style is like
% the \glostyle{super4col} but with a header row.
%    \begin{macrocode}
\newglossarystyle{super4colheader}{%
%    \end{macrocode}
% Base it on the glostyle{super4col} style:
%    \begin{macrocode}
  \setglossarystyle{super4col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns, a header and no tail:
%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}}
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\bfseries\entryname&\bfseries\descriptionname&
        \bfseries\symbolname &
        \bfseries\pagelistname\tabularnewline}%
     \tabletail{}%
     \begin{supertabular}{llll}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{super4colborder}
% The \glostyle{super4colborder} style is like
% the \glostyle{super4col} but with a border.
%    \begin{macrocode}
\newglossarystyle{super4colborder}{%
%    \end{macrocode}
% Base it on the glostyle{super4col} style:
%    \begin{macrocode}
  \setglossarystyle{super4col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns and a horizontal line in the head and tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline}\tabletail{\hline}%
     \begin{supertabular}{|l|l|l|l|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{super4colheaderborder}
% The \glostyle{super4colheaderborder} style is like
% the \glostyle{super4col} but with a header and border.
%    \begin{macrocode}
\newglossarystyle{super4colheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{super4col} style:
%    \begin{macrocode}
  \setglossarystyle{super4col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns and a header bordered by horizontal lines and 
% a horizontal line in the tail:
%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}}
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline\bfseries\entryname&\bfseries\descriptionname&
        \bfseries\symbolname &
        \bfseries\pagelistname\tabularnewline\hline}%
     \tabletail{\hline}%
     \begin{supertabular}{|l|l|l|l|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altsuper4col}
% The \glostyle{altsuper4col} glossary style is like 
% \glostyle{super4col} but has provision for multiline descriptions.
%    \begin{macrocode}
\newglossarystyle{altsuper4col}{%
%    \end{macrocode}
% Base it on the glostyle{super4col} style:
%    \begin{macrocode}
  \setglossarystyle{super4col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns and no head or tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{}\tabletail{}%
     \begin{supertabular}{lp{\glsdescwidth}lp{\glspagelistwidth}}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altsuper4colheader}
% The \glostyle{altsuper4colheader} style is like
% the \glostyle{altsuper4col} but with a header row.
%    \begin{macrocode}
\newglossarystyle{altsuper4colheader}{%
%    \end{macrocode}
% Base it on the glostyle{super4colheader} style:
%    \begin{macrocode}
  \setglossarystyle{super4colheader}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns, a header and no tail:
%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}}
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\bfseries\entryname&\bfseries\descriptionname&
      \bfseries\symbolname &
      \bfseries\pagelistname\tabularnewline}\tabletail{}%
     \begin{supertabular}{lp{\glsdescwidth}lp{\glspagelistwidth}}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altsuper4colborder}
% The \glostyle{altsuper4colborder} style is like
% the \glostyle{altsuper4col} but with a border.
%    \begin{macrocode}
\newglossarystyle{altsuper4colborder}{%
%    \end{macrocode}
% Base it on the glostyle{super4colborder} style:
%    \begin{macrocode}
  \setglossarystyle{super4colborder}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns and a horizontal line in the head and tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline}\tabletail{\hline}%
     \begin{supertabular}%
       {|l|p{\glsdescwidth}|l|p{\glspagelistwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altsuper4colheaderborder}
% The \glostyle{altsuper4colheaderborder} style is like
% the \glostyle{altsuper4col} but with a header and border.
%    \begin{macrocode}
\newglossarystyle{altsuper4colheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{super4colheaderborder} style:
%    \begin{macrocode}
  \setglossarystyle{super4colheaderborder}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns and a header bordered by horizontal lines and 
% a horizontal line in the tail:
%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}}
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline
       \bfseries\entryname &
       \bfseries\descriptionname &
       \bfseries\symbolname &
       \bfseries\pagelistname\tabularnewline\hline}%
     \tabletail{\hline}%
     \begin{supertabular}%
       {|l|p{\glsdescwidth}|l|p{\glspagelistwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%\iffalse
%    \begin{macrocode}
%</glossary-super.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossary-superragged.sty>
%    \end{macrocode}
%\fi
% \section{Glossary Styles using supertabular environment (glossary-superragged package)}
% The glossary styles defined in the \isty{glossary-superragged}
% package use the \env{supertabular} environment. These styles 
% are like those provided by the \isty{glossary-super} package, 
% except that the multiline columns have ragged right justification.
%    \begin{macrocode}
\ProvidesPackage{glossary-superragged}[2021/11/01 v4.49 (NLCT)]
%    \end{macrocode}
% Requires the \isty{array} package:
%    \begin{macrocode}
\RequirePackage{array}
%    \end{macrocode}
% Requires the \isty{supertabular} package:
%    \begin{macrocode}
\RequirePackage{supertabular}
%    \end{macrocode}
%\begin{macro}{\glsdescwidth}
% This is a length that governs the width of the description column.
% This may already have been defined.
%    \begin{macrocode}
\@ifundefined{glsdescwidth}{%
  \newlength\glsdescwidth
  \setlength{\glsdescwidth}{0.6\hsize}
}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glspagelistwidth}
% This is a length that governs the width of the page list column.
% This may already have been defined.
%    \begin{macrocode}
\@ifundefined{glspagelistwidth}{%
  \newlength\glspagelistwidth
  \setlength{\glspagelistwidth}{0.1\hsize}
}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{style}{superragged}
% The \glostyle{superragged} glossary style uses the
% \env{supertabular} environment.
%    \begin{macrocode}
\newglossarystyle{superragged}{%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% two columns and no head or tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{}\tabletail{}%
     \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}}}%
    {\end{supertabular}}%
%    \end{macrocode}
% Do nothing at the start of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries put in a row (name in first column,
% description and page list in second column):
%\changes{3.08a}{2013-09-28}{updated to use \cs{glossentry} and
%\cs{subglossentry}}
%    \begin{macrocode}
  \renewcommand{\glossentry}[2]{%
    \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
    \glossentrydesc{##1}\glspostdescription\space ##2%
    \tabularnewline
  }%
%    \end{macrocode}
% Sub entries put in a row (no name, description and page list
% in second column):
%    \begin{macrocode}
  \renewcommand{\subglossentry}[3]{%
     & 
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription\space
     ##3%
     \tabularnewline
  }%
%    \end{macrocode}
% Blank row between groups:
%\changes{3.03}{2012/09/21}{added check for glsnogroupskip}
%\changes{4.23}{2016-04-30}{check for nogroupskip changed}
%The check for \pkgopt{nogroupskip} must occur outside
%\cs{glsgroupskip}
%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108})
%    \begin{macrocode}
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{& \tabularnewline}%
  \fi
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{superraggedborder}
% The \glostyle{superraggedborder} style is like the above, but with 
% horizontal and vertical lines:
%    \begin{macrocode}
\newglossarystyle{superraggedborder}{%
%    \end{macrocode}
% Base it on the glostyle{superragged} style:
%    \begin{macrocode}
  \setglossarystyle{superragged}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% two columns and a horizontal line in the head and tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline}\tabletail{\hline}%
     \begin{supertabular}{|l|>{\raggedright}p{\glsdescwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{superraggedheader}
% The \glostyle{superraggedheader} style is like the
% \glostyle{super} style, but with a header:
%    \begin{macrocode}
\newglossarystyle{superraggedheader}{%
%    \end{macrocode}
% Base it on the glostyle{superragged} style:
%    \begin{macrocode}
  \setglossarystyle{superragged}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% two columns, a header and no tail:
%    \begin{macrocode}
\renewenvironment{theglossary}%
  {\tablehead{\bfseries \entryname & \bfseries \descriptionname
     \tabularnewline}%
   \tabletail{}%
   \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}}}%
  {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{superraggedheaderborder}
% The \glostyle{superraggedheaderborder} style is like
% the \glostyle{superragged} style but with a header and border:
%    \begin{macrocode}
\newglossarystyle{superraggedheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{super} style:
%    \begin{macrocode}
  \setglossarystyle{superragged}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% two columns, a header and horizontal lines above and below the
% table:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline\bfseries \entryname &
       \bfseries \descriptionname\tabularnewline\hline}%
     \tabletail{\hline}
     \begin{supertabular}{|l|>{\raggedright}p{\glsdescwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{superragged3col}
% The \glostyle{superragged3col} style is like the \glostyle{superragged} 
% style, but with 3 columns:
%    \begin{macrocode}
\newglossarystyle{superragged3col}{%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% three columns and no head or tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{}\tabletail{}%
     \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}%
        >{\raggedright}p{\glspagelistwidth}}}%
    {\end{supertabular}}%
%    \end{macrocode}
% Do nothing at the start of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries on a row (name in first column, 
% description in second column, page list in last column):
%    \begin{macrocode}
  \renewcommand{\glossentry}[2]{%
    \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
    \glossentrydesc{##1} &
    ##2\tabularnewline
  }%
%    \end{macrocode}
% Sub entries on a row (no name, description in second column,
% page list in last column):
%    \begin{macrocode}
  \renewcommand{\subglossentry}[3]{%
     & 
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}\glossentrydesc{##2} &
     ##3\tabularnewline
  }%
%    \end{macrocode}
% Blank row between groups:
%\changes{3.03}{2012/09/21}{added check for glsnogroupskip}
%\changes{4.23}{2016-04-30}{check for nogroupskip changed}
%The check for \pkgopt{nogroupskip} must occur outside
%\cs{glsgroupskip}
%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108})
%    \begin{macrocode}
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{& & \tabularnewline}%
  \fi
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{superragged3colborder}
% The \glostyle{superragged3colborder} style is like the
% \glostyle{superragged3col} style, but with a border:
%    \begin{macrocode}
\newglossarystyle{superragged3colborder}{%
%    \end{macrocode}
% Base it on the glostyle{superragged3col} style:
%    \begin{macrocode}
  \setglossarystyle{superragged3col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% three columns and a horizontal line in the head and tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline}\tabletail{\hline}%
     \begin{supertabular}{|l|>{\raggedright}p{\glsdescwidth}|%
       >{\raggedright}p{\glspagelistwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{superragged3colheader}
% The \glostyle{superragged3colheader} style is like 
% the \glostyle{superragged3col} style but with a header row:
%    \begin{macrocode}
\newglossarystyle{superragged3colheader}{%
%    \end{macrocode}
% Base it on the glostyle{superragged3col} style:
%    \begin{macrocode}
  \setglossarystyle{superragged3col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% three columns, a header and no tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\bfseries\entryname&\bfseries\descriptionname&
       \bfseries\pagelistname\tabularnewline}\tabletail{}%
     \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}%
       >{\raggedright}p{\glspagelistwidth}}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{superraggedright3colheaderborder}
% The \glostyle{superragged3colheaderborder} style is like
% the \glostyle{superragged3col} style but with a header and border:
%    \begin{macrocode}
\newglossarystyle{superragged3colheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{superragged3colborder} style:
%    \begin{macrocode}
  \setglossarystyle{superragged3colborder}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% three columns, a header with horizontal lines and a horizontal
% line in the tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline
        \bfseries\entryname&\bfseries\descriptionname&
        \bfseries\pagelistname\tabularnewline\hline}%
     \tabletail{\hline}%
     \begin{supertabular}{|l|>{\raggedright}p{\glsdescwidth}|%
       >{\raggedright}p{\glspagelistwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altsuperragged4col}
% The \glostyle{altsuperragged4col} glossary style is like 
% \glostyle{altsuper4col} style in the \isty{glossary-super}
% package but uses ragged right formatting in the description 
% and page list columns.
%    \begin{macrocode}
\newglossarystyle{altsuperragged4col}{%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns and no head or tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{}\tabletail{}%
     \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}l%
       >{\raggedright}p{\glspagelistwidth}}}%
    {\end{supertabular}}%
%    \end{macrocode}
% Do nothing at the start of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries on a row with the name in the first
% column, description in second column, symbol in third column
% and page list in last column:
%    \begin{macrocode}
  \renewcommand{\glossentry}[2]{%
    \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
    \glossentrydesc{##1} &
    \glossentrysymbol{##1} & ##2\tabularnewline
  }%
%    \end{macrocode}
% Sub entries on a row with no name, the description in the second
% column, symbol in third column and page list in last column:
%    \begin{macrocode}
  \renewcommand{\subglossentry}[3]{%
     & 
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}\glossentrydesc{##2} &
     \glossentrysymbol{##2} & ##3\tabularnewline
  }%
%    \end{macrocode}
% Blank row between groups:
%\changes{3.03}{2012/09/21}{added check for glsnogroupskip}
%\changes{4.23}{2016-04-30}{check for nogroupskip changed}
%The check for \pkgopt{nogroupskip} must occur outside
%\cs{glsgroupskip}
%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108})
%    \begin{macrocode}
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{& & & \tabularnewline}%
  \fi
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altsuperragged4colheader}
% The \glostyle{altsuperragged4colheader} style is like
% the \glostyle{altsuperragged4col} style but with a header row.
%    \begin{macrocode}
\newglossarystyle{altsuperragged4colheader}{%
%    \end{macrocode}
% Base it on the glostyle{altsuperragged4col} style:
%    \begin{macrocode}
  \setglossarystyle{altsuperragged4col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns, a header and no tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\bfseries\entryname&\bfseries\descriptionname&
      \bfseries\symbolname &
      \bfseries\pagelistname\tabularnewline}\tabletail{}%
     \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}l%
       >{\raggedright}p{\glspagelistwidth}}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altsuperragged4colborder}
% The \glostyle{altsuperragged4colborder} style is like
% the \glostyle{altsuperragged4col} style but with a border.
%    \begin{macrocode}
\newglossarystyle{altsuperragged4colborder}{%
%    \end{macrocode}
% Base it on the glostyle{altsuperragged4col} style:
%    \begin{macrocode}
  \setglossarystyle{altsuper4col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns and a horizontal line in the head and tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline}\tabletail{\hline}%
     \begin{supertabular}%
       {|l|>{\raggedright}p{\glsdescwidth}|l|%
         >{\raggedright}p{\glspagelistwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altsuperragged4colheaderborder}
% The \glostyle{altsuperragged4colheaderborder} style is like
% the \glostyle{altsuperragged4col} style but with a header and border.
%    \begin{macrocode}
\newglossarystyle{altsuperragged4colheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{altsuperragged4col} style:
%    \begin{macrocode}
  \setglossarystyle{altsuperragged4col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns and a header bordered by horizontal lines and 
% a horizontal line in the tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline
       \bfseries\entryname &
       \bfseries\descriptionname &
       \bfseries\symbolname &
       \bfseries\pagelistname\tabularnewline\hline}%
     \tabletail{\hline}%
     \begin{supertabular}%
       {|l|>{\raggedright}p{\glsdescwidth}|l|%
          >{\raggedright}p{\glspagelistwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%\iffalse
%    \begin{macrocode}
%</glossary-superragged.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossary-tree.sty>
%    \end{macrocode}
%\fi
%\section{Tree Styles (glossary-tree.sty)}
% The \isty{glossary-tree} style file defines glossary styles
% that have a tree-like structure. These are designed for
% hierarchical glossaries.
%    \begin{macrocode}
\ProvidesPackage{glossary-tree}[2021/11/01 v4.49 (NLCT)]
%    \end{macrocode}
%
%\begin{macro}{\indexspace}
%\changes{4.13}{2015-02-03}{new}
% There are a few classes that don't define \cs{indexspace}, so
% provide a definition if it hasn't been defined.
%    \begin{macrocode}
\providecommand{\indexspace}{%
  \par \vskip 10\p@ \@plus 5\p@ \@minus 3\p@ \relax
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glstreenamefmt}
%\changes{4.08}{2014-07-30}{new}
% Format used to display the name in the tree styles. (This may be
% counteracted by \ics{glsnamefont}.) This command was previously also used to
% format the group headings.
%    \begin{macrocode}
\newcommand*{\glstreenamefmt}[1]{\textbf{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glstreegroupheaderfmt}
%\changes{4.22}{2016-04-19}{new}
% Format used to display the group header in the tree styles.
% Before v4.22, \cs{glstreenamefmt} was used for the group header,
% so the default definition uses that to help maintain
% backward-compatibility, since in previous versions redefining
% \cs{glstreenamefmt} would've also affected the group headings.
%    \begin{macrocode}
\newcommand*{\glstreegroupheaderfmt}[1]{\glstreenamefmt{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glstreenavigationfmt}
%\changes{4.22}{2016-04-19}{new}
% Format used to display the navigation header in the tree styles.
%    \begin{macrocode}
\newcommand*{\glstreenavigationfmt}[1]{\glstreenamefmt{#1}}
%    \end{macrocode}
%\end{macro}
%
%Allow the user to adjust the \glostyle{index} style without disturbing the index.
%\begin{macro}{\glstreeitem}
%Top level item used in \glostyle{index} style.
%\changes{4.26}{2016-10-12}{new}
%    \begin{macrocode}
\ifdef\@idxitem
{\newcommand{\glstreeitem}{\@idxitem}}
{\newcommand{\glstreeitem}{\par\hangindent40\p@}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glstreesubitem}
%\changes{4.26}{2016-10-12}{new}
%Level~1 item used in \glostyle{index} style.
%    \begin{macrocode}
\ifdef\subitem
{\let\glstreesubitem\subitem}
{\newcommand\glstreesubitem{\glstreeitem\hspace*{20\p@}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glstreesubsubitem}
%\changes{4.26}{2016-10-12}{new}
%Level~1 item used in \glostyle{index} style.
%    \begin{macrocode}
\ifdef\subsubitem
{\let\glstreesubsubitem\subsubitem}
{\newcommand\glstreesubsubitem{\glstreeitem\hspace*{30\p@}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glstreepredesc}
%Allow the user to adjust the space before the description (except
%for the \glostyle{alttree} style).
%\changes{4.26}{2016-10-12}{new}
%    \begin{macrocode}
\newcommand{\glstreepredesc}{\space}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glstreechildpredesc}
%Allow the user to adjust the space before the description for
%sub-entries (except for the \glostyle{treenoname} and
%\glostyle{alttree} style).
%\changes{4.26}{2016-10-12}{new}
%    \begin{macrocode}
\newcommand{\glstreechildpredesc}{\space}
%    \end{macrocode}
%\end{macro}
%
%\begin{style}{index}
% The \glostyle{index} glossary style 
% is similar in style to the way indices are usually typeset
% using \cs{item}, \cs{subitem} and \cs{subsubitem}.
% The entry name is 
% set in bold. If an entry has a symbol, it is placed in 
% brackets after the name. Then the description is displayed,
% followed by the number list. This style allows up to three
% levels.
%    \begin{macrocode}
\newglossarystyle{index}{%
%    \end{macrocode}
% Set the paragraph indentation and skip and define \ics{item}
% to be the same as that used by \env{theindex}:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\setlength{\parindent}{0pt}%
     \setlength{\parskip}{0pt plus 0.3pt}%
     \let\item\glstreeitem
     \let\subitem\glstreesubitem
     \let\subsubitem\glstreesubsubitem
    }%
%    \end{macrocode}
%\changes{3.08a}{2013-09-28}{added paragraph break at end of environment}
%    \begin{macrocode}
    {\par}%
%    \end{macrocode}
% Do nothing at the start of the environment:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headers:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entry starts a new item with the name in bold
% followed by the symbol in brackets (if it exists), the description
% and the page list.
%\changes{3.08a}{2013-09-28}{updated to use \cs{glossentry} and
%\cs{subglossentry}}
%    \begin{macrocode}
  \renewcommand*{\glossentry}[2]{%
     \item\glsentryitem{##1}\glstreenamefmt{\glstarget{##1}{\glossentryname{##1}}}%
     \ifglshassymbol{##1}{\space(\glossentrysymbol{##1})}{}%
     \glstreepredesc \glossentrydesc{##1}\glspostdescription\space ##2%
  }%
%    \end{macrocode}
% Sub entries: level 1 entries use \ics{subitem}, levels greater 
% than~1 use \ics{subsubitem}. The level ("##1") shouldn't be 0,
% as that's catered by \cs{glossentry}, but for completeness,
% if the level is 0, \ics{item} is used. The name is put in bold,
% followed by the symbol in brackets (if it exists), the description
% and the page list.
%    \begin{macrocode}
  \renewcommand{\subglossentry}[3]{%
    \ifcase##1\relax
      % level 0
      \item
    \or
      % level 1
      \subitem
      \glssubentryitem{##2}%
    \else
      % all other levels
      \subsubitem
    \fi
    \glstreenamefmt{\glstarget{##2}{\glossentryname{##2}}}%
    \ifglshassymbol{##2}{\space(\glossentrysymbol{##2})}{}%
    \glstreechildpredesc\glossentrydesc{##2}\glspostdescription\space ##3%
  }%
%    \end{macrocode}
% Vertical gap between groups is the same as that used by indices:
%\changes{3.03}{2012/09/21}{added check for glsnogroupskip}
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{indexgroup}
% The \glostyle{indexgroup} style is like the \glostyle{index}
% style but has headings.
%    \begin{macrocode}
\newglossarystyle{indexgroup}{%
%    \end{macrocode}
% Base it on the glostyle{index} style:
%    \begin{macrocode}
  \setglossarystyle{index}%
%    \end{macrocode}
% Add a heading for each group. This puts the group's title in
% bold followed by a vertical gap.
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \item\glstreegroupheaderfmt{\glsgetgrouptitle{##1}}%
    \indexspace
  }%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{indexhypergroup}
% The \glostyle{indexhypergroup} style is like the
% \glostyle{indexgroup} style but has hyper navigation.
%    \begin{macrocode}
\newglossarystyle{indexhypergroup}{%
%    \end{macrocode}
% Base it on the glostyle{index} style:
%    \begin{macrocode}
  \setglossarystyle{index}%
%    \end{macrocode}
% Put navigation links to the groups at the start of the glossary:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \item\glstreenavigationfmt{\glsnavigation}\indexspace}%
%    \end{macrocode}
% Add a heading for each group (with a target). The group's title is
% in bold followed by a vertical gap.
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \item\glstreegroupheaderfmt
      {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}%
    \indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{tree}
% The \glostyle{tree} glossary style 
% is similar in style to the \glostyle{index} style, but
% can have arbitrary levels.
%    \begin{macrocode}
\newglossarystyle{tree}{%
%    \end{macrocode}
% Set the paragraph indentation and skip:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\setlength{\parindent}{0pt}%
     \setlength{\parskip}{0pt plus 0.3pt}}%
    {}%
%    \end{macrocode}
% Do nothing at the start of the \env{theglossary} environment:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries: name in bold, followed by symbol in
% brackets (if it exists), the description and the page list:
%\changes{3.08a}{2013-09-28}{updated to use \cs{glossentry} and
%\cs{subglossentry}}
%    \begin{macrocode}
  \renewcommand{\glossentry}[2]{%
    \hangindent0pt\relax
    \parindent0pt\relax
    \glsentryitem{##1}\glstreenamefmt{\glstarget{##1}{\glossentryname{##1}}}%
    \ifglshassymbol{##1}{\space(\glossentrysymbol{##1})}{}%
    \glstreepredesc\glossentrydesc{##1}\glspostdescription\space##2\par
  }%
%    \end{macrocode}
% Sub entries: level \meta{n} is indented by \meta{n} times
% \ics{glstreeindent}. The name is in bold, followed by the
% symbol in brackets (if it exists), the description and the
% page list.
%    \begin{macrocode}
  \renewcommand{\subglossentry}[3]{%
    \hangindent##1\glstreeindent\relax
    \parindent##1\glstreeindent\relax
    \ifnum##1=1\relax
      \glssubentryitem{##2}%
    \fi
    \glstreenamefmt{\glstarget{##2}{\glossentryname{##2}}}%
    \ifglshassymbol{##2}{\space(\glossentrysymbol{##2})}{}%
    \glstreechildpredesc\glossentrydesc{##2}\glspostdescription\space ##3\par
  }%
%    \end{macrocode}
% Vertical gap between groups is the same as that used by
% indices:
%\changes{3.03}{2012/09/21}{added check for glsnogroupskip}
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{treegroup}
% Like the \glostyle{tree} style but the glossary groups have
% headings.
%    \begin{macrocode}
\newglossarystyle{treegroup}{%
%    \end{macrocode}
% Base it on the glostyle{tree} style:
%    \begin{macrocode}
  \setglossarystyle{tree}%
%    \end{macrocode}
% Each group has a heading (in bold) followed by a vertical gap):
%    \begin{macrocode}
  \renewcommand{\glsgroupheading}[1]{\par
    \noindent\glstreegroupheaderfmt{\glsgetgrouptitle{##1}}\par
    \indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{treehypergroup}
% The \glostyle{treehypergroup} style is like the \glostyle{treegroup}
% style, but has a set of links to the groups at the
% start of the glossary.
%    \begin{macrocode}
\newglossarystyle{treehypergroup}{%
%    \end{macrocode}
% Base it on the glostyle{tree} style:
%    \begin{macrocode}
  \setglossarystyle{tree}%
%    \end{macrocode}
% Put navigation links to the groups at the start of the
% \env{theglossary} environment:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \par\noindent\glstreenavigationfmt{\glsnavigation}\par\indexspace}%
%    \end{macrocode}
% Each group has a heading (in bold with a target) followed by a 
% vertical gap):
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \par\noindent
    \glstreegroupheaderfmt
      {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par
    \indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{macro}{\glstreeindent}
% Length governing left indent for each level of the \glostyle{tree}
% style.
%    \begin{macrocode}
\newlength\glstreeindent
\setlength{\glstreeindent}{10pt}
%    \end{macrocode}
%\end{macro}
%
%\begin{style}{treenoname}
% The \glostyle{treenoname} glossary style 
% is like the \glostyle{tree} style, but
% doesn't print the name or symbol for sub-levels.
%    \begin{macrocode}
\newglossarystyle{treenoname}{%
%    \end{macrocode}
% Set the paragraph indentation and skip:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\setlength{\parindent}{0pt}%
     \setlength{\parskip}{0pt plus 0.3pt}}%
    {}%
%    \end{macrocode}
% No header:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries: the name is in bold, followed by the
% symbol in brackets (if it exists), the description and the
% page list.
%    \begin{macrocode}
  \renewcommand{\glossentry}[2]{%
    \hangindent0pt\relax
    \parindent0pt\relax
    \glsentryitem{##1}\glstreenamefmt{\glstarget{##1}{\glossentryname{##1}}}%
    \ifglshassymbol{##1}{\space(\glossentrysymbol{##1})}{}%
    \glstreepredesc\glossentrydesc{##1}\glspostdescription\space##2\par
  }%
%    \end{macrocode}
% Sub entries: level \meta{n} is indented by \meta{n} times
% \ics{glstreeindent}. The name and symbol are omitted. The
% description followed by the page list are displayed.
%    \begin{macrocode}
  \renewcommand{\subglossentry}[3]{%
    \hangindent##1\glstreeindent\relax
    \parindent##1\glstreeindent\relax
    \ifnum##1=1\relax
      \glssubentryitem{##2}%
    \fi
    \glstarget{##2}{\strut}%
    \glossentrydesc{##2}\glspostdescription\space##3\par
  }%
%    \end{macrocode}
% Vertical gap between groups is the same as that used by indices:
%\changes{3.03}{2012/09/21}{added check for glsnogroupskip}
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{treenonamegroup}
% Like the \glostyle{treenoname} style but the glossary groups have
% headings.
%    \begin{macrocode}
\newglossarystyle{treenonamegroup}{%
%    \end{macrocode}
% Base it on the glostyle{treenoname} style:
%    \begin{macrocode}
  \setglossarystyle{treenoname}%
%    \end{macrocode}
% Give each group a heading:
%    \begin{macrocode}
  \renewcommand{\glsgroupheading}[1]{\par
    \noindent\glstreegroupheaderfmt
      {\glsgetgrouptitle{##1}}\par\indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{treenonamehypergroup}
% The \glostyle{treenonamehypergroup} style is like the \glostyle{treenonamegroup}
% style, but has a set of links to the groups at the
% start of the glossary.
%    \begin{macrocode}
\newglossarystyle{treenonamehypergroup}{%
%    \end{macrocode}
% Base it on the glostyle{treenoname} style:
%    \begin{macrocode}
  \setglossarystyle{treenoname}%
%    \end{macrocode}
% Put navigation links to the groups at the start of the
% \env{theglossary} environment:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \par\noindent\glstreenavigationfmt{\glsnavigation}\par\indexspace}%
%    \end{macrocode}
% Each group has a heading (in bold with a target) followed by a 
% vertical gap):
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \par\noindent
    \glstreegroupheaderfmt
      {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par
    \indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{macro}{\glsfindwidesttoplevelname}
%\changes{4.22}{2016-04-19}{new}
% Find the widest name over all parentless entries in the
% given glossary or glossaries.
%    \begin{macrocode}
\newrobustcmd*{\glsfindwidesttoplevelname}[1][\@glo@types]{%
  \dimen@=0pt\relax
  \gls@tmplen=0pt\relax
  \forallglossaries[#1]{\@gls@type}%
  {%
    \forglsentries[\@gls@type]{\@glo@label}%
    {%
      \ifglshasparent{\@glo@label}%
      {}%
      {%
        \settowidth{\dimen@}%
         {\glstreenamefmt{\glsentryname{\@glo@label}}}%
        \ifdim\dimen@>\gls@tmplen
          \gls@tmplen=\dimen@
          \letcs{\@glswidestname}{glo@\glsdetoklabel{\@glo@label}@name}%
        \fi
      }%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glssetwidest}
% \cs{glssetwidest}\oarg{level}\marg{text} sets the widest
% text for the given level. It is used by the
% \glostyle{alttree} glossary styles to determine the
% indentation of each level.
%    \begin{macrocode}
\newcommand*{\glssetwidest}[2][0]{%
  \expandafter\def\csname @glswidestname\romannumeral#1\endcsname{%
    #2}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glswidestname}
% Initialise \cs{@glswidestname}.
%    \begin{macrocode}
\newcommand*{\@glswidestname}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glstreenamebox}
% Used by the \glostyle{alttree} style to create the box for the
% name and associated information.
%\changes{4.19}{2015-10-31}{new}
%    \begin{macrocode}
\newcommand*{\glstreenamebox}[2]{%
  \makebox[#1][l]{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{style}{alttree}
% The \glostyle{alttree} glossary style 
% is similar in style to the \glostyle{tree} style, but
% the indentation is obtained from the width of 
% \cs{@glswidestname} which is set using \cs{glssetwidest}.
%    \begin{macrocode}
\newglossarystyle{alttree}{%
%    \end{macrocode}
% Redefine \env{theglossary} environment.
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\def\@gls@prevlevel{-1}%
     \mbox{}\par}%
    {\par}%
%    \end{macrocode}
% Set the header and group headers to nothing.
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Redefine the way that the level~0 entries are displayed.
%\changes{3.08a}{2013-09-28}{updated to use \cs{glossentry} and
%\cs{subglossentry}}
%    \begin{macrocode}
  \renewcommand{\glossentry}[2]{%
    \ifnum\@gls@prevlevel=0\relax
    \else
%    \end{macrocode}
% Find out how big the indentation should be by measuring the
% widest entry.
%    \begin{macrocode}
       \settowidth{\glstreeindent}{\glstreenamefmt{\@glswidestname\space}}%
    \fi
%    \end{macrocode}
% Set the hangindent and paragraph indent.
%\changes{4.04}{2014-03-06}{moved hangindent and parindent assignments
%outside level test}
%    \begin{macrocode}
    \hangindent\glstreeindent
    \parindent\glstreeindent
%    \end{macrocode}
% Put the name to the left of the paragraph block.
%    \begin{macrocode}
    \makebox[0pt][r]{\glstreenamebox{\glstreeindent}{%
       \glsentryitem{##1}\glstreenamefmt{\glstarget{##1}{\glossentryname{##1}}}}}%
%    \end{macrocode}
% If the symbol is missing, ignore it, otherwise put it in 
% brackets.
%\changes{4.10}{2014-08-27}{moved space after symbol}
%    \begin{macrocode}
    \ifglshassymbol{##1}{(\glossentrysymbol{##1})\space}{}%
%    \end{macrocode}
% Do the description followed by the description terminator and
% location list.
%    \begin{macrocode}
    \glossentrydesc{##1}\glspostdescription \space ##2\par
%    \end{macrocode}
% Set the previous level to 0.
%    \begin{macrocode}
    \def\@gls@prevlevel{0}%
  }%
%    \end{macrocode}
% Redefine the way sub-entries are displayed.
%    \begin{macrocode}
  \renewcommand{\subglossentry}[3]{%
%    \end{macrocode}
% Increment and display the sub-entry counter if this is a level~1
% entry and the sub-entry counter is in use.
%    \begin{macrocode}
    \ifnum##1=1\relax
      \glssubentryitem{##2}%
    \fi
%    \end{macrocode}
% If the level hasn't changed, keep the same settings, otherwise
% adjust \cs{glstreeindent} accordingly.
%    \begin{macrocode}
    \ifnum\@gls@prevlevel=##1\relax
    \else
%    \end{macrocode}
% Compute the widest entry for this level, or for level~0 if not
% defined for this level. Store in \cs{gls@tmplen}
%    \begin{macrocode}
      \@ifundefined{@glswidestname\romannumeral##1}{%
        \settowidth{\gls@tmplen}{\glstreenamefmt{\@glswidestname\space}}}{%
        \settowidth{\gls@tmplen}{\glstreenamefmt{%
           \csname @glswidestname\romannumeral##1\endcsname\space}}}%
%    \end{macrocode}
% Determine if going up or down a level
%    \begin{macrocode}
      \ifnum\@gls@prevlevel<##1\relax
%    \end{macrocode}
% Depth has increased, so add the width of the widest entry to
% \cs{glstreeindent}.
%    \begin{macrocode}
         \setlength\glstreeindent\gls@tmplen
         \addtolength\glstreeindent\parindent
         \parindent\glstreeindent
      \else
%    \end{macrocode}
% Depth has decreased, so subtract width of the widest entry 
% from the previous level to \cs{glstreeindent}. First 
% determine the width of the widest entry for the previous level
% and store in \cs{glstreeindent}.
%    \begin{macrocode}
         \@ifundefined{@glswidestname\romannumeral\@gls@prevlevel}{%
           \settowidth{\glstreeindent}{\glstreenamefmt{%
              \@glswidestname\space}}}{%
           \settowidth{\glstreeindent}{\glstreenamefmt{%
              \csname @glswidestname\romannumeral\@gls@prevlevel
                 \endcsname\space}}}%
%    \end{macrocode}
% Subtract this length from the previous level's paragraph indent
% and set to \cs{glstreeindent}.
%    \begin{macrocode}
         \addtolength\parindent{-\glstreeindent}%
         \setlength\glstreeindent\parindent
      \fi
    \fi
%    \end{macrocode}
% Set the hanging indentation.
%    \begin{macrocode}
    \hangindent\glstreeindent
%    \end{macrocode}
% Put the name to the left of the paragraph block
%    \begin{macrocode}
    \makebox[0pt][r]{\glstreenamebox{\gls@tmplen}{%
      \glstreenamefmt{\glstarget{##2}{\glossentryname{##2}}}}}%
%    \end{macrocode}
% If the symbol is missing, ignore it, otherwise put it in 
% brackets.
%\changes{4.10}{2014-08-27}{moved space after symbol}
%    \begin{macrocode}
    \ifglshassymbol{##2}{(\glossentrysymbol{##2})\space}{}%
%    \end{macrocode}
% Do the description followed by the description terminator and
% location list.
%    \begin{macrocode}
    \glossentrydesc{##2}\glspostdescription\space ##3\par
%    \end{macrocode}
% Set the previous level macro to the current level.
%    \begin{macrocode}
    \def\@gls@prevlevel{##1}%
  }%
%    \end{macrocode}
% Vertical gap between groups is the same as that used by indices:
%\changes{3.03}{2012/09/21}{added check for glsnogroupskip}
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{alttreegroup}
% Like the \glostyle{alttree} style but the glossary groups have
% headings.
%    \begin{macrocode}
\newglossarystyle{alttreegroup}{%
%    \end{macrocode}
% Base it on the glostyle{alttree} style:
%    \begin{macrocode}
  \setglossarystyle{alttree}%
%    \end{macrocode}
% Give each group a heading.
%    \begin{macrocode}
  \renewcommand{\glsgroupheading}[1]{\par
    \def\@gls@prevlevel{-1}%
    \hangindent0pt\relax
    \parindent0pt\relax
    \glstreegroupheaderfmt{\glsgetgrouptitle{##1}}%
    \par\indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{alttreehypergroup}
% The \glostyle{alttreehypergroup} style is like the 
% \glostyle{alttreegroup} style, but has a set of links to the 
% groups at the start of the glossary.
%    \begin{macrocode}
\newglossarystyle{alttreehypergroup}{%
%    \end{macrocode}
% Base it on the glostyle{alttree} style:
%    \begin{macrocode}
  \setglossarystyle{alttree}%
%    \end{macrocode}
% Put the navigation links in the header
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \par
    \def\@gls@prevlevel{-1}%
    \hangindent0pt\relax
    \parindent0pt\relax
    \glstreenavigationfmt{\glsnavigation}\par\indexspace}%
%    \end{macrocode}
% Put a hypertarget at the start of each group
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \par
    \def\@gls@prevlevel{-1}%
    \hangindent0pt\relax
    \parindent0pt\relax
    \glstreegroupheaderfmt
     {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par
    \indexspace}}
%    \end{macrocode}
%\end{style}
%
%\iffalse
%    \begin{macrocode}
%</glossary-tree.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-compatible-207.sty>
%    \end{macrocode}
%\fi
%\chapter{Backwards Compatibility}
%\section{glossaries-compatible-207}
% Provides compatibility with version 2.07 and below. This uses
% original \sty{glossaries} xindy and makeindex formatting, so can
% be used with old documents that had customized style files, but
% hyperlinks may not work properly.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{glossaries-compatible-207}[2021/11/01 v4.49 (NLCT)]
%    \end{macrocode}
%\begin{macro}{\GlsAddXdyAttribute}
% Adds an attribute in old format.
%    \begin{macrocode}
\ifglsxindy
  \renewcommand*\GlsAddXdyAttribute[1]{%
  \edef\@xdyattributes{\@xdyattributes ^^J \string"#1\string"}%
  \expandafter\toks@\expandafter{\@xdylocref}%
  \edef\@xdylocref{\the\toks@ ^^J%
  (markup-locref
  :open \string"\string~n\string\setentrycounter
    {\noexpand\glscounter}%
    \expandafter\string\csname#1\endcsname
    \expandafter\@gobble\string\{\string" ^^J
  :close \string"\expandafter\@gobble\string\}\string" ^^J
  :attr \string"#1\string")}}
%    \end{macrocode}
% Only has an effect before \ics{writeist}:
%    \begin{macrocode}
\fi
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\GlsAddXdyCounters}
%    \begin{macrocode}
\renewcommand*\GlsAddXdyCounters[1]{%
  \GlossariesWarning{\string\GlsAddXdyCounters\space not available
    in compatibility mode.}%
}
%    \end{macrocode}
%\end{macro}
% Add predefined attributes
%    \begin{macrocode}
  \GlsAddXdyAttribute{glsnumberformat}
  \GlsAddXdyAttribute{textrm}
  \GlsAddXdyAttribute{textsf}
  \GlsAddXdyAttribute{texttt}
  \GlsAddXdyAttribute{textbf}
  \GlsAddXdyAttribute{textmd}
  \GlsAddXdyAttribute{textit}
  \GlsAddXdyAttribute{textup}
  \GlsAddXdyAttribute{textsl}
  \GlsAddXdyAttribute{textsc}
  \GlsAddXdyAttribute{emph}
  \GlsAddXdyAttribute{glshypernumber}
  \GlsAddXdyAttribute{hyperrm}
  \GlsAddXdyAttribute{hypersf}
  \GlsAddXdyAttribute{hypertt}
  \GlsAddXdyAttribute{hyperbf}
  \GlsAddXdyAttribute{hypermd}
  \GlsAddXdyAttribute{hyperit}
  \GlsAddXdyAttribute{hyperup}
  \GlsAddXdyAttribute{hypersl}
  \GlsAddXdyAttribute{hypersc}
  \GlsAddXdyAttribute{hyperemph}
%    \end{macrocode}
%
%\begin{macro}{\GlsAddXdyLocation}
% Restore v2.07 definition:
%    \begin{macrocode}
\ifglsxindy
   \renewcommand*{\GlsAddXdyLocation}[2]{%
     \edef\@xdyuserlocationdefs{%
        \@xdyuserlocationdefs ^^J%
        (define-location-class \string"#1\string"^^J\space\space
        \space(#2))
     }%
     \edef\@xdyuserlocationnames{%
        \@xdyuserlocationnames^^J\space\space\space
        \string"#1\string"}%
   }
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@do@wrglossary}
%    \begin{macrocode}
\renewcommand{\@do@wrglossary}[1]{%
%    \end{macrocode}
% Determine whether to use \app{xindy} or \app{makeindex}
% syntax
%    \begin{macrocode}
\ifglsxindy
%    \end{macrocode}
% Need to determine if the formatting information starts with
% a ( or ) indicating a range.
%    \begin{macrocode}
  \expandafter\@glo@check@mkidxrangechar\@glsnumberformat\@nil
  \def\@glo@range{}%
  \expandafter\if\@glo@prefix(\relax
    \def\@glo@range{:open-range}%
  \else
    \expandafter\if\@glo@prefix)\relax
      \def\@glo@range{:close-range}%
    \fi
  \fi
%    \end{macrocode}
% Get the location and escape any special characters
%    \begin{macrocode}
  \protected@edef\@glslocref{\theglsentrycounter}%
  \@gls@checkmkidxchars\@glslocref
%    \end{macrocode}
% Write to the glossary file using \app{xindy} syntax.
%    \begin{macrocode}
  \glossary[\csname glo@#1@type\endcsname]{%
  (indexentry :tkey (\csname glo@#1@index\endcsname)
    :locref \string"\@glslocref\string" %
    :attr \string"\@glo@suffix\string" \@glo@range
  )
  }%
\else
%    \end{macrocode}
% Convert the format information into the format required for
% \app{makeindex}
%    \begin{macrocode}
  \@set@glo@numformat\@glo@numfmt\@gls@counter\@glsnumberformat
%    \end{macrocode}
% Write to the glossary file using \app{makeindex} syntax.
%    \begin{macrocode}
  \glossary[\csname glo@#1@type\endcsname]{%
  \string\glossaryentry{\csname glo@#1@index\endcsname
    \@gls@encapchar\@glo@numfmt}{\theglsentrycounter}}%
\fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@set@glo@numformat}
% Only had 3 arguments in v2.07
%    \begin{macrocode}
\def\@set@glo@numformat#1#2#3{%
  \expandafter\@glo@check@mkidxrangechar#3\@nil
  \protected@edef#1{%
    \@glo@prefix setentrycounter[]{#2}%
    \expandafter\string\csname\@glo@suffix\endcsname
  }%
  \@gls@checkmkidxchars#1%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\writeist}
% Redefine \cs{writeist} back to the way it was in v2.07, but change
% \cs{istfile} to \cs{glswrite}.
%    \begin{macrocode}
\ifglsxindy
  \def\writeist{%
    \openout\glswrite=\istfilename
    \write\glswrite{;; xindy style file created by the glossaries
      package in compatible-2.07 mode}%
    \write\glswrite{;; for document '\jobname' on
      \the\year-\the\month-\the\day}%
    \write\glswrite{^^J; required styles^^J}
    \@for\@xdystyle:=\@xdyrequiredstyles\do{%
       \ifx\@xdystyle\@empty
       \else
         \protected@write\glswrite{}{(require
           \string"\@xdystyle.xdy\string")}%
       \fi
    }%
    \write\glswrite{^^J%
       ; list of allowed attributes (number formats)^^J}%
    \write\glswrite{(define-attributes ((\@xdyattributes)))}%
    \write\glswrite{^^J; user defined alphabets^^J}%
    \write\glswrite{\@xdyuseralphabets}%
    \write\glswrite{^^J; location class definitions^^J}%
    \protected@edef\@gls@roman{\@roman{0\string"
      \string"roman-numbers-lowercase\string" :sep \string"}}%
    \@onelevel@sanitize\@gls@roman
    \edef\@tmp{\string" \string"roman-numbers-lowercase\string"
       :sep \string"}%
    \@onelevel@sanitize\@tmp
    \ifx\@tmp\@gls@roman
       \write\glswrite{(define-location-class
         \string"roman-page-numbers\string"^^J\space\space\space
         (\string"roman-numbers-lowercase\string")
         :min-range-length \@glsminrange)}%
    \else
       \write\glswrite{(define-location-class
         \string"roman-page-numbers\string"^^J\space\space\space
         (:sep "\@gls@roman")
         :min-range-length \@glsminrange)}%
    \fi
    \write\glswrite{(define-location-class
      \string"Roman-page-numbers\string"^^J\space\space\space
      (\string"roman-numbers-uppercase\string")
         :min-range-length \@glsminrange)}%
    \write\glswrite{(define-location-class
      \string"arabic-page-numbers\string"^^J\space\space\space
      (\string"arabic-numbers\string")
         :min-range-length \@glsminrange)}%
    \write\glswrite{(define-location-class
      \string"alpha-page-numbers\string"^^J\space\space\space
      (\string"alpha\string")
         :min-range-length \@glsminrange)}%
    \write\glswrite{(define-location-class
      \string"Alpha-page-numbers\string"^^J\space\space\space
      (\string"ALPHA\string")
         :min-range-length \@glsminrange)}%
    \write\glswrite{(define-location-class
      \string"Appendix-page-numbers\string"^^J\space\space\space
      (\string"ALPHA\string"
       :sep \string"\@glsAlphacompositor\string"
       \string"arabic-numbers\string")
         :min-range-length \@glsminrange)}%
    \write\glswrite{(define-location-class
      \string"arabic-section-numbers\string"^^J\space\space\space
      (\string"arabic-numbers\string"
       :sep \string"\glscompositor\string"
       \string"arabic-numbers\string")
         :min-range-length \@glsminrange)}%
    \write\glswrite{^^J; user defined location classes}%
    \write\glswrite{\@xdyuserlocationdefs}%
    \write\glswrite{^^J; define cross-reference class^^J}%
    \write\glswrite{(define-crossref-class \string"see\string"
      :unverified )}%
    \write\glswrite{(markup-crossref-list
       :class \string"see\string"^^J\space\space\space
       :open \string"\string\glsseeformat\string"
       :close \string"{}\string")}%
    \write\glswrite{^^J; define the order of the location classes}%
    \write\glswrite{(define-location-class-order
       (\@xdylocationclassorder))}%
    \write\glswrite{^^J; define the glossary markup^^J}%
    \write\glswrite{(markup-index^^J\space\space\space
      :open \string"\string
      \glossarysection[\string\glossarytoctitle]{\string
      \glossarytitle}\string\glossarypreamble\string~n\string\begin
      {theglossary}\string\glossaryheader\string~n\string" ^^J\space
      \space\space:close \string"\expandafter\@gobble
        \string\%\string~n\string
        \end{theglossary}\string\glossarypostamble
        \string~n\string" ^^J\space\space\space
      :tree)}%
    \write\glswrite{(markup-letter-group-list
      :sep \string"\string\glsgroupskip\string~n\string")}%
    \write\glswrite{(markup-indexentry
      :open \string"\string\relax \string\glsresetentrylist
         \string~n\string")}%
    \write\glswrite{(markup-locclass-list :open
     \string"\glsopenbrace\string\glossaryentrynumbers
       \glsopenbrace\string\relax\space \string"^^J\space\space\space
     :sep \string", \string"
     :close \string"\glsclosebrace\glsclosebrace\string")}%
    \write\glswrite{(markup-locref-list
     :sep \string"\string\delimN\space\string")}%
    \write\glswrite{(markup-range
     :sep \string"\string\delimR\space\string")}%
    \@onelevel@sanitize\gls@suffixF
    \@onelevel@sanitize\gls@suffixFF
    \ifx\gls@suffixF\@empty
    \else
      \write\glswrite{(markup-range
      :close "\gls@suffixF" :length 1 :ignore-end)}%
    \fi
    \ifx\gls@suffixFF\@empty
    \else
      \write\glswrite{(markup-range
      :close "\gls@suffixFF" :length 2 :ignore-end)}%
    \fi
    \write\glswrite{^^J; define format to use for locations^^J}%
    \write\glswrite{\@xdylocref}%
    \write\glswrite{^^J; define letter group list format^^J}%
    \write\glswrite{(markup-letter-group-list
     :sep \string"\string\glsgroupskip\string~n\string")}%
    \write\glswrite{^^J; letter group headings^^J}%
    \write\glswrite{(markup-letter-group
      :open-head \string"\string\glsgroupheading
      \glsopenbrace\string"^^J\space\space\space
      :close-head \string"\glsclosebrace\string")}%
    \write\glswrite{^^J; additional letter groups^^J}%
    \write\glswrite{\@xdylettergroups}%
    \write\glswrite{^^J; additional sort rules^^J}
    \write\glswrite{\@xdysortrules}%
  \noist}
\else
  \edef\@gls@actualchar{\string?}
  \edef\@gls@encapchar{\string|}
  \edef\@gls@levelchar{\string!}
  \edef\@gls@quotechar{\string"}
  \def\writeist{\relax
    \openout\glswrite=\istfilename
    \write\glswrite{\expandafter\@gobble\string\% makeindex style file
      created by the glossaries package}
    \write\glswrite{\expandafter\@gobble\string\% for document
      '\jobname' on \the\year-\the\month-\the\day}
    \write\glswrite{actual '\@gls@actualchar'}
    \write\glswrite{encap '\@gls@encapchar'}
    \write\glswrite{level '\@gls@levelchar'}
    \write\glswrite{quote '\@gls@quotechar'}
    \write\glswrite{keyword \string"\string\\glossaryentry\string"}
    \write\glswrite{preamble \string"\string\\glossarysection[\string
      \\glossarytoctitle]{\string\\glossarytitle}\string
      \\glossarypreamble\string\n\string\\begin{theglossary}\string
      \\glossaryheader\string\n\string"}
    \write\glswrite{postamble \string"\string\%\string\n\string
      \\end{theglossary}\string\\glossarypostamble\string\n
      \string"}
    \write\glswrite{group_skip \string"\string\\glsgroupskip\string\n
      \string"}
    \write\glswrite{item_0 \string"\string\%\string\n\string"}
    \write\glswrite{item_1 \string"\string\%\string\n\string"}
    \write\glswrite{item_2 \string"\string\%\string\n\string"}
    \write\glswrite{item_01 \string"\string\%\string\n\string"}
    \write\glswrite{item_x1
      \string"\string\\relax \string\\glsresetentrylist\string\n
      \string"}
    \write\glswrite{item_12 \string"\string\%\string\n\string"}
    \write\glswrite{item_x2
      \string"\string\\relax \string\\glsresetentrylist\string\n
      \string"}
    \write\glswrite{delim_0 \string"\string\{\string
      \\glossaryentrynumbers\string\{\string\\relax \string"}
    \write\glswrite{delim_1 \string"\string\{\string
      \\glossaryentrynumbers\string\{\string\\relax \string"}
    \write\glswrite{delim_2 \string"\string\{\string
      \\glossaryentrynumbers\string\{\string\\relax \string"}
    \write\glswrite{delim_t \string"\string\}\string\}\string"}
    \write\glswrite{delim_n \string"\string\\delimN \string"}
    \write\glswrite{delim_r \string"\string\\delimR \string"}
    \write\glswrite{headings_flag 1}
    \write\glswrite{heading_prefix
       \string"\string\\glsgroupheading\string\{\string"}
    \write\glswrite{heading_suffix
       \string"\string\}\string\\relax
       \string\\glsresetentrylist \string"}
    \write\glswrite{symhead_positive \string"glssymbols\string"}
    \write\glswrite{numhead_positive \string"glsnumbers\string"}
    \write\glswrite{page_compositor \string"\glscompositor\string"}
    \@gls@escbsdq\gls@suffixF
    \@gls@escbsdq\gls@suffixFF
    \ifx\gls@suffixF\@empty
    \else
      \write\glswrite{suffix_2p \string"\gls@suffixF\string"}
    \fi
    \ifx\gls@suffixFF\@empty
    \else
      \write\glswrite{suffix_3p \string"\gls@suffixFF\string"}
    \fi
    \noist
  }
\fi
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\noist}
%    \begin{macrocode}
\renewcommand*{\noist}{\let\writeist\relax}
%    \end{macrocode}
%\end{macro}
%\iffalse
%    \begin{macrocode}
%</glossaries-compatible-207.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-compatible-307.sty>
%    \end{macrocode}
%\fi
%\section{glossaries-compatible-307}
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{glossaries-compatible-307}[2021/11/01 v4.49 (NLCT)]
%    \end{macrocode}
%
% Compatibility macros for predefined glossary styles:
%\begin{macro}{\compatglossarystyle}
% Defines a compatibility glossary style.
%    \begin{macrocode}
\newcommand{\compatglossarystyle}[2]{%
  \ifcsundef{@glscompstyle@#1}%
  {%
    \csdef{@glscompstyle@#1}{#2}%
  }%
  {%
    \PackageError{glossaries}{Glossary compatibility style `#1' is already defined}{}%
  }%
}
%    \end{macrocode}
%\end{macro}
% Backward compatible \glostyle{inline} style.
%    \begin{macrocode}
\compatglossarystyle{inline}{%
  \renewcommand{\glossaryentryfield}[5]{%
    \glsinlinedopostchild
    \gls@inlinesep
    \def\glo@desc{##3}%
    \def\@no@post@desc{\nopostdesc}%
    \glsentryitem{##1}\glsinlinenameformat{##1}{##2}%
    \ifx\glo@desc\@no@post@desc
      \glsinlineemptydescformat{##4}{##5}%
    \else
      \ifstrempty{##3}%
      {\glsinlineemptydescformat{##4}{##5}}%
      {\glsinlinedescformat{##3}{##4}{##5}}%
    \fi
    \ifglshaschildren{##1}%
    {%
       \glsresetsubentrycounter
       \glsinlineparentchildseparator
       \def\gls@inlinesubsep{}%
       \def\gls@inlinepostchild{\glsinlinepostchild}%
    }%
    {}%
    \def\gls@inlinesep{\glsinlineseparator}%
  }%
%    \end{macrocode}
% Sub-entries display description:
%    \begin{macrocode}
  \renewcommand{\glossarysubentryfield}[6]{%
    \gls@inlinesubsep%
    \glsinlinesubnameformat{##2}{##3}%
    \glssubentryitem{##2}\glsinlinesubdescformat{##4}{##5}{##6}%
    \def\gls@inlinesubsep{\glsinlinesubseparator}%
  }%
}
%    \end{macrocode}
% Backward compatible \glostyle{list} style.
%    \begin{macrocode}
\compatglossarystyle{list}{%
  \renewcommand*{\glossaryentryfield}[5]{%
    \item[\glsentryitem{##1}\glstarget{##1}{##2}]
       ##3\glspostdescription\space ##5}%
%    \end{macrocode}
% Sub-entries continue on the same line:
%    \begin{macrocode}
  \renewcommand*{\glossarysubentryfield}[6]{%
    \glssubentryitem{##2}%
    \glstarget{##2}{\strut}##4\glspostdescription\space ##6.}%
}
%    \end{macrocode}
% Backward compatible \glostyle{listgroup} style.
%    \begin{macrocode}
\compatglossarystyle{listgroup}{%
 \csuse{@glscompstyle@list}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{listhypergroup} style.
%    \begin{macrocode}
\compatglossarystyle{listhypergroup}{%
 \csuse{@glscompstyle@list}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{altlist} style.
%    \begin{macrocode}
\compatglossarystyle{altlist}{%
  \renewcommand*{\glossaryentryfield}[5]{%
    \item[\glsentryitem{##1}\glstarget{##1}{##2}]%
      \mbox{}\par\nobreak\@afterheading
      ##3\glspostdescription\space ##5}%
  \renewcommand{\glossarysubentryfield}[6]{%
    \par
    \glssubentryitem{##2}%
    \glstarget{##2}{\strut}##4\glspostdescription\space ##6}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{altlistgroup} style.
%    \begin{macrocode}
\compatglossarystyle{altlistgroup}{%
 \csuse{@glscompstyle@altlist}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{altlisthypergroup} style.
%    \begin{macrocode}
\compatglossarystyle{altlisthypergroup}{%
 \csuse{@glscompstyle@altlist}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{listdotted} style.
%    \begin{macrocode}
\compatglossarystyle{listdotted}{%
  \renewcommand*{\glossaryentryfield}[5]{%
    \item[]\makebox[\glslistdottedwidth][l]{%
      \glsentryitem{##1}\glstarget{##1}{##2}%
      \unskip\leaders\hbox to 2.9mm{\hss.}\hfill\strut}##3}%
  \renewcommand*{\glossarysubentryfield}[6]{%
    \item[]\makebox[\glslistdottedwidth][l]{%
    \glssubentryitem{##2}%
    \glstarget{##2}{##3}%
    \unskip\leaders\hbox to 2.9mm{\hss.}\hfill\strut}##4}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{sublistdotted} style.
%    \begin{macrocode}
\compatglossarystyle{sublistdotted}{%
  \csuse{@glscompstyle@listdotted}%
  \renewcommand*{\glossaryentryfield}[5]{%
    \item[\glsentryitem{##1}\glstarget{##1}{##2}]}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{long} style.
%    \begin{macrocode}
\compatglossarystyle{long}{%
  \renewcommand*{\glossaryentryfield}[5]{%
    \glsentryitem{##1}\glstarget{##1}{##2} & ##3\glspostdescription\space ##5\\}%
  \renewcommand*{\glossarysubentryfield}[6]{%
     &
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}##4\glspostdescription\space ##6\\}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{longborder} style.
%    \begin{macrocode}
\compatglossarystyle{longborder}{%
 \csuse{@glscompstyle@long}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{longheader} style.
%    \begin{macrocode}
\compatglossarystyle{longheader}{%
 \csuse{@glscompstyle@long}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{longheaderborder} style.
%    \begin{macrocode}
\compatglossarystyle{longheaderborder}{%
 \csuse{@glscompstyle@long}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{long3col} style.
%    \begin{macrocode}
\compatglossarystyle{long3col}{%
  \renewcommand*{\glossaryentryfield}[5]{%
    \glsentryitem{##1}\glstarget{##1}{##2} & ##3 & ##5\\}%
  \renewcommand*{\glossarysubentryfield}[6]{%
     &
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}##4 & ##6\\}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{long3colborder} style.
%    \begin{macrocode}
\compatglossarystyle{long3colborder}{%
 \csuse{@glscompstyle@long3col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{long3colheader} style.
%    \begin{macrocode}
\compatglossarystyle{long3colheader}{%
 \csuse{@glscompstyle@long3col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{long3colheaderborder} style.
%    \begin{macrocode}
\compatglossarystyle{long3colheaderborder}{%
 \csuse{@glscompstyle@long3col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{long4col} style.
%    \begin{macrocode}
\compatglossarystyle{long4col}{%
  \renewcommand*{\glossaryentryfield}[5]{%
    \glsentryitem{##1}\glstarget{##1}{##2} & ##3 & ##4 & ##5\\}%
  \renewcommand*{\glossarysubentryfield}[6]{%
     &
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}##4 & ##5 & ##6\\}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{long4colheader} style.
%    \begin{macrocode}
\compatglossarystyle{long4colheader}{%
 \csuse{@glscompstyle@long4col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{long4colborder} style.
%    \begin{macrocode}
\compatglossarystyle{long4colborder}{%
 \csuse{@glscompstyle@long4col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{long4colheaderborder} style.
%    \begin{macrocode}
\compatglossarystyle{long4colheaderborder}{%
 \csuse{@glscompstyle@long4col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{altlong4col} style.
%    \begin{macrocode}
\compatglossarystyle{altlong4col}{%
 \csuse{@glscompstyle@long4col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{altlong4colheader} style.
%    \begin{macrocode}
\compatglossarystyle{altlong4colheader}{%
 \csuse{@glscompstyle@long4col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{altlong4colborder} style.
%    \begin{macrocode}
\compatglossarystyle{altlong4colborder}{%
 \csuse{@glscompstyle@long4col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{altlong4colheaderborder} style.
%    \begin{macrocode}
\compatglossarystyle{altlong4colheaderborder}{%
 \csuse{@glscompstyle@long4col}%
}%
%    \end{macrocode}
%
% Backward compatible \glostyle{long} style.
%    \begin{macrocode}
\compatglossarystyle{longragged}{%
  \renewcommand*{\glossaryentryfield}[5]{%
    \glsentryitem{##1}\glstarget{##1}{##2} & ##3\glspostdescription\space ##5%
    \tabularnewline}%
  \renewcommand*{\glossarysubentryfield}[6]{%
     &
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}##4\glspostdescription\space ##6%
    \tabularnewline}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{longraggedborder} style.
%    \begin{macrocode}
\compatglossarystyle{longraggedborder}{%
 \csuse{@glscompstyle@longragged}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{longraggedheader} style.
%    \begin{macrocode}
\compatglossarystyle{longraggedheader}{%
 \csuse{@glscompstyle@longragged}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{longraggedheaderborder} style.
%    \begin{macrocode}
\compatglossarystyle{longraggedheaderborder}{%
 \csuse{@glscompstyle@longragged}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{longragged3col} style.
%    \begin{macrocode}
\compatglossarystyle{longragged3col}{%
  \renewcommand*{\glossaryentryfield}[5]{%
    \glsentryitem{##1}\glstarget{##1}{##2} & ##3 & ##5\tabularnewline}%
  \renewcommand*{\glossarysubentryfield}[6]{%
     &
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}##4 & ##6\tabularnewline}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{longragged3colborder} style.
%    \begin{macrocode}
\compatglossarystyle{longragged3colborder}{%
 \csuse{@glscompstyle@longragged3col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{longragged3colheader} style.
%    \begin{macrocode}
\compatglossarystyle{longragged3colheader}{%
 \csuse{@glscompstyle@longragged3col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{longragged3colheaderborder} style.
%    \begin{macrocode}
\compatglossarystyle{longragged3colheaderborder}{%
 \csuse{@glscompstyle@longragged3col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{altlongragged4col} style.
%    \begin{macrocode}
\compatglossarystyle{altlongragged4col}{%
  \renewcommand*{\glossaryentryfield}[5]{%
    \glsentryitem{##1}\glstarget{##1}{##2} & ##3 & ##4 & ##5\tabularnewline}%
  \renewcommand*{\glossarysubentryfield}[6]{%
     &
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}##4 & ##5 & ##6\tabularnewline}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{altlongragged4colheader} style.
%    \begin{macrocode}
\compatglossarystyle{altlongragged4colheader}{%
 \csuse{@glscompstyle@altlong4col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{altlongragged4colborder} style.
%    \begin{macrocode}
\compatglossarystyle{altlongragged4colborder}{%
 \csuse{@glscompstyle@altlong4col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{altlongragged4colheaderborder} style.
%    \begin{macrocode}
\compatglossarystyle{altlongragged4colheaderborder}{%
 \csuse{@glscompstyle@altlong4col}%
}%
%    \end{macrocode}
%
% Backward compatible \glostyle{index} style.
%    \begin{macrocode}
\compatglossarystyle{index}{%
  \renewcommand*{\glossaryentryfield}[5]{%
    \item\glsentryitem{##1}\textbf{\glstarget{##1}{##2}}%
      \ifx\relax##4\relax
      \else
        \space(##4)%
      \fi
      \space ##3\glspostdescription \space ##5}%
  \renewcommand*{\glossarysubentryfield}[6]{%
    \ifcase##1\relax
      % level 0
      \item
    \or
      % level 1
      \subitem
      \glssubentryitem{##2}%
    \else
      % all other levels
      \subsubitem
    \fi
    \textbf{\glstarget{##2}{##3}}%
    \ifx\relax##5\relax
    \else
      \space(##5)%
    \fi
    \space##4\glspostdescription\space ##6}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{indexgroup} style.
%    \begin{macrocode}
\compatglossarystyle{indexgroup}{%
 \csuse{@glscompstyle@index}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{indexhypergroup} style.
%    \begin{macrocode}
\compatglossarystyle{indexhypergroup}{%
 \csuse{@glscompstyle@index}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{tree} style.
%    \begin{macrocode}
\compatglossarystyle{tree}{%
  \renewcommand{\glossaryentryfield}[5]{%
    \hangindent0pt\relax
    \parindent0pt\relax
    \glsentryitem{##1}\textbf{\glstarget{##1}{##2}}%
    \ifx\relax##4\relax
    \else
      \space(##4)%
    \fi
    \space ##3\glspostdescription \space ##5\par}%
  \renewcommand{\glossarysubentryfield}[6]{%
    \hangindent##1\glstreeindent\relax
    \parindent##1\glstreeindent\relax
    \ifnum##1=1\relax
      \glssubentryitem{##2}%
    \fi
    \textbf{\glstarget{##2}{##3}}%
    \ifx\relax##5\relax
    \else
      \space(##5)%
    \fi
    \space##4\glspostdescription\space ##6\par}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{treegroup} style.
%    \begin{macrocode}
\compatglossarystyle{treegroup}{%
 \csuse{@glscompstyle@tree}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{treehypergroup} style.
%    \begin{macrocode}
\compatglossarystyle{treehypergroup}{%
 \csuse{@glscompstyle@tree}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{treenoname} style.
%    \begin{macrocode}
\compatglossarystyle{treenoname}{%
  \renewcommand{\glossaryentryfield}[5]{%
    \hangindent0pt\relax
    \parindent0pt\relax
    \glsentryitem{##1}\textbf{\glstarget{##1}{##2}}%
    \ifx\relax##4\relax
    \else
      \space(##4)%
    \fi
    \space ##3\glspostdescription \space ##5\par}%
  \renewcommand{\glossarysubentryfield}[6]{%
    \hangindent##1\glstreeindent\relax
    \parindent##1\glstreeindent\relax
    \ifnum##1=1\relax
      \glssubentryitem{##2}%
    \fi
    \glstarget{##2}{\strut}%
    ##4\glspostdescription\space ##6\par}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{treenonamegroup} style.
%    \begin{macrocode}
\compatglossarystyle{treenonamegroup}{%
 \csuse{@glscompstyle@treenoname}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{treenonamehypergroup} style.
%    \begin{macrocode}
\compatglossarystyle{treenonamehypergroup}{%
 \csuse{@glscompstyle@treenoname}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{alttree} style.
%    \begin{macrocode}
\compatglossarystyle{alttree}{%
  \renewcommand{\glossaryentryfield}[5]{%
    \ifnum\@gls@prevlevel=0\relax
    \else
       \settowidth{\glstreeindent}{\textbf{\@glswidestname\space}}%
      \hangindent\glstreeindent
      \parindent\glstreeindent
    \fi
    \makebox[0pt][r]{\makebox[\glstreeindent][l]{%
       \glsentryitem{##1}\textbf{\glstarget{##1}{##2}}}}%
    \ifx\relax##4\relax
    \else
      (##4)\space
    \fi
    ##3\glspostdescription \space ##5\par
    \def\@gls@prevlevel{0}%
  }%
  \renewcommand{\glossarysubentryfield}[6]{%
    \ifnum##1=1\relax
      \glssubentryitem{##2}%
    \fi
    \ifnum\@gls@prevlevel=##1\relax
    \else
      \@ifundefined{@glswidestname\romannumeral##1}{%
        \settowidth{\gls@tmplen}{\textbf{\@glswidestname\space}}}{%
        \settowidth{\gls@tmplen}{\textbf{%
           \csname @glswidestname\romannumeral##1\endcsname\space}}}%
      \ifnum\@gls@prevlevel<##1\relax
         \setlength\glstreeindent\gls@tmplen
         \addtolength\glstreeindent\parindent
         \parindent\glstreeindent
      \else
         \@ifundefined{@glswidestname\romannumeral\@gls@prevlevel}{%
           \settowidth{\glstreeindent}{\textbf{%
              \@glswidestname\space}}}{%
           \settowidth{\glstreeindent}{\textbf{%
              \csname @glswidestname\romannumeral\@gls@prevlevel
                 \endcsname\space}}}%
         \addtolength\parindent{-\glstreeindent}%
         \setlength\glstreeindent\parindent
      \fi
    \fi
    \hangindent\glstreeindent
    \makebox[0pt][r]{\makebox[\gls@tmplen][l]{%
      \textbf{\glstarget{##2}{##3}}}}%
    \ifx##5\relax\relax
    \else
      (##5)\space
    \fi
    ##4\glspostdescription\space ##6\par
    \def\@gls@prevlevel{##1}%
  }%
}%
%    \end{macrocode}
% Backward compatible \glostyle{alttreegroup} style.
%    \begin{macrocode}
\compatglossarystyle{alttreegroup}{%
 \csuse{@glscompstyle@alttree}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{alttreehypergroup} style.
%    \begin{macrocode}
\compatglossarystyle{alttreehypergroup}{%
 \csuse{@glscompstyle@alttree}%
}%
%    \end{macrocode}
%
% Backward compatible \glostyle{mcolindex} style.
%    \begin{macrocode}
\compatglossarystyle{mcolindex}{%
 \csuse{@glscompstyle@index}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{mcolindexgroup} style.
%    \begin{macrocode}
\compatglossarystyle{mcolindexgroup}{%
 \csuse{@glscompstyle@index}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{mcolindexhypergroup} style.
%    \begin{macrocode}
\compatglossarystyle{mcolindexhypergroup}{%
 \csuse{@glscompstyle@index}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{mcoltree} style.
%    \begin{macrocode}
\compatglossarystyle{mcoltree}{%
 \csuse{@glscompstyle@tree}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{mcoltreegroup} style.
%    \begin{macrocode}
\compatglossarystyle{mcolindextreegroup}{%
 \csuse{@glscompstyle@tree}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{mcoltreehypergroup} style.
%    \begin{macrocode}
\compatglossarystyle{mcolindextreehypergroup}{%
 \csuse{@glscompstyle@tree}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{mcoltreenoname} style.
%    \begin{macrocode}
\compatglossarystyle{mcoltreenoname}{%
 \csuse{@glscompstyle@tree}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{mcoltreenonamegroup} style.
%    \begin{macrocode}
\compatglossarystyle{mcoltreenonamegroup}{%
 \csuse{@glscompstyle@tree}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{mcoltreenonamehypergroup} style.
%    \begin{macrocode}
\compatglossarystyle{mcoltreenonamehypergroup}{%
 \csuse{@glscompstyle@tree}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{mcolalttree} style.
%    \begin{macrocode}
\compatglossarystyle{mcolalttree}{%
 \csuse{@glscompstyle@alttree}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{mcolalttreegroup} style.
%    \begin{macrocode}
\compatglossarystyle{mcolalttreegroup}{%
 \csuse{@glscompstyle@alttree}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{mcolalttreehypergroup} style.
%    \begin{macrocode}
\compatglossarystyle{mcolalttreehypergroup}{%
 \csuse{@glscompstyle@alttree}%
}%
%    \end{macrocode}

% Backward compatible \glostyle{superragged} style.
%    \begin{macrocode}
\compatglossarystyle{superragged}{%
  \renewcommand*{\glossaryentryfield}[5]{%
    \glsentryitem{##1}\glstarget{##1}{##2} & ##3\glspostdescription\space ##5%
      \tabularnewline}%
  \renewcommand*{\glossarysubentryfield}[6]{%
     &
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}##4\glspostdescription\space ##6%
     \tabularnewline}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{superraggedborder} style.
%    \begin{macrocode}
\compatglossarystyle{superraggedborder}{%
 \csuse{@glscompstyle@superragged}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{superraggedheader} style.
%    \begin{macrocode}
\compatglossarystyle{superraggedheader}{%
 \csuse{@glscompstyle@superragged}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{superraggedheaderborder} style.
%    \begin{macrocode}
\compatglossarystyle{superraggedheaderborder}{%
 \csuse{@glscompstyle@superragged}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{superragged3col} style.
%    \begin{macrocode}
\compatglossarystyle{superragged3col}{%
  \renewcommand*{\glossaryentryfield}[5]{%
    \glsentryitem{##1}\glstarget{##1}{##2} & ##3 & ##5\tabularnewline}%
  \renewcommand*{\glossarysubentryfield}[6]{%
     &
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}##4 & ##6\tabularnewline}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{superragged3colborder} style.
%    \begin{macrocode}
\compatglossarystyle{superragged3colborder}{%
 \csuse{@glscompstyle@superragged3col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{superragged3colheader} style.
%    \begin{macrocode}
\compatglossarystyle{superragged3colheader}{%
 \csuse{@glscompstyle@superragged3col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{superragged3colheaderborder} style.
%    \begin{macrocode}
\compatglossarystyle{superragged3colheaderborder}{%
 \csuse{@glscompstyle@superragged3col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{altsuperragged4col} style.
%    \begin{macrocode}
\compatglossarystyle{altsuperragged4col}{%
  \renewcommand*{\glossaryentryfield}[5]{%
    \glsentryitem{##1}\glstarget{##1}{##2} & ##3 & ##4 & ##5\tabularnewline}%
  \renewcommand*{\glossarysubentryfield}[6]{%
     &
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}##4 & ##5 & ##6\tabularnewline}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{altsuperragged4colheader} style.
%    \begin{macrocode}
\compatglossarystyle{altsuperragged4colheader}{%
 \csuse{@glscompstyle@altsuperragged4col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{altsuperragged4colborder} style.
%    \begin{macrocode}
\compatglossarystyle{altsuperragged4colborder}{%
 \csuse{@glscompstyle@altsuperragged4col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{altsuperragged4colheaderborder} style.
%    \begin{macrocode}
\compatglossarystyle{altsuperragged4colheaderborder}{%
 \csuse{@glscompstyle@altsuperragged4col}%
}%
%    \end{macrocode}
%
% Backward compatible \glostyle{super} style.
%    \begin{macrocode}
\compatglossarystyle{super}{%
  \renewcommand*{\glossaryentryfield}[5]{%
    \glsentryitem{##1}\glstarget{##1}{##2} & ##3\glspostdescription\space ##5\\}%
  \renewcommand*{\glossarysubentryfield}[6]{%
     &
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}##4\glspostdescription\space ##6\\}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{superborder} style.
%    \begin{macrocode}
\compatglossarystyle{superborder}{%
 \csuse{@glscompstyle@super}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{superheader} style.
%    \begin{macrocode}
\compatglossarystyle{superheader}{%
 \csuse{@glscompstyle@super}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{superheaderborder} style.
%    \begin{macrocode}
\compatglossarystyle{superheaderborder}{%
 \csuse{@glscompstyle@super}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{super3col} style.
%    \begin{macrocode}
\compatglossarystyle{super3col}{%
  \renewcommand*{\glossaryentryfield}[5]{%
    \glsentryitem{##1}\glstarget{##1}{##2} & ##3 & ##5\\}%
  \renewcommand*{\glossarysubentryfield}[6]{%
     &
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}##4 & ##6\\}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{super3colborder} style.
%    \begin{macrocode}
\compatglossarystyle{super3colborder}{%
 \csuse{@glscompstyle@super3col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{super3colheader} style.
%    \begin{macrocode}
\compatglossarystyle{super3colheader}{%
 \csuse{@glscompstyle@super3col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{super3colheaderborder} style.
%    \begin{macrocode}
\compatglossarystyle{super3colheaderborder}{%
 \csuse{@glscompstyle@super3col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{super4col} style.
%    \begin{macrocode}
\compatglossarystyle{super4col}{%
  \renewcommand*{\glossaryentryfield}[5]{%
    \glsentryitem{##1}\glstarget{##1}{##2} & ##3 & ##4 & ##5\\}%
  \renewcommand*{\glossarysubentryfield}[6]{%
     &
     \glssubentryitem{##2}%
     \glstarget{##2}{\strut}##4 & ##5 & ##6\\}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{super4colheader} style.
%    \begin{macrocode}
\compatglossarystyle{super4colheader}{%
 \csuse{@glscompstyle@super4col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{super4colborder} style.
%    \begin{macrocode}
\compatglossarystyle{super4colborder}{%
 \csuse{@glscompstyle@super4col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{super4colheaderborder} style.
%    \begin{macrocode}
\compatglossarystyle{super4colheaderborder}{%
 \csuse{@glscompstyle@super4col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{altsuper4col} style.
%    \begin{macrocode}
\compatglossarystyle{altsuper4col}{%
 \csuse{@glscompstyle@super4col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{altsuper4colheader} style.
%    \begin{macrocode}
\compatglossarystyle{altsuper4colheader}{%
 \csuse{@glscompstyle@super4col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{altsuper4colborder} style.
%    \begin{macrocode}
\compatglossarystyle{altsuper4colborder}{%
 \csuse{@glscompstyle@super4col}%
}%
%    \end{macrocode}
% Backward compatible \glostyle{altsuper4colheaderborder} style.
%    \begin{macrocode}
\compatglossarystyle{altsuper4colheaderborder}{%
 \csuse{@glscompstyle@super4col}%
}%
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-compatible-307.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-accsupp.sty>
%    \end{macrocode}
%\fi
%\chapter{Accessibility Support (glossaries-accsupp Code)}
%\label{sec:code:accsupp}
% The \isty{glossaries-accsupp} package is experimental. It is
% intended to provide a means of using the PDF accessibilty support
% in glossary entries. See the \isty{accsupp} documentation for
% further details about accessibility support.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
%    \end{macrocode}
% Package version number now in line with main glossaries package number.
%    \begin{macrocode}
\ProvidesPackage{glossaries-accsupp}[2021/11/01 v4.49 (NLCT)
  Experimental glossaries accessibility]
%    \end{macrocode}
% Pass all options to \sty{glossaries}:
%    \begin{macrocode}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{glossaries}}
%    \end{macrocode}
% Process options:
%    \begin{macrocode}
\ProcessOptions
%    \end{macrocode}
% This package should be loaded before \sty{glossaries-extra}, so
% complain if that has already been loaded.
%    \begin{macrocode}
\@ifpackageloaded{glossaries-extra}
{%
%    \end{macrocode}
%If the \pkgoptfmt{accsupp} option was used, \cs{@glsxtr@doaccsupp}
%will have been set, otherwise it will be empty.
%\changes{4.29}{2017-01-19}{added check for \cs{@glsxtr@doaccsupp}}
%    \begin{macrocode}
  \ifx\@glsxtr@doaccsupp\empty
   \GlossariesWarning{The `glossaries-accsupp'
   package has been loaded\MessageBreak 
   after the `glossaries-extra' package. This\MessageBreak
   can cause a failure to integrate both packages. \MessageBreak
   Either use the `accsupp' option when you load\MessageBreak
   `glossaries-extra' or load `glossaries-accsupp'\MessageBreak
   before loading `glossaries-extra'}%
  \fi
}
{}
%    \end{macrocode}
%
%\begin{macro}{\compatibleglossentry}
% Override style compatibility macros:
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.04}{2014-03-06}{changed \cs{newcommand} to \cs{def} as is may or
%may not be defined}
%    \begin{macrocode}
\def\compatibleglossentry#1#2{%
  \toks@{#2}%
  \protected@edef\@do@glossentry{%
    \noexpand\accsuppglossaryentryfield{#1}%
    {\noexpand\glsnamefont
       {\expandafter\expandonce\csname glo@\glsdetoklabel{#1}@name\endcsname}}%
    {\expandafter\expandonce\csname glo@\glsdetoklabel{#1}@desc\endcsname}%
    {\expandafter\expandonce\csname glo@\glsdetoklabel{#1}@symbol\endcsname}%
    {\the\toks@}%
  }%
  \@do@glossentry
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\compatiblesubglossentry}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.04}{2014-03-06}{changed \cs{newcommand} to \cs{def} as is may or
%may not be defined}
%    \begin{macrocode}
\def\compatiblesubglossentry#1#2#3{%
  \toks@{#3}%
  \protected@edef\@do@subglossentry{%
    \noexpand\accsuppglossarysubentryfield{\number#1}%
    {#2}%
    {\noexpand\glsnamefont
      {\expandafter\expandonce\csname glo@\glsdetoklabel{#2}@name\endcsname}}%
    {\expandafter\expandonce\csname glo@\glsdetoklabel{#2}@desc\endcsname}%
    {\expandafter\expandonce\csname glo@\glsdetoklabel{#2}@symbol\endcsname}%
    {\the\toks@}%
  }%
  \@do@subglossentry
}
%    \end{macrocode}
%\end{macro}
% Required packages:
%    \begin{macrocode}
\RequirePackage{glossaries}
%    \end{macrocode}
%
%\begin{macro}{\gls@accsupp@engine}
%\changes{4.45}{2020-02-13}{new}
%There's currently only support for \sty{accsupp}, but if you
%define \cs{gls@accsupp@engine} before loading
%\sty{glossaries-accsupp}, you can prevent \sty{accsupp} from being
%loaded. Redefining this command after \sty{glossaries-accsupp} has loaded
%obviously won't do anything (and so is an internal command to
%deter casual use). If it is defined to something other than
%"accsupp" then \cs{gls@accessibility} will need to be defined to
%something appropriate.
%    \begin{macrocode}
\providecommand{\gls@accsupp@engine}{accsupp}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@accessibility}
%\changes{4.45}{2020-02-13}{new}
%\begin{definition}
%\cs{gls@accessibility}\marg{options}\marg{PDF element}\marg{value}\marg{content}
%\end{definition}
%    \begin{macrocode}
\providecommand{\gls@accessibility}[4]{#4}
\ifdefstring\gls@accsupp@engine{accsupp}
{
  \RequirePackage{accsupp}
  \renewcommand{\gls@accessibility}[4]{%
    \BeginAccSupp{#1,#2={#3}}#4\EndAccSupp{}%
  }
}
{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccessibility}
%\changes{4.45}{2020-02-13}{new}
%\begin{definition}
%\cs{glsaccessibility}\oarg{options}\marg{PDF element}\marg{value}\marg{content}
%\end{definition}
%User-level command that includes debug info if required.
%    \begin{macrocode}
\newcommand{\glsaccessibility}[4][]{%
 \@glsshowaccsupp{#1}{#2}{#3}%
 \gls@accessibility{#1}{#2}{#3}{#4}%
}
%    \end{macrocode}
%\end{macro}
% 
%\section{Defining Replacement Text}
% The version 0.1 stored the replacement text in the
% \gloskey{symbol} key. This has been changed to use the
% new keys defined here. Example of use:
%\begin{verbatim}
%\newglossaryentry{dr}{name=Dr,description={},access={Doctor}}
%\end{verbatim}
%\begin{key}{access}
% The replacement text corresponding to the \gloskey{name} key:
%    \begin{macrocode}
\define@key{glossentry}{access}{%
  \def\@glo@access{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{textaccess}
% The replacement text corresponding to the \gloskey{text} key:
%    \begin{macrocode}
\define@key{glossentry}{textaccess}{%
  \def\@glo@textaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{firstaccess}
% The replacement text corresponding to the \gloskey{first} key:
%    \begin{macrocode}
\define@key{glossentry}{firstaccess}{%
  \def\@glo@firstaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{pluralaccess}
% The replacement text corresponding to the \gloskey{plural} key:
%    \begin{macrocode}
\define@key{glossentry}{pluralaccess}{%
  \def\@glo@pluralaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{firstpluralaccess}
% The replacement text corresponding to the \gloskey{firstplural} key:
%    \begin{macrocode}
\define@key{glossentry}{firstpluralaccess}{%
  \def\@glo@firstpluralaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{symbolaccess}
% The replacement text corresponding to the \gloskey{symbol} key:
%    \begin{macrocode}
\define@key{glossentry}{symbolaccess}{%
  \def\@glo@symbolaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{symbolpluralaccess}
% The replacement text corresponding to the \gloskey{symbolplural} key:
%    \begin{macrocode}
\define@key{glossentry}{symbolpluralaccess}{%
  \def\@glo@symbolpluralaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{descriptionaccess}
% The replacement text corresponding to the \gloskey{description} key:
%    \begin{macrocode}
\define@key{glossentry}{descriptionaccess}{%
  \def\@glo@descaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{descriptionpluralaccess}
% The replacement text corresponding to the \gloskey{descriptionplural} key:
%    \begin{macrocode}
\define@key{glossentry}{descriptionpluralaccess}{%
  \def\@glo@descpluralaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{shortaccess}
% The replacement text corresponding to the \gloskey{short} key:
%    \begin{macrocode}
\define@key{glossentry}{shortaccess}{%
  \def\@glo@shortaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{shortpluralaccess}
% The replacement text corresponding to the \gloskey{shortplural} key:
%    \begin{macrocode}
\define@key{glossentry}{shortpluralaccess}{%
  \def\@glo@shortpluralaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{longaccess}
% The replacement text corresponding to the \gloskey{long} key:
%    \begin{macrocode}
\define@key{glossentry}{longaccess}{%
  \def\@glo@longaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{longpluralaccess}
% The replacement text corresponding to the \gloskey{longplural} key:
%    \begin{macrocode}
\define@key{glossentry}{longpluralaccess}{%
  \def\@glo@longpluralaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%There are now also keys that correspond to the user keys:
%\begin{key}{user1access}
%\changes{4.45}{2020-02-13}{new}
% The replacement text corresponding to the \gloskey{user1} key:
%    \begin{macrocode}
\define@key{glossentry}{user1access}{%
  \def\@glo@useriaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{user2access}
%\changes{4.45}{2020-02-13}{new}
% The replacement text corresponding to the \gloskey{user2} key:
%    \begin{macrocode}
\define@key{glossentry}{user2access}{%
  \def\@glo@useriiaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{user3access}
%\changes{4.45}{2020-02-13}{new}
% The replacement text corresponding to the \gloskey{user3} key:
%    \begin{macrocode}
\define@key{glossentry}{user3access}{%
  \def\@glo@useriiiaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{user4access}
%\changes{4.45}{2020-02-13}{new}
% The replacement text corresponding to the \gloskey{user4} key:
%    \begin{macrocode}
\define@key{glossentry}{user4access}{%
  \def\@glo@userivaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{user5access}
%\changes{4.45}{2020-02-13}{new}
% The replacement text corresponding to the \gloskey{user5} key:
%    \begin{macrocode}
\define@key{glossentry}{user5access}{%
  \def\@glo@uservaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{user6access}
%\changes{4.45}{2020-02-13}{new}
% The replacement text corresponding to the \gloskey{user6} key:
%    \begin{macrocode}
\define@key{glossentry}{user6access}{%
  \def\@glo@userviaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%
% For any custom keys, the replacement text would have to be
% explicitly put in the value, e.g.,
% "user1={\glsshortaccsupp{inches}{in}}".
%
% Append these new keys to \cs{@gls@keymap}:
%    \begin{macrocode}
\appto\@gls@keymap{,%
  {access}{access},%
  {textaccess}{textaccess},%
  {firstaccess}{firstaccess},%
  {pluralaccess}{pluralaccess},%
  {firstpluralaccess}{firstpluralaccess},%
  {symbolaccess}{symbolaccess},%
  {symbolpluralaccess}{symbolpluralaccess},%
  {descaccess}{descaccess},%
  {descpluralaccess}{descpluralaccess},%
  {shortaccess}{shortaccess},%
  {shortpluralaccess}{shortpluralaccess},%
  {longaccess}{longaccess},%
  {longpluralaccess}{longpluralaccess},%
  {user1access}{useriaccess},%
  {user2access}{useriiaccess},%
  {user3access}{useriiiaccess},%
  {user4access}{userivaccess},%
  {user5access}{uservaccess},%
  {user6access}{userviaccess}%
}
%    \end{macrocode}
%
%\begin{macro}{\@gls@noaccess}
% Indicates that no replacement text has been provided.
%    \begin{macrocode}
\def\@gls@noaccess{\relax}
%    \end{macrocode}
%\end{macro}
%
% Previously, the \gloskey{access} key  was initialised to
% the value of the \gloskey{symbol} key at the start for backwards 
% compatibility. This causes a problem for situations where the
% replacement text is provided for \gloskey{symbol} but not for
% \gloskey{name} so this behaviour has been removed.
%\changes{4.45}{2020-02-13}{removed backward compatibility use of
%symbol key}
%    \begin{macrocode}
\let\@gls@oldnewglossaryentryprehook\@newglossaryentryprehook
\renewcommand*{\@newglossaryentryprehook}{%
  \@gls@oldnewglossaryentryprehook
  \def\@glo@access{\relax}%
%    \end{macrocode}
% Initialise the other keys:
%    \begin{macrocode}
  \def\@glo@textaccess{\@glo@access}%
  \def\@glo@firstaccess{\@glo@access}%
  \def\@glo@pluralaccess{\@glo@textaccess}%
  \def\@glo@firstpluralaccess{\@glo@pluralaccess}%
  \def\@glo@symbolaccess{\relax}%
  \def\@glo@symbolpluralaccess{\@glo@symbolaccess}%
  \def\@glo@descaccess{\relax}%
  \def\@glo@descpluralaccess{\@glo@descaccess}%
  \def\@glo@shortaccess{\relax}%
  \def\@glo@shortpluralaccess{\@glo@shortaccess}%
  \def\@glo@longaccess{\relax}%
  \def\@glo@longpluralaccess{\@glo@longaccess}%
  \def\@glo@useriaccess{\relax}%
  \def\@glo@useriiaccess{\relax}%
  \def\@glo@useriiiaccess{\relax}%
  \def\@glo@userivaccess{\relax}%
  \def\@glo@uservaccess{\relax}%
  \def\@glo@userviaccess{\relax}%
}
%    \end{macrocode}
% Add to the end hook:
%    \begin{macrocode}
\let\@gls@oldnewglossaryentryposthook\@newglossaryentryposthook
\renewcommand*{\@newglossaryentryposthook}{%
  \@gls@oldnewglossaryentryposthook
%    \end{macrocode}
% Store the access information:
%    \begin{macrocode}
  \expandafter
    \protected@xdef\csname glo@\@glo@label @access\endcsname{%
      \@glo@access}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @textaccess\endcsname{%
      \@glo@textaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @firstaccess\endcsname{%
      \@glo@firstaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @pluralaccess\endcsname{%
      \@glo@pluralaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @firstpluralaccess\endcsname{%
      \@glo@firstpluralaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @symbolaccess\endcsname{%
      \@glo@symbolaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @symbolpluralaccess\endcsname{%
      \@glo@symbolpluralaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @descaccess\endcsname{%
      \@glo@descaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @descpluralaccess\endcsname{%
      \@glo@descpluralaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @shortaccess\endcsname{%
      \@glo@shortaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @shortpluralaccess\endcsname{%
      \@glo@shortpluralaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @longaccess\endcsname{%
      \@glo@longaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @longpluralaccess\endcsname{%
      \@glo@longpluralaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @useriaccess\endcsname{%
      \@glo@useriaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @useriiaccess\endcsname{%
      \@glo@useriiaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @useriiiaccess\endcsname{%
      \@glo@useriiiaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @userivaccess\endcsname{%
      \@glo@userivaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @uservaccess\endcsname{%
      \@glo@uservaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @userviaccess\endcsname{%
      \@glo@userviaccess}%
}
%    \end{macrocode}
%
%\section{Accessing Replacement Text}
%\begin{macro}{\glsentryaccess}
% Get the value of the \gloskey{access} key for the entry with
% the given label:
%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}}
%    \begin{macrocode}
\newcommand*{\glsentryaccess}[1]{%
  \@gls@entry@field{#1}{access}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentrytextaccess}
% Get the value of the \gloskey{textaccess} key for the entry with
% the given label:
%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}}
%    \begin{macrocode}
\newcommand*{\glsentrytextaccess}[1]{%
  \@gls@entry@field{#1}{textaccess}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentryfirstaccess}
% Get the value of the \gloskey{firstaccess} key for the entry with
% the given label:
%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}}
%    \begin{macrocode}
\newcommand*{\glsentryfirstaccess}[1]{%
  \@gls@entry@field{#1}{firstaccess}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentrypluralaccess}
% Get the value of the \gloskey{pluralaccess} key for the entry with
% the given label:
%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}}
%    \begin{macrocode}
\newcommand*{\glsentrypluralaccess}[1]{%
  \@gls@entry@field{#1}{pluralaccess}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentryfirstpluralaccess}
%\changes{4.45}{2020-02-13}{switched to using \cs{@gls@entry@field}}
% Get the value of the \gloskey{firstpluralaccess} key for the entry with
% the given label:
%    \begin{macrocode}
\newcommand*{\glsentryfirstpluralaccess}[1]{%
  \@gls@entry@field{#1}{firstpluralaccess}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentrysymbolaccess}
% Get the value of the \gloskey{symbolaccess} key for the entry with
% the given label:
%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}}
%    \begin{macrocode}
\newcommand*{\glsentrysymbolaccess}[1]{%
  \@gls@entry@field{#1}{symbolaccess}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentrysymbolpluralaccess}
% Get the value of the \gloskey{symbolpluralaccess} key for the entry with
% the given label:
%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}}
%    \begin{macrocode}
\newcommand*{\glsentrysymbolpluralaccess}[1]{%
  \@gls@entry@field{#1}{symbolpluralaccess}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentrydescaccess}
% Get the value of the \gloskey{descriptionaccess} key for the entry with
% the given label:
%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}}
%    \begin{macrocode}
\newcommand*{\glsentrydescaccess}[1]{%
  \@gls@entry@field{#1}{descaccess}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentrydescpluralaccess}
% Get the value of the \gloskey{descriptionpluralaccess} key for the entry with
% the given label:
%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}}
%\changes{4.45}{2020-02-13}{corrected field reference}
%    \begin{macrocode}
\newcommand*{\glsentrydescpluralaccess}[1]{%
  \@gls@entry@field{#1}{descpluralaccess}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryshortaccess}
% Get the value of the \gloskey{shortaccess} key for the entry with
% the given label:
%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}}
%    \begin{macrocode}
\newcommand*{\glsentryshortaccess}[1]{%
  \@gls@entry@field{#1}{shortaccess}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentryshortpluralaccess}
% Get the value of the \gloskey{shortpluralaccess} key for the entry with
% the given label:
%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}}
%    \begin{macrocode}
\newcommand*{\glsentryshortpluralaccess}[1]{%
  \@gls@entry@field{#1}{shortpluralaccess}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentrylongaccess}
% Get the value of the \gloskey{longaccess} key for the entry with
% the given label:
%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}}
%    \begin{macrocode}
\newcommand*{\glsentrylongaccess}[1]{%
  \@gls@entry@field{#1}{longaccess}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentrylongpluralaccess}
% Get the value of the \gloskey{longpluralaccess} key for the entry with
% the given label:
%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}}
%    \begin{macrocode}
\newcommand*{\glsentrylongpluralaccess}[1]{%
  \@gls@entry@field{#1}{longpluralaccess}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryuseriaccess}
% Get the value of the \gloskey{user1access} key for the entry with
% the given label:
%\changes{4.45}{2020-02-13}{new}
%    \begin{macrocode}
\newcommand*{\glsentryuseriaccess}[1]{%
  \@gls@entry@field{#1}{useriaccess}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryuseriiaccess}
% Get the value of the \gloskey{user2access} key for the entry with
% the given label:
%\changes{4.45}{2020-02-13}{new}
%    \begin{macrocode}
\newcommand*{\glsentryuseriiaccess}[1]{%
  \@gls@entry@field{#1}{useriiaccess}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryuseriiiaccess}
% Get the value of the \gloskey{user3access} key for the entry with
% the given label:
%\changes{4.45}{2020-02-13}{new}
%    \begin{macrocode}
\newcommand*{\glsentryuseriiiaccess}[1]{%
  \@gls@entry@field{#1}{useriiiaccess}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryuserivaccess}
% Get the value of the \gloskey{user4access} key for the entry with
% the given label:
%\changes{4.45}{2020-02-13}{new}
%    \begin{macrocode}
\newcommand*{\glsentryuserivaccess}[1]{%
  \@gls@entry@field{#1}{userivaccess}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryuservaccess}
% Get the value of the \gloskey{user5access} key for the entry with
% the given label:
%\changes{4.45}{2020-02-13}{new}
%    \begin{macrocode}
\newcommand*{\glsentryuservaccess}[1]{%
  \@gls@entry@field{#1}{uservaccess}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryuserviaccess}
% Get the value of the \gloskey{user6access} key for the entry with
% the given label:
%\changes{4.45}{2020-02-13}{new}
%    \begin{macrocode}
\newcommand*{\glsentryuserviaccess}[1]{%
  \@gls@entry@field{#1}{userviaccess}%
}
%    \end{macrocode}
%\end{macro}
%
%There are three 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, ``St'' could be short for ``saint'' or ``street'').
%\end{description}
%Therefore, rather than having one command for all fields, it's
%better to have a command dependent on the field type. For example,
%the \gloskey{short} and \gloskey{shortpl} keys would require "E",
%the \gloskey{symbol} key would require "ActualText", and a field
%that contains an image would require "Alt".
%
%\begin{macro}{\glsfieldaccsupp}
%\begin{definition}
%\cs{glsfieldaccsupp}\marg{replacement}\marg{content}\marg{field}\marg{label}
%\end{definition}
%\changes{4.45}{2020-02-13}{new}
%Test if there's a command called \cs{gls\meta{field}accsupp}. If
%there is then use that otherwise use \cs{glsaccsupp}. The first
%argument should be the internal field label (not the key). The
%final argument is the entry label. If \sty{glossaries-extra} has
%been loaded, this first checks for
%\cs{glsxtr\meta{category}\meta{field}accsupp} and \cs{glsxtr\meta{category}accsupp}.
%    \begin{macrocode}
\newcommand{\glsfieldaccsupp}[4]{%
  \ifdef\glscategory
  {%
    \ifcsdef{glsxtr\glscategory{#4}#3accsupp}%
    {\csname glsxtr\glscategory{#4}#3accsupp\endcsname{#1}{#2}}%
    {%
      \ifcsdef{glsxtr\glscategory{#4}accsupp}%
      {\csname glsxtr\glscategory{#4}accsupp\endcsname{#1}{#2}}%
      {%
        \ifcsdef{gls#3accsupp}%
        {\csname gls#3accsupp\endcsname{#1}{#2}}%
        {\glsaccsupp{#1}{#2}}%
      }%
    }%
  }%
  {%
    \ifcsdef{gls#3accsupp}%
    {\csname gls#3accsupp\endcsname{#1}{#2}}%
    {\glsaccsupp{#1}{#2}}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\xglsfieldaccsupp}
%\begin{definition}
%\cs{xglsfieldaccsupp}\marg{replacement}\marg{content}\marg{field}\marg{label}
%\end{definition}
%\changes{4.45}{2020-02-13}{new}
%As \cs{glsfieldaccsupp} but fully expand replacement text.
%    \begin{macrocode}
\newcommand{\xglsfieldaccsupp}[1]{%
  \protected@edef\@gls@replacementtext{#1}%
  \expandafter\glsfieldaccsupp\expandafter{\@gls@replacementtext}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsshortaccsupp}
%\changes{4.45}{2020-02-13}{new}
%\begin{definition}
%\cs{glsshortaccsupp}\marg{replacement text}\marg{text}
%\end{definition}
%    \begin{macrocode}
\newcommand*{\glsshortaccsupp}[2]{\glsaccessibility{E}{#1}{#2}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsshortplaccsupp}
%\changes{4.45}{2020-02-13}{new}
%\begin{definition}
%\cs{glsshortplaccsupp}\marg{replacement text}\marg{text}
%\end{definition}
%    \begin{macrocode}
\newcommand*{\glsshortplaccsupp}{\glsshortaccsupp}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsaccsupp}
%\changes{4.38}{2018-05-10}{added braces around actual text argument}
%\begin{definition}
%\cs{glsaccsupp}\marg{replacement text}\marg{text}
%\end{definition}
%    \begin{macrocode}
\newcommand*{\glsaccsupp}[2]{\glsaccessibility{ActualText}{#1}{#2}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\xglsaccsupp}
% Fully expands replacement text before calling \cs{glsaccsupp}
%    \begin{macrocode}
\newcommand*{\xglsaccsupp}[2]{%
   \protected@edef\@gls@replacementtext{#1}%
   \expandafter\glsaccsupp\expandafter{\@gls@replacementtext}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@access@display}
%\changes{4.03}{2014-01-20}{new}
%Deprecated. Use \cs{@gls@fieldaccess@display} instead.
%    \begin{macrocode}
\newcommand*{\@gls@access@display}[2]{%
  \protected@edef\@glo@access{#2}%
  \ifx\@glo@access\@gls@noaccess
    #1%
  \else
    \xglsaccsupp{\@glo@access}{#1}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@fieldaccess@display}
%\begin{definition}
%\cs{@gls@fieldaccess@display}\marg{label}\marg{field}\marg{content}\marg{replacement}
%\end{definition}
%\changes{4.45}{2020-02-13}{new}
%    \begin{macrocode}
\newcommand*{\@gls@fieldaccess@display}[4]{%
  \protected@edef\@glo@access{#4}%
  \ifdefequal\@glo@access\@gls@noaccess
  {#3}%
  {\expandafter\glsfieldaccsupp\expandafter{\@glo@access}{#3}{#2}{#1}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsnameaccessdisplay}
%\changes{4.45}{2020-02-13}{added check for existence}
% Displays the first argument with the accessibility text for
% the entry with the label given by the second argument (if set).
%    \begin{macrocode}
\newrobustcmd*{\glsnameaccessdisplay}[2]{%
  \ifcsundef{glo@\glsdetoklabel{#2}@access}%
  {#1}%
  {\@gls@fieldaccess@display{#2}{name}{#1}{\glsentryaccess{#2}}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glstextaccessdisplay}
%\changes{4.45}{2020-02-13}{added check for existence}
% As above but for the \gloskey{textaccess} replacement text.
%    \begin{macrocode}
\newrobustcmd*{\glstextaccessdisplay}[2]{%
  \ifcsundef{glo@\glsdetoklabel{#2}@textaccess}%
  {#1}%
  {\@gls@fieldaccess@display{#2}{text}{#1}{\glsentrytextaccess{#2}}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glspluralaccessdisplay}
%\changes{4.45}{2020-02-13}{added check for existence}
% As above but for the \gloskey{pluralaccess} replacement text.
%    \begin{macrocode}
\newrobustcmd*{\glspluralaccessdisplay}[2]{%
  \ifcsundef{glo@\glsdetoklabel{#2}@pluralaccess}%
  {#1}%
  {\@gls@fieldaccess@display{#2}{plural}{#1}{\glsentrypluralaccess{#2}}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsfirstaccessdisplay}
%\changes{4.45}{2020-02-13}{added check for existence}
% As above but for the \gloskey{firstaccess} replacement text.
%    \begin{macrocode}
\newrobustcmd*{\glsfirstaccessdisplay}[2]{%
  \ifcsundef{glo@\glsdetoklabel{#2}@firstaccess}%
  {#1}%
  {\@gls@fieldaccess@display{#2}{first}{#1}{\glsentryfirstaccess{#2}}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsfirstpluralaccessdisplay}
%\changes{4.45}{2020-02-13}{added check for existence}
% As above but for the \gloskey{firstpluralaccess} replacement text.
%    \begin{macrocode}
\newrobustcmd*{\glsfirstpluralaccessdisplay}[2]{%
  \ifcsundef{glo@\glsdetoklabel{#2}@firstpluralaccess}%
  {#1}%
  {\@gls@fieldaccess@display{#2}{firstpl}{#1}{\glsentryfirstpluralaccess{#2}}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glssymbolaccessdisplay}
%\changes{4.45}{2020-02-13}{added check for existence}
% As above but for the \gloskey{symbolaccess} replacement text.
%    \begin{macrocode}
\newrobustcmd*{\glssymbolaccessdisplay}[2]{%
  \ifcsundef{glo@\glsdetoklabel{#2}@symbolaccess}%
  {#1}%
  {\@gls@fieldaccess@display{#2}{symbol}{#1}{\glsentrysymbolaccess{#2}}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glssymbolpluralaccessdisplay}
%\changes{4.45}{2020-02-13}{added check for existence}
% As above but for the \gloskey{symbolpluralaccess} replacement text.
%    \begin{macrocode}
\newrobustcmd*{\glssymbolpluralaccessdisplay}[2]{%
  \ifcsundef{glo@\glsdetoklabel{#2}@symbolpluralaccess}%
  {#1}%
  {\@gls@fieldaccess@display{#2}{symbolplural}{#1}{\glsentrysymbolpluralaccess{#2}}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsdescriptionaccessdisplay}
%\changes{4.45}{2020-02-13}{added check for existence}
% As above but for the \gloskey{descriptionaccess} replacement text.
%    \begin{macrocode}
\newrobustcmd*{\glsdescriptionaccessdisplay}[2]{%
  \ifcsundef{glo@\glsdetoklabel{#2}@descaccess}%
  {#1}%
  {\@gls@fieldaccess@display{#2}{desc}{#1}{\glsentrydescaccess{#2}}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsdescriptionpluralaccessdisplay}
%\changes{4.45}{2020-02-13}{added check for existence}
% As above but for the \gloskey{descriptionpluralaccess} replacement text.
%    \begin{macrocode}
\newrobustcmd*{\glsdescriptionpluralaccessdisplay}[2]{%
  \ifcsundef{glo@\glsdetoklabel{#2}@descpluralaccess}%
  {#1}%
  {\@gls@fieldaccess@display{#2}{descplural}{#1}{\glsentrydescpluralaccess{#2}}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsshortaccessdisplay}
%\changes{4.45}{2020-02-13}{added check for existence}
% As above but for the \gloskey{shortaccess} replacement text.
%    \begin{macrocode}
\newrobustcmd*{\glsshortaccessdisplay}[2]{%
  \ifcsundef{glo@\glsdetoklabel{#2}@shortaccess}%
  {#1}%
  {\@gls@fieldaccess@display{#2}{short}{#1}{\glsentryshortaccess{#2}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsshortpluralaccessdisplay}
%\changes{4.45}{2020-02-13}{added check for existence}
% As above but for the \gloskey{shortpluralaccess} replacement text.
%    \begin{macrocode}
\newrobustcmd*{\glsshortpluralaccessdisplay}[2]{%
  \ifcsundef{glo@\glsdetoklabel{#2}@shortpluralaccess}%
  {#1}%
  {\@gls@fieldaccess@display{#2}{shortpl}{#1}{\glsentryshortpluralaccess{#2}}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glslongaccessdisplay}
%\changes{4.45}{2020-02-13}{added check for existence}
% As above but for the \gloskey{longaccess} replacement text.
%    \begin{macrocode}
\newrobustcmd*{\glslongaccessdisplay}[2]{%
  \ifcsundef{glo@\glsdetoklabel{#2}@longaccess}%
  {#1}%
  {\@gls@fieldaccess@display{#2}{long}{#1}{\glsentrylongaccess{#2}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glslongpluralaccessdisplay}
%\changes{4.45}{2020-02-13}{added check for existence}
% As above but for the \gloskey{longpluralaccess} replacement text.
%    \begin{macrocode}
\newrobustcmd*{\glslongpluralaccessdisplay}[2]{%
  \ifcsundef{glo@\glsdetoklabel{#2}@longpluralaccess}%
  {#1}%
  {\@gls@fieldaccess@display{#2}{longpl}{#1}{\glsentrylongpluralaccess{#2}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsuseriaccessdisplay}
%\changes{4.45}{2020-02-13}{new}
% As above but for the \gloskey{user1access} replacement text.
%    \begin{macrocode}
\newrobustcmd*{\glsuseriaccessdisplay}[2]{%
  \ifcsundef{glo@\glsdetoklabel{#2}@useriaccess}%
  {#1}%
  {\@gls@fieldaccess@display{#2}{useri}{#1}{\glsentryuseriaccess{#2}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsuseriiaccessdisplay}
%\changes{4.45}{2020-02-13}{new}
% As above but for the \gloskey{user2access} replacement text.
%    \begin{macrocode}
\newrobustcmd*{\glsuseriiaccessdisplay}[2]{%
  \ifcsundef{glo@\glsdetoklabel{#2}@useriiaccess}%
  {#1}%
  {\@gls@fieldaccess@display{#2}{userii}{#1}{\glsentryuseriiaccess{#2}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsuseriiiaccessdisplay}
%\changes{4.45}{2020-02-13}{new}
% As above but for the \gloskey{user3access} replacement text.
%    \begin{macrocode}
\newrobustcmd*{\glsuseriiiaccessdisplay}[2]{%
  \ifcsundef{glo@\glsdetoklabel{#2}@useriiiaccess}%
  {#1}%
  {\@gls@fieldaccess@display{#2}{useriii}{#1}{\glsentryuseriiiaccess{#2}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsuserivaccessdisplay}
%\changes{4.45}{2020-02-13}{new}
% As above but for the \gloskey{user4access} replacement text.
%    \begin{macrocode}
\newrobustcmd*{\glsuserivaccessdisplay}[2]{%
  \ifcsundef{glo@\glsdetoklabel{#2}@userivaccess}%
  {#1}%
  {\@gls@fieldaccess@display{#2}{useriv}{#1}{\glsentryuserivaccess{#2}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsuservaccessdisplay}
%\changes{4.45}{2020-02-13}{new}
% As above but for the \gloskey{user5access} replacement text.
%    \begin{macrocode}
\newrobustcmd*{\glsuservaccessdisplay}[2]{%
  \ifcsundef{glo@\glsdetoklabel{#2}@uservaccess}%
  {#1}%
  {\@gls@fieldaccess@display{#2}{userv}{#1}{\glsentryuservaccess{#2}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsuserviaccessdisplay}
%\changes{4.45}{2020-02-13}{new}
% As above but for the \gloskey{user6access} replacement text.
%    \begin{macrocode}
\newrobustcmd*{\glsuserviaccessdisplay}[2]{%
  \ifcsundef{glo@\glsdetoklabel{#2}@userviaccess}%
  {#1}%
  {\@gls@fieldaccess@display{#2}{uservi}{#1}{\glsentryuserviaccess{#2}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\changes{4.25}{??}{changed \cs{DeclareRobustCommand} to
%\cs{newrobustcmd} and changed \cs{@ifundefined} to \cs{ifcsundef}}
%\begin{macro}{\glsaccessdisplay}
% Gets the replacement text corresponding to the named key given
% by the first argument and calls the appropriate command 
% defined above.
%    \begin{macrocode}
\newrobustcmd*{\glsaccessdisplay}[3]{%
  \ifcsundef{gls#1accessdisplay}%
  {%
    \PackageError{glossaries-accsupp}{No accessibility support
     for key `#1'}{}%
  }%
  {%
    \csname gls#1accessdisplay\endcsname{#2}{#3}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@gls@default@entryfmt}
% Redefine the default entry format to use accessibility information
%    \begin{macrocode}
\renewcommand*{\@@gls@default@entryfmt}[2]{%
  \ifdefempty\glscustomtext
  {%
    \glsifplural
    {%
%    \end{macrocode}
% Plural form
%    \begin{macrocode}
      \glscapscase
      {%
%    \end{macrocode}
% Don't adjust case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
          #2{\glspluralaccessdisplay
               {\glsentryplural{\glslabel}}{\glslabel}}%
            {\glsdescriptionpluralaccessdisplay
               {\glsentrydescplural{\glslabel}}{\glslabel}}%
            {\glssymbolpluralaccessdisplay
               {\glsentrysymbolplural{\glslabel}}{\glslabel}}
            {\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          #1{\glsfirstpluralaccessdisplay
               {\glsentryfirstplural{\glslabel}}{\glslabel}}%
            {\glsdescriptionpluralaccessdisplay
               {\glsentrydescplural{\glslabel}}{\glslabel}}%
            {\glssymbolpluralaccessdisplay
               {\glsentrysymbolplural{\glslabel}}{\glslabel}}%
            {\glsinsert}%
        }%
      }%
      {%
%    \end{macrocode}
% Make first letter upper case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use.
%    \begin{macrocode}
          #2{\glspluralaccessdisplay
              {\Glsentryplural{\glslabel}}{\glslabel}}%
            {\glsdescriptionpluralaccessdisplay
              {\glsentrydescplural{\glslabel}}{\glslabel}}%
            {\glssymbolpluralaccessdisplay
              {\glsentrysymbolplural{\glslabel}}{\glslabel}}%
            {\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          #1{\glsfirstpluralaccessdisplay
               {\Glsentryfirstplural{\glslabel}}{\glslabel}}%
            {\glsdescriptionpluralaccessdisplay
               {\glsentrydescplural{\glslabel}}{\glslabel}}%
            {\glssymbolpluralaccessdisplay
               {\glsentrysymbolplural{\glslabel}}{\glslabel}}%
            {\glsinsert}%
        }%
      }%
      {%
%    \end{macrocode}
% Make all upper case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
          \MakeUppercase{%
            #2{\glspluralaccessdisplay
                {\glsentryplural{\glslabel}}{\glslabel}}%
              {\glsdescriptionpluralaccessdisplay
                {\glsentrydescplural{\glslabel}}{\glslabel}}%
              {\glssymbolpluralaccessdisplay
                {\glsentrysymbolplural{\glslabel}}{\glslabel}}%
              {\glsinsert}}%
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          \MakeUppercase{%
            #1{\glsfirstpluralaccessdisplay
                {\glsentryfirstplural{\glslabel}}{\glslabel}}%
              {\glsdescriptionpluralaccessdisplay
                {\glsentrydescplural{\glslabel}}{\glslabel}}%
              {\glssymbolpluralaccessdisplay
                {\glsentrysymbolplural{\glslabel}}{\glslabel}}%
              {\glsinsert}}%
        }%
      }%
    }%
    {%
%    \end{macrocode}
% Singular form
%    \begin{macrocode}
      \glscapscase
      {%
%    \end{macrocode}
% Don't adjust case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
          #2{\glstextaccessdisplay
               {\glsentrytext{\glslabel}}{\glslabel}}%
            {\glsdescriptionaccessdisplay
               {\glsentrydesc{\glslabel}}{\glslabel}}%
            {\glssymbolaccessdisplay
               {\glsentrysymbol{\glslabel}}{\glslabel}}%
            {\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          #1{\glsfirstaccessdisplay
              {\glsentryfirst{\glslabel}}{\glslabel}}%
            {\glsdescriptionaccessdisplay
              {\glsentrydesc{\glslabel}}{\glslabel}}%
            {\glssymbolaccessdisplay
              {\glsentrysymbol{\glslabel}}{\glslabel}}%
            {\glsinsert}%
        }%
      }%
      {%
%    \end{macrocode}
% Make first letter upper case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
          #2{\glstextaccessdisplay
               {\Glsentrytext{\glslabel}}{\glslabel}}%
            {\glsdescriptionaccessdisplay
               {\glsentrydesc{\glslabel}}{\glslabel}}%
            {\glssymbolaccessdisplay
               {\glsentrysymbol{\glslabel}}{\glslabel}}%
            {\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          #1{\glsfirstaccessdisplay
              {\Glsentryfirst{\glslabel}}{\glslabel}}%
            {\glsdescriptionaccessdisplay
              {\glsentrydesc{\glslabel}}{\glslabel}}%
            {\glssymbolaccessdisplay
              {\glsentrysymbol{\glslabel}}{\glslabel}}%
            {\glsinsert}%
        }%
      }%
      {%
%    \end{macrocode}
% Make all upper case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
          \MakeUppercase{%
            #2{\glstextaccessdisplay
                {\glsentrytext{\glslabel}}{\glslabel}}%
              {\glsdescriptionaccessdisplay
                {\glsentrydesc{\glslabel}}{\glslabel}}%
              {\glssymbolaccessdisplay
                {\glsentrysymbol{\glslabel}}{\glslabel}}%
              {\glsinsert}}%
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          \MakeUppercase{%
            #1{\glsfirstaccessdisplay
                {\glsentryfirst{\glslabel}}{\glslabel}}%
              {\glsdescriptionaccessdisplay
                {\glsentrydesc{\glslabel}}{\glslabel}}%
              {\glssymbolaccessdisplay
                {\glsentrysymbol{\glslabel}}{\glslabel}}%
              {\glsinsert}}%
        }%
      }%
    }%
  }%
  {%
%    \end{macrocode}
% Custom text provided in \cs{glsdisp}
%    \begin{macrocode}
    \ifglsused{\glslabel}%
    {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
      #2{\glscustomtext}%
        {\glsdescriptionaccessdisplay
          {\glsentrydesc{\glslabel}}{\glslabel}}%
        {\glssymbolaccessdisplay
          {\glsentrysymbol{\glslabel}}{\glslabel}}%
        {\glsinsert}%
    }%
    {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
      #1{\glscustomtext}%
        {\glsdescriptionaccessdisplay
          {\glsentrydesc{\glslabel}}{\glslabel}}%
        {\glssymbolaccessdisplay
          {\glsentrysymbol{\glslabel}}{\glslabel}}%
        {\glsinsert}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsgenentryfmt}
% Redefine to use accessibility information.
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewcommand*{\glsgenentryfmt}{%
  \ifdefempty\glscustomtext
  {%
    \glsifplural
    {%
%    \end{macrocode}
% Plural form
%    \begin{macrocode}
      \glscapscase
      {%
%    \end{macrocode}
% Don't adjust case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
          \glspluralaccessdisplay
               {\glsentryplural{\glslabel}}{\glslabel}%
          \glsinsert
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          \glsfirstpluralaccessdisplay
              {\glsentryfirstplural{\glslabel}}{\glslabel}%
          \glsinsert
        }%
      }%
      {%
%    \end{macrocode}
% Make first letter upper case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use.
%    \begin{macrocode}
          \glspluralaccessdisplay
              {\Glsentryplural{\glslabel}}{\glslabel}%
          \glsinsert
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          \glsfirstpluralaccessdisplay
              {\Glsentryfirstplural{\glslabel}}{\glslabel}%
          \glsinsert
        }%
      }%
      {%
%    \end{macrocode}
% Make all upper case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
           \glspluralaccessdisplay
              {\mfirstucMakeUppercase{\glsentryplural{\glslabel}}}%
              {\glslabel}%
           \mfirstucMakeUppercase{\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          \glsfirstpluralacessdisplay
             {\mfirstucMakeUppercase{\glsentryfirstplural{\glslabel}}}%
             {\glslabel}%
          \mfirstucMakeUppercase{\glsinsert}%
        }%
      }%
    }%
    {%
%    \end{macrocode}
% Singular form
%    \begin{macrocode}
      \glscapscase
      {%
%    \end{macrocode}
% Don't adjust case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
          \glstextaccessdisplay{\glsentrytext{\glslabel}}{\glslabel}%
          \glsinsert
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          \glsfirstaccessdisplay{\glsentryfirst{\glslabel}}{\glslabel}%
          \glsinsert
        }%
      }%
      {%
%    \end{macrocode}
% Make first letter upper case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
           \glstextaccessdisplay{\Glsentrytext{\glslabel}}{\glslabel}%
           \glsinsert
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          \glsfirstaccessdisplay{\Glsentryfirst{\glslabel}}{\glslabel}%
          \glsinsert
        }%
      }%
      {%
%    \end{macrocode}
% Make all upper case
%    \begin{macrocode}
        \ifglsused\glslabel
        {%
%    \end{macrocode}
% Subsequent use
%    \begin{macrocode}
          \glstextaccessdisplay
            {\mfirstucMakeUppercase{\glsentrytext{\glslabel}}}{\glslabel}%
          \mfirstucMakeUppercase{\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use
%    \begin{macrocode}
          \glsfirstaccessdisplay
            {\mfirstucMakeUppercase{\glsentryfirst{\glslabel}}}{\glslabel}%
          \mfirstucMakeUppercase{\glsinsert}%
        }%
      }%
    }%
  }%
  {%
%    \end{macrocode}
% Custom text provided in \cs{glsdisp}. (The insert should
% be empty at this point.) The accessibility information, if
% required, will have to be explicitly included in the custom text.
%    \begin{macrocode}
    \glscustomtext\glsinsert
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsgenacfmt}
% Redefine to include accessibility information.
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewcommand*{\glsgenacfmt}{%
  \ifdefempty\glscustomtext
  {%
    \ifglsused\glslabel
    {%
%    \end{macrocode}
% Subsequent use:
%    \begin{macrocode}
      \glsifplural
      {%
%    \end{macrocode}
% Subsequent plural form:
%    \begin{macrocode}
        \glscapscase
        {%
%    \end{macrocode}
% Subsequent plural form, don't adjust case:
%    \begin{macrocode}
          \acronymfont
           {\glsshortpluralaccessdisplay
              {\glsentryshortpl{\glslabel}}{\glslabel}}%
          \glsinsert
        }%
        {%
%    \end{macrocode}
% Subsequent plural form, make first letter upper case:
%    \begin{macrocode}
          \acronymfont
           {\glsshortpluralaccessdisplay
              {\Glsentryshortpl{\glslabel}}{\glslabel}}%
          \glsinsert
        }%
        {%
%    \end{macrocode}
% Subsequent plural form, all caps:
%    \begin{macrocode}
          \mfirstucMakeUppercase
          {\acronymfont
           {\glsshortpluralaccessdisplay
              {\glsentryshortpl{\glslabel}}{\glslabel}}%
          \glsinsert}%
        }%
      }%
      {%
%    \end{macrocode}
% Subsequent singular form
%    \begin{macrocode}
        \glscapscase
        {%
%    \end{macrocode}
% Subsequent singular form, don't adjust case:
%    \begin{macrocode}
          \acronymfont
           {\glsshortaccessdisplay{\glsentryshort{\glslabel}}{\glslabel}}%
          \glsinsert
        }%
        {%
%    \end{macrocode}
% Subsequent singular form, make first letter upper case:
%    \begin{macrocode}
          \acronymfont
           {\glsshortaccessdisplay{\Glsentryshort{\glslabel}}{\glslabel}}%
          \glsinsert
        }%
        {%
%    \end{macrocode}
% Subsequent singular form, all caps:
%    \begin{macrocode}
          \mfirstucMakeUppercase
            {\acronymfont{%
              \glsshortaccessdisplay{\glsentryshort{\glslabel}}{\glslabel}}%
             \glsinsert}%
        }%
      }%
    }%
    {%
%    \end{macrocode}
% First use:
%    \begin{macrocode}
      \glsifplural
      {%
%    \end{macrocode}
% First use plural form:
%    \begin{macrocode}
        \glscapscase
        {%
%    \end{macrocode}
% First use plural form, don't adjust case:
%    \begin{macrocode}
          \genplacrfullformat{\glslabel}{\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use plural form, make first letter upper case:
%    \begin{macrocode}
          \Genplacrfullformat{\glslabel}{\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use plural form, all caps:
%    \begin{macrocode}
          \mfirstucMakeUppercase
            {\genplacrfullformat{\glslabel}{\glsinsert}}%
        }%
      }%
      {%
%    \end{macrocode}
% First use singular form
%    \begin{macrocode}
        \glscapscase
        {%
%    \end{macrocode}
% First use singular form, don't adjust case:
%    \begin{macrocode}
          \genacrfullformat{\glslabel}{\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use singular form, make first letter upper case:
%    \begin{macrocode}
          \Genacrfullformat{\glslabel}{\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use singular form, all caps:
%    \begin{macrocode}
          \mfirstucMakeUppercase
           {\genacrfullformat{\glslabel}{\glsinsert}}%
        }%
      }%
    }%
  }%
  {%
%    \end{macrocode}
% User supplied text. (The insert should be empty at this point.)
% The accessibility information, if
% required, will have to be explicitly included in the custom text.
%    \begin{macrocode}
    \glscustomtext
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\genacrfullformat}
% Redefine to include accessibility information.
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewcommand*{\genacrfullformat}[2]{%
   \glslongaccessdisplay{\glsentrylong{#1}}{#1}#2\space
   (\glsshortaccessdisplay{\protect\firstacronymfont{\glsentryshort{#1}}}{#1})%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Genacrfullformat}
% Redefine to include accessibility information.
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewcommand*{\Genacrfullformat}[2]{%
   \glslongaccessdisplay{\Glsentrylong{#1}}{#1}#2\space
   (\glsshortaccessdisplay{\protect\firstacronymfont{\Glsentryshort{#1}}}{#1})%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\genplacrfullformat}
% Redefine to include accessibility information.
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewcommand*{\genplacrfullformat}[2]{%
   \glslongpluralaccessdisplay{\glsentrylongpl{#1}}{#1}#2\space
   (\glsshortpluralaccessdisplay
      {\protect\firstacronymfont{\glsentryshortpl{#1}}}{#1})%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Genplacrfullformat}
% Redefine to include accessibility information.
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewcommand*{\Genplacrfullformat}[2]{%
   \glslongpluralaccessdisplay{\Glsentrylongpl{#1}}{#1}#2\space
   (\glsshortpluralaccessdisplay
      {\protect\firstacronymfont{\glsentryshortpl{#1}}}{#1})%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@acrshort}
%\changes{4.08}{2014-07-30}{added \cs{do@gls@link@checkfirsthyper}}
%    \begin{macrocode}
\def\@acrshort#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\relax
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}}
%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in
%\cs{@gls@link})}
%    \begin{macrocode}
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\glsshortaccessdisplay{\glsentryshort{#2}}{#2}}#3%
    }%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Acrshort}
%\changes{4.08}{2014-07-30}{added \cs{do@gls@link@checkfirsthyper}}
%    \begin{macrocode}
\def\@Acrshort#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\relax
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}}
%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in
%\cs{@gls@link})}
%    \begin{macrocode}
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@secondofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\glsshortaccessdisplay{\Glsentryshort{#2}}{#2}}#3%
    }%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@ACRshort}
%\changes{4.08}{2014-07-30}{added \cs{do@gls@link@checkfirsthyper}}
%    \begin{macrocode}
\def\@ACRshort#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\relax
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}}
%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in
%\cs{@gls@link})}
%    \begin{macrocode}
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@thirdofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\glsshortaccessdisplay
          {\MakeUppercase{\glsentryshort{#2}}}{#2}}#3%
    }%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@acrlong}
%\changes{4.08}{2014-07-30}{added \cs{do@gls@link@checkfirsthyper}}
%    \begin{macrocode}
\def\@acrlong#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\relax
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}}
%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in
%\cs{@gls@link})}
%    \begin{macrocode}
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\glslongaccessdisplay{\glsentrylong{#2}}{#2}}#3%
    }%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Acrlong}
%\changes{4.08}{2014-07-30}{added \cs{do@gls@link@checkfirsthyper}}
%    \begin{macrocode}
\def\@Acrlong#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\relax
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}}
%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in
%\cs{@gls@link})}
%    \begin{macrocode}
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\glslongaccessdisplay{\Glsentrylong{#2}}{#2}}#3%
    }%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@ACRlong}
%\changes{4.08}{2014-07-30}{added \cs{do@gls@link@checkfirsthyper}}
%    \begin{macrocode}
\def\@ACRlong#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\relax
%    \end{macrocode}
%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural},
% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}}
%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in
%\cs{@gls@link})}
%    \begin{macrocode}
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\glslongaccessdisplay{%
        \MakeUppercase{\glsentrylong{#2}}}{#2}#3}%
    }%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
%    \end{macrocode}
%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}}
%    \begin{macrocode}
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glstext@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@glstext@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glstextaccessdisplay{\glsentrytext{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glstext@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@Glstext@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glstextaccessdisplay{\Glsentrytext{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLStext@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@GLStext@#1#2[#3]{%
  \@gls@field@link{#1}{#2}%
  {\glstextaccessdisplay{\mfirstucMakeUppercase{\glsentrytext{#2}}}{#2}%
   \mfirstucMakeUppercase{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsfirst@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@glsfirst@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsfirstaccessdisplay{\glsentryfirst{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsfirst@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@Glsfirst@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsfirstaccessdisplay{\Glsentryfirst{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSfirst@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@GLSfirst@#1#2[#3]{%
  \@gls@field@link{#1}{#2}%
  {\glsfirstaccessdisplay{\mfirstucMakeUppercase{\glsentryfirst{#2}}}{#2}%
   \mfirstucMakeUppercase{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsplural@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@glsplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glspluralaccessdisplay{\glsentryplural{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsplural@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@Glsplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glspluralaccessdisplay{\Glsentryplural{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSplural@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@GLSplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}%
  {\glspluralaccessdisplay{\mfirstucMakeUppercase{\glsentryplural{#2}}}{#2}%
   \mfirstucMakeUppercase{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsfirstplural@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@glsfirstplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsfirstpluralaccessdisplay{\glsentryfirstplural{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsfirstplural@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@glsfirstplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsfirstpluralaccessdisplay{\Glsentryfirstplural{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSfirstplural@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@GLSfirstplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}%
  {\glsfirstpluralaccessdisplay{\mfirstucMakeUppercase{\glsentryfirstplural{#2}}}{#2}%
    \mfirstucMakeUppercase{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsname@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@glsname@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsnameaccessdisplay{\glsentryname{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsname@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@Glsname@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsnameaccessdisplay{\Glsentryname{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSname@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@GLSname@#1#2[#3]{%
  \@gls@field@link{#1}{#2}%
  {\glsnameaccessdisplay{\mfirstucMakeUppercase{\glsentryname{#2}}}{#2}%
   \mfirstucMakeUppercase{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsdesc@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@glsdesc@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsdescriptionaccessdisplay{\glsentrydesc{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsdesc@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@Glsdesc@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsdescriptionaccessdisplay{\Glsentrydesc{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSdesc@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@GLSdesc@#1#2[#3]{%
  \@gls@field@link{#1}{#2}%
  {\glsdescriptionaccessdisplay{\mfirstucMakeUppercase{\glsentrydesc{#2}}}{#2}%
   \mfirstucMakeUppercase{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsdescplural@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@glsdescplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsdescriptionpluralaccessdisplay{\glsentrydescplural{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsdescplural@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@Glsdescplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsdescriptionpluralaccessdisplay{\Glsentrydescplural{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSdescplural@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@GLSdescplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}%
  {\glsdescriptionpluralaccessdisplay{\mfirstucMakeUppercase{\glsentrydescplural{#2}}}{#2}%
   \mfirstucMakeUppercase{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glssymbol@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@glssymbol@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glssymbolaccessdisplay{\glsentrysymbol{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glssymbol@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@Glssymbol@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glssymbolaccessdisplay{\Glsentrysymbol{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSsymbol@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@GLSsymbol@#1#2[#3]{%
  \@gls@field@link{#1}{#2}%
    {\glssymbolaccessdisplay{\mfirstucMakeUppercase{\glsentrysymbol{#2}}}{#2}%
     \mfirstucMakeUppercase{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glssymbolplural@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@glssymbolplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glssymbolpluralaccessdisplay{\glsentrysymbolplural{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glssymbolplural@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@Glssymbolplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glssymbolpluralaccessdisplay{\Glsentrysymbolplural{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSsymbolplural@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@GLSsymbolplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}%
    {\glssymbolpluralaccessdisplay{\mfirstucMakeUppercase{\glsentrysymbolplural{#2}}}{#2}%
     \mfirstucMakeUppercase{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsuseri@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@glsuseri@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsuseriaccessdisplay{\glsentryuseri{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsuseri@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@Glsuser@i#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsuseriaccessdisplay{\Glsentryuseri{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSuseri@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@GLSuseri@#1#2[#3]{%
  \@gls@field@link{#1}{#2}%
    {\glsuseriaccessdisplay{\mfirstucMakeUppercase{\glsentryuseri{#2}}}{#2}%
     \mfirstucMakeUppercase{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsuserii@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@glsuserii@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsuseriiaccessdisplay{\glsentryuserii{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsuserii@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@Glsuser@i#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsuseriiaccessdisplay{\Glsentryuserii{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSuserii@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@GLSuserii@#1#2[#3]{%
  \@gls@field@link{#1}{#2}%
    {\glsuseriiaccessdisplay{\mfirstucMakeUppercase{\glsentryuserii{#2}}}{#2}%
     \mfirstucMakeUppercase{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsuseriii@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@glsuseriii@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsuseriiiaccessdisplay{\glsentryuseriii{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsuseriii@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@Glsuser@i#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsuseriiiaccessdisplay{\Glsentryuseriii{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSuseriii@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@GLSuseriii@#1#2[#3]{%
  \@gls@field@link{#1}{#2}%
    {\glsuseriiiaccessdisplay{\mfirstucMakeUppercase{\glsentryuseriii{#2}}}{#2}%
     \mfirstucMakeUppercase{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsuseriv@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@glsuseriv@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsuserivaccessdisplay{\glsentryuseriv{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsuseriv@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@Glsuser@i#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsuserivaccessdisplay{\Glsentryuseriv{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSuseriv@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@GLSuseriv@#1#2[#3]{%
  \@gls@field@link{#1}{#2}%
    {\glsuserivaccessdisplay{\mfirstucMakeUppercase{\glsentryuseriv{#2}}}{#2}%
     \mfirstucMakeUppercase{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsuserv@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@glsuserv@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsuservaccessdisplay{\glsentryuserv{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsuserv@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@Glsuser@i#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsuservaccessdisplay{\Glsentryuserv{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSuserv@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@GLSuserv@#1#2[#3]{%
  \@gls@field@link{#1}{#2}%
    {\glsuservaccessdisplay{\mfirstucMakeUppercase{\glsentryuserv{#2}}}{#2}%
     \mfirstucMakeUppercase{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsuservi@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@glsuservi@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsuserviaccessdisplay{\glsentryuservi{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsuservi@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@Glsuser@i#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsuserviaccessdisplay{\Glsentryuservi{#2}}{#2}#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSuservi@}
%\changes{4.45}{2020-02-13}{added accessibility support}
%    \begin{macrocode}
\def\@GLSuservi@#1#2[#3]{%
  \@gls@field@link{#1}{#2}%
    {\glsuserviaccessdisplay{\mfirstucMakeUppercase{\glsentryuservi{#2}}}{#2}%
     \mfirstucMakeUppercase{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\section{Displaying the Glossary}
%\changes{3.08a}{2013-09-28}{removed definition of \cs{@glossaryentryfield}}
%\changes{3.08a}{2013-09-28}{removed definition of \cs{@glossarysubentryfield}}
%
% We need to redefine the way the glossary entries are formatted to
% include the accessibility support. The predefined glossary styles
% use \ics{glossentryname}, \ics{glossentrydesc} and
% \ics{glossentrysymbol}, but we need to provide compatibility with
% earlier versions in case users have defined their own styles using
% \cs{accsuppglossaryentryfield} and
% \cs{accsuppglossarysubentryfield}.
%
% Now redefine \cs{glossentryname}, \cs{glossentrydesc} and
% \cs{glossentrysymbol} etc so they use the accessibility stuff.
%    \begin{macrocode}
\renewcommand*{\glossentryname}[1]{%
  \glsdoifexists{#1}%
  {%
    \glsnamefont{\glsnameaccessdisplay{\glsentryname{#1}}{#1}}%
  }%
}
%    \end{macrocode}
%
%    \begin{macrocode}
\renewcommand*{\glossentryname}[1]{%
  \glsdoifexists{#1}%
  {%
    \glsnamefont{\glsnameaccessdisplay{\Glsentryname{#1}}{#1}}%
  }%
}
%    \end{macrocode}
%
%    \begin{macrocode}
\renewcommand*{\glossentrydesc}[1]{%
  \glsdoifexists{#1}%
  {%
     \glsdescriptionaccessdisplay{\glsentrydesc{#1}}{#1}%
  }%
}
%    \end{macrocode}
%
%    \begin{macrocode}
\renewcommand*{\Glossentrydesc}[1]{%
  \glsdoifexists{#1}%
  {%
     \glsdescriptionaccessdisplay{\Glsentrydesc{#1}}{#1}%
  }%
}
%    \end{macrocode}
%
%    \begin{macrocode}
\renewcommand*{\glossentrysymbol}[1]{%
  \glsdoifexists{#1}%
  {%
     \glssymbolaccessdisplay{\glsentrysymbol{#1}}{#1}%
  }%
}
%    \end{macrocode}
%
%    \begin{macrocode}
\renewcommand*{\Glossentrysymbol}[1]{%
  \glsdoifexists{#1}%
  {%
     \glssymbolaccessdisplay{\Glsentrysymbol{#1}}{#1}%
  }%
}
%    \end{macrocode}
%
%\begin{macro}{\accsuppglossaryentryfield}
%    \begin{macrocode}
\newcommand*{\accsuppglossaryentryfield}[5]{%
  \glossaryentryfield{#1}%
  {\glsnameaccessdisplay{#2}{#1}}%
  {\glsdescriptionaccessdisplay{#3}{#1}}%
  {\glssymbolaccessdisplay{#4}{#1}}{#5}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\accsuppglossarysubentryfield}
%    \begin{macrocode}
\newcommand*{\accsuppglossarysubentryfield}[6]{%
  \glossarysubentryfield{#1}{#2}%
  {\glsnameaccessdisplay{#3}{#2}}%
  {\glsdescriptionaccessdisplay{#4}{#2}}%
  {\glssymbolaccessdisplay{#5}{#2}}{#6}%
}
%    \end{macrocode}
%\end{macro}
%
%\section{Acronyms}
% Redefine acronym styles provided by \styfmt{glossaries}:
%
%\begin{acrstyle}{long-short}
% \meta{long} (\meta{short}) acronym style.
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewacronymstyle{long-short}%
{%
%    \end{macrocode}
% Check for long form in case this is a mixed glossary.
%    \begin{macrocode}
  \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}%
}%
{%
  \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}%
  \renewcommand*{\genacrfullformat}[2]{%
   \glslongaccessdisplay{\glsentrylong{##1}}{##1}##2\space
   (\glsshortaccessdisplay
      {\protect\firstacronymfont{\glsentryshort{##1}}}{##1})%
  }%
  \renewcommand*{\Genacrfullformat}[2]{%
   \glslongaccessdisplay{\Glsentrylong{##1}}{##1}##2\space
   (\glsshortaccessdisplay
      {\protect\firstacronymfont{\glsentryshort{##1}}}{##1})%
  }%
  \renewcommand*{\genplacrfullformat}[2]{%
   \glslongpluralaccessdisplay{\glsentrylongpl{##1}}{##1}##2\space
   (\glsshortpluralaccessdisplay
      {\protect\firstacronymfont{\glsentryshortpl{##1}}}{##1})%
  }%
  \renewcommand*{\Genplacrfullformat}[2]{%
   \glslongpluralaccessdisplay{\Glsentrylongpl{##1}}{##1}##2\space
   (\glsshortpluralaccessdisplay
      {\protect\firstacronymfont{\glsentryshortpl{##1}}}{##1})%
  }%
  \renewcommand*{\acronymentry}[1]{%
    \glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1}}
  \renewcommand*{\acronymsort}[2]{##1}%
  \renewcommand*{\acronymfont}[1]{##1}%
  \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{short-long}
% \meta{short} (\meta{long}) acronym style.
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewacronymstyle{short-long}%
{%
%    \end{macrocode}
% Check for long form in case this is a mixed glossary.
%    \begin{macrocode}
  \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}%
}%
{%
  \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}%
  \renewcommand*{\genacrfullformat}[2]{%
   \glsshortaccessdisplay
     {\protect\firstacronymfont{\glsentryshort{##1}}}{##1}##2\space
   (\glslongaccessdisplay{\glsentrylong{##1}}{##1})%
  }%
  \renewcommand*{\Genacrfullformat}[2]{%
   \glsshortaccessdisplay
      {\protect\firstacronymfont{\Glsentryshort{##1}}}{##1}##2\space
   (\glslongaccessdisplay{\glsentrylong{##1}}{##1})%
  }%
  \renewcommand*{\genplacrfullformat}[2]{%
   \glsshortpluralaccessdisplay
     {\protect\firstacronymfont{\glsentryshortpl{##1}}}{##1}##2\space
   (\glslongpluralaccessdisplay
     {\glsentrylongpl{##1}}{##1})%
  }%
  \renewcommand*{\Genplacrfullformat}[2]{%
   \glsshortpluralaccessdisplay
    {\protect\firstacronymfont{\Glsentryshortpl{##1}}}{##1}##2\space
   (\glslongpluralaccessdisplay{\glsentrylongpl{##1}}{##1})%
  }%
  \renewcommand*{\acronymentry}[1]{%
    \glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1}}%
  \renewcommand*{\acronymsort}[2]{##1}%
  \renewcommand*{\acronymfont}[1]{##1}%
  \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{long-short-desc}
% \meta{long} (\marg{short}) acronym style that has an
% accompanying description (which the user needs to supply).
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewacronymstyle{long-short-desc}%
{%
  \GlsUseAcrEntryDispStyle{long-short}%
}%
{%
  \GlsUseAcrStyleDefs{long-short}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glslongaccessdisplay{\glsentrylong{##1}}{##1}\space
    (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{long-sc-short-desc}
% \meta{long} (\cs{textsc}\marg{short}) acronym style that has an
% accompanying description (which the user needs to supply).
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewacronymstyle{long-sc-short-desc}%
{%
  \GlsUseAcrEntryDispStyle{long-sc-short}%
}%
{%
  \GlsUseAcrStyleDefs{long-sc-short}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glslongaccessdisplay{\glsentrylong{##1}}{##1}\space
    (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{long-sm-short-desc}
% \meta{long} (\cs{textsmaller}\marg{short}) acronym style that has an
% accompanying description (which the user needs to supply).
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewacronymstyle{long-sm-short-desc}%
{%
  \GlsUseAcrEntryDispStyle{long-sm-short}%
}%
{%
  \GlsUseAcrStyleDefs{long-sm-short}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glslongaccessdisplay{\glsentrylong{##1}}{##1}\space
    (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{short-long-desc}
% \meta{short} (\marg{long}) acronym style that has an
% accompanying description (which the user needs to supply).
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewacronymstyle{short-long-desc}%
{%
  \GlsUseAcrEntryDispStyle{short-long}%
}%
{%
  \GlsUseAcrStyleDefs{short-long}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glslongaccessdisplay{\glsentrylong{##1}}{##1}\space
    (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{sc-short-long-desc}
% \meta{long} (\cs{textsc}\marg{short}) acronym style that has an
% accompanying description (which the user needs to supply).
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewacronymstyle{sc-short-long-desc}%
{%
  \GlsUseAcrEntryDispStyle{sc-short-long}%
}%
{%
  \GlsUseAcrStyleDefs{sc-short-long}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glslongaccessdisplay{\glsentrylong{##1}}{##1}\space
    (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{sm-short-long-desc}
% \meta{long} (\cs{textsmaller}\marg{short}) acronym style that has an
% accompanying description (which the user needs to supply).
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewacronymstyle{sm-short-long-desc}%
{%
  \GlsUseAcrEntryDispStyle{sm-short-long}%
}%
{%
  \GlsUseAcrStyleDefs{sm-short-long}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glslongaccessdisplay{\glsentrylong{##1}}{##1}\space
    (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{dua}
% \meta{long} only acronym style.
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewacronymstyle{dua}%
{%
%    \end{macrocode}
% Check for long form in case this is a mixed glossary.
%    \begin{macrocode}
  \ifdefempty\glscustomtext
  {%
    \ifglshaslong{\glslabel}%
    {%
      \glsifplural
      {%
%    \end{macrocode}
% Plural form:
%    \begin{macrocode}
        \glscapscase
        {%
%    \end{macrocode}
% Plural form, don't adjust case:
%    \begin{macrocode}
          \glslongpluralaccessdisplay{\glsentrylongpl{\glslabel}}{\glslabel}%
          \glsinsert
        }%
        {%
%    \end{macrocode}
% Plural form, make first letter upper case:
%    \begin{macrocode}
          \glslongpluralaccessdisplay{\Glsentrylongpl{\glslabel}}{\glslabel}%
          \glsinsert
        }%
        {%
%    \end{macrocode}
% Plural form, all caps:
%    \begin{macrocode}
          \glslongpluralaccessdisplay
            {\mfirstucMakeUppercase{\glsentrylongpl{\glslabel}}}{\glslabel}%
          \mfirstucMakeUppercase{\glsinsert}%
        }%
      }%
      {%
%    \end{macrocode}
% Singular form
%    \begin{macrocode}
        \glscapscase
        {%
%    \end{macrocode}
% Singular form, don't adjust case:
%    \begin{macrocode}
          \glslongaccessdisplay{\glsentrylong{\glslabel}}{\glslabel}\glsinsert
        }%
        {%
%    \end{macrocode}
% Subsequent singular form, make first letter upper case:
%    \begin{macrocode}
          \glslongaccessdisplay{\Glsentrylong{\glslabel}}{\glslabel}\glsinsert
        }%
        {%
%    \end{macrocode}
% Subsequent singular form, all caps:
%    \begin{macrocode}
          \glslongaccessdisplay
           {\mfirstucMakeUppercase
              {\glsentrylong{\glslabel}\glsinsert}}{\glslabel}%
          \mfirstucMakeUppercase{\glsinsert}%
        }%
      }%
    }%
    {%
%    \end{macrocode}
% Not an acronym:
%    \begin{macrocode}
      \glsgenentryfmt
    }%
  }%
  {\glscustomtext\glsinsert}%
}%
{%
  \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}%
  \renewcommand*{\acrfullfmt}[3]{%
    \glslink[##1]{##2}{%
      \glslongaccessdisplay{\glsentrylong{##2}}{##2}##3\space
      (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##2}}}{##2})}}%
  \renewcommand*{\Acrfullfmt}[3]{%
    \glslink[##1]{##2}{%
      \glslongaccessdisplay{\Glsentrylong{##2}}{##2}##3\space
      (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##2}}}{##2})}}%
  \renewcommand*{\ACRfullfmt}[3]{%
    \glslink[##1]{##2}{%
      \glslongaccessdisplay
        {\mfirstucMakeUppercase{\glsentrylong{##2}}{##2}##3\space
      (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##2}}}{##2})}}}%
  \renewcommand*{\acrfullplfmt}[3]{%
    \glslink[##1]{##2}{%
      \glslongpluralaccessdisplay
        {\glsentrylongpl{##2}}{##2}##3\space
      (\glsshortpluralaccessdisplay
        {\acronymfont{\glsentryshortpl{##2}}}{##2})}}%
  \renewcommand*{\Acrfullplfmt}[3]{%
    \glslink[##1]{##2}{%
      \glslongpluralaccessdisplay
        {\Glsentrylongpl{##2}}{##2}##3\space
      (\glsshortpluralaccessdisplay
        {\acronymfont{\glsentryshortpl{##2}}}{##2})}}%
  \renewcommand*{\ACRfullplfmt}[3]{%
    \glslink[##1]{##2}{%
      \glslongpluralaccessdisplay
         {\mfirstucMakeUppercase{\glsentrylongpl{##2}}{##2}##3\space
      (\glsshortpluralaccessdisplay
         {\acronymfont{\glsentryshortpl{##2}}}{##2})}}}%
  \renewcommand*{\glsentryfull}[1]{%
    \glslongaccessdisplay{\glsentrylong{##1}}\space
    (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})%
  }%
  \renewcommand*{\Glsentryfull}[1]{%
    \glslongaccessdisplay{\Glsentrylong{##1}}{##1}\space
    (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})%
  }%
  \renewcommand*{\glsentryfullpl}[1]{%
    \glslongpluralaccessdisplay{\glsentrylongpl{##1}}{##1}\space
    (\glsshortpluralaccessdisplay{\acronymfont{\glsentryshortpl{##1}}}{##1})%
  }%
  \renewcommand*{\Glsentryfullpl}[1]{%
    \glslongpluralaccessdisplay{\Glsentrylongpl{##1}}{##1}\space
    (\glsshortpluralaccessdisplay{\acronymfont{\glsentryshortpl{##1}}}{##1})%
  }%
  \renewcommand*{\acronymentry}[1]{%
     \glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1}}%
  \renewcommand*{\acronymsort}[2]{##1}%
  \renewcommand*{\acronymfont}[1]{##1}%
  \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{dua-desc}
% \meta{long} only acronym style with user-supplied description.
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewacronymstyle{dua-desc}%
{%
  \GlsUseAcrEntryDispStyle{dua}%
}%
{%
  \GlsUseAcrStyleDefs{dua}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymentry}[1]{%
    \glslongaccessdisplay{\acronymfont{\glsentrylong{##1}}}{##1}}%
  \renewcommand*{\acronymsort}[2]{##2}%
}%
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{footnote}
% \meta{short}\cs{footnote}\marg{long} acronym style.
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewacronymstyle{footnote}%
{%
%    \end{macrocode}
% Check for long form in case this is a mixed glossary.
%    \begin{macrocode}
  \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}%
}%
{%
  \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}%
%    \end{macrocode}
% Need to ensure hyperlinks are switched off on first use:
%    \begin{macrocode}
  \glshyperfirstfalse
  \renewcommand*{\genacrfullformat}[2]{%
   \glsshortaccessdisplay
     {\protect\firstacronymfont{\glsentryshort{##1}}}{##1}##2%
   \protect\footnote{\glslongaccessdisplay{\glsentrylong{##1}}{##1}}%
  }%
  \renewcommand*{\Genacrfullformat}[2]{%
   \glsshortaccessdisplay
     {\firstacronymfont{\Glsentryshort{##1}}}{##1}##2%
   \protect\footnote{\glslongaccessdisplay{\glsentrylong{##1}}{##1}}%
  }%
  \renewcommand*{\genplacrfullformat}[2]{%
   \glsshortpluralaccessdisplay
     {\protect\firstacronymfont{\glsentryshortpl{##1}}}{##1}##2%
   \protect\footnote{\glslongpluralaccessdisplay{\glsentrylongpl{##1}}{##1}}%
  }%
  \renewcommand*{\Genplacrfullformat}[2]{%
   \glsshortpluralaccessdisplay
     {\protect\firstacronymfont{\Glsentryshortpl{##1}}}{##1}##2%
   \protect\footnote{\glslongpluralaccessdisplay{\glsentrylongpl{##1}}{##1}}%
  }%
  \renewcommand*{\acronymentry}[1]{%
    \glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1}}%
  \renewcommand*{\acronymsort}[2]{##1}%
  \renewcommand*{\acronymfont}[1]{##1}%
  \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}%
%    \end{macrocode}
% Don't use footnotes for \ics{acrfull}:
%    \begin{macrocode}
  \renewcommand*{\acrfullfmt}[3]{%
    \glslink[##1]{##2}{%
      \glsshortaccessdisplay{\acronymfont{\glsentryshort{##2}}}{##2}##3\space
      (\glslongaccessdisplay{\glsentrylong{##2}}{##2})}}%
  \renewcommand*{\Acrfullfmt}[3]{%
    \glslink[##1]{##2}{%
      \glsshortaccessdisplay{\acronymfont{\Glsentryshort{##2}}}{##2}##3\space
      (\glslongaccessdisplay{\glsentrylong{##2}}{##2})}}%
  \renewcommand*{\ACRfullfmt}[3]{%
    \glslink[##1]{##2}{%
      \glsshortaccessdisplay
         {\mfirstucMakeUppercase
           {\acronymfont{\glsentryshort{##2}}}{##2}##3\space
      (\glslongaccessdisplay{\glsentrylong{##2}}{##2})}}}%
  \renewcommand*{\acrfullplfmt}[3]{%
    \glslink[##1]{##2}{%
      \glsshortpluralaccessdisplay
         {\acronymfont{\glsentryshortpl{##2}}}{##2}##3\space
      (\glslongpluralaccessdisplay{\glsentrylongpl{##2}}{##2})}}%
  \renewcommand*{\Acrfullplfmt}[3]{%
    \glslink[##1]{##2}{%
      \glsshortpluralaccessdisplay
        {\acronymfont{\Glsentryshortpl{##2}}}{##2}##3\space
      (\glslongpluralaccessdisplay{\glsentrylongpl{##2}})}}%
  \renewcommand*{\ACRfullplfmt}[3]{%
    \glslink[##1]{##2}{%
      \glsshortpluralaccessdisplay
        {\mfirstucMakeUppercase
           {\acronymfont{\glsentryshortpl{##2}}}{##2}##3\space
      (\glslongpluralaccessdisplay{\glsentrylongpl{##2}}{##2})}}}%
%    \end{macrocode}
% Similarly for \ics{glsentryfull} etc:
%    \begin{macrocode}
  \renewcommand*{\glsentryfull}[1]{%
     \glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1}\space
      (\glslongaccessdisplay{\glsentrylong{##1}}{##1})}%
  \renewcommand*{\Glsentryfull}[1]{%
     \glsshortaccessdisplay{\acronymfont{\Glsentryshort{##1}}}{##1}\space
     (\glslongaccessdisplay{\glsentrylong{##1}}{##1})}%
  \renewcommand*{\glsentryfullpl}[1]{%
     \glsshortpluralaccessdisplay
       {\acronymfont{\glsentryshortpl{##1}}}{##1}\space
       (\glslongpluralaccessdisplay{\glsentrylongpl{##1}}{##1})}%
  \renewcommand*{\Glsentryfullpl}[1]{%
     \glsshortpluralaccessdisplay
        {\acronymfont{\Glsentryshortpl{##1}}}{##1}\space
     (\glslongpluralaccessdisplay{\glsentrylongpl{##1}}{##1})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{footnote-sc}
% \cs{textsc}\marg{short}\cs{footnote}\marg{long} acronym style.
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewacronymstyle{footnote-sc}%
{%
  \GlsUseAcrEntryDispStyle{footnote}%
}%
{%
  \GlsUseAcrStyleDefs{footnote}%
  \renewcommand{\acronymentry}[1]{%
     \glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1}}
  \renewcommand{\acronymfont}[1]{\textsc{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glstextup{\glspluralsuffix}}%
}%
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{footnote-sm}
% \cs{textsmaller}\marg{short}\cs{footnote}\marg{long} acronym style.
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewacronymstyle{footnote-sm}%
{%
  \GlsUseAcrEntryDispStyle{footnote}%
}%
{%
  \GlsUseAcrStyleDefs{footnote}%
  \renewcommand{\acronymentry}[1]{%
    \glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1}}
  \renewcommand{\acronymfont}[1]{\textsmaller{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}%
}%
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{footnote-desc}
% \meta{short}\cs{footnote}\marg{long} acronym style that has an
% accompanying description (which the user needs to supply).
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewacronymstyle{footnote-desc}%
{%
  \GlsUseAcrEntryDispStyle{footnote}%
}%
{%
  \GlsUseAcrStyleDefs{footnote}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glslongaccessdisplay{\glsentrylong{##1}}{##1}\space
    (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{footnote-sc-desc}
% \cs{textsc}\marg{short}\cs{footnote}\marg{long} acronym style that has an
% accompanying description (which the user needs to supply).
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewacronymstyle{footnote-sc-desc}%
{%
  \GlsUseAcrEntryDispStyle{footnote-sc}%
}%
{%
  \GlsUseAcrStyleDefs{footnote-sc}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glslongaccessdisplay{\glsentrylong{##1}}{##1}\space
    (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{acrstyle}{footnote-sm-desc}
% \cs{textsmaller}\marg{short}\cs{footnote}\marg{long} acronym style that has an
% accompanying description (which the user needs to supply).
%\changes{4.03}{2014-01-20}{redefined to use accessibility
%information}
%    \begin{macrocode}
\renewacronymstyle{footnote-sm-desc}%
{%
  \GlsUseAcrEntryDispStyle{footnote-sm}%
}%
{%
  \GlsUseAcrStyleDefs{footnote-sm}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glslongaccessdisplay{\glsentrylong{##1}}{##1}\space
    (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})}%
}
%    \end{macrocode}
%\end{acrstyle}
%
%\begin{macro}{\glsdefaultshortaccess}
%\changes{4.45}{2020-02-13}{new}
%\begin{definition}
%\cs{glsdefaultshortaccess}\marg{long}\marg{short}
%\end{definition}
%Default \gloskey{shortaccess} value.
%    \begin{macrocode}
\newcommand*{\glsdefaultshortaccess}[2]{#1}
%    \end{macrocode}
%\end{macro}
%
% Use \cs{newacronymhook} to modify the key list to set
% the access text to the long version by default.
%\changes{1.46}{2021-09-20}{changed \cs{edef} to \cs{protected@edef}}
%    \begin{macrocode}
\renewcommand*{\newacronymhook}{%
  \protected@edef\@gls@keylist{%
     shortaccess={\glsdefaultshortaccess{\the\glslongtok}{\the\glsshorttok}},%
     shortpluralaccess={\glsdefaultshortaccess{\the\glslongtok}{\the\glsshorttok}},%
     \the\glskeylisttok}%
  \expandafter\glskeylisttok\expandafter{\@gls@keylist}%
}
%    \end{macrocode}
%\begin{macro}{\DefaultNewAcronymDef}
% Modify default style to use access text:
%    \begin{macrocode}
\renewcommand*{\DefaultNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\the\glsshorttok},%
      description={\the\glslongtok},%
      descriptionaccess=\relax,
      text={\the\glsshorttok},%
      access={\noexpand\@glo@textaccess},%
      sort={\the\glsshorttok},%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      shortaccess={\glsdefaultshortaccess{\the\glslongtok}{\the\glsshorttok}},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      descriptionplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      first={\noexpand\glslongaccessdisplay
        {\the\glslongtok}{\the\glslabeltok}\space
        (\noexpand\glsshortaccessdisplay
          {\the\glsshorttok}{\the\glslabeltok})},%
      plural={\the\glsshorttok\acrpluralsuffix},%
      firstplural={\noexpand\glslongpluralaccessdisplay
        {\noexpand\@glo@longpl}{\the\glslabeltok}\space
        (\noexpand\glsshortpluralaccessdisplay
          {\noexpand\@glo@shortpl}{\the\glslabeltok})},%
      firstaccess=\relax,
      firstpluralaccess=\relax,
      textaccess={\noexpand\@glo@shortaccess},%
      \the\glskeylisttok
    }%
  }%
  \let\@org@gls@assign@firstpl\gls@assign@firstpl
  \let\@org@gls@assign@plural\gls@assign@plural
  \let\@org@gls@assign@descplural\gls@assign@descplural
  \def\gls@assign@firstpl##1##2{%
    \@@gls@expand@field{##1}{firstpl}{##2}%
  }%
  \def\gls@assign@plural##1##2{%
    \@@gls@expand@field{##1}{plural}{##2}%
  }%
  \def\gls@assign@descplural##1##2{%
    \@@gls@expand@field{##1}{descplural}{##2}%
  }%
  \@do@newglossaryentry
  \let\gls@assign@firstpl\@org@gls@assign@firstpl
  \let\gls@assign@plural\@org@gls@assign@plural
  \let\gls@assign@symbolplural\@org@gls@assign@symbolplural
  \@@gls@noexpand@assign@default@plurals
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\DescriptionFootnoteNewAcronymDef}
%    \begin{macrocode}
\renewcommand*{\DescriptionFootnoteNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\noexpand\acronymfont{\the\glsshorttok}},%
      sort={\the\glsshorttok},%
      text={\the\glsshorttok},%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      shortaccess={\glsdefaultshortaccess{\the\glslongtok}{\the\glsshorttok}},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      access={\noexpand\@glo@textaccess},%
      plural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      symbol={\the\glslongtok},%
      symbolplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      firstpluralaccess=\relax,
      textaccess={\noexpand\@glo@shortaccess},%
      \the\glskeylisttok
    }%
  }%
  \let\@org@gls@assign@firstpl\gls@assign@firstpl
  \let\@org@gls@assign@plural\gls@assign@plural
  \let\@org@gls@assign@symbolplural\gls@assign@symbolplural
  \def\gls@assign@firstpl##1##2{%
    \@@gls@expand@field{##1}{firstpl}{##2}%
  }%
  \def\gls@assign@plural##1##2{%
    \@@gls@expand@field{##1}{plural}{##2}%
  }%
  \def\gls@assign@symbolplural##1##2{%
    \@@gls@expand@field{##1}{symbolplural}{##2}%
  }%
  \@do@newglossaryentry
  \let\gls@assign@plural\@org@gls@assign@plural
  \let\gls@assign@firstpl\@org@gls@assign@firstpl
  \let\gls@assign@symbolplural\@org@gls@assign@symbolplural
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\DescriptionNewAcronymDef}
%    \begin{macrocode}
\renewcommand*{\DescriptionNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\noexpand
        \acrnameformat{\the\glsshorttok}{\the\glslongtok}},%
      access={\noexpand\@glo@textaccess},%
      sort={\the\glsshorttok},%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      shortaccess={\glsdefaultshortaccess{\the\glslongtok}{\the\glsshorttok}},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      first={\the\glslongtok},%
      firstaccess=\relax,
      firstplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      text={\the\glsshorttok},%
      textaccess={\the\glslongtok},%
      plural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      symbol={\noexpand\@glo@text},%
      symbolaccess={\noexpand\@glo@textaccess},%
      symbolplural={\noexpand\@glo@plural},%
      firstpluralaccess=\relax,
      textaccess={\noexpand\@glo@shortaccess},%
      \the\glskeylisttok}%
  }%
  \let\@org@gls@assign@firstpl\gls@assign@firstpl
  \let\@org@gls@assign@plural\gls@assign@plural
  \let\@org@gls@assign@symbolplural\gls@assign@symbolplural
  \def\gls@assign@firstpl##1##2{%
    \@@gls@expand@field{##1}{firstpl}{##2}%
  }%
  \def\gls@assign@plural##1##2{%
    \@@gls@expand@field{##1}{plural}{##2}%
  }%
  \def\gls@assign@symbolplural##1##2{%
    \@@gls@expand@field{##1}{symbolplural}{##2}%
  }%
  \@do@newglossaryentry
  \let\gls@assign@firstpl\@org@gls@assign@firstpl
  \let\gls@assign@plural\@org@gls@assign@plural
  \let\gls@assign@symbolplural\@org@gls@assign@symbolplural
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\FootnoteNewAcronymDef}
%    \begin{macrocode}
\renewcommand*{\FootnoteNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\noexpand\acronymfont{\the\glsshorttok}},%
      sort={\the\glsshorttok},%
      text={\the\glsshorttok},%
      textaccess={\the\glslongtok},%
      access={\noexpand\@glo@textaccess},%
      plural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      description={\the\glslongtok},%
      descriptionplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      \the\glskeylisttok
    }%
  }%
  \let\@org@gls@assign@plural\gls@assign@plural
  \let\@org@gls@assign@firstpl\gls@assign@firstpl
  \let\@org@gls@assign@descplural\gls@assign@descplural
  \def\gls@assign@firstpl##1##2{%
    \@@gls@expand@field{##1}{firstpl}{##2}%
  }%
  \def\gls@assign@plural##1##2{%
    \@@gls@expand@field{##1}{plural}{##2}%
  }%
  \def\gls@assign@descplural##1##2{%
    \@@gls@expand@field{##1}{descplural}{##2}%
  }%
  \@do@newglossaryentry
  \let\gls@assign@plural\@org@gls@assign@plural
  \let\gls@assign@firstpl\@org@gls@assign@firstpl
  \let\gls@assign@descplural\@org@gls@assign@descplural
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SmallNewAcronymDef}
%    \begin{macrocode}
\renewcommand*{\SmallNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\noexpand\acronymfont{\the\glsshorttok}},%
      access={\noexpand\@glo@symbolaccess},%
      sort={\the\glsshorttok},%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      shortaccess={\glsdefaultshortaccess{\the\glslongtok}{\the\glsshorttok}},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      text={\noexpand\@glo@short},%
      textaccess={\noexpand\@glo@shortaccess},%
      plural={\noexpand\@glo@shortpl},%
      first={\the\glslongtok},%
      firstaccess=\relax,
      firstplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      description={\noexpand\@glo@first},%
      descriptionplural={\noexpand\@glo@firstplural},%
      symbol={\the\glsshorttok},%
      symbolaccess={\the\glslongtok},%
      symbolplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      \the\glskeylisttok
    }%
  }%
  \let\@org@gls@assign@firstpl\gls@assign@firstpl
  \let\@org@gls@assign@plural\gls@assign@plural
  \let\@org@gls@assign@descplural\gls@assign@descplural
  \let\@org@gls@assign@symbolplural\gls@assign@symbolplural
  \def\gls@assign@firstpl##1##2{%
    \@@gls@expand@field{##1}{firstpl}{##2}%
  }%
  \def\gls@assign@plural##1##2{%
    \@@gls@expand@field{##1}{plural}{##2}%
  }%
  \def\gls@assign@descplural##1##2{%
    \@@gls@expand@field{##1}{descplural}{##2}%
  }%
  \def\gls@assign@symbolplural##1##2{%
    \@@gls@expand@field{##1}{symbolplural}{##2}%
  }%
  \@do@newglossaryentry
  \let\gls@assign@firstpl\@org@gls@assign@firstpl
  \let\gls@assign@plural\@org@gls@assign@plural
  \let\gls@assign@descplural\@org@gls@assign@descplural
  \let\gls@assign@symbolplural\@org@gls@assign@symbolplural
}
%    \end{macrocode}
%\end{macro}
%
% The following are kept for compatibility with versions before
% 3.0:
%\begin{macro}{\glsshortaccesskey}
%    \begin{macrocode}
  \newcommand*{\glsshortaccesskey}{\glsshortkey access}%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsshortpluralaccesskey}
%    \begin{macrocode}
  \newcommand*{\glsshortpluralaccesskey}{\glsshortpluralkey access}%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glslongaccesskey}
%    \begin{macrocode}
  \newcommand*{\glslongaccesskey}{\glslongkey access}%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glslongpluralaccesskey}
%    \begin{macrocode}
  \newcommand*{\glslongpluralaccesskey}{\glslongpluralkey access}%
%    \end{macrocode}
%\end{macro}
%\section{Debugging Commands}
%
%\begin{macro}{\showglonameaccess}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%\changes{4.38}{2018-05-10}{bug fix: corrected field (was showing text access field)}
%    \begin{macrocode}
\newcommand*{\showglonameaccess}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@access\endcsname
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\showglotextaccess}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglotextaccess}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@textaccess\endcsname
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\showglopluralaccess}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglopluralaccess}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@pluralaccess\endcsname
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\showglofirstaccess}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglofirstaccess}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@firstaccess\endcsname
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\showglofirstpluralaccess}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglofirstpluralaccess}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@firstpluralaccess\endcsname
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\showglosymbolaccess}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglosymbolaccess}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@symbolaccess\endcsname
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\showglosymbolpluralaccess}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglosymbolpluralaccess}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@symbolpluralaccess\endcsname
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\showglodescaccess}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglodescaccess}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@descaccess\endcsname
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\showglodescpluralaccess}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglodescpluralaccess}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@descpluralaccess\endcsname
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\showgloshortaccess}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showgloshortaccess}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@shortaccess\endcsname
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\showgloshortpluralaccess}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showgloshortpluralaccess}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@shortpluralaccess\endcsname
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\showglolongaccess}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglolongaccess}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@longaccess\endcsname
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\showglolongpluralaccess}
%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}}
%    \begin{macrocode}
\newcommand*{\showglolongpluralaccess}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@longpluralaccess\endcsname
}
%    \end{macrocode}
%\end{macro}
%\iffalse
%    \begin{macrocode}
%</glossaries-accsupp.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-babel.sty>
%    \end{macrocode}
%\fi
%\chapter{Multi-Lingual Support}
% Many thanks to everyone who contributed to the translations both
% via email and on comp.text.tex.
% Language support has now been split off into independent language
% modules.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{glossaries-babel}[2021/11/01 v4.49 (NLCT)]
%    \end{macrocode}
% Load \sty{tracklang} to obtain language settings.
%    \begin{macrocode}
\RequirePackage{tracklang}
\let\glsifusetranslator\@secondoftwo
%    \end{macrocode}
% Check for tracked languages:
%    \begin{macrocode}
  \AnyTrackedLanguages
  {%
    \ForEachTrackedDialect{\this@dialect}{%
      \IfTrackedLanguageFileExists{\this@dialect}%
      {glossaries-}% prefix
      {.ldf}%
      {%
        \RequireGlossariesLang{\CurrentTrackedTag}%
      }%
      {%
         \PackageWarningNoLine{glossaries}%
         {No language module detected for `\this@dialect'.\MessageBreak
          Language modules need to be installed separately.\MessageBreak
          Please check on CTAN for a bundle called\MessageBreak
         `glossaries-\CurrentTrackedLanguage' or similar}%
      }%
    }%
  }%
  {}%
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-babel.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-polyglossia.sty>
%    \end{macrocode}
%\fi
%\section{Polyglossia Captions}
% Language support has now been split off into independent language
% modules.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{glossaries-polyglossia}[2021/11/01 v4.49 (NLCT)]
%    \end{macrocode}
% Load \sty{tracklang} to obtain language settings.
%    \begin{macrocode}
\RequirePackage{tracklang}
\let\glsifusetranslator\@secondoftwo
%    \end{macrocode}
% Check for tracked languages:
%    \begin{macrocode}
  \AnyTrackedLanguages
  {%
    \ForEachTrackedDialect{\this@dialect}{%
      \IfTrackedLanguageFileExists{\this@dialect}%
      {glossaries-}% prefix
      {.ldf}%
      {%
        \RequireGlossariesLang{\CurrentTrackedTag}%
      }%
      {%
         \PackageWarningNoLine{glossaries}%
         {No language module detected for `\this@dialect'.\MessageBreak
          Language modules need to be installed separately.\MessageBreak
          Please check on CTAN for a bundle called\MessageBreak
         `glossaries-\CurrentTrackedLanguage' or similar}%
      }%
    }%
  }%
  {}%
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-polyglossia.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-acronym-desc.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% This file is part of the glossaries bundle
% These are test acronym entries with descriptions.
%COMMENT

\newacronym[type=\glsdefaulttype,description={fringilla a, euismod sodales,
  sollicitudin vel, wisi}]{ndl}{NDL}{nam dui ligula}

\newacronym[type=\glsdefaulttype,description={non justo}]{mal}{MAL}{morbi auctor lorem}

\newacronym[type=\glsdefaulttype,description={pretium at, lobortis vitae, ultricies et,
tellus}]{nll}{NLL}{name lacus libero}

\newacronym[type=\glsdefaulttype,description={tortor sed accumsan bibendum, erat ligula
aliquet magna, vitae ornare odio metus a mi}]{da}{DA}{donec aliquet}

\newacronym[type=\glsdefaulttype,description={et nisl hendrerit mollis}]{mao}{MAO}{morbi ac orci}

\newacronym[type=\glsdefaulttype,description={cras nec ante}]{sum}{SUM}{suspendisse ut massa}

\newacronym[type=\glsdefaulttype,description={cum sociis natoque penatibus et magnis dis
parturient montes, nascetur ridiculus mus}]{pan}{PAN}{pellentesque a nulla}

\newacronym[type=\glsdefaulttype,description={nulla ullamcorper vestibulum 
turpis}]{atu}{ATU}{aliquam tincidunt urna}

\newacronym[type=\glsdefaulttype,description={nulla malesuada porttitor diam}]%
 {pclm}{PCLM}{pellentesque cursus luctus mauris}

%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-acronym-desc.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-acronym.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% This file is part of the glossaries bundle
% These are test acronym entries
%COMMENT

\newacronym[type=\glsdefaulttype]{lid}{LID}{lorem ipsum dolor}

\newacronym[type=\glsdefaulttype]{stc}{STC}{sit amet consectetuer}

\newacronym[type=\glsdefaulttype]{aeu}{AEU}{adipiscing elit ut}

\newacronym[type=\glsdefaulttype]{pev}{PEV}{purus elit vestibulum}

\newacronym[type=\glsdefaulttype]{upa}{UPA}{ut placerat ac}

\newacronym[type=\glsdefaulttype]{avf}{AVF}{adipiscing vitae felis}

\newacronym[type=\glsdefaulttype]{cdg}{CDG}{curabitur dictum gravida}

\newacronym[type=\glsdefaulttype]{mna}{MNA}{mauris nam arcu}

\newacronym[type=\glsdefaulttype]{lne}{LNE}{libero nonummy eget}

\newacronym[type=\glsdefaulttype]{civ}{CIV}{consectetuer id vulputate}

\newacronym[type=\glsdefaulttype]{amd}{AMD}{a magna donec}

\newacronym[type=\glsdefaulttype]{vae}{VAE}{vehicula augue eu}

\newacronym[type=\glsdefaulttype]{nph}{NPH}{neque pellentesque habitant}

\newacronym[type=\glsdefaulttype]{mts}{MTS}{morbi tristique senectus}

\newacronym[type=\glsdefaulttype]{ene}{ENE}{et netus et}

\newacronym[type=\glsdefaulttype]{mfa}{MFA}{malesuada fames ac}

\newacronym[type=\glsdefaulttype]{tem}{TEM}{turpis egestas mauris}

\newacronym[type=\glsdefaulttype]{ulc}{ULC}{ut leo cras}

\newacronym[type=\glsdefaulttype]{vmr}{VMR}{viverra metus rhoncus}

\newacronym[type=\glsdefaulttype]{sne}{SNE}{sem nulla et}

\newacronym[type=\glsdefaulttype]{lvu}{LVU}{lectus vestibulum urna}

\newacronym[type=\glsdefaulttype]{fup}{FUP}{fringilla ultrices phasellus}

\newacronym[type=\glsdefaulttype]{ets}{ETS}{eu tellus sit}

\newacronym[type=\glsdefaulttype]{atg}{ATG}{amet tortor gravida}

\newacronym[type=\glsdefaulttype]{pis}{PIS}{placerat integer sapien}

\newacronym[type=\glsdefaulttype]{eii}{EII}{est iaculis in}

\newacronym[type=\glsdefaulttype]{pqv}{PQV}{pretium quis viverra}

\newacronym[type=\glsdefaulttype]{anp}{ANP}{ac nunc praesent}

\newacronym[type=\glsdefaulttype]{esv}{ESV}{eget sem vel}

\newacronym[type=\glsdefaulttype]{lub}{LUB}{leo ultrices bibendum}

\newacronym[type=\glsdefaulttype]{afm}{AFM}{aenean faucibus morbi}

\newacronym[type=\glsdefaulttype]{dnm}{DNM}{dolor nulla malesuada}

\newacronym[type=\glsdefaulttype]{epa}{EPA}{eu pulvinar at}

\newacronym[type=\glsdefaulttype]{man}{MAC}{mollis ac nulla}

\newacronym[type=\glsdefaulttype]{cas}{CAS}{curabitur auctor semper}

\newacronym[type=\glsdefaulttype]{ndv}{NDV}{nulla donec varius}

\newacronym[type=\glsdefaulttype]{oer}{OER}{orci eget risus}

\newacronym[type=\glsdefaulttype]{dnmc}{DNMC}{duis nibh mi congue}

\newacronym[type=\glsdefaulttype]{cea}{CEA}{congue eu accumsan}

\newacronym[type=\glsdefaulttype]{esq}{ESQ}{eleifend sagittis quis}

\newacronym[type=\glsdefaulttype]{dia}{DIA}{duis eget orci}

\newacronym[type=\glsdefaulttype]{sao}{SAO}{sit amet orci}

\newacronym[type=\glsdefaulttype]{drn}{DRN}{dignissim rutrum nam}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-acronym.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-acronyms-lang.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% This file is part of the glossaries bundle
% These are test acronym entries where some are provided with
% "translations", which are stored in the user1 key.
%COMMENT

\newacronym[type=\glsdefaulttype,user1={love itself}]{li}{LI}{lorem ipsum}

\newacronym[type=\glsdefaulttype,user1={produces none}]{np}{NP}{nulla pariatur}

\newacronym[type=\glsdefaulttype,user1={blame belongs}]{sic}{SIC}{sunt in culpa}

\newacronym[type=\glsdefaulttype,user1={blinded by
desire}]{esoc}{ESOC}{excepturi sint obcaecati cupiditat}

\newacronym[type=\glsdefaulttype]{nmruu}{NMRUU}{nulla malesuada
risus ut urna}

\newacronym[type=\glsdefaulttype]{di}{DI}{duis iaculi}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-acronyms-lang.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-brief.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% This file is part of the glossaries bundle
% These are test glossary entries with brief descriptions.
%COMMENT

\newglossaryentry{lorem}{name={lorem},description={ipsum}}

\newglossaryentry{dolor}{name={dolor},description={sit}}

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

\newglossaryentry{adipiscing}{name={adipiscing},description={elit}}

\newglossaryentry{ut}{name={ut},description={purus}}

\newglossaryentry{elit}{name={elit},description={vestibulum}}

\newglossaryentry{placerat}{name={placerat},description={ac}}

\newglossaryentry{vitae}{name={vitae},description={felis}}

\newglossaryentry{curabitur}{name={curabitur},description={gravida}}

\newglossaryentry{mauris}{name={mauris},description={nam}}

\newglossaryentry{arcu}{name={arcu},description={libero}}

\newglossaryentry{nonummy}{name={nonummy},description={eget}}

\newglossaryentry{consectetuer}{name={consectetuer},description={id}}

\newglossaryentry{vulputate}{name={vulputate},description={a magna}}

\newglossaryentry{donec}{name={donec},description={vehicula}}

\newglossaryentry{augue}{name={augue},description={eu neque}}

\newglossaryentry{pellentesque}{name={pellentesque},description={habitant}}

\newglossaryentry{morbi}{name={morbi},description={tristique}}

\newglossaryentry{senectus}{name={senectus},description={et netus}}

\newglossaryentry{et}{name={et},description={malesuada}}

\newglossaryentry{fames}{name={fames},description={ac}}

\newglossaryentry{turpis}{name={turpis},description={egestas}}

\newglossaryentry{leo}{name={leo},description={cras}}

\newglossaryentry{viverra}{name={viverra},description={metus}}

\newglossaryentry{rhoncus}{name={rhoncus},description={sem}}

\newglossaryentry{nulla}{name={nulla},description={et}}

\newglossaryentry{lectus}{name={lectus},description={vestibulum}}

\newglossaryentry{urna}{name={urna},description={fringilla}}

\newglossaryentry{ultrices}{name={ultrices},description={phasellus}}

\newglossaryentry{eu}{name={eu},description={tellus}}

\newglossaryentry{sit}{name={sit},description={amet}}

\newglossaryentry{tortor}{name={tortor},description={gravida}}

\newglossaryentry{integer}{name={integer},description={sapien}}

\newglossaryentry{est}{name={est},description={iaculis}}

\newglossaryentry{in}{name={in},description={pretium}}

\newglossaryentry{quis}{name={quis},description={viverra}}

\newglossaryentry{ac}{name={ac},description={nunc}}

\newglossaryentry{praesent}{name={praesent},description={eget}}

\newglossaryentry{sem}{name={sem},description={vel leo}}

\newglossaryentry{bibendum}{name={bibendum},description={ultrices}}

\newglossaryentry{aenean}{name={aenean},description={faucibus}}

\newglossaryentry{malesuada}{name={malesuada},description={eu}}

\newglossaryentry{pulvinar}{name={pulvinar},description={at}}

\newglossaryentry{mollis}{name={mollis},description={ac nulla}}

\newglossaryentry{auctor}{name={auctor},description={semper}}

\newglossaryentry{varius}{name={varius},description={orci}}

\newglossaryentry{eget}{name={eget},description={risus}}

\newglossaryentry{duis}{name={duis},description={nibh}}

\newglossaryentry{mi}{name={mi},description={congue}}

\newglossaryentry{accumsan}{name={accumsan},description={eleifend}}

\newglossaryentry{sagittis}{name={sagittis},description={quis}}

\newglossaryentry{diam}{name={diam},description={duis}}

\newglossaryentry{orci}{name={orci},description={dignissim}}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-brief.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-childmultipar.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% This file is part of the glossaries bundle.
% These are test glossary entries with child entries that have 
% multi-paragraph descriptions. One parent entry also has a
% multi-paragraph description. Some entries have an associated
% image file (stored in user1). The referenced image files are 
% provided by the mwe package.
%COMMENT

\newglossaryentry{hiersedmattis}{name={sed mattis},user1={example-image},
 description={Erat sit amet dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur
dictum gravida mauris. Ut pellentesque augue sed urna. Vestibulum
diam eros, fringilla et, consectetuer eu, nonummy id, sapien. Nullam
at lectus. In sagittis ultrices mauris. Curabitur malesuada erat sit
amet massa. Fusce blandit. Aliquam erat volutpat.}}


\longnewglossaryentry{hierloremi-ii}
{name={lorem 1--2},parent={hiersedmattis}}%
{%
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur
dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer
id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque
habitant morbi tristique senectus et netus et malesuada fames ac
turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla
et lectus vestibulum urna fringilla ultrices.  Phasellus eu tellus
sit amet tortor gravida placerat. Integer sapien est, iaculis in,
pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices
bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar
at, mollis ac, nulla.  Curabitur auctor semper nulla. Donec varius
orci eget risus. Duis nibh mi, congue eu, accumsan eleifend,
sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum.

Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel,
wisi. Morbi auctor lorem non justo. Nam lacus libero, pretium at,
lobortis vitae, ultricies et, tellus. Donec aliquet, tortor sed
accumsan bibendum, erat ligula aliquet magna, vitae ornare odio
metus a mi. Morbi ac orci et nisl hendrerit mollis. Suspendisse ut
massa. Cras nec ante. Pellentesque a nulla.  Cum sociis natoque
penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Aliquam tincidunt urna. Nulla ullamcorper vestibulum turpis.
Pellentesque cursus luctus mauris.%
}

\longnewglossaryentry{hierloremiii-iv}
{name={lorem 3--4},parent={hiersedmattis},user1={example-image}}%
{%
Nulla malesuada porttitor diam. Donec felis erat, congue non,
volutpat at, tincidunt tristique, libero.  Vivamus viverra fermentum
felis. Donec nonummy pellentesque ante.  Phasellus adipiscing semper
elit. Proin fermentum massa ac quam. Sed diam turpis, molestie
vitae, placerat a, molestie nec, leo. Maecenas lacinia. Nam ipsum
ligula, eleifend at, accumsan nec, suscipit a, ipsum. Morbi blandit
ligula feugiat magna. Nunc eleifend consequat lorem. Sed lacinia
nulla vitae enim. Pellentesque tincidunt purus vel magna. Integer
non enim. Praesent euismod nunc eu purus. Donec bibendum quam in
tellus. Nullam cursus pulvinar lectus. Donec et mi.  Nam vulputate
metus eu enim. Vestibulum pellentesque felis eu massa. 

Quisque ullamcorper placerat ipsum. Cras nibh.  Morbi vel justo
vitae lacus tincidunt ultrices. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. In hac habitasse platea dictumst.
Integer tempus convallis augue. Etiam facilisis. Nunc elementum
fermentum wisi. Aenean placerat. Ut imperdiet, enim sed gravida
sollicitudin, felis odio placerat quam, ac pulvinar elit purus eget
enim. Nunc vitae tortor. Proin tempus nibh sit amet nisl.  Vivamus
quis tortor vitae risus porta vehicula.%
}

\longnewglossaryentry{hierloremv-vi}
{name={lorem 5--6},parent={hiersedmattis}}%
{%
Fusce mauris. Vestibulum luctus nibh at lectus.  Sed bibendum, nulla
a faucibus semper, leo velit ultricies tellus, ac venenatis arcu
wisi vel nisl. Vestibulum diam. Aliquam pellentesque, augue quis
sagittis posuere, turpis lacus congue quam, in hendrerit risus eros
eget felis. Maecenas eget erat in sapien mattis porttitor.
Vestibulum porttitor. Nulla facilisi. Sed a turpis eu lacus commodo
facilisis. Morbi fringilla, wisi in dignissim interdum, justo lectus
sagittis dui, et vehicula libero dui cursus dui. Mauris tempor
ligula sed lacus. Duis cursus enim ut augue.  Cras ac magna. Cras
nulla. Nulla egestas. Curabitur a leo. Quisque egestas wisi eget
nunc. Nam feugiat lacus vel est. Curabitur consectetuer.%

Suspendisse vel felis. Ut lorem lorem, interdum eu, tincidunt sit
amet, laoreet vitae, arcu. Aenean faucibus pede eu ante. Praesent
enim elit, rutrum at, molestie non, nonummy vel, nisl. Ut lectus
eros, malesuada sit amet, fermentum eu, sodales cursus, magna. Donec
eu purus. Quisque vehicula, urna sed ultricies auctor, pede lorem
egestas dui, et convallis elit erat sed nulla.  Donec luctus.
Curabitur et nunc. Aliquam dolor odio, commodo pretium, ultricies
non, pharetra in, velit. Integer arcu est, nonummy in, fermentum
faucibus, egestas vel, odio.%
}

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

Morbi ultrices rutrum lorem. Nam elementum ullamcorper
leo. Morbi dui. Aliquam sagittis. Nunc placerat.  Pellentesque
tristique sodales est. Maecenas imperdiet lacinia velit. Cras non
urna. Morbi eros pede, suscipit ac, varius vel, egestas non, eros.}

\longnewglossaryentry{hierloremvii-viii}
{name={lorem 7--8},parent={hiergravida},user1={example-image-b}}%
{%
Sed commodo posuere pede. Mauris ut est. Ut quis purus. Sed ac odio.
Sed vehicula hendrerit sem. Duis non odio.  Morbi ut dui. Sed
accumsan risus eget odio. In hac habitasse platea dictumst.
Pellentesque non elit. Fusce sed justo eu urna porta tincidunt.
Mauris felis odio, sollicitudin sed, volutpat a, ornare ac, erat.
Morbi quis dolor. Donec pellentesque, erat ac sagittis semper, nunc
dui lobortis purus, quis congue purus metus ultricies tellus. Proin
et quam. Class aptent taciti sociosqu ad litora torquent per conubia
nostra, per inceptos hymenaeos. Praesent sapien turpis, fermentum
vel, eleifend faucibus, vehicula eu, lacus.

Pellentesque habitant morbi tristique senectus et netus et malesuada
fames ac turpis egestas. Donec odio elit, dictum in, hendrerit sit
amet, egestas sed, leo. Praesent feugiat sapien aliquet odio.
Integer vitae justo. Aliquam vestibulum fringilla lorem. Sed neque
lectus, consectetuer at, consectetuer sed, eleifend ac, lectus.
Nulla facilisi. Pellentesque eget lectus.  Proin eu metus. Sed
porttitor. In hac habitasse platea dictumst.  Suspendisse eu lectus.
Ut mi mi, lacinia sit amet, placerat et, mollis vitae, dui. Sed ante
tellus, tristique ut, iaculis eu, malesuada ac, dui.  Mauris nibh
leo, facilisis non, adipiscing quis, ultrices a, dui.%
}

\longnewglossaryentry{hierloremix-x}
{name={lorem 9--10},parent={hiergravida},user1={example-image-c}}%
{%
Morbi luctus, wisi viverra faucibus pretium, nibh est placerat odio,
nec commodo wisi enim eget quam. Quisque libero justo, consectetuer
a, feugiat vitae, porttitor eu, libero.  Suspendisse sed mauris
vitae elit sollicitudin malesuada. Maecenas ultricies eros sit amet
ante. Ut venenatis velit. Maecenas sed mi eget dui varius euismod.
Phasellus aliquet volutpat odio.  Vestibulum ante ipsum primis in
faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque
sit amet pede ac sem eleifend consectetuer. Nullam elementum, urna
vel imperdiet sodales, elit ipsum pharetra ligula, ac pretium ante
justo a nulla. Curabitur tristique arcu eu metus. Vestibulum lectus.
Proin mauris. Proin eu nunc eu urna hendrerit faucibus. Aliquam
auctor, pede consequat laoreet varius, eros tellus scelerisque quam,
pellentesque hendrerit ipsum dolor sed augue. Nulla nec lacus.

Suspendisse vitae elit. Aliquam arcu neque, ornare in, ullamcorper
quis, commodo eu, libero. Fusce sagittis erat at erat tristique
mollis. Maecenas sapien libero, molestie et, lobortis in, sodales
eget, dui. Morbi ultrices rutrum lorem. Nam elementum ullamcorper
leo. Morbi dui. Aliquam sagittis. Nunc placerat.  Pellentesque
tristique sodales est. Maecenas imperdiet lacinia velit. Cras non
urna. Morbi eros pede, suscipit ac, varius vel, egestas non, eros.
Praesent malesuada, diam id pretium elementum, eros sem dictum
tortor, vel consectetuer odio sem sed wisi.%
}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-childmultipar.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-childnoname.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% This file is part of the glossaries bundle
% These are test glossary entries with child entries that don't have
% a name supplied. (The name is the same as the parent name.)
%COMMENT

\newglossaryentry{scelerisque}{name={scelerisque},description={at}}

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

\newglossaryentry{utodionisl}{parent={scelerisque},description={facilisis id}}

\newglossaryentry{molliset}{parent={scelerisque},description={nec, enim}}

\newglossaryentry{aeneansem}{parent={scelerisque},description={sem leo}}

\newglossaryentry{pellentesquesit}{parent={scelerisque},description={sit amet}}

\newglossaryentry{sapien}{parent={scelerisque},description={vehicula
pellentesque}}

\newglossaryentry{consequat}{parent={scelerisque},description={tellus
et tortor}}

\newglossaryentry{uttempor}{name={ut tempor},description={laoreet
quam}}

\newglossaryentry{nullamid}{parent={uttempor},description={wisi a
libero}}

\newglossaryentry{tristique}{parent={uttempor},description={semper}}

\newglossaryentry{nullamnislmassa}{parent={uttempor},description={rutrum
ut}}

\newglossaryentry{eleifend}{name={eleifend},description={sit amet
faucibus}}

\newglossaryentry{elementum}{parent={eleifend},description={elementum}}

\newglossaryentry{urnasapien}{parent={eleifend},description={urna sapien}}

\newglossaryentry{consectetuermauris}{name={consectetuer},description={mauris}}

\newglossaryentry{quisegestas}{parent={consectetuermauris},description={quis egestas}}

\newglossaryentry{leojusto}{parent={consectetuermauris},description={leo
justo}}

\newglossaryentry{nonrisus}{name={non risus},description={morbi non
felis}}

\newglossaryentry{aclibero}{parent={nonrisus},description={ac libero}}

\newglossaryentry{vulputatefringilla}{parent={nonrisus},description={vulputate
fringilla}}

\newglossaryentry{maurislibero}{name={mauris},description={libero eros}}

\newglossaryentry{lacinia}{parent={maurislibero},description={lacinia
non}}

\newglossaryentry{sodales}{parent={maurislibero},description={sodales
quis}}

\newglossaryentry{dapibus}{parent={maurislibero},description={dapibus
porttitor, pede}}

\newglossaryentry{class}{name={class},description={aptent taciti}}

\newglossaryentry{sociosqu}{parent={class},description={sociosqu}}

\newglossaryentry{adlitora}{parent={class},description={ad litora}}

\newglossaryentry{torquent}{parent={class},description={torquent per
conubia}}

\newglossaryentry{nostra}{name={nostra},description={per inceptos
hymenaeos}}

\newglossaryentry{morbidapibus}{parent={nostra},description={morbi
dapibus}}

\newglossaryentry{mauriscondimentum}{parent={nostra},description={mauris
condimentum nulla}}

\newglossaryentry{cumsociis}{name={cum sociis},description={natoque
penatibus}}

\newglossaryentry{etmagnis}{parent={cumsociis},description={et
magnis}}

\newglossaryentry{disparturient}{parent={cumsociis},description={dis
parturient montes}}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-childnoname.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-cite.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% This file is part of the glossaries bundle
% These are test glossary entries with citation labels stored in
% the user1 field. (The citations are defined in the xampl.bib file
% that should be available on modern TeX distributions.)
%COMMENT

\newglossaryentry{fusce}{name={fusce},
description={suscipit cursus sem},user1={article-minimal}}

\newglossaryentry{vivamus}{name={vivamus},
description={risus mi, egestas ac},user1={article-full}}

\newglossaryentry{imperdiet}{name={imperdiet},
description={varius, faucibus quis, leo},user1={whole-journal}}

\newglossaryentry{aenean2}{name={aenean},
description={tincidunt},user1={inbook-minimal}}

\newglossaryentry{crasid}{name={cras id},
description={justo quis nibh scelerisque dignissim},
user1={inbook-full}}

\newglossaryentry{aliquam2}{name={aliquam},
description={sagittis elementum dolor},
user1={book-minimal}}

\newglossaryentry{aeneanconsectetuer}{name={aenean consectetuer},
description={justo in pede},
user1={book-full}}

\newglossaryentry{curabiturullamcorper}{name={curabitur ullamcorper},
description={ligula nec orci},
user1={booklet-minimal}}

\newglossaryentry{aliquampurus}{name={aliquam purus},
description={turpis, aliquam id},
user1={booklet-full}}

\newglossaryentry{ornarevitae}{name={ornare vitae},
description={porttitor non, wisi},
user1={incollection-minimal}}

\newglossaryentry{maecenasluctus}{name={maecenas luctus},
description={porta lorem},
user1={incollection-full}}

\newglossaryentry{donecvitae}{name={donec vitae},
description={ligula eu ante pretium varius},
user1={manual-minimal}}

\newglossaryentry{proin}{name={proin},
description={tortor metus, convallis et},
user1={manual-full}}

\newglossaryentry{hendrerit}{name={hendrerit},
description={non, scelerisque in, urna},
user1={mastersthesis-minimal}}

\newglossaryentry{crasquis}{name={cras qui},
description={libero eu ligula bibendum tempor},
user1={mastersthesis-full}}

\newglossaryentry{vivamustellus}{name={vivamus tellus},
description={quam, malesuada eu, tempus sed, tempor sed, velit},
user1={misc-minimal}}

\newglossaryentry{doneclacinia}{name={donec lacinia},
description={auctor libero},
user1={misc-full}}

\newglossaryentry{praesent2}{name={praesent},
description={sed neque id pede mollis rutrum},
user1={inproceedings-minimal}}

 % Here's one with multiple cites:
\newglossaryentry{vestibulum2}{name={vestibulum},
description={iaculis risus},
user1={inproceedings-minimal,phdthesis-minimal}}

 % Here's one without a user1 key for comparison:
\newglossaryentry{pellentesque2}{name={pellentesque},
description={lacus}}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-cite.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-images.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% This file is part of the glossaries bundle
% These are test glossary entries with multi-paragraph descriptions
% that have an associated image file (stored in user1).
% The referenced image files are provided by the mwe package.
%COMMENT

\longnewglossaryentry{sedfeugiat}{name={sed feugiat},user1={example-image}}%
{%
Cum sociis natoque penatibus et magnis dis parturient montes,
nascetur ridiculus mus. Ut pellentesque augue sed urna. Vestibulum
diam eros, fringilla et, consectetuer eu, nonummy id, sapien. Nullam
at lectus. In sagittis ultrices mauris. Curabitur malesuada erat sit
amet massa. Fusce blandit. Aliquam erat volutpat.  Aliquam euismod.
Aenean vel lectus.  Nunc imperdiet justo nec dolor.

Etiam euismod. Fusce facilisis lacinia dui.  Suspendisse potenti. In
mi erat, cursus id, nonummy sed, ullamcorper eget, sapien. Praesent
pretium, magna in eleifend egestas, pede pede pretium lorem, quis
consectetuer tortor sapien facilisis magna.  Mauris quis magna
varius nulla scelerisque imperdiet. Aliquam non quam. Aliquam
porttitor quam a lacus. Praesent vel arcu ut tortor cursus volutpat.
In vitae pede quis diam bibendum placerat. Fusce elementum convallis
neque. Sed dolor orci, scelerisque ac, dapibus nec, ultricies ut,
mi. Duis nec dui quis leo sagittis commodo.
}

\longnewglossaryentry{aliquamlectus}%
{name={aliquam lectus},user1={example-image-a}}%
{%
Vivamus leo. Quisque ornare tellus ullamcorper nulla. Mauris
porttitor pharetra tortor. Sed fringilla justo sed mauris. Mauris
tellus. Sed non leo. Nullam elementum, magna in cursus sodales,
augue est scelerisque sapien, venenatis congue nulla arcu et pede.
Ut suscipit enim vel sapien.  Donec congue. Maecenas urna mi,
suscipit in, placerat ut, vestibulum ut, massa. Fusce ultrices nulla
et nisl.

Etiam ac leo a risus tristique nonummy. Donec dignissim tincidunt
nulla. Vestibulum rhoncus molestie odio. Sed lobortis, justo et
pretium lobortis, mauris turpis condimentum augue, nec ultricies
nibh arcu pretium enim. Nunc purus neque, placerat id, imperdiet
sed, pellentesque nec, nisl. Vestibulum imperdiet neque non sem
accumsan laoreet. In hac habitasse platea dictumst. Etiam
condimentum facilisis libero. Suspendisse in elit quis nisl aliquam
dapibus. Pellentesque auctor sapien. Sed egestas sapien nec lectus.
Pellentesque vel dui vel neque bibendum viverra.  Aliquam porttitor
nisl nec pede. Proin mattis libero vel turpis.  Donec rutrum mauris
et libero. Proin euismod porta felis. Nam lobortis, metus quis
elementum commodo, nunc lectus elementum mauris, eget vulputate
ligula tellus eu neque. Vivamus eu dolor.
}

\longnewglossaryentry{nullainipsum}%
{name={nulla in ipsum},user1={example-image-b}}%
{%
 Praesent eros nulla, congue vitae, euismod ut, commodo a, wisi.
Pellentesque habitant morbi tristique senectus et netus et malesuada
fames ac turpis egestas.  Aenean nonummy magna non leo. Sed felis
erat, ullamcorper in, dictum non, ultricies ut, lectus. Proin vel
arcu a odio lobortis euismod.  Vestibulum ante ipsum primis in
faucibus orci luctus et ultrices posuere cubilia Curae; Proin ut
est. Aliquam odio. Pellentesque massa turpis, cursus eu, euismod
nec, tempor congue, nulla. Duis viverra gravida mauris. Cras
tincidunt. Curabitur eros ligula, varius ut, pulvinar in, cursus
faucibus, augue.

Nulla mattis luctus nulla. Duis commodo velit at leo.  Aliquam
vulputate magna et leo. Nam vestibulum ullamcorper leo.  Vestibulum
condimentum rutrum mauris. Donec id mauris. Morbi molestie justo et
pede. Vivamus eget turpis sed nisl cursus tempor.  Curabitur mollis
sapien condimentum nunc. In wisi nisl, malesuada at, dignissim sit
amet, lobortis in, odio. Aenean consequat arcu a ante. Pellentesque
porta elit sit amet orci. Etiam at turpis nec elit ultricies
imperdiet. Nulla facilisi. In hac habitasse platea dictumst.
Suspendisse viverra aliquam risus. Nullam pede justo, molestie
nonummy, scelerisque eu, facilisis vel, arcu.
}

\longnewglossaryentry{curabiturtellusmagna}%
{name={curabitur tellus magna},user1={example-image-c}}%
{%
Donec interdum. Praesent scelerisque.  Maecenas posuere sodales
odio. Vivamus metus lacus, varius quis, imperdiet quis, rhoncus a,
turpis. Etiam ligula arcu, elementum a, venenatis quis, sollicitudin
sed, metus. Donec nunc pede, tincidunt in, venenatis vitae, faucibus
vel, nibh. Pellentesque wisi. Nullam malesuada. Morbi ut tellus ut
pede tincidunt porta. Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Etiam congue neque id dolor.

Donec et nisl at wisi luctus bibendum. Nam interdum tellus ac
libero. Sed sem justo, laoreet vitae, fringilla at, adipiscing ut,
nibh. Maecenas non sem quis tortor eleifend fermentum. Etiam id
tortor ac mauris porta vulputate. Integer porta neque vitae massa.
Maecenas tempus libero a libero posuere dictum.  Vestibulum ante
ipsum primis in faucibus orci luctus et ultrices posuere cubilia
Curae; Aenean quis mauris sed elit commodo placerat.  Class aptent
taciti sociosqu ad litora torquent per conubia nostra, per inceptos
hymenaeos. Vivamus rhoncus tincidunt libero. Etiam elementum pretium
justo. Vivamus est. Morbi a tellus eget pede tristique commodo.
Nulla nisl. Vestibulum sed nisl eu sapien cursus rutrum.
}

\longnewglossaryentry{nullanonmauris}%
{name={nulla non mauris},user1={example-image-16x10}}%
{%
Nullam varius. Etiam dignissim elementum metus. Vestibulum faucibus,
metus sit amet mattis rhoncus, sapien dui laoreet odio, nec
ultricies nibh augue a enim. Fusce in ligula. Quisque at magna et
nulla commodo consequat.  Proin accumsan imperdiet sem. Nunc porta.
Donec feugiat mi at justo.  Phasellus facilisis ipsum quis ante. In
ac elit eget ipsum pharetra faucibus.  Maecenas viverra nulla in
massa.

Nulla ac nisl. Nullam urna nulla, ullamcorper in, interdum sit amet,
gravida ut, risus. Aenean ac enim. In luctus.  Phasellus eu quam
vitae turpis viverra pellentesque. Duis feugiat felis ut enim.
Phasellus pharetra, sem id porttitor sodales, magna nunc aliquet
nibh, nec blandit nisl mauris at pede. Suspendisse risus risus,
lobortis eget, semper at, imperdiet sit amet, quam.  Quisque
scelerisque dapibus nibh. Nam enim. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Nunc ut metus. Ut metus justo, auctor
at, ultrices eu, sagittis ut, purus. Aliquam aliquam.
}

\longnewglossaryentry{etiampedemassa}%
{name={etiam pede massa},user1={example-image-10x16}}%
{%
Vestibulum luctus commodo lacus. Morbi lacus dui, tempor sed,
euismod eget, condimentum at, tortor. Phasellus aliquet odio ac
lacus tempor faucibus. Praesent sed sem. Praesent iaculis.  Cras
rhoncus tellus sed justo ullamcorper sagittis.  Donec quis orci.
Sed ut tortor quis tellus euismod tincidunt. Suspendisse congue nisl
eu elit. Aliquam tortor diam, tempus id, tristique eget, sodales
vel, nulla. Praesent tellus mi, condimentum sed, viverra at,
consectetuer quis, lectus. In auctor vehicula orci. Sed pede sapien,
euismod in, suscipit in, pharetra placerat, metus. Vivamus commodo
dui non odio. Donec et felis.

Etiam suscipit aliquam arcu. Aliquam sit amet est ac purus bibendum
congue. Sed in eros. Morbi non orci.  Pellentesque mattis lacinia
elit. Fusce molestie velit in ligula.  Nullam et orci vitae nibh
vulputate auctor. Aliquam eget purus.  Nulla auctor wisi sed ipsum.
Morbi porttitor tellus ac enim. Fusce ornare. Proin ipsum enim,
tincidunt in, ornare venenatis, molestie a, augue. Donec vel pede in
lacus sagittis porta. Sed hendrerit ipsum quis nisl.  Suspendisse
quis massa ac nibh pretium cursus.  Sed sodales. Nam eu neque quis
pede dignissim ornare. Maecenas eu purus ac urna tincidunt congue.
}

\longnewglossaryentry{donecetnisl}%
{name={donec et nisl},user1={example-image-16x9}}%
{%
Aenean dictum odio sit amet risus. Morbi purus. Nulla a est sit amet
purus venenatis iaculis. Vivamus viverra purus vel magna. Donec in
justo sed odio malesuada dapibus. Nunc ultrices aliquam nunc.
Vivamus facilisis pellentesque velit. Nulla nunc velit, vulputate
dapibus, vulputate id, mattis ac, justo. Nam mattis elit dapibus
purus.  Quisque enim risus, congue non, elementum ut, mattis quis,
sem.  Quisque elit.

Maecenas non massa. Vestibulum pharetra nulla at lorem. Duis quis
quam id lacus dapibus interdum. Nulla lorem.  Donec ut ante quis
dolor bibendum condimentum. Etiam egestas tortor vitae lacus.
Praesent cursus. Mauris bibendum pede at elit. Morbi et felis a
lectus interdum facilisis. Sed suscipit gravida turpis.  Nulla at
lectus. Vestibulum ante ipsum primis in faucibus orci luctus et
ultrices posuere cubilia Curae; Praesent nonummy luctus nibh. Proin
turpis nunc, congue eu, egestas ut, fringilla at, tellus. In hac
habitasse platea dictumst.
}

\longnewglossaryentry{vivamuseutellus}%
{name={vivamus eu tellus},user1={example-image-9x16}}%
{%
 Nam orci orci, malesuada id, gravida nec, ultricies vitae, erat.
Donec risus turpis, luctus sit amet, interdum quis, porta sed,
ipsum.  Suspendisse condimentum, tortor at egestas posuere, neque
metus tempor orci, et tincidunt urna nunc a purus. Sed facilisis
blandit tellus. Nunc risus sem, suscipit nec, eleifend quis, cursus
quis, libero. Curabitur et dolor. Sed vitae sem. Cum sociis natoque
penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Maecenas ante. Duis ullamcorper enim. Donec tristique enim eu leo.
Nullam molestie elit eu dolor. Nullam bibendum, turpis vitae
tristique gravida, quam sapien tempor lectus, quis pretium tellus
purus ac quam. Nulla facilisi.

Duis aliquet dui in est. Donec eget est. Nunc lectus odio, varius
at, fermentum in, accumsan non, enim. Aliquam erat volutpat. Proin
sit amet nulla ut eros consectetuer cursus.  Phasellus dapibus
aliquam justo. Nunc laoreet. Donec consequat placerat magna. Duis
pretium tincidunt justo. Sed sollicitudin vestibulum quam. Nam quis
ligula. Vivamus at metus. Etiam imperdiet imperdiet pede. Aenean
turpis. Fusce augue velit, scelerisque sollicitudin, dictum vitae,
tempor et, pede. Donec wisi sapien, feugiat in, fermentum ut,
sollicitudin adipiscing, metus.
}

\longnewglossaryentry{donecvelnibh}%
{name={donec vel nibh},user1={example-image-golden}}%
{%
  Donec pede. Sed id quam id wisi laoreet suscipit. Nulla lectus
dolor, aliquam ac, fringilla eget, mollis ut, orci. In pellentesque
justo in ligula. Maecenas turpis. Donec eleifend leo at felis
tincidunt consequat. Aenean turpis metus, malesuada sed, condimentum
sit amet, auctor a, wisi. Pellentesque sapien elit, bibendum ac,
posuere et, congue eu, felis. Vestibulum mattis libero quis metus
scelerisque ultrices. Sed purus.

Donec molestie, magna ut luctus ultrices, tellus arcu nonummy velit,
sit amet pulvinar elit justo et mauris.  In pede.  Maecenas euismod
elit eu erat. Aliquam augue wisi, facilisis congue, suscipit in,
adipiscing et, ante. In justo. Cras lobortis neque ac ipsum. Nunc
fermentum massa at ante. Donec orci tortor, egestas sit amet,
ultrices eget, venenatis eget, mi.  Maecenas vehicula leo semper
est. Mauris vel metus. Aliquam erat volutpat. In rhoncus sapien ac
tellus. Pellentesque ligula.
}

\longnewglossaryentry{crasdapibus}%
{name={cras dapibus},user1={example-image-golden-upright}}%
{%
Aenean interdum nibh sed wisi. Praesent sollicitudin vulputate dui.
Praesent iaculis viverra augue. Quisque in libero. Aenean gravida
lorem vitae sem ullamcorper cursus. Nunc adipiscing rutrum ante.
Nunc ipsum massa, faucibus sit amet, viverra vel, elementum semper,
orci. Cras eros sem, vulputate et, tincidunt id, ultrices eget,
magna. Nulla varius ornare odio. Donec accumsan mauris sit amet
augue. Sed ligula lacus, laoreet non, aliquam sit amet, iaculis
tempor, lorem. Suspendisse eros. Nam porta, leo sed congue tempor,
felis est ultrices eros, id mattis velit felis non metus.  Curabitur
vitae elit non mauris varius pretium. Aenean lacus sem, tincidunt
ut, consequat quis, porta vitae, turpis. Nullam laoreet fermentum
urna. Proin iaculis lectus.

Sed mattis, erat sit amet gravida malesuada, elit augue egestas
diam, tempus scelerisque nunc nisl vitae libero.  Sed consequat
feugiat massa. Nunc porta, eros in eleifend varius, erat leo rutrum
dui, non convallis lectus orci ut nibh. Sed lorem massa, nonummy
quis, egestas id, condimentum at, nisl. Maecenas at nibh.  Aliquam
et augue at nunc pellentesque ullamcorper. Duis nisl nibh, laoreet
suscipit, convallis ut, rutrum id, enim. Phasellus odio.  Nulla
nulla elit, molestie non, scelerisque at, vestibulum eu, nulla. Ut
odio nisl, facilisis id, mollis et, scelerisque nec, enim.  Aenean
sem leo, pellentesque sit amet, scelerisque sit amet, vehicula
pellentesque, sapien.
}

\longnewglossaryentry{sedconsequat}%
{name={sed consequat},user1={example-image-1x1}}%
{%
Ut tempor laoreet quam. Nullam id wisi a libero tristique semper.
Nullam nisl massa, rutrum ut, egestas semper, mollis id, leo. Nulla
ac massa eu risus blandit mattis. Mauris ut nunc. In hac habitasse
platea dictumst.  Aliquam eget tortor. Quisque dapibus pede in erat.
Nunc enim. In dui nulla, commodo at, consectetuer nec, malesuada
nec, elit. Aliquam ornare tellus eu urna. Sed nec metus. Cum sociis
natoque penatibus et magnis dis parturient montes, nascetur
ridiculus mus.  Pellentesque habitant morbi tristique senectus et
netus et malesuada fames ac turpis egestas.

Phasellus id magna. Duis malesuada interdum arcu.  Integer metus.
Morbi pulvinar pellentesque mi. Suspendisse sed est eu magna
molestie egestas. Quisque mi lorem, pulvinar eget, egestas quis,
luctus at, ante. Proin auctor vehicula purus. Fusce ac nisl aliquam
ante hendrerit pellentesque. Class aptent taciti sociosqu ad litora
torquent per conubia nostra, per inceptos hymenaeos. Morbi wisi.
Etiam arcu mauris, facilisis sed, eleifend non, nonummy ut, pede.
Cras ut lacus tempor metus mollis placerat.  Vivamus eu tortor vel
metus interdum malesuada.
}

 % This one doesn't have an image. The style can test whether an
 % image has been supplied using \ifglshasfield

\longnewglossaryentry{sedeleifend}%
{name={sed eleifend}}%
{%
Morbi non felis ac libero vulputate fringilla. Mauris libero eros,
lacinia non, sodales quis, dapibus porttitor, pede.  Class aptent
taciti sociosqu ad litora torquent per conubia nostra, per inceptos
hymenaeos. Morbi dapibus mauris condimentum nulla.  Cum sociis
natoque penatibus et magnis dis parturient montes, nascetur
ridiculus mus. Etiam sit amet erat. Nulla varius. Etiam tincidunt
dui vitae turpis. Donec leo. Morbi vulputate convallis est.  Integer
aliquet. Pellentesque aliquet sodales urna.
}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-images.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-long.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% This file is part of the glossaries bundle
% These are test glossary entries with long descriptions.
%COMMENT

\newglossaryentry{loremipsum}{name={lorem ipsum},
description={dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur
dictum gravida mauris.}}

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

\newglossaryentry{crasviverra}{name={cras viverra},
description={metus rhoncus sem. Nulla et lectus vestibulum
urna fringilla ultrices.  Phasellus eu tellus sit amet tortor gravida
placerat.}}

\newglossaryentry{integersapien}{name={integer sapien},
description={est, iaculis in, pretium quis, viverra ac,
nunc. Praesent eget sem vel leo ultrices bibendum. Aenean
faucibus.}}

\newglossaryentry{morbidolor}{name={morbi dolor},
description={nulla, malesuada eu, pulvinar at, mollis ac, nulla.
Curabitur auctor semper nulla. Donec varius orci eget risus. Duis
nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis
eget orci sit amet orci dignissim rutrum.}}

\newglossaryentry{namdui}{name={nam dui},
description={ligula, fringilla a, euismod sodales,
sollicitudin vel, wisi. Morbi auctor lorem non justo.}}

\newglossaryentry{namlacus}{name={nam lacus},
description={libero, pretium at, lobortis vitae, ultricies et,
tellus. Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna,
vitae ornare odio metus a mi.}}

\newglossaryentry{morbiac}{name={morbi ac},
description={orci et nisl hendrerit mollis. Suspendisse ut massa.
Cras nec ante. Pellentesque a nulla.  Cum sociis natoque penatibus
et magnis dis parturient montes, nascetur ridiculus mus.}}

\newglossaryentry{aliquam}{name={aliquam},
description={tincidunt urna. Nulla ullamcorper
vestibulum turpis. Pellentesque cursus luctus mauris.}}

\newglossaryentry{nullamalesuada}{name={nulla malesuada},
description={porttitor diam. Donec felis erat, congue non, volutpat at, 
tincidunt tristique, libero.  Vivamus viverra fermentum felis.}}

\newglossaryentry{donecnonummy}{name={donec nonummy},
description={pellentesque ante. Phasellus
adipiscing semper elit. Proin fermentum massa ac quam. Sed diam
turpis, molestie vitae, placerat a, molestie nec, leo.}}

\newglossaryentry{maecenaslacinia}{name={maecenas lacinia},
description={nam ipsum ligula, eleifend at, accumsan nec, suscipit
a, ipsum. Morbi blandit ligula feugiat magna. Nunc eleifend consequat
lorem.}}

\newglossaryentry{sedlacinia}{name={sed lacinia},
description={nulla vitae enim. Pellentesque tincidunt purus
vel magna. Integer non enim. Praesent euismod nunc eu purus. Donec
bibendum quam in tellus.}}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-long.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-longchild.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% This file is part of the glossaries bundle
% These are test glossary entries with child entries and long
% descriptions.
%COMMENT

\newglossaryentry{longsedmattis}{name={sed mattis},
 description={erat sit amet dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur
dictum gravida mauris.}}

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

\newglossaryentry{longelitaugue}{parent={longsedmattis},name={elit augue},
description={egestas diam metus rhoncus sem. Nulla et lectus vestibulum
urna fringilla ultrices.  Phasellus eu tellus sit amet tortor gravida
placerat.}}

\newglossaryentry{longtempus}{parent={longsedmattis},name={tempus},
description={scelerisque est, iaculis in, pretium quis, viverra ac,
nunc. Praesent eget sem vel leo ultrices bibendum. Aenean
faucibus.}}

\newglossaryentry{longnunc}{name={nunc},
 description={nisl vitae nulla, malesuada eu, pulvinar at, mollis ac, nulla.
Curabitur auctor semper nulla. Donec varius orci eget risus. Duis
nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis
eget orci sit amet orci dignissim rutrum.}}

\newglossaryentry{longlibero}{parent={longnunc},name={libero},
 description={sed consequat ligula, fringilla a, euismod sodales,
sollicitudin vel, wisi. Morbi auctor lorem non justo.}}

\newglossaryentry{longfeugiat}{parent={longnunc},name={feugiat},
 description={massa libero, pretium at, lobortis vitae, ultricies et,
tellus. Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna,
vitae ornare odio metus a mi.}}

\newglossaryentry{longporta}{parent={longnunc},name={porta},
 description={eros in eleifend orci et nisl hendrerit mollis. Suspendisse ut massa.
Cras nec ante. Pellentesque a nulla.  Cum sociis natoque penatibus
et magnis dis parturient montes, nascetur ridiculus mus.}}

\newglossaryentry{longvariuserat}{parent={longnunc},name={varius erat},
description={leo rutrum dui tincidunt urna. Nulla ullamcorper
vestibulum turpis. Pellentesque cursus luctus mauris.}}

\newglossaryentry{longnonconvallis}{name={non convallis},
 description={lectus orci ut nibh porttitor diam. Donec felis erat,
congue non, volutpat at, tincidunt tristique, libero.  Vivamus
viverra fermentum felis.}}

\newglossaryentry{longsedlorem}{parent={longnonconvallis},name={sedlorem},
 description={massa pellentesque ante. Phasellus
adipiscing semper elit. Proin fermentum massa ac quam. Sed diam
turpis, molestie vitae, placerat a, molestie nec, leo.}}

\newglossaryentry{longnonummyquis}{parent={longnonconvallis},name={nonummy
quis}, description={egestas id nam ipsum ligula, eleifend at, accumsan nec, suscipit
a, ipsum. Morbi blandit ligula feugiat magna. Nunc eleifend consequat
lorem.}}

\newglossaryentry{longcondimentum}{name={condimentum},
 description={at nisl nulla vitae enim. Pellentesque tincidunt purus
vel magna. Integer non enim. Praesent euismod nunc eu purus. Donec
bibendum quam in tellus.}}

\newglossaryentry{longmaecenas}{parent={longcondimentum},name={maecenas},
description={at nibh fringilla a, euismod sodales, sollicitudin vel,
wisi. Morbi auctor lorem non justo. Nam lacus libero, pretium at,
lobortis vitae, ultricies et, tellus. Donec aliquet, tortor sed
accumsan bibendum, erat ligula aliquet magna, vitae ornare odio
metus a mi. Morbi ac orci et nisl hendrerit mollis. Suspendisse ut
massa. Cras nec ante. Pellentesque a nulla.  Cum sociis natoque
penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Aliquam tincidunt urna. Nulla ullamcorper vestibulum turpis.
Pellentesque cursus luctus mauris.}}

\newglossaryentry{longaliquamet}{name={aliquam et},
 description={augue felis erat, congue non,
volutpat at, tincidunt tristique, libero.  Vivamus viverra fermentum
felis. Donec nonummy pellentesque ante.}}

\newglossaryentry{longatnunc}{parent={longaliquamet},name={at nunc},
 description={pellentesque ullamcorper el justo
vitae lacus tincidunt ultrices. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit.}}

\newglossaryentry{longduisnisl}{parent={longatnunc},name={duisnisl},
 description={laoreet suscipit ac venenatis arcu
wisi vel nisl. Vestibulum diam. Aliquam pellentesque, augue quis
sagittis posuere, turpis lacus congue quam, in hendrerit risus eros
eget felis. Maecenas eget erat in sapien mattis porttitor.}}

\newglossaryentry{longduisnibh}{parent={longatnunc},name={duisnibh},
description={convallis ut justo lectus
sagittis dui, et vehicula libero dui cursus dui. Mauris tempor
ligula sed lacus. Duis cursus enim ut augue.  Cras ac magna.}}

\newglossaryentry{longrutrum}{name={rutrum},
 description={id, enim elit, rutrum at, molestie non, nonummy vel, nisl. Ut lectus
eros, malesuada sit amet, fermentum eu, sodales cursus, magna. Donec
eu purus. Quisque vehicula, urna sed ultricies auctor, pede lorem
egestas dui, et convallis elit erat sed nulla.}}

\newglossaryentry{longphasellus}{parent={longrutrum},name={phasellus},
 description={odio volutpat a, ornare ac, erat.
Morbi quis dolor. Donec pellentesque, erat ac sagittis semper, nunc
dui lobortis purus, quis congue purus metus ultricies tellus. Proin
et quam.}}

\newglossaryentry{longnullanulla}{parent={longrutrum},name={nulla nulla},
description={elit, molestie non wisi viverra faucibus pretium, nibh est placerat odio,
nec commodo wisi enim eget quam. Quisque libero justo, consectetuer
a, feugiat vitae, porttitor eu, libero.}}

%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-longchild.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-multipar.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% This file is part of the glossaries bundle
% These are test glossary entries with multi-paragraph descriptions.
%COMMENT

\longnewglossaryentry{loremi-ii}{name={lorem 1--2}}%
{%
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur
dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer
id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque
habitant morbi tristique senectus et netus et malesuada fames ac
turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla
et lectus vestibulum urna fringilla ultrices.  Phasellus eu tellus
sit amet tortor gravida placerat. Integer sapien est, iaculis in,
pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices
bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar
at, mollis ac, nulla.  Curabitur auctor semper nulla. Donec varius
orci eget risus. Duis nibh mi, congue eu, accumsan eleifend,
sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum.

Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel,
wisi. Morbi auctor lorem non justo. Nam lacus libero, pretium at,
lobortis vitae, ultricies et, tellus. Donec aliquet, tortor sed
accumsan bibendum, erat ligula aliquet magna, vitae ornare odio
metus a mi. Morbi ac orci et nisl hendrerit mollis. Suspendisse ut
massa. Cras nec ante. Pellentesque a nulla.  Cum sociis natoque
penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Aliquam tincidunt urna. Nulla ullamcorper vestibulum turpis.
Pellentesque cursus luctus mauris.%
}

\longnewglossaryentry{loremiii-iv}{name={lorem 3--4}}%
{%
Nulla malesuada porttitor diam. Donec felis erat, congue non,
volutpat at, tincidunt tristique, libero.  Vivamus viverra fermentum
felis. Donec nonummy pellentesque ante.  Phasellus adipiscing semper
elit. Proin fermentum massa ac quam. Sed diam turpis, molestie
vitae, placerat a, molestie nec, leo. Maecenas lacinia. Nam ipsum
ligula, eleifend at, accumsan nec, suscipit a, ipsum. Morbi blandit
ligula feugiat magna. Nunc eleifend consequat lorem. Sed lacinia
nulla vitae enim. Pellentesque tincidunt purus vel magna. Integer
non enim. Praesent euismod nunc eu purus. Donec bibendum quam in
tellus. Nullam cursus pulvinar lectus. Donec et mi.  Nam vulputate
metus eu enim. Vestibulum pellentesque felis eu massa. 

Quisque ullamcorper placerat ipsum. Cras nibh.  Morbi vel justo
vitae lacus tincidunt ultrices. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. In hac habitasse platea dictumst.
Integer tempus convallis augue. Etiam facilisis. Nunc elementum
fermentum wisi. Aenean placerat. Ut imperdiet, enim sed gravida
sollicitudin, felis odio placerat quam, ac pulvinar elit purus eget
enim. Nunc vitae tortor. Proin tempus nibh sit amet nisl.  Vivamus
quis tortor vitae risus porta vehicula.%
}

\longnewglossaryentry{loremv-vi}{name={lorem 5--6}}%
{%
Fusce mauris. Vestibulum luctus nibh at lectus.  Sed bibendum, nulla
a faucibus semper, leo velit ultricies tellus, ac venenatis arcu
wisi vel nisl. Vestibulum diam. Aliquam pellentesque, augue quis
sagittis posuere, turpis lacus congue quam, in hendrerit risus eros
eget felis. Maecenas eget erat in sapien mattis porttitor.
Vestibulum porttitor. Nulla facilisi. Sed a turpis eu lacus commodo
facilisis. Morbi fringilla, wisi in dignissim interdum, justo lectus
sagittis dui, et vehicula libero dui cursus dui. Mauris tempor
ligula sed lacus. Duis cursus enim ut augue.  Cras ac magna. Cras
nulla. Nulla egestas. Curabitur a leo. Quisque egestas wisi eget
nunc. Nam feugiat lacus vel est. Curabitur consectetuer.%

Suspendisse vel felis. Ut lorem lorem, interdum eu, tincidunt sit
amet, laoreet vitae, arcu. Aenean faucibus pede eu ante. Praesent
enim elit, rutrum at, molestie non, nonummy vel, nisl. Ut lectus
eros, malesuada sit amet, fermentum eu, sodales cursus, magna. Donec
eu purus. Quisque vehicula, urna sed ultricies auctor, pede lorem
egestas dui, et convallis elit erat sed nulla.  Donec luctus.
Curabitur et nunc. Aliquam dolor odio, commodo pretium, ultricies
non, pharetra in, velit. Integer arcu est, nonummy in, fermentum
faucibus, egestas vel, odio.%
}

\longnewglossaryentry{loremvii-viii}{name={lorem 7--8}}%
{%
Sed commodo posuere pede. Mauris ut est. Ut quis purus. Sed ac odio.
Sed vehicula hendrerit sem. Duis non odio.  Morbi ut dui. Sed
accumsan risus eget odio. In hac habitasse platea dictumst.
Pellentesque non elit. Fusce sed justo eu urna porta tincidunt.
Mauris felis odio, sollicitudin sed, volutpat a, ornare ac, erat.
Morbi quis dolor. Donec pellentesque, erat ac sagittis semper, nunc
dui lobortis purus, quis congue purus metus ultricies tellus. Proin
et quam. Class aptent taciti sociosqu ad litora torquent per conubia
nostra, per inceptos hymenaeos. Praesent sapien turpis, fermentum
vel, eleifend faucibus, vehicula eu, lacus.

Pellentesque habitant morbi tristique senectus et netus et malesuada
fames ac turpis egestas. Donec odio elit, dictum in, hendrerit sit
amet, egestas sed, leo. Praesent feugiat sapien aliquet odio.
Integer vitae justo. Aliquam vestibulum fringilla lorem. Sed neque
lectus, consectetuer at, consectetuer sed, eleifend ac, lectus.
Nulla facilisi. Pellentesque eget lectus.  Proin eu metus. Sed
porttitor. In hac habitasse platea dictumst.  Suspendisse eu lectus.
Ut mi mi, lacinia sit amet, placerat et, mollis vitae, dui. Sed ante
tellus, tristique ut, iaculis eu, malesuada ac, dui.  Mauris nibh
leo, facilisis non, adipiscing quis, ultrices a, dui.%
}

\longnewglossaryentry{loremix-x}{name={lorem 9--10}}%
{%
Morbi luctus, wisi viverra faucibus pretium, nibh est placerat odio,
nec commodo wisi enim eget quam. Quisque libero justo, consectetuer
a, feugiat vitae, porttitor eu, libero.  Suspendisse sed mauris
vitae elit sollicitudin malesuada. Maecenas ultricies eros sit amet
ante. Ut venenatis velit. Maecenas sed mi eget dui varius euismod.
Phasellus aliquet volutpat odio.  Vestibulum ante ipsum primis in
faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque
sit amet pede ac sem eleifend consectetuer. Nullam elementum, urna
vel imperdiet sodales, elit ipsum pharetra ligula, ac pretium ante
justo a nulla. Curabitur tristique arcu eu metus. Vestibulum lectus.
Proin mauris. Proin eu nunc eu urna hendrerit faucibus. Aliquam
auctor, pede consequat laoreet varius, eros tellus scelerisque quam,
pellentesque hendrerit ipsum dolor sed augue. Nulla nec lacus.

Suspendisse vitae elit. Aliquam arcu neque, ornare in, ullamcorper
quis, commodo eu, libero. Fusce sagittis erat at erat tristique
mollis. Maecenas sapien libero, molestie et, lobortis in, sodales
eget, dui. Morbi ultrices rutrum lorem. Nam elementum ullamcorper
leo. Morbi dui. Aliquam sagittis. Nunc placerat.  Pellentesque
tristique sodales est. Maecenas imperdiet lacinia velit. Cras non
urna. Morbi eros pede, suscipit ac, varius vel, egestas non, eros.
Praesent malesuada, diam id pretium elementum, eros sem dictum
tortor, vel consectetuer odio sem sed wisi.%
}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-multipar.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-parent.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% This file is part of the glossaries bundle
% These are test glossary entries with child entries.
%COMMENT

\newglossaryentry{sedmattis}{name={sed mattis},description={erat sit amet}}

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

\newglossaryentry{elitaugue}{parent={sedmattis},name={elit augue},
description={egestas diam}}

\newglossaryentry{tempus}{parent={sedmattis},name={tempus},
description={scelerisque}}

\newglossaryentry{nunc}{name={nunc},description={nisl vitae}}

\newglossaryentry{libero}{parent={nunc},name={libero},description={sed
consequat}}

\newglossaryentry{feugiat}{parent={nunc},name={feugiat},description={massa}}

\newglossaryentry{porta}{parent={nunc},name={porta},description={eros
in eleifend}}

\newglossaryentry{variuserat}{parent={nunc},name={varius erat},
description={leo rutrum dui}}

\newglossaryentry{nonconvallis}{name={non
convallis},description={lectus orci ut nibh}}

\newglossaryentry{sedlorem}{parent={nonconvallis},name={sedlorem},description={massa}}

\newglossaryentry{nonummyquis}{parent={nonconvallis},name={nonummy
quis}, description={egestas id}}

\newglossaryentry{condimentum}{name={condimentum},description={at
nisl}}

\newglossaryentry{maecenas}{parent={condimentum},name={maecenas},
description={at nibh}}

\newglossaryentry{aliquamet}{name={aliquam et},description={augue}}

\newglossaryentry{atnunc}{parent={aliquamet},name={at nunc},description={pellentesque
ullamcorper}}

\newglossaryentry{duisnisl}{parent={atnunc},name={duisnisl},description={laoreet
suscipit}}

\newglossaryentry{duisnibh}{parent={atnunc},name={duisnibh},
description={convallis ut}}

\newglossaryentry{rutrum}{name={rutrum},description={id, enim}}

\newglossaryentry{phasellus}{parent={rutrum},name={phasellus},
description={odio}}

\newglossaryentry{nullanulla}{parent={rutrum},name={nulla nulla},
description={elit, molestie non}}

%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-parent.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-symbolnames.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% This file is part of the glossaries bundle
% These are test glossary entries with associated symbols.
%COMMENT

\newglossaryentry{sym.alpha}{sort={alpha},name={\ensuremath{\alpha}},
description={Quisque ullamcorper placerat ipsum.}}

\newglossaryentry{sym.beta}{sort={beta},name={\ensuremath{\beta}},
description={Cras nibh.}}

\newglossaryentry{sym.gamma}{sort={gamma},name={\ensuremath{\gamma}},
description={Morbi vel justo vitae lacus tincidunt ultrices.}}

\newglossaryentry{sym.delta}{sort={delta},name={\ensuremath{\delta}},
description={Lorem ipsum dolor sit amet, consectetuer adipiscing
elit.}}

\newglossaryentry{sym.epsilon}{sort={epsilon},name={\ensuremath{\epsilon}},
description={In hac habitasse platea dictumst.}}

\newglossaryentry{sym.zeta}{sort={zeta},name={\ensuremath{\zeta}},
description={Integer tempus convallis augue.}}

\newglossaryentry{sym.eta}{sort={eta},name={\ensuremath{\eta}},
description={Etiam facilisis.}}

\newglossaryentry{sym.theta}{sort={theta},name={\ensuremath{\theta}},
description={Nunc elementum fermentum wisi.}}

\newglossaryentry{sym.iota}{sort={iota},name={\ensuremath{i}},
description={Aenean placerat.}}

\newglossaryentry{sym.kappa}{sort={kappa},name={\ensuremath{\kappa}},
description={Ut imperdiet, enim sed gravida sollicitudin, felis odio
placerat quam, ac pulvinar elit purus eget enim.}}

\newglossaryentry{sym.lambda}{sort={lambda},name={\ensuremath{\lambda}},
description={Nunc vitae tortor.}}

\newglossaryentry{sym.mu}{sort={mu},name={\ensuremath{\mu}},
description={Proin tempus nibh sit amet nisl.}}

\newglossaryentry{sym.nu}{sort={nu},name={\ensuremath{\nu}},
description={Vivamus quis tortor vitae risus porta vehicula.}}

\newglossaryentry{sym.xi}{sort={xi},name={\ensuremath{\xi}},
description={Fusce mauris.}}

\newglossaryentry{sym.pi}{sort={pi},name={\ensuremath{\pi}},
description={Vestibulum luctus nibh at lectus.}}

\newglossaryentry{sym.rho}{sort={rho},name={\ensuremath{\rho}},
description={Sed bibendum, nulla a faucibus semper, leo velit
ultricies tellus, ac venenatis arcu wisi vel nisl. Vestibulum diam.}}

\newglossaryentry{sym.sigma}{sort={sigma},name={\ensuremath{\sigma}},
description={Aliquam pellentesque, augue quis sagittis posuere,
turpis lacus congue quam, in hendrerit risus eros eget felis.}}

\newglossaryentry{sym.tau}{sort={tau},name={\ensuremath{\tau}},
description={Maecenas eget erat in sapien mattis porttitor.}}

\newglossaryentry{sym.upsilon}{sort={upsilon},name={\ensuremath{\upsilon}},
description={Vestibulum porttitor.}}

\newglossaryentry{sym.phi}{sort={phi},name={\ensuremath{\phi}},
description={Nulla facilisi.}}

\newglossaryentry{sym.chi}{sort={chi},name={\ensuremath{\chi}},
description={Sed a turpis eu lacus commodo facilisis.}}

\newglossaryentry{sym.psi}{sort={psi},name={\ensuremath{\psi}},
description={Morbi fringilla, wisi in dignissim interdum, justo
lectus sagittis dui, et vehicula libero dui cursus dui.}}

\newglossaryentry{sym.omega}{sort={omega},name={\ensuremath{\omega}},
description={Mauris tempor ligula sed lacus.}}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-symbolnames.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-symbols.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% This file is part of the glossaries bundle
% These are test glossary entries with associated symbols.
%COMMENT

\newglossaryentry{alpha}{name={alpha},symbol={\ensuremath{\alpha}},
description={Quisque ullamcorper placerat ipsum.}}

\newglossaryentry{beta}{name={beta},symbol={\ensuremath{\beta}},
description={Cras nibh.}}

\newglossaryentry{gamma}{name={gamma},symbol={\ensuremath{\gamma}},
description={Morbi vel justo vitae lacus tincidunt ultrices.}}

\newglossaryentry{delta}{name={delta},symbol={\ensuremath{\delta}},
description={Lorem ipsum dolor sit amet, consectetuer adipiscing
elit.}}

\newglossaryentry{epsilon}{name={epsilon},symbol={\ensuremath{\epsilon}},
description={In hac habitasse platea dictumst.}}

\newglossaryentry{zeta}{name={zeta},symbol={\ensuremath{\zeta}},
description={Integer tempus convallis augue.}}

\newglossaryentry{eta}{name={eta},symbol={\ensuremath{\eta}},
description={Etiam facilisis.}}

\newglossaryentry{theta}{name={theta},symbol={\ensuremath{\theta}},
description={Nunc elementum fermentum wisi.}}

\newglossaryentry{iota}{name={iota},symbol={\ensuremath{i}},
description={Aenean placerat.}}

\newglossaryentry{kappa}{name={kappa},symbol={\ensuremath{\kappa}},
description={Ut imperdiet, enim sed gravida sollicitudin, felis odio
placerat quam, ac pulvinar elit purus eget enim.}}

\newglossaryentry{lambda}{name={lambda},symbol={\ensuremath{\lambda}},
description={Nunc vitae tortor.}}

\newglossaryentry{mu}{name={mu},symbol={\ensuremath{\mu}},
description={Proin tempus nibh sit amet nisl.}}

\newglossaryentry{nu}{name={nu},symbol={\ensuremath{\nu}},
description={Vivamus quis tortor vitae risus porta vehicula.}}

\newglossaryentry{xi}{name={xi},symbol={\ensuremath{\xi}},
description={Fusce mauris.}}

\newglossaryentry{pi}{name={pi},symbol={\ensuremath{\pi}},
description={Vestibulum luctus nibh at lectus.}}

\newglossaryentry{rho}{name={rho},symbol={\ensuremath{\rho}},
description={Sed bibendum, nulla a faucibus semper, leo velit
ultricies tellus, ac venenatis arcu wisi vel nisl. Vestibulum diam.}}

\newglossaryentry{sigma}{name={sigma},symbol={\ensuremath{\sigma}},
description={Aliquam pellentesque, augue quis sagittis posuere,
turpis lacus congue quam, in hendrerit risus eros eget felis.}}

\newglossaryentry{tau}{name={tau},symbol={\ensuremath{\tau}},
description={Maecenas eget erat in sapien mattis porttitor.}}

\newglossaryentry{upsilon}{name={upsilon},symbol={\ensuremath{\upsilon}},
description={Vestibulum porttitor.}}

\newglossaryentry{phi}{name={phi},symbol={\ensuremath{\phi}},
description={Nulla facilisi.}}

\newglossaryentry{chi}{name={chi},symbol={\ensuremath{\chi}},
description={Sed a turpis eu lacus commodo facilisis.}}

\newglossaryentry{psi}{name={psi},symbol={\ensuremath{\psi}},
description={Morbi fringilla, wisi in dignissim interdum, justo
lectus sagittis dui, et vehicula libero dui cursus dui.}}

\newglossaryentry{omega}{name={omega},symbol={\ensuremath{\omega}},
description={Mauris tempor ligula sed lacus.}}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-symbols.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-url.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% This file is part of the glossaries bundle
% These are test glossary entries with URLs stored in
% the user1 field.
%COMMENT

\newglossaryentry{aenean-url}{name={aenean},
 description={adipiscing auctor est},
 user1={http://uk.tug.org/}}

\newglossaryentry{morbi-url}{name={morbi},
 description={quam arcu, malesuada sed, volutpat et, elementum sit
amet, libero},
 user1={http://www.ctan.org/}}

\newglossaryentry{duis-url}{name={duis},
 description={mattis},
 user1={http://www.tug.org/}}

 % Now try an active character
\newglossaryentry{sed-url}{name={sed},
 description={cursus lectus quis odio (uses
\texttt{\string\protect\string~})},
 user1={http://theoval.cmp.uea.ac.uk/\protect~nlct/}}

\newglossaryentry{sed2-url}{name={sed},
 description={cursus lectus quis odio (uses
\texttt{\string\string\string~})},
 user1={http://theoval.cmp.uea.ac.uk/\string~nlct/}}

\newglossaryentry{sed3-url}{name={sed},
 description={cursus lectus quis odio (uses
\texttt{\string\glstildechar})},
 user1={http://theoval.cmp.uea.ac.uk/\glstildechar nlct/}}

 % How do we deal with a percent character?

 % Temporarily change the category code

\catcode`\%=12
\newglossaryentry{phasellus-url}{name={phasellus},
 description={arcu (catcode change)},
 user1=http://theoval.cmp.uea.ac.uk/%7Enlct
}
\catcode`\%=14

 % Use \%

\newglossaryentry{phasellus2-url}{name={phasellus},
 description={arcu (uses \texttt{\string\%})},
 user1=http://theoval.cmp.uea.ac.uk/\%7Enlct
}

 % Use \glspercentchar

\newglossaryentry{phasellus3-url}{name={phasellus},
 description={arcu  (uses 
 \texttt{\string\glspercentchar})},
 user1=http://theoval.cmp.uea.ac.uk/\glspercentchar 7Enlct
}

%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-url.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-2020-03-19.sty>
%    \end{macrocode}
%\fi
% \section{Rollback v4.46 (glossaries-2020-03-19.sty)}
% Version 4.46 preserved for rollback.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{glossaries}[2020/03/19 v4.46 (NLCT)]
\RequirePackage{ifthen}
\RequirePackage{xkeyval}[2006/11/18]
\RequirePackage{mfirstuc}
\RequirePackage{textcase}
\renewcommand*{\mfirstucMakeUppercase}{\MakeTextUppercase}%
\RequirePackage{xfor}
\RequirePackage{datatool-base}
\RequirePackage{amsgen}
\RequirePackage{etoolbox}
\newif\if@gls@docloaded
\@ifpackageloaded{doc}%
{%
  \@gls@docloadedtrue
}%
{%
  \@ifclassloaded{nlctdoc}{\@gls@docloadedtrue}{\@gls@docloadedfalse}%
}
\if@gls@docloaded
  \let\glsorg@theglossary\theglossary
  \let\glsorg@endtheglossary\endtheglossary
  \let\glsorg@PrintChanges\PrintChanges
  \renewcommand{\PrintChanges}{%
    \begingroup
      \let\theglossary\glsorg@theglossary
      \let\endtheglossary\glsorg@endtheglossary
      \glsorg@PrintChanges
    \endgroup
  }
\fi
\newif\if@gls@debug
\define@choicekey{glossaries.sty}{debug}[\gls@debug@val\gls@debug@nr]%
 {true,false,showtargets,showaccsupp}[true]{%
  \ifcase\gls@debug@nr\relax
    % debug=true
    \@gls@debugtrue
    \renewcommand*{\GlossariesWarning}[1]{%
      \PackageWarning{glossaries}{##1}%
    }%
    \renewcommand*{\GlossariesWarningNoLine}[1]{%
      \PackageWarningNoLine{glossaries}{##1}%
    }%
    \let\@glsshowtarget\@gobble
    \PackageInfo{glossaries}{debug mode ON (nowarn option disabled)}%
  \or
    % debug=false
    \@gls@debugfalse
    \let\@glsshowtarget\@gobble
    \let\@glsshowaccsupp\@gobblethree
    \PackageInfo{glossaries}{debug mode OFF}%
  \or
    % debug=showtargets
    \@gls@debugtrue
    \renewcommand*{\GlossariesWarning}[1]{%
      \PackageWarning{glossaries}{##1}%
    }%
    \renewcommand*{\GlossariesWarningNoLine}[1]{%
      \PackageWarningNoLine{glossaries}{##1}%
    }%
    \PackageInfo{glossaries}{debug mode ON (nowarn option disabled)}%
    \renewcommand{\@glsshowtarget}{\@@glsshowtarget}%
  \or
    % debug=showaccsupp
    \@gls@debugtrue
    \renewcommand*{\GlossariesWarning}[1]{%
      \PackageWarning{glossaries}{##1}%
    }%
    \renewcommand*{\GlossariesWarningNoLine}[1]{%
      \PackageWarningNoLine{glossaries}{##1}%
    }%
    \PackageInfo{glossaries}{debug mode ON (nowarn option disabled)}%
    \renewcommand{\@glsshowaccsupp}{\glsshowaccsupp}%
  \fi
}
\newcommand*{\glsshowtarget}[1]{%
 \ifmmode
   \nfss@text{\glsshowtargetfont [#1]}%
 \else
   \ifinner
     {\glsshowtargetfont [#1]}%
   \else
     \glsshowtargetouter{#1}%
   \fi
 \fi
}
\newcommand*{\glsshowtargetouter}[1]{%
 \glsshowtargetsymbol\marginpar{\glsshowtargetsymbol\glsshowtargetfont #1}}
\newcommand*{\glsshowtargetsymbol}{{\tiny$\triangleright$}}
\newcommand*{\glsshowtargetfont}{\ttfamily\footnotesize}
\newcommand*{\@glsshowtarget}[1]{}
\newrobustcmd*{\@@glsshowtarget}[1]{%
  \begingroup
  \protected@edef\@gls@tmp{#1}%
  \@onelevel@sanitize\@gls@tmp
  \expandafter\glsshowtarget\expandafter{\@gls@tmp}%
  \endgroup
}
\newcommand*{\@glsshowaccsupp}[3]{}
\newrobustcmd*{\glsshowaccsupp}[3]{%
  \ifstrempty{#1}%
  {\@@glsshowtarget{/#2 (#3)}}%
  {\@@glsshowtarget{/#2 (#3) [#1]}}%
}
\newcommand*{\@gls@see@noindex}{%
  \PackageError{glossaries}%
  {`\gls@xr@key' key may only be used after \string\makeglossaries\space
   or \string\makenoidxglossaries\space (or move
   \string\newglossaryentry\space
   definitions into the preamble)}%
  {You must use \string\makeglossaries\space
   or \string\makenoidxglossaries\space before defining
   any entries that have a `\gls@xr@key' key. It may
   be that the `see' key has been written to the .glsdefs
   file from the previous run, in which case you need to
   move your definitions
   to the preamble if you don't want to use
   \string\makeglossaries\space
   or \string\makenoidxglossaries}%
}
\define@choicekey{glossaries.sty}{seenoindex}%
 [\gls@seenoindex@val\gls@seenoindex@nr]{error,warn,ignore}{%
  \ifcase\gls@seenoindex@nr
    \renewcommand*{\@gls@see@noindex}{%
      \PackageError{glossaries}%
      {`\gls@xr@key' key may only be used after \string\makeglossaries\space
       or \string\makenoidxglossaries}%
      {You must use \string\makeglossaries\space
       or \string\makenoidxglossaries\space before defining
       any entries that have a `\gls@xr@key' key}%
    }%
  \or
    \renewcommand*{\@gls@see@noindex}{%
      \GlossariesWarning{`\gls@xr@key' key ignored}%
    }%
  \or
    \renewcommand*{\@gls@see@noindex}{}%
  \fi
}
\define@boolkey{glossaries.sty}[gls]{toc}[true]{}
\define@boolkey{glossaries.sty}[gls]{numberline}[true]{}
\ifcsundef{chapter}%
  {\newcommand*{\@@glossarysec}{section}}%
  {\newcommand*{\@@glossarysec}{chapter}}
\define@choicekey{glossaries.sty}{section}{part,chapter,section,%
subsection,subsubsection,paragraph,subparagraph}[section]{%
  \renewcommand*{\@@glossarysec}{#1}}
\newcommand*{\@@glossarysecstar}{*}
\newcommand*{\@@glossaryseclabel}{}
\newcommand*{\glsautoprefix}{}
\define@choicekey{glossaries.sty}{numberedsection}%
 [\gls@numberedsection@val\gls@numberedsection@nr]{%
false,nolabel,autolabel,nameref}[nolabel]{%
  \ifcase\gls@numberedsection@nr\relax
    \renewcommand*{\@@glossarysecstar}{*}%
    \renewcommand*{\@@glossaryseclabel}{}%
  \or
    \renewcommand*{\@@glossarysecstar}{}%
    \renewcommand*{\@@glossaryseclabel}{}%
  \or
    \renewcommand*{\@@glossarysecstar}{}%
    \renewcommand*{\@@glossaryseclabel}{%
      \label{\glsautoprefix\@glo@type}}%
  \or
    \renewcommand*{\@@glossarysecstar}{*}%
    \renewcommand*{\@@glossaryseclabel}{%
      \protected@edef\@currentlabelname{\glossarytoctitle}%
      \label{\glsautoprefix\@glo@type}}%
  \fi
}
\@ifpackageloaded{classicthesis}
{\newcommand*{\@glossary@default@style}{index}}
{\newcommand*{\@glossary@default@style}{list}}
\define@key{glossaries.sty}{style}{%
  \def\@glossary@default@style{#1}%
}
\newcommand*{\@gls@declareoption}[2]{%
  \DeclareOptionX{#1}{#2}%
  \DeclareOption{#1}{#2}%
}
\newcommand*{\glossaryentrynumbers}[1]{#1\gls@save@numberlist{#1}}
\@gls@declareoption{nonumberlist}{%
  \renewcommand*{\glossaryentrynumbers}[1]{\gls@save@numberlist{#1}}%
}
\define@boolkey{glossaries.sty}[gls]{savenumberlist}[true]{}
\glssavenumberlistfalse
\newcommand*\@glo@seeautonumberlist{}
\@gls@declareoption{seeautonumberlist}{%
   \renewcommand*{\@glo@seeautonumberlist}{%
      \def\@glo@prefix{\glsnextpages}%
   }%
}
\define@boolkey{glossaries.sty}[gls]{esclocations}[true]{}
\glsesclocationstrue
\newcommand*{\@gls@loadlong}{\RequirePackage{glossary-long}}
\@gls@declareoption{nolong}{\renewcommand*{\@gls@loadlong}{}}
\IfFileExists{supertabular.sty}{%
  \newcommand*{\@gls@loadsuper}{\RequirePackage{glossary-super}}}{%
  \newcommand*{\@gls@loadsuper}{}}
\@gls@declareoption{nosuper}{\renewcommand*{\@gls@loadsuper}{}}
\newcommand*{\@gls@loadlist}{\RequirePackage{glossary-list}[=v4.46]}
\@gls@declareoption{nolist}{%
 \renewcommand*{\@gls@loadlist}{%
  \ifdefstring{\@glossary@default@style}{list}%
  {\let\@glossary@default@style\relax}%
  {}%
 }%
}
\newcommand*{\@gls@loadtree}{\RequirePackage{glossary-tree}}
\@gls@declareoption{notree}{\renewcommand*{\@gls@loadtree}{}}
\@gls@declareoption{nostyles}{%
  \renewcommand*{\@gls@loadlong}{}%
  \renewcommand*{\@gls@loadsuper}{}%
  \renewcommand*{\@gls@loadlist}{}%
  \renewcommand*{\@gls@loadtree}{}%
  \let\@glossary@default@style\relax
}
\newcommand*{\glspostdescription}{%
  \ifglsnopostdot\else.\spacefactor\sfcode`\. \fi
}
\define@boolkey{glossaries.sty}[gls]{nopostdot}[true]{}
\glsnopostdotfalse
\define@boolkey{glossaries.sty}[gls]{nogroupskip}[true]{}
\glsnogroupskipfalse
\define@boolkey{glossaries.sty}[gls]{ucmark}[true]{}
\@ifclassloaded{memoir}
{%
  \glsucmarktrue
}%
{%
  \glsucmarkfalse
}
\newcommand*{\@gls@define@glossaryentrycounter}{%
  \ifglsentrycounter
    \ifundef\c@glossaryentry
    {%
      \ifx\@gls@counterwithin\@empty
        \newcounter{glossaryentry}%
      \else
        \newcounter{glossaryentry}[\@gls@counterwithin]%
      \fi
      \def\theHglossaryentry{\currentglossary.\theglossaryentry}%
    }%
    {}%
  \fi
}
\define@boolkey{glossaries.sty}[gls]{entrycounter}[true]{}
\glsentrycounterfalse
\define@key{glossaries.sty}{counterwithin}{%
  \renewcommand*{\@gls@counterwithin}{#1}%
  \glsentrycountertrue
  \@gls@define@glossaryentrycounter
}
\newcommand*{\@gls@counterwithin}{}
\newcommand{\@gls@define@glossarysubentrycounter}{%
  \ifundef\c@glossarysubentry
  {%
    \ifglssubentrycounter
      \ifglsentrycounter
        \newcounter{glossarysubentry}[glossaryentry]%
      \else
        \newcounter{glossarysubentry}%
      \fi
      \def\theHglossarysubentry{\currentglossary.\currentglssubentry.\theglossarysubentry}%
    \fi
  }%
  {}%
}
\define@boolkey{glossaries.sty}[gls]{subentrycounter}[true]{}
\glssubentrycounterfalse
\newcommand*{\@glo@default@sorttype}{standard}
\define@choicekey{glossaries.sty}{sort}{standard,def,use,none}{%
  \renewcommand*{\@glo@default@sorttype}{#1}%
  \csname @gls@setupsort@#1\endcsname
}
\newcommand*{\glsprestandardsort}[3]{%
  \glsdosanitizesort
}
\newcommand*{\@glo@check@sortallowed}[1]{}
\newcommand*{\@gls@setupsort@standard}{%
  \def\do@glo@storeentry{\@glo@storeentry}%
  \def\@gls@defsortcount##1{}%
  \def\@gls@defsort##1##2{%
    \ifx\@glo@sort\@glsdefaultsort
      \let\@glo@sort\@glo@name
    \fi
    \let\glsdosanitizesort\@gls@sanitizesort
    \glsprestandardsort{\@glo@sort}{##1}{##2}%
    \expandafter\protected@xdef\csname glo@##2@sort\endcsname{\@glo@sort}%
  }%
  \def\@gls@setsort##1{}%
  \let\@glo@check@sortallowed\@gobble
}
\@gls@setupsort@standard
\newcommand*\glssortnumberfmt[1]{%
  \ifnum#1<100000 0\fi
  \ifnum#1<10000 0\fi
  \ifnum#1<1000 0\fi
  \ifnum#1<100 0\fi
  \ifnum#1<10 0\fi
  \number#1%
}
\newcommand*{\@gls@setupsort@def}{%
  \def\do@glo@storeentry{\@glo@storeentry}%
  \def\@gls@defsortcount##1{%
    \expandafter\global
    \expandafter\newcount\csname glossary@##1@sortcount\endcsname
  }%
  \def\@gls@defsort##1##2{%
    \ifcsundef{glossary@##1@sortcount}%
    {\@gls@defsortcount{##1}}%
    {}%
    \expandafter\global\expandafter
    \advance\csname glossary@##1@sortcount\endcsname by 1\relax
    \expandafter\protected@xdef\csname glo@##2@sort\endcsname{%
       \expandafter\glssortnumberfmt
         {\csname glossary@##1@sortcount\endcsname}}%
  }%
  \def\@gls@setsort##1{}%
  \let\@glo@check@sortallowed\@gobble
}
\newcommand*{\@gls@setupsort@use}{%
  \let\do@glo@storeentry\@gobble
  \def\@gls@defsortcount##1{%
    \expandafter\global
    \expandafter\newcount\csname glossary@##1@sortcount\endcsname
  }%
  \def\@gls@defsort##1##2{%
    \expandafter\gdef\csname glo@##2@sort\endcsname{}%
  }%
  \def\@gls@setsort##1{%
    \edef\@glo@parent{\csname glo@##1@parent\endcsname}%
    \ifx\@glo@parent\@empty
    \else
      \expandafter\@gls@setsort\expandafter{\@glo@parent}%
    \fi
    \edef\@glo@type{\csname glo@##1@type\endcsname}%
    \edef\@gls@tmp{\csname glo@##1@sort\endcsname}%
    \ifx\@gls@tmp\@empty
      \expandafter\global\expandafter
      \advance\csname glossary@\@glo@type @sortcount\endcsname by 1\relax
      \expandafter\protected@xdef\csname glo@##1@sort\endcsname{%
         \expandafter\glssortnumberfmt
           {\csname glossary@\@glo@type @sortcount\endcsname}}%
      \@glo@storeentry{##1}%
    \fi
  }%
  \let\@glo@check@sortallowed\@gobble
}
\newcommand*{\@gls@setupsort@none}{%
  \def\do@glo@storeentry##1{}%
  \def\@gls@defsortcount##1{}%
  \def\@gls@defsort##1##2{%
    \expandafter\global\expandafter\let\csname glo@##2@sort\endcsname\@glo@sort
  }%
  \def\@gls@setsort##1{}%
  \renewcommand\@glo@check@sortallowed[1]{\PackageError{glossaries}
   {Option sort=none not allowed with \string##1}%
   {(Use sort=def instead)}}%
}
\newcommand*{\glsdefmain}{%
  \if@gls@docloaded
    \newglossary[glg2]{main}{gls2}{glo2}{\glossaryname}%
  \else
    \newglossary{main}{gls}{glo}{\glossaryname}%
  \fi
  \newcommand*{\gls@tr@set@main@toctitle}{%
    \translatelet{\glossarytoctitle}{Glossary}%
  }%
}
\newcommand*{\glsdefaulttype}{main}
\newcommand*{\acronymtype}{\glsdefaulttype}
\@gls@declareoption{nomain}{%
   \let\glsdefaulttype\relax
   \renewcommand*{\glsdefmain}{}%
}
\define@boolkey{glossaries.sty}[gls]{acronym}[true]{%
  \ifglsacronym
    \renewcommand{\@gls@do@acronymsdef}{%
      \DeclareAcronymList{acronym}%
      \newglossary[alg]{acronym}{acr}{acn}{\acronymname}%
      \renewcommand*{\acronymtype}{acronym}%
      \newcommand*{\gls@tr@set@acronym@toctitle}{%
        \translatelet{\glossarytoctitle}{Acronyms}%
      }%
    }%
  \else
    \let\@gls@do@acronymsdef\relax
  \fi
}
\AtBeginDocument{%
  \ifglsacronym
    \ifbool{glscompatible-3.07}%
    {}%
    {%
      \providecommand*{\printacronyms}[1][]{%
        \printglossary[type=\acronymtype,#1]}%
    }%
  \fi
}
\newcommand*{\@gls@do@acronymsdef}{}
\@gls@declareoption{acronyms}{%
  \glsacronymtrue
  \def\@gls@do@acronymsdef{%
     \DeclareAcronymList{acronym}%
     \newglossary[alg]{acronym}{acr}{acn}{\acronymname}%
     \renewcommand*{\acronymtype}{acronym}%
      \newcommand*{\gls@tr@set@acronym@toctitle}{%
        \translatelet{\glossarytoctitle}{Acronyms}%
      }%
   }%
}
\newcommand*{\@glsacronymlists}{}
\newcommand*{\@addtoacronymlists}[1]{%
  \ifx\@glsacronymlists\@empty
    \protected@xdef\@glsacronymlists{#1}%
  \else
    \protected@xdef\@glsacronymlists{\@glsacronymlists,#1}%
  \fi
}
\newcommand*{\DeclareAcronymList}[1]{%
  \glsIfListOfAcronyms{#1}{}{\@addtoacronymlists{#1}}%
}
\newcommand{\glsIfListOfAcronyms}[1]{%
  \edef\@do@gls@islistofacronyms{%
    \noexpand\@gls@islistofacronyms{#1}{\@glsacronymlists}}%
  \@do@gls@islistofacronyms
}
\newcommand{\@gls@islistofacronyms}[4]{%
  \def\gls@islistofacronyms##1,#1,##2\end@gls@islistofacronyms{%
     \def\@gls@before{##1}\def\@gls@after{##2}}%
  \gls@islistofacronyms,#2,#1,\@nil\end@gls@islistofacronyms
  \ifx\@gls@after\@nnil
    #4%
  \else
    #3%
  \fi
}
\newif\if@glsisacronymlist
\newcommand*{\gls@checkisacronymlist}[1]{%
   \glsIfListOfAcronyms{#1}%
     {\@glsisacronymlisttrue}{\@glsisacronymlistfalse}%
}
\newcommand*{\SetAcronymLists}[1]{%
  \renewcommand*{\@glsacronymlists}{#1}%
}
\define@key{glossaries.sty}{acronymlists}{%
  \DeclareAcronymList{#1}%
}
\newcommand{\glscounter}{page}
\define@key{glossaries.sty}{counter}{%
  \renewcommand*{\glscounter}{#1}%
}
\newcommand*{\@gls@nohyperlist}{}
\newcommand*{\GlsDeclareNoHyperList}[1]{%
  \ifdefempty\@gls@nohyperlist
  {%
     \renewcommand*{\@gls@nohyperlist}{#1}%
  }%
  {%
     \appto\@gls@nohyperlist{,#1}%
  }%
}
\define@key{glossaries.sty}{nohypertypes}{%
  \GlsDeclareNoHyperList{#1}%
}
\newcommand*{\GlossariesWarning}[1]{%
  \PackageWarning{glossaries}{#1}%
}
\newcommand*{\GlossariesWarningNoLine}[1]{%
  \PackageWarningNoLine{glossaries}{#1}%
}
\newcommand{\glosortentrieswarning}{%
 \typeout{Using TeX to sort glossary entries---this may
 take a while}%
}
\@gls@declareoption{nowarn}{%
  \if@gls@debug
    \GlossariesWarning{Warnings can't be suppressed in debug mode}%
  \else
    \renewcommand*{\GlossariesWarning}[1]{}%
    \renewcommand*{\GlossariesWarningNoLine}[1]{}%
    \renewcommand*{\glosortentrieswarning}{}%
    \renewcommand*{\@gls@missinglang@warn}[2]{}%
  \fi
}
\newcommand*{\@gls@missinglang@warn}[2]{%
  \PackageWarningNoLine{glossaries}%
  {No language module detected for `#1'.\MessageBreak
  Language modules need to be installed separately.\MessageBreak
  Please check on CTAN for a bundle called\MessageBreak
  `glossaries-#2' or similar}%
}
\@gls@declareoption{nolangwarn}{%
  \renewcommand*{\@gls@missinglang@warn}[2]{}%
}
\newcommand*{\@gls@warnonglossdefined}{%
  \GlossariesWarning{Overriding \string\printglossary}%
}
\newcommand*{\@gls@warnontheglossdefined}{%
  \GlossariesWarning{Overriding `theglossary' environment}%
}
\@gls@declareoption{noredefwarn}{%
  \renewcommand*{\@gls@warnonglossdefined}{}%
  \renewcommand*{\@gls@warnontheglossdefined}{}%
}
\newcommand*{\@gls@sanitizedesc}{%
}
\newcommand*{\glssetexpandfield}[1]{%
  \csdef{gls@assign@#1@field}##1##2{%
    \@@gls@expand@field{##1}{#1}{##2}%
  }%
}
\newcommand*{\glssetnoexpandfield}[1]{%
  \csdef{gls@assign@#1@field}##1##2{%
    \@@gls@noexpand@field{##1}{#1}{##2}%
  }%
}
\glssetexpandfield{type}
\glssetnoexpandfield{desc}
\glssetnoexpandfield{descplural}
\newcommand*{\@gls@sanitizename}{}
\glssetnoexpandfield{name}
\newcommand*{\@gls@sanitizesymbol}{}
\glssetnoexpandfield{symbol}
\glssetnoexpandfield{symbolplural}
\newcommand*{\@gls@sanitizesort}{%
  \ifglssanitizesort
    \@@gls@sanitizesort
  \else
    \@@gls@nosanitizesort
  \fi
}
\newcommand*\@@gls@sanitizesort{%
  \@onelevel@sanitize\@glo@sort
}
\newcommand*{\@@gls@nosanitizesort}{}
\newcommand*\@gls@noidx@sanitizesort{%
  \ifdefvoid\@glo@sort
  {}%
  {%
    \expandafter\@@gls@noidx@sanitizesort\@glo@sort\gls@end@sanitizesort
  }%
}
\def\@@gls@noidx@sanitizesort#1#2\gls@end@sanitizesort{%
  \def\@glo@sort{#1#2}%
  \@onelevel@sanitize\@glo@sort
}
\newcommand*{\@@gls@noidx@nosanitizesort}{%
  \ifdefvoid\@glo@sort
  {}%
  {%
    \expandafter\@@gls@noidx@no@sanitizesort\@glo@sort\gls@end@sanitizesort
  }%
}
\def\@@gls@noidx@no@sanitizesort#1#2\gls@end@sanitizesort{%
  \bgroup
    \glsnoidxstripaccents
    \protected@xdef\@@glo@sort{#1#2}%
  \egroup
  \let\@glo@sort\@@glo@sort
}
\newcommand*\glsnoidxstripaccents{%
  \let\IeC\@firstofone
  \let\add@accent@\@secondoftwo
  \let\@text@composite@x\@secondoftwo
  \let\@tabacckludge\@secondoftwo
  \expandafter\def\csname \encodingdefault-cmd\endcsname##1##2##3{##3}%
  \expandafter\def\csname OT1-cmd\endcsname##1##2##3{##3}%
  \expandafter\def\csname T1-cmd\endcsname##1##2##3{##3}%
  \expandafter\def\csname PD1-cmd\endcsname##1##2##3{##3}%
  \let\'\@firstofone
  \let\`\@firstofone
  \let\^\@firstofone
  \let\"\@firstofone
  \let\u\@firstofone
  \let\t\@firstofone
  \let\d\@firstofone
  \let\r\@firstofone
  \let\=\@firstofone
  \let\.\@firstofone
  \let\~\@firstofone
  \let\v\@firstofone
  \let\H\@firstofone
  \let\c\@firstofone
  \let\b\@firstofone
  \let\a\@secondoftwo
  \def\AE{AE}%
  \def\ae{ae}%
  \def\OE{OE}%
  \def\oe{oe}%
  \def\AA{AA}%
  \def\aa{aa}%
  \def\L{L}%
  \def\l{l}%
  \def\O{O}%
  \def\o{o}%
  \def\SS{SS}%
  \def\ss{ss}%
  \def\th{th}%
  \def\TH{TH}%
  \def\dh{dh}%
  \def\DH{DH}%
}
\@ifl@t@r\fmtversion{2019/10/01}
{%
 \appto\glsnoidxstripaccents{\let\UTFviii@two@octets\UTFviii@two@octets@combine}%
}
{}
\define@boolkey[gls]{sanitize}{description}[true]{%
  \GlossariesWarning{sanitize={description} package option deprecated}%
  \ifgls@sanitize@description
    \glssetnoexpandfield{desc}%
    \glssetnoexpandfield{descplural}%
  \else
    \glssetexpandfield{desc}%
    \glssetexpandfield{descplural}%
  \fi
}
\define@boolkey[gls]{sanitize}{name}[true]{%
  \GlossariesWarning{sanitize={name} package option deprecated}%
  \ifgls@sanitize@name
    \glssetnoexpandfield{name}%
  \else
    \glssetexpandfield{name}%
  \fi
}
\define@boolkey[gls]{sanitize}{symbol}[true]{%
  \GlossariesWarning{sanitize={symbol} package option deprecated}%
  \ifgls@sanitize@symbol
    \glssetnoexpandfield{symbol}%
    \glssetnoexpandfield{symbolplural}%
  \else
    \glssetexpandfield{symbol}%
    \glssetexpandfield{symbolplural}%
  \fi
}
\define@boolkey{glossaries.sty}[gls]{sanitizesort}[true]{%
  \ifglssanitizesort
    \glssetnoexpandfield{sortvalue}%
    \renewcommand*{\@gls@noidx@setsanitizesort}{%
      \glssanitizesorttrue
      \glssetnoexpandfield{sortvalue}%
    }%
  \else
    \glssetexpandfield{sortvalue}%
    \renewcommand*{\@gls@noidx@setsanitizesort}{%
      \glssanitizesortfalse
      \glssetexpandfield{sortvalue}%
    }%
  \fi
}
\glssanitizesorttrue
\glssetnoexpandfield{sortvalue}%
\newcommand*{\@gls@noidx@setsanitizesort}{%
  \glssanitizesortfalse
  \glssetexpandfield{sortvalue}%
}
\define@choicekey[gls]{sanitize}{sort}{true,false}[true]{%
  \setbool{glssanitizesort}{#1}%
  \ifglssanitizesort
    \glssetnoexpandfield{sortvalue}%
  \else
    \glssetexpandfield{sortvalue}%
  \fi
  \GlossariesWarning{sanitize={sort} package option
    deprecated. Use sanitizesort instead}%
}
\define@key{glossaries.sty}{sanitize}[description=true,symbol=true,name=true]{%
  \ifthenelse{\equal{#1}{none}}%
  {%
    \GlossariesWarning{sanitize package option deprecated}%
    \glssetexpandfield{name}%
    \glssetexpandfield{symbol}%
    \glssetexpandfield{symbolplural}%
    \glssetexpandfield{desc}%
    \glssetexpandfield{descplural}%
  }%
  {%
    \setkeys[gls]{sanitize}{#1}%
  }%
}
\newif\ifglstranslate
\newcommand*\@gls@usetranslator{%
  \@ifpackageloaded{polyglossia}%
  {%
     \let\glsifusetranslator\@secondoftwo
  }%
  {%
    \@ifpackageloaded{babel}%
    {%
        \IfFileExists{translator.sty}%
        {%
           \RequirePackage{translator}%
           \let\glsifusetranslator\@firstoftwo
        }%
        {}%
    }%
    {}%
  }%
}
\newcommand{\glsifusedtranslatordict}[3]{%
  \glsifusetranslator
  {\ifcsdef{ver@glossaries-dictionary-#1.dict}{#2}{#3}}%
  {#3}%
}
\@gls@declareoption{notranslate}{%
  \glstranslatefalse
  \let\@gls@usetranslator\relax
  \let\glsifusetranslator\@secondoftwo
}
\define@choicekey{glossaries.sty}{translate}%
  [\gls@translate@val\gls@translate@nr]%
  {true,false,babel}[true]%
  {%
    \ifcase\gls@translate@nr\relax
      \glstranslatetrue
      \renewcommand*\@gls@usetranslator{%
        \@ifpackageloaded{polyglossia}%
        {%
           \let\glsifusetranslator\@secondoftwo
        }%
        {%
          \@ifpackageloaded{babel}%
          {%
            \IfFileExists{translator.sty}%
            {%
               \RequirePackage{translator}%
               \let\glsifusetranslator\@firstoftwo
            }%
            {}%
          }%
          {}%
        }%
      }%
    \or
      \glstranslatefalse
      \let\@gls@usetranslator\relax
      \let\glsifusetranslator\@secondoftwo
    \or
      \glstranslatetrue
      \let\@gls@usetranslator\relax
      \let\glsifusetranslator\@secondoftwo
    \fi
  }
\glstranslatefalse
\let\glsifusetranslator\@secondoftwo
\@ifpackageloaded{translator}%
{%
  \glstranslatetrue
  \let\glsifusetranslator\@firstoftwo
}%
{%
  \@for\gls@thissty:=tracklang,babel,ngerman,polyglossia\do
  {
    \@ifpackageloaded{\gls@thissty}%
    {%
      \glstranslatetrue
      \@endfortrue
    }%
    {}%
  }
}
\define@boolkey{glossaries.sty}[gls]{indexonlyfirst}[true]{}
\glsindexonlyfirstfalse
\define@boolkey{glossaries.sty}[gls]{hyperfirst}[true]{}
\glshyperfirsttrue
\newcommand*{\@gls@setacrstyle}{}
\define@boolkey{glossaries.sty}[glsacr]{footnote}[true]{%
  \ifbool{glsacrdescription}%
  {}%
  {%
    \renewcommand*{\@gls@sanitizedesc}{}%
  }%
  \renewcommand*{\@gls@setacrstyle}{\SetAcronymStyle}%
}
\define@boolkey{glossaries.sty}[glsacr]{description}[true]{%
  \renewcommand*{\@gls@sanitizesymbol}{}%
  \renewcommand*{\@gls@setacrstyle}{\SetAcronymStyle}%
}
\define@boolkey{glossaries.sty}[glsacr]{smallcaps}[true]{%
  \renewcommand*{\@gls@sanitizesymbol}{}%
  \renewcommand*{\@gls@setacrstyle}{\SetAcronymStyle}%
}
\define@boolkey{glossaries.sty}[glsacr]{smaller}[true]{%
  \renewcommand*{\@gls@sanitizesymbol}{}%
  \renewcommand*{\@gls@setacrstyle}{\SetAcronymStyle}%
}
\define@boolkey{glossaries.sty}[glsacr]{dua}[true]{%
  \renewcommand*{\@gls@sanitizesymbol}{}%
  \renewcommand*{\@gls@setacrstyle}{\SetAcronymStyle}%
}
\define@boolkey{glossaries.sty}[glsacr]{shortcuts}[true]{}
\newcommand*{\glsorder}{word}
\newcommand*{\@glsorder}[1]{}
\define@choicekey{glossaries.sty}{order}{word,letter}{%
  \def\glsorder{#1}}
\newif\ifglsxindy
\glsxindyfalse
\@gls@declareoption{makeindex}{\glsxindyfalse}
\define@boolkey[gls]{xindy}{glsnumbers}[true]{}
\gls@xindy@glsnumberstrue
\def\@xdy@main@language{\languagename}%
\define@key[gls]{xindy}{language}{\def\@xdy@main@language{#1}}
\ifcsundef{inputencodingname}{%
  \def\gls@codepage{}}{%
  \def\gls@codepage{\inputencodingname}
}
\define@key[gls]{xindy}{codepage}{\def\gls@codepage{#1}}
\define@key{glossaries.sty}{xindy}[]{%
  \glsxindytrue
  \setkeys[gls]{xindy}{#1}%
}
\@gls@declareoption{xindygloss}{%
  \glsxindytrue
}
\@gls@declareoption{xindynoglsnumbers}{%
  \glsxindytrue
  \gls@xindy@glsnumbersfalse
}
\providecommand{\@domakeglossaries}[1]{#1}
\@gls@declareoption{disablemakegloss}{%
  \ifdefequal\makeglossaries\@no@makeglossaries
  {%
    \GlossariesWarning{Option `disablemakegloss' has no effect
    (\string\makenoidxglossaries\space has already been used)}%
  }%
  {%
    \ifdefequal\@makeglossary\@gobble
    {%
      \GlossariesWarning{Option `disablemakegloss' has no effect
      (\string\makeglossaries\space has already been used)}%
    }%
    {%
      \renewcommand{\@domakeglossaries}[1]{%
        \PackageInfo{glossaries}{\string\makeglossaries\space and
          \string\makenoidxglossaries\space have been disabled}%
      }%
    }%
  }%
}
\@gls@declareoption{restoremakegloss}{%
  \ifdefequal\makeglossaries\@no@makeglossaries
  {%
    \GlossariesWarning{Option `restoremakegloss' has no effect
    (\string\makenoidxglossaries\space has already been used)}%
  }%
  {%
    \ifdefequal\@makeglossary\@gobble
    {%
      \GlossariesWarning{Option `restoremakegloss' has no effect
      (\string\makeglossaries\space has already been used)}%
    }%
    {%
      \PackageInfo{glossaries}{\string\makeglossaries\space and
        \string\makenoidxglossaries\space have been restored}%
      \let\@domakeglossaries\@firstofone
    }%
  }%
}
\newcommand*{\@do@write@glslabels}{%
 \AtEndDocument{\@@do@write@glslabels}%
 \let\@do@write@glslabels\relax
}
\newcommand*{\@@do@write@glslabels}{%
  \newwrite\@gls@labelsfile
  \immediate\openout\@gls@labelsfile=\jobname.glslabels
  \forallglsentries[\@glo@types,\@ignored@glossaries]{\@glsentry}%
  {\ifdefempty{\@glsentry}{}{\immediate\write\@gls@labelsfile{\@glsentry}}}%
  \immediate\closeout\@gls@labelsfile
}
\@gls@declareoption{writeglslabels}{\@do@write@glslabels}
\newif\ifglsautomake
\newcommand{\gls@automake@nr}{1}
\define@choicekey{glossaries.sty}{automake}%
  [\gls@automake@val\gls@automake@nr]{true,false,immediate}[true]{%
  \ifnum\gls@automake@nr=1\relax
   \glsautomakefalse
  \else
   \glsautomaketrue
  \fi
  \ifglsautomake
    \renewcommand*{\@gls@doautomake}{%
      \PackageError{glossaries}{You must use
      \string\makeglossaries\space with automake=true}
      {%
         Either remove the automake=true setting or
         add \string\makeglossaries\space to your document preamble.%
      }%
    }%
  \else
    \renewcommand*{\@gls@doautomake}{}%
  \fi
}
\glsautomakefalse
\newcommand*{\@gls@doautomake}{}
\AtEndDocument{\@gls@doautomake}
\define@boolkey{glossaries.sty}[gls]{savewrites}[true]{%
  \ifglssavewrites
    \renewcommand*{\glswritefiles}{\@glswritefiles}%
  \else
    \let\glswritefiles\@empty
  \fi
}
\glssavewritesfalse
\let\glswritefiles\@empty
\define@boolkey{glossaries.sty}[gls]{compatible-3.07}[true]{}
\boolfalse{glscompatible-3.07}
\define@boolkey{glossaries.sty}[gls]{compatible-2.07}[true]{%
  \ifbool{glscompatible-2.07}%
  {%
    \booltrue{glscompatible-3.07}%
  }%
  {}%
}
\boolfalse{glscompatible-2.07}
\let\gls@original@makeglossary\makeglossary
\let\gls@original@glossary\glossary
\def\makeglossary{%
 \GlossariesWarning{Use of \string\makeglossary\space with
 glossaries.sty is \MessageBreak deprecated. Use \string\makeglossaries\space
 instead. If you \MessageBreak need the original definition of
 \string\makeglossary\space use \MessageBreak the package options
 kernelglossredefs=false (to \MessageBreak restore the former definition of
 \string\makeglossary) and \MessageBreak nomain (if the file extensions cause a
 conflict)}%
 \makeglossaries
}
\newcommand*{\@gls@override@glossary}[1][main]{%
 \GlossariesWarning{Use of \string\glossary\space with
 glossaries.sty is deprecated. \MessageBreak Indexing should be performed
 with the user level \MessageBreak commands, such as \string\gls\space or
 \string\glsadd. If you need the \MessageBreak original definition of
 \string\glossary\space use the package \MessageBreak options
  kernelglossredefs=false (to restore the \MessageBreak former definition of
 \string\glossary) and nomain (if the \MessageBreak file extensions cause a
 conflict)}%
 \gls@glossary{#1}%
}
\if@gls@docloaded
\else
  \def\glossary{\@gls@override@glossary}
\fi
\define@choicekey{glossaries.sty}{kernelglossredefs}%
 [\gls@debug@val\gls@debug@nr]{true,false,nowarn}[true]%
{%
  \ifcase\gls@debug@nr\relax
   \def\glossary{\@gls@override@glossary}%
   \def\makeglossary{%
    \GlossariesWarning{Use of \string\makeglossary\space with
    glossaries.sty is deprecated. Use \string\makeglossaries\space
    instead. If you need the original definition of
    \string\makeglossary\space use the package options
    kernelglossredefs=false (to prevent redefinition of
    \string\makeglossary) and nomain (if the file extensions cause a
    conflict)}%
    \makeglossaries
   }%
  \or
    \let\glossary\gls@original@glossary
    \let\makeglossary\gls@original@makeglossary
  \or
    \def\makeglossary{\makeglossaries}%
    \renewcommand*{\@gls@override@glossary}[1][main]{%
       \gls@glossary{##1}%
    }%
  \fi
}
\@gls@declareoption{symbols}{%
  \let\@gls@do@symbolsdef\@gls@symbolsdef
}
\newcommand*{\@gls@do@symbolsdef}{}
\newcommand*{\@gls@symbolsdef}{%
  \newglossary[slg]{symbols}{sls}{slo}{\glssymbolsgroupname}%
  \newcommand*{\printsymbols}[1][]{\printglossary[type=symbols,##1]}%
  \newcommand*{\gls@tr@set@symbols@toctitle}{%
    \translatelet{\glossarytoctitle}{Symbols (glossaries)}%
  }%
}%
\@gls@declareoption{numbers}{%
  \let\@gls@do@numbersdef\@gls@numbersdef
}
\newcommand*{\@gls@do@numbersdef}{}
\newcommand*{\@gls@numbersdef}{%
  \newglossary[nlg]{numbers}{nls}{nlo}{\glsnumbersgroupname}%
  \newcommand*{\printnumbers}[1][]{\printglossary[type=numbers,##1]}%
  \newcommand*{\gls@tr@set@numbers@toctitle}{%
    \translatelet{\glossarytoctitle}{Numbers (glossaries)}%
  }%
}%
\@gls@declareoption{index}{%
  \ifx\@gls@do@indexdef\@empty
    \let\@gls@do@indexdef\@gls@indexdef
  \fi
}
\@gls@declareoption{noglossaryindex}{%
  \let\@gls@do@indexdef\relax
}
\newcommand*{\@gls@do@indexdef}{}
\newcommand*{\@gls@indexdef}{%
  \newglossary[ilg]{index}{ind}{idx}{\indexname}%
  \newcommand*{\printindex}[1][]{\printglossary[type=index,##1]}%
  \newcommand*{\newterm}[2][]{%
    \newglossaryentry{##2}%
    {type={index},name={##2},description={\nopostdesc},##1}}
  \let\@gls@do@indexdef\relax
}%
\@for\CurrentOption :=\@declaredoptions\do{%
  \ifx\CurrentOption\@empty
  \else
    \@expandtwoargs
      \in@ {,\CurrentOption ,}{,\@classoptionslist,\@curroptions,}%
    \ifin@
      \@use@ption
      \expandafter \let\csname ds@\CurrentOption\endcsname\@empty
    \fi
  \fi
}
\ProcessOptionsX
\RequirePackage{glossaries-compatible-307}
\disable@keys{glossaries.sty}{compatible-2.07,%
 xindy,xindygloss,xindynoglsnumbers,makeindex,%
 acronym,translate,notranslate,nolong,nosuper,notree,nostyles,%
 nomain,noglossaryindex}
\newcommand*{\setupglossaries}[1]{%
  \renewcommand*{\@gls@setacrstyle}{}%
  \ifglsacrshortcuts
    \def\@gls@setupshortcuts{\glsacrshortcutstrue}%
  \else
    \def\@gls@setupshortcuts{%
      \ifglsacrshortcuts
        \DefineAcronymSynonyms
      \fi
    }%
  \fi
  \glsacrshortcutsfalse
  \let\@gls@do@numbersdef\relax
  \let\@gls@do@symbolssdef\relax
  \let\@gls@do@indexdef\relax
  \let\@gls@do@acronymsdef\relax
  \ifglsentrycounter
    \let\@gls@doentrycounterdef\relax
  \else
    \let\@gls@doentrycounterdef\@gls@define@glossaryentrycounter
  \fi
  \ifglssubentrycounter
    \let\@gls@dosubentrycounterdef\relax
  \else
    \let\@gls@dosubentrycounterdef\@gls@define@glossarysubentrycounter
  \fi
  \setkeys{glossaries.sty}{#1}%
  \@gls@setacrstyle
  \@gls@setupshortcuts
  \@gls@do@acronymsdef
  \@gls@do@numbersdef
  \@gls@do@symbolssdef
  \@gls@do@indexdef
  \@gls@doentrycounterdef
  \@gls@dosubentrycounterdef
}
\ifthenelse{\equal{\glscounter}{section}}%
{%
  \ifcsundef{chapter}{}%
  {%
    \let\@gls@old@chapter\@chapter
    \def\@chapter[#1]#2{\@gls@old@chapter[{#1}]{#2}%
    \ifcsundef{hyperdef}{}{\hyperdef{section}{\thesection}{}}}%
  }%
}%
{}
\newcommand*{\@gls@onlypremakeg}{}
\newcommand*{\@onlypremakeg}[1]{%
  \ifx\@gls@onlypremakeg\@empty
     \def\@gls@onlypremakeg{#1}%
  \else
     \expandafter\toks@\expandafter{\@gls@onlypremakeg}%
     \edef\@gls@onlypremakeg{\the\toks@,\noexpand#1}%
  \fi
}
\newcommand*{\@disable@onlypremakeg}{%
\@for\@thiscs:=\@gls@onlypremakeg\do{%
   \expandafter\@disable@premakecs\@thiscs%
}}
\newcommand*{\@disable@premakecs}[1]{%
  \def#1{\PackageError{glossaries}{\string#1\space may only be
  used before \string\makeglossaries}{You can't use
  \string#1\space after \string\makeglossaries}}%
}
\providecommand*{\glossaryname}{Glossary}
\providecommand*{\acronymname}{Acronyms}
\newcommand*{\glssettoctitle}[1]{%
 \def\glossarytoctitle{\csname @glotype@#1@title\endcsname}}
\providecommand*{\entryname}{Notation}
\providecommand*{\descriptionname}{Description}
\providecommand*{\symbolname}{Symbol}
\providecommand*{\pagelistname}{Page List}
\providecommand*{\glssymbolsgroupname}{Symbols}
\providecommand*{\glsnumbersgroupname}{Numbers}
\newcommand*{\glspluralsuffix}{s}
\newcommand*{\glsacrpluralsuffix}{\glspluralsuffix}
\newcommand*{\glsupacrpluralsuffix}{\glstextup{\glsacrpluralsuffix}}
\providecommand*{\seename}{see}
\providecommand*{\andname}{\&}
\newcommand*{\RequireGlossariesLang}[1]{%
  \@ifundefined{ver@glossaries-#1.ldf}{\input{glossaries-#1.ldf}}{}%
}
\newcommand*{\ProvidesGlossariesLang}[1]{%
  \ProvidesFile{glossaries-#1.ldf}%
}
\newcommand*{\addglossarytocaptions}[1]{}
\ifglstranslate
  \RequirePackage{tracklang}
  \@gls@usetranslator
  \@ifpackageloaded{translator}
  {%
    \ifboolexpr
    {
      test {\ifdefstring{\trans@languages}{English}}
      and not
      test {\ifdefstring{bbl@loaded}{english}}
    }
    {%
      \let\glsifusetranslator\@secondoftwo
    }%
    {%
       \usedictionary{glossaries-dictionary}%
       \renewcommand*{\addglossarytocaptions}[1]{%
         \ifcsundef{captions#1}{}%
         {%
           \expandafter\let\expandafter\@gls@tmp\csname captions#1\endcsname
           \expandafter\toks@\expandafter{\@gls@tmp
             \renewcommand*{\glossaryname}{\translate{Glossary}}%
           }%
           \expandafter\edef\csname captions#1\endcsname{\the\toks@}%
         }%
       }%
    }%
  }%
  {}%
  \AnyTrackedLanguages
  {%
    \ForEachTrackedDialect{\this@dialect}{%
      \IfTrackedLanguageFileExists{\this@dialect}%
      {glossaries-}% prefix
      {.ldf}%
      {%
        \RequireGlossariesLang{\CurrentTrackedTag}%
      }%
      {%
        \@gls@missinglang@warn\this@dialect\CurrentTrackedLanguage
      }%
    }%
  }%
  {}%
  \glsifusetranslator
  {%
    \renewcommand*{\glssettoctitle}[1]{%
      \ifcsdef{gls@tr@set@#1@toctitle}%
      {%
        \csuse{gls@tr@set@#1@toctitle}%
      }%
      {%
        \def\glossarytoctitle{\csname @glotype@#1@title\endcsname}%
      }%
    }%
    \renewcommand*{\glossaryname}{\translate{Glossary}}%
    \renewcommand*{\acronymname}{\translate{Acronyms}}%
    \renewcommand*{\entryname}{\translate{Notation (glossaries)}}%
    \renewcommand*{\descriptionname}{%
      \translate{Description (glossaries)}}%
    \renewcommand*{\symbolname}{\translate{Symbol (glossaries)}}%
    \renewcommand*{\pagelistname}{%
      \translate{Page List (glossaries)}}%
    \renewcommand*{\glssymbolsgroupname}{%
      \translate{Symbols (glossaries)}}%
    \renewcommand*{\glsnumbersgroupname}{%
      \translate{Numbers (glossaries)}}%
  }{}%
\fi
\DeclareRobustCommand*{\nopostdesc}{}
\newcommand*{\@nopostdesc}{%
  \let\org@glspostdescription\glspostdescription
  \def\glspostdescription{%
    \let\glspostdescription\org@glspostdescription}%
}
\newcommand*{\@no@post@desc}{\nopostdesc}
\newcommand{\glspar}{\par}
\newcommand{\setStyleFile}[1]{%
  \renewcommand*{\gls@istfilebase}{#1}%
  \ifglsxindy
    \def\istfilename{\gls@istfilebase.xdy}
  \else
    \def\istfilename{\gls@istfilebase.ist}
  \fi
}
\@onlypremakeg\setStyleFile
\ifglsxindy
  \def\istfilename{\gls@istfilebase.xdy}
\else
  \def\istfilename{\gls@istfilebase.ist}
\fi
\newcommand*{\gls@istfilebase}{\jobname}
\newcommand*{\@istfilename}[1]{}
\newcommand*{\glscompositor}{.}
\newcommand*{\glsSetCompositor}[1]{%
  \renewcommand*{\glscompositor}{#1}}
\@onlypremakeg\glsSetCompositor
\newcommand*{\@glsAlphacompositor}{\glscompositor}
\ifglsxindy
  \newcommand*\glsSetAlphaCompositor[1]{%
     \renewcommand*\@glsAlphacompositor{#1}}
\else
  \newcommand*\glsSetAlphaCompositor[1]{%
    \glsnoxindywarning\glsSetAlphaCompositor}
\fi
\@onlypremakeg\glsSetAlphaCompositor
\newcommand*{\gls@suffixF}{}
\newcommand*{\glsSetSuffixF}[1]{%
  \renewcommand*{\gls@suffixF}{#1}}
\@onlypremakeg\glsSetSuffixF
\newcommand*{\gls@suffixFF}{}
\newcommand*{\glsSetSuffixFF}[1]{%
  \renewcommand*{\gls@suffixFF}{#1}%
}
\ifcsundef{hyperlink}%
{%
  \newcommand*{\glsnumberformat}[1]{#1}%
}%
{%
  \newcommand*{\glsnumberformat}[1]{\glshypernumber{#1}}%
}
\newcommand{\delimN}{, }
\newcommand{\delimR}{--}
\newcommand*{\glossarypreamble}{%
  \csuse{@glossarypreamble@\currentglossary}%
}
\newcommand{\setglossarypreamble}[2][\glsdefaulttype]{%
  \ifglossaryexists*{#1}%
  {\csgdef{@glossarypreamble@#1}{#2}}%
  {\GlossariesWarning{Glossary `#1' is not defined}}%
}
\newcommand*{\glossarypostamble}{}
\newcommand*{\glossarysection}[2][\@gls@title]{%
  \def\@gls@title{#2}%
  \ifcsundef{phantomsection}%
  {%
    \@glossarysection{#1}{#2}%
  }%
  {%
    \@p@glossarysection{#1}{#2}%
  }%
  \glsglossarymark{\glossarytoctitle}%
}
\ifcsundef{glossarymark}%
{%
  \newcommand{\glsglossarymark}[1]{\glossarymark{#1}}
}%
{%
  \@ifclassloaded{memoir}
  {%
    \newcommand{\glsglossarymark}[1]{%
      \ifglsucmark
        \markboth{\memUChead{#1}}{\memUChead{#1}}%
      \else
        \markboth{#1}{#1}%
      \fi
    }
  }%
  {%
    \newcommand{\glsglossarymark}[1]{%
      \ifglsucmark
        \@mkboth{\mfirstucMakeUppercase{#1}}{\mfirstucMakeUppercase{#1}}%
      \else
        \@mkboth{#1}{#1}%
      \fi
    }
  }
}
\providecommand{\glossarymark}[1]{%
  \ifglsucmark
    \@mkboth{\mfirstucMakeUppercase{#1}}{\mfirstucMakeUppercase{#1}}%
  \else
    \@mkboth{#1}{#1}%
  \fi
}
\newcommand*{\setglossarysection}[1]{%
\setkeys{glossaries.sty}{section=#1}}
\newcommand*{\@glossarysection}[2]{%
  \ifdefempty\@@glossarysecstar
  {%
    \csname\@@glossarysec\endcsname[#1]{#2}%
  }%
  {%
    \csname\@@glossarysec\endcsname*{#2}%
    \@gls@toc{#1}{\@@glossarysec}%
  }%
  \@@glossaryseclabel
}
\newcommand*{\@p@glossarysection}[2]{%
  \glsclearpage
  \phantomsection
  \ifdefempty\@@glossarysecstar
  {%
    \csname\@@glossarysec\endcsname{#2}%
  }%
  {%
    \@gls@toc{#1}{\@@glossarysec}%
      \csname\@@glossarysec\endcsname*{#2}%
  }%
  \@@glossaryseclabel
}
\newcommand*{\gls@doclearpage}{%
  \ifthenelse{\equal{\@@glossarysec}{chapter}}%
  {%
    \ifcsundef{cleardoublepage}%
    {%
      \clearpage
    }%
    {%
      \ifcsdef{if@openright}%
      {%
         \if@openright
           \cleardoublepage
         \else
           \clearpage
         \fi
      }%
      {%
         \cleardoublepage
      }%
    }%
  }%
  {}%
}
\newcommand*{\glsclearpage}{\gls@doclearpage}
\newcommand*{\@gls@toc}[2]{%
  \ifglstoc
    \ifglsnumberline
      \addcontentsline{toc}{#2}{\protect\numberline{}#1}%
    \else
      \addcontentsline{toc}{#2}{#1}%
    \fi
  \fi
}
\newcommand*{\glsnoxindywarning}[1]{%
  \GlossariesWarning{Not in xindy mode --- ignoring \string#1}%
}
\newcommand*{\glsnomakeindexwarning}[1]{%
  \GlossariesWarning{Not in makeindex mode --- ignoring \string#1}%
}
\ifglsxindy
  \edef\@xdyattributes{\string"default\string"}%
\fi
\ifglsxindy
  \edef\@xdyattributelist{}%
\fi
\ifglsxindy
  \def\@xdylocref{}
\fi
\newcommand*{\@gls@ifinlist}[4]{%
  \def\@do@ifinlist##1,#1,##2\end@doifinlist{%
    \def\@gls@listsuffix{##2}%
    \ifx\@gls@listsuffix\@empty
       #4%
    \else
       #3%
    \fi
  }%
  \@do@ifinlist,#2,#1,\end@doifinlist
}
\ifglsxindy
  \newcommand*{\@xdycounters}{\glscounter}
  \newcommand*\GlsAddXdyCounters[1]{%
    \@for\@gls@ctr:=#1\do{%
       \edef\@do@addcounter{%
          \noexpand\@gls@ifinlist{\@gls@ctr}{\@xdycounters}{}%
          {%
             \noexpand\edef\noexpand\@xdycounters{\@xdycounters,%
               \noexpand\@gls@ctr}%
          }%
       }%
       \@do@addcounter
    }
  }
  \@onlypremakeg\GlsAddXdyCounters
\else
  \newcommand*\GlsAddXdyCounters[1]{%
    \glsnoxindywarning\GlsAddXdyAttribute
  }
\fi
\newcommand*\@disabled@glsaddxdycounters{%
   \PackageError{glossaries}{\string\GlsAddXdyCounters\space
   can't be used after \string\GlsAddXdyAttribute}{Move all
   occurrences of \string\GlsAddXdyCounters\space before the first
   instance of \string\GlsAddXdyAttribute}%
}
\ifglsxindy
  \newcommand*\@glsaddxdyattribute[2]{%
    \edef\@xdyattributes{\@xdyattributes ^^J \string"#1\string" ^^J
      \string"#2#1\string"}%
    \expandafter\toks@\expandafter{\@xdylocref}%
    \edef\@xdylocref{\the\toks@ ^^J%
      (markup-locref
      :open \string"\glstildechar n%
        \expandafter\string\csname glsX#2X#1\endcsname
        \string" ^^J
      :close \string"\string" ^^J
      :attr \string"#2#1\string")}%
    \expandafter\gdef\csname glsX#2X#1\endcsname##1##2{%
       \setentrycounter[##1]{#2}\csname #1\endcsname{##2}%
    }%
  }
  \newcommand*\GlsAddXdyAttribute[1]{%
    \ifx\@xdyattributelist\@empty
      \edef\@xdyattributelist{#1}%
    \else
      \edef\@xdyattributelist{\@xdyattributelist,#1}%
    \fi
    \@for\@this@counter:=\@xdycounters\do{%
      \protected@edef\gls@do@addxdyattribute{%
        \noexpand\@glsaddxdyattribute{#1}{\@this@counter}%
      }
      \gls@do@addxdyattribute
    }%
    \let\GlsAddXdyCounters\@disabled@glsaddxdycounters
  }
  \@onlypremakeg\GlsAddXdyAttribute
\else
  \newcommand*\GlsAddXdyAttribute[1]{%
    \glsnoxindywarning\GlsAddXdyAttribute}
\fi
\ifglsxindy
\newcommand*{\@gls@addpredefinedattributes}{%
  \GlsAddXdyAttribute{glsnumberformat}
  \GlsAddXdyAttribute{textrm}
  \GlsAddXdyAttribute{textsf}
  \GlsAddXdyAttribute{texttt}
  \GlsAddXdyAttribute{textbf}
  \GlsAddXdyAttribute{textmd}
  \GlsAddXdyAttribute{textit}
  \GlsAddXdyAttribute{textup}
  \GlsAddXdyAttribute{textsl}
  \GlsAddXdyAttribute{textsc}
  \GlsAddXdyAttribute{emph}
  \GlsAddXdyAttribute{glshypernumber}
  \GlsAddXdyAttribute{hyperrm}
  \GlsAddXdyAttribute{hypersf}
  \GlsAddXdyAttribute{hypertt}
  \GlsAddXdyAttribute{hyperbf}
  \GlsAddXdyAttribute{hypermd}
  \GlsAddXdyAttribute{hyperit}
  \GlsAddXdyAttribute{hyperup}
  \GlsAddXdyAttribute{hypersl}
  \GlsAddXdyAttribute{hypersc}
  \GlsAddXdyAttribute{hyperemph}
  \GlsAddXdyAttribute{glsignore}
}
\else
  \let\@gls@addpredefinedattributes\relax
\fi
\def\@xdyuseralphabets{}
\ifglsxindy
  \newcommand*{\GlsAddXdyAlphabet}[2]{%
  \edef\@xdyuseralphabets{%
    \@xdyuseralphabets ^^J
    (define-alphabet "#1" (#2))}}
\else
  \newcommand*{\GlsAddXdyAlphabet}[2]{%
     \glsnoxindywarning\GlsAddXdyAlphabet}
\fi
\ifglsxindy
  \newcommand*{\@gls@xdy@locationlist}{%
     roman-page-numbers,%
     Roman-page-numbers,%
     arabic-page-numbers,%
     alpha-page-numbers,%
     Alpha-page-numbers,%
     Appendix-page-numbers,%
     arabic-section-numbers%
  }
  \protected@edef\@gls@roman{\@roman{0\string"
      \string"roman-numbers-lowercase\string" :sep \string"}}%
  \@onelevel@sanitize\@gls@roman
  \edef\@tmp{\string" \string"roman-numbers-lowercase\string"
       :sep \string"}%
  \@onelevel@sanitize\@tmp
  \ifx\@tmp\@gls@roman
    \expandafter
      \edef\csname @gls@xdy@Lclass@roman-page-numbers\endcsname{%
        \string"roman-numbers-lowercase\string"%
      }%
  \else
     \expandafter
      \edef\csname @gls@xdy@Lclass@roman-page-numbers\endcsname{
        :sep \string"\@gls@roman\string"%
      }%
  \fi
  \expandafter\def\csname @gls@xdy@Lclass@Roman-page-numbers\endcsname{%
    \string"roman-numbers-uppercase\string"%
  }%
  \expandafter\def\csname @gls@xdy@Lclass@arabic-page-numbers\endcsname{%
    \string"arabic-numbers\string"%
  }%
  \expandafter\def\csname @gls@xdy@Lclass@alpha-page-numbers\endcsname{%
    \string"alpha\string"%
  }%
  \expandafter\def\csname @gls@xdy@Lclass@Alpha-page-numbers\endcsname{%
    \string"ALPHA\string"%
  }%
  \expandafter\def\csname @gls@xdy@Lclass@Appendix-page-numbers\endcsname{%
    \string"ALPHA\string"
    :sep \string"\@glsAlphacompositor\string"
    \string"arabic-numbers\string"%
  }
  \expandafter\def\csname @gls@xdy@Lclass@arabic-section-numbers\endcsname{%
    \string"arabic-numbers\string"
     :sep \string"\glscompositor\string"
    \string"arabic-numbers\string"%
  }%
  \def\@xdyuserlocationdefs{}
  \def\@xdyuserlocationnames{}
\fi
\ifglsxindy
 \newcommand\@xdycrossrefhook{}
\fi
\ifglsxindy
   \newcommand*{\GlsAddXdyLocation}[3][]{%
     \def\@gls@tmp{#1}%
     \ifx\@gls@tmp\@empty
       \edef\@xdyuserlocationdefs{%
          \@xdyuserlocationdefs ^^J%
          (define-location-class \string"#2\string"^^J\space\space
          \space(:sep \string"{}\glsopenbrace\string" #3
                 :sep \string"\glsclosebrace\string"))
       }%
     \else
       \edef\@xdyuserlocationdefs{%
          \@xdyuserlocationdefs ^^J%
          (define-location-class \string"#2\string"^^J\space\space
          \space(:sep "\glsopenbrace"
                 #1
                 :sep "\glsclosebrace\glsopenbrace" #3
                 :sep "\glsclosebrace"))
       }%
     \fi
     \edef\@xdyuserlocationnames{%
        \@xdyuserlocationnames^^J\space\space\space
        \string"#2\string"}%
   }
  \@onlypremakeg\GlsAddXdyLocation
\else
   \newcommand*{\GlsAddXdyLocation}[2]{%
     \glsnoxindywarning\GlsAddXdyLocation}
\fi
\ifglsxindy
  \def\@xdylocationclassorder{^^J\space\space\space
    \string"roman-page-numbers\string"^^J\space\space\space
    \string"arabic-page-numbers\string"^^J\space\space\space
    \string"arabic-section-numbers\string"^^J\space\space\space
    \string"alpha-page-numbers\string"^^J\space\space\space
    \string"Roman-page-numbers\string"^^J\space\space\space
    \string"Alpha-page-numbers\string"^^J\space\space\space
    \string"Appendix-page-numbers\string"
    \@xdyuserlocationnames^^J\space\space\space
    \string"see\string"
   }
\fi
\ifglsxindy
  \newcommand*\GlsSetXdyLocationClassOrder[1]{%
    \def\@xdylocationclassorder{#1}}
\else
  \newcommand*\GlsSetXdyLocationClassOrder[1]{%
    \glsnoxindywarning\GlsSetXdyLocationClassOrder}
\fi
\ifglsxindy
  \def\@xdysortrules{}
\fi
\ifglsxindy
  \newcommand*\GlsAddSortRule[2]{%
    \expandafter\toks@\expandafter{\@xdysortrules}%
    \protected@edef\@xdysortrules{\the\toks@ ^^J
     (sort-rule \string"#1\string" \string"#2\string")}%
  }
\else
  \newcommand*\GlsAddSortRule[2]{%
    \glsnoxindywarning\GlsAddSortRule}
\fi
\ifglsxindy
  \def\@xdyrequiredstyles{tex}
\fi
\ifglsxindy
  \newcommand*\GlsAddXdyStyle[1]{%
    \edef\@xdyrequiredstyles{\@xdyrequiredstyles,#1}}%
\else
  \newcommand*\GlsAddXdyStyle[1]{%
    \glsnoxindywarning\GlsAddXdyStyle}
\fi
\ifglsxindy
  \newcommand*\GlsSetXdyStyles[1]{%
    \edef\@xdyrequiredstyles{#1}}
\else
  \newcommand*\GlsSetXdyStyles[1]{%
    \glsnoxindywarning\GlsSetXdyStyles}
\fi
\newcommand*{\findrootlanguage}{}
\def\@xdylanguage#1#2{}
\ifglsxindy
  \newcommand*\GlsSetXdyLanguage[2][\glsdefaulttype]{%
  \ifglossaryexists{#1}{%
    \expandafter\def\csname @xdy@#1@language\endcsname{#2}%
  }{%
    \PackageError{glossaries}{Can't set language type for
    glossary type `#1' --- no such glossary}{%
    You have specified a glossary type that doesn't exist}}}
\else
  \newcommand*\GlsSetXdyLanguage[2][]{%
    \glsnoxindywarning\GlsSetXdyLanguage}
\fi
\def\@gls@codepage#1#2{}
\ifglsxindy
  \newcommand*{\GlsSetXdyCodePage}[1]{%
    \renewcommand*{\gls@codepage}{#1}%
  }
  \AtBeginDocument{%
    \ifx\gls@codepage\@empty
      \@ifpackageloaded{fontspec}{\def\gls@codepage{utf8}}{}%
    \fi
  }
\else
  \newcommand*{\GlsSetXdyCodePage}[1]{%
    \glsnoxindywarning\GlsSetXdyCodePage}
\fi
\ifglsxindy
  \ifgls@xindy@glsnumbers
    \def\@xdylettergroups{(define-letter-group
       \string"glsnumbers\string"^^J\space\space\space
       :prefixes (\string"0\string" \string"1\string"
       \string"2\string" \string"3\string" \string"4\string"
       \string"5\string" \string"6\string" \string"7\string"
       \string"8\string" \string"9\string")^^J\space\space\space
       \@xdynumbergrouporder)}
  \else
    \def\@xdylettergroups{}
  \fi
\fi
  \newcommand*\GlsAddLetterGroup[2]{%
    \expandafter\toks@\expandafter{\@xdylettergroups}%
    \protected@edef\@xdylettergroups{\the\toks@^^J%
    (define-letter-group \string"#1\string"^^J\space\space\space#2)}%
  }%
\newcommand*{\forallglossaries}[3][\@glo@types]{%
  \@for#2:=#1\do{\ifx#2\@empty\else#3\fi}%
}

\newcommand*{\forallacronyms}[2]{%
  \@for#1:=\@glsacronymlists\do{\ifx#1\@empty\else#2\fi}%
}
\newcommand*{\forglsentries}[3][\glsdefaulttype]{%
  \edef\@@glo@list{\csname glolist@#1\endcsname}%
  \@for#2:=\@@glo@list\do
  {%
    \ifdefempty{#2}{}{#3}%
  }%
}
\newcommand*{\forallglsentries}[3][\@glo@types]{%
  \expandafter\forallglossaries\expandafter[#1]{\@@this@glo@}%
  {%
    \forglsentries[\@@this@glo@]{#2}{#3}%
  }%
}
\newcommand{\ifglossaryexists}{%
  \@ifstar\s@ifglossaryexists\@ifglossaryexists
}
\newcommand{\@ifglossaryexists}[3]{%
  \ifcsundef{@glotype@#1@out}{#3}{#2}%
}
\newcommand{\s@ifglossaryexists}[3]{%
  \ifcsundef{glolist@#1}{#3}{#2}%
}
\newcommand*{\glsdetoklabel}[1]{#1}
\newcommand{\ifglsentryexists}[3]{%
  \ifcsundef{glo@\glsdetoklabel{#1}@name}{#3}{#2}%
}
\newcommand*{\ifglsused}[3]{%
  \ifbool{glo@\glsdetoklabel{#1}@flag}{#2}{#3}%
}
\newcommand{\glsdoifexists}[2]{%
  \ifglsentryexists{#1}{#2}{%
    \PackageError{glossaries}{Glossary entry `\glsdetoklabel{#1}'
    has not been defined}{You need to define a glossary entry before you
    can use it.}}%
}
\newcommand{\glsdoifnoexists}[2]{%
  \ifglsentryexists{#1}{%
    \PackageError{glossaries}{Glossary entry `\glsdetoklabel{#1}' has already
    been defined}{}}{#2}%
}
\newcommand{\glsdoifexistsorwarn}[2]{%
  \ifglsentryexists{#1}{#2}{%
    \GlossariesWarning{Glossary entry `\glsdetoklabel{#1}'
      has not been defined}%
  }%
}
\newcommand{\glsdoifexistsordo}[3]{%
  \ifglsentryexists{#1}{#2}{%
    \PackageError{glossaries}{Glossary entry `\glsdetoklabel{#1}'
    has not been defined}{You need to define a glossary entry before you
    can use it.}%
    #3%
  }%
}
\newcommand{\doifglossarynoexistsordo}[3]{%
  \ifglossaryexists*{#1}%
  {%
    \PackageError{glossaries}{Glossary type `#1' already exists}{}%
    #3%
  }%
  {#2}%
}
\newrobustcmd{\ifglshaschildren}[3]{%
  \glsdoifexists{#1}%
  {%
     \def\do@glshaschildren{#3}%
     \edef\@gls@thislabel{\glsdetoklabel{#1}}%
     \expandafter\forglsentries\expandafter
       [\csname glo@\@gls@thislabel @type\endcsname]
     {\glo@label}%
     {%
       \letcs\glo@parent{glo@\glo@label @parent}%
       \ifdefequal\@gls@thislabel\glo@parent
       {%
         \def\do@glshaschildren{#2}%
         \@endfortrue
       }%
       {}%
     }%
     \do@glshaschildren
  }%
}
\newcommand{\ifglshasparent}[3]{%
  \glsdoifexists{#1}%
  {%
    \ifcsempty{glo@\glsdetoklabel{#1}@parent}{#3}{#2}%
  }%
}
\newcommand*{\ifglshasdesc}[3]{%
  \ifcsempty{glo@\glsdetoklabel{#1}@desc}%
  {#3}%
  {#2}%
}
\newcommand*{\ifglsdescsuppressed}[3]{%
  \ifcsequal{glo@\glsdetoklabel{#1}@desc}{@no@post@desc}%
  {#2}%
  {#3}%
}
\newrobustcmd*{\ifglshassymbol}[3]{%
  \letcs{\@glo@symbol}{glo@\glsdetoklabel{#1}@symbol}%
  \ifdefempty\@glo@symbol
  {#3}%
  {%
    \ifdefequal\@glo@symbol\@gls@default@value
    {#3}%
    {#2}%
  }%
}
\newrobustcmd*{\ifglshaslong}[3]{%
  \letcs{\@glo@long}{glo@\glsdetoklabel{#1}@long}%
  \ifdefempty\@glo@long
  {#3}%
  {%
    \ifdefequal\@glo@long\@gls@default@value
    {#3}%
    {#2}%
  }%
}
\newrobustcmd*{\ifglshasshort}[3]{%
  \letcs{\@glo@short}{glo@\glsdetoklabel{#1}@short}%
  \ifdefempty\@glo@short
  {#3}%
  {%
    \ifdefequal\@glo@short\@gls@default@value
    {#3}%
    {#2}%
  }%
}
\newrobustcmd*{\ifglshasfield}[4]{%
  \glsdoifexists{#2}%
  {%
    \letcs{\@glo@thisvalue}{glo@\glsdetoklabel{#2}@#1}%
    \ifdef\@glo@thisvalue
    {%
      \ifdefempty\@glo@thisvalue
      {%
        #4%
      }%
      {%
        \ifdefequal\@glo@thisvalue\@gls@default@value
        {%
          #4%
        }%
        {%
         \let\glscurrentfieldvalue\@glo@thisvalue
         #3%
        }%
      }%
    }%
    {%
       \@gls@fetchfield{\@gls@thisfield}{#1}%
       \ifdef\@gls@thisfield
       {%
         \letcs{\@glo@thisvalue}{glo@\glsdetoklabel{#2}@\@gls@thisfield}%
         \ifdefempty\@glo@thisvalue
         {%
           #4%
         }%
         {%
           \ifdefequal\@glo@thisvalue\@gls@default@value
           {%
             #4%
           }%
           {%
            \let\glscurrentfieldvalue\@glo@thisvalue
            #3%
           }%
         }%
       }%
       {%
         \GlossariesWarning{Unknown entry field `#1'}%
         #4%
       }%
    }%
  }%
}
\newcommand*{\glscurrentfieldvalue}{}
\newcommand*{\@glo@types}{,}
\newcommand*\@gls@provide@newglossary{%
  \protected@write\@auxout{}{\string\providecommand\string\@newglossary[4]{}}%
  \let\@gls@provide@newglossary\relax
}
\newcommand*{\defglsentryfmt}[2][\glsdefaulttype]{%
  \csgdef{gls@#1@entryfmt}{#2}%
}
\newcommand*{\gls@doentryfmt}[1]{\csuse{gls@#1@entryfmt}}
\newcommand*{\@gls@forbidtexext}[1]{%
 \ifboolexpr{test {\ifdefstring{#1}{tex}}
          or test {\ifdefstring{#1}{TEX}}}
 {%
   \def#1{nottex}%
   \PackageError{glossaries}%
    {Forbidden `.tex' extension replaced with `.nottex'}%
    {I'm sorry, I can't allow you to do something so reckless.\MessageBreak
     Don't use `.tex' as an extension for a temporary file.}%
 }%
 {%
 }%
}
\newcommand*{\gls@gobbleopt}{\new@ifnextchar[{\@gls@gobbleopt}{}}
\def\@gls@gobbleopt[#1]{}
\newcommand*{\newglossary}{\@ifstar\s@newglossary\ns@newglossary}
\newcommand*{\s@newglossary}[2]{%
 \ns@newglossary[#1-glg]{#1}{#1-gls}{#1-glo}{#2}%
}
\newcommand*{\ns@newglossary}[5][glg]{%
 \doifglossarynoexistsordo{#2}%
 {%
  \ifundef\glsdefaulttype
  {%
    \gdef\glsdefaulttype{#2}%
  }{}%
  \toks@{#2}\edef\@glo@types{\@glo@types\the\toks@,}%
  \expandafter\gdef\csname glolist@#2\endcsname{,}%
  \expandafter\edef\csname @glotype@#2@log\endcsname{#1}%
  \expandafter\edef\csname @glotype@#2@in\endcsname{#3}%
  \expandafter\edef\csname @glotype@#2@out\endcsname{#4}%
  \expandafter\@gls@forbidtexext\csname @glotype@#2@log\endcsname
  \expandafter\@gls@forbidtexext\csname @glotype@#2@in\endcsname
  \expandafter\@gls@forbidtexext\csname @glotype@#2@out\endcsname
  \expandafter\def\csname @glotype@#2@title\endcsname{#5}%
  \@gls@provide@newglossary
  \protected@write\@auxout{}{\string\@newglossary{#2}{#1}{#3}{#4}}%
  \ifcsundef{gls@#2@entryfmt}%
  {%
    \defglsentryfmt[#2]{\glsentryfmt}%
  }%
  {}%
  \@gls@defsortcount{#2}%
  \@ifnextchar[{\@gls@setcounter{#2}}%
    {\@gls@setcounter{#2}[\glscounter]}%
 }%
 {%
   \gls@gobbleopt
 }%
}
\newcommand*{\altnewglossary}[3]{%
  \newglossary[#2-glg]{#1}{#2-gls}{#2-glo}{#3}%
}
\@onlypreamble{\newglossary}
\@onlypremakeg\newglossary
\newcommand*{\@newglossary}[4]{}
\def\@gls@setcounter#1[#2]{%
  \expandafter\def\csname @glotype@#1@counter\endcsname{#2}%
  \ifglsxindy
    \GlsAddXdyCounters{#2}%
  \fi
}
\newcommand*{\@gls@getcounter}[1]{%
 \csname @glotype@#1@counter\endcsname
}
\glsdefmain
\@gls@do@acronymsdef
\@gls@do@symbolsdef
\@gls@do@numbersdef
\@gls@do@indexdef
\newcommand*{\newignoredglossary}[1]{%
  \ifdefempty\@ignored@glossaries
  {%
    \edef\@ignored@glossaries{#1}%
  }%
  {%
    \eappto\@ignored@glossaries{,#1}%
  }%
  \csgdef{glolist@#1}{,}%
  \ifcsundef{gls@#1@entryfmt}%
  {%
    \defglsentryfmt[#1]{\glsentryfmt}%
  }%
  {}%
  \ifdefempty\@gls@nohyperlist
  {%
     \renewcommand*{\@gls@nohyperlist}{#1}%
  }%
  {%
     \eappto\@gls@nohyperlist{,#1}%
  }%
}
\newcommand*{\@ignored@glossaries}{}
\newcommand*{\ifignoredglossary}[3]{%
  \edef\@gls@igtype{#1}%
  \expandafter\DTLifinlist\expandafter
    {\@gls@igtype}{\@ignored@glossaries}{#2}{#3}%
}
\define@key{glossentry}{name}{%
\def\@glo@name{#1}%
}
\define@key{glossentry}{description}{%
\def\@glo@desc{#1}%
}
\define@key{glossentry}{descriptionplural}{%
\def\@glo@descplural{#1}%
}
\define@key{glossentry}{sort}{%
\def\@glo@sort{#1}}
\define@key{glossentry}{text}{%
\def\@glo@text{#1}%
}
\define@key{glossentry}{plural}{%
\def\@glo@plural{#1}%
}
\define@key{glossentry}{first}{%
\def\@glo@first{#1}%
}
\define@key{glossentry}{firstplural}{%
\def\@glo@firstplural{#1}%
}
\newcommand*{\@gls@default@value}{\relax}
\define@key{glossentry}{symbol}{%
\def\@glo@symbol{#1}%
}
\define@key{glossentry}{symbolplural}{%
\def\@glo@symbolplural{#1}%
}
\define@key{glossentry}{type}{%
\def\@glo@type{#1}}
\define@key{glossentry}{counter}{%
  \ifcsundef{c@#1}%
  {%
    \PackageError{glossaries}%
    {There is no counter called `#1'}%
    {%
      The counter key should have the name of a valid counter
      as its value%
    }%
  }%
  {%
    \def\@glo@counter{#1}%
  }%
}
\define@key{glossentry}{see}{%
  \gls@set@xr@key{see}{\@glo@see}{#1}%
}
\newcommand*{\gls@set@xr@key}[3]{%
  \renewcommand*{\gls@xr@key}{#1}%
  \gls@checkseeallowed
  \def#2{#3}%
  \@glo@seeautonumberlist
}
\newcommand*{\gls@xr@key}{see}
\newcommand*{\gls@checkseeallowed}{%
 \@gls@see@noindex
}
\newcommand*{\gls@checkseeallowed@preambleonly}{%
  \GlossariesWarning{glossaries}%
  {`\gls@xr@key' key doesn't have any effect when used in the document
   environment. Move the definition to the preamble
    after \string\makeglossaries\space
   or \string\makenoidxglossaries}%
}
\define@key{glossentry}{parent}{%
\def\@glo@parent{#1}}
\define@choicekey{glossentry}{nonumberlist}%
 [\gls@nonumberlist@val\gls@nonumberlist@nr]{true,false}[true]%
{%
  \ifcase\gls@nonumberlist@nr\relax
    \def\@glo@prefix{\glsnonextpages}%
    \@gls@savenonumberlist{true}%
  \else
    \def\@glo@prefix{\glsnextpages}%
    \@gls@savenonumberlist{false}%
  \fi
}
\newcommand*{\@gls@savenonumberlist}[1]{}
\newcommand*{\@gls@initnonumberlist}{}%
\newcommand*{\@gls@storenonumberlist}[1]{}
\newcommand*{\@gls@enablesavenonumberlist}{%
  \renewcommand*{\@gls@initnonumberlist}{%
    \undef\@glo@nonumberlist
  }%
  \renewcommand*{\@gls@savenonumberlist}[1]{%
    \def\@glo@nonumberlist{##1}%
  }%
  \renewcommand*{\@gls@storenonumberlist}[1]{%
    \ifdef\@glo@nonumberlist
    {%
      \cslet{glo@\glsdetoklabel{##1}@nonumberlist}{\@glo@nonumberlist}%
    }%
    {}%
  }%
  \appto\@gls@keymap{,{nonumberlist}{nonumberlist}}%
}
\define@key{glossentry}{user1}{%
  \def\@glo@useri{#1}%
}
\define@key{glossentry}{user2}{%
  \def\@glo@userii{#1}%
}
\define@key{glossentry}{user3}{%
  \def\@glo@useriii{#1}%
}
\define@key{glossentry}{user4}{%
  \def\@glo@useriv{#1}%
}
\define@key{glossentry}{user5}{%
  \def\@glo@userv{#1}%
}
\define@key{glossentry}{user6}{%
  \def\@glo@uservi{#1}%
}
\define@key{glossentry}{short}{%
  \def\@glo@short{#1}%
}
\define@key{glossentry}{shortplural}{%
  \def\@glo@shortpl{#1}%
}
\define@key{glossentry}{long}{%
  \def\@glo@long{#1}%
}
\define@key{glossentry}{longplural}{%
  \def\@glo@longpl{#1}%
}
\newcommand*{\@glsnoname}{%
  \PackageError{glossaries}{name key required in
  \string\newglossaryentry\space for entry `\@glo@label'}{You
  haven't specified the entry name}}
\newcommand*\@glsnodesc{%
  \PackageError{glossaries}
  {%
    description key required in \string\newglossaryentry\space
    for entry `\@glo@label'%
  }%
  {%
    You haven't specified the entry description%
  }%
}%
\newcommand*{\@glsdefaultplural}{}
\newcommand*{\@gls@missingnumberlist}[1]{%
  ??%
  \ifglssavenumberlist
    \GlossariesWarning{Missing number list for entry `#1'.
     Maybe makeglossaries + rerun required}%
  \else
    \PackageError{glossaries}%
    {Package option `savenumberlist=true' required}%
    {%
      You must use the `savenumberlist' package option
      to reference location lists.%
    }%
  \fi
}
\newcommand*{\@glsdefaultsort}{\@glo@name}
\newcount\gls@level
\newcommand{\@@gls@noexpand@field}[3]{%
 \expandafter\global\expandafter
    \let\csname glo@#1@#2\endcsname#3%
}
\newcommand{\@gls@noexpand@fields}[4]{%
  \ifcsdef{gls@assign@#3@field}
  {%
     \ifdefequal{#4}{\@gls@default@value}%
     {%
       \edef\@gls@value{\expandonce{#1}}%
       \csuse{gls@assign@#3@field}{#2}{\@gls@value}%
     }%
     {%
       \csuse{gls@assign@#3@field}{#2}{#4}%
     }%
  }%
  {%
    \ifdefequal{#4}{\@gls@default@value}%
    {%
       \edef\@gls@value{\expandonce{#1}}%
       \@@gls@noexpand@field{#2}{#3}{\@gls@value}%
    }%
    {%
      \@@gls@noexpand@field{#2}{#3}{#4}%
    }%
  }%
}
\newcommand{\@@gls@expand@field}[3]{%
 \expandafter
   \protected@xdef\csname glo@#1@#2\endcsname{#3}%
}
\newcommand{\@gls@expand@fields}[4]{%
  \ifcsdef{gls@assign@#3@field}
  {%
     \ifdefequal{#4}{\@gls@default@value}%
     {%
       \edef\@gls@value{\expandonce{#1}}%
       \csuse{gls@assign@#3@field}{#2}{\@gls@value}%
     }%
     {%
       \expandafter\@gls@startswithexpandonce#4\relax\relax\gls@endcheck
       {%
         \@@gls@expand@field{#2}{#3}{#4}%
       }%
       {%
         \csuse{gls@assign@#3@field}{#2}{#4}%
       }%
     }%
  }%
  {%
    \ifdefequal{#4}{\@gls@default@value}%
    {%
      \@@gls@expand@field{#2}{#3}{#1}%
    }%
    {%
      \@@gls@expand@field{#2}{#3}{#4}%
    }%
  }%
}
\def\@gls@expandonce{\expandonce}
\def\@gls@startswithexpandonce#1#2\gls@endcheck#3#4{%
  \def\@gls@tmp{#1}%
  \ifdefequal{\@gls@expandonce}{\@gls@tmp}{#3}{#4}%
}
\let\gls@assign@field\@gls@expand@fields
\newcommand*{\glsexpandfields}{%
  \let\gls@assign@field\@gls@expand@fields
}
\newcommand*{\glsnoexpandfields}{%
  \let\gls@assign@field\@gls@noexpand@fields
}
\newrobustcmd{\newglossaryentry}[2]{%
  \glsdoifnoexists{#1}%
  {%
     \gls@defglossaryentry{#1}{#2}%
  }%
}
\newcommand*{\gls@defdocnewglossaryentry}{%
  \let\gls@checkseeallowed\gls@checkseeallowed@preambleonly
  \let\newglossaryentry\new@glossaryentry
}
\newrobustcmd{\provideglossaryentry}[2]{%
  \ifglsentryexists{#1}%
  {}%
  {%
    \gls@defglossaryentry{#1}{#2}%
  }%
}
\@onlypreamble{\provideglossaryentry}
\newrobustcmd{\new@glossaryentry}[2]{%
  \ifundef\@gls@deffile
  {%
     \global\newwrite\@gls@deffile
     \immediate\openout\@gls@deffile=\jobname.glsdefs
  }%
  {}%
  \ifglsentryexists{#1}{}%
  {%
     \gls@defglossaryentry{#1}{#2}%
  }%
  \@gls@writedef{#1}%
}
\AtBeginDocument{\gls@begindocdefs}
\AtEndDocument{\ifdef\@gls@deffile{\closeout\@gls@deffile}{}}
\newcommand*{\gls@begindocdefs}{%
  \@gls@enablesavenonumberlist
  \edef\@gls@restoreat{\noexpand\catcode`\noexpand\@=\number\catcode`\@\relax}%
  \makeatletter
  \InputIfFileExists{\jobname.glsdefs}{}{}%
  \@gls@restoreat
  \undef\@gls@restoreat
  \gls@defdocnewglossaryentry
}
\newcommand*{\@gls@writedef}[1]{%
  \immediate\write\@gls@deffile
  {%
    \string\ifglsentryexists{#1}{}\glspercentchar^^J%
    \expandafter\@gobble\string\{\glspercentchar^^J%
      \string\gls@defglossaryentry{\glsdetoklabel{#1}}\glspercentchar^^J%
      \expandafter\@gobble\string\{\glspercentchar%
  }%
  \@for\@gls@map:=\@gls@keymap\do
  {%
    \letcs\glo@value{glo@\glsdetoklabel{#1}@\expandafter\@secondoftwo\@gls@map}%
    \ifdef\glo@value
    {%
      \@onelevel@sanitize\glo@value
      \immediate\write\@gls@deffile
      {%
        \expandafter\@firstoftwo\@gls@map
          =\expandafter\@gobble\string\{\glo@value\expandafter\@gobble\string\},%
          \glspercentchar
      }%
    }%
    {}%
  }%
  \glswritedefhook
  \immediate\write\@gls@deffile
  {%
           \glspercentchar^^J%
      \expandafter\@gobble\string\}\glspercentchar^^J%
    \expandafter\@gobble\string\}\glspercentchar%
  }%
}
\newcommand*{\@gls@keymap}{%
  {name}{name},%
  {sort}{sortvalue},% unescaped sort value
  {type}{type},%
  {first}{first},%
  {firstplural}{firstpl},%
  {text}{text},%
  {plural}{plural},%
  {description}{desc},%
  {descriptionplural}{descplural},%
  {symbol}{symbol},%
  {symbolplural}{symbolplural},%
  {user1}{useri},%
  {user2}{userii},%
  {user3}{useriii},%
  {user4}{useriv},%
  {user5}{userv},%
  {user6}{uservi},%
  {long}{long},%
  {longplural}{longpl},%
  {short}{short},%
  {shortplural}{shortpl},%
  {counter}{counter},%
  {parent}{parent}%
}
\newcommand*{\@gls@fetchfield}[2]{%
  \edef\@gls@thisval{#2}%
  \@for\@gls@map:=\@gls@keymap\do{%
   \edef\@this@key{\expandafter\@firstoftwo\@gls@map}%
   \ifdefequal{\@this@key}{\@gls@thisval}%
   {%
     \edef#1{\expandafter\@secondoftwo\@gls@map}%
     \@endfortrue
   }%
   {}%
 }%
}
\newcommand*{\glsaddstoragekey}{\@ifstar\@sglsaddstoragekey\@glsaddstoragekey}
\newcommand*{\@sglsaddstoragekey}[1]{%
  \key@ifundefined{glossentry}{#1}%
  {%
    \expandafter\newcommand\expandafter*\expandafter
     {\csname gls@assign@#1@field\endcsname}[2]{%
       \@@gls@expand@field{##1}{#1}{##2}%
     }%
  }%
  {}%
  \@glsaddstoragekey{#1}%
}
\newcommand*{\@glsaddstoragekey}[3]{%
  \key@ifundefined{glossentry}{#1}%
  {%
    \define@key{glossentry}{#1}{\csdef{@glo@#1}{##1}}%
    \appto\@gls@keymap{,{#1}{#1}}%
    \appto\@newglossaryentryprehook{\csdef{@glo@#1}{#2}}%
    \appto\@newglossaryentryposthook{%
      \letcs{\@glo@tmp}{@glo@#1}%
      \gls@assign@field{#2}{\@glo@label}{#1}{\@glo@tmp}%
    }%
    \newcommand*{#3}[1]{\@gls@entry@field{##1}{#1}}%
  }%
  {%
    \PackageError{glossaries}{Key `#1' already exists}{}%
  }%
}
\newcommand*{\glsaddkey}{\@ifstar\@sglsaddkey\@glsaddkey}
\newcommand*{\@sglsaddkey}[1]{%
  \key@ifundefined{glossentry}{#1}%
  {%
    \expandafter\newcommand\expandafter*\expandafter
     {\csname gls@assign@#1@field\endcsname}[2]{%
       \@@gls@expand@field{##1}{#1}{##2}%
     }%
  }%
  {}%
  \@glsaddkey{#1}%
}
\newcommand*{\@glsaddkey}[7]{%
  \key@ifundefined{glossentry}{#1}%
  {%
    \define@key{glossentry}{#1}{\csdef{@glo@#1}{##1}}%
    \appto\@gls@keymap{,{#1}{#1}}%
    \appto\@newglossaryentryprehook{\csdef{@glo@#1}{#2}}%
    \appto\@newglossaryentryposthook{%
      \letcs{\@glo@tmp}{@glo@#1}%
      \gls@assign@field{#2}{\@glo@label}{#1}{\@glo@tmp}%
    }%
    \newcommand*{#3}[1]{\@gls@entry@field{##1}{#1}}%
    \newcommand*{#4}[1]{\@Gls@entry@field{##1}{#1}}%
    \ifcsdef{@gls@user@#1@}%
    {%
       \PackageError{glossaries}%
       {Can't define `\string#5' as helper command
        `\expandafter\string\csname @gls@user@#1@\endcsname' already exists}%
       {}%
    }%
    {%
      \expandafter\newcommand\expandafter*\expandafter
        {\csname @gls@user@#1\endcsname}[2][]{%
          \new@ifnextchar[%
            {\csuse{@gls@user@#1@}{##1}{##2}}%
            {\csuse{@gls@user@#1@}{##1}{##2}[]}}%
      \csdef{@gls@user@#1@}##1##2[##3]{%
        \@gls@field@link{##1}{##2}{#3{##2}##3}%
      }%
      \newrobustcmd*{#5}{%
        \expandafter\@gls@hyp@opt\csname @gls@user@#1\endcsname}%
    }%
    \ifcsdef{@Gls@user@#1@}%
    {%
       \PackageError{glossaries}%
       {Can't define `\string#6' as helper command
        `\expandafter\string\csname @Gls@user@#1@\endcsname' already exists}%
       {}%
    }%
    {%
      \expandafter\newcommand\expandafter*\expandafter
        {\csname @Gls@user@#1\endcsname}[2][]{%
          \new@ifnextchar[%
            {\csuse{@Gls@user@#1@}{##1}{##2}}%
            {\csuse{@Gls@user@#1@}{##1}{##2}[]}}%
      \csdef{@Gls@user@#1@}##1##2[##3]{%
        \@gls@field@link{##1}{##2}{#4{##2}##3}%
      }%
      \newrobustcmd*{#6}{%
        \expandafter\@gls@hyp@opt\csname @Gls@user@#1\endcsname}%
    }%
    \ifcsdef{@GLS@user@#1@}%
    {%
       \PackageError{glossaries}%
       {Can't define `\string#7' as helper command
        `\expandafter\string\csname @GLS@user@#1@\endcsname' already exists}%
       {}%
    }%
    {%
      \expandafter\newcommand\expandafter*\expandafter
        {\csname @GLS@user@#1\endcsname}[2][]{%
          \new@ifnextchar[%
            {\csuse{@GLS@user@#1@}{##1}{##2}}%
            {\csuse{@GLS@user@#1@}{##1}{##2}[]}}%
      \csdef{@GLS@user@#1@}##1##2[##3]{%
        \@gls@field@link{##1}{##2}{\mfirstucMakeUppercase{#3{##2}##3}}%
      }%
      \newrobustcmd*{#7}{%
        \expandafter\@gls@hyp@opt\csname @GLS@user@#1\endcsname}%
    }%
  }%
  {%
    \PackageError{glossaries}{Key `#1' already exists}{}%
  }%
}
\newcommand{\glsfieldxdef}[3]{%
 \glsdoifexists{#1}%
 {%
   \edef\@glo@label{\glsdetoklabel{#1}}%
   \ifcsdef{glo@\@glo@label @#2}%
   {%
      \protected@csxdef{glo@\@glo@label @#2}{#3}%
   }%
   {%
      \PackageError{glossaries}{Key `#2' doesn't exist}{}%
   }%
 }%
}
\newcommand{\glsfieldedef}[3]{%
 \glsdoifexists{#1}%
 {%
   \edef\@glo@label{\glsdetoklabel{#1}}%
   \ifcsdef{glo@\@glo@label @#2}%
   {%
      \protected@csedef{glo@\@glo@label @#2}{#3}%
   }%
   {%
      \PackageError{glossaries}{Key `#2' doesn't exist}{}%
   }%
 }%
}
\newcommand{\glsfieldgdef}[3]{%
 \glsdoifexists{#1}%
 {%
   \edef\@glo@label{\glsdetoklabel{#1}}%
   \ifcsdef{glo@\@glo@label @#2}%
   {%
      \expandafter\gdef\csname glo@\@glo@label @#2\endcsname{#3}%
   }%
   {%
      \PackageError{glossaries}{Key `#2' doesn't exist}{}%
   }%
 }%
}
\newcommand{\glsfielddef}[3]{%
 \glsdoifexists{#1}%
 {%
   \edef\@glo@label{\glsdetoklabel{#1}}%
   \ifcsdef{glo@\@glo@label @#2}%
   {%
      \expandafter\def\csname glo@\@glo@label @#2\endcsname{#3}%
   }%
   {%
      \PackageError{glossaries}{Key `#2' doesn't exist}{}%
   }%
 }%
}
\newcommand{\glsfieldfetch}[3]{%
 \glsdoifexists{#1}%
 {%
   \edef\@glo@label{\glsdetoklabel{#1}}%
   \ifcsdef{glo@\@glo@label @#2}%
   {%
      \letcs#3{glo@\@glo@label @#2}%
   }%
   {%
      \PackageError{glossaries}{Key `#2' doesn't exist}{}%
   }%
 }%
}
\newcommand{\ifglsfieldeq}[5]{%
 \glsdoifexists{#1}%
 {%
   \edef\@glo@label{\glsdetoklabel{#1}}%
   \ifcsdef{glo@\@glo@label @#2}%
   {%
      \ifcsstring{glo@\@glo@label @#2}{#3}{#4}{#5}%
   }%
   {%
      \PackageError{glossaries}{Key `#2' doesn't exist}{}%
   }%
 }%
}
\newcommand{\ifglsfielddefeq}[5]{%
 \glsdoifexists{#1}%
 {%
   \edef\@glo@label{\glsdetoklabel{#1}}%
   \ifcsdef{glo@\@glo@label @#2}%
   {%
      \expandafter\ifdefstrequal
       \csname glo@\@glo@label @#2\endcsname{#3}{#4}{#5}%
   }%
   {%
      \PackageError{glossaries}{Key `#2' doesn't exist}{}%
   }%
 }%
}
\newcommand{\ifglsfieldcseq}[5]{%
 \glsdoifexists{#1}%
 {%
   \edef\@glo@label{\glsdetoklabel{#1}}%
   \ifcsdef{glo@\@glo@label @#2}%
   {%
      \ifcsstrequal{glo@\@glo@label @#2}{#3}{#4}{#5}%
   }%
   {%
      \PackageError{glossaries}{Key `#2' doesn't exist}{}%
   }%
 }%
}
\newcommand*{\glswritedefhook}{}
\newcommand*{\gls@assign@desc}[1]{%
  \gls@assign@field{}{#1}{desc}{\@glo@desc}%
  \gls@assign@field{\@glo@desc}{#1}{descplural}{\@glo@descplural}%
}
\newcommand{\longnewglossaryentry}[3]{%
  \glsdoifnoexists{#1}%
  {%
     \bgroup
       \let\@org@newglossaryentryprehook\@newglossaryentryprehook
       \long\def\@newglossaryentryprehook{%
         \long\def\@glo@desc{#3\leavevmode\unskip\nopostdesc}%
         \@org@newglossaryentryprehook
       }%
       \renewcommand*{\gls@assign@desc}[1]{%
          \global\cslet{glo@\glsdetoklabel{#1}@desc}{\@glo@desc}%
          \global\cslet{glo@\glsdetoklabel{#1}@descplural}{\@glo@desc}%
        }
       \gls@defglossaryentry{#1}{#2}%
     \egroup
  }
}
\@onlypreamble{\longnewglossaryentry}
\newcommand{\longprovideglossaryentry}[3]{%
  \ifglsentryexists{#1}{}%
  {\longnewglossaryentry{#1}{#2}{#3}}%
}
\@onlypreamble{\longprovideglossaryentry}
\newcommand{\gls@defglossaryentry}[2]{%
  \let\GlsSetQuote\gls@nosetquote
  \edef\@glo@label{\glsdetoklabel{#1}}%
  \let\glslabel\@glo@label
  \let\@glo@name\@glsnoname
  \let\@glo@desc\@glsnodesc
  \let\@glo@descplural\@gls@default@value
  \let\@glo@type\@gls@default@value
  \let\@glo@symbol\@gls@default@value
  \let\@glo@symbolplural\@gls@default@value
  \let\@glo@text\@gls@default@value
  \let\@glo@plural\@gls@default@value
  \let\@glo@first\@gls@default@value
  \let\@glo@firstplural\@gls@default@value
  \let\@glo@sort\@gls@default@value
  \let\@glo@counter\@gls@default@value
  \def\@glo@see{}%
  \def\@glo@parent{}%
  \def\@glo@prefix{}%
  \@gls@initnonumberlist
  \def\@glo@useri{}%
  \def\@glo@userii{}%
  \def\@glo@useriii{}%
  \def\@glo@useriv{}%
  \def\@glo@userv{}%
  \def\@glo@uservi{}%
  \def\@glo@short{}%
  \def\@glo@shortpl{}%
  \def\@glo@long{}%
  \def\@glo@longpl{}%
  \@newglossaryentryprehook
  \setkeys{glossentry}{#2}%
  \ifundef\glsdefaulttype
  {%
     \PackageError{glossaries}%
     {No default glossary type (have you used `nomain' by mistake?)}%
     {If you use package option `nomain' you must define
      a new glossary before you can define entries}%
  }%
  {}%
  \gls@assign@field{\glsdefaulttype}{\@glo@label}{type}{\@glo@type}%
  \edef\@glo@type{\glsentrytype{\@glo@label}}%
  \ifcsundef{glolist@\@glo@type}%
  {%
      \PackageError{glossaries}%
      {Glossary type `\@glo@type' has not been defined}%
      {You need to define a new glossary type, before making entries
       in it}%
  }%
  {%
    \ifignoredglossary\@glo@type
      {%
      \ifx\@glo@desc\@glsnodesc
        \let\@glo@desc\@empty
      \fi
    }%
    {%
    }%
    \protected@edef\@glolist@{\csname glolist@\@glo@type\endcsname}%
    \expandafter\xdef\csname glolist@\@glo@type\endcsname{%
      \@glolist@{\@glo@label},}%
  }%
  \gls@level=0\relax
  \ifx\@glo@parent\@empty
    \expandafter\gdef\csname glo@\@glo@label @parent\endcsname{}%
  \else
    \ifdefequal\@glo@label\@glo@parent%
    {%
      \PackageError{glossaries}{Entry `\@glo@label' can't be its own parent}{}%
      \def\@glo@parent{}%
      \expandafter\gdef\csname glo@\@glo@label @parent\endcsname{}%
    }%
    {%
      \ifglsentryexists{\@glo@parent}%
      {%
        \expandafter\xdef\csname glo@\@glo@label @parent\endcsname{%
           \@glo@parent}%
        \gls@level=\csname glo@\@glo@parent @level\endcsname\relax
        \advance\gls@level by 1\relax
        \ifx\@glo@name\@glsnoname
          \expandafter\let\expandafter\@glo@name
           \csname glo@\@glo@parent @name\endcsname
          \ifx\@glo@plural\@gls@default@value
            \expandafter\let\expandafter\@glo@plural
               \csname glo@\@glo@parent @plural\endcsname
          \fi
        \fi
      }%
      {%
        \PackageError{glossaries}%
        {%
          Invalid parent `\@glo@parent'
          for entry `\@glo@label' - parent doesn't exist%
        }%
        {%
          Parent entries must be defined before their children%
        }%
        \def\@glo@parent{}%
        \expandafter\gdef\csname glo@\@glo@label @parent\endcsname{}%
      }%
    }%
  \fi
  \expandafter\xdef\csname glo@\@glo@label @level\endcsname{\number\gls@level}%
  \gls@assign@field{\@glo@name}{\@glo@label}{sortvalue}{\@glo@sort}%
  \letcs\@glo@sort{glo@\@glo@label @sortvalue}%
  \gls@assign@field{\@glo@name}{\@glo@label}{text}{\@glo@text}%
  \expandafter\gls@assign@field\expandafter
     {\csname glo@\@glo@label @text\endcsname\glspluralsuffix}%
     {\@glo@label}{plural}{\@glo@plural}%
  \expandafter\gls@assign@field\expandafter
     {\csname glo@\@glo@label @text\endcsname}%
     {\@glo@label}{first}{\@glo@first}%
  \ifx\@glo@first\@gls@default@value
    \expandafter\gls@assign@field\expandafter
       {\csname glo@\@glo@label @plural\endcsname}%
       {\@glo@label}{firstpl}{\@glo@firstplural}%
  \else
    \expandafter\gls@assign@field\expandafter
       {\csname glo@\@glo@label @first\endcsname\glspluralsuffix}%
       {\@glo@label}{firstpl}{\@glo@firstplural}%
  \fi
  \ifcsundef{@glotype@\@glo@type @counter}%
  {%
    \def\@glo@defaultcounter{\glscounter}%
  }%
  {%
    \letcs\@glo@defaultcounter{@glotype@\@glo@type @counter}%
  }%
  \gls@assign@field{\@glo@defaultcounter}{\@glo@label}{counter}{\@glo@counter}%
  \gls@assign@field{}{\@glo@label}{useri}{\@glo@useri}%
  \gls@assign@field{}{\@glo@label}{userii}{\@glo@userii}%
  \gls@assign@field{}{\@glo@label}{useriii}{\@glo@useriii}%
  \gls@assign@field{}{\@glo@label}{useriv}{\@glo@useriv}%
  \gls@assign@field{}{\@glo@label}{userv}{\@glo@userv}%
  \gls@assign@field{}{\@glo@label}{uservi}{\@glo@uservi}%
  \gls@assign@field{}{\@glo@label}{short}{\@glo@short}%
  \gls@assign@field{}{\@glo@label}{shortpl}{\@glo@shortpl}%
  \gls@assign@field{}{\@glo@label}{long}{\@glo@long}%
  \gls@assign@field{}{\@glo@label}{longpl}{\@glo@longpl}%
  \ifx\@glo@name\@glsnoname
    \@glsnoname
    \let\@gloname\@gls@default@value
  \fi
  \gls@assign@field{}{\@glo@label}{name}{\@glo@name}%
  \ifcsundef{glo@\@glo@label @numberlist}%
  {%
    \csxdef{glo@\@glo@label @numberlist}{%
       \noexpand\@gls@missingnumberlist{\@glo@label}}%
  }%
  {}%
  \@gls@storenonumberlist{\@glo@label}%
  \def\@glo@@desc{\@glo@first}%
  \ifx\@glo@desc\@glo@@desc
    \let\@glo@desc\@glo@first
  \fi
  \ifx\@glo@desc\@glsnodesc
    \@glsnodesc
    \let\@glodesc\@gls@default@value
  \fi
  \gls@assign@desc{\@glo@label}%
  \@gls@defsort{\@glo@type}{\@glo@label}%
  \def\@glo@@symbol{\@glo@text}%
  \ifx\@glo@symbol\@glo@@symbol
    \let\@glo@symbol\@glo@text
  \fi
  \gls@assign@field{\relax}{\@glo@label}{symbol}{\@glo@symbol}%
  \expandafter
    \gls@assign@field\expandafter
    {\csname glo@\@glo@label @symbol\endcsname}
    {\@glo@label}{symbolplural}{\@glo@symbolplural}%
  \expandafter\xdef\csname glo@\@glo@label @flagfalse\endcsname{%
    \noexpand\global
      \noexpand\let\expandafter\noexpand
        \csname ifglo@\@glo@label @flag\endcsname\noexpand\iffalse
  }%
  \expandafter\xdef\csname glo@\@glo@label @flagtrue\endcsname{%
    \noexpand\global
      \noexpand\let\expandafter\noexpand
        \csname ifglo@\@glo@label @flag\endcsname\noexpand\iftrue
  }%
  \csname glo@\@glo@label @flagfalse\endcsname
  \@glo@autosee
  \ifignoredglossary\@glo@type
  {%
    \csdef{glo@\@glo@label @index}{}%
  }
  {%
    \do@glo@storeentry{\@glo@label}%
  }%
  \@newglossaryentry@defcounters
  \@newglossaryentryposthook
}
\newcommand*{\@glo@autosee}{%
  \ifdefvoid\@glo@see{}%
  {%
    \protected@edef\@do@glssee{%
      \noexpand\@gls@fixbraces\noexpand\@glo@list\@glo@see\noexpand\@nil
      \noexpand\expandafter\noexpand\@glssee\noexpand\@glo@list{\@glo@label}}%
    \@do@glssee
  }%
  \@glo@autoseehook
}%
\newcommand*{\@glo@autoseehook}{}
\newcommand*{\@newglossaryentryprehook}{}
\newcommand*{\@newglossaryentryposthook}{}
\newcommand*{\@newglossaryentry@defcounters}{}
\newcommand*{\glsmoveentry}[2]{%
  \edef\@glo@thislabel{\glsdetoklabel{#1}}%
  \edef\glo@type{\csname glo@\@glo@thislabel @type\endcsname}%
  \def\glo@list{,}%
  \forglsentries[\glo@type]{\glo@label}%
   {%
     \ifdefequal\@glo@thislabel\glo@label
       {}{\eappto\glo@list{\glo@label,}}%
   }%
  \cslet{glolist@\glo@type}{\glo@list}%
  \csdef{glo@\@glo@thislabel @type}{#2}%
}
\ifglsxindy
  \newcommand*{\@glossaryentryfield}{\string\\glossentry}
\else
  \newcommand*{\@glossaryentryfield}{\string\glossentry}
\fi
\ifglsxindy
  \newcommand*{\@glossarysubentryfield}{%
    \string\\subglossentry}
\else
  \newcommand*{\@glossarysubentryfield}{%
    \string\subglossentry}
\fi
\newcommand{\@glo@storeentry}[1]{%
  \edef\@glo@esclabel{#1}%
  \@gls@checkmkidxchars\@glo@esclabel
  \protected@edef\@glo@sort{\csname glo@#1@sort\endcsname}%
  \@gls@checkmkidxchars\@glo@sort
  \@gls@checkmkidxchars\@glo@prefix
  \edef\@glo@parent{\csname glo@#1@parent\endcsname}%
  \ifglsxindy
    \ifx\@glo@parent\@empty
      \expandafter\protected@xdef\csname glo@#1@index\endcsname{%
       (\string"\@glo@sort\string" %
       \string"\@glo@prefix\@glossaryentryfield{\@glo@esclabel}\string") %
      }%
    \else
      \expandafter\protected@xdef\csname glo@#1@index\endcsname{%
        \csname glo@\@glo@parent @index\endcsname
        (\string"\@glo@sort\string" %
        \string"\@glo@prefix\@glossarysubentryfield
           {\csname glo@#1@level\endcsname}{\@glo@esclabel}\string") %
       }%
    \fi
  \else
    \ifx\@glo@parent\@empty
      \@onelevel@sanitize\@glo@prefix
      \expandafter\protected@xdef\csname glo@#1@index\endcsname{%
        \@glo@sort\@gls@actualchar\@glo@prefix
        \@glossaryentryfield{\@glo@esclabel}%
      }%
    \else
      \expandafter\protected@xdef\csname glo@#1@index\endcsname{%
        \csname glo@\@glo@parent @index\endcsname\@gls@levelchar
        \@glo@sort\@gls@actualchar\@glo@prefix
        \@glossarysubentryfield
          {\csname glo@#1@level\endcsname}{\@glo@esclabel}%
      }%
    \fi
  \fi
}
\AtBeginDocument{%
  \@ifpackageloaded{amsmath}%
  {\let\gls@ifnotmeasuring\@gls@ifnotmeasuring}%
  {}%
}
\newcommand*{\@gls@ifnotmeasuring}[1]{%
  \ifmeasuring@
  \else
    #1%
  \fi
}
\newcommand*\gls@ifnotmeasuring[1]{#1}
\def\@gls@patchtabularx#1\hbox#2#3!!{%
  \def\TX@trial##1{#1\hbox{\let\glsunset\@gobble#2}#3}%
}
\newcommand*\glspatchtabularx{%
 \ifdef\TX@trial
 {%
   \expandafter\@gls@patchtabularx\TX@trial{##1}!!%
   \let\glspatchtabularx\relax
 }%
 {}%
}
\newcommand*{\glsreset}[1]{%
  \gls@ifnotmeasuring
  {%
    \glsdoifexists{#1}%
    {%
       \@glsreset{#1}%
    }%
  }%
}
\newcommand*{\glslocalreset}[1]{%
  \gls@ifnotmeasuring
  {%
    \glsdoifexists{#1}%
    {%
       \@glslocalreset{#1}%
    }%
  }%
}
\newcommand*{\glsunset}[1]{%
  \gls@ifnotmeasuring
  {%
    \glsdoifexists{#1}%
    {%
      \@glsunset{#1}%
    }%
  }%
}
\newcommand*{\glslocalunset}[1]{%
  \gls@ifnotmeasuring
  {%
    \glsdoifexists{#1}%
    {%
      \@glslocalunset{#1}%
    }%
  }%
}
\newcommand*{\@glslocalunset}{\@@glslocalunset}
\newcommand*{\@@glslocalunset}[1]{%
   \expandafter\let\csname ifglo@\glsdetoklabel{#1}@flag\endcsname\iftrue
}
\newcommand*{\@glsunset}{\@@glsunset}
\newcommand*{\@@glsunset}[1]{%
  \expandafter\global\csname glo@\glsdetoklabel{#1}@flagtrue\endcsname
}
\newcommand*{\@glslocalreset}{\@@glslocalreset}
\newcommand*{\@@glslocalreset}[1]{%
   \expandafter\let\csname ifglo@\glsdetoklabel{#1}@flag\endcsname\iffalse
}
\newcommand*{\@glsreset}{\@@glsreset}
\newcommand*{\@@glsreset}[1]{%
  \expandafter\global\csname glo@\glsdetoklabel{#1}@flagfalse\endcsname
}
\newcommand*{\glsresetall}[1][\@glo@types]{%
  \forallglsentries[#1]{\@glsentry}%
  {%
     \glsreset{\@glsentry}%
  }%
}
\newcommand*{\glslocalresetall}[1][\@glo@types]{%
  \forallglsentries[#1]{\@glsentry}%
  {%
    \glslocalreset{\@glsentry}%
  }%
}
\newcommand*{\glsunsetall}[1][\@glo@types]{%
  \forallglsentries[#1]{\@glsentry}%
  {%
    \glsunset{\@glsentry}%
  }%
}
\newcommand*{\glslocalunsetall}[1][\@glo@types]{%
  \forallglsentries[#1]{\@glsentry}%
  {%
    \glslocalunset{\@glsentry}%
  }%
}
\newcommand*{\@@newglossaryentry@defcounters}{%
  \csdef{glo@\@glo@label @currcount}{0}%
  \csdef{glo@\@glo@label @prevcount}{0}%
}
\newcommand*{\glsenableentrycount}{%
  \let\@newglossaryentry@defcounters\@@newglossaryentry@defcounters
  \renewcommand*{\gls@defdocnewglossaryentry}{%
    \renewcommand*\newglossaryentry[2]{%
      \PackageError{glossaries}{\string\newglossaryentry\space
      may only be used in the preamble when entry counting has
      been activated}{If you use \string\glsenableentrycount\space
      you must place all entry definitions in the preamble not in
      the document environment}%
    }%
  }%
  \newcommand*{\glsentrycurrcount}[1]{%
   \ifcsundef{glo@\glsdetoklabel{##1}@currcount}%
   {0}{\@gls@entry@field{##1}{currcount}}%
  }%
  \newcommand*{\glsentryprevcount}[1]{%
   \ifcsundef{glo@\glsdetoklabel{##1}@prevcount}%
   {0}{\@gls@entry@field{##1}{prevcount}}%
  }%
  \renewcommand*{\@glsunset}[1]{%
    \@@glsunset{##1}%
    \@gls@increment@currcount{##1}%
  }%
  \renewcommand*{\@glslocalunset}[1]{%
    \@@glslocalunset{##1}%
    \@gls@local@increment@currcount{##1}%
  }%
  \renewcommand*{\@glsreset}[1]{%
    \@@glsreset{##1}%
    \csgdef{glo@\glsdetoklabel{##1}@currcount}{0}%
  }%
  \renewcommand*{\@glslocalreset}[1]{%
    \@@glslocalreset{##1}%
    \csdef{glo@\glsdetoklabel{##1}@currcount}{0}%
  }%
 \def\@cgls@##1##2[##3]{%
   \ifnum\glsentryprevcount{##2}=1\relax
     \cglsformat{##2}{##3}%
     \glsunset{##2}%
   \else
     \@gls@{##1}{##2}[##3]%
   \fi
 }%
 \def\@cglspl@##1##2[##3]{%
   \ifnum\glsentryprevcount{##2}=1\relax
     \cglsplformat{##2}{##3}%
     \glsunset{##2}%
   \else
     \@glspl@{##1}{##2}[##3]%
   \fi
 }%
 \def\@cGls@##1##2[##3]{%
   \ifnum\glsentryprevcount{##2}=1\relax
     \cGlsformat{##2}{##3}%
     \glsunset{##2}%
   \else
     \@Gls@{##1}{##2}[##3]%
   \fi
 }%
 \def\@cGlspl@##1##2[##3]{%
   \ifnum\glsentryprevcount{##2}=1\relax
     \cGlsplformat{##2}{##3}%
     \glsunset{##2}%
   \else
     \@Glspl@{##1}{##2}[##3]%
   \fi
 }%
  \AtEndDocument{\@gls@write@entrycounts}%
  \renewcommand*{\@gls@entry@count}[2]{%
    \csgdef{glo@\glsdetoklabel{##1}@prevcount}{##2}%
  }%
  \let\glsenableentrycount\relax
}
\@onlypreamble\glsenableentrycount
\newcommand*{\@gls@increment@currcount}[1]{%
  \csxdef{glo@\glsdetoklabel{#1}@currcount}{%
   \number\numexpr\glsentrycurrcount{#1}+1}%
}
\newcommand*{\@gls@local@increment@currcount}[1]{%
  \csedef{glo@\glsdetoklabel{#1}@currcount}{%
   \number\numexpr\glsentrycurrcount{#1}+1}%
}
\newcommand*{\@gls@write@entrycounts}{%
  \immediate\write\@auxout
    {\string\providecommand*{\string\@gls@entry@count}[2]{}}%
  \forallglsentries{\@glsentry}{%
    \ifglsused{\@glsentry}%
    {\immediate\write\@auxout
      {\string\@gls@entry@count{\@glsentry}{\glsentrycurrcount{\@glsentry}}}}%
    {}%
  }%
}
\newcommand*{\@gls@entry@count}[2]{}
\newrobustcmd*{\cgls}{\@gls@hyp@opt\@cgls}
\newcommand*{\@cgls}[2][]{%
  \new@ifnextchar[{\@cgls@{#1}{#2}}{\@cgls@{#1}{#2}[]}%
}
\def\@cgls@#1#2[#3]{%
 \GlossariesWarning{\string\cgls\space is defaulting to
   \string\gls\space since you haven't enabled entry counting}%
 \@gls@{#1}{#2}[#3]%
}
\newcommand*{\cglsformat}[2]{%
  \ifglshaslong{#1}{\glsentrylong{#1}}{\glsentryfirst{#1}}#2%
}
\newrobustcmd*{\cGls}{\@gls@hyp@opt\@cGls}
\newcommand*{\@cGls}[2][]{%
  \new@ifnextchar[{\@cGls@{#1}{#2}}{\@cGls@{#1}{#2}[]}%
}
\def\@cGls@#1#2[#3]{%
 \GlossariesWarning{\string\cGls\space is defaulting to
   \string\Gls\space since you haven't enabled entry counting}%
 \@Gls@{#1}{#2}[#3]%
}
\newcommand*{\cGlsformat}[2]{%
  \ifglshaslong{#1}{\Glsentrylong{#1}}{\Glsentryfirst{#1}}#2%
}
\newrobustcmd*{\cglspl}{\@gls@hyp@opt\@cglspl}
\newcommand*{\@cglspl}[2][]{%
  \new@ifnextchar[{\@cglspl@{#1}{#2}}{\@cglspl@{#1}{#2}[]}%
}
\def\@cglspl@#1#2[#3]{%
 \GlossariesWarning{\string\cglspl\space is defaulting to
   \string\glspl\space since you haven't enabled entry counting}%
 \@glspl@{#1}{#2}[#3]%
}
\newcommand*{\cglsplformat}[2]{%
  \ifglshaslong{#1}{\glsentrylongpl{#1}}{\glsentryfirstplural{#1}}#2%
}
\newrobustcmd*{\cGlspl}{\@gls@hyp@opt\@cGlspl}
\newcommand*{\@cGlspl}[2][]{%
  \new@ifnextchar[{\@cGlspl@{#1}{#2}}{\@cGlspl@{#1}{#2}[]}%
}
\def\@cGlspl@#1#2[#3]{%
 \GlossariesWarning{\string\cGlspl\space is defaulting to
   \string\Glspl\space since you haven't enabled entry counting}%
 \@Glspl@{#1}{#2}[#3]%
}
\newcommand*{\cGlsplformat}[2]{%
  \ifglshaslong{#1}{\Glsentrylongpl{#1}}{\Glsentryfirstplural{#1}}#2%
}
\newcommand*{\loadglsentries}[2][\@gls@default]{%
  \let\@gls@default\glsdefaulttype
  \def\glsdefaulttype{#1}\input{#2}%
  \let\glsdefaulttype\@gls@default
}
\@onlypreamble{\loadglsentries}
\newcommand*{\glstextformat}[1]{#1}
\newcommand*{\glsentryfmt}{%
  \@@gls@default@entryfmt\glsdisplayfirst\glsdisplay
}
\newcommand*{\@@gls@default@entryfmt}[2]{%
  \ifdefempty\glscustomtext
  {%
    \glsifplural
    {%
      \glscapscase
      {%
        \ifglsused\glslabel
        {%
          #2{\glsentryplural{\glslabel}}%
            {\glsentrydescplural{\glslabel}}%
            {\glsentrysymbolplural{\glslabel}}{\glsinsert}%
        }%
        {%
          #1{\glsentryfirstplural{\glslabel}}%
            {\glsentrydescplural{\glslabel}}%
            {\glsentrysymbolplural{\glslabel}}{\glsinsert}%
        }%
      }%
      {%
        \ifglsused\glslabel
        {%
          \ifbool{glscompatible-3.07}%
          {%
            \protected@edef\@glo@etext{%
              #2{\glsentryplural{\glslabel}}%
                {\glsentrydescplural{\glslabel}}%
                {\glsentrysymbolplural{\glslabel}}{\glsinsert}}%
            \xmakefirstuc\@glo@etext
          }%
          {%
            #2{\Glsentryplural{\glslabel}}%
              {\glsentrydescplural{\glslabel}}%
              {\glsentrysymbolplural{\glslabel}}{\glsinsert}%
          }%
        }%
        {%
          \ifbool{glscompatible-3.07}%
          {%
            \protected@edef\@glo@etext{%
              #1{\glsentryfirstplural{\glslabel}}%
                {\glsentrydescplural{\glslabel}}%
                {\glsentrysymbolplural{\glslabel}}{\glsinsert}}%
            \xmakefirstuc\@glo@etext
          }%
          {%
            #1{\Glsentryfirstplural{\glslabel}}%
              {\glsentrydescplural{\glslabel}}%
              {\glsentrysymbolplural{\glslabel}}{\glsinsert}%
          }%
        }%
      }%
      {%
        \ifglsused\glslabel
        {%
          \mfirstucMakeUppercase{#2{\glsentryplural{\glslabel}}%
            {\glsentrydescplural{\glslabel}}%
            {\glsentrysymbolplural{\glslabel}}{\glsinsert}}%
        }%
        {%
          \mfirstucMakeUppercase{#1{\glsentryfirstplural{\glslabel}}%
            {\glsentrydescplural{\glslabel}}%
            {\glsentrysymbolplural{\glslabel}}{\glsinsert}}%
        }%
      }%
    }%
    {%
      \glscapscase
      {%
        \ifglsused\glslabel
        {%
          #2{\glsentrytext{\glslabel}}%
            {\glsentrydesc{\glslabel}}%
            {\glsentrysymbol{\glslabel}}{\glsinsert}%
        }%
        {%
          #1{\glsentryfirst{\glslabel}}%
            {\glsentrydesc{\glslabel}}%
            {\glsentrysymbol{\glslabel}}{\glsinsert}%
        }%
      }%
      {%
        \ifglsused\glslabel
        {%
          \ifbool{glscompatible-3.07}%
          {%
            \protected@edef\@glo@etext{%
              #2{\glsentrytext{\glslabel}}%
                {\glsentrydesc{\glslabel}}%
                {\glsentrysymbol{\glslabel}}{\glsinsert}}%
            \xmakefirstuc\@glo@etext
          }%
          {%
            #2{\Glsentrytext{\glslabel}}%
              {\glsentrydesc{\glslabel}}%
              {\glsentrysymbol{\glslabel}}{\glsinsert}%
          }%
        }%
        {%
          \ifbool{glscompatible-3.07}%
          {%
            \protected@edef\@glo@etext{%
              #1{\glsentryfirst{\glslabel}}%
                {\glsentrydesc{\glslabel}}%
                {\glsentrysymbol{\glslabel}}{\glsinsert}}%
              \xmakefirstuc\@glo@etext
          }%
          {%
            #1{\Glsentryfirst{\glslabel}}%
              {\glsentrydesc{\glslabel}}%
              {\glsentrysymbol{\glslabel}}{\glsinsert}%
          }%
        }%
      }%
      {%
        \ifglsused\glslabel
        {%
          \mfirstucMakeUppercase{#2{\glsentrytext{\glslabel}}%
            {\glsentrydesc{\glslabel}}%
            {\glsentrysymbol{\glslabel}}{\glsinsert}}%
        }%
        {%
          \mfirstucMakeUppercase{#1{\glsentryfirst{\glslabel}}%
            {\glsentrydesc{\glslabel}}%
            {\glsentrysymbol{\glslabel}}{\glsinsert}}%
        }%
      }%
    }%
  }%
  {%
    \ifglsused{\glslabel}%
    {%
      #2{\glscustomtext}%
        {\glsentrydesc{\glslabel}}%
        {\glsentrysymbol{\glslabel}}{}%
    }%
    {%
      #1{\glscustomtext}%
        {\glsentrydesc{\glslabel}}%
        {\glsentrysymbol{\glslabel}}{}%
    }%
  }%
}
\newcommand*{\glsgenentryfmt}{%
  \ifdefempty\glscustomtext
  {%
    \glsifplural
    {%
      \glscapscase
      {%
        \ifglsused\glslabel
        {%
          \glsentryplural{\glslabel}\glsinsert
        }%
        {%
          \glsentryfirstplural{\glslabel}\glsinsert
        }%
      }%
      {%
        \ifglsused\glslabel
        {%
           \Glsentryplural{\glslabel}\glsinsert
        }%
        {%
           \Glsentryfirstplural{\glslabel}\glsinsert
        }%
      }%
      {%
        \ifglsused\glslabel
        {%
          \mfirstucMakeUppercase
             {\glsentryplural{\glslabel}\glsinsert}%
        }%
        {%
          \mfirstucMakeUppercase
             {\glsentryfirstplural{\glslabel}\glsinsert}%
        }%
      }%
    }%
    {%
      \glscapscase
      {%
        \ifglsused\glslabel
        {%
          \glsentrytext{\glslabel}\glsinsert
        }%
        {%
          \glsentryfirst{\glslabel}\glsinsert
        }%
      }%
      {%
        \ifglsused\glslabel
        {%
           \Glsentrytext{\glslabel}\glsinsert
        }%
        {%
          \Glsentryfirst{\glslabel}\glsinsert
        }%
      }%
      {%
        \ifglsused\glslabel
        {%
          \mfirstucMakeUppercase{\glsentrytext{\glslabel}\glsinsert}%
        }%
        {%
          \mfirstucMakeUppercase{\glsentryfirst{\glslabel}\glsinsert}%
        }%
      }%
    }%
  }%
  {%
    \glscustomtext\glsinsert
  }%
}
\newcommand*{\glsgenacfmt}{%
  \ifdefempty\glscustomtext
  {%
    \ifglsused\glslabel
    {%
      \glsifplural
      {%
        \glscapscase
        {%
          \acronymfont{\glsentryshortpl{\glslabel}}\glsinsert
        }%
        {%
          \acronymfont{\Glsentryshortpl{\glslabel}}\glsinsert
        }%
        {%
          \mfirstucMakeUppercase
            {\acronymfont{\glsentryshortpl{\glslabel}}\glsinsert}%
        }%
      }%
      {%
        \glscapscase
        {%
          \acronymfont{\glsentryshort{\glslabel}}\glsinsert
        }%
        {%
          \acronymfont{\Glsentryshort{\glslabel}}\glsinsert
        }%
        {%
          \mfirstucMakeUppercase
            {\acronymfont{\glsentryshort{\glslabel}}\glsinsert}%
        }%
      }%
    }%
    {%
      \glsifplural
      {%
        \glscapscase
        {%
          \genplacrfullformat{\glslabel}{\glsinsert}%
        }%
        {%
          \Genplacrfullformat{\glslabel}{\glsinsert}%
        }%
        {%
          \mfirstucMakeUppercase
            {\genplacrfullformat{\glslabel}{\glsinsert}}%
        }%
      }%
      {%
        \glscapscase
        {%
          \genacrfullformat{\glslabel}{\glsinsert}%
        }%
        {%
          \Genacrfullformat{\glslabel}{\glsinsert}%
        }%
        {%
          \mfirstucMakeUppercase
           {\genacrfullformat{\glslabel}{\glsinsert}}%
        }%
      }%
    }%
  }%
  {%
    \glscustomtext
  }%
}
\newcommand*{\genacrfullformat}[2]{%
   \glsentrylong{#1}#2\space
   (\protect\firstacronymfont{\glsentryshort{#1}})%
}
\newcommand*{\Genacrfullformat}[2]{%
  \protected@edef\gls@text{\genacrfullformat{#1}{#2}}%
  \xmakefirstuc\gls@text
}
\newcommand*{\genplacrfullformat}[2]{%
   \glsentrylongpl{#1}#2\space
   (\protect\firstacronymfont{\glsentryshortpl{#1}})%
}
\newcommand*{\Genplacrfullformat}[2]{%
  \protected@edef\gls@text{\genplacrfullformat{#1}{#2}}%
  \xmakefirstuc\gls@text
}
\newcommand*{\glsdisplayfirst}[4]{#1#4}
\newcommand*{\glsdisplay}[4]{#1#4}
\newcommand*{\defglsdisplay}[2][\glsdefaulttype]{%
  \GlossariesWarning{\string\defglsdisplay\space is now obsolete.^^J
  Use \string\defglsentryfmt\space instead}%
  \expandafter\def\csname gls@#1@display\endcsname##1##2##3##4{#2}%
  \edef\@gls@doentrydef{%
    \noexpand\defglsentryfmt[#1]{%
      \noexpand\ifcsdef{gls@#1@displayfirst}%
      {%
        \noexpand\@@gls@default@entryfmt
          {\noexpand\csuse{gls@#1@displayfirst}}%
          {\noexpand\csuse{gls@#1@display}}%
      }%
      {%
        \noexpand\@@gls@default@entryfmt
          {\noexpand\glsdisplayfirst}%
          {\noexpand\csuse{gls@#1@display}}%
      }%
    }%
  }%
  \@gls@doentrydef
}
\newcommand*{\defglsdisplayfirst}[2][\glsdefaulttype]{%
  \GlossariesWarning{\string\defglsdisplayfirst\space is now obsolete.^^J
  Use \string\defglsentryfmt\space instead}%
  \expandafter\def\csname gls@#1@displayfirst\endcsname##1##2##3##4{#2}%
  \edef\@gls@doentrydef{%
    \noexpand\defglsentryfmt[#1]{%
      \noexpand\ifcsdef{gls@#1@display}%
      {%
        \noexpand\@@gls@default@entryfmt
          {\noexpand\csuse{gls@#1@displayfirst}}%
          {\noexpand\csuse{gls@#1@display}}%
      }%
      {%
        \noexpand\@@gls@default@entryfmt
          {\noexpand\csuse{gls@#1@displayfirst}}%
          {\noexpand\glsdisplay}%
      }%
    }%
  }%
  \@gls@doentrydef
}
\define@key{glslink}{counter}{%
  \ifcsundef{c@#1}%
  {%
    \PackageError{glossaries}%
    {There is no counter called `#1'}%
    {%
       The counter key should have the name of a valid counter
       as its value%
    }%
  }%
  {%
    \def\@gls@counter{#1}%
  }%
}
\define@key{glslink}{format}{%
  \def\@glsnumberformat{#1}}
\define@boolkey{glslink}{hyper}[true]{}
\ifdef{\hyperlink}{\KV@glslink@hypertrue}{\KV@glslink@hyperfalse}
\define@boolkey{glslink}{local}[true]{}
\newcommand*{\glslinkvar}[3]{#1}
\newcommand*{\glsifhyper}[2]{%
 \glslinkvar{#1}{#2}{#1}%
 \GlossariesWarning{\string\glsifhyper\space is deprecated. Did
  you mean \string\glsifhyperon\space or \string\glslinkvar?}%
}
\newcommand*{\@gls@hyp@opt}[1]{%
 \let\glslinkvar\@firstofthree
 \let\@gls@hyp@opt@cs#1\relax
 \@ifstar{\s@gls@hyp@opt}%
 {\@ifnextchar+{\@firstoftwo{\p@gls@hyp@opt}}{#1}}%
}
\newcommand*{\s@gls@hyp@opt}[1][]{%
 \let\glslinkvar\@secondofthree
 \@gls@hyp@opt@cs[hyper=false,#1]}
\newcommand*{\p@gls@hyp@opt}[1][]{%
 \let\glslinkvar\@thirdofthree
 \@gls@hyp@opt@cs[hyper=true,#1]}
\newrobustcmd*{\glslink}{%
 \@gls@hyp@opt\@gls@@link
}
\newcommand*{\@gls@@link}[3][]{%
  \glsdoifexistsordo{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\relax
    \@gls@link[#1]{#2}{#3}%
  }{%
    \glstextformat{#3}%
  }%
  \glspostlinkhook
}
\newcommand*{\glspostlinkhook}{}
\newcommand*{\@gls@link@checkfirsthyper}{%
  \ifglsused{\glslabel}%
  {%
  }%
  {%
    \gls@checkisacronymlist\glstype
    \ifglshyperfirst
      \if@glsisacronymlist
        \ifglsacrfootnote
           \KV@glslink@hyperfalse
        \fi
      \fi
    \else
       \KV@glslink@hyperfalse
    \fi
  }%
  \glslinkcheckfirsthyperhook
}
\newcommand*{\glslinkcheckfirsthyperhook}{}
\newcommand*{\glslinkpostsetkeys}{}
\newcommand{\glsifhyperon}[2]{\ifKV@glslink@hyper#1\else#2\fi}
\newcommand*{\do@glsdisablehyperinlist}{%
  \expandafter\DTLifinlist\expandafter{\glstype}{\@gls@nohyperlist}%
    {\KV@glslink@hyperfalse}{}%
}
\newcommand*{\@gls@setdefault@glslink@opts}{}
\def\@gls@link[#1]#2#3{%
    \leavevmode
    \edef\glslabel{\glsdetoklabel{#2}}%
    \def\@gls@link@opts{#1}%
    \let\@gls@link@label\glslabel
    \def\@glsnumberformat{glsnumberformat}%
    \edef\@gls@counter{\csname glo@\glslabel @counter\endcsname}%
    \edef\glstype{\csname glo@\glslabel @type\endcsname}%
    \let\org@ifKV@glslink@hyper\ifKV@glslink@hyper
    \@gls@setdefault@glslink@opts
    \do@glsdisablehyperinlist
    \do@gls@link@checkfirsthyper
    \setkeys{glslink}{#1}%
    \glslinkpostsetkeys
    \@gls@saveentrycounter
    \@gls@setsort{\glslabel}%
    \@do@wrglossary{#2}%
    \ifKV@glslink@hyper
      \@glslink{\glolinkprefix\glslabel}{\glstextformat{#3}}%
    \else
      \glsdonohyperlink{\glolinkprefix\glslabel}{\glstextformat{#3}}%
    \fi
    \let\ifKV@glslink@hyper\org@ifKV@glslink@hyper
}
\newcommand*{\glolinkprefix}{glo:}
\def\glsentrycounter{\glscounter}%
\newcommand*{\@gls@saveentrycounter}{%
  \def\@gls@Hcounter{}%
  \ifthenelse{\equal{\@gls@counter}{equation}}%
  {
    \ifcsundef{xatlevel@}%
    {%
      \edef\theglsentrycounter{\expandafter\noexpand
        \csname the\@gls@counter\endcsname}%
    }%
    {%
      \ifx\xatlevel@\@empty
        \edef\theglsentrycounter{\expandafter\noexpand
          \csname the\@gls@counter\endcsname}%
      \else
        \savecounters@
        \advance\c@equation by 1\relax
          \edef\theglsentrycounter{\csname the\@gls@counter\endcsname}%
        \ifcsundef{theH\@gls@counter}%
        {%
           \def\@gls@Hcounter{\theglsentrycounter}%
        }%
        {%
          \def\@gls@Hcounter{\csname theH\@gls@counter\endcsname}%
        }%
        \protected@edef\theHglsentrycounter{\@gls@Hcounter}%
        \restorecounters@
      \fi
    }%
  }%
  {%
    \edef\theglsentrycounter{\expandafter\noexpand
      \csname the\@gls@counter\endcsname}%
  }%
  \ifx\@gls@Hcounter\@empty
    \ifcsundef{theH\@gls@counter}%
    {%
       \def\theHglsentrycounter{\theglsentrycounter}%
    }%
    {%
      \protected@edef\theHglsentrycounter{\expandafter\noexpand
        \csname theH\@gls@counter\endcsname}%
    }%
  \fi
}
\def\@set@glo@numformat#1#2#3#4{%
  \expandafter\@glo@check@mkidxrangechar#3\@nil
  \protected@edef#1{%
    \@glo@prefix setentrycounter[#4]{#2}%
    \expandafter\string\csname\@glo@suffix\endcsname
  }%
  \@gls@checkmkidxchars#1%
}
\def\@glo@check@mkidxrangechar#1#2\@nil{%
\if#1(\relax
  \def\@glo@prefix{(}%
  \if\relax#2\relax
    \def\@glo@suffix{glsnumberformat}%
  \else
    \def\@glo@suffix{#2}%
  \fi
\else
  \if#1)\relax
    \def\@glo@prefix{)}%
    \if\relax#2\relax
      \def\@glo@suffix{glsnumberformat}%
    \else
      \def\@glo@suffix{#2}%
  \fi
  \else
    \def\@glo@prefix{}\def\@glo@suffix{#1#2}%
  \fi
\fi}
\newcommand*{\@gls@escbsdq}[1]{%
  \def\@gls@checkedmkidx{}%
  \let\gls@xdystring=#1\relax
  \@onelevel@sanitize\gls@xdystring
  \edef\do@gls@xdycheckbackslash{%
    \noexpand\@gls@xdycheckbackslash\gls@xdystring\noexpand\@nil
    \@backslashchar\@backslashchar\noexpand\null}%
  \do@gls@xdycheckbackslash
  \expandafter\@gls@updatechecked\@gls@checkedmkidx{\gls@xdystring}%
  \def\@gls@checkedmkidx{}%
  \expandafter\@gls@xdycheckquote\gls@xdystring\@nil""\null
  \expandafter\@gls@updatechecked\@gls@checkedmkidx{\gls@xdystring}%
  \@for\@gls@tmp:=\gls@protected@pagefmts\do
  {%
    \edef\@gls@sanitized@tmp{\expandafter\@gobble\string\\\expandonce\@gls@tmp}%
    \@onelevel@sanitize\@gls@sanitized@tmp
    \edef\gls@dosubst{%
      \noexpand\DTLsubstituteall\noexpand\gls@xdystring
      {\@gls@sanitized@tmp}{\expandonce\@gls@tmp}%
    }%
    \gls@dosubst
  }%
  \let#1=\gls@xdystring
}
\newcommand{\@gls@checkmkidxchars}[1]{%
  \ifglsxindy
    \@gls@escbsdq{#1}%
  \else
    \def\@gls@checkedmkidx{}%
    \expandafter\@gls@checkquote#1\@nil""\null
    \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
    \def\@gls@checkedmkidx{}%
    \expandafter\@gls@checkescquote#1\@nil\"\"\null
    \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
    \def\@gls@checkedmkidx{}%
    \expandafter\@gls@checkescactual#1\@nil\?\?\null
    \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
    \def\@gls@checkedmkidx{}%
    \expandafter\@gls@checkactual#1\@nil??\null
    \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
    \def\@gls@checkedmkidx{}%
    \expandafter\@gls@checkbar#1\@nil||\null
    \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
    \def\@gls@checkedmkidx{}%
    \expandafter\@gls@checkescbar#1\@nil\|\|\null
    \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
    \def\@gls@checkedmkidx{}%
    \expandafter\@gls@checklevel#1\@nil!!\null
    \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
  \fi
}
\def\@gls@updatechecked#1\@nil#2{\def#2{#1}}
\newtoks\@gls@tmpb
\def\@gls@checkquote#1"#2"#3\null{%
  \@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
  \toks@={#1}%
  \ifx\null#2\null
   \ifx\null#3\null
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
    \def\@@gls@checkquote{\relax}%
   \else
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
      \@gls@quotechar\@gls@quotechar\@gls@quotechar\@gls@quotechar}%
    \def\@@gls@checkquote{\@gls@checkquote#3\null}%
   \fi
  \else
   \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
     \@gls@quotechar\@gls@quotechar}%
   \ifx\null#3\null
     \def\@@gls@checkquote{\@gls@checkquote#2""\null}%
   \else
     \def\@@gls@checkquote{\@gls@checkquote#2"#3\null}%
   \fi
  \fi
  \@@gls@checkquote
}
\def\@gls@checkescquote#1\"#2\"#3\null{%
  \@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
  \toks@={#1}%
  \ifx\null#2\null
   \ifx\null#3\null
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
    \def\@@gls@checkescquote{\relax}%
   \else
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
      \@gls@quotechar\string\"\@gls@quotechar
      \@gls@quotechar\string\"\@gls@quotechar}%
    \def\@@gls@checkescquote{\@gls@checkescquote#3\null}%
   \fi
  \else
   \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
     \@gls@quotechar\string\"\@gls@quotechar}%
   \ifx\null#3\null
     \def\@@gls@checkescquote{\@gls@checkescquote#2\"\"\null}%
   \else
     \def\@@gls@checkescquote{\@gls@checkescquote#2\"#3\null}%
   \fi
  \fi
\@@gls@checkescquote
}
\def\@gls@checkescactual#1\?#2\?#3\null{%
 \@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
 \toks@={#1}%
 \ifx\null#2\null
   \ifx\null#3\null
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
    \def\@@gls@checkescactual{\relax}%
   \else
     \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
     \@gls@quotechar\string\"\@gls@actualchar
     \@gls@quotechar\string\"\@gls@actualchar}%
     \def\@@gls@checkescactual{\@gls@checkescactual#3\null}%
   \fi
  \else
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
    \@gls@quotechar\string\"\@gls@actualchar}%
    \ifx\null#3\null
      \def\@@gls@checkescactual{\@gls@checkescactual#2\?\?\null}%
    \else
      \def\@@gls@checkescactual{\@gls@checkescactual#2\?#3\null}%
   \fi
  \fi
\@@gls@checkescactual
}
\def\@gls@checkescbar#1\|#2\|#3\null{%
  \@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
  \toks@={#1}%
  \ifx\null#2\null
   \ifx\null#3\null
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
    \def\@@gls@checkescbar{\relax}%
   \else
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
      \@gls@quotechar\string\"\@gls@encapchar
      \@gls@quotechar\string\"\@gls@encapchar}%
    \def\@@gls@checkescbar{\@gls@checkescbar#3\null}%
   \fi
  \else
   \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
     \@gls@quotechar\string\"\@gls@encapchar}%
   \ifx\null#3\null
    \def\@@gls@checkescbar{\@gls@checkescbar#2\|\|\null}%
   \else
    \def\@@gls@checkescbar{\@gls@checkescbar#2\|#3\null}%
   \fi
  \fi
\@@gls@checkescbar
}
\def\@gls@checkesclevel#1\!#2\!#3\null{%
  \@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
  \toks@={#1}%
  \ifx\null#2\null
   \ifx\null#3\null
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
    \def\@@gls@checkesclevel{\relax}%
   \else
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
      \@gls@quotechar\string\"\@gls@levelchar
      \@gls@quotechar\string\"\@gls@levelchar}%
    \def\@@gls@checkesclevel{\@gls@checkesclevel#3\null}%
   \fi
  \else
   \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
     \@gls@quotechar\string\"\@gls@levelchar}%
   \ifx\null#3\null
    \def\@@gls@checkesclevel{\@gls@checkesclevel#2\!\!\null}%
   \else
    \def\@@gls@checkesclevel{\@gls@checkesclevel#2\!#3\null}%
   \fi
  \fi
\@@gls@checkesclevel
}
\def\@gls@checkbar#1|#2|#3\null{%
  \@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
  \toks@={#1}%
  \ifx\null#2\null
   \ifx\null#3\null
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
    \def\@@gls@checkbar{\relax}%
   \else
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
      \@gls@quotechar\@gls@encapchar\@gls@quotechar\@gls@encapchar}%
    \def\@@gls@checkbar{\@gls@checkbar#3\null}%
   \fi
  \else
   \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
     \@gls@quotechar\@gls@encapchar}%
   \ifx\null#3\null
     \def\@@gls@checkbar{\@gls@checkbar#2||\null}%
   \else
     \def\@@gls@checkbar{\@gls@checkbar#2|#3\null}%
   \fi
  \fi
  \@@gls@checkbar
}
\def\@gls@checklevel#1!#2!#3\null{%
  \@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
  \toks@={#1}%
  \ifx\null#2\null
    \ifx\null#3\null
      \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
      \def\@@gls@checklevel{\relax}%
    \else
      \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
      \@gls@quotechar\@gls@levelchar\@gls@quotechar\@gls@levelchar}%
      \def\@@gls@checklevel{\@gls@checklevel#3\null}%
    \fi
  \else
    \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
    \@gls@quotechar\@gls@levelchar}%
    \ifx\null#3\null
      \def\@@gls@checklevel{\@gls@checklevel#2!!\null}%
    \else
      \def\@@gls@checklevel{\@gls@checklevel#2!#3\null}%
    \fi
  \fi
  \@@gls@checklevel
}
\def\@gls@checkactual#1?#2?#3\null{%
  \@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
  \toks@={#1}%
  \ifx\null#2\null
    \ifx\null#3\null
      \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
      \def\@@gls@checkactual{\relax}%
     \else
      \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
        \@gls@quotechar\@gls@actualchar\@gls@quotechar\@gls@actualchar}%
      \def\@@gls@checkactual{\@gls@checkactual#3\null}%
     \fi
    \else
     \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
       \@gls@quotechar\@gls@actualchar}%
     \ifx\null#3\null
       \def\@@gls@checkactual{\@gls@checkactual#2??\null}%
     \else
       \def\@@gls@checkactual{\@gls@checkactual#2?#3\null}%
     \fi
    \fi
  \@@gls@checkactual
}
\def\@gls@xdycheckquote#1"#2"#3\null{%
  \@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
  \toks@={#1}%
  \ifx\null#2\null
    \ifx\null#3\null
      \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
      \def\@@gls@xdycheckquote{\relax}%
     \else
      \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
        \string\"\string\"}%
      \def\@@gls@xdycheckquote{\@gls@xdycheckquote#3\null}%
     \fi
    \else
     \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
       \string\"}%
     \ifx\null#3\null
       \def\@@gls@xdycheckquote{\@gls@xdycheckquote#2""\null}%
     \else
       \def\@@gls@xdycheckquote{\@gls@xdycheckquote#2"#3\null}%
     \fi
    \fi
  \@@gls@xdycheckquote
}
\edef\def@gls@xdycheckbackslash{%
 \noexpand\def\noexpand\@gls@xdycheckbackslash##1\@backslashchar
   ##2\@backslashchar##3\noexpand\null{%
  \noexpand\@gls@tmpb=\noexpand\expandafter
    {\noexpand\@gls@checkedmkidx}%
  \noexpand\toks@={##1}%
  \noexpand\ifx\noexpand\null##2\noexpand\null
   \noexpand\ifx\noexpand\null##3\noexpand\null
    \noexpand\edef\noexpand\@gls@checkedmkidx{%
       \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@}%
    \noexpand\def\noexpand\@@gls@xdycheckbackslash{\relax}%
   \noexpand\else
    \noexpand\edef\noexpand\@gls@checkedmkidx{%
      \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@
    \@backslashchar\@backslashchar\@backslashchar\@backslashchar}%
  \noexpand\def\noexpand\@@gls@xdycheckbackslash{%
     \noexpand\@gls@xdycheckbackslash##3\noexpand\null}%
   \noexpand\fi
  \noexpand\else
   \noexpand\edef\noexpand\@gls@checkedmkidx{%
     \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@
   \@backslashchar\@backslashchar}%
 \noexpand\ifx\noexpand\null##3\noexpand\null
   \noexpand\def\noexpand\@@gls@xdycheckbackslash{%
      \noexpand\@gls@xdycheckbackslash##2\@backslashchar
      \@backslashchar\noexpand\null}%
   \noexpand\else
     \noexpand\def\noexpand\@@gls@xdycheckbackslash{%
        \noexpand\@gls@xdycheckbackslash##2\@backslashchar
           ##3\noexpand\null}%
   \noexpand\fi
  \noexpand\fi
  \noexpand\@@gls@xdycheckbackslash
 }%
}
\def@gls@xdycheckbackslash

\newlength\gls@tmplen
\newcommand*{\glsdohypertarget}[2]{%
  \@glsshowtarget{#1}%
  \settoheight{\gls@tmplen}{#2}%
  \raisebox{\gls@tmplen}{\hypertarget{#1}{}}#2%
}
\newcommand*{\glsdohyperlink}[2]{%
 \@glsshowtarget{#1}%
 \hyperlink{#1}{#2}%
}
\newcommand*{\glsdonohyperlink}[2]{#2}
\ifcsundef{hyperlink}%
{%
  \let\@glslink\glsdonohyperlink
}%
{%
  \let\@glslink\glsdohyperlink
}
\ifcsundef{hypertarget}%
{%
  \let\@glstarget\@secondoftwo
}%
{%
  \let\@glstarget\glsdohypertarget
}
\newcommand{\glsdisablehyper}{%
  \KV@glslink@hyperfalse
  \let\@glslink\glsdonohyperlink
  \let\@glstarget\@secondoftwo
}
\newcommand{\glsenablehyper}{%
 \KV@glslink@hypertrue
 \let\@glslink\glsdohyperlink
 \let\@glstarget\glsdohypertarget
}
\providecommand{\@firstofthree}[3]{#1}
\providecommand{\@secondofthree}[3]{#2}
\newrobustcmd*{\gls}{\@gls@hyp@opt\@gls}
\newcommand*{\@gls}[2][]{%
  \new@ifnextchar[{\@gls@{#1}{#2}}{\@gls@{#1}{#2}[]}%
}
\def\@gls@#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@firstofthree
    \let\glscustomtext\@empty
    \def\glsinsert{#3}%
    \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}%
    \@gls@link[#1]{#2}{\@glo@text}%
    \ifKV@glslink@local
      \glslocalunset{#2}%
    \else
      \glsunset{#2}%
    \fi
  }%
  \glspostlinkhook
}
\newrobustcmd*{\Gls}{\@gls@hyp@opt\@Gls}
\newcommand*{\@Gls}[2][]{%
  \new@ifnextchar[{\@Gls@{#1}{#2}}{\@Gls@{#1}{#2}[]}%
}
\def\@Gls@#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@secondofthree
    \let\glscustomtext\@empty
    \def\glsinsert{#3}%
    \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}%
    \@gls@link[#1]{#2}{\@glo@text}%
    \ifKV@glslink@local
      \glslocalunset{#2}%
    \else
      \glsunset{#2}%
    \fi
  }%
  \glspostlinkhook
}
\newrobustcmd*{\GLS}{\@gls@hyp@opt\@GLS}
\newcommand*{\@GLS}[2][]{%
  \new@ifnextchar[{\@GLS@{#1}{#2}}{\@GLS@{#1}{#2}[]}%
}
\def\@GLS@#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@thirdofthree
    \let\glscustomtext\@empty
    \def\glsinsert{#3}%
    \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}%
    \@gls@link[#1]{#2}{\@glo@text}%
    \ifKV@glslink@local
      \glslocalunset{#2}%
    \else
      \glsunset{#2}%
    \fi
  }%
  \glspostlinkhook
}
\newrobustcmd*{\glspl}{\@gls@hyp@opt\@glspl}
\newcommand*{\@glspl}[2][]{%
  \new@ifnextchar[{\@glspl@{#1}{#2}}{\@glspl@{#1}{#2}[]}%
}
\def\@glspl@#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@firstofthree
    \let\glscustomtext\@empty
    \def\glsinsert{#3}%
    \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}%
    \@gls@link[#1]{#2}{\@glo@text}%
    \ifKV@glslink@local
      \glslocalunset{#2}%
    \else
      \glsunset{#2}%
    \fi
  }%
  \glspostlinkhook
}
\newrobustcmd*{\Glspl}{\@gls@hyp@opt\@Glspl}
\newcommand*{\@Glspl}[2][]{%
  \new@ifnextchar[{\@Glspl@{#1}{#2}}{\@Glspl@{#1}{#2}[]}%
}
\def\@Glspl@#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@secondofthree
    \let\glscustomtext\@empty
    \def\glsinsert{#3}%
    \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}%
    \@gls@link[#1]{#2}{\@glo@text}%
    \ifKV@glslink@local
      \glslocalunset{#2}%
    \else
      \glsunset{#2}%
    \fi
  }%
  \glspostlinkhook
}
\newrobustcmd*{\GLSpl}{\@gls@hyp@opt\@GLSpl}
\newcommand*{\@GLSpl}[2][]{%
  \new@ifnextchar[{\@GLSpl@{#1}{#2}}{\@GLSpl@{#1}{#2}[]}%
}
\def\@GLSpl@#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@thirdofthree
    \let\glscustomtext\@empty
    \def\glsinsert{#3}%
    \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}%
    \@gls@link[#1]{#2}{\@glo@text}%
    \ifKV@glslink@local
      \glslocalunset{#2}%
    \else
      \glsunset{#2}%
    \fi
  }%
  \glspostlinkhook
}
\newrobustcmd*{\glsdisp}{\@gls@hyp@opt\@glsdisp}
\newcommand*{\@glsdisp}[3][]{%
  \glsdoifexists{#2}{%
    \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@firstofthree
    \def\glscustomtext{#3}%
    \def\glsinsert{}%
    \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}%
    \@gls@link[#1]{#2}{\@glo@text}%
    \ifKV@glslink@local
      \glslocalunset{#2}%
    \else
      \glsunset{#2}%
    \fi
  }%
  \glspostlinkhook
}
\newcommand*{\@gls@link@nocheckfirsthyper}{}
\newcommand{\@gls@field@link}[3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \@gls@link[#1]{#2}{#3}%
  }%
  \glspostlinkhook
}
\newrobustcmd*{\glstext}{\@gls@hyp@opt\@glstext}
\newcommand*{\@glstext}[2][]{%
  \new@ifnextchar[{\@glstext@{#1}{#2}}{\@glstext@{#1}{#2}[]}}
\def\@glstext@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentrytext{#2}#3}%
}
\newrobustcmd*{\GLStext}{\@gls@hyp@opt\@GLStext}
\newcommand*{\@GLStext}[2][]{%
  \new@ifnextchar[{\@GLStext@{#1}{#2}}{\@GLStext@{#1}{#2}[]}}
\def\@GLStext@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentrytext{#2}#3}}%
}
\newrobustcmd*{\Glstext}{\@gls@hyp@opt\@Glstext}
\newcommand*{\@Glstext}[2][]{%
  \new@ifnextchar[{\@Glstext@{#1}{#2}}{\@Glstext@{#1}{#2}[]}}
\def\@Glstext@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentrytext{#2}#3}%
}
\newrobustcmd*{\glsfirst}{\@gls@hyp@opt\@glsfirst}
\newcommand*{\@glsfirst}[2][]{%
  \new@ifnextchar[{\@glsfirst@{#1}{#2}}{\@glsfirst@{#1}{#2}[]}}
\def\@glsfirst@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentryfirst{#2}#3}%
}
\newrobustcmd*{\Glsfirst}{\@gls@hyp@opt\@Glsfirst}
\newcommand*{\@Glsfirst}[2][]{%
  \new@ifnextchar[{\@Glsfirst@{#1}{#2}}{\@Glsfirst@{#1}{#2}[]}}
\def\@Glsfirst@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentryfirst{#2}#3}%
}
\newrobustcmd*{\GLSfirst}{\@gls@hyp@opt\@GLSfirst}
\newcommand*{\@GLSfirst}[2][]{%
  \new@ifnextchar[{\@GLSfirst@{#1}{#2}}{\@GLSfirst@{#1}{#2}[]}}
\def\@GLSfirst@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryfirst{#2}#3}}%
}
\newrobustcmd*{\glsplural}{\@gls@hyp@opt\@glsplural}
\newcommand*{\@glsplural}[2][]{%
  \new@ifnextchar[{\@glsplural@{#1}{#2}}{\@glsplural@{#1}{#2}[]}}
\def\@glsplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentryplural{#2}#3}%
}
\newrobustcmd*{\Glsplural}{\@gls@hyp@opt\@Glsplural}
\newcommand*{\@Glsplural}[2][]{%
  \new@ifnextchar[{\@Glsplural@{#1}{#2}}{\@Glsplural@{#1}{#2}[]}}
\def\@Glsplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentryplural{#2}#3}%
}
\newrobustcmd*{\GLSplural}{\@gls@hyp@opt\@GLSplural}
\newcommand*{\@GLSplural}[2][]{%
  \new@ifnextchar[{\@GLSplural@{#1}{#2}}{\@GLSplural@{#1}{#2}[]}}
\def\@GLSplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryplural{#2}#3}}%
}
\newrobustcmd*{\glsfirstplural}{\@gls@hyp@opt\@glsfirstplural}
\newcommand*{\@glsfirstplural}[2][]{%
  \new@ifnextchar[{\@glsfirstplural@{#1}{#2}}{\@glsfirstplural@{#1}{#2}[]}}
\def\@glsfirstplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentryfirstplural{#2}#3}%
}
\newrobustcmd*{\Glsfirstplural}{\@gls@hyp@opt\@Glsfirstplural}
\newcommand*{\@Glsfirstplural}[2][]{%
  \new@ifnextchar[{\@Glsfirstplural@{#1}{#2}}{\@Glsfirstplural@{#1}{#2}[]}}
\def\@Glsfirstplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentryfirstplural{#2}#3}%
}
\newrobustcmd*{\GLSfirstplural}{\@gls@hyp@opt\@GLSfirstplural}
\newcommand*{\@GLSfirstplural}[2][]{%
  \new@ifnextchar[{\@GLSfirstplural@{#1}{#2}}{\@GLSfirstplural@{#1}{#2}[]}}
\def\@GLSfirstplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryfirstplural{#2}#3}}%
}
\newrobustcmd*{\glsname}{\@gls@hyp@opt\@glsname}
\newcommand*{\@glsname}[2][]{%
  \new@ifnextchar[{\@glsname@{#1}{#2}}{\@glsname@{#1}{#2}[]}}
\def\@glsname@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentryname{#2}#3}%
}
\newrobustcmd*{\Glsname}{\@gls@hyp@opt\@Glsname}
\newcommand*{\@Glsname}[2][]{%
  \new@ifnextchar[{\@Glsname@{#1}{#2}}{\@Glsname@{#1}{#2}[]}}
\def\@Glsname@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentryname{#2}#3}%
}
\newrobustcmd*{\GLSname}{\@gls@hyp@opt\@GLSname}
\newcommand*{\@GLSname}[2][]{%
  \new@ifnextchar[{\@GLSname@{#1}{#2}}{\@GLSname@{#1}{#2}[]}}
\def\@GLSname@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryname{#2}#3}}%
}
\newrobustcmd*{\glsdesc}{\@gls@hyp@opt\@glsdesc}
\newcommand*{\@glsdesc}[2][]{%
  \new@ifnextchar[{\@glsdesc@{#1}{#2}}{\@glsdesc@{#1}{#2}[]}}
\def\@glsdesc@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentrydesc{#2}#3}%
}
\newrobustcmd*{\Glsdesc}{\@gls@hyp@opt\@Glsdesc}
\newcommand*{\@Glsdesc}[2][]{%
  \new@ifnextchar[{\@Glsdesc@{#1}{#2}}{\@Glsdesc@{#1}{#2}[]}}
\def\@Glsdesc@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentrydesc{#2}#3}%
}
\newrobustcmd*{\GLSdesc}{\@gls@hyp@opt\@GLSdesc}
\newcommand*{\@GLSdesc}[2][]{%
  \new@ifnextchar[{\@GLSdesc@{#1}{#2}}{\@GLSdesc@{#1}{#2}[]}}
\def\@GLSdesc@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentrydesc{#2}#3}}%
}
\newrobustcmd*{\glsdescplural}{\@gls@hyp@opt\@glsdescplural}
\newcommand*{\@glsdescplural}[2][]{%
  \new@ifnextchar[{\@glsdescplural@{#1}{#2}}{\@glsdescplural@{#1}{#2}[]}}
\def\@glsdescplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentrydescplural{#2}#3}%
}
\newrobustcmd*{\Glsdescplural}{\@gls@hyp@opt\@Glsdescplural}
\newcommand*{\@Glsdescplural}[2][]{%
  \new@ifnextchar[{\@Glsdescplural@{#1}{#2}}{\@Glsdescplural@{#1}{#2}[]}}
\def\@Glsdescplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentrydescplural{#2}#3}%
}
\newrobustcmd*{\GLSdescplural}{\@gls@hyp@opt\@GLSdescplural}
\newcommand*{\@GLSdescplural}[2][]{%
  \new@ifnextchar[{\@GLSdescplural@{#1}{#2}}{\@GLSdescplural@{#1}{#2}[]}}
\def\@GLSdescplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentrydescplural{#2}#3}}%
}
\newrobustcmd*{\glssymbol}{\@gls@hyp@opt\@glssymbol}
\newcommand*{\@glssymbol}[2][]{%
  \new@ifnextchar[{\@glssymbol@{#1}{#2}}{\@glssymbol@{#1}{#2}[]}}
\def\@glssymbol@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentrysymbol{#2}#3}%
}
\newrobustcmd*{\Glssymbol}{\@gls@hyp@opt\@Glssymbol}
\newcommand*{\@Glssymbol}[2][]{%
  \new@ifnextchar[{\@Glssymbol@{#1}{#2}}{\@Glssymbol@{#1}{#2}[]}}
\def\@Glssymbol@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentrysymbol{#2}#3}%
}
\newrobustcmd*{\GLSsymbol}{\@gls@hyp@opt\@GLSsymbol}
\newcommand*{\@GLSsymbol}[2][]{%
  \new@ifnextchar[{\@GLSsymbol@{#1}{#2}}{\@GLSsymbol@{#1}{#2}[]}}
\def\@GLSsymbol@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentrysymbol{#2}#3}}%
}
\newrobustcmd*{\glssymbolplural}{\@gls@hyp@opt\@glssymbolplural}
\newcommand*{\@glssymbolplural}[2][]{%
  \new@ifnextchar[{\@glssymbolplural@{#1}{#2}}{\@glssymbolplural@{#1}{#2}[]}}
\def\@glssymbolplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentrysymbolplural{#2}#3}%
}
\newrobustcmd*{\Glssymbolplural}{\@gls@hyp@opt\@Glssymbolplural}
\newcommand*{\@Glssymbolplural}[2][]{%
  \new@ifnextchar[{\@Glssymbolplural@{#1}{#2}}{\@Glssymbolplural@{#1}{#2}[]}}
\def\@Glssymbolplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentrysymbolplural{#2}#3}%
}
\newrobustcmd*{\GLSsymbolplural}{\@gls@hyp@opt\@GLSsymbolplural}
\newcommand*{\@GLSsymbolplural}[2][]{%
  \new@ifnextchar[{\@GLSsymbolplural@{#1}{#2}}{\@GLSsymbolplural@{#1}{#2}[]}}
\def\@GLSsymbolplural@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentrysymbolplural{#2}#3}}%
}
\newrobustcmd*{\glsuseri}{\@gls@hyp@opt\@glsuseri}
\newcommand*{\@glsuseri}[2][]{%
  \new@ifnextchar[{\@glsuseri@{#1}{#2}}{\@glsuseri@{#1}{#2}[]}}
\def\@glsuseri@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentryuseri{#2}#3}%
}
\newrobustcmd*{\Glsuseri}{\@gls@hyp@opt\@Glsuseri}
\newcommand*{\@Glsuseri}[2][]{%
  \new@ifnextchar[{\@Glsuseri@{#1}{#2}}{\@Glsuseri@{#1}{#2}[]}}
\def\@Glsuseri@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentryuseri{#2}#3}%
}
\newrobustcmd*{\GLSuseri}{\@gls@hyp@opt\@GLSuseri}
\newcommand*{\@GLSuseri}[2][]{%
  \new@ifnextchar[{\@GLSuseri@{#1}{#2}}{\@GLSuseri@{#1}{#2}[]}}
\def\@GLSuseri@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryuseri{#2}#3}}%
}
\newrobustcmd*{\glsuserii}{\@gls@hyp@opt\@glsuserii}
\newcommand*{\@glsuserii}[2][]{%
  \new@ifnextchar[{\@glsuserii@{#1}{#2}}{\@glsuserii@{#1}{#2}[]}}
\def\@glsuserii@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentryuserii{#2}#3}%
}
\newrobustcmd*{\Glsuserii}{\@gls@hyp@opt\@Glsuserii}
\newcommand*{\@Glsuserii}[2][]{%
  \new@ifnextchar[{\@Glsuserii@{#1}{#2}}{\@Glsuserii@{#1}{#2}[]}}
\def\@Glsuserii@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentryuserii{#2}#3}%
}
\newrobustcmd*{\GLSuserii}{\@gls@hyp@opt\@GLSuserii}
\newcommand*{\@GLSuserii}[2][]{%
  \new@ifnextchar[{\@GLSuserii@{#1}{#2}}{\@GLSuserii@{#1}{#2}[]}}
\def\@GLSuserii@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryuserii{#2}#3}}%
}
\newrobustcmd*{\glsuseriii}{\@gls@hyp@opt\@glsuseriii}
\newcommand*{\@glsuseriii}[2][]{%
  \new@ifnextchar[{\@glsuseriii@{#1}{#2}}{\@glsuseriii@{#1}{#2}[]}}
\def\@glsuseriii@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentryuseriii{#2}#3}%
}
\newrobustcmd*{\Glsuseriii}{\@gls@hyp@opt\@Glsuseriii}
\newcommand*{\@Glsuseriii}[2][]{%
  \new@ifnextchar[{\@Glsuseriii@{#1}{#2}}{\@Glsuseriii@{#1}{#2}[]}}
\def\@Glsuseriii@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentryuseriii{#2}#3}%
}
\newrobustcmd*{\GLSuseriii}{\@gls@hyp@opt\@GLSuseriii}
\newcommand*{\@GLSuseriii}[2][]{%
  \new@ifnextchar[{\@GLSuseriii@{#1}{#2}}{\@GLSuseriii@{#1}{#2}[]}}
\def\@GLSuseriii@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryuseriii{#2}#3}}%
}
\newrobustcmd*{\glsuseriv}{\@gls@hyp@opt\@glsuseriv}
\newcommand*{\@glsuseriv}[2][]{%
  \new@ifnextchar[{\@glsuseriv@{#1}{#2}}{\@glsuseriv@{#1}{#2}[]}}
\def\@glsuseriv@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentryuseriv{#2}#3}%
}
\newrobustcmd*{\Glsuseriv}{\@gls@hyp@opt\@Glsuseriv}
\newcommand*{\@Glsuseriv}[2][]{%
  \new@ifnextchar[{\@Glsuseriv@{#1}{#2}}{\@Glsuseriv@{#1}{#2}[]}}
\def\@Glsuseriv@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentryuseriv{#2}#3}%
}
\newrobustcmd*{\GLSuseriv}{\@gls@hyp@opt\@GLSuseriv}
\newcommand*{\@GLSuseriv}[2][]{%
  \new@ifnextchar[{\@GLSuseriv@{#1}{#2}}{\@GLSuseriv@{#1}{#2}[]}}
\def\@GLSuseriv@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryuseriv{#2}#3}}%
}
\newrobustcmd*{\glsuserv}{\@gls@hyp@opt\@glsuserv}
\newcommand*{\@glsuserv}[2][]{%
  \new@ifnextchar[{\@glsuserv@{#1}{#2}}{\@glsuserv@{#1}{#2}[]}}
\def\@glsuserv@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentryuserv{#2}#3}%
}
\newrobustcmd*{\Glsuserv}{\@gls@hyp@opt\@Glsuserv}
\newcommand*{\@Glsuserv}[2][]{%
\new@ifnextchar[{\@Glsuserv@{#1}{#2}}{\@Glsuserv@{#1}{#2}[]}}
\def\@Glsuserv@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentryuserv{#2}#3}%
}
\newrobustcmd*{\GLSuserv}{\@gls@hyp@opt\@GLSuserv}
\newcommand*{\@GLSuserv}[2][]{%
\new@ifnextchar[{\@GLSuserv@{#1}{#2}}{\@GLSuserv@{#1}{#2}[]}}
\def\@GLSuserv@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryuserv{#2}#3}}%
}
\newrobustcmd*{\glsuservi}{\@gls@hyp@opt\@glsuservi}
\newcommand*{\@glsuservi}[2][]{%
  \new@ifnextchar[{\@glsuservi@{#1}{#2}}{\@glsuservi@{#1}{#2}[]}}
\def\@glsuservi@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\glsentryuservi{#2}#3}%
}
\newrobustcmd*{\Glsuservi}{\@gls@hyp@opt\@Glsuservi}
\newcommand*{\@Glsuservi}[2][]{%
  \new@ifnextchar[{\@Glsuservi@{#1}{#2}}{\@Glsuservi@{#1}{#2}[]}}
\def\@Glsuservi@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\Glsentryuservi{#2}#3}%
}
\newrobustcmd*{\GLSuservi}{\@gls@hyp@opt\@GLSuservi}
\newcommand*{\@GLSuservi}[2][]{%
  \new@ifnextchar[{\@GLSuservi@{#1}{#2}}{\@GLSuservi@{#1}{#2}[]}}
\def\@GLSuservi@#1#2[#3]{%
  \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryuservi{#2}#3}}%
}
\newrobustcmd*{\acrshort}{\@gls@hyp@opt\ns@acrshort}
\newcommand*{\ns@acrshort}[2][]{%
  \new@ifnextchar[{\@acrshort{#1}{#2}}{\@acrshort{#1}{#2}[]}%
}
\def\@acrshort#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\glsentryshort{#2}}#3%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
\newrobustcmd*{\Acrshort}{\@gls@hyp@opt\ns@Acrshort}
\newcommand*{\ns@Acrshort}[2][]{%
  \new@ifnextchar[{\@Acrshort{#1}{#2}}{\@Acrshort{#1}{#2}[]}%
}
\def\@Acrshort#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \def\glslabel{#2}%
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@secondofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\Glsentryshort{#2}}#3%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
\newrobustcmd*{\ACRshort}{\@gls@hyp@opt\ns@ACRshort}
\newcommand*{\ns@ACRshort}[2][]{%
  \new@ifnextchar[{\@ACRshort{#1}{#2}}{\@ACRshort{#1}{#2}[]}%
}
\def\@ACRshort#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \def\glslabel{#2}%
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@thirdofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \mfirstucMakeUppercase{\acronymfont{\glsentryshort{#2}}#3}%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
\newrobustcmd*{\acrshortpl}{\@gls@hyp@opt\ns@acrshortpl}
\newcommand*{\ns@acrshortpl}[2][]{%
  \new@ifnextchar[{\@acrshortpl{#1}{#2}}{\@acrshortpl{#1}{#2}[]}%
}
\def\@acrshortpl#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \def\glslabel{#2}%
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\glsentryshortpl{#2}}#3%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
\newrobustcmd*{\Acrshortpl}{\@gls@hyp@opt\ns@Acrshortpl}
\newcommand*{\ns@Acrshortpl}[2][]{%
  \new@ifnextchar[{\@Acrshortpl{#1}{#2}}{\@Acrshortpl{#1}{#2}[]}%
}
\def\@Acrshortpl#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \def\glslabel{#2}%
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@secondofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\Glsentryshortpl{#2}}#3%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
\newrobustcmd*{\ACRshortpl}{\@gls@hyp@opt\ns@ACRshortpl}
\newcommand*{\ns@ACRshortpl}[2][]{%
  \new@ifnextchar[{\@ACRshortpl{#1}{#2}}{\@ACRshortpl{#1}{#2}[]}%
}
\def\@ACRshortpl#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \def\glslabel{#2}%
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@thirdofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \mfirstucMakeUppercase{\acronymfont{\glsentryshortpl{#2}}#3}%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
\newrobustcmd*{\acrlong}{\@gls@hyp@opt\ns@acrlong}
\newcommand*{\ns@acrlong}[2][]{%
  \new@ifnextchar[{\@acrlong{#1}{#2}}{\@acrlong{#1}{#2}[]}%
}
\def\@acrlong#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \def\glslabel{#2}%
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \glsentrylong{#2}#3%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
\newrobustcmd*{\Acrlong}{\@gls@hyp@opt\ns@Acrlong}
\newcommand*{\ns@Acrlong}[2][]{%
  \new@ifnextchar[{\@Acrlong{#1}{#2}}{\@Acrlong{#1}{#2}[]}%
}
\def\@Acrlong#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \def\glslabel{#2}%
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@secondofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \Glsentrylong{#2}#3%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
\newrobustcmd*{\ACRlong}{\@gls@hyp@opt\ns@ACRlong}
\newcommand*{\ns@ACRlong}[2][]{%
  \new@ifnextchar[{\@ACRlong{#1}{#2}}{\@ACRlong{#1}{#2}[]}%
}
\def\@ACRlong#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \def\glslabel{#2}%
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@thirdofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \mfirstucMakeUppercase{\glsentrylong{#2}#3}%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
\newrobustcmd*{\acrlongpl}{\@gls@hyp@opt\ns@acrlongpl}
\newcommand*{\ns@acrlongpl}[2][]{%
  \new@ifnextchar[{\@acrlongpl{#1}{#2}}{\@acrlongpl{#1}{#2}[]}%
}
\def\@acrlongpl#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \def\glslabel{#2}%
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \glsentrylongpl{#2}#3%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
\newrobustcmd*{\Acrlongpl}{\@gls@hyp@opt\ns@Acrlongpl}
\newcommand*{\ns@Acrlongpl}[2][]{%
  \new@ifnextchar[{\@Acrlongpl{#1}{#2}}{\@Acrlongpl{#1}{#2}[]}%
}
\def\@Acrlongpl#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \def\glslabel{#2}%
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@secondofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \Glsentrylongpl{#2}#3%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
\newrobustcmd*{\ACRlongpl}{\@gls@hyp@opt\ns@ACRlongpl}
\newcommand*{\ns@ACRlongpl}[2][]{%
  \new@ifnextchar[{\@ACRlongpl{#1}{#2}}{\@ACRlongpl{#1}{#2}[]}%
}
\def\@ACRlongpl#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \def\glslabel{#2}%
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@thirdofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \mfirstucMakeUppercase{\glsentrylongpl{#2}#3}%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
\newcommand*{\@gls@entry@field}[2]{%
  \csname glo@\glsdetoklabel{#1}@#2\endcsname
}
\newcommand*{\glsletentryfield}[3]{%
  \letcs{#1}{glo@\glsdetoklabel{#2}@#3}%
}
\newcommand*{\@Gls@entry@field}[2]{%
  \glsdoifexistsordo{#1}%
  {%
    \letcs\@glo@text{glo@\glsdetoklabel{#1}@#2}%
    \ifdef\@glo@text
    {%
      \xmakefirstuc{\@glo@text}%
    }%
    {%
      ??\PackageError{glossaries}{The field `#2' doesn't exist for glossary
      entry `\glsdetoklabel{#1}'}{Check you have correctly spelt the entry
      label and the field name}%
    }%
  }%
  {%
    ??%
  }%
}
\newcommand*{\glsentryname}[1]{\@gls@entry@field{#1}{name}}
\newrobustcmd*{\Glsentryname}[1]{%
  \@Gls@entryname{#1}%
}
\newcommand*{\@Gls@entryname}[1]{%
  \@Gls@entry@field{#1}{name}%
}
\newcommand*{\@Gls@acrentryname}[1]{%
  \ifglshaslong{#1}%
  {%
    \letcs\@glo@text{glo@\glsdetoklabel{#1}@name}%
    \expandafter\@gls@getbody\@glo@text{}\@nil
    \expandafter\ifx\@gls@body\glsentrylong\relax
      \expandafter\Glsentrylong\@gls@rest
    \else
      \expandafter\ifx\@gls@body\glsentryshort\relax
        \expandafter\Glsentryshort\@gls@rest
      \else
        \expandafter\ifx\@gls@body\acronymfont\relax
         {%
            \let\glsentryshort\Glsentryshort
            \@glo@text
         }%
        \else
          \expandafter\ifx\@gls@body\glsshortaccessdisplay\relax
            {%
              \let\glsentryshort\Glsentryshort
              \@glo@text
            }%
          \else
            \xmakefirstuc{\@glo@text}%
          \fi
        \fi
      \fi
    \fi
  }%
  {%
    \@Gls@entry@field{#1}{name}%
  }%
}
\newcommand*{\glsentrydesc}[1]{\@gls@entry@field{#1}{desc}}
\newrobustcmd*{\Glsentrydesc}[1]{%
  \@Gls@entry@field{#1}{desc}%
}
\newcommand*{\glsentrydescplural}[1]{%
  \@gls@entry@field{#1}{descplural}%
}
\newrobustcmd*{\Glsentrydescplural}[1]{%
  \@Gls@entry@field{#1}{descplural}%
}
\newcommand*{\glsentrytext}[1]{\@gls@entry@field{#1}{text}}
\newrobustcmd*{\Glsentrytext}[1]{%
  \@Gls@entry@field{#1}{text}%
}
\newcommand*{\glsentryplural}[1]{%
  \@gls@entry@field{#1}{plural}%
}
\newrobustcmd*{\Glsentryplural}[1]{%
  \@Gls@entry@field{#1}{plural}%
}
\newcommand*{\glsentrysymbol}[1]{%
  \@gls@entry@field{#1}{symbol}%
}
\newrobustcmd*{\Glsentrysymbol}[1]{%
  \@Gls@entry@field{#1}{symbol}%
}
\newcommand*{\glsentrysymbolplural}[1]{%
  \@gls@entry@field{#1}{symbolplural}%
}
\newrobustcmd*{\Glsentrysymbolplural}[1]{%
  \@Gls@entry@field{#1}{symbolplural}%
}
\newcommand*{\glsentryfirst}[1]{%
  \@gls@entry@field{#1}{first}%
}
\newrobustcmd*{\Glsentryfirst}[1]{%
  \@Gls@entry@field{#1}{first}%
}
\newcommand*{\glsentryfirstplural}[1]{%
  \@gls@entry@field{#1}{firstpl}%
}
\newrobustcmd*{\Glsentryfirstplural}[1]{%
  \@Gls@entry@field{#1}{firstpl}%
}
\newrobustcmd*{\@glsentrytitlecase}[2]{%
  \glsdoifexists{#1}%
  {%
    \glsfieldfetch{#1}{#2}{\@gls@value}%
    \xcapitalisewords{\@gls@value}%
  }%
}
\ifdef\texorpdfstring
{
  \newcommand*{\glsentrytitlecase}[2]{%
    \texorpdfstring
      {\@glsentrytitlecase{#1}{#2}}%
      {\@gls@entry@field{#1}{#2}}%
  }
}
{
  \newcommand*{\glsentrytitlecase}[2]{\@glsentrytitlecase{#1}{#2}}
}
\newcommand*{\glsentrytype}[1]{\@gls@entry@field{#1}{type}}
\newcommand*{\glsentrysort}[1]{%
  \@gls@entry@field{#1}{sort}%
}
\newcommand*{\glsentryparent}[1]{%
  \@gls@entry@field{#1}{parent}%
}
\newcommand*{\glsentryuseri}[1]{%
  \@gls@entry@field{#1}{useri}%
}
\newrobustcmd*{\Glsentryuseri}[1]{%
  \@Gls@entry@field{#1}{useri}%
}
\newcommand*{\glsentryuserii}[1]{%
  \@gls@entry@field{#1}{userii}%
}
\newrobustcmd*{\Glsentryuserii}[1]{%
  \@Gls@entry@field{#1}{userii}%
}
\newcommand*{\glsentryuseriii}[1]{%
  \@gls@entry@field{#1}{useriii}%
}
\newrobustcmd*{\Glsentryuseriii}[1]{%
  \@Gls@entry@field{#1}{useriii}%
}
\newcommand*{\glsentryuseriv}[1]{%
  \@gls@entry@field{#1}{useriv}%
}
\newrobustcmd*{\Glsentryuseriv}[1]{%
  \@Gls@entry@field{#1}{useriv}%
}
\newcommand*{\glsentryuserv}[1]{%
  \@gls@entry@field{#1}{userv}%
}
\newrobustcmd*{\Glsentryuserv}[1]{%
  \@Gls@entry@field{#1}{userv}%
}
\newcommand*{\glsentryuservi}[1]{%
  \@gls@entry@field{#1}{uservi}%
}
\newrobustcmd*{\Glsentryuservi}[1]{%
  \@Gls@entry@field{#1}{uservi}%
}
\newcommand*{\glsentryshort}[1]{\@gls@entry@field{#1}{short}}
\newrobustcmd*{\Glsentryshort}[1]{%
  \@Gls@entry@field{#1}{short}%
}
\newcommand*{\glsentryshortpl}[1]{\@gls@entry@field{#1}{shortpl}}
\newrobustcmd*{\Glsentryshortpl}[1]{%
  \@Gls@entry@field{#1}{shortpl}%
}
\newcommand*{\glsentrylong}[1]{\@gls@entry@field{#1}{long}}
\newrobustcmd*{\Glsentrylong}[1]{%
  \@Gls@entry@field{#1}{long}%
}
\newcommand*{\glsentrylongpl}[1]{\@gls@entry@field{#1}{longpl}}
\newrobustcmd*{\Glsentrylongpl}[1]{%
  \@Gls@entry@field{#1}{longpl}%
}
\newcommand*{\glsentryfull}[1]{%
  \acrfullformat{\glsentrylong{#1}}{\acronymfont{\glsentryshort{#1}}}%
}
\newrobustcmd*{\Glsentryfull}[1]{%
  \acrfullformat{\Glsentrylong{#1}}{\acronymfont{\glsentryshort{#1}}}%
}
\newcommand*{\glsentryfullpl}[1]{%
  \acrfullformat{\glsentrylongpl{#1}}{\acronymfont{\glsentryshortpl{#1}}}%
}
\newrobustcmd*{\Glsentryfullpl}[1]{%
  \acrfullformat{\Glsentrylongpl{#1}}{\acronymfont{\glsentryshortpl{#1}}}%
}
\newcommand*{\glsentrynumberlist}[1]{%
  \glsdoifexists{#1}%
  {%
    \@gls@entry@field{#1}{numberlist}%
  }%
}
\@ifpackageloaded{hyperref} {%
  \newcommand*{\glsdisplaynumberlist}[1]{%
    \GlossariesWarning
    {%
      \string\glsdisplaynumberlist\space
      doesn't work with hyperref.^^JUsing
      \string\glsentrynumberlist\space instead%
    }%
    \glsentrynumberlist{#1}%
  }%
}%
{%
  \newcommand*{\glsdisplaynumberlist}[1]{%
    \glsdoifexists{#1}%
    {%
      \bgroup
         \edef\@glo@label{\glsdetoklabel{#1}}%
         \let\@org@glsnumberformat\glsnumberformat
         \def\glsnumberformat##1{##1}%
         \protected@edef\the@numberlist{%
           \csname glo@\@glo@label @numberlist\endcsname}%
         \def\@gls@numlist@sep{}%
         \def\@gls@numlist@nextsep{}%
         \def\@gls@numlist@lastsep{}%
         \def\@gls@thislist{}%
         \def\@gls@donext@def{}%
         \renewcommand\do[1]{%
           \protected@edef\@gls@thislist{%
             \@gls@thislist
             \noexpand\@gls@numlist@sep
             ##1%
           }%
           \let\@gls@numlist@sep\@gls@numlist@nextsep
           \def\@gls@numlist@nextsep{\glsnumlistsep}%
           \@gls@donext@def
           \def\@gls@donext@def{%
             \def\@gls@numlist@lastsep{\glsnumlistlastsep}%
           }%
         }%
         \expandafter \glsnumlistparser \expandafter{\the@numberlist}%
         \let\@gls@numlist@sep\@gls@numlist@lastsep
         \@gls@thislist
      \egroup
    }%
  }
}
\newcommand*{\glsnumlistsep}{, }
\newcommand*{\glsnumlistlastsep}{ \& }
\newcommand*{\glshyperlink}[2][\glsentrytext{\@glo@label}]{%
 \def\@glo@label{#2}%
 \@glslink{\glolinkprefix\glsdetoklabel{#2}}{#1}}
\define@key{glossadd}{counter}{\def\@gls@counter{#1}}
\define@key{glossadd}{format}{\def\@glsnumberformat{#1}}
\define@key{glossadd}{types}{\def\@glo@type{#1}}
\newrobustcmd*{\glsadd}[2][]{%
  \@gls@adjustmode
  \glsdoifexists{#2}%
  {%
    \def\@glsnumberformat{glsnumberformat}%
    \edef\@gls@counter{\csname glo@\glsdetoklabel{#2}@counter\endcsname}%
    \setkeys{glossadd}{#1}%
    \@gls@saveentrycounter
    \@gls@setsort{#2}%
    \@@do@wrglossary{#2}%
  }%
}
\newcommand*{\@gls@adjustmode}{}
\AtBeginDocument{\renewcommand*{\@gls@adjustmode}{\ifvmode\mbox{}\fi}}
\newrobustcmd*{\glsaddall}[1][]{%
  \edef\@glo@type{\@glo@types}%
  \setkeys{glossadd}{#1}%
  \forallglsentries[\@glo@type]{\@glo@entry}{%
    \glsadd[#1]{\@glo@entry}%
  }%
}
\newrobustcmd*{\glsaddallunused}[1][\@glo@types]{%
 \forallglsentries[#1]{\@glo@entry}%
 {%
    \ifglsused{\@glo@entry}{}{\glsadd[format=glsignore]{\@glo@entry}}%
 }%
}
\newcommand*{\glsignore}[1]{}
\edef\glsopenbrace{\expandafter\@gobble\string\{}
\edef\glsclosebrace{\expandafter\@gobble\string\}}
\edef\glsbackslash{\expandafter\@gobble\string\\}
\edef\glsquote#1{\string"#1\string"}
\edef\glspercentchar{\expandafter\@gobble\string\%}
\edef\glstildechar{\string~}
\ifglsxindy
  \newcommand*{\@glsfirstletter}{A}
\fi
\newcommand*{\GlsSetXdyFirstLetterAfterDigits}{%
  \@ifstar\s@GlsSetXdyFirstLetterAfterDigits\@GlsSetXdyFirstLetterAfterDigits}
\ifglsxindy
  \newcommand*{\@GlsSetXdyFirstLetterAfterDigits}[1]{%
    \renewcommand*{\@glsfirstletter}{#1}}
  \newcommand*{\s@GlsSetXdyFirstLetterAfterDigits}[1]{%
    \renewcommand*{\@glsfirstletter}{#1}%
    \@onelevel@sanitize\@glsfirstletter
  }
\else
  \newcommand*{\@GlsSetXdyFirstLetterAfterDigits}[1]{%
    \glsnoxindywarning\GlsSetXdyFirstLetterAfterDigits}
  \newcommand*{\s@GlsSetXdyFirstLetterAfterDigits}{%
    \@GlsSetXdyFirstLetterAfterDigits
  }
\fi
\ifglsxindy
  \newcommand*{\@xdynumbergrouporder}{:before \string"\@glsfirstletter\string"}
\fi
\newcommand*{\GlsSetXdyNumberGroupOrder}[1]{%
 \@ifstar\s@GlsSetXdyNumberGroupOrder\@GlsSetXdyNumberGroupOrder
}
\ifglsxindy
  \newcommand*{\@GlsSetXdyNumberGroupOrder}[1]{%
    \renewcommand*{\@xdynumbergrouporder}{#1}%
  }
  \newcommand*{\s@GlsSetXdyNumberGroupOrder}[1]{%
    \renewcommand*{\@xdynumbergrouporder}{#1}%
    \@onelevel@sanitize\@xdynumbergrouporder
  }
\else
  \newcommand*{\@GlsSetXdyNumberGroupOrder}[1]{%
    \glsnoxindywarning\GlsSetXdyNumberGroupOrder}
  \newcommand*{\s@GlsSetXdyNumberGroupOrder}{%
    \@GlsSetXdyNumberGroupOrder}
\fi
\newcommand*{\@glsminrange}{2}
\ifglsxindy
  \newcommand*{\GlsSetXdyMinRangeLength}[1]{%
    \renewcommand*{\@glsminrange}{#1}}
\else
  \newcommand*{\GlsSetXdyMinRangeLength}[1]{%
    \glsnoxindywarning\GlsSetXdyMinRangeLength}
\fi

\ifglsxindy
  \def\writeist{%
    \ifundef{\glswrite}{\newwrite\glswrite}{}%
    \@gls@addpredefinedattributes
    \openout\glswrite=\istfilename
    \write\glswrite{;; xindy style file created by the glossaries
        package}%
    \write\glswrite{;; for document '\jobname' on
       \the\year-\the\month-\the\day}%
    \write\glswrite{^^J; required styles^^J}
    \@for\@xdystyle:=\@xdyrequiredstyles\do{%
         \ifx\@xdystyle\@empty
         \else
           \protected@write\glswrite{}{(require
             \string"\@xdystyle.xdy\string")}%
         \fi
    }%
    \write\glswrite{^^J%
       ; list of allowed attributes (number formats)^^J}%
    \write\glswrite{(define-attributes ((\@xdyattributes)))}%
    \write\glswrite{^^J; user defined alphabets^^J}%
    \write\glswrite{\@xdyuseralphabets}%
    \write\glswrite{^^J; location class definitions^^J}%
    \@for\@gls@classI:=\@gls@xdy@locationlist\do{%
      \protected@write\glswrite{}{(define-location-class
        \string"\@gls@classI\string"^^J\space\space\space
        (
          :sep "{}{"
          \csname @gls@xdy@Lclass@\@gls@classI\endcsname\space
          :sep "}"
        )
        ^^J\space\space\space
        :min-range-length \@glsminrange^^J%
        )
      }%
      {%
        \@for\@gls@classII:=\@gls@xdy@locationlist\do{%
          \protected@write\glswrite{}{(define-location-class
            \string"\@gls@classII-\@gls@classI\string"
              ^^J\space\space\space
            (
              :sep "{"
              \csname @gls@xdy@Lclass@\@gls@classII\endcsname\space
              :sep "}{"
              \csname @gls@xdy@Lclass@\@gls@classI\endcsname\space
              :sep "}"
            )
            ^^J\space\space\space
            :min-range-length \@glsminrange^^J%
            )
          }%
        }%
      }%
    }%
    \write\glswrite{^^J; user defined location classes}%
    \write\glswrite{\@xdyuserlocationdefs}%
    \write\glswrite{^^J; define cross-reference class^^J}%
    \write\glswrite{(define-crossref-class \string"see\string"
        :unverified )}%
    \write\glswrite{(markup-crossref-list
         :class \string"see\string"^^J\space\space\space
         :open \string"\string\glsseeformat\string"
         :close \string"{}\string")}%
    \@xdycrossrefhook
    \write\glswrite{^^J; define the order of the location classes}%
    \write\glswrite{(define-location-class-order
         (\@xdylocationclassorder))}%
    \write\glswrite{^^J; define the glossary markup^^J}%
    \write\glswrite{(markup-index^^J\space\space\space
        :open \string"\string
        \glossarysection[\string\glossarytoctitle]{\string
        \glossarytitle}\string\glossarypreamble}%
    \@for\@this@ctr:=\@xdycounters\do{%
      {%
        \@for\@this@attr:=\@xdyattributelist\do{%
           \protected@write\glswrite{}{\string\providecommand*%
             \expandafter\string
             \csname glsX\@this@ctr X\@this@attr\endcsname[2]%
             {%
                \string\setentrycounter
                  [\expandafter\@gobble\string\#1]{\@this@ctr}%
                \expandafter\string
                \csname\@this@attr\endcsname
                  {\expandafter\@gobble\string\#2}%
             }%
           }%
        }%
      }%
    }%
    \write\glswrite{%
        \string\begin
        {theglossary}\string\glossaryheader\glstildechar n\string" ^^J\space
        \space\space:close \string"\glspercentchar\glstildechar n\string
          \end{theglossary}\string\glossarypostamble
          \glstildechar n\string" ^^J\space\space\space
        :tree)}%
    \write\glswrite{(markup-letter-group-list
        :sep \string"\string\glsgroupskip\glstildechar n\string")}%
    \write\glswrite{(markup-indexentry
        :open \string"\string\relax \string\glsresetentrylist
           \glstildechar n\string")}%
    \write\glswrite{(markup-locclass-list :open
       \string"\glsopenbrace\string\glossaryentrynumbers
         \glsopenbrace\string\relax\space \string"^^J\space\space\space
       :sep \string", \string"
       :close \string"\glsclosebrace\glsclosebrace\string")}%
    \write\glswrite{(markup-locref-list
       :sep \string"\string\delimN\space\string")}%
    \write\glswrite{(markup-range
       :sep \string"\string\delimR\space\string")}%
    \@onelevel@sanitize\gls@suffixF
    \@onelevel@sanitize\gls@suffixFF
    \ifx\gls@suffixF\@empty
    \else
      \write\glswrite{(markup-range
        :close "\gls@suffixF" :length 1 :ignore-end)}%
    \fi
    \ifx\gls@suffixFF\@empty
    \else
      \write\glswrite{(markup-range
        :close "\gls@suffixFF" :length 2 :ignore-end)}%
    \fi
    \write\glswrite{^^J; define format to use for locations^^J}%
    \write\glswrite{\@xdylocref}%
    \write\glswrite{^^J; define letter group list format^^J}%
    \write\glswrite{(markup-letter-group-list
       :sep \string"\string\glsgroupskip\glstildechar n\string")}%
    \write\glswrite{^^J; letter group headings^^J}%
    \write\glswrite{(markup-letter-group
        :open-head \string"\string\glsgroupheading
        \glsopenbrace\string"^^J\space\space\space
        :close-head \string"\glsclosebrace\string")}%
    \write\glswrite{^^J; additional letter groups^^J}%
    \write\glswrite{\@xdylettergroups}%
    \write\glswrite{^^J; additional sort rules^^J}
    \write\glswrite{\@xdysortrules}%
    \@gls@writeisthook
    \closeout\glswrite
    \let\writeist\relax
  }
\else
  \edef\@gls@actualchar{\string?}
  \edef\@gls@encapchar{\string|}
  \edef\@gls@levelchar{\string!}
  \edef\@gls@quotechar{\string"}%
  \let\GlsSetQuote\gls@nosetquote
  \def\writeist{\relax
   \ifundef{\glswrite}{\newwrite\glswrite}{}\relax
   \openout\glswrite=\istfilename
    \write\glswrite{\glspercentchar\space makeindex style file
      created by the glossaries package}
    \write\glswrite{\glspercentchar\space for document
      '\jobname' on \the\year-\the\month-\the\day}
    \write\glswrite{actual '\@gls@actualchar'}
    \write\glswrite{encap '\@gls@encapchar'}
    \write\glswrite{level '\@gls@levelchar'}
    \write\glswrite{quote '\@gls@quotechar'}
    \write\glswrite{keyword \string"\string\\glossaryentry\string"}
    \write\glswrite{preamble \string"\string\\glossarysection[\string
      \\glossarytoctitle]{\string\\glossarytitle}\string
      \\glossarypreamble\string\n\string\\begin{theglossary}\string
      \\glossaryheader\string\n\string"}
    \write\glswrite{postamble \string"\string\%\string\n\string
      \\end{theglossary}\string\\glossarypostamble\string\n
      \string"}
    \write\glswrite{group_skip \string"\string\\glsgroupskip\string\n
      \string"}
    \write\glswrite{item_0 \string"\string\%\string\n\string"}
    \write\glswrite{item_1 \string"\string\%\string\n\string"}
    \write\glswrite{item_2 \string"\string\%\string\n\string"}
    \write\glswrite{item_01 \string"\string\%\string\n\string"}
    \write\glswrite{item_x1
      \string"\string\\relax \string\\glsresetentrylist\string\n
      \string"}
    \write\glswrite{item_12 \string"\string\%\string\n\string"}
    \write\glswrite{item_x2
      \string"\string\\relax \string\\glsresetentrylist\string\n
      \string"}
    \write\glswrite{delim_0 \string"\string\{\string
      \\glossaryentrynumbers\string\{\string\\relax \string"}
    \write\glswrite{delim_1 \string"\string\{\string
      \\glossaryentrynumbers\string\{\string\\relax \string"}
    \write\glswrite{delim_2 \string"\string\{\string
      \\glossaryentrynumbers\string\{\string\\relax \string"}
    \write\glswrite{delim_t \string"\string\}\string\}\string"}
    \write\glswrite{delim_n \string"\string\\delimN \string"}
    \write\glswrite{delim_r \string"\string\\delimR \string"}
    \write\glswrite{headings_flag 1}
    \write\glswrite{heading_prefix
       \string"\string\\glsgroupheading\string\{\string"}
    \write\glswrite{heading_suffix
       \string"\string\}\string\\relax
       \string\\glsresetentrylist \string"}
    \write\glswrite{symhead_positive \string"glssymbols\string"}
    \write\glswrite{numhead_positive \string"glsnumbers\string"}
    \write\glswrite{page_compositor \string"\glscompositor\string"}
    \@gls@escbsdq\gls@suffixF
    \@gls@escbsdq\gls@suffixFF
    \ifx\gls@suffixF\@empty
    \else
      \write\glswrite{suffix_2p \string"\gls@suffixF\string"}
    \fi
    \ifx\gls@suffixFF\@empty
    \else
      \write\glswrite{suffix_3p \string"\gls@suffixFF\string"}
    \fi
    \@gls@writeisthook
    \closeout\glswrite
    \let\writeist\relax
  }
\fi
\newcommand*{\GlsSetWriteIstHook}[1]{\renewcommand*{\@gls@writeisthook}{#1}}
\@onlypremakeg\GlsSetWriteIstHook
\newcommand*{\@gls@writeisthook}{}
\ifglsxindy
 \newcommand*{\GlsSetQuote}[1]{\glsnomakeindexwarning\GlsSetQuote}
 \newcommand*{\gls@nosetquote}[1]{\glsnomakeindexwarning\GlsSetQuote}
\else
 \newcommand*{\GlsSetQuote}[1]{\edef\@gls@quotechar{\string#1}%
    \@ifpackageloaded{tracklang}%
    {%
      \IfTrackedLanguage{german}%
      {%
        \def\@@gls@extramakeindexopts{-g}%
      }%
      {}%
    }%
    {}%
   \edef\@gls@docheckquotedef{%
     \noexpand\def\noexpand\@gls@checkquote####1#1####2#1####3\noexpand\null{%
       \noexpand\@gls@tmpb=\noexpand\expandafter{\noexpand\@gls@checkedmkidx}%
       \noexpand\toks@={####1}%
       \noexpand\ifx\noexpand\null####2\noexpand\null
        \noexpand\ifx\noexpand\null####3\noexpand\null
         \noexpand\edef\noexpand\@gls@checkedmkidx{%
           \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@}%
         \noexpand\def\noexpand\@@gls@checkquote{\noexpand\relax}%
        \noexpand\else
         \noexpand\edef\noexpand\@gls@checkedmkidx{%
           \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@
           \noexpand\@gls@quotechar\noexpand\@gls@quotechar
           \noexpand\@gls@quotechar\noexpand\@gls@quotechar}%
         \noexpand\def\noexpand\@@gls@checkquote{%
           \noexpand\@gls@checkquote####3\noexpand\null}%
        \noexpand\fi
       \noexpand\else
        \noexpand\edef\noexpand\@gls@checkedmkidx{%
          \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@
          \noexpand\@gls@quotechar\noexpand\@gls@quotechar}%
        \noexpand\ifx\noexpand\null####3\noexpand\null
          \noexpand\def\noexpand\@@gls@checkquote{%
            \noexpand\@gls@checkquote####2#1#1\noexpand\null}%
        \noexpand\else
          \noexpand\def\noexpand\@@gls@checkquote{%
            \noexpand\@gls@checkquote####2#1####3\noexpand\null}%
        \noexpand\fi
       \noexpand\fi
       \noexpand\@@gls@checkquote
     }%
   }%
   \@gls@docheckquotedef
   \edef\@gls@docheckquotedef{%
     \noexpand\renewcommand{\noexpand\@gls@checkmkidxchars}[1]{%
       \noexpand\def\noexpand\@gls@checkedmkidx{}%
       \noexpand\expandafter\noexpand\@gls@checkquote####1\noexpand\@nil
         #1#1\noexpand\null
       \noexpand\expandafter\noexpand\@gls@updatechecked
         \noexpand\@gls@checkedmkidx{####1}%
       \noexpand\def\noexpand\@gls@checkedmkidx{}%
       \noexpand\expandafter\noexpand\@gls@checkescquote####1\noexpand\@nil
         \expandonce{\csname#1\endcsname}\expandonce{\csname#1\endcsname}%
         \noexpand\null
       \noexpand\expandafter\noexpand\@gls@updatechecked
         \noexpand\@gls@checkedmkidx{####1}%
       \noexpand\def\noexpand\@gls@checkedmkidx{}%
       \noexpand\expandafter\noexpand\@gls@checkescactual####1\noexpand\@nil
         \noexpand\?\noexpand\?\noexpand\null
       \noexpand\expandafter\noexpand\@gls@updatechecked
         \noexpand\@gls@checkedmkidx{####1}%
       \noexpand\def\noexpand\@gls@checkedmkidx{}%
       \noexpand\expandafter\noexpand\@gls@checkactual####1\noexpand\@nil
         \noexpand?\noexpand?\noexpand\null
       \noexpand\expandafter\noexpand\@gls@updatechecked
         \noexpand\@gls@checkedmkidx{####1}%
       \noexpand\def\noexpand\@gls@checkedmkidx{}%
       \noexpand\expandafter\noexpand\@gls@checkbar####1\noexpand\@nil
         \noexpand|\noexpand|\noexpand\null
       \noexpand\expandafter\noexpand\@gls@updatechecked
         \noexpand\@gls@checkedmkidx{####1}%
       \noexpand\def\noexpand\@gls@checkedmkidx{}%
       \noexpand\expandafter\noexpand\@gls@checkescbar####1\noexpand\@nil
         \noexpand\|\noexpand\|\noexpand\null
       \noexpand\expandafter\noexpand\@gls@updatechecked
         \noexpand\@gls@checkedmkidx{####1}%
       \noexpand\def\noexpand\@gls@checkedmkidx{}%
       \noexpand\expandafter\noexpand\@gls@checklevel####1\noexpand\@nil
         \noexpand!\noexpand!\noexpand\null
       \noexpand\expandafter\noexpand\@gls@updatechecked
         \noexpand\@gls@checkedmkidx{####1}%
     }%
   }%
   \@gls@docheckquotedef
   \edef\@gls@docheckquotedef{%
     \noexpand\def\noexpand\@gls@checkescquote####1%
       \expandonce{\csname#1\endcsname}####2\expandonce{\csname#1\endcsname}%
       ####3\noexpand\null{%
       \noexpand\@gls@tmpb=\noexpand\expandafter{\noexpand\@gls@checkedmkidx}%
       \noexpand\toks@={####1}%
       \noexpand\ifx\noexpand\null####2\noexpand\null
        \noexpand\ifx\noexpand\null####3\noexpand\null
         \noexpand\edef\noexpand\@gls@checkedmkidx{%
           \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@}%
         \noexpand\def\noexpand\@@gls@checkescquote{\noexpand\relax}%
         \noexpand\else
         \noexpand\edef\noexpand\@gls@checkedmkidx{%
           \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@
           \noexpand\@gls@quotechar\noexpand\string\expandonce{%
             \csname#1\endcsname}\noexpand\@gls@quotechar
           \noexpand\@gls@quotechar\noexpand\string\expandonce{%
             \csname#1\endcsname}\noexpand\@gls@quotechar}%
         \noexpand\def\noexpand\@@gls@checkescquote{%
           \noexpand\@gls@checkescquote####3\noexpand\null}%
        \noexpand\fi
        \noexpand\else
        \noexpand\edef\noexpand\@gls@checkedmkidx{%
          \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@
          \noexpand\@gls@quotechar\noexpand\string
            \expandonce{\csname#1\endcsname}\noexpand\@gls@quotechar}%
        \noexpand\ifx\noexpand\null####3\noexpand\null
          \noexpand\def\noexpand\@@gls@checkescquote{%
           \noexpand\@gls@checkescquote####2\expandonce{\csname#1\endcsname}%
           \expandonce{\csname#1\endcsname}\noexpand\null}%
        \noexpand\else
          \noexpand\def\noexpand\@@gls@checkescquote{%
            \noexpand\@gls@checkescquote####2\expandonce{\csname#1\endcsname}%
            ####3\noexpand\null}%
        \noexpand\fi
       \noexpand\fi
      \noexpand\@@gls@checkescquote
     }%
   }%
   \@gls@docheckquotedef
 }
 \newcommand*{\gls@nosetquote}[1]{\PackageError{glossaries}%
   {\string\GlsSetQuote\space not permitted here}%
   {Move \string\GlsSetQuote\space earlier in the preamble, as
    soon as possible after glossaries.sty has been loaded}}
\fi
\newcommand*{\@gls@extramakeindexopts}[1]{}
\newcommand{\noist}{%
  \@gls@addpredefinedattributes
  \let\writeist\relax
}
\newcommand*{\@makeglossary}[1]{%
  \ifglossaryexists{#1}%
  {%
    \ifglssavewrites
      \expandafter\newtoks\csname glo@#1@filetok\endcsname
    \else
      \expandafter\newwrite\csname glo@#1@file\endcsname
      \expandafter\@glsopenfile\csname glo@#1@file\endcsname{#1}%
    \fi
    \@gls@renewglossary
    \writeist
  }%
  {%
    \PackageError{glossaries}%
    {Glossary type `#1' not defined}%
    {New glossaries must be defined before using \string\makeglossaries}%
  }%
}
\newcommand*{\@glsopenfile}[2]{%
  \immediate\openout#1=\jobname.\csname @glotype@#2@out\endcsname
  \PackageInfo{glossaries}{Writing glossary file
     \jobname.\csname @glotype@#2@out\endcsname}%
}
\newcommand*{\@closegls}[1]{%
  \closeout\csname glo@#1@file\endcsname
}
\ifglsxindy
 \newcommand*{\@gls@automake}[1]{%
   \ifglossaryexists{#1}
   {%
     \@closegls{#1}%
     \ifdefstring{\glsorder}{letter}%
      {\def\@gls@order{-M ord/letorder }}%
      {\let\@gls@order\@empty}%
     \ifcsundef{@xdy@#1@language}%
      {\let\@gls@langmod\@xdy@main@language}%
      {\letcs\@gls@langmod{@xdy@#1@language}}%
     \edef\@gls@dothiswrite{\noexpand\write18{xindy
       -I xindy
       \@gls@order
       -L \@gls@langmod\space
       -M \gls@istfilebase\space
       -C \gls@codepage\space
       -t \jobname.\csuse{@glotype@#1@log}
       -o \jobname.\csuse{@glotype@#1@in}
       \jobname.\csuse{@glotype@#1@out}}%
     }%
     \@gls@dothiswrite
   }%
   {%
     \GlossariesWarning{Can't make glossary `#1', it doesn't exist}%
   }%
 }
\else
 \newcommand*{\@gls@automake}[1]{%
   \ifglossaryexists{#1}
   {%
     \@closegls{#1}%
     \ifdefstring{\glsorder}{letter}%
      {\def\@gls@order{-l }}%
      {\let\@gls@order\@empty}%
     \edef\@gls@dothiswrite{\noexpand\write18{makeindex \@gls@order
       -s \istfilename\space
       -t \jobname.\csuse{@glotype@#1@log}
       -o \jobname.\csuse{@glotype@#1@in}
       \jobname.\csuse{@glotype@#1@out}}%
     }%
     \@gls@dothiswrite
   }%
   {%
     \GlossariesWarning{Can't make glossary `#1', it doesn't exist}%
   }%
 }
\fi
\ifglsxindy
 \newcommand*{\@gls@automake@immediate}[1]{%
   \ifglossaryexists{#1}
   {%
     \IfFileExists{\jobname.\csuse{@glotype@#1@out}}%
     {%
       \ifdefstring{\glsorder}{letter}%
        {\def\@gls@order{-M ord/letorder }}%
        {\let\@gls@order\@empty}%
       \ifcsundef{@xdy@#1@language}%
        {\let\@gls@langmod\@xdy@main@language}%
        {\letcs\@gls@langmod{@xdy@#1@language}}%
       \edef\@gls@dothiswrite{\noexpand\immediate\noexpand\write18{xindy
         -I xindy
         \@gls@order
         -L \@gls@langmod\space
         -M \gls@istfilebase\space
         -C \gls@codepage\space
         -t \jobname.\csuse{@glotype@#1@log}
         -o \jobname.\csuse{@glotype@#1@in}
         \jobname.\csuse{@glotype@#1@out}}%
       }%
       \@gls@dothiswrite
     }%
     {\GlossariesWarning{can't automake `#1': \jobname.\csuse{@glotype@#1@out}
      doesn't exist. Rerun may be required}}%
   }%
   {%
     \GlossariesWarning{Can't make glossary `#1', it doesn't exist}%
   }%
 }
\else
 \newcommand*{\@gls@automake@immediate}[1]{%
   \ifglossaryexists{#1}
   {%
     \IfFileExists{\jobname.\csuse{@glotype@#1@out}}%
     {%
       \ifdefstring{\glsorder}{letter}%
        {\def\@gls@order{-l }}%
        {\let\@gls@order\@empty}%
       \edef\@gls@dothiswrite{\noexpand\immediate\noexpand\write18{makeindex \@gls@order
         -s \istfilename\space
         -t \jobname.\csuse{@glotype@#1@log}
         -o \jobname.\csuse{@glotype@#1@in}
         \jobname.\csuse{@glotype@#1@out}}%
       }%
       \@gls@dothiswrite
     }%
     {\GlossariesWarning{can't automake `#1': \jobname.\csuse{@glotype@#1@out}
      doesn't exist. Rerun may be required}}%
   }%
   {%
     \GlossariesWarning{Can't make glossary `#1', it doesn't exist}%
   }%
 }
\fi
\newcommand*{\@warn@nomakeglossaries}{}
\newcommand*{\warn@nomakeglossaries}{\@warn@nomakeglossaries}
\newcommand{\@gls@@automake@immediate}{%
 \ifnum\gls@automake@nr=2\relax
   \@for\@gls@type:=\@glo@types\do{%
      \ifdefempty{\@gls@type}{}%
      {\@gls@automake@immediate{\@gls@type}}%
   }%
   \glsautomakefalse
   \renewcommand*{\@gls@doautomake}{}%
 \fi
}
\newcommand*{\makeglossaries}{%
 \@domakeglossaries
 {%
   \@gls@@automake@immediate
  \ifundef{\glswrite}{\newwrite\glswrite}{}%
  \protected@write\@auxout{}{\string\providecommand\string\@glsorder[1]{}}
  \protected@write\@auxout{}{\string\providecommand\string\@istfilename[1]{}}
  \ifundef\@@gls@extramakeindexopts
  {}%
  {%
    \protected@write\@auxout{}{\string\providecommand
       \string\@gls@extramakeindexopts[1]{}}
    \protected@write\@auxout{}{\string\@gls@extramakeindexopts
      {\@@gls@extramakeindexopts}}%
  }%
  \protected@write\@auxout{}{\string\@istfilename{\istfilename}}%
  \protected@write\@auxout{}{\string\@glsorder{\glsorder}}
  \@for\@glo@type:=\@glo@types\do{%
    \ifthenelse{\equal{\@glo@type}{}}{}{%
    \@makeglossary{\@glo@type}}%
  }%
  \renewcommand*\newglossary[4][]{%
  \PackageError{glossaries}{New glossaries
  must be created before \string\makeglossaries}{You need
  to move \string\makeglossaries\space after all your
  \string\newglossary\space commands}}%
  \let\@makeglossary\@gobble
  \let\makeglossaries\relax
  \@disable@onlypremakeg
  \let\gls@checkseeallowed\relax
  \let\warn@nomakeglossaries\relax
  \def\warn@noprintglossary{%
    \ifdefstring{\@glo@types}{,}%
    {%
      \GlossariesWarningNoLine{No glossaries have been defined}%
    }%
    {%
      \GlossariesWarningNoLine{No \string\printglossary\space
        or \string\printglossaries\space
        found. ^^J(Remove \string\makeglossaries\space if you
        don't want any glossaries.) ^^JThis document will not
        have a glossary}%
    }%
  }%
  \ifglssavenumberlist
    \edef\@gls@dodeflistparser{\noexpand\DeclareListParser
      {\noexpand\glsnumlistparser}{\delimN}}%
    \@gls@dodeflistparser
  \fi
  \let\makenoidxglossaries\@no@makeglossaries
  \renewcommand*{\@printgloss@setsort}{%
    \let\@glo@assign@sortkey\@glo@no@assign@sortkey
  }%
  \ifglsautomake
    \renewcommand*{\@gls@doautomake}{%
      \@for\@gls@type:=\@glo@types\do{%
        \ifdefempty{\@gls@type}{}%
        {\@gls@automake{\@gls@type}}%
      }%
    }%
  \fi
  \@glo@check@sortallowed\makeglossaries
 }%
}
\@onlypreamble{\makeglossaries}
\AtEndDocument{%
  \warn@nomakeglossaries
  \warn@noprintglossary
}
\newcommand*{\makenoidxglossaries}{%
 \@domakeglossaries
 {%
  \renewcommand{\@gls@noref@warn}[1]{%
    \GlossariesWarning{Empty glossary for
    \string\printnoidxglossary[type={##1}].
    Rerun may be required (or you may have forgotten to use
    commands like \string\gls)}%
  }%
  \let\@gls@checkmkidxchars\@gobble
  \glsesclocationsfalse
  \let\@@do@@wrglossary\gls@noidxglossary
  \let\@gls@getgrouptitle\@gls@noidx@getgrouptitle
  \let\gls@checkseeallowed\relax
  \renewcommand{\@do@seeglossary}[2]{%
    \edef\@gls@label{\glsdetoklabel{##1}}%
    \protected@write\@auxout{}{%
      \string\@gls@reference
        {\csname glo@\@gls@label @type\endcsname}%
        {\@gls@label}%
        {%
          \string\glsseeformat##2{}%
        }%
    }%
  }%
  \AtBeginDocument
  {%
    \write\@auxout{\string\providecommand\string\@gls@reference[3]{}}%
  }%
  \def\warn@noprintglossary{%
    \GlossariesWarningNoLine{No \string\printnoidxglossary\space
      or \string\printnoidxglossaries ^^J
      found. (Remove \string\makenoidxglossaries\space if you
      don't want any glossaries.)^^JThis document will not have a glossary}%
  }%
  \let\warn@nomakeglossaries\relax
  \let\makeglossaries\@no@makeglossaries
  \renewcommand*{\@printgloss@setsort}{%
    \let\@glo@assign@sortkey\@@glo@assign@sortkey
    \def\@glo@sorttype{\@glo@default@sorttype}%
  }%
  \renewcommand*\new@glossaryentry[2]{%
    \PackageError{glossaries}{Glossary entries must be
     defined in the preamble^^Jwhen you use
     \string\makenoidxglossaries}%
    {Either move your definitions to the preamble or use
     \string\makeglossaries}%
  }%
  \renewcommand*{\glsentrynumberlist}[1]{%
    \letcs{\@gls@loclist}{glo@\glsdetoklabel{##1}@loclist}%
    \ifdef\@gls@loclist
    {%
      \glsnoidxloclist{\@gls@loclist}%
    }%
    {%
      ??\glsdoifexists{##1}%
      {%
        \GlossariesWarning{Missing location list for `##1'. Either
          a rerun is required or you haven't referenced the entry}%
      }%
    }%
  }%
  \renewcommand*{\glsdisplaynumberlist}[1]{%
    \letcs{\@gls@loclist}{glo@\glsdetoklabel{##1}@loclist}%
    \ifdef\@gls@loclist
    {%
      \def\@gls@noidxloclist@sep{%
        \def\@gls@noidxloclist@sep{%
          \def\@gls@noidxloclist@sep{%
            \glsnumlistsep
          }%
          \def\@gls@noidxloclist@finalsep{\glsnumlistlastsep}%
        }%
      }%
      \def\@gls@noidxloclist@finalsep{}%
      \def\@gls@noidxloclist@prev{}%
      \forlistloop{\glsnoidxdisplayloclisthandler}{\@gls@loclist}%
      \@gls@noidxloclist@finalsep
      \@gls@noidxloclist@prev
    }%
    {%
      ??\glsdoifexists{##1}%
      {%
        \GlossariesWarning{Missing location list for `##1'. Either
          a rerun is required or you haven't referenced the entry}%
      }%
    }%
  }%
  \renewcommand*{\glsnumberlistloop}[3]{%
    \letcs{\@gls@loclist}{glo@\glsdetoklabel{##1}@loclist}%
    \let\@gls@org@glsnoidxdisplayloc\glsnoidxdisplayloc
    \let\@gls@org@glsseeformat\glsseeformat
    \let\glsnoidxdisplayloc##2\relax
    \let\glsseeformat##3\relax
    \ifdef\@gls@loclist
    {%
      \forlistloop{\glsnoidxnumberlistloophandler}{\@gls@loclist}%
    }%
    {%
      ??\glsdoifexists{##1}%
      {%
        \GlossariesWarning{Missing location list for `##1'. Either
          a rerun is required or you haven't referenced the entry}%
      }%
    }%
    \let\glsnoidxdisplayloc\@gls@org@glsnoidxdisplayloc
    \let\glsseeformat\@gls@org@glsseeformat
  }%
  \let\@@gls@sanitizesort\@gls@noidx@sanitizesort
  \let\@@gls@nosanitizesort\@@gls@noidx@nosanitizesort
  \@gls@noidx@setsanitizesort
  \@glo@check@sortallowed\makenoidxglossaries
 }%
}
\@onlypreamble{\makenoidxglossaries}
\newcommand*{\glsnumberlistloop}[2]{%
   \PackageError{glossaries}{\string\glsnumberlistloop\space
    only works with \string\makenoidxglossaries}{}%
}
\newcommand*{\glsnoidxnumberlistloophandler}[1]{%
  #1%
}
\newcommand*{\@no@makeglossaries}{%
  \PackageError{glossaries}{You can't use both
  \string\makeglossaries\space and \string\makenoidxglossaries}%
  {Either use one or other (or none) of those commands but not both
  together.}%
}
\newcommand{\@gls@noref@warn}[1]{%
  \GlossariesWarning{\string\makenoidxglossaries\space
   is required to make \string\printnoidxglossary[type={#1}] work}%
}
\newcommand*{\gls@noidxglossary}{%
  \protected@write\@auxout{}{%
    \string\@gls@reference
      {\csname glo@\@gls@label @type\endcsname}%
      {\@gls@label}%
      {\string\glsnoidxdisplayloc
        {\@glo@counterprefix}%
        {\@gls@counter}%
        {\@glsnumberformat}%
        {\@glslocref}%
      }%
  }%
}
\providecommand\istfile{\glswrite}
\AtEndDocument{%
  \glswritefiles
}
\newcommand*{\@glswritefiles}{%
  \forallglossaries{\@glo@type}{%
     \ifcsundef{glo@\@glo@type @filetok}%
     {%
        \def\gls@tmp{}%
     }%
     {%
        \edef\gls@tmp{\expandafter\the
           \csname glo@\@glo@type @filetok\endcsname}%
     }%
     \ifx\gls@tmp\@empty
        \ifx\@glo@type\glsdefaulttype
          \GlossariesWarningNoLine{Glossary `\@glo@type' has no
             entries.^^JRemember to use package option `nomain' if
you
             don't want to^^Juse the main glossary}%
        \else
          \GlossariesWarningNoLine{Glossary `\@glo@type' has no
             entries}%
        \fi
     \else
        \@glsopenfile{\glswrite}{\@glo@type}%
        \immediate\write\glswrite{%
           \expandafter\the
             \csname glo@\@glo@type @filetok\endcsname}%
        \immediate\closeout\glswrite
     \fi
  }%
}
\newcommand*{\gls@glossary}[1]{%
  \@gls@glossary{#1}%
}
\newcommand*{\@gls@glossary}[2]{%
  \if@gls@debug
    \PackageInfo{glossaries}{wrglossary(#1)(#2)}%
  \fi
}
\newcommand{\@gls@renewglossary}{%
  \gdef\@gls@glossary##1{\@bsphack\begingroup\gls@wrglossary{##1}}%
  \let\@gls@renewglossary\@empty
}
\newcommand*{\gls@wrglossary}[2]{%
  \ifglssavewrites
    \protected@edef\@gls@tmp{\the\csname glo@#1@filetok\endcsname#2}%
    \expandafter\global\expandafter\csname glo@#1@filetok\endcsname
       \expandafter{\@gls@tmp^^J}%
  \else
    \ifcsdef{glo@#1@file}%
    {%
      \expandafter\protected@write\csname glo@#1@file\endcsname{%
        \gls@disablepagerefexpansion}{#2}%
    }%
    {%
       \ifignoredglossary{#1}{}%
       {%
          \GlossariesWarning{No file defined for glossary `#1'}%
       }%
    }%
  \fi
  \endgroup\@esphack
}
\newcommand*{\@do@wrglossary}[1]{%
  \glswriteentry{#1}{\@@do@wrglossary{#1}}%
}
\newcommand*{\glswriteentry}[2]{%
  \ifglsindexonlyfirst
    \ifglsused{#1}{}{#2}%
  \else
    #2%
  \fi
}
\newcommand{\gls@protected@pagefmts}{\gls@numberpage,\gls@alphpage,%
 \gls@Alphpage,\gls@romanpage,\gls@Romanpage,\gls@arabicpage}
\newcommand*{\gls@disablepagerefexpansion}{%
  \@for\@gls@this:=\gls@protected@pagefmts\do
  {%
    \expandafter\let\@gls@this\relax
  }%
}
\newcommand*{\gls@alphpage}{\@alph\c@page}
\newcommand*{\gls@Alphpage}{\@Alph\c@page}
\newcommand*{\gls@numberpage}{\number\c@page}
\newcommand*{\gls@arabicpage}{\@arabic\c@page}
\newcommand*{\gls@romanpage}{\romannumeral\c@page}
\newcommand*{\gls@Romanpage}{\@Roman\c@page}
\newcommand*{\glsaddprotectedpagefmt}[1]{%
  \eappto\gls@protected@pagefmts{,\expandonce{\csname gls#1page\endcsname}}%
  \csedef{gls#1page}{\expandonce{\csname#1\endcsname}\noexpand\c@page}%
  \eappto\@wrglossarynumberhook{%
    \noexpand\let\expandonce{\csname org@gls#1\endcsname}%
      \expandonce{\csname#1\endcsname}%
    \noexpand\def\expandonce{\csname#1\endcsname}{%
      \noexpand\@wrglossary@pageformat
         \expandonce{\csname gls#1page\endcsname}%
         \expandonce{\csname org@gls#1\endcsname}%
    }%
  }%
}
\newcommand*\@wrglossarynumberhook{}
\newcommand{\@wrglossary@pageformat}[3]{%
  \ifx#3\c@page #1\else #2#3\fi
}
\newcommand*{\@@do@wrglossary}[1]{%
  \ifglsesclocations
    \@@do@esc@wrglossary{#1}%
  \else
    \@@do@noesc@wrglossary{#1}%
  \fi
}
\newcommand*{\@@do@noesc@wrglossary}[1]{%
  \expandafter\def\expandafter\@glslocref\expandafter{\theglsentrycounter}%
  \expandafter\def\expandafter\@glsHlocref\expandafter{\theHglsentrycounter}%
  \ifx\@glsHlocref\@glslocref
    \def\@glo@counterprefix{}%
  \else
    \protected@edef\@do@gls@getcounterprefix{\noexpand\@gls@getcounterprefix
      {\@glslocref}{\@glsHlocref}%
    }%
    \@do@gls@getcounterprefix
  \fi
  \edef\@gls@label{\glsdetoklabel{#1}}%
  \@@do@@wrglossary
}
\newif\ifglswrallowprimitivemods
\glswrallowprimitivemodstrue
\newcommand*{\@@do@esc@wrglossary}[1]{% please read documented code!
  \begingroup
    \let\gls@orgthe\the
    \let\gls@orgnumber\number
    \let\gls@orgarabic\@arabic
    \let\gls@orgromannumeral\romannumeral
    \let\gls@orgalph\@alph
    \let\gls@orgAlph\@Alph
    \let\gls@orgRoman\@Roman
    \ifglswrallowprimitivemods
      \def\gls@the##1{%
        \ifx##1\c@page \gls@numberpage\else\gls@orgthe##1\fi}%
      \def\the{\expandafter\gls@the}%
      \def\gls@number##1{%
        \ifx##1\c@page \gls@numberpage\else\gls@orgnumber##1\fi}%
      \def\number{\expandafter\gls@number}%
    \fi
    \def\@arabic##1{%
      \ifx##1\c@page \gls@arabicpage\else\gls@orgarabic##1\fi}%
    \def\romannumeral##1{%
      \ifx##1\c@page \gls@romanpage\else\gls@orgromannumeral##1\fi}%
    \def\@Roman##1{%
      \ifx##1\c@page \gls@Romanpage\else\gls@orgRoman##1\fi}%
    \def\@alph##1{%
      \ifx##1\c@page \gls@alphpage\else\gls@orgalph##1\fi}%
    \def\@Alph##1{%
      \ifx##1\c@page \gls@Alphpage\else\gls@orgAlph##1\fi}%
   \@wrglossarynumberhook
    \gls@disablepagerefexpansion
    \protected@xdef\@glslocref{\theglsentrycounter}%
  \endgroup
  \@gls@checkmkidxchars\@glslocref
  \expandafter\ifx\theHglsentrycounter\theglsentrycounter\relax
    \def\@glo@counterprefix{}%
  \else
    \protected@edef\@glsHlocref{\theHglsentrycounter}%
    \@gls@checkmkidxchars\@glsHlocref
    \edef\@do@gls@getcounterprefix{\noexpand\@gls@getcounterprefix
      {\@glslocref}{\@glsHlocref}%
    }%
    \@do@gls@getcounterprefix
  \fi
  \edef\@gls@label{\glsdetoklabel{#1}}%
  \@@do@@wrglossary
}
\newcommand*{\@@do@@wrglossary}{%
  \ifglsxindy
    \expandafter\@glo@check@mkidxrangechar\@glsnumberformat\@nil
    \def\@glo@range{}%
    \expandafter\if\@glo@prefix(\relax
      \def\@glo@range{:open-range}%
    \else
      \expandafter\if\@glo@prefix)\relax
        \def\@glo@range{:close-range}%
      \fi
    \fi
    \gls@glossary{\csname glo@\@gls@label @type\endcsname}{%
    (indexentry :tkey (\csname glo@\@gls@label @index\endcsname)
      :locref \string"{\@glo@counterprefix}{\@glslocref}\string" %
      :attr \string"\@gls@counter\@glo@suffix\string"
      \@glo@range
    )
    }%
  \else
    \@set@glo@numformat{\@glo@numfmt}{\@gls@counter}{\@glsnumberformat}%
      {\@glo@counterprefix}%
    \gls@glossary{\csname glo@\@gls@label @type\endcsname}{%
    \string\glossaryentry{\csname glo@\@gls@label @index\endcsname
      \@gls@encapchar\@glo@numfmt}{\@glslocref}}%
  \fi
}
\newcommand*\@gls@getcounterprefix[2]{%
  \edef\@gls@thisloc{#1}\edef\@gls@thisHloc{#2}%
  \ifx\@gls@thisloc\@gls@thisHloc
    \def\@glo@counterprefix{}%
  \else
    \def\@gls@get@counterprefix##1.#1##2\end@getprefix{%
      \def\@glo@tmp{##2}%
      \ifx\@glo@tmp\@empty
        \def\@glo@counterprefix{}%
      \else
        \def\@glo@counterprefix{##1}%
      \fi
    }%
    \@gls@get@counterprefix#2.#1\end@getprefix
    \ifx\@glo@counterprefix\@empty
      \GlossariesWarning{Hyper target `#2' can't be formed by
       prefixing^^Jlocation `#1'. You need to modify the
       definition of \string\theH\@gls@counter^^Jotherwise you
       will get the warning: "`name{\@gls@counter.#1}' has been^^J
       referenced but does not exist"}%
    \fi
  \fi
}
\newcommand{\@do@seeglossary}[2]{%
\def\@gls@xref{#2}%
\@onelevel@sanitize\@gls@xref
\@gls@checkmkidxchars\@gls@xref
\ifglsxindy
  \gls@glossary{\csname glo@#1@type\endcsname}{%
    (indexentry
      :tkey (\csname glo@#1@index\endcsname)
      :xref (\string"\@gls@xref\string")
      :attr \string"see\string"
    )
  }%
\else
  \gls@glossary{\csname glo@#1@type\endcsname}{%
  \string\glossaryentry{\csname glo@#1@index\endcsname
  \@gls@encapchar glsseeformat\@gls@xref}{Z}}%
\fi
}
\def\@gls@fixbraces#1#2#3\@nil{%
  \ifx#2[\relax
   \@@gls@fixbraces#1#2#3\@end@fixbraces
  \else
    \def#1{{#2#3}}%
  \fi
}
\def\@@gls@fixbraces#1[#2]#3\@end@fixbraces{%
  \def#1{[#2]{#3}}%
}
\newrobustcmd*{\glssee}[3][\seename]{%
  \@do@seeglossary{#2}{[#1]{#3}}}
\newcommand*{\@glssee}[3][\seename]{%
  \glssee[#1]{#3}{#2}}
\newrobustcmd*{\glsseeformat}[3][\seename]{%
  \emph{#1} \glsseelist{#2}}
\newrobustcmd*{\glsseelist}[1]{%
  \let\@gls@dolast\relax
  \let\@gls@donext\relax
  \@for\@gls@thislabel:=#1\do{%
    \ifx\@xfor@nextelement\@nnil
      \@gls@dolast
    \else
      \@gls@donext
    \fi
    \expandafter\glsseeitem\expandafter{\@gls@thislabel}%
    \let\@gls@dolast\glsseelastsep
    \let\@gls@donext\glsseesep
  }%
}
\newcommand*{\glsseelastsep}{\space\andname\space}
\newcommand*{\glsseesep}{, }
\newrobustcmd*{\glsseeitem}[1]{\glshyperlink[\glsseeitemformat{#1}]{#1}}
\newcommand*{\glsseeitemformat}[1]{\glsentrytext{#1}}
\newcommand*{\gls@save@numberlist}[1]{%
  \ifglssavenumberlist
    \toks@{#1}%
    \edef\@do@writeaux@info{%
        \noexpand\csgdef{glo@\glscurrententrylabel @numberlist}{\the\toks@}%
    }%
    \@onelevel@sanitize\@do@writeaux@info
    \protected@write\@auxout{}{\@do@writeaux@info}%
  \fi
}
\newcommand*{\warn@noprintglossary}{}%
\ifcsundef{printglossary}{}%
{%
  \@gls@warnonglossdefined
  \undef\printglossary
}
\newcommand*{\@printgloss@checkexists@noignored}[2]{%
  \@ifglossaryexists{#1}%
  {#2}%
  {%
    \ifignoredglossary{#1}%
    {\GlossariesWarning{Glossary `#1' is an ignored glossary}}%
    {\GlossariesWarning{Glossary `#1' doesn't exist}}%
  }%
}
\newcommand*{\@printgloss@checkexists@allowignored}[2]{%
  \s@ifglossaryexists{#1}%
  {#2}%
  {\GlossariesWarning{Glossary `#1' doesn't exist}}%
}
\let\@printgloss@checkexists\@printgloss@checkexists@noignored
\newcommand*{\printglossary}[1][type=\glsdefaulttype]{%
  \let\@printgloss@checkexists\@printgloss@checkexists@noignored
  \@printglossary{#1}{\@print@glossary}%
}
\newcommand*{\printglossaries}{%
  \forallglossaries{\@@glo@type}{\printglossary[type=\@@glo@type]}%
}
\newcommand*{\printnoidxglossary}[1][type=\glsdefaulttype]{%
  \let\@printgloss@checkexists\@printgloss@checkexists@noignored
  \@printglossary{#1}{\@print@noidx@glossary}%
}
\newcommand*{\printnoidxglossaries}{%
  \forallglossaries{\@@glo@type}{\printnoidxglossary[type=\@@glo@type]}%
}
\newcommand*{\@printgloss@setsort}{}
\newcommand*{\@gls@preglossaryhook}{}
\newcommand{\@printglossary}[2]{%
  \def\@glo@type{\glsdefaulttype}%
  \def\glossarytitle{\csname @glotype@\@glo@type @title\endcsname}%
  \def\glossarytoctitle{\glossarytitle}%
  \let\org@glossarytitle\glossarytitle
  \def\@glossarystyle{%
    \ifx\@glossary@default@style\relax
      \GlossariesWarning{No default glossary style provided \MessageBreak
        for the glossary `\@glo@type'. \MessageBreak
        Using deprecated fallback. \MessageBreak
        To fix this set the style with \MessageBreak
        \string\setglossarystyle\space or use the \MessageBreak
        style key=value option}%
    \fi
  }%
  \def\gls@dotoctitle{\glssettoctitle{\@glo@type}}%
  \let\@org@glossaryentrynumbers\glossaryentrynumbers
  \bgroup
   \@printgloss@setsort
   \setkeys{printgloss}{#1}%
   \@printgloss@checkexists{\@glo@type}%
   {%
    \ifx\glossarytitle\org@glossarytitle
    \else
      \expandafter\let\csname @glotype@\@glo@type @title\endcsname
                    \glossarytitle
    \fi
    \let\currentglossary\@glo@type
    \let\org@glossaryentrynumbers\glossaryentrynumbers
    \let\glsnonextpages\@glsnonextpages
    \let\glsnextpages\@glsnextpages
    \let\nopostdesc\@nopostdesc
    \gls@dotoctitle
    \@glossarystyle
    \let\gls@org@glossaryentryfield\glossentry
    \let\gls@org@glossarysubentryfield\subglossentry
    \renewcommand{\glossentry}[1]{%
      \xdef\glscurrententrylabel{\glsdetoklabel{##1}}%
      \gls@org@glossaryentryfield{##1}%
    }%
    \renewcommand{\subglossentry}[2]{%
      \xdef\glscurrententrylabel{\glsdetoklabel{##2}}%
      \gls@org@glossarysubentryfield{##1}{##2}%
    }%
    \@gls@preglossaryhook
    #2%
   }%
  \egroup
  \global\let\glossaryentrynumbers\@org@glossaryentrynumbers
  \global\let\warn@noprintglossary\relax
}
\newcommand{\@print@glossary}{%
  \makeatletter
  \@input@{\jobname.\csname @glotype@\@glo@type @in\endcsname}%
  \IfFileExists{\jobname.\csname @glotype@\@glo@type @in\endcsname}%
  {}%
  {\null}%
  \ifglsxindy
    \ifcsundef{@xdy@\@glo@type @language}%
    {%
      \edef\@do@auxoutstuff{%
        \noexpand\AtEndDocument{%
          \noexpand\immediate\noexpand\write\@auxout{%
            \string\providecommand\string\@xdylanguage[2]{}}%
          \noexpand\immediate\noexpand\write\@auxout{%
            \string\@xdylanguage{\@glo@type}{\@xdy@main@language}}%
        }%
      }%
    }%
    {%
      \edef\@do@auxoutstuff{%
        \noexpand\AtEndDocument{%
          \noexpand\immediate\noexpand\write\@auxout{%
            \string\providecommand\string\@xdylanguage[2]{}}%
          \noexpand\immediate\noexpand\write\@auxout{%
            \string\@xdylanguage{\@glo@type}{\csname @xdy@\@glo@type
              @language\endcsname}}%
        }%
      }%
    }%
    \@do@auxoutstuff
    \edef\@do@auxoutstuff{%
      \noexpand\AtEndDocument{%
         \noexpand\immediate\noexpand\write\@auxout{%
          \string\providecommand\string\@gls@codepage[2]{}}%
         \noexpand\immediate\noexpand\write\@auxout{%
          \string\@gls@codepage{\@glo@type}{\gls@codepage}}%
      }%
    }%
    \@do@auxoutstuff
  \fi
  \renewcommand*{\@warn@nomakeglossaries}{%
    \GlossariesWarningNoLine{\string\makeglossaries\space
    hasn't been used,^^Jthe glossaries will not be updated}%
  }%
}
\newcommand*{\@glo@sortentries}[2]{%
  \glosortentrieswarning
  \def\@glo@sortinglist{}%
  \def\@glo@sortinghandler{#1}%
  \edef\@glo@type{#2}%
  \forlistcsloop{\@glo@do@sortentries}{@glsref@#2}%
  \csdef{@glsref@#2}{}%
  \@for\@this@label:=\@glo@sortinglist\do{%
    \xifinlistcs{\@this@label}{@glsref@#2}%
    {}%
    {%
      \listcsxadd{@glsref@#2}{\@this@label}%
    }%
    \ifcsdef{@glo@sortingchildren@\@this@label}%
    {%
      \@glo@addchildren{#2}{\@this@label}%
    }%
    {}%
  }%
}
\newcommand*{\@glo@addchildren}[2]{%
  \bgroup
     \letcs{\@glo@childlist}{@glo@sortingchildren@#2}%
     \@for\@this@childlabel:=\@glo@childlist\do
     {%
       \xifinlistcs{\@this@childlabel}{@glsref@#1}%
       {}%
       {%
         \listcsxadd{@glsref@#1}{\@this@childlabel}%
       }%
       \ifcsdef{@glo@sortingchildren@\@this@childlabel}%
       {%
         \@glo@addchildren{#1}{\@this@childlabel}%
       }%
       {%
       }%
     }%
  \egroup
}
\newcommand*{\@glo@do@sortentries}[1]{%
  \ifglshasparent{#1}%
  {%
    \edef\@glo@parent{\csuse{glo@\glsdetoklabel{#1}@parent}}%
    \ifcsundef{@glo@sortingchildren@\@glo@parent}%
    {%
      \csdef{@glo@sortingchildren@\@glo@parent}{}%
    }%
    {}%
    \expandafter\@glo@sortedinsert
      \csname @glo@sortingchildren@\@glo@parent\endcsname{#1}%
    \xifinlistcs{\@glo@parent}{@glsref@\@glo@type}%
    {%
    }%
    {%
       \expandafter\@glo@do@sortentries\expandafter{\@glo@parent}%
    }%
  }%
  {%
    \@glo@sortedinsert{\@glo@sortinglist}{#1}%
  }%
}
\newcommand*{\@glo@sortedinsert}[2]{%
  \dtl@insertinto{#2}{#1}{\@glo@sortinghandler}%
}%
\newcommand*{\@glo@sorthandler@word}[2]{%
  \letcs\@gls@sort@A{glo@\glsdetoklabel{#1}@sort}%
  \letcs\@gls@sort@B{glo@\glsdetoklabel{#2}@sort}%
  \edef\glo@do@compare{%
    \noexpand\dtlwordindexcompare{\noexpand\dtl@sortresult}%
    {\expandonce\@gls@sort@B}%
    {\expandonce\@gls@sort@A}%
  }%
  \glo@do@compare
}
\newcommand*{\@glo@sorthandler@letter}[2]{%
  \letcs\@gls@sort@A{glo@\glsdetoklabel{#1}@sort}%
  \letcs\@gls@sort@B{glo@\glsdetoklabel{#2}@sort}%
  \edef\glo@do@compare{%
    \noexpand\dtlletterindexcompare{\noexpand\dtl@sortresult}%
    {\expandonce\@gls@sort@B}%
    {\expandonce\@gls@sort@A}%
  }%
  \glo@do@compare
}
\newcommand*{\@glo@sorthandler@case}[2]{%
  \letcs\@gls@sort@A{glo@\glsdetoklabel{#1}@sort}%
  \letcs\@gls@sort@B{glo@\glsdetoklabel{#2}@sort}%
  \edef\glo@do@compare{%
    \noexpand\dtlcompare{\noexpand\dtl@sortresult}%
    {\expandonce\@gls@sort@B}%
    {\expandonce\@gls@sort@A}%
  }%
  \glo@do@compare
}
\newcommand*{\@glo@sorthandler@nocase}[2]{%
  \letcs\@gls@sort@A{glo@\glsdetoklabel{#1}@sort}%
  \letcs\@gls@sort@B{glo@\glsdetoklabel{#2}@sort}%
  \edef\glo@do@compare{%
    \noexpand\dtlicompare{\noexpand\dtl@sortresult}%
    {\expandonce\@gls@sort@B}%
    {\expandonce\@gls@sort@A}%
  }%
  \glo@do@compare
}
\newcommand*{\@glo@sortmacro@word}[1]{%
  \ifdefstring{\@glo@default@sorttype}{standard}%
  {%
    \@glo@sortentries{\@glo@sorthandler@word}{#1}%
  }%
  {%
    \PackageError{glossaries}{Conflicting sort options:^^J
     \string\usepackage[sort=\@glo@default@sorttype]{glossaries}^^J
     \string\printnoidxglossary[sort=word]}{}%
  }%
}
\newcommand*{\@glo@sortmacro@letter}[1]{%
  \ifdefstring{\@glo@default@sorttype}{standard}%
  {%
    \@glo@sortentries{\@glo@sorthandler@letter}{#1}%
  }%
  {%
    \PackageError{glossaries}{Conflicting sort options:^^J
     \string\usepackage[sort=\@glo@default@sorttype]{glossaries}^^J
     \string\printnoidxglossary[sort=letter]}{}%
  }%
}
\newcommand*{\@glo@sortmacro@standard}[1]{%
  \ifdefstring{\@glo@default@sorttype}{standard}%
  {%
    \ifcsdef{@glo@sorthandler@\glsorder}%
    {%
      \@glo@sortentries{\csuse{@glo@sorthandler@\glsorder}}{#1}%
    }%
    {%
      \PackageError{glossaries}{Unknown sort handler `\glsorder'}{}%
    }%
  }%
  {%
    \PackageError{glossaries}{Conflicting sort options:^^J
     \string\usepackage[sort=\@glo@default@sorttype]{glossaries}^^J
     \string\printnoidxglossary[sort=standard]}{}%
  }%
}
\newcommand*{\@glo@sortmacro@case}[1]{%
  \ifdefstring{\@glo@default@sorttype}{standard}%
  {%
    \@glo@sortentries{\@glo@sorthandler@case}{#1}%
  }%
  {%
    \PackageError{glossaries}{Conflicting sort options:^^J
     \string\usepackage[sort=\@glo@default@sorttype]{glossaries}^^J
     \string\printnoidxglossary[sort=case]}{}%
  }%
}
\newcommand*{\@glo@sortmacro@nocase}[1]{%
  \ifdefstring{\@glo@default@sorttype}{standard}%
  {%
    \@glo@sortentries{\@glo@sorthandler@nocase}{#1}%
  }%
  {%
    \PackageError{glossaries}{Conflicting sort options:^^J
     \string\usepackage[sort=\@glo@default@sorttype]{glossaries}^^J
     \string\printnoidxglossary[sort=nocase]}{}%
  }%
}
\newcommand*{\@glo@sortmacro@def}[1]{%
  \def\@glo@sortinglist{}%
  \forglsentries[#1]{\@gls@thislabel}%
  {%
    \xifinlistcs{\@gls@thislabel}{@glsref@#1}%
    {%
      \listeadd{\@glo@sortinglist}{\@gls@thislabel}%
    }%
    {%
    }%
  }%
  \cslet{@glsref@#1}{\@glo@sortinglist}%
}
\newcommand*{\@glo@sortmacro@def@do}[1]{%
  \ifinlistcs{#1}{@glsref@\@glo@type}%
  {}%
  {%
    \listcsadd{@glsref@\@glo@type}{#1}%
  }%
  \ifcsdef{@glo@sortingchildren@#1}%
  {%
    \@glo@addchildren{\@glo@type}{#1}%
  }%
  {}%
}
\newcommand*{\@glo@sortmacro@use}[1]{}
\newcommand*{\@print@noidx@glossary}{%
  \ifcsdef{@glsref@\@glo@type}%
  {%
    \ifcsdef{@glo@sortmacro@\@glo@sorttype}%
    {%
      \csuse{@glo@sortmacro@\@glo@sorttype}{\@glo@type}%
    }%
    {%
       \PackageError{glossaries}{Unknown sort handler `\@glo@sorttype'}{}%
    }%
    \glossarysection[\glossarytoctitle]{\glossarytitle}%
    \glossarypreamble
    \def\@gls@currentlettergroup{}%
    \begin{theglossary}%
    \glossaryheader
    \glsresetentrylist
   \forlistcsloop{\@gls@noidx@do}{@glsref@\@glo@type}%
    \end{theglossary}%
    \glossarypostamble
  }%
  {%
    \@gls@noref@warn{\@glo@type}%
  }%
}
\def\glo@grabfirst#1#2\@nil{%
  \def\@gls@firsttok{#1}%
  \ifdefempty\@gls@firsttok
  {%
    \def\@glo@thislettergrp{0}%
  }%
  {%
    \@onelevel@sanitize\@gls@firsttok
    \expandafter\@glo@grabfirst\@gls@firsttok{}{}\@nil
  }%
}
\def\@glo@grabfirst#1#2\@nil{%
  \ifdefempty\@glo@thislettergrp
  {%
     \def\@glo@thislettergrp{glssymbols}%
  }%
  {%
    \count@=\uccode`#1\relax
    \ifnum\count@=0\relax
      \def\@glo@thislettergrp{glssymbols}%
    \else
      \ifdefstring\@glo@sorttype{case}%
      {%
         \count@=`#1\relax
      }%
      {%
      }%
      \edef\@glo@thislettergrp{\the\count@}%
    \fi
  }%
}
\newcommand{\@gls@noidx@do}[1]{%
  \global\letcs{\@gls@loclist}{glo@\glsdetoklabel{#1}@loclist}%
  \ifglshasparent{#1}%
  {%
    \gls@level=\csuse{glo@\glsdetoklabel{#1}@level}\relax
    \ifdefvoid{\@gls@loclist}
    {%
      \subglossentry{\gls@level}{#1}{}%
    }%
    {%
      \subglossentry{\gls@level}{#1}%
      {%
        \glossaryentrynumbers{\glsnoidxloclist{\@gls@loclist}}%
      }%
    }%
  }%
  {%
    \letcs{\@gls@sort}{glo@\glsdetoklabel{#1}@sort}%
    \expandafter\glo@grabfirst\@gls@sort{}{}\@nil
    \ifdefequal{\@glo@thislettergrp}{\@gls@currentlettergroup}%
    {}%
    {%
      \ifdefempty{\@gls@currentlettergroup}{}%
      {%
        \global\let\@glo@thislettergrp\@glo@thislettergrp
        \glsgroupskip
      }%
      \glsgroupheading{\@glo@thislettergrp}%
    }%
    \global\let\@gls@currentlettergroup\@glo@thislettergrp
    \ifdefvoid{\@gls@loclist}
    {%
      \glossentry{#1}{}%
    }%
    {%
      \glossentry{#1}%
      {%
        \glossaryentrynumbers{\glsnoidxloclist{\@gls@loclist}}%
      }%
    }%
  }%
}
\newcommand*{\glsnoidxloclist}[1]{%
  \def\@gls@noidxloclist@sep{}%
  \def\@gls@noidxloclist@prev{}%
  \forlistloop{\glsnoidxloclisthandler}{#1}%
}
\newcommand*{\glsnoidxloclisthandler}[1]{%
  \ifdefstring{\@gls@noidxloclist@prev}{#1}%
  {%
  }%
  {%
    \@gls@noidxloclist@sep
    #1%
    \def\@gls@noidxloclist@sep{\delimN}%
    \def\@gls@noidxloclist@prev{#1}%
  }%
}
\newcommand*{\glsnoidxdisplayloclisthandler}[1]{%
  \ifdefstring{\@gls@noidxloclist@prev}{#1}%
  {%
  }%
  {%
    \@gls@noidxloclist@sep
    \@gls@noidxloclist@prev
    \def\@gls@noidxloclist@prev{#1}%
  }%
}
\newcommand*\glsnoidxdisplayloc[4]{%
  \setentrycounter[#1]{#2}%
  \csuse{#3}{#4}%
}
\newcommand*{\@gls@reference}[3]{%
  \glsdoifexistsorwarn{#2}%
  {%
    \ifcsundef{@glsref@#1}{\csgdef{@glsref@#1}{}}{}%
    \ifinlistcs{#2}{@glsref@#1}%
    {}%
    {\listcsgadd{@glsref@#1}{#2}}%
    \ifcsundef{glo@\glsdetoklabel{#2}@loclist}%
    {\csgdef{glo@\glsdetoklabel{#2}@loclist}{}}%
    {}%
    \listcsgadd{glo@\glsdetoklabel{#2}@loclist}{#3}%
  }%
}
\define@key{printgloss}{type}{\def\@glo@type{#1}}
\define@key{printgloss}{title}{%
 \def\glossarytitle{#1}%
 \let\gls@dotoctitle\relax
}
\define@key{printgloss}{toctitle}{%
 \def\glossarytoctitle{#1}%
 \let\gls@dotoctitle\relax
}
\define@key{printgloss}{style}{%
  \ifcsundef{@glsstyle@#1}%
  {%
    \PackageError{glossaries}%
    {Glossary style `#1' undefined}{}%
  }%
  {%
    \def\@glossarystyle{\setglossentrycompatibility
      \csname @glsstyle@#1\endcsname}%
  }%
}
\define@choicekey{printgloss}{numberedsection}%
 [\gls@numberedsection@val\gls@numberedsection@nr]%
 {false,nolabel,autolabel,nameref}[nolabel]%
{%
  \ifcase\gls@numberedsection@nr\relax
    \renewcommand*{\@@glossarysecstar}{*}%
    \renewcommand*{\@@glossaryseclabel}{}%
  \or
    \renewcommand*{\@@glossarysecstar}{}%
    \renewcommand*{\@@glossaryseclabel}{}%
  \or
    \renewcommand*{\@@glossarysecstar}{}%
    \renewcommand*{\@@glossaryseclabel}{\label{\glsautoprefix\@glo@type}}%
  \or
    \renewcommand*{\@@glossarysecstar}{*}%
    \renewcommand*{\@@glossaryseclabel}{%
      \protected@edef\@currentlabelname{\glossarytoctitle}%
      \label{\glsautoprefix\@glo@type}}%
  \fi
}
\define@choicekey{printgloss}{nogroupskip}{true,false}[true]{%
  \csuse{glsnogroupskip#1}%
}
\define@choicekey{printgloss}{nopostdot}{true,false}[true]{%
  \csuse{glsnopostdot#1}%
}
\newcommand*{\GlsEntryCounterLabelPrefix}{glsentry-}
\define@choicekey{printgloss}{entrycounter}{true,false}[true]{%
  \csuse{glsentrycounter#1}%
  \@gls@define@glossaryentrycounter
}
\define@choicekey{printgloss}{subentrycounter}{true,false}[true]{%
  \csuse{glssubentrycounter#1}%
  \@gls@define@glossarysubentrycounter
}
\define@boolkey{printgloss}[gls]{nonumberlist}[true]{%
\ifglsnonumberlist
   \def\glossaryentrynumbers##1{}%
\else
   \def\glossaryentrynumbers##1{##1}%
\fi}
\define@key{printgloss}{sort}{\@glo@assign@sortkey{#1}}
\newcommand*{\@glo@no@assign@sortkey}[1]{%
   \PackageError{glossaries}{`sort' key not permitted with
   \string\printglossary}%
   {The `sort' key may only be used with \string\printnoidxglossary}%
}
\newcommand*{\@@glo@assign@sortkey}[1]{%
  \def\@glo@sorttype{#1}%
}
\newcommand*{\@glsnonextpages}{%
  \gdef\glossaryentrynumbers##1{%
     \glsresetentrylist
  }%
}
\newcommand*{\@glsnextpages}{%
  \gdef\glossaryentrynumbers##1{%
     ##1\glsresetentrylist}}
\newcommand*{\glsresetentrylist}{%
  \global\let\glossaryentrynumbers\org@glossaryentrynumbers}
\newcommand*{\glsnonextpages}{}
\newcommand*{\glsnextpages}{}
\@gls@define@glossaryentrycounter
\@gls@define@glossarysubentrycounter
\newcommand*{\glsresetsubentrycounter}{%
  \ifglssubentrycounter
    \setcounter{glossarysubentry}{0}%
  \fi
}
\newcommand*{\glsresetentrycounter}{%
  \ifglsentrycounter
    \setcounter{glossaryentry}{0}%
  \fi
}
\newcommand*{\glsstepentry}[1]{%
  \ifglsentrycounter
    \refstepcounter{glossaryentry}%
    \label{\GlsEntryCounterLabelPrefix\glsdetoklabel{#1}}%
  \fi
}
\newcommand*{\glsstepsubentry}[1]{%
  \ifglssubentrycounter
    \edef\currentglssubentry{\glsdetoklabel{#1}}%
    \refstepcounter{glossarysubentry}%
    \label{\GlsEntryCounterLabelPrefix\currentglssubentry}%
  \fi
}
\newcommand*{\glsrefentry}[1]{%
 \ifglsentrycounter
   \ref{\GlsEntryCounterLabelPrefix\glsdetoklabel{#1}}%
 \else
   \ifglssubentrycounter
     \ref{\GlsEntryCounterLabelPrefix\glsdetoklabel{#1}}%
   \else
     \gls{#1}%
   \fi
 \fi
}
\newcommand*{\glsentrycounterlabel}{%
 \ifglsentrycounter
   \theglossaryentry.\space
 \fi
}
\newcommand*{\glssubentrycounterlabel}{%
 \ifglssubentrycounter
   \theglossarysubentry)\space
 \fi
}
\newcommand*{\glsentryitem}[1]{%
  \ifglsentrycounter
    \glsstepentry{#1}\glsentrycounterlabel
  \else
    \glsresetsubentrycounter
  \fi
}
\newcommand*{\glssubentryitem}[1]{%
  \ifglssubentrycounter
    \glsstepsubentry{#1}\glssubentrycounterlabel
  \fi
}
\ifcsundef{theglossary}%
{%
  \newenvironment{theglossary}{}{}%
}%
{%
  \@gls@warnontheglossdefined
  \renewenvironment{theglossary}{}{}%
}
\newcommand*{\glossaryheader}{}
\newcommand*{\glstarget}[2]{\@glstarget{\glolinkprefix#1}{#2}}
\providecommand*{\compatibleglossentry}[2]{%
  \toks@{#2}%
  \protected@edef\@do@glossentry{\noexpand\glossaryentryfield{#1}%
    {\noexpand\glsnamefont
       {\expandafter\expandonce\csname glo@#1@name\endcsname}}%
    {\expandafter\expandonce\csname glo@#1@desc\endcsname}%
    {\expandafter\expandonce\csname glo@#1@symbol\endcsname}%
    {\the\toks@}%
  }%
  \@do@glossentry
}
\newcommand*{\glossentryname}[1]{%
  \glsdoifexistsorwarn{#1}%
  {%
    \letcs{\glo@name}{glo@\glsdetoklabel{#1}@name}%
    \expandafter\glsnamefont\expandafter{\glo@name}%
  }%
}
\newcommand*{\Glossentryname}[1]{%
  \glsdoifexistsorwarn{#1}%
  {%
    \glsnamefont{\Glsentryname{#1}}%
  }%
}
\newcommand*{\glossentrydesc}[1]{%
  \glsdoifexistsorwarn{#1}%
  {%
     \glsentrydesc{#1}%
  }%
}
\newcommand*{\Glossentrydesc}[1]{%
  \glsdoifexistsorwarn{#1}%
  {%
    \Glsentrydesc{#1}%
  }%
}
\newcommand*{\glossentrysymbol}[1]{%
  \glsdoifexistsorwarn{#1}%
  {%
     \glsentrysymbol{#1}%
  }%
}
\newcommand*{\Glossentrysymbol}[1]{%
  \glsdoifexistsorwarn{#1}%
  {%
     \Glsentrysymbol{#1}%
  }%
}
\providecommand*{\compatiblesubglossentry}[3]{%
  \toks@{#3}%
  \protected@edef\@do@subglossentry{\noexpand\glossarysubentryfield{\number#1}%
  {#2}%
    {\noexpand\glsnamefont
      {\expandafter\expandonce\csname glo@#2@name\endcsname}}%
    {\expandafter\expandonce\csname glo@#2@desc\endcsname}%
    {\expandafter\expandonce\csname glo@#2@symbol\endcsname}%
    {\the\toks@}%
  }%
  \@do@subglossentry
}
\newcommand*{\setglossentrycompatibility}{%
  \let\glossentry\compatibleglossentry
  \let\subglossentry\compatiblesubglossentry
}
\setglossentrycompatibility
\newcommand{\glossaryentryfield}[5]{%
  \GlossariesWarning
  {Deprecated use of \string\glossaryentryfield.^^J
   I recommend you change to \string\glossentry.^^J
   If you've just upgraded, try removing your gls auxiliary
   files^^J and recompile}%
  \noindent\textbf{\glstarget{#1}{#2}} #4 #3. #5\par}
\newcommand*{\glossarysubentryfield}[6]{%
  \GlossariesWarning
  {Deprecated use of \string\glossarysubentryfield.^^J
   I recommend you change to \string\subglossentry.^^J
   If you've just upgraded, try removing your gls auxiliary
   files^^J and recompile}%
  \glstarget{#2}{\strut}#4. #6\par}
\newcommand*{\glsgroupskip}{}
\newcommand*{\glsgroupheading}[1]{}
\newcommand*{\glsgetgrouptitle}[1]{%
  \@gls@getgrouptitle{#1}{\@gls@grptitle}%
  \@gls@grptitle
}
\newcommand*{\@gls@getgrouptitle}[2]{%
 \dtl@ifsingle{#1}%
 {%
   \ifcsundef{#1groupname}{\def#2{#1}}{\letcs#2{#1groupname}}%
 }%
 {%
   \ifboolexpr{test{\ifstrequal{#1}{glssymbols}}
            or test{\ifstrequal{#1}{glsnumbers}}}%
   {%
     \ifcsundef{#1groupname}{\def#2{#1}}{\letcs#2{#1groupname}}%
   }%
   {%
     \def#2{#1}%
   }%
 }%
}
\newcommand*{\@gls@noidx@getgrouptitle}[2]{%
  \DTLifint{#1}%
  {\edef#2{\char#1\relax}}%
  {%
    \ifcsundef{#1groupname}{\def#2{#1}}{\letcs#2{#1groupname}}%
  }%
}
\newcommand*{\glsgetgrouplabel}[1]{%
\ifthenelse{\equal{#1}{\glssymbolsgroupname}}{glssymbols}{%
\ifthenelse{\equal{#1}{\glsnumbersgroupname}}{glsnumbers}{#1}}}
\newcommand*{\setentrycounter}[2][]{%
  \def\@glo@counterprefix{#1}%
  \ifx\@glo@counterprefix\@empty
    \def\@glo@counterprefix{.}%
  \else
    \def\@glo@counterprefix{.#1.}%
  \fi
  \def\glsentrycounter{#2}%
}
\newcommand*{\setglossarystyle}[1]{%
  \ifcsundef{@glsstyle@#1}%
  {%
    \PackageError{glossaries}{Glossary style `#1' undefined}{}%
  }%
  {%
    \csname @glsstyle@#1\endcsname
  }%
  \ifx\@glossary@default@style\relax
    \protected@edef\@glossary@default@style{#1}%
  \fi
}
\newcommand*{\glossarystyle}[1]{%
  \ifcsundef{@glsstyle@#1}%
  {%
    \PackageError{glossaries}{Glossary style `#1' undefined}{}%
  }%
  {%
    \GlossariesWarning
    {Deprecated command \string\glossarystyle.^^J
     I recommend you switch to \string\setglossarystyle\space unless
     you want to maintain backward compatibility}%
    \setglossentrycompatibility
    \csname @glsstyle@#1\endcsname
    \ifcsdef{@glscompstyle@#1}%
    {\setglossentrycompatibility\csuse{@glscompstyle@#1}}%
    {}%
  }%
  \ifx\@glossary@default@style\relax
    \protected@edef\@glossary@default@style{#1}%
  \fi
}
\newcommand{\newglossarystyle}[2]{%
  \ifcsundef{@glsstyle@#1}%
  {%
    \expandafter\def\csname @glsstyle@#1\endcsname{#2}%
  }%
  {%
    \PackageError{glossaries}{Glossary style `#1' is already defined}{}%
  }%
}
\newcommand{\renewglossarystyle}[2]{%
  \ifcsundef{@glsstyle@#1}%
  {%
    \PackageError{glossaries}{Glossary style `#1' isn't already defined}{}%
  }%
  {%
    \csdef{@glsstyle@#1}{#2}%
  }%
}
\newcommand*{\glsnamefont}[1]{#1}
\ifcsundef{hyperlink}%
{%
  \def\glshypernumber#1{#1}%
}%
{%
  \def\glshypernumber#1{\@glshypernumber#1\nohyperpage{}\@nil}
}
\def\@glshypernumber#1\nohyperpage#2#3\@nil{%
  \ifx\\#1\\%
  \else
    \@delimR#1\delimR\delimR\\%
  \fi
  \ifx\\#2\\%
  \else
    #2%
  \fi
  \ifx\\#3\\%
  \else
    \@glshypernumber#3\@nil
  \fi
}
\def\@delimR#1\delimR #2\delimR #3\\{%
\ifx\\#2\\%
  \@delimN{#1}%
\else
  \@gls@numberlink{#1}\delimR\@gls@numberlink{#2}%
\fi}
\def\@delimN#1{\@@delimN#1\delimN \delimN\\}
\def\@@delimN#1\delimN #2\delimN#3\\{%
\ifx\\#3\\%
  \@gls@numberlink{#1}%
\else
  \@gls@numberlink{#1}\delimN\@gls@numberlink{#2}%
\fi
}
\def\@gls@numberlink#1{%
\begingroup
 \toks@={}%
 \@gls@removespaces#1 \@nil
\endgroup}
\def\@gls@removespaces#1 #2\@nil{%
 \toks@=\expandafter{\the\toks@#1}%
 \ifx\\#2\\%
   \edef\x{\the\toks@}%
   \ifx\x\empty
   \else
     \hyperlink{\glsentrycounter\@glo@counterprefix\the\toks@}%
               {\the\toks@}%
   \fi
 \else
   \@gls@ReturnAfterFi{%
     \@gls@removespaces#2\@nil
   }%
 \fi
}
\long\def\@gls@ReturnAfterFi#1\fi{\fi#1}
\newcommand*{\hyperrm}[1]{\textrm{\glshypernumber{#1}}}
\newcommand*{\hypersf}[1]{\textsf{\glshypernumber{#1}}}
\newcommand*{\hypertt}[1]{\texttt{\glshypernumber{#1}}}
\newcommand*{\hyperbf}[1]{\textbf{\glshypernumber{#1}}}
\newcommand*{\hypermd}[1]{\textmd{\glshypernumber{#1}}}
\newcommand*{\hyperit}[1]{\textit{\glshypernumber{#1}}}
\newcommand*{\hypersl}[1]{\textsl{\glshypernumber{#1}}}
\newcommand*{\hyperup}[1]{\textup{\glshypernumber{#1}}}
\newcommand*{\hypersc}[1]{\textsc{\glshypernumber{#1}}}
\newcommand*{\hyperemph}[1]{\emph{\glshypernumber{#1}}}
\newcommand{\oldacronym}[4][\gls@label]{%
  \def\gls@label{#2}%
  \newacronym[#4]{#1}{#2}{#3}%
  \ifcsundef{xspace}%
  {%
    \expandafter\edef\csname#1\endcsname{%
      \noexpand\@ifstar{\noexpand\Gls{#1}}{\noexpand\gls{#1}}%
    }%
  }%
  {%
    \expandafter\edef\csname#1\endcsname{%
      \noexpand\@ifstar{\noexpand\Gls{#1}\noexpand\xspace}{%
      \noexpand\gls{#1}\noexpand\xspace}%
    }%
  }%
}
  \newcommand{\newacronym}[4][]{}
\newcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}
\newrobustcmd*{\glstextup}[1]{\ifdef\textulc{\textulc{#1}}{\textup{#1}}}
\newcommand*{\glsshortkey}{short}
\newcommand*{\glsshortpluralkey}{shortplural}
\newcommand*{\glslongkey}{long}
\newcommand*{\glslongpluralkey}{longplural}
\newrobustcmd*{\acrfull}{\@gls@hyp@opt\ns@acrfull}
\newcommand*\ns@acrfull[2][]{%
  \new@ifnextchar[{\@acrfull{#1}{#2}}%
                  {\@acrfull{#1}{#2}[]}%
}
\def\@acrfull#1#2[#3]{%
  \acrfullfmt{#1}{#2}{#3}%
}
\newcommand*{\acrfullfmt}[3]{%
  \acrlinkfullformat{\@acrlong}{\@acrshort}{#1}{#2}{#3}%
}
\newcommand{\acrlinkfullformat}[5]{%
  \acrfullformat{#1{#3}{#4}[#5]}{#2{#3}{#4}[]}%
}
\newcommand{\acrfullformat}[2]{#1\glsspace(#2)}
\newrobustcmd{\glsspace}{\space}
\newrobustcmd*{\Acrfull}{\@gls@hyp@opt\ns@Acrfull}
\newcommand*\ns@Acrfull[2][]{%
  \new@ifnextchar[{\@Acrfull{#1}{#2}}%
                  {\@Acrfull{#1}{#2}[]}%
}
\def\@Acrfull#1#2[#3]{%
  \Acrfullfmt{#1}{#2}{#3}%
}
\newcommand*{\Acrfullfmt}[3]{%
  \acrlinkfullformat{\@Acrlong}{\@acrshort}{#1}{#2}{#3}%
}
\newrobustcmd*{\ACRfull}{\@gls@hyp@opt\ns@ACRfull}
\newcommand*\ns@ACRfull[2][]{%
  \new@ifnextchar[{\@ACRfull{#1}{#2}}%
                  {\@ACRfull{#1}{#2}[]}%
}
\def\@ACRfull#1#2[#3]{%
  \ACRfullfmt{#1}{#2}{#3}%
}
\newcommand*{\ACRfullfmt}[3]{%
  \acrlinkfullformat{\@ACRlong}{\@ACRshort}{#1}{#2}{#3}%
}
\newrobustcmd*{\acrfullpl}{\@gls@hyp@opt\ns@acrfullpl}
\newcommand*\ns@acrfullpl[2][]{%
  \new@ifnextchar[{\@acrfullpl{#1}{#2}}%
                  {\@acrfullpl{#1}{#2}[]}%
}
\def\@acrfullpl#1#2[#3]{%
  \acrfullplfmt{#1}{#2}{#3}%
}
\newcommand*{\acrfullplfmt}[3]{%
  \acrlinkfullformat{\@acrlongpl}{\@acrshortpl}{#1}{#2}{#3}%
}
\newrobustcmd*{\Acrfullpl}{\@gls@hyp@opt\ns@Acrfullpl}
\newcommand*\ns@Acrfullpl[2][]{%
  \new@ifnextchar[{\@Acrfullpl{#1}{#2}}%
                  {\@Acrfullpl{#1}{#2}[]}%
}
\def\@Acrfullpl#1#2[#3]{%
  \Acrfullplfmt{#1}{#2}{#3}%
}
\newcommand*{\Acrfullplfmt}[3]{%
  \acrlinkfullformat{\@Acrlongpl}{\@acrshortpl}{#1}{#2}{#3}%
}
\newrobustcmd*{\ACRfullpl}{\@gls@hyp@opt\ns@ACRfullpl}
\newcommand*\ns@ACRfullpl[2][]{%
  \new@ifnextchar[{\@ACRfullpl{#1}{#2}}%
                  {\@ACRfullpl{#1}{#2}[]}%
}
\def\@ACRfullpl#1#2[#3]{%
  \ACRfullplfmt{#1}{#2}{#3}%
}
\newcommand*{\ACRfullplfmt}[3]{%
  \acrlinkfullformat{\@ACRlongpl}{\@ACRshortpl}{#1}{#2}{#3}%
}
\newcommand{\acronymfont}[1]{#1}
\newcommand{\firstacronymfont}[1]{\acronymfont{#1}}
\newcommand*{\acrnameformat}[2]{\acronymfont{#1}}
\newtoks\glskeylisttok
\newtoks\glslabeltok
\newtoks\glsshorttok
\newtoks\glslongtok
\newcommand*{\newacronymhook}{}
\newcommand*{\SetGenericNewAcronym}{%
  \let\@Gls@entryname\@Gls@acrentryname
  \renewcommand{\newacronym}[4][]{%
    \ifdefempty{\@glsacronymlists}%
    {%
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
    }%
    {}%
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \protected@edef\@do@newglossaryentry{%
      \noexpand\newglossaryentry{\the\glslabeltok}%
      {%
        type=\acronymtype,%
        name={\expandonce{\acronymentry{##2}}},%
        sort={\acronymsort{\the\glsshorttok}{\the\glslongtok}},%
        text={\the\glsshorttok},%
        short={\the\glsshorttok},%
        shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
        long={\the\glslongtok},%
        longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
        \GenericAcronymFields,%
        \the\glskeylisttok
      }%
    }%
    \@do@newglossaryentry
  }%
  \renewcommand*{\acrfullfmt}[3]{%
    \glslink[##1]{##2}{\genacrfullformat{##2}{##3}}}%
  \renewcommand*{\Acrfullfmt}[3]{%
    \glslink[##1]{##2}{\Genacrfullformat{##2}{##3}}}%
  \renewcommand*{\ACRfullfmt}[3]{%
    \glslink[##1]{##2}{%
      \mfirstucMakeUppercase{\genacrfullformat{##2}{##3}}}}%
  \renewcommand*{\acrfullplfmt}[3]{%
    \glslink[##1]{##2}{\genplacrfullformat{##2}{##3}}}%
  \renewcommand*{\Acrfullplfmt}[3]{%
    \glslink[##1]{##2}{\Genplacrfullformat{##2}{##3}}}%
  \renewcommand*{\ACRfullplfmt}[3]{%
    \glslink[##1]{##2}{%
      \mfirstucMakeUppercase{\genplacrfullformat{##2}{##3}}}}%
  \renewcommand*{\glsentryfull}[1]{\genacrfullformat{##1}{}}%
  \renewcommand*{\Glsentryfull}[1]{\Genacrfullformat{##1}{}}%
  \renewcommand*{\glsentryfullpl}[1]{\genplacrfullformat{##1}{}}%
  \renewcommand*{\Glsentryfullpl}[1]{\Genplacrfullformat{##1}{}}%
}
\newcommand*{\GenericAcronymFields}{description={\the\glslongtok}}
\newcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{#1}}}
\newcommand*{\acronymsort}[2]{#1}
\newcommand*{\setacronymstyle}[1]{%
  \ifcsundef{@glsacr@dispstyle@#1}
  {%
    \PackageError{glossaries}{Undefined acronym style `#1'}{}%
  }%
  {%
    \ifdefempty{\@glsacronymlists}%
    {%
      \DeclareAcronymList{\acronymtype}%
    }%
    {}%
    \SetGenericNewAcronym
    \GlsUseAcrStyleDefs{#1}%
    \@for\@gls@type:=\@glsacronymlists\do{%
      \defglsentryfmt[\@gls@type]{\GlsUseAcrEntryDispStyle{#1}}%
    }%
  }%
}
\newcommand*{\newacronymstyle}[3]{%
  \ifcsdef{@glsacr@dispstyle@#1}%
  {%
    \PackageError{glossaries}{Acronym style `#1' already exists}{}%
  }%
  {%
    \csdef{@glsacr@dispstyle@#1}{#2}%
    \csdef{@glsacr@styledefs@#1}{#3}%
  }%
}
\newcommand*{\renewacronymstyle}[3]{%
  \ifcsdef{@glsacr@dispstyle@#1}%
  {%
    \csdef{@glsacr@dispstyle@#1}{#2}%
    \csdef{@glsacr@styledefs@#1}{#3}%
  }%
  {%
    \PackageError{glossaries}{Acronym style `#1' doesn't exist}{}%
  }%
}
\newcommand*{\GlsUseAcrEntryDispStyle}[1]{\csuse{@glsacr@dispstyle@#1}}
\newcommand*{\GlsUseAcrStyleDefs}[1]{\csuse{@glsacr@styledefs@#1}}
\newacronymstyle{long-short}%
{%
  \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}%
}%
{%
  \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}%
  \renewcommand*{\genacrfullformat}[2]{%
   \glsentrylong{##1}##2\space
   (\protect\firstacronymfont{\glsentryshort{##1}})%
  }%
  \renewcommand*{\Genacrfullformat}[2]{%
   \Glsentrylong{##1}##2\space
   (\protect\firstacronymfont{\glsentryshort{##1}})%
  }%
  \renewcommand*{\genplacrfullformat}[2]{%
   \glsentrylongpl{##1}##2\space
   (\protect\firstacronymfont{\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\Genplacrfullformat}[2]{%
   \Glsentrylongpl{##1}##2\space
   (\protect\firstacronymfont{\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}%
  \renewcommand*{\acronymsort}[2]{##1}%
  \renewcommand*{\acronymfont}[1]{##1}%
  \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}%
}
\newacronymstyle{long-sp-short}%
{%
  \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}%
}%
{%
  \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}%
  \renewcommand*{\genacrfullformat}[2]{%
   \glsentrylong{##1}##2\glsacspace{##1}%
   (\protect\firstacronymfont{\glsentryshort{##1}})%
  }%
  \renewcommand*{\Genacrfullformat}[2]{%
   \Glsentrylong{##1}##2\glsacspace{##1}%
   (\protect\firstacronymfont{\glsentryshort{##1}})%
  }%
  \renewcommand*{\genplacrfullformat}[2]{%
   \glsentrylongpl{##1}##2\glsacspace{##1}%
   (\protect\firstacronymfont{\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\Genplacrfullformat}[2]{%
   \Glsentrylongpl{##1}##2\glsacspace{##1}%
   (\protect\firstacronymfont{\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}%
  \renewcommand*{\acronymsort}[2]{##1}%
  \renewcommand*{\acronymfont}[1]{##1}%
  \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}%
}
\newcommand*{\glsacspace}[1]{%
  \settowidth{\dimen@}{(\firstacronymfont{\glsentryshort{#1}})}%
  \ifdim\dimen@<3em~\else\space\fi
}
\newacronymstyle{short-long}%
{%
  \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}%
}%
{%
  \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}%
  \renewcommand*{\genacrfullformat}[2]{%
   \protect\firstacronymfont{\glsentryshort{##1}}##2\space
   (\glsentrylong{##1})%
  }%
  \renewcommand*{\Genacrfullformat}[2]{%
   \protect\firstacronymfont{\Glsentryshort{##1}}##2\space
   (\glsentrylong{##1})%
  }%
  \renewcommand*{\genplacrfullformat}[2]{%
   \protect\firstacronymfont{\glsentryshortpl{##1}}##2\space
   (\glsentrylongpl{##1})%
  }%
  \renewcommand*{\Genplacrfullformat}[2]{%
   \protect\firstacronymfont{\Glsentryshortpl{##1}}##2\space
   (\glsentrylongpl{##1})%
  }%
  \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}%
  \renewcommand*{\acronymsort}[2]{##1}%
  \renewcommand*{\acronymfont}[1]{##1}%
  \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}%
}
\newacronymstyle{long-sc-short}%
{%
  \GlsUseAcrEntryDispStyle{long-short}%
}%
{%
  \GlsUseAcrStyleDefs{long-short}%
  \renewcommand{\acronymfont}[1]{\textsc{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}%
}
\newacronymstyle{long-sm-short}%
{%
  \GlsUseAcrEntryDispStyle{long-short}%
}%
{%
  \GlsUseAcrStyleDefs{long-short}%
  \renewcommand{\acronymfont}[1]{\textsmaller{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}%
}
\newacronymstyle{sc-short-long}%
{%
  \GlsUseAcrEntryDispStyle{short-long}%
}%
{%
  \GlsUseAcrStyleDefs{short-long}%
  \renewcommand{\acronymfont}[1]{\textsc{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}%
}
\newacronymstyle{sm-short-long}%
{%
  \GlsUseAcrEntryDispStyle{short-long}%
}%
{%
  \GlsUseAcrStyleDefs{short-long}%
  \renewcommand{\acronymfont}[1]{\textsmaller{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}%
}
\newacronymstyle{long-short-desc}%
{%
  \GlsUseAcrEntryDispStyle{long-short}%
}%
{%
  \GlsUseAcrStyleDefs{long-short}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}%
}
\newacronymstyle{long-sp-short-desc}%
{%
  \GlsUseAcrEntryDispStyle{long-sp-short}%
}%
{%
  \GlsUseAcrStyleDefs{long-sp-short}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glsentrylong{##1}\glsacspace{##1}(\acronymfont{\glsentryshort{##1}})}%
}
\newacronymstyle{long-sc-short-desc}%
{%
  \GlsUseAcrEntryDispStyle{long-sc-short}%
}%
{%
  \GlsUseAcrStyleDefs{long-sc-short}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}%
}
\newacronymstyle{long-sm-short-desc}%
{%
  \GlsUseAcrEntryDispStyle{long-sm-short}%
}%
{%
  \GlsUseAcrStyleDefs{long-sm-short}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}%
}
\newacronymstyle{short-long-desc}%
{%
  \GlsUseAcrEntryDispStyle{short-long}%
}%
{%
  \GlsUseAcrStyleDefs{short-long}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}%
}
\newacronymstyle{sc-short-long-desc}%
{%
  \GlsUseAcrEntryDispStyle{sc-short-long}%
}%
{%
  \GlsUseAcrStyleDefs{sc-short-long}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}%
}
\newacronymstyle{sm-short-long-desc}%
{%
  \GlsUseAcrEntryDispStyle{sm-short-long}%
}%
{%
  \GlsUseAcrStyleDefs{sm-short-long}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}%
}
\newacronymstyle{dua}%
{%
  \ifdefempty\glscustomtext
  {%
    \ifglshaslong{\glslabel}%
    {%
      \glsifplural
      {%
        \glscapscase
        {%
          \glsentrylongpl{\glslabel}\glsinsert
        }%
        {%
          \Glsentrylongpl{\glslabel}\glsinsert
        }%
        {%
          \mfirstucMakeUppercase
            {\glsentrylongpl{\glslabel}\glsinsert}%
        }%
      }%
      {%
        \glscapscase
        {%
          \glsentrylong{\glslabel}\glsinsert
        }%
        {%
          \Glsentrylong{\glslabel}\glsinsert
        }%
        {%
          \mfirstucMakeUppercase
            {\glsentrylong{\glslabel}\glsinsert}%
        }%
      }%
    }%
    {%
      \glsgenentryfmt
    }%
  }%
  {\glscustomtext\glsinsert}%
}%
{%
  \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}%
  \renewcommand*{\acrfullfmt}[3]{%
    \glslink[##1]{##2}{\glsentrylong{##2}##3\space
      (\acronymfont{\glsentryshort{##2}})}}%
  \renewcommand*{\Acrfullfmt}[3]{%
    \glslink[##1]{##2}{\Glsentrylong{##2}##3\space
      (\acronymfont{\glsentryshort{##2}})}}%
  \renewcommand*{\ACRfullfmt}[3]{%
    \glslink[##1]{##2}{%
      \mfirstucMakeUppercase{\glsentrylong{##2}##3\space
      (\acronymfont{\glsentryshort{##2}})}}}%
  \renewcommand*{\acrfullplfmt}[3]{%
    \glslink[##1]{##2}{\glsentrylongpl{##2}##3\space
      (\acronymfont{\glsentryshortpl{##2}})}}%
  \renewcommand*{\Acrfullplfmt}[3]{%
    \glslink[##1]{##2}{\Glsentrylongpl{##2}##3\space
      (\acronymfont{\glsentryshortpl{##2}})}}%
  \renewcommand*{\ACRfullplfmt}[3]{%
    \glslink[##1]{##2}{%
      \mfirstucMakeUppercase{\glsentrylongpl{##2}##3\space
      (\acronymfont{\glsentryshortpl{##2}})}}}%
  \renewcommand*{\glsentryfull}[1]{%
    \glsentrylong{##1}\space(\acronymfont{\glsentryshort{##1}})%
  }%
  \renewcommand*{\Glsentryfull}[1]{%
    \Glsentrylong{##1}\space(\acronymfont{\glsentryshort{##1}})%
  }%
  \renewcommand*{\glsentryfullpl}[1]{%
    \glsentrylongpl{##1}\space(\acronymfont{\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\Glsentryfullpl}[1]{%
    \Glsentrylongpl{##1}\space(\acronymfont{\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}%
  \renewcommand*{\acronymsort}[2]{##1}%
  \renewcommand*{\acronymfont}[1]{##1}%
  \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}%
}
\newacronymstyle{dua-desc}%
{%
  \GlsUseAcrEntryDispStyle{dua}%
}%
{%
  \GlsUseAcrStyleDefs{dua}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentrylong{##1}}}%
  \renewcommand*{\acronymsort}[2]{##2}%
}%
\newacronymstyle{footnote}%
{%
  \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}%
}%
{%
  \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}%
  \glshyperfirstfalse
  \renewcommand*{\genacrfullformat}[2]{%
   \protect\firstacronymfont{\glsentryshort{##1}}##2%
   \protect\footnote{\glsentrylong{##1}}%
  }%
  \renewcommand*{\Genacrfullformat}[2]{%
   \firstacronymfont{\Glsentryshort{##1}}##2%
   \protect\footnote{\glsentrylong{##1}}%
  }%
  \renewcommand*{\genplacrfullformat}[2]{%
   \protect\firstacronymfont{\glsentryshortpl{##1}}##2%
   \protect\footnote{\glsentrylongpl{##1}}%
  }%
  \renewcommand*{\Genplacrfullformat}[2]{%
   \protect\firstacronymfont{\Glsentryshortpl{##1}}##2%
   \protect\footnote{\glsentrylongpl{##1}}%
  }%
  \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}%
  \renewcommand*{\acronymsort}[2]{##1}%
  \renewcommand*{\acronymfont}[1]{##1}%
  \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}%
  \renewcommand*{\acrfullfmt}[3]{%
    \glslink[##1]{##2}{\acronymfont{\glsentryshort{##2}}##3\space
      (\glsentrylong{##2})}}%
  \renewcommand*{\Acrfullfmt}[3]{%
    \glslink[##1]{##2}{\acronymfont{\Glsentryshort{##2}}##3\space
      (\glsentrylong{##2})}}%
  \renewcommand*{\ACRfullfmt}[3]{%
    \glslink[##1]{##2}{%
      \mfirstucMakeUppercase{\acronymfont{\glsentryshort{##2}}##3\space
      (\glsentrylong{##2})}}}%
  \renewcommand*{\acrfullplfmt}[3]{%
    \glslink[##1]{##2}{\acronymfont{\glsentryshortpl{##2}}##3\space
      (\glsentrylongpl{##2})}}%
  \renewcommand*{\Acrfullplfmt}[3]{%
    \glslink[##1]{##2}{\acronymfont{\Glsentryshortpl{##2}}##3\space
      (\glsentrylongpl{##2})}}%
  \renewcommand*{\ACRfullplfmt}[3]{%
    \glslink[##1]{##2}{%
      \mfirstucMakeUppercase{\acronymfont{\glsentryshortpl{##2}}##3\space
      (\glsentrylongpl{##2})}}}%
  \renewcommand*{\glsentryfull}[1]{%
     \acronymfont{\glsentryshort{##1}}\space(\glsentrylong{##1})}%
  \renewcommand*{\Glsentryfull}[1]{%
     \acronymfont{\Glsentryshort{##1}}\space(\glsentrylong{##1})}%
  \renewcommand*{\glsentryfullpl}[1]{%
     \acronymfont{\glsentryshortpl{##1}}\space(\glsentrylongpl{##1})}%
  \renewcommand*{\Glsentryfullpl}[1]{%
     \acronymfont{\Glsentryshortpl{##1}}\space(\glsentrylongpl{##1})}%
}
\newacronymstyle{footnote-sc}%
{%
  \GlsUseAcrEntryDispStyle{footnote}%
}%
{%
  \GlsUseAcrStyleDefs{footnote}%
  \renewcommand{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}
  \renewcommand{\acronymfont}[1]{\textsc{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}%
}%
\newacronymstyle{footnote-sm}%
{%
  \GlsUseAcrEntryDispStyle{footnote}%
}%
{%
  \GlsUseAcrStyleDefs{footnote}%
  \renewcommand{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}
  \renewcommand{\acronymfont}[1]{\textsmaller{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}%
}%
\newacronymstyle{footnote-desc}%
{%
  \GlsUseAcrEntryDispStyle{footnote}%
}%
{%
  \GlsUseAcrStyleDefs{footnote}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}%
}
\newacronymstyle{footnote-sc-desc}%
{%
  \GlsUseAcrEntryDispStyle{footnote-sc}%
}%
{%
  \GlsUseAcrStyleDefs{footnote-sc}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}%
}
\newacronymstyle{footnote-sm-desc}%
{%
  \GlsUseAcrEntryDispStyle{footnote-sm}%
}%
{%
  \GlsUseAcrStyleDefs{footnote-sm}%
  \renewcommand*{\GenericAcronymFields}{}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
    \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}%
}
\newcommand*{\DefineAcronymSynonyms}{%
  \let\acs\acrshort
  \let\Acs\Acrshort
  \let\acsp\acrshortpl
  \let\Acsp\Acrshortpl
  \let\acl\acrlong
  \let\aclp\acrlongpl
  \let\Acl\Acrlong
  \let\Aclp\Acrlongpl
  \let\acf\acrfull
  \let\acfp\acrfullpl
  \let\Acf\Acrfull
  \let\Acfp\Acrfullpl
  \let\ac\gls
  \let\Ac\Gls
  \let\acp\glspl
  \let\Acp\Glspl
}
\ifglsacrshortcuts
  \DefineAcronymSynonyms
\fi
\newcommand*{\SetDefaultAcronymDisplayStyle}[1]{%
  \defglsentryfmt[#1]{\glsgenentryfmt}%
}
\newcommand*{\DefaultNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\the\glsshorttok},%
      sort={\the\glsshorttok},%
      text={\the\glsshorttok},%
      first={\acrfullformat{\the\glslongtok}{\the\glsshorttok}},%
      plural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      firstplural={\acrfullformat{\noexpand\expandonce\noexpand\@glo@longpl}%
                                 {\noexpand\expandonce\noexpand\@glo@shortpl}},%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      description={\the\glslongtok},%
      descriptionplural={\noexpand\expandonce\noexpand\@glo@longpl},%
      \the\glskeylisttok
    }%
  }%
  \let\@org@gls@assign@firstpl\gls@assign@firstpl
  \let\@org@gls@assign@plural\gls@assign@plural
  \let\@org@gls@assign@descplural\gls@assign@descplural
  \def\gls@assign@firstpl##1##2{%
    \@@gls@expand@field{##1}{firstpl}{##2}%
  }%
  \def\gls@assign@plural##1##2{%
    \@@gls@expand@field{##1}{plural}{##2}%
  }%
  \def\gls@assign@descplural##1##2{%
    \@@gls@expand@field{##1}{descplural}{##2}%
  }%
  \@do@newglossaryentry
  \let\gls@assign@firstpl\@org@gls@assign@firstpl
  \let\gls@assign@plural\@org@gls@assign@plural
  \let\gls@assign@symbolplural\@org@gls@assign@symbolplural
}
\newcommand*{\SetDefaultAcronymStyle}{%
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetDefaultAcronymDisplayStyle{\@gls@type}%
  }%
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetDefaultAcronymDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \DefaultNewAcronymDef
  }%
  \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}%
}
\newcommand*{\acrfootnote}[3]{\acrlinkfootnote{#1}{#2}{#3}}
\newcommand*{\acrlinkfootnote}[3]{%
  \footnote{\glslink[#1]{#2}{#3}}%
}
\newcommand*{\acrnolinkfootnote}[3]{%
  \footnote{#3}%
}
\newcommand*{\SetDescriptionFootnoteAcronymDisplayStyle}[1]{%
  \defglsentryfmt[#1]{%
    \ifdefempty\glscustomtext
    {%
      \ifglsused{\glslabel}%
      {%
        \acronymfont{\glsgenentryfmt}%
      }%
      {%
        \firstacronymfont{\glsgenentryfmt}%
        \ifglshassymbol{\glslabel}%
        {%
          \expandafter\protect\expandafter\acrfootnote\expandafter
           {\@gls@link@opts}{\@gls@link@label}%
           {%
            \glsifplural
              {\glsentrysymbolplural{\glslabel}}%
              {\glsentrysymbol{\glslabel}}%
           }%
        }%
      }%
    }%
    {\glscustomtext\glsinsert}%
  }%
}
\newcommand*{\DescriptionFootnoteNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\noexpand\acronymfont{\the\glsshorttok}},%
      sort={\the\glsshorttok},%
      first={\the\glsshorttok},%
      firstplural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      text={\the\glsshorttok},%
      plural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      symbol={\the\glslongtok},%
      symbolplural={\noexpand\expandonce\noexpand\@glo@longpl},%
      \the\glskeylisttok
    }%
  }%
  \let\@org@gls@assign@firstpl\gls@assign@firstpl
  \let\@org@gls@assign@plural\gls@assign@plural
  \let\@org@gls@assign@symbolplural\gls@assign@symbolplural
  \def\gls@assign@firstpl##1##2{%
    \@@gls@expand@field{##1}{firstpl}{##2}%
  }%
  \def\gls@assign@plural##1##2{%
    \@@gls@expand@field{##1}{plural}{##2}%
  }%
  \def\gls@assign@symbolplural##1##2{%
    \@@gls@expand@field{##1}{symbolplural}{##2}%
  }%
  \@do@newglossaryentry
  \let\gls@assign@plural\@org@gls@assign@plural
  \let\gls@assign@firstpl\@org@gls@assign@firstpl
  \let\gls@assign@symbolplural\@org@gls@assign@symbolplural
}
\newcommand*{\SetDescriptionFootnoteAcronymStyle}{%
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetDescriptionFootnoteAcronymDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \DescriptionFootnoteNewAcronymDef
  }%
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetDescriptionFootnoteAcronymDisplayStyle{\@gls@type}%
  }%
  \ifglsacrsmallcaps
    \renewcommand*{\acronymfont}[1]{\textsc{##1}}%
    \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}%
  \else
    \ifglsacrsmaller
      \renewcommand*{\acronymfont}[1]{\textsmaller{##1}}%
    \fi
  \fi
  \ifglsacrdua
    \PackageError{glossaries}{Option clash: `footnote' and `dua'
    can't both be set}{}%
  \fi
}%
\newcommand*{\SetDescriptionDUAAcronymDisplayStyle}[1]{%
  \defglsentryfmt[#1]{\glsgenentryfmt}%
}
\newcommand*{\DescriptionDUANewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\the\glslongtok},%
      sort={\the\glslongtok},
      text={\the\glslongtok},%
      first={\the\glslongtok},%
      plural={\noexpand\expandonce\noexpand\@glo@longpl},%
      firstplural={\noexpand\expandonce\noexpand\@glo@longpl},%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      symbol={\the\glsshorttok},%
      symbolplural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      \the\glskeylisttok
    }%
  }%
  \let\@org@gls@assign@firstpl\gls@assign@firstpl
  \let\@org@gls@assign@plural\gls@assign@plural
  \let\@org@gls@assign@symbolplural\gls@assign@symbolplural
  \def\gls@assign@firstpl##1##2{%
    \@@gls@expand@field{##1}{firstpl}{##2}%
  }%
  \def\gls@assign@plural##1##2{%
    \@@gls@expand@field{##1}{plural}{##2}%
  }%
  \def\gls@assign@symbolplural##1##2{%
    \@@gls@expand@field{##1}{symbolplural}{##2}%
  }%
  \@do@newglossaryentry
  \let\gls@assign@firstpl\@org@gls@assign@firstpl
  \let\gls@assign@plural\@org@gls@assign@plural
  \let\gls@assign@symbolplural\@org@gls@assign@symbolplural
}
\newcommand*{\SetDescriptionDUAAcronymStyle}{%
  \ifglsacrsmallcaps
    \PackageError{glossaries}{Option clash: `smallcaps' and `dua'
    can't both be set}{}%
  \else
    \ifglsacrsmaller
      \PackageError{glossaries}{Option clash: `smaller' and `dua'
      can't both be set}{}%
    \fi
  \fi
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetDescriptionDUAAcronymDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \DescriptionDUANewAcronymDef
  }%
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetDescriptionDUAAcronymDisplayStyle{\@gls@type}%
  }%
}%
\newcommand*{\SetDescriptionAcronymDisplayStyle}[1]{%
  \defglsentryfmt[#1]{%
    \ifdefempty\glscustomtext
    {%
      \ifglsused{\glslabel}%
      {%
        \let\gls@org@insert\glsinsert
        \let\glsinsert\@empty
        \acronymfont{\glsgenentryfmt}\gls@org@insert
      }%
      {%
        \glsgenentryfmt
        \ifglshassymbol{\glslabel}%
          {%
             \glsifplural
             {%
               \def\@glo@symbol{\glsentrysymbolplural{\glslabel}}%
             }%
             {%
               \def\@glo@symbol{\glsentrysymbol{\glslabel}}%
             }%
             \space(\protect\firstacronymfont
             {\glscapscase
              {\@glo@symbol}
              {\@glo@symbol}
              {\mfirstucMakeUppercase{\@glo@symbol}}})%
          }%
          {}%
      }%
    }%
    {\glscustomtext\glsinsert}%
  }%
}
\newcommand*{\DescriptionNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\noexpand
        \acrnameformat{\the\glsshorttok}{\the\glslongtok}},%
      sort={\the\glsshorttok},%
      first={\the\glslongtok},%
      firstplural={\noexpand\expandonce\noexpand\@glo@longpl},%
      text={\the\glsshorttok},%
      plural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      symbol={\noexpand\@glo@text},%
      symbolplural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      \the\glskeylisttok}%
  }%
  \let\@org@gls@assign@firstpl\gls@assign@firstpl
  \let\@org@gls@assign@plural\gls@assign@plural
  \let\@org@gls@assign@symbolplural\gls@assign@symbolplural
  \def\gls@assign@firstpl##1##2{%
    \@@gls@expand@field{##1}{firstpl}{##2}%
  }%
  \def\gls@assign@plural##1##2{%
    \@@gls@expand@field{##1}{plural}{##2}%
  }%
  \def\gls@assign@symbolplural##1##2{%
    \@@gls@expand@field{##1}{symbolplural}{##2}%
  }%
  \@do@newglossaryentry
  \let\gls@assign@firstpl\@org@gls@assign@firstpl
  \let\gls@assign@plural\@org@gls@assign@plural
  \let\gls@assign@symbolplural\@org@gls@assign@symbolplural
}
\newcommand*{\SetDescriptionAcronymStyle}{%
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetDescriptionAcronymDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \DescriptionNewAcronymDef
  }%
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetDescriptionAcronymDisplayStyle{\@gls@type}%
  }%
  \ifglsacrsmallcaps
    \renewcommand{\acronymfont}[1]{\textsc{##1}}
    \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}%
  \else
    \ifglsacrsmaller
      \renewcommand*{\acronymfont}[1]{\textsmaller{##1}}%
    \fi
  \fi
}%
\newcommand*{\SetFootnoteAcronymDisplayStyle}[1]{%
  \defglsentryfmt[#1]{%
    \ifdefempty\glscustomtext
    {%
      \let\gls@org@insert\glsinsert
      \let\glsinsert\@empty
      \ifglsused{\glslabel}%
      {%
        \acronymfont{\glsgenentryfmt}\gls@org@insert
      }%
      {%
        \firstacronymfont{\glsgenentryfmt}\gls@org@insert
        \ifglshaslong{\glslabel}%
        {%
          \expandafter\protect\expandafter\acrfootnote\expandafter
           {\@gls@link@opts}{\@gls@link@label}%
           {%
            \glsifplural
              {\glsentrylongpl{\glslabel}}%
              {\glsentrylong{\glslabel}}%
           }%
        }%
        {}%
      }%
    }%
    {\glscustomtext\glsinsert}%
  }%
}
\newcommand*{\FootnoteNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\noexpand\acronymfont{\the\glsshorttok}},%
      sort={\the\glsshorttok},%
      text={\the\glsshorttok},%
      plural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      first={\the\glsshorttok},%
      firstplural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      description={\the\glslongtok},%
      descriptionplural={\noexpand\expandonce\noexpand\@glo@longpl},%
      \the\glskeylisttok
    }%
  }%
  \let\@org@gls@assign@plural\gls@assign@plural
  \let\@org@gls@assign@firstpl\gls@assign@firstpl
  \let\@org@gls@assign@descplural\gls@assign@descplural
  \def\gls@assign@firstpl##1##2{%
    \@@gls@expand@field{##1}{firstpl}{##2}%
  }%
  \def\gls@assign@plural##1##2{%
    \@@gls@expand@field{##1}{plural}{##2}%
  }%
  \def\gls@assign@descplural##1##2{%
    \@@gls@expand@field{##1}{descplural}{##2}%
  }%
  \@do@newglossaryentry
  \let\gls@assign@plural\@org@gls@assign@plural
  \let\gls@assign@firstpl\@org@gls@assign@firstpl
  \let\gls@assign@descplural\@org@gls@assign@descplural
}
\newcommand*{\SetFootnoteAcronymStyle}{%
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetFootnoteAcronymDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \FootnoteNewAcronymDef
  }%
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetFootnoteAcronymDisplayStyle{\@gls@type}%
  }%
  \ifglsacrsmallcaps
     \renewcommand*{\acronymfont}[1]{\textsc{##1}}%
     \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}%
  \else
     \ifglsacrsmaller
        \renewcommand*{\acronymfont}[1]{\textsmaller{##1}}%
     \fi
  \fi
  \ifglsacrdua
     \PackageError{glossaries}{Option clash: `footnote' and `dua'
     can't both be set}{}%
  \fi
}%
\DeclareRobustCommand*{\glsdoparenifnotempty}[2]{%
  \protected@edef\gls@tmp{#1}%
  \ifdefempty\gls@tmp
  {}%
  {%
    \ifx\gls@tmp\@gls@default@value
    \else
      \space (#2{#1})%
    \fi
  }%
}
\newcommand*{\SetSmallAcronymDisplayStyle}[1]{%
  \defglsentryfmt[#1]{%
    \ifdefempty\glscustomtext
    {%
      \let\gls@org@insert\glsinsert
      \let\glsinsert\@empty
      \ifglsused{\glslabel}%
      {%
        \acronymfont{\glsgenentryfmt}\gls@org@insert
      }%
      {%
        \glsgenentryfmt
        \ifglshassymbol{\glslabel}%
        {%
          \glsifplural
          {%
            \def\@glo@symbol{\glsentrysymbolplural{\glslabel}}%
          }%
          {%
            \def\@glo@symbol{\glsentrysymbol{\glslabel}}%
          }%
          \space
            (\glscapscase
            {\firstacronymfont{\@glo@symbol}}%
            {\firstacronymfont{\@glo@symbol}}%
            {\firstacronymfont{\mfirstucMakeUppercase{\@glo@symbol}}})%
        }%
        {}%
      }%
    }%
    {\glscustomtext\glsinsert}%
  }%
}
\newcommand*{\SmallNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\noexpand\acronymfont{\the\glsshorttok}},%
      sort={\the\glsshorttok},%
      text={\the\glsshorttok},%
      plural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      first={\the\glslongtok},%
      firstplural={\noexpand\expandonce\noexpand\@glo@longpl},%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      description={\noexpand\@glo@first},%
      descriptionplural={\noexpand\expandonce\noexpand\@glo@longpl},%
      symbol={\the\glsshorttok},%
      symbolplural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      \the\glskeylisttok
    }%
  }%
  \let\@org@gls@assign@firstpl\gls@assign@firstpl
  \let\@org@gls@assign@plural\gls@assign@plural
  \let\@org@gls@assign@descplural\gls@assign@descplural
  \let\@org@gls@assign@symbolplural\gls@assign@symbolplural
  \def\gls@assign@firstpl##1##2{%
    \@@gls@expand@field{##1}{firstpl}{##2}%
  }%
  \def\gls@assign@plural##1##2{%
    \@@gls@expand@field{##1}{plural}{##2}%
  }%
  \def\gls@assign@descplural##1##2{%
    \@@gls@expand@field{##1}{descplural}{##2}%
  }%
  \def\gls@assign@symbolplural##1##2{%
    \@@gls@expand@field{##1}{symbolplural}{##2}%
  }%
  \@do@newglossaryentry
  \let\gls@assign@firstpl\@org@gls@assign@firstpl
  \let\gls@assign@plural\@org@gls@assign@plural
  \let\gls@assign@descplural\@org@gls@assign@descplural
  \let\gls@assign@symbolplural\@org@gls@assign@symbolplural
}
\newcommand*{\SetSmallAcronymStyle}{%
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetSmallAcronymDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \SmallNewAcronymDef
  }%
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetSmallAcronymDisplayStyle{\@gls@type}%
  }%
  \ifglsacrsmallcaps
    \renewcommand*{\acronymfont}[1]{\textsc{##1}}
    \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}%
  \else
    \renewcommand*{\acronymfont}[1]{\textsmaller{##1}}
  \fi
  \ifglsacrdua
    \ifglsacrsmallcaps
      \PackageError{glossaries}{Option clash: `smallcaps' and `dua'
      can't both be set}{}%
    \else
      \PackageError{glossaries}{Option clash: `smaller' and `dua'
      can't both be set}{}%
    \fi
  \fi
}%
\newcommand*{\SetDUADisplayStyle}[1]{%
  \defglsentryfmt[#1]{\glsgenentryfmt}%
}
\newcommand*{\DUANewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\the\glsshorttok},%
      text={\the\glslongtok},%
      first={\the\glslongtok},%
      plural={\noexpand\expandonce\noexpand\@glo@longpl},%
      firstplural={\noexpand\expandonce\noexpand\@glo@longpl},%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      description={\the\glslongtok},%
      descriptionplural={\noexpand\expandonce\noexpand\@glo@longpl},%
      symbol={\the\glsshorttok},%
      symbolplural={\noexpand\expandonce\noexpand\@glo@shortpl},%
      \the\glskeylisttok
    }%
  }%
  \let\@org@gls@assign@firstpl\gls@assign@firstpl
  \let\@org@gls@assign@plural\gls@assign@plural
  \let\@org@gls@assign@symbolplural\gls@assign@symbolplural
  \let\@org@gls@assign@descplural\gls@assign@descplural
  \def\gls@assign@firstpl##1##2{%
    \@@gls@expand@field{##1}{firstpl}{##2}%
  }%
  \def\gls@assign@plural##1##2{%
    \@@gls@expand@field{##1}{plural}{##2}%
  }%
  \def\gls@assign@symbolplural##1##2{%
    \@@gls@expand@field{##1}{symbolplural}{##2}%
  }%
  \def\gls@assign@descplural##1##2{%
    \@@gls@expand@field{##1}{descplural}{##2}%
  }%
  \@do@newglossaryentry
  \let\gls@assign@firstpl\@org@gls@assign@firstpl
  \let\gls@assign@plural\@org@gls@assign@plural
  \let\gls@assign@symbolplural\@org@gls@assign@symbolplural
  \let\gls@assign@descplural\@org@gls@assign@descplural
}
\newcommand*{\SetDUAStyle}{%
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetDUADisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \DUANewAcronymDef
  }%
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetDUADisplayStyle{\@gls@type}%
  }%
}
\newcommand*{\SetAcronymStyle}{%
  \SetDefaultAcronymStyle
  \ifglsacrdescription
    \ifglsacrfootnote
      \SetDescriptionFootnoteAcronymStyle
    \else
      \ifglsacrdua
        \SetDescriptionDUAAcronymStyle
      \else
        \SetDescriptionAcronymStyle
      \fi
    \fi
  \else
    \ifglsacrfootnote
      \SetFootnoteAcronymStyle
    \else
      \ifthenelse{\boolean{glsacrsmallcaps}\OR
        \boolean{glsacrsmaller}}%
      {%
        \SetSmallAcronymStyle
      }%
      {%
        \ifglsacrdua
          \SetDUAStyle
        \fi
      }%
    \fi
  \fi
}
\SetAcronymStyle
\newcommand*{\SetCustomDisplayStyle}[1]{%
  \defglsentryfmt[#1]{\glsgenentryfmt}%
}
\newcommand*{\CustomAcronymFields}{%
  name={\the\glsshorttok},%
  description={\the\glslongtok},%
  first={\acrfullformat{\the\glslongtok}{\the\glsshorttok}},%
  firstplural={\acrfullformat
    {\noexpand\glsentrylongpl{\the\glslabeltok}}%
    {\noexpand\glsentryshortpl{\the\glslabeltok}}},%
  text={\the\glsshorttok},%
  plural={\the\glsshorttok\noexpand\acrpluralsuffix}%
}
\newcommand*{\CustomNewAcronymDef}{%
  \protected@edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      short={\the\glsshorttok},%
      shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      long={\the\glslongtok},%
      longplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      user1={\the\glsshorttok},%
      user2={\the\glsshorttok\noexpand\acrpluralsuffix},%
      user3={\the\glslongtok},%
      user4={\the\glslongtok\noexpand\acrpluralsuffix},%
      \CustomAcronymFields,%
      \the\glskeylisttok
    }%
  }%
  \@do@newglossaryentry
}
\newcommand*{\SetCustomStyle}{%
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetCustomDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \CustomNewAcronymDef
  }%
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetCustomDisplayStyle{\@gls@type}%
  }%
}
\RequirePackage{glossary-hypernav}
\@gls@loadlist
\@gls@loadlong
\@gls@loadsuper
\@gls@loadtree
\ifx\@glossary@default@style\relax
\else
  \setglossarystyle{\@glossary@default@style}
\fi
\newcommand*{\showgloparent}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@parent\endcsname
}
\newcommand*{\showglolevel}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@level\endcsname
}
\newcommand*{\showglotext}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@text\endcsname
}
\newcommand*{\showgloplural}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@plural\endcsname
}
\newcommand*{\showglofirst}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@first\endcsname
}
\newcommand*{\showglofirstpl}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@firstpl\endcsname
}
\newcommand*{\showglotype}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@type\endcsname
}
\newcommand*{\showglocounter}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@counter\endcsname
}
\newcommand*{\showglouseri}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@useri\endcsname
}
\newcommand*{\showglouserii}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@userii\endcsname
}
\newcommand*{\showglouseriii}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@useriii\endcsname
}
\newcommand*{\showglouseriv}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@useriv\endcsname
}
\newcommand*{\showglouserv}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@userv\endcsname
}
\newcommand*{\showglouservi}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@uservi\endcsname
}
\newcommand*{\showgloname}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@name\endcsname
}
\newcommand*{\showglodesc}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@desc\endcsname
}
\newcommand*{\showglodescplural}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@descplural\endcsname
}
\newcommand*{\showglosort}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@sort\endcsname
}
\newcommand*{\showglosymbol}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@symbol\endcsname
}
\newcommand*{\showglosymbolplural}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@symbolplural\endcsname
}
\newcommand*{\showgloshort}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@short\endcsname
}
\newcommand*{\showglolong}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@long\endcsname
}
\newcommand*{\showgloindex}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@index\endcsname
}
\newcommand*{\showgloflag}[1]{%
  \expandafter\show\csname ifglo@\glsdetoklabel{#1}@flag\endcsname
}
\newcommand*{\showgloloclist}[1]{%
  \expandafter\show\csname glo@\glsdetoklabel{#1}@loclist\endcsname
}
\newcommand*{\showglofield}[2]{%
 \csshow{glo@\glsdetoklabel{#1}@#2}%
}
\newcommand*{\showacronymlists}{%
   \show\@glsacronymlists
}
\newcommand*{\showglossaries}{%
   \show\@glo@types
}
\newcommand*{\showglossaryin}[1]{%
  \expandafter\show\csname @glotype@#1@in\endcsname
}
\newcommand*{\showglossaryout}[1]{%
  \expandafter\show\csname @glotype@#1@out\endcsname
}
\newcommand*{\showglossarytitle}[1]{%
  \expandafter\show\csname @glotype@#1@title\endcsname
}
\newcommand*{\showglossarycounter}[1]{%
  \expandafter\show\csname @glotype@#1@counter\endcsname
}
\newcommand*{\showglossaryentries}[1]{%
  \expandafter\show\csname glolist@#1\endcsname
}
\csname ifglscompatible-2.07\endcsname
  \RequirePackage{glossaries-compatible-207}
\fi
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-2020-03-19.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries.perl>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
# File          : glossaries.perl
# Author        : Nicola L.C. Talbot
# Date          : 14th June 2007
# Last Modified : 2014-09-24
# Version       : 1.06
# Description   : LaTeX2HTML (limited!) implementation of glossaries 
#                  package. Note that not all the glossaries.sty
#                  macros have been implemented.
#                Note that this may not work with new versions of
#                LaTeX2HTML.

# This is a LaTeX2HTML style implementing the glossaries package, and
# is distributed as part of that package.
# Copyright 2007 Nicola L.C. Talbot
# This work may be distributed and/or modified under the
# conditions of the LaTeX Project Public License, either version 1.3
# of this license of (at your option) any later version.
# The latest version of this license is in
#   http://www.latex-project.org/lppl.txt
# and version 1.3 or later is part of all distributions of LaTeX
# version 2005/12/01 or later.
#
# This work has the LPPL maintenance status `maintained'.
#
# The Current Maintainer of this work is Nicola Talbot.

# This work consists of the files glossaries.dtx and glossaries.ins 
# and the derived files glossaries.sty, glossaries-prefix.sty,
# glossary-hypernav.sty, glossary-inline.sty, glossary-list.sty, 
# glossary-long.sty, glossary-longbooktabs.sty, glossary-longragged.sty,
# glossary-mcols.sty, glossary-super.sty, glossary-superragged.sty, 
# glossary-tree.sty, glossaries-compatible-207.sty, 
# glossaries-compatible-307.sty, glossaries-accsupp.sty, 
# glossaries-babel.sty, glossaries-polyglossia.sty, glossaries.perl.
# Also makeglossaries and makeglossaries-lite.lua.


package main;

&do_require_package("mfirstuc");

 %glossary_style = ();
 &set_glossarystyle('altlist');# default style

 $CURRENT_STYLE='altlist';

&process_commands_nowrap_in_tex( <<_RAW_ARG_CMDS_);
newglossarystyle # {} # {}
_RAW_ARG_CMDS_

# These are the only package options implemented.

sub do_glossaries_style_altlist{
}

sub do_glossaries_toc{
}

sub do_glossaries_toc_true{
}

$INDEXONLYFIRST=0;

sub do_glossaries_indexonlyfirst{
  $INDEXONLYFIRST=1;
}

$gls_nonumberlist{'main'} = 0;

sub do_glossaries_nonumberlist{
  $gls_nonumberlist{'main'} = 1;
}

$GLSCURRENTFORMAT="textrm" if (!defined($GLSCURRENTFORMAT));
$GLOSSARY_END_DESCRIPTION = '.' if (!defined($GLOSSARY_END_DESCRIPTION));

sub do_cmd_glossaryname{
   "Glossary$_[0]"
}

$gls_mark{'main'} = "<tex2html_gls_main_mark>";
$gls_file_mark{'main'} = "<tex2html_gls_main_file_mark>";
$gls_title{'main'} = "\\glossaryname";
$gls_toctitle{'main'} = "\\glossaryname";
$delimN{'main'} = ", ";
$glsnumformat{'main'} = $GLSCURRENTFORMAT;
@{$gls_entries{'main'}} = ();
$gls_displayfirst{'main'} = "glsdisplayfirst";
$gls_display{'main'} = "glsdisplay";

 %glsentry = ();

$acronymtype = 'main';

sub do_glossaries_acronym{
   &do_glossaries_acronym_true
}

sub do_glossaries_acronym_true{
   &make_newglossarytype("acronym", "\\acronymname");
   $acronymtype = 'acronym';
}

sub do_glossaries_acronym_false{
   $acronymtype = 'main';
}

sub do_cmd_acronymname{
   join('', 'Acronyms', $_[0]);
}

sub do_cmd_acronymtype{
   join('', $acronymtype, $_[0]);
}

$global{'glossaryentry'} = 0;
$global{'glossarysubentry'} = 0;

sub do_cmd_theglossaryentry{
  join('', $global{'glossaryentry'}, $_[0]);
}

sub do_cmd_theglossarysubentry{
  join('', $global{'glossarysubentry'}, $_[0]);
}

sub do_glossaries_entrycounter{
  &do_glossaries_entrycounter_true
}

sub do_glossaries_entrycounter_true{
  eval(<<'_END_DEF');
  sub do_cmd_glsresetentrycounter{
    $global{'entrycounter'} = 0;
    $_[0];
  }
_END_DEF
}

sub do_glossaries_entrycounter_false{
  eval(<<'_END_DEF');
  sub do_cmd_glsresetentrycounter{
    $_[0];
  }
_END_DEF
}

sub do_cmd_glsresetentrycounter{$_[0];}

sub do_glossaries_subentrycounter{
  &do_glossaries_subentrycounter_true
}

sub do_glossaries_subentrycounter_true{
  eval(<<'_END_DEF');
  sub do_cmd_glsresetsubentrycounter{
    $global{'subentrycounter'} = 0;
    $_[0];
  }
_END_DEF
}

sub do_glossaries_subentrycounter_false{
  eval(<<'_END_DEF');
  sub do_cmd_glsresetsubentrycounter{
    $_[0];
  }
_END_DEF
}

sub do_cmd_glsresetsubentrycounter{ $_[0]; }

# modify set_depth_levels so that glossary is added

sub replace_glossary_markers{
   foreach $type (keys %gls_mark)
   {
      if (defined &add_gls_hook)
        {&add_gls_hook if (/$gls_mark{$type}/);}
      else
        {&add_gls($type) if (/$gls_mark{$type}/);}

      s/$gls_file_mark{$type}/$glsfile{$type}/g;
   }
}

# there must be a better way of doing this
# other than copying the original code and adding to it.
sub replace_general_markers {
    if (defined &replace_infopage_hook) {&replace_infopage_hook if (/$info_page_mark/);}
    else { &replace_infopage if (/$info_page_mark/); }
    if (defined &add_idx_hook) {&add_idx_hook if (/$idx_mark/);}
    else {&add_idx if (/$idx_mark/);}
    &replace_glossary_markers;

    if ($segment_figure_captions) {
s/$lof_mark/$segment_figure_captions/o
    } else { s/$lof_mark/$figure_captions/o }
    if ($segment_table_captions) {
s/$lot_mark/$segment_table_captions/o
    } else { s/$lot_mark/$table_captions/o }
    &replace_morelinks();
    if (defined &replace_citations_hook) {&replace_citations_hook if /$bbl_mark/;}
    else {&replace_bbl_marks if /$bbl_mark/;}
    if (defined &add_toc_hook) {&add_toc_hook if (/$toc_mark/);}
    else {&add_toc if (/$toc_mark/);}
    if (defined &add_childs_hook) {&add_childs_hook if (/$childlinks_on_mark/);}
    else {&add_childlinks if (/$childlinks_on_mark/);}
    &remove_child_marks;

    if (defined &replace_cross_references_hook) {&replace_cross_references_hook;}
    else {&replace_cross_ref_marks if /$cross_ref_mark||$cross_ref_visible_mark/;}
    if (defined &replace_external_references_hook) {&replace_external_references_hook;}
    else {&replace_external_ref_marks if /$external_ref_mark/;}
    if (defined &replace_cite_references_hook) {&replace_cite_references_hook;}
    else { &replace_cite_marks if /$cite_mark/; }
    if (defined &replace_user_references) {
  &replace_user_references if /$user_ref_mark/; }

}

sub add_gls{
    local($sidx_style, $eidx_style) =('<STRONG>','</STRONG>');
    if ($INDEX_STYLES) {
if ($INDEX_STYLES =~/,/) {
local(@styles) = split(/\s*,\s*/,$INDEX_STYLES);
    $sidx_style = join('','<', join('><',@styles) ,'>');
    $eidx_style = join('','</', join('></',reverse(@styles)) ,'>');
} else {
    $sidx_style = join('','<', $INDEX_STYLES,'>');
    $eidx_style = join('','</', $INDEX_STYLES,'>');
}
    }
    &add_real_gls
}

sub gls_compare{
   local($x, $y) = @_;

   if ($x eq '' or $y eq '')
   {
      if ($x ne '')
      {
         # y is the shorter string
         return 1;
      }
      elsif ($y ne '')
      {
         # x is the shorter string
         return -1;
      }
      else
      {
         # both empty
         return 0;
      }
   }

   local($x0) = '';
   local($y0) = '';

   #v1.06 added /i for case-insensitive match
   if ($x=~s/^(&#(?:\d+|x[\da-f]+);)//i)
   {
      $x0 = $1;
   }
   elsif ($x=~s/^(.)//)
   {
      $x0 = $1;
   }

   if ($y=~s/^(&#(?:\d+|x[\da-f]+);)//i)
   {
      $y0 = $1;
   }
   elsif ($y=~s/^(.)//)
   {
      $y0 = $1;
   }

   local($numx);

   if ($x0=~/&#(\d+|x[\da-f]+);/i)
   {
      $numx = $1;

      $numx = hex("0$numx") if $numx=~/^x/;
   }
   else
   {
      $numx = ord($x0);
   }

   local($numy);

   if ($y0=~/&#(\d+|x[\da-f]+);/i)
   {
      $numy = $1;

      $numy = hex("0$numy") if $numy=~/^x/;
   }
   else
   {
      $numy = ord($y0);
   }

   if ($numx == $numy)
   {
      return &gls_compare($x, $y);
   }
   elsif ($numx >= 48 and $numx <= 57) # x in range '0' ... '9'
   {
      if ($numy >= 48 and $numy <= 57) # y in range '0' ... '9'
      {
         return $numx <=> $numy;
      }
      elsif (($numy >= 97 and $numy <= 122) or ($numy >= 65 and $numy <= 90)) # y a letter
      {
         # digits are less than letters
         return -1;
      }
      else
      {
         # digits are greater than symbols
         return 1;
      }
   }
   elsif (($numx >= 97 and $numx <= 122) or ($numx >= 65 and $numx <= 90)) # x a letter
   {
      if (($numy >= 97 and $numy <= 122) or ($numy >= 65 and $numy <= 90)) # y a letter
      {
         if (($numx <= 90 and $numy <= 90) or ($numx >= 97 and $numy >= 97))
         {
            # same case (already checked if they are equal)

            return $numx <=> $numy;
         }

         # are they upper/lower case versions of each other?

         if (($numx >= 97 and $numy == $numx-32))
         {
            # x is upper case version of y

            if ($x or $y)
            {
               return &gls_compare($x, $y);
            }
            else
            {
               return -1;
            }
         }

         if (($numy >= 97 and $numx == $numy-32))
         {
            # y is upper case version of x

            if ($x or $y)
            {
               return &gls_compare($x, $y);
            }
            else
            {
               return 1;
            }
         }

         # compare lower case values
         return lc(chr($numx)) cmp lc(chr($numy));
      }
      else
      {
         # a-z greater than symbols and digits
         return 1;
      }
   }
   elsif ($numy >= 48 and $numy <= 57) # y in range '0' ... '9'
   {
      # already checked for '0' < x < '9' and '0' < y < '9'
      # already checked for 'a' < x < 'z' and '0' < y < '9'
      
      # digits greater than symbols
      return 1;
   }
   elsif (($numy >= 97 and $numy <= 122)  or ($numy >= 65 and $numy <= 90)) # y is a letter
   {
      # already checked for x is digit and y a is letter
      # already checked for x is letter and y a is letter
      
      # symbols and digits are less than letters

      return -1;
   }

   $numx <=> $numy
}

sub gloskeysort{

   $a=~/^(.*)###(\d+)$/;

   local($labelx) = $1;
   local($x_id) =$2;

   $b=~/^(.*)###(\d+)$/;

   local($labely) = $1;
   local($y_id) = $2;

   local($sortx) = &gls_get_sort($labelx);
   local($sorty) = &gls_get_sort($labely);

   local($n);

   # are they case-insensitive equivalent?

   if (lc($sortx) eq lc($sorty))
   {
      $n = ($sortx cmp $sorty);
   }
   else
   {
      $n = &gls_compare($sortx, $sorty);
   }

   unless ($n)
   {
      $n = ($x_id <=> $y_id);
   }

   $n
}

sub add_parent_if_required{
   local($label) = @_;

   local($parent) = &gls_get_parent($label);

   if ($parent)
   {
      local($type) = &gls_get_type($parent);

      # does this parent have a backlink?

      for my $key (keys %{$glossary{$type}})
      {
         return if $key=~/^$parent###\d+$/;
      }

      # none found, so add empty one

      my $id = ++$global{'max_id'};

      $glossary{$type}{"$parent###$id"} = '';
      $glossary_entry{$type}{"$parent###$id"} = $parent;

      # check if parent also has a parent

      &add_parent_if_required($parent);
   }
}

sub add_real_gls{
   local($type) = @_;
   print "\nDoing glossary '$type' ...";
   local($key, $str, @keys, $thisglsentry, $level, $count,
   $previous, $current, $id, $linktext, $delimN);

   $TITLE = $gls_toctitle{$type};

   local($oldstyle) = $CURRENT_STYLE;

   if ($gls_style{$type})
   {
      &set_glossarystyle($gls_style{$type});
   }

   # add any parent entries that haven't been referenced

   for my $key (keys %{$glossary{$type}})
   {
      my $label = $key;
      $label =~ s/###\d+$//o; # Remove the unique id's

      &add_parent_if_required($label);
   }

   @keys = keys %{$glossary{$type}};

   @keys = sort gloskeysort @keys;

   $level = 0;

   $delimN = $delimN{$type};

   $previous = '';

   local($previousentry) = '';

   my $glossaryentryfield = '';

   my $previouscat = '';

   local ($entry);

   foreach $key (@keys)
   {
      $current = $key;
      $current =~ s/\#\#\#\d+$//o; # Remove the unique id's

      my $issame = ($current eq $previous ? 1 : 0);

      $previous = $current;

      $entry = $glossary_entry{$type}{$key};

      unless ($issame)
      {
         if ($glossaryentryfield)
         {
            $id = ++$global{'max_id'};

            my $level = &gls_get_level($previousentry);

            if ($level > 0)
            {
              my $id2 = ++$global{'max_id'};

              $thisglsentry .= 
                 "\\glossarysubentryfield $OP$id2$CP$level$OP$id2$CP$glossaryentryfield$OP$id$CP$linktext$OP$id$CP";
            }
            else
            {
              $thisglsentry .= 
                 "\\glossaryentryfield $glossaryentryfield$OP$id$CP$linktext$OP$id$CP";
            }

            $glossaryentryfield = '';
         }

         $linktext = '';

         my $currentcat = substr(&gls_get_sort($current), 0, 1);

         if ($currentcat=~/[a-zA-Z]/)
         {
            $currentcat = uc($currentcat);
         }
         elsif ($currentcat=~/[0-9]/)
         {
            $currentcat = 'glsnumbers';
         }
         else
         {
            $currentcat = 'glssymbols';
         }

         unless ($previouscat eq $currentcat)
         {
            $id = ++$global{'max_id'};
            $thisglsentry .= "\\glsgroupheading$OP$id$CP$currentcat$OP$id$CP";

            $previouscat = $currentcat;
         }
      }

      $previousentry = $entry;

      # Back ref
      
      if ($gls_nonumberlist{$type})
      {
         $linktext = '';
      }
      elsif ($glossary{$type}{$key})
      {
         $id = ++$global{'max_id'};

         $linktext .= $delimN if ($linktext);

         $linktext .= "$glossary{$type}{$key}\\$glossary_format{$type}{$key}${OP}$id${CP}$glossary_linktext{$type}{$key}${OP}$id${CP}</A>";

      }

      unless ($issame)
      {
         $id = ++$global{'max_id'};
         local($name) = &translate_commands(
            "\\glsnamefont $OP$id$CP$glsentry{$entry}{name}$OP$id$CP");

         local($symbol) = ($glsentry{$entry}{'symbol'} ?
                        " $glsentry{$entry}{symbol}" : '');

         $id = ++$global{'max_id'};
         my $id2 = ++$global{'max_id'};
         my $id3 = ++$global{'max_id'};
         my $id4 = ++$global{'max_id'};

         $glossaryentryfield = "$OP$id$CP$entry$OP$id$CP" # label
           . "$OP$id2$CP$name$OP$id2$CP" # name
           . "$OP$id3$CP$glsentry{$entry}{description}$OP$id3$CP" # description
           . "$OP$id4$CP$symbol$OP$id4$CP" # symbol
      }

   }

   if ($glossaryentryfield and $entry)
   {
      my $level = &gls_get_level($entry);

      if ($level > 0)
      {
        my $id2 = ++$global{'max_id'};

        $thisglsentry .= 
           "\\glossarysubentryfield $OP$id2$CP$level$OP$id2$CP$glossaryentryfield$OP$id$CP$linktext$OP$id$CP";
      }
      else
      {
         $id = ++$global{'max_id'};
         $thisglsentry .= 
            "\\glossaryentryfield $glossaryentryfield$OP$id$CP$linktext$OP$id$CP";
      }
   }

   $str = &do_env_theglossary($thisglsentry) . &translate_commands("\\glossarypostamble");

   if ($gls_style{$type})
   {
      &set_glossarystyle($oldstyle);
   }

   s/$gls_mark{$type}/$preglossary\n$str\n/s;
}

sub do_cmd_glstarget{
  local($_) = @_;

  local($id, $label, $text);

  $label = &missing_braces unless
   s/$next_pair_pr_rx/$id=$1;$label=$2;''/eo;

  $text = &missing_braces unless
   s/$next_pair_pr_rx/$id=$1;$text=$2;''/eo;

  "<A NAME=\"gls:$label\">$text</A>$_";
}

sub do_cmd_newglossarystyle{
   local($_) = @_;

   local($id,$style,$defs);

   $style = &missing_braces unless 
     s/$next_pair_rx/$id=$1;$style=$2;''/eo;

   $defs = &missing_braces unless 
     s/$next_pair_rx/$id=$1;$defs=$2;''/eo;

   $glossary_style{$style} = $defs;

   $_;
}

sub do_cmd_glossarystyle{
   local($_) = @_;

   local($id,$style);

   $style = &missing_braces unless 
     s/$next_pair_pr_rx/$id=$1;$style=$2;''/eo;

   &set_glossarystyle($style);

   $_;
}

sub set_glossarystyle{
   local($style) = @_;

   $CURRENT_STYLE = $style;

   if ($glossary_style{$style})
   {
      local($_) = $glossary_style{$style};

      s/$O(\d+)$C/$OP$1$CP/g;

      &translate_commands($_);
   }
   else
   {
      my $cmd_sub = "set_glossarystyle_$style";

      if (defined(&$cmd_sub))
      {
         &$cmd_sub();
      }
      else
      {
         &write_warnings("Unknown glossary style '$style', defaulting to 'altlist'");
         &set_glossarystyle_altlist();

         $CURRENT_STYLE = 'altlist';
      }
   }

}

sub do_cmd_glspar{ "<P>".$_[0]; }

sub do_cmd_glossaryheader{ 
  local($_) = @_;
  $_
}

sub do_cmd_glsentryitem{
  local($_) = @_;

  local($id, $label);

  $label = &missing_braces unless
     s/$next_pair_pr_rx/$id=$1,$label=$2;''/eo;

  $_
}

sub do_cmd_glssubentryitem{
  local($_) = @_;

  local($id, $label);

  $label = &missing_braces unless
     s/$next_pair_pr_rx/$id=$1,$label=$2;''/eo;

  $_
}

sub do_cmd_glsgroupheading{ 
  local($_) = @_;

  local($id, $heading);

  $heading = &missing_braces unless
   s/$next_pair_pr_rx/$id=$1,$heading=$2;''/eo;

  $_;
}

sub do_cmd_glossaryentryfield{
   local($_) = @_;

   local($id, $label, $name, $desc, $symbol, $backlink);

   $label = &missing_braces unless
     s/$next_pair_pr_rx/$id=$1;$label=$2;''/eo;

   $name = &missing_braces unless
     s/$next_pair_pr_rx/$id=$1;$name=$2;''/eo;

   $desc = &missing_braces unless
     s/$next_pair_pr_rx/$id=$1;$desc=$2;''/eo;

   $symbol = &missing_braces unless
     s/$next_pair_pr_rx/$id=$1;$symbol=$2;''/eo;

   $backlink = &missing_braces unless
     s/$next_pair_pr_rx/$id=$1;$backlink=$2;''/eo;

   local($id2) = ++$global{'max_id'};

   "\\glstarget $OP$id$CP$label$OP$id$CP$OP$id2$CP$name$OP$id2$CP\n$desc $backlink\n$_";
}

sub do_cmd_glossarysubentryfield{
   local($_) = @_;

   local($id, $level, $label, $name, $desc, $symbol, $backlink);

   $level = &missing_braces unless
     s/$next_pair_pr_rx/$id=$1;$level=$2;''/eo;

   $label = &missing_braces unless
     s/$next_pair_pr_rx/$id=$1;$label=$2;''/eo;

   $name = &missing_braces unless
     s/$next_pair_pr_rx/$id=$1;$name=$2;''/eo;

   $desc = &missing_braces unless
     s/$next_pair_pr_rx/$id=$1;$desc=$2;''/eo;

   $symbol = &missing_braces unless
     s/$next_pair_pr_rx/$id=$1;$symbol=$2;''/eo;

   $backlink = &missing_braces unless
     s/$next_pair_pr_rx/$id=$1;$backlink=$2;''/eo;

   local($id2) = ++$global{'max_id'};

   "\\glstarget $OP$id$CP$label$OP$id$CP$OP$id2$CP$name$OP$id2$CP\n$desc $backlink\n$_";
}

sub do_env_theglossary{
  local($_) = @_;

   &translate_commands($_);
}

sub set_glossarystyle_altlist{
  eval(<<'END_STYLE'); 
  sub do_cmd_glossaryheader{ 
    local($_) = @_;
    $_
  }

  sub do_cmd_glsgroupheading{ 
     local($_) = @_;

     local($id, $heading);

     $heading = &missing_braces unless
      s/$next_pair_pr_rx/$id=$1,$heading=$2;''/eo;

    $_
  }

  sub do_cmd_glossaryentryfield{
     local($_) = @_;

     local($id, $id2, $id3, $id4, $id5, $label, $name, $desc, $symbol, $backlink);

     $label = &missing_braces unless
       s/$next_pair_pr_rx/$id=$1;$label=$2;''/eo;

     $name = &missing_braces unless
       s/$next_pair_pr_rx/$id2=$1;$name=$2;''/eo;

     $desc = &missing_braces unless
       s/$next_pair_pr_rx/$id3=$1;$desc=$2;''/eo;

     $symbol = &missing_braces unless
       s/$next_pair_pr_rx/$id4=$1;$symbol=$2;''/eo;

     $backlink = &missing_braces unless
       s/$next_pair_pr_rx/$id5=$1;$backlink=$2;''/eo;

     "<DT>\\glstarget $OP$id$CP$label$OP$id$CP$OP$id2$CP$name$OP$id2$CP\n<DD>"
     . "$desc\\glspostdescription\\space $backlink$_";
  }

  sub do_cmd_glossarysubentryfield{
     local($_) = @_;

     local($id, $id2, $id3, $id4, $id5, $id6, $level, 
       $label, $name, $desc, $symbol, $backlink);

     $level = &missing_braces unless
       s/$next_pair_pr_rx/$id=$1;$level=$2;''/eo;

     $label = &missing_braces unless
       s/$next_pair_pr_rx/$id2=$1;$label=$2;''/eo;

     $name = &missing_braces unless
       s/$next_pair_pr_rx/$id3=$1;$name=$2;''/eo;

     $desc = &missing_braces unless
       s/$next_pair_pr_rx/$id4=$1;$desc=$2;''/eo;

     $symbol = &missing_braces unless
       s/$next_pair_pr_rx/$id5=$1;$symbol=$2;''/eo;

     $backlink = &missing_braces unless
       s/$next_pair_pr_rx/$id6=$1;$backlink=$2;''/eo;
  
     "<P>\\glssubentryitem $OP$id$CP$label$OP$id$CP"
     ."\\glstarget $OP$id2$CP$label$OP$id2$CP$OP$id3$CP$name$OP$id3$CP"
     ."$desc\\glspostdescription\\space $backlink\n$_";
  }

  sub do_env_theglossary{
    local($_) = @_;

     "<DL>".&translate_commands("\\glossaryheader $_")."</DL>";
  }
END_STYLE
}

sub set_glossarystyle_inline{
  eval(<<'END_STYLE'); 
  sub do_cmd_glossaryheader{ 
    local($_) = @_;
    $_
  }

  sub do_cmd_glsgroupheading{ 
    local($_) = @_;

    local($id, $heading);

    $heading = &missing_braces unless
     s/$next_pair_pr_rx/$id=$1,$heading=$2;''/eo;

    $_;
  }

  sub do_cmd_glossaryentryfield{
     local($_) = @_;

     local($id, $id2, $id3, $id4, $id5, $label, $name, $desc, $symbol, $backlink);

     $label = &missing_braces unless
       s/$next_pair_pr_rx/$id=$1;$label=$2;''/eo;

     $name = &missing_braces unless
       s/$next_pair_pr_rx/$id2=$1;$name=$2;''/eo;

     $desc = &missing_braces unless
       s/$next_pair_pr_rx/$id3=$1;$desc=$2;''/eo;

     $symbol = &missing_braces unless
       s/$next_pair_pr_rx/$id4=$1;$symbol=$2;''/eo;

     $backlink = &missing_braces unless
       s/$next_pair_pr_rx/$id5=$1;$backlink=$2;''/eo;

     local($field) = "\\glsinlinedopostchild $glsinlinesep";

     $field .= "\\glsentryitem $OP$id$CP$label$OP$id$CP"
             . "\\glsinlinenameformat $OP$id2$CP$label$OP$id2$CP$OP$id3$CP$name$OP$id3$CP";

     $id3 = ++$global{'max_id'};

     if ($desc)
     {
       $field .= 
           "\\glsinlinedescformat $OP$id3$CP$desc$OP$id3$CP"
          ."$OP$id4$CP$symbol$OP$id4$CP"
          ."$OP$id5$CP$backlink$OP$id5$CP";
     }
     else
     {
       $field .= 
           "\\glsinlineemptydescformat "
          ."$OP$id4$CP$symbol$OP$id4$CP"
          ."$OP$id5$CP$backlink$OP$id5$CP";
     }

# TODO : check if has children

     local($haschildren) = 0;

     if ($haschildren)
     {
       $field .= "\\glsresetsubentrycounter "
               . "\\glsinlineparentchildseparator "
               . "\\glsinlinepostchild ";
     }

    $glsinlinesep = &translate_commands("\\glsinlineseparator ")
       unless $glsinlinesep;

     $field.$_;
  }

  sub do_cmd_glossarysubentryfield{
     local($_) = @_;

     local($id, $id2, $id3, $id4,$id5,$id6,$level, 
       $label, $name, $desc, $symbol, $backlink);

     $level = &missing_braces unless
       s/$next_pair_pr_rx/$id=$1;$level=$2;''/eo;

     $label = &missing_braces unless
       s/$next_pair_pr_rx/$id2=$1;$label=$2;''/eo;

     $name = &missing_braces unless
       s/$next_pair_pr_rx/$id3=$1;$name=$2;''/eo;

     $desc = &missing_braces unless
       s/$next_pair_pr_rx/$id4=$1;$desc=$2;''/eo;

     $symbol = &missing_braces unless
       s/$next_pair_pr_rx/$id5=$1;$symbol=$2;''/eo;

     $backlink = &missing_braces unless
       s/$next_pair_pr_rx/$id6=$1;$backlink=$2;''/eo;

     "\\glsinlinesubnameformat $OP$id$CP$label$OP$id$CP$OP$id2$CP$name$OP$id2$CP"
     ."\\glssubentryitem $OP$id3$CP$label$OP$id3$CP"
     ."\\glsinlinesubdescformat $OP$id4$CP$desc$OP$id4$CP$OP$id5$CP$symbol$OP$id5$CP$OP$id6$CP$backlink$OP$id6$CP"
     .$_;
  }

  sub do_env_theglossary{
    local($_) = @_;

    $glsinlinesep = '';

     &translate_commands("\\glossaryheader $_\\glspostinline ");
  }
END_STYLE
}

local($glsinlinesep,$glsinlinepostchild);

sub do_cmd_glsinlineseparator{
  local($_) = @_;

  "; $_";
}

sub do_cmd_glsinlinedopostchild{
  local($_) = @_;

  $_;
}

sub do_cmd_glspostdescription{
  local($_) = @_;

  $GLOSSARY_END_DESCRIPTION.$_;
}

sub do_cmd_glspostinline{
  local($_) = @_;

  &translate_commands("\\glspostdescription\\space ").$_;
}

sub do_cmd_glsinlinepostchild{
  local($_) = @_;

  $_;
}

sub do_cmd_glsinlineparentchildseparator{
  local($_) = @_;

  ": $_";
}

sub do_cmd_glsinlinesubseparator{
  local($_) = @_;

  ", $_";
}

sub do_cmd_glsinlinenameformat{
  &do_cmd_glstarget(@_);
}

sub do_cmd_glsinlinedescformat{
  local($_) = @_;

  local($id, $desc, $symbol, $backlinks);

  $desc = &missing_braces unless
    s/$next_pair_pr_rx/$id=$1,$desc=$2;''/eo;

  $symbol = &missing_braces unless
    s/$next_pair_pr_rx/$id=$1,$symbol=$2;''/eo;

  $backlinks = &missing_braces unless
    s/$next_pair_pr_rx/$id=$1,$backlinks=$2;''/eo;

  "\\space $desc$_";
}

sub do_cmd_glsinlineemptydescformat{
  local($_) = @_;

  local($id, $symbol, $backlinks);

  $symbol = &missing_braces unless
    s/$next_pair_pr_rx/$id=$1,$symbol=$2;''/eo;

  $backlinks = &missing_braces unless
    s/$next_pair_pr_rx/$id=$1,$backlinks=$2;''/eo;

  $_;
}

sub do_cmd_glsinlinesubnameformat{
  local($_) = @_;

  local($id, $id2, $label, $name);

  $label = &missing_braces unless
    s/$next_pair_pr_rx/$id=$1,$label=$2;''/eo;

  $name = &missing_braces unless
    s/$next_pair_pr_rx/$id2=$1,$name=$2;''/eo;

  "\\glstarget $OP$id$CP$label$OP$id$CP$OP$id2$CP$OP$id2$CP$_";
}

sub do_cmd_glsinlinesubdescformat{
  local($_) = @_;

  local($id, $desc, $symbol, $backlinks);

  $desc = &missing_braces unless
    s/$next_pair_pr_rx/$id=$1,$desc=$2;''/eo;

  $symbol = &missing_braces unless
    s/$next_pair_pr_rx/$id=$1,$symbol=$2;''/eo;

  $backlinks = &missing_braces unless
    s/$next_pair_pr_rx/$id=$1,$backlinks=$2;''/eo;

  "$desc$_";
}

sub set_depth_levels {
    # Sets $outermost_level
    local($level);
    # scan the document body, not the preamble, for use of sectioning commands
    my ($contents) = $_;
    if ($contents =~ /\\begin\s*((?:$O|$OP)\d+(?:$C|$CP))document\1|\\startdocument/s) {
$contents = $';
    }
    foreach $level ("part", "chapter", "section", "subsection",
    "subsubsection", "paragraph") {
last if (($outermost_level) = $contents =~ /\\($level)$delimiter_rx/);
last if (($outermost_level) = $contents =~ /\\endsegment\s*\[\s*($level)\s*\]/s);
if ($contents =~ /\\segment\s*($O\d+$C)[^<]+\1\s*($O\d+$C)\s*($level)\s*\2/s)
{ $outermost_level = $3; last };
    }
    $level = ($outermost_level ? $section_commands{$outermost_level} :
      do {$outermost_level = 'section'; 3;});

    if ($REL_DEPTH && $MAX_SPLIT_DEPTH) {
$MAX_SPLIT_DEPTH = $level + $MAX_SPLIT_DEPTH;
    } elsif (!($MAX_SPLIT_DEPTH)) { $MAX_SPLIT_DEPTH = 1 };

    %unnumbered_section_commands = (
          'tableofcontents', $level
, 'listoffigures', $level
, 'listoftables', $level
, 'bibliography', $level
, 'textohtmlindex', $level
, 'textohtmlglossary', $level
, 'textohtmlglossaries', $level
        , %unnumbered_section_commands
        );

    %section_commands = (
  %unnumbered_section_commands
        , %section_commands
        );
}

sub add_bbl_and_idx_dummy_commands {
    local($id) = $global{'max_id'};

    s/([\\]begin\s*$O\d+$C\s*thebibliography)/$bbl_cnt++; $1/eg;
    ## if ($bbl_cnt == 1) {
s/([\\]begin\s*$O\d+$C\s*thebibliography)/$id++; "\\bibliography$O$id$C$O$id$C $1"/geo;
    #}
    $global{'max_id'} = $id;
    s/([\\]begin\s*$O\d+$C\s*theindex)/\\textohtmlindex $1/o;
    s/[\\]printindex/\\textohtmlindex /o;
    &add_gls_dummy_commands;
    &lib_add_bbl_and_idx_dummy_commands() if defined(&lib_add_bbl_and_idx_dummy_commands);
}

sub add_gls_dummy_commands{
   s/[\\]printglossary/\\textohtmlglossary/sg;
   s/[\\]printglossaries/\\textohtmlglossaries/sg;
}

sub get_firstkeyval{
   local($key,$_) = @_;
   local($value);

   s/\b$key\s*=$OP(\d+)$CP(.*)$OP\1$CP\s*(,|$)/$value=$2;','/es;
   undef($value) if $`=~/\b$key\s*=/;

   unless (defined($value))
   {
      s/(^|,)\s*$key\s*=\s*([^,]*)\s*(,|$)/,/s;
      $value=$2;
   }

   ($value,$_);
}

# need to get the value of the last key of a given name
# in the event of multiple occurrences.
sub get_keyval{
   local($key,$_) = @_;
   local($value);

   while (/\b$key\s*=/g)
   {
      ($value,$_) = &get_firstkeyval($key, $_);
      last unless defined($value);
   }

   ($value,$_);
}

sub get_boolval{
   local($key,$_) = @_;
   local($value);

   while (/\b$key\s*(?:=(true|false))?\b/g)
   {
     $value = ($1 ? $1 : 'true');
   }

   ($value eq 'true' ? 1 : 0, $_);
}

# This is modified from do_cmd_textohtmlindex

sub do_cmd_textohtmlglossary{
   local($_) = @_;

   local($keyval,$pat) = &get_next_optional_argument;

   local($type,$title,$toctitle,$style,$nonumberlist);

   $nonumberlist = 'default';

   ($type,$keyval) = &get_keyval('type', $keyval);
   ($title,$keyval) = &get_keyval('title', $keyval);
   ($toctitle,$keyval) = &get_keyval('toctitle', $keyval);
   ($style,$keyval) = &get_keyval('style', $keyval);
   ($nonumberlist,$keyval) = &get_boolval('nonumberlist', $keyval);

   &make_textohtmlglossary($type,$toctitle,$title,$style,$nonumberlist).$_;
}

# add_real_gls does the actual glossary
sub make_textohtmlglossary{
   local($type,$toctitle,$title,$style,$nonumberlist) = @_;

   unless (defined($type)) {$type = 'main';}

   unless (defined $gls_mark{$type})
   {
      &write_warnings("glossary type '$type' not implemented");
   }

   if ($style)
   {
      $gls_style{$type} = $style;
   }

   $toctitle = $gls_toctitle{$type} unless ($toctitle or $title);

   $title = $gls_title{$type} unless ($title);
   $toctitle = $title unless ($toctitle);

   $gls_toctitle{$type} = $toctitle;

   $gls_nonumberlist{$type} = $nonumberlist unless ($nonumberlist eq 'default');

   $toc_sec_title = $toctitle;
   $glsfile{$type} = $CURRENT_FILE;

   if (defined($frame_main_suffix))
   {
      $glsfile{$type}=~s/$frame_main_suffix/$frame_body_suffix/;
   }

   $TITLE=&translate_commands($toctitle);

   if (%glossary_labels) { &make_glossary_labels(); }

   if (($SHORT_INDEX) && (%glossary_segment))
   {
      &make_preglossary();
   }
   else
   {
      $preglossary = &translate_commands("\\glossarypreamble");
   }

   local $idx_head = $section_headings{'textohtmlindex'};
   local($heading) = join(''
        , &make_section_heading($title, $idx_head)
        , $gls_mark{$type} );
   local($pre,$post) = &minimize_open_tags($heading);

   join('',"<BR>\n" , $pre);
}

sub do_cmd_textohtmlglossaries{
   local($_) = @_;

   foreach $type (keys %gls_mark)
   {
      $id = ++$global{'max_id'};
      $_ = &make_textohtmlglossary($type,$gls_title{'main'}).$_;
   }

   $_;
}

sub make_glossary_labels {
    local($key, @keys);
    @keys = keys %glossary_labels;
    foreach $key (@keys) {
        if (($ref_files{$key}) && !($ref_files{$key} eq "$glsfile{'main'}")) {
            local($tmp) = $ref_files{$key};
            &write_warnings("\nmultiple label $key , target in $glsfile{'main'} masks $tmp ");
        }
        $ref_files{$key} .= $glsfile{'main'};
    }
}

sub make_preglossary{ &make_real_preglossary }
sub make_real_preglossary{
    local($key, @keys, $head, $body);
    $head = "<HR>\n<H4>Legend:</H4>\n<DL COMPACT>";
    @keys = keys %glossary_segment;
    foreach $key (@keys) {
        local($tmp) = "segment$key";
        $tmp = $ref_files{$tmp};
        $body .= "\n<DT>$key<DD>".&make_named_href('',$tmp,$glossary_segment{$key});
    }
    $preglossary = join('', $head, $body, "\n</DL>") if ($body);
}

sub do_cmd_glossary { &do_real_glossary(@_) }
sub do_real_glossary {
   local($_) = @_;
   local($type) = "main";
   local($anchor,$entry);

   local($type,$pat) = &get_next_optional_argument;

   $entry = &missing_braces unless 
           (s/$next_pair_pr_rx//o&&($entry=$2));

   $anchor = &make_glossary_entry($entry,$anchor_invisible_mark,$type);

   join('', $anchor, $_);
}

sub make_glossary_entry { &make_real_glossary_entry(@_) }
sub make_real_glossary_entry {
    local($entry,$text,$type) = @_;
    local($this_file) = $CURRENT_FILE;

    $TITLE = $saved_title
       if (($saved_title)&&(!($TITLE)||($TITLE eq $default_title)));

    # Save the reference
    local($str) = "$label###" . ++$global{'max_id'}; # Make unique

    local($id) = ++$glsentry{$entry}{'maxid'};
    local($glsanchor)="gls:$entry$id";

    local($target) = $frame_body_name;

    if (defined($frame_main_suffix))
    {
       $this_file=~s/$frame_main_suffix/$frame_body_suffix/;
    }

    $glossary{$type}{$str} .= &make_half_href($this_file."#$glsanchor");
    $glossary_format{$type}{$str} = $GLSCURRENTFORMAT;
    $glossary_entry{$type}{$str} = $entry;
    $glossary_linktext{$type}{$str} = $TITLE;

    local($mark) = $gls_file_mark{$type};

    $mark = &get_gls_file_mark($type, $entry) if (defined(&get_gls_file_mark));

    $text = &translate_commands($text);

    if (defined($frame_foot_name))
    {
       "<A HREF=\"$mark#gls:$entry\" NAME=\"$glsanchor\" TARGET=\"$frame_foot_name\">$text<\/A>";
    }
    else
    {
       "<A HREF=\"$mark#gls:$entry\" NAME=\"$glsanchor\">$text<\/A>";
    }
}

sub make_real_glossary_entry_no_backlink {
    local($entry,$text,$type) = @_;
    local($this_file) = $CURRENT_FILE;

    local($target) = $frame_body_name;

    if (defined($frame_main_suffix))
    {
       $this_file=~s/$frame_main_suffix/$frame_body_suffix/;
    }

    local($mark) = $gls_file_mark{$type};

    $mark = &get_gls_file_mark($type, $entry) if (defined(&get_gls_file_mark));

    $text = &translate_commands($text);

    if (defined($frame_foot_name))
    {
       "<A HREF=\"$mark#gls:$entry\" NAME=\"$glsanchor\" TARGET=\"$frame_foot_name\">$text<\/A>";
    }
    else
    {
       "<A HREF=\"$mark#gls:$entry\" >$text<\/A>";
    }
}

sub do_cmd_newglossary{
   local($_) = @_;
   local($type,$out,$in,$opt,$pat,$title);

   ($opt,$pat) = &get_next_optional_argument;

   $type = &missing_braces unless 
           (s/$next_pair_pr_rx//o&&($type=$2));
   $in = &missing_braces unless 
           (s/$next_pair_pr_rx//o&&($in=$2));
   $out = &missing_braces unless 
           (s/$next_pair_pr_rx//o&&($out=$2));
   $title = &missing_braces unless 
           (s/$next_pair_pr_rx//o&&($title=$2));

   ($opt,$pat) = &get_next_optional_argument;

   &make_newglossarytype($type, $title);

   $_;
}

sub make_newglossarytype{
   local($type, $title) = @_;

   $gls_mark{$type} = "<tex2html_gls_${type}_mark>";
   $gls_file_mark{$type} = "<tex2html_gls_${type}_file_mark>";
   $gls_title{$type} = $title;
   $gls_toctitle{$type} = $title;
   $delimN{$type} = ", ";
   $glsnumformat{$type} = $GLSCURRENTFORMAT;
   @{$gls_entries{$type}} = ();
   $gls_displayfirst{$type} = "glsdisplayfirst";
   $gls_display{$type} = "glsdisplay";
   $gls_nonumberlist{$type} = $gls_nonumberlist{'main'};
}

sub do_cmd_glsdisplay{
   local($_) = @_;
   local($text,$description,$symbol,$insert);

   $text = &missing_braces unless
        (s/$next_pair_pr_rx/$text=$2;''/eo);

   $description = &missing_braces unless
        (s/$next_pair_pr_rx/$description=$2;''/eo);

   $symbol = &missing_braces unless
        (s/$next_pair_pr_rx/$symbol=$2;''/eo);

   $insert = &missing_braces unless
        (s/$next_pair_pr_rx/$insert=$2;''/eo);

   "$text$insert" . $_;
}

sub do_cmd_glsdisplayfirst{
   local($_) = @_;
   local($text,$description,$symbol,$insert);

   $text = &missing_braces unless
        (s/$next_pair_pr_rx/$text=$2;''/eo);

   $description = &missing_braces unless
        (s/$next_pair_pr_rx/$description=$2;''/eo);

   $symbol = &missing_braces unless
        (s/$next_pair_pr_rx/$symbol=$2;''/eo);

   $insert = &missing_braces unless
        (s/$next_pair_pr_rx/$insert=$2;''/eo);

   "$text$insert" . $_;
}

sub gls_get_displayfirst{
   local($type) = @_;
   local($display)= $gls_displayfirst{$type};

   if (not defined($display))
   {
      &write_warnings("Glossary '$type' is not defined");
      $display='';
   }
   elsif ($display eq '')
   {
      &write_warnings("glsdisplayfirst not set for glossary '$type'");
   }
   else
   {
      $display = "\\$display ";
   }

   $display;
}

sub gls_get_display{
   local($type) = @_;
   local($display)= $gls_display{$type};

   if (not defined($display))
   {
      &write_warnings("Glossary '$type' is not defined");
      $display = '';
   }
   elsif ($display eq '')
   {
      &write_warnings("glsdisplay not set for glossary '$type'");
   }
   else
   {
      $display = "\\$display ";
   }

   $display;
}

sub do_cmd_glsnamefont{
   local($_) = @_;
   local($text);

   $text = &missing_braces unless
        (s/$next_pair_pr_rx/$text=$2;''/eo);

   "<B>$text</B>$_";
}

sub do_cmd_newacronym{
   local($_) = @_;
   local($label,$abbrev,$long,$opt,$shortplural,$longplural);

   ($opt,$pat) = &get_next_optional_argument;

   $label = &missing_braces unless
        (s/$next_pair_pr_rx/$label=$2;''/eo);
   $abbrv = &missing_braces unless
        (s/$next_pair_pr_rx/$abbrv=$2;''/eo);
   $long = &missing_braces unless
        (s/$next_pair_pr_rx/$long=$2;''/eo);

   ($longplural,$opt) = &get_keyval('longplural', $opt);
   ($shortplural,$opt) = &get_keyval('shortplural', $opt);

   $longplural = $long.'s' unless ($longplural);
   $shortplural = $abbrv.'s' unless ($shortplural);

   local($cmd) = "\\newglossaryentry";
   local($id);
   $id = ++$global{'max_id'};
   $cmd .= "$OP$id$CP$label$OP$id$CP";
   $id = ++$global{'max_id'};
   local($entry) = "type=$OP$id$CP\\acronymtype$OP$id$CP,";
   $id = ++$global{'max_id'};
   $entry .= "name=$OP$id$CP$abbrv$OP$id$CP,";
   $id = ++$global{'max_id'};
   $entry .= "description=$OP$id$CP$long$OP$id$CP,";
   $id = ++$global{'max_id'};
   $entry .= "text=$OP$id$CP$abbrv$OP$id$CP,";
   $id = ++$global{'max_id'};
   $entry .= "first=$OP$id$CP$long ($abbrv)$OP$id$CP,";
   $id = ++$global{'max_id'};
   $entry .= "plural=$OP$id$CP$shortplural$OP$id$CP,";
   $id = ++$global{'max_id'};
   $entry .= "firstplural=$OP$id$CP$longplural ($shortplural)$OP$id$CP";

   $id = ++$global{'max_id'};
   $cmd .= "$OP$id$CP$entry,$opt$OP$id$CP";

   &translate_commands($cmd).$_;
}

sub gls_entry_init{
   local($label, $type, $name, $desc) = @_;

   %{$glsentry{$label}} = 
     ( type => $type,
       name => $name,
       'sort' => $name,
       description => $desc,
       text => $name,
       first => $name,
       plural => "${name}s",
       firstplural => "${name}s",
       symbol => '',
       flag => 0,
       maxid => 0,
       level => 0,
       parent => ''
     );

   $#{@{$glsentry{$label}{children}}} = -1; 

   $glsentry{$label};
}

sub gls_get_type{
   local($label) = @_;
   local($type) = '';

   if (&gls_entry_defined($label))
   {
      $type = $glsentry{$label}{'type'};
   }
   else
   {
      &write_warnings("gls_get_type: glossary entry '$label' has not been defined");
   }

   $type;
}

sub gls_set_type{
   local($label, $type) = @_;

   if (&gls_entry_defined($label))
   {
      $glsentry{$label}{'type'} = $type;
   }
   else
   {
      &write_warnings("gls_set_type: glossary entry '$label' has not been defined");
   }
}

sub gls_get_name{
   local($label) = @_;
   local($name) = '';

   if (&gls_entry_defined($label))
   {
      $name = $glsentry{$label}{'name'};
   }
   else
   {
      &write_warnings("gls_get_name: glossary entry '$label' has not been defined");
   }

   $name;
}

sub gls_set_name{
   local($label, $name) = @_;

   if (&gls_entry_defined($label))
   {
      $glsentry{$label}{'name'} = $name;
   }
   else
   {
      &write_warnings("gls_set_name: glossary entry '$label' has not been defined");
   }
}

sub gls_get_description{
   local($label) = @_;
   local($description) = '';

   if (&gls_entry_defined($label))
   {
      $description = $glsentry{$label}{'description'};
   }
   else
   {
      &write_warnings("gls_get_description: glossary entry '$label' has not been defined");
   }

   $description;
}

sub gls_set_description{
   local($label, $description) = @_;

   if (&gls_entry_defined($label))
   {
      $glsentry{$label}{'description'} = $description;
   }
   else
   {
      &write_warnings("gls_set_description: glossary entry '$label' has not been defined");
   }
}

sub gls_get_symbol{
   local($label) = @_;
   local($symbol) = '';

   if (&gls_entry_defined($label))
   {
      $symbol = $glsentry{$label}{'symbol'};
   }
   else
   {
      &write_warnings("gls_get_symbol: glossary entry '$label' has not been defined");
   }

   $symbol;
}

sub gls_set_symbol{
   local($label, $symbol) = @_;

   if (&gls_entry_defined($label))
   {
      $glsentry{$label}{'symbol'} = $symbol;
   }
   else
   {
      &write_warnings("gls_set_symbol: glossary entry '$label' has not been defined");
   }
}

sub gls_get_sort{
   local($label) = @_;
   local($sort) = '';

   if (&gls_entry_defined($label))
   {
      $sort = $glsentry{$label}{'sort'};
   }
   else
   {
      &write_warnings("gls_get_sort: glossary entry '$label' has not been defined");
   }

   $sort;
}

sub gls_set_sort{
   local($label, $sort) = @_;

   if (&gls_entry_defined($label))
   {
      $glsentry{$label}{'sort'} = $sort;
   }
   else
   {
      &write_warnings("gls_set_sort: glossary entry '$label' has not been defined");
   }
}

sub gls_get_text{
   local($label) = @_;
   local($text) = '';

   if (&gls_entry_defined($label))
   {
      $text = $glsentry{$label}{'text'};
   }
   else
   {
      &write_warnings("gls_get_text: glossary entry '$label' has not been defined");
   }

   $text;
}

sub gls_set_text{
   local($label, $text) = @_;

   if (&gls_entry_defined($label))
   {
      $glsentry{$label}{'text'} = $text;
   }
   else
   {
      &write_warnings("gls_set_text: glossary entry '$label' has not been defined");
   }
}

sub gls_get_plural{
   local($label) = @_;
   local($plural) = '';

   if (&gls_entry_defined($label))
   {
      $plural = $glsentry{$label}{'plural'};
   }
   else
   {
      &write_warnings("gls_get_plural: glossary entry '$label' has not been defined");
   }

   $plural;
}

sub gls_set_plural{
   local($label, $plural) = @_;

   if (&gls_entry_defined($label))
   {
      $glsentry{$label}{'plural'} = $plural;
   }
   else
   {
      &write_warnings("gls_set_plural: glossary entry '$label' has not been defined");
   }
}

sub gls_get_firstplural{
   local($label) = @_;
   local($firstplural) = '';

   if (&gls_entry_defined($label))
   {
      $firstplural = $glsentry{$label}{'firstplural'};
   }
   else
   {
      &write_warnings("gls_get_firstplural: glossary entry '$label' has not been defined");
   }

   $firstplural;
}

sub gls_set_firstplural{
   local($label, $firstplural) = @_;

   if (&gls_entry_defined($label))
   {
      $glsentry{$label}{'firstplural'} = $firstplural;
   }
   else
   {
      &write_warnings("gls_set_firstplural: glossary entry '$label' has not been defined");
   }
}

sub gls_get_first{
   local($label) = @_;
   local($first) = '';

   if (&gls_entry_defined($label))
   {
      $first = $glsentry{$label}{'first'};
   }
   else
   {
      &write_warnings("gls_get_first: glossary entry '$label' has not been defined");
   }

   $first;
}

sub gls_set_first{
   local($label, $first) = @_;

   if (&gls_entry_defined($label))
   {
      $glsentry{$label}{'first'} = $first;
   }
   else
   {
      &write_warnings("gls_set_first: glossary entry '$label' has not been defined");
   }
}

sub gls_get_parent{
  local($label) = @_;

  local($parent);

  if (&gls_entry_defined($label))
  {
     $parent = $glsentry{$label}{'parent'};
  }
  else
  {
     &write_warnings("gls_get_parent: glossary entry '$label' has not been defined");
  }

  $parent;
}

sub gls_get_level{
   local($label) = @_;

   local($level) = 0;

   if (&gls_entry_defined($label))
   {
      $level = $glsentry{$label}{'level'};
   }
   else
   {
     &write_warnings("gls_get_level: glossary entry '$label' has not been defined");
   }

   $level;
}

sub gls_set_parent{
  local ($label, $parent) = @_;

  if (&gls_entry_defined($label))
  {
     if ($parent)
     {
        if (&gls_entry_defined($parent))
        {
           $glsentry{$label}{'parent'} = $parent;

           push @{$glsentry{$parent}{'children'}}, $label;

           $glsentry{$label}{'level'} = $glsentry{$parent}{'level'}+1;
        }
        else
        {
           &write_warnings("gls_set_parent: parent '$parent' for glossary entry '$label' has not been defined");
        }
     }
     else
     {
        $glsentry{$label}{'parent'} = '';
     }
  }
  else
  {
     &write_warnings("gls_set_parent: glossary entry '$label' has not been defined");
  }
}

sub gls_get_childcount{
   my($label) = @_;

   my($count) = 0;

   if (&gls_entry_defined($label))
   {
      $count = scalar(@{$glsentry{$label}{'children'}});
   }
   else
   {
      &write_warnings("gls_get_childcount: glossary entry '$label' has not been defined");
   }

   $count;
}

sub gls_get_referenced_childcount{
   my($label) = @_;

   my($count) = 0;

   if (&gls_entry_defined($label))
   {
      $count = scalar(grep(($glsentry{$_}{'maxid'} > 0), @{$glsentry{$label}{'children'}}));
   }
   else
   {
      &write_warnings("gls_get_childcount: glossary entry '$label' has not been defined");
   }

   $count;
}

sub gls_set_userkeys{
   local($label, @user) = @_;

   if (&gls_entry_defined($label))
   {
      for (my $idx = 0; $idx < 6; $idx++)
      {
         $glsentry{$label}{"user".($idx+1)} = $user[$idx];
      }
   }
   else
   {
      &write_warnings("gls_set_user: glossary entry '$label' has not been defined");
   }
}

sub gls_set_user{
   local($label, $idx, $text) = @_;

   if (&gls_entry_defined($label))
   {
      $glsentry{$label}{"user$idx"} = $text;
   }
   else
   {
      &write_warnings("gls_set_user: glossary entry '$label' has not been defined");
   }
}

sub gls_set_useri{
   local($label, $text) = @_;

   if (&gls_entry_defined($label))
   {
      $glsentry{$label}{'user1'} = $text;
   }
   else
   {
      &write_warnings("gls_set_useri: glossary entry '$label' has not been defined");
   }
}

sub gls_set_userii{
   local($label, $text) = @_;

   if (&gls_entry_defined($label))
   {
      $glsentry{$label}{'user2'} = $text;
   }
   else
   {
      &write_warnings("gls_set_userii: glossary entry '$label' has not been defined");
   }
}

sub gls_set_useriii{
   local($label, $text) = @_;

   if (&gls_entry_defined($label))
   {
      $glsentry{$label}{'user3'} = $text;
   }
   else
   {
      &write_warnings("gls_set_useriii: glossary entry '$label' has not been defined");
   }
}

sub gls_set_useriv{
   local($label, $text) = @_;

   if (&gls_entry_defined($label))
   {
      $glsentry{$label}{'user4'} = $text;
   }
   else
   {
      &write_warnings("gls_set_useriv: glossary entry '$label' has not been defined");
   }
}

sub gls_set_userv{
   local($label, $text) = @_;

   if (&gls_entry_defined($label))
   {
      $glsentry{$label}{'user5'} = $text;
   }
   else
   {
      &write_warnings("gls_set_userv: glossary entry '$label' has not been defined");
   }
}

sub gls_set_uservi{
   local($label, $text) = @_;

   if (&gls_entry_defined($label))
   {
      $glsentry{$label}{'user6'} = $text;
   }
   else
   {
      &write_warnings("gls_set_uservi: glossary entry '$label' has not been defined");
   }
}

sub gls_get_user{
   local($label, $idx) = @_;
   local($value) = '';

   if (&gls_entry_defined($label))
   {
      $value = $glsentry{$label}{"user".$idx};
   }
   else
   {
      &write_warnings("gls_get_user[$idx]: glossary entry '$label' has not been defined");
   }

   $value;
}

sub gls_used{
   local($label) = @_;
   local($flag) = 0;

   if (&gls_entry_defined($label))
   {
      $flag = $glsentry{$label}{'flag'};
   }
   else
   {
      &write_warnings("gls_used: glossary entry '$label' has not been defined");
   }

   $flag;
}

sub gls_entry_defined{
   local($label) = @_;

   (%{$glsentry{$label}}) ? 1 : 0;
}

sub do_cmd_newglossaryentry{
   local($_) = @_;
   local($label,$name,$description,$symbol,$sort,$text,$first,
     $plural,$firstplural,$type,$keyval,$parent,@user);

   $label = &missing_braces unless
              s/$next_pair_pr_rx/$label=$2;''/eo;

   $keyval = &missing_braces unless
              s/$next_pair_pr_rx/$keyval=$2;''/eo;

   ($name,$keyval) = &get_keyval('name', $keyval);
   ($description,$keyval) = &get_keyval('description', $keyval);
   ($symbol,$keyval) = &get_keyval('symbol', $keyval);
   ($sort,$keyval) = &get_keyval('sort', $keyval);
   ($text,$keyval) = &get_keyval('text', $keyval);
   ($first,$keyval) = &get_keyval('first', $keyval);
   ($firstplural,$keyval) = &get_keyval('firstplural', $keyval);
   ($plural,$keyval) = &get_keyval('plural', $keyval);
   ($type,$keyval) = &get_keyval('type', $keyval);
   ($parent,$keyval) = &get_keyval('parent', $keyval);

   if ($parent and not $name)
   {
     $name = &gls_get_name($parent);
   }

   @user = ();

   for (my $idx = 0; $idx < 6; $idx++)
   {
      ($user[$idx],$keyval) = &get_keyval("user".($idx+1), $keyval);
   }

   if (defined($type))
   {
      $type = &translate_commands($type);
   }
   else
   {
      $type = 'main';
   }

   &gls_entry_init($label, $type, $name, $description);

   &gls_set_symbol($label, defined($symbol)?$symbol:'');

   $sort = "$name $description" unless (defined($sort) and $sort);

   &gls_set_sort($label, $sort);

   $text = $name unless (defined($text) and $text);

   &gls_set_text($label, $text);

   $first = $text unless (defined($first) and $first);

   &gls_set_first($label, $first);

   $plural = "${text}s" unless (defined($plural) and $plural);

   &gls_set_plural($label, $plural);

   $firstplural = "${first}s" unless (defined($firstplural) and $firstplural);

   &gls_set_firstplural($label, $firstplural);

   &gls_set_userkeys($label, @user);

   &gls_set_parent($label, $parent);

   push @{$gls_entries{$type}}, $label;

   $_;
}

sub reset_entry{
   local($label) = @_;

   $glsentry{$label}{'flag'} = 0;
}

sub unset_entry{
   local($label) = @_;

   $glsentry{$label}{'flag'} = 1;
}

sub do_cmd_glsreset{
   local($_) = @_;
   local($label);

   $label = &missing_braces unless
              s/$next_pair_pr_rx/$label=$2;''/eo;

   &reset_entry($label);

   $_;
}

sub do_cmd_glsunset{
   local($_) = @_;
   local($label);

   $label = &missing_braces unless
              s/$next_pair_pr_rx/$label=$2;''/eo;

   &unset_entry($label);

   $_;
}

sub do_cmd_ifglsused{
   local($_) = @_;
   local($label,$true,$false);

   $label = &missing_braces unless
              s/$next_pair_pr_rx/$label=$2;''/eo;

   $true = &missing_braces unless
              s/$next_pair_pr_rx/$true=$2;''/eo;

   $false = &missing_braces unless
              s/$next_pair_pr_rx/$false=$2;''/eo;

   (&gls_used($label) ? $true : $false) . $_;
}

sub do_cmd_ifglsentryexists{
   local($_) = @_;
   local($label,$true,$false);

   $label = &missing_braces unless
              s/$next_pair_pr_rx/$label=$2;''/eo;

   $true = &missing_braces unless
              s/$next_pair_pr_rx/$true=$2;''/eo;

   $false = &missing_braces unless
              s/$next_pair_pr_rx/$false=$2;''/eo;

   (&gls_entry_defined($label) ? $true : $false) . $_;
}

sub gls_add_entry{
   local($type, $label, $format, $text) = @_;

   local($oldfmt) = $GLSCURRENTFORMAT;

   if (defined($format))
   {
      $format=~s/[\(\)]//;

      if ($format)
      {
         $GLSCURRENTFORMAT=$format;
      }
   }

   $id = ++$global{'max_id'};

   local($str) = &make_real_glossary_entry($label,$text,$type);
   $GLSCURRENTFORMAT = $oldfmt;

   $str;
}

sub do_cmd_glsadd{
   local($_) = @_;
   local($optarg,$pat,$label,$str,$id,$type,$format);
   ($optarg,$pat) = &get_next_optional_argument;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   $type = &gls_get_type($label);

   local($dobacklink) = 1;

   if (&gls_used($label))
   {
      if ($INDEXONLYFIRST)
      {
        $dobacklink = 0;
      }
   }
   else
   {
      &unset_entry($label);
   }

   if (defined $type)
   {
      ($format,$optarg) = &get_keyval('format', $optarg);
      $format='' unless(defined($format));

      if ($dobacklink)
      {
         &gls_add_entry($type,$label,$format,"");
      }
      else
      {
         $glsentry{$label}{'maxid'} = ++$glsentry{$entry}{'maxid'};
         my $key = $label."###".$glsentry{$label}{'maxid'};
         $glossary{$type}{$key}='';
      }
   }
   else
   {
      &write_warnings("gls_add: glossary entry '$label' undefined");
      $str = '';
   }

   $str . $_;
}

sub do_cmd_glsaddall{
   local($_) = @_;
   local($optarg,$pat) = &get_next_optional_argument;

   local($format,$list);

   ($list,$optarg) = &get_keyval('types', $optarg);
   ($format,$optarg) = &get_keyval('format', $optarg);

   $format='' unless(defined($format));

   local(@types) = keys(%gls_mark);

   if ($list)
   {
      @types = split /\s*,\s*/, $list;
   }

   foreach $type (@types)
   {
      # strip leading and trailing spaces
      $type=~s/^\s*([^\s]+)\s*$/\1/;

      foreach $label (@{$gls_entries{$type}})
      {
         local($dobacklink) = 1;

         if (&gls_used($label))
         {
            if ($INDEXONLYFIRST)
            {
              $dobacklink = 0;
            }
         }
         else
         {
            &unset_entry($label);
         }

         if ($dobacklink)
         {
            &gls_add_entry($type,$label,$format,"");
         }
      }
   }

   $_;
}

sub do_cmd_glsresetall{
   local($_) = @_;
   local($types,$pat) = &get_next_optional_argument;

   local(@types) = keys(%gls_mark);

   if (defined($types) and $types)
   {
      @types = split /,/, $types;
   }

   foreach $type (@types)
   {
      # strip leasing and trailing spaces
      $type=~s/^\s*([^\s]+)\s*$/\1/;

      foreach $label (@{$gls_entries{$type}})
      {
         &reset_entry($label);
      }
   }

   $_;
}

sub do_cmd_glsunsetall{
   local($_) = @_;
   local($types,$pat) = &get_next_optional_argument;

   local(@types) = keys(%gls_mark);

   if (defined($types) and $types)
   {
      @types = split /,/, $types;
   }

   foreach $type (@types)
   {
      # strip leasing and trailing spaces
      $type=~s/^\s*([^\s]+)\s*$/\1/;

      foreach $label (@{$gls_entries{$type}})
      {
         &reset_entry($label);
      }
   }

   $_;
}

$glslabel = '';

sub do_cmd_glslabel{ $glslabel.$_[0] }

sub make_glslink{
   local($type,$label,$format,$text) = @_;
   local($str) = '';

   $glslabel = $label;

   if (defined $type)
   {
      $str = &gls_add_entry($type,$label,$format,$text);
   }
   else
   {
      &write_warnings("glossary '$type' undefined");
   }

   $str;
}

sub do_cmd_glslink{
   local($_) = @_;
   local($optarg,$pat,$label,$text,$type,$format,$str);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   $text = &missing_braces unless
             (s/$next_pair_pr_rx/$text=$2;''/eo);

   # v1.01 removed following lines (\glslink doesn't have
   # a final optional argument!
   #local ($space) = '';
   #if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}
   #($optarg,$pat) = &get_next_optional_argument;

   $type = &gls_get_type($label);

   #&make_glslink($type, $label, $format, $text).$space . $_;
   &make_glslink($type, $label, $format, $text) . $_;
}

sub do_cmd_glslinkstar{
   local($_) = @_;
   local($optarg,$pat,$label,$text,$type,$format,$str);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   $text = &missing_braces unless
             (s/$next_pair_pr_rx/$text=$2;''/eo);

   $type = &gls_get_type($label);

   $text . $_;
}

sub do_cmd_glsdisp{
   local($_) = @_;
   local($optarg,$pat,$label,$text,$type,$format,$str);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   $text = &missing_braces unless
             (s/$next_pair_pr_rx/$text=$2;''/eo);

   local($dobacklink) = 1;

   if (&gls_used($label))
   {
      if ($INDEXONLYFIRST)
      {
        $dobacklink = 0;
      }
   }
   else
   {
      &unset_entry($label);
   }

   $type = &gls_get_type($label);

   if ($dobacklink)
   {
      &make_glslink($type, $label, $format, $text) .$space . $_;
   }
   else
   {
      &make_real_glossary_entry_no_backlink($label, $text, $type). $space . $_;
   }
}

sub do_cmd_glshyperlink{
   local($_) = @_;

   local($text,$pat) = &get_next_optional_argument;

   local($id, $label);

   $label = &missing_braces unless
      s/$next_pair_pr_rx/$id=$1,$label=$2;''/eo;

   $text = &gls_get_text($label) unless $text;

   local($type) = &gls_get_type($label);

   "<A HREF=\"$gls_file_mark{$type}#gls:$label\">$text<\/A>"
   .$_;
}

sub do_cmd_glsentrydesc{
   local($_) = @_;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   &gls_get_description($label).$_;
}

sub do_cmd_Glsentrydesc{
   local($_) = @_;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   &do_real_makefirstuc(&gls_get_description($label)).$_;
}

sub do_cmd_glsentrytext{
   local($_) = @_;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   &gls_get_text($label).$_;
}

sub do_cmd_Glsentrytext{
   local($_) = @_;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   &do_real_makefirstuc(&gls_get_text($label)).$_;
}

sub do_cmd_glsentryname{
   local($_) = @_;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   &gls_get_name($label).$_;
}

sub do_cmd_Glsentryname{
   local($_) = @_;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   &do_real_makefirstuc(&gls_get_name($label)).$_;
}

sub do_cmd_glsentryfirst{
   local($_) = @_;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   &gls_get_first($label).$_;
}

sub do_cmd_Glsentryfirst{
   local($_) = @_;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   &do_real_makefirstuc(&gls_get_first($label)).$_;
}

sub do_cmd_glsentryplural{
   local($_) = @_;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   &gls_get_plural($label).$_;
}

sub do_cmd_Glsentryplural{
   local($_) = @_;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   &do_real_makefirstuc(&gls_get_plural($label)).$_;
}

sub do_cmd_glsentryfirstplural{
   local($_) = @_;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local($text)=$glsentry{$label}{'firstplural'};

   unless (defined($text))
   {
      &write_warnings("glossary entry '$label' has not been defined");
      $text = '';
   }

   "$text$_";
   &gls_get_firstplural($label).$_;
}

sub do_cmd_Glsentryfirstplural{
   local($_) = @_;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   &do_real_makefirstuc(&gls_get_firstplural($label)).$_;
}

sub do_cmd_glsentrysymbol{
   local($_) = @_;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   &gls_get_symbol($label).$_;
}

sub do_cmd_Glsentrysymbol{
   local($_) = @_;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   &do_real_makefirstuc(&gls_get_symbol($label)).$_;
}

sub do_cmd_glsentryuseri{
   local($_) = @_;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   &gls_get_user($label, 1).$_;
}

sub do_cmd_glsentryuserii{
   local($_) = @_;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   &gls_get_user($label, 2).$_;
}

sub do_cmd_glsentryuseriii{
   local($_) = @_;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   &gls_get_user($label, 3).$_;
}

sub do_cmd_glsentryuseriv{
   local($_) = @_;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   &gls_get_user($label, 4).$_;
}

sub do_cmd_glsentryuserv{
   local($_) = @_;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   &gls_get_user($label, 5).$_;
}

sub do_cmd_glsentryuservi{
   local($_) = @_;

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   &gls_get_user($label, 6).$_;
}

sub do_cmd_gls{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   local($dobacklink) = 1;

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_text($label);
      $display = &gls_get_display($type);

      if ($INDEXONLYFIRST)
      {
        $dobacklink = 0;
      }
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_first($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &translate_commands("$display$args");

   if ($dobacklink)
   {
      &make_glslink($type, $label, $format, $link_text) .$space . $_;
   }
   else
   {
      &make_real_glossary_entry_no_backlink($label, $link_text, $type). $space . $_;
   }
}

# added v1.04
sub do_cmd_glsstar{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_text($label);
      $display = &gls_get_display($type);
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_first($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &translate_commands("$display$args");

   $link_text . $space . $_;
}

sub do_cmd_glspl{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = $glsentry{$label}{'type'};

   local($dobacklink) = 1;

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_plural($label);
      $display = &gls_get_display($type);;

      if ($INDEXONLYFIRST)
      {
        $dobacklink = 0;
      }
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_firstplural($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &translate_commands("$display$args");

   if ($dobacklink)
   {
      &make_glslink($type, $label, $format, $link_text) .$space . $_;
   }
   else
   {
      &make_real_glossary_entry_no_backlink($label, $link_text, $type). $space . $_;
   }
}

# added v1.04
sub do_cmd_glsplstar{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = $glsentry{$label}{'type'};

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_plural($label);
      $display = &gls_get_display($type);;
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_firstplural($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &translate_commands("$display$args");

   $link_text . $space . $_;
}

sub do_cmd_Gls{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = $glsentry{$label}{'type'};

   local($dobacklink) = 1;

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_text($label);
      $display = &gls_get_display($type);;

      if ($INDEXONLYFIRST)
      {
        $dobacklink = 0;
      }
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_first($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &do_real_makefirstuc(&translate_commands("$display$args"));

   if ($dobacklink)
   {
      &make_glslink($type, $label, $format, $link_text) .$space . $_;
   }
   else
   {
      &make_real_glossary_entry_no_backlink($label, $link_text, $type). $space . $_;
   }
}

# added v1.04
sub do_cmd_Glsstar{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = $glsentry{$label}{'type'};

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_text($label);
      $display = &gls_get_display($type);;
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_first($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &translate_commands("$display$args");

   &do_real_makefirstuc($link_text). $space . $_;
}

sub do_cmd_Glspl{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = $glsentry{$label}{'type'};

   local($dobacklink) = 1;

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_plural($label);
      $display = &gls_get_display($type);;

      if ($INDEXONLYFIRST)
      {
        $dobacklink = 0;
      }
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_firstplural($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &do_real_makefirstuc(&translate_commands("$display$args"));

   if ($dobacklink)
   {
      &make_glslink($type, $label, $format, $link_text) .$space . $_;
   }
   else
   {
      &make_real_glossary_entry_no_backlink($label, $link_text, $type). $space . $_;
   }
}

# added v1.04
sub do_cmd_Glsplstar{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = $glsentry{$label}{'type'};

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_plural($label);
      $display = &gls_get_display($type);;
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_firstplural($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &translate_commands("$display$args");

   &do_real_makefirstuc($link_text).$space . $_;
}

sub do_cmd_GLS{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = $glsentry{$label}{'type'};

   local($dobacklink) = 1;

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_text($label);
      $display = &gls_get_display($type);;

      if ($INDEXONLYFIRST)
      {
        $dobacklink = 0;
      }
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_first($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = uc(&translate_commands("$display$args"));

   if ($dobacklink)
   {
      &make_glslink($type, $label, $format, $link_text) .$space . $_;
   }
   else
   {
      &make_real_glossary_entry_no_backlink($label, $link_text, $type). $space . $_;
   }
}

# added v1.04
sub do_cmd_GLSstar{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = $glsentry{$label}{'type'};

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_text($label);
      $display = &gls_get_display($type);;
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_first($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &translate_commands("$display$args");

   uc($link_text).$space . $_;
}

sub do_cmd_GLSpl{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = $glsentry{$label}{'type'};

   local($dobacklink) = 1;

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_plural($label);
      $display = &gls_get_display($type);;

      if ($INDEXONLYFIRST)
      {
        $dobacklink = 0;
      }
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_firstplural($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = uc(&translate_commands("$display$args"));

   if ($dobacklink)
   {
      &make_glslink($type, $label, $format, $link_text) .$space . $_;
   }
   else
   {
      &make_real_glossary_entry_no_backlink($label, $link_text, $type). $space . $_;
   }
}

# added v1.04
sub do_cmd_GLSplstar{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = $glsentry{$label}{'type'};

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_plural($label);
      $display = &gls_get_display($type);;
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_firstplural($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &translate_commands("$display$args");

   uc($link_text).$space . $_;
}

# added 22 Feb 2008
sub do_cmd_glstext{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_text($label);

   &make_glslink($type, $label, $format, $text) .$space . $_;
}

# added 22 Feb 2008
sub do_cmd_Glstext{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_text($label);

   &make_glslink($type, $label, $format, &do_real_makefirstuc($text)) .$space . $_;
}

# added 22 Feb 2008
sub do_cmd_GLStext{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_text($label);

   &make_glslink($type, $label, $format, uc($text)) .$space . $_;
}

# added 22 Feb 2008
sub do_cmd_glsname{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_name($label);

   &make_glslink($type, $label, $format, $text) .$space . $_;
}

# added 22 Feb 2008
sub do_cmd_Glsname{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_name($label);

   &make_glslink($type, $label, $format, &do_real_makefirstuc($text)) .$space . $_;
}

# added 22 Feb 2008
sub do_cmd_GLSname{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_name($label);

   &make_glslink($type, $label, $format, uc($text)) .$space . $_;
}

# added 22 Feb 2008
sub do_cmd_glsfirst{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_first($label);

   &make_glslink($type, $label, $format, $text) .$space . $_;
}

# added 22 Feb 2008
sub do_cmd_Glsfirst{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_first($label);

   &make_glslink($type, $label, $format, &do_real_makefirstuc($text)) .$space . $_;
}

# added 22 Feb 2008
sub do_cmd_GLSfirst{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_first($label);

   &make_glslink($type, $label, $format, uc($text)) .$space . $_;
}

# added 22 Feb 2008
sub do_cmd_glsfirstplural{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_firstplural($label);

   &make_glslink($type, $label, $format, $text) .$space . $_;
}

# added 22 Feb 2008
sub do_cmd_Glsfirstplural{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_firstplural($label);

   &make_glslink($type, $label, $format, &do_real_makefirstuc($text)) .$space . $_;
}

# added 22 Feb 2008
sub do_cmd_GLSfirstplural{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_firstplural($label);

   &make_glslink($type, $label, $format, uc($text)) .$space . $_;
}

# added 22 Feb 2008
sub do_cmd_glsplural{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_plural($label);

   &make_glslink($type, $label, $format, $text) .$space . $_;
}

# added 22 Feb 2008
sub do_cmd_Glsplural{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_plural($label);

   &make_glslink($type, $label, $format, &do_real_makefirstuc($text)) .$space . $_;
}

# added 22 Feb 2008
sub do_cmd_GLSplural{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_plural($label);

   &make_glslink($type, $label, $format, uc($text)) .$space . $_;
}

# added 22 Feb 2008
sub do_cmd_glsdesc{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_description($label);

   &make_glslink($type, $label, $format, $text) .$space . $_;
}

# added 22 Feb 2008
sub do_cmd_Glsdesc{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_description($label);

   &make_glslink($type, $label, $format, &do_real_makefirstuc($text)) .$space . $_;
}

# added 22 Feb 2008
sub do_cmd_GLSdesc{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_description($label);

   &make_glslink($type, $label, $format, uc($text)) .$space . $_;
}

# added 22 Feb 2008
sub do_cmd_glssymbol{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_symbol($label);

   &make_glslink($type, $label, $format, $text) .$space . $_;
}

# added 22 Feb 2008
sub do_cmd_Glssymbol{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_symbol($label);

   &make_glslink($type, $label, $format, &do_real_makefirstuc($text)) .$space . $_;
}

# added 22 Feb 2008
sub do_cmd_GLSsymbol{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_symbol($label);

   &make_glslink($type, $label, $format, uc($text)) .$space . $_;
}

sub do_cmd_glsuseri{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_user($label, 1);

   &make_glslink($type, $label, $format, $text) .$space . $_;
}

sub do_cmd_Glsuseri{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &do_real_makefirstuc(&gls_get_user($label, 1));

   &make_glslink($type, $label, $format, $text) .$space . $_;
}

sub do_cmd_glsuserii{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_user($label, 2);

   &make_glslink($type, $label, $format, $text) .$space . $_;
}

sub do_cmd_Glsuserii{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &do_real_makefirstuc(&gls_get_user($label, 2));

   &make_glslink($type, $label, $format, $text) .$space . $_;
}

sub do_cmd_glsuseriii{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_user($label, 3);

   &make_glslink($type, $label, $format, $text) .$space . $_;
}

sub do_cmd_Glsuseriii{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &do_real_makefirstuc(&gls_get_user($label, 3));

   &make_glslink($type, $label, $format, $text) .$space . $_;
}

sub do_cmd_glsuseriv{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_user($label, 4);

   &make_glslink($type, $label, $format, $text) .$space . $_;
}

sub do_cmd_Glsuseriv{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &do_real_makefirstuc(&gls_get_user($label, 4));

   &make_glslink($type, $label, $format, $text) .$space . $_;
}

sub do_cmd_glsuserv{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_user($label, 5);

   &make_glslink($type, $label, $format, $text) .$space . $_;
}

sub do_cmd_Glsuserv{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &do_real_makefirstuc(&gls_get_user($label, 5));

   &make_glslink($type, $label, $format, $text) .$space . $_;
}

sub do_cmd_glsuservi{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &gls_get_user($label, 6);

   &make_glslink($type, $label, $format, $text) .$space . $_;
}

sub do_cmd_Glsuservi{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

   ($format,$optarg) = &get_keyval('format', $optarg);

   $label = &missing_braces unless
             (s/$next_pair_pr_rx/$label=$2;''/eo);

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = &gls_get_type($label);

   $text = &do_real_makefirstuc(&gls_get_user($label, 6));

   &make_glslink($type, $label, $format, $text) .$space . $_;
}

sub do_cmd_acrshort{
  &do_cmd_glstext(@_)
}

sub do_cmd_Acrshort{
  &do_cmd_Glstext(@_)
}

sub do_cmd_ACRshort{
  &do_cmd_GLStext(@_)
}

sub do_cmd_acrlong{
  &do_cmd_glsdesc(@_)
}

sub do_cmd_Acrlong{
  &do_cmd_Glsdesc(@_)
}

sub do_cmd_ACRlong{
  &do_cmd_GLSdesc(@_)
}

sub do_cmd_acrfull{
  &do_cmd_glsfirst(@_)
}

sub do_cmd_Acrfull{
  &do_cmd_Glsfirst(@_)
}

sub do_cmd_ACRfull{
  &do_cmd_GLSfirst(@_)
}

sub do_cmd_glossarypreamble{
   local($_) = @_;
   $_[0];
}

sub do_cmd_glossarypostamble{
   local($_) = @_;
   $_[0];
}

sub do_cmd_glsnumformat{
   local($_) = @_;

   $_;
}

sub do_cmd_hyperit{
   join('', "\\textit ", $_[0]);
}

sub do_cmd_hyperrm{
   join('', "\\textrm ", $_[0]);
}

sub do_cmd_hypertt{
   join('', "\\texttt ", $_[0]);
}

sub do_cmd_hypersf{
   join('', "\\textsf ", $_[0]);
}

sub do_cmd_hyperbf{
   join('', "\\textbf ", $_[0]);
}

&ignore_commands( <<_IGNORED_CMDS_ );
makeglossary
makeglossaries
glossaryentrynumbers # {}
_IGNORED_CMDS_

1;
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</glossaries.perl>
%    \end{macrocode}
%\fi
%\Finale
\endinput
