%\iffalse
% glossaries-extra.dtx generated using makedtx version 1.2 (c) Nicola Talbot
% Command line args:
%   -codetitle "Main Package Code (\\styfmt{glossaries-extra.sty})"
%   -comment ".*\.tex"
%   -comment ".*\.bib"
%   -setambles ".*\.bib=>\nopreamble\nopostamble"
%   -author "Nicola Talbot"
%   -src "glossaries-extra.sty\Z=>glossaries-extra.sty"
%   -src "glossaries-extra-bib2gls.sty\Z=>glossaries-extra-bib2gls.sty"
%   -src "glossaries-extra-stylemods.sty\Z=>glossaries-extra-stylemods.sty"
%   -src "glossary-bookindex.sty\Z=>glossary-bookindex.sty"
%   -src "(example-glossaries-.+\.tex)\Z=>\1"
%   -src "(example-glossaries-.+\.bib)\Z=>\1"
%   -macrocode ".*\.tex"
%   -macrocode ".*\.bib"
%   -doc "glossaries-extra-codedoc.tex"
%   -section "chapter"
%   glossaries-extra
% Created on 2018/5/9 22:46
%\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) 2018 Nicola Talbot, all rights reserved.
% \fi
% \iffalse
%<*driver>
\documentclass[report,widecs]{nlctdoc}

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

\usepackage{alltt}
\usepackage{pifont}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[colorlinks,
            bookmarks,
            hyperindex=false,
            pdfauthor={Nicola L.C. Talbot},
            pdftitle={glossaries-extra.sty: an extension to the glossaries
package},
            pdfkeywords={LaTeX,package,glossary,abbreviations}]{hyperref}
\usepackage[nonumberlist,nopostdot=false]{glossaries-extra}

\RecordChanges

\makeglossaries

\renewcommand*{\main}[1]{\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}.
  \glsadd{firstuseflag}\glsadd{firstusetext}%
  \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{Counter}{counter}{glossary counters}
\doxitem{AbbrvStyle}{abbrvstyle}{abbreviation styles}

\setcounter{IndexColumns}{2}

\CheckSum{23123}

\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*{\stylefmt}[1]{\textsf{#1}}

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

\newcommand*{\acrstyle}[1]{\stylefmt{#1}%
 \index{acronym styles (glossaries):>#1=\protect\stylefmt{#1}|main}}

\newcommand*{\abbrstyle}[1]{\stylefmt{#1}%
 \index{abbreviation styles:>#1=\protect\stylefmt{#1}|main}}

\newcommand*{\category}[1]{\textsf{#1}\index{entry categories:>#1={\protect\sffamily#1}|main}}

\newcommand*{\catattr}[1]{\textsf{#1}\index{category attributes:>#1={\protect\sffamily#1}|main}}

\GlossaryPrologue{%
 \chapter*{{Change History}}%
 \markboth{{Change History}}{{Change History}}%
 \phantomsection
 \addcontentsline{toc}{chapter}{Change History}%
 \raggedright
}

\title{glossaries-extra.sty v1.31:
 documented code}
\author{Nicola L.C. Talbot\\[10pt]
Dickimaw Books\\
\url{http://www.dickimaw-books.com/}}

\date{2018-05-09}

\begin{document}
\DocInput{glossaries-extra.dtx}
\end{document}
%</driver>
%\fi
%\MakeShortVerb{"}
%\DeleteShortVerb{\|}
%
% \maketitle
%
%\begin{abstract}
%This is the documented code for the \sty{glossaries-extra} package.
%See glossaries-extra-manual.pdf for the user manual.
%
%\begin{important}
%This package is experimental and not stable. It's provided for
%testing purposes only. Future versions may not be compatible with
%this version. Once it has stabilised I'll add it to CTAN, at which
%point compatibility with the first stable version will be
%maintained.
%\end{important}
%\end{abstract}
%
%\tableofcontents
%
%\StopEventually{%
%  \printglossaries
%  \PrintChanges
%  \PrintIndex
%}
%
%
%
%\chapter{Main Package Code (\styfmt{glossaries-extra.sty})}
%\iffalse
%    \begin{macrocode}
%<*glossaries-extra.sty>
%    \end{macrocode}
%\fi
%\changes{0.1}{2015-11-22}{Initial experimental release}
%\section{Package Initialisation and Options}
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{glossaries-extra}[2018/05/09 v1.31 (NLCT)]
%    \end{macrocode}
% Requires \sty{xkeyval} to define package options.
%    \begin{macrocode}
\RequirePackage{xkeyval}
%    \end{macrocode}
% Requires \sty{etoolbox} package.
%    \begin{macrocode}
\RequirePackage{etoolbox}
%    \end{macrocode}
% Has \styfmt{glossaries} already been loaded?
%    \begin{macrocode}
\@ifpackageloaded{glossaries}
{%
%    \end{macrocode}
% Already loaded so pass any options to \cs{setupglossaries}.
% This means that the options that can only be set when
% \styfmt{glossaries} is loaded can't be used.
%    \begin{macrocode}
   \newcommand{\glsxtr@dooption}[1]{\setupglossaries{#1}}%
   \let\@glsxtr@declareoption\@gls@declareoption
}
{%
%    \end{macrocode}
% Not already loaded, so pass options to \styfmt{glossaries}.
%    \begin{macrocode}
   \newcommand{\glsxtr@dooption}[1]{%
     \PassOptionsToPackage{#1}{glossaries}%
   }%
%    \end{macrocode}
% Set the defaults.
%    \begin{macrocode}
   \PassOptionsToPackage{toc}{glossaries}
   \PassOptionsToPackage{nopostdot}{glossaries}
   \PassOptionsToPackage{noredefwarn}{glossaries}
   \@ifpackageloaded{polyglossia}%
   {}%
   {%
     \@ifpackageloaded{babel}%
     {\PassOptionsToPackage{translate=babel}{glossaries}}%
     {}%
   }%
   \newcommand*{\@glsxtr@declareoption}[2]{%
     \DeclareOptionX{#1}{#2}%
     \DeclareOption{#1}{#2}%
   }
}
%    \end{macrocode}
% Declare package options.
%\begin{macro}{\glsxtrundefaction}
% Determines what to do if an entry hasn't been defined.
% The two arguments are the error or warning message and the help
% message if an error should be produced.
%    \begin{macrocode}
\newcommand*{\glsxtrundefaction}[2]{%
  \@glsxtrundeftag\PackageError{glossaries-extra}{#1}{#2}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtr@warnonexistsordo}
% If user wants \pkgopt[warn]{undefaction}, then \styfmt{glossaries}
% v4.19 is required.
%    \begin{macrocode}
\newcommand*{\glsxtr@warnonexistsordo}[1]{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrundeftag}
% Text to display when an entry doesn't exist.
%    \begin{macrocode}
\newcommand*{\glsxtrundeftag}{??}
\newcommand*{\@glsxtrundeftag}{}
%    \end{macrocode}
% This text is switched on at the start of the document to prevent
% unwanted text inserted into the preamble if any tests are made
% before the start of the document.
%\end{macro}
%
%\begin{macro}{\@glsxtr@warn@undefaction}
%This is how \cs{glsxtrundefaction} should behave if
%\pkgopt[warn]{undefaction} is set.
%\changes{1.08}{2016-12-13}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@warn@undefaction}[2]{%
  \@glsxtrundeftag\GlossariesExtraWarning{#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@err@undefaction}
%This is how \cs{glsxtrundefaction} should behave if
%\pkgopt[error]{undefaction} is set.
%\changes{1.08}{2016-12-13}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@err@undefaction}[2]{%
  \@glsxtrundeftag\PackageError{glossaries-extra}{#1}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@warn@onexistsordo}
%This is how \cs{glsxtr@warnonexistsordo} should behave if
%\pkgopt[warn]{undefaction} is set.
%\changes{1.08}{2016-12-13}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@warn@onexistsordo}[1]{%
  \GlossariesExtraWarning{\string#1\space hasn't been defined, so
  some errors won't be converted to warnings. 
  (This most likely means your version of
  glossaries.sty is below version 4.19.)}%
}
%    \end{macrocode}
%\end{macro}

%\begin{macro}{\@glsxtr@redef@forglsentries}
%\changes{1.11}{2017-01-19}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@redef@forglsentries}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@do@redef@forglsentries}
%\changes{1.11}{2017-01-19}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@do@redef@forglsentries}{%
  \renewcommand*{\forglsentries}[3][\glsdefaulttype]{%
    \edef\@@glo@list{\csname glolist@##1\endcsname}%
    \ifdefstring{\@@glo@list}{,}%
    {%
      \GlossariesExtraWarning{No entries defined in glossary `##1'}%
    }%
    {%
      \@for##2:=\@@glo@list\do
      {%
        \ifdefempty{##2}{}{##3}%
      }%
    }%
  }%
}%
%    \end{macrocode}
%\end{macro}
%
%    \begin{macrocode}
\define@choicekey{glossaries-extra.sty}{undefaction}%
 [\glsxtr@undefaction@val\glsxtr@undefaction@nr]%
 {warn,error}%
 {%
   \ifcase\glsxtr@undefaction@nr\relax
     \let\glsxtrundefaction\@glsxtr@warn@undefaction
     \let\glsxtr@warnonexistsordo\@glsxtr@warn@onexistsordo
     \let\@glsxtr@redef@forglsentries\@glsxtr@do@redef@forglsentries
   \or
     \let\glsxtrundefaction\@glsxtr@err@undefaction
     \let\glsxtr@warnonexistsordo\@gobble
     \let\@glsxtr@redef@forglsentries\relax
   \fi
 }
%    \end{macrocode}
%
%To assist bib2gls, v1.08 introduces the \pkgopt{record} option, which will write
%information to the aux file whenever an entry needs to be indexed.
%
%\begin{macro}{\@glsxtr@record}
%\changes{1.08}{2016-12-13}{new}
%\changes{1.14}{2017-04-18}{added third arg}
%Does nothing by default.
%    \begin{macrocode}
\newcommand*{\@glsxtr@record}[3]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@recordsee}
%\changes{1.14}{2017-04-18}{new}
%Does nothing by default.
%    \begin{macrocode}
\newcommand*{\glsxtr@recordsee}[2]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@defaultnumberformat}
%\changes{1.19}{2017-09-09}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@defaultnumberformat}{glsnumberformat}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrSetDefaultNumberFormat}
%\changes{1.19}{2017-09-09}{new}
%    \begin{macrocode}
\newcommand*{\GlsXtrSetDefaultNumberFormat}[1]{%
  \renewcommand*{\@glsxtr@defaultnumberformat}{#1}%
}%
%    \end{macrocode}
%\end{macro}
%
%The \pkgopt{record} option is somewhat problematic. On the first
%\LaTeX\ run the entries aren't defined. This isn't as
%straight-forward as commands like \cs{cite} since attributes
%associated with the entry's category may switch off the indexing
%or the entry's glossary type might require a particular counter.
%This kind of information can't be determined until the entry has
%been defined. So there are two different commands here. One that's
%used if the entry hasn't been defined, which tries to use sensible
%defaults, and one which is used when the entry has been defined.
%
%\begin{macro}{\@glsxtr@do@record@wrglossary}
%\changes{1.21}{2017-11-03}{new}
%The \pkgopt[only]{record} option sets \cs{@@do@wrglossary} to this
%command, which means it's done within \cs{glsadd} and
%\cs{@gls@link}, and so is only done if the entry exists.
%    \begin{macrocode}
\newcommand*{\@glsxtr@do@record@wrglossary}[1]{%
 \begingroup
   \ifKV@glslink@noindex
   \else
     \edef\@gls@label{\glsdetoklabel{#1}}%
     \let\glslabel\@gls@label
     \glswriteentry{#1}%
     {%
       \ifdefempty{\@glsxtr@thevalue}%
       {%
         \ifx\@glsxtr@org@theHvalue\@glsxtr@theHvalue
         \else
           \let\theHglsentrycounter\@glsxtr@theHvalue
         \fi
         \glsxtr@saveentrycounter
         \let\@@do@@wrglossary\@glsxtr@dorecord
       }%
       {%
         \let\theglsentrycounter\@glsxtr@thevalue
         \let\theHglsentrycounter\@glsxtr@theHvalue
         \let\@@do@@wrglossary\@glsxtr@dorecordnodefer
       }%
       \ifx\@glsxtr@record@setting\@glsxtr@record@setting@alsoindex
         \glsxtr@@do@wrglossary{#1}%
       \else
         \@@glsxtrwrglossmark
%    \end{macrocode}
%Increment associated counter.
%    \begin{macrocode}
         \glsxtr@inc@wrglossaryctr{#1}%
         \@@do@@wrglossary
       \fi
     }%
   \fi
 \endgroup
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@do@alsoindex@wrglossary}
%\changes{1.21}{2017-11-03}{new}
%The \pkgopt[alsoindex]{record} option needs to both record and
%index.
%    \begin{macrocode}
\newcommand*{\glsxtr@do@alsoindex@wrglossary}[1]{%
  \glsxtr@@do@wrglossary{#1}%
  \@glsxtr@do@record@wrglossary{#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@glsxtr@record}
%\changes{1.08}{2016-12-13}{new}
%The \pkgopt[only]{record} option sets \cs{@glsxtr@record} to this.
%This performs the recording if the entry doesn't exist and is done
%at the start of \cs{@gls@field@link} and commands like \cs{@gls@}
%(before the existence test). This means that it disregards the
%\gloskey[glslink]{wrgloss} key.
%
%The first argument is the option list (as passed in the first optional
%argument to commands like \cs{gls}). This allows the \gloskey[glslink]{noindex}
%setting to be picked up. The second argument is the entry's label.
% The third argument is the key family
%(\texttt{glslink} in most cases, \texttt{glossadd} for \cs{glsadd}).
%    \begin{macrocode}
\newcommand*{\@@glsxtr@record}[3]{%
 \ifglsentryexists{#2}{}%
 {%
   \@@glsxtrwrglossmark
   \begingroup
%    \end{macrocode}
%Save the label in case it's needed.
%    \begin{macrocode}
     \edef\@gls@label{\glsdetoklabel{#2}}%
     \let\glslabel\@gls@label
     \let\@glsnumberformat\@glsxtr@defaultnumberformat
     \def\@glsxtr@thevalue{}%
     \def\@glsxtr@theHvalue{\@glsxtr@thevalue}%
     \let\@glsxtr@org@theHvalue\@glsxtr@theHvalue
%    \end{macrocode}
%Entry hasn't been defined, so we'll have to assume it's
%\cs{glscounter} by default.
%    \begin{macrocode}
     \let\@gls@counter\glscounter
%    \end{macrocode}
%Check for default options (which may switch off indexing).
%\changes{1.21}{2017-11-03}{added check for default options}
%    \begin{macrocode}
     \@gls@setdefault@glslink@opts
%    \end{macrocode}
%Implement any pre-key settings.
%\changes{1.30}{2018-04-25}{added check for pre-key hook}
%    \begin{macrocode}
     \csuse{@glsxtr@#3@prekeys}%
%    \end{macrocode}
%Assign keys.
%    \begin{macrocode}
     \setkeys{#3}{#1}%
%    \end{macrocode}
%Implement any post-key settings.
%\changes{1.30}{2018-04-25}{added check for post-key hook}
%    \begin{macrocode}
     \csuse{@glsxtr@#3@postkeys}%
%    \end{macrocode}
%Increment associated counter.
%    \begin{macrocode}
   \glsxtr@inc@wrglossaryctr{#2}%
%    \end{macrocode}
%Check if \gloskey[glslink]{noindex} option has been used.
%    \begin{macrocode}
     \ifKV@glslink@noindex
     \else
       \glswriteentry{#2}%
       {%
%    \end{macrocode}
%Check if \gloskey[glsadd]{thevalue} has been set.
%    \begin{macrocode}
         \ifdefempty{\@glsxtr@thevalue}%
         {%
%    \end{macrocode}
%Key \gloskey[glsadd]{thevalue} hasn't been set, but check if
%\gloskey[glsadd]{theHvalue} has been set. (Not particularly likely,
%but allow for it.)
%    \begin{macrocode}
           \ifx\@glsxtr@org@theHvalue\@glsxtr@theHvalue
           \else
             \let\theHglsentrycounter\@glsxtr@theHvalue
           \fi
%    \end{macrocode}
%Save the entry counter.
%    \begin{macrocode}
           \glsxtr@saveentrycounter
%    \end{macrocode}
%Temporarily redefine \cs{@@do@@wrglossary} for use with
%\cs{glsxtr@@do@wrglossary}.
%    \begin{macrocode}
           \let\@@do@@wrglossary\@glsxtr@dorecord
         }%
         {%
%    \end{macrocode}
%\gloskey[glsadd]{thevalue} has been set, so there's no need to
%defer writing the location value. (If it's dependent on the page
%counter, the \gloskey[glslink]{counter} key should be set instead.)
%    \begin{macrocode}
           \let\theglsentrycounter\@glsxtr@thevalue
           \let\theHglsentrycounter\@glsxtr@theHvalue
           \let\@@do@@wrglossary\@glsxtr@dorecordnodefer
         }%
         \ifx\@glsxtr@record@setting\@glsxtr@record@setting@alsoindex
           \glsxtr@@do@wrglossary{#2}%
         \else
%    \end{macrocode}
%No need to escape special characters.
%    \begin{macrocode}
           \@@do@@wrglossary
         \fi
       }%
     \fi
   \endgroup
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@glslink@prekeys}
%\changes{1.30}{2018-04-25}{new}
%    \begin{macrocode}
\newcommand{\@glsxtr@glslink@prekeys}{\glslinkpresetkeys}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@glslink@postkeys}
%\changes{1.30}{2018-04-25}{new}
%    \begin{macrocode}
\newcommand{\@glsxtr@glslink@postkeys}{\glslinkpostsetkeys}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@glossadd@prekeys}
%\changes{1.30}{2018-04-25}{new}
%    \begin{macrocode}
\newcommand{\@glsxtr@glossadd@prekeys}{\glsaddpresetkeys}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@glossadd@postkeys}
%\changes{1.30}{2018-04-25}{new}
%    \begin{macrocode}
\newcommand{\@glsxtr@glossadd@postkeys}{\glsaddpostsetkeys}
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{\@glsxtr@dorecord}
%\changes{1.08}{2016-12-13}{new}
%\changes{1.15}{2017-05-10}{corrected premature expansion of \cs{@glslocref}}
%If \pkgopt[alsoindex]{record} is used, then \cs{@glslocref} may
%have been escaped, but this isn't appropriate here.
%\changes{1.19}{2017-09-09}{Use \cs{@glsrecordlocref} instead of \cs{@glslocref}}
%    \begin{macrocode}
\newcommand*\@glsxtr@dorecord{%
   \global\let\@glsrecordlocref\theglsentrycounter
   \let\@glsxtr@orgprefix\@glo@counterprefix
   \ifx\theglsentrycounter\theHglsentrycounter
     \def\@glo@counterprefix{}%
   \else
     \edef\@do@gls@getcounterprefix{\noexpand\@gls@getcounterprefix
       {\theglsentrycounter}{\theHglsentrycounter}%
     }%
     \@do@gls@getcounterprefix
   \fi
%    \end{macrocode}
%\changes{1.30}{2018-04-25}{don't suppress expansion of \cs{@glsrecordlocref}}
%\changes{1.29}{2018-04-09}{don't suppress expansion of
%\cs{@glsrecordlocref} if counter isn't page}
%Don't protect the \cs{@glsrecordlocref} from premature expansion.
%If the counter isn't \counter{page} then it needs expanding. If the
%location includes \cs{thepage} then \cs{protected@write} will
%automatically deal with it.
%    \begin{macrocode}
   \protected@write\@auxout{}{\string\glsxtr@record
      {\@gls@label}{\@glo@counterprefix}{\@gls@counter}{\@glsnumberformat}%
      {\@glsrecordlocref}}%
   \@glsxtr@counterrecordhook
   \let\@glo@counterprefix\@glsxtr@orgprefix
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@dorecordnodefer}
%\changes{1.16}{2017-06-15}{new}
%As above, but don't defer expansion of location. This uses
%\cs{theglsentrycounter} directly for the location
%rather than \cs{@glslocref} since there's no need to guard against
%premature expansion of the page counter.
%\changes{1.19}{2017-09-09}{Use \cs{theglsentrycounter} for the location
%rather than \cs{@glslocref}}
%    \begin{macrocode}
\newcommand*\@glsxtr@dorecordnodefer{%
   \ifx\theglsentrycounter\theHglsentrycounter
     \protected@write\@auxout{}{\string\glsxtr@record
        {\@gls@label}{}{\@gls@counter}{\@glsnumberformat}%
        {\theglsentrycounter}}%
   \else
    \edef\@do@gls@getcounterprefix{\noexpand\@gls@getcounterprefix
      {\theglsentrycounter}{\theHglsentrycounter}%
    }%
    \@do@gls@getcounterprefix
     \protected@write\@auxout{}{\string\glsxtr@record
        {\@gls@label}{\@glo@counterprefix}{\@gls@counter}{\@glsnumberformat}%
        {\theglsentrycounter}}%
   \fi
   \@glsxtr@counterrecordhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@glsxtr@recordcounter}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand*{\@@glsxtr@recordcounter}{%
  \@glsxtr@noop@recordcounter
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@noop@recordcounter}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@noop@recordcounter}[1]{%
  \PackageError{glossaries-extra}{\string\GlsXtrRecordCounter\space
   requires record=only or record=alsoindex package option}{}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@op@recordcounter}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@op@recordcounter}[1]{%
  \eappto\@glsxtr@counterrecordhook{\noexpand\@glsxtr@docounterrecord{#1}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@recordsee}
%\changes{1.14}{2017-04-18}{new}
%Deal with \cs{glssee} in record mode. (This doesn't increment the
%associated counter.)
%    \begin{macrocode}
\newcommand*{\@glsxtr@recordsee}[2]{%
 \@@glsxtrwrglossmark
 \def\@gls@xref{#2}%
 \@onelevel@sanitize\@gls@xref
 \protected@write\@auxout{}{\string\glsxtr@recordsee{#1}{\@gls@xref}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\printunsrtglossaryunit}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand{\printunsrtglossaryunit}{%
  \print@noop@unsrtglossaryunit
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@setup@record}
%\changes{1.08}{2016-12-13}{new}
%Initialise.
%    \begin{macrocode}
\newcommand*{\glsxtr@setup@record}{\let\@@do@wrglossary\glsxtr@@do@wrglossary}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@indexonly@saveentrycounter}
%\changes{1.08}{2016-12-13}{new}
% Only store the entry counter information if the
%indexing is on.
%    \begin{macrocode}
\newcommand*{\glsxtr@indexonly@saveentrycounter}{%
 \ifKV@glslink@noindex
 \else
   \glsxtr@saveentrycounter
 \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@addloclistfield}
%\changes{1.08}{2016-12-13}{new}
%    \begin{macrocode}
\newcommand*{\glsxtr@addloclistfield}{%
 \key@ifundefined{glossentry}{loclist}%
 {%
   \define@key{glossentry}{loclist}{\def\@glo@loclist{##1}}%
   \appto\@gls@keymap{,{loclist}{loclist}}%
   \appto\@newglossaryentryprehook{\def\@glo@loclist{}}%
   \appto\@newglossaryentryposthook{%
     \gls@assign@field{}{\@glo@label}{loclist}{\@glo@loclist}%
   }%
   \glssetnoexpandfield{loclist}%
 }%
 {}%
%    \end{macrocode}
%\changes{1.11}{2017-01-19}{added location key}
%The loclist field is just a comma-separated list. The location
%field is the formatted list.
%    \begin{macrocode}
 \key@ifundefined{glossentry}{location}%
 {%
   \define@key{glossentry}{location}{\def\@glo@location{##1}}%
   \appto\@gls@keymap{,{location}{location}}%
   \appto\@newglossaryentryprehook{\def\@glo@location{}}%
   \appto\@newglossaryentryposthook{%
     \gls@assign@field{}{\@glo@label}{location}{\@glo@location}%
   }%
   \glssetnoexpandfield{location}%
 }%
 {}%
%    \end{macrocode}
%\changes{1.11}{2017-01-19}{added group key}
%Add a key to store the group heading.
%    \begin{macrocode}
 \key@ifundefined{glossentry}{group}%
 {%
   \define@key{glossentry}{group}{\def\@glo@group{##1}}%
   \appto\@gls@keymap{,{group}{group}}%
   \appto\@newglossaryentryprehook{\def\@glo@group{}}%
   \appto\@newglossaryentryposthook{%
     \gls@assign@field{}{\@glo@label}{group}{\@glo@group}%
   }%
   \glssetnoexpandfield{group}%
 }%
 {}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@record@setting}
%\changes{1.19}{2017-09-09}{new}
%Keep track of the \pkgopt{record} package option.
%    \begin{macrocode}
\newcommand*{\@glsxtr@record@setting}{off}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@record@setting@alsoindex}
%\changes{1.19}{2017-09-09}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@record@setting@alsoindex}{alsoindex}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@record@setting@only}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@record@setting@only}{only}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@record@setting@off}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@record@setting@off}{off}
%    \end{macrocode}
%\end{macro}
%
%Now define the \pkgopt{record} package option.
%\changes{1.08}{2016-12-13}{added \pkgopt{record} package option}
%    \begin{macrocode}
\define@choicekey{glossaries-extra.sty}{record}
 [\@glsxtr@record@setting\glsxtr@record@nr]%
 {off,only,alsoindex}%
 [only]%
 {%
   \ifcase\glsxtr@record@nr\relax
%    \end{macrocode}
%Don't record.
%    \begin{macrocode}
     \def\glsxtr@setup@record{%
       \renewcommand*{\@do@seeglossary}{\@glsxtr@doseeglossary}%
       \renewcommand*{\@glsxtr@record}[3]{}%
       \let\@@do@wrglossary\glsxtr@@do@wrglossary
       \let\@gls@saveentrycounter\glsxtr@indexonly@saveentrycounter
       \let\glsxtrundefaction\@glsxtr@err@undefaction
       \let\glsxtr@warnonexistsordo\@gobble
       \let\@@glsxtr@recordcounter\@glsxtr@noop@recordcounter
       \def\printunsrtglossaryunit{\print@noop@unsrtglossaryunit}%
       \undef\glsxtrsetaliasnoindex
     }%
   \or
%    \end{macrocode}
%Only record (don't index).
%    \begin{macrocode}
     \def\glsxtr@setup@record{%
       \@glsxtr@autoseeindexfalse
       \let\@do@seeglossary\@glsxtr@recordsee
       \let\@glsxtr@record\@@glsxtr@record
       \let\@@do@wrglossary\@glsxtr@do@record@wrglossary
       \let\@gls@saveentrycounter\relax
       \let\glsxtrundefaction\@glsxtr@warn@undefaction
       \let\glsxtr@warnonexistsordo\@glsxtr@warn@onexistsordo
       \glsxtr@addloclistfield
       \renewcommand*{\@glsxtr@autoindexcrossrefs}{}%
       \let\@@glsxtr@recordcounter\@glsxtr@op@recordcounter
       \def\printunsrtglossaryunit{\print@op@unsrtglossaryunit}%
%    \end{macrocode}
%Switch off the index suppression for aliased entries.
%(bib2gls will deal with them.)
%    \begin{macrocode}
       \def\glsxtrsetaliasnoindex{}%
%    \end{macrocode}
% \cs{@gls@setupsort@none} was only introduced to
% \sty{glossaries} v4.30, so it may not be available. If it's
% defined, use it to remove the unnecessary overhead of escaping and
% sanitizing the sort value.
%\changes{1.16}{2017-06-15}{added check for \cs{@gls@setupsort@none}}
%    \begin{macrocode}
       \ifdef\@gls@setupsort@none{\@gls@setupsort@none}{}%
%    \end{macrocode}
% Warn about using \cs{printglossary}:
%    \begin{macrocode}
       \def\glsxtrNoGlossaryWarning{\@glsxtr@record@noglossarywarning}%
%    \end{macrocode}
%Load \sty{glossaries-extra-bib2gls}:
%    \begin{macrocode}
       \RequirePackage{glossaries-extra-bib2gls}%
     }%
   \or
%    \end{macrocode}
%Record and index. This option doesn't load
%\sty{glossaries-extra-bib2gls} as the sorting is performed by
%\app{xindy} or \app{makeindex}.
%    \begin{macrocode}
     \def\glsxtr@setup@record{%
       \renewcommand*{\@do@seeglossary}{\@glsxtr@dosee@alsoindex@glossary}%
       \let\@glsxtr@record\@@glsxtr@record
       \let\@@do@wrglossary\glsxtr@do@alsoindex@wrglossary
       \let\@gls@saveentrycounter\glsxtr@indexonly@saveentrycounter
       \let\glsxtrundefaction\@glsxtr@warn@undefaction
       \let\glsxtr@warnonexistsordo\@glsxtr@warn@onexistsordo
       \glsxtr@addloclistfield
       \let\@@glsxtr@recordcounter\@glsxtr@op@recordcounter
       \def\printunsrtglossaryunit{\print@op@unsrtglossaryunit}%
       \undef\glsxtrsetaliasnoindex
     }%
   \fi
 }
%    \end{macrocode}
%
%\changes{1.06}{2016-06-18}{docdef option changed to choice}
%Version 1.06 changes the \pkgopt{docdef} option to a choice rather
%than boolean setting. The available values are: false, true or
%restricted. The restricted option permits document definitions as
%long as they occur before the first glossary is displayed.
%
%\begin{macro}{\@glsxtr@docdefval}
%\changes{1.06}{2016-06-18}{new}
%The \pkgopt{docdef} value is stored as an integer: 0 (false), 1
%(true) and 2 (restricted).
%\changes{1.28}{2018-03-06}{changed from count register to macro}
%    \begin{macrocode}
\newcommand*{\@glsxtr@docdefval}{0}
%    \end{macrocode}
%\end{macro}
%
%Need to provide conditional commands that are backward compatible:
%\begin{macro}{\if@glsxtrdocdef}
%    \begin{macrocode}
\newcommand*{\if@glsxtrdocdef}{\ifnum\@glsxtr@docdefval>0 }
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glsxtrdocdeftrue}
%    \begin{macrocode}
\newcommand*{\@glsxtrdocdeftrue}{\def\@glsxtr@docdefval{1}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glsxtrdocdeffalse}
%    \begin{macrocode}
\newcommand*{\@glsxtrdocdeffalse}{\def\@glsxtr@docdefval{0}}
%    \end{macrocode}
%\end{macro}
%
%
% By default don't allow entries to be defined in the document to
% encourage the user to define them in the preamble, but if the user
% is really determined to define them in the document allow them to
% request this.
%    \begin{macrocode}
\define@choicekey{glossaries-extra.sty}{docdef}
 [\@glsxtr@docdefsetting\@glsxtr@docdefval]%
 {false,true,restricted}[true]%
{%
  \ifnum\@glsxtr@docdefval=2\relax
    \renewcommand*{\@glsdoifexistsorwarn}{\glsdoifexists}%
  \fi
}
%    \end{macrocode}
%\begin{macro}{\if@glsxtrdocdefrestricted}
%\changes{1.06}{2016-06-18}{new}
%    \begin{macrocode}
\newcommand*{\if@glsxtrdocdefrestricted}{\ifnum\@glsxtr@docdefval=2 }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsdoifexistsorwarn}
%\changes{1.06}{2016-06-18}{new}
%Need an error to notify user if an undefined entry is being referenced in the
%glossary for the \pkgopt[restricted]{docdef} option. This is used
%by \cs{glossentryname} (but not by \cs{glossentrydesc} etc as one error
%per entry is sufficient).
%    \begin{macrocode}
\newcommand*{\@glsdoifexistsorwarn}{\glsdoifexistsorwarn}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{indexcrossrefs}
% Automatically index cross references at the end of the document
%    \begin{macrocode}
\define@boolkey{glossaries-extra.sty}[@glsxtr]{indexcrossrefs}[true]{%
 \if@glsxtrindexcrossrefs
 \else
  \renewcommand*{\@glsxtr@autoindexcrossrefs}{}%
 \fi
}
%    \end{macrocode}
%\end{option}
% Switch off since this can increase the build time.
%    \begin{macrocode}
\@glsxtrindexcrossrefsfalse
%    \end{macrocode}
% But allow \gloskey{see} key to switch it on automatically.
%\begin{macro}{\@glsxtr@autoindexcrossrefs}
%\changes{1.0}{2016-01-24}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@autoindexcrossrefs}{\@glsxtrindexcrossrefstrue}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{autoseeindex}
%Provide a boolean option to allow the user to prevent the
%automatic indexing of the cross-referencing keys \gloskey{see},
%\gloskey{seealso} and \gloskey{alias}.
%\changes{1.16}{2017-06-15}{new}
%    \begin{macrocode}
\define@boolkey{glossaries-extra.sty}[@glsxtr@]{autoseeindex}[true]{%
}
\@glsxtr@autoseeindextrue
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\GlossariesExtraWarning}
%Allow users to suppress warnings.
%    \begin{macrocode}
\newcommand*{\GlossariesExtraWarning}[1]{\PackageWarning{glossaries-extra}{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlossariesExtraWarningNoLine}
%Allow users to suppress warnings.
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newcommand*{\GlossariesExtraWarningNoLine}[1]{%
 \PackageWarningNoLine{glossaries-extra}{#1}}
%    \end{macrocode}
%\end{macro}
%
%    \begin{macrocode}
\@glsxtr@declareoption{nowarn}{%
  \let\GlossariesExtraWarning\@gobble
  \let\GlossariesExtraWarningNoLine\@gobble
  \glsxtr@dooption{nowarn}%
}
%    \end{macrocode}
%
%\begin{macro}{\@glsxtr@defpostpunc}
%Redefines \cs{glspostdescription}. The \pkgopt{postdot} and
%\pkgopt{nopostdot} options will have to redefine this.
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@defpostpunc}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{postdot}
%Shortcut for \pkgopt[false]{nopostdot}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\@glsxtr@declareoption{postdot}{%
  \glsxtr@dooption{nopostdot=false}%
  \renewcommand*{\@glsxtr@defpostpunc}{%
    \renewcommand*{\glspostdescription}{%
      \ifglsnopostdot\else.\spacefactor\sfcode`\. \fi}%
  }%
}
%    \end{macrocode}
%\end{option}

%\begin{option}{nopostdot}
%Needs to redefine \cs{@glsxtr@defpostpunc}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\define@choicekey{glossaries-extra.sty}{nopostdot}{true,false}[true]{%
  \glsxtr@dooption{nopostdot=#1}%
  \renewcommand*{\@glsxtr@defpostpunc}{%
    \renewcommand*{\glspostdescription}{%
      \ifglsnopostdot\else.\spacefactor\sfcode`\. \fi}%
  }%
}
%    \end{macrocode}
%\end{option}
%
%\begin{option}{postpunc}
%Set the post-description punctuation. This also sets
%the \cs{ifglsnopostdot} conditional, which now indicates if
%the post-description punctuation has been suppressed.
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\define@key{glossaries-extra.sty}{postpunc}{%
  \glsxtr@dooption{nopostdot=false}%
  \ifstrequal{#1}{dot}%
  {%
    \renewcommand*{\@glsxtr@defpostpunc}{%
      \renewcommand*{\glspostdescription}{.\spacefactor\sfcode`\. }%
    }%
  }%
  {%
    \ifstrequal{#1}{comma}%
    {%
      \renewcommand*{\@glsxtr@defpostpunc}{%
        \renewcommand*{\glspostdescription}{,}%
      }%
    }%
    {%
      \ifstrequal{#1}{none}%
      {%
        \glsxtr@dooption{nopostdot=true}%
        \renewcommand*{\@glsxtr@defpostpunc}{%
          \renewcommand*{\glspostdescription}{}%
        }%
      }%
      {%
        \renewcommand*{\@glsxtr@defpostpunc}{%
          \renewcommand*{\glspostdescription}{#1}%
        }%
      }%
    }%
  }%
}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\glsxtrabbrvtype}
% Glossary type for abbreviations.
%    \begin{macrocode}
\newcommand*{\glsxtrabbrvtype}{\glsdefaulttype}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@abbreviationsdef}
% Set by \pkgopt{abbreviations} option.
%    \begin{macrocode}
\newcommand*{\@glsxtr@abbreviationsdef}{}
%    \end{macrocode}
%\end{macro}

%\begin{macro}{\@glsxtr@doabbreviationsdef}
%\changes{0.5.3}{2015-12-09}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@doabbreviationsdef}{%
  \@ifpackageloaded{babel}%
  {\providecommand{\abbreviationsname}{\acronymname}}%
  {\providecommand{\abbreviationsname}{Abbreviations}}%
  \newglossary[glg-abr]{abbreviations}{gls-abr}{glo-abr}{\abbreviationsname}%
  \renewcommand*{\glsxtrabbrvtype}{abbreviations}%
  \newcommand*{\printabbreviations}[1][]{%
    \printglossary[type=\glsxtrabbrvtype,##1]%
  }%
  \disable@keys{glossaries-extra.sty}{abbreviations}%
%    \end{macrocode}
% If the \pkgopt{acronym} option hasn't been used, change
% \ics{acronymtype} to \ics{glsxtrabbrvtype}.
%\changes{0.4}{2015-12-03}{added redefinition of \cs{acronymtype}}
%    \begin{macrocode}
  \ifglsacronym
  \else
    \renewcommand*{\acronymtype}{\glsxtrabbrvtype}%
  \fi
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{abbreviations}
% If \pkgopt{abbreviations}, create a new glossary type for abbreviations.
%    \begin{macrocode}
\@glsxtr@declareoption{abbreviations}{%
  \let\@glsxtr@abbreviationsdef\@glsxtr@doabbreviationsdef
}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\GlsXtrDefineAbbreviationShortcuts}
% Enable shortcut commands for the abbreviations. Unlike the analogous
% command provided by \styfmt{glossaries}, this uses \cs{newcommand}
% instead of \cs{let} as a safety feature (except for \cs{newabbr}
% which is also provided with \cs{GlsXtrDefineAcShortcuts}).
%    \begin{macrocode}
\newcommand*{\GlsXtrDefineAbbreviationShortcuts}{%
  \newcommand*{\ab}{\cgls}%
  \newcommand*{\abp}{\cglspl}%
  \newcommand*{\as}{\glsxtrshort}%
  \newcommand*{\asp}{\glsxtrshortpl}%
  \newcommand*{\al}{\glsxtrlong}%
  \newcommand*{\alp}{\glsxtrlongpl}%
  \newcommand*{\af}{\glsxtrfull}%
  \newcommand*{\afp}{\glsxtrfullpl}%
  \newcommand*{\Ab}{\cGls}%
  \newcommand*{\Abp}{\cGlspl}%
  \newcommand*{\As}{\Glsxtrshort}%
  \newcommand*{\Asp}{\Glsxtrshortpl}%
  \newcommand*{\Al}{\Glsxtrlong}%
  \newcommand*{\Alp}{\Glsxtrlongpl}%
  \newcommand*{\Af}{\Glsxtrfull}%
  \newcommand*{\Afp}{\Glsxtrfullpl}%
  \newcommand*{\AB}{\cGLS}%
  \newcommand*{\ABP}{\cGLSpl}%
  \newcommand*{\AS}{\GLSxtrshort}%
  \newcommand*{\ASP}{\GLSxtrshortpl}%
  \newcommand*{\AL}{\GLSxtrlong}%
  \newcommand*{\ALP}{\GLSxtrlongpl}%
  \newcommand*{\AF}{\GLSxtrfull}%
  \newcommand*{\AFP}{\GLSxtrfullpl}%
%    \end{macrocode}
%\changes{1.23}{2017-11-12}{changed \cs{newabbr} definition to use \cs{providecommand}}
%    \begin{macrocode}
  \providecommand*{\newabbr}{\newabbreviation}%
%    \end{macrocode}
% Disable this command after it's been used.
%    \begin{macrocode}
  \let\GlsXtrDefineAbbreviationShortcuts\relax
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrDefineAcShortcuts}
% Enable shortcut commands for the abbreviations, but uses the
% analogous commands provided by \styfmt{glossaries}.
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\GlsXtrDefineAcShortcuts}{%
  \newcommand*{\ac}{\cgls}%
  \newcommand*{\acp}{\cglspl}%
  \newcommand*{\acs}{\glsxtrshort}%
  \newcommand*{\acsp}{\glsxtrshortpl}%
  \newcommand*{\acl}{\glsxtrlong}%
  \newcommand*{\aclp}{\glsxtrlongpl}%
  \newcommand*{\acf}{\glsxtrfull}%
  \newcommand*{\acfp}{\glsxtrfullpl}%
  \newcommand*{\Ac}{\cGls}%
  \newcommand*{\Acp}{\cGlspl}%
  \newcommand*{\Acs}{\Glsxtrshort}%
  \newcommand*{\Acsp}{\Glsxtrshortpl}%
  \newcommand*{\Acl}{\Glsxtrlong}%
  \newcommand*{\Aclp}{\Glsxtrlongpl}%
  \newcommand*{\Acf}{\Glsxtrfull}%
  \newcommand*{\Acfp}{\Glsxtrfullpl}%
  \newcommand*{\AC}{\cGLS}%
  \newcommand*{\ACP}{\cGLSpl}%
  \newcommand*{\ACS}{\GLSxtrshort}%
  \newcommand*{\ACSP}{\GLSxtrshortpl}%
  \newcommand*{\ACL}{\GLSxtrlong}%
  \newcommand*{\ACLP}{\GLSxtrlongpl}%
  \newcommand*{\ACF}{\GLSxtrfull}%
  \newcommand*{\ACFP}{\GLSxtrfullpl}%
%    \end{macrocode}
%\changes{1.23}{2017-11-12}{changed \cs{newabbr} definition to use \cs{providecommand}}
%    \begin{macrocode}
  \providecommand*{\newabbr}{\newabbreviation}%
%    \end{macrocode}
% Disable this command after it's been used.
%    \begin{macrocode}
  \let\GlsXtrDefineAcShortcuts\relax
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrDefineOtherShortcuts}
% Similarly provide shortcut versions for the commands provided by
% the \pkgopt{symbols} and \pkgopt{numbers} options.
%    \begin{macrocode}
\newcommand*{\GlsXtrDefineOtherShortcuts}{%
  \newcommand*{\newentry}{\newglossaryentry}%
  \ifdef\printsymbols
  {%
    \newcommand*{\newsym}{\glsxtrnewsymbol}%
  }{}%
  \ifdef\printnumbers
  {%
    \newcommand*{\newnum}{\glsxtrnewnumber}%
  }{}%
  \let\GlsXtrDefineOtherShortcuts\relax
}
%    \end{macrocode}
%\end{macro}
%
% Always use the long forms, not the shortcuts, where portability is
% an issue. (For example, when defining entries in a file that may
% be input by multiple documents.)
%
%\begin{macro}{\@glsxtr@setupshortcuts}
% Command used to set the shortcuts option.
%    \begin{macrocode}
\newcommand*{\@glsxtr@setupshortcuts}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@shortcutsval}
% Store the value of the shortcuts option. (Needed by bib2gls.)
%\changes{1.11}{2017-01-19}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@shortcutsval}{\ifglsacrshortcuts acro\else none\fi}%
%    \end{macrocode}
%\end{macro}
%
%Provide \pkgopt{shortcuts} option. Unlike the \styfmt{glossaries}
%version, this is a choice rather than a boolean key but it also provides
%\pkgopt[true]{shortcuts} and \pkgopt[false]{shortcuts}, which are
%equivalent to \pkgopt[all]{shortcuts} and
%\pkgopt[none]{shortcuts}. Multiple use of this option in the
%\emph{same} option list will override each other.
%New to v1.17: \pkgopt[ac]{shortcuts} which implements
%\cs{GlsXtrDefineAcShortcuts} (not included in
%\pkgopt[all]{shortcuts} as it conflicts with other shortcuts).
%    \begin{macrocode}
\define@choicekey{glossaries-extra.sty}{shortcuts}%
 [\@glsxtr@shortcutsval\@glsxtr@shortcutsnr]%
 {acronyms,acro,abbreviations,abbr,other,all,true,ac,none,false}[true]{%
   \ifcase\@glsxtr@shortcutsnr\relax % acronyms
     \renewcommand*{\@glsxtr@setupshortcuts}{%
       \glsacrshortcutstrue
       \DefineAcronymSynonyms
     }%
   \or % acro
     \renewcommand*{\@glsxtr@setupshortcuts}{%
       \glsacrshortcutstrue
       \DefineAcronymSynonyms
     }%
   \or % abbreviations
     \renewcommand*{\@glsxtr@setupshortcuts}{%
       \GlsXtrDefineAbbreviationShortcuts
     }%
   \or % abbr
     \renewcommand*{\@glsxtr@setupshortcuts}{%
       \GlsXtrDefineAbbreviationShortcuts
     }%
   \or % other
     \renewcommand*{\@glsxtr@setupshortcuts}{%
       \GlsXtrDefineOtherShortcuts
     }%
   \or % all
     \renewcommand*{\@glsxtr@setupshortcuts}{%
       \glsacrshortcutstrue
%    \end{macrocode}
%\changes{1.21}{2017-11-03}{changed true setting to use shortcuts=ac
%instead of shortcuts=acronym}
%    \begin{macrocode}
       \GlsXtrDefineAcShortcuts
       \GlsXtrDefineAbbreviationShortcuts
       \GlsXtrDefineOtherShortcuts
     }%
   \or % true
     \renewcommand*{\@glsxtr@setupshortcuts}{%
       \glsacrshortcutstrue
%    \end{macrocode}
%\changes{1.21}{2017-11-03}{changed true setting to use shortcuts=ac
%instead of shortcuts=acronym}
%    \begin{macrocode}
       \GlsXtrDefineAcShortcuts
       \GlsXtrDefineAbbreviationShortcuts
       \GlsXtrDefineOtherShortcuts
     }%
%    \end{macrocode}
%\changes{1.21}{2017-11-03}{corrected shortcuts=ac}
%    \begin{macrocode}
   \or % ac
     \renewcommand*{\@glsxtr@setupshortcuts}{%
       \glsacrshortcutstrue
       \GlsXtrDefineAcShortcuts
     }%
%    \end{macrocode}
%Leave none and false as last option.
%    \begin{macrocode}
   \else % none, false
     \renewcommand*{\@glsxtr@setupshortcuts}{}%
   \fi
 }
%    \end{macrocode}
%
%\begin{macro}{\@glsxtr@doaccsupp}
%\changes{0.5.1}{2015-12-07}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@doaccsupp}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{accsupp}
% If \pkgopt{accsupp}, load \sty{glossaries-accsupp} package.
%    \begin{macrocode}
\@glsxtr@declareoption{accsupp}{%
 \renewcommand*{\@glsxtr@doaccsupp}{\RequirePackage{glossaries-accsupp}}}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\glsxtrNoGlossaryWarning}
%\changes{0.3}{2015-12-02}{new}
% Warning text displayed in document if the external glossary file
% given by the argument is missing.
%    \begin{macrocode}
\newcommand{\glsxtrNoGlossaryWarning}[1]{%
  \@glsxtr@defaultnoglossarywarning{#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{nomissingglstext}
% If true, suppress the text produced if the external glossary file
% is missing.
%    \begin{macrocode}
\define@choicekey{glossaries-extra.sty}{nomissingglstext}
 [\@glsxtr@nomissingglstextval\@glsxtr@nomissingglstextnr]%
 {true,false}[true]{%
   \ifcase\@glsxtr@nomissingglstextnr\relax % true
     \renewcommand{\glsxtrNoGlossaryWarning}[1]{\null}%
   \else % false
     \renewcommand{\glsxtrNoGlossaryWarning}[1]{%
       \@glsxtr@defaultnoglossarywarning{#1}%
     }%
   \fi
 }
%    \end{macrocode}
%\end{option}
%
% Provide option to load \sty{glossaries-extra-stylemods}
% (Deferred to the end.)
%\begin{macro}{\@glsxtr@redefstyles}
%    \begin{macrocode}
\newcommand*{\@glsxtr@redefstyles}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{stylemods}
%\changes{1.02}{2016-04-25}{new}
%\changes{1.18}{2017-08-10}{changed default value to \qt{default}}
%    \begin{macrocode}
\define@key{glossaries-extra.sty}{stylemods}[default]{%
  \ifstrequal{#1}{default}%
  {%
    \renewcommand*{\@glsxtr@redefstyles}{%
      \RequirePackage{glossaries-extra-stylemods}}%
  }%
  {%
    \ifstrequal{#1}{all}%
    {%
      \renewcommand*{\@glsxtr@redefstyles}{%
        \PassOptionsToPackage{all}{glossaries-extra-stylemods}%
        \RequirePackage{glossaries-extra-stylemods}%
      }%
    }%
    {%
      \renewcommand*{\@glsxtr@redefstyles}{}%
      \@for\@glsxtr@tmp:=#1\do{%
        \IfFileExists{glossary-\@glsxtr@tmp.sty}%
        {%
          \eappto\@glsxtr@redefstyles{%
            \noexpand\RequirePackage{glossary-\@glsxtr@tmp}}%
        }%
        {%
           \PackageError{glossaries-extra}%
             {Glossaries style package `glossary-\@glsxtr@tmp.sty' 
              doesn't exist (did you mean to use the `style' key?)}%
             {The list of values (#1) in the `stylemods' key should
              match the glossary-xxx.sty files provided with
              glossaries.sty}%
        }%
      }%
      \appto\@glsxtr@redefstyles{\RequirePackage{glossaries-extra-stylemods}}%
   }
  }%
}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@glsxtr@do@style}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@do@style}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{style}
%\changes{1.04}{2016-05-02}{new}
% Since the \pkgopt{stylemods} option can automatically load extra
% style packages, deal with the \pkgopt{style} option after those
% packages have been loaded.
%    \begin{macrocode}
\define@key{glossaries-extra.sty}{style}{%
%    \end{macrocode}
%Defer actual style change:
%    \begin{macrocode}
 \renewcommand*{\@glsxtr@do@style}{%
%    \end{macrocode}
% Set this as the default style:
%    \begin{macrocode}
   \setkeys{glossaries.sty}{style={#1}}%
%    \end{macrocode}
% Set this style:
%    \begin{macrocode}
   \setglossarystyle{#1}%
 }%
}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\glsxtr@inc@wrglossaryctr}
%\changes{1.29}{2018-04-09}{new}
%Increments the associated counter if enabled. Does nothing by
%default. The optional argument is the entry label in case it's
%required, but the \ctr{wrglossary} counter is globally used by all
%entries.
%    \begin{macrocode}
\newcommand*{\glsxtr@inc@wrglossaryctr}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrInternalLocationHyperlink}
%\changes{1.29}{2018-04-09}{new}
%\begin{definition}
%\cs{glsxtrinternallocationhyperlink}\marg{counter}\marg{prefix}\marg{location}
%\end{definition}
%The first two arguments are always control sequences.
%    \begin{macrocode}
\newcommand*{\GlsXtrInternalLocationHyperlink}[3]{%
  \glsxtrhyperlink{#1#2#3}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@wrglossary@locationhyperlink}
%\changes{1.29}{2018-04-09}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@wrglossary@locationhyperlink}[3]{%
  \pageref{wrglossary.#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{indexcounter}
%\changes{1.29}{2018-04-09}{new}
%Define the \ctr{wrglossary} counter that's incremented every time
%an entry is indexed, except for cross-references. This is designed
%for use with \app{bib2gls} v1.4+. It can work with the other indexing
%methods but it will interfere with the number list collation.
%This option automatically implements \pkgopt[wrglossary]{counter}.
%
%Since \styfmt{glossaries} automatically loads \sty{amsmath}, there
%may be a problem if the indexing occurs in the \env{equation}
%environment, because only one \cs{label} is allowed in each
%instance of that environment. It's best to change the counter when
%in maths mode.
%    \begin{macrocode}
\@glsxtr@declareoption{indexcounter}{%
  \glsxtr@dooption{counter=wrglossary}%
  \ifundef\c@wrglossary
  {%
    \newcounter{wrglossary}%
    \renewcommand{\thewrglossary}{\arabic{wrglossary}}%
  }%
  {}%
  \renewcommand*{\glsxtr@inc@wrglossaryctr}[1]{%
%    \end{macrocode}
%Only increment if the current counter is \ctr{wrglossary}.
%\changes{1.30}{2018-04-25}{added check for \ctrfmt{wrglossary} counter}
%    \begin{macrocode}
    \ifdefstring\@gls@counter{wrglossary}%
    {%
      \refstepcounter{wrglossary}%
      \label{wrglossary.\thewrglossary}%
    }%
    {}%
  }%
  \renewcommand*{\GlsXtrInternalLocationHyperlink}[3]{%
    \ifdefstring\glsentrycounter{wrglossary}%
    {%
      \@glsxtr@wrglossary@locationhyperlink{##1}{##2}{##3}%
    }%
    {\glsxtrhyperlink{##1##2##3}{##3}}%
  }%
}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@glsxtrwrglossmark}
%\changes{1.21}{2017-11-03}{new}
%Marks the place where indexing occurs.
%Does nothing by default.
%    \begin{macrocode}
\newcommand*{\@glsxtrwrglossmark}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@glsxtrwrglossmark}
%\changes{1.21}{2017-11-03}{new}
%Since \cs{glsadd} can be used in the preamble, this action needs to
%be disabled until the start of the document.
%    \begin{macrocode}
\newcommand*{\@@glsxtrwrglossmark}{}
\AtBeginDocument{\renewcommand*{\@@glsxtrwrglossmark}{\@glsxtrwrglossmark}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrwrglossmark}
%\changes{1.21}{2017-11-03}{new}
%Does nothing by default.
%    \begin{macrocode}
\newcommand*{\glsxtrwrglossmark}{\ensuremath{\cdot}}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{debug}
%\changes{1.21}{2017-11-03}{new}
% Provide extra debug options.
%    \begin{macrocode}
\define@choicekey{glossaries-extra.sty}{debug}
 [\@glsxtr@debugval\@glsxtr@debugnr]%
 {true,false,showtargets,showwrgloss,all}[true]{%
   \ifcase\@glsxtr@debugnr\relax % true
    \glsxtr@dooption{debug=true}%
    \renewcommand*{\@glsxtrwrglossmark}{}%
   \or % false
    \glsxtr@dooption{debug=false}%
    \renewcommand*{\@glsxtrwrglossmark}{}%
   \or % showtargets
    \glsxtr@dooption{debug=showtargets}%
   \or % showwrgloss
    \glsxtr@dooption{debug=true}%
    \renewcommand*{\@glsxtrwrglossmark}{\glsxtrwrglossmark}%
   \or % all
    \glsxtr@dooption{debug=showtargets}%
    \renewcommand*{\@glsxtrwrglossmark}{\glsxtrwrglossmark}%
   \fi
 }
%    \end{macrocode}
%\end{option}
%
% Pass all other options to \styfmt{glossaries}.
%    \begin{macrocode}
\DeclareOptionX*{%
 \expandafter\glsxtr@dooption\expandafter{\CurrentOption}}
%    \end{macrocode}
% Process options.
%    \begin{macrocode}
\ProcessOptionsX
%    \end{macrocode}
% Load \styfmt{glossaries} if not already loaded.
%    \begin{macrocode}
\RequirePackage{glossaries}
%    \end{macrocode}
% Load the \sty{glossaries-accsupp} package if required.
%    \begin{macrocode}
\@glsxtr@doaccsupp
%    \end{macrocode}
% Redefine \cs{glspostdescription} if required.
%    \begin{macrocode}
\@glsxtr@defpostpunc
%    \end{macrocode}
%
%\begin{macro}{\glsshowtarget}
%This command was introduced to \sty{glossaries} v4.32 so it may not
%be defined. Therefore it's defined here using \cs{def}.
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\def\glsshowtarget#1{%
 \glsxtrtitleorpdforheading
 {%
   \ifmmode
     \texttt{\small [#1]}%
   \else
     \ifinner
       \texttt{\small [#1]}%
     \else
       \marginpar{\texttt{\small #1}}%
     \fi
   \fi
 }%
 {[#1]}%
 {\texttt{\small [#1]}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@org@doseeglossary}
%Save original definition of \cs{@do@seeglossary}
%    \begin{macrocode}
\let\@glsxtr@org@doseeglossary\@do@seeglossary
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@doseeglossary}
%\changes{1.21}{2017-11-03}{new}
%This doesn't increment the associated counter.
%    \begin{macrocode}
\newcommand*{\@glsxtr@doseeglossary}[2]{%
  \glsdoifexists{#1}%
  {%
    \@@glsxtrwrglossmark
    \@glsxtr@org@doseeglossary{#1}{#2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@dosee@alsoindex@glossary}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@dosee@alsoindex@glossary}[2]{%
  \@glsxtr@recordsee{#1}{#2}%
  \@glsxtr@doseeglossary{#1}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@org@gloautosee}
%\changes{1.14}{2017-04-18}{new}
%Save and restore original definition of \cs{@glo@autosee}.
%(That command may not be defined as it was only introduced
%to \sty{glossaries} v4.30, in which case the synonym
%won't be defined either.)
%    \begin{macrocode}
\let\@glsxtr@org@gloautosee\@glo@autosee
%    \end{macrocode}
%\end{macro}
%Check if user tried \pkgopt[false]{autoseeindex} when it can't be
%supported.
%    \begin{macrocode}
\if@glsxtr@autoseeindex
\else
  \ifdef\@glsxtr@org@gloautosee
  {}%
  {\PackageError{glossaries-extra}{`autoseeindex=false' package
   option requires at least v4.30 of glossaries.sty}%
   {You need to update the glossaries.sty package}%
  }
\fi
%    \end{macrocode}
%
%\begin{macro}{\@glo@autosee}
%\changes{1.16}{2017-06-15}{added redefinition}
%If \cs{@glo@autosee} has been defined (\sty{glossaries} v4.30
%onwards), redefine it to test the \pkgopt{autoseeindex} option.
%    \begin{macrocode}
\ifdef\@glo@autosee
{%
  \renewcommand*{\@glo@autosee}{%
    \if@glsxtr@autoseeindex\@glsxtr@org@gloautosee\fi}%
}%
{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@checkseeallowed}
%\changes{1.16}{2017-06-15}{added redefinition}
%Don't prohibit the use of the \gloskey{see} key before the indexing
%files have been opened if the automatic see indexing has been
%disabled, since it's no longer an issue.
%    \begin{macrocode}
\renewcommand*{\gls@checkseeallowed}{%
 \if@glsxtr@autoseeindex\@gls@see@noindex\fi
}
%    \end{macrocode}
%\end{macro}
%
%
% Define abbreviations glossaries if required.
%    \begin{macrocode}
\@glsxtr@abbreviationsdef
\let\@glsxtr@abbreviationsdef\relax
%    \end{macrocode}
% Setup shortcuts if required.
%    \begin{macrocode}
\@glsxtr@setupshortcuts
%    \end{macrocode}
%Redefine \cs{@glsxtr@redef@forglsentries} if required.
%    \begin{macrocode}
\@glsxtr@redef@forglsentries
%    \end{macrocode}
%
%\begin{macro}{\glossariesextrasetup}
%Allow user to set options after the package has been loaded.
% First modify \cs{glsxtr@dooption} so that it now uses
% \cs{setupglossaries}:
%    \begin{macrocode}
\renewcommand{\glsxtr@dooption}[1]{\setupglossaries{#1}}%
%    \end{macrocode}
% Now define the user command:
%    \begin{macrocode}
\newcommand*{\glossariesextrasetup}[1]{%
  \let\glsxtr@setup@record\relax
  \let\@glsxtr@setupshortcuts\relax
  \let\@glsxtr@redef@forglsentries\relax
  \setkeys{glossaries-extra.sty}{#1}%
  \@glsxtr@abbreviationsdef
  \let\@glsxtr@abbreviationsdef\relax
  \@glsxtr@setupshortcuts
  \glsxtr@setup@record
  \@glsxtr@redef@forglsentries
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@org@@do@wrglossary}
%\changes{1.21}{2017-11-03}{new}
%Save original definition of \cs{@@do@wrglossary}.
%    \begin{macrocode}
\let\glsxtr@org@@do@wrglossary\@@do@wrglossary
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@@do@wrglossary}
%\changes{1.08}{2016-12-13}{new}
%The new version adds code that can show a marker for debugging and
%increments the associated counter if enabled.
%    \begin{macrocode}
\newcommand*{\glsxtr@@do@wrglossary}[1]{%
 \@@glsxtrwrglossmark
 \glsxtr@inc@wrglossaryctr{#1}%
 \glsxtr@org@@do@wrglossary{#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@saveentrycounter}
%\changes{1.08}{2016-12-13}{new}
%Save original definition of \cs{@gls@saveentrycounter}.
%    \begin{macrocode}
\let\glsxtr@saveentrycounter\@gls@saveentrycounter
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@saveentrycounter}
%\changes{1.08}{2016-12-13}{new}
%Change \cs{@gls@saveentrycounter} so that it only stores the entry
%counter information if the indexing is on.
%    \begin{macrocode}
\let\@gls@saveentrycounter\glsxtr@indexonly@saveentrycounter
%    \end{macrocode}
%\end{macro}
%
%Provide script dialect hook (does nothing unless
%redefined by \sty{glossaries-extra-bib2gls}).
%\begin{macro}{\@glsxtrdialecthook}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtrdialecthook}{}
%    \end{macrocode}
%\end{macro}
%
%Set up record option if required.
%    \begin{macrocode}
\glsxtr@setup@record
%    \end{macrocode}
%
% Disable preamble-only options and switch on the undefined tag at
% the start of the document.
%\changes{1.06}{2016-06-18}{disabled docdef key at the start of the
%document}
%    \begin{macrocode}
\AtBeginDocument{%
  \disable@keys{glossaries-extra.sty}{abbreviations,docdef,record}%
  \def\@glsxtrundeftag{\glsxtrundeftag}%
}
%    \end{macrocode}
%
%\section{Extra Utilities}
%\begin{macro}{\glsxtrifemptyglossary}
%\begin{definition}
%\cs{glsxtrifemptyglossary}\marg{type}\marg{true}\marg{false}
%\end{definition}
% Provide command to determine if any entries have been added to the
% glossary (where the glossary label is provided in the first
% argument). The entries are stored in the comma-separated list
% \cs{glolist@\meta{type}}. If this hasn't been defined, the glosary
% doesn't exist. If it has been defined and is simply a comma, the
% glossary exists and is empty. (It's initialised to a comma.)
%\changes{0.4}{2015-12-03}{new}
%    \begin{macrocode}
\newcommand{\glsxtrifemptyglossary}[3]{%
  \ifcsdef{glolist@#1}%
  {%
    \ifcsstring{glolist@#1}{,}{#2}{#3}%
  }%
  {%
    \glsxtrundefaction{Glossary type `#1' doesn't exist}{}%
    #2%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrifkeydefined}
%\changes{1.12}{2017-02-03}{new}
%Tests if the key given in the first argument has been defined.
%    \begin{macrocode}
\newcommand*{\glsxtrifkeydefined}[3]{%
  \key@ifundefined{glossentry}{#1}{#3}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrprovidestoragekey}
%\changes{1.12}{2017-02-03}{new}
%Like \cs{glsaddstoragekey} but does nothing if the key has already
%been defined.
%    \begin{macrocode}
\newcommand*{\glsxtrprovidestoragekey}{%
  \@ifstar\@sglsxtr@provide@storagekey\@glsxtr@provide@storagekey
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@provide@storagekey}
%\changes{1.12}{2017-02-03}{new}
%Unstarred version.
%    \begin{macrocode}
\newcommand*{\@glsxtr@provide@storagekey}[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}%
    }%
%    \end{macrocode}
%Allow the user to omit the user level command if they only
%intended fetching the value with \cs{glsxtrusefield}
%    \begin{macrocode}
    \ifblank{#3}
    {}%
    {%
       \newcommand*{#3}[1]{\@gls@entry@field{##1}{#1}}%
    }%
  }%
  {%
%    \end{macrocode}
%Provide the no-link command if not already defined.
%    \begin{macrocode}
    \ifblank{#3}
    {}%
    {%
      \providecommand*{#3}[1]{\@gls@entry@field{##1}{#1}}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\s@glsxtr@provide@storagekey}
%\changes{1.12}{2017-02-03}{new}
%Starred version.
%    \begin{macrocode}
\newcommand*{\s@glsxtr@provide@storagekey}[1]{%
  \key@ifundefined{glossentry}{#1}%
  {%
    \expandafter\newcommand\expandafter*\expandafter
     {\csname gls@assign@#1@field\endcsname}[2]{%
       \@@gls@expand@field{##1}{#1}{##2}%
     }%
  }%
  {}%
  \@glsxtr@provide@addstoragekey{#1}%
}
%    \end{macrocode}
%\end{macro}
%
%The name of a text-block control sequence can be stored in a
%field (given by \cs{GlsXtrFmtField}). This command can then be used
%with \cs{glsxtrfmt}\oarg{options}\marg{label}\marg{text} which
%effectively does
%\cs{glslink}\oarg{options}\marg{label}\{\meta{cs}\marg{text}\}
%If the field hasn't been set for that entry just \meta{text} is
%done.
%
%\begin{macro}{\GlsXtrFmtField}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand{\GlsXtrFmtField}{useri}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrFmtDefaultOptions}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand{\GlsXtrFmtDefaultOptions}{noindex}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrfmt}
%\changes{1.12}{2017-02-03}{new}
%The post-link hook isn't done. This now has a starred form
%that checks for a final optional argument.
%    \begin{macrocode}
\newrobustcmd*{\glsxtrfmt}{\@ifstar\s@glsxtrfmt\@glsxtrfmt}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glsxtrfmt}
%\changes{1.23}{2017-11-12}{new}
%Unstarred form.
%    \begin{macrocode}
\newcommand*{\@glsxtrfmt}[3][]{\@@glsxtrfmt{#1}{#2}{#3}{}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\s@glsxtrfmt}
%\changes{1.23}{2017-11-12}{new}
%Starred form.
%    \begin{macrocode}
\newcommand*{\s@glsxtrfmt}[3][]{%
 \new@ifnextchar[{\s@@glsxtrfmt{#1}{#2}{#3}}%
  {\@@glsxtrfmt{#1}{#2}{#3}{}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\s@@glsxtrfmt}
%\changes{1.23}{2017-11-12}{new}
%Pick up final optional argument.
%    \begin{macrocode}
\def\s@@glsxtrfmt#1#2#3[#4]{\@@glsxtrfmt{#1}{#2}{#3}{#4}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@@glsxtrfmt}
%\changes{1.23}{2017-11-12}{new}
%Actual inner working.
%    \begin{macrocode}
\newcommand*{\@@glsxtrfmt}[4]{%
%    \end{macrocode}
%Since there's no post-link hook to worry about, grouping can be
%added to provide some protection against nesting (but in general
%nested link text should be avoided).
%\changes{1.23}{2017-11-12}{added grouping}
%    \begin{macrocode}
 \begingroup
   \def\glslabel{#2}%
   \glsdoifexistsordo{#2}%
   {%
     \ifglshasfield{\GlsXtrFmtField}{#2}%
     {%
       \let\do@gls@link@checkfirsthyper\relax
       \expandafter\@gls@link\expandafter[\GlsXtrFmtDefaultOptions,#1]{#2}%
         {\glsxtrfmtdisplay{\glscurrentfieldvalue}{#3}{#4}}%
     }%
     {\glsxtrfmtdisplay{@firstofone}{#3}{#4}}%
   }%
   {%
%    \end{macrocode}
%Has the default \verb|noindex| been counteracted? If so, this
%needs \cs{glsadd} in case \app{bib2gls} needs to pick up the record.
%\changes{1.23}{2017-11-12}{added check for indexing}
%    \begin{macrocode}
     \begingroup
       \@gls@setdefault@glslink@opts
       \setkeys{glslink}{\GlsXtrFmtDefaultOptions,#1}%
       \ifKV@glslink@noindex\else\glsadd{#2}\fi
     \endgroup
     \glsxtrfmtdisplay{@firstofone}{#3}{#4}%
   }%
 \endgroup
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrfmtdisplay}
%\changes{1.23}{2017-11-12}{new}
%The command used internally by \cs{glsxtrfmt} to do the actual
%formatting. The first argument is the control sequence name,
%the second is the control sequence's argument, the third
%is the inserted material (if starred form used).
%    \begin{macrocode}
\newcommand{\glsxtrfmtdisplay}[3]{\csuse{#1}{#2}#3}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrentryfmt}
%\changes{1.12}{2017-02-03}{new}
%No link or indexing.
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\glsxtrentryfmt}[2]{%
    \texorpdfstring{\@glsxtrentryfmt{#1}{#2}}{#2}%
  }
}
{
  \newcommand*{\glsxtrentryfmt}{\@glsxtrentryfmt}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtrentryfmt}
%\changes{1.12}{2017-02-03}{new}
%\changes{1.23}{2017-11-12}{fixed missing label argument}
%    \begin{macrocode}
\newrobustcmd*{\@glsxtrentryfmt}[2]{%
 \glsdoifexistsordo{#1}%
 {%
   \ifglshasfield{\GlsXtrFmtField}{#1}%
   {%
     \csuse{\glscurrentfieldvalue}{#2}%
   }%
   {#2}%
 }%
 {#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrfieldlistadd}
%\changes{1.12}{2017-02-03}{new}
%If a field stores an etoolbox internal list (e.g.
%\gloskey{loclist}) then this macro provides a convenient
%way of adding to the list via etoolbox's \cs{listcsadd}.
%The first argument is the entry's label, the second is the field
%label and the third is the element to add to the list.
%    \begin{macrocode}
\newcommand*{\glsxtrfieldlistadd}[3]{%
  \listcsadd{glo@\glsdetoklabel{#1}@#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrfieldlistgadd}
%\changes{1.12}{2017-02-03}{new}
%Similarly but uses \cs{listcsgadd}.
%    \begin{macrocode}
\newcommand*{\glsxtrfieldlistgadd}[3]{%
  \listcsgadd{glo@\glsdetoklabel{#1}@#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrfieldlisteadd}
%\changes{1.12}{2017-02-03}{new}
%Similarly but uses \cs{listcseadd}.
%    \begin{macrocode}
\newcommand*{\glsxtrfieldlisteadd}[3]{%
  \listcseadd{glo@\glsdetoklabel{#1}@#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrfieldlistxadd}
%Similarly but uses \cs{listcsxadd}.
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrfieldlistxadd}[3]{%
  \listcsxadd{glo@\glsdetoklabel{#1}@#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%Now provide commands to iterate over these lists.
%\begin{macro}{\glsxtrfielddolistloop}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrfielddolistloop}[2]{%
  \dolistcsloop{glo@\glsdetoklabel{#1}@#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrfieldforlistloop}
%\changes{1.12}{2017-02-03}{new}
%\changes{1.29}{2018-04-09}{corrected argument order in \cs{forlistcsloop}}
%    \begin{macrocode}
\newcommand*{\glsxtrfieldforlistloop}[3]{%
  \forlistcsloop{#3}{glo@\glsdetoklabel{#1}@#2}%
}
%    \end{macrocode}
%\end{macro}
%
%List element tests:
%\begin{macro}{\glsxtrfieldifinlist}
%\changes{1.12}{2017-02-03}{new}
%First argument label, second argument field, third argument item,
%fourth true part and fifth false part.
%    \begin{macrocode}
\newcommand*{\glsxtrfieldifinlist}[5]{%
  \ifinlistcs{#3}{glo@\glsdetoklabel{#1}@#2}{#4}{#5}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrfieldxifinlist}
%\changes{1.12}{2017-02-03}{new}
%Expands item.
%    \begin{macrocode}
\newcommand*{\glsxtrfieldxifinlist}[5]{%
  \xifinlistcs{#3}{glo@\glsdetoklabel{#1}@#2}{#4}{#5}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrforcsvfield}
%\changes{1.24}{2017-11-14}{new}
%\begin{definition}
%\cs{glsxtrforcsvfield}\marg{label}\marg{field}\marg{cs handler}
%\end{definition}
%    \begin{macrocode}
\newcommand*{\glsxtrforcsvfield}[3]{%
 \@glsxtrifhasfield{#2}{#1}%
 {%
   \let\glsxtrendfor\@endfortrue
   \@for\@glsxtr@label:=\glscurrentfieldvalue\do
   {\expandafter#3\expandafter{\@glsxtr@label}}}%
 {}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrifhasfield}
%\changes{1.19}{2017-09-09}{new}
%A simpler alternative to \cs{ifglshasfield} that doesn't complain
%if the entry or the field doesn't exist. (No mapping is used.)
%Grouping is added to the unstarred version allow for nested use.
%    \begin{macrocode}
\newrobustcmd{\glsxtrifhasfield}{%
  \@ifstar{\s@glsxtrifhasfield}{\@glsxtrifhasfield}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtrifhasfield}
%\changes{1.19}{2017-09-09}{new}
%Unstarred version adds grouping.
%    \begin{macrocode}
\newcommand{\@glsxtrifhasfield}[4]{%
  {\s@glsxtrifhasfield{#1}{#2}{#3}{#4}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\s@glsxtrifhasfield}
%\changes{1.19}{2017-09-09}{new}
%\changes{1.21}{2017-11-03}{switched from \cs{ifdef} to \cs{ifundef}}
% Starred version omits grouping.
%    \begin{macrocode}
\newcommand{\s@glsxtrifhasfield}[4]{%
  \letcs{\glscurrentfieldvalue}{glo@\glsdetoklabel{#2}@#1}%
  \ifundef\glscurrentfieldvalue
  {#4}%
  {%
   \ifdefempty\glscurrentfieldvalue{#4}{#3}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrIfFieldNonZero}
%\changes{1.31}{2018-05-09}{new}
%Designed for numeric fields.
%    \begin{macrocode}
\newcommand{\GlsXtrIfFieldNonZero}[4]{%
  \GlsXtrIfFieldCmpNum{#1}{#2}{=}{0}{#4}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrIfFieldEqNum}
%\changes{1.31}{2018-05-09}{new}
%\begin{definition}
%\cs{GlsXtrIfFieldEqNum}\marg{field}\marg{label}\marg{value}\marg{true}\marg{false}
%\end{definition}
%Designed for numeric fields.
%    \begin{macrocode}
\newcommand{\GlsXtrIfFieldEqNum}[5]{%
  \GlsXtrIfFieldCmpNum{#1}{#2}{=}{#3}{#4}{#5}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrIfFieldCmpNum}
%\changes{1.31}{2018-05-09}{new}
%\begin{definition}
%\cs{GlsXtrIfFieldCmpNum}\marg{field}\marg{label}\marg{comparison}\marg{value}\marg{true}\marg{false}
%\end{definition}
%Designed for numeric fields.
%    \begin{macrocode}
\newcommand{\GlsXtrIfFieldCmpNum}[6]{%
  {%
    \letcs{\glscurrentfieldvalue}{glo@\glsdetoklabel{#2}@#1}%
    \ifundef\glscurrentfieldvalue
    {\def\glscurrentfieldvalue{0}}%
    {%
     \ifdefempty\glscurrentfieldvalue
     {\def\glscurrentfieldvalue{0}}%
     {}%
    }%
    \ifnum\glscurrentfieldvalue#3#4\relax #5\else #6\fi
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrIfFieldUndef}
%\changes{1.23}{2017-11-12}{new}
%\begin{definition}
%\cs{GlsXtrIfFieldUndef}\marg{field}\marg{label}\marg{true}\marg{false}
%\end{definition}
%Just uses \cs{ifcsundef}.
%    \begin{macrocode}
\newcommand{\GlsXtrIfFieldUndef}[2]{%
 \ifcsundef{glo@\glsdetoklabel{#2}@#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrusefield}
%\changes{1.12}{2017-02-03}{new}
%Provide a user-level alternative to \cs{@gls@entry@field}.
%The first argument is the entry label. The second argument is the
%field label.
%    \begin{macrocode}
\newcommand*{\glsxtrusefield}[2]{%
  \@gls@entry@field{#1}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrusefield}
%\changes{1.12}{2017-02-03}{new}
%Provide a user-level alternative to \cs{@Gls@entry@field}.
%    \begin{macrocode}
\newcommand*{\Glsxtrusefield}[2]{%
  \@gls@entry@field{#1}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrdeffield}
%\changes{1.12}{2017-02-03}{new}
%Just use \cs{csdef} to provide a field value for the given entry.
%    \begin{macrocode}
\newcommand*{\glsxtrdeffield}[2]{\csdef{glo@\glsdetoklabel{#1}@#2}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtredeffield}
%\changes{1.12}{2017-02-03}{new}
%Just use \cs{csedef} to provide a field value for the given entry.
%\changes{1.28}{2018-03-06}{changed \cs{csedef} to
%\cs{protected@csedef}}
%    \begin{macrocode}
\newcommand*{\glsxtredeffield}[2]{\protected@csedef{glo@\glsdetoklabel{#1}@#2}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrsetfieldifexists}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrsetfieldifexists}[3]{\glsdoifexists{#1}{#3}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrSetField}
%\changes{1.12}{2017-02-03}{new}
%Allow the user to set a field. First argument entry label, second
%argument field label, third argument value.
%    \begin{macrocode}
\newrobustcmd*{\GlsXtrSetField}[3]{%
  \glsxtrsetfieldifexists{#1}{#2}%
  {\csdef{glo@\glsdetoklabel{#1}@#2}{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrLetField}
%\changes{1.12}{2017-02-03}{new}
%Uses \cs{cslet} instead. Third argument should be a macro.
%    \begin{macrocode}
\newrobustcmd*{\GlstrLetField}[3]{%
  \glsxtrsetfieldifexists{#1}{#2}%
  {\cslet{glo@\glsdetoklabel{#1}@#2}{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\csGlsXtrLetField}
%\changes{1.12}{2017-02-03}{new}
%Uses \cs{csletcs} instead. Third argument should be a control
%sequence name.
%    \begin{macrocode}
\newrobustcmd*{\csGlsXtrLetField}[3]{%
  \glsxtrsetfieldifexists{#1}{#2}%
  {\csletcs{glo@\glsdetoklabel{#1}@#2}{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrLetFieldToField}
%\changes{1.12}{2017-02-03}{new}
%Sets the field for one entry to the field for another entry.
%Third argument should be the other entry
%and the fourth argument that other field label.
%    \begin{macrocode}
\newrobustcmd*{\GlsXtrLetFieldToField}[4]{%
  \glsxtrsetfieldifexists{#1}{#2}%
  {\csletcs{glo@\glsdetoklabel{#1}@#2}{glo@\glsdetoklabel{#3}@#4}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gGlsXtrSetField}
%\changes{1.12}{2017-02-03}{new}
%Allow the user to set a field. First argument entry label, second
%argument field label, third argument value.
%    \begin{macrocode}
\newrobustcmd*{\gGlsXtrSetField}[3]{%
  \glsxtrsetfieldifexists{#1}{#2}%
  {\csgdef{glo@\glsdetoklabel{#1}@#2}{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\xGlsXtrSetField}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newrobustcmd*{\xGlsXtrSetField}[3]{%
  \glsxtrsetfieldifexists{#1}{#2}%
  {\protected@csxdef{glo@\glsdetoklabel{#1}@#2}{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\eGlsXtrSetField}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newrobustcmd*{\eGlsXtrSetField}[3]{%
  \glsxtrsetfieldifexists{#1}{#2}%
  {\protected@csedef{glo@\glsdetoklabel{#1}@#2}{#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrIfFieldEqStr}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newrobustcmd*{\GlsXtrIfFieldEqStr}[5]{%
  \glsxtrifhasfield{#1}{#2}%
  {%
    \ifdefstring{\glscurrentfieldvalue}{#3}{#4}{#5}%
  }%
  {#5}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrIfFieldEqXpStr}
%\changes{1.31}{2018-05-09}{new}
%Like the above but first expands the string.
%    \begin{macrocode}
\newrobustcmd*{\GlsXtrIfFieldEqXpStr}[5]{%
  \glsxtrifhasfield{#1}{#2}%
  {%
    \protected@edef\@gls@tmp{#3}%
    \ifdefequal{\glscurrentfieldvalue}{\@gls@tmp}{#4}{#5}%
  }%
  {#5}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrIfXpFieldEqXpStr}
%\changes{1.31}{2018-05-09}{new}
%Like the above but also expands the field value.
%    \begin{macrocode}
\newrobustcmd*{\GlsXtrIfXpFieldEqXpStr}[5]{%
  \glsxtrifhasfield{#1}{#2}%
  {%
    \protected@edef\@gls@tmp{\glscurrentfieldvalue}%
    \let\glscurrentfieldvalue\@gls@tmp
    \protected@edef\@gls@tmp{#3}%
    \ifdefequal{\glscurrentfieldvalue}{\@gls@tmp}{#4}{#5}%
  }%
  {#5}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrpageref}
%\changes{1.11}{2017-01-19}{new}
% Like \cs{glsrefentry} but references the page number instead (if
% entry counting is on). The base \sty{glossaries} package only
% introduced \cs{GlsEntryCounterLabelPrefix} in version 4.38, so it
% may not be defined.
%    \begin{macrocode}
\ifdef\GlsEntryCounterLabelPrefix
{%
  \newcommand*{\glsxtrpageref}[1]{%
    \ifglsentrycounter
      \pageref{\GlsEntryCounterLabelPrefix\glsdetoklabel{#1}}%
    \else
      \ifglssubentrycounter
        \pageref{\GlsEntryCounterLabelPrefix\glsdetoklabel{#1}}%
      \else
        \gls{#1}%
      \fi
    \fi
  }
}%
{%
  \newcommand*{\glsxtrpageref}[1]{%
    \ifglsentrycounter
      \pageref{glsentry-\glsdetoklabel{#1}}%
    \else
      \ifglssubentrycounter
        \pageref{glsentry-\glsdetoklabel{#1}}%
      \else
        \gls{#1}%
      \fi
    \fi
  }
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\apptoglossarypreamble}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand{\apptoglossarypreamble}[2][\glsdefaulttype]{%
  \ifcsdef{glolist@#1}%
  {%
   \ifcsundef{@glossarypreamble@#1}%
   {\csdef{@glossarypreamble@#1}{}}%
   {}%
   \csappto{@glossarypreamble@#1}{#2}%
  }%
  {%
    \GlossariesExtraWarning{Glossary `#1' is not defined}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\pretoglossarypreamble}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand{\preglossarypreamble}[2][\glsdefaulttype]{%
  \ifcsdef{glolist@#1}%
  {%
   \ifcsundef{@glossarypreamble@#1}%
   {\csdef{@glossarypreamble@#1}{}}%
   {}%
   \cspreto{@glossarypreamble@#1}{#2}%
  }%
  {%
    \GlossariesExtraWarning{Glossary `#1' is not defined}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\section{Modifications to Commands Provided by \styfmt{glossaries}}
% Some of the commands provided by \styfmt{glossaries} are modified
% to take into account new options or to change default behaviour.
%
%Provide a starred version of \cs{longnewglossaryentry} that doesn't
%automatically insert \verb|\leavevmode\unskip\nopostdesc| at the
%end of the description. The unstarred version is modified to use
%\cs{glsxtrpostlongdescription} instead.
%
%\begin{macro}{\longnewglossaryentry}
%\changes{1.12}{2017-02-03}{added starred version}
%    \begin{macrocode}
\renewcommand*{\longnewglossaryentry}{%
 \@ifstar\@glsxtr@s@longnewglossaryentry\@glsxtr@longnewglossaryentry
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@s@longnewglossaryentry}
%\changes{1.12}{2017-02-03}{new}
%Starred version.
%    \begin{macrocode}
\newcommand{\@glsxtr@s@longnewglossaryentry}[3]{%
  \glsdoifnoexists{#1}%
  {%
     \bgroup
       \let\@org@newglossaryentryprehook\@newglossaryentryprehook
       \long\def\@newglossaryentryprehook{%
         \long\def\@glo@desc{#3}%
         \@org@newglossaryentryprehook
       }%
       \renewcommand*{\gls@assign@desc}[1]{%
          \global\cslet{glo@\glsdetoklabel{#1}@desc}{\@glo@desc}%
          \global\cslet{glo@\glsdetoklabel{#1}@descplural}{\@glo@descplural}%
        }
       \gls@defglossaryentry{#1}{#2}%
     \egroup
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@longnewglossaryentry}
%\changes{1.12}{2017-02-03}{new}
%Unstarred version.
%    \begin{macrocode}
\newcommand{\@glsxtr@longnewglossaryentry}[3]{%
  \glsdoifnoexists{#1}%
  {%
     \bgroup
       \let\@org@newglossaryentryprehook\@newglossaryentryprehook
       \long\def\@newglossaryentryprehook{%
         \long\def\@glo@desc{#3\glsxtrpostlongdescription}%
         \@org@newglossaryentryprehook
       }%
       \renewcommand*{\gls@assign@desc}[1]{%
          \global\cslet{glo@\glsdetoklabel{#1}@desc}{\@glo@desc}%
%    \end{macrocode}
%The following is different from the base \sty{glossaries.sty}:
%    \begin{macrocode}
          \global\cslet{glo@\glsdetoklabel{#1}@descplural}{\@glo@descplural}%
        }
       \gls@defglossaryentry{#1}{#2}%
     \egroup
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrpostlongdescription}
%\changes{1.12}{2017-02-03}{new}
%Hook at the end of the description when using the unstarred
%\cs{longnewglossaryentry}.
%    \begin{macrocode}
\newcommand*{\glsxtrpostlongdescription}{\leavevmode\unskip\nopostdesc}
%    \end{macrocode}
%\end{macro}
%
%Provide a starred version of \cs{newignoredglossary} that doesn't
%add the glossary to the nohyperlist list.
%
%\begin{macro}{\newignoredglossary}
%\changes{1.11}{2017-01-19}{added starred version}
%Redefine to check for star.
%    \begin{macrocode}
\renewcommand{\newignoredglossary}{%
 \@ifstar\glsxtr@s@newignoredglossary\glsxtr@org@newignoredglossary
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@org@newignoredglossary}
%The original definition is patched to check for existence.
%\changes{1.11}{2017-01-19}{new}
%\changes{1.12}{2017-02-03}{Added check for existence}
%    \begin{macrocode}
\newcommand*{\glsxtr@org@newignoredglossary}[1]{%
  \ifcsdef{glolist@#1}
  {%
    \glsxtrundefaction{Glossary type `#1' already exists}{}%
  }%
  {%
    \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}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@s@newignoredglossary}
%Starred form.
%\changes{1.11}{2017-01-19}{new}
%\changes{1.12}{2017-02-03}{Added check for existence}
%    \begin{macrocode}
\newcommand*{\glsxtr@s@newignoredglossary}[1]{%
  \ifcsdef{glolist@#1}
  {%
    \glsxtrundefaction{Glossary type `#1' already exists}{}%
  }%
  {%
    \ifdefempty\@ignored@glossaries
    {%
      \edef\@ignored@glossaries{#1}%
    }%
    {%
      \eappto\@ignored@glossaries{,#1}%
    }%
    \csgdef{glolist@#1}{,}%
    \ifcsundef{gls@#1@entryfmt}%
    {%
      \defglsentryfmt[#1]{\glsentryfmt}%
    }%
    {}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glssettoctitle}
%\changes{1.12}{2017-02-03}{added patch}
%Ignored glossaries don't have an associated title, so modify
%\cs{glssettoctitle} to check for it to prevent an undefined 
%command written to the toc file.
%    \begin{macrocode}
\glsifusetranslator
{%
  \renewcommand*{\glssettoctitle}[1]{%
    \ifcsdef{gls@tr@set@#1@toctitle}%
    {%
      \csuse{gls@tr@set@#1@toctitle}%
    }%
    {%
      \ifcsdef{@glotype@#1@title}%
      {\def\glossarytoctitle{\csname @glotype@#1@title\endcsname}}%
      {\def\glossarytoctitle{\glossarytitle}}%
    }%
  }%
}
{
  \renewcommand*{\glssettoctitle}[1]{%
    \ifcsdef{@glotype@#1@title}%
    {\def\glossarytoctitle{\csname @glotype@#1@title\endcsname}}%
    {\def\glossarytoctitle{\glossarytitle}}%
  }
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\provideignoredglossary}
%\changes{1.12}{2017-02-03}{new}
%As above but won't do anything if the glossary already exists.
%    \begin{macrocode}
\newcommand{\provideignoredglossary}{%
 \@ifstar\glsxtr@s@provideignoredglossary\glsxtr@provideignoredglossary
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@provideignoredglossary}
%\changes{1.12}{2017-02-03}{new}
%Unstarred version.
%    \begin{macrocode}
\newcommand*{\glsxtr@provideignoredglossary}[1]{%
  \ifcsdef{glolist@#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}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@s@provideignoredglossary}
%Starred form.
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand*{\glsxtr@s@provideignoredglossary}[1]{%
  \ifcsdef{glolist@#1}
  {}%
  {%
    \ifdefempty\@ignored@glossaries
    {%
      \edef\@ignored@glossaries{#1}%
    }%
    {%
      \eappto\@ignored@glossaries{,#1}%
    }%
    \csgdef{glolist@#1}{,}%
    \ifcsundef{gls@#1@entryfmt}%
    {%
      \defglsentryfmt[#1]{\glsentryfmt}%
    }%
    {}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrcopytoglossary}
%Adds an entry label to another glossary list. First argument is
%entry label. Second argument is glossary label.
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrcopytoglossary}[2]{%
  \glsdoifexists{#1}%
  {%
    \ifcsdef{glolist@#2}
    {%
      \cseappto{glolist@#2}{#1,}%
    }%
    {%
      \glsxtrundefaction{Glossary type `#2' doesn't exist}{}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\subsection{Existence Checks}
%\begin{macro}{\glsdoifexists}
% Modify \cs{glsdoifexists} to take account of the
% \pkgopt{undefaction} setting.
%    \begin{macrocode}
\renewcommand{\glsdoifexists}[2]{%
  \ifglsentryexists{#1}{#2}%
  {%
%    \end{macrocode}
% Define \cs{glslabel} in case it's needed after this command (for
% example in the post-link hook).
%\changes{1.08}{2016-12-13}{now defines \cs{glslabel}}
%    \begin{macrocode}
    \edef\glslabel{\glsdetoklabel{#1}}%
    \glsxtrundefaction{Glossary entry `\glslabel'
    has not been defined}{You need to define a glossary entry before
    you can reference it.}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdoifnoexists}
% Modify \cs{glsdoifnoexists} to take account of the
% \pkgopt{undefaction} setting.
%    \begin{macrocode}
\renewcommand{\glsdoifnoexists}[2]{%
   \ifglsentryexists{#1}{%
    \glsxtrundefaction{Glossary entry `\glsdetoklabel{#1}'
    has already been defined}{}}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdoifexistsordo}
% Modify \cs{glsdoifexistsordo} to take account of the
% \pkgopt{undefaction} setting. This command was introduced in 
% \styfmt{glossaries} version 4.19, so check if it has been defined first.
%    \begin{macrocode}
\ifdef\glsdoifexistsordo
{%
  \renewcommand{\glsdoifexistsordo}[3]{%
    \ifglsentryexists{#1}{#2}%
    {%
      \glsxtrundefaction{Glossary entry `\glsdetoklabel{#1}'
      has not been defined}{You need to define a glossary entry 
      before you can use it.}%
      #3%
    }%
  }%
}
{%
  \glsxtr@warnonexistsordo\glsdoifexistsordo
  \newcommand{\glsdoifexistsordo}[3]{%
    \ifglsentryexists{#1}{#2}%
    {%
      \glsxtrundefaction{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}
% Similarly for \cs{doifglossarynoexistsordo}.
%    \begin{macrocode}
\ifdef\doifglossarynoexistsordo
{%
  \renewcommand{\doifglossarynoexistsordo}[3]{%
    \ifglossaryexists{#1}%
    {%
      \glsxtrundefaction{Glossary type `#1' already exists}{}%
      #3%
    }%
    {#2}%
  }%
}
{%
  \glsxtr@warnonexistsordo\doifglossarynoexistsordo
  \newcommand{\doifglossarynoexistsordo}[3]{%
    \ifglossaryexists{#1}%
    {%
      \glsxtrundefaction{Glossary type `#1' already exists}{}%
      #3%
    }%
    {#2}%
  }%
}

%    \end{macrocode}
%\end{macro}
%
%There are now three types of cross-references: the \gloskey{see} key (as
%original), the \gloskey{alias} key (from \styfmt{glossaries-extra} v1.12)
% and the \gloskey{seealso} key (from \styfmt{glossaries-extra} v1.16).
% The original \gloskey{see} key needs to have a corresponding field
% (which it doesn't with the base \sty{glossaries} package).
%
%\begin{macro}{\@newglossaryentryposthook}
% Hook into end of \cs{newglossaryentry} to add \qt{see} value as a
% field.
%\changes{0.5.4}{2015-12-15}{added empty see value if not set and added
% `see' to field key map}
%    \begin{macrocode}
\appto\@newglossaryentryposthook{%
  \ifdefvoid\@glo@see
   {\csxdef{glo@\@glo@label @see}{}}%
   {%
     \csxdef{glo@\@glo@label @see}{\@glo@see}%
     \if@glsxtr@autoseeindex
       \@glsxtr@autoindexcrossrefs
     \fi
   }%
}
\appto\@gls@keymap{,{see}{see}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrusesee}
%\changes{1.06}{2016-06-18}{new}
%Apply \cs{glsseeformat} to the \gloskey{see} key if not empty.
%    \begin{macrocode}
\newcommand*{\glsxtrusesee}[1]{%
  \glsdoifexists{#1}%
  {%
    \letcs{\@glo@see}{glo@\glsdetoklabel{#1}@see}%
    \ifdefempty\@glo@see
    {}%
    {%
      \expandafter\glsxtr@usesee\@glo@see\@end@glsxtr@usesee
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@usesee}
%\changes{1.06}{2016-06-18}{new}
%    \begin{macrocode}
\newcommand*{\glsxtr@usesee}[1][\seename]{%
  \@glsxtr@usesee[#1]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@usesee}
%\changes{1.06}{2016-06-18}{new}
%    \begin{macrocode}
\def\@glsxtr@usesee[#1]#2\@end@glsxtr@usesee{%
  \glsxtruseseeformat{#1}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtruseseeformat}
%\changes{1.06}{2016-06-18}{new}
%The format used by \cs{glsxtrusesee}. The first argument is the tag
%(such as \cs{seename}). The second argument is the comma-separated
%list of cross-referenced labels.
%    \begin{macrocode}
\newcommand*{\glsxtruseseeformat}[2]{%
  \glsseeformat[#1]{#2}{}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsseeitemformat}
%\changes{1.21}{2017-11-03}{new}
%\changes{1.22}{2017-11-08}{switched check from regular to short}
%\styfmt{glossaries} originally defined \cs{glsseeitemformat}
%to use \cs{glsentryname} but in v3.0 this was switched to
%use \cs{glsentrytext} due to problems occurring with the
%\gloskey{name} field being sanitized. Since this is no longer a
%problem, \styfmt{glossaries-extra} restores the original
%definition as it makes more sense to use the \gloskey{name}
%in the cross-reference list. This still uses \cs{glsaccesstext}
%for abbreviations.
%    \begin{macrocode}
\renewcommand*{\glsseeitemformat}[1]{%
 \ifglshasshort{\glslabel}{\glsaccesstext{#1}}{\glsaccessname{#1}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtruseseealso}
%\changes{1.16}{2017-06-15}{new}
%Apply \cs{glsseeformat} to the \gloskey{seealso} key if not empty.
%There's no optional tag to worry about here.
%    \begin{macrocode}
\newcommand*{\glsxtruseseealso}[1]{%
  \glsdoifexists{#1}%
  {%
    \letcs{\@glo@see}{glo@\glsdetoklabel{#1}@seealso}%
    \ifdefempty\@glo@see
    {}%
    {%
      \expandafter\glsxtruseseealsoformat\expandafter{\@glo@see}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtruseseealsoformat}
%\changes{1.16}{2017-06-15}{new}
%The format used by \cs{glsxtruseseealso}. The argument is the comma-separated
%list of cross-referenced labels.
%    \begin{macrocode}
\newcommand*{\glsxtruseseealsoformat}[1]{%
  \glsseeformat[\seealsoname]{#1}{}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrseelist}
%\changes{1.16}{2017-06-15}{new}
%Fully expands argument before passing to \cs{glsseelist}.
%(The argument to \cs{glsseelist} must be a comma-separated list of
%entry labels.)
%    \begin{macrocode}
\newrobustcmd{\glsxtrseelist}[1]{%
  \edef\@glo@tmp{\noexpand\glsseelist{#1}}\@glo@tmp
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\seealsoname}
%\changes{1.16}{2017-06-15}{new}
%In case this command hasn't been defined. (Should be provided by
%language packages.)
%    \begin{macrocode}
\providecommand{\seealsoname}{see also}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrindexseealso}
%\changes{1.16}{2017-06-15}{new}
%If \cs{@xdycrossrefhook} is defined, provide a
%\texttt{seealso} crossref class. Otherwise this just does
%\cs{glssee} with \cs{seealsoname} as the tag. The hook is only
%defined if both \pkgopt{xindy} and \sty{glossaries} v4.30+ are
%being used.
%    \begin{macrocode}
\ifdef\@xdycrossrefhook
{
%    \end{macrocode}
%Add the cross-reference class definition to the hook.
%    \begin{macrocode}
  \appto\@xdycrossrefhook{%
    \write\glswrite{(define-crossref-class \string"seealso\string"
      :unverified )}%
    \write\glswrite{(markup-crossref-list
       :class \string"seealso\string"^^J\space\space\space
       :open \string"\string\glsxtruseseealsoformat\glsopenbrace\string"
       :close \string"\glsclosebrace\string")}%
  }
%    \end{macrocode}
%Append to class list.
%    \begin{macrocode}
  \appto\@xdylocationclassorder{\space\string"seealso\string"}
%    \end{macrocode}
%This essentially works like \cs{@do@seeglossary} but uses the
%\texttt{seealso} class.
%\changes{1.21}{2017-11-03}{added check that the entry exists}
%This doesn't increment the associated counter.
%    \begin{macrocode}
  \newrobustcmd*{\glsxtrindexseealso}[2]{%
    \ifx\@glsxtr@record@setting\@glsxtr@record@setting@alsoindex
      \@glsxtr@recordsee{#1}{#2}%
    \fi
    \glsdoifexists{#1}%
    {%
      \@@glsxtrwrglossmark
      \def\@gls@xref{#2}%
      \@onelevel@sanitize\@gls@xref
      \@gls@checkmkidxchars\@gls@xref
      \gls@glossary{\csname glo@#1@type\endcsname}{%
        (indexentry
          :tkey (\csname glo@#1@index\endcsname)
          :xref (\string"\@gls@xref\string")
          :attr \string"seealso\string"
        )
      }%
    }%
  }
}
{
%    \end{macrocode}
% \pkgopt{xindy} not in use or \sty{glossaries} version too old to support this.
%    \begin{macrocode}
  \newrobustcmd*{\glsxtrindexseealso}{\glssee[\seealsoname]}
}
%    \end{macrocode}
%\end{macro}
%
%The \gloskey{alias} key should be set to the label of the synonymous entry.
%The \gloskey{seealso} key essentially behaves like
%\texttt{see=[\cs{seealsoname}]\marg{xr-list}}. Neither of these new keys 
%has the optional tag part allowed with \gloskey{see}.
%
% If \cs{gls@set@xr@key} has been defined (\sty{glossaries} v4.30), 
% use that, otherwise just use \cs{glsaddstoragekey}.
%
%    \begin{macrocode}
\ifdef\gls@set@xr@key
{
%    \end{macrocode}
% We have at least \sty{glossaries} v4.30. This means the new keys 
% can be governed by the same settings as the see key.
%    \begin{macrocode}
  \define@key{glossentry}{alias}{%
    \gls@set@xr@key{alias}{\@glo@alias}{#1}%
  }
  \define@key{glossentry}{seealso}{%
    \gls@set@xr@key{seealso}{\@glo@seealso}{#1}%
  }
%    \end{macrocode}
% Add to the key mappings.
%    \begin{macrocode}
  \appto\@gls@keymap{,{alias}{alias},{seealso}{seealso}}
%    \end{macrocode}
% Set the default value.
%    \begin{macrocode}
  \appto\@newglossaryentryprehook{\def\@glo@alias{}\def\@glo@seealso{}}%
%    \end{macrocode}
% Assign the field values.
%    \begin{macrocode}
  \appto\@newglossaryentryposthook{%
    \ifdefvoid\@glo@seealso
     {\csxdef{glo@\@glo@label @seealso}{}}%
     {%
       \csxdef{glo@\@glo@label @seealso}{\@glo@seealso}%
       \if@glsxtr@autoseeindex
         \@glsxtr@autoindexcrossrefs
       \fi
     }%
%    \end{macrocode}
% The \gloskey{alias} field doesn't trigger the automatic
% cross-reference indexing performed at the end of the document.
%    \begin{macrocode}
    \ifdefvoid\@glo@alias
     {\csxdef{glo@\@glo@label @alias}{}}%
     {%
       \csxdef{glo@\@glo@label @alias}{\@glo@alias}%
     }%
  }
%    \end{macrocode}
% Provide user-level commands to access the values.
%\begin{macro}{\glsxtralias}
%    \begin{macrocode}
  \newcommand*{\glsxtralias}[1]{\@gls@entry@field{#1}{alias}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrseealsolabels}
%    \begin{macrocode}
  \newcommand*{\glsxtrseealsolabels}[1]{\@gls@entry@field{#1}{seealso}}
%    \end{macrocode}
%\end{macro}
%Add to the \cs{@glo@autosee} hook.
%    \begin{macrocode}
  \appto\@glo@autoseehook{%
    \ifdefvoid\@glo@alias
    {%
      \ifdefvoid\@glo@seealso
      {}%
      {%
        \edef\@do@glssee{\noexpand\glsxtrindexseealso
          {\@glo@label}{\@glo@seealso}}%
        \@do@glssee
      }%
    }%
    {%
%    \end{macrocode}
%Add cross-reference if see key hasn't been used.
%    \begin{macrocode}
      \ifdefvoid\@glo@see
      {%
        \edef\@do@glssee{\noexpand\glssee{\@glo@label}{\@glo@alias}}%
        \@do@glssee
      }%
      {}%
    }%
  }%
}
{
%    \end{macrocode}
% We have an older version of \sty{glossaries}, so just use
% \cs{glsaddstoragekey}.
%\begin{macro}{\glsxtralias}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
  \glsaddstoragekey*{alias}{}{\glsxtralias}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrseealsolabels}
%\changes{1.16}{2017-06-15}{new}
%    \begin{macrocode}
  \glsaddstoragekey*{seealso}{}{\glsxtrseealsolabels}
%    \end{macrocode}
%\end{macro}
%
%If \cs{gls@set@xr@key} isn't defined, then \cs{@glo@autosee} won't
%be either, so use the post entry definition hook.
%
%\begin{macro}{\@newglossaryentryposthook}
%\changes{1.12}{2017-02-03}{added check for alias key}
%Append to the hook to check for the \gloskey{alias} and
%\gloskey{seealso} keys.
%    \begin{macrocode}
  \appto\@newglossaryentryposthook{%
    \ifcsvoid{glo@\@glo@label @alias}%
    {%
      \ifcsvoid{glo@\@glo@label @seealso}%
      {}%
      {%
        \edef\@do@glssee{\noexpand\glsxtrindexseealso
          {\@glo@label}{\csuse{glo@\@glo@label @seealso}}}%
        \@do@glssee
      }%
    }%
    {%
%    \end{macrocode}
%Add cross-reference if see key hasn't been used.
%    \begin{macrocode}
      \ifdefvoid\@glo@see
      {%
        \edef\@do@glssee{\noexpand\glssee
          {\@glo@label}{\csuse{glo@\@glo@label @alias}}}%
        \@do@glssee
      }%
      {}%
    }%
  }
%    \end{macrocode}
%\end{macro}
%
%    \begin{macrocode}
}
%    \end{macrocode}
%
%
% Add all unused cross-references at the end of the document.
%    \begin{macrocode}
\AtEndDocument{\if@glsxtrindexcrossrefs\glsxtraddallcrossrefs\fi}
%    \end{macrocode}
%
%\begin{macro}{\glsxtraddallcrossrefs}
% Iterate through all used entries and if they have a
% cross-reference, make sure the cross-reference has been added.
%    \begin{macrocode}
\newcommand*{\glsxtraddallcrossrefs}{%
  \forallglossaries{\@glo@type}%
  {%
     \forglsentries[\@glo@type]{\@glo@label}%
     {%
       \ifglsused{\@glo@label}%
       {\expandafter\@glsxtr@addunusedxrefs\expandafter{\@glo@label}}{}%
     }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@addunusedxrefs}
% If the given entry has a \gloskey{see} or \gloskey{seealso} field add all unused
% cross-references. (The \gloskey{alias} field isn't checked.)
%\changes{1.16}{2017-06-15}{added check for \gloskey{seealso} field}
%    \begin{macrocode}
\newcommand*{\@glsxtr@addunusedxrefs}[1]{%
  \letcs{\@glo@see}{glo@\glsdetoklabel{#1}@see}%
  \ifdefvoid\@glo@see
  {}%
  {%
    \expandafter\glsxtr@addunused\@glo@see\@end@glsxtr@addunused
  }%
  \letcs{\@glo@see}{glo@\glsdetoklabel{#1}@seealso}%
  \ifdefvoid\@glo@see
  {}%
  {%
    \expandafter\glsxtr@addunused\@glo@see\@end@glsxtr@addunused
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@addunused}
% Adds all the entries if they haven't been used.
%    \begin{macrocode}
\newcommand*{\glsxtr@addunused}[1][]{%
  \@glsxtr@addunused
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@addunused}
% Adds all the entries if they haven't been used.
%    \begin{macrocode}
\def\@glsxtr@addunused#1\@end@glsxtr@addunused{%
 \@for\@glsxtr@label:=#1\do
 {%
   \ifglsused{\@glsxtr@label}{}%
   {%
     \glsadd[format=glsxtrunusedformat]{\@glsxtr@label}%
     \glsunset{\@glsxtr@label}%
     \expandafter\@glsxtr@addunusedxrefs\expandafter{\@glsxtr@label}%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrunusedformat}
%    \begin{macrocode}
\newcommand*{\glsxtrunusedformat}[1]{\unskip}
%    \end{macrocode}
%\end{macro}
%
%\subsection{Document Definitions}
%
%\begin{macro}{\gls@begindocdefs}
%This command was only introduced to \styfmt{glossaries} v4.37, so
%it may not be defined. If it has been defined, redefine it to check
%\cs{@glsxtr@docdefval} so that it only inputs the \texttt{.glsdefs}
%file if \pkgopt[true]{docdef}.
%    \begin{macrocode}
\ifdef\gls@begindocdefs
{%
  \renewcommand*{\gls@begindocdefs}{%
    \ifnum\@glsxtr@docdefval=1\relax
      \@gls@enablesavenonumberlist
      \edef\@gls@restoreat{%
        \noexpand\catcode`\noexpand\@=\number\catcode`\@\relax}%
      \makeatletter
      \InputIfFileExists{\jobname.glsdefs}{}{}%
      \@gls@restoreat
      \undef\@gls@restoreat
      \gls@defdocnewglossaryentry
    \fi
  }
}
{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\makenoidxglossaries}
%Modify \cs{makenoidxglossaries} so that it automatically 
%sets \pkgopt[false]{docdef} (unless the restricted setting is on)
%and disables the \pkgopt{docdef} key.
%This command isn't allow with the \pkgopt{record} option.
%    \begin{macrocode}
\let\glsxtr@orgmakenoidxglossaries\makenoidxglossaries
\renewcommand{\makenoidxglossaries}{%
  \ifdefequal\@glsxtr@record@setting\@glsxtr@record@setting@off
  {%
    \glsxtr@orgmakenoidxglossaries
%    \end{macrocode}
%Add marker to \cs{@do@seeglossary} but don't increment associated
%counter.
%    \begin{macrocode}
    \renewcommand{\@do@seeglossary}[2]{%
      \@@glsxtrwrglossmark
      \edef\@gls@label{\glsdetoklabel{##1}}%
      \protected@write\@auxout{}{%
        \string\@gls@reference
          {\csname glo@\@gls@label @type\endcsname}%
          {\@gls@label}%
          {%
            \string\glsseeformat##2{}%
          }%
      }%
    }%
%    \end{macrocode}
%Check for \pkgopt[restricted]{docdefs}:
%    \begin{macrocode}
    \if@glsxtrdocdefrestricted
%    \end{macrocode}
%If restricted document definitions allowed, adjust
%\cs{@gls@reference} so that it doesn't test for existence.
%    \begin{macrocode}
      \renewcommand*{\@gls@reference}[3]{%
        \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}%
      }%
    \else
%    \end{macrocode}
%Disable document definitions.
%    \begin{macrocode}
      \@glsxtrdocdeffalse
    \fi
    \disable@keys{glossaries-extra.sty}{docdef}%
  }%
  {%
    \PackageError{glossaries-extra}{\string\makenoidxglossaries\space
     not permitted\MessageBreak 
     with record=\@glsxtr@record@setting\space package option}%
    {You may only use \string\makenoidxglossaries\ space with the
     record=off option}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@defdocnewglossaryentry}
% Modify \cs{gls@defdocnewglossaryentry} so that it checks
% the \pkgopt{docdef} value.
%    \begin{macrocode}
\renewcommand*{\gls@defdocnewglossaryentry}{%
  \ifcase\@glsxtr@docdefval
%    \end{macrocode}
% \pkgopt[false]{docdef}:
%    \begin{macrocode}
    \renewcommand*{\newglossaryentry}[2]{%
      \PackageError{glossaries-extra}{Glossary entries must
       be \MessageBreak defined in the preamble with \MessageBreak
       package option `docdef=false'\MessageBreak(consider using
       `docdef=restricted')}{Move your glossary definitions to
       the preamble. You can also put them in a \MessageBreak separate file
       and load them with \string\loadglsentries.}%
    }%
  \or
%    \end{macrocode}
% (\pkgopt[true]{docdef} case.)
% Since the \gloskey{see} value is now saved in a field, it
% can be used by entries that have been defined in the document.
%    \begin{macrocode}
    \let\gls@checkseeallowed\relax
    \let\newglossaryentry\new@glossaryentry
  \or
%    \end{macrocode}
%Restricted mode just needs to allow the \gloskey{see} value.
%    \begin{macrocode}
    \let\gls@checkseeallowed\relax
  \fi
}%
%    \end{macrocode}
%\end{macro}
%
% Permit a special form of document definition, but only allow
% it if the glossaries come at the end of the document. These
% commands behave a little like a combination of \cs{newterm}
% and \cs{gls}. This must be explicitly enabled with
% the following.
%
%\begin{macro}{\GlsXtrEnableOnTheFly}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\newcommand*{\GlsXtrEnableOnTheFly}{%
  \@ifstar\@sGlsXtrEnableOnTheFly\@GlsXtrEnableOnTheFly
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@sGlsXtrEnableOnTheFly}
%\changes{0.5.4}{2015-12-15}{new}
% The starred version attempts to allow UTF8 characters in the
% label, but this may break! (Formatting commands mustn't be used in the 
% label, but the label may be a command whose replacement text is the
% actual label. This doesn't take into account a command that's
% defined in terms of another command that may eventually expand to
% the label text.)
%    \begin{macrocode}
\newcommand*{\@sGlsXtrEnableOnTheFly}{%
  \renewcommand*{\glsdetoklabel}[1]{%
    \expandafter\@glsxtr@ifcsstart\string##1 \@glsxtr@end@
    {%
      \expandafter\detokenize\expandafter{##1}%
    }%
    {\detokenize{##1}}%
  }%
  \@GlsXtrEnableOnTheFly
}
\def\@glsxtr@ifcsstart#1#2\@glsxtr@end@#3#4{%
  \expandafter\if\glsbackslash#1%
    #3%
  \else
    #4%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrstarflywarn}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrstarflywarn}{%
  \GlossariesExtraWarning{Experimental starred version of
  \string\GlsXtrEnableOnTheFly\space in use (please ensure you have
  read the warnings in the glossaries-extra user manual)}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GlsXtrEnableOnTheFly}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\newcommand*{\@GlsXtrEnableOnTheFly}{%
%    \end{macrocode}
%\end{macro}
% Don't redefine \cs{glsdetoklabel} if LuaTeX or XeTeX is being
% used, since it's mainly to allow accented characters in the
% label.
%
% These definitions are all assigned the category given by:
%\begin{macro}{\glsxtrcat}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
  \newcommand*{\glsxtrcat}{general}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
  \newcommand*{\glsxtr}[1][]{%
   \def\glsxtr@keylist{##1}%
   \@glsxtr
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
  \newcommand*{\@glsxtr}[2][]{%
   \ifglsentryexists{##2}%
   {%
     \ifblank{##1}{}{\GlsXtrWarning{##1}{##2}}%
   }%
   {%
     \gls@defglossaryentry{##2}{name={##2},category=\glsxtrcat,
       description={\nopostdesc},##1}%
   }%
   \expandafter\gls\expandafter[\glsxtr@keylist]{##2}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtr}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
  \newcommand*{\Glsxtr}[1][]{%
   \def\glsxtr@keylist{##1}%
   \@Glsxtr
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsxtr}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
  \newcommand*{\@Glsxtr}[2][]{%
   \ifglsentryexists{##2}%
   {%
     \ifblank{##1}{}{\GlsXtrWarning{##1}{##2}}%
   }%
   {%
     \gls@defglossaryentry{##2}{name={##2},category=\glsxtrcat,
       description={\nopostdesc},##1}%
   }%
   \expandafter\Gls\expandafter[\glsxtr@keylist]{##2}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrpl}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
  \newcommand*{\glsxtrpl}[1][]{%
   \def\glsxtr@keylist{##1}%
   \@glsxtrpl
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtrpl}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
  \newcommand*{\@glsxtrpl}[2][]{%
   \ifglsentryexists{##2}%
   {%
     \ifblank{##1}{}{\GlsXtrWarning{##1}{##2}}%
   }%
   {%
     \gls@defglossaryentry{##2}{name={##2},category=\glsxtrcat,
       description={\nopostdesc},##1}%
   }%
   \expandafter\glspl\expandafter[\glsxtr@keylist]{##2}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrpl}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
  \newcommand*{\Glsxtrpl}[1][]{%
   \def\glsxtr@keylist{##1}%
   \@Glsxtrpl
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsxtrpl}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
  \newcommand*{\@Glsxtrpl}[2][]{%
   \ifglsentryexists{##2}
   {%
     \ifblank{##1}{}{\GlsXtrWarning{##1}{##2}}%
   }%
   {%
     \gls@defglossaryentry{##2}{name={##2},category=\glsxtrcat,
       description={\nopostdesc},##1}%
   }%
   \expandafter\Glspl\expandafter[\glsxtr@keylist]{##2}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrWarning}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
  \newcommand*{\GlsXtrWarning}[2]{%
    \def\@glsxtr@optlist{##1}%
    \@onelevel@sanitize\@glsxtr@optlist
    \GlossariesExtraWarning{The options `\@glsxtr@optlist' have 
    been ignored for entry `##2' as it has already been defined}%
  }
%    \end{macrocode}
%\end{macro}
% Disable commands after the glossary:
%    \begin{macrocode}
  \renewcommand\@printglossary[2]{%
    \def\@glsxtr@printglossopts{##1}%
    \@glsxtr@orgprintglossary{##1}{##2}%
    \def\@glsxtr{\@glsxtr@disabledflycommand\glsxtr}%
    \def\@glsxtrpl{\@glsxtr@disabledflycommand\glsxtrpl}%
    \def\@Glsxtr{\@glsxtr@disabledflycommand\Glsxtr}%
    \def\@Glsxtrpl{\@glsxtr@disabledflycommand\Glsxtrpl}%
  }
%    \end{macrocode}
%
%\begin{macro}{\@glsxtr@disabledflycommand}
%    \begin{macrocode}
  \newcommand*{\@glsxtr@disabledflycommand}[1]{%
    \PackageError{glossaries-extra}%
    {\string##1\space can't be used after any of the \MessageBreak
     glossaries have been displayed}%
    {The on-the-fly commands enabled by 
     \string\GlsXtrEnableOnTheFly\space may only be used \MessageBreak
     before the glossaries. If you want to use any entries \MessageBreak
     after any of the glossaries, you must use the standard \MessageBreak
     method of first defining the entry and then using the \MessageBreak
     entry with commands like \string\gls}%
     \@@glsxtr@disabledflycommand
  }%
  \newcommand*{\@@glsxtr@disabledflycommand}[2][]{##2}
%    \end{macrocode}
%\end{macro}
%
% End of \cs{GlsXtrEnableOnTheFly}. Disable since it can only
% be used once.
%    \begin{macrocode}
  \let\GlsXtrEnableOnTheFly\relax
}
\@onlypreamble\GlsXtrEnableOnTheFly
%    \end{macrocode}
%
%\subsection{Existing Glossary Style Modifications}
%
% Modify \cs{setglossarystyle} to keep track of the current style.
% This allows the \cs{glossaries-extra-stylemods} package to reset the
% current style after the required modifications have been made.
%\begin{macro}{\@glsxtr@current@style}
%\changes{1.02}{2016-04-25}{new}
% Initialise the current style to the default style.
%    \begin{macrocode}
\newcommand*{\@glsxtr@current@style}{\@glossary@default@style}
%    \end{macrocode}
%\end{macro}
%
% Modify \cs{setglossarystyle} to set \cs{@glsxtr@current@style}.
%\begin{macro}{\setglossarystyle}
%    \begin{macrocode}
\renewcommand*{\setglossarystyle}[1]{%
  \ifcsundef{@glsstyle@#1}%
  {%
    \PackageError{glossaries-extra}{Glossary style `#1' undefined}{}%
  }%
  {%
    \csname @glsstyle@#1\endcsname
%    \end{macrocode}
% Only set the current style if it exists.
%    \begin{macrocode}
    \protected@edef\@glsxtr@current@style{#1}%
  }%
  \ifx\@glossary@default@style\relax
    \protected@edef\@glossary@default@style{#1}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
% In case we have an old version of \styfmt{glossaries}:
%    \begin{macrocode}
\ifdef\@glossary@default@style
{}
{%
  \let\@glossary@default@style\relax
}
%    \end{macrocode}
%
%\begin{macro}{\glslistdottedwidth}
%If \cs{glslistdottedwidth} has been defined and is currently equal
%to \verb|.5\hsize| then make the modification suggested in 
%\href{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=92}{bug report \#92}
%    \begin{macrocode}
\ifdef\glslistdottedwidth
{%
  \ifdim\glslistdottedwidth=.5\hsize
    \setlength{\glslistdottedwidth}{-\dimexpr\maxdimen-1sp\relax}
    \AtBeginDocument{%
      \ifdim\glslistdottedwidth=-\dimexpr\maxdimen-1sp\relax
       \setlength{\glslistdottedwidth}{.5\columnwidth}%
      \fi
    }%
  \fi
}
{}%
%    \end{macrocode}
%\end{macro}
%
%Similarly for \cs{glsdescwidth}:
%\begin{macro}{\glsdescwidth}
%\changes{0.5.3}{2015-12-09}{added}
%    \begin{macrocode}
\ifdef\glsdescwidth
{%
  \ifdim\glsdescwidth=.6\hsize
    \setlength{\glsdescwidth}{-\dimexpr\maxdimen-1sp\relax}
    \AtBeginDocument{%
      \ifdim\glsdescwidth=-\dimexpr\maxdimen-1sp\relax
       \setlength{\glsdescwidth}{.6\columnwidth}%
      \fi
    }%
  \fi
}
{}%
%    \end{macrocode}
%\end{macro}
%and for \cs{glspagelistwidth}:
%\begin{macro}{\glspagelistwidth}
%\changes{0.5.3}{2015-12-09}{added}
%    \begin{macrocode}
\ifdef\glspagelistwidth
{%
  \ifdim\glspagelistwidth=.1\hsize
    \setlength{\glspagelistwidth}{-\dimexpr\maxdimen-1sp\relax}
    \AtBeginDocument{%
      \ifdim\glspagelistwidth=-\dimexpr\maxdimen-1sp\relax
       \setlength{\glspagelistwidth}{.1\columnwidth}%
      \fi
    }%
  \fi
}
{}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glossaryentrynumbers}
% Has the \pkgopt{nonumberlist} option been used?
%\changes{0.5.2}{2015-12-08}{added}
%    \begin{macrocode}
\def\org@glossaryentrynumbers#1{#1\gls@save@numberlist{#1}}%
\ifx\org@glossaryentrynumbers\glossaryentrynumbers
  \glsnonumberlistfalse
  \renewcommand*{\glossaryentrynumbers}[1]{%
    \ifglsentryexists{\glscurrententrylabel}%
    {%
      \@glsxtrpreloctag
      \GlsXtrFormatLocationList{#1}%
      \@glsxtrpostloctag
      \gls@save@numberlist{#1}%
    }{}%
  }%
\else
  \glsnonumberlisttrue
  \renewcommand*{\glossaryentrynumbers}[1]{%
    \ifglsentryexists{\glscurrententrylabel}%
    {%
      \gls@save@numberlist{#1}%
    }{}%
  }%
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrFormatLocationList}
%\changes{0.5.2}{2015-12-08}{new}
% Provide an easy interface to change the format of the location
% list without removing the save number list stuff.
%    \begin{macrocode}
\newcommand*{\GlsXtrFormatLocationList}[1]{#1}
%    \end{macrocode}
%\end{macro}
%
% Sometimes users want to prefix the location list with
% \qt{page}\slash\qt{pages}. The simplest way to determine if the
% location list consists of a single location is to check for
% instances of \cs{delimN} or \cs{delimR}, but this isn't so easy to
% do as they might be embedded inside the argument of formatting
% commands. With a bit of trickery we can find out by adjusting
% \cs{delimN} and \cs{delimR} to set a flag and then save
% information to the auxiliary file for the next run.
%\begin{macro}{\GlsXtrEnablePreLocationTag}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newcommand*{\GlsXtrEnablePreLocationTag}[2]{%
  \let\@glsxtrpreloctag\@@glsxtrpreloctag
  \let\@glsxtrpostloctag\@@glsxtrpostloctag
  \renewcommand*{\@glsxtr@pagetag}{#1}%
  \renewcommand*{\@glsxtr@pagestag}{#2}%
  \renewcommand*{\@glsxtr@savepreloctag}[2]{%
    \csgdef{@glsxtr@preloctag@##1}{##2}%
  }%
  \renewcommand*{\@glsxtr@doloctag}{%
    \ifcsundef{@glsxtr@preloctag@\glscurrententrylabel}%
    {%
      \GlossariesWarning{Missing pre-location tag for `\glscurrententrylabel'.
        Rerun required}%
    }%
    {%
      \csuse{@glsxtr@preloctag@\glscurrententrylabel}%
    }%
  }%
}
\@onlypreamble\GlsXtrEnablePreLocationTag
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glsxtrpreloctag}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newcommand*{\@@glsxtrpreloctag}{%
   \let\@glsxtr@org@delimN\delimN
   \let\@glsxtr@org@delimR\delimR
   \let\@glsxtr@org@glsignore\glsignore
%    \end{macrocode}
% \cs{gdef} is required as the delimiters may occur inside a scope.
%    \begin{macrocode}
   \gdef\@glsxtr@thisloctag{\@glsxtr@pagetag}%
   \renewcommand*{\delimN}{%
     \gdef\@glsxtr@thisloctag{\@glsxtr@pagestag}%
     \@glsxtr@org@delimN}%
   \renewcommand*{\delimR}{%
     \gdef\@glsxtr@thisloctag{\@glsxtr@pagestag}%
     \@glsxtr@org@delimR}%
   \renewcommand*{\glsignore}[1]{%
     \gdef\@glsxtr@thisloctag{\relax}%
     \@glsxtr@org@glsignore{##1}}%
   \@glsxtr@doloctag
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glsxtrpreloctag}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtrpreloctag}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@pagetag}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@pagetag}{}%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glsxtr@pagestag}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@pagestag}{}%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@@glsxtrpostloctag}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newcommand*{\@@glsxtrpostloctag}{%
   \let\delimN\@glsxtr@org@delimN
   \let\delimR\@glsxtr@org@delimR
   \let\glsignore\@glsxtr@org@glsignore
   \protected@write\@auxout{}%
    {\string\@glsxtr@savepreloctag{\glscurrententrylabel}{\@glsxtr@thisloctag}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glsxtrpostloctag}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtrpostloctag}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@preloctag}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@savepreloctag}[2]{}
\protected@write\@auxout{}{%
  \string\providecommand\string\@glsxtr@savepreloctag[2]{}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@doloctag}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@doloctag}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\KV@printgloss@nonumberlist}
% Modify the \gloskey[printglossary]{nonumberlist} key to
% use \cs{GlsXtrFormatLocationList} (and also save the number list):
%\changes{0.5.2}{2015-12-08}{added}
%    \begin{macrocode}
\renewcommand*{\KV@printgloss@nonumberlist}[1]{%
 \XKV@plfalse
 \XKV@sttrue
 \XKV@checkchoice[\XKV@resa]{#1}{true,false}%
 {%
   \csname glsnonumberlist\XKV@resa\endcsname
   \ifglsnonumberlist
     \def\glossaryentrynumbers##1{\gls@save@numberlist{##1}}%
   \else
     \def\glossaryentrynumbers##1{%
       \@glsxtrpreloctag
       \GlsXtrFormatLocationList{##1}%
       \@glsxtrpostloctag
       \gls@save@numberlist{##1}}%
   \fi
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\subsection{Entry Formatting, Hyperlinks and Indexing}
%
%\begin{macro}{\glsentryfmt}
% Change default entry format. Use the generic format for regular
% terms (that is, entries that have a category with the \catattr{regular}
% attribute set) or non-regular terms without a short value and use the abbreviation format for non-regular
% terms that have a short value. If further attributes need to be checked, then
% \cs{glsentryfmt} will need redefining as appropriate (or use
% \cs{defglsentryfmt}).
%\changes{0.3}{2015-12-02}{added check for short}
% The abbreviation format is set here for entries that have a short
% form, even if they are regular entries to ensure the abbreviation
% fonts are correct.
%\changes{0.5.2}{2015-12-08}{moved \cs{glssetabbrvfmt} from
%\cs{glsxtrabbrvfmt} to here}
%    \begin{macrocode}
\renewcommand*{\glsentryfmt}{%
  \ifglshasshort{\glslabel}{\glssetabbrvfmt{\glscategory{\glslabel}}}{}%
  \glsifregular{\glslabel}%
  {\glsxtrregularfont{\glsgenentryfmt}}%
  {%
    \ifglshasshort{\glslabel}%
    {\glsxtrabbreviationfont{\glsxtrgenabbrvfmt}}%
    {\glsxtrregularfont{\glsgenentryfmt}}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrregularfont}
%\changes{1.04}{2016-05-02}{new}
% Font used for regular entries.
%    \begin{macrocode}
\newcommand*{\glsxtrregularfont}[1]{#1}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrabbreviationfont}
%\changes{1.30}{2018-04-25}{new}
% Font used for abbreviation entries.
%    \begin{macrocode}
\newcommand*{\glsxtrabbreviationfont}[1]{#1}
%    \end{macrocode}
%\end{macro}
%
% Commands like \cs{glsifplural} are only used by the \cs{gls}-like
% commands in the \styfmt{glossaries} package, but it might be useful
% for the postlink hook to know if the user has used, say,
% \cs{glsfirst} or \cs{glsplural}. This can provide better
% consistency with the formatting of the \cs{gls}-like commands,
% even though they don't use \cs{glsentryfmt}.
%
%\begin{macro}{\@gls@field@link}
% Redefine \cs{@gls@field@link} so that commands like \cs{glsfirst}
% can setup \cs{glsxtrifwasfirstuse} etc to allow the postlink hook
% to work better. This now has an optional argument that sets up the
% defaults.
%\changes{0.3}{2015-12-02}{added optional argument}
%    \begin{macrocode}
\renewcommand{\@gls@field@link}[4][]{%
%    \end{macrocode}
%If the \pkgopt{record} option has been used, the information needs
%to be written to the aux file regardless of whether the entry
%exists (unless indexing has been switched off).
%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}}
%    \begin{macrocode}
  \@glsxtr@record{#2}{#3}{glslink}%
  \glsdoifexists{#3}%
  {%
%    \end{macrocode}
%Save and restore the hyper setting (\cs{@gls@link} also does this,
%but that's too late if the optional argument of \cs{@gls@field@link}
%modifies it).
%    \begin{macrocode}
    \let\glsxtrorg@ifKV@glslink@hyper\ifKV@glslink@hyper
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \def\glscustomtext{#4}%
    \@glsxtr@field@linkdefs
    #1%
    \@gls@link[#2]{#3}{#4}%
    \let\ifKV@glslink@hyper\glsxtrorg@ifKV@glslink@hyper
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%The commands \cs{gls}, \cs{Gls} etc don't use \cs{@gls@field@link},
%so they need modifying as well to use \cs{@glsxtr@record}.
%
%\begin{macro}{\@gls@}
%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}}
%Save the original definition and redefine.
%    \begin{macrocode}
\let\@glsxtr@org@gls@\@gls@
\def\@gls@#1#2{%
  \@glsxtr@record{#1}{#2}{glslink}%
  \@glsxtr@org@gls@{#1}{#2}%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glspl@}
%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}}
%Save the original definition and redefine.
%    \begin{macrocode}
\let\@glsxtr@org@glspl@\@glspl@
\def\@glspl@#1#2{%
  \@glsxtr@record{#1}{#2}{glslink}%
  \@glsxtr@org@glspl@{#1}{#2}%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Gls@}
%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}}
%Save the original definition and redefine.
%    \begin{macrocode}
\let\@glsxtr@org@Gls@\@Gls@
\def\@Gls@#1#2{%
  \@glsxtr@record{#1}{#2}{glslink}%
  \@glsxtr@org@Gls@{#1}{#2}%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glspl@}
%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}}
%Save the original definition and redefine.
%    \begin{macrocode}
\let\@glsxtr@org@Glspl@\@Glspl@
\def\@Glspl@#1#2{%
  \@glsxtr@record{#1}{#2}{glslink}%
  \@glsxtr@org@Glspl@{#1}{#2}%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLS@}
%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}}
%Save the original definition and redefine.
%    \begin{macrocode}
\let\@glsxtr@org@GLS@\@GLS@
\def\@GLS@#1#2{%
  \@glsxtr@record{#1}{#2}{glslink}%
  \@glsxtr@org@GLS@{#1}{#2}%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSpl@}
%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}}
%\changes{1.10}{2016-12-17}{fixed bug caused by typo in command name}
%Save the original definition and redefine.
%    \begin{macrocode}
\let\@glsxtr@org@GLSpl@\@GLSpl@
\def\@GLSpl@#1#2{%
  \@glsxtr@record{#1}{#2}{glslink}%
  \@glsxtr@org@GLSpl@{#1}{#2}%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsdisp}
%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}}
%\changes{1.13}{2017-02-07}{removed \cs{@glsxtr@org@glsdisp}}
%This is redefined to allow the recording on the first run.
%Can't save and restore \cs{@glsdisp} since it has an optional
%argument.
%    \begin{macrocode}
\renewcommand*{\@glsdisp}[3][]{%
  \@glsxtr@record{#1}{#2}{glslink}%
  \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
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@@link@}
%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}}
%Redefine to include \cs{@glsxtr@record}
%    \begin{macrocode}
\renewcommand*{\@gls@@link}[3][]{%
  \@glsxtr@record{#1}{#2}{glslink}%
  \glsdoifexistsordo{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\relax
    \@gls@link[#1]{#2}{#3}%
  }%
  {%
    \glstextformat{#3}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrinitwrgloss}
%\changes{1.14}{2017-04-18}{new}
%Set the default if the \gloskey[glslink]{wrgloss} is omitted.
%    \begin{macrocode}
\newcommand*{\glsxtrinitwrgloss}{%
 \glsifattribute{\glslabel}{wrgloss}{after}%
 {%
   \glsxtrinitwrglossbeforefalse
 }%
 {%
   \glsxtrinitwrglossbeforetrue
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ifglsxtrwrglossbefore}
%\changes{1.14}{2017-04-18}{new}
%Conditional to determine if the indexing should be done before the
%link text.
%    \begin{macrocode}
\newif\ifglsxtrinitwrglossbefore
\glsxtrinitwrglossbeforetrue
%    \end{macrocode}
%\end{macro}
%
% Define a \gloskey[glslink]{wrgloss} key to determine whether to
% write the glossary information before or after the link text.
%    \begin{macrocode}
\define@choicekey{glslink}{wrgloss}%
[\@glsxtr@wrglossval\@glsxtr@wrglossnr]%
{before,after}%
{%
  \ifcase\@glsxtr@wrglossnr\relax
    \glsxtrinitwrglossbeforetrue
  \or
    \glsxtrinitwrglossbeforefalse
  \fi
}
%    \end{macrocode}
%\changes{1.19}{2017-09-09}{added \cs{glslink} option \texttt{thevalue}}
%    \begin{macrocode}
\define@key{glslink}{thevalue}{\def\@glsxtr@thevalue{#1}}
%    \end{macrocode}
%
%\changes{1.19}{2017-09-09}{added \cs{glslink} option \texttt{theHvalue}}
%    \begin{macrocode}
\define@key{glslink}{theHvalue}{\def\@glsxtr@theHvalue{#1}}
%    \end{macrocode}
%
%\begin{macro}{\ifglsxtr@hyperoutside}
%\changes{1.21}{2017-11-03}{new}
% Define a \gloskey[glslink]{hyperoutside} key to determine whether 
% \cs{hyperlink} should be outside \cs{glstextformat}.
%    \begin{macrocode}
\define@boolkey{glslink}[glsxtr@]{hyperoutside}[true]{}
\glsxtr@hyperoutsidetrue
%    \end{macrocode}
%
%\end{macro}
%
%\begin{macro}{\@glsxtr@local@textformat}
%\changes{1.30}{2018-04-25}{new}
%Provide a key to locally change the text format.
%    \begin{macrocode}
\define@key{glslink}{textformat}{%
  \ifcsdef{#1}
  {%
    \letcs{\@glsxtr@local@textformat}{#1}%
  }%
  {%
    \PackageError{glossaries-extra}{Unknown control sequence name `#1'}{}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\changes{1.31}{2018-05-09}{added \texttt{prefix} key for \texttt{glslink}}
%    \begin{macrocode}
\define@key{glslink}{prefix}{\def\glolinkprefix{#1}}
%    \end{macrocode}
%
%\begin{macro}{\glsxtrinithyperoutside}
%\changes{1.21}{2017-11-03}{new}
%Set the default if the \gloskey[glslink]{hyperoutside} is omitted.
%    \begin{macrocode}
\newcommand*{\glsxtrinithyperoutside}{%
 \glsifattribute{\glslabel}{hyperoutside}{false}%
 {%
   \glsxtr@hyperoutsidefalse
 }%
 {%
   \glsxtr@hyperoutsidetrue
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@inc@linkcount}
%\changes{1.26}{2018-01-05}{new}
%Does nothing by default.
%    \begin{macrocode}
\newcommand*{\glsxtr@inc@linkcount}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glslinkpresetkeys}
%\changes{1.26}{2018-01-05}{new}
%User hook performed immediately before options are set. 
%Does nothing by default.
%    \begin{macrocode}
\newcommand*{\glslinkpresetkeys}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrExpandedFmt}
%\changes{1.30}{2018-04-25}{new}
%Helper command that (protected) fully expands second argument and
%then applies it to the first, which must be a command that takes a
%single argument.
%    \begin{macrocode}
\newrobustcmd*{\GlsXtrExpandedFmt}[2]{%
  \protected@edef\@glsxtr@tmp{#2}%
  \expandafter#1\expandafter{\@glsxtr@tmp}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@link}
%\changes{1.14}{2017-04-18}{added redefinition}
%Redefine to allow the indexing to be placed after the link text. By
%default this is done before the link text to prevent problems that
%can occur from the whatsit, but there may be times when the user
%would like the indexing done afterwards even though it causes a
%whatsit.
%    \begin{macrocode}
\def\@gls@link[#1]#2#3{%
  \leavevmode
  \edef\glslabel{\glsdetoklabel{#2}}%
  \def\@gls@link@opts{#1}%
  \let\@gls@link@label\glslabel
  \let\@glsnumberformat\@glsxtr@defaultnumberformat
  \edef\@gls@counter{\csname glo@\glslabel @counter\endcsname}%
  \edef\glstype{\csname glo@\glslabel @type\endcsname}%
  \let\org@ifKV@glslink@hyper\ifKV@glslink@hyper
%    \end{macrocode}
%Save current value of \cs{glolinkprefix}:
%    \begin{macrocode}
  \let\@glsxtr@org@glolinkprefix\glolinkprefix
%    \end{macrocode}
%Initialise \cs{@glsxtr@local@textformat}
%    \begin{macrocode}
  \let\@glsxtr@local@textformat\relax
%    \end{macrocode}
% Initialise thevalue and theHvalue (v1.19).
%    \begin{macrocode}
  \def\@glsxtr@thevalue{}%
  \def\@glsxtr@theHvalue{\@glsxtr@thevalue}%
%    \end{macrocode}
% Initialise when indexing should occur (new to v1.14).
%    \begin{macrocode}
  \glsxtrinitwrgloss
%    \end{macrocode}
% Initialise whether \cs{hyperlink} should be outside \cs{glstextformat}
% (new to v1.21).
%    \begin{macrocode}
  \glsxtrinithyperoutside
%    \end{macrocode}
% Note that the default link options may
% override \cs{glsxtrinitwrgloss}.
%    \begin{macrocode}
  \@gls@setdefault@glslink@opts
%    \end{macrocode}
%Increment link counter if enabled (new to v1.26).
%    \begin{macrocode}
  \glsxtr@inc@linkcount
%    \end{macrocode}
% As the original definition.
%    \begin{macrocode}
  \do@glsdisablehyperinlist
  \do@gls@link@checkfirsthyper
%    \end{macrocode}
%User hook before options are set (new to v1.26):
%    \begin{macrocode}
  \glslinkpresetkeys
%    \end{macrocode}
%Set options.
%    \begin{macrocode}
  \setkeys{glslink}{#1}%
%    \end{macrocode}
%User hook after options are set:
%    \begin{macrocode}
  \glslinkpostsetkeys
%    \end{macrocode}
% Check \gloskey[glslink]{thevalue} and \gloskey[glslink]{theHvalue}
% before saving (v1.19).
%    \begin{macrocode}
  \ifdefempty{\@glsxtr@thevalue}%
  {%
    \@gls@saveentrycounter
  }%
  {%
    \let\theglsentrycounter\@glsxtr@thevalue
    \def\theHglsentrycounter{\@glsxtr@theHvalue}%
  }%
  \@gls@setsort{\glslabel}%
%    \end{macrocode}
%Check if the \gloskey[glslink]{textformat} key has been used.
%    \begin{macrocode}
  \ifx\@glsxtr@local@textformat\relax
%    \end{macrocode}
% Check \catattr{textformat} attribute (new to v1.21).
%    \begin{macrocode}
     \glshasattribute{\glslabel}{textformat}%
     {%
       \edef\@glsxtr@attrval{\glsgetattribute{\glslabel}{textformat}}%
       \ifcsdef{\@glsxtr@attrval}%
       {%
         \letcs{\@glsxtr@textformat}{\@glsxtr@attrval}%
       }%
       {%
         \GlossariesExtraWarning{Unknown control sequence name 
         `\@glsxtr@attrval' supplied in textformat attribute
         for entry `\glslabel'. Reverting to default \string\glstextformat}%
         \let\@glsxtr@textformat\glstextformat
       }%
     }%
     {%
       \let\@glsxtr@textformat\glstextformat
     }%
  \else
     \let\@glsxtr@textformat\@glsxtr@local@textformat
  \fi
%    \end{macrocode}
% Do write if it should occur before the link text:
%    \begin{macrocode}
  \ifglsxtrinitwrglossbefore
    \@do@wrglossary{#2}%
  \fi
%    \end{macrocode}
% Do the link text:
%    \begin{macrocode}
  \ifKV@glslink@hyper
    \ifglsxtr@hyperoutside
      \@glslink{\glolinkprefix\glslabel}{\@glsxtr@textformat{#3}}%
    \else
      \@glsxtr@textformat{\@glslink{\glolinkprefix\glslabel}{#3}}%
    \fi
  \else
    \ifglsxtr@hyperoutside
      \glsdonohyperlink{\glolinkprefix\glslabel}{\@glsxtr@textformat{#3}}%
    \else
      \@glsxtr@textformat{\glsdonohyperlink{\glolinkprefix\glslabel}{#3}}%
    \fi
  \fi
%    \end{macrocode}
% Do write if it should occur after the link text:
%    \begin{macrocode}
  \ifglsxtrinitwrglossbefore
  \else
    \@do@wrglossary{#2}%
  \fi
%    \end{macrocode}
%Restore original value of \cs{glolinkprefix}:
%    \begin{macrocode}
  \let\glolinkprefix\@glsxtr@org@glolinkprefix
%    \end{macrocode}
% As the original definition:
%    \begin{macrocode}
  \let\ifKV@glslink@hyper\org@ifKV@glslink@hyper
}
%    \end{macrocode}
%\end{macro}
%
%\changes{1.14}{2017-04-18}{added \cs{glsadd} option \texttt{thevalue}}
%    \begin{macrocode}
\define@key{glossadd}{thevalue}{\def\@glsxtr@thevalue{#1}}
%    \end{macrocode}
%
%\changes{1.14}{2017-04-18}{added \cs{glsadd} option \texttt{theHvalue}}
%    \begin{macrocode}
\define@key{glossadd}{theHvalue}{\def\@glsxtr@theHvalue{#1}}
%    \end{macrocode}
%
%\begin{macro}{\glsaddpresetkeys}
%\changes{1.30}{2018-04-25}{new}
%    \begin{macrocode}
\newcommand*{\glsaddpresetkeys}{}
%    \end{macrocode}
%\end{macro}

%\begin{macro}{\glsaddpostsetkeys}
%\changes{1.30}{2018-04-25}{new}
%    \begin{macrocode}
\newcommand*{\glsaddpostsetkeys}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsadd}
%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}}
%Redefine to include \cs{@glsxtr@record} and suppress in headings
%    \begin{macrocode}
\renewrobustcmd*{\glsadd}[2][]{%
  \glsxtrifinmark
  {}%
  {%
    \@gls@adjustmode
    \@glsxtr@record{#1}{#2}{glossadd}%
    \glsdoifexists{#2}%
    {%
      \let\@glsnumberformat\@glsxtr@defaultnumberformat
      \edef\@gls@counter{\csname glo@\glsdetoklabel{#2}@counter\endcsname}%
      \def\@glsxtr@thevalue{}%
      \def\@glsxtr@theHvalue{\@glsxtr@thevalue}%
%    \end{macrocode}
%Implement any default settings (before options are set)
%\changes{1.30}{2018-04-25}{added \cs{glsaddpresetkeys}}
%    \begin{macrocode}
      \glsaddpresetkeys
      \setkeys{glossadd}{#1}%
%    \end{macrocode}
%Implement any default settings (after options are set)
%\changes{1.30}{2018-04-25}{added \cs{glsaddpostsetkeys}}
%    \begin{macrocode}
      \glsaddpostsetkeys
      \ifdefempty{\@glsxtr@thevalue}%
      {%
        \@gls@saveentrycounter
      }%
      {%
        \let\theglsentrycounter\@glsxtr@thevalue
        \def\theHglsentrycounter{\@glsxtr@theHvalue}%
      }%
%    \end{macrocode}
% Define sort key if necessary (in case of \pkgopt[use]{sort}):
%\changes{1.24}{2017-11-14}{added \cs{@gls@setsort}}
%    \begin{macrocode}
      \@gls@setsort{#2}%
      \@@do@wrglossary{#2}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaddeach}
%\changes{1.31}{2018-05-09}{new}
%Performs \cs{glsadd} for each entry listed in the mandatory
%argument.
%    \begin{macrocode}
\newrobustcmd{\glsaddeach}[2][]{%
  \@for\@gls@thislabel:=#2\do{\glsadd[#1]{\@gls@thislabel}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@field@linkdefs}
% Default settings for \cs{@gls@field@link}
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@field@linkdefs}{%
  \let\glsxtrifwasfirstuse\@secondoftwo
  \let\glsifplural\@secondoftwo
  \let\glscapscase\@firstofthree
  \let\glsinsert\@empty
}
%    \end{macrocode}
%\end{macro}
%
%Redefine the field link commands that need to modify the above.
%Also add accessibility support and set the abbreviation styles if
%required.
%\begin{macro}{\glsxtrassignfieldfont}
%\changes{1.04}{2016-05-02}{new}
%\changes{1.08}{2016-12-13}{added check for existence}
%    \begin{macrocode}
\newcommand*{\glsxtrassignfieldfont}[1]{%
  \ifglsentryexists{#1}%
  {%
    \ifglshasshort{#1}%
    {%
      \glssetabbrvfmt{\glscategory{#1}}%
      \glsifregular{#1}%
      {\let\@gls@field@font\glsxtrregularfont}%
      {\let\@gls@field@font\@firstofone}%
    }%
    {%
      \glsifnotregular{#1}%
      {\let\@gls@field@font\@firstofone}%
      {\let\@gls@field@font\glsxtrregularfont}%
    }%
  }%
  {%
    \let\@gls@field@font\@gobble
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glstext@}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
%\changes{1.04}{2016-05-02}{set abbreviation and regular format}
% The abbreviation format may also need setting.
%    \begin{macrocode}
\def\@glstext@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link{#1}{#2}{\@gls@field@font{\glsaccesstext{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLStext@}
% All uppercase version of \cs{glstext}.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.04}{2016-05-02}{set abbreviation and regular format}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
% The abbreviation format may also need setting.
%    \begin{macrocode}
\def\@GLStext@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link[\let\glscapscase\@thirdofthree]{#1}{#2}%
    {\@gls@field@font{\GLSaccesstext{#2}\mfirstucMakeUppercase{#3}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glstext@}
% First letter uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.04}{2016-05-02}{set abbreviation and regular format}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
% The abbreviation format may also need setting.
%    \begin{macrocode}
\def\@Glstext@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link[\let\glscapscase\@secondofthree]{#1}{#2}%
    {\@gls@field@font{\Glsaccesstext{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%Version 1.07 ensures that \cs{glsfirst} etc honours the
%\catattr{nohyperfirst} attribute. Allow a convenient way for the
%user to revert to ignoring this attribute for these commands.
%\begin{macro}{\glsxtrchecknohyperfirst}
%\changes{1.07}{2016-08-15}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrchecknohyperfirst}[1]{%
  \glsifattribute{#1}{nohyperfirst}{true}{\KV@glslink@hyperfalse}{}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsfirst@}
% No case changing version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.04}{2016-05-02}{set abbreviation and regular format}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
% The abbreviation format may also need setting.
%    \begin{macrocode}
\def\@glsfirst@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
%    \end{macrocode}
% Ensure that \cs{glsfirst} honours the \catattr{nohyperfirst} attribute.
%\changes{1.07}{2016-08-15}{added check for nohyperfirst attribute}
%    \begin{macrocode}
  \@gls@field@link
  [\let\glsxtrifwasfirstuse\@firstoftwo
   \glsxtrchecknohyperfirst{#2}%
  ]{#1}{#2}%
  {\@gls@field@font{\glsaccessfirst{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsfirst@}
% First letter uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.04}{2016-05-02}{set abbreviation and regular format}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
% The abbreviation format may also need setting.
%    \begin{macrocode}
\def\@Glsfirst@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
%    \end{macrocode}
% Ensure that \cs{Glsfirst} honours the \catattr{nohyperfirst} attribute.
%\changes{1.07}{2016-08-15}{added check for nohyperfirst attribute}
%    \begin{macrocode}
  \@gls@field@link
  [\let\glsxtrifwasfirstuse\@firstoftwo
   \let\glscapscase\@secondofthree
   \glsxtrchecknohyperfirst{#2}%
  ]%
   {#1}{#2}{\@gls@field@font{\Glsaccessfirst{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSfirst@}
% All uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.04}{2016-05-02}{set abbreviation format}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
% The abbreviation format may also need setting.
%    \begin{macrocode}
\def\@GLSfirst@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
%    \end{macrocode}
% Ensure that \cs{GLSfirst} honours the \catattr{nohyperfirst} attribute.
%\changes{1.07}{2016-08-15}{added check for nohyperfirst attribute}
%    \begin{macrocode}
  \@gls@field@link
  [\let\glsxtrifwasfirstuse\@firstoftwo
   \let\glscapscase\@thirdofthree
   \glsxtrchecknohyperfirst{#2}%
  ]%
   {#1}{#2}{\@gls@field@font{\GLSaccessfirst{#2}\mfirstucMakeUppercase{#3}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsplural@}
% No case changing version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.03}{2016-04-27}{fixed bug \cs{@glsplural@} should be redefined
%not \cs{@glsplural}}
%\changes{1.04}{2016-05-02}{set abbreviation and regular format}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
% The abbreviation format may also need setting.
%    \begin{macrocode}
\def\@glsplural@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link[\let\glsifplural\@firstoftwo]{#1}{#2}%
    {\@gls@field@font{\glsaccessplural{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsplural@}
% First letter uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.03}{2016-04-27}{fixed bug \cs{@Glsplural@} should be redefined
%not \cs{@Glsplural}}
%\changes{1.04}{2016-05-02}{set abbreviation and regular format}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
% The abbreviation format may also need setting.
%    \begin{macrocode}
\def\@Glsplural@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link
  [\let\glsifplural\@firstoftwo
   \let\glscapscase\@secondofthree
  ]%
    {#1}{#2}{\@gls@field@font{\Glsaccessplural{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSplural@}
% All uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.03}{2016-04-27}{fixed bug \cs{@GLSplural@} should be redefined
%not \cs{@GLSplural}}
%\changes{1.04}{2016-05-02}{set abbreviation and regular format}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
% The abbreviation format may also need setting.
%    \begin{macrocode}
\def\@GLSplural@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link
  [\let\glsifplural\@firstoftwo
   \let\glscapscase\@thirdofthree
  ]%
    {#1}{#2}{\@gls@field@font{\GLSaccessplural{#2}\mfirstucMakeUppercase{#3}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsfirstplural@}
% No case changing version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.04}{2016-05-02}{set abbreviation and regular format}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
% The abbreviation format may also need setting.
%    \begin{macrocode}
\def\@glsfirstplural@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
%    \end{macrocode}
% Ensure that \cs{glsfirstplural} honours the \catattr{nohyperfirst} attribute.
%\changes{1.07}{2016-08-15}{added check for nohyperfirst attribute}
%    \begin{macrocode}
  \@gls@field@link
  [\let\glsxtrifwasfirstuse\@firstoftwo
   \let\glsifplural\@firstoftwo
   \glsxtrchecknohyperfirst{#2}%
  ]%
   {#1}{#2}{\@gls@field@font{\glsaccessfirstplural{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsfirstplural@}
% First letter uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.03}{2016-04-27}{bug fix: misspelt cs name}
%\changes{1.04}{2016-05-02}{set abbreviation and regular format}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
% The abbreviation format may also need setting.
%    \begin{macrocode}
\def\@Glsfirstplural@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
%    \end{macrocode}
% Ensure that \cs{glsfirstplural} honours the \catattr{nohyperfirst} attribute.
%\changes{1.07}{2016-08-15}{added check for nohyperfirst attribute}
%    \begin{macrocode}
  \@gls@field@link
  [\let\glsxtrifwasfirstuse\@firstoftwo
   \let\glsifplural\@firstoftwo
   \let\glscapscase\@secondofthree
   \glsxtrchecknohyperfirst{#2}%
  ]%
   {#1}{#2}{\@gls@field@font{\Glsaccessfirstplural{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSfirstplural@}
% All uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.03}{2016-04-27}{bug fix: misspelt cs name}
%\changes{1.04}{2016-05-02}{set abbreviation and regular format}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
% The abbreviation format may also need setting.
%    \begin{macrocode}
\def\@GLSfirstplural@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
%    \end{macrocode}
% Ensure that \cs{glsfirstplural} honours the \catattr{nohyperfirst} attribute.
%\changes{1.07}{2016-08-15}{added check for nohyperfirst attribute}
%    \begin{macrocode}
  \@gls@field@link
  [\let\glsxtrifwasfirstuse\@firstoftwo
   \let\glsifplural\@firstoftwo
   \let\glscapscase\@thirdofthree
   \glsxtrchecknohyperfirst{#2}%
  ]%
   {#1}{#2}%
   {\@gls@field@font{\GLSaccessfirstplural{#2}\mfirstucMakeUppercase{#3}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsname@}
% Redefine to use accessibility support.
%\changes{0.5.2}{2015-12-08}{added accessibility support}
%\changes{1.04}{2016-05-02}{set abbreviation and regular format}
% The abbreviation format may also need setting.
%    \begin{macrocode}
\def\@glsname@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link{#1}{#2}{\@gls@field@font{\glsaccessname{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsname@}
% First letter uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.04}{2016-05-02}{set abbreviation and regular format}
%\changes{0.5.2}{2015-12-08}{add accessibility support}
% The abbreviation format may also need setting.
%    \begin{macrocode}
\def\@Glsname@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link
  [\let\glscapscase\@secondoftwo]{#1}{#2}%
  {\@gls@field@font{\Glsaccessname{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSname@}
% All uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.04}{2016-05-02}{set abbreviation and regular format}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
% The abbreviation format may also need setting.
%    \begin{macrocode}
\def\@GLSname@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link[\let\glscapscase\@thirdoftwo]%
    {#1}{#2}%
    {\@gls@field@font{\GLSaccessname{#2}\mfirstucMakeUppercase{#3}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsdesc@}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
%\changes{1.04}{2016-05-02}{set abbreviation and regular format}
%    \begin{macrocode}
\def\@glsdesc@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link{#1}{#2}{\@gls@field@font{\glsaccessdesc{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsdesc@}
% First letter uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
%\changes{1.04}{2016-05-02}{set abbreviation and regular format}
%    \begin{macrocode}
\def\@Glsdesc@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link
  [\let\glscapscase\@secondoftwo]{#1}{#2}%
  {\@gls@field@font{\Glsaccessdesc{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSdesc@}
% All uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
%\changes{1.04}{2016-05-02}{set abbreviation and regular format}
%    \begin{macrocode}
\def\@GLSdesc@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link[\let\glscapscase\@thirdoftwo]%
    {#1}{#2}{\@gls@field@font{\GLSaccessdesc{#2}\mfirstucMakeUppercase{#3}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsdescplural@}
% No case-changing version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
%\changes{1.04}{2016-05-02}{set abbreviation and regular format}
%    \begin{macrocode}
\def\@glsdescplural@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link
  [\let\glscapscase\@secondoftwo
   \let\glsifplural\@firstoftwo
  ]{#1}{#2}{\@gls@field@font{\glsaccessdescplural{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsdescplural@}
% First letter uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
%\changes{1.04}{2016-05-02}{set abbreviation and regular format}
%    \begin{macrocode}
\def\@Glsdescplural@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link
  [\let\glscapscase\@secondoftwo
   \let\glsifplural\@firstoftwo
  ]{#1}{#2}{\@gls@field@font{\Glsaccessdescplural{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSdescplural@}
% All uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
%\changes{1.04}{2016-05-02}{set abbreviation and regular format}
%    \begin{macrocode}
\def\@GLSdesc@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link
  [\let\glscapscase\@thirdoftwo
   \let\glsifplural\@firstoftwo
  ]%
    {#1}{#2}%
    {\@gls@field@font{\GLSaccessdescplural{#2}\mfirstucMakeUppercase{#3}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glssymbol@}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
%\changes{1.04}{2016-05-02}{set regular format}
%    \begin{macrocode}
\def\@glssymbol@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link{#1}{#2}{\@gls@field@font{\glsaccesssymbol{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glssymbol@}
% First letter uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
%\changes{1.04}{2016-05-02}{set regular format}
%    \begin{macrocode}
\def\@Glssymbol@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link
  [\let\glscapscase\@secondoftwo]%
   {#1}{#2}{\@gls@field@font{\Glsaccesssymbol{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSsymbol@}
% All uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
%\changes{1.04}{2016-05-02}{set regular format}
%    \begin{macrocode}
\def\@GLSsymbol@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link[\let\glscapscase\@thirdoftwo]%
    {#1}{#2}{\@gls@field@font{\GLSaccesssymbol{#2}\mfirstucMakeUppercase{#3}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glssymbolplural@}
% No case-changing version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
%\changes{1.04}{2016-05-02}{set regular format}
%    \begin{macrocode}
\def\@glssymbolplural@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link
  [\let\glscapscase\@secondoftwo
   \let\glsifplural\@firstoftwo
  ]{#1}{#2}{\@gls@field@font{\glsaccesssymbolplural{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glssymbolplural@}
% First letter uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
%\changes{1.04}{2016-05-02}{set regular format}
%    \begin{macrocode}
\def\@Glssymbolplural@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link
  [\let\glscapscase\@secondoftwo
   \let\glsifplural\@firstoftwo
  ]{#1}{#2}{\@gls@field@font{\Glsaccesssymbolplural{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSsymbolplural@}
% All uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{0.5.2}{2015-12-08}{added accessibility support}
%\changes{1.04}{2016-05-02}{set regular format}
%    \begin{macrocode}
\def\@GLSsymbol@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link
  [\let\glscapscase\@thirdoftwo
   \let\glsifplural\@firstoftwo
  ]%
    {#1}{#2}%
    {\@gls@field@font{\GLSaccesssymbolplural{#2}\mfirstucMakeUppercase{#3}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsuseri@}
% First letter uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.04}{2016-05-02}{set regular format}
%    \begin{macrocode}
\def\@Glsuseri@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link
  [\let\glscapscase\@secondoftwo]{#1}{#2}%
  {\@gls@field@font{\Glsentryuseri{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSuseri@}
% All uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.04}{2016-05-02}{set regular format}
%    \begin{macrocode}
\def\@GLSuseri@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link[\let\glscapscase\@thirdoftwo]%
    {#1}{#2}{\@gls@field@font{\mfirstucMakeUppercase{\glsentryuseri{#2}#3}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsuserii@}
% First letter uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.04}{2016-05-02}{set regular format}
%    \begin{macrocode}
\def\@Glsuserii@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link
  [\let\glscapscase\@secondoftwo]%
   {#1}{#2}{\@gls@field@font{\Glsentryuserii{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSuserii@}
% All uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.04}{2016-05-02}{set regular format}
%    \begin{macrocode}
\def\@GLSuserii@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link[\let\glscapscase\@thirdoftwo]%
    {#1}{#2}{\@gls@field@font{\mfirstucMakeUppercase{\glsentryuserii{#2}#3}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsuseriii@}
% First letter uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.04}{2016-05-02}{set regular format}
%    \begin{macrocode}
\def\@Glsuseriii@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link
  [\let\glscapscase\@secondoftwo]%
   {#1}{#2}{\@gls@field@font{\Glsentryuseriii{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSuseriii@}
% All uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.04}{2016-05-02}{set regular format}
%    \begin{macrocode}
\def\@GLSuseriii@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link[\let\glscapscase\@thirdoftwo]%
    {#1}{#2}{\@gls@field@font{\mfirstucMakeUppercase{\glsentryuseriii{#2}#3}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsuseriv@}
% First letter uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.04}{2016-05-02}{set regular format}
%    \begin{macrocode}
\def\@Glsuseriv@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link
  [\let\glscapscase\@secondoftwo]%
   {#1}{#2}{\@gls@field@font{\Glsentryuseriv{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSuseriv@}
% All uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.04}{2016-05-02}{set regular format}
%    \begin{macrocode}
\def\@GLSuseriv@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link[\let\glscapscase\@thirdoftwo]%
    {#1}{#2}%
    {\@gls@field@font{\mfirstucMakeUppercase{\glsentryuseriv{#2}#3}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsuserv@}
% First letter uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.04}{2016-05-02}{set regular format}
%    \begin{macrocode}
\def\@Glsuserv@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link
  [\let\glscapscase\@secondoftwo]%
   {#1}{#2}{\@gls@field@font{\Glsentryuserv{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSuserv@}
% All uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.04}{2016-05-02}{set regular format}
%    \begin{macrocode}
\def\@GLSuserv@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link[\let\glscapscase\@thirdoftwo]%
    {#1}{#2}{\@gls@field@font{\mfirstucMakeUppercase{\glsentryuserv{#2}#3}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsuservi@}
% First letter uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.04}{2016-05-02}{set regular format}
%    \begin{macrocode}
\def\@Glsuservi@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link
  [\let\glscapscase\@secondoftwo]%
   {#1}{#2}{\@gls@field@font{\Glsentryuservi{#2}#3}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSuservi@}
% All uppercase version.
%\changes{0.3}{2015-12-02}{added redefinition}
%\changes{1.04}{2016-05-02}{set regular format}
%    \begin{macrocode}
\def\@GLSuservi@#1#2[#3]{%
  \glsxtrassignfieldfont{#2}%
  \@gls@field@link[\let\glscapscase\@thirdoftwo]%
    {#1}{#2}{\@gls@field@font{\mfirstucMakeUppercase{\glsentryuservi{#2}#3}}}%
}
%    \end{macrocode}
%\end{macro}
%
%Commands like \cs{acrshort} already set \cs{glsifplural}, but they
%don't set \cs{glsxtrifwasfirstuse} so they need adjusting.
%
%\begin{macro}{\@acrshort}
%\changes{0.3}{2015-12-02}{added redefinition}
% No case change.
%    \begin{macrocode}
\def\@acrshort#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\glsaccessshort{#2}}#3%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Acrshort}
%\changes{0.3}{2015-12-02}{added redefinition}
% First letter uppercase.
%    \begin{macrocode}
\def\@Acrshort#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@secondofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\Glsaccessshort{#2}}#3%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@ACRshort}
%\changes{0.3}{2015-12-02}{added redefinition}
% All uppercase.
%    \begin{macrocode}
\def\@ACRshort#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@thirdofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \mfirstucMakeUppercase{\acronymfont{\glsaccessshort{#2}}#3}%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@acrshortpl}
%\changes{0.3}{2015-12-02}{added redefinition}
% No case change.
%    \begin{macrocode}
\def\@acrshortpl#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\glsaccessshortpl{#2}}#3%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Acrshortpl}
%\changes{0.3}{2015-12-02}{added redefinition}
% First letter uppercase.
%    \begin{macrocode}
\def\@Acrshortpl#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@secondofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\Glsaccessshortpl{#2}}#3%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@ACRshortpl}
%\changes{0.3}{2015-12-02}{added redefinition}
% All uppercase.
%    \begin{macrocode}
\def\@ACRshortpl#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@thirdofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \mfirstucMakeUppercase{\acronymfont{\glsaccessshortpl{#2}}#3}%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@acrlong}
%\changes{0.3}{2015-12-02}{added redefinition}
% No case change.
%    \begin{macrocode}
\def\@acrlong#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\glsaccesslong{#2}}#3%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Acrlong}
%\changes{0.3}{2015-12-02}{added redefinition}
% First letter uppercase.
%    \begin{macrocode}
\def\@Acrlong#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@secondofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\Glsaccesslong{#2}}#3%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@ACRlong}
%\changes{0.3}{2015-12-02}{added redefinition}
% All uppercase.
%    \begin{macrocode}
\def\@ACRlong#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@thirdofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \mfirstucMakeUppercase{\acronymfont{\glsaccesslong{#2}}#3}%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@acrlongpl}
%\changes{0.3}{2015-12-02}{added redefinition}
% No case change.
%    \begin{macrocode}
\def\@acrlongpl#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\glsaccesslongpl{#2}}#3%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Acrlongpl}
%\changes{0.3}{2015-12-02}{added redefinition}
% First letter uppercase.
%    \begin{macrocode}
\def\@Acrlongpl#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@secondofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \acronymfont{\Glsaccesslongpl{#2}}#3%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@ACRlongpl}
%\changes{0.3}{2015-12-02}{added redefinition}
% All uppercase.
%    \begin{macrocode}
\def\@ACRlongpl#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@thirdofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \mfirstucMakeUppercase{\acronymfont{\glsaccesslongpl{#2}}#3}%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%Modify \cs{@glsaddkey} so additional keys provided by the user can
%be treated in a similar way.
%\begin{macro}{\@glsaddkey}
%    \begin{macrocode}
\renewcommand*{\@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}}%
%    \end{macrocode}
% Now for the commands with links. First the version with no case
% change (same as before):
%    \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}%
       {}%
    }%
    {%
      \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
% (modified):
%    \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}%
       {}%
    }%
    {%
      \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[\let\glscapscase\@secondofthree]%
          {##1}{##2}{#4{##2}##3}%
      }%
      \newrobustcmd*{#6}{%
        \expandafter\@gls@hyp@opt\csname @Gls@user@#1\endcsname}%
    }%
%    \end{macrocode}
% Finally the all caps version (modified):
%    \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}%
       {}%
    }%
    {%
      \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[\let\glscapscase\@thirdofthree]%
           {##1}{##2}{\mfirstucMakeUppercase{#3{##2}##3}}%
      }%
      \newrobustcmd*{#7}{%
        \expandafter\@gls@hyp@opt\csname @GLS@user@#1\endcsname}%
    }%
  }%
  {%
    \PackageError{glossaries-extra}{Key `#1' already exists}{}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@link@nocheckfirsthyper}
% Old versions of \styfmt{glossaries} don't define
% this, so provide it just in case it hasn't been defined.
%    \begin{macrocode}
\providecommand*{\@gls@link@nocheckfirsthyper}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@link@checkfirsthyper}
% Modify check to determine if the hyperlink should be automatically 
% suppressed, but save the original in case the acronyms are restored.
%    \begin{macrocode}
\let\@glsxtr@org@checkfirsthyper\@gls@link@checkfirsthyper
\renewcommand*{\@gls@link@checkfirsthyper}{%
%    \end{macrocode}
% \cs{ifglsused} isn't useful in the post link hook as it's already
% been unset by then, so define a command that can be used in the
% post link hook. Since \cs{@gls@link@checkfirsthyper} is only used
% by commands like \cs{gls} but not by other commands, this seems
% the best place to put it.
%    \begin{macrocode}
  \ifglsused{\glslabel}%
   {\let\glsxtrifwasfirstuse\@secondoftwo}
   {\let\glsxtrifwasfirstuse\@firstoftwo}%
%    \end{macrocode}
% Store the category label for convenience.
%    \begin{macrocode}
  \edef\glscategorylabel{\glscategory{\glslabel}}%
  \ifglsused{\glslabel}%
  {%
    \glsifcategoryattribute{\glscategorylabel}{nohypernext}{true}%
      {\KV@glslink@hyperfalse}{}%
  }%
  {%
    \glsifcategoryattribute{\glscategorylabel}{nohyperfirst}{true}%
      {\KV@glslink@hyperfalse}{}%
  }%
  \glslinkcheckfirsthyperhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\do@glsdisablehyperinlist}
% This command was introduced in \styfmt{glossaries} v4.19. If it
% hasn't been defined, we're using an earlier version, in which case
% the \catattr{nohyper} attribute can't be implemented.
%    \begin{macrocode}
\ifdef\do@glsdisablehyperinlist
{%
  \let\@glsxtr@do@glsdisablehyperinlist\do@glsdisablehyperinlist
  \renewcommand*{\do@glsdisablehyperinlist}{%
    \@glsxtr@do@glsdisablehyperinlist
    \glsifattribute{\glslabel}{nohyper}{true}{\KV@glslink@hyperfalse}{}%
  }
}
{}
%    \end{macrocode}
%\end{macro}
%
% Define a \gloskey[glslink]{noindex} key to prevent writing information to the
% external file.
%    \begin{macrocode}
\define@boolkey{glslink}{noindex}[true]{}
\KV@glslink@noindexfalse
%    \end{macrocode}
%
%If \cs{@gls@setdefault@glslink@opts} has been defined
%(\styfmt{glossaries} v4.20) use it to set the default keys in
%\cs{@glslink}.
%\begin{macro}{\@gls@setdefault@glslink@opts}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\ifdef\@gls@setdefault@glslink@opts
{
  \renewcommand*{\@gls@setdefault@glslink@opts}{%
    \KV@glslink@noindexfalse
    \@glsxtrsetaliasnoindex
  }
}
{
%    \end{macrocode}
% Not defined so prepend it to \cs{do@glsdisablehyperinlist} to
% achieve the same effect.
%    \begin{macrocode}
  \newcommand*{\@gls@setdefault@glslink@opts}{%
    \KV@glslink@noindexfalse
    \@glsxtrsetaliasnoindex
  }
  \preto\do@glsdisablehyperinlist{\@gls@setdefault@glslink@opts}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrsetaliasnoindex}
%\changes{1.12}{2017-02-03}{new}
%\changes{1.13}{2017-02-07}{switched to \cs{providecommand}}
%Allow user to hook into the alias noindex setting.
%Default behaviour switches off indexing for aliases.
%If the record option is on, this will have been defined to do
%nothing. (bib2gls will deal with records for aliased entries.)
%    \begin{macrocode}
\providecommand*{\glsxtrsetaliasnoindex}{%
 \KV@glslink@noindextrue
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtrsetaliasnoindex}
%\changes{1.12}{2017-02-03}{new}
%\changes{1.21}{2017-11-03}{changed to use \cs{glsxtrifhasfield} instead of
%\cs{ifglshasfield}}
%    \begin{macrocode}
\newcommand*{\@glsxtrsetaliasnoindex}{%
 \glsxtrifhasfield{alias}{\glslabel}%
 {%
   \let\glsxtrindexaliased\@glsxtrindexaliased
   \glsxtrsetaliasnoindex
   \let\glsxtrindexaliased\@no@glsxtrindexaliased
 }%
 {}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtrindexaliased}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand{\@glsxtrindexaliased}{%
 \ifKV@glslink@noindex 
 \else
   \begingroup
   \let\@glsnumberformat\@glsxtr@defaultnumberformat
   \edef\@gls@counter{\csname glo@\glsdetoklabel{\glslabel}@counter\endcsname}%
   \glsxtr@saveentrycounter
   \@@do@wrglossary{\glsxtralias{\glslabel}}%
   \endgroup
 \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@no@glsxtrindexaliased}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand{\@no@glsxtrindexaliased}{%
  \PackageError{glossaries-extra}{\string\glsxtrindexaliased\space
  not permitted outside definition of \string\glsxtrsetaliasnoindex}%
  {}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrindexaliased}
%\changes{1.12}{2017-02-03}{new}
%Provide a command to redirect alias indexing, but only allow it to
%be used within \cs{glsxtrsetaliasnoindex}.
%    \begin{macrocode}
\let\glsxtrindexaliased\@no@glsxtrindexaliased
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrSetDefaultGlsOpts}
%\changes{0.5.4}{2015-12-15}{new}
% Set the default options for \cs{glslink} etc.
%    \begin{macrocode}
\newcommand*{\GlsXtrSetDefaultGlsOpts}[1]{%
  \renewcommand*{\@gls@setdefault@glslink@opts}{%
    \setkeys{glslink}{#1}%
    \@glsxtrsetaliasnoindex
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrifindexing}
% Provide user level command to access it in \cs{glswriteentry}.
%    \begin{macrocode}
\newcommand*{\glsxtrifindexing}[2]{%
  \ifKV@glslink@noindex #2\else #1\fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glswriteentry}
% Redefine to test for \catattr{indexonlyfirst} category attribute.
%    \begin{macrocode}
\renewcommand*{\glswriteentry}[2]{%
  \glsxtrifindexing
  {%
   \ifglsindexonlyfirst
     \ifglsused{#1}
     {\glsxtrdoautoindexname{#1}{dualindex}}%
     {#2}%
   \else
     \glsifattribute{#1}{indexonlyfirst}{true}%
     {\ifglsused{#1}
      {\glsxtrdoautoindexname{#1}{dualindex}}%
      {#2}}%
     {#2}%
   \fi
  }%
  {}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@do@@wrglossary}
% Hook into glossary indexing command so that it can also use
% \ics{index} at the same time if required and add user hook.
%    \begin{macrocode}
\appto\@@do@@wrglossary{\@glsxtr@do@@wrindex
  \glsxtrdowrglossaryhook{\@gls@label}%
}
%    \end{macrocode}
% (The label can be obtained from \cs{@gls@label} at this point.)
%\end{macro}
% Similarly for the \qt{noidx} version:
%\begin{macro}{\gls@noidxglossary}
%    \begin{macrocode}
\appto\gls@noidxglossary{\@glsxtr@do@@wrindex
  \glsxtrdowrglossaryhook{\@gls@label}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@do@@wrindex}
%    \begin{macrocode}
\newcommand*{\@glsxtr@do@@wrindex}{%
  \glsxtrdoautoindexname{\@gls@label}{dualindex}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrdowrglossaryhook}
% Allow user to hook into indexing code. (Always used by
% \cs{glsadd}. Used by \cs{gls} when indexing, which may or may not occur
% depending on the indexing settings.)
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrdowrglossaryhook}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@alt@hyp@opt}
%\changes{0.5.4}{2015-12-15}{new}
% Commands like \cs{gls} have a star or plus version. Provide a
% third symbol that the user can adapt for convenience.
%    \begin{macrocode}
\newcommand*{\@gls@alt@hyp@opt}[1]{%
 \let\glslinkvar\@firstofthree
 \let\@gls@hyp@opt@cs#1\relax
 \@ifstar{\s@gls@hyp@opt}%
 {\@ifnextchar+%
   {\@firstoftwo{\p@gls@hyp@opt}}%
   {%
     \expandafter\@ifnextchar\@gls@alt@hyp@opt@char
     {\@firstoftwo{\@alt@gls@hyp@opt}}%
     {#1}%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@alt@gls@hyp@opt}
% User version
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\newcommand*{\@alt@gls@hyp@opt}[1][]{%
 \let\glslinkvar\@firstofthree
 \expandafter\@gls@hyp@opt@cs\expandafter[\@gls@alt@hyp@opt@keys,#1]}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@alt@hyp@opt@char}
%\changes{0.5.4}{2015-12-15}{new}
%Contains the character used as the command modifier.
%    \begin{macrocode}
\newcommand*{\@gls@alt@hyp@opt@char}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@alt@hyp@opt@keys}
%\changes{0.5.4}{2015-12-15}{new}
%Contains the option list used as the command modifier.
%    \begin{macrocode}
\newcommand*{\@gls@alt@hyp@opt@keys}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrSetAltModifier}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\newcommand*{\GlsXtrSetAltModifier}[2]{%
  \let\@gls@hyp@opt\@gls@alt@hyp@opt
  \def\@gls@alt@hyp@opt@char{#1}%
  \def\@gls@alt@hyp@opt@keys{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@org@dohyperlink}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\let\glsxtr@org@dohyperlink\glsdohyperlink
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsnavhyperlink}
%\changes{1.21}{2017-11-03}{patched}
%Now that \cs{glsdohyperlink} (used by \cs{@glslink}) references 
%\cs{glslabel} it's necessary to patch \cs{glsnavhyperlink} to 
%avoid using it (since \cs{glslabel} won't be defined). This means
%temporarily redefining \cs{glsdohyperlink} to its original
%definition.
%
%This command is provided by \sty{glossary-hypernav} so it may not
%exist.
%    \begin{macrocode}
\ifdef\glsnavhyperlink
{
  \renewcommand*{\glsnavhyperlink}[3][\@glo@type]{%
    \edef\gls@grplabel{#2}\protected@edef\@gls@grptitle{#3}%
%    \end{macrocode}
%Scope:
%    \begin{macrocode}
    {%
      \let\glsdohyperlink\glsxtr@org@dohyperlink
      \@glslink{\glsnavhyperlinkname{#1}{#2}}{#3}%
    }%
  }%
}
{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdohyperlink}
% Unpleasant complications can occur if the \gloskey{text} or
% \gloskey{first} key etc contains \cs{gls}, particularly if there
% are hyperlinks. To get around this problem, patch
% \cs{glsdohyperlink} so that it temporarily makes \ics{gls} behave
% like \ics{glstext}\oarg{hyper=false,noindex}. (This will be
% overridden if the user explicitly cancels either of those options
% in the optional argument of \cs{gls} or using the plus version.)
% This also patches the short form commands like \cs{acrshort}
% and \cs{glsxtrshort} to use \cs{glsentryshort} and, similarly, the
% long form commands like \cs{acrlong} and \cs{glsxtrlong} to use
% \cs{glsentrylong}. Added attribute check.
%\changes{0.5.4}{2015-12-15}{added}
%    \begin{macrocode}
\renewcommand*{\glsdohyperlink}[2]{%
 \glshasattribute{\glslabel}{targeturl}%
 {%
   \glshasattribute{\glslabel}{targetname}%
   {%
     \glshasattribute{\glslabel}{targetcategory}%
     {%
       \hyperref{\glsgetattribute{\glslabel}{targeturl}}%
         {\glsgetattribute{\glslabel}{targetcategory}}%
         {\glsgetattribute{\glslabel}{targetname}}%
         {{\glsxtrprotectlinks#2}}%
     }%
     {%
       \hyperref{\glsgetattribute{\glslabel}{targeturl}}%
         {}%
         {\glsgetattribute{\glslabel}{targetname}}%
         {{\glsxtrprotectlinks#2}}%
     }%
   }%
   {%
     \href{\glsgetattribute{\glslabel}{targeturl}}%
       {{\glsxtrprotectlinks#2}}%
   }%
 }%
 {%
%    \end{macrocode}
%Check for alias.
%\changes{1.12}{2017-02-03}{added check for alias field}
%    \begin{macrocode}
   \glsfieldfetch{\glslabel}{alias}{\gloaliaslabel}%
   \ifdefvoid\gloaliaslabel
   {%
     \glsxtrhyperlink{#1}{{\glsxtrprotectlinks#2}}%
   }%
   {%
%    \end{macrocode}
%Redirect link to the alias target.
%    \begin{macrocode}
     \glsxtrhyperlink
     {\glolinkprefix\glsdetoklabel{\gloaliaslabel}}%
     {{\glsxtrprotectlinks#2}}%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}

%\begin{macro}{\glsxtrhyperlink}
%\changes{1.19}{2017-09-09}{new}
%Allows integration with the base \styfmt{glossaries} package's
%\pkgopt[showtargets]{debug} option.
%    \begin{macrocode}
\ifdef\@glsshowtarget
{
  \newcommand{\glsxtrhyperlink}[2]{%
    \@glsshowtarget{#1}%
    \hyperlink{#1}{#2}%
  }%
}
{
  \newcommand{\glsxtrhyperlink}[2]{\hyperlink{#1}{#2}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdisablehyper}
%\changes{1.14}{2017-04-18}{added redefinition}
% Redefine to set \cs{glslabel} (to allow it to be picked up by
% \cs{glsdohyperlink}). Also made it robust and added grouping to localise the
% definition of \cs{glslabel}. The original internal command
% {@glo@label} could probably be simply replaced with \cs{glslabel},
% but it's retained in case its removal causes unexpected problems.
%\changes{1.21}{2017-11-03}{added check for existence}
%    \begin{macrocode}
\renewrobustcmd*{\glshyperlink}[2][\glsentrytext{\@glo@label}]{%
 \glsdoifexists{#2}%
 {%
   \def\@glo@label{#2}%
   {\edef\glslabel{#2}%
   \@glslink{\glolinkprefix\glslabel}{#1}}%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdisablehyper}
%\changes{0.5.4}{2015-12-15}{added}
%\changes{1.21}{2017-11-03}{changed to use \cs{def} rather than \cs{let}}
% Redefine in case we have an old version of \styfmt{glossaries}.
%This now uses \cs{def} rather than \cs{let} to allow for
%redefinitions of \cs{glsdonohyperlink}.
%    \begin{macrocode}
\renewcommand{\glsdisablehyper}{%
  \KV@glslink@hyperfalse
  \def\@glslink{\glsdonohyperlink}%
  \let\@glstarget\@secondoftwo
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsenablehyper}
%\changes{1.21}{2017-11-03}{changed to use \cs{def} rather than \cs{let}}
%This now uses \cs{def} rather than \cs{let} to allow for
%redefinitions of \cs{glsdohypertarget} and \cs{glsdohyperlink}.
%    \begin{macrocode}
\renewcommand{\glsenablehyper}{%
 \KV@glslink@hypertrue
 \def\@glslink{\glsdohyperlink}%
 \def\@glstarget{\glsdohypertarget}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdonohyperlink}
% This command was only introduced in \styfmt{glossaries} v4.20, so it may
% not be defined (therefore use \cs{def}). For older \styfmt{glossaries} versions, this won't be
% used if \sty{hyperref} hasn't been loaded, which means the
% indexing will still take place. The generated text is scoped
% (the link text in \cs{hyperlink} is also scoped, so it's
% consistent).
%\changes{0.5.4}{2015-12-15}{added}
%    \begin{macrocode}
\def\glsdonohyperlink#1#2{{\glsxtrprotectlinks #2}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glslink}
% Reset \cs{@glslink} with patched versions:
%\changes{1.21}{2017-11-03}{changed \cs{let} to \cs{def}}
%    \begin{macrocode}
\ifcsundef{hyperlink}%
{%
  \def\@glslink{\glsdonohyperlink}
}%
{%
  \def\@glslink{\glsdohyperlink}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrprotectlinks}
%\changes{0.5.4}{2015-12-15}{new}
% Make \cs{gls} (and variants) behave like the corresponding
% \cs{glstext} (and variants) with hyperlinking and indexing off.
%    \begin{macrocode}
\newcommand*{\glsxtrprotectlinks}{%
  \KV@glslink@hyperfalse
  \KV@glslink@noindextrue
  \let\@gls@\@glsxtr@p@text@
  \let\@Gls@\@Glsxtr@p@text@
  \let\@GLS@\@GLSxtr@p@text@
  \let\@glspl@\@glsxtr@p@plural@
  \let\@Glspl@\@Glsxtr@p@plural@
  \let\@GLSpl@\@GLSxtr@p@plural@
  \let\@glsxtrshort\@glsxtr@p@short@
  \let\@Glsxtrshort\@Glsxtr@p@short@
  \let\@GLSxtrshort\@GLSxtr@p@short@
  \let\@glsxtrlong\@glsxtr@p@long@
  \let\@Glsxtrlong\@Glsxtr@p@long@
  \let\@GLSxtrlong\@GLSxtr@p@long@
  \let\@glsxtrshortpl\@glsxtr@p@shortpl@
  \let\@Glsxtrshortpl\@Glsxtr@p@shortpl@
  \let\@GLSxtrshortpl\@GLSxtr@p@shortpl@
  \let\@glsxtrlongpl\@glsxtr@p@longpl@
  \let\@Glsxtrlongpl\@Glsxtr@p@longpl@
  \let\@GLSxtrlongpl\@GLSxtr@p@longpl@
  \let\@acrshort\@glsxtr@p@acrshort@
  \let\@Acrshort\@Glsxtr@p@acrshort@
  \let\@ACRshort\@GLSxtr@p@acrshort@
  \let\@acrshortpl\@glsxtr@p@acrshortpl@
  \let\@Acrshortpl\@Glsxtr@p@acrshortpl@
  \let\@ACRshortpl\@GLSxtr@p@acrshortpl@
  \let\@acrlong\@glsxtr@p@acrlong@
  \let\@Acrlong\@Glsxtr@p@acrlong@
  \let\@ACRlong\@GLSxtr@p@acrlong@
  \let\@acrlongpl\@glsxtr@p@acrlongpl@
  \let\@Acrlongpl\@Glsxtr@p@acrlongpl@
  \let\@ACRlongpl\@GLSxtr@p@acrlongpl@
}
%    \end{macrocode}
%\end{macro}
%
% These protected versions need grouping to prevent the label from 
% getting confused.
%\begin{macro}{\@glsxtr@p@text@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@glsxtr@p@text@#1#2[#3]{{\@glstext@{#1}{#2}[#3]}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsxtr@p@text@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@Glsxtr@p@text@#1#2[#3]{{\@Glstext@{#1}{#2}[#3]}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSxtr@p@text@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@GLSxtr@p@text@#1#2[#3]{{\@GLStext@{#1}{#2}[#3]}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@p@plural@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@glsxtr@p@plural@#1#2[#3]{{\@glsplural@{#1}{#2}[#3]}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsxtr@p@plural@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@Glsxtr@p@plural@#1#2[#3]{{\@Glsplural@{#1}{#2}[#3]}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSxtr@p@plural@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@GLSxtr@p@plural@#1#2[#3]{{\@GLSplural@{#1}{#2}[#3]}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@p@short@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@glsxtr@p@short@#1#2[#3]{%
 {%
  \glssetabbrvfmt{\glscategory{#2}}%
  \glsabbrvfont{\glsentryshort{#2}}#3%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsxtr@p@short@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@Glsxtr@p@short@#1#2[#3]{%
 {%
   \glssetabbrvfmt{\glscategory{#2}}%
   \glsabbrvfont{\Glsentryshort{#2}}#3%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSxtr@p@short@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@GLSxtr@p@short@#1#2[#3]{%
  {%
    \glssetabbrvfmt{\glscategory{#2}}%
    \mfirstucMakeUppercase{\glsabbrvfont{\glsentryshort{#2}}#3}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@p@shortpl@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@glsxtr@p@shortpl@#1#2[#3]{%
 {%
   \glssetabbrvfmt{\glscategory{#2}}%
   \glsabbrvfont{\glsentryshortpl{#2}}#3%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsxtr@p@shortpl@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@Glsxtr@p@shortpl@#1#2[#3]{%
 {%
   \glssetabbrvfmt{\glscategory{#2}}%
   \glsabbrvfont{\Glsentryshortpl{#2}}#3%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSxtr@p@shortpl@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@GLSxtr@p@shortpl@#1#2[#3]{%
  {%
    \glssetabbrvfmt{\glscategory{#2}}%
    \mfirstucMakeUppercase{\glsabbrvfont{\glsentryshortpl{#2}}#3}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@p@long@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@glsxtr@p@long@#1#2[#3]{{\glsentrylong{#2}#3}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsxtr@p@long@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@Glsxtr@p@long@#1#2[#3]{{\Glsentrylong{#2}#3}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSxtr@p@long@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@GLSxtr@p@long@#1#2[#3]{%
  {\mfirstucMakeUppercase{\glslongfont{\glsentrylong{#2}}#3}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@p@longpl@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@glsxtr@p@longpl@#1#2[#3]{{\glsentrylongpl{#2}#3}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsxtr@p@longpl@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@Glsxtr@p@longpl@#1#2[#3]{{\glslongfont{\Glsentrylongpl{#2}}#3}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSxtr@p@longpl@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@GLSxtr@p@longpl@#1#2[#3]{%
  {\mfirstucMakeUppercase{\glslongfont{\glsentrylongpl{#2}}#3}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@p@acrshort@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@glsxtr@p@acrshort@#1#2[#3]{{\acronymfont{\glsentryshort{#2}}#3}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsxtr@p@acrshort@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@Glsxtr@p@acrshort@#1#2[#3]{{\acronymfont{\Glsentryshort{#2}}#3}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSxtr@p@acrshort@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@GLSxtr@p@acrshort@#1#2[#3]{%
  {\mfirstucMakeUppercase{\acronymfont{\glsentryshort{#2}}#3}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@p@acrshortpl@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@glsxtr@p@acrshortpl@#1#2[#3]{{\acronymfont{\glsentryshortpl{#2}}#3}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsxtr@p@acrshortpl@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@Glsxtr@p@acrshortpl@#1#2[#3]{{\acronymfont{\Glsentryshortpl{#2}}#3}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSxtr@p@acrshortpl@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@GLSxtr@p@acrshortpl@#1#2[#3]{%
  {\mfirstucMakeUppercase{\acronymfont{\glsentryshortpl{#2}}#3}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@p@acrlong@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@glsxtr@p@acrlong@#1#2[#3]{{\glsentrylong{#2}#3}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsxtr@p@acrlong@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@Glsxtr@p@acrlong@#1#2[#3]{{\Glsentrylong{#2}#3}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSxtr@p@acrlong@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@GLSxtr@p@acrlong@#1#2[#3]{%
 {\mfirstucMakeUppercase{\glsentrylong{#2}#3}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@p@acrlongpl@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@glsxtr@p@acrlongpl@#1#2[#3]{{\glsentrylongpl{#2}#3}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsxtr@p@acrlongpl@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@Glsxtr@p@acrlongpl@#1#2[#3]{{\Glsentrylongpl{#2}#3}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSxtr@p@acrlongpl@}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\def\@GLSxtr@p@acrlongpl@#1#2[#3]{%
 {\mfirstucMakeUppercase{\glsentrylongpl{#2}#3}}}
%    \end{macrocode}
%\end{macro}
%
%Commands to minimise conflict.
%\begin{macro}{\@glsxtrp@opt}
%\changes{1.07}{2016-08-15}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtrp@opt}{hyper=false,noindex}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrsetpopts}
%\changes{1.07}{2016-08-15}{new}
%Used in glossary to switch hyperlinks on for the \cs{glsxtrp} type
%of commands.
%    \begin{macrocode}
\newcommand*{\glsxtrsetpopts}[1]{%
  \renewcommand*{\@glsxtrp@opt}{#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glossxtrsetpopts}
%\changes{1.07}{2016-08-15}{new}
%Used in glossary to switch hyperlinks on for the \cs{glsxtrp} type
%of commands.
%    \begin{macrocode}
\newcommand*{\glossxtrsetpopts}{%
  \glsxtrsetpopts{noindex}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@glsxtrp}
%\changes{1.07}{2016-08-15}{new}
%    \begin{macrocode}
\newrobustcmd*{\@@glsxtrp}[2]{%
%    \end{macrocode}
%Add scope.
%    \begin{macrocode}
  {%
    \let\glspostlinkhook\relax
    \csname#1\expandafter\endcsname\expandafter[\@glsxtrp@opt]{#2}[]%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtrp}
%\changes{1.07}{2016-08-15}{new}
%    \begin{macrocode}
\newrobustcmd*{\@glsxtrp}[2]{%
  \ifcsdef{gls#1}%
  {%
    \@@glsxtrp{gls#1}{#2}%
  }%
  {%
    \ifcsdef{glsxtr#1}%
    {%
      \@@glsxtrp{glsxtr#1}{#2}%
    }%
    {%
      \PackageError{glossaries-extra}{`#1' not recognised by
        \string\glsxtrp}{}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glsxtrp}
%\changes{1.07}{2016-08-15}{new}
%    \begin{macrocode}
\newrobustcmd*{\@Glsxtrp}[2]{%
  \ifcsdef{Gls#1}%
  {%
    \@@glsxtrp{Gls#1}{#2}%
  }%
  {%
    \ifcsdef{Glsxtr#1}%
    {%
      \@@glsxtrp{Glsxtr#1}{#2}%
    }%
    {%
      \PackageError{glossaries-extra}{`#1' not recognised by
        \string\Glsxtrp}{}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSxtrp}
%\changes{1.07}{2016-08-15}{new}
%    \begin{macrocode}
\newrobustcmd*{\@GLSxtrp}[2]{%
  \ifcsdef{GLS#1}%
  {%
    \@@glsxtrp{GLS#1}{#2}%
  }%
  {%
    \ifcsdef{GLSxtr#1}%
    {%
      \@@glsxtrp{GLSxtr#1}{#2}%
    }%
    {%
      \PackageError{glossaries-extra}{`#1' not recognised by
        \string\GLSxtrp}{}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@entry@p}
%\changes{1.07}{2016-08-15}{new}
%    \begin{macrocode}
\newrobustcmd*{\glsxtr@headentry@p}[2]{%
 \glsifattribute{#1}{headuc}{true}%
 {%
   \mfirstucMakeUppercase{\@gls@entry@field{#1}{#2}}%
 }%
 {%
   \@gls@entry@field{#1}{#2}%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrp}
%\changes{1.07}{2016-08-15}{new}
%Not robust as it needs to expand somewhat.
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand{\glsxtrp}[2]{%
    \protect\NoCaseChange
    {%
      \protect\texorpdfstring
      {%
        \protect\glsxtrifinmark
        {%
          \ifcsdef{glsxtrhead#1}%
          {%
            {\protect\csuse{glsxtrhead#1}{#2}}%
          }%
          {%
            \glsxtr@headentry@p{#2}{#1}%
          }%
        }%
        {%
          \@glsxtrp{#1}{#2}%
        }%
      }%
      {%
        \protect\@gls@entry@field{#2}{#1}%
      }%
    }%
  }
}
{
  \newcommand{\glsxtrp}[2]{%
    \protect\NoCaseChange
    {%
      \protect\glsxtrifinmark
      {%
        \ifcsdef{glsxtrhead#1}%
        {%
          {\protect\csuse{glsxtrhead#1}}%
        }%
        {%
          \glsxtr@headentry@p{#2}{#1}%
        }%
      }%
      {%
        \@glsxtrp{#1}{#2}%
      }%
    }%
  }
}
%    \end{macrocode}
%\end{macro}
%
%Provide short synonyms for the most common option.
%\begin{macro}{\glsps}
%\changes{1.07}{2016-08-15}{new}
%    \begin{macrocode}
\newcommand*{\glsps}{\glsxtrp{short}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glspt}
%\changes{1.07}{2016-08-15}{new}
%    \begin{macrocode}
\newcommand*{\glspt}{\glsxtrp{text}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrp}
%\changes{1.07}{2016-08-15}{new}
%As above but use first letter upper case (but not for the
%bookmarks, which can't process \cs{uppercase}).
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand{\Glsxtrp}[2]{%
    \protect\NoCaseChange
    {%
      \protect\texorpdfstring
      {%
        \protect\glsxtrifinmark
        {%
          \ifcsdef{Glsxtrhead#1}%
          {%
            {\protect\csuse{Glsxtrhead#1}{#2}}%
          }%
          {%
            \protect\@Gls@entry@field{#2}{#1}%
          }%
        }%
        {%
          \@Glsxtrp{#1}{#2}%
        }%
      }%
      {%
        \protect\@gls@entry@field{#2}{#1}%
      }%
    }%
  }
}
{
  \newcommand{\Glsxtrp}[2]{%
    \protect\NoCaseChange
    {%
      \protect\glsxtrifinmark
      {%
        \ifcsdef{Glsxtrhead#1}%
        {%
          {\protect\csuse{Glsxtrhead#1}}%
        }%
        {%
          \protect\@Gls@entry@field{#2}{#1}%
        }%
      }%
      {%
        \@Glsxtrp{#1}{#2}%
      }%
    }%
  }
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSxtrp}
%\changes{1.07}{2016-08-15}{new}
%As above but all upper case (but not for the
%bookmarks, which can't process \cs{uppercase}).
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand{\GLSxtrp}[2]{%
    \protect\NoCaseChange
    {%
      \protect\texorpdfstring
      {%
        \protect\glsxtrifinmark
        {%
          \ifcsdef{GLSxtr#1}%
          {%
            {\protect\GLSxtrshort[noindex,hyper=false]{#1}[]}%
          }%
          {%
            \protect\mfirstucMakeUppercase
            {%
              \protect\@gls@entry@field{#2}{#1}%
            }%
          }%
        }%
        {%
          \@GLSxtrp{#1}{#2}%
        }%
      }%
      {%
        \protect\@gls@entry@field{#2}{#1}%
      }%
    }%
  }
}
{
  \newcommand{\GLSxtrp}[2]{%
    \protect\NoCaseChange
    {%
      \protect\glsxtrifinmark
      {%
        \ifcsdef{GLSxtr#1}%
        {%
          {\protect\GLSxtrshort[noindex,hyper=false]{#1}[]}%
        }%
        {%
          \protect\mfirstucMakeUppercase
          {%
            \protect\@gls@entry@field{#2}{#1}%
          }%
        }%
      }%
      {%
        \@GLSxtrp{#1}{#2}%
      }%
    }%
  }
}
%    \end{macrocode}
%\end{macro}
%
%
%\subsection{Entry Counting}
%
% The (use) entry counting mechanism from \styfmt{glossaries} is adjusted
% here to work with category attributes. Provide a convenient
% command to enable entry counting, set the \catattr{entrycount}
% attribute for given categories and redefine \ics{gls} etc to 
% use \cs{cgls} instead. This form of entry counting is provided to
% adjust the formatting if the number of times an entry has been
% used (through commands that unset the first use flag) doesn't
% exceeding the specified threshold. For link counting, see
% \sectionref{sec:linkcount}.
%
% First adjust definitions of the unset and reset commands to
% provide a hook, but changing the flag can cause problems in 
% certain situations, so to allow the normal unsetting to be 
% temporarily disabled, \cs{@glsunset} is let to
% \cs{@glsxtr@unset}, which performs the actual unsetting through
% \cs{@@glsunset} and then does the hook. This means that the
% unsetting (and the hook) can switched off by redefining \cs{@glsunset}
% and then switched back on again by changing the definition back to
% \cs{@glsxtr@unset}.
%
%\begin{macro}{\@glsxtr@unset}
%\changes{1.30}{2018-04-25}{new}
% Global unset.
%    \begin{macrocode}
\newcommand*{\@glsxtr@unset}[1]{%
  \@@glsunset{#1}%
  \glsxtrpostunset{#1}%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsunset}
% Global unset.
%    \begin{macrocode}
\let\@glsunset\@glsxtr@unset
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrpostunset}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrpostunset}[1]{}
%    \end{macrocode}
%\end{macro}
%
%Provide a command to store a list of labels that will need
%unsetting.
%\begin{macro}{\GlsXtrStartUnsetBuffering}
%\changes{1.30}{2018-04-25}{new}
%    \begin{macrocode}
\newcommand*{\GlsXtrStartUnsetBuffering}{%
  \@ifstar\s@GlsXtrStartUnsetBuffering\@GlsXtrStartUnsetBuffering
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GlsXtrStartUnsetBuffering}
%\changes{1.31}{2018-05-09}{new}
%Unstarred version doesn't check for duplicates.
%    \begin{macrocode}
\newcommand*{\@GlsXtrStartUnsetBuffering}{%
  \let\@glsxtr@org@unset@buffer\@glsxtr@unset@buffer
  \def\@glsxtr@unset@buffer{}%
  \let\@glsunset\@glsxtrbuffer@unset
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\s@GlsXtrStartUnsetBuffering}
%\changes{1.31}{2018-05-09}{new}
%Starred version checks for duplicates.
%    \begin{macrocode}
\newcommand*{\s@GlsXtrStartUnsetBuffering}{%
  \let\@glsxtr@org@unset@buffer\@glsxtr@unset@buffer
  \def\@glsxtr@unset@buffer{}%
  \let\@glsunset\@glsxtrbuffer@nodup@unset
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtrbuffer@unset}
%\changes{1.30}{2018-04-25}{new}
%This must use a global change since \cs{gls} may have to be placed
%inside \cs{mbox} (for example, with \sty{soul} commands).
%    \begin{macrocode}
\newcommand*{\@glsxtrbuffer@unset}[1]{%
  \listxadd\@glsxtr@unset@buffer{#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtrbuffer@nodup@unset}
%\changes{1.31}{2018-05-09}{new}
%Alternative version that avoids duplicates.
%One level of expansion is performed on the argument in case it's a
%control sequence containing the label. (Not using \cs{xifinlist} as
%the added complexity might cause problems that the buffering is
%trying to overcome.)
%    \begin{macrocode}
\newcommand*{\@glsxtrbuffer@nodup@unset}[1]{%
  \expandafter\ifinlist\expandafter{#1}{\@glsxtr@unset@buffer}{}%
  {\listxadd\@glsxtr@unset@buffer{#1}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrStopUnsetBuffering}
%\changes{1.30}{2018-04-25}{new}
%    \begin{macrocode}
\newcommand*{\GlsXtrStopUnsetBuffering}{%
  \@ifstar\s@GlsXtrStopUnsetBuffering\@GlsXtrStopUnsetBuffering
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GlsXtrStopUnsetBuffering}
%\changes{1.30}{2018-04-25}{new}
%Unstarred form (global unset).
%    \begin{macrocode}
\newcommand*{\@GlsXtrStopUnsetBuffering}{%
  \let\@glsunset\@glsxtr@unset
  \forlistloop\@glsunset\@glsxtr@unset@buffer
  \let\@glsxtr@unset@buffer\@glsxtr@org@unset@buffer
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\s@GlsXtrStopUnsetBuffering}
%\changes{1.30}{2018-04-25}{new}
%Starred form (local unset).
%    \begin{macrocode}
\newcommand*{\s@GlsXtrStopUnsetBuffering}{%
  \forlistloop\@glslocalunset\@glsxtr@unset@buffer
  \let\@glsunset\@glsxtr@unset
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrForUnsetBufferedList}
%\changes{1.31}{2018-05-09}{new}
%Iterate over labels stored in the current buffer.
%The argument is the handler macro.
%    \begin{macrocode}
\newcommand*{\GlsXtrForUnsetBufferedList}[1]{%
  \forlistloop#1\@glsxtr@unset@buffer
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glslocalunset}
% Local unset.
%    \begin{macrocode}
\renewcommand*{\@glslocalunset}[1]{%
  \@@glslocalunset{#1}%
  \glsxtrpostlocalunset{#1}%
}%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrpostlocalunset}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrpostlocalunset}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsreset}
% Global reset.
%    \begin{macrocode}
\renewcommand*{\@glsreset}[1]{%
  \@@glsreset{#1}%
  \glsxtrpostreset{#1}%
}%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrpostreset}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrpostreset}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glslocalreset}
% Local reset.
%    \begin{macrocode}
\renewcommand*{\@glslocalreset}[1]{%
  \@@glslocalreset{#1}%
  \glsxtrpostlocalreset{#1}%
}%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrpostlocalreset}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrpostlocalreset}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glslocalreseteach}
%\changes{1.31}{2018-05-09}{new}
%Locally reset a list of entries.
%    \begin{macrocode}
\newcommand*{\glslocalreseteach}[1]{%
  \gls@ifnotmeasuring
  {%
    \@for\@gls@thislabel:=#1\do{%
      \glsdoifexists{\@gls@thislabel}%
      {%
        \@glslocalreset{\@gls@thislabel}%
      }%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glslocalunseteach}
%Locally unset a list of entries.
%\changes{1.31}{2018-05-09}{new}
%    \begin{macrocode}
\newcommand*{\glslocalunseteach}[1]{%
  \gls@ifnotmeasuring
  {%
    \@for\@gls@thislabel:=#1\do{%
      \glsdoifexists{\@gls@thislabel}%
      {%
        \@glslocalunset{\@gls@thislabel}%
      }%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrEnableEntryCounting}
% The first argument is the list of categories and the second
% argument is the value of the \catattr{entrycount} attribute.
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newcommand*{\GlsXtrEnableEntryCounting}[2]{%
%    \end{macrocode}
% Enable entry counting:
%    \begin{macrocode}
  \glsenableentrycount
%    \end{macrocode}
% Redefine \cs{gls} etc:
%    \begin{macrocode}
  \renewcommand*{\gls}{\cgls}%
  \renewcommand*{\Gls}{\cGls}%
  \renewcommand*{\glspl}{\cglspl}%
  \renewcommand*{\Glspl}{\cGlspl}%
  \renewcommand*{\GLS}{\cGLS}%
  \renewcommand*{\GLSpl}{\cGLSpl}%
%    \end{macrocode}
% Set the \catattr{entrycount} attribute:
%    \begin{macrocode}
  \@glsxtr@setentrycountunsetattr{#1}{#2}%
%    \end{macrocode}
% In case this command is used again:
%    \begin{macrocode}
  \let\GlsXtrEnableEntryCounting\@glsxtr@setentrycountunsetattr
  \renewcommand*{\GlsXtrEnableEntryUnitCounting}[3]{%
   \PackageError{glossaries-extra}{\string\GlsXtrEnableEntryUnitCounting\space
    can't be used with \string\GlsXtrEnableEntryCounting}%
   {Use one or other but not both commands}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@setentrycountunsetattr}
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@setentrycountunsetattr}[2]{%
 \@for\@glsxtr@cat:=#1\do
 {%
   \ifdefempty{\@glsxtr@cat}{}%
   {%
     \glssetcategoryattribute{\@glsxtr@cat}{entrycount}{#2}%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
% Redefine the entry counting commands to take into account the
%\catattr{entrycount} attribute.
%\begin{macro}{\glsenableentrycount}
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\renewcommand*{\glsenableentrycount}{%
%    \end{macrocode}
% Enable new fields:
%    \begin{macrocode}
  \appto\@newglossaryentry@defcounters{\@@newglossaryentry@defcounters}%
%    \end{macrocode}
% Just in case the user has switched on the \pkgopt{docdef} option.
%    \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}
% New commands to access new fields:
%    \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}
% Adjust post unset and reset:
%    \begin{macrocode}
  \let\@glsxtr@entrycount@org@unset\glsxtrpostunset
  \renewcommand*{\glsxtrpostunset}[1]{%
    \@glsxtr@entrycount@org@unset{##1}%
    \@gls@increment@currcount{##1}%
  }%
  \let\@glsxtr@entrycount@org@localunset\glsxtrpostlocalunset
  \renewcommand*{\glsxtrpostlocalunset}[1]{%
    \@glsxtr@entrycount@org@localunset{##1}%
    \@gls@local@increment@currcount{##1}%
  }%
  \let\@glsxtr@entrycount@org@reset\glsxtrpostreset
  \renewcommand*{\glsxtrpostreset}[1]{%
    \@glsxtr@entrycount@org@reset{##1}%
    \csgdef{glo@\glsdetoklabel{##1}@currcount}{0}%
  }%
  \let\@glsxtr@entrycount@org@localreset\glsxtrpostlocalreset
  \renewcommand*{\glsxtrpostlocalreset}[1]{%
    \@glsxtr@entrycount@org@localreset{##1}%
    \csdef{glo@\glsdetoklabel{##1}@currcount}{0}%
  }%
%    \end{macrocode}
% Modifications to take into account the attributes that govern
% whether the entry should be unset.
%    \begin{macrocode}
  \let\@cgls@\@@cgls@
  \let\@cglspl@\@@cglspl@
%    \end{macrocode}
%\changes{1.14}{2017-04-18}{fixed assignment of \cs{@cGls@}}
%    \begin{macrocode}
  \let\@cGls@\@@cGls@
  \let\@cGlspl@\@@cGlspl@
  \let\@cGLS@\@@cGLS@
  \let\@cGLSpl@\@@cGLSpl@
%    \end{macrocode}
% The rest is as the original definition.
%    \begin{macrocode}
  \AtEndDocument{\@gls@write@entrycounts}%
  \renewcommand*{\@gls@entry@count}[2]{%
    \csgdef{glo@\glsdetoklabel{##1}@prevcount}{##2}%
  }%
  \let\glsenableentrycount\relax
  \renewcommand*{\glsenableentryunitcount}{%
    \PackageError{glossaries-extra}{\string\glsenableentryunitcount\space
     can't be used with \string\glsenableentrycount}%
    {Use one or other but not both commands}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@write@entrycounts}
% Modify this command so that it only writes the information for
% entries with the \catattr{entrycount} attribute and issue
% warning if no entries have this attribute set.
%    \begin{macrocode}
\renewcommand*{\@gls@write@entrycounts}{%
  \immediate\write\@auxout
    {\string\providecommand*{\string\@gls@entry@count}[2]{}}%
  \count@=0\relax
  \forallglsentries{\@glsentry}{%
    \glshasattribute{\@glsentry}{entrycount}%
    {%
      \ifglsused{\@glsentry}%
      {%
        \immediate\write\@auxout
         {\string\@gls@entry@count{\@glsentry}{\glsentrycurrcount{\@glsentry}}}%
      }%
      {}%
      \advance\count@ by \@ne
    }%
    {}%
  }%
  \ifnum\count@=0
    \GlossariesExtraWarningNoLine{Entry counting has been enabled 
     \MessageBreak with \string\glsenableentrycount\space but the 
     \MessageBreak attribute `entrycount' hasn't 
     \MessageBreak been assigned to any of the defined
     \MessageBreak entries}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrifcounttrigger}
%\begin{definition}
%\cs{glsxtrifcounttrigger}\marg{label}\marg{trigger format}\marg{normal}
%\end{definition}
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrifcounttrigger}[3]{%
 \glshasattribute{#1}{entrycount}%
 {%
   \ifnum\glsentryprevcount{#1}>\glsgetattribute{#1}{entrycount}\relax
    #3%
   \else
    #2%
   \fi
 }%
 {#3}% 
}
%    \end{macrocode}
%\end{macro}
%
% Actual internal definitions of \cs{cgls} used when entry counting
% is enabled.
%
%\begin{macro}{\@@cgls@}
%    \begin{macrocode}
\def\@@cgls@#1#2[#3]{%
  \glsxtrifcounttrigger{#2}%
  {%
    \cglsformat{#2}{#3}%
    \glsunset{#2}%
  }% 
  {%
    \@gls@{#1}{#2}[#3]%
  }%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@cglspl@}
%    \begin{macrocode}
\def\@@cglspl@#1#2[#3]{%
  \glsxtrifcounttrigger{#2}%
  {%
    \cglsplformat{#2}{#3}%
    \glsunset{#2}%
  }%
  {%
    \@glspl@{#1}{#2}[#3]%
  }%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@cGls@}
%    \begin{macrocode}
\def\@@cGls@#1#2[#3]{%
  \glsxtrifcounttrigger{#2}%
  {%
    \cGlsformat{#2}{#3}%
    \glsunset{#2}%
  }%
  {%
    \@Gls@{#1}{#2}[#3]%
  }%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@cGlspl@}
%    \begin{macrocode}
\def\@@cGlspl@#1#2[#3]{%
  \glsxtrifcounttrigger{#2}%
  {%
    \cGlsplformat{#2}{#3}%
    \glsunset{#2}%
  }%
  {%
    \@Glspl@{#1}{#2}[#3]%
  }%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@cGLS@}
%    \begin{macrocode}
\def\@@cGLS@#1#2[#3]{%
  \glsxtrifcounttrigger{#2}%
  {%
    \cGLSformat{#2}{#3}%
    \glsunset{#2}%
  }% 
  {%
    \@GLS@{#1}{#2}[#3]%
  }%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@cGLSpl@}
%    \begin{macrocode}
\def\@@cGLSpl@#1#2[#3]{%
  \glsxtrifcounttrigger{#2}%
  {%
    \cGLSplformat{#2}{#3}%
    \glsunset{#2}%
  }%
  {%
    \@GLSpl@{#1}{#2}[#3]%
  }%
}%
%    \end{macrocode}
%\end{macro}
%
% Remove default warnings from \cs{cgls} etc so that it can be used
% interchangeable with \cs{gls} etc.
%\begin{macro}{\@cgls@}
%    \begin{macrocode}
\def\@cgls@#1#2[#3]{\@gls@{#1}{#2}[#3]}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@cGls@}
%    \begin{macrocode}
\def\@cGls@#1#2[#3]{\@Gls@{#1}{#2}[#3]}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@cglspl@}
%    \begin{macrocode}
\def\@cglspl@#1#2[#3]{\@glspl@{#1}{#2}[#3]}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@cGlspl@}
%    \begin{macrocode}
\def\@cGlspl@#1#2[#3]{\@Glspl@{#1}{#2}[#3]}
%    \end{macrocode}
%\end{macro}
%
% Add all upper case versions not provided by \styfmt{glossaries}.
%\begin{macro}{\cGLS}
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newrobustcmd*{\cGLS}{\@gls@hyp@opt\@cGLS}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@cGLS}
%\changes{0.5}{2015-12-07}{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{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\def\@cGLS@#1#2[#3]{\@GLS@{#1}{#2}[#3]}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\cGLSformat}
%\changes{0.5}{2015-12-07}{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]{%
 \expandafter\mfirstucMakeUppercase\expandafter{\cglsformat{#1}{#2}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\cGLSpl}
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newrobustcmd*{\cGLSpl}{\@gls@hyp@opt\@cGLSpl}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@cGLSpl}
%\changes{0.5}{2015-12-07}{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{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\def\@cGLSpl@#1#2[#3]{\@GLSpl@{#1}{#2}[#3]}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\cGLSplformat}
%\changes{0.5}{2015-12-07}{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]{%
 \expandafter\mfirstucMakeUppercase\expandafter{\cglsplformat{#1}{#2}}%
}
%    \end{macrocode}
%\end{macro}
%
% Modify the trigger formats to check for the \catattr{regular} attribute.
%\begin{macro}{\cglsformat}
%\changes{0.5.4}{2015-12-15}{added}
%    \begin{macrocode}
\renewcommand*{\cglsformat}[2]{%
  \glsifregular{#1}
  {\glsentryfirst{#1}}%
  {\ifglshaslong{#1}{\glsentrylong{#1}}{\glsentryfirst{#1}}}#2%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\cGlsformat}
%\changes{0.5.4}{2015-12-15}{added}
%    \begin{macrocode}
\renewcommand*{\cGlsformat}[2]{%
  \glsifregular{#1}
  {\Glsentryfirst{#1}}%
  {\ifglshaslong{#1}{\Glsentrylong{#1}}{\Glsentryfirst{#1}}}#2%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\cglsplformat}
%\changes{0.5.4}{2015-12-15}{added}
%    \begin{macrocode}
\renewcommand*{\cglsplformat}[2]{%
  \glsifregular{#1}
  {\glsentryfirstplural{#1}}%
  {\ifglshaslong{#1}{\glsentrylongpl{#1}}{\glsentryfirstplural{#1}}}#2%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\cGlsplformat}
%\changes{0.5.4}{2015-12-15}{added}
%    \begin{macrocode}
\renewcommand*{\cGlsplformat}[2]{%
  \glsifregular{#1}
  {\Glsentryfirstplural{#1}}%
  {\ifglshaslong{#1}{\Glsentrylongpl{#1}}{\Glsentryfirstplural{#1}}}#2%
}
%    \end{macrocode}
%\end{macro}
%
%New code similar to above for unit counting.
%
%\begin{macro}{\@@newglossaryentry@defunitcounters}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\newcommand*{\@@newglossaryentry@defunitcounters}{%
  \edef\@glo@countunit{\csuse{@glsxtr@categoryattr@@\@glo@category @unitcount}}%
  \ifdefvoid\@glo@countunit
  {}%
  {%
    \@glsxtr@ifunitcounter{\@glo@countunit}%
    {}%
    {\expandafter\@glsxtr@addunitcounter\expandafter{\@glo@countunit}}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@unitcountlist}
%\changes{0.5.4}{2015-12-15}{new}
% List to keep track of which counters are being used by the entry
% unit count facility.
%    \begin{macrocode}
\newcommand*{\@glsxtr@unitcountlist}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@addunitcounter}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@addunitcounter}[1]{%
 \listadd{\@glsxtr@unitcountlist}{#1}%
 \ifcsundef{glsxtr@theunit@#1}
 {%
   \ifcsdef{theH#1}%
   {\csdef{glsxtr@theunit@#1}{\csuse{theH#1}}}%
   {\csdef{glsxtr@theunit@#1}{\csuse{the#1}}}%
 }%
 {}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@ifunitcounter}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@ifunitcounter}[3]{%
  \xifinlist{#1}{\@glsxtr@unitcountlist}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@currentunitcount}
%    \begin{macrocode}
\newcommand*\@glsxtr@currentunitcount[1]{%
 glo@\glsdetoklabel{#1}@currunit@\glsgetattribute{#1}{unitcount}.%
 \csuse{glsxtr@theunit@\glsgetattribute{#1}{unitcount}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@previousunitcount}
%    \begin{macrocode}
\newcommand*\@glsxtr@previousunitcount[1]{%
 glo@\glsdetoklabel{#1}@prevunit@\glsgetattribute{#1}{unitcount}.%
 \csuse{glsxtr@theunit@\glsgetattribute{#1}{unitcount}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@increment@currunitcount}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\newcommand*{\@gls@increment@currunitcount}[1]{%
  \glshasattribute{#1}{unitcount}%
  {%
    \edef\@glsxtr@csname{\@glsxtr@currentunitcount{#1}}%
    \ifcsundef{\@glsxtr@csname}%
    {%
      \csgdef{\@glsxtr@csname}{1}%
      \listcsxadd
       {glo@\glsdetoklabel{#1}@unitlist}%
       {\glsgetattribute{#1}{unitcount}.%
        \csuse{glsxtr@theunit@\glsgetattribute{#1}{unitcount}}%
       }%
    }%
    {%
      \csxdef{\@glsxtr@csname}%
      {\number\numexpr\csname\@glsxtr@csname\endcsname+1}%
    }%
  }%
  {}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@local@increment@currunitcount}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\newcommand*{\@gls@local@increment@currunitcount}[1]{%
  \glshasattribute{#1}{unitcount}%
  {%
    \edef\@glsxtr@csname{\@glsxtr@currentunitcount{#1}}%
    \ifcsundef{\@glsxtr@csname}%
    {%
      \csdef{\@glsxtr@csname}{1}%
      \listcseadd
       {glo@\glsdetoklabel{#1}@unitlist}%
       {\glsgetattribute{#1}{unitcount}.%
        \csuse{glsxtr@theunit@\glsgetattribute{#1}{unitcount}}%
       }%
    }%
    {%
      \csedef{\@glsxtr@csname}%
      {\number\numexpr\csname\@glsxtr@csname\endcsname+1}%
    }%
  }%
  {}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@currunitcount}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@currunitcount}[2]{%
 \ifcsundef
 {glo@\glsdetoklabel{#1}@currunit@#2}%
 {0}%
 {\csuse{glo@\glsdetoklabel{#1}@currunit@#2}}%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@prevunitcount}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@prevunitcount}[2]{%
 \ifcsundef
 {glo@\glsdetoklabel{#1}@prevunit@#2}%
 {0}%
 {\csuse{glo@\glsdetoklabel{#1}@prevunit@#2}}%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsenableentryunitcount}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\newcommand*{\glsenableentryunitcount}{%
%    \end{macrocode}
% Enable new fields:
%    \begin{macrocode}
  \appto\@newglossaryentry@defcounters{\@@newglossaryentry@defunitcounters}%
%    \end{macrocode}
% Just in case the user has switched on the \pkgopt{docdef} option.
%    \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\glsenableentryunitcount\space
      you must place all entry definitions in the preamble not in
      the document environment}%
    }%
  }%
%    \end{macrocode}
% New commands to access new fields:
%    \begin{macrocode}
  \newcommand*{\glsentrycurrcount}[1]{%
    \@glsxtr@currunitcount{##1}{\glsgetattribute{##1}{unitcount}.%
     \csuse{glsxtr@theunit@\glsgetattribute{##1}{unitcount}}}%
  }%
  \newcommand*{\glsentryprevcount}[1]{%
    \@glsxtr@prevunitcount{##1}{\glsgetattribute{##1}{unitcount}.%
     \csuse{glsxtr@theunit@\glsgetattribute{##1}{unitcount}}}%
  }%
%    \end{macrocode}
% Access total count:
%    \begin{macrocode}
  \newcommand*{\glsentryprevtotalcount}[1]{%
    \ifcsundef{glo@\glsdetoklabel{##1}@prevunittotal}%
    {0}%
    {%
      \number\csuse{glo@\glsdetoklabel{##1}@prevunittotal}
    }%
  }%
%    \end{macrocode}
% Access max value:
%    \begin{macrocode}
  \newcommand*{\glsentryprevmaxcount}[1]{%
    \ifcsundef{glo@\glsdetoklabel{##1}@prevunitmax}%
    {0}%
    {%
      \number\csuse{glo@\glsdetoklabel{##1}@prevunitmax}
    }%
  }%
%    \end{macrocode}
% Adjust post unset and reset:
%    \begin{macrocode}
  \let\@glsxtr@entryunitcount@org@unset\glsxtrpostunset
  \renewcommand*{\glsxtrpostunset}[1]{%
    \@glsxtr@entryunitcount@org@unset{##1}%
    \@gls@increment@currunitcount{##1}%
  }%
  \let\@glsxtr@entryunitcount@org@localunset\glsxtrpostlocalunset
  \renewcommand*{\glsxtrpostlocalunset}[1]{%
    \@glsxtr@entryunitcount@org@localunset{##1}%
    \@gls@local@increment@currunitcount{##1}%
  }%
  \let\@glsxtr@entryunitcount@org@reset\glsxtrpostreset
  \renewcommand*{\glsxtrpostreset}[1]{%
    \glshasattribute{##1}{unitcount}%
    {%
      \edef\@glsxtr@csname{\@glsxtr@currentunitcount{##1}}%
      \ifcsundef{\@glsxtr@csname}%
      {}%
      {\csgdef{\@glsxtr@csname}{0}}%
    }%
    {}%
  }%
  \let\@glsxtr@entryunitcount@org@localreset\glsxtrpostlocalreset
  \renewcommand*{\glsxtrpostlocalreset}[1]{%
    \@glsxtr@entryunitcount@org@localreset{##1}%
    \glshasattribute{##1}{unitcount}%
    {%
      \edef\@glsxtr@csname{\@glsxtr@currentunitcount{##1}}%
      \ifcsundef{\@glsxtr@csname}%
      {}%
      {\csdef{\@glsxtr@csname}{0}}%
    }%
    {}%
  }%
%    \end{macrocode}
% Modifications to take into account the attributes that govern
% whether the entry should be unset.
%    \begin{macrocode}
  \let\@cgls@\@@cgls@
  \let\@cglspl@\@@cglspl@
%    \end{macrocode}
%\changes{1.14}{2017-04-18}{fixed assignment of \cs{@cGls@}}
%    \begin{macrocode}
  \let\@cGls@\@@cGls@
  \let\@cGlspl@\@@cGlspl@
  \let\@cGLS@\@@cGLS@
  \let\@cGLSpl@\@@cGLSpl@
%    \end{macrocode}
% Write information to the aux file.
%    \begin{macrocode}
  \AtEndDocument{\@gls@write@entryunitcounts}%
  \renewcommand*{\@gls@entry@unitcount}[3]{%
    \csgdef{glo@\glsdetoklabel{##1}@prevunit@##3}{##2}%
    \ifcsundef{glo@\glsdetoklabel{##1}@prevunittotal}%
    {\csgdef{glo@\glsdetoklabel{##1}@prevunittotal}{##2}}%
    {%
      \csxdef{glo@\glsdetoklabel{##1}@prevunittotal}{
        \number\numexpr\csuse{glo@\glsdetoklabel{##1}@prevunittotal}+##2}%
    }%
    \ifcsundef{glo@\glsdetoklabel{##1}@prevunitmax}%
    {\csgdef{glo@\glsdetoklabel{##1}@prevunitmax}{##2}}%
    {%
      \ifnum\csuse{glo@\glsdetoklabel{##1}@prevunitmax}<##2
       \csgdef{glo@\glsdetoklabel{##1}@prevunitmax}{##2}%
      \fi
    }%
  }%
  \let\glsenableentryunitcount\relax
  \renewcommand*{\glsenableentrycount}{%
    \PackageError{glossaries-extra}{\string\glsenableentrycount\space
     can't be used with \string\glsenableentryunitcount}%
    {Use one or other but not both commands}%
  }%
}
\@onlypreamble\glsenableentryunitcount
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@entry@unitcount}
%    \begin{macrocode}
\newcommand*{\@gls@entry@unitcount}[3]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@write@entryunitcounts@do}
%    \begin{macrocode}
\newcommand*{\@gls@write@entryunitcounts@do}[1]{%
  \immediate\write\@auxout
   {\string\@gls@entry@unitcount
     {\@glsentry}%
     {\@glsxtr@currunitcount{\@glsentry}{#1}%
     }%
     {#1}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@write@entryunitcounts}
%    \begin{macrocode}
\newcommand*{\@gls@write@entryunitcounts}{%
  \immediate\write\@auxout
    {\string\providecommand*{\string\@gls@entry@unitcount}[3]{}}%
  \count@=0\relax
  \forallglsentries{\@glsentry}{%
    \glshasattribute{\@glsentry}{unitcount}%
    {%
      \ifglsused{\@glsentry}%
      {%
        \forlistcsloop
          {\@gls@write@entryunitcounts@do}%
          {glo@\glsdetoklabel{\@glsentry}@unitlist}%
      }%
      {}%
      \advance\count@ by \@ne
    }%
    {}%
  }%
  \ifnum\count@=0
    \GlossariesExtraWarningNoLine{Entry counting has been enabled 
     \MessageBreak with \string\glsenableentryunitcount\space but the 
     \MessageBreak attribute `unitcount' hasn't 
     \MessageBreak been assigned to any of the defined
     \MessageBreak entries}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrEnableEntryUnitCounting}
% The first argument is the list of categories, the second
% argument is the value of the \catattr{entrycount} attribute
% and the third is the counter name.
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\newcommand*{\GlsXtrEnableEntryUnitCounting}[3]{%
%    \end{macrocode}
% Enable entry counting:
%    \begin{macrocode}
  \glsenableentryunitcount
%    \end{macrocode}
% Redefine \cs{gls} etc:
%    \begin{macrocode}
  \renewcommand*{\gls}{\cgls}%
  \renewcommand*{\Gls}{\cGls}%
  \renewcommand*{\glspl}{\cglspl}%
  \renewcommand*{\Glspl}{\cGlspl}%
  \renewcommand*{\GLS}{\cGLS}%
  \renewcommand*{\GLSpl}{\cGLSpl}%
%    \end{macrocode}
% Set the \catattr{entrycount} attribute:
%    \begin{macrocode}
  \@glsxtr@setentryunitcountunsetattr{#1}{#2}{#3}%
%    \end{macrocode}
% In case this command is used again:
%    \begin{macrocode}
  \let\GlsXtrEnableEntryUnitCounting\@glsxtr@setentryunitcountunsetattr
  \renewcommand*{\GlsXtrEnableEntryCounting}[2]{%
   \PackageError{glossaries-extra}{\string\GlsXtrEnableEntryCounting\space
    can't be used with \string\GlsXtrEnableEntryUnitCounting}%
   {Use one or other but not both commands}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@setentryunitcountunsetattr}
%\changes{0.5.4}{2015-12-15}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@setentryunitcountunsetattr}[3]{%
 \@for\@glsxtr@cat:=#1\do
 {%
   \ifdefempty{\@glsxtr@cat}{}%
   {%
     \glssetcategoryattribute{\@glsxtr@cat}{entrycount}{#2}%
     \glssetcategoryattribute{\@glsxtr@cat}{unitcount}{#3}%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%
%\subsection{Acronym Modifications}
% It's more consistent to use the abbreviation code for acronyms,
% but make some adjustments to allow for continued use of the
% \styfmt{glossaries} package's custom acronym format. (For example,
% user may already have defined some acronym styles with
% \cs{newacronymstyle} which they would like to continue to use.)
% The original \styfmt{glossaries} acronym code can be restored 
% with \cs{RestoreAcronyms}, but adjust \cs{SetGenericNewAcronym} 
% so that \cs{newacronym} adds the category.
%
%\begin{macro}{\SetGenericNewAcronym}
%    \begin{macrocode}
\renewcommand*{\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},%
        category=acronym,
        \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}{}}%
}
%    \end{macrocode}
%\end{macro}
%
% This will cause a problem for glossaries that contain a mixture of
% acronyms and abbreviations, so redefine \cs{newacronym} to use the
% new abbreviation interface.
%
% First save the original definitions:
%    \begin{macrocode}
\let\@glsxtr@org@setacronymstyle\setacronymstyle
\let\@glsxtr@org@newacronymstyle\newacronymstyle
%    \end{macrocode}
%
%\begin{macro}{\MakeAcronymsAbbreviations}
% Make acronyms use the same interface as abbreviations.
% Note that \cs{newacronymstyle} has a different implementation to
% \cs{newabbrevationstyle} so disable \cs{newacronymstyle} and
% \cs{setacronymstyle}.
%\changes{0.4}{2015-12-03}{set the default type to \cs{acronymtype}}
%\changes{0.5.4}{2015-12-15}{now disables \cs{setacronymstyle}}
%    \begin{macrocode}
\newcommand*{\MakeAcronymsAbbreviations}{%
   \renewcommand*{\newacronym}[4][]{%
     \glsxtr@newabbreviation{type=\acronymtype,category=acronym,##1}{##2}{##3}{##4}%
   }%
   \renewcommand*{\firstacronymfont}[1]{\glsfirstabbrvfont{##1}}%
   \renewcommand*{\acronymfont}[1]{\glsabbrvfont{##1}}%
   \renewcommand*{\setacronymstyle}[1]{%
      \PackageError{glossaries-extra}{\string\setacronymstyle{##1}
      unavailable.
      Use \string\setabbreviationstyle\space instead.
      The original acronym interface can be restored with
      \string\RestoreAcronyms}{}%
   }%
   \renewcommand*{\newacronymstyle}[1]{%
      \GlossariesExtraWarning{New acronym style `##1' won't be
      available unless you restore the original acronym interface with
      \string\RestoreAcronyms}%
      \@glsxtr@org@newacronymstyle{##1}%
   }%
}
%    \end{macrocode}
%\end{macro}
%
% Switch acronyms to abbreviations:
%    \begin{macrocode}
\MakeAcronymsAbbreviations
%    \end{macrocode}
%
%\begin{macro}{\RestoreAcronyms}
% Restore acronyms to \styfmt{glossaries} interface.
%    \begin{macrocode}
\newcommand*{\RestoreAcronyms}{%
  \SetGenericNewAcronym
  \renewcommand{\firstacronymfont}[1]{\acronymfont{##1}}%
  \renewcommand{\acronymfont}[1]{##1}%
  \let\setacronymstyle\@glsxtr@org@setacronymstyle
  \let\newacronymstyle\@glsxtr@org@newacronymstyle
%    \end{macrocode}
%\changes{1.07}{2016-08-15}{modified \cs{@gls@link@checkfirsthyper} to set
%\cs{glsxtrifwasfirstuse}}
% Need to restore the original definition of \cs{@gls@link@checkfirsthyper}
% but \cs{glsxtrifwasfirstuse} still needs setting for the benefit
% of the post-link hook.
%    \begin{macrocode}
  \renewcommand*\@gls@link@checkfirsthyper{%
    \ifglsused{\glslabel}%
    {\let\glsxtrifwasfirstuse\@secondoftwo}
    {\let\glsxtrifwasfirstuse\@firstoftwo}%
    \@glsxtr@org@checkfirsthyper
  }
  \glssetcategoryattribute{acronym}{regular}{false}%
  \setacronymstyle{long-short}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsacspace}
% Allow the user to customise the maximum value.
%    \begin{macrocode}
\renewcommand*{\glsacspace}[1]{%
  \settowidth{\dimen@}{(\firstacronymfont{\glsentryshort{#1}})}%
  \ifdim\dimen@<\glsacspacemax~\else\space\fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsacspacemax}
% Value used in the above.
%    \begin{macrocode}
\newcommand*{\glsacspacemax}{3em}
%    \end{macrocode}
%\end{macro}
%
%\subsection{Indexing and Displaying Glossaries}
%From time-to-time users ask if they can have one glossary sorted
%normally and another sorted by definition or usage. With the
% base \styfmt{glossaries} package this can only be achieved with the
% \qt{noidx} commands (Option~1). This is an attempt to mix and
% match.
%
%First we need a list of the glossaries that require
%\gls{makeindex}\slash\gls{xindy}.
%\begin{macro}{\@glsxtr@reg@glosslist}
%\changes{1.0}{2016-01-24}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@reg@glosslist}{}
%    \end{macrocode}
%\end{macro}
% Save the original definition of \cs{makeglossaries}:
%    \begin{macrocode}
\let\@glsxtr@org@makeglossaries\makeglossaries
%    \end{macrocode}
%
% Redefine \cs{makeglossaries} to take an optional argument.
% This should be empty for the usual behaviour (all glossaries
% need processing with an indexing application) or a comma-separated
% list of glossary labels indicating those glossaries that should be
% processed with an indexing application. The optional argument
% version shouldn't be used with \pkgopt{record}.
%\begin{macro}{\makeglossaries}
%\changes{1.0}{2016-01-24}{new}
%    \begin{macrocode}
\renewcommand*{\makeglossaries}[1][]{%
 \ifx\@glsxtr@record@setting\@glsxtr@record@setting@only
  \PackageError{glossaries-extra}{\string\makeglossaries\space
   not permitted\MessageBreak with record=only package option}%
  {You may only use \string\makeglossaries\space with
   record=off or record=alsoindex options}%
 \else
   \ifblank{#1}%
   {\@glsxtr@org@makeglossaries}%
   {%
     \ifx\@glsxtr@record@setting\@glsxtr@record@setting@alsoindex
       \PackageError{glossaries-extra}{\string\makeglossaries[#1]\space
       not permitted\MessageBreak with record=alsoindex package option}%
       {You may only use the hybrid \string\makeglossaries[...]\space with
        record=off option}%
     \else
       \edef\@glsxtr@reg@glosslist{#1}%
       \ifundef{\glswrite}{\newwrite\glswrite}{}%
       \protected@write\@auxout{}{\string\providecommand
         \string\@glsorder[1]{}}
       \protected@write\@auxout{}{\string\providecommand
         \string\@istfilename[1]{}}
       \protected@write\@auxout{}{\string\@istfilename{\istfilename}}%
       \protected@write\@auxout{}{\string\@glsorder{\glsorder}}
       \protected@write\@auxout{}{\string\glsxtr@makeglossaries{#1}}
       \write\@auxout{\string\providecommand\string\@gls@reference[3]{}}%
%    \end{macrocode}
% Iterate through each supplied glossary type and activate it.
%    \begin{macrocode}
       \@for\@glo@type:=#1\do{%
        \ifdefempty{\@glo@type}{}{\@makeglossary{\@glo@type}}%
       }%
%    \end{macrocode}
% New glossaries must be created before \cs{makeglossaries}:
%    \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
%    \begin{macrocode}
        \let\@makeglossary\relax
        \let\makeglossary\relax
        \renewcommand\makeglossaries[1][]{}%
%    \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}
%Adjust \cs{@do@seeglossary}. This needs to check for the entry's
%existence but don't increment associated counter.
%    \begin{macrocode}
        \renewcommand*{\@do@seeglossary}[2]{%
          \glsdoifexists{##1}%
          {%
            \edef\@gls@label{\glsdetoklabel{##1}}%
            \edef\@gls@type{\csname glo@\@gls@label @type\endcsname}%
            \expandafter\DTLifinlist\expandafter{\@gls@type}{\@glsxtr@reg@glosslist}%
            {\@glsxtr@org@doseeglossary{##1}{##2}}%
            {%
              \@@glsxtrwrglossmark
              \protected@write\@auxout{}{%
                \string\@gls@reference
                  {\gls@type}{\@gls@label}{\string\glsseeformat##2{}}%
              }%
            }%
          }%
        }%
%    \end{macrocode}
% Adjust \cs{@@do@@wrglossary}
%    \begin{macrocode}
        \let\@glsxtr@@do@@wrglossary\@@do@@wrglossary
        \def\@@do@@wrglossary{%
          \edef\@gls@type{\csname glo@\@gls@label @type\endcsname}%
          \expandafter\DTLifinlist\expandafter{\@gls@type}{\@glsxtr@reg@glosslist}%
          {\@glsxtr@@do@@wrglossary}%
          {\gls@noidxglossary}%
        }%
%    \end{macrocode}
% Suppress warning about no \cs{makeglossaries}
%    \begin{macrocode}
        \let\warn@nomakeglossaries\relax
        \def\warn@noprintglossary{%
          \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}
% Only warn for glossaries not listed.
%    \begin{macrocode}
        \renewcommand{\@gls@noref@warn}[1]{%
          \edef\@gls@type{##1}%
          \expandafter\DTLifinlist\expandafter{\@gls@type}{\@glsxtr@reg@glosslist}%
          {%
            \GlossariesExtraWarning{Can't use
               \string\printnoidxglossary[type={\@gls@type}]
               when `\@gls@type' is listed in the optional argument of
               \string\makeglossaries}%
          }%
          {%
            \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}
% Adjust display number list to check for type:
%    \begin{macrocode}
        \renewcommand*{\glsdisplaynumberlist}[1]{%
          \expandafter\DTLifinlist\expandafter{##1}{\@glsxtr@reg@glosslist}%
          {\@glsxtr@idx@displaynumberlist{##1}}%
          {\@glsxtr@noidx@displaynumberlist{##1}}%
        }%
%    \end{macrocode}
% Adjust entry list:
%    \begin{macrocode}
        \renewcommand*{\glsentrynumberlist}[1]{%
          \expandafter\DTLifinlist\expandafter{##1}{\@glsxtr@reg@glosslist}%
          {\@glsxtr@idx@entrynumberlist{##1}}%
          {\@glsxtr@noidx@entrynumberlist{##1}}%
        }%
%    \end{macrocode}
% Adjust number list loop
%    \begin{macrocode}
        \renewcommand*{\glsnumberlistloop}[2]{%
          \expandafter\DTLifinlist\expandafter{##1}{\@glsxtr@reg@glosslist}%
          {%
             \PackageError{glossaries-extra}{\string\glsnumberlistloop\space
              not available for glossary `##1'}{}%
          }%
          {\@glsxtr@noidx@numberlistloop{##1}{##2}}%
        }%
%    \end{macrocode}
% Only sanitize sort for normal indexing glossaries.
%    \begin{macrocode}
        \renewcommand*{\glsprestandardsort}[3]{%
          \expandafter\DTLifinlist\expandafter{##2}{\@glsxtr@reg@glosslist}%
          {%
            \glsdosanitizesort
          }%
          {%
            \ifglssanitizesort
             \@gls@noidx@sanitizesort
            \else
             \@gls@noidx@nosanitizesort
            \fi
          }%
        }%
%    \end{macrocode}
% Unlike \cs{makenoidxglossaries} we can't automatically set
% sanitizesort=false. All entries must be defined in the preamble.
%    \begin{macrocode}
        \renewcommand*\new@glossaryentry[2]{%
          \PackageError{glossaries-extra}{Glossary entries must be defined
           in the preamble\MessageBreak when you use the optional argument
           of \string\makeglossaries}{Either move your definitions to the
           preamble or don't use the optional argument of
           \string\makeglossaries}%
        }%
%    \end{macrocode}
% Only activate sort key for glossaries that aren't listed in
% \verb|#1| (glossary label is stored in \cs{@glo@type} but this
% defaults to \cs{glsdefaulttype} so some expansion is required).
%    \begin{macrocode}
        \let\@glo@assign@sortkey\@glsxtr@mixed@assign@sortkey
        \renewcommand*{\@printgloss@setsort}{%
%    \end{macrocode}
% Need to extract just the \gloskey[printglossary]{type} value.
%    \begin{macrocode}
          \expandafter\@glsxtr@gettype\expandafter,\@glsxtr@printglossopts,%
            type=\glsdefaulttype,\@end@glsxtr@gettype
          \def\@glo@sorttype{\@glo@default@sorttype}%
        }%
%    \end{macrocode}
% Check \pkgopt{automake} setting:
%    \begin{macrocode}
        \ifglsautomake
          \renewcommand*{\@gls@doautomake}{%
            \@for\@gls@type:=\@glsxtr@reg@glosslist\do{%
              \ifdefempty{\@gls@type}{}{\@gls@automake{\@gls@type}}%
            }%
          }%
        \fi
%    \end{macrocode}
% Check the sort setting (\sty{glossaries} v4.30 onwards):
%    \begin{macrocode}
        \ifdef\@glo@check@sortallowed{\@glo@check@sortallowed\makeglossaries}{}%
     \fi
   }%
 \fi
}
%    \end{macrocode}
%\end{macro}
%
%The optional argument version of \cs{makeglossaries} needs an
%adjustment to \cs{@printglossary} to allow \cs{@glo@assign@sortkey}
%to pick up the glossary type.
%
%\begin{macro}{\@glsxtr@orgprintglossary}
%This no longer simply saves \cs{@printglossary} with \cs{let}
%but is actually defined
%to check for the existence of the title, since ignored 
%glossaries don't have a title assigned. (bib2gls writes
%\cs{provideignoredglossary} to the glstex file for some settings,
%so the glossary might not have been defined.)
%(This command is also used for on-the-fly setting.)
%    \begin{macrocode}
\newcommand{\@glsxtr@orgprintglossary}[2]{%
  \def\@glo@type{\glsdefaulttype}%
%    \end{macrocode}
%Add check here.
%    \begin{macrocode}
  \def\glossarytitle{%
     \ifcsdef{@glotype@\@glo@type @title}%
     {\csuse{@glotype@\@glo@type @title}}%
     {\glossaryname}}%
  \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}%
    \ifx\glossarytitle\org@glossarytitle
    \else
      \cslet{@glotype@\@glo@type @title}{\glossarytitle}%
    \fi
    \let\currentglossary\@glo@type
    \let\org@glossaryentrynumbers\glossaryentrynumbers
    \let\glsnonextpages\@glsnonextpages
    \let\glsnextpages\@glsnextpages
%    \end{macrocode}
%\changes{1.22}{2017-11-08}{changed explicit \cs{let} for \cs{nopostdesc}
%to \cs{glsxtractivatenopost}}
%    \begin{macrocode}
    \glsxtractivatenopost
    \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
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtractivatenopost}
%\changes{1.22}{2017-11-08}{new}
%Change \cs{nopostdesc} and \cs{glsxtrnopostpunc} to behave as they
%do in the glossary.
%    \begin{macrocode}
\newcommand*{\glsxtractivatenopost}{%
  \let\nopostdesc\@nopostdesc
  \let\glsxtrnopostpunc\@glsxtr@nopostpunc
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrnopostpunc}
%\changes{1.22}{2017-11-08}{new}
%    \begin{macrocode}
\newrobustcmd*{\glsxtrnopostpunc}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@nopostpunc}
%Provide a command that works like \cs{nopostdesc} but only
%switches of the punctuation without suppressing the post-description
%hook.
%\changes{1.22}{2017-11-08}{new}
%    \begin{macrocode}
\newcommand{\@glsxtr@nopostpunc}{%
 \let\@@glsxtr@org@postdescription\glspostdescription
 \ifglsnopostdot
   \renewcommand{\glspostdescription}{%
     \glsnopostdottrue
     \let\glspostdescription\@@glsxtr@org@postdescription
     \let\glsxtrrestorepostpunc\@glsxtr@restore@postpunc
     \glsxtrpostdescription
     \@glsxtr@nopostpunc@postdesc}%
 \else
   \renewcommand{\glspostdescription}{%
     \let\glspostdescription\@@glsxtr@org@postdescription
     \let\glsxtrrestorepostpunc\@glsxtr@restore@postpunc
     \glsxtrpostdescription
     \@glsxtr@nopostpunc@postdesc}%
 \fi
 \glsnopostdotfalse
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@nopostpunc@postdesc}
%\changes{1.23}{2017-11-12}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@nopostpunc@postdesc}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@restore@postpunc}
%\changes{1.23}{2017-11-12}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@restore@postpunc}{%
 \def\@glsxtr@nopostpunc@postdesc{%
   \@glsxtr@org@postdescription
   \let\@glsxtr@nopostpunc@postdesc\@empty
   \let\glsxtrrestorepostpunc\@empty
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrrestorepostpunc}
%\changes{1.23}{2017-11-12}{new}
%Does nothing outside of glossary.
%    \begin{macrocode}
\newcommand*{\glsxtrrestorepostpunc}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@printglossary}
%Redefine.
%\changes{1.09}{2016-12-16}{redefined to save options}
%    \begin{macrocode}
\renewcommand{\@printglossary}[2]{%
  \def\@glsxtr@printglossopts{#1}%
  \@glsxtr@orgprintglossary{#1}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%Add a key that switches off the entry targets:
%\changes{1.12}{2017-02-03}{added target key to printgloss family}
%    \begin{macrocode}
\define@choicekey{printgloss}{target}
[\@glsxtr@printglossval\@glsxtr@printglossnr]%
{true,false}[true]%
{%
  \ifcase\@glsxtr@printglossnr
%    \end{macrocode}
%\changes{1.31}{2018-05-09}{changed \cs{let} to \cs{def}}
%    \begin{macrocode}
    \def\@glstarget{\glsdohypertarget}%
  \else
    \let\@glstarget\@secondoftwo
  \fi
}
%    \end{macrocode}
%\begin{macro}{\@glsxtrhypernameprefix}
%\changes{1.20}{2017-09-11}{new}
%    \begin{macrocode}
\newcommand{\@glsxtrhypernameprefix}{}
%    \end{macrocode}
%\end{macro}
%
%New to v1.20:
%    \begin{macrocode}
\define@key{printgloss}{targetnameprefix}{%
  \renewcommand{\@glsxtrhypernameprefix}{#1}%
}
%    \end{macrocode}
%
%\changes{1.31}{2018-05-09}{added \texttt{prefix} key for \texttt{printgloss}}
%    \begin{macrocode}
\define@key{printgloss}{prefix}{%
  \renewcommand{\glolinkprefix}{#1}%
}
%    \end{macrocode}
%
%\begin{macro}{\glsdohypertarget}
%\changes{1.20}{2017-09-11}{added redefinition}
%Redefine to insert \cs{@glsxtrhypernameprefix} before the target
%name.
%    \begin{macrocode}
\let\@glsxtr@org@glsdohypertarget\glsdohypertarget
\renewcommand{\glsdohypertarget}[2]{%
  \@glsxtr@org@glsdohypertarget{\@glsxtrhypernameprefix#1}{#2}%
}
%    \end{macrocode}
%\changes{1.31}{2018-05-09}{bug fix: ensure that new version is picked up}
%Update \cs{@glstarget} to use \cs{def} instead being assigned with
%\cs{let} so that it can pick up the new definition and allow any
%further redefinitions:
%    \begin{macrocode}
\ifx\@glstarget\@glsxtr@org@glsdohypertarget
 \def\@glstarget{\glsdohypertarget}%
\fi
%\end{macro}
%    \end{macrocode}
%\begin{macro}{\glsxtr@makeglossaries}
%For the benefit of \app{makeglossaries}
%\changes{1.09}{2016-12-16}{new}
%    \begin{macrocode}
\newcommand*{\glsxtr@makeglossaries}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@gettype}
%Get just the type.
%\changes{1.09}{2016-12-16}{new}
%    \begin{macrocode}
\def\@glsxtr@gettype#1,type=#2,#3\@end@glsxtr@gettype{%
  \def\@glo@type{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@mixed@assign@sortkey}
%Assign the sort key.
%\changes{1.09}{2016-12-16}{new}
%    \begin{macrocode}
\newcommand\@glsxtr@mixed@assign@sortkey[1]{%
  \edef\@glo@type{\@glo@type}%
  \expandafter\DTLifinlist\expandafter{\@glo@type}{\@glsxtr@reg@glosslist}%
  {%
    \@glo@no@assign@sortkey{#1}%
  }%
  {%
    \@@glo@assign@sortkey{#1}%
  }%
}%
%    \end{macrocode}
%\end{macro}
% Display number list for the regular version:
%\begin{macro}{\@glsxtr@idx@displaynumberlist}
%\changes{1.0}{2016-01-24}{new}
%    \begin{macrocode}
\let\@glsxtr@idx@displaynumberlist\glsdisplaynumberlist
%    \end{macrocode}
%\end{macro}
%
% Display number list for the \qt{noidx} version:
%\begin{macro}{\@glsxtr@noidx@displaynumberlist}
%\changes{1.0}{2016-01-24}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@noidx@displaynumberlist}[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
  }%
  {%
%    \end{macrocode}
%\changes{1.17}{2017-08-09}{replace hard-coded ?? with
%\cs{glsxtrundeftag}}
%    \begin{macrocode}
    \glsxtrundeftag
    \glsdoifexists{#1}%
    {%
      \GlossariesWarning{Missing location list for `#1'. Either
        a rerun is required or you haven't referenced the entry.}%
    }%
  }%
}%

%    \end{macrocode}
%\end{macro}
%And for the number list loop:
%\begin{macro}{\@glsxtr@noidx@numberlistloop}
%\changes{1.0}{2016-01-24}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@noidx@numberlistloop}[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}%
  }%
  {%
%    \end{macrocode}
%\changes{1.17}{2017-08-09}{replace hard-coded ?? with
%\cs{glsxtrundeftag}}
%    \begin{macrocode}
    \glsxtrundeftag
    \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}
%\end{macro}
%
%Same for entry number list.
%\begin{macro}{\@glsxtr@noidx@entrynumberlist}
%\changes{1.0}{2016-01-24}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@noidx@entrynumberlist}[1]{%
  \letcs{\@gls@loclist}{glo@\glsdetoklabel{#1}@loclist}%
  \ifdef\@gls@loclist
  {%
    \glsnoidxloclist{\@gls@loclist}%
  }%
  {%
%    \end{macrocode}
%\changes{1.17}{2017-08-09}{replace hard-coded ?? with
%\cs{glsxtrundeftag}}
%    \begin{macrocode}
    \glsxtrundeftag
    \glsdoifexists{#1}%
    {%
      \GlossariesWarning{Missing location list for `#1'. Either
        a rerun is required or you haven't referenced the entry.}%
    }%
  }%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@idx@entrynumberlist}
%\changes{1.0}{2016-01-24}{new}
%\changes{1.04}{2016-05-02}{switched from \cs{let} to \cs{newcommand}}
%    \begin{macrocode}
\newcommand*{\@glsxtr@idx@entrynumberlist}[1]{\glsentrynumberlist{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@noidx@getgrouptitle}
%\changes{1.14}{2017-04-18}{new}
%\changes{1.16}{2017-06-15}{fixed bug}
%Patch.
%    \begin{macrocode}
\renewcommand*{\@gls@noidx@getgrouptitle}[2]{%
  \protected@edef\@glsxtr@titlelabel{#1}%
  \ifdefvoid\@glsxtr@titlelabel
  {}%
  {%
    \protected@edef\@glsxtr@titlelabel{\csuse{glsxtr@grouptitle@#1}}%
  }%
  \ifdefvoid{\@glsxtr@titlelabel}%
  {%
    \DTLifint{#1}%
    {%
      \ifnum#1<256\relax
        \edef#2{\char#1\relax}%
      \else
        \edef#2{#1}%
      \fi
    }%
    {%
      \ifcsundef{#1groupname}%
      {\def#2{#1}}%
      {\letcs#2{#1groupname}}%
    }%
  }%
  {%
    \let#2\@glsxtr@titlelabel
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@org@getgrouptitle}
%\changes{1.14}{2017-04-18}{new}
%Save original definition of \cs{@gls@getgrouptitle}
%    \begin{macrocode}
\let\glsxtr@org@getgrouptitle\@gls@getgrouptitle
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrgetgrouptitle}
%\changes{1.14}{2017-04-18}{new}
%Provide a user-level command to fetch the group title. The first
%argument is the group label. The second argument is a control
%sequence in which to store the title.
%    \begin{macrocode}
\newrobustcmd{\glsxtrgetgrouptitle}[2]{%
  \protected@edef\@glsxtr@titlelabel{glsxtr@grouptitle@#1}%
  \@onelevel@sanitize\@glsxtr@titlelabel
  \ifcsdef{\@glsxtr@titlelabel}
  {\letcs{#2}{\@glsxtr@titlelabel}}%
  {\glsxtr@org@getgrouptitle{#1}{#2}}%
}
\let\@gls@getgrouptitle\glsxtrgetgrouptitle
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrsetgrouptitle}
%\changes{1.14}{2017-04-18}{new}
%Sets the title for the given group label.
%\changes{1.28}{2018-03-06}{changed \cs{csxdef} \cs{protected@csxdef}}
%    \begin{macrocode}
\newcommand{\glsxtrsetgrouptitle}[2]{%
  \protected@edef\@glsxtr@titlelabel{glsxtr@grouptitle@#1}%
  \@onelevel@sanitize\@glsxtr@titlelabel
  \protected@csxdef{\@glsxtr@titlelabel}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrlocalsetgrouptitle}
%\changes{1.24}{2017-11-14}{new}
%As above put only locally defines the title.
%\changes{1.28}{2018-03-06}{changed \cs{csedef} \cs{protected@csedef}}
%    \begin{macrocode}
\newcommand{\glsxtrlocalsetgrouptitle}[2]{%
  \protected@edef\@glsxtr@titlelabel{glsxtr@grouptitle@#1}%
  \@onelevel@sanitize\@glsxtr@titlelabel
  \protected@csedef{\@glsxtr@titlelabel}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsnavigation}
%\changes{1.14}{2017-04-18}{new}
%Redefine to use new user-level command.
%    \begin{macrocode}
\renewcommand*{\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
    \glsxtrgetgrouptitle{\@gls@tmp}{\@gls@grptitle}%
    \glsnavhyperlink{\@gls@tmp}{\@gls@grptitle}%
    \let\@gls@between\glshypernavsep
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@print@noidx@glossary}
%\changes{1.11}{2017-01-19}{added redefinition}
%    \begin{macrocode}
\renewcommand*{\@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
%    \end{macrocode}
%Moved this command definition outside of environment in case of
%scoping issues (e.g. in tabular-like styles).
%    \begin{macrocode}
    \def\@gls@currentlettergroup{}%
    \begin{theglossary}%
    \glossaryheader
    \glsresetentrylist
    \forlistcsloop{\@gls@noidx@do}{@glsref@\@glo@type}%
    \end{theglossary}%
    \glossarypostamble
  }%
  {%
%    \end{macrocode}
%Add section header if there are actually entries defined in this
%glossary as the document is likely pending a re-run.
%    \begin{macrocode}
    \glsxtrifemptyglossary{\@glo@type}%
    {}%
    {\glossarysection[\glossarytoctitle]{\glossarytitle}}%
    \@gls@noref@warn{\@glo@type}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsnoidxdisplayloc}
%\changes{1.12}{2017-02-03}{added redefinition}
%Patch to check for range formations.
%    \begin{macrocode}
\renewcommand*{\glsnoidxdisplayloc}[4]{%
  \setentrycounter[#1]{#2}%
  \@glsxtr@display@loc#3\empty\end@glsxtr@display@loc{#4}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@display@loc}
%\changes{1.12}{2017-02-03}{new}
%Patch to check for range formations.
%    \begin{macrocode}
\def\@glsxtr@display@loc#1#2\end@glsxtr@display@loc#3{%
  \ifx#1(\relax
    \glsxtrdisplaystartloc{#2}{#3}%
  \else
    \ifx#1)\relax
      \glsxtrdisplayendloc{#2}{#3}%
    \else
      \glsxtrdisplaysingleloc{#1#2}{#3}%
    \fi
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrdisplaysingleloc}
%\changes{1.12}{2017-02-03}{new}
%Single location.
%    \begin{macrocode}
\newcommand*{\glsxtrdisplaysingleloc}[2]{%
  \csuse{#1}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%By default the range identifiers are simply ignored.
%A custom list loop handler can be defined by the user
%to test for ranges by checking the definition of
%\cs{glsxtrlocrangefmt}.
%
%\begin{macro}{\glsxtrdisplaystartloc}
%\changes{1.12}{2017-02-03}{new}
%Start of a location range.
%    \begin{macrocode}
\newcommand*{\glsxtrdisplaystartloc}[2]{%
  \edef\glsxtrlocrangefmt{#1}%
  \ifx\glsxtrlocrangefmt\empty
    \def\glsxtrlocrangefmt{glsnumberformat}%
  \fi
  \expandafter\glsxtrdisplaysingleloc
    \expandafter{\glsxtrlocrangefmt}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrdisplayendloc}
%\changes{1.12}{2017-02-03}{new}
%\changes{1.14}{2017-04-18}{added check for empty format}
%End of a location range.
%    \begin{macrocode}
\newcommand*{\glsxtrdisplayendloc}[2]{%
  \edef\@glsxtr@tmp{#1}%
  \ifdefempty{\@glsxtr@tmp}{\def\@glsxtr@tmp{glsnumberformat}}{}%
  \ifx\glsxtrlocrangefmt\@glsxtr@tmp
  \else
    \GlossariesExtraWarning{Mismatched end location range 
      (start=\glsxtrlocrangefmt, end=\@glsxtr@tmp)}%
  \fi
  \expandafter\glsxtrdisplayendlochook\expandafter{\@glsxtr@tmp}{#2}%
  \expandafter\glsxtrdisplaysingleloc
    \expandafter{\glsxtrlocrangefmt}{#2}%
  \def\glsxtrlocrangefmt{}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrdisplayendlochook}
%\changes{1.12}{2017-02-03}{new}
%Allow the user to hook into the end of range command.
%    \begin{macrocode}
\newcommand*{\glsxtrdisplayendlochook}[2]{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrlocrangefmt}
%\changes{1.12}{2017-02-03}{new}
%Current range format. Empty if not in a range.
%    \begin{macrocode}
\newcommand*{\glsxtrlocrangefmt}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\setentrycounter}
%\changes{1.29}{2018-04-09}{new}
%Adjust \cs{setentrycounter} to save the original prefix.
%    \begin{macrocode}
\renewcommand*{\setentrycounter}[2][]{%
  \def\glsxtrcounterprefix{#1}%
  \ifx\glsxtrcounterprefix\@empty
    \def\@glo@counterprefix{.}%
  \else
    \def\@glo@counterprefix{.#1.}%
  \fi
  \def\glsentrycounter{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@removespaces}
%\changes{1.14}{2017-04-18}{new}
%Redefine to allow adjustments to location hyperlink.
%    \begin{macrocode}
\def\@gls@removespaces#1 #2\@nil{%
 \toks@=\expandafter{\the\toks@#1}%
 \ifx\\#2\\%
   \edef\x{\the\toks@}%
   \ifx\x\empty
   \else
%    \end{macrocode}
%Expand location (just in case \cs{toks@} is needed for something
%else).
%\changes{1.29}{2018-04-09}{added expansion}
%    \begin{macrocode}
    \expandafter\glsxtrlocationhyperlink\expandafter
     \glsentrycounter\expandafter\@glo@counterprefix\expandafter{\the\toks@}%
   \fi
 \else
   \@gls@ReturnAfterFi{%
     \@gls@removespaces#2\@nil
   }%
 \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrlocationhyperlink}
%\changes{1.14}{2017-04-18}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrlocationhyperlink}[3]{%
  \ifdefvoid\glsxtrsupplocationurl
  {%
    \GlsXtrInternalLocationHyperlink{#1}{#2}{#3}%
  }%
  {%
    \hyperref{\glsxtrsupplocationurl}{}{#1#2#3}{#3}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrsupphypernumber}
%\changes{1.14}{2017-04-18}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrsupphypernumber}[1]{%
 {%
   \glshasattribute{\glscurrententrylabel}{externallocation}%
   {%
     \def\glsxtrsupplocationurl{%
       \glsgetattribute{\glscurrententrylabel}{externallocation}}%
   }%
   {%
     \def\glsxtrsupplocationurl{}%
   }%
   \glshypernumber{#1}%
 }%
}
%    \end{macrocode}
%\end{macro}
%
% Give a bit of assistance to new users who are confused and don't
% know how to read transcript messages.
%\begin{macro}{\@print@glossary}
%\changes{0.3}{2015-12-02}{added redefinition}
%    \begin{macrocode}
\renewcommand{\@print@glossary}{%
  \makeatletter
  \@input@{\jobname.\csname @glotype@\@glo@type @in\endcsname}%
  \IfFileExists{\jobname.\csname @glotype@\@glo@type @in\endcsname}%
  {}%
  {\glsxtrNoGlossaryWarning{\@glo@type}}%
  \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}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
% Setup the warning text to display if the external file for the given
% glossary is missing.
%
%\begin{macro}{\GlsXtrNoGlsWarningHead}
% Header message.
%    \begin{macrocode}
\newcommand{\GlsXtrNoGlsWarningHead}[2]{%
 This document is incomplete. The external file associated with
 the glossary `#1' (which should be called \texttt{#2})
 hasn't been created.%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrNoGlsWarningEmptyStart}
% No entries have been added to the glossary.
%    \begin{macrocode}
\newcommand{\GlsXtrNoGlsWarningEmptyStart}{%
  This has probably happened because there are no entries defined 
  in this glossary.%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrNoGlsWarningEmptyMain}
% The default \qt{main} glossary is empty.
%    \begin{macrocode}
\newcommand{\GlsXtrNoGlsWarningEmptyMain}{%
 If you don't want this glossary,
 add \texttt{nomain} to your package option list when you load
 \texttt{glossaries-extra.sty}. For example:%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrNoGlsWarningEmptyNotMain}
% A glossary that isn't the default \qt{main} glossary is empty.
%    \begin{macrocode}
\newcommand{\GlsXtrNoGlsWarningEmptyNotMain}[1]{%
 Did you forget to use \texttt{type=#1} when you defined your
 entries? If you tried to load entries into this glossary with
 \texttt{\string\loadglsentries} did you remember to use
 \texttt{[#1]} as the optional argument? If you did, check that
 the definitions in the file you loaded all had the type set
 to \texttt{\string\glsdefaulttype}.%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrNoGlsWarningCheckFile}
% Advisory message to check the file contents.
%    \begin{macrocode}
\newcommand{\GlsXtrNoGlsWarningCheckFile}[1]{%
  Check the contents of the file \texttt{#1}. If
  it's empty, that means you haven't indexed any of your entries in this
  glossary (using commands like \texttt{\string\gls} or
  \texttt{\string\glsadd}) so this list can't be generated.
  If the file isn't empty, the document build process hasn't been
  completed.%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrNoGlsWarningAutoMake}
% Message when \pkgopt{automake} option has been used.
%    \begin{macrocode}
\newcommand{\GlsXtrNoGlsWarningAutoMake}[1]{%
  You may need to rerun \LaTeX. If you already have, it may be that
  \TeX's shell escape doesn't allow you to run
  \ifglsxindy xindy\else makeindex\fi. Check the
  transcript file \texttt{\jobname.log}. If the shell escape is
  disabled, try one of the following:

  \begin{itemize}
    \item Run the external (Lua) application:

       \texttt{makeglossaries-lite.lua \string"\jobname\string"}

    \item Run the external (Perl) application:

       \texttt{makeglossaries \string"\jobname\string"}
  \end{itemize}
  
  Then rerun \LaTeX\ on this document.
  \GlossariesExtraWarning{Rerun required to build the 
  glossary `#1' or check TeX's shell escape allows
  you to run \ifglsxindy xindy\else makeindex\fi}%
}
%    \end{macrocode}
%\end{macro}
%
%\changes{0.5.3}{2015-12-09}{removed \cs{GlsXtrNoGlsWarningNoAutoMakeMain}}
%
%\begin{macro}{\GlsXtrNoGlsWarningMisMatch}
% Mismatching \cs{makenoidxglossaries}.
%    \begin{macrocode}
\newcommand{\GlsXtrNoGlsWarningMisMatch}{%
  You need to either replace \texttt{\string\makenoidxglossaries}
  with \texttt{\string\makeglossaries} or replace
  \texttt{\string\printglossary} (or \texttt{\string\printglossaries}) with
  \texttt{\string\printnoidxglossary}
  (or \texttt{\string\printnoidxglossaries}) and then rebuild
  this document.%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrNoGlsWarningBuildInfo}
% Build advice.
%    \begin{macrocode}
\newcommand{\GlsXtrNoGlsWarningBuildInfo}{%
  Try one of the following:
  \begin{itemize}
    \item Add \texttt{automake} to your package option list when you load
          \texttt{glossaries-extra.sty}. For example:

          \texttt{\string\usepackage[automake]%
              \glsopenbrace glossaries-extra\glsclosebrace}

    \item Run the external (Lua) application:

          \texttt{makeglossaries-lite.lua \string"\jobname\string"}

    \item Run the external (Perl) application:

          \texttt{makeglossaries \string"\jobname\string"}
  \end{itemize}
  
  Then rerun \LaTeX\ on this document.%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrRecordWarning}
% Paragraph for \pkgopt[only]{record}.
%\changes{1.31}{2018-05-09}{new}
%    \begin{macrocode}
\newcommand{\GlsXtrRecordWarning}[1]{%
 \texttt{\string\printglossary} doesn't work
 with the \texttt{record=only} package option 
 use\par\texttt{\string\printunsrtglossary[type=#1]}\par
 instead (or change the package option).%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrNoGlsWarningTail}
% Final paragraph.
%    \begin{macrocode}
\newcommand{\GlsXtrNoGlsWarningTail}{%
 This message will be removed once the problem has been fixed.%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrNoGlsWarningNoOut}
% No out file created.
% Build advice.
%    \begin{macrocode}
\newcommand{\GlsXtrNoGlsWarningNoOut}[1]{%
  The file \texttt{#1} doesn't exist. This most likely means you haven't used
  \texttt{\string\makeglossaries} or you have used
  \texttt{\string\nofiles}. If this is just a draft version of the
  document, you can suppress this message using the 
  \texttt{nomissingglstext} package option.%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@defaultnoglossarywarning}
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@defaultnoglossarywarning}[1]{%
 \glossarysection[\glossarytoctitle]{\glossarytitle}
 \GlsXtrNoGlsWarningHead{#1}{\jobname.\csname @glotype@\@glo@type @in\endcsname}
 \par
 \glsxtrifemptyglossary{#1}%
 {%
    \GlsXtrNoGlsWarningEmptyStart\space
    \ifthenelse{\equal{#1}{main}}{\GlsXtrNoGlsWarningEmptyMain\par
    \medskip
    \noindent\texttt{\string\usepackage[nomain\ifglsacronym ,acronym\fi]%
        \glsopenbrace glossaries-extra\glsclosebrace}
    \medskip
    }%
    {\GlsXtrNoGlsWarningEmptyNotMain{#1}}%
 }%
 {%
   \IfFileExists{\jobname.\csname @glotype@\@glo@type @out\endcsname}
   {%
     \GlsXtrNoGlsWarningCheckFile
       {\jobname.\csname @glotype@\@glo@type @out\endcsname}

     \ifglsautomake
 
      \GlsXtrNoGlsWarningAutoMake{#1}

     \else

        \ifthenelse{\equal{#1}{main}}%
        {%
          \GlsXtrNoGlsWarningEmptyMain\par
          \medskip
          \noindent\texttt{\string\usepackage[nomain]%
            \glsopenbrace glossaries-extra\glsclosebrace}
          \medskip
        }%
        {}%

        \ifdefequal\makeglossaries\@no@makeglossaries
        {%
          \GlsXtrNoGlsWarningMisMatch
        }%
        {%
          \GlsXtrNoGlsWarningBuildInfo
        }%
     \fi
   }%
   {%
     \GlsXtrNoGlsWarningNoOut
       {\jobname.\csname @glotype@\@glo@type @out\endcsname}%
   }%
 }%
 \par
 \GlsXtrNoGlsWarningTail
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@record@noglossarywarning}
%\changes{1.31}{2018-05-09}{new}
%Warn about using \cs{printglossary} with \pkgopt{record}
%    \begin{macrocode}
\newcommand*{\@glsxtr@record@noglossarywarning}[1]{%
  \GlossariesExtraWarning{\string\printglossary\space doesn't work\MessageBreak
  with record=only package option\MessageBreak(use
  \string\printunsrtglossary[type=#1])\MessageBreak
  instead (or change the package option)}%
 \glossarysection[\glossarytoctitle]{\glossarytitle}
 \GlsXtrRecordWarning{#1}
 \GlsXtrNoGlsWarningTail
}
%    \end{macrocode}
%\end{macro}
%
%Provide some commands to accompany the \pkgopt{record} option
%for use with \href{https://github.com/nlct/bib2gls}{bib2gls}.
%\begin{macro}{\glsxtrresourcefile}
%\changes{1.08}{2016-12-13}{new}
%\changes{1.11}{2017-01-19}{changed extension to .glstex}
%Since it's dangerous for an external application to
%create a file with a .tex extension, as from v1.11 this 
%enforces a .glstex extension to avoid conflict.
%    \begin{macrocode}
\newcommand*{\glsxtrresourcefile}[2][]{%
%    \end{macrocode}
%The \pkgopt{record} option can't be set after this command.
%\changes{1.21}{2017-11-03}{now disables record key}
%    \begin{macrocode}
  \disable@keys{glossaries-extra.sty}{record}%
  \glsxtr@writefields
  \protected@write\@auxout{\glsxtrresourceinit}{\string\glsxtr@resource{#1}{#2}}%
  \let\@glsxtr@org@see@noindex\@gls@see@noindex
  \let\@gls@see@noindex\relax
  \IfFileExists{#2.glstex}%
  {%
%    \end{macrocode}
%Can't scope \cs{@input} so save and restore the category code of
%\texttt{@} to allow for internal commands in the location list.
%\changes{1.12}{2017-02-03}{added catcode change for @}
%    \begin{macrocode}
    \edef\@bibgls@restoreat{\noexpand\catcode\noexpand`\noexpand\@=\number\catcode`\@}%
    \makeatletter
    \@input{#2.glstex}%
    \@bibgls@restoreat
  }%
  {%
    \GlossariesExtraWarning{No file `#2.glstex'}% 
  }%
  \let\@gls@see@noindex\@glsxtr@org@see@noindex
}
\@onlypreamble\glsxtrresourcefile
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrresourceinit}
%\changes{1.21}{2017-11-03}{new}
%Code used during the protected write operation.
%    \begin{macrocode}
\newcommand*{\glsxtrresourceinit}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrresourcecount}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcount\glsxtrresourcecount
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\GlsXtrLoadResources}
%\changes{1.11}{2017-01-19}{new}
%\changes{1.12}{2017-02-03}{removed restriction on only one per document}
%Short cut that uses \cs{glsxtrresourcefile} with \cs{jobname} as
%the mandatory argument.
%    \begin{macrocode}
\newcommand*{\GlsXtrLoadResources}[1][]{%
  \ifnum\glsxtrresourcecount=0\relax
    \glsxtrresourcefile[#1]{\jobname}%
  \else
    \glsxtrresourcefile[#1]{\jobname-\the\glsxtrresourcecount}%
  \fi
  \advance\glsxtrresourcecount by 1\relax
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@resource}
%\changes{1.08}{2016-12-13}{new}
%    \begin{macrocode}
\newcommand*{\glsxtr@resource}[2]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@fields}
%\changes{1.11}{2017-01-19}{new}
%    \begin{macrocode}
\newcommand*{\glsxtr@fields}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@texencoding}
%\changes{1.11}{2017-01-19}{new}
%    \begin{macrocode}
\newcommand*{\glsxtr@texencoding}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@langtag}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand*{\glsxtr@langtag}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@pluralsuffixes}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand*{\glsxtr@pluralsuffixes}[4]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@shortcutsval}
%\changes{1.11}{2017-01-19}{new}
%    \begin{macrocode}
\newcommand*{\glsxtr@shortcutsval}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@linkprefix}
%\changes{1.11}{2017-01-19}{new}
%    \begin{macrocode}
\newcommand*{\glsxtr@linkprefix}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@writefields}
%\changes{1.11}{2017-01-19}{new}
%This information only needs to be written once, so disable it after
%it's been used.
%    \begin{macrocode}
\newcommand*{\glsxtr@writefields}{%
%    \end{macrocode}
%\changes{1.16}{2017-06-15}{added \cs{providecommand} lines}
%    \begin{macrocode}
  \protected@write\@auxout{}%
   {\string\providecommand*{\string\glsxtr@fields}[1]{}}%
  \protected@write\@auxout{}%
   {\string\providecommand*{\string\glsxtr@resource}[2]{}}%
  \protected@write\@auxout{}%
   {\string\providecommand*{\string\glsxtr@pluralsuffixes}[4]{}}%
  \protected@write\@auxout{}%
   {\string\providecommand*{\string\glsxtr@shortcutsval}[1]{}}%
  \protected@write\@auxout{}%
   {\string\providecommand*{\string\glsxtr@linkprefix}[1]{}}%
  \protected@write\@auxout{}{\string\glsxtr@fields{\@gls@keymap}}%
%    \end{macrocode}
%\changes{1.22}{2017-11-08}{provide \cs{glsxtr@record} in aux file}
%    \begin{macrocode}
  \protected@write\@auxout{}%
   {\string\providecommand*{\string\glsxtr@record}[5]{}}%
%    \end{macrocode}
%If any languages have been loaded, the language tag will be
%available in \cs{CurrentTrackedLanguageTag} (provided by
%\sty{tracklang}). For multilingual
%documents, the required locale will have to be indicated in the
%"sort" key when using \cs{glsxtrresourcefile}.
%    \begin{macrocode}
  \ifdef\CurrentTrackedLanguageTag
  {%
     \protected@write\@auxout{}{%
       \string\glsxtr@langtag{\CurrentTrackedLanguageTag}}%
  }%
  {}%
  \protected@write\@auxout{}{\string\glsxtr@pluralsuffixes
    {\glspluralsuffix}{\abbrvpluralsuffix}{\acrpluralsuffix}%
    {\glsxtrabbrvpluralsuffix}}%
  \ifdef\inputencodingname
  {%
     \protected@write\@auxout{}{\string\glsxtr@texencoding{\inputencodingname}}%
  }%
  {%
%    \end{macrocode}
%If \sty{fontspec} has been loaded, assume UTF-8. (The encoding can
%be changed with \cs{XeTeXinputencoding}, but I can't work out how
%to determine the current encoding.)
%    \begin{macrocode}
     \@ifpackageloaded{fontspec}%
     {\protected@write\@auxout{}{\string\glsxtr@texencoding{utf8}}}%
     {}%
  }%
  \protected@write\@auxout{}{\string\glsxtr@shortcutsval{\@glsxtr@shortcutsval}}%
%    \end{macrocode}
%Prefix deferred until the beginning of the document in case it's
%redefined later in the preamble. This is picked up by bib2gls when
%the external option is used.
%    \begin{macrocode}
  \AtBeginDocument
    {\protected@write\@auxout{}{\string\glsxtr@linkprefix{\glolinkprefix}}}%
  \let\glsxtr@writefields\relax
%    \end{macrocode}
%If the \pkgopt{automake} option is on, try running bib2gls if
%the aux file exists.
%\changes{1.14}{2017-04-18}{added check for automake}
%\changes{1.19}{2017-09-09}{removed double-quotes around \cs{jobname}}
%The double-quotes around \cs{jobname} have been removed (v1.19)
%since \cs{jobname} will include double-quotes if the file name has
%spaces.
%    \begin{macrocode}
  \ifglsautomake
    \IfFileExists{\jobname.aux}%
    {\immediate\write18{bib2gls \jobname}}{}%
%    \end{macrocode}
%If \cs{makeglossaries} is also used, allow makeindex/xindy to
%also be run, otherwise disable the error message about requiring
%\cs{makeglossaries} with \pkgopt[true]{automake}.
%    \begin{macrocode}
    \ifx\@gls@doautomake\@gls@doautomake@err
       \let\@gls@doautomake\relax
    \fi
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@do@automake@err}
%\changes{1.14}{2017-04-18}{new}
%    \begin{macrocode}
\newcommand*{\@gls@doautomake@err}{%
  \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.%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%Allow locations specific to a particular counter to be recorded.
%\begin{macro}{\glsxtr@record}
%\changes{1.08}{2016-12-13}{new}
%    \begin{macrocode}
\newcommand*{\glsxtr@record}[5]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@counterrecord}
%\changes{1.12}{2017-02-03}{new}
%Aux file command.
%    \begin{macrocode}
\newcommand*{\glsxtr@counterrecord}[3]{%
  \glsxtrfieldlistgadd{#1}{record.#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@counterrecordhook}
%\changes{1.12}{2017-02-03}{new}
%Hook used by \cs{@glsxtr@dorecord}.
%    \begin{macrocode}
\newcommand*{\@glsxtr@counterrecordhook}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrRecordCounter}
%\changes{1.12}{2017-02-03}{new}
%Activate recording for a particular counter (identified in the
%argument).
%    \begin{macrocode}
\newcommand*{\GlsXtrRecordCounter}[1]{%
  \@@glsxtr@recordcounter{#1}%
}
\@onlypreamble\GlsXtrRecordCounter
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@docounterrecord}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@docounterrecord}[1]{%
  \protected@write\@auxout{}{\string\glsxtr@counterrecord
    {\@gls@label}{#1}{\csuse{the#1}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrglossentry}
%Users may prefer to have entries displayed throughout the document
%rather than gathered together in a list. This command emulates
%the way \cs{glossentry} behaves (without the style formatting
%commands like \cs{item}). This needs to define \cs{currentglossary}
%to the current glossary type (normally set at the start of
%\cs{@printglossary}) and needs to define \cs{glscurrententrylabel}
%to the entry's label (normally set before \cs{glossentry} and
%\cs{subglossentry}). This needs some protection in case it's used
%in a section heading.
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrglossentry}[1]{%
  \glsxtrtitleorpdforheading
  {\@glsxtrglossentry{#1}}%
  {\glsentryname{#1}}%
  {\glsxtrheadname{#1}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glsxtrglossentry}
%\changes{1.21}{2017-11-03}{new}
%Another test is needed in case \cs{@glsxtrglossentry} has been
%written to the table of contents.
%    \begin{macrocode}
\newrobustcmd*{\@glsxtrglossentry}[1]{%
  \glsxtrtitleorpdforheading
  {%
    \glsdoifexists{#1}%
    {%
      \begingroup
        \edef\glscurrententrylabel{\glsdetoklabel{#1}}%
        \edef\currentglossary{\GlsXtrStandaloneGlossaryType}%
        \ifglshasparent{#1}%
        {\GlsXtrStandaloneSubEntryItem{#1}}%
        {\glsentryitem{#1}}%
        \glstarget{#1}{\glossentryname{#1}}%
      \endgroup
    }%
  }%
  {\glsentryname{#1}}%
  {\glsxtrheadname{#1}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrStandaloneGlossaryType}
%\changes{1.31}{2018-05-09}{new}
%To make it easier to adjust the definition of \cs{currentglossary}
%within \cs{glsxtrglossentry}, this expands to the default
%definition. (If redefined, it must fully expand to the appropriate
%label.)
%    \begin{macrocode}
\newcommand{\GlsXtrStandaloneGlossaryType}{\glsentrytype{\glscurrententrylabel}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrStandaloneSubEntryItem}
%\changes{1.31}{2018-05-09}{new}
%Used for sub-entries in standalone format. The argument is the
%entry's label.
%    \begin{macrocode}
\newcommand*{\GlsXtrStandaloneSubEntryItem}[1]{%
  \GlsXtrIfFieldEqNum{level}{#1}{1}{\glssubentryitem{#1}}{}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrglossentryother}
%\changes{1.22}{2017-11-08}{new}
%As \cs{glsxtrglossentry} but uses a different field.
%First argument is code to use in the header. The second argument
%is the entry's label. The third argument is the internal field
%label. This needs to be expandable in case it occurs in a
%sectioning command so it can't have an optional argument.
%    \begin{macrocode}
\newcommand*{\glsxtrglossentryother}[3]{%
  \ifstrempty{#1}%
  {%
    \ifcsdef{glsxtrhead#3}%
    {%
      \glsxtrtitleorpdforheading
      {\@glsxtrglossentryother{#2}{#3}{#1}}%
      {\@gls@entry@field{#2}{#3}}%
      {\csuse{glsxtrhead#3}{#2}}%
    }%
    {%
      \glsxtrtitleorpdforheading
      {\@glsxtrglossentryother{#2}{#3}{#1}}%
      {\@gls@entry@field{#2}{#3}}%
      {\@gls@entry@field{\NoCaseChange{#2}}{#3}}%
    }%
  }%
  {%
    \glsxtrtitleorpdforheading
    {\@glsxtrglossentryother{#2}{#3}{#1}}%
    {\@gls@entry@field{#2}{#3}}%
    {#1}%
  }%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glsxtrglossentryother}
%\changes{1.22}{2017-11-08}{new}
%As \cs{@glsxtrglossentry} but uses a different field.
%    \begin{macrocode}
\newrobustcmd*{\@glsxtrglossentryother}[3]{%
  \glsxtrtitleorpdforheading
  {%
    \glsdoifexists{#1}%
    {%
      \begingroup
        \edef\glscurrententrylabel{\glsdetoklabel{#1}}%
        \edef\currentglossary{\GlsXtrStandaloneGlossaryType}%
        \ifglshasparent{#1}%
        {\GlsXtrStandaloneSubEntryItem{#1}}%
        {\glsentryitem{#1}}%
        \glstarget{#1}{\glossentrynameother{#1}{#2}}%
      \endgroup
    }%
  }%
  {\@gls@entry@field{#1}{#2}}%
  {#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\printunsrtglossary}
%\changes{1.08}{2016-12-13}{new}
%\changes{1.12}{2017-02-03}{added starred form}
%Similar to \cs{printnoidxglossary} but it displays all entries
%defined for the given glossary without sorting.
%    \begin{macrocode}
\newcommand*{\printunsrtglossary}{%
  \@ifstar\s@printunsrtglossary\@printunsrtglossary
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@printunsrtglossary}
%\changes{1.12}{2017-02-03}{new}
%Unstarred version.
%    \begin{macrocode}
\newcommand*{\@printunsrtglossary}[1][]{%
  \@printglossary{type=\glsdefaulttype,#1}{\@print@unsrt@glossary}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\s@printunsrtglossary}
%\changes{1.12}{2017-02-03}{new}
%Starred version.
%    \begin{macrocode}
\newcommand*{\s@printunsrtglossary}[2][]{%
  \begingroup
    #2%
    \@printglossary{type=\glsdefaulttype,#1}{\@print@unsrt@glossary}%
  \endgroup
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\printunsrtglossaries}
%\changes{1.08}{2016-12-13}{new}
%Similar to \cs{printnoidxglossaries} but it displays all entries
%defined for the given glossary without sorting.
%    \begin{macrocode}
\newcommand*{\printunsrtglossaries}{%
  \forallglossaries{\@@glo@type}{\printunsrtglossary[type=\@@glo@type]}%
}
%    \end{macrocode}
%\end{macro}

%\begin{macro}{\@print@unsrt@glossary}
%\changes{1.08}{2016-12-13}{new}
%    \begin{macrocode}
\newcommand*{\@print@unsrt@glossary}{%
  \glossarysection[\glossarytoctitle]{\glossarytitle}%
  \glossarypreamble
%    \end{macrocode}
%check for empty list
%    \begin{macrocode}
  \glsxtrifemptyglossary{\@glo@type}%
  {%
    \GlossariesExtraWarning{No entries defined in glossary `\@glo@type'}% 
  }%
  {%
%    \end{macrocode}
%\changes{1.16}{2017-06-15}{corrected misspelt command}
%    \begin{macrocode}
    \key@ifundefined{glossentry}{group}%
    {\let\@gls@getgrouptitle\@gls@noidx@getgrouptitle}%
    {\let\@gls@getgrouptitle\@glsxtr@unsrt@getgrouptitle}%
    \def\@gls@currentlettergroup{}%
%    \end{macrocode}
%A loop within the tabular-like styles can cause problems, so
%move the loop outside.
%    \begin{macrocode}
    \def\@glsxtr@doglossary{%
      \begin{theglossary}%
      \glossaryheader
      \glsresetentrylist
    }%
    \expandafter\@for\expandafter\glscurrententrylabel\expandafter
      :\expandafter=\csname glolist@\@glo@type\endcsname\do{%
      \ifdefempty{\glscurrententrylabel}
      {}%
      {%
%    \end{macrocode}
%Provide a hook (for example to measure width).
%    \begin{macrocode}
        \let\glsxtr@process\@firstofone
        \let\printunsrtglossaryskipentry
            \@glsxtr@printunsrtglossaryskipentry
        \printunsrtglossaryentryprocesshook{\glscurrententrylabel}%
%    \end{macrocode}
%Don't check group for child entries.
%    \begin{macrocode}
        \glsxtr@process
        {%
          \ifglshasparent{\glscurrententrylabel}{}%
          {%
            \@glsxtr@checkgroup\glscurrententrylabel
            \expandafter\appto\expandafter\@glsxtr@doglossary\expandafter
              {\@glsxtr@groupheading}%
          }%
          \eappto\@glsxtr@doglossary{%
            \noexpand\@printunsrt@glossary@handler{\glscurrententrylabel}}%
        }%
      }%
    }%
    \appto\@glsxtr@doglossary{\end{theglossary}}%
    \printunsrtglossarypredoglossary
    \@glsxtr@doglossary
  }%
  \glossarypostamble
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\printunsrtglossaryentryprocesshook}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\printunsrtglossaryentryprocesshook}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\printunsrtglossaryskipentry}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\printunsrtglossaryskipentry}{%
  \PackageError{glossaries-extra}{\string\printunsrtglossaryskipentry\space
can only be used within \string\printunsrtglossaryentryprocesshook}{}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\printunsrtglossaryentryprocesshook}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@printunsrtglossaryskipentry}{%
  \let\glsxtr@process\@gobble
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\printunsrtglossarypredoglossary}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\printunsrtglossarypredoglossary}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@printunsrt@glossary@handler}
%\changes{1.16}{2017-06-15}{new}
%    \begin{macrocode}
\newcommand{\@printunsrt@glossary@handler}[1]{%
  \xdef\glscurrententrylabel{#1}%
  \printunsrtglossaryhandler\glscurrententrylabel
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\printunsrtglossaryhandler}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand{\printunsrtglossaryhandler}[1]{%
  \glsxtrunsrtdo{#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtriflabelinlist}
%\begin{definition}
%\cs{glsxtriflabelinlist}\marg{label}\marg{list}\marg{true}\marg{false}
%\end{definition}
%\changes{1.21}{2017-11-03}{new}
%Might be useful for the handler to check if an entry label
%or category label is contained in a list, so provide a user-level
%version of \cs{@gls@ifinlist} which ensures the label and list are
%fully expanded.
%    \begin{macrocode}
\newrobustcmd*{\glsxtriflabelinlist}[4]{%
 \protected@edef\@glsxtr@doiflabelinlist{\noexpand\@gls@ifinlist{#1}{#2}}%
 \@glsxtr@doiflabelinlist{#3}{#4}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\print@op@unsrtglossaryunit}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand{\print@op@unsrtglossaryunit}[2][]{%
  \s@printunsrtglossary[type=\glsdefaulttype,#1]{%
    \printunsrtglossaryunitsetup{#2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\printunsrtglossaryunitsetup}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand*{\printunsrtglossaryunitsetup}[1]{%
  \renewcommand{\printunsrtglossaryhandler}[1]{%
    \glsxtrfieldxifinlist{##1}{record.#1}{\csuse{the#1}}
    {\glsxtrunsrtdo{##1}}%
    {}%
  }%
%    \end{macrocode}
%\changes{1.20}{2017-09-11}{switched from redefining \cs{glolinkprefix} to
% \cs{@glsxtrhypernameprefix}}
%Only the target names should have the prefixes adjusted as \cs{gls}
%etc need the original \cs{glolinkprefix}. The \cs{@gobble} part
%discards \cs{glolinkprefix}.
%    \begin{macrocode}
  \ifcsundef{theH#1}%
  {%
    \renewcommand*{\@glsxtrhypernameprefix}{record.#1.\csuse{the#1}.\@gobble}%
  }%
  {%
    \renewcommand*{\@glsxtrhypernameprefix}{record.#1.\csuse{theH#1}.\@gobble}%
  }%
  \renewcommand*{\glossarysection}[2][]{}%
  \appto\glossarypostamble{\glspar\medskip\glspar}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\print@noop@unsrtglossaryunit}
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand{\print@noop@unsrtglossaryunit}[2][]{%
  \PackageError{glossaries-extra}{\string\printunsrtglossaryunit\space
   requires the record=only or record=alsoindex package option}{}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@unsrt@getgrouptitle}
%\changes{1.11}{2017-01-19}{new}
%    \begin{macrocode}
\newrobustcmd*{\@glsxtr@unsrt@getgrouptitle}[2]{%
  \protected@edef\@glsxtr@titlelabel{glsxtr@grouptitle@#1}%
  \@onelevel@sanitize\@glsxtr@titlelabel
  \ifcsdef{\@glsxtr@titlelabel}
  {\letcs{#2}{\@glsxtr@titlelabel}}%
  {\def#2{#1}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrunsrtdo}
%\changes{1.12}{2017-02-03}{new}
%Provide a user-level call to \cs{@glsxtr@noidx@do} to make it
%easier to define a new handler.
%    \begin{macrocode}
\newcommand{\glsxtrunsrtdo}{\@glsxtr@noidx@do}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrgroupfield}
%\app{bib2gls} provides a supplementary field labelled 
%\texttt{secondarygroup} for secondary glossaries, so 
%provide a way of switching to that field. (The \gloskey{group}
%key still needs checking. There's no associated key with the
%internal field).
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrgroupfield}{group}
%    \end{macrocode}
%\end{macro}
%
%The \env{tabular}-like glossary styles cause quite a problem
%with the iterative approach. In particular for the group skip.
%To compensate for this, the groups are now determined while
%\cs{@glsxtr@doglossary} is being constructed rather than in the
%handler.
%\begin{macro}{\@glsxtr@checkgroup}
%\changes{1.21}{2017-11-03}{new}
%The argument is the entry's label. (This block of code was
%formerly in \cs{@glsxtr@noidx@do}.) Now that this is no longer
%within a tabular environment, the global definitions aren't needed.
%The result is now stored in \cs{@glsxtr@groupheading}, which will
%be empty if no heading is required.
%    \begin{macrocode}
\newcommand*{\@glsxtr@checkgroup}[1]{%
  \def\@glsxtr@groupheading{}%
  \key@ifundefined{glossentry}{group}%
  {%
    \letcs{\@gls@sort}{glo@\glsdetoklabel{#1}@sort}%
    \expandafter\glo@grabfirst\@gls@sort{}{}\@nil
  }%
  {%
%    \end{macrocode}
%\changes{1.16}{2017-06-15}{use \cs{csuse} instead of \cs{csname}}
%    \begin{macrocode}
    \protected@edef\@glo@thislettergrp{%
        \csuse{glo@\glsdetoklabel{#1}@\glsxtrgroupfield}}%
  }%
  \ifdefequal{\@glo@thislettergrp}{\@gls@currentlettergroup}%
  {}%
  {%
    \ifdefempty{\@gls@currentlettergroup}{}%
    {\def\@glsxtr@groupheading{\glsgroupskip}}%
    \eappto\@glsxtr@groupheading{%
      \noexpand\glsgroupheading{\expandonce\@glo@thislettergrp}%
    }%
  }%
  \let\@gls@currentlettergroup\@glo@thislettergrp
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@noidx@do}
%\changes{1.11}{2017-01-19}{new}
%Minor modification of \cs{@gls@noidx@do} to check for location
%field if present, but also need to check for the \gloskey{group}
%field.
%    \begin{macrocode}
\newcommand{\@glsxtr@noidx@do}[1]{%
  \ifglsentryexists{#1}%
  {%
    \global\letcs{\@gls@loclist}{glo@\glsdetoklabel{#1}@loclist}%
    \global\letcs{\@gls@location}{glo@\glsdetoklabel{#1}@location}%
    \ifglshasparent{#1}%
    {%
      \gls@level=\csuse{glo@\glsdetoklabel{#1}@level}\relax
      \ifdefvoid{\@gls@location}%
      {%
        \ifdefvoid{\@gls@loclist}%
        {%
          \subglossentry{\gls@level}{#1}{}%
        }%
        {%
          \subglossentry{\gls@level}{#1}%
          {%
            \glossaryentrynumbers{\glsnoidxloclist{\@gls@loclist}}%
          }%
        }%
      }%
      {%
        \subglossentry{\gls@level}{#1}{\glossaryentrynumbers{\@gls@location}}%
      }%
    }%
    {%
%    \end{macrocode}
%\changes{1.21}{2017-11-03}{removed code dealing with the group}
%    \begin{macrocode}
      \ifdefvoid{\@gls@location}%
      {%
        \ifdefvoid{\@gls@loclist}
        {%
          \glossentry{#1}{}%
        }%
        {%
          \glossentry{#1}%
          {%
            \glossaryentrynumbers{\glsnoidxloclist{\@gls@loclist}}%
          }%
        }%
      }%
      {%
        \glossentry{#1}%
        {%
          \glossaryentrynumbers{\@gls@location}%
        }%
      }%
    }%
  }%
  {}%
}
%    \end{macrocode}
%\end{macro}
%
%Provide a way to conveniently define commands that behaves like
%\cs{gls} with a label prefix.
%
%It's possible that the user might want minor variations
%with the same prefix but different default options, so
%use a counter to provide unique inner commands.
%\begin{macro}{\glsxtrnewgls}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcount\@glsxtrnewgls@inner
%    \end{macrocode}
%\end{macro}
%(The default options supplied in \meta{options} below
%could possibly be used to form the inner control sequence name to
%help make it unique, but it might feasibly contain 
%\gloskey[glslink]{thevalue} where the value might contain commands.)
%
%\begin{macro}{\@glsxtrnewgls}
%\changes{1.21}{2017-11-03}{new}
%\begin{definition}
%\cs{glsxtrnewgls}\oarg{options}\marg{prefix}\marg{cs}\marg{inner cs
%name}
%\end{definition}
%
%    \begin{macrocode}
\newcommand*{\@glsxtrnewgls}[4]{%
  \ifdef{#3}%
  {%
    \PackageError{glossaries-extra}{Command \string#3\space already
defined}{}%
  }%
  {%
     \ifcsdef{@#4like@#2}%
     {%
       \advance\@glsxtrnewgls@inner by \@ne
       \def\@glsxtrnewgls@innercsname{@#4like\number\@glsxtrnewgls@inner @#2}%
     }%
     {\def\@glsxtrnewgls@innercsname{@#4like@#2}}%
     \expandafter\newrobustcmd\expandafter*\expandafter
      #3\expandafter{\expandafter\@gls@hyp@opt\csname\@glsxtrnewgls@innercsname\endcsname}%
     \ifstrempty{#1}%
     {%
       \expandafter\newcommand\expandafter*\csname\@glsxtrnewgls@innercsname\endcsname[2][]{%
         \new@ifnextchar[%
          {\csname @#4@\endcsname{##1}{#2##2}}%
          {\csname @#4@\endcsname{##1}{#2##2}[]}%
       }%
     }%
     {%
       \expandafter\newcommand\expandafter*\csname\@glsxtrnewgls@innercsname\endcsname[2][]{%
         \new@ifnextchar[%
          {\csname @#4@\endcsname{#1,##1}{#2##2}}%
          {\csname @#4@\endcsname{#1,##1}{#2##2}[]}%
       }%
     }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrnewgls}
%\begin{definition}
%\cs{glsxtrnewgls}\oarg{options}\marg{prefix}\marg{cs}
%\end{definition}
%The first argument prepends to the options and the second argument is the prefix.
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newrobustcmd*{\glsxtrnewgls}[3][]{%
  \@glsxtrnewgls{#1}{#2}{#3}{gls}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrnewglslike}
%Provide a way to conveniently define commands that behave like
%\cs{gls}, \cs{glspl}, \cs{Gls} and \cs{Glspl} with a label prefix.
%The first argument prepends to the options and the second argument is the prefix.
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newrobustcmd*{\glsxtrnewglslike}[6][]{%
  \@glsxtrnewgls{#1}{#2}{#3}{gls}%
  \@glsxtrnewgls{#1}{#2}{#4}{glspl}%
  \@glsxtrnewgls{#1}{#2}{#5}{Gls}%
  \@glsxtrnewgls{#1}{#2}{#6}{Glspl}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrnewGLSlike}
%Provide a way to conveniently define commands that behave like
%\cs{GLS}, \cs{GLSpl} with a label prefix.
%The first argument prepends to the options and the second argument is the prefix.
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newrobustcmd*{\glsxtrnewGLSlike}[4][]{%
  \@glsxtrnewgls{#1}{#2}{#3}{GLS}%
  \@glsxtrnewgls{#1}{#2}{#4}{GLSpl}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrnewrgls}
%As \cs{glsxtrnewgls} but for \cs{rgls}.
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newrobustcmd*{\glsxtrnewrgls}[3][]{%
  \@glsxtrnewgls{#1}{#2}{#3}{rgls}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrnewrglslike}
%As \cs{glsxtrnewglslike} but for \cs{rgls} etc.
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newrobustcmd*{\glsxtrnewrglslike}[6][]{%
  \@glsxtrnewgls{#1}{#2}{#3}{rgls}%
  \@glsxtrnewgls{#1}{#2}{#4}{rglspl}%
  \@glsxtrnewgls{#1}{#2}{#5}{rGls}%
  \@glsxtrnewgls{#1}{#2}{#6}{rGlspl}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrnewrGLSlike}
%\changes{1.21}{2017-11-03}{new}
%As \cs{glsxtrnewGLSlike} but for \cs{rGLS} etc.
%    \begin{macrocode}
\newrobustcmd*{\glsxtrnewrGLSlike}[4][]{%
  \@glsxtrnewgls{#1}{#2}{#3}{rGLS}%
  \@glsxtrnewgls{#1}{#2}{#4}{rGLSpl}%
}
%    \end{macrocode}
%\end{macro}
%
%Provide easy access to record count fields.
%\begin{macro}{\GlsXtrTotalRecordCount}
%\changes{1.21}{2017-11-03}{new}
%Access total record count. This is designed to
%be expandable. The argument is the label.
%    \begin{macrocode}
\newcommand*{\GlsXtrTotalRecordCount}[1]{%
 \ifcsdef{glo@\glsdetoklabel{#1}@recordcount}%
 {\csname glo@\glsdetoklabel{#1}@recordcount\endcsname}%
 {0}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\GlsXtrRecordCount}
%\changes{1.21}{2017-11-03}{new}
%Access record count for a particular counter. The first argument is the label.
%The second argument is the counter name.
%    \begin{macrocode}
\newcommand*{\GlsXtrRecordCount}[2]{%
 \ifcsdef{glo@\glsdetoklabel{#1}@recordcount.#2}%
 {\csname glo@\glsdetoklabel{#1}@recordcount.#2\endcsname}%
 {0}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrLocationRecordCount}
%\changes{1.21}{2017-11-03}{new}
%Access record count for a particular counter and location. 
%The first argument is the label.
%The second argument is the counter name.
%The third argument is the location.
%This command shouldn't be used if the location doesn't fully
%expand unless \cs{glsxtrdetoklocation} can be set to something
%sensible.
%    \begin{macrocode}
\newcommand*{\GlsXtrLocationRecordCount}[3]{%
 \ifcsdef{glo@\glsdetoklabel{#1}@recordcount.#2.\glsxtrdetoklocation{#3}}%
 {\csname glo@\glsdetoklabel{#1}@recordcount.#2.\glsxtrdetoklocation{#3}\endcsname}%
 {0}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrdetoklocation}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrdetoklocation}[1]{#1}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrenablerecordcount}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrenablerecordcount}{%
  \renewcommand*{\gls}{\rgls}%
  \renewcommand*{\Gls}{\rGls}%
  \renewcommand*{\glspl}{\rglspl}%
  \renewcommand*{\Glspl}{\rGlspl}%
  \renewcommand*{\GLS}{\rGLS}%
  \renewcommand*{\GLSpl}{\rGLSpl}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrrecordtriggervalue}
%\changes{1.21}{2017-11-03}{new}
%The value used by the record trigger test.
%The argument is the entry's label.
%    \begin{macrocode}
\newcommand*{\glsxtrrecordtriggervalue}[1]{%
 \GlsXtrTotalRecordCount{#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrSetRecordCountAttribute}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\GlsXtrSetRecordCountAttribute}[2]{%
 \@for\@glsxtr@cat:=#1\do
 {%
   \ifdefempty{\@glsxtr@cat}{}%
   {%
     \glssetcategoryattribute{\@glsxtr@cat}{recordcount}{#2}%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrifrecordtrigger}
%\begin{definition}
%\cs{glsxtrifrecordtrigger}\marg{label}\marg{trigger format}\marg{normal}
%\end{definition}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrifrecordtrigger}[3]{%
 \glshasattribute{#1}{recordcount}%
 {%
   \ifnum\glsxtrrecordtriggervalue{#1}>\glsgetattribute{#1}{recordcount}\relax
    #3%
   \else
    #2%
   \fi
 }%
 {#3}% 
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@rglstrigger@record}
%\changes{1.21}{2017-11-03}{new}
%Still need a record to ensure that \app{bib2gls} selects the entry.
%    \begin{macrocode}
\newcommand*{\@glsxtr@rglstrigger@record}[3]{%
  \edef\glslabel{\glsdetoklabel{#2}}%
  \let\@gls@link@label\glslabel
  \def\@glsxtr@thevalue{}%
  \def\@glsxtr@theHvalue{\@glsxtr@thevalue}%
  \def\@glsnumberformat{glstriggerrecordformat}%
  \edef\@gls@counter{\csname glo@\glslabel @counter\endcsname}%
  \edef\glstype{\csname glo@\glslabel @type\endcsname}%
  \def\@glsxtr@thevalue{}%
  \def\@glsxtr@theHvalue{\@glsxtr@thevalue}%
  \glsxtrinitwrgloss
  \glslinkpresetkeys
  \setkeys{glslink}{#1}%
  \glslinkpostsetkeys
  \ifdefempty{\@glsxtr@thevalue}%
  {%
    \@gls@saveentrycounter
  }%
  {%
    \let\theglsentrycounter\@glsxtr@thevalue
    \def\theHglsentrycounter{\@glsxtr@theHvalue}%
  }%
  \ifglsxtrinitwrglossbefore
    \@do@wrglossary{#2}%
  \fi
  #3%
  \ifglsxtrinitwrglossbefore
  \else
    \@do@wrglossary{#2}%
  \fi
  \ifKV@glslink@local
    \glslocalunset{#2}%
  \else
    \glsunset{#2}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glstriggerrecordformat}
%\changes{1.21}{2017-11-03}{new}
%Typically won't be used as it should be recognised as a special
%type of ignored location by \app{bib2gls}. 
%    \begin{macrocode}
\newcommand*{\glstriggerrecordformat}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\rgls}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newrobustcmd*{\rgls}{\@gls@hyp@opt\@rgls}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@rgls}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\@rgls}[2][]{%
  \new@ifnextchar[{\@rgls@{#1}{#2}}{\@rgls@{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@rgls@}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\def\@rgls@#1#2[#3]{%
  \glsxtrifrecordtrigger{#2}%
  {%
    \@glsxtr@rglstrigger@record{#1}{#2}{\rglsformat{#2}{#3}}%
  }% 
  {%
    \@gls@{#1}{#2}[#3]%
  }%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\rglspl}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newrobustcmd*{\rglspl}{\@gls@hyp@opt\@rglspl}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@rglspl}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\@rglspl}[2][]{%
  \new@ifnextchar[{\@rglspl@{#1}{#2}}{\@rglspl@{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@rglspl@}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\def\@rglspl@#1#2[#3]{%
  \glsxtrifrecordtrigger{#2}%
  {%
    \@glsxtr@rglstrigger@record{#1}{#2}{\rglsplformat{#2}{#3}}%
  }%
  {%
    \@glspl@{#1}{#2}[#3]%
  }%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\rGls}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newrobustcmd*{\rGls}{\@gls@hyp@opt\@rGls}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@rGls}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\@rGls}[2][]{%
  \new@ifnextchar[{\@rGls@{#1}{#2}}{\@rGls@{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@rGls@}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\def\@rGls@#1#2[#3]{%
  \glsxtrifrecordtrigger{#2}%
  {%
    \@glsxtr@rglstrigger@record{#1}{#2}{\rGlsformat{#2}{#3}}%
  }%
  {%
    \@Gls@{#1}{#2}[#3]%
  }%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\rGlspl}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newrobustcmd*{\rGlspl}{\@gls@hyp@opt\@rGlspl}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@rGlspl}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\@rGlspl}[2][]{%
  \new@ifnextchar[{\@rGlspl@{#1}{#2}}{\@rGlspl@{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@rGlspl@}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\def\@rGlspl@#1#2[#3]{%
  \glsxtrifrecordtrigger{#2}%
  {%
    \@glsxtr@rglstrigger@record{#1}{#2}{\rGlsplformat{#2}{#3}}%
  }%
  {%
    \@Glspl@{#1}{#2}[#3]%
  }%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\rGLS}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newrobustcmd*{\rGLS}{\@gls@hyp@opt\@rGLS}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@rGLS}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\@rGLS}[2][]{%
  \new@ifnextchar[{\@rGLS@{#1}{#2}}{\@rGLS@{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@rGLS@}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\def\@rGLS@#1#2[#3]{%
  \glsxtrifrecordtrigger{#2}%
  {%
    \@glsxtr@rglstrigger@record{#1}{#2}{\rGLSformat{#2}{#3}}%
  }% 
  {%
    \@GLS@{#1}{#2}[#3]%
  }%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\rGLSpl}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newrobustcmd*{\rGLSpl}{\@gls@hyp@opt\@rGLSpl}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@rGLSpl}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\@rGLSpl}[2][]{%
  \new@ifnextchar[{\@rGLSpl@{#1}{#2}}{\@rGLSpl@{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@rGLSpl@}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\def\@rGLSpl@#1#2[#3]{%
  \glsxtrifrecordtrigger{#2}%
  {%
    \@glsxtr@rglstrigger@record{#1}{#2}{\rGLSplformat{#2}{#3}}%
  }%
  {%
    \@GLSpl@{#1}{#2}[#3]%
  }%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\rglsformat}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\rglsformat}[2]{%
  \glsifregular{#1}
  {\glsentryfirst{#1}}%
  {\ifglshaslong{#1}{\glsentrylong{#1}}{\glsentryfirst{#1}}}#2%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\rglsplformat}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\rglsplformat}[2]{%
  \glsifregular{#1}
  {\glsentryfirstplural{#1}}%
  {\ifglshaslong{#1}{\glsentrylongplural{#1}}{\glsentryfirstplural{#1}}}#2%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\rGlsformat}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\rGlsformat}[2]{%
  \glsifregular{#1}
  {\Glsentryfirst{#1}}%
  {\ifglshaslong{#1}{\Glsentrylong{#1}}{\Glsentryfirst{#1}}}#2%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\rGlsplformat}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\rGlsplformat}[2]{%
  \glsifregular{#1}
  {\Glsentryfirstplural{#1}}%
  {\ifglshaslong{#1}{\Glsentrylongplural{#1}}{\Glsentryfirstplural{#1}}}#2%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\rGLSformat}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\rGLSformat}[2]{%
 \expandafter\mfirstucMakeUppercase\expandafter{\rglsformat{#1}{#2}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\rGLSplformat}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\rGLSplformat}[2]{%
 \expandafter\mfirstucMakeUppercase\expandafter{\rglsplformat{#1}{#2}}%
}
%    \end{macrocode}
%\end{macro}
%
%\section{Link Counting}
%\label{sec:linkcount}
%This is different to the entry counting provided by the base
%package (which counts the number of times the first use flag is
%unset). Instead, this method hooks into \cs{@gls@link} (through
%\cs{glsxtr@inc@linkcount}) to increment an associated counter.
%To preserve resources, the counter is only defined if it needs to
%be incremented. This method is independent of the presence of
%hyperlinks. (The \qt{link} part of the name refers to \cs{@gls@link}
%not \cs{hyperlink}.)
%
%\begin{macro}{\@glsxtr@do@inc@linkcount}
%\changes{1.26}{2018-01-05}{new}
%This performs the actual incrementing and counter definition.
%The counter is given by \cs{c@glsxtr@linkcount@\meta{label}} where
%\meta{label} is the entry's label. Since this is performed within
%\cs{@gls@link} the label can be accessed with \cs{glslabel}.
%    \begin{macrocode}
\newcommand{\@glsxtr@do@inc@linkcount}{%
%    \end{macrocode}
%Does this entry have the \catattr{linkcount} attribute set?
%    \begin{macrocode}
 \glsifattribute{\glslabel}{linkcount}{true}%
 {%
%    \end{macrocode}
%Does the counter exist?
%    \begin{macrocode}
   \ifcsdef{c@glsxtr@linkcount@\glslabel}{}%
   {%
%    \end{macrocode}
%Counter doesn't exist, so define it.
%    \begin{macrocode}
     \newcounter{glsxtr@linkcount@\glslabel}%
%    \end{macrocode}
%If \catattr{linkcountmaster} is set, add to counter reset.
%    \begin{macrocode}
     \glshasattribute{\glslabel}{linkcountmaster}%
     {%
%    \end{macrocode}
%Need to ensure values are fully expanded.
%    \begin{macrocode}
       \begingroup
        \edef\x{\endgroup\noexpand\@addtoreset{glsxtr@linkcount@\glslabel}%
         {\glsgetattribute{\glslabel}{linkcountmaster}}}%
       \x
     }%
     {}%
   }%
%    \end{macrocode}
% Increment counter:
%    \begin{macrocode}
  \glsxtrinclinkcounter{glsxtr@linkcount@\glslabel}%
 }%
 {}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrinclinkcounter}
%\changes{1.26}{2018-01-05}{new}
%May be redefined to use \cs{refstepcounter} if required.
%    \begin{macrocode}
\newcommand*{\glsxtrinclinkcounter}[1]{\stepcounter{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrLinkCounterValue}
%\changes{1.26}{2018-01-05}{new}
%Expands to the associated link counter register or 0 if not
%defined.
%    \begin{macrocode}
\newcommand*{\GlsXtrLinkCounterValue}[1]{%
 \ifcsundef{c@glsxtr@linkcount@#1}{0}{\csname c@glsxtr@linkcount@#1\endcsname}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrTheLinkCounter}
%\changes{1.26}{2018-01-05}{new}
%Expands to the display value of the associated link counter or 0 if not
%defined.
%    \begin{macrocode}
\newcommand*{\GlsXtrTheLinkCounter}[1]{%
 \ifcsundef{theglsxtr@linkcount@#1}{0}%
 {\csname theglsxtr@linkcount@#1\endcsname}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrIfLinkCounterDef}
%\changes{1.26}{2018-01-05}{new}
%Tests if the counter has been defined
%    \begin{macrocode}
\newcommand*{\GlsXtrIfLinkCounterDef}[3]{%
 \ifcsundef{theglsxtr@linkcount@#1}{#3}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrLinkCounterName}
%\changes{1.26}{2018-01-05}{new}
%Expands to the associated link counter name. (No check for
%existence.)
%    \begin{macrocode}
\newcommand*{\GlsXtrLinkCounterName}[1]{glsxtr@linkcount@#1}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrEnableLinkCounting}
%\changes{1.26}{2018-01-05}{new}
%\begin{definition}
%\cs{GlsXtrEnableLinkCounting}\oarg{master counter}\marg{categories}
%\end{definition}
%Enable link counting for the given categories.
%    \begin{macrocode}
\newcommand*{\GlsXtrEnableLinkCounting}[2][]{%
 \let\glsxtr@inc@linkcount\@glsxtr@do@inc@linkcount
 \@for\@glsxtr@label:=#2\do
 {%
  \glssetcategoryattribute{\@glsxtr@label}{linkcount}{true}%
  \ifstrempty{#1}{}%
  {%
    \ifcsundef{c@#1}%
    {\@nocounterr{#1}}%
    {\glssetcategoryattribute{\@glsxtr@label}{linkcountmaster}{#1}}%
  }%
 }%
}
\@onlypreamble\GlsXtrEnableLinkCounting
%    \end{macrocode}
%\end{macro}
%
%\section{Integration with glossaries-accsupp}
% Provide better integration with the \sty{glossaries-accsupp}
% package. (Must be loaded before the main code of
% \styfmt{glossaries-extra} either explicitly or through the
% \pkgopt{accsupp} package option.)
%
% These commands have their definitions set according to whether
% or not \styfmt{glossaries-extra} has been loaded.
%\changes{0.5.2}{2015-12-08}{fixed typo in glossaries-accsupp and tidied up code to use
% just one \cs{@ifpackageloaded}}
%    \begin{macrocode}
\@ifpackageloaded{glossaries-accsupp}
{
%    \end{macrocode}
% Define (or redefine) commands to use the accessibility
% information.
%\begin{macro}{\glsaccessname}
% Display the \gloskey{name} value (no link and no check for existence).
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
  \newcommand*{\glsaccessname}[1]{%
    \glsnameaccessdisplay
    {%
      \glsentryname{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccessname}
% Display the \gloskey{name} value (no link and no check for existence)
% with the first letter converted to upper case.
%\changes{0.5.1}{2015-12-07}{new}
%    \begin{macrocode}
  \newcommand*{\Glsaccessname}[1]{%
    \glsnameaccessdisplay
    {%
      \Glsentryname{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccessname}
% Display the \gloskey{name} value (no link and no check for existence)
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccessname}[1]{%
    \glsnameaccessdisplay
    {%
      \mfirstucMakeUppercase{\glsentryname{#1}}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccesstext}
% Display the \gloskey{text} value (no link and no check for existence).
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
  \newcommand*{\glsaccesstext}[1]{%
    \glstextaccessdisplay
    {%
      \glsentrytext{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccesstext}
% Display the \gloskey{text} value (no link and no check for existence)
% with the first letter converted to upper case.
%\changes{0.5.1}{2015-12-02}{new}
%    \begin{macrocode}
  \newcommand*{\Glsaccesstext}[1]{%
    \glstextaccessdisplay
    {%
      \Glsentrytext{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccesstext}
% Display the \gloskey{text} value (no link and no check for existence)
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccesstext}[1]{%
    \glstextaccessdisplay
    {%
      \mfirstucMakeUppercase{\glsentrytext{#1}}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccessplural}
% Display the \gloskey{plural} value (no link and no check for existence).
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
  \newcommand*{\glsaccessplural}[1]{%
    \glspluralaccessdisplay
    {%
      \glsentryplural{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccessplural}
% Display the \gloskey{plural} value (no link and no check for existence)
% with the first letter converted to upper case.
%\changes{0.5.1}{2015-12-07}{new}
%    \begin{macrocode}
  \newcommand*{\Glsaccessplural}[1]{%
    \glspluralaccessdisplay
    {%
      \Glsentryplural{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccessplural}
% Display the \gloskey{plural} value (no link and no check for existence)
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccessplural}[1]{%
    \glspluralaccessdisplay
    {%
      \mfirstucMakeUppercase{\glsentryplural{#1}}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccessfirst}
% Display the \gloskey{first} value (no link and no check for existence).
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
  \newcommand*{\glsaccessfirst}[1]{%
    \glsfirstaccessdisplay
    {%
      \glsentryfirst{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccessfirst}
% Display the \gloskey{first} value (no link and no check for existence)
% with the first letter converted to upper case.
%\changes{0.5.1}{2015-12-07}{new}
%    \begin{macrocode}
  \newcommand*{\Glsaccessfirst}[1]{%
    \glsfirstaccessdisplay
    {%
      \Glsentryfirst{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccessfirst}
% Display the \gloskey{first} value (no link and no check for existence)
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccessfirst}[1]{%
    \glsfirstaccessdisplay
    {%
      \mfirstucMakeUppercase{\glsentryfirst{#1}}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccessfirstplural}
% Display the \gloskey{firstplural} value (no link and no check for existence).
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
  \newcommand*{\glsaccessfirstplural}[1]{%
    \glsfirstpluralaccessdisplay
    {%
      \glsentryfirstplural{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccessfirstplural}
% Display the \gloskey{firstplural} value (no link and no check for existence)
% with the first letter converted to upper case.
%\changes{0.5.1}{2015-12-07}{new}
%    \begin{macrocode}
  \newcommand*{\Glsaccessfirstplural}[1]{%
    \glsfirstpluralaccessdisplay
    {%
      \Glsentryfirstplural{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccessfirstplural}
% Display the \gloskey{firstplural} value (no link and no check for existence)
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccessfirstplural}[1]{%
    \glsfirstpluralaccessdisplay
    {%
      \mfirstucMakeUppercase{\glsentryfirstplural{#1}}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccesssymbol}
% Display the \gloskey{symbol} value (no link and no check for existence).
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
  \newcommand*{\glsaccesssymbol}[1]{%
    \glssymbolaccessdisplay
    {%
      \glsentrysymbol{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccesssymbol}
% Display the \gloskey{symbol} value (no link and no check for existence)
% with the first letter converted to upper case.
%\changes{0.5.1}{2015-12-07}{new}
%    \begin{macrocode}
  \newcommand*{\Glsaccesssymbol}[1]{%
    \glssymbolaccessdisplay
    {%
      \Glsentrysymbol{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccesssymbol}
% Display the \gloskey{symbol} value (no link and no check for existence)
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccesssymbol}[1]{%
    \glssymbolaccessdisplay
    {%
      \mfirstucMakeUppercase{\glsentrysymbol{#1}}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccesssymbolplural}
% Display the \gloskey{symbolplural} value (no link and no check for existence).
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
  \newcommand*{\glsaccesssymbolplural}[1]{%
    \glssymbolpluralaccessdisplay
    {%
      \glsentrysymbolplural{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccesssymbolplural}
% Display the \gloskey{symbolplural} value (no link and no check for existence)
% with the first letter converted to upper case.
%\changes{0.5.1}{2015-12-07}{new}
%    \begin{macrocode}
  \newcommand*{\Glsaccesssymbolplural}[1]{%
    \glssymbolpluralaccessdisplay
    {%
      \Glsentrysymbolplural{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccesssymbolplural}
% Display the \gloskey{symbolplural} value (no link and no check for existence)
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccesssymbolplural}[1]{%
    \glssymbolpluralaccessdisplay
    {%
      \mfirstucMakeUppercase{\glsentrysymbolplural{#1}}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccessdesc}
% Display the \gloskey{desc} value (no link and no check for existence).
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
  \newcommand*{\glsaccessdesc}[1]{%
    \glsdescriptionaccessdisplay
    {%
      \glsentrydesc{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccessdesc}
% Display the \gloskey{desc} value (no link and no check for existence)
% with the first letter converted to upper case.
%\changes{0.5.1}{2015-12-07}{new}
%    \begin{macrocode}
  \newcommand*{\Glsaccessdesc}[1]{%
    \glsdescriptionaccessdisplay
    {%
      \Glsentrydesc{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccessdesc}
% Display the \gloskey{desc} value (no link and no check for existence)
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccessdesc}[1]{%
    \glsdescriptionaccessdisplay
    {%
      \mfirstucMakeUppercase{\glsentrydesc{#1}}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccessdescplural}
% Display the \gloskey{descplural} value (no link and no check for existence).
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
  \newcommand*{\glsaccessdescplural}[1]{%
    \glsdescriptionpluralaccessdisplay
    {%
      \glsentrydescplural{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccessdescplural}
% Display the \gloskey{descplural} value (no link and no check for existence)
% with the first letter converted to upper case.
%\changes{0.5.1}{2015-12-07}{new}
%    \begin{macrocode}
  \newcommand*{\Glsaccessdescplural}[1]{%
    \glsdescriptionpluralaccessdisplay
    {%
      \Glsentrydescplural{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccessdescplural}
% Display the \gloskey{descplural} value (no link and no check for existence)
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccessdescplural}[1]{%
    \glsdescriptionpluralaccessdisplay
    {%
      \mfirstucMakeUppercase{\glsentrydescplural{#1}}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccessshort}
% Display the short form (no link and no check for existence).
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
  \newcommand*{\glsaccessshort}[1]{%
    \glsshortaccessdisplay
    {%
      \glsentryshort{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccessshort}
% Display the short form with first letter converted to uppercase
% (no link and no check for existence).
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
  \newcommand*{\Glsaccessshort}[1]{%
    \glsshortaccessdisplay
    {%
      \Glsentryshort{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccessshort}
% Display the \gloskey{short} value (no link and no check for existence)
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccessshort}[1]{%
    \glsshortaccessdisplay
    {%
      \mfirstucMakeUppercase{\glsentryshort{#1}}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccessshortpl}
% Display the short plural form (no link and no check for existence).
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
  \newcommand*{\glsaccessshortpl}[1]{%
    \glsshortpluralaccessdisplay
    {%
      \glsentryshortpl{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccessshortpl}
% Display the short plural form with first letter converted to
% uppercase (no link and no check for existence).
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
  \newcommand*{\Glsaccessshortpl}[1]{%
    \glsshortpluralaccessdisplay
    {%
      \Glsentryshortpl{#1}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccessshortpl}
% Display the \gloskey{shortplural} value (no link and no check for existence)
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccessshortpl}[1]{%
    \glsshortpluralaccessdisplay
    {%
      \mfirstucMakeUppercase{\glsentryshortpl{#1}}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccesslong}
% Display the long form (no link and no check for existence).
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
  \newcommand*{\glsaccesslong}[1]{%
    \glslongaccessdisplay{\glsentrylong{#1}}{#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccesslong}
% Display the long form (no link and no check for existence).
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}

  \newcommand*{\Glsaccesslong}[1]{%
    \glslongaccessdisplay{\Glsentrylong{#1}}{#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccesslong}
% Display the \gloskey{long} value (no link and no check for existence)
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccesslong}[1]{%
    \glslongaccessdisplay
    {%
      \mfirstucMakeUppercase{\glsentrylong{#1}}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccesslongpl}
% Display the long plural form (no link and no check for existence).
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\glsaccesslongpl}[1]{%
    \glslongpluralaccessdisplay{\glsentrylongpl{#1}}{#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccesslongpl}
% Display the long plural form (no link and no check for existence).
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}

  \newcommand*{\Glsaccesslongpl}[1]{%
    \glslongpluralaccessdisplay{\Glsentrylongpl{#1}}{#1}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccesslongpl}
% Display the \gloskey{longplural} value (no link and no check for existence)
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccesslongpl}[1]{%
    \glslongpluralaccessdisplay
    {%
      \mfirstucMakeUppercase{\glsentrylongpl{#1}}%
    }%
    {#1}%
  }
%    \end{macrocode}
%\end{macro}
%
% Keys for accessibility support.
%    \begin{macrocode}
  \define@key{glsxtrabbrv}{access}{%
    \def\@gls@nameaccess{#1}%
  }
%    \end{macrocode}
%
%    \begin{macrocode}
  \define@key{glsxtrabbrv}{textaccess}{%
    \def\@gls@textaccess{#1}%
  }
%    \end{macrocode}
%
%    \begin{macrocode}
  \define@key{glsxtrabbrv}{firstaccess}{%
    \def\@gls@firstaccess{#1}%
  }
%    \end{macrocode}
%
%    \begin{macrocode}
  \define@key{glsxtrabbrv}{shortaccess}{%
    \def\@gls@shortaccess{#1}%
  }
%    \end{macrocode}
%
%    \begin{macrocode}
  \define@key{glsxtrabbrv}{shortpluralaccess}{%
    \def\@gls@shortaccesspl{#1}%
  }
%    \end{macrocode}
%\begin{macro}{\@gls@initaccesskeys}
%\changes{1.31}{2018-05-09}{new}
%    \begin{macrocode}
  \newcommand*{\@gls@initaccesskeys}{%
    \def\@gls@nameaccess{}%
    \def\@gls@textaccess{}%
    \def\@gls@firstaccess{}%
    \def\@gls@shortaccess{}%
    \def\@gls@shortaccesspl{}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@ifaccessattribute@set}
%\begin{definition}
%\cs{\@gls@ifaccessattribute@set}\marg{attribute}\marg{true}\marg{false}
%\end{definition}
%\changes{1.31}{2018-05-09}{new}
%    \begin{macrocode}
\newcommand*{\@gls@ifaccessattribute@set}[3]{%
  \glsifcategoryattribute{\glscategorylabel}{access#1}{true}%
  {#2}%
  {%
    \glsifcategoryattribute{\glscategorylabel}{access#1}{false}%
    {#3}%
    {%
      \glsifcategoryattribute{\glscategorylabel}{#1}{true}%
      {#2}%
      {#3}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@setup@default@short@access}
%\changes{1.31}{2018-05-09}{new}
%Assign the default value of the \gloskey{shortaccess} key. The
%argument is the short value passed to \cs{newabbreviation}.
%    \begin{macrocode}
  \newcommand{\@gls@setup@default@short@access}[1]{%
%    \end{macrocode}
%Check if the \catattr{accessinsertdots} attribute has been set but
%only if \gloskey{shortaccess} hasn't been set.
%    \begin{macrocode}
    \ifdefempty\@gls@shortaccess
    {%
      \glsifcategoryattribute{\glscategorylabel}{accessinsertdots}{true}%
      {%
        \@glsxtr@insertdots\@gls@shortaccess{#1}%
        \eappto\ExtraCustomAbbreviationFields{%
          shortaccess={\expandonce\@gls@shortaccess},}%
      }%
      {}%
    }%
    {}%
%    \end{macrocode}
%If the \gloskey{shortaccess} field has been set but
%\gloskey{shortaccessplural} hasn't been set, assign plural form.
%    \begin{macrocode}
    \ifdefempty\@gls@shortaccess
    {}%
    {%
      \ifdefempty\@gls@shortaccesspl
      {%
        \@gls@ifaccessattribute@set{aposplural}%
        {%
          \expandafter\def\expandafter\@gls@shortaccesspl\expandafter{%
            \@gls@shortaccess'\abbrvpluralsuffix}%
        }%
        {%
          \@gls@ifaccessattribute@set{noshortplural}%
          {%
             \let\@gls@shortaccesspl\@gls@shortaccess
          }%
          {%
            \expandafter\def\expandafter\@gls@shortaccesspl\expandafter{%
              \@gls@shortaccess\abbrvpluralsuffix}%
          }%
        }%
        \eappto\ExtraCustomAbbreviationFields{%
          shortpluralaccess={\expandonce\@gls@shortaccesspl},}%
      }%
      {}%
    }%
%    \end{macrocode}
%If \gloskey{access} key hasn't been set, check if the 
%\catattr{nameshortaccess} attribute has been set.
%    \begin{macrocode}
    \ifdefempty\@gls@nameaccess
    {%
      \glsifcategoryattribute{\glscategorylabel}{nameshortaccess}{true}%
      {%
%    \end{macrocode}
%Do nothing if the \gloskey{shortaccess} key hasn't been set.
%    \begin{macrocode}
        \ifdefempty\@gls@shortaccess
        {}%
        {%
           \eappto\ExtraCustomAbbreviationFields{%
              access={\expandonce\@gls@shortaccess},%
           }%
        }%
      }%
      {}%
    }%
    {}%
%    \end{macrocode}
%If \gloskey{textaccess} key hasn't been set, check if the 
%\catattr{textshortaccess} attribute has been set.
%    \begin{macrocode}
    \ifdefempty\@gls@textaccess
    {%
      \glsifcategoryattribute{\glscategorylabel}{textshortaccess}{true}%
      {%
%    \end{macrocode}
%Do nothing if the \gloskey{shortaccess} key hasn't been set.
%    \begin{macrocode}
        \ifdefempty\@gls@shortaccess
        {}%
        {%
           \eappto\ExtraCustomAbbreviationFields{%
              textaccess={\expandonce\@gls@shortaccess},%
           }%
        }%
      }%
      {}%
    }%
    {}%
%    \end{macrocode}
%If \gloskey{firstaccess} key hasn't been set, check if the 
%\catattr{firstshortaccess} attribute has been set.
%    \begin{macrocode}
    \ifdefempty\@gls@firstaccess
    {%
      \glsifcategoryattribute{\glscategorylabel}{firstshortaccess}{true}%
      {%
%    \end{macrocode}
%Do nothing if the \gloskey{shortaccess} key hasn't been set.
%    \begin{macrocode}
        \ifdefempty\@gls@shortaccess
        {}%
        {%
           \eappto\ExtraCustomAbbreviationFields{%
              firstaccess={\expandonce\@gls@shortaccess},%
           }%
        }%
      }%
      {}%
    }%
    {}%
  }
%    \end{macrocode}
%\end{macro}
% End of if accsupp part
%    \begin{macrocode}
}
{
%    \end{macrocode}
% No accessibility support. Just define these commands to do 
% \cs{glsentry}\meta{xxx}
%\begin{macro}{\glsaccessname}
% Display the \gloskey{name} value (no link and no check for existence).
%    \begin{macrocode}
  \newcommand*{\glsaccessname}[1]{\glsentryname{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccessname}
% Display the \gloskey{name} value (no link and no check for existence)
% with the first letter converted to upper case.
%    \begin{macrocode}
  \newcommand*{\Glsaccessname}[1]{\Glsentryname{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccessname}
% Display the \gloskey{name} value (no link and no check for existence).
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccessname}[1]{%
   \protect\mfirstucMakeUppercase{\glsentryname{#1}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccesstext}
% Display the \gloskey{text} value (no link and no check for existence).
%    \begin{macrocode}
  \newcommand*{\glsaccesstext}[1]{\glsentrytext{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccesstext}
% Display the \gloskey{text} value (no link and no check for existence)
% with the first letter converted to upper case.
%    \begin{macrocode}
  \newcommand*{\Glsaccesstext}[1]{\Glsentrytext{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccesstext}
% Display the \gloskey{text} value (no link and no check for existence).
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccesstext}[1]{%
   \protect\mfirstucMakeUppercase{\glsentrytext{#1}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccessplural}
% Display the \gloskey{plural} value (no link and no check for existence).
%    \begin{macrocode}
  \newcommand*{\glsaccessplural}[1]{\glsentryplural{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccessplural}
% Display the \gloskey{plural} value (no link and no check for existence)
% with the first letter converted to upper case.
%    \begin{macrocode}
  \newcommand*{\Glsaccessplural}[1]{\Glsentryplural{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccessplural}
% Display the \gloskey{plural} value (no link and no check for existence).
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccessplural}[1]{%
   \protect\mfirstucMakeUppercase{\glsentryplural{#1}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccessfirst}
% Display the \gloskey{first} value (no link and no check for existence).
%    \begin{macrocode}
  \newcommand*{\glsaccessfirst}[1]{\glsentryfirst{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccessfirst}
% Display the \gloskey{first} value (no link and no check for existence)
% with the first letter converted to upper case.
%    \begin{macrocode}
  \newcommand*{\Glsaccessfirst}[1]{\Glsentryfirst{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccessfirst}
% Display the \gloskey{first} value (no link and no check for existence).
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccessfirst}[1]{%
   \protect\mfirstucMakeUppercase{\glsentryfirst{#1}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccessfirstplural}
% Display the \gloskey{firstplural} value (no link and no check for existence).
%    \begin{macrocode}
  \newcommand*{\glsaccessfirstplural}[1]{\glsentryfirstplural{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccessfirstplural}
% Display the \gloskey{firstplural} value (no link and no check for existence)
% with the first letter converted to upper case.
%    \begin{macrocode}
  \newcommand*{\Glsaccessfirstplural}[1]{\Glsentryfirstplural{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccessfirstplural}
% Display the \gloskey{firstplural} value (no link and no check for existence).
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccessfirstplural}[1]{%
   \protect\mfirstucMakeUppercase{\glsentryfirstplural{#1}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccesssymbol}
% Display the \gloskey{symbol} value (no link and no check for existence).
%    \begin{macrocode}
  \newcommand*{\glsaccesssymbol}[1]{\glsentrysymbol{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccesssymbol}
% Display the \gloskey{symbol} value (no link and no check for existence)
% with the first letter converted to upper case.
%    \begin{macrocode}
  \newcommand*{\Glsaccesssymbol}[1]{\Glsentrysymbol{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccesssymbol}
% Display the \gloskey{symbol} value (no link and no check for existence).
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccesssymbol}[1]{%
   \protect\mfirstucMakeUppercase{\glsentrysymbol{#1}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccesssymbolplural}
% Display the \gloskey{symbolplural} value (no link and no check for existence).
%    \begin{macrocode}
  \newcommand*{\glsaccesssymbolplural}[1]{\glsentrysymbolplural{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccesssymbolplural}
% Display the \gloskey{symbolplural} value (no link and no check for existence)
% with the first letter converted to upper case.
%    \begin{macrocode}
  \newcommand*{\Glsaccesssymbolplural}[1]{\Glsentrysymbolplural{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccesssymbolplural}
% Display the \gloskey{symbolplural} value (no link and no check for existence).
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccesssymbolplural}[1]{%
   \protect\mfirstucMakeUppercase{\glsentrysymbolplural{#1}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccessdesc}
% Display the \gloskey{desc} value (no link and no check for existence).
%    \begin{macrocode}
  \newcommand*{\glsaccessdesc}[1]{\glsentrydesc{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccessdesc}
% Display the \gloskey{desc} value (no link and no check for existence)
% with the first letter converted to upper case.
%    \begin{macrocode}
  \newcommand*{\Glsaccessdesc}[1]{\Glsentrydesc{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccessdesc}
% Display the \gloskey{desc} value (no link and no check for existence).
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccessdesc}[1]{%
   \protect\mfirstucMakeUppercase{\glsentrydesc{#1}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccessdescplural}
% Display the \gloskey{descplural} value (no link and no check for existence).
%    \begin{macrocode}
  \newcommand*{\glsaccessdescplural}[1]{\glsentrydescplural{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccessdescplural}
% Display the \gloskey{descplural} value (no link and no check for existence)
% with the first letter converted to upper case.
%    \begin{macrocode}
  \newcommand*{\Glsaccessdescplural}[1]{\Glsentrydescplural{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccessdescplural}
% Display the \gloskey{descplural} value (no link and no check for existence).
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccessdescplural}[1]{%
   \protect\mfirstucMakeUppercase{\glsentrydescplural{#1}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccessshort}
% Display the short form (no link and no check for existence).
%    \begin{macrocode}
  \newcommand*{\glsaccessshort}[1]{\glsentryshort{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccessshort}
% Display the short form with first letter converted to uppercase
% (no link and no check for existence).
%    \begin{macrocode}
  \newcommand*{\Glsaccessshort}[1]{\Glsentryshort{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccessshort}
% Display the \gloskey{short} value (no link and no check for existence).
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccessshort}[1]{%
   \protect\mfirstucMakeUppercase{\glsentryshort{#1}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccessshortpl}
% Display the short plural form (no link and no check for existence).
%    \begin{macrocode}
  \newcommand*{\glsaccessshortpl}[1]{\glsentryshortpl{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccessshortpl}
% Display the short plural form with first letter converted to
% uppercase (no link and no check for existence).
%    \begin{macrocode}
  \newcommand*{\Glsaccessshortpl}[1]{\Glsentryshortpl{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccessshortpl}
% Display the \gloskey{shortplural} value (no link and no check for existence).
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccessshortpl}[1]{%
   \protect\mfirstucMakeUppercase{\glsentryshortpl{#1}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccesslong}
% Display the long form (no link and no check for existence).
%    \begin{macrocode}
  \newcommand*{\glsaccesslong}[1]{\glsentrylong{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccesslong}
% Display the long form (no link and no check for existence).
%    \begin{macrocode}
  \newcommand*{\Glsaccesslong}[1]{\Glsentrylong{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccesslong}
% Display the \gloskey{long} value (no link and no check for existence).
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccesslong}[1]{%
   \protect\mfirstucMakeUppercase{\glsentrylong{#1}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccesslongpl}
% Display the long plural form (no link and no check for existence).
%    \begin{macrocode}
  \newcommand*{\glsaccesslongpl}[1]{\glsentrylongpl{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsaccesslongpl}
% Display the long plural form (no link and no check for existence).
%    \begin{macrocode}
  \newcommand*{\Glsaccesslongpl}[1]{\Glsentrylongpl{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSaccesslongpl}
% Display the \gloskey{longplural} value (no link and no check for existence).
% converted to upper case.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
  \newcommand*{\GLSaccesslongpl}[1]{%
   \protect\mfirstucMakeUppercase{\glsentrylongpl{#1}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@initaccesskeys}
%\changes{1.31}{2018-05-09}{new}
%This does nothing if there's no accessibility support.
%    \begin{macrocode}
  \newcommand*{\@gls@initaccesskeys}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@setup@default@short@access}
%\changes{1.31}{2018-05-09}{new}
%This does nothing if there's no accessibility support.
%    \begin{macrocode}
  \newcommand{\@gls@setup@default@short@access}[1]{}%
%    \end{macrocode}
% End of else part
%    \begin{macrocode}
}
%    \end{macrocode}
%
%\section{Categories}
%\begin{macro}{\glscategory}
% Add a new storage key that can be used to indicate a category. The
% default category is \category{general}.
%    \begin{macrocode}
\glsaddstoragekey{category}{general}{\glscategory}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsifcategory}
% Convenient shortcut to determine if an entry has the given
% category.
%    \begin{macrocode}
\newcommand{\glsifcategory}[4]{%
 \ifglsfieldeq{#1}{category}{#2}{#3}{#4}%
}
%    \end{macrocode}
%\end{macro}
%
% Categories can have attributes.
%\begin{macro}{\glssetcategoryattribute}
%\begin{definition}
%\cs{glssetcategoryattribute}\marg{category}\marg{attribute-label}\marg{value}
%\end{definition}
% Set (or override if already set) an attribute for the given
% category.
%    \begin{macrocode}
\newcommand*{\glssetcategoryattribute}[3]{%
  \csdef{@glsxtr@categoryattr@@#1@#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsgetcategoryattribute}
%\begin{definition}
%\cs{glsgetcategoryattribute}\marg{category}\marg{attribute-label}
%\end{definition}
% Get the value of the given attribute for the given
% category. Does nothing if the attribute isn't defined.
%    \begin{macrocode}
\newcommand*{\glsgetcategoryattribute}[2]{%
  \csuse{@glsxtr@categoryattr@@#1@#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glshascategoryattribute}
%\begin{definition}
%\cs{glshascategoryattribute}\marg{category}\marg{attribute-label}\marg{true}\marg{false}
%\end{definition}
%\changes{0.5}{2015-12-07}{new}
% Tests if the category has the given attribute set.
%    \begin{macrocode}
\newcommand*{\glshascategoryattribute}[4]{%
  \ifcsvoid{@glsxtr@categoryattr@@#1@#2}{#4}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glssetattribute}
%\begin{definition}
%\cs{glssetattribute}\marg{entry label}\marg{attribute-label}\marg{value}
%\end{definition}
% Short cut where the category label is obtained from the entry
% information.
%    \begin{macrocode}
\newcommand*{\glssetattribute}[3]{%
  \glssetcategoryattribute{\glscategory{#1}}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsgetattribute}
%\begin{definition}
%\cs{glsgetattribute}\marg{entry label}\marg{attribute-label}
%\end{definition}
% Short cut where the category label is obtained from the entry
% information.
%    \begin{macrocode}
\newcommand*{\glsgetattribute}[2]{%
  \glsgetcategoryattribute{\glscategory{#1}}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glshasattribute}
%\begin{definition}
%\cs{glshasattribute}\marg{entry
%label}\marg{attribute-label}\marg{true}\marg{false}
%\end{definition}
%\changes{0.5}{2015-12-07}{new}
%\changes{0.5.4}{2015-12-15}{added check for entry's existence}
% Short cut to test if the given attribute has been set where the
% category label is obtained from the entry information.
%    \begin{macrocode}
\newcommand*{\glshasattribute}[4]{%
  \ifglsentryexists{#1}%
  {\glshascategoryattribute{\glscategory{#1}}{#2}{#3}{#4}}%
  {#4}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsifcategoryattribute}
%\begin{definition}
%\cs{glsifcategoryattribute}\marg{category}\marg{attribute-label}\marg{value}\marg{true
%part}\marg{false part}
%\end{definition}
% True if category has the attribute with the given value.
%    \begin{macrocode}
\newcommand{\glsifcategoryattribute}[5]{%
 \ifcsundef{@glsxtr@categoryattr@@#1@#2}%
 {#5}%
 {\ifcsstring{@glsxtr@categoryattr@@#1@#2}{#3}{#4}{#5}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsifattribute}
%\begin{definition}
%\cs{glsifattribute}\marg{entry label}\marg{attribute-label}\marg{value}\marg{true
%part}\marg{false part}
%\end{definition}
%Short cut to determine if the given entry has a category with the
%given attribute set.
%\changes{0.5.4}{2015-12-15}{added check for entry's existence}
%    \begin{macrocode}
\newcommand{\glsifattribute}[5]{%
  \ifglsentryexists{#1}%
  {\glsifcategoryattribute{\glscategory{#1}}{#2}{#3}{#4}{#5}}%
  {#5}%
}
%    \end{macrocode}
%\end{macro}
%
% Set attributes for the default \category{general} category:
%    \begin{macrocode}
\glssetcategoryattribute{general}{regular}{true}
%    \end{macrocode}
% Acronyms are regular by default, since they're typically just
% treated like normal words.
%    \begin{macrocode}
\glssetcategoryattribute{acronym}{regular}{true}
%    \end{macrocode}
%
%\begin{macro}{\glssetregularcategory}
%Convenient shortcut to create add the regular attribute.
%    \begin{macrocode}
\newcommand*{\glssetregularcategory}[1]{%
 \glssetcategoryattribute{#1}{regular}{true}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsifregularcategory}
%\begin{definition}
%\cs{glsifregularcategory}\marg{category}\marg{true part}\marg{false part}
%\end{definition}
% Short cut to determine if a category has the regular attribute
% explicitly set to true.
%    \begin{macrocode}
\newcommand{\glsifregularcategory}[3]{%
  \glsifcategoryattribute{#1}{regular}{true}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsifnotregularcategory}
%\begin{definition}
%\cs{glsifnotregularcategory}\marg{category}\marg{true part}\marg{false part}
%\end{definition}
% Short cut to determine if a category has the regular attribute
% explicitly set to false.
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newcommand{\glsifnotregularcategory}[3]{%
  \glsifcategoryattribute{#1}{regular}{false}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsifregular}
%\begin{definition}
%\cs{glsifregular}\marg{entry label}\marg{true part}\marg{false part}
%\end{definition}
% Short cut to determine if an entry has a regular attribute set to
% true.
%    \begin{macrocode}
\newcommand{\glsifregular}[3]{%
  \glsifregularcategory{\glscategory{#1}}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsifnotregular}
%\begin{definition}
%\cs{glsifnotregular}\marg{entry label}\marg{true part}\marg{false part}
%\end{definition}
% Short cut to determine if an entry has a regular attribute set to
% false.
%    \begin{macrocode}
\newcommand{\glsifnotregular}[3]{%
  \glsifnotregularcategory{\glscategory{#1}}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsforeachincategory}
%\begin{definition}
%\cs{glsforeachincategory}\oarg{glossary
%labels}\marg{category-label}\marg{glossary-cs}\marg{label-cs}\marg{body}
%\end{definition}
% Iterates through all entries in all the glossaries (or just those
% listed in \meta{glossary labels}) and does \meta{body} if the
% category matches \meta{category-label}. The control sequences
% \meta{glossary-cs} and \meta{label-cs} may be used in \meta{body}
% to access the glossary label and entry label for the current
% iteration.
%    \begin{macrocode}
\newcommand{\glsforeachincategory}[5][\@glo@types]{%
  \forallglossaries[#1]{#3}%
  {%
     \forglsentries[#3]{#4}%
     {%
       \glsifcategory{#4}{#2}{#5}{}%
     }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsforeachwithattribute}
%\begin{definition}
%\cs{glsforeachwithattribute}\oarg{glossary
%labels}\marg{attribute-label}\marg{attribute-value}\marg{glossary-cs}\marg{label-cs}\marg{body}
%\end{definition}
% Iterates through all entries in all the glossaries (or just those
% listed in \meta{glossary labels}) and does \meta{body} if the
% category attribute \meta{attribute-label} matches
% \meta{attribute-value}. The control sequences
% \meta{glossary-cs} and \meta{label-cs} may be used in \meta{body}
% to access the glossary label and entry label for the current
% iteration.
%    \begin{macrocode}
\newcommand{\glsforeachwithattribute}[6][\@glo@types]{%
  \forallglossaries[#1]{#4}%
  {%
     \forglsentries[#4]{#5}%
     {%
       \glsifattribute{#5}{#2}{#3}{#6}{}%
     }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
% If \cs{newterm} has been defined, redefine it so that it
% automatically sets the category label to \category{index} and add
% \cs{glsxtrpostdescription}.
%    \begin{macrocode}
\ifdef\newterm
{%
%    \end{macrocode}
%\begin{macro}{\newterm}
%\changes{0.4}{2015-12-03}{fixed name argument}
%    \begin{macrocode}
  \renewcommand*{\newterm}[2][]{%
    \newglossaryentry{#2}%
    {type={index},category=index,name={#2},%
     description={\glsxtrpostdescription\nopostdesc},#1}%
  }
%    \end{macrocode}
%\end{macro}
% Indexed terms are regular by default.
%    \begin{macrocode}
  \glssetcategoryattribute{index}{regular}{true}
%    \end{macrocode}
%\begin{macro}{\glsxtrpostdescindex}
%    \begin{macrocode}
  \newcommand*{\glsxtrpostdescindex}{}
%    \end{macrocode}
%\end{macro}
%    \begin{macrocode}
}
{}
%    \end{macrocode}
%
%If the \pkgopt{symbols} package option was used, define a similar
%command for symbols, but set the default sort to the label rather
%than the name as the symbols will typically contain commands that
%will confuse makeindex and xindy.
%    \begin{macrocode}
\ifdef\printsymbols
{%
%    \end{macrocode}
%\begin{macro}{\glsxtrnewsymbol}
%\changes{0.4}{2015-12-03}{added extra argument}
% Unlike \cs{newterm}, this has a separate argument for the label
% (since the symbol will likely contain commands).
%    \begin{macrocode}
  \newcommand*{\glsxtrnewsymbol}[3][]{%
    \newglossaryentry{#2}{name={#3},sort={#2},type=symbols,category=symbol,#1}%
  }
%    \end{macrocode}
%\end{macro}
% Symbols are regular by default.
%    \begin{macrocode}
  \glssetcategoryattribute{symbol}{regular}{true}
%    \end{macrocode}
%\begin{macro}{\glsxtrpostdescsymbol}
%    \begin{macrocode}
  \newcommand*{\glsxtrpostdescsymbol}{}
%    \end{macrocode}
%\end{macro}
%    \begin{macrocode}
}
{}
%    \end{macrocode}
%
% Similar for the numbers option.
%    \begin{macrocode}
\ifdef\printnumbers
{%
%    \end{macrocode}
%\begin{macro}{\glsxtrnewnumber}
%\changes{0.4}{2015-12-03}{added extra argument}
%    \begin{macrocode}
\ifdef\printnumbers
  \newcommand*{\glsxtrnewnumber}[3][]{%
    \newglossaryentry{#2}{name={#3},sort={#2},type=numbers,category=number,#1}%
  }
%    \end{macrocode}
%\end{macro}
% Numbers are regular by default.
%    \begin{macrocode}
  \glssetcategoryattribute{number}{regular}{true}
%    \end{macrocode}
%\begin{macro}{\glsxtrpostdescnumber}
%    \begin{macrocode}
  \newcommand*{\glsxtrpostdescnumber}{}
%    \end{macrocode}
%\end{macro}
%    \begin{macrocode}
}
{}
%    \end{macrocode}
%
%\begin{macro}{\glsxtrsetcategory}
% Set the category for all listed labels. The first argument is the
% list of entry labels and the second argument is the category label.
%    \begin{macrocode}
\newcommand*{\glsxtrsetcategory}[2]{%
  \@for\@glsxtr@label:=#1\do
  {%
    \glsfieldxdef{\@glsxtr@label}{category}{#2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrsetcategoryforall}
% Set the category for all entries in the listed glossaries. The first argument 
% is the list of glossary labels and the second argument is the category label.
%    \begin{macrocode}
\newcommand*{\glsxtrsetcategoryforall}[2]{%
  \forallglossaries[#1]{\@glsxtr@type}{%
    \forglsentries[\@glsxtr@type]{\@glsxtr@label}%
    {%
      \glsfieldxdef{\@glsxtr@label}{category}{#2}%
    }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrfieldtitlecase}
%\begin{definition}
%\cs{glsxtrfieldtitlecase}\marg{label}\marg{field}
%\end{definition}
% Apply title casing to the contents of the given field.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrfieldtitlecase}[2]{%
  \expandafter\glsxtrfieldtitlecasecs\expandafter
    {\csname glo@\glsdetoklabel{#1}@#2\endcsname}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrfieldtitlecasecs}
%The command used by \cs{glsxtrfieldtitlecase}. May be
%redefined to use a different command, for example,
%\cs{xcapitalisefmtwords}.
%\changes{1.07}{2016-08-15}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrfieldtitlecasecs}[1]{\xcapitalisewords{#1}}
%    \end{macrocode}
%\end{macro}
%
% Provide a convenient way to modify glossary styles without having
% to define a new style just to convert the first letter of fields
% to upper case.
%\begin{macro}{\glossentrydesc}
% If the \catattr{glossdesc} attribute is \qt{firstuc} convert first
% letter to upper case. If the attribute is \qt{title} use title
% case.
%    \begin{macrocode}
\@ifpackageloaded{glossaries-accsupp}
{
  \renewcommand*{\glossentrydesc}[1]{%
    \glsdoifexistsorwarn{#1}%
    {%
      \glssetabbrvfmt{\glscategory{#1}}%
%    \end{macrocode}
% As from version 1.04, allow the \catattr{glossdescfont} attribute
% to determine the font applied.
%\changes{1.04}{2016-05-02}{added glossdescfont attribute check}
%    \begin{macrocode}
      \glshasattribute{#1}{glossdescfont}%
      {%
        \edef\@glsxtr@attrval{\glsgetattribute{#1}{glossdescfont}}%
        \ifcsdef{\@glsxtr@attrval}%
        {%
          \letcs{\@glsxtr@glossdescfont}{\@glsxtr@attrval}%
        }%
        {%
          \GlossariesExtraWarning{Unknown control sequence name 
          `\@glsxtr@attrval' supplied in glossdescfont attribute
          for entry `#1'. Ignoring}%
          \let\@glsxtr@glossdescfont\@firstofone
        }%
      }%
      {\let\@glsxtr@glossdescfont\@firstofone}%
      \glsifattribute{#1}{glossdesc}{firstuc}%
      {%
        \@glsxtr@glossdescfont{\Glsaccessdesc{#1}}%
      }%
      {%
        \glsifattribute{#1}{glossdesc}{title}%
        {%
          \@glsxtr@do@titlecaps@warn
          \glsdescriptionaccessdisplay
          {%
            \@glsxtr@glossdescfont{\glsxtrfieldtitlecase{#1}{desc}}%
          }%
          {#1}%
        }%
        {%
          \@glsxtr@glossdescfont{\glsaccessdesc{#1}}%
        }%
      }%
    }%
  }
}
{
  \renewcommand*{\glossentrydesc}[1]{%
    \glsdoifexistsorwarn{#1}%
    {%
      \glssetabbrvfmt{\glscategory{#1}}%
      \glshasattribute{#1}{glossdescfont}%
      {%
        \edef\@glsxtr@attrval{\glsgetattribute{#1}{glossdescfont}}%
        \ifcsdef{\@glsxtr@attrval}%
        {%
          \letcs{\@glsxtr@glossdescfont}{\@glsxtr@attrval}%
        }%
        {%
          \GlossariesExtraWarning{Unknown control sequence name 
          `\@glsxtr@attrval' supplied in glossdescfont attribute
          for entry `#1'. Ignoring}%
          \let\@glsxtr@glossdescfont\@firstofone
        }%
      }%
      {\let\@glsxtr@glossdescfont\@firstofone}%
      \glsifattribute{#1}{glossdesc}{firstuc}%
      {%
        \@glsxtr@glossdescfont{\Glsentrydesc{#1}}%
      }%
      {%
        \glsifattribute{#1}{glossdesc}{title}%
        {%
          \@glsxtr@do@titlecaps@warn
          \@glsxtr@glossdescfont{\glsxtrfieldtitlecase{#1}{desc}}%
        }%
        {%
          \@glsxtr@glossdescfont{\glsentrydesc{#1}}%
        }%
      }%
    }%
  }
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glossentryname}
% If the \catattr{glossname} attribute is \qt{firstuc} convert first
% letter to upper case. If the attribute is \qt{title} use title
% case.
%    \begin{macrocode}
\@ifpackageloaded{glossaries-accsupp}
{
  \renewcommand*{\glossentryname}[1]{%
    \@glsdoifexistsorwarn{#1}%
    {%
      \glssetabbrvfmt{\glscategory{#1}}%
%    \end{macrocode}
% As from version 1.04, allow the \catattr{glossnamefont} attribute
% to determine the font applied.
%\changes{1.04}{2016-05-02}{added glossnamefont attribute check}
%    \begin{macrocode}
      \glshasattribute{#1}{glossnamefont}%
      {%
        \edef\@glsxtr@attrval{\glsgetattribute{#1}{glossnamefont}}%
        \ifcsdef{\@glsxtr@attrval}%
        {%
          \letcs{\@glsxtr@glossnamefont}{\@glsxtr@attrval}%
        }%
        {%
          \GlossariesExtraWarning{Unknown control sequence name 
          `\@glsxtr@attrval' supplied in glossnamefont attribute
          for entry `#1'. Reverting to default \string\glsnamefont}%
          \let\@glsxtr@glossnamefont\glsnamefont
        }%
      }%
      {\let\@glsxtr@glossnamefont\glsnamefont}%
      \glsifattribute{#1}{glossname}{firstuc}%
      {%
        \glsnameaccessdisplay
        {%
          \@glsxtr@glossnamefont{\Glsentryname{#1}}%
        }%
        {#1}%
      }%
      {%
        \glsifattribute{#1}{glossname}{title}%
        {%
          \@glsxtr@do@titlecaps@warn
          \glsnameaccessdisplay
          {%
            \@glsxtr@glossnamefont{\glsxtrfieldtitlecase{#1}{name}}%
          }%
          {#1}%
        }%
        {%
          \glsifattribute{#1}{glossname}{uc}%
          {%
            \glsnameaccessdisplay
            {%
%    \end{macrocode}
% Hide the label from the upper-casing command.
%    \begin{macrocode}
               \letcs{\glo@name}{glo@\glsdetoklabel{#1}@name}%
               \@glsxtr@glossnamefont{\mfirstucMakeUppercase{\glo@name}}%
            }%
            {#1}%
          }%
          {%
            \letcs{\glo@name}{glo@\glsdetoklabel{#1}@name}%
            \glsnameaccessdisplay
            {%
              \expandafter\@glsxtr@glossnamefont\expandafter{\glo@name}%
            }%
            {#1}%
          }%
        }%
      }%
%    \end{macrocode}
% Do post-name hook:
%    \begin{macrocode}
      \glsxtrpostnamehook{#1}%
    }%
  }
}
{
  \renewcommand*{\glossentryname}[1]{%
    \@glsdoifexistsorwarn{#1}%
    {%
      \glssetabbrvfmt{\glscategory{#1}}%
      \glshasattribute{#1}{glossnamefont}%
      {%
        \edef\@glsxtr@attrval{\glsgetattribute{#1}{glossnamefont}}%
        \ifcsdef{\@glsxtr@attrval}%
        {%
          \letcs{\@glsxtr@glossnamefont}{\@glsxtr@attrval}%
        }%
        {%
          \GlossariesExtraWarning{Unknown control sequence name 
          `\@glsxtr@attrval' supplied in glossnamefont attribute
          for entry `#1'. Reverting to default \string\glsnamefont}%
          \let\@glsxtr@glossnamefont\glsnamefont
        }%
      }%
      {\let\@glsxtr@glossnamefont\glsnamefont}%
      \glsifattribute{#1}{glossname}{firstuc}%
      {%
        \@glsxtr@glossnamefont{\Glsentryname{#1}}%
      }%
      {%
        \glsifattribute{#1}{glossname}{title}%
        {%
          \@glsxtr@do@titlecaps@warn
          \@glsxtr@glossnamefont{\glsxtrfieldtitlecase{#1}{name}}%
        }%
        {%
          \glsifattribute{#1}{glossname}{uc}%
          {%
%    \end{macrocode}
% Hide the label from the upper-casing command.
%    \begin{macrocode}
            \letcs{\glo@name}{glo@\glsdetoklabel{#1}@name}%
            \@glsxtr@glossnamefont{\mfirstucMakeUppercase{\glo@name}}%
          }%
          {%
%    \end{macrocode}
% This little trick is used by \styfmt{glossaries} to allow the user to
% redefine \ics{glsnamefont} to use \cs{makefirstuc}. Support it
% even though they can now use the \catattr{firstuc} attribute.
%    \begin{macrocode}
            \letcs{\glo@name}{glo@\glsdetoklabel{#1}@name}%
            \expandafter\@glsxtr@glossnamefont\expandafter{\glo@name}%
          }%
        }%
      }%
%    \end{macrocode}
% Do post-name hook.
%\changes{1.04}{2016-05-02}{moved post name hook inside condition}
%    \begin{macrocode}
      \glsxtrpostnamehook{#1}%
    }%
  }
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glossentryname}
% Redefine to set the abbreviation format and accessibility support.
%\changes{0.5.2}{2015-12-08}{added}
%    \begin{macrocode}
\@ifpackageloaded{glossaries-accsupp}
{
  \renewcommand*{\Glossentryname}[1]{%
    \@glsdoifexistsorwarn{#1}%
    {%
      \glssetabbrvfmt{\glscategory{#1}}%
%    \end{macrocode}
% As from version 1.04, allow the \catattr{glossnamefont} attribute
% to determine the font applied.
%\changes{1.04}{2016-05-02}{added glossnamefont attribute check}
%    \begin{macrocode}
      \glshasattribute{#1}{glossnamefont}%
      {%
        \edef\@glsxtr@attrval{\glsgetattribute{#1}{glossnamefont}}%
        \ifcsdef{\@glsxtr@attrval}%
        {%
          \letcs{\@glsxtr@glossnamefont}{\@glsxtr@attrval}%
        }%
        {%
          \GlossariesExtraWarning{Unknown control sequence name 
          `\@glsxtr@attrval' supplied in glossnamefont attribute
          for entry `#1'. Reverting to default \string\glsnamefont}%
          \let\@glsxtr@glossnamefont\glsnamefont
        }%
      }%
      {\let\@glsxtr@glossnamefont\glsnamefont}%
      \glsnameaccessdisplay
      {%
        \@glsxtr@glossnamefont{\Glsentryname{#1}}%
      }%
      {#1}%
%    \end{macrocode}
% Do post-name hook:
%    \begin{macrocode}
      \glsxtrpostnamehook{#1}%
    }%
  }
}
{
  \renewcommand*{\Glossentryname}[1]{%
    \@glsdoifexistsorwarn{#1}%
    {%
      \glssetabbrvfmt{\glscategory{#1}}%
      \glshasattribute{#1}{glossnamefont}%
      {%
        \edef\@glsxtr@attrval{\glsgetattribute{#1}{glossnamefont}}%
        \ifcsdef{\@glsxtr@attrval}%
        {%
          \letcs{\@glsxtr@glossnamefont}{\@glsxtr@attrval}%
        }%
        {%
          \GlossariesExtraWarning{Unknown control sequence name 
          `\@glsxtr@attrval' supplied in glossnamefont attribute
          for entry `#1'. Reverting to default \string\glsnamefont}%
          \let\@glsxtr@glossnamefont\glsnamefont
        }%
      }%
      {\let\@glsxtr@glossnamefont\glsnamefont}%
      \@glsxtr@glossnamefont{\Glsentryname{#1}}%
%    \end{macrocode}
% Do post-name hook:
%    \begin{macrocode}
      \glsxtrpostnamehook{#1}%
    }%
  }
}
%    \end{macrocode}
%\end{macro}
%
% Provide a convenient way to also index the entries using the
% standard \ics{index} mechanism. This may use different actual,
% encap and escape characters to those used for the glossaries.
%
%\begin{macro}{\glsxtrpostnamehook}
%\changes{0.5.3}{2015-12-09}{new}
% Hook to append stuff after the name is displayed in the glossary. 
% The argument is the entry's label.
%    \begin{macrocode}
\newcommand*{\glsxtrpostnamehook}[1]{%
  \let\@glsnumberformat\@glsxtr@defaultnumberformat
  \glsxtrdoautoindexname{#1}{indexname}%
%    \end{macrocode}
%Allow additional code regardless of category:
%    \begin{macrocode}
  \glsextrapostnamehook{#1}%
%    \end{macrocode}
% Allow categories to hook in here.
%\changes{1.04}{2016-05-02}{added category check}
%    \begin{macrocode}
  \csuse{glsxtrpostname\glscategory{#1}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsextrapostnamehook}
%\changes{1.25}{2017-11-24}{new}
%    \begin{macrocode}
\newcommand*{\glsextrapostnamehook}[1]{}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdefpostname}
%\changes{1.31}{2018-05-09}{new}
%Provide a convenient command for defining the post-name hook
%for the given category.
%    \begin{macrocode}
\newcommand*{\glsdefpostname}[2]{%
  \csdef{glsxtrpostname#1}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@setaccessdisplay}
%\changes{1.22}{2017-11-08}{new}
%    \begin{macrocode}
\@ifpackageloaded{glossaries-accsupp}
{
  \newcommand*{\glsxtr@setaccessdisplay}[1]{%
     \ifcsdef{gls#1accessdisplay}%
     {\letcs\@glsxtr@accessdisplay{gls#1accessdisplay}}%
     {%
%    \end{macrocode}
%This is essentially the reverse of \cs{@gls@fetchfield}, since the
%field supplied to \cs{glossentryname} has to be the internal label,
%but the \cs{gls\meta{field}accessdisplay} commands use the key name.
%    \begin{macrocode}
       \edef\@gls@thisval{#1}%
       \@for\@gls@map:=\@gls@keymap\do{%
        \edef\@this@key{\expandafter\@secondoftwo\@gls@map}%
        \ifdefequal{\@this@key}{\@gls@thisval}%
        {%
          \edef\@gls@thisval{\expandafter\@firstoftwo\@gls@map}%
          \@endfortrue
        }%
        {}%
       }%
       \ifcsdef{gls\@gls@thisval accessdisplay}%
       {\letcs\@glsxtr@accessdisplay{gls\@gls@thisval accessdisplay}}%
       {\let\@glsxtr@accessdisplay\@firstoftwo}%
     }%
  }
}
{%
  \newcommand*{\glsxtr@setaccessdisplay}[1]{%
   \let\@glsxtr@accessdisplay\@firstoftwo}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glossentrynameother}
% Provide a command that works like \cs{glossentryname}
% but accesses a different field (which must be supplied using its
% internal field label).
%\changes{1.22}{2017-11-08}{new}
%    \begin{macrocode}
\newrobustcmd*{\glossentrynameother}[2]{%
  \@glsdoifexistsorwarn{#1}%
  {%
%    \end{macrocode}
%Accessibility support:
%    \begin{macrocode}
    \glsxtr@setaccessdisplay{#2}%
%    \end{macrocode}
%Set the abbreviation format:
%    \begin{macrocode}
    \glssetabbrvfmt{\glscategory{#1}}%
    \glshasattribute{#1}{glossnamefont}%
    {%
      \edef\@glsxtr@attrval{\glsgetattribute{#1}{glossnamefont}}%
      \ifcsdef{\@glsxtr@attrval}%
      {%
        \letcs{\@glsxtr@glossnamefont}{\@glsxtr@attrval}%
      }%
      {%
        \GlossariesExtraWarning{Unknown control sequence name 
        `\@glsxtr@attrval' supplied in glossnamefont attribute
        for entry `#1'. Reverting to default \string\glsnamefont}%
        \let\@glsxtr@glossnamefont\glsnamefont
      }%
    }%
    {\let\@glsxtr@glossnamefont\glsnamefont}%
    \glsifattribute{#1}{glossname}{firstuc}%
    {%
      \@glsxtr@accessdisplay
      {\@glsxtr@glossnamefont{\@Gls@entry@field{#1}{#2}}}%
      {#1}%
    }%
    {%
      \glsifattribute{#1}{glossname}{title}%
      {%
        \@glsxtr@do@titlecaps@warn
        \@glsxtr@accessdisplay
        {\@glsxtr@glossnamefont{\glsxtrfieldtitlecase{#1}{#2}}}%
        {#1}%
      }%
      {%
        \glsifattribute{#1}{glossname}{uc}%
        {%
          \letcs{\glo@name}{glo@\glsdetoklabel{#1}@#2}%
          \@glsxtr@accessdisplay
          {\@glsxtr@glossnamefont{\mfirstucMakeUppercase{\glo@name}}}%
          {#1}%
        }%
        {%
          \letcs{\glo@name}{glo@\glsdetoklabel{#1}@#2}%
          \@glsxtr@accessdisplay
          {\expandafter\@glsxtr@glossnamefont\expandafter{\glo@name}}%
          {#1}%
        }%
      }%
    }%
%    \end{macrocode}
% Do post-name hook.
%    \begin{macrocode}
      \glsxtrpostnamehook{#1}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\if@glsxtr@format@override}
%\changes{0.5.3}{2015-12-09}{new}
% Determines if the \gloskey[glslink]{format} key should override
% the indexing attribute value.
%    \begin{macrocode}
\newif\if@glsxtr@format@override
\@glsxtr@format@overridefalse
%    \end{macrocode}
%\end{macro}
%
%If overriding is enabled, the \ics{glshypernumber} command will have to 
%be redefined in the index to use \cs{hyperpage} instead.
%\begin{macro}{\GlsXtrEnableIndexFormatOverride}
%    \begin{macrocode}
\@ifpackageloaded{hyperref}
{
%    \end{macrocode}
% If \sty{hyperref}'s \pkgoptfmt{hyperindex} option is on, then
% \sty{hyperref} will automatically add \cs{hyperpage}, so don't
% add it.
%    \begin{macrocode}
  \ifHy@hyperindex
    \newcommand*{\GlsXtrEnableIndexFormatOverride}{%
      \@glsxtr@format@overridetrue
      \appto\theindex{\let\glshypernumber\@firstofone}%
    }
  \else
    \newcommand*{\GlsXtrEnableIndexFormatOverride}{%
      \@glsxtr@format@overridetrue
      \appto\theindex{\let\glshypernumber\hyperpage}%
    }
  \fi
}
{
  \newcommand*{\GlsXtrEnableIndexFormatOverride}{%
    \@glsxtr@format@overridetrue
  }
}
\@onlypreamble\GlsXtrEnableIndexFormatOverride
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrdoautoindexname}
%\changes{0.5.3}{2015-12-09}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrdoautoindexname}[2]{%
  \glshasattribute{#1}{#2}%
  {%
%    \end{macrocode}
% Escape any makeindex/xindy characters in the value of the \gloskey{name}
% field. Take care with \sty{babel} as this won't work if the
% category code has changed for those characters.
%    \begin{macrocode}
    \@glsxtr@autoindex@setname{#1}%
%    \end{macrocode}
% If the attribute value is simply \qt{true} don't add an encap,
% otherwise use the value as the encap.
%    \begin{macrocode}
    \protected@edef\@glsxtr@attrval{\glsgetattribute{#1}{#2}}%
    \if@glsxtr@format@override
%    \end{macrocode}
%\changes{1.19}{2017-09-09}{changed format test}
%    \begin{macrocode}
      \ifx\@glsnumberformat\@glsxtr@defaultnumberformat
      \else
        \let\@glsxtr@attrval\@glsnumberformat
      \fi
    \fi
    \ifdefstring{\@glsxtr@attrval}{true}%
    {}%
    {\eappto\@glo@name{\@glsxtr@autoindex@encap\@glsxtr@attrval}}%
    \expandafter\glsxtrautoindex\expandafter{\@glo@name}%
  }%
  {}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrautoindex}
%\changes{1.16}{2017-06-15}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrautoindex}{\index}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@autoindex@setname}
%\changes{0.5.3}{2015-12-09}{new}
% Assign \cs{@glo@name} for use with \catattr{indexname} attribute.
%    \begin{macrocode}
\newcommand*{\@glsxtr@autoindex@setname}[1]{%
  \protected@edef\@glo@name{\glsxtrautoindexentry{#1}}%
  \glsxtrautoindexassignsort{\@glo@sort}{#1}%
  \@gls@checkmkidxchars\@glo@sort
  \@glsxtr@autoindex@doextra@esc\@glo@sort
  \epreto\@glo@name{\@glo@sort\@glsxtr@autoindex@at}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrautoindexentry}
%\changes{1.16}{2017-06-15}{new}
%Command used for the actual part when auto-indexing.
%    \begin{macrocode}
\newcommand*{\glsxtrautoindexentry}[1]{\string\glsentryname{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrautoindexassignsort}
%\changes{1.16}{2017-06-15}{new}
%Used to assign the sort value when auto-indexing.
%    \begin{macrocode}
\newcommand*{\glsxtrautoindexassignsort}[2]{%
  \glsletentryfield{#1}{#2}{sort}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@autoindex@doextra@esc}
%    \begin{macrocode}
\newcommand*{\@glsxtr@autoindex@doextra@esc}[1]{%
%    \end{macrocode}
% Escape the escape character unless it has already been escaped.
%    \begin{macrocode}
  \ifx\@glsxtr@autoindex@esc\@gls@quotechar
  \else
    \def\@gls@checkedmkidx{}%
    \edef\@@glsxtr@checkspch{%
      \noexpand\@glsxtr@autoindex@escquote\expandonce{#1}%
        \noexpand\@empty\@glsxtr@autoindex@esc\noexpand\@nnil
        \@glsxtr@autoindex@esc\noexpand\@empty\noexpand\@glsxtr@endescspch}%
    \@@glsxtr@checkspch
    \let#1\@gls@checkedmkidx\relax
  \fi
%    \end{macrocode}
% Escape actual character unless it has already been escaped.
%    \begin{macrocode}
  \ifx\@glsxtr@autoindex@at\@gls@actualchar
  \else
    \def\@gls@checkedmkidx{}%
    \edef\@@glsxtr@checkspch{%
      \noexpand\@glsxtr@autoindex@escat\expandonce{#1}%
        \noexpand\@empty\@glsxtr@autoindex@at\noexpand\@nnil
        \@glsxtr@autoindex@at\noexpand\@empty\noexpand\@glsxtr@endescspch}%
    \@@glsxtr@checkspch
    \let#1\@gls@checkedmkidx\relax
  \fi
%    \end{macrocode}
% Escape level character unless it has already been escaped.
%    \begin{macrocode}
  \ifx\@glsxtr@autoindex@level\@gls@levelchar
  \else
    \def\@gls@checkedmkidx{}%
    \edef\@@glsxtr@checkspch{%
      \noexpand\@glsxtr@autoindex@esclevel\expandonce{#1}%
        \noexpand\@empty\@glsxtr@autoindex@level\noexpand\@nnil
        \@glsxtr@autoindex@level\noexpand\@empty\noexpand\@glsxtr@endescspch}%
    \@@glsxtr@checkspch
    \let#1\@gls@checkedmkidx\relax
  \fi
%    \end{macrocode}
% Escape encap character unless it has already been escaped.
%    \begin{macrocode}
  \ifx\@glsxtr@autoindex@encap\@gls@encapchar
  \else
    \def\@gls@checkedmkidx{}%
    \edef\@@glsxtr@checkspch{%
      \noexpand\@glsxtr@autoindex@escencap\expandonce{#1}%
        \noexpand\@empty\@glsxtr@autoindex@encap\noexpand\@nnil
        \@glsxtr@autoindex@encap\noexpand\@empty\noexpand\@glsxtr@endescspch}%
    \@@glsxtr@checkspch
    \let#1\@gls@checkedmkidx\relax
  \fi
}
%    \end{macrocode}
%\end{macro}
%
% The user commands here have a preamble-only restriction to ensure
% they are set before required and also to reduce the chances of
% complications caused by \sty{babel}'s shorthands.
%
%\begin{macro}{\@glsxtr@autoindex@at}
%\changes{0.5.3}{2015-12-09}{new}
% Actual character for use with \cs{index}.
%    \begin{macrocode}
\newcommand*{\@glsxtr@autoindex@at}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrSetActualChar}
% Set the actual character.
%    \begin{macrocode}
\newcommand*{\GlsXtrSetActualChar}[1]{%
  \gdef\@glsxtr@autoindex@at{#1}%
  \def\@glsxtr@autoindex@escat##1#1##2#1##3\@glsxtr@endescspch{%
    \@@glsxtr@autoindex@escspch{#1}{\@glsxtr@autoindex@escat}{##1}{##2}{##3}%
  }%
}
\@onlypreamble\GlsXtrSetActualChar
\makeatother
\GlsXtrSetActualChar{@}
\makeatletter
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@autoindex@encap}
%\changes{0.5.3}{2015-12-09}{new}
% Encap character for use with \cs{index}.
%    \begin{macrocode}
\newcommand*{\@glsxtr@autoindex@encap}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrSetEncapChar}
% Set the encap character.
%    \begin{macrocode}
\newcommand*{\GlsXtrSetEncapChar}[1]{%
  \gdef\@glsxtr@autoindex@encap{#1}%
  \def\@glsxtr@autoindex@escencap##1#1##2#1##3\@glsxtr@endescspch{%
    \@@glsxtr@autoindex@escspch{#1}{\@glsxtr@autoindex@escencap}{##1}{##2}{##3}%
  }%
}
\GlsXtrSetEncapChar{|}
\@onlypreamble\GlsXtrSetEncapChar
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@autoindex@level}
%\changes{0.5.3}{2015-12-09}{new}
% Level character for use with \cs{index}.
%    \begin{macrocode}
\newcommand*{\@glsxtr@autoindex@level}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrSetLevelChar}
% Set the encap character.
%    \begin{macrocode}
\newcommand*{\GlsXtrSetLevelChar}[1]{%
  \gdef\@glsxtr@autoindex@level{#1}%
  \def\@glsxtr@autoindex@esclevel##1#1##2#1##3\@glsxtr@endescspch{%
    \@@glsxtr@autoindex@escspch{#1}{\@glsxtr@autoindex@esclevel}{##1}{##2}{##3}%
  }%
}
\GlsXtrSetLevelChar{!}
\@onlypreamble\GlsXtrSetLevelChar
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@autoindex@esc}
%\changes{0.5.3}{2015-12-09}{new}
% Escape character for use with \cs{index}.
%    \begin{macrocode}
\newcommand*{\@glsxtr@autoindex@esc}{"}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrSetEscChar}
% Set the escape character.
%    \begin{macrocode}
\newcommand*{\GlsXtrSetEscChar}[1]{%
  \gdef\@glsxtr@autoindex@esc{#1}%
  \def\@glsxtr@autoindex@escquote##1#1##2#1##3\@glsxtr@endescspch{%
    \@@glsxtr@autoindex@escspch{#1}{\@glsxtr@autoindex@escquote}{##1}{##2}{##3}%
  }%
}
\GlsXtrSetEscChar{"}
\@onlypreamble\GlsXtrSetEscChar
%    \end{macrocode}
%\end{macro}
%
% Set if defined. (For example, if \sty{doc} package has been
% loaded.) Actual character \ics{actualchar}:
%    \begin{macrocode}
\ifdef\actualchar
 {\expandafter\GlsXtrSetActualChar\expandafter{\actualchar}}
 {}
%    \end{macrocode}
% Quote character \ics{quotechar}:
%    \begin{macrocode}
\ifdef\quotechar
 {\expandafter\GlsXtrSetEscChar\expandafter{\quotechar}}
 {}
%    \end{macrocode}
% Level character \ics{levelchar}:
%    \begin{macrocode}
\ifdef\levelchar
 {\expandafter\GlsXtrSetLevelChar\expandafter{\levelchar}}
 {}
%    \end{macrocode}
% Encap character \ics{encapchar}:
%    \begin{macrocode}
\ifdef\encapchar
 {\expandafter\GlsXtrSetEncapChar\expandafter{\encapchar}}
 {}
%    \end{macrocode}
%
%\begin{macro}{\@glsxtr@gobbleto@endescspch}
%    \begin{macrocode}
\def\@glsxtr@gobbleto@endescspch#1\@glsxtr@endescspch{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@@glsxtr@autoindex@esc@spch}
%\begin{definition}
%\cs{@@glsxtr@autoindex@escspch}\marg{char}\marg{cs}\marg{pre}\marg{mid}\marg{post}
%\end{definition}
%    \begin{macrocode}
\newcommand*{\@@glsxtr@autoindex@escspch}[5]{%
  \@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
  \toks@={#3}%
  \ifx\@nnil#3\relax
    \def\@@glsxtr@checkspch{\@glsxtr@gobbleto@endescspch#5\@glsxtr@endescspch}%
  \else
    \ifx\@nnil#4\relax
      \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
     \def\@@glsxtr@checkspch{\@glsxtr@gobbleto@endescspch
        #4#5\@glsxtr@endescspch}%
    \else
      \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
       \@glsxtr@autoindex@esc#1}%
      \def\@@glsxtr@checkspch{#2#5#1\@nnil#1\@glsxtr@endescspch}%
    \fi
  \fi
  \@@glsxtr@checkspch
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glossentrydesc}
% Redefine to set the abbreviation format and accessibility support.
%\changes{0.5.2}{2015-12-08}{added}
%    \begin{macrocode}
\renewcommand*{\Glossentrydesc}[1]{%
  \glsdoifexistsorwarn{#1}%
  {%
    \glssetabbrvfmt{\glscategory{#1}}%
    \Glsaccessdesc{#1}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glossentrysymbol}
% Redefine to set the abbreviation format and accessibility support.
%\changes{0.5.2}{2015-12-08}{added}
%    \begin{macrocode}
\renewcommand*{\glossentrysymbol}[1]{%
  \glsdoifexistsorwarn{#1}%
  {%
    \glssetabbrvfmt{\glscategory{#1}}%
    \glsaccesssymbol{#1}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glossentrysymbol}
% Redefine to set the abbreviation format and accessibility support.
%\changes{0.5.2}{2015-12-08}{added}
%    \begin{macrocode}
\renewcommand*{\Glossentrysymbol}[1]{%
  \glsdoifexistsorwarn{#1}%
  {%
    \glssetabbrvfmt{\glscategory{#1}}%
    \Glsaccesssymbol{#1}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%Allow initials to be marked but only use the formatting for the
%tag in the glossary.
%\begin{macro}{\GlsXtrEnableInitialTagging}
% Allow initial tagging. The first argument is a list of categories
% to apply this to. The second argument is the name of the command to
% use to tag the initials. This can't already be defined for safety
% unless the starred version is used.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
\newcommand*{\GlsXtrEnableInitialTagging}{%
  \@ifstar\s@glsxtr@enabletagging\@glsxtr@enabletagging
}
\@onlypreamble\GlsXtrEnableInitialTagging
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@enabletagging}
% Starred version undefines command.
%    \begin{macrocode}
\newcommand*{\s@glsxtr@enabletagging}[2]{%
  \undef#2%
  \@glsxtr@enabletagging{#1}{#2}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glsxtr@enabletagging}
% Internal command.
%    \begin{macrocode}
\newcommand*{\@glsxtr@enabletagging}[2]{%
%    \end{macrocode}
% Set attributes for categories given in the first argument.
%    \begin{macrocode}
  \@for\@glsxtr@cat:=#1\do
  {%
    \ifdefempty\@glsxtr@cat
    {}%
    {\glssetcategoryattribute{\@glsxtr@cat}{tagging}{true}}%
  }%
  \newrobustcmd*#2[1]{##1}%
  \def\@glsxtr@taggingcs{#2}%
  \renewcommand*\@glsxtr@activate@initialtagging{%
    \let#2\@glsxtr@tag
  }%
  \ifundef\@gls@preglossaryhook
  {\GlossariesExtraWarning{Initial tagging requires at least 
    glossaries.sty v4.19 to work correctly}}%
  {}%
}
%    \end{macrocode}
%\end{macro}
%
%Are we using an old version of \sty{mfirstuc} that has a bug in 
%\cs{capitalisewords}? If so, patch it so we don't have a problem
% with a combination of tagging and title case.
%\begin{macro}{\mfu@checkword@do}
%If this command hasn't been defined, then we have pre v2.02 of
%\sty{mfirstuc}
%\changes{0.5.2}{2015-12-08}{added}
%    \begin{macrocode}
\ifundef\mfu@checkword@do
{
  \newcommand*{\mfu@checkword@do}[1]{%
   \ifdefstring{\mfu@checkword@arg}{#1}%
   {%
     \let\@mfu@domakefirstuc\@firstofone
     \listbreak
   }%
   {}%
  }
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\mfu@checkword}
% \cs{capitalisewords} was introduced in \sty{mfirstuc} v1.06.
% If \cs{mfu@checkword} hasn't been defined \sty{mfirstuc} is too
% old to support the title case attribute.
%    \begin{macrocode}
  \ifundef\mfu@checkword
  {
    \newcommand{\@glsxtr@do@titlecaps@warn}{%
     \GlossariesExtraWarning{mfirstuc.sty too old. Title Caps
      support not available}%
%    \end{macrocode}
% One warning should suffice.
%    \begin{macrocode}
      \let\@glsxtr@do@titlecaps@warn\relax
    }
  }
  {
    \renewcommand*{\mfu@checkword}[1]{%
      \def\mfu@checkword@arg{#1}%
      \let\@mfu@domakefirstuc\makefirstuc
      \forlistloop\mfu@checkword@do\@mfu@nocaplist
    }
  }
}
{}% no patch required
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@do@titlecaps@warn}
% Do warning if title case not supported.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@do@titlecaps@warn}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@activate@initialtagging}
% Used in \cs{printglossary} but at least v4.19 of \styfmt{glossaries}
% required.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
\newcommand*\@glsxtr@activate@initialtagging{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@tag}
%\changes{0.5.2}{2015-12-08}{new}
% Definition of tagging command when used in glossary.
%    \begin{macrocode}
\newrobustcmd*{\@glsxtr@tag}[1]{%
  \glsifattribute{\glscurrententrylabel}{tagging}{true}%
  {\glsxtrtagfont{#1}}{#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrtagfont}
% Used in the glossary.
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrtagfont}[1]{\underline{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@preglossaryhook}
% This macro was introduced in \styfmt{glossaries} version 4.19, so it
% may not be defined. If it hasn't been defined this feature is
% unavailable. A check is added for the entry's existence to prevent
% errors from occurring if the user removes an entry or changes the
% label, which can interrupt the build process.
%\changes{1.04}{2016-05-02}{added check for entry's existence}
%    \begin{macrocode}
\ifdef\@gls@preglossaryhook
{
  \renewcommand*{\@gls@preglossaryhook}{%
    \@glsxtr@activate@initialtagging
%    \end{macrocode}
%\changes{1.12}{2017-02-03}{check for definition}
%Since the glossaries are automatically scoped,
%\cs{@glsxtr@org@postdescription} shouldn't already be defined, but
%check anyway just as a precautionary measure.
%    \begin{macrocode}
    \ifundef\@glsxtr@org@postdescription
    {%
      \let\@glsxtr@org@postdescription\glspostdescription
      \renewcommand*{\glspostdescription}{%
        \ifglsentryexists{\glscurrententrylabel}%
        {%
          \glsxtrpostdescription
          \@glsxtr@org@postdescription
        }%
        {}%
      }%
    }%
    {}%
%    \end{macrocode}
%\changes{1.07}{2016-08-15}{added \cs{glossxtrsetpopts}}
%Enable the options used by \cs{@@glsxtrp}:
%    \begin{macrocode}
    \glossxtrsetpopts
  }%
}
{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrpostdescription}
%This command will only be used if \cs{@gls@preglossaryhook} is
%available \emph{and} the glossary style uses
%\cs{glspostdescription} without modifying it. (\cs{nopostdesc}
%will suppress this.) The \sty{glossaries-extra-stylemods} package will
%add the post description hook to all the predefined styles that
%don't include it.
%    \begin{macrocode}
\newcommand*{\glsxtrpostdescription}{%
  \csuse{glsxtrpostdesc\glscategory{\glscurrententrylabel}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrpostdescgeneral}
%    \begin{macrocode}
\newcommand*{\glsxtrpostdescgeneral}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrpostdescterm}
%    \begin{macrocode}
\newcommand*{\glsxtrpostdescterm}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrpostdescacronym}
%    \begin{macrocode}
\newcommand*{\glsxtrpostdescacronym}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrpostdescabbreviation}
%    \begin{macrocode}
\newcommand*{\glsxtrpostdescabbreviation}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdefpostdesc}
%\changes{1.31}{2018-05-09}{new}
%Provide a convenient command for defining the post-description hook
%for the given category.
%    \begin{macrocode}
\newcommand*{\glsdefpostdesc}[2]{%
  \csdef{glsxtrpostdesc#1}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glspostlinkhook}
% Redefine the post link hook used by commands like \cs{gls} to
% make it easier for categories or attributes to modify this action.
% Since this hook occurs outside the existence check of commands like
% \cs{gls}, this needs to be checked again here. Do nothing if the
% entry hasn't been defined.
%\changes{0.5.4}{2015-12-15}{added existence check}
%    \begin{macrocode}
\renewcommand*{\glspostlinkhook}{%
 \ifglsentryexists{\glslabel}{\glsxtrpostlinkhook}{}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrpostlinkhook}
% The entry label should already be stored in \cs{glslabel} by
% \cs{@gls@link}.
%    \begin{macrocode}
\newcommand*{\glsxtrpostlinkhook}{%
 \glsxtrdiscardperiod{\glslabel}%
 {\glsxtrpostlinkendsentence}%
 {\glsxtrifcustomdiscardperiod
  {\glsxtrifperiod{\glsxtrpostlinkendsentence}{\glsxtrpostlink}}%
  {\glsxtrpostlink}%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrifcustomdiscardperiod}
%\changes{1.23}{2017-11-12}{new}
%Allow user to provide a custom check. Should expand to \verb|#2| if
%no check is required otherwise expand to \verb|#1|.
%    \begin{macrocode}
\newcommand*{\glsxtrifcustomdiscardperiod}[2]{#2}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrpostlink}
%    \begin{macrocode}
\newcommand*{\glsxtrpostlink}{%
 \csuse{glsxtrpostlink\glscategory{\glslabel}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdefpostlink}
%\changes{1.31}{2018-05-09}{new}
%Provide a convenient command for defining the post-link hook
%for the given category. Doesn't allow an empty argument (which)
%would overwrite \cs{glsxtrpostlink}.
%    \begin{macrocode}
\newcommand*{\glsdefpostlink}[2]{%
%    \end{macrocode}
% \cs{ifthenelse} is used to ensure that the expanded value is 
% tested. (The category label must be fully expandable.) 
%    \begin{macrocode}
  \ifthenelse{\equal{#1}{}}%
  {\PackageError{glossaries-extra}
    {Invalid empty category label in \string\glsdefpostlink}{}}%
  {\csdef{glsxtrpostlink#1}{#2}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrpostlinkendsentence}
%\changes{0.3}{2015-12-02}{new}
% Done by \cs{glsxtrpostlinkhook} if a full stop is discarded.
%    \begin{macrocode}
\newcommand*{\glsxtrpostlinkendsentence}{%
 \ifcsdef{glsxtrpostlink\glscategory{\glslabel}}
 {%
   \csuse{glsxtrpostlink\glscategory{\glslabel}}%
%    \end{macrocode}
% Put the full stop back.
%    \begin{macrocode}
   .\spacefactor\sfcode`\. \relax
 }%
 {%
%    \end{macrocode}
% Assume the full stop was discarded because the entry ends with a
% period, so adjust the spacefactor.
%    \begin{macrocode}
   \spacefactor\sfcode`\. \relax
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrpostlinkAddDescOnFirstUse}
%\changes{0.3}{2015-12-02}{new}
% Provide a command for appending the description in parentheses on
% first use, for the convenience of users wanting to add this to the
% post link hook.
%\changes{1.25}{2017-11-24}{changed to use \cs{glsxtrparen}}
%    \begin{macrocode}
\newcommand*{\glsxtrpostlinkAddDescOnFirstUse}{%
  \glsxtrifwasfirstuse{\space\glsxtrparen{\glsaccessdesc{\glslabel}}}{}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrpostlinkAddSymbolOnFirstUse}
%\changes{0.3}{2015-12-02}{new}
% Provide a command for appending the symbol (if defined) in parentheses on
% first use, for the convenience of users wanting to add this to the
% post link hook.
%\changes{1.25}{2017-11-24}{changed to use \cs{glsxtrparen}}
%    \begin{macrocode}
\newcommand*{\glsxtrpostlinkAddSymbolOnFirstUse}{%
  \glsxtrifwasfirstuse
  {%
    \ifglshassymbol{\glslabel}%
    {\space\glsxtrparen{\glsaccesssymbol{\glslabel}}}%
    {}%
  }%
  {}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrpostlinkAddSymbolDescOnFirstUse}
%\changes{1.31}{2018-05-09}{new}
% Provide a command for appending the symbol (if defined) and
% description in parentheses on
% first use, for the convenience of users wanting to add this to the
% post link hook.
%    \begin{macrocode}
\newcommand*{\glsxtrpostlinkAddSymbolDescOnFirstUse}{%
  \glsxtrifwasfirstuse
  {%
    \space\glsxtrparen
    {%
      \ifglshassymbol{\glslabel}%
      {\glsaccesssymbol{\glslabel}, }%
      {}%
      \glsaccessdesc{\glslabel}%
    }%
  }%
  {}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrdiscardperiod}
% Discard following period (if present) if the
% \catattr{discardperiod} attribute is true. If a period is
% discarded, do the second argument otherwise do the third
% argument. The entry label is in the first argument.
% Since this is designed for abbreviations that end with a period,
% check if the plural form was used (which typically won't end with
% a period).
%\changes{0.3}{2015-12-02}{added check for plural}
%\changes{1.01}{2016-02-02}{added check for first use}
%    \begin{macrocode}
\newcommand*{\glsxtrdiscardperiod}[3]{%
 \glsxtrifwasfirstuse
 {%
   \glsifattribute{#1}{retainfirstuseperiod}{true}%
   {#3}%
   {%
     \glsifattribute{#1}{discardperiod}{true}%
     {%
       \glsifplural
       {%
         \glsifattribute{#1}{pluraldiscardperiod}{true}%
         {\glsxtrifperiod{#2}{#3}}%
         {#3}%
       }%
       {%
         \glsxtrifperiod{#2}{#3}%
       }%
     }%
     {#3}%
   }%
 }%
 {%
   \glsifattribute{#1}{discardperiod}{true}%
   {%
     \glsifplural
     {%
       \glsifattribute{#1}{pluraldiscardperiod}{true}%
       {\glsxtrifperiod{#2}{#3}}%
       {#3}%
     }%
     {%
       \glsxtrifperiod{#2}{#3}%
     }%
   }%
   {#3}%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrifperiod}
% Make a convenient user command to check if the next character is a
% full stop (period). Works like \cs{@ifstar} but uses
% \cs{new@ifnextchar} rather than \cs{@ifnextchar}
%    \begin{macrocode}
\newcommand*{\glsxtrifperiod}[1]{\new@ifnextchar.{\@firstoftwo{#1}}}
%    \end{macrocode}
%\end{macro}
%
% Sometimes it's useful to test if there's a punctuation character
% following the glossary entry.
%\begin{macro}{\glsxtr@punclist}
% List of characters identified as punctuation marks. (Be careful of
% \sty{babel} shorthands!) This doesn't allow for punctuation marks
% made up from multiple characters (such as \verb|''|).
%    \begin{macrocode}
\newcommand*{\glsxtr@punclist}{.,:;?!}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtraddpunctuationmark}
% Add character to punctuation list.
%    \begin{macrocode}
\newcommand*{\glsxtraddpunctuationmark}[1]{\appto\glsxtr@punclist{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrsetpunctuationmarks}
% Reset the punctuation list.
%    \begin{macrocode}
\newcommand*{\glsxtrsetpunctuationmarks}[1]{\def\glsxtr@punclist{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrifpunc}
%\begin{definition}
%\cs{glsxtrifnextpunc}\marg{true part}\marg{false part}
%\end{definition}
%Test if this is followed by a punctuation mark. (Adapted from
%\cs{new@ifnextchar}.)
%    \begin{macrocode}
\newcommand*{\glsxtrifnextpunc}[2]{%
  \def\reserved@a{#1}% 
  \def\reserved@b{#2}%
  \futurelet\@glspunc@token\glsxtr@ifnextpunc
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@ifnextpunc}
%    \begin{macrocode}
\newcommand*{\glsxtr@ifnextpunc}{%
 \glsxtr@ifpunctoken{\@glspunc@token}{\let\reserved@b\reserved@a}{}%
 \reserved@b
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@ifpunctoken}
% Test if the token given in the first argument is in the
% punctuation list.
%    \begin{macrocode}
\newcommand*{\glsxtr@ifpunctoken}[1]{%
  \expandafter\@glsxtr@ifpunctoken\expandafter#1\glsxtr@punclist\@nnil
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@ifpunctoken}
%    \begin{macrocode}
\def\@glsxtr@ifpunctoken#1#2{%
  \let\reserved@d=#2%
  \ifx\reserved@d\@nnil
    \let\glsxtr@next\@glsxtr@notfoundinlist
  \else
    \ifx#1\reserved@d
     \let\glsxtr@next\@glsxtr@foundinlist
    \else
     \let\glsxtr@next\@glsxtr@ifpunctoken
    \fi
  \fi
  \glsxtr@next#1%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@foundinlist}
%    \begin{macrocode}
\def\@glsxtr@foundinlist#1\@nnil{\@firstoftwo}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@notfoundinlist}
%    \begin{macrocode}
\def\@glsxtr@notfoundinlist#1{\@secondoftwo}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrdopostpunc}
%\begin{definition}
%\cs{glsxtrdopostpunc}\marg{code}
%\end{definition}
% If this is followed be a punctuation character, do \meta{code}
% after the character otherwise do \meta{code} before whatever comes
% next.
%    \begin{macrocode}
\newcommand{\glsxtrdopostpunc}[1]{%
  \glsxtrifnextpunc{\@glsxtr@swaptwo{#1}}{#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@swaptwo}
%    \begin{macrocode}
\newcommand{\@glsxtr@swaptwo}[2]{#2#1}
%    \end{macrocode}
%\end{macro}
%
%\section{Abbreviations}
%
%The \qt{acronym} code from \styfmt{glossaries} is misnamed as it's more
%often used for other forms of abbreviations. This code corrects
%this inconsistency, but rather than just having synonyms, provide 
% commands for abbreviations that have a similar, but not identical,
% underlying mechanism to acronyms.
%
% If there's a style for the given category, apply it.
%    \begin{macrocode}
\define@key{glsxtrabbrv}{category}{%
 \edef\glscategorylabel{#1}%
 \ifcsdef{@glsabbrv@current@#1}%
 {%
%    \end{macrocode}
% Warning should already have been issued.
%    \begin{macrocode}
   \let\@glsxtr@orgwarndep\GlsXtrWarnDeprecatedAbbrStyle
   \let\GlsXtrWarnDeprecatedAbbrStyle\@gobbletwo
   \glsxtr@applyabbrvstyle{\csname @glsabbrv@current@#1\endcsname}%
   \let\GlsXtrWarnDeprecatedAbbrStyle\@glsxtr@orgwarndep
 }%
 {}%
}
%    \end{macrocode}
% Save the short plural form. This may be needed before the entry is
% defined.
%    \begin{macrocode}
\define@key{glsxtrabbrv}{shortplural}{%
  \def\@gls@shortpl{#1}%
}
%    \end{macrocode}
% Similarly for the long plural form.
%    \begin{macrocode}
\define@key{glsxtrabbrv}{longplural}{%
  \def\@gls@longpl{#1}%
}
%    \end{macrocode}
%
% Token registers for the short plural and long plural, provided for
% use in the abbreviation style definitions.
%\begin{macro}{\glsshortpltok}
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
\newtoks\glsshortpltok
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glslongpltok}
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
\newtoks\glslongpltok
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@insertdots}
%\changes{0.3}{2015-12-02}{new}
% Provided in case user wants to automatically insert dots between
% each letter of the abbreviation. This should be applied before
% defining the abbreviation to optimise the document build.
% (Otherwise, it would have to be done each time the short form is
% required, which is an unnecessary waste of time.) For this to work
% the short form must be expanded when passed to
% \cs{newabbreviation}. Note that explicitly using the
% \gloskey{short} or \gloskey{shortplural} keys will override this.
%    \begin{macrocode}
\newcommand*{\@glsxtr@insertdots}[2]{%
  \def#1{}%
  \@glsxtr@insert@dots#1#2\@nnil
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtr@insert@dots}
%    \begin{macrocode}
\newcommand*{\@glsxtr@insert@dots}[2]{%
  \ifx\@nnil#2\relax
   \let\@glsxtr@insert@dots@next\@gobble
  \else
   \ifx\relax#2\relax
   \else
     \appto#1{#2.}%
   \fi
   \let\@glsxtr@insert@dots@next\@glsxtr@insert@dots
  \fi
  \@glsxtr@insert@dots@next#1%
}
%    \end{macrocode}
%\end{macro}
%
%Similarly provide a way of replacing spaces with
%\cs{glsxtrwordsep}, which first needs to be defined:
%\begin{macro}{\glsxtrwordsep}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrwordsep}{\space}
%    \end{macrocode}
%\end{macro}
%Each word is marked with 
%\begin{macro}{\glsxtrword}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrword}[1]{#1}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glsxtr@markwordseps}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\@glsxtr@markwordseps}[2]{%
  \def#1{}%
  \@glsxtr@mark@wordseps#1#2 \@nnil
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glsxtr@mark@wordseps}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\def\@glsxtr@mark@wordseps#1#2 #3{%
  \ifdefempty{#1}%
  {\def#1{\protect\glsxtrword{#2}}}%
  {\appto#1{\protect\glsxtrwordsep\protect\glsxtrword{#2}}}%
  \ifx\@nnil#3\relax
   \let\@glsxtr@mark@wordseps@next\relax
  \else
   \def\@glsxtr@mark@wordseps@next{%
     \@glsxtr@mark@wordseps#1#3}%
  \fi
  \@glsxtr@mark@wordseps@next
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\newabbreviation}
% Define a new generic abbreviation.
%    \begin{macrocode}
\newcommand*{\newabbreviation}[4][]{%
  \glsxtr@newabbreviation{#1}{#2}{#3}{#4}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@newabbreviation}
% Internal macro. (bib2gls has an option that needs to
% temporarily redefine \cs{newabbreviation}. This is just makes
% it easier to save and restore the original definition.)
%\changes{1.12}{2017-02-03}{new}
%    \begin{macrocode}
\newcommand*{\glsxtr@newabbreviation}[4]{%
  \glskeylisttok{#1}%
  \glslabeltok{#2}%
  \glsshorttok{#3}%
  \glslongtok{#4}%
%    \end{macrocode}
%Save the original short and long values (before attribute settings
%modify them).
%\changes{1.17}{2017-08-09}{added \cs{glsxtrorgshort} and \cs{glsxtrorglong}}
%    \begin{macrocode}
  \def\glsxtrorgshort{#3}%
  \def\glsxtrorglong{#4}%
%    \end{macrocode}
%\changes{1.31}{2018-05-09}{added \cs{ExtraCustomAbbreviationFields}}
%Provide extra settings for hooks (if modified, this command must
%end with a comma).
%    \begin{macrocode}
  \def\ExtraCustomAbbreviationFields{}%
%    \end{macrocode}
%Initialise accessibility settings if required.
%    \begin{macrocode}
  \@gls@initaccesskeys
%    \end{macrocode}
% Get the category.
%\changes{0.3}{2015-12-02}{fixed family name in \cs{setkeys}}
%    \begin{macrocode}
  \def\glscategorylabel{abbreviation}%
  \glsxtr@applyabbrvstyle{\@glsabbrv@current@abbreviation}%
%    \end{macrocode}
% Ignore the shortplural and longplural keys.
%    \begin{macrocode}
  \setkeys*{glsxtrabbrv}[shortplural,longplural]{#1}%
%    \end{macrocode}
% Set the default long plural
%    \begin{macrocode}
  \def\@gls@longpl{#4\glspluralsuffix}%
  \let\@gls@default@longpl\@gls@longpl
%    \end{macrocode}
% Has the \catattr{markwords} attribute been set?
%    \begin{macrocode}
  \glsifcategoryattribute{\glscategorylabel}{markwords}{true}%
  {%
    \@glsxtr@markwordseps\@gls@long{#4}%
    \expandafter\def\expandafter\@gls@longpl\expandafter
     {\@gls@long\glspluralsuffix}%
    \let\@gls@default@longpl\@gls@longpl
%    \end{macrocode}
% Update \cs{glslongtok}.
%    \begin{macrocode}
    \expandafter\glslongtok\expandafter{\@gls@long}%
  }%
  {}%
%    \end{macrocode}
% Has the \catattr{markshortwords} attribute been set? (Not
% compatible with \catattr{insertdots}.)
%    \begin{macrocode}
  \glsifcategoryattribute{\glscategorylabel}{markshortwords}{true}%
  {%
    \@glsxtr@markwordseps\@gls@short{#3}%
  }%
  {%
%    \end{macrocode}
% Has the \catattr{insertdots} attribute been set?
%    \begin{macrocode}
    \glsifcategoryattribute{\glscategorylabel}{insertdots}{true}%
    {%
      \@glsxtr@insertdots\@gls@short{#3}%
      \expandafter\glsshorttok\expandafter{\@gls@short\spacefactor1000 \relax}%
    }%
    {\def\@gls@short{#3}}%
  }%
%    \end{macrocode}
% Has the \catattr{aposplural} attribute been set? (Not compatible
% with \catattr{noshortplural}.)
%    \begin{macrocode}
  \glsifcategoryattribute{\glscategorylabel}{aposplural}{true}%
  {%
    \expandafter\def\expandafter\@gls@shortpl\expandafter{\@gls@short
      '\abbrvpluralsuffix}%
  }%
  {%
%    \end{macrocode}
% Has the \catattr{noshortplural} attribute been set?
%    \begin{macrocode}
    \glsifcategoryattribute{\glscategorylabel}{noshortplural}{true}%
    {%
      \let\@gls@shortpl\@gls@short
    }%
      {%
      \expandafter\def\expandafter\@gls@shortpl\expandafter{\@gls@short
        \abbrvpluralsuffix}%
    }%
  }%
%    \end{macrocode}
% Update \cs{glsshorttok}:
%    \begin{macrocode}
  \expandafter\glsshorttok\expandafter{\@gls@short}%
%    \end{macrocode}
% Hook for further customisation if required:
%    \begin{macrocode}
  \glsxtrnewabbrevpresetkeyhook{#1}{#2}{#3}%
%    \end{macrocode}
% Get the short and long plurals provided by user in optional
% argument to override defaults, if necessary.
% Ignore the category key (already obtained).
%    \begin{macrocode}
  \setkeys*{glsxtrabbrv}[category]{#1}%
%    \end{macrocode}
% Has the plural been explicitly set?
%    \begin{macrocode}
  \ifx\@gls@default@longpl\@gls@longpl
  \else
%    \end{macrocode}
% Has the \catattr{markwords} attribute been set?
%    \begin{macrocode}
    \glsifcategoryattribute{\glscategorylabel}{markwords}{true}%
    {%
      \expandafter\@glsxtr@markwordseps\expandafter\@gls@longpl\expandafter
       {\@gls@longpl}%
    }%
    {}%
  \fi
%    \end{macrocode}
% Set the plural token registers so the values can be accessed by
% the abbreviation styles.
%    \begin{macrocode}
  \expandafter\glsshortpltok\expandafter{\@gls@shortpl}%
  \expandafter\glslongpltok\expandafter{\@gls@longpl}%
%    \end{macrocode}
% Hook for accessibility support (does nothing if
% \sty{glossaries-accsupp} hasn't been loaded).
%    \begin{macrocode}
  \@gls@setup@default@short@access{#3}%
%    \end{macrocode}
% Do any extra setup provided by hook:
%    \begin{macrocode}
  \newabbreviationhook
%    \end{macrocode}
% Define this entry:
%    \begin{macrocode}
  \protected@edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\glsxtrabbrvtype,%
      category=abbreviation,%
      short={\the\glsshorttok},%
      shortplural={\the\glsshortpltok},%
      long={\the\glslongtok},%
      longplural={\the\glslongpltok},%
      name={\the\glsshorttok},%
      \CustomAbbreviationFields,%
%    \end{macrocode}
% Hook may override abbreviation style default settings (this hook
% must end with a comma if set).
%    \begin{macrocode}
      \ExtraCustomAbbreviationFields
%    \end{macrocode}
% Any explicit fields set in the optional argument override all
% other settings.
%    \begin{macrocode}
      \the\glskeylisttok
    }%
  }%
  \@do@newglossaryentry
  \GlsXtrPostNewAbbreviation
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrnewabbrevpresetkeyhook}
% Hook for extra stuff in \cs{newabbreviation}
%\changes{0.5.2}{2015-12-08}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrnewabbrevpresetkeyhook}[3]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrPostNewAbbreviation}
% Hook used by abbreviation styles.
%    \begin{macrocode}
\newcommand*{\GlsXtrPostNewAbbreviation}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\newabbreviationhook}
% Hook for use with \cs{newabbreviation}.
%    \begin{macrocode}
\newcommand*{\newabbreviationhook}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\CustomAbbreviationFields}
%    \begin{macrocode}
\newcommand*{\CustomAbbreviationFields}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrparen}
%\changes{1.17}{2017-08-09}{new}
%For the parenthetical styles. 
%    \begin{macrocode}
\newcommand*{\glsxtrparen}[1]{(#1)}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrfullformat}
% Full format without case change.
%    \begin{macrocode}
\newcommand*{\glsxtrfullformat}[2]{%
  \glsfirstlongfont{\glsaccesslong{#1}}#2\glsxtrfullsep{#1}%
  \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshort{#1}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrfullformat}
% Full format with case change.
%    \begin{macrocode}
\newcommand*{\Glsxtrfullformat}[2]{%
  \glsfirstlongfont{\Glsaccesslong{#1}}#2\glsxtrfullsep{#1}%
  \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshort{#1}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrfullplformat}
% Plural full format without case change.
%    \begin{macrocode}
\newcommand*{\glsxtrfullplformat}[2]{%
  \glsfirstlongfont{\glsaccesslongpl{#1}}#2\glsxtrfullsep{#1}%
  \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshortpl{#1}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrfullplformat}
% Plural full format with case change.
%    \begin{macrocode}
\newcommand*{\Glsxtrfullplformat}[2]{%
  \glsfirstlongfont{\Glsaccesslongpl{#1}}#2\glsxtrfullsep{#1}%
  \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshortpl{#1}}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrfullsep}
% Separator used by full format is a space by default. The argument
% is the entry's label.
%    \begin{macrocode}
\newcommand*{\glsxtrfullsep}[1]{\space}
%    \end{macrocode}
%\end{macro}
%
% In-line formats in case first use isn't compatible with
% \cs{glsentryfull} (for example, first use suppresses the long form
% or uses a footnote).
%\begin{macro}{\glsxtrinlinefullformat}
% Full format without case change.
%    \begin{macrocode}
\newcommand*{\glsxtrinlinefullformat}{\glsxtrfullformat}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrinlinefullformat}
% Full format with case change.
%    \begin{macrocode}
\newcommand*{\Glsxtrinlinefullformat}{\Glsxtrfullformat}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrfullplformat}
% Plural full format without case change.
%    \begin{macrocode}
\newcommand*{\glsxtrinlinefullplformat}{\glsxtrfullplformat}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrinlinefullplformat}
% Plural full format with case change.
%    \begin{macrocode}
\newcommand*{\Glsxtrinlinefullplformat}{\Glsxtrfullplformat}
%    \end{macrocode}
%\end{macro}
%
% Redefine \cs{glsentryfull} etc to use the inline format.
% Since these commands as supposed to be expandable, they can only
% use the currently applied style. If there are mixed styles, you'll
% need to use the \cs{glsxtrfull} set of commands instead.
%\begin{macro}{\glsentryfull}
%    \begin{macrocode}
\renewcommand*{\glsentryfull}[1]{\glsxtrinlinefullformat{#1}{}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsentryfull}
%    \begin{macrocode}
\renewcommand*{\Glsentryfull}[1]{\Glsxtrinlinefullformat{#1}{}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryfullpl}
%    \begin{macrocode}
\renewcommand*{\glsentryfullpl}[1]{\glsxtrinlinefullplformat{#1}{}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsentryfullpl}
%    \begin{macrocode}
\renewcommand*{\Glsentryfullpl}[1]{\Glsxtrinlinefullplformat{#1}{}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsfirstabbrvfont}
% Font changing command used for the abbreviation on first use or in
% the full format.
%    \begin{macrocode}
\newcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsfirstabbrvdefaultfont}
% Font changing command used for the abbreviation on first use or in
% the full format.
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newcommand*{\glsfirstabbrvdefaultfont}[1]{\glsabbrvfont{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsabbrvfont}
% Font changing command used for the abbreviation on subsequent use.
%    \begin{macrocode}
\newcommand*{\glsabbrvfont}[1]{\glsabbrvdefaultfont{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsabbrvdefaultfont}
%\changes{0.3}{2015-12-02}{renamed from \cs{abbrvdefaultfont}}
%    \begin{macrocode}
\newcommand*{\glsabbrvdefaultfont}[1]{#1}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glslongfont}
%\changes{1.04}{2016-05-02}{new}
% Font changing command used for the long form in commands like
% \cs{glsxtrlong}.
%    \begin{macrocode}
\newcommand*{\glslongfont}[1]{\glslongdefaultfont{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glslongdefaultfont}
% Default font changing command used for the long form in commands like
%\changes{1.04}{2016-05-02}{new}
% \cs{glsxtrlong}.
%    \begin{macrocode}
\newcommand*{\glslongdefaultfont}[1]{#1}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsfirstlongfont}
% Font changing command used for the long form on first use or in
% the full format.
%    \begin{macrocode}
\newcommand*{\glsfirstlongfont}[1]{\glslongfont{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsfirstlongdefaultfont}
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newcommand*{\glsfirstlongdefaultfont}[1]{\glslongdefaultfont{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrabbrvpluralsuffix}
% Default plural suffix.
%\changes{1.12}{2017-02-03}{new}
%Allow an alternative default suffix for abbreviations.
%    \begin{macrocode}
\newcommand*{\glsxtrabbrvpluralsuffix}{\glspluralsuffix}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\abbrvpluralsuffix}
% Default plural suffix.
%    \begin{macrocode}
\newcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrfull}
% Full form (no case-change).
%    \begin{macrocode}
\newrobustcmd*{\glsxtrfull}{\@gls@hyp@opt\ns@glsxtrfull}
\newcommand*\ns@glsxtrfull[2][]{%
  \new@ifnextchar[{\@glsxtr@full{#1}{#2}}%
                  {\@glsxtr@full{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glsxtr@full}
% Low-level macro:
%    \begin{macrocode}
\def\@glsxtr@full#1#2[#3]{%
%    \end{macrocode}
%If the \pkgopt{record} option has been used, the information needs
%to be written to the aux file regardless of whether the entry
%exists (unless indexing has been switched off).
%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}}
%    \begin{macrocode}
  \@glsxtr@record{#1}{#2}{glslink}%
  \glsdoifexists{#2}%
  {%
    \glssetabbrvfmt{\glscategory{#2}}%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
    \def\glscustomtext{\glsxtrinlinefullformat{#2}{#3}}%
%    \end{macrocode}
% What should \cs{glsxtrifwasfirstuse} be set to here? Where the inline
% and display full forms are the same, this is essentially emulating
% first use, to it make sense for the postlink hook to pretend it 
% was a first use instance. It makes less sense if the inline and
% display forms are different. Provide a hook to make it easier to
% reconfigure.
%    \begin{macrocode}
    \glsxtrsetupfulldefs
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrsetupfulldefs}
%    \begin{macrocode}
\newcommand*{\glsxtrsetupfulldefs}{%
  \let\glsxtrifwasfirstuse\@firstoftwo
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrfull}
% Full form (first letter uppercase).
%    \begin{macrocode}
\newrobustcmd*{\Glsxtrfull}{\@gls@hyp@opt\ns@Glsxtrfull}
\newcommand*\ns@Glsxtrfull[2][]{%
  \new@ifnextchar[{\@Glsxtr@full{#1}{#2}}%
                  {\@Glsxtr@full{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@Glsxtr@full}
% Low-level macro:
%    \begin{macrocode}
\def\@Glsxtr@full#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \glssetabbrvfmt{\glscategory{#2}}%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@secondofthree
    \let\glsinsert\@empty
    \def\glscustomtext{\Glsxtrinlinefullformat{#2}{#3}}%
    \glsxtrsetupfulldefs
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSxtrfull}
% Full form (all uppercase).
%    \begin{macrocode}
\newrobustcmd*{\GLSxtrfull}{\@gls@hyp@opt\ns@GLSxtrfull}
\newcommand*\ns@GLSxtrfull[2][]{%
  \new@ifnextchar[{\@GLSxtr@full{#1}{#2}}%
                  {\@GLSxtr@full{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@GLSxtr@full}
% Low-level macro:
%    \begin{macrocode}
\def\@GLSxtr@full#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \glssetabbrvfmt{\glscategory{#2}}%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@thirdofthree
    \let\glsinsert\@empty
    \def\glscustomtext{\mfirstucMakeUppercase{\glsxtrinlinefullformat{#2}{#3}}}%
    \glsxtrsetupfulldefs
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrfullpl}
% Plural full form (no case-change).
%    \begin{macrocode}
\newrobustcmd*{\glsxtrfullpl}{\@gls@hyp@opt\ns@glsxtrfullpl}
\newcommand*\ns@glsxtrfullpl[2][]{%
  \new@ifnextchar[{\@glsxtr@fullpl{#1}{#2}}%
                  {\@glsxtr@fullpl{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glsxtr@fullpl}
% Low-level macro:
%    \begin{macrocode}
\def\@glsxtr@fullpl#1#2[#3]{%
%    \end{macrocode}
%If the \pkgopt{record} option has been used, the information needs
%to be written to the aux file regardless of whether the entry
%exists (unless indexing has been switched off).
%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}}
%    \begin{macrocode}
  \@glsxtr@record{#1}{#2}{glslink}%
  \glsdoifexists{#2}%
  {%
    \glssetabbrvfmt{\glscategory{#2}}%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
    \def\glscustomtext{\glsxtrinlinefullplformat{#2}{#3}}%
    \glsxtrsetupfulldefs
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrfullpl}
% Plural full form (first letter uppercase).
%    \begin{macrocode}
\newrobustcmd*{\Glsxtrfullpl}{\@gls@hyp@opt\ns@Glsxtrfullpl}
\newcommand*\ns@Glsxtrfullpl[2][]{%
  \new@ifnextchar[{\@Glsxtr@fullpl{#1}{#2}}%
                  {\@Glsxtr@fullpl{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@Glsxtr@fullpl}
% Low-level macro:
%    \begin{macrocode}
\def\@Glsxtr@fullpl#1#2[#3]{%
%    \end{macrocode}
%If the \pkgopt{record} option has been used, the information needs
%to be written to the aux file regardless of whether the entry
%exists (unless indexing has been switched off).
%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}}
%    \begin{macrocode}
  \@glsxtr@record{#1}{#2}{glslink}%
  \glsdoifexists{#2}%
  {%
    \glssetabbrvfmt{\glscategory{#2}}%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@secondofthree
    \let\glsinsert\@empty
    \def\glscustomtext{\Glsxtrinlinefullplformat{#2}{#3}}%
    \glsxtrsetupfulldefs
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSxtrfullpl}
% Plural full form (all upper case).
%    \begin{macrocode}
\newrobustcmd*{\GLSxtrfullpl}{\@gls@hyp@opt\ns@GLSxtrfullpl}
\newcommand*\ns@GLSxtrfullpl[2][]{%
  \new@ifnextchar[{\@GLSxtr@fullpl{#1}{#2}}%
                  {\@GLSxtr@fullpl{#1}{#2}[]}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@GLSxtr@fullpl}
% Low-level macro:
%    \begin{macrocode}
\def\@GLSxtr@fullpl#1#2[#3]{%
%    \end{macrocode}
%If the \pkgopt{record} option has been used, the information needs
%to be written to the aux file regardless of whether the entry
%exists (unless indexing has been switched off).
%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}}
%    \begin{macrocode}
  \@glsxtr@record{#1}{#2}{glslink}%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@thirdofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \mfirstucMakeUppercase{\glsxtrinlinefullplformat{#2}{#3}}}%
    \glsxtrsetupfulldefs
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
% The short and long forms work in a similar way to acronyms.
%\begin{macro}{\glsxtrshort}
%    \begin{macrocode}
\newrobustcmd*{\glsxtrshort}{\@gls@hyp@opt\ns@glsxtrshort}
%    \end{macrocode}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@glsxtrshort}[2][]{%
  \new@ifnextchar[{\@glsxtrshort{#1}{#2}}{\@glsxtrshort{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glsxtrshort#1#2[#3]{%
%    \end{macrocode}
%If the \pkgopt{record} option has been used, the information needs
%to be written to the aux file regardless of whether the entry
%exists (unless indexing has been switched off).
%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}}
%    \begin{macrocode}
  \@glsxtr@record{#1}{#2}{glslink}%
  \glsdoifexists{#2}%
  {%
%    \end{macrocode}
% Need to make sure \cs{glsabbrvfont} is set correctly.
%    \begin{macrocode}
    \glssetabbrvfmt{\glscategory{#2}}%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \glsabbrvfont{\glsaccessshort{#2}\ifglsxtrinsertinside#3\fi}%
      \ifglsxtrinsertinside\else#3\fi
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrshort}
%    \begin{macrocode}
\newrobustcmd*{\Glsxtrshort}{\@gls@hyp@opt\ns@Glsxtrshort}
%    \end{macrocode}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@Glsxtrshort}[2][]{%
  \new@ifnextchar[{\@Glsxtrshort{#1}{#2}}{\@Glsxtrshort{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glsxtrshort#1#2[#3]{%
%    \end{macrocode}
%If the \pkgopt{record} option has been used, the information needs
%to be written to the aux file regardless of whether the entry
%exists (unless indexing has been switched off).
%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}}
%    \begin{macrocode}
  \@glsxtr@record{#1}{#2}{glslink}%
  \glsdoifexists{#2}%
  {%
    \glssetabbrvfmt{\glscategory{#2}}%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@secondofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \glsabbrvfont{\Glsaccessshort{#2}\ifglsxtrinsertinside#3\fi}%
      \ifglsxtrinsertinside\else#3\fi
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSxtrshort}
%    \begin{macrocode}
\newrobustcmd*{\GLSxtrshort}{\@gls@hyp@opt\ns@GLSxtrshort}
%    \end{macrocode}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@GLSxtrshort}[2][]{%
  \new@ifnextchar[{\@GLSxtrshort{#1}{#2}}{\@GLSxtrshort{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLSxtrshort#1#2[#3]{%
%    \end{macrocode}
%If the \pkgopt{record} option has been used, the information needs
%to be written to the aux file regardless of whether the entry
%exists (unless indexing has been switched off).
%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}}
%    \begin{macrocode}
  \@glsxtr@record{#1}{#2}{glslink}%
  \glsdoifexists{#2}%
  {%
    \glssetabbrvfmt{\glscategory{#2}}%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@thirdofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \mfirstucMakeUppercase
      {\glsabbrvfont{\glsaccessshort{#2}\ifglsxtrinsertinside#3\fi}%
        \ifglsxtrinsertinside\else#3\fi
      }%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrlong}
%    \begin{macrocode}
\newrobustcmd*{\glsxtrlong}{\@gls@hyp@opt\ns@glsxtrlong}
%    \end{macrocode}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@glsxtrlong}[2][]{%
  \new@ifnextchar[{\@glsxtrlong{#1}{#2}}{\@glsxtrlong{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glsxtrlong#1#2[#3]{%
%    \end{macrocode}
%If the \pkgopt{record} option has been used, the information needs
%to be written to the aux file regardless of whether the entry
%exists (unless indexing has been switched off).
%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}}
%    \begin{macrocode}
  \@glsxtr@record{#1}{#2}{glslink}%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \glslongfont{\glsaccesslong{#2}\ifglsxtrinsertinside#3\fi}%
      \ifglsxtrinsertinside\else#3\fi
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrlong}
%    \begin{macrocode}
\newrobustcmd*{\Glsxtrlong}{\@gls@hyp@opt\ns@Glsxtrlong}
%    \end{macrocode}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@Glsxtrlong}[2][]{%
  \new@ifnextchar[{\@Glsxtrlong{#1}{#2}}{\@Glsxtrlong{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glsxtrlong#1#2[#3]{%
%    \end{macrocode}
%If the \pkgopt{record} option has been used, the information needs
%to be written to the aux file regardless of whether the entry
%exists (unless indexing has been switched off).
%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}}
%    \begin{macrocode}
  \@glsxtr@record{#1}{#2}{glslink}%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@secondofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \glslongfont{\Glsaccesslong{#2}\ifglsxtrinsertinside#3\fi}%
      \ifglsxtrinsertinside\else#3\fi
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSxtrlong}
%    \begin{macrocode}
\newrobustcmd*{\GLSxtrlong}{\@gls@hyp@opt\ns@GLSxtrlong}
%    \end{macrocode}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@GLSxtrlong}[2][]{%
  \new@ifnextchar[{\@GLSxtrlong{#1}{#2}}{\@GLSxtrlong{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLSxtrlong#1#2[#3]{%
%    \end{macrocode}
%If the \pkgopt{record} option has been used, the information needs
%to be written to the aux file regardless of whether the entry
%exists (unless indexing has been switched off).
%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}}
%    \begin{macrocode}
  \@glsxtr@record{#1}{#2}{glslink}%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@secondoftwo
    \let\glscapscase\@thirdofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
     \mfirstucMakeUppercase
     {\glslongfont{\glsaccesslong{#2}\ifglsxtrinsertinside#3\fi}%
      \ifglsxtrinsertinside\else#3\fi
     }%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
% Plural short forms:
%\begin{macro}{\glsxtrshortpl}
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
\newrobustcmd*{\glsxtrshortpl}{\@gls@hyp@opt\ns@glsxtrshortpl}
%    \end{macrocode}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@glsxtrshortpl}[2][]{%
  \new@ifnextchar[{\@glsxtrshortpl{#1}{#2}}{\@glsxtrshortpl{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glsxtrshortpl#1#2[#3]{%
%    \end{macrocode}
%If the \pkgopt{record} option has been used, the information needs
%to be written to the aux file regardless of whether the entry
%exists (unless indexing has been switched off).
%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}}
%    \begin{macrocode}
  \@glsxtr@record{#1}{#2}{glslink}%
  \glsdoifexists{#2}%
  {%
    \glssetabbrvfmt{\glscategory{#2}}%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \glsabbrvfont{\glsaccessshortpl{#2}\ifglsxtrinsertinside#3\fi}%
      \ifglsxtrinsertinside\else#3\fi
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrshortpl}
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
\newrobustcmd*{\Glsxtrshortpl}{\@gls@hyp@opt\ns@Glsxtrshortpl}
%    \end{macrocode}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@Glsxtrshortpl}[2][]{%
  \new@ifnextchar[{\@Glsxtrshortpl{#1}{#2}}{\@Glsxtrshortpl{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glsxtrshortpl#1#2[#3]{%
%    \end{macrocode}
%If the \pkgopt{record} option has been used, the information needs
%to be written to the aux file regardless of whether the entry
%exists (unless indexing has been switched off).
%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}}
%    \begin{macrocode}
  \@glsxtr@record{#1}{#2}{glslink}%
  \glsdoifexists{#2}%
  {%
    \glssetabbrvfmt{\glscategory{#2}}%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@secondofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \glsabbrvfont{\Glsaccessshortpl{#2}\ifglsxtrinsertinside#3\fi}%
      \ifglsxtrinsertinside\else#3\fi
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSxtrshortpl}
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
\newrobustcmd*{\GLSxtrshortpl}{\@gls@hyp@opt\ns@GLSxtrshortpl}
%    \end{macrocode}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@GLSxtrshortpl}[2][]{%
  \new@ifnextchar[{\@GLSxtrshortpl{#1}{#2}}{\@GLSxtrshortpl{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLSxtrshortpl#1#2[#3]{%
%    \end{macrocode}
%If the \pkgopt{record} option has been used, the information needs
%to be written to the aux file regardless of whether the entry
%exists (unless indexing has been switched off).
%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}}
%    \begin{macrocode}
  \@glsxtr@record{#1}{#2}{glslink}%
  \glsdoifexists{#2}%
  {%
    \glssetabbrvfmt{\glscategory{#2}}%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@thirdofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \mfirstucMakeUppercase
      {\glsabbrvfont{\glsaccessshortpl{#2}\ifglsxtrinsertinside#3\fi}%
       \ifglsxtrinsertinside\else#3\fi
      }%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
% Plural long forms:
%\begin{macro}{\glsxtrlongpl}
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
\newrobustcmd*{\glsxtrlongpl}{\@gls@hyp@opt\ns@glsxtrlongpl}
%    \end{macrocode}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@glsxtrlongpl}[2][]{%
  \new@ifnextchar[{\@glsxtrlongpl{#1}{#2}}{\@glsxtrlongpl{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glsxtrlongpl#1#2[#3]{%
%    \end{macrocode}
%If the \pkgopt{record} option has been used, the information needs
%to be written to the aux file regardless of whether the entry
%exists (unless indexing has been switched off).
%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}}
%    \begin{macrocode}
  \@glsxtr@record{#1}{#2}{glslink}%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@firstofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \glslongfont{\glsaccesslongpl{#2}\ifglsxtrinsertinside#3\fi}%
      \ifglsxtrinsertinside\else#3\fi
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrlongpl}
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
\newrobustcmd*{\Glsxtrlongpl}{\@gls@hyp@opt\ns@Glsxtrlongpl}
%    \end{macrocode}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@Glsxtrlongpl}[2][]{%
  \new@ifnextchar[{\@Glsxtrlongpl{#1}{#2}}{\@Glsxtrlongpl{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glsxtrlongpl#1#2[#3]{%
%    \end{macrocode}
%If the \pkgopt{record} option has been used, the information needs
%to be written to the aux file regardless of whether the entry
%exists (unless indexing has been switched off).
%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}}
%    \begin{macrocode}
  \@glsxtr@record{#1}{#2}{glslink}%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@secondofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \glslongfont{\Glsaccesslongpl{#2}\ifglsxtrinsertinside#3\fi}%
      \ifglsxtrinsertinside\else#3\fi
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GLSxtrlongpl}
%\changes{0.3}{2015-12-02}{new}
%    \begin{macrocode}
\newrobustcmd*{\GLSxtrlongpl}{\@gls@hyp@opt\ns@GLSxtrlongpl}
%    \end{macrocode}
% Define the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\ns@GLSxtrlongpl}[2][]{%
  \new@ifnextchar[{\@GLSxtrlongpl{#1}{#2}}{\@GLSxtrlongpl{#1}{#2}[]}%
}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLSxtrlongpl#1#2[#3]{%
%    \end{macrocode}
%If the \pkgopt{record} option has been used, the information needs
%to be written to the aux file regardless of whether the entry
%exists (unless indexing has been switched off).
%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}}
%    \begin{macrocode}
  \@glsxtr@record{#1}{#2}{glslink}%
  \glsdoifexists{#2}%
  {%
    \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper
    \let\glsxtrifwasfirstuse\@secondoftwo
    \let\glsifplural\@firstoftwo
    \let\glscapscase\@thirdofthree
    \let\glsinsert\@empty
    \def\glscustomtext{%
      \mfirstucMakeUppercase
      {\glslongfont{\glsaccesslongpl{#2}\ifglsxtrinsertinside#3\fi}%
       \ifglsxtrinsertinside\else#3\fi
      }%
    }%
    \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}%
  }%
  \glspostlinkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glssetabbrvfmt}
% Set the current format for the given category (or the
% \category{abbreviation} category if unset).
%    \begin{macrocode}
\newcommand*{\glssetabbrvfmt}[1]{%
  \ifcsdef{@glsabbrv@current@#1}%
  {\glsxtr@applyabbrvfmt{\csname @glsabbrv@current@#1\endcsname}}%
  {\glsxtr@applyabbrvfmt{\@glsabbrv@current@abbreviation}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsuseabbrvfont}
% Provide a way to use the abbreviation font for a given category
% for arbitrary text.
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newrobustcmd*{\glsuseabbrvfont}[2]{{\glssetabbrvfmt{#2}\glsabbrvfont{#1}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsuselongfont}
% Provide a way to use the long font for a given category
% for arbitrary text.
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newrobustcmd*{\glsuselongfont}[2]{{\glssetabbrvfmt{#2}\glslongfont{#1}}}
%    \end{macrocode}
%\end{macro}
%
%\changes{0.5.2}{2015-12-08}{removed \cs{glsxtrabbrvfmt}}
%\begin{macro}{\glsxtrgenabbrvfmt}
% Similar to \cs{glsgenacfmt}, but for abbreviations.
%\changes{1.17}{2017-08-09}{added check for \cs{ifglsxtrinsertinside}}
%    \begin{macrocode}
\newcommand*{\glsxtrgenabbrvfmt}{%
  \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}
          \glsxtrsubsequentplfmt{\glslabel}{\glsinsert}%
        }%
        {%
%    \end{macrocode}
% Subsequent plural form, make first letter upper case:
%    \begin{macrocode}
          \Glsxtrsubsequentplfmt{\glslabel}{\glsinsert}%
        }%
        {%
%    \end{macrocode}
% Subsequent plural form, all caps:
%    \begin{macrocode}
          \mfirstucMakeUppercase
            {\glsxtrsubsequentplfmt{\glslabel}{\glsinsert}}%
        }%
      }%
      {%
%    \end{macrocode}
% Subsequent singular form
%    \begin{macrocode}
        \glscapscase
        {%
%    \end{macrocode}
% Subsequent singular form, don't adjust case:
%    \begin{macrocode}
          \glsxtrsubsequentfmt{\glslabel}{\glsinsert}%
        }%
        {%
%    \end{macrocode}
% Subsequent singular form, make first letter upper case:
%    \begin{macrocode}
          \Glsxtrsubsequentfmt{\glslabel}{\glsinsert}%
        }%
        {%
%    \end{macrocode}
% Subsequent singular form, all caps:
%    \begin{macrocode}
          \mfirstucMakeUppercase
            {\glsxtrsubsequentfmt{\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}
          \glsxtrfullplformat{\glslabel}{\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use plural form, make first letter upper case:
%    \begin{macrocode}
          \Glsxtrfullplformat{\glslabel}{\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use plural form, all caps:
%    \begin{macrocode}
          \mfirstucMakeUppercase
            {\glsxtrfullplformat{\glslabel}{\glsinsert}}%
        }%
      }%
      {%
%    \end{macrocode}
% First use singular form
%    \begin{macrocode}
        \glscapscase
        {%
%    \end{macrocode}
% First use singular form, don't adjust case:
%    \begin{macrocode}
          \glsxtrfullformat{\glslabel}{\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use singular form, make first letter upper case:
%    \begin{macrocode}
          \Glsxtrfullformat{\glslabel}{\glsinsert}%
        }%
        {%
%    \end{macrocode}
% First use singular form, all caps:
%    \begin{macrocode}
          \mfirstucMakeUppercase
           {\glsxtrfullformat{\glslabel}{\glsinsert}}%
        }%
      }%
    }%
  }%
  {%
%    \end{macrocode}
% User supplied text.
%    \begin{macrocode}
    \glscustomtext
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrsubsequentfmt}
% Subsequent use format (singular no case change).
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrsubsequentfmt}[2]{%
  \glsabbrvfont{\glsaccessshort{#1}\ifglsxtrinsertinside #2\fi}%
  \ifglsxtrinsertinside \else#2\fi
}
\let\glsxtrdefaultsubsequentfmt\glsxtrsubsequentfmt
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrsubsequentplfmt}
% Subsequent use format (plural no case change).
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrsubsequentplfmt}[2]{%
  \glsabbrvfont{\glsaccessshortpl{#1}\ifglsxtrinsertinside #2\fi}%
  \ifglsxtrinsertinside \else#2\fi
}
\let\glsxtrdefaultsubsequentplfmt\glsxtrsubsequentplfmt
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrsubsequentfmt}
% Subsequent use format (singular, first letter uppercase).
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\Glsxtrsubsequentfmt}[2]{%
  \glsabbrvfont{\Glsaccessshort{#1}\ifglsxtrinsertinside #2\fi}%
  \ifglsxtrinsertinside \else#2\fi
}
\let\Glsxtrdefaultsubsequentfmt\Glsxtrsubsequentfmt
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrsubsequentplfmt}
% Subsequent use format (plural, first letter uppercase).
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\Glsxtrsubsequentplfmt}[2]{%
  \glsabbrvfont{\Glsaccessshortpl{#1}\ifglsxtrinsertinside #2\fi}%
  \ifglsxtrinsertinside \else#2\fi
}
\let\Glsxtrdefaultsubsequentplfmt\Glsxtrsubsequentplfmt
%    \end{macrocode}
%\end{macro}
%
%\subsection{Abbreviation Styles Setup}
%
%\begin{macro}{\setabbreviationstyle}
%    \begin{macrocode}
\newcommand*{\setabbreviationstyle}[2][abbreviation]{%
  \ifcsundef{@glsabbrv@dispstyle@setup@#2}
  {%
    \PackageError{glossaries-extra}{Undefined abbreviation style `#2'}{}%
  }%
  {%
%    \end{macrocode}
% Have abbreviations already been defined for this category?
%\changes{0.5.2}{2015-12-08}{added check for post-definition style switch}
%    \begin{macrocode}
     \ifcsstring{@glsabbrv@current@#1}{#2}%
     {%
%    \end{macrocode}
% Style already set.
%    \begin{macrocode}
     }%
     {%
       \def\@glsxtr@dostylewarn{}%
       \glsforeachincategory{#1}{\@gls@type}{\@gls@label}%
       {%
         \def\@glsxtr@dostylewarn{\GlossariesWarning{Abbreviation
           style has been switched \MessageBreak
           for category `#1', \MessageBreak
           but there have already been entries \MessageBreak
           defined for this category. Unwanted \MessageBreak
           side-effects may result}}%
         \@endfortrue
       }%
       \@glsxtr@dostylewarn
%    \end{macrocode}
% Set up the style for the given category.
%    \begin{macrocode}
       \csdef{@glsabbrv@current@#1}{#2}%
       \glsxtr@applyabbrvstyle{#2}%
     }%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@applyabbrvstyle}
% Apply the abbreviation style without existence check.
%    \begin{macrocode}
\newcommand*{\glsxtr@applyabbrvstyle}[1]{%
  \csuse{@glsabbrv@dispstyle@setup@#1}%
  \csuse{@glsabbrv@dispstyle@fmts@#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@applyabbrvfmt}
% Only apply the style formats.
%    \begin{macrocode}
\newcommand*{\glsxtr@applyabbrvfmt}[1]{%
  \csuse{@glsabbrv@dispstyle@fmts@#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\newabbreviationstyle}
% This is different from \cs{newacronymstyle}. The first argument is
% the label, the second argument sets the information required when
% defining the new abbreviation and the third argument sets the
% commands used to display the full format.
%\changes{1.04}{2016-05-02}{bug fix: corrected test for existence}
%    \begin{macrocode}
\newcommand*{\newabbreviationstyle}[3]{%
  \ifcsdef{@glsabbrv@dispstyle@setup@#1}
  {%
    \PackageError{glossaries-extra}{Abbreviation style `#1' already
     defined}{}%
  }%
  {%
    \csdef{@glsabbrv@dispstyle@setup@#1}{%
%    \end{macrocode}
% Initialise hook to do nothing. The style may change this.
%    \begin{macrocode}
     \renewcommand*{\GlsXtrPostNewAbbreviation}{}%
     #2}%
    \csdef{@glsabbrv@dispstyle@fmts@#1}{%
%    \end{macrocode}
% Assume in-line form is the same as first use. The style may change
% this.
%    \begin{macrocode}
    \renewcommand*{\glsxtrinlinefullformat}{\glsxtrfullformat}%
    \renewcommand*{\Glsxtrinlinefullformat}{\Glsxtrfullformat}%
    \renewcommand*{\glsxtrinlinefullplformat}{\glsxtrfullplformat}%
    \renewcommand*{\Glsxtrinlinefullplformat}{\Glsxtrfullplformat}%
%    \end{macrocode}
% Reset \cs{glsxtrsubsequentfmt} etc in case a style changes this.
%    \begin{macrocode}
    \let\glsxtrsubsequentfmt\glsxtrdefaultsubsequentfmt
    \let\glsxtrsubsequentplfmt\glsxtrdefaultsubsequentplfmt
    \let\Glsxtrsubsequentfmt\Glsxtrdefaultsubsequentfmt
    \let\Glsxtrsubsequentplfmt\Glsxtrdefaultsubsequentplfmt
    #3}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\renewabbreviationstyle}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newcommand*{\renewabbreviationstyle}[3]{%
  \ifcsundef{@glsabbrv@dispstyle@setup@#1}
  {%
    \PackageError{glossaries-extra}{Abbreviation style `#1' not defined}{}%
  }%
  {%
    \csdef{@glsabbrv@dispstyle@setup@#1}{%
%    \end{macrocode}
% Initialise hook to do nothing. The style may change this.
%    \begin{macrocode}
     \renewcommand*{\GlsXtrPostNewAbbreviation}{}%
     #2}%
    \csdef{@glsabbrv@dispstyle@fmts@#1}{%
%    \end{macrocode}
% Assume in-line form is the same as first use. The style may change
% this.
%    \begin{macrocode}
    \renewcommand*{\glsxtrinlinefullformat}{\glsxtrfullformat}%
    \renewcommand*{\Glsxtrinlinefullformat}{\Glsxtrfullformat}%
    \renewcommand*{\glsxtrinlinefullplformat}{\glsxtrfullplformat}%
    \renewcommand*{\Glsxtrinlinefullplformat}{\Glsxtrfullplformat}%
    #3}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\letabbreviationstyle}
%\changes{1.04}{2016-05-02}{new}
% Define a synonym for an abbreviation style. The first argument is
% the new name. The second argument is the original style's name.
%    \begin{macrocode}
\newcommand*{\letabbreviationstyle}[2]{%
  \csletcs{@glsabbrv@dispstyle@setup@#1}{@glsabbrv@dispstyle@setup@#2}%
  \csletcs{@glsabbrv@dispstyle@fmts@#1}{@glsabbrv@dispstyle@fmts@#2}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glsxtr@deprecated@abbrstyle}
%\changes{1.04}{2016-05-02}{new}
%\begin{definition}
%\cs{@glsxtr@deprecated@abbrstyle}\marg{old-name}\marg{new-name}
%\end{definition}
% Define a synonym for a deprecated abbreviation style.
%    \begin{macrocode}
\newcommand*{\@glsxtr@deprecated@abbrstyle}[2]{%
  \csdef{@glsabbrv@dispstyle@setup@#1}{%
    \GlsXtrWarnDeprecatedAbbrStyle{#1}{#2}%
    \csuse{@glsabbrv@dispstyle@setup@#2}%
  }%
  \csletcs{@glsabbrv@dispstyle@fmts@#1}{@glsabbrv@dispstyle@fmts@#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrWarnDeprecatedAbbrStyle}
%Generate warning for deprecated style use.
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newcommand*{\GlsXtrWarnDeprecatedAbbrStyle}[2]{%
  \GlossariesExtraWarning{Deprecated abbreviation style name `#1',
  use `#2' instead}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrUseAbbrStyleSetup}
%    \begin{macrocode}
\newcommand*{\GlsXtrUseAbbrStyleSetup}[1]{%
  \ifcsundef{@glsabbrv@dispstyle@setup@#1}%
  {%
     \PackageError{glossaries-extra}%
     {Unknown abbreviation style definitions `#1'}{}%
  }%
  {%
     \csname @glsabbrv@dispstyle@setup@#1\endcsname
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrUseAbbrStyleFmts}
%    \begin{macrocode}
\newcommand*{\GlsXtrUseAbbrStyleFmts}[1]{%
  \ifcsundef{@glsabbrv@dispstyle@fmts@#1}%
  {%
     \PackageError{glossaries-extra}%
     {Unknown abbreviation style formats `#1'}{}%
  }%
  {%
     \csname @glsabbrv@dispstyle@fmts@#1\endcsname
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\subsection{Predefined Styles (Default Font)}
% Define some common styles. These will set the \gloskey{first},
% \gloskey{firstplural}, \gloskey{text} and \gloskey{plural}
% keys, even if the \catattr{regular} attribute isn't set to
% \qt{true}. If this attribute is set, commands like \cs{gls} will
% use them as per a regular entry, otherwise those keys will be
% ignored unless explicitly invoked by the user with commands like
% \cs{glsfirst}. In order for the first letter uppercase versions to
% work correctly, \cs{glsxtrfullformat} needs to be expanded when
% those keys are set. The final optional argument of \cs{glsfirst}
% will behave differently to the final optional argument of \cs{gls}
% with some styles.
%
%\begin{macro}{\ifglsxtrinsertinside}
%\changes{1.02}{2016-04-25}{new}
% Switch to determine if the insert text should be inside or outside
% the font changing command. The default is outside.
%    \begin{macrocode}
\newif\ifglsxtrinsertinside
\glsxtrinsertinsidefalse
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrlongshortname}
%\changes{1.25}{2017-11-24}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrlongshortname}{%
  \protect\glsabbrvfont{\the\glsshorttok}%
}
%    \end{macrocode}
%\end{macro}
%
%\changes{1.17}{2017-08-09}{removed some inconsistencies in the abbreviation
%styles}
%\begin{abbrvstyle}{long-short}
%    \begin{macrocode}
\newabbreviationstyle{long-short}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongshortname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstlongfont{\the\glslongtok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvfont{\the\glsshorttok}}},%
    firstplural={\protect\glsfirstlongfont{\the\glslongpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvfont{\the\glsshortpltok}}},%
%    \end{macrocode}
%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}}
%    \begin{macrocode}
    plural={\protect\glsabbrvfont{\the\glsshortpltok}},%
    description={\the\glslongtok}}%
%    \end{macrocode}
%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
%    \end{macrocode}
% In case the user wants to mix and match font styles, these are
% redefined here.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}%
  \renewcommand*{\glsabbrvfont}[1]{\glsabbrvdefaultfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The first use full form and the inline full form are the same for
% this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstlongfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstlongfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstlongfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstlongfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvfont{\glsaccessshortpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
% Set this as the default style for general abbreviations:
%    \begin{macrocode}
\setabbreviationstyle{long-short}
%    \end{macrocode}
%
%\begin{macro}{\glsxtrlongshortdescsort}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrlongshortdescsort}{%
 \expandonce\glsxtrorglong\space (\expandonce\glsxtrorgshort)%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrlongshortdescname}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrlongshortdescname}{%
  \protect\glslongfont{\the\glslongtok} 
  \glsxtrparen{\protect\glsabbrvfont{\the\glsshorttok}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{long-short-desc}
% User supplies description. The long form is included in the name.
%\changes{0.3}{2015-12-02}{fixed name to use \cs{glslabeltok}}
%    \begin{macrocode}
\newabbreviationstyle{long-short-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongshortdescname},
    sort={\glsxtrlongshortdescsort},%
    first={\protect\glsfirstlongfont{\the\glslongtok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvfont{\the\glsshorttok}}},%
    firstplural={\protect\glsfirstlongfont{\the\glslongpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvfont{\the\glsshortpltok}}},%
%    \end{macrocode}
%The \gloskey{text} key should only have the short form.
%\changes{1.07}{2016-08-15}{added missing text key}
%    \begin{macrocode}
    text={\protect\glsabbrvfont{\the\glsshorttok}},%
%    \end{macrocode}
%\changes{1.07}{2016-08-15}{fixed misspelling of \cs{glsabbrvfont}}
%    \begin{macrocode}
    plural={\protect\glsabbrvfont{\the\glsshortpltok}}%
  }%
%    \end{macrocode}
%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{long-short}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{macro}{\glsxtrshortlongname}
%\changes{1.25}{2017-11-24}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrshortlongname}{%
  \protect\glsabbrvfont{\the\glsshorttok}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{short-long}
% Short form followed by long form in parenthesis on first use.
%    \begin{macrocode}
\newabbreviationstyle{short-long}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortlongname},
    sort={\the\glsshorttok},
    description={\the\glslongtok},%
    first={\protect\glsfirstabbrvfont{\the\glsshorttok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlongfont{\the\glslongtok}}},%
    firstplural={\protect\glsfirstabbrvfont{\the\glsshortpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlongfont{\the\glslongpltok}}},%
%    \end{macrocode}
%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}}
%    \begin{macrocode}
    plural={\protect\glsabbrvfont{\the\glsshortpltok}}}%
%    \end{macrocode}
%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
%    \end{macrocode}
% In case the user wants to mix and match font styles, these are
% redefined here.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvdefaultfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The first use full form and the inline full form are the same for
% this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfont{\glsaccesslongpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{macro}{\glsxtrshortlongdescsort}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrshortlongdescsort}{\the\glsshorttok}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrshortlongdescname}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrshortlongdescname}{%
  \protect\glsabbrvfont{\the\glsshorttok} 
  \glsxtrparen{\protect\glslongfont{\the\glslongtok}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{short-long-desc}
% User supplies description. The long form is included in the name.
%\changes{0.3}{2015-12-02}{fixed name to use \cs{glslabeltok}}
%    \begin{macrocode}
\newabbreviationstyle{short-long-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortlongdescname},
    sort={\glsxtrshortlongdescsort},
    first={\protect\glsfirstabbrvfont{\the\glsshorttok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlongfont{\the\glslongtok}}},%
    firstplural={\protect\glsfirstabbrvfont{\the\glsshortpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlongfont{\the\glslongpltok}}},%
%    \end{macrocode}
%\changes{1.07}{2016-08-15}{added text key}
%    \begin{macrocode}
    text={\protect\glsabbrvfont{\the\glsshorttok}},%
%    \end{macrocode}
%\changes{1.07}{2016-08-15}{fixed misspelling of \cs{glsabbrvfont} in plural
%key}
%    \begin{macrocode}
    plural={\protect\glsabbrvfont{\the\glsshortpltok}}%
  }%
%    \end{macrocode}
%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{short-long}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{macro}{\glsfirstlongfootnotefont}
%\changes{1.05}{2016-06-10}{new}
%Only used by the \qt{footnote} styles.
%    \begin{macrocode}
\newcommand*{\glsfirstlongfootnotefont}[1]{\glslongfootnotefont{#1}}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glslongfootnotefont}
%\changes{1.05}{2016-06-10}{new}
%Only used by the \qt{footnote} styles.
%    \begin{macrocode}
\newcommand*{\glslongfootnotefont}[1]{\glslongdefaultfont{#1}}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrabbrvfootnote}
%\begin{definition}
%\cs{glsxtrabbrvfootnote}\marg{label}\marg{long}
%\end{definition}
%\changes{1.07}{2016-08-15}{new}
%Command used by footnote abbreviation styles. The default
%definition ignores the first argument. The second argument
%\meta{long} includes the font changing command and may be the
%singular or plural form, depending on the command that was used
%(for example, \cs{gls} or \cs{glspl}).
%    \begin{macrocode}
\newcommand*{\glsxtrabbrvfootnote}[2]{\footnote{#2}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrfootnotename}
%\changes{1.25}{2017-11-24}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrfootnotename}{%
  \protect\glsabbrvfont{\the\glsshorttok}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{footnote}
% Short form followed by long form in footnote on first use.
%    \begin{macrocode}
\newabbreviationstyle{footnote}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrfootnotename},
    sort={\the\glsshorttok},
    description={\the\glslongtok},%
%    \end{macrocode}
%\changes{1.07}{2016-08-15}{changed first forms to use
%\cs{glsfirstlongfootnotefont}}
%    \begin{macrocode}
    first={\protect\glsfirstabbrvfont{\the\glsshorttok}%
     \protect\glsxtrabbrvfootnote{\the\glslabeltok}%
       {\protect\glsfirstlongfootnotefont{\the\glslongtok}}},%
    firstplural={\protect\glsfirstabbrvfont{\the\glsshortpltok}%
     \protect\glsxtrabbrvfootnote{\the\glslabeltok}%
       {\protect\glsfirstlongfootnotefont{\the\glslongpltok}}},%
%    \end{macrocode}
%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}}
%    \begin{macrocode}
    plural={\protect\glsabbrvfont{\the\glsshortpltok}}}%
%    \end{macrocode}
% Switch off hyperlinks on first use to prevent nested hyperlinks,
% and unset the \catattr{regular} attribute if it has been set.
%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set}
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glssetattribute{\the\glslabeltok}{nohyperfirst}{true}%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
%    \end{macrocode}
% In case the user wants to mix and match font styles, these are
% redefined here.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvdefaultfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongfootnotefont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongfootnotefont{##1}}%
%    \end{macrocode}
% The full format displays the short form followed by the long form
% as a footnote.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \protect\glsxtrabbrvfootnote{##1}%
      {\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \protect\glsxtrabbrvfootnote{##1}%
      {\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \protect\glsxtrabbrvfootnote{##1}%
      {\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \protect\glsxtrabbrvfootnote{##1}%
      {\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form and the inline full form use the short
% (long) style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%\begin{abbrvstyle}{short-footnote}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\letabbreviationstyle{short-footnote}{footnote}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{postfootnote}
% Similar to the above but the footnote is placed afterwards,
% outside the link. This avoids nested links and can also move the
% footnote marker after any following punctuation mark.
% Pre v1.07 included \cs{footnote} in the first keys, which was
% incorrect as it caused duplicate footnotes.
%\changes{1.07}{2016-08-15}{removed \cs{footnote} from first keys}
%    \begin{macrocode}
\newabbreviationstyle{postfootnote}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrfootnotename},
    sort={\the\glsshorttok},
    description={\the\glslongtok},%
    first={\protect\glsfirstabbrvfont{\the\glsshorttok}},%
    firstplural={\protect\glsfirstabbrvfont{\the\glsshortpltok}},%
%    \end{macrocode}
%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}}
%    \begin{macrocode}
    plural={\protect\glsabbrvfont{\the\glsshortpltok}}}%
%    \end{macrocode}
% Make this category insert a footnote after the link if this was
% the first use, and
% unset the \catattr{regular} attribute if it has been set.
%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set}
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \csdef{glsxtrpostlink\glscategorylabel}{%
      \glsxtrifwasfirstuse
      {%
%    \end{macrocode}
% Needs the specific font command here as the style may have been
% lost by the time the footnote occurs.
%    \begin{macrocode}
        \glsxtrdopostpunc{\protect\glsxtrabbrvfootnote{\glslabel}%
        {\glsfirstlongfootnotefont{\glsentrylong{\glslabel}}}}%
      }%
      {}%
    }%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
%    \end{macrocode}
%\changes{1.02}{2016-04-25}{added redef of \cs{glsxtrsetupfulldefs}}
% The footnote needs to be suppressed in the inline form, so
% \cs{glsxtrfull} must set the first use switch off.
%    \begin{macrocode}
  \renewcommand*{\glsxtrsetupfulldefs}{%
    \let\glsxtrifwasfirstuse\@secondoftwo
  }%
}%
{%
%    \end{macrocode}
% In case the user wants to mix and match font styles, these are
% redefined here.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvdefaultfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongfootnotefont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongfootnotefont{##1}}%
%    \end{macrocode}
% The full format displays the short form. The long form is
% deferred.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
%    \end{macrocode}
% The first use full form and the inline full form use the short
% (long) style.
%\changes{1.07}{2016-08-15}{switched from \cs{glsfirstlongfont} to
%\cs{glsfirstlongfootnotefont}}
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-postfootnote}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\letabbreviationstyle{short-postfootnote}{postfootnote}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{macro}{\glsxtrshortnolongname}
%\changes{1.25}{2017-11-24}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrshortnolongname}{%
  \protect\glsabbrvfont{\the\glsshorttok}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{short}
% Provide a style that only displays the short form on first use,
% but the short and long form can be displayed with the \qt{full}
% commands that use the inline format. If the user supplies a
% description, the long form won't be displayed in the predefined
% glossary styles, but the post description hook can be employed to
% automatically insert it.
%    \begin{macrocode}
\newabbreviationstyle{short}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortnolongname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstabbrvfont{\the\glsshorttok}},
    firstplural={\protect\glsfirstabbrvfont{\the\glsshortpltok}},
    text={\protect\glsabbrvfont{\the\glsshorttok}},
    plural={\protect\glsabbrvfont{\the\glsshortpltok}},
    description={\the\glslongtok}}%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glssetattribute{\the\glslabeltok}{regular}{true}}%
}%
{%
%    \end{macrocode}
% In case the user wants to mix and match font styles, these are
% redefined here.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvdefaultfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The inline full form displays the short form followed by the
% long form in parentheses.
%\changes{0.2}{2015-11-30}{switched inline full form to short (long)}
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \protect\glsfirstabbrvfont{\glsaccessshort{##1}%
      \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \protect\glsfirstabbrvfont{\glsaccessshortpl{##1}%
     \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \protect\glsfirstabbrvfont{\glsaccessshort{##1}%
      \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfont{\Glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \protect\glsfirstabbrvfont{\glsaccessshortpl{##1}%
       \ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfont{\Glsaccesslongpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form only displays the short form, but it
% typically won't be used as the \catattr{regular} attribute is set by this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
% Set this as the default style for acronyms:
%    \begin{macrocode}
\setabbreviationstyle[acronym]{short}
%    \end{macrocode}
%
%\begin{abbrvstyle}{short-nolong}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\letabbreviationstyle{short-nolong}{short}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-nolong-noreg}
%\changes{1.17}{2017-08-09}{new}
% Like \abbrstyle{short-nolong} but doesn't set the \catattr{regular} attribute.
%    \begin{macrocode}
\newabbreviationstyle{short-nolong-noreg}%
{%
  \GlsXtrUseAbbrStyleSetup{short-nolong}%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{short-nolong}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%
%\begin{macro}{\glsxtrshortdescname}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrshortdescname}{%
  \protect\glsabbrvfont{\the\glsshorttok}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{short-desc}
% The user must supply the description in this style. The long form
% is added to the name. The \abbrstyle{short} style (possibly with the
% post-description hooks set) might be a better option.
%\changes{1.01}{2016-02-02}{fixed typo in
%\cs{glsxtrinlinefullformat} and added missing second argument}
%    \begin{macrocode}
\newabbreviationstyle{short-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortdescname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstabbrvfont{\the\glsshorttok}},
    firstplural={\protect\glsfirstabbrvfont{\the\glsshortpltok}},
    text={\protect\glsabbrvfont{\the\glsshorttok}},
    plural={\protect\glsabbrvfont{\the\glsshortpltok}},
    description={\the\glslongtok}}%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glssetattribute{\the\glslabeltok}{regular}{true}}%
}%
{%
%    \end{macrocode}
% In case the user wants to mix and match font styles, these are
% redefined here.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvdefaultfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The inline full form displays the short format followed by the
% long form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfont{\glsaccesslongpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form only displays the short form, but it
% typically won't be used as the \catattr{regular} attribute is set by this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%\begin{abbrvstyle}{short-nolong-desc}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\letabbreviationstyle{short-nolong-desc}{short-desc}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-nolong-desc-noreg}
%\changes{1.17}{2017-08-09}{new}
% Like \abbrstyle{short-nolong-desc} but doesn't set the \catattr{regular} attribute.
%    \begin{macrocode}
\newabbreviationstyle{short-nolong-desc-noreg}%
{%
  \GlsXtrUseAbbrStyleSetup{short-nolong-desc}%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{short-nolong-desc}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{nolong-short}
% Similar to \abbrstyle{short-nolong} but the full form shows the
% long form followed by the short form in parentheses.
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newabbreviationstyle{nolong-short}%
{%
  \GlsXtrUseAbbrStyleSetup{short-nolong}%
}%
{%
  \GlsXtrUseAbbrStyleFmts{short-nolong}%
%    \end{macrocode}
% The inline full form displays the long form followed by the
% short form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \protect\glsfirstlongfont{\glsaccesslong{##1}%
      \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \protect\glsfirstlongfont{\glsaccesslongpl{##1}%
     \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \protect\glsfirstlongfont{\glsaccesslong{##1}%
      \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvfont{\Glsaccessshort{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \protect\glsfirstlongfont{\glsaccesslongpl{##1}%
       \ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvfont{\Glsaccessshortpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{nolong-short-noreg}
%\changes{1.21}{2017-11-03}{new}
% Like \abbrstyle{nolong-short} but doesn't set the \catattr{regular} attribute.
%    \begin{macrocode}
\newabbreviationstyle{nolong-short-noreg}%
{%
  \GlsXtrUseAbbrStyleSetup{nolong-short}%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{nolong-short}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{macro}{\glsxtrlongnoshortdescname}
%\changes{1.25}{2017-11-24}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrlongnoshortdescname}{%
  \protect\glslongfont{\the\glslongtok}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{long-desc}
% Provide a style that only displays the long form,
% but the long and short form can be displayed with the \qt{full}
% commands that use the inline format. The predefined glossary styles
% won't show the short form. The user must supply a description for
% this style.
%    \begin{macrocode}
\newabbreviationstyle{long-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongnoshortdescname},
    sort={\the\glslongtok},
    first={\protect\glsfirstlongfont{\the\glslongtok}},
    firstplural={\protect\glsfirstlongfont{\the\glslongpltok}},
    text={\glslongfont{\the\glslongtok}},
    plural={\glslongfont{\the\glslongpltok}}%
  }%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glssetattribute{\the\glslabeltok}{regular}{true}}%
}%
{%
%    \end{macrocode}
% In case the user wants to mix and match font styles, these are
% redefined here.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvdefaultfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The format for subsequent use (not used when the regular attribute
% is set).
%    \begin{macrocode}
  \renewcommand*{\glsxtrsubsequentfmt}[2]{%
    \glslongfont{\glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\glsxtrsubsequentplfmt}[2]{%
    \glslongfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\Glsxtrsubsequentfmt}[2]{%
    \glslongfont{\Glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\Glsxtrsubsequentplfmt}[2]{%
    \glslongfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
%    \end{macrocode}
% The inline full form displays the long format followed by the
% short form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstlongfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstlongfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstlongfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstlongfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshortpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form only displays the long form, but it
% typically won't be used as the \catattr{regular} attribute is set by this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstlongfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstlongfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstlongfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstlongfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%\begin{abbrvstyle}{long-noshort-desc}
%\changes{1.04}{2016-05-02}{new}
%Provide a synonym that matches similar styles.
%    \begin{macrocode}
\letabbreviationstyle{long-noshort-desc}{long-desc}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-noshort-desc-noreg}
%\changes{1.17}{2017-08-09}{new}
% Like long-noshort-desc but doesn't set the \catattr{regular} attribute.
%    \begin{macrocode}
\newabbreviationstyle{long-noshort-desc-noreg}%
{%
  \GlsXtrUseAbbrStyleSetup{long-noshort-desc}%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{long-noshort-desc}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{macro}{\glsxtrlongnoshortname}
%\changes{1.25}{2017-11-24}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrlongnoshortname}{%
  \protect\glsabbrvfont{\the\glsshorttok}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{long}
% It doesn't really make a great deal of sense to have a long-only
% style that doesn't have a description (unless no glossary is
% required), but the best course of
% action here is to use the short form as the name and the long
% form as the description.
%    \begin{macrocode}
\newabbreviationstyle{long}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongnoshortname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstlongfont{\the\glslongtok}},
    firstplural={\protect\glsfirstlongfont{\the\glslongpltok}},
    text={\glslongfont{\the\glslongtok}},
    plural={\glslongfont{\the\glslongpltok}},%
    description={\the\glslongtok}%
  }%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glssetattribute{\the\glslabeltok}{regular}{true}}%
}%
{%
  \GlsXtrUseAbbrStyleFmts{long-desc}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-noshort}
%\changes{1.04}{2016-05-02}{new}
%Provide a synonym that matches similar styles.
%    \begin{macrocode}
\letabbreviationstyle{long-noshort}{long}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-noshort-noreg}
%\changes{1.17}{2017-08-09}{new}
% Like long-noshort but doesn't set the \catattr{regular} attribute.
%    \begin{macrocode}
\newabbreviationstyle{long-noshort-noreg}%
{%
  \GlsXtrUseAbbrStyleSetup{long-noshort}%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{long-noshort}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\subsection{Predefined Styles (Small Capitals)}
%These styles use \cs{textsc} for the short form.
%\begin{macro}{\glsxtrscfont}
%\changes{0.5}{2015-12-07}{new}
%Maintained for backward-compatibility.
%    \begin{macrocode}
\newcommand*{\glsxtrscfont}[1]{\textsc{#1}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsabbrvscfont}
%\changes{1.17}{2017-08-09}{new}
%Added for consistent naming.
%    \begin{macrocode}
\newcommand*{\glsabbrvscfont}{\glsxtrscfont}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrfirstscfont}
%\changes{1.04}{2016-05-02}{new}
%Maintained for backward-compatibility.
%    \begin{macrocode}
\newcommand*{\glsxtrfirstscfont}[1]{\glsabbrvscfont{#1}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsfirstabbrvscfont}
%\changes{1.17}{2017-08-09}{new}
%Added for consistent naming.
%    \begin{macrocode}
\newcommand*{\glsfirstabbrvscfont}{\glsxtrfirstscfont}
%    \end{macrocode}
%\end{macro}
% and for the default short form suffix:
%\begin{macro}{\glsxtrscsuffix}
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrscsuffix}{\glstextup{\glsxtrabbrvpluralsuffix}}
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{long-short-sc}
%    \begin{macrocode}
\newabbreviationstyle{long-short-sc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongshortname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstlongdefaultfont{\the\glslongtok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvscfont{\the\glsshorttok}}},%
    firstplural={\protect\glsfirstlongdefaultfont{\the\glslongpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvscfont{\the\glsshortpltok}}},%
    plural={\protect\glsabbrvscfont{\the\glsshortpltok}},%
    description={\the\glslongtok}}%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
%    \end{macrocode}
% Use smallcaps and adjust the plural suffix to revert to upright.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvscfont{##1}}%
  \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvscfont{##1}}%
%    \end{macrocode}
% Use the default long fonts.
%    \begin{macrocode}
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The first use full form and the inline full form are the same for
% this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvscfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvscfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstlongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvscfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstlongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvscfont{\glsaccessshortpl{##1}}}%
  }%
}
%    \end{macrocode}
%
%\begin{abbrvstyle}{long-short-sc-desc}
%    \begin{macrocode}
\newabbreviationstyle{long-short-sc-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongshortdescname},
    sort={\glsxtrlongshortdescsort},%
    first={\protect\glsfirstlongdefaultfont{\the\glslongtok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvscfont{\the\glsshorttok}}},%
    firstplural={\protect\glsfirstlongdefaultfont{\the\glslongpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvscfont{\the\glsshortpltok}}},%
    text={\protect\glsabbrvscfont{\the\glsshorttok}},%
    plural={\protect\glsabbrvscfont{\the\glsshortpltok}}%
  }%
%    \end{macrocode}
%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
%    \end{macrocode}
% As long-short-sc style:
%    \begin{macrocode}
  \GlsXtrUseAbbrStyleFmts{long-short-sc}%
}
%    \end{macrocode}
%
% Now the short (long) version
%    \begin{macrocode}
\newabbreviationstyle{short-sc-long}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortlongname},
    sort={\the\glsshorttok},
    description={\the\glslongtok},%
    first={\protect\glsfirstabbrvscfont{\the\glsshorttok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongtok}}},%
    firstplural={\protect\glsfirstabbrvscfont{\the\glsshortpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongpltok}}},%
    plural={\protect\glsabbrvscfont{\the\glsshortpltok}}}%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
%    \end{macrocode}
% Use smallcaps and adjust the plural suffix to revert to upright.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvscfont{##1}}%
  \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvscfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The first use full form and the inline full form are the same for
% this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvscfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvscfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvscfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvscfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
% As before but user provides description
%    \begin{macrocode}
\newabbreviationstyle{short-sc-long-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortlongdescname},
    sort={\glsxtrshortlongdescsort},
    first={\protect\glsfirstabbrvscfont{\the\glsshorttok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongtok}}},%
    firstplural={\protect\glsfirstabbrvscfont{\the\glsshortpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongpltok}}},%
    text={\protect\glsabbrvscfont{\the\glsshorttok}},%
    plural={\protect\glsabbrvscfont{\the\glsshortpltok}}%
  }%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
%    \end{macrocode}
% As short-sc-long style:
%    \begin{macrocode}
  \GlsXtrUseAbbrStyleFmts{short-sc-long}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-sc}
%    \begin{macrocode}
\newabbreviationstyle{short-sc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortnolongname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstabbrvscfont{\the\glsshorttok}},
    firstplural={\protect\glsfirstabbrvscfont{\the\glsshortpltok}},
    text={\protect\glsabbrvscfont{\the\glsshorttok}},
    plural={\protect\glsabbrvscfont{\the\glsshortpltok}},
    description={\the\glslongtok}}%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glssetattribute{\the\glslabeltok}{regular}{true}}%
}%
{%
%    \end{macrocode}
% Use smallcaps and adjust the plural suffix to revert to upright.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvscfont{##1}}%
  \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvscfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The inline full form displays the short form followed by the
% long form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \protect\glsfirstabbrvscfont{\glsaccessshort{##1}%
      \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \protect\glsfirstabbrvscfont{\glsaccessshortpl{##1}%
     \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}%
  }%
%    \end{macrocode}
%\changes{1.21}{2017-11-03}{corrected first letter uppercasing}
%    \begin{macrocode}
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \protect\glsfirstabbrvscfont{\Glsaccessshort{##1}%
      \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \protect\glsfirstabbrvscfont{\Glsaccessshortpl{##1}%
       \ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form only displays the short form, but it
% typically won't be used as the \catattr{regular} attribute is set by this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvscfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvscfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvscfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvscfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-sc-nolong}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\letabbreviationstyle{short-sc-nolong}{short-sc}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-sc-desc}
%    \begin{macrocode}
\newabbreviationstyle{short-sc-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortdescname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstabbrvscfont{\the\glsshorttok}},
    firstplural={\protect\glsfirstabbrvscfont{\the\glsshortpltok}},
    text={\protect\glsabbrvscfont{\the\glsshorttok}},
    plural={\protect\glsabbrvscfont{\the\glsshortpltok}},
    description={\the\glslongtok}}%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glssetattribute{\the\glslabeltok}{regular}{true}}%
}%
{%
%    \end{macrocode}
% Use smallcaps and adjust the plural suffix to revert to upright.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvscfont{##1}}%
  \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvscfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The inline full form displays the short format followed by the
% long form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvscfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvscfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvscfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvscfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form only displays the short form, but it
% typically won't be used as the \catattr{regular} attribute is set by this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvscfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvscfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvscfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvscfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%\begin{abbrvstyle}{short-sc-nolong-desc}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\letabbreviationstyle{short-sc-nolong-desc}{short-sc-desc}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{nolong-short-sc}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newabbreviationstyle{nolong-short-sc}%
{%
  \GlsXtrUseAbbrStyleSetup{short-sc-nolong}%
}%
{%
  \GlsXtrUseAbbrStyleFmts{short-sc-nolong}%
%    \end{macrocode}
% The inline full form displays the long form followed by the
% short form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \protect\glsfirstlongdefaultfont{\glsaccesslong{##1}%
      \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvscfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \protect\glsfirstlongdefaultfont{\glsaccesslongpl{##1}%
     \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvscfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \protect\glsfirstlongdefaultfont{\Glsaccesslong{##1}%
      \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvscfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \protect\glsfirstlongdefaultfont{\Glsaccesslongpl{##1}%
       \ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvscfont{\glsaccessshortpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-noshort-sc}
%\changes{1.04}{2016-05-02}{renamed from \qt{long-sc}}
% The smallcaps font will only be used if
% the short form is explicitly invoked through commands like
% \cs{glsxtrshort}.
%    \begin{macrocode}
\newabbreviationstyle{long-noshort-sc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongnoshortname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstlongdefaultfont{\the\glslongtok}},
    firstplural={\protect\glsfirstlongdefaultfont{\the\glslongpltok}},
    text={\protect\glslongdefaultfont{\the\glslongtok}},
    plural={\protect\glslongdefaultfont{\the\glslongpltok}},%
    description={\the\glslongtok}%
  }%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glssetattribute{\the\glslabeltok}{regular}{true}}%
}%
{%
%    \end{macrocode}
% Use smallcaps and adjust the plural suffix to revert to upright.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvscfont{##1}}%
  \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvscfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The format for subsequent use (not used when the regular attribute
% is set).
%    \begin{macrocode}
  \renewcommand*{\glsxtrsubsequentfmt}[2]{%
    \glslongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\glsxtrsubsequentplfmt}[2]{%
    \glslongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\Glsxtrsubsequentfmt}[2]{%
    \glslongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\Glsxtrsubsequentplfmt}[2]{%
    \glslongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
%    \end{macrocode}
% The inline full form displays the long format followed by the
% short form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvscfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvscfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstlongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvscfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstlongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvscfont{\glsaccessshortpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form only displays the long form, but it
% typically won't be used as the \catattr{regular} attribute is set by this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%\begin{abbrvstyle}{long-sc}
%Backward compatibility: 
%    \begin{macrocode}
\@glsxtr@deprecated@abbrstyle{long-sc}{long-noshort-sc}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-noshort-sc-desc}
%\changes{1.04}{2016-05-02}{renamed from \qt{long-desc-sc}}
% The smallcaps font will only be used if
% the short form is explicitly invoked through commands like
% \cs{glsshort}.
%    \begin{macrocode}
\newabbreviationstyle{long-noshort-sc-desc}%
{%
  \GlsXtrUseAbbrStyleSetup{long-noshort-desc}%
}%
{%
%    \end{macrocode}
% Use smallcaps and adjust the plural suffix to revert to upright.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvscfont{##1}}%
  \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvscfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The format for subsequent use (not used when the regular attribute
% is set).
%    \begin{macrocode}
  \renewcommand*{\glsxtrsubsequentfmt}[2]{%
    \glslongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\glsxtrsubsequentplfmt}[2]{%
    \glslongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\Glsxtrsubsequentfmt}[2]{%
    \glslongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\Glsxtrsubsequentplfmt}[2]{%
    \glslongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
%    \end{macrocode}
% The inline full form displays the long format followed by the
% short form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvscfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvscfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstlongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvscfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstlongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvscfont{\glsaccessshortpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form only displays the long form, but it
% typically won't be used as the \catattr{regular} attribute is set by this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%\begin{abbrvstyle}{long-desc-sc}
%Backward compatibility: 
%    \begin{macrocode}
\@glsxtr@deprecated@abbrstyle{long-desc-sc}{long-noshort-sc-desc}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-sc-footnote}
%\changes{0.5}{2015-12-07}{new}
%\changes{1.04}{2016-05-02}{renamed from \qt{footnote-sc}}
%    \begin{macrocode}
\newabbreviationstyle{short-sc-footnote}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrfootnotename},
    sort={\the\glsshorttok},
    description={\the\glslongtok},%
    first={\protect\glsfirstabbrvscfont{\the\glsshorttok}%
     \protect\glsxtrabbrvfootnote{\the\glslabeltok}%
       {\protect\glsfirstlongfootnotefont{\the\glslongtok}}},%
    firstplural={\protect\glsfirstabbrvscfont{\the\glsshortpltok}%
     \protect\glsxtrabbrvfootnote{\the\glslabeltok}%
       {\protect\glsfirstlongfootnotefont{\the\glslongpltok}}},%
    plural={\protect\glsabbrvscfont{\the\glsshortpltok}}}%
%    \end{macrocode}
% Switch off hyperlinks on first use to prevent nested hyperlinks,
% and unset the \catattr{regular} attribute if it has been set.
%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set}
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glssetattribute{\the\glslabeltok}{nohyperfirst}{true}%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
%    \end{macrocode}
% Use smallcaps and adjust the plural suffix to revert to upright.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvscfont{##1}}%
  \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvscfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongfootnotefont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongfootnotefont{##1}}%
%    \end{macrocode}
% The full format displays the short form followed by the long form
% as a footnote.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvscfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \protect\glsxtrabbrvfootnote{##1}%
      {\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvscfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \protect\glsxtrabbrvfootnote{##1}%
      {\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvscfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \protect\glsxtrabbrvfootnote{##1}%
      {\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvscfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \protect\glsxtrabbrvfootnote{##1}%
      {\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form and the inline full form use the short
% (long) style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvscfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvscfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvscfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvscfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%\begin{abbrvstyle}{footnote-sc}
%Backward compatibility: 
%    \begin{macrocode}
\@glsxtr@deprecated@abbrstyle{footnote-sc}{short-sc-footnote}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-sc-postfootnote}
%\changes{0.5}{2015-12-07}{new}
%\changes{1.04}{2016-05-02}{renamed from \qt{postfootnote-sc}}
%    \begin{macrocode}
\newabbreviationstyle{short-sc-postfootnote}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrfootnotename},
    sort={\the\glsshorttok},
    description={\the\glslongtok},%
    first={\protect\glsfirstabbrvscfont{\the\glsshorttok}},%
    firstplural={\protect\glsfirstabbrvscfont{\the\glsshortpltok}},%
    plural={\protect\glsabbrvscfont{\the\glsshortpltok}}}%
%    \end{macrocode}
% Make this category insert a footnote after the link if this was
% the first use, and
% unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \csdef{glsxtrpostlink\glscategorylabel}{%
      \glsxtrifwasfirstuse
      {%
%    \end{macrocode}
% Needs the specific font command here as the style may have been
% lost by the time the footnote occurs.
%    \begin{macrocode}
        \glsxtrdopostpunc{\protect\glsxtrabbrvfootnote{\glslabel}%
        {\glsfirstlongfootnotefont{\glsentrylong{\glslabel}}}}%
      }%
      {}%
    }%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
%    \end{macrocode}
% The footnote needs to be suppressed in the inline form, so
% \cs{glsxtrfull} must set the first use switch off.
%    \begin{macrocode}
  \renewcommand*{\glsxtrsetupfulldefs}{%
    \let\glsxtrifwasfirstuse\@secondoftwo
  }%
}%
{%
%    \end{macrocode}
% Use smallcaps and adjust the plural suffix to revert to upright.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvscfont{##1}}%
  \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvscfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongfootnotefont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongfootnotefont{##1}}%
%    \end{macrocode}
% The full format displays the short form. The long form is
% deferred.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvscfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvscfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvscfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvscfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
%    \end{macrocode}
% The first use full form and the inline full form use the short
% (long) style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvscfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvscfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvscfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvscfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%\begin{abbrvstyle}{postfootnote-sc}
%Backward compatibility: 
%    \begin{macrocode}
\@glsxtr@deprecated@abbrstyle{postfootnote-sc}{short-sc-postfootnote}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\subsection{Predefined Styles (Fake Small Capitals)}
% These styles require the \sty{relsize} package, which must be
% loaded by the user. These styles all use:
%\begin{macro}{\glsxtrsmfont}
%\changes{0.5}{2015-12-07}{new}
%Maintained for backward compatibility.
%    \begin{macrocode}
\newcommand*{\glsxtrsmfont}[1]{\textsmaller{#1}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsabbrvsmfont}
%\changes{1.17}{2017-08-09}{new}
%Added for consistent naming.
%    \begin{macrocode}
\newcommand*{\glsabbrvsmfont}{\glsxtrsmfont}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrfirstsmfont}
%\changes{1.04}{2016-05-02}{new}
%Maintained for backward compatibility.
%    \begin{macrocode}
\newcommand*{\glsxtrfirstsmfont}[1]{\glsabbrvsmfont{#1}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsfirstabbrvsmfont}
%\changes{1.17}{2017-08-09}{new}
%Added for consistent naming.
%    \begin{macrocode}
\newcommand*{\glsfirstabbrvsmfont}{\glsxtrfirstsmfont}
%    \end{macrocode}
%\end{macro}
% and for the default short form suffix:
%\begin{macro}{\glsxtrsmsuffix}
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrsmsuffix}{\glsxtrabbrvpluralsuffix}
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{long-short-sm}
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newabbreviationstyle{long-short-sm}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongshortname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstlongdefaultfont{\the\glslongtok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvsmfont{\the\glsshorttok}}},%
    firstplural={\protect\glsfirstlongdefaultfont{\the\glslongpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvsmfont{\the\glsshortpltok}}},%
    plural={\protect\glsabbrvsmfont{\the\glsshortpltok}},%
    description={\the\glslongtok}}%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvsmfont{##1}}%
  \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvsmfont{##1}}%
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}%
%    \end{macrocode}
% Use the default long fonts.
%    \begin{macrocode}
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The first use full form and the inline full form are the same for
% this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvsmfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvsmfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstlongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvsmfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstlongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvsmfont{\glsaccessshortpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-short-sm-desc}
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newabbreviationstyle{long-short-sm-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongshortdescname},
    sort={\glsxtrlongshortdescsort},%
    first={\protect\glsfirstlongdefaultfont{\the\glslongtok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvsmfont{\the\glsshorttok}}},%
    firstplural={\protect\glsfirstlongdefaultfont{\the\glslongpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvsmfont{\the\glsshortpltok}}},%
    text={\protect\glsabbrvsmfont{\the\glsshorttok}},%
    plural={\protect\glsabbrvsmfont{\the\glsshortpltok}}%
  }%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
%    \end{macrocode}
% As long-short-sm style:
%    \begin{macrocode}
  \GlsXtrUseAbbrStyleFmts{long-short-sm}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-sm-long}
% Now the short (long) version
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newabbreviationstyle{short-sm-long}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortlongname},
    sort={\the\glsshorttok},
    description={\the\glslongtok},%
    first={\protect\glsfirstabbrvsmfont{\the\glsshorttok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongtok}}},%
    firstplural={\protect\glsfirstabbrvsmfont{\the\glsshortpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongpltok}}},%
    plural={\protect\glsabbrvsmfont{\the\glsshortpltok}}}%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvsmfont{##1}}%
  \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvsmfont{##1}}%
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The first use full form and the inline full form are the same for
% this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvsmfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvsmfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvsmfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvsmfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-sm-long-desc}
% As before but user provides description
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newabbreviationstyle{short-sm-long-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortlongdescname},
    sort={\glsxtrshortlongdescsort},
    first={\protect\glsfirstabbrvsmfont{\the\glsshorttok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongtok}}},%
    firstplural={\protect\glsfirstabbrvsmfont{\the\glsshortpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongpltok}}},%
    text={\protect\glsabbrvsmfont{\the\glsshorttok}},%
    plural={\protect\glsabbrvsmfont{\the\glsshortpltok}}%
  }%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
%    \end{macrocode}
% As short-sm-long style:
%    \begin{macrocode}
  \GlsXtrUseAbbrStyleFmts{short-sm-long}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-sm}
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newabbreviationstyle{short-sm}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortnolongname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstabbrvsmfont{\the\glsshorttok}},
    firstplural={\protect\glsfirstabbrvsmfont{\the\glsshortpltok}},
    text={\protect\glsabbrvsmfont{\the\glsshorttok}},
    plural={\protect\glsabbrvsmfont{\the\glsshortpltok}},
    description={\the\glslongtok}}%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glssetattribute{\the\glslabeltok}{regular}{true}}%
}%
{%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvsmfont{##1}}%
  \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvsmfont{##1}}%
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The inline full form displays the short form followed by the
% long form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \protect\glsfirstabbrvsmfont{\glsaccessshort{##1}%
      \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \protect\glsfirstabbrvsmfont{\glsaccessshortpl{##1}%
     \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}%
  }%
%    \end{macrocode}
%\changes{1.21}{2017-11-03}{corrected first letter uppercasing}
%    \begin{macrocode}
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \protect\glsfirstabbrvsmfont{\Glsaccessshort{##1}%
      \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \protect\glsfirstabbrvsmfont{\Glsaccessshortpl{##1}%
       \ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form only displays the short form, but it
% typically won't be used as the \catattr{regular} attribute is set by this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvsmfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvsmfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvsmfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvsmfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-sm-nolong}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\letabbreviationstyle{short-sm-nolong}{short-sm}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-sm-desc}
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newabbreviationstyle{short-sm-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortdescname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstabbrvsmfont{\the\glsshorttok}},
    firstplural={\protect\glsfirstabbrvsmfont{\the\glsshortpltok}},
    text={\protect\glsabbrvsmfont{\the\glsshorttok}},
    plural={\protect\glsabbrvsmfont{\the\glsshortpltok}},
    description={\the\glslongtok}}%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glssetattribute{\the\glslabeltok}{regular}{true}}%
}%
{%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvsmfont{##1}}%
  \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvsmfont{##1}}%
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The inline full form displays the short format followed by the
% long form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvsmfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvsmfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvsmfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvsmfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form only displays the short form, but it
% typically won't be used as the \catattr{regular} attribute is set by this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvsmfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvsmfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvsmfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvsmfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%\begin{abbrvstyle}{short-sm-nolong-desc}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\letabbreviationstyle{short-sm-nolong-desc}{short-sm-desc}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{nolong-short-sm}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newabbreviationstyle{nolong-short-sm}%
{%
  \GlsXtrUseAbbrStyleSetup{short-sm-nolong}%
}%
{%
  \GlsXtrUseAbbrStyleFmts{short-sm-nolong}%
%    \end{macrocode}
% The inline full form displays the long form followed by the
% short form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \protect\glsfirstlongdefaultfont{\glsaccesslong{##1}%
      \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvsmfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \protect\glsfirstlongdefaultfont{\glsaccesslongpl{##1}%
     \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvsmfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \protect\glsfirstlongdefaultfont{\Glsaccesslong{##1}%
      \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvsmfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \protect\glsfirstlongdefaultfont{\Glsaccesslongpl{##1}%
       \ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvsmfont{\glsaccessshortpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-noshort-sm}
%\changes{0.5}{2015-12-07}{new}
%\changes{1.04}{2016-05-02}{renamed from \qt{long-sm}}
% The smallcaps font will only be used if
% the short form is explicitly invoked through commands like
% \cs{glsshort}.
%    \begin{macrocode}
\newabbreviationstyle{long-noshort-sm}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongnoshortname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstlongdefaultfont{\the\glslongtok}},
    firstplural={\protect\glsfirstlongdefaultfont{\the\glslongpltok}},
    text={\protect\glslongdefaultfont{\the\glslongtok}},
    plural={\protect\glslongdefaultfont{\the\glslongpltok}},%
    description={\the\glslongtok}%
  }%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glssetattribute{\the\glslabeltok}{regular}{true}}%
}%
{%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvsmfont{##1}}%
  \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvsmfont{##1}}%
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The format for subsequent use (not used when the regular attribute
% is set).
%    \begin{macrocode}
  \renewcommand*{\glsxtrsubsequentfmt}[2]{%
    \glslongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\glsxtrsubsequentplfmt}[2]{%
    \glslongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\Glsxtrsubsequentfmt}[2]{%
    \glslongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\Glsxtrsubsequentplfmt}[2]{%
    \glslongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
%    \end{macrocode}
% The inline full form displays the long format followed by the
% short form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvsmfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvsmfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstlongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvsmfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstlongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvsmfont{\glsaccessshortpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form only displays the long form, but it
% typically won't be used as the \catattr{regular} attribute is set by this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%\begin{abbrvstyle}{long-sm}
%Backward compatibility: 
%    \begin{macrocode}
\@glsxtr@deprecated@abbrstyle{long-sm}{long-noshort-sm}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-noshort-sm-desc}
%\changes{0.5}{2015-12-07}{new}
%\changes{1.04}{2016-05-02}{renamed from \cs{long-desc-sm}}
% The smaller font will only be used if
% the short form is explicitly invoked through commands like
% \cs{glsshort}.
%    \begin{macrocode}
\newabbreviationstyle{long-noshort-sm-desc}%
{%
  \GlsXtrUseAbbrStyleSetup{long-noshort-desc}%
}%
{%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvsmfont{##1}}%
  \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvsmfont{##1}}%
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The format for subsequent use (not used when the regular attribute
% is set).
%    \begin{macrocode}
  \renewcommand*{\glsxtrsubsequentfmt}[2]{%
    \glslongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\glsxtrsubsequentplfmt}[2]{%
    \glslongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\Glsxtrsubsequentfmt}[2]{%
    \glslongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\Glsxtrsubsequentplfmt}[2]{%
    \glslongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
%    \end{macrocode}
% The inline full form displays the long format followed by the
% short form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvsmfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvsmfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstlongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvsmfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstlongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvsmfont{\glsaccessshortpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form only displays the long form, but it
% typically won't be used as the \catattr{regular} attribute is set by this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%\begin{abbrvstyle}{long-desc-sm}
%Backward compatibility: 
%    \begin{macrocode}
\@glsxtr@deprecated@abbrstyle{long-desc-sm}{long-noshort-sm-desc}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-sm-footnote}
%\changes{0.5}{2015-12-07}{new}
%\changes{1.04}{2016-05-02}{renamed from \qt{footnote-sm}}
%    \begin{macrocode}
\newabbreviationstyle{short-sm-footnote}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrfootnotename},
    sort={\the\glsshorttok},
    description={\the\glslongtok},%
    first={\protect\glsfirstabbrvsmfont{\the\glsshorttok}%
     \protect\glsxtrabbrvfootnote{\the\glslabeltok}%
       {\protect\glsfirstlongfootnotefont{\the\glslongtok}}},%
    firstplural={\protect\glsfirstabbrvsmfont{\the\glsshortpltok}%
     \protect\glsxtrabbrvfootnote{\the\glslabeltok}%
       {\protect\glsfirstlongfootnotefont{\the\glslongpltok}}},%
    plural={\protect\glsabbrvsmfont{\the\glsshortpltok}}}%
%    \end{macrocode}
% Switch off hyperlinks on first use to prevent nested hyperlinks,
% and unset the \catattr{regular} attribute if it has been set.
%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set}
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glssetattribute{\the\glslabeltok}{nohyperfirst}{true}%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvsmfont{##1}}%
  \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvsmfont{##1}}%
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongfootnotefont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongfootnotefont{##1}}%
%    \end{macrocode}
% The full format displays the short form followed by the long form
% as a footnote.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvsmfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \protect\glsxtrabbrvfootnote{##1}%
      {\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvsmfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \protect\glsxtrabbrvfootnote{##1}%
      {\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvsmfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \protect\glsxtrabbrvfootnote{##1}%
      {\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvsmfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \protect\glsxtrabbrvfootnote{##1}%
      {\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form and the inline full form use the short
% (long) style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvsmfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvsmfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvsmfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvsmfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%\begin{abbrvstyle}{footnote-sm}
%Backward compatibility: 
%    \begin{macrocode}
\@glsxtr@deprecated@abbrstyle{footnote-sm}{short-sm-footnote}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-sm-postfootnote}
%\changes{0.5}{2015-12-07}{new}
%\changes{1.04}{2016-05-02}{renamed from \qt{postfootnote-sm}}
%    \begin{macrocode}
\newabbreviationstyle{short-sm-postfootnote}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrfootnotename},
    sort={\the\glsshorttok},
    description={\the\glslongtok},%
    first={\protect\glsfirstabbrvsmfont{\the\glsshorttok}},%
    firstplural={\protect\glsfirstabbrvsmfont{\the\glsshortpltok}},%
    plural={\protect\glsabbrvsmfont{\the\glsshortpltok}}}%
%    \end{macrocode}
% Make this category insert a footnote after the link if this was
% the first use, and
% unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \csdef{glsxtrpostlink\glscategorylabel}{%
      \glsxtrifwasfirstuse
      {%
%    \end{macrocode}
% Needs the specific font command here as the style may have been
% lost by the time the footnote occurs.
%    \begin{macrocode}
        \glsxtrdopostpunc{\protect\glsxtrabbrvfootnote{\glslabel}%
        {\glsfirstlongfootnotefont{\glsentrylong{\glslabel}}}}%
      }%
      {}%
    }%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
%    \end{macrocode}
% The footnote needs to be suppressed in the inline form, so
% \cs{glsxtrfull} must set the first use switch off.
%    \begin{macrocode}
  \renewcommand*{\glsxtrsetupfulldefs}{%
    \let\glsxtrifwasfirstuse\@secondoftwo
  }%
}%
{%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvsmfont{##1}}%
  \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvsmfont{##1}}%
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongfootnotefont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongfootnotefont{##1}}%
%    \end{macrocode}
% The full format displays the short form. The long form is
% deferred.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvsmfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvsmfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvsmfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvsmfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
%    \end{macrocode}
% The first use full form and the inline full form use the short
% (long) style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvsmfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvsmfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvsmfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvsmfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%\begin{abbrvstyle}{postfootnote-sm}
%Backward compatibility: 
%    \begin{macrocode}
\@glsxtr@deprecated@abbrstyle{postfootnote-sm}{short-sm-postfootnote}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\subsection{Predefined Styles (Emphasized)}
% These styles use \ics{emph} for the short form.
%\begin{macro}{\glsabbrvemfont}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newcommand*{\glsabbrvemfont}[1]{\emph{#1}}%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsfirstabbrvemfont}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newcommand*{\glsfirstabbrvemfont}[1]{\glsabbrvemfont{#1}}%
%    \end{macrocode}
%\end{macro}
% The default short form suffix:
%\begin{macro}{\glsxtremsuffix}
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newcommand*{\glsxtremsuffix}{\glsxtrabbrvpluralsuffix}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsfirstlongemfont}
%\changes{1.04}{2016-05-02}{new}
%Only used by the \qt{long-em} styles.
%    \begin{macrocode}
\newcommand*{\glsfirstlongemfont}[1]{\glslongemfont{#1}}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glslongemfont}
%\changes{1.04}{2016-05-02}{new}
%Only used by the \qt{long-em} styles.
%    \begin{macrocode}
\newcommand*{\glslongemfont}[1]{\emph{#1}}%
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{long-short-em}
%\changes{0.5}{2015-12-07}{new}
% The long form is just set in the default long font.
%    \begin{macrocode}
\newabbreviationstyle{long-short-em}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongshortname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstlongdefaultfont{\the\glslongtok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvemfont{\the\glsshorttok}}},%
    firstplural={\protect\glsfirstlongdefaultfont{\the\glslongpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvemfont{\the\glsshortpltok}}},%
    plural={\protect\glsabbrvemfont{\the\glsshortpltok}},%
    description={\the\glslongtok}}%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvemfont{##1}}%
  \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvemfont{##1}}%
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}%
%    \end{macrocode}
% Use the default long fonts.
%    \begin{macrocode}
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The first use full form and the inline full form are the same for
% this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstlongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstlongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-short-em-desc}
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newabbreviationstyle{long-short-em-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongshortdescname},
    sort={\glsxtrlongshortdescsort},%
    first={\protect\glsfirstlongdefaultfont{\the\glslongtok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvemfont{\the\glsshorttok}}},%
    firstplural={\protect\glsfirstlongdefaultfont{\the\glslongpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvemfont{\the\glsshortpltok}}},%
    text={\protect\glsabbrvemfont{\the\glsshorttok}},%
    plural={\protect\glsabbrvemfont{\the\glsshortpltok}}%
  }%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
%    \end{macrocode}
% As long-short-em style:
%    \begin{macrocode}
  \GlsXtrUseAbbrStyleFmts{long-short-em}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-em-short-em}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newabbreviationstyle{long-em-short-em}%
{%
%    \end{macrocode}
%\cs{glslongemfont} is used in the description since \cs{glsdesc}
%doesn't set the style.
%    \begin{macrocode}
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongshortname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstlongemfont{\the\glslongtok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvemfont{\the\glsshorttok}}},%
    firstplural={\protect\glsfirstlongemfont{\the\glslongpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvemfont{\the\glsshortpltok}}},%
%    \end{macrocode}
%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}}
%    \begin{macrocode}
    plural={\protect\glsabbrvemfont{\the\glsshortpltok}},%
    description={\protect\glslongemfont{\the\glslongtok}}}%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}%
  \renewcommand*{\glsabbrvfont}[1]{\glsabbrvemfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvemfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongemfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongemfont{##1}}%
%    \end{macrocode}
% The first use full form and the inline full form are the same for
% this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstlongemfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstlongemfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstlongemfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstlongemfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-em-short-em-desc}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newabbreviationstyle{long-em-short-em-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongshortdescname},
    sort={\glsxtrlongshortdescsort},%
    first={\protect\glsfirstlongemfont{\the\glslongtok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvemfont{\the\glsshorttok}}},%
    firstplural={\protect\glsfirstlongemfont{\the\glslongpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvemfont{\the\glsshortpltok}}},%
    text={\protect\glsabbrvemfont{\the\glsshorttok}},%
    plural={\protect\glsabbrvemfont{\the\glsshortpltok}}%
  }%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{long-em-short-em}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-em-long}
% Now the short (long) version
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newabbreviationstyle{short-em-long}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortlongname},
    sort={\the\glsshorttok},
    description={\the\glslongtok},%
    first={\protect\glsfirstabbrvemfont{\the\glsshorttok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongtok}}},%
    firstplural={\protect\glsfirstabbrvemfont{\the\glsshortpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongpltok}}},%
    plural={\protect\glsabbrvemfont{\the\glsshortpltok}}}%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
%    \end{macrocode}
% Mostly as short-long style:
%\changes{1.05}{2016-06-10}{fixed incorrect font used by long form}
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvemfont{##1}}%
  \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvemfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The first use full form and the inline full form are the same for
% this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvemfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvemfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-em-long-desc}
% As before but user provides description
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newabbreviationstyle{short-em-long-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortlongdescname},
    sort={\glsxtrshortlongdescsort},
    first={\protect\glsfirstabbrvemfont{\the\glsshorttok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongtok}}},%
    firstplural={\protect\glsfirstabbrvemfont{\the\glsshortpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongpltok}}},%
    text={\protect\glsabbrvemfont{\the\glsshorttok}},%
    plural={\protect\glsabbrvemfont{\the\glsshortpltok}}%
  }%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{short-em-long}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-em-long-em}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newabbreviationstyle{short-em-long-em}%
{%
%    \end{macrocode}
%\cs{glslongemfont} is used in the description since \cs{glsdesc}
%doesn't set the style.
%    \begin{macrocode}
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortlongname},
    sort={\the\glsshorttok},
    description={\protect\glslongemfont{\the\glslongtok}},%
    first={\protect\glsfirstabbrvemfont{\the\glsshorttok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlongemfont{\the\glslongtok}}},%
    firstplural={\protect\glsfirstabbrvemfont{\the\glsshortpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlongemfont{\the\glslongpltok}}},%
%    \end{macrocode}
%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}}
%    \begin{macrocode}
    plural={\protect\glsabbrvemfont{\the\glsshortpltok}}}%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}%
  \renewcommand*{\glsabbrvfont}[1]{\glsabbrvemfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvemfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongemfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongemfont{##1}}%
%    \end{macrocode}
% The first use full form and the inline full form are the same for
% this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongemfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongemfont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvemfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongemfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvemfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongemfont{\glsaccesslongpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-em-long-em-desc}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newabbreviationstyle{short-em-long-em-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortlongdescname},%
    sort={\glsxtrshortlongdescsort},%
    first={\protect\glsfirstabbrvemfont{\the\glsshorttok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlongemfont{\the\glslongtok}}},%
    firstplural={\protect\glsfirstabbrvemfont{\the\glsshortpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlongemfont{\the\glslongpltok}}},%
    text={\protect\glsabbrvemfont{\the\glsshorttok}},%
    plural={\protect\glsabbrvemfont{\the\glsshortpltok}}%
  }%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{short-em-long-em}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-em}
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newabbreviationstyle{short-em}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortnolongname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstabbrvemfont{\the\glsshorttok}},
    firstplural={\protect\glsfirstabbrvemfont{\the\glsshortpltok}},
    text={\protect\glsabbrvemfont{\the\glsshorttok}},
    plural={\protect\glsabbrvemfont{\the\glsshortpltok}},
    description={\the\glslongtok}}%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glssetattribute{\the\glslabeltok}{regular}{true}}%
}%
{%
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvemfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvemfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The inline full form displays the short form followed by the
% long form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \protect\glsfirstabbrvemfont{\glsaccessshort{##1}%
      \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \protect\glsfirstabbrvemfont{\glsaccessshortpl{##1}%
     \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}%
  }%
%    \end{macrocode}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \protect\glsfirstabbrvemfont{\Glsaccessshort{##1}%
      \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \protect\glsfirstabbrvemfont{\Glsaccessshortpl{##1}%
       \ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form only displays the short form, but it
% typically won't be used as the \catattr{regular} attribute is set by this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-em-nolong}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\letabbreviationstyle{short-em-nolong}{short-em}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-em-desc}
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\newabbreviationstyle{short-em-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortdescname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstabbrvemfont{\the\glsshorttok}},
    firstplural={\protect\glsfirstabbrvemfont{\the\glsshortpltok}},
    text={\protect\glsabbrvemfont{\the\glsshorttok}},
    plural={\protect\glsabbrvemfont{\the\glsshortpltok}},
    description={\the\glslongtok}}%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glssetattribute{\the\glslabeltok}{regular}{true}}%
}%
{%
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvemfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvemfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The inline full form displays the short format followed by the
% long form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvemfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvemfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form only displays the short form, but it
% typically won't be used as the \catattr{regular} attribute is set by this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%\begin{abbrvstyle}{short-em-nolong-desc}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\letabbreviationstyle{short-em-nolong-desc}{short-em-desc}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{nolong-short-em}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newabbreviationstyle{nolong-short-em}%
{%
  \GlsXtrUseAbbrStyleSetup{short-em-nolong}%
}%
{%
  \GlsXtrUseAbbrStyleFmts{short-em-nolong}%
%    \end{macrocode}
% The inline full form displays the long form followed by the
% short form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \protect\glsfirstlongdefaultfont{\glsaccesslong{##1}%
      \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \protect\glsfirstlongdefaultfont{\glsaccesslongpl{##1}%
     \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \protect\glsfirstlongdefaultfont{\Glsaccesslong{##1}%
      \ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \protect\glsfirstlongdefaultfont{\Glsaccesslongpl{##1}%
       \ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-noshort-em}
%\changes{0.5}{2015-12-07}{new}
%\changes{1.04}{2016-05-02}{renamed from \qt{long-em}}
% The short form is explicitly invoked through commands like
% \cs{glsshort}.
%    \begin{macrocode}
\newabbreviationstyle{long-noshort-em}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongnoshortname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstlongdefaultfont{\the\glslongtok}},
    firstplural={\protect\glsfirstlongdefaultfont{\the\glslongpltok}},
    text={\protect\glslongdefaultfont{\the\glslongtok}},
    plural={\protect\glslongdefaultfont{\the\glslongpltok}},%
    description={\the\glslongtok}%
  }%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glssetattribute{\the\glslabeltok}{regular}{true}}%
}%
{%
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvemfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvemfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The format for subsequent use (not used when the regular attribute
% is set).
%    \begin{macrocode}
  \renewcommand*{\glsxtrsubsequentfmt}[2]{%
    \glslongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\glsxtrsubsequentplfmt}[2]{%
    \glslongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\Glsxtrsubsequentfmt}[2]{%
    \glslongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\Glsxtrsubsequentplfmt}[2]{%
    \glslongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
%    \end{macrocode}
% The inline full form displays the long format followed by the
% short form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstlongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstlongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form only displays the long form, but it
% typically won't be used as the \catattr{regular} attribute is set by this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%\begin{abbrvstyle}{long-em}
%Backward compatibility: 
%    \begin{macrocode}
\@glsxtr@deprecated@abbrstyle{long-em}{long-noshort-em}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-em-noshort-em}
%\changes{1.04}{2016-05-02}{new}
% The short form is explicitly invoked through commands like
% \cs{glsshort}.
%    \begin{macrocode}
\newabbreviationstyle{long-em-noshort-em}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongnoshortname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstlongemfont{\the\glslongtok}},
    firstplural={\protect\glsfirstlongemfont{\the\glslongpltok}},
    text={\protect\glslongemfont{\the\glslongtok}},
    plural={\protect\glslongemfont{\the\glslongpltok}},%
    description={\protect\glslongemfont{\the\glslongtok}}%
  }%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glssetattribute{\the\glslabeltok}{regular}{true}}%
}%
{%
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvemfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvemfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongemfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongemfont{##1}}%
%    \end{macrocode}
% The format for subsequent use (not used when the regular attribute
% is set).
%    \begin{macrocode}
  \renewcommand*{\glsxtrsubsequentfmt}[2]{%
    \glslongemfont{\glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\glsxtrsubsequentplfmt}[2]{%
    \glslongemfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\Glsxtrsubsequentfmt}[2]{%
    \glslongemfont{\Glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\Glsxtrsubsequentplfmt}[2]{%
    \glslongemfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
%    \end{macrocode}
% The inline full form displays the long format followed by the
% short form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstlongemfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstlongemfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstlongemfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstlongemfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form only displays the long form, but it
% typically won't be used as the \catattr{regular} attribute is set by this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstlongemfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstlongemfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstlongemfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstlongemfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-em-noshort-em-noreg}
%\changes{1.17}{2017-08-09}{new}
% Like long-em-noshort-em but doesn't set the \catattr{regular} attribute.
%    \begin{macrocode}
\newabbreviationstyle{long-em-noshort-em-noreg}%
{%
  \GlsXtrUseAbbrStyleSetup{long-em-noshort-em}%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{long-em-noshort-em}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-noshort-em-desc}
%\changes{1.04}{2016-05-02}{renamed from \qt{long-desc-em}}
%\changes{0.5}{2015-12-07}{new}
% The emphasized font will only be used if
% the short form is explicitly invoked through commands like
% \cs{glsshort}.
%    \begin{macrocode}
\newabbreviationstyle{long-noshort-em-desc}%
{%
  \GlsXtrUseAbbrStyleSetup{long-noshort-desc}%
}%
{%
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvemfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvemfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}%
%    \end{macrocode}
% The format for subsequent use (not used when the regular attribute
% is set).
%    \begin{macrocode}
  \renewcommand*{\glsxtrsubsequentfmt}[2]{%
    \glslongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\glsxtrsubsequentplfmt}[2]{%
    \glslongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\Glsxtrsubsequentfmt}[2]{%
    \glslongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\Glsxtrsubsequentplfmt}[2]{%
    \glslongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
%    \end{macrocode}
% The inline full form displays the long format followed by the
% short form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstlongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstlongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form only displays the long form, but it
% typically won't be used as the \catattr{regular} attribute is set by this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%\begin{abbrvstyle}{long-desc-em}
%Backward compatibility: 
%    \begin{macrocode}
\@glsxtr@deprecated@abbrstyle{long-desc-em}{long-noshort-em-desc}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-em-noshort-em-desc}
%\changes{1.04}{2016-05-02}{new}
% The short form is explicitly invoked through commands like
% \cs{glsshort}. The long form is emphasized.
%    \begin{macrocode}
\newabbreviationstyle{long-em-noshort-em-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongnoshortdescname},
    sort={\the\glslongtok},
    first={\protect\glsfirstlongemfont{\the\glslongtok}},
    firstplural={\protect\glsfirstlongemfont{\the\glslongpltok}},
    text={\glslongemfont{\the\glslongtok}},
    plural={\glslongemfont{\the\glslongpltok}}%
  }%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glssetattribute{\the\glslabeltok}{regular}{true}}%
}%
{%
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvemfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvemfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongemfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongemfont{##1}}%
%    \end{macrocode}
% The format for subsequent use (not used when the regular attribute
% is set).
%    \begin{macrocode}
  \renewcommand*{\glsxtrsubsequentfmt}[2]{%
    \glslongemfont{\glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\glsxtrsubsequentplfmt}[2]{%
    \glslongemfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\Glsxtrsubsequentfmt}[2]{%
    \glslongemfont{\Glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
  \renewcommand*{\Glsxtrsubsequentplfmt}[2]{%
    \glslongemfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}%
    \ifglsxtrinsertinside \else##2\fi
  }%
%    \end{macrocode}
% The inline full form displays the long format followed by the
% short form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstlongemfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstlongemfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstlongemfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstlongemfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form only displays the long form, but it
% typically won't be used as the \catattr{regular} attribute is set by this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstlongemfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstlongemfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstlongemfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstlongemfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-em-noshort-em-desc-noreg}
%\changes{1.17}{2017-08-09}{new}
% Like long-em-noshort-em-desc but doesn't set the \catattr{regular} attribute.
%    \begin{macrocode}
\newabbreviationstyle{long-em-noshort-em-desc-noreg}%
{%
  \GlsXtrUseAbbrStyleSetup{long-em-noshort-em-desc}%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{long-em-noshort-em-desc}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-em-footnote}
%\changes{0.5}{2015-12-07}{new}
%\changes{1.04}{2015-04-30}{renamed from \qt{footnote-em}}
%    \begin{macrocode}
\newabbreviationstyle{short-em-footnote}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrfootnotename},
    sort={\the\glsshorttok},
    description={\the\glslongtok},%
    first={\protect\glsfirstabbrvemfont{\the\glsshorttok}%
     \protect\glsxtrabbrvfootnote{\the\glslabeltok}%
       {\protect\glsfirstlongfootnotefont{\the\glslongtok}}},%
    firstplural={\protect\glsfirstabbrvemfont{\the\glsshortpltok}%
     \protect\glsxtrabbrvfootnote{\the\glslabeltok}%
       {\protect\glsfirstlongfootnotefont{\the\glslongpltok}}},%
    plural={\protect\glsabbrvemfont{\the\glsshortpltok}}}%
%    \end{macrocode}
% Switch off hyperlinks on first use to prevent nested hyperlinks,
% and unset the \catattr{regular} attribute if it has been set.
%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set}
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glssetattribute{\the\glslabeltok}{nohyperfirst}{true}%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvemfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvemfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongfootnotefont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongfootnotefont{##1}}%
%    \end{macrocode}
% The full format displays the short form followed by the long form
% as a footnote.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \protect\glsxtrabbrvfootnote{##1}%
      {\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \protect\glsxtrabbrvfootnote{##1}%
      {\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvemfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \protect\glsxtrabbrvfootnote{##1}%
      {\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvemfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \protect\glsxtrabbrvfootnote{##1}%
      {\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form and the inline full form use the short
% (long) style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvemfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvemfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%\begin{abbrvstyle}{footnote-em}
%Backward compatibility: 
%    \begin{macrocode}
\@glsxtr@deprecated@abbrstyle{footnote-em}{short-em-footnote}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-em-postfootnote}
%\changes{0.5}{2015-12-07}{new}
%\changes{1.04}{2016-05-02}{renamed from \qt{postfootnote-em}}
%    \begin{macrocode}
\newabbreviationstyle{short-em-postfootnote}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrfootnotename},
    sort={\the\glsshorttok},
    description={\the\glslongtok},%
    first={\protect\glsfirstabbrvemfont{\the\glsshorttok}},%
    firstplural={\protect\glsfirstabbrvemfont{\the\glsshortpltok}},%
    plural={\protect\glsabbrvemfont{\the\glsshortpltok}}}%
%    \end{macrocode}
% Make this category insert a footnote after the link if this was
% the first use, and
% unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \csdef{glsxtrpostlink\glscategorylabel}{%
      \glsxtrifwasfirstuse
      {%
%    \end{macrocode}
% Needs the specific font command here as the style may have been
% lost by the time the footnote occurs.
%    \begin{macrocode}
        \glsxtrdopostpunc{\protect\glsxtrabbrvfootnote{\glslabel}%
        {\glsfirstlongfootnotefont{\glsentrylong{\glslabel}}}}%
      }%
      {}%
    }%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
%    \end{macrocode}
% The footnote needs to be suppressed in the inline form, so
% \cs{glsxtrfull} must set the first use switch off.
%    \begin{macrocode}
  \renewcommand*{\glsxtrsetupfulldefs}{%
    \let\glsxtrifwasfirstuse\@secondoftwo
  }%
}%
{%
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvemfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvemfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongfootnotefont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongfootnotefont{##1}}%
%    \end{macrocode}
% The full format displays the short form. The long form is
% deferred.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvemfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvemfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
%    \end{macrocode}
% The first use full form and the inline full form use the short
% (long) style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvemfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvemfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}%
    \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%\begin{abbrvstyle}{postfootnote-em}
%Backward compatibility: 
%    \begin{macrocode}
\@glsxtr@deprecated@abbrstyle{postfootnote-em}{short-em-postfootnote}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\subsection{Predefined Styles (User Parentheses Hook)}
% These styles allow the user to adjust the parenthetical forms.
% These styles all test for the existence of the
% field given by:
%\begin{macro}{\glsxtruserfield}
%\changes{1.04}{2016-05-02}{new}
% Default is the useri field.
%    \begin{macrocode}
\newcommand*{\glsxtruserfield}{useri}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtruserparen}
%\changes{1.04}{2016-05-02}{new}
% The format of the parenthetical information.
% The first argument is the long/short form. The second argument
% is the entry's label. If \cs{glscurrentfieldvalue} has been
% defined, then we have at least \styfmt{glossaries} v4.23, which makes
% it easier for the user to adjust this.
%    \begin{macrocode}
\ifdef\glscurrentfieldvalue
{
  \newcommand*{\glsxtruserparen}[2]{%
    \glsxtrfullsep{#2}%
    \glsxtrparen
     {#1\ifglshasfield{\glsxtruserfield}{#2}{, \glscurrentfieldvalue}{}}%
  }
}
{
  \newcommand*{\glsxtruserparen}[2]{%
    \glsxtrfullsep{#2}%
    \glsxtrparen
      {#1\ifglshasfield{\glsxtruserfield}{#2}{, \@glo@thisvalue}{}}%
  }
}
%    \end{macrocode}
%\end{macro}
% Font used for short form:
%\begin{macro}{\glsabbrvuserfont}
%\changes{1.04}{2016-05-02}{new}
%\changes{1.17}{2017-08-09}{initialised to default font}
%    \begin{macrocode}
\newcommand*{\glsabbrvuserfont}[1]{\glsabbrvdefaultfont{#1}}
%    \end{macrocode}
%\end{macro}
% Font used for short form on first use:
%\begin{macro}{\glsfirstabbrvuserfont}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newcommand*{\glsfirstabbrvuserfont}[1]{\glsabbrvuserfont{#1}}
%    \end{macrocode}
%\end{macro}
% Font used for long form:
%\begin{macro}{\glslonguserfont}
%\changes{1.04}{2016-05-02}{new}
%\changes{1.17}{2017-08-09}{initialised to default font}
%    \begin{macrocode}
\newcommand*{\glslonguserfont}[1]{\glslongdefaultfont{#1}}
%    \end{macrocode}
%\end{macro}
% Font used for long form on first use:
%\begin{macro}{\glsfirstlonguserfont}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newcommand*{\glsfirstlonguserfont}[1]{\glslonguserfont{#1}}
%    \end{macrocode}
%\end{macro}
% The default short form suffix:
%\begin{macro}{\glsxtrusersuffix}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrusersuffix}{\glsxtrabbrvpluralsuffix}
%    \end{macrocode}
%\end{macro}
%
% Description encapsulator.
%\begin{macro}{\glsuserdescription}
%\changes{1.30}{2018-04-25}{new}
%The first argument is the description. The second argument is the
%label.
%    \begin{macrocode}
\newcommand*{\glsuserdescription}[2]{\glslonguserfont{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{long-short-user}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newabbreviationstyle{long-short-user}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongshortname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstlonguserfont{\the\glslongtok}%
     \protect\glsxtruserparen{\protect\glsfirstabbrvuserfont{\the\glsshorttok}}%
      {\the\glslabeltok}},%
    firstplural={\protect\glsfirstlonguserfont{\the\glslongpltok}%
     \protect\glsxtruserparen
      {\protect\glsfirstabbrvuserfont{\the\glsshortpltok}}{\the\glslabeltok}},%
%    \end{macrocode}
%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}}
%    \begin{macrocode}
    plural={\protect\glsabbrvuserfont{\the\glsshortpltok}},%
    description={\protect\glsuserdescription{\the\glslongtok}%
     {\the\glslabeltok}}}%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
%    \end{macrocode}
% In case the user wants to mix and match font styles, these are
% redefined here.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\glsxtrusersuffix}%
  \renewcommand*{\glsabbrvfont}[1]{\glsabbrvuserfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvuserfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlonguserfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslonguserfont{##1}}%
%    \end{macrocode}
% The first use full form and the inline full form are the same for
% this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstlonguserfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtruserparen{\glsfirstabbrvuserfont{\glsaccessshort{##1}}}{##1}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstlonguserfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtruserparen{\glsfirstabbrvuserfont{\glsaccessshortpl{##1}}}{##1}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstlonguserfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtruserparen{\glsfirstabbrvuserfont{\glsaccessshort{##1}}}{##1}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstlonguserfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtruserparen{\glsfirstabbrvuserfont{\glsaccessshortpl{##1}}}{##1}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-postshort-user}
%\changes{1.12}{2017-02-03}{new}
%Like \abbrstyle{long-short-user} but defers the parenthetical
%matter to after the link.
%    \begin{macrocode}
\newabbreviationstyle{long-postshort-user}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongshortname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstlonguserfont{\the\glslongtok}},%
    firstplural={\protect\glsfirstlonguserfont{\the\glslongpltok}},%
%    \end{macrocode}
%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}}
%    \begin{macrocode}
    plural={\protect\glsabbrvuserfont{\the\glsshortpltok}},%
    description={\protect\glsuserdescription{\the\glslongtok}%
     {\the\glslabeltok}}}%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \csdef{glsxtrpostlink\glscategorylabel}{%
      \glsxtrifwasfirstuse
      {%
        \glsxtruserparen
          {\glsfirstabbrvuserfont{\glsentryshort{\glslabel}}}%
          {\glslabel}%
      }%
      {}%
    }%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
%    \end{macrocode}
% In case the user wants to mix and match font styles, these are
% redefined here.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\glsxtrusersuffix}%
  \renewcommand*{\glsabbrvfont}[1]{\glsabbrvuserfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvuserfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlonguserfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslonguserfont{##1}}%
%    \end{macrocode}
%First use full form:
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstlonguserfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstlonguserfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstlonguserfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstlonguserfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
%    \end{macrocode}
% In-line format:
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstlonguserfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtruserparen{\glsfirstabbrvuserfont{\glsaccessshort{##1}}}{##1}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstlonguserfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtruserparen{\glsfirstabbrvuserfont{\glsaccessshortpl{##1}}}{##1}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstlonguserfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtruserparen{\glsfirstabbrvuserfont{\glsaccessshort{##1}}}{##1}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstlonguserfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtruserparen{\glsfirstabbrvuserfont{\glsaccessshortpl{##1}}}{##1}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{macro}{\glsxtrlongshortuserdescname}
%\changes{1.25}{2017-11-24}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrlongshortuserdescname}{%
  \protect\glslonguserfont{\the\glslongtok}%
  \protect\glsxtruserparen
   {\protect\glsabbrvuserfont{\the\glsshorttok}}{\the\glslabeltok}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{long-postshort-user-desc}
%\changes{1.12}{2017-02-03}{new}
%Like \abbrstyle{long-postshort-user} but the user supplies the
%description.
%    \begin{macrocode}
\newabbreviationstyle{long-postshort-user-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongshortuserdescname},
    sort={\the\glslongtok},
    first={\protect\glsfirstlonguserfont{\the\glslongtok}},%
    firstplural={\protect\glsfirstlonguserfont{\the\glslongpltok}},%
%    \end{macrocode}
%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}}
%    \begin{macrocode}
    text={\protect\glsabbrvuserfont{\the\glsshorttok}},%
    plural={\protect\glsabbrvuserfont{\the\glsshortpltok}}%
  }%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \csdef{glsxtrpostlink\glscategorylabel}{%
      \glsxtrifwasfirstuse
      {%
        \glsxtruserparen
          {\glsfirstabbrvuserfont{\glsentryshort{\glslabel}}}%
          {\glslabel}%
      }%
      {}%
    }%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{long-postshort-user}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-postlong-user}
%\changes{1.12}{2017-02-03}{new}
%Like \abbrstyle{short-long-user} but defers the parenthetical
%matter to after the link.
%    \begin{macrocode}
\newabbreviationstyle{short-postlong-user}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortlongname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstlonguserfont{\the\glslongtok}},%
    firstplural={\protect\glsfirstlonguserfont{\the\glslongpltok}},%
%    \end{macrocode}
%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}}
%    \begin{macrocode}
    plural={\protect\glsabbrvuserfont{\the\glsshortpltok}},%
    description={\protect\glsuserdescription{\the\glslongtok}%
     {\the\glslabeltok}}}%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \csdef{glsxtrpostlink\glscategorylabel}{%
      \glsxtrifwasfirstuse
      {%
        \glsxtruserparen
          {\glsfirstlonguserfont{\glsentrylong{\glslabel}}}%
          {\glslabel}%
      }%
      {}%
    }%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
%    \end{macrocode}
% In case the user wants to mix and match font styles, these are
% redefined here.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\glsxtrusersuffix}%
  \renewcommand*{\glsabbrvfont}[1]{\glsabbrvuserfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvuserfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlonguserfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslonguserfont{##1}}%
%    \end{macrocode}
%First use full form:
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvuserfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvuserfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvuserfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvuserfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
%    \end{macrocode}
% In-line format:
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvuserfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtruserparen{\glsfirstlonguserfont{\glsaccesslong{##1}}}{##1}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvuserfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtruserparen{\glsfirstlonguserfont{\glsaccesslongpl{##1}}}{##1}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvuserfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtruserparen{\glsfirstlonguserfont{\glsaccesslong{##1}}}{##1}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvuserfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtruserparen{\glsfirstlonguserfont{\glsaccesslongpl{##1}}}{##1}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{macro}{\glsxtrshortlonguserdescname}
%\changes{1.25}{2017-11-24}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrshortlonguserdescname}{%
 \protect\glsabbrvuserfont{\the\glsshorttok}%
 \protect\glsxtruserparen
   {\protect\glslonguserfont{\the\glslongpltok}}%
   {\the\glslabeltok}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{short-postlong-user-desc}
%\changes{1.12}{2017-02-03}{new}
%Like \abbrstyle{short-postlong-user} but leaves the user to specify
%the description.
%    \begin{macrocode}
\newabbreviationstyle{short-postlong-user-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortlonguserdescname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstlonguserfont{\the\glslongtok}},%
    firstplural={\protect\glsfirstlonguserfont{\the\glslongpltok}},%
%    \end{macrocode}
%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}}
%    \begin{macrocode}
    text={\protect\glsabbrvuserfont{\the\glsshorttok}},%
    plural={\protect\glsabbrvuserfont{\the\glsshortpltok}}%
  }%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \csdef{glsxtrpostlink\glscategorylabel}{%
      \glsxtrifwasfirstuse
      {%
        \glsxtruserparen
          {\glsfirstlonguserfont{\glsentrylong{\glslabel}}}%
          {\glslabel}%
      }%
      {}%
    }%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{short-postlong-user}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-short-user-desc}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newabbreviationstyle{long-short-user-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongshortuserdescname},
    sort={\glsxtrlongshortdescsort},%
%    \end{macrocode}
%\changes{1.17}{2017-08-09}{corrected first forms}
%    \begin{macrocode}
    first={\protect\glsfirstlonguserfont{\the\glslongtok}%
     \protect\glsxtruserparen{\protect\glsfirstabbrvuserfont{\the\glsshorttok}}%
      {\the\glslabeltok}},%
    firstplural={\protect\glsfirstlonguserfont{\the\glslongpltok}%
     \protect\glsxtruserparen
      {\protect\glsfirstabbrvuserfont{\the\glsshortpltok}}{\the\glslabeltok}},%
    text={\protect\glsabbrvfont{\the\glsshorttok}},%
    plural={\protect\glsabbrvfont{\the\glsshortpltok}}%
  }%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{long-short-user}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-long-user}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newabbreviationstyle{short-long-user}%
{%
%    \end{macrocode}
%\cs{glslonguserfont} is used in the description since \cs{glsdesc}
%doesn't set the style. (Now in \cs{glsuserdescription}.)
%    \begin{macrocode}
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortlongname},
    sort={\the\glsshorttok},
    description={\protect\glsuserdescription{\the\glslongtok}%
      {\the\glslabeltok}},%
    first={\protect\glsfirstabbrvuserfont{\the\glsshorttok}%
     \protect\glsxtruserparen{\protect\glsfirstlonguserfont{\the\glslongtok}}%
       {\the\glslabeltok}},%
    firstplural={\protect\glsfirstabbrvuserfont{\the\glsshortpltok}%
     \protect\glsxtruserparen{\protect\glsfirstlonguserfont{\the\glslongpltok}}%
       {\the\glslabeltok}},%
%    \end{macrocode}
%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}}
%    \begin{macrocode}
    plural={\protect\glsabbrvuserfont{\the\glsshortpltok}}}%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
%    \end{macrocode}
% In case the user wants to mix and match font styles, these are
% redefined here.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\glsxtrusersuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvuserfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvuserfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlonguserfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslonguserfont{##1}}%
%    \end{macrocode}
% The first use full form and the inline full form are the same for
% this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstabbrvuserfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtruserparen{\glsfirstlonguserfont{\glsaccesslong{##1}}}{##1}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstabbrvuserfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtruserparen{\glsfirstlonguserfont{\glsaccesslongpl{##1}}}{##1}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstabbrvuserfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtruserparen{\glsfirstlonguserfont{\glsaccesslong{##1}}}{##1}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstabbrvuserfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtruserparen{\glsfirstlonguserfont{\glsaccesslongpl{##1}}}{##1}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-long-user-desc}
%\changes{1.04}{2016-05-02}{new}
%    \begin{macrocode}
\newabbreviationstyle{short-long-user-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortlonguserdescname},
    sort={\glsxtrshortlongdescsort},%
%    \end{macrocode}
%\changes{1.17}{2017-08-09}{corrected first forms}
%    \begin{macrocode}
    first={\protect\glsfirstabbrvuserfont{\the\glsshorttok}%
     \protect\glsxtruserparen{\protect\glsfirstlonguserfont{\the\glslongtok}}%
       {\the\glslabeltok}},%
    firstplural={\protect\glsfirstabbrvuserfont{\the\glsshortpltok}%
     \protect\glsxtruserparen{\protect\glsfirstlonguserfont{\the\glslongpltok}}%
       {\the\glslabeltok}},%
    text={\protect\glsabbrvfont{\the\glsshorttok}},%
    plural={\protect\glsabbrvfont{\the\glsshortpltok}}%
  }%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{short-long-user}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\subsection{Predefined Styles (Hyphen)}
%These styles are designed to work with the \catattr{markwords}
%attribute. They check if the inserted material (provided by the final
%optional argument of commands like \cs{gls}) starts with a hyphen.
%If it does, the insert is added to the parenthetical material. 
%Note that commands like \cs{glsxtrlong} set \cs{glsinsert} to empty 
%with the entire link-text stored in \cs{glscustomtext}.
%
%\begin{macro}{\glsxtrifhyphenstart}
%Checks if the argument starts with a hyphen. The argument may be
%\cs{glsinsert} so check for that and expand.
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newrobustcmd*{\glsxtrifhyphenstart}[3]{%
  \ifx\glsinsert#1\relax
   \expandafter\@glsxtrifhyphenstart#1\relax\relax
     \@end@glsxtrifhyphenstart{#2}{#3}%
  \else
   \@glsxtrifhyphenstart#1\relax\relax\@end@glsxtrifhyphenstart{#2}{#3}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtrifhyphenstart}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\def\@glsxtrifhyphenstart#1#2\@end@glsxtrifhyphenstart#3#4{%
  \ifx-#1\relax#3\else #4\fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrlonghyphenshort}
%\changes{1.17}{2017-08-09}{new}
%\begin{definition}
%\cs{glsxtrlonghyphenshort}\marg{label}\marg{long}\marg{short}\marg{insert}
%\end{definition}
%The \meta{long} and \meta{short} arguments may be the plural form.
%The \meta{long} argument may also be the first letter uppercase form.
%    \begin{macrocode}
\newcommand*{\glsxtrlonghyphenshort}[4]{%
%    \end{macrocode}
% Grouping is needed to localise the redefinitions.
%    \begin{macrocode}
 {%
%    \end{macrocode}
% If \meta{insert} starts with a hyphen, redefine \ics{glsxtrwordsep}
% to a hyphen. The inserted material is also inserted into the
% parenthetical part. (The inserted material is grouped as a
% precautionary measure.) No change is made to \cs{glsxtrwordsep} if
% \meta{insert} doesn't start with a hyphen.
%    \begin{macrocode}
   \glsxtrifhyphenstart{#4}{\def\glsxtrwordsep{-}}{}%
   \glsfirstlonghyphenfont{#2\ifglsxtrinsertinside{#4}\fi}%
   \ifglsxtrinsertinside\else{#4}\fi
   \glsxtrfullsep{#1}%
   \glsxtrparen{\glsfirstabbrvhyphenfont{#3\ifglsxtrinsertinside{#4}\fi}%
    \ifglsxtrinsertinside\else{#4}\fi}%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsabbrvhyphenfont}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\glsabbrvhyphenfont}{\glsabbrvdefaultfont}%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsfirstabbrvhyphenfont}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\glsfirstabbrvhyphenfont}{\glsabbrvhyphenfont}%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glslonghyphenfont}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\glslonghyphenfont}{\glslongdefaultfont}%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsfirstlonghyphenfont}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\glsfirstlonghyphenfont}{\glslonghyphenfont}%
%    \end{macrocode}
%\end{macro}
% The default short form suffix:
%\begin{macro}{\glsxtrhyphensuffix}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrhyphensuffix}{\glsxtrabbrvpluralsuffix}
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{long-hyphen-short-hyphen}
%\changes{1.17}{2017-08-09}{new}
%Designed for use with the \catattr{markwords} attribute.
%    \begin{macrocode}
\newabbreviationstyle{long-hyphen-short-hyphen}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongshortname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstlonghyphenfont{\the\glslongtok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvhyphenfont{\the\glsshorttok}}},%
    firstplural={\protect\glsfirstlonghyphenfont{\the\glslongpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvhyphenfont{\the\glsshortpltok}}},%
    plural={\protect\glsabbrvhyphenfont{\the\glsshortpltok}},%
    description={\protect\glslonghyphenfont{\the\glslongtok}}}%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \renewcommand*{\abbrvpluralsuffix}{\glsxtrhyphensuffix}%
  \renewcommand*{\glsabbrvfont}[1]{\glsabbrvhyphenfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvhyphenfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlonghyphenfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslonghyphenfont{##1}}%
%    \end{macrocode}
% The first use full form and the inline full form are the same for
% this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsxtrlonghyphenshort{##1}{\glsaccesslong{##1}}{\glsaccessshort{##1}}{##2}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsxtrlonghyphenshort{##1}{\glsaccesslongpl{##1}}%
     {\glsaccessshortpl{##1}}{##2}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsxtrlonghyphenshort{##1}{\Glsaccesslong{##1}}{\glsaccessshort{##1}}{##2}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsxtrlonghyphenshort{##1}{\Glsaccesslongpl{##1}}%
     {\glsaccessshortpl{##1}}{##2}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-hyphen-short-hyphen-desc}
%\changes{1.17}{2017-08-09}{new}
%Like \abbrstyle{long-hyphen-short-hyphen} but the description
%must be supplied by the user.
%    \begin{macrocode}
\newabbreviationstyle{long-hyphen-short-hyphen-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongshortdescname},
    sort={\glsxtrlongshortdescsort},
    first={\protect\glsfirstlonghyphenfont{\the\glslongtok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvhyphenfont{\the\glsshorttok}}},%
    firstplural={\protect\glsfirstlonghyphenfont{\the\glslongpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstabbrvhyphenfont{\the\glsshortpltok}}},%
    text={\protect\glsabbrvhyphenfont{\the\glsshorttok}},%
    plural={\protect\glsabbrvhyphenfont{\the\glsshortpltok}}%
  }%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{long-hyphen-short-hyphen}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{macro}{\glsxtrlonghyphennoshort}
%\changes{1.17}{2017-08-09}{new}
%\begin{definition}
%\cs{glsxtrlonghyphennoshort}\marg{label}\marg{long}\marg{insert}
%\end{definition}
%    \begin{macrocode}
\newcommand*{\glsxtrlonghyphennoshort}[3]{%
%    \end{macrocode}
% Grouping is needed to localise the redefinitions.
%    \begin{macrocode}
 {%
%    \end{macrocode}
% If \meta{insert} starts with a hyphen, redefine \ics{glsxtrwordsep}
% to a hyphen. The inserted material is also inserted into the
% parenthetical part. (The inserted material is grouped as a
% precautionary measure.) No change is made to \cs{glsxtrwordsep} if
% \meta{insert} doesn't start with a hyphen.
%    \begin{macrocode}
   \glsxtrifhyphenstart{#3}{\def\glsxtrwordsep{-}}{}%
   \glsfirstlonghyphenfont{#2\ifglsxtrinsertinside{#3}\fi}%
   \ifglsxtrinsertinside\else{#3}\fi
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{long-hyphen-noshort-desc-noreg}
%\changes{1.17}{2017-08-09}{new}
%This version doesn't show the short form (except
%explicitly with \cs{glsxtrshort}). Since \cs{glsxtrshort} doesn't
%support the hyphen switch, the short form just uses the default
%short-form font command. This style won't work with the 
%\catattr{regular} as the regular form isn't flexible enough.
%    \begin{macrocode}
\newabbreviationstyle{long-hyphen-noshort-desc-noreg}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongnoshortdescname},
    sort={\expandonce\glsxtrorglong},
    first={\protect\glsfirstlonghyphenfont{\the\glslongtok}},%
    firstplural={\protect\glsfirstlonghyphenfont{\the\glslongpltok}},%
    plural={\protect\glslonghyphenfont{\the\glslongpltok}}%
  }%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{long-hyphen-short-hyphen}%
%    \end{macrocode}
% In case the user wants to mix and match font styles, these are
% redefined here.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}%
  \renewcommand*\glsabbrvfont[1]{\glsabbrvdefaultfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlonghyphenfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslonghyphenfont{##1}}%
%    \end{macrocode}
% The format for subsequent use (not used when the regular attribute
% is set).
%    \begin{macrocode}
  \renewcommand*{\glsxtrsubsequentfmt}[2]{%
    \glsxtrlonghyphennoshort{##1}{\glsaccesslong{##1}}{##2}%
  }%
  \renewcommand*{\glsxtrsubsequentplfmt}[2]{%
    \glsxtrlonghyphennoshort{##1}{\glsaccesslongpl{##1}}{##2}%
  }%
  \renewcommand*{\Glsxtrsubsequentfmt}[2]{%
    \glsxtrlonghyphennoshort{##1}{\Glsaccesslong{##1}}{##2}%
  }%
  \renewcommand*{\Glsxtrsubsequentplfmt}[2]{%
    \glsxtrlonghyphennoshort{##1}{\Glsaccesslongpl{##1}}{##2}%
  }%
%    \end{macrocode}
% The inline full form displays the long format followed by the
% short form in parentheses.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsxtrlonghyphennoshort{##1}{\glsaccesslong{##1}}{##2}%
    \glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsxtrlonghyphennoshort{##1}{\glsaccesslongpl{##1}}{##2}%
    \glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsxtrlonghyphennoshort{##1}{\Glsaccesslong{##1}}{##2}%
    \glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsxtrlonghyphennoshort{##1}{\Glsaccesslongpl{##1}}{##2}%
    \glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshortpl{##1}}}%
  }%
%    \end{macrocode}
% The first use full form only displays the long form.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsxtrlonghyphennoshort{##1}{\glsaccesslong{##1}}{##2}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsxtrlonghyphennoshort{##1}{\glsaccesslongpl{##1}}{##2}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsxtrlonghyphennoshort{##1}{\Glsaccesslong{##1}}{##2}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsxtrlonghyphennoshort{##1}{\Glsaccesslongpl{##1}}{##2}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-hyphen-noshort-noreg}
% It doesn't really make a great deal of sense to have a long-only
% style that doesn't have a description (unless no glossary is
% required), but the best course of
% action here is to use the short form as the name and the long
% form as the description.
%    \begin{macrocode}
\newabbreviationstyle{long-hyphen-noshort-noreg}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongnoshortname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstlonghyphenfont{\the\glslongtok}},%
    firstplural={\protect\glsfirstlonghyphenfont{\the\glslongpltok}},%
    text={\protect\glslonghyphenfont{\the\glslongtok}},%
    plural={\protect\glslonghyphenfont{\the\glslongpltok}},%
    description={\the\glslongtok}%
  }%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{long-desc}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{macro}{\glsxtrlonghyphen}
%\changes{1.17}{2017-08-09}{new}
%\begin{definition}
%\cs{glsxtrlonghyphen}\marg{long}\marg{label}\marg{insert}
%\end{definition}
%Used by \abbrstyle{long-hyphen-postshort-hyphen}. The \meta{insert}
%is check to determine if it starts with a hyphen but isn't used
%here as it's moved to the post-link hook.
%    \begin{macrocode}
\newcommand*{\glsxtrlonghyphen}[3]{%
%    \end{macrocode}
% Grouping is needed to localise the redefinitions.
%    \begin{macrocode}
 {%
   \glsxtrifhyphenstart{#3}{\def\glsxtrwordsep{-}}{}%
   \glsfirstlonghyphenfont{#1}%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrposthyphenshort}
%\changes{1.17}{2017-08-09}{new}
%\begin{definition}
%\cs{glsxtrposthyphenshort}\marg{label}\marg{insert}
%\end{definition}
%Used in the post-link hook for the
%\abbrstyle{long-hyphen-postshort-hyphen} style. Much like
%\cs{glsxtrlonghyphenshort} but omits the \meta{long} part. This
%always uses the singular short form.
%    \begin{macrocode}
\newcommand*{\glsxtrposthyphenshort}[2]{%
 {%
   \glsxtrifhyphenstart{#2}{\def\glsxtrwordsep{-}}{}%
   \ifglsxtrinsertinside{\glsfirstlonghyphenfont{#2}}\else{#2}\fi
   \glsxtrfullsep{#1}%
   \glsxtrparen
   {\glsfirstabbrvhyphenfont{\glsentryshort{#1}\ifglsxtrinsertinside{#2}\fi}%
    \ifglsxtrinsertinside\else{#2}\fi
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrposthyphensubsequent}
%\changes{1.17}{2017-08-09}{new}
%\begin{definition}
%\cs{glsxtrposthyphensubsequent}\marg{label}\marg{insert}
%\end{definition}
%Format in the post-link hook for subsequent use. The label is
%ignored by default.
%    \begin{macrocode}
\newcommand*{\glsxtrposthyphensubsequent}[2]{%
  \glsabbrvfont{\ifglsxtrinsertinside {#2}\fi}%
  \ifglsxtrinsertinside \else{#2}\fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{long-hyphen-postshort-hyphen}
%\changes{1.17}{2017-08-09}{new}
%Like \abbrstyle{long-hyphen-short-hyphen} but shifts the insert
%and parenthetical material to the post-link hook.
%    \begin{macrocode}
\newabbreviationstyle{long-hyphen-postshort-hyphen}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongshortname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstlonghyphenfont{\the\glslongtok}},%
    firstplural={\protect\glsfirstlonghyphenfont{\the\glslongpltok}},%
    plural={\protect\glsabbrvhyphenfont{\the\glsshortpltok}},%
    description={\protect\glslonghyphenfont{\the\glslongtok}}}%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \csdef{glsxtrpostlink\glscategorylabel}{%
      \glsxtrifwasfirstuse
      {%
        \glsxtrposthyphenshort{\glslabel}{\glsinsert}%
      }%
      {%
%    \end{macrocode}
% Put the insertion into the post-link:
%    \begin{macrocode}
        \glsxtrposthyphensubsequent{\glslabel}{\glsinsert}%
      }%
    }%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
%    \end{macrocode}
% In case the user wants to mix and match font styles, these are
% redefined here.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}%
  \renewcommand*{\glsabbrvfont}[1]{\glsabbrvhyphenfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvhyphenfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlonghyphenfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslonghyphenfont{##1}}%
%    \end{macrocode}
% Subsequent use needs to omit the insertion:
%    \begin{macrocode}
  \renewcommand*{\glsxtrsubsequentfmt}[2]{%
    \glsabbrvfont{\glsaccessshort{##1}}%
  }%
  \renewcommand*{\glsxtrsubsequentplfmt}[2]{%
    \glsabbrvfont{\glsaccessshortpl{##1}}%
  }%
  \renewcommand*{\Glsxtrsubsequentfmt}[2]{%
    \glsabbrvfont{\Glsaccessshort{##1}}%
  }%
  \renewcommand*{\Glsxtrsubsequentplfmt}[2]{%
    \glsabbrvfont{\Glsaccessshortpl{##1}}%
  }%
%    \end{macrocode}
% First use full form:
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsxtrlonghyphen{\glsaccesslong{##1}}{##1}{##2}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsxtrlonghyphen{\glsaccesslongpl{##1}}{##1}{##2}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsxtrlonghyphen{\Glsaccesslong{##1}}{##1}{##2}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsxtrlonghyphen{\Glsaccesslongpl{##1}}{##1}{##2}%
  }%
%    \end{macrocode}
% In-line format.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstlonghyphenfont{\glsaccesslong{##1}%
      \ifglsxtrinsertinside{##2}\fi}%
    \ifglsxtrinsertinside \else{##2}\fi
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstlonghyphenfont{\glsaccesslongpl{##1}%
      \ifglsxtrinsertinside{##2}\fi}%
    \ifglsxtrinsertinside \else{##2}\fi
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstlonghyphenfont{\Glsaccesslong{##1}%
      \ifglsxtrinsertinside{##2}\fi}%
    \ifglsxtrinsertinside \else{##2}\fi
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstlonghyphenfont{\Glsaccesslongpl{##1}%
      \ifglsxtrinsertinside{##2}\fi}%
    \ifglsxtrinsertinside \else{##2}\fi
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{long-hyphen-postshort-hyphen-desc}
%\changes{1.17}{2017-08-09}{new}
%Like \abbrstyle{long-hyphen-postshort-hyphen} but the description
%must be supplied by the user.
%    \begin{macrocode}
\newabbreviationstyle{long-hyphen-postshort-hyphen-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrlongshortdescname},
    sort={\glsxtrlongshortdescsort},%
    first={\protect\glsfirstlonghyphenfont{\the\glslongtok}},%
    firstplural={\protect\glsfirstlonghyphenfont{\the\glslongpltok}},%
    text={\protect\glsabbrvhyphenfont{\the\glsshorttok}},%
    plural={\protect\glsabbrvhyphenfont{\the\glsshortpltok}}%
  }%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \csdef{glsxtrpostlink\glscategorylabel}{%
      \glsxtrifwasfirstuse
      {%
        \glsxtrposthyphenshort{\glslabel}{\glsinsert}%
      }%
      {%
%    \end{macrocode}
% Put the insertion into the post-link:
%    \begin{macrocode}
        \glsxtrposthyphensubsequent{\glslabel}{\glsinsert}%
      }%
    }%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{long-hyphen-postshort-hyphen}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{macro}{\glsxtrshorthyphenlong}
%\changes{1.17}{2017-08-09}{new}
%\begin{definition}
%\cs{glsxtrshorthyphenlong}\marg{label}\marg{short}\marg{long}\marg{insert}
%\end{definition}
%The \meta{long} and \meta{short} arguments may be the plural form.
%The \meta{long} argument may also be the first letter uppercase form.
%    \begin{macrocode}
\newcommand*{\glsxtrshorthyphenlong}[4]{%
%    \end{macrocode}
% Grouping is needed to localise the redefinitions.
%    \begin{macrocode}
 {%
%    \end{macrocode}
% If \meta{insert} starts with a hyphen, redefine \cs{glsxtrwordsep}
% to a hyphen. The inserted material is also inserted into the
% parenthetical part. (The inserted material is grouped as a
% precautionary measure.)
%    \begin{macrocode}
   \glsxtrifhyphenstart{#4}{\def\glsxtrwordsep{-}}{}%
   \glsfirstabbrvhyphenfont{#2\ifglsxtrinsertinside{#4}\fi}%
   \ifglsxtrinsertinside\else{#4}\fi
   \glsxtrfullsep{#1}%
   \glsxtrparen{\glsfirstlonghyphenfont{#3\ifglsxtrinsertinside{#4}\fi}%
    \ifglsxtrinsertinside\else{#4}\fi}%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{short-hyphen-long-hyphen}
%\changes{1.17}{2017-08-09}{new}
%Designed for use with the \catattr{markwords} attribute.
%    \begin{macrocode}
\newabbreviationstyle{short-hyphen-long-hyphen}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortlongname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstabbrvhyphenfont{\the\glsshorttok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlonghyphenfont{\the\glslongtok}}},%
    firstplural={\protect\glsfirstabbrvhyphenfont{\the\glsshortpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlonghyphenfont{\the\glslongpltok}}},%
    plural={\protect\glsabbrvhyphenfont{\the\glsshortpltok}},%
    description={\protect\glslonghyphenfont{\the\glslongtok}}}%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \renewcommand*{\abbrvpluralsuffix}{\glsxtrhyphensuffix}%
  \renewcommand*{\glsabbrvfont}[1]{\glsabbrvhyphenfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvhyphenfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlonghyphenfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslonghyphenfont{##1}}%
%    \end{macrocode}
% The first use full form and the inline full form are the same for
% this style.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsxtrshorthyphenlong{##1}{\glsaccessshort{##1}}{\glsaccesslong{##1}}{##2}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsxtrshorthyphenlong{##1}%
     {\glsaccessshortpl{##1}}{\glsaccesslongpl{##1}}{##2}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsxtrshorthyphenlong{##1}{\glsaccessshort{##1}}{\Glsaccesslong{##1}}{##2}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsxtrshorthyphenlong{##1}%
     {\glsaccessshortpl{##1}}{\Glsaccesslongpl{##1}}{##2}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-hyphen-long-hyphen-desc}
%\changes{1.17}{2017-08-09}{new}
%Like \abbrstyle{short-hyphen-long-hyphen} but the description
%must be supplied by the user.
%    \begin{macrocode}
\newabbreviationstyle{short-hyphen-long-hyphen-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortlongdescname},
    sort={\glsxtrshortlongdescsort},
    first={\protect\glsfirstabbrvhyphenfont{\the\glsshorttok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlonghyphenfont{\the\glslongtok}}},%
    firstplural={\protect\glsfirstabbrvhyphenfont{\the\glsshortpltok}%
     \protect\glsxtrfullsep{\the\glslabeltok}%
     \glsxtrparen{\protect\glsfirstlonghyphenfont{\the\glslongpltok}}},%
    text={\protect\glsabbrvhyphenfont{\the\glsshorttok}},%
    plural={\protect\glsabbrvhyphenfont{\the\glsshortpltok}}%
  }%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{short-hyphen-long-hyphen}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{macro}{\glsxtrshorthyphen}
%\changes{1.17}{2017-08-09}{new}
%\begin{definition}
%\cs{glsxtrshorthyphen}\marg{short}\marg{label}\marg{insert}
%\end{definition}
%Used by \abbrstyle{short-hyphen-postlong-hyphen}. The \meta{insert}
%is check to determine if it starts with a hyphen but isn't used
%here as it's moved to the post-link hook.
%    \begin{macrocode}
\newcommand*{\glsxtrshorthyphen}[3]{%
%    \end{macrocode}
% Grouping is needed to localise the redefinitions.
%    \begin{macrocode}
 {%
   \glsxtrifhyphenstart{#3}{\def\glsxtrwordsep{-}}{}%
   \glsfirstabbrvhyphenfont{#1}%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrposthyphenlong}
%\changes{1.17}{2017-08-09}{new}
%\begin{definition}
%\cs{glsxtrposthyphenlong}\marg{label}\marg{insert}
%\end{definition}
%Used in the post-link hook for the
%\abbrstyle{short-hyphen-postlong-hyphen} style. Much like
%\cs{glsxtrshorthyphenlong} but omits the \meta{short} part. This
%always uses the singular long form.
%    \begin{macrocode}
\newcommand*{\glsxtrposthyphenlong}[2]{%
 {%
   \glsxtrifhyphenstart{#2}{\def\glsxtrwordsep{-}}{}%
   \ifglsxtrinsertinside{\glsfirstabbrvhyphenfont{#2}}\else{#2}\fi
   \glsxtrfullsep{#1}%
   \glsxtrparen
   {\glsfirstlonghyphenfont{\glsentrylong{#1}\ifglsxtrinsertinside{#2}\fi}%
    \ifglsxtrinsertinside\else{#2}\fi
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{short-hyphen-postlong-hyphen}
%\changes{1.17}{2017-08-09}{new}
%Like \abbrstyle{short-hyphen-long-hyphen} but shifts the insert
%and parenthetical material to the post-link hook.
%    \begin{macrocode}
\newabbreviationstyle{short-hyphen-postlong-hyphen}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortlongname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstabbrvhyphenfont{\the\glsshorttok}},%
    firstplural={\protect\glsfirstabbrvhyphenfont{\the\glsshortpltok}},%
    plural={\protect\glsabbrvhyphenfont{\the\glsshortpltok}},%
    description={\protect\glslonghyphenfont{\the\glslongtok}}}%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \csdef{glsxtrpostlink\glscategorylabel}{%
      \glsxtrifwasfirstuse
      {%
        \glsxtrposthyphenlong{\glslabel}{\glsinsert}%
      }%
      {%
%    \end{macrocode}
% Put the insertion into the post-link:
%    \begin{macrocode}
        \glsxtrposthyphensubsequent{\glslabel}{\glsinsert}%
      }%
    }%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
%    \end{macrocode}
% In case the user wants to mix and match font styles, these are
% redefined here.
%    \begin{macrocode}
  \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}%
  \renewcommand*{\glsabbrvfont}[1]{\glsabbrvhyphenfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvhyphenfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlonghyphenfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslonghyphenfont{##1}}%
%    \end{macrocode}
% Subsequent use needs to omit the insertion:
%    \begin{macrocode}
  \renewcommand*{\glsxtrsubsequentfmt}[2]{%
    \glsabbrvfont{\glsaccessshort{##1}}%
  }%
  \renewcommand*{\glsxtrsubsequentplfmt}[2]{%
    \glsabbrvfont{\glsaccessshortpl{##1}}%
  }%
  \renewcommand*{\Glsxtrsubsequentfmt}[2]{%
    \glsabbrvfont{\Glsaccessshort{##1}}%
  }%
  \renewcommand*{\Glsxtrsubsequentplfmt}[2]{%
    \glsabbrvfont{\Glsaccessshortpl{##1}}%
  }%
%    \end{macrocode}
% First use full form:
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsxtrshorthyphen{\glsaccessshort{##1}}{##1}{##2}%
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsxtrshorthyphen{\glsaccessshortpl{##1}}{##1}{##2}%
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsxtrshorthyphen{\Glsaccessshort{##1}}{##1}{##2}%
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsxtrshorthyphen{\Glsaccessshortpl{##1}}{##1}{##2}%
  }%
%    \end{macrocode}
% In-line format. Commands like \cs{glsxtrfull} set \cs{glsinsert}
% to empty. The entire link-text (provided by the following
% commands) is stored in \cs{glscustomtext}.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvhyphenfont{\glsaccessshort{##1}%
      \ifglsxtrinsertinside{##2}\fi}%
    \ifglsxtrinsertinside \else{##2}\fi
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvhyphenfont{\glsaccessshortpl{##1}%
      \ifglsxtrinsertinside{##2}\fi}%
    \ifglsxtrinsertinside \else{##2}\fi
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstabbrvhyphenfont{\Glsaccessshort{##1}%
      \ifglsxtrinsertinside{##2}\fi}%
    \ifglsxtrinsertinside \else{##2}\fi
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstabbrvhyphenfont{\Glsaccessshortpl{##1}%
      \ifglsxtrinsertinside{##2}\fi}%
    \ifglsxtrinsertinside \else{##2}\fi
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{abbrvstyle}{short-hyphen-postlong-hyphen-desc}
%\changes{1.17}{2017-08-09}{new}
%Like \abbrstyle{short-hyphen-postlong-hyphen} but the description
%must be supplied by the user.
%    \begin{macrocode}
\newabbreviationstyle{short-hyphen-postlong-hyphen-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtrshortlongdescname},
    sort={\glsxtrshortlongdescsort},%
    first={\protect\glsfirstabbrvhyphenfont{\the\glsshorttok}},%
    firstplural={\protect\glsfirstabbrvhyphenfont{\the\glsshortpltok}},%
    text={\protect\glsabbrvhyphenfont{\the\glsshorttok}},%
    plural={\protect\glsabbrvhyphenfont{\the\glsshortpltok}}%
  }%
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \csdef{glsxtrpostlink\glscategorylabel}{%
      \glsxtrifwasfirstuse
      {%
        \glsxtrposthyphenlong{\glslabel}{\glsinsert}%
      }%
      {%
%    \end{macrocode}
% Put the insertion into the post-link:
%    \begin{macrocode}
        \glsxtrposthyphensubsequent{\glslabel}{\glsinsert}%
      }%
    }%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{short-hyphen-postlong-hyphen}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\subsection{Predefined Styles (No Short on First Use)}
%These styles show only the long form on first use and only the
%short form on subsequent use.
%\begin{macro}{\glsabbrvonlyfont}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\glsabbrvonlyfont}{\glsabbrvdefaultfont}%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsfirstabbrvonlyfont}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\glsfirstabbrvonlyfont}{\glsabbrvonlyfont}%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glslongonlyfont}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\glslongonlyfont}{\glslongdefaultfont}%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsfirstlongonlyfont}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\glsfirstlongonlyfont}{\glslongonlyfont}%
%    \end{macrocode}
%\end{macro}
% The default short form suffix:
%\begin{macro}{\glsxtronlysuffix}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\glsxtronlysuffix}{\glsxtrabbrvpluralsuffix}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtronlyname}
%\changes{1.25}{2017-11-24}{new}
% The default name format for this style.
%    \begin{macrocode}
\newcommand*{\glsxtronlyname}{%
  \protect\glsabbrvonlyfont{\the\glsshorttok}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{long-only-short-only}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newabbreviationstyle{long-only-short-only}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtronlyname},
    sort={\the\glsshorttok},
    first={\protect\glsfirstlongonlyfont{\the\glslongtok}},%
    firstplural={\protect\glsfirstlongonlyfont{\the\glslongpltok}},%
    plural={\protect\glsabbrvonlyfont{\the\glsshortpltok}},%
    description={\protect\glslongonlyfont{\the\glslongtok}}}%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtronlysuffix}%
  \renewcommand*{\glsabbrvfont}[1]{\glsabbrvonlyfont{##1}}%
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvonlyfont{##1}}%
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongonlyfont{##1}}%
  \renewcommand*{\glslongfont}[1]{\glslongonlyfont{##1}}%
%    \end{macrocode}
% The first use full form doesn't show the short form.
%    \begin{macrocode}
  \renewcommand*{\glsxtrfullformat}[2]{%
    \glsfirstlongonlyfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\glsxtrfullplformat}[2]{%
    \glsfirstlongonlyfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullformat}[2]{%
    \glsfirstlongonlyfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
  \renewcommand*{\Glsxtrfullplformat}[2]{%
    \glsfirstlongonlyfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
  }%
%    \end{macrocode}
% The inline full form does show the short form.
%    \begin{macrocode}
  \renewcommand*{\glsxtrinlinefullformat}[2]{%
    \glsfirstlongonlyfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvonlyfont{\glsaccessshort{##1}}}%
  }%
  \renewcommand*{\glsxtrinlinefullplformat}[2]{%
    \glsfirstlongonlyfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvonlyfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullformat}[2]{%
    \glsfirstlongonlyfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvonlyfont{\glsaccessshortpl{##1}}}%
  }%
  \renewcommand*{\Glsxtrinlinefullplformat}[2]{%
    \glsfirstlongonlyfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}%
    \ifglsxtrinsertinside\else##2\fi
    \glsxtrfullsep{##1}%
    \glsxtrparen{\protect\glsfirstabbrvonlyfont{\Glsaccessshortpl{##1}}}%
  }%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\begin{macro}{\glsxtronlydescsort}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\glsxtronlydescsort}{\the\glslongtok}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtronlydescname}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newcommand*{\glsxtronlydescname}{%
  \protect\glslongfont{\the\glslongtok}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{abbrvstyle}{long-only-short-only-desc}
%\changes{1.17}{2017-08-09}{new}
%    \begin{macrocode}
\newabbreviationstyle{long-only-short-only-desc}%
{%
  \renewcommand*{\CustomAbbreviationFields}{%
    name={\glsxtronlydescname},
    sort={\glsxtronlydescsort},%
    first={\protect\glsfirstlongonlyfont{\the\glslongtok}},%
    firstplural={\protect\glsfirstlongonlyfont{\the\glslongpltok}},%
    text={\protect\glsabbrvonlyfont{\the\glsshorttok}},%
    plural={\protect\glsabbrvonlyfont{\the\glsshortpltok}}%
  }%
%    \end{macrocode}
% Unset the \catattr{regular} attribute if it has been set.
%    \begin{macrocode}
  \renewcommand*{\GlsXtrPostNewAbbreviation}{%
    \glshasattribute{\the\glslabeltok}{regular}%
    {%
      \glssetattribute{\the\glslabeltok}{regular}{false}%
    }%
    {}%
  }%
}%
{%
  \GlsXtrUseAbbrStyleFmts{long-only-short-only}%
}
%    \end{macrocode}
%\end{abbrvstyle}
%
%\section{Using Entries in Headings}
%
% There are four main problems with using entries in sectioning
% commands: they can mess with the first use flag if they end up in
% the table of contents, they can add unwanted numbers to the
% entry's location list, the label is corrupted if used inside
% \ics{MakeUppercase} (which is used by the default headings style)
% and they need to be expandable for PDF bookmarks. The
% \styfmt{glossaries} package therefore recommends the use of the
% expandable commands, such as \cs{glsentryshort}, instead but this
% doesn't reflect the formatting since it doesn't include
% \cs{glsabbrvfont}. The commands below are an attempt to get around
% these problems.
%
% The PDF bookmark issue can easily be fixed with \sty{hyperref}'s
% \cs{texorpdfstring} which can simply use the expandable command
% in the PDF string case. The \TeX\ string case can now use
% \cs{glsxtrshort} with the \gloskey[glslink]{noindex} key set, which
% prevents the unwanted additions to the location list, and the
% \gloskey[glslink]{hyper} key set to false, which prevents the problem of
% nested links. This just leaves one thing left that needs to be
% dealt with, and that's what to do if the heading style 
% uses \cs{MakeUppercase}.
%
% Note that \styfmt{glossaries} automatically loads \sty{textcase}, so
% the label can be protected from case change with \sty{textcase}'s
% \cs{NoCaseChange}. This means that we don't have a problem
% provided the page style uses \cs{MakeTextUppercase}, but the
% default heading page style uses \cs{MakeUppercase}.
%
% To get around this, save the original definition of \cs{markboth}
% and \cs{markright} and adjust it so that \cs{MakeUppercase} is
% temporarily redefined to \cs{MakeTextUppercase}. Some packages or
% classes redefine these commands, so we can't just assume they
% still have the original kernel definition.
%
%\begin{macro}{\markright}
% Save original definition:
%    \begin{macrocode}
\let\@glsxtr@org@markright\markright
%    \end{macrocode}
% Redefine (grouping not added in case it interferes with the
% original code):
%    \begin{macrocode}
\renewcommand*{\markright}[1]{%
 \glsxtrmarkhook
 \@glsxtr@org@markright{\@glsxtrinmark#1\@glsxtrnotinmark}%
 \glsxtrrestoremarkhook
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\markboth}
% Save original definition:
%    \begin{macrocode}
\let\@glsxtr@org@markboth\markboth
%    \end{macrocode}
% Redefine (grouping not added in case it interferes with the
% original code):
%    \begin{macrocode}
\renewcommand*{\markboth}[2]{%
 \glsxtrmarkhook
 \@glsxtr@org@markboth
   {\@glsxtrinmark#1\@glsxtrnotinmark}%
   {\@glsxtrinmark#2\@glsxtrnotinmark}%
 \glsxtrrestoremarkhook
}
%    \end{macrocode}
%\end{macro}
%
%Also do this for \cs{@starttoc}
%\begin{macro}{\@starttoc}
% Save original definition:
%    \begin{macrocode}
\let\@glsxtr@org@@starttoc\@starttoc
%    \end{macrocode}
% Redefine:
%    \begin{macrocode}
\renewcommand*{\@starttoc}[1]{%
 \glsxtrmarkhook
 \@glsxtrinmark
 \@glsxtr@org@@starttoc{#1}%
 \@glsxtrnotinmark
 \glsxtrrestoremarkhook
}
%    \end{macrocode}
%\end{macro}
%
% If this causes a problem provide a simple way of switching back to
% the original definitions:
%\begin{macro}{\glsxtrRevertMarks}
%    \begin{macrocode}
\newcommand*{\glsxtrRevertMarks}{%
  \let\markright\@glsxtr@org@markright
  \let\markboth\@glsxtr@org@markboth
  \let\@starttoc\@glsxtr@org@@starttoc
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrRevertTocMarks}
%\changes{1.31}{2018-05-09}{new}
%Just restores \cs{@starttoc}.
%    \begin{macrocode}
\newcommand*{\glsxtrRevertTocMarks}{%
  \let\@starttoc\@glsxtr@org@@starttoc
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrifinmark}
%\changes{1.07}{2016-08-15}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrifinmark}[2]{#2}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtrinmark}
%\changes{1.07}{2016-08-15}{new}
%    \begin{macrocode}
\newrobustcmd*{\@glsxtrinmark}{%
  \let\glsxtrifinmark\@firstoftwo
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtrnotinmark}
%\changes{1.07}{2016-08-15}{new}
%    \begin{macrocode}
\newrobustcmd*{\@glsxtrnotinmark}{%
  \let\glsxtrifinmark\@secondoftwo
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrtitleorpdforheading}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\glsxtrtitleorpdforheading}[3]{\texorpdfstring{#1}{#2}}
}
{
  \newcommand*{\glsxtrtitleorpdforheading}[3]{#1}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrmarkhook}
% Hook used in new definition of \cs{markboth} and \cs{markright}
% to make some changes to apply to the marks:
%    \begin{macrocode}
\newcommand*{\glsxtrmarkhook}{%
%    \end{macrocode}
% Save current definitions:
%    \begin{macrocode}
  \let\@glsxtr@org@MakeUppercase\MakeUppercase
  \let\@glsxtr@org@glsxtrtitleorpdforheading\glsxtrtitleorpdforheading
  \let\@glsxtr@org@glsxtrtitleshort\glsxtrtitleshort
  \let\@glsxtr@org@glsxtrtitleshortpl\glsxtrtitleshortpl
  \let\@glsxtr@org@Glsxtrtitleshort\Glsxtrtitleshort
  \let\@glsxtr@org@Glsxtrtitleshortpl\Glsxtrtitleshortpl
  \let\@glsxtr@org@glsxtrtitlename\glsxtrtitlename
  \let\@glsxtr@org@Glsxtrtitlename\Glsxtrtitlename
  \let\@glsxtr@org@glsxtrtitletext\glsxtrtitletext
  \let\@glsxtr@org@Glsxtrtitletext\Glsxtrtitletext
  \let\@glsxtr@org@glsxtrtitleplural\glsxtrtitleplural
  \let\@glsxtr@org@Glsxtrtitleplural\Glsxtrtitleplural
  \let\@glsxtr@org@glsxtrtitlefirst\glsxtrtitlefirst
  \let\@glsxtr@org@Glsxtrtitlefirst\Glsxtrtitlefirst
  \let\@glsxtr@org@glsxtrtitlefirstplural\glsxtrtitlefirstplural
  \let\@glsxtr@org@Glsxtrtitlefirstplural\Glsxtrtitlefirstplural
  \let\@glsxtr@org@glsxtrtitlelong\glsxtrtitlelong
  \let\@glsxtr@org@glsxtrtitlelongpl\glsxtrtitlelongpl
  \let\@glsxtr@org@Glsxtrtitlelong\Glsxtrtitlelong
  \let\@glsxtr@org@Glsxtrtitlelongpl\Glsxtrtitlelongpl
  \let\@glsxtr@org@glsxtrtitlefull\glsxtrtitlefull
  \let\@glsxtr@org@glsxtrtitlefullpl\glsxtrtitlefullpl
  \let\@glsxtr@org@Glsxtrtitlefull\Glsxtrtitlefull
  \let\@glsxtr@org@Glsxtrtitlefullpl\Glsxtrtitlefullpl
%    \end{macrocode}
% New definitions
%    \begin{macrocode}
  \let\glsxtrifinmark\@firstoftwo
  \let\MakeUppercase\MakeTextUppercase
  \let\glsxtrtitleorpdforheading\@thirdofthree
  \let\glsxtrtitleshort\glsxtrheadshort
  \let\glsxtrtitleshortpl\glsxtrheadshortpl
  \let\Glsxtrtitleshort\Glsxtrheadshort
  \let\Glsxtrtitleshortpl\Glsxtrheadshortpl
  \let\glsxtrtitlename\glsxtrheadname
  \let\Glsxtrtitlename\Glsxtrheadname
  \let\glsxtrtitletext\glsxtrheadtext
  \let\Glsxtrtitletext\Glsxtrheadtext
  \let\glsxtrtitleplural\glsxtrheadplural
  \let\Glsxtrtitleplural\Glsxtrheadplural
  \let\glsxtrtitlefirst\glsxtrheadfirst
  \let\Glsxtrtitlefirst\Glsxtrheadfirst
  \let\glsxtrtitlefirstplural\glsxtrheadfirstplural
  \let\Glsxtrtitlefirstplural\Glsxtrheadfirstplural
  \let\glsxtrtitlelong\glsxtrheadlong
  \let\glsxtrtitlelongpl\glsxtrheadlongpl
  \let\Glsxtrtitlelong\Glsxtrheadlong
  \let\Glsxtrtitlelongpl\Glsxtrheadlongpl
  \let\glsxtrtitlefull\glsxtrheadfull
  \let\glsxtrtitlefullpl\glsxtrheadfullpl
  \let\Glsxtrtitlefull\Glsxtrheadfull
  \let\Glsxtrtitlefullpl\Glsxtrheadfullpl
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrrestoremarkhook}
% Hook used in new definition of \cs{markboth} and \cs{markright}
% to restore the modified definitions. (This is in case the original
% \cs{markboth} and \cs{markright} shouldn't be grouped for some
% reason. There already is some grouping within those original
% definitions, but some of the code lies outside that grouping, and
% possibly there's a reason for it.)
%    \begin{macrocode}
\newcommand*{\glsxtrrestoremarkhook}{%
  \let\glsxtrifinmark\@secondoftwo
  \let\MakeUppercase\@glsxtr@org@MakeUppercase
  \let\glsxtrtitleorpdforheading\@glsxtr@org@glsxtrtitleorpdforheading
  \let\glsxtrtitleshort\@glsxtr@org@glsxtrtitleshort
  \let\glsxtrtitleshortpl\@glsxtr@org@glsxtrtitleshortpl
  \let\Glsxtrtitleshort\@glsxtr@org@Glsxtrtitleshort
  \let\Glsxtrtitleshortpl\@glsxtr@org@Glsxtrtitleshortpl
  \let\glsxtrtitlename\@glsxtr@org@glsxtrtitlename
  \let\Glsxtrtitlename\@glsxtr@org@Glsxtrtitlename
  \let\glsxtrtitletext\@glsxtr@org@glsxtrtitletext
  \let\Glsxtrtitletext\@glsxtr@org@Glsxtrtitletext
  \let\glsxtrtitleplural\@glsxtr@org@glsxtrtitleplural
  \let\Glsxtrtitleplural\@glsxtr@org@Glsxtrtitleplural
  \let\glsxtrtitlefirst\@glsxtr@org@glsxtrtitlefirst
  \let\Glsxtrtitlefirst\@glsxtr@org@Glsxtrtitlefirst
  \let\glsxtrtitlefirstplural\@glsxtr@org@glsxtrtitlefirstplural
  \let\Glsxtrtitlefirstplural\@glsxtr@org@Glsxtrtitlefirstplural
  \let\glsxtrtitlelong\@glsxtr@org@glsxtrtitlelong
  \let\glsxtrtitlelongpl\@glsxtr@org@glsxtrtitlelongpl
  \let\Glsxtrtitlelong\@glsxtr@org@Glsxtrtitlelong
  \let\Glsxtrtitlelongpl\@glsxtr@org@Glsxtrtitlelongpl
  \let\glsxtrtitlefull\@glsxtr@org@glsxtrtitlefull
  \let\glsxtrtitlefullpl\@glsxtr@org@glsxtrtitlefullpl
  \let\Glsxtrtitlefull\@glsxtr@org@Glsxtrtitlefull
  \let\Glsxtrtitlefullpl\@glsxtr@org@Glsxtrtitlefullpl
}
%    \end{macrocode}
%\end{macro}
%
%\changes{0.5.1}{2015-12-07}{removed \cs{ifglsxtruseuchead}}
% Instead of using one document-wide conditional, use
% \catattr{headuc} attribute to determine whether or not to use the
% all upper case form.
%
%\begin{macro}{\glsxtrheadshort}
% Command used to display short form in the page header.
%\changes{0.5.1}{2015-12-07}{now uses headuc attribute}
%    \begin{macrocode}
\newcommand*{\glsxtrheadshort}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
     \GLSxtrshort[noindex,hyper=false]{#1}[]%
   }%
   {%
     \glsxtrshort[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrtitleshort}
% Command to display short form of abbreviation in section title and
% table of contents.
%    \begin{macrocode}
\newrobustcmd*{\glsxtrtitleshort}[1]{%
  \glsxtrshort[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrheadshortpl}
% Command used to display plural short form in the page header.
% If you want the text converted to upper case, this needs to be
% redefined to use \cs{GLSxtrshortpl} instead. If you are using a
% smallcaps style, the default fonts don't provide italic smallcaps.
%\changes{0.5.1}{2015-12-07}{now uses headuc attribute}
%    \begin{macrocode}
\newcommand*{\glsxtrheadshortpl}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
      \GLSxtrshortpl[noindex,hyper=false]{#1}[]%
   }%
   {%
      \glsxtrshortpl[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrtitleshortpl}
% Command to display plural short form of abbreviation in section title and
% table of contents.
%\changes{1.03}{2016-04-27}{bug fix: changed \cs{glsxtrshort} to
%\cs{glsxtrshortpl}}
%    \begin{macrocode}
\newrobustcmd*{\glsxtrtitleshortpl}[1]{%
  \glsxtrshortpl[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrheadshort}
% Command used to display short form in the page header with the
% first letter converted to upper case.
%\changes{0.5.1}{2015-12-07}{now uses headuc attribute}
%    \begin{macrocode}
\newcommand*{\Glsxtrheadshort}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
     \GLSxtrshort[noindex,hyper=false]{#1}[]%
   }%
   {%
     \Glsxtrshort[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrtitleshort}
% Command to display short form of abbreviation in section title and
% table of contents with the first letter converted to upper case.
%    \begin{macrocode}
\newrobustcmd*{\Glsxtrtitleshort}[1]{%
  \Glsxtrshort[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrheadshortpl}
% Command used to display plural short form in the page header with the
% first letter converted to upper case.
%\changes{0.5.1}{2015-12-07}{now uses headuc attribute}
%    \begin{macrocode}
\newcommand*{\Glsxtrheadshortpl}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
     \GLSxtrshortpl[noindex,hyper=false]{#1}[]%
   }%
   {%
     \Glsxtrshortpl[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrtitleshortpl}
% Command to display plural short form of abbreviation in section title and
% table of contents with the first letter converted to upper case.
%    \begin{macrocode}
\newrobustcmd*{\Glsxtrtitleshortpl}[1]{%
  \Glsxtrshortpl[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrheadname}
% As above but for the \gloskey{name} value.
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrheadname}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
     \GLSname[noindex,hyper=false]{#1}[]%
   }%
   {%
     \glsname[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrtitlename}
% Command to display \gloskey{name} value in section title and
% table of contents.
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newrobustcmd*{\glsxtrtitlename}[1]{%
  \glsname[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrheadname}
% First letter converted to upper case
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\Glsxtrheadname}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
     \GLSname[noindex,hyper=false]{#1}[]%
   }%
   {%
     \Glsname[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrtitlename}
% Command to display \gloskey{name} value in section title and
% table of contents with the first letter changed to upper case.
%    \begin{macrocode}
%\changes{1.21}{2017-11-03}{new}
\newrobustcmd*{\Glsxtrtitlename}[1]{%
  \Glsname[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrheadtext}
% As above but for the \gloskey{text} value.
%\changes{0.5.1}{2015-12-07}{now uses headuc attribute}
%    \begin{macrocode}
\newcommand*{\glsxtrheadtext}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
     \GLStext[noindex,hyper=false]{#1}[]%
   }%
   {%
     \glstext[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrtitletext}
% Command to display \gloskey{text} value in section title and
% table of contents.
%    \begin{macrocode}
\newrobustcmd*{\glsxtrtitletext}[1]{%
  \glstext[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{\Glsxtrheadtext}
% First letter converted to upper case
%\changes{0.5.1}{2015-12-07}{now uses headuc attribute}
%    \begin{macrocode}
\newcommand*{\Glsxtrheadtext}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
     \GLStext[noindex,hyper=false]{#1}[]%
   }%
   {%
     \Glstext[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrtitletext}
% Command to display \gloskey{text} value in section title and
% table of contents with the first letter changed to upper case.
%    \begin{macrocode}
\newrobustcmd*{\Glsxtrtitletext}[1]{%
  \Glstext[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrheadplural}
% As above but for the \gloskey{plural} value.
%\changes{0.5.1}{2015-12-07}{now uses headuc attribute}
%    \begin{macrocode}
\newcommand*{\glsxtrheadplural}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
     \GLSplural[noindex,hyper=false]{#1}[]%
   }%
   {%
     \glsplural[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrtitleplural}
% Command to display \gloskey{plural} value in section title and
% table of contents.
%    \begin{macrocode}
\newrobustcmd*{\glsxtrtitleplural}[1]{%
  \glsplural[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrheadplural}
% Convert first letter to upper case.
%\changes{0.5.1}{2015-12-07}{now uses headuc attribute}
%    \begin{macrocode}
\newcommand*{\Glsxtrheadplural}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
     \GLSplural[noindex,hyper=false]{#1}[]%
   }%
   {%
     \Glsplural[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrtitleplural}
% Command to display \gloskey{plural} value in section title and
% table of contents with the first letter changed to upper case.
%    \begin{macrocode}
\newrobustcmd*{\Glsxtrtitleplural}[1]{%
  \Glsplural[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrheadfirst}
% As above but for the \gloskey{first} value.
%\changes{0.5.1}{2015-12-07}{now uses headuc attribute}
%    \begin{macrocode}
\newcommand*{\glsxtrheadfirst}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
     \GLSfirst[noindex,hyper=false]{#1}[]%
   }%
   {%
     \glsfirst[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrtitlefirst}
% Command to display \gloskey{first} value in section title and
% table of contents.
%    \begin{macrocode}
\newrobustcmd*{\glsxtrtitlefirst}[1]{%
  \glsfirst[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrheadfirst}
% First letter converted to upper case
%\changes{0.5.1}{2015-12-07}{now uses headuc attribute}
%    \begin{macrocode}
\newcommand*{\Glsxtrheadfirst}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
     \GLSfirst[noindex,hyper=false]{#1}[]%
   }%
   {%
     \Glsfirst[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrtitlefirst}
% Command to display \gloskey{first} value in section title and
% table of contents with the first letter changed to upper case.
%    \begin{macrocode}
\newrobustcmd*{\Glsxtrtitlefirst}[1]{%
  \Glsfirst[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrheadfirstplural}
% As above but for the \gloskey{firstplural} value.
%\changes{0.5.1}{2015-12-07}{now uses headuc attribute}
%    \begin{macrocode}
\newcommand*{\glsxtrheadfirstplural}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
     \GLSfirstplural[noindex,hyper=false]{#1}[]%
   }%
   {%
     \glsfirstplural[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrtitlefirstplural}
% Command to display \gloskey{firstplural} value in section title and
% table of contents.
%    \begin{macrocode}
\newrobustcmd*{\glsxtrtitlefirstplural}[1]{%
  \glsfirstplural[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrheadfirstplural}
% First letter converted to upper case
%\changes{0.5.1}{2015-12-07}{now uses headuc attribute}
%    \begin{macrocode}
\newcommand*{\Glsxtrheadfirstplural}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
     \GLSfirstplural[noindex,hyper=false]{#1}[]%
   }%
   {%
     \Glsfirstplural[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrtitlefirstplural}
% Command to display \gloskey{first} value in section title and
% table of contents with the first letter changed to upper case.
%    \begin{macrocode}
\newrobustcmd*{\Glsxtrtitlefirstplural}[1]{%
  \Glsfirstplural[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrheadlong}
% Command used to display long form in the page header.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrheadlong}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
     \GLSxtrlong[noindex,hyper=false]{#1}[]%
   }%
   {%
     \glsxtrlong[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrtitlelong}
% Command to display long form of abbreviation in section title and
% table of contents.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\newrobustcmd*{\glsxtrtitlelong}[1]{%
  \glsxtrlong[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrheadlongpl}
% Command used to display plural long form in the page header.
% If you want the text converted to upper case, this needs to be
% redefined to use \cs{GLSxtrlongpl} instead. If you are using a
% smallcaps style, the default fonts don't provide italic smallcaps.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrheadlongpl}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
      \GLSxtrlongpl[noindex,hyper=false]{#1}[]%
   }%
   {%
      \glsxtrlongpl[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrtitlelongpl}
% Command to display plural long form of abbreviation in section title and
% table of contents.
%\changes{1.02}{2016-04-25}{new}
%\changes{1.03}{2016-04-27}{bug fix: changed \cs{glsxtrlong} to
%\cs{glsxtrlongpl}}
%    \begin{macrocode}
\newrobustcmd*{\glsxtrtitlelongpl}[1]{%
  \glsxtrlongpl[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrheadlong}
% Command used to display long form in the page header with the
% first letter converted to upper case.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\newcommand*{\Glsxtrheadlong}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
     \GLSxtrlong[noindex,hyper=false]{#1}[]%
   }%
   {%
     \Glsxtrlong[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrtitlelong}
% Command to display long form of abbreviation in section title and
% table of contents with the first letter converted to upper case.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\newrobustcmd*{\Glsxtrtitlelong}[1]{%
  \Glsxtrlong[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrheadlongpl}
% Command used to display plural long form in the page header with the
% first letter converted to upper case.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\newcommand*{\Glsxtrheadlongpl}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
     \GLSxtrlongpl[noindex,hyper=false]{#1}[]%
   }%
   {%
     \Glsxtrlongpl[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrtitlelongpl}
% Command to display plural long form of abbreviation in section title and
% table of contents with the first letter converted to upper case.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\newrobustcmd*{\Glsxtrtitlelongpl}[1]{%
  \Glsxtrlongpl[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrheadfull}
% Command used to display full form in the page header.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrheadfull}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
     \GLSxtrfull[noindex,hyper=false]{#1}[]%
   }%
   {%
     \glsxtrfull[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrtitlefull}
% Command to display full form of abbreviation in section title and
% table of contents.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\newrobustcmd*{\glsxtrtitlefull}[1]{%
  \glsxtrfull[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrheadfullpl}
% Command used to display plural full form in the page header.
% If you want the text converted to upper case, this needs to be
% redefined to use \cs{GLSxtrfullpl} instead. If you are using a
% smallcaps style, the default fonts don't provide italic smallcaps.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrheadfullpl}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
      \GLSxtrfullpl[noindex,hyper=false]{#1}[]%
   }%
   {%
      \glsxtrfullpl[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrtitlefullpl}
% Command to display plural full form of abbreviation in section title and
% table of contents.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\newrobustcmd*{\glsxtrtitlefullpl}[1]{%
  \glsxtrfullpl[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrheadfull}
% Command used to display full form in the page header with the
% first letter converted to upper case.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\newcommand*{\Glsxtrheadfull}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
     \GLSxtrfull[noindex,hyper=false]{#1}[]%
   }%
   {%
     \Glsxtrfull[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrtitlefull}
% Command to display full form of abbreviation in section title and
% table of contents with the first letter converted to upper case.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\newrobustcmd*{\Glsxtrtitlefull}[1]{%
  \Glsxtrfull[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrheadfullpl}
% Command used to display plural full form in the page header with the
% first letter converted to upper case.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\newcommand*{\Glsxtrheadfullpl}[1]{%
 \protect\NoCaseChange
 {%
   \glsifattribute{#1}{headuc}{true}%
   {%
     \GLSxtrfullpl[noindex,hyper=false]{#1}[]%
   }%
   {%
     \Glsxtrfullpl[noindex,hyper=false]{#1}[]%
   }%
 }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsxtrtitlefullpl}
% Command to display plural full form of abbreviation in section title and
% table of contents with the first letter converted to upper case.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\newrobustcmd*{\Glsxtrtitlefullpl}[1]{%
  \Glsxtrfullpl[noindex,hyper=false]{#1}[]%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsfmtshort}
% Provide a way of using the formatted short form in section
% headings. If \sty{hyperref} has been loaded, use
% \cs{texorpdfstring} for convenience in PDF bookmarks.
%\changes{0.2}{2015-11-30}{new}
%\changes{0.4}{2015-12-03}{changed to use \cs{glsxtrshort}}
%\changes{0.5}{2015-12-07}{changed to use \cs{glsxtrtitleshort}}
%\changes{0.5}{2015-12-07}{renamed from \cs{glsentryfmtshort}}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\glsfmtshort}[1]{%
    \texorpdfstring
      {\glsxtrtitleshort{#1}}%
      {\glsentryshort{#1}}%
  }
}
{
  \newcommand*{\glsfmtshort}[1]{%
   \glsxtrtitleshort{#1}}
}
%    \end{macrocode}
%\end{macro}
%Similarly for the plural version.
%\begin{macro}{\glsfmtshortpl}
%\changes{0.2}{2015-11-30}{new}
%\changes{0.4}{2015-12-03}{changed to use \cs{glsxtrshortpl}}
%\changes{0.5}{2015-12-07}{changed to use \cs{glsxtrtitleshortpl}}
%\changes{0.5}{2015-12-07}{renamed from \cs{glsentryfmtshortpl}}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\glsfmtshortpl}[1]{%
    \texorpdfstring
      {\glsxtrtitleshortpl{#1}}%
      {\glsentryshortpl{#1}}%
  }
}
{
  \newcommand*{\glsfmtshortpl}[1]{%
   \glsxtrtitleshortpl{#1}}
}
%    \end{macrocode}
%\end{macro}
% The case-changing version isn't suitable for PDF bookmarks, so the
% PDF alternative uses the non-case-changing version.
%\begin{macro}{\Glsfmtshort}
% Singular form (first letter uppercase).
%\changes{0.2}{2015-11-30}{new}
%\changes{0.4}{2015-12-03}{changed to use \cs{Glsxtrshort}}
%\changes{0.5}{2015-12-07}{changed to use \cs{Glsxtrtitleshort}}
%\changes{0.5}{2015-12-07}{renamed from \cs{Glsentryfmtshort}}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\Glsfmtshort}[1]{%
    \texorpdfstring
      {\Glsxtrtitleshort{#1}}%
      {\glsentryshort{#1}}%
  }
}
{
  \newcommand*{\Glsfmtshort}[1]{%
   \Glsxtrtitleshort{#1}}
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsfmtshortpl}
%Plural form (first letter uppercase).
%\changes{0.2}{2015-11-30}{new}
%\changes{0.4}{2015-12-03}{changed to use \cs{glsxtrshortpl}}
%\changes{0.5}{2015-12-07}{changed to use \cs{Glsxtrtitleshortpl}}
%\changes{0.5}{2015-12-07}{renamed from \cs{Glsentryfmtshortpl}}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\Glsfmtshortpl}[1]{%
    \texorpdfstring
    {\Glsxtrtitleshortpl{#1}}%
    {\glsentryshortpl{#1}}%
  }
}
{
  \newcommand*{\Glsfmtshortpl}[1]{%
   \Glsxtrtitleshortpl{#1}}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsfmtname}
%As above but for the \gloskey{name} value.
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\glsfmtname}[1]{%
    \texorpdfstring
    {\glsxtrtitlename{#1}}%
    {\glsentryname{#1}}%
  }
}
{
  \newcommand*{\glsfmtname}[1]{%
   \glsxtrtitlename{#1}}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsfmtname}
%First letter converted to upper case.
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\Glsfmtname}[1]{%
    \texorpdfstring
    {\Glsxtrtitlename{#1}}%
    {\glsentryname{#1}}%
  }
}
{
  \newcommand*{\Glsfmtname}[1]{%
   \Glsxtrtitlename{#1}}
}
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{\glsfmttext}
%As above but for the \gloskey{text} value.
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\glsfmttext}[1]{%
    \texorpdfstring
    {\glsxtrtitletext{#1}}%
    {\glsentrytext{#1}}%
  }
}
{
  \newcommand*{\glsfmttext}[1]{%
   \glsxtrtitletext{#1}}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsfmttext}
%First letter converted to upper case.
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\Glsfmttext}[1]{%
    \texorpdfstring
    {\Glsxtrtitletext{#1}}%
    {\glsentrytext{#1}}%
  }
}
{
  \newcommand*{\Glsfmttext}[1]{%
   \Glsxtrtitletext{#1}}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsfmtplural}
%As above but for the \gloskey{plural} value.
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\glsfmtplural}[1]{%
    \texorpdfstring
    {\glsxtrtitleplural{#1}}%
    {\glsentryplural{#1}}%
  }
}
{
  \newcommand*{\glsfmtplural}[1]{%
   \glsxtrtitleplural{#1}}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsfmtplural}
%First letter converted to upper case.
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\Glsfmtplural}[1]{%
    \texorpdfstring
    {\Glsxtrtitleplural{#1}}%
    {\glsentryplural{#1}}%
  }
}
{
  \newcommand*{\Glsfmtplural}[1]{%
   \Glsxtrtitleplural{#1}}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsfmtfirst}
%As above but for the \gloskey{first} value.
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\glsfmtfirst}[1]{%
    \texorpdfstring
    {\glsxtrtitlefirst{#1}}%
    {\glsentryfirst{#1}}%
  }
}
{
  \newcommand*{\glsfmtfirst}[1]{%
   \glsxtrtitlefirst{#1}}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsfmtfirst}
%First letter converted to upper case.
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\Glsfmtfirst}[1]{%
    \texorpdfstring
    {\Glsxtrtitlefirst{#1}}%
    {\glsentryfirst{#1}}%
  }
}
{
  \newcommand*{\Glsfmtfirst}[1]{%
   \Glsxtrtitlefirst{#1}}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsfmtfirstpl}
%As above but for the \gloskey{firstplural} value.
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\glsfmtfirstpl}[1]{%
    \texorpdfstring
    {\glsxtrtitlefirstplural{#1}}%
    {\glsentryfirstplural{#1}}%
  }
}
{
  \newcommand*{\glsfmtfirstpl}[1]{%
   \glsxtrtitlefirstplural{#1}}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsfmtfirstpl}
%First letter converted to upper case.
%\changes{0.5}{2015-12-07}{new}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\Glsfmtfirstpl}[1]{%
    \texorpdfstring
    {\Glsxtrtitlefirstplural{#1}}%
    {\glsentryfirstplural{#1}}%
  }
}
{
  \newcommand*{\Glsfmtfirstpl}[1]{%
   \Glsxtrtitlefirstplural{#1}}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsfmtlong}
%As above but for the \gloskey{long} value.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\glsfmtlong}[1]{%
    \texorpdfstring
    {\glsxtrtitlelong{#1}}%
    {\glsentrylong{#1}}%
  }
}
{
  \newcommand*{\glsfmtlong}[1]{%
   \glsxtrtitlelong{#1}}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsfmtlong}
%First letter converted to upper case.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\Glsfmtlong}[1]{%
    \texorpdfstring
    {\Glsxtrtitlelong{#1}}%
    {\glsentrylong{#1}}%
  }
}
{
  \newcommand*{\Glsfmtlong}[1]{%
   \Glsxtrtitlelong{#1}}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsfmtlongpl}
%As above but for the \gloskey{longplural} value.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\glsfmtlongpl}[1]{%
    \texorpdfstring
    {\glsxtrtitlelongpl{#1}}%
    {\glsentrylongpl{#1}}%
  }
}
{
  \newcommand*{\glsfmtlongpl}[1]{%
   \glsxtrtitlelongpl{#1}}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsfmtlongpl}
%First letter converted to upper case.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\Glsfmtlongpl}[1]{%
    \texorpdfstring
    {\Glsxtrtitlelongpl{#1}}%
    {\glsentrylongpl{#1}}%
  }
}
{
  \newcommand*{\Glsfmtlongpl}[1]{%
   \Glsxtrtitlelongpl{#1}}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsfmtfull}
%In-line full format.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\glsfmtfull}[1]{%
    \texorpdfstring
    {\glsxtrtitlefull{#1}}%
    {\glsxtrinlinefullformat{#1}{}}%
  }
}
{
  \newcommand*{\glsfmtfull}[1]{%
   \glsxtrtitlefull{#1}}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsfmtfull}
%First letter converted to upper case.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\Glsfmtfull}[1]{%
    \texorpdfstring
    {\Glsxtrtitlefull{#1}}%
    {\Glsxtrinlinefullformat{#1}{}}%
  }
}
{
  \newcommand*{\Glsfmtfull}[1]{%
   \Glsxtrtitlefull{#1}}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsfmtfullpl}
%In-line full plural format.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\glsfmtfullpl}[1]{%
    \texorpdfstring
    {\glsxtrtitlefullpl{#1}}%
    {\glsxtrinlinefullplformat{#1}{}}%
  }
}
{
  \newcommand*{\glsfmtfullpl}[1]{%
   \glsxtrtitlefullpl{#1}}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Glsfmtfullpl}
%First letter converted to upper case.
%\changes{1.02}{2016-04-25}{new}
%    \begin{macrocode}
\ifdef\texorpdfstring
{
  \newcommand*{\Glsfmtfullpl}[1]{%
    \texorpdfstring
    {\Glsxtrtitlefullpl{#1}}%
    {\Glsxtrinlinefullplformat{#1}{}}%
  }
}
{
  \newcommand*{\Glsfmtfullpl}[1]{%
   \Glsxtrtitlefullpl{#1}}
}
%    \end{macrocode}
%\end{macro}
%
%\section{Multi-Lingual Support}
% Add the facility to load language modules, if they are installed,
% but none are provided with this package.
%
%\begin{macro}{\RequireGlossariesExtraLang}
%\changes{0.5.3}{2015-12-09}{new}
%    \begin{macrocode}
\newcommand*{\RequireGlossariesExtraLang}[1]{%
  \@ifundefined{ver@glossariesxtr-#1.ldf}{\input{glossariesxtr-#1.ldf}}{}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ProvidesGlossariesExtraLang}
%\changes{0.5.3}{2015-12-09}{new}
%    \begin{macrocode}
\newcommand*{\ProvidesGlossariesExtraLang}[1]{%
  \ProvidesFile{glossariesxtr-#1.ldf}%
}
%    \end{macrocode}
%\end{macro}
%
% Load any required language modules that are available. This
% doesn't generate any warning if none are found, since they're not 
% essential. (The only command that really needs defining for the
% document is \ics{abbreviationsname}, which can simply be
% redefined. However, with \app{bib2gls} it might be useful to
% provide custom rules for a particular locale.)
%
%\begin{macro}{\glsxtr@loaddialect}
%The dialect label should be stored in \cs{this@dialect}
%before using this command.
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand{\glsxtr@loaddialect}{%
  \IfTrackedLanguageFileExists{\this@dialect}%
  {glossariesxtr-}% prefix
  {.ldf}%
  {%
    \RequireGlossariesExtraLang{\CurrentTrackedTag}%
  }%
  {}% not found
%    \end{macrocode}
% If \sty{glossaries-extra-bib2gls} has been loaded,
% \cs{@glsxtrdialecthook} will check for the associated script,
% otherwise it will do nothing.
%    \begin{macrocode}
  \@glsxtrdialecthook
}
%    \end{macrocode}
%\end{macro}
%    \begin{macrocode}
\@ifpackageloaded{tracklang}
{%
  \AnyTrackedLanguages
  {%
    \ForEachTrackedDialect{\this@dialect}{\glsxtr@loaddialect}%
  }%
  {}%
}
{}
%    \end{macrocode}
% Load \sty{glossaries-extra-stylemods} if required.
%    \begin{macrocode}
\@glsxtr@redefstyles
%    \end{macrocode}
% and set the style:
%    \begin{macrocode}
\@glsxtr@do@style
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-extra.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-extra-bib2gls.sty>
%    \end{macrocode}
%\fi
%\changes{1.27}{2018-02-26}{added glossaries-extra-bib2gls.sty}
%\section{glossaries-extra-bib2gls.sty}
%This package provides additional support for \app{bib2gls} and is
%automatically loaded by the record option.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{glossaries-extra-bib2gls}[2018/05/09 v1.31 (NLCT)]
%    \end{macrocode}
%
%These are some convenient macros for use with custom rules.
%\begin{macro}{\glshex}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\glshex}{\string\u}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glscapturedgroup}
%\changes{1.31}{2018-05-09}{new}
%    \begin{macrocode}
\newcommand*{\glscapturedgroup}{\string\$}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrIfHasNonZeroChildCount}
%\changes{1.31}{2018-05-09}{new}
%For use with \app{bib2gls}'s \texttt{save-child-count} resource option.
%    \begin{macrocode}
\newcommand*{\GlsXtrIfHasNonZeroChildCount}[3]{%
  \GlsXtrIfFieldNonZero{childcount}{#1}{#2}{#3}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrprovidecommand}
%\changes{1.27}{2018-02-26}{new}
%For use in \texttt{@preamble}, this behaves like
%\cs{providecommand} in the document but like \cs{renewcommand}
%in \app{bib2gls}.
%    \begin{macrocode}
\newcommand*{\glsxtrprovidecommand}{\providecommand}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtr@wrglossarylocation}
%\changes{1.29}{2018-04-09}{new}
%For use with \pkgopt{indexcounter} and \app{bib2gls}.
%    \begin{macrocode}
\newcommand*{\glsxtr@wrglossarylocation}[2]{#1}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrIndexCounterLink}
%\changes{1.29}{2018-04-09}{new}
%\begin{definition}
%\cs{GlsXtrIndexCounterLink}\marg{text}\marg{label}
%\end{definition}
%For use with \pkgopt{indexcounter} and \app{bib2gls}.
%    \begin{macrocode}
\ifdef\hyperref
{%
  \newcommand*{\GlsXtrIndexCounterLink}[2]{%
    \glsxtrifhasfield{indexcounter}{#2}%
    {\hyperref[wrglossary.\glscurrentfieldvalue]{#1}}%
    {#1}%
  }
}
{
  \newcommand*{\GlsXtrIndexCounterLink}[2]{#1}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrDualField}
%\changes{1.30}{2018-04-25}{new}
%\begin{definition}
%\cs{GlsXtrDualField}
%\end{definition}
%The internal field used to store the dual label. The
%\texttt{dual-field} defaults to \texttt{dual} if no value is
%supplied so that's used as the default.
%    \begin{macrocode}
\newcommand*{\GlsXtrDualField}{dual}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrDualBackLink}
%\changes{1.30}{2018-04-25}{new}
%\begin{definition}
%\cs{GlsXtrDualBackLink}\marg{text}\marg{label}
%\end{definition}
%Adds a hyperlink to the dual entry.
%    \begin{macrocode}
\newcommand*{\GlsXtrDualBackLink}[2]{%
  \glsxtrifhasfield{\GlsXtrDualField}{#2}%
  {\glshyperlink[#1]{\glscurrentfieldvalue}}%
  {#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrBibTeXEntryAliases}
%\changes{1.29}{2018-04-09}{new}
%Convenient shortcut for use with \texttt{entry-type-aliases} to
%alias standard \BibTeX\ entry types to \texttt{@bibtexentry}.
%    \begin{macrocode}
\newcommand*{\GlsXtrBibTeXEntryAliases}{%
  article=bibtexentry,
  book=bibtexentry,
  booklet=bibtexentry,
  conference=bibtexentry,
  inbook=bibtexentry,
  incollection=bibtexentry,
  inproceedings=bibtexentry,
  manual=bibtexentry,
  mastersthesis=bibtexentry,
  misc=bibtexentry,
  phdthesis=bibtexentry,
  proceedings=bibtexentry,
  techreport=bibtexentry,
  unpublished=bibtexentry
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsXtrProvideBibTeXFields}
%\changes{1.29}{2018-04-09}{new}
%Convenient shortcut to define the standard \BibTeX\ fields.
%    \begin{macrocode}
\newcommand*{\GlsXtrProvideBibTeXFields}{%
  \glsaddstoragekey{address}{}{\glsxtrbibaddress}%
  \glsaddstoragekey{author}{}{\glsxtrbibauthor}%
  \glsaddstoragekey{booktitle}{}{\glsxtrbibbooktitle}%
  \glsaddstoragekey{chapter}{}{\glsxtrbibchapter}%
  \glsaddstoragekey{edition}{}{\glsxtrbibedition}%
  \glsaddstoragekey{howpublished}{}{\glsxtrbibhowpublished}%
  \glsaddstoragekey{institution}{}{\glsxtrbibinstitution}%
  \glsaddstoragekey{journal}{}{\glsxtrbibjournal}%
  \glsaddstoragekey{month}{}{\glsxtrbibmonth}%
  \glsaddstoragekey{note}{}{\glsxtrbibnote}%
  \glsaddstoragekey{number}{}{\glsxtrbibnumber}%
  \glsaddstoragekey{organization}{}{\glsxtrbiborganization}%
  \glsaddstoragekey{pages}{}{\glsxtrbibpages}%
  \glsaddstoragekey{publisher}{}{\glsxtrbibpublisher}%
  \glsaddstoragekey{school}{}{\glsxtrbibschool}%
  \glsaddstoragekey{series}{}{\glsxtrbibseries}%
  \glsaddstoragekey{title}{}{\glsxtrbibtitle}%
  \glsaddstoragekey{bibtextype}{}{\glsxtrbibtype}%
  \glsaddstoragekey{volume}{}{\glsxtrbibvolume}%
}
%    \end{macrocode}
%\end{macro}
%
%Provide missing Greek letters for use in maths mode.
%These commands are recognised by \app{bib2gls} and will be mapped to the
%Mathematical Greek Italic letters. This ensures that the Greek
%letters that have the same shape as Latin letters are kept
%with the other mathematical Greek letters for sorting purposes. 
%The \LaTeX\ version of these commands (provided here) use an upright font 
%for capitals and italic for lower case to provide a better match 
%with the other Greek symbols provided by the kernel.
%
%\begin{macro}{\Alpha}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\providecommand*{\Alpha}{\mathrm{A}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Beta}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\providecommand*{\Beta}{\mathrm{B}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Epsilon}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\providecommand*{\Epsilon}{\mathrm{E}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Zeta}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\providecommand*{\Zeta}{\mathrm{Z}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Eta}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\providecommand*{\Eta}{\mathrm{H}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Iota}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\providecommand*{\Iota}{\mathrm{I}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Kappa}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\providecommand*{\Kappa}{\mathrm{K}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Mu}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\providecommand*{\Mu}{\mathrm{M}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Nu}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\providecommand*{\Nu}{\mathrm{N}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Omicron}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\providecommand*{\Omicron}{\mathrm{O}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Rho}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\providecommand*{\Rho}{\mathrm{P}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Tau}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\providecommand*{\Tau}{\mathrm{T}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Chi}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\providecommand*{\Chi}{\mathrm{X}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Digamma}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\providecommand*{\Digamma}{\mathrm{F}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\omicron}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\providecommand*{\omicron}{\mathit{o}}
%    \end{macrocode}
%\end{macro}
%
%Provide corresponding upright characters if \sty{upgreek} has been
%loaded. (The upper case characters are the same as above.)
%    \begin{macrocode}
\@ifpackageloaded{upgreek}%
{
%    \end{macrocode}
%\begin{macro}{\Upalpha}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
  \providecommand*{\Upalpha}{\mathrm{A}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Upbeta}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
  \providecommand*{\Upbeta}{\mathrm{B}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Upepsilon}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
  \providecommand*{\Upepsilon}{\mathrm{E}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Upzeta}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
  \providecommand*{\Upzeta}{\mathrm{Z}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Upeta}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
  \providecommand*{\Upeta}{\mathrm{H}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Upiota}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
  \providecommand*{\Upiota}{\mathrm{I}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Upkappa}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
  \providecommand*{\Upkappa}{\mathrm{K}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Upmu}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
  \providecommand*{\Upmu}{\mathrm{M}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Upnu}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
  \providecommand*{\Upnu}{\mathrm{N}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Upomicron}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
  \providecommand*{\Upomicron}{\mathrm{O}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Uprho}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
  \providecommand*{\Uprho}{\mathrm{P}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Uptau}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
  \providecommand*{\Uptau}{\mathrm{T}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Upchi}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
  \providecommand*{\Upchi}{\mathrm{X}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\upomicron}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
  \providecommand*{\upomicron}{\mathrm{o}}
%    \end{macrocode}
%\end{macro}
%
%    \begin{macrocode}
}%
{}% upgreek.sty not loaded
%    \end{macrocode}
%
%This package provides some basic rules, but it's not intended for
%complete coverage of all locales. The CLDR should provide the
%appropriate locale-sensitive rules. These macros are primarily to
%help construct custom rules to include, for example, Greek maths symbols
%mixed with Latin. For the full rule syntax, see the Java API for
%\href{https://docs.oracle.com/javase/8/docs/api/java/text/RuleBasedCollator.html}{RuleBaseCollator}
%
%If you want to provide a rule-block for a particular locale to
%allow for customization within that locale, create a file called 
%\texttt{glossariesxtr-\meta{tag}.ldf} (where \meta{tag} identifies
%the locale) and add similar commands. See the description
%of \cs{IfTrackedLanguageFileExists} in the \sty{tracklang} manual
%for the allowed forms of \meta{tag}. The simplest is to just use
%the root language label or ISO code. The file will then be automatically loaded
%by \styfmt{glossaries-extra} if the document has support for that
%language.
%
%When combining these blocks of rules, remember to separate them
%with the appropriate character. For example:
%\begin{verbatim}
%sort-rule={\glsxtrcontrolrules
% ;\glsxtrspacerules
% ;\glsxtrnonprintablerules
% ;\glsxtrcombiningdiacriticrules
% ,\glsxtrhyphenrules
% <\glsxtrgeneralpuncrules
% <\glsxtrdigitrules
% <\glsxtrfractionrules
% <\glsxtrGeneralLatinIVrules
% <\glsxtrMathItalicGreekIrules
%}
%\end{verbatim}
%
%\begin{macro}{\glsxtrcontrolrules}
%\changes{1.27}{2018-02-26}{new}
%These are control characters that are usually placed at the start
%of a rule in the `ignored characters' section. These control
%characters are unlikely to appear in any entry fields but are
%provided for completeness.
%\cs{string} is used for punctuation characters in case they've been
%made active.
%    \begin{macrocode}
\newcommand*{\glsxtrcontrolrules}{%
 \string'\glshex 200B\string'\string=\glshex 200C\string=\glshex 200D
 \string=\glshex 200E\string=\glshex 200F\string=\glshex 0000\string=\glshex 0001
 \string=\glshex 0002\string=\glshex 0003\string=\glshex 0004\string=\glshex 0005
 \string=\glshex 0006\string=\glshex 0007\string=\glshex 0008
 \string=\string'\glshex 0009\string'\string=\string'\glshex 000B\string'
 \string=\glshex 000E\string=\glshex 000F\string=\string'\glshex
0010\string'\string=\glshex 0011
 \string=\glshex 0012\string=\glshex 0013\string=\glshex 0014\string=\glshex 0015
 \string=\glshex 0016\string=\glshex 0017\string=\glshex 0018\string=\glshex 0019
 \string=\glshex 001A\string=\glshex 001B\string=\glshex 001C\string=\glshex 001D
 \string=\glshex 001E\string=\glshex 001F\string=\glshex 007F\string=\glshex 0080
 \string=\glshex 0081\string=\glshex 0082\string=\glshex 0083\string=\glshex 0084
 \string=\glshex 0085\string=\glshex 0086\string=\glshex 0087\string=\glshex 0088
 \string=\glshex 0089\string=\glshex 008A\string=\glshex 008B\string=\glshex 008C
 \string=\glshex 008D\string=\glshex 008E\string=\glshex 008F\string=\glshex 0090
 \string=\glshex 0091\string=\glshex 0092\string=\glshex 0093\string=\glshex 0094
 \string=\glshex 0095\string=\glshex 0096\string=\glshex 0097\string=\glshex 0098
 \string=\glshex 0099\string=\glshex 009A\string=\glshex 009B\string=\glshex 009C
 \string=\glshex 009D\string=\glshex 009E\string=\glshex 009F
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrspacerules}
%\changes{1.27}{2018-02-26}{new}
%These are space characters.
%    \begin{macrocode}
\newcommand*{\glsxtrspacerules}{%
 \string' \string'\string;
 \string'\glshex 00A0\string'\string;
 \string'\glshex 2000\string'\string;
 \string'\glshex 2001\string'\string;
 \string'\glshex 2002\string'\string;
 \string'\glshex 2003\string'\string;
 \string'\glshex 2004\string'\string;
 \string'\glshex 2005\string'\string;
 \string'\glshex 2006\string'\string;
 \string'\glshex 2007\string'\string;
 \string'\glshex 2008\string'\string;
 \string'\glshex 2009\string'\string;
 \string'\glshex 200A\string'\string;
 \string'\glshex 3000\string'
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrnonprintablerules}
%\changes{1.27}{2018-02-26}{new}
%These are non-printable characters (BOM, tabs, line feed and carriage
%return).
%    \begin{macrocode}
\newcommand*{\glsxtrnonprintablerules}{%
 \string'\glshex FEFF\string'\string;
 \string'\glshex 000A\string'\string;
 \string'\glshex 0009\string'\string;
 \string'\glshex 000C\string'\string;
 \string'\glshex 000B\string'
}
%    \end{macrocode}
%\end{macro}

%\begin{macro}{\glsxtrcombiningdiacriticrules}
%\changes{1.27}{2018-02-26}{new}
%Combining diacritic marks. This is split into multiple macros.
%    \begin{macrocode}
\newcommand*{\glsxtrcombiningdiacriticrules}{%
 \glsxtrcombiningdiacriticIrules\string;
 \glsxtrcombiningdiacriticIIrules\string;
 \glsxtrcombiningdiacriticIIIrules\string;
 \glsxtrcombiningdiacriticIVrules
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrcombiningdiacriticIrules}
%\changes{1.27}{2018-02-26}{new}
%First set of combining diacritic marks.
%    \begin{macrocode}
\newcommand*{\glsxtrcombiningdiacriticIrules}{%
 \glshex 0301\string;% combining acute
 \glshex 0300\string;% combining grave 
 \glshex 0306\string;% combining breve
 \glshex 0302\string;% combining circumflex
 \glshex 030C\string;% combining caron
 \glshex 030A\string;% combining ring
 \glshex 030D\string;% combining vertical line above
 \glshex 0308\string;% combining diaeresis
 \glshex 030B\string;% combining double acute
 \glshex 0303\string;% combining tilde
 \glshex 0307\string;% combining dot above
 \glshex 0304% combining macron
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrcombiningdiacriticIIrules}
%\changes{1.27}{2018-02-26}{new}
%Second set of combining diacritic marks.
%    \begin{macrocode}
\newcommand*{\glsxtrcombiningdiacriticIIrules}{%
 \glshex 0337\string;% combining short solidus overlay
 \glshex 0327\string;% combining cedilla
 \glshex 0328\string;% combining ogonek
 \glshex 0323\string;% combining dot below 
 \glshex 0332\string;% combining low line
 \glshex 0305\string;% combining overline
 \glshex 0309\string;% combining hook above
 \glshex 030E\string;% combining double vertical line above
 \glshex 030F\string;% combining double grave accent
 \glshex 0310\string;% combining candrabindu
 \glshex 0311\string;% combining inverted breve
 \glshex 0312\string;% combining turned comma above
 \glshex 0313\string;% combining comma above
 \glshex 0314\string;% combining reversed comma above
 \glshex 0315\string;% combining comma above right
 \glshex 0316\string;% combining grave accent below
 \glshex 0317% combining acute accent below
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrcombiningdiacriticIIIrules}
%\changes{1.27}{2018-02-26}{new}
%Third set of combining diacritic marks.
%    \begin{macrocode}
\newcommand*{\glsxtrcombiningdiacriticIIIrules}{%
 \glshex 0318\string;% combining left tack below
 \glshex 0319\string;% combining right tack below
 \glshex 031A\string;% combining left angle above
 \glshex 031B\string;% combining horn
 \glshex 031C\string;% combining left half ring below
 \glshex 031D\string;% combining up tack below
 \glshex 031E\string;% combining down tack below
 \glshex 031F\string;% combining plus sign below
 \glshex 0320\string;% combining minus sign below
 \glshex 0321\string;% combining palatalized hook below
 \glshex 0322\string;% combining retroflex hook below
 \glshex 0324\string;% combining diaresis below
 \glshex 0325\string;% combining ring below
 \glshex 0326\string;% combining comma below
 \glshex 0329\string;% combining vertical line below
 \glshex 032A\string;% combining bridge below
 \glshex 032B\string;% combining inverted double arch below
 \glshex 032C\string;% combining caron below
 \glshex 032D\string;% combining circumflex accent below
 \glshex 032E\string;% combining breve below
 \glshex 032F\string;% combining inverted breve below
 \glshex 0330\string;% combining tilde below
 \glshex 0331\string;% combining macron below
 \glshex 0333\string;% combining double low line
 \glshex 0334\string;% combining tilde overlay
 \glshex 0335\string;% combining short stroke overlay
 \glshex 0336\string;% combining long stroke overlay
 \glshex 0338\string;% combining long solidus overlay
 \glshex 0339\string;% combining combining right half ring below
 \glshex 033A\string;% combining inverted bridge below
 \glshex 033B\string;% combining square below
 \glshex 033C\string;% combining seagull below
 \glshex 033D\string;% combining x above
 \glshex 033E\string;% combining vertical tilde
 \glshex 033F\string;% combining double overline
 \glshex 0342\string;% combining Greek perispomeni
 \glshex 0344\string;% combining Greek dialytika tonos
 \glshex 0345\string;% combining Greek ypogegrammeni
 \glshex 0360\string;% combining double tilde
 \glshex 0361\string;% combining double inverted breve
 \glshex 0483\string;% combining Cyrillic titlo
 \glshex 0484\string;% combining Cyrillic palatalization
 \glshex 0485\string;% combining Cyrillic dasia pneumata
 \glshex 0486% combining Cyrillic psili pneumata
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrcombiningdiacriticIVrules}
%\changes{1.27}{2018-02-26}{new}
%Fourth set of combining diacritic marks.
%    \begin{macrocode}
\newcommand*{\glsxtrcombiningdiacriticIVrules}{%
 \glshex 20D0\string;% combining left harpoon above
 \glshex 20D1\string;% combining right harpoon above
 \glshex 20D2\string;% combining long vertical line overlay
 \glshex 20D3\string;% combining short vertical line overlay
 \glshex 20D4\string;% combining anticlockwise arrow above
 \glshex 20D5\string;% combining clockwise arrow above
 \glshex 20D6\string;% combining left arrow above
 \glshex 20D7\string;% combining right arrow above
 \glshex 20D8\string;% combining ring overlay
 \glshex 20D9\string;% combining clockwise ring overlay
 \glshex 20DA\string;% combining anticlockwise ring overlay
 \glshex 20DB\string;% combining three dots above
 \glshex 20DC\string;% combining four dots above
 \glshex 20DD\string;% combining enclosing circle
 \glshex 20DE\string;% combining enclosing square
 \glshex 20DF\string;% combining enclosing diamond
 \glshex 20E0\string;% combining enclosing circle backslash
 \glshex 20E1%  combining left right arrow above
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrhyphenrules}
%\changes{1.27}{2018-02-26}{new}
%Hyphens.
%    \begin{macrocode}
\newcommand*{\glsxtrhyphenrules}{%
 \string'\string-\string'\string;% ASCII hyphen
 \glshex 00AD\string;% soft hyphen
 \glshex 2010\string;% hyphen
 \glshex 2011\string;% non-breaking hyphen
 \glshex 2012\string;% figure dash
 \glshex 2013\string;% en dash
 \glshex 2014\string;% em dash
 \glshex 2015\string;% horizontal bar
 \glshex 2212\string=\glshex 207B\string=\glshex 208B% minus sign
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrgeneralpuncrules}
%\changes{1.27}{2018-02-26}{new}
%General punctuation.
%    \begin{macrocode}
\newcommand*{\glsxtrgeneralpuncrules}{%
  \glsxtrgeneralpuncIrules
  \string<\glsxtrcurrencyrules
  \string<\glsxtrgeneralpuncIIrules
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrgeneralpuncIrules}
%\changes{1.27}{2018-02-26}{new}
%First set of general punctuation.
%    \begin{macrocode}
\newcommand*{\glsxtrgeneralpuncIrules}{%
 \string'\glshex 005F\string'% underscore
 \string<\glshex 00AF% macron
 \string<\string'\glshex 002C\string'% comma
 \string<\string'\glshex 003B\string'% semi-colon
 \string<\string'\glshex 003A\string'% colon
 \string<\string'\glshex 0021\string'% exclamation mark
 \string<\glshex 00A1% inverted exclamation mark 
 \string<\string'\glshex 003F\string'% question mark
 \string<\glshex 00BF% inverted question mark
 \string<\string'\glshex 002F\string'% solidus
 \string<\string'\glshex 002E\string'% full stop
 \string<\glshex 00B4% acute accent
 \string<\string'\glshex 0060\string'% grave accent
 \string<\string'\glshex 005E\string'% circumflex accent
 \string<\glshex 00A8% diaersis
 \string<\string'\glshex 007E\string'% tilde
 \string<\glshex 00B7% middle dot
 \string<\glshex 00B8% cedilla
 \string<\string'\glshex 0027\string'% straight apostrophe
 \string<\string'\glshex 0022\string'% straight double quote
 \string<\glshex 00AB% left guillemet
 \string<\glshex 00BB% right guillemet
 \string<\string'\glshex 0028\string'% left parenthesis
  \string=\glshex 207D\string=\glshex 208D% super/subscript left parenthesis
 \string<\string'\glshex 0029\string'% right parenthesis
  \string=\glshex 207E\string=\glshex 208E% super/subscript right parenthesis
 \string<\string'\glshex 005B\string'% left square bracket
 \string<\string'\glshex 005D\string'% right square bracket
 \string<\string'\glshex 007B\string'% left curly bracket
 \string<\string'\glshex 007D\string'% right curly bracket
 \string<\glshex 00A7% section sign
 \string<\glshex 00B6% pilcrow sign
 \string<\glshex 00A9% copyright sign
 \string<\glshex 00AE% registered sign
 \string<\string'\glshex 0040\string'% at sign
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrcurrencyrules}
%\changes{1.27}{2018-02-26}{new}
%General punctuation.
%    \begin{macrocode}
\newcommand*{\glsxtrcurrencyrules}{%
 \glshex 00A4% currency sign
 \string<\glshex 0E3F% Thai currency symbol baht
 \string<\glshex 00A2% cent sign
 \string<\glshex 20A1% colon sign
 \string<\glshex 20A2% cruzeiro sign
 \string<\string'\glshex 0024\string'% dollar sign
 \string<\glshex 20AB% dong sign
 \string<\glshex 20AC% euro sign
 \string<\glshex 20A3% French franc sign
 \string<\glshex 20A4% lira sign
 \string<\glshex 20A5% mill sign
 \string<\glshex 20A6% naira sign
 \string<\glshex 20A7% peseta sign
 \string<\glshex 00A3% pound sign
 \string<\glshex 20A8% rupee sign
 \string<\glshex 20AA% new sheqel sign
 \string<\glshex 20A9% won sign
 \string<\glshex 00A5% yen sign
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrgeneralpuncIIrules}
%\changes{1.27}{2018-02-26}{new}
%Second set of general punctuation.
%    \begin{macrocode}
\newcommand*{\glsxtrgeneralpuncIIrules}{%
 \string'\glshex 002A\string'% asterisk
 \string<\string'\glshex 005C\string'% backslash
 \string<\string'\glshex 0026\string'% ampersand
 \string<\string'\glshex 0023\string'% hash sign
 \string<\string'\glshex 0025\string'% percent sign
 \string<\string'\glshex 002B\string'% plus sign
  \string=\glshex 207A\string=\glshex 208A% super/subscript plus sign
 \string<\glshex 00B1% plus-minus sign
 \string<\glshex 00F7% division sign
 \string<\glshex 00D7% multiplication sign
 \string<\string'\glshex 003C\string'% less-than sign
 \string<\string'\glshex 003D\string'% equals sign
 \string<\string'\glshex 003E\string'% greater-than sign
 \string<\glshex 00AC% not sign
 \string<\string'\glshex 007C\string'% vertical bar (pipe)
 \string<\glshex 00A6% broken bar 
 \string<\glshex 00B0% degree sign
 \string<\glshex 00B5% micron sign
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrGeneralLatinIrules}
%\changes{1.27}{2018-02-26}{new}
%Basic Latin alphabet.
%    \begin{macrocode}
\newcommand*{\glsxtrGeneralLatinIrules}{%
 \glsxtrLatinA
 \string<b,B%
 \string<c,C%
 \string<d,D%
 \string<\glsxtrLatinE
 \string<f,F%
 \string<g,G%
 \string<\glsxtrLatinH
 \string<\glsxtrLatinI
 \string<j,J%
 \string<\glsxtrLatinK
 \string<\glsxtrLatinL
 \string<\glsxtrLatinM
 \string<\glsxtrLatinN
 \string<\glsxtrLatinO
 \string<\glsxtrLatinP
 \string<q,Q%
 \string<r,R%
 \string<\glsxtrLatinS 
 \string<\glsxtrLatinT
 \string<u,U%
 \string<v,V%
 \string<w,W%
 \string<\glsxtrLatinX
 \string<y,Y%
 \string<z,Z
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrGeneralLatinIIrules}
%\changes{1.27}{2018-02-26}{new}
%General Latin alphabet (eth between D and E, \ss\ treated as SS).
%    \begin{macrocode}
\newcommand*{\glsxtrGeneralLatinIIrules}{%
 \glsxtrLatinA
 \string<b,B%
 \string<c,C%
 \string<d,D%
 \string<\glsxtrLatinEth
 \string<\glsxtrLatinE
 \string<f,F%
 \string<g,G%
 \string<\glsxtrLatinH
 \string<\glsxtrLatinI
 \string<j,J%
 \string<\glsxtrLatinK
 \string<\glsxtrLatinL
 \string<\glsxtrLatinM
 \string<\glsxtrLatinN
 \string<\glsxtrLatinO
 \string<\glsxtrLatinP
 \string<q,Q%
 \string<r,R%
 \string<\glsxtrLatinS
 \string& SS \string, \glsxtrLatinEszettSs
 \string<\glsxtrLatinT
 \string<u,U%
 \string<v,V%
 \string<w,W%
 \string<\glsxtrLatinX
 \string<y,Y%
 \string<z,Z%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrGeneralLatinIIIrules}
%\changes{1.27}{2018-02-26}{new}
%General Latin alphabet (eth between D and E, \ss\ treated as SZ).
%    \begin{macrocode}
\newcommand*{\glsxtrGeneralLatinIIIrules}{%
 \glsxtrLatinA
 \string<b,B%
 \string<c,C%
 \string<d,D%
 \string<\glsxtrLatinEth
 \string<\glsxtrLatinE
 \string<f,F%
 \string<g,G%
 \string<\glsxtrLatinH
 \string<\glsxtrLatinI
 \string<j,J%
 \string<\glsxtrLatinK
 \string<\glsxtrLatinL
 \string<\glsxtrLatinM
 \string<\glsxtrLatinN
 \string<\glsxtrLatinO
 \string<\glsxtrLatinP
 \string<q,Q%
 \string<r,R%
 \string<\glsxtrLatinS 
 \string& SZ, \glsxtrLatinEszettSz
 \string<\glsxtrLatinT
 \string<u,U%
 \string<v,V%
 \string<w,W%
 \string<\glsxtrLatinX
 \string<y,Y%
 \string<z,Z%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrGeneralLatinIVrules}
%\changes{1.27}{2018-02-26}{new}
%General Latin alphabet (\AE\ treated as AE and \OE treated as OE,
%\TH treated as TH, \ss\ treated as SS, eth between D and E).
%    \begin{macrocode}
\newcommand*{\glsxtrGeneralLatinIVrules}{%
 \glsxtrLatinA
 \string& AE , \glsxtrLatinAELigature
 \string<b,B%
 \string<c,C%
 \string<d,D%
 \string<\glsxtrLatinEth
 \string<\glsxtrLatinE
 \string<f,F%
 \string<g,G%
 \string<\glsxtrLatinH
 \string<\glsxtrLatinI
 \string<j,J%
 \string<\glsxtrLatinK
 \string<\glsxtrLatinL
 \string<\glsxtrLatinM
 \string<\glsxtrLatinN
 \string<\glsxtrLatinO
 \string& OE , \glsxtrLatinOELigature
 \string<\glsxtrLatinP
 \string<q,Q%
 \string<r,R%
 \string<\glsxtrLatinS 
 \string& SS , \glsxtrLatinEszettSs
 \string<\glsxtrLatinT
 \string& th =\glshex 00DE 
 \string& TH =\glshex 00FE 
 \string<u,U%
 \string<v,V%
 \string<w,W%
 \string<\glsxtrLatinX
 \string<y,Y%
 \string<z,Z%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrGeneralLatinVrules}
%\changes{1.27}{2018-02-26}{new}
%General Latin alphabet (eth between D and E, \ss\ treated as SS,
%\TH\ treated as TH).
%    \begin{macrocode}
\newcommand*{\glsxtrGeneralLatinVrules}{%
 \glsxtrLatinA
 \string<b,B%
 \string<c,C%
 \string<d,D%
 \string<\glsxtrLatinEth
 \string<\glsxtrLatinE
 \string<f,F%
 \string<g,G%
 \string<\glsxtrLatinH
 \string<\glsxtrLatinI
 \string<j,J%
 \string<\glsxtrLatinK
 \string<\glsxtrLatinL
 \string<\glsxtrLatinM
 \string<\glsxtrLatinN
 \string<\glsxtrLatinO
 \string<\glsxtrLatinP
 \string<q,Q%
 \string<r,R%
 \string<\glsxtrLatinS
 \string& SS , \glsxtrLatinEszettSs
 \string<\glsxtrLatinT
 \string& th =\glshex 00DE 
 \string& TH =\glshex 00FE 
 \string<u,U%
 \string<v,V%
 \string<w,W%
 \string<\glsxtrLatinX
 \string<y,Y%
 \string<z,Z%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrGeneralLatinVIrules}
%\changes{1.27}{2018-02-26}{new}
%General Latin alphabet (eth between D and E, \ss\ treated as SZ,
%\TH\ treated as TH).
%    \begin{macrocode}
\newcommand*{\glsxtrGeneralLatinVIrules}{%
 \glsxtrLatinA
 \string<b,B%
 \string<c,C%
 \string<d,D%
 \string<\glsxtrLatinEth
 \string<\glsxtrLatinE
 \string<f,F%
 \string<g,G%
 \string<\glsxtrLatinH
 \string<\glsxtrLatinI
 \string<j,J%
 \string<\glsxtrLatinK
 \string<\glsxtrLatinL
 \string<\glsxtrLatinM
 \string<\glsxtrLatinN
 \string<\glsxtrLatinO
 \string<\glsxtrLatinP
 \string<q,Q%
 \string<r,R%
 \string<\glsxtrLatinS
 \string& SZ , \glsxtrLatinEszettSz
 \string<\glsxtrLatinT
 \string& th =\glshex 00DE 
 \string& TH =\glshex 00FE 
 \string<u,U%
 \string<v,V%
 \string<w,W%
 \string<\glsxtrLatinX
 \string<y,Y%
 \string<z,Z%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrGeneralLatinVIIrules}
%\changes{1.27}{2018-02-26}{new}
%General Latin alphabet (\AE\ between A and B, eth between D and E,
%insular G as G, \OE\ between O and P, long S equivalent to S, 
%\TH\ between T and U and wynn as W).
%    \begin{macrocode}
\newcommand*{\glsxtrGeneralLatinVIIrules}{%
 \glsxtrLatinA
 \string<\glsxtrLatinAELigature
 \string<b,B%
 \string<c,C%
 \string<d,D%
 \string<\glsxtrLatinEth
 \string<\glsxtrLatinE
 \string<f,F%
 \string<\glsxtrLatinInsularG
 \string<\glsxtrLatinH
 \string<\glsxtrLatinI
 \string<j,J%
 \string<\glsxtrLatinK
 \string<\glsxtrLatinL
 \string<\glsxtrLatinM
 \string<\glsxtrLatinN
 \string<\glsxtrLatinO
 \string<\glsxtrLatinOELigature
 \string<\glsxtrLatinP
 \string<q,Q%
 \string<r,R%
 \string<\glshex 017F=\glsxtrLatinS % s and long s 
 \string<\glsxtrLatinT
 \string<\glsxtrLatinThorn
 \string<u,U%
 \string<v,V%
 \string< w\string=\glshex 01BF, W\string=\glshex 01F7
 \string<\glsxtrLatinX
 \string<y,Y%
 \string<z,Z%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrGeneralLatinVIIIrules}
%\changes{1.27}{2018-02-26}{new}
%General Latin alphabet (\AE\ treated as AE and \OE treated as OE,
%\TH treated as TH, \ss\ treated as SS, eth treated as D, \O\
%treated as O, \L\ treated as L).
%    \begin{macrocode}
\newcommand*{\glsxtrGeneralLatinVIIIrules}{%
 \glsxtrLatinA
 \string& AE , \glsxtrLatinAELigature
 \string<b,B%
 \string<c,C%
 \string<\glshex 00F0\string;d,\glshex 00D0\string;D% D and eth
 \string<\glsxtrLatinE
 \string<f,F%
 \string<g,G%
 \string<\glsxtrLatinH
 \string<\glsxtrLatinI
 \string<j,J%
 \string<\glsxtrLatinK
 \string<\glshex 0142\string=\glsxtrLatinL\string=\glshex 0141% L and \L
 \string<\glsxtrLatinM
 \string<\glsxtrLatinN
 \string<\glshex 00F8\string=\glsxtrLatinO\string=\glshex 00D8% O and \O
 \string& OE , \glsxtrLatinOELigature
 \string<\glsxtrLatinP
 \string<q,Q%
 \string<r,R%
 \string<\glsxtrLatinS
 \string& SS , \glsxtrLatinEszettSs
 \string<\glsxtrLatinT
 \string& th =\glshex 00DE 
 \string& TH =\glshex 00FE 
 \string<u,U%
 \string<v,V%
 \string<w,W%
 \string<\glsxtrLatinX
 \string<y,Y%
 \string<z,Z%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinA}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinA}{%
  a\string=\glshex 00AA\string=\glshex 2090,A
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinE}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinE}{%
  e\string=\glshex 2091,E
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinH}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinH}{%
  h\string=\glshex 2095,H
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinI}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinI}{%
  i\string=\glshex 2071,I
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinK}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinK}{%
  k\string=\glshex 2096,K
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinL}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinL}{%
  l\string=\glshex 2097,L
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinM}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinM}{%
  m\string=\glshex 2098,M
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinN}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinN}{%
  n\string=\glshex 207F\string=\glshex 2099,N
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinO}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinO}{%
  o\string=\glshex 00BA\string=\glshex 2092,O
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinP}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinP}{%
  p\string=\glshex 209A,P
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinS}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinS}{%
  s\string=\glshex 209B,S
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinT}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinT}{%
  t\string=\glshex 209C,T
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinX}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinX}{%
  x\string=\glshex 2093,X
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinSchwa}
%\changes{1.27}{2018-02-26}{new}
%Latin schwa (lower case, subscript and upper case).
%    \begin{macrocode}
\newcommand*{\glsxtrLatinSchwa}{%
  \glshex 0259\string=\glshex 2094,\glshex 018F
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinEszettSs}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinEszettSs}{%
 \glshex 00DF% eszett
 \string=\glshex 017Fs % long S s 
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinEszettSz}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinEszettSz}{%
 \glshex 00DF% eszett
 \string= \glshex 017Fz % long S z 
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinEth}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinEth}{%
 \glshex 00F0,\glshex 00D0% eth
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinThorn}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinThorn}{%
 \glshex 00FE,\glshex 00DE% thorn
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinAELigature}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinAELigature}{%
 \glshex 00E6,\glshex 00C6% AE-ligature
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinOELigature}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinOELigature}{%
 \glshex 0153,\glshex 0152% OE-ligature
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinAA}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinAA}{%
 \glshex 00E5=a\glshex 030A,% \aa
 \glshex 00C5=A\glshex 030A% \AA
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinWynn}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinWynn}{%
 \glshex 01BF,\glshex 01F7% wynn
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinInsularG}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinInsularG}{%
 \glshex 1D79,\glshex A77D% insular G
 \string; g, G
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinOslash}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinOslash}{%
 \glshex 00F8,\glshex 00D8% \o, \O
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrLatinLslash}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrLatinLslash}{%
 \glshex 0142,\glshex 0141% \l, \L
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathUpGreekIrules}
%\changes{1.27}{2018-02-26}{new}
%Includes digamma between epsilon and zeta.
%    \begin{macrocode}
\newcommand*{\glsxtrMathUpGreekIrules}{%
 \glsxtrUpAlpha
 \string<\glsxtrUpBeta
 \string<\glsxtrUpGamma
 \string<\glsxtrUpDelta
 \string<\glsxtrUpEpsilon
 \string<\glsxtrUpDigamma
 \string<\glsxtrUpZeta
 \string<\glsxtrUpEta
 \string<\glsxtrUpTheta
 \string<\glsxtrUpIota
 \string<\glsxtrUpKappa
 \string<\glsxtrUpLambda
 \string<\glsxtrUpMu
 \string<\glsxtrUpNu
 \string<\glsxtrUpXi
 \string<\glsxtrUpOmicron
 \string<\glsxtrUpPi
 \string<\glsxtrUpRho
 \string<\glsxtrUpSigma
 \string<\glsxtrUpTau
 \string<\glsxtrUpUpsilon
 \string<\glsxtrUpPhi
 \string<\glsxtrUpChi
 \string<\glsxtrUpPsi
 \string<\glsxtrUpOmega
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathUpGreekIIrules}
%\changes{1.27}{2018-02-26}{new}
%Doesn't include digamma.
%    \begin{macrocode}
\newcommand*{\glsxtrMathUpGreekIIrules}{%
 \glsxtrUpAlpha
 \string<\glsxtrUpBeta
 \string<\glsxtrUpGamma
 \string<\glsxtrUpDelta
 \string<\glsxtrUpEpsilon
 \string<\glsxtrUpZeta
 \string<\glsxtrUpEta
 \string<\glsxtrUpTheta
 \string<\glsxtrUpIota
 \string<\glsxtrUpKappa
 \string<\glsxtrUpLambda
 \string<\glsxtrUpMu
 \string<\glsxtrUpNu
 \string<\glsxtrUpXi
 \string<\glsxtrUpOmicron
 \string<\glsxtrUpPi
 \string<\glsxtrUpRho
 \string<\glsxtrUpSigma
 \string<\glsxtrUpTau
 \string<\glsxtrUpUpsilon
 \string<\glsxtrUpPhi
 \string<\glsxtrUpChi
 \string<\glsxtrUpPsi
 \string<\glsxtrUpOmega
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicGreekIrules}
%\changes{1.27}{2018-02-26}{new}
%Includes (upright) digamma between epsilon and zeta (there isn't
%an italic digamma), so don't mix with \cs{glsxtrMathUpGreekIrules}
%or there may be unexpected results.
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicGreekIrules}{%
 \glsxtrMathItalicAlpha
 \string<\glsxtrMathItalicBeta
 \string<\glsxtrMathItalicGamma
 \string<\glsxtrMathItalicDelta
 \string<\glsxtrMathItalicEpsilon
 \string<\glsxtrUpDigamma
 \string<\glsxtrMathItalicZeta
 \string<\glsxtrMathItalicEta
 \string<\glsxtrMathItalicTheta
 \string<\glsxtrMathItalicIota
 \string<\glsxtrMathItalicKappa
 \string<\glsxtrMathItalicLambda
 \string<\glsxtrMathItalicMu
 \string<\glsxtrMathItalicNu
 \string<\glsxtrMathItalicXi
 \string<\glsxtrMathItalicOmicron
 \string<\glsxtrMathItalicPi
 \string<\glsxtrMathItalicRho
 \string<\glsxtrMathItalicSigma
 \string<\glsxtrMathItalicTau
 \string<\glsxtrMathItalicUpsilon
 \string<\glsxtrMathItalicPhi
 \string<\glsxtrMathItalicChi
 \string<\glsxtrMathItalicPsi
 \string<\glsxtrMathItalicOmega
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicGreekIIrules}
%\changes{1.27}{2018-02-26}{new}
%Doesn't include digamma.
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicGreekIIrules}{%
 \glsxtrMathItalicAlpha
 \string<\glsxtrMathItalicBeta
 \string<\glsxtrMathItalicGamma
 \string<\glsxtrMathItalicDelta
 \string<\glsxtrMathItalicEpsilon
 \string<\glsxtrMathItalicZeta
 \string<\glsxtrMathItalicEta
 \string<\glsxtrMathItalicTheta
 \string<\glsxtrMathItalicIota
 \string<\glsxtrMathItalicKappa
 \string<\glsxtrMathItalicLambda
 \string<\glsxtrMathItalicMu
 \string<\glsxtrMathItalicNu
 \string<\glsxtrMathItalicXi
 \string<\glsxtrMathItalicOmicron
 \string<\glsxtrMathItalicPi
 \string<\glsxtrMathItalicRho
 \string<\glsxtrMathItalicSigma
 \string<\glsxtrMathItalicTau
 \string<\glsxtrMathItalicUpsilon
 \string<\glsxtrMathItalicPhi
 \string<\glsxtrMathItalicChi
 \string<\glsxtrMathItalicPsi
 \string<\glsxtrMathItalicOmega
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicUpperGreekIrules}
%\changes{1.27}{2018-02-26}{new}
%Upper case only (includes upright digamma).
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicUpperGreekIrules}{%
 \glshex 1D6E2% upper case alpha (maths italic)
 \string<\glshex 1D6E3% upper case beta (maths italic)
 \string<\glshex 1D6E4% upper case gamma (maths italic)
 \string<\glshex 1D6E5% upper case delta (maths italic)
 \string<\glshex 1D6E6% upper case epsilon (maths italic)
 \string<\glshex 03DC% upper case digamma
 \string<\glshex 1D6E7% upper case zeta (maths italic)
 \string<\glshex 1D6E8% upper case eta (maths italic)
 \string<\glshex 1D6E9% upper case theta (maths italic)
 \string=\glshex 1D6F3% upper case theta variant (maths italic)
 \string<\glshex 1D6EA% upper case iota (maths italic)
 \string<\glshex 1D6EB% upper case kappa (maths italic)
 \string<\glshex 1D6EC% upper case lambda (maths italic)
 \string<\glshex 1D6ED% upper case mu (maths italic)
 \string<\glshex 1D6EE% upper case nu (maths italic)
 \string<\glshex 1D6EF% upper case xi (maths italic)
 \string<\glshex 1D6F0% upper case omicron (maths italic)
 \string<\glshex 1D6F1% upper case pi (maths italic)
 \string<\glshex 1D6F2% upper case rho (maths italic)
 \string<\glshex 1D6F4% upper case sigma (maths italic)
 \string<\glshex 1D6F5% upper case tau (maths italic)
 \string<\glshex 1D6F6% upper case upsilon (maths italic)
 \string<\glshex 1D6F7% upper case phi (maths italic)
 \string<\glshex 1D6F8% upper case chi (maths italic)
 \string<\glshex 1D6F9% upper case psi (maths italic)
 \string<\glshex 1D6FA% upper case omega (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicUpperGreekIIrules}
%\changes{1.27}{2018-02-26}{new}
%Upper case only (doesn't include upright digamma).
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicUpperGreekIIrules}{%
 \glshex 1D6E2% upper case alpha (maths italic)
 \string<\glshex 1D6E3% upper case beta (maths italic)
 \string<\glshex 1D6E4% upper case gamma (maths italic)
 \string<\glshex 1D6E5% upper case delta (maths italic)
 \string<\glshex 1D6E6% upper case epsilon (maths italic)
 \string<\glshex 1D6E7% upper case zeta (maths italic)
 \string<\glshex 1D6E8% upper case eta (maths italic)
 \string<\glshex 1D6E9% upper case theta (maths italic)
 \string=\glshex 1D6F3% upper case theta variant (maths italic)
 \string<\glshex 1D6EA% upper case iota (maths italic)
 \string<\glshex 1D6EB% upper case kappa (maths italic)
 \string<\glshex 1D6EC% upper case lambda (maths italic)
 \string<\glshex 1D6ED% upper case mu (maths italic)
 \string<\glshex 1D6EE% upper case nu (maths italic)
 \string<\glshex 1D6EF% upper case xi (maths italic)
 \string<\glshex 1D6F0% upper case omicron (maths italic)
 \string<\glshex 1D6F1% upper case pi (maths italic)
 \string<\glshex 1D6F2% upper case rho (maths italic)
 \string<\glshex 1D6F4% upper case sigma (maths italic)
 \string<\glshex 1D6F5% upper case tau (maths italic)
 \string<\glshex 1D6F6% upper case upsilon (maths italic)
 \string<\glshex 1D6F7% upper case phi (maths italic)
 \string<\glshex 1D6F8% upper case chi (maths italic)
 \string<\glshex 1D6F9% upper case psi (maths italic)
 \string<\glshex 1D6FA% upper case omega (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicLowerGreekIrules}
%\changes{1.27}{2018-02-26}{new}
%Lower case only (includes upright digamma).
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicLowerGreekIrules}{%
 \glshex 1D6FC% lower case alpha (maths italic)
 \string<\glshex 1D6FD% lower case beta (maths italic)
 \string<\glshex 1D6FE% lower case gamma (maths italic)
 \string<\glshex 1D6FF% lower case delta (maths italic)
 \string<\glshex 1D700% lower case epsilon (maths italic)
 \string=\glshex 1D716% lower case epsilon variant (maths italic)
 \string<\glshex 03DD% lower case digamma
 \string<\glshex 1D701% lower case zeta (maths italic)
 \string<\glshex 1D702% lower case eta (maths italic)
 \string<\glshex 1D703% lower case theta (maths italic)
 \string=\glshex 1D717% lower case theta variant (maths italic)
 \string<\glshex 1D704% lower case iota (maths italic)
 \string<\glshex 1D705% lower case kappa (maths italic)
 \string=\glshex 1D718% lower case kappa variant (maths italic)
 \string<\glshex 1D706% lower case lambda (maths italic)
 \string<\glshex 1D707% lower case mu (maths italic)
 \string<\glshex 1D708% lower case nu (maths italic)
 \string<\glshex 1D709% lower case xi (maths italic)
 \string<\glshex 1D70A% lower case omicron (maths italic)
 \string<\glshex 1D70B% lower case pi (maths italic)
 \string=\glshex 1D71B% lower case pi variant (maths italic)
 \string<\glshex 1D70C% lower case rho (maths italic)
 \string=\glshex 1D71A% lower case rho variant (maths italic)
 \string<\glshex 1D70D% lower case final sigma (maths italic)
 \string=\glshex 1D70E% lower case sigma (maths italic)
 \string<\glshex 1D70F% lower case tau (maths italic)
 \string<\glshex 1D710% lower case upsilon (maths italic)
 \string<\glshex 1D711% lower case phi (maths italic)
 \string=\glshex 1D719% lower case phi variant (maths italic)
 \string<\glshex 1D712% lower case chi (maths italic)
 \string<\glshex 1D713% lower case psi (maths italic)
 \string<\glshex 1D714% lower case omega (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicLowerGreekIIrules}
%\changes{1.27}{2018-02-26}{new}
%Lower case only (doesn't includes upright digamma).
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicLowerGreekIIrules}{%
 \glshex 1D6FC% lower case alpha (maths italic)
 \string<\glshex 1D6FD% lower case beta (maths italic)
 \string<\glshex 1D6FE% lower case gamma (maths italic)
 \string<\glshex 1D6FF% lower case delta (maths italic)
 \string<\glshex 1D700% lower case epsilon (maths italic)
 \string=\glshex 1D716% lower case epsilon variant (maths italic)
 \string<\glshex 1D701% lower case zeta (maths italic)
 \string<\glshex 1D702% lower case eta (maths italic)
 \string<\glshex 1D703% lower case theta (maths italic)
 \string=\glshex 1D717% lower case theta variant (maths italic)
 \string<\glshex 1D704% lower case iota (maths italic)
 \string<\glshex 1D705% lower case kappa (maths italic)
 \string=\glshex 1D718% lower case kappa variant (maths italic)
 \string<\glshex 1D706% lower case lambda (maths italic)
 \string<\glshex 1D707% lower case mu (maths italic)
 \string<\glshex 1D708% lower case nu (maths italic)
 \string<\glshex 1D709% lower case xi (maths italic)
 \string<\glshex 1D70A% lower case omicron (maths italic)
 \string<\glshex 1D70B% lower case pi (maths italic)
 \string=\glshex 1D71B% lower case pi variant (maths italic)
 \string<\glshex 1D70C% lower case rho (maths italic)
 \string=\glshex 1D71A% lower case rho variant (maths italic)
 \string<\glshex 1D70D% lower case final sigma (maths italic)
 \string=\glshex 1D70E% lower case sigma (maths italic)
 \string<\glshex 1D70F% lower case tau (maths italic)
 \string<\glshex 1D710% lower case upsilon (maths italic)
 \string<\glshex 1D711% lower case phi (maths italic)
 \string=\glshex 1D719% lower case phi variant (maths italic)
 \string<\glshex 1D712% lower case chi (maths italic)
 \string<\glshex 1D713% lower case psi (maths italic)
 \string<\glshex 1D714% lower case omega (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathGreekIrules}
%\changes{1.27}{2018-02-26}{new}
%Includes both upright and italic with digamma between epsilon and
%zeta.
%    \begin{macrocode}
\newcommand*{\glsxtrMathGreekIrules}{%
 \glsxtrMathItalicAlpha
 \string;\glsxtrUpAlpha
 \string<\glsxtrMathItalicBeta
 \string;\glsxtrUpBeta
 \string<\glsxtrMathItalicGamma
 \string;\glsxtrUpGamma
 \string<\glsxtrMathItalicDelta
 \string;\glsxtrUpDelta
 \string<\glsxtrMathItalicEpsilon
 \string;\glsxtrUpEpsilon
 \string<\glsxtrUpDigamma
 \string<\glsxtrMathItalicZeta
 \string;\glsxtrUpZeta
 \string<\glsxtrMathItalicEta
 \string;\glsxtrUpEta
 \string<\glsxtrMathItalicTheta
 \string;\glsxtrUpTheta
 \string<\glsxtrMathItalicIota
 \string;\glsxtrUpIota
 \string<\glsxtrMathItalicKappa
 \string;\glsxtrUpKappa
 \string<\glsxtrMathItalicLambda
 \string;\glsxtrUpLambda
 \string<\glsxtrMathItalicMu
 \string;\glsxtrUpMu
 \string<\glsxtrMathItalicNu
 \string;\glsxtrUpNu
 \string<\glsxtrMathItalicXi
 \string;\glsxtrUpXi
 \string<\glsxtrMathItalicOmicron
 \string;\glsxtrUpOmicron
 \string<\glsxtrMathItalicPi
 \string;\glsxtrUpPi
 \string<\glsxtrMathItalicRho
 \string;\glsxtrUpRho
 \string<\glsxtrMathItalicSigma
 \string;\glsxtrUpSigma
 \string<\glsxtrMathItalicTau
 \string;\glsxtrUpTau
 \string<\glsxtrMathItalicUpsilon
 \string;\glsxtrUpUpsilon
 \string<\glsxtrMathItalicPhi
 \string;\glsxtrUpPhi
 \string<\glsxtrMathItalicChi
 \string;\glsxtrUpChi
 \string<\glsxtrMathItalicPsi
 \string;\glsxtrUpPsi
 \string<\glsxtrMathItalicOmega
 \string;\glsxtrUpOmega
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathGreekIIrules}
%\changes{1.27}{2018-02-26}{new}
%Includes both upright and italic (digamma not included).
%    \begin{macrocode}
\newcommand*{\glsxtrMathGreekIIrules}{%
 \glsxtrMathItalicAlpha
 \string;\glsxtrUpAlpha
 \string<\glsxtrMathItalicBeta
 \string;\glsxtrUpBeta
 \string<\glsxtrMathItalicGamma
 \string;\glsxtrUpGamma
 \string<\glsxtrMathItalicDelta
 \string;\glsxtrUpDelta
 \string<\glsxtrMathItalicEpsilon
 \string;\glsxtrUpEpsilon
 \string<\glsxtrMathItalicZeta
 \string;\glsxtrUpZeta
 \string<\glsxtrMathItalicEta
 \string;\glsxtrUpEta
 \string<\glsxtrMathItalicTheta
 \string;\glsxtrUpTheta
 \string<\glsxtrMathItalicIota
 \string;\glsxtrUpIota
 \string<\glsxtrMathItalicKappa
 \string;\glsxtrUpKappa
 \string<\glsxtrMathItalicLambda
 \string;\glsxtrUpLambda
 \string<\glsxtrMathItalicMu
 \string;\glsxtrUpMu
 \string<\glsxtrMathItalicNu
 \string;\glsxtrUpNu
 \string<\glsxtrMathItalicXi
 \string;\glsxtrUpXi
 \string<\glsxtrMathItalicOmicron
 \string;\glsxtrUpOmicron
 \string<\glsxtrMathItalicPi
 \string;\glsxtrUpPi
 \string<\glsxtrMathItalicRho
 \string;\glsxtrUpRho
 \string<\glsxtrMathItalicSigma
 \string;\glsxtrUpSigma
 \string<\glsxtrMathItalicTau
 \string;\glsxtrUpTau
 \string<\glsxtrMathItalicUpsilon
 \string;\glsxtrUpUpsilon
 \string<\glsxtrMathItalicPhi
 \string;\glsxtrUpPhi
 \string<\glsxtrMathItalicChi
 \string;\glsxtrUpChi
 \string<\glsxtrMathItalicPsi
 \string;\glsxtrUpPsi
 \string<\glsxtrMathItalicOmega
 \string;\glsxtrUpOmega
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpAlpha}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpAlpha}{%
 \glshex 03B1,% lower case alpha
 \glshex 0391% upper case alpha
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpBeta}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpBeta}{%
 \glshex 03B2,% lower case beta
 \glshex 0392% upper case beta
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpGamma}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpGamma}{%
 \glshex 03B3,% lower case gamma
 \glshex 0393% upper case gamma
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpDelta}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpDelta}{%
 \glshex 03B4,% lower case delta
 \glshex 0394% upper case delta
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpEpsilon}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpEpsilon}{%
 \glshex 03B5% lower case epsilon
 \string=\glshex 03F5,% lower case epsilon variant
 \glshex 0395% upper case epsilon
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpDigamma}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpDigamma}{%
 \glshex 03DD,% lower case digamma
 \glshex 03DC% upper case digamma
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpZeta}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpZeta}{%
 \glshex 03B6,% lower case zeta
 \glshex 0396% upper case zeta
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpEta}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpEta}{%
 \glshex 03B7,% lower case eta
 \glshex 0397% upper case eta
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpTheta}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpTheta}{%
 \glshex 03B8% lower case theta
 \string=\glshex 03D1,% lower case theta variant
 \glshex 0398% upper case theta
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpIota}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpIota}{%
 \glshex 03B9,% lower case iota
 \glshex 0399% upper case iota
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpKappa}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpKappa}{%
 \glshex 03BA% lower case kappa
 \string=\glshex 03F0,% lower case kappa variant
 \glshex 039A% upper case kappa
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpLambda}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpLambda}{%
 \glshex 03BB,% lower lambda
 \glshex 039B% upper case lambda
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpMu}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpMu}{%
 \glshex 03BC,% lower case mu
 \glshex 039C% upper case mu
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpNu}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpNu}{%
 \glshex 03BD,% lower case nu
 \glshex 039D% upper case nu
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpXi}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpXi}{%
 \glshex 03BE,% lower case xi
 \glshex 039E% upper case xi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpOmicron}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpOmicron}{%
 \glshex 03BF,% lower case omicron
 \glshex 039F% upper case omicron
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpPi}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpPi}{%
 \glshex 03C0% lower case pi
 \string=\glshex 03D6,% lower case pi variant
 \glshex 03A0% upper case pi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpRho}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpRho}{%
 \glshex 03C1% lower case rho
 \string=\glshex 03F1,% lower case rho variant
 \glshex 03A1% upper case rho
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpSigma}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpSigma}{%
 \glshex 03C2% lower case sigma
 \string=\glshex 03C3,% lower case sigma
 \glshex 03A3% upper case sigma
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpTau}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpTau}{%
 \glshex 03C4,% lower case tau
 \glshex 03A4% upper case tau
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpUpsilon}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpUpsilon}{%
 \glshex 03C5,% lower case upsilon
 \glshex 03A5% upper case upsilon
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpPhi}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpPhi}{%
 \glshex 03C6% lower case phi
 \string=\glshex 03D5,% lower case phi variant
 \glshex 03A6% upper case phi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpChi}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpChi}{%
 \glshex 03C7,% lower case chi
 \glshex 03A7% upper case chi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpPsi}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpPsi}{%
 \glshex 03C8,% lower case psi
 \glshex 03A8% upper case psi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrUpOmega}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrUpOmega}{%
 \glshex 03C9,% lower case omega
 \glshex 03A9% upper case omega
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicAlpha}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicAlpha}{%
 \glshex 1D6FC,% lower case alpha (maths italic)
 \glshex 1D6E2% upper case alpha (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicBeta}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicBeta}{%
 \glshex 1D6FD,% lower case beta (maths italic)
 \glshex 1D6E3% upper case beta (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicGamma}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicGamma}{%
 \glshex 1D6FE,% lower case gamma (maths italic)
 \glshex 1D6E4% upper case gamma (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicDelta}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicDelta}{%
 \glshex 1D6FF,% lower case delta (maths italic)
 \glshex 1D6E5% upper case delta (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicEpsilon}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicEpsilon}{%
 \glshex 1D700% lower case epsilon (maths italic)
 \string=\glshex 1D716,% lower case epsilon variant (maths italic)
 \glshex 1D6E6% upper case epsilon (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicZeta}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicZeta}{%
 \glshex 1D701,% lower case zeta (maths italic)
 \glshex 1D6E7% upper case zeta (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicEta}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicEta}{%
 \glshex 1D702,% lower case eta (maths italic)
 \glshex 1D6E8% upper case eta (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicTheta}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicTheta}{%
 \glshex 1D703% lower case theta (maths italic)
 \string=\glshex 1D717,% lower case theta variant (maths italic)
 \glshex 1D6E9% upper case theta (maths italic)
 \string=\glshex 1D6F3% upper case theta variant (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicIota}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicIota}{%
 \glshex 1D704,% lower case iota (maths italic)
 \glshex 1D6EA% upper case iota (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicKappa}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicKappa}{%
 \glshex 1D705% lower case kappa (maths italic)
 \string=\glshex 1D718,% lower case kappa variant (maths italic)
 \glshex 1D6EB% upper case kappa (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicLambda}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicLambda}{%
 \glshex 1D706,% lower case lambda (maths italic)
 \glshex 1D6EC% upper case lambda (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicMu}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicMu}{%
 \glshex 1D707,% lower case mu (maths italic)
 \glshex 1D6ED% upper case mu (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicNu}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicNu}{%
 \glshex 1D708,% lower case nu (maths italic)
 \glshex 1D6EE% upper case nu (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicXi}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicXi}{%
 \glshex 1D709,% lower case xi (maths italic)
 \glshex 1D6EF% upper case xi (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicOmicron}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicOmicron}{%
 \glshex 1D70A,% lower case omicron (maths italic)
 \glshex 1D6F0% upper case omicron (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicPi}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicPi}{%
 \glshex 1D70B% lower case pi (maths italic)
 \string=\glshex 1D71B,% lower case pi variant (maths italic)
 \glshex 1D6F1% upper case pi (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicRho}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicRho}{%
 \glshex 1D70C% lower case rho (maths italic)
 \string=\glshex 1D71A,% lower case rho variant (maths italic)
 \glshex 1D6F2% upper case rho (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicSigma}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicSigma}{%
 \glshex 1D70D% lower case final sigma (maths italic)
 \string=\glshex 1D70E,% lower case sigma (maths italic)
 \glshex 1D6F4% upper case sigma (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicTau}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicTau}{%
 \glshex 1D70F,% lower case tau (maths italic)
 \glshex 1D6F5% upper case tau (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicUpsilon}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicUpsilon}{%
 \glshex 1D710,% lower case upsilon (maths italic)
 \glshex 1D6F6% upper case upsilon (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicPhi}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicPhi}{%
 \glshex 1D711% lower case phi (maths italic)
 \string=\glshex 1D719,% lower case phi variant (maths italic)
 \glshex 1D6F7% upper case phi (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicChi}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicChi}{%
 \glshex 1D712,% lower case chi (maths italic)
 \glshex 1D6F8% upper case chi (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicPsi}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicPsi}{%
 \glshex 1D713,% lower case psi (maths italic)
 \glshex 1D6F9% upper case psi (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicOmega}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicOmega}{%
 \glshex 1D714,% lower case omega (maths italic)
 \glshex 1D6FA% upper case omega (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicPartial}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicPartial}{%
 \glshex 1D715% partial differential (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrMathItalicNabla}
%\changes{1.27}{2018-02-26}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrMathItalicNabla}{%
 \glshex 1D6FB% nabla (maths italic)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrdigitrules}
%\changes{1.27}{2018-02-26}{new}
%Digits from the Basic Latin set and subscript and superscript digit
%rules.
%    \begin{macrocode}
\newcommand*{\glsxtrdigitrules}{%
 0\string=\glshex 2080\string=\glshex 2070
 \string<1\string=\glshex 2081\string=\glshex 00B9
 \string<2\string=\glshex 2082\string=\glshex 00B2
 \string<3\string=\glshex 2083\string=\glshex 00B3
 \string<4\string=\glshex 2084\string=\glshex 2074
 \string<5\string=\glshex 2085\string=\glshex 2075
 \string<6\string=\glshex 2086\string=\glshex 2076
 \string<7\string=\glshex 2087\string=\glshex 2077
 \string<8\string=\glshex 2088\string=\glshex 2078
 \string<9\string=\glshex 2089\string=\glshex 2079
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrBasicDigitrules}
%\changes{1.27}{2018-02-26}{new}
%Digits from the Basic Latin set.
%    \begin{macrocode}
\newcommand*{\glsxtrBasicDigitrules}{%
 0\string<1\string<2\string<3\string<4%
 \string<5\string<6\string<7\string<8\string<9%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrSubScriptDigitrules}
%\changes{1.27}{2018-02-26}{new}
%Subscript digits.
%    \begin{macrocode}
\newcommand*{\glsxtrSubScriptDigitrules}{%
 \glshex 2080% subscript 0
 \string<\glshex 2081% subscript 1
 \string<\glshex 2082% subscript 2
 \string<\glshex 2083% subscript 3
 \string<\glshex 2084% subscript 4
 \string<\glshex 2085% subscript 5
 \string<\glshex 2086% subscript 6
 \string<\glshex 2087% subscript 7
 \string<\glshex 2088% subscript 8
 \string<\glshex 2089% subscript 9
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrSuperScriptDigitrules}
%\changes{1.27}{2018-02-26}{new}
%Superscript digits.
%    \begin{macrocode}
\newcommand*{\glsxtrSuperScriptDigitrules}{%
 \glshex 2070% superscript 0
 \string<\glshex 00B9% superscript 1
 \string<\glshex 00B2% superscript 2
 \string<\glshex 00B3% superscript 3
 \string<\glshex 2074% superscript 4
 \string<\glshex 2075% superscript 5
 \string<\glshex 2076% superscript 6
 \string<\glshex 2077% superscript 7
 \string<\glshex 2078% superscript 8
 \string<\glshex 2079% superscript 9
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrfractionrules}
%\changes{1.27}{2018-02-26}{new}
%Vulgar fractions.
%    \begin{macrocode}
\newcommand*{\glsxtrfractionrules}{%
 \glshex 215F% fraction numerator one (1/)
 \string<\glshex 2189% zero thirds (0/3 = 0)
 \string<\glshex 2152% one tenth (1/10 = 0.1)
 \string<\glshex 2151% one ninth (1/9 ~ 0.111)
 \string<\glshex 215B% one eighth (1/8 = 0.125)
 \string<\glshex 2150% one seventh (1/7 ~ 0.143)
 \string<\glshex 2159% one sixth (1/6 ~ 0.167)
 \string<\glshex 2155% one fifth (1/5 = 0.2)
 \string<\glshex 00BC% one quarter (1/4 = 0.25)
 \string<\glshex 2153% one third (1/3 ~ 0.333)
 \string<\glshex 215C% three eighths (3/8 = 0.375)
 \string<\glshex 2156% two fifths (2/5 = 0.4)
 \string<\glshex 00BD% one half (1/2 = 0.5)
 \string<\glshex 2157% three fifths (3/5 = 0.6)
 \string<\glshex 215D% five eighths (5/8 = 0.625)
 \string<\glshex 2154% two thirds (2/3 ~ 0.667)
 \string<\glshex 00BE% three quarters (3/4 = 0.75)
 \string<\glshex 2158% four fifths (4/5 = 0.8)
 \string<\glshex 215A% five sixths (5/6 ~ 0.833)
 \string<\glshex 215E% seven eighths (7/8 = 0.875)
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsxtrdialecthook}
%Check for scripts associated with the document dialects.
%\changes{1.28}{2018-03-06}{save and restore \cs{TrackLangRequireDialectPrefix}}
%    \begin{macrocode}
\renewcommand{\@glsxtrdialecthook}{%
  \ifundef\CurrentTrackedScript
  {%
    \TrackLangIfHasDefaultScript{\CurrentTrackedLanguage}%
    {%
     \edef\CurrentTrackedScript{%
       \TrackLangGetDefaultScript\CurrentTrackedLanguage}%
    }%
    {}%
  }%
  {}%
  \ifdef\CurrentTrackedScript
  {%
    \let\gls@orgTrackLangRequireDialectPrefix\TrackLangRequireDialectPrefix
    \def\TrackLangRequireDialectPrefix{glossariesxtr-}%
    \let\CurrentTrackedTag\CurrentTrackedScript
    \IfFileExists{\TrackLangRequireDialectPrefix\CurrentTrackedTag.ldf}
    {\RequireGlossariesExtraLang{\CurrentTrackedTag}}%
    {}%
    \let\TrackLangRequireDialectPrefix\gls@orgTrackLangRequireDialectPrefix
  }%
  {}%
}
%    \end{macrocode}
%\end{macro}
%If \cs{glsxtr@loaddialect} has been defined, then
%\sty{glossaries-extra-bib2gls} has been loaded after
%\sty{glossaries-extra}. (For example, through
%\ics{glossariesextrasetup}.) Not recommended, but if this has been
%done try to find the associated language resources.
%    \begin{macrocode}
\ifdef\glsxtr@loaddialect
{%
  \@ifpackageloaded{tracklang}
  {%
    \AnyTrackedLanguages
    {%
      \ForEachTrackedDialect{\this@dialect}{\glsxtr@loaddialect}%
    }%
    {}%
  }
  {}
}
{}
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-extra-bib2gls.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-extra-stylemods.sty>
%    \end{macrocode}
%\fi
%\chapter{Style Adjustments (\styfmt{glossaries-extra-stylemods.sty})}
% This package adjusts the predefined styles so that they include the post
% description hook. Also, some other minor adjustments may be made
% to make existing styles more flexible.
%
%\section{Package Initialisation}
% First identify package:
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{glossaries-extra-stylemods}[2018/05/09 v1.31 (NLCT)]
%    \end{macrocode}
% Provide package options to automatically load required predefined
% styles. The simplest method is to just test for the existence of
% the file \texttt{glossary-}\meta{option}\texttt{.sty}. Packages
% can't be loaded whilst the options are being processed, so save
% the list in \cs{@glsxtr@loadstyles}.
%\begin{macro}{\@glsxtr@loadstyles}
%    \begin{macrocode}
\newcommand*{\@glsxtr@loadstyles}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{all}
%\changes{1.21}{2017-11-03}{new}
%Provide all known styles.
%    \begin{macrocode}
\DeclareOption{all}{%
  \appto\@glsxtr@loadstyles{%
    \RequirePackage{glossary-inline}%
    \RequirePackage{glossary-list}%
    \RequirePackage{glossary-tree}%
    \RequirePackage{glossary-mcols}%
    \RequirePackage{glossary-long}%
    \RequirePackage{glossary-longragged}%
    \RequirePackage{glossary-longbooktabs}%
    \RequirePackage{glossary-super}%
    \RequirePackage{glossary-superragged}%
    \RequirePackage{glossary-bookindex}%
  }
}
%    \end{macrocode}
%\end{option}
%
%    \begin{macrocode}
\DeclareOption*{%
  \IfFileExists{glossary-\CurrentOption.sty}
   {\eappto\@glsxtr@loadstyles{%
      \noexpand\RequirePackage{glossary-\CurrentOption}}%
   }%
   {%
     \PackageError{glossaries-extra-styles}%
     {Unknown option `\CurrentOption'}{}%
   }%
}
%    \end{macrocode}
% Process the package options:
%    \begin{macrocode}
\ProcessOptions
%    \end{macrocode}
%
% Load the required packages:
%    \begin{macrocode}
\@glsxtr@loadstyles
%    \end{macrocode}
% Adjust the styles so that they all have the post description hook.
% Also, instead of having a hard-coded \cs{space} before the
% location, use:
%\begin{macro}{\glsxtrprelocation}
%\changes{1.21}{2017-11-03}{new}
%This uses \cs{providecommand} as the same command is also
%provided by \sty{glossary-bookindex}.
%    \begin{macrocode}
\providecommand*{\glsxtrprelocation}{\space}
%    \end{macrocode}
%\end{macro}
%
%In case we have an old version of \sty{glossaries}:
%\begin{macro}{\renewglossarystyle}
%    \begin{macrocode}
\providecommand{\renewglossarystyle}[2]{%
  \ifcsundef{@glsstyle@#1}%
  {%
    \PackageError{glossaries-extra}{Glossary style `#1' isn't already defined}{}%
  }%
  {%
    \csdef{@glsstyle@#1}{#2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\section{List-Like Styles}
% The list-like styles mostly already use the post description hook.
% Only the \glostyle{listdotted} style need modifying to add this.
%    \begin{macrocode}
\ifdef{\@glsstyle@listdotted}
{%
 \renewglossarystyle{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}\glspostdescription}%
   \renewcommand*{\subglossentry}[3]{%
    \item[]\makebox[\glslistdottedwidth][l]{%
    \glssubentryitem{##2}%
    \glstarget{##2}{\glossentryname{##2}}%
    \unskip\leaders\hbox to 2.9mm{\hss.}\hfill\strut}%
    \glossentrydesc{##2}\glspostdescription}%
 }
}
{%
%    \end{macrocode}
% Assume the style isn't required if it hasn't already been defined.
%    \begin{macrocode}
}
%    \end{macrocode}
% The \glostyle{sublistdotted} style doesn't display the description
% for top-level entries. Sub-level entries use the
% \glostyle{listdottedstyle}.
%
%The other list styles would be easier to adapt if the space
%before the number list wasn't hard coded.
%\changes{1.21}{2017-11-03}{modified list to remove hard coded \cs{space}}
%    \begin{macrocode}
\ifdef{\@glsstyle@list}
{%
%    \end{macrocode}
%\begin{macro}{\glslistprelocation}
%\changes{1.21}{2017-11-03}{new}
%Space before number list for top-level entries.
%    \begin{macrocode}
  \newcommand{\glslistprelocation}{\glsxtrprelocation}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glslistchildprelocation}
%\changes{1.21}{2017-11-03}{new}
%Space before number list for child entries.
%    \begin{macrocode}
  \newcommand{\glslistchildprelocation}{\glslistprelocation}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glslistchildpostlocation}
%\changes{1.21}{2017-11-03}{new}
%Full stop after number list.
%    \begin{macrocode}
  \newcommand{\glslistchildpostlocation}{.}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glslistdesc}
%\changes{1.31}{2018-05-09}{new}
%    \begin{macrocode}
  \newcommand{\glslistdesc}[1]{\glossentrydesc{#1}\glspostdescription}
%    \end{macrocode}
%\end{macro}
%Redefine \glostyle{list} to use these commands.
%    \begin{macrocode}
  \renewglossarystyle{list}{%
    \renewenvironment{theglossary}%
      {\begin{description}}{\end{description}}%
    \renewcommand*{\glossaryheader}{}%
    \renewcommand*{\glsgroupheading}[1]{}%
    \renewcommand*{\glossentry}[2]{%
      \item[\glsentryitem{##1}%
            \glstarget{##1}{\glossentryname{##1}}]
        \glslistdesc{##1}\glslistprelocation ##2}%
    \renewcommand*{\subglossentry}[3]{%
      \glssubentryitem{##2}%
      \glstarget{##2}{\strut}\space
      \glslistdesc{##2}%
      \glslistchildprelocation ##3\glslistchildpostlocation}%
    \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}%
  }
}
{}
%    \end{macrocode}
%Similarly for \glostyle{altlist}. Since it requires \glostyle{list},
%the new commands should have been defined above.
%    \begin{macrocode}
\ifdef{\@glsstyle@altlist}
{%
  \renewglossarystyle{altlist}{%
    \setglossarystyle{list}%
    \renewcommand*{\glossentry}[2]{%
      \item[\glsentryitem{##1}%
        \glstarget{##1}{\glossentryname{##1}}]%
      \mbox{}\par\nobreak\@afterheading
      \glslistdesc{##1}\glslistprelocation ##2}%
    \renewcommand{\subglossentry}[3]{%
      \par
      \glssubentryitem{##2}%
      \glstarget{##2}{\strut}\glslistdesc{##2}%
      \glslistchildprelocation ##3}%
  }
}
{}
%    \end{macrocode}
%Redefine \glostyle{listgroup} so that it discourages a break
%after group headings.
%\changes{1.21}{2017-11-03}{redefined \texttt{listgroup} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@listgroup}
{%
  \renewglossarystyle{listgroup}{%
    \setglossarystyle{list}%
    \renewcommand*{\glsgroupheading}[1]{%
      \item[\glslistgroupheaderfmt{\glsgetgrouptitle{##1}}]%
      \mbox{}\par\nobreak\@afterheading
    }%
  }
}
{}
%    \end{macrocode}
%Similarly for \glostyle{listhypergroup}.
%\changes{1.21}{2017-11-03}{redefined \texttt{listhypergroup} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@listhypergroup}
{%
  \renewglossarystyle{listhypergroup}{%
    \setglossarystyle{list}%
    \renewcommand*{\glossaryheader}{%
      \glslistnavigationitem{\glsnavigation}}%
    \renewcommand*{\glsgroupheading}[1]{%
      \item[\glslistgroupheaderfmt
            {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}]%
      \mbox{}\par\nobreak\@afterheading
    }%
  }
}
{}
%    \end{macrocode}
%Similarly for \glostyle{altlistgroup}.
%\changes{1.21}{2017-11-03}{redefined \texttt{altlistgroup} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@altlistgroup}
{%
  \renewglossarystyle{altlistgroup}{%
    \setglossarystyle{altlist}%
    \renewcommand*{\glsgroupheading}[1]{%
      \item[\glslistgroupheaderfmt{\glsgetgrouptitle{##1}}]%
      \mbox{}\par\nobreak\@afterheading
    }%
  }
}
{}
%    \end{macrocode}
%Similarly for \glostyle{altlisthypergroup}.
%\changes{1.21}{2017-11-03}{redefined \texttt{altlisthypergroup} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@altlisthypergroup}
{%
  \renewglossarystyle{altlisthypergroup}{%
    \setglossarystyle{altlist}%
    \renewcommand*{\glossaryheader}{%
      \glslistnavigationitem{\glsnavigation}}%
    \renewcommand*{\glsgroupheading}[1]{%
      \item[\glslistgroupheaderfmt
        {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}]%
      \mbox{}\par\nobreak\@afterheading
    }%
  }
}
{}
%    \end{macrocode}
%
%\section{Longtable Styles}
% The three and four column styles require adjustment to add the
% post-description hook. The two column styles need the hard-coded
% \cs{space} changed to \cs{glsxtrprelocation}.
%    \begin{macrocode}
\ifcsdef{@glsstyle@long}
{%
  \renewglossarystyle{long}{%
    \renewenvironment{theglossary}%
       {\begin{longtable}{lp{\glsdescwidth}}}%
       {\end{longtable}}%
    \renewcommand*{\glossaryheader}{}%
    \renewcommand*{\glsgroupheading}[1]{}%
    \renewcommand{\glossentry}[2]{%
      \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
      \glossentrydesc{##1}\glspostdescription
      \glsxtrprelocation ##2\tabularnewline
    }%
    \renewcommand{\subglossentry}[3]{%
       &
       \glssubentryitem{##2}%
       \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription
       \glsxtrprelocation ##3\tabularnewline
    }%
    \ifglsnogroupskip
      \renewcommand*{\glsgroupskip}{}%
    \else
      \renewcommand*{\glsgroupskip}{ & \tabularnewline}%
    \fi
  }
}
{}
%    \end{macrocode}
%Three column style:
%    \begin{macrocode}
\ifcsdef{@glsstyle@long3col}
{%
  \renewglossarystyle{long3col}{%
    \renewenvironment{theglossary}%
      {\begin{longtable}{lp{\glsdescwidth}p{\glspagelistwidth}}}%
      {\end{longtable}}%
    \renewcommand*{\glossaryheader}{}%
    \renewcommand*{\glsgroupheading}[1]{}%
    \renewcommand{\glossentry}[2]{%
      \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
      \glossentrydesc{##1}\glspostdescription & ##2\tabularnewline
    }%
    \renewcommand{\subglossentry}[3]{%
       &
       \glssubentryitem{##2}%
       \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription &
       ##3\tabularnewline
    }%
%    \end{macrocode}
%Conditional needs to be outside of \cs{glsgroupskip} otherwise it
%can cause \qt{Incomplete \cs{iftrue}} errors.
%\changes{1.21}{2017-11-03}{moved conditional outside of \cs{glsgroupskip}}
%    \begin{macrocode}
    \ifglsnogroupskip
      \renewcommand*{\glsgroupskip}{}%
    \else
      \renewcommand*{\glsgroupskip}{& &\tabularnewline}%
    \fi
  }
}
{}
%    \end{macrocode}
% Four column style:
%    \begin{macrocode}
\ifcsdef{@glsstyle@long4col}
{%
  \renewglossarystyle{long4col}{%
    \renewenvironment{theglossary}%
      {\begin{longtable}{llll}}%
      {\end{longtable}}%
    \renewcommand*{\glossaryheader}{}%
    \renewcommand*{\glsgroupheading}[1]{}%
    \renewcommand{\glossentry}[2]{%
      \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
      \glossentrydesc{##1}\glspostdescription &
      \glossentrysymbol{##1} &
      ##2\tabularnewline
    }%
    \renewcommand{\subglossentry}[3]{%
       &
       \glssubentryitem{##2}%
       \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription &
       \glossentrysymbol{##2} & ##3\tabularnewline
    }%
%    \end{macrocode}
%\changes{1.21}{2017-11-03}{moved conditional outside of \cs{glsgroupskip}}
%    \begin{macrocode}
    \ifglsnogroupskip
      \renewcommand*{\glsgroupskip}{}%
    \else 
      \renewcommand*{\glsgroupskip}{& & &\tabularnewline}%
    \fi
  }
}
{}
%    \end{macrocode}
%
%The styles in \sty{glossary-longbooktabs} are all based on the
%styles in \sty{glossary-long}, so no adjustments are needed for
%that package.
%
%\section{Long Ragged Styles}
% The three and four column styles require adjustment for the
% post-description hook, but not the two column styles. However, the
% two-column styles need to have \cs{space} replaced with
% \cs{glsxtrprelocation}.
%    \begin{macrocode}
\ifcsdef{@glsstyle@longragged}
{%
  \renewglossarystyle{longragged}{%
    \renewenvironment{theglossary}%
       {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}}}%
       {\end{longtable}}%
    \renewcommand*{\glossaryheader}{}%
    \renewcommand*{\glsgroupheading}[1]{}%
    \renewcommand{\glossentry}[2]{%
      \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
      \glossentrydesc{##1}\glspostdescription\glsxtrprelocation ##2%
      \tabularnewline
    }%
    \renewcommand{\subglossentry}[3]{%
       &
       \glssubentryitem{##2}%
       \glstarget{##2}{\strut}\glossentrydesc{##2}%
       \glspostdescription\glsxtrprelocation ##3%
       \tabularnewline
    }%
    \ifglsnogroupskip
      \renewcommand*{\glsgroupskip}{}%
    \else
      \renewcommand*{\glsgroupskip}{ & \tabularnewline}%
    \fi
  }
}
{}
%    \end{macrocode}
%Three and four column styles don't use \cs{glsxtrprelocation} since the number
%list is in its own column.
%    \begin{macrocode}
\ifcsdef{@glsstyle@longragged3col}
{%
  \renewglossarystyle{longragged3col}{%
    \renewenvironment{theglossary}%
      {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}%
         >{\raggedright}p{\glspagelistwidth}}}%
      {\end{longtable}}%
    \renewcommand*{\glossaryheader}{}%
    \renewcommand*{\glsgroupheading}[1]{}%
    \renewcommand{\glossentry}[2]{%
      \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
      \glossentrydesc{##1}\glspostdescription & ##2\tabularnewline
    }%
    \renewcommand{\subglossentry}[3]{%
       &
       \glssubentryitem{##2}%
       \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription &
       ##3\tabularnewline
    }%
%    \end{macrocode}
%\changes{1.21}{2017-11-03}{moved conditional outside of \cs{glsgroupskip}}
%    \begin{macrocode}
    \ifglsnogroupskip
      \renewcommand*{\glsgroupskip}{}%
    \else 
      \renewcommand*{\glsgroupskip}{& &\tabularnewline}%
    \fi
  }
}
{}
%    \end{macrocode}
% Four column style:
%    \begin{macrocode}
\ifcsdef{@glsstyle@altlongragged4col}
{%
  \renewglossarystyle{altlongragged4col}{%
    \renewenvironment{theglossary}%
      {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}l%
         >{\raggedright}p{\glspagelistwidth}}}%
      {\end{longtable}}%
    \renewcommand*{\glossaryheader}{}%
    \renewcommand*{\glsgroupheading}[1]{}%
    \renewcommand{\glossentry}[2]{%
      \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
      \glossentrydesc{##1}\glspostdescription & \glossentrysymbol{##1} &
      ##2\tabularnewline
    }%
    \renewcommand{\subglossentry}[3]{%
       &
       \glssubentryitem{##2}%
       \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription &
       \glossentrysymbol{##2} & ##3\tabularnewline
    }%
%    \end{macrocode}
%\changes{1.21}{2017-11-03}{moved conditional outside of \cs{glsgroupskip}}
%    \begin{macrocode}
    \ifglsnogroupskip
      \renewcommand*{\glsgroupskip}{}%
    \else 
      \renewcommand*{\glsgroupskip}{& & &\tabularnewline}%
    \fi
  }
}
{}
%    \end{macrocode}
%
%\section{Supertabular Styles}
% The three and four column styles require adjustment to add the
% post-description hook. The two column styles need the hard-coded
% \cs{space} changed to \cs{glsxtrprelocation}.
%    \begin{macrocode}
\ifcsdef{@glsstyle@super}
{%
  \renewglossarystyle{super}{%
    \renewenvironment{theglossary}%
      {\tablehead{}\tabletail{}%
       \begin{supertabular}{lp{\glsdescwidth}}}%
      {\end{supertabular}}%
    \renewcommand*{\glossaryheader}{}%
    \renewcommand*{\glsgroupheading}[1]{}%
    \renewcommand{\glossentry}[2]{%
      \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
      \glossentrydesc{##1}\glspostdescription
      \glsxtrprelocation ##2\tabularnewline
    }%
    \renewcommand{\subglossentry}[3]{%
       &
       \glssubentryitem{##2}%
       \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription
       \glsxtrprelocation ##3\tabularnewline
    }%
    \ifglsnogroupskip
      \renewcommand*{\glsgroupskip}{}%
    \else
      \renewcommand*{\glsgroupskip}{& \tabularnewline}%
    \fi
  }
}
{}
%    \end{macrocode}
%Three column style:
%    \begin{macrocode}
\ifcsdef{@glsstyle@super3col}
{%
  \renewglossarystyle{super3col}{%
    \renewenvironment{theglossary}%
      {\tablehead{}\tabletail{}%
       \begin{supertabular}{lp{\glsdescwidth}p{\glspagelistwidth}}}%
      {\end{supertabular}}%
    \renewcommand*{\glossaryheader}{}%
    \renewcommand*{\glsgroupheading}[1]{}%
    \renewcommand{\glossentry}[2]{%
      \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
      \glossentrydesc{##1}\glspostdescription & ##2\tabularnewline
    }%
    \renewcommand{\subglossentry}[3]{%
       &
       \glssubentryitem{##2}%
       \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription &
       ##3\tabularnewline
    }%
%    \end{macrocode}
%\changes{1.21}{2017-11-03}{moved conditional outside of \cs{glsgroupskip}}
%    \begin{macrocode}
    \ifglsnogroupskip
      \renewcommand*{\glsgroupskip}{}%
    \else 
      \renewcommand*{\glsgroupskip}{ & &\tabularnewline}%
    \fi
  }
}
{}
%    \end{macrocode}
% Four column styles:
%    \begin{macrocode}
\ifcsdef{@glsstyle@super4col}
{%
  \renewglossarystyle{super4col}{%
    \renewenvironment{theglossary}%
      {\tablehead{}\tabletail{}%
       \begin{supertabular}{llll}}{%
       \end{supertabular}}%
    \renewcommand*{\glossaryheader}{}%
    \renewcommand*{\glsgroupheading}[1]{}%
    \renewcommand{\glossentry}[2]{%
      \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
      \glossentrydesc{##1}\glspostdescription &
      \glossentrysymbol{##1} & ##2\tabularnewline
    }%
    \renewcommand{\subglossentry}[3]{%
       &
       \glssubentryitem{##2}%
       \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription &
       \glossentrysymbol{##2} & ##3\tabularnewline
    }%
%    \end{macrocode}
%\changes{1.21}{2017-11-03}{moved conditional outside of \cs{glsgroupskip}}
%    \begin{macrocode}
    \ifglsnogroupskip
      \renewcommand*{\glsgroupskip}{}%
    \else 
      \renewcommand*{\glsgroupskip}{& & &\tabularnewline}%
    \fi
  }
}
{}
%    \end{macrocode}
%
%\section{Super Ragged Styles}
% The three and four column styles require adjustment for the
% post-description hook, but not the two column styles. However, the
% two-column styles need to have \cs{space} replaced with
% \cs{glsxtrprelocation}.
%    \begin{macrocode}
\ifcsdef{@glsstyle@superragged}
{%
  \renewglossarystyle{superragged}{%
    \renewenvironment{theglossary}%
      {\tablehead{}\tabletail{}%
       \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}}}%
      {\end{supertabular}}%
    \renewcommand*{\glossaryheader}{}%
    \renewcommand*{\glsgroupheading}[1]{}%
    \renewcommand{\glossentry}[2]{%
      \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
      \glossentrydesc{##1}\glspostdescription\glsxtrprelocation ##2%
      \tabularnewline
    }%
    \renewcommand{\subglossentry}[3]{%
       &
       \glssubentryitem{##2}%
       \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription
       \glsxtrprelocation ##3%
       \tabularnewline
    }%
    \ifglsnogroupskip
      \renewcommand*{\glsgroupskip}{}%
    \else
      \renewcommand*{\glsgroupskip}{& \tabularnewline}%
    \fi
  }
}
{}
%    \end{macrocode}
%Three column style:
%    \begin{macrocode}
\ifcsdef{@glsstyle@superragged3col}
{%
  \renewglossarystyle{superragged3col}{%
    \renewenvironment{theglossary}%
      {\tablehead{}\tabletail{}%
       \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}%
          >{\raggedright}p{\glspagelistwidth}}}%
      {\end{supertabular}}%
    \renewcommand*{\glossaryheader}{}%
    \renewcommand*{\glsgroupheading}[1]{}%
    \renewcommand{\glossentry}[2]{%
      \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
      \glossentrydesc{##1}\glspostdescription &
      ##2\tabularnewline
    }%
    \renewcommand{\subglossentry}[3]{%
       &
       \glssubentryitem{##2}%
       \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription &
       ##3\tabularnewline
    }%
%    \end{macrocode}
%\changes{1.21}{2017-11-03}{moved conditional outside of \cs{glsgroupskip}}
%    \begin{macrocode}
    \ifglsnogroupskip
      \renewcommand*{\glsgroupskip}{}%
    \else
      \renewcommand*{\glsgroupskip}{ & &\tabularnewline}%
    \fi
  }
}
{}
%    \end{macrocode}
% Four columns:
%    \begin{macrocode}
\ifcsdef{@glsstyle@altsuperragged4col}
{%
  \renewglossarystyle{altsuperragged4col}{%
    \renewenvironment{theglossary}%
      {\tablehead{}\tabletail{}%
       \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}l%
         >{\raggedright}p{\glspagelistwidth}}}%
      {\end{supertabular}}%
    \renewcommand*{\glossaryheader}{}%
    \renewcommand{\glossentry}[2]{%
      \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
      \glossentrydesc{##1}\glspostdescription &
      \glossentrysymbol{##1} & ##2\tabularnewline
    }%
    \renewcommand{\subglossentry}[3]{%
       &
       \glssubentryitem{##2}%
       \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription &
       \glossentrysymbol{##2} & ##3\tabularnewline
    }%
%    \end{macrocode}
%\changes{1.21}{2017-11-03}{moved conditional outside of \cs{glsgroupskip}}
%    \begin{macrocode}
    \ifglsnogroupskip
      \renewcommand*{\glsgroupskip}{}%
    \else 
      \renewcommand*{\glsgroupskip}{& & &\tabularnewline}%
    \fi
  }
}
{}
%    \end{macrocode}
%
%\section{Inline Style}
% The \glostyle{inline} style is dealt with slightly differently.
% The \cs{glspostdescription} hook is actually in
% \cs{glspostinline}, which is called at the end of the glossary.
% The original definition of \cs{glspostinline} also includes a
% space, which is unnecessary. Here, instead of redefining the
% \glostyle{inline} style, just redefine \cs{glspostinline} and 
% \cs{glsinlinedescformat}.
%    \begin{macrocode}
\ifdef{\@glsstyle@inline}
{%
   \renewcommand*{\glspostinline}{.\spacefactor\sfcode`\.}
%    \end{macrocode}
% Just use \cs{glsxtrpostdescription} instead of
% \cs{glspostdescription}.
%    \begin{macrocode}
   \renewcommand*{\glsinlinedescformat}[3]{%
     \space#1\glsxtrpostdescription}
   \renewcommand*{\glsinlinesubdescformat}[3]{%
     #1\glsxtrpostdescription}
%    \end{macrocode}
% The default settings don't show the location lists, so there's no
% adjustment for \cs{glsxtrprelocation}.
%    \begin{macrocode}
}
{}
%    \end{macrocode}
%
%\section{Tree Styles}
% Redefine both \cs{glstreenamefmt} and \cs{glstreegroupheaderfmt}
% in terms of \cs{glstreedefaultnamefmt} to make it easier to change
% both at the same time or only change one without affecting the
% other.
%    \begin{macrocode}
\ifdef\glstreenamefmt
{
%    \end{macrocode}
%\begin{macro}{\glstreedefaultnamefmt}
%\changes{1.31}{2018-05-09}{new}
%    \begin{macrocode}
  \newcommand{\glstreedefaultnamefmt}[1]{\textbf{#1}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glstreenamefmt}
%\changes{1.31}{2018-05-09}{added redefinition}
%    \begin{macrocode}
  \renewcommand{\glstreenamefmt}[1]{\glstreedefaultnamefmt{#1}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glstreegroupheaderfmt}
%\changes{1.31}{2018-05-09}{added redefinition}
%This command was only introduced to \sty{glossary-tree} v4.22, so
%it may not be defined.
%    \begin{macrocode}
  \def\glstreegroupheaderfmt#1{\glstreedefaultnamefmt{#1}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glstreenavigationfmt}
%\changes{1.31}{2018-05-09}{added redefinition}
%This command was only introduced to \sty{glossary-tree} v4.22, so
%it may not be defined.
%    \begin{macrocode}
  \def\glstreenavigationfmt#1{\glstreedefaultnamefmt{#1}}
%    \end{macrocode}
%\end{macro}
%    \begin{macrocode}
}
{}
%    \end{macrocode}
% The \glostyle{index} style is redefined so that the space before
% the number list isn't hard coded.
%\changes{1.21}{2017-11-03}{modified index to remove hard coded \cs{space}}
%    \begin{macrocode}
\ifdef{\@glsstyle@index}
{
%    \end{macrocode}
%\begin{macro}{\glstreeprelocation}
%\changes{1.21}{2017-11-03}{new}
%The space before the number list for top-level entries. This is
%shared by the other tree styles.
%    \begin{macrocode}
  \newcommand*{\glstreeprelocation}{\glsxtrprelocation}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glstreechildprelocation}
%\changes{1.21}{2017-11-03}{new}
%The space before the number list for child entries. This is
%shared by the other tree styles.
%    \begin{macrocode}
  \newcommand*{\glstreechildprelocation}{\glstreeprelocation}
%    \end{macrocode}
%\end{macro}
%Modify the \glostyle{index} style.
%    \begin{macrocode}
  \renewglossarystyle{index}{%
    \renewenvironment{theglossary}%
      {\setlength{\parindent}{0pt}%
       \setlength{\parskip}{0pt plus 0.3pt}%
       \let\item\glstreeitem
       \let\subitem\glstreesubitem
       \let\subsubitem\glstreesubsubitem
      }%
    {\par}%
    \renewcommand*{\glossaryheader}{}%
    \renewcommand*{\glsgroupheading}[1]{}%
    \renewcommand*{\glossentry}[2]{%
       \item\glsentryitem{##1}%
       \glstreenamefmt{\glstarget{##1}{\glossentryname{##1}}}%
       \glstreesymbol{##1}%
       \glstreedesc{##1}%
       \glstreeprelocation ##2%
    }%
    \renewcommand{\subglossentry}[3]{%
      \ifcase##1\relax
        \item
      \or
        \subitem
        \glssubentryitem{##2}%
      \else
        \subsubitem
      \fi
      \glstreenamefmt{\glstarget{##2}{\glossentryname{##2}}}%
      \glstreechildsymbol{##2}%
      \glstreechilddesc{##2}%
      \glstreechildprelocation ##3%
    }%
    \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}%
  }
}
{}
%    \end{macrocode}
%
% The \glostyle{indexgroup} style is redefined to discourage a page
% break after the heading.
%\changes{1.21}{2017-11-03}{redefined \texttt{indexgroup} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@indexgroup}
{%
  \renewglossarystyle{indexgroup}{%
    \setglossarystyle{index}%
    \renewcommand*{\glsgroupheading}[1]{%
      \item\glstreegroupheaderfmt{\glsgetgrouptitle{##1}}%
      \nopagebreak\indexspace
      \nobreak\@afterheading
    }%
  }
}
{}
%    \end{macrocode}
%
%Similarly for \glostyle{indexhypergroup}.
%\changes{1.21}{2017-11-03}{redefined \texttt{indexhypergroup} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@indexhypergroup}
{%
  \renewglossarystyle{indexhypergroup}{%
    \setglossarystyle{index}%
    \renewcommand*{\glossaryheader}{%
      \item\glstreenavigationfmt{\glsnavigation}%
       \nobreak\@afterheading\indexspace}%
    \renewcommand*{\glsgroupheading}[1]{%
      \item\glstreegroupheaderfmt
        {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}%
      \nopagebreak\indexspace
      \nobreak\@afterheading}%
  }%
}
{}
%    \end{macrocode}
%
%Adjust \glostyle{tree} style to remove hard coded space before
%number list.
%    \begin{macrocode}
\ifdef{\@glsstyle@tree}
{%
%Provide a command for use with the \glostyle{tree} styles that displays
%the pre-description separator, the
%description and post-description hook.
%\begin{macro}{\glstreedesc}
%\changes{1.31}{2018-05-09}{new}
%    \begin{macrocode}
  \newcommand{\glstreedesc}[1]{%
    \glstreepredesc\glossentrydesc{#1}\glspostdescription
  }
%    \end{macrocode}
%\end{macro}
%Similarly for the symbol.
%\begin{macro}{\glstreesymbol}
%\changes{1.31}{2018-05-09}{new}
%    \begin{macrocode}
  \newcommand{\glstreesymbol}[1]{%
    \ifglshassymbol{#1}{\space(\glossentrysymbol{#1})}{}%
  }%
%    \end{macrocode}
%\end{macro}
%And for the child entries:
%\begin{macro}{\glstreechilddesc}
%\changes{1.31}{2018-05-09}{new}
%    \begin{macrocode}
  \newcommand{\glstreechilddesc}[1]{%
    \glstreechildpredesc\glossentrydesc{#1}\glspostdescription
  }%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glstreechildsymbol}
%\changes{1.31}{2018-05-09}{new}
%This just behaves in the same way as the top-level.
%    \begin{macrocode}
  \newcommand{\glstreechildsymbol}[1]{%
    \glstreesymbol{#1}%
  }%
%    \end{macrocode}
%\end{macro}
%    \begin{macrocode}
  \renewglossarystyle{tree}{%
    \renewenvironment{theglossary}%
      {\setlength{\parindent}{0pt}%
       \setlength{\parskip}{0pt plus 0.3pt}}%
      {}%
    \renewcommand*{\glossaryheader}{}%
    \renewcommand*{\glsgroupheading}[1]{}%
    \renewcommand{\glossentry}[2]{%
      \hangindent0pt\relax
      \parindent0pt\relax
      \glsentryitem{##1}\glstreenamefmt{\glstarget{##1}{\glossentryname{##1}}}%
      \glstreesymbol{##1}%
      \glstreedesc{##1}%
      \glstreeprelocation##2\par
    }%
    \renewcommand{\subglossentry}[3]{%
      \hangindent##1\glstreeindent\relax
      \parindent##1\glstreeindent\relax
      \ifnum##1=1\relax
        \glssubentryitem{##2}%
      \fi
      \glstreenamefmt{\glstarget{##2}{\glossentryname{##2}}}%
      \glstreechildsymbol{##2}%
      \glstreechilddesc{##2}%
      \glstreechildprelocation ##3\par
    }%
    \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}%
  }%
}
{}
%    \end{macrocode}
%
% The \glostyle{treegroup} style is redefined to discourage a page
% break after the heading.
%\changes{1.21}{2017-11-03}{redefined \texttt{treegroup} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@treegroup}
{%
  \renewglossarystyle{treegroup}{%
    \setglossarystyle{tree}%
    \renewcommand{\glsgroupheading}[1]{\par
      \noindent\glstreegroupheaderfmt{\glsgetgrouptitle{##1}}\par
      \nopagebreak\indexspace\nobreak\@afterheading}%
  }
}
{}
%    \end{macrocode}
%
%Similarly for \glostyle{treehypergroup}
%\changes{1.21}{2017-11-03}{redefined \texttt{treehypergroup} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@treehypergroup}
{%
  \renewglossarystyle{treehypergroup}{%
    \setglossarystyle{tree}%
    \renewcommand*{\glossaryheader}{%
      \par\noindent\glstreenavigationfmt{\glsnavigation}\par
      \nobreak\@afterheading\indexspace}%
    \renewcommand*{\glsgroupheading}[1]{%
      \par\noindent
      \glstreegroupheaderfmt
        {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par
      \nopagebreak\indexspace\nobreak\@afterheading}%
  }
}
{}
%    \end{macrocode}
%
%Adjust \glostyle{treenoname} style to remove hard coded space before
%number list.
%    \begin{macrocode}
\ifdef{\@glsstyle@treenoname}
{%
%Provide a command for use with the \glostyle{treenoname} styles that displays
%the pre-description separator, the
%description and post-description hook.
%\begin{macro}{\glstreenonamedesc}
%\changes{1.31}{2018-05-09}{new}
%    \begin{macrocode}
  \newcommand{\glstreenonamedesc}[1]{%
    \glstreepredesc\glossentrydesc{#1}\glspostdescription
  }%
%    \end{macrocode}
%\end{macro}
%Similarly for the symbol.
%\begin{macro}{\glstreenonamesymbol}
%\changes{1.31}{2018-05-09}{new}
%    \begin{macrocode}
  \newcommand{\glstreenonamesymbol}[1]{%
    \ifglshassymbol{#1}{\space(\glossentrysymbol{#1})}{}%
  }%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glstreenonamechilddesc}
%\changes{1.31}{2018-05-09}{new}
%The child entry doesn't have the pre-description separator as the
%name isn't displayed.
%    \begin{macrocode}
  \newcommand{\glstreenonamechilddesc}[1]{%
    \glossentrydesc{#1}\glspostdescription
  }%
%    \end{macrocode}
%\end{macro}
%    \begin{macrocode}
  \renewglossarystyle{treenoname}{%
    \renewenvironment{theglossary}%
      {\setlength{\parindent}{0pt}%
       \setlength{\parskip}{0pt plus 0.3pt}}%
      {}%
    \renewcommand*{\glossaryheader}{}%
    \renewcommand*{\glsgroupheading}[1]{}%
    \renewcommand{\glossentry}[2]{%
      \hangindent0pt\relax
      \parindent0pt\relax
      \glsentryitem{##1}\glstreenamefmt{\glstarget{##1}{\glossentryname{##1}}}%
      \glstreenonamesymbol{##1}%
      \glstreenonamedesc{##1}%
      \glstreeprelocation##2\par
    }%
    \renewcommand{\subglossentry}[3]{%
      \hangindent##1\glstreeindent\relax
      \parindent##1\glstreeindent\relax
      \ifnum##1=1\relax
        \glssubentryitem{##2}%
      \fi
      \glstarget{##2}{\strut}%
      \glstreenonamechilddesc{##2}%
      \glstreechildprelocation##3\par
    }%
    \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}%
  }
}
{}
%    \end{macrocode}
%
% The \glostyle{treenonamegroup} style is redefined to discourage a page
% break after the heading.
%\changes{1.21}{2017-11-03}{redefined \texttt{treenonamegroup} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@treenonamegroup}
{%
  \renewglossarystyle{treenonamegroup}{%
    \setglossarystyle{treenoname}%
    \renewcommand{\glsgroupheading}[1]{\par
      \noindent\glstreegroupheaderfmt
        {\glsgetgrouptitle{##1}}%
      \nopagebreak\indexspace\nobreak\@afterheading
    }%
  }
}
{}
%    \end{macrocode}
%
%Similarly for \glostyle{treenonamehypergroup}
%\changes{1.21}{2017-11-03}{redefined \texttt{treenonamehypergroup} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@treenonamehypergroup}
{%
  \renewglossarystyle{treenonamehypergroup}{%
    \setglossarystyle{treenoname}%
    \renewcommand*{\glossaryheader}{%
      \par\noindent\glstreenavigationfmt{\glsnavigation}\par
      \nobreak\@afterheading\indexspace}%
    \renewcommand*{\glsgroupheading}[1]{%
      \par\noindent
      \glstreegroupheaderfmt
        {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}%
      \nopagebreak\indexspace\nobreak\@afterheading}%
  }
}
{}
%    \end{macrocode}
%
% The \glostyle{alttree} style is redefined to make it easier to
% made minor adjustments.
%    \begin{macrocode}
\ifdef{\@glsstyle@alttree}
{%
%    \end{macrocode}
% Only redefine this style if it's already been defined.
%
%\begin{macro}{\glsxtralttreeSymbolDescLocation}
%\changes{1.05}{2016-06-10}{new}
%\begin{definition}
%\cs{glsxtralttreeSymbolDescLocation}\marg{label}\marg{location
%list}
%\end{definition}
%Layout the symbol, description and location for top-level entries.
%    \begin{macrocode}
  \newcommand{\glsxtralttreeSymbolDescLocation}[2]{%
    {%
      \let\par\glsxtrAltTreePar
      \ifglshassymbol{#1}{(\glossentrysymbol{#1})\space}{}%
      \glossentrydesc{#1}\glspostdescription\glstreeprelocation #2\par
    }%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrAltTreeIndent}
%\changes{1.05}{2016-06-10}{new}
% Paragraph indent for subsequent paragraphs in multi-paragraph
% descriptions.
%    \begin{macrocode}
  \newlength\glsxtrAltTreeIndent
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrAltTreePar}
%\changes{1.05}{2016-06-10}{new}
%Multi-paragraph descriptions need to keep the hanging indent.
%    \begin{macrocode}
  \newcommand{\glsxtrAltTreePar}{%
    \@@par
    \glsxtrAltTreeSetHangIndent
    \setlength{\parindent}{\dimexpr\hangindent+\glsxtrAltTreeIndent}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtralttreeSubSymbolDescLocation}
%\changes{1.05}{2016-06-10}{new}
%\begin{definition}
%\cs{glsxtralttreeSubSymbolDescLocation}\marg{level}\marg{label}\marg{location
%list}
%\end{definition}
%Layout the symbol, description and location for sub-entries.
% Defaults to the same as the top-level.
%    \begin{macrocode}
  \newcommand{\glsxtralttreeSubSymbolDescLocation}[3]{%
    \glsxtralttreeSymbolDescLocation{#2}{#3}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrtreetopindent}
%\changes{1.05}{2016-06-10}{new}
% The original style has to keep computing the width of the name at
% each entry. This register allows the style to compute it once for
% the top-level at the start of the glossary.
%    \begin{macrocode}
  \newlength\glsxtrtreetopindent
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtralttreeInit}
%\changes{1.05}{2016-06-10}{new}
% User-level initialisation for the \glostyle{alttree} style.
%    \begin{macrocode}
  \newcommand*{\glsxtralttreeInit}{%
    \settowidth{\glsxtrtreetopindent}{\glstreenamefmt{\glsgetwidestname\space}}%
    \glsxtrAltTreeIndent=\parindent
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gglssetwidest}
%\changes{1.21}{2017-11-03}{new}
% The original \cs{glssetwidest} only uses \cs{def}. This uses
% \cs{gdef}.
%    \begin{macrocode}
  \newcommand*{\gglssetwidest}[2][0]{%
    \csgdef{@glswidestname\romannumeral#1}{#2}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\eglssetwidest}
%\changes{1.05}{2016-06-10}{new}
% The original \cs{glssetwidest} only uses \cs{def}. This uses
% \cs{protected@csedef}.
%    \begin{macrocode}
  \newcommand*{\eglssetwidest}[2][0]{%
    \protected@csedef{@glswidestname\romannumeral#1}{#2}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\xglssetwidest}
%\changes{1.05}{2016-06-10}{new}
%Like the above but uses \cs{protected@csxdef}.
%    \begin{macrocode}
  \newcommand*{\xglssetwidest}[2][0]{%
    \protected@csxdef{@glswidestname\romannumeral#1}{#2}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsupdatewidest}
%\changes{1.23}{2017-11-12}{new}
%Only sets if new value is wider than old value.
%    \begin{macrocode}
  \newcommand*{\glsupdatewidest}[2][0]{%
    \ifcsundef{@glswidestname\romannumeral#1}%
    {\csdef{@glswidestname\romannumeral#1}{#2}}%
    {%
      \settowidth{\dimen@}{\csuse{@glswidestname\romannumeral#1}}%
      \settowidth{\dimen@ii}{#2}%
      \ifdim\dimen@ii>\dimen@
       \csdef{@glswidestname\romannumeral#1}{#2}%
      \fi
    }%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gglsupdatewidest}
%\changes{1.23}{2017-11-12}{new}
%As above but global definition.
%    \begin{macrocode}
  \newcommand*{\gglsupdatewidest}[2][0]{%
    \ifcsundef{@glswidestname\romannumeral#1}%
    {\csgdef{@glswidestname\romannumeral#1}{#2}}%
    {%
      \settowidth{\dimen@}{\csuse{@glswidestname\romannumeral#1}}%
      \settowidth{\dimen@ii}{#2}%
      \ifdim\dimen@ii>\dimen@
       \csgdef{@glswidestname\romannumeral#1}{#2}%
      \fi
    }%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\eglsupdatewidest}
%\changes{1.23}{2017-11-12}{new}
%As \cs{glsupdatewidest} but expands value.
%    \begin{macrocode}
  \newcommand*{\eglsupdatewidest}[2][0]{%
    \ifcsundef{@glswidestname\romannumeral#1}%
    {\protected@csedef{@glswidestname\romannumeral#1}{#2}}%
    {%
      \settowidth{\dimen@}{\csuse{@glswidestname\romannumeral#1}}%
      \settowidth{\dimen@ii}{#2}%
      \ifdim\dimen@ii>\dimen@
       \protected@csedef{@glswidestname\romannumeral#1}{#2}%
      \fi
    }%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\xglsupdatewidest}
%\changes{1.23}{2017-11-12}{new}
%As above but global.
%    \begin{macrocode}
  \newcommand*{\xglsupdatewidest}[2][0]{%
    \ifcsundef{@glswidestname\romannumeral#1}%
    {\protected@csxdef{@glswidestname\romannumeral#1}{#2}}%
    {%
      \settowidth{\dimen@}{\csuse{@glswidestname\romannumeral#1}}%
      \settowidth{\dimen@ii}{#2}%
      \ifdim\dimen@ii>\dimen@
       \protected@csxdef{@glswidestname\romannumeral#1}{#2}%
      \fi
    }%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsgetwidestname}
%\changes{1.05}{2016-06-10}{new}
% Provide a user-level macro to obtain the widest top-level name.
%    \begin{macrocode}
  \newcommand*{\glsgetwidestname}{\@glswidestname}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsgetwidestsubname}
%\changes{1.05}{2016-06-10}{new}
% Provide a user-level macro to obtain the widest sub-entry name.
%    \begin{macrocode}
  \newcommand*{\glsgetwidestsubname}[1]{%
    \ifcsundef{@glswidestname\romannumeral#1}%
    {\@glswidestname}%
    {\csuse{@glswidestname\romannumeral#1}}%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsFindWidestTopLevelName}
%CamelCase is easier for long command names. Provide a CamelCase
%synonym of \ics{glsfindwidesttoplevelname}.
%    \begin{macrocode}
  \let\glsFindWidestTopLevelName\glsfindwidesttoplevelname
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsFindWidestUsedTopLevelName}
%\changes{1.05}{2016-06-10}{new}
% Like \cs{glsfindwidesttoplevelname} but has an additional check
% that the entry has been used. Only useful if the glossaries occur
% at the end of the document, in which case this command should go
% at the start of the glossary. Alternatively, place at the end of
% the document and save for the next run.
%    \begin{macrocode}
  \newrobustcmd*{\glsFindWidestUsedTopLevelName}[1][\@glo@types]{%
    \dimen@=0pt\relax
    \gls@tmplen=0pt\relax
    \forallglossaries[#1]{\@gls@type}%
    {%
      \forglsentries[\@gls@type]{\@glo@label}%
      {%
        \ifglsused{\@glo@label}%
        {%
          \ifglshasparent{\@glo@label}%
          {}%
          {%
            \settowidth{\dimen@}%
             {\glstreenamefmt{\glsentryname{\@glo@label}}}%
            \ifdim\dimen@>\gls@tmplen
              \gls@tmplen=\dimen@
              \eglssetwidest{\glsentryname{\@glo@label}}%
            \fi
          }%
        }%
        {}%
      }%
    }%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsFindWidestUsedAnyName}
%\changes{1.05}{2016-06-10}{new}
% Like the above but doesn't check the parent key. Useful if all
% levels should have the same width for the name.
%    \begin{macrocode}
  \newrobustcmd*{\glsFindWidestUsedAnyName}[1][\@glo@types]{%
    \dimen@=0pt\relax
    \gls@tmplen=0pt\relax
    \forallglossaries[#1]{\@gls@type}%
    {%
      \forglsentries[\@gls@type]{\@glo@label}%
      {%
        \ifglsused{\@glo@label}%
        {%
          \settowidth{\dimen@}%
           {\glstreenamefmt{\glsentryname{\@glo@label}}}%
          \ifdim\dimen@>\gls@tmplen
            \gls@tmplen=\dimen@
            \eglssetwidest{\glsentryname{\@glo@label}}%
          \fi
        }%
        {}%
      }%
    }%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsFindWidestAnyName}
%\changes{1.05}{2016-06-10}{new}
% Like the above but doesn't check is the entry has been used.
%    \begin{macrocode}
  \newrobustcmd*{\glsFindWidestAnyName}[1][\@glo@types]{%
    \dimen@=0pt\relax
    \gls@tmplen=0pt\relax
    \forallglossaries[#1]{\@gls@type}%
    {%
      \forglsentries[\@gls@type]{\@glo@label}%
      {%
        \settowidth{\dimen@}%
         {\glstreenamefmt{\glsentryname{\@glo@label}}}%
        \ifdim\dimen@>\gls@tmplen
          \gls@tmplen=\dimen@
          \eglssetwidest{\glsentryname{\@glo@label}}%
        \fi
      }%
    }%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsFindWidestUsedLevelTwo}
%\changes{1.05}{2016-06-10}{new}
% This is like \cs{glsFindWidestUsedTopLevelName} but also sets the
% first two sub-levels as well. Any entry that has a
% great-grandparent is ignored.
%    \begin{macrocode}
  \newrobustcmd*{\glsFindWidestUsedLevelTwo}[1][\@glo@types]{%
    \dimen@=0pt\relax
    \dimen@i=0pt\relax
    \dimen@ii=0pt\relax
    \forallglossaries[#1]{\@gls@type}%
    {%
      \forglsentries[\@gls@type]{\@glo@label}%
      {%
        \ifglsused{\@glo@label}%
        {%
          \ifglshasparent{\@glo@label}%
          {%
            \edef\@glo@parent{\csuse{glo@\glsdetoklabel{\@glo@label}@parent}}%
            \ifglshasparent{\@glo@parent}%
            {%
              \edef\@glo@parent{\csuse{glo@\glsdetoklabel{\@glo@parent}@parent}}%
              \ifglshasparent{\@glo@parent}%
              {}%
              {%
                \settowidth{\gls@tmplen}%
                   {\glstreenamefmt{\glsentryname{\@glo@label}}}%
                \ifdim\gls@tmplen>\dimen@ii
                  \dimen@ii=\gls@tmplen
                  \eglssetwidest[2]{\glsentryname{\@glo@label}}%
                \fi
              }%
            }%
            {%
              \settowidth{\gls@tmplen}%
                 {\glstreenamefmt{\glsentryname{\@glo@label}}}%
              \ifdim\gls@tmplen>\dimen@i
                \dimen@i=\gls@tmplen
                \eglssetwidest[1]{\glsentryname{\@glo@label}}%
              \fi
            }%
          }%
          {%
            \settowidth{\gls@tmplen}%
               {\glstreenamefmt{\glsentryname{\@glo@label}}}%
            \ifdim\gls@tmplen>\dimen@
              \dimen@=\gls@tmplen
              \eglssetwidest{\glsentryname{\@glo@label}}%
            \fi
          }%
        }%
        {}%
      }%
    }%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsFindWidestLevelTwo}
%\changes{1.05}{2016-06-10}{new}
% This is like \cs{glsFindWidestUsedLevelTwo} but doesn't check if the
% entry has been used.
%    \begin{macrocode}
  \newrobustcmd*{\glsFindWidestLevelTwo}[1][\@glo@types]{%
    \dimen@=0pt\relax
    \dimen@i=0pt\relax
    \dimen@ii=0pt\relax
    \forallglossaries[#1]{\@gls@type}%
    {%
      \forglsentries[\@gls@type]{\@glo@label}%
      {%
        \ifglshasparent{\@glo@label}%
        {%
          \edef\@glo@parent{\csuse{glo@\glsdetoklabel{\@glo@label}@parent}}%
          \ifglshasparent{\@glo@parent}%
          {%
            \edef\@glo@parent{\csuse{glo@\glsdetoklabel{\@glo@parent}@parent}}%
            \ifglshasparent{\@glo@parent}%
            {}%
            {%
              \settowidth{\gls@tmplen}%
                 {\glstreenamefmt{\glsentryname{\@glo@label}}}%
              \ifdim\gls@tmplen>\dimen@ii
                \dimen@ii=\gls@tmplen
                \eglssetwidest[2]{\glsentryname{\@glo@label}}%
              \fi
            }%
          }%
          {%
            \settowidth{\gls@tmplen}%
               {\glstreenamefmt{\glsentryname{\@glo@label}}}%
            \ifdim\gls@tmplen>\dimen@i
              \dimen@i=\gls@tmplen
              \eglssetwidest[1]{\glsentryname{\@glo@label}}%
            \fi
          }%
        }%
        {%
          \settowidth{\gls@tmplen}%
             {\glstreenamefmt{\glsentryname{\@glo@label}}}%
          \ifdim\gls@tmplen>\dimen@
            \dimen@=\gls@tmplen
            \eglssetwidest{\glsentryname{\@glo@label}}%
          \fi
        }%
      }%
    }%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsFindWidestUsedAnyNameSymbol}
%\changes{1.05}{2016-06-10}{new}
% Like the \cs{glsFindWidestUsedAnyName} but also measures the
% symbol. The length of the widest symbol is stored in the second argument
% should be a length register.
%    \begin{macrocode}
  \newrobustcmd*{\glsFindWidestUsedAnyNameSymbol}[2][\@glo@types]{%
    \dimen@=0pt\relax
    \gls@tmplen=0pt\relax
    #2=0pt\relax
    \forallglossaries[#1]{\@gls@type}%
    {%
      \forglsentries[\@gls@type]{\@glo@label}%
      {%
        \ifglsused{\@glo@label}%
        {%
          \settowidth{\dimen@}%
           {\glstreenamefmt{\glsentryname{\@glo@label}}}%
          \ifdim\dimen@>\gls@tmplen
            \gls@tmplen=\dimen@
            \eglssetwidest{\glsentryname{\@glo@label}}%
          \fi
          \settowidth{\dimen@}%
           {\glsentrysymbol{\@glo@label}}%
          \ifdim\dimen@>#2\relax
            #2=\dimen@
          \fi
        }%
        {}%
      }%
    }%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsFindWidestAnyNameSymbol}
%\changes{1.05}{2016-06-10}{new}
% Like the above but doesn't check if the entry has been used.
%    \begin{macrocode}
  \newrobustcmd*{\glsFindWidestAnyNameSymbol}[2][\@glo@types]{%
    \dimen@=0pt\relax
    \gls@tmplen=0pt\relax
    #2=0pt\relax
    \forallglossaries[#1]{\@gls@type}%
    {%
      \forglsentries[\@gls@type]{\@glo@label}%
      {%
        \settowidth{\dimen@}%
         {\glstreenamefmt{\glsentryname{\@glo@label}}}%
        \ifdim\dimen@>\gls@tmplen
          \gls@tmplen=\dimen@
          \eglssetwidest{\glsentryname{\@glo@label}}%
        \fi
        \settowidth{\dimen@}%
         {\glsentrysymbol{\@glo@label}}%
        \ifdim\dimen@>#2\relax
          #2=\dimen@
        \fi
      }%
    }%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsFindWidestUsedAnyNameSymbolLocation}
%\changes{1.05}{2016-06-10}{new}
% Like the \cs{glsFindWidestUsedAnyNameSymbol} but also measures the
% location list. This requires \ics{glsentrynumberlist}.
% The length of the widest symbol is stored in the second argument
% should be a length register. The length of the widest location
% list is stored in the third argument, which should also be a
% length register.
%    \begin{macrocode}
  \newrobustcmd*{\glsFindWidestUsedAnyNameSymbolLocation}[3][\@glo@types]{%
    \dimen@=0pt\relax
    \gls@tmplen=0pt\relax
    #2=0pt\relax
    #3=0pt\relax
    \forallglossaries[#1]{\@gls@type}%
    {%
      \forglsentries[\@gls@type]{\@glo@label}%
      {%
        \ifglsused{\@glo@label}%
        {%
          \settowidth{\dimen@}%
           {\glstreenamefmt{\glsentryname{\@glo@label}}}%
          \ifdim\dimen@>\gls@tmplen
            \gls@tmplen=\dimen@
            \eglssetwidest{\glsentryname{\@glo@label}}%
          \fi
          \settowidth{\dimen@}%
           {\glsentrysymbol{\@glo@label}}%
          \ifdim\dimen@>#2\relax
            #2=\dimen@
          \fi
          \settowidth{\dimen@}%
           {\GlsXtrFormatLocationList{\glsentrynumberlist{\@glo@label}}}%
          \ifdim\dimen@>#3\relax
            #3=\dimen@
          \fi
        }%
        {}%
      }%
    }%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsFindWidestAnyNameSymbolLocation}
%\changes{1.05}{2016-06-10}{new}
% Like the \cs{glsFindWidestUsedAnyNameSymbol} but doesn't check if
% the entry has been used.
%    \begin{macrocode}
  \newrobustcmd*{\glsFindWidestAnyNameSymbolLocation}[3][\@glo@types]{%
    \dimen@=0pt\relax
    \gls@tmplen=0pt\relax
    #2=0pt\relax
    #3=0pt\relax
    \forallglossaries[#1]{\@gls@type}%
    {%
      \forglsentries[\@gls@type]{\@glo@label}%
      {%
        \settowidth{\dimen@}%
         {\glstreenamefmt{\glsentryname{\@glo@label}}}%
        \ifdim\dimen@>\gls@tmplen
          \gls@tmplen=\dimen@
          \eglssetwidest{\glsentryname{\@glo@label}}%
        \fi
        \settowidth{\dimen@}%
         {\glsentrysymbol{\@glo@label}}%
        \ifdim\dimen@>#2\relax
          #2=\dimen@
        \fi
        \settowidth{\dimen@}%
          {\GlsXtrFormatLocationList{\glsentrynumberlist{\@glo@label}}}%
        \ifdim\dimen@>#3\relax
          #3=\dimen@
        \fi
      }%
    }%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsFindWidestUsedAnyNameLocation}
%\changes{1.05}{2016-06-10}{new}
% Like the \cs{glsFindWidestUsedAnyNameSymbolLocation} but doesn't
% measure the symbol. The length of the widest location
% list is stored in the second argument, which should be a
% length register.
%    \begin{macrocode}
  \newrobustcmd*{\glsFindWidestUsedAnyNameLocation}[2][\@glo@types]{%
    \dimen@=0pt\relax
    \gls@tmplen=0pt\relax
    #2=0pt\relax
    \forallglossaries[#1]{\@gls@type}%
    {%
      \forglsentries[\@gls@type]{\@glo@label}%
      {%
        \ifglsused{\@glo@label}%
        {%
          \settowidth{\dimen@}%
           {\glstreenamefmt{\glsentryname{\@glo@label}}}%
          \ifdim\dimen@>\gls@tmplen
            \gls@tmplen=\dimen@
            \eglssetwidest{\glsentryname{\@glo@label}}%
          \fi
          \settowidth{\dimen@}%
           {\GlsXtrFormatLocationList{\glsentrynumberlist{\@glo@label}}}%
          \ifdim\dimen@>#2\relax
            #2=\dimen@
          \fi
        }%
        {}%
      }%
    }%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsFindWidestAnyNameLocation}
%\changes{1.05}{2016-06-10}{new}
% Like the \cs{glsFindWidestAnyNameLocation} but doesn't
% check the \gls{firstuse} flag.
%    \begin{macrocode}
  \newrobustcmd*{\glsFindWidestAnyNameLocation}[2][\@glo@types]{%
    \dimen@=0pt\relax
    \gls@tmplen=0pt\relax
    #2=0pt\relax
    \forallglossaries[#1]{\@gls@type}%
    {%
      \forglsentries[\@gls@type]{\@glo@label}%
      {%
        \settowidth{\dimen@}%
         {\glstreenamefmt{\glsentryname{\@glo@label}}}%
        \ifdim\dimen@>\gls@tmplen
          \gls@tmplen=\dimen@
          \eglssetwidest{\glsentryname{\@glo@label}}%
        \fi
        \settowidth{\dimen@}%
         {\GlsXtrFormatLocationList{\glsentrynumberlist{\@glo@label}}}%
        \ifdim\dimen@>#2\relax
          #2=\dimen@
        \fi
      }%
    }%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrComputeTreeIndent}
%\changes{1.05}{2016-06-10}{new}
% Compute the value of \cs{glstreeindent}. Argument is the entry label.
% (Ignored in default definition, but this command may be redefined
% to take the particular entry into account.)  Note that the
% sub-levels modify \cs{glstreeindent}.
%    \begin{macrocode}
  \newcommand*{\glsxtrComputeTreeIndent}[1]{%
    \glstreeindent=\glsxtrtreetopindent\relax
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrComputeTreeSubIndent}
%\changes{1.05}{2016-06-10}{new}
%\begin{definition}
%\cs{glsxtrComputeTreeSubIndent}\marg{level}\marg{label}\marg{register}
%\end{definition}
% Compute the indent for the sub-entries. The first argument is the
% level, the second argument is the entry label and the third
% argument is the length register used to store the computed indent.
%    \begin{macrocode}
  \newcommand*{\glsxtrComputeTreeSubIndent}[3]{%
    \ifcsundef{@glswidestname\romannumeral#1}%
    {%
      \settowidth{#3}{\glstreenamefmt{\@glswidestname\space}}%
    }%
    {%
      \settowidth{#3}{\glstreenamefmt{%
             \csname @glswidestname\romannumeral#1\endcsname\space}}%
    }%
  }
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrAltTreeSetHangIndent}
%\changes{1.05}{2016-06-10}{new}
% Set \cs{hangindent} for top-level entries:
%    \begin{macrocode}
  \newcommand*{\glsxtrAltTreeSetHangIndent}{\hangindent\glstreeindent}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrAltTreeSetSubHangIndent}
%\changes{1.05}{2016-06-10}{new}
% Set \cs{hangindent} for sub-entries:
%    \begin{macrocode}
  \newcommand*{\glsxtrAltTreeSetSubHangIndent}[1]{\hangindent\glstreeindent}
%    \end{macrocode}
%\end{macro}
%
% Redefine \glostyle{alttree}:
%    \begin{macrocode}
  \renewglossarystyle{alttree}{%
    \renewenvironment{theglossary}%
      {%
       \glsxtralttreeInit
       \def\@gls@prevlevel{-1}%
       \mbox{}\par}%
      {\par}%
    \renewcommand*{\glossaryheader}{}%
    \renewcommand*{\glsgroupheading}[1]{}%
    \renewcommand{\glossentry}[2]{%
      \ifnum\@gls@prevlevel=0\relax
      \else
        \glsxtrComputeTreeIndent{##1}%
      \fi
      \parindent\glstreeindent
      \glsxtrAltTreeSetHangIndent
      \makebox[0pt][r]%
      {%
        \glstreenamebox{\glstreeindent}%
        {%
           \glsentryitem{##1}%
           \glstreenamefmt{\glstarget{##1}{\glossentryname{##1}}}%
        }%
      }%
      \glsxtralttreeSymbolDescLocation{##1}{##2}%
      \def\@gls@prevlevel{0}%
    }
    \renewcommand{\subglossentry}[3]{%
      \ifnum##1=1\relax
        \glssubentryitem{##2}%
      \fi
      \ifnum\@gls@prevlevel=##1\relax
      \else
        \glsxtrComputeTreeSubIndent{##1}{##2}{\gls@tmplen}%
        \ifnum\@gls@prevlevel<##1\relax
          \setlength\glstreeindent\gls@tmplen
          \addtolength\glstreeindent\parindent
          \parindent\glstreeindent
        \else
          \ifnum\@gls@prevlevel=0\relax
            \glsxtrComputeTreeIndent{##2}%
          \else
            \glsxtrComputeTreeSubIndent{\@gls@prevlevel}{##2}{\glstreeindent}%
          \fi
          \addtolength\parindent{-\glstreeindent}%
          \setlength\glstreeindent\parindent
        \fi
      \fi
      \glsxtrAltTreeSetSubHangIndent{##1}%
      \makebox[0pt][r]{\glstreenamebox{\gls@tmplen}{%
        \glstreenamefmt{\glstarget{##2}{\glossentryname{##2}}}}}%
      \glsxtralttreeSubSymbolDescLocation{##1}{##2}{##3}%
      \def\@gls@prevlevel{##1}%
    }%
    \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}%
  }
}%
{%
}
%    \end{macrocode}
%Redefine \glostyle{alttreegroup} so that it discourages a break
%after group headings.
%\changes{1.21}{2017-11-03}{redefined \texttt{alttreegroup} to discourage
%breaks after group headings}
%Can't use \cs{@afterheading} here as it messes with the first item
%of the group.
%    \begin{macrocode}
\ifdef{\@glsstyle@alttreegroup}
{%
  \renewglossarystyle{alttreegroup}{%
    \setglossarystyle{alttree}%
    \renewcommand{\glsgroupheading}[1]{\par
      \def\@gls@prevlevel{-1}%
      \hangindent0pt\relax
      \parindent0pt\relax
      \glstreegroupheaderfmt{\glsgetgrouptitle{##1}}%
      \nopagebreak\indexspace\nopagebreak
    }%
  }%
}%
{%
}
%    \end{macrocode}
%Similarly for \glostyle{alttreehypergroup}.
%\changes{1.21}{2017-11-03}{redefined \texttt{alttreehypergroup} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@alttreehypergroup}
{%
  \renewglossarystyle{alttreehypergroup}{%
    \setglossarystyle{alttree}%
    \renewcommand*{\glossaryheader}{%
      \par
      \def\@gls@prevlevel{-1}%
      \hangindent0pt\relax
      \parindent0pt\relax
      \glstreenavigationfmt{\glsnavigation}\par\indexspace
    }%
    \renewcommand*{\glsgroupheading}[1]{%
      \par
      \def\@gls@prevlevel{-1}%
      \hangindent0pt\relax
      \parindent0pt\relax
      \glstreegroupheaderfmt
       {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par
      \nopagebreak\indexspace\nopagebreak
    }%
  }
}%
{%
}
%    \end{macrocode}
%
%\section{Multicolumn Styles}
%Adjust \glostyle{mcolindexgroup} to discourage page breaks after
%the group headings.
%\changes{1.21}{2017-11-03}{redefined \texttt{mcolindexgroup} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@mcolindexgroup}
{%
  \renewglossarystyle{mcolindexgroup}{%
    \setglossarystyle{mcolindex}%
    \renewcommand*{\glsgroupheading}[1]{%
      \item\glstreegroupheaderfmt{\glsgetgrouptitle{##1}}%
      \nopagebreak\indexspace\nobreak\@afterheading
    }%
  }
}%
{%
}
%    \end{macrocode}
%Similarly for \glostyle{mcolindexhypergroup}.
%\changes{1.21}{2017-11-03}{redefined \texttt{mcolindexhypergroup} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@mcolindexhypergroup}
{%
  \renewglossarystyle{mcolindexhypergroup}{%
    \setglossarystyle{mcolindex}%
    \renewcommand*{\glossaryheader}{%
      \item\glstreenavigationfmt{\glsnavigation}%
      \indexspace
    }%
    \renewcommand*{\glsgroupheading}[1]{%
      \item\glstreegroupheaderfmt
        {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}%
      \nopagebreak\indexspace\nobreak\@afterheading
    }%
  }
}%
{%
}
%    \end{macrocode}
%Similarly for \glostyle{mcolindexspannav}.
%\changes{1.21}{2017-11-03}{redefined \texttt{mcolindexspannav} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@mcolindexspannav}
{%
  \renewglossarystyle{mcolindexspannav}{%
    \setglossarystyle{index}%
    \renewenvironment{theglossary}%
    {%
     \begin{multicols}{\glsmcols}[\noindent\glstreenavigationfmt{\glsnavigation}]%
     \setlength{\parindent}{0pt}%
     \setlength{\parskip}{0pt plus 0.3pt}%
     \let\item\glstreeitem}%
    {\end{multicols}}%
    \renewcommand*{\glsgroupheading}[1]{%
      \item\glstreegroupheaderfmt
        {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}%
      \nopagebreak\indexspace\nobreak\@afterheading
    }%
  }
}%
{%
}
%    \end{macrocode}
%Similarly for \glostyle{mcoltreegroup}.
%\changes{1.21}{2017-11-03}{redefined \texttt{mcoltreegroup} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@mcoltreegroup}
{%
  \renewglossarystyle{mcoltreegroup}{%
    \setglossarystyle{mcoltree}%
    \renewcommand{\glsgroupheading}[1]{\par
      \noindent\glstreegroupheaderfmt{\glsgetgrouptitle{##1}}%
      \nopagebreak\indexspace\nobreak\@afterheading
    }%
  }
}%
{%
}
%    \end{macrocode}
%Similarly for \glostyle{mcoltreehypergroup}.
%\changes{1.21}{2017-11-03}{redefined \texttt{mcoltreehypergroup} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@mcoltreehypergroup}
{%
  \renewglossarystyle{mcoltreehypergroup}{%
    \setglossarystyle{mcoltree}%
    \renewcommand*{\glossaryheader}{%
      \par\noindent\glstreenavigationfmt{\glsnavigation}\par\indexspace
    }%
    \renewcommand*{\glsgroupheading}[1]{%
      \par\noindent
      \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}%
      \nopagebreak\indexspace\nobreak\@afterheading
    }%
  }
}%
{%
}
%    \end{macrocode}
%Similarly for \glostyle{mcoltreespannav}.
%\changes{1.21}{2017-11-03}{redefined \texttt{mcoltreespannav} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@mcoltreespannav}
{%
  \renewglossarystyle{mcoltreespannav}{%
    \setglossarystyle{tree}%
    \renewenvironment{theglossary}%
    {%
       \begin{multicols}{\glsmcols}%
         [\noindent\glstreenavigationfmt{\glsnavigation}]%
       \setlength{\parindent}{0pt}%
       \setlength{\parskip}{0pt plus 0.3pt}%
    }%
    {\end{multicols}}%
    \renewcommand*{\glsgroupheading}[1]{%
      \par\noindent
      \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}%
      \nopagebreak\indexspace\nobreak\@afterheading
    }%
  }
}%
{%
}
%    \end{macrocode}
%Similarly for \glostyle{mcoltreenonamegroup}.
%\changes{1.21}{2017-11-03}{redefined \texttt{mcoltreenonamegroup} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@mcoltreenonamegroup}
{%
  \renewglossarystyle{mcoltreenonamegroup}{%
    \setglossarystyle{mcoltreenoname}%
    \renewcommand{\glsgroupheading}[1]{\par
      \noindent\glstreegroupheaderfmt{\glsgetgrouptitle{##1}}%
      \nopagebreak\indexspace\nobreak\@afterheading
    }%
  }
}%
{%
}
%    \end{macrocode}
%Similarly for \glostyle{mcoltreenonamehypergroup}.
%\changes{1.21}{2017-11-03}{redefined \texttt{mcoltreenonamehypergroup} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@mcoltreenonamehypergroup}
{%
  \renewglossarystyle{mcoltreenonamehypergroup}{%
    \setglossarystyle{mcoltreenoname}%
    \renewcommand*{\glossaryheader}{%
      \par\noindent\glstreenavigationfmt{\glsnavigation}\par\indexspace}%
    \renewcommand*{\glsgroupheading}[1]{%
      \par\noindent
      \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}%
      \nopagebreak\indexspace\nobreak\@afterheading}%
  }
}%
{%
}
%    \end{macrocode}
%Similarly for \glostyle{mcoltreenonamespannav}.
%\changes{1.21}{2017-11-03}{redefined \texttt{mcoltreenonamespannav} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@mcoltreenonamespannav}
{%
  \renewglossarystyle{mcoltreenonamespannav}{%
    \setglossarystyle{treenoname}%
    \renewenvironment{theglossary}%
    {%
       \begin{multicols}{\glsmcols}%
         [\noindent\glstreenavigationfmt{\glsnavigation}]%
       \setlength{\parindent}{0pt}%
       \setlength{\parskip}{0pt plus 0.3pt}%
    }%
    {\end{multicols}}%
    \renewcommand*{\glsgroupheading}[1]{%
      \par\noindent
      \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}%
      \nopagebreak\indexspace\nobreak\@afterheading}%
  }
}%
{%
}
%    \end{macrocode}
%\glostyle{mcolalttree} needs adjusting so that it uses \cs{glsxtralttreeInit}
%This doesn't use \verb|\mbox{}\par| which would unbalance the top
%of the columns.
%\changes{1.21}{2017-11-03}{adjusted mcolalttree}
%    \begin{macrocode}
\ifdef{\@glsstyle@mcolalttree}
{%
  \renewglossarystyle{mcolalttree}{%
    \setglossarystyle{alttree}%
    \renewenvironment{theglossary}%
    {%
       \glsxtralttreeInit
       \def\@gls@prevlevel{-1}%
       \begin{multicols}{\glsmcols}%
    }%
    {\par\end{multicols}}%
  }
}%
{%
}
%    \end{macrocode}
%Redefine \glostyle{mcolalttreegroup} to discourage page breaks
%after the group headings.
%\changes{1.21}{2017-11-03}{redefined \texttt{mcolalttreegroup} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@mcolalttreegroup}
{%
  \renewglossarystyle{mcolalttreegroup}{%
    \setglossarystyle{mcolalttree}%
    \renewcommand{\glsgroupheading}[1]{\par
      \def\@gls@prevlevel{-1}%
      \hangindent0pt\relax
      \parindent0pt\relax
      \glstreegroupheaderfmt{\glsgetgrouptitle{##1}}%
      \nopagebreak\indexspace\nopagebreak
    }%
  }
}%
{%
}
%    \end{macrocode}
%Similarly for \glostyle{mcolalttreehypergroup}.
%\changes{1.21}{2017-11-03}{redefined \texttt{mcolalttreehypergroup} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@mcolalttreehypergroup}
{%
  \renewglossarystyle{mcolalttreehypergroup}{%
    \setglossarystyle{mcolalttree}%
    \renewcommand*{\glossaryheader}{%
      \par
      \def\@gls@prevlevel{-1}%
      \hangindent0pt\relax
      \parindent0pt\relax
      \glstreenavigationfmt{\glsnavigation}%
      \par\indexspace
    }%
    \renewcommand*{\glsgroupheading}[1]{%
      \par
      \def\@gls@prevlevel{-1}%
      \hangindent0pt\relax
      \parindent0pt\relax
      \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}%
      \nopagebreak\indexspace\nopagebreak
    }%
  }
}%
{%
}
%    \end{macrocode}
%Similarly for \glostyle{mcolalttreespannav}.
%\changes{1.21}{2017-11-03}{redefined \texttt{mcolalttreespannav} to discourage
%breaks after group headings}
%    \begin{macrocode}
\ifdef{\@glsstyle@mcolalttreespannav}
{%
  \renewglossarystyle{mcolalttreespannav}{%
    \setglossarystyle{alttree}%
    \renewenvironment{theglossary}%
    {%
       \glsxtralttreeInit
       \def\@gls@prevlevel{-1}%
       \begin{multicols}{\glsmcols}%
          [\noindent\glstreenavigationfmt{\glsnavigation}]%
    }%
    {\par\end{multicols}}%
    \renewcommand*{\glsgroupheading}[1]{%
      \par
      \def\@gls@prevlevel{-1}%
      \hangindent0pt\relax
      \parindent0pt\relax
      \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}%
      \nopagebreak\indexspace\nopagebreak
    }%
  }
}%
{%
}
%    \end{macrocode}
%
% Reset the default style
%    \begin{macrocode}
\ifx\@glossary@default@style\relax
\else
  \setglossarystyle{\@glsxtr@current@style}
\fi
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-extra-stylemods.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossary-bookindex.sty>
%    \end{macrocode}
%\fi
%\chapter{bookindex style (\styfmt{glossary-bookindex.sty})}
%\changes{1.21}{2017-11-03}{new}
%\section{Package Initialisation and Options}
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{glossary-bookindex}[2018/05/09 v1.31 (NLCT)]
%    \end{macrocode}
%Load required packages.
%    \begin{macrocode}
\RequirePackage{multicol}
\RequirePackage{glossary-tree}
%    \end{macrocode}
%\begin{macro}{\glsxtrbookindexcols}
%\changes{1.21}{2017-11-03}{new}
% Number of columns.
%    \begin{macrocode}
\newcommand{\glsxtrbookindexcols}{2}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrbookindexname}
%\changes{1.21}{2017-11-03}{new}
%Format used for top-level entries.
% (Argument is the label.)
%    \begin{macrocode}
\newcommand*{\glsxtrbookindexname}[1]{\glossentryname{#1}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrbookindexsubname}
%\changes{1.21}{2017-11-03}{new}
%Format used for sub entries.
%    \begin{macrocode}
\newcommand*{\glsxtrbookindexsubname}[1]{\glsxtrbookindexname{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrprelocation}
%\changes{1.21}{2017-11-03}{new}
%Provide in case \sty{glossaries-stylemods} isn't loaded.
%    \begin{macrocode}
\providecommand*{\glsxtrprelocation}{\space}
%    \end{macrocode}
%\end{macro}

%\begin{macro}{\glsxtrbookindexprelocation}
%\changes{1.21}{2017-11-03}{new}
%Separator used before location list for top-level entries.
%Version 1.22 has removed the \cs{ifglsnopostdot} check 
%since this style doesn't display the description.
%\changes{1.22}{2017-11-08}{removed check for no post dot}
%    \begin{macrocode}
\newcommand*{\glsxtrbookindexprelocation}[1]{%
  \glsxtrifhasfield{location}{#1}%
  {,\glsxtrprelocation}%
  {\glsxtrprelocation}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrbookindexsubprelocation}
%\changes{1.21}{2017-11-03}{new}
%Separator used before location list for sub-entries.
%    \begin{macrocode}
\newcommand*{\glsxtrbookindexsubprelocation}[1]{%
 \glsxtrbookindexprelocation{#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrbookindexparentchildsep}
%\changes{1.21}{2017-11-03}{new}
%Separator used between top-level parent and child entry.
%    \begin{macrocode}
\newcommand{\glsxtrbookindexparentchildsep}{\nopagebreak}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrbookindexparentsubchildsep}
%\changes{1.21}{2017-11-03}{new}
%Separator used between sub-level parent and child entry.
%    \begin{macrocode}
\newcommand{\glsxtrbookindexparentsubchildsep}{\glsxtrbookindexparentchildsep}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrbookindexbetween}
%\changes{1.21}{2017-11-03}{new}
%Between two top-level entries identified by the labels in the
%arguments.
%    \begin{macrocode}
\newcommand{\glsxtrbookindexbetween}[2]{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrbookindexsubbetween}
%\changes{1.21}{2017-11-03}{new}
%Between two level~1 entries identified by the labels in the
%arguments.
%    \begin{macrocode}
\newcommand{\glsxtrbookindexsubbetween}[2]{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrbookindexsubsubbetween}
%\changes{1.21}{2017-11-03}{new}
%Between two level~2 entries identified by the labels in the
%arguments.
%    \begin{macrocode}
\newcommand{\glsxtrbookindexsubsubbetween}[2]{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrbookindexatendgroup}
%\changes{1.21}{2017-11-03}{new}
%At the end of a letter group. The argument is the index of the last
%top-level entry.
%    \begin{macrocode}
\newcommand{\glsxtrbookindexatendgroup}[1]{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrbookindexsubatendgroup}
%\changes{1.21}{2017-11-03}{new}
%At the end of a letter group. The argument is the index of the last
%level~1 entry.
%    \begin{macrocode}
\newcommand{\glsxtrbookindexsubatendgroup}[1]{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrbookindexsubsubatendgroup}
%\changes{1.21}{2017-11-03}{new}
%At the end of a letter group. The argument is the index of the last
%level~2 entry.
%    \begin{macrocode}
\newcommand{\glsxtrbookindexsubsubatendgroup}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrbookindexgroupskip}
%\changes{1.21}{2017-11-03}{new}
%Group separator.
%    \begin{macrocode}
\newcommand{\glsxtrbookindexgroupskip}{\ifglsnogroupskip\else\indexspace\fi}
%    \end{macrocode}
%\end{macro}
%
%Format group title.
%\begin{macro}{\glsxtrbookindexformatheader}
%\changes{1.21}{2017-11-03}{new}
%Group separator.
%    \begin{macrocode}
\newcommand*{\glsxtrbookindexformatheader}[1]{%
  \par{\centering\glstreegroupheaderfmt{#1}\par}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrbookindexbookmark}
%\changes{1.21}{2017-11-03}{new}
%Book mark group heading if supported.
%    \begin{macrocode}
\ifdef\pdfbookmark
{%
  \newcommand*{\glsxtrbookindexbookmark}[2]{%
    \ifdefstring{\@@glossarysec}{chapter}%
    {\pdfbookmark[1]{#1}{#2}}%
    {\pdfbookmark[2]{#1}{#2}}%
  }
}
{%
  \newcommand*{\glsxtrbookindexbookmark}[2]{}
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrbookindexcolspread}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrbookindexcolspread}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrbookindexmulticolsenv}
%\changes{1.25}{2017-11-14}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrbookindexmulticolsenv}{multicols}
%    \end{macrocode}
%\end{macro}
%
%Define the style.
%    \begin{macrocode}
\newglossarystyle{bookindex}{%
  \setglossarystyle{index}%
  \renewenvironment{theglossary}%
  {%
    \ifdefempty\glsxtrbookindexcolspread
    {%
      \expandafter\begin\expandafter{\glsxtrbookindexmulticolsenv}%
        {\glsxtrbookindexcols}%
    }%
    {%
      \expandafter\begin\expandafter{\glsxtrbookindexmulticolsenv}%
        {\glsxtrbookindexcols}[\glsxtrbookindexcolspread]%
    }%
    \setlength{\parindent}{0pt}%
    \setlength{\parskip}{0pt plus 0.3pt}%
    \let\@glsxtr@bookindex@sep\glsxtrbookindexparentchildsep
    \let\@glsxtr@bookindex@subsep\glsxtrbookindexparentsubchildsep
    \let\@glsxtr@bookindex@between\@gobble
    \let\@glsxtr@bookindex@subbetween\@gobble
    \let\@glsxtr@bookindex@subsubbetween\@gobble
    \let\@glsxtr@bookindex@atendgroup\relax
    \let\@glsxtr@bookindex@subatendgroup\relax
    \let\@glsxtr@bookindex@subsubatendgroup\relax
    \let\@glsxtr@bookindexgroupskip\relax
  }%
  {%
%    \end{macrocode}
% Do end group hooks.
%    \begin{macrocode}
     \@glsxtr@bookindex@subsubatendgroup
     \@glsxtr@bookindex@subatendgroup
     \@glsxtr@bookindex@atendgroup
%    \end{macrocode}
%End \env{multicols} environment.
%    \begin{macrocode}
     \expandafter\end\expandafter{\glsxtrbookindexmulticolsenv}%
  }%
%    \end{macrocode}
%Use ragged right as columns are likely to be narrow and
%indexes tend not to be fully justified.
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{\raggedright}%
%    \end{macrocode}
%Top level entry format.
%    \begin{macrocode}
  \renewcommand*{\glossentry}[2]{%
%    \end{macrocode}
%Do separator.
%    \begin{macrocode}
    \@glsxtr@bookindex@between{##1}%
%    \end{macrocode}
%Update separators.
%    \begin{macrocode}
    \let\@glsxtr@bookindex@sep\glsxtrbookindexparentchildsep
    \let\@glsxtr@bookindex@subsep\glsxtrbookindexparentsubchildsep
    \let\@glsxtr@bookindex@subbetween\@gobble
    \let\@glsxtr@bookindex@subsubbetween\@gobble
    \edef\@glsxtr@bookindex@between{%
       \noexpand\glsxtrbookindexbetween{##1}%
    }%
    \edef\@glsxtr@bookindex@atendgroup{%
      \noexpand\glsxtrbookindexatendgroup{##1}%
    }%
    \let\@glsxtr@bookindex@subatendgroup\relax
    \let\@glsxtr@bookindex@subsubatendgroup\relax
%    \end{macrocode}
%Format entry.
%    \begin{macrocode}
    \glstreeitem
      \glsentryitem{##1}%
      \glstarget{##1}{\glsxtrbookindexname{##1}}%
    \glsxtrbookindexprelocation{##1}##2%
  }%
  \renewcommand{\subglossentry}[3]{%
    \ifcase##1\relax
%    \end{macrocode}
% Level 0 (shouldn't happen as that's formatted with \cs{glossentry}).
%    \begin{macrocode}
      \glstreeitem
    \or
%    \end{macrocode}
% Level 1.
%    \begin{macrocode}
      \@glsxtr@bookindex@sep
      \@glsxtr@bookindex@subbetween{##2}%
      \let\@glsxtr@bookindex@sep\relax
%    \end{macrocode}
% Update separators.
%    \begin{macrocode}
      \let\@glsxtr@bookindex@subsubbetween\@gobble
      \let\@glsxtr@bookindex@subsep\glsxtrbookindexparentsubchildsep
      \edef\@glsxtr@bookindex@subbetween{%
         \noexpand\glsxtrbookindexsubbetween{##2}%
      }%
      \edef\@glsxtr@bookindex@atsubendgroup{%
        \noexpand\glsxtrbookindexatsubendgroup{##1}%
      }%
%    \end{macrocode}
% Start sub-item.
%    \begin{macrocode}
      \glstreesubitem
      \glssubentryitem{##2}%
    \else
%    \end{macrocode}
% All other levels.
%    \begin{macrocode}
      \@glsxtr@bookindex@subsep
      \@glsxtr@bookindex@subsubbetween{##2}%
%    \end{macrocode}
% Update separators.
%    \begin{macrocode}
      \let\@glsxtr@bookindex@subsep\relax
      \edef\@glsxtr@bookindex@subsubbetween{%
         \noexpand\glsxtrbookindexsubsubbetween{##2}%
      }%
      \edef\@glsxtr@bookindex@atsubsubendgroup{%
        \noexpand\glsxtrbookindexatsubsubendgroup{##1}%
      }%
%    \end{macrocode}
% Start sub-sub-item.
%    \begin{macrocode}
      \glstreesubsubitem
    \fi
%    \end{macrocode}
% Format entry.
%    \begin{macrocode}
    \glstarget{##2}{\glsxtrbookindexsubname{##2}}%
    \glsxtrbookindexsubprelocation{##2}##3%
  }%
%    \end{macrocode}
% The group skip is moved to the group heading to avoid interfering
% with the end letter group hooks.
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{}%
%    \end{macrocode}
% Group heading format.
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
%    \end{macrocode}
% Do end group hooks.
%    \begin{macrocode}
    \@glsxtr@bookindex@subsubatendgroup
    \@glsxtr@bookindex@subatendgroup
    \@glsxtr@bookindex@atendgroup
    \@glsxtr@bookindexgroupskip
%    \end{macrocode}
% Update separators.
%    \begin{macrocode}
    \let\@glsxtr@bookindexgroupskip\glsxtrbookindexgroupskip
    \let\@glsxtr@bookindex@between\@gobble
    \let\@glsxtr@bookindex@atendgroup\relax
    \let\@glsxtr@bookindex@subatendgroup\relax
    \let\@glsxtr@bookindex@subsubatendgroup\relax
%    \end{macrocode}
% Fetch the group title from the label supplied in \verb|#1|.
%    \begin{macrocode}
    \glsxtrgetgrouptitle{##1}{\thisgrptitle}%
%    \end{macrocode}
% Do the PDF bookmark if supported.
%    \begin{macrocode}
    \glsxtrbookindexbookmark{\thisgrptitle}{index.##1}%
%    \end{macrocode}
% Format the group title.
%    \begin{macrocode}
    \glsxtrbookindexformatheader{\thisgrptitle}%
    \nopagebreak\indexspace\nopagebreak\@afterheading
  }%
}
%    \end{macrocode}
% Some supplementary commands that may be useful.
% These store the entry label for the current page. Since the page
% number is needed in the control sequence, this uses
% \cs{glsxtrbookindexthepage} instead of \cs{thepage} in case
% the page numbering has been set to something that contains
% formatting commands.
%\begin{macro}{\glsxtrbookindexthepage}
%\changes{1.21}{2017-11-03}{new}
%The \cs{@printglossary} sets \cs{currentglossary} to the current
%glossary label. This is used as a prefix in case the page number is
%reset.
%    \begin{macrocode}
\newcommand{\glsxtrbookindexthepage}{%
 \ifdef\currentglossary{\currentglossary.\arabic{page}}{\arabic{page}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrbookindexmarkentry}
%\changes{1.21}{2017-11-03}{new}
%Writes entry information to the \texttt{.aux} file. The argument is
%the entry label.
%    \begin{macrocode}
\newcommand*{\glsxtrbookindexmarkentry}[1]{%
  \protected@write\@auxout
  {\let\glsxtrbookindexthepage\relax}%
  {\string\glsxtr@setbookindexmark{\glsxtrbookindexthepage}{#1}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtr@setbookindexmark}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\glsxtr@setbookindexmark}[2]{%
 \ifcsundef{glsxtr@idxfirstmark@#1}%
 {\csgdef{glsxtr@idxfirstmark@#1}{#2}}%
 {}%
 \csgdef{glsxtr@idxlastmark@#1}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrbookindexfirstmarkfmt}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrbookindexfirstmarkfmt}[1]{%
  \glsentryname{#1}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrbookindexfirstmark}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrbookindexfirstmark}{%
  \letcs{\glsxtr@label}{glsxtr@idxfirstmark@\glsxtrbookindexthepage}%
  \ifdef\glsxtr@label
  {\glsxtrbookindexfirstmarkfmt{\glsxtr@label}}%
  {}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsxtrbookindexlastmarkfmt}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrbookindexlastmarkfmt}[1]{%
  \glsentryname{#1}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsxtrbookindexlastmark}
%\changes{1.21}{2017-11-03}{new}
%    \begin{macrocode}
\newcommand*{\glsxtrbookindexlastmark}{%
  \letcs{\glsxtr@label}{glsxtr@idxlastmark@\glsxtrbookindexthepage}%
  \ifdef\glsxtr@label
  {\glsxtrbookindexlastmarkfmt{\glsxtr@label}}%
  {}%
}
%    \end{macrocode}
%\end{macro}
%
%\iffalse
%    \begin{macrocode}
%</glossary-bookindex.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-xr.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% This file is part of the glossaries-extra bundle
% These are dummy glossary entries with cross-references for use in
% test documents.
%COMMENT
\newglossaryentry{lorem}{name={lorem},description={ipsum}}

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

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

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

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

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

\newglossaryentry{elit}{name={elit},description={vestibulum},
 seealso={adipiscing,ut}}

\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},
 seealso={placerat,vitae,curabitur}}

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

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

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

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

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

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

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

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

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

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

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

\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},
 parent={lectus},see={nulla}}

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

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

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

\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},
 seealso={sit,tortor,est}}

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

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

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

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

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

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

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

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

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

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

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

\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},
 see={eget}}

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

\newglossaryentry{orci}{name={orci},description={dignissim},
 seealso={diam}}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-xr.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-acronym-desc.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% Encoding: UTF-8
%COMMENT
@acronym{ndl,
  description = {fringilla a, euismod sodales,
  sollicitudin vel, wisi},
  short = {NDL},
  long = {nam dui ligula}
}

@acronym{mal,
  description = {non justo},
  short = {MAL},
  long = {morbi auctor lorem}
}

@acronym{nll,
  description = {pretium at, lobortis vitae, ultricies et,
tellus},
  short = {NLL},
  long = {name lacus libero}
}

@acronym{da,
  description = {tortor sed accumsan bibendum, erat ligula
aliquet magna, vitae ornare odio metus a mi},
  short = {DA},
  long = {donec aliquet}
}

@acronym{mao,
  description = {et nisl hendrerit mollis},
  short = {MAO},
  long = {morbi ac orci}
}

@acronym{sum,
  description = {cras nec ante},
  short = {SUM},
  long = {suspendisse ut massa}
}

@acronym{pan,
  description = {cum sociis natoque penatibus et magnis dis
parturient montes, nascetur ridiculus mus},
  short = {PAN},
  long = {pellentesque a nulla}
}

@acronym{atu,
  description = {nulla ullamcorper vestibulum 
turpis},
  short = {ATU},
  long = {aliquam tincidunt urna}
}

@acronym{pclm,
  description = {nulla malesuada porttitor diam},
  short = {PCLM},
  long = {pellentesque cursus luctus mauris}
}

%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-acronym-desc.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-acronym.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% Encoding: UTF-8
%COMMENT
@acronym{lid,
  short = {LID},
  long = {lorem ipsum dolor}
}

@acronym{stc,
  short = {STC},
  long = {sit amet consectetuer}
}

@acronym{aeu,
  short = {AEU},
  long = {adipiscing elit ut}
}

@acronym{pev,
  short = {PEV},
  long = {purus elit vestibulum}
}

@acronym{upa,
  short = {UPA},
  long = {ut placerat ac}
}

@acronym{avf,
  short = {AVF},
  long = {adipiscing vitae felis}
}

@acronym{cdg,
  short = {CDG},
  long = {curabitur dictum gravida}
}

@acronym{mna,
  short = {MNA},
  long = {mauris nam arcu}
}

@acronym{lne,
  short = {LNE},
  long = {libero nonummy eget}
}

@acronym{civ,
  short = {CIV},
  long = {consectetuer id vulputate}
}

@acronym{amd,
  short = {AMD},
  long = {a magna donec}
}

@acronym{vae,
  short = {VAE},
  long = {vehicula augue eu}
}

@acronym{nph,
  short = {NPH},
  long = {neque pellentesque habitant}
}

@acronym{mts,
  short = {MTS},
  long = {morbi tristique senectus}
}

@acronym{ene,
  short = {ENE},
  long = {et netus et}
}

@acronym{mfa,
  short = {MFA},
  long = {malesuada fames ac}
}

@acronym{tem,
  short = {TEM},
  long = {turpis egestas mauris}
}

@acronym{ulc,
  short = {ULC},
  long = {ut leo cras}
}

@acronym{vmr,
  short = {VMR},
  long = {viverra metus rhoncus}
}

@acronym{sne,
  short = {SNE},
  long = {sem nulla et}
}

@acronym{lvu,
  short = {LVU},
  long = {lectus vestibulum urna}
}

@acronym{fup,
  short = {FUP},
  long = {fringilla ultrices phasellus}
}

@acronym{ets,
  short = {ETS},
  long = {eu tellus sit}
}

@acronym{atg,
  short = {ATG},
  long = {amet tortor gravida}
}

@acronym{pis,
  short = {PIS},
  long = {placerat integer sapien}
}

@acronym{eii,
  short = {EII},
  long = {est iaculis in}
}

@acronym{pqv,
  short = {PQV},
  long = {pretium quis viverra}
}

@acronym{anp,
  short = {ANP},
  long = {ac nunc praesent}
}

@acronym{esv,
  short = {ESV},
  long = {eget sem vel}
}

@acronym{lub,
  short = {LUB},
  long = {leo ultrices bibendum}
}

@acronym{afm,
  short = {AFM},
  long = {aenean faucibus morbi}
}

@acronym{dnm,
  short = {DNM},
  long = {dolor nulla malesuada}
}

@acronym{epa,
  short = {EPA},
  long = {eu pulvinar at}
}

@acronym{man,
  short = {MAC},
  long = {mollis ac nulla}
}

@acronym{cas,
  short = {CAS},
  long = {curabitur auctor semper}
}

@acronym{ndv,
  short = {NDV},
  long = {nulla donec varius}
}

@acronym{oer,
  short = {OER},
  long = {orci eget risus}
}

@acronym{dnmc,
  short = {DNMC},
  long = {duis nibh mi congue}
}

@acronym{cea,
  short = {CEA},
  long = {congue eu accumsan}
}

@acronym{esq,
  short = {ESQ},
  long = {eleifend sagittis quis}
}

@acronym{dia,
  short = {DIA},
  long = {duis eget orci}
}

@acronym{sao,
  short = {SAO},
  long = {sit amet orci}
}

@acronym{drn,
  short = {DRN},
  long = {dignissim rutrum nam}
}

%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-acronym.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-acronyms-lang.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% Encoding: UTF-8
%COMMENT
@acronym{li,
  user1 = {love itself},
  short = {LI},
  long = {lorem ipsum}
}

@acronym{np,
  user1 = {produces none},
  short = {NP},
  long = {nulla pariatur}
}

@acronym{sic,
  user1 = {blame belongs},
  short = {SIC},
  long = {sunt in culpa}
}

@acronym{esoc,
  user1 = {blinded by
desire},
  short = {ESOC},
  long = {excepturi sint obcaecati cupiditat}
}

@acronym{nmruu,
  short = {NMRUU},
  long = {nulla malesuada
risus ut urna}
}

@acronym{di,
  short = {DI},
  long = {duis iaculi}
}

%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-acronyms-lang.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-brief.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% Encoding: UTF-8
%COMMENT
@entry{lorem,
  name = {lorem},
  description = {ipsum}
}

@entry{dolor,
  name = {dolor},
  description = {sit}
}

@entry{amet,
  name = {amet},
  description = {consectetuer}
}

@entry{adipiscing,
  name = {adipiscing},
  description = {elit}
}

@entry{ut,
  name = {ut},
  description = {purus}
}

@entry{elit,
  name = {elit},
  description = {vestibulum}
}

@entry{placerat,
  name = {placerat},
  description = {ac}
}

@entry{vitae,
  name = {vitae},
  description = {felis}
}

@entry{curabitur,
  name = {curabitur},
  description = {gravida}
}

@entry{mauris,
  name = {mauris},
  description = {nam}
}

@entry{arcu,
  name = {arcu},
  description = {libero}
}

@entry{nonummy,
  name = {nonummy},
  description = {eget}
}

@entry{consectetuer,
  name = {consectetuer},
  description = {id}
}

@entry{vulputate,
  name = {vulputate},
  description = {a magna}
}

@entry{donec,
  name = {donec},
  description = {vehicula}
}

@entry{augue,
  name = {augue},
  description = {eu neque}
}

@entry{pellentesque,
  name = {pellentesque},
  description = {habitant}
}

@entry{morbi,
  name = {morbi},
  description = {tristique}
}

@entry{senectus,
  name = {senectus},
  description = {et netus}
}

@entry{et,
  name = {et},
  description = {malesuada}
}

@entry{fames,
  name = {fames},
  description = {ac}
}

@entry{turpis,
  name = {turpis},
  description = {egestas}
}

@entry{leo,
  name = {leo},
  description = {cras}
}

@entry{viverra,
  name = {viverra},
  description = {metus}
}

@entry{rhoncus,
  name = {rhoncus},
  description = {sem}
}

@entry{nulla,
  name = {nulla},
  description = {et}
}

@entry{lectus,
  name = {lectus},
  description = {vestibulum}
}

@entry{urna,
  name = {urna},
  description = {fringilla}
}

@entry{ultrices,
  name = {ultrices},
  description = {phasellus}
}

@entry{eu,
  name = {eu},
  description = {tellus}
}

@entry{sit,
  name = {sit},
  description = {amet}
}

@entry{tortor,
  name = {tortor},
  description = {gravida}
}

@entry{integer,
  name = {integer},
  description = {sapien}
}

@entry{est,
  name = {est},
  description = {iaculis}
}

@entry{in,
  name = {in},
  description = {pretium}
}

@entry{quis,
  name = {quis},
  description = {viverra}
}

@entry{ac,
  name = {ac},
  description = {nunc}
}

@entry{praesent,
  name = {praesent},
  description = {eget}
}

@entry{sem,
  name = {sem},
  description = {vel leo}
}

@entry{bibendum,
  name = {bibendum},
  description = {ultrices}
}

@entry{aenean,
  name = {aenean},
  description = {faucibus}
}

@entry{malesuada,
  name = {malesuada},
  description = {eu}
}

@entry{pulvinar,
  name = {pulvinar},
  description = {at}
}

@entry{mollis,
  name = {mollis},
  description = {ac nulla}
}

@entry{auctor,
  name = {auctor},
  description = {semper}
}

@entry{varius,
  name = {varius},
  description = {orci}
}

@entry{eget,
  name = {eget},
  description = {risus}
}

@entry{duis,
  name = {duis},
  description = {nibh}
}

@entry{mi,
  name = {mi},
  description = {congue}
}

@entry{accumsan,
  name = {accumsan},
  description = {eleifend}
}

@entry{sagittis,
  name = {sagittis},
  description = {quis}
}

@entry{diam,
  name = {diam},
  description = {duis}
}

@entry{orci,
  name = {orci},
  description = {dignissim}
}

%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-brief.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-childnoname.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% Encoding: UTF-8
%COMMENT
@entry{scelerisque,
  name = {scelerisque},
  description = {at}
}

@entry{vestibulum,
  parent = {scelerisque},
  description = {eu, nulla}
}

@entry{utodionisl,
  parent = {scelerisque},
  description = {facilisis id}
}

@entry{molliset,
  parent = {scelerisque},
  description = {nec, enim}
}

@entry{aeneansem,
  parent = {scelerisque},
  description = {sem leo}
}

@entry{pellentesquesit,
  parent = {scelerisque},
  description = {sit amet}
}

@entry{sapien,
  parent = {scelerisque},
  description = {vehicula
pellentesque}
}

@entry{consequat,
  parent = {scelerisque},
  description = {tellus
et tortor}
}

@entry{uttempor,
  name = {ut tempor},
  description = {laoreet
quam}
}

@entry{nullamid,
  parent = {uttempor},
  description = {wisi a
libero}
}

@entry{tristique,
  parent = {uttempor},
  description = {semper}
}

@entry{nullamnislmassa,
  parent = {uttempor},
  description = {rutrum
ut}
}

@entry{eleifend,
  name = {eleifend},
  description = {sit amet
faucibus}
}

@entry{elementum,
  parent = {eleifend},
  description = {elementum}
}

@entry{urnasapien,
  parent = {eleifend},
  description = {urna sapien}
}

@entry{consectetuermauris,
  name = {consectetuer},
  description = {mauris}
}

@entry{quisegestas,
  parent = {consectetuermauris},
  description = {quis egestas}
}

@entry{leojusto,
  parent = {consectetuermauris},
  description = {leo
justo}
}

@entry{nonrisus,
  name = {non risus},
  description = {morbi non
felis}
}

@entry{aclibero,
  parent = {nonrisus},
  description = {ac libero}
}

@entry{vulputatefringilla,
  parent = {nonrisus},
  description = {vulputate
fringilla}
}

@entry{maurislibero,
  name = {mauris},
  description = {libero eros}
}

@entry{lacinia,
  parent = {maurislibero},
  description = {lacinia
non}
}

@entry{sodales,
  parent = {maurislibero},
  description = {sodales
quis}
}

@entry{dapibus,
  parent = {maurislibero},
  description = {dapibus
porttitor, pede}
}

@entry{class,
  name = {class},
  description = {aptent taciti}
}

@entry{sociosqu,
  parent = {class},
  description = {sociosqu}
}

@entry{adlitora,
  parent = {class},
  description = {ad litora}
}

@entry{torquent,
  parent = {class},
  description = {torquent per
conubia}
}

@entry{nostra,
  name = {nostra},
  description = {per inceptos
hymenaeos}
}

@entry{morbidapibus,
  parent = {nostra},
  description = {morbi
dapibus}
}

@entry{mauriscondimentum,
  parent = {nostra},
  description = {mauris
condimentum nulla}
}

@entry{cumsociis,
  name = {cum sociis},
  description = {natoque
penatibus}
}

@entry{etmagnis,
  parent = {cumsociis},
  description = {et
magnis}
}

@entry{disparturient,
  parent = {cumsociis},
  description = {dis
parturient montes}
}

%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-childnoname.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-cite.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% Encoding: UTF-8
%COMMENT
@entry{fusce,
  user1 = {article-minimal},
  name = {fusce},
  description = {suscipit cursus sem}
}

@entry{vivamus,
  user1 = {article-full},
  name = {vivamus},
  description = {risus mi, egestas ac}
}

@entry{imperdiet,
  user1 = {whole-journal},
  name = {imperdiet},
  description = {varius, faucibus quis, leo}
}

@entry{aenean2,
  user1 = {inbook-minimal},
  name = {aenean},
  description = {tincidunt}
}

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

@entry{aliquam2,
  user1 = {book-minimal},
  name = {aliquam},
  description = {sagittis elementum dolor}
}

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

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

@entry{aliquampurus,
  user1 = {booklet-full},
  name = {aliquam purus},
  description = {turpis, aliquam id}
}

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

@entry{maecenasluctus,
  user1 = {incollection-full},
  name = {maecenas luctus},
  description = {porta lorem}
}

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

@entry{proin,
  user1 = {manual-full},
  name = {proin},
  description = {tortor metus, convallis et}
}

@entry{hendrerit,
  user1 = {mastersthesis-minimal},
  name = {hendrerit},
  description = {non, scelerisque in, urna}
}

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

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

@entry{doneclacinia,
  user1 = {misc-full},
  name = {donec lacinia},
  description = {auctor libero}
}

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

@entry{vestibulum2,
  user1 = {inproceedings-minimal,phdthesis-minimal},
  name = {vestibulum},
  description = {iaculis risus}
}

@entry{pellentesque2,
  name = {pellentesque},
  description = {lacus}
}

%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-cite.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-images.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% Encoding: UTF-8
%COMMENT
@entry{sedfeugiat,
  user1 = {example-image},
  name = {sed feugiat},
  description = {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.
}
}

@entry{aliquamlectus,
  user1 = {example-image-a},
  name = {aliquam lectus},
  description = {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.
}
}

@entry{nullainipsum,
  user1 = {example-image-b},
  name = {nulla in ipsum},
  description = {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.
}
}

@entry{curabiturtellusmagna,
  user1 = {example-image-c},
  name = {curabitur tellus magna},
  description = {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.
}
}

@entry{nullanonmauris,
  user1 = {example-image-16x10},
  name = {nulla non mauris},
  description = {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.
}
}

@entry{etiampedemassa,
  user1 = {example-image-10x16},
  name = {etiam pede massa},
  description = {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.
}
}

@entry{donecetnisl,
  user1 = {example-image-16x9},
  name = {donec et nisl},
  description = {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.
}
}

@entry{vivamuseutellus,
  user1 = {example-image-9x16},
  name = {vivamus eu tellus},
  description = {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.
}
}

@entry{donecvelnibh,
  user1 = {example-image-golden},
  name = {donec vel nibh},
  description = {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.
}
}

@entry{crasdapibus,
  user1 = {example-image-golden-upright},
  name = {cras dapibus},
  description = {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.
}
}

@entry{sedconsequat,
  user1 = {example-image-1x1},
  name = {sed consequat},
  description = {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.
}
}

@entry{sedeleifend,
  name = {sed eleifend},
  description = {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.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-long.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% Encoding: UTF-8
%COMMENT
@entry{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.}
}

@entry{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.}
}

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

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

@entry{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.}
}

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

@entry{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.}
}

@entry{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.}
}

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

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

@entry{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.}
}

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

@entry{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.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-multipar.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% Encoding: UTF-8
%COMMENT
@entry{loremi-ii,
  name = {lorem 1--2},
  description = {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.}
}

@entry{loremiii-iv,
  name = {lorem 3--4},
  description = {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.}
}

@entry{loremv-vi,
  name = {lorem 5--6},
  description = {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.}
}

@entry{loremvii-viii,
  name = {lorem 7--8},
  description = {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.}
}

@entry{loremix-x,
  name = {lorem 9--10},
  description = {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.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-parent.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% Encoding: UTF-8
%COMMENT
@entry{sedmattis,
  name = {sed mattis},
  description = {erat sit amet}
}

@entry{nunc,
  name = {nunc},
  description = {nisl vitae}
}

@entry{nonconvallis,
  name = {non
convallis},
  description = {lectus orci ut nibh}
}

@entry{condimentum,
  name = {condimentum},
  description = {at
nisl}
}

@entry{aliquamet,
  name = {aliquam et},
  description = {augue}
}

@entry{rutrum,
  name = {rutrum},
  description = {id, enim}
}

%   child entries:


@entry{gravida,
  parent = {sedmattis},
  name = {gravida},
  description = {malesuada}
}

@entry{elitaugue,
  parent = {sedmattis},
  name = {elit augue},
  description = {egestas diam}
}

@entry{tempus,
  parent = {sedmattis},
  name = {tempus},
  description = {scelerisque}
}

@entry{libero,
  parent = {nunc},
  name = {libero},
  description = {sed
consequat}
}

@entry{feugiat,
  parent = {nunc},
  name = {feugiat},
  description = {massa}
}

@entry{porta,
  parent = {nunc},
  name = {porta},
  description = {eros
in eleifend}
}

@entry{variuserat,
  parent = {nunc},
  name = {varius erat},
  description = {leo rutrum dui}
}

@entry{sedlorem,
  parent = {nonconvallis},
  name = {sedlorem},
  description = {massa}
}

@entry{nonummyquis,
  parent = {nonconvallis},
  name = {nonummy
quis},
  description = {egestas id}
}

@entry{maecenas,
  parent = {condimentum},
  name = {maecenas},
  description = {at nibh}
}

@entry{atnunc,
  parent = {aliquamet},
  name = {at nunc},
  description = {pellentesque
ullamcorper}
}

@entry{phasellus,
  parent = {rutrum},
  name = {phasellus},
  description = {odio}
}

@entry{nullanulla,
  parent = {rutrum},
  name = {nulla nulla},
  description = {elit, molestie non}
}

% level 2:

@entry{duisnisl,
  parent = {atnunc},
  name = {duisnisl},
  description = {laoreet
suscipit}
}

@entry{duisnibh,
  parent = {atnunc},
  name = {duisnibh},
  description = {convallis ut}
}

%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-parent.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-symbols.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% Encoding: UTF-8
%COMMENT
@entry{alpha,
  symbol = {\ensuremath{\alpha}},
  name = {alpha},
  description = {Quisque ullamcorper placerat ipsum.}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@entry{omega,
  symbol = {\ensuremath{\omega}},
  name = {omega},
  description = {Mauris tempor ligula sed lacus.}
}

%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-symbols.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-url.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% Encoding: UTF-8
%COMMENT
@entry{aenean-url,
  user1 = {http://uk.tug.org/},
  name = {aenean},
  description = {adipiscing auctor est}
}

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

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

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

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

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

@entry{phasellus-url,
  user1 = {http://theoval.cmp.uea.ac.uk/},
  name = {phasellus},
  description = {arcu (catcode change)}
}

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

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

%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-url.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*example-glossaries-xr.bib>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<<COMMENT
% Encoding: UTF-8
%COMMENT
@entry{lorem,
  name = {lorem},
  description = {ipsum}
}

@entry{alias-lorem,
  name = {alias-lorem},
  description = {ipsum},
  alias = {lorem}
}

@entry{dolor,
  name = {dolor},
  description = {sit}
}

@entry{amet,
  see = {dolor},
  name = {amet},
  description = {consectetuer}
}

@entry{adipiscing,
  name = {adipiscing},
  description = {elit}
}

@entry{ut,
  name = {ut},
  description = {purus}
}

@entry{elit,
  name = {elit},
  description = {vestibulum},
  seealso = {adipiscing,ut}
}

@entry{placerat,
  name = {placerat},
  description = {ac}
}

@entry{vitae,
  name = {vitae},
  description = {felis}
}

@entry{curabitur,
  name = {curabitur},
  description = {gravida}
}

@entry{mauris,
  name = {mauris},
  description = {nam}
}

@entry{arcu,
  name = {arcu},
  description = {libero},
  seealso = {placerat,vitae,curabitur}
}

@entry{nonummy,
  name = {nonummy},
  description = {eget},
  seealso = {mauris}
}

@entry{consectetuer,
  parent = {nonummy},
  name = {consectetuer},
  description = {id}
}

@entry{vulputate,
  parent = {nonummy},
  name = {vulputate},
  description = {a magna}
}

@entry{donec,
  name = {donec},
  description = {vehicula}
}

@entry{augue,
  name = {augue},
  description = {eu neque}
}

@entry{pellentesque,
  see = {augue},
  name = {pellentesque},
  description = {habitant}
}

@entry{morbi,
  name = {morbi},
  description = {tristique}
}

@entry{senectus,
  name = {senectus},
  description = {et netus}
}

@entry{et,
  see = {vulputate},
  name = {et},
  description = {malesuada}
}

@entry{fames,
  name = {fames},
  description = {ac}
}

@entry{turpis,
  name = {turpis},
  description = {egestas},
  seealso = {consectetuer}
}

@entry{leo,
  name = {leo},
  description = {cras}
}

@entry{viverra,
  name = {viverra},
  description = {metus}
}

@entry{rhoncus,
  name = {rhoncus},
  description = {sem}
}

@entry{nulla,
  name = {nulla},
  description = {et}
}

@entry{lectus,
  name = {lectus},
  description = {vestibulum}
}

@entry{urna,
  parent = {lectus},
  see = {nulla},
  name = {urna},
  description = {fringilla}
}

@entry{ultrices,
  parent = {lectus},
  name = {ultrices},
  description = {phasellus}
}

@entry{eu,
  parent = {lectus},
  name = {eu},
  description = {tellus}
}

@entry{alias-eu,
  name = {alias-eu},
  description = {tellus},
  alias = {eu}
}

@entry{sit,
  name = {sit},
  description = {amet}
}

@entry{tortor,
  name = {tortor},
  description = {gravida}
}

@entry{integer,
  name = {integer},
  description = {sapien}
}

@entry{est,
  name = {est},
  description = {iaculis}
}

@entry{in,
  name = {in},
  description = {pretium},
  seealso = {sit,tortor,est}
}

@entry{quis,
  name = {quis},
  description = {viverra}
}

@entry{ac,
  name = {ac},
  description = {nunc}
}

@entry{praesent,
  name = {praesent},
  description = {eget \gls{ac}}
}

@entry{sem,
  name = {sem},
  description = {vel leo
\glshyperlink{quis}}
}

@entry{bibendum,
  name = {bibendum},
  description = {ultrices}
}

@entry{aenean,
  name = {aenean},
  description = {faucibus}
}

@entry{malesuada,
  parent = {aenean},
  name = {malesuada},
  description = {eu}
}

@entry{pulvinar,
  parent = {aenean},
  name = {pulvinar},
  description = {at}
}

@entry{mollis,
  parent = {aenean},
  name = {mollis},
  description = {ac nulla}
}

@entry{auctor,
  parent = {aenean},
  name = {auctor},
  description = {semper}
}

@entry{varius,
  parent = {aenean},
  name = {varius},
  description = {orci}
}

@entry{eget,
  name = {eget},
  description = {risus}
}

@entry{duis,
  name = {duis},
  description = {nibh}
}

@entry{mi,
  name = {mi},
  description = {congue}
}

@entry{accumsan,
  name = {accumsan},
  description = {eleifend}
}

@entry{sagittis,
  see = {eget},
  name = {sagittis},
  description = {quis}
}

@entry{diam,
  name = {diam},
  description = {duis}
}

@entry{orci,
  name = {orci},
  description = {dignissim},
  seealso = {diam}
}

%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</example-glossaries-xr.bib>
%    \end{macrocode}
%\fi
%\Finale
\endinput
