%%
%% This is file `testidx-glossaries.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% testidx.dtx  (with options: `testidx-glossaries.sty,package')
%% 
%%  testidx.dtx
%%  Copyright 2017 Nicola 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 or (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 testidx.dtx and testidx.ins and the derived files testidx.sty, testidx-glossaries.sty, testidx-glossaries-diglyphs.tex, testidx-glossaries-nodiglyphs.tex, testidx-glossaries-samples.tex, testidx-glossaries-diglyphs-utf8.bib, testidx-glossaries-markers.bib, testidx-glossaries-mathsym.bib, testidx-glossaries-nodiglyphs-utf8.bib, testidx-glossaries-nodiglyphs.bib, testidx-glossaries-numbers.bib, testidx-glossaries-samples-ascii.bib, testidx-glossaries-samples-utf8.bib, testidx-glossaries-samples.bib.
%% 
%% \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         \~}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{testidx-glossaries}[2017/08/11 v1.1 (NLCT)]
\newcommand*{\tstidx@glossariespkg}{glossaries}
\@ifpackageloaded{glossaries}
{%
  \newcommand*{\tstidx@setupglossaries}[1]{\setupglossaries{#1}}%
}%
{%
  \newcommand*{\tstidx@setupglossaries}[1]{%
    \PassOptionsToPackage{#1}{glossaries}%
  }
}
\@ifpackageloaded{glossaries-extra}
{%
  \newcommand*{\tstidx@setupglossariesextra}[1]{\glossariesextrasetup{#1}}%
}%
{%
  \newcommand*{\tstidx@setupglossariesextra}[1]{%
    \PassOptionsToPackage{#1}{glossaries-extra}%
  }
}
\newcommand*{\tstidx@usemakegloss}{\PackageError{testidx-glossaries}{You
need to put \string\tstidxmakegloss\MessageBreak in the preamble in order
to use\MessageBreak \string\testidx\space with testidx-glossaries}{}}
\newcommand*{\tstidxmakegloss}[1][]{%
 \@tstidx@ifgerman{\GlsSetQuote{+}}{}%
 \tstidxdefaultmakegloss
}
\newcommand*{\tstidxprintglossaries}{\printglossaries}
\newcommand*{\tstidxprintglossary}{\printglossary}
\newcommand*{\tstidxtexfiles}{testidx-glossaries-samples,\tstidxglyphfile}
\newcommand*{\tstidxbasebibfiles}{testidx-glossaries-samples}
\newcommand*{\tstidxasciibibfiles}{testidx-glossaries-samples-ascii}
\newcommand*{\tstidxutfbibfiles}{testidx-glossaries-samples-utf8}

\newcommand*{\tstidxloadsamples}{%
 \@for\tstidxfile:=\tstidxtexfiles\do{\input{\tstidxfile}}%
 \renewcommand*{\tstidx@usemakegloss}{}%
}
\newcommand*{\tstidxdefaultmakegloss}{%
 \makeglossaries
 \tstidxloadsamples
}
\newcommand*{\tstidxnoidxmakegloss}{%
 \makenoidxglossaries
 \tstidxloadsamples
}
\newcommand*{\tstidxbibmakegloss}[1]{%
  \def\@tstidx@resourceargs{}%
  \@tstidx@ifutfviii
  {%
    \def\@tstidx@resource@src{\tstidxbasebibfiles,%
      \tstidxutfbibfiles,%
      \tstidxglyphfile-utf8}%
  }%
  {%
    \def\@tstidx@resource@src{\tstidxbasebibfiles,%
      \tstidxasciibibfiles,%
       testidx-glossaries-nodiglyphs}%
  }%
  \if@tstidx@setdescription
    \if@tstidx@useglsseekey
      \def\@tstidx@resourceargs{selection={recorded and deps and see}}%
    \else
      \def\@tstidx@resourceargs{ignore-fields={see,seealso}}%
    \fi
  \else
    \if@tstidx@useglsseekey
      \def\@tstidx@resourceargs{%
        selection={recorded and deps and see},
        ignore-fields={description}}%
    \else
      \def\@tstidx@resourceargs{%
        ignore-fields={description,see,seealso}}%
    \fi
  \fi
  \iftestidxprefix
    \tstidxloadglsresource{src={testidx-glossaries-mathsym},%
      group={Maths},sort={letter-case},\@tstidx@resourceargs}%
    \tstidxloadglsresource{src={testidx-glossaries-markers},%
      group={Markers},sort={letter-case},\@tstidx@resourceargs}%
    \iftstidxnumbergroup
      \tstidxloadglsresource{src={testidx-glossaries-numbers},%
        sort={integer},\@tstidx@resourceargs}%
      \tstidxloadglsresource{src={\@tstidx@resource@src},%
        \@tstidx@resourceargs,#1}%
    \else
      \tstidxloadglsresource{src={testidx-glossaries-numbers,%
         \@tstidx@resource@src},%
        \@tstidx@resourceargs,#1}%
    \fi
  \else
    \iftstidxnumbergroup
      \tstidxloadglsresource{src={testidx-glossaries-numbers},%
        sort={integer},\@tstidx@resourceargs}%
      \tstidxloadglsresource{%
        src={testidx-glossaries-mathsym,%
             testidx-glossaries-markers,%
            \@tstidx@resource@src},%
        \@tstidx@resourceargs,#1}%
    \else
      \tstidxloadglsresource{%
        src={testidx-glossaries-mathsym,%
             testidx-glossaries-markers,%
             testidx-glossaries-numbers,%
            \@tstidx@resource@src},%
        \@tstidx@resourceargs,#1}%
    \fi
  \fi
  \renewcommand*{\tstidx@usemakegloss}{}%
}
\newcommand{\tstidxloadglsresource}[1]{%
  \iftestidxverbose
    \PackageInfo{testidx-glossaries}{\string\GlsXtrLoadResources[#1]}%
  \fi
  \GlsXtrLoadResources[#1]%
}
\newif\if@tstidx@useglsseekey
\@tstidx@useglsseekeytrue
\DeclareOption{seekey}{\@tstidx@useglsseekeytrue}
\DeclareOption{noseekey}{\@tstidx@useglsseekeyfalse}
\newif\if@tstidx@setdescription
\@tstidx@setdescriptionfalse
\DeclareOption{desc}{\@tstidx@setdescriptiontrue}
\DeclareOption{nodesc}{\@tstidx@setdescriptionfalse}
\DeclareOption{extra}{\renewcommand*{\tstidx@glossariespkg}{glossaries-extra}}
\DeclareOption{noextra}{\renewcommand*{\tstidx@glossariespkg}{glossaries}}
\newcommand*{\@testidx@ifusebibgls}[2]{#2}
\DeclareOption{makeindex}{%
  \let\@testidx@ifusebibgls\@secondoftwo
  \tstidx@setupglossaries{makeindex}%
  \renewcommand*{\tstidxmakegloss}[1][]{%
    \@tstidx@ifgerman{\GlsSetQuote{+}}{}%
    \tstidxdefaultmakegloss
  }%
  \renewcommand*{\tstidxprintglossaries}{\printglossaries}%
  \renewcommand*{\tstidxprintglossary}{\printglossary}%
}
\DeclareOption{xindy}{%
  \let\@testidx@ifusebibgls\@secondoftwo
  \tstidx@setupglossaries{xindy}%
  \renewcommand*{\tstidxmakegloss}[1][]{%
    \tstidxdefaultmakegloss
  }%
  \renewcommand*{\tstidxprintglossaries}{\printglossaries}%
  \renewcommand*{\tstidxprintglossary}{\printglossary}%
}
\DeclareOption{tex}{%
  \let\@testidx@ifusebibgls\@secondoftwo
  \renewcommand*{\tstidxmakegloss}[1][]{%
    \tstidxnoidxmakegloss
  }%
  \renewcommand*{\tstidxprintglossaries}{\printnoidxglossaries}%
  \renewcommand*{\tstidxprintglossary}{\printnoidxglossary}%
}
\DeclareOption{bib2gls}{%
  \renewcommand*{\tstidx@glossariespkg}{glossaries-extra}%
  \let\@testidx@ifusebibgls\@firstoftwo
  \tstidx@setupglossariesextra{record}%
  \renewcommand*{\tstidxmakegloss}[1][]{%
    \tstidxbibmakegloss{#1}%
  }%
  \renewcommand*{\tstidxprintglossaries}{\printunsrtglossaries}%
  \renewcommand*{\tstidxprintglossary}{\printunsrtglossary}%
}
\DeclareOption{manual}{%
 \renewcommand*{\tstidx@usemakegloss}{}%
  \renewcommand*{\tstidxmakegloss}[1][]{%
    \PackageWarning{testidx-glossaries}{\string\tstidxmakegloss\space
     disabled by `manual' package option}%
  }%
  \renewcommand*{\tstidxprintglossaries}{%
    \PackageWarning{testidx-glossaries}{\string\tstidxprintglossaries\space
     disabled by `manual' package option}%
  }%
  \renewcommand*{\tstidxprintglossary}{%
    \PackageWarning{testidx-glossaries}{\string\tstidxprintglossary\space
     disabled by `manual' package option}%
  }%
}
\newif\iftstidxnumbergroup
\tstidxnumbergrouptrue
\DeclareOption{noglsnumbers}{\tstidxnumbergroupfalse}
\DeclareOption{glsnumbers}{\tstidxnumbergrouptrue}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{testidx}}
\ProcessOptions
\RequirePackage{testidx}
\@tstidx@ifsanitize
 {\tstidx@setupglossaries{sanitizesort=true}}
 {\tstidx@setupglossaries{sanitizesort=false}}
\RequirePackage{\tstidx@glossariespkg}
\RequirePackage{glossary-mcols}
\if@tstidx@setdescription
 \setupglossaries{nopostdot=false}
 \setglossarystyle{indexgroup}
\else
 \setupglossaries{nopostdot}
 \setglossarystyle{mcolindexgroup}
\fi
\ifglsxindy
\iftstidxnumbergroup
   \gls@xindy@glsnumberstrue
  \else
   \gls@xindy@glsnumbersfalse
  \fi
\fi
\newif\if@tstidx@hasseealsokey
\key@ifundefined{glossentry}{seealso}%
{\@tstidx@hasseealsokeyfalse}
{\@tstidx@hasseealsokeytrue}
\iftestidxverbose
 \appto\@newglossaryentryposthook{\@testidx@writeglsinfo}
 \newcommand\@testidx@writeglsinfo{%
   \letcs{\@tstidx@sort}{glo@\glsdetoklabel{\@glo@label}@sort}%
   \@onelevel@sanitize\@tstidx@sort
   \letcs{\@tstidx@name}{glo@\glsdetoklabel{\@glo@label}@name}%
   \@onelevel@sanitize\@tstidx@name
   \letcs{\@tstidx@text}{glo@\glsdetoklabel{\@glo@label}@text}%
   \@onelevel@sanitize\@tstidx@text
   \ifcsdef{glo@\glsdetoklabel{\@glo@label}@parent}%
   {\letcs\@tstidx@parent{glo@\glsdetoklabel{\@glo@label}@parent}}%
   {\def\@tstidx@parent{}}%
   \PackageInfo{testidx-glossaries}{new term label={\@glo@label},
    \MessageBreak
    name={\@tstidx@name},
    \MessageBreak
    sort={\@tstidx@sort},
    \MessageBreak
    text={\@tstidx@text},
    \MessageBreak
    parent={\@tstidx@parent},
    \MessageBreak
    see={\@glo@see}%
    \if@tstidx@hasseealsokey
      ,\MessageBreak
      seealso={\@glo@seealso}
    \fi
    \MessageBreak
    }%
 }
 \let\tstidx@org@glo@sortedinsert\@glo@sortedinsert
 \renewcommand{\@glo@sortedinsert}[2]{%
   \typeout{#2}%
   \tstidx@org@glo@sortedinsert{#1}{#2}%
 }
\fi
\ifdef\glosortentrieswarning
{}
{%
  \let\tstidx@org@glo@sortentries\@glo@sortentries
  \renewcommand{\@glo@sortentries}[2]{%
    \typeout{Using TeX to sort entries---this may take a while}%
    \tstidx@org@glo@sortentries{#1}{#2}%
  }
}
\newcommand*{\@tstidx@usemakegloss}{\tstidx@usemakegloss}
\newcommand*{\tstidxtoidx}{%
 \renewcommand*{\@tstidx@usemakegloss}{}%
 \let\@tstindex\@tstidx@org@index
 \let\@tstidxwordpl\@tstidx@org@wordpl
 \let\@tstidxphrasepl\@tstidx@org@phrasepl
 \let\@tstidxcs\@tstidx@org@cs
 \let\@tstindexpost\@tstidx@org@indexpost
 \let\@tstindexopenpost\@tstidx@org@indexopenpost
 \let\@tstindexclosepost\@tstidx@org@indexclosepost
 \let\@tstindexpre\@tstidx@org@indexpre
 \let\@tstindexopenpre\@tstidx@org@indexopenpre
 \let\@tstindexclosepre\@tstidx@org@indexclosepre
 \let\@tstindexsee\@tstidx@org@indexsee
 \let\@tstidx@indexsubsee\@tstidx@org@indexsubsee
 \let\@tstidx@subindexpost\@tstidx@org@subindexpost
 \let\@tstidx@subindexopenpost\@tstidx@org@subindexopenpost
 \let\@tstidx@subindexclosepost\@tstidx@org@subindexclosepost
 \let\@tstidx@subindexpre\@tstidx@org@subindexpre
 \let\@tstidx@subindexopenpre\@tstidx@org@subindexopenpre
 \let\@tstidx@subindexclosepre\@tstidx@org@subindexclosepre
 \let\@@tstidx@subsubindexpost\@tstidx@org@subsubindexpost
 \let\@@tstidx@subsubindexopenpost\@tstidx@org@subsubindexopenpost
 \let\@@tstidx@subsubindexclosepost\@tstidx@org@subsubindexclosepost
 \let\@@tstidx@subsubindexpre\@tstidx@org@subsubindexpre
 \let\@@tstidx@subsubindexopenpre\@tstidx@org@subsubindexopenpre
 \let\@@tstidx@subsubindexclosepre\@tstidx@org@subsubindexclosepre
 \let\@tidx@par@i\@tidx@org@par@i
 \let\@tidx@par@ii\@tidx@org@par@ii
 \let\@tidx@par@iii\@tidx@org@par@iii
 \let\@tidx@par@iv\@tidx@org@par@iv
 \let\@tidx@par@vi\@tidx@org@par@vi
 \let\@tidx@mathslettergroup\@tidx@org@mathslettergroup
 \let\@tidx@numberlettergroup\@tidx@org@numberlettergroup
 \let\@tidx@scriptnote\@tidx@org@scriptnote
 \let\@tidx@sanitizenote\@tidx@org@sanitizenote
 \let\@tidx@stripaccentsnote\@tidx@org@stripaccentsnote
}
\newcommand*{\tstidxtogls}{%
 \renewcommand*{\@tstidx@usemakegloss}{\tstidx@usemakegloss}%
 \let\@tstindex\@tstidx@org@index
 \let\@tstidxwordpl\@tstidx@gls@wordpl
 \let\@tstidxphrasepl\@tstidx@gls@phrasepl
 \let\@tstidxcs\@tstidx@gls@cs
 \let\@tstindexpost\@tstidx@gls@indexpost
 \let\@tstindexopenpost\@tstidx@gls@indexopenpost
 \let\@tstindexclosepost\@tstidx@gls@indexclosepost
 \let\@tstindexpre\@tstidx@gls@indexpre
 \let\@tstindexopenpre\@tstidx@gls@indexopenpre
 \let\@tstindexclosepre\@tstidx@gls@indexclosepre
 \let\@tstindexsee\@tstidx@gls@indexsee
 \let\@tstidx@indexsubsee\@tstidx@gls@indexsubsee
 \let\@tstidx@subindexpost\@tstidx@gls@subindexpost
 \let\@tstidx@subindexopenpost\@tstidx@gls@subindexopenpost
 \let\@tstidx@subindexclosepost\@tstidx@gls@subindexclosepost
 \let\@tstidx@subindexpre\@tstidx@gls@subindexpre
 \let\@tstidx@subindexopenpre\@tstidx@gls@subindexopenpre
 \let\@tstidx@subindexclosepre\@tstidx@gls@subindexclosepre
 \let\@@tstidx@subsubindexpost\@tstidx@gls@subsubindexpost
 \let\@@tstidx@subsubindexopenpost\@tstidx@gls@subsubindexopenpost
 \let\@@tstidx@subsubindexclosepost\@tstidx@gls@subsubindexclosepost
 \let\@@tstidx@subsubindexpre\@tstidx@gls@subsubindexpre
 \let\@@tstidx@subsubindexopenpre\@tstidx@gls@subsubindexopenpre
 \let\@@tstidx@subsubindexclosepre\@tstidx@gls@subsubindexclosepre
 \let\@tidx@par@i\@tidx@gls@par@i
 \let\@tidx@par@ii\@tidx@gls@par@ii
 \let\@tidx@par@iii\@tidx@gls@par@iii
 \let\@tidx@par@iv\@tidx@gls@par@iv
 \let\@tidx@par@vi\@tidx@gls@par@vi
 \let\@tidx@mathslettergroup\@tidx@gls@mathslettergroup
 \let\@tidx@numberlettergroup\@tidx@gls@numberlettergroup
 \let\@tidx@scriptnote\@tidx@gls@scriptnote
 \let\@tidx@sanitizenote\@tidx@gls@sanitizenote
 \let\@tidx@stripaccentsnote\@tidx@gls@stripaccentsnote
}
\renewcommand*{\testidx}{%
  \@tstidx@usemakegloss
  \@ifstar
  {%
    \def\@testidx@block@sep{\space}%
    \@testidx
  }%
  {%
    \def\@testidx@block@sep{\tstidxdefblocksep}%
    \@testidx
  }%
}
\iftestidxdiglyphs
  \newcommand*{\tstidxglyphfile}{testidx-glossaries-diglyphs}
\else
  \newcommand*{\tstidxglyphfile}{testidx-glossaries-nodiglyphs}
\fi
\@ifpackageloaded{glossaries-extra}
{
  \newcommand*{\tstidxnewentry}[3]{\newglossaryentry{#1}{category={#2},#3}}
}
{
  \newcommand*{\tstidxnewentry}[3]{\newglossaryentry{#1}{#3}}
}
\newcommand*{\@tstidx@gls@index}[1]{}
\let\@tstidx@org@index\@tstindex
\let\@tstindex\@tstidx@gls@index
\newcommand*{\@tstidx@gls@wordpl}[2]{%
 {\def\tstidx@gls{\glspl}\def\tstidx@glsentry{\glsentryplural}%
  \tstidxword[#1]{#2}%
 }%
}
\let\@tstidx@org@wordpl\@tstidxwordpl
\let\@tstidxwordpl\@tstidx@gls@wordpl
\newcommand*{\@tstidx@gls@phrasepl}[2]{%
 {\def\tstidx@gls{\glspl}\def\tstidx@glsentry{\glsentryplural}%
  \tstidxphrase[#1]{#2}%
 }%
}
\let\@tstidx@org@phrasepl\@tstidxphrasepl
\let\@tstidxphrasepl\@tstidx@gls@phrasepl
\newcommand*{\@tstidx@gls@cs}[2]{%
 \tstidxfmtpost{cs.#2}{\tstidxcsfmt}{#1}%
}
\let\@tstidx@org@cs\@tstidxcs
\let\@tstidxcs\@tstidx@gls@cs
\newcommand*{\tstidx@gls}{\gls}
\newcommand*{\tstidx@glsentry}{\glsentrytext}
\newcommand*{\tstidx@label}{\glslabel}
\newcommand*{\tstidx@encap}{}
\newcommand*{\tstidx@range}{}
\newcommand*{\tstidx@openrange}{(}
\newcommand*{\tstidx@closerange}{)}
\newcommand*{\tstidx@levelmarker}[4]{%
  \ifcsdef{glo@#1@level}%
  {%
    \ifcase\csname glo@#1@level\endcsname
     #2\or#3\else#4%
    \fi
  }%
  {%
    #2%
  }%
}
\newcommand*{\tstidx@post@glstextformat}[1]{%
 \ifx\@tstidx@encap\@empty
  \iftestidxshowmarks
    \ifx\@tstidx@range\tstidx@openrange
      \tstidxtext{#1%
        \tstidx@levelmarker\@tstidx@label
         \tstidxopenmarker
         \tstidxopensubmarker
         \tstidxopensubsubmarker
      }%
    \else
      \ifx\@tstidx@range\tstidx@closerange
        \tstidxtext{#1%
          \tstidx@levelmarker\@tstidx@label
           \tstidxclosemarker
           \tstidxclosesubmarker
           \tstidxclosesubsubmarker
        }%
      \else
        \tstidxtext{#1%
          \tstidx@levelmarker\@tstidx@label
           \tstidxmarker
           \tstidxsubmarker
           \tstidxsubsubmarker
        }%
      \fi
    \fi
  \else
    #1%
  \fi
 \else
   \iftestidxshowmarks
     \tstidxtext{\tstidxencaptext{\@tstidx@encap}{#1%
      \tstidx@levelmarker\@tstidx@label
       \tstidxmarker
       \tstidxsubmarker
       \tstidxsubsubmarker
     }}%
   \else
     #1%
   \fi
  \fi
}
\newcommand*{\tstidx@pre@glstextformat}[1]{%
 \ifx\@tstidx@encap\@empty
  \iftestidxshowmarks
    \ifx\@tstidx@range\tstidx@openrange
      \tstidxtext{%
        \tstidx@levelmarker\@tstidx@label
         \tstidxopenmarker
         \tstidxopensubmarker
         \tstidxopensubsubmarker
        #1}%
    \else
      \ifx\@tstidx@range\tstidx@closerange
        \tstidxtext{%
          \tstidx@levelmarker\@tstidx@label
           \tstidxclosemarker
           \tstidxclosesubmarker
           \tstidxclosesubsubmarker
        #1}%
      \else
        \tstidxtext{%
          \tstidx@levelmarker\@tstidx@label
           \tstidxmarker
           \tstidxsubmarker
           \tstidxsubsubmarker
         #1}%
      \fi
    \fi
  \else
    #1%
  \fi
 \else
  \iftestidxshowmarks
    \tstidxtext{\tstidxencaptext{\@tstidx@encap}{%
      \tstidx@levelmarker\@tstidx@label
       \tstidxmarker
       \tstidxsubmarker
       \tstidxsubsubmarker
    #1}}%
  \else
    #1%
  \fi
 \fi
}
\newcommand*{\@tstidx@zapnonlabel}[2]{%
 \ifx,#1\@empty\else\ifx'#1\@empty\else\ifx-#1\@empty\else#1\fi\fi\fi
 \ifx#2\@empty
 \else
  \expandafter\@tstidx@zapnonlabel
 \fi
 #2}
\newcommand*{\tstidx@getlabel}[1]{\@tstidx@zapnonlabel#1\@empty\@empty}
\newcommand*{\tstidx@glspreindex}[2][]{%
  \glshyperlink[\glstextformat{}]{#2}\glsadd[#1]{#2}}
\newcommand*{\tstidx@glspostindex}[2][]{%
 \glsadd[#1]{#2}\glshyperlink[\glstextformat{}]{#2}}
\def\@tstidx@gls@indexpost#1#2[#3]#4#5{%
  \bgroup
  \edef\@tstidx@label{\tstidx@getlabel{#3}}%
  \ifx\@tstidx@label\@empty
    \edef\@tstidx@label{\tstidx@getlabel{#1}}%
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#2}}%
    \fi
  \fi
  \def\@tstidx@encap{#4}%
  \def\@tstidx@range{}%
  \let\tstidx@org@glstextformat\glstextformat
  \renewcommand\glstextformat[1]{\tstidx@post@glstextformat
    {\tstidx@org@glstextformat{##1}}}%
  \ifx\relax#5\relax
    \ifx\@tstidx@encap\@empty
     \tstidx@glspostindex{\@tstidx@label}%
    \else
     \tstidx@glspostindex[format={#4}]{\@tstidx@label}%
    \fi
  \else
    \@ifundefined{glsxtrinitwrgloss}%
    {%
      \glshyperlink[\glstextformat{\tstidx@glsentry{\@tstidx@label}}]%
       {\@tstidx@label}%
      \ifx\@tstidx@encap\@empty
       \glsadd{\@tstidx@label}%
      \else
       \glsadd[format={#4}]{\@tstidx@label}%
      \fi
    }%
    {%
      \ifx\@tstidx@encap\@empty
       \tstidx@gls[wrgloss=after]{\@tstidx@label}%
      \else
       \tstidx@gls[wrgloss=after,format={#4}]{\@tstidx@label}%
      \fi
    }%
  \fi
  \egroup
}
\let\@tstidx@org@indexpost\@tstindexpost
\let\@tstindexpost\@tstidx@gls@indexpost
\def\@tstidx@gls@indexopenpost#1#2[#3]#4#5{%
  \bgroup
  \edef\@tstidx@label{\tstidx@getlabel{#3}}%
  \ifx\@tstidx@label\@empty
    \edef\@tstidx@label{\tstidx@getlabel{#1}}%
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#2}}%
    \fi
  \fi
  \def\@tstidx@encap{#4}%
  \def\@tstidx@range{(}%
  \let\tstidx@org@glstextformat\glstextformat
  \renewcommand\glstextformat[1]{\tstidx@post@glstextformat
    {\tstidx@org@glstextformat{##1}}}%
  \ifx\relax#5\relax
    \tstidx@glspostindex[format={(#4}]{\@tstidx@label}%
  \else
    \@ifundefined{glsxtrinitwrgloss}%
    {%
      \glshyperlink[\glstextformat{\tstidx@glsentry{\@tstidx@label}}]%
       {\@tstidx@label}%
      \glsadd[format={(#4}]{\@tstidx@label}%
    }%
    {%
      \tstidx@gls[wrgloss=after,format={(#4}]{\@tstidx@label}%
    }%
  \fi
  \egroup
}
\let\@tstidx@org@indexopenpost\@tstindexopenpost
\let\@tstindexopenpost\@tstidx@gls@indexopenpost
\def\@tstidx@gls@indexclosepost#1#2[#3]#4#5{%
  \bgroup
  \edef\@tstidx@label{\tstidx@getlabel{#3}}%
  \ifx\@tstidx@label\@empty
    \edef\@tstidx@label{\tstidx@getlabel{#1}}%
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#2}}%
    \fi
  \fi
  \def\@tstidx@encap{#4}%
  \def\@tstidx@range{)}%
  \let\tstidx@org@glstextformat\glstextformat
  \renewcommand\glstextformat[1]{\tstidx@post@glstextformat
    {\tstidx@org@glstextformat{##1}}}%
  \ifx\relax#5\relax
    \tstidx@glspostindex[format={)#4}]{\@tstidx@label}%
  \else
    \@ifundefined{glsxtrinitwrgloss}%
    {%
      \glshyperlink[\glstextformat{\tstidx@glsentry{\@tstidx@label}}]%
       {\@tstidx@label}%
      \glsadd[format={)#4}]{\@tstidx@label}%
    }%
    {%
      \tstidx@gls[wrgloss=after,format={)#4}]{\@tstidx@label}%
    }%
  \fi
  \egroup
}
\let\@tstidx@org@indexclosepost\@tstindexclosepost
\let\@tstindexclosepost\@tstidx@gls@indexclosepost
\def\@tstidx@gls@indexpre#1#2[#3]#4#5{%
  \bgroup
  \edef\@tstidx@label{\tstidx@getlabel{#3}}%
  \ifx\@tstidx@label\@empty
    \edef\@tstidx@label{\tstidx@getlabel{#1}}%
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#2}}%
    \fi
  \fi
  \def\@tstidx@encap{#4}%
  \def\@tstidx@range{}%
  \let\tstidx@org@glstextformat\glstextformat
  \renewcommand\glstextformat[1]{\tstidx@pre@glstextformat
    {\tstidx@org@glstextformat{##1}}}%
  \ifx\relax#5\relax
    \ifx\@tstidx@encap\@empty
     \tstidx@glspreindex{\@tstidx@label}%
    \else
     \tstidx@glspreindex[format={#4}]{\@tstidx@label}%
    \fi
  \else
    \ifx\@tstidx@encap\@empty
     \tstidx@gls{\@tstidx@label}%
    \else
     \tstidx@gls[format={#4}]{\@tstidx@label}%
    \fi
  \fi
  \egroup
}
\let\@tstidx@org@indexpre\@tstindexpre
\let\@tstindexpre\@tstidx@gls@indexpre
\def\@tstidx@gls@indexopenpre#1#2[#3]#4#5{%
  \bgroup
  \edef\@tstidx@label{\tstidx@getlabel{#3}}%
  \ifx\@tstidx@label\@empty
    \edef\@tstidx@label{\tstidx@getlabel{#1}}%
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#2}}%
    \fi
  \fi
  \def\@tstidx@encap{#4}%
  \def\@tstidx@range{(}%
  \let\tstidx@org@glstextformat\glstextformat
  \renewcommand\glstextformat[1]{\tstidx@pre@glstextformat
    {\tstidx@org@glstextformat{##1}}}%
  \ifx\relax#5\relax
    \tstidx@glspreindex[format={(#4}]{\@tstidx@label}%
  \else
    \tstidx@gls[format={(#4}]{\@tstidx@label}%
  \fi
  \egroup
}
\let\@tstidx@org@indexopenpre\@tstindexopenpre
\let\@tstindexopenpre\@tstidx@gls@indexopenpre
\def\@tstidx@gls@indexclosepre#1#2[#3]#4#5{%
  \bgroup
  \edef\@tstidx@label{\tstidx@getlabel{#3}}%
  \ifx\@tstidx@label\@empty
    \edef\@tstidx@label{\tstidx@getlabel{#1}}%
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#2}}%
    \fi
  \fi
  \def\@tstidx@encap{#4}%
  \def\@tstidx@range{)}%
  \let\tstidx@org@glstextformat\glstextformat
  \renewcommand\glstextformat[1]{\tstidx@pre@glstextformat
    {\tstidx@org@glstextformat{##1}}}%
  \ifx\relax#5\relax
    \tstidx@glspreindex[format={)#4}]{\@tstidx@label}%
  \else
    \tstidx@gls[format={)#4}]{\@tstidx@label}%
  \fi
  \egroup
}
\let\@tstidx@org@indexclosepre\@tstindexclosepre
\let\@tstindexclosepre\@tstidx@gls@indexclosepre
\providecommand*\seealsoname{see also}
\providecommand*\seename{see}
\newcommand*\tstidx@seealso{seealso}
\def\@tstidx@gls@indexsee#1#2#3#4[#5]#6{%
  \if@tstidx@useglsseekey
  \else
    \bgroup
    \edef\@tstidx@label{\tstidx@getlabel{#3}}%
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#1}}%
      \ifx\@tstidx@label\@empty
        \edef\@tstidx@label{\tstidx@getlabel{#2}}%
      \fi
    \fi
    \ifx\relax#5\relax
      \def\@tstidx@xrlabel{}%
      \def\@tstidx@xrlabel@sep{}%
      \@for\@tst@idxthis:=#6\do{%
        \edef\@tstidx@xrlabel{\@tstidx@xrlabel\@tstidx@xrlabel@sep
          \expandafter\tstidx@getlabel\expandafter{\@tst@idxthis}}%
        \def\@tstidx@xrlabel@sep{,}%
      }%
    \else
      \def\@tstidx@xrlabel{#5}%
    \fi
    \edef\@tstidx@seetag{#4}%
    \ifx\@tstidx@seetag\tstidx@seealso
     \if@tstidx@hasseealsokey
       \expandafter\glsxtrindexseealso\expandafter\@tstidx@label\expandafter
         {\@tstidx@xrlabel}%
     \else
       \expandafter\glssee\expandafter[\expandafter\seealsoname
         \expandafter]\expandafter\@tstidx@label\expandafter{\@tstidx@xrlabel}%
     \fi
    \else
     \expandafter\glssee\expandafter\@tstidx@label\expandafter
       {\@tstidx@xrlabel}%
    \fi
    \iftestidxshowmarks
      \ifx\relax#5\relax
       \tstidxseeref{#2}{tst#4ref}{#6}%
      \else
       \tstidxseeref{#2}{tst#4ref}{#5}%
      \fi
    \fi
    \egroup
  \fi
}
\let\@tstidx@org@indexsee\@tstindexsee
\let\@tstindexsee\@tstidx@gls@indexsee
\def\@tstidx@gls@subindexpost#1#2[#3]#4#5{%
  \bgroup
  \edef\@tstidx@label{\tstidx@getlabel{#3}}%
  \ifx\@tstidx@label\@empty
    \edef\@tstidx@label{\tstidx@getlabel{#1}}%
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#2}}%
    \fi
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#2}}%
    \fi
    \ifx\@tstidx@sort\empty
      \edef\@tstidx@label{%
        \expandafter\tstidx@getlabel\expandafter{\@tstidx@term}%
        .\@tstidx@label}%
    \else
      \edef\@tstidx@label{%
        \expandafter\tstidx@getlabel\expandafter{\@tstidx@sort}%
        .\@tstidx@label}%
    \fi
  \fi
  \def\@tstidx@encap{#4}%
  \def\@tstidx@range{}%
  \let\tstidx@org@glstextformat\glstextformat
  \renewcommand\glstextformat[1]{\tstidx@post@glstextformat
    {\tstidx@org@glstextformat{##1}}}%
  \ifx\relax#5\relax
    \ifx\@tstidx@encap\@empty
     \tstidx@glspostindex{\@tstidx@label}%
    \else
     \tstidx@glspostindex[format={#4}]{\@tstidx@label}%
    \fi
  \else
    \@ifundefined{glsxtrinitwrgloss}%
    {%
      \glshyperlink[\glstextformat{\tstidx@glsentry{\@tstidx@label}}]%
       {\@tstidx@label}%
      \ifx\@tstidx@encap\@empty
       \glsadd{\@tstidx@label}%
      \else
       \glsadd[format={#4}]{\@tstidx@label}%
      \fi
    }%
    {%
      \ifx\@tstidx@encap\@empty
       \tstidx@gls[wrgloss=after]{\@tstidx@label}%
      \else
       \tstidx@gls[wrgloss=after,format={#4}]{\@tstidx@label}%
      \fi
    }%
  \fi
  \egroup
}
\let\@tstidx@org@subindexpost\@tstidx@subindexpost
\let\@tstidx@subindexpost\@tstidx@gls@subindexpost
\def\@tstidx@gls@subindexopenpost#1#2[#3]#4#5{%
  \bgroup
  \edef\@tstidx@label{\tstidx@getlabel{#3}}%
  \ifx\@tstidx@label\@empty
    \edef\@tstidx@label{\tstidx@getlabel{#1}}%
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#2}}%
    \fi
    \ifx\@tstidx@sort\empty
      \edef\@tstidx@label{%
        \expandafter\tstidx@getlabel\expandafter{\@tstidx@term}%
        .\@tstidx@label}%
    \else
      \edef\@tstidx@label{%
        \expandafter\tstidx@getlabel\expandafter{\@tstidx@sort}%
        .\@tstidx@label}%
    \fi
  \fi
  \def\@tstidx@encap{#4}%
  \def\@tstidx@range{(}%
  \let\tstidx@org@glstextformat\glstextformat
  \renewcommand\glstextformat[1]{\tstidx@post@glstextformat
    {\tstidx@org@glstextformat{##1}}}%
  \ifx\relax#5\relax
    \tstidx@glspostindex[format={(#4}]{\@tstidx@label}%
  \else
    \@ifundefined{glsxtrinitwrgloss}%
    {%
      \glshyperlink[\glstextformat{\tstidx@glsentry{\@tstidx@label}}]%
       {\@tstidx@label}%
      \glsadd[format={(#4}]{\@tstidx@label}%
    }%
    {%
      \tstidx@gls[wrgloss=after,format={(#4}]{\@tstidx@label}%
    }%
  \fi
  \egroup
}
\let\@tstidx@org@subindexopenpost\@tstidx@subindexopenpost
\let\@tstidx@subindexopenpost\@tstidx@gls@subindexopenpost
\def\@tstidx@gls@subindexclosepost#1#2[#3]#4#5{%
  \bgroup
  \edef\@tstidx@label{\tstidx@getlabel{#3}}%
  \ifx\@tstidx@label\@empty
    \edef\@tstidx@label{\tstidx@getlabel{#1}}%
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#2}}%
    \fi
    \ifx\@tstidx@sort\empty
      \edef\@tstidx@label{%
        \expandafter\tstidx@getlabel\expandafter{\@tstidx@term}%
        .\@tstidx@label}%
    \else
      \edef\@tstidx@label{%
        \expandafter\tstidx@getlabel\expandafter{\@tstidx@sort}%
        .\@tstidx@label}%
    \fi
  \fi
  \def\@tstidx@encap{#4}%
  \def\@tstidx@range{)}%
  \let\tstidx@org@glstextformat\glstextformat
  \renewcommand\glstextformat[1]{\tstidx@post@glstextformat
    {\tstidx@org@glstextformat{##1}}}%
  \ifx\relax#5\relax
    \tstidx@glspostindex[format={)#4}]{\@tstidx@label}%
  \else
    \@ifundefined{glsxtrinitwrgloss}%
    {%
      \glshyperlink[\glstextformat{\tstidx@glsentry{\@tstidx@label}}]%
       {\@tstidx@label}%
      \glsadd[format={)#4}]{\@tstidx@label}%
    }%
    {%
     \tstidx@gls[wrgloss=after,format={)#4}]{\@tstidx@label}%
    }%
  \fi
  \egroup
}
\let\@tstidx@org@subindexclosepost\@tstidx@subindexclosepost
\let\@tstidx@subindexclosepost\@tstidx@gls@subindexclosepost
\def\@tstidx@gls@subindexpre#1#2[#3]#4#5{%
  \bgroup
  \edef\@tstidx@label{\tstidx@getlabel{#3}}%
  \ifx\@tstidx@label\@empty
    \edef\@tstidx@label{\tstidx@getlabel{#1}}%
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#2}}%
    \fi
    \ifx\@tstidx@sort\empty
      \edef\@tstidx@label{%
        \expandafter\tstidx@getlabel\expandafter{\@tstidx@term}%
        .\@tstidx@label}%
    \else
      \edef\@tstidx@label{%
        \expandafter\tstidx@getlabel\expandafter{\@tstidx@sort}%
        .\@tstidx@label}%
    \fi
  \fi
  \def\@tstidx@encap{#4}%
  \def\@tstidx@range{}%
  \let\tstidx@org@glstextformat\glstextformat
  \renewcommand\glstextformat[1]{\tstidx@pre@glstextformat
    {\tstidx@org@glstextformat{##1}}}%
  \ifx\relax#5\relax
    \ifx\@tstidx@encap\@empty
     \tstidx@glspreindex{\@tstidx@label}%
    \else
     \tstidx@glspreindex[format={#4}]{\@tstidx@label}%
    \fi
  \else
    \ifx\@tstidx@encap\@empty
     \tstidx@gls{\@tstidx@label}%
    \else
     \tstidx@gls[format={#4}]{\@tstidx@label}%
    \fi
  \fi
  \egroup
}
\let\@tstidx@org@subindexpre\@tstidx@subindexpre
\let\@tstidx@subindexpre\@tstidx@gls@subindexpre
\def\@tstidx@gls@subindexopenpre#1#2[#3]#4#5{%
  \bgroup
  \edef\@tstidx@label{\tstidx@getlabel{#3}}%
  \ifx\@tstidx@label\@empty
    \edef\@tstidx@label{\tstidx@getlabel{#1}}%
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#2}}%
    \fi
    \ifx\@tstidx@sort\empty
      \edef\@tstidx@label{%
        \expandafter\tstidx@getlabel\expandafter{\@tstidx@term}%
        .\@tstidx@label}%
    \else
      \edef\@tstidx@label{%
        \expandafter\tstidx@getlabel\expandafter{\@tstidx@sort}%
        .\@tstidx@label}%
    \fi
  \fi
  \def\@tstidx@encap{#4}%
  \def\@tstidx@range{(}%
  \let\tstidx@org@glstextformat\glstextformat
  \renewcommand\glstextformat[1]{\tstidx@pre@glstextformat
    {\tstidx@org@glstextformat{##1}}}%
  \ifx\relax#5\relax
   \tstidx@glspreindex[format={(#4}]{\@tstidx@label}%
  \else
   \tstidx@gls[format={(#4}]{\@tstidx@label}%
  \fi
  \egroup
}
\let\@tstidx@org@subindexopenpre\@tstidx@subindexopenpre
\let\@tstidx@subindexopenpre\@tstidx@gls@subindexopenpre
\def\@tstidx@gls@subindexclosepre#1#2[#3]#4#5{%
  \bgroup
  \edef\@tstidx@label{\tstidx@getlabel{#3}}%
  \ifx\@tstidx@label\@empty
    \edef\@tstidx@label{\tstidx@getlabel{#1}}%
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#2}}%
    \fi
    \ifx\@tstidx@sort\empty
      \edef\@tstidx@label{%
        \expandafter\tstidx@getlabel\expandafter{\@tstidx@term}%
        .\@tstidx@label}%
    \else
      \edef\@tstidx@label{%
        \expandafter\tstidx@getlabel\expandafter{\@tstidx@sort}%
        .\@tstidx@label}%
    \fi
  \fi
  \def\@tstidx@encap{#4}%
  \def\@tstidx@range{)}%
  \let\tstidx@org@glstextformat\glstextformat
  \renewcommand\glstextformat[1]{\tstidx@pre@glstextformat
    {\tstidx@org@glstextformat{##1}}}%
  \ifx\relax#5\relax
   \tstidx@glspreindex[format={)#4}]{\@tstidx@label}%
  \else
   \tstidx@gls[format={)#4}]{\@tstidx@label}%
  \fi
  \egroup
}
\let\@tstidx@org@subindexclosepre\@tstidx@subindexclosepre
\let\@tstidx@subindexclosepre\@tstidx@gls@subindexclosepre
\def\@tstidx@gls@indexsubsee#1#2#3#4[#5]#6{%
  \if@tstidx@useglsseekey
  \else
    \bgroup
    \edef\@tstidx@label{\tstidx@getlabel{#3}}%
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#1}}%
      \ifx\@tstidx@label\@empty
        \edef\@tstidx@label{\tstidx@getlabel{#2}}%
      \fi
    \fi
    \ifx\relax#5\relax
      \def\@tstidx@xrlabel{}%
      \def\@tstidx@xrlabel@sep{}%
      \@for\@tst@idxthis:=#6\do{%
        \edef\@tstidx@xrlabel{\@tstidx@xrlabel\@tstidx@xrlabel@sep
          \expandafter\tstidx@getlabel\expandafter{\@tst@idxthis}}%
        \def\@tstidx@xrlabel@sep{,}%
      }%
    \else
      \def\@tstidx@xrlabel{#5}%
    \fi
    \edef\@tstidx@seetag{#4}%
    \ifx\@tstidx@seetag\tstidx@seealso
     \if@tstidx@hasseealsokey
       \expandafter\glsxtrindexseealso\expandafter\@tstidx@label\expandafter
         {\@tstidx@xrlabel}%
     \else
       \expandafter\glssee\expandafter[\expandafter\seealsoname
         \expandafter]\expandafter\@tstidx@label\expandafter{\@tstidx@xrlabel}%
     \fi
    \else
     \expandafter\glssee\expandafter\@tstidx@label\expandafter
       {\@tstidx@xrlabel}%
    \fi
    \iftestidxshowmarks
      \protected@edef\tstidx@dosee{\noexpand\tstidxsubseeref
        {\@tstidx@term}{#2}{tst#4ref}{\@tstidx@xrlabel}}%
      \tstidx@dosee
    \fi
    \egroup
  \fi
}
\let\@tstidx@org@indexsubsee\@tstidx@indexsubsee
\let\@tstidx@indexsubsee\@tstidx@gls@indexsubsee
\def\@tstidx@gls@subsubindexpost#1#2[#3]#4#5{%
  \bgroup
  \edef\@tstidx@label{\tstidx@getlabel{#3}}%
  \ifx\@tstidx@label\@empty
    \edef\@tstidx@label{\tstidx@getlabel{#1}}%
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#2}}%
    \fi
    \ifx\@tstidx@sort\empty
      \ifx\@tstidx@subsort\empty
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@term}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subterm}%
          .\@tstidx@label}%
      \else
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@term}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subsort}%
          .\@tstidx@label}%
      \fi
    \else
      \ifx\@tstidx@subsort\empty
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@sort}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subterm}%
          .\@tstidx@label}%
      \else
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@sort}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subsort}%
          .\@tstidx@label}%
      \fi
    \fi
  \fi
  \def\@tstidx@encap{#4}%
  \def\@tstidx@range{}%
  \let\tstidx@org@glstextformat\glstextformat
  \renewcommand\glstextformat[1]{\tstidx@post@glstextformat
    {\tstidx@org@glstextformat{##1}}}%
  \ifx\relax#5\relax
    \ifx\@tstidx@encap\@empty
     \tstidx@glspostindex{\@tstidx@label}%
    \else
     \tstidx@glspostindex[format={#4}]{\@tstidx@label}%
    \fi
  \else
    \@ifundefined{glsxtrinitwrgloss}%
    {%
      \glshyperlink[\glstextformat{\tstidx@glsentry{\@tstidx@label}}]%
       {\@tstidx@label}%
      \ifx\@tstidx@encap\@empty
       \glsadd{\@tstidx@label}%
      \else
       \glsadd[format={#4}]{\@tstidx@label}%
      \fi
    }%
    {%
      \ifx\@tstidx@encap\@empty
       \tstidx@gls[wrgloss=after]{\@tstidx@label}%
      \else
       \tstidx@gls[wrgloss=after,format={#4}]{\@tstidx@label}%
      \fi
    }%
  \fi
  \egroup
}
\let\@tstidx@org@subsubindexpost\@@tstidx@subsubindexpost
\let\@@tstidx@subsubindexpost\@tstidx@gls@subsubindexpost
\def\@tstidx@gls@subsubindexopenpost#1#2[#3]#4#5{%
  \bgroup
  \edef\@tstidx@label{\tstidx@getlabel{#3}}%
  \ifx\@tstidx@label\@empty
    \edef\@tstidx@label{\tstidx@getlabel{#1}}%
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#2}}%
    \fi
    \ifx\@tstidx@sort\empty
      \ifx\@tstidx@subsort\empty
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@term}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subterm}%
          .\@tstidx@label}%
      \else
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@term}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subsort}%
          .\@tstidx@label}%
      \fi
    \else
      \ifx\@tstidx@subsort\empty
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@sort}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subterm}%
          .\@tstidx@label}%
      \else
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@sort}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subsort}%
          .\@tstidx@label}%
      \fi
    \fi
  \fi
  \def\@tstidx@encap{#4}%
  \def\@tstidx@range{(}%
  \let\tstidx@org@glstextformat\glstextformat
  \renewcommand\glstextformat[1]{\tstidx@post@glstextformat
    {\tstidx@org@glstextformat{##1}}}%
  \ifx\relax#5\relax
    \tstidx@glspostindex[format={(#4}]{\@tstidx@label}%
  \else
    \@ifundefined{glsxtrinitwrgloss}%
    {%
      \glshyperlink[\glstextformat{\tstidx@glsentry{\@tstidx@label}}]%
       {\@tstidx@label}%
      \glsadd[format={(#4}]{\@tstidx@label}%
    }%
    {%
      \tstidx@gls[wrgloss=after,format={(#4}]{\@tstidx@label}%
    }%
  \fi
  \egroup
}
\let\@tstidx@org@subsubindexopenpost\@@tstidx@subsubindexopenpost
\let\@@tstidx@subsubindexopenpost\@tstidx@gls@subsubindexopenpost
\def\@tstidx@gls@subsubindexclosepost#1#2[#3]#4#5{%
  \bgroup
  \edef\@tstidx@label{\tstidx@getlabel{#3}}%
  \ifx\@tstidx@label\@empty
    \edef\@tstidx@label{\tstidx@getlabel{#1}}%
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#2}}%
    \fi
    \ifx\@tstidx@sort\empty
      \ifx\@tstidx@subsort\empty
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@term}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subterm}%
          .\@tstidx@label}%
      \else
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@term}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subsort}%
          .\@tstidx@label}%
      \fi
    \else
      \ifx\@tstidx@subsort\empty
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@sort}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subterm}%
          .\@tstidx@label}%
      \else
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@sort}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subsort}%
          .\@tstidx@label}%
      \fi
    \fi
  \fi
  \def\@tstidx@encap{#4}%
  \def\@tstidx@range{)}%
  \let\tstidx@org@glstextformat\glstextformat
  \renewcommand\glstextformat[1]{\tstidx@post@glstextformat
    {\tstidx@org@glstextformat{##1}}}%
  \ifx\relax#5\relax
    \tstidx@glspostindex[format={)#4}]{\@tstidx@label}%
  \else
    \@ifundefined{glsxtrinitwrgloss}%
    {%
      \glshyperlink[\glstextformat{\tstidx@glsentry{\@tstidx@label}}]%
       {\@tstidx@label}%
      \glsadd[format={)#4}]{\@tstidx@label}%
    }%
    {%
     \tstidx@gls[wrgloss=after,format={)#4}]{\@tstidx@label}%
    }%
  \fi
  \egroup
}
\let\@tstidx@org@subsubindexclosepost\@@tstidx@subsubindexclosepost
\let\@@tstidx@subsubindexclosepost\@tstidx@gls@subsubindexclosepost
\def\@tstidx@gls@subsubindexpre#1#2[#3]#4#5{%
  \bgroup
  \edef\@tstidx@label{\tstidx@getlabel{#3}}%
  \ifx\@tstidx@label\@empty
    \edef\@tstidx@label{\tstidx@getlabel{#1}}%
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#2}}%
    \fi
    \ifx\@tstidx@sort\empty
      \ifx\@tstidx@subsort\empty
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@term}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subterm}%
          .\@tstidx@label}%
      \else
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@term}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subsort}%
          .\@tstidx@label}%
      \fi
    \else
      \ifx\@tstidx@subsort\empty
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@sort}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subterm}%
          .\@tstidx@label}%
      \else
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@sort}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subsort}%
          .\@tstidx@label}%
      \fi
    \fi
  \fi
  \def\@tstidx@encap{#4}%
  \def\@tstidx@range{}%
  \let\tstidx@org@glstextformat\glstextformat
  \renewcommand\glstextformat[1]{\tstidx@pre@glstextformat
    {\tstidx@org@glstextformat{##1}}}%
  \ifx\relax#5\relax
    \ifx\@tstidx@encap\@empty
     \tstidx@glspreindex{\@tstidx@label}%
    \else
     \tstidx@glspreindex[format={#4}]{\@tstidx@label}%
    \fi
  \else
    \ifx\@tstidx@encap\@empty
     \tstidx@gls{\@tstidx@label}%
    \else
     \tstidx@gls[format={#4}]{\@tstidx@label}%
    \fi
  \fi
  \egroup
}
\let\@tstidx@org@subsubindexpre\@@tstidx@subsubindexpre
\let\@@tstidx@subsubindexpre\@tstidx@gls@subsubindexpre
\def\@tstidx@gls@subsubindexopenpre#1#2[#3]#4#5{%
  \bgroup
  \edef\@tstidx@label{\tstidx@getlabel{#3}}%
  \ifx\@tstidx@label\@empty
    \edef\@tstidx@label{\tstidx@getlabel{#1}}%
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#2}}%
    \fi
    \ifx\@tstidx@sort\empty
      \ifx\@tstidx@subsort\empty
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@term}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subterm}%
          .\@tstidx@label}%
      \else
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@term}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subsort}%
          .\@tstidx@label}%
      \fi
    \else
      \ifx\@tstidx@subsort\empty
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@sort}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subterm}%
          .\@tstidx@label}%
      \else
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@sort}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subsort}%
          .\@tstidx@label}%
      \fi
    \fi
  \fi
  \def\@tstidx@encap{#4}%
  \def\@tstidx@range{(}%
  \let\tstidx@org@glstextformat\glstextformat
  \renewcommand\glstextformat[1]{\tstidx@pre@glstextformat
    {\tstidx@org@glstextformat{##1}}}%
  \ifx\relax#5\relax
   \tstidx@glspreindex[format={(#4}]{\@tstidx@label}%
  \else
   \tstidx@gls[format={(#4}]{\@tstidx@label}%
  \fi
  \egroup
}
\let\@tstidx@org@subsubindexopenpre\@@tstidx@subsubindexopenpre
\let\@@tstidx@subsubindexopenpre\@tstidx@gls@subsubindexopenpre
\def\@tstidx@gls@subsubindexclosepre#1#2[#3]#4#5{%
  \bgroup
  \edef\@tstidx@label{\tstidx@getlabel{#3}}%
  \ifx\@tstidx@label\@empty
    \edef\@tstidx@label{\tstidx@getlabel{#1}}%
    \ifx\@tstidx@label\@empty
      \edef\@tstidx@label{\tstidx@getlabel{#2}}%
    \fi
    \ifx\@tstidx@sort\empty
      \ifx\@tstidx@subsort\empty
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@term}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subterm}%
          .\@tstidx@label}%
      \else
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@term}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subsort}%
          .\@tstidx@label}%
      \fi
    \else
      \ifx\@tstidx@subsort\empty
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@sort}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subterm}%
          .\@tstidx@label}%
      \else
        \edef\@tstidx@label{%
          \expandafter\tstidx@getlabel\expandafter{\@tstidx@sort}%
          .\expandafter\tstidx@getlabel\expandafter{\@tstidx@subsort}%
          .\@tstidx@label}%
      \fi
    \fi
  \fi
  \def\@tstidx@encap{#4}%
  \def\@tstidx@range{)}%
  \let\tstidx@org@glstextformat\glstextformat
  \renewcommand\glstextformat[1]{\tstidx@pre@glstextformat
    {\tstidx@org@glstextformat{##1}}}%
  \ifx\relax#5\relax
   \tstidx@glspreindex[format={)#4}]{\@tstidx@label}%
  \else
   \tstidx@gls[format={)#4}]{\@tstidx@label}%
  \fi
  \egroup
}
\let\@tstidx@org@subsubindexclosepre\@@tstidx@subsubindexclosepre
\let\@@tstidx@subsubindexclosepre\@tstidx@gls@subsubindexclosepre
\newcommand*{\tstidxnewutfentry}[6]{%
  \@tstidx@ifutfviii
  {%
    \tstidxprocessutf{\@tstidx@utf}{#3}%
    \ifx\relax#4\relax
      \protected@edef\@tstidx@doidx{%
        \noexpand\tstidxnewentry{#1}{#6}%
        {name={#3},%
         sort={\unexpanded\expandafter{\@tstidx@utf}},%
        description={},#5}}%
    \else
      \protected@edef\@tstidx@doidx{%
        \noexpand\tstidxnewentry{#1}{#6}%
        {name={\noexpand#4{#3}},%
         sort={\unexpanded\expandafter{\@tstidx@utf}},%
        description={},#5}}%
    \fi
  }%
  {%
    \tstidxprocessasciisort{\@tstidx@asciisort}{#2}%
    \tstidxprocessasciisortstrip{\@tstidx@asciilabel}{#1}%
    \ifx\relax#4\relax
      \protected@edef\@tstidx@doidx{%
        \noexpand\tstidxnewentry{\@tstidx@asciilabel}{#6}%
        {name={#2},%
         sort={\unexpanded\expandafter{\@tstidx@asciisort}},%
        description={},#5}}%
    \else
      \protected@edef\@tstidx@doidx{%
        \noexpand\tstidxnewentry{\@tstidx@asciilabel}{#6}%
        {name={\noexpand#4{#2}},%
         sort={\unexpanded\expandafter{\@tstidx@asciisort}},%
        description={},#5}}%
    \fi
  }%
  \@tstidx@doidx
}
\newcommand*{\tstidxnewutfentrytext}[8]{%
  \@tstidx@ifutfviii
  {%
    \tstidxprocessutf{\@tstidx@utf}{#4}%
    \ifx\relax#6\relax
      \protected@edef\@tstidx@doidx{%
        \noexpand\tstidxnewentry{#1}{#8}%
        {name={#4},%
         sort={\unexpanded\expandafter{\@tstidx@utf}},%
         text={#5},%
        description={},#7}}%
    \else
      \protected@edef\@tstidx@doidx{%
        \noexpand\tstidxnewentry{#1}{#8}%
        {name={#4},%
         text={\noexpand#6{#5}},%
         sort={\unexpanded\expandafter{\@tstidx@utf}},%
        description={},#7}}%
    \fi
  }%
  {%
    \tstidxprocessasciisort{\@tstidx@asciisort}{#2}%
    \ifx\relax#6\relax
      \protected@edef\@tstidx@doidx{%
        \noexpand\tstidxnewentry{#1}{#8}%
        {name={#2},%
         text={#3},%
         sort={\unexpanded\expandafter{\@tstidx@asciisort}},%
        description={},#7}}%
    \else
      \protected@edef\@tstidx@doidx{%
        \noexpand\tstidxnewentry{#1}{#8}%
        {name={\noexpand#6{#2}},%
         text={\noexpand#6{#3}},%
         sort={\unexpanded\expandafter{\@tstidx@asciisort}},%
        description={},#7}}%
    \fi
  }%
  \@tstidx@doidx
}
\newcommand*{\tstidxnewword}[3][]{%
 \if@tstidx@setdescription
   \tstidxnewentry{\tstidx@getlabel{#2}}{word}{name={#2},description={#3},#1}%
 \else
   \tstidxnewentry{\tstidx@getlabel{#2}}{word}{name={#2},description={},#1}%
 \fi
}
\if@tstidx@useglsseekey
  \newcommand*{\tstidxnewwordsee}[4][]{%
    \tstidxnewword[see={#4},#1]{#2}{#3}%
  }
\else
  \newcommand*{\tstidxnewwordsee}[4][]{%
    \tstidxnewword[#1]{#2}{#3}%
  }
\fi
\if@tstidx@useglsseekey
  \if@tstidx@hasseealsokey
    \newcommand*{\tstidxnewwordseealso}[4][]{%
      \tstidxnewword[seealso={#4},#1]{#2}{#3}%
    }
  \else
    \newcommand*{\tstidxnewwordseealso}[4][]{%
      \tstidxnewword[see={[\seealsoname]#4},#1]{#2}{#3}%
    }
  \fi
\else
  \newcommand*{\tstidxnewwordseealso}[4][]{%
    \tstidxnewword[#1]{#2}{#3}%
  }
\fi
\newcommand*{\tstidxnewdigraph}[3][]{%
 \if@tstidx@setdescription
   \tstidxnewentry{\tstidx@getlabel{#2}}{digraph}{name={#2},description={#3},#1}%
 \else
   \tstidxnewentry{\tstidx@getlabel{#2}}{digraph}{name={#2},description={},#1}%
 \fi
}
\newcommand*{\tstidxnewtrigraph}[3][]{%
 \if@tstidx@setdescription
   \tstidxnewentry{\tstidx@getlabel{#2}}{trigraph}{name={#2},description={#3},#1}%
 \else
   \tstidxnewentry{\tstidx@getlabel{#2}}{trigraph}{name={#2},description={},#1}%
 \fi
}
\newcommand*{\tstidxnewsubword}[4][]{%
 \if@tstidx@setdescription
   \tstidxnewentry{\tstidx@getlabel{#2.#3}}{word}%
   {parent={\tstidx@getlabel{#2}},name={#3},description={#4},#1}%
 \else
   \tstidxnewentry{\tstidx@getlabel{#2.#3}}{word}%
   {parent={\tstidx@getlabel{#2}},name={#3},description={},#1}%
 \fi
}
\if@tstidx@useglsseekey
  \newcommand*{\tstidxnewsubwordsee}[5][]{%
    \tstidxnewsubword[see={#5},#1]{#2}{#3}{#4}%
  }
\else
  \newcommand*{\tstidxnewsubwordsee}[5][]{%
    \tstidxnewsubword[#1]{#2}{#3}{#4}%
  }
\fi
\if@tstidx@useglsseekey
  \if@tstidx@hasseealsokey
    \newcommand*{\tstidxnewsubwordseealso}[5][]{%
      \tstidxnewsubword[seealso={#5},#1]{#2}{#3}{#4}%
    }
  \else
    \newcommand*{\tstidxnewsubwordseealso}[5][]{%
      \tstidxnewsubword[see={[\seealsoname]#5},#1]{#2}{#3}{#4}%
    }
  \fi
\else
  \newcommand*{\tstidxnewsubwordseealso}[5][]{%
    \tstidxnewsubword[#1]{#2}{#3}{#4}%
  }
\fi
\renewcommand*{\tstidxcsfmt}[1]{\texttt{\glsbackslash#1}}
\newcommand*{\tstidxnewcs}[3][]{%
 \if@tstidx@setdescription
   \tstidxnewentry{\tstidx@getlabel{cs.#2}}{cs}%
   {sort={#2},name={\tstidxcsfmt{#2}},description={#3},#1}%
 \else
   \tstidxnewentry{\tstidx@getlabel{cs.#2}}{cs}%
   {sort={#2},name={\tstidxcsfmt{#2}},description={},#1}%
 \fi
}
\newcommand*{\tstidxnewencapcsn}[3][]{%
 \if@tstidx@setdescription
   \tstidxnewentry{\tstidx@getlabel{#2}}{encapcsn}{sort={#2 (#2)},%
    name={\texttt{#2} (\tstidxcsfmt{#2})},
    text={\texttt{#2}},description={#3},#1}%
   \tstidxnewentry{\tstidx@getlabel{encap.#2}}{encapcsn}{sort={#2},%
    parent={\tstidx@getlabel{encap}},
    name={\texttt{#2}},description={#3}}%
 \else
   \tstidxnewentry{\tstidx@getlabel{#2}}{encapcsn}{sort={#2 (#2)},%
    name={\texttt{#2} (\tstidxcsfmt{#2})},
    text={\texttt{#2}},description={},#1}%
   \tstidxnewentry{\tstidx@getlabel{encap.#2}}{encapcsn}{sort={#2},%
    parent={\tstidx@getlabel{encap}},
    name={\texttt{#2}},description={}}%
 \fi
}
\newcommand*{\tstidxnewenv}[3][]{%
 \if@tstidx@setdescription
   \tstidxnewentry{\tstidx@getlabel{#2environment}}%
   {environment}{sort={#2 environment},%
    name={\tstidxenvfmt{#2} environment},%
    text={\tstidxenvfmt{#2}},description={#3},#1}%
 \else
   \tstidxnewentry{\tstidx@getlabel{#2environment}}%
   {environment}{sort={#2 environment},%
    name={\tstidxenvfmt{#2} environment},%
    text={\tstidxenvfmt{#2}},description={},#1}%
 \fi
}
\newcommand*{\tstidxnewapp}[3][]{%
 \if@tstidx@setdescription
   \tstidxnewentry{\tstidx@getlabel{#2}}{application}{sort={#2},%
    name={\tstidxappfmt{#2}},description={#3},#1}%
   \tstidxnewentry{applications.\tstidx@getlabel{#2}}{application}{sort={#2},%
    parent={applications},name={\tstidxappfmt{#2}},description={#3}}%
 \else
   \tstidxnewentry{\tstidx@getlabel{#2}}{application}{sort={#2},%
    name={\tstidxappfmt{#2}},description={},#1}%
   \tstidxnewentry{applications.\tstidx@getlabel{#2}}{application}{sort={#2},%
    parent={applications},name={\tstidxappfmt{#2}},description={}}%
 \fi
}
\newcommand*{\tstidxnewappopt}[4][]{%
 \if@tstidx@setdescription
   \tstidxnewentry{\tstidx@getlabel{#3.#2option}}{applicationoption}%
   {sort={#3 (#2)},%
    name={\tstidxappoptfmt{#3} (\tstidxappfmt{#2})},description={#4},#1}%
   \tstidxnewentry{\tstidx@getlabel{#2.#3}}{applicationoption}%
   {parent={#2},sort={#3},%
    name={\tstidxappoptfmt{#3}},description={#4},#1}%
   \tstidxnewentry{\tstidx@getlabel{applications.#2.#3}}%
   {applicationoption}{sort={#3},%
    parent={\tstidx@getlabel{applications.#2}},name={\tstidxappoptfmt{#3}},%
    description={#4}}%
 \else
   \tstidxnewentry{\tstidx@getlabel{#3.#2option}}{applicationoption}%
   {sort={#3 (#2)},%
    name={\tstidxappoptfmt{#3} (\tstidxappfmt{#2})},description={},#1}%
   \tstidxnewentry{\tstidx@getlabel{#2.#3}}{applicationoption}%
   {parent={#2},sort={#3},%
    name={\tstidxappoptfmt{#3}},description={},#1}%
   \tstidxnewentry{\tstidx@getlabel{applications.#2.#3}}%
   {applicationoption}{sort={#3},%
    parent={\tstidx@getlabel{applications.#2}},name={\tstidxappoptfmt{#3}},%
    description={}}%
 \fi
}
\newcommand*{\tstidxnewsty}[3][]{%
 \if@tstidx@setdescription
   \tstidxnewentry{\tstidx@getlabel{#2package}}{package}{sort={#2 package},%
    name={\tstidxstyfmt{#2} package},%
    text={\tstidxstyfmt{#2}},%
    description={#3},#1}%
   \tstidxnewentry{\tstidx@getlabel{packages.#2package}}{package}{sort={#2},%
    parent={packages},name={\tstidxstyfmt{#2}},%
    text={\tstidxstyfmt{#2}},description={#3}}%
 \else
   \tstidxnewentry{\tstidx@getlabel{#2package}}{package}{sort={#2 package},%
    name={\tstidxstyfmt{#2} package},%
    text={\tstidxstyfmt{#2}},%
    description={},#1}%
   \tstidxnewentry{\tstidx@getlabel{packages.#2package}}{package}{sort={#2},%
    parent={packages},name={\tstidxstyfmt{#2}},%
    text={\tstidxstyfmt{#2}},description={}}%
 \fi
}
\if@tstidx@useglsseekey
  \if@tstidx@hasseealsokey
    \newcommand*{\tstidxnewstyseealso}[4][]{%
      \tstidxnewsty[seealso={#4},#1]{#2}{#3}%
    }
  \else
    \newcommand*{\tstidxnewstyseealso}[4][]{%
      \tstidxnewsty[see={[\seealsoname]#4},#1]{#2}{#3}%
    }
  \fi
\else
  \newcommand*{\tstidxnewstyseealso}[4][]{%
    \tstidxnewsty[#1]{#2}{#3}%
  }
\fi
\newcommand*{\tstidxnewstyopt}[4][]{%
 \if@tstidx@setdescription
   \tstidxnewentry{\tstidx@getlabel{#2package.#3}}{packageoption}{sort={#3},%
    name={\tstidxstyoptfmt{#3}},%
    parent={\tstidx@getlabel{#2package}},%
    description={#4},#1}%
   \tstidxnewentry{\tstidx@getlabel{packages.#2package.#3}}{packageoption}%
   {sort={#3},%
    parent={\tstidx@getlabel{packages.#2package}},name={\tstidxstyoptfmt{#3}},%
    description={#4}}%
 \else
   \tstidxnewentry{\tstidx@getlabel{#2package.#3}}{packageoption}{sort={#3},%
    name={\tstidxstyoptfmt{#3}},%
    parent={\tstidx@getlabel{#2package}},%
    description={},#1}%
   \tstidxnewentry{\tstidx@getlabel{packages.#2package.#3}}{packageoption}%
   {sort={#3},%
    parent={\tstidx@getlabel{packages.#2package}},name={\tstidxstyoptfmt{#3}},%
    description={}}%
 \fi
}
\newcommand*{\tstidxnewnumber}[3][]{%
 \if@tstidx@setdescription
  \tstidxnewentry{\tstidx@getlabel{#2}}{number}{name={#2},description={#3},#1}%
 \else
  \tstidxnewentry{\tstidx@getlabel{#2}}{number}{name={#2},description={},#1}%
 \fi
}
\newcommand*{\tstidxnewphrase}[3][]{%
 \if@tstidx@setdescription
   \tstidxnewentry{\tstidx@getlabel{#2}}{phrase}{name={#2},description={#3},#1}%
 \else
   \tstidxnewentry{\tstidx@getlabel{#2}}{phrase}{name={#2},description={},#1}%
 \fi
}
\if@tstidx@useglsseekey
  \newcommand*{\tstidxnewphrasesee}[4][]{%
    \tstidxnewphrase[see={#4},#1]{#2}{#3}%
  }
\else
  \newcommand*{\tstidxnewphrasesee}[4][]{%
    \tstidxnewphrase[#1]{#2}{#3}%
  }
\fi
\if@tstidx@useglsseekey
  \if@tstidx@hasseealsokey
    \newcommand*{\tstidxnewphraseseealso}[4][]{%
      \tstidxnewphrase[seealso={#4},#1]{#2}{#3}%
    }
  \else
    \newcommand*{\tstidxnewphraseseealso}[4][]{%
      \tstidxnewphrase[see={[\seealsoname]#4},#1]{#2}{#3}%
    }
  \fi
\else
  \newcommand*{\tstidxnewphraseseealso}[4][]{%
    \tstidxnewphrase[#1]{#2}{#3}%
  }
\fi
\newcommand*{\tstidxnewartphrase}[4][]{%
 \if@tstidx@setdescription
 \tstidxnewentry{\tstidx@getlabel{#3}}{phrase}{name={#3, #2},
   text={#2 #3},description={#4},#1}%
 \else
 \tstidxnewentry{\tstidx@getlabel{#3}}{phrase}{name={#3, #2},
   text={#2 #3},description={},#1}%
 \fi
}
\newcommand*{\tstidxnewsubphrase}[4][]{%
 \if@tstidx@setdescription
  \tstidxnewentry{\tstidx@getlabel{#2.#3}}{phrase}%
    {parent={\tstidx@getlabel{#2}},%
    name={#3},description={#4},#1}%
 \else
  \tstidxnewentry{\tstidx@getlabel{#2.#3}}{phrase}%
    {parent={\tstidx@getlabel{#2}},%
    name={#3},description={},#1}%
 \fi
}
\newcommand*{\tstidxnewperson}[4][]{%
  \tstidxnewutfperson[#1]{#2}{#3}{#2}{#3}{#4}%
}
\newcommand*{\tstidxnewutfperson}[3][]{%
  \@ifnextchar[{\@tstidxnewutfperson{#1}{#2}{#3}}%
  {\@tstidxnewutfperson{#1}{#2}{#3}[#2#3]}%
}
\def\@tstidxnewutfperson#1#2#3[#4]#5#6#7{%
 \if@tstidx@setdescription
  \tstidxnewutfentrytext{\tstidx@getlabel{#4}}{#3, #2}{#2 #3}{#6, #5}{#5 #6}%
   {}{description={#7},#1}{person}%
  \tstidxnewutfentrytext{\tstidx@getlabel{people.#4}}{#3, #2}{#2 #3}{#6, #5}%
  {#5 #6}{}{description={#7},parent={people}}{person}%
 \else
  \tstidxnewutfentrytext{\tstidx@getlabel{#4}}{#3, #2}{#2 #3}{#6, #5}{#5 #6}%
   {}{#1}{person}%
  \tstidxnewutfentrytext{\tstidx@getlabel{people.#4}}{#3, #2}{#2 #3}{#6, #5}%
  {#5 #6}{}{parent={people}}{person}%
 \fi
}
\newcommand*{\tstidxnewsym}[4][]{%
 \if@tstidx@setdescription
  \tstidxnewentry{\tstidx@getlabel{#2}}{symbol}%
  {name={#3},sort={#2},description={#4},#1}%
 \else
  \tstidxnewentry{\tstidx@getlabel{#2}}{symbol}%
  {name={#3},sort={#2},description={},#1}%
 \fi
}
\newcommand*{\tstidxnewindexmarker}[3][]{%
 \if@tstidx@setdescription
  \toks@{description={#3},#1}%
 \else
  \toks@{description={},#1}%
 \fi
 \iftestidxprefix
   \protected@edef\@tstidx@dodef{%
    \noexpand\tstidxnewentry{\tstidx@getlabel{#2}}%
    {indexmarker}{%
     name={{}\noexpand\protect\expandonce{\csname#2\endcsname}\noexpand\space
      (\noexpand\tstidxcsfmt{#2})},%
     sort={\tstidxindexmarkerprefix#2},
     \the\toks@}}%
 \else
   \protected@edef\@tstidx@dodef{%
    \noexpand\tstidxnewentry{\tstidx@getlabel{#2}}%
    {indexmarker}{%
     name={{}\noexpand\protect\expandonce{\csname#2\endcsname}\noexpand\space
      (\noexpand\tstidxcsfmt{#2})},%
     sort={#2},
     \the\toks@}}%
 \fi
  \@tstidx@dodef
}
\newcommand*{\tstidxnewmath}[2][]{%
  \@ifnextchar[{\@tstidxnewmath{#1}{#2}}{\@tstidxnewmath{#1}{#2}[#2]}%
}
\def\@tstidxnewmath#1#2[#3]#4#5{%
 \if@tstidx@setdescription
  \tstidxnewentry{\tstidx@getlabel{#3}}{math}%
  {name={$#4$},text={#4},sort={#2},description={#5},#1}%
 \else
  \tstidxnewentry{\tstidx@getlabel{#3}}{math}%
  {name={$#4$},text={#4},sort={#2},description={},#1}%
 \fi
}
\newcommand*{\tstidxnewmathsym}[2][]{%
  \@ifnextchar[{\@tstidxnewmathsym{#1}{#2}}{\@tstidxnewmathsym{#1}{#2}[#2]}%
}
\def\@tstidxnewmathsym#1#2[#3]#4#5{%
 \iftestidxprefix
  \if@tstidx@setdescription
    \toks@{name={$#4$},text={#4},description={#5},#1}%
  \else
    \toks@{name={$#4$},text={#4},#1}%
  \fi
  \protected@edef\@tstidx@dodef{%
   \noexpand\tstidxnewentry{\tstidx@getlabel{#3}}{mathsymbol}%
   {sort={\tstidxmathsymprefix#2},description={},\the\toks@}%
  }%
  \@tstidx@dodef
 \else
  \if@tstidx@setdescription
    \tstidxnewentry{\tstidx@getlabel{#3}}{mathsymbol}{name={$#4$},%
    text={#4},sort={#2},description={#5},#1}%
  \else
    \tstidxnewentry{\tstidx@getlabel{#3}}{mathsymbol}{name={$#4$},%
    text={#4},sort={#2},description={},#1}%
  \fi
 \fi
}
\newcommand*{\tstidxnewutfword}[5][]{%
 \if@tstidx@setdescription
   \tstidxnewutfentry{\tstidx@getlabel{#2}}{#3}{#4}{}{description={#5},#1}{word}%
 \else
   \tstidxnewutfentry{\tstidx@getlabel{#2}}{#3}{#4}{}{#1}{word}%
 \fi
}
\if@tstidx@useglsseekey
  \newcommand*{\tstidxnewutfwordsee}[6][]{%
    \tstidxnewutfword[see={#6},#1]{#2}{#3}{#4}{#5}%
  }
\else
  \newcommand*{\tstidxnewutfwordsee}[6][]{%
    \tstidxnewutfword[#1]{#2}{#3}{#4}{#5}%
  }
\fi
\if@tstidx@useglsseekey
  \if@tstidx@hasseealsokey
    \newcommand*{\tstidxnewutfwordseealso}[6][]{%
      \tstidxnewutfword[seealso={#6},#1]{#2}{#3}{#4}{#5}%
    }
  \else
    \newcommand*{\tstidxnewutfwordseealso}[6][]{%
      \tstidxnewutfword[see={[\seealsoname]#6},#1]{#2}{#3}{#4}{#5}%
    }
  \fi
\else
  \newcommand*{\tstidxnewutfwordseealso}[6][]{%
    \tstidxnewutfword[#1]{#2}{#3}{#4}{#5}%
  }
\fi
\newcommand*{\tstidxnewutfdigraph}[5][]{%
 \if@tstidx@setdescription
   \tstidxnewutfentry{\tstidx@getlabel{#2}}{#3}{#4}{}{description={#5},#1}{digraph}%
 \else
   \tstidxnewutfentry{\tstidx@getlabel{#2}}{#3}{#4}{}{#1}{digraph}%
 \fi
}
\newcommand*{\tstidxnewutfphrase}[5][]{%
 \if@tstidx@setdescription
   \tstidxnewutfentry{\tstidx@getlabel{#2}}{#3}{#4}{}%
     {description={#5},#1}{phrase}%
 \else
   \tstidxnewutfentry{\tstidx@getlabel{#2}}{#3}{#4}{}{#1}{phrase}%
 \fi
}
\newcommand*{\tstidxnewplace}[3][]{%
 \tstidxnewutfplace[#1]{#2}{#2}{#2}{#3}%
}
\newcommand*{\tstidxnewutfplace}[5][]{%
 \if@tstidx@setdescription
   \tstidxnewutfentry{\tstidx@getlabel{#2}}{#3}{#4}{}%
     {description={#5},#1}{place}%
   \tstidxnewutfentry{\tstidx@getlabel{places.#2}}{#3}{#4}{}%
     {description={#5},parent={places}}{place}%
 \else
   \tstidxnewutfentry{\tstidx@getlabel{#2}}{#3}{#4}{}{#1}{place}%
   \tstidxnewutfentry{\tstidx@getlabel{places.#2}}{#3}{#4}{}%
     {parent={places}}{place}%
 \fi
}
\newcommand*{\tstidxnewartplace}[4][]{%
 \if@tstidx@setdescription
  \tstidxnewentry{\tstidx@getlabel{#3}}{place}{name={#3, #2},%
    text={#2 #3},description={#4},#1}%
  \tstidxnewentry{\tstidx@getlabel{places.#3}}{place}{%
    parent={places},name={#3, #2},%
    text={#2 #3},description={#4}}%
 \else
  \tstidxnewentry{\tstidx@getlabel{#3}}{place}{name={#3, #2},%
    text={#2 #3},description={},#1}%
  \tstidxnewentry{\tstidx@getlabel{places.#3}}{place}{%
    parent={places},name={#3, #2},%
    text={#2 #3},description={}}%
 \fi
}
\newcommand*{\tstidxnewbook}[3][]{%
 \if@tstidx@setdescription
  \tstidxnewentry{\tstidx@getlabel{#2}}{book}{sort={#2},%
   name={\tstidxbookfmt{#2}},description={#3},#1}%
  \tstidxnewentry{\tstidx@getlabel{books.#2}}{book}{sort={#2},%
   parent={books},name={\tstidxbookfmt{#2}},description={#3}}%
 \else
  \tstidxnewentry{\tstidx@getlabel{#2}}{book}{sort={#2},%
   name={\tstidxbookfmt{#2}},description={},#1}%
  \tstidxnewentry{\tstidx@getlabel{books.#2}}{book}{sort={#2},%
   parent={books},name={\tstidxbookfmt{#2}},description={}}%
 \fi
}
\newcommand*{\tstidxnewartbook}[4][]{%
 \if@tstidx@setdescription
  \tstidxnewentry{\tstidx@getlabel{#3}}{book}{%
   name={\tstidxbookfmt{#3, #2}},
   sort={#3, #2},
   text={\tstidxbookfmt{#2 #3}},description={#4},#1}%
  \tstidxnewentry{\tstidx@getlabel{books.#3}}{book}{%
   parent={books},
   name={\tstidxbookfmt{#3, #2}},
   sort={#3, #2},
   text={\tstidxbookfmt{#2 #3}},description={#4}}%
 \else
  \tstidxnewentry{\tstidx@getlabel{#3}}{book}{%
   name={\tstidxbookfmt{#3, #2}},
   sort={#3, #2},
   text={\tstidxbookfmt{#2 #3}},description={},#1}%
  \tstidxnewentry{\tstidx@getlabel{books.#3}}{book}{%
   parent={books},
   name={\tstidxbookfmt{#3, #2}},
   sort={#3, #2},
   text={\tstidxbookfmt{#2 #3}},description={}}%
 \fi
}
\newcommand*{\tstidxnewfilm}[3][]{%
 \if@tstidx@setdescription
  \tstidxnewentry{\tstidx@getlabel{#2}}{film}{sort={#2},%
   name={\tstidxfilmfmt{#2}},description={#3},#1}%
  \tstidxnewentry{\tstidx@getlabel{films.#2}}{film}{sort={#2},%
   parent={films},name={\tstidxfilmfmt{#2}},description={#3}}%
 \else
  \tstidxnewentry{\tstidx@getlabel{#2}}{film}{sort={#2},%
   name={\tstidxfilmfmt{#2}},description={},#1}%
  \tstidxnewentry{\tstidx@getlabel{films.#2}}{film}{sort={#2},%
   parent={films},name={\tstidxfilmfmt{#2}},description={}}%
 \fi
}
\newcommand*{\tstidxnewartfilm}[4][]{%
 \if@tstidx@setdescription
  \tstidxnewentry{\tstidx@getlabel{#3}}{film}{%
   name={\tstidxfilmfmt{#3, #2}},
   sort={#3, #2},
   text={\tstidxfilmfmt{#2 #3}},description={#4},#1}%
  \tstidxnewentry{\tstidx@getlabel{films.#3}}{film}{%
   parent={films},
   name={\tstidxfilmfmt{#3, #2}},
   sort={#3, #2},
   text={\tstidxfilmfmt{#2 #3}},description={#4}}%
 \else
  \tstidxnewentry{\tstidx@getlabel{#3}}{film}{%
   name={\tstidxfilmfmt{#3, #2}},
   sort={#3, #2},
   text={\tstidxfilmfmt{#2 #3}},description={},#1}%
  \tstidxnewentry{\tstidx@getlabel{films.#3}}{film}{%
   parent={films},
   name={\tstidxfilmfmt{#3, #2}},
   sort={#3, #2},
   text={\tstidxfilmfmt{#2 #3}},description={}}%
 \fi
}
\newcommand*{\@tidx@gls@par@i}{%
 This is a~sample block of text designed to test indexing with
 the \expandafter\tstidxsty\expandafter{\tstidx@glossariespkg} package. To test
 only \tstidxcs{index} and \tstidxenv{theindex} environment, just use
 \tstidxsty{testidx} instead of \tstidxsty{testidx-glossaries}.
 Alternatively, use \tstidxcs{tstidxtoidx} to switch back to the
 original \tstidxsty{testidx} behaviour.
 This sample text is provided to help test the
 \if@tstidx@use@encaps
  \tstidxword[tstidxencapii]{layout}
 \else
  \tstidxword{layout}
 \fi
  of the
 \if@tstidx@use@encaps
  \tstidxword[tstidxencapii]{index}
 \else
  \tstidxword{index}
 \fi
 (or
 \if@tstidx@use@encaps
  \tstidxword[tstidxencapii]{glossary}%
 \else
  \tstidxword{glossary}%
 \fi
 ) and the
 \if@tstidx@use@encaps
   \tstidxphrasepl[tstidxencapii]{indexing application},
 \else
   \tstidxphrasepl{indexing application},
 \fi
 such as
 \tstidxapp{makeindex} or
 \tstidxapp{xindy}, that may be used with the
 \expandafter\tstidxsty\expandafter{\tstidx@glossariespkg} package.
 This \tstidxword{example} text is just
 \tstidxword{filler} (produced using \tstidxcs{testidx} provided
 by the \tstidxopensty{testidx} package) to
 pad\tstindexsee{padding}{seealso}{filler} out
 the document with instances of \tstidxcs{index} interspersed throughout.
 You can find out more
 information from the \tstidxsty{testidx} user manual, which
 can be accessed using the \tstidxapp{texdoc} application.
}
\let\@tidx@org@par@i\@tidx@par@i
\let\@tidx@par@i\@tidx@gls@par@i
\newcommand*{\@tidx@gls@par@ii}{%
 The \tstidxsty{testidx-glossaries} package uses \tstidxcs{gls} (or
 \tstidxcs{glspl}) unless no text should be displayed when indexing
 occurs (in which case just \tstidxcs{glsadd} is used). This test package
 doesn't make any modifications to
 \tstidxcs{gls} (or \tstidxcs{glspl}), but there are some minor changes to entry
 definitions and command use to allow this \tstidxphrase{dummy text} to test
 various cases.  By default \tstidxcs{gls} performs the indexing before the
 \tstidxphrase{link text} to prevent any unwanted interference caused by the
 \tstidxword{whatsit} introduced by the indexing.
 However, it's possible that you may want the indexing to occur
 after the \tstidxphrase{link text}, even though it creates
 a~\tstidxword{whatsit}. This \tstidxphrase{dummy text} is designed to use
 a mixture of pre- and post-indexing to investigate the results (particularly
 with \tstidxwordpl{phrase} spanning a \tstidxphrase{page break}).
 The \tstidxsty{glossaries-extra} package (as from
 version 1.14) provides a~new key \tstidxqt{wrgloss} (for commands
 like \tstidxcs{gls}), which may take the values
 \tstidxqt{before} or \tstidxqt{after}. If this key is available,
 it will be used for the post-indexing \tstidxwordpl{example},
 otherwise the post-indexing will be performed manually using
 \tstidxcs{glsadd} after the \tstidxphrase{link text} (which is displayed using
 \tstidxcs{glshyperlink}). The \tstidxsty{testidx-glossaries} package
 just loads the base \tstidxsty{glossaries} package by default. Use
 the \tstidxstyopt{testidx-glossaries}{extra} package option to also
 load \tstidxsty{glossaries-extra}. The \tstidxphrase{visual effects} in this
 \tstidxphrase{dummy text} are provided to illustrate where the
 indexing occurs. The \tstidxsty{testidx-glossaries} package
 doesn't attempt to produce a well-designed index or glossary. Its
 \tstidxword{purpose} is to help you \tstidxword{test} your chosen
 \tstidxword{design}, which is easier to do with a
 relatively small test \tstidxword{document}, than with a large
 \tstidxword{book}. The \tstidxphrase{dummy text} is intended to produce an
 \tstidxword{index} that is at least three pages long to allow you
 to test the page headers and footers in a two-sided document.
 The \tstidxqt{mcolindexgroup} style is set by default (rather than
 the \tstidxqt{list} style) as that style more closely represents
 the style used in indexes.
 \if@tstidx@setdescription
  However, since this document has used the
  \tstidxstyopt{testidx-glossaries}{desc} option,
  the style is instead set to \tstidxqt{indexgroup}.
 \else
  If you use the \tstidxstyopt{testidx-glossaries}{desc} option,
  the style will instead be set to \tstidxqt{indexgroup}.
 \fi
 You can change the style using \tstidxcs{setglossarystyle}.
 By default the \tstidxqt{tree} styles (including
 \tstidxqt{mcolindexgroup}) display the name field in bold in the
 \tstidxword{glossary}. This is governed by the command
 \tstidxcs{glstreenamefmt}, which may be redefined as appropriate.
 You can hide the visual effects with the
 \tstidxstyopt{testidx}{hidemarks} package option.%
 \iftestidxshowmarks
 \else
  \space (It seems you already have this option set.
  Remove it or use \tstidxstyopt{testidx}{showmarks} to show them
  again.)%
 \fi
}
\let\@tidx@org@par@ii\@tidx@par@ii
\let\@tidx@par@ii\@tidx@gls@par@ii
\newcommand*{\@tidx@gls@par@iii}{%
 The actual place where the indexing occurs in this
 \if@tstidx@use@encaps
   \tstidxphrase[tstidxencapiii]{dummy text}
 \else
   \tstidxphrase{dummy text}
 \fi
 is marked with the symbol
 \tstidxindexmarker{tstidxmarker} if there is no \tstidxword{range}
or
 \tstidxphrase{cross-reference}. The
 \if@tstidx@use@encaps
   \tstidxword[tstidxencapi]{word}
 \else
   \tstidxword{word}
 \fi
 or
 \if@tstidx@use@encaps
   \tstidxword[tstidxencapii]{phrase}
 \else
   \tstidxword{phrase}
 \fi
 adjacent to this \tstidxword{marker} is
 the text being indexed.\tstidxfootnote{The indexing may
 occur before or after the \tstidxword{word} or \tstidxword{phrase}
 (\tstidxphrase{link text}) being indexed in this
 \if@tstidx@use@encaps
   \tstidxphrase[tstidxencapiii]{dummy text},
 \else
   \tstidxphrase{dummy text},
 \fi
 but there's no
 space between the \tstidxword{marker} and the term being indexed.
 Incidentally, this \tstidxword{footnote} text was produced
 using the command \tstidxcs{tstidxfootnote}, which you can
 redefined as required. (It defaults to just \tstidxcs{footnote}.)}
 A sub-entry is indicated with the symbol
 \tstidxindexmarker{tstidxsubmarker} and a sub-sub-entry is
 indicated with the symbol \tstidxindexmarker{tstidxsubsubmarker}.
 If an \tstidxword{encap} value is provided, both the
 \if@tstidx@use@encaps
  \tstidxword[tstidxencapiii]{text}
 \else
  \tstidxword{text}
 \fi
 and the
 \if@tstidx@use@encaps
   \tstidxword[tstidxencapii]{marker}
 \else
   \tstidxword{marker}
 \fi
 are typeset in the \tstidxword{argument} of the corresponding
command.
 (The text occurring in the document is also typeset within the
argument of
 \tstidxcs{tstidxtext}. The default value is to use a dark grey, but
since the
 default values for the \tstidxword{predefined} encaps used in this
text all
 change the colour, the dark grey will only apply where the encap
hasn't
 been set.) There are three \tstidxword{encap} values used
throughout this
 \tstidxphrase{dummy text} (unless you've used the
 \tstidxstyopt{testidx}{notestencaps} package option):
 \if@tstidx@use@encaps
  \tstidxencapcsn[tstidxencapi]{tstidxencapi},
 \else
  \tstidxencapcsn{tstidxencapi},
 \fi
 \if@tstidx@use@encaps
   \tstidxencapcsn[tstidxencapii]{tstidxencapii}
 \else
   \tstidxencapcsn{tstidxencapii}
 \fi
 and
 \if@tstidx@use@encaps
   \tstidxencapcsn[tstidxencapiii]{tstidxencapiii}.
 \else
   \tstidxencapcsn{tstidxencapiii}.
 \fi
 (The default values use \tstidxcs{textcolor}, so you might want to
use the
 \tstidxstyopt{hyperref}{hidelinks} option
 if you want to use the \tstidxsty{hyperref} package.)
 If you use the \tstidxstyopt{testidx-glossaries}{noseekey} package option, a
 cross-referenced entry (using \tstidxcs{glssee}\if@tstidx@hasseealsokey
  \ or \tstidxcs{glsxtrindexseealso}\fi) is identified
  using the \tstidxword{marker}  \tstidxindexmarker{tstidxseemarker}
 and the cross-referenced information is displayed as
 a \tstidxphrase{marginal note} by default, with the term being indexed
 followed by the \tstidxword{cross-reference}.
 For example,
 \tstidxword{lyuk}\tstindexsee{lyuk}{seealso}{digraph} has
 the marker \tstidxmarker\ to show that the word \tstidxqt{lyuk} was
 indexed. If the
\tstidxstyopt{testidx-glossaries}{noseekey} package option is set,
 this is followed by the marker \tstidxseemarker\ to show that
 a cross-reference to \tstidxword{digraph} has also been indexed (with the details shown in
 the margin).
 \if@tstidx@useglsseekey
   This document has used the \tstidxstyopt{testidx-glossaries}{seekey} package option,
   which means that \tstidxcs{glssee}
   \if@tstidx@hasseealsokey
    and \tstidxcs{glsxtrindexseealso} aren't
   \else
    isn't
   \fi
   used in the \tstidxphrase{dummy text}.
   Instead the \tstidxqt{see}
   \if@tstidx@hasseealsokey
    and \tstidxqt{seealso} keys provided in the entry definition were
   \else
    key provided in the entry definition was
   \fi
   used to perform the \tstidxword{cross-reference} at the time the entry was
   defined, and so no markers or marginal notes are displayed.
 \else
   This document has used the \tstidxstyopt{testidx-glossaries}{noseekey} package option. This option ignores the \tstidxqt{see}
   \if@tstidx@hasseealsokey
    and \tstidxqt{seealso} keys
   \else
    key
   \fi
   within the entry definitions for testing purposes. If you use the
   \tstidxstyopt{testidx-glossaries}{seekey}
   package option instead, the \tstidxqt{see}
   \if@tstidx@hasseealsokey
     and \tstidxqt{seealso} keys will
     be used when defining the entries with cross-references instead of
     using \tstidxcs{glssee} and \tstidxcs{glsxtrindexseealso}.
   \else
     key will be used when defining the entries with cross-references instead of
     using \tstidxcs{glssee}.
   \fi
   No markers will appear in that case as the
   cross-referencing will be performed when the entry is defined in
   the preamble.
 \fi
 A sub-level \tstidxword{cross-reference} is identified with the
 \tstidxword{marker} \tstidxindexmarker{tstidxsubseemarker} and the
 marginal note displays the main term followed by the sub-term (separated by the
 symbol \tstidxsubseesep).  The \tstidxword{marker} used for the start of
 a range is \tstidxindexmarker{tstidxopenmarker} and the
 \tstidxword{marker} used for the end of
 a range is \tstidxindexmarker{tstidxclosemarker}
 unless the entry is a sub-level, in which case the
 \tstidxword{marker} for the start of the range is
 \tstidxindexmarker{tstidxopensubmarker}
 and the \tstidxword{marker} used for the end of a range is
 \tstidxindexmarker{tstidxclosesubmarker}, or for a sub-sub-level
\tstidxindexmarker{tstidxopensubsubmarker} and
 \tstidxindexmarker{tstidxclosesubsubmarker}. There are no tests for
 any further sub-levels. Although \tstidxapp{xindy} allows more than
 three levels (\tstidxapp{makeindex} doesn't), it's somewhat
 \tstidxword{excessive} to go below a sub-sub-level.
 You'll have to add your own tests for anything deeper.%

}
\let\@tidx@org@par@iii\@tidx@par@iii
\let\@tidx@par@iii\@tidx@gls@par@iii
\newcommand*{\@tidx@gls@par@iv}{%
 Here's an \tstidxword{example} of the start of a
\tstidxopenword{range} but
 remember that a range must also have an end, so make sure that
 \tstidxword{block}~\@tidx@closerangepar\ has been included in this
 \if@tstidx@use@encaps
   \tstidxphrase[tstidxencapiii]{dummy text},
 \else
   \tstidxphrase{dummy text},
 \fi
  which closes this
 \tstidxword{example}.
 When the \tstidxstyopt{testidx}{verbose} option is used with just
 \tstidxsty{testidx}, the indexing information
 will show the \tstidxword{argument} being passed to
 \tstidxcs{tstindex} (which will cause \tstidxphrase{overfull lines}).
 Since the \tstidxsty{testidx-glossaries} package doesn't use
 \tstidxcs{tstindex}, the \tstidxstyopt{testidx-glossaries}{verbose} package
  option will instead write information to the transcript file showing the
 label, name field, sort field, text field, parent field and see field for each
 entry as it's defined. (The parent and see fields may be empty).
 If the \tstidxstyopt{testidx-glossaries}{tex} package option is
 used, the sorting may take a long time (since \TeX\ is being used
 to sort the entries). In this case, the
 \tstidxstyopt{testidx-glossaries}{verbose} package
 option will also write information while it's sorting the entries,
 so that you know \TeX\ is still doing something and hasn't got stuck.
 This document has the
 \iftestidxverbose
  \tstidxstyopt{testidx-glossaries}{verbose} package
 \else
  \tstidxstyopt{testidx-glossaries}{noverbose} package
 \fi
 option set.%
}
\let\@tidx@org@par@iv\@tidx@par@iv
\let\@tidx@par@iv\@tidx@gls@par@iv
\newcommand*{\@tidx@gls@par@vi}{%
 On the subject of \tstidxapp{xindy}, if you want to use it with
 this \tstidxword{example} document, you'll need to add the
 \tstidxword{encap} values used in this \tstidxphrase{dummy text}
 as allowed attributes. (Don't forget you'll also need the
 \tstidxstyopt{testidx-glossaries}{xindy} package option when you
 load \tstidxsty{testidx-glossaries}.) With the \tstidxsty{glossaries} package,
 this means using \tstidxcs{GlsAddXdyAttribute} with the
 encap name as the argument. For example
 \begin{flushleft}\ttfamily
 \string\GlsAddXdyAttribute\expandafter\@gobble\string\{tstidxencapi\expandafter\@gobble\string\}\endgraf
 \string\GlsAddXdyAttribute\expandafter\@gobble\string\{tstidxencapii\expandafter\@gobble\string\}\endgraf
 \string\GlsAddXdyAttribute\expandafter\@gobble\string\{tstidxencapiii\expandafter\@gobble\string\}
 \end{flushleft}
 This sets up allowed encap values and how they should be formatted.
 The ordering of the allowed \tstidxword{attributes} here gives the
 \tstidxencapcsn{tstidxencapi} encap precedence in the
 event of a \tstidxphrase{multiple encaps} clash, since it's the
 first one in the list.
 Check out the difference between using \tstidxapp{xindy} and
 \tstidxapp{makeindex} on this document. Also check the difference
 between using \tstidxapp{makeglossaries} and
 \tstidxapp{makeglossaries-lite} to build this document.
 The \tstidxsubword{location list}{page separator} is given by
 \tstidxcs{delimN}, and the
 \tstidxsubword{location list}{range separator}%
 \tstindexsee{range separator}{see}{location list} is given by
 \tstidxcs{delimR}.
 On the subject of location lists, the word
 \tstidxword{passim} (meaning \tstidxqt{here and there}) is
 sometimes used to tidy up ragged lists. For example,
 the locations \tstidxqt{1, 3, 4, 6, 7} may look neater as
 \tstidxqt{1-7 passim}, which indicates references are scattered (here
 and there) throughout that range.
 The \tstidxapp{bib2gls} application may be used with the
 \tstidxsty{glossaries-extra} package instead of
 \tstidxapp{makeindex} or \tstidxapp{xindy}. Use the
 \tstidxstyopt{testidx-glossaries}{bib2gls} package option to set up
 this dummy text to use it. Note that this option doesn't make use
 of the prefix commands \tstidxcs{tstidxindexmarkerprefix} or
 \tstidxcs{tstidxindexmathsymprefix}. The
 \tstidxstyopt{testidx}{prefix} package option will instead alter
 the way the bib files are loaded to produce a similar grouping.%
}
\let\@tidx@org@par@vi\@tidx@par@vi
\let\@tidx@par@vi\@tidx@gls@par@vi
\newcommand{\@tidx@gls@sanitizenote}{%
 \space You currently have the
 \@tstidx@ifsanitize
 {\tstidxstyopt{testidx-glossaries}{sanitize} option on.
  This means that the words containing \tstidxword{UTF-8} characters will
  first be sanitized before being passed to \tstidxcs{tstindex}, which
  will allow you to test how well the \tstidxphrase{indexing application}
  sorts \tstidxword{UTF-8} characters. If you'd rather test how
  \tstidxcs{index} writes these characters to the file read by the
  indexing application, use the \tstidxstyopt{testidx-glossaries}{nosanitize}
  option instead. This may cause the \tstidxword{UTF-8} characters to be
  written in terms of \tstidxcs{IeC}.
 }%
 {\tstidxstyopt{testidx-glossaries}{nosanitize} option on.
  This means that the words containing \tstidxword{UTF-8} characters
  may be written to the file processed by the
  \tstidxphrase{indexing application} in terms of
  \tstidxcs{IeC}. This allows you to test how \tstidxcs{index} behaves.
  If you'd rather test how the indexing application sorts
  \tstidxword{UTF-8} characters, use the
  \tstidxstyopt{testidx-glossaries}{sanitize}
  option instead, which will sanitize the \tstidxword{UTF-8} characters
  before passing them to \tstidxcs{tstindex}.
 }%
 The \tstidxstyopt{testidx-glossaries}{nosanitize} option doesn't
 have an effect when used with the
 \tstidxstyopt{testidx-glossaries}{bib2gls} package option, since
 the sort value isn't written to an external file.%
}
\let\@tidx@org@sanitizenote\@tidx@sanitizenote
\let\@tidx@sanitizenote\@tidx@gls@sanitizenote
\newcommand{\@tidx@gls@stripaccentsnote}{%
 \space The \tstidxstyopt{testidx-glossaries}{stripaccents} package option will
  effectively do, for example,
  \texttt{sort=\char`\{elite\char`\},
  name=\char`\{\string\'elite\char`\}}
  whereas the
  \tstidxstyopt{testidx-glossaries}{nostripaccents} package option will
  effectively do, for example,
  \texttt{sort=\char`\{\string\'elite\char`\},
  name=\char`\{\string\'elite\char`\}}. These options have
  no effect in UTF-8 mode.%
}
\let\@tidx@org@stripaccentsnote\@tidx@stripaccentsnote
\let\@tidx@stripaccentsnote\@tidx@gls@stripaccentsnote
\newcommand*{\@tidx@gls@scriptnote}{%
  (Note how the subscripts and superscripts can be affected
  by material inserted between the symbol and the sub- and
  superscripts. With the \tstidxsty{glossaries} package, this can be
  avoided by using the final optional argument of commands like
  \tstidxcs{gls} to bring the scripts into the
  \tstidxphrase{link text}, but not if the scripts also include
  \tstidxcs{gls}, as the superscript does here.)
}
\let\@tidx@org@scriptnote\@tidx@scriptnote
\let\@tidx@scriptnote\@tidx@gls@scriptnote
\newcommand*{\@tidx@gls@numberlettergroup}{%
  If you're using \tstidxapp{xindy}, the \tstidxqt{glsnumbers}
  letter group (with the title \tstidxqt{\glsnumbersgroupname}) will
  automatically be added to your \texttt{.xdy}
  file unless you switch off this feature with the
  \tstidxstyopt{testidx-glossaries}{noglsnumbers} package option.
}
\let\@tidx@org@numberlettergroup\@tidx@numberlettergroup
\let\@tidx@numberlettergroup\@tidx@gls@numberlettergroup
\newcommand*{\@tidx@gls@mathslettergroup}{%
 \@testidx@ifusebibgls
 {%
   Now I've been a bit fancy here and used multiple bib files
   to define the glossary entries. The maths symbols are defined in
   their own separate bib file.
  \iftestidxprefix
  This document has used the \tstidxstyopt{testidx}{prefix} package
  option, which means that \tstidxcs{tstidxmakegloss} is defined to
  perform separate sorts for each resource block, which enables the
  maths symbols to appear in their own group.
  \else
  This document has used the \tstidxstyopt{testidx}{noprefix} package
  option, which means that \tstidxcs{tstidxmakegloss} is defined to
  sort the maths symbols together with the main entries. If you
  use the \tstidxstyopt{testidx}{prefix} package instead, the maths
  symbols will be sorted separately and placed in their own group.
  \fi
  If you haven't used \tstidxcs{tstidxmakegloss} then the above
  won't apply. If you don't use the
  \tstidxstyopt{testidx-glossaries}{bib2gls} package option, then
  the \tstidxstyopt{testidx}{prefix} package will instead insert
  \texttt{\tstidxmathsymprefix} in front of
  the sort key so I can get \tstidxapp{xindy} to create a special
  group for the maths symbols.  Here's
 }%
 {%
 \iftestidxprefix
  Now I've been a bit fancy here and inserted
  \texttt{\tstidxmathsymprefix} in front of
  the sort key so I can get \tstidxapp{xindy} to create a special
  group for the maths symbols.  Here's
 \else
  This document has used the \tstidxstyopt{testidx}{noprefix}
  package option, which has switched of the sort prefixes.
  If you use the \tstidxstyopt{testidx}{prefix} option I can be a
  bit fancy here and insert
  \texttt{\tstidxmathsymprefix} in front of
  the sort key so I can get \tstidxapp{xindy} to create a special
  group for the maths symbols.  When you switch on the prefixes here's
 \fi
 }%
the code you can add to your document to implement it:
\begin{flushleft}\ttfamily
\string\GlsAddLetterGroup\glsopenbrace Maths\glsclosebrace\glsopenbrace
   \string:prefixes (\string"\tstidxmathsymprefix\string")
   \string:before \string"glsnumbers\string"\glsclosebrace
\end{flushleft}
}
\let\@tidx@org@mathslettergroup\@tidx@mathslettergroup
\let\@tidx@mathslettergroup\@tidx@gls@mathslettergroup
\endinput
%%
%% End of file `testidx-glossaries.sty'.
