texlive[42294] Master: testidx (17oct16)

commits+karl at tug.org commits+karl at tug.org
Mon Oct 17 23:25:15 CEST 2016


Revision: 42294
          http://tug.org/svn/texlive?view=revision&revision=42294
Author:   karl
Date:     2016-10-17 23:25:14 +0200 (Mon, 17 Oct 2016)
Log Message:
-----------
testidx (17oct16)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/testidx/
    trunk/Master/texmf-dist/doc/latex/testidx/CHANGES
    trunk/Master/texmf-dist/doc/latex/testidx/README
    trunk/Master/texmf-dist/doc/latex/testidx/samples/
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-a4.pdf
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-a4.tex
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-amsmath.pdf
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-amsmath.tex
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-babel-german.pdf
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-babel-german.tex
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-german.pdf
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-german.tex
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-hyp.pdf
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-hyp.tex
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-letter.pdf
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-letter.tex
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-lua.pdf
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-lua.tex
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-subset.pdf
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-subset.tex
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-t1.pdf
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-t1.tex
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-utf8.pdf
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-utf8.tex
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-xe.pdf
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-xe.tex
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx.pdf
    trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx.tex
    trunk/Master/texmf-dist/doc/latex/testidx/testidx-code.pdf
    trunk/Master/texmf-dist/doc/latex/testidx/testidx-manual.pdf
    trunk/Master/texmf-dist/doc/latex/testidx/testidx-manual.tex
    trunk/Master/texmf-dist/source/latex/testidx/
    trunk/Master/texmf-dist/source/latex/testidx/testidx.dtx
    trunk/Master/texmf-dist/source/latex/testidx/testidx.ins
    trunk/Master/texmf-dist/tex/latex/testidx/
    trunk/Master/texmf-dist/tex/latex/testidx/testidx.sty
    trunk/Master/tlpkg/tlpsrc/testidx.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/testidx/CHANGES
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/CHANGES	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/testidx/CHANGES	2016-10-17 21:25:14 UTC (rev 42294)
@@ -0,0 +1,3 @@
+v1.0 (2016-10-17):
+
+ * Initial release

Added: trunk/Master/texmf-dist/doc/latex/testidx/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/README	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/testidx/README	2016-10-17 21:25:14 UTC (rev 42294)
@@ -0,0 +1,34 @@
+LaTeX Package : testidx v1.0
+
+Last Modified : 2016-10-17
+
+Author        : Nicola Talbot
+
+This package provides dummy text for testing indexes.
+
+Example document:
+
+\documentclass{article}
+
+\usepackage{makeidx}
+\usepackage{testidx}
+
+\makeindex
+
+\begin{document}
+\testidx
+
+\printindex
+\end{document}
+
+Note that the dummy indexing intentionally triggers multiple encap
+warnings for testing purposes.
+
+LICENCE
+
+This material is subject to the LaTeX Project Public License.
+See http://www.ctan.org/license/lppl1.3
+for the details of that license.
+
+Author's home page: http://www.dickimaw-books.com/
+


Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/README
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-a4.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-a4.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-a4.pdf	2016-10-17 21:24:04 UTC (rev 42293)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-a4.pdf	2016-10-17 21:25:14 UTC (rev 42294)

Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-a4.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-a4.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-a4.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-a4.tex	2016-10-17 21:25:14 UTC (rev 42294)
@@ -0,0 +1,28 @@
+% This file is public domain.
+%
+% This example document demonstrates the testidx package
+% with A4 paper. You can build this document using:
+%
+% pdflatex sample-idx-a4
+% makeindex sample-idx-a4.idx
+% pdflatex sample-idx-a4
+%
+% If you are using arara, the directives are:
+%
+% arara: pdflatex
+% arara: makeindex
+% arara: pdflatex
+\documentclass[a4paper]{article}
+
+\usepackage{geometry}
+\usepackage{makeidx}
+\usepackage{testidx}
+
+\makeindex
+
+\begin{document}
+\testidx
+
+\printindex
+\end{document}
+


Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-a4.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-amsmath.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-amsmath.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-amsmath.pdf	2016-10-17 21:24:04 UTC (rev 42293)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-amsmath.pdf	2016-10-17 21:25:14 UTC (rev 42294)

Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-amsmath.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-amsmath.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-amsmath.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-amsmath.tex	2016-10-17 21:25:14 UTC (rev 42294)
@@ -0,0 +1,28 @@
+% This file is public domain.
+%
+% This example document demonstrates the testidx package
+% with the amsmath package. You can build this document using:
+%
+% pdflatex sample-idx-amsmath
+% makeindex sample-idx-amsmath.idx
+% pdflatex sample-idx-amsmath
+%
+% If you are using arara, the directives are:
+%
+% arara: pdflatex
+% arara: makeindex
+% arara: pdflatex
+\documentclass{article}
+
+\usepackage{makeidx}
+\usepackage{amsmath}
+\usepackage{testidx}
+
+\makeindex
+
+\begin{document}
+\testidx
+
+\printindex
+\end{document}
+


Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-amsmath.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-babel-german.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-babel-german.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-babel-german.pdf	2016-10-17 21:24:04 UTC (rev 42293)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-babel-german.pdf	2016-10-17 21:25:14 UTC (rev 42294)

Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-babel-german.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-babel-german.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-babel-german.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-babel-german.tex	2016-10-17 21:25:14 UTC (rev 42294)
@@ -0,0 +1,45 @@
+% This file is public domain.
+%
+% This example document demonstrates the testidx package
+% with babel and the -g (German) makeindex option.
+% You can build this document using:
+%
+% pdflatex sample-idx-babel-german
+% makeindex -g -s sample-idx-babel-german.idx sample-idx-babel-german.idx
+% pdflatex sample-idx-babel-german
+%
+% If you are using arara, the directives are:
+%
+% arara: pdflatex
+% arara: makeindex: { german: on, style: sample-idx-german.ist }
+% arara: pdflatex
+\documentclass[ngerman]{article}
+
+\usepackage{filecontents}
+\usepackage{makeidx}
+\usepackage{babel}
+\usepackage{testidx}
+
+\providecommand*\lettergroup[1]{%
+  \par\textbf{#1}\par
+  \nopagebreak
+}
+\begin{filecontents*}{\jobname.ist}
+quote '+'
+headings_flag 1
+heading_prefix "\\item\\lettergroup{"
+heading_suffix "}\n"
+symhead_positive "Symbole"
+symhead_negative "symbole"
+numhead_positive "Zahlen"
+numhead_negative "zahlen"
+\end{filecontents*}
+
+\makeindex
+
+\begin{document}
+\testidx
+
+\printindex
+\end{document}
+


Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-babel-german.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-german.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-german.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-german.pdf	2016-10-17 21:24:04 UTC (rev 42293)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-german.pdf	2016-10-17 21:25:14 UTC (rev 42294)

Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-german.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-german.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-german.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-german.tex	2016-10-17 21:25:14 UTC (rev 42294)
@@ -0,0 +1,45 @@
+% This file is public domain.
+%
+% This example document demonstrates the testidx package
+% with ngerman.sty and the -g (German) makeindex option.
+% You can build this document using:
+%
+% pdflatex sample-idx-german
+% makeindex -g -s sample-idx-german.idx sample-idx-german.idx
+% pdflatex sample-idx-german
+%
+% If you are using arara, the directives are:
+%
+% arara: pdflatex
+% arara: makeindex: { german: on, style: sample-idx-german.ist }
+% arara: pdflatex
+\documentclass{article}
+
+\usepackage{filecontents}
+\usepackage{makeidx}
+\usepackage{ngerman}
+\usepackage[german]{testidx}
+
+\providecommand*\lettergroup[1]{%
+  \par\textbf{#1}\par
+  \nopagebreak
+}
+\begin{filecontents*}{\jobname.ist}
+quote '+'
+headings_flag 1
+heading_prefix "\\item\\lettergroup{"
+heading_suffix "}\n"
+symhead_positive "Symbole"
+symhead_negative "symbole"
+numhead_positive "Zahlen"
+numhead_negative "zahlen"
+\end{filecontents*}
+
+\makeindex
+
+\begin{document}
+\testidx
+
+\printindex
+\end{document}
+


Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-german.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-hyp.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-hyp.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-hyp.pdf	2016-10-17 21:24:04 UTC (rev 42293)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-hyp.pdf	2016-10-17 21:25:14 UTC (rev 42294)

Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-hyp.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-hyp.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-hyp.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-hyp.tex	2016-10-17 21:25:14 UTC (rev 42294)
@@ -0,0 +1,28 @@
+% This file is public domain.
+%
+% This example document demonstrates the testidx package
+% with hyperref.sty makeindex. You can build this document using:
+%
+% pdflatex sample-idx-hyp
+% makeindex sample-idx-hyp.idx
+% pdflatex sample-idx-hyp
+%
+% If you are using arara, the directives are:
+%
+% arara: pdflatex
+% arara: makeindex
+% arara: pdflatex
+\documentclass{article}
+
+\usepackage{makeidx}
+\usepackage{testidx}
+\usepackage[hidelinks]{hyperref}
+
+\makeindex
+
+\begin{document}
+\testidx
+
+\printindex
+\end{document}
+


Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-hyp.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-letter.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-letter.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-letter.pdf	2016-10-17 21:24:04 UTC (rev 42293)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-letter.pdf	2016-10-17 21:25:14 UTC (rev 42294)

Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-letter.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-letter.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-letter.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-letter.tex	2016-10-17 21:25:14 UTC (rev 42294)
@@ -0,0 +1,30 @@
+% This file is public domain.
+%
+% This example document demonstrates the testidx package
+% with US Letter paper and the book class. You can build
+% this document using:
+%
+% pdflatex sample-idx-letter
+% makeindex sample-idx-letter.idx
+% pdflatex sample-idx-letter
+%
+% If you are using arara, the directives are:
+%
+% arara: pdflatex
+% arara: makeindex
+% arara: pdflatex
+\documentclass[letterpaper]{book}
+
+\usepackage[marginpar=1in]{geometry}
+\usepackage{makeidx}
+\usepackage{testidx}
+
+\makeindex
+
+\begin{document}
+\chapter{Sample}
+\testidx
+
+\printindex
+\end{document}
+


Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-letter.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-lua.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-lua.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-lua.pdf	2016-10-17 21:24:04 UTC (rev 42293)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-lua.pdf	2016-10-17 21:25:14 UTC (rev 42294)

Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-lua.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-lua.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-lua.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-lua.tex	2016-10-17 21:25:14 UTC (rev 42294)
@@ -0,0 +1,78 @@
+% This file is public domain.
+%
+% This example document demonstrates the testidx package
+% with LuaLaTeX and xindy. You can build this document using:
+%
+% lualatex sample-idx-lua
+% xindy -M sample-idx-lua -M texindy -C utf8 -L english -t sample-idx-lua.ilg sample-idx-lua.idx
+% lualatex sample-idx-lua
+%
+% If you are using arara, the directives are:
+%
+% arara: lualatex
+% arara: xindy: {language: english, codepage: utf8,
+% arara: --> log: sample-idx-lua.ilg,
+% arara: --> modules: [basename, texindy]}
+% arara: lualatex
+\documentclass{article}
+
+\usepackage{filecontents}
+\usepackage{fontspec}
+\usepackage{makeidx}
+\usepackage{testidx}
+
+% Create the .xdy file for this example:
+\begin{filecontents*}{\jobname.xdy}
+; list of allowed attributes
+
+(define-attributes ((
+  "tstidxencapi"
+  "tstidxencapii"
+  "tstidxencapiii"
+)))
+
+; define format to use for locations
+
+(markup-locref :open "\tstidxencapi{"
+ :close "}"
+ :attr "tstidxencapi")
+
+(markup-locref :open "\tstidxencapii{"
+ :close "}"
+ :attr "tstidxencapii")
+
+(markup-locref :open "\tstidxencapiii{"
+ :close "}"
+ :attr "tstidxencapiii")
+
+(markup-locref-list :sep ",")
+(markup-range :sep "--")
+
+; define a numbers group
+
+(define-letter-group "Numbers"
+   :prefixes ("0" "1" "2" "3" "4" "5" "6" "7" "8" "9")
+   :before "A")
+
+; define a "Maths" group for keys starting with "+"
+
+(define-letter-group "Maths"
+   :prefixes (">" )
+   :before "Numbers")
+
+; define a "Markers" group for keys starting with "."
+
+(define-letter-group "Markers"
+   :prefixes ("<" )
+   :before "Maths")
+
+\end{filecontents*}
+
+\makeindex
+
+\begin{document}
+\testidx
+
+\printindex
+\end{document}
+


Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-lua.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-subset.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-subset.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-subset.pdf	2016-10-17 21:24:04 UTC (rev 42293)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-subset.pdf	2016-10-17 21:25:14 UTC (rev 42294)

Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-subset.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-subset.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-subset.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-subset.tex	2016-10-17 21:25:14 UTC (rev 42294)
@@ -0,0 +1,28 @@
+% This file is public domain.
+%
+% This example document demonstrates the testidx package
+% with a subset of the test paragraphs. You can build this
+% document using:
+%
+% pdflatex sample-idx-subset
+% makeindex sample-idx-subset.idx
+% pdflatex sample-idx-subset
+%
+% If you are using arara, the directives are:
+%
+% arara: pdflatex
+% arara: makeindex
+% arara: pdflatex
+\documentclass{article}
+
+\usepackage{makeidx}
+\usepackage{testidx}
+
+\makeindex
+
+\begin{document}
+\testidx[1,8,10-14,\tstidxmaxblocks]
+
+\printindex
+\end{document}
+


Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-subset.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-t1.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-t1.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-t1.pdf	2016-10-17 21:24:04 UTC (rev 42293)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-t1.pdf	2016-10-17 21:25:14 UTC (rev 42294)

Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-t1.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-t1.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-t1.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-t1.tex	2016-10-17 21:25:14 UTC (rev 42294)
@@ -0,0 +1,37 @@
+% This file is public domain.
+%
+% This example document demonstrates the testidx package
+% with makeindex. You can build this document using:
+%
+% pdflatex sample-idx-t1
+% makeindex sample-idx-t1.idx
+% pdflatex sample-idx-t1
+%
+% If you are using arara, the directives are:
+%
+% arara: pdflatex
+% arara: makeindex
+% arara: pdflatex
+\documentclass{article}
+
+\usepackage[T1]{fontenc}
+\usepackage{makeidx}
+\usepackage
+ [% options:
+   stripaccents,% strip accents from sort key (default)
+   %nostripaccents,% don't strip accents from sort key
+   %verbose,% show \index commands in the text
+   noverbose,% don't show \index commands in the text (default)
+   showmarks,% highlight where \index has been used (default)
+   %hidemarks,% don't highlight where \index has been used
+   %notestencaps,% don't test the encaps
+ ]{testidx}
+
+\makeindex
+
+\begin{document}
+\testidx
+
+\printindex
+\end{document}
+


Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-t1.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-utf8.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-utf8.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-utf8.pdf	2016-10-17 21:24:04 UTC (rev 42293)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-utf8.pdf	2016-10-17 21:25:14 UTC (rev 42294)

Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-utf8.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-utf8.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-utf8.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-utf8.tex	2016-10-17 21:25:14 UTC (rev 42294)
@@ -0,0 +1,87 @@
+% This file is public domain.
+%
+% This example document demonstrates the testidx package
+% with inputenc.sty and xindy. You can build this document using:
+%
+% pdflatex sample-idx-utf8
+% xindy -M sample-idx-utf8 -M texindy -C utf8 -L english -t sample-idx-utf8.ilg sample-idx-utf8.idx
+% pdflatex sample-idx-utf8
+%
+% If you are using arara, the directives are:
+%
+% arara: pdflatex
+% arara: xindy: {language: english, codepage: utf8,
+% arara: --> modules: [basename, texindy]}
+% arara: pdflatex
+\documentclass{article}
+
+\usepackage{filecontents}
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+\usepackage{makeidx}
+\usepackage
+ [
+  %nosanitize,% don't sanitize characters in the dummy entries
+  sanitize,% sanitize characters in the dummy entries
+  showmarks,% show where the indexing command has been used
+  %hidemarks,% hide the visual effects
+  %verbose,% show the argument that's being passed to \index
+           % warning: will cause overfull lines!
+  noverbose% default
+ ]
+ {testidx}
+
+% Create the .xdy file for this example:
+\begin{filecontents*}{\jobname.xdy}
+; list of allowed attributes
+
+(define-attributes ((
+  "tstidxencapi"
+  "tstidxencapii"
+  "tstidxencapiii"
+)))
+
+; define format to use for locations
+
+(markup-locref :open "\tstidxencapi{"
+ :close "}"
+ :attr "tstidxencapi")
+
+(markup-locref :open "\tstidxencapii{"
+ :close "}"
+ :attr "tstidxencapii")
+
+(markup-locref :open "\tstidxencapiii{"
+ :close "}"
+ :attr "tstidxencapiii")
+
+(markup-locref-list :sep ",")
+(markup-range :sep "--")
+
+; define a numbers group
+
+(define-letter-group "Numbers"
+   :prefixes ("0" "1" "2" "3" "4" "5" "6" "7" "8" "9")
+   :before "A")
+
+; define a "Maths" group for keys starting with "+"
+
+(define-letter-group "Maths"
+   :prefixes (">" )
+   :before "Numbers")
+
+; define a "Markers" group for keys starting with "."
+
+(define-letter-group "Markers"
+   :prefixes ("<" )
+   :before "Maths")
+\end{filecontents*}
+
+\makeindex
+
+\begin{document}
+\testidx
+
+\printindex
+\end{document}
+


Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-utf8.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-xe.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-xe.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-xe.pdf	2016-10-17 21:24:04 UTC (rev 42293)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-xe.pdf	2016-10-17 21:25:14 UTC (rev 42294)

Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-xe.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-xe.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-xe.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-xe.tex	2016-10-17 21:25:14 UTC (rev 42294)
@@ -0,0 +1,77 @@
+% This file is public domain.
+%
+% This example document demonstrates the testidx package
+% with XeLaTeX and xindy. You can build this document using:
+%
+% xelatex sample-idx-xe
+% xindy -M sample-idx-xe -M texindy -C utf8 -L english -t sample-idx-xe.ilg sample-idx-xe.idx
+% xelatex sample-idx-xe
+%
+% If you are using arara, the directives are:
+%
+% arara: xelatex
+% arara: xindy: {language: english, codepage: utf8,
+% arara: --> modules: [basename, texindy]}
+% arara: xelatex
+\documentclass{article}
+
+\usepackage{filecontents}
+\usepackage{fontspec}
+\usepackage{makeidx}
+\usepackage{testidx}
+
+% Create the .xdy file for this example:
+\begin{filecontents*}{\jobname.xdy}
+; list of allowed attributes
+
+(define-attributes ((
+  "tstidxencapi"
+  "tstidxencapii"
+  "tstidxencapiii"
+)))
+
+; define format to use for locations
+
+(markup-locref :open "\tstidxencapi{"
+ :close "}"
+ :attr "tstidxencapi")
+
+(markup-locref :open "\tstidxencapii{"
+ :close "}"
+ :attr "tstidxencapii")
+
+(markup-locref :open "\tstidxencapiii{"
+ :close "}"
+ :attr "tstidxencapiii")
+
+(markup-locref-list :sep ",")
+(markup-range :sep "--")
+
+; define a numbers group
+
+(define-letter-group "Numbers"
+   :prefixes ("0" "1" "2" "3" "4" "5" "6" "7" "8" "9")
+   :before "A")
+
+; define a "Maths" group for keys starting with "+"
+
+(define-letter-group "Maths"
+   :prefixes (">" )
+   :before "Numbers")
+
+; define a "Markers" group for keys starting with "."
+
+(define-letter-group "Markers"
+   :prefixes ("<" )
+   :before "Maths")
+
+\end{filecontents*}
+
+\makeindex
+
+\begin{document}
+\testidx
+
+\printindex
+\end{document}
+


Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-xe.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx.pdf	2016-10-17 21:24:04 UTC (rev 42293)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx.pdf	2016-10-17 21:25:14 UTC (rev 42294)

Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx.tex	2016-10-17 21:25:14 UTC (rev 42294)
@@ -0,0 +1,36 @@
+% This file is public domain.
+%
+% This example document demonstrates the testidx package
+% with makeindex. You can build this document using:
+%
+% pdflatex sample-idx
+% makeindex sample-idx.idx
+% pdflatex sample-idx
+%
+% If you are using arara, the directives are:
+%
+% arara: pdflatex
+% arara: makeindex
+% arara: pdflatex
+\documentclass{article}
+
+\usepackage{makeidx}
+\usepackage
+ [% options:
+   stripaccents,% strip accents from sort key (default)
+   %nostripaccents,% don't strip accents from sort key
+   %verbose,% show \index commands in the text
+   noverbose,% don't show \index commands in the text (default)
+   showmarks,% highlight where \index has been used (default)
+   %hidemarks,% don't highlight where \index has been used
+   %notestencaps,% don't test the encaps
+ ]{testidx}
+
+\makeindex
+
+\begin{document}
+\testidx
+
+\printindex
+\end{document}
+


Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/samples/sample-idx.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/testidx-code.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/testidx/testidx-code.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/testidx-code.pdf	2016-10-17 21:24:04 UTC (rev 42293)
+++ trunk/Master/texmf-dist/doc/latex/testidx/testidx-code.pdf	2016-10-17 21:25:14 UTC (rev 42294)

Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/testidx-code.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/testidx-manual.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/testidx/testidx-manual.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/testidx-manual.pdf	2016-10-17 21:24:04 UTC (rev 42293)
+++ trunk/Master/texmf-dist/doc/latex/testidx/testidx-manual.pdf	2016-10-17 21:25:14 UTC (rev 42294)

Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/testidx-manual.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/testidx/testidx-manual.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/testidx/testidx-manual.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/testidx/testidx-manual.tex	2016-10-17 21:25:14 UTC (rev 42294)
@@ -0,0 +1,859 @@
+\documentclass[widecs]{nlctdoc}
+
+\usepackage[marginpar=1in]{geometry}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{metalogo}
+\usepackage{cmap}
+\usepackage{upquote}
+\usepackage{testidx}
+\usepackage[colorlinks,
+            bookmarks,
+            hyperindex=false,
+            pdfauthor={Nicola L.C. Talbot},
+            pdftitle={testidx.sty: dummy text for testing indexes},
+            pdfkeywords={LaTeX,package,dummy text}]{hyperref}
+
+
+\IndexPrologue{\section*{\indexname}
+ \addcontentsline{toc}{section}{\indexname}%
+ \markboth{\indexname}{\indexname}}
+
+\setcounter{IndexColumns}{2}
+
+\renewcommand*{\main}[1]{\hyperpage{#1}}
+\renewcommand*{\usage}[1]{\hyperpage{#1}}
+
+\begin{document}
+
+ \title{testidx.sty v1.0: 
+dummy text for testing indexes}
+ \author{Nicola L.C. Talbot\\[10pt]
+\url{http://www.dickimaw-books.com/}}
+
+ \date{2016-10-17}
+ \maketitle
+ \tableofcontents
+
+ \section{Introduction}
+ \label{sec:intro}
+
+The \styfmt{testidx} package is for testing indexes (\cs{index},
+\env{theindex} and indexing applications, such as \app{makeindex}
+and \app{xindy}).
+As with packages like \sty{lipsum} and \sty{blindtext}, this package
+provides dummy text, but it's interspersed with \cs{index} commands.
+The filler text is English not lorum ipsum, as this makes it
+slightly easier to check the words in the index against the words in
+the document. (For those who don't understand English, it's at least
+no worse than lorum ipsum.)
+
+Example document:
+\begin{verbatim}
+\documentclass{article}
+
+\usepackage{makeidx}
+\usepackage{testidx}
+
+\makeindex
+
+\begin{document}
+\testidx
+\printindex
+\end{document}
+\end{verbatim}
+
+If the document is called, say, \texttt{myDoc.tex}, then
+the PDF can be built using:
+\begin{verbatim}
+pdflatex myDoc
+makeindex myDoc.idx
+pdflatex myDoc
+\end{verbatim}
+
+\begin{important}
+There will be warnings about multiple encaps. This is intentional
+to test how the indexing applications deal with this problem.
+\end{important}
+
+If you want to use \app{xindy}, you'll need to define the 
+attributes (encaps) used in the dummy text. For example:
+\begin{verbatim}
+\documentclass{article}
+
+\usepackage{filecontents}
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+\usepackage{makeidx}
+\usepackage{testidx}
+
+\begin{filecontents*}{\jobname.xdy}
+; list of allowed attributes
+
+(define-attributes ((
+  "tstidxencapi"
+  "tstidxencapii"
+  "tstidxencapiii"
+)))
+
+; define format to use for locations
+
+(markup-locref :open "\tstidxencapi{"
+ :close "}"
+ :attr "tstidxencapi")
+
+(markup-locref :open "\tstidxencapii{"
+ :close "}"
+ :attr "tstidxencapii")
+
+(markup-locref :open "\tstidxencapiii{"
+ :close "}"
+ :attr "tstidxencapiii")
+
+(markup-locref-list :sep ",")
+(markup-range :sep "--")
+\end{filecontents*}
+
+\makeindex
+
+\begin{document}
+\testidx
+
+\printindex
+\end{document}
+\end{verbatim}
+
+If this document is called, say, \texttt{myDoc.tex} then the 
+build process is:
+\begin{verbatim}
+pdflatex myDoc
+xindy -L english -C utf8 -M myDoc.xdy -M texindy -t myDoc.ilg myDoc.idx
+pdflatex myDoc
+\end{verbatim}
+You can substitute \texttt{english} for another language (for
+example, \texttt{swedish} or \texttt{danish}) to test how the
+extended Latin characters are sorted for a particular language.
+
+\XeLaTeX\ can be used instead:
+\begin{verbatim}
+\documentclass{article}
+
+\usepackage{filecontents}
+\usepackage{fontspec}
+\usepackage{makeidx}
+\usepackage{testidx}
+
+\begin{filecontents*}{\jobname.xdy}
+; list of allowed attributes
+
+(define-attributes ((
+  "tstidxencapi"
+  "tstidxencapii"
+  "tstidxencapiii"
+)))
+
+; define format to use for locations
+
+(markup-locref :open "\tstidxencapi{"
+ :close "}"
+ :attr "tstidxencapi")
+
+(markup-locref :open "\tstidxencapii{"
+ :close "}"
+ :attr "tstidxencapii")
+
+(markup-locref :open "\tstidxencapiii{"
+ :close "}"
+ :attr "tstidxencapiii")
+
+(markup-locref-list :sep ",")
+(markup-range :sep "--")
+\end{filecontents*}
+
+\makeindex
+
+\begin{document}
+\testidx
+
+\printindex
+\end{document}
+
+\end{verbatim}
+The build process is now:
+\begin{verbatim}
+xelatex myDoc
+xindy -L english -C utf8 -M myDoc.xdy -M texindy -t myDoc.ilg myDoc.idx
+xelatex myDoc
+\end{verbatim}
+(Similarly for \LuaLaTeX.)
+
+If you want to use \app{makeindex}'s \texttt{-g} option (German)
+you can use the package option \pkgopt{german} or \pkgopt{ngerman},
+which will change the \app{makeindex} quote character to 
+\texttt{+} but remember you need to add this to a style file.
+For example:
+\begin{verbatim}
+\documentclass{article}
+
+\usepackage{filecontents}
+\usepackage{makeidx}
+\usepackage{ngerman}
+\usepackage[german]{testidx}
+
+\begin{filecontents*}{\jobname.ist}
+quote '+'
+\end{filecontents*}
+
+\makeindex
+
+\begin{document}
+\testidx
+
+\printindex
+\end{document}
+\end{verbatim}
+This document can be built using:
+\begin{verbatim}
+pdflatex myDoc
+makeindex -g -s myDoc.sty myDoc.idx
+pdflatex myDoc
+\end{verbatim}
+(Note the different position of the \qt{Numbers} group
+in the index.)
+
+Alternatively:
+\begin{verbatim}
+\documentclass[ngerman]{article}
+
+\usepackage{filecontents}
+\usepackage{makeidx}
+\usepackage{babel}
+\usepackage{testidx}
+
+\begin{filecontents*}{\jobname.ist}
+quote '+'
+\end{filecontents*}
+
+\makeindex
+
+\begin{document}
+\testidx
+
+\printindex
+\end{document}
+\end{verbatim}
+
+\section{Package Options}
+\label{sec:pkgopt}
+
+The following package options are provided:
+\begin{description}
+\item[\pkgopt{german} or \pkgopt{ngerman}]
+This redefines the indexing \qt{quote} character to use \texttt{+}
+instead of the double-quote character. Remember to add this
+to your style file and call \app{makeindex} with the
+\texttt{-g} (German) switch. (See example above in 
+the previous section.) This option may also be implemented
+using
+\begin{definition}[\DescribeMacro\testidxGermanOn]
+\cs{testidxGermanOn}
+\end{definition}
+
+\item[\pkgopt{nogerman}]
+Counteract the effect of the previous option.
+This option may also be implemented using
+\begin{definition}[\DescribeMacro\testidxGermanOff]
+\cs{testidxGermanOff}
+\end{definition}
+
+\item[\pkgopt{stripaccents}]
+Strips accent commands from the sort key when using the
+ASCII option (see \sectionref{sec:exlatin}).
+This option may also be implemented using
+\begin{definition}[\DescribeMacro\testidxStripAccents]
+\cs{testidxStripAccents}
+\end{definition}
+Note that the \pkgopt{german} or \pkgopt{ngerman} package option
+won't strip the umlaut accent when used with this option.
+
+\item[\pkgopt{nostripaccents}]
+Doesn't strip accent commands from the sort key when using the
+ASCII option (see \sectionref{sec:exlatin}).
+This option may also be implemented using
+\begin{definition}[\DescribeMacro\testidxNoStripAccents]
+\cs{testidxNoStripAccents}
+\end{definition}
+
+\item[\pkgopt{sanitize}]
+Sanitize the terms before indexing them when using
+the UTF-8 option to prevent the UTF-8 characters from being
+expanded to \sty{inputenc}'s internal macros such as \cs{IeC}.
+This option is the default unless \XeLaTeX\ or \LuaLaTeX\ 
+are in use.
+This option may also be implemented using
+\begin{definition}[\DescribeMacro\testidxSanitizeOn]
+\cs{testidxSanitizeOn}
+\end{definition}
+
+\item[\pkgopt{nosanitize}]
+Don't sanitize the terms before indexing them when using
+the UTF-8 option.
+This option may also be implemented using
+\begin{definition}[\DescribeMacro\testidxSanitizeOff]
+\cs{testidxSanitizeOff}
+\end{definition}
+
+\item[\pkgopt{showmarks}]
+(Default.) Show the location of the \cs{index} commands
+in the dummy text with markers.
+This option may also be implemented using
+\begin{definition}[\DescribeMacro\testidxshowmarkstrue]
+\cs{testidxshowmarkstrue}
+\end{definition}
+
+\item[\pkgopt{hidemarks} or \pkgopt{noshowmarks}]
+Hide the markers.
+This option may also be implemented using
+\begin{definition}[\DescribeMacro\testidxshowmarksfalse]
+\cs{testidxshowmarksfalse}
+\end{definition}
+
+\item[\pkgopt{verbose}]
+Show the actual indexing commands within the dummy text.
+This will most likely cause a high number of overfull lines.
+This option may also be implemented using
+\begin{definition}[\DescribeMacro\testidxverbosetrue]
+\cs{testidxverbosetrue}
+\end{definition}
+
+\item[\pkgopt{noverbose}]
+(Default.) Cancel the \pkgopt{verbose} option.
+This option may also be implemented using
+\begin{definition}[\DescribeMacro\testidxverbosefalse]
+\cs{testidxverbosefalse}
+\end{definition}
+
+\item[\pkgopt{notestencaps}]
+Suppress the testing of the encaps. Note that this only affects
+the commands used within \ics{testidx}, which have an optional
+argument to specify the encap. Some of these commands have the
+default value of the optional argument set to one of the test
+encaps. This option changes the command definition so that the
+optional argument is blank. Therefore this setting can only
+be used as a package option. However, this doesn't prevent
+you from explicitly testing an encap either directly using
+\ics{index} (e.g.\ \verb"\index{word|emph}") or implicitly
+using one of the helper commands described in the documented
+code (e.g.\ \verb"\tstidxsty[emph]{testidx}").
+
+\item[\pkgopt{testencaps}]
+(Default.) Cancels the \pkgopt{notestencaps} option. 
+This option ensures that \ics{testidx} uses the three test 
+encaps.
+\end{description}
+
+\section{Basic Commands}
+\label{sec:basic}
+
+This section only covers the basic commands provided by 
+\styfmt{testidx}. For more advanced commands, see the documented
+code.
+
+\begin{definition}[\DescribeMacro\testidx]
+\cs{testidx}\oarg{blocks}
+\end{definition}
+This is the principle command provided by this package. It
+generates the predefined dummy text that's interspersed 
+with indexing commands. There are \number\tstidxmaxblocks\ 
+blocks in total. This number can be accessed through the register:
+\begin{definition}[\DescribeMacro\tstidxmaxblocks]
+\cs{tstidxmaxblocks}
+\end{definition}
+
+If the optional argument \oarg{blocks} is omitted, all the blocks
+will be used. Each block starts with a number identifying it.
+This number prefix is formatted using:
+\begin{definition}[\DescribeMacro\tstidxprefixblock]
+\cs{tstidxprefixblock}\marg{n}
+\end{definition}
+where \meta{n} is the block number. If you want to suppress the
+number prefix, just redefine this command to ignore its argument.
+
+By default, the blocks are separated by a paragraph break.
+If the starred form is used, the blocks are separated by a~space.
+Note that some of the blocks contain paragraph breaks for
+displayed material. The starred form won't eliminate
+paragraph breaks \emph{within} the blocks, just those
+used as separators between the blocks.
+
+The intention of the dummy text is to provide an index that should
+typically span at least three pages for A4 or letter paper,
+to allow testing of headers and footers across a double-paged
+spread. Some of the indexing commands intentionally cause
+warnings from \app{makeindex} to test for certain situations.
+Phrases are indexed as well as just individual words to 
+increase the chances of indexed terms spanning a page
+break. However, the page dimensions, fonts and other material in the
+document will obviously alter where the page breaks occur.
+
+You can display only a subset of the blocks using the optional
+argument, which may be a comma-separated list of block identifiers
+or hyphen-separated range. Note that some of the blocks contain the
+start or end of an indexing range. If you only display a subset
+of the blocks that contains any of these, you need to make
+sure that you include the blocks that contain matching open
+and closing ranges (unless you're testing for mis-matched ranges).
+
+The optional argument may be a mixture of individual block
+identifiers and ranges. Examples:
+\begin{enumerate}
+\item Just display block~6:
+\begin{verbatim}
+\testidx[6]
+\end{verbatim}
+\item Display blocks~4 to 6:
+\begin{verbatim}
+\testidx[4-6]
+\end{verbatim}
+\item Display blocks~1, 4 to 6, and the last block:
+\begin{verbatim}
+\testidx[1,4-6,\tstidxmaxblocks]
+\end{verbatim}
+\item Intersperse the blocks with sections:
+\begin{verbatim}
+\section{Sample}
+\testidx[1-6]
+\section{Another Sample}
+\testidx[7-\tstidxmaxblocks]
+\end{verbatim}
+\end{enumerate}
+
+If for some bizarre and wacky reason you want the blocks
+in the reverse order, you can do so. For example:
+\begin{verbatim}
+\testidx[\tstidxmaxblocks-1]
+\end{verbatim}
+However the open and close range formations are likely to
+confuse \app{makeindex}\slash\app{xindy}, but perhaps that's
+your intention. Just remember to stay within the range
+1--\cs{tstidxmaxblocks} as you'll get an error if you
+go out of those bounds.
+
+The actual indexing is performed using:
+\begin{definition}[\DescribeMacro\tstindex]
+\cs{tstindex}\marg{text}
+\end{definition}
+This defaults to just \cs{index}\marg{text} but may be redefined. For
+example, if you are testing multiple indexes, you can
+redefine \cs{tstindex} to use a specific index.
+
+The dummy text includes markers to identify where the instances
+of \cs{tstindex} have been used. To reduce the possibility of
+package conflict, \styfmt{testidx} loads a bare minimum of
+packages\footnote{only \sty{color}, \sty{ifxetex} and
+\sty{ifluatex} are loaded}
+and tries to rely as much as possible on \LaTeX\ kernel
+commands, so the markers are fairly primitive. If you prefer
+fancier markers, you can change them by redefining the
+commands listed below. Multiple markers in the dummy text
+indicate multiple instances of \cs{tstindex} without any
+intervening text.
+
+\begin{definition}[\DescribeMacro\tstidxmarker]
+\cs{tstidxmarker}
+\end{definition}
+This is the marker used to show an instance of \cs{tstindex}
+for a top-level entry that doesn't start or end a range.
+Default: \tstidxmarker
+
+\begin{definition}[\DescribeMacro\tstidxopenmarker]
+\cs{tstidxopenmarker}
+\end{definition}
+This is the marker used to show an instance of \cs{tstindex}
+for a top-level entry that starts a range.
+Default: \tstidxopenmarker
+
+\begin{definition}[\DescribeMacro\tstidxclosemarker]
+\cs{tstidxclosemarker}
+\end{definition}
+This is the marker used to show an instance of \cs{tstindex}
+for a top-level entry that ends a range.
+Default: \tstidxclosemarker
+
+\begin{definition}[\DescribeMacro\tstidxsubmarker]
+\cs{tstidxsubmarker}
+\end{definition}
+This is the marker used to show an instance of \cs{tstindex}
+for a sub-entry that doesn't start or end a range.
+Default: \tstidxsubmarker
+
+\begin{definition}[\DescribeMacro\tstidxopensubmarker]
+\cs{tstidxopensubmarker}
+\end{definition}
+This is the marker used to show an instance of \cs{tstindex}
+for a sub-entry that starts a range.
+Default: \tstidxopensubmarker
+
+\begin{definition}[\DescribeMacro\tstidxclosesubmarker]
+\cs{tstidxclosesubmarker}
+\end{definition}
+This is the marker used to show an instance of \cs{tstindex}
+for a sub-entry that ends a range.
+Default: \tstidxclosesubmarker
+
+\begin{definition}[\DescribeMacro\tstidxsubsubmarker]
+\cs{tstidxsubsubmarker}
+\end{definition}
+This is the marker used to show an instance of \cs{tstindex}
+for a sub-sub-entry that doesn't start or end a range.
+Default: \tstidxsubsubmarker
+
+\begin{definition}[\DescribeMacro\tstidxopensubsubmarker]
+\cs{tstidxopensubsubmarker}
+\end{definition}
+This is the marker used to show an instance of \cs{tstindex}
+for a sub-sub-entry that starts a range.
+Default: \tstidxopensubsubmarker
+
+\begin{definition}[\DescribeMacro\tstidxclosesubsubmarker]
+\cs{tstidxclosesubsubmarker}
+\end{definition}
+This is the marker used to show an instance of \cs{tstindex}
+for a sub-sub-entry that ends a range.
+Default: \tstidxclosesubsubmarker
+
+\begin{definition}[\DescribeMacro\tstidxseemarker]
+\cs{tstidxseemarker}
+\end{definition}
+This is the marker used to show an instance of \cs{tstindex}
+that uses a cross-reference. Additionally, the cross-referenced
+information will appear in a marginal note.
+Default: \tstidxseemarker
+
+\begin{definition}[\DescribeMacro\tstidxsubseemarker]
+\cs{tstidxsubseemarker}
+\end{definition}
+This is the marker used to show an instance of \cs{tstindex}
+that uses a cross-reference in a sub-entry.
+Default: \tstidxsubseemarker\ (the sub-level and cross-reference
+markers superimposed, not to be confused with a sub-level marker
+followed by a cross-reference marker, which indicates
+consecutive occurrences of \cs{tstindex}).
+As above the cross-reference information appears in a marginal 
+note. The main term and the sub-entry term are separated with
+the symbol given by
+\begin{definition}[\DescribeMacro\tstidxsubseesep]
+\cs{tstidxsubseesep}
+\end{definition}
+which defaults to \tstidxsubseesep
+
+There are three encap values used:
+\begin{definition}[\DescribeMacro\tstidxencapi]
+\cs{tstidxencapi}\marg{location}
+\end{definition}
+\begin{definition}[\DescribeMacro\tstidxencapii]
+\cs{tstidxencapii}\marg{location}
+\end{definition}
+\begin{definition}[\DescribeMacro\tstidxencapiii]
+\cs{tstidxencapiii}\marg{location}
+\end{definition}
+By default these just set \meta{location} in a different
+text colour.
+
+If you are using \app{xindy}, you'll need to add these
+to a \texttt{.xdy} file that can be loaded using \app{xindy}'s
+\texttt{-M} switch. For example, include the following
+in your \texttt{.xdy} file:
+\begin{verbatim}
+; list of allowed attributes
+
+(define-attributes ((
+  "tstidxencapi"
+  "tstidxencapii"
+  "tstidxencapiii"
+)))
+
+; define format to use for locations
+
+(markup-locref :open "\tstidxencapi{"
+ :close "}"
+ :attr "tstidxencapi")
+
+(markup-locref :open "\tstidxencapii{"
+ :close "}"
+ :attr "tstidxencapii")
+
+(markup-locref :open "\tstidxencapiii{"
+ :close "}"
+ :attr "tstidxencapiii")
+\end{verbatim}
+You may also want to add the list and range separators, if you
+haven't already done so:
+\begin{verbatim}
+(markup-locref-list :sep ",")
+(markup-range :sep "--")
+\end{verbatim}
+
+The \cs{tstindex} command is sometimes placed before the term
+or phrase being indexed and sometimes afterwards. To clarify
+what's being indexed, the adjacent word or phrase is surrounded
+by
+\begin{definition}[\DescribeMacro\tstidxtext]
+\cs{tstidxtext}\marg{text}
+\end{definition}
+This defaults to using a dark grey text colour. If an
+encap has been used, the corresponding encap command (see
+above) is included within the argument of \cs{tstidxtext}:
+\begin{definition}
+\cs{tstidxtext}\{\meta{cs}\marg{text}\}
+\end{definition}
+where \meta{cs} is the encap command. This means that with
+the default definitions, the dark grey text colour will
+only be visible when there's no encap, as the encap command
+will override the colour change.
+
+Note that the marker is included within \meta{text}.
+Some of the examples have consecutive uses of
+\cs{tstindex}, such as a top-level entry followed
+by a sub-entry. For example, a person's name is indexed twice:
+\begin{verbatim}
+Donald Knuth\index{Knuth, Donald}\index{people!Knuth, Donald}
+\end{verbatim}
+(It's actually done using \verb|\tstidxperson{Donald}{Knuth}|
+for better consistency. These markup commands typically
+won't need changing, but if they do, see the documented code
+for further detail.)
+
+Example:
+\begin{verbatim}
+\renewcommand*{\tstindex}[1]{}
+\textsf{\testidx[1,\tstidxmaxblocks]}
+\end{verbatim}
+produces the two paragraphs (first and last blocks) shown below:
+
+\medskip\par
+\renewcommand*{\tstindex}[1]{}
+\textsf{\testidx[1,\tstidxmaxblocks]}
+\par\medskip
+
+Note that I've redefined \cs{tstindex} to ignore its argument
+in this document so those terms won't actually be indexed 
+in this case. The block references (such as \qt{block~1})
+in the dummy text don't use the standard 
+\cs{label}\slash\cs{ref} mechanism as the references must still 
+work even if the referenced block has been omitted. This
+means they won't have hyperlinks even if you include the
+\sty{hyperref} package as the target may not be defined.
+They are provided primarily so you can easily find out which
+blocks need adding if you're only using a subset and need to
+close a range.
+
+\section{Indexing Special Characters}
+\label{sec:idxspchars}
+
+If you need to change the indexing special characters, you
+can redefine the commands listed in this section. Remember
+that you will also need to make the relevant changes to your
+indexing style file.
+
+\begin{definition}[\DescribeMacro\tstidxquote]
+\cs{tstidxquote}
+\end{definition}
+The \qt{quote} character. The default is: \texttt{\tstidxquote}.
+Note that the \pkgopt{german} or \pkgopt{ngerman} package option
+will automatically redefine \cs{tstidxquote} to \texttt{+}
+(plus).
+
+\begin{definition}[\DescribeMacro\tstidxactual]
+\cs{tstidxactual}
+\end{definition}
+The \qt{actual} character. The default is: \texttt{\tstidxactual}.
+
+\begin{definition}[\DescribeMacro\tstidxlevel]
+\cs{tstidxlevel}
+\end{definition}
+The \qt{level} character. The default is: \texttt{\tstidxlevel}.
+
+\begin{definition}[\DescribeMacro\tstidxencap]
+\cs{tstidxencap}
+\end{definition}
+The \qt{encap} character. The default is: \texttt{\tstidxencap}.
+
+\begin{definition}[\DescribeMacro\tstidxopenrange]
+\cs{tstidxopenrange}
+\end{definition}
+The \qt{open range} character. The default is:
+\texttt{\tstidxopenrange}.
+
+\begin{definition}[\DescribeMacro\tstidxcloserange]
+\cs{tstidxcloserange}
+\end{definition}
+The \qt{close range} character. The default is:
+\texttt{\tstidxcloserange}.
+
+\section{Extended Latin Characters}
+\label{sec:exlatin}
+
+The dummy text includes words or phrases that have extended
+Latin characters. There are two modes:
+
+\begin{description}
+\item[ASCII] This mode is on \emph{unless} you are using
+\XeLaTeX\ or \LuaLaTeX, or the document has loaded 
+\sty{inputenc} with the encoding set to \pkgopt{utf8}.
+
+Example that will switch on ASCII mode:
+\begin{verbatim}
+\documentclass{article}
+
+\usepackage[latin1]{inputenc}
+\usepackage{makeidx}
+\usepackage{testidx}
+
+\makeindex
+
+\begin{document}
+\testidx
+
+\printindex
+\end{document}
+\end{verbatim}
+
+\item[UTF-8] This mode is on \emph{if} you are using
+\XeLaTeX\ or \LuaLaTeX, or if the document has loaded 
+\sty{inputenc} with the encoding set to \pkgopt{utf8}.
+
+Example that will switch on UTF-8 mode:
+\begin{verbatim}
+\documentclass{article}
+
+\usepackage{fontspec}
+\usepackage{makeidx}
+\usepackage{testidx}
+
+\makeindex
+
+\begin{document}
+\testidx
+
+\printindex
+\end{document}
+\end{verbatim}
+Or
+\begin{verbatim}
+\documentclass{article}
+
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+\usepackage{makeidx}
+\usepackage{testidx}
+
+\makeindex
+
+\begin{document}
+\testidx
+
+\printindex
+\end{document}
+\end{verbatim}
+
+\end{description}
+
+When the ASCII mode is on, words or phrases with UTF-8
+characters use the standard \LaTeX\ accent commands, such
+as \cs{'} (acute accent) or \cs{o} (\o). There are two
+package options that determine whether or not to include these
+commands in the sort key: \pkgopt{stripaccents} will remove
+the accent commands (except for the umlaut shortcut \verb|"|
+if the \pkgopt{german} or \pkgopt{ngerman} package option has been
+used), and \pkgopt{nostripaccents} will keep the accent commands
+in the sort key.
+
+For example, with the ASCII mode on with the \pkgopt{stripaccents}
+option, \qt{Anders Jonas \AA ngstr\"om} is indexed as
+\begin{verbatim}
+Angstrom, Anders Jonas@\AA ngstr\""om, Anders Jonas
+\end{verbatim}
+unless the \pkgopt{german} or \pkgopt{ngerman} option is on,
+in which case it's indexed as
+\begin{verbatim}
+Angstr"om, Anders Jonas@\AA ngstr"om, Anders Jonas
+\end{verbatim}
+Whereas with the \pkgopt{nostripaccents} option, this name is
+indexed as
+\begin{verbatim}
+\r Angstr\""om, Anders Jonas@\AA ngstr\""om, Anders Jonas
+\end{verbatim}
+unless the \pkgopt{german} or \pkgopt{ngerman} option is
+on, in which case it's indexed as
+\begin{verbatim}
+\r Angstr"om, Anders Jonas@\AA ngstr"om, Anders Jonas
+\end{verbatim}
+
+When the UTF-8 mode is on, UTF-8 characters are used instead.
+For example, \qt{Anders Jonas \AA ngstr\"om} is indexed
+as
+\begin{flushleft}\ttfamily
+\AA ngstr\"om, Anders Jonas
+\end{flushleft}
+(The \pkgopt{stripaccents} and \pkgopt{nostripaccents} options 
+are ignored.)
+
+\XeLaTeX\ and \LuaLaTeX\ both natively support UTF-8, so
+when either of those engines are in use, the UTF-8 characters 
+will be written to the indexing file as they are. So the above
+example will appear in the \texttt{.idx} file as:
+\begin{flushleft}\ttfamily
+\cs{indexentry}\{\AA ngstr\"om, Anders Jonas\}\marg{location}
+\end{flushleft}
+Regular \LaTeX\ requires the \sty{inputenc} package to support
+UTF-8 characters, but each UTF-8 character is treated as
+two tokens (the first and second octets) where the first token is an
+active character that takes the second token as the argument.
+This means that expansion will occur when writing these
+active characters to an external file. This means that the
+above will appear in the \texttt{.idx} file as:
+\begin{verbatim}
+\indexentry{\IeC {\r A}ngstr\IeC {\"o}m, Anders Jonas}{3}
+\end{verbatim}
+(where 3 is the page number).
+
+Since this can confuse the indexing application,
+\styfmt{testidx} provides a \pkgopt{sanitize} package option
+which will first sanitize the UTF-8 characters before
+indexing them. This option is on by default for regular \LaTeX\ and
+off for \XeLaTeX\ and \LuaLaTeX. You can switch it off
+using the \pkgopt{nosanitize} package option.
+
+Whether it should be on or off really depends on what you want
+to test. For example, if you want to test how an indexing 
+application deals with UTF-8 characters, then switch it on, but
+if you want to test how your indexing command (whatever 
+\cs{tstindex} is defined as) behaves with these characters, then 
+switch it off.
+
+Note that this \pkgopt{sanitize} option isn't adjusting the
+definition of \cs{index} or \cs{tstindex}, but is essentially
+pretending that the user is doing something like:
+\begin{flushleft}\ttfamily\obeylines
+\cs{makeatletter}
+Anders Jonas \AA ngstr\"om\%
+\cs{def}\cs{tmp}\{\AA ngstr\"om, Anders Jonas\}\%
+\cs{@onelevel at sanitize}\cs{tmp}
+\cs{exandafter}\cs{index}\cs{expandafter}\{\cs{tmp}\}\%
+\cs{edef}\cs{tmp}\{people\cs{tstidxlevel}\cs{tmp}\}\%
+\cs{exandafter}\cs{index}\cs{expandafter}\{\cs{tmp}\}\%
+\end{flushleft}
+instead of simulating:
+\begin{flushleft}\ttfamily\obeylines
+Anders Jonas \AA ngstr\"om\%
+\cs{tstindex}\{\AA ngstr\"om, Anders Jonas\}\%
+\cs{tstindex}\{people\tstidxlevel\AA ngstr\"om, Anders Jonas\}\%
+\end{flushleft}
+
+Note that the sanitization isn't applied to the entire argument
+of \cs{tstindex}, but only selected parts of it.
+
+\PrintIndex
+
+\end{document}


Property changes on: trunk/Master/texmf-dist/doc/latex/testidx/testidx-manual.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/testidx/testidx.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/testidx/testidx.dtx	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/testidx/testidx.dtx	2016-10-17 21:25:14 UTC (rev 42294)
@@ -0,0 +1,4132 @@
+%\iffalse
+% testidx.dtx generated using makedtx version 1.1 (c) Nicola Talbot
+% Command line args:
+%   -src "testidx.sty\Z=>testidx.sty"
+%   -doc "testidx-codedoc.tex"
+%   -author "Nicola Talbot"
+%   -codetitle "Main Package Code"
+%   testidx
+% Created on 2016/10/17 12:32
+%\fi
+%\iffalse
+%<*package>
+%% \CharacterTable
+%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%%   Digits        \0\1\2\3\4\5\6\7\8\9
+%%   Exclamation   \!     Double quote  \"     Hash (number) \#
+%%   Dollar        \$     Percent       \%     Ampersand     \&
+%%   Acute accent  \'     Left paren    \(     Right paren   \)
+%%   Asterisk      \*     Plus          \+     Comma         \,
+%%   Minus         \-     Point         \.     Solidus       \/
+%%   Colon         \:     Semicolon     \;     Less than     \<
+%%   Equals        \=     Greater than  \>     Question mark \?
+%%   Commercial at \@     Left bracket  \[     Backslash     \\
+%%   Right bracket \]     Circumflex    \^     Underscore    \_
+%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
+%%   Right brace   \}     Tilde         \~}
+%</package>
+%\fi
+% \iffalse
+% Doc-Source file to use with LaTeX2e
+% Copyright (C) 2016 Nicola Talbot, all rights reserved.
+% \fi
+% \iffalse
+%<*driver>
+\documentclass{nlctdoc}
+
+\iffalse
+testidx-codedoc.tex is a stub file used by makedtx to create
+testidx.dtx
+\fi
+
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage[colorlinks,
+            bookmarks,
+            hyperindex=false,
+            pdfauthor={Nicola L.C. Talbot},
+            pdftitle={testidx.sty: Documented code}]{hyperref}
+
+\RecordChanges
+
+\renewcommand*{\main}[1]{\hyperpage{#1}}
+
+\setcounter{IndexColumns}{2}
+
+\CheckSum{4724}
+
+\begin{document}
+\DocInput{testidx.dtx}
+\end{document}
+%</driver>
+%\fi
+%\MakeShortVerb{"}
+%\DeleteShortVerb{\|}
+%
+% \title{Documented Code For testidx v1.0}
+% \author{Nicola L.C. Talbot\\[10pt]
+%Dickimaw Books\\
+%\url{http://www.dickimaw-books.com/}}
+%
+% \date{2016-10-17}
+% \maketitle
+%
+%\tableofcontents
+%
+%\section{Introduction}
+%
+%This is the documented code for the \styfmt{testidx} package.
+%See \texttt{testidx-manual.pdf} for the main user guide.
+%
+%
+%\StopEventually{%
+%  \phantomsection
+%  \addcontentsline{toc}{section}{Change History}%
+%  \raggedright
+%  \PrintChanges
+%  \PrintIndex
+%}
+%
+%
+%
+%\section{Main Package Code}
+%\iffalse
+%    \begin{macrocode}
+%<*testidx.sty>
+%    \end{macrocode}
+%\fi
+%\section{Initialisation}
+%    \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{testidx}[2016/10/17 v1.0 (NLCT)]
+%    \end{macrocode}
+%To avoid as much conflict as possible, this package loads the
+%bare minimum, so I'm not using useful packages like \styfmt{etoolbox} or
+%\styfmt{pgffor}. Just load a few necessities:
+%    \begin{macrocode}
+\RequirePackage{color}
+%    \end{macrocode}
+%Need to know if we have UTF-8 support:
+%    \begin{macrocode}
+\RequirePackage{ifxetex}
+\RequirePackage{ifluatex}
+%    \end{macrocode}
+%\begin{macro}{\@tstidx at ifutfviii}
+%    \begin{macrocode}
+\newcommand*{\@tstidx at ifutfviii}[2]{%
+  \ifxetex
+   #1%
+  \else
+   \ifluatex
+     #1%
+   \else
+     \@ifundefined{inputencodingname}{#2}%
+     {\ifx\inputencodingname\@tstidx at utfviii#1\else#2\fi}%
+   \fi
+  \fi
+}
+\newcommand*{\@tstidx at utfviii}{utf8}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxprocessasciisort}
+%The first argument is a control sequence in which to store the
+%processed sort string.
+%    \begin{macrocode}
+\newcommand*{\tstidxprocessasciisort}{\tstidxprocessasciisortstrip}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\testidxStripAccents}
+%    \begin{macrocode}
+\newcommand*{\testidxStripAccents}{%
+  \renewcommand*{\tstidxprocessasciisort}{\tstidxprocessasciisortstrip}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\testidxNoStripAccents}
+%    \begin{macrocode}
+\newcommand*{\testidxNoStripAccents}{%
+  \renewcommand*{\tstidxprocessasciisort}{\tstidxprocessasciisortnostrip}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%Option to strip accents from sort key (non-UTF-8).
+%    \begin{macrocode}
+\DeclareOption{stripaccents}{\testidxStripAccents}
+%    \end{macrocode}
+%
+%Leave the accent commands in the sort key (non-UTF-8).
+%    \begin{macrocode}
+\DeclareOption{nostripaccents}{\testidxNoStripAccents}
+%    \end{macrocode}
+%
+%\begin{macro}{\tstidxquote}
+%Quote character.
+%    \begin{macrocode}
+\newcommand{\tstidxquote}{\string"}
+%    \end{macrocode}
+%\end{macro}
+%This is going to cause a problem for the umlauts if we're not using
+%UTF-8, so provide a command to protect the double-quote:
+%\begin{macro}{\tstidxumlaut}
+%    \begin{macrocode}
+\newcommand*{\tstidxumlaut}{%
+  \expandafter\@gobble\string\\\tstidxquote\string"}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxsortumlaut}
+%    \begin{macrocode}
+\newcommand*{\tstidxsortumlaut}{%
+  \expandafter\@gobble\string\\\tstidxquote\string"}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxsortumlautstrip}
+%    \begin{macrocode}
+\newcommand*{\tstidxsortumlautstrip}{\@firstofone}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\testidxGermanOn}
+%Switch German option on.
+%    \begin{macrocode}
+\newcommand*{\testidxGermanOn}{%
+  \let\@tstidx at ifgerman\@firstoftwo
+  \renewcommand{\tstidxquote}{+}%
+  \renewcommand*{\tstidxumlaut}{\string"}%
+  \renewcommand*{\tstidxsortumlautstrip}{\string"}%
+  \renewcommand*{\tstidxsortumlaut}{\string"}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\testidxGermanOff}
+%Switch German option off.
+%    \begin{macrocode}
+\newcommand*{\testidxGermanOff}{%
+  \let\@tstidx at ifgerman\@secondoftwo
+  \renewcommand{\tstidxquote}{\string"}%
+  \renewcommand*{\tstidxumlaut}{%
+  \expandafter\@gobble\string\\\tstidxquote\string"}%
+  \renewcommand*{\tstidxsortumlautstrip}{\@firstofone}%
+  \renewcommand*{\tstidxsortumlaut}{%
+    \expandafter\@gobble\string\\\tstidxquote\string"}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@tstidx at ifgerman}
+%    \begin{macrocode}
+\newcommand*{\@tstidx at ifgerman}[2]{#2}
+%    \end{macrocode}
+%\end{macro}
+%User may want to run \app{makeindex} with the \texttt{-g} switch,
+%so provide \pkgopt{german} option that will accommodate this.
+%    \begin{macrocode}
+\DeclareOption{german}{\testidxGermanOn}
+%    \end{macrocode}
+%Also allow \pkgopt{ngerman} to do the same:
+%    \begin{macrocode}
+\DeclareOption{ngerman}{\testidxGermanOn}
+%    \end{macrocode}
+%Provide an option to counter-act this:
+%    \begin{macrocode}
+\DeclareOption{nogerman}{\testidxGermanOff}
+%    \end{macrocode}
+%
+%
+%\begin{macro}{\tstidxprocessutf}
+%How to deal with UTF-8 words.
+%    \begin{macrocode}
+\ifxetex
+  \newcommand*{\tstidxprocessutf}{%
+    \tstidxprocessutfnosanitize
+  }
+\else
+ \ifluatex
+   \newcommand*{\tstidxprocessutf}{%
+     \tstidxprocessutfnosanitize
+   }
+ \else
+   \newcommand*{\tstidxprocessutf}{%
+     \tstidxprocessutfsanitize
+   }
+ \fi
+\fi
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@tstidx at ifsanitize}
+%    \begin{macrocode}
+\newcommand*{\@tstidx at ifsanitize}[2]{#1}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\testidxSanitizeOn}
+%Switch the \pkgopt{sanitize} option on.
+%    \begin{macrocode}
+\newcommand*{\testidxSanitizeOn}{%
+   \let\@tstidx at ifsanitize\@firstoftwo
+   \renewcommand*{\tstidxprocessutf}{%
+     \tstidxprocessutfsanitize
+   }%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\testidxSanitizeOff}
+%Switch the \pkgopt{sanitize} option off.
+%    \begin{macrocode}
+\newcommand*{\testidxSanitizeOff}{%
+   \let\@tstidx at ifsanitize\@secondoftwo
+   \renewcommand*{\tstidxprocessutf}{%
+     \tstidxprocessutfnosanitize
+   }%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%Option to switch on the UTF-8 sanitization (irrespective of engine):
+%    \begin{macrocode}
+\DeclareOption{sanitize}{\testidxSanitizeOn}
+%    \end{macrocode}
+%
+%Option to switch off the UTF-8 sanitization (irrespective of engine):
+%    \begin{macrocode}
+\DeclareOption{nosanitize}{\testidxSanitizeOff}
+%    \end{macrocode}
+%
+%Option to show the actual indexing argument.
+%\begin{macro}{\iftestidxverbose}
+%    \begin{macrocode}
+\newif\iftestidxverbose
+\testidxverbosefalse
+\DeclareOption{verbose}{\testidxverbosetrue}
+\DeclareOption{noverbose}{\testidxverbosefalse}
+%    \end{macrocode}
+%\end{macro}
+%
+%Option to hide the markers.
+%\begin{macro}{\iftestidxshowmarks}
+%    \begin{macrocode}
+\newif\iftestidxshowmarks
+\testidxshowmarkstrue
+\DeclareOption{showmarks}{\testidxshowmarkstrue}
+\DeclareOption{noshowmarks}{\testidxshowmarksfalse}
+\DeclareOption{hidemarks}{\testidxshowmarksfalse}
+%    \end{macrocode}
+%\end{macro}
+%
+%Option to skip the test encaps.
+%\begin{macro}{\if at tstidx@use at encaps}
+%    \begin{macrocode}
+\newif\if at tstidx@use at encaps
+\@tstidx at use@encapstrue
+\DeclareOption{testencaps}{\@tstidx at use@encapstrue}
+\DeclareOption{notestencaps}{\@tstidx at use@encapsfalse}
+%    \end{macrocode}
+%\end{macro}
+%
+%Process options:
+%    \begin{macrocode}
+\ProcessOptions
+%    \end{macrocode}
+%Find out if various packages have been loaded.
+%\begin{macro}{\@tstidx at ifamsmath}
+%    \begin{macrocode}
+\AtBeginDocument{%
+  \@ifpackageloaded{amsmath}%
+  {\let\@tstidx at ifamsmath\@firstoftwo}%
+  {\let\@tstidx at ifamsmath\@secondoftwo}%
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@tstidx at ifinputenc}
+%    \begin{macrocode}
+  \@ifpackageloaded{inputenc}
+  {
+    \let\@tstidx at if@inputenc\@firstoftwo
+  }%
+  {%
+    \ifxetex
+      \let\@tstidx at if@inputenc\@firstoftwo
+    \else
+      \ifluatex
+        \let\@tstidx at if@inputenc\@firstoftwo
+      \else
+        \let\@tstidx at if@inputenc\@secondoftwo
+      \fi
+    \fi
+  }%
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@tstidx at if@notOT at ne}
+% Some of the accent commands don't work with the default OT1
+% encoding, so provide a convenient test.
+%    \begin{macrocode}
+  \ifxetex
+    \let\@tstidx at if@notOT at ne\@firstoftwo
+  \else
+    \ifluatex
+      \let\@tstidx at if@notOT at ne\@firstoftwo
+    \else
+      \newcommand*{\@tstidx at OT@ne}{OT1}%
+      \edef\@tstidx at enc{\encodingdefault}%
+      \ifx\@tstidx at OT@ne\@tstidx at enc
+        \let\@tstidx at if@notOT at ne\@secondoftwo
+      \else
+        \let\@tstidx at if@notOT at ne\@firstoftwo
+      \fi
+    \fi
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%\section{Markup Commands}
+% String is used in case any of these characters have been made
+% active.
+%\begin{macro}{\tstidxactual}
+%Actual character.
+%    \begin{macrocode}
+\newcommand{\tstidxactual}{\string @}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxlevel}
+%Level character.
+%    \begin{macrocode}
+\newcommand{\tstidxlevel}{\string!}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxencap}
+%Encap character.
+%    \begin{macrocode}
+\newcommand{\tstidxencap}{\string|}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxopenrange}
+%Start range character.
+%    \begin{macrocode}
+\newcommand{\tstidxopenrange}{\string(}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxcloserange}
+%End range character.
+%    \begin{macrocode}
+\newcommand{\tstidxcloserange}{\string)}
+%    \end{macrocode}
+%\end{macro}
+%Some of the examples use words with extended Latin characters.
+%Provide a way of simulating the user explicitly writing, for
+%example, \verb|\index{\""Angelholm}|.
+%\begin{macro}{\tstidxprocessascii}
+%The first argument is a control sequence in which to store the
+%processed string.
+%    \begin{macrocode}
+\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 at xdef#1{#2}%
+  }%
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxprocessasciisortnostrip}
+%    \begin{macrocode}
+\newcommand*{\tstidxprocessasciisortnostrip}[2]{%
+  {%
+    \let\"\tstidxsortumlaut
+    \protected at xdef#1{#2}%
+  }%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxprocessasciisortstrip}
+%    \begin{macrocode}
+\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 at xdef#1{#2}%
+  }%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxprocessutfsanitize}
+%Sanitize UTF-8 strings.
+%    \begin{macrocode}
+\newcommand*{\tstidxprocessutfsanitize}[2]{%
+  \def#1{#2}%
+  \@onelevel at sanitize#1%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxprocessutfnosanitize}
+%Don't sanitize UTF-8 strings.
+%    \begin{macrocode}
+\newcommand*{\tstidxprocessutfnosanitize}[2]{%
+  \def#1{#2}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%
+%\begin{macro}{\tstidxencaptext}
+% Wrap text in the command corresponding to the given encap.
+%    \begin{macrocode}
+\newcommand*{\tstidxencaptext}[2]{%
+  \@ifundefined{#1}%
+  {%
+    \PackageError{testidx}{Encap value `#1' doesn't correspond
+    to a known command}{}%
+  }%
+  {%
+    \csname#1\endcsname{#2}%
+  }%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxtext}
+%Identify text next to the index command. This will also be wrapped
+%around the encap value if supplied.
+%    \begin{macrocode}
+\newcommand*{\tstidxtext}[1]{\textcolor[gray]{0.3}{#1}}
+%    \end{macrocode}
+%\end{macro}
+%
+%Provide three different encap values for testing:
+%\begin{macro}{\tstidxencapi}
+%    \begin{macrocode}
+\newcommand*{\tstidxencapi}[1]{\textcolor{blue}{#1}}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxencapii}
+%    \begin{macrocode}
+\newcommand*{\tstidxencapii}[1]{\textcolor{cyan}{#1}}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxencapiii}
+%    \begin{macrocode}
+\newcommand*{\tstidxencapiii}[1]{\textcolor{magenta}{#1}}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxensuretext}
+%Ensure in text mode.
+%    \begin{macrocode}
+\newcommand*{\tstidxensuretext}[1]{%
+ \ifmmode
+  \@tstidx at ifamsmath{\text{#1}}{\mbox{#1}}%
+ \else
+  #1%
+ \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%Markers to show where the \cs{index} commands are used.
+%Preferable to have markers that adjust to font size, and only use
+%commands provided by \LaTeX\ kernel to reduce package requirements.
+%\begin{macro}{\tstidxmarker}
+%No range or cross-reference. I initially used
+%\cs{textperiodcentered} for the marker, but some fonts make it a
+%bit too spacey for this purpose.
+%    \begin{macrocode}
+\newcommand*{\tstidxmarker}{%
+ \tstidxensuretext{\raisebox{.65ex}{.}}%
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxsubmarker}
+%Sub-entry.
+%    \begin{macrocode}
+\newcommand*{\tstidxsubmarker}{%
+ \tstidxensuretext{\strut\smash{\raisebox{-1.5ex}{\v{}}}}%
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxsubsubmarker}
+%Sub-sub-entry.
+%    \begin{macrocode}
+\newcommand*{\tstidxsubsubmarker}{%
+ \tstidxensuretext{\strut\makebox[0pt][l]{\smash{\raisebox{-1ex}{\v{}}}}%
+ \smash{\raisebox{-1.5ex}{\v{}}}}%
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxopenmarker}
+%Start of a range.
+%    \begin{macrocode}
+\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}%
+ }%
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxclosemarker}
+%End of a range.
+%    \begin{macrocode}
+\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}%
+ }%
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxopensubmarker}
+%Start of a range for sub-entries.
+%    \begin{macrocode}
+\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}%
+ }%
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxclosesubmarker}
+%End of a range for sub-entries.
+%    \begin{macrocode}
+\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}%
+ }%
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxopensubsubmarker}
+%Start of a range for sub-sub-entries.
+%    \begin{macrocode}
+\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}%
+ }%
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxclosesubsubmarker}
+%End of a range for sub-sub-entries.
+%    \begin{macrocode}
+\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}%
+ }%
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxseemarker}
+%Cross-reference.
+%    \begin{macrocode}
+\newcommand*{\tstidxseemarker}{\^{}}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxseeref}
+%Cross-references are identified with the marker and with a marginal
+%note with the term being indexed and the argument of the \qt{see} encap.
+%    \begin{macrocode}
+\newcommand*{\tstidxseeref}[3]{\tstidxseemarker
+ \marginpar{\strut\raggedright\footnotesize
+   \normalcolor\tstidxseemarker#1, \csname#2\endcsname{#3}{}}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxsubseemarker}
+%Cross-reference.
+%    \begin{macrocode}
+\newcommand*{\tstidxsubseemarker}{%
+ \tstidxensuretext{\makebox[0pt][l]{\tstidxsubmarker}%
+ \tstidxseemarker}%
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxsubseeref}
+%Cross-references are identified with the marker and with a marginal
+%note with the term being indexed and the argument of the \qt{see} encap.
+%    \begin{macrocode}
+\newcommand*{\tstidxsubseeref}[4]{\tstidxsubseemarker
+ \marginpar{\strut\raggedright\footnotesize
+   \normalcolor\tstidxsubseemarker#1\tstidxsubseesep#2, \csname#3\endcsname{#4}{}}%
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxsubseesep}
+%Separator used in the above.
+%    \begin{macrocode}
+\newcommand*{\tstidxsubseesep}{\,$\triangleright$\,}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstindex}
+% Allow user to change \cs{index} to something else. For example,
+% add an optional argument if multiple indexes are present.
+%    \begin{macrocode}
+\newcommand*{\tstindex}{\index}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@tstindex}
+%    \begin{macrocode}
+\newcommand*{\@tstindex}[1]{%
+  \iftestidxverbose
+   \def\@tstindex at arg{#1}%
+   \@onelevel at sanitize\@tstindex at arg
+   \testidxverbosefmt{\@tstindex at arg}%
+  \fi
+  \tstindex{#1}%
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\testidxverbosefmt}
+%    \begin{macrocode}
+\newcommand*{\testidxverbosefmt}[1]{%
+  \expandafter\def\expandafter\@tstidx at tmp\expandafter{\tstindex}%
+  \@onelevel at sanitize\@tstidx at tmp
+  \tstidxensuretext{%
+    \discretionary{}{}{}%
+    {\footnotesize\texttt{\@tstidx at tmp
+     \expandafter\@gobble\string\{#1\expandafter\@gobble\string\}}}%
+    \discretionary{}{}{}%
+  }%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxqt}
+%Nothing to do with indexing, but just provides semantic markup for
+%quotes.
+%    \begin{macrocode}
+\newcommand*{\tstidxqt}[1]{``#1''}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxdash}
+%    \begin{macrocode}
+\newcommand*{\tstidxdash}{\,---\,}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxfootnote}
+%    \begin{macrocode}
+\newcommand*{\tstidxfootnote}{\footnote}
+%    \end{macrocode}
+%\end{macro}
+%
+%\section{Convenience Commands}
+%These commands are provided for conveniently marking various
+%aspects of the dummy text.
+%\begin{macro}{\tstidxfmtpost}
+%\begin{definition}
+%\cs{tstidxfmtpost}\marg{text}\marg{fmt cs}\marg{encap}
+%\end{definition}
+%Index an entry that needs a formatting command.
+%    \begin{macrocode}
+\newcommand*{\tstidxfmtpost}[3]{%
+  \tstindexpost[#1]{\protect#2{#1}}{#3}{#2{#1}}%
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxfmtopenpost}
+%\begin{definition}
+%\cs{tstidxfmtopenpost}\marg{text}\marg{fmt cs}\marg{encap}
+%\end{definition}
+%Index an entry that needs a formatting command.
+%    \begin{macrocode}
+\newcommand*{\tstidxfmtopenpost}[3]{%
+  \tstindexopenpost[#1]{\protect#2{#1}}{#3}{#2{#1}}%
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxfmtclosepost}
+%\begin{definition}
+%\cs{tstidxfmtclosepost}\marg{text}\marg{fmt cs}\marg{encap}
+%\end{definition}
+%Index an entry that needs a formatting command.
+%    \begin{macrocode}
+\newcommand*{\tstidxfmtclosepost}[3]{%
+  \tstindexclosepost[#1]{\protect#2{#1}}{#3}{#2{#1}}%
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxfmtpre}
+%\begin{definition}
+%\cs{tstidxfmtpre}\marg{text}\marg{fmt cs}\marg{encap}
+%\end{definition}
+%Index an entry that needs a formatting command.
+%    \begin{macrocode}
+\newcommand*{\tstidxfmtpre}[3]{%
+  \tstindexpre[#1]{\protect#2{#1}}{#3}{#2{#1}}%
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxfmtopenpre}
+%\begin{definition}
+%\cs{tstidxfmtopenpre}\marg{text}\marg{fmt cs}\marg{encap}
+%\end{definition}
+%Index an entry that needs a formatting command.
+%    \begin{macrocode}
+\newcommand*{\tstidxfmtopenpre}[3]{%
+  \tstindexopenpre[#1]{\protect#2{#1}}{#3}{#2{#1}}%
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxfmtclosepre}
+%\begin{definition}
+%\cs{tstidxfmtclosepre}\marg{text}\marg{fmt cs}\marg{encap}
+%\end{definition}
+%Index an entry that needs a formatting command.
+%    \begin{macrocode}
+\newcommand*{\tstidxfmtclosepre}[3]{%
+  \tstindexclosepre[#1]{\protect#2{#1}}{#3}{#2{#1}}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxutf}
+%\begin{definition}
+%\cs{tstidxutf}\marg{display}\marg{ascii}\marg{utf8}\marg{encap}\marg{idx cs}
+%\end{definition}
+%Index a word with UTF-8 characters.
+%    \begin{macrocode}
+\newcommand*{\tstidxutf}[5]{%
+  \def\@tstidx at text{#1}%
+  \@tstidx at ifutfviii
+  {%
+    \ifx\@tstidx at text\@empty
+      \def\@tstidx at text{#3}%
+    \fi
+    \tstidxprocessutf{\@tstidx at utf}{#3}%
+    \protected at edef\@tstidx at doidx{%
+      \noexpand#5{\unexpanded\expandafter{\@tstidx at utf}}{#4}%
+        {\@tstidx at text}%
+    }%
+  }%
+  {%
+    \ifx\@tstidx at text\@empty
+      \def\@tstidx at text{#2}%
+    \fi
+    \tstidxprocessascii{\@tstidx at ascii}{#2}%
+    \tstidxprocessasciisort{\@tstidx at asciisort}{#2}%
+    \protected at edef\@tstidx at doidx{%
+      \noexpand#5[\unexpanded\expandafter{\@tstidx at asciisort}]%
+        {\unexpanded\expandafter{\@tstidx at ascii}}{#4}%
+        {\@tstidx at text}%
+    }%
+  }%
+  \@tstidx at doidx
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxsubutf}
+%\begin{definition}
+%\cs{tstidxsubutf}\marg{display}\marg{ascii}\marg{utf8}\marg{sub-ascii}\marg{sub-utf8}\marg{encap}\marg{idx cs}
+%\end{definition}
+%First level sub-entry.
+%    \begin{macrocode}
+\newcommand*{\tstidxsubutf}[7]{%
+  \def\@tstidx at text{#1}%
+  \@tstidx at ifutfviii
+  {%
+    \ifx\@tstidx at text\@empty
+      \def\@tstidx at text{#3}%
+    \fi
+    \tstidxprocessutf{\@tstidx at utf}{#3}%
+    \tstidxprocessutf{\@tstidx at subutf}{#5}%
+    \protected at edef\@tstidx at doidx{%
+      \noexpand#7{\unexpanded\expandafter{\@tstidx at utf}}%
+        {\unexpanded\expandafter{\@tstidx at subutf}}%
+        {#6}%
+        {\@tstidx at text}%
+    }%
+  }%
+  {%
+    \ifx\@tstidx at text\@empty
+      \def\@tstidx at text{#2}%
+    \fi
+    \tstidxprocessascii{\@tstidx at ascii}{#2}%
+    \tstidxprocessasciisort{\@tstidx at asciisort}{#2}%
+    \tstidxprocessascii{\@tstidx at subascii}{#4}%
+    \tstidxprocessasciisort{\@tstidx at subasciisort}{#4}%
+    \protected at edef\@tstidx at doidx{%
+      \noexpand#7[\unexpanded\expandafter{\@tstidx at asciisort}]%
+        {\unexpanded\expandafter{\@tstidx at ascii}}%
+        [\unexpanded\expandafter{\@tstidx at subasciisort}]%
+        {\unexpanded\expandafter{\@tstidx at subascii}}%
+        {#6}%
+        {\@tstidx at text}%
+    }%
+  }%
+  \@tstidx at doidx
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxutfpost}
+%\begin{definition}
+%\cs{tstidxutfpost}\oarg{display}\marg{ascii}\marg{utf8}\marg{encap}
+%\end{definition}
+%Index a word with UTF-8 characters.
+%    \begin{macrocode}
+\newcommand*{\tstidxutfpost}[4][]{%
+  \tstidxutf{#1}{#2}{#3}{#4}{\tstindexpost}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxutfopenpost}
+%\begin{definition}
+%\cs{tstidxutfopenpost}\oarg{display}\marg{ascii}\marg{utf8}\marg{encap}
+%\end{definition}
+%Index a word with UTF-8 characters.
+%    \begin{macrocode}
+\newcommand*{\tstidxutfopenpost}[4][]{%
+  \tstidxutf{#1}{#2}{#3}{#4}{\tstindexopenpost}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxutfclosepost}
+%\begin{definition}
+%\cs{tstidxutfclosepost}\oarg{display}\marg{ascii}\marg{utf8}\marg{encap}
+%\end{definition}
+%Index a word with UTF-8 characters.
+%    \begin{macrocode}
+\newcommand*{\tstidxutfclosepost}[4][]{%
+  \tstidxutf{#1}{#2}{#3}{#4}{\tstindexclosepost}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxutfpre}
+%\begin{definition}
+%\cs{tstidxutfpre}\oarg{display}\marg{ascii}\marg{utf8}\marg{encap}
+%\end{definition}
+%Index a word with UTF-8 characters.
+%    \begin{macrocode}
+\newcommand*{\tstidxutfpre}[4][]{%
+  \tstidxutf{#1}{#2}{#3}{#4}{\tstindexpre}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxutfopenpre}
+%\begin{definition}
+%\cs{tstidxutfopenpre}\oarg{display}\marg{ascii}\marg{utf8}\marg{encap}
+%\end{definition}
+%Index a word with UTF-8 characters.
+%    \begin{macrocode}
+\newcommand*{\tstidxutfopenpre}[4][]{%
+  \tstidxutf{#1}{#2}{#3}{#4}{\tstindexopenpre}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxutfclosepre}
+%\begin{definition}
+%\cs{tstidxutfclosepre}\oarg{display}\marg{ascii}\marg{utf8}\marg{encap}
+%\end{definition}
+%Index a word with UTF-8 characters.
+%    \begin{macrocode}
+\newcommand*{\tstidxutfclosepre}[4][]{%
+  \tstidxutf{#1}{#2}{#3}{#4}{\tstindexclosepre}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxutfsubpost}
+%\begin{definition}
+%\cs{tstidxutfsubpost}\oarg{display}\marg{ascii}\marg{utf8}\marg{sub-ascii}\marg{sub-utf8}\marg{encap}
+%\end{definition}
+%Sub-entry.
+%    \begin{macrocode}
+\newcommand*{\tstidxutfsubpost}[6][]{%
+  \tstidxsubutf{#1}{#2}{#3}{#4}{#5}{#6}{\tstsubindexpost}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxutfsubopenpost}
+%\begin{definition}
+%\cs{tstidxutfsubopenpost}\oarg{display}\marg{ascii}\marg{utf8}\marg{sub-ascii}\marg{sub-utf8}\marg{encap}
+%\end{definition}
+%Sub-entry.
+%    \begin{macrocode}
+\newcommand*{\tstidxutfsubopenpost}[6][]{%
+  \tstidxsubutf{#1}{#2}{#3}{#4}{#5}{#6}{\tstsubindexopenpost}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxutfsubclosepost}
+%\begin{definition}
+%\cs{tstidxutfsubclosepost}\oarg{display}\marg{ascii}\marg{utf8}\marg{sub-ascii}\marg{sub-utf8}\marg{encap}
+%\end{definition}
+%Sub-entry.
+%    \begin{macrocode}
+\newcommand*{\tstidxutfsubclosepost}[6][]{%
+  \tstidxsubutf{#1}{#2}{#3}{#4}{#5}{#6}{\tstsubindexclosepost}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxutfsubpre}
+%\begin{definition}
+%\cs{tstidxutfsubpre}\oarg{display}\marg{ascii}\marg{utf8}\marg{sub-ascii}\marg{sub-utf8}\marg{encap}
+%\end{definition}
+%Sub-entry.
+%    \begin{macrocode}
+\newcommand*{\tstidxutfsubpre}[6][]{%
+  \tstidxsubutf{#1}{#2}{#3}{#4}{#5}{#6}{\tstsubindexpre}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxutfsubopenpre}
+%\begin{definition}
+%\cs{tstidxutfsubopenpre}\oarg{display}\marg{ascii}\marg{utf8}\marg{sub-ascii}\marg{sub-utf8}\marg{encap}
+%\end{definition}
+%Sub-entry.
+%    \begin{macrocode}
+\newcommand*{\tstidxutfsubopenpre}[6][]{%
+  \tstidxsubutf{#1}{#2}{#3}{#4}{#5}{#6}{\tstsubindexopenpre}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxutfsubclosepre}
+%\begin{definition}
+%\cs{tstidxutfsubclosepre}\oarg{display}\marg{ascii}\marg{utf8}\marg{sub-ascii}\marg{sub-utf8}\marg{encap}
+%\end{definition}
+%Sub-entry.
+%    \begin{macrocode}
+\newcommand*{\tstidxutfsubclosepre}[6][]{%
+  \tstidxsubutf{#1}{#2}{#3}{#4}{#5}{#6}{\tstsubindexclosepre}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxcsfmt}
+% Display a control sequence.
+%    \begin{macrocode}
+\newcommand*{\tstidxcsfmt}[1]{\texttt{\char`\\#1}}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxcs}
+% Display and index a control sequence. The optional argument is the encap
+%    \begin{macrocode}
+\if at tstidx@use at encaps
+ \newcommand*{\tstidxcs}[2][tstidxencapi]{%
+   \tstidxfmtpost{#2}{\tstidxcsfmt}{#1}%
+ }
+\else
+ \newcommand*{\tstidxcs}[2][]{%
+   \tstidxfmtpost{#2}{\tstidxcsfmt}{#1}%
+ }
+\fi
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxopencs}
+%As above but starts a range.
+%    \begin{macrocode}
+\if at tstidx@use at encaps
+  \newcommand*{\tstidxopencs}[2][tstidxencapi]{%
+    \tstidxfmtopenpost{#2}{\tstidxcsfmt}{#1}%
+  }
+\else
+  \newcommand*{\tstidxopencs}[2][]{%
+    \tstidxfmtopenpost{#2}{\tstidxcsfmt}{#1}%
+  }
+\fi
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxclosecs}
+%As above but ends a range.
+%    \begin{macrocode}
+\if at tstidx@use at encaps
+  \newcommand*{\tstidxclosecs}[2][tstidxencapi]{%
+    \tstidxfmtclosepost{#2}{\tstidxcsfmt}{#1}%
+  }
+\else
+  \newcommand*{\tstidxclosecs}[2][]{%
+    \tstidxfmtclosepost{#2}{\tstidxcsfmt}{#1}%
+  }
+\fi
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxencapcsn}
+% Display and index a control sequence name (without the initial
+% backslash). The optional argument is the encap
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxopencsn}
+%As above but starts a range.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxclosecsn}
+%As above but ends a range.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxenvfmt}
+% Display an environment name.
+%    \begin{macrocode}
+\newcommand*{\tstidxenvfmt}[1]{\texttt{#1}}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxenv}
+% Display and index an environment name.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxopenenv}
+%As above but starts a range.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxcloseenv}
+%As above but ends a range.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxappfmt}
+% Display an application name.
+%    \begin{macrocode}
+\newcommand*{\tstidxappfmt}[1]{\texttt{#1}}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxapp}
+% Display and index an application name.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxopenapp}
+%As above but starts a range.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxcloseapp}
+%As above but ends a range.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxappoptfmt}
+% Display an application option.
+%    \begin{macrocode}
+\newcommand*{\tstidxappoptfmt}[1]{\texttt{#1}}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxappopt}
+% Display and index an application option.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxopenappopt}
+% As above but start a range.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxcloseappopt}
+% As above but end a range.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxstyfmt}
+% Display a package name.
+%    \begin{macrocode}
+\newcommand*{\tstidxstyfmt}[1]{\texttt{#1}}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxsty}
+% Display and index a package name.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxopensty}
+%As above but starts a range.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxclosesty}
+%As above but ends a range.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxstyoptfmt}
+% Display a package option.
+%    \begin{macrocode}
+\newcommand*{\tstidxstyoptfmt}[1]{\texttt{#1}}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxstyopt}
+% Display and index a package option.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxopenstyopt}
+% As above but start a range.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxclosestyopt}
+% As above but end a range.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxword}
+% Display and index a word.
+%    \begin{macrocode}
+\newcommand*{\tstidxword}[2][]{%
+  \tstindexpost{#2}{#1}{#2}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxopenword}
+% As above but starts a range.
+%    \begin{macrocode}
+\newcommand*{\tstidxopenword}[2][]{%
+  \tstindexopenpost{#2}{#1}{#2}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxcloseword}
+% As above but ends a range.
+%    \begin{macrocode}
+\newcommand*{\tstidxcloseword}[2][]{%
+  \tstindexclosepost{#2}{#1}{#2}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxsubword}
+%\begin{definition}
+%\cs{tstidxsubword}\oarg{encap}\marg{main-entry}\marg{word}
+%\end{definition}
+% Display and index a word as a sub-entry.
+%    \begin{macrocode}
+\newcommand*{\tstidxsubword}[3][]{%
+  \tstsubindexpost{#2}{#3}{#1}{#3}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxnumber}
+% Display and index a word.
+%    \begin{macrocode}
+\if at tstidx@use at encaps
+  \newcommand*{\tstidxnumber}[2][tstidxencapiii]{%
+    \tstindexpost{#2}{#1}{#2}%
+  }
+\else
+  \newcommand*{\tstidxnumber}[2][]{%
+    \tstindexpost{#2}{#1}{#2}%
+  }
+\fi
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxphrase}
+% Display and index a phrase.
+%    \begin{macrocode}
+\newcommand*{\tstidxphrase}[2][]{%
+  \tstindexpre{#2}{#1}{#2}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxopenphrase}
+% As above but starts a range.
+%    \begin{macrocode}
+\newcommand*{\tstidxopenphrase}[2][]{%
+  \tstindexopenpre{#2}{#1}{#2}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxclosephrase}
+% As above but ends a range.
+%    \begin{macrocode}
+\newcommand*{\tstidxclosephrase}[2][]{%
+  \tstindexclosepre{#2}{#1}{#2}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxartphrase}
+%\begin{definition}
+%\cs{tstidxartphrase}\oarg{encap}\marg{article}\marg{remainder}
+%\end{definition}
+% Display and index a phrase that starts with (in)definite
+% article.
+%    \begin{macrocode}
+\newcommand*{\tstidxartphrase}[3][]{%
+  \tstindexpost{#3, #2}{#1}{#2 #3}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxopenartphrase}
+%As above but starts a range.
+%    \begin{macrocode}
+\newcommand*{\tstidxopenartphrase}[3][]{%
+  \tstindexopenpost{#3, #2}{#1}{#2 #3}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxcloseartphrase}
+%As above but ends a range.
+%    \begin{macrocode}
+\newcommand*{\tstidxcloseartphrase}[3][]{%
+  \tstindexclosepost{#3, #2}{#1}{#2 #3}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxperson}
+% Display and index a person's name.
+%    \begin{macrocode}
+\newcommand*{\tstidxperson}[3][]{%
+  \tstidxutfperson[#1]{#2}{#3}{#2}{#3}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxopenperson}
+% As above but starts a range.
+%    \begin{macrocode}
+\newcommand*{\tstidxopenperson}[3][]{%
+  \tstidxutfopenperson[#1]{#2}{#3}{#2}{#3}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxcloseperson}
+% As above but ends a range.
+%    \begin{macrocode}
+\newcommand*{\tstidxcloseperson}[3][]{%
+  \tstidxutfcloseperson[#1]{#2}{#3}{#2}{#3}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxutfperson}
+%\begin{definition}
+%\cs{tstidxutfperson}\oarg{encap}\marg{ascii forename}\marg{ascii surname}\marg{utf8 forname}{utf8 surname}
+%\end{definition}
+% Display and index a person's name with UTF-8 characters.
+%    \begin{macrocode}
+\newcommand*{\tstidxutfperson}[5][]{%
+  \@tstidx at 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}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxopenutfperson}
+% As above but starts a range.
+%    \begin{macrocode}
+\newcommand*{\tstidxutfopenperson}[5][]{%
+  \@tstidx at ifutfviii
+  {%
+    \tstidxutfopenpost[#4 #5]{#3, #2}{#5, #4}{#1}%
+  }%
+  {%
+    \tstidxutfopenpost[#2 #3]{#3, #2}{#5, #4}{#1}%
+  }%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxcloseutfperson}
+% As above but ends a range.
+%    \begin{macrocode}
+\newcommand*{\tstidxutfcloseperson}[7][]{%
+  \@tstidx at ifutfviii
+  {%
+    \tstidxutfclosepost[#4 #5]{#3, #2}{#5, #4}{#1}%
+  }%
+  {%
+    \tstidxutfclosepost[#2 #3]{#3, #2}{#5, #4}{#1}%
+  }%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxsym}
+%\begin{definition}
+%\cs{tstidxsym}\oarg{encap}\marg{sort}\marg{indexed symbol}
+%\end{definition}
+% Display and index a symbol.
+%    \begin{macrocode}
+\newcommand*{\tstidxsym}[3][]{%
+  \tstindexpost[#2]{\protect#3}{#1}{#3}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxopensym}
+%\begin{definition}
+%\cs{tstidxopensym}\oarg{encap}\marg{sort}\marg{indexed symbol}
+%\end{definition}
+% As above but starts a range.
+%    \begin{macrocode}
+\newcommand*{\tstidxopensym}[3][]{%
+  \tstindexopenpost[#2]{\protect#3}{#1}{#3}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxclosesym}
+%\begin{definition}
+%\cs{tstidxclosesym}\oarg{encap}\marg{sort}\marg{indexed symbol}
+%\end{definition}
+% As above but ends a range.
+%    \begin{macrocode}
+\newcommand*{\tstidxclosesym}[3][]{%
+  \tstindexopenpost[#2]{\protect#3}{#1}{#3}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxindexmarker}
+%    \begin{macrocode}
+\newcommand{\tstidxindexmarker}[1]{%
+ \tstidxsym{\tstidxindexmarkerprefix#1}{\csname#1\endcsname
+   \protect\space (\protect\tstidxcsfmt{#1})}% 
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxindexmarkerprefix}
+%    \begin{macrocode}
+\newcommand*{\tstidxindexmarkerprefix}{<}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxmath}
+%\begin{definition}
+%\cs{tstidxmath}\oarg{encap}\marg{sort}\marg{entry}
+%\end{definition}
+% Display and index something in maths-mode.
+%    \begin{macrocode}
+\if at tstidx@use at encaps
+  \newcommand*{\tstidxmath}[3][tstidxencapii]{%
+    \tstindexpre[#2]{$#3$}{#1}{#3}%
+  }
+\else
+  \newcommand*{\tstidxmath}[3][]{%
+    \tstindexpre[#2]{$#3$}{#1}{#3}%
+  }
+\fi
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxmathsym}
+%\begin{definition}
+%\cs{tstidxmathsym}\oarg{encap}\marg{sort}\marg{entry}
+%\end{definition}
+%Inserts a prefix before \meta{sort}.
+%    \begin{macrocode}
+\if at tstidx@use at encaps
+  \newcommand*{\tstidxmathsym}[3][tstidxencapii]{%
+    \tstidxmath[#1]{\tstidxmathsymprefix#2}{#3}%
+  }
+\else
+  \newcommand*{\tstidxmathsym}[3][]{%
+    \tstidxmath[#1]{\tstidxmathsymprefix#2}{#3}%
+  }
+\fi
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\tstidxmathsymprefix}
+%    \begin{macrocode}
+\newcommand*{\tstidxmathsymprefix}{>}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxutfword}
+%\begin{definition}
+%\cs{tstidxutfword}\oarg{encap}\marg{ascii}\marg{utf8}
+%\end{definition}
+% Display and index a word with UTF-8 characters.
+%    \begin{macrocode}
+\newcommand*{\tstidxutfword}[3][]{%
+  \tstidxutfpost{#2}{#3}{#1}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxopenutf}
+%\begin{definition}
+%\cs{tstidxopenutf}\oarg{encap}\marg{sort}\marg{ascii}\marg{utf8}
+%\end{definition}
+% As above but starts a range.
+%    \begin{macrocode}
+\newcommand*{\tstidxopenutf}[4][]{%
+  \tstidxutfopenpost{#2}{#3}{#1}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxcloseutf}
+%\begin{definition}
+%\cs{tstidxcloseutf}\oarg{encap}\marg{sort}\marg{ascii}\marg{utf8}
+%\end{definition}
+% As above but ends a range.
+%    \begin{macrocode}
+\newcommand*{\tstidxcloseutf}[4][]{%
+  \tstidxutfclosepost{#2}{#3}{#1}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxutfphrase}
+%\begin{definition}
+%\cs{tstidxutfphrase}\oarg{encap}\marg{ascii}\marg{utf8}
+%\end{definition}
+% Display and index a phrase with UTF-8 characters.
+%    \begin{macrocode}
+\newcommand*{\tstidxutfphrase}[3][]{%
+  \tstidxutfpre{#2}{#3}{#1}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxopenutfphrase}
+%\begin{definition}
+%\cs{tstidxopenutfphrase}\oarg{encap}\marg{ascii}\marg{utf8}
+%\end{definition}
+% As above but starts a range.
+%    \begin{macrocode}
+\newcommand*{\tstidxopenutfphrase}[3][]{%
+  \tstidxutfopenpre{#2}{#3}{#1}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxcloseutfphrase}
+%\begin{definition}
+%\cs{tstidxcloseutf}\oarg{encap}\marg{ascii}\marg{utf8}
+%\end{definition}
+% As above but ends a range.
+%    \begin{macrocode}
+\newcommand*{\tstidxcloseutfphrase}[3][]{%
+  \tstidxutfclosepre{#2}{#3}{#1}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxplace}
+% Display and index a place name.
+%    \begin{macrocode}
+\newcommand*{\tstidxplace}[2][]{%
+  \tstidxutfplace[#1]{#2}{#2}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxutfplace}
+%\begin{definition}
+%\cs{tstidxutfplace}\oarg{encap}\marg{ascii}\marg{utf8}
+%\end{definition}
+% Display and index a word with UTF-8 characters.
+%    \begin{macrocode}
+\newcommand*{\tstidxutfplace}[3][]{%
+  \tstidxutfpost{#2}{#3}{#1}%
+  \tstidxutfsubpost[\relax]{places}{places}{#2}{#3}{#1}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxartplace}
+% Display and index a place name that starts with an article.
+%    \begin{macrocode}
+\newcommand*{\tstidxartplace}[3][]{%
+  \tstindexpost{#3, #2}{#1}{#2 #3}%
+  \tstidxutfsubpost[\relax]{places}{places}{#3, #2}{#3, #2}{#1}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxbookfmt}
+% Display an book title.
+%    \begin{macrocode}
+\newcommand*{\tstidxbookfmt}[1]{\emph{#1}}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxbook}
+% Display and index a book title.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxopenbook}
+%As above but starts a range.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxclosebook}
+%As above but ends a range.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxartbook}
+%\begin{definition}
+%\cs{tstidxartbook}\oarg{encap}\marg{article}\marg{remainder}
+%\end{definition}
+% Display and index a book title that starts with (in)definite
+% article.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxopenartbook}
+%As above but starts a range.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxcloseartbook}
+%As above but ends a range.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxfilmfmt}
+% Display an film title.
+%    \begin{macrocode}
+\newcommand*{\tstidxfilmfmt}[1]{\emph{#1}}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxfilm}
+% Display and index a film title.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxopenfilm}
+%As above but starts a range.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxclosefilm}
+%As above but ends a range.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxartfilm}
+% As above but the title starts with an article.
+%    \begin{macrocode}
+\if at tstidx@use at 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
+%    \end{macrocode}
+%\end{macro}
+%
+%\section{Generic Indexing Test Commands}
+%\subsection{Top-Level Entries}
+%The \cs{expandafter} stuff here is done to help simulate the user directly
+%using \cs{index}.
+% 
+%\begin{macro}{\tstindexpost}
+%The first argument is the sort, the second argument is the term
+%being indexed and the third argument is the encap. The final
+%argument is text to be displayed before the term is indexed.
+%    \begin{macrocode}
+\newcommand*{\tstindexpost}[4][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+   \def\@tstidx at entry{#2}%
+  \else
+   \toks@{#1}%
+   \edef\@tstidx at entry{\the\toks@\tstidxactual}%
+   \expandafter\def\expandafter\@tstidx at entry\expandafter{\@tstidx at entry#2}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+   \iftestidxshowmarks
+     \tstidxtext{#4\tstidxmarker}%
+   \else
+     #4%
+   \fi
+  \else
+   \iftestidxshowmarks
+     \tstidxtext{\tstidxencaptext{#3}{#4\tstidxmarker}}%
+   \else
+     #4%
+   \fi
+   \expandafter\toks@\expandafter{\@tstidx at entry}%
+   \edef\@tstidx at entry{\the\toks@\tstidxencap#3}%
+  \fi
+  \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstindexopenpost}
+%As previous but starts a range.
+%    \begin{macrocode}
+\newcommand*{\tstindexopenpost}[4][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+   \def\@tstidx at entry{#2}%
+  \else
+   \toks@{#1}%
+   \edef\@tstidx at entry{\the\toks@\tstidxactual}%
+   \expandafter\def\expandafter\@tstidx at entry\expandafter{\@tstidx at entry#2}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+   \iftestidxshowmarks
+     \tstidxtext{#4\tstidxopenmarker}%
+   \else
+     #4%
+   \fi
+   \expandafter\toks@\expandafter{\@tstidx at entry}%
+   \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange}%
+  \else
+   \iftestidxshowmarks
+     \tstidxtext{\tstidxencaptext{#3}{#4\tstidxopenmarker}}%
+   \else
+     #4%
+   \fi
+   \expandafter\toks@\expandafter{\@tstidx at entry}%
+   \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange#3}%
+  \fi
+  \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstindexclosepost}
+%As previous but ends a range.
+%    \begin{macrocode}
+\newcommand*{\tstindexclosepost}[4][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+   \def\@tstidx at entry{#2}%
+  \else
+   \toks@{#1}%
+   \edef\@tstidx at entry{\the\toks@\tstidxactual}%
+   \expandafter\def\expandafter\@tstidx at entry\expandafter{\@tstidx at entry#2}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+   \iftestidxshowmarks
+     \tstidxtext{#4\tstidxclosemarker}%
+   \else
+     #4%
+   \fi
+   \expandafter\toks@\expandafter{\@tstidx at entry}%
+   \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange}%
+  \else
+   \iftestidxshowmarks
+     \tstidxtext{\tstidxencaptext{#3}{#4\tstidxclosemarker}}%
+   \else
+     #4%
+   \fi
+   \expandafter\toks@\expandafter{\@tstidx at entry}%
+   \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange#3}%
+  \fi
+  \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstindexpre}
+%The first argument is the sort, the second argument is the term
+%being indexed and the third argument is the encap. The final
+%argument is text to be displayed after the term is indexed.
+%    \begin{macrocode}
+\newcommand*{\tstindexpre}[4][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+   \def\@tstidx at entry{#2}%
+  \else
+   \toks@{#1}%
+   \edef\@tstidx at entry{\the\toks@\tstidxactual}%
+   \expandafter\def\expandafter\@tstidx at entry\expandafter{\@tstidx at entry#2}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+   \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+   \iftestidxshowmarks
+     \tstidxtext{\tstidxmarker#4}%
+   \else
+     #4%
+   \fi
+  \else
+   \expandafter\toks@\expandafter{\@tstidx at entry}%
+   \edef\@tstidx at entry{\the\toks@\tstidxencap#3}%
+   \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+   \iftestidxshowmarks
+     \tstidxtext{\tstidxencaptext{#3}{\tstidxmarker#4}}%
+   \else
+     #4%
+   \fi
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstindexopenpre}
+%As previous but starts a range.
+%    \begin{macrocode}
+\newcommand*{\tstindexopenpre}[4][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+   \def\@tstidx at entry{#2}%
+  \else
+   \toks@{#1}%
+   \edef\@tstidx at entry{\the\toks@\tstidxactual}%
+   \expandafter\def\expandafter\@tstidx at entry\expandafter{\@tstidx at entry#2}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+   \expandafter\toks@\expandafter{\@tstidx at entry}%
+   \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange}%
+   \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+   \iftestidxshowmarks
+     \tstidxtext{\tstidxopenmarker#4}%
+   \else
+     #4%
+   \fi
+  \else
+   \expandafter\toks@\expandafter{\@tstidx at entry}%
+   \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange#3}%
+   \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+   \iftestidxshowmarks
+     \tstidxtext{\tstidxencaptext{#3}{\tstidxopenmarker#4}}%
+   \else
+     #4%
+   \fi
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstindexclosepre}
+%As previous but ends a range.
+%    \begin{macrocode}
+\newcommand*{\tstindexclosepre}[4][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+   \def\@tstidx at entry{#2}%
+  \else
+   \toks@{#1}%
+   \edef\@tstidx at entry{\the\toks@\tstidxactual}%
+   \expandafter\def\expandafter\@tstidx at entry\expandafter{\@tstidx at entry#2}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+   \expandafter\toks@\expandafter{\@tstidx at entry}%
+   \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange}%
+   \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+   \iftestidxshowmarks
+     \tstidxtext{\tstidxclosemarker#4}%
+   \else
+     #4%
+   \fi
+  \else
+   \expandafter\toks@\expandafter{\@tstidx at entry}%
+   \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange#3}%
+   \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+   \iftestidxshowmarks
+     \tstidxtext{\tstidxencaptext{#3}{\tstidxclosemarker#4}}%
+   \else
+     #4%
+   \fi
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstindexsee}
+%The first argument is the sort, the second argument is the term
+%being indexed, the third argument is the cross-referencing control
+%sequence name (\qt{see} or \qt{seealso}) and the final argument is the
+% cross-referenced text (the first argument of \ics{see} or
+% \ics{seealso}).
+%    \begin{macrocode}
+\newcommand*{\tstindexsee}[4][]{%
+  \def\@tstidx at sort{#1}%
+  \ifx\@tstidx at sort\@empty
+   \def\@tstidx at entry{#2}%
+  \else
+   \toks@{#1}%
+   \edef\@tstidx at entry{\the\toks@\tstidxactual}%
+   \expandafter\def\expandafter\@tstidx at entry\expandafter{\@tstidx at entry#2}%
+  \fi
+  \expandafter\toks@\expandafter{\@tstidx at entry}%
+  \edef\@tstidx at entry{\the\toks@\tstidxencap#3{#4}}%
+  \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \iftestidxshowmarks
+    \tstidxseeref{#2}{#3}{#4}%
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\subsection{Sub-Entries}
+%One sub-level.
+%\begin{macro}{\tstsubindexpost}
+%\begin{definition}
+%\cs{tstsubindexpost}\oarg{main sort}\marg{main term}\oarg{sub
+%sort}\marg{sub term}\marg{encap}\marg{text}
+%\end{definition}
+%    \begin{macrocode}
+\newcommand*{\tstsubindexpost}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subindexpost
+}
+\newcommand*{\@tst at subindexpost}[4][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxsubmarker}%
+    \else
+      #4%
+    \fi
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \else
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxsubmarker}}%
+    \else
+      #4%
+    \fi
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstsubindexopenpost}
+%\begin{definition}
+%\cs{tstsubindexopenpost}\oarg{main sort}\marg{main term}\oarg{sub
+%sort}\marg{sub term}\marg{encap}\marg{text}
+%\end{definition}
+%    \begin{macrocode}
+\newcommand*{\tstsubindexopenpost}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subindexopenpost
+}
+\newcommand*{\@tst at subindexopenpost}[4][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxopensubmarker}%
+    \else
+      #4%
+    \fi
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \else
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxopensubmarker}}%
+    \else
+      #4%
+    \fi
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstsubindexclosepost}
+%\begin{definition}
+%\cs{tstsubindexclosepost}\oarg{main sort}\marg{main term}\oarg{sub
+%sort}\marg{sub term}\marg{encap}\marg{text}
+%\end{definition}
+%    \begin{macrocode}
+\newcommand*{\tstsubindexclosepost}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subindexclosepost
+}
+\newcommand*{\@tst at subindexclosepost}[4][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxclosesubmarker}%
+    \else
+      #4%
+    \fi
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \else
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxclosesubmarker}}%
+    \else
+      #4%
+    \fi
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstsubindexpre}
+%\begin{definition}
+%\cs{tstsubindexpre}\oarg{main sort}\marg{main term}\oarg{sub
+%sort}\marg{sub term}\marg{encap}\marg{text}
+%\end{definition}
+%    \begin{macrocode}
+\newcommand*{\tstsubindexpre}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subindexpre
+}
+\newcommand*{\@tst at subindexpre}[4][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxsubmarker}%
+    \else
+      #4%
+    \fi
+  \else
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxsubmarker}}%
+    \else
+      #4%
+    \fi
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstsubindexopenpre}
+%\begin{definition}
+%\cs{tstsubindexopenpre}\oarg{main sort}\marg{main term}\oarg{sub
+%sort}\marg{sub term}\marg{encap}\marg{text}
+%\end{definition}
+%    \begin{macrocode}
+\newcommand*{\tstsubindexopenpre}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subindexopenpre
+}
+\newcommand*{\@tst at subindexopenpre}[4][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxopensubmarker}%
+    \else
+      #4%
+    \fi
+  \else
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxopensubmarker}}%
+    \else
+      #4%
+    \fi
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstsubindexclosepre}
+%\begin{definition}
+%\cs{tstsubindexclosepre}\oarg{main sort}\marg{main term}\oarg{sub
+%sort}\marg{sub term}\marg{encap}\marg{text}
+%\end{definition}
+%    \begin{macrocode}
+\newcommand*{\tstsubindexclosepre}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subindexclosepre
+}
+\newcommand*{\@tst at subindexclosepre}[4][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxclosesubmarker}%
+    \else
+      #4%
+    \fi
+  \else
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxclosesubmarker}}%
+    \else
+      #4%
+    \fi
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstindexsubsee}
+%\begin{definition}
+%\cs{tstindexsubsee}\oarg{main sort}\marg{main term}\oarg{sub sort}
+%\marg{sub term}\marg{cs name}\marg{text}
+%\end{definition}
+%    \begin{macrocode}
+\newcommand*{\tstindexsubsee}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \ifx\@tstidx at sort\@empty
+   \def\@tstidx at entry{#2}%
+  \else
+   \toks@{#1}%
+   \edef\@tstidx at entry{\the\toks@\tstidxactual}%
+   \expandafter\def\expandafter\@tstidx at entry\expandafter{\@tstidx at entry#2}%
+  \fi
+  \@tstindexsubsee
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@tstindexsubsee}
+%    \begin{macrocode}
+\newcommand*{\@tstindexsubsee}[4][]{%
+  \def\@tstidx at subsort{#1}%
+  \ifx\@tstidx at subsort\@empty
+   \toks@{#2}%
+   \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}%
+     \tstidxlevel\the\toks@}%
+  \else
+   \toks@{#1}%
+   \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}%
+     \tstidxlevel\the\toks@\tstidxactual}%
+   \expandafter\def\expandafter\@tstidx at entry\expandafter{\@tstidx at entry#2}%
+  \fi
+  \expandafter\toks@\expandafter{\@tstidx at entry}%
+  \edef\@tstidx at entry{\the\toks@\tstidxencap#3{#4}}%
+  \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \iftestidxshowmarks
+    \tstidxsubseeref{\@tstidx at term}{#2}{#3}{#4}%
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%
+%Two sub-levels.
+%\begin{macro}{\tstsubsubindexpost}
+%\begin{definition}
+%\cs{tstsubsubindexpost}\oarg{main sort}\marg{main term}\oarg{sub
+%sort}\marg{sub term}\oarg{sub-sub sort}\marg{sub-sub term}\marg{encap}\marg{text}
+%\end{definition}
+%    \begin{macrocode}
+\newcommand*{\tstsubsubindexpost}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subsubindexpost
+}
+\newcommand*{\@tst at subsubindexpost}[2][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \@@tst at subsubindexpost
+}
+\newcommand*{\@@tst at subsubindexpost}[4][]{%
+  \def\@tstidx at subsubsort{#1}%
+  \def\@tstidx at subsubterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at subsubsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxsubsubmarker}%
+    \else
+      #4%
+    \fi
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \else
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxsubsubmarker}}%
+    \else
+      #4%
+    \fi
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstsubsubindexopenpost}
+%\begin{definition}
+%\cs{tstsubsubindexopenpost}\oarg{main sort}\marg{main term}\oarg{sub
+%sort}\marg{sub term}\oarg{sub-sub sort}\marg{sub-sub term}\marg{encap}\marg{text}
+%\end{definition}
+%    \begin{macrocode}
+\newcommand*{\tstsubsubindexopenpost}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subsubindexopenpost
+}
+\newcommand*{\@tst at subsubindexopenpost}[2][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \@@tst at subsubindexopenpost
+}
+\newcommand*{\@@tst at subsubindexopenpost}[4][]{%
+  \def\@tstidx at subsubsort{#1}%
+  \def\@tstidx at subsubterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at subsubsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxopensubmarker}%
+    \else
+      #4%
+    \fi
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \else
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxopensubmarker}}%
+    \else
+      #4%
+    \fi
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstsubsubindexclosepost}
+%\begin{definition}
+%\cs{tstsubsubindexclosepost}\oarg{main sort}\marg{main term}\oarg{sub
+%sort}\marg{sub term}\oarg{sub-sub sort}\marg{sub-sub term}\marg{encap}\marg{text}
+%\end{definition}
+%    \begin{macrocode}
+\newcommand*{\tstsubsubindexclosepost}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subsubindexclosepost
+}
+\newcommand*{\@tst at subsubindexclosepost}[2][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \@@tst at subsubindexclosepost
+}
+\newcommand*{\@@tst at subsubindexclosepost}[4][]{%
+  \def\@tstidx at subsubsort{#1}%
+  \def\@tstidx at subsubterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at subsubsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxclosesubmarker}%
+    \else
+      #4%
+    \fi
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \else
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxclosesubmarker}}%
+    \else
+      #4%
+    \fi
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstsubsubindexpre}
+%\begin{definition}
+%\cs{tstsubsubindexpre}\oarg{main sort}\marg{main term}\oarg{sub
+%sort}\marg{sub term}\oarg{sub-sub sort}\marg{sub-sub term}\marg{encap}\marg{text}
+%\end{definition}
+%    \begin{macrocode}
+\newcommand*{\tstsubsubindexpre}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subsubindexpre
+}
+\newcommand*{\@tst at subsubindexpre}[2][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \@@tst at subsubindexpre
+}
+\newcommand*{\@@tst at subsubindexpre}[4][]{%
+  \def\@tstidx at subsubsort{#1}%
+  \def\@tstidx at subsubterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at subsubsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxsubsubmarker}%
+    \else
+      #4%
+    \fi
+  \else
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxsubsubmarker}}%
+    \else
+      #4%
+    \fi
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstsubsubindexopenpre}
+%\begin{definition}
+%\cs{tstsubsubindexopenpre}\oarg{main sort}\marg{main term}\oarg{sub
+%sort}\marg{sub term}\oarg{sub-sub sort}\marg{sub-sub term}\marg{encap}\marg{text}
+%\end{definition}
+%    \begin{macrocode}
+\newcommand*{\tstsubsubindexopenpre}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subsubindexopenpre
+}
+\newcommand*{\@tst at subsubindexopenpre}[2][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \@@tst at subsubindexopenpre
+}
+\newcommand*{\@@tst at subsubindexopenpre}[4][]{%
+  \def\@tstidx at subsubsort{#1}%
+  \def\@tstidx at subsubterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at subsubsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxopensubmarker}%
+    \else
+      #4%
+    \fi
+  \else
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxopensubmarker}}%
+    \else
+      #4%
+    \fi
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstsubsubindexclosepre}
+%\begin{definition}
+%\cs{tstsubsubindexclosepre}\oarg{main sort}\marg{main term}\oarg{sub
+%sort}\marg{sub term}\oarg{sub-sub sort}\marg{sub-sub term}\marg{encap}\marg{text}
+%\end{definition}
+%    \begin{macrocode}
+\newcommand*{\tstsubsubindexclosepre}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subsubindexclosepre
+}
+\newcommand*{\@tst at subsubindexclosepre}[2][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \@@tst at subsubindexclosepre
+}
+\newcommand*{\@@tst at subsubindexclosepre}[4][]{%
+  \def\@tstidx at subsubsort{#1}%
+  \def\@tstidx at subsubterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at subsubsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxclosesubmarker}%
+    \else
+      #4%
+    \fi
+  \else
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxclosesubmarker}}%
+    \else
+      #4%
+    \fi
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%
+%
+%\section{Filler Text Generator}
+%\begin{macro}{\testidx}
+%Provide a command similar to \cs{lipsum} from the \sty{lipsum}
+%package. May take a comma-separated list or a range of paragraph
+%indices. The starred form suppresses paragraph breaks.
+%    \begin{macrocode}
+\newcommand*{\testidx}{%
+  \@ifstar
+  {%
+    \def\@testidx at block@sep{\space}%
+    \@testidx
+  }%
+  {%
+    \def\@testidx at block@sep{\tstidxdefblocksep}%
+    \@testidx
+  }%
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@testidx}
+%    \begin{macrocode}
+\newcommand*{\@testidx}[1][1-\tstidxmaxblocks]{%
+  \@for\@tidx at block@range:=#1\do{%
+    \ifx\@tidx at block@range\@empty
+    \else
+     \expandafter\@test at idx\@tidx at block@range-\@nil-\@nil\@end at test@idx
+    \fi
+  }%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxdefblocksep}
+% The default separator between blocks is \cs{par}.
+%    \begin{macrocode}
+\newcommand{\tstidxdefblocksep}{\par}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxprefixblock}
+%Prefix for each paragraph. Argument is the paragraph number.
+%    \begin{macrocode}
+\newcommand*{\tstidxprefixblock}[1]{{\scriptsize\number#1.}\ }
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@tidx at parctr}
+%    \begin{macrocode}
+\newcount\@tidx at parctr
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@test at idx}
+%    \begin{macrocode}
+\def\@test at idx#1-#2-#3\@end at test@idx{%
+  \def\@tst at idx@arg{#1}%
+  \ifx\@tst at idx@arg\@nnil
+   \PackageError{testidx}{Invalid range `\@tidx at block@range'}{}%
+  \else
+    \def\@tst at idx@arg{#2}%
+    \ifx\@tst at idx@arg\@empty
+      \PackageError{testidx}{Invalid range `\@tidx at block@range'}{}%
+    \else
+      \ifx\@tst at idx@arg\@nnil
+        \@@test at idx{#1}%
+      \else
+        \ifnum#2<#1\relax
+          \@tidx at parctr=\numexpr#1+1\relax
+          \loop
+            \advance\@tidx at parctr by -\@ne
+            \@@test at idx\@tidx at parctr
+          \ifnum\@tidx at parctr>#2
+          \repeat
+        \else
+          \@tidx at parctr=\numexpr#1-1\relax
+          \loop
+            \advance\@tidx at parctr by \@ne
+            \@@test at idx\@tidx at parctr
+          \ifnum\@tidx at parctr<#2
+          \repeat
+        \fi
+      \fi
+    \fi
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@@test at idx}
+%Do paragraph identified by argument.
+%    \begin{macrocode}
+\newcommand*{\@@test at idx}[1]{%
+ \@ifundefined{@tidx at par@\romannumeral#1}%
+ {%
+   \PackageError{testidx}{No such test block `\number#1'}%
+   {Blocks are numbered from 1 to \number\tstidxmaxblocks}%
+ }%
+ {%
+    \tstidxprefixblock{#1}%
+    \csname @tidx at par@\romannumeral#1\endcsname
+    \@testidx at block@sep
+ }%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\tstidxmaxblocks}
+%    \begin{macrocode}
+\newcount\tstidxmaxblocks
+%    \end{macrocode}
+%\end{macro}
+%\subsection{Adding Test Paragraphs}
+%
+%\begin{macro}{\tstidxnewblock}
+%    \begin{macrocode}
+\newcommand*{\tstidxnewblock}{
+  \@ifstar\s at tstidxnewblock\@tstidxnewblock
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\s at tstidxnewblock}
+%\begin{definition}
+%\cs{tstidxnewblock}*\marg{cs}\marg{block text}
+%\end{definition}
+%(Starred form.) Define a new block and assign the block's number
+% to the control sequence \meta{cs} for reference in another
+% block. (Can't use the normal \cs{ref}\slash\cs{label} as the
+% reference is more useful to the user if the referred block is
+% missing. The undefined ?? indicator isn't much use in this
+% context.)
+%    \begin{macrocode}
+\newcommand{\s at tstidxnewblock}[2]{%
+  \@tstidxnewblock{#2}%
+  \edef#1{\number\tstidxmaxblocks}%
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@tstidxnewblock}
+%\begin{definition}
+%\cs{tstidxnewblock}\marg{block text}
+%\end{definition}
+% (Unstarred form.) Define a new block.
+%    \begin{macrocode}
+\newcommand{\@tstidxnewblock}[1]{%
+  \advance\tstidxmaxblocks by \@ne
+  \expandafter
+    \newcommand\csname @tidx at par@\romannumeral\tstidxmaxblocks\endcsname{#1}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\subsection{Test Paragraphs}
+% These are all the predefined test paragraphs.
+%    \begin{macrocode}
+\tstidxnewblock
+{%
+ This is a~sample block of text designed to test
+ \tstidxcs{index}, the
+ \if at tstidx@use at encaps
+  \tstidxword[tstidxencapii]{layout}
+ \else
+  \tstidxword{layout}
+ \fi
+  of the
+ \if at tstidx@use at encaps
+  \tstidxword[tstidxencapii]{index}
+ \else
+  \tstidxword{index}
+ \fi
+ (\tstidxenv{theindex} environment) and any
+ \if at tstidx@use at 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 at close@testidxsty.%
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\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
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\tstidxnewblock
+{%
+ The actual place where the \tstidxcs{index} command occurs in this 
+ \if at tstidx@use at 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 at tstidx@use at encaps
+   \tstidxword[tstidxencapi]{word}
+ \else
+   \tstidxword{word}
+ \fi
+ or 
+ \if at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at encaps
+  \tstidxword[tstidxencapiii]{text}
+ \else
+  \tstidxword{text}
+ \fi
+ and the 
+ \if at tstidx@use at 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 at tstidx@use at encaps
+  \tstidxencapcsn[tstidxencapi]{tstidxencapi}, 
+ \else
+  \tstidxencapcsn{tstidxencapi}, 
+ \fi
+ \if at tstidx@use at encaps
+   \tstidxencapcsn[tstidxencapii]{tstidxencapii}
+ \else
+   \tstidxencapcsn{tstidxencapii}
+ \fi
+ and 
+ \if at tstidx@use at 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.%
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\tstidxnewblock*{\@tidx at 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 at closerangepar\ has been included in this
+ \if at tstidx@use at 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
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\tstidxnewblock
+{%
+ Now that the preliminaries have been dispensed with in the previous
+ \tstidxword{paragraph}s, we can get on
+ to some serious 
+ \if at tstidx@use at encaps
+   \tstidxword[tstidxencapii]{waffle}
+ \else
+   \tstidxword{waffle}
+ \fi
+ to act as 
+ \if at tstidx@use at 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 at tstidx@use at 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 at xdypar, have some 
+ sneaky \tstidxword{paragraph} breaks that won't
+ be suppressed.) \tstidxsym{TeX}{\TeX}'s asynchronous 
+ \if at tstidx@use at encaps
+   \tstidxphrase[tstidxencapii]{output routine}
+ \else
+   \tstidxphrase{output routine}
+ \fi
+ can cause things to go a bit 
+ \if at tstidx@use at encaps
+   \tstidxphrase[tstidxencapiii]{out of whack},
+ \else
+   \tstidxphrase{out of whack},
+ \fi
+ so lengthy paragraphs in this 
+ \if at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at encaps
+   \tstidxword[tstidxencapiii]{paragraph}
+ \else
+   \tstidxword{paragraph}
+ \fi
+ that was written to deliberately upset \tstidxapp{makeindex}.
+ Mean, aren't I?%
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\tstidxnewblock*{\@tidx at 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:
+%    \end{macrocode}
+% Can't use verbatim so fudge it.
+%    \begin{macrocode}
+ \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.%
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\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 at tstidx@use at 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 at if@notOT at 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 at if@notOT at 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 at 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 at ifutfviii
+ {%
+   \ifxetex
+   \else
+     \ifluatex
+     \else
+       \space You currently have the 
+       \@tstidx at 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
+ }%
+ {}%
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\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 at 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}.%
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\tstidxnewblock*{\@tidx at closerangepar}%
+{%
+ This is the end of the \tstidxcloseword{range}
+ \tstidxword{example} from \tstidxword{block}~\@tidx at 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 at 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}.%
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\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}.)%
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\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}.)%
+} 
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\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}.)%
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\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}.)%
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\tstidxnewblock*{\@tidx at 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.% 
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\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?%
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\tstidxnewblock*{\@tidx at 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?%
+}
+%    \end{macrocode}
+%\iffalse
+%    \begin{macrocode}
+%</testidx.sty>
+%    \end{macrocode}
+%\fi
+%\Finale
+\endinput


Property changes on: trunk/Master/texmf-dist/source/latex/testidx/testidx.dtx
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/testidx/testidx.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/testidx/testidx.ins	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/testidx/testidx.ins	2016-10-17 21:25:14 UTC (rev 42294)
@@ -0,0 +1,31 @@
+% testidx.ins generated using makedtx version 1.1 2016/10/17 12:32
+\input docstrip
+
+\preamble
+
+ 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.
+
+\endpreamble
+
+\askforoverwritefalse
+
+\generate{\file{testidx.sty}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{testidx.dtx}{testidx.sty,package}}
+}
+
+\endbatchfile

Added: trunk/Master/texmf-dist/tex/latex/testidx/testidx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/testidx/testidx.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/testidx/testidx.sty	2016-10-17 21:25:14 UTC (rev 42294)
@@ -0,0 +1,2745 @@
+%%
+%% 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 at ifutfviii}[2]{%
+  \ifxetex
+   #1%
+  \else
+   \ifluatex
+     #1%
+   \else
+     \@ifundefined{inputencodingname}{#2}%
+     {\ifx\inputencodingname\@tstidx at utfviii#1\else#2\fi}%
+   \fi
+  \fi
+}
+\newcommand*{\@tstidx at 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 at ifgerman\@firstoftwo
+  \renewcommand{\tstidxquote}{+}%
+  \renewcommand*{\tstidxumlaut}{\string"}%
+  \renewcommand*{\tstidxsortumlautstrip}{\string"}%
+  \renewcommand*{\tstidxsortumlaut}{\string"}%
+}
+\newcommand*{\testidxGermanOff}{%
+  \let\@tstidx at ifgerman\@secondoftwo
+  \renewcommand{\tstidxquote}{\string"}%
+  \renewcommand*{\tstidxumlaut}{%
+  \expandafter\@gobble\string\\\tstidxquote\string"}%
+  \renewcommand*{\tstidxsortumlautstrip}{\@firstofone}%
+  \renewcommand*{\tstidxsortumlaut}{%
+    \expandafter\@gobble\string\\\tstidxquote\string"}%
+}
+\newcommand*{\@tstidx at 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 at ifsanitize}[2]{#1}
+\newcommand*{\testidxSanitizeOn}{%
+   \let\@tstidx at ifsanitize\@firstoftwo
+   \renewcommand*{\tstidxprocessutf}{%
+     \tstidxprocessutfsanitize
+   }%
+}
+\newcommand*{\testidxSanitizeOff}{%
+   \let\@tstidx at 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 at tstidx@use at encaps
+\@tstidx at use@encapstrue
+\DeclareOption{testencaps}{\@tstidx at use@encapstrue}
+\DeclareOption{notestencaps}{\@tstidx at use@encapsfalse}
+\ProcessOptions
+\AtBeginDocument{%
+  \@ifpackageloaded{amsmath}%
+  {\let\@tstidx at ifamsmath\@firstoftwo}%
+  {\let\@tstidx at ifamsmath\@secondoftwo}%
+  \@ifpackageloaded{inputenc}
+  {
+    \let\@tstidx at if@inputenc\@firstoftwo
+  }%
+  {%
+    \ifxetex
+      \let\@tstidx at if@inputenc\@firstoftwo
+    \else
+      \ifluatex
+        \let\@tstidx at if@inputenc\@firstoftwo
+      \else
+        \let\@tstidx at if@inputenc\@secondoftwo
+      \fi
+    \fi
+  }%
+  \ifxetex
+    \let\@tstidx at if@notOT at ne\@firstoftwo
+  \else
+    \ifluatex
+      \let\@tstidx at if@notOT at ne\@firstoftwo
+    \else
+      \newcommand*{\@tstidx at OT@ne}{OT1}%
+      \edef\@tstidx at enc{\encodingdefault}%
+      \ifx\@tstidx at OT@ne\@tstidx at enc
+        \let\@tstidx at if@notOT at ne\@secondoftwo
+      \else
+        \let\@tstidx at if@notOT at 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 at xdef#1{#2}%
+  }%
+}
+\newcommand*{\tstidxprocessasciisortnostrip}[2]{%
+  {%
+    \let\"\tstidxsortumlaut
+    \protected at 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 at xdef#1{#2}%
+  }%
+}
+\newcommand*{\tstidxprocessutfsanitize}[2]{%
+  \def#1{#2}%
+  \@onelevel at 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 at 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 at arg{#1}%
+   \@onelevel at sanitize\@tstindex at arg
+   \testidxverbosefmt{\@tstindex at arg}%
+  \fi
+  \tstindex{#1}%
+}
+\newcommand*{\testidxverbosefmt}[1]{%
+  \expandafter\def\expandafter\@tstidx at tmp\expandafter{\tstindex}%
+  \@onelevel at sanitize\@tstidx at tmp
+  \tstidxensuretext{%
+    \discretionary{}{}{}%
+    {\footnotesize\texttt{\@tstidx at 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 at text{#1}%
+  \@tstidx at ifutfviii
+  {%
+    \ifx\@tstidx at text\@empty
+      \def\@tstidx at text{#3}%
+    \fi
+    \tstidxprocessutf{\@tstidx at utf}{#3}%
+    \protected at edef\@tstidx at doidx{%
+      \noexpand#5{\unexpanded\expandafter{\@tstidx at utf}}{#4}%
+        {\@tstidx at text}%
+    }%
+  }%
+  {%
+    \ifx\@tstidx at text\@empty
+      \def\@tstidx at text{#2}%
+    \fi
+    \tstidxprocessascii{\@tstidx at ascii}{#2}%
+    \tstidxprocessasciisort{\@tstidx at asciisort}{#2}%
+    \protected at edef\@tstidx at doidx{%
+      \noexpand#5[\unexpanded\expandafter{\@tstidx at asciisort}]%
+        {\unexpanded\expandafter{\@tstidx at ascii}}{#4}%
+        {\@tstidx at text}%
+    }%
+  }%
+  \@tstidx at doidx
+}
+\newcommand*{\tstidxsubutf}[7]{%
+  \def\@tstidx at text{#1}%
+  \@tstidx at ifutfviii
+  {%
+    \ifx\@tstidx at text\@empty
+      \def\@tstidx at text{#3}%
+    \fi
+    \tstidxprocessutf{\@tstidx at utf}{#3}%
+    \tstidxprocessutf{\@tstidx at subutf}{#5}%
+    \protected at edef\@tstidx at doidx{%
+      \noexpand#7{\unexpanded\expandafter{\@tstidx at utf}}%
+        {\unexpanded\expandafter{\@tstidx at subutf}}%
+        {#6}%
+        {\@tstidx at text}%
+    }%
+  }%
+  {%
+    \ifx\@tstidx at text\@empty
+      \def\@tstidx at text{#2}%
+    \fi
+    \tstidxprocessascii{\@tstidx at ascii}{#2}%
+    \tstidxprocessasciisort{\@tstidx at asciisort}{#2}%
+    \tstidxprocessascii{\@tstidx at subascii}{#4}%
+    \tstidxprocessasciisort{\@tstidx at subasciisort}{#4}%
+    \protected at edef\@tstidx at doidx{%
+      \noexpand#7[\unexpanded\expandafter{\@tstidx at asciisort}]%
+        {\unexpanded\expandafter{\@tstidx at ascii}}%
+        [\unexpanded\expandafter{\@tstidx at subasciisort}]%
+        {\unexpanded\expandafter{\@tstidx at subascii}}%
+        {#6}%
+        {\@tstidx at text}%
+    }%
+  }%
+  \@tstidx at 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 at tstidx@use at encaps
+ \newcommand*{\tstidxcs}[2][tstidxencapi]{%
+   \tstidxfmtpost{#2}{\tstidxcsfmt}{#1}%
+ }
+\else
+ \newcommand*{\tstidxcs}[2][]{%
+   \tstidxfmtpost{#2}{\tstidxcsfmt}{#1}%
+ }
+\fi
+\if at tstidx@use at encaps
+  \newcommand*{\tstidxopencs}[2][tstidxencapi]{%
+    \tstidxfmtopenpost{#2}{\tstidxcsfmt}{#1}%
+  }
+\else
+  \newcommand*{\tstidxopencs}[2][]{%
+    \tstidxfmtopenpost{#2}{\tstidxcsfmt}{#1}%
+  }
+\fi
+\if at tstidx@use at encaps
+  \newcommand*{\tstidxclosecs}[2][tstidxencapi]{%
+    \tstidxfmtclosepost{#2}{\tstidxcsfmt}{#1}%
+  }
+\else
+  \newcommand*{\tstidxclosecs}[2][]{%
+    \tstidxfmtclosepost{#2}{\tstidxcsfmt}{#1}%
+  }
+\fi
+\if at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at 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 at ifutfviii
+  {%
+    \tstidxutfopenpost[#4 #5]{#3, #2}{#5, #4}{#1}%
+  }%
+  {%
+    \tstidxutfopenpost[#2 #3]{#3, #2}{#5, #4}{#1}%
+  }%
+}
+\newcommand*{\tstidxutfcloseperson}[7][]{%
+  \@tstidx at 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 at tstidx@use at encaps
+  \newcommand*{\tstidxmath}[3][tstidxencapii]{%
+    \tstindexpre[#2]{$#3$}{#1}{#3}%
+  }
+\else
+  \newcommand*{\tstidxmath}[3][]{%
+    \tstindexpre[#2]{$#3$}{#1}{#3}%
+  }
+\fi
+\if at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at sort{#1}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+   \def\@tstidx at entry{#2}%
+  \else
+   \toks@{#1}%
+   \edef\@tstidx at entry{\the\toks@\tstidxactual}%
+   \expandafter\def\expandafter\@tstidx at entry\expandafter{\@tstidx at entry#2}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+   \iftestidxshowmarks
+     \tstidxtext{#4\tstidxmarker}%
+   \else
+     #4%
+   \fi
+  \else
+   \iftestidxshowmarks
+     \tstidxtext{\tstidxencaptext{#3}{#4\tstidxmarker}}%
+   \else
+     #4%
+   \fi
+   \expandafter\toks@\expandafter{\@tstidx at entry}%
+   \edef\@tstidx at entry{\the\toks@\tstidxencap#3}%
+  \fi
+  \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+}
+\newcommand*{\tstindexopenpost}[4][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+   \def\@tstidx at entry{#2}%
+  \else
+   \toks@{#1}%
+   \edef\@tstidx at entry{\the\toks@\tstidxactual}%
+   \expandafter\def\expandafter\@tstidx at entry\expandafter{\@tstidx at entry#2}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+   \iftestidxshowmarks
+     \tstidxtext{#4\tstidxopenmarker}%
+   \else
+     #4%
+   \fi
+   \expandafter\toks@\expandafter{\@tstidx at entry}%
+   \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange}%
+  \else
+   \iftestidxshowmarks
+     \tstidxtext{\tstidxencaptext{#3}{#4\tstidxopenmarker}}%
+   \else
+     #4%
+   \fi
+   \expandafter\toks@\expandafter{\@tstidx at entry}%
+   \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange#3}%
+  \fi
+  \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+}
+\newcommand*{\tstindexclosepost}[4][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+   \def\@tstidx at entry{#2}%
+  \else
+   \toks@{#1}%
+   \edef\@tstidx at entry{\the\toks@\tstidxactual}%
+   \expandafter\def\expandafter\@tstidx at entry\expandafter{\@tstidx at entry#2}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+   \iftestidxshowmarks
+     \tstidxtext{#4\tstidxclosemarker}%
+   \else
+     #4%
+   \fi
+   \expandafter\toks@\expandafter{\@tstidx at entry}%
+   \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange}%
+  \else
+   \iftestidxshowmarks
+     \tstidxtext{\tstidxencaptext{#3}{#4\tstidxclosemarker}}%
+   \else
+     #4%
+   \fi
+   \expandafter\toks@\expandafter{\@tstidx at entry}%
+   \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange#3}%
+  \fi
+  \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+}
+\newcommand*{\tstindexpre}[4][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+   \def\@tstidx at entry{#2}%
+  \else
+   \toks@{#1}%
+   \edef\@tstidx at entry{\the\toks@\tstidxactual}%
+   \expandafter\def\expandafter\@tstidx at entry\expandafter{\@tstidx at entry#2}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+   \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+   \iftestidxshowmarks
+     \tstidxtext{\tstidxmarker#4}%
+   \else
+     #4%
+   \fi
+  \else
+   \expandafter\toks@\expandafter{\@tstidx at entry}%
+   \edef\@tstidx at entry{\the\toks@\tstidxencap#3}%
+   \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+   \iftestidxshowmarks
+     \tstidxtext{\tstidxencaptext{#3}{\tstidxmarker#4}}%
+   \else
+     #4%
+   \fi
+  \fi
+}
+\newcommand*{\tstindexopenpre}[4][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+   \def\@tstidx at entry{#2}%
+  \else
+   \toks@{#1}%
+   \edef\@tstidx at entry{\the\toks@\tstidxactual}%
+   \expandafter\def\expandafter\@tstidx at entry\expandafter{\@tstidx at entry#2}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+   \expandafter\toks@\expandafter{\@tstidx at entry}%
+   \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange}%
+   \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+   \iftestidxshowmarks
+     \tstidxtext{\tstidxopenmarker#4}%
+   \else
+     #4%
+   \fi
+  \else
+   \expandafter\toks@\expandafter{\@tstidx at entry}%
+   \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange#3}%
+   \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+   \iftestidxshowmarks
+     \tstidxtext{\tstidxencaptext{#3}{\tstidxopenmarker#4}}%
+   \else
+     #4%
+   \fi
+  \fi
+}
+\newcommand*{\tstindexclosepre}[4][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+   \def\@tstidx at entry{#2}%
+  \else
+   \toks@{#1}%
+   \edef\@tstidx at entry{\the\toks@\tstidxactual}%
+   \expandafter\def\expandafter\@tstidx at entry\expandafter{\@tstidx at entry#2}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+   \expandafter\toks@\expandafter{\@tstidx at entry}%
+   \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange}%
+   \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+   \iftestidxshowmarks
+     \tstidxtext{\tstidxclosemarker#4}%
+   \else
+     #4%
+   \fi
+  \else
+   \expandafter\toks@\expandafter{\@tstidx at entry}%
+   \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange#3}%
+   \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+   \iftestidxshowmarks
+     \tstidxtext{\tstidxencaptext{#3}{\tstidxclosemarker#4}}%
+   \else
+     #4%
+   \fi
+  \fi
+}
+\newcommand*{\tstindexsee}[4][]{%
+  \def\@tstidx at sort{#1}%
+  \ifx\@tstidx at sort\@empty
+   \def\@tstidx at entry{#2}%
+  \else
+   \toks@{#1}%
+   \edef\@tstidx at entry{\the\toks@\tstidxactual}%
+   \expandafter\def\expandafter\@tstidx at entry\expandafter{\@tstidx at entry#2}%
+  \fi
+  \expandafter\toks@\expandafter{\@tstidx at entry}%
+  \edef\@tstidx at entry{\the\toks@\tstidxencap#3{#4}}%
+  \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \iftestidxshowmarks
+    \tstidxseeref{#2}{#3}{#4}%
+  \fi
+}
+\newcommand*{\tstsubindexpost}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subindexpost
+}
+\newcommand*{\@tst at subindexpost}[4][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxsubmarker}%
+    \else
+      #4%
+    \fi
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \else
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxsubmarker}}%
+    \else
+      #4%
+    \fi
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \fi
+}
+\newcommand*{\tstsubindexopenpost}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subindexopenpost
+}
+\newcommand*{\@tst at subindexopenpost}[4][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxopensubmarker}%
+    \else
+      #4%
+    \fi
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \else
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxopensubmarker}}%
+    \else
+      #4%
+    \fi
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \fi
+}
+\newcommand*{\tstsubindexclosepost}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subindexclosepost
+}
+\newcommand*{\@tst at subindexclosepost}[4][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxclosesubmarker}%
+    \else
+      #4%
+    \fi
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \else
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxclosesubmarker}}%
+    \else
+      #4%
+    \fi
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \fi
+}
+\newcommand*{\tstsubindexpre}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subindexpre
+}
+\newcommand*{\@tst at subindexpre}[4][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxsubmarker}%
+    \else
+      #4%
+    \fi
+  \else
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxsubmarker}}%
+    \else
+      #4%
+    \fi
+  \fi
+}
+\newcommand*{\tstsubindexopenpre}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subindexopenpre
+}
+\newcommand*{\@tst at subindexopenpre}[4][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxopensubmarker}%
+    \else
+      #4%
+    \fi
+  \else
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxopensubmarker}}%
+    \else
+      #4%
+    \fi
+  \fi
+}
+\newcommand*{\tstsubindexclosepre}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subindexclosepre
+}
+\newcommand*{\@tst at subindexclosepre}[4][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxclosesubmarker}%
+    \else
+      #4%
+    \fi
+  \else
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxclosesubmarker}}%
+    \else
+      #4%
+    \fi
+  \fi
+}
+\newcommand*{\tstindexsubsee}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \ifx\@tstidx at sort\@empty
+   \def\@tstidx at entry{#2}%
+  \else
+   \toks@{#1}%
+   \edef\@tstidx at entry{\the\toks@\tstidxactual}%
+   \expandafter\def\expandafter\@tstidx at entry\expandafter{\@tstidx at entry#2}%
+  \fi
+  \@tstindexsubsee
+}
+\newcommand*{\@tstindexsubsee}[4][]{%
+  \def\@tstidx at subsort{#1}%
+  \ifx\@tstidx at subsort\@empty
+   \toks@{#2}%
+   \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}%
+     \tstidxlevel\the\toks@}%
+  \else
+   \toks@{#1}%
+   \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}%
+     \tstidxlevel\the\toks@\tstidxactual}%
+   \expandafter\def\expandafter\@tstidx at entry\expandafter{\@tstidx at entry#2}%
+  \fi
+  \expandafter\toks@\expandafter{\@tstidx at entry}%
+  \edef\@tstidx at entry{\the\toks@\tstidxencap#3{#4}}%
+  \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \iftestidxshowmarks
+    \tstidxsubseeref{\@tstidx at term}{#2}{#3}{#4}%
+  \fi
+}
+\newcommand*{\tstsubsubindexpost}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subsubindexpost
+}
+\newcommand*{\@tst at subsubindexpost}[2][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \@@tst at subsubindexpost
+}
+\newcommand*{\@@tst at subsubindexpost}[4][]{%
+  \def\@tstidx at subsubsort{#1}%
+  \def\@tstidx at subsubterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at subsubsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxsubsubmarker}%
+    \else
+      #4%
+    \fi
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \else
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxsubsubmarker}}%
+    \else
+      #4%
+    \fi
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \fi
+}
+\newcommand*{\tstsubsubindexopenpost}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subsubindexopenpost
+}
+\newcommand*{\@tst at subsubindexopenpost}[2][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \@@tst at subsubindexopenpost
+}
+\newcommand*{\@@tst at subsubindexopenpost}[4][]{%
+  \def\@tstidx at subsubsort{#1}%
+  \def\@tstidx at subsubterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at subsubsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxopensubmarker}%
+    \else
+      #4%
+    \fi
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \else
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxopensubmarker}}%
+    \else
+      #4%
+    \fi
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \fi
+}
+\newcommand*{\tstsubsubindexclosepost}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subsubindexclosepost
+}
+\newcommand*{\@tst at subsubindexclosepost}[2][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \@@tst at subsubindexclosepost
+}
+\newcommand*{\@@tst at subsubindexclosepost}[4][]{%
+  \def\@tstidx at subsubsort{#1}%
+  \def\@tstidx at subsubterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at subsubsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxclosesubmarker}%
+    \else
+      #4%
+    \fi
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \else
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxclosesubmarker}}%
+    \else
+      #4%
+    \fi
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+  \fi
+}
+\newcommand*{\tstsubsubindexpre}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subsubindexpre
+}
+\newcommand*{\@tst at subsubindexpre}[2][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \@@tst at subsubindexpre
+}
+\newcommand*{\@@tst at subsubindexpre}[4][]{%
+  \def\@tstidx at subsubsort{#1}%
+  \def\@tstidx at subsubterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at subsubsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxsubsubmarker}%
+    \else
+      #4%
+    \fi
+  \else
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxsubsubmarker}}%
+    \else
+      #4%
+    \fi
+  \fi
+}
+\newcommand*{\tstsubsubindexopenpre}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subsubindexopenpre
+}
+\newcommand*{\@tst at subsubindexopenpre}[2][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \@@tst at subsubindexopenpre
+}
+\newcommand*{\@@tst at subsubindexopenpre}[4][]{%
+  \def\@tstidx at subsubsort{#1}%
+  \def\@tstidx at subsubterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at subsubsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxopensubmarker}%
+    \else
+      #4%
+    \fi
+  \else
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxopenrange#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxopensubmarker}}%
+    \else
+      #4%
+    \fi
+  \fi
+}
+\newcommand*{\tstsubsubindexclosepre}[2][]{%
+  \def\@tstidx at sort{#1}%
+  \def\@tstidx at term{#2}%
+  \@tst at subsubindexclosepre
+}
+\newcommand*{\@tst at subsubindexclosepre}[2][]{%
+  \def\@tstidx at subsort{#1}%
+  \def\@tstidx at subterm{#2}%
+  \@@tst at subsubindexclosepre
+}
+\newcommand*{\@@tst at subsubindexclosepre}[4][]{%
+  \def\@tstidx at subsubsort{#1}%
+  \def\@tstidx at subsubterm{#2}%
+  \def\@tstidx at encap{#3}%
+  \ifx\@tstidx at sort\@empty
+    \let\@tstidx at entry\@tstidx at term
+  \else
+     \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at sort}\tstidxactual
+      \unexpanded\expandafter{\@tstidx at term}}%
+  \fi
+  \ifx\@tstidx at subsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subterm}}%
+  \fi
+  \ifx\@tstidx at subsubsort\@empty
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \else
+    \edef\@tstidx at entry{\unexpanded\expandafter{\@tstidx at entry}\tstidxlevel
+      \unexpanded\expandafter{\@tstidx at subsubsort}\tstidxactual
+        \unexpanded\expandafter{\@tstidx at subsubterm}}%
+  \fi
+  \ifx\@tstidx at encap\@empty
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{#4\tstidxclosesubmarker}%
+    \else
+      #4%
+    \fi
+  \else
+    \expandafter\toks@\expandafter{\@tstidx at entry}%
+    \edef\@tstidx at entry{\the\toks@\tstidxencap\tstidxcloserange#3}%
+    \expandafter\@tstindex\expandafter{\@tstidx at entry}%
+    \iftestidxshowmarks
+      \tstidxtext{\tstidxencaptext{#3}{#4\tstidxclosesubmarker}}%
+    \else
+      #4%
+    \fi
+  \fi
+}
+\newcommand*{\testidx}{%
+  \@ifstar
+  {%
+    \def\@testidx at block@sep{\space}%
+    \@testidx
+  }%
+  {%
+    \def\@testidx at block@sep{\tstidxdefblocksep}%
+    \@testidx
+  }%
+}
+\newcommand*{\@testidx}[1][1-\tstidxmaxblocks]{%
+  \@for\@tidx at block@range:=#1\do{%
+    \ifx\@tidx at block@range\@empty
+    \else
+     \expandafter\@test at idx\@tidx at block@range-\@nil-\@nil\@end at test@idx
+    \fi
+  }%
+}
+\newcommand{\tstidxdefblocksep}{\par}
+\newcommand*{\tstidxprefixblock}[1]{{\scriptsize\number#1.}\ }
+\newcount\@tidx at parctr
+\def\@test at idx#1-#2-#3\@end at test@idx{%
+  \def\@tst at idx@arg{#1}%
+  \ifx\@tst at idx@arg\@nnil
+   \PackageError{testidx}{Invalid range `\@tidx at block@range'}{}%
+  \else
+    \def\@tst at idx@arg{#2}%
+    \ifx\@tst at idx@arg\@empty
+      \PackageError{testidx}{Invalid range `\@tidx at block@range'}{}%
+    \else
+      \ifx\@tst at idx@arg\@nnil
+        \@@test at idx{#1}%
+      \else
+        \ifnum#2<#1\relax
+          \@tidx at parctr=\numexpr#1+1\relax
+          \loop
+            \advance\@tidx at parctr by -\@ne
+            \@@test at idx\@tidx at parctr
+          \ifnum\@tidx at parctr>#2
+          \repeat
+        \else
+          \@tidx at parctr=\numexpr#1-1\relax
+          \loop
+            \advance\@tidx at parctr by \@ne
+            \@@test at idx\@tidx at parctr
+          \ifnum\@tidx at parctr<#2
+          \repeat
+        \fi
+      \fi
+    \fi
+  \fi
+}
+\newcommand*{\@@test at idx}[1]{%
+ \@ifundefined{@tidx at par@\romannumeral#1}%
+ {%
+   \PackageError{testidx}{No such test block `\number#1'}%
+   {Blocks are numbered from 1 to \number\tstidxmaxblocks}%
+ }%
+ {%
+    \tstidxprefixblock{#1}%
+    \csname @tidx at par@\romannumeral#1\endcsname
+    \@testidx at block@sep
+ }%
+}
+\newcount\tstidxmaxblocks
+\newcommand*{\tstidxnewblock}{
+  \@ifstar\s at tstidxnewblock\@tstidxnewblock
+}
+\newcommand{\s at tstidxnewblock}[2]{%
+  \@tstidxnewblock{#2}%
+  \edef#1{\number\tstidxmaxblocks}%
+}
+\newcommand{\@tstidxnewblock}[1]{%
+  \advance\tstidxmaxblocks by \@ne
+  \expandafter
+    \newcommand\csname @tidx at par@\romannumeral\tstidxmaxblocks\endcsname{#1}%
+}
+\tstidxnewblock
+{%
+ This is a~sample block of text designed to test
+ \tstidxcs{index}, the
+ \if at tstidx@use at encaps
+  \tstidxword[tstidxencapii]{layout}
+ \else
+  \tstidxword{layout}
+ \fi
+  of the
+ \if at tstidx@use at encaps
+  \tstidxword[tstidxencapii]{index}
+ \else
+  \tstidxword{index}
+ \fi
+ (\tstidxenv{theindex} environment) and any
+ \if at tstidx@use at 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 at 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 at tstidx@use at 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 at tstidx@use at encaps
+   \tstidxword[tstidxencapi]{word}
+ \else
+   \tstidxword{word}
+ \fi
+ or
+ \if at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at encaps
+  \tstidxword[tstidxencapiii]{text}
+ \else
+  \tstidxword{text}
+ \fi
+ and the
+ \if at tstidx@use at 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 at tstidx@use at encaps
+  \tstidxencapcsn[tstidxencapi]{tstidxencapi},
+ \else
+  \tstidxencapcsn{tstidxencapi},
+ \fi
+ \if at tstidx@use at encaps
+   \tstidxencapcsn[tstidxencapii]{tstidxencapii}
+ \else
+   \tstidxencapcsn{tstidxencapii}
+ \fi
+ and
+ \if at tstidx@use at 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 at 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 at closerangepar\ has been included in this
+ \if at tstidx@use at 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 at tstidx@use at encaps
+   \tstidxword[tstidxencapii]{waffle}
+ \else
+   \tstidxword{waffle}
+ \fi
+ to act as
+ \if at tstidx@use at 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 at tstidx@use at 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 at xdypar, have some
+ sneaky \tstidxword{paragraph} breaks that won't
+ be suppressed.) \tstidxsym{TeX}{\TeX}'s asynchronous
+ \if at tstidx@use at encaps
+   \tstidxphrase[tstidxencapii]{output routine}
+ \else
+   \tstidxphrase{output routine}
+ \fi
+ can cause things to go a bit
+ \if at tstidx@use at encaps
+   \tstidxphrase[tstidxencapiii]{out of whack},
+ \else
+   \tstidxphrase{out of whack},
+ \fi
+ so lengthy paragraphs in this
+ \if at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at 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 at tstidx@use at encaps
+   \tstidxword[tstidxencapiii]{paragraph}
+ \else
+   \tstidxword{paragraph}
+ \fi
+ that was written to deliberately upset \tstidxapp{makeindex}.
+ Mean, aren't I?%
+}
+\tstidxnewblock*{\@tidx at 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 at tstidx@use at 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 at if@notOT at 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 at if@notOT at 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 at 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 at ifutfviii
+ {%
+   \ifxetex
+   \else
+     \ifluatex
+     \else
+       \space You currently have the
+       \@tstidx at 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 at 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 at closerangepar}%
+{%
+ This is the end of the \tstidxcloseword{range}
+ \tstidxword{example} from \tstidxword{block}~\@tidx at 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 at 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 at 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 at 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'.


Property changes on: trunk/Master/texmf-dist/tex/latex/testidx/testidx.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2016-10-17 21:24:04 UTC (rev 42293)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2016-10-17 21:25:14 UTC (rev 42294)
@@ -567,7 +567,7 @@
     tamethebeast tap tapir tasks tcldoc tcolorbox tdclock tdsfrmath
     technics ted templates-fenn templates-sommer templatetools tempora
     tengwarscript
-    tensor termcal termlist termmenu testhyphens teubner
+    tensor termcal termlist termmenu testhyphens testidx teubner
     tex-ewd tex-font-errors-cheatsheet tex-gyre tex-gyre-math tex-ini-files
     tex-label tex-overview tex-ps tex-refs tex-virtual-academy-pl
     tex4ebook texapi texbytopic texcount

Modified: trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2016-10-17 21:24:04 UTC (rev 42293)
+++ trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2016-10-17 21:25:14 UTC (rev 42294)
@@ -988,6 +988,7 @@
 depend termcal
 depend termlist
 depend testhyphens
+depend testidx
 depend tex-label
 depend texlogos
 depend texmate

Added: trunk/Master/tlpkg/tlpsrc/testidx.tlpsrc
===================================================================


More information about the tex-live-commits mailing list