%%
%% This is file `testidx.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% testidx.dtx  (with options: `testidx.sty,package')
%% 
%%  testidx.dtx
%%  Copyright 2016 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 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 testidx.dtx and testidx.ins and the derived file testidx.sty.
%% 
%% \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}[2016/10/17 v1.0 (NLCT)]
\RequirePackage{color}
\RequirePackage{ifxetex}
\RequirePackage{ifluatex}
\newcommand*{\@tstidx@ifutfviii}[2]{%
  \ifxetex
   #1%
  \else
   \ifluatex
     #1%
   \else
     \@ifundefined{inputencodingname}{#2}%
     {\ifx\inputencodingname\@tstidx@utfviii#1\else#2\fi}%
   \fi
  \fi
}
\newcommand*{\@tstidx@utfviii}{utf8}
\newcommand*{\tstidxprocessasciisort}{\tstidxprocessasciisortstrip}
\newcommand*{\testidxStripAccents}{%
  \renewcommand*{\tstidxprocessasciisort}{\tstidxprocessasciisortstrip}%
}
\newcommand*{\testidxNoStripAccents}{%
  \renewcommand*{\tstidxprocessasciisort}{\tstidxprocessasciisortnostrip}%
}
\DeclareOption{stripaccents}{\testidxStripAccents}
\DeclareOption{nostripaccents}{\testidxNoStripAccents}
\newcommand{\tstidxquote}{\string"}
\newcommand*{\tstidxumlaut}{%
  \expandafter\@gobble\string\\\tstidxquote\string"}
\newcommand*{\tstidxsortumlaut}{%
  \expandafter\@gobble\string\\\tstidxquote\string"}
\newcommand*{\tstidxsortumlautstrip}{\@firstofone}
\newcommand*{\testidxGermanOn}{%
  \let\@tstidx@ifgerman\@firstoftwo
  \renewcommand{\tstidxquote}{+}%
  \renewcommand*{\tstidxumlaut}{\string"}%
  \renewcommand*{\tstidxsortumlautstrip}{\string"}%
  \renewcommand*{\tstidxsortumlaut}{\string"}%
}
\newcommand*{\testidxGermanOff}{%
  \let\@tstidx@ifgerman\@secondoftwo
  \renewcommand{\tstidxquote}{\string"}%
  \renewcommand*{\tstidxumlaut}{%
  \expandafter\@gobble\string\\\tstidxquote\string"}%
  \renewcommand*{\tstidxsortumlautstrip}{\@firstofone}%
  \renewcommand*{\tstidxsortumlaut}{%
    \expandafter\@gobble\string\\\tstidxquote\string"}%
}
\newcommand*{\@tstidx@ifgerman}[2]{#2}
\DeclareOption{german}{\testidxGermanOn}
\DeclareOption{ngerman}{\testidxGermanOn}
\DeclareOption{nogerman}{\testidxGermanOff}
\ifxetex
  \newcommand*{\tstidxprocessutf}{%
    \tstidxprocessutfnosanitize
  }
\else
 \ifluatex
   \newcommand*{\tstidxprocessutf}{%
     \tstidxprocessutfnosanitize
   }
 \else
   \newcommand*{\tstidxprocessutf}{%
     \tstidxprocessutfsanitize
   }
 \fi
\fi
\newcommand*{\@tstidx@ifsanitize}[2]{#1}
\newcommand*{\testidxSanitizeOn}{%
   \let\@tstidx@ifsanitize\@firstoftwo
   \renewcommand*{\tstidxprocessutf}{%
     \tstidxprocessutfsanitize
   }%
}
\newcommand*{\testidxSanitizeOff}{%
   \let\@tstidx@ifsanitize\@secondoftwo
   \renewcommand*{\tstidxprocessutf}{%
     \tstidxprocessutfnosanitize
   }%
}
\DeclareOption{sanitize}{\testidxSanitizeOn}
\DeclareOption{nosanitize}{\testidxSanitizeOff}
\newif\iftestidxverbose
\testidxverbosefalse
\DeclareOption{verbose}{\testidxverbosetrue}
\DeclareOption{noverbose}{\testidxverbosefalse}
\newif\iftestidxshowmarks
\testidxshowmarkstrue
\DeclareOption{showmarks}{\testidxshowmarkstrue}
\DeclareOption{noshowmarks}{\testidxshowmarksfalse}
\DeclareOption{hidemarks}{\testidxshowmarksfalse}
\newif\if@tstidx@use@encaps
\@tstidx@use@encapstrue
\DeclareOption{testencaps}{\@tstidx@use@encapstrue}
\DeclareOption{notestencaps}{\@tstidx@use@encapsfalse}
\ProcessOptions
\AtBeginDocument{%
  \@ifpackageloaded{amsmath}%
  {\let\@tstidx@ifamsmath\@firstoftwo}%
  {\let\@tstidx@ifamsmath\@secondoftwo}%
  \@ifpackageloaded{inputenc}
  {
    \let\@tstidx@if@inputenc\@firstoftwo
  }%
  {%
    \ifxetex
      \let\@tstidx@if@inputenc\@firstoftwo
    \else
      \ifluatex
        \let\@tstidx@if@inputenc\@firstoftwo
      \else
        \let\@tstidx@if@inputenc\@secondoftwo
      \fi
    \fi
  }%
  \ifxetex
    \let\@tstidx@if@notOT@ne\@firstoftwo
  \else
    \ifluatex
      \let\@tstidx@if@notOT@ne\@firstoftwo
    \else
      \newcommand*{\@tstidx@OT@ne}{OT1}%
      \edef\@tstidx@enc{\encodingdefault}%
      \ifx\@tstidx@OT@ne\@tstidx@enc
        \let\@tstidx@if@notOT@ne\@secondoftwo
      \else
        \let\@tstidx@if@notOT@ne\@firstoftwo
      \fi
    \fi
  \fi
}
\newcommand{\tstidxactual}{\string @}
\newcommand{\tstidxlevel}{\string!}
\newcommand{\tstidxencap}{\string|}
\newcommand{\tstidxopenrange}{\string(}
\newcommand{\tstidxcloserange}{\string)}
\newcommand*{\tstidxprocessascii}[2]{%
  {%
    \let\"\tstidxumlaut
    \def\'{\string\'}%
    \def\`{\string\`}%
    \def\.{\string\.}%
    \def\={\string\=}%
    \def\^{\string\^}%
    \def\~{\string\~}%
    \def\c{\string\c}%
    \def\r{\string\r}%
    \def\b{\string\b}%
    \def\d{\string\d}%
    \def\H{\string\H}%
    \def\k{\string\k}%
    \def\u{\string\u}%
    \def\v{\string\v}%
    \def\O{\string\O\space}%
    \def\o{\string\o\space}%
    \def\l{\string\l\space}%
    \def\L{\string\L\space}%
    \def\i{\string\i\space}%
    \def\AA{\string\AA\space}%
    \def\aa{\string\aa\space}%
    \def\ae{\string\ae\space}%
    \def\AE{\string\AE\space}%
    \def\oe{\string\oe\space}%
    \def\OE{\string\OE\space}%
    \def\ss{\string\ss\space}%
    \def\SS{\string\SS\space}%
    \def\th{\string\th\space}%
    \def\TH{\string\TH\space}%
    \def\dh{\string\dh\space}%
    \def\DH{\string\DH\space}%
    \def\dj{\string\dj\space}%
    \def\DJ{\string\DJ\space}%
    \def\ng{\string\ng\space}%
    \def\NG{\string\NG\space}%
    \protected@xdef#1{#2}%
  }%
}
\newcommand*{\tstidxprocessasciisortnostrip}[2]{%
  {%
    \let\"\tstidxsortumlaut
    \protected@xdef#1{#2}%
  }%
}
\newcommand*{\tstidxprocessasciisortstrip}[2]{%
  {%
    \let\"\tstidxsortumlautstrip
    \let\'\@firstofone
    \let\`\@firstofone
    \let\.\@firstofone
    \let\=\@firstofone
    \let\^\@firstofone
    \let\~\@firstofone
    \let\c\@firstofone
    \let\r\@firstofone
    \let\b\@firstofone
    \let\d\@firstofone
    \let\H\@firstofone
    \let\k\@firstofone
    \let\u\@firstofone
    \let\v\@firstofone
    \def\O{O}%
    \def\o{o}%
    \def\l{l}%
    \def\L{L}%
    \def\i{i}%
    \def\AA{A}%
    \def\aa{a}%
    \def\ae{ae}%
    \def\AE{AE}%
    \def\oe{oe}%
    \def\OE{OE}%
    \def\ss{ss}%
    \def\SS{SS}%
    \def\th{th}%
    \def\TH{TH}%
    \def\dh{dh}%
    \def\DH{DH}%
    \def\dj{dj}%
    \def\DJ{DJ}%
    \def\ng{ng}%
    \def\NG{NG}%
    \protected@xdef#1{#2}%
  }%
}
\newcommand*{\tstidxprocessutfsanitize}[2]{%
  \def#1{#2}%
  \@onelevel@sanitize#1%
}
\newcommand*{\tstidxprocessutfnosanitize}[2]{%
  \def#1{#2}%
}
\newcommand*{\tstidxencaptext}[2]{%
  \@ifundefined{#1}%
  {%
    \PackageError{testidx}{Encap value `#1' doesn't correspond
    to a known command}{}%
  }%
  {%
    \csname#1\endcsname{#2}%
  }%
}
\newcommand*{\tstidxtext}[1]{\textcolor[gray]{0.3}{#1}}
\newcommand*{\tstidxencapi}[1]{\textcolor{blue}{#1}}
\newcommand*{\tstidxencapii}[1]{\textcolor{cyan}{#1}}
\newcommand*{\tstidxencapiii}[1]{\textcolor{magenta}{#1}}
\newcommand*{\tstidxensuretext}[1]{%
 \ifmmode
  \@tstidx@ifamsmath{\text{#1}}{\mbox{#1}}%
 \else
  #1%
 \fi
}
\newcommand*{\tstidxmarker}{%
 \tstidxensuretext{\raisebox{.65ex}{.}}%
}
\newcommand*{\tstidxsubmarker}{%
 \tstidxensuretext{\strut\smash{\raisebox{-1.5ex}{\v{}}}}%
}
\newcommand*{\tstidxsubsubmarker}{%
 \tstidxensuretext{\strut\makebox[0pt][l]{\smash{\raisebox{-1ex}{\v{}}}}%
 \smash{\raisebox{-1.5ex}{\v{}}}}%
}
\newcommand*{\tstidxopenmarker}{%
  \tstidxensuretext
  {%
   \setlength{\unitlength}{1ex}%
   \begin{picture}(.5,2)
   \put(\@halfwidth\@gobble,0){\line(0,1){2}}
   \put(0,2){\line(1,0){.5}}
   \end{picture}%
   \hspace{\@halfwidth}%
 }%
}
\newcommand*{\tstidxclosemarker}{%
  \tstidxensuretext
  {%
   \setlength{\unitlength}{1ex}%
   \begin{picture}(.5,2)
   \put(\@halfwidth\@gobble,0){\line(1,0){.5}}
   \put(.5,0){\line(0,1){2}}
   \end{picture}%
   \hspace{\@halfwidth}%
 }%
}
\newcommand*{\tstidxopensubmarker}{%
 \tstidxensuretext
 {%
   \setlength{\unitlength}{1ex}%
   \begin{picture}(.4,1.6)
   \put(\@halfwidth\@gobble,0){\line(0,1){1.6}}
   \put(0,1.6){\line(1,0){.4}}
   \end{picture}%
   \hspace{\@halfwidth}%
 }%
}
\newcommand*{\tstidxclosesubmarker}{%
 \tstidxensuretext
 {%
   \setlength{\unitlength}{1ex}%
   \begin{picture}(.4,1.6)
   \put(\@halfwidth\@gobble,0){\line(1,0){.4}}
   \put(.4,0){\line(0,1){1.6}}
   \end{picture}%
   \hspace{\@halfwidth}%
 }%
}
\newcommand*{\tstidxopensubsubmarker}{%
 \tstidxensuretext
 {%
   \setlength{\unitlength}{1ex}%
   \begin{picture}(.3,1.2)
   \put(\@halfwidth\@gobble,0){\line(0,1){1.2}}
   \put(0,1.2){\line(1,0){.3}}
   \end{picture}%
   \hspace{\@halfwidth}%
 }%
}
\newcommand*{\tstidxclosesubsubmarker}{%
 \tstidxensuretext
 {%
   \setlength{\unitlength}{1ex}%
   \begin{picture}(.3,1.2)
   \put(\@halfwidth\@gobble,0){\line(1,0){.3}}
   \put(.3,0){\line(0,1){1.2}}
   \end{picture}%
   \hspace{\@halfwidth}%
 }%
}
\newcommand*{\tstidxseemarker}{\^{}}
\newcommand*{\tstidxseeref}[3]{\tstidxseemarker
 \marginpar{\strut\raggedright\footnotesize
   \normalcolor\tstidxseemarker#1, \csname#2\endcsname{#3}{}}%
}
\newcommand*{\tstidxsubseemarker}{%
 \tstidxensuretext{\makebox[0pt][l]{\tstidxsubmarker}%
 \tstidxseemarker}%
}
\newcommand*{\tstidxsubseeref}[4]{\tstidxsubseemarker
 \marginpar{\strut\raggedright\footnotesize
   \normalcolor\tstidxsubseemarker#1\tstidxsubseesep#2, \csname#3\endcsname{#4}{}}%
}
\newcommand*{\tstidxsubseesep}{\,$\triangleright$\,}
\newcommand*{\tstindex}{\index}
\newcommand*{\@tstindex}[1]{%
  \iftestidxverbose
   \def\@tstindex@arg{#1}%
   \@onelevel@sanitize\@tstindex@arg
   \testidxverbosefmt{\@tstindex@arg}%
  \fi
  \tstindex{#1}%
}
\newcommand*{\testidxverbosefmt}[1]{%
  \expandafter\def\expandafter\@tstidx@tmp\expandafter{\tstindex}%
  \@onelevel@sanitize\@tstidx@tmp
  \tstidxensuretext{%
    \discretionary{}{}{}%
    {\footnotesize\texttt{\@tstidx@tmp
     \expandafter\@gobble\string\{#1\expandafter\@gobble\string\}}}%
    \discretionary{}{}{}%
  }%
}
\newcommand*{\tstidxqt}[1]{``#1''}
\newcommand*{\tstidxdash}{\,---\,}
\newcommand*{\tstidxfootnote}{\footnote}
\newcommand*{\tstidxfmtpost}[3]{%
  \tstindexpost[#1]{\protect#2{#1}}{#3}{#2{#1}}%
}
\newcommand*{\tstidxfmtopenpost}[3]{%
  \tstindexopenpost[#1]{\protect#2{#1}}{#3}{#2{#1}}%
}
\newcommand*{\tstidxfmtclosepost}[3]{%
  \tstindexclosepost[#1]{\protect#2{#1}}{#3}{#2{#1}}%
}
\newcommand*{\tstidxfmtpre}[3]{%
  \tstindexpre[#1]{\protect#2{#1}}{#3}{#2{#1}}%
}
\newcommand*{\tstidxfmtopenpre}[3]{%
  \tstindexopenpre[#1]{\protect#2{#1}}{#3}{#2{#1}}%
}
\newcommand*{\tstidxfmtclosepre}[3]{%
  \tstindexclosepre[#1]{\protect#2{#1}}{#3}{#2{#1}}%
}
\newcommand*{\tstidxutf}[5]{%
  \def\@tstidx@text{#1}%
  \@tstidx@ifutfviii
  {%
    \ifx\@tstidx@text\@empty
      \def\@tstidx@text{#3}%
    \fi
    \tstidxprocessutf{\@tstidx@utf}{#3}%
    \protected@edef\@tstidx@doidx{%
      \noexpand#5{\unexpanded\expandafter{\@tstidx@utf}}{#4}%
        {\@tstidx@text}%
    }%
  }%
  {%
    \ifx\@tstidx@text\@empty
      \def\@tstidx@text{#2}%
    \fi
    \tstidxprocessascii{\@tstidx@ascii}{#2}%
    \tstidxprocessasciisort{\@tstidx@asciisort}{#2}%
    \protected@edef\@tstidx@doidx{%
      \noexpand#5[\unexpanded\expandafter{\@tstidx@asciisort}]%
        {\unexpanded\expandafter{\@tstidx@ascii}}{#4}%
        {\@tstidx@text}%
    }%
  }%
  \@tstidx@doidx
}
\newcommand*{\tstidxsubutf}[7]{%
  \def\@tstidx@text{#1}%
  \@tstidx@ifutfviii
  {%
    \ifx\@tstidx@text\@empty
      \def\@tstidx@text{#3}%
    \fi
    \tstidxprocessutf{\@tstidx@utf}{#3}%
    \tstidxprocessutf{\@tstidx@subutf}{#5}%
    \protected@edef\@tstidx@doidx{%
      \noexpand#7{\unexpanded\expandafter{\@tstidx@utf}}%
        {\unexpanded\expandafter{\@tstidx@subutf}}%
        {#6}%
        {\@tstidx@text}%
    }%
  }%
  {%
    \ifx\@tstidx@text\@empty
      \def\@tstidx@text{#2}%
    \fi
    \tstidxprocessascii{\@tstidx@ascii}{#2}%
    \tstidxprocessasciisort{\@tstidx@asciisort}{#2}%
    \tstidxprocessascii{\@tstidx@subascii}{#4}%
    \tstidxprocessasciisort{\@tstidx@subasciisort}{#4}%
    \protected@edef\@tstidx@doidx{%
      \noexpand#7[\unexpanded\expandafter{\@tstidx@asciisort}]%
        {\unexpanded\expandafter{\@tstidx@ascii}}%
        [\unexpanded\expandafter{\@tstidx@subasciisort}]%
        {\unexpanded\expandafter{\@tstidx@subascii}}%
        {#6}%
        {\@tstidx@text}%
    }%
  }%
  \@tstidx@doidx
}
\newcommand*{\tstidxutfpost}[4][]{%
  \tstidxutf{#1}{#2}{#3}{#4}{\tstindexpost}%
}
\newcommand*{\tstidxutfopenpost}[4][]{%
  \tstidxutf{#1}{#2}{#3}{#4}{\tstindexopenpost}%
}
\newcommand*{\tstidxutfclosepost}[4][]{%
  \tstidxutf{#1}{#2}{#3}{#4}{\tstindexclosepost}%
}
\newcommand*{\tstidxutfpre}[4][]{%
  \tstidxutf{#1}{#2}{#3}{#4}{\tstindexpre}%
}
\newcommand*{\tstidxutfopenpre}[4][]{%
  \tstidxutf{#1}{#2}{#3}{#4}{\tstindexopenpre}%
}
\newcommand*{\tstidxutfclosepre}[4][]{%
  \tstidxutf{#1}{#2}{#3}{#4}{\tstindexclosepre}%
}
\newcommand*{\tstidxutfsubpost}[6][]{%
  \tstidxsubutf{#1}{#2}{#3}{#4}{#5}{#6}{\tstsubindexpost}%
}
\newcommand*{\tstidxutfsubopenpost}[6][]{%
  \tstidxsubutf{#1}{#2}{#3}{#4}{#5}{#6}{\tstsubindexopenpost}%
}
\newcommand*{\tstidxutfsubclosepost}[6][]{%
  \tstidxsubutf{#1}{#2}{#3}{#4}{#5}{#6}{\tstsubindexclosepost}%
}
\newcommand*{\tstidxutfsubpre}[6][]{%
  \tstidxsubutf{#1}{#2}{#3}{#4}{#5}{#6}{\tstsubindexpre}%
}
\newcommand*{\tstidxutfsubopenpre}[6][]{%
  \tstidxsubutf{#1}{#2}{#3}{#4}{#5}{#6}{\tstsubindexopenpre}%
}
\newcommand*{\tstidxutfsubclosepre}[6][]{%
  \tstidxsubutf{#1}{#2}{#3}{#4}{#5}{#6}{\tstsubindexclosepre}%
}
\newcommand*{\tstidxcsfmt}[1]{\texttt{\char`\\#1}}
\if@tstidx@use@encaps
 \newcommand*{\tstidxcs}[2][tstidxencapi]{%
   \tstidxfmtpost{#2}{\tstidxcsfmt}{#1}%
 }
\else
 \newcommand*{\tstidxcs}[2][]{%
   \tstidxfmtpost{#2}{\tstidxcsfmt}{#1}%
 }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxopencs}[2][tstidxencapi]{%
    \tstidxfmtopenpost{#2}{\tstidxcsfmt}{#1}%
  }
\else
  \newcommand*{\tstidxopencs}[2][]{%
    \tstidxfmtopenpost{#2}{\tstidxcsfmt}{#1}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxclosecs}[2][tstidxencapi]{%
    \tstidxfmtclosepost{#2}{\tstidxcsfmt}{#1}%
  }
\else
  \newcommand*{\tstidxclosecs}[2][]{%
    \tstidxfmtclosepost{#2}{\tstidxcsfmt}{#1}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxencapcsn}[2][tstidxencapi]{%
    \tstindexpost[#2 (#2)]%
    {\texttt{#2} (\protect\tstidxcsfmt{#2})}{#1}{\texttt{#2}}%
    \tstsubindexpost{encap}[#2]{\texttt{#2}}{#1}{}%
  }
\else
  \newcommand*{\tstidxencapcsn}[2][]{%
    \tstindexpost[#2 (#2)]%
    {\texttt{#2} (\protect\tstidxcsfmt{#2})}{#1}{\texttt{#2}}%
    \tstsubindexpost{encap}[#2]{\texttt{#2}}{#1}{}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxopencsn}[2][tstidxencapi]{%
    \tstindexopenpost[#2 (#2)]%
    {\texttt{#2} (\protect\tstidxcsfmt{#2})}{#1}{\texttt{#2}}%
  }
\else
  \newcommand*{\tstidxopencsn}[2][]{%
    \tstindexopenpost[#2 (#2)]%
    {\texttt{#2} (\protect\tstidxcsfmt{#2})}{#1}{\texttt{#2}}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxclosecsn}[2][tstidxencapi]{%
    \tstindexclosepost[#2 (#2)]%
    {\texttt{#2} (\protect\tstidxcsfmt{#2})}{#1}{\texttt{#2}}%
  }
\else
  \newcommand*{\tstidxclosecsn}[2][]{%
    \tstindexclosepost[#2 (#2)]%
    {\texttt{#2} (\protect\tstidxcsfmt{#2})}{#1}{\texttt{#2}}%
  }
\fi
\newcommand*{\tstidxenvfmt}[1]{\texttt{#1}}
\if@tstidx@use@encaps
  \newcommand*{\tstidxenv}[2][tstidxencapi]{%
    \tstindexpost[#2 environment]%
    {\protect\tstidxenvfmt{#2} environment}{#1}%
    {\tstidxenvfmt{#2}}%
  }
\else
  \newcommand*{\tstidxenv}[2][]{%
    \tstindexpost[#2 environment]%
    {\protect\tstidxenvfmt{#2} environment}{#1}%
    {\tstidxenvfmt{#2}}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxopenenv}[2][tstidxencapi]{%
    \tstindexopenpost[#2 environment]%
    {\protect\tstidxenvfmt{#2} environment}{#1}%
    {\tstidxenvfmt{#2}}%
  }
\else
  \newcommand*{\tstidxopenenv}[2][]{%
    \tstindexopenpost[#2 environment]%
    {\protect\tstidxenvfmt{#2} environment}{#1}%
    {\tstidxenvfmt{#2}}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxcloseenv}[2][tstidxencapi]{%
    \tstindexclosepost[#2 environment]%
    {\protect\tstidxenvfmt{#2} environment}{#1}%
    {\tstidxenvfmt{#2}}%
  }
\else
  \newcommand*{\tstidxcloseenv}[2][]{%
    \tstindexclosepost[#2 environment]%
    {\protect\tstidxenvfmt{#2} environment}{#1}%
    {\tstidxenvfmt{#2}}%
  }
\fi
\newcommand*{\tstidxappfmt}[1]{\texttt{#1}}
\if@tstidx@use@encaps
  \newcommand*{\tstidxapp}[2][tstidxencapi]{%
    \tstidxfmtpost{#2}{\tstidxappfmt}{#1}%
    \tstsubindexpost{applications}[#2]{\protect\tstidxappfmt{#2}}{#1}{}%
  }
\else
  \newcommand*{\tstidxapp}[2][]{%
    \tstidxfmtpost{#2}{\tstidxappfmt}{#1}%
    \tstsubindexpost{applications}[#2]{\protect\tstidxappfmt{#2}}{#1}{}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxopenapp}[2][tstidxencapi]{%
    \tstidxfmtopenpost{#2}{\tstidxappfmt}{#1}%
    \tstsubindexopenpost{applications}[#2]{\protect\tstidxappfmt{#2}}{#1}{}%
  }
\else
  \newcommand*{\tstidxopenapp}[2][]{%
    \tstidxfmtopenpost{#2}{\tstidxappfmt}{#1}%
    \tstsubindexopenpost{applications}[#2]{\protect\tstidxappfmt{#2}}{#1}{}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxcloseapp}[2][tstidxencapi]{%
    \tstidxfmtclosepost{#2}{\tstidxappfmt}{#1}%
    \tstsubindexclosepost{applications}[#2]{\protect\tstidxappfmt{#2}}{#1}{}%
  }
\else
  \newcommand*{\tstidxcloseapp}[2][]{%
    \tstidxfmtclosepost{#2}{\tstidxappfmt}{#1}%
    \tstsubindexclosepost{applications}[#2]{\protect\tstidxappfmt{#2}}{#1}{}%
  }
\fi
\newcommand*{\tstidxappoptfmt}[1]{\texttt{#1}}
\if@tstidx@use@encaps
  \newcommand*{\tstidxappopt}[3][tstidxencapiii]{%
    \tstsubindexpost[#2]{\protect\tstidxappfmt{#2}}%
      [#3]{\protect\tstidxappoptfmt{#3}}{#1}{\tstidxappoptfmt{#3}}%
    \tstsubsubindexpost{applications}[#2]{\protect\tstidxappfmt{#2}}%
      [#3]{\protect\tstidxappoptfmt{#3}}{#1}{}%
  }
\else
  \newcommand*{\tstidxappopt}[3][]{%
    \tstsubindexpost[#2]{\protect\tstidxappfmt{#2}}%
      [#3]{\protect\tstidxappoptfmt{#3}}{#1}{\tstidxappoptfmt{#3}}%
    \tstsubsubindexpost{applications}[#2]{\protect\tstidxappfmt{#2}}%
      [#3]{\protect\tstidxappoptfmt{#3}}{#1}{}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxopenappopt}[3][tstidxencapiii]{%
    \tstsubindexopenpost[#2]{\protect\tstidxappfmt{#2}}%
      [#3]{\protect\tstidxappoptfmt{#3}}{#1}{\tstidxappoptfmt{#3}}%
    \tstsubsubindexopenpost{applications}[#2]%
      {\protect\tstidxappfmt{#2}}%
      [#3]{\protect\tstidxappoptfmt{#3}}{#1}{}%
  }
\else
  \newcommand*{\tstidxopenappopt}[3][]{%
    \tstsubindexopenpost[#2]{\protect\tstidxappfmt{#2}}%
      [#3]{\protect\tstidxappoptfmt{#3}}{#1}{\tstidxappoptfmt{#3}}%
    \tstsubsubindexopenpost{applications}[#2]%
      {\protect\tstidxappfmt{#2}}%
      [#3]{\protect\tstidxappoptfmt{#3}}{#1}{}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxcloseappopt}[3][tstidxencapiii]{%
    \tstsubindexclosepost[#2]{\protect\tstidxappfmt{#2}}%
      [#3]{\protect\tstidxappoptfmt{#3}}{#1}{\tstidxappoptfmt{#3}}%
    \tstsubsubindexclosepost{applications}[#2]%
      {\protect\tstidxappfmt{#2}}%
      [#3]{\protect\tstidxappoptfmt{#3}}{#1}{}%
  }
\else
  \newcommand*{\tstidxcloseappopt}[3][]{%
    \tstsubindexclosepost[#2]{\protect\tstidxappfmt{#2}}%
      [#3]{\protect\tstidxappoptfmt{#3}}{#1}{\tstidxappoptfmt{#3}}%
    \tstsubsubindexclosepost{applications}[#2]%
      {\protect\tstidxappfmt{#2}}%
      [#3]{\protect\tstidxappoptfmt{#3}}{#1}{}%
  }
\fi
\newcommand*{\tstidxstyfmt}[1]{\texttt{#1}}
\if@tstidx@use@encaps
  \newcommand*{\tstidxsty}[2][tstidxencapiii]{%
    \tstindexpost[#2 package]%
     {\protect\tstidxstyfmt{#2} package}{#1}{\tstidxstyfmt{#2}}%
    \tstsubindexpost{packages}[#2 package]%
     {\protect\tstidxstyfmt{#2} package}{#1}{}%
  }
\else
  \newcommand*{\tstidxsty}[2][]{%
    \tstindexpost[#2 package]%
     {\protect\tstidxstyfmt{#2} package}{#1}{\tstidxstyfmt{#2}}%
    \tstsubindexpost{packages}[#2 package]%
     {\protect\tstidxstyfmt{#2} package}{#1}{}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxopensty}[2][tstidxencapiii]{%
    \tstindexopenpost[#2 package]{\protect\tstidxstyfmt{#2} package}{#1}%
      {\tstidxstyfmt{#2}}%
    \tstsubindexopenpost{packages}[#2 package]%
      {\protect\tstidxstyfmt{#2} package}{#1}{}%
  }
\else
  \newcommand*{\tstidxopensty}[2][]{%
    \tstindexopenpost[#2 package]{\protect\tstidxstyfmt{#2} package}{#1}%
      {\tstidxstyfmt{#2}}%
    \tstsubindexopenpost{packages}[#2 package]%
      {\protect\tstidxstyfmt{#2} package}{#1}{}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxclosesty}[2][tstidxencapiii]{%
    \tstindexclosepost[#2 package]{\protect\tstidxstyfmt{#2} package}{#1}%
     {\tstidxstyfmt{#2}}%
    \tstsubindexclosepost{packages}[#2 package]%
     {\protect\tstidxstyfmt{#2} package}{#1}{}%
  }
\else
  \newcommand*{\tstidxclosesty}[2][]{%
    \tstindexclosepost[#2 package]{\protect\tstidxstyfmt{#2} package}{#1}%
     {\tstidxstyfmt{#2}}%
    \tstsubindexclosepost{packages}[#2 package]%
     {\protect\tstidxstyfmt{#2} package}{#1}{}%
  }
\fi
\newcommand*{\tstidxstyoptfmt}[1]{\texttt{#1}}
\if@tstidx@use@encaps
  \newcommand*{\tstidxstyopt}[3][tstidxencapiii]{%
    \tstsubindexpost[#2 package]{\protect\tstidxstyfmt{#2} package}%
      [#3]{\protect\tstidxstyoptfmt{#3}}{#1}{\tstidxstyoptfmt{#3}}%
    \tstsubsubindexpost{packages}[#2 package]%
      {\protect\tstidxstyfmt{#2} package}%
      [#3]{\protect\tstidxstyoptfmt{#3}}{#1}{}%
  }
\else
  \newcommand*{\tstidxstyopt}[3][]{%
    \tstsubindexpost[#2 package]{\protect\tstidxstyfmt{#2} package}%
      [#3]{\protect\tstidxstyoptfmt{#3}}{#1}{\tstidxstyoptfmt{#3}}%
    \tstsubsubindexpost{packages}[#2 package]%
      {\protect\tstidxstyfmt{#2} package}%
      [#3]{\protect\tstidxstyoptfmt{#3}}{#1}{}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxopenstyopt}[3][tstidxencapiii]{%
    \tstsubindexopenpost[#2 package]{\protect\tstidxstyfmt{#2} package}%
      [#3]{\protect\tstidxstyoptfmt{#3}}{#1}{\tstidxstyoptfmt{#3}}%
    \tstsubsubindexopenpost{packages}[#2 package]%
      {\protect\tstidxstyfmt{#2} package}%
      [#3]{\protect\tstidxstyoptfmt{#3}}{#1}{}%
  }
\else
  \newcommand*{\tstidxopenstyopt}[3][]{%
    \tstsubindexopenpost[#2 package]{\protect\tstidxstyfmt{#2} package}%
      [#3]{\protect\tstidxstyoptfmt{#3}}{#1}{\tstidxstyoptfmt{#3}}%
    \tstsubsubindexopenpost{packages}[#2 package]%
      {\protect\tstidxstyfmt{#2} package}%
      [#3]{\protect\tstidxstyoptfmt{#3}}{#1}{}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxclosestyopt}[3][tstidxencapiii]{%
    \tstsubindexclosepost[#2 package]{\protect\tstidxstyfmt{#2} package}%
      [#3]{\protect\tstidxstyoptfmt{#3}}{#1}{\tstidxstyoptfmt{#3}}%
    \tstsubsubindexclosepost{packages}[#2 package]%
      {\protect\tstidxstyfmt{#2} package}%
      [#3]{\protect\tstidxstyoptfmt{#3}}{#1}{}%
  }
\else
  \newcommand*{\tstidxclosestyopt}[3][]{%
    \tstsubindexclosepost[#2 package]{\protect\tstidxstyfmt{#2} package}%
      [#3]{\protect\tstidxstyoptfmt{#3}}{#1}{\tstidxstyoptfmt{#3}}%
    \tstsubsubindexclosepost{packages}[#2 package]%
      {\protect\tstidxstyfmt{#2} package}%
      [#3]{\protect\tstidxstyoptfmt{#3}}{#1}{}%
  }
\fi
\newcommand*{\tstidxword}[2][]{%
  \tstindexpost{#2}{#1}{#2}%
}
\newcommand*{\tstidxopenword}[2][]{%
  \tstindexopenpost{#2}{#1}{#2}%
}
\newcommand*{\tstidxcloseword}[2][]{%
  \tstindexclosepost{#2}{#1}{#2}%
}
\newcommand*{\tstidxsubword}[3][]{%
  \tstsubindexpost{#2}{#3}{#1}{#3}%
}
\if@tstidx@use@encaps
  \newcommand*{\tstidxnumber}[2][tstidxencapiii]{%
    \tstindexpost{#2}{#1}{#2}%
  }
\else
  \newcommand*{\tstidxnumber}[2][]{%
    \tstindexpost{#2}{#1}{#2}%
  }
\fi
\newcommand*{\tstidxphrase}[2][]{%
  \tstindexpre{#2}{#1}{#2}%
}
\newcommand*{\tstidxopenphrase}[2][]{%
  \tstindexopenpre{#2}{#1}{#2}%
}
\newcommand*{\tstidxclosephrase}[2][]{%
  \tstindexclosepre{#2}{#1}{#2}%
}
\newcommand*{\tstidxartphrase}[3][]{%
  \tstindexpost{#3, #2}{#1}{#2 #3}%
}
\newcommand*{\tstidxopenartphrase}[3][]{%
  \tstindexopenpost{#3, #2}{#1}{#2 #3}%
}
\newcommand*{\tstidxcloseartphrase}[3][]{%
  \tstindexclosepost{#3, #2}{#1}{#2 #3}%
}
\newcommand*{\tstidxperson}[3][]{%
  \tstidxutfperson[#1]{#2}{#3}{#2}{#3}%
}
\newcommand*{\tstidxopenperson}[3][]{%
  \tstidxutfopenperson[#1]{#2}{#3}{#2}{#3}%
}
\newcommand*{\tstidxcloseperson}[3][]{%
  \tstidxutfcloseperson[#1]{#2}{#3}{#2}{#3}%
}
\newcommand*{\tstidxutfperson}[5][]{%
  \@tstidx@ifutfviii
  {%
    \tstidxutfpost[#4 #5]{#3, #2}{#5, #4}{#1}%
  }%
  {%
    \tstidxutfpost[#2 #3]{#3, #2}{#5, #4}{#1}%
  }%
  \tstidxutfsubpost[\relax]{people}{people}{#3, #2}{#5, #4}{#1}%
}
\newcommand*{\tstidxutfopenperson}[5][]{%
  \@tstidx@ifutfviii
  {%
    \tstidxutfopenpost[#4 #5]{#3, #2}{#5, #4}{#1}%
  }%
  {%
    \tstidxutfopenpost[#2 #3]{#3, #2}{#5, #4}{#1}%
  }%
}
\newcommand*{\tstidxutfcloseperson}[7][]{%
  \@tstidx@ifutfviii
  {%
    \tstidxutfclosepost[#4 #5]{#3, #2}{#5, #4}{#1}%
  }%
  {%
    \tstidxutfclosepost[#2 #3]{#3, #2}{#5, #4}{#1}%
  }%
}
\newcommand*{\tstidxsym}[3][]{%
  \tstindexpost[#2]{\protect#3}{#1}{#3}%
}
\newcommand*{\tstidxopensym}[3][]{%
  \tstindexopenpost[#2]{\protect#3}{#1}{#3}%
}
\newcommand*{\tstidxclosesym}[3][]{%
  \tstindexopenpost[#2]{\protect#3}{#1}{#3}%
}
\newcommand{\tstidxindexmarker}[1]{%
 \tstidxsym{\tstidxindexmarkerprefix#1}{\csname#1\endcsname
   \protect\space (\protect\tstidxcsfmt{#1})}%
}
\newcommand*{\tstidxindexmarkerprefix}{<}
\if@tstidx@use@encaps
  \newcommand*{\tstidxmath}[3][tstidxencapii]{%
    \tstindexpre[#2]{$#3$}{#1}{#3}%
  }
\else
  \newcommand*{\tstidxmath}[3][]{%
    \tstindexpre[#2]{$#3$}{#1}{#3}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxmathsym}[3][tstidxencapii]{%
    \tstidxmath[#1]{\tstidxmathsymprefix#2}{#3}%
  }
\else
  \newcommand*{\tstidxmathsym}[3][]{%
    \tstidxmath[#1]{\tstidxmathsymprefix#2}{#3}%
  }
\fi
\newcommand*{\tstidxmathsymprefix}{>}
\newcommand*{\tstidxutfword}[3][]{%
  \tstidxutfpost{#2}{#3}{#1}%
}
\newcommand*{\tstidxopenutf}[4][]{%
  \tstidxutfopenpost{#2}{#3}{#1}%
}
\newcommand*{\tstidxcloseutf}[4][]{%
  \tstidxutfclosepost{#2}{#3}{#1}%
}
\newcommand*{\tstidxutfphrase}[3][]{%
  \tstidxutfpre{#2}{#3}{#1}%
}
\newcommand*{\tstidxopenutfphrase}[3][]{%
  \tstidxutfopenpre{#2}{#3}{#1}%
}
\newcommand*{\tstidxcloseutfphrase}[3][]{%
  \tstidxutfclosepre{#2}{#3}{#1}%
}
\newcommand*{\tstidxplace}[2][]{%
  \tstidxutfplace[#1]{#2}{#2}%
}
\newcommand*{\tstidxutfplace}[3][]{%
  \tstidxutfpost{#2}{#3}{#1}%
  \tstidxutfsubpost[\relax]{places}{places}{#2}{#3}{#1}%
}
\newcommand*{\tstidxartplace}[3][]{%
  \tstindexpost{#3, #2}{#1}{#2 #3}%
  \tstidxutfsubpost[\relax]{places}{places}{#3, #2}{#3, #2}{#1}%
}
\newcommand*{\tstidxbookfmt}[1]{\emph{#1}}
\if@tstidx@use@encaps
  \newcommand*{\tstidxbook}[2][tstidxencapii]{%
    \tstindexpost[#2]{\protect\tstidxbookfmt{#2}}{#1}{\tstidxbookfmt{#2}}%
    \tstsubindexpost{books}[#2]{\protect\tstidxbookfmt{#2}}{#1}{}%
  }
\else
  \newcommand*{\tstidxbook}[2][]{%
    \tstindexpost[#2]{\protect\tstidxbookfmt{#2}}{#1}{\tstidxbookfmt{#2}}%
    \tstsubindexpost{books}[#2]{\protect\tstidxbookfmt{#2}}{#1}{}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxopenbook}[2][tstidxencapii]{%
    \tstindexopenpost[#2]{\protect\tstidxbookfmt{#2}}{#1}{\tstidxbookfmt{#2}}%
    \tstsubindexopenpost{books}[#2]{\protect\tstidxbookfmt{#2}}{#1}{}%
  }
\else
  \newcommand*{\tstidxopenbook}[2][]{%
    \tstindexopenpost[#2]{\protect\tstidxbookfmt{#2}}{#1}{\tstidxbookfmt{#2}}%
    \tstsubindexopenpost{books}[#2]{\protect\tstidxbookfmt{#2}}{#1}{}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxclosebook}[2][tstidxencapii]{%
    \tstindexclosepost[#2]{\protect\tstidxbookfmt{#2}}{#1}{\tstidxbookfmt{#2}}%
    \tstsubindexclosepost{books}[#2]{\protect\tstidxbookfmt{#2}}{#1}{}%
  }
\else
  \newcommand*{\tstidxclosebook}[2][]{%
    \tstindexclosepost[#2]{\protect\tstidxbookfmt{#2}}{#1}{\tstidxbookfmt{#2}}%
    \tstsubindexclosepost{books}[#2]{\protect\tstidxbookfmt{#2}}{#1}{}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxartbook}[3][tstidxencapii]{%
    \tstindexpost[#3, #2]{\protect\tstidxbookfmt{#3, #2}}{#1}{\tstidxbookfmt{#2 #3}}%
    \tstsubindexpost{books}[#3, #2]{\protect\tstidxbookfmt{#3, #2}}{#1}{}%
  }
\else
  \newcommand*{\tstidxartbook}[3][]{%
    \tstindexpost[#3, #2]{\protect\tstidxbookfmt{#3, #2}}{#1}{\tstidxbookfmt{#2 #3}}%
    \tstsubindexpost{books}[#3, #2]{\protect\tstidxbookfmt{#3, #2}}{#1}{}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxopenartbook}[3][tstidxencapii]{%
    \tstindexopenpost[#3, #2]{\protect\tstidxbookfmt{#3, #2}}{#1}%
      {\tstidxbookfmt{#2 #3}}%
    \tstsubindexopenpost{books}[#3, #2]{\protect\tstidxbookfmt{#3, #2}}{#1}{}%
  }
\else
  \newcommand*{\tstidxopenartbook}[3][]{%
    \tstindexopenpost[#3, #2]{\protect\tstidxbookfmt{#3, #2}}{#1}%
      {\tstidxbookfmt{#2 #3}}%
    \tstsubindexopenpost{books}[#3, #2]{\protect\tstidxbookfmt{#3, #2}}{#1}{}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxcloseartbook}[3][tstidxencapii]{%
    \tstindexclosepost[#3, #2]{\protect\tstidxbookfmt{#3, #2}}{#1}%
      {\tstidxbookfmt{#2 #3}}%
    \tstsubindexclosepost{books}[#3, #2]{\protect\tstidxbookfmt{#3, #2}}{#1}{}%
  }
\else
  \newcommand*{\tstidxcloseartbook}[3][]{%
    \tstindexclosepost[#3, #2]{\protect\tstidxbookfmt{#3, #2}}{#1}%
      {\tstidxbookfmt{#2 #3}}%
    \tstsubindexclosepost{books}[#3, #2]{\protect\tstidxbookfmt{#3, #2}}{#1}{}%
  }
\fi
\newcommand*{\tstidxfilmfmt}[1]{\emph{#1}}
\if@tstidx@use@encaps
  \newcommand*{\tstidxfilm}[2][tstidxencapii]{%
    \tstindexpost[#2]{\protect\tstidxfilmfmt{#2}}{#1}{\tstidxfilmfmt{#2}}%
    \tstsubindexpost{films}[#2]{\protect\tstidxfilmfmt{#2}}{#1}{}%
  }
\else
  \newcommand*{\tstidxfilm}[2][]{%
    \tstindexpost[#2]{\protect\tstidxfilmfmt{#2}}{#1}{\tstidxfilmfmt{#2}}%
    \tstsubindexpost{films}[#2]{\protect\tstidxfilmfmt{#2}}{#1}{}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxopenfilm}[2][tstidxencapii]{%
    \tstindexopenpost[#2]{\protect\tstidxfilmfmt{#2}}{#1}{\tstidxfilmfmt{#2}}%
    \tstsubindexopenpost{films}[#2]{\protect\tstidxfilmfmt{#2}}{#1}{}%
  }
\else
  \newcommand*{\tstidxopenfilm}[2][]{%
    \tstindexopenpost[#2]{\protect\tstidxfilmfmt{#2}}{#1}{\tstidxfilmfmt{#2}}%
    \tstsubindexopenpost{films}[#2]{\protect\tstidxfilmfmt{#2}}{#1}{}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxclosefilm}[2][tstidxencapii]{%
    \tstindexclosepost[#2]{\protect\tstidxfilmfmt{#2}}{#1}{\tstidxfilmfmt{#2}}%
    \tstsubindexclosepost{films}[#2]{\protect\tstidxfilmfmt{#2}}{#1}{}%
  }
\else
  \newcommand*{\tstidxclosefilm}[2][]{%
    \tstindexclosepost[#2]{\protect\tstidxfilmfmt{#2}}{#1}{\tstidxfilmfmt{#2}}%
    \tstsubindexclosepost{films}[#2]{\protect\tstidxfilmfmt{#2}}{#1}{}%
  }
\fi
\if@tstidx@use@encaps
  \newcommand*{\tstidxartfilm}[3][tstidxencapii]{%
    \tstindexpost[#3, #2]{\protect\tstidxfilmfmt{#3, #2}}{#1}%
      {\tstidxfilmfmt{#2 #3}}%
    \tstsubindexpost{films}[#3, #2]{\protect\tstidxfilmfmt{#3, #2}}{#1}{}%
  }
\else
  \newcommand*{\tstidxartfilm}[3][]{%
    \tstindexpost[#3, #2]{\protect\tstidxfilmfmt{#3, #2}}{#1}%
      {\tstidxfilmfmt{#2 #3}}%
    \tstsubindexpost{films}[#3, #2]{\protect\tstidxfilmfmt{#3, #2}}{#1}{}%
  }
\fi
\newcommand*{\tstindexpost}[4][]{%
  \def\@tstidx@sort{#1}%
  \def\@tstidx@encap{#3}%
  \ifx\@tstidx@sort\@empty
   \def\@tstidx@entry{#2}%
  \else
   \toks@{#1}%
   \edef\@tstidx@entry{\the\toks@\tstidxactual}%
   \expandafter\def\expandafter\@tstidx@entry\expandafter{\@tstidx@entry#2}%
  \fi
  \ifx\@tstidx@encap\@empty
   \iftestidxshowmarks
     \tstidxtext{#4\tstidxmarker}%
   \else
     #4%
   \fi
  \else
   \iftestidxshowmarks
     \tstidxtext{\tstidxencaptext{#3}{#4\tstidxmarker}}%
   \else
     #4%
   \fi
   \expandafter\toks@\expandafter{\@tstidx@entry}%
   \edef\@tstidx@entry{\the\toks@\tstidxencap#3}%
  \fi
  \expandafter\@tstindex\expandafter{\@tstidx@entry}%
}
\newcommand*{\tstindexopenpost}[4][]{%
  \def\@tstidx@sort{#1}%
  \def\@tstidx@encap{#3}%
  \ifx\@tstidx@sort\@empty
   \def\@tstidx@entry{#2}%
  \else
   \toks@{#1}%
   \edef\@tstidx@entry{\the\toks@\tstidxactual}%
   \expandafter\def\expandafter\@tstidx@entry\expandafter{\@tstidx@entry#2}%
  \fi
  \ifx\@tstidx@encap\@empty
   \iftestidxshowmarks
     \tstidxtext{#4\tstidxopenmarker}%
   \else
     #4%
   \fi
   \expandafter\toks@\expandafter{\@tstidx@entry}%
   \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxopenrange}%
  \else
   \iftestidxshowmarks
     \tstidxtext{\tstidxencaptext{#3}{#4\tstidxopenmarker}}%
   \else
     #4%
   \fi
   \expandafter\toks@\expandafter{\@tstidx@entry}%
   \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxopenrange#3}%
  \fi
  \expandafter\@tstindex\expandafter{\@tstidx@entry}%
}
\newcommand*{\tstindexclosepost}[4][]{%
  \def\@tstidx@sort{#1}%
  \def\@tstidx@encap{#3}%
  \ifx\@tstidx@sort\@empty
   \def\@tstidx@entry{#2}%
  \else
   \toks@{#1}%
   \edef\@tstidx@entry{\the\toks@\tstidxactual}%
   \expandafter\def\expandafter\@tstidx@entry\expandafter{\@tstidx@entry#2}%
  \fi
  \ifx\@tstidx@encap\@empty
   \iftestidxshowmarks
     \tstidxtext{#4\tstidxclosemarker}%
   \else
     #4%
   \fi
   \expandafter\toks@\expandafter{\@tstidx@entry}%
   \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxcloserange}%
  \else
   \iftestidxshowmarks
     \tstidxtext{\tstidxencaptext{#3}{#4\tstidxclosemarker}}%
   \else
     #4%
   \fi
   \expandafter\toks@\expandafter{\@tstidx@entry}%
   \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxcloserange#3}%
  \fi
  \expandafter\@tstindex\expandafter{\@tstidx@entry}%
}
\newcommand*{\tstindexpre}[4][]{%
  \def\@tstidx@sort{#1}%
  \def\@tstidx@encap{#3}%
  \ifx\@tstidx@sort\@empty
   \def\@tstidx@entry{#2}%
  \else
   \toks@{#1}%
   \edef\@tstidx@entry{\the\toks@\tstidxactual}%
   \expandafter\def\expandafter\@tstidx@entry\expandafter{\@tstidx@entry#2}%
  \fi
  \ifx\@tstidx@encap\@empty
   \expandafter\@tstindex\expandafter{\@tstidx@entry}%
   \iftestidxshowmarks
     \tstidxtext{\tstidxmarker#4}%
   \else
     #4%
   \fi
  \else
   \expandafter\toks@\expandafter{\@tstidx@entry}%
   \edef\@tstidx@entry{\the\toks@\tstidxencap#3}%
   \expandafter\@tstindex\expandafter{\@tstidx@entry}%
   \iftestidxshowmarks
     \tstidxtext{\tstidxencaptext{#3}{\tstidxmarker#4}}%
   \else
     #4%
   \fi
  \fi
}
\newcommand*{\tstindexopenpre}[4][]{%
  \def\@tstidx@sort{#1}%
  \def\@tstidx@encap{#3}%
  \ifx\@tstidx@sort\@empty
   \def\@tstidx@entry{#2}%
  \else
   \toks@{#1}%
   \edef\@tstidx@entry{\the\toks@\tstidxactual}%
   \expandafter\def\expandafter\@tstidx@entry\expandafter{\@tstidx@entry#2}%
  \fi
  \ifx\@tstidx@encap\@empty
   \expandafter\toks@\expandafter{\@tstidx@entry}%
   \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxopenrange}%
   \expandafter\@tstindex\expandafter{\@tstidx@entry}%
   \iftestidxshowmarks
     \tstidxtext{\tstidxopenmarker#4}%
   \else
     #4%
   \fi
  \else
   \expandafter\toks@\expandafter{\@tstidx@entry}%
   \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxopenrange#3}%
   \expandafter\@tstindex\expandafter{\@tstidx@entry}%
   \iftestidxshowmarks
     \tstidxtext{\tstidxencaptext{#3}{\tstidxopenmarker#4}}%
   \else
     #4%
   \fi
  \fi
}
\newcommand*{\tstindexclosepre}[4][]{%
  \def\@tstidx@sort{#1}%
  \def\@tstidx@encap{#3}%
  \ifx\@tstidx@sort\@empty
   \def\@tstidx@entry{#2}%
  \else
   \toks@{#1}%
   \edef\@tstidx@entry{\the\toks@\tstidxactual}%
   \expandafter\def\expandafter\@tstidx@entry\expandafter{\@tstidx@entry#2}%
  \fi
  \ifx\@tstidx@encap\@empty
   \expandafter\toks@\expandafter{\@tstidx@entry}%
   \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxcloserange}%
   \expandafter\@tstindex\expandafter{\@tstidx@entry}%
   \iftestidxshowmarks
     \tstidxtext{\tstidxclosemarker#4}%
   \else
     #4%
   \fi
  \else
   \expandafter\toks@\expandafter{\@tstidx@entry}%
   \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxcloserange#3}%
   \expandafter\@tstindex\expandafter{\@tstidx@entry}%
   \iftestidxshowmarks
     \tstidxtext{\tstidxencaptext{#3}{\tstidxclosemarker#4}}%
   \else
     #4%
   \fi
  \fi
}
\newcommand*{\tstindexsee}[4][]{%
  \def\@tstidx@sort{#1}%
  \ifx\@tstidx@sort\@empty
   \def\@tstidx@entry{#2}%
  \else
   \toks@{#1}%
   \edef\@tstidx@entry{\the\toks@\tstidxactual}%
   \expandafter\def\expandafter\@tstidx@entry\expandafter{\@tstidx@entry#2}%
  \fi
  \expandafter\toks@\expandafter{\@tstidx@entry}%
  \edef\@tstidx@entry{\the\toks@\tstidxencap#3{#4}}%
  \expandafter\@tstindex\expandafter{\@tstidx@entry}%
  \iftestidxshowmarks
    \tstidxseeref{#2}{#3}{#4}%
  \fi
}
\newcommand*{\tstsubindexpost}[2][]{%
  \def\@tstidx@sort{#1}%
  \def\@tstidx@term{#2}%
  \@tst@subindexpost
}
\newcommand*{\@tst@subindexpost}[4][]{%
  \def\@tstidx@subsort{#1}%
  \def\@tstidx@subterm{#2}%
  \def\@tstidx@encap{#3}%
  \ifx\@tstidx@sort\@empty
    \let\@tstidx@entry\@tstidx@term
  \else
     \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@sort}\tstidxactual
      \unexpanded\expandafter{\@tstidx@term}}%
  \fi
  \ifx\@tstidx@subsort\@empty
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subterm}}%
  \else
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsort}\tstidxactual
        \unexpanded\expandafter{\@tstidx@subterm}}%
  \fi
  \ifx\@tstidx@encap\@empty
    \iftestidxshowmarks
      \tstidxtext{#4\tstidxsubmarker}%
    \else
      #4%
    \fi
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
  \else
    \iftestidxshowmarks
      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxsubmarker}}%
    \else
      #4%
    \fi
    \expandafter\toks@\expandafter{\@tstidx@entry}%
    \edef\@tstidx@entry{\the\toks@\tstidxencap#3}%
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
  \fi
}
\newcommand*{\tstsubindexopenpost}[2][]{%
  \def\@tstidx@sort{#1}%
  \def\@tstidx@term{#2}%
  \@tst@subindexopenpost
}
\newcommand*{\@tst@subindexopenpost}[4][]{%
  \def\@tstidx@subsort{#1}%
  \def\@tstidx@subterm{#2}%
  \def\@tstidx@encap{#3}%
  \ifx\@tstidx@sort\@empty
    \let\@tstidx@entry\@tstidx@term
  \else
     \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@sort}\tstidxactual
      \unexpanded\expandafter{\@tstidx@term}}%
  \fi
  \ifx\@tstidx@subsort\@empty
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subterm}}%
  \else
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsort}\tstidxactual
        \unexpanded\expandafter{\@tstidx@subterm}}%
  \fi
  \ifx\@tstidx@encap\@empty
    \iftestidxshowmarks
      \tstidxtext{#4\tstidxopensubmarker}%
    \else
      #4%
    \fi
    \expandafter\toks@\expandafter{\@tstidx@entry}%
    \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxopenrange}%
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
  \else
    \iftestidxshowmarks
      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxopensubmarker}}%
    \else
      #4%
    \fi
    \expandafter\toks@\expandafter{\@tstidx@entry}%
    \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxopenrange#3}%
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
  \fi
}
\newcommand*{\tstsubindexclosepost}[2][]{%
  \def\@tstidx@sort{#1}%
  \def\@tstidx@term{#2}%
  \@tst@subindexclosepost
}
\newcommand*{\@tst@subindexclosepost}[4][]{%
  \def\@tstidx@subsort{#1}%
  \def\@tstidx@subterm{#2}%
  \def\@tstidx@encap{#3}%
  \ifx\@tstidx@sort\@empty
    \let\@tstidx@entry\@tstidx@term
  \else
     \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@sort}\tstidxactual
      \unexpanded\expandafter{\@tstidx@term}}%
  \fi
  \ifx\@tstidx@subsort\@empty
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subterm}}%
  \else
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsort}\tstidxactual
        \unexpanded\expandafter{\@tstidx@subterm}}%
  \fi
  \ifx\@tstidx@encap\@empty
    \iftestidxshowmarks
      \tstidxtext{#4\tstidxclosesubmarker}%
    \else
      #4%
    \fi
    \expandafter\toks@\expandafter{\@tstidx@entry}%
    \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxcloserange}%
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
  \else
    \iftestidxshowmarks
      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxclosesubmarker}}%
    \else
      #4%
    \fi
    \expandafter\toks@\expandafter{\@tstidx@entry}%
    \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxcloserange#3}%
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
  \fi
}
\newcommand*{\tstsubindexpre}[2][]{%
  \def\@tstidx@sort{#1}%
  \def\@tstidx@term{#2}%
  \@tst@subindexpre
}
\newcommand*{\@tst@subindexpre}[4][]{%
  \def\@tstidx@subsort{#1}%
  \def\@tstidx@subterm{#2}%
  \def\@tstidx@encap{#3}%
  \ifx\@tstidx@sort\@empty
    \let\@tstidx@entry\@tstidx@term
  \else
     \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@sort}\tstidxactual
      \unexpanded\expandafter{\@tstidx@term}}%
  \fi
  \ifx\@tstidx@subsort\@empty
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subterm}}%
  \else
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsort}\tstidxactual
        \unexpanded\expandafter{\@tstidx@subterm}}%
  \fi
  \ifx\@tstidx@encap\@empty
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
    \iftestidxshowmarks
      \tstidxtext{#4\tstidxsubmarker}%
    \else
      #4%
    \fi
  \else
    \expandafter\toks@\expandafter{\@tstidx@entry}%
    \edef\@tstidx@entry{\the\toks@\tstidxencap#3}%
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
    \iftestidxshowmarks
      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxsubmarker}}%
    \else
      #4%
    \fi
  \fi
}
\newcommand*{\tstsubindexopenpre}[2][]{%
  \def\@tstidx@sort{#1}%
  \def\@tstidx@term{#2}%
  \@tst@subindexopenpre
}
\newcommand*{\@tst@subindexopenpre}[4][]{%
  \def\@tstidx@subsort{#1}%
  \def\@tstidx@subterm{#2}%
  \def\@tstidx@encap{#3}%
  \ifx\@tstidx@sort\@empty
    \let\@tstidx@entry\@tstidx@term
  \else
     \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@sort}\tstidxactual
      \unexpanded\expandafter{\@tstidx@term}}%
  \fi
  \ifx\@tstidx@subsort\@empty
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subterm}}%
  \else
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsort}\tstidxactual
        \unexpanded\expandafter{\@tstidx@subterm}}%
  \fi
  \ifx\@tstidx@encap\@empty
    \expandafter\toks@\expandafter{\@tstidx@entry}%
    \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxopenrange}%
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
    \iftestidxshowmarks
      \tstidxtext{#4\tstidxopensubmarker}%
    \else
      #4%
    \fi
  \else
    \expandafter\toks@\expandafter{\@tstidx@entry}%
    \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxopenrange#3}%
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
    \iftestidxshowmarks
      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxopensubmarker}}%
    \else
      #4%
    \fi
  \fi
}
\newcommand*{\tstsubindexclosepre}[2][]{%
  \def\@tstidx@sort{#1}%
  \def\@tstidx@term{#2}%
  \@tst@subindexclosepre
}
\newcommand*{\@tst@subindexclosepre}[4][]{%
  \def\@tstidx@subsort{#1}%
  \def\@tstidx@subterm{#2}%
  \def\@tstidx@encap{#3}%
  \ifx\@tstidx@sort\@empty
    \let\@tstidx@entry\@tstidx@term
  \else
     \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@sort}\tstidxactual
      \unexpanded\expandafter{\@tstidx@term}}%
  \fi
  \ifx\@tstidx@subsort\@empty
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subterm}}%
  \else
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsort}\tstidxactual
        \unexpanded\expandafter{\@tstidx@subterm}}%
  \fi
  \ifx\@tstidx@encap\@empty
    \expandafter\toks@\expandafter{\@tstidx@entry}%
    \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxcloserange}%
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
    \iftestidxshowmarks
      \tstidxtext{#4\tstidxclosesubmarker}%
    \else
      #4%
    \fi
  \else
    \expandafter\toks@\expandafter{\@tstidx@entry}%
    \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxcloserange#3}%
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
    \iftestidxshowmarks
      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxclosesubmarker}}%
    \else
      #4%
    \fi
  \fi
}
\newcommand*{\tstindexsubsee}[2][]{%
  \def\@tstidx@sort{#1}%
  \def\@tstidx@term{#2}%
  \ifx\@tstidx@sort\@empty
   \def\@tstidx@entry{#2}%
  \else
   \toks@{#1}%
   \edef\@tstidx@entry{\the\toks@\tstidxactual}%
   \expandafter\def\expandafter\@tstidx@entry\expandafter{\@tstidx@entry#2}%
  \fi
  \@tstindexsubsee
}
\newcommand*{\@tstindexsubsee}[4][]{%
  \def\@tstidx@subsort{#1}%
  \ifx\@tstidx@subsort\@empty
   \toks@{#2}%
   \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}%
     \tstidxlevel\the\toks@}%
  \else
   \toks@{#1}%
   \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}%
     \tstidxlevel\the\toks@\tstidxactual}%
   \expandafter\def\expandafter\@tstidx@entry\expandafter{\@tstidx@entry#2}%
  \fi
  \expandafter\toks@\expandafter{\@tstidx@entry}%
  \edef\@tstidx@entry{\the\toks@\tstidxencap#3{#4}}%
  \expandafter\@tstindex\expandafter{\@tstidx@entry}%
  \iftestidxshowmarks
    \tstidxsubseeref{\@tstidx@term}{#2}{#3}{#4}%
  \fi
}
\newcommand*{\tstsubsubindexpost}[2][]{%
  \def\@tstidx@sort{#1}%
  \def\@tstidx@term{#2}%
  \@tst@subsubindexpost
}
\newcommand*{\@tst@subsubindexpost}[2][]{%
  \def\@tstidx@subsort{#1}%
  \def\@tstidx@subterm{#2}%
  \@@tst@subsubindexpost
}
\newcommand*{\@@tst@subsubindexpost}[4][]{%
  \def\@tstidx@subsubsort{#1}%
  \def\@tstidx@subsubterm{#2}%
  \def\@tstidx@encap{#3}%
  \ifx\@tstidx@sort\@empty
    \let\@tstidx@entry\@tstidx@term
  \else
     \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@sort}\tstidxactual
      \unexpanded\expandafter{\@tstidx@term}}%
  \fi
  \ifx\@tstidx@subsort\@empty
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subterm}}%
  \else
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsort}\tstidxactual
        \unexpanded\expandafter{\@tstidx@subterm}}%
  \fi
  \ifx\@tstidx@subsubsort\@empty
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsubterm}}%
  \else
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsubsort}\tstidxactual
        \unexpanded\expandafter{\@tstidx@subsubterm}}%
  \fi
  \ifx\@tstidx@encap\@empty
    \iftestidxshowmarks
      \tstidxtext{#4\tstidxsubsubmarker}%
    \else
      #4%
    \fi
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
  \else
    \iftestidxshowmarks
      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxsubsubmarker}}%
    \else
      #4%
    \fi
    \expandafter\toks@\expandafter{\@tstidx@entry}%
    \edef\@tstidx@entry{\the\toks@\tstidxencap#3}%
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
  \fi
}
\newcommand*{\tstsubsubindexopenpost}[2][]{%
  \def\@tstidx@sort{#1}%
  \def\@tstidx@term{#2}%
  \@tst@subsubindexopenpost
}
\newcommand*{\@tst@subsubindexopenpost}[2][]{%
  \def\@tstidx@subsort{#1}%
  \def\@tstidx@subterm{#2}%
  \@@tst@subsubindexopenpost
}
\newcommand*{\@@tst@subsubindexopenpost}[4][]{%
  \def\@tstidx@subsubsort{#1}%
  \def\@tstidx@subsubterm{#2}%
  \def\@tstidx@encap{#3}%
  \ifx\@tstidx@sort\@empty
    \let\@tstidx@entry\@tstidx@term
  \else
     \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@sort}\tstidxactual
      \unexpanded\expandafter{\@tstidx@term}}%
  \fi
  \ifx\@tstidx@subsort\@empty
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subterm}}%
  \else
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsort}\tstidxactual
        \unexpanded\expandafter{\@tstidx@subterm}}%
  \fi
  \ifx\@tstidx@subsubsort\@empty
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsubterm}}%
  \else
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsubsort}\tstidxactual
        \unexpanded\expandafter{\@tstidx@subsubterm}}%
  \fi
  \ifx\@tstidx@encap\@empty
    \iftestidxshowmarks
      \tstidxtext{#4\tstidxopensubmarker}%
    \else
      #4%
    \fi
    \expandafter\toks@\expandafter{\@tstidx@entry}%
    \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxopenrange}%
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
  \else
    \iftestidxshowmarks
      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxopensubmarker}}%
    \else
      #4%
    \fi
    \expandafter\toks@\expandafter{\@tstidx@entry}%
    \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxopenrange#3}%
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
  \fi
}
\newcommand*{\tstsubsubindexclosepost}[2][]{%
  \def\@tstidx@sort{#1}%
  \def\@tstidx@term{#2}%
  \@tst@subsubindexclosepost
}
\newcommand*{\@tst@subsubindexclosepost}[2][]{%
  \def\@tstidx@subsort{#1}%
  \def\@tstidx@subterm{#2}%
  \@@tst@subsubindexclosepost
}
\newcommand*{\@@tst@subsubindexclosepost}[4][]{%
  \def\@tstidx@subsubsort{#1}%
  \def\@tstidx@subsubterm{#2}%
  \def\@tstidx@encap{#3}%
  \ifx\@tstidx@sort\@empty
    \let\@tstidx@entry\@tstidx@term
  \else
     \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@sort}\tstidxactual
      \unexpanded\expandafter{\@tstidx@term}}%
  \fi
  \ifx\@tstidx@subsort\@empty
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subterm}}%
  \else
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsort}\tstidxactual
        \unexpanded\expandafter{\@tstidx@subterm}}%
  \fi
  \ifx\@tstidx@subsubsort\@empty
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsubterm}}%
  \else
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsubsort}\tstidxactual
        \unexpanded\expandafter{\@tstidx@subsubterm}}%
  \fi
  \ifx\@tstidx@encap\@empty
    \iftestidxshowmarks
      \tstidxtext{#4\tstidxclosesubmarker}%
    \else
      #4%
    \fi
    \expandafter\toks@\expandafter{\@tstidx@entry}%
    \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxcloserange}%
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
  \else
    \iftestidxshowmarks
      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxclosesubmarker}}%
    \else
      #4%
    \fi
    \expandafter\toks@\expandafter{\@tstidx@entry}%
    \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxcloserange#3}%
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
  \fi
}
\newcommand*{\tstsubsubindexpre}[2][]{%
  \def\@tstidx@sort{#1}%
  \def\@tstidx@term{#2}%
  \@tst@subsubindexpre
}
\newcommand*{\@tst@subsubindexpre}[2][]{%
  \def\@tstidx@subsort{#1}%
  \def\@tstidx@subterm{#2}%
  \@@tst@subsubindexpre
}
\newcommand*{\@@tst@subsubindexpre}[4][]{%
  \def\@tstidx@subsubsort{#1}%
  \def\@tstidx@subsubterm{#2}%
  \def\@tstidx@encap{#3}%
  \ifx\@tstidx@sort\@empty
    \let\@tstidx@entry\@tstidx@term
  \else
     \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@sort}\tstidxactual
      \unexpanded\expandafter{\@tstidx@term}}%
  \fi
  \ifx\@tstidx@subsort\@empty
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subterm}}%
  \else
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsort}\tstidxactual
        \unexpanded\expandafter{\@tstidx@subterm}}%
  \fi
  \ifx\@tstidx@subsubsort\@empty
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsubterm}}%
  \else
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsubsort}\tstidxactual
        \unexpanded\expandafter{\@tstidx@subsubterm}}%
  \fi
  \ifx\@tstidx@encap\@empty
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
    \iftestidxshowmarks
      \tstidxtext{#4\tstidxsubsubmarker}%
    \else
      #4%
    \fi
  \else
    \expandafter\toks@\expandafter{\@tstidx@entry}%
    \edef\@tstidx@entry{\the\toks@\tstidxencap#3}%
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
    \iftestidxshowmarks
      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxsubsubmarker}}%
    \else
      #4%
    \fi
  \fi
}
\newcommand*{\tstsubsubindexopenpre}[2][]{%
  \def\@tstidx@sort{#1}%
  \def\@tstidx@term{#2}%
  \@tst@subsubindexopenpre
}
\newcommand*{\@tst@subsubindexopenpre}[2][]{%
  \def\@tstidx@subsort{#1}%
  \def\@tstidx@subterm{#2}%
  \@@tst@subsubindexopenpre
}
\newcommand*{\@@tst@subsubindexopenpre}[4][]{%
  \def\@tstidx@subsubsort{#1}%
  \def\@tstidx@subsubterm{#2}%
  \def\@tstidx@encap{#3}%
  \ifx\@tstidx@sort\@empty
    \let\@tstidx@entry\@tstidx@term
  \else
     \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@sort}\tstidxactual
      \unexpanded\expandafter{\@tstidx@term}}%
  \fi
  \ifx\@tstidx@subsort\@empty
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subterm}}%
  \else
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsort}\tstidxactual
        \unexpanded\expandafter{\@tstidx@subterm}}%
  \fi
  \ifx\@tstidx@subsubsort\@empty
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsubterm}}%
  \else
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsubsort}\tstidxactual
        \unexpanded\expandafter{\@tstidx@subsubterm}}%
  \fi
  \ifx\@tstidx@encap\@empty
    \expandafter\toks@\expandafter{\@tstidx@entry}%
    \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxopenrange}%
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
    \iftestidxshowmarks
      \tstidxtext{#4\tstidxopensubmarker}%
    \else
      #4%
    \fi
  \else
    \expandafter\toks@\expandafter{\@tstidx@entry}%
    \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxopenrange#3}%
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
    \iftestidxshowmarks
      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxopensubmarker}}%
    \else
      #4%
    \fi
  \fi
}
\newcommand*{\tstsubsubindexclosepre}[2][]{%
  \def\@tstidx@sort{#1}%
  \def\@tstidx@term{#2}%
  \@tst@subsubindexclosepre
}
\newcommand*{\@tst@subsubindexclosepre}[2][]{%
  \def\@tstidx@subsort{#1}%
  \def\@tstidx@subterm{#2}%
  \@@tst@subsubindexclosepre
}
\newcommand*{\@@tst@subsubindexclosepre}[4][]{%
  \def\@tstidx@subsubsort{#1}%
  \def\@tstidx@subsubterm{#2}%
  \def\@tstidx@encap{#3}%
  \ifx\@tstidx@sort\@empty
    \let\@tstidx@entry\@tstidx@term
  \else
     \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@sort}\tstidxactual
      \unexpanded\expandafter{\@tstidx@term}}%
  \fi
  \ifx\@tstidx@subsort\@empty
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subterm}}%
  \else
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsort}\tstidxactual
        \unexpanded\expandafter{\@tstidx@subterm}}%
  \fi
  \ifx\@tstidx@subsubsort\@empty
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsubterm}}%
  \else
    \edef\@tstidx@entry{\unexpanded\expandafter{\@tstidx@entry}\tstidxlevel
      \unexpanded\expandafter{\@tstidx@subsubsort}\tstidxactual
        \unexpanded\expandafter{\@tstidx@subsubterm}}%
  \fi
  \ifx\@tstidx@encap\@empty
    \expandafter\toks@\expandafter{\@tstidx@entry}%
    \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxcloserange}%
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
    \iftestidxshowmarks
      \tstidxtext{#4\tstidxclosesubmarker}%
    \else
      #4%
    \fi
  \else
    \expandafter\toks@\expandafter{\@tstidx@entry}%
    \edef\@tstidx@entry{\the\toks@\tstidxencap\tstidxcloserange#3}%
    \expandafter\@tstindex\expandafter{\@tstidx@entry}%
    \iftestidxshowmarks
      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxclosesubmarker}}%
    \else
      #4%
    \fi
  \fi
}
\newcommand*{\testidx}{%
  \@ifstar
  {%
    \def\@testidx@block@sep{\space}%
    \@testidx
  }%
  {%
    \def\@testidx@block@sep{\tstidxdefblocksep}%
    \@testidx
  }%
}
\newcommand*{\@testidx}[1][1-\tstidxmaxblocks]{%
  \@for\@tidx@block@range:=#1\do{%
    \ifx\@tidx@block@range\@empty
    \else
     \expandafter\@test@idx\@tidx@block@range-\@nil-\@nil\@end@test@idx
    \fi
  }%
}
\newcommand{\tstidxdefblocksep}{\par}
\newcommand*{\tstidxprefixblock}[1]{{\scriptsize\number#1.}\ }
\newcount\@tidx@parctr
\def\@test@idx#1-#2-#3\@end@test@idx{%
  \def\@tst@idx@arg{#1}%
  \ifx\@tst@idx@arg\@nnil
   \PackageError{testidx}{Invalid range `\@tidx@block@range'}{}%
  \else
    \def\@tst@idx@arg{#2}%
    \ifx\@tst@idx@arg\@empty
      \PackageError{testidx}{Invalid range `\@tidx@block@range'}{}%
    \else
      \ifx\@tst@idx@arg\@nnil
        \@@test@idx{#1}%
      \else
        \ifnum#2<#1\relax
          \@tidx@parctr=\numexpr#1+1\relax
          \loop
            \advance\@tidx@parctr by -\@ne
            \@@test@idx\@tidx@parctr
          \ifnum\@tidx@parctr>#2
          \repeat
        \else
          \@tidx@parctr=\numexpr#1-1\relax
          \loop
            \advance\@tidx@parctr by \@ne
            \@@test@idx\@tidx@parctr
          \ifnum\@tidx@parctr<#2
          \repeat
        \fi
      \fi
    \fi
  \fi
}
\newcommand*{\@@test@idx}[1]{%
 \@ifundefined{@tidx@par@\romannumeral#1}%
 {%
   \PackageError{testidx}{No such test block `\number#1'}%
   {Blocks are numbered from 1 to \number\tstidxmaxblocks}%
 }%
 {%
    \tstidxprefixblock{#1}%
    \csname @tidx@par@\romannumeral#1\endcsname
    \@testidx@block@sep
 }%
}
\newcount\tstidxmaxblocks
\newcommand*{\tstidxnewblock}{
  \@ifstar\s@tstidxnewblock\@tstidxnewblock
}
\newcommand{\s@tstidxnewblock}[2]{%
  \@tstidxnewblock{#2}%
  \edef#1{\number\tstidxmaxblocks}%
}
\newcommand{\@tstidxnewblock}[1]{%
  \advance\tstidxmaxblocks by \@ne
  \expandafter
    \newcommand\csname @tidx@par@\romannumeral\tstidxmaxblocks\endcsname{#1}%
}
\tstidxnewblock
{%
 This is a~sample block of text designed to test
 \tstidxcs{index}, 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
 (\tstidxenv{theindex} environment) and any
 \if@tstidx@use@encaps
   \tstidxphrase[tstidxencapii]{indexing application},
 \else
   \tstidxphrase{indexing application},
 \fi
 such as
 \tstidxapp{makeindex} or
 \tstidxapp{xindy}. This 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 use it, for \tstidxword{example}, to test an indexing
 package, such as \tstidxsty{makeidx} or \tstidxsty{imakeidx}, or to
 test a \tstidxapp{makeindex} style file or \tstidxapp{xindy} module.
 You can find out more
 information from the \tstidxsty{testidx} user manual, which
 can be accessed using the \tstidxapp{texdoc} application.
 This block starts a range that is closed in block~\@tidx@close@testidxsty.%
}
\tstidxnewblock
{%
 The \tstidxsty{testidx} package doesn't make any
 modifications to \tstidxcs{index} or \tstidxenv{theindex}. All
 \tstidxphrase{visual effects} in this \tstidxphrase{dummy text} are produced
 using markup commands provided solely for this \tstidxword{purpose} that
 internally use \tstidxcs{index} or, more specifically, internally use
 \tstidxcs{tstindex}, which is defined to use \tstidxcs{index} (so you can
 redefine \tstidxcs{tstindex} if you have multiple indexes). This package
 doesn't attempt to \tstidxword{parse} or otherwise \tstidxword{interpret} the
 \tstidxword{argument} of \tstidxcs{index}, nor does it attempt to
 produce a well-designed index. Its 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.
 You can hide the visual effects with the
 \tstidxstyopt{testidx}{hidemarks} package option.
 \iftestidxshowmarks
 \else
  (It seems you already have this option set.
  Remove it or use \tstidxstyopt{testidx}{showmarks} to show them
  again.)%
 \fi
}
\tstidxnewblock
{%
 The actual place where the \tstidxcs{index} command 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 \tstidxcs{index} command may
 occur before or after the \tstidxword{word} or \tstidxword{phrase} 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. Always
 remember not to surround your \tstidxcs{index} usage with spaces. Keep it
 flush against the term being indexed and only have a space on one
 side. 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.) A cross-referenced
 entry (using \tstidxencapcsn{see} or \tstidxencapcsn{seealso}) 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}. 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.%
}
\tstidxnewblock*{\@tidx@openrangepar}
{%
 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}.
 \iftestidxverbose
   I see you've used the \tstidxstyopt{testidx}{verbose} package option which
   shows the \tstidxword{argument} being passed to \tstidxcs{tstindex}.
   I expect it's caused some \tstidxphrase{overfull lines}.%
 \else
   If you want more detail, you can use the \tstidxstyopt{testidx}{verbose}
   package option which will show the \tstidxword{argument} being passed to
   \tstidxcs{tstindex} but be warned that it will
   cause \tstidxphrase{overfull lines}.%
 \fi
}
\tstidxnewblock
{%
 Now that the preliminaries have been dispensed with in the previous
 \tstidxword{paragraph}s, we can get on
 to some serious
 \if@tstidx@use@encaps
   \tstidxword[tstidxencapii]{waffle}
 \else
   \tstidxword{waffle}
 \fi
 to act as
 \if@tstidx@use@encaps
   \tstidxword[tstidxencapi]{filler}
 \else
   \tstidxword{filler}
 \fi
 text because this really needs
 some \tstidxword{padding} in order to get a decent sized
 \tstidxword{index} with lots of locations. I did consider using just
 plain old \tstidxphrase{lorem ipsum} (like the \tstidxsty{lipsum}
 package), but it gets a bit boring after a while, and it's easier to
 check the indexing has been performed successfully if you can understand
 the text. Of course, this doesn't help those who don't know any English, but at
 least they're no worse off than they would have been with random
 \tstidxword{gibberish}\tstindexsee{gobbledegook}{see}{gibberish},
 at least, I hope not.  In other words, if I could just \tstidxword{clarify}
 what I'm trying to say here, in a \tstidxword{confidential} and not too
 \tstidxword{roundabout} \tstidxword{fashion}\tstidxdash
 \tstidxphrase{between you, me and the gatepost}\tstidxdash is please don't
 consider this to be an
 \tstidxword{illustration}\tstindexsee{illustration}{seealso}{example} of
 my stunning \tstidxword{wit}, \tstidxword{eloquence} and
 \tstidxphrase{way with words} because I'm shamelessly contravening the
 \tstidxphrase{creative writing}
 \tstidxword{adage} (or possibly \tstidxword{motto}) of
 \tstidxphrase{cut to the chase}, remove excessive
 \tstidxword{verbiage} and \tstidxphrase{get to the point}. I shall
 take care to hide this \tstidxword{drivel} from my
 \if@tstidx@use@encaps
   \tstidxphrase[tstidxencapiii]{creative writing}
 \else
   \tstidxphrase{creative writing}
 \fi
 \tstidxword{tutor} and
 fellow writers, so
 \tstidxphrase{keep mum}\tstindexsee{keep mum}{seealso}{confidential}
 and don't \tstidxword{grass} on me because that just won't be fair,
 and it might \tstidxword{distress} them to a certain extent.
 Where was I? Oh, yes, \tstidxword{padding}. I'm trying to make this
 \tstidxword{paragraph} quite long, not because I have any pretensions of being
 the next \tstidxperson{James}{Joyce} and competing with
 \tstidxbook{Ulysses}, but because one of the things
 we need to check for is what happens with paragraphs that span a
 \tstidxphrase{page break}. (If you're feeling particularly daring,
 try out the starred version of \tstidxcs{testidx}, although
 some of the blocks, such as \tstidxword{block}~\@tidx@xdypar, have some
 sneaky \tstidxword{paragraph} breaks that won't
 be suppressed.) \tstidxsym{TeX}{\TeX}'s asynchronous
 \if@tstidx@use@encaps
   \tstidxphrase[tstidxencapii]{output routine}
 \else
   \tstidxphrase{output routine}
 \fi
 can cause things to go a bit
 \if@tstidx@use@encaps
   \tstidxphrase[tstidxencapiii]{out of whack},
 \else
   \tstidxphrase{out of whack},
 \fi
 so lengthy paragraphs in this
 \if@tstidx@use@encaps
   \tstidxword[tstidxencapii]{example}
 \else
   \tstidxword{example}
 \fi
 document increase the chances of testing for these occurrences.
 Whether or not this particular \tstidxword{paragraph}
 actually spans a \tstidxphrase{page break} does, of course, depend on
 various things including your document \tstidxsubword{document}{properties},
 such as the \tstidxphrase{page dimensions}, \tstidxphrase{font family} and
 \tstidxphrase{font size}. If it turns out that this
 \if@tstidx@use@encaps
   \tstidxword[tstidxencapi]{paragraph}
 \else
   \tstidxword{paragraph}
 \fi
 has spanned a \tstidxphrase{page break}, you might want to check the terms
 indexed here to make sure they have the correct page numbers listed.
 Something else that you might want to check, while you're at it, is
 what's happened to the \tstidxword{location list} for the word
 \if@tstidx@use@encaps
   \tstidxqt{\tstidxword[tstidxencapii]{paragraph}},
 \else
   \tstidxqt{\tstidxword{paragraph}},
 \fi
 as I've used different
 \tstidxword{encap} values for it in various places in this
 \tstidxword{example}
 \if@tstidx@use@encaps
   \tstidxword[tstidxencapiii]{paragraph}.
 \else
   \tstidxword{paragraph}.
 \fi
 If you are using
 \tstidxapp{makeindex}, you might notice some warnings about
 \tstidxphrase{multiple encaps}, and the \tstidxphrase{page number}
 may be duplicated in the location list. If you are using
 \tstidxapp{xindy}, then it will discard duplicate page numbers and
 give preference to the first defined attribute in whatever
 \tstidxapp{xindy} module you're using. However, be careful if a
 \if@tstidx@use@encaps
   \tstidxword[tstidxencapi]{range}
 \else
   \tstidxword{range}
 \fi
 overlaps a different \tstidxword{encap}.
 Remember that there's a difference between an \tstidxword{index} and a
 \tstidxword{concordance}. If you just index pertinent places, there's less
 likelihood of conflicting encaps. This is the end of a
 \if@tstidx@use@encaps
   \tstidxword[tstidxencapiii]{paragraph}
 \else
   \tstidxword{paragraph}
 \fi
 that was written to deliberately upset \tstidxapp{makeindex}.
 Mean, aren't I?%
}
\tstidxnewblock*{\@tidx@xdypar}
{%
 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. For example, you may want to create a file
 called, say, \texttt{\jobname.xdy} that contains the following:
 \begin{flushleft}\ttfamily\obeylines
; list of allowed attributes
\par\medskip\par
(define-attributes ((
  \string"tstidxencapi\string"
  \string"tstidxencapii\string"
  \string"tstidxencapiii\string"
)))
\par\medskip\par
; define format to use for locations
\par\medskip\par
(markup-locref :open \string"\string\tstidxencapi\expandafter\@gobble\string\{\string"
 :close \string"\expandafter\@gobble\string\}\string"
 :attr \string"tstidxencapi\string")

(markup-locref :open \string"\string\tstidxencapii\expandafter\@gobble\string\{\string"
 :close \string"\expandafter\@gobble\string\}\string"
 :attr \string"tstidxencapii\string")

(markup-locref :open
\string"\string\tstidxencapiii\expandafter\@gobble\string\{\string"
 :close \string"\expandafter\@gobble\string\}\string"
 :attr \string"tstidxencapiii\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. You can then
 run \tstidxapp{xindy} using:
 \begin{flushleft}\ttfamily
xindy -L english -C utf8 -M \jobname.xdy -M texindy -t \jobname.ilg
\jobname.idx
 \end{flushleft}
 You might also want to set the location list
 \tstidxsubword{location list}{page separator}
 and the \tstidxsubword{location list}{range separator}%
 \tstindexsee{range separator}{see}{location list}
 in your \texttt{.xdy} file.  For example:
 \begin{flushleft}\ttfamily
(markup-locref-list :sep \string",\string")\par
(markup-range :sep \string"\string-\string-\string")
 \end{flushleft}
 Check out the difference between using \tstidxapp{xindy} and
 \tstidxapp{makeindex} on this document.%
}
\tstidxnewblock
{%
 We, the \tstidxutfword{\'elite}{élite} who discovered the
 \tstidxutfword{\ae sthetic}{æsthetic}
 delights of \tstidxsym{TeX}{\TeX}, must not become
 \tstidxutfword{blas\'e}{blasé} about being the
 \tstidxutfword{prot\'eg\'e}{protégé}
 of the great \tstidxperson{Donald}{Knuth}.
 It may stagger the
 \tstidxutfword{client\`ele}{clientèle} of
 \if@tstidx@use@encaps
   \tstidxartphrase[tstidxencapii]{the}{commercial world}
 \else
   \tstidxartphrase{the}{commercial world}
 \fi
 to discover our
 \tstidxutfword{r\'esum\'e}{résumé}
 (after foraging for it in our natty
 \tstidxutfphrase{attach\'e case}{attaché case})
 while we sample a \tstidxword{vol-au-vent} or \tstidxword{two}
 at the \tstidxutfword{soir\'ee}{soirée}
 in the \tstidxutfphrase{pied-\`a-terre}{pied-à-terre}
 with the delightful \tstidxutfword{ph\oe nix}{phœnix}-%
 themed \tstidxutfword{d\'ecor}{décor} and
 \tstidxutfword{f\ae rie}{færie}
 \tstidxutfword{fa\c{c}ade}{façade}
 that has stunned
 many an \tstidxutfword{\ae thereal}{æthereal}
 \tstidxutfword{d\'ebutante}{débutante}
 sporting a \tstidxutfphrase{berg\`ere hat}{bergère hat},
 but it would be \tstidxutfword{na\"ive}{naïve}
 to fall for such a \tstidxutfword{f\oe tid}{fœtid}
 \tstidxutfword{clich\'e}{cliché}.
 This \tstidxword{paragraph} is in a state of
 \tstidxutfword{d\'eshabill\'e}{déshabillé}.
 Like a \tstidxword{sculpture} of \tstidxword{Venus} in a
 \tstidxutfword{n\'eglig\'ee}{négligée}, it's transparently
 obvious that this \tstidxword{paragraph} is provided for the sole purpose of
 \tstidxword{ogling}\tstindexsee{gawping}{see}{ogling}
 \tstidxphrase{extended Latin characters} and testing
 how \tstidxapp{xindy} and \tstidxapp{makeindex} compare.
 Time for a quick trip to the \tstidxutfword{caf\'e}{café}
 for an \tstidxutfword{an\ae mic}{anæmic}
 \tstidxphrase{cup of tea} with
 \tstidxutfperson{Anders Jonas}{\AA ngstr\"om}%
 {Anders Jonas}{Ångström} and then off to find a \tstidxword{zoo}
 in \tstidxutfplace{\"Osterg\"otland}{Östergötland},
 so we can get to the end of the \tstidxword{alphabet}. Perhaps
 then we should go over to
 \tstidxutfplace{\"Angelholm}{Ängelholm}
 and head off across the
 \tstidxutfplace{\O resund}{Øresund} bridge and
 \tstidxword{resume} our search for some more examples.
 We'll go on a \tstidxphrase{whistle-stop tour} around
 \tstidxutfplace{T\r{a}rnby}{Tårnby},
 \tstidxutfplace{R\o dovre}{Rødovre},
 \tstidxutfplace{N\ae stved}{Næstved} and
 \tstidxutfplace{\O lstykke-Stenl\o se}{Ølstykke-Stenløse}.
 Afterwards, we'll \tstidxword{fly} to
 \tstidxplace{Poland} (possibly in an \tstidxword{aeroplane}\tstidxdash
 if passengers would like to look out of their \tstidxword{window}, they'll
 see we're passing over
 \tstidxutfplace{A\ss lar}{Aßlar} and
 \tstidxutfplace{Bad Gottleuba-Berggie\ss h\"ubel}{Bad Gottleuba-Berggießhübel})
 and then we'll visit \tstidxutfplace{\L\'od\'z}{Łódź},
 \@tstidx@if@notOT@ne
 {%
   \tstidxutfplace{\'Swi\k{e}tokrzyskie}{Świętokrzyskie}%
   \ifxetex
   \else
     \ifluatex
     \else
       \space(that one will cause a problem for certain font encodings
       because of the \tstidxword{ogonek} and
       will be omitted if you use the default
       \tstidxsubword{font encoding}{OT1}
       encoding, but not if you use the \tstidxsty{fontenc} package with,
       for example, the \tstidxstyopt{fontenc}{T1} option)%
     \fi
   \fi,
 }%
 {%
   [a place with an \tstidxword{ogonek} has been omitted because this document
    is using the default \tstidxsubword{font encoding}{OT1} font
   encoding\tstidxdash try loading \tstidxsty{fontenc} with the
   \tstidxstyopt{fontenc}{T1} option],
 }%
 \tstidxutfplace{\.Zory}{Żory},
 \tstidxutfplace{\.Zelech\'ow}{Żelechów},
 \tstidxutfplace{\L obez}{Łobez},
 \tstidxutfplace{G\l og\'ow}{Głogów}
 (not to be confused with \tstidxplace{Glasgow}),
 \tstidxutfplace{\'Cmiel\'ow}{Ćmielów},
 \tstidxutfplace{\'Scinawa}{Ścinawa}
 and
 \tstidxutfplace{\'Swidnica}{Świdnica}.
 Then let's \tstidxword{sail} to \tstidxplace{Iceland} (possibly in
 a \tstidxword{ship}) and visit the lakes of
 \tstidxplace{Iceland}, such as
 \tstidxutfplace{\"Olvesvatn}{Ölvesvatn},
 \tstidxutfplace{\'Ulfsvatn}{Úlfsvatn},
 \tstidxutfplace{\'Anavatn}{Ánavatn},
 \tstidxutfplace{M\'asvatn}{Másvatn},
 \@tstidx@if@notOT@ne
 {%
   \tstidxutfplace{\th r\'hyrningsvatn}{Þríhyrningsvatn}
   (that one starts with a \tstidxutfword{thorn (\th)}{thorn (Þ)}),
   \tstidxutfplace{Sigr\'i\dh arsta\dh avatn}{Sigríðarstaðavatn}
   (that one has an \tstidxutfword{eth \dh}{eth ð}%
   \ifxetex
    )%
   \else
     \ifluatex
      )%
     \else
       \tstidxdash those last two will also be omitted if you use the default
       \tstidxword{OT1} \tstidxword{font encoding})%
     \fi
   \fi,
 }%
 {%
   [a couple of lakes with a \tstidxword{thorn} and an
   \tstidxword{eth} have been omitted because this document is using the
   default \tstidxword{OT1} \tstidxword{font encoding}\tstidxdash try loading
   \tstidxsty{fontenc} with the \tstidxstyopt{fontenc}{T1} option],
 }%
 \tstidxutfplace{Gr\ae navatn}{Grænavatn},
 \tstidxutfplace{\'Arnesl\'on}{Árneslón}
 and
 \tstidxutfplace{\'Ish\'olsvatn}{Íshólsvatn}.
 If you are using this with \tstidxapp{xindy} and
 \tstidxword{UTF-8}, try this out with a different language option,
 for example \tstidxappopt{xindy}{-L swedish} or
 \tstidxappopt{xindy}{-L danish} or \tstidxappopt{xindy}{-L german-duden} or
 \tstidxappopt{xindy}{-L german-din5007} or \tstidxappopt{xindy}{-L polish} or
 \tstidxappopt{xindy}{-L icelandic}.
 \@tstidx@ifgerman
 {I notice you've use the \tstidxstyopt{testidx}{german} or
  \tstidxstyopt{testidx}{ngerman} package option. This means that if you want
  to use \tstidxapp{makeindex} instead of \tstidxapp{xindy}, you can
  use \tstidxapp{makeindex}'s \tstidxappopt{makeindex}{-g} option.%
 }%
 {%
  If you want to use \tstidxapp{makeindex} instead of
  \tstidxapp{xindy}, then the package option \tstidxstyopt{testidx}{german} or
  \tstidxstyopt{testidx}{ngerman} will allow you to use
  \tstidxapp{makeindex}'s \tstidxappopt{makeindex}{-g} option.%
 }%
 \@tstidx@ifutfviii
 {%
   \ifxetex
   \else
     \ifluatex
     \else
       \space You currently have the
       \@tstidx@ifsanitize
       {\tstidxstyopt{testidx}{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}{nosanitize}
        option instead. This may cause the \tstidxword{UTF-8} characters to be
        written in terms of \tstidxcs{IeC}.%
       }%
       {\tstidxstyopt{testidx}{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}{sanitize}
        option instead, which will sanitize the \tstidxword{UTF-8} characters
        before passing them to \tstidxcs{tstindex}.%
       }
     \fi
   \fi
 }%
 {}%
}
\tstidxnewblock
{%
  Don't forget there's also a \tstidxphrase{number group}, so let's
  have some numbers.
  \tstidxartbook{The}{Hitchhiker's Guide to the Galaxy} has
  of course propelled the number \tstidxnumber{42} to stardom, as the
  answer to \tstidxword{life}, the \tstidxword{universe} and
  everything. We usually deal in base~\tstidxnumber{10}, but sometimes
  base~\tstidxnumber{16} is useful to programmers, and computers
  prefer base~\tstidxnumber{2} (and \tstidxnumber{2} is the only
  \tstidxword{even} \tstidxword{prime number}). A \tstidxword{century} in
  \tstidxword{cricket} means \tstidxnumber{100} runs, and in the
  \tstidxword{calendar} \tstidxnumber{100} years.
  If you're using \tstidxapp{xindy}, you can provide a numbers group
  by adding the following to your \texttt{.xdy} module:
\begin{flushleft}\ttfamily
(define-letter-group \string"Numbers\string"\par
   \string: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")\par
   \string:before \string"A\string")
\end{flushleft}
  Whilst we're on the subject of numbers, let's try out some
  equations.
\begin{equation}
\tstidxmath{E}{E} = mc^2
\end{equation}
  \@tstidx@ifamsmath
  {%
   Since this document is using \tstidxsty{amsmath}, let's try out
the \tstidxenv{align} environment:
\begin{align}
\tstidxmath{f(x)}{f(\protect\vec{x})} &=
 \tstidxmathsym{alpha}{\protect\alpha}
 \tstidxmathsym{sum}{\protect\sum}_i^{\tstidxmath{n}{n}} x_i
+\tstidxmathsym{beta}{\protect\beta} \sum_{i}^n x_i^2
+\tstidxmathsym{gamma}{\protect\gamma}
\end{align}
   If this document hadn't loaded the \tstidxsty{amsmath} package,
we would have had to use the \tstidxenv{eqnarray} environment
instead.
  }%
  {%
   This document doesn't load the \tstidxsty{amsmath} package, so
let's try out the \tstidxenv{eqnarray} environment:
\begin{eqnarray}
\tstidxmath{f(x)}{f(\protect\vec{x})} &=&
 \tstidxmathsym{alpha}{\protect\alpha}
 \tstidxmathsym{sum}{\protect\sum}_i^{\tstidxmath{n}{n}} x_i
+\tstidxmathsym{beta}{\protect\beta} \sum_{i}^n x_i^2
+\tstidxmathsym{gamma}{\protect\gamma}
\end{eqnarray}
   If you load the \tstidxsty{amsmath} package, we'll test the
   \tstidxenv{align} environment instead.
  }%
  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 the code you can add to your
\texttt{.xdy} file to implement it:
\begin{flushleft}\ttfamily
(define-letter-group \string"Maths\string"
   \string:prefixes (\string"\tstidxmathsymprefix\string")
   \string:before \string"Numbers\string")
\end{flushleft}
 I've done something similar with the \tstidxword{marker}s where I've used
 \texttt{\tstidxindexmarkerprefix} as the \tstidxword{prefix}.%
}
\tstidxnewblock*{\@tidx@closerangepar}%
{%
 This is the end of the \tstidxcloseword{range}
 \tstidxword{example} from \tstidxword{block}~\@tidx@openrangepar.
 There's not much else to say about this \tstidxword{block} really.
 It's quite boring, isn't it? However, you'll need it if you've
 included block~\@tidx@openrangepar. Unless you're testing for
 a mis-matched range, of course. That might be quite interesting,
 possibly, but I'm not going to \tstidxphrase{hold my breath}.%
}
\tstidxnewblock
{%
  Now this is going to be hard to believe\tstidxdash in fact I'm
  totally \tstidxword{gobsmacked} and utterly \tstidxword{astounded}
  \tstidxdash but I've discovered that we're still missing some
  \tstidxphrase{letter groups}, and I've run out of anything
  \tstidxword{quaint} to say, so I'm going to have to
  \tstidxword{yatter} for a while longer, which will probably make
  you \tstidxword{yawn}. What shall we talk about? My \tstidxword{quirky}
  \tstidxword{badinage} is about to \tstidxword{expire}. How about a
  \tstidxword{story}? Here's one I made up for my friend
  \tstidxperson{Paulo}{Cereda} in \tstidxsym{TeX}{\TeX}.SE chat because he likes
  ducks and is the creator of \tstidxapp{arara}.
  So, are you sitting comfortably? Then let's \tstidxword{begin}. By the way,
  before I \tstidxword{forget}, it's called
  \tstidxbook{Sir Quackalot and the Golden Arara} and is the
  first story in
  \tstidxartbook{The}{Adventures of Sir Quackalot}.
  It's a \tstidxword{tale} of \tstidxword{adventure} and
  \tstidxword{daring-do}. The \tstidxword{hero} of the
  \tstidxword{story} is \tstidxperson{Sir}{Quackalot}, in case you
  can't tell from the \tstidxword{title}.
  \tstidxphrase{Once upon a time}, a long time ago in
  \tstidxartphrase{a}{far away land}, there lived a
  \tstidxword{knight}. He was \tstidxword{handsome}, he was
  \tstidxword{bold}, he was \tstidxword{brave}.
  He was\tstidxdash a \tstidxword{duck}. His \tstidxword{name} was
  \tstidxperson{Sir}{Quackalot}.
  One day \tstidxperson{the}{Fairy Goose} appeared.
  \tstidxqt{Brave \tstidxword{knight},} she said. \tstidxqt{A terrible
  \tstidxword{plight} has fallen on
  the \tstidxword{land}. The evil \tstidxword{OgRe} has stolen
  \tstidxartphrase{the}{Golden Arara}. Only you can save it.}
  (That's a \tstidxword{reference} to
  \tstidxsym{TeX}{\TeX}'s \tstidxphrase{output routine}, if you missed it.)
  \tstidxqt{It will be a \tstidxword{perilous} \tstidxword{quest}, but find
  \tstidxartphrase{the}{Mighty Helm of Knuth} and
  \tstidxartphrase{the}{Legendary Sword} \tstidxword{xor} to aid you.} (Ask
  \tstidxperson{David}{Carlisle} about the \tstidxword{xor}
  \tstidxword{reference}.)%
}
\tstidxnewblock
{%
 So \tstidxperson{Sir}{Quackalot} set out on his \tstidxword{quest}.
 (This is the \tstidxword{continuation} from
 the previous \tstidxword{block}, for any \tstidxword{newcomers}
 who have just turned up.) He soon arrived at
 \tstidxartphrase{the}{Bog of Eternal Glossaries} (that's a
 reference to my \tstidxsty{glossaries} package, and it's also a
 \tstidxword{nod} to \tstidxartplace{the}{Bog of Eternal Stench} in
 \tstidxfilm{Labyrinth}), in the
 \tstidxword{centre} (or \tstidxword{center} for those of you
 \tstidxphrase{across the pond}) of which was
 suspended \tstidxartphrase{the}{Mighty Helm of Knuth}, but
 \tstidxperson{Sir}{Quackalot} was learned in the \tstidxword{lore} of
 installing \tstidxapp{Perl} and was able to leap upon the
 \tstidxword{raft} \tstidxapp{makeglossaries} and steer his way through the
 \tstidxword{external} \tstidxphrase{indexing application}s and their many
 arguments.  (That's supposed to be a \tstidxword{pun}, but it's
 \tstidxphrase{bad form} to explain the \tstidxword{joke}, and it
 wasn't even particularly \tstidxword{witty}.
 Incidentally, \tstidxperson{Joseph}{Wright} makes a
 \tstidxword{cameo} at this point with the
 \tstidxword{exclamation} \tstidxqt{fetchez la vache!}\ but you'll have to
 ask \tstidxperson{Paulo}{Cereda} what
 that's all about. It wouldn't surprise me if it had something to
 do with \tstidxphrase{Monty Python}.)%
}
\tstidxnewblock
{%
 Anyway, where were we? Oh, yes.  He (that's
 \tstidxperson{Sir}{Quackalot} we're talking about, if you've only
 just joined us) snatched up \tstidxartphrase{the}{Mighty Helm of Knuth} and
 escaped from the \tstidxword{perilous} \tstidxword{bog}. Soon he came to
 \tstidxartphrase{the}{Dread Vale of the Editors}, guarded
 at either end by the ever-quarrelling
 \tstidxword{leviathans} \tstidxapp{Emacs} and \tstidxapp{Vi}.
 As he approached the \tstidxword{vale}, Emacs uttered the
 \tstidxphrase{magic incantation} that
 sent forth \tstidxartphrase{the}{butterflies of chaos}.
 (I know \tstidxqt{\tstidxword{doom}} is more appropriate but,
 as is \tstidxphrase{common knowledge}, \tstidxword{chaos} is a
 \tstidxword{butterfly} \tstidxword{motif}.)%
}
\tstidxnewblock
{%
But \tstidxperson{Sir}{Quackalot} was protected by
\tstidxartphrase{the}{Mighty Helm of Knuth} and
raced past into the \tstidxword{vale}, where he found
\tstidxartphrase{the}{Legendary Sword} \tstidxword{xor} in
the centre of the great \tstidxsty{longtable}. (Ooh, I've started a
\tstidxword{sentence} with a \tstidxword{conjunction}.
How \tstidxword{naughty} is that?)
With a great \tstidxword{leap} and a \tstidxword{bound},
\tstidxperson{Sir}{Quackalot} plucked out the \tstidxword{sword} and
headed for the far end of the \tstidxword{vale}.
Up pounced \tstidxapp{Vi} and belched forth a \tstidxword{myriad}
of \tstidxword{clones} that bore down on
\tstidxperson{Sir}{Quackalot}.  But, brandishing the \tstidxword{sword}
\tstidxword{xor}, \tstidxperson{Sir}{Quackalot} sliced them down.
(There's some \tstidxword{repetition} there, but hopefully no one's
noticed. There's even more coming up in the next
\tstidxword{block}.)%
}
\tstidxnewblock*{\@tidx@close@testidxsty}%
{%
\tstidxperson{Sir}{Quackalot} escaped from
\tstidxartphrase{the}{Dread Vale of the Editors} and set off
up the path that led to the evil \tstidxword{OgRe}'s \tstidxword{lair}.
As \tstidxperson{Sir}{Quackalot} approached, there was a fearful
\tstidxword{roar}, and the \tstidxword{OgRe} pounced on \tstidxperson{Sir}{Quackalot}.
The brave \tstidxword{knight} raised his powerful \tstidxword{sword}
\tstidxword{xor} and brought it down on the \tstidxword{OgRe}, destroying him.
\tstidxperson{Sir}{Quackalot} rescued \tstidxartphrase{the}{Golden Arara}
and the \tstidxword{land} was once more restored to \tstidxword{peace} and
\tstidxword{harmony} and
\tstidxword{paragraph}s were able to \tstidxword{span}
\tstidxphrase{page break}s without \tstidxword{fear}.
\tstidxartphrase{The}{End}. Don't miss the next \tstidxword{thrilling}
\tstidxword{adventure} \tstidxbook{Sir Quackalot and the Hyper Lake of Doom}
where our \tstidxphrase{intrepid hero}%
\tstindexsubsee{hero}{intrepid}{see}{intrepid hero} meets a \tstidxword{quixotic}
\tstidxword{seal} with a \tstidxword{zither} (a \tstidxword{zealous}
\tstidxword{fan} of \tstidxartfilm{The}{Third Man}), a \tstidxword{youthful}
\tstidxphrase{sea lion} with a \tstidxword{magic}
\tstidxword{yo-yo}, and a \tstidxword{wily} \tstidxword{wombat}
\tstidxword{warrior} with a \tstidxword{laser-guided}
\tstidxphrase{sealant gun}. Can they defeat the
\tstidxword{villainous}, \tstidxword{zany} \tstidxword{zoologist}
sailing a \tstidxword{xebec} bearing canisters of
\tstidxword{xenon}, \tstidxword{xylem} and \tstidxword{xylene}?
Oh, \tstidxword{zounds}! He's wearing a \tstidxphrase{zoot suit}
and smoking a \tstidxword{zucchini} whilst playing a \tstidxword{xylophone}.
As one \tstidxphrase{anonymous reviewer} said,
it's as \tstidxword{exhilarating} as watching a \tstidxword{yuppie}
eating a \tstidxphrase{yule log} soaked in \tstidxphrase{yoghurt}.
Hmm, \tstidxword{yummy}\tstidxdash or \tstidxword{yuck}, depending
on your tastes.%
}
\tstidxnewblock
{%
 Oh, did I tell you about the \tstidxphrase{vice-president} who was
 a \tstidxword{Viking} in a \tstidxword{vignette}? No? Well, I can't
 quite remember the \tstidxword{story} myself, but it had something
 to do with a \tstidxphrase{vice admiral} with a
 \tstidxphrase{Victoria plum} and a \tstidxphrase{viceroy} with
 a \tstidxphrase{Victoria sponge}, or was it
 \tstidxphrase{vice versa}? The \tstidxphrase{vice chancellor}
 preferred \tstidxword{vichyssoise}.
 For \tstidxphrase{letter ordering} use the \tstidxappopt{makeindex}{-l} option
 with \tstidxapp{makeindex} or the \texttt{ord/letorder} module
 with \tstidxapp{xindy} (\tstidxappopt{xindy}{-M ord/letorder}).
 If you omit this, the default
 \tstidxphrase{word ordering} is used. The ordering in the
 \tstidxbook{Compact Oxford English Dictionary} (third edition,
 revised) for these words are: vice admiral, vice chancellor, vice-president,
 \tstidxword{viceregal}, viceroy, vice versa. Quick
 \tstidxword{quizz}. Can you get \tstidxapp{makeindex} or
 \tstidxapp{xindy} to reproduce that order?%
}
\tstidxnewblock*{\@tidx@close@testidxsty}%
{%
 This is the final \tstidxword{block} of dummy text
 provided by the \tstidxclosesty{testidx} package. This block
 contains the close of a \tstidxword{range} that was started in block~1.
 Fun, wasn't it?%
}
\endinput
%%
%% End of file `testidx.sty'.
