%\iffalse
% glossaries.dtx generated using makedtx version 0.94b (c) Nicola Talbot
% Command line args:
%   -macrocode "glossaries\.perl"
%   -macrocode ".*\.tex"
%   -macrocode ".*\.xdy"
%   -setambles "glossaries\.perl=>\nopreamble\nopostamble"
%   -setambles ".*\.tex=>\nopreamble\nopostamble"
%   -setambles ".*\.xdy=>\nopreamble\nopostamble"
%   -comment "glossaries\.perl"
%   -comment ".*\.tex"
%   -comment ".*\.xdy"
%   -src "glossaries.sty\Z=>glossaries.sty"
%   -src "mfirstuc.sty\Z=>mfirstuc.sty"
%   -src "(glossary-.+)\.(sty)\Z=>\1.\2"
%   -src "(glossaries-accsupp)\.(sty)\Z=>\1.\2"
%   -src "(glossaries-babel)\.(sty)\Z=>\1.\2"
%   -src "(glossaries-polyglossia)\.(sty)\Z=>\1.\2"
%   -src "(glossaries-dictionary-.+)\.(dict)\Z=>\1.\2"
%   -src "(minimalgls\.tex)\Z=>\1"
%   -src "(sample.*\.tex)\Z=>\1"
%   -src "(samplexdy-mc\.xdy)\Z=>\1"
%   -src "(database.*\.tex)\Z=>\1"
%   -src "(glossaries\.perl)\Z=>\1"
%   -doc "glossaries-manual.tex"
%   -author "Nicola Talbot"
%   -codetitle "Glossaries Documented Code"
%   glossaries
% Created on 2010/7/10 12:21
%\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) 2010 Nicola Talbot, all rights reserved.
% \fi
% \iffalse
%<*driver>
\documentclass{nlctdoc}

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

\doxitem{Option}{option}{package options}
\doxitem{GlsKey}{key}{glossary keys}
\doxitem{Style}{style}{glossary styles}

\setcounter{IndexColumns}{2}

\CheckSum{11106}

\newcommand*{\tick}{\ding{51}}

\newcommand*{\ifirstuse}{\iterm{first use}}
\newcommand*{\firstuse}{first use\ifirstuse}
\newcommand*{\firstuseflag}{first use flag\ifirstuseflag}
\newcommand*{\firstusetext}{first use text\ifirstusetext}

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

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

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

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


\begin{document}
\DocInput{glossaries.dtx}
\end{document}
%</driver>
%\fi
%\MakeShortVerb{"}
%\DeleteShortVerb{\|}
%
% \title{glossaries.sty v2.07: 
%   \LaTeXe\ Package to Assist Generating Glossaries}
% \author{Nicola L.C. Talbot\\[10pt]
%School of Computing Sciences\\
%University of East Anglia\\
%Norwich. Norfolk\\
%NR4 7TJ. United Kingdom.\\
%\url{http://theoval.cmp.uea.ac.uk/~nlct/}}
%
% \date{2010-07-10}
% \maketitle
%
%This is the user manual for the \styfmt{glossaries} package. Other
%documents accompanying this manual:
%\begin{itemize}
%\item \qtdocref{The glossaries package: a guide for beginners}{glossariesbegin}
%\item \qtdocref{Upgrading from the glossary package to the
%glossaries package}{glossary2glossaries}
%\end{itemize}
%See the file \texttt{INSTALL} for installation instructions.
%Related web resources:
%\begin{itemize}
%\item
%\urlfootref{http://theoval.cmp.uea.ac.uk/~nlct/latex/packages/faq/glossariesfaq.html}{The glossaries FAQ}
%
%\item
%\urlfootref{http://www.latex-community.org/index.php?option=com_content&view=article&id=263&Itemid=114}{Glossaries,
%Nomenclature, Lists of Symbols and Acronyms }
%\end{itemize}
%
%\clearpage
%\tableofcontents
%
% \section{Introduction}
%
% \changes{1.0}{2007 May 16}{Initial version}
%The \styfmt{glossaries} package is provided to assist generating
%glossaries. It has a certain amount of flexibility, allowing the
%user to customize the format of the glossary and define multiple
%glossaries. It also supports acronyms and glossary styles that
%include symbols (in addition to a name and description) for glossary
%entries. There is provision for loading a database of glossary
%terms. Only those terms used\footnote{that is, if the term has been
%referenced using any of the commands described in
%\sectionref{sec:glslink}, \sectionref{sec:glsadd} or via
%\ics{glssee} (or the \gloskey{see} key)} in the document will be
%added to the glossary.
%
%\textbf{This package replaces the \sty{glossary} package which is
%now obsolete.} Please see the document \qtdocref{Upgrading from the
%glossary package to the glossaries package}{glossary2glossaries} for
%assistance in upgrading.
%
%One of the strengths of this package is its flexibility, however
%the drawback of this is the necessity of having a large manual
%that can cover all the various settings. If you are daunted by the
%size of the manual, try starting off with the much shorter
%\docref{guide for beginners}{glossariesbegin}.
%
%\begin{important}
%The \styfmt{glossaries} package comes with a
%\href{http://www.perl.org/about.html}{Perl} script called
%\app{makeglossaries}. This provides a convenient interface to
%\app{makeindex} or \app{xindy}. It is strongly recommended
%that you use this script, but \emph{it is not essential}. If you are
%reluctant to install Perl, or for any other reason you don't want to
%use \app{makeglossaries}, you can called \app{makeindex} or
%\app{xindy} explicitly. See \sectionref{sec:makeglossaries} for
%further details.
%\end{important}
%
%This manual is structured as follows:
%\begin{itemize}
%\item \sectionref{sec:overview} gives an overview of the main user
%commands and their syntax.
%
%\item \sectionref{sec:mfirstuc} describes the associated
%\styfmt{mfirstuc} package.
%
%\ifpdf
%  \item \sectionref{sec:code} contains the documented source code for 
%  those who want to know more about how the package works. This 
%  describes more advanced commands, such as determining if an entry or 
%  a glossary exists and commands that iterate through defined terms or
%  glossaries.
%
%  \item \sectionref{sec:code:mfirstuc} contains the documented code for 
%  the \styfmt{mfirstuc} package.
%\fi 
%\end{itemize}
%\ifpdf
%\else
%  The \href{glossaries.pdf}{PDF version} of this manual also describes 
%  more advanced commands in the documented code section (such as 
%  determining if an entry or a glossary exists and commands that 
%  iterate through defined terms or glossaries).
%\fi
%
%\noindent The remainder of this introductory section covers the
%following:
%\begin{itemize}
%\item \sectionref{sec:samples} lists the sample documents provided 
%with this package.
%
%\item \sectionref{sec:languages} provides information for users who
%wish to write in a language other than English.
%
%\item \sectionref{sec:makeglossaries} describes how to use a
%post-processor to create the sorted glossaries for your document.
%
%\item \sectionref{sec:trouble} provides some assistance in the event
%that you encounter a problem.
%\end{itemize}
%
%
%\subsection{Sample Documents}
%\label{sec:samples}
%
%The \styfmt{glossaries} package is provided with some sample
%documents that illustrate the various functions. These should
%be located in the \texttt{samples} subdirectory (folder) of the
%\styfmt{glossaries} documentation directory. This location varies
%according to your operating system and \TeX\ distribution. You
%can use \texttt{texdoc} to locate the main glossaries documentation.
%For example, in a terminal or command prompt, type:
%\begin{prompt}
%texdoc -l glossaries
%\end{prompt}
%This should display the full pathname of the file 
%\texttt{glossaries.pdf}. View the contents of that directory and
%see if it contains the \texttt{samples} subdirectory.
%
%If you can't find the sample files, they are available in the
%subdirectory \texttt{doc/latex/glossaries/samples/} in the
%\texttt{glossaries.tds.zip} archive which can be downloaded from
%\href{http://tug.ctan.org/tex-archive/macros/latex/contrib/glossaries/}{CTAN}.
%
%
%The sample documents are as follows:
%\begin{description}
%\item[minimalgls.tex]\label{ex:minimalgls} This document is a
%minimal working example. You can test your installation using this
%file. To create the complete document you will need to do the
%following steps:
%  \begin{enumerate}
%  \item Run \texttt{minimalgls.tex} through \LaTeX\ either by 
%  typing
%\begin{prompt}
%latex minimalgls
%\end{prompt}
%  in a terminal or by using the relevant button or menu item in
%  your text editor or front-end. This will create the required 
%  associated files but you will not see the glossary. If you use 
%  PDF\LaTeX\ you will also get warnings about non-existent 
%  references. These warnings may be ignored on the first run.
%
%  If you get a \verb"Missing \begin{document}" error, then 
%  it's most likely that your version of \sty{xkeyval} is 
%  out of date. Check the log file for a warning of that nature. 
%  If this is the case, you will need to update the \styfmt{xkeyval}
%  package.
%
%  \item Run \app{makeglossaries} on the document. This can
%  be done on a terminal either by typing
%\begin{prompt}
%makeglossaries minimalgls
%\end{prompt}
%  or by typing
%\begin{prompt}
%perl makeglossaries minimalgls
%\end{prompt}
%  If your system doesn't recognise the command \texttt{perl} then
%  it's likely you don't have Perl installed. In which case you
%  will need to use \app{makeindex} directly. You can do this
%  in a terminal by typing (all on one line):
%\begin{prompt}
%makeindex -s minimalgls.ist -t minimalgls.glg -o minimalgls.gls minimalgls.glo
%\end{prompt}
%  (See \sectionref{sec:makeindexapp} for further details on using 
%   \app{makeindex} explicitly.)
%
%  Note that if you need to specify the full path and the path
%  contains spaces, you will need to delimit the file names with
%  the double-quote character.
%
%  \item Run \texttt{minimalgls.tex} through \LaTeX\ again (as step~1)
%  \end{enumerate}
%You should now have a complete document. The number following
%each entry in the glossary is the location number. By default, this 
%is the page number where the entry was referenced.
%
%\item[sample4col.tex]\label{ex:sample4col} This document illustrates
%a four column glossary where the entries have a symbol in addition
%to the name and description. To create the complete document, you
%need to do:
%\begin{prompt}
%latex sample4col
%makeglossaries sample4col
%latex sample4col
%\end{prompt}
%As before, if you don't have Perl installed, you will need to use
%\app{makeindex} directly instead of using
%\app{makeglossaries}. The vertical gap between entries is the
%gap created at the start of each group. This can be suppressed by
%redefining \ics{glsgroupskip} after the glossary style has been set:
%\begin{verbatim}
%\renewcommand*{\glsgroupskip}{}
%\end{verbatim}
%
%\item[sampleAcr.tex]\label{ex:sampleAcr} This document has some
%sample acronyms. It also adds the glossary to the table of contents,
%so an extra run through \LaTeX\ is required to ensure the document
%is up to date:
%\begin{prompt}
%latex sampleAcr
%makeglossaries sampleAcr
%latex sampleAcr
%latex sampleAcr
%\end{prompt}
%
%\item[sampleAcrDesc.tex]\label{ex:sampleAcrDesc} This is similar to
%the previous example, except that the acronyms have an associated
%description. As with the previous example, the glossary is added to
%the table of contents, so an extra run through \LaTeX\ is required:
%\begin{prompt}
%latex sampleAcrDesc
%makeglossaries sampleAcrDesc
%latex sampleAcrDesc
%latex sampleAcrDesc
%\end{prompt}
%
%\item[sampleDesc.tex]\label{ex:sampleDesc} This is similar to the
%previous example, except that it defines the acronyms using
%\ics{newglossaryentry} instead of \ics{newacronym}. As with the
%previous example, the glossary is added to the table of contents, so
%an extra run through \LaTeX\ is required:
%\begin{prompt}
%latex sampleDesc
%makeglossaries sampleDesc
%latex sampleDesc
%latex sampleDesc
%\end{prompt}
%
%\item[sample-custom-acronym.tex]\label{ex:sample-custom-acronym}
%This document illustrates how to define your own acronym style if
%the predefined styles don't suit your requirements.
%\begin{prompt}
%latex sample-custom-acronym
%makeglossaries sample-custom-acronym
%latex sample-custom-acronym
%\end{prompt}
%
%\item[sampleDB.tex]\label{ex:sampleDB} This document illustrates how
%to load external files containing the glossary definitions. It also
%illustrates how to define a new glossary type. This document has the
%\term{number list} suppressed and uses \ics{glsaddall} to add all
%the entries to the glossaries without referencing each one
%explicitly. To create the document do:
%\begin{prompt}
%latex sampleDB
%makeglossaries sampleDB
%latex sampleDB
%\end{prompt}
%The glossary definitions are stored in the accompanying files
%\texttt{database1.tex} and \texttt{database2.tex}. Note that if you
%don't have Perl installed, you will need to use \app{makeindex}
%twice instead of a single call to \app{makeglossaries}:
%\begin{enumerate}
%\item Create the main glossary:
%\begin{prompt}
%makeindex -s sampleDB.ist -t sampleDB.glg -o sampleDB.gls sampleDB.glo
%\end{prompt}
%\item Create the secondary glossary:
%\begin{prompt}
%makeindex -s sampleDB.ist -t sampleDB.nlg -o sampleDB.not sampleDB.ntn
%\end{prompt}
%\end{enumerate}
%
%\item[sampleEq.tex]\label{ex:sampleEq} This document illustrates how
%to change the location to something other than the page number. In
%this case, the \texttt{equation} counter is used since all glossary
%entries appear inside an \env{equation} environment. To create
%the document do:
%\begin{prompt}
%latex sampleEq
%makeglossaries sampleEq
%latex sampleEq
%\end{prompt}
%
%\item[sampleEqPg.tex]\label{ex:sampleEqPg} This is similar to the
%previous example, but the number lists\iterm{number list} are a
%mixture of page numbers and equation numbers. This example adds the
%glossary to the table of contents, so an extra \LaTeX\ run is
%required:
%\begin{prompt}
%latex sampleEqPg
%makeglossaries sampleEqPg
%latex sampleEqPg
%latex sampleEqPg
%\end{prompt}
%
%\item[sampleSec.tex]\label{ex:sampleSec} This document also
%illustrates how to change the location to something other than the
%page number. In this case, the \texttt{section} counter is used.
%This example adds the glossary to the table of contents, so an extra
%\LaTeX\ run is required:
%\begin{prompt}
%latex sampleSec
%makeglossaries sampleSec
%latex sampleSec
%latex sampleSec
%\end{prompt}
%
%\item[sampleNtn.tex]\label{ex:sampleNtn} This document illustrates
%how to create an additional glossary type. This example adds the
%glossary to the table of contents, so an extra \LaTeX\ run is
%required:
%\begin{prompt}
%latex sampleNtn
%makeglossaries sampleNtn
%latex sampleNtn
%latex sampleNtn
%\end{prompt}
%Note that if you don't have Perl installed, you will need to use
%\app{makeindex} twice instead of a single call to
%\app{makeglossaries}:
%\begin{enumerate}
%\item Create the main glossary:
%\begin{prompt}
%makeindex -s sampleNtn.ist -t sampleNtn.glg -o sampleNtn.gls sampleNtn.glo
%\end{prompt}
%\item Create the secondary glossary:
%\begin{prompt}
%makeindex -s sampleNtn.ist -t sampleNtn.nlg -o sampleNtn.not sampleNtn.ntn
%\end{prompt}
%\end{enumerate}
%
%\item[sample.tex]\label{ex:sample} This document illustrates some of
%the basics, including how to create child entries that use the same
%name as the parent entry. This example adds the glossary to the
%table of contents, so an extra \LaTeX\ run is required:
%\begin{prompt}
%latex sample
%makeglossaries sample
%latex sample
%latex sample
%\end{prompt}
%You can see the difference between word and letter ordering if you
%substitute \pkgopt[word]{order} with \pkgopt[letter]{order}. (Note
%that this will only have an effect if you use
%\app{makeglossaries}. If you use \app{makeindex} explicitly,
%you will need to use the \texttt{-l} switch to indicate letter
%ordering.)
%
%\item[sampletree.tex]\label{ex:sampletree} This document illustrates
%a hierarchical glossary structure where child entries have different
%names to their corresponding parent entry. To create the document
%do:
%\begin{prompt}
%latex sampletree
%makeglossaries sampletree
%latex sampletree
%\end{prompt}
%
%\item[samplexdy.tex]\label{ex:samplexdy} This document illustrates
%how to use the \styfmt{glossaries} package with \app{xindy} instead
%of \app{makeindex}. The document uses UTF8 encoding (with the
%\sty{inputenc} package). The encoding is picked up by
%\app{makeglossaries}. By default, this document will create a
%\app{xindy} style file called \texttt{samplexdy.xdy}, but if you
%uncomment the lines
%\begin{verbatim}
%\setStyleFile{samplexdy-mc}
%\noist
%\GlsSetXdyLanguage{}
%\end{verbatim}
%it will set the style file to \texttt{samplexdy-mc.xdy} instead.
%This provides an additional letter group for entries starting with
%\qt{Mc} or \qt{Mac}. If you use \app{makeglossaries}, you don't
%need to supply any additional information. If you don't use
%\app{makeglossaries}, you will need to specify the required
%information. Note that if you set the style file to
%\texttt{samplexdy-mc.xdy} you must also specify \ics{noist},
%otherwise the \styfmt{glossaries} package will overwrite
%\texttt{samplexdy-mc.xdy} and you will lose the \qt{Mc} letter
%group.
%
%To create the document do:
%\begin{prompt}
%latex samplexdy
%makeglossaries samplexdy
%latex samplexdy
%\end{prompt}
%If you don't have Perl installed, you will have to call 
%\app{xindy} explicitly instead of using \app{makeglossaries}.
%If you are using the default style file \texttt{samplexdy.xdy}, then
%do (no line breaks):
%\begin{prompt}
%xindy -L english -C utf8 -I xindy -M samplexdy -t samplexdy.glg -o samplexdy.gls samplexdy.glo
%\end{prompt}
%otherwise, if you are using \texttt{samplexdy-mc.xdy}, then do
%(no line breaks):
%\begin{prompt}
%xindy -I xindy -M samplexdy-mc -t samplexdy.glg -o samplexdy.gls samplexdy.glo
%\end{prompt}
%
%\item[sampleutf8.tex]\label{ex:sampleutf8} This is another example
%that uses \app{xindy}. Unlike \app{makeindex},
%\app{xindy} can cope with accented or non-Latin characters. This
%document uses UTF8 encoding. To create the document do:
%\begin{prompt}
%latex sampleutf8
%makeglossaries sampleutf8
%latex sampleutf8
%\end{prompt}
%If you don't have Perl installed, you will have to call
%\app{xindy} explicitly instead of using \app{makeglossaries}
%(no line breaks):
%\begin{prompt}
%xindy -L english -C utf8 -I xindy -M sampleutf8 -t sampleutf8.glg -o sampleutf8.gls sampleutf8.glo
%\end{prompt}
%
%If you remove the \pkgopt{xindy} option from \texttt{sampleutf8.tex} 
%and do:
%\begin{prompt}
%latex sampleutf8
%makeglossaries sampleutf8
%latex sampleutf8
%\end{prompt}
%you will see that the entries that start with a non-Latin character
%now appear in the symbols group, and the word \qt{man\oe uvre} is now 
%after \qt{manor} instead of before it. If you are unable to use
%\app{makeglossaries}, the call to \app{makeindex} is as
%follows (no line breaks):
%\begin{prompt}
%makeindex -s sampleutf8.ist -t sampleutf8.glg -o sampleutf8.gls sampleutf8.glo
%\end{prompt}
%
%\item[sampleaccsupp.tex]\label{ex:sampleaccsupp} This document
%uses the experimental \sty{glossaries-accsupp} package. The
%symbol is set to the replacement text. Note that some PDF
%viewers don't use the accessibility support. Information 
%about the \styfmt{glossaries-accsupp} package can be found in
%\sectionref{sec:accsupp}.
%
%\end{description}
%
%
%\subsection{Multi-Lingual Support}
%\label{sec:languages}
%
%As from version 1.17, the \styfmt{glossaries} package can now be
%used with \app{xindy} as well as \app{makeindex}. If you
%are writing in a language that uses accented characters or
%non-Latin characters it is recommended that you use \app{xindy}
%as \app{makeindex} is hard-coded for Latin languages. This
%means that you are not restricted to the A, \ldots, Z letter groups.
%If you want to use \app{xindy}, remember to use the
%\pkgopt{xindy} package option. For example:
%\begin{verbatim}
%\documentclass[frenchb]{article}
%\usepackage[utf8]{inputenc}
%\usepackage[T1]{fontenc}
%\usepackage{babel}
%\usepackage[xindy]{glossaries}
%\end{verbatim}
%
%\begin{important}
%If you use an accented or other expandable character at the start of
%an entry name, you must place it in a group, or it will cause
%a problem for commands that convert the first letter to uppercase
%(e.g.\ \ics{Gls}) due to expansion issues. For example:
%\begin{verbatim}
%\newglossaryentry{elite}{name={{é}lite},
%description={select group or class}}
%\end{verbatim}
%\end{important}
%
%If you use the \sty{inputenc} package, \app{makeglossaries}
%will pick up the encoding from the auxiliary file. If you use
%\app{xindy} explicitly instead of via \app{makeglossaries},
%you may need to specify the encoding using the \texttt{-C} 
%option. Read the \app{xindy} manual for further details.
%
%\subsubsection{Changing the Fixed Names}
%\label{sec:fixednames}
%
%As from version 1.08, the \styfmt{glossaries} package now has
%limited multi-lingual support, thanks to all the people who have sent
%me the relevant translations either via email or via 
%\texttt{comp.text.tex}.
%However you must load \sty{babel} or \sty{polyglossia} \emph{before} 
%\styfmt{glossaries} to enable this. Note that if \sty{babel} is loaded 
%and the \sty{translator} package is detected on \TeX's path, then the
%\sty{translator} package will be loaded automatically.  However,
%it may not pick up on the required languages so, if the predefined
%text is not translated, you may need to explicitly load the
%\sty{translator} package with the required languages. For example:
%\begin{verbatim}
%\usepackage[spanish]{babel}
%\usepackage[spanish]{translator}
%\usepackage{glossaries}
%\end{verbatim}
%Alternatively, specify the language as a class option rather
%than a package option. For example:
%\begin{verbatim}
%\documentclass[spanish]{report}
%
%\usepackage{babel}
%\usepackage{glossaries}
%\end{verbatim}
%
%If you want to use \sty{ngerman} or \sty{german} instead
%of \sty{babel}, you will need to include the \sty{translator} package 
%to provide the translations. For example:
%\begin{verbatim}
%\documentclass[ngerman]{article}
%\usepackage{ngerman}
%\usepackage{translator}
%\usepackage{glossaries}
%\end{verbatim}
%
%The languages are currently supported by the
%\styfmt{glossaries} package are listed in
%\tableref{tab:supportedlanguages}.
%
%\begin{table}[htbp]
%\caption{Supported Languages}
%\label{tab:supportedlanguages}
%\begin{center}
%\begin{tabular}{lc}
%\bfseries Language & \bfseries As from version\\
%Brazilian Portuguese & 1.17\\
%Danish & 1.08\\
%Dutch & 1.08\\
%English & 1.08\\
%French & 1.08\\
%German & 1.08\\
%Irish & 1.08\\
%Italian & 1.08\\
%Hungarian & 1.08\\
%Polish & 1.13\\
%Serbian & 2.06\\
%Spanish & 1.08
%\end{tabular}
%\end{center}
%\end{table}
%
%The language dependent commands and \sty{translator} keys used by the 
%glossaries package are listed in \tableref{tab:predefinednames}.
%
%\begin{table}[htbp]
%\caption{Customised Text}
%\label{tab:predefinednames}
%\begin{center}
%\begin{tabular}{@{}llp{0.4\linewidth}@{}}
%\bfseries Command Name & \bfseries Translator Key Word &
%\bfseries Purpose\\
%\ics{glossaryname} & \texttt{Glossary} & Title of the main glossary.\\
%\ics{acronymname} & \texttt{Acronyms} & Title of the list of acronyms
%(when used with package option \pkgopt{acronym}).\\
%\ics{entryname} & \texttt{Notation (glossaries)} & 
%Header for first column in the glossary (for 2, 3 or 4 column glossaries 
%that support headers).\\
%\ics{descriptionname} & \texttt{Description (glossaries)} &
%Header for second column in the glossary (for 2, 3 or 4 column glossaries
%that support headers).\\
%\ics{symbolname} & \texttt{Symbol (glossaries)} & Header for symbol
%column in the glossary for glossary styles that support this option.\\
%\ics{pagelistname} & \texttt{Page List (glossaries)} & 
%Header for page list column in the glossary for glossaries that support 
%this option.\\
%\ics{glssymbolsgroupname} & \texttt{Symbols (glossaries)} & 
%Header for symbols section of the glossary for glossary styles that 
%support this option.\\
%\ics{glsnumbersgroupname} & \texttt{Numbers (glossaries)} & Header for
%numbers section of the glossary for glossary styles that support
%this option.
%\end{tabular}
%\end{center}
%\end{table}
%
%Due to the varied nature of glossaries, it's likely that the
%predefined translations may not be appropriate. If you are using the
%\sty{babel} package and do not have the \sty{translator} package
%installed, you need to be familiar with the advice given in
%\urlref{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=latexwords}{changing
%the words babel uses}. If you have the \sty{translator} package
%installed, then you can provide your own dictionary with the
%necessary modifications (using \cs{deftranslation}) and load it
%using \cs{usedictionary}. Note that the dictionaries are loaded at
%the beginning of the document, so it won't have any effect if you
%put \cs{deftranslation} in the preamble. It should be put in your
%personal dictionary instead. See the \sty{translator} documentation
%for further details.
%
%If you are using \sty{babel} and don't want to use the
%\sty{translator} interface, you can suppress it using the package
%option \pkgopt[false]{translate}, and either load
%\sty{glossaries-babel} after \styfmt{glossaries} or specify you're own
%translations. For example:
%\begin{verbatim}
%\documentclass[british]{article}
%
%\usepackage{babel}
%\usepackage[translate=false]{glossaries}
%\usepackage{glossaries-babel}
%\end{verbatim}
%or:
%\begin{verbatim}
%\documentclass[british]{article}
%
%\usepackage{babel}
%\usepackage[translate=false]{glossaries}
%
%\addto\captionsbritish{%
%    \renewcommand*{\glossaryname}{List of Terms}%
%    \renewcommand*{\acronymname}{List of Acronyms}%
%    \renewcommand*{\entryname}{Notation}%
%    \renewcommand*{\descriptionname}{Description}%
%    \renewcommand*{\symbolname}{Symbol}%
%    \renewcommand*{\pagelistname}{Page List}%
%    \renewcommand*{\glssymbolsgroupname}{Symbols}%
%    \renewcommand*{\glsnumbersgroupname}{Numbers}%
%}
%\end{verbatim}
%
%If you are using \sty{polyglossia} instead of \sty{babel}, 
%\sty{glossaries-polyglossia} will automatically be loaded unless
%you specify the package option \pkgopt[false]{translate}.
%
%Note that \app{xindy} provides much better multi-lingual support
%than \app{makeindex}, so it's recommended that you use \app{xindy}
%if you have glossary entries that contain diacritics or
%non-Roman letters. See \sectionref{sec:xindy} for further
%details.
%
%\subsection{Generating the Associated Glossary Files}
%\label{sec:makeglossaries}
%
%In order to generate a sorted glossary with compact location lists,
%it is necessary to use an external indexing application as an
%intermediate step. It is this application that creates the file
%containing the code that typesets the glossary. If this step is
%omitted, the glossaries will not appear in your document. The two
%indexing applications that are most commonly used with \LaTeX\ are
%\app{makeindex} and \app{xindy}. As from version 1.17, the
%\styfmt{glossaries} package can be used with either of these
%applications. Previous versions were designed to be used with
%\app{makeindex} only. Note that \app{xindy} has much better
%multi-lingual support than \app{makeindex}, so \app{xindy} is
%recommended if you're not writing in English. Commands that only
%have an effect when \app{xindy} is used are described in
%\sectionref{sec:xindy}.
%
%
%The \styfmt{glossaries} package comes with the Perl script
%\app{makeglossaries} which will run \app{makeindex} or \app{xindy}
%on all the glossary files using a customized style file (which is
%created by \ics{makeglossaries}). See
%\sectionref{sec:makeglossariesapp} for further
%details. Perl is stable, cross-platform, open source software that
%is used by a number of \TeX-related applications. Further
%information is available at \url{http://www.perl.org/about.html}.
%However, whilst it is strongly recommended that you use the
%\app{makeglossaries} script, it is possible to use the
%\styfmt{glossaries} package without having Perl installed. In which
%case, if you have used the \pkgopt{xindy} package option, you will
%need to use \app{xindy} (see \sectionref{sec:xindyapp}), otherwise
%you will need to use \app{makeindex} (see
%\sectionref{sec:makeindexapp}). Note that some commands and package
%options have no effect if you don't use \app{makeglossaries}. These
%are listed in \tableref{tab:makeglossariesCmds}.
%
%Note that if any of your entries use an entry
%that is not referenced outside the glossary, you will need to
%do an additional \app{makeglossaries}, \app{makeindex}
%or \app{xindy} run, as appropriate. For example,
%suppose you have defined the following entries:
%\begin{verbatim}
%\newglossaryentry{citrusfruit}{name={citrus fruit},
%description={fruit of any citrus tree. (See also 
%\gls{orange})}}
%
%\newglossaryentry{orange}{name={orange},
%description={an orange coloured fruit.}}
%\end{verbatim}
%and suppose you have \verb|\gls{citrusfruit}| in your document
%but don't reference the \texttt{orange} entry, then the
%\texttt{orange} entry won't appear in your glossary until
%you first create the glossary and then do another run
%of \app{makeglossaries}, \app{makeindex} or \app{xindy}.
%For example, if the document is called \texttt{myDoc.tex}, then
%you must do:
%\begin{prompt}
%latex myDoc
%makeglossaries myDoc
%latex myDoc
%makeglossaries myDoc
%latex myDoc
%\end{prompt}
%
%Likewise, an additional \app{makeglossaries} and \LaTeX\ run
%may be required if the document pages shift with re-runs. For
%example, if the page numbering is not reset after the table of
%contents, the insertion of the table of contents on the second
%\LaTeX\ run may push glossary entries across page boundaries, which
%means that the number lists\iterm{number list} in the glossary may 
%need updating.
%
%The examples in this document assume that you are accessing
%\app{makeglossaries}, \app{xindy} or \app{makeindex} via a terminal.
%Windows users can use the MSDOS Prompt which is usually accessed via
%the \menu{Start}\submenu{All Programs} menu or
%\menu{Start}\submenu{All Programs}\submenu{Accessories} menu.
%
%Alternatively, your text editor may have the facility to create a
%function that will call the required application. The article
%\href{http://www.latex-community.org/index.php?option=com_content&view=article\&id=263:glossaries-nomenclature-lists-of-symbols-and-acronyms&catid=55:latex-general&Itemid=114}{\qt{Glossaries, Nomenclature, List of Symbols and
%Acronyms}}
%in the \urlfootref{http://www.latex-community.org/}{\LaTeX\
%Community's} Know How section
%describes how to do this for TeXnicCenter, and the thread
%\href{http://groups.google.com/group/comp.text.tex/browse_thread/thread/edd83831b81b0759?hl=en}{\qt{Executing Glossaries' makeindex from a WinEdt
%macro}} on the \texttt{comp.text.tex} newsgroup
%describes how to do it for WinEdt. For other editors see the editor's
%user manual for further details.
%
%If any problems occur, remember to check the transcript files 
%(e.g.\ \filetype{.glg} or \filetype{.alg}) for messages.
%
%\begin{table}[htbp]
%\caption{Commands and package options that have no effect when
%using \texttt{xindy} or \texttt{makeindex} explicitly}
%\label{tab:makeglossariesCmds}
%\vskip\baselineskip
%\begin{tabular}{@{}lll@{}}
%\bfseries Command or Package Option & \app{makeindex} & 
%\app{xindy}\\
%\pkgopt[letter]{order} & use \texttt{-l} &
% use \texttt{-M ord/letorder}\\
%\pkgopt[word]{order} & default & default\\
%\pkgopt{xindy}=\{\pkgoptfmt{language=}\meta{lang}\pkgoptfmt{,codename=}\meta{code}\} &
%N/A & use \texttt{-L} \meta{lang} \texttt{-C} \meta{code}\\
%\ics{GlsSetXdyLanguage}\marg{lang} & N/A &
%use \texttt{-L} \meta{lang}\\
%\ics{GlsSetXdyCodePage}\marg{code} & N/A &
%use \texttt{-C} \meta{code}
%\end{tabular}
%\par
%\end{table}
%
%
%\subsubsection{Using the makeglossaries Perl Script}
%\label{sec:makeglossariesapp}
%
%The \app{makeglossaries} script picks up the relevant information
%from the auxiliary (\filetype{.aux}) file and will either call
%\app{xindy} or \app{makeindex}, depending on the supplied
%information. Therefore, you only need to pass the document's name
%without the extension to \app{makeglossaries}. For example, if your
%document is called \texttt{myDoc.tex}, type the following in your
%terminal:
%\begin{prompt}
%latex myDoc
%makeglossaries myDoc
%latex myDoc
%\end{prompt}
%You may need to explicitly load \app{makeglossaries} into Perl:
%\begin{prompt}
%perl makeglossaries myDoc
%\end{prompt}
%There is a batch file called \texttt{makeglossaries.bat} which does
%this for Windows users, but you must have Perl installed to be able
%to use it.
%
%The \app{makeglossaries} script contains POD (Plain Old
%Documentation). If you want, you can create a man page for
%\app{makeglossaries} using \app{pod2man} and move the 
%resulting file onto the man path.
%
%
%\subsubsection{Using xindy explicitly}
%\label{sec:xindyapp}
%
%If you want to use \app{xindy} to process the glossary
%files, you must make sure you have used the 
%\pkgopt{xindy} package option:
%\begin{verbatim}
%\usepackage[xindy]{glossaries}
%\end{verbatim}
%This is required regardless of whether you use \app{xindy}
%explicitly or whether it's called implicitly via 
%\app{makeglossaries}. This causes the glossary 
%entries to be written in raw \app{xindy} format, so you need to
%use \texttt{-I xindy} \emph{not} \texttt{-I tex}.
%
%To run \app{xindy} type the following in your terminal 
%(all on one line):
%\begin{prompt}
%xindy -L \meta{language} -C \meta{encoding} -I xindy -M \meta{style} -t \meta{base}.glg -o \meta{base}.gls \meta{base}.glo
%\end{prompt}
%where \meta{language} is the required language name, \meta{encoding}
%is the encoding, \meta{base} is the name of the document without the
%\filetype{.tex} extension and \meta{style} is the name of the
%\app{xindy} style file without the \filetype{.xdy} extension.
%The default name for this style file is \meta{base}\filetype{.xdy}
%but can be changed via \ics{setStyleFile}\marg{style}. You may need
%to specify the full path name depending on the current working
%directory. If any of the file names contain spaces, you must delimit
%them using double-quotes.
%
%For example, if your document is called \texttt{myDoc.tex} and
%you are using UTF8 encoding in English, then type the
%following in your terminal:
%\begin{prompt}
%xindy -L english -C utf8 -I xindy -M myDoc -t myDoc.glg -o myDoc.gls myDoc.glo
%\end{prompt}
%
%Note that this just creates the main glossary. You need to do
%the same for each of the other glossaries (including the
%list of acronyms if you have used the \pkgopt{acronym}
%package option), substituting \filetype{.glg}, \filetype{.gls}
%and \filetype{.glo} with the relevant extensions. For example,
%if you have used the \pkgopt{acronym} package option, then 
%you would need to do:
%\begin{prompt}
%xindy -L english -C utf8 -I xindy -M myDoc -t myDoc.alg -o myDoc.acr myDoc.acn
%\end{prompt}
%For additional glossaries, the extensions are those supplied
%when you created the glossary with \ics{newglossary}.
%
%Note that if you use \app{makeglossaries} instead, you can
%replace all those calls to \app{xindy} with just one call
%to \app{makeglossaries}:
%\begin{prompt}
%makeglossaries myDoc
%\end{prompt}
%Note also that some commands and package options have no effect if 
%you use \app{xindy} explicitly instead of using 
%\app{makeglossaries}. These are listed in 
%\tableref{tab:makeglossariesCmds}.
%
%
%\subsubsection{Using makeindex explicitly}
%\label{sec:makeindexapp}
%
%If you want to use \app{makeindex} explicitly, you must
%make sure that you haven't used the \pkgopt{xindy} package
%option or the glossary entries will be written in the wrong
%format. To run \app{makeindex}, type the following in
%your terminal:
%\begin{prompt}
%makeindex -s \meta{style}.ist -t \meta{base}.glg -o \meta{base}.gls \meta{base}.glo
%\end{prompt}
%where \meta{base} is the name of your document without the
%\filetype{.tex} extension and \meta{style}\filetype{.ist} is the 
%name of the \app{makeindex} style file. By default, this is
%\meta{base}\filetype{.ist}, but may be changed via
%\ics{setStyleFile}\marg{style}. Note that there are other options, 
%such as \texttt{-l} (letter ordering). See the \app{makeindex}
%manual for further details.
%
%For example, if your document is called \texttt{myDoc.tex}, then
%type the following at the terminal:
%\begin{prompt}
%makeindex -s myDoc.ist -t myDoc.glg -o myDoc.gls myDoc.glo
%\end{prompt}
%Note that this only creates the main glossary. If you have
%additional glossaries (for example, if you have used the
%\pkgopt{acronym} package option) then you must call 
%\app{makeindex} for each glossary, substituting 
%\filetype{.glg}, \filetype{.gls} and \filetype{.glo} with the
%relevant extensions. For example, if you have used the
%\pkgopt{acronym} package option, then you need to type the
%following in your terminal:
%\begin{prompt}
%makeindex -s myDoc.ist -t myDoc.alg -o myDoc.acr myDoc.acn
%\end{prompt}
%For additional glossaries, the extensions are those supplied
%when you created the glossary with \ics{newglossary}.
%
%Note that if you use \app{makeglossaries} instead, you can
%replace all those calls to \app{makeindex} with just one call
%to \app{makeglossaries}:
%\begin{prompt}
%makeglossaries myDoc
%\end{prompt}
%Note also that some commands and package options have no effect if 
%you use \app{makeindex} explicitly instead of using 
%\app{makeglossaries}. These are listed in 
%\tableref{tab:makeglossariesCmds}.
%
%
%\subsubsection{Note to Front-End and Script Developers}
%
%The information needed to determine whether to use \app{xindy}
%or \app{makeindex} and the information needed to call those
%applications is stored in the auxiliary file. This information can
%be gathered by a front-end, editor or script to make the glossaries
%where appropriate. This section describes how the information is
%stored in the auxiliary file.
%
%The file extensions used by each defined glossary are given by
%\begin{definition}[\DescribeMacro{\@newglossary}]
%\cs{@newglossary}\marg{label}\marg{log}\marg{out-ext}\marg{in-ext}
%\end{definition}
%where \meta{in-ext} is the extension of the \emph{indexing
%application's} input file (the output file from the \styfmt{glossaries}
%package's point of view), \meta{out-ext} is the extension of the
%\emph{indexing application's} output file (the input file from
%the \styfmt{glossaries} package's point of view) and \meta{log} is the
%extension of the indexing application's transcript file. The label
%for the glossary is also given for information purposes only, but
%is not required by the indexing applications. For example, the
%information for the main glossary is written as:
%\begin{verbatim}
%\@newglossary{main}{glg}{gls}{glo}
%\end{verbatim}
%
%The indexing application's style file is specified by
%\begin{definition}[\DescribeMacro{\@istfilename}]
%\cs{@istfilename}\marg{filename}
%\end{definition}
%The file extension indicates whether to use \app{makeindex}
%(\filetype{.ist}) or \app{xindy} (\filetype{.xdy}). Note that
%the glossary information is formatted differently depending on
%which indexing application is supposed to be used, so it's 
%important to call the correct one.
%
%Word or letter ordering is specified by:
%\begin{definition}[\DescribeMacro{\@glsorder}]
%\cs{@glsorder}\marg{order}
%\end{definition}
%where \meta{order} can be either \texttt{word} or \texttt{letter}.
%
%If \app{xindy} should be used, the language and code page
%for each glossary is specified by
%\begin{definition}[\DescribeMacro{\@xdylanguage}\DescribeMacro{\@gls@codepage}]
%\cs{@xdylanguage}\marg{label}\marg{language}\\
%\cs{@gls@codepage}\marg{label}\marg{code}
%\end{definition}
%where \meta{label} identifies the glossary, \meta{language} is
%the root language (e.g.\ \texttt{english}) and \meta{code}
%is the encoding (e.g.\ \texttt{utf8}). These commands are omitted
%if \app{makeindex} should be used.
%
%
%\subsection{Troubleshooting}
%\label{sec:trouble}
%
%The \styfmt{glossaries} package comes with a minimal file called 
%\texttt{minimalgls.tex} which can be used for testing. This
%should be located in the \texttt{samples} subdirectory (folder)
%of the \styfmt{glossaries} documentation directory. The location
%varies according to your operating system and \TeX\ installation.
%For example, on my Linux partition it can be found in
%\texttt{/usr/local/texlive/2008/texmf-dist/doc/latex/glossaries/}. 
%Further information on debugging \LaTeX\ code is available at
%\url{http://theoval.cmp.uea.ac.uk/~nlct/latex/minexample/}.
%
%Below is a list of the most frequently asked questions. For
%other queries, consult the \styfmt{glossaries} FAQ at
%\url{http://theoval.cmp.uea.ac.uk/~nlct/latex/packages/faq/glossariesfaq.html}. 
%
%\begin{enumerate}
%\item \textbf{Q.} I get the error message:
%\begin{verbatim}
%Missing \begin{document}
%\end{verbatim}
%
%\textbf{A.} Check you are using an up to date version of the \sty{xkeyval}
%package.
%
%\item \textbf{Q.} I've used the \pkgopt{smallcaps} option, but the acronyms
%are displayed in normal sized upper case letters.
%
%\textbf{A.} The \pkgopt{smallcaps} package option uses \cs{textsc} to typeset
%the acronyms. This command converts lower case letters to small 
%capitals, while upper case letters remain their usual size. Therefore
%you need to specify the acronym in lower case letters.
%
%\item \textbf{Q.} My acronyms won't break across a line when they're
%expanded.
%
%\textbf{A.} PDF\LaTeX\ can break hyperlinks across a line, but
%\LaTeX\ can't. If you can't use PDF\LaTeX\ then disable the first use
%links using the package option \pkgopt[false]{hyperfirst}.
%
%\item \textbf{Q.} How do I change the font that the acronyms are displayed in?
%
%\textbf{A.} The easiest way to do this is to specify the \pkgopt{smaller} package
%option and redefine \cs{acronymfont} to use the required typesetting
%command.  For example, suppose you would like the acronyms displayed in 
%a sans-serif font, then you can do:
%\begin{verbatim}
%\usepackage[smaller]{glossaries}
%\renewcommand*{\acronymfont}[1]{\textsf{#1}}
%\end{verbatim}
%
%\item \textbf{Q.} How do I change the font that the acronyms are displayed in
%on \firstuse?
%
%\textbf{A.} The easiest way to do this is to specify the \pkgopt{smaller} package
%option and redefine \cs{firstacronymfont} to use the required 
%command. Note that if you don't want the acronym on subsequent use
%to use \cs{textsmaller}, you will also need to redefine \cs{acronymfont},
%as above. For example to make the acronym emphasized on 
%\firstuse, but use the surrounding font for subsequent use, you can do:
%\begin{verbatim}
%\usepackage[smaller]{glossaries}
%\renewcommand*{\firstacronymfont}[1]{\emph{#1}}
%\renewcommand*{\acronymfont}[1]{#1}
%\end{verbatim}
%
%\item \textbf{Q.} I don't have Perl installed, do I have to use 
%\app{makeglossaries}?
%
%\textbf{A.} Although it is strongly recommended that you use
%\app{makeglossaries}, you don't have to use it. For further details,
%read \sectionref{sec:xindyapp} or \sectionref{sec:makeindexapp},
%depending on whether you want to use \app{xindy} or \app{makeindex}.
%
%\item \textbf{Q.} I'm used to using the \styfmt{glossary} package: are there any
%instructions on migrating from the \sty{glossary} package to the
%\styfmt{glossaries} package?
%
%\textbf{A.} Read \qtdocref{Upgrading from the glossary package to
%the glossaries package}{glossary2glossaries} which should be
%available from the same location as this document.
%
%\item \textbf{Q.} I'm using \sty{babel} but the fixed names haven't
%been translated.
%
%\textbf{A.} The \styfmt{glossaries} package currently only supports
%the following languages: Brazilian Portuguese, Danish, Dutch,
%English, French, German, Irish, Italian, Hungarian, Polish, Serbian and
%Spanish. If you want to add another language, send me the
%translations, and I'll add them to the next version.
%
%If you are using one of the above languages, but the text hasn't been
%translated, try adding the \sty{translator} package with the
%required languages explicitly (before you load the \styfmt{glossaries}
%package). For example:
%\begin{verbatim}
%\usepackage[ngerman]{babel}
%\usepackage[ngerman]{translator}
%\usepackage{glossaries}
%\end{verbatim}
%Alternatively, you can add the language as a global option
%to the class file. Check the \styfmt{translator} package documentation 
%for further details.
%
%\item \textbf{Q.} My acronyms contain strange characters when I use commands
%like \ics{acrlong}.
%
%\textbf{A.} Switch off the sanitization:
%\begin{verbatim}
%\usepackage[sanitize=none]{glossaries}
%\end{verbatim}
%and protect fragile commands.
%
%\item \textbf{Q.} My glossaries haven't appeared.
%
%\textbf{A.} Remember to do the following:
%\begin{itemize}
%\item Add \ics{makeglossaries} to the document preamble.
%
%\item Use either \ics{printglossary} for each glossary that has
%been defined or \ics{printglossaries}.
%
%\item Use the commands listed in \sectionref{sec:glslink},
%\sectionref{sec:glsadd} or \sectionref{sec:crossref} for each entry
%that you want to appear in the glossary.
%
%\item Run \LaTeX\ on your document, then run \app{makeglossaries},
%then run \LaTeX\ on your document again. If you want the glossaries
%to appear in the table of contents, you will need an extra \LaTeX\
%run. If any of your entries cross-reference an entry that's not
%referenced in the main body of the document, you will need to run
%\app{makeglossaries} (see \sectionref{sec:makeglossaries}) after the
%second \LaTeX\ run, followed by another \LaTeX\ run.
%\end{itemize}
%
%Check the log files (\filetype{.log}, \filetype{.glg} etc) for any 
%warnings.
%
%\item \textbf{Q.} It is possible to change the rules used to sort
%the glossary entries?
%
%\textbf{A.} If it's for an individual entry, then you can use the
%entry's \gloskey{sort} key to sort it according to a different term.
%If it's for the entire alphabet, then you will need to use
%\app{xindy} (instead of \app{makeindex}) and use an appropriate
%\app{xindy} language module. Writing \app{xindy} modules or styles
%is beyond the scope of this manual. Further information about
%\app{xindy} can be found at the
%\urlfootref{http://xindy.sourceforge.net/}{Xindy Web Site}. There is
%also a link to the \app{xindy} mailing list from that site.
%
%\end{enumerate}
%
%
%\section{Overview of Main User Commands}\label{sec:overview}
% \changes{1.02}{2007 May 25}{added overview section}
%
%This section is an overview of the main user commands and package
%options. If you find this too complicated, try starting out with the
%\docref{guide for beginners}{glossariesbegin}.
%
%\subsection{Package Options}
%\label{sec:pkgopts}
%
%The \styfmt{glossaries} package options are as follows:
%\begin{description}
%\item[\pkgopt{nowarn}] This suppresses all warnings generated by
%the \styfmt{glossaries} package.
%
%\item[\pkgopt{nomain}] This suppresses the creation of the main
%glossary. Note that if you use this option, you must create another
%glossary in which to put all your entries (either via the
%\pkgopt{acronym} package option described below or via
%\ics{newglossary} described in \sectionref{sec:newglossary}).
%
%\item[\pkgopt{toc}] Add the glossaries to the table of contents.
%Note that an extra \LaTeX\ run is required with this option.
%Alternatively, you can switch this function on and off using
%\begin{definition}[\DescribeMacro{\glstoctrue}]
%\cs{glstoctrue}
%\end{definition}
%and
%\begin{definition}[\DescribeMacro{\glstocfalse}]
%\cs{glstocfalse}
%\end{definition}
%
%\item[\pkgopt{numberline}] When used with \pkgopt{toc}, this will
%add \cs{numberline}\verb|{}| in the final argument of 
%\cs{addcontentsline}. This will align the table of contents entry 
%with the numbered section titles. Note that this option has no
%effect if the \pkgopt{toc} option is omitted. If \pkgopt{toc} is
%used without \pkgopt{numberline}, the title will be aligned with
%the section numbers rather than the section titles.
%
%\item[\pkgopt{acronym}] This creates a new glossary with the
%label \texttt{acronym}. This is equivalent to:
%\begin{verbatim}
%\newglossary[alg]{acronym}{acr}{acn}{\acronymname}
%\end{verbatim}
%If the \pkgopt{acronym} package option is used, \ics{acronymtype}
%is set to \texttt{acronym} otherwise it is set to 
%\texttt{main}.\footnote{Actually it sets \ics{acronymtype} to
%\ics{glsdefaulttype} if the \pkgopt{acronym} package option is
%not used, but \ics{glsdefaulttype} usually has the value
%\texttt{main}.} 
%Entries that are defined using \ics{newacronym} are placed in
%the glossary whose label is given by \ics{acronymtype}, unless
%another glossary is explicitly specified.
%
%\item[\pkgopt{acronymlists}] By default, only the \texttt{acronym}
%glossary is considered to be a list of acronyms. If you have other
%lists of acronyms, you can specify them as a comma-separated list
%in the value of \pkgopt{acronymlists}. For example, if you want
%the \texttt{main} glossary to also contain a list of acronyms, you
%can do:
%\begin{verbatim}
%\usepackage[acronym,acronymlists={main}]{glossaries}
%\end{verbatim}
%No check is performed to determine if the listed glossaries exist,
%so you can add glossaries you haven't defined yet. For example:
%\begin{verbatim}
%\usepackage[acronym,acronymlists={main,acronym2}]{glossaries}
%\newglossary[alg2]{acronym2}{acr2}{acn2}{Statistical Acronyms}
%\end{verbatim}
%
%\item[\pkgopt{section}] This is a \meta{key}=\meta{value} option.  Its
%value should be the name of a sectional unit (e.g.\ chapter).
%This will make the glossaries appear in the named sectional unit,
%otherwise each glossary will appear in a chapter, if chapters
%exist, otherwise in a section. Unnumbered sectional units will be used
%by default. Example:
%\begin{verbatim}
%\usepackage[section=subsection]{glossaries}
%\end{verbatim}
%You can omit the value if you want to use sections, i.e.\
%\begin{verbatim}
%\usepackage[section]{glossaries}
%\end{verbatim}
%is equivalent to
%\begin{verbatim}
%\usepackage[section=section]{glossaries}
%\end{verbatim}
%You can change this value later in the document using
%\begin{definition}[\DescribeMacro{\setglossarysection}]
%\cs{setglossarysection}\marg{name}
%\end{definition}
%where \meta{name} is the sectional unit.
%
%The start of each glossary adds information to the page header via
%\begin{definition}[\DescribeMacro{\glossarymark}]
%\cs{glossarymark}\marg{glossary title}
%\end{definition}
%This defaults to \cs{@mkboth}, but you may need to redefine it.
%For example, to only change the right header:
%\begin{verbatim}
%\renewcommand{\glossarymark}[1]{\markright{#1}}
%\end{verbatim}
%or to prevent it from changing the headers:
%\begin{verbatim}
%\renewcommand{\glossarymark}[1]{}
%\end{verbatim}
%
%Occasionally you may find that another package defines 
%\cs{cleardoublepage} when it is not required. This may cause an 
%unwanted blank page to appear before each glossary. This can
%be fixed by redefining \ics{glsclearpage}:
%\begin{verbatim}
%\renewcommand*{\glsclearpage}{\clearpage}
%\end{verbatim}
%
%\item[\pkgopt{numberedsection}]
%The glossaries are placed in unnumbered sectional units by default,
%but this can be changed using \pkgopt{numberedsection}. This option can take
%three possible values: \pkgoptval{false}{numberedsection} (no
%number, i.e.\ use starred form), \pkgoptval{nolabel}{numberedsection}
%(numbered, i.e.\ unstarred form, but not labelled) and
%\pkgoptval{autolabel}{numberedsection} (numbered with automatic
%labelling). If \pkgopt[autolabel]{numberedsection} is used, each
%glossary is given a label that matches the glossary type, so the
%main (default) glossary is labelled \texttt{main}, the list of
%acronyms is labelled \texttt{acronym}\footnote{if the
%\pkgopt{acronym} option is used, otherwise the list of
%acronyms is the main glossary} and additional glossaries are labelled
%using the value specified in the first mandatory argument to 
%\cs{newglossary}. For example, if you load \styfmt{glossaries}
%using:
%\begin{verbatim}
%\usepackage[section,numberedsection=autolabel]{glossaries}
%\end{verbatim}
%then each glossary will appear in a numbered section, and can
%be referenced using something like:
%\begin{verbatim}
%The main glossary is in section~\ref{main} and the list of
%acronyms is in section~\ref{acronym}.
%\end{verbatim}
%If you can't decide whether to have the acronyms in the main
%glossary or a separate list of acronyms, you can use
%\ics{acronymtype} which is set to \texttt{main} if the
%\pkgopt{acronym} option is not used and is set to \texttt{acronym}
%if the \pkgopt{acronym} option is used. For example:
%\begin{verbatim}
%The list of acronyms is in section~\ref{\acronymtype}.
%\end{verbatim}
%
%As from version 1.14, you can add a prefix to the label by
%redefining 
%\begin{definition}[\DescribeMacro{\glsautoprefix}]
%\cs{glsautoprefix}
%\end{definition}
%For example:
%\begin{verbatim}
%\renewcommand*{\glsautoprefix}{glo:}
%\end{verbatim}
%will add \texttt{glo:} to the automatically generated label, so
%you can then, for example, refer to the list of acronyms as follows:
%\begin{verbatim}
%The list of acronyms is in section~\ref{glo:\acronymtype}.
%\end{verbatim}
%Or, if you are undecided on a prefix:
%\begin{verbatim}
%The list of acronyms is in section~\ref{\glsautoprefix\acronymtype}.
%\end{verbatim}
%
%
%\item[\pkgopt{style}] This is a \meta{key}=\meta{value} option. Its 
%value should be the name of the glossary style to use. Predefined 
%glossary styles are listed in \sectionref{sec:styles}.
%
%\item[\pkgopt{nolong}] This prevents the \styfmt{glossaries} package
%from automatically loading \sty{glossary-long} (which means that
%the \sty{longtable} package also won't be loaded). This reduces
%overhead by not defining unwanted styles and commands. Note that if
%you use this option, you won't be able to use any of the
%glossary styles defined in the \styfmt{glossary-long} package.
%
%\item[\pkgopt{nosuper}] This prevents the \styfmt{glossaries} package
%from automatically loading \sty{glossary-super} (which means that
%the \sty{supertabular} package also won't be loaded). This reduces
%overhead by not defining unwanted styles and commands. Note that if
%you use this option, you won't be able to use any of the
%glossary styles defined in the \styfmt{glossary-super} package.
%
%\item[\pkgopt{nolist}] This prevents the \styfmt{glossaries} package
%from automatically loading \sty{glossary-list}. This reduces
%overhead by not defining unwanted styles. Note that if
%you use this option, you won't be able to use any of the
%glossary styles defined in the \styfmt{glossary-list} package.
%Note that since the default style is \glostyle{list}, you will 
%also need to use the \pkgopt{style} option to set the style to
%something else.
%
%\item[\pkgopt{notree}] This prevents the \styfmt{glossaries} package
%from automatically loading \sty{glossary-tree}. This reduces
%overhead by not defining unwanted styles. Note that if
%you use this option, you won't be able to use any of the
%glossary styles defined in the \styfmt{glossary-tree} package.
%
%\item[\pkgopt{nostyles}] This prevents all the predefined styles
%from being loaded. This option is provided in the event that the
%user has custom styles that are not dependent on the styles
%provided by the \styfmt{glossaries} package. Note that if you use
%this option, you can't use the \pkgopt{style} package option. Instead
%you must either use \ics{glossarystyle}\marg{style} or
%the \gloskey[printglossary]{style} key in the
%optional argument to \ics{printglossary}.
%
%\item[\pkgopt{nonumberlist}] This option will suppress the 
%associated number lists\iterm{number list} in the glossaries (see also 
%\sectionref{sec:numberlists}).
%
%\item[\pkgopt{counter}] This is a \meta{key}=\meta{value} option. The
%value should be the name of the default counter to use in the number
%lists\iterm{number list}.
%
%\hypertarget{sanitize}{}\relax \item[\pkgopt{sanitize}] This is a
%\meta{key}=\meta{value} option whose value is also a
%\meta{key}=\meta{value} list. By default, the \styfmt{glossaries}
%package sanitizes the values of the \gloskey{name},
%\gloskey{description} and \gloskey{symbol} keys used when defining a
%new glossary entry. This means that you can use fragile commands in
%those keys, but it may lead to unexpected results if you try to
%display these values within the document text. This sanitization can
%be switched off using the \pkgopt{sanitize} package option. \ifpdf
%(See \sectionref{sec:pkgopt} and \sectionref{sec:newentry} for
%further details.) \fi For example, to switch off the sanitization
%for the \gloskey{description} and \gloskey{name} keys, but not for
%the \gloskey{symbol} key, do:
%\begin{verbatim}
%\usepackage[sanitize={name=false,description=false,%
%symbol=true}]{glossaries}
%\end{verbatim}
%You can use \pkgopt[none]{sanitize} as a shortcut for\newline
%\pkgoptfmt{sanitize=\{name=false,description=false,symbol=false\}}.
%
%\begin{important}%
%\textbf{Note}: this sanitization only applies to the \gloskey{name}, 
%\gloskey{description} and \gloskey{symbol} keys. It doesn't apply
%to any of the other keys (except the \gloskey{sort} key which is
%always sanitized) so fragile commands contained in the value of
%the other keys must always be protected using \cs{protect}.
%Since the value of the \gloskey{text} key is obtained from the
%\gloskey{name} key, you will still need to protect fragile commands
%in the \gloskey{name} key if you don't use the \gloskey{text} key. 
%\end{important}
%
%\item[\pkgopt{description}] This option changes the definition of
%\ics{newacronym} to allow a description. See \sectionref{sec:acronyms} 
%for further details.
%
%\item[\pkgopt{footnote}] This option changes the definition of
%\ics{newacronym} and the way that acronyms are displayed. See
%\sectionref{sec:acronyms} for further details.
%
%\item[\pkgopt{smallcaps}] This option changes the definition of
%\ics{newacronym} and the way that acronyms are displayed. See
%\sectionref{sec:acronyms} for further details.
%
%\item[\pkgopt{smaller}] This option changes the definition of
%\ics{newacronym} and the way that acronyms are displayed.
%If you use this option, you will need to include the \sty{relsize} 
%package or otherwise define \ics{textsmaller} or redefine
%\ics{acronymfont}. See \sectionref{sec:acronyms} for further details.
%
%\item[\pkgopt{dua}] This option changes the definition of
%\ics{newacronym} so that acronyms are always expanded. 
%See \sectionref{sec:acronyms} for further details.
%
%\item[\pkgopt{shortcuts}] This option provides shortcut commands
%for acronyms.  See \sectionref{sec:acronyms} for further details.
%
%\item[\pkgopt{makeindex}] (Default) The glossary information and
%indexing style file will be written in \app{makeindex} format. If
%you use \app{makeglossaries}, it will automatically detect that it
%needs to call \app{makeindex}. If you don't use
%\app{makeglossaries}, you need to remember to use \app{makeindex}
%not \app{xindy}. The indexing style file will been given a
%\filetype{.ist} extension.
%
%\item[\pkgopt{xindy}] The glossary information and indexing style
%file will be written in \app{xindy} format. If you use
%\app{makeglossaries}, it will automatically detect that it needs to
%call \app{xindy}. If you don't use \app{makeglossaries}, you need to
%remember to use \app{xindy} not \app{makeindex}. The indexing style
%file will been given a \filetype{.xdy} extension.
%
%The \pkgopt{xindy} package option may additionally have a value that
%is a \meta{key}=\meta{value} comma-separated list to override the
%language and codepage. For example:
%\begin{verbatim}
%\usepackage[xindy={language=english,codepage=utf8}]{glossaries}
%\end{verbatim}
%You can also specify whether you want a number group in the
%glossary. This defaults to true, but can be suppressed. For example:
%\begin{verbatim}
%\usepackage[xindy={glsnumbers=false}]{glossaries}
%\end{verbatim}
%See \sectionref{sec:xindy} for further details on using \app{xindy}
%with the \styfmt{glossaries} package.
%
%\item[\pkgopt{order}] This may take two values: 
%\pkgoptval{word}{order} or \pkgoptval{letter}{order}. The default
%is word ordering. Note that this option has no effect if you
%don't use \app{makeglossaries}.
%
%\item[\pkgopt{translate}] This is a boolean option. The default is
%\pkgoptval{true}{translate} if \sty{babel}, \sty{polyglossia} or 
%\sty{translator} have been loaded, otherwise the default value is
%\pkgoptval{false}{translate}.
%
%  \begin{description}
%  \item[{\pkgopt[true]{translate}}] If \sty{babel} has been loaded
%  and the \sty{translator} package is installed, \sty{translator}
%  will be loaded and the translations will be provided by the
%  \sty{translator} package interface. You can modify the 
%  translations by providing your own dictionary. If the 
%  \sty{translator} package isn't installed and \sty{babel} is
%  loaded, the \sty{glossaries-babel} package will 
%  be loaded and the translations will be provided using \styfmt{babel}'s
%  \cs{addto}\cs{caption}\meta{language} mechanism. If 
%  \sty{polyglossia} has been loaded, \sty{glossaries-polyglossia}
%  will be loaded.
%
%  \item[{\pkgopt[false]{translate}}] Don't provide translations, even
%  if \sty{babel} or \sty{polyglossia} has been loaded. You can 
%  then provide you're own translations or explicitly load 
%  \sty{glossaries-babel} or \sty{glossaries-polyglossia}.
%  \end{description}
%
%See \sectionref{sec:fixednames} for further details.
%
%\item[\pkgopt{hyperfirst}] This is a boolean option that specifies
%whether each term has a hyperlink on \firstuse. The default is 
%\pkgopt[true]{hyperfirst} (terms on first use have a hyperlink, 
%unless explicitly suppressed using starred versions of commands
%such as \cs{gls*}).
%
%\end{description}
%
%\subsection{Defining Glossary Entries}
%\label{sec:newglosentry}
%
%All glossary entries must be defined before they are used, so it is
%better to define them in the preamble to ensure this.\footnote{The
%only preamble restriction on \cs{newglossaryentry} and
%\cs{newacronym} was removed in version 1.13, but the restriction
%remains for \cs{loadglsentries}.} However only those entries that
%occur in the document (using any of the commands described in
%\sectionref{sec:glslink}, \sectionref{sec:glsadd} or
%\sectionref{sec:crossref}) will appear in the glossary. Each time an
%entry is used in this way, a line is added to an associated glossary
%file (\filetype{.glo}), which then needs to be converted into a
%corresponding \filetype{.gls} file which contains the typeset
%glossary which is input by \ics{printglossary} or
%\ics{printglossaries}. The Perl script \app{makeglossaries} can be
%used to call \app{makeindex} or \app{xindy}, using a customised
%indexing style file, for each of the glossaries that are defined in
%the document. Note that there should be no need for you to
%explicitly edit or input any of these external files. See
%\sectionref{sec:makeglossaries} for further details.
%
%The command
%\begin{definition}[\DescribeMacro{\makeglossaries}]
%\cs{makeglossaries}
%\end{definition}
%must be placed in the preamble in order to create the customised
%\app{makeindex} (\filetype{.ist}) or \app{xindy} (\filetype{.xdy})
%style file and to ensure that glossary entries are written to the
%appropriate output files. If you omit \cs{makeglossaries} none of
%the glossaries will be created.
%
%\begin{important}
%Note that some of the commands provided by the \styfmt{glossaries}
%package must be placed before \cs{makeglossaries} as they are
%required when creating the customised style file. If you attempt
%to use those commands after \cs{makeglossaries} you will generate
%an error.
%\end{important}
%
%You can suppress the creation of the customised \app{xindy}
%or \app{makeindex} style file using
%\begin{definition}[\DescribeMacro{\noist}]
%\cs{noist}
%\end{definition}
%Note that this command must be used before \cs{makeglossaries}.
%
%The default name for the customised style file is given by
%\ics{jobname}\filetype{.ist} (for \app{makeindex}) or 
%\ics{jobname}\filetype{.xdy} (for \app{xindy}). This name may be
%changed using:
%\begin{definition}[\DescribeMacro{\setStyleFile}]
%\cs{setStyleFile}\marg{name}
%\end{definition}
%where \meta{name} is the name of the style file without the 
%extension. Note that this command must be used before
%\cs{makeglossaries}.
%
%Each glossary entry is assigned a \term{number list} that lists all 
%the locations in the document where that entry was used. By default,
%the location refers to the page number but this may be overridden
%using the \pkgopt{counter} package option. The default form of
%the location number assumes a full stop compositor (e.g.\ 1.2),
%but if your location numbers use a different compositor (e.g. 1-2)
%you need to set this using
%\begin{definition}[\DescribeMacro{\glsSetCompositor}]
%\cs{glsSetCompositor}\marg{symbol}
%\end{definition}
%For example:
%\begin{verbatim}
%\glsSetCompositor{-}
%\end{verbatim}
%Note that this command must be used before \cs{makeglossaries}.
%
%If you use \app{xindy}, you can have a different compositor for page
%numbers starting with an uppercase alphabetical character using:
%\begin{definition}[\DescribeMacro{\glsSetAlphaCompositor}]
%\cs{glsSetAlphaCompositor}\marg{symbol}
%\end{definition}
%Note that this command has no effect if you haven't used the
%\pkgopt{xindy} package option. For example, if you want number
%lists\iterm{number list} containing a mixture of A-1 and 2.3 style
%formats, then do:
%\begin{verbatim}
%\glsSetCompositor{.} \glsSetAlphaCompositor{-}
%\end{verbatim}
%See \sectionref{sec:numberlists} for further information about
%number lists\iterm{number list}.
%
%New glossary entries are defined using the command:
%\begin{definition}[\DescribeMacro{\newglossaryentry}]
%\cs{newglossaryentry}\marg{label}\marg{key-val list}
%\end{definition}
%The first argument, \meta{label}, must be a unique label with which
%to identify this entry. The second argument, \meta{key-val list}, is
%a \meta{key}=\meta{value} list that supplies the relevant
%information about this entry. There are two required fields:
%\gloskey{description} and either \gloskey{name} or \gloskey{parent}.
%Available fields are listed below:
%
%\begin{description}
%\item[{\gloskey{name}}] The name of the entry (as it will appear in 
%the glossary). If this key is omitted and the \gloskey{parent}
%key is supplied, this value will be the same as the parent's name.
%
%\item[{\gloskey{description}}] A brief description of this term (to
%appear in the glossary). Within this value, you can use 
%\begin{definition}[\DescribeMacro{\nopostdesc}]
%\cs{nopostdesc}
%\end{definition}
%to suppress the
%description terminator for this entry. For example, if this
%entry is a parent entry that doesn't require a description, you
%can do \verb|description={\nopostdesc}|. If you want a paragraph
%break in the description use
%\begin{definition}[\DescribeMacro{\glspar}]
%\cs{glspar}
%\end{definition}
%However, note that not all glossary styles support multi-line
%descriptions. If you are using one of the tabular-like glossary
%styles that permit multi-line descriptions, use \ics{newline}
%not \verb"\\" if you want to force a line break.
%
%\item[{\gloskey{parent}}] The label of the parent entry. Note that
%the parent entry must be defined before its sub-entries.
%See \sectionref{sec:subentries} for further details.
%
%\item[{\gloskey{descriptionplural}}] The plural form of the 
%description (as passed to \ics{glsdisplay} and \ics{glsdisplayfirst}
%by \ics{glspl}, \ics{Glspl} and \ics{GLSpl}). If omitted, the value
%is set to the same as the \gloskey{description} key.
%
%\item[{\gloskey{text}}] How this entry will appear in the document text
%when using \ics{gls} (or one of its uppercase variants). If this
%field is omitted, the value of the \gloskey{name} key is used.
%
%\item[{\gloskey{first}}] How the entry will appear in the document text
%the first time it is used with \ics{gls}\ifirstusetext\ (or one of its uppercase
%variants). If this field is omitted, the value of the \gloskey{text}
%key is used.
%
%\item[{\gloskey{plural}}] How the entry will appear in the document text
%when using \ics{glspl} (or one of its uppercase variants).
%If this field is omitted, the value is obtained by appending 
%\ics{glspluralsuffix} to the value of the \gloskey{text} field.
%The default value of \cs{glspluralsuffix} is the letter
%\qt{s}.
%
%\item[{\gloskey{firstplural}}] How the entry will appear in the
%document text the first time it is used with \ics{glspl}\ifirstusetext\ (or one of its
%uppercase variants). If this field is omitted, the value is obtained
%from the \gloskey{plural} key, if the \gloskey{first} key is omitted,
%or by appending \ics{glspluralsuffix} to the value of the
%\gloskey{first} field, if the \gloskey{first} field is present.
%
%\textbf{Note:} prior to version 1.13, the default value of 
%\gloskey{firstplural} was always taken by appending \qt{s} to the
%\gloskey{first} key, which meant that you had to specify both
%\gloskey{plural} and \gloskey{firstplural}, even if you hadn't
%used the \gloskey{first} key.
%
%\item[{\gloskey{symbol}}] This field is provided to allow the user to
%specify an associated symbol. If omitted, the value is set to 
%\cs{relax}. Note that not all glossary styles display the
%symbol.
%
%\item[{\gloskey{symbolplural}}] This is the plural form of the
%symbol (as passed to \ics{glsdisplay} and \ics{glsdisplayfirst}
%by \ics{glspl}, \ics{Glspl} and \ics{GLSpl}). If omitted, the value
%is set to the same as the \gloskey{symbol} key.
%
%\item[{\gloskey{sort}}] This value indicates how \app{makeindex}
%or \app{xindy} should sort this entry. If omitted, the value is 
%given by the \gloskey{name} field.
%
%\item[{\gloskey{type}}] This specifies the label of the glossary in 
%which this entry belongs. If omitted, the default glossary is 
%assumed.  The list of acronyms type is given by
%\ics{acronymtype} which will either be \texttt{main} or
%\texttt{acronym}, depending on whether the \pkgopt{acronym} package
%option was used.
%
%\item[{\gloskey{user1}, \ldots, \gloskey{user6}}] Six additional
%keys provided for any additional information the user may want
%to specify.  (For example, an associated dimension or an alternative
%plural.)
%
%\item[{\gloskey{nonumberlist}}] Suppress the \term{number list} for
%this entry.
%
%\item[{\gloskey{see}}] Cross-reference another entry. Using the
%\gloskey{see} key will automatically add this entry to the
%glossary, but will not automatically add the cross-referenced entry.
%The referenced entry should be supplied as the value to this key.
%If you want to override the \qt{see} tag, you can supply the new
%tag in square brackets before the label. For example
%\verb|see=[see also]{anotherlabel}|. For further details,
%see \sectionref{sec:crossref}.
%
%\end{description}
%Note that if the name starts with an accented letter or non-Latin
%character, you must group the accented letter, otherwise it will 
%cause a problem for commands like \cs{Gls} and \cs{Glspl}. 
%For example:
%\begin{verbatim}
%\newglossaryentry{elite}{name={{\'e}lite},
%description={select group or class}}
%\end{verbatim}
%Note that the same applies if you are using the \sty{inputenc}
%package:
%\begin{verbatim}
%\newglossaryentry{elite}{name={{é}lite},
%description={select group or class}}
%\end{verbatim}
%Note that in both of the above examples, you will also need to
%supply the \gloskey{sort} key if you are using \app{makeindex}
%whereas \app{xindy} is usually able to sort accented letters
%correctly.
%
%
%
%\subsubsection{Plurals}
%You may have noticed from above that you can specify the plural form
%when you define a term. If you omit this, the plural will be 
%obtained by appending 
%\begin{definition}[\DescribeMacro{\glspluralsuffix}]
%\cs{glspluralsuffix}
%\end{definition}
%to the singular form. This command defaults to the letter \qt{s}. 
%For example:
%\begin{verbatim}
%\newglossaryentry{cow}{name=cow,description={a fully grown
%female of any bovine animal}}
%\end{verbatim}
%defines a new entry whose singular form is \qt{cow} and plural form
%is \qt{cows}. However, if you are writing in archaic English, you
%may want to use \qt{kine} as the plural form, in which case you
%would have to do:
%\begin{verbatim}
%\newglossaryentry{cow}{name=cow,plural=kine,
%description={a fully grown female of any bovine animal}}
%\end{verbatim}
%
%If you are writing in a language that supports
%multiple plurals (for a given term) then use the \gloskey{plural} key
%for one of them and one of the user keys to specify the
%other plural form. For example:
%\begin{verbatim}
%\newglossaryentry{cow}{name=cow,description={a fully grown
%female of any bovine animal (plural cows, archaic plural kine)},
%user1={kine}}
%\end{verbatim}
%You can then use \verb|\glspl{cow}| to produce \qt{cows} and 
%\verb|\glsuseri{cow}| to produce \qt{kine}. You can, of course,
%define an easy to remember synonym. For example:
%\begin{verbatim}
%\let\glsaltpl\glsuseri
%\end{verbatim}
%Then you don't have to remember which key you used to store the
%alternative plural.
%
%If you are using a language that usually forms plurals
%by appending a different letter, or sequence of letters, you can
%redefine \cs{glspluralsuffix} as required. However, this must be
%done \emph{before} the entries are defined. For languages that don't
%form plurals by simply appending a suffix, all the plural forms must be 
%specified using the \gloskey{plural} key (and the \gloskey{firstplural}
%key where necessary). 
%
%
%\subsubsection{Sub-Entries}
%\label{sec:subentries}
%
%As from version 1.17, it is possible to specify sub-entries. These
%may be used to order the glossary into categories, in which case
%the sub-entry will have a different name to its parent entry, or
%it may be used to distinguish different definitions for the same
%word, in which case the sub-entries will have the same name as
%the parent entry. Note that not all glossary styles support
%hierarchical entries and may display all the entries in a flat
%format. Of the styles that support sub-entries, some display the
%sub-entry's name whilst others don't. Therefore you need to
%ensure that you use a suitable style. See \sectionref{sec:styles} 
%for a list of predefined styles.
%
%Note that the parent entry will automatically be added to the
%glossary if any of its child entries are used in the document.
%If the parent entry is not referenced in the document, it will not
%have a \term{number list}.
%
%
%\paragraph{Hierarchical Categories} To arrange a glossary
%with hierarchical categories, you need to first define the
%category and then define the sub-entries using the relevant 
%category entry as the value of the \gloskey{parent} key. For
%example, suppose I want a glossary of mathematical symbols that
%are divided into Greek letters and Roman letters. Then I can
%define the categories as follows:
%\begin{verbatim}
%\newglossaryentry{greekletter}{name={Greek letters},
%description={\nopostdesc}}
%
%\newglossaryentry{romanletter}{name={Roman letters},
%description={\nopostdesc}}
%\end{verbatim}
%
%Note that in this example, the category entries don't need a
%description so I have set the descriptions to \ics{nopostdesc}.
%This gives a blank description and suppresses the
%description terminator.
%
%I can now define my sub-entries as follows:
%\begin{verbatim}
%\newglossaryentry{pi}{name={pi},
%description={ratio of the circumference of a circle to the diameter},
%parent=greekletter}
%
%\newglossaryentry{C}{name=C,
%description={Euler's constant},
%parent=romanletter}
%\end{verbatim}
%
%
%\paragraph{Homographs} Sub-entries that have the same name as
%the parent entry, don't need to have the \gloskey{name} key.
%For example, the word \qt{glossary} can mean a list of technical
%words or a collection of glosses. In both cases the plural is
%\qt{glossaries}. So first define the parent entry:
%\begin{verbatim}
%\newglossaryentry{glossary}{name=glossary,
%description={\nopostdesc},
%plural={glossaries}}
%\end{verbatim}
%Again, the parent entry has no description, so the description
%terminator needs to be suppressed using \ics{nopostdesc}.
%
%Now define the two different meanings of the word:
%\begin{verbatim}
%\newglossaryentry{glossarylist}{
%description={1) list of technical words},
%sort={1},
%parent={glossary}}
%
%\newglossaryentry{glossarycol}{
%description={2) collection of glosses},
%sort={2},
%parent={glossary}}
%\end{verbatim}
%Note that if I reference the parent entry, the location will be
%added to the parent's \term{number list}, whereas if I reference 
%any of the child entries, the location will be added to the child
%entry's number list.  Note also that since the sub-entries have the
%same name, the \gloskey{sort} key is required.
%
%In the above example, the plural form for both of the child entries
%is the same as the parent entry, so the \gloskey{plural} key was
%not required for the child entries. However, if the sub-entries
%have different plurals, they will need to be specified. For example:
%\begin{verbatim}
%\newglossaryentry{bravo}{name={bravo},
%description={\nopostdesc}}
%
%\newglossaryentry{bravocry}{description={1) cry of approval (pl.\ bravos)},
%sort={1},
%plural={bravos},
%parent=bravo}
%
%\newglossaryentry{bravoruffian}{description={2) hired ruffian or
%killer (pl.\ bravoes)},
%sort={2},
%plural={bravoes},
%parent=bravo}
%\end{verbatim}
%
%
%\subsubsection{Loading Entries From a File}
%\label{sec:loadglsentries}
%
%You can store all your glossary entry definitions in another
%file and use:
%\begin{definition}[\DescribeMacro{\loadglsentries}]
%\cs{loadglsentries}\oarg{type}\marg{filename}
%\end{definition}
%where \meta{filename} is the name of the file containing all the
%\cs{newglossaryentry} commands. The optional argument
%\meta{type} is the name of the glossary to which those entries
%should belong, for those entries where the \gloskey{type} key has 
%been omitted (or, more specifically, for those entries whose
%type has been specified by \cs{glsdefaulttype}, which is what
%\cs{newglossaryentry} uses by default). For example, suppose I have
%a file called \texttt{myentries.tex} which contains:
%\begin{verbatim}
%\newglossaryentry{perl}{type=main,
%name={Perl},
%description={A scripting language}}
%
%\newglossaryentry{tex}{name={\TeX},
%description={A typesetting language},sort={TeX}}
%
%\newglossaryentry{html}{type=\glsdefaulttype,
%name={html},
%description={A mark up language}}
%\end{verbatim}
%and suppose in my document preamble I use the command:
%\begin{verbatim}
%\loadglsentries[languages]{myentries}
%\end{verbatim}
%then this will add the entries \texttt{tex} and \texttt{html}
%to the glossary whose type is given by \texttt{languages}, but
%the entry \texttt{perl} will be added to the main glossary, since
%it explicitly sets the type to \texttt{main}.
%
%\textbf{Note:} if you use \cs{newacronym} (see
%\sectionref{sec:acronyms}) the type is set as
%\verb|type=\acronymtype| unless you explicitly override it. For
%example, if my file \texttt{myacronyms.tex} contains:
%\begin{verbatim}
%\newacronym{aca}{aca}{a contrived acronym}
%\end{verbatim}
%then (supposing I have defined a new glossary type called
%\texttt{altacronym})
%\begin{verbatim}
%\loadglsentries[altacronym]{myacronyms}
%\end{verbatim}
%will add \texttt{aca} to the glossary type \texttt{acronym}, if the
%package option \pkgopt{acronym} has been specified, or will add
%\texttt{aca} to the glossary type \texttt{altacronym}, if the
%package option \pkgopt{acronym} is not specified.\footnote{This is
%because \cs{acronymtype} is set to \cs{glsdefaulttype} if the
%\pkgopt{acronym} package option is not used.} In this instance, it
%is better to change \texttt{myacronyms.tex} to:
%\begin{verbatim}
%\newacronym[type=\glsdefaulttype]{aca}{aca}{a contrived acronym}
%\end{verbatim}
%and now
%\begin{verbatim}
%\loadglsentries[altacronym]{myacronyms}
%\end{verbatim}
%will add \texttt{aca} to the glossary type \texttt{altacronym},
%regardless of whether or not the package option \pkgopt{acronym} is
%used.
%
%Note that only those entries that have been used
%in the text will appear in the relevant glossaries.
%Note also that \cs{loadglsentries} may only be used in the 
%preamble.
%
%\subsection{Number lists}
%\label{sec:numberlists}
%
%Each entry in the glossary has an associated \termdef{number list}. 
%By default,
%these numbers refer to the pages on which that entry has been used
%(using any of the commands described in \sectionref{sec:glslink} 
%and \sectionref{sec:glsadd}). The number list can be suppressed using 
%the \pkgopt{nonumberlist} package option, or an alternative counter
%can be set as the default using the \pkgopt{counter} package option.
%The number list is also referred to as the location 
%list\index{location list|see{number list}}.
%
%Both \app{makeindex} and \app{xindy} concatenate a
%sequence of 3 or more consecutive pages into a range. With 
%\app{xindy} you can vary the minimum sequence length using
%\ics{GlsSetXdyMinRangeLength}\marg{n} where \meta{n} is either
%an integer or the keyword \texttt{none} which indicates that there
%should be no range formation.
%
%\begin{important}
%Note that \cs{GlsSetXdyMinRangeLength} must be used before
%\ics{makeglossaries} and has no effect if \ics{noist} is used.
%\end{important}
%
%With both \app{makeindex} and \app{xindy}, you can replace
%the separator and the closing number in the range using:
%\begin{definition}[\DescribeMacro{\glsSetSuffixF}]
%\cs{glsSetSuffixF}\marg{suffix}
%\end{definition}
%\begin{definition}[\DescribeMacro{\glsSetSuffixFF}]
%\cs{glsSetSuffixFF}\marg{suffix}
%\end{definition}
%where the former command specifies the suffix to use for a 2 page
%list and the latter specifies the suffix to use for longer lists.
%For example:
%\begin{verbatim}
%\glsSetSuffixF{f.}
%\glsSetSuffixFF{ff.}
%\end{verbatim}
%Note that if you use \app{xindy}, you will also need to
%set the minimum range length to 1 if you want to change these
%suffixes:
%\begin{verbatim}
%\GlsSetXdyMinRangeLength{1}
%\end{verbatim}
%Note that if you use the \sty{hyperref} package, you will need
%to use \ics{nohyperpage} in the suffix to ensure that the hyperlinks
%work correctly. For example:
%\begin{verbatim}
%\glsSetSuffixF{\nohyperpage{f.}}
%\glsSetSuffixFF{\nohyperpage{ff.}}
%\end{verbatim}
%
%\begin{important}
%Note that \cs{glsSetSuffixF} and \cs{glsSetSuffixFF} must be used 
%before \ics{makeglossaries} and have no effect if \ics{noist} is 
%used.
%\end{important}
%
%
%\subsection{Links to Glossary Entries}
%\label{sec:glslink}
%
%Once you have defined a glossary entry using \ics{newglossaryentry},
%you can refer to that entry in the document using one of the
%commands listed in this section. The text which appears at that
%point in the document when using one of these commands is referred
%to as the \termdef{link text} (even if there are no hyperlinks). The
%commands in this section also add a line to an external file that is
%used by \app{makeindex} or \app{xindy} to generate the relevant
%entry in the glossary. This information includes an associated
%location that is added to the \term{number list} for that entry. By
%default, the location refers to the page number. For further
%information on number lists, see \sectionref{sec:numberlists}.
%
%\begin{important}
%It is strongly recommended that you don't use the commands
%defined in this section in the arguments of sectioning or caption
%commands.
%\end{important}
%
%The above warning is particularly important if you are using the
%\styfmt{glossaries} package in conjunction with the \sty{hyperref}
%package. Instead, use one of the commands listed in
%\sectionref{sec:glsnolink} (such as \cs{glsentrytext}) or provide an
%alternative via the optional argument to the sectioning/caption
%command. Examples:
%\begin{verbatim}
%\section{An overview of \glsentrytext{perl}}
%\section[An overview of Perl]{An overview of \gls{perl}}
%\end{verbatim}
%
%The way the \term{link text} is displayed depends on 
%\begin{definition}[\DescribeMacro{\glstextformat}]
%\cs{glstextformat}\marg{text}
%\end{definition}
%For example, to make all \term{link text} appear in a sans-serif
%font, do:
%\begin{verbatim}
%\renewcommand*{\glstextformat}[1]{\textsf{#1}}
%\end{verbatim}
%
%Each entry has an associated conditional referred to as the
%\firstuseflag. This determines whether \ics{gls}, 
%\ics{glspl} (and their uppercase variants) should use the
%value of the \gloskey{first} or \gloskey{text} keys. Note that an 
%entry can be used without affecting the \firstuseflag\ (for example,
%when used with \cs{glslink}). See \sectionref{sec:glsunset} for 
%commands that unset or reset this conditional.
%
%The command:
%\begin{definition}[\DescribeMacro{\glslink}]
%\cs{glslink}\oarg{options}\marg{label}\marg{text}
%\end{definition}
%will place \cs{glstextformat}\marg{text} in the document at that
%point and add a line into the associated glossary file for the
%glossary entry given by \meta{label}. If hyperlinks are supported,
%\meta{text} will be a hyperlink to the relevant line in the
%glossary. (Note that this command doesn't affect the \firstuseflag:
%use \ics{glsdisp} instead.) The optional argument \meta{options}
%must be a \meta{key}=\meta{value} list which can take any of the
%following keys:
%
%\begin{description}
%\item[{\gloskey[glslink]{format}}] This specifies how to format the
%associated location number for this entry in the glossary. This 
%value is equivalent to the \app{makeindex} encap value, and (as
%with \cs{index}) the value needs to be the name of a command
%\emph{without} the initial backslash. As with \cs{index}, the
%characters \verb"(" and \verb")" can also be used to specify the
%beginning and ending of a number range.  Again as with \cs{index},
%the command should be the name of a command which takes an argument
%(which will be the associated location).  Be careful not to use a
%declaration (such as \texttt{bfseries}) instead of a text block command
%(such as \texttt{textbf}) as the effect is not guaranteed to be
%localised. If you want to apply more than one style to a given entry
%(e.g.\ \textbf{bold} and \emph{italic}) you will need to create a
%command that applies both formats, e.g.\ 
%\begin{verbatim}
%\newcommand*{\textbfem}[1]{\textbf{\emph{#1}}}
%\end{verbatim}
%and use that command.
%
%In this document, the standard formats refer to the standard text 
%block commands such as \ics{textbf} or \ics{emph} or any of the 
%commands listed in \tableref{tab:hyperxx}.
%
%\begin{important}
%If you use \app{xindy} instead of \app{makeindex}, you
%must specify any non-standard formats that you want to use
%with the \gloskey[glslink]{format} key using
%\ics{GlsAddXdyAttribute}\marg{name}. So if you use
%\app{xindy} with the above example, you would need to add:
%\begin{verbatim}
%\GlsAddXdyAttribute{textbfem}
%\end{verbatim}
%\end{important}
%
%Note that unlike \cs{index}, you can't have anything following the
%command name, such as an asterisk or arguments. If you want to
%cross-reference another entry, either use the \gloskey{see} key when
%you define the entry or use \ics{glssee} (described in
%\sectionref{sec:crossref}).
%
%
%If you are using hyperlinks and you want to change the font of the
%hyperlinked location, don't use \ics{hyperpage} (provided by the
%\sty{hyperref} package) as the locations may not refer to a page
%number.  Instead, the \styfmt{glossaries} package provides number
%formats listed in \tableref{tab:hyperxx}.
%
%\begin{table}[htbp]
%\caption{Predefined Hyperlinked Location Formats}
%\label{tab:hyperxx}
%\centering
%\vskip\baselineskip
%\begin{tabular}{ll}
%\locfmt{hyperrm} & serif hyperlink\\
%\locfmt{hypersf} & sans-serif hyperlink\\
%\locfmt{hypertt} & monospaced hyperlink\\
%\locfmt{hyperbf} & bold hyperlink\\
%\locfmt{hypermd} & medium weight hyperlink\\
%\locfmt{hyperit} & italic hyperlink\\
%\locfmt{hypersl} & slanted hyperlink\\
%\locfmt{hyperup} & upright hyperlink\\
%\locfmt{hypersc} & small caps hyperlink\\
%\locfmt{hyperemph} & emphasized hyperlink
%\end{tabular}
%\par
%\end{table}
%
%Note that if the \ics{hyperlink} command hasn't been defined,
%the \texttt{hyper}\meta{xx} formats are equivalent to the
%analogous \texttt{text}\meta{xx} font commands (and \texttt{hyperemph}
%is equivalent to \texttt{emph}). If you want to
%make a new format, you will need to define a command which takes
%one argument and use that. For example, if you want the location
%number to be in a bold sans-serif font, you can define a
%command called, say, \cs{hyperbsf}:
%\begin{verbatim}
%\newcommand{\hyperbsf}[1]{\textbf{\hypersf{#1}}}
%\end{verbatim}
%and then use \texttt{hyperbsf} as the value for the \gloskey{format}
%key. \ifpdf (See also \sectionref{sec:code:printglos}.) \fi 
%Remember that if you use \app{xindy}, you will need to add
%this to the list of location attributes:
%\begin{verbatim}
%\GlsAddXdyAttribute{hyperbsf}
%\end{verbatim}
%
%\item[{\gloskey[glslink]{counter}}] This specifies which counter
%to use for this location. This overrides the default counter
%used by this entry. (See also \sectionref{sec:numberlists}.)
%
%\item[{\gloskey[glslink]{hyper}}] This is a boolean key which can
%be used to enable/disable the hyperlink to the relevant entry
%in the glossary. (Note that setting \texttt{hyper=true} will have no
%effect if \cs{hyperlink} has not been defined.) The default
%value is \texttt{hyper=true}.
%
%\end{description}
%There is also a starred version:
%\begin{definition}[\DescribeMacro{\glslink*}]
%\cs{glslink*}\oarg{options}\marg{label}\marg{text}
%\end{definition}
%which is equivalent to \cs{glslink}, except it sets
%\texttt{hyper=false}. Similarly, all the following commands 
%described in this section also have a starred version that disables
%the hyperlink.
%
%The command:
%\begin{definition}[\DescribeMacro{\gls}]
%\cs{gls}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%is the same as \cs{glslink}, except that the \term{link text}
%is determined from the values of the \gloskey{text} and 
%\gloskey{first} keys supplied when the entry was defined using
%\ics{newglossaryentry}. If the entry has been marked as having
%been used\ifirstuseflag, the value of the \gloskey{text} key will be used, otherwise
%the value of the \gloskey{first} key will be used. 
%On completion, \cs{gls} will mark the entry's first use flag\ifirstuseflag\ as
%used.
%
%There are two uppercase variants:
%\begin{definition}[\DescribeMacro{\Gls}]
%\cs{Gls}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%and
%\begin{definition}[\DescribeMacro{\GLS}]
%\cs{GLS}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%which make the first letter of the link text or all the link text
%uppercase, respectively.
%
%The final optional argument \meta{insert}, allows you to insert
%some additional text into the link text. By default, this will
%append \meta{insert} at the end of the link text, but this
%can be changed (see \sectionref{sec:glsdisplay}). 
%
%
%The first optional argument \meta{options} is the same as the optional
%argument to \ics{glslink}. As with \cs{glslink}, these commands also
%have a starred version that disable the hyperlink.
%
%There are also analogous plural forms:
%\begin{definition}[\DescribeMacro{\glspl}]
%\cs{glspl}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glspl}]
%\cs{Glspl}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\GLSpl}]
%\cs{GLSpl}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%These determine the link text from the \gloskey{plural} and
%\gloskey{firstplural} keys supplied when the entry was first
%defined. As before, these commands also have
%a starred version that disable the hyperlink.
%
%Note that \cs{glslink} doesn't use or affect the \firstuseflag,
%nor does it use \ics{glsdisplay} or \ics{glsdisplayfirst} (see 
%\sectionref{sec:glsdisplay}). Instead, you can use:
%\begin{definition}[\DescribeMacro{\glsdisp}]
%\cs{glsdisp}\oarg{options}\marg{label}\marg{link text}
%\end{definition}
%This behaves in the same way as \cs{gls}, except that it uses
%\meta{link text} instead of the value of the \gloskey{first}
%or \gloskey{text} key. (Note that this command always sets
%\meta{insert} to nothing.) This command affects the \firstuseflag,
%and uses \ics{glsdisplay} or \ics{glsdisplayfirst}.
%
%The command:
%\begin{definition}[\DescribeMacro{\glstext}]
%\cs{glstext}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%is similar to \ics{gls} except that it always uses the value
%of the \gloskey{text} key and does not affect the 
%\firstuseflag. 
%Unlike \cs{gls}, the inserted text \meta{insert} 
%is always appended to the link text since \cs{glstext} doesn't
%use \ics{glsdisplay} or \ics{glsdisplayfirst}. (The same is 
%true for all the following commands described in this section.)
%
%There are also analogous commands:
%\begin{definition}[\DescribeMacro{\Glstext}]
%\cs{Glstext}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\GLStext}]
%\cs{GLStext}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%As before, these commands also have a starred version that disable
%the hyperlink.
%
%The command:
%\begin{definition}[\DescribeMacro{\glsfirst}]
%\cs{glsfirst}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%is similar to \ics{glstext} except that it always uses the value
%of the \gloskey{first} key. Again, \meta{insert} is always appended
%to the end of the link text and does not affect the 
%\firstuseflag.
%
%There are also analogous commands:
%\begin{definition}[\DescribeMacro{\Glsfirst}]
%\cs{Glsfirst}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\GLSfirst}]
%\cs{GLSfirst}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%As before, these commands also have a starred version that disable
%the hyperlink.
%
%The command:
%\begin{definition}[\DescribeMacro{\glsplural}]
%\cs{glsplural}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%is similar to \ics{glstext} except that it always uses the value
%of the \gloskey{plural} key. Again, \meta{insert} is always appended
%to the end of the link text and does not mark the entry as having
%been used.
%
%There are also analogous commands:
%\begin{definition}[\DescribeMacro{\Glsplural}]
%\cs{Glsplural}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\GLSplural}]
%\cs{GLSplural}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%As before, these commands also have a starred version that disable
%the hyperlink.
%
%The command:
%\begin{definition}[\DescribeMacro{\glsfirstplural}]
%\cs{glsfirstplural}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%is similar to \ics{glstext} except that it always uses the value
%of the \gloskey{firstplural} key. Again, \meta{insert} is always 
%appended to the end of the link text and does not mark the entry as
%having been used.
%
%There are also analogous commands:
%\begin{definition}[\DescribeMacro{\Glsfirstplural}]
%\cs{Glsfirstplural}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\GLSfirstplural}]
%\cs{GLSfirstplural}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%As before, these commands also have a starred version that disable
%the hyperlink.
%
%The command:
%\begin{definition}[\DescribeMacro{\glsname}]
%\cs{glsname}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%is similar to \ics{glstext} except that it always uses the value of
%the \gloskey{name} key. Again, \meta{insert} is always appended to
%the end of the link text and does not mark the entry as having been
%used. Note: if you want to use this command and the \gloskey{name}
%key contains commands, you will have to disable the
%\hyperlink{sanitize}{sanitization} of the \gloskey{name} key and
%protect fragile commands.
%
%There are also analogous commands:
%\begin{definition}[\DescribeMacro{\Glsname}]
%\cs{Glsname}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\GLSname}]
%\cs{GLSname}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%As before, these commands also have a starred version that disable
%the hyperlink.
%
%The command:
%\begin{definition}[\DescribeMacro{\glssymbol}]
%\cs{glssymbol}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%is similar to \ics{glstext} except that it always uses the value of
%the \gloskey{symbol} key. Again, \meta{insert} is always appended to
%the end of the link text and does not mark the entry as having been
%used. Note: if you want to use this command and the \gloskey{symbol}
%key contains commands, you will have to disable the
%\hyperlink{sanitize}{sanitization} of the \gloskey{symbol} key and
%protect fragile commands.
%
%There are also analogous commands:
%\begin{definition}[\DescribeMacro{\Glssymbol}]
%\cs{Glssymbol}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\GLSsymbol}]
%\cs{GLSsymbol}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%As before, these commands also have a starred version that disable
%the hyperlink.
%
%The command:
%\begin{definition}[\DescribeMacro{\glsdesc}]
%\cs{glsdesc}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%is similar to \ics{glstext} except that it always uses the value of
%the \gloskey{description} key. Again, \meta{insert} is always
%appended to the end of the link text and does not mark the entry as
%having been used. Note: if you want to use this command and the
%\gloskey{description} key contains commands, you will have to
%disable the \hyperlink{sanitize}{sanitization} of the
%\gloskey{description} key and protect fragile commands.
%
%There are also analogous commands:
%\begin{definition}[\DescribeMacro{\Glsdesc}]
%\cs{Glsdesc}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\GLSdesc}]
%\cs{GLSdesc}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%As before, these commands also have a starred version that disable
%the hyperlink.
%
%The command:
%\begin{definition}[\DescribeMacro{\glsuseri}]
%\cs{glsuseri}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%is similar to \ics{glstext} except that it always uses the value
%of the \gloskey{user1} key. Again, \meta{insert} is always
%appended to the end of the link text and does not mark the entry as 
%having been used.
%
%There are also analogous commands:
%\begin{definition}[\DescribeMacro{\Glsuseri}]
%\cs{Glsuseri}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\GLSuseri}]
%\cs{GLSuseri}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%As before, these commands also have a starred version that disable
%the hyperlink. Similarly for the other user keys:
%\begin{definition}[\DescribeMacro{\glsuserii}]
%\cs{glsuserii}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glsuserii}]
%\cs{Glsuserii}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\GLSuserii}]
%\cs{GLSuserii}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\glsuseriii}]
%\cs{glsuseriii}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glsuseriii}]
%\cs{Glsuseriii}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\GLSuseriii}]
%\cs{GLSuseriii}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\glsuseriv}]
%\cs{glsuseriv}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glsuseriv}]
%\cs{Glsuseriv}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\GLSuseriv}]
%\cs{GLSuseriv}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\glsuserv}]
%\cs{glsuserv}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glsuserv}]
%\cs{Glsuserv}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\GLSuserv}]
%\cs{GLSuserv}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\glsuservi}]
%\cs{glsuservi}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glsuservi}]
%\cs{Glsuservi}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\GLSuservi}]
%\cs{GLSuservi}\oarg{options}\marg{text}\oarg{insert}
%\end{definition}
%
%
%
%\subsubsection{Changing the format of the link text}
%\label{sec:glsdisplay}
%
%The format of the \term{link text} for \ics{gls}, \ics{glspl}
%and their uppercase variants is governed by two commands:
%\begin{definition}[\DescribeMacro{\glsdisplayfirst}]
%\cs{glsdisplayfirst}\marg{first/first plural}\marg{description}\marg{symbol}\marg{insert}
%\end{definition}
%which is used the
%first time a glossary entry is used\ifirstuse\ in the text and
%\begin{definition}[\DescribeMacro{\glsdisplay}]
%\cs{glsdisplay}\marg{text/plural}\marg{description}\marg{symbol}\marg{insert}
%\end{definition}
%which is used subsequently.
%Both commands take four arguments: the first is either the singular or
%plural form given by the \gloskey{text}, \gloskey{plural},
%\gloskey{first} or \gloskey{firstplural} keys (set when the term was
%defined) depending on context; the second argument is the term's
%description (as supplied by the \gloskey{description} or
%\gloskey{descriptionplural} keys); the third
%argument is the symbol associated with the term (as supplied by the
%\gloskey{symbol} or \gloskey{symbolplural} keys) and the fourth argument is the additional text
%supplied in the final optional argument to \cs{gls} or
%\cs{glspl} (or their uppercase variants). The default definitions
%of \cs{glsdisplay} and \cs{glsdisplayfirst} simply
%print the first argument immediately followed by the fourth argument.
%The remaining arguments are ignored.
%
%If required, you can access the label for the given entry via
%\begin{definition}[\DescribeMacro{\glslabel}]
%\cs{glslabel}
%\end{definition}
%so it is possible to use this label in the definition of
%\cs{glsdisplay} or \cs{glsdisplayfirst} to supply additional
%information using any of the commands described in
%\sectionref{sec:glsnolink}, if required.
%
%Note that \cs{glsdisplay} and \cs{glsdisplayfirst} are not used
%by \ics{glslink}. If you want to supply your own link text, you
%need to use \ics{glsdisp} instead.
%
%For example, suppose you want a glossary of measurements and
%units, you can use the \gloskey{symbol} key to store the unit:
%\begin{verbatim}
%\newglossaryentry{distance}{name=distance,
%description={The length between two points},
%symbol={km}}
%\end{verbatim}
%and now suppose you want \verb|\gls{distance}| to produce
%\qt{distance (km)} on \firstuse, then you can redefine
%\cs{glsdisplayfirst} as follows:
%\begin{verbatim}
%\renewcommand{\glsdisplayfirst}[4]{#1#4 (#3)}
%\end{verbatim}
%Note that the additional text is placed after \verb|#1|, so
%\verb|\gls{distance}['s]| will produce \qt{distance's (km)}
%rather than \qt{distance (km)'s} which looks a bit odd (even though
%it may be in the context of \qt{the distance (km) is measured between
%the two points} --- but in this instance it would be better not to
%use a contraction).
%
%Note also that all of the \term{link text} will be formatted according
%to \ics{glstextformat} (described earlier). So if you do, say:
%\begin{verbatim}
%\renewcommand{\glstextformat}[1]{\textbf{#1}}
%\renewcommand{\glsdisplayfirst}[4]{#1#4 (#3)}
%\end{verbatim}
%then \verb|\gls{distance}| will produce \qt{\textbf{distance (km)}}.
%
%If you have multiple glossaries, changing \cs{glsdisplayfirst} and
%\cs{glsdisplay} will change the way entries for all of the
%glossaries appear when using the commands \ics{gls}, \ics{glspl}, their
%uppercase variants and \ics{glsdisp}.  If you only
%want the change to affect entries for a given glossary, then you need
%to use
%\begin{definition}[\DescribeMacro{\defglsdisplay}]
%\cs{defglsdisplay}\oarg{type}\marg{definition}
%\end{definition}
%and
%\begin{definition}[\DescribeMacro{\defglsdisplayfirst}]
%\cs{defglsdisplayfirst}\oarg{type}\marg{definition}
%\end{definition}
%instead of redefining \cs{glsdisplay} and \cs{glsdisplayfirst}.
%
%Both \cs{defglsdisplay} and \cs{defglsdisplayfirst} take two arguments:
%the first (which is optional) is the glossary's label\footnote{\texttt{main} for the main
%(default) glossary, \cs{acronymtype} for the list of acronyms, or the
%name supplied in the first mandatory argument to \cs{newglossary} for
%additional glossaries.} and the second is how the term should be
%displayed when it is invoked using commands \cs{gls}, 
%\cs{glspl}, their uppercase variants and \cs{glsdisp}. This is similar to the way \cs{glsdisplayfirst} was
%redefined above.
%
%For example, suppose you have created a new glossary called
%\texttt{notation} and you want to change the way the entry is
%displayed on \firstuse\ so that it includes the symbol, you can do:
%\begin{verbatim}
%\defglsdisplayfirst[notation]{#1#4 (denoted #3)}
%\end{verbatim}
%Now suppose you have defined an entry as follows:
%\begin{verbatim}
%\newglossaryentry{set}{type=notation,
%  name=set,
%  description={A collection of objects},
%  symbol={$S$}
%}
%\end{verbatim}
%The first time you reference this entry it will be displayed as:
%\qt{set (denoted $S$)} (assuming \ics{gls} was used).
%
%Remember that if you use the \gloskey{symbol} key, you need to use a
%glossary style that displays the symbol, as many of the styles
%ignore it. In addition, if you want either the description or symbol
%to appear in the \term{link text}, you will have to disable the
%\hyperlink{sanitize}{sanitization} of these keys and protect fragile
%commands.
%
%\subsubsection{Enabling and disabling hyperlinks to glossary entries}
%
%If you load the \sty{hyperref} or \sty{html} packages prior to
%loading the \styfmt{glossaries} package, commands such as \ics{glslink}
%and \ics{gls}, described above, will automatically have hyperlinks
%to the relevant glossary entry, unless the \gloskey[glslink]{hyper}
%option has been set to \texttt{false}. You can disable or enable links using:
%\begin{definition}[\DescribeMacro{\glsdisablehyper}]
%\cs{glsdisablehyper}
%\end{definition}
%and
%\begin{definition}[\DescribeMacro{\glsenablehyper}]
%\cs{glsenablehyper}
%\end{definition}
%respectively. The effect can be localised by placing the commands
%within a group. Note that you should only use \cs{glsenablehyper}
%if the commands \ics{hyperlink} and \ics{hypertarget} have been
%defined (for example, by the \sty{hyperref} package).
%
%You can disable just the first use links using the package
%option \pkgopt[false]{hyperfirst}. Note that this option only
%affects commands that recognise the \firstuse\ flag, for example
%\ics{gls}, \ics{glspl} and \ics{glsdisp} but not \ics{glslink}.
%
%
%\subsection{Adding an Entry to the Glossary Without Generating Text}
%\label{sec:glsadd}
%
%It is possible to add a line in the glossary file without
%generating any text at that point in the document using:
%\begin{definition}[\DescribeMacro{\glsadd}]
%\cs{glsadd}\oarg{options}\marg{label}
%\end{definition}
%This is similar to \ics{glslink}, only it doesn't produce
%any text (so therefore, there is no \gloskey[glslink]{hyper} key
%available in \meta{options} but all the other options that can
%be used with \cs{glslink} can be passed to \cs{glsadd}).
%For example, to add a page range to the glossary number list for the
%entry whose label is given by \texttt{set}:
%\begin{verbatim}
%\glsadd[format=(]{set}
%Lots of text about sets spanning many pages.
%\glsadd[format=)]{set}
%\end{verbatim}
%
%To add all entries that have been defined, use:
%\begin{definition}[\DescribeMacro{\glsaddall}]
%\cs{glsaddall}\oarg{options}
%\end{definition}
%The optional argument is the same as for \cs{glsadd}, except
%there is also a key \gloskey[glsaddall]{types} which can be
%used to specify which glossaries to use. This should be a
%comma separated list. For example, if you only want to add
%all the entries belonging to the list of acronyms (specified by
%the glossary type \cs{acronymtype}) and a list of
%notation (specified by the glossary type \texttt{notation}) then you can
%do:
%\begin{verbatim}
%\glsaddall[types={\acronymtype,notation}]
%\end{verbatim}
%
%
%\subsection{Cross-Referencing Entries}
%\label{sec:crossref}
%
%There are several ways of cross-referencing entries in the 
%glossary: 
%
%\begin{enumerate}
%\item You can use commands such as \ics{gls} in the
%entries description. For example:
%\begin{verbatim}
%\newglossaryentry{apple}{name=apple,
%description={firm, round fruit. See also \gls{pear}}}
%\end{verbatim}
%Note that with this method, if you don't use the 
%cross-referenced term in the glossary, you will need two runs of
%\app{makeglossaries}:
%\begin{prompt}
%latex filename
%makeglossaries filename
%latex filename
%makeglossaries filename
%latex filename
%\end{prompt}
%
%\item As described in \sectionref{sec:newglosentry}, you can use the
%\gloskey{see} key when you define the entry. For example:
%\begin{verbatim}
%\newglossaryentry{MaclaurinSeries}{name={Maclaurin series},
%description={Series expansion}, see={TaylorsTheorem}}
%\end{verbatim}
%Note that in this case, the entry with the \gloskey{see} key will
%automatically be added to the glossary, but the cross-referenced
%entry won't. You therefore need to ensure that you use the
%cross-referenced term with the commands described in
%\sectionref{sec:glslink} or \sectionref{sec:glsadd}.
%
%You can optionally override the \qt{see} tag using square brackets
%at the start of the \gloskey{see} value. For example:
%\begin{verbatim}
%\newglossaryentry{MaclaurinSeries}{name={Maclaurin series},
%description={Series expansion},
%see=[see also]{TaylorsTheorem}}
%\end{verbatim}
%
%\item After you have defined the entry, use
%\begin{definition}[\DescribeMacro{\glssee}]
%\cs{glssee}\oarg{tag}\marg{label}\marg{xr label list}
%\end{definition}
%where \meta{xr label list} is a comma-separated list of entry 
%labels to be cross-referenced, \meta{label} is the label of the
%entry doing the cross-referencing and \meta{tag} is the \qt{see} tag.
%For example:
%\begin{verbatim}
%\glssee[see also]{series}{FourierSeries,TaylorsTheorem}
%\end{verbatim}
%Note that this automatically adds the entry given by \meta{label} to
%the glossary but doesn't add the cross-referenced entries (specified
%by \meta{xr label list}) to the glossary.
%\end{enumerate}
%
%In both cases~2 and 3 above, the cross-referenced information appears
%in the \term{number list}, whereas in case~1, the cross-referenced 
%information appears in the description. In cases~2 and~3, the
%default text for the \qt{see} tag is given by \ics{seename}.
%
%
%\subsection{Using Glossary Terms Without Links}
%\label{sec:glsnolink}
%
%The commands described in this section display entry details without
%adding any information to the glossary. They don't use
%\cs{glstextformat}, they don't have any optional arguments, they
%don't affect the \firstuseflag\ and, apart from \ics{glshyperlink},
%they don't produce hyperlinks.
%\begin{definition}[\DescribeMacro{\glsentryname}]
%\cs{glsentryname}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glsentryname}]
%\cs{Glsentryname}\marg{label}
%\end{definition}
%These commands display the name of the glossary entry given by
%\meta{label}, as specified by the \gloskey{name} key.
%\cs{Glsentryname} makes the first letter uppercase.
%\begin{definition}[\DescribeMacro{\glsentrytext}]
%\cs{glsentrytext}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glsentrytext}]
%\cs{Glsentrytext}\marg{label}
%\end{definition}
%These commands display the subsequent use text for the glossary
%entry given by \meta{label}, as specified by the \gloskey{text} key.
%\cs{Glsentrytext} makes the first letter uppercase.
%\begin{definition}[\DescribeMacro{\glsentryplural}]
%\cs{glsentryplural}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glsentryplural}]
%\cs{Glsentryplural}\marg{label}
%\end{definition}
%These commands display the subsequent use plural text for the
%glossary entry given by \meta{label}, as specified by the
%\gloskey{plural} key. \cs{Glsentryplural} makes the first letter
%uppercase.
%\begin{definition}[\DescribeMacro{\glsentryfirst}]
%\cs{glsentryfirst}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glsentryfirst}]
%\cs{Glsentryfirst}\marg{label}
%\end{definition}
%These commands display the \firstusetext\ for the glossary entry
%given by \meta{label}, as specified by the \gloskey{first} key.
%\cs{Glsentryfirst} makes the first letter uppercase.
%\begin{definition}[\DescribeMacro{\glsentryfirstplural}]
%\cs{glsentryfirstplural}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glsentryfirstplural}]
%\cs{Glsentryfirstplural}\marg{label}
%\end{definition}
%These commands display the plural form of the \firstusetext\ for the
%glossary entry given by \meta{label}, as specified by the
%\gloskey{firstplural} key. \cs{Glsentryfirstplural} makes the first
%letter uppercase.
%\begin{definition}[\DescribeMacro{\glsentrydesc}]
%\cs{glsentrydesc}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glsentrydesc}]
%\cs{Glsentrydesc}\marg{label}
%\end{definition}
%These commands display the description for the glossary entry given
%by \meta{label}. \cs{Glsentrydesc} makes the first letter uppercase.
%\begin{definition}[\DescribeMacro{\glsentrydescplural}]
%\cs{glsentrydescplural}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glsentrydescplural}]
%\cs{Glsentrydescplural}\marg{label}
%\end{definition}
%These commands display the plural description for the glossary entry
%given by \meta{label}. \cs{Glsentrydescplural} makes the first
%letter uppercase.
%\begin{definition}[\DescribeMacro{\glsentrysymbol}]
%\cs{glsentrysymbol}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glsentrysymbol}]
%\cs{Glsentrysymbol}\marg{label}
%\end{definition}
%These commands display the symbol for the glossary entry given by
%\meta{label}. \cs{Glsentrysymbol} makes the first letter uppercase.
%\begin{definition}[\DescribeMacro{\glsentrysymbolplural}]
%\cs{glsentrysymbolplural}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glsentrysymbolplural}]
%\cs{Glsentrysymbolplural}\marg{label}
%\end{definition}
%These commands display the plural symbol for the glossary entry
%given by \meta{label}. \cs{Glsentrysymbolplural} makes the first
%letter uppercase.
%\begin{definition}[\DescribeMacro{\glsentryuseri}]
%\cs{glsentryuseri}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glsentryuseri}]
%\cs{Glsentryuseri}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\glsentryuserii}]
%\cs{glsentryuserii}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glsentryuserii}]
%\cs{Glsentryuserii}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\glsentryuseriii}]
%\cs{glsentryuseriii}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glsentryuseriii}]
%\cs{Glsentryuseriii}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\glsentryuseriv}]
%\cs{glsentryuseriv}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glsentryuseriv}]
%\cs{Glsentryuseriv}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\glsentryuserv}]
%\cs{glsentryuserv}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glsentryuserv}]
%\cs{Glsentryuserv}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\glsentryuservi}]
%\cs{glsentryuservi}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Glsentryuservi}]
%\cs{Glsentryuservi}\marg{label}
%\end{definition}
%These commands display the value of the user keys for the glossary
%entry given by \meta{label}.
%\begin{definition}[\DescribeMacro{\glshyperlink}]
%\cs{glshyperlink}\oarg{link text}\marg{label}
%\end{definition}
%This command provides a hyperlink to the glossary entry given by
%\meta{label} \textbf{but does not add any information to the
%glossary file}. The link text is given by
%\ics{glsentryname}\marg{label} by default, but can be overridden
%using the optional argument.
%\begin{important}
%If you use \cs{glshyperlink}, you need to ensure that the relevant
%entry has been added to the glossary using any of the commands
%described in \sectionref{sec:glslink} or \sectionref{sec:glsadd}
%otherwise you will end up with a broken link.
%\end{important}
%
%For further information see \ifpdf
%\sectionref{sec:code:glsnolink}\else the section \qt{Displaying
%entry details without adding information to the glossary} in the
%document \url{glossaries.pdf}\fi.
%
%
%\subsection{Displaying a glossary}
%\label{sec:printglossary}
%
%The command
%\begin{definition}[\DescribeMacro{\printglossaries}]
%\cs{printglossaries}
%\end{definition}
%will display all the glossaries in the order in which they were
%defined. Note that no glossaries will appear until you have either
%used the Perl script \app{makeglossaries} or have directly used
%\app{makeindex} or \app{xindy} (as described in
%\sectionref{sec:makeglossaries}). If the glossary 
%still does not appear after you re-\LaTeX\ your document, check the
%\app{makeindex}/\app{xindy} log files to see if there is a problem.
%Remember that you also need to use the command \ics{makeglossaries}
%in the preamble to enable the glossaries.
%
%An individual glossary can be displayed using:
%\begin{definition}[\DescribeMacro{\printglossary}]
%\cs{printglossary}\oarg{options}
%\end{definition}
%where \meta{options} is a \meta{key}=\meta{value} list of options. 
%The following keys are available:
%\begin{description}
%\item[{\gloskey[printglossary]{type}}] The value of this key
%specifies which glossary to print. If omitted, the default
%glossary is assumed. For example, to print the list of acronyms:
%\begin{verbatim}
%\printglossary[type=\acronymtype]
%\end{verbatim}
%
%\item[{\gloskey[printglossary]{title}}] This is the glossary's
%title (overriding the title specified when the glossary was 
%defined).
%
%\item[{\gloskey[printglossary]{toctitle}}] This is the title
%to use for the table of contents (if the \pkgopt{toc} package
%option has been used). It may also be used for the page header,
%depending on the page style. If omitted, the glossary title is used.
%
%\item[{\gloskey[printglossary]{style}}] This specifies which
%glossary style to use for this glossary, overriding the effect
%of the \pkgopt{style} package option or \ics{glossarystyle}.
%
%\item[{\gloskey[printglossary]{numberedsection}}] This specifies
%whether to use a numbered section for this glossary, overriding
%the effect of the \pkgopt{numberedsection} package option. This
%key has the same syntax as the \pkgopt{numberedsection} package
%option, described in \sectionref{sec:pkgopts}.
%
%\item[{\gloskey[printglossary]{nonumberlist}}] Unlike the package option
%of the same name, this key is a boolean key. If true (\verb|nonumberlist=true|) the numberlist
%is suppressed for this glossary. If false (\verb|nonumberlist=false|) the numberlist is
%displayed for this glossary. If no value is supplied, true is 
%assumed.
%
%\end{description}
%
%By default, the glossary is started either by \cs{chapter*} or by
%\cs{section*}, depending on whether or not \cs{chapter} is defined.
%This can be overridden by the \pkgopt{section} package option or the
%\cs{setglossarysection} command. Numbered sectional units can be
%obtained using the \pkgopt{numberedsection} package option. Each
%glossary sets the page header via the command \ics{glossarymark}. If
%this mechanism is unsuitable for your chosen class file or page
%style package, you will need to redefine \ics{glossarymark}. Further
%information about these options and commands is given in
%\sectionref{sec:pkgopts}.
%
%Information can be added to the start of the glossary (after the
%title and before the main body of the glossary) by redefining
%\begin{definition}[\DescribeMacro{\glossarypreamble}]
%\cs{glossarypreamble}
%\end{definition}
%For example:
%\begin{verbatim}
%\renewcommand{\glossarypreamble}{Numbers in italic indicate
%primary definitions.}
%\end{verbatim}
%This needs to be done before the glossary is displayed using
%\cs{printglossaries} or \cs{printglossary}. Note that if you
%want a different preamble for each glossary, you will need to
%use a separate \cs{printglossary} for each glossary and change
%the definition of \cs{glossarypreamble} between each glossary.
%For example:
%\begin{verbatim}
%\renewcommand{\glossarypreamble}{Numbers in italic indicate
%primary definitions.}
%\printglossary
%\renewcommand{\glossarypreamble}{}
%\printglossary[type=acronym]
%\end{verbatim}
%Alternatively, you can do something like:
%\begin{verbatim}
%\renewcommand{\glossarypreamble}{Numbers in italic indicate
%primary definitions.\gdef\glossarypreamble{}}
%\printglossaries
%\end{verbatim}
%which will print the preamble text for the first glossary and 
%change the preamble to do nothing for subsequent glossaries.
%(Note that \cs{gdef} is required as the glossary is placed within
%a group.)
%
%There is an analogous command called
%\begin{definition}[\DescribeMacro{\glossarypostamble}]
%\cs{glossarypostamble}
%\end{definition}
%which is placed at the end of each glossary.
%
%\subsubsection{Changing the way the entry name appears in the glossary}
%\label{sec:glsnamefont}
%
%Within each glossary, each entry name is formatted according to
%\begin{definition}[\DescribeMacro{\glsnamefont}]
%\cs{glsnamefont}\marg{name}
%\end{definition}
%which takes one argument: the entry name. This command is always
%used regardless of the glossary style. By default, \cs{glsnamefont}
%simply displays its argument in whatever the surrounding font
%happens to be. This means that in the list-like glossary styles
%(defined in the \sty{glossary-list} style file) the name will appear
%in bold, since the name is placed in the optional argument of
%\cs{item}, whereas in the tabular styles (defined in the
%\sty{glossary-long} and \sty{glossary-super} style files) the name
%will appear in the normal font. The hierarchical glossary styles
%(defined in the \sty{glossary-tree} style file) also set the name in
%bold.
%
%For example, suppose you want all the entry names to appear in 
%medium weight small caps, then you can do:
%\begin{verbatim}
%\renewcommand{\glsnamefont}[1]{\textsc{\mdseries #1}}
%\end{verbatim}
%
%
%\subsubsection{Xindy}
%\label{sec:xindy}
%
%If you want to use \app{xindy} to sort the glossary, you
%must use the package option \pkgopt{xindy}:
%\begin{verbatim}
%\usepackage[xindy]{glossaries}
%\end{verbatim}
%This ensures that the glossary information is written in 
%\app{xindy} syntax.
%
%\sectionref{sec:makeglossaries} covers how to use the external
%indexing application. This section covers the commands provided
%by the \styfmt{glossaries} package that allow you to adjust the
%\app{xindy} style file (\filetype{.xdy}) and parameters.
%
%To assist writing information to the \app{xindy} style
%file, the \styfmt{glossaries} package provides the following
%commands:
%\begin{definition}[\DescribeMacro{\glsopenbrace}]
%\cs{glsopenbrace}
%\end{definition}
%\begin{definition}[\DescribeMacro{\glsclosebrace}]
%\cs{glsclosebrace}
%\end{definition}
%which produce an open and closing brace. (This is needed because
%\verb|\{| and \verb|\}| don't expand to a simple brace character
%when written to a file.)
%
%In addition, if you are using a package that makes the double
%quote character active (e.g. \sty{ngerman}) you can use:
%\begin{definition}[\DescribeMacro{\glsquote}]
%\cs{glsquote}\marg{text}
%\end{definition}
%which will produce \verb|"|\meta{text}\verb|"|. Alternatively,
%you can use \verb|\string"| to write the double-quote character. 
%This document assumes that the double quote character has not been
%made active, so the examples just use \verb|"| for clarity.
%
%If you want greater control over the \app{xindy} style file than is
%available through the \LaTeX\ commands provided by the
%\styfmt{glossaries} package, you will need to edit the \app{xindy}
%style file. In which case, you must use \ics{noist} to prevent the
%style file from being overwritten by the \styfmt{glossaries}
%package. For additional information about \app{xindy}, read the
%\app{xindy} documentation.
%
%\paragraph{Language and Encodings}
%When you use \app{xindy}, you need to specify the language
%and encoding used (unless you have written your own custom
%\app{xindy} style file that defines the relevant alphabet
%and sort rules). If you use \app{makeglossaries},
%this information is obtained from the document's auxiliary 
%(\filetype{.aux}) file.  The \styfmt{glossaries} package attempts to 
%find the root language, but in the event that it gets it wrong or if 
%\app{xindy} doesn't support that language, then you can
%specify the language using:
%\begin{definition}[\DescribeMacro{\GlsSetXdyLanguage}]
%\cs{GlsSetXdyLanguage}\oarg{glossary type}\marg{language}
%\end{definition}
%where \meta{language} is the name of the language. The
%optional argument can be used if you have multiple glossaries
%in different languages. If \meta{glossary type} is omitted, it
%will be applied to all glossaries, otherwise the language
%setting will only be applied to the glossary given by
%\meta{glossary type}.
%
%If the \sty{inputenc} package is used, the encoding will be
%obtained from the value of \ics{inputencodingname}. 
%Alternatively, you can specify the encoding using:
%\begin{definition}[\DescribeMacro{\GlsSetXdyCodePage}]
%\cs{GlsSetXdyCodePage}\marg{code}
%\end{definition}
%where \meta{code} is the name of the encoding. For example:
%\begin{verbatim}
%\GlsSetXdyCodePage{utf8}
%\end{verbatim}
%
%Note that you can also specify the language and encoding using
%the package option 
%\verb|xindy={language=|\meta{lang}\verb|,codepage=|\meta{code}\verb|}|.
%For example:
%\begin{verbatim}
%\usepackage[xindy={language=english,codepage=utf8}]{glossaries}
%\end{verbatim}
%
%If you write your own custom \app{xindy} style file that 
%includes the language settings, you need to set the language
%to nothing:
%\begin{verbatim}
%\GlsSetXdyLanguage{}
%\end{verbatim}
%(and remember to use \ics{noist} to prevent the style file from
%being overwritten).
%
%\begin{important}
%The commands \cs{GlsSetXdyLanguage} and \cs{GlsSetXdyCodePage}
%have no effect if you don't use \app{makeglossaries}. If
%you call \app{xindy} without \app{makeglossaries} you
%need to remember to set the language and encoding using the
%\texttt{-L} and \texttt{-C} switches.
%\end{important}
%
%
%\paragraph{Locations and Number lists}
%
%The most likely attributes used in the \gloskey[glslink]{format} 
%key (\locfmt{textrm}, \locfmt{hyperrm} etc) are automatically added 
%to the \app{xindy} style file, but if you want to use another 
%attribute, you need to add it using:
%\begin{definition}[\DescribeMacro{\GlsAddXdyAttribute}]
%\cs{GlsAddXdyAttribute}\marg{name}
%\end{definition}
%where \meta{name} is the name of the attribute, as used in
%the \gloskey[glslink]{format} key. For example, suppose I want a
%bold, italic, hyperlinked location. I first need to define a
%command that will do this:
%\begin{verbatim}
%\newcommand*{\hyperbfit}[1]{\textit{\hyperbf{#1}}}
%\end{verbatim}
%but with \app{xindy}, I also need to add this as an allowed
%attribute:
%\begin{verbatim}
%\GlsAddXdyAttribute{hyperbfit}
%\end{verbatim}
%
%\begin{important}
%Note that \cs{GlsAddXdyAttribute} has no effect if \ics{noist} is
%used or if \ics{makeglossaries} is omitted.
%
%\cs{GlsAddXdyAttribute} must be used before \ics{makeglossaries}.
%\end{important}
%
%If the location numbers don't get expanded to a simple Arabic or 
%Roman number or a letter from a, \ldots, z or A, \ldots, Z, then
%you need to add a location style in the appropriate format.
%
%For example, suppose you want the page numbers written as words
%rather than digits and you use the \sty{fmtcount} package to
%do this. You can redefine \ics{thepage} as follows:
%\begin{verbatim}
%\renewcommand*{\thepage}{\Numberstring{page}}
%\end{verbatim}
%This gets expanded to \verb|\protect \Numberstringnum |\marg{n}
%where \meta{n} is the Arabic page number. This means that you need to
%define a new location that has that form:
%\begin{verbatim}
%\GlsAddXdyLocation{Numberstring}{:sep "\string\protect\space
%  \string\Numberstringnum\space\glsopenbrace"
%  "arabic-numbers" :sep "\glsclosebrace"}
%\end{verbatim}
%Note that it's necessary to use \cs{space} to indicate that 
%spaces also appear in the format, since, unlike \TeX,
%\app{xindy} doesn't ignore spaces after control sequences.
%
%\begin{important}
%Note that \cs{GlsAddXdyLocation} has no effect if \ics{noist} is
%used or if \ics{makeglossaries} is omitted.
%
%\cs{GlsAddXdyLocation} must be used before \ics{makeglossaries}.
%\end{important}
%
%In the \term{number list}, the locations are sorted according to
%type. The default ordering is: \texttt{roman-page-numbers} (e.g.\
%i), \texttt{arabic-page-numbers} (e.g.\ 1),
%\texttt{arabic-section-numbers} (e.g.\ 1.1 if the compositor is a
%full stop or 1-1 if the compositor is a hyphen\footnote{see
%\ics{setCompositor} described in \sectionref{sec:newglosentry}}),
%\texttt{alpha-page-numbers} (e.g.\ a), \texttt{Roman-page-numbers}
%(e.g.\ I), \texttt{Alpha-page-numbers} (e.g.\ A),
%\texttt{Appendix-page-numbers} (e.g.\ A.1 if the Alpha compositor is
%a full stop or A-1 if the Alpha compositor is a hyphen\footnote{see
%\ics{setAlphaCompositor} described in
%\sectionref{sec:newglosentry}}), user defined location names (as
%specified by \ics{GlsAddXdyLocation} in the order in which they were
%defined), \texttt{see} (cross-referenced entries). This ordering can
%be changed using:
%\begin{definition}[\DescribeMacro{\GlsSetXdyLocationClassOrder}]
%\cs{GlsSetXdyLocationClassOrder}\marg{location names}
%\end{definition}
%where each location name is delimited by double quote marks and
%separated by white space. For example:
%\begin{verbatim}
%\GlsSetXdyLocationClassOrder{
%  "arabic-page-numbers"
%  "arabic-section-numbers"
%  "roman-page-numbers"
%  "Roman-page-numbers"
%  "alpha-page-numbers"
%  "Alpha-page-numbers"
%  "Appendix-page-numbers"
%  "see"
%}
%\end{verbatim}
%
%\begin{important}
%Note that \cs{GlsSetXdyLocationClassOrder} has no effect if 
%\ics{noist} is used or if \ics{makeglossaries} is omitted.
%
%\cs{GlsSetXdyLocationClassOrder} must be used before 
%\ics{makeglossaries}.
%\end{important}
%
%If a \term{number list} consists of a sequence of consecutive 
%numbers, the range will be concatenated. The 
%number of consecutive locations that causes a range formation 
%defaults to 2, but can be changed using:
%\begin{definition}[\DescribeMacro{\GlsSetXdyMinRangeLength}]
%\cs{GlsSetXdyMinRangeLength}\marg{n}
%\end{definition}
%For example:
%\begin{verbatim}
%\GlsSetXdyMinRangeLength{3}
%\end{verbatim}
%The argument may also be the keyword \texttt{none}, to indicate that
%there should be no range formations. See the \app{xindy}
%manual for further details on range formations.
%
%\begin{important}
%Note that \cs{GlsSetXdyMinRangeLength} has no effect if \ics{noist}
%is used or if \ics{makeglossaries} is omitted.
%
%\cs{GlsSetXdyMinRangeLength} must be used before 
%\ics{makeglossaries}.
%\end{important}
%
%See \sectionref{sec:numberlists} for further details.
%
%
%\paragraph{Glossary Groups}
%The glossary is divided into groups according to the first
%letter of the sort key. The \styfmt{glossaries} package also adds
%a number group by default, unless you suppress it in the
%\pkgopt{xindy} package option. For example:
%\begin{verbatim}
%\usepackage[xindy={glsnumbers=false}]{glossaries}
%\end{verbatim}
%Any entry that doesn't go in one of the letter groups or the
%number group is placed in the default group.
%
%If you have a number group, the default behaviour is to locate
%it before the \qt{A} letter group. If you are not using a
%Roman alphabet, you can change this using\\[10pt]
%\cs{GlsSetXdyFirstLetterAfterDigits}\marg{letter}
%
%\begin{important}
%Note that \cs{GlsSetXdyFirstLetterAfterDigits} has no effect if 
%\ics{noist} is used or if \ics{makeglossaries} is omitted.
%
%\cs{GlsSetXdyFirstLetterAfterDigits} must be used before 
%\ics{makeglossaries}.
%\end{important}
%
%
%\subsection{Defining New Glossaries}
%\label{sec:newglossary}
%
%A new glossary can be defined using:
%\begin{definition}[\DescribeMacro{\newglossary}]
%\cs{newglossary}\oarg{log-ext}\marg{name}\marg{in-ext}\marg{out-ext}\marg{title}\oarg{counter}
%\end{definition}
%where \meta{name} is the label to assign to this glossary. The
%arguments \meta{in-ext} and \meta{out-ext} specify the extensions to
%give to the input and output files for that glossary, \meta{title}
%is the default title for this new glossary and the final optional
%argument \meta{counter} specifies which counter to use for the
%associated number lists\iterm{number list} (see also
%\sectionref{sec:numberlists}). The first optional argument specifies
%the extension for the \app{makeindex} or \app{xindy} transcript file
%(this information is only used by \app{makeglossaries} which picks
%up the information from the auxiliary file).
%
%Note that the main (default) glossary is automatically created as:
%\begin{verbatim}
%\newglossary{main}{gls}{glo}{\glossaryname}
%\end{verbatim}
%so it can be identified by the label \texttt{main} (unless the
%\pkgopt{nomain} package option is used). Using the
%\pkgopt{acronym} package option is equivalent to:
%\begin{verbatim}
%\newglossary[alg]{acronym}{acr}{acn}{\acronymname}
%\end{verbatim}
%so it can be identified by the label \texttt{acronym}. If you are
%not sure whether the \pkgopt{acronym} option has been used, you
%can identify the list of acronyms by the command 
%\DescribeMacro{\acronymtype}\cs{acronymtype} which is set to
%\texttt{acronym}, if the \pkgopt{acronym} option has been used,
%otherwise it is set to \texttt{main}. Note that if you are using
%the main glossary as your list of acronyms, you need to declare
%it as a list of acronyms using the package option 
%\pkgopt{acronymlists}.
%
%\begin{important}
%All glossaries must be defined before \ics{makeglossaries} to 
%ensure that the relevant output files are opened.
%\end{important}
%
%
%\subsection{Acronyms}
%\label{sec:acronyms}
%
%You may have noticed in \sectionref{sec:newglosentry} that when you
%specify a new entry, you can specify alternate text to use when the
%term is first used\ifirstuse\ in the document. This provides a
%useful means to define acronyms. For convenience, the
%\styfmt{glossaries} package defines the command:
%\begin{definition}[\DescribeMacro{\newacronym}]
%\cs{newacronym}\oarg{key-val
%list}\marg{label}\marg{abbrv}\marg{long}
%\end{definition}
%By default, this is equivalent to:
%\begin{display}\ttfamily
%\cs{newglossaryentry}\textrm{\marg{label}}\{type=\ics{acronymtype},
%name=\textrm{\marg{abbrv}},
%description=\textrm{\marg{long}},
%text=\textrm{\marg{abbrv}},
%first=\{\textrm{\meta{long}} (\textrm{\meta{abbrv}})\},
%plural=\{\textrm{\meta{abbrv}}\cs{glspluralsuffix}\},
%firstplural=\{\textrm{\meta{long}}\cs{glspluralsuffix}\cs{space} (\textrm{\meta{abbrv}}\cs{glspluralsuffix})\},
%\textrm{\meta{key-val list}}\}
%\end{display}
%As mentioned in the previous section, the command
%\ics{acronymtype} is the name of the glossary in which the acronyms
%should appear. If the \pkgopt{acronym} package option has been used,
%this will be \texttt{acronym}, otherwise it will be \texttt{main}.
%The acronyms can then be used in exactly the same way as any other
%glossary entry. If you want more than one list of acronyms, you must
%identify the others using the package options \pkgopt{acronymlists}.
%This ensures that options such as \pkgopt{footnote} and
%\pkgopt{smallcaps} work for the additional lists of acronyms.
%
%\begin{important}%
%\textbf{Note:} since \cs{newacronym} sets \verb|type=\acronymtype|,
%if you want to load a file containing acronym definitions using
%\cs{loadglsentries}\oarg{type}\marg{filename}, the optional argument
%\meta{type} will not have an effect unless you explicitly set the
%type as \verb|type=\glsdefaulttype| in the optional argument to
%\ics{newacronym}. See \sectionref{sec:loadglsentries}.
%\end{important}
%
%For example, the following defines the acronym IDN:
%\begin{verbatim}
%\newacronym{idn}{IDN}{identification number}
%\end{verbatim}
%This is equivalent to:
%\begin{verbatim}
%\newglossaryentry{idn}{type=\acronymtype,
%name={IDN},
%description={identification number},
%text={IDN},
%first={identification number (IDN)},
%plural={IDNs},
%firstplural={identification numbers (IDNs)}}
%\end{verbatim}
%so \verb|\gls{idn}| will produce \qt{identification number (IDN)} on
%\firstuse\ and \qt{IDN} on subsequent uses.
%
%This section describes acronyms that have been defined using
%\ics{newacronym}. If you prefer to define your acronyms using
%\ics{newglossaryentry} explicitly, then you should skip this section
%and ignore the package options: \pkgopt{smallcaps},
%\pkgopt{smaller}, \pkgopt{description}, \pkgopt{dua} and
%\pkgopt{footnote}, as these options change the definition of
%\ics{newacronym} for common acronym formats as well as the way that
%the link text is displayed (see \sectionref{sec:glsdisplay}).
%Likewise you should ignore the package option \pkgopt{shortcuts} and
%the new commands described in this section, such as \ics{acrshort},
%as they vary according to the definition of \ics{newacronym}.
%
%If you want to define your own custom acronym style, see
%\sectionref{sec:customacronym}.
%
%\begin{important}
%If you try using \ics{newglossaryentry} for entries in a designated
%list of acronyms in combination with any of the above named package 
%options you are likely to get unexpected results such as empty
%brackets or empty footnotes.
%\end{important}
%
%If you use any of the package options \pkgopt{smallcaps}, 
%\pkgopt{smaller}, \pkgopt{description} or 
%\pkgopt{footnote}, the acronyms will be displayed in the document
%using:
%\begin{definition}[\DescribeMacro{\acronymfont}]
%\cs{acronymfont}\marg{text}
%\end{definition}
%and
%\begin{definition}[\DescribeMacro{\firstacronymfont}]
%\cs{firstacronymfont}\marg{text}
%\end{definition}
%where \cs{firstacronymfont} is applied on \firstuse\ and
%\cs{acronymfont} is applied on subsequent use. Note that if you
%don't use any of the above package options, changing the definition
%of \cs{acronymfont} or \cs{firstacronymfont} will have no effect. In
%this case, the recommended route is to use either the
%\pkgopt{smaller} or the \pkgopt{smallcaps} package option and
%redefine \cs{acronymfont} and \cs{firstacronymfont} as required.
%(The \pkgopt{smallcaps} option sets the default plural suffix in an
%upright font to cancel the effect of \cs{textsc}, whereas
%\pkgopt{smaller} sets the suffix in the surrounding font.)
%For example, if you want acronyms in a normal font on first use and
%emphasized on subsequent use, do:
%\begin{verbatim}
%\usepackage[smaller]{glossaries}
%\renewcommand*{\firstacronymfont}[1]{#1}
%\renewcommand*{\acronymfont}[1]{\emph{#1}}
%\end{verbatim}
%(Note that it is for this reason that the \sty{relsize} package
%is not automatically loaded when selecting the
%\pkgopt{smaller} package option.)
%
%\Tableref{tab:acronymsettings} lists the package options that govern
%the acronym styles and how the \ics{newglossaryentry} keys are used
%to store \meta{long} (the long form) and \meta{abbrv} (the short
%form). Note that the \pkgopt{smallcaps} option redefines
%\cs{acronymfont} so that it sets its argument using \cs{textsc} (so
%you should use lower case characters in \meta{abbrv}) and the
%\pkgopt{smaller} option redefines \cs{acronymfont} to use
%\cs{textsmaller},\footnote{you will need to load a package, such as
%\styfmt{relsize}, that defines \cs{textsmaller} if you use this
%option.}\ otherwise \cs{acronymfont} simply displays its argument in
%the surrounding font.
%
%\begin{table}[htbp]
%\caption{Package options governing \cs{newacronym} and how the 
%information is stored in the keys for \cs{newglossaryentry}}
%\label{tab:acronymsettings}
%\begin{center}
%\begin{tabular}{lllll}
%\bfseries Package Option &
%\gloskey{first} key &
%\gloskey{text} key &
%\gloskey{description} key &
%\gloskey{symbol} key\\
%\pkgopt{description},\pkgopt{footnote} &
%\meta{abbrv} &
%\meta{abbrv} &
%user supplied &
%\meta{long}\\
%\pkgopt{description},\pkgopt{dua} &
%\meta{long} &
%\meta{long} &
%user supplied &
%\meta{abbrv}\\
%\pkgopt{description} &
%\meta{long} &
%\meta{abbrv} &
%user supplied &
%\meta{abbrv}\\
%\pkgopt{footnote} &
%\meta{abbrv} &
%\meta{abbrv} &
%\meta{long} &
% \\
%\pkgopt{smallcaps} &
%\meta{long} &
%\meta{abbrv} &
%\meta{long} &
%\meta{abbrv}\\
%\pkgopt{smaller} &
%\meta{long} &
%\meta{abbrv} &
%\meta{long} &
%\meta{abbrv}\\
%\pkgopt{dua} &
%\meta{long} &
%\meta{long} &
%\meta{long} &
%\meta{abbrv}\\
%None of the above&
%\meta{long} (\meta{abbrv}) &
%\meta{abbrv} &
%\meta{long} &
%\end{tabular}
%\end{center}
%\end{table}
%
%In case you can't remember which key stores the long or short forms
%(or their plurals) the \styfmt{glossaries} package provides the 
%commands:
%\begin{itemize}
%\item\DescribeMacro{\glsshortkey}\cs{glsshortkey}
%The key used to store the short form.
%\item\DescribeMacro{\glsshortpluralkey}\cs{glsshortpluralkey}
%The key used to store the plural version of the short form.
%\item\DescribeMacro{\glslongkey}\cs{glslongkey}
%The key used to store the long form.
%\item\DescribeMacro{\glslongpluralkey}\cs{glslongpluralkey}
%The key used to store the plural version of the long form.
%\end{itemize}
%These can be used in the optional argument of \cs{newacronym}
%to override the defaults. For example:
%\begin{verbatim}
%\newacronym[\glslongpluralkey={diagonal matrices}]{dm}{DM}{diagonal 
%matrix}
%\end{verbatim}
%If the \firstuse\ uses the plural form, \verb|\glspl{dm}| will
%display: diagonal matrices (DMs).
%
%Each of the package options \pkgopt{smallcaps}, \pkgopt{smaller},
%\pkgopt{footnote}, \pkgopt{dua} and \pkgopt{description} use
%\ics{defglsdisplay} and \ics{defglsdisplayfirst} (described in
%\sectionref{sec:glsdisplay}) to change the way the link text is
%displayed. This means that these package options only work for the
%glossary type given by \cs{acronymtype}. If you have multiple lists
%of acronyms, you will need to make the appropriate changes for each
%additional glossary type.
%
%\begin{description}
%\item[\pkgopt{description},\pkgopt{footnote}]\ifpdf\mbox{}\par\fi
%When these two package options are used together, the \firstuse\ displays
%the entry as:
%\begin{display}
%\cs{firstacronymfont}\marg{abbrv}\meta{insert}\cs{footnote}\marg{long} 
%\end{display}
%while subsequent use displays the entry as:
%\begin{display}
%\cs{acronymfont}\marg{abbrv}\meta{insert}
%\end{display}
%where \meta{insert} indicates the text supplied in the final
%optional argument to \cs{gls}, \cs{glspl} or their uppercase 
%variants.
%
%In this case, the long form is stored in the \gloskey{symbol} key.
%This means that the long form will not be displayed in the list of
%acronyms unless you use a glossary style that displays the entry's
%symbol (for example, the \glostyle{index} style). Entries will 
%be sorted according to the short form.
%
%Note also that when these two package options are used (in the
%given order), the \styfmt{glossaries} package additionally implements the
%\pkgopt{sanitize} option using 
%\ipkgopt[description]{sanitize}\ipkgopt[symbol]{sanitize}\verb|sanitize={description=false,symbol=false}|, so 
%remember to protect fragile commands when defining acronyms.
%
%\item[\pkgopt{dua}]\ifpdf\mbox{}\par\fi
%The \pkgopt{dua} package option always displays the expanded
%form and so may not be used with \pkgopt{footnote}, \pkgopt{smaller} or 
%\pkgopt{smallcaps}. Both \firstuse\ and subsequent use displays the
%entry in the form:
%\begin{display}
%\meta{long}\meta{insert}
%\end{display}
%
%If the \pkgopt{description} package option is also used, the 
%\gloskey{name} key is set to the long form, otherwise the
%\gloskey{name} key is set to the short form and the
%\gloskey{description} key is set to the long form. In both
%cases the \gloskey{symbol} is set to the short form. Therefore,
%if you use the \pkgopt{description} package option and you want
%the short form to appear in the list of acronyms, you will need
%to use a glossary style that displays the entry's symbol (for 
%example, the \glostyle{index} style). Entries will be sorted
%according to the long form if the \pkgopt{description} option
%is used, otherwise they will be sorted according to the
%short form (unless overridden by the \gloskey{sort} key in 
%the optional argument of \ics{newacronym}).
%
%\item[\pkgopt{description}]\ifpdf\mbox{}\par\fi
%This package option displays the entry on \firstuse\ as:
%\begin{display}
%\meta{long}\meta{insert} (\cs{firstacronymfont}\marg{abbrv})
%\end{display}
%while subsequent use displays the entry as:
%\begin{display}
%\cs{acronymfont}\marg{abbrv}\meta{insert}
%\end{display}
%Note also that if this package option is used, the \styfmt{glossaries}
%package additionally implements the option 
%\ipkgopt[symbol]{sanitize}\verb|sanitize={symbol=false}|, so
%remember to protect fragile commands when defining acronyms.
%
%Note that with this option, you need to specify the description
%using the \gloskey{description} key in the optional argument
%of \ics{newacronym}. When this option is used without 
%the \pkgopt{footnote} or \pkgopt{dua} options, the name field
%is specified as
%\begin{definition}[\DescribeMacro{\acrnameformat}]
%\cs{acrnameformat}\marg{short}\marg{long}
%\end{definition}
%This defaults to \ics{acronymfont}\marg{short}, which means that the
%long form will not appear in the list of acronyms by default.
%To change this, you need to redefine \ics{acrnameformat} as
%appropriate. For example, to display the long form followed
%by the short form in parentheses do:
%\begin{verbatim}
%\renewcommand*{\acrnameformat}[2]{#2 (\acronymfont{#1})}
%\end{verbatim}
%Note that even if you redefine \ics{acrnameformat}, the
%entries will be sorted according to the short form, unless you
%override this using the \gloskey{sort} key in the optional
%argument to \ics{newacronym}.
%
%\item[\pkgopt{footnote}]\ifpdf\mbox{}\par\fi
%This package option displays the entry on \firstuse\ as:
%\begin{display}
%\cs{firstacronymfont}\marg{abbrv}\meta{insert}\cs{footnote}\marg{long}
%\end{display}
%while subsequent use displays the entry as:
%\begin{display}
%\cs{acronymfont}\marg{abbrv}\meta{insert}
%\end{display}
%Acronyms will be sorted according to the short form.
%
%Note also that if this package option is used, the \styfmt{glossaries}
%package additionally implements the option 
%\ipkgopt[description]{sanitize}\verb|sanitize={description=false}|, so
%remember to protect fragile commands when defining acronyms.
%
%Note that on \firstuse, it is the long form in the footnote that
%links to the relevant glossary entry (where hyperlinks are enabled),
%whereas on subsequent use, the acronym links to the relevant
%glossary entry. It is possible to change this to make the acronym on
%\firstuse\ have the hyperlink instead of the footnote, but since the
%footnote marker will also be a hyperlink, you will have two
%hyperlinks in immediate succession. This can be ambiguous where the
%hyperlinks are coloured rather than boxed. The code required to
%change the \firstuse\ to make the acronym a hyperlink is as follows:
%\begin{verbatim}
% \defglsdisplayfirst[\acronymtype]{%
% \noexpand\protect\noexpand
%    \glslink[\@gls@link@opts]{\@gls@link@label}{\firstacronymfont{#1}#4}%
%    \noexpand\protect\noexpand\footnote{#2}}%
%\end{verbatim}
%\textbf{Note} that this involves using internal commands (i.e.\
%commands whose name contains an \verb|@| character), so if this code
%is place in a \texttt{.tex} file it needs to be placed within a
%\cs{makeatletter} \ldots\ \cs{makeatother} pair. (See
%\urlref{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=atsigns}{\cs{@}
%and \texttt{@} in macro names} for further details.)
%
%\item[\pkgopt{smallcaps}]\ifpdf\mbox{}\par\fi
%If neither the \pkgopt{footnote} nor \pkgopt{description} options
%have been set, this option displays the entry on \firstuse\ as:
%\begin{display}
%\meta{long}\meta{insert} (\cs{firstacronymfont}\marg{abbrv})
%\end{display}
%while subsequent use displays the entry as:
%\begin{display}
%\cs{acronymfont}\marg{abbrv}\meta{insert}
%\end{display}
%where \cs{acronymfont} is set to \verb|\textsc{#1}|.
%
%\begin{important}
%Note that since the acronym is displayed using \ics{textsc}, 
%the short form, \meta{abbrv}, should be specified in lower case.
%\ifpdf(Recall that "\textsc{abc}" produces \textsc{abc} whereas 
%"\textsc{ABC}" produces \textsc{ABC}.)\fi
%\end{important}
%
%Note also that if this package option is used, the \styfmt{glossaries}
%package additionally implements the option 
%\ipkgopt[symbol]{sanitize}\verb|sanitize={symbol=false}|, so
%remember to protect fragile commands when defining acronyms.
%
%\item[\pkgopt{smaller}]\ifpdf\mbox{}\par\fi
%If neither the \pkgopt{footnote} nor \pkgopt{description} options
%have been set, this option displays the entry on \firstuse\ as:
%\begin{display}
%\meta{long}\meta{insert} (\cs{firstacronymfont}\marg{abbrv})
%\end{display}
%while subsequent use displays the entry as:
%\begin{display}
%\cs{acronymfont}\marg{abbrv}\meta{insert}
%\end{display}
%where \cs{acronymfont} is set to 
%\verb|\textsmaller{#1}|.\footnote{not that this was change from 
%using \ics{smaller} to \ics{textsmaller} as declarations
%cause a problem for \ics{makefirstuc}.}
%The entries will be sorted according to the short form.
%
%\begin{important}
%Remember to load a package that defines \ics{textsmaller} (such as
%\sty{relsize}) if you want to use this option, unless you want
%to redefine \ics{acronymfont} to use some other formatting command.
%\end{important}
%
%Note also that if this package option is used, the \styfmt{glossaries}
%package additionally implements the option 
%\ipkgopt[symbol]{sanitize}\verb|sanitize={symbol=false}|, so
%remember to protect fragile commands when defining acronyms.
%
%\item[None of the above]\ifpdf \mbox{}\par\fi
%If none of the package options \pkgopt{smallcaps}, \pkgopt{smaller},
%\pkgopt{footnote}, \pkgopt{dua} or \pkgopt{description} are used, 
%then on \firstuse\ the entry is displayed as:
%\begin{display}
%\meta{long} (\meta{abbrv})\meta{insert}
%\end{display}
%while subsequent use displays the entry as:
%\begin{display}
%\meta{abbrv}\meta{insert}
%\end{display}
%Entries will be sorted according to the short form.
%Note that if none of the acronym-related package options are used,
%the \pkgopt{sanitize} option will not be affected.
%\end{description}
%
%Recall from \sectionref{sec:glslink} that you can access the values
%of individual keys using commands like \ics{glstext}, so it is
%possible to use these commands to print just the long form or just
%the abbreviation without affecting the flag that determines whether
%the entry has been used. However the keys that store the long and
%short form vary depending on the acronym style, so the
%\styfmt{glossaries} package provides commands that are set according
%to the package options. These are as follows:
%\begin{definition}[\DescribeMacro{\acrshort}]
%\cs{acrshort}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Acrshort}]
%\cs{ACRshort}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\ACRshort}]
%\cs{ACRshort}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%Print the abbreviated version with (if required) a hyperlink to the
%relevant entry in the glossary. This is usually equivalent to
%\ics{glstext} (or its uppercase variants) but may additionally put
%the link text within the argument to \ics{acronymfont}.
%\begin{definition}[\DescribeMacro{\acrlong}]
%\cs{acrlong}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Acrlong}]
%\cs{ACRlong}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\ACRlong}]
%\cs{ACRlong}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%Print the long version with (if required) a hyperlink to the
%relevant entry in the glossary. This is may be equivalent to
%\ics{glsdesc}, \ics{glssymbol} or \ics{glsfirst} (or their uppercase
%variants), depending on package options.
%\begin{definition}[\DescribeMacro{\acrfull}]
%\cs{acrfull}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\Acrfull}]
%\cs{ACRfull}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%\begin{definition}[\DescribeMacro{\ACRfull}]
%\cs{ACRfull}\oarg{options}\marg{label}\oarg{insert}
%\end{definition}
%Print the long version followed by the abbreviation in brackets with
%(if required) a hyperlink to the relevant entry in the glossary.
%
%\begin{important}
%Note that if any of the above commands produce unexpected output
%and you haven't used any of the acronym-related package options,
%you will need to switch off the sanitization\ipkgopt{sanitize}. 
%For example:
%\begin{verbatim}
%\usepackage[sanitize=none]{glossaries}
%\end{verbatim}
%However, if you do this, you must remember to protect fragile
%commands when defining acronyms or glossary entries.
%\end{important}
%
%Note that if you change the definition of \ics{newacronym}, you
%may additionally need to change the above commands as well as
%changing the way the text is displayed using \ics{defglsdisplay}
%and \ics{defglsdisplayfirst}.
%
%The package option \pkgopt{shortcuts} provides the synonyms listed
%in \tableref{tab:shortcuts}. If any of those commands generate
%an \qt{undefined control sequence} error message, check that you
%have enabled the shortcuts using the \pkgopt{shortcuts} package 
%option. Note that there are no shortcuts for the commands that
%produce all upper case text.
%
%\begin{table}[htbp]
%\caption[Synonyms provided by the package option shortcuts]{Synonyms provided by the package option \pkgopt{shortcuts}}
%\label{tab:shortcuts}
%\begin{center}
%\begin{tabular}{ll}
%\bfseries Shortcut Command & \bfseries Equivalent Command\\
%\ics{acs} & \ics{acrshort}\\
%\ics{Acs} & \ics{Acrshort}\\
%\ics{acsp} & \ics{acrshortpl}\\
%\ics{Acsp} & \ics{Acrshortpl}\\
%\ics{acl} & \ics{acrlong}\\
%\ics{Acl} & \ics{Acrlong}\\
%\ics{aclp} & \ics{acrlongpl}\\
%\ics{Aclp} & \ics{Acrlongpl}\\
%\ics{acf} & \ics{acrfull}\\
%\ics{Acf} & \ics{Acrfull}\\
%\ics{acfp} & \ics{acrfullpl}\\
%\ics{Acfp} & \ics{Acrfullpl}\\
%\ics{ac} & \ics{gls}\\
%\ics{Ac} & \ics{Gls}\\
%\ics{acp} & \ics{glspl}\\
%\ics{Acp} & \ics{Glspl}
%\end{tabular}
%\end{center}
%\end{table}
%
%\subsubsection{Defining A Custom Acronym Style}
%\label{sec:customacronym}
%
%You may find that the predefined acronyms styles that come with the
%\styfmt{glossaries} package don't suit your requirements. In this
%case you can define your own style. This is done by redefining the
%following commands:
%\begin{definition}[\DescribeMacro{\CustomAcronymFields}]
%\cs{CustomAcronymFields}
%\end{definition}
%This command sets up the keys for \ics{newglossaryentry} when
%you define an acronym using \ics{newacronym}. Within the definition
%of \cs{CustomAcronymFields}, you may use \cs{the}\ics{glslongtok} to
%access the long form, \cs{the}\ics{glsshorttok} to access the short
%form and \cs{the}\ics{glslabeltok} to access the label. This command
%is typically used to set the \gloskey{name}, \gloskey{first},
%\gloskey{firstplural}, \gloskey{text} and \gloskey{plural} keys. It
%may also be used to set the \gloskey{symbol} or
%\gloskey{description} keys depending on your requirements.
%
%\begin{definition}[\DescribeMacro{\SetCustomDisplayStyle}]
%\cs{SetCustomDisplayStyle}\marg{type}
%\end{definition}
%This is used to set up the display style for the glossary given by
%\meta{type}. This should typically just use \ics{defglsdisplayfirst}
%and \ics{defglsdisplay}.
%
%Once you have redefined \cs{CustomAcronymFields} and
%\cs{SetCustomDisplayStyle}, you must then switch to this style using
%\begin{definition}[\DescribeMacro{\SetCustomStyle}]
%\cs{SetCustomStyle}
%\end{definition}
%Note that you may still use the \pkgopt{shortcuts} package option
%with your custom style.
%
%\begin{important}
%If you omit \cs{SetCustomStyle}, or use it before you redefine
%\cs{CustomAcronymFields} and \cs{SetCustomDisplayStyle}, your new
%style won't be correctly implemented. You must set up the custom style 
%before defining new acronyms. The acronyms must be defined using
%\ics{newacronym} not \ics{newglossaryentry}.
%\end{important}
%
%As an example, suppose I want my acronym on first use to have the
%short form in the text and the long form with the description in a
%footnote. Suppose also that I want the short form to be put in small
%caps in the main body of the document, but I want it in normal
%capitals in the list of acronyms. In my list of acronyms, I want the
%long form as the name with the short form in brackets followed by
%the description.
%
%First, I need to redefine \ics{CustomAcronymFields} so that
%\ics{newacronym} will correctly set the \gloskey{name}, 
%\gloskey{text} and \gloskey{plural} keys. I want the long form to be
%stored in the \gloskey{name} and the short form to be stored in
%\gloskey{text}. In addition, I'm going to set the \gloskey{symbol}
%to the short form in upper case so that it will appear in the list
%of acronyms.
%
%\begin{verbatim}
%\renewcommand*{\CustomAcronymFields}{%
%  name={\the\glslongtok},%
%  symbol={\MakeUppercase{\the\glsshorttok}},%
%  text={\textsc{\the\glsshorttok}},%
%  plural={\textsc{\the\glsshorttok}s}%
%}
%\end{verbatim}
%
%Note that in this case I haven't bothered with \ics{acrpluralsuffix}
%and have just inserted an \qt{s}.
%
%When I use the custom acronym style, the short form is stored in
%\gloskey{user1}, the plural short form is stored in \gloskey{user2},
%the long form is stored in \gloskey{user3} and the plural long form
%is stored in \gloskey{user4}. So when I use \ics{defglsdisplayfirst}
%and \ics{defglsdisplay}, I can use \ics{glsentryuseriii} to access
%the long form. Recall from \sectionref{sec:glsdisplay}, that the
%optional argument to \ics{defglsdisplayfirst} and \ics{defglsdisplay}
%indicates the glossary type. This is passed to
%\ics{SetCustomDisplayStyle}. The mandatory argument sets up the
%definition of \ics{glsdisplayfirst} and \ics{glsdisplay} for the
%given glossary, where the first argument corresponds to the
%\gloskey{first}, \gloskey{firstplural}, \gloskey{text} or 
%\gloskey{plural}, as appropriate, the second argument corresponds to
%the \gloskey{description}, the third corresponds to the
%\gloskey{symbol} and the fourth argument is the inserted text.
%
%\begin{verbatim}
%\renewcommand*{\SetCustomDisplayStyle}[1]{%
%  \defglsdisplayfirst[#1]{##1##4\protect\footnote{%
%    \glsentryuseriii{\glslabel}: ##2%
%  }}
%  \defglsdisplay[#1]{##1##4}%
%}
%\end{verbatim}
%
%Since we have a definition inside a definition, \verb|#1| refers to
%the argument of \ics{SetCustomDisplayStyle}, and \verb|##1|, \ldots,
%\verb|##4|, refer to the arguments of \ics{glsdisplayfirst} and
%\ics{glsdisplay}.
%
%Now that I've redefined \ics{CustomAcronymFields} and
%\ics{SetCustomDisplayStyle}, I can set this style using
%\begin{verbatim}
%\SetCustomStyle
%\end{verbatim}
%and now I can define my acronyms:
%\begin{verbatim}
%\newacronym[description={set of tags for use in developing hypertext
%documents}]{html}{html}{Hyper Text Markup Language}
%
%\newacronym[description={language used to describe the layout of a
%document written in a markup language}]{css}{css}{Cascading Style
%Sheet}
%\end{verbatim}
%
%Note that since I've used the description in the main body of the
%text, I need to switch off the sanitization otherwise any commands
%within the description won't get interpreted. Also I want to use the
%\sty{hyperref} package, but this will cause a problem on first use
%as I'll get nested hyperlinks, so I need to switch off the
%hyperlinks on first use. In addition, I want to use a glossary style
%that displays the symbol. Therefore, in my preamble I have:
%
%\begin{verbatim}
%\usepackage[colorlinks]{hyperref}
%\usepackage[acronym,         % create list of acronyms
%            nomain,          % don't need main glossary for this example
%            style=tree,      % need a style that displays the symbol
%            hyperfirst=false,% don't hyperlink first use
%            sanitize=none    % switch off sanitization as description 
%                             % will be used in the main text
%            ]{glossaries}
%\end{verbatim}
%
%Note that I haven't used the \pkgopt{description} or
%\pkgopt{footnote} package options.
%
%\subsubsection{Upgrading From the glossary Package}
%\label{sec:oldacronym}
%Users of the obsolete \sty{glossary} package may recall that
%the syntax used to define new acronyms has changed with the
%replacement \styfmt{glossaries} package. In addition, the old
%\sty{glossary} package created the command 
%\cs{}\meta{acr-name} when defining the acronym \meta{acr-name}.
%
%In order to facilitate migrating from the old package to the new
%one, the \styfmt{glossaries} package\footnote{as from version 1.18} 
%provides the command:
%\begin{definition}[\DescribeMacro{\oldacronym}]
%\cs{oldacronym}\oarg{label}\marg{abbrv}\marg{long}\marg{key-val list}
%\end{definition}
%This uses the same syntax as the \sty{glossary} package's
%method of defining acronyms. It is equivalent to:\\[10pt]
%\ics{newacronym}\oarg{key-val list}\marg{label}\marg{abbrv}\marg{long}\\[10pt]
%In addition, \ics{oldacronym} also defines the commands
%\cs{}\meta{label}, which is equivalent to \ics{gls}\marg{label},
%and \cs{}\meta{label}\texttt{*}, which is equivalent to
%\ics{Gls}\marg{label}. If \meta{label} is omitted, \meta{abbrv}
%is used. Since commands names must consist only of alphabetical
%characters, \meta{label} must also only consist of alphabetical
%characters. Note that \cs{}\meta{label} doesn't allow you to use
%the first optional argument of \ics{gls} or \ics{Gls} --- you will
%need to explicitly use \ics{gls} or \ics{Gls} to change the
%settings.
%
%\begin{important}
%Recall that, in general, \LaTeX\ ignores spaces following command 
%names consisting of alphabetical characters. This is also true for 
%\cs{}\meta{label} unless you additionally load the
%\sty{xspace} package.
%\end{important}
%
%The \styfmt{glossaries} package doesn't load the \sty{xspace} package
%since there are both advantages and disadvantages to using
%\ics{xspace} in \cs{}\meta{label}. If you don't use the 
%\sty{xspace} package you need to explicitly force a space using
%\verb*|\ | (backslash space) however you can follow \cs{}\meta{label}
%with additional text in square brackets (the final optional
%argument to \ics{gls}). If you use the \sty{xspace} package
%you don't need to escape the spaces but you can't use
%the optional argument to insert text (you will have to explicitly
%use \ics{gls}).
%
%To illustrate this, suppose I define the acronym \qt{abc} as
%follows:
%\begin{verbatim}
%\oldacronym{abc}{example acronym}{}
%\end{verbatim}
%This will create the command \cs{abc} and its starred version
%\cs{abc*}. \Tableref{tab:xspace} illustrates the effect of
%\cs{abc} (on subsequent use) according to whether or not the
%\sty{xspace} package has been loaded. As can be seen from the
%final row in the table, the \sty{xspace} package prevents the
%optional argument from being recognised.
%
%\begin{table}[htbp]
%\caption[The effect of using xspace]{The effect of using 
%\styfmt{xspace} with \cs{oldacronym}}
%\label{tab:xspace}
%\vskip\baselineskip
%\centering
%\begin{tabular}{lll}
%\bfseries Code & \bfseries With \styfmt{xspace} &
%\bfseries Without \styfmt{xspace}\\
%\verb|\abc.| & abc. & abc.\\
%\verb|\abc xyz| & abc xyz & abcxyz\\
%\verb|\abc\ xyz| & abc xyz & abc xyz\\
%\verb|\abc* xyz| & Abc xyz & Abc xyz\\
%\verb|\abc['s] xyz| & abc ['s] xyz & abc's xyz
%\end{tabular}
%\par
%\end{table}
%
%
%
%\subsection{Unsetting and Resetting Entry Flags}
%\label{sec:glsunset}
%
%When using \ics{gls}, \ics{glspl} and their uppercase variants it is
%possible that you may want to use the value given by the
%\gloskey{first} key, even though you have already used the glossary
%entry\ifirstuse. Conversely, you may want to use the value given by the
%\gloskey{text} key, even though you haven't used the glossary entry.
%The former can be achieved by one of the following commands:
%\begin{definition}[\DescribeMacro{\glsreset}]
%\cs{glsreset}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\glslocalreset}]
%\cs{glslocalreset}\marg{label}
%\end{definition}
%while the latter can be achieved by one of the following commands:
%\begin{definition}[\DescribeMacro{\glsunset}]
%\cs{glsunset}\marg{label}
%\end{definition}
%\begin{definition}[\DescribeMacro{\glslocalunset}]
%\cs{glslocalunset}\marg{label}
%\end{definition}
%You can also reset or unset all entries for a given glossary or list of
%glossaries using:
%\begin{definition}[\DescribeMacro{\glsresetall}]
%\cs{glsresetall}\oarg{glossary list}
%\end{definition}
%\begin{definition}[\DescribeMacro{\glslocalresetall}]
%\cs{glslocalresetall}\oarg{glossary list}
%\end{definition}
%\begin{definition}[\DescribeMacro{\glsunsetall}]
%\cs{glsunsetall}\oarg{glossary list}
%\end{definition}
%\begin{definition}[\DescribeMacro{\glslocalunsetall}]
%\cs{glslocalunsetall}\oarg{glossary list}
%\end{definition}
%where \meta{glossary list} is a comma-separated list of 
%glossary labels. If omitted, all defined glossaries are assumed.
%For example, to reset all entries in the main glossary and the
%list of acronyms:
%\begin{verbatim}
%\glsresetall[main,acronym]
%\end{verbatim}
%
%You can determine whether an entry's first use flag is set using:
%\begin{definition}[\DescribeMacro{\ifglsused}]
%\cs{ifglsused}\marg{label}\marg{true part}\marg{false part}
%\end{definition}
%where \meta{label} is the label of the required entry. If the
%entry has been used, \meta{true part} will be done, otherwise
%\meta{false part} will be done.
%
%
%\subsection{Glossary Styles}
%\label{sec:styles}
%The \styfmt{glossaries} package comes with some pre-defined
%glossary styles. Note that the styles are suited to different
%types of glossaries: some styles ignore the associated
%symbol; some styles are not designed for hierarchical entries,
%so they display sub-entries in the same way as they display top
%level entries; some styles are designed for homographs, so they 
%ignore the name for sub-entries. You should therefore pick a style 
%that suits your type of glossary. See \tableref{tab:styles} for
%a summary of the available styles.
%
%\begin{table}[htbp]
%\caption[Glossary Styles]{Glossary Styles. An asterisk in the style 
%name indicates anything that matches that doesn't match any
%previously listed style (e.g.\ \texttt{long3col*}
%matches \glostyle{long3col}, \glostyle{long3colheader}, 
%\glostyle{long3colborder} and \glostyle{long3colheaderborder}).
%A maximum level of 0 indicates a flat glossary (sub-entries
%are displayed in the same way as main entries). Where the maximum
%level is given as --- there is no limit, but note that 
%\app{makeindex} imposes a limit of 2 sub-levels. If the
%homograph column is checked, then the name is not displayed for
%sub-entries. If the symbol column is checked, then the symbol will
%be displayed if it has been defined.}
%\label{tab:styles}
%\vskip\baselineskip
%\centering
%\begin{tabular}{lccc}
%\bfseries Style & \bfseries Maximum Level &
%\bfseries Homograph & \bfseries Symbol\\
%\ttfamily listdotted & 0 & & \\
%\ttfamily sublistdotted & 1 & & \\
%\ttfamily list* & 1 & \tick & \\
%\ttfamily altlist* & 1 & \tick & \\
%\ttfamily long*3col* & 1 & \tick & \\
%\ttfamily long4col* & 1 & \tick & \tick \\
%\ttfamily altlong*4col* & 1 & \tick & \tick \\
%\ttfamily long* & 1 & \tick & \\
%\ttfamily super*3col* & 1 & \tick & \\
%\ttfamily super4col* & 1 & \tick & \tick \\
%\ttfamily altsuper*4col* & 1 & \tick & \tick \\
%\ttfamily super* & 1 & \tick & \\
%\ttfamily index* & 2 & & \tick\\
%\ttfamily treenoname* & --- & \tick & \tick\\
%\ttfamily tree* & --- & & \tick\\
%\ttfamily alttree* & --- & & \tick
%\end{tabular}
%\par
%\end{table}
%
%The glossary style can be set using the \gloskey[printglossary]{style} key in the optional
%argument to \ics{printglossary} or using the command:
%\begin{definition}[\DescribeMacro{\glossarystyle}]
%\cs{glossarystyle}\marg{style-name}
%\end{definition}
%Some of the glossary styles may also be set using the \pkgopt{style} 
%package option, it depends if the package in which they are defined
%is automatically loaded by the \styfmt{glossaries} package.
%
%The tabular-like styles that allow multi-line descriptions and page
%lists use the length \DescribeMacro{\glsdescwidth}\cs{glsdescwidth}
%to set the width of the description column and the length
%\DescribeMacro{\glspagelistwidth}\cs{glspagelistwidth} to set the
%width of the page list column.\footnote{these lengths will not be
%available if you use both the \pkgopt{nolong} and \pkgopt{nosuper}
%package options or if you use the \pkgopt{nostyles} package option
%unless you explicitly load the relevant package.}
%These will need to be changed using \cs{setlength} if the glossary
%is too wide. Note that the \glostyle{long4col} and
%\glostyle{super4col} styles (and their header and border variations)
%don't use these lengths as they are designed for single line
%entries. Instead you should use the analogous \glostyle{altlong4col}
%and \glostyle{altsuper4col} styles.  If you want to
%explicitly create a line-break within a multi-line description in
%a tabular-like style you should use \ics{newline} instead of
%\verb|\\|.
%
%Note that if you use the \gloskey[printglossary]{style} key in the
%optional argument to \ics{printglossary}, it will override any 
%previous style settings for the given glossary, so if, for example,
%you do
%\begin{verbatim}
%\renewcommand*{\glsgroupskip}{}
%\printglossary[style=long]
%\end{verbatim}
%then the new definition of \ics{glsgroupskip} will not have an affect
%for this glossary, as \cs{glsgroupskip} is redefined by 
%\verb|style=long|. Likewise, \ics{glossarystyle} will also
%override any previous style definitions, so, again
%\begin{verbatim}
%\renewcommand*{\glsgroupskip}{}
%\glossarystyle{long}
%\end{verbatim}
%will reset \cs{glsgroupskip} back to its default definition for the
%named glossary style (\glostyle{long} in this case). If you want to 
%modify the styles, either use \ics{newglossarystyle} (described
%in the next section) or make the modifications after 
%\ics{glossarystyle}, e.g.:
%\begin{verbatim}
%\glossarystyle{long}
%\renewcommand*{\glsgroupskip}{}
%\end{verbatim}
%
% \changes{1.03}{2007 July 4}{'glspostdescription added}
%All the styles except for the three- and four-column styles and the
%\glostyle{listdotted} style use the command
%\begin{definition}[\DescribeMacro{\glspostdescription}]
%\cs{glspostdescription}
%\end{definition}
%after the description. This simply displays a full stop by default.
%To eliminate this full stop (or replace it with something else, say,
%a comma) you will need to redefine \cs{glspostdescription} before
%the glossary is displayed. Alternatively, you can suppress it for a
%given entry by placing \ics{nopostdesc} in the entry's description.
%
%\subsubsection{List Styles}
%\label{sec:liststyles}
%
%The styles described in this section are all defined in the package
%\sty{glossary-list}. Since they all use the \env{description}
%environment, they are governed by the same parameters as that
%environment. These styles all ignore the entry's symbol.  Note that
%these styles will automatically be available unless you use the
%\pkgopt{nolist} or \pkgopt{nostyles} package options.
%
%\begin{description}
%\item[list] The \glostyle{list} style uses the \env{description}
%environment. The entry name is placed in the optional argument of
%the \cs{item} command (so it will appear in bold by default). The
%description follows, and then the associated \term{number list} for 
%that entry. The symbol is ignored.  If the entry has child entries,
%the description and number list follows (but not the name) for each
%child entry.  Groups are separated using \cs{indexspace}.
%
%\item[listgroup] The \glostyle{listgroup} style is like 
%\glostyle{list} but the glossary groups have headings.
%
%\item[listhypergroup] The \glostyle{listhypergroup} style is like
%\glostyle{listgroup} but has a navigation line at the start of the
%glossary with links to each group that is present in the glossary.
%This requires an additional run through \LaTeX\ to ensure the group
%information is up to date. In the navigation line, each group is
%separated by
%\begin{definition}[\DescribeMacro{\glshypernavsep}]
%\cs{glshypernavsep}
%\end{definition}
%which defaults to a vertical bar with a space on either side. For
%example, to simply have a space separating each group, do:
%\begin{verbatim}
%\renewcommand*{\glshypernavsep}{\space}
%\end{verbatim}
%
%Note that the hyper-navigation line is now (as from version 1.14) 
%set inside the optional argument to \cs{item} instead of after it
%to prevent a spurious space at the start. This can be changed
%by redefining \ics{glossaryheader}, but note that this needs to
%be done \emph{after} the glossary style has been set.
%
%\item[altlist] The \glostyle{altlist} style is like \glostyle{list}
%but the description starts on the line following the name. (As
%with the \glostyle{list} style, the symbol is ignored.) Each child
%entry starts a new line, but as with the \glostyle{list} style,
%the name associated with each child entry is ignored.
%
%\item[altlistgroup] The \glostyle{altlistgroup} style is like 
%\glostyle{altlist} but the glossary groups have headings.
%
%\item[altlisthypergroup] The \glostyle{altlisthypergroup} style is like 
%\glostyle{altlistgroup} but has a set of links to the glossary 
%groups. The navigation line is the same as that for 
%\glostyle{listhypergroup}, described above.
%
%\item[listdotted] This style uses the \env{description}
%environment.\footnote{This style was supplied by Axel~Menzel.} Each
%entry starts with \verb|\item[]|, followed by the name followed by a
%dotted line, followed by the description. Note that this style
%ignores both the \term{number list} and the symbol. The length
%\begin{definition}[\DescribeMacro{\glslistdottedwidth}]
%\cs{glslistdottedwidth}
%\end{definition}
%governs where the description should start. This is a flat style, so
%child entries are formatted in the same way as the parent entries.
%
%\item[sublistdotted] This is a variation on the \glostyle{listdotted}
%style designed for hierarchical glossaries. The main entries
%have just the name displayed. The sub entries are displayed in
%the same manner as \glostyle{listdotted}.
%\end{description}
%
%
%\subsubsection{Longtable Styles}
%\label{sec:longstyles}
%
%The styles described in this section are all defined in the package
%\sty{glossary-long}. Since they all use the \env{longtable}
%environment, they are governed by the same parameters as that
%environment.  Note that these styles will automatically be available
%unless you use the \pkgopt{nolong} or \pkgopt{nostyles} package
%options.  These styles fully justify the description and page list
%columns.  If you want ragged right formatting instead, use the
%analogous styles described in \sectionref{sec:longraggedstyles}.
%
%
%\begin{description}
%\item[long] The \glostyle{long} style uses the \env{longtable}
%environment (defined by the \sty{longtable} package). It has two
%columns: the first column contains the entry's name and the second
%column contains the description followed by the \term{number list}.
%The entry's symbol is ignored.
%Sub groups are separated with a blank row. The width of the
%first column is governed by the widest entry in that column. The
%width of the second column is governed by the length
%\ics{glsdescwidth}. Child entries have a similar format to the
%parent entries except that their name is suppressed.
%
%\item[longborder] The \glostyle{longborder} style is like
%\glostyle{long} but has horizontal and vertical lines around it.
%
%\item[longheader] The \glostyle{longheader} style is like
%\glostyle{long} but has a header row.
%
%\item[longheaderborder] The \glostyle{longheaderborder} style is
%like \glostyle{longheader} but has horizontal and vertical lines
%around it.
%
%\item[long3col] The \glostyle{long3col} style is like
%\glostyle{long} but has three columns. The first column contains
%the entry's name, the second column contains the description
%and the third column contains the \term{number list}.
%The entry's symbol is ignored. The width of the
%first column is governed by the widest entry in that column, the
%width of the second column is governed by the length
%\ics{glsdescwidth}, and the width of the third column is governed by the
%length \ics{glspagelistwidth}.
%
%\item[long3colborder] The \glostyle{long3colborder} style is like
%the \glostyle{long3col} style but has horizontal and vertical
%lines around it.
%
%\item[long3colheader] The \glostyle{long3colheader} style is like
%\glostyle{long3col} but has a header row.
%
%\item[long3colheaderborder] The \glostyle{long3colheaderborder} style is
%like \glostyle{long3colheader} but has horizontal and vertical lines
%around it.
%
%\item[long4col] The \glostyle{long4col} style is like 
%\glostyle{long3col} but has an additional column in which the
%entry's associated symbol appears. This style is used for brief
%single line descriptions. The column widths are governed by the
%widest entry in the given column. Use \glostyle{altlong4col} for 
%multi-line descriptions.
%
%\item[long4colborder] The \glostyle{long4colborder} style is like
%the \glostyle{long4col} style but has horizontal and vertical
%lines around it.
%
%\item[long4colheader] The \glostyle{long4colheader} style is like
%\glostyle{long4col} but has a header row.
%
%\item[long4colheaderborder] The \glostyle{long4colheaderborder} style is
%like \glostyle{long4colheader} but has horizontal and vertical lines
%around it.
%
%\item[altlong4col] The \glostyle{altlong4col} style is like
%\glostyle{long4col} but allows multi-line descriptions and page
%lists.  The width of the description column is governed by the
%length \ics{glsdescwidth} and the width of the page list column is
%governed by the length \ics{glspagelistwidth}. The widths of the
%name and symbol columns are governed by the widest entry in the
%given column.
%
%\item[altlong4colborder] The \glostyle{altlong4colborder} style is like
%the \glostyle{long4colborder} but allows multi-line descriptions and
%page lists.
%
%\item[altlong4colheader] The \glostyle{altlong4colheader} style is like
%\glostyle{long4colheader} but allows multi-line descriptions and
%page lists.
%
%\item[altlong4colheaderborder] The \glostyle{altlong4colheaderborder} 
%style is like \glostyle{long4colheaderborder} but allows multi-line
%descriptions and page lists.
%\end{description}
%
%
%\subsubsection{Longtable Styles (Ragged Right)}
%\label{sec:longraggedstyles}
%
%The styles described in this section are all defined in the package
%\sty{glossary-longragged}. These styles are analogous to those
%defined in \sty{glossary-long} but the multiline columns are left
%justified instead of fully justified. Since these styles all use the
%\env{longtable} environment, they are governed by the same
%parameters as that environment. The \sty{glossary-longragged}
%package additionally requires the \sty{array} package.  Note that
%these styles will only be available if you explicitly load
%\sty{glossary-longragged}:
%\begin{verbatim}
%\usepackage{glossaries}
%\usepackage{glossary-longragged}
%\end{verbatim}
%Note that you can't set these styles using the \pkgopt{style}
%package option since the styles aren't defined until after
%the \styfmt{glossaries} package has been loaded.
%
%\begin{description}
%\item[longragged] The \glostyle{longragged} style has two
%columns: the first column contains the entry's name and the second
%column contains the (left-justified) description followed by the 
%\term{number list}.  The entry's symbol is ignored.
%Sub groups are separated with a blank row. The width of the
%first column is governed by the widest entry in that column. The
%width of the second column is governed by the length
%\ics{glsdescwidth}. Child entries have a similar format to the
%parent entries except that their name is suppressed.
%
%\item[longraggedborder] The \glostyle{longraggedborder} style is like
%\glostyle{longragged} but has horizontal and vertical lines around it.
%
%\item[longraggedheader] The \glostyle{longraggedheader} style is like
%\glostyle{longragged} but has a header row.
%
%\item[longraggedheaderborder] The \glostyle{longraggedheaderborder} 
%style is like \glostyle{longraggedheader} but has horizontal and 
%vertical lines around it.
%
%\item[longragged3col] The \glostyle{longragged3col} style is like
%\glostyle{longragged} but has three columns. The first column
%contains the entry's name, the second column contains the (left
%justified) description and the third column contains the (left
%justified) \term{number list}.  The entry's symbol is ignored. The
%width of the first column is governed by the widest entry in that
%column, the width of the second column is governed by the length
%\ics{glsdescwidth}, and the width of the third column is governed by
%the length \ics{glspagelistwidth}.
%
%\item[longragged3colborder] The \glostyle{longragged3colborder}
%style is like the \glostyle{longragged3col} style but has horizontal
%and vertical lines around it.
%
%\item[longragged3colheader] The \glostyle{longragged3colheader} style is like
%\glostyle{longragged3col} but has a header row.
%
%\item[longragged3colheaderborder] The \glostyle{longragged3colheaderborder} style is
%like \glostyle{longragged3colheader} but has horizontal and vertical lines
%around it.
%
%\item[altlongragged4col] The \glostyle{altlongragged4col} style is
%like \glostyle{longragged3col} but has an additional column in which
%the entry's associated symbol appears. The width of the description
%column is governed by the length \ics{glsdescwidth} and the width of
%the page list column is governed by the length
%\ics{glspagelistwidth}. The widths of the name and symbol columns
%are governed by the widest entry in the given column.
%
%\item[altlongragged4colborder] The
%\glostyle{altlongragged4colborder} style is like the
%\glostyle{altlongragged4col} but has horizontal and vertical lines
%around it.
%
%\item[altlongragged4colheader] The
%\glostyle{altlongragged4colheader} style is like
%\glostyle{altlongragged4col} but has a header row.
%
%\item[altlongragged4colheaderborder] The
%\glostyle{altlongragged4colheaderborder} style is like
%\glostyle{altlongragged4colheader} but has horizontal and vertical
%lines around it.
%
%\end{description}
%
%
%\subsubsection{Supertabular Styles}
%\label{sec:superstyles}
%
%The styles described in this section are all defined in the package
%\sty{glossary-super}. Since they all use the \env{supertabular}
%environment, they are governed by the same parameters as that
%environment.  Note that these styles will automatically be available
%unless you use the \pkgopt{nosuper} or \pkgopt{nostyles} package
%options.  In general, the \env{longtable} environment is better,
%but there are some circumstances where it is better to use
%\env{supertabular}.\footnote{e.g.\ with the \sty{flowfram}
%package.} These styles fully justify the description and page list
%columns.  If you want ragged right formatting instead, use the
%analogous styles described in \sectionref{sec:superraggedstyles}.
%
%\begin{description}
%\item[super] The \glostyle{super} style uses the \env{supertabular}
%environment (defined by the \sty{supertabular} package). It has two
%columns: the first column contains the entry's name and the second
%column contains the description followed by the \term{number list}.
%The entry's symbol is ignored.
%Sub groups are separated with a blank row. The width of the
%first column is governed by the widest entry in that column. The
%width of the second column is governed by the length
%\ics{glsdescwidth}. Child entries have a similar format to the
%parent entries except that their name is suppressed.
%
%\item[superborder] The \glostyle{superborder} style is like
%\glostyle{super} but has horizontal and vertical lines around it.
%
%\item[superheader] The \glostyle{superheader} style is like
%\glostyle{super} but has a header row.
%
%\item[superheaderborder] The \glostyle{superheaderborder} style is
%like \glostyle{superheader} but has horizontal and vertical lines
%around it.
%
%\item[super3col] The \glostyle{super3col} style is like
%\glostyle{super} but has three columns. The first column contains
%the entry's name, the second column contains the description
%and the third column contains the \term{number list}. The
%entry's symbol is ignored. The width of the
%first column is governed by the widest entry in that column. The
%width of the second column is governed by the length
%\ics{glsdescwidth}. The width of the third column is governed by the
%length \ics{glspagelistwidth}.
%
%\item[super3colborder] The \glostyle{super3colborder} style is like
%the \glostyle{super3col} style but has horizontal and vertical
%lines around it.
%
%\item[super3colheader] The \glostyle{super3colheader} style is like
%\glostyle{super3col} but has a header row.
%
%\item[super3colheaderborder] The \glostyle{super3colheaderborder} style
%is like \glostyle{super3colheader} but has horizontal and vertical
%lines around it.
%
%\item[super4col] The \glostyle{super4col} style is like 
%\glostyle{super3col} but has an additional column in which the
%entry's associated symbol appears. This style is designed for
%entries with brief single line descriptions. The column widths are governed by the
%widest entry in the given column. Use \glostyle{altsuper4col}
%for multi-line descriptions.
%
%\item[super4colborder] The \glostyle{super4colborder} style is like
%the \glostyle{super4col} style but has horizontal and vertical
%lines around it.
%
%\item[super4colheader] The \glostyle{super4colheader} style is like
%\glostyle{super4col} but has a header row.
%
%\item[super4colheaderborder] The \glostyle{super4colheaderborder} style
%is like \glostyle{super4colheader} but has horizontal and vertical
%lines around it.
%
%\item[altsuper4col] The \glostyle{altsuper4col} style is like 
%\glostyle{super4col} but allows multi-line descriptions and page
%lists.
%The width of the description column is governed by the length
%\ics{glsdescwidth} and the width of the page list column is
%governed by the length \ics{glspagelistwidth}. The width of the name 
%and symbol columns is governed by the widest entry in the 
%given column.
%
%\item[altsuper4colborder] The \glostyle{altsuper4colborder} style is like
%the \glostyle{super4colborder} style but allows multi-line descriptions
%and page lists.
%
%\item[altsuper4colheader] The \glostyle{altsuper4colheader} style is like
%\glostyle{super4colheader} but allows multi-line descriptions and
%page lists.
%
%\item[altsuper4colheaderborder] The \glostyle{altsuper4colheaderborder}
%style is like \glostyle{super4colheaderborder} but allows multi-line
%descriptions and page lists.
%\end{description}
%
%
%\subsubsection{Supertabular Styles (Ragged Right)}
%\label{sec:superraggedstyles}
%
%The styles described in this section are all defined in the package
%\sty{glossary-superragged}. These styles are analogous to those
%defined in \sty{glossary-super} but the multiline columns are left
%justified instead of fully justified. Since these styles all use the
%\env{supertabular} environment, they are governed by the same
%parameters as that environment. The \sty{glossary-superragged}
%package additionally requires the \sty{array} package.  Note that
%these styles will only be available if you explicitly load
%\sty{glossary-superragged}:
%\begin{verbatim}
%\usepackage{glossaries}
%\usepackage{glossary-superragged}
%\end{verbatim}
%Note that you can't set these styles using the \pkgopt{style}
%package option since the styles aren't defined until after
%the \styfmt{glossaries} package has been loaded.
%
%\begin{description}
%\item[superragged] The \glostyle{superragged} style uses the
%\env{supertabular} environment (defined by the
%\sty{supertabular} package). It has two columns: the first column
%contains the entry's name and the second column contains the (left
%justified) description followed by the \term{number list}.  The
%entry's symbol is ignored.  Sub groups are separated with a blank
%row. The width of the first column is governed by the widest entry
%in that column. The width of the second column is governed by the
%length \ics{glsdescwidth}. Child entries have a similar format to
%the parent entries except that their name is suppressed.
%
%\item[superraggedborder] The \glostyle{superraggedborder} style is
%like \glostyle{superragged} but has horizontal and vertical lines
%around it.
%
%\item[superraggedheader] The \glostyle{superraggedheader} style is
%like \glostyle{superragged} but has a header row.
%
%\item[superraggedheaderborder] The
%\glostyle{superraggedheaderborder} style is like
%\glostyle{superraggedheader} but has horizontal and vertical lines
%around it.
%
%\item[superragged3col] The \glostyle{superragged3col} style is like
%\glostyle{superragged} but has three columns. The first column
%contains the entry's name, the second column contains the (left
%justified) description and the third column contains the (left
%justified) \term{number list}. The entry's symbol is ignored. The
%width of the first column is governed by the widest entry in that
%column. The width of the second column is governed by the length
%\ics{glsdescwidth}. The width of the third column is governed by the
%length \ics{glspagelistwidth}.
%
%\item[superragged3colborder] The \glostyle{superragged3colborder}
%style is like the \glostyle{superragged3col} style but has
%horizontal and vertical lines around it.
%
%\item[superragged3colheader] The \glostyle{superragged3colheader}
%style is like \glostyle{superragged3col} but has a header row.
%
%\item[superragged3colheaderborder] The
%\glostyle{superragged3colheaderborder} style is like
%\glostyle{superragged3colheader} but has horizontal and vertical
%lines around it.
%
%\item[altsuperragged4col] The \glostyle{altsuperragged4col} style is
%like \glostyle{superragged3col} but has an additional column in
%which the entry's associated symbol appears. The column widths for
%the name and symbol column are governed by the widest entry in the
%given column.
%
%\item[altsuperragged4colborder] The
%\glostyle{altsuperragged4colborder} style is like the
%\glostyle{altsuperragged4col} style but has horizontal and vertical
%lines around it.
%
%\item[altsuperragged4colheader] The
%\glostyle{altsuperragged4colheader} style is like
%\glostyle{altsuperragged4col} but has a header row.
%
%\item[altsuperragged4colheaderborder] The
%\glostyle{altsuperragged4colheaderborder} style is like
%\glostyle{altsuperragged4colheader} but has horizontal and vertical
%lines around it.
%
%\end{description}
%
%
%\subsubsection{Tree-Like Styles}
%\label{sec:treestyles}
%
%The styles described in this section are all defined in the package
%\sty{glossary-tree}. These styles are designed for hierarchical
%glossaries but can also be used with glossaries that don't have
%sub-entries. These styles will display the entry's symbol if it
%exists. Note that these styles will automatically be available
%unless you use the \pkgopt{notree} or \pkgopt{nostyles} package
%options.
%
%\begin{description}
%\item[index] The \glostyle{index} style is similar to the way
%indices are usually formatted in that it has a hierarchical
%structure up to three levels (the main level plus two sub-levels).
%The name is typeset in bold, and if the symbol is present it is set
%in parentheses after the name and before the description.
%Sub-entries are indented and also include the name, the symbol
%in brackets (if present) and the description.  Groups are separated
%using \ics{indexspace}.
%
%\item[indexgroup] The \glostyle{indexgroup} style is similar to
%the \glostyle{index} style except that each group has a heading.
%
%\item[indexhypergroup] The \glostyle{indexhypergroup} style is like 
%\glostyle{indexgroup} but has a set of links to the glossary 
%groups. The navigation line is the same as that for 
%\glostyle{listhypergroup}, described above.
%
%\item[tree] The \glostyle{tree} style is similar to the
%\glostyle{index} style except that it can have arbitrary levels.
%(Note that \app{makeindex} is limited to three levels, so
%you will need to use \app{xindy} if you want more than 
%three levels.) Each sub-level is indented by 
%\DescribeMacro{\glstreeindent}\cs{glstreeindent}. Note that the
%name, symbol (if present) and description are placed in the
%same paragraph block. If you want the name to be apart from the
%description, use the \glostyle{alttree} style instead. (See below.)
%
%\item[treegroup] The \glostyle{treegroup} style is similar to
%the \glostyle{tree} style except that each group has a heading.
%
%\item[treehypergroup] The \glostyle{treehypergroup} style is like 
%\glostyle{treegroup} but has a set of links to the glossary 
%groups. The navigation line is the same as that for 
%\glostyle{listhypergroup}, described above.
%
%\item[treenoname] The \glostyle{treenoname} style is like
%the \glostyle{tree} style except that the name for each sub-entry
%is ignored.
%
%\item[treenonamegroup] The \glostyle{treenonamegroup} style is 
%similar to the \glostyle{treenoname} style except that each group 
%has a heading.
%
%\item[treenonamehypergroup] The \glostyle{treenonamehypergroup} 
%style is like \glostyle{treenonamegroup} but has a set of links to 
%the glossary groups. The navigation line is the same as that for 
%\glostyle{listhypergroup}, described above.
%
%\item[alttree] The \glostyle{alttree} style is similar to the
%\glostyle{tree} style except that the indentation for each level
%is determined by the width of the text specified by
%\begin{definition}[\DescribeMacro{\glssetwidest}]
%\cs{glssetwidest}\oarg{level}\marg{text}
%\end{definition}
%The optional argument \meta{level} indicates the level, where
%0 indicates the top-most level, 1 indicates the first level 
%sub-entries, etc. If \cs{glssetwidest} hasn't been used for a 
%given sub-level, the level~0 widest text is used instead. If
%\meta{level} is omitted, 0 is assumed.
%
%For each level, the name is placed to the left of the paragraph
%block containing the symbol (optional) and the description. If the
%symbol is present, it is placed in parentheses before the
%description.
%
%\item[alttreegroup] The \glostyle{alttreegroup} is like the
%\glostyle{alttree} style except that each group has a heading.
%
%\item[alttreehypergroup] The \glostyle{alttreehypergroup} style is 
%like \glostyle{alttreegroup} but has a set of links to the glossary 
%groups. The navigation line is the same as that for 
%\glostyle{listhypergroup}, described above.
%
%\end{description}
%
%
%
%\subsection{Defining your own glossary style}
%\label{sec:newglossarystyle}
%
%If the predefined styles don't fit your requirements, you can
%define your own style using:
%\begin{definition}[\DescribeMacro{\newglossarystyle}]
%\cs{newglossarystyle}\marg{name}\marg{definitions}
%\end{definition}
%where \meta{name} is the name of the new glossary style (to be
%used in \cs{glossarystyle}). The second argument \meta{definitions}
%needs to redefine all of the following:
%
%\begin{definition}[\DescribeEnv{theglossary}]
%\env{theglossary}
%\end{definition}
%This environment defines how the main body of the glossary should
%be typeset. Note that this does not include the section heading,
%the glossary preamble (defined by \cs{glossarypreamble}) or the
%glossary postamble (defined by \cs{glossarypostamble}). For example,
%the \glostyle{list} style uses the \env{description} environment,
%so the \env{theglossary} environment is simply redefined to begin
%and end the \env{description} environment.
%
%\begin{definition}[\DescribeMacro{\glossaryheader}]
%\cs{glossaryheader}
%\end{definition}
%This macro indicates what to do at the start of the main body
%of the glossary. Note that this is not the same as 
%\cs{glossarypreamble}, which should not be affected by changes in
%the glossary style. The \glostyle{list} glossary style redefines
%\cs{glossaryheader} to do nothing, whereas the \glostyle{longheader}
%glossary style redefines \cs{glossaryheader} to do a header row.
%
%\begin{definition}[\DescribeMacro{\glsgroupheading}]
%\cs{glsgroupheading}\marg{label}
%\end{definition}
%This macro indicates
%what to do at the start of each logical block within the main body
%of the glossary. If you use \app{makeindex} the glossary is
%sub-divided into a maximum of twenty-eight logical blocks that are
%determined by the first character of the \gloskey{sort} key (or
%\gloskey{name} key if the \gloskey{sort} key is omitted). The
%sub-divisions are in the following order: symbols, numbers, A,
%\ldots, Z\@. If you use \app{xindy}, the sub-divisions depend on
%the language settings.
%
%Note that the argument to \cs{glsgroupheading}
%is a label \emph{not} the group title. The group title can be obtained
%via
%\begin{definition}[\DescribeMacro{\glsgetgrouptitle}]
%\cs{glsgetgrouptitle}\marg{label}
%\end{definition}
%This obtains the title as follows: if 
%\cs{}\meta{label}\texttt{groupname} exists, this is taken to be the 
%title, otherwise the title is just \meta{label}.
%
%A navigation hypertarget can be created using
%\begin{definition}[\DescribeMacro{\glsnavhypertarget}]
%\cs{glsnavhypertarget}\marg{label}\marg{text}
%\end{definition}
%For further details about \cs{glsnavhypertarget}, see
%\ifpdf\sectionref{sec:code:hypernav}\else the documented code of
%\sty{glossary-hypernav} in \texttt{glossaries.pdf}\fi.
%
%
%Most of the predefined glossary styles redefine \cs{glsgroupheading}
%to simply ignore its argument.  The \glostyle{listhypergroup} style
%redefines \cs{glsgroupheading} as follows:
%\begin{verbatim}
%\renewcommand*{\glsgroupheading}[1]{%
%\item[\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}]}
%\end{verbatim}
%See also \cs{glsgroupskip} below. (Note that command definitions within 
%\cs{newglossarystyle} must use \verb|##1| instead of \verb|#1| etc.)
%
%\begin{definition}[\DescribeMacro{\glsgroupskip}]
%\cs{glsgroupskip}
%\end{definition}
%This macro determines what to do after one logical group but before
%the header for the next logical group. The \glostyle{list} glossary
%style simply redefines \cs{glsgroupskip} to be \cs{indexspace},
%whereas the tabular-like styles redefine \cs{glsgroupskip} to
%produce a blank row.
%
%\begin{definition}[\DescribeMacro{\glossaryentryfield}]
%\cs{glossaryentryfield}\marg{label}\marg{formatted
%name}\marg{description}\marg{symbol}
%\marg{number list}
%\end{definition}
%This macro indicates what to do for a given glossary entry.
%Note that \meta{formatted name} will always be in the form
%\cs{glsnamefont}\marg{name}. This allows the user to set a given
%font for the entry name, regardless of the glossary style used.
%Note that \meta{label} is the label used when the glossary entry
%was defined via either \cs{newglossaryentry} or \cs{newacronym}. 
%
%Each time you use a glossary entry it creates a hyperlink (if
%hyperlinks are enabled) to the relevant line in the glossary.
%Your new glossary style must therefore redefine
%\cs{glossaryentryfield} to set the appropriate target. This
%is done using
%\begin{definition}[\DescribeMacro{\glstarget}]
%\cs{glstarget}\marg{label}\marg{text}
%\end{definition}
%where \meta{label} is the entry's label. Note that you
%don't need to worry about whether the \sty{hyperref} package has
%been loaded, as \cs{glstarget} won't create a target if
%\cs{hypertarget} hasn't been defined.
%
%For example, the 
%\glostyle{list} style defines \cs{glossaryentryfield} as follows:
%\begin{verbatim}
%\renewcommand*{\glossaryentryfield}[5]{%
%\item[\glstarget{##1}{##2}] ##3\glspostdescription\space ##5}
%\end{verbatim}
%
%Note also that \meta{number list} will always be of the form\\[10pt]
%\cs{glossaryentrynumbers}\{\cs{relax}\\
%\cs{setentrycounter}\marg{counter name}\cs{glsnumberformat}\marg{number(s)}\}\\[10pt]
%where \meta{number(s)}
%may contain \cs{delimN} (to delimit individual numbers) and/or
%\cs{delimR} (to indicate a range of numbers). There may be 
%multiple occurrences of 
%\cs{setentrycounter}\marg{counter name}\cs{glsnumberformat}\marg{number(s)}, but note
%that the entire number list is enclosed within the argument
%to \ics{glossaryentrynumbers}. The user can redefine this to change
%the way the entire number list is formatted, regardless of 
%the glossary style. However the most common use of
%\cs{glossaryentrynumbers} is to provide a means of suppressing the
%number list altogether. (In fact, the \pkgopt{nonumberlist} option 
%redefines \cs{glossaryentrynumbers} to ignore its argument.)
%Therefore, when you define a new glossary style, you don't need
%to worry about whether the user has specified the 
%\pkgopt{nonumberlist} package option.
%
%\begin{definition}[\DescribeMacro{\glossarysubentryfield}]
%\cs{glossarysubentryfield}\marg{level}\marg{label}\marg{formatted
%name}\marg{description}\marg{symbol}
%\marg{number list}
%\end{definition}
%This is new to version 1.17, and is used to display sub-entries.
%The first argument, \meta{level}, indicates the sub-entry level.
%This must be an integer from 1 (first sub-level) onwards. The
%remaining arguments are analogous to those for
%\ics{glossaryentryfield} described above.
%
%For further details of these commands, see
%\ifpdf\sectionref{sec:code:printglos}\else the documented code in
%\texttt{glossaries.pdf}\fi. 
%
%\subsubsection{Example: creating a completely new style}
%
%If you want a completely new style, you will need to redefine all
%of the commands and the environment listed above. 
%
%For example, suppose you want each entry to start with a bullet point.
%This means that the glossary should be placed in the \env{itemize}
%environment, so \env{theglossary} should start and end that
%environment. Let's also suppose that you don't want anything between
%the glossary groups (so \ics{glsgroupheading} and \ics{glsgroupskip}
%should do nothing) and suppose you don't want anything to appear
%immediately after \verb|\begin{theglossary}| (so \ics{glossaryheader}
%should do nothing). In addition, let's suppose the symbol should
%appear in brackets after the name, followed by the description and
%last of all the \term{number list} should appear within square brackets
%at the end. Then you can create this new glossary style, called, say,
%\texttt{mylist}, as follows:
%\begin{verbatim}
% \newglossarystyle{mylist}{%
% % put the glossary in the itemize environment:
% \renewenvironment{theglossary}{\begin{itemize}}{\end{itemize}}%
% % have nothing after \begin{theglossary}:
% \renewcommand*{\glossaryheader}{}%
% % have nothing between glossary groups:
% \renewcommand*{\glsgroupheading}[1]{}%
% \renewcommand*{\glsgroupskip}{}%
% % set how each entry should appear:
% \renewcommand*{\glossaryentryfield}[5]{%
% \item % bullet point
% \glstarget{##1}{##2}% the entry name
% \space (##4)% the symbol in brackets
% \space ##3% the description
% \space [##5]% the number list in square brackets
% }%
% % set how sub-entries appear:
% \renewcommand*{\glossarysubentryfield}[6]{%
%   \glossaryentryfield{##2}{##3}{##4}{##5}{##6}}%
% }
%\end{verbatim}
%Note that this style creates a flat glossary, where sub-entries
%are displayed in exactly the same way as the top level entries.
%
%
%\subsubsection{Example: creating a new glossary style based on an
%existing style}
%
%\changes{1.11}{2008 March 1}{Fixed error in manual (glossary style
%is set using \cs{glossarystyle} not \cs{setglossarystyle})}%
%If you want to define a new style that is a slightly modified
%version of an existing style, you can use \cs{glossarystyle}
%within the second argument of \cs{newglossarystyle} followed by
%whatever alterations you require. For example, suppose you want 
%a style like the \glostyle{list} style but you don't want the extra
%vertical space created by \cs{indexspace} between groups, then you
%can create a new glossary style called, say, \texttt{mylist} as
%follows:
%\begin{verbatim}
%\newglossarystyle{mylist}{%
%\glossarystyle{list}% base this style on the list style
%\renewcommand{\glsgroupskip}{}% make nothing happen between groups
%}
%\end{verbatim} 
%
%
%\subsubsection{Example: creating a glossary style that uses the
%\gloskey{user1}, \ldots, \gloskey{user6} keys}
%
%Since \ics{glossaryentryfield} and \ics{glossarysubentryfield}
%provide the label for the entry, it's also possible to access
%the values of the generic user keys, such as \gloskey{user1}. For
%example, suppose each entry not only has an associated symbol,
%but also units (stored in \gloskey{user1}) and dimension
%(stored in \gloskey{user2}). Then you can define a glossary style
%that displays each entry in a \env{longtable} as follows:
%\begin{verbatim}
%\newglossarystyle{long6col}{%
% % put the glossary in a longtable environment:
% \renewenvironment{theglossary}%
%  {\begin{longtable}{lp{\glsdescwidth}cccp{\glspagelistwidth}}}%
%  {\end{longtable}}%
% % Set the table's header:
% \renewcommand*{\glossaryheader}{%
%  \bfseries Term & \bfseries Description & \bfseries Symbol &
%  \bfseries Units & \bfseries Dimensions & \bfseries Page List
%  \\\endhead}%
% % No heading between groups:
%  \renewcommand*{\glsgroupheading}[1]{}%
% % Main (level 0) entries displayed in a row:
%  \renewcommand*{\glossaryentryfield}[5]{%
%    \glstarget{##1}{##2}% Name
%    & ##3% Description
%    & ##4% Symbol
%    & \glsentryuseri{##1}% Units
%    & \glsentryuserii{##1}% Dimensions
%    & ##5% Page list
%    \\% end of row
%  }%
% % Sub entries treated the same as level 0 entries:
% \renewcommand*{\glossarysubentryfield}[6]{%
%  \glossaryentryfield{##2}{##3}{##4}{##5}{##6}}%
% % Nothing between groups:
% \renewcommand*{\glsgroupskip}{}%
%}
%\end{verbatim}
%
%
%\subsection{Accessibility Support}\label{sec:accsupp}
%Limited accessibility support is provided by the accompanying
%\sty{glossaries-accsupp} package, but note that this package is
%experimental and it requires the \sty{accsupp} package 
%which is also listed as experimental. This package defines
%additional keys that may be used when defining glossary entries.
%The keys are as follows:
%\begin{description}
%\item[{\gloskey{access}}] The replacement text corresponding to
%the \gloskey{name} key.
%
%\item[{\gloskey{textaccess}}] The replacement text corresponding
%to the \gloskey{text} key.
%
%\item[{\gloskey{firstaccess}}] The replacement text corresponding
%to the \gloskey{first} key.
%
%\item[{\gloskey{pluralaccess}}] The replacement text corresponding
%to the \gloskey{plural} key.
%
%\item[{\gloskey{firstpluralaccess}}] The replacement text corresponding
%to the \gloskey{firstplural} key.
%
%\item[{\gloskey{symbolaccess}}] The replacement text corresponding
%to the \gloskey{symbol} key.
%
%\item[{\gloskey{symbolpluralaccess}}] The replacement text corresponding
%to the \gloskey{symbolplural} key.
%
%\item[{\gloskey{descriptionaccess}}] The replacement text corresponding
%to the \gloskey{description} key.
%
%\item[{\gloskey{descriptionpluralaccess}}] The replacement text corresponding
%to the \gloskey{descriptionplural} key.
%
%\end{description}
%
%For example:
%\begin{verbatim}
%\newglossaryentry{tex}{name={\TeX},description={Document preparation
%language},access={TeX}}
%\end{verbatim}
%Now \verb|\gls{tex}| will be equivalent to
%\begin{verbatim}
%\BeginAccSupp{ActualText=TeX}\TeX\EndAccSupp{}
%\end{verbatim}
%See \ifpdf \sectionref{sec:code:accsupp} \else the section
%\qt{glossaries-accsupp code} in the document \texttt{glossaries.pdf}
%\fi for further details. It is recommended that you also read the
%\sty{accsupp} documentation. 
%
%\section{Mfirstuc Package}
%\label{sec:mfirstuc}
%
%The \styfmt{glossaries} bundle is supplied with the package 
%\sty{mfirstuc} which provides the command:
%\begin{definition}[\DescribeMacro{\makefirstuc}]
%\cs{makefirstuc}\marg{stuff}
%\end{definition}
%which makes the first object of
%\meta{stuff} uppercase unless \meta{stuff} starts with a control
%sequence followed by a non-empty group, in which case the first
%object in the group is converted to uppercase. Examples:
%\begin{itemize}
%\item \verb|\makefirstuc{abc}| produces Abc
%
%\item \verb|\makefirstuc{\emph{abc}}| produces \emph{Abc} 
%(\ics{MakeUppercase} has been applied to the letter \qt{a} rather
%than \cs{emph}.) Note however that 
%\verb|\makefirstuc{{\em abc}}| produces \emph{ABC} and 
%\verb|{\makefirstuc{\em abc}}| produces abc.
%
%\item \verb|\makefirstuc{{\'a}bc}| produces \MakeUppercase{\'a}bc
%
%\item \verb|\makefirstuc{\ae bc}| produces \MakeUppercase{\ae}bc
%
%\item \verb|\makefirstuc{{\ae}bc}| produces \MakeUppercase{\ae}bc
%
%\item \verb|\makefirstuc{{ä}bc}| produces \MakeUppercase{ä}bc
%
%\end{itemize}
%Note that non-Latin or accented characters appearing at the
%start of the text must be placed in a group (even if you are
%using the \sty{inputenc} package) due to expansion issues.
%
%\begin{important}
%In version 1.02 of \styfmt{mfirstuc}, a bug fix resulted in a change
%in output if the first object is a control sequence followed by
%an empty group. Prior to version 1.02, \verb|\makefirstuc{\ae{}bc}|
%produced \ae Bc. However as from version 1.02, it now produces
%\AE bc.
%\end{important}
%
%Note also that
%\begin{verbatim}
%\newcommand{\abc}{abc}
%\makefirstuc{\abc}
%\end{verbatim}
%produces: ABC. This is because the first object in the argument of
%\cs{makefirstuc} is \cs{abc}, so it does \verb|\MakeUppercase\abc|.
%Whereas:
%\begin{verbatim}
%\newcommand{\abc}{abc}
%\expandafter\makefirstuc\expandafter{\abc}
%\end{verbatim}
%produces: Abc. There is a short cut command which will do this:\\[10pt]
%\begin{definition}[\DescribeMacro{\xmakefirstuc}]
%\cs{xmakefirstuc}\marg{stuff}
%\end{definition}
%This is equivalent to \cs{expandafter}\cs{makefirstuc}\cs{expandafter}\marg{stuff}. So
%\begin{verbatim}
%\newcommand{\abc}{abc}
%\xmakefirstuc{\abc}
%\end{verbatim}
%produces: Abc.
%
%If you want to use an alternative command to convert to uppercase,
%for example \cs{MakeTextUppercase},\footnote{defined in the 
%\styfmt{textcase} package} you can redefine the internal
%command \cs{@gls@makefirstuc}. For example:
%\begin{verbatim}
%\renewcommand{\@gls@makefirstuc}[1]{\MakeTextUppercase #1}
%\end{verbatim}
%(Remember that command names that contain the @ character must
%either be placed in packages or be placed between \cs{makeatletter} 
%and \cs{makeatother}.)
%
%
%
%\StopEventually{%
%  \clearpage\phantomsection
%  \addcontentsline{toc}{section}{Index}\PrintIndex
%  
%}
%
%
%
%\section{Glossaries Documented Code}
%\iffalse
%    \begin{macrocode}
%<*glossaries.sty>
%    \end{macrocode}
%\fi
%\label{sec:code}
% \subsection{Package Definition}
% This package requires \LaTeXe.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{glossaries}[2010/07/10 v2.07 (NLCT)]
%    \end{macrocode}
% Required packages:
%    \begin{macrocode}
\RequirePackage{ifthen}
\RequirePackage{xkeyval}[2006/11/18]
\RequirePackage{mfirstuc}
\RequirePackage{xfor}
%    \end{macrocode}
%\changes{1.1}{2008 Feb 22}{amsgen now loaded (\cs{new@ifnextchar} needed)}
% Need to use \cs{new@ifnextchar} instead of \cs{@ifnextchar} in 
% commands that have a final optional argument (such as \ics{gls})
% so require \isty{amsgen}.
% Thanks to Morten~H\o gholm for suggesting this. (This has
% replaced using the \sty{xspace} package.)
%    \begin{macrocode}
\RequirePackage{amsgen}
%    \end{macrocode}
%
% \subsection{Package Options}\label{sec:pkgopt}
%\begin{option}{toc}
% The \pkgopt{toc} package option will add the glossaries 
% to the table of contents. This is a boolean key, if the
% value is omitted it is taken to be true.
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{toc}[true]{}
%    \end{macrocode}
%\end{option}
%\begin{option}{numberline}
%\changes{1.1}{2008 Feb 22}{numberline option added}
% The \pkgopt{numberline} package option adds \cs{numberline} to
% \cs{addcontentsline}. Note that this option only has an effect
% if used in with \pkgopt[true]{toc}.
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{numberline}[true]{}
%    \end{macrocode}
%\end{option}
%
% The sectional unit used to start the glossary is stored in
% \cs{@@glossarysec}. If chapters are defined, this
% is initialised to \texttt{chapter}, otherwise it is
% initialised to \texttt{section}.
%\begin{macro}{\@@glossarysec}
%    \begin{macrocode}
\@ifundefined{chapter}{\newcommand*{\@@glossarysec}{section}}{%
  \newcommand*{\@@glossarysec}{chapter}}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{section}
% The \pkgopt{section} key can be used to set the sectional unit.
% If no unit is specified, use \texttt{section} as the default.
% The starred form of the named sectional unit will be used.
% If you want some other way to start the glossary section (e.g.\ 
% a numbered section) you will have to redefined 
% \ics{glossarysection}.
%    \begin{macrocode}
\define@choicekey{glossaries.sty}{section}{part,chapter,section,%
subsection,subsubsection,paragraph,subparagraph}[section]{%
  \renewcommand*{\@@glossarysec}{#1}}
%    \end{macrocode}
%\end{option}
%
% Determine whether or not to use numbered sections.
%\begin{macro}{\@@glossarysecstar}
%    \begin{macrocode}
\newcommand*{\@@glossarysecstar}{*}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@@glossaryseclabel}
%    \begin{macrocode}
\newcommand*{\@@glossaryseclabel}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsautoprefix}
% Prefix to add before label if automatically generated:
%\changes{1.14}{2008 June 17}{new}
%    \begin{macrocode}
\newcommand*{\glsautoprefix}{}
%    \end{macrocode}
%\end{macro}
%\begin{option}{numberedsection}
%\changes{1.1}{2008 Feb 22}{numberedsection package option added}
%    \begin{macrocode}
\define@choicekey{glossaries.sty}{numberedsection}[\val\nr]{%
false,nolabel,autolabel}[nolabel]{%
  \ifcase\nr\relax
    \renewcommand*{\@@glossarysecstar}{*}%
    \renewcommand*{\@@glossaryseclabel}{}%
  \or
    \renewcommand*{\@@glossarysecstar}{}%
    \renewcommand*{\@@glossaryseclabel}{}%
  \or
    \renewcommand*{\@@glossarysecstar}{}%
    \renewcommand*{\@@glossaryseclabel}{%
      \label{\glsautoprefix\@glo@type}}%
  \fi
}
%    \end{macrocode}
%\end{option}
%
% The default glossary style is stored in 
% \cs{@glossary@default@style}. This is initialised to
% \texttt{list}. (The \glostyle{list} style is
% defined in the accompanying \isty{glossary-list} package
% described in \autoref{sec:code:styles}.)
%\begin{macro}{\@glossary@default@style}
%    \begin{macrocode}
\newcommand*{\@glossary@default@style}{list}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{style}
% The default glossary style can be changed using the \pkgopt{style}
% package option. The value can be the name of any
% defined glossary style. The glossary style is set at the beginning
% of the document, so you can still use the \pkgopt{style} key to
% set a style that is defined in another package. This package comes
% with some predefined styles that are defined in 
% \autoref{sec:code:styles}.
%    \begin{macrocode}
\define@key{glossaries.sty}{style}{%
\renewcommand*{\@glossary@default@style}{#1}}
%    \end{macrocode}
%\end{option}
%
% Each entry within a given glossary will have an associated
% number list. By default, this refers to the page numbers on
% which that entry has been used, but it can also refer to any counter
% used in the document (such as the section or equation counters).
% The default number list format displays the number list ``as is'':
%\begin{macro}{\glossaryentrynumbers}
%    \begin{macrocode}
\newcommand*{\glossaryentrynumbers}[1]{#1}
%    \end{macrocode}
%\end{macro}
%\begin{option}{nonumberlist}
% Note that the entire number list for a given entry will be
% passed to \cs{glossaryentrynumbers} so any font changes
% will also be applied to the delimiters.
% The \pkgopt{nonumberlist} package option suppresses the 
% number lists (this simply redefines 
% \cs{glossaryentrynumbers} to ignores its argument).
%    \begin{macrocode}
\DeclareOptionX{nonumberlist}{%
\renewcommand*{\glossaryentrynumbers}[1]{}}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@gls@loadlong}
%\changes{1.18}{2009 January 14}{new}
%    \begin{macrocode}
\newcommand*{\@gls@loadlong}{\RequirePackage{glossary-long}}
%    \end{macrocode}
%\end{macro}
%\begin{option}{nolong}
%\changes{1.18}{2009 January 14}{new}
% This option prevents \isty{glossary-long} from being loaded.
% This means that the glossary styles that use the 
% \env{longtable} environment will not be available. This option
% is provided to reduce overhead caused by loading unrequired
% packages.
%    \begin{macrocode}
\DeclareOptionX{nolong}{\renewcommand*{\@gls@loadlong}{}}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@gls@loadsuper}
%\changes{1.18}{2009 January 14}{new}
% The \isty{glossary-super} package isn't loaded if
% \isty{supertabular} isn't installed.
%    \begin{macrocode}
\IfFileExists{supertabular.sty}{%
  \newcommand*{\@gls@loadsuper}{\RequirePackage{glossary-super}}}{%
  \newcommand*{\@gls@loadsuper}{}}
%    \end{macrocode}
%\end{macro}
%\begin{option}{nosuper}
%\changes{1.18}{2009 January 14}{new}
% This option prevents \isty{glossary-super} from being loaded.
% This means that the glossary styles that use the 
% \env{supertabular} environment will not be available. This option
% is provided to reduce overhead caused by loading unrequired
% packages.
%    \begin{macrocode}
\DeclareOptionX{nosuper}{\renewcommand*{\@gls@loadsuper}{}}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@gls@loadlist}
%\changes{1.18}{2009 January 14}{new}
%    \begin{macrocode}
\newcommand*{\@gls@loadlist}{\RequirePackage{glossary-list}}
%    \end{macrocode}
%\end{macro}
%\begin{option}{nolist}
%\changes{1.18}{2009 January 14}{new}
% This option prevents \isty{glossary-list} from being loaded
% (to reduce overheads if required). Naturally, the styles defined
% in \isty{glossary-list} will not be available if this option
% is used.
%    \begin{macrocode}
\DeclareOptionX{nolist}{\renewcommand*{\@gls@loadlist}{}}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\@gls@loadtree}
%\changes{1.18}{2009 January 14}{new}
%    \begin{macrocode}
\newcommand*{\@gls@loadtree}{\RequirePackage{glossary-tree}}
%    \end{macrocode}
%\end{macro}
%\begin{option}{notree}
%\changes{1.18}{2009 January 14}{new}
% This option prevents \isty{glossary-tree} from being loaded
% (to reduce overheads if required). Naturally, the styles defined
% in \isty{glossary-tree} will not be available if this option
% is used.
%    \begin{macrocode}
\DeclareOptionX{notree}{\renewcommand*{\@gls@loadtree}{}}
%    \end{macrocode}
%\end{option}
%
%\begin{option}{nostyles}
%\changes{1.18}{2009 January 14}{new}
% Provide an option to suppress all the predefined styles (in the
% event that the user has custom styles that are not dependent
% on the predefined styles).
%    \begin{macrocode}
\DeclareOptionX{nostyles}{%
  \renewcommand*{\@gls@loadlong}{}%
  \renewcommand*{\@gls@loadsuper}{}%
  \renewcommand*{\@gls@loadlist}{}%
  \renewcommand*{\@gls@loadtree}{}%
  \let\@glossary@default@style\relax
}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\glsdefmain}
%\changes{2.01}{2009 May 30}{new}
% Define the main glossary. This will be the first glossary to
% be displayed when using \ics{printglossaries}.
%    \begin{macrocode}
\newcommand*{\glsdefmain}{%
  \newglossary{main}{gls}{glo}{\glossaryname}%
}
%    \end{macrocode}
%\end{macro}
%
% Keep track of the default glossary. This is initialised to
% the main glossary, but can be changed if for some reason
% you want to make a secondary glossary the main glossary. This
% affects any commands that can optionally take a glossary name
% as an argument (or as the value of the 
% \gloskey{type}\igloskey[printglossary]{type} key in 
%a key-value list). This was mainly done so that 
% \ics{loadglsentries} can temporarily change 
% \cs{glsdefaulttype} while it loads a file containing
% new glossary entries (see \autoref{sec:load}).
%\begin{macro}{\glsdefaulttype}
%    \begin{macrocode}
\newcommand*{\glsdefaulttype}{main}
%    \end{macrocode}
%\end{macro}
% Keep track of which glossary the acronyms are in. This is 
% initialised to \cs{glsdefaulttype}, but is changed by
% the \pkgopt{acronym} package option.
%\begin{macro}{\acronymtype}
%    \begin{macrocode}
\newcommand*{\acronymtype}{\glsdefaulttype}
%    \end{macrocode}
%\end{macro}
%
%\changes{2.01}{2009 May 30}{added nomain package option}
% The \pkgopt{nomain} option suppress the creation of the main 
% glossary.
%    \begin{macrocode}
\DeclareOptionX{nomain}{%
   \let\glsdefaulttype\relax
   \renewcommand*{\glsdefmain}{}%
}
%    \end{macrocode}
%
%\begin{option}{acronym}
% The \pkgopt{acronym} option sets an associated conditional 
% which is used in \autoref{sec:acronym} to determine whether
% or not to define a separate glossary for acronyms.
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{acronym}[true]{%
  \DeclareAcronymList{acronym}%
}
%    \end{macrocode}
%\end{option}
%\begin{macro}{\@glsacronymlists}
%\changes{2.04}{2009 November 10}{new}
% Comma-separated list of glossary labels indicating which 
% glossaries contain acronyms. Note that \ics{SetAcronymStyle}
% must be used after adding labels to this macro.
%    \begin{macrocode}
\newcommand*{\@glsacronymlists}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@addtoacronynlists}
%    \begin{macrocode}
\newcommand*{\@addtoacronymlists}[1]{%
  \ifx\@glsacronymlists\@empty
    \protected@xdef\@glsacronymlists{#1}%
  \else
    \protected@xdef\@glsacronymlists{\@glsacronymlists,#1}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\DeclareAcronymList}
%\changes{2.04}{2009 November 10}{new}%
% Identifies the named glossary as a list of acronyms and adds
% to the list. (Doesn't check if the glossary exists, but checks
% if label already in list. Use \ics{SetAcronymStyle} after
% identifying all the acronym lists.)
%    \begin{macrocode}
\newcommand*{\DeclareAcronymList}[1]{%
  \glsIfListOfAcronyms{#1}{}{\@addtoacronymlists{#1}}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsIfListOfAcronyms}
%\cs{glsIfListOfAcronyms}\marg{label}\marg{true part}\marg{false part}\\[10pt]
% Determines if the glossary with the given label has been identified
% as being a list of acronyms.
%    \begin{macrocode}
\newcommand{\glsIfListOfAcronyms}[1]{%
  \edef\@do@gls@islistofacronyms{%
    \noexpand\@gls@islistofacronyms{#1}{\@glsacronymlists}}%
  \@do@gls@islistofacronyms
}
%    \end{macrocode}
% Internal command requires label and list to be expanded:
%    \begin{macrocode}
\newcommand{\@gls@islistofacronyms}[4]{%
  \def\gls@islistofacronyms##1,#1,##2\end@gls@islistofacronyms{%
     \def\@before{##1}\def\@after{##2}}%
  \gls@islistofacronyms,#2,#1,\@nil\end@gls@islistofacronyms
  \ifx\@after\@nnil
%    \end{macrocode}
% Not found
%    \begin{macrocode}
    #4%
  \else
%    \end{macrocode}
% Found
%    \begin{macrocode}
    #3%
  \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\if@glsisacronymlist}
% Convenient boolean.
%    \begin{macrocode}
\newif\if@glsisacronymlist
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\gls@checkisacronymlist}
% Sets the above boolean if argument is a label representing 
% a list of acronyms.
%    \begin{macrocode}
\newcommand*{\gls@checkisacronymlist}[1]{%
   \glsIfListOfAcronyms{#1}%
     {\@glsisacronymlisttrue}{\@glsisacronymlistfalse}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\SetAcronymLists}
%\changes{2.04}{2009 November 10}{new}%
% Sets the ``list of acronyms'' list. Argument must be a
% comma-separated list of glossary labels. (Doesn't check at this
% point if the glossaries exists.)
%    \begin{macrocode}
\newcommand*{\SetAcronymLists}[1]{%
  \renewcommand*{\@glsacronymlists}{#1}%
}
%    \end{macrocode}
%\end{macro}
%\begin{option}{acronymlists}
%\changes{2.04}{2009 November 10}{new}%
%    \begin{macrocode}
\define@key{glossaries.sty}{acronymlists}{%
  \@addtoacronymlists{#1}%
}
%    \end{macrocode}
%\end{option}
%
% The default counter associated with the numbers in the glossary
% is stored in \cs{glscounter}. This is initialised to the 
% page counter. This is used as the default counter when a
% new glossary is defined, unless a different counter is specified
% in the optional argument to \ics{newglossary} (see
% \autoref{sec:newglos}).
%\begin{macro}{\glscounter}
%    \begin{macrocode}
\newcommand{\glscounter}{page}
%    \end{macrocode}
%\end{macro}
%\begin{option}{counter}
% The \pkgopt{counter} option changes the default counter. (This
% just redefines \cs{glscounter}.)
%    \begin{macrocode}
\define@key{glossaries.sty}{counter}{%
  \renewcommand*{\glscounter}{#1}%
}
%    \end{macrocode}
%\end{option}
%
% The glossary keys whose values are written to another file (i.e.\
% \gloskey{sort}, \gloskey{name}, \gloskey{description} and
% \gloskey{symbol}) need to be sanitized, otherwise fragile
% commands would not be able to be used in 
% \ics{newglossaryentry}. However, strange results will occur
% if you then use those fields in the document. As these fields
% are not normally used in the document, but are by default only
% used in the glossary, the default is to sanitize them. If however
% you want to use these values in the document (either by redefining
% commands like \ics{glsdisplay} or by using commands like
% \ics{glsentrydesc}) you will have to switch off the 
% sanitization using the \pkgopt{sanitize} package option, but
% you will then have to use \ics{protect} to protect fragile 
% commands when defining new glossary entries. 
% The \pkgopt{sanitize} option
% takes a key-value list as its value, which can be used to 
% switch individual values on and off. For example:
%\begin{verbatim}
%\usepackage[sanitize={description,name,symbol=false}]{glossaries}
%\end{verbatim}
%will switch off the sanitization for the \gloskey{symbol} key, but
% switch it on for the \gloskey{description} and \gloskey{name} keys.
% This would mean that you can use fragile commands in the
%description and name when defining a new glossary entry, but not
% for the symbol.
%
% The default values are defined as:
%\begin{macro}{\@gls@sanitizedesc}
%    \begin{macrocode}
\newcommand*{\@gls@sanitizedesc}{\@onelevel@sanitize\@glo@desc}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@sanitizename}
%    \begin{macrocode}
\newcommand*{\@gls@sanitizename}{\@onelevel@sanitize\@glo@name}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@sanitizesymbol}
%    \begin{macrocode}
\newcommand*{\@gls@sanitizesymbol}{\@onelevel@sanitize\@glo@symbol}
%    \end{macrocode}
%\end{macro}
% (There is no equivalent for the \gloskey{sort} key, since that
% is only provided for the benefit of \app{makeindex} or
% \app{xindy}, and so will always be sanitized.)
%
% Before defining the \pkgopt{sanitize} package option, The 
% key-value list for the \pkgopt{sanitize} value needs to be defined.
% These are all boolean keys. If they are not given a value, assume
% \texttt{true}.
%
% Firstly the \gloskey{description}. If set, it will redefine
% \cs{@gls@sanitizedesc} to use \cs{@onelevel@sanitize},
% otherwise \cs{@gls@sanitizedesc} will do nothing.
%    \begin{macrocode}
\define@boolkey[gls]{sanitize}{description}[true]{%
\ifgls@sanitize@description
  \renewcommand*{\@gls@sanitizedesc}{\@onelevel@sanitize\@glo@desc}%
\else
  \renewcommand*{\@gls@sanitizedesc}{}%
\fi
}
%    \end{macrocode}
% Similarly for the \gloskey{name} key:
%    \begin{macrocode}
\define@boolkey[gls]{sanitize}{name}[true]{%
\ifgls@sanitize@name
  \renewcommand*{\@gls@sanitizename}{\@onelevel@sanitize\@glo@name}%
\else
  \renewcommand*{\@gls@sanitizename}{}%
\fi}
%    \end{macrocode}
% and for the \gloskey{symbol} key:
%    \begin{macrocode}
\define@boolkey[gls]{sanitize}{symbol}[true]{%
\ifgls@sanitize@symbol
  \renewcommand*{\@gls@sanitizesymbol}{%
\@onelevel@sanitize\@glo@symbol}%
\else
  \renewcommand*{\@gls@sanitizesymbol}{}%
\fi}
%    \end{macrocode}
%
%\begin{option}{sanitize}
% Now define the \pkgopt{sanitize} option. It can either take
% a key-val list as its value, or it can take the keyword
% \texttt{none}, which is equivalent to \texttt{description=false,
% symbol=false, name=false}:
%    \begin{macrocode}
\define@key{glossaries.sty}{sanitize}[description=true,symbol=true,
name=true]{%
\ifthenelse{\equal{#1}{none}}{%
\renewcommand*{\@gls@sanitizedesc}{}%
\renewcommand*{\@gls@sanitizename}{}%
\renewcommand*{\@gls@sanitizesymbol}{}%
}{\setkeys[gls]{sanitize}{#1}}%
}
%    \end{macrocode}
%\end{option}
%\begin{option}{translate}
%\changes{1.1}{2008 Feb 22}{translate option added}
% Define \pkgopt{translate} option. If false don't set up
% multi-lingual support.
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{translate}[true]{}
%    \end{macrocode}
%\end{option}
% Set the default value:
%    \begin{macrocode}
\glstranslatefalse
\@ifpackageloaded{translator}{\glstranslatetrue}{%
\@ifpackageloaded{babel}{\glstranslatetrue}{%
\@ifpackageloaded{polyglossia}{\glstranslatetrue}{}}}
%    \end{macrocode}
%
%\begin{option}{hyperfirst}
%\changes{2.03}{2009 Sep 23}{new}
% Set whether or not terms should have a hyperlink on first use.
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[gls]{hyperfirst}[true]{}
\glshyperfirsttrue
%    \end{macrocode}
%\end{option}
%
%\begin{option}{footnote}
% Set the long form of the acronym in footnote on first use.
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[glsacr]{footnote}[true]{%
\ifthenelse{\boolean{glsacrdescription}}{}%
{\renewcommand*{\@gls@sanitizedesc}{}}%
}
%    \end{macrocode}
%\end{option}
%\begin{option}{description}
% Allow acronyms to have a description (needs to be set using
% the \gloskey{description} key in the optional argument of
% \ics{newacronym}).
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[glsacr]{description}[true]{%
  \renewcommand*{\@gls@sanitizesymbol}{}%
}
%    \end{macrocode}
%\end{option}
%\begin{option}{smallcaps}
% Define \ics{newacronym} to set the short form in small capitals.
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[glsacr]{smallcaps}[true]{%
  \renewcommand*{\@gls@sanitizesymbol}{}%
}
%    \end{macrocode}
%\end{option}
%\begin{option}{smaller}
% Define \ics{newacronym} to set the short form using \cs{smaller}
% which obviously needs to be defined by loading the appropriate
% package.
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[glsacr]{smaller}[true]{%
  \renewcommand*{\@gls@sanitizesymbol}{}%
}
%    \end{macrocode}
%\end{option}
%\begin{option}{dua}
% Define \ics{newacronym} to always use the long forms 
% (i.e.\ don't use acronyms)
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[glsacr]{dua}[true]{%
  \renewcommand*{\@gls@sanitizesymbol}{}%
}
%    \end{macrocode}
%\end{option}
%\begin{option}{shotcuts}
% Define acronym shortcuts.
%    \begin{macrocode}
\define@boolkey{glossaries.sty}[glsacr]{shortcuts}[true]{}
%    \end{macrocode}
%\end{option}
%
%\begin{macro}{\glsorder}
% Stores the glossary ordering. This may either be \qt{word}
% or \qt{letter}. This passes the relevant information to
% \app{makeglossaries}. The default is word ordering.
%    \begin{macrocode}
\newcommand*{\glsorder}{word}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glsorder}
% The ordering information is written to the auxiliary file
% for \app{makeglossaries}, so ignore the auxiliary 
% information.
%    \begin{macrocode}
\newcommand*{\@glsorder}[1]{}
%    \end{macrocode}
%\end{macro}
%
%\begin{option}{order}
%\changes{1.17}{2008 December 26}{order package option added}
%    \begin{macrocode}
\define@choicekey{glossaries.sty}{order}{word,letter}{%
  \def\glsorder{#1}}
%    \end{macrocode}
%\end{option}
%
%\changes{1.17}{2008 December 26}{added xindy support}
%\begin{macro}{\ifglsxindy}
%\changes{1.17}{2008 December 26}{new}
% Provide boolean to determine whether \app{xindy} or
% \app{makeindex} will be used to sort the glossaries.
%    \begin{macrocode}
\newif\ifglsxindy
%    \end{macrocode}
%\end{macro}
% The default is \app{makeindex}:
%    \begin{macrocode}
\glsxindyfalse
%    \end{macrocode}
%
% Define package option to specify that \app{makeindex} will 
% be used to sort the glossaries:
%    \begin{macrocode}
\DeclareOptionX{makeindex}{\glsxindyfalse}
%    \end{macrocode}
%
% The \pkgopt{xindy} package option may have a value which in
% turn can be a key=value list. First define the keys for this
% sub-list. The boolean "glsnumbers" determines whether to
% automatically add the \texttt{glsnumbers} letter group.
%    \begin{macrocode}
\define@boolkey[gls]{xindy}{glsnumbers}[true]{}
\gls@xindy@glsnumberstrue
%    \end{macrocode}
%
%\begin{macro}{\@xdy@main@language}
% Define what language to use for each glossary type (if a
% language is not defined for a particular glossary type
% the language specified for the main glossary is used.)
%    \begin{macrocode}
\def\@xdy@main@language{\rootlanguagename}%
%    \end{macrocode}
%\end{macro}
% Define key to set the language
%    \begin{macrocode}
\define@key[gls]{xindy}{language}{\def\@xdy@main@language{#1}}
%    \end{macrocode}
%
%\begin{macro}{\gls@codepage}
% Define the code page. If \ics{inputencodingname} is defined
% use that, otherwise have initialise with no codepage.
%    \begin{macrocode}
\@ifundefined{inputencodingname}{%
  \def\gls@codepage{}}{%
  \def\gls@codepage{\inputencodingname}
}
%    \end{macrocode}
% Define a key to set the code page.
%    \begin{macrocode}
\define@key[gls]{xindy}{codepage}{\def\gls@codepage{#1}}
%    \end{macrocode}
%\end{macro}
%
% Define package option to specify that \app{xindy} will be 
% used to sort the glossaries:
%    \begin{macrocode}
\define@key{glossaries.sty}{xindy}[]{%
  \glsxindytrue
  \setkeys[gls]{xindy}{#1}%
}
%    \end{macrocode}
%
%\begin{macro}{\GlossariesWarning}
% Prints a warning message.
%    \begin{macrocode}
\newcommand*{\GlossariesWarning}[1]{%
  \PackageWarning{glossaries}{#1}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\GlossariesWarningNoLine}
% Prints a warning message without the line number.
%    \begin{macrocode}
\newcommand*{\GlossariesWarningNoLine}[1]{%
  \PackageWarningNoLine{glossaries}{#1}%
}
%    \end{macrocode}
%\end{macro}
% Define package option to suppress warnings
%    \begin{macrocode}
\DeclareOptionX{nowarn}{%
  \renewcommand*{\GlossariesWarning}[1]{}%
  \renewcommand*{\GlossariesWarningNoLine}[1]{}%
}
%    \end{macrocode}
%
% Process package options:
%    \begin{macrocode}
\ProcessOptionsX
%    \end{macrocode}
% If \isty{babel} package is loaded, check to see if 
% \isty{translator} is installed, but only if translation is
% required.
%\changes{2.02}{2009 July 13}{translate=false will prevent 
% automatic loading of translator package}
%    \begin{macrocode}
\ifglstranslate
  \@ifpackageloaded{babel}{\IfFileExists{translator.sty}{%
    \RequirePackage{translator}}{}}{}
\fi
%    \end{macrocode}
%
% If chapters are defined and the user has requested the
% section counter as a package option, \cs{@chapter} will
% be modified so 
% that it adds a \texttt{section.}\meta{n}\texttt{.0} target, 
% otherwise entries placed before the first section of a chapter
% will have undefined links.
%
% The same problem will also occur if a lower sectional unit is
% used, but this is less likely to happen. If it does, or if
% you change \cs{glscounter} to "section" later, you
% will have to specify a different counter for the entries
% that give rise to a \texttt{name}"{"\meta{section-level}"."\meta{n}".0}"
% non-existent warning (e.g. "\gls[counter=chapter]{label}").
%    \begin{macrocode}
\ifthenelse{\equal{\glscounter}{section}}{%
\@ifundefined{chapter}{}{%
\let\@gls@old@chapter\@chapter
\def\@chapter[#1]#2{\@gls@old@chapter[{#1}]{#2}%
\@ifundefined{hyperdef}{}{\hyperdef{section}{\thesection}{}}}}}{}
%    \end{macrocode}
%
%\begin{macro}{\@gls@onlypremakeg}
% Some commands only have an effect when used before 
% \ics{makeglossaries}. So define a list of commands that
% should be disabled after \ics{makeglossaries}
%    \begin{macrocode}
\newcommand*{\@gls@onlypremakeg}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@onlypremakeg}
% Adds the specified control sequence to the list of commands that
% must be disabled after \ics{makeglossaries}.
%    \begin{macrocode}
\newcommand*{\@onlypremakeg}[1]{%
\ifx\@gls@onlypremakeg\@empty
   \def\@gls@onlypremakeg{#1}%
\else
   \expandafter\toks@\expandafter{\@gls@onlypremakeg}%
   \edef\@gls@onlypremakeg{\the\toks@,\noexpand#1}%
\fi}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@disable@onlypremakeg}
% Disable all commands listed in \cs{@gls@onlypremakeg}
%    \begin{macrocode}
\newcommand*{\@disable@onlypremakeg}{%
\@for\@thiscs:=\@gls@onlypremakeg\do{%
   \expandafter\@disable@premakecs\@thiscs%
}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@disable@premakecs}
% Disables the given command.
%    \begin{macrocode}
\newcommand*{\@disable@premakecs}[1]{%
  \def#1{\PackageError{glossaries}{\string#1\space may only be
  used before \string\makeglossaries}{You can't use
  \string#1\space after \string\makeglossaries}}%
}
%    \end{macrocode}
%\end{macro}
%
%\subsection{Default values}\label{sec:predefinednames}
% This section sets up default values that are used by this
% package. Some of the names may already be defined (e.g.\ by
% \isty{babel}) so \cs{providecommand} is used.
%
% Main glossary title:
%\begin{macro}{\glossaryname}
%    \begin{macrocode}
\providecommand*{\glossaryname}{Glossary}
%    \end{macrocode}
%\end{macro}
% The title for the "acronym" glossary type (which is defined if 
% \pkgopt{acronym} package option is used) is given by
% \cs{acronymname}. If the \pkgopt{acronym}
% package option is not used, \cs{acronymname} won't be used.
%\begin{macro}{\acronymname}
%    \begin{macrocode}
\providecommand*{\acronymname}{Acronyms}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glssettoctitle}
% Sets the TOC title for the given glossary.
%\changes{1.15}{2008 August 15}{new}
%    \begin{macrocode}
\newcommand*{\glssettoctitle}[1]{%
\def\glossarytoctitle{\csname @glotype@#1@title\endcsname}}
%    \end{macrocode}
%\end{macro}
%
% The following commands provide text for the headers used by 
% some of the tabular-like glossary 
% styles. Whether or not they get used in the glossary depends on
% the glossary style.
%\begin{macro}{\entryname}
%    \begin{macrocode}
\providecommand*{\entryname}{Notation}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\descriptionname}
%    \begin{macrocode}
\providecommand*{\descriptionname}{Description}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\symbolname}
%    \begin{macrocode}
\providecommand*{\symbolname}{Symbol}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\pagelistname}
%    \begin{macrocode}
\providecommand*{\pagelistname}{Page List}
%    \end{macrocode}
%\end{macro}
% Labels for \app{makeindex}'s symbol and number groups:
%\begin{macro}{\glssymbolsgroupname}
%    \begin{macrocode}
\providecommand*{\glssymbolsgroupname}{Symbols}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsnumbersgroupname}
%    \begin{macrocode}
\providecommand*{\glsnumbersgroupname}{Numbers}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glspluralsuffix}
% The default plural is formed by appending \cs{glspluralsuffix} to
% the singular form.
%    \begin{macrocode}
\newcommand*{\glspluralsuffix}{s}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\seename}
%    \begin{macrocode}
\providecommand*{\seename}{see}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\andname}
%    \begin{macrocode}
\providecommand*{\andname}{\&}
%    \end{macrocode}
%\end{macro}
% Add multi-lingual support\changes{1.08}{2007 Oct 13}{Added 
% babel support}. Thanks to everyone who contributed to the
% translations from both comp.text.tex and via email.
%\begin{macro}{\addglossarytocaptions}
% If using \isty{translator}, \ics{glossaryname} should be defined
% in terms of \ics{translate}, but if babel is also loaded, it will
% redefine \cs{glossaryname} whenever the language is set, so 
% override it. (Don't use \ics{addto} as \isty{polyglossia} doesn't
% define it.)
%    \begin{macrocode}
\newcommand*{\addglossarytocaptions}[1]{%
  \@ifundefined{captions#1}{}{%
    \expandafter\let\expandafter\@gls@tmp\csname captions#1\endcsname
    \expandafter\toks@\expandafter{\@gls@tmp
      \renewcommand*{\glossaryname}{\translate{Glossary}}%
    }%
    \expandafter\edef\csname captions#1\endcsname{\the\toks@}%
  }%
}
%    \end{macrocode}
%\end{macro}
%    \begin{macrocode}
\ifglstranslate
%    \end{macrocode}
% If \isty{translator} is not install, used standard 
% \isty{babel} captions, otherwise load \isty{translator}
% dictionary.
%\changes{1.1}{2008 Feb 22}{Added support for translator package}
%\changes{1.15}{2008 August 15}{Added 'glssettoctitle}
%    \begin{macrocode}
  \@ifpackageloaded{translator}{%
    \usedictionary{glossaries-dictionary}%
    \addglossarytocaptions{portuges}%
    \addglossarytocaptions{portuguese}%
    \addglossarytocaptions{brazil}%
    \addglossarytocaptions{brazilian}%
    \addglossarytocaptions{danish}%
    \addglossarytocaptions{dutch}%
    \addglossarytocaptions{afrikaans}%
    \addglossarytocaptions{english}%
    \addglossarytocaptions{UKenglish}%
    \addglossarytocaptions{USenglish}%
    \addglossarytocaptions{american}%
    \addglossarytocaptions{australian}%
    \addglossarytocaptions{british}%
    \addglossarytocaptions{canadian}%
    \addglossarytocaptions{newzealand}%
    \addglossarytocaptions{french}%
    \addglossarytocaptions{frenchb}%
    \addglossarytocaptions{francais}%
    \addglossarytocaptions{acadian}%
    \addglossarytocaptions{canadien}%
    \addglossarytocaptions{german}%
    \addglossarytocaptions{germanb}%
    \addglossarytocaptions{austrian}%
    \addglossarytocaptions{naustrian}%
    \addglossarytocaptions{ngerman}%
    \addglossarytocaptions{irish}%
    \addglossarytocaptions{italian}%
    \addglossarytocaptions{magyar}%
    \addglossarytocaptions{hungarian}%
    \addglossarytocaptions{polish}%
    \addglossarytocaptions{spanish}%
    \renewcommand*{\glssettoctitle}[1]{%
    \ifthenelse{\equal{#1}{main}}{%
      \translatelet{\glossarytoctitle}{Glossary}}{%
      \ifthenelse{\equal{#1}{acronym}}{%
        \translatelet{\glossarytoctitle}{Acronyms}}{%
        \def\glossarytoctitle{\csname @glotype@#1@title\endcsname}}}}%
    \renewcommand*{\glossaryname}{\translate{Glossary}}%
    \renewcommand*{\acronymname}{\translate{Acronyms}}%
    \renewcommand*{\entryname}{\translate{Notation (glossaries)}}%
    \renewcommand*{\descriptionname}{%
      \translate{Description (glossaries)}}%
    \renewcommand*{\symbolname}{\translate{Symbol (glossaries)}}%
    \renewcommand*{\pagelistname}{%
      \translate{Page List (glossaries)}}%
    \renewcommand*{\glssymbolsgroupname}{%
      \translate{Symbols (glossaries)}}%
    \renewcommand*{\glsnumbersgroupname}{%
      \translate{Numbers (glossaries)}}%
  }{%
    \@ifpackageloaded{babel}%
    {\RequirePackage{glossaries-babel}}%
    {%
      \@ifpackageloaded{polyglossia}{%
        \RequirePackage{glossaries-polyglossia}}{}%
    }}
\fi
%    \end{macrocode}
%\begin{macro}{\glspostdescription}
% The description terminator is given by \cs{glspostdescription}
% (except for the 3 and 4 column styles). This is a full stop
% by default:
%    \begin{macrocode}
\newcommand*{\glspostdescription}{.}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\nopostdesc}
% Provide a means to suppress description terminator for a given
% entry. (Useful for entries with no description.) Has no
% effect outside the glossaries.
%\changes{1.17}{2008 December 26}{new}
%    \begin{macrocode}
\newcommand*{\nopostdesc}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@nopostdesc}
% Suppress next description terminator.
%    \begin{macrocode}
\newcommand*{\@nopostdesc}{%
  \let\org@glspostdescription\glspostdescription
  \def\glspostdescription{%
    \let\glspostdescription\org@glspostdescription}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glspar}
% Provide means of having a paragraph break in glossary entries
%    \begin{macrocode}
\newcommand{\glspar}{\par}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\setStyleFile}
% Sets the style file. The relevent extension is appended.
%    \begin{macrocode}
\ifglsxindy
  \newcommand{\setStyleFile}[1]{%
    \renewcommand{\istfilename}{#1.xdy}}
\else
  \newcommand{\setStyleFile}[1]{%
    \renewcommand{\istfilename}{#1.ist}}
\fi
%    \end{macrocode}
% This command only has an effect prior to using
% \ics{makeglossaries}.
%    \begin{macrocode}
\@onlypremakeg\setStyleFile
%    \end{macrocode}
%\end{macro}
%
% The name of the \app{makeindex} or \app{xindy} style file
% is given by \cs{istfilename}. This file is 
% created by \ics{writeist} (which is used by 
% \ics{makeglossaries}) so
% redefining this command will only have an effect if it is 
% done \emph{before} \cs{makeglossaries}. As from v1.17, use
% \ics{setStyleFile} instead of directly redefining \cs{istfilename}.
%\begin{macro}{\istfilename}
%\changes{1.17}{2008 December 26}{added xindy support}
%    \begin{macrocode}
\ifglsxindy
  \def\istfilename{\jobname.xdy}
\else
  \def\istfilename{\jobname.ist}
\fi
%    \end{macrocode}
%\end{macro}
% The \app{makeglossaries} Perl script picks up this name
% from the auxiliary file. If the name ends with \filetype{.xdy}
% it calls \app{xindy} otherwise it calls \app{makeindex}.
% Since its not required by
% \LaTeX, \cs{@istfilename} ignores its argument.
%\begin{macro}{\@istfilename}
%    \begin{macrocode}
\newcommand*{\@istfilename}[1]{}
%    \end{macrocode}
%\end{macro}
%
% This command is the value of the \istkey{page\_compositor}
% \app{makeindex} key. Again, any redefinition of this command 
% must take place \emph{before} \cs{writeist} otherwise it 
% will have no effect. As from 1.17, use \ics{glsSetCompositor}
% instead of directly redefining \cs{glscompositor}.
%\begin{macro}{\glscompositor}
%    \begin{macrocode}
\newcommand*{\glscompositor}{.}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsSetCompositor}
% Sets the compositor.
%    \begin{macrocode}
\newcommand*{\glsSetCompositor}[1]{%
  \renewcommand*{\glscompositor}{#1}}
%    \end{macrocode}
% Only use before \ics{makeglossaries}
%    \begin{macrocode}
\@onlypremakeg\glsSetCompositor
%    \end{macrocode}
%\end{macro}
%
% (The page compositor is usually defined as a dash when using
% \app{makeindex}, but most of the standard counters used
% by \LaTeX\ use a full stop as the compositor, which is why I
% have used it as the default.) If \app{xindy} is used 
% \cs{glscompositor} only affects the \texttt{arabic-page-numbers}
% location class.
%\begin{macro}{\@glsAlphacompositor}
% This is only used by \app{xindy}. It specifies the
% compositor to use when location numbers are in the form
% \meta{letter}\meta{compositor}\meta{number}. For example,
% if \cs{@glsAlphacompositor} is set to ``.'' then it allows
% locations such as A.1 whereas if \cs{@glsAlphacompositor} is
% set to ``-'' then it allows locations such as A-1.
%    \begin{macrocode}
\newcommand*{\@glsAlphacompositor}{\glscompositor}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsSetAlphaCompositor}
% Sets the alpha compositor.
%    \begin{macrocode}
\ifglsxindy
  \newcommand*\glsSetAlphaCompositor[1]{%
     \renewcommand*\@glsAlphacompositor{#1}}
\else
  \newcommand*\glsSetAlphaCompositor[1]{%
    \glsnoxindywarning\glsSetAlphaCompositor}
\fi
%    \end{macrocode}
% Can only be used before \ics{makeglossaries}
%    \begin{macrocode}
\@onlypremakeg\glsSetAlphaCompositor
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@suffixF}
%\changes{1.17}{2008 December 26}{new}
% Suffix to use for a two page list. This overrides the separator
% and the closing page number if set to something other than
% an empty macro.
%    \begin{macrocode}
\newcommand*{\gls@suffixF}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsSetSuffixF}
%\changes{1.17}{2008 December 26}{new}
% Sets the suffix to use for a two page list.
%    \begin{macrocode}
\newcommand*{\glsSetSuffixF}[1]{%
  \renewcommand*{\gls@suffixF}{#1}}
%    \end{macrocode}
% Only has an effect when used before \ics{makeglossaries}
%    \begin{macrocode}
\@onlypremakeg\glsSetSuffixF
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@suffixFF}
%\changes{1.17}{2008 December 26}{new}
% Suffix to use for a three page list. This overrides the separator
% and the closing page number if set to something other than
% an empty macro.
%    \begin{macrocode}
\newcommand*{\gls@suffixFF}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsSetSuffixFF}
%\changes{1.17}{2008 December 26}{new}
% Sets the suffix to use for a three page list.
%    \begin{macrocode}
\newcommand*{\glsSetSuffixFF}[1]{%
  \renewcommand*{\gls@suffixFF}{#1}}
%    \end{macrocode}
%\end{macro}
%
% The command \cs{glsnumberformat} indicates the default
% format for the page numbers in the glossary. (Note that this
% is not the same as \ics{glossaryentrynumbers}, but applies
% to individual numbers or groups of numbers within an entry's
% associated number list.) If hyperlinks are defined, it will use
% \ics{glshypernumber}, otherwise it will simply display its 
% argument ``as is''.
%\begin{macro}{\glsnumberformat}
%    \begin{macrocode}
\@ifundefined{hyperlink}{%
\newcommand*{\glsnumberformat}[1]{#1}}{%
\newcommand*{\glsnumberformat}[1]{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%
% Individual numbers in an entry's associated number list are
% delimited using \cs{delimN} (which corresponds to the 
% \istkey{delim\_n} \app{makeindex} keyword). The default value
% is a comma followed by a space.
%\begin{macro}{\delimN}
%    \begin{macrocode}
\newcommand{\delimN}{, }
%    \end{macrocode}
%\end{macro}
% A range of numbers within an entry's associated number list is
% delimited using \cs{delimR} (which corresponds to the
% \istkey{delim\_r} \app{makeindex} keyword). The default is
% an en-dash.
%\begin{macro}{\delimR}
%    \begin{macrocode}
\newcommand{\delimR}{--}
%    \end{macrocode}
%\end{macro}
%
% The glossary preamble is given by \cs{glossarypreamble}. This
% will appear after the glossary sectioning command, and before the
% \env{theglossary} environment. It is designed to allow the
% user to add information pertaining to the glossary (e.g.\ ``page
% numbers in italic indicate the primary definition'') therefore 
% \cs{glossarypremable} shouldn't be affected by the glossary
% style. (So if you define your own glossary style, don't have it 
% change \cs{glossarypreamble}.) The preamble is empty by
% default. If you have multiple glossaries, and you want a 
% different preamble for each glossary, you will need to use
% \ics{printglossary} for each glossary type, instead of 
% \ics{printglossaries}, and redefine \cs{glossarypreamble}
% before each \ics{printglossary}.
%\begin{macro}{\glossarypreamble}
%    \begin{macrocode}
\newcommand*{\glossarypreamble}{}
%    \end{macrocode}
%\end{macro}
%
% The glossary postamble is given by \cs{glossarypostamble}.
% This is provided to allow the user to
% add something after the end of the \env{theglossary}
% environment (again, this shouldn't be affected by the
% glossary style). It is, of course, possible to simply add the
% text after \ics{printglossary}, but if you only want the
% postamble to appear after the first glossary, but not after 
% subsequent glossaries, you can do something like:
%\begin{verbatim}
%\renewcommand{\glossarypostamble}{For a complete list of terms
%see \cite{blah}\gdef\glossarypreamble{}}
%\end{verbatim}
%\begin{macro}{\glossarypostamble}
%    \begin{macrocode}
\newcommand*{\glossarypostamble}{}
%    \end{macrocode}
%\end{macro}
%
% The sectioning command that starts a glossary is given by
% \cs{glossarysection}. (This does not form part of the
% glossary style, and so should not be changed by a glossary
% style.) If \ics{phantomsection}
% is defined, it uses \cs{\@p@glossarysection}, otherwise it
% uses \cs{@glossarysection}.
%\changes{1.05}{2007 Aug 10}{added '@mkboth to 'glossarysection}
%\changes{2.02}{2009 July 13}{changed '@mkboth to 'glossarymark}
%\begin{macro}{\glossarysection}
%    \begin{macrocode}
\newcommand*{\glossarysection}[2][\@gls@title]{%
  \def\@gls@title{#2}%
  \@ifundefined{phantomsection}{%
  \@glossarysection{#1}{#2}}{\@p@glossarysection{#1}{#2}}%
  \glossarymark{\glossarytoctitle}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glossarymark}
%\changes{2.02}{2009 July 13}{New}
%\changes{2.03}{2009 Sep 23}{Added check to see if it's already 
%defined}
% Sets the header mark for the glossary. Takes the glossary short
% (TOC) title as the argument.
%    \begin{macrocode}
\@ifundefined{glossarymark}{%
  \newcommand{\glossarymark}[1]{\@mkboth{#1}{#1}}
}{%
  \GlossariesWarning{overriding \string\glossarymark}%
  \@ifclassloaded{memoir}%
  {
    \renewcommand{\glossarymark}[1]{%
      \markboth{\memUChead{#1}}{\memUChead{#1}}%
    }
  }
  {
    \renewcommand{\glossarymark}[1]{\@mkboth{#1}{#1}}
  }
}
%    \end{macrocode}
%\end{macro}
%
% The required sectional unit is given by \cs{@@glossarysec}
% which was defined by the \pkgopt{section} package option. The
% starred form of the command is chosen. If you don't want any sectional
% command, you will need to redefine \cs{glossarysection}.
% The sectional unit can be changed, if different sectional units
% are required.
%\begin{macro}{\setglossarysection}
%\changes{1.1}{2008 Feb 22}{new}
%    \begin{macrocode}
\newcommand*{\setglossarysection}[1]{%
\setkeys{glossaries.sty}{section=#1}}
%    \end{macrocode}
%\end{macro}
%
%The command \cs{@glossarysection} indicates how to start
% the glossary section if \ics{phantomsection} is not defined.
%\begin{macro}{\@glossarysection}
%\changes{1.1}{2008 Feb 22}{numbered sections and auto label added}
%    \begin{macrocode}
\newcommand*{\@glossarysection}[2]{%
\ifx\@@glossarysecstar\@empty
  \csname\@@glossarysec\endcsname{#2}%
\else
  \csname\@@glossarysec\endcsname*{#2}%
  \@gls@toc{#1}{\@@glossarysec}%
\fi
\@@glossaryseclabel}
%    \end{macrocode}
%\end{macro}
%
% As \cs{@glossarysection}, but put in 
% \ics{phantomsection}, and swap where \cs{@gls@toc} goes. 
% If using chapters do a \cs{clearpage}. This ensures that
% the hyper link from the table of contents leads to the line above
% the heading, rather than the line below it.
%\begin{macro}{\@p@glossarysection}
%\changes{1.1}{2008 Feb 22}{numbered sections and auto label added}
%    \begin{macrocode}
\newcommand*{\@p@glossarysection}[2]{%
\glsclearpage
\phantomsection
\ifx\@@glossarysecstar\@empty
  \csname\@@glossarysec\endcsname{#2}%
\else
  \@gls@toc{#1}{\@@glossarysec}%
  \csname\@@glossarysec\endcsname*{#2}%
\fi
\@@glossaryseclabel}
%    \end{macrocode}
%\end{macro}
%
%The \cs{gls@doclearpage} command is used to issue a
% \cs{clearpage} (or \cs{cleardoublepage}) depending
% on whether the glossary sectional unit is a chapter. If the
% sectional unit is something else, do nothing.
%\begin{macro}{\gls@doclearpage}
%    \begin{macrocode}
\newcommand*{\gls@doclearpage}{%
\ifthenelse{\equal{\@@glossarysec}{chapter}}{%
\@ifundefined{cleardoublepage}{\clearpage}{\cleardoublepage}}{}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsclearpage}
% This just calls \cs{gls@doclearpage}, but it makes it easier to
% have a user command so that the user can override it.
%\changes{1.19}{2009 Mar 2}{new}
%    \begin{macrocode}
\newcommand*{\glsclearpage}{\gls@doclearpage}
%    \end{macrocode}
%\end{macro}
%
% The glossary is added to the table of contents if glstoc flag set.
% If it is set, \cs{@gls@toc} will add a line to the 
% \filetype{.toc} file, otherwise it will do nothing.
% (The first argument to \cs{@gls@toc} is the title for the
% table of contents, the second argument is the sectioning type.) 
%\begin{macro}{\@gls@toc}
%\changes{1.1}{2008 Feb 22}{numberline added}
%    \begin{macrocode}
\newcommand*{\@gls@toc}[2]{%
\ifglstoc
  \ifglsnumberline
    \addcontentsline{toc}{#2}{\numberline{}#1}%
  \else
    \addcontentsline{toc}{#2}{#1}%
  \fi
\fi}
%    \end{macrocode}
%\end{macro}
%
%\subsection{Xindy}
% This section defines commands that only have an effect if
% \app{xindy} is used to sort the glossaries.
%\begin{macro}{\glsnoxindywarning}
% Issues a warning if \app{xindy} hasn't been specified.
% These warnings can be suppressed by redefining 
% \cs{glsnoxindywarning} to ignore its argument
%    \begin{macrocode}
\newcommand*{\glsnoxindywarning}[1]{%
  \GlossariesWarning{Not in xindy mode --- ignoring \string#1}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@xdyattributes}
% Define list of attributes (\cs{string} is used in case
% the double quote character has been made active)
%    \begin{macrocode}
\ifglsxindy
  \edef\@xdyattributes{\string"default\string"}%
\fi
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@xdylocref}
% Define list of markup location references.
%    \begin{macrocode}
\ifglsxindy
  \def\@xdylocref{}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsAddXdyAttribute}
% Adds an attribute.
%    \begin{macrocode}
\ifglsxindy
  \newcommand*\GlsAddXdyAttribute[1]{%
  \edef\@xdyattributes{\@xdyattributes ^^J \string"#1\string"}%
  \expandafter\toks@\expandafter{\@xdylocref}%
  \edef\@xdylocref{\the\toks@ ^^J%
  (markup-locref
  :open \string"\string~n\string\setentrycounter
    {\noexpand\glscounter}%
    \expandafter\string\csname#1\endcsname
    \expandafter\@gobble\string\{\string" ^^J
  :close \string"\expandafter\@gobble\string\}\string" ^^J
  :attr \string"#1\string")}}
%    \end{macrocode}
% Only has an effect before \ics{writeist}:
%    \begin{macrocode}
  \@onlypremakeg\GlsAddXdyAttribute
\else
  \newcommand*\GlsAddXdyAttribute[1]{%
    \glsnoxindywarning\GlsAddXdyAttribute}
\fi
%    \end{macrocode}
%\end{macro}
% Add known attributes:
%    \begin{macrocode}
\ifglsxindy
  \GlsAddXdyAttribute{glsnumberformat}
  \GlsAddXdyAttribute{textrm}
  \GlsAddXdyAttribute{textsf}
  \GlsAddXdyAttribute{texttt}
  \GlsAddXdyAttribute{textbf}
  \GlsAddXdyAttribute{textmd}
  \GlsAddXdyAttribute{textit}
  \GlsAddXdyAttribute{textup}
  \GlsAddXdyAttribute{textsl}
  \GlsAddXdyAttribute{textsc}
  \GlsAddXdyAttribute{emph}
  \GlsAddXdyAttribute{glshypernumber}
  \GlsAddXdyAttribute{hyperrm}
  \GlsAddXdyAttribute{hypersf}
  \GlsAddXdyAttribute{hypertt}
  \GlsAddXdyAttribute{hyperbf}
  \GlsAddXdyAttribute{hypermd}
  \GlsAddXdyAttribute{hyperit}
  \GlsAddXdyAttribute{hyperup}
  \GlsAddXdyAttribute{hypersl}
  \GlsAddXdyAttribute{hypersc}
  \GlsAddXdyAttribute{hyperemph}
\fi
%    \end{macrocode}
%
%\begin{macro}{\@xdyuseralphabets}
% List of additional alphabets
%    \begin{macrocode}
\def\@xdyuseralphabets{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\GlsAddXdyAlphabet}
% \cs{GlsAddXdyAlphabet}\marg{name}\marg{definition}
% adds a new alphabet called \meta{name}. The definition
% must use \app{xindy} syntax.
%    \begin{macrocode}
\ifglsxindy
  \newcommand*{\GlsAddXdyAlphabet}[2]{%
  \edef\@xdyuseralphabets{%
    \@xdyuseralphabets ^^J
    (define-alphabet "#1" (#2))}}
\else
  \newcommand*{\GlsAddXdyAlphabet}[2]{%
     \glsnoxindywarning\GlsAddXdyAlphabet}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@xdyuserlocationdefs}
% List of additional location definitions
% (separated by "^^J")
%    \begin{macrocode}
\def\@xdyuserlocationdefs{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@xdyuserlocationnames}
% List of additional user location names
%    \begin{macrocode}
\def\@xdyuserlocationnames{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsAddXdyLocation}
% \cs{GlsAddXdyLocation}\marg{name}\marg{definition}
% Define a new location called \meta{name}. The definition
% must use \app{xindy} syntax. (Note that this doesn't
% check to see if the location is already defined. That is left
% to \app{xindy} to complain about.)
%    \begin{macrocode}
\ifglsxindy
   \newcommand*{\GlsAddXdyLocation}[2]{%
     \edef\@xdyuserlocationdefs{%
        \@xdyuserlocationdefs ^^J%
        (define-location-class \string"#1\string"^^J\space\space
        \space(#2))
     }%
     \edef\@xdyuserlocationnames{%
        \@xdyuserlocationnames^^J\space\space\space
        \string"#1\string"}%
   }
%    \end{macrocode}
% Only has an effect before \ics{writeist}:
%    \begin{macrocode}
  \@onlypremakeg\GlsAddXdyLocation
\else
   \newcommand*{\GlsAddXdyLocation}[2]{%
     \glsnoxindywarning\GlsAddXdyLocation}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@xdylocationclassorder}
% Define location class order
%    \begin{macrocode}
\ifglsxindy
  \edef\@xdylocationclassorder{^^J\space\space\space
    \string"roman-page-numbers\string"^^J\space\space\space
    \string"arabic-page-numbers\string"^^J\space\space\space
    \string"arabic-section-numbers\string"^^J\space\space\space
    \string"alpha-page-numbers\string"^^J\space\space\space 
    \string"Roman-page-numbers\string"^^J\space\space\space
    \string"Alpha-page-numbers\string"^^J\space\space\space
    \string"Appendix-page-numbers\string"
    \@xdyuserlocationnames^^J\space\space\space
    \string"see\string"
   }
\fi
%    \end{macrocode}
%\end{macro}
% Change the location order.
%\begin{macro}{\GlsSetXdyLocationClassOrder}
%    \begin{macrocode}
\ifglsxindy
  \newcommand*\GlsSetXdyLocationClassOrder[1]{%
    \def\@xdylocationclassorder{#1}}
\else
  \newcommand*\GlsSetXdyLocationClassOrder[1]{%
    \glsnoxindywarning\GlsSetXdyLocationClassOrder}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@xdysortrules}
% Define sort rules
%    \begin{macrocode}
\ifglsxindy
  \def\@xdysortrules{}
\fi
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\GlsAddSortRule}
% Add a sort rule
%    \begin{macrocode}
\ifglsxindy
  \newcommand*\GlsAddSortRule[2]{%
    \expandafter\toks@\expandafter{\@xdysortrules}%
    \protected@edef\@xdysortrules{\the\toks@ ^^J
     (sort-rule \string"#1\string" \string"#2\string")}%
  }
\else
  \newcommand*\GlsAddSortRule[2]{%
    \glsnoxindywarning\GlsAddSortRule}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@xdyrequiredstyles}
% Define list of required styles (this should be a comma-separated
% list of \app{xindy} styles)
%    \begin{macrocode}
\ifglsxindy
  \def\@xdyrequiredstyles{tex}
\fi
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\GlsAddXdyStyle}
% Add a \app{xindy} style to the list of required styles
%    \begin{macrocode}
\ifglsxindy
  \newcommand*\GlsAddXdyStyle[1]{%
    \edef\@xdyrequiredstyles{\@xdyrequiredstyles,#1}}%
\else
  \newcommand*\GlsAddXdyStyle[1]{%
    \glsnoxindywarning\GlsAddXdyStyle}
\fi
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\GlsSetXdyStyles}
% Reset the list of required styles
%    \begin{macrocode}
\ifglsxindy
  \newcommand*\GlsSetXdyStyles[1]{%
    \edef\@xdyrequiredstyles{#1}}
\else
  \newcommand*\GlsSetXdyStyles[1]{%
    \glsnoxindywarning\GlsSetXdyStyles}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\findrootlanguage}
% The root language name is required by \app{xindy}. This
% information is for \app{makeglossaries} to pass to
% \app{xindy}. Since \ics{languagename} only stores the
% regional dialect rather than the root language name, some
% trickery is required to determine the root language.
%    \begin{macrocode}
\ifglsxindy
  \@ifpackageloaded{babel}{%
%    \end{macrocode}
% Need to parse \texttt{babel.sty} to determine the root language.
% This code was provided by Enrico~Gregorio.
%    \begin{macrocode}
  \def\findrootlanguage{\begingroup
    \escapechar=-1\relax
%    \end{macrocode}
% normalize \cs{languagename} to category 12 chars
%    \begin{macrocode}
    \edef\languagename{%
      \expandafter\string\csname\languagename\endcsname}%
%    \end{macrocode}
% disable \texttt{babel.sty} useless commands
%    \begin{macrocode}
    \def\NeedsTeXFormat##1[##2]{}%
    \def\ProvidesPackage##1[##2]{}%
    \let\LdfInit\relax
    \def\languageattribute##1##2{}%
%    \end{macrocode}
% change the meaning of \cs{DeclareOption}
%    \begin{macrocode}
    \def\DeclareOption##1##2{%
%    \end{macrocode}
% at \cs{DeclareOption*} we end
%    \begin{macrocode}
      \ifx##1*\expandafter\endinput\else
%    \end{macrocode}
% else we build a string with the first argument
%    \begin{macrocode}
      \edef\testlanguage{\expandafter\string\csname##1\endcsname}%
%    \end{macrocode}
% if \cs{testlanguage} and \cs{languagename} are the same
% we execute the second argument
%    \begin{macrocode}
      \ifx\testlanguage\languagename##2\fi
    \fi}
%    \end{macrocode}
% almost all options of babel are \cs{input}"{"\meta{name}".ldf}"
%    \begin{macrocode}
  \def\input##1{\stripldf##1}%
%    \end{macrocode}
% we put the root language name in \ics{rootlanguagename}
%    \begin{macrocode}
  \def\stripldf##1.ldf{\gdef\rootlanguagename{##1}}%
%    \end{macrocode}
% now input babel.sty, using the primitive \cs{input}
%    \begin{macrocode}
  \@@input babel.sty
  \endgroup}%
  }{%
%    \end{macrocode}
% \isty{babel} hasn't been loaded, so check if \isty{ngerman} has
% been loaded
%    \begin{macrocode}
    \@ifpackageloaded{ngerman}{%
       \def\findrootlanguage{%
         \def\rootlanguagename{german}}%
    }{%
%    \end{macrocode}
% Neither \sty{babel} nor \sty{ngerman} have been loaded, so
% assume the root language is English
%    \begin{macrocode}
       \def\findrootlanguage{%
         \def\rootlanguagename{english}}%
    }%
  }%
\fi
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\rootlanguagename}
% Set default root language to English.
%    \begin{macrocode}
\def\rootlanguagename{english}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@xdylanguage}
% The \app{xindy} language setting is required by 
% \app{makeglossaries}, so provide a command for 
% \app{makeglossaries} to pick up the information
% from the auxiliary file.  This command is not needed by the 
% \sty{glossaries} package, so define it to ignore its arguments.
%    \begin{macrocode}
\def\@xdylanguage#1#2{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsSetXdyLanguage}
% Define a command that allows the user to set the language
% for a given glossary type. The first argument indicates the
% glossary type. If omitted the main glossary is assumed.
%    \begin{macrocode}
\ifglsxindy
  \newcommand*\GlsSetXdyLanguage[2][\glsdefaulttype]{%
  \ifglossaryexists{#1}{%
    \expandafter\def\csname @xdy@#1@language\endcsname{#2}%
  }{%
    \PackageError{glossaries}{Can't set language type for
    glossary type `#1' --- no such glossary}{%
    You have specified a glossary type that doesn't exist}}}
\else
  \newcommand*\GlsSetXdyLanguage[2][]{%
    \glsnoxindywarning\GlsSetXdyLanguage}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@codepage}
% The \app{xindy} codepage setting is required by 
% \app{makeglossaries}, so provide a command for 
% \app{makeglossaries} to pick up the information
% from the auxiliary file.  This command is not needed by the 
% \sty{glossaries} package, so define it to ignore its arguments.
%    \begin{macrocode}
\def\@gls@codepage#1#2{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsSetXdyCodePage}
% Define command to set the code page.
%    \begin{macrocode}
\ifglsxindy
  \newcommand*{\GlsSetXdyCodePage}[1]{%
    \renewcommand*{\gls@codepage}{#1}%
  }
\else
  \newcommand*{\GlsSetXdyCodePage}[1]{%
    \glsnoxindywarning\GlsSetXdyCodePage}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@xdylettergroups}
% Store letter group definitions.
%    \begin{macrocode}
\ifglsxindy
  \ifgls@xindy@glsnumbers
    \def\@xdylettergroups{(define-letter-group
       \string"glsnumbers\string"^^J\space\space\space
       :prefixes (\string"0\string" \string"1\string"
       \string"2\string" \string"3\string" \string"4\string"
       \string"5\string" \string"6\string" \string"7\string"
       \string"8\string" \string"9\string")^^J\space\space\space
       :before \string"\@glsfirstletter\string")}
  \else
    \def\@xdylettergroups{}
  \fi
\fi
%   \end{macrocode}
%\end{macro}
%
%\begin{macro}{\GlsAddLetterGroup}
% Add a new letter group. The first argument is the name
% of the letter group. The second argument is the \app{xindy}
% code specifying prefixes and ordering.
%    \begin{macrocode}
  \newcommand*\GlsAddLetterGroup[2]{%
    \expandafter\toks@\expandafter{\@xdylettergroups}%
    \protected@edef\@xdylettergroups{\the\toks@^^J%
    (define-letter-group \string"#1\string"^^J\space\space\space#2)}%
  }%
%    \end{macrocode}
%\end{macro}
%
%\subsection{Loops and conditionals}
%\begin{macro}{\forallglossaries}
% To iterate through all glossaries (or comma-separated list of
% glossary names given in optional argument) use:\\[10pt]
% \cs{forallglossaries}\oarg{glossary list}\marg{cmd}\marg{code}\\[10pt]
% where \meta{cmd} is
% a control sequence which will be set to the name of the
% glossary in the current iteration.
%\changes{2.01}{2009 May 30}{replaced \cs{ifthenelse} with \cs{ifx}}
%    \begin{macrocode}
\newcommand*{\forallglossaries}[3][\@glo@types]{%
  \@for#2:=#1\do{\ifx#2\@empty\else#3\fi}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\forglsentries}
% To iterate through all entries in a given glossary use:\\[10pt]
%\cs{forglsentries}\oarg{type}\marg{cmd}\marg{code}\\[10pt]
%where \meta{type} is the glossary label and \meta{cmd} is a
% control sequence which will be set to the entry label in the
% current iteration.
%\changes{2.01}{2009 May 30}{replaced \cs{ifthenelse} with \cs{ifx}}
%    \begin{macrocode}
\newcommand*{\forglsentries}[3][\glsdefaulttype]{%
  \edef\@@glo@list{\csname glolist@#1\endcsname}%
  \@for#2:=\@@glo@list\do{\ifx#2\@empty\else#3\fi}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\forallglsentries}
% To iterate through all glossary entries over all glossaries listed
% in the optional argument (the default is all glossaries) use:\\[10pt] 
% \cs{forallglsentries}\oarg{glossary list}\marg{cmd}\marg{code}\\[10pt]
% Within \cs{forallglsentries}, the current glossary type
% is given by \cs{@@this@glo@}.
%    \begin{macrocode}
\newcommand*{\forallglsentries}[3][\@glo@types]{%
\expandafter\forallglossaries\expandafter[#1]{\@@this@glo@}{%
\forglsentries[\@@this@glo@]{#2}{#3}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ifglossaryexists}
% To check to see if a glossary exists use:\\[10pt]
%\cs{ifglossaryexists}\marg{type}\marg{true-text}\marg{false-text}\\[10pt]
%where \meta{type} is the glossary's label.
%    \begin{macrocode}
\newcommand{\ifglossaryexists}[3]{%
  \@ifundefined{@glotype@#1@out}{#3}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ifglsentryexists}
% To check to see if a glossary entry has been defined use:\\[10pt]
% \cs{ifglsentryexists}\marg{label}\marg{true text}\marg{false text}\\[10pt]
%where \meta{label} is the entry's label.
%    \begin{macrocode}
\newcommand{\ifglsentryexists}[3]{%
\@ifundefined{glo@#1@name}{#3}{#2}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\ifglsused}
% To determine if given glossary entry has been 
% used in the document text yet use:\\[10pt]
% \cs{ifglsused}\marg{label}\marg{true text}\marg{false text}\\[10pt]
% where \meta{label} is the entry's label.
% If true it will do \meta{true text}
% otherwise it will do \meta{false text}.
%    \begin{macrocode}
\newcommand*{\ifglsused}[3]{\ifthenelse{\boolean{glo@#1@flag}}{#2}{#3}}
%    \end{macrocode}
%\end{macro}
%The following two commands will cause an error if the given
% condition fails:
%
%\begin{macro}{\glsdoifexists}
%\cs{glsdoifexists}\marg{label}\marg{code}\par
% Generate an error if entry specified by \meta{label} doesn't 
% exists, otherwise do \meta{code}.
%    \begin{macrocode}
\newcommand{\glsdoifexists}[2]{%
  \ifglsentryexists{#1}{#2}{%
    \PackageError{glossaries}{Glossary entry `#1' has not been
    defined}{You need to define a glossary entry before you
    can use it.}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdoifnoexists}
%\cs{glsdoifnoexists}\marg{label}\marg{code}\par
% The opposite: only do second argument if the entry doesn't
% exists. Generate an error message if it exists.
%    \begin{macrocode}
\newcommand{\glsdoifnoexists}[2]{%
  \ifglsentryexists{#1}{%
    \PackageError{glossaries}{Glossary entry `#1' has already
    been defined}{}}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\subsection{Defining new glossaries}\label{sec:newglos}
% A comma-separated list of glossary names is stored
% in \cs{@glo@types}. When a new glossary type
% is created, its identifying name is added to this list.
% This is used by commands that iterate through all glossaries
% (such as \ics{makeglossaries} and \ics{printglossaries}).
%\begin{macro}{\@glo@types}
%    \begin{macrocode}
\newcommand*{\@glo@types}{,}
%    \end{macrocode}
%\end{macro}
%
% A new glossary type is defined using \cs{newglossary}.
% Syntax:\\[10pt]\cs{newglossary}\oarg{log-ext}\marg{name}\marg{in-ext}\marg{out-ext}%
%\marg{title}\oarg{counter}\\[10pt]%
% where \meta{log-ext} is the extension of the \app{makeindex}
% transcript file, \meta{in-ext} is the extension of the glossary 
% input file (read in by \ics{printglossary} and created by
% \app{makeindex}), \meta{out-ext} is the extension of the
% glossary output file which is read in by \app{makeindex} 
% (lines are written to this file by the \ics{glossary} command),
% \meta{title} is the title of the glossary that is used in
% \ics{glossarysection} and
% \meta{counter} is the default counter to be used by entries
% belonging to this glossary. The \app{makeglossaries} Perl
% script reads in the relevant extensions from the auxiliary file,
% and passes the appropriate file names and switches to 
% \app{makeindex}.
%\begin{macro}{\newglossary}
%    \begin{macrocode}
\newcommand*{\newglossary}[5][glg]{%
\ifglossaryexists{#2}{%
  \PackageError{glossaries}{Glossary type `#2' already exists}{%
  You can't define a new glossary called `#2' because it already
  exists}%
}{%
%    \end{macrocode}
% Check if default has been set
%    \begin{macrocode}
  \ifx\glsdefaulttype\relax
    \gdef\glsdefaulttype{#2}%
  \fi
%    \end{macrocode}
% Add this to the list of glossary types:
%    \begin{macrocode}
  \toks@{#2}\edef\@glo@types{\@glo@types\the\toks@,}%
%    \end{macrocode}
% Define a comma-separated list of labels for this glossary type, 
% so that all the entries for this glossary can be reset with a 
% single command. When a new entry is created, its label is added
% to this list.
%    \begin{macrocode}
  \expandafter\gdef\csname glolist@#2\endcsname{,}%
%    \end{macrocode}
% Store details of this new glossary type:
%    \begin{macrocode}
  \expandafter\def\csname @glotype@#2@in\endcsname{#3}%
  \expandafter\def\csname @glotype@#2@out\endcsname{#4}%
  \expandafter\def\csname @glotype@#2@title\endcsname{#5}%
  \protected@write\@auxout{}{\string\@newglossary{#2}{#1}{#3}{#4}}%
%    \end{macrocode}
% How to display this entry in the document text (uses
% \cs{glsdisplay} and \cs{glsdisplayfirst} by
% default). These can be redefined by the user later if required
% (see \ics{defglsdisplay} and \ics{defglsdisplayfirst}). These
% may already have been defined if this has been specified as 
% a list of acronyms.
%\changes{2.04}{2009 November 10}{added check to determine if 
% \cs{gls@\meta{type}@display} and \cs{gls@\meta{type}@displayfirst}
% have been defined.}
%    \begin{macrocode}
  \@ifundefined{gls@#2@display}{%
    \expandafter\gdef\csname gls@#2@display\endcsname{%
      \glsdisplay}}{}%
  \@ifundefined{gls@#2@displayfirst}{%
  \expandafter\gdef\csname gls@#2@displayfirst\endcsname{%
    \glsdisplayfirst}}{}%
%    \end{macrocode}
% Find out if the final optional argument has been specified, and
% use it to set the counter associated with this glossary. (Uses
% \ics{glscounter} if no optional argument is present.)
%    \begin{macrocode}
  \@ifnextchar[{\@gls@setcounter{#2}}%
    {\@gls@setcounter{#2}[\glscounter]}}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\altnewglossary}
%\changes{2.06}{2010 June 14}{new}
%    \begin{macrocode}
\newcommand*{\altnewglossary}[3]{%
  \newglossary[#2-glg]{#1}{#2-gls}{#2-glo}{#3}%
}
%    \end{macrocode}
%\end{macro}
% Only define new glossaries in the preamble:
%    \begin{macrocode}
\@onlypreamble{\newglossary}
%    \end{macrocode}
% Only define new glossaries before \ics{makeglossaries}
%    \begin{macrocode}
\@onlypremakeg\newglossary
%    \end{macrocode}
%\cs{@newglossary} is used to specify the file extensions
% for the \app{makeindex} input, output and transcript files.
% It is written to the auxiliary file by \ics{newglossary}.
% Since it is not used by \LaTeX, \cs{@newglossary} simply
% ignores its arguments.
%\begin{macro}{\@newglossary}
%    \begin{macrocode}
\newcommand*{\@newglossary}[4]{}
%    \end{macrocode}
%\end{macro}
% Store counter to be used for given glossary type (the first
% argument is the glossary label, the second argument is the name 
% of the counter):
%\begin{macro}{\@gls@setcounter}
%    \begin{macrocode}
\def\@gls@setcounter#1[#2]{%
\expandafter\def\csname @glotype@#1@counter\endcsname{#2}%
}
%    \end{macrocode}
%\end{macro}
% Get counter associated with given glossary (the argument is
% the glossary label):
%\begin{macro}{\@gls@getcounter}
%    \begin{macrocode}
\newcommand*{\@gls@getcounter}[1]{%
\csname @glotype@#1@counter\endcsname}
%    \end{macrocode}
%\end{macro}
%
% Define the main glossary. This will be the first glossary to
% be displayed when using \ics{printglossaries}.
%    \begin{macrocode}
\glsdefmain
%    \end{macrocode}
%
%\subsection{Defining new entries}\label{sec:newentry}
% New glossary entries are defined using \cs{newglossaryentry}.
% This command requires a label and a key-value list that defines
% the relevant information for that entry. The definition for these
% keys follows. Note that the \gloskey{name},
% \gloskey{description} and \gloskey{symbol} keys will be
% sanitized later, depending on the value of the package option
% \pkgopt{sanitize} (this means that if some of the keys haven't
% been defined, they can be constructed from the \gloskey{name}
% and \gloskey{description} key before they are sanitized).
%
%
%\begin{key}{name}
%The \gloskey{name} key indicates the name
% of the term being defined. This is how the term will appear in
% the glossary. The \gloskey{name} key is required when defining
% a new glossary entry.
%    \begin{macrocode}
\define@key{glossentry}{name}{%
\def\@glo@name{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{description}
% The \gloskey{description} key is usually only used in
% the glossary, but can be made to appear in the text by redefining
% \ics{glsdisplay} and \ics{glsdisplayfirst} (or
% using \ics{defglsdisplay} and \ics{defglsdisplayfirst}), however,
% you will have to disable the sanitize option (using the 
% \pkgopt{sanitize} package option, 
% "sanitize={description=false}", and protect fragile
% commands). The \gloskey{description} key is required when
% defining a new glossary entry. (Be careful not to make the
% description too long, because \app{makeindex} has a limited
% buffer. \cs{@glo@desc} is defined to be a short command 
% to discourage lengthy descriptions
% for this reason. If you do have a very long description, or if
% you require paragraph breaks, define a separate command that 
% contains the description, and use it as the value to the 
% \gloskey{description} key.)
%    \begin{macrocode}
\define@key{glossentry}{description}{%
\def\@glo@desc{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{descriptionplural}
% \changes{1.12}{2008 Mar 8}{new}
%    \begin{macrocode}
\define@key{glossentry}{descriptionplural}{%
\def\@glo@descplural{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{sort}
% The \gloskey{sort} key needs to be sanitized here 
% (the sort key is provided for \app{makeindex}'s benefit, 
% not for use in the document). The \gloskey{sort} key is optional
% when defining a new glossary entry. If omitted, the value 
% is given by \meta{name} \meta{description}.
%\changes{1.18}{2009 January 14}{moved sanitization to 'newglossaryentry}
%    \begin{macrocode}
\define@key{glossentry}{sort}{%
\def\@glo@sort{#1}}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{text}
% The \gloskey{text} key determines how the term should appear when
% used in the document (i.e.\ outside of the glossary). If omitted, 
% the value of the \gloskey{name} key is used instead.
%    \begin{macrocode}
\define@key{glossentry}{text}{%
\def\@glo@text{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{plural}
% The \gloskey{plural} key determines how the plural form of the term
% should be displayed in the document. If omitted, the plural is
% constructed by appending \ics{glspluralsuffix} to the value of the 
% \gloskey{text} key.
%    \begin{macrocode}
\define@key{glossentry}{plural}{%
\def\@glo@plural{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{first}
% The \gloskey{first} key determines how the entry should be displayed
% in the document when it is first used. If omitted, it is taken
% to be the same as the value of the \gloskey{text} key.
%    \begin{macrocode}
\define@key{glossentry}{first}{%
\def\@glo@first{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{firstplural}
% The \gloskey{firstplural} key is used to set the plural form for
% first use, in the event that the plural is required the first 
% time the term is used. If omitted, it is constructed by 
% appending \ics{glspluralsuffix} to the value of the \gloskey{first} key.
%    \begin{macrocode}
\define@key{glossentry}{firstplural}{%
\def\@glo@firstplural{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{symbol}
% The \gloskey{symbol} key is ignored by most of the predefined
% glossary styles, and defaults to \cs{relax} if omitted. 
% It is provided for glossary styles that require an associated 
% symbol, as well as a name and description. To make this value 
% appear in the glossary, you need to redefine 
% \ics{glossaryentryfield} so that it uses its fourth parameter.
% If you want this value to appear in the text when the term is used 
% by commands like \ics{gls}, you will need to change
% \ics{glsdisplay} and \ics{glsdisplayfirst} (either 
% explicitly for all glossaries or via \ics{defglsdisplay}
% and \ics{defglsdisplayfirst} for individual glossaries).
%    \begin{macrocode}
\define@key{glossentry}{symbol}{%
\def\@glo@symbol{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{symbolplural}
% \changes{1.12}{2008 Mar 8}{new}
%    \begin{macrocode}
\define@key{glossentry}{symbolplural}{%
\def\@glo@symbolplural{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{type}
% The \gloskey{type} key specifies to which glossary this
% entry belongs. If omitted, the default glossary is used.
%    \begin{macrocode}
\define@key{glossentry}{type}{%
\def\@glo@type{#1}}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{counter}
% The \gloskey{counter} key specifies the name of the counter 
% associated with this glossary entry:
%    \begin{macrocode}
\define@key{glossentry}{counter}{%
\@ifundefined{c@#1}{\PackageError{glossaries}{There is no counter
called `#1'}{The counter key should have the name of a valid 
counter as its value}}{%
\def\@glo@counter{#1}}}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{see}
% The \gloskey{see} key specifies a list of cross-references
% \changes{1.17}{2008 December 26}{new}
%    \begin{macrocode}
\define@key{glossentry}{see}{%
\def\@glo@see{#1}}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{parent}
% The \gloskey{parent} key specifies the parent entry, if
% required.
% \changes{1.17}{2008 December 26}{new}
%    \begin{macrocode}
\define@key{glossentry}{parent}{%
\def\@glo@parent{#1}}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{nonumberlist}
% The \gloskey{nonumberlist} key suppresses the number list
% for the given entry.
% \changes{1.17}{2008 December 26}{new}
%    \begin{macrocode}
\define@key{glossentry}{nonumberlist}[none]{%
\def\@glo@prefix{\glsnonextpages}}
%    \end{macrocode}
%\end{key}
%
% Define some generic user keys. (6 ought to be enough!)
%\begin{key}{user1}
%    \begin{macrocode}
\define@key{glossentry}{user1}{%
  \def\@glo@useri{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{user2}
%    \begin{macrocode}
\define@key{glossentry}{user2}{%
  \def\@glo@userii{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{user3}
%    \begin{macrocode}
\define@key{glossentry}{user3}{%
  \def\@glo@useriii{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{user4}
%    \begin{macrocode}
\define@key{glossentry}{user4}{%
  \def\@glo@useriv{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{user5}
%    \begin{macrocode}
\define@key{glossentry}{user5}{%
  \def\@glo@userv{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{key}{user6}
%    \begin{macrocode}
\define@key{glossentry}{user6}{%
  \def\@glo@uservi{#1}%
}
%    \end{macrocode}
%\end{key}
%
%\begin{macro}{\@glsnoname}
% \changes{1.17}{2008 December 26}{new}
% Define command to generate error if \gloskey{name} key is missing.
%    \begin{macrocode}
\newcommand*{\@glsnoname}{%
  \PackageError{glossaries}{name key required in 
  \string\newglossaryentry\space for entry `\@glo@label'}{You 
  haven't specified the entry name}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glsdefaultplural}
% Define command to set default plural.
% \changes{1.17}{2008 December 26}{new}
%    \begin{macrocode}
\newcommand*{\@glsdefaultplural}{\@glo@text\glspluralsuffix}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsdefaultsort}
% Define command to set default sort.
% \changes{1.17}{2008 December 26}{new}
%    \begin{macrocode}
\newcommand*{\@glsdefaultsort}{\@glo@name}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\gls@level}
% Register to increment entry levels.
%    \begin{macrocode}
\newcount\gls@level
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\newglossaryentry}
% Define \cs{newglossaryentry}%
% \marg{label} \marg{key-val list}. 
% There are two required fields in \meta{key-val list}: 
% \gloskey{name} (or \gloskey{parent}) and 
% \gloskey{description}. (See above.)
%    \begin{macrocode}
\DeclareRobustCommand{\newglossaryentry}[2]{%
%    \end{macrocode}
% Check to see if this glossary entry has already been defined:
%    \begin{macrocode}
\glsdoifnoexists{#1}{%
%    \end{macrocode}
% Store label
%    \begin{macrocode}
\def\@glo@label{#1}%
%    \end{macrocode}
% Set up defaults. If the \gloskey{name} or \gloskey{description}
% keys are omitted, an error will be generated.
%    \begin{macrocode}
\let\@glo@name\@glsnoname
%    \end{macrocode}
%\changes{1.08}{2007 Oct 13}{Fixed error message to say ``description
%key'' rather than ``desc key''}
%    \begin{macrocode}
\def\@glo@desc{\PackageError{glossaries}{description key required in 
\string\newglossaryentry\space for entry `\@glo@label'}{You haven't specified the entry description}}%
%    \end{macrocode}
% \changes{1.12}{2008 Mar 8}{descriptionplural support added}
%    \begin{macrocode}
\def\@glo@descplural{\@glo@desc}%
%    \end{macrocode}
%    \begin{macrocode}
\def\@glo@type{\glsdefaulttype}%
\def\@glo@symbol{\relax}%
%    \end{macrocode}
% \changes{1.12}{2008 Mar 8}{symbolplural support added}
%    \begin{macrocode}
\def\@glo@symbolplural{\@glo@symbol}%
%    \end{macrocode}
%    \begin{macrocode}
\def\@glo@text{\@glo@name}%
%    \end{macrocode}
%    \begin{macrocode}
\let\@glo@plural\@glsdefaultplural
%    \end{macrocode}
% \changes{1.13}{2008 May 10}{Changed default first value}
% Using \cs{let} instead of \cs{def} to make later comparison
% avoid expansion issues. (Thanks to Ulrich~Diez for suggesting
% this.)
% \changes{1.16}{2008 August 27}{Changed def to let}
%    \begin{macrocode}
\let\@glo@first\relax
%    \end{macrocode}
% \changes{1.12}{2008 Mar 8}{Changed default first plural to be first
% key with s appended (was text key with s appended)}
% \changes{1.13}{2008 May 10}{Changed default firstplural value}
%    \begin{macrocode}
\let\@glo@firstplural\relax
%    \end{macrocode}
% Set the default sort:
%\changes{1.05}{2007 Aug 10}{Changed the default value of the sort
% key to just the value of the name key}%
%\changes{1.18}{2009 January 14}{Changed default value of sort
% to '@glsdefaultsort}
%    \begin{macrocode}
\let\@glo@sort\@glsdefaultsort
%    \end{macrocode}
% Set the default counter:
%    \begin{macrocode}
\def\@glo@counter{\@gls@getcounter{\@glo@type}}%
%    \end{macrocode}
%\changes{1.17}{2008 December 26}{added see key}
%    \begin{macrocode}
\def\@glo@see{}%
%    \end{macrocode}
%\changes{1.17}{2008 December 26}{added parent key}
%    \begin{macrocode}
\def\@glo@parent{}%
%    \end{macrocode}
%\changes{1.17}{2008 December 26}{added nonumberlist key}
%    \begin{macrocode}
\def\@glo@prefix{}%
%    \end{macrocode}
%\changes{2.04}{2009 November 10}{added user1-6 keys}
%    \begin{macrocode}
\def\@glo@useri{}%
\def\@glo@userii{}%
\def\@glo@useriii{}%
\def\@glo@useriv{}%
\def\@glo@userv{}%
\def\@glo@uservi{}%
%    \end{macrocode}
% Add start hook in case another package wants to add extra keys.
%    \begin{macrocode}
  \@newglossaryentryprehook
%    \end{macrocode}
% Extract key-val information from third parameter:
%    \begin{macrocode}
\setkeys{glossentry}{#2}%
%    \end{macrocode}
% Check to see if this glossary type has been defined, if it has,
% add this label to the relevant list, otherwise generate an error.
%    \begin{macrocode}
\@ifundefined{glolist@\@glo@type}{\PackageError{glossaries}{%
Glossary type '\@glo@type' has not been defined}{%
You need to define a new glossary type, before making entries
in it}}{%
\protected@edef\@glolist@{\csname glolist@\@glo@type\endcsname}%
\expandafter\xdef\csname glolist@\@glo@type\endcsname{\@glolist@{#1},}%
}%
%    \end{macrocode}
% Initialise level to 0.
%    \begin{macrocode}
\gls@level=0\relax
%    \end{macrocode}
% Has this entry been assigned a parent?
%    \begin{macrocode}
\ifx\@glo@parent\@empty
%    \end{macrocode}
% Doesn't have a parent. Set \cs{glo@}\meta{label}"@parent" to
% empty.
%    \begin{macrocode}
  \expandafter\gdef\csname glo@#1@parent\endcsname{}%
\else
%    \end{macrocode}
% Has a parent. Check to ensure this entry isn't its own parent.
%    \begin{macrocode}
  \ifthenelse{\equal{#1}{\@glo@parent}}{%
    \PackageError{glossaries}{Entry `#1' can't be its own parent}{}%
    \def\@glo@parent{}%
    \expandafter\gdef\csname glo@#1@parent\endcsname{}%
  }{%
%    \end{macrocode}
% Check the parent exists:
%    \begin{macrocode}
    \ifglsentryexists{\@glo@parent}{%
%    \end{macrocode}
% Parent exists. Set \cs{glo@}\meta{label}"@parent".
%    \begin{macrocode}
      \expandafter\xdef\csname glo@#1@parent\endcsname{\@glo@parent}%
%    \end{macrocode}
% Determine level.
%    \begin{macrocode}
      \gls@level=\csname glo@\@glo@parent @level\endcsname\relax
      \advance\gls@level by 1\relax
%    \end{macrocode}
% If name hasn't been specified, use same as the parent name
%    \begin{macrocode}
      \ifx\@glo@name\@glsnoname
        \expandafter\let\expandafter\@glo@name
           \csname glo@\@glo@parent @name\endcsname
%    \end{macrocode}
% If name and plural haven't been specified, use same as the parent
%    \begin{macrocode}
        \ifx\@glo@plural\@glsdefaultplural
          \expandafter\let\expandafter\@glo@plural
             \csname glo@\@glo@parent @plural\endcsname
        \fi
      \fi
    }{%
%    \end{macrocode}
% Parent doesn't exist, so issue an error message and change this
% entry to have no parent
%    \begin{macrocode}
      \PackageError{glossaries}{Invalid parent `\@glo@parent'
      for entry `#1' - parent doesn't exist}{Parent entries
      must be defined before their children}%
      \def\@glo@parent{}%
      \expandafter\gdef\csname glo@#1@parent\endcsname{}%
     }%
  }%
\fi
%    \end{macrocode}
% Set the level for this entry
%    \begin{macrocode}
\expandafter\xdef\csname glo@#1@level\endcsname{\number\gls@level}%
%    \end{macrocode}
% Check if \gloskey{first} and \gloskey{firstplural} have been use.
% If \gloskey{firstplural} hasn't been specified, but \gloskey{first}
% has been specified, then form \gloskey{firstplural} by appending
% \cs{glspluralsuffix} to value of \gloskey{first} key, otherwise
% obtain the value from the \gloskey{plural} key.
% \changes{1.16}{2008 August 27}{Changed if to ifx}
% This now uses \cs{ifx} instead of \cs{if} to avoid expansion
% issues. (Thanks to Ulrich~Diez for suggesting this.)
%    \begin{macrocode}
\ifx\relax\@glo@firstplural
   \ifx\relax\@glo@first
      \def\@glo@firstplural{\@glo@plural}%
      \def\@glo@first{\@glo@text}%
   \else
      \def\@glo@firstplural{\@glo@first\glspluralsuffix}%
   \fi
\else
   \ifx\relax\@glo@first
      \def\@glo@first{\@glo@text}%
   \fi
\fi
%    \end{macrocode}
% Define commands associated with this entry:
%    \begin{macrocode}
\expandafter
  \protected@xdef\csname glo@#1@text\endcsname{\@glo@text}%
\expandafter
  \protected@xdef\csname glo@#1@plural\endcsname{\@glo@plural}%
\expandafter
  \protected@xdef\csname glo@#1@first\endcsname{\@glo@first}%
\expandafter
  \protected@xdef\csname glo@#1@firstpl\endcsname{\@glo@firstplural}%
\expandafter
  \protected@xdef\csname glo@#1@type\endcsname{\@glo@type}%
\expandafter
  \protected@xdef\csname glo@#1@counter\endcsname{\@glo@counter}%
\expandafter
  \protected@xdef\csname glo@#1@useri\endcsname{\@glo@useri}%
\expandafter
  \protected@xdef\csname glo@#1@userii\endcsname{\@glo@userii}%
\expandafter
  \protected@xdef\csname glo@#1@useriii\endcsname{\@glo@useriii}%
\expandafter
  \protected@xdef\csname glo@#1@useriv\endcsname{\@glo@useriv}%
\expandafter
  \protected@xdef\csname glo@#1@userv\endcsname{\@glo@userv}%
\expandafter
  \protected@xdef\csname glo@#1@uservi\endcsname{\@glo@uservi}%
\@gls@sanitizename
\expandafter\protected@xdef\csname glo@#1@name\endcsname{\@glo@name}%
%    \end{macrocode}
% The smaller and smallcaps options set the description to 
% \cs{@glo@first}. Need to check for this, otherwise it won't get
% expanded if the description gets sanitized.
%\changes{1.15}{2008 August 15}{check for '@glo@first in description}%
%    \begin{macrocode}
\def\@glo@@desc{\@glo@first}%
\ifx\@glo@desc\@glo@@desc
  \let\@glo@desc\@glo@first
\fi
\@gls@sanitizedesc
\expandafter\protected@xdef\csname glo@#1@desc\endcsname{\@glo@desc}%
\expandafter\protected@xdef\csname glo@#1@descplural\endcsname{\@glo@descplural}%
%    \end{macrocode}
% Sanitize sort value:
%\changes{1.18}{2009 January 14}{moved sort sanitization to
% 'newglossaryentry}
%    \begin{macrocode}
\ifx\@glo@sort\@glsdefaultsort
  \let\@glo@sort\@glo@name
\fi
\@onelevel@sanitize\@glo@sort
%    \end{macrocode}
% Set the sort key for this entry:
%    \begin{macrocode}
\expandafter\protected@xdef\csname glo@#1@sort\endcsname{\@glo@sort}%
%    \end{macrocode}
%\changes{1.15}{2008 August 15}{check for '@glo@text in symbol}%
%    \begin{macrocode}
\def\@glo@@symbol{\@glo@text}%
\ifx\@glo@symbol\@glo@@symbol
  \let\@glo@symbol\@glo@text
\fi
\@gls@sanitizesymbol
\expandafter\protected@xdef\csname glo@#1@symbol\endcsname{\@glo@symbol}%
\expandafter\protected@xdef\csname glo@#1@symbolplural\endcsname{\@glo@symbolplural}%
%    \end{macrocode}
% Define an associated boolean variable to determine whether this
% entry has been used yet (needs to be defined globally):
%    \begin{macrocode}
\expandafter\gdef\csname glo@#1@flagfalse\endcsname{%
\expandafter\global\expandafter
\let\csname ifglo@#1@flag\endcsname\iffalse}%
\expandafter\gdef\csname glo@#1@flagtrue\endcsname{%
\expandafter\global\expandafter
\let\csname ifglo@#1@flag\endcsname\iftrue}%
\csname glo@#1@flagfalse\endcsname
%    \end{macrocode}
% Sort out any cross-referencing if required.
%    \begin{macrocode}
\ifx\@glo@see\@empty
\else
  \protected@edef\@do@glssee{%
    \noexpand\@gls@fixbraces\noexpand\@glo@list\@glo@see
      \noexpand\@nil
    \noexpand\expandafter\noexpand\@glssee\noexpand\@glo@list{#1}}%
  \@do@glssee
\fi
}%
%    \end{macrocode}
% Determine and store main part of the entry's index format.
%\changes{1.17}{2008 December 26}{Stored main part of entry 
% format when entry
% is defined}%
%    \begin{macrocode}
  \@glo@storeentry{#1}%
%    \end{macrocode}
% Add end hook in case another package wants to add extra keys.
%    \begin{macrocode}
  \@newglossaryentryposthook
}
%    \end{macrocode}
%\changes{1.13}{2008 May 10}{Removed restriction on only using
% 'newglossaryentry in the preamble}
%\end{macro}
%\begin{macro}{\@newglossaryentryprehook}
% Allow extra information to be added to glossary entries:
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\@newglossaryentryprehook}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@newglossaryentryposthook}
% Allow extra information to be added to glossary entries:
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\@newglossaryentryposthook}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glossaryentryfield}
% Indicate what command should be used to display each entry in
% the glossary. (This enables the \sty{glossaries-accsupp} package
% to use \cs{accsuppglossaryentryfield} instead.)
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\ifglsxindy
  \newcommand*{\@glossaryentryfield}{\string\\glossaryentryfield}
\else
  \newcommand*{\@glossaryentryfield}{\string\glossaryentryfield}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glossarysubentryfield}
% Indicate what command should be used to display each subentry in
% the glossary. (This enables the \sty{glossaries-accsupp} package
% to use \cs{accsuppglossarysubentryfield} instead.)
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\ifglsxindy
  \newcommand*{\@glossarysubentryfield}{%
    \string\\glossarysubentryfield}
\else
  \newcommand*{\@glossarysubentryfield}{%
    \string\glossarysubentryfield}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glo@storeentry}
%\changes{1.17}{2008 December 26}{new}
% Determine the format to write the entry in the glossary 
% output (\filetype{.glo}) file.
% The argument is the entry's label.
% The result is stored in \cs{glo@}\meta{label}"@entry", where
% \meta{label} is the entry's label. (This doesn't include
% any formatting or location information.)
%    \begin{macrocode}
\newcommand{\@glo@storeentry}[1]{%
%    \end{macrocode}
% Get the sort string and escape any special characters
%    \begin{macrocode}
\protected@edef\@glo@sort{\csname glo@#1@sort\endcsname}%
\@gls@checkmkidxchars\@glo@sort
%    \end{macrocode}
% Same again for the name string.
%    \begin{macrocode}
\protected@edef\@@glo@name{\csname glo@#1@name\endcsname}%
\@gls@checkmkidxchars\@@glo@name
%    \end{macrocode}
% Add the font command. (The backslash needs to be escaped for
% \app{xindy}.)
%    \begin{macrocode}
\ifglsxindy
  \protected@edef\@glo@name{\string\\glsnamefont{\@@glo@name}}%
\else
  \protected@edef\@glo@name{\string\glsnamefont{\@@glo@name}}%
\fi
%    \end{macrocode}
% Get the description string and escape any special characters
%    \begin{macrocode}
\protected@edef\@glo@desc{\csname glo@#1@desc\endcsname}%
\@gls@checkmkidxchars\@glo@desc
%    \end{macrocode}
% Same again for the symbol
%    \begin{macrocode}
\protected@edef\@glo@symbol{\csname glo@#1@symbol\endcsname}%
\@gls@checkmkidxchars\@glo@symbol
%    \end{macrocode}
% Escape any special characters in the prefix
%    \begin{macrocode}
\@gls@checkmkidxchars\@glo@prefix
%    \end{macrocode}
% Get the parent, if one exists
%    \begin{macrocode}
\edef\@glo@parent{\csname glo@#1@parent\endcsname}%
%    \end{macrocode}
% Write the information to the glossary file.
%    \begin{macrocode}
\ifglsxindy
%    \end{macrocode}
% Store using \app{xindy} syntax.
%    \begin{macrocode}
  \ifx\@glo@parent\@empty
%    \end{macrocode}
% Entry doesn't have a parent
%    \begin{macrocode}
    \expandafter\protected@xdef\csname glo@#1@index\endcsname{%
     (\string"\@glo@sort\string" %
     \string"\@glo@prefix\@glossaryentryfield{#1}{\@glo@name
     }{\@glo@desc}{\@glo@symbol}\string") %
    }%
  \else
%    \end{macrocode}
% Entry has a parent
%    \begin{macrocode}
    \expandafter\protected@xdef\csname glo@#1@index\endcsname{%
      \csname glo@\@glo@parent @index\endcsname
      (\string"\@glo@sort\string" %
      \string"\@glo@prefix\@glossarysubentryfield%
         {\csname glo@#1@level\endcsname}{#1}{\@glo@name
      }{\@glo@desc}{\@glo@symbol}\string") %
   }%
  \fi
\else
%    \end{macrocode}
% Store using \app{makeindex} syntax.
%    \begin{macrocode}
  \ifx\@glo@parent\@empty
%    \end{macrocode}
% Sanitize \cs{@glo@prefix}
%    \begin{macrocode}
    \@onelevel@sanitize\@glo@prefix
%    \end{macrocode}
% Entry doesn't have a parent
%    \begin{macrocode}
    \expandafter\protected@xdef\csname glo@#1@index\endcsname{%
      \@glo@sort\@gls@actualchar\@glo@prefix
      \@glossaryentryfield{#1}{\@glo@name}{\@glo@desc
      }{\@glo@symbol}%
    }%
  \else
%    \end{macrocode}
% Entry has a parent
%    \begin{macrocode}
    \expandafter\protected@xdef\csname glo@#1@index\endcsname{%
      \csname glo@\@glo@parent @index\endcsname\@gls@levelchar
      \@glo@sort\@gls@actualchar\@glo@prefix
      \@glossarysubentryfield
        {\csname glo@#1@level\endcsname}{#1}{\@glo@name}{\@glo@desc
      }{\@glo@symbol}%
    }%
  \fi
\fi
}
%    \end{macrocode}
%\end{macro}
%
%\subsection{Resetting and unsetting entry flags}
% Each glossary entry is assigned a conditional of the form
%\cs{ifglo@}\meta{label}\texttt{@flag} which determines
% whether or not the entry has been used (see also 
% \ics{ifglsused} defined below). These flags can
% be set and unset using the following macros:
%
% The command \cs{glsreset}\marg{label} can be used
% to set the entry flag to indicate that it hasn't been used yet. The
% required argument is the entry label.
%\begin{macro}{\glsreset}
%    \begin{macrocode}
\newcommand*{\glsreset}[1]{%
\glsdoifexists{#1}{%
\expandafter\global\csname glo@#1@flagfalse\endcsname}}
%    \end{macrocode}
%\end{macro}
% As above, but with only a local effect:
%\begin{macro}{\glslocalreset}
%    \begin{macrocode}
\newcommand*{\glslocalreset}[1]{%
\glsdoifexists{#1}{%
\expandafter\let\csname ifglo@#1@flag\endcsname\iffalse}}
%    \end{macrocode}
%\end{macro}
% The command \cs{glsunset}\marg{label} can be used to
% set the entry flag to indicate that it has been used. The required
% argument is the entry label.
%\begin{macro}{\glsunset}
%    \begin{macrocode}
\newcommand*{\glsunset}[1]{%
\glsdoifexists{#1}{%
\expandafter\global\csname glo@#1@flagtrue\endcsname}}
%    \end{macrocode}
%\end{macro}
% As above, but with only a local effect:
%\begin{macro}{\glslocalunset}
%    \begin{macrocode}
\newcommand*{\glslocalunset}[1]{%
\glsdoifexists{#1}{%
\expandafter\let\csname ifglo@#1@flag\endcsname\iftrue}}
%    \end{macrocode}
%\end{macro}
% Reset all entries for the named glossaries (supplied in a 
% comma-separated list). 
% Syntax: \cs{glsresetall}\oarg{glossary-list}
%\begin{macro}{\glsresetall}
%    \begin{macrocode}
\newcommand*{\glsresetall}[1][\@glo@types]{%
\forallglsentries[#1]{\@glsentry}{%
\glsreset{\@glsentry}}}
%    \end{macrocode}
%\end{macro}
% As above, but with only a local effect:
%\begin{macro}{\glslocalresetall}
%    \begin{macrocode}
\newcommand*{\glslocalresetall}[1][\@glo@types]{%
\forallglsentries[#1]{\@glsentry}{%
\glslocalreset{\@glsentry}}}
%    \end{macrocode}
%\end{macro}
% Unset all entries for the named glossaries (supplied in a 
% comma-separated list). 
% Syntax: \cs{glsunsetall}\oarg{glossary-list}
%\begin{macro}{\glsunsetall}
%    \begin{macrocode}
\newcommand*{\glsunsetall}[1][\@glo@types]{%
\forallglsentries[#1]{\@glsentry}{%
\glsunset{\@glsentry}}}
%    \end{macrocode}
%\end{macro}
% As above, but with only a local effect:
%\begin{macro}{\glslocalunsetall}
%    \begin{macrocode}
\newcommand*{\glslocalunsetall}[1][\@glo@types]{%
\forallglsentries[#1]{\@glsentry}{%
\glslocalunset{\@glsentry}}}
%    \end{macrocode}
%\end{macro}
%
% \subsection{Loading files containing glossary entries}
%\label{sec:load}
% Glossary entries can be defined in an external file.
% These external files can contain \ics{newglossaryentry}
% and \ics{newacronym} commands.\footnote{and any other valid 
%\LaTeX\ code that can be used in the preamble.}\\[10pt]
% \cs{loadglsentries}\oarg{type}\marg{filename}\\[10pt]
% This command will input the file using \cs{input}.
% The optional argument specifies to which glossary the
% entries should be assigned if they haven't used the \gloskey{type}
% key. If the optional argument is not specified, the default
% glossary is used. Only those entries used in the document (via
% \ics{glslink}, \ics{gls}, \ics{glspl} and uppercase
% variants or \ics{glsadd} and \ics{glsaddall} 
% will appear in the glossary). The mandatory argument is 
% the filename (with or without .tex extension).
%\begin{macro}{\loadglsentries}
%    \begin{macrocode}
\newcommand*{\loadglsentries}[2][\@gls@default]{%
\let\@gls@default\glsdefaulttype
\def\glsdefaulttype{#1}\input{#2}%
\let\glsdefaulttype\@gls@default}
%    \end{macrocode}
%\end{macro}
% \cs{loadglsentries} can only be used in the preamble:
%    \begin{macrocode}
\@onlypreamble{\loadglsentries}
%    \end{macrocode}
%
%\subsection{Using glossary entries in the text}
%\label{sec:code:glslink}
%
% Any term that has been defined using \ics{newglossaryentry}
% (or \ics{newacronym}) can be displayed in the text 
% (i.e.\ outside of the glossary) using
% one of the commands defined in this section. Unless you use
% \ics{glslink}, the way the term appears in the text is
% determined by \ics{glsdisplayfirst} (if it is the first
% time the term has been used) or \ics{glsdisplay} (for
% subsequent use). Any formatting commands (such as \cs{textbf}
% is governed by \ics{glstextformat}. By default this just 
% displays the \term{link text} ``as is''.
%\changes{1.04}{2007 Aug 3}{Added 'glstextformat}%
%\begin{macro}{\glstextformat}
%    \begin{macrocode}
\newcommand*{\glstextformat}[1]{#1}
%    \end{macrocode}
%\end{macro}
%
% The first time an entry is used, the way in which it is
% displayed is governed by \cs{glsdisplayfirst}. This
% takes four parameters: \verb|#1| will be the value
% of the entry's \gloskey{first} or \gloskey{firstplural} key, 
% \verb|#2| will be the value of the entry's \gloskey{description}
% key, \verb|#3| will be the value of the entry's \gloskey{symbol}
% key and \verb|#4| is additional text supplied by the final optional
% argument to commands like \ics{gls} and \ics{glspl}.
% The default is to display the first parameter followed by the
% additional text.
%\begin{macro}{\glsdisplayfirst}
%    \begin{macrocode}
\newcommand*{\glsdisplayfirst}[4]{#1#4}
%    \end{macrocode}
%\end{macro}
%
% After the first use, the entry is displayed according to
% the format of \cs{glsdisplay}. Again, it takes four
% parameters: \verb|#1| will be the value of the
% entry's \gloskey{text} or \gloskey{plural} key, 
% \verb|#2| will be the value of the entry's \gloskey{description} 
% key, \verb|#3| will be the value of the entry's \gloskey{symbol}
% key and \verb|#4| is additional text supplied by the final optional
% argument to commands like \ics{gls} and \ics{glspl}.
%\begin{macro}{\glsdisplay}
%    \begin{macrocode}
\newcommand*{\glsdisplay}[4]{#1#4}
%    \end{macrocode}
%\end{macro}
%
% When a new glossary is created it uses \cs{glsdisplayfirst}
% and \cs{glsdisplay} as the default way of displaying its
% entry in the text. This can be changed for the entries belonging 
% to an individual glossary using 
% \ics{defglsdisplay} and \ics{defglsdisplayfirst}.
%\\[10pt]
% \cs{defglsdisplay}\oarg{type}\marg{definition}\\[10pt]%
% The glossary type is given by \meta{type} (the default glossary
% if omitted) and
% \meta{definition} should have at most \verb|#1|, \verb|#2|,
% \verb|#3| and \verb|#4|. These represent the same arguments
% as those described for \ics{glsdisplay}.
%\begin{macro}{\defglsdisplay}
%    \begin{macrocode}
\newcommand*{\defglsdisplay}[2][\glsdefaulttype]{%
\expandafter\def\csname gls@#1@display\endcsname##1##2##3##4{#2}}
%    \end{macrocode}
%\end{macro}
%\vskip5pt
% \cs{defglsdisplayfirst}\oarg{type}\marg{definition}\\[10pt]%
% The glossary type is given by \meta{type} (the default glossary
% if omitted) and
% \meta{definition} should have at most \verb|#1|, \verb|#2|,
% \verb|#3| and \verb|#4|. These represent the same arguments
% as those described for \ics{glsdisplayfirst}.
%\begin{macro}{\defglsdisplayfirst}
%    \begin{macrocode}
\newcommand*{\defglsdisplayfirst}[2][\glsdefaulttype]{%
\expandafter\def\csname gls@#1@displayfirst\endcsname##1##2##3##4{#2}}
%    \end{macrocode}
%\end{macro}
%
%\subsubsection{Links to glossary entries}
% The links to glossary entries all have a first optional 
% argument that can be used to change the format and counter
% of the associated entry number. Except for \cs{glslink},
% the commands like \cs{gls} have a final optional
% argument that can be used to insert additional text in the
% link (this will usually be appended, but can be redefined using
% \ics{defglsdisplay} and \ics{defglsdisplayfirst}). 
% It goes against the \LaTeX\ norm to have an optional
% argument after the mandatory arguments, but it makes more
% sense to write, say, \verb|\gls{label}['s]| rather than, say,
% \verb|\gls[append='s]{label}|. Since these control sequences
% are defined to include the final square bracket, spaces
% will be ignored after them. This is likely to lead to
% confusion as most users would not expect, say, "\gls{"\meta{label}"}"
% to ignore following spaces, so \cs{new@ifnextchar} from the 
% \isty{amsgen} package is required.
%
% The following keys can be used in the first optional 
% argument. The \gloskey[glslink]{counter} key checks that the 
% value is the name of a valid counter.
%    \begin{macrocode}
\define@key{glslink}{counter}{%
\@ifundefined{c@#1}{\PackageError{glossaries}{There is no counter
called `#1'}{The counter key should have the name of a valid 
counter as its value}}{%
\def\@gls@counter{#1}}}
%    \end{macrocode}
% The value of the \gloskey[glslink]{format} key should be the name of a 
% command (without the initial backslash) that has a single mandatory 
% argument which can be used to format the associated entry
% number.
%    \begin{macrocode}
\define@key{glslink}{format}{%
\def\@glsnumberformat{#1}}
%    \end{macrocode}
% The \gloskey[glslink]{hyper} key is a boolean key, it can either have the 
% value true or false, and indicates whether or not to make a 
% hyperlink to the relevant glossary entry. If hyper is false, an 
% entry will still be made in the glossary, but the given text 
% won't be a hyperlink.
%    \begin{macrocode}
\define@boolkey{glslink}{hyper}[true]{}
%    \end{macrocode}
%
%Syntax:\\[10pt]
% \cs{glslink}\oarg{options}\marg{label}\marg{text}
%\\[10pt]
% Display \meta{text} in the document, and add the entry information
% for \meta{label} into the relevant glossary. The optional
% argument should be a key value list using the \texttt{glslink}
% keys defined above.
%
% There is also a starred version:\\[10pt]
% \cs{glslink*}\oarg{options}\marg{label}\marg{text}\\[10pt]
% which is equivalent to 
% \cs{glslink}"[hyper=false,"\meta{options}"]"\marg{label}\marg{text}
%
% First determine whether or not we are using the starred version:
%\begin{macro}{\glslink}
%    \begin{macrocode}
\newcommand{\glslink}{%
\@ifstar\@sgls@link\@gls@@link}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@sgls@link}
% The starred version of \cs{glslink} calls the unstarred version
% with hyperlinks disabled.
%    \begin{macrocode}
\newcommand*{\@sgls@link}[1][]{\@gls@@link[hyper=false,#1]}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@@link}
%\changes{2.03}{2009 Sep 23}{new}
% The unstarred version of \cs{glslink} checks for the existance
% of the term. The main part of the business is in \cs{@gls@link}
% which shouldn't check if the term is defined as it's called by
% \cs{gls} etc which also perform that check.
%    \begin{macrocode}
\newcommand*{\@gls@@link}[3][]{%
  \ifglsentryexists{#2}%
  {%
    \@gls@link[#1]{#2}{#3}%
  }{%
    \PackageError{glossaries}{Glossary entry `#2' has not been
    defined}{You need to define a glossary entry before you
    can use it.}%
%    \end{macrocode}
% Display the specified text. (The entry doesn't exist so
% there's nothing to link it to.)
%    \begin{macrocode}
    \glstextformat{#3}%
  }%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@link}
%\changes{1.07}{2007 Sep 13}{fixed bug caused by \cs{theglsentrycounter} setting the page number too soon}
%\changes{1.15}{2008 August 15}{added 'glslabel}
%    \begin{macrocode}
\def\@gls@link[#1]#2#3{%
%    \end{macrocode}
%\changes{2.03}{2009 Sep 23}{Moved entry existance check to 
% avoid }
%\changes{2.03}{2009 Sep 23}{added \cs{leavevmode}}
% Inserting \cs{leavevmode} suggested by Donald~Arseneau (avoids
% problem with tabularx).
%    \begin{macrocode}
    \leavevmode
    \def\glslabel{#2}%
    \def\@glsnumberformat{glsnumberformat}%
    \edef\@gls@counter{\csname glo@#2@counter\endcsname}%
    \KV@glslink@hypertrue
    \setkeys{glslink}{#1}%
    \edef\theglsentrycounter{\expandafter\noexpand
      \csname the\@gls@counter\endcsname}%
%    \end{macrocode}
%\changes{2.01}{2009 May 30}{moved \cs{@do@wrglossary} before term is displayed
% to prevent unwanted whatsit}
%    \begin{macrocode}
    \@do@wrglossary{#2}%
    \ifKV@glslink@hyper
      \@glslink{glo:#2}{\glstextformat{#3}}%
    \else
      \glstextformat{#3}\relax
    \fi
}
%    \end{macrocode}
%\end{macro}
%\changes{1.01}{2007 May 17}{Added range facility in format key}%
% Set the formatting information in the format required by 
% \app{makeindex}. The first argument is the format specified
% by the user (via the format key), the second argument is the
% name of the counter used to indicate the location and the third
% argument is a control sequence which stores the required format.
%\begin{macro}{\@set@glo@numformat}
%    \begin{macrocode}
\def\@set@glo@numformat#1#2#3{%
\expandafter\@glo@check@mkidxrangechar#3\@nil
\protected@edef#1{\@glo@prefix setentrycounter{#2}%
\expandafter\string\csname\@glo@suffix\endcsname}%
\@gls@checkmkidxchars#1}
%    \end{macrocode}
%\end{macro}
% Check to see if the given string starts with a ( or ). If it
% does set \cs{@glo@prefix} to the starting character,
% and \cs{@glo@suffix} to the rest (or "glsnumberformat"
% if there is nothing else),
% otherwise set \cs{@glo@prefix} to nothing and
% \cs{@glo@suffix} to all of it.
%    \begin{macrocode}
\def\@glo@check@mkidxrangechar#1#2\@nil{%
\if#1(\relax
  \def\@glo@prefix{(}%
  \if\relax#2\relax
    \def\@glo@suffix{glsnumberformat}%
  \else
    \def\@glo@suffix{#2}%
  \fi
\else
  \if#1)\relax
    \def\@glo@prefix{)}%
    \if\relax#2\relax
      \def\@glo@suffix{glsnumberformat}%
    \else
      \def\@glo@suffix{#2}%
  \fi
  \else
    \def\@glo@prefix{}\def\@glo@suffix{#1#2}%
  \fi
\fi}
%    \end{macrocode}
%
%\begin{macro}{\@gls@escbsdq}
% Escape backslashes and double quote marks. The argument must be
% a control sequence.
%    \begin{macrocode}
\newcommand*{\@gls@escbsdq}[1]{%
  \def\@gls@checkedmkidx{}%
  \let\gls@xdystring=#1\relax
  \@onelevel@sanitize\gls@xdystring
  \edef\do@gls@xdycheckbackslash{%
    \noexpand\@gls@xdycheckbackslash\gls@xdystring\noexpand\@nil
    \@backslashchar\@backslashchar\noexpand\null}%
  \do@gls@xdycheckbackslash
  \expandafter\@gls@updatechecked\@gls@checkedmkidx{\gls@xdystring}%
  \def\@gls@checkedmkidx{}%
  \expandafter\@gls@xdycheckquote\gls@xdystring\@nil""\null
  \expandafter\@gls@updatechecked\@gls@checkedmkidx{\gls@xdystring}%
  \let#1=\gls@xdystring
}
%    \end{macrocode}
%\end{macro}
% Catch special characters\mkidxspch (argument must be a
% control sequence):
%\begin{macro}{\@gls@checkmkidxchars}
%    \begin{macrocode}
\newcommand{\@gls@checkmkidxchars}[1]{%
\ifglsxindy
  \@gls@escbsdq{#1}%
\else
  \def\@gls@checkedmkidx{}%
  \expandafter\@gls@checkquote#1\@nil""\null
  \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
  \def\@gls@checkedmkidx{}%
  \expandafter\@gls@checkescquote#1\@nil\"\"\null
  \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
  \def\@gls@checkedmkidx{}%
  \expandafter\@gls@checkescactual#1\@nil\?\?\null
  \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
  \def\@gls@checkedmkidx{}%
  \expandafter\@gls@checkactual#1\@nil??\null
  \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
  \def\@gls@checkedmkidx{}%
  \expandafter\@gls@checkbar#1\@nil||\null
  \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
  \def\@gls@checkedmkidx{}%
  \expandafter\@gls@checkescbar#1\@nil\|\|\null
  \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
  \def\@gls@checkedmkidx{}%
  \expandafter\@gls@checklevel#1\@nil!!\null
  \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}%
\fi
}
%    \end{macrocode}
%\end{macro}
% Update the control sequence and strip trailing \cs{@nil}:
%\begin{macro}{\@gls@updatechecked}
%    \begin{macrocode}
\def\@gls@updatechecked#1\@nil#2{\def#2{#1}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@tmpb}
%\changes{1.1}{2008 Feb 22}{changed \cs{toksdef} to \cs{newtoks}}
% Define temporary token
%    \begin{macrocode}
\newtoks\@gls@tmpb
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@checkquote}
% Replace \verb|"| with \verb|""| since \verb|"| is a makeindex
% special character\mkidxspch.
%    \begin{macrocode}
\def\@gls@checkquote#1"#2"#3\null{%
\@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
\toks@={#1}%
\ifx\null#2\null
 \ifx\null#3\null
  \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
  \def\@@gls@checkquote{\relax}%
 \else
  \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
    \@gls@quotechar\@gls@quotechar\@gls@quotechar\@gls@quotechar}%
  \def\@@gls@checkquote{\@gls@checkquote#3\null}%
 \fi
\else
 \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
   \@gls@quotechar\@gls@quotechar}%
 \ifx\null#3\null
   \def\@@gls@checkquote{\@gls@checkquote#2""\null}%
 \else
   \def\@@gls@checkquote{\@gls@checkquote#2"#3\null}%
 \fi
\fi
\@@gls@checkquote}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@checkescquote}
% Do the same for \verb|\"|:
%    \begin{macrocode}
\def\@gls@checkescquote#1\"#2\"#3\null{%
\@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
\toks@={#1}%
\ifx\null#2\null
 \ifx\null#3\null
  \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
  \def\@@gls@checkescquote{\relax}%
 \else
  \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
    \@gls@quotechar\string\"\@gls@quotechar
    \@gls@quotechar\string\"\@gls@quotechar}%
  \def\@@gls@checkescquote{\@gls@checkescquote#3\null}%
 \fi
\else
 \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
   \@gls@quotechar\string\"\@gls@quotechar}%
 \ifx\null#3\null
   \def\@@gls@checkescquote{\@gls@checkescquote#2\"\"\null}%
 \else
   \def\@@gls@checkescquote{\@gls@checkescquote#2\"#3\null}%
 \fi
\fi
\@@gls@checkescquote}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@checkescactual}
% Similarly for \verb|\?| (which is replaces @ as 
% \app{makeindex}'s special character):
%    \begin{macrocode}
\def\@gls@checkescactual#1\?#2\?#3\null{%
\@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
\toks@={#1}%
\ifx\null#2\null
 \ifx\null#3\null
  \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
  \def\@@gls@checkescactual{\relax}%
 \else
  \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
    \@gls@quotechar\string\"\@gls@actualchar
    \@gls@quotechar\string\"\@gls@actualchar}%
  \def\@@gls@checkescactual{\@gls@checkescactual#3\null}%
 \fi
\else
 \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
   \@gls@quotechar\string\"\@gls@actualchar}%
 \ifx\null#3\null
  \def\@@gls@checkescactual{\@gls@checkescactual#2\?\?\null}%
 \else
  \def\@@gls@checkescactual{\@gls@checkescactual#2\?#3\null}%
 \fi
\fi
\@@gls@checkescactual}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@checkescbar}
% Similarly for \verb"\|":
%    \begin{macrocode}
\def\@gls@checkescbar#1\|#2\|#3\null{%
\@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
\toks@={#1}%
\ifx\null#2\null
 \ifx\null#3\null
  \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
  \def\@@gls@checkescbar{\relax}%
 \else
  \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
    \@gls@quotechar\string\"\@gls@encapchar
    \@gls@quotechar\string\"\@gls@encapchar}%
  \def\@@gls@checkescbar{\@gls@checkescbar#3\null}%
 \fi
\else
 \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
   \@gls@quotechar\string\"\@gls@encapchar}%
 \ifx\null#3\null
  \def\@@gls@checkescbar{\@gls@checkescbar#2\|\|\null}%
 \else
  \def\@@gls@checkescbar{\@gls@checkescbar#2\|#3\null}%
 \fi
\fi
\@@gls@checkescbar}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@checkesclevel}
% Similarly for \verb"\!":
%    \begin{macrocode}
\def\@gls@checkesclevel#1\!#2\!#3\null{%
\@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
\toks@={#1}%
\ifx\null#2\null
 \ifx\null#3\null
  \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
  \def\@@gls@checkesclevel{\relax}%
 \else
  \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
    \@gls@quotechar\string\"\@gls@levelchar
    \@gls@quotechar\string\"\@gls@levelchar}%
  \def\@@gls@checkesclevel{\@gls@checkesclevel#3\null}%
 \fi
\else
 \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
   \@gls@quotechar\string\"\@gls@levelchar}%
 \ifx\null#3\null
  \def\@@gls@checkesclevel{\@gls@checkesclevel#2\!\!\null}%
 \else
  \def\@@gls@checkesclevel{\@gls@checkesclevel#2\!#3\null}%
 \fi
\fi
\@@gls@checkesclevel}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@checkbar}
% and for \verb"|":
%    \begin{macrocode}
\def\@gls@checkbar#1|#2|#3\null{%
\@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
\toks@={#1}%
\ifx\null#2\null
 \ifx\null#3\null
  \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
  \def\@@gls@checkbar{\relax}%
 \else
  \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
    \@gls@quotechar\@gls@encapchar\@gls@quotechar\@gls@encapchar}%
  \def\@@gls@checkbar{\@gls@checkbar#3\null}%
 \fi
\else
 \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
   \@gls@quotechar\@gls@encapchar}%
 \ifx\null#3\null
   \def\@@gls@checkbar{\@gls@checkbar#2||\null}%
 \else
   \def\@@gls@checkbar{\@gls@checkbar#2|#3\null}%
 \fi
\fi
\@@gls@checkbar}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@checklevel}
% and for \verb"!":
%    \begin{macrocode}
\def\@gls@checklevel#1!#2!#3\null{%
\@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
\toks@={#1}%
\ifx\null#2\null
 \ifx\null#3\null
  \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
  \def\@@gls@checklevel{\relax}%
 \else
  \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
    \@gls@quotechar\@gls@levelchar\@gls@quotechar\@gls@levelchar}%
  \def\@@gls@checklevel{\@gls@checklevel#3\null}%
 \fi
\else
 \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
   \@gls@quotechar\@gls@levelchar}%
 \ifx\null#3\null
   \def\@@gls@checklevel{\@gls@checklevel#2!!\null}%
 \else
   \def\@@gls@checklevel{\@gls@checklevel#2!#3\null}%
 \fi
\fi
\@@gls@checklevel}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@checkactual}
% and for \verb"?":
%    \begin{macrocode}
\def\@gls@checkactual#1?#2?#3\null{%
\@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
\toks@={#1}%
\ifx\null#2\null
 \ifx\null#3\null
  \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
  \def\@@gls@checkactual{\relax}%
 \else
  \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
    \@gls@quotechar\@gls@actualchar\@gls@quotechar\@gls@actualchar}%
  \def\@@gls@checkactual{\@gls@checkactual#3\null}%
 \fi
\else
 \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
   \@gls@quotechar\@gls@actualchar}%
 \ifx\null#3\null
   \def\@@gls@checkactual{\@gls@checkactual#2??\null}%
 \else
   \def\@@gls@checkactual{\@gls@checkactual#2?#3\null}%
 \fi
\fi
\@@gls@checkactual}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@xdycheckquote}
% As before but for use with \app{xindy}
%    \begin{macrocode}
\def\@gls@xdycheckquote#1"#2"#3\null{%
\@gls@tmpb=\expandafter{\@gls@checkedmkidx}%
\toks@={#1}%
\ifx\null#2\null
 \ifx\null#3\null
  \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}%
  \def\@@gls@xdycheckquote{\relax}%
 \else
  \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
    \string\"\string\"}%
  \def\@@gls@xdycheckquote{\@gls@xdycheckquote#3\null}%
 \fi
\else
 \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@
   \string\"}%
 \ifx\null#3\null
   \def\@@gls@xdycheckquote{\@gls@xdycheckquote#2""\null}%
 \else
   \def\@@gls@xdycheckquote{\@gls@xdycheckquote#2"#3\null}%
 \fi
\fi
\@@gls@xdycheckquote
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@xdycheckbackslash}
% Need to escape all backslashes for \app{xindy}.
% Define command that will define \cs{@gls@xdycheckbackslash}
%    \begin{macrocode}
\edef\def@gls@xdycheckbackslash{%
 \noexpand\def\noexpand\@gls@xdycheckbackslash##1\@backslashchar
   ##2\@backslashchar##3\noexpand\null{%
  \noexpand\@gls@tmpb=\noexpand\expandafter
    {\noexpand\@gls@checkedmkidx}%
  \noexpand\toks@={##1}%
  \noexpand\ifx\noexpand\null##2\noexpand\null
   \noexpand\ifx\noexpand\null##3\noexpand\null
    \noexpand\edef\noexpand\@gls@checkedmkidx{%
       \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@}%
    \noexpand\def\noexpand\@@gls@xdycheckbackslash{\relax}%
   \noexpand\else
    \noexpand\edef\noexpand\@gls@checkedmkidx{%
      \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@
    \@backslashchar\@backslashchar\@backslashchar\@backslashchar}%
  \noexpand\def\noexpand\@@gls@xdycheckbackslash{%
     \noexpand\@gls@xdycheckbackslash##3\noexpand\null}%
   \noexpand\fi
  \noexpand\else
   \noexpand\edef\noexpand\@gls@checkedmkidx{%
     \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@
   \@backslashchar\@backslashchar}%
 \noexpand\ifx\noexpand\null##3\noexpand\null
   \noexpand\def\noexpand\@@gls@xdycheckbackslash{%
      \noexpand\@gls@xdycheckbackslash##2\@backslashchar
      \@backslashchar\noexpand\null}%
   \noexpand\else
     \noexpand\def\noexpand\@@gls@xdycheckbackslash{%
        \noexpand\@gls@xdycheckbackslash##2\@backslashchar
           ##3\noexpand\null}%
   \noexpand\fi
  \noexpand\fi
  \noexpand\@@gls@xdycheckbackslash
 }%
}
%    \end{macrocode}
% Now go ahead and define \cs{@gls@xdycheckbackslash}
%    \begin{macrocode}
\def@gls@xdycheckbackslash
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glslink}
% If \ics{hyperlink} is not defined \cs{@glslink} 
% ignores its first argument and just does the second argument,
% otherwise it is equivalent to \ics{hyperlink}.
%    \begin{macrocode}
\@ifundefined{hyperlink}{%
  \gdef\@glslink#1#2{#2}%
}{%
  \gdef\@glslink#1#2{\hyperlink{#1}{#2}}%
}
%    \end{macrocode}
%\end{macro}
%\changes{1.12}{2008 Mar 8}{added check for 'hypertarget separate
% to 'hyperlink (memoir defines 'hyperlink but not 'hypertarget)}
%\begin{macro}{\@glstarget}
% If \ics{hypertarget} is not defined, \cs{@glstarget}
% ignores its first argument and just does the second argument,
% otherwise it is equivalent to \ics{hypertarget}.
%\changes{1.16}{2008 August 27}{raised the hypertarget so the target text doesn't
% scroll off the top of the page}
%    \begin{macrocode}
\newlength\gls@tmplen
\@ifundefined{hypertarget}{%
  \gdef\@glstarget#1#2{#2}%
}{%
 \gdef\@glstarget#1#2{%
    \settoheight{\gls@tmplen}{#2}%
    \raisebox{\gls@tmplen}{\hypertarget{#1}{}}#2}%
}
%    \end{macrocode}
%\end{macro}
%
% Glossary hyperlinks can be disabled using \cs{glsdisablehyper}
% (effect can be localised):
%\begin{macro}{\glsdisablehyper}
%    \begin{macrocode}
\newcommand{\glsdisablehyper}{%
\renewcommand*\@glslink[2]{##2}%
\renewcommand*\@glstarget[2]{##2}}
%    \end{macrocode}
%\end{macro}
% Glossary hyperlinks can be enabled using \cs{glsenablehyper}
% (effect can be localised):
%\begin{macro}{\glsenablehyper}
%    \begin{macrocode}
\newcommand{\glsenablehyper}{%
\renewcommand*\@glslink[2]{\hyperlink{##1}{##2}}%
\renewcommand*\@glstarget[2]{%
  \settoheight{\gls@tmplen}{##2}%
  \raisebox{\gls@tmplen}{\hypertarget{##1}{}}##2}}
%    \end{macrocode}
%\end{macro}
%
%Syntax:\\[10pt]
% \cs{gls}\oarg{options}\marg{label}\oarg{insert text}\\[10pt]
% Link to glossary entry using singular form. The link text
% is taken from the value of the \gloskey{text} or \gloskey{first}
% keys used when the entry was defined.
%
%  The first optional argument is a key-value list, the same as
% \ics{glslink}\igloskey[glslink]{hyper}\igloskey[glslink]{format}\igloskey[glslink]{counter}, 
% the mandatory argument is the entry label. 
% After the mandatory argument, there is another optional argument 
% to insert extra text in the link text (the location of the inserted
% text is governed by \ics{glsdisplay} and 
% \ics{glsdisplayfirst}). As with \cs{glslink}
% there is a starred version which is the same as the unstarred 
% version but with the \gloskey[glslink]{hyper} key set to \texttt{false}.
% (Additional options can also be specified 
% in the first optional argument.)
%
% First determine if we are using the starred form:
%\begin{macro}{\gls}
%    \begin{macrocode}
\newcommand*{\gls}{\@ifstar\@sgls\@gls}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%\begin{macro}{\@sgls}
%    \begin{macrocode}
\newcommand*{\@sgls}[1][]{\@gls[hyper=false,#1]}
%    \end{macrocode}
%\end{macro}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%\begin{macro}{\@gls}
%    \begin{macrocode}
\newcommand*{\@gls}[2][]{%
\new@ifnextchar[{\@gls@{#1}{#2}}{\@gls@{#1}{#2}[]}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@gls@}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@gls@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label}
%    \begin{macrocode}
\def\@gls@link@opts{#1}%
\def\@gls@link@label{#2}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\ifglsused{#2}%
{%
  \def\@glo@text{%
    \csname gls@\@glo@type @display\endcsname
      {\glsentrytext{#2}}{\glsentrydesc{#2}}{\glsentrysymbol{#2}}{#3}}%
}%
{%
  \def\@glo@text{%
    \csname gls@\@glo@type @displayfirst\endcsname
      {\glsentryfirst{#2}}{\glsentrydesc{#2}}{\glsentrysymbol{#2}}{#3}}%
}%
%    \end{macrocode}
% Call \cs{@gls@link}.
% If \pkgopt{footnote} package option has been used and the glossary
% type is \cs{acronymtype}, suppress 
% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst}
% package option is used.
%\changes{1.16}{2008 August 27}{Test glossary type is 'acronymtype in addition to
%checking if footnote option has been used}
%\changes{2.03}{2009 Sep 23}{Added check for hyperfirst}
%\changes{2.04}{2009 November 10}{Changed test to check if glossary type
%has been identified as a list of acronyms}
%    \begin{macrocode}
\ifglsused{#2}{%
  \@gls@link[#1]{#2}{\@glo@text}%
}{%
  \gls@checkisacronymlist\@glo@type
  \ifthenelse{\(\boolean{@glsisacronymlist}\AND
    \boolean{glsacrfootnote}\) \OR \NOT\boolean{glshyperfirst}}{%
    \@gls@link[#1,hyper=false]{#2}{\@glo@text}%
  }{%
    \@gls@link[#1]{#2}{\@glo@text}%
  }%
}%
%    \end{macrocode}
% Indicate that this entry has now been used
%    \begin{macrocode}
\glsunset{#2}}%
}
%    \end{macrocode}
%\end{macro}
%
% \cs{Gls} behaves like \cs{gls}, but the first letter
% of the link text is converted to uppercase (note that if the
% first letter has an accent, the accented letter will need to
% be grouped when you define the entry). It is mainly intended
% for terms that start a sentence:
%\begin{macro}{\Gls}
%    \begin{macrocode}
\newcommand*{\Gls}{\@ifstar\@sGls\@Gls}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGls}[1][]{\@Gls[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Gls}[2][]{%
\new@ifnextchar[{\@Gls@{#1}{#2}}{\@Gls@{#1}{#2}[]}}
%    \end{macrocode}
%\begin{macro}{\@Gls@}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Gls@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label}
%    \begin{macrocode}
\def\@gls@link@opts{#1}%
\def\@gls@link@label{#2}%
\def\glslabel{#2}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\ifglsused{#2}%
{%
  \protected@edef\@glo@text{%
    \csname gls@\@glo@type @display\endcsname
      {\glsentrytext{#2}}{\glsentrydesc{#2}}%
      {\glsentrysymbol{#2}}{#3}}%
}%
{%
  \protected@edef\@glo@text{%
    \csname gls@\@glo@type @displayfirst\endcsname
      {\glsentryfirst{#2}}{\glsentrydesc{#2}}%
      {\glsentrysymbol{#2}}{#3}}%
}%
%    \end{macrocode}
% Call \cs{@gls@link}
% If \pkgopt{footnote} package option has been used and the glossary
% type is \cs{acronymtype}, suppress 
% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst}
% package option is used.
%\changes{1.16}{2008 August 27}{Test glossary type is 'acronymtype in addition to
%checking if footnote option has been used}
%\changes{2.03}{2009 Sep 23}{Added check for hyperfirst}
%\changes{2.04}{2009 November 10}{Changed test to check if glossary type
%has been identified as a list of acronyms}
%    \begin{macrocode}
\ifglsused{#2}{%
  \@gls@link[#1]{#2}{%
  \expandafter\makefirstuc\expandafter{\@glo@text}}%
}{%
  \gls@checkisacronymlist\@glo@type
  \ifthenelse{\(\boolean{@glsisacronymlist}\AND
    \boolean{glsacrfootnote}\) \OR \NOT\boolean{glshyperfirst}}{%
    \@gls@link[#1,hyper=false]{#2}{%
  \expandafter\makefirstuc\expandafter{\@glo@text}}%
  }{%
    \@gls@link[#1]{#2}{%
  \expandafter\makefirstuc\expandafter{\@glo@text}}%
  }%
}%
%    \end{macrocode}
% Indicate that this entry has now been used
%    \begin{macrocode}
\glsunset{#2}}%
}
%    \end{macrocode}
%\end{macro}
%
% \cs{GLS} behaves like \ics{gls}, but the link
% text is converted to uppercase:
%\begin{macro}{\GLS}
%    \begin{macrocode}
\newcommand*{\GLS}{\@ifstar\@sGLS\@GLS}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGLS}[1][]{\@GLS[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLS}[2][]{%
\new@ifnextchar[{\@GLS@{#1}{#2}}{\@GLS@{#1}{#2}[]}}
%    \end{macrocode}
%\begin{macro}{\@GLS@}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLS@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label}
%    \begin{macrocode}
\def\@gls@link@opts{#1}%
\def\@gls@link@label{#2}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text}).
%    \begin{macrocode}
\ifglsused{#2}{\def\@glo@text{%
\csname gls@\@glo@type @display\endcsname
{\glsentrytext{#2}}{\glsentrydesc{#2}}{\glsentrysymbol{#2}}{#3}}}{%
\def\@glo@text{%
\csname gls@\@glo@type @displayfirst\endcsname
{\glsentryfirst{#2}}{\glsentrydesc{#2}}{\glsentrysymbol{#2}}{#3}}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% If \pkgopt{footnote} package option has been used and the glossary
% type is \cs{acronymtype}, suppress 
% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst}
% package option is used.
%\changes{1.16}{2008 August 27}{Test glossary type is 'acronymtype in addition to
%checking if footnote option has been used}
%\changes{2.03}{2009 Sep 23}{Added check for hyperfirst}
%\changes{2.04}{2009 November 10}{Changed test to check if glossary type
%has been identified as a list of acronyms}
%    \begin{macrocode}
\ifglsused{#2}{%
  \@gls@link[#1]{#2}{\MakeUppercase{\@glo@text}}%
}{%
  \gls@checkisacronymlist\@glo@type
  \ifthenelse{\(\boolean{@glsisacronymlist}\AND
    \boolean{glsacrfootnote}\) \OR \NOT\boolean{glshyperfirst}}{%
    \@gls@link[#1,hyper=false]{#2}{\MakeUppercase{\@glo@text}}%
  }{%
    \@gls@link[#1]{#2}{\MakeUppercase{\@glo@text}}%
  }%
}%
%    \end{macrocode}
% Indicate that this entry has now been used
%    \begin{macrocode}
\glsunset{#2}}%
}
%    \end{macrocode}
%\end{macro}
%
% \cs{glspl} behaves in the same way as \ics{gls} except
% it uses the plural form.
%\begin{macro}{\glspl}
%    \begin{macrocode}
\newcommand*{\glspl}{\@ifstar\@sglspl\@glspl}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sglspl}[1][]{\@glspl[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glspl}[2][]{%
\new@ifnextchar[{\@glspl@{#1}{#2}}{\@glspl@{#1}{#2}[]}}
%    \end{macrocode}
%\begin{macro}{\@glspl@}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glspl@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label}
%    \begin{macrocode}
\def\@gls@link@opts{#1}%
\def\@gls@link@label{#2}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%\changes{1.12}{2008 Mar 8}{now uses 'glsentrydescplural and
% 'glsentrysymbolplural instead of 'glsentrydesc and 'glsentrysymbol}
%    \begin{macrocode}
\ifglsused{#2}%
{%
  \def\@glo@text{%
    \csname gls@\@glo@type @display\endcsname
      {\glsentryplural{#2}}{\glsentrydescplural{#2}}%
      {\glsentrysymbolplural{#2}}{#3}}%
}%
{%
  \def\@glo@text{%
    \csname gls@\@glo@type @displayfirst\endcsname
      {\glsentryfirstplural{#2}}{\glsentrydescplural{#2}}%
      {\glsentrysymbolplural{#2}}{#3}}%
}%
%    \end{macrocode}
% Call \cs{@gls@link}.
% If \pkgopt{footnote} package option has been used and the glossary
% type is \cs{acronymtype}, suppress 
% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst}
% package option is used.
%\changes{1.16}{2008 August 27}{Test glossary type is 'acronymtype in addition to
%checking if footnote option has been used}
%\changes{2.03}{2009 Sep 23}{Added check for hyperfirst}
%\changes{2.04}{2009 November 10}{Changed test to check if glossary type
%has been identified as a list of acronyms}
%    \begin{macrocode}
\ifglsused{#2}{%
  \@gls@link[#1]{#2}{\@glo@text}%
}{%
  \gls@checkisacronymlist\@glo@type
  \ifthenelse{\(\boolean{@glsisacronymlist}\AND
    \boolean{glsacrfootnote}\) \OR \NOT\boolean{glshyperfirst}}{%
    \@gls@link[#1,hyper=false]{#2}{\@glo@text}%
  }{%
    \@gls@link[#1]{#2}{\@glo@text}%
  }%
}%
%    \end{macrocode}
% Indicate that this entry has now been used
%    \begin{macrocode}
\glsunset{#2}}%
}
%    \end{macrocode}
%\end{macro}
%
% \cs{Glspl} behaves in the same way as \ics{glspl}, except
% that the first letter of the link text is converted to uppercase
% (as with \ics{Gls}, if the first letter has an accent, it
% will need to be grouped).
%\begin{macro}{\Glspl}
%    \begin{macrocode}
\newcommand*{\Glspl}{\@ifstar\@sGlspl\@Glspl}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGlspl}[1][]{\@Glspl[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glspl}[2][]{%
\new@ifnextchar[{\@Glspl@{#1}{#2}}{\@Glspl@{#1}{#2}[]}}
%    \end{macrocode}
%\begin{macro}{\@Glspl@}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glspl@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label}
%    \begin{macrocode}
\def\@gls@link@opts{#1}%
\def\@gls@link@label{#2}%
\def\glslabel{#2}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text}). This needs to be expanded so that the
% \cs{@glo@text} can be passed to \cs{xmakefirstuc}.
%\changes{1.12}{2008 Mar 8}{now uses 'glsentrydescplural and
% 'glsentrysymbolplural instead of 'glsentrydesc and 'glsentrysymbol}
%    \begin{macrocode}
\ifglsused{#2}%
{%
  \protected@edef\@glo@text{%
    \csname gls@\@glo@type @display\endcsname
      {\glsentryplural{#2}}{\glsentrydescplural{#2}}%
      {\glsentrysymbolplural{#2}}{#3}}%
}%
{%
  \protected@edef\@glo@text{%
    \csname gls@\@glo@type @displayfirst\endcsname
      {\glsentryfirstplural{#2}}{\glsentrydescplural{#2}}%
      {\glsentrysymbolplural{#2}}{#3}}%
}%
%    \end{macrocode}
% Call \cs{@gls@link}.
% If \pkgopt{footnote} package option has been used and the glossary
% type is \cs{acronymtype}, suppress 
% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst}
% package option is used.
%\changes{1.16}{2008 August 27}{Test glossary type is 'acronymtype in addition to
%checking if footnote option has been used}
%\changes{2.03}{2009 Sep 23}{Added check for hyperfirst}
%\changes{2.04}{2009 November 10}{Changed test to check if glossary type
%has been identified as a list of acronyms}
%    \begin{macrocode}
\ifglsused{#2}{%
  \@gls@link[#1]{#2}{%
    \expandafter\makefirstuc\expandafter{\@glo@text}}%
}{%
  \gls@checkisacronymlist\@glo@type
  \ifthenelse{\(\boolean{@glsisacronymlist}\AND
    \boolean{glsacrfootnote}\) \OR \NOT\boolean{glshyperfirst}}{%
    \@gls@link[#1,hyper=false]{#2}{%
      \expandafter\makefirstuc\expandafter{\@glo@text}}%
  }{%
    \@gls@link[#1]{#2}{%
      \expandafter\makefirstuc\expandafter{\@glo@text}}%
  }%
}%
%    \end{macrocode}
% Indicate that this entry has now been used
%    \begin{macrocode}
\glsunset{#2}}%
}
%    \end{macrocode}
%\end{macro}
%
% \cs{GLSpl} behaves like \ics{glspl} except that all the
% link text is converted to uppercase.
%\begin{macro}{\GLSpl}
%    \begin{macrocode}
\newcommand*{\GLSpl}{\@ifstar\@sGLSpl\@GLSpl}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGLSpl}[1][]{\@GLSpl[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSpl}[2][]{%
\new@ifnextchar[{\@GLSpl@{#1}{#2}}{\@GLSpl@{#1}{#2}[]}}
%    \end{macrocode}
%\begin{macro}{\@GLSpl}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLSpl@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label}
%    \begin{macrocode}
\def\@gls@link@opts{#1}%
\def\@gls@link@label{#2}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%\changes{1.12}{2008 Mar 8}{now uses 'glsentrydescplural and
% 'glsentrysymbolplural instead of 'glsentrydesc and 'glsentrysymbol}
%    \begin{macrocode}
\ifglsused{#2}{\def\@glo@text{%
\csname gls@\@glo@type @display\endcsname
{\glsentryplural{#2}}{\glsentrydescplural{#2}}{%
\glsentrysymbolplural{#2}}{#3}}}{%
\def\@glo@text{%
\csname gls@\@glo@type @displayfirst\endcsname
{\glsentryfirstplural{#2}}{\glsentrydescplural{#2}}{%
\glsentrysymbolplural{#2}}{#3}}}%
%    \end{macrocode}
% Call \cs{@gls@link}.
% If \pkgopt{footnote} package option has been used and the glossary
% type is \cs{acronymtype}, suppress 
% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst}
% package option is used.
%\changes{1.16}{2008 August 27}{Test glossary type is 'acronymtype in addition to
%checking if footnote option has been used}
%\changes{2.03}{2009 Sep 23}{Added check for hyperfirst}
%\changes{2.04}{2009 November 10}{Changed test to check if glossary type
%has been identified as a list of acronyms}
%    \begin{macrocode}
\ifglsused{#2}{%
  \@gls@link[#1]{#2}{\MakeUppercase{\@glo@text}}%
}{%
  \gls@checkisacronymlist\@glo@type
  \ifthenelse{\(\boolean{@glsisacronymlist}\AND
    \boolean{glsacrfootnote}\) \OR \NOT\boolean{glshyperfirst}}{%
    \@gls@link[#1,hyper=false]{#2}{\MakeUppercase{\@glo@text}}%
  }{%
    \@gls@link[#1]{#2}{\MakeUppercase{\@glo@text}}%
  }%
}%
%    \end{macrocode}
% Indicate that this entry has now been used
%    \begin{macrocode}
\glsunset{#2}}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsdisp}
%\changes{1.19}{2009 Mar 2}{new}
%\cs{glsdisp}\oarg{options}\marg{label}\marg{text}
% This is like \cs{gls} except that the link text is provided.
% This differs from \cs{glslink} in that it uses 
% \cs{glsdisplay} or \cs{glsdisplayfirst} and unsets the first use
% flag.
%
% First determine if we are using the starred form:
%    \begin{macrocode}
\newcommand*{\glsdisp}{\@ifstar\@sglsdisp\@glsdisp}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%\begin{macro}{\@sgls}
%    \begin{macrocode}
\newcommand*{\@sglsdisp}[1][]{\@glsdisp[hyper=false,#1]}
%    \end{macrocode}
%\end{macro}
% Defined the un-starred form.
%\begin{macro}{\@glsdisp}
%    \begin{macrocode}
\newcommand*{\@glsdisp}[3][]{%
  \glsdoifexists{#2}{%
%    \end{macrocode}
%\changes{2.05}{2010 Feb 6}{Added closing brace. Patch provided by Sergiu Dotenco}
%    \begin{macrocode}
    \edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label}
%    \begin{macrocode}
    \def\@gls@link@opts{#1}%
    \def\@gls@link@label{#2}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
    \ifglsused{#2}%
    {%
      \def\@glo@text{%
        \csname gls@\@glo@type @display\endcsname
        {#3}{\glsentrydesc{#2}}{\glsentrysymbol{#2}}{}}%
    }%
    {%
      \def\@glo@text{%
        \csname gls@\@glo@type @displayfirst\endcsname
        {#3}{\glsentrydesc{#2}}{\glsentrysymbol{#2}}{}}%
    }%
%    \end{macrocode}
% Call \cs{@gls@link}.
% If \pkgopt{footnote} package option has been used and the glossary
% type is \cs{acronymtype}, suppress 
% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst}
% package option is used.
%\changes{1.16}{2008 August 27}{Test glossary type is 'acronymtype in addition to
%checking if footnote option has been used}
%\changes{2.03}{2009 Sep 23}{Added check for hyperfirst}
%\changes{2.04}{2009 November 10}{Changed test to check if glossary type
%has been identified as a list of acronyms}
%    \begin{macrocode}
    \ifglsused{#2}%
    {%
      \@gls@link[#1]{#2}{\@glo@text}%
    }%
    {%
      \gls@checkisacronymlist\@glo@type
      \ifthenelse{\(\boolean{@glsisacronymlist}\AND
        \boolean{glsacrfootnote}\) \OR \NOT\boolean{glshyperfirst}}%
      {%
        \@gls@link[#1,hyper=false]{#2}{\@glo@text}%
      }%
      {%
        \@gls@link[#1]{#2}{\@glo@text}%
      }%
    }%
%    \end{macrocode}
% Indicate that this entry has now been used
%\changes{2.05}{2010 Feb 6}{Removed spurious brace. Patch provided by Sergiu Dotenco}
%    \begin{macrocode}
    \glsunset{#2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
% \cs{glstext} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{text} key and it doesn't mark the entry as
% used.
%\begin{macro}{\glstext}
%    \begin{macrocode}
\newcommand*{\glstext}{\@ifstar\@sglstext\@glstext}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sglstext}[1][]{\@glstext[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glstext}[2][]{%
\new@ifnextchar[{\@glstext@{#1}{#2}}{\@glstext@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glstext@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('glstext shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentrytext{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\@glo@text#3}%
}%
}
%    \end{macrocode}
%
% \cs{GLStext} behaves like \cs{glstext} except the text is converted
% to uppercase.
%\begin{macro}{\GLStext}
%    \begin{macrocode}
\newcommand*{\GLStext}{\@ifstar\@sGLStext\@GLStext}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGLStext}[1][]{\@GLStext[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLStext}[2][]{%
\new@ifnextchar[{\@GLStext@{#1}{#2}}{\@GLStext@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLStext@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('GLStext shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentrytext{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\MakeUppercase{\@glo@text#3}}%
}%
}
%    \end{macrocode}
%
% \cs{Glstext} behaves like \cs{glstext} except that the first letter
% of the text is converted to uppercase.
%\begin{macro}{\Glstext}
%    \begin{macrocode}
\newcommand*{\Glstext}{\@ifstar\@sGlstext\@Glstext}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGlstext}[1][]{\@Glstext[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glstext}[2][]{%
\new@ifnextchar[{\@Glstext@{#1}{#2}}{\@Glstext@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glstext@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('Glstext shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentrytext{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{%
   \expandafter\makefirstuc\expandafter{\@glo@text}#3}%
}%
}
%    \end{macrocode}
%
% \cs{glsfirst} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{first} key and it doesn't mark the entry as
% used.
%\begin{macro}{\glsfirst}
%    \begin{macrocode}
\newcommand*{\glsfirst}{\@ifstar\@sglsfirst\@glsfirst}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sglsfirst}[1][]{\@glsfirst[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsfirst}[2][]{%
\new@ifnextchar[{\@glsfirst@{#1}{#2}}{\@glsfirst@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glsfirst@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('glsfirst shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryfirst{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\@glo@text#3}%
}%
}
%    \end{macrocode}
%
% \cs{Glsfirst} behaves like \ics{glsfirst} except it displays the 
% first letter in uppercase.
%\begin{macro}{\Glsfirst}
%    \begin{macrocode}
\newcommand*{\Glsfirst}{\@ifstar\@sGlsfirst\@Glsfirst}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGlsfirst}[1][]{\@Glsfirst[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsfirst}[2][]{%
\new@ifnextchar[{\@Glsfirst@{#1}{#2}}{\@Glsfirst@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glsfirst@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('Glsfirst shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryfirst{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{%
   \expandafter\makefirstuc\expandafter{\@glo@text}#3}%
}%
}
%    \end{macrocode}
%
% \cs{GLSfirst} behaves like \ics{Glsfirst} except it displays the 
% text in uppercase.
%\begin{macro}{\GLSfirst}
%    \begin{macrocode}
\newcommand*{\GLSfirst}{\@ifstar\@sGLSfirst\@GLSfirst}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGLSfirst}[1][]{\@GLSfirst[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSfirst}[2][]{%
\new@ifnextchar[{\@GLSfirst@{#1}{#2}}{\@GLSfirst@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLSfirst@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('GLSfirst shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryfirst{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\MakeUppercase{\@glo@text#3}}%
}%
}
%    \end{macrocode}
%
% \cs{glsplural} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{plural} key and it doesn't mark the entry as
% used.
%\begin{macro}{\glsplural}
%    \begin{macrocode}
\newcommand*{\glsplural}{\@ifstar\@sglsplural\@glsplural}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sglsplural}[1][]{\@glsplural[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsplural}[2][]{%
\new@ifnextchar[{\@glsplural@{#1}{#2}}{\@glsplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glsplural@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('glsplural shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryplural{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\@glo@text#3}%
}%
}
%    \end{macrocode}
%
% \cs{Glsplural} behaves like \ics{glsplural} except that the first
% letter is converted to uppercase.
%\begin{macro}{\Glsplural}
%    \begin{macrocode}
\newcommand*{\Glsplural}{\@ifstar\@sGlsplural\@Glsplural}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGlsplural}[1][]{\@Glsplural[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsplural}[2][]{%
\new@ifnextchar[{\@Glsplural@{#1}{#2}}{\@Glsplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glsplural@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('Glsplural shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryplural{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{%
   \expandafter\makefirstuc\expandafter{\@glo@text}#3}%
}%
}
%    \end{macrocode}
%
% \cs{GLSplural} behaves like \ics{glsplural} except that the 
% text is converted to uppercase.
%\begin{macro}{\GLSplural}
%    \begin{macrocode}
\newcommand*{\GLSplural}{\@ifstar\@sGLSplural\@GLSplural}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGLSplural}[1][]{\@GLSplural[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSplural}[2][]{%
\new@ifnextchar[{\@GLSplural@{#1}{#2}}{\@GLSplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLSplural@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('GLSplural shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryplural{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\MakeUppercase{\@glo@text#3}}%
}%
}
%    \end{macrocode}
%
% \cs{glsfirstplural} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{firstplural} key and it doesn't mark the entry as
% used.
%\begin{macro}{\glsfirstplural}
%    \begin{macrocode}
\newcommand*{\glsfirstplural}{\@ifstar\@sglsfirstplural\@glsfirstplural}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sglsfirstplural}[1][]{\@glsfirstplural[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsfirstplural}[2][]{%
\new@ifnextchar[{\@glsfirstplural@{#1}{#2}}{\@glsfirstplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glsfirstplural@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('glsfirstplural shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryfirstplural{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\@glo@text#3}%
}%
}
%    \end{macrocode}
%
% \cs{Glsfirstplural} behaves like \ics{glsfirstplural} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glsfirstplural}
%    \begin{macrocode}
\newcommand*{\Glsfirstplural}{\@ifstar\@sGlsfirstplural\@Glsfirstplural}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGlsfirstplural}[1][]{\@Glsfirstplural[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsfirstplural}[2][]{%
\new@ifnextchar[{\@Glsfirstplural@{#1}{#2}}{\@Glsfirstplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glsfirstplural@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('Glsfirstplural shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryfirstplural{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{%
  \expandafter\makefirstuc\expandafter{\@glo@text}#3}%
}%
}
%    \end{macrocode}
%
% \cs{GLSfirstplural} behaves like \ics{glsfirstplural} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSfirstplural}
%    \begin{macrocode}
\newcommand*{\GLSfirstplural}{\@ifstar\@sGLSfirstplural\@GLSfirstplural}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGLSfirstplural}[1][]{\@GLSfirstplural[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSfirstplural}[2][]{%
\new@ifnextchar[{\@GLSfirstplural@{#1}{#2}}{\@GLSfirstplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLSfirstplural@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('GLSfirstplural shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryfirstplural{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\MakeUppercase{\@glo@text#3}}%
}%
}
%    \end{macrocode}
%
% \cs{glsname} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{name} key and it doesn't mark the entry as
% used.
%\begin{macro}{\glsname}
%    \begin{macrocode}
\newcommand*{\glsname}{\@ifstar\@sglsname\@glsname}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sglsname}[1][]{\@glsname[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsname}[2][]{%
\new@ifnextchar[{\@glsname@{#1}{#2}}{\@glsname@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glsname@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('glsname shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryname{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\@glo@text#3}%
}%
}
%    \end{macrocode}
%
% \cs{Glsname} behaves like \ics{glsname} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glsname}
%    \begin{macrocode}
\newcommand*{\Glsname}{\@ifstar\@sGlsname\@Glsname}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGlsname}[1][]{\@Glsname[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsname}[2][]{%
\new@ifnextchar[{\@Glsname@{#1}{#2}}{\@Glsname@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glsname@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('glsname shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryname{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{%
  \expandafter\makefirstuc\expandafter{\@glo@text}#3}%
}%
}
%    \end{macrocode}
%
% \cs{GLSname} behaves like \ics{glsname} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSname}
%    \begin{macrocode}
\newcommand*{\GLSname}{\@ifstar\@sGLSname\@GLSname}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGLSname}[1][]{\@GLSname[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSname}[2][]{%
\new@ifnextchar[{\@GLSname@{#1}{#2}}{\@GLSname@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLSname@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('GLSname shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryname{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\MakeUppercase{\@glo@text#3}}%
}%
}
%    \end{macrocode}
%
% \cs{glsdesc} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{description} key and it doesn't mark the entry
% as used.
%\begin{macro}{\glsdesc}
%    \begin{macrocode}
\newcommand*{\glsdesc}{\@ifstar\@sglsdesc\@glsdesc}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sglsdesc}[1][]{\@glsdesc[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsdesc}[2][]{%
\new@ifnextchar[{\@glsdesc@{#1}{#2}}{\@glsdesc@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glsdesc@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('glsdesc shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentrydesc{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\@glo@text#3}%
}%
}
%    \end{macrocode}
%
% \cs{Glsdesc} behaves like \ics{glsdesc} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glsdesc}
%    \begin{macrocode}
\newcommand*{\Glsdesc}{\@ifstar\@sGlsdesc\@Glsdesc}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGlsdesc}[1][]{\@Glsdesc[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsdesc}[2][]{%
\new@ifnextchar[{\@Glsdesc@{#1}{#2}}{\@Glsdesc@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glsdesc@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('Glsdesc shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentrydesc{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{%
  \expandafter\makefirstuc\expandafter{\@glo@text}#3}%
}%
}
%    \end{macrocode}
%
% \cs{GLSdesc} behaves like \ics{glsdesc} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSdesc}
%    \begin{macrocode}
\newcommand*{\GLSdesc}{\@ifstar\@sGLSdesc\@GLSdesc}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGLSdesc}[1][]{\@GLSdesc[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSdesc}[2][]{%
\new@ifnextchar[{\@GLSdesc@{#1}{#2}}{\@GLSdesc@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLSdesc@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('GLSdesc shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentrydesc{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\MakeUppercase{\@glo@text#3}}%
}%
}
%    \end{macrocode}
%
% \cs{glsdescplural} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{descriptionplural} key and it doesn't mark the entry
% as used.
%\begin{macro}{\glsdescplural}
%    \begin{macrocode}
\newcommand*{\glsdescplural}{\@ifstar\@sglsdescplural\@glsdescplural}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sglsdescplural}[1][]{\@glsdescplural[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsdescplural}[2][]{%
\new@ifnextchar[{\@glsdescplural@{#1}{#2}}{\@glsdescplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glsdescplural@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentrydescplural{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\@glo@text#3}%
}%
}
%    \end{macrocode}
%
% \cs{Glsdescplural} behaves like \ics{glsdescplural} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glsdescplural}
%    \begin{macrocode}
\newcommand*{\Glsdescplural}{\@ifstar\@sGlsdescplural\@Glsdescplural}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGlsdescplural}[1][]{\@Glsdescplural[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsdescplural}[2][]{%
\new@ifnextchar[{\@Glsdescplural@{#1}{#2}}{\@Glsdescplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glsdescplural@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentrydescplural{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{%
  \expandafter\makefirstuc\expandafter{\@glo@text}#3}%
}%
}
%    \end{macrocode}
%
% \cs{GLSdescplural} behaves like \ics{glsdescplural} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSdescplural}
%    \begin{macrocode}
\newcommand*{\GLSdescplural}{\@ifstar\@sGLSdescplural\@GLSdescplural}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGLSdescplural}[1][]{\@GLSdescplural[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSdescplural}[2][]{%
\new@ifnextchar[{\@GLSdescplural@{#1}{#2}}{\@GLSdescplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLSdescplural@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentrydescplural{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\MakeUppercase{\@glo@text#3}}%
}%
}
%    \end{macrocode}
%
% \cs{glssymbol} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{symbol} key and it doesn't mark the entry as
% used.
%\begin{macro}{\glssymbol}
%    \begin{macrocode}
\newcommand*{\glssymbol}{\@ifstar\@sglssymbol\@glssymbol}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sglssymbol}[1][]{\@glssymbol[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glssymbol}[2][]{%
\new@ifnextchar[{\@glssymbol@{#1}{#2}}{\@glssymbol@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glssymbol@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('glssymbol shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentrysymbol{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\@glo@text#3}%
}%
}
%    \end{macrocode}
%
% \cs{Glssymbol} behaves like \ics{glssymbol} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glssymbol}
%    \begin{macrocode}
\newcommand*{\Glssymbol}{\@ifstar\@sGlssymbol\@Glssymbol}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGlssymbol}[1][]{\@Glssymbol[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glssymbol}[2][]{%
\new@ifnextchar[{\@Glssymbol@{#1}{#2}}{\@Glssymbol@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glssymbol@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('Glssymbol shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentrysymbol{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{%
   \expandafter\makefirstuc\expandafter{\@glo@text}#3}%
}%
}
%    \end{macrocode}
%
% \cs{GLSsymbol} behaves like \ics{glssymbol} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSsymbol}
%    \begin{macrocode}
\newcommand*{\GLSsymbol}{\@ifstar\@sGLSsymbol\@GLSsymbol}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGLSsymbol}[1][]{\@GLSsymbol[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSsymbol}[2][]{%
\new@ifnextchar[{\@GLSsymbol@{#1}{#2}}{\@GLSsymbol@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLSsymbol@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('GLSsymbol shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentrysymbol{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\MakeUppercase{\@glo@text#3}}%
}%
}
%    \end{macrocode}
%
% \cs{glssymbolplural} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{symbolplural} key and it doesn't mark the entry as
% used.
%\begin{macro}{\glssymbolplural}
%    \begin{macrocode}
\newcommand*{\glssymbolplural}{\@ifstar\@sglssymbolplural\@glssymbolplural}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sglssymbolplural}[1][]{\@glssymbolplural[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glssymbolplural}[2][]{%
\new@ifnextchar[{\@glssymbolplural@{#1}{#2}}{\@glssymbolplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glssymbolplural@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
% \changes{1.12}{2008 Mar 8}{fixed bug ('glssymbolplural shouldn't use
% 'gls@\meta{type}@display)}
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentrysymbolplural{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\@glo@text#3}%
}%
}
%    \end{macrocode}
%
% \cs{Glssymbolplural} behaves like \ics{glssymbolplural} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glssymbolplural}
%    \begin{macrocode}
\newcommand*{\Glssymbolplural}{\@ifstar\@sGlssymbolplural\@Glssymbolplural}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGlssymbolplural}[1][]{\@Glssymbolplural[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glssymbolplural}[2][]{%
\new@ifnextchar[{\@Glssymbolplural@{#1}{#2}}{\@Glssymbolplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glssymbolplural@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentrysymbolplural{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{%
   \expandafter\makefirstuc\expandafter{\@glo@text}#3}%
}%
}
%    \end{macrocode}
%
% \cs{GLSsymbolplural} behaves like \ics{glssymbolplural} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSsymbolplural}
%    \begin{macrocode}
\newcommand*{\GLSsymbolplural}{\@ifstar\@sGLSsymbolplural\@GLSsymbolplural}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGLSsymbolplural}[1][]{\@GLSsymbolplural[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSsymbolplural}[2][]{%
\new@ifnextchar[{\@GLSsymbolplural@{#1}{#2}}{\@GLSsymbolplural@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLSsymbolplural@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentrysymbolplural{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
% \changes{1.13}{2008 May 10}{fixed bug that ignores 3rd parameter}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\MakeUppercase{\@glo@text#3}}%
}%
}
%    \end{macrocode}
%
% \cs{glsuseri} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{user1} key and it doesn't mark the entry
% as used.
%\begin{macro}{\glsuseri}
%    \begin{macrocode}
\newcommand*{\glsuseri}{\@ifstar\@sglsuseri\@glsuseri}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sglsuseri}[1][]{\@glsuseri[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsuseri}[2][]{%
\new@ifnextchar[{\@glsuseri@{#1}{#2}}{\@glsuseri@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glsuseri@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryuseri{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\@glo@text#3}%
}%
}
%    \end{macrocode}
%
% \cs{Glsuseri} behaves like \ics{glsuseri} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glsuseri}
%    \begin{macrocode}
\newcommand*{\Glsuseri}{\@ifstar\@sGlsuseri\@Glsuseri}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGlsuseri}[1][]{\@Glsuseri[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsuseri}[2][]{%
\new@ifnextchar[{\@Glsuseri@{#1}{#2}}{\@Glsuseri@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glsuseri@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryuseri{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
\@gls@link[#1]{#2}{%
  \expandafter\makefirstuc\expandafter{\@glo@text}#3}%
}%
}
%    \end{macrocode}
%
% \cs{GLSuseri} behaves like \ics{glsuseri} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSuseri}
%    \begin{macrocode}
\newcommand*{\GLSuseri}{\@ifstar\@sGLSuseri\@GLSuseri}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGLSuseri}[1][]{\@GLSuseri[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSuseri}[2][]{%
\new@ifnextchar[{\@GLSuseri@{#1}{#2}}{\@GLSuseri@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLSuseri@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryuseri{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\MakeUppercase{\@glo@text#3}}%
}%
}
%    \end{macrocode}
%
% \cs{glsuserii} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{user2} key and it doesn't mark the entry
% as used.
%\begin{macro}{\glsuserii}
%    \begin{macrocode}
\newcommand*{\glsuserii}{\@ifstar\@sglsuserii\@glsuserii}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sglsuserii}[1][]{\@glsuserii[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsuserii}[2][]{%
\new@ifnextchar[{\@glsuserii@{#1}{#2}}{\@glsuserii@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glsuserii@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryuserii{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\@glo@text#3}%
}%
}
%    \end{macrocode}
%
% \cs{Glsuserii} behaves like \ics{glsuserii} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glsuserii}
%    \begin{macrocode}
\newcommand*{\Glsuserii}{\@ifstar\@sGlsuserii\@Glsuserii}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGlsuserii}[1][]{\@Glsuserii[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsuserii}[2][]{%
\new@ifnextchar[{\@Glsuserii@{#1}{#2}}{\@Glsuserii@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glsuserii@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryuserii{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
\@gls@link[#1]{#2}{%
  \expandafter\makefirstuc\expandafter{\@glo@text}#3}%
}%
}
%    \end{macrocode}
%
% \cs{GLSuserii} behaves like \ics{glsuserii} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSuserii}
%    \begin{macrocode}
\newcommand*{\GLSuserii}{\@ifstar\@sGLSuserii\@GLSuserii}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGLSuserii}[1][]{\@GLSuserii[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSuserii}[2][]{%
\new@ifnextchar[{\@GLSuserii@{#1}{#2}}{\@GLSuserii@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLSuserii@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryuserii{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\MakeUppercase{\@glo@text#3}}%
}%
}
%    \end{macrocode}
%
% \cs{glsuseriii} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{user3} key and it doesn't mark the entry
% as used.
%\begin{macro}{\glsuseriii}
%    \begin{macrocode}
\newcommand*{\glsuseriii}{\@ifstar\@sglsuseriii\@glsuseriii}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sglsuseriii}[1][]{\@glsuseriii[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsuseriii}[2][]{%
\new@ifnextchar[{\@glsuseriii@{#1}{#2}}{\@glsuseriii@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glsuseriii@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryuseriii{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\@glo@text#3}%
}%
}
%    \end{macrocode}
%
% \cs{Glsuseriii} behaves like \ics{glsuseriii} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glsuseriii}
%    \begin{macrocode}
\newcommand*{\Glsuseriii}{\@ifstar\@sGlsuseriii\@Glsuseriii}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGlsuseriii}[1][]{\@Glsuseriii[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsuseriii}[2][]{%
\new@ifnextchar[{\@Glsuseriii@{#1}{#2}}{\@Glsuseriii@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glsuseriii@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryuseriii{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
\@gls@link[#1]{#2}{%
  \expandafter\makefirstuc\expandafter{\@glo@text}#3}%
}%
}
%    \end{macrocode}
%
% \cs{GLSuseriii} behaves like \ics{glsuseriii} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSuseriii}
%    \begin{macrocode}
\newcommand*{\GLSuseriii}{\@ifstar\@sGLSuseriii\@GLSuseriii}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGLSuseriii}[1][]{\@GLSuseriii[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSuseriii}[2][]{%
\new@ifnextchar[{\@GLSuseriii@{#1}{#2}}{\@GLSuseriii@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLSuseriii@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryuseriii{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\MakeUppercase{\@glo@text#3}}%
}%
}
%    \end{macrocode}
%
% \cs{glsuseriv} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{user4} key and it doesn't mark the entry
% as used.
%\begin{macro}{\glsuseriv}
%    \begin{macrocode}
\newcommand*{\glsuseriv}{\@ifstar\@sglsuseriv\@glsuseriv}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sglsuseriv}[1][]{\@glsuseriv[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsuseriv}[2][]{%
\new@ifnextchar[{\@glsuseriv@{#1}{#2}}{\@glsuseriv@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glsuseriv@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryuseriv{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\@glo@text#3}%
}%
}
%    \end{macrocode}
%
% \cs{Glsuseriv} behaves like \ics{glsuseriv} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glsuseriv}
%    \begin{macrocode}
\newcommand*{\Glsuseriv}{\@ifstar\@sGlsuseriv\@Glsuseriv}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGlsuseriv}[1][]{\@Glsuseriv[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsuseriv}[2][]{%
\new@ifnextchar[{\@Glsuseriv@{#1}{#2}}{\@Glsuseriv@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glsuseriv@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryuseriv{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
\@gls@link[#1]{#2}{%
  \expandafter\makefirstuc\expandafter{\@glo@text}#3}%
}%
}
%    \end{macrocode}
%
% \cs{GLSuseriv} behaves like \ics{glsuseriv} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSuseriv}
%    \begin{macrocode}
\newcommand*{\GLSuseriv}{\@ifstar\@sGLSuseriv\@GLSuseriv}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGLSuseriv}[1][]{\@GLSuseriv[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSuseriv}[2][]{%
\new@ifnextchar[{\@GLSuseriv@{#1}{#2}}{\@GLSuseriv@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLSuseriv@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryuseriv{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\MakeUppercase{\@glo@text#3}}%
}%
}
%    \end{macrocode}
%
% \cs{glsuserv} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{user5} key and it doesn't mark the entry
% as used.
%\begin{macro}{\glsuserv}
%    \begin{macrocode}
\newcommand*{\glsuserv}{\@ifstar\@sglsuserv\@glsuserv}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sglsuserv}[1][]{\@glsuserv[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsuserv}[2][]{%
\new@ifnextchar[{\@glsuserv@{#1}{#2}}{\@glsuserv@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glsuserv@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryuserv{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\@glo@text#3}%
}%
}
%    \end{macrocode}
%
% \cs{Glsuserv} behaves like \ics{glsuserv} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glsuserv}
%    \begin{macrocode}
\newcommand*{\Glsuserv}{\@ifstar\@sGlsuserv\@Glsuserv}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGlsuserv}[1][]{\@Glsuserv[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsuserv}[2][]{%
\new@ifnextchar[{\@Glsuserv@{#1}{#2}}{\@Glsuserv@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glsuserv@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryuserv{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
\@gls@link[#1]{#2}{%
  \expandafter\makefirstuc\expandafter{\@glo@text}#3}%
}%
}
%    \end{macrocode}
%
% \cs{GLSuserv} behaves like \ics{glsuserv} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSuserv}
%    \begin{macrocode}
\newcommand*{\GLSuserv}{\@ifstar\@sGLSuserv\@GLSuserv}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGLSuserv}[1][]{\@GLSuserv[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSuserv}[2][]{%
\new@ifnextchar[{\@GLSuserv@{#1}{#2}}{\@GLSuserv@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLSuserv@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryuserv{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\MakeUppercase{\@glo@text#3}}%
}%
}
%    \end{macrocode}
%
% \cs{glsuservi} behaves like \ics{gls} except it always uses the value 
% given by the \gloskey{user6} key and it doesn't mark the entry
% as used.
%\begin{macro}{\glsuservi}
%    \begin{macrocode}
\newcommand*{\glsuservi}{\@ifstar\@sglsuservi\@glsuservi}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sglsuservi}[1][]{\@glsuservi[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@glsuservi}[2][]{%
\new@ifnextchar[{\@glsuservi@{#1}{#2}}{\@glsuservi@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@glsuservi@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryuservi{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\@glo@text#3}%
}%
}
%    \end{macrocode}
%
% \cs{Glsuservi} behaves like \ics{glsuservi} except that the
% first letter is converted to uppercase.
%\begin{macro}{\Glsuservi}
%    \begin{macrocode}
\newcommand*{\Glsuservi}{\@ifstar\@sGlsuservi\@Glsuservi}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGlsuservi}[1][]{\@Glsuservi[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@Glsuservi}[2][]{%
\new@ifnextchar[{\@Glsuservi@{#1}{#2}}{\@Glsuservi@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@Glsuservi@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryuservi{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
\@gls@link[#1]{#2}{%
  \expandafter\makefirstuc\expandafter{\@glo@text}#3}%
}%
}
%    \end{macrocode}
%
% \cs{GLSuservi} behaves like \ics{glsuservi} except that the
% link text is converted to uppercase.
%\begin{macro}{\GLSuservi}
%    \begin{macrocode}
\newcommand*{\GLSuservi}{\@ifstar\@sGLSuservi\@GLSuservi}
%    \end{macrocode}
%\end{macro}
% Define the starred form:
%    \begin{macrocode}
\newcommand*{\@sGLSuservi}[1][]{\@GLSuservi[hyper=false,#1]}
%    \end{macrocode}
% Defined the un-starred form. Need to determine if there is
% a final optional argument
%    \begin{macrocode}
\newcommand*{\@GLSuservi}[2][]{%
\new@ifnextchar[{\@GLSuservi@{#1}{#2}}{\@GLSuservi@{#1}{#2}[]}}
%    \end{macrocode}
% Read in the final optional argument:
%    \begin{macrocode}
\def\@GLSuservi@#1#2[#3]{%
\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
\protected@edef\@glo@text{\glsentryuservi{#2}}%
%    \end{macrocode}
% Call \cs{@gls@link}
%    \begin{macrocode}
\@gls@link[#1]{#2}{\MakeUppercase{\@glo@text#3}}%
}%
}
%    \end{macrocode}
%
% \subsubsection{Displaying entry details without adding
% information to the glossary}
%\label{sec:code:glsnolink}
% 
% These commands merely display entry information without adding
% entries in the associated file or having hyperlinks.
%
% Get the entry name (as specified by the \gloskey{name} key
% when the entry was defined). The argument
% is the label associated with the entry. Note that unless you
% used \texttt{name=false} in the \pkgopt{sanitize} package option 
% you may get unexpected results if the \gloskey{name} key contains 
% any commands.
%\begin{macro}{\glsentryname}
%    \begin{macrocode}
\newcommand*{\glsentryname}[1]{\csname glo@#1@name\endcsname}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryname}
%    \begin{macrocode}
\newcommand*{\Glsentryname}[1]{%
\protected@edef\@glo@text{\csname glo@#1@name\endcsname}%
\expandafter\makefirstuc\expandafter{\@glo@text}}
%    \end{macrocode}
%\end{macro}
%
% Get the entry description (as specified by the 
% \gloskey{description} when the entry was defined). The argument
% is the label associated with the entry. Note that unless you
% used \texttt{description=false} in the \pkgopt{sanitize} package 
% option you may get unexpected results if the \gloskey{description} 
% key contained any commands.
%\begin{macro}{\glsentrydesc}
%    \begin{macrocode}
\newcommand*{\glsentrydesc}[1]{\csname glo@#1@desc\endcsname}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentrydesc}
%    \begin{macrocode}
\newcommand*{\Glsentrydesc}[1]{%
\protected@edef\@glo@text{\csname glo@#1@desc\endcsname}%
\expandafter\makefirstuc\expandafter{\@glo@text}}
%    \end{macrocode}
%\end{macro}
% Plural form:
%\begin{macro}{\glsentrydescplural}
%\changes{1.12}{2008 Mar 8}{New}
%    \begin{macrocode}
\newcommand*{\glsentrydescplural}[1]{%
\csname glo@#1@descplural\endcsname}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentrydescplural}
%\changes{1.12}{2008 Mar 8}{New}
%    \begin{macrocode}
\newcommand*{\Glsentrydescplural}[1]{%
\protected@edef\@glo@text{\csname glo@#1@descplural\endcsname}%
\expandafter\makefirstuc\expandafter{\@glo@text}}
%    \end{macrocode}
%\end{macro}
%
% Get the entry text, as specified by the \gloskey{text} key when
% the entry was defined. The argument
% is the label associated with the entry:
%\begin{macro}{\glsentrytext}
%    \begin{macrocode}
\newcommand*{\glsentrytext}[1]{\csname glo@#1@text\endcsname}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentrytext}
%    \begin{macrocode}
\newcommand*{\Glsentrytext}[1]{%
\protected@edef\@glo@text{\csname glo@#1@text\endcsname}%
\expandafter\makefirstuc\expandafter{\@glo@text}}
%    \end{macrocode}
%\end{macro}
%
% Get the plural form:
%\begin{macro}{\glsentryplural}
%    \begin{macrocode}
\newcommand*{\glsentryplural}[1]{\csname glo@#1@plural\endcsname}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryplural}
%    \begin{macrocode}
\newcommand*{\Glsentryplural}[1]{%
\protected@edef\@glo@text{\csname glo@#1@plural\endcsname}%
\expandafter\makefirstuc\expandafter{\@glo@text}}
%    \end{macrocode}
%\end{macro}
%
% Get the symbol associated with this entry. The argument
% is the label associated with the entry. Note that unless you
% used \texttt{symbol=false} in the \pkgopt{sanitize} package 
% option you may get unexpected results if the \gloskey{symbol} 
% key contained any commands.
%\begin{macro}{\glsentrysymbol}
%    \begin{macrocode}
\newcommand*{\glsentrysymbol}[1]{\csname glo@#1@symbol\endcsname}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentrysymbol}
%    \begin{macrocode}
\newcommand*{\Glsentrysymbol}[1]{%
\protected@edef\@glo@text{\csname glo@#1@symbol\endcsname}%
\expandafter\makefirstuc\expandafter{\@glo@text}}
%    \end{macrocode}
%\end{macro}
% Plural form:
%\begin{macro}{\glsentrysymbolplural}
%\changes{1.12}{2008 Mar 8}{New}
%    \begin{macrocode}
\newcommand*{\glsentrysymbolplural}[1]{%
\csname glo@#1@symbolplural\endcsname}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentrysymbolplural}
%\changes{1.12}{2008 Mar 8}{New}
%    \begin{macrocode}
\newcommand*{\Glsentrysymbolplural}[1]{%
\protected@edef\@glo@text{\csname glo@#1@symbolplural\endcsname}%
\expandafter\makefirstuc\expandafter{\@glo@text}}
%    \end{macrocode}
%\end{macro}
%
% Get the entry text to be used when the entry is first used in
% the document (as specified by the \gloskey{first} key when
% the entry was defined).
%\begin{macro}{\glsentryfirst}
%    \begin{macrocode}
\newcommand*{\glsentryfirst}[1]{\csname glo@#1@first\endcsname}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryfirst}
%    \begin{macrocode}
\newcommand*{\Glsentryfirst}[1]{%
\protected@edef\@glo@text{\csname glo@#1@first\endcsname}%
\expandafter\makefirstuc\expandafter{\@glo@text}}
%    \end{macrocode}
%\end{macro}
%
% Get the plural form (as specified by the \gloskey{firstplural}
% key when the entry was defined).
%\begin{macro}{\glsentryfirstplural}
%    \begin{macrocode}
\newcommand*{\glsentryfirstplural}[1]{%
\csname glo@#1@firstpl\endcsname}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryfirstplural}
%    \begin{macrocode}
\newcommand*{\Glsentryfirstplural}[1]{%
\protected@edef\@glo@text{\csname glo@#1@firstpl\endcsname}%
\expandafter\makefirstuc\expandafter{\@glo@text}}
%    \end{macrocode}
%\end{macro}
%
% Display the glossary type with which this entry is associated
% (as specified by the \gloskey{type} key used when the entry was 
% defined)
%\begin{macro}{\glsentrytype}
%    \begin{macrocode}
\newcommand*{\glsentrytype}[1]{\csname glo@#1@type\endcsname}
%    \end{macrocode}
%\end{macro}
%
% Display the sort text used for this entry. Note that the 
% \gloskey{sort} key is sanitize, so unexpected results may 
% occur if the \gloskey{sort} key contained commands.
%\begin{macro}{\glsentrysort}
%    \begin{macrocode}
\newcommand*{\glsentrysort}[1]{\csname glo@#1@sort\endcsname}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryuseri}
% Get the first user key (as specified by the 
% \gloskey{user1} when the entry was defined). The argument
% is the label associated with the entry.
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\glsentryuseri}[1]{\csname glo@#1@useri\endcsname}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryuseri}
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\Glsentryuseri}[1]{%
\protected@edef\@glo@text{\csname glo@#1@useri\endcsname}%
\expandafter\makefirstuc\expandafter{\@glo@text}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryuserii}
% Get the second user key (as specified by the 
% \gloskey{user2} when the entry was defined). The argument
% is the label associated with the entry.
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\glsentryuserii}[1]{\csname glo@#1@userii\endcsname}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryuserii}
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\Glsentryuserii}[1]{%
\protected@edef\@glo@text{\csname glo@#1@userii\endcsname}%
\expandafter\makefirstuc\expandafter{\@glo@text}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryuseriii}
% Get the third user key (as specified by the 
% \gloskey{user3} when the entry was defined). The argument
% is the label associated with the entry.
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\glsentryuseriii}[1]{\csname glo@#1@useriii\endcsname}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryuseriii}
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\Glsentryuseriii}[1]{%
\protected@edef\@glo@text{\csname glo@#1@useriii\endcsname}%
\expandafter\makefirstuc\expandafter{\@glo@text}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryuseriv}
% Get the fourth user key (as specified by the 
% \gloskey{user4} when the entry was defined). The argument
% is the label associated with the entry.
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\glsentryuseriv}[1]{\csname glo@#1@useriv\endcsname}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryuseriv}
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\Glsentryuseriv}[1]{%
\protected@edef\@glo@text{\csname glo@#1@useriv\endcsname}%
\expandafter\makefirstuc\expandafter{\@glo@text}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryuserv}
% Get the fifth user key (as specified by the 
% \gloskey{user5} when the entry was defined). The argument
% is the label associated with the entry.
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\glsentryuserv}[1]{\csname glo@#1@userv\endcsname}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryuserv}
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\Glsentryuserv}[1]{%
\protected@edef\@glo@text{\csname glo@#1@userv\endcsname}%
\expandafter\makefirstuc\expandafter{\@glo@text}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsentryuservi}
% Get the sixth user key (as specified by the 
% \gloskey{user6} when the entry was defined). The argument
% is the label associated with the entry.
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\glsentryuservi}[1]{\csname glo@#1@uservi\endcsname}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Glsentryuservi}
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\Glsentryuservi}[1]{%
\protected@edef\@glo@text{\csname glo@#1@uservi\endcsname}%
\expandafter\makefirstuc\expandafter{\@glo@text}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glshyperlink}
% Provide a hyperlink to a glossary entry without adding information
% to the glossary file. The entry needs to be added using a 
% command like \ics{glslink} or \ics{glsadd} to ensure that
% the target is defined. The first (optional) argument specifies
% the link text. The entry name is used by default. The second
% argument is the entry label.
%\changes{1.17}{2008 December 26}{new}
%    \begin{macrocode}
\newcommand*{\glshyperlink}[2][\glsentryname{\@glo@label}]{%
\def\@glo@label{#2}%
\@glslink{glo:#2}{#1}}
%    \end{macrocode}
%\end{macro}
%
%\subsection{Adding an entry to the glossary without generating
% text}
% The following keys are provided for \cs{glsadd} and 
% \cs{glsaddall}:
%    \begin{macrocode}
\define@key{glossadd}{counter}{\def\@gls@counter{#1}}
%    \end{macrocode}
%\changes{2.07}{2010 Jul 10}{glssadd format key stored in \cs{@glsnumberformat}
%(was mistakenly stored in \cs{@glo@format})}
%    \begin{macrocode}
\define@key{glossadd}{format}{\def\@glsnumberformat{#1}}
%    \end{macrocode}
% This key is only used by \cs{glsaddall}:
%    \begin{macrocode}
\define@key{glossadd}{types}{\def\@glo@type{#1}}
%    \end{macrocode}
%\vskip5pt
%\cs{glsadd}\oarg{options}\marg{label}\\[10pt]
% Add a term to the glossary without generating any link text. 
% The optional argument indicates which counter to use, 
% and how to format it (using a key-value list)
% the second argument is the entry label. Note that \meta{options}
% only has two keys: \gloskey[glsadd]{counter} and \gloskey[glsadd]{format} (the \gloskey[glsaddall]{types} key will be ignored).
%\begin{macro}{\glsadd}
%\changes{1.07}{2007 Sep 13}{fixed bug caused by \cs{theglsentrycounter} setting the page number too soon}
%\changes{2.04}{2009 November 10}{fixed bug that ignored counter}
%    \begin{macrocode}
\newcommand*{\glsadd}[2][]{%
\glsdoifexists{#2}{%
\def\@glsnumberformat{glsnumberformat}%
\edef\@gls@counter{\csname glo@#2@counter\endcsname}%
\setkeys{glossadd}{#1}%
\edef\theglsentrycounter{\expandafter\noexpand
  \csname the\@gls@counter\endcsname}%
\@do@wrglossary{#2}%
}}
%    \end{macrocode}
%\end{macro}
%\vskip5pt
%\cs{glsaddall}\oarg{glossary list}\\[10pt]
% Add all terms defined for the listed glossaries (without displaying
% any text). If \gloskey[glsaddall]{types} key is omitted, apply to all
% glossary types.
%\begin{macro}{\glsaddall}
%    \begin{macrocode}
\newcommand*{\glsaddall}[1][]{%
\edef\@glo@type{\@glo@types}%
\setkeys{glossadd}{#1}%
\forallglsentries[\@glo@type]{\@glo@entry}{%
\glsadd[#1]{\@glo@entry}}%
}
%    \end{macrocode}
%\end{macro}
%
%\subsection{Creating associated files}
% The \cs{writeist} command creates the associated 
% customized \filetype{.ist} \app{makeindex} style file.
% While defining this command, some characters have their 
% catcodes temporarily changed to ensure they get written to 
% the \filetype{.ist} file correctly. The \app{makeindex} 
% actual character (usually "@") is redefined to be a "?", to allow 
% internal commands to be written to the glossary file output file.
%
% The special characters\mkidxspch\ are stored in \cs{@gls@actualchar},
% \cs{@gls@encapchar}, \cs{@glsl@levelchar} and
% \cs{@gls@quotechar} to make them easier to use later,
% but don't change these values, because the characters are
% encoded in the command definitions that are used to escape
% the special characters (which means that the user no longer
% needs to worry about \app{makeindex} special characters).
%
% The symbols and numbers label for group headings are hardwired into
% the \filetype{.ist} file as \texttt{glssymbols} and 
% \texttt{glsnumbers}, the group titles can be translated 
% (so that \ics{glssymbolsgroupname} replaces \texttt{glssymbols}
% and \ics{glsnumbersgroupname} replaces \texttt{glsnumbers})
% using the command \ics{glsgetgrouptitle} which is
% defined in \isty{glossary-hypernav}. This is done to prevent
% any problem characters in \ics{glssymbolsgroupname}
% and \ics{glsnumbersgroupname} from breaking hyperlinks.
%
%\begin{macro}{\glsopenbrace}
% Define \cs{glsopenbrace} to make it easier to write an opening 
% brace to a file.
%    \begin{macrocode}
\edef\glsopenbrace{\expandafter\@gobble\string\{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsclosebrace}
% Define \cs{glsclosebrace} to make it easier to write an opening 
% brace to a file.
%    \begin{macrocode}
\edef\glsclosebrace{\expandafter\@gobble\string\}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsquote}
% Define command that makes it easier to write quote marks to
% a file in the event that the double quote character has been
% made active.
%    \begin{macrocode}
\edef\glsquote#1{\string"#1\string"}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsfirstletter}
% Define the first letter to come after the digits 0,\ldots,9.
% Only required for \app{xindy}.
%    \begin{macrocode}
\ifglsxindy
  \newcommand*{\@glsfirstletter}{A}
\fi
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\GlsSetXdyFirstLetterAfterDigits}
% Sets the first letter to come after the digits 0,\ldots,9.
%    \begin{macrocode}
\ifglsxindy
  \newcommand*{\GlsSetXdyFirstLetterAfterDigits}[1]{%
    \renewcommand*{\@glsfirstletter}{#1}}
\else
  \newcommand*{\GlsSetXdyFirstLetterAfterDigits}[1]{%
    \glsnoxindywarning\GlsSetXdyFirstLetterAfterDigits}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glsminrange}
% Define the minimum number of successive location references
% to merge into a range.
%    \begin{macrocode}
\newcommand*{\@glsminrange}{2}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\GlsSetXdyMinRangeLength}
% Set the minimum range length. The value must either be "none"
% or a positive integer. The \sty{glossaries} package doesn't
% check if the argument is valid, that is left to \app{xindy}.
%    \begin{macrocode}
\ifglsxindy
  \newcommand*{\GlsSetXdyMinRangeLength}[1]{%
    \renewcommand*{\@glsminrange}{#1}}
\else
  \newcommand*{\GlsSetXdyMinRangeLength}[1]{%
    \glsnoxindywarning\GlsSetXdyMinRangeLength}
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\writeist}
%\changes{1.17}{2008 December 26}{added xindy support}
%\changes{1.01}{2007 May 17}{Added spaces after 'delimN and 'delimR in ist file}%
%    \begin{macrocode}
\newwrite\istfile
\ifglsxindy
%    \end{macrocode}
% Code to use if \app{xindy} is required.
%    \begin{macrocode}
  \def\writeist{%
%    \end{macrocode}
% Open the style file
%    \begin{macrocode}
    \openout\istfile=\istfilename
%    \end{macrocode}
% Write header comment at the start of the file
%    \begin{macrocode}
    \write\istfile{;; xindy style file created by the glossaries
      package}%
    \write\istfile{;; for document '\jobname' on 
      \the\year-\the\month-\the\day}%
%    \end{macrocode}
% Specify the required styles
%    \begin{macrocode}
    \write\istfile{^^J; required styles^^J}
    \@for\@xdystyle:=\@xdyrequiredstyles\do{%
       \ifx\@xdystyle\@empty
       \else
         \protected@write\istfile{}{(require 
           \string"\@xdystyle.xdy\string")}%
       \fi
    }%
%    \end{macrocode}
% List the allowed attributes (possible values used by the
% \gloskey{format} key)
%    \begin{macrocode}
    \write\istfile{^^J%
       ; list of allowed attributes (number formats)^^J}%
    \write\istfile{(define-attributes ((\@xdyattributes)))}%
%    \end{macrocode}
% Define any additional alphabets
%    \begin{macrocode}
    \write\istfile{^^J; user defined alphabets^^J}%
    \write\istfile{\@xdyuseralphabets}%
%    \end{macrocode}
% Define location classes.
%    \begin{macrocode}
    \write\istfile{^^J; location class definitions^^J}%
%    \end{macrocode}
% Lower case Roman numerals (i, ii, \ldots). In the event that
% \ics{roman} has been redefined to produce a fancy form of
% roman numerals, attempt to work out how it will be written
% to the output file.
%    \begin{macrocode}
    \protected@edef\@gls@roman{\@roman{0\string" 
      \string"roman-numbers-lowercase\string" :sep \string"}}%
    \@onelevel@sanitize\@gls@roman
    \edef\@tmp{\string" \string"roman-numbers-lowercase\string"
       :sep \string"}%
    \@onelevel@sanitize\@tmp
    \ifx\@tmp\@gls@roman
       \write\istfile{(define-location-class
         \string"roman-page-numbers\string"^^J\space\space\space
         (\string"roman-numbers-lowercase\string")
         :min-range-length \@glsminrange)}%
    \else
       \write\istfile{(define-location-class
         \string"roman-page-numbers\string"^^J\space\space\space
         (:sep "\@gls@roman")
         :min-range-length \@glsminrange)}%
    \fi
%    \end{macrocode}
% Upper case Roman numerals (I, II, \ldots)
%    \begin{macrocode}
    \write\istfile{(define-location-class
      \string"Roman-page-numbers\string"^^J\space\space\space
      (\string"roman-numbers-uppercase\string")
         :min-range-length \@glsminrange)}%
%    \end{macrocode}
% Arabic numbers (1, 2, \ldots)
%    \begin{macrocode}
    \write\istfile{(define-location-class 
      \string"arabic-page-numbers\string"^^J\space\space\space
      (\string"arabic-numbers\string")
         :min-range-length \@glsminrange)}%
%    \end{macrocode}
% Lower case alphabetical locations (a, b, \ldots)
%    \begin{macrocode}
    \write\istfile{(define-location-class 
      \string"alpha-page-numbers\string"^^J\space\space\space
      (\string"alpha\string")
         :min-range-length \@glsminrange)}%
%    \end{macrocode}
% Upper case alphabetical locations (A, B, \ldots)
%    \begin{macrocode}
    \write\istfile{(define-location-class
      \string"Alpha-page-numbers\string"^^J\space\space\space
      (\string"ALPHA\string")
         :min-range-length \@glsminrange)}%
%    \end{macrocode}
% Appendix style locations (e.g.\ A-1, A-2, \ldots, B-1, B-2,
% \ldots). The separator is given by \ics{@glsAlphacompositor}.
%    \begin{macrocode}
    \write\istfile{(define-location-class
      \string"Appendix-page-numbers\string"^^J\space\space\space
      (\string"ALPHA\string"
       :sep \string"\@glsAlphacompositor\string"
       \string"arabic-numbers\string")
         :min-range-length \@glsminrange)}%
%    \end{macrocode}
% Section number style locations (e.g.\ 1.1, 1.2, \ldots). The
% compositor is given by \ics{glscompositor}.
%    \begin{macrocode}
    \write\istfile{(define-location-class
      \string"arabic-section-numbers\string"^^J\space\space\space
      (\string"arabic-numbers\string"
       :sep \string"\glscompositor\string"
       \string"arabic-numbers\string")
         :min-range-length \@glsminrange)}%
%    \end{macrocode}
% User defined location classes.
%    \begin{macrocode}
    \write\istfile{^^J; user defined location classes}%
    \write\istfile{\@xdyuserlocationdefs}%
%    \end{macrocode}
% Cross-reference class. (The unverified option is used as the
% cross-references are supplied using the list of labels along with
% the optional argument for \ics{glsseeformat} which
% \app{xindy} won't recognise.)
%    \begin{macrocode}
    \write\istfile{^^J; define cross-reference class^^J}%
    \write\istfile{(define-crossref-class \string"see\string"
      :unverified )}%
%    \end{macrocode}
% Define how cross-references should be displayed. This adds an
% empty set of braces after the cross-referencing information 
% allowing for the final argument of \cs{glsseeformat} which
% gets ignored. (When using \app{makeindex} this final argument
% contains the location information which is not required.)
%    \begin{macrocode}
    \write\istfile{(markup-crossref-list
       :class \string"see\string"^^J\space\space\space
       :open \string"\string\glsseeformat\string"
       :close \string"{}\string")}%
%    \end{macrocode}
% List the order to sort the classes.
%    \begin{macrocode}
    \write\istfile{^^J; define the order of the location classes}%
    \write\istfile{(define-location-class-order
       (\@xdylocationclassorder))}%
%    \end{macrocode}
% Specify what to write to the start and end of the glossary file.
%    \begin{macrocode}
    \write\istfile{^^J; define the glossary markup^^J}%
    \write\istfile{(markup-index^^J\space\space\space
      :open \string"\string
      \glossarysection[\string\glossarytoctitle]{\string
      \glossarytitle}\string\glossarypreamble\string~n\string\begin
      {theglossary}\string\glossaryheader\string~n\string" ^^J\space
      \space\space:close \string"\expandafter\@gobble
        \string\%\string~n\string
        \end{theglossary}\string\glossarypostamble
        \string~n\string" ^^J\space\space\space
      :tree)}%
%    \end{macrocode}
% Specify what to put between letter groups
%    \begin{macrocode}
    \write\istfile{(markup-letter-group-list
      :sep \string"\string\glsgroupskip\string~n\string")}%
%    \end{macrocode}
% Specify what to put between entries
%    \begin{macrocode}
    \write\istfile{(markup-indexentry
      :open \string"\string\relax \string\glsresetentrylist
         \string~n\string")}%
%    \end{macrocode}
% Specify how to format entries
%    \begin{macrocode}
    \write\istfile{(markup-locclass-list :open 
     \string"\glsopenbrace\string\glossaryentrynumbers
       \glsopenbrace\string\relax\space \string"^^J\space\space\space
     :sep \string", \string"
     :close \string"\glsclosebrace\glsclosebrace\string")}%
%    \end{macrocode}
% Specify how to separate location numbers
%    \begin{macrocode}
    \write\istfile{(markup-locref-list
     :sep \string"\string\delimN\space\string")}%
%    \end{macrocode}
% Specify how to indicate location ranges
%    \begin{macrocode}
    \write\istfile{(markup-range
     :sep \string"\string\delimR\space\string")}%
%    \end{macrocode}
% Specify 2-page and 3-page suffixes, if defined.
% First, the values must be sanitized to write them explicity.
%    \begin{macrocode}
    \@onelevel@sanitize\gls@suffixF
    \@onelevel@sanitize\gls@suffixFF
%    \end{macrocode}
%    \begin{macrocode}
    \ifx\gls@suffixF\@empty
    \else
      \write\istfile{(markup-range
      :close "\gls@suffixF" :length 1 :ignore-end)}%
    \fi
    \ifx\gls@suffixFF\@empty
    \else
      \write\istfile{(markup-range
      :close "\gls@suffixFF" :length 2 :ignore-end)}%
    \fi
%    \end{macrocode}
% Specify how to format locations.
%    \begin{macrocode}
    \write\istfile{^^J; define format to use for locations^^J}%
    \write\istfile{\@xdylocref}%
%    \end{macrocode}
% Specify how to separate letter groups.
%    \begin{macrocode}
    \write\istfile{^^J; define letter group list format^^J}%
    \write\istfile{(markup-letter-group-list
     :sep \string"\string\glsgroupskip\string~n\string")}%
%    \end{macrocode}
% Define letter group headings.
%    \begin{macrocode}
    \write\istfile{^^J; letter group headings^^J}%
    \write\istfile{(markup-letter-group 
      :open-head \string"\string\glsgroupheading
      \glsopenbrace\string"^^J\space\space\space
      :close-head \string"\glsclosebrace\string")}%
%    \end{macrocode}
% Define additional letter groups.
%    \begin{macrocode}
    \write\istfile{^^J; additional letter groups^^J}%
    \write\istfile{\@xdylettergroups}%
%    \end{macrocode}
% Define additional sort rules
%    \begin{macrocode}
    \write\istfile{^^J; additional sort rules^^J}
    \write\istfile{\@xdysortrules}%
  \noist}
\else
%    \end{macrocode}
% Code to use if \app{makeindex} is required.
%\changes{2.01}{2009 May 30}{removed item\_02 - no such makeindex key}
%    \begin{macrocode}
  \edef\@gls@actualchar{\string?}
  \edef\@gls@encapchar{\string|}
  \edef\@gls@levelchar{\string!}
  \edef\@gls@quotechar{\string"}
  \def\writeist{\relax
    \openout\istfile=\istfilename
    \write\istfile{\expandafter\@gobble\string\% makeindex style file
      created by the glossaries package}
    \write\istfile{\expandafter\@gobble\string\% for document
      '\jobname' on \the\year-\the\month-\the\day}
    \write\istfile{actual '\@gls@actualchar'}
    \write\istfile{encap '\@gls@encapchar'}
    \write\istfile{level '\@gls@levelchar'}
    \write\istfile{quote '\@gls@quotechar'}
    \write\istfile{keyword \string"\string\\glossaryentry\string"}
    \write\istfile{preamble \string"\string\\glossarysection[\string
      \\glossarytoctitle]{\string\\glossarytitle}\string
      \\glossarypreamble\string\n\string\\begin{theglossary}\string
      \\glossaryheader\string\n\string"}
    \write\istfile{postamble \string"\string\%\string\n\string
      \\end{theglossary}\string\\glossarypostamble\string\n
      \string"}
    \write\istfile{group_skip \string"\string\\glsgroupskip\string\n
      \string"}
    \write\istfile{item_0 \string"\string\%\string\n\string"}
    \write\istfile{item_1 \string"\string\%\string\n\string"}
    \write\istfile{item_2 \string"\string\%\string\n\string"}
    \write\istfile{item_01 \string"\string\%\string\n\string"}
    \write\istfile{item_x1
      \string"\string\\relax \string\\glsresetentrylist\string\n
      \string"}
    \write\istfile{item_12 \string"\string\%\string\n\string"}
    \write\istfile{item_x2
      \string"\string\\relax \string\\glsresetentrylist\string\n
      \string"}
%    \end{macrocode}
%\changes{2.05}{2010 Feb 6}{Added \cs{string} before opening 
% and closing braces. Patch provided by Segiu Dotenco}
%    \begin{macrocode}
    \write\istfile{delim_0 \string"\string\{\string
      \\glossaryentrynumbers\string\{\string\\relax \string"}
    \write\istfile{delim_1 \string"\string\{\string
      \\glossaryentrynumbers\string\{\string\\relax \string"}
    \write\istfile{delim_2 \string"\string\{\string
      \\glossaryentrynumbers\string\{\string\\relax \string"}
    \write\istfile{delim_t \string"\string\}\string\}\string"}
    \write\istfile{delim_n \string"\string\\delimN \string"}
    \write\istfile{delim_r \string"\string\\delimR \string"}
    \write\istfile{headings_flag 1}
    \write\istfile{heading_prefix 
       \string"\string\\glsgroupheading\string\{\string"}
    \write\istfile{heading_suffix
       \string"\string\}\string\\relax
       \string\\glsresetentrylist \string"}
    \write\istfile{symhead_positive \string"glssymbols\string"}
    \write\istfile{numhead_positive \string"glsnumbers\string"}
    \write\istfile{page_compositor \string"\glscompositor\string"}
    \@gls@escbsdq\gls@suffixF
    \@gls@escbsdq\gls@suffixFF
    \ifx\gls@suffixF\@empty
    \else
      \write\istfile{suffix_2p \string"\gls@suffixF\string"}
    \fi
    \ifx\gls@suffixFF\@empty
    \else
      \write\istfile{suffix_3p \string"\gls@suffixFF\string"}
    \fi
    \noist
  }
\fi
%    \end{macrocode}
%\end{macro}
%
%The command \cs{noist} will suppress the creation of
% the \filetype{.ist} file (it simply redefines 
% \cs{writeist} to do nothing). Obviously you need to use this
% command before \cs{writeist} to have any effect. Since
% the \filetype{.ist} file should only be created once, \cs{noist}
% is called at the end of \cs{writeist}.
%\begin{macro}{\noist}
%    \begin{macrocode}
\newcommand{\noist}{\let\writeist\relax}
%    \end{macrocode}
%\end{macro}
%
% \cs{@makeglossary} is an internal command that takes an 
% argument indicating the glossary type. This command will 
% create the glossary file required by \app{makeindex} for the
% given glossary type, using the extension supplied by the
% \meta{out-ext} parameter used in \ics{newglossary} 
% (and it will also activate the \ics{glossary} command, 
% and create the customized \filetype{.ist} \app{makeindex} 
% style file). 
%
% Note that you can't use \cs{@makeglossary} for only some of the
% defined glossaries. You either need to have a \cs{makeglossary}
% for all glossaries or none (otherwise you will end up with a
% situation where \TeX\ is trying to write to a non-existant
% file). The relevant glossary must be
% defined prior to using \cs{@makeglossary}.
%\begin{macro}{\@makeglossary}
%    \begin{macrocode}
\newcommand*{\@makeglossary}[1]{%
\ifglossaryexists{#1}{%
\edef\glo@out{\csname @glotype@#1@out\endcsname}%
\expandafter\newwrite\csname glo@#1@file\endcsname
\edef\@glo@file{\csname glo@#1@file\endcsname}%
\immediate\openout\@glo@file=\jobname.\glo@out
\@gls@renewglossary
\PackageInfo{glossaries}{Writing glossary file \jobname.\glo@out}
\writeist
}{\PackageError{glossaries}{%
Glossary type `#1' not defined}{New glossaries must be defined before
using \string\makeglossary}}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\warn@nomakeglossaries}
% Issue warning that \cs{makeglossaries} hasn't been used.
%    \begin{macrocode}
\newcommand*{\warn@nomakeglossaries}{%
  \GlossariesWarningNoLine{\string\makeglossaries\space
  hasn't been used,^^Jthe glossaries will not be updated}%
}
%    \end{macrocode}
%\end{macro}
%
% \cs{makeglossaries} will use \cs{@makeglossary}
% for each glossary type that has been defined.  New glossaries
% need to be defined before using \cs{makeglossary}, so
% have \cs{makeglossaries} redefine \cs{newglossary}
% to prevent it being used afterwards.
%\begin{macro}{\makeglossaries}
%    \begin{macrocode}
\newcommand*{\makeglossaries}{%
% Write the name of the style file to the aux file 
% (needed by \app{makeglossaries})
%    \begin{macrocode}
  \protected@write\@auxout{}{\string\@istfilename{\istfilename}}%
  \protected@write\@auxout{}{\string\@glsorder{\glsorder}}
%    \end{macrocode}
% Iterate through each glossary type and activate it.
%    \begin{macrocode}
  \@for\@glo@type:=\@glo@types\do{%
    \ifthenelse{\equal{\@glo@type}{}}{}{%
    \@makeglossary{\@glo@type}}%
  }%
%    \end{macrocode}
% New glossaries must be created before \cs{makeglossaries} 
% so disable \ics{newglossary}.
%    \begin{macrocode}
  \renewcommand*\newglossary[4][]{%
  \PackageError{glossaries}{New glossaries
  must be created before \string\makeglossaries}{You need
  to move \string\makeglossaries\space after all your 
  \string\newglossary\space commands}}%
%    \end{macrocode}
% Any subsequence instances of this command should have no effect
%    \begin{macrocode}
  \let\@makeglossary\relax
  \let\makeglossary\relax
  \let\makeglossaries\relax
%    \end{macrocode}
% Disable all commands that have no effect after \cs{makeglossaries}
%    \begin{macrocode}
  \@disable@onlypremakeg
%    \end{macrocode}
% Suppress warning about no \cs{makeglossaries}
%    \begin{macrocode}
  \let\warn@nomakeglossaries\relax
}
%    \end{macrocode}
%\end{macro}
%
% The \cs{makeglossary} command is redefined to be
% identical to \cs{makeglossaries}. (This is done to 
% reinforce the message that you must either use 
% \cs{@makeglossary} for all the glossaries or for none 
% of them.)
%\begin{macro}{\makeglossary}
%    \begin{macrocode}
\let\makeglossary\makeglossaries
%    \end{macrocode}
%\end{macro}
%
% If \ics{makeglossaries} hasn't been used, issue a warning.
% Also issue a warning if neither \ics{printglossaries} nor
% \ics{printglossary} have been used.
%    \begin{macrocode}
\AtEndDocument{%
  \warn@nomakeglossaries
  \warn@noprintglossary
}
%    \end{macrocode}
%
%\subsection{Writing information to associated files}
% The \cs{glossary} command is redefined so that it takes an 
% optional argument \meta{type} to specify the glossary type (use 
% \cs{glsdefaulttype} glossary by default). 
% This shouldn't be used at user level
% as \cs{glslink} sets the correct format. The associated 
% number should be stored in \cs{theglsentrycounter}
% before using \cs{glossary}.
%\begin{macro}{\glossary}
%    \begin{macrocode}
\renewcommand*{\glossary}[1][\glsdefaulttype]{%
\@glossary[#1]}
%    \end{macrocode}
%\end{macro}
%
% Define internal \cs{@glossary} to ignore its argument.
% This gets redefined in \cs{@makeglossary}. This is
% defined to just \cs{index} as \cls{memoir} changes the definition of
% \cs{@index}. (Thanks to Dan Luecking for pointing this out.)
%\begin{macro}{\@glossary}
%\changes{1.17}{2008 December 26}{changed definition to use
%\cs{index} instead of \cs{@index}}
%    \begin{macrocode}
\def\@glossary[#1]{\index}
%    \end{macrocode}
%\end{macro}
% This is a convenience command to set \cs{@glossary}.
% It is used by \cs{@makeglossary} and then redefined to
% do nothing, as it only needs to be done once.
%\begin{macro}{\@gls@renewglossary}
%    \begin{macrocode}
\newcommand{\@gls@renewglossary}{%
\gdef\@glossary[##1]{\@bsphack\begingroup\@wrglossary{##1}}%
\let\@gls@renewglossary\@empty
}
%    \end{macrocode}
%\end{macro}
% The \cs{@wrglossary} command is redefined to have
% two arguments. The first argument is the glossary type, 
% the second argument is the glossary entry 
% (the format of which is set in \cs{glslink}).
%\begin{macro}{\@wrglossary}
%\changes{1.17}{2008 December 26}{modified to allow for xindy support}
%    \begin{macrocode}
\renewcommand*{\@wrglossary}[2]{%
  \expandafter\protected@write\csname glo@#1@file\endcsname{}{#2}%
  \endgroup\@esphack
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@do@wrglossary}
%\changes{1.17}{2008 December 26}{new}
% Write the glossary entry in the appropriate format.
% (Need to set \@glsnumberformat and \@gls@counter prior to use.)
% The argument is the entry's label.
%    \begin{macrocode}
\newcommand{\@do@wrglossary}[1]{%
%    \end{macrocode}
% Determine whether to use \app{xindy} or \app{makeindex}
% syntax
%    \begin{macrocode}
\ifglsxindy
%    \end{macrocode}
% Need to determine if the formatting information starts with
% a ( or ) indicating a range.
%    \begin{macrocode}
  \expandafter\@glo@check@mkidxrangechar\@glsnumberformat\@nil
  \def\@glo@range{}%
  \expandafter\if\@glo@prefix(\relax
    \def\@glo@range{:open-range}%
  \else
    \expandafter\if\@glo@prefix)\relax
      \def\@glo@range{:close-range}%
    \fi
  \fi
%    \end{macrocode}
% Get the location and escape any special characters
%    \begin{macrocode}
\protected@edef\@glslocref{\theglsentrycounter}%
\@gls@checkmkidxchars\@glslocref
%    \end{macrocode}
% Write to the glossary file using \app{xindy} syntax.
%    \begin{macrocode}
  \glossary[\csname glo@#1@type\endcsname]{%
  (indexentry :tkey (\csname glo@#1@index\endcsname)
    :locref \string"\@glslocref\string" %
    :attr \string"\@glo@suffix\string" \@glo@range
  )
  }%
\else
%    \end{macrocode}
% Convert the format information into the format required for
% \app{makeindex}
%    \begin{macrocode}
  \@set@glo@numformat\@glo@numfmt\@gls@counter\@glsnumberformat
%    \end{macrocode}
% Write to the glossary file using \app{makeindex} syntax.
%    \begin{macrocode}
  \glossary[\csname glo@#1@type\endcsname]{%
  \string\glossaryentry{\csname glo@#1@index\endcsname
    \@gls@encapchar\@glo@numfmt}{\theglsentrycounter}}%
\fi
}
%    \end{macrocode}
%\end{macro}
%
%\subsection{Glossary Entry Cross-References}
%\begin{macro}{\@do@seeglossary}
%\changes{1.17}{2008 December 26}{new}
% Write the glossary entry with a cross reference.
% The first argument is the entry's label, the second must be in
% the form \oarg{tag}\marg{list}, where \meta{tag} is a tag
% such as ``see'' and \meta{list} is a list of labels.
%    \begin{macrocode}
\newcommand{\@do@seeglossary}[2]{%
\ifglsxindy
  \glossary[\csname glo@#1@type\endcsname]{%
    (indexentry
      :tkey (\csname glo@#1@index\endcsname)
      :xref (\string"#2\string")
      :attr \string"see\string"
    )
  }%
\else
  \glossary[\csname glo@#1@type\endcsname]{%
  \string\glossaryentry{\csname glo@#1@index\endcsname
  \@gls@encapchar glsseeformat#2}{Z}}%
\fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@fixbraces}
% If no optional argument is specified, list needs to be enclosed
% in a set of braces.
%    \begin{macrocode}
\def\@gls@fixbraces#1#2#3\@nil{%
  \ifx#2[\relax
    \def#1{#2#3}%
  \else
    \def#1{{#2#3}}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glssee}
%\cs{glssee}\marg{label}\marg{cross-ref list}
%\changes{1.17}{2008 December 26}{new}
%     \begin{macrocode}
\newcommand*{\glssee}[3][\seename]{%
  \@do@seeglossary{#2}{[#1]{#3}}}
\newcommand*{\@glssee}[3][\seename]{%
  \glssee[#1]{#3}{#2}}
%     \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsseeformat}
%\changes{1.17}{2008 December 26}{new}
% The first argument specifies what tag to use (e.g.\ ``see''),
% the second argument is a comma-separated list of labels.
% The final argument (the location) is ignored.
%    \begin{macrocode}
\newcommand*{\glsseeformat}[3][\seename]{\emph{#1} \glsseelist{#2}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsseelist}
%\cs{glsseelist}\marg{list} formats list of entry labels.
%    \begin{macrocode}
\newcommand*{\glsseelist}[1]{%
%    \end{macrocode}
% If there is only one item in the list, set the last separator
% to do nothing.
%    \begin{macrocode}
  \let\@gls@dolast\relax
%    \end{macrocode}
% Don't display separator on the first iteration of the loop
%    \begin{macrocode}
  \let\@gls@donext\relax
%    \end{macrocode}
% Iterate through the labels
%    \begin{macrocode}
  \@for\@gls@thislabel:=#1\do{%
%    \end{macrocode}
% Check if on last iteration of loop
%    \begin{macrocode}
    \ifx\@xfor@nextelement\@nnil
      \@gls@dolast
    \else
      \@gls@donext
    \fi
%    \end{macrocode}
% display the entry for this label
%    \begin{macrocode}
    \glsseeitem{\@gls@thislabel}%
%    \end{macrocode}
% Update separators
%    \begin{macrocode}
    \let\@gls@dolast\glsseelastsep
    \let\@gls@donext\glsseesep
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsseelastsep}
% Separator to use between penultimate and ultimate entries in a
% cross-referencing list.
%    \begin{macrocode}
\newcommand*{\glsseelastsep}{\space\andname\space}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsseesep}
% Separator to use between entires in a cross-referencing list.
%    \begin{macrocode}
\newcommand*{\glsseesep}{, }
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsseeitem}
%\cs{glsseeitem}\marg{label} formats individual entry in a 
% cross-referencing list.
%    \begin{macrocode}
\newcommand*{\glsseeitem}[1]{\glshyperlink{#1}}
%    \end{macrocode}
%\end{macro}
%
% \subsection{Displaying the glossary}\label{sec:code:printglos}
% An individual glossary is displayed in the text using
% \cs{printglossary}\oarg{key-val list}. If the 
% \gloskey[printglossary]{type} key is omitted, the default glossary is displayed.
% The optional argument can be used to specify an alternative
% glossary, and can also be used to set the style, title and
% entry in the table of contents. Available keys are defined below.
%
%\begin{macro}{\warn@noprintglossary}
% Warn the user if they have forgotten \ics{printglossaries}
% or \ics{printglossary}. (Will be suppressed if there is at
% least one occurance of \ics{printglossary}. There is no check
% to ensure that there is a \ics{printglossary} for each defined
% glossary.)
%    \begin{macrocode}
\def\warn@noprintglossary{\GlossariesWarningNoLine{No
  \string\printglossary\space or \string\printglossaries\space
  found.^^JThis document will not have a glossary}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\printglossary}
%\changes{1.17}{2008 December 26}{added print language to aux file}
%\changes{1.15}{2008 August 15}{changed the way the TOC title is set}
%\changes{1.17}{2008 December 26}{added check to determine if 'printglossary is already
% defined}
% The TOC title needs to be processed in a different manner
% to the main title in case the \sty{translator} and \sty{hyperref} packages
% are both being used.
%    \begin{macrocode}
\@ifundefined{printglossary}{}{%
%    \end{macrocode}
% If \cs{printglossary} is already defined, issue a warning
% and undefine it.
%    \begin{macrocode}
  \GlossariesWarning{Overriding \string\printglossary}%
  \let\printglossary\undefined
}
%    \end{macrocode}
% \cs{printglossary} has an optional argument. The default
% value is to set the glossary type to the main glossary.
%    \begin{macrocode}
\newcommand*{\printglossary}[1][type=\glsdefaulttype]{%
%    \end{macrocode}
% If \app{xindy} is being used, need to find the root language
% for \app{makeglossaries} to pass to \app{xindy}.
%    \begin{macrocode}
  \ifglsxindy\findrootlanguage\fi
%    \end{macrocode}
% Set up defaults.
%    \begin{macrocode}
  \def\@glo@type{\glsdefaulttype}%
  \def\glossarytitle{\csname @glotype@\@glo@type @title\endcsname}%
  \def\@glossarystyle{}%
  \def\gls@dotoctitle{\glssettoctitle{\@glo@type}}%
%    \end{macrocode}
% Store current value of \ics{glossaryentrynumbers}. (This may
% be changed via the optional argument)
%    \begin{macrocode}
  \let\@org@glossaryentrynumbers\glossaryentrynumbers
%    \end{macrocode}
% Localise the effects of the optional argument
%    \begin{macrocode}
  \bgroup
%    \end{macrocode}
% Determine settings specified in the optional argument.
%    \begin{macrocode}
    \setkeys{printgloss}{#1}%
%    \end{macrocode}
%Enable individual number lists to be suppressed.
%    \begin{macrocode}
    \let\org@glossaryentrynumbers\glossaryentrynumbers
    \let\glsnonextpages\@glsnonextpages
%    \end{macrocode}
% Enable suppression of description terminators.
%    \begin{macrocode}
    \let\nopostdesc\@nopostdesc
%    \end{macrocode}
% Set up the entry for the TOC
%    \begin{macrocode}
    \gls@dotoctitle
%    \end{macrocode}
% Set the glossary style
%    \begin{macrocode}
    \@glossarystyle
%    \end{macrocode}
% Some macros may end up being expanded into internals in the
% glossary, so need to make @ a letter.
%    \begin{macrocode}
    \makeatletter
%    \end{macrocode}
% Input the glossary file, if it exists.
%    \begin{macrocode}
    \@input@{\jobname.\csname @glotype@\@glo@type @in\endcsname}%
%    \end{macrocode}
% If the glossary file doesn't exist, do \cs{null}. (This ensures
% that the page is shipped out and all write commands are done.)
% This might produce an empty page, but at this point the document
% isn't complete, so it shouldn't matter.
%    \begin{macrocode}
\IfFileExists{\jobname.\csname @glotype@\@glo@type @in\endcsname}{}%
{\null}%
%    \end{macrocode}
% If \app{xindy} is being used, need to write the language
% dependent information to the \filetype{.aux} file for
% \app{makeglossaries}.
%    \begin{macrocode}
    \ifglsxindy
      \@ifundefined{@xdy@\@glo@type @language}{%
        \protected@write\@auxout{}{%
        \string\@xdylanguage{\@glo@type}{\@xdy@main@language}}%
      }{%
        \protected@write\@auxout{}{%
          \string\@xdylanguage{\@glo@type}{\csname @xdy@\@glo@type 
            @language\endcsname}}%
      }%
      \protected@write\@auxout{}{%
        \string\@gls@codepage{\@glo@type}{\gls@codepage}}%
    \fi
  \egroup
%    \end{macrocode}
% Reset \ics{glossaryentrynumbers}
%    \begin{macrocode}
  \global\let\glossaryentrynumbers\@org@glossaryentrynumbers
%    \end{macrocode}
% Suppress warning about no \ics{printglossary}
%\changes{2.02}{2007 July 13}{suppressed warning globally rather than locally}
%    \begin{macrocode}
  \global\let\warn@noprintglossary\relax
}
%    \end{macrocode}
%\end{macro}
%
% The \cs{printglossaries} command will do \cs{printglossary}
% for each glossary type that has been defined. It is better
% to use \cs{printglossaries} rather than individual
% \cs{printglossary} commands to ensure that you don't forget
% any new glossaries you may have created. It also makes it easier to
% chop and change the value of the \pkgopt{acronym} package option.
% However, if you want to list the glossaries in a different order,
% or if you want to set the title or table of contents entry, or
% if you want to use different glossary styles for each glossary, you
% will need to use \cs{printglossary} explicitly for each
% glossary type.
%\begin{macro}{\printglossaries}
%    \begin{macrocode}
\newcommand*{\printglossaries}{%
\forallglossaries{\@@glo@type}{\printglossary[type=\@@glo@type]}}
%    \end{macrocode}
%\end{macro}
% The keys that can be used in the optional argument to
% \ics{printglossary} are as follows:
% The \gloskey[printglossary]{type} key sets the glossary type.
%    \begin{macrocode}
\define@key{printgloss}{type}{\def\@glo@type{#1}}
%    \end{macrocode}
% The \gloskey[printglossary]{title} key sets the title used in the glossary section
% header. This overrides the title used in \ics{newglossary}.
%    \begin{macrocode}
\define@key{printgloss}{title}{\def\glossarytitle{#1}}
%    \end{macrocode}
% The \gloskey[printglossary]{toctitle} sets the text used for the relevant entry 
% in the table of contents.
%    \begin{macrocode}
\define@key{printgloss}{toctitle}{\def\glossarytoctitle{#1}%
\let\gls@dotoctitle\relax
}
%    \end{macrocode}
% The \gloskey[printglossary]{style} key sets the glossary style (but only for
% the given glossary).
%    \begin{macrocode}
\define@key{printgloss}{style}{%
\@ifundefined{@glsstyle@#1}{\PackageError{glossaries}{Glossary 
style `#1' undefined}{}}{%
\def\@glossarystyle{\csname @glsstyle@#1\endcsname}}}
%    \end{macrocode}
% \changes{1.14}{2008 June 17}{added numberedsection key to 'printglossary}
% The \gloskey[printglossary]{numberedsection} key determines if this
% glossary should be in a numbered section.
%    \begin{macrocode}
\define@choicekey{printgloss}{numberedsection}[\val\nr]{%
false,nolabel,autolabel}[nolabel]{%
\ifcase\nr\relax
  \renewcommand*{\@@glossarysecstar}{*}%
  \renewcommand*{\@@glossaryseclabel}{}%
\or
  \renewcommand*{\@@glossarysecstar}{}%
  \renewcommand*{\@@glossaryseclabel}{}%
\or
  \renewcommand*{\@@glossarysecstar}{}%
  \renewcommand*{\@@glossaryseclabel}{\label{\glsautoprefix\@glo@type}}%
\fi}
%    \end{macrocode}
% \changes{1.14}{2008 June 17}{added nonumberlist key to 'printglossary}
% The \gloskey[printglossary]{nonumberlist} key determines if this
% glossary should have a number list.
%    \begin{macrocode}
\define@boolkey{printgloss}[gls]{nonumberlist}[true]{%
\ifglsnonumberlist
   \def\glossaryentrynumbers##1{}%
\else
   \def\glossaryentrynumbers##1{##1}%
\fi}
%    \end{macrocode}
%
%\begin{macro}{\@glsnonextpages}
%\changes{1.17}{2008 December 26}{new}%
% Suppresses the next number list only. Global assignments required
% as it may not occur in the same level of grouping as the
% next numberlist. (For example, if \cs{glsnonextpages} is place
% in the entry's description and 3 column tabular style glossary
% is used.) \cs{org@glossaryentrynumbers} needs to be set at
% the start of each glossary, in the event that
% \ics{glossaryentrynumber} is redefined.
%    \begin{macrocode}
\newcommand*{\@glsnonextpages}{%
  \gdef\glossaryentrynumbers##1{%
     \glsresetentrylist}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsresetentrylist}
% Resets \cs{glossaryentrynumbers}
%    \begin{macrocode}
\newcommand*{\glsresetentrylist}{%
  \global\let\glossaryentrynumbers\org@glossaryentrynumbers}
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{\glsnonextpages}
% Outside of \cs{printglossary} this does nothing.
%    \begin{macrocode}
\newcommand*{\glsnonextpages}{}
%    \end{macrocode}
%\end{macro}
%
%\DescribeEnv{theglossary}
% If the \env{theglossary} environment has 
% already been defined, a warning will be issued. 
% This environment should be redefined by glossary styles.
%    \begin{macrocode}
\@ifundefined{theglossary}{%
  \newenvironment{theglossary}{}{}%
}{%
  \GlossariesWarning{overriding `theglossary' environment}%
  \renewenvironment{theglossary}{}{}%
}
%    \end{macrocode}
%
% The glossary header is given by \cs{glossaryheader}. 
% This forms part of the glossary style, and
% must indicate what should appear immediately after the start of the
% \env{theglossary} environment. (For example, if the glossary
% uses a tabular-like environment, it may be used to set the
% header row.) Note that if you don't want a header row, the glossary
% style must redefine \cs{glossaryheader} to do nothing.
%\begin{macro}{\glossaryheader}
%    \begin{macrocode}
\newcommand*{\glossaryheader}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glstarget}
%\changes{1.18}{2009 January 14}{new}
%\cs{glstarget}\marg{label}\marg{name}\\[10pt]
% Provide user interface to \cs{@glstarget} to make it easier to
% modify the glossary style in the document.
%    \begin{macrocode}
\newcommand*{\glstarget}[2]{\@glstarget{glo:#1}{#2}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glossaryentryfield}
% \cs{glossaryentryfield}\marg{label}\marg{name}\marg{description}\marg{symbol}\marg{page-list}\\[10pt]
% This command governs how each entry row should be formatted 
% in the glossary. Glossary styles need to redefine this command.
% Most of the predefined styles ignore \meta{symbol}.
%    \begin{macrocode}
\newcommand*{\glossaryentryfield}[5]{%
\noindent\textbf{\glstarget{#1}{#2}} #4 #3. #5\par}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glossaryentryfield}
% \cs{glossarysubentryfield}\marg{level}\marg{label}\marg{name}\marg{description}\marg{symbol}\marg{page-list}\\[10pt]
% This command governs how each subentry should be formatted 
% in the glossary. Glossary styles need to redefine this command.
% Most of the predefined styles ignore \meta{symbol}. The first
% argument is a number indicating the level. (The level should
% be greater than or equal to 1.)
%    \begin{macrocode}
\newcommand*{\glossarysubentryfield}[6]{%
\glstarget{#2}{\strut}#4. #6\par}
%    \end{macrocode}
%\end{macro}
%
% Within each glossary, the entries form distinct groups
% which are determined by the first character of the \gloskey{sort} 
% key. When using \app{makeindex}, there will be a maximum of 28 groups: symbols, numbers,
% and the 26 alphabetical groups A, \ldots, Z\@. If you use
% \app{xindy} the groups will depend on whatever alphabet
% is used. This is determined by the language or custom
% alphabets can be created in the \app{xindy} style file.
% The command \cs{glsgroupskip} 
% specifies what to do between glossary groups. Glossary styles
% must redefine this command. (Note that \cs{glsgroupskip}
% only occurs between groups, not at the start or end of the
% glossary.)
%\begin{macro}{\glsgroupskip}
%    \begin{macrocode}
\newcommand*{\glsgroupskip}{}
%    \end{macrocode}
%\end{macro}
%
% Each of the 28 glossary groups described above is preceded by a 
% group heading.
% This is formatted by the command \cs{glsgroupheading}
% which takes one argument which is the \emph{label} assigned to that
% group (not the title). The corresponding labels are: \texttt{glssymbols},
% \texttt{glsnumbers}, \texttt{A}, \ldots, \texttt{Z}. 
% Glossary styles must redefined this command. (In between groups,
% \cs{glsgroupheading} comes immediately after \cs{glsgroupskip}.)
%\begin{macro}{\glsgroupheading}
%    \begin{macrocode}
\newcommand*{\glsgroupheading}[1]{}
%    \end{macrocode}
%\end{macro}
% It is possible to ``trick'' \app{makeindex} into
% treating entries as though they belong to the same group, 
% even if the terms don't start with the same letter, by
% modifying the \gloskey{sort} key. For example, all entries 
% belonging to one
% group could be defined so that the \gloskey{sort} key starts with an
% "a", while entries belonging to another group could be defined
% so that the \gloskey{sort} key starts with a "b", and so on. If
% you want each group to have a heading, you would then need to
% modify the translation control sequences \cs{glsgetgrouptitle}
% and \cs{glsgetgrouplabel} so that the label is translated
% into the required title (and vice-versa).
%\\[10pt]
%\cs{glsgetgrouptitle}\marg{label}\\[10pt]
% This command produces the title for the glossary group
% whose label is given by \meta{label}. By default, the group
% labelled \texttt{glssymbols} produces 
% \ics{glssymbolsgroupname}, the group labelled 
% \texttt{glsnumbers} produces \ics{glsnumbersgroupname}
% and all the other groups simply produce their label.
% As mentioned above, the group labels are: \texttt{glssymbols}, \texttt{glsnumbers},
% \texttt{A}, \ldots, \texttt{Z}\@. If you want to redefine
% the group titles, you will need to redefine this command.
%\begin{macro}{\glsgetgrouptitle}
%    \begin{macrocode}
\newcommand*{\glsgetgrouptitle}[1]{%
\@ifundefined{#1groupname}{#1}{\csname #1groupname\endcsname}}
%    \end{macrocode}
%\end{macro}
%\vskip5pt
%\cs{glsgetgrouplabel}\marg{title}\\[10pt]
%This command does the reverse to the previous command. The
% argument is the group title, and it produces the group label.
% Note that if you redefine \cs{glsgetgrouptitle}, you
% will also need to redefine \cs{glsgetgrouplabel}.
%\begin{macro}{\glsgetgrouplabel}
%    \begin{macrocode}
\newcommand*{\glsgetgrouplabel}[1]{%
\ifthenelse{\equals{#1}{\glssymbolsgroupname}}{glssymbols}{%
\ifthenelse{\equals{#1}{\glsnumbersgroupname}}{glsnumbers}{#1}}}
%    \end{macrocode}
%\end{macro}
%
% The command \cs{setentrycounter} sets the entry's 
% associated counter (required by 
% \cs{glshypernumber} etc.) \ics{glslink} and
% \ics{glsadd} encode the
% \ics{glossary} argument so that the relevant counter is
% set prior to the formatting command.
%\begin{macro}{\setentrycounter}
%    \begin{macrocode}
\newcommand*{\setentrycounter}[1]{\def\glsentrycounter{#1}}
%    \end{macrocode}
%\end{macro}
%
% The current glossary style can be set using
% \cs{glossarystyle}\marg{style}.
%\begin{macro}{\glossarystyle}
%    \begin{macrocode}
\newcommand*{\glossarystyle}[1]{%
\@ifundefined{@glsstyle@#1}{\PackageError{glossaries}{Glossary 
style `#1' undefined}{}}{%
\csname @glsstyle@#1\endcsname}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\newglossarystyle}
% New glossary styles can be defined using:\\[10pt]
% \cs{newglossarystyle}\marg{name}\marg{definition}\\[10pt]
% The \meta{definition} argument should redefine 
% \env{theglossary}, \ics{glossaryheader}, 
% \ics{glsgroupheading}, \ics{glossaryentryfield} and
% \ics{glsgroupskip} (see \autoref{sec:code:styles} for the
% definitions of predefined styles). Glossary styles should not 
% redefine \ics{glossarypreamble} and 
% \ics{glossarypostamble}, as
% the user should be able to switch between styles without affecting
% the pre- and postambles.
%\changes{1.17}{2008 December 26}{made 'newglossarystyle long}
%    \begin{macrocode}
\newcommand{\newglossarystyle}[2]{%
\@ifundefined{@glsstyle@#1}{%
\expandafter\def\csname @glsstyle@#1\endcsname{#2}}{%
\PackageError{glossaries}{Glossary style `#1' is already defined}{}}}
%    \end{macrocode}
%\end{macro}
%
% Glossary entries are encoded so that the second argument
% to \ics{glossaryentryfield} is always specified as
% \cs{glsnamefont}\marg{name}. This allows the
% user to change the font used to display the name term
% without having to redefine \ics{glossaryentryfield}.
% The default uses the surrounding font, so in the list type
% styles (which place the name in the optional argument to
% \ics{item}) the name will appear in bold.
%\begin{macro}{\glsnamefont}
%    \begin{macrocode}
\newcommand*{\glsnamefont}[1]{#1}
%    \end{macrocode}
%\end{macro}
%
% Each glossary entry has an associated number list (usually page
% numbers) that indicate where in the document the entry has been
% used. The format for these number lists can be changed using the
% \gloskey[glslink]{format}\igloskey[glsadd]{format} key in commands like \ics{glslink}.
% The default format is given by \cs{glshypernumber}. This takes
% a single argument which may be a single number, a number range
% or a number list. The number ranges are delimited with 
% \ics{delimR}, the number lists are delimited with 
% \ics{delimN}.
%
% If the document doesn't have hyperlinks, the numbers can be
% displayed just as they are, but if the document supports 
% hyperlinks, the numbers should link to the relevant location.
% This means extracting the individual numbers from the list or
% ranges. The \isty{hyperref} package does this with the
% \ics{hyperpage} command, but this is encoded for comma and
% dash delimiters and only for the page counter, but this code needs
% to be more general. So I have adapted the code used in the
% \isty{hyperref} package.
%\begin{macro}{\glshypernumber}
%\changes{1.17}{2008 December 26}{modified to allow material 
% to be attached to location}
%    \begin{macrocode}
\@ifundefined{hyperlink}{%
\def\glshypernumber#1{#1}}{%
\def\glshypernumber#1{%
  \@glshypernumber#1\nohyperpage{}\@nil}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@glshypernumber}
% This code was provided by Heiko~Oberdiek to allow material
% to be attached to the location.
%\changes{1.17}{2008 December 26}{new}
%    \begin{macrocode}
\def\@glshypernumber#1\nohyperpage#2#3\@nil{%
  \ifx\\#1\\%
  \else
    \@delimR#1\delimR\delimR\\%
  \fi
  \ifx\\#2\\%
  \else
    #2%
  \fi
  \ifx\\#3\\%
  \else
    \@glshypernumber#3\@nil
  \fi
}
%    \end{macrocode}
%\end{macro}
% \cs{@delimR} displays a range of numbers for the counter 
% whose name is given by 
% \cs{@gls@counter} (which must be set prior to using
% \cs{glshypernumber}).
%\begin{macro}{\@delimR}
%    \begin{macrocode}
\def\@delimR#1\delimR #2\delimR #3\\{%
\ifx\\#2\\%
  \@delimN{#1}%
\else
  \@gls@numberlink{#1}\delimR\@gls@numberlink{#2}%
\fi}
%    \end{macrocode}
%\end{macro}
% \cs{@delimN} displays a list of individual numbers, 
% instead of a range:
%\begin{macro}{\@delimN}
%    \begin{macrocode}
\def\@delimN#1{\@@delimN#1\delimN \delimN\\}
\def\@@delimN#1\delimN #2\delimN#3\\{%
\ifx\\#3\\%
  \@gls@numberlink{#1}%
\else
  \@gls@numberlink{#1}\delimN\@gls@numberlink{#2}%
\fi
}
%    \end{macrocode}
%\end{macro}
% The following code is modified from hyperref's 
% \cs{HyInd@pagelink} where
% the name of the counter being used is given by 
% \cs{@gls@counter}.
%    \begin{macrocode}
\def\@gls@numberlink#1{%
\begingroup
 \toks@={}%
 \@gls@removespaces#1 \@nil
\endgroup}
%    \end{macrocode}
%    \begin{macrocode}
\def\@gls@removespaces#1 #2\@nil{%
 \toks@=\expandafter{\the\toks@#1}%
 \ifx\\#2\\%
   \edef\x{\the\toks@}%
   \ifx\x\empty
   \else
     \hyperlink{\glsentrycounter.\the\toks@}{\the\toks@}%
   \fi
 \else
   \@gls@ReturnAfterFi{%
     \@gls@removespaces#2\@nil
   }%
 \fi
}
\long\def\@gls@ReturnAfterFi#1\fi{\fi#1}
%    \end{macrocode}
%
% The following commands will switch to the
% appropriate font, and create a hyperlink, if hyperlinks are
% supported. If hyperlinks are not supported, they will just
% display their argument in the appropriate font.
%\begin{macro}{\hyperrm}
%    \begin{macrocode}
\newcommand*{\hyperrm}[1]{\textrm{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\hypersf}
%    \begin{macrocode}
\newcommand*{\hypersf}[1]{\textsf{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\hypertt}
%    \begin{macrocode}
\newcommand*{\hypertt}[1]{\texttt{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\hyperbf}
%    \begin{macrocode}
\newcommand*{\hyperbf}[1]{\textbf{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\hypermd}
%    \begin{macrocode}
\newcommand*{\hypermd}[1]{\textmd{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\hyperit}
%    \begin{macrocode}
\newcommand*{\hyperit}[1]{\textit{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\hypersl}
%    \begin{macrocode}
\newcommand*{\hypersl}[1]{\textsl{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\hyperup}
%    \begin{macrocode}
\newcommand*{\hyperup}[1]{\textup{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\hypersc}
%    \begin{macrocode}
\newcommand*{\hypersc}[1]{\textsc{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\hyperemph}
%    \begin{macrocode}
\newcommand*{\hyperemph}[1]{\emph{\glshypernumber{#1}}}
%    \end{macrocode}
%\end{macro}
%
%\subsection{Acronyms}\label{sec:acronym}
%If the \pkgopt{acronym} package option is used, a 
% new glossary called "acronym" is created
%    \begin{macrocode}
\ifglsacronym
  \newglossary[alg]{acronym}{acr}{acn}{\acronymname}
%    \end{macrocode}
%and \ics{acronymtype} is set to the name of this new glossary.
%    \begin{macrocode}
  \renewcommand*{\acronymtype}{acronym}
\fi
%    \end{macrocode}
%\begin{macro}{\oldacronym}
%\cs{oldacronym}\oarg{label}\marg{abbrv}\marg{long}\marg{key-val list}\\[10pt]
% This emulates the way the old \isty{glossary} package defined
% acronyms. It is equivalent to \ics{newacronym}\oarg{key-val
% list}\marg{label}\marg{abbrv}\marg{long} and it additionally
% defines the command \cs{}\meta{label} which is equivalent to
% \cs{gls}\marg{label} (thus \meta{label} must only contain
% alphabetical characters). If \meta{label} is omitted, \meta{abbrv}
% is used. This only emulates the syntax of the old \isty{glossary} 
% package. The way the acronyms appear in the list of acronyms is 
% determined by the definition of \ics{newacronym} and the
% glossary style.
%
% Note that \cs{}\meta{label} can't have an optional
% argument if the \isty{xspace} package is loaded. If 
% \isty{xspace} hasn't been loaded then you can do
% \cs{}\meta{label}\oarg{insert} but you can't do 
% \cs{}\meta{label}\oarg{key-val list}. For example if you define the
% acronym svm, then you can do "\svm['s]" but you can't do
% "\svm[format=textbf]". If the \isty{xspace} package is loaded,
% "\svm['s]" will appear as "svm ['s]" which is unlikely to be
% the desired result. In this case, you will need to use 
% \cs{gls} explicitly, e.g.\ "\gls{svm}['s]". Note that it is
% up to the user to load \isty{xspace} if desired.
%\changes{1.18}{2009 January 14}{new}
%    \begin{macrocode}
\newcommand{\oldacronym}[4][\gls@label]{%
  \def\gls@label{#2}%
  \newacronym[#4]{#1}{#2}{#3}%
  \@ifundefined{xspace}{%
    \expandafter\edef\csname#1\endcsname{%
      \noexpand\@ifstar{\noexpand\Gls{#1}}{\noexpand\gls{#1}}}%
  }{%
    \expandafter\edef\csname#1\endcsname{%
      \noexpand\@ifstar{\noexpand\Gls{#1}\noexpand\xspace}{%
      \noexpand\gls{#1}\noexpand\xspace}}%
  }%
}
%    \end{macrocode}
%\end{macro}
%\vskip5pt
% \cs{newacronym}\oarg{key-val list}\marg{label}\marg{abbrev}\marg{long}\\[10pt]
% This is a quick way of defining acronyms, all it does
% is call \ics{newglossaryentry} with the appropriate
% values. It sets the
% glossary type to \ics{acronymtype} which will be
% "acronym" if the package option \pkgopt{acronym} has
% been used, otherwise it will be the default glossary.
% Since \cs{newacronym} merely calls \ics{newglossaryentry},
% the acronym is treated like any other glossary entry.
%
% If you prefer a different format, you
% can redefine \cs{newacronym} as required. The optional 
% argument can be used to override any of the settings.
%
% This is just a stub. It's redefined by commands like
% \cs{SetDefaultAcronymStyle}.
%\begin{macro}{\newacronym}
%    \begin{macrocode}
  \newcommand{\newacronym}[4][]{}
%    \end{macrocode}
%\changes{1.13}{2008 May 10}{Removed restriction on only using
% 'newacronym in the preamble}
%\end{macro}
% Set up some convenient short cuts. These need to be changed if
% \cs{newacronym} is changed (or if the \gloskey{description} key
% is changed).
%
%\begin{macro}{\acrpluralsuffix}
%\changes{1.13}{2008 May 10}{New}
% Plural suffix used by \cs{newacronym}. This just defaults to
% \cs{glspluralsuffix} but is changed to include \cs{textup} 
% if the smallcaps option is used, so that the suffix doesn't appear
% in small caps as it doesn't look right. For example, 
% \textsc{abcs} looks as though the ``s'' is part of the acronym, but
% \textsc{abc}s looks as though the ``s'' is a plural suffix. Since
% the entire text \texttt{abcs} is set in \cs{textsc}, \cs{textup}
% is need to cancel it out.
%    \begin{macrocode}
\newcommand*{\acrpluralsuffix}{\glspluralsuffix}
%    \end{macrocode}
%\end{macro}
%
% Make a note of the keys that are used to store the long and
% short forms:
%\begin{macro}{\glsshortkey}
%    \begin{macrocode}
\newcommand*{\glsshortkey}{text}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsshortpluralkey}
%    \begin{macrocode}
\newcommand*{\glsshortpluralkey}{plural}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glslongkey}
%    \begin{macrocode}
\newcommand*{\glslongkey}{description}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glslongpluralkey}
%    \begin{macrocode}
\newcommand*{\glslongpluralkey}{descriptionplural}
%    \end{macrocode}
%\end{macro}
%
% Using the default definitions, \ics{acrshort} is the same as
% \ics{glstext}, which means that it will print the abbreviation.
%\begin{macro}{\acrshort}
%    \begin{macrocode}
\newcommand*{\acrshort}[2][]{%
  \new@ifnextchar[{\@acrshort{#1}{#2}}{\@acrshort{#1}{#2}[]}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Acrshort}
%\changes{1.13}{2008 May 10}{fixed bug that used all lower case version}
%    \begin{macrocode}
\newcommand*{\Acrshort}[2][]{%
  \new@ifnextchar[{\@Acrshort{#1}{#2}}{\@Acrshort{#1}{#2}[]}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\ACRshort}
%\changes{1.13}{2008 May 10}{fixed bug that used all lower case version}
%    \begin{macrocode}
\newcommand*{\ACRshort}[2][]{%
  \new@ifnextchar[{\@ACRshort{#1}{#2}}{\@ACRshort{#1}{#2}[]}}
%    \end{macrocode}
%\end{macro}
% Plural:
%\begin{macro}{\acrshortpl}
%\changes{1.13}{2008 May 10}{new}
%    \begin{macrocode}
\newcommand*{\acrshortpl}[2][]{%
  \new@ifnextchar[{\@acrshortpl{#1}{#2}}{\@acrshortpl{#1}{#2}[]}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Acrshortpl}
%\changes{1.13}{2008 May 10}{new}
%    \begin{macrocode}
\newcommand*{\Acrshortpl}[2][]{%
  \new@ifnextchar[{\@Acrshortpl{#1}{#2}}{\@Acrshortpl{#1}{#2}[]}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\ACRshortpl}
%\changes{1.13}{2008 May 10}{new}
%    \begin{macrocode}
\newcommand*{\ACRshortpl}[2][]{%
  \new@ifnextchar[{\@ACRshortpl{#1}{#2}}{\@ACRshortpl{#1}{#2}[]}}
%    \end{macrocode}
%\end{macro}
%
% \ics{acrlong} is set to \ics{glsdesc}, so it will print the long 
% form, unless the description key has been set to something else.
%\begin{macro}{\acrlong}
%    \begin{macrocode}
\newcommand*{\acrlong}[2][]{%
  \new@ifnextchar[{\@acrlong{#1}{#2}}{\@acrlong{#1}{#2}[]}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Acrlong}
%\changes{1.13}{2008 May 10}{fixed bug that used all lower case version}
%    \begin{macrocode}
\newcommand*{\Acrlong}[2][]{%
  \new@ifnextchar[{\@Acrlong{#1}{#2}}{\@Acrlong{#1}{#2}[]}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\ACRlong}
%\changes{1.13}{2008 May 10}{fixed bug that used all lower case version}
%    \begin{macrocode}
\newcommand*{\ACRlong}[2][]{%
  \new@ifnextchar[{\@ACRlong{#1}{#2}}{\@ACRlong{#1}{#2}[]}}
%    \end{macrocode}
%\end{macro}
% Plural:
%\begin{macro}{\acrlongpl}
%\changes{1.13}{2008 May 10}{new}
%    \begin{macrocode}
\newcommand*{\acrlongpl}[2][]{%
  \new@ifnextchar[{\@acrlongpl{#1}{#2}}{\@acrlongpl{#1}{#2}[]}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Acrlongpl}
%\changes{1.13}{2008 May 10}{new}
%    \begin{macrocode}
\newcommand*{\Acrlongpl}[2][]{%
  \new@ifnextchar[{\@Acrlongpl{#1}{#2}}{\@Acrlongpl{#1}{#2}[]}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\ACRlongpl}
%\changes{1.13}{2008 May 10}{new}
%    \begin{macrocode}
\newcommand*{\ACRlongpl}[2][]{%
  \new@ifnextchar[{\@ACRlongpl{#1}{#2}}{\@ACRlongpl{#1}{#2}[]}}
%    \end{macrocode}
%\end{macro}
%
%
% \ics{acrfull} is set to \ics{glsfirst}, so it should display the
% full form.
%\begin{macro}{\acrfull}
%    \begin{macrocode}
\newcommand*{\acrfull}[2][]{%
  \new@ifnextchar[{\@acrfull{#1}{#2}}{\@acrfull{#1}{#2}[]}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Acrfull}
%    \begin{macrocode}
\newcommand*{\Acrfull}[2][]{%
  \new@ifnextchar[{\@Acrfull{#1}{#2}}{\@Acrfull{#1}{#2}[]}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\ACRfull}
%    \begin{macrocode}
\newcommand*{\ACRfull}[2][]{%
  \new@ifnextchar[{\@ACRfull{#1}{#2}}{\@ACRfull{#1}{#2}[]}}
%    \end{macrocode}
%\end{macro}
% Plural:
%\begin{macro}{\acrfullpl}
%\changes{1.13}{2008 May 10}{new}
%    \begin{macrocode}
\newcommand*{\acrfullpl}[2][]{%
  \new@ifnextchar[{\@acrfullpl{#1}{#2}}{\@acrfullpl{#1}{#2}[]}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\Acrfullpl}
%\changes{1.13}{2008 May 10}{new}
%    \begin{macrocode}
\newcommand*{\Acrfullpl}[2][]{%
  \new@ifnextchar[{\@Acrfullpl{#1}{#2}}{\@Acrfullpl{#1}{#2}[]}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\ACRfullpl}
%\changes{1.13}{2008 May 10}{new}
%    \begin{macrocode}
\newcommand*{\ACRfullpl}[2][]{%
  \new@ifnextchar[{\@ACRfullpl{#1}{#2}}{\@ACRfullpl{#1}{#2}[]}}
%    \end{macrocode}
%\end{macro}
%
%\subsection{Predefined acronym styles}
%\begin{macro}{\acronymfont}
%This is only used with the additional acronym styles:
%    \begin{macrocode}
\newcommand{\acronymfont}[1]{#1}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\firstacronymfont}
%This is only used with the additional acronym styles:
%\changes{1.14}{2008 June 17}{new}
%    \begin{macrocode}
\newcommand{\firstacronymfont}[1]{\acronymfont{#1}}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\acrnameformat}
% The styles that allow an additional description use 
% \cs{acrnameformat}\marg{short}\marg{long} to determine what
% information is displayed in the name.
%    \begin{macrocode}
\newcommand*{\acrnameformat}[2]{\acronymfont{#1}}
%    \end{macrocode}
%\end{macro}
%
% Define some tokens used by \cs{newacronym}:
%\begin{macro}{\glskeylisttok}
%    \begin{macrocode}
\newtoks\glskeylisttok
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glslabeltok}
%    \begin{macrocode}
\newtoks\glslabeltok
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsshorttok}
%    \begin{macrocode}
\newtoks\glsshorttok
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glslongtok}
%    \begin{macrocode}
\newtoks\glslongtok
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\newacronymhook}
% Provide a hook for \cs{newacronym}:
%    \begin{macrocode}
\newcommand*{\newacronymhook}{}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SetDefaultAcronymDisplayStyle}
% Sets the default acronym display style for given glossary.
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\SetDefaultAcronymDisplayStyle}[1]{%
  \defglsdisplay[#1]{##1##4}%
  \defglsdisplayfirst[#1]{##1##4}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\DefaultNewAcronymDef}
% Sets up the acronym definition for the default style.
% The information is provided by the tokens \cs{glslabeltok},
% \cs{glsshorttok}, \cs{glslongtok} and \cs{glskeylisttok}.
%    \begin{macrocode}
\newcommand*{\DefaultNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\the\glsshorttok},%
      description={\the\glslongtok},%
      text={\the\glsshorttok},%
      sort={\the\glsshorttok},%
      descriptionplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      first={\the\glslongtok\space(\the\glsshorttok)},%
      plural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      firstplural={\noexpand\@glo@descplural\space
        (\noexpand\@glo@plural)},%
      \the\glskeylisttok
    }%
  }%
  \@do@newglossaryentry
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SetDefaultAcronymStyle}
%\changes{2.04}{2009 November 10}{new}
% Set up the default acronym style:
%    \begin{macrocode}
\newcommand*{\SetDefaultAcronymStyle}{%
%    \end{macrocode}
% Set the display style:
%    \begin{macrocode}
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetDefaultAcronymDisplayStyle{\@gls@type}%
  }%
%    \end{macrocode}
% Set up the definition of \cs{newacronym}:
%    \begin{macrocode}
  \renewcommand{\newacronym}[4][]{%
%    \end{macrocode}
% If user is just using the main glossary and hasn't identified it
% as a list of acronyms, then update. (This is done to ensure 
% backwards compatibility with versions prior to 2.04).
%    \begin{macrocode}
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetDefaultAcronymDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \DefaultNewAcronymDef
  }%
%    \end{macrocode}
% Define short cuts.
%    \begin{macrocode}
  \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}%
  \renewcommand*{\glsshortkey}{text}%
  \renewcommand*{\glsshortpluralkey}{plural}%
  \renewcommand*{\glslongkey}{description}%
  \renewcommand*{\glslongpluralkey}{descriptionplural}%
  \def\@acrshort##1##2[##3]{\@glstext@{##1}{##2}[##3]}%
  \def\@Acrshort##1##2[##3]{\@Glstext@{##1}{##2}[##3]}%
  \def\@ACRshort##1##2[##3]{\@GLStext@{##1}{##2}[##3]}%
  \def\@acrshortpl##1##2[##3]{\@glsplural@{##1}{##2}[##3]}%
  \def\@Acrshortpl##1##2[##3]{\@Glsplural@{##1}{##2}[##3]}%
  \def\@ACRshortpl##1##2[##3]{\@GLSplural@{##1}{##2}[##3]}%
  \def\@acrlong##1##2[##3]{\@glsdesc@{##1}{##2}[##3]}%
  \def\@Acrlong##1##2[##3]{\@Glsdesc@{##1}{##2}[##3]}%
  \def\@ACRlong##1##2[##3]{\@GLSdesc@{##1}{##2}[##3]}%
  \def\@acrlongpl##1##2[##3]{\@glsdescplural@{##1}{##2}[##3]}%
  \def\@Acrlongpl##1##2[##3]{\@Glsdescplural@{##1}{##2}[##3]}%
  \def\@ACRlongpl##1##2[##3]{\@GLSdescplural@{##1}{##2}[##3]}%
  \def\@acrfull##1##2[##3]{\@glsfirst@{##1}{##2}[##3]}%
  \def\@Acrfull##1##2[##3]{\@Glsfirst@{##1}{##2}[##3]}%
  \def\@ACRfull##1##2[##3]{\@GLSfirst@{##1}{##2}[##3]}%
  \def\@acrfullpl##1##2[##3]{\@glsfirstplural@{##1}{##2}[##3]}%
  \def\@Acrfullpl##1##2[##3]{\@Glsfirstplural@{##1}{##2}[##3]}%
  \def\@ACRfullpl##1##2[##3]{\@GLSfirstplural@{##1}{##2}[##3]}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\SetDescriptionFootnoteAcronymDisplayStyle}
% Sets the acronym display style for given glossary for the
% description and footnote combination.
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\SetDescriptionFootnoteAcronymDisplayStyle}[1]{%
  \defglsdisplayfirst[#1]{%
    \firstacronymfont{##1}##4%
      \protect\footnote{%
        \glslink[\@gls@link@opts]{\@gls@link@label}{##3}}}%
  \defglsdisplay[#1]{\acronymfont{##1}##4}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\DescriptionFootnoteNewAcronymDef}
%    \begin{macrocode}
\newcommand*{\DescriptionFootnoteNewAcronymDef}{%
    \edef\@do@newglossaryentry{%
      \noexpand\newglossaryentry{\the\glslabeltok}%
      {%
        type=\acronymtype,%
        name={\noexpand\acronymfont{\the\glsshorttok}},%
        sort={\the\glsshorttok},%
        text={\the\glsshorttok},%
        plural={\the\glsshorttok\noexpand\acrpluralsuffix},%
        symbol={\the\glslongtok},%
        symbolplural={\the\glslongtok\noexpand\acrpluralsuffix},%
        \the\glskeylisttok
      }%
    }%
    \@do@newglossaryentry
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SetDescriptionFootnoteAcronymStyle}
% If a description and footnote are both required, store the long form 
% in the \gloskey{symbol} key. Store the short form in \gloskey{text}
% key. Note that since the long form is stored in the symbol key,
% if you want the long form to appear in the list of acronyms, you
% need to use a glossary style that displays the symbol key.
%    \begin{macrocode}
\newcommand*{\SetDescriptionFootnoteAcronymStyle}{%
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetDescriptionFootnoteAcronymDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \DescriptionFootnoteNewAcronymDef
  }%
%    \end{macrocode}
% Set up the commands to make a note of the keys to store the long
% and short forms:
%    \begin{macrocode}
  \def\glsshortkey{text}%
  \def\glsshortpluralkey{plural}%
  \def\glslongkey{symbol}%
  \def\glslongpluralkey{symbolplural}%
%    \end{macrocode}
% Set up short cuts. Short form:
%    \begin{macrocode}
  \def\@acrshort##1##2[##3]{%
    \acronymfont{\@glstext@{##1}{##2}[##3]}}%
  \def\@Acrshort##1##2[##3]{%
    \acronymfont{\@Glstext@{##1}{##2}[##3]}}%
  \def\@ACRshort##1##2[##3]{%
    \acronymfont{\@GLStext@{##1}{##2}[##3]}}%
%    \end{macrocode}
% Plural form:
%    \begin{macrocode}
  \def\@acrshortpl##1##2[##3]{%
    \acronymfont{\@glsplural@{##1}{##2}[##3]}}%
  \def\@Acrshortpl##1##2[##3]{%
    \acronymfont{\@Glsplural@{##1}{##2}[##3]}}%
  \def\@ACRshortpl##1##2[##3]{%
    \acronymfont{\@GLSplural@{##1}{##2}[##3]}}%
%    \end{macrocode}
% Long form:
%    \begin{macrocode}
  \def\@acrlong##1##2[##3]{\@glssymbol@{##1}{##2}[##3]}%
  \def\@Acrlong##1##2[##3]{\@Glssymbol@{##1}{##2}[##3]}%
  \def\@ACRlong##1##2[##3]{\@GLSsymbol@{##1}{##2}[##3]}%
%    \end{macrocode}
% Plural long form:
%    \begin{macrocode}
  \def\@acrlongpl##1##2[##3]{\@glssymbolplural@{##1}{##2}[##3]}%
  \def\@Acrlongpl##1##2[##3]{\@Glssymbolplural@{##1}{##2}[##3]}%
  \def\@ACRlongpl##1##2[##3]{\@GLSsymbolplural@{##1}{##2}[##3]}%
%    \end{macrocode}
% Full form:
%    \begin{macrocode}
   \def\@acrfull##1##2[##3]{\@glssymbol@{##1}{##2}[##3] 
     (\acronymfont{\@glstext@{##1}{##2}[##3]})}%
   \def\@Acrfull##1##2[##3]{\@Glssymbol@{##1}{##2}[##3] 
     (\acronymfont{\@glstext@{##1}{##2}[##3]})}%
   \def\@ACRfull##1##2[##3]{\@GLSsymbol@{##1}{##2}[##3] 
     (\acronymfont{\@GLStext@{##1}{##2}[##3]})}%
%    \end{macrocode}
% Plural full form:
%    \begin{macrocode}
  \def\@acrfullpl##1##2[##3]{\@glssymbolplural@{##1}{##2}[##3] 
    (\acronymfont{\@glsplural@{##1}{##2}[##3]})}%
  \def\@Acrfullpl##1##2[##3]{\@Glssymbolplural@{##1}{##2}[##3] 
    (\acronymfont{\@glsplural@{##1}{##2}[##3]})}%
  \def\@ACRfullpl##1##2[##3]{\@GLSsymbolplural@{##1}{##2}[##3] 
    (\acronymfont{\@GLSplural@{##1}{##2}[##3]})}%
%    \end{macrocode}
%
% If \pkgopt{footnote} package option is specified, set the first
% use to append the long form (stored in \gloskey{symbol}) as a 
% footnote.
%\changes{1.12}{2008 Mar 8}{Added 'protect before 'footnote
% and 'glslink}
%    \begin{macrocode}
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetDescriptionFootnoteAcronymDisplayStyle{\@gls@type}%
  }%
%    \end{macrocode}
% Redefine \ics{acronymfont} if small caps required. The plural suffix
% is set in an upright font so that it remains in normal lower case,
% otherwise it looks as though it's part of the acronym.
%\changes{1.19}{2009 Mar 2}{changed 'acronymfont to use 'textsmaller instead
%of 'smaller}
%    \begin{macrocode}
  \ifglsacrsmallcaps
    \renewcommand*{\acronymfont}[1]{\textsc{##1}}%
    \renewcommand*{\acrpluralsuffix}{%
      \textup{\glspluralsuffix}}%
  \else
    \ifglsacrsmaller
      \renewcommand*{\acronymfont}[1]{\textsmaller{##1}}%
    \fi
  \fi
%    \end{macrocode}
% Check for package option clash
%    \begin{macrocode}
  \ifglsacrdua
    \PackageError{glossaries}{Option clash: `footnote' and `dua'
    can't both be set}{}%
  \fi
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\SetDescriptionDUAAcronymDisplayStyle}
% Sets the acronym display style for given glossary with 
% description and dua combination.
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\SetDescriptionDUAAcronymDisplayStyle}[1]{%
  \defglsdisplay[#1]{##1##4}%
  \defglsdisplayfirst[#1]{##1##4}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\DescriptionDUANewAcronymDef}
%    \begin{macrocode}
\newcommand*{\DescriptionDUANewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\the\glslongtok},%
      sort={\the\glslongtok},
      text={\the\glslongtok},%
      plural={\the\glslongtok\noexpand\acrpluralsuffix},%
      symbol={\the\glsshorttok},%
      symbolplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      \the\glskeylisttok
    }%
  }%
  \@do@newglossaryentry
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SetDescriptionDUAAcronymStyle}
% Description, don't use acronym and no footnote. 
% Note that the short form is stored in the \gloskey{symbol} key,
% so if the short form needs to be displayed in the glossary, 
% use a style the displays the symbol.
%    \begin{macrocode}
\newcommand*{\SetDescriptionDUAAcronymStyle}{%
  \ifglsacrsmallcaps
    \PackageError{glossaries}{Option clash: `smallcaps' and `dua'
    can't both be set}{}%
  \else
    \ifglsacrsmaller
      \PackageError{glossaries}{Option clash: `smaller' and `dua'
      can't both be set}{}%
    \fi
  \fi
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetDescriptionDUAAcronymDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \DescriptionDUANewAcronymDef
  }%
%    \end{macrocode}
% Set up the commands to make a note of the keys to store the long
% and short forms:
%    \begin{macrocode}
  \def\glsshortkey{symbol}%
  \def\glsshortpluralkey{symbolplural}%
  \def\glslongkey{first}%
  \def\glslongpluralkey{plural}%
%    \end{macrocode}
% Set up short cuts. Short form:
%    \begin{macrocode}
  \def\@acrshort##1##2[##3]{%
    \acronymfont{\@glssymbol@{##1}{##2}[##3]}}%
  \def\@Acrshort##1##2[##3]{%
    \acronymfont{\@Glssymbol@{##1}{##2}[##3]}}%
  \def\@ACRshort##1##2[##3]{%
    \acronymfont{\@GLSsymbol@{##1}{##2}[##3]}}%
%    \end{macrocode}
% Plural short form:
%    \begin{macrocode}
  \def\@acrshortpl##1##2[##3]{%
    \acronymfont{\@glssymbolplural@{##1}{##2}[##3]}}%
  \def\@Acrshortpl##1##2[##3]{%
    \acronymfont{\@Glssymbolplural@{##1}{##2}[##3]}}%
  \def\@ACRshortpl##1##2[##3]{%
    \acronymfont{\@GLSsymbolplural@{##1}{##2}[##3]}}%
%    \end{macrocode}
% Long form:
%    \begin{macrocode}
  \def\@acrlong##1##2[##3]{\@glsfirst@{##1}{##2}[##3]}%
  \def\@Acrlong##1##2[##3]{\@Glsfirst@{##1}{##2}[##3]}%
  \def\@ACRlong##1##2[##3]{\@GLSfirst@{##1}{##2}[##3]}%
%    \end{macrocode}
% Plural long form:
%    \begin{macrocode}
  \def\@acrlongpl##1##2[##3]{\@glsfirstplural@{##1}{##2}[##3]}%
  \def\@Acrlongpl##1##2[##3]{\@Glsfirstplural@{##1}{##2}[##3]}%
  \def\@ACRlongpl##1##2[##3]{\@GLSfirstplural@{##1}{##2}[##3]}%
%    \end{macrocode}
% Full form:
%    \begin{macrocode}
  \def\@acrfull##1##2[##3]{\@glsfirst@{##1}{##2}[##3] 
    (\acronymfont{\@glssymbol@{##1}{##2}[##3]})}%
  \def\@Acrfull##1##2[##3]{\@Glsfirst@{##1}{##2}[##3] 
    (\acronymfont{\@glssymbol@{##1}{##2}[##3]})}%
  \def\@ACRfull##1##2[##3]{\@GLSfirst@{##1}{##2}[##3] 
    (\acronymfont{\@GLSsymbol@{##1}{##2}[##3]})}%
%    \end{macrocode}
% Plural full form:
%    \begin{macrocode}
  \def\@acrfullpl##1##2[##3]{\@glsfirstplural@{##1}{##2}[##3] 
    (\acronymfont{\@glssymbolplural@{##1}{##2}[##3]})}%
  \def\@Acrfullpl##1##2[##3]{\@Glsfirstplural@{##1}{##2}[##3] 
    (\acronymfont{\@glssymbolplural@{##1}{##2}[##3]})}%
  \def\@ACRfullpl##1##2[##3]{\@GLSfirstplural@{##1}{##2}[##3] 
    (\acronymfont{\@GLSsymbolplural@{##1}{##2}[##3]})}%
%    \end{macrocode}
% Set display.
%    \begin{macrocode}
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetDescriptionDUAAcronymDisplayStyle{\@gls@type}%
  }%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\SetDescriptionAcronymDisplayStyle}
% Sets the acronym display style for given glossary using
% the description setting (but not footnote or dua).
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\SetDescriptionAcronymDisplayStyle}[1]{%
  \defglsdisplayfirst[#1]{%
    ##1##4 (\firstacronymfont{##3})}%
  \defglsdisplay[#1]{\acronymfont{##1}##4}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\DescriptionNewAcronymDef}
%    \begin{macrocode}
\newcommand*{\DescriptionNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\noexpand
        \acrnameformat{\the\glsshorttok}{\the\glslongtok}},%
      sort={\the\glsshorttok},%
      first={\the\glslongtok},%
      firstplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      text={\the\glsshorttok},%
      plural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      symbol={\noexpand\@glo@text},%
      symbolplural={\noexpand\@glo@plural},%
      \the\glskeylisttok}%
  }%
  \@do@newglossaryentry
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SetDescriptionAcronymStyle}
% Option \pkgopt{description} is used, but not \pkgopt{dua}
% or \pkgopt{footnote}.
% Store long form in \gloskey{first} key
% and short form in \gloskey{text} and \gloskey{symbol} key.
% The name is stored using \ics{acrnameformat} to allow the
% user to override the way the name is displayed in the
% list of acronyms.
%    \begin{macrocode}
\newcommand*{\SetDescriptionAcronymStyle}{%
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetDescriptionAcronymDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \DescriptionNewAcronymDef
  }%
%    \end{macrocode}
% Set up the commands to make a note of the keys to store the long
% and short forms:
%    \begin{macrocode}
  \def\glsshortkey{text}%
  \def\glsshortpluralkey{plural}%
  \def\glslongkey{first}%
  \def\glslongpluralkey{firstplural}%
%    \end{macrocode}
% Set up short cuts. Short form:
%    \begin{macrocode}
  \def\@acrshort##1##2[##3]{%
    \acronymfont{\@glstext@{##1}{##2}[##3]}}%
  \def\@Acrshort##1##2[##3]{%
    \acronymfont{\@Glstext@{##1}{##2}[##3]}}%
  \def\@ACRshort##1##2[##3]{%
    \acronymfont{\@GLStext@{##1}{##2}[##3]}}%
%    \end{macrocode}
% Plural short form:
%    \begin{macrocode}
  \def\@acrshortpl##1##2[##3]{%
    \acronymfont{\@glsplural@{##1}{##2}[##3]}}%
  \def\@Acrshortpl##1##2[##3]{%
    \acronymfont{\@Glsplural@{##1}{##2}[##3]}}%
  \def\@ACRshortpl##1##2[##3]{%
    \acronymfont{\@GLSplural@{##1}{##2}[##3]}}%
%    \end{macrocode}
% Long form:
%    \begin{macrocode}
  \def\@acrlong##1##2[##3]{\@glsfirst@{##1}{##2}[##3]}%
  \def\@Acrlong##1##2[##3]{\@Glsfirst@{##1}{##2}[##3]}%
  \def\@ACRlong##1##2[##3]{\@GLSfirst@{##1}{##2}[##3]}%
%    \end{macrocode}
% Plural long form:
%    \begin{macrocode}
  \def\@acrlongpl##1##2[##3]{\@glsfirstplural@{##1}{##2}[##3]}%
  \def\@Acrlongpl##1##2[##3]{\@Glsfirstplural@{##1}{##2}[##3]}%
  \def\@ACRlongpl##1##2[##3]{\@GLSfirstplural@{##1}{##2}[##3]}%
%    \end{macrocode}
% Full form:
%    \begin{macrocode}
  \def\@acrfull##1##2[##3]{\@glsfirst@{##1}{##2}[##3] 
    (\acronymfont{\@glssymbol@{##1}{##2}[##3]})}%
  \def\@Acrfull##1##2[##3]{\@Glsfirst@{##1}{##2}[##3] 
    (\acronymfont{\@glssymbol@{##1}{##2}[##3]})}%
  \def\@ACRfull##1##2[##3]{\@GLSfirst@{##1}{##2}[##3] 
    (\acronymfont{\@GLSsymbol@{##1}{##2}[##3]})}%
%    \end{macrocode}
% Plural full form:
%    \begin{macrocode}
  \def\@acrfullpl##1##2[##3]{\@glsfirstplural@{##1}{##2}[##3] 
    (\acronymfont{\@glssymbolplural@{##1}{##2}[##3]})}%
  \def\@Acrfullpl##1##2[##3]{\@Glsfirstplural@{##1}{##2}[##3] 
    (\acronymfont{\@glssymbolplural@{##1}{##2}[##3]})}%
  \def\@ACRfullpl##1##2[##3]{\@GLSfirstplural@{##1}{##2}[##3] 
    (\acronymfont{\@GLSsymbolplural@{##1}{##2}[##3]})}%
%    \end{macrocode}
% Set display.
%    \begin{macrocode}
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetDescriptionAcronymDisplayStyle{\@gls@type}%
  }%
%    \end{macrocode}
% Redefine \ics{acronymfont} if small caps required. The plural suffix
% is set in an upright font so that it remains in normal lower case,
% otherwise it looks as though it's part of the acronym.
%\changes{1.19}{2009 Mar 2}{changed 'acronymfont to use 'textsmaller instead
%of 'smaller}
%    \begin{macrocode}
  \ifglsacrsmallcaps
    \renewcommand{\acronymfont}[1]{\textsc{##1}}
    \renewcommand*{\acrpluralsuffix}{%
      \textup{\glspluralsuffix}}%
  \else
    \ifglsacrsmaller
      \renewcommand*{\acronymfont}[1]{\textsmaller{##1}}%
    \fi
  \fi
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\SetFootnoteAcronymDisplayStyle}
% Sets the acronym display style for given glossary with
% footnote setting (but not description or dua).
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\SetFootnoteAcronymDisplayStyle}[1]{%
  \defglsdisplayfirst[#1]{%
    \firstacronymfont{##1}##4\protect\footnote{%
       \protect\glslink
         [\@gls@link@opts]{\@gls@link@label}{##2}}}%
  \defglsdisplay[#1]{\acronymfont{##1}##4}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\FootnoteNewAcronymDef}
%    \begin{macrocode}
\newcommand*{\FootnoteNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\noexpand\acronymfont{\the\glsshorttok}},%
      sort={\the\glsshorttok},%
      text={\the\glsshorttok},%
      plural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      description={\the\glslongtok},%
      descriptionplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      \the\glskeylisttok
    }%
  }%
  \@do@newglossaryentry
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SetFootnoteAcronymStyle}
% If \pkgopt{footnote} package option is specified, set the first
% use to append the long form (stored in \gloskey{description}) as a 
% footnote.
% Use the \gloskey{description} key to store the long form.
%    \begin{macrocode}
\newcommand*{\SetFootnoteAcronymStyle}{%
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetFootnoteAcronymDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \FootnoteNewAcronymDef
  }%
%    \end{macrocode}
% Set up the commands to make a note of the keys to store the long
% and short forms:
%    \begin{macrocode}
  \def\glsshortkey{text}%
  \def\glsshortpluralkey{plural}%
  \def\glslongkey{description}%
  \def\glslongpluralkey{descriptionplural}%
%    \end{macrocode}
% Set display
%\changes{1.12}{2008 Mar 8}{Added 'protect before 'footnote and
% 'glslink}
%    \begin{macrocode}
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetFootnoteAcronymDisplayStyle{\@gls@type}%
  }%
%    \end{macrocode}
% Set up short cuts. Short form:
%    \begin{macrocode}
  \def\@acrshort##1##2[##3]{\acronymfont{\@glstext@{##1}{##2}[##3]}}%
  \def\@Acrshort##1##2[##3]{\acronymfont{\@Glstext@{##1}{##2}[##3]}}%
  \def\@ACRshort##1##2[##3]{\acronymfont{\@GLStext@{##1}{##2}[##3]}}%
%    \end{macrocode}
% Plural short form:
%    \begin{macrocode}
  \def\@acrshortpl##1##2[##3]{%
    \acronymfont{\@glsplural@{##1}{##2}[##3]}}%
  \def\@Acrshortpl##1##2[##3]{%
    \acronymfont{\@Glsplural@{##1}{##2}[##3]}}%
  \def\@ACRshortpl##1##2[##3]{%
    \acronymfont{\@GLSplural@{##1}{##2}[##3]}}%
%    \end{macrocode}
% Long form:
%    \begin{macrocode}
  \def\@acrlong##1##2[##3]{\@glsdesc@{##1}{##2}[##3]}%
  \def\@Acrlong##1##2[##3]{\@Glsdesc@{##1}{##2}[##3]}%
  \def\@ACRlong##1##2[##3]{\@GLSdesc@{##1}{##2}[##3]}%
%    \end{macrocode}
% Plural long form:
%    \begin{macrocode}
  \def\@acrlongpl##1##2[##3]{\@glsdescplural@{##1}{##2}[##3]}%
  \def\@Acrlongpl##1##2[##3]{\@Glsdescplural@{##1}{##2}[##3]}%
  \def\@ACRlongpl##1##2[##3]{\@GLSdescplural@{##1}{##2}[##3]}%
%    \end{macrocode}
% Full form:
%    \begin{macrocode}
  \def\@acrfull##1##2[##3]{\@glsdesc@{##1}{##2}[##3] 
    (\@glstext@{##1}{##2}[##3])}%
  \def\@Acrfull##1##2[##3]{\@Glsdesc@{##1}{##2}[##3] 
    (\@glstext@{##1}{##2}[##3])}%
  \def\@ACRfull##1##2[##3]{\@GLSdesc@{##1}{##2}[##3] 
    (\@GLStext@{##1}{##2}[##3])}%
%    \end{macrocode}
% Plural full form:
%    \begin{macrocode}
  \def\@acrfullpl##1##2[##3]{\@glsdescplural@{##1}{##2}[##3] 
    (\@glsplural@{##1}{##2}[##3])}%
  \def\@Acrfullpl##1##2[##3]{\@Glsdesctext@{##1}{##2}[##3] 
    (\@glsplural@{##1}{##2}[##3])}%
  \def\@ACRfullpl##1##2[##3]{\@GLSdesctext@{##1}{##2}[##3] 
    (\@GLSplural@{##1}{##2}[##3])}%
%    \end{macrocode}
% Redefine \ics{acronymfont} if small caps required. The plural suffix
% is set in an upright font so that it remains in normal lower case,
% otherwise it looks as though it's part of the acronym.
%\changes{1.19}{2009 Mar 2}{changed 'acronymfont to use 'textsmaller instead
%of 'smaller}
%    \begin{macrocode}
  \ifglsacrsmallcaps
     \renewcommand*{\acronymfont}[1]{\textsc{##1}}%
     \renewcommand*{\acrpluralsuffix}{%
        \textup{\glspluralsuffix}}%
  \else
     \ifglsacrsmaller
        \renewcommand*{\acronymfont}[1]{\textsmaller{##1}}%
     \fi
  \fi
%    \end{macrocode}
% Check for option clash
%    \begin{macrocode}
  \ifglsacrdua
     \PackageError{glossaries}{Option clash: `footnote' and `dua'
     can't both be set}{}%
  \fi
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\SetSmallAcronymDisplayStyle}
% Sets the acronym display style for given glossary where neither
% footnote nor description is required, but smallcaps or smaller
% specified.
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\SetSmallAcronymDisplayStyle}[1]{%
  \defglsdisplayfirst[#1]{##1##4 (\firstacronymfont{##3})}
  \defglsdisplay[#1]{\acronymfont{##1}##4}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SmallNewAcronymDef}
%    \begin{macrocode}
\newcommand*{\SmallNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\noexpand\acronymfont{\the\glsshorttok}},%
      sort={\the\glsshorttok},%
      text={\noexpand\@glo@symbol},%
      plural={\noexpand\@glo@symbolplural},%
      first={\the\glslongtok},%
      firstplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      description={\noexpand\@glo@first},%
      descriptionplural={\noexpand\@glo@firstplural},%
      symbol={\the\glsshorttok},%
      symbolplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      \the\glskeylisttok
    }%
  }%
  \@do@newglossaryentry
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SetSmallAcronymStyle}
% Neither footnote nor description required, but smallcaps or
% smaller specified.
% Use the \gloskey{symbol} key to store the short form and
% \gloskey{first} to store the long form.
%    \begin{macrocode}
\newcommand*{\SetSmallAcronymStyle}{%
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetSmallAcronymDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \SmallNewAcronymDef
  }%
%    \end{macrocode}
% Set up the commands to make a note of the keys to store the long
% and short forms:
%    \begin{macrocode}
  \def\glsshortkey{symbol}%
  \def\glsshortpluralkey{symbolplural}%
  \def\glslongkey{first}%
  \def\glslongpluralkey{firstplural}%
%    \end{macrocode}
% Change the display since \gloskey{first} only contains long form.
%    \begin{macrocode}
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetSmallAcronymDisplayStyle{\@gls@type}%
  }%
%    \end{macrocode}
% Redefine \ics{acronymfont} if small caps required. The plural suffix
% is set in an upright font so that it remains in normal lower case,
% otherwise it looks as though it's part of the acronym.
%\changes{1.19}{2009 Mar 2}{changed 'acronymfont to use 'textsmaller instead
%of 'smaller}
%    \begin{macrocode}
  \ifglsacrsmallcaps
    \renewcommand*{\acronymfont}[1]{\textsc{##1}}
    \renewcommand*{\acrpluralsuffix}{%
       \textup{\glspluralsuffix}}%
  \else
    \renewcommand*{\acronymfont}[1]{\textsmaller{##1}}
  \fi
%    \end{macrocode}
% Set up short cuts. Short form:
%    \begin{macrocode}
  \def\@acrshort##1##2[##3]{%
    \acronymfont{\@glstext@{##1}{##2}[##3]}}%
  \def\@Acrshort##1##2[##3]{%
    \acronymfont{\@Glstext@{##1}{##2}[##3]}}%
  \def\@ACRshort##1##2[##3]{%
    \acronymfont{\@GLStext@{##1}{##2}[##3]}}%
%    \end{macrocode}
% Plural short form:
%    \begin{macrocode}
  \def\@acrshortpl##1##2[##3]{%
    \acronymfont{\@glsplural@{##1}{##2}[##3]}}%
  \def\@Acrshortpl##1##2[##3]{%
    \acronymfont{\@Glsplural@{##1}{##2}[##3]}}%
  \def\@ACRshortpl##1##2[##3]{%
    \acronymfont{\@GLSplural@{##1}{##2}[##3]}}%
%    \end{macrocode}
% Long form:
%    \begin{macrocode}
  \def\@acrlong##1##2[##3]{\@glsfirst@{##1}{##2}[##3]}%
  \def\@Acrlong##1##2[##3]{\@Glsfirst@{##1}{##2}[##3]}%
  \def\@ACRlong##1##2[##3]{\@GLSfirst@{##1}{##2}[##3]}%
%    \end{macrocode}
% Plural long form:
%    \begin{macrocode}
  \def\@acrlongpl##1##2[##3]{\@glsfirstplural@{##1}{##2}[##3]}%
  \def\@Acrlongpl##1##2[##3]{\@Glsfirstplural@{##1}{##2}[##3]}%
  \def\@ACRlongpl##1##2[##3]{\@GLSfirstplural@{##1}{##2}[##3]}%
%    \end{macrocode}
% Full form:
%    \begin{macrocode}
  \def\@acrfull##1##2[##3]{\@glsfirst@{##1}{##2}[##3] 
    (\acronymfont{\@glstext@{##1}{##2}[##3]})}%
  \def\@Acrfull##1##2[##3]{\@Glsfirst@{##1}{##2}[##3] 
    (\acronymfont{\@glstext@{##1}{##2}[##3]})}%
  \def\@ACRfull##1##2[##3]{\@GLSfirst@{##1}{##2}[##3] 
    (\acronymfont{\@GLStext@{##1}{##2}[##3]})}%
%    \end{macrocode}
% Plural full form:
%    \begin{macrocode}
  \def\@acrfullpl##1##2[##3]{\@glsfirstplural@{##1}{##2}[##3] 
    (\acronymfont{\@glsplural@{##1}{##2}[##3]})}
  \def\@Acrfullpl##1##2[##3]{\@Glsfirstplural@{##1}{##2}[##3] 
    (\acronymfont{\@glsplural@{##1}{##2}[##3]})}
  \def\@ACRfullpl##1##2[##3]{\@GLSfirstplural@{##1}{##2}[##3] 
    (\acronymfont{\@GLSplural@{##1}{##2}[##3]})}
%    \end{macrocode}
% check for option clash
%    \begin{macrocode}
  \ifglsacrdua
    \ifglsacrsmallcaps
      \PackageError{glossaries}{Option clash: `smallcaps' and `dua'
      can't both be set}{}%
    \else
      \PackageError{glossaries}{Option clash: `smaller' and `dua'
      can't both be set}{}%
    \fi
  \fi
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\SetDUADisplayStyle}
% Sets the acronym display style for given glossary with dua
% setting.
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\SetDUADisplayStyle}[1]{%
  \defglsdisplay[#1]{##1##4}%
  \defglsdisplayfirst[#1]{##1##4}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\DUANewAcronymDef}
%    \begin{macrocode}
\newcommand*{\DUANewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\the\glsshorttok},%
      text={\the\glslongtok},%
      plural={\the\glslongtok\noexpand\acrpluralsuffix},%
      description={\the\glslongtok},%
      symbol={\the\glsshorttok},%
      symbolplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      \the\glskeylisttok
    }%
  }%
  \@do@newglossaryentry
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SetDUAStyle}
% Always expand acronyms.
%    \begin{macrocode}
\newcommand*{\SetDUAStyle}{%
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetDUADisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \DUANewAcronymDef
  }%
%    \end{macrocode}
% Set up the commands to make a note of the keys to store the long
% and short forms:
%    \begin{macrocode}
  \def\glsshortkey{symbol}%
  \def\glsshortpluralkey{symbolplural}%
  \def\glslongkey{text}%
  \def\glslongpluralkey{plural}%
%    \end{macrocode}
% Set the display
%    \begin{macrocode}
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetDUADisplayStyle{\@gls@type}%
  }%
%    \end{macrocode}
% Set up short cuts. Short form:
%    \begin{macrocode}
  \def\@acrshort##1##2[##3]{\@glssymbol@{##1}{##2}[##3]}%
  \def\@Acrshort##1##2[##3]{\@Glssymbol@{##1}{##2}[##3]}%
  \def\@ACRshort##1##2[##3]{\@GLSsymbol@{##1}{##2}[##3]}%
%    \end{macrocode}
% Plural short form:
%    \begin{macrocode}
  \def\@acrshortpl##1##2[##3]{\@glssymbolplural@{##1}{##2}[##3]}%
  \def\@Acrshortpl##1##2[##3]{\@Glssymbolplural@{##1}{##2}[##3]}%
  \def\@ACRshortpl##1##2[##3]{\@GLSsymbolplural@{##1}{##2}[##3]}%
%    \end{macrocode}
% Long form:
%    \begin{macrocode}
  \def\@acrlong##1##2[##3]{\@glstext@{##1}{##2}[##3]}%
  \def\@Acrlong##1##2[##3]{\@Glstext@{##1}{##2}[##3]}%
  \def\@ACRlong##1##2[##3]{\@GLStext@{##1}{##2}[##3]}%
%    \end{macrocode}
% Plural long form:
%    \begin{macrocode}
  \def\@acrlongpl##1##2[##3]{\@glsplural@{##1}{##2}[##3]}%
  \def\@Acrlongpl##1##2[##3]{\@Glsplural@{##1}{##2}[##3]}%
  \def\@ACRlongpl##1##2[##3]{\@GLSplural@{##1}{##2}[##3]}%
%    \end{macrocode}
% Full form:
%    \begin{macrocode}
  \def\@acrfull##1##2[##3]{\@glstext@{##1}{##2}[##3] 
    (\acronymfont{\@glssymbol@{##1}{##2}[##3]})}%
  \def\@Acrfull##1##2[##3]{\@Glstext@{##1}{##2}[##3] 
    (\acronymfont{\@glssymbol@{##1}{##2}[##3]})}%
  \def\@ACRfull##1##2[##3]{\@GLStext@{##1}{##2}[##3] 
    (\acronymfont{\@GLSsymbol@{##1}{##2}[##3]})}%
%    \end{macrocode}
% Plural full form:
%    \begin{macrocode}
  \def\@acrfullpl##1##2[##3]{\@glsplural@{##1}{##2}[##3] 
    (\acronymfont{\@glssymbolplural@{##1}{##2}[##3]})}%
  \def\@Acrfullpl##1##2[##3]{\@Glsplural@{##1}{##2}[##3] 
    (\acronymfont{\@glssymbolplural@{##1}{##2}[##3]})}%
  \def\@ACRfullpl##1##2[##3]{\@GLSplural@{##1}{##2}[##3] 
    (\acronymfont{\@GLSsymbolplural@{##1}{##2}[##3]})}%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\SetAcronymStyle}
%    \begin{macrocode}
\newcommand*{\SetAcronymStyle}{%
  \SetDefaultAcronymStyle
  \ifglsacrdescription
    \ifglsacrfootnote
      \SetDescriptionFootnoteAcronymStyle
    \else
      \ifglsacrdua
        \SetDescriptionDUAAcronymStyle
      \else
        \SetDescriptionAcronymStyle
      \fi
    \fi
  \else
    \ifglsacrfootnote
      \SetFootnoteAcronymStyle
    \else
      \ifthenelse{\boolean{glsacrsmallcaps}\OR
        \boolean{glsacrsmaller}}%
      {%
        \SetSmallAcronymStyle
      }%
      {%
        \ifglsacrdua
          \SetDUAStyle
        \fi
      }%
    \fi
  \fi
}
%    \end{macrocode}
% Set the acronym style according to the package options
%    \begin{macrocode}
\SetAcronymStyle
%    \end{macrocode}
%\end{macro}
%
% Allow user to define their own custom acronyms. The short form is
% stored in the user1 key, the plural short form is stored in the
% user2 key, the long form is stored in the user3 key and the
% plural long form is stored in the user4 key. Defaults to
% displaying only the acronym with the long form as the description.
%\begin{macro}{\SetCustomDisplayStyle}
% Sets the acronym display style.
%\changes{2.06}{2010 June 14}{new}
%    \begin{macrocode}
\newcommand*{\SetCustomDisplayStyle}[1]{%
  \defglsdisplay[#1]{##1##4}%
  \defglsdisplayfirst[#1]{##1##4}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\CustomAcronymFields}
%\changes{2.06}{2010 June 14}{new}
%    \begin{macrocode}
\newcommand*{\CustomAcronymFields}{%
  name={\the\glsshorttok},%
  description={\the\glslongtok},%
  first={\the\glslongtok\space(\the\glsshorttok)},%
  firstplural={\the\glslongtok\noexpand\acrpluralsuffix\space
    (\the\glsshorttok)}%
  text={\the\glsshorttok},%
  plural={\the\glsshorttok\noexpand\acrpluralsuffix}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\CustomNewAcronymDef}
%\changes{2.06}{2010 June 14}{new}
%    \begin{macrocode}
\newcommand*{\CustomNewAcronymDef}{%
  \protected@edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      user1={\the\glsshorttok},%
      user2={\the\glsshorttok\noexpand\acrpluralsuffix},%
      user3={\the\glslongtok},%
      user4={\the\glslongtok\noexpand\acrpluralsuffix},%
      \CustomAcronymFields,%
      \the\glskeylisttok
    }%
  }%
  \@do@newglossaryentry
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SetCustomStyle}
%\changes{2.06}{2010 June 14}{new}
%    \begin{macrocode}
\newcommand*{\SetCustomStyle}{%
  \renewcommand{\newacronym}[4][]{%
    \ifx\@glsacronymlists\@empty
      \def\@glo@type{\acronymtype}%
      \setkeys{glossentry}{##1}%
      \DeclareAcronymList{\@glo@type}%
      \SetCustomDisplayStyle{\@glo@type}%
    \fi
    \glskeylisttok{##1}%
    \glslabeltok{##2}%
    \glsshorttok{##3}%
    \glslongtok{##4}%
    \newacronymhook
    \CustomNewAcronymDef
  }%
%    \end{macrocode}
% Set up the commands to make a note of the keys to store the long
% and short forms:
%    \begin{macrocode}
  \def\glsshortkey{user1}%
  \def\glsshortpluralkey{user2}%
  \def\glslongkey{user3}%
  \def\glslongpluralkey{user4}%
%    \end{macrocode}
% Set the display
%    \begin{macrocode}
  \@for\@gls@type:=\@glsacronymlists\do{%
    \SetCustomDisplayStyle{\@gls@type}%
  }%
%    \end{macrocode}
% Set up short cuts. Short form:
%    \begin{macrocode}
  \def\@acrshort##1##2[##3]{\@glsuseri@{##1}{##2}[##3]}%
  \def\@Acrshort##1##2[##3]{\@Glsuseri@{##1}{##2}[##3]}%
  \def\@ACRshort##1##2[##3]{\@GLSuseri@{##1}{##2}[##3]}%
%    \end{macrocode}
% Plural short form:
%    \begin{macrocode}
  \def\@acrshortpl##1##2[##3]{\@glsuserii@{##1}{##2}[##3]}%
  \def\@Acrshortpl##1##2[##3]{\@Glsuserii@{##1}{##2}[##3]}%
  \def\@ACRshortpl##1##2[##3]{\@GLSuserii@{##1}{##2}[##3]}%
%    \end{macrocode}
% Long form:
%    \begin{macrocode}
  \def\@acrlong##1##2[##3]{\@glsuseriii@{##1}{##2}[##3]}%
  \def\@Acrlong##1##2[##3]{\@Glsuseriii@{##1}{##2}[##3]}%
  \def\@ACRlong##1##2[##3]{\@GLSuseriii@{##1}{##2}[##3]}%
%    \end{macrocode}
% Plural long form:
%    \begin{macrocode}
  \def\@acrlongpl##1##2[##3]{\@glsuseriv@{##1}{##2}[##3]}%
  \def\@Acrlongpl##1##2[##3]{\@Glsuseriv@{##1}{##2}[##3]}%
  \def\@ACRlongpl##1##2[##3]{\@GLSuseriv@{##1}{##2}[##3]}%
%    \end{macrocode}
% Full form:
%    \begin{macrocode}
  \def\@acrfull##1##2[##3]{\@glsuseriii@{##1}{##2}[##3] 
    (\acronymfont{\@glsuseri@{##1}{##2}[##3]})}%
  \def\@Acrfull##1##2[##3]{\@Glsuseriii@{##1}{##2}[##3] 
    (\acronymfont{\@glsuseri@{##1}{##2}[##3]})}%
  \def\@ACRfull##1##2[##3]{\@GLSuseriii@{##1}{##2}[##3] 
    (\acronymfont{\@GLSuseri@{##1}{##2}[##3]})}%
%    \end{macrocode}
% Plural full form:
%    \begin{macrocode}
  \def\@acrfullpl##1##2[##3]{\@glsuseriv@{##1}{##2}[##3] 
    (\acronymfont{\@glsuserii@{##1}{##2}[##3]})}%
  \def\@Acrfullpl##1##2[##3]{\@Glsuseriv@{##1}{##2}[##3] 
    (\acronymfont{\@glsuserii@{##1}{##2}[##3]})}%
  \def\@ACRfullpl##1##2[##3]{\@GLSuseriv@{##1}{##2}[##3] 
    (\acronymfont{\@GLSuserii@{##1}{##2}[##3]})}%
}%
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{\DefineAcronymSynonyms}
%\changes{2.04}{2009 November 10}{new}
%    \begin{macrocode}
\newcommand*{\DefineAcronymSynonyms}{%
%    \end{macrocode}
%\end{macro}
% Short form
%\begin{macro}{\acs}
%    \begin{macrocode}
  \let\acs\acrshort
%    \end{macrocode}
%\end{macro}
% First letter uppercase short form
%\begin{macro}{\Acs}
%    \begin{macrocode}
  \let\Acs\Acrshort
%    \end{macrocode}
%\end{macro}
% Plural short form
%\begin{macro}{\acsp}
%    \begin{macrocode}
  \let\acsp\acrshortpl
%    \end{macrocode}
%\end{macro}
% First letter uppercase plural short form
%\begin{macro}{\Acsp}
%    \begin{macrocode}
  \let\Acsp\Acrshortpl
%    \end{macrocode}
%\end{macro}
% Long form
%\begin{macro}{\acl}
%    \begin{macrocode}
  \let\acl\acrlong
%    \end{macrocode}
%\end{macro}
% Plural long form
%\begin{macro}{\aclp}
%    \begin{macrocode}
  \let\aclp\acrlongpl
%    \end{macrocode}
%\end{macro}
% First letter upper case long form
%\begin{macro}{\Acl}
%    \begin{macrocode}
  \let\Acl\Acrlong
%    \end{macrocode}
%\end{macro}
% First letter upper case plural long form
%\begin{macro}{\Aclp}
%    \begin{macrocode}
  \let\Aclp\Acrlongpl
%    \end{macrocode}
%\end{macro}
% Full form
%\begin{macro}{\acf}
%    \begin{macrocode}
  \let\acf\acrfull
%    \end{macrocode}
%\end{macro}
% Plural full form
%\begin{macro}{\acfp}
%    \begin{macrocode}
  \let\acfp\acrfullpl
%    \end{macrocode}
%\end{macro}
% First letter upper case full form
%\begin{macro}{\Acf}
%    \begin{macrocode}
  \let\Acf\Acrfull
%    \end{macrocode}
%\end{macro}
% First letter upper case plural full form
%\begin{macro}{\Acfp}
%    \begin{macrocode}
  \let\Acfp\Acrfullpl
%    \end{macrocode}
%\end{macro}
% Standard form
%\begin{macro}{\ac}
%    \begin{macrocode}
  \let\ac\gls
%    \end{macrocode}
%\end{macro}
% First upper case standard form
%\begin{macro}{\Ac}
%    \begin{macrocode}
  \let\Ac\Gls
%    \end{macrocode}
%\end{macro}
% Standard plural form
%\begin{macro}{\acp}
%    \begin{macrocode}
  \let\acp\glspl
%    \end{macrocode}
%\end{macro}
% Standard first letter upper case plural form
%\begin{macro}{\Acp}
%    \begin{macrocode}
  \let\Acp\Glspl
%    \end{macrocode}
%\end{macro}
%    \begin{macrocode}
}
%    \end{macrocode}
% Define synonyms if required
%    \begin{macrocode}
\ifglsacrshortcuts
  \DefineAcronymSynonyms
\fi
%    \end{macrocode}
%
% \subsection{Predefined Glossary Styles}\label{sec:code:styles}
% The \sty{glossaries} bundle comes with some predefined glossary
% styles. These need to be loaded now for the \pkgopt{style} option
% to use them.
%
% First, the glossary hyper-navigation commands need to be loaded.
%    \begin{macrocode}
\RequirePackage{glossary-hypernav}
%    \end{macrocode}
% The styles that use list-like environments. These are not loaded
% if the \pkgopt{nolist} option is used:
%    \begin{macrocode}
\@gls@loadlist
%    \end{macrocode}
% The styles that use the \env{longtable} environment. These are
% not loaded if the \pkgopt{nolong} package option is used.
%    \begin{macrocode}
\@gls@loadlong
%    \end{macrocode}
% The styles that use the \env{supertabular} environment. These are
% not loaded if the \pkgopt{nosuper} package option is used or if
% the \isty{supertabular} package isn't installed.
%    \begin{macrocode}
\@gls@loadsuper
%    \end{macrocode}
% The tree-like styles. These are not loaded if the \pkgopt{notree}
% package option is used.
%    \begin{macrocode}
\@gls@loadtree
%    \end{macrocode}
% The default glossary style is set according to the \pkgopt{style} package
% option, but can be overridden by \ics{glossarystyle}. The
% required style must be defined at this point.
%    \begin{macrocode}
\ifx\@glossary@default@style\relax
\else
  \glossarystyle{\@glossary@default@style}
\fi
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*mfirstuc.sty>
%    \end{macrocode}
%\fi
%\section{Mfirstuc Documented Code}
%\label{sec:code:mfirstuc}
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mfirstuc}[2009/11/03 v1.04 (NLCT)]
%    \end{macrocode}
%\begin{macro}{\makefirstuc}
% Syntax:\\
% \cs{makefirstuc}\marg{text}\\
% Makes the first letter uppercase, but will
% skip initial control sequences if they are followed by a group
% and make the first thing in the group uppercase, unless the group
% is empty.
% Thus \verb|\makefirstuc{abc}| will produce: Abc, 
% \verb|\makefirstuc{\ae bc}| will produce: \AE bc, but
% \verb|\makefirstuc{\emph{abc}}| will produce \emph{Abc}.
% This is required by \ics{Gls} and \ics{Glspl}.
%    \begin{macrocode}
\newif\if@glscs
\newtoks\@glsmfirst
\newtoks\@glsmrest
\def\makefirstuc#1{%
  \def\gls@argi{#1}%
  \ifx\gls@argi\@empty
%    \end{macrocode}
% If the argument is empty, do nothing.
%    \begin{macrocode}
  \else
%    \end{macrocode}
%\changes{1.03}{2008/12/22}{changed 'protected@edef to 'def}
%    \begin{macrocode}
    \def\@gls@tmp{\ #1}%
    \@onelevel@sanitize\@gls@tmp
    \expandafter\@gls@checkcs\@gls@tmp\relax\relax
    \if@glscs
      \@gls@getbody #1{}\@nil
      \ifx\@gls@rest\@empty
        \@gls@makefirstuc{#1}%
      \else
        \expandafter\@gls@split\@gls@rest\@nil
        \ifx\@gls@first\@empty
           \@gls@makefirstuc{#1}%
        \else
           \expandafter\@glsmfirst\expandafter{\@gls@first}%
           \expandafter\@glsmrest\expandafter{\@gls@rest}%
           \edef\@gls@domfirstuc{\noexpand\@gls@body
             {\noexpand\@gls@makefirstuc\the\@glsmfirst}%
             \the\@glsmrest}%
           \@gls@domfirstuc
        \fi
      \fi
    \else
      \@gls@makefirstuc{#1}%
    \fi
  \fi
}
%    \end{macrocode}
%\end{macro}
% Put first argument in \cs{@gls@first} and second argument in
% \cs{@gls@rest}:
%    \begin{macrocode}
\def\@gls@split#1#2\@nil{%
  \def\@gls@first{#1}\def\@gls@rest{#2}%
}
%    \end{macrocode}
%    \begin{macrocode}
\def\@gls@checkcs#1 #2#3\relax{%
  \def\@gls@argi{#1}\def\@gls@argii{#2}%
  \ifx\@gls@argi\@gls@argii
    \@glscstrue
  \else
    \@glscsfalse
  \fi
}
%    \end{macrocode}
% Make first thing upper case:
%    \begin{macrocode}
\def\@gls@makefirstuc#1{\MakeUppercase #1}
%    \end{macrocode}
%
% Get the first grouped argument and stores in \cs{@gls@body}.
%    \begin{macrocode}
\def\@gls@getbody#1#{\def\@gls@body{#1}\@gls@gobbletonil}
%    \end{macrocode}
% Scoup up everything to \cs{@nil} and store in \cs{@gls@rest}:
%    \begin{macrocode}
\def\@gls@gobbletonil#1\@nil{\def\@gls@rest{#1}}
%    \end{macrocode}
%
%\begin{macro}{\xmakefirstuc}
% Expand argument once before applying \cs{makefirstuc}
% (added v1.01).
%    \begin{macrocode}
\newcommand*{\xmakefirstuc}[1]{%
\expandafter\makefirstuc\expandafter{#1}}
%    \end{macrocode}
%\end{macro}
%\section{Glossary Styles}
%\iffalse
%    \begin{macrocode}
%</mfirstuc.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossary-hypernav.sty>
%    \end{macrocode}
%\fi
% \subsection{Glossary hyper-navigation definitions (glossary-hypernav package)}
%\label{sec:code:hypernav}
% Package Definition:
%    \begin{macrocode}
\ProvidesPackage{glossary-hypernav}[2007/07/04 v1.01 (NLCT)]
%    \end{macrocode}
%
% The commands defined in this package are provided to 
% help navigate around the groups within a glossary 
% (see \autoref{sec:code:printglos}.)
% \ics{printglossary} (and \ics{printglossaries})
% set \cs{@glo@type} to the label of the current
% glossary. This is used to create a unique hypertarget in
% the event of multiple glossaries.
%\\[10pt]
% \cs{glsnavhyperlink}\oarg{type}\marg{label}\marg{text}\\[10pt]
% This command makes \meta{text} a hyperlink to the glossary group
% whose label is given by \meta{label} for the glossary given
% by \meta{type}.
%\begin{macro}{\glsnavhyperlink}
%\changes{1.14}{2008 June 17}{changed 'edef to 'protected@edef}
%\changes{1.17}{2008 December 26}{replaced 'hyperlink to '@glslink}
%    \begin{macrocode}
\newcommand*{\glsnavhyperlink}[3][\@glo@type]{%
  \edef\gls@grplabel{#2}\protected@edef\@gls@grptitle{#3}%
  \@glslink{glsn:#1@#2}{#3}}
%    \end{macrocode}
%\end{macro}
%\vskip5pt
% \cs{glsnavhypertarget}\oarg{type}\marg{label}\marg{text}\\[10pt]
% This command makes \meta{text} a hypertarget for the glossary group
% whose label is given by \meta{label} in the glossary given
% by \meta{type}. If \meta{type} is omitted, \cs{@glo@type} is
% used which is set by \ics{printglossary} to the current
% glossary label.
%\begin{macro}{\glsnavhypertarget}
%\changes{1.14}{2008 June 17}{added write to aux file}
%\changes{1.15}{2008 August 15}{added check if rerun required}
%\changes{1.17}{2008 December 26}{replaced 'hypertarget to '@glstarget}
%    \begin{macrocode}
\newcommand*{\glsnavhypertarget}[3][\@glo@type]{%
%    \end{macrocode}
% Add this group to the aux file for re-run check.
%    \begin{macrocode}
  \protected@write\@auxout{}{\string\@gls@hypergroup{#1}{#2}}%
%    \end{macrocode}
% Add the target.
%    \begin{macrocode}
  \@glstarget{glsn:#1@#2}{#3}%
%    \end{macrocode}
% Check list of know groups to determine if a re-run is required.
%    \begin{macrocode}
  \expandafter\let
     \expandafter\@gls@list\csname @gls@hypergrouplist@#1\endcsname
%    \end{macrocode}
% Iterate through list and terminate loop if this group is found.
%    \begin{macrocode}
  \@for\@gls@elem:=\@gls@list\do{%
    \ifthenelse{\equal{\@gls@elem}{#2}}{\@endfortrue}{}}%
%    \end{macrocode}
% Check if list terminated prematurely.
%    \begin{macrocode}
  \if@endfor
  \else
%    \end{macrocode}
% This group was not included in the list, so issue a warning.
%    \begin{macrocode}
    \GlossariesWarningNoLine{Navigation panel 
       for glossary type `#1'^^Jmissing group `#2'}%
    \gdef\gls@hypergrouprerun{%
      \GlossariesWarningNoLine{Navigation panel 
      has changed. Rerun LaTeX}}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\gls@hypergrouprerun}
% Give a warning at the end if re-run required
%\changes{1.15}{2008 August 15}{new}
%    \begin{macrocode}
\let\gls@hypergrouprerun\relax
\AtEndDocument{\gls@hypergrouprerun}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@hypergroup}
% This adds to (or creates) the command \cs{@gls@hypergrouplist@}\meta{glossary type} 
% which lists all groups for a given glossary, so that
% the navigation bar only contains those groups that are present.
% However it requires at least 2 runs to ensure the information is
% up-to-date.
%\changes{1.14}{2008 June 17}{new}
%    \begin{macrocode}
\newcommand*{\@gls@hypergroup}[2]{%
\@ifundefined{@gls@hypergrouplist@#1}{%
   \expandafter\xdef\csname @gls@hypergrouplist@#1\endcsname{#2}%
}{%
   \expandafter\let\expandafter\@gls@tmp
      \csname @gls@hypergrouplist@#1\endcsname
   \expandafter\xdef\csname @gls@hypergrouplist@#1\endcsname{%
      \@gls@tmp,#2}%
}%
}
%    \end{macrocode}
%\end{macro}
%
% The \cs{glsnavigation} command displays a simple glossary 
% group navigation. 
% The symbol and number elements are defined separately, 
% so that they can be suppressed if need be. Note that this 
% command will produce a link to all 28 groups, but some groups
% may not be defined if there are groups that do not contain any
% terms, in which case you will get an undefined hyperlink warning.
% Now for the whole navigation bit:
%\begin{macro}{\glsnavigation}
% \changes{1.14}{2008 June 2008}{changed to only use labels for
% groups that are present}
%    \begin{macrocode}
\newcommand*{\glsnavigation}{%
\def\@gls@between{}%
\@ifundefined{@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
   \glsnavhyperlink{\@gls@tmp}{\glsgetgrouptitle{\@gls@tmp}}%
   \let\@gls@between\glshypernavsep%
}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glshypernavsep}
% Separator for the hyper navigation bar.
%    \begin{macrocode}
\newcommand*{\glshypernavsep}{\space\textbar\space}
%    \end{macrocode}
%\end{macro}
% The \cs{glssymbolnav} produces a simple navigation set of
% links for just the symbol and number groups. This used to be used at
% the start of \cs{glsnavigation}. This command is no longer needed.
%\begin{macro}{\glssymbolnav}
%    \begin{macrocode}
\newcommand*{\glssymbolnav}{%
\glsnavhyperlink{glssymbols}{\glsgetgrouptitle{glssymbols}}%
\glshypernavsep
\glsnavhyperlink{glsnumbers}{\glsgetgrouptitle{glsnumbers}}%
\glshypernavsep
}
%    \end{macrocode}
%\end{macro}
%\iffalse
%    \begin{macrocode}
%</glossary-hypernav.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossary-list.sty>
%    \end{macrocode}
%\fi
% \subsection{List Style (glossary-list.sty)}
% The \isty{glossary-list} style file defines glossary styles
% that use the \env{description} environment. Note that since
% the entry name is placed in the optional argument to the
% \ics{item} command, it will appear in a bold font by
% default.
%    \begin{macrocode}
\ProvidesPackage{glossary-list}[2009/05/30 v2.01 (NLCT)]
%    \end{macrocode}
%\begin{style}{list}
% The \glostyle{list} glossary style 
% uses the \env{description} environment. The group separator
% \ics{glsgroupskip} is redefined as \cs{indexspace}
% which produces a gap between groups. The glossary heading
% and the group headings do nothing. Sub-entries immediately
% follow the main entry without the sub-entry name. This style
% does not use the entry's symbol. This is used as the default
% style for the \sty{glossaries} package.
%    \begin{macrocode}
\newglossarystyle{list}{%
%    \end{macrocode}
% Use \env{description} environment:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{description}}{\end{description}}%
%    \end{macrocode}
% No header at the start of the environment:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries start a new item in the list:
%    \begin{macrocode}
  \renewcommand*{\glossaryentryfield}[5]{%
    \item[\glstarget{##1}{##2}] ##3\glspostdescription\space ##5}%
%    \end{macrocode}
% Sub-entries continue on the same line:
%    \begin{macrocode}
  \renewcommand*{\glossarysubentryfield}[6]{%
    \glstarget{##2}{\strut}##4\glspostdescription\space ##6.}%
%   \end{macrocode}
% Add vertical space between groups:
%   \begin{macrocode}
  \renewcommand*{\glsgroupskip}{\indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{listgroup}
% The \glostyle{listgroup} style is like the \glostyle{list}
% style, but the glossary groups have headings.
%\changes{1.08}{2007 Oct 13}{changed listgroup style to use \cs{glsgetgrouptitle}}
%    \begin{macrocode}
\newglossarystyle{listgroup}{%
%    \end{macrocode}
% Base it on the \glostyle{list} style:
%    \begin{macrocode}
  \glossarystyle{list}%
%    \end{macrocode}
% Each group has a heading:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{\item[\glsgetgrouptitle{##1}]}}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{listhypergroup}
% The \glostyle{listhypergroup} style is like the \glostyle{listgroup}
% style, but has a set of links to the groups at the
% start of the glossary.
%    \begin{macrocode}
\newglossarystyle{listhypergroup}{%
%    \end{macrocode}
% Base it on the \glostyle{list} style:
%    \begin{macrocode}
  \glossarystyle{list}%
%    \end{macrocode}
% Add navigation links at the start of the environment:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \item[\glsnavigation]}%
%    \end{macrocode}
% Each group has a heading with a hypertarget:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \item[\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}]}}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlist}
% The \glostyle{altlist} glossary style is like the \glostyle{list}
% style, but places the description on a new line. Sub-entries
% follow in separate paragraphs without the sub-entry name. This
% style does not use the entry's symbol.
%    \begin{macrocode}
\newglossarystyle{altlist}{%
%    \end{macrocode}
% Base it on the \glostyle{list} style:
%    \begin{macrocode}
  \glossarystyle{list}%
%    \end{macrocode}
% Main (level 0) entries start a new item in the list with a
% line break after the entry name:
%    \begin{macrocode}
  \renewcommand*{\glossaryentryfield}[5]{%
    \item[\glstarget{##1}{##2}]\mbox{}\newline 
      ##3\glspostdescription\space ##5}%
%    \end{macrocode}
% Sub-entries start a new paragraph:
%    \begin{macrocode}
  \renewcommand{\glossarysubentryfield}[6]{%
    \par\glstarget{##2}{\strut}##4\glspostdescription\space ##6}%
}
%    \end{macrocode}
%\end{style}
%\begin{style}{altlistgroup}
% The \glostyle{altlistgroup} glossary style is like the
% \glostyle{altlist} style, but the glossary groups have headings.
%\changes{1.08}{2007 Oct 13}{changed altlistgroup style to use \cs{glsgetgrouptitle}}
%    \begin{macrocode}
\newglossarystyle{altlistgroup}{%
%    \end{macrocode}
% Base it on the \glostyle{altlist} style:
%    \begin{macrocode}
  \glossarystyle{altlist}%
%    \end{macrocode}
% Each group has a heading:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{\item[\glsgetgrouptitle{##1}]}}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlisthypergroup}
% The \glostyle{altlisthypergroup} glossary style is like the
% \glostyle{altlistgroup} style, but has a 
% set of links to the groups at the start of the glossary.
%    \begin{macrocode}
\newglossarystyle{altlisthypergroup}{%
%    \end{macrocode}
% Base it on the \glostyle{altlist} style:
%    \begin{macrocode}
  \glossarystyle{altlist}%
%    \end{macrocode}
% Add navigation links at the start of the environment:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \item[\glsnavigation]}%
%    \end{macrocode}
% Each group has a heading with a hypertarget:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \item[\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}]}}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{listdotted}
% The \glostyle{listdotted} glossary style was supplied by 
% Axel~Menzel. I've modified it slightly so that the distance from
% the start of the name to the end of the dotted line is specified 
% by \cs{glslistdottedwidth}.
% Note that this style ignores the page numbers as well as the
% symbol. Sub-entries are displayed in the same way as top-level
% entries.
%    \begin{macrocode}
\newglossarystyle{listdotted}{%
%    \end{macrocode}
% Base it on the \glostyle{list} style:
%    \begin{macrocode}
  \glossarystyle{list}%
%    \end{macrocode}
% Each main (level 0) entry starts a new item:
%    \begin{macrocode}
  \renewcommand*{\glossaryentryfield}[5]{%
    \item[]\makebox[\glslistdottedwidth][l]{\glstarget{##1}{##2}%
    \unskip\leaders\hbox to 2.9mm{\hss.}\hfill\strut}##3}%
%    \end{macrocode}
% Sub entries have the same format as main entries:
%    \begin{macrocode}
  \renewcommand*{\glossarysubentryfield}[6]{%
    \item[]\makebox[\glslistdottedwidth][l]{\glstarget{##2}{##3}%
    \unskip\leaders\hbox to 2.9mm{\hss.}\hfill\strut}##4}%
}
%    \end{macrocode}
%\end{style}
%\begin{macro}{\glslistdottedwidth}
%\changes{2.01}{2009 May 30}{changed \cs{linewidth} to \cs{hsize}}
%    \begin{macrocode}
\newlength\glslistdottedwidth
\setlength{\glslistdottedwidth}{.5\hsize}
%    \end{macrocode}
%\end{macro}
%
%\begin{style}{sublistdotted}
% This style is similar to the glostyle{listdotted} style, except
% that the main entries just have the name displayed.
%    \begin{macrocode}
\newglossarystyle{sublistdotted}{%
%    \end{macrocode}
% Base it on the \glostyle{listdotted} style:
%    \begin{macrocode}
  \glossarystyle{listdotted}%
%    \end{macrocode}
% Main (level 0) entries just display the name:
%    \begin{macrocode}
  \renewcommand*{\glossaryentryfield}[5]{%
    \item[\glstarget{##1}{##2}]}%
}
%    \end{macrocode}
%\end{style}
%\iffalse
%    \begin{macrocode}
%</glossary-list.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossary-long.sty>
%    \end{macrocode}
%\fi
% \subsection{Glossary Styles using longtable (the glossary-long
% package)}
% The glossary styles defined in the \isty{glossary-long} package
% used the \env{longtable} environment in the glossary.
%    \begin{macrocode}
\ProvidesPackage{glossary-long}[2009/05/30 v2.01 (NLCT)]
%    \end{macrocode}
% Requires the \isty{longtable} package:
%    \begin{macrocode}
\RequirePackage{longtable}
%    \end{macrocode}
%\begin{macro}{\glsdescwidth}
% This is a length that governs the width of the description column.
% (There's a chance that the user may specify \pkgopt{nolong}
% and then load \isty{glossary-long} later, in which case 
% \cs{glsdescwidth} may have already been defined by
% \isty{glossary-super}. The same goes for \cs{glspagelistwidth}.)
%\changes{2.01}{2009 May 30}{changed \cs{linewidth} to \cs{hsize}}
%    \begin{macrocode}
\@ifundefined{glsdescwidth}{%
  \newlength\glsdescwidth
  \setlength{\glsdescwidth}{0.6\hsize}
}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glspagelistwidth}
% This is a length that governs the width of the page list column.
%\changes{2.01}{2009 May 30}{changed \cs{linewidth} to \cs{hsize}}
%    \begin{macrocode}
\@ifundefined{glspagelistwidth}{%
  \newlength\glspagelistwidth
  \setlength{\glspagelistwidth}{0.1\hsize}
}{}
%    \end{macrocode}
%\end{macro}
% 
%\begin{style}{long}
% The \glostyle{long} glossary style command which 
% uses the \env{longtable} environment:
%    \begin{macrocode}
\newglossarystyle{long}{%
%    \end{macrocode}
% Use \env{longtable} with two columns:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
     {\begin{longtable}{lp{\glsdescwidth}}}%
     {\end{longtable}}%
%    \end{macrocode}
% Do nothing at the start of the environment:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No heading between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries displayed in a row:
%    \begin{macrocode}
  \renewcommand*{\glossaryentryfield}[5]{%
    \glstarget{##1}{##2} & ##3\glspostdescription\space ##5\\}%
%    \end{macrocode}
% Sub entries displayed on the following row without the name:
%    \begin{macrocode}
  \renewcommand*{\glossarysubentryfield}[6]{%
     & \glstarget{##2}{\strut}##4\glspostdescription\space ##6\\}%
%    \end{macrocode}
% Blank row between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{ & \\}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longborder}
% The \glostyle{longborder} style is like the above, but with horizontal and
% vertical lines:
%    \begin{macrocode}
\newglossarystyle{longborder}{%
%    \end{macrocode}
% Base it on the glostyle{long} style:
%    \begin{macrocode}
  \glossarystyle{long}%
%    \end{macrocode}
% Use \env{longtable} with two columns with vertical lines
% between each column:
%    \begin{macrocode}
  \renewenvironment{theglossary}{%
    \begin{longtable}{|l|p{\glsdescwidth}|}}{\end{longtable}}%
%    \end{macrocode}
% Place horizontal lines at the head and foot of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{\hline\endhead\hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longheader}
% The \glostyle{longheader} style is like the
% \glostyle{long} style but with a header:
%    \begin{macrocode}
\newglossarystyle{longheader}{%
%    \end{macrocode}
% Base it on the glostyle{long} style:
%    \begin{macrocode}
  \glossarystyle{long}%
%    \end{macrocode}
% Set the table's header:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \bfseries \entryname & \bfseries \descriptionname\\\endhead}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longheaderborder}
% The \glostyle{longheaderborder} style is
% like the \glostyle{long} style but with a header and border:
%    \begin{macrocode}
\newglossarystyle{longheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{longborder} style:
%    \begin{macrocode}
  \glossarystyle{longborder}%
%    \end{macrocode}
% Set the table's header and add horizontal line to table's foot:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \hline\bfseries \entryname & \bfseries \descriptionname\\\hline
    \endhead
    \hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{long3col}
% The \glostyle{long3col} style is like \glostyle{long} but with 3 columns
%    \begin{macrocode}
\newglossarystyle{long3col}{%
%    \end{macrocode}
% Use a \env{longtable} with 3 columns:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{lp{\glsdescwidth}p{\glspagelistwidth}}}%
    {\end{longtable}}%
%    \end{macrocode}
% No table header:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No headings between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries on a row (name in first column, 
% description in second column, page list in last column):
%    \begin{macrocode}
  \renewcommand*{\glossaryentryfield}[5]{%
    \glstarget{##1}{##2} & ##3 & ##5\\}%
%    \end{macrocode}
% Sub-entries on a separate row (no name, description in
% second column, page list in third column):
%    \begin{macrocode}
  \renewcommand*{\glossarysubentryfield}[6]{%
     & \glstarget{##2}{\strut}##4 & ##6\\}%
%    \end{macrocode}
% Blank row between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{ & &\\}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{long3colborder}
% The \glostyle{long3colborder} style is like the
% \glostyle{long3col} style but with a border:
%    \begin{macrocode}
\newglossarystyle{long3colborder}{%
%    \end{macrocode}
% Base it on the glostyle{long3col} style:
%    \begin{macrocode}
  \glossarystyle{long3col}%
%    \end{macrocode}
% Use a \env{longtable} with 3 columns with vertical lines
% around them:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{|l|p{\glsdescwidth}|p{\glspagelistwidth}|}}%
    {\end{longtable}}%
%    \end{macrocode}
% Place horizontal lines at the head and foot of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{\hline\endhead\hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{long3colheader}
% The \glostyle{long3colheader} style is like \glostyle{long3col} but with a header row:
%    \begin{macrocode}
\newglossarystyle{long3colheader}{%
%    \end{macrocode}
% Base it on the glostyle{long3col} style:
%    \begin{macrocode}
  \glossarystyle{long3col}%
%    \end{macrocode}
% Set the table's header:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \bfseries\entryname&\bfseries\descriptionname&
    \bfseries\pagelistname\\\endhead}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{long3colheaderborder}
% The \glostyle{long3colheaderborder} style is like the above but with a border
%    \begin{macrocode}
\newglossarystyle{long3colheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{long3colborder} style:
%    \begin{macrocode}
  \glossarystyle{long3colborder}%
%    \end{macrocode}
% Set the table's header and add horizontal line at table's foot:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \hline
    \bfseries\entryname&\bfseries\descriptionname&
    \bfseries\pagelistname\\\hline\endhead
    \hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{long4col}
% The \glostyle{long4col} style has four columns where the third 
% column contains the value of the associated \gloskey{symbol} key.
%    \begin{macrocode}
\newglossarystyle{long4col}{%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{llll}}%
    {\end{longtable}}%
%    \end{macrocode}
% No table header:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries on a single row (name in first column,
% description in second column, symbol in third column, page list
% in last column):
%    \begin{macrocode}
  \renewcommand*{\glossaryentryfield}[5]{%
    \glstarget{##1}{##2} & ##3 & ##4 & ##5\\}%
%    \end{macrocode}
% Sub entries on a single row with no name (description in second
% column, symbol in third column, page list in last column):
%    \begin{macrocode}
  \renewcommand*{\glossarysubentryfield}[6]{%
     & \glstarget{##2}{\strut}##4 & ##5 & ##6\\}%
%    \end{macrocode}
% Blank row between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{ & & &\\}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{long4colheader}
% The \glostyle{long4colheader} style is like \glostyle{long4col} 
% but with a header row.
%    \begin{macrocode}
\newglossarystyle{long4colheader}{%
%    \end{macrocode}
% Base it on the glostyle{long4col} style:
%    \begin{macrocode}
  \glossarystyle{long4col}%
%    \end{macrocode}
% Table has a header:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \bfseries\entryname&\bfseries\descriptionname&
    \bfseries \symbolname&
    \bfseries\pagelistname\\\endhead}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{long4colborder}
% The \glostyle{long4colborder} style is like \glostyle{long4col} 
% but with a border.
%    \begin{macrocode}
\newglossarystyle{long4colborder}{%
%    \end{macrocode}
% Base it on the glostyle{long4col} style:
%    \begin{macrocode}
  \glossarystyle{long4col}%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns surrounded by vertical
% lines:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{|l|l|l|l|}}%
    {\end{longtable}}%
%    \end{macrocode}
% Add horizontal lines to the head and foot of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{\hline\endhead\hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{long4colheaderborder}
% The \glostyle{long4colheaderborder} style is like the above but 
% with a border.
%    \begin{macrocode}
\newglossarystyle{long4colheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{long4col} style:
%    \begin{macrocode}
  \glossarystyle{long4col}%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns surrounded by vertical
% lines:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{|l|l|l|l|}}%
    {\end{longtable}}%
%    \end{macrocode}
% Add table header and horizontal line at the table's foot:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \hline\bfseries\entryname&\bfseries\descriptionname&
    \bfseries \symbolname&
    \bfseries\pagelistname\\\hline\endhead\hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlong4col}
% The \glostyle{altlong4col} style is like the \glostyle{long4col}
% style but can have multiline descriptions and page lists.
%    \begin{macrocode}
\newglossarystyle{altlong4col}{%
%    \end{macrocode}
% Base it on the glostyle{long4col} style:
%    \begin{macrocode}
   \glossarystyle{long4col}%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns where the second and
% last columns may have multiple lines in each row:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{lp{\glsdescwidth}lp{\glspagelistwidth}}}%
    {\end{longtable}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlong4colheader}
% The \glostyle{altlong4colheader} style is like 
% \glostyle{altlong4col} but with a header row.
%    \begin{macrocode}
\newglossarystyle{altlong4colheader}{%
%    \end{macrocode}
% Base it on the glostyle{long4colheader} style:
%    \begin{macrocode}
  \glossarystyle{long4colheader}%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns where the second and
% last columns may have multiple lines in each row:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{lp{\glsdescwidth}lp{\glspagelistwidth}}}%
    {\end{longtable}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlong4colborder}
% The \glostyle{altlong4colborder} style is like
% \glostyle{altlong4col} but with a border.
%    \begin{macrocode}
\newglossarystyle{altlong4colborder}{%
%    \end{macrocode}
% Base it on the glostyle{long4colborder} style:
%    \begin{macrocode}
   \glossarystyle{long4colborder}%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns where the second and
% last columns may have multiple lines in each row:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{|l|p{\glsdescwidth}|l|p{\glspagelistwidth}|}}%
    {\end{longtable}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlong4colheaderborder}
% The \glostyle{altlong4colheaderborder} style is like the above but
% with a header as well as a border.
%    \begin{macrocode}
\newglossarystyle{altlong4colheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{long4colheaderborder} style:
%    \begin{macrocode}
  \glossarystyle{long4colheaderborder}%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns where the second and
% last columns may have multiple lines in each row:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{|l|p{\glsdescwidth}|l|p{\glspagelistwidth}|}}%
    {\end{longtable}}%
}
%    \end{macrocode}
%\end{style}
%\iffalse
%    \begin{macrocode}
%</glossary-long.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossary-longragged.sty>
%    \end{macrocode}
%\fi
% \subsection{Glossary Styles using longtable (the glossary-longragged
% package)}
% The glossary styles defined in the \isty{glossary-longragged} package
% used the \env{longtable} environment in the glossary and use
% ragged right formatting for the multiline columns.
%    \begin{macrocode}
\ProvidesPackage{glossary-longragged}[2009/05/30 v2.01 (NLCT)]
%    \end{macrocode}
% Requires the \isty{array} package:
%    \begin{macrocode}
\RequirePackage{array}
%    \end{macrocode}
% Requires the \isty{longtable} package:
%    \begin{macrocode}
\RequirePackage{longtable}
%    \end{macrocode}
%\begin{macro}{\glsdescwidth}
% This is a length that governs the width of the description column.
% This may have already been defined.
%    \begin{macrocode}
\@ifundefined{glsdescwidth}{%
  \newlength\glsdescwidth
  \setlength{\glsdescwidth}{0.6\hsize}
}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glspagelistwidth}
% This is a length that governs the width of the page list column.
% This may already have been defined.
%    \begin{macrocode}
\@ifundefined{glspagelistwidth}{%
  \newlength\glspagelistwidth
  \setlength{\glspagelistwidth}{0.1\hsize}
}{}
%    \end{macrocode}
%\end{macro}
% 
%\begin{style}{longragged}
% The \glostyle{longragged} glossary style is like the
% \glostyle{long} but uses ragged right formatting for the
% description column.
%    \begin{macrocode}
\newglossarystyle{longragged}{%
%    \end{macrocode}
% Use \env{longtable} with two columns:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
     {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}}}%
     {\end{longtable}}%
%    \end{macrocode}
% Do nothing at the start of the environment:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No heading between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries displayed in a row:
%    \begin{macrocode}
  \renewcommand*{\glossaryentryfield}[5]{%
    \glstarget{##1}{##2} & ##3\glspostdescription\space ##5%
    \tabularnewline}%
%    \end{macrocode}
% Sub entries displayed on the following row without the name:
%    \begin{macrocode}
  \renewcommand*{\glossarysubentryfield}[6]{%
     & \glstarget{##2}{\strut}##4\glspostdescription\space ##6%
    \tabularnewline}%
%    \end{macrocode}
% Blank row between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{ & \tabularnewline}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longraggedborder}
% The \glostyle{longraggedborder} style is like the above, but with horizontal and
% vertical lines:
%    \begin{macrocode}
\newglossarystyle{longraggedborder}{%
%    \end{macrocode}
% Base it on the glostyle{longragged} style:
%    \begin{macrocode}
  \glossarystyle{longragged}%
%    \end{macrocode}
% Use \env{longtable} with two columns with vertical lines
% between each column:
%    \begin{macrocode}
  \renewenvironment{theglossary}{%
    \begin{longtable}{|l|>{\raggedright}p{\glsdescwidth}|}}%
    {\end{longtable}}%
%    \end{macrocode}
% Place horizontal lines at the head and foot of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{\hline\endhead\hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longraggedheader}
% The \glostyle{longraggedheader} style is like the
% \glostyle{longragged} style but with a header:
%    \begin{macrocode}
\newglossarystyle{longraggedheader}{%
%    \end{macrocode}
% Base it on the glostyle{longragged} style:
%    \begin{macrocode}
  \glossarystyle{longragged}%
%    \end{macrocode}
% Set the table's header:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \bfseries \entryname & \bfseries \descriptionname
    \tabularnewline\endhead}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longraggedheaderborder}
% The \glostyle{longraggedheaderborder} style is
% like the \glostyle{longragged} style but with a header and border:
%    \begin{macrocode}
\newglossarystyle{longraggedheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{longraggedborder} style:
%    \begin{macrocode}
  \glossarystyle{longraggedborder}%
%    \end{macrocode}
% Set the table's header and add horizontal line to table's foot:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \hline\bfseries \entryname & \bfseries \descriptionname
    \tabularnewline\hline
    \endhead
    \hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longragged3col}
% The \glostyle{longragged3col} style is like \glostyle{longragged} but with 3 columns
%    \begin{macrocode}
\newglossarystyle{longragged3col}{%
%    \end{macrocode}
% Use a \env{longtable} with 3 columns:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}%
       >{\raggedright}p{\glspagelistwidth}}}%
    {\end{longtable}}%
%    \end{macrocode}
% No table header:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No headings between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries on a row (name in first column, 
% description in second column, page list in last column):
%    \begin{macrocode}
  \renewcommand*{\glossaryentryfield}[5]{%
    \glstarget{##1}{##2} & ##3 & ##5\tabularnewline}%
%    \end{macrocode}
% Sub-entries on a separate row (no name, description in
% second column, page list in third column):
%    \begin{macrocode}
  \renewcommand*{\glossarysubentryfield}[6]{%
     & \glstarget{##2}{\strut}##4 & ##6\tabularnewline}%
%    \end{macrocode}
% Blank row between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{ & &\tabularnewline}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longragged3colborder}
% The \glostyle{longragged3colborder} style is like the
% \glostyle{longragged3col} style but with a border:
%    \begin{macrocode}
\newglossarystyle{longragged3colborder}{%
%    \end{macrocode}
% Base it on the glostyle{longragged3col} style:
%    \begin{macrocode}
  \glossarystyle{longragged3col}%
%    \end{macrocode}
% Use a \env{longtable} with 3 columns with vertical lines
% around them:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{|l|>{\raggedright}p{\glsdescwidth}|%
      >{\raggedright}p{\glspagelistwidth}|}}%
    {\end{longtable}}%
%    \end{macrocode}
% Place horizontal lines at the head and foot of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{\hline\endhead\hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longragged3colheader}
% The \glostyle{longragged3colheader} style is like \glostyle{longragged3col} but with a header row:
%    \begin{macrocode}
\newglossarystyle{longragged3colheader}{%
%    \end{macrocode}
% Base it on the glostyle{longragged3col} style:
%    \begin{macrocode}
  \glossarystyle{longragged3col}%
%    \end{macrocode}
% Set the table's header:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \bfseries\entryname&\bfseries\descriptionname&
    \bfseries\pagelistname\tabularnewline\endhead}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{longragged3colheaderborder}
% The \glostyle{longragged3colheaderborder} style is like the above but with a border
%    \begin{macrocode}
\newglossarystyle{longragged3colheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{longragged3colborder} style:
%    \begin{macrocode}
  \glossarystyle{longragged3colborder}%
%    \end{macrocode}
% Set the table's header and add horizontal line at table's foot:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \hline
    \bfseries\entryname&\bfseries\descriptionname&
    \bfseries\pagelistname\tabularnewline\hline\endhead
    \hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlongragged4col}
% The \glostyle{altlongragged4col} style is like the \glostyle{altlong4col}
% style defined in the \isty{glossary-long} package, except that
% ragged right formatting is used for the description and page list
% columns.
%    \begin{macrocode}
\newglossarystyle{altlongragged4col}{%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns where the second and
% last columns may have multiple lines in each row:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}l%
       >{\raggedright}p{\glspagelistwidth}}}%
    {\end{longtable}}%
%    \end{macrocode}
% No table header:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries on a single row (name in first column,
% description in second column, symbol in third column, page list
% in last column):
%    \begin{macrocode}
  \renewcommand*{\glossaryentryfield}[5]{%
    \glstarget{##1}{##2} & ##3 & ##4 & ##5\tabularnewline}%
%    \end{macrocode}
% Sub entries on a single row with no name (description in second
% column, symbol in third column, page list in last column):
%    \begin{macrocode}
  \renewcommand*{\glossarysubentryfield}[6]{%
     & \glstarget{##2}{\strut}##4 & ##5 & ##6\tabularnewline}%
%    \end{macrocode}
% Blank row between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{ & & &\tabularnewline}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlongragged4colheader}
% The \glostyle{altlongragged4colheader} style is like 
% \glostyle{altlongragged4col} but with a header row.
%    \begin{macrocode}
\newglossarystyle{altlongragged4colheader}{%
%    \end{macrocode}
% Base it on the glostyle{altlongragged4col} style:
%    \begin{macrocode}
  \glossarystyle{altlongragged4col}%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns where the second and
% last columns may have multiple lines in each row:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}l%
      >{\raggedright}p{\glspagelistwidth}}}%
    {\end{longtable}}%
%    \end{macrocode}
% Table has a header:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \bfseries\entryname&\bfseries\descriptionname&
    \bfseries \symbolname&
    \bfseries\pagelistname\tabularnewline\endhead}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlongragged4colborder}
% The \glostyle{altlongragged4colborder} style is like
% \glostyle{altlongragged4col} but with a border.
%    \begin{macrocode}
\newglossarystyle{altlongragged4colborder}{%
%    \end{macrocode}
% Base it on the glostyle{altlongragged4col} style:
%    \begin{macrocode}
   \glossarystyle{altlongragged4col}%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns where the second and
% last columns may have multiple lines in each row:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{|l|>{\raggedright}p{\glsdescwidth}|l|%
      >{\raggedright}p{\glspagelistwidth}|}}%
    {\end{longtable}}%
%    \end{macrocode}
% Add horizontal lines to the head and foot of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{\hline\endhead\hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altlongragged4colheaderborder}
% The \glostyle{altlongragged4colheaderborder} style is like the above but
% with a header as well as a border.
%    \begin{macrocode}
\newglossarystyle{altlongragged4colheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{altlongragged4col} style:
%    \begin{macrocode}
  \glossarystyle{altlongragged4col}%
%    \end{macrocode}
% Use a \env{longtable} with 4 columns where the second and
% last columns may have multiple lines in each row:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\begin{longtable}{|l|>{\raggedright}p{\glsdescwidth}|l|%
       >{\raggedright}p{\glspagelistwidth}|}}%
    {\end{longtable}}%
%    \end{macrocode}
% Add table header and horizontal line at the table's foot:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \hline\bfseries\entryname&\bfseries\descriptionname&
    \bfseries \symbolname&
    \bfseries\pagelistname\tabularnewline\hline\endhead
      \hline\endfoot}%
}
%    \end{macrocode}
%\end{style}
%\iffalse
%    \begin{macrocode}
%</glossary-longragged.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossary-super.sty>
%    \end{macrocode}
%\fi
% \subsection{Glossary Styles using supertabular environment (glossary-super package)}
% The glossary styles defined in the \isty{glossary-super} package
% use the \env{supertabular} environment.
%    \begin{macrocode}
\ProvidesPackage{glossary-super}[2009/05/30 v2.01 (NLCT)]
%    \end{macrocode}
% Requires the \isty{supertabular} package:
%    \begin{macrocode}
\RequirePackage{supertabular}
%    \end{macrocode}
%\begin{macro}{\glsdescwidth}
% This is a length that governs the width of the description column.
% This may already have been defined if \isty{glossary-long}
% has been loaded.\changes{2.01}{2009 May 30}{changed \cs{linewidth}
% to \cs{hsize}}
%    \begin{macrocode}
\@ifundefined{glsdescwidth}{%
  \newlength\glsdescwidth
  \setlength{\glsdescwidth}{0.6\hsize}
}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glspagelistwidth}
% This is a length that governs the width of the page list column.
% This may already have been defined if \isty{glossary-long}
% has been loaded.\changes{2.01}{2009 May 30}{changed \cs{linewidth}
% to \cs{hsize}}
%    \begin{macrocode}
\@ifundefined{glspagelistwidth}{%
  \newlength\glspagelistwidth
  \setlength{\glspagelistwidth}{0.1\hsize}
}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{style}{super}
% The \glostyle{super} glossary style uses the
% \env{supertabular} environment
% (it uses lengths defined in the \isty{glossary-long} package.)
%    \begin{macrocode}
\newglossarystyle{super}{%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% two columns and no head or tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{}\tabletail{}%
     \begin{supertabular}{lp{\glsdescwidth}}}%
    {\end{supertabular}}%
%    \end{macrocode}
% Do nothing at the start of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries put in a row (name in first column,
% description and page list in second column):
%    \begin{macrocode}
  \renewcommand*{\glossaryentryfield}[5]{%
    \glstarget{##1}{##2} & ##3\glspostdescription\space ##5\\}%
%    \end{macrocode}
% Sub entries put in a row (no name, description and page list
% in second column):
%    \begin{macrocode}
  \renewcommand*{\glossarysubentryfield}[6]{%
     & \glstarget{##2}{\strut}##4\glspostdescription\space ##6\\}%
%    \end{macrocode}
% Blank row between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{ & \\}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{superborder}
% The \glostyle{superborder} style is like the above, but with 
% horizontal and vertical lines:
%    \begin{macrocode}
\newglossarystyle{superborder}{%
%    \end{macrocode}
% Base it on the glostyle{super} style:
%    \begin{macrocode}
  \glossarystyle{super}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% two columns and a horizontal line in the head and tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline}\tabletail{\hline}%
     \begin{supertabular}{|l|p{\glsdescwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{superheader}
% The \glostyle{superheader} style is like the
% \glostyle{super} style, but with a header:
%    \begin{macrocode}
\newglossarystyle{superheader}{%
%    \end{macrocode}
% Base it on the glostyle{super} style:
%    \begin{macrocode}
  \glossarystyle{super}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% two columns, a header and no tail:
%    \begin{macrocode}
\renewenvironment{theglossary}%
  {\tablehead{\bfseries \entryname & \bfseries \descriptionname\\}%
   \tabletail{}%
   \begin{supertabular}{lp{\glsdescwidth}}}%
  {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{superheaderborder}
% The \glostyle{superheaderborder} style is like
% the \glostyle{super} style but with a header and border:
%    \begin{macrocode}
\newglossarystyle{superheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{super} style:
%    \begin{macrocode}
  \glossarystyle{super}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% two columns, a header and horizontal lines above and below the
% table:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline\bfseries \entryname &
       \bfseries \descriptionname\\\hline}%
     \tabletail{\hline}
     \begin{supertabular}{|l|p{\glsdescwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{super3col}
% The \glostyle{super3col} style is like the \glostyle{super} 
% style, but with 3 columns:
%    \begin{macrocode}
\newglossarystyle{super3col}{%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% three columns and no head or tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{}\tabletail{}%
     \begin{supertabular}{lp{\glsdescwidth}p{\glspagelistwidth}}}%
    {\end{supertabular}}%
%    \end{macrocode}
% Do nothing at the start of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries on a row (name in first column, 
% description in second column, page list in last column):
%    \begin{macrocode}
  \renewcommand*{\glossaryentryfield}[5]{%
    \glstarget{##1}{##2} & ##3 & ##5\\}%
%    \end{macrocode}
% Sub entries on a row (no name, description in second column,
% page list in last column):
%    \begin{macrocode}
  \renewcommand*{\glossarysubentryfield}[6]{%
     & \glstarget{##2}{\strut}##4 & ##6\\}%
%    \end{macrocode}
% Blank row between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{ & &\\}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{super3colborder}
% The \glostyle{super3colborder} style is like the
% \glostyle{super3col} style, but with a border:
%    \begin{macrocode}
\newglossarystyle{super3colborder}{%
%    \end{macrocode}
% Base it on the glostyle{super3col} style:
%    \begin{macrocode}
  \glossarystyle{super3col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% three columns and a horizontal line in the head and tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline}\tabletail{\hline}%
     \begin{supertabular}{|l|p{\glsdescwidth}|p{\glspagelistwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{super3colheader}
% The \glostyle{super3colheader} style is like 
% the \glostyle{super3col} style but with a header row:
%    \begin{macrocode}
\newglossarystyle{super3colheader}{%
%    \end{macrocode}
% Base it on the glostyle{super3col} style:
%    \begin{macrocode}
  \glossarystyle{super3col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% three columns, a header and no tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\bfseries\entryname&\bfseries\descriptionname&
       \bfseries\pagelistname\\}\tabletail{}%
     \begin{supertabular}{lp{\glsdescwidth}p{\glspagelistwidth}}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{super3colheaderborder}
% The \glostyle{super3colheaderborder} style is like
% the \glostyle{super3col} style but with a header and border:
%    \begin{macrocode}
\newglossarystyle{super3colheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{super3colborder} style:
%    \begin{macrocode}
  \glossarystyle{super3colborder}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% three columns, a header with horizontal lines and a horizontal
% line in the tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline
        \bfseries\entryname&\bfseries\descriptionname&
        \bfseries\pagelistname\\\hline}%
     \tabletail{\hline}%
     \begin{supertabular}{|l|p{\glsdescwidth}|p{\glspagelistwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{super4col}
% The \glostyle{super4col} glossary style has four columns,
% where the third column contains the value of the
% corresponding \gloskey{symbol} key used when that entry
% was defined.
%    \begin{macrocode}
\newglossarystyle{super4col}{%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns and no head or tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{}\tabletail{}%
     \begin{supertabular}{llll}}{%
     \end{supertabular}}%
%    \end{macrocode}
% Do nothing at the start of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries on a row with the name in the first
% column, description in second column, symbol in third column
% and page list in last column:
%    \begin{macrocode}
  \renewcommand*{\glossaryentryfield}[5]{%
    \glstarget{##1}{##2} & ##3 & ##4 & ##5\\}%
%    \end{macrocode}
% Sub entries on a row with no name, the description in the second
% column, symbol in third column and page list in last column:
%    \begin{macrocode}
  \renewcommand*{\glossarysubentryfield}[6]{%
     & \glstarget{##2}{\strut}##4 & ##5 & ##6\\}%
%    \end{macrocode}
% Blank row between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{ & & &\\}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{super4colheader}
% The \glostyle{super4colheader} style is like
% the \glostyle{super4col} but with a header row.
%    \begin{macrocode}
\newglossarystyle{super4colheader}{%
%    \end{macrocode}
% Base it on the glostyle{super4col} style:
%    \begin{macrocode}
  \glossarystyle{super4col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns, a header and no tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\bfseries\entryname&\bfseries\descriptionname&
        \bfseries\symbolname &
        \bfseries\pagelistname\\}%
     \tabletail{}%
     \begin{supertabular}{llll}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{super4colborder}
% The \glostyle{super4colborder} style is like
% the \glostyle{super4col} but with a border.
%    \begin{macrocode}
\newglossarystyle{super4colborder}{%
%    \end{macrocode}
% Base it on the glostyle{super4col} style:
%    \begin{macrocode}
  \glossarystyle{super4col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns and a horizontal line in the head and tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline}\tabletail{\hline}%
     \begin{supertabular}{|l|l|l|l|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{super4colheaderborder}
% The \glostyle{super4colheaderborder} style is like
% the \glostyle{super4col} but with a header and border.
%    \begin{macrocode}
\newglossarystyle{super4colheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{super4col} style:
%    \begin{macrocode}
  \glossarystyle{super4col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns and a header bordered by horizontal lines and 
% a horizontal line in the tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline\bfseries\entryname&\bfseries\descriptionname&
        \bfseries\symbolname &
        \bfseries\pagelistname\\\hline}\tabletail{\hline}%
     \begin{supertabular}{|l|l|l|l|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altsuper4col}
% The \glostyle{altsuper4col} glossary style is like 
% \glostyle{super4col} but has provision for multiline descriptions.
%    \begin{macrocode}
\newglossarystyle{altsuper4col}{%
%    \end{macrocode}
% Base it on the glostyle{super4col} style:
%    \begin{macrocode}
  \glossarystyle{super4col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns and no head or tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{}\tabletail{}%
     \begin{supertabular}{lp{\glsdescwidth}lp{\glspagelistwidth}}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altsuper4colheader}
% The \glostyle{altsuper4colheader} style is like
% the \glostyle{altsuper4col} but with a header row.
%    \begin{macrocode}
\newglossarystyle{altsuper4colheader}{%
%    \end{macrocode}
% Base it on the glostyle{super4colheader} style:
%    \begin{macrocode}
  \glossarystyle{super4colheader}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns, a header and no tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\bfseries\entryname&\bfseries\descriptionname&
      \bfseries\symbolname &
      \bfseries\pagelistname\\}\tabletail{}%
     \begin{supertabular}{lp{\glsdescwidth}lp{\glspagelistwidth}}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altsuper4colborder}
% The \glostyle{altsuper4colborder} style is like
% the \glostyle{altsuper4col} but with a border.
%    \begin{macrocode}
\newglossarystyle{altsuper4colborder}{%
%    \end{macrocode}
% Base it on the glostyle{super4colborder} style:
%    \begin{macrocode}
  \glossarystyle{super4colborder}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns and a horizontal line in the head and tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline}\tabletail{\hline}%
     \begin{supertabular}%
       {|l|p{\glsdescwidth}|l|p{\glspagelistwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altsuper4colheaderborder}
% The \glostyle{altsuper4colheaderborder} style is like
% the \glostyle{altsuper4col} but with a header and border.
%    \begin{macrocode}
\newglossarystyle{altsuper4colheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{super4colheaderborder} style:
%    \begin{macrocode}
  \glossarystyle{super4colheaderborder}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns and a header bordered by horizontal lines and 
% a horizontal line in the tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline
       \bfseries\entryname &
       \bfseries\descriptionname &
       \bfseries\symbolname &
       \bfseries\pagelistname\\\hline}%
     \tabletail{\hline}%
     \begin{supertabular}%
       {|l|p{\glsdescwidth}|l|p{\glspagelistwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%\iffalse
%    \begin{macrocode}
%</glossary-super.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossary-superragged.sty>
%    \end{macrocode}
%\fi
% \subsection{Glossary Styles using supertabular environment (glossary-superragged package)}
% The glossary styles defined in the \isty{glossary-superragged}
% package use the \env{supertabular} environment. These styles 
% are like those provided by the \isty{glossary-super} package, 
% except that the multiline columns have ragged right justification.
%    \begin{macrocode}
\ProvidesPackage{glossary-superragged}[2009/05/30 v2.01 (NLCT)]
%    \end{macrocode}
% Requires the \isty{array} package:
%    \begin{macrocode}
\RequirePackage{array}
%    \end{macrocode}
% Requires the \isty{supertabular} package:
%    \begin{macrocode}
\RequirePackage{supertabular}
%    \end{macrocode}
%\begin{macro}{\glsdescwidth}
% This is a length that governs the width of the description column.
% This may already have been defined.
%    \begin{macrocode}
\@ifundefined{glsdescwidth}{%
  \newlength\glsdescwidth
  \setlength{\glsdescwidth}{0.6\hsize}
}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glspagelistwidth}
% This is a length that governs the width of the page list column.
% This may already have been defined.
%    \begin{macrocode}
\@ifundefined{glspagelistwidth}{%
  \newlength\glspagelistwidth
  \setlength{\glspagelistwidth}{0.1\hsize}
}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{style}{superragged}
% The \glostyle{superragged} glossary style uses the
% \env{supertabular} environment.
%    \begin{macrocode}
\newglossarystyle{superragged}{%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% two columns and no head or tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{}\tabletail{}%
     \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}}}%
    {\end{supertabular}}%
%    \end{macrocode}
% Do nothing at the start of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries put in a row (name in first column,
% description and page list in second column):
%    \begin{macrocode}
  \renewcommand*{\glossaryentryfield}[5]{%
    \glstarget{##1}{##2} & ##3\glspostdescription\space ##5%
      \tabularnewline}%
%    \end{macrocode}
% Sub entries put in a row (no name, description and page list
% in second column):
%    \begin{macrocode}
  \renewcommand*{\glossarysubentryfield}[6]{%
     & \glstarget{##2}{\strut}##4\glspostdescription\space ##6%
     \tabularnewline}%
%    \end{macrocode}
% Blank row between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{ & \tabularnewline}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{superraggedborder}
% The \glostyle{superraggedborder} style is like the above, but with 
% horizontal and vertical lines:
%    \begin{macrocode}
\newglossarystyle{superraggedborder}{%
%    \end{macrocode}
% Base it on the glostyle{superragged} style:
%    \begin{macrocode}
  \glossarystyle{superragged}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% two columns and a horizontal line in the head and tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline}\tabletail{\hline}%
     \begin{supertabular}{|l|>{\raggedright}p{\glsdescwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{superraggedheader}
% The \glostyle{superraggedheader} style is like the
% \glostyle{super} style, but with a header:
%    \begin{macrocode}
\newglossarystyle{superraggedheader}{%
%    \end{macrocode}
% Base it on the glostyle{superragged} style:
%    \begin{macrocode}
  \glossarystyle{superragged}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% two columns, a header and no tail:
%    \begin{macrocode}
\renewenvironment{theglossary}%
  {\tablehead{\bfseries \entryname & \bfseries \descriptionname
     \tabularnewline}%
   \tabletail{}%
   \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}}}%
  {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{superraggedheaderborder}
% The \glostyle{superraggedheaderborder} style is like
% the \glostyle{superragged} style but with a header and border:
%    \begin{macrocode}
\newglossarystyle{superraggedheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{super} style:
%    \begin{macrocode}
  \glossarystyle{superragged}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% two columns, a header and horizontal lines above and below the
% table:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline\bfseries \entryname &
       \bfseries \descriptionname\tabularnewline\hline}%
     \tabletail{\hline}
     \begin{supertabular}{|l|>{\raggedright}p{\glsdescwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{superragged3col}
% The \glostyle{superragged3col} style is like the \glostyle{superragged} 
% style, but with 3 columns:
%    \begin{macrocode}
\newglossarystyle{superragged3col}{%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% three columns and no head or tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{}\tabletail{}%
     \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}%
        >{\raggedright}p{\glspagelistwidth}}}%
    {\end{supertabular}}%
%    \end{macrocode}
% Do nothing at the start of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries on a row (name in first column, 
% description in second column, page list in last column):
%    \begin{macrocode}
  \renewcommand*{\glossaryentryfield}[5]{%
    \glstarget{##1}{##2} & ##3 & ##5\tabularnewline}%
%    \end{macrocode}
% Sub entries on a row (no name, description in second column,
% page list in last column):
%    \begin{macrocode}
  \renewcommand*{\glossarysubentryfield}[6]{%
     & \glstarget{##2}{\strut}##4 & ##6\tabularnewline}%
%    \end{macrocode}
% Blank row between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{ & &\tabularnewline}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{superragged3colborder}
% The \glostyle{superragged3colborder} style is like the
% \glostyle{superragged3col} style, but with a border:
%    \begin{macrocode}
\newglossarystyle{superragged3colborder}{%
%    \end{macrocode}
% Base it on the glostyle{superragged3col} style:
%    \begin{macrocode}
  \glossarystyle{superragged3col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% three columns and a horizontal line in the head and tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline}\tabletail{\hline}%
     \begin{supertabular}{|l|>{\raggedright}p{\glsdescwidth}|%
       >{\raggedright}p{\glspagelistwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{superragged3colheader}
% The \glostyle{superragged3colheader} style is like 
% the \glostyle{superragged3col} style but with a header row:
%    \begin{macrocode}
\newglossarystyle{superragged3colheader}{%
%    \end{macrocode}
% Base it on the glostyle{superragged3col} style:
%    \begin{macrocode}
  \glossarystyle{superragged3col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% three columns, a header and no tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\bfseries\entryname&\bfseries\descriptionname&
       \bfseries\pagelistname\tabularnewline}\tabletail{}%
     \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}%
       >{\raggedright}p{\glspagelistwidth}}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{superraggedright3colheaderborder}
% The \glostyle{superragged3colheaderborder} style is like
% the \glostyle{superragged3col} style but with a header and border:
%    \begin{macrocode}
\newglossarystyle{superragged3colheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{superragged3colborder} style:
%    \begin{macrocode}
  \glossarystyle{superragged3colborder}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% three columns, a header with horizontal lines and a horizontal
% line in the tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline
        \bfseries\entryname&\bfseries\descriptionname&
        \bfseries\pagelistname\tabularnewline\hline}%
     \tabletail{\hline}%
     \begin{supertabular}{|l|>{\raggedright}p{\glsdescwidth}|%
       >{\raggedright}p{\glspagelistwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altsuperragged4col}
% The \glostyle{altsuperragged4col} glossary style is like 
% \glostyle{altsuper4col} style in the \isty{glossary-super}
% package but uses ragged right formatting in the description 
% and page list columns.
%    \begin{macrocode}
\newglossarystyle{altsuperragged4col}{%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns and no head or tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{}\tabletail{}%
     \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}l%
       >{\raggedright}p{\glspagelistwidth}}}%
    {\end{supertabular}}%
%    \end{macrocode}
% Do nothing at the start of the table:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries on a row with the name in the first
% column, description in second column, symbol in third column
% and page list in last column:
%    \begin{macrocode}
  \renewcommand*{\glossaryentryfield}[5]{%
    \glstarget{##1}{##2} & ##3 & ##4 & ##5\tabularnewline}%
%    \end{macrocode}
% Sub entries on a row with no name, the description in the second% column, symbol in third column and page list in last column:
%    \begin{macrocode}
  \renewcommand*{\glossarysubentryfield}[6]{%
     & \glstarget{##2}{\strut}##4 & ##5 & ##6\tabularnewline}%
%    \end{macrocode}
% Blank row between groups:
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{ & & &\tabularnewline}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altsuperragged4colheader}
% The \glostyle{altsuperragged4colheader} style is like
% the \glostyle{altsuperragged4col} style but with a header row.
%    \begin{macrocode}
\newglossarystyle{altsuperragged4colheader}{%
%    \end{macrocode}
% Base it on the glostyle{altsuperragged4col} style:
%    \begin{macrocode}
  \glossarystyle{altsuperragged4col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns, a header and no tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\bfseries\entryname&\bfseries\descriptionname&
      \bfseries\symbolname &
      \bfseries\pagelistname\tabularnewline}\tabletail{}%
     \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}l%
       >{\raggedright}p{\glspagelistwidth}}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altsuperragged4colborder}
% The \glostyle{altsuperragged4colborder} style is like
% the \glostyle{altsuperragged4col} style but with a border.
%    \begin{macrocode}
\newglossarystyle{altsuperragged4colborder}{%
%    \end{macrocode}
% Base it on the glostyle{altsuperragged4col} style:
%    \begin{macrocode}
  \glossarystyle{altsuper4col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns and a horizontal line in the head and tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline}\tabletail{\hline}%
     \begin{supertabular}%
       {|l|>{\raggedright}p{\glsdescwidth}|l|%
         >{\raggedright}p{\glspagelistwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{altsuperragged4colheaderborder}
% The \glostyle{altsuperragged4colheaderborder} style is like
% the \glostyle{altsuperragged4col} style but with a header and border.
%    \begin{macrocode}
\newglossarystyle{altsuperragged4colheaderborder}{%
%    \end{macrocode}
% Base it on the glostyle{altsuperragged4col} style:
%    \begin{macrocode}
  \glossarystyle{altsuperragged4col}%
%    \end{macrocode}
% Put the glossary in a \env{supertabular} environment with
% four columns and a header bordered by horizontal lines and 
% a horizontal line in the tail:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\tablehead{\hline
       \bfseries\entryname &
       \bfseries\descriptionname &
       \bfseries\symbolname &
       \bfseries\pagelistname\tabularnewline\hline}%
     \tabletail{\hline}%
     \begin{supertabular}%
       {|l|>{\raggedright}p{\glsdescwidth}|l|%
          >{\raggedright}p{\glspagelistwidth}|}}%
    {\end{supertabular}}%
}
%    \end{macrocode}
%\end{style}
%\iffalse
%    \begin{macrocode}
%</glossary-superragged.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossary-tree.sty>
%    \end{macrocode}
%\fi
%\subsection{Tree Styles (glossary-tree.sty)}
% The \isty{glossary-tree} style file defines glossary styles
% that have a tree-like structure. These are designed for
% hierarchical glossaries.
%    \begin{macrocode}
\ProvidesPackage{glossary-tree}[2009/01/14 v1.01 (NLCT)]
%    \end{macrocode}
%
%\begin{style}{index}
% The \glostyle{index} glossary style 
% is similar in style to the way indices are usually typeset
% using \cs{item}, \cs{subitem} and \cs{subsubitem}.
% The entry name is 
% set in bold. If an entry has a symbol, it is placed in 
% brackets after the name. Then the description is displayed,
% followed by the number list. This style allows up to three
% levels.
%    \begin{macrocode}
\newglossarystyle{index}{%
%    \end{macrocode}
% Set the paragraph indentation and skip and define \ics{item}
% to be the same as that used by \env{theindex}:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\setlength{\parindent}{0pt}%
     \setlength{\parskip}{0pt plus 0.3pt}%
     \let\item\@idxitem}%
    {}%
%    \end{macrocode}
% Do nothing at the start of the environment:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headers:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entry starts a new item with the name in bold
% followed by the symbol in brackets (if it exists), the description
% and the page list.
%    \begin{macrocode}
\renewcommand*{\glossaryentryfield}[5]{%
\item\textbf{\glstarget{##1}{##2}}%
  \ifx\relax##4\relax
  \else
    \space(##4)%
  \fi
  \space ##3\glspostdescription \space ##5}%
%    \end{macrocode}
% Sub entries: level 1 entries use \ics{subitem}, levels greater 
% than~1 use \ics{subsubitem}. The level ("##1") shouldn't be 0,
% as that's catered by \cs{glossaryentryfield}, but for completeness,
% if the level is 0, \ics{item} is used. The name is put in bold,
% followed by the symbol in brackets (if it exists), the description
% and the page list.
%    \begin{macrocode}
  \renewcommand*{\glossarysubentryfield}[6]{%
    \ifcase##1\relax
      % level 0
      \item
    \or
      % level 1
      \subitem
    \else
      % all other levels
      \subsubitem
    \fi
    \textbf{\glstarget{##2}{##3}}%
    \ifx\relax##5\relax
    \else
      \space(##5)%
    \fi
    \space##4\glspostdescription\space ##6}%
%    \end{macrocode}
% Vertical gap between groups is the same as that used by indices:
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{\indexspace}}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{indexgroup}
% The \glostyle{indexgroup} style is like the \glostyle{index}
% style but has headings.
%    \begin{macrocode}
\newglossarystyle{indexgroup}{%
%    \end{macrocode}
% Base it on the glostyle{index} style:
%    \begin{macrocode}
  \glossarystyle{index}%
%    \end{macrocode}
% Add a heading for each group. This puts the group's title in
% bold followed by a vertical gap.
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \item\textbf{\glsgetgrouptitle{##1}}\indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{indexhypergroup}
% The \glostyle{indexhypergroup} style is like the
% \glostyle{indexgroup} style but has hyper navigation.
%    \begin{macrocode}
\newglossarystyle{indexhypergroup}{%
%    \end{macrocode}
% Base it on the glostyle{index} style:
%    \begin{macrocode}
  \glossarystyle{index}%
%    \end{macrocode}
% Put navigation links to the groups at the start of the glossary:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \item\textbf{\glsnavigation}\indexspace}%
%    \end{macrocode}
% Add a heading for each group (with a target). The group's title is
% in bold followed by a vertical gap.
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \item\textbf{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}%
    \indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{tree}
% The \glostyle{tree} glossary style 
% is similar in style to the \glostyle{index} style, but
% can have arbitrary levels.
%    \begin{macrocode}
\newglossarystyle{tree}{%
%    \end{macrocode}
% Set the paragraph indentation and skip:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\setlength{\parindent}{0pt}%
     \setlength{\parskip}{0pt plus 0.3pt}}%
    {}%
%    \end{macrocode}
% Do nothing at the start of the \env{theglossary} environment:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries: name in bold, followed by symbol in
% brackets (if it exists), the description and the page list:
%    \begin{macrocode}
  \renewcommand{\glossaryentryfield}[5]{%
    \hangindent0pt\relax
    \parindent0pt\relax
    \textbf{\glstarget{##1}{##2}}%
    \ifx\relax##4\relax
    \else
      \space(##4)%
    \fi
    \space ##3\glspostdescription \space ##5\par}%
%    \end{macrocode}
% Sub entries: level \meta{n} is indented by \meta{n} times
% \ics{glstreeindent}. The name is in bold, followed by the
% symbol in brackets (if it exists), the description and the
% page list.
%    \begin{macrocode}
  \renewcommand{\glossarysubentryfield}[6]{%
    \hangindent##1\glstreeindent\relax
    \parindent##1\glstreeindent\relax
    \textbf{\glstarget{##2}{##3}}%
    \ifx\relax##5\relax
    \else
      \space(##5)%
    \fi
    \space##4\glspostdescription\space ##6\par}%
%    \end{macrocode}
% Vertical gap between groups is the same as that used by
% indices:
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{\indexspace}}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{treegroup}
% Like the \glostyle{tree} style but the glossary groups have
% headings.
%    \begin{macrocode}
\newglossarystyle{treegroup}{%
%    \end{macrocode}
% Base it on the glostyle{tree} style:
%    \begin{macrocode}
  \glossarystyle{tree}%
%    \end{macrocode}
% Each group has a heading (in bold) followed by a vertical gap):
%    \begin{macrocode}
  \renewcommand{\glsgroupheading}[1]{\par
    \noindent\textbf{\glsgetgrouptitle{##1}}\par\indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{treehypergroup}
% The \glostyle{treehypergroup} style is like the \glostyle{treegroup}
% style, but has a set of links to the groups at the
% start of the glossary.
%    \begin{macrocode}
\newglossarystyle{treehypergroup}{%
%    \end{macrocode}
% Base it on the glostyle{tree} style:
%    \begin{macrocode}
  \glossarystyle{tree}%
%    \end{macrocode}
% Put navigation links to the groups at the start of the
% \env{theglossary} environment:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \par\noindent\textbf{\glsnavigation}\par\indexspace}%
%    \end{macrocode}
% Each group has a heading (in bold with a target) followed by a 
% vertical gap):
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \par\noindent
    \textbf{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par
    \indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{macro}{\glstreeindent}
% Length governing left indent for each level of the \glostyle{tree}
% style.
%    \begin{macrocode}
\newlength\glstreeindent
\setlength{\glstreeindent}{10pt}
%    \end{macrocode}
%\end{macro}
%
%\begin{style}{treenoname}
% The \glostyle{treenoname} glossary style 
% is like the \glostyle{tree} style, but
% doesn't print the name or symbol for sub-levels.
%    \begin{macrocode}
\newglossarystyle{treenoname}{%
%    \end{macrocode}
% Set the paragraph indentation and skip:
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\setlength{\parindent}{0pt}%
     \setlength{\parskip}{0pt plus 0.3pt}}%
    {}%
%    \end{macrocode}
% No header:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
%    \end{macrocode}
% No group headings:
%    \begin{macrocode}
\renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Main (level 0) entries: the name is in bold, followed by the
% symbol in brackets (if it exists), the description and the
% page list.
%    \begin{macrocode}
  \renewcommand{\glossaryentryfield}[5]{%
    \hangindent0pt\relax
    \parindent0pt\relax
    \textbf{\glstarget{##1}{##2}}%
    \ifx\relax##4\relax
    \else
      \space(##4)%
    \fi
    \space ##3\glspostdescription \space ##5\par}%
%    \end{macrocode}
% Sub entries: level \meta{n} is indented by \meta{n} times
% \ics{glstreeindent}. The name and symbol are omitted. The
% description followed by the page list are displayed.
%    \begin{macrocode}
  \renewcommand{\glossarysubentryfield}[6]{%
    \hangindent##1\glstreeindent\relax
    \parindent##1\glstreeindent\relax
    \glstarget{##2}{\strut}%
    ##4\glspostdescription\space ##6\par}%
%    \end{macrocode}
% Vertical gap between groups is the same as that used by indices:
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{\indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{treenonamegroup}
% Like the \glostyle{treenoname} style but the glossary groups have
% headings.
%    \begin{macrocode}
\newglossarystyle{treenonamegroup}{%
%    \end{macrocode}
% Base it on the glostyle{treenoname} style:
%    \begin{macrocode}
  \glossarystyle{treenoname}%
%    \end{macrocode}
% Give each group a heading:
%    \begin{macrocode}
  \renewcommand{\glsgroupheading}[1]{\par
    \noindent\textbf{\glsgetgrouptitle{##1}}\par\indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{treenonamehypergroup}
% The \glostyle{treenonamehypergroup} style is like the \glostyle{treenonamegroup}
% style, but has a set of links to the groups at the
% start of the glossary.
%    \begin{macrocode}
\newglossarystyle{treenonamehypergroup}{%
%    \end{macrocode}
% Base it on the glostyle{treenoname} style:
%    \begin{macrocode}
  \glossarystyle{treenoname}%
%    \end{macrocode}
% Put navigation links to the groups at the start of the
% \env{theglossary} environment:
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \par\noindent\textbf{\glsnavigation}\par\indexspace}%
%    \end{macrocode}
% Each group has a heading (in bold with a target) followed by a 
% vertical gap):
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \par\noindent
    \textbf{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par
    \indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{macro}{\glssetwidest}
% \cs{glssetwidest}\oarg{level}\marg{text} sets the widest
% text for the given level. It is used by the
% \glostyle{alttree} glossary styles to determine the
% indentation of each level.
%    \begin{macrocode}
\newcommand*{\glssetwidest}[2][0]{%
  \expandafter\def\csname @glswidestname\romannumeral#1\endcsname{%
    #2}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glswidestname}
% Initialise \cs{@glswidestname}.
%    \begin{macrocode}
\newcommand*{\@glswidestname}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{style}{alttree}
% The \glostyle{alttree} glossary style 
% is similar in style to the \glostyle{tree} style, but
% the indentation is obtained from the width of 
% \cs{@glswidestname} which is set using \cs{glssetwidest}.
%    \begin{macrocode}
\newglossarystyle{alttree}{%
%    \end{macrocode}
% Redefine \env{theglossary} environment.
%    \begin{macrocode}
  \renewenvironment{theglossary}%
    {\def\@gls@prevlevel{-1}%
     \mbox{}\par}%
    {\par}%
%    \end{macrocode}
% Set the header and group headers to nothing.
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{}%
  \renewcommand*{\glsgroupheading}[1]{}%
%    \end{macrocode}
% Redefine the way that the level~0 entries are displayed.
%    \begin{macrocode}
  \renewcommand{\glossaryentryfield}[5]{%
%    \end{macrocode}
% If the level hasn't changed, keep the same settings, otherwise
% change \cs{glstreeindent} accordingly.
%    \begin{macrocode}
    \ifnum\@gls@prevlevel=0\relax
    \else
%    \end{macrocode}
% Find out how big the indentation should be by measuring the
% widest entry.
%    \begin{macrocode}
       \settowidth{\glstreeindent}{\textbf{\@glswidestname\space}}%
%    \end{macrocode}
% Set the hangindent and paragraph indent.
%    \begin{macrocode}
      \hangindent\glstreeindent
      \parindent\glstreeindent
    \fi
%    \end{macrocode}
% Put the name to the left of the paragraph block.
%    \begin{macrocode}
    \makebox[0pt][r]{\makebox[\glstreeindent][l]{%
       \textbf{\glstarget{##1}{##2}}}}%
%    \end{macrocode}
% If the symbol is missing, ignore it, otherwise put it in 
% brackets.
%    \begin{macrocode}
    \ifx\relax##4\relax
    \else
      (##4)\space
    \fi
%    \end{macrocode}
% Do the description followed by the description terminator and
% location list.
%    \begin{macrocode}
    ##3\glspostdescription \space ##5\par
%    \end{macrocode}
% Set the previous level to 0.
%    \begin{macrocode}
    \def\@gls@prevlevel{0}%
  }%
%    \end{macrocode}
% Redefine the way sub-entries are displayed.
%    \begin{macrocode}
  \renewcommand{\glossarysubentryfield}[6]{%
%    \end{macrocode}
% If the level hasn't changed, keep the same settings, otherwise
% adjust \cs{glstreeindent} accordingly.
%    \begin{macrocode}
    \ifnum\@gls@prevlevel=##1\relax
    \else
%    \end{macrocode}
% Compute the widest entry for this level, or for level~0 if not
% defined for this level. Store in \cs{gls@tmplen}
%    \begin{macrocode}
      \@ifundefined{@glswidestname\romannumeral##1}{%
        \settowidth{\gls@tmplen}{\textbf{\@glswidestname\space}}}{%
        \settowidth{\gls@tmplen}{\textbf{%
           \csname @glswidestname\romannumeral##1\endcsname\space}}}%
%    \end{macrocode}
% Determine if going up or down a level
%    \begin{macrocode}
      \ifnum\@gls@prevlevel<##1\relax
%    \end{macrocode}
% Depth has increased, so add the width of the widest entry to
% \cs{glstreeindent}.
%    \begin{macrocode}
         \setlength\glstreeindent\gls@tmplen
         \addtolength\glstreeindent\parindent
         \parindent\glstreeindent
      \else
%    \end{macrocode}
% Depth has decreased, so subtract width of the widest entry 
% from the previous level to \cs{glstreeindent}. First 
% determine the width of the widest entry for the previous level
% and store in \cs{glstreeindent}.
%    \begin{macrocode}
         \@ifundefined{@glswidestname\romannumeral\@gls@prevlevel}{%
           \settowidth{\glstreeindent}{\textbf{%
              \@glswidestname\space}}}{%
           \settowidth{\glstreeindent}{\textbf{%
              \csname @glswidestname\romannumeral\@gls@prevlevel
                 \endcsname\space}}}%
%    \end{macrocode}
% Subtract this length from the previous level's paragraph indent
% and set to \cs{glstreeindent}.
%    \begin{macrocode}
         \addtolength\parindent{-\glstreeindent}%
         \setlength\glstreeindent\parindent
      \fi
    \fi
%    \end{macrocode}
% Set the hanging indentation.
%    \begin{macrocode}
    \hangindent\glstreeindent
%    \end{macrocode}
% Put the name to the left of the paragraph block
%    \begin{macrocode}
    \makebox[0pt][r]{\makebox[\gls@tmplen][l]{%
      \textbf{\glstarget{##2}{##3}}}}%
%    \end{macrocode}
% If the symbol is missing, ignore it, otherwise put it in 
% brackets.
%    \begin{macrocode}
    \ifx##5\relax\relax
    \else
      (##5)\space
    \fi
%    \end{macrocode}
% Do the description followed by the description terminator and
% location list.
%    \begin{macrocode}
    ##4\glspostdescription\space ##6\par
%    \end{macrocode}
% Set the previous level macro to the current level.
%    \begin{macrocode}
    \def\@gls@prevlevel{##1}%
  }%
%    \end{macrocode}
% Vertical gap between groups is the same as that used by indices:
%    \begin{macrocode}
  \renewcommand*{\glsgroupskip}{\indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{alttreegroup}
% Like the \glostyle{alttree} style but the glossary groups have
% headings.
%    \begin{macrocode}
\newglossarystyle{alttreegroup}{%
%    \end{macrocode}
% Base it on the glostyle{alttree} style:
%    \begin{macrocode}
  \glossarystyle{alttree}%
%    \end{macrocode}
% Give each group a heading.
%    \begin{macrocode}
  \renewcommand{\glsgroupheading}[1]{\par
    \def\@gls@prevlevel{-1}%
    \hangindent0pt\relax
    \parindent0pt\relax
    \textbf{\glsgetgrouptitle{##1}}\par\indexspace}%
}
%    \end{macrocode}
%\end{style}
%
%\begin{style}{alttreehypergroup}
% The \glostyle{alttreehypergroup} style is like the 
% \glostyle{alttreegroup} style, but has a set of links to the 
% groups at the start of the glossary.
%    \begin{macrocode}
\newglossarystyle{alttreehypergroup}{%
%    \end{macrocode}
% Base it on the glostyle{alttree} style:
%    \begin{macrocode}
  \glossarystyle{alttree}%
%    \end{macrocode}
% Put the navigation links in the header
%    \begin{macrocode}
  \renewcommand*{\glossaryheader}{%
    \par
    \def\@gls@prevlevel{-1}%
    \hangindent0pt\relax
    \parindent0pt\relax
    \textbf{\glsnavigation}\par\indexspace}%
%    \end{macrocode}
% Put a hypertarget at the start of each group
%    \begin{macrocode}
  \renewcommand*{\glsgroupheading}[1]{%
    \par
    \def\@gls@prevlevel{-1}%
    \hangindent0pt\relax
    \parindent0pt\relax
    \textbf{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par
    \indexspace}}
%    \end{macrocode}
%\end{style}
%
%\iffalse
%    \begin{macrocode}
%</glossary-tree.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-accsupp.sty>
%    \end{macrocode}
%\fi
%\section{Accessibilty Support (glossaries-accsupp Code)}
%\label{sec:code:accsupp}
% The \isty{glossaries-accsupp} package is experimental. It is
% intended to provide a means of using the PDF accessibilty support
% in glossary entries. See the \isty{accsupp} documentation for
% further details about accessibility support.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{glossaries-accsupp}[2009/11/02 v0.2 (NLCT)]
%    \end{macrocode}
% Pass all options to \sty{glossaries}:
%    \begin{macrocode}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{glossaries}}
%    \end{macrocode}
% Process options:
%    \begin{macrocode}
\ProcessOptions
%    \end{macrocode}
% Required packages:
%    \begin{macrocode}
\RequirePackage{glossaries}
\RequirePackage{accsupp}
%    \end{macrocode}
% 
%\subsection{Defining Replacement Text}
% The version 0.1 stored the replacement text in the
% \gloskey{symbol} key. This has been changed to use the
% new keys defined here. Example of use:
%\begin{verbatim}
%\newglossaryentry{dr}{name=Dr,description={},access={Doctor}}
%\end{verbatim}
%\begin{key}{access}
% The replacement text corresponding to the \gloskey{name} key:
%    \begin{macrocode}
\define@key{glossentry}{access}{%
  \def\@glo@access{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{textaccess}
% The replacement text corresponding to the \gloskey{text} key:
%    \begin{macrocode}
\define@key{glossentry}{textaccess}{%
  \def\@glo@textaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{firstaccess}
% The replacement text corresponding to the \gloskey{first} key:
%    \begin{macrocode}
\define@key{glossentry}{firstaccess}{%
  \def\@glo@firstaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{pluralaccess}
% The replacement text corresponding to the \gloskey{plural} key:
%    \begin{macrocode}
\define@key{glossentry}{pluralaccess}{%
  \def\@glo@pluralaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{firstpluralaccess}
% The replacement text corresponding to the \gloskey{firstplural} key:
%    \begin{macrocode}
\define@key{glossentry}{firstpluralaccess}{%
  \def\@glo@firstpluralaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{symbolaccess}
% The replacement text corresponding to the \gloskey{symbol} key:
%    \begin{macrocode}
\define@key{glossentry}{symbolaccess}{%
  \def\@glo@symbolaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{symbolpluralaccess}
% The replacement text corresponding to the \gloskey{symbolplural} key:
%    \begin{macrocode}
\define@key{glossentry}{symbolpluralaccess}{%
  \def\@glo@symbolpluralaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{descriptionaccess}
% The replacement text corresponding to the \gloskey{description} key:
%    \begin{macrocode}
\define@key{glossentry}{descriptionaccess}{%
  \def\@glo@descaccess{#1}%
}
%    \end{macrocode}
%\end{key}
%\begin{key}{descriptionpluralaccess}
% The replacement text corresponding to the \gloskey{descriptionplural} key:
%    \begin{macrocode}
\define@key{glossentry}{descriptionpluralaccess}{%
  \def\@glo@descpluralaccess{#1}%
}
%    \end{macrocode}
%\end{key}
% There are no equivalent keys for the \gloskey{user1}\ldots
%\gloskey{user6} keys. The replacement text would have to be
% explicitly put in the value, e.g.,
% "user1={\glsaccsupp{inches}{in}}".
%
%\begin{macro}{\@gls@noaccess}
% Indicates that no replacement text has been provided.
%    \begin{macrocode}
\def\@gls@noaccess{\relax}
%    \end{macrocode}
%\end{macro}
%
% Add to the start hook (the \gloskey{access} key is initialised to
% the value of the \gloskey{symbol} key at the start for backwards 
% compatibility):
%    \begin{macrocode}
\let\@gls@oldnewglossaryentryprehook\@newglossaryentryprehook
\renewcommand*{\@newglossaryentryprehook}{%
  \@gls@oldnewglossaryentryprehook
  \def\@glo@access{\@glo@symbol}%
%    \end{macrocode}
% Initialise the other keys:
%    \begin{macrocode}
  \def\@glo@textaccess{\@glo@access}%
  \def\@glo@firstaccess{\@glo@access}%
  \def\@glo@pluralaccess{\@glo@textaccess}%
  \def\@glo@firstpluralaccess{\@glo@pluralaccess}%
  \def\@glo@symbolaccess{\relax}%
  \def\@glo@symbolpluralaccess{\@glo@symbolaccess}%
  \def\@glo@descaccess{\relax}%
  \def\@glo@descpluralaccess{\@glo@descaccess}%
}
%    \end{macrocode}
% Add to the end hook:
%    \begin{macrocode}
\let\@gls@oldnewglossaryentryposthook\@newglossaryentryposthook
\renewcommand*{\@newglossaryentryposthook}{%
  \@gls@oldnewglossaryentryposthook
%    \end{macrocode}
% Store the access information:
%    \begin{macrocode}
  \expandafter
    \protected@xdef\csname glo@\@glo@label @access\endcsname{%
      \@glo@access}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @textaccess\endcsname{%
      \@glo@textaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @firstaccess\endcsname{%
      \@glo@firstaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @pluralaccess\endcsname{%
      \@glo@pluralaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @firstpluralaccess\endcsname{%
      \@glo@firstpluralaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @symbolaccess\endcsname{%
      \@glo@symbolaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @symbolpluralaccess\endcsname{%
      \@glo@symbolpluralaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @descaccess\endcsname{%
      \@glo@descaccess}%
  \expandafter
    \protected@xdef\csname glo@\@glo@label @descpluralaccess\endcsname{%
      \@glo@descpluralaccess}%
}
%    \end{macrocode}
%
%\subsection{Accessing Replacement Text}
%\begin{macro}{\glsentryaccess}
% Get the value of the \gloskey{access} key for the entry with
% the given label:
%    \begin{macrocode}
\newcommand*{\glsentryaccess}[1]{%
  \csname glo@#1@access\endcsname
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentrytextaccess}
% Get the value of the \gloskey{textaccess} key for the entry with
% the given label:
%    \begin{macrocode}
\newcommand*{\glsentrytextaccess}[1]{%
  \csname glo@#1@textaccess\endcsname
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentryfirstaccess}
% Get the value of the \gloskey{firstaccess} key for the entry with
% the given label:
%    \begin{macrocode}
\newcommand*{\glsentryfirstaccess}[1]{%
  \csname glo@#1@firstaccess\endcsname
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentrypluralaccess}
% Get the value of the \gloskey{pluralaccess} key for the entry with
% the given label:
%    \begin{macrocode}
\newcommand*{\glsentrypluralaccess}[1]{%
  \csname glo@#1@pluralaccess\endcsname
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentryfirstpluralaccess}
% Get the value of the \gloskey{firstpluralaccess} key for the entry with
% the given label:
%    \begin{macrocode}
\newcommand*{\glsentryfirstpluralaccess}[1]{%
  \csname glo@#1@firstpluralaccess\endcsname
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentrysymbolaccess}
% Get the value of the \gloskey{symbolaccess} key for the entry with
% the given label:
%    \begin{macrocode}
\newcommand*{\glsentrysymbolaccess}[1]{%
  \csname glo@#1@symbolaccess\endcsname
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentrysymbolpluralaccess}
% Get the value of the \gloskey{symbolpluralaccess} key for the entry with
% the given label:
%    \begin{macrocode}
\newcommand*{\glsentrysymbolpluralaccess}[1]{%
  \csname glo@#1@symbolpluralaccess\endcsname
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentrydescaccess}
% Get the value of the \gloskey{descriptionaccess} key for the entry with
% the given label:
%    \begin{macrocode}
\newcommand*{\glsentrydescaccess}[1]{%
  \csname glo@#1@descaccess\endcsname
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsentrydescpluralaccess}
% Get the value of the \gloskey{descriptionpluralaccess} key for the entry with
% the given label:
%    \begin{macrocode}
\newcommand*{\glsentrydescpluralaccess}[1]{%
  \csname glo@#1@descaccess\endcsname
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsaccsupp}
%\cs{glsaccsupp}\marg{replacement text}\marg{text}\\[10pt]
% This can be redefined to use "E" or "Alt" instead of
% "ActualText". (I don't have the software to test the "E" or
% "Alt" options.)
%    \begin{macrocode}
\newcommand*{\glsaccsupp}[2]{%
  \BeginAccSupp{ActualText=#1}#2\EndAccSupp{}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\xglsaccsupp}
% Fully expands replacement text before calling \cs{glsaccsupp}
%    \begin{macrocode}
\newcommand*{\xglsaccsupp}[2]{%
   \protected@edef\@gls@replacementtext{#1}%
   \expandafter\glsaccsupp\expandafter{\@gls@replacementtext}{#2}%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\glsnameaccessdisplay}
% Displays the first argument with the accessibility text for
% the entry with the label given by the second argument (if set).
%    \begin{macrocode}
\DeclareRobustCommand*{\glsnameaccessdisplay}[2]{%
  \protected@edef\@glo@access{\glsentryaccess{#2}}%
  \ifx\@glo@access\@gls@noaccess
    #1%
  \else
    \xglsaccsupp{\@glo@access}{#1}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glstextaccessdisplay}
% As above but for the \gloskey{textaccess} replacement text.
%    \begin{macrocode}
\DeclareRobustCommand*{\glstextaccessdisplay}[2]{%
  \protected@edef\@glo@access{\glsentrytextaccess{#2}}%
  \ifx\@glo@access\@gls@noaccess
    #1%
  \else
    \xglsaccsupp{\@glo@access}{#1}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glspluralaccessdisplay}
% As above but for the \gloskey{pluralaccess} replacement text.
%    \begin{macrocode}
\DeclareRobustCommand*{\glspluralaccessdisplay}[2]{%
  \protected@edef\@glo@access{\glsentrypluralaccess{#2}}%
  \ifx\@glo@access\@gls@noaccess
    #1%
  \else
    \xglsaccsupp{\@glo@access}{#1}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsfirstaccessdisplay}
% As above but for the \gloskey{firstaccess} replacement text.
%    \begin{macrocode}
\DeclareRobustCommand*{\glsfirstaccessdisplay}[2]{%
  \protected@edef\@glo@access{\glsentryfirstaccess{#2}}%
  \ifx\@glo@access\@gls@noaccess
    #1%
  \else
    \xglsaccsupp{\@glo@access}{#1}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsfirstpluralaccessdisplay}
% As above but for the \gloskey{firstpluralaccess} replacement text.
%    \begin{macrocode}
\DeclareRobustCommand*{\glsfirstpluralaccessdisplay}[2]{%
  \protected@edef\@glo@access{\glsentryfirstpluralaccess{#2}}%
  \ifx\@glo@access\@gls@noaccess
    #1%
  \else
    \xglsaccsupp{\@glo@access}{#1}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glssymbolaccessdisplay}
% As above but for the \gloskey{symbolaccess} replacement text.
%    \begin{macrocode}
\DeclareRobustCommand*{\glssymbolaccessdisplay}[2]{%
  \protected@edef\@glo@access{\glsentrysymbolaccess{#2}}%
  \ifx\@glo@access\@gls@noaccess
    #1%
  \else
    \xglsaccsupp{\@glo@access}{#1}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glssymbolpluralaccessdisplay}
% As above but for the \gloskey{symbolpluralaccess} replacement text.
%    \begin{macrocode}
\DeclareRobustCommand*{\glssymbolpluralaccessdisplay}[2]{%
  \protected@edef\@glo@access{\glsentrysymbolpluralaccess{#2}}%
  \ifx\@glo@access\@gls@noaccess
    #1%
  \else
    \xglsaccsupp{\@glo@access}{#1}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsdescriptionaccessdisplay}
% As above but for the \gloskey{descriptionaccess} replacement text.
%    \begin{macrocode}
\DeclareRobustCommand*{\glsdescriptionaccessdisplay}[2]{%
  \protected@edef\@glo@access{\glsentrydescaccess{#2}}%
  \ifx\@glo@access\@gls@noaccess
    #1%
  \else
    \xglsaccsupp{\@glo@access}{#1}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsdescriptionpluralaccessdisplay}
% As above but for the \gloskey{descriptionpluralaccess} replacement text.
%    \begin{macrocode}
\DeclareRobustCommand*{\glsdescriptionpluralaccessdisplay}[2]{%
  \protected@edef\@glo@access{\glsentrydescpluralaccess{#2}}%
  \ifx\@glo@access\@gls@noaccess
    #1%
  \else
    \xglsaccsupp{\@glo@access}{#1}%
  \fi
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsaccessdisplay}
% Gets the replacement text corresponding to the named key given
% by the first argument and calls the appropriate command 
% defined above.
%    \begin{macrocode}
\DeclareRobustCommand*{\glsaccessdisplay}[3]{%
  \@ifundefined{gls#1accessdisplay}%
  {%
    \PackageError{glossaries-accsupp}{No accessibility support
     for key `#1'}{}%
  }%
  {%
    \csname gls#1accessdisplay\endcsname{#2}{#3}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@}
% Redefine \cs{@gls@} to change the way the link text is defined
%    \begin{macrocode}
\def\@gls@#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label}
%    \begin{macrocode}
    \def\@gls@link@opts{#1}%
    \def\@gls@link@label{#2}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text}). This is no longer expanded.
%    \begin{macrocode}
    \ifglsused{#2}%
    {%
      \def\@glo@text{\csname gls@\@glo@type @display\endcsname
        {\glstextaccessdisplay{\glsentrytext{#2}}{#2}}%
        {\glsdescriptionaccessdisplay{\glsentrydesc{#2}}{#2}}%
        {\glssymbolaccessdisplay{\glsentrysymbol{#2}}{#2}}%
        {#3}}%
    }%
    {%
      \def\@glo@text{\csname gls@\@glo@type @displayfirst\endcsname
        {\glsfirstaccessdisplay{\glsentryfirst{#2}}{#2}}%
        {\glsdescriptionaccessdisplay{\glsentrydesc{#2}}{#2}}%
        {\glssymbolaccessdisplay{\glsentrysymbol{#2}}{#2}}%
        {#3}}%
    }%
%    \end{macrocode}
% Call \cs{@gls@link}.
% If \pkgopt{footnote} package option has been used, suppress 
% hyperlink for first use.
%    \begin{macrocode}
    \ifglsused{#2}%
    {%
      \@gls@link[#1]{#2}{\@glo@text}%
    }%
    {%
      \gls@checkisacronymlist\@glo@type
      \ifthenelse{\(\boolean{@glsisacronymlist}\AND
        \boolean{glsacrfootnote}\) \OR\NOT\boolean{glshyperfirst}}%
      {%
        \@gls@link[#1,hyper=false]{#2}{\@glo@text}%
      }%
      {%
        \@gls@link[#1]{#2}{\@glo@text}%
      }%
    }%
%    \end{macrocode}
% Indicate that this entry has now been used
%    \begin{macrocode}
    \glsunset{#2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Gls@}
%    \begin{macrocode}
\def\@Gls@#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label}
%    \begin{macrocode}
    \def\@gls@link@opts{#1}%
    \def\@gls@link@label{#2}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text}). The first character of the entry text is 
% converted to uppercase before passing to
% \cs{gls@}\meta{type}"@display" or 
% \cs{gls@}\meta{type}"@displayfirst"
%    \begin{macrocode}
    \ifglsused{#2}%
    {%
      \def\@glo@text{\csname gls@\@glo@type @display\endcsname
        {\glstextaccessdisplay{\Glsentrytext{#2}}{#2}}%
        {\glsdescriptionaccessdisplay{\glsentrydesc{#2}}{#2}}%
        {\glssymbolaccessdisplay{\glsentrysymbol{#2}}{#2}}%
        {#3}}%
    }%
    {%
      \def\@glo@text{\csname gls@\@glo@type @displayfirst\endcsname
        {\glsfirstaccessdisplay{\Glsentryfirst{#2}}{#2}}%
        {\glsdescriptionaccessdisplay{\glsentrydesc{#2}}{#2}}%
        {\glssymbolaccessdisplay{\glsentrysymbol{#2}}{#2}}%
        {#3}}%
    }%
%    \end{macrocode}
% Call \cs{@gls@link}.
% If \pkgopt{footnote} package option has been used, suppress 
% hyperlink for first use.
%    \begin{macrocode}
  \ifglsused{#2}%
  {%
    \@gls@link[#1]{#2}{\@glo@text}%
  }%
  {%
    \gls@checkisacronymlist\@glo@type
    \ifthenelse{\(\boolean{@glsisacronymlist}\AND
      \boolean{glsacrfootnote}\) \OR\NOT\boolean{glshyperfirst}}%
    {%
      \@gls@link[#1,hyper=false]{#2}{\@glo@text}%
    }%
    {%
    \@gls@link[#1]{#2}{\@glo@text}%
    }%
  }%
%    \end{macrocode}
% Indicate that this entry has now been used
%    \begin{macrocode}
    \glsunset{#2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLS@}
%    \begin{macrocode}
\def\@GLS@#1#2[#3]{%
  \glsdoifexists{#2}{%
    \edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label}
%    \begin{macrocode}
    \def\@gls@link@opts{#1}%
    \def\@gls@link@label{#2}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text}).
%    \begin{macrocode}
    \ifglsused{#2}%
    {%
      \def\@glo@text{\csname gls@\@glo@type @display\endcsname
        {\glstextaccessdisplay{\glsentrytext{#2}}{#2}}%
        {\glsdescriptionaccessdisplay{\glsentrydesc{#2}}{#2}}%
        {\glssymbolaccessdisplay{\glsentrysymbol{#2}}{#2}}%
        {#3}}%
    }%
    {%
      \edef\@glo@text{\csname gls@\@glo@type @displayfirst\endcsname
        {\glsfirstaccessdisplay{\glsentryfirst{#2}}{#2}}%
        {\glsdescriptionaccessdisplay{\glsentrydesc{#2}}{#2}}%
        {\glssymbolaccessdisplay{\glsentrysymbol{#2}}{#2}}%
        {#3}}%
    }%
%    \end{macrocode}
% Call \cs{@gls@link}
% If \pkgopt{footnote} package option has been used, suppress 
% hyperlink for first use.
%\changes{1.16}{2008 August 27}{Test glossary type is 'acronymtype in addition to
%checking if footnote option has been used}
%    \begin{macrocode}
    \ifglsused{#2}%
    {%
      \@gls@link[#1]{#2}{\MakeUppercase{\@glo@text}}%
    }%
    {%
      \gls@checkisacronymlist\@glo@type
      \ifthenelse{\(\boolean{@glsisacronymlist}\AND
        \boolean{glsacrfootnote}\) \OR\NOT\boolean{glshyperfirst}}{%
        \@gls@link[#1,hyper=false]{#2}{\MakeUppercase{\@glo@text}}%
      }%
      {%
        \@gls@link[#1]{#2}{\MakeUppercase{\@glo@text}}%
      }%
    }%
%    \end{macrocode}
% Indicate that this entry has now been used
%    \begin{macrocode}
    \glsunset{#2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@gls@pl@}
%    \begin{macrocode}
\def\@glspl@#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label}
%    \begin{macrocode}
    \def\@gls@link@opts{#1}%
    \def\@gls@link@label{#2}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
    \ifglsused{#2}%
    {%
      \def\@glo@text{\csname gls@\@glo@type @display\endcsname
        {\glspluralaccessdisplay{\glsentryplural{#2}}{#2}}%
        {\glsdescriptionpluralaccessdisplay{\glsentrydescplural{#2}}{#2}}%
        {\glssymbolpluralaccessdisplay{\glsentrysymbolplural{#2}}{#2}}%
        {#3}}%
    }%
    {%
      \def\@glo@text{\csname gls@\@glo@type @displayfirst\endcsname
        {\glsfirstpluralaccessdisplay{\glsentryfirstplural{#2}}{#2}}%
        {\glsdescriptionpluralaccessdisplay{\glsentrydescplural{#2}}{#2}}%
        {\glssymbolpluralaccessdisplay{\glsentrysymbolplural{#2}}{#2}}%
        {#3}}%
    }%
%    \end{macrocode}
% Call \cs{@gls@link}
% If \pkgopt{footnote} package option has been used, suppress 
% hyperlink for first use.
%\changes{1.16}{2008 August 27}{Test glossary type is 'acronymtype in addition to
%checking if footnote option has been used}
%    \begin{macrocode}
    \ifglsused{#2}%
    {%
      \@gls@link[#1]{#2}{\@glo@text}%
    }%
    {%
      \gls@checkisacronymlist\@glo@type
      \ifthenelse{\(\boolean{@glsisacronymlist}\AND
        \boolean{glsacrfootnote}\) \OR\NOT\boolean{glshyperfirst}}%
      {%
        \@gls@link[#1,hyper=false]{#2}{\@glo@text}%
      }%
      {%
        \@gls@link[#1]{#2}{\@glo@text}%
      }%
    }%
%    \end{macrocode}
% Indicate that this entry has now been used
%    \begin{macrocode}
    \glsunset{#2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@Glspl@}
%    \begin{macrocode}
\def\@Glspl@#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label}
%    \begin{macrocode}
    \def\@gls@link@opts{#1}%
    \def\@gls@link@label{#2}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text}).
%    \begin{macrocode}
    \ifglsused{#2}%
    {%
      \def\@glo@text{\csname gls@\@glo@type @display\endcsname
        {\glspluralaccessdisplay{\Glsentryplural{#2}}{#2}}%
        {\glsdescriptionpluralaccessdisplay{\glsentrydescplural{#2}}{#2}}%
        {\glssymbolpluralaccessdisplay{\glsentrysymbolplural{#2}}{#2}}%
        {#3}}%
    }%
    {%
      \def\@glo@text{\csname gls@\@glo@type @displayfirst\endcsname
        {\glsfirstpluralaccessdisplay{\Glsentryfirstplural{#2}}{#2}}%
        {\glsdescriptionpluralaccessdisplay{\glsentrydescplural{#2}}{#2}}%
        {\glssymbolpluralaccessdisplay{\glsentrysymbolplural{#2}}{#2}}%
        {#3}}%
    }%
%    \end{macrocode}
% Call \cs{@gls@link}
% If \pkgopt{footnote} package option has been used, suppress 
% hyperlink for first use.
%    \begin{macrocode}
    \ifglsused{#2}%
    {%
      \@gls@link[#1]{#2}{\@glo@text}%
    }%
    {%
      \ifthenelse{\equal{\@glo@type}{\acronymtype}\and
        \boolean{glsacrfootnote}}%
      {%
        \@gls@link[#1,hyper=false]{#2}{\@glo@text}%
      }%
      {%
        \@gls@link[#1]{#2}{\@glo@text}%
      }%
    }%
%    \end{macrocode}
% Indicate that this entry has now been used
%    \begin{macrocode}
    \glsunset{#2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@GLSpl@}
%    \begin{macrocode}
\def\@GLSpl@#1#2[#3]{%
  \glsdoifexists{#2}%
  {%
    \edef\@glo@type{\glsentrytype{#2}}%
%    \end{macrocode}
% Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label}
%    \begin{macrocode}
    \def\@gls@link@opts{#1}%
    \def\@gls@link@label{#2}%
%    \end{macrocode}
% Determine what the link text should be (this is stored in 
% \cs{@glo@text})
%    \begin{macrocode}
    \ifglsused{#2}%
    {%
      \def\@glo@text{\csname gls@\@glo@type @display\endcsname
        {\glspluralaccessdisplay{\glsentryplural{#2}}{#2}}%
        {\glsdescriptionpluralaccessdisplay{\glsentrydescplural{#2}}{#2}}%
        {\glssymbolpluralaccessdisplay{\glsentrysymbolplural{#2}}{#2}}%
        {#3}}%
    }%
    {%
      \def\@glo@text{\csname gls@\@glo@type @displayfirst\endcsname
      {\glsfirstpluralaccessdisplay{\glsentryfirstplural{#2}}{#2}}%
      {\glsdescriptionpluralaccessdisplay{\glsentrydescplural{#2}}{#2}}%
      {\glssymbolpluralaccessdisplay{\glsentrysymbolplural{#2}}{#2}}%
      {#3}}%
    }%
%    \end{macrocode}
% Call \cs{@gls@link}
% If \pkgopt{footnote} package option has been used, suppress 
% hyperlink for first use.
%    \begin{macrocode}
    \ifglsused{#2}%
    {%
      \@gls@link[#1]{#2}{\MakeUppercase{\@glo@text}}%
    }%
    {%
      \gls@checkisacronymlist\@glo@type
      \ifthenelse{\(\boolean{@glsisacronymlist}\AND
        \boolean{glsacrfootnote}\)\OR\NOT\boolean{glshyperfirst}}%
      {%
        \@gls@link[#1,hyper=false]{#2}{\MakeUppercase{\@glo@text}}%
      }%
      {%
        \@gls@link[#1]{#2}{\MakeUppercase{\@glo@text}}%
      }%
    }%
%    \end{macrocode}
% Indicate that this entry has now been used
%    \begin{macrocode}
    \glsunset{#2}%
  }%
}
%    \end{macrocode}
%\end{macro}
%
%\subsection{Displaying the Glossary}
% Entries within the glossary or list of acronyms are now formatted
% via \cs{accsuppglossaryentryfield} and
% \cs{accsuppglossarysubentryfield}.
%\begin{macro}{\@glossaryentryfield}
%    \begin{macrocode}
\ifglsxindy
  \renewcommand*{\@glossaryentryfield}{%
     \string\\accsuppglossaryentryfield}
\else
  \renewcommand*{\@glossaryentryfield}{%
     \string\accsuppglossaryentryfield}
\fi
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\@glossarysubentryfield}
%    \begin{macrocode}
\ifglsxindy
  \renewcommand*{\@glossarysubentryfield}{%
    \string\\accsuppglossarysubentryfield}
\else
  \renewcommand*{\@glossarysubentryfield}{%
    \string\accsuppglossarysubentryfield}
\fi
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\accsuppglossaryentryfield}
%    \begin{macrocode}
\newcommand*{\accsuppglossaryentryfield}[5]{%
  \glossaryentryfield{#1}%
  {\glsnameaccessdisplay{#2}{#1}}%
  {\glsdescriptionaccessdisplay{#3}{#1}}%
  {\glssymbolaccessdisplay{#4}{#1}}{#5}%
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\accsuppglossarysubentryfield}
%    \begin{macrocode}
\newcommand*{\accsuppglossarysubentryfield}[6]{%
  \glossaryentryfield{#1}{#2}%
  {\glsnameaccessdisplay{#3}{#2}}%
  {\glsdescriptionaccessdisplay{#4}{#2}}%
  {\glssymbolaccessdisplay{#5}{#2}}{#6}%
}
%    \end{macrocode}
%\end{macro}
%
%\subsection{Acronyms}
% Use \cs{newacronymhook} to modify the key list to set
% the access text to the long version by default.
%    \begin{macrocode}
\renewcommand*{\newacronymhook}{%
  \edef\@gls@keylist{\glsshortkey access=\the\glslongtok,%
     \the\glskeylisttok}%
  \expandafter\glskeylisttok\expandafter{\@gls@keylist}%
}
%    \end{macrocode}
%\begin{macro}{\DefaultNewAcronymDef}
% Modify default style to use access text:
%    \begin{macrocode}
\renewcommand*{\DefaultNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\the\glsshorttok},%
      description={\the\glslongtok},%
      descriptionaccess=\relax,
      text={\the\glsshorttok},%
      textaccess={\the\glslongtok},%
      access={\noexpand\@glo@textaccess},%
      sort={\the\glsshorttok},%
      descriptionplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      firstaccess=\relax,
      first={\noexpand\glsdescriptionaccessdisplay
        {\the\glslongtok}{\the\glslabeltok}\space
        (\noexpand\glstextaccessdisplay
          {\the\glsshorttok}{\the\glslabeltok})},%
      plural={\the\glsshorttok\acrpluralsuffix},%
      firstplural={\noexpand\glsdescriptionpluralaccessdisplay
        {\noexpand\@glo@descplural}{\the\glslabeltok}\space
        (\noexpand\glspluralaccessdisplay
          {\noexpand\@glo@plural}{\the\glslabeltok})},%
      firstpluralaccess=\relax,
      \the\glskeylisttok
    }%
  }%
  \@do@newglossaryentry
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\DescriptionFootnoteNewAcronymDef}
%    \begin{macrocode}
\renewcommand*{\DescriptionFootnoteNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\noexpand\acronymfont{\the\glsshorttok}},%
      sort={\the\glsshorttok},%
      text={\the\glsshorttok},%
      textaccess={\the\glslongtok},%
      access={\noexpand\@glo@textaccess},%
      plural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      symbol={\the\glslongtok},%
      symbolplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      \the\glskeylisttok
    }%
  }%
  \@do@newglossaryentry
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\DescriptionNewAcronymDef}
%    \begin{macrocode}
\renewcommand*{\DescriptionNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\noexpand
        \acrnameformat{\the\glsshorttok}{\the\glslongtok}},%
      access={\noexpand\@glo@textaccess},%
      sort={\the\glsshorttok},%
      first={\the\glslongtok},%
      firstaccess=\relax,
      firstplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      text={\the\glsshorttok},%
      textaccess={\the\glslongtok},%
      plural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      symbol={\noexpand\@glo@text},%
      symbolaccess={\noexpand\@glo@textaccess},%
      symbolplural={\noexpand\@glo@plural},%
      \the\glskeylisttok}%
  }%
  \@do@newglossaryentry
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\FootnoteNewAcronymDef}
%    \begin{macrocode}
\renewcommand*{\FootnoteNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\noexpand\acronymfont{\the\glsshorttok}},%
      access={\noexpand\@glo@textaccess},%
      sort={\the\glsshorttok},%
      text={\the\glsshorttok},%
      textaccess={\the\glslongtok},%
      plural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      description={\the\glslongtok},%
      descriptionplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      \the\glskeylisttok
    }%
  }%
  \@do@newglossaryentry
}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\SmallNewAcronymDef}
%    \begin{macrocode}
\renewcommand*{\SmallNewAcronymDef}{%
  \edef\@do@newglossaryentry{%
    \noexpand\newglossaryentry{\the\glslabeltok}%
    {%
      type=\acronymtype,%
      name={\noexpand\acronymfont{\the\glsshorttok}},%
      access={\noexpand\@glo@symbolaccess},%
      sort={\the\glsshorttok},%
      text={\noexpand\@glo@symbol},%
      textaccess={\noexpand\@glo@symbolaccess},%
      plural={\noexpand\@glo@symbolplural},%
      first={\the\glslongtok},%
      firstaccess=\relax,
      firstplural={\the\glslongtok\noexpand\acrpluralsuffix},%
      description={\noexpand\@glo@first},%
      descriptionplural={\noexpand\@glo@firstplural},%
      symbol={\the\glsshorttok},%
      symbolaccess={\the\glslongtok},%
      symbolplural={\the\glsshorttok\noexpand\acrpluralsuffix},%
      \the\glskeylisttok
    }%
  }%
  \@do@newglossaryentry
}
%    \end{macrocode}
%\end{macro}
% Add means of referencing accessibility support for acronyms:
%\begin{macro}{\glsshortaccesskey}
%    \begin{macrocode}
  \newcommand*{\glsshortaccesskey}{\glsshortkey access}%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glsshortpluralaccesskey}
%    \begin{macrocode}
  \newcommand*{\glsshortpluralaccesskey}{\glsshortpluralkey access}%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glslongaccesskey}
%    \begin{macrocode}
  \newcommand*{\glslongaccesskey}{\glslongkey access}%
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\glslongpluralaccesskey}
%    \begin{macrocode}
  \newcommand*{\glslongpluralaccesskey}{\glslongpluralkey access}%
%    \end{macrocode}
%\end{macro}
%\iffalse
%    \begin{macrocode}
%</glossaries-accsupp.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-babel.sty>
%    \end{macrocode}
%\fi
%\section{Multi-Lingual Support}
% Many thanks to everyone who contributed to the translations both
% via email and on comp.text.tex.
%\subsection{Babel Captions}
% Define \isty{babel} captions if multi-lingual
% support is required, but the \isty{translator} package is not loaded.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{glossaries-babel}[2009/04/16 v1.2 (NLCT)]
%    \end{macrocode}
% English:
%    \begin{macrocode}
\@ifundefined{captionsenglish}{}{%
  \addto\captionsenglish{%
    \renewcommand*{\glossaryname}{Glossary}%
    \renewcommand*{\acronymname}{Acronyms}%
    \renewcommand*{\entryname}{Notation}%
    \renewcommand*{\descriptionname}{Description}%
    \renewcommand*{\symbolname}{Symbol}%
    \renewcommand*{\pagelistname}{Page List}%
    \renewcommand*{\glssymbolsgroupname}{Symbols}%
    \renewcommand*{\glsnumbersgroupname}{Numbers}%
}%
}
\@ifundefined{captionsamerican}{}{%
  \addto\captionsamerican{%
    \renewcommand*{\glossaryname}{Glossary}%
    \renewcommand*{\acronymname}{Acronyms}%
    \renewcommand*{\entryname}{Notation}%
    \renewcommand*{\descriptionname}{Description}%
    \renewcommand*{\symbolname}{Symbol}%
    \renewcommand*{\pagelistname}{Page List}%
    \renewcommand*{\glssymbolsgroupname}{Symbols}%
    \renewcommand*{\glsnumbersgroupname}{Numbers}%
}%
}
\@ifundefined{captionsaustralian}{}{%
  \addto\captionsaustralian{%
    \renewcommand*{\glossaryname}{Glossary}%
    \renewcommand*{\acronymname}{Acronyms}%
    \renewcommand*{\entryname}{Notation}%
    \renewcommand*{\descriptionname}{Description}%
    \renewcommand*{\symbolname}{Symbol}%
    \renewcommand*{\pagelistname}{Page List}%
    \renewcommand*{\glssymbolsgroupname}{Symbols}%
    \renewcommand*{\glsnumbersgroupname}{Numbers}%
}%
}
\@ifundefined{captionsbritish}{}{%
  \addto\captionsbritish{%
    \renewcommand*{\glossaryname}{Glossary}%
    \renewcommand*{\acronymname}{Acronyms}%
    \renewcommand*{\entryname}{Notation}%
    \renewcommand*{\descriptionname}{Description}%
    \renewcommand*{\symbolname}{Symbol}%
    \renewcommand*{\pagelistname}{Page List}%
    \renewcommand*{\glssymbolsgroupname}{Symbols}%
    \renewcommand*{\glsnumbersgroupname}{Numbers}%
}}%
\@ifundefined{captionscanadian}{}{%
  \addto\captionscanadian{%
    \renewcommand*{\glossaryname}{Glossary}%
    \renewcommand*{\acronymname}{Acronyms}%
    \renewcommand*{\entryname}{Notation}%
    \renewcommand*{\descriptionname}{Description}%
    \renewcommand*{\symbolname}{Symbol}%
    \renewcommand*{\pagelistname}{Page List}%
    \renewcommand*{\glssymbolsgroupname}{Symbols}%
    \renewcommand*{\glsnumbersgroupname}{Numbers}%
}%
}
\@ifundefined{captionsnewzealand}{}{%
  \addto\captionsnewzealand{%
    \renewcommand*{\glossaryname}{Glossary}%
    \renewcommand*{\acronymname}{Acronyms}%
    \renewcommand*{\entryname}{Notation}%
    \renewcommand*{\descriptionname}{Description}%
    \renewcommand*{\symbolname}{Symbol}%
    \renewcommand*{\pagelistname}{Page List}%
    \renewcommand*{\glssymbolsgroupname}{Symbols}%
    \renewcommand*{\glsnumbersgroupname}{Numbers}%
}%
}
\@ifundefined{captionsUKenglish}{}{%
  \addto\captionsUKenglish{%
    \renewcommand*{\glossaryname}{Glossary}%
    \renewcommand*{\acronymname}{Acronyms}%
    \renewcommand*{\entryname}{Notation}%
    \renewcommand*{\descriptionname}{Description}%
    \renewcommand*{\symbolname}{Symbol}%
    \renewcommand*{\pagelistname}{Page List}%
    \renewcommand*{\glssymbolsgroupname}{Symbols}%
    \renewcommand*{\glsnumbersgroupname}{Numbers}%
}%
}
\@ifundefined{captionsUSenglish}{}{%
  \addto\captionsUSenglish{%
    \renewcommand*{\glossaryname}{Glossary}%
    \renewcommand*{\acronymname}{Acronyms}%
    \renewcommand*{\entryname}{Notation}%
    \renewcommand*{\descriptionname}{Description}%
    \renewcommand*{\symbolname}{Symbol}%
    \renewcommand*{\pagelistname}{Page List}%
    \renewcommand*{\glssymbolsgroupname}{Symbols}%
    \renewcommand*{\glsnumbersgroupname}{Numbers}%
}%
}
%    \end{macrocode}
% German (quite a few variations were suggested for German; 
% I settled on the following):
%    \begin{macrocode}
\@ifundefined{captionsgerman}{}{%
  \addto\captionsgerman{% 
    \renewcommand*{\glossaryname}{Glossar}%
    \renewcommand*{\acronymname}{Akronyme}%
    \renewcommand*{\entryname}{Bezeichnung}%
    \renewcommand*{\descriptionname}{Beschreibung}%
    \renewcommand*{\symbolname}{Symbol}%
    \renewcommand*{\pagelistname}{Seiten}%
    \renewcommand*{\glssymbolsgroupname}{Symbole}%
    \renewcommand*{\glsnumbersgroupname}{Zahlen}} 
}
%    \end{macrocode}
% ngerman is identical to German:
%\changes{1.2}{2009 April 16}{fixed bug in ngerman captions}
%    \begin{macrocode}
\@ifundefined{captionsngerman}{}{%
  \addto\captionsngerman{% 
    \renewcommand*{\glossaryname}{Glossar}%
    \renewcommand*{\acronymname}{Akronyme}%
    \renewcommand*{\entryname}{Bezeichnung}%
    \renewcommand*{\descriptionname}{Beschreibung}%
    \renewcommand*{\symbolname}{Symbol}%
    \renewcommand*{\pagelistname}{Seiten}%
    \renewcommand*{\glssymbolsgroupname}{Symbole}%
    \renewcommand*{\glsnumbersgroupname}{Zahlen}} 
}
%    \end{macrocode}
% Italian:
%    \begin{macrocode}
\@ifundefined{captionsitalian}{}{%
  \addto\captionsitalian{%
    \renewcommand*{\glossaryname}{Glossario}%
    \renewcommand*{\acronymname}{Acronimi}%
    \renewcommand*{\entryname}{Nomenclatura}%
    \renewcommand*{\descriptionname}{Descrizione}%
    \renewcommand*{\symbolname}{Simbolo}%
    \renewcommand*{\pagelistname}{Elenco delle pagine}%
    \renewcommand*{\glssymbolsgroupname}{Simboli}%
    \renewcommand*{\glsnumbersgroupname}{Numeri}} 
}
%    \end{macrocode}
% Dutch:
%    \begin{macrocode}
\@ifundefined{captionsdutch}{}{%
  \addto\captionsdutch{%
    \renewcommand*{\glossaryname}{Woordenlijst}%
    \renewcommand*{\acronymname}{Acroniemen}%
    \renewcommand*{\entryname}{Benaming}%
    \renewcommand*{\descriptionname}{Beschrijving}%
    \renewcommand*{\symbolname}{Symbool}%
    \renewcommand*{\pagelistname}{Pagina's}%
    \renewcommand*{\glssymbolsgroupname}{Symbolen}%
    \renewcommand*{\glsnumbersgroupname}{Cijfers}} 
}
%    \end{macrocode}
% Spanish:
%    \begin{macrocode}
\@ifundefined{captionsspanish}{}{%
  \addto\captionsspanish{%
    \renewcommand*{\glossaryname}{Glosario}%
    \renewcommand*{\acronymname}{Siglas}%
    \renewcommand*{\entryname}{Entrada}%
    \renewcommand*{\descriptionname}{Descripci\'on}%
    \renewcommand*{\symbolname}{S\'{\i}mbolo}%
    \renewcommand*{\pagelistname}{Lista de p\'aginas}%
    \renewcommand*{\glssymbolsgroupname}{S\'{\i}mbolos}%
    \renewcommand*{\glsnumbersgroupname}{N\'umeros}} 
}
%    \end{macrocode}
% French:
%    \begin{macrocode}
\@ifundefined{captionsfrench}{}{%
  \addto\captionsfrench{%
    \renewcommand*{\glossaryname}{Glossaire}%
    \renewcommand*{\acronymname}{Acronymes}%
    \renewcommand*{\entryname}{Terme}%
    \renewcommand*{\descriptionname}{Description}%
    \renewcommand*{\symbolname}{Symbole}%
    \renewcommand*{\pagelistname}{Pages}%
    \renewcommand*{\glssymbolsgroupname}{Symboles}%
    \renewcommand*{\glsnumbersgroupname}{Nombres}} 
}
\@ifundefined{captionsfrenchb}{}{%
  \addto\captionsfrenchb{%
    \renewcommand*{\glossaryname}{Glossaire}%
    \renewcommand*{\acronymname}{Acronymes}%
    \renewcommand*{\entryname}{Terme}%
    \renewcommand*{\descriptionname}{Description}%
    \renewcommand*{\symbolname}{Symbole}%
    \renewcommand*{\pagelistname}{Pages}%
    \renewcommand*{\glssymbolsgroupname}{Symboles}%
    \renewcommand*{\glsnumbersgroupname}{Nombres}} 
}
\@ifundefined{captionsfrancais}{}{%
  \addto\captionsfrancais{%
    \renewcommand*{\glossaryname}{Glossaire}%
    \renewcommand*{\acronymname}{Acronymes}%
    \renewcommand*{\entryname}{Terme}%
    \renewcommand*{\descriptionname}{Description}%
    \renewcommand*{\symbolname}{Symbole}%
    \renewcommand*{\pagelistname}{Pages}%
    \renewcommand*{\glssymbolsgroupname}{Symboles}%
    \renewcommand*{\glsnumbersgroupname}{Nombres}} 
}
%    \end{macrocode}
% Danish:
%    \begin{macrocode}
\@ifundefined{captionsdanish}{}{%
  \addto\captionsdanish{%
    \renewcommand*{\glossaryname}{Ordliste}%
    \renewcommand*{\acronymname}{Akronymer}%
    \renewcommand*{\entryname}{Symbolforklaring}%
    \renewcommand*{\descriptionname}{Beskrivelse}%
    \renewcommand*{\symbolname}{Symbol}%
    \renewcommand*{\pagelistname}{Side}%
    \renewcommand*{\glssymbolsgroupname}{Symboler}%
    \renewcommand*{\glsnumbersgroupname}{Tal}} 
}
%    \end{macrocode}
% Irish:
%    \begin{macrocode}
\@ifundefined{captionsirish}{}{%
  \addto\captionsirish{%
    \renewcommand*{\glossaryname}{Gluais}%
    \renewcommand*{\acronymname}{Acrainmneacha}%
%    \end{macrocode}
% wasn't sure whether to go for N\'ota (Note), Ciall (`Meaning',
% `sense') or Br\'{\i} (`Meaning'). In the end I chose Ciall.
%    \begin{macrocode}
    \renewcommand*{\entryname}{Ciall}%
    \renewcommand*{\descriptionname}{Tuairisc}%
%    \end{macrocode}
% Again, not sure whether to use Comhartha/Comhartha\'{\i} or
% Siombail/Siombaile, so have chosen the former.
%    \begin{macrocode}
    \renewcommand*{\symbolname}{Comhartha}%
    \renewcommand*{\glssymbolsgroupname}{Comhartha\'{\i}}%
    \renewcommand*{\pagelistname}{Leathanaigh}%
    \renewcommand*{\glsnumbersgroupname}{Uimhreacha}} 
}
%    \end{macrocode}
% Hungarian:
%    \begin{macrocode}
\@ifundefined{captionsmagyar}{}{%
  \addto\captionsmagyar{%
    \renewcommand*{\glossaryname}{Sz\'ojegyz\'ek}%
    \renewcommand*{\acronymname}{Bet\H uszavak}%
    \renewcommand*{\entryname}{Kifejez\'es}%
    \renewcommand*{\descriptionname}{Magyar\'azat}%
    \renewcommand*{\symbolname}{Jel\"ol\'es}%
    \renewcommand*{\pagelistname}{Oldalsz\'am}%
    \renewcommand*{\glssymbolsgroupname}{Jelek}%
    \renewcommand*{\glsnumbersgroupname}{Sz\'amjegyek}%
  }
}
\@ifundefined{captionshungarian}{}{%
  \addto\captionshungarian{%
    \renewcommand*{\glossaryname}{Sz\'ojegyz\'ek}%
    \renewcommand*{\acronymname}{Bet\H uszavak}%
    \renewcommand*{\entryname}{Kifejez\'es}%
    \renewcommand*{\descriptionname}{Magyar\'azat}%
    \renewcommand*{\symbolname}{Jel\"ol\'es}%
    \renewcommand*{\pagelistname}{Oldalsz\'am}%
    \renewcommand*{\glssymbolsgroupname}{Jelek}%
    \renewcommand*{\glsnumbersgroupname}{Sz\'amjegyek}%
  }
}
%    \end{macrocode}
% Polish
% \changes{1.13}{2008 May 10}{Add Polish support}
%    \begin{macrocode}
\@ifundefined{captionspolish}{}{%
  \addto\captionspolish{%
    \renewcommand*{\glossaryname}{S{\l}ownik termin\'ow}%
    \renewcommand*{\acronymname}{Skr\'ot}%
    \renewcommand*{\entryname}{Termin}%
    \renewcommand*{\descriptionname}{Opis}%
    \renewcommand*{\symbolname}{Symbol}%
    \renewcommand*{\pagelistname}{Strony}%
    \renewcommand*{\glssymbolsgroupname}{Symbole}%
    \renewcommand*{\glsnumbersgroupname}{Liczby}}
}
%    \end{macrocode}
% Brazilian
%\changes{1.17}{2008 December 11}{Added Brazilian support}
%    \begin{macrocode}
\@ifundefined{captionsbrazil}{}{%
  \addto\captionsbrazil{%
    \renewcommand*{\glossaryname}{Gloss\'ario}%
    \renewcommand*{\acronymname}{Siglas}%
    \renewcommand*{\entryname}{Nota\c c\~ao}%
    \renewcommand*{\descriptionname}{Descri\c c\~ao}%
    \renewcommand*{\symbolname}{S\'imbolo}%
    \renewcommand*{\pagelistname}{Lista de P\'aginas}%
    \renewcommand*{\glssymbolsgroupname}{S\'imbolos}%
    \renewcommand*{\glsnumbersgroupname}{N\'umeros}%
  }%
}
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-babel.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-polyglossia.sty>
%    \end{macrocode}
%\fi
%\subsection{Polyglossia Captions}
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{glossaries-polyglossia}[2009/11/09 v1.0 (NLCT)]
%    \end{macrocode}
% English:
%    \begin{macrocode}
\@ifundefined{captionsenglish}{}{%
  \expandafter\toks@\expandafter{\captionsenglish
    \renewcommand*{\glossaryname}{\textenglish{Glossary}}%
    \renewcommand*{\acronymname}{\textenglish{Acronyms}}%
    \renewcommand*{\entryname}{\textenglish{Notation}}%
    \renewcommand*{\descriptionname}{\textenglish{Description}}%
    \renewcommand*{\symbolname}{\textenglish{Symbol}}%
    \renewcommand*{\pagelistname}{\textenglish{Page List}}%
    \renewcommand*{\glssymbolsgroupname}{\textenglish{Symbols}}%
    \renewcommand*{\glsnumbersgroupname}{\textenglish{Numbers}}%
  }%
  \edef\captionsenglish{\the\toks@}%
}
%    \end{macrocode}
% German:
%    \begin{macrocode}
\@ifundefined{captionsgerman}{}{%
  \expandafter\toks@\expandafter{\captionsgerman
    \renewcommand*{\glossaryname}{\textgerman{Glossar}}%
    \renewcommand*{\acronymname}{\textgerman{Akronyme}}%
    \renewcommand*{\entryname}{\textgerman{Bezeichnung}}%
    \renewcommand*{\descriptionname}{\textgerman{Beschreibung}}%
    \renewcommand*{\symbolname}{\textgerman{Symbol}}%
    \renewcommand*{\pagelistname}{\textgerman{Seiten}}%
    \renewcommand*{\glssymbolsgroupname}{\textgerman{Symbole}}%
    \renewcommand*{\glsnumbersgroupname}{\textgerman{Zahlen}}%
  }% 
  \edef\captionsgerman{\the\toks@}%
}
%    \end{macrocode}
% Italian:
%    \begin{macrocode}
\@ifundefined{captionsitalian}{}{%
  \expandafter\toks@\expandafter{\captionsitalian
    \renewcommand*{\glossaryname}{\textitalian{Glossario}}%
    \renewcommand*{\acronymname}{\textitalian{Acronimi}}%
    \renewcommand*{\entryname}{\textitalian{Nomenclatura}}%
    \renewcommand*{\descriptionname}{\textitalian{Descrizione}}%
    \renewcommand*{\symbolname}{\textitalian{Simbolo}}%
    \renewcommand*{\pagelistname}{\textitalian{Elenco delle pagine}}%
    \renewcommand*{\glssymbolsgroupname}{\textitalian{Simboli}}%
    \renewcommand*{\glsnumbersgroupname}{\textitalian{Numeri}}%
  }%
  \edef\captionsitalian{\the\toks@}% 
}
%    \end{macrocode}
% Dutch:
%    \begin{macrocode}
\@ifundefined{captionsdutch}{}{%
  \expandafter\toks@\expandafter{\captionsdutch
    \renewcommand*{\glossaryname}{\textdutch{Woordenlijst}}%
    \renewcommand*{\acronymname}{\textdutch{Acroniemen}}%
    \renewcommand*{\entryname}{\textdutch{Benaming}}%
    \renewcommand*{\descriptionname}{\textdutch{Beschrijving}}%
    \renewcommand*{\symbolname}{\textdutch{Symbool}}%
    \renewcommand*{\pagelistname}{\textdutch{Pagina's}}%
    \renewcommand*{\glssymbolsgroupname}{\textdutch{Symbolen}}%
    \renewcommand*{\glsnumbersgroupname}{\textdutch{Cijfers}}%
  }%
  \edef\captionsdutch{\the\toks@}%
}
%    \end{macrocode}
% Spanish:
%    \begin{macrocode}
\@ifundefined{captionsspanish}{}{%
  \expandafter\toks@\expandafter{\captionsspanish
    \renewcommand*{\glossaryname}{\textspanish{Glosario}}%
    \renewcommand*{\acronymname}{\textspanish{Siglas}}%
    \renewcommand*{\entryname}{\textspanish{Entrada}}%
    \renewcommand*{\descriptionname}{\textspanish{Descripci\'on}}%
    \renewcommand*{\symbolname}{\textspanish{S\'{\i}mbolo}}%
    \renewcommand*{\pagelistname}{\textspanish{Lista de p\'aginas}}%
    \renewcommand*{\glssymbolsgroupname}{\textspanish{S\'{\i}mbolos}}%
    \renewcommand*{\glsnumbersgroupname}{\textspanish{N\'umeros}}%
  }%
  \edef\captionsspanish{\the\toks@}%
}
%    \end{macrocode}
% French:
%    \begin{macrocode}
\@ifundefined{captionsfrench}{}{%
  \expandafter\toks@\expandafter{\captionsfrench
    \renewcommand*{\glossaryname}{\textfrench{Glossaire}}%
    \renewcommand*{\acronymname}{\textfrench{Acronymes}}%
    \renewcommand*{\entryname}{\textfrench{Terme}}%
    \renewcommand*{\descriptionname}{\textfrench{Description}}%
    \renewcommand*{\symbolname}{\textfrench{Symbole}}%
    \renewcommand*{\pagelistname}{\textfrench{Pages}}%
    \renewcommand*{\glssymbolsgroupname}{\textfrench{Symboles}}%
    \renewcommand*{\glsnumbersgroupname}{\textfrench{Nombres}}%
  }%
  \edef\captionsfrench{\the\toks@}% 
}
%    \end{macrocode}
% Danish:
%    \begin{macrocode}
\@ifundefined{captionsdanish}{}{%
  \expandafter\toks@\expandafter{\captionsdanish
    \renewcommand*{\glossaryname}{\textdanish{Ordliste}}%
    \renewcommand*{\acronymname}{\textdanish{Akronymer}}%
    \renewcommand*{\entryname}{\textdanish{Symbolforklaring}}%
    \renewcommand*{\descriptionname}{\textdanish{Beskrivelse}}%
    \renewcommand*{\symbolname}{\textdanish{Symbol}}%
    \renewcommand*{\pagelistname}{\textdanish{Side}}%
    \renewcommand*{\glssymbolsgroupname}{\textdanish{Symboler}}%
    \renewcommand*{\glsnumbersgroupname}{\textdanish{Tal}}%
  }%
  \edef\captionsdanish{\the\toks@}%
}
%    \end{macrocode}
% Irish:
%    \begin{macrocode}
\@ifundefined{captionsirish}{}{%
  \expandafter\toks@\expandafter{\captionsirish
    \renewcommand*{\glossaryname}{\textirish{Gluais}}%
    \renewcommand*{\acronymname}{\textirish{Acrainmneacha}}%
    \renewcommand*{\entryname}{\textirish{Ciall}}%
    \renewcommand*{\descriptionname}{\textirish{Tuairisc}}%
    \renewcommand*{\symbolname}{\textirish{Comhartha}}%
    \renewcommand*{\glssymbolsgroupname}{\textirish{Comhartha\'{\i}}}%
    \renewcommand*{\pagelistname}{\textirish{Leathanaigh}}%
    \renewcommand*{\glsnumbersgroupname}{\textirish{Uimhreacha}}%
  }%
  \edef\captionsirish{\the\toks@}%
}
%    \end{macrocode}
% Hungarian:
%    \begin{macrocode}
\@ifundefined{captionsmagyar}{}{%
  \expandafter\toks@\expandafter{\captionsmagyar
    \renewcommand*{\glossaryname}{\textmagyar{Sz\'ojegyz\'ek}}%
    \renewcommand*{\acronymname}{\textmagyar{Bet\H uszavak}}%
    \renewcommand*{\entryname}{\textmagyar{Kifejez\'es}}%
    \renewcommand*{\descriptionname}{\textmagyar{Magyar\'azat}}%
    \renewcommand*{\symbolname}{\textmagyar{Jel\"ol\'es}}%
    \renewcommand*{\pagelistname}{\textmagyar{Oldalsz\'am}}%
    \renewcommand*{\glssymbolsgroupname}{\textmagyar{Jelek}}%
    \renewcommand*{\glsnumbersgroupname}{\textmagyar{Sz\'amjegyek}}%
  }%
  \edef\captionsmagyar{\the\toks@}%
}
%    \end{macrocode}
% Polish
% \changes{1.13}{2008 May 10}{Add Polish support}
%    \begin{macrocode}
\@ifundefined{captionspolish}{}{%
  \expandafter\toks@\expandafter{\captionspolish
    \renewcommand*{\glossaryname}{\textpolish{S{\l}ownik termin\'ow}}%
    \renewcommand*{\acronymname}{\textpolish{Skr\'ot}}%
    \renewcommand*{\entryname}{\textpolish{Termin}}%
    \renewcommand*{\descriptionname}{\textpolish{Opis}}%
    \renewcommand*{\symbolname}{\textpolish{Symbol}}%
    \renewcommand*{\pagelistname}{\textpolish{Strony}}%
    \renewcommand*{\glssymbolsgroupname}{\textpolish{Symbole}}%
    \renewcommand*{\glsnumbersgroupname}{\textpolish{Liczby}}%
  }%
  \edef\captionspolish{\the\toks@}%
}
%    \end{macrocode}
% Portugues
%    \begin{macrocode}
\@ifundefined{captionsportuges}{}{%
  \expandafter\toks@\expandafter{\captionsportuges
    \renewcommand*{\glossaryname}{\textportuges{Gloss\'ario}}%
    \renewcommand*{\acronymname}{\textportuges{Siglas}}%
    \renewcommand*{\entryname}{\textportuges{Nota\c c\~ao}}%
    \renewcommand*{\descriptionname}{\textportuges{Descri\c c\~ao}}%
    \renewcommand*{\symbolname}{\textportuges{S\'imbolo}}%
    \renewcommand*{\pagelistname}{\textportuges{Lista de P\'aginas}}%
    \renewcommand*{\glssymbolsgroupname}{\textportuges{S\'imbolos}}%
    \renewcommand*{\glsnumbersgroupname}{\textportuges{N\'umeros}}%
  }%
  \edef\captionsportuges{\the\toks@}%
}
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-polyglossia.sty>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-dictionary-Brazilian.dict>
%    \end{macrocode}
%\fi
%\subsection{Brazilian Dictionary}
% This is a dictionary file provided by Thiago de~Melo for
% use with the \isty{translator} package.
%\changes{1.17}{2008 November 17}{added Brazilian dictionary}
%\changes{2.02}{2009 July 13}{Changed Brazil to Brazilian}
%    \begin{macrocode}
\ProvidesDictionary{glossaries-dictionary}{Brazilian}
%    \end{macrocode}
% Provide Brazilian translations:
%    \begin{macrocode}
\providetranslation{Glossary}{Gloss\'ario}
\providetranslation{Acronyms}{Siglas}
\providetranslation{Notation (glossaries)}{Nota\c c\~ao}
\providetranslation{Description (glossaries)}{Descri\c c\~ao}
\providetranslation{Symbol (glossaries)}{S\'imbolo}
\providetranslation{Page List (glossaries)}{Lista de P\'aginas}
\providetranslation{Symbols (glossaries)}{S\'imbolos}
\providetranslation{Numbers (glossaries)}{N\'umeros}
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-dictionary-Brazilian.dict>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-dictionary-Danish.dict>
%    \end{macrocode}
%\fi
%\subsection{Danish Dictionary}
% This is a dictionary file provided for use with the \isty{translator}
% package.
%    \begin{macrocode}
\ProvidesDictionary{glossaries-dictionary}{Danish}
%    \end{macrocode}
% Provide Danish translations:
%    \begin{macrocode}
\providetranslation{Glossary}{Ordliste}
\providetranslation{Acronyms}{Akronymer}
\providetranslation{Notation (glossaries)}{Symbolforklaring}
\providetranslation{Description (glossaries)}{Beskrivelse}
\providetranslation{Symbol (glossaries)}{Symbol}
\providetranslation{Page List (glossaries)}{Side}
\providetranslation{Symbols (glossaries)}{Symboler}
\providetranslation{Numbers (glossaries)}{Tal}
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-dictionary-Danish.dict>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-dictionary-Dutch.dict>
%    \end{macrocode}
%\fi
%\subsection{Dutch Dictionary}
% This is a dictionary file provided for use with the \isty{translator}
% package.
%    \begin{macrocode}
\ProvidesDictionary{glossaries-dictionary}{Dutch}
%    \end{macrocode}
% Provide Dutch translations:
%    \begin{macrocode}
\providetranslation{Glossary}{Woordenlijst}
\providetranslation{Acronyms}{Acroniemen}
\providetranslation{Notation (glossaries)}{Benaming}
\providetranslation{Description (glossaries)}{Beschrijving}
\providetranslation{Symbol (glossaries)}{Symbool}
\providetranslation{Page List (glossaries)}{Pagina's}
\providetranslation{Symbols (glossaries)}{Symbolen}
\providetranslation{Numbers (glossaries)}{Cijfers}
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-dictionary-Dutch.dict>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-dictionary-English.dict>
%    \end{macrocode}
%\fi
%\subsection{English Dictionary}
% This is a dictionary file provided for use with the \isty{translator}
% package.
%    \begin{macrocode}
\ProvidesDictionary{glossaries-dictionary}{English}
%    \end{macrocode}
% Provide English translations:
%    \begin{macrocode}
\providetranslation{Glossary}{Glossary}
\providetranslation{Acronyms}{Acronyms}
\providetranslation{Notation (glossaries)}{Notation}
\providetranslation{Description (glossaries)}{Description}
\providetranslation{Symbol (glossaries)}{Symbol}
\providetranslation{Page List (glossaries)}{Page List}
\providetranslation{Symbols (glossaries)}{Symbols}
\providetranslation{Numbers (glossaries)}{Numbers}
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-dictionary-English.dict>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-dictionary-French.dict>
%    \end{macrocode}
%\fi
%\subsection{French Dictionary}
% This is a dictionary file provided for use with the \isty{translator}
% package.
%    \begin{macrocode}
\ProvidesDictionary{glossaries-dictionary}{French}
%    \end{macrocode}
% Provide French translations:
%    \begin{macrocode}
\providetranslation{Glossary}{Glossaire}
\providetranslation{Acronyms}{Acronymes}
\providetranslation{Notation (glossaries)}{Terme}
\providetranslation{Description (glossaries)}{Description}
\providetranslation{Symbol (glossaries)}{Symbole}
\providetranslation{Page List (glossaries)}{Pages}
\providetranslation{Symbols (glossaries)}{Symboles}
\providetranslation{Numbers (glossaries)}{Nombres}
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-dictionary-French.dict>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-dictionary-German.dict>
%    \end{macrocode}
%\fi
%\subsection{German Dictionary}
% This is a dictionary file provided for use with the \isty{translator}
% package.
%    \begin{macrocode}
\ProvidesDictionary{glossaries-dictionary}{German}
%    \end{macrocode}
% Provide German translations (quite a few variations were suggested
% for German; I settled on the following):
%    \begin{macrocode}
\providetranslation{Glossary}{Glossar}
\providetranslation{Acronyms}{Akronyme}
\providetranslation{Notation (glossaries)}{Bezeichnung}
\providetranslation{Description (glossaries)}{Beschreibung}
\providetranslation{Symbol (glossaries)}{Symbol}
\providetranslation{Page List (glossaries)}{Seiten}
\providetranslation{Symbols (glossaries)}{Symbole}
\providetranslation{Numbers (glossaries)}{Zahlen}
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-dictionary-German.dict>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-dictionary-Irish.dict>
%    \end{macrocode}
%\fi
%\subsection{Irish Dictionary}
% This is a dictionary file provided for use with the \isty{translator}
% package.
%    \begin{macrocode}
\ProvidesDictionary{glossaries-dictionary}{Irish}
%    \end{macrocode}
% Provide Irish translations:
%    \begin{macrocode}
\providetranslation{Glossary}{Gluais}
\providetranslation{Acronyms}{Acrainmneacha}
\providetranslation{Notation (glossaries)}{Ciall}
\providetranslation{Description (glossaries)}{Tuairisc}
\providetranslation{Symbol (glossaries)}{Comhartha}
\providetranslation{Page List (glossaries)}{Leathanaigh}
\providetranslation{Symbols (glossaries)}{Comhartha\'{\i}}
\providetranslation{Numbers (glossaries)}{Uimhreacha}
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-dictionary-Irish.dict>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-dictionary-Italian.dict>
%    \end{macrocode}
%\fi
%\subsection{Italian Dictionary}
% This is a dictionary file provided for use with the \isty{translator}
% package.
%    \begin{macrocode}
\ProvidesDictionary{glossaries-dictionary}{Italian}
%    \end{macrocode}
% Provide Italian translations:
%    \begin{macrocode}
\providetranslation{Glossary}{Glossario}
\providetranslation{Acronyms}{Acronimi}
\providetranslation{Notation (glossaries)}{Nomenclatura}
\providetranslation{Description (glossaries)}{Descrizione}
\providetranslation{Symbol (glossaries)}{Simbolo}
\providetranslation{Page List (glossaries)}{Elenco delle pagine}
\providetranslation{Symbols (glossaries)}{Simboli}
\providetranslation{Numbers (glossaries)}{Numeri}
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-dictionary-Italian.dict>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-dictionary-Magyar.dict>
%    \end{macrocode}
%\fi
%\subsection{Magyar Dictionary}
% This is a dictionary file provided for use with the \isty{translator}
% package.
%    \begin{macrocode}
\ProvidesDictionary{glossaries-dictionary}{Magyar}
%    \end{macrocode}
% Provide translations:
%    \begin{macrocode}
\providetranslation{Glossary}{Sz\'ojegyz\'ek}
\providetranslation{Acronyms}{Bet\H uszavak}
\providetranslation{Notation (glossaries)}{Kifejez\'es}
\providetranslation{Description (glossaries)}{Magyar\'azat}
\providetranslation{Symbol (glossaries)}{Jel\"ol\'es}
\providetranslation{Page List (glossaries)}{Oldalsz\'am}
\providetranslation{Symbols (glossaries)}{Jelek}
\providetranslation{Numbers (glossaries)}{Sz\'amjegyek}
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-dictionary-Magyar.dict>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-dictionary-Polish.dict>
%    \end{macrocode}
%\fi
%\subsection{Polish Dictionary}
% This is a dictionary file provided for use with the \isty{translator}
% package.
%    \begin{macrocode}
\ProvidesDictionary{glossaries-dictionary}{Polish}
%    \end{macrocode}
% Provide Polish translations:
%    \begin{macrocode}
\providetranslation{Glossary}{S{\l}ownik termin\'ow}
\providetranslation{Acronyms}{Skr\'ot}
\providetranslation{Notation (glossaries)}{Termin}
\providetranslation{Description (glossaries)}{Opis}
\providetranslation{Symbol (glossaries)}{Symbol}
\providetranslation{Page List (glossaries)}{Strony}
\providetranslation{Symbols (glossaries)}{Symbole}
\providetranslation{Numbers (glossaries)}{Liczby}
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-dictionary-Polish.dict>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-dictionary-Serbian.dict>
%    \end{macrocode}
%\fi
%\subsection{Serbian Dictionary}
% This dictionary was provided by Zoran Filipovic.
%    \begin{macrocode}
\ProvidesDictionary{glossaries-dictionary}{Serbian}
\providetranslation{Glossary}{Mali re\v cnik}
\providetranslation{Acronyms}{Skra\' cenice}
\providetranslation{Notation (glossaries)}{Oznaka}
\providetranslation{Description (glossaries)}{Opis}
\providetranslation{Symbol (glossaries)}{Simbol}
\providetranslation{Page List (glossaries)}{Stranica}
\providetranslation{Symbols (glossaries)}{Simboli}
\providetranslation{Numbers (glossaries)}{Brojevi}
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-dictionary-Serbian.dict>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries-dictionary-Spanish.dict>
%    \end{macrocode}
%\fi
%\subsection{Spanish Dictionary}
% This is a dictionary file provided for use with the \isty{translator}
% package.
%    \begin{macrocode}
\ProvidesDictionary{glossaries-dictionary}{Spanish}
%    \end{macrocode}
% Provide Spanish translations:
%    \begin{macrocode}
\providetranslation{Glossary}{Glosario}
\providetranslation{Acronyms}{Siglas}
\providetranslation{Notation (glossaries)}{Entrada}
\providetranslation{Description (glossaries)}{Descripci\'on}
\providetranslation{Symbol (glossaries)}{S\'{\i}mbolo}
\providetranslation{Page List (glossaries)}{Lista de p\'aginas}
\providetranslation{Symbols (glossaries)}{S\'{\i}mbolos}
\providetranslation{Numbers (glossaries)}{N\'umeros}
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</glossaries-dictionary-Spanish.dict>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*minimalgls.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
 % This is a minimal file for testing and debugging 
 % the glossaries package. Change the class file as 
 % desired, and add the relevant package options to
 % both the class file and the glossaries package.
 % Change the sample glossary entry and acronym if
 % required. If the problem occurs with an additional
 % glossary, add in the relevant \newglossary command
 % and a sample entry.
 %
 % Only add extra packages or commands if they 
 % contribute to whatever problem you are trying to
 % test.
 %
 % Remember that the document will not be complete
 % until you have successfully completed all of the
 % following steps:
 % 1. latex minimalgls
 % 2. makeglossaries minimalgls (note no extension)
 % 3. latex minimalgls
 % A further run through LaTeX will be required to ensure that
 % the table of contents is up to date if the toc option
 % is used.
\documentclass{article}
\listfiles

\usepackage[colorlinks]{hyperref}
 \usepackage{glossaries} % acronym will go in main glossary
 %\usepackage[acronym]{glossaries} % make a separate list of acronyms

\makeglossaries

\newglossaryentry{sample}{name={sample},
description={a sample entry}}

% This contrived acronym has non-standard plural forms.
% These are specified in the optional argument.
\newacronym[\glsshortpluralkey=cas,\glslongpluralkey=contrived 
acronyms]{aca}{aca}{a contrived acronym}

\begin{document}
A \gls{sample} entry and \gls{aca}. Second use: \gls{aca}.

Plurals: \glspl{sample}. Reset acronym\glsreset{aca}.
First use: \glspl{aca}. Second use: \glspl{aca}.

\printglossaries
\end{document}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</minimalgls.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*sample-custom-acronym.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
\documentclass{report}

\usepackage[colorlinks]{hyperref}
\usepackage[acronym,         % create list of acronyms
            nomain,          % don't need main glossary for this example
            style=tree,      % need a style that displays the symbol
            hyperfirst=false,% don't hyperlink first use
            sanitize=none    % switch off sanitization as description 
                             % will be used in the main text
            ]{glossaries}

\makeglossaries

  % This is a sample file to illustrate how to define a custom
  % acronym. This example defines the acronym so that on first use
  % it displays the short form in the text and places the long form
  % and its description in a footnote. In the main body of the
  % document the short form will be displayed in small caps, but in
  % the list of acronyms the short form is displayed in normal
  % capitals. To ensure this, the short form should be written in
  % lower case when the acronym is defined, and \MakeUppercase is
  % used when it's displayed in the list of acronyms.

  % In the list of acronyms, the long form is used as the name, the
  % short form is used as the symbol and the user supplies the
  % description when defining the acronym.

\renewcommand*{\CustomAcronymFields}{%
  name={\the\glslongtok},%
  symbol={\MakeUppercase{\the\glsshorttok}},%
  text={\textsc{\the\glsshorttok}},%
  plural={\textsc{\the\glsshorttok}\noexpand\acrpluralsuffix}%
}

\renewcommand*{\SetCustomDisplayStyle}[1]{%
  % ##1 corresponds to the 'first' key
  % ##2 corresponds to the 'description' key
  % ##3 corresponds to the 'symbol' key
  % ##4 is the inserted text given by the final optional argument to
  % commands like \gls
  % The short form can be obtained via \glsentryuseri{\glslabel}
  % The plural short form can be obtained via
  % \glsentryuserii{\glslabel}
  % The long form can be obtained via \glsentryuseriii{\glslabel}
  % The plural long form can be obtained via
  % \glsentryuseriv{\glslabel}
  \defglsdisplayfirst[#1]{##1##4\protect\footnote{%
    \glsentryuseriii{\glslabel}: ##2}}%
  % ##1 corresponds to the 'text' key
  % the rest as above
  \defglsdisplay[#1]{##1##4}%
}

 % Now set the custom acronym style (to override the default style)
\SetCustomStyle

 % Now define the acronyms (must be done after setting the custom
 % style)

\newacronym[description={set of tags for use in developing hypertext
documents}]{html}{html}{Hyper Text Markup Language}

\newacronym[description={language used to describe the layout of a
document written in a markup language}]{css}{css}{Cascading Style
Sheet}

\begin{document}

\gls{css}. \gls{html}.

\gls{css}. \gls{html}.

\printglossaries
\end{document}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</sample-custom-acronym.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*sample.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
\documentclass[a4paper]{report}

\usepackage[plainpages=false,colorlinks]{hyperref}
\usepackage[toc,style=treenoname,order=word,acronym]{glossaries}

\makeglossaries

\newglossaryentry{glossary}{name=glossary,
description={\nopostdesc},
plural={glossaries}}

\newglossaryentry{glossarylist}{
description={1) list of technical words},
sort={1},
parent={glossary}}

\newglossaryentry{glossarycol}{
description={2) collection of glosses},
sort={2},
parent={glossary}}

\newglossaryentry{Perl}{name=\texttt{Perl},
sort=Perl, % need a sort key because name contains a command
description=A scripting language}

\newglossaryentry{pagelist}{name=page list,
 % description value has to be enclosed in braces
 % because it contains commas
description={a list of individual pages or page ranges 
(e.g.\ 1,2,4,7-9)}}

\newglossaryentry{mtrx}{name=matrix,
description={rectangular array of quantities},
 % plural is not simply obtained by appending an s, so specify
plural=matrices}

 % entry with a paragraph break in the description

\newglossaryentry{par}{name=paragraph,
description={distinct section of piece of 
writing.\glspar Beginning on new, usually indented, line}}

 % entry with two types of plural. Set the plural form to the 
 % form most likely to be used. If you want to use a different
 % plural, you will need to explicity specify it in \glslink
\newglossaryentry{cow}{name=cow,
 % this isn't necessary, as this form (appending an s) is
 % the default
plural=cows,
 % description:
description={(\emph{pl.}\ cows, \emph{archaic} kine) an adult
female of any bovine animal}}

\newglossaryentry{bravo}{name={bravo},
description={\nopostdesc}}

\newglossaryentry{bravo1}{description={1) cry of approval (pl.\ bravos)},
sort={1},
plural={bravos},
parent=bravo}

\newglossaryentry{bravo2}{description={2) hired ruffian or killer (pl.\ bravoes)},
sort={2},
plural={bravoes},
parent=bravo}

\newglossaryentry{seal}{name=seal,description={sea mammal with
flippers that eats fish}}

\newglossaryentry{sealion}{name={sea lion},
description={large seal}}

\begin{document}

\title{Sample Document Using glossary Package}
\author{Nicola Talbot}
\pagenumbering{alph}% prevent duplicate page link names if using PDF
\maketitle

\pagenumbering{roman}
\tableofcontents

\chapter{Introduction}
\pagenumbering{arabic}

A \gls{glossarylist} is a very useful addition to any
technical document, although a \gls{glossarycol} can 
also simply be a collection of glosses, which is
another thing entirely. Some documents have
multiple \glspl{glossarylist}.

Once you have run your document through \LaTeX, you
will then need to run the \texttt{.glo} file through
\texttt{makeindex}.  You will need to set the output
file so that it creates a \texttt{.gls} file instead
of an \texttt{.ind} file, and change the name of 
the log file so that it doesn't overwrite the index
log file (if you have an index for your document).  
Rather than having to remember all the command line
switches, you can call the \gls{Perl} script
\texttt{makeglossaries} which provides a convenient
wrapper.

If a comma appears within the name or description, grouping
must be used, e.g.\ in the description of \gls{pagelist}.

\chapter{Plurals and Paragraphs}

Plurals are assumed to have the letter s appended, but if this is
not the case, as in \glspl{mtrx}, then you need to specify the
plural when you define the entry. If a term may have multiple
plurals (for example \glspl{cow}/\glslink{cow}{kine}) then 
define the entry with the plural form most likely to be used and
explicitly specify the alternative form using \verb|\glslink|.
\Glspl{seal} and \glspl{sealion} have regular plural forms.

\Gls{bravo} is a homograph, but the plural forms are spelt
differently. The plural of \gls{bravo1}, a cry of approval, 
is \glspl{bravo1}, whereas the plural of \gls{bravo2}, a hired
ruffian or killer, is \glspl{bravo2}.

\Glspl{par} can cause a problem in commands, so care is needed
when having a paragraph break in a \gls{glossarylist} entry.

\chapter{Ordering}

There are two types of ordering: word ordering (which places
``\gls{sealion}'' before ``\gls{seal}'') and letter ordering
(which places ``\gls{seal}'' before ``\gls{sealion}'').

\printglossaries

\end{document}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</sample.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*sample4col.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
\documentclass[a4paper]{article}

\usepackage[style=long4colheaderborder]{glossaries}

\makeglossaries

\newglossaryentry{w}{name={$w$},
sort=w,
description={width},
symbol=m}

\newglossaryentry{M}{name={$M$},
sort=M,
description={mass},
symbol=kg}

\begin{document}

\printglossaries

The width, \gls{w}, is measured in meters. The mass, \gls{M} is
measured in kilograms.

\end{document}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</sample4col.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*sampleaccsupp.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
\documentclass{article}

\usepackage[acronym,smallcaps]{glossaries-accsupp}

\makeglossaries

\newglossaryentry{dr}{name=Dr,description={Doctor},access={Doctor}}

\newacronym[\glsshortaccesskey=S V M]{svm}{svm}{support vector machine}

\newacronym{eg}{e.g.}{for example}

\begin{document}
\gls{dr}~Jones.
\gls{dr}~Jones.

\Gls{eg}, \gls{eg}

\gls{svm}. \gls{svm}.

\printglossaries
\end{document}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</sampleaccsupp.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*sampleAcr.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
\documentclass[a4paper]{report}

\usepackage[colorlinks,plainpages=false]{hyperref}
\usepackage[style=long,toc]{glossaries}

\makeglossaries

\newacronym{svm}% label
{svm}% abbreviation
{support vector machine}% long form

\newacronym{ksvm}{ksvm}{kernel support vector machine}

\newacronym{rna}{rna}{ribonukleins\"aure}

\begin{document}
\tableofcontents

\chapter{Support Vector Machines}

\Glspl{svm} are used widely in the area of pattern recognition.

This is the text produced without a link: \glsentrytext{svm}.
This is the text produced on first use without a link:
\glsentryfirst{svm}. This is the entry's description without
a link: \glsentrydesc{svm}.

This is the entry in uppercase: \GLS{svm}.

\chapter{Kernel Support Vector Machines}

The \gls{ksvm} is \ifglsused{svm}{an}{a} \gls{svm} that uses
the so called ``kernel trick''. Plural: \glspl{ksvm}.

\glsresetall
Possessive: \gls{ksvm}['s].
Make the glossary entry number bold for this 
one \gls[format=hyperbf]{svm}.

\chapter{Another chapter}

You don't need to worry about makeindex's special characters:
\gls{rna}.

\printglossary[title={Acronyms}]

\end{document}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</sampleAcr.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*sampleAcrDesc.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
\documentclass[a4paper]{report}

\usepackage[colorlinks,plainpages=false]{hyperref}

\usepackage[style=altlist, % use altlist style
            toc, % add the glossary to the table of contents
            sanitize={description=false},% want to use description in main document
            description% acronyms have a user-supplied description
           ]{glossaries}

\makeglossaries

\newacronym[description={Statistical pattern recognition 
technique~\protect\cite{svm}}, % acronym's description
name={Support vector machine (svm)}% change the default way of displaying the entry name in the list of acronyms
]{svm}{svm}{support vector machine}

\newacronym[description={Statistical pattern recognition technique
using the ``kernel trick'' (see also \glshyperlink[SVM]{svm})},% acronym's description
name={Kernel support vector machine (ksvm)}% change the default way of displaying the entry name in the list of acronyms
]{ksvm}{ksvm}{kernel 
support vector machine}

\begin{document}
\tableofcontents

\chapter{Support Vector Machines}

The \gls{svm} is used widely in the area of pattern recognition.
 % plural form with initial letter in uppercase:
\Glspl{svm} are \ldots

This is the text produced without a link: \glsentrytext{svm}.
This is the text produced on first use without a link:
\glsentryfirst{svm}. This is the entry's description without
a link: \glsentrydesc{svm}.

This is the entry in uppercase: \GLS{svm}.

\chapter{Kernel Support Vector Machines}

The \gls{ksvm} is \ifglsused{svm}{an}{a} \gls{svm} that uses
the so called ``kernel trick''. This is the entry's description without
a link: \glsentrydesc{ksvm}.

\glsresetall
Possessive: \gls{ksvm}['s].
Make the glossary entry number bold for this 
one \gls[format=hyperbf]{svm}.

\begin{thebibliography}{1}
\bibitem{svm} \ldots
\end{thebibliography}

\printglossary

\end{document}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</sampleAcrDesc.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*sampleacronyms.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
\documentclass{article}

\usepackage[acronym,footnote,acronymlists={main,acronym2}]{glossaries}

\newglossary[alg2]{acronym2}{acr2}{acn2}{Statistical Acronyms}

\makeglossaries

% Main glossary is a list of calculus acronyms

\renewcommand{\glossaryname}{Calculus Acronyms}

\newacronym[type=main]{vc}{VC}{Vector Calculus}
\newacronym[type=main]{ftoc}{FTOC}{Fundamental Theorem of Calculus}

% "acronym" glossary is a list of computer related acronyms

\renewcommand{\acronymname}{Computer Acronyms}

\newacronym{kb}{kb}{KiloBit}
\newacronym{kB}{kB}{KiloByte}

% "acronym2" glossary is a list of statistical acronyms

\newacronym[type=acronym2]{svm}{SVM}{Support Vector Machine}

\begin{document}
\section{Sample Section}
\gls{kb}. \gls{kB}. \gls{vc}. \gls{ftoc}. \gls{svm}.

\gls{kb}. \gls{kB}. \gls{vc}. \gls{ftoc}. \gls{svm}.

\printglossaries
\end{document}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</sampleacronyms.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*sampleDB.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
\documentclass{article}

\usepackage[colorlinks,plainpages=false]{hyperref}
\usepackage[nonumberlist]{glossaries}

\newglossary[nlg]{symbols}{not}{ntn}{Symbols}

\makeglossaries

\loadglsentries{database1}
\loadglsentries[symbols]{database2}

\begin{document}

\glsaddall

\printglossaries

\end{document}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</sampleDB.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*sampleDesc.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
% See also sampleAcrDesc.tex
\documentclass[a4paper]{report}

\usepackage[colorlinks,plainpages=false]{hyperref}

\usepackage[style=altlist, % use altlist style
            toc, % add the glossary to the table of contents
            sanitize={description=false}% don't sanitize description
           ]{glossaries}

\makeglossaries

\newglossaryentry{svm}{
 % how the entry name should appear in the glossary
name={Support vector machine (SVM)},
 % how the description should appear in the glossary
 % since I have used sanitize={description=false}
 % I have to protect fragile commands
description={Statistical pattern recognition
technique~\protect\cite{svm}},
 % how the entry should appear in the document text
text={svm},
 % how the entry should appear the first time it is
 % used in the document text
first={support vector machine (svm)}}

\newglossaryentry{ksvm}{
name={Kernel support vector machine (KSVM)},
description={Statistical pattern recognition technique
using the ``kernel trick'' (see also SVM)},
text={ksvm},
first={kernel support vector machine}}

\begin{document}
\tableofcontents

\chapter{Support Vector Machines}

The \gls{svm} is used widely in the area of pattern recognition.
 % plural form with initial letter in uppercase:
\Glspl{svm} are \ldots

This is the text produced without a link: \glsentrytext{svm}.
This is the text produced on first use without a link:
\glsentryfirst{svm}. This is the entry's description without
a link: \glsentrydesc{svm}.

This is the entry in uppercase: \GLS{svm}.

\chapter{Kernel Support Vector Machines}

The \gls{ksvm} is \ifglsused{svm}{an}{a} \gls{svm} that uses
the so called ``kernel trick''.

\glsresetall
Possessive: \gls{ksvm}['s].
Make the glossary entry number bold for this 
one \gls[format=hyperbf]{svm}.

\begin{thebibliography}{1}
\bibitem{svm} \ldots
\end{thebibliography}

\printglossary[title={Acronyms}]

\end{document}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</sampleDesc.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*sampleEq.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
\documentclass[a4paper,12pt]{report}

\usepackage{amsmath}
\usepackage[colorlinks]{hyperref}
\usepackage[style=long3colheader,counter=equation]{glossaries}

\makeglossaries

\newcommand{\erf}{\operatorname{erf}}
\newcommand{\erfc}{\operatorname{erfc}}

 % redefine the way hyperref creates the target for equations
 % so that the glossary links to equation numbers work

\renewcommand*\theHequation{\thechapter.\arabic{equation}}

 % Change the glossary headings

\renewcommand{\entryname}{Notation}
\renewcommand{\descriptionname}{Function Name}
\renewcommand{\pagelistname}{Number of Formula}

 % define glossary entries

\newglossaryentry{Gamma}{name=\ensuremath{\Gamma(z)},
description=Gamma function,
sort=Gamma}

\newglossaryentry{gamma}{name={\ensuremath{\gamma(\alpha,x)}},
description=Incomplete gamma function,
sort=gamma}

\newglossaryentry{iGamma}{name={\ensuremath{\Gamma(\alpha,x)}},
description=Incomplete gamma function,
sort=Gamma}

\newglossaryentry{psi}{name=\ensuremath{\psi(x)},
description=Psi function,sort=psi}

\newglossaryentry{erf}{name=\ensuremath{\erf(x)},
description=Error function,sort=erf}

\newglossaryentry{erfc}{name=\ensuremath{\erfc},
description=Complementary error function,sort=erfc}

\newglossaryentry{B}{name={\ensuremath{B(x,y)}},
description=Beta function,sort=B}

\newglossaryentry{Bx}{name={\ensuremath{B_x(p,q)}},
description=Incomplete beta function,sort=Bx}

\newglossaryentry{Tn}{name=\ensuremath{T_n(x)},
description=Chebyshev's polynomials of the first kind,sort=Tn}

\newglossaryentry{Un}{name=\ensuremath{U_n(x)},
description=Chebyshev's polynomials of the second kind,sort=Un}

\newglossaryentry{Hn}{name=\ensuremath{H_n(x)},
description=Hermite polynomials,sort=Hn}

\newglossaryentry{Ln}{name=\ensuremath{L_n^\alpha(x)},
description=Laguerre polynomials,sort=Lna}

\newglossaryentry{Znu}{name=\ensuremath{Z_\nu(z)},
description=Bessel functions,sort=Z}

\newglossaryentry{Phi}{name={\ensuremath{\Phi(\alpha,\gamma;z)}},
description=confluent hypergeometric function,sort=Pagz}

\newglossaryentry{knu}{name=\ensuremath{k_\nu(x)},
description=Bateman's function,sort=kv}

\newglossaryentry{Dp}{name=\ensuremath{D_p(z)},
description=Parabolic cylinder functions,sort=Dp}

\newglossaryentry{F}{name={\ensuremath{F(\phi,k)}},
description=Elliptical integral of the first kind,sort=Fpk}

\newglossaryentry{C}{name=\ensuremath{C},
description=Euler's constant,sort=C}

\newglossaryentry{G}{name=\ensuremath{G},
description=Catalan's constant,sort=G}

\begin{document}
\title{A Sample Document Using glossaries.sty}
\author{Nicola Talbot}
\maketitle

\begin{abstract}
This is a sample document illustrating the use of the \textsf{glossaries}
package.  The functions here have been taken from ``Tables of
Integrals, Series, and Products'' by I.S.~Gradshteyn and I.M~Ryzhik.
The glossary is a list of special functions, so 
the equation number has been used rather than the page number.  This 
can be done using the \texttt{counter=equation} package
option.
\end{abstract}

\printglossary[title={Index of Special Functions and Notations}]

\chapter{Gamma Functions}

\begin{equation}
\gls{Gamma} = \int_{0}^{\infty}e^{-t}t^{z-1}\,dt
\end{equation}

\verb|\ensuremath| is only required here if using 
hyperlinks.
\begin{equation}
\glslink{Gamma}{\ensuremath{\Gamma(x+1)}} = x\Gamma(x)
\end{equation}

\begin{equation}
\gls{gamma} = \int_0^x e^{-t}t^{\alpha-1}\,dt
\end{equation}

\begin{equation}
\gls{iGamma} = \int_x^\infty e^{-t}t^{\alpha-1}\,dt
\end{equation}

\newpage

\begin{equation}
\gls{Gamma} = \Gamma(\alpha, x) + \gamma(\alpha, x)
\end{equation}

\begin{equation}
\gls{psi} = \frac{d}{dx}\ln\Gamma(x)
\end{equation}

\chapter{Error Functions}

\begin{equation}
\gls{erf} = \frac{2}{\surd\pi}\int_0^x e^{-t^2}\,dt
\end{equation}

\begin{equation}
\gls{erfc} = 1 - \erf(x)
\end{equation}

\chapter{Beta Function}

\begin{equation}
\gls{B} = 2\int_0^1 t^{x-1}(1-t^2)^{y-1}\,dt
\end{equation}
Alternatively:
\begin{equation}
\gls{B} = 2\int_0^{\frac\pi2}\sin^{2x-1}\phi\cos^{2y-1}\phi\,d\phi
\end{equation}

\begin{equation}
\gls{B} = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)} = B(y,x)
\end{equation}

\begin{equation}
\gls{Bx} = \int_0^x t^{p-1}(1-t)^{q-1}\,dt
\end{equation}

\chapter{Polynomials}

\section{Chebyshev's polynomials}

\begin{equation}
\gls{Tn} = \cos(n\arccos x)
\end{equation}

\begin{equation}
\gls{Un} = \frac{\sin[(n+1)\arccos x]}{\sin[\arccos x]}
\end{equation}

\section{Hermite polynomials}

\begin{equation}
\gls{Hn} = (-1)^n e^{x^2} \frac{d^n}{dx^n}(e^{-x^2})
\end{equation}

\section{Laguerre polynomials}

\begin{equation}
L_n^{\alpha} (x) = \frac{1}{n!}e^x x^{-\alpha} 
\frac{d^n}{dx^n}(e^{-x}x^{n+\alpha})
\end{equation}

\chapter{Bessel Functions}

Bessel functions $Z_\nu$ are solutions of
\begin{equation}
\frac{d^2\glslink{Znu}{Z_\nu}}{dz^2} 
+ \frac{1}{z}\,\frac{dZ_\nu}{dz} + 
\left( 1-\frac{\nu^2}{z^2}Z_\nu = 0 \right)
\end{equation}

\chapter{Confluent hypergeometric function}

\begin{equation}
\gls{Phi} = 1 + \frac{\alpha}{\gamma}\,\frac{z}{1!}
+ \frac{\alpha(\alpha+1)}{\gamma(\gamma+1)}\,\frac{z^2}{2!}
+\frac{\alpha(\alpha+1)(\alpha+2)}{\gamma(\gamma+1)(\gamma+2)}\,
\frac{z^3}{3!} + \cdots
\end{equation}

\begin{equation}
\gls{knu} = \frac{2}{\pi}\int_0^{\pi/2}
\cos(x \tan\theta - \nu\theta)\,d\theta
\end{equation}

\chapter{Parabolic cylinder functions}

\begin{equation}
\gls{Dp} = 2^{\frac{p}{2}}e^{-\frac{z^2}{4}}
\left\{
\frac{\surd\pi}{\Gamma\left(\frac{1-p}{2}\right)}
\Phi\left(-\frac{p}{2},\frac{1}{2};\frac{z^2}{2}\right)
-\frac{\sqrt{2\pi}z}{\Gamma\left(-\frac{p}{2}\right)}
\Phi\left(\frac{1-p}{2},\frac{3}{2};\frac{z^2}{2}\right)
\right\}
\end{equation}

\chapter{Elliptical Integral of the First Kind}

\begin{equation}
\gls{F} = \int_0^\phi \frac{d\alpha}{\sqrt{1-k^2\sin^2\alpha}}
\end{equation}

\chapter{Constants}

\begin{equation}
\gls{C} = 0.577\,215\,664\,901\ldots
\end{equation}

\begin{equation}
\gls{G} = 0.915\,965\,594\ldots
\end{equation}

\end{document}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</sampleEq.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*sampleEqPg.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
 % To ensure that the page numbers are up-to-date:
 %
 % latex sampleEqPg
 % makeglossaries sampleEqPg
 % latex sampleEqPg
 % makeglossaries sampleEqPg
 % latex sampleEqPg
 %
 % The extra makeglossaries run is required because adding the
 % glossary in the second LaTeX run shifts the page numbers on
 % which means that the glossary needs to be updated again.
 % (Note that this problem is avoided if the page numbering is
 % reset after the glossary. For example, if the glossary has
 % roman numbering and the subsequent pages have arabic numbering)
\documentclass[a4paper,12pt]{report}

\usepackage{amsmath}
\usepackage[colorlinks]{hyperref}
\usepackage[style=long3colheader,toc,
            counter=equation]{glossaries}

\newcommand{\erf}{\operatorname{erf}}
\newcommand{\erfc}{\operatorname{erfc}}

 % redefine the way hyperref creates the target for equations
 % so that the glossary links to equation numbers work

\renewcommand*\theHequation{\thechapter.\arabic{equation}}

\renewcommand{\glossaryname}{Index of Special Functions and Notations}

\renewcommand{\glossarypreamble}{Numbers in italic indicate the equation number,
numbers in bold indicate page numbers where the main definition occurs.\par}

 % set the glossary number style to italic
 % hyperit is used instead of textit because
 % the hyperref package is being used.
\renewcommand{\glsnumberformat}[1]{\hyperit{#1}}

 % 1st column heading
\renewcommand{\entryname}{Notation}

 % 2nd column heading
\renewcommand{\descriptionname}{Function Name}

 % 3rd column heading
\renewcommand{\pagelistname}{}

 % Redefine header row so that it
 % adds a blank row after the title row
\renewcommand{\glossaryheader}{\bfseries\entryname &
\bfseries\descriptionname&\bfseries\pagelistname\\
& & \\\endhead}

 % Define glossary entries

\newglossaryentry{Gamma}{name=\ensuremath{\Gamma(z)},
description=Gamma function,sort=Gamma}

\newglossaryentry{gamma}{name=\ensuremath{\gamma(\alpha,x)},
description=Incomplete gamma function,sort=gamma}

\newglossaryentry{iGamma}{name=\ensuremath{\Gamma(\alpha,x)},
description=Incomplete gamma function,sort=Gamma}

\newglossaryentry{psi}{name=\ensuremath{\psi(x)},
description=Psi function,sort=psi}

\newglossaryentry{erf}{name=\ensuremath{\erf(x)},
description=Error function,sort=erf}

\newglossaryentry{erfc}{name=\ensuremath{\erfc(x)},
description=Complementary error function,sort=erfc}

\newglossaryentry{beta}{name=\ensuremath{B(x,y)},
description=Beta function,sort=B}

\newglossaryentry{Bx}{name=\ensuremath{B_x(p,q)},
description=Incomplete beta function,sort=Bx}

\newglossaryentry{Tn}{name=\ensuremath{T_n(x)},
description=Chebyshev's polynomials of the first kind,
sort=Tn}

\newglossaryentry{Un}{name=\ensuremath{U_n(x)},
description=Chebyshev's polynomials of the second kind,
sort=Un}

\newglossaryentry{Hn}{name=\ensuremath{H_n(x)},
description=Hermite polynomials,sort=Hn}

\newglossaryentry{Lna}{name=\ensuremath{L_n^\alpha(x)},
description=Laguerre polynomials,sort=Lna}

\newglossaryentry{Znu}{name=\ensuremath{Z_\nu(z)},
description=Bessel functions,sort=Z}

\newglossaryentry{Pagz}{name=\ensuremath{\Phi(\alpha,\gamma;z)},
description=confluent hypergeometric function,sort=Pagz}

\newglossaryentry{kv}{name=\ensuremath{k_\nu(x)},
description=Bateman's function,sort=kv}

\newglossaryentry{Dp}{name=\ensuremath{D_p(z)},
description=Parabolic cylinder functions,sort=Dp}

\newglossaryentry{Fpk}{name=\ensuremath{F(\phi,k)},
description=Elliptical integral of the first kind,sort=Fpk}

\newglossaryentry{C}{name=\ensuremath{C},
description=Euler's constant,sort=C}

\newglossaryentry{G}{name=\ensuremath{G},
description=Catalan's constant,sort=G}

\makeglossaries

\pagestyle{headings}

\begin{document}

\title{Sample Document Using Interchangable Numbering}
\author{Nicola Talbot}
\maketitle

\begin{abstract}
This is a sample document illustrating the use of the \textsf{glossaries}
package.  The functions here have been taken from ``Tables of
Integrals, Series, and Products'' by I.S.~Gradshteyn and I.M~Ryzhik.

The glossary lists both page numbers and equation numbers.  
Since the majority of the entries use the equation number,
\texttt{counter=equation} was used as a package option.
Note that this example will only work where the
page number and equation number compositor is the same. So 
it won't work if, say, the page numbers are of the form 
2-4 and the equation numbers are of the form 4.6.  
As most of the glossary entries should have an italic 
format, it is easiest to set the default format to 
italic.

\end{abstract}

\tableofcontents

\printglossary[toctitle={Special Functions}]

\chapter{Gamma Functions}

The \glslink[format=hyperbf,counter=page]{Gamma}{gamma function} is 
defined as
\begin{equation}
\gls{Gamma} = \int_{0}^{\infty}e^{-t}t^{z-1}\,dt
\end{equation}

\begin{equation}
\glslink{Gamma}{\ensuremath{\Gamma(x+1)}} = x\Gamma(x)
\end{equation}

\begin{equation}
\gls{gamma} = \int_0^x e^{-t}t^{\alpha-1}\,dt
\end{equation}

\begin{equation}
\gls{iGamma} = \int_x^\infty e^{-t}t^{\alpha-1}\,dt
\end{equation}

\newpage

\begin{equation}
\glslink{Gamma}{\ensuremath{\Gamma(\alpha)}} = 
\Gamma(\alpha, x) + \gamma(\alpha, x)
\end{equation}

\begin{equation}
\gls{psi} = \frac{d}{dx}\ln\Gamma(x)
\end{equation}

\chapter{Error Functions}

The \glslink[format=hyperbf,counter=page]{erf}{error function} is defined as:
\begin{equation}
\gls{erf} = \frac{2}{\surd\pi}\int_0^x e^{-t^2}\,dt
\end{equation}

\begin{equation}
\gls{erfc} = 1 - \erf(x)
\end{equation}

\chapter{Beta Function}

\begin{equation}
\gls{beta} = 2\int_0^1 t^{x-1}(1-t^2)^{y-1}\,dt
\end{equation}
Alternatively:
\begin{equation}
\gls{beta} = 2\int_0^{\frac\pi2}\sin^{2x-1}\phi\cos^{2y-1}\phi\,d\phi
\end{equation}

\begin{equation}
\gls{beta} = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)} = B(y,x)
\end{equation}

\begin{equation}
\gls{Bx} = \int_0^x t^{p-1}(1-t)^{q-1}\,dt
\end{equation}

\chapter{Chebyshev's polynomials}

\begin{equation}
\gls{Tn} = \cos(n\arccos x)
\end{equation}

\begin{equation}
\gls{Un} = \frac{\sin[(n+1)\arccos x]}{\sin[\arccos x]}
\end{equation}

\chapter{Hermite polynomials}

\begin{equation}
\gls{Hn} = (-1)^n e^{x^2} \frac{d^n}{dx^n}(e^{-x^2})
\end{equation}

\chapter{Laguerre polynomials}

\begin{equation}
\gls{Lna} = \frac{1}{n!}e^x x^{-\alpha} 
\frac{d^n}{dx^n}(e^{-x}x^{n+\alpha})
\end{equation}

\chapter{Bessel Functions}

Bessel functions $Z_\nu(z)$ are solutions of
\begin{equation}
\frac{d^2\glslink{Znu}{Z_\nu}}{dz^2} + \frac{1}{z}\,\frac{dZ_\nu}{dz} + 
\left(
1-\frac{\nu^2}{z^2}Z_\nu = 0
\right)
\end{equation}

\chapter{Confluent hypergeometric function}

\begin{equation}
\gls{Pagz} = 1 + \frac{\alpha}{\gamma}\,\frac{z}{1!}
+ \frac{\alpha(\alpha+1)}{\gamma(\gamma+1)}\,\frac{z^2}{2!}
+\frac{\alpha(\alpha+1)(\alpha+2)}
      {\gamma(\gamma+1)(\gamma+2)}
\,\frac{z^3}{3!}
+ \cdots
\end{equation}

\begin{equation}
\gls{kv} = \frac{2}{\pi}\int_0^{\pi/2}
\cos(x \tan\theta - \nu\theta)\,d\theta
\end{equation}

\chapter{Parabolic cylinder functions}

\begin{equation}
\gls{Dp} = 2^{\frac{p}{2}}e^{-\frac{z^2}{4}}
\left\{
\frac{\surd\pi}{\Gamma\left(\frac{1-p}{2}\right)}
\Phi\left(-\frac{p}{2},\frac{1}{2};\frac{z^2}{2}\right)
-\frac{\sqrt{2\pi}z}{\Gamma\left(-\frac{p}{2}\right)}
\Phi\left(\frac{1-p}{2},\frac{3}{2};\frac{z^2}{2}\right)
\right\}
\end{equation}

\chapter{Elliptical Integral of the First Kind}

\begin{equation}
\gls{Fpk} = \int_0^\phi 
\frac{d\alpha}{\sqrt{1-k^2\sin^2\alpha}}
\end{equation}

\chapter{Constants}

\begin{equation}
\gls{C} = 0.577\,215\,664\,901\ldots
\end{equation}

\begin{equation}
\gls{G} = 0.915\,965\,594\ldots
\end{equation}

\end{document}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</sampleEqPg.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*sampleNtn.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
\documentclass{report}

\usepackage[plainpages=false,colorlinks]{hyperref}
\usepackage{html}
\usepackage[toc]{glossaries}

 % Define a new glossary type called notation
\newglossary[nlg]{notation}{not}{ntn}{Notation}

\makeglossaries

 % Notation definitions

\newglossaryentry{not:set}{type=notation, % glossary type
name={$\mathcal{S}$},
description={A set},
sort={S}}

\newglossaryentry{not:U}{type=notation,
name={$\mathcal{U}$},
description={The universal set},
sort=U}

\newglossaryentry{not:card}{type=notation,
name={$|\mathcal{S}|$},
description={cardinality of $\mathcal{S}$},
sort=cardinality}

\newglossaryentry{not:fact}{type=notation,
name={$!$},
description={factorial},
sort=factorial}

 % Main glossary definitions

\newglossaryentry{gls:set}{name=set,
description={A collection of distinct objects}}

\newglossaryentry{gls:card}{name=cardinality,
description={The number of elements in the specified set}}

\begin{document}
\title{Sample Document using the glossaries Package}
\author{Nicola Talbot}
\pagenumbering{alph}
\maketitle

\begin{abstract}
 %stop hyperref complaining about duplicate page identifiers:
\pagenumbering{Alph}
This is a sample document illustrating the use of the
\textsf{glossaries} package.  In this example, a new glossary type
called \texttt{notation} is defined, so that the document can have a 
separate glossary of terms and index of notation. The index of notation
doesn't have associated numbers.
\end{abstract}


\pagenumbering{roman}
\tableofcontents

\printglossaries

\chapter{Introduction}
\pagenumbering{arabic}

\glslink{gls:set}{Sets} 
are denoted by a caligraphic font 
e.g.\ \gls{not:set}.

Let \gls[format=hyperit]{not:U} denote the universal set.

The \gls{gls:card} of a set $\mathcal{S}$ is denoted 
\gls{not:card}.

\chapter{Another Chapter}

Another mention of the universal set \gls{not:U}.

The factorial symbol: \gls{not:fact}.

\end{document}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</sampleNtn.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*sampleSec.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
\documentclass{report}

\usepackage[plainpages=false,colorlinks]{hyperref}
\usepackage[style=altlist,toc,counter=section]{glossaries}

\makeglossaries

\newglossaryentry{ident}{name=identity matrix,
description=diagonal matrix with 1s along the leading diagonal,
plural=identity matrices}

\newglossaryentry{diag}{name=diagonal matrix,
description=matrix whose only non-zero entries are along
the leading diagonal,
plural=diagonal matrices}

\newglossaryentry{sing}{name=singular matrix,
description=matrix with zero determinant,
plural=singular matrices}

\begin{document}

\pagenumbering{roman}
\tableofcontents

\printglossaries

\chapter{Introduction}
\pagenumbering{arabic}
This is a sample document illustrating the use of the
\textsf{glossaries} package.

\chapter{Diagonal matrices}

A \gls[format=hyperit]{diag} is a matrix where all elements not on the
leading diagonal are zero.  This is the
primary definition, so an italic font is used for the page number.

\newpage
\section{Identity matrix}
The \gls[format=hyperit]{ident} is a \gls{diag} whose leading
diagonal elements are all equal to 1.

Here is another entry for a \gls{diag}. And this is the
plural: \glspl{ident}.

This adds an entry into the glossary with a bold number, but
it doesn't create a hyperlink: \gls*[format=hyperbf]{ident}.

\chapter{Singular Matrices}

A \gls{sing} is a matrix with zero determinant.
\Glspl{sing} are non-invertible. Possessive:
a \gls{sing}['s] dimensions are not necessarily equal.

Another \gls{ident} entry.

\end{document}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</sampleSec.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*sampletree.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
\documentclass{report}

\usepackage[colorlinks]{hyperref}
\usepackage[style=alttreehypergroup,nolong,nosuper]{glossaries}

 % The alttree type of glossary styles need to know the
 % widest entry name for each level
\glssetwidest{Roman letters} % level 0 widest name
\glssetwidest[1]{Sigma}      % level 1 widest name

\makeglossaries

\newglossaryentry{greekletter}{name={Greek letters},
text={Greek letter},
description={\nopostdesc}}

\newglossaryentry{sigma}{name={Sigma},
text={\ensuremath{\Sigma}},
first={\ensuremath{\Sigma} (uppercase sigma)},
symbol={\ensuremath{\Sigma}},
description={Used to indicate summation},
parent=greekletter}

\newglossaryentry{pi}{name={pi},
text={\ensuremath{\pi}},
first={\ensuremath{\pi} (lowercase pi)},
symbol={\ensuremath{\pi}},
description={Transcendental number},
parent=greekletter}

\newglossaryentry{romanletter}{name={Roman letters},
text={Roman letter},
description={\nopostdesc}}

\newglossaryentry{e}{name={e},
description={Unique real number such that the derivative of
the function $e^x$ is the function itself},
parent=romanletter}

\newglossaryentry{C}{name={C},
description={Euler's constant},
parent=romanletter}

\begin{document}
This is a sample document illustrating hierarchical glossary
entries.

\chapter{Greek Letters Used in Mathematics}

Some information about \glspl{greekletter}.
The letter \gls{pi} is used to represent the ratio of a circle's
circumference to its diameter.
The letter \gls{sigma} is used to represent summation.

\chapter{Roman Letters Used in Mathematics}

Some information about \glspl{romanletter}.
The letter \gls{e} is the unique real number such that
the derivative of the function $e^x$ is the function itself.
The letter \gls{C} represents Euler's constant.

\printglossaries

\end{document}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</sampletree.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*sampleutf8.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[xindy,nonumberlist,style=listgroup]{glossaries}

\makeglossaries

% Note that because the é is the first letter of the
% name, it needs to be grouped or it will cause a
% problem for \makefirstuc due to expansion issues.
\newglossaryentry{elite}{name={{é}lite},
description={select group or class}}

\newglossaryentry{elephant}{name=elephant,
description={large animal with trunk and tusks}}

\newglossaryentry{elk}{name=elk,
description=large deer}

\newglossaryentry{mannerly}{name=mannerly,
description=polite}

% The œ is not the first letter, so it doesn't need to
% be grouped.
\newglossaryentry{manoeuvre}{name={manœuvre},
description=planned and controlled movement}

\newglossaryentry{manor}{name=manor,
description=large landed estate or its house}

\newglossaryentry{odometer}{name=odometer,
description=instrument for measuring distance travelled by
a wheeled vehicle}

\newglossaryentry{oesophagus}{name={{œ}sophagus},
description={canal from mouth to stomach}}

\newglossaryentry{ogre}{name=ogre,
description=man-eating giant}

\begin{document}
\null % ensure that the first run produces some output
\glsaddall

\printglossaries

\end{document}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</sampleutf8.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*samplexdy.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
 % This is a sample document illustrating how to use the
 % glossaries package with xindy. To create the document:
 %
 %   latex samplexdy
 %   makeglossaries samplexdy
 %   latex samplexdy
 %
 % If you don't have Perl installed, then use one of the
 % following instead of makeglossaries:
 %
 % If you want to have a separate "Mc" letter group do:
 %
 %    xindy -I xindy -M samplexdy-mc -t samplexdy.glg -o samplexdy.gls samplexdy.glo
 %
 % Otherwise do:
 %
 %  xindy -L english -C utf8 -I xindy -M samplexdy -t samplexdy.glg -o samplexdy.gls samplexdy.glo
 % 
\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fmtcount}

 % remove redefinition of \thepage below if you want to uncomment
 % the following line:
 % \usepackage[colorlinks]{hyperref}

\usepackage[xindy,style=altlistgroup]{glossaries}

 % Define a new command to do bold italic (it uses \hyperbf
 % rather than \textbf in case I later introduce hyperlinks
 % - although I would have to remove the fancy page numbering
 % if I wanted to do that):

\newcommand*{\hyperbfit}[1]{\textit{\hyperbf{#1}}}

 % Need to add this to the list of attributes in order
 % to use it with xindy:
 % (This command will have no effect if \noist is used)

\GlsAddXdyAttribute{hyperbfit}

 % Redefine the page numbers so that they appear as a word:

 \renewcommand*{\thepage}{\Numberstring{page}}

 % Need to add this to the list of location styles.
 % \Numberstring{page} gets expanded to
 % \protect \Numberstringnum {<n>} (where <n> is the page number)
 % so need to define the location in that format:
 % (This command will have no effect if \noist is used)

\GlsAddXdyLocation{Numberstring}{:sep "\string\protect\space
  \string\Numberstringnum\space\glsopenbrace" 
  "arabic-numbers" :sep "\glsclosebrace"}

 % To have Mc as a separate group uncomment the following three
 % lines:

 %\setStyleFile{samplexdy-mc} % note no extension
 %\noist
 %\GlsSetXdyLanguage{}

 % The above three lines specify to use samplexdy-mc.xdy (supplied
 % with this file) and don't overwrite it. The language is
 % unset using \GlsSetXdyLanguage{} as all the language 
 % dependent information is contained in samplexdy-mc.xdy
 % Note that using \noist means that commands like
 % \GlsAddXdyAttribute and \GlsAddXdyLocation will no longer have
 % an effect.

 % Write the style file (if \noist isn't used)
 % and activate glossary entries

\makeglossaries

 % Define glossary entries
 % \glshyperlink is used instead of \gls to prevent the glossary
 % page numbers also appear in the locations, however I need
 % to ensure that the referenced entries are added to the 
 % glossary via commands that use \glslink, \glsadd or \glssee

\newglossaryentry{mcadam}{name={McAdam, John Loudon},
first={John Loudon McAdam},text={McAdam},
description={Scottish engineer}}

\newglossaryentry{maclaurin}{name={Maclaurin, Colin},
first={Colin Maclaurin},text={Maclaurin},
description={Scottish mathematician best known for the
\gls{maclaurinseries}}}

\newglossaryentry{maclaurinseries}{name={Maclaurin series},
description={Series expansion},see={taylorstheorem}}

\newglossaryentry{taylorstheorem}{name={Taylor's theorem},
description={Theorem expressing a function $f(x)$ as the sum of
a polynomial and a remainder:
\[f(x) = f(a)+f'(a)(x-a)+f''(a)(x-a^2)/2!+\cdots+R_n\]
If $n\to\infty$ the expansion is a \glshyperlink{taylorseries}
and if $a=0$, the series is called a 
\gls{maclaurinseries}}}

\newglossaryentry{taylorseries}{name={Taylor series},
description={Series expansion},see={taylorstheorem}}

\newglossaryentry{taylor}{name={Taylor, Brook},
first={Brook Taylor},text={Taylor},
description={English mathematician}}

\newglossaryentry{mcnemar}{name={McNemar, Quinn},
first={Quinn McNemar},text={McNemar},
description={Mathematician who introduced 
\gls{mcnemarstest}. This entry has the number list
suppressed},nonumberlist}

\newglossaryentry{mcnemarstest}{name={McNemar's test},
description={A nonparametric test introduced by
\gls{mcnemar} in 1947}}

\newglossaryentry{mach}{name={Mach, Ernst},
first={Ernst Mach},text={Mach},
 % if using samplexdy-mc.xdy, the following line is needed
 % to prevent this entry being put in the "Mc" group
sort={mach, Ernst},
description={Czech/Austrian physicist and philosopher}}

\newglossaryentry{machnumber}{name={Mach number},
 % if using samplexdy-mc.xdy, the following line is needed
 % to prevent this entry being put in the "Mc" group
sort={mach number},
description={Ratio of the speed of a body in a fluid to the
speed of sound in that fluid named after \gls{mach}}}

\newglossaryentry{malthus}{name={Malthus, Thomas Robert},
first={Thomas Robert Malthus},text={Malthus},
description={English mathematician, sociologist and classicist}}

\newglossaryentry{ampereandre}{name={Ampère, André-Marie},
first={André-Marie Ampère},text={Ampère},
description={French mathematician and physicist}}

\newglossaryentry{ampere}{name={ampere},
description={SI unit of electric current named after
\gls{ampereandre}}}

\newglossaryentry{archimedes}{name={Archimedes of Syracuse},
first={Archimedes of Syracuse},text={Archimedes},
description={Greek mathematician}}

\newglossaryentry{archimedesprinciple}{name={Archemedes' principle},
description={Principle that if a body is submerged in a fluid
it experiences upthrust equal to the weight of the displaced
fluid. Named after \gls{archimedes}}}

\newglossaryentry{galton}{name={Galton, Sir Francis},
first={Sir Francis Galton},text={Galton},
description={English anthropologist}}

\newglossaryentry{gauss}{name={Gauss, Karl Friedrich},
first={Karl Friedrich Gauss},text={Gauss},
description={German mathematician}}

\newglossaryentry{gaussianint}{name={Gaussian integer},
description={Complex number where both real and imaginary
parts are integers}}

\newglossaryentry{peano}{name={Peano, Giuseppe},
first={Giuseppe Peano},text={Peano},
description={Italian mathematician}}

\newglossaryentry{peanoscurve}{name={Peano's curve},
description={A space-filling curve discovered by 
\gls{peano}}}

\newglossaryentry{pearson}{name={Pearson, Karl},
first={Karl Pearson},text={Pearson},
description={English mathematician}}

\newglossaryentry{pearspmcc}{name={Pearson's product moment
correlation coefficient},description={Product moment correlation
coefficient named after \gls{pearson}}}

\begin{document}
\title{Sample Document Using the Glossaries Package With Xindy}
\author{Nicola Talbot}
\maketitle

\section{\glsentryfirst{gauss}}

This is a section on \gls[format=(]{gauss}. This section spans
several pages.

\newpage

This page talks about \glspl[format=hyperbfit]{gaussianint}. Since
it's the principle definition, the user-defined hyperbfit format is 
used.

\newpage

The section on \gls[format=)]{gauss} ends here.

\section{Series Expansions}

This section is about series expansions. It mentions
\gls{maclaurin} and \gls{taylor}. It also discusses 
\gls{taylorstheorem} which is related to the \gls{taylorseries}.
The \gls{maclaurinseries} is a special case of the
\gls{taylorseries}.

\section{\glsentryname{archimedesprinciple}}

This section discusses \gls{archimedesprinciple} which was
introduced by \gls{archimedes}.

\section{Another section}

This section covers \gls{mach} who introduced the \gls{machnumber}.
It also mentions \gls{ampereandre} after whom the
SI unit \gls{ampere} is named. It then discusses \gls{galton}
and \gls{malthus}. Finally it mentions \gls{mcadam}.

\newpage
This page discusses \gls{mcnemar} who introduced
\gls{mcnemarstest} and \gls{peano} who discovered \gls{peanoscurve}.

\printglossaries
\end{document}
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</samplexdy.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*samplexdy-mc.xdy>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
;; xindy style file for samplexdy.tex that has Mc letter group

(define-letter-group "A" :prefixes (""))
(define-letter-group "B" :after "A" :prefixes (""))
(define-letter-group "C" :after "B" :prefixes (""))
(define-letter-group "D" :after "C" :prefixes (""))
(define-letter-group "E" :after "D" :prefixes (""))
(define-letter-group "F" :after "E" :prefixes (""))
(define-letter-group "G" :after "F" :prefixes (""))
(define-letter-group "H" :after "G" :prefixes ("¤"))
(define-letter-group "I" :after "H" :prefixes ("¨"))
(define-letter-group "J" :after "I" :prefixes ("¬"))
(define-letter-group "K" :after "J" :prefixes ("®"))
(define-letter-group "L" :after "K" :prefixes ("´"))
(define-letter-group "Mc" :after "L" :prefixes ("»"))
(define-letter-group "M" :after "Mc" :prefixes ("»"))
(define-letter-group "N" :after "M" :prefixes ("¼"))
(define-letter-group "O" :after "N" :prefixes ("Ã"))
(define-letter-group "P" :after "O" :prefixes ("È"))
(define-letter-group "Q" :after "P" :prefixes ("Ê"))
(define-letter-group "R" :after "Q" :prefixes ("Ë"))
(define-letter-group "S" :after "R" :prefixes ("Ð"))
(define-letter-group "T" :after "S" :prefixes ("Ú"))
(define-letter-group "U" :after "T" :prefixes ("à"))
(define-letter-group "V" :after "U" :prefixes ("å"))
(define-letter-group "W" :after "V" :prefixes ("æ"))
(define-letter-group "X" :after "W" :prefixes ("ë"))
(define-letter-group "Y" :after "X" :prefixes ("í"))
(define-letter-group "È" :after "Y" :prefixes ("ï"))
(define-letter-group "Z" :after "È" :prefixes ("ð"))
(define-letter-group "Ã" :after "Z" :prefixes ("ö"))
(define-letter-group "Æ¿" :after "Ã" :prefixes ("÷"))

(define-rule-set "en-alphabetize"

  :rules  (("Ã " "" :string)
           ("Ã" "" :string)
           ("Ã" "" :string)
           ("Ã¦" "" :string)
           ("Ã" "" :string)
           ("Ã§" "" :string)
           ("Ã°" "" :string)
           ("Ã" "" :string)
           ("Ã" "" :string)
           ("Ã" "" :string)
           ("Ã" "" :string)
           ("Ã" "" :string)
           ("Ã¨" "" :string)
           ("Ã«" "" :string)
           ("Ãª" "" :string)
           ("Ã©" "" :string)
           ("Ã" "¨" :string)
           ("Ã¯" "¨" :string)
           ("Ã" "¼" :string)
           ("Ã±" "¼" :string)
           ("Ã" "Ã" :string)
           ("Ã" "Ã" :string)
           ("Ã´" "Ã" :string)
           ("Ã¶" "Ã" :string)
           ("Å" "Ã" :string)
           ("Å" "Ã" :string)
           ("È" "ï" :string)
           ("È" "ï" :string)
           ("Ã¾" "ö" :string)
           ("Ã" "ö" :string)
           ("Ç·" "÷" :string)
           ("Æ¿" "÷" :string)
           ("a" "" :string)
           ("A" "" :string)
           ("b" "" :string)
           ("B" "" :string)
           ("C" "" :string)
           ("c" "" :string)
           ("d" "" :string)
           ("D" "" :string)
           ("E" "" :string)
           ("e" "" :string)
           ("F" "" :string)
           ("f" "" :string)
           ("g" "" :string)
           ("G" "" :string)
           ("H" "¤" :string)
           ("h" "¤" :string)
           ("I" "¨" :string)
           ("i" "¨" :string)
           ("J" "¬" :string)
           ("j" "¬" :string)
           ("K" "®" :string)
           ("k" "®" :string)
           ("L" "´" :string)
           ("l" "´" :string)
           ("Mc" "»" :string)
           ("Mac" "»" :string)
           ("M" "»" :string)
           ("m" "»" :string)
           ("N" "¼" :string)
           ("n" "¼" :string)
           ("O" "Ã" :string)
           ("o" "Ã" :string)
           ("P" "È" :string)
           ("p" "È" :string)
           ("q" "Ê" :string)
           ("Q" "Ê" :string)
           ("r" "Ë" :string)
           ("R" "Ë" :string)
           ("S" "Ð" :string)
           ("s" "Ð" :string)
           ("T" "Ú" :string)
           ("t" "Ú" :string)
           ("u" "à" :string)
           ("U" "à" :string)
           ("v" "å" :string)
           ("V" "å" :string)
           ("w" "æ" :string)
           ("W" "æ" :string)
           ("X" "ë" :string)
           ("x" "ë" :string)
           ("Y" "í" :string)
           ("y" "í" :string)
           ("z" "ð" :string)
           ("Z" "ð" :string)
           ))

(define-rule-set "en-resolve-diacritics"

  :rules  (("È" "¢" :string)
           ("Ã¾" "¢" :string)
           ("Ç·" "¢" :string)
           ("Ã" "¢" :string)
           ("È" "¢" :string)
           ("Æ¿" "¢" :string)
           ("Ã" "£" :string)
           ("Ã" "£" :string)
           ("Ã°" "£" :string)
           ("Ã" "£" :string)
           ("Ã" "£" :string)
           ("Ã" "£" :string)
           ("Ã¯" "£" :string)
           ("Ã¶" "£" :string)
           ("Ã±" "£" :string)
           ("Ã§" "£" :string)
           ("Ã " "£" :string)
           ("Ã" "£" :string)
           ("Ã©" "£" :string)
           ("Ã" "£" :string)
           ("Ã" "¤" :string)
           ("Ã´" "¤" :string)
           ("Ã" "¤" :string)
           ("Ã¨" "¤" :string)
           ("Ã" "¥" :string)
           ("Ã«" "¥" :string)
           ("Ã" "¦" :string)
           ("Ãª" "¦" :string)
           ("Å" "ÿ" :string)
           ("Ã" "ÿ" :string)
           ("Å" "ÿ" :string)
           ("Ã¦" "ÿ" :string)
           ("S" "¢" :string)
           ("K" "¢" :string)
           ("d" "¢" :string)
           ("Y" "¢" :string)
           ("E" "¢" :string)
           ("y" "¢" :string)
           ("g" "¢" :string)
           ("e" "¢" :string)
           ("J" "¢" :string)
           ("q" "¢" :string)
           ("D" "¢" :string)
           ("b" "¢" :string)
           ("z" "¢" :string)
           ("w" "¢" :string)
           ("Q" "¢" :string)
           ("M" "¢" :string)
           ("C" "¢" :string)
           ("L" "¢" :string)
           ("X" "¢" :string)
           ("P" "¢" :string)
           ("T" "¢" :string)
           ("a" "¢" :string)
           ("N" "¢" :string)
           ("j" "¢" :string)
           ("Z" "¢" :string)
           ("u" "¢" :string)
           ("k" "¢" :string)
           ("t" "¢" :string)
           ("W" "¢" :string)
           ("v" "¢" :string)
           ("s" "¢" :string)
           ("B" "¢" :string)
           ("H" "¢" :string)
           ("c" "¢" :string)
           ("I" "¢" :string)
           ("G" "¢" :string)
           ("U" "¢" :string)
           ("F" "¢" :string)
           ("r" "¢" :string)
           ("x" "¢" :string)
           ("V" "¢" :string)
           ("h" "¢" :string)
           ("f" "¢" :string)
           ("i" "¢" :string)
           ("A" "¢" :string)
           ("O" "¢" :string)
           ("n" "¢" :string)
           ("m" "¢" :string)
           ("l" "¢" :string)
           ("p" "¢" :string)
           ("R" "¢" :string)
           ("o" "¢" :string)
           ))

(define-rule-set "en-resolve-case"

  :rules  (("Ã" "8" :string)
           ("Ã" "8" :string)
           ("Ã" "8" :string)
           ("Ã" "8" :string)
           ("Ã" "8" :string)
           ("Ã" "8" :string)
           ("Ã" "8" :string)
           ("Ã" "8" :string)
           ("Ã" "8" :string)
           ("Ç·" "8" :string)
           ("Ã" "8" :string)
           ("Ã" "8" :string)
           ("È" "8" :string)
           ("Ã" "8" :string)
           ("Ã" "89" :string)
           ("Å" "89" :string)
           ("Ã°" "9" :string)
           ("Ã´" "9" :string)
           ("È" "9" :string)
           ("Ã¯" "9" :string)
           ("Ã¶" "9" :string)
           ("Ã±" "9" :string)
           ("Ã§" "9" :string)
           ("Ã " "9" :string)
           ("Ã¾" "9" :string)
           ("Ã¨" "9" :string)
           ("Ã«" "9" :string)
           ("Ãª" "9" :string)
           ("Ã©" "9" :string)
           ("Æ¿" "9" :string)
           ("Å" "99" :string)
           ("Ã¦" "99" :string)
           ("S" "8" :string)
           ("K" "8" :string)
           ("Y" "8" :string)
           ("E" "8" :string)
           ("J" "8" :string)
           ("D" "8" :string)
           ("Q" "8" :string)
           ("M" "8" :string)
           ("C" "8" :string)
           ("L" "8" :string)
           ("X" "8" :string)
           ("P" "8" :string)
           ("T" "8" :string)
           ("N" "8" :string)
           ("Z" "8" :string)
           ("W" "8" :string)
           ("B" "8" :string)
           ("H" "8" :string)
           ("I" "8" :string)
           ("G" "8" :string)
           ("U" "8" :string)
           ("F" "8" :string)
           ("V" "8" :string)
           ("A" "8" :string)
           ("O" "8" :string)
           ("R" "8" :string)
           ("d" "9" :string)
           ("y" "9" :string)
           ("g" "9" :string)
           ("e" "9" :string)
           ("q" "9" :string)
           ("b" "9" :string)
           ("z" "9" :string)
           ("w" "9" :string)
           ("a" "9" :string)
           ("j" "9" :string)
           ("u" "9" :string)
           ("k" "9" :string)
           ("t" "9" :string)
           ("v" "9" :string)
           ("s" "9" :string)
           ("c" "9" :string)
           ("r" "9" :string)
           ("x" "9" :string)
           ("h" "9" :string)
           ("f" "9" :string)
           ("i" "9" :string)
           ("n" "9" :string)
           ("m" "9" :string)
           ("l" "9" :string)
           ("p" "9" :string)
           ("o" "9" :string)
           ))

(define-rule-set "en-ignore-special"

  :rules  (("-" "" :string)
           ("!" "" :string)
           ("{" "" :string)
           ("'" "" :string)
           ("}" "" :string)
           ("?" "" :string)
           ("." "" :string)
           ))

(define-rule-set "en-resolve-special"

  :rules  (("Ã" "¤" :string)
           ("Ã" "¤" :string)
           ("Ã°" "¤" :string)
           ("Ã" "¤" :string)
           ("Ã" "¤" :string)
           ("Ã" "¤" :string)
           ("Ã´" "¤" :string)
           ("Ã" "¤" :string)
           ("È" "¤" :string)
           ("Ã¯" "¤" :string)
           ("Ã" "¤" :string)
           ("Ã¶" "¤" :string)
           ("Ã±" "¤" :string)
           ("Ã" "¤" :string)
           ("Ã§" "¤" :string)
           ("Ã" "¤" :string)
           ("Ã " "¤" :string)
           ("Ã¾" "¤" :string)
           ("Ç·" "¤" :string)
           ("Ã¨" "¤" :string)
           ("Ã" "¤" :string)
           ("Ã«" "¤" :string)
           ("Ã" "¤" :string)
           ("Ãª" "¤" :string)
           ("Ã©" "¤" :string)
           ("È" "¤" :string)
           ("Æ¿" "¤" :string)
           ("Ã" "¤" :string)
           ("Å" "¤¤" :string)
           ("Ã" "¤¤" :string)
           ("Å" "¤¤" :string)
           ("Ã¦" "¤¤" :string)
           ("?" "¡" :string)
           ("!" "¢" :string)
           ("." "£" :string)
           ("S" "¤" :string)
           ("K" "¤" :string)
           ("d" "¤" :string)
           ("Y" "¤" :string)
           ("E" "¤" :string)
           ("y" "¤" :string)
           ("g" "¤" :string)
           ("e" "¤" :string)
           ("J" "¤" :string)
           ("q" "¤" :string)
           ("D" "¤" :string)
           ("b" "¤" :string)
           ("z" "¤" :string)
           ("w" "¤" :string)
           ("Q" "¤" :string)
           ("M" "¤" :string)
           ("C" "¤" :string)
           ("L" "¤" :string)
           ("X" "¤" :string)
           ("P" "¤" :string)
           ("T" "¤" :string)
           ("a" "¤" :string)
           ("N" "¤" :string)
           ("j" "¤" :string)
           ("Z" "¤" :string)
           ("u" "¤" :string)
           ("k" "¤" :string)
           ("t" "¤" :string)
           ("W" "¤" :string)
           ("v" "¤" :string)
           ("s" "¤" :string)
           ("B" "¤" :string)
           ("H" "¤" :string)
           ("c" "¤" :string)
           ("I" "¤" :string)
           ("G" "¤" :string)
           ("U" "¤" :string)
           ("F" "¤" :string)
           ("r" "¤" :string)
           ("x" "¤" :string)
           ("V" "¤" :string)
           ("h" "¤" :string)
           ("f" "¤" :string)
           ("i" "¤" :string)
           ("A" "¤" :string)
           ("O" "¤" :string)
           ("n" "¤" :string)
           ("m" "¤" :string)
           ("l" "¤" :string)
           ("p" "¤" :string)
           ("R" "¤" :string)
           ("o" "¤" :string)
           ("-" "¥" :string)
           ("'" "¦" :string)
           ("{" "§" :string)
           ("}" "¨" :string)
           ))

; The following section is customised for samplexdy.tex
; (copied from samplexdy.xdy automatically generated by
; samplexdy.tex)

; required styles

(require "tex.xdy")

; list of allowed attributes (number formats)

(define-attributes (("default"
 "glsnumberformat"
 "textrm"
 "textsf"
 "texttt"
 "textbf"
 "textmd"
 "textit"
 "textup"
 "textsl"
 "textsc"
 "emph"
 "glshypernumber"
 "hyperrm"
 "hypersf"
 "hypertt"
 "hyperbf"
 "hypermd"
 "hyperit"
 "hyperup"
 "hypersl"
 "hypersc"
 "hyperemph"
 "hyperbfit")))

; user defined alphabets



; location class definitions

(define-location-class "roman-page-numbers"
   ("roman-numbers-lowercase"))
(define-location-class "Roman-page-numbers"
   ("roman-numbers-uppercase"))
(define-location-class "arabic-page-numbers"
   ("arabic-numbers"))
(define-location-class "alpha-page-numbers"
   ("alpha"))
(define-location-class "Alpha-page-numbers"
   ("ALPHA"))
(define-location-class "Appendix-page-numbers"
   ("ALPHA" :sep "." "arabic-numbers"))
(define-location-class "arabic-section-numbers"
   ("arabic-numbers" :sep "." "arabic-numbers"))

; user defined location classes

(define-location-class "Numberstring"
   (:sep "\protect \Numberstringnum {" "arabic-numbers" :sep "}")) 

; define cross-reference class

(define-crossref-class "see" :unverified )
(markup-crossref-list :class "see"
   :open "\glsseeformat" :close "{}")

; define the order of the location classes
(define-location-class-order (
   "roman-page-numbers"
   "arabic-page-numbers"
   "arabic-section-numbers"
   "alpha-page-numbers"
   "Roman-page-numbers"
   "Alpha-page-numbers"
   "Appendix-page-numbers" 
   "see" ))

; define the glossary markup

(markup-index
   :open "\glossarysection[\glossarytoctitle]{\glossarytitle}\glossarypreamble~n\begin{theglossary}\glossaryheader~n" 
   :close "~n\end{theglossary}~n\glossarypostamble~n" 
   :tree)
(markup-letter-group-list :sep "\glsgroupskip~n")
(markup-indexentry :open "~n" :depth 0)
(markup-locclass-list :open "{\glossaryentrynumbers{\relax "
   :sep ", " :close "}}")
(markup-locref-list :sep "\delimN ")
(markup-range :sep "\delimR ")

; define format to use for locations


(markup-locref :open "~n\setentrycounter{page}\glsnumberformat{" 
 :close "}" 
 :attr "glsnumberformat")
(markup-locref :open "~n\setentrycounter{page}\textrm{" 
 :close "}" 
 :attr "textrm")
(markup-locref :open "~n\setentrycounter{page}\textsf{" 
 :close "}" 
 :attr "textsf")
(markup-locref :open "~n\setentrycounter{page}\texttt{" 
 :close "}" 
 :attr "texttt")
(markup-locref :open "~n\setentrycounter{page}\textbf{" 
 :close "}" 
 :attr "textbf")
(markup-locref :open "~n\setentrycounter{page}\textmd{" 
 :close "}" 
 :attr "textmd")
(markup-locref :open "~n\setentrycounter{page}\textit{" 
 :close "}" 
 :attr "textit")
(markup-locref :open "~n\setentrycounter{page}\textup{" 
 :close "}" 
 :attr "textup")
(markup-locref :open "~n\setentrycounter{page}\textsl{" 
 :close "}" 
 :attr "textsl")
(markup-locref :open "~n\setentrycounter{page}\textsc{" 
 :close "}" 
 :attr "textsc")
(markup-locref :open "~n\setentrycounter{page}\emph{" 
 :close "}" 
 :attr "emph")
(markup-locref :open "~n\setentrycounter{page}\glshypernumber{" 
 :close "}" 
 :attr "glshypernumber")
(markup-locref :open "~n\setentrycounter{page}\hyperrm{" 
 :close "}" 
 :attr "hyperrm")
(markup-locref :open "~n\setentrycounter{page}\hypersf{" 
 :close "}" 
 :attr "hypersf")
(markup-locref :open "~n\setentrycounter{page}\hypertt{" 
 :close "}" 
 :attr "hypertt")
(markup-locref :open "~n\setentrycounter{page}\hyperbf{" 
 :close "}" 
 :attr "hyperbf")
(markup-locref :open "~n\setentrycounter{page}\hypermd{" 
 :close "}" 
 :attr "hypermd")
(markup-locref :open "~n\setentrycounter{page}\hyperit{" 
 :close "}" 
 :attr "hyperit")
(markup-locref :open "~n\setentrycounter{page}\hyperup{" 
 :close "}" 
 :attr "hyperup")
(markup-locref :open "~n\setentrycounter{page}\hypersl{" 
 :close "}" 
 :attr "hypersl")
(markup-locref :open "~n\setentrycounter{page}\hypersc{" 
 :close "}" 
 :attr "hypersc")
(markup-locref :open "~n\setentrycounter{page}\hyperemph{" 
 :close "}" 
 :attr "hyperemph")
(markup-locref :open "~n\setentrycounter{page}\hyperbfit{" 
 :close "}" 
 :attr "hyperbfit")

; define letter group list format

(markup-letter-group-list :sep "\glsgroupskip~n")

; letter group headings

(markup-letter-group :open-head "\glsgroupheading{"
   :close-head "}")

(define-letter-group "glsnumbers"
   :prefixes ("0" "1" "2" "3" "4" "5" "6" "7" "8" "9")
   :before "A")

; The following is copied from xindy/lang/english/utf8-lang.xdy

(define-sort-rule-orientations (forward backward forward forward))
(use-rule-set :run 0
	      :rule-set ("en-alphabetize" "en-ignore-special"))
(use-rule-set :run 1
	      :rule-set ("en-resolve-diacritics" "en-ignore-special"))
(use-rule-set :run 2
	      :rule-set ("en-resolve-case" "en-ignore-special"))
(use-rule-set :run 3
	      :rule-set ("en-resolve-special"))

%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</samplexdy-mc.xdy>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*database1.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
 % This is a sample database of glossary entries
 % Only those entries used in the document with \glslink, \gls,
 % \glspl, and uppercase variants will have entries in the
 % glossary. Note that the type key is not used, as the
 % glossary type can be specified in \loadglsentries

\newglossaryentry{array}{name=array,
description={A list of values identified by a numeric value}}

\newglossaryentry{binary}{name=binary,
description={Pertaining to numbers represented in base 2}}

\newglossaryentry{comment}{name=comment,
description={A remark that doesn't affect the meaning of the 
code}}

\newglossaryentry{global}{name=global,
description={Something that maintains its state when it leaves
the current group}}

\newglossaryentry{local}{name=local,
description={Something that only maintains its state until
it leaves the group in which it was defined/changed}}

%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</database1.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*database2.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
 % This is a sample database of glossary entries
 % Only those entries used in the document with \glslink, \gls,
 % \glspl, and uppercase variants will have entries in the
 % glossary. Note that the type key is not used, as the
 % glossary type can be specified in \loadglsentries

 % Don't need to worry about makeindex special characters
\newglossaryentry{quote}{name={"},
description={the double quote symbol}}

\newglossaryentry{at}{name={@},
description={the ``at'' symbol}}

\newglossaryentry{excl}{name={!},
description={the exclamation mark symbol}}

\newglossaryentry{bar}{name={$|$},
description={the vertical bar symbol}}

\newglossaryentry{hash}{name={\#},
description={the hash symbol}}

%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</database2.tex>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*glossaries.perl>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
# File          : glossaries.perl
# Author        : Nicola L.C. Talbot
# Date          : 14th June 2007
# Last Modified : 25th July 2008
# Version       : 1.04
# Description   : LaTeX2HTML (limited!) implementation of glossaries 
#                  package. Note that not all the glossaries.sty
#                  macros have been implemented.

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

# This work consists of the files glossaries.dtx and glossaries.ins 
# and the derived files glossaries.sty, glossary-hypernav.sty, 
# glossary-list.sty, glossary-long.sty, glossary-super.sty, 
# glossaries.perl. Also makeglossaries and makeglossaries.bat


package main;

# These are the only package options implemented.

sub do_glossaries_style_altlist{
}

sub do_glossaries_toc{
}

sub do_glossaries_toc_true{
}

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

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

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

 %glsentry = ();

$acronymtype = 'main';

sub do_glossaries_acronym{
   &do_glossaries_acronym_true
}

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

sub do_glossary_acronym_false{
   $acronymtype = 'main';
}

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

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

# modify set_depth_levels so that glossary is added

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

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

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

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

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

}

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

sub gloskeysort{
   local($x, $y) = ($a, $b);
   $x=~s/^(.*)###(\d+)$/\l\1/;
   local($x_id) = $2;
   $y=~s/^(.*)###(\d+)$/\l\1/;
   local($y_id) = $2;

   local($n) = ($x cmp $y);

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

   $n;
}

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

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

   @keys = sort gloskeysort @keys;

   $level = 0;

   $delimN = $delimN{$type};

   foreach $key (@keys)
   {
      $current = $key;
      $str = $current;
      $str =~ s/\#\#\#\d+$//o; # Remove the unique id's
      #$linktext = $cross_ref_visible_mark;
      $id = ++$global{'max_id'};
      $linktext = "\\$glossary_format{$type}{$key}${OP}$id${CP}$glossary_linktext{$type}{$key}${OP}$id${CP}";
      $linktext = &translate_commands($linktext);

      local($entry) = $glossary_entry{$type}{$key};

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

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

      $glossary .=
      # If it's the same string don't start a new line
         (&index_key_eq($current, $previous) ?
               $delimN
               . $glossary{$type}{$key}
               . $linktext
               . "</A>"
            : "<DT>"
                   . "<A NAME=\"gls:$entry\">$name</A>"
                   . "<DD>"
                   . $glsentry{$entry}{'description'} 
                   . $symbol . $GLOSSARY_END_DESCRIPTION
                   . $glossary{$type}{$key}
         . $linktext. "</A>");
      $previous = $current;
   }
    $glossary = '<DD>'.$glossary unless ($glossary =~ /^\s*<D(T|D)>/);

    $glossary =~ s/(<A [^>]*>)(<D(T|D)>)/$2$1/g;

    $str = &translate_commands("\\glossarypostamble");
    s/$gls_mark{$type}/$preglossary\n<DL COMPACT>\n$glossary<\/DL>$str\n/s;
}

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

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

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

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

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

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

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

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

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

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

   ($value,$_);
}

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

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

   ($value,$_);
}

# This is modified from do_cmd_textohtmlindex

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

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

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

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

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

sub make_textohtmlglossary{
   local($type,$toctitle,$title,$style) = @_;

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

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

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

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

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

   $TITLE=&translate_commands($toctitle);

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

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

   local $idx_head = $section_headings{'textohtmlindex'};
   local($heading) = join(''
        , &make_section_heading($title, $idx_head)
        , $gls_mark{$type} );
   local($pre,$post) = &minimize_open_tags($heading);
   join('',"<BR>\n" , $pre);
}

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

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

   $_;
}

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

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

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

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

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

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

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

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

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

    local($sort) = $glsentry{$entry}{'sort'};

    # Save the reference
    local($str) = "$sort###" . ++$global{'max_id'}; # Make unique
    # concatenate multiple spaces into a single space
    # otherwise keys won't sort properly
    $str=~s/\s+/ /gs;

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

    local($target) = $frame_body_name;

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

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

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

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

   ($opt,$pat) = &get_next_optional_argument;

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

   ($opt,$pat) = &get_next_optional_argument;

   &make_newglossarytype($type, $title);

   $_;
}

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

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

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

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

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

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

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

   "$text$insert" . $_;
}

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

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

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

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

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

   "$text$insert" . $_;
}

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

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

   $display;
}

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

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

   $display;
}

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

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

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

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

   ($opt,$pat) = &get_next_optional_argument;

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

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

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

   &translate_commands($cmd).$_;
}

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

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

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

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

   $type;
}

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

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

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

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

   $name;
}

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

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

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

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

   $description;
}

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

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

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

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

   $symbol;
}

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

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

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

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

   $sort;
}

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

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

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

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

   $text;
}

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

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

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

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

   $plural;
}

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

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

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

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

   $firstplural;
}

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

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

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

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

   $first;
}

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

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

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

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

   $flag;
}

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

   defined(%{$glsentry{$label}});
}

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

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

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

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

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

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

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

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

   &gls_set_sort($label, $sort);

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

   &gls_set_text($label, $text);

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

   &gls_set_first($label, $first);

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

   &gls_set_plural($label, $plural);

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

   &gls_set_firstplural($label, $firstplural);

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

   $_;
}

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

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

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

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

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

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

   &reset_entry($label);

   $_;
}

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

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

   &unset_entry($label);

   $_;
}

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

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

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

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

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

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

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

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

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

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

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

   local($oldfmt) = $GLSCURRENTFORMAT;

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

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

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

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

   $str;
}

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

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

   $type = &gls_get_type($label);

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

      &gls_add_entry($type,$label,$format,"");
   }
   else
   {
      &write_warnings("gls_add: glossary entry '$label' undefined");
      $str = '';
   }

   $str . $_;
}

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

   local($format,$types);

   ($type,$optarg) = &get_keyval('types', $optarg);

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

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

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

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

      foreach $label (@{$gls_entries{$type}})
      {
         &gls_add_entry($type,$label,$format,"");
      }
   }

   $_;
}

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

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

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

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

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

   $_;
}

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

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

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

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

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

   $_;
}

$glslabel = '';

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

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

   $glslabel = $label;

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

   $str;
}

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

   ($optarg,$pat) = &get_next_optional_argument;

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

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

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

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

   $type = &gls_get_type($label);

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

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

   ($optarg,$pat) = &get_next_optional_argument;

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

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

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

   $type = &gls_get_type($label);

   $text . $_;
}

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

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

   &gls_get_description($label).$_;
}

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

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

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

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

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

   &gls_get_text($label).$_;
}

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

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

   ucfirst(&gls_get_text($label)).$_;
}

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

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

   &gls_get_name($label).$_;
}

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

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

   ucfirst(&gls_get_name($label)).$_;
}

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

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

   &gls_get_first($label).$_;
}

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

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

   ucfirst(&gls_get_first($label)).$_;
}

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

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

   &gls_get_plural($label).$_;
}

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

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

   ucfirst(&gls_get_plural($label)).$_;
}

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

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

   local($text)=$glsentry{$label}{'firstplural'};

   unless (defined($text))
   {
      &write_warnings("glossary entry '$label' has not been defined");
      $text = '';
   }

   "$text$_";
   &gls_get_firstplural($label).$_;
}

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

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

   ucfirst(&gls_get_firstplural($label)).$_;
}

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

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

   &gls_get_symbol($label).$_;
}

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

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

   ucfirst(&gls_get_symbol($label)).$_;
}

sub do_cmd_gls{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_text($label);
      $display = &gls_get_display($type);
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_first($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &translate_commands("$display$args");

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

# added v1.04
sub do_cmd_glsstar{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_text($label);
      $display = &gls_get_display($type);
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_first($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &translate_commands("$display$args");

   $link_text . $space . $_;
}

sub do_cmd_glspl{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = $glsentry{$label}{'type'};

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_plural($label);
      $display = &gls_get_display($type);;
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_firstplural($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &translate_commands("$display$args");

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

# added v1.04
sub do_cmd_glsplstar{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = $glsentry{$label}{'type'};

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_plural($label);
      $display = &gls_get_display($type);;
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_firstplural($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &translate_commands("$display$args");

   $link_text . $space . $_;
}

sub do_cmd_Gls{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = $glsentry{$label}{'type'};

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_text($label);
      $display = &gls_get_display($type);;
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_first($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &translate_commands("$display$args");

   &make_glslink($type, $label, $format, ucfirst($link_text)). $space . $_;
}

# added v1.04
sub do_cmd_Glsstar{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = $glsentry{$label}{'type'};

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_text($label);
      $display = &gls_get_display($type);;
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_first($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &translate_commands("$display$args");

   ucfirst($link_text). $space . $_;
}

sub do_cmd_Glspl{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = $glsentry{$label}{'type'};

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_plural($label);
      $display = &gls_get_display($type);;
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_firstplural($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &translate_commands("$display$args");

   &make_glslink($type, $label, $format, ucfirst($link_text)).$space . $_;
}

# added v1.04
sub do_cmd_Glsplstar{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = $glsentry{$label}{'type'};

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_plural($label);
      $display = &gls_get_display($type);;
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_firstplural($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &translate_commands("$display$args");

   ucfirst($link_text).$space . $_;
}

sub do_cmd_GLS{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = $glsentry{$label}{'type'};

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_text($label);
      $display = &gls_get_display($type);;
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_first($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &translate_commands("$display$args");

   &make_glslink($type, $label, $format, uc($link_text)).$space . $_;
}

# added v1.04
sub do_cmd_GLSstar{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = $glsentry{$label}{'type'};

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_text($label);
      $display = &gls_get_display($type);;
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_first($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &translate_commands("$display$args");

   uc($link_text).$space . $_;
}

sub do_cmd_GLSpl{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = $glsentry{$label}{'type'};

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_plural($label);
      $display = &gls_get_display($type);;
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_firstplural($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &translate_commands("$display$args");

   &make_glslink($type, $label, $format, uc($link_text)).$space . $_;
}

# added v1.04
sub do_cmd_GLSplstar{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

   local($type) = $glsentry{$label}{'type'};

   if (&gls_used($label))
   {
      # entry has already been used

      $text = &gls_get_plural($label);
      $display = &gls_get_display($type);;
   }
   else
   {
      # entry hasn't been used

      $text = &gls_get_firstplural($label);
      $display = &gls_get_displayfirst($type);

      &unset_entry($label);
   }

   local($args) = '';

   local($id) = ++$global{'max_id'};
   $args .= "$OP$id$CP$text$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP";

   $id = ++$global{'max_id'};
   $args .= "$OP$id$CP$insert$OP$id$CP";

   local($link_text) = &translate_commands("$display$args");

   uc($link_text).$space . $_;
}

# added 22 Feb 2008
sub do_cmd_glstext{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_text($label);

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

# added 22 Feb 2008
sub do_cmd_Glstext{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_text($label);

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

# added 22 Feb 2008
sub do_cmd_GLStext{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_text($label);

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

# added 22 Feb 2008
sub do_cmd_glsname{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_name($label);

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

# added 22 Feb 2008
sub do_cmd_Glsname{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_name($label);

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

# added 22 Feb 2008
sub do_cmd_GLSname{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_name($label);

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

# added 22 Feb 2008
sub do_cmd_glsfirst{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_first($label);

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

# added 22 Feb 2008
sub do_cmd_Glsfirst{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_first($label);

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

# added 22 Feb 2008
sub do_cmd_GLSfirst{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_first($label);

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

# added 22 Feb 2008
sub do_cmd_glsfirstplural{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_firstplural($label);

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

# added 22 Feb 2008
sub do_cmd_Glsfirstplural{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_firstplural($label);

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

# added 22 Feb 2008
sub do_cmd_GLSfirstplural{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_firstplural($label);

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

# added 22 Feb 2008
sub do_cmd_glsplural{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_plural($label);

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

# added 22 Feb 2008
sub do_cmd_Glsplural{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_plural($label);

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

# added 22 Feb 2008
sub do_cmd_GLSplural{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_plural($label);

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

# added 22 Feb 2008
sub do_cmd_glsdesc{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_description($label);

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

# added 22 Feb 2008
sub do_cmd_Glsdesc{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_description($label);

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

# added 22 Feb 2008
sub do_cmd_GLSdesc{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_description($label);

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

# added 22 Feb 2008
sub do_cmd_glssymbol{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_symbol($label);

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

# added 22 Feb 2008
sub do_cmd_Glssymbol{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_symbol($label);

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

# added 22 Feb 2008
sub do_cmd_GLSsymbol{
   local($_) = @_;
   local($optarg,$pat,$label,$text, $format, $insert);

   ($optarg,$pat) = &get_next_optional_argument;

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

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

   local ($space) = '';
   if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';}

   $insert = '';
   ($insert,$pat) = &get_next_optional_argument;

   local($display) = '';

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

   $text = &gls_get_symbol($label);

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

sub do_cmd_acrshort{
  &do_cmd_glstext(@_)
}

sub do_cmd_Acrshort{
  &do_cmd_Glstext(@_)
}

sub do_cmd_ACRshort{
  &do_cmd_GLStext(@_)
}

sub do_cmd_acrlong{
  &do_cmd_glsdesc(@_)
}

sub do_cmd_Acrlong{
  &do_cmd_Glsdesc(@_)
}

sub do_cmd_ACRlong{
  &do_cmd_GLSdesc(@_)
}

sub do_cmd_acrfull{
  &do_cmd_glsfirst(@_)
}

sub do_cmd_Acrfull{
  &do_cmd_Glsfirst(@_)
}

sub do_cmd_ACRfull{
  &do_cmd_GLSfirst(@_)
}

sub do_cmd_glossarypreamble{
   local($_) = @_;
   $_[0];
}

sub do_cmd_glossarypostamble{
   local($_) = @_;
   $_[0];
}

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

   $_;
}

sub do_cmd_hyperit{
   join('', "\\textit ", $_[0]);
}

sub do_cmd_hyperrm{
   join('', "\\textrm ", $_[0]);
}

sub do_cmd_hypertt{
   join('', "\\texttt ", $_[0]);
}

sub do_cmd_hypersf{
   join('', "\\textsf ", $_[0]);
}

sub do_cmd_hyperbf{
   join('', "\\textbf ", $_[0]);
}

&ignore_commands( <<_IGNORED_CMDS_ );
makeglossary
makeglossaries
glossarystyle {}
_IGNORED_CMDS_

1;
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%</glossaries.perl>
%    \end{macrocode}
%\fi
%\Finale
\endinput
