summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-11 23:58:52 +0000
committerKarl Berry <karl@freefriends.org>2006-01-11 23:58:52 +0000
commit0dcdc408ec54f939e0f799cbcac31d850546d06c (patch)
tree6934a062dab2f76690df681df1e7721a0a614447 /Master/texmf-dist
parent5207625972f9358905a04858dce25499866a2e46 (diff)
trunk/Master/texmf-dist/source/latex/varindex
git-svn-id: svn://tug.org/texlive/trunk@579 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/source/latex/varindex/varindex.dtx5359
-rw-r--r--Master/texmf-dist/source/latex/varindex/varindex.ins21
2 files changed, 5380 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/varindex/varindex.dtx b/Master/texmf-dist/source/latex/varindex/varindex.dtx
new file mode 100644
index 00000000000..328ec9cd4fa
--- /dev/null
+++ b/Master/texmf-dist/source/latex/varindex/varindex.dtx
@@ -0,0 +1,5359 @@
+% \def\fileversion{2.3}\def\filedate{2001/05/06}\def\docdate{2001/05/09}
+%\iffalse These lines are necessary for the doc and docstrip utilities
+%<*asciidocu>
+
+%%#
+%%# Author:
+%%#
+%%# M. V\"ath vaeth@mathematik.uni-wuerzburg.de
+%%#
+%%# This package bases on ideas of indextwo.sty which was written jointly with
+%%#
+%%# O. Karch karch@informatik.uni-wuerzburg.de
+%%# H.-C. Wirth wirth@informatik.uni-wuerzburg.de
+
+%%#############################################################################
+%%#
+%%# This LaTeX package provides a luxury front-end for the \index command.
+%%# For example, it allows to generate multiple \index entries in
+%%# almost any form by a single command. Extremely customizable.
+%%# Works with all versions of LaTeX and probably most other TeX formats, too.
+%%# This package requires the toolbox package at least in version 3.1.
+%%#
+%%#############################################################################
+
+%%#
+%%# This package was tested with LaTeX 2.09 and LaTeX 2e and should work
+%%# with all other (future) versions of LaTeX and friends, too.
+%%# It should even run with other (non-LaTeX) formats if an \index command
+%%# with LaTeX-Syntax is provided.
+%%#
+
+% If you have access to (reasonable new) docstrip TeXfiles, you should run
+% tex/latex on the file
+% `varindex.ins'
+% to produce the files `varindex.sty', `varindex.txt' and `varindex.tex'.
+% (In case `varindex.ins' is lost: You can find its content in the last
+% few lines of the file you are currently reading between the
+% lines %<*insfile> and %</insfile>;
+% BTW: You should name this file here `varindex.dtx' before you run tex
+% on varindex.ins).
+%
+% The file `varindex.txt' contains a `brief' (but complete) ascii
+% documentation. If you have additionally access to LaTeX2e, you may run
+% latex on the generated file `varindex.tex' to produce `varindex.dvi' which
+% contains a more luxury documentation. (If you want an index or
+% implementation details in the documentation read the comments in
+% `varindex.tex' before running it through latex).
+%
+% If you do not have access to the docstrip TeXfiles you may simply
+% copy/rename this file here into
+% `varindex.sty'
+% to use the package and read the ascii documentation in this file.
+% The ascii documentation (the content of `varindex.txt') consists of all
+% lines in this file which start with %%# (this is the above block and another
+% (very large) block which follows soon).
+%
+% But I do not recommended this, because TeX will need more time to read this
+% longer file, and because there might be a (very slight) incompatibility if
+% you use it (namely if you load `varindex.sty' with some *extremely* strange
+% catcodes).
+% I recommend in this case instead to generate the file `varindex.sty' as
+% anything between the lines %<*package> and %</package> by hand.
+% (This is not precisely the file which you get with the docstrip TeXfiles,
+% but a reasonable good substitute. To speed up loading, you may also
+% eliminate all lines starting with `% ' in `varindex.sty').
+% For your information: The file `varindex.tex' produced by the docstrip
+% TeXfiles is anything between the lines %<*driver> and %</driver>
+% (with a line containing \endinput and two comment lines appended)
+%
+%
+% In any case, you end up with the file `varindex.sty'.
+%
+% If you can generate `varindex.tex', you will probably want to stop
+% reading now and instead read the `luxury' documentation in `varindex.dvi'.
+%
+% Otherwise, you have to make due with the following ascii documentation.
+%
+%
+% \fi\catcode\#14\relax\iffalse (This line is needed for the doc utility)
+%
+
+%%# To use varindex, you have to put `varindex.sty' in a path where TeX looks
+%%# for its input files. You must also have the file `toolbox.sty' of the
+%%# toolbox package in your path. The TeX documents using varindex need the
+%%# following modifications in their header:
+%%#
+%%# a) If you use LaTeX2.09, use varindex as a style option, e.g.
+%%# \documentstyle[varindex]{article}
+%%# or
+%%# \documentstyle[varindex,12pt]{article}
+%%# b) If you use LaTeX2e, put in the preamble the command
+%%# \usepackage{varindex}
+%%# c) If you use some other (non-LaTeX) format, you will probably have to
+%%# insert a line like
+%%# \catcode`\@=11\input varindex.sty\catcode`\@=12\relax
+%%#
+%%# For TeX insiders: LaTeX-specific commands used in `varindex.sty' are only:
+%%#
+%%# \makeatother
+%%# \makeatletter
+%%# \typeout
+%%# \RequirePackage
+%%# \newcommand (only in the form \newcommand{\command}{} to ensure that
+%%# \command was not defined before)
+%%# \ProvidesPackage
+%%#
+%%# The above commands are used only if they are defined (otherwise,
+%%# natural substitutes are used (\newcommand and \Provides package are
+%%# then not used at all))
+
+
+%%#
+%%# I strongly recommend to have additionally a look at the documentation
+%%# of the "toolbox" package, in particular the \toolboxMakeDef command
+%%# (provided since toolbox v3.1) which supplements \varindex.
+%%#
+
+%%#
+%%# The \varindex command is highly customizable.
+%%# So the following examples can only give you a rough impression of what
+%%# you can actually do with it. You do not need to understand them now:
+%%# The general usage is explained later. (Maybe you want to look up the
+%%# examples afterwards).
+%%#
+%%#
+%%# 1. Typical example of usage (using the \varindextwo macros):
+%%#
+%%#
+%%#
+%%# Suppose the following customization of the \varindex command was defined:
+%%# \def\Index{\varindex(){\varindextwoScan}{\varindextwo}[\emph]}
+%%# Since we used the \varindextwo macros here, by default
+%%# TWO index entries are generated with a single command:
+%%#
+%%# \Index{ring with $1$@one}
+%%#
+%%# ring
+%%# ~ with $1$ [sorted like: "with one"]
+%%#
+%%# $1$ [sorted like: "one" ]
+%%# ring with ~ [sorted like: "ring with" (without " ~") ]
+%%#
+%%# DIFFERENT entries may be generated by your own rules. E.g.:
+%%#
+%%# \Index{Hausdorff measure of noncompactness}[4,23 2!~34!1= ]
+%%#
+%%# generates THREE index entries:
+%%#
+%%# noncompactness, measure of ~ (sorted like "noncompactness, measure of")
+%%#
+%%# measure
+%%# ~ of noncompactness
+%%# Hausdorff = (here, = stands for the $\approx$ symbol)
+%%#
+%%# Hausdorff measure of noncompactness
+%%#
+%%# The last of these entries occurs only, because the last character in
+%%# the format argument [...] was a space.
+%%#
+%%# If you want only slight modification(s) of the default, you need also just
+%%# slight modifications of the command, e.g.
+%%#
+%%# \Index*,{ring with $1$@one} is as above, just that the second entry reads
+%%#
+%%# $1$, ring with ~ [sorted like "one, ring with" ]
+%%#
+%%# Moreover, since the `*' occured in the previous command, additionally
+%%#
+%%# \emph{ring with $1$}
+%%#
+%%# appears in the running text. Praxis shows that changes in the entries as
+%%# above have to be made frequently in the `fine tuning' of the index of a
+%%# book. Note that with the original \index the command would have to be
+%%# changed completely for the above entries, because we have a "sort" entry
+%%# for which a different rule applies if we use a subitem instead of a ",".
+%%# (BTW: \varindex produces sort entries only if they are necessary).
+%%#
+%%# Of course, you may combine the default with your own format:
+%%#
+%%# \Index{internal integrable function}[23,1~ +] generates
+%%#
+%%# integrable function, internal ~
+%%#
+%%# internal
+%%# ~ integrable function
+%%#
+%%# function
+%%# internal integrable ~
+%%#
+%%#
+%%# 2. A simple example without the \varindextwo macros:
+%%#
+%%# \varindex*{topology of a normed space}{5!4~!1= 45,12}[|see{norm}]
+%%#
+%%# produces the two index entries:
+%%#
+%%# space
+%%# normed ~
+%%# topology =
+%%#
+%%# normed space, topology of
+%%#
+%%# In both entries not the pagenumber is cited, but the text "see also norm".
+%%# Additionally, the tokens {topology of a normed space} are
+%%# inserted into the running text (this would not happen if
+%%# \varindex is used in place of \varindex*).
+%%# Only in the first of the above entries, an `@' part will be added to the
+%%# *.idx file: This entry is sorted as if " ~" resp. " =" would not exist.
+%%#
+%%#
+%%# 3. Another example without the \varindextwo macros:
+%%#
+%%# \varindex[\emph][|textbf]%
+%%# {$\sigma$@sigma!$(\sigma-)$ finite {measure space}}%
+%%# {*1.23 23 23,1- 1-23}
+%%#
+%%# generates the three index entries:
+%%#
+%%# finite measure space
+%%#
+%%# finite measure space, $\sigma$- (sorted as "finite measure space, sigma-")
+%%#
+%%# $\sigma$-finite measure space (sorted as "sigma-finite measure space")
+%%#
+%%# In all three entries the pages are printed using \textbf.
+%%#
+%%# Moreover, the tokens
+%%# \emph{($\sigma$-)finite measure space}
+%%# are put into the running text.
+%%#
+%%#
+%%# 4. A simple example using a flag (without the \varindextwo macros):
+%%#
+%%# \varindex1{$L$ and $M$@L and M}{}
+%%# ^
+%%#
+%%# generates the index entry "$L$ and $M$" which is sorted like "L and M".
+%%# In the form
+%%# \varindex1*{$L$ and $M$@L and M}{}
+%%# or
+%%# \varindex*1{$L$ and $M$@L and M}{}
+%%# additionally, {$L$ and $M$} is output into the running text.
+%%#
+%%# Note that without the `1', the index generated were
+%%# "$L$ and $M$ and M" which were sorted like "$L$ and L and M".
+%%#
+%%#
+%%# 5. An example for very primitive customized index commands (without the
+%%# \varindextwo macros):
+%%#
+%%# \def\myindexA{\varindex[\emph][|textbf]*}
+%%# \def\myindexB{\varindex(){}{}[\emph][|textbf]}
+%%#
+%%# \myindexA{Foo1}{}
+%%# \myindexB{Foo2}[][]
+%%# \myindexB*{Foo3!{Foo 3}}
+%%#
+%%# Generates the index entries Foo1, Foo2, and Foo3. Moreover, \emph{Foo1}
+%%# and \emph{Foo 3} is put into the running text. The pagenumber of Foo 2 in
+%%# the index is printed normal, the others with \textbf.
+%%#
+%%#
+%%# 6. An example of a primitive customized index command (without the
+%%# \varindextwo macros):
+%%#
+%%# \def\myindex{\varindex(\ifnum\varindexCount=2 1!2 2,1\fi){}{}[\emph]}
+%%#
+%%# \myindex{Foo Bar}
+%%# generates the index entries
+%%# Foo
+%%# Bar
+%%#
+%%# Bar, Foo
+%%#
+%%# \myindex*{Foo Bar}
+%%# generates the same index entries as above and additionally outputs
+%%# \emph{Foo Bar} into the running text.
+%%#
+%%# \myindex*{other format}[21]
+%%# generates the index entry
+%%# format other
+%%# and outputs \emph{other format} into the running text.
+%%#
+%%# \myindex[|textbf]*{BoBo}
+%%# generates the index entry
+%%# BoBo
+%%# where the pagenumber is printed with \textbf.
+%%# Moreover, \emph{BoBo} is output into the running text.
+%%#
+%%#
+%%# 7. A primitive varying customized index command (without the \varindextwo
+%%# macros):
+%%#
+%%# \def\myindex{\varindex(\ifnum\varindexCount=2 1!2 2,1\fi)%
+%%# (\ifnum\varindexCount=2*2,1 1!2 2,1\fi){}{}[\emph]}
+%%#
+%%# With the same commands as in 6. the same index entries are generated,
+%%# but the tokens \emph{Far, Boo}, \emph{other format}, and \emph{Bobo}
+%%# are output into the running text.
+%%#
+%%#
+%%# 8. Examples with the \varindextwo macros:
+%%# We use a similar definition for \Index as in 1., and define an \iemph
+%%# macro which has `*' as a default and outputs with \emph.
+%%# Both sort of definitions are highly recommended for you private style.
+%%#
+%%# \def\Index{\varindex(){\varindextwoScan}{\varindextwo}[]}
+%%# \def\iemph{\varindex(){\varindextwoScan\def\varindexStarPos{}}%
+%%# {\varindextwo}[\emph]}
+%%# (note that \def\iemph{\varindex(){\varindextwoScan}{\varindextwo}[\emph]*}
+%%# is not so good as the above definition of \iemph as is explained below).
+%%#
+%%# \Index*{measure of $\gamma$-noncompactness@gamma-noncompactness!FOO}
+%%#
+%%# generates the index entries
+%%#
+%%# measure
+%%# ~ of $\gamma$-noncompactness (sorted as "of gamma-noncompactness")
+%%#
+%%# $\gamma$-noncompacntess
+%%# measure of ~
+%%#
+%%# and outputs the tokens {measure of FOO} into the running text.
+%%#
+%%# \Index*,?_'{flic of flac} generates
+%%#
+%%# flic of flac
+%%#
+%%# flac, flic
+%%#
+%%# and outputs {flic of flac}.
+%%#
+%%# \Index^={$\sigma$@sigma algebra} generates
+%%#
+%%# $\sigma$ (sorted as "sigma")
+%%# ~-algebra (sorted as "algebra" resp. "-algebra", see below)
+%%#
+%%# algebra
+%%# $\sigma$-~ (sorted as "sigma-")
+%%#
+%%# Here, the sorting "-algebra" is chosen when you used
+%%# \let\varindexOutSortDashBeg\varindexOutSortDash
+%%# as described later.
+%%#
+%%# \Index-^>{$\sigma$@sigma algebra} generates
+%%#
+%%# $\sigma$- (sorted as "sigma-")
+%%# ~ algebra (sorted as "algebra")
+%%#
+%%# \Index^.,:{ultra filter} generates
+%%#
+%%# ultra
+%%# ~filter (no space following ~)
+%%# filter, ultra~ (no space in front of ~)
+%%#
+%%# \iemph[|see{recursive recursion}],_{recursive recursion} generates
+%%#
+%%# recursive recursion, \see{recursive recursion}
+%%#
+%%# recursion, recursive ~, \see{recursive recursion}
+%%#
+%%# and outputs \emph{recursive recursion}. If we would have used instead the
+%%# definition \def\iemph{\varindex(){\varindextwoScan}{\varindextwo}[]*},
+%%# the above call were not possible, since the optional arguments [|see...]
+%%# must occur in front of the flag `*'.
+%%#
+%%# \Index-;*{Flip Flop} generates
+%%#
+%%# Flip-Flop
+%%#
+%%# FlopFlip
+%%#
+%%# and outputs {Flip-Flop} (!!!!!!!)
+%%#
+%%# \Index>{Flippy Flop!GO}[*2-1-2 2!1-1 1-12 +]
+%%#
+%%# generates
+%%#
+%%# Flop
+%%# Flippy-Flippy (no tilde!)
+%%#
+%%# Flippy-Flippy Flop
+%%#
+%%# Flippy
+%%# ~ Flop
+%%#
+%%# and outputs {GO-Flippy-GO} (!!!)
+%%#
+%%# \Index*_,{shape {of a} of star} generates
+%%#
+%%# shape of a star
+%%#
+%%# star, shape of ~ (sorted like "star, shape of")
+%%#
+%%# and outputs {shape of a star}.
+%%#
+%%# \Index1*{$L$ feature@L feature}
+%%# \Index,{No $L$@L feature}
+%%# generate
+%%#
+%%# $L$ feature (sorted like "L feature")
+%%#
+%%# No
+%%# ~ $L$ feature (sorted like "L feature")
+%%#
+%%# feature, No $L$ ~ (sorted like "feature, No L")
+%%#
+%%# and outputs {$L$ feature}.
+%%#
+%%#
+%%# 9. Example of a simple modification of the \varindextwo macros:
+%%#
+%%# \def\myindextwoScan{%
+%%# \varindextwoScan
+%%# \varindexNewFlag ~\vxtSpaceA
+%%# \varindexNewFlag 1\vxtSpaceB
+%%# \varindexNewFlag !\varindexOneEntry
+%%# \varindexMakeSplitExpand{/}{vxtSplitAtMagic}%
+%%# \def\varindexStarPos{}%
+%%# }
+%%# \def\myIndex{\varindex(){\myindextwoScan}{\varindextwo}[]}
+%%#
+%%# \myIndex behaves similar to the previous example with
+%%# the following differences:
+%%# 1. The flag `1' now has the previous meaning of "~".
+%%# 2. One may now use "~" and "_" equivalently.
+%%# 3. The flag `!' now has the originial meaning of the flag `1'.
+%%# 4. Instead of `+' in the format string, the character `/' has to be used.
+
+%%#
+%%#
+%%# Description:
+%%#
+%%# There are two possible calls:
+%%#
+%%# a) \varindex[textstyle][pagestyleA]flags{main entries}{format}[pagestyleB]
+%%#
+%%# Here, [textstyle], [pagestyleA], [pagestyleB], and flags are optional.
+%%# (If [textstyle] is omitted, also [pagestyleA] must be omitted).
+%%#
+%%# textstyle: describes the textstyle used for the output into the
+%%# running text (typically, textstyle is \emph or empty).
+%%# pagestyle: describes the pagestyle used for the output of the pagenumber
+%%# (you may also use a construct like |see{...} here).
+%%# If [pagestyleB] is present, this is the value used.
+%%# Otherwise, the value of [pagestyleA] is used (resp. nothing).
+%%# flags can be one (or both) of the following tokens:
+%%# `*': "Output into running text":
+%%# If no * is used in the format string (see below),
+%%# then the format is automatically prepended by the tokens `* '
+%%# resp. `*' (depending whether format starts with ` ' or not)
+%%# `1': The content of {main entries} is considered as a single entry
+%%# (see below).
+%%# {main entries} and
+%%# {format} are explained later.
+%%#
+%%# b) \varindex(formatA)(format*A){scanprogram}{mainprogram}
+%%# [textstyle][pagestyleA]flags{main entries}[formatB][pagestyleB]
+%%#
+%%# Concerning [textstyle], [pagestyleA], flags, [pagestyleB], the same
+%%# remarks as in a) hold. Also (format*A) and (formatA) are optional.
+%%# (if (formatA) is omitted, also (format*A) must be omitted).
+%%#
+%%# The "default" format is formatA resp. format*A (depending whether the
+%%# flag "*" has been used or not). If [formatB] is given, then this is
+%%# used as the format (i.e. it overrides the default).
+%%#
+%%# scanprogram is executed immediately when \varindex reads it.
+%%# This can be used to introduce FURTHER flags (other than '*' and `1'),
+%%# see below.
+%%# mainprogram is executed AFTER the format string(s) has been expanded.
+%%#
+%%#
+%%#
+%%# It is recommended to define personal macros which contain all parameters up
+%%# to the place where the flags occur (either with or without some flags,
+%%# depending on the intention). See the examples above.
+%%#
+%%#
+%%#
+%%#
+%%# The main argument (called {main entries} above) has the form
+%%#
+%%# entry1[`space' entry2][`space' entry3] ...
+%%#
+%%# where each of entry1 entry2 entry3 ... in turn has the form
+%%# indextext@sorttext!outputtext or
+%%# indextext!outputtext@sorttext
+%%# In each of these forms, @sorttext and !outputtext are optional.
+%%# Here,
+%%# indextext is the text which is put into the index for the entry
+%%# sorttext is what is used as a sort criterion for the entry
+%%# outputtext is what is output into the running text for the entry
+%%#
+%%# Note that the symbol @ has in a sense the opposite meaning as in the
+%%# original \index command:
+%%# BEFORE that symbol, the desired text appears, and
+%%# AFTER the symbol the place where it has to be sorted.
+%%# However, we chose the symbols @ and !, because these two
+%%# symbols are forbidden anyway (otherwise, makeindex will become confused).
+%%#
+%%# As usual, multiple spaces are considered as ONE space and do not generate
+%%# empty "ghost" entries. Moreover, a space after a TeX-command like \LaTeX
+%%# is eliminated by TeX and thus also not considered as a separator.
+%%# You may use braces {...} either around a whole entry or
+%%# around indextext resp. sorttext resp. outputtext to allow spaces
+%%# which do not act as "separators" in the corresponding part. The braces
+%%# around these parts will vanish. In particular, you may generate an
+%%# empty entry with {} or ! or @ (bordered by spaces).
+%%# If you want that braces occur in the OUTPUT, you have to add an
+%%# additional pair of braces. Be aware that you write sufficiently
+%%# many braces, if you really should need them: For example,
+%%# the command \varindex{{{{A B}}}}{} produces the index entry {A B}:
+%%# The outermost pair of braces is eliminated immediately by TeX. The second
+%%# pair is eliminated, because this is a pair around a complete entry.
+%%# Finally, another pair is eliminated, because it is a brace around
+%%# indextext.
+%%# With the flag `1', {main entries} is considered as one single entry.
+%%# Nevertheless, also with this flag, an additional pair of braces around
+%%# main entry is eliminated.
+%%#
+%%#
+%%# The format string has one of the following three forms
+%%# indexa[`space' indexb][`space' indexc] ... [*outputa][*outputb] ...
+%%# [*outputa][`space' indexa][`space' indexb][*outputc] ...
+%%# *
+%%# where the order of arguments can be arbitrarily mixed (except for the first
+%%# indexa in the first form). indexa indexb ... outputa ... describe the
+%%# format of the index entries resp. of the output into the running text.
+%%# The output is generated in the given order (this might be important, if
+%%# a pagebreak occurs during the output into the running text).
+%%# The last case is exceptional and equivalent to `*space'.
+%%# The following characters/strings describe the format:
+%%#
+%%# 1-9: entry1-9
+%%# 0: entry 10
+%%# ~: a placeholder sign
+%%# =: alternative placeholder sign
+%%# _: a space character
+%%# s: The token \space (but _ is used for the sort entry)
+%%# .: No space will follow
+%%# ,: The character , (space will follow)
+%%# -: The character - (no space will follow)
+%%# !: Create a new sublevel
+%%# All other tokens in this argument are forbidden.
+%%# The token ! makes no sense for the output in the running text and thus
+%%# is forbidden behind *.
+%%#
+%%# By a heuristic rule, a space is automatically inserted between two entries
+%%# which generate non-empty text. If the heuristic rule fails, you may always
+%%# force a space by either "_" or "s", or forbid a space by ".".
+%%#
+%%# If a format is empty, all entries are taken in the order of input.
+%%# Note that TeX eliminates concatenated spaces, and so you are able to
+%%# produce an empty format entry only at the end or in front of a `*'.
+%%# If you want to force an empty OUTPUT (is this ever useful?), you may use
+%%# just "." as the entry.
+%%#
+%%# A sort entry is only written to the *.idx file if it differs from the
+%%# text entry.
+
+%%#
+%%#
+%%# Description of the \varindextwo macros:
+%%#
+%%# The macros
+%%#
+%%# \varindextwoScan \varindextwo
+%%#
+%%# can be used together as parameters {scanprogram} resp. {mainprogram}
+%%# for the \varindex command.
+%%# If \varindex is called with these macros, and no
+%%# explicit format argument is given, these macros generate a format
+%%# depending on the number of entries in {main entries}:
+%%#
+%%# a) If there is only one entry in {main entries},
+%%# then the format "1" resp. "*1 1" is generated
+%%# (depending whether the * flag was used or not), i.e. the
+%%# entry is put into the index, and printed if \varindex was
+%%# called with the * flag.
+%%#
+%%# b) If there are two main entries like {graulty bazola},
+%%# then the format becomes { 1!~2 1!2~}, i.e. the index entries
+%%#
+%%# graulty
+%%# ~ bazola
+%%#
+%%# bazola
+%%# graulty ~
+%%#
+%%# are produced.
+%%#
+%%# You can modify the first format entry with the following flags:
+%%# flags format used: If used with `*' additionally:
+%%# _ 12 *12
+%%# - 1-2 *1-2
+%%# ^ 1!~-2 resp. 1!-2 *1-2
+%%# -^ 1-!~.2 resp. 1-!~2 *1-2
+%%# . 1.2 *1.2
+%%# .^ 1!~.2 *1.2
+%%# / 1!2 (without ~) *12
+%%# < no entry *12
+%%#
+%%# Here, the combinations -^ and .^ mean that both flags are used
+%%# (the order plays no role).
+%%# The output for ^ respectively -^ is determined by the switches
+%%# \varindextwoDashTildetrue (default)
+%%# \varindextwoDashTildefalse
+%%# \varindextwoDashSpacetrue
+%%# \varindextwoDashSpacefalse (default)
+%%#
+%%# You can modify the second format entry with the following flags:
+%%# flags format used:
+%%# , 2,1~ resp. 2,1
+%%# ~ 21
+%%# = 2!1-~
+%%# ,= 2,1-~ resp. 2,1-
+%%# + 2-1
+%%# : 2!1.~
+%%# ,: 2,1.~ resp. 2,1
+%%# ; 2.1
+%%# > no entry
+%%# ! Append ~ (if not already there)
+%%# ? Without ~
+%%#
+%%# Whether the first or the second alternatives in the above forms is used
+%%# depends on the status of the switch
+%%# \varindextwoCommaTildetrue (default)
+%%# \varindextwoCommaTildefalse
+%%# We point out that "\varindextwoCommaTildefalse" was in earlier versions
+%%# of "varindex" the default (and could not be changed).
+%%# Note that this switch has no effect if the ! or ? flags are used.
+%%#
+%%# HINT for remembering the symbols: The symbols _ . - for the first entry
+%%# are the same flags as for the output and the same flags which are used
+%%# in the format string. The corresponding symbols ~ : (and ;) = (and +)
+%%# for the second entry "look similar". The "," is only useful in the
+%%# second entry (and is the same symbol as in the format string).
+%%# The two exceptional symbols ">" and "<" can be read as "generate only
+%%# the forward-directed resp. backward-directed entry".
+%%#
+%%# c) If there are three main entries like {graulty of bazola}, then the
+%%# format becomes { 1!~23 3!12~}, i.e. the output becomes
+%%#
+%%# graulty
+%%# ~ of bazola
+%%#
+%%# bazola
+%%# graulty of ~
+%%#
+%%# The flags have an analogous effect to b).
+%%# In addition, if the flags ` resp. ' are used, the second word
+%%# (in our example: `of') is omitted from the output in the first resp.
+%%# in the second index entry. If the * flag and ` are used together, the
+%%# second entry is also omitted from the output into the running text.
+%%#
+%%# d) If there are four main entries like {graulty of OF bazola}, then the
+%%# format becomes { 1!~24 4!31~}, i.e. the output becomes
+%%#
+%%# graulty
+%%# ~ of bazola
+%%#
+%%# bazola
+%%# graulty OF ~
+%%#
+%%# i.e. we have a similar effect as in c) except that for the first entry
+%%# the third word is skipped, and for the second entry the second word is
+%%# skipped. All flags as in c) can be used with an analogous meaning.
+%%# Also if the * flag is used, the output into the running text is
+%%# analogous to c) (the third word is skipped).
+%%#
+%%# e) If there are more than four main entries, then
+%%# (formatA) resp. (format*A) is used.
+%%#
+%%# If an explicit format argument is provided, then this is used except
+%%# when it contains the symbol +. In this case, this symbol is replaced by the
+%%# output which would be generated "normally". If additionally the `*'-flag
+%%# is used, there is a special rule:
+%%# If the explicit format contains a `*', then no additional `*'-output is
+%%# produced. Otherwise, the `*'-output from a)-e) is prepended to the given
+%%# format string (with a space at the end, unless the format string is empty).
+%%# This means that `normally' you have the output from a)-e),
+%%# unless you write an own `*'-part in the argument.
+%%#
+%%# If you do not like the tokens chosen for the default symbols, you can
+%%# easily choose your own tokens by just replacing \varindextwoScan with your
+%%# own macro (or defining your own ``magic'' tokens after \varindextwoScan,
+%%# see Example 9. above).
+
+%%#
+%%#
+%%# Primitive customization:
+%%#
+%%#
+%%# You may use the command
+%%# \varindexUsePlaceholderAfalse
+%%# \varindexUsePlaceholderBfalse
+%%# to ignore the sign ~ resp. = in the format entry.
+%%# You can easily restore the default by
+%%# \varindexUsePlaceholderAtrue
+%%# \varindexUsePlaceholderBtrue
+%%#
+%%# If you want to switch off the placeholder only at the beginning of
+%%# a new entry (resp. of a new subentry), you can use the commands
+%%# \varindexLeadingPlaceholderAfalse
+%%# \varindexLeadingPlaceholderBfalse
+%%# The default is restored with
+%%# \varindexLeadingPlaceholderAtrue
+%%# \varindexLeadingPlaceholderBtrue
+%%#
+%%# By default, the "," in the format string is in this connection
+%%# treated as a symbol generating a new "subentry". You can change this
+%%# default with the command
+%%# \varindexCommaLeadsfalse
+%%# You may switch back with
+%%# \varindexCommaLeadstrue
+%%#
+%%#
+%%# The content of the macro
+%%# \varindexPlaceholderAText
+%%# \varindexPlaceholderASort
+%%# \varindexPlaceholderBText
+%%# \varindexPlaceholderBSort
+%%# is used as the placeholder ~ resp. = in the index resp. sort entry.
+%%# Note that if one of these entries expands empty, different rules for
+%%# the automatic insertion of spaces apply (for the index and sort entry
+%%# separately).
+%%#
+%%# You may prefer that the placeholder text resp. sort content changes at
+%%# run time to the context of the previous ! entry. For example, you may
+%%# want that the command \varindex{Gibble Gobble}{2!~2} produces the index
+%%# entry
+%%# Gibble
+%%# Gibble Gobble
+%%# (or is at least SORTED as such an entry).
+%%#
+%%# You can achieve this with the commands
+%%# \varindexPreviousATexttrue
+%%# \varindexPreviousASorttrue
+%%# \varindexPreviousBTexttrue
+%%# \varindexPreviousBSorttrue
+%%# for the text and sort entry and the placeholders ~ and =, respectively.
+%%# With these commands, the content of \varindexPlaceholderAText etc
+%%# is only used as the default if no previous ! entry was given.
+%%# You can switch back to the default mode with the respective commands
+%%# \varindexPreviousATextfalse
+%%# \varindexPreviousASortfalse
+%%# \varindexPreviousBTextfalse
+%%# \varindexPreviousBSortfalse
+%%#
+%%# By default, the ',' in the format entry is considered in this connection
+%%# similar to '!'. If you want to change this, use the command
+%%# \varindexCommaExpandfalse
+%%# You may switch back with
+%%# \varindexCommaExpandtrue
+%%#
+%%# Since version 2.2, the dash "-" occurring at the beginning of entry
+%%# (or after "!" or even after "," if \varindexCommaExpandtrue is in effect)
+%%# is ignored for sorting. You can switch off this feature with the command
+%%#
+%%# \let\varindexOutSortDashBeg\varindexOutSortDash
+%%#
+%%# To restore the new default, use
+%%#
+%%# \let\varindexOutSortDashBeg\toolboxEmpty
+%%#
+%%#
+%%# The commands
+%%#
+%%# \varindexSetWordString{|} % Use | as separator for entries instead
+%%# % of spaces.
+%%# \varindexSetSortString{>} % default: @
+%%# \varindexSetPlainString{<} % default: !
+%%#
+%%# set the default "magic" strings used for the main argument.
+%%# The argument of the above macros is intentionally NOT expanded (so that
+%%# you do not have troubles with active characters like ~).
+%%# To force expansion, use e.g.
+%%# \expandafter\varindexSetWordString\expandafter{\MacroToExpand}
+%%# or some similar construct.
+%%#
+%%# If you use a different separator than `space' for the entries, you may want
+%%# to change the rule how braces are eliminated. With the commands
+%%# \varindexEliminateOuterBracetrue
+%%# \varindexEliminateInnerBracetrue
+%%# \varindexEliminateOuterBracefalse
+%%# \varindexEliminateInnerBracefalse
+%%# you may allow resp. forbid the elimination of braces around the entries
+%%# resp. around {indextext} {sorttext} and {outputtext}
+%%# With the flag `1', {main entries} is considered as one single entry,
+%%# but if \varindexEliminateOuterBracetrue is set (which is the default)
+%%# also in this case an additional pair of braces around main entry is
+%%# eliminated.
+%%#
+%%# Similarly as above,
+%%#
+%%# \varindexSetIndexString{|} % default: space
+%%# \varindexSetOutputString{<} % default: *
+%%# \varindexSetTildeAString{~} % (is default)
+%%# \varindexSetTildeBString{=} % (is default)
+%%# \varindexSetSpaceString{_} % (is default)
+%%# \varindexSetSpaceTokString{s} % (is default)
+%%# \varindexSetOmitString{.} % (is default)
+%%# \varindexSetCommaString{,} % (is default)
+%%# \varindexSetDashString{-} % (is default)
+%%# \varindexSetExclamString{!} % (is default)
+%%# \varindexSetStringForNr 1{a} % default: 1
+%%# \varindexSetStringForNr{11}{b}% No default!
+%%#
+%%# sets the default "magic" strings used for the format argument.
+%%# In contrast to before, the arguments are fully expanded (with
+%%# \varindexedef, see below).
+%%# Note that the last command provides a way to access more than 10 entries!
+%%#
+%%# If you use \varindexSetIndexString{|} (with some non-space token),
+%%# you may still use spaces in the format which then are just ignored.
+%%#
+%%#
+%%# Avoid that one string is a prefix of another string: In this case,
+%%# strange effects may happen, and this behavior may even change in
+%%# future releases of this package.
+%%# Note that the above effect may arise unintentionally if you use active
+%%# chars. For this reason, `~' is defined to expand to the letter `~',
+%%# before the expansion is executed. Maybe in later releases of this package
+%%# there will be further such redefinitions.
+%%# You can explicitly use this feature in your own macros by using
+%%# \varindexedef instead of the usual \edef, see below.
+%%#
+%%#
+%%# You can change the output for the text resp sort entry of the various
+%%# symbols used in the format string. More precisely, you can redefine
+%%#
+%%# \varindexOutExclam % Text output for !
+%%# \varindexFollowsExclam % Decide whether magic space after ! is inserted
+%%# \varindexOutTextComma % Text output for ,
+%%# \varindexOutSortComma % Sort output for ,
+%%# \varindexFollowsComma % Decide whether magic space after , is inserted
+%%# \varindexPreceedsComma % Decide whether magic space before , is erased
+%%# \varindexOutTextSpace % Text output for _
+%%# \varindexOutSortSpace % Sort output for _
+%%# \varindexFollowsSpace % Decide whether magic space after _ is inserted
+%%# \varindexPreceedsSpace % Decide whether magic space before _ is erase
+%%# \varindexOutTextSpTok % Text output for s
+%%# \varindexOutSortSpTok % Sort output for s
+%%# \varindexFollowsSpTok % Decide whether magic space after s is inserted
+%%# \varindexPreceedsSpTok % Decide whether magic space before s is erased
+%%# \varindexOutTextDash % Text output for -
+%%# \varindexOutSortDash % Sort output for -
+%%# \varindexOutSortDashBeg% Sort output for - if nothing preceeds
+%%# \varindexFollowsDash % Decide whether magic space after - is inserted
+%%# \varindexPreceedsDash % Decide whether magic space before - is erased
+%%# \varindexOutTextOmit % Text output for .
+%%# \varindexOutSortOmit % Sort output for .
+%%# \varindexFollowsOmit % Decide whether magic space after . is inserted
+%%# \varindexPreceedsOmit % Decide whether magic space before . is erased
+%%#
+%%# The meaning is as follows: \varindexOut... should just expand to the
+%%# tokens which should be written into the text resp. sort output.
+%%# The corresponding macro \varindexFollows... is typically defined with
+%%# one of the following commands:
+%%# \let\varindexFollows...\varindexNextSpace
+%%# \let\varindexFollows...\varindexNoNextSpace
+%%# In the first case, a space is `magically' inserted in front of a
+%%# subsequent token (unless this token erases the magic space).
+%%# In the second case, no space follows, of course.
+%%# There is an alternative call:
+%%# \def\varindexFollows...{\varindexSpaceTexttrue\varindexSpaceSortfalse}
+%%# This definition achieves that for the text output a space should follow,
+%%# but not for the sort output. Of course, you can also use similarly the
+%%# commands \varindexSpaceTextfalse and/or \varindexSpaceSorttrue
+%%# in the above definition (the effect should be obvious).
+%%# In particular, \varindexNextSpace is equivalent to
+%%# \varindexSpaceTexttrue\varindexSorttrue.
+%%#
+%%# The macro \varindexPreceeds... is similarly as \varindexFollows... with
+%%# the difference that it is executed BEFORE the token in question is
+%%# output. In particular, you can ignore a previous `magic space'.
+%%# All of the `magic space' commands are defined by default with
+%%# \let\varindexFollows...\toolboxEmpty
+%%# \let\varindexPreceeds...\varindexNoNextSpace
+%%# with the following two exceptions:
+%%# \let\varindexFollowsExclam\varindexNoNextSpace
+%%# \let\varindexFollowsComma\varindexNextSpace
+%%#
+%%# Documented Features (in later versions, these will still be available,
+%%# and if they contain a bug now, they will be repaired to work this way):
+%%#
+%%# (In a future release, varindex will cook your coffee, too)
+%%#
+%%#
+%%#
+%%# The main argument is NOT expanded, so you can actually write macros
+%%# into the *.idx file. The command actually used to write the index is
+%%#
+%%# \varindexIndex
+%%#
+%%# (which by default is of course defined as \index).
+%%# Since some implementations of the \index command still (partially) expand
+%%# their argument (which might be considered as a bug), the argument of
+%%# \varindexIndex is translated before the actual call with the aid of
+%%# \toolboxMakeHarmless.
+%%# If you want to redefine \varindexIndex to a personal \index-output
+%%# function, you might want to skip the \toolboxMakeHarmless step.
+%%# This is arranged with the command
+%%#
+%%# \varindexNoConvert
+%%#
+%%# You can cancel the effect of this command with
+%%#
+%%# \varindexDoConvert
+%%#
+%%# Even if \varindexNoConvert is not in effect, the main argument is not
+%%# expanded (and in particular, the argument of \varindexIndex consists of
+%%# the corresponding entries in an unexpanded form).
+%%#
+%%# The whole \varindex... procedure takes place in a group, so all your
+%%# variables are local to a single call (unless you use \gdef...
+%%# (and friends) of course).
+%%#
+%%# There are no \global directives in any macro related with this package.
+%%# In particular, if you call the above macros in a group (or redefine
+%%# \varindexIndex), the effect holds only until the end of the group.
+%%#
+%%# In contrast to the main argument, the format argument is expanded
+%%# (with \varindexedef, see below)
+%%# (and also formatA resp. format*A is expanded before),
+%%# so you can define abbreviations (even simple conditional abbreviations)
+%%# for the format. Note, however, that the expansion is essentially only
+%%# evaluated with \edef. So, you will probably not want to use e.g. \relax,
+%%# since this command expands to itself (and not into nothing - use
+%%# \toolboxEmpty if you want the latter).
+%%# If you want more complex abbreviations, use {mainprogram} instead.
+%%#
+%%# In order to help you write conditional abbreviations, the
+%%# following variables are defined when your macro is expanded (and in
+%%# particular also in {mainprogram}). You may of course redefine them
+%%# appropriately:
+%%#
+%%# \varindexAppend The argument pagestyleA resp. pagestyleB.
+%%# \varindexCount a TeX counter containing the number of entries in
+%%# the main argument.
+%%# \varindexLastEntry This is a macro (NOT a counter) which is usually
+%%# the value of \the\varindexCount. See below.
+%%# \varindexEntry1-... The (index) text occuring in entry 1-...
+%%# \varindexSort1-... The corresponding sort entry. If no sort entry was
+%%# given, this is the same as the corresponding
+%%# \varindexEntry1-...
+%%# \varindexPlain1-... The text which should be output in the text. If no
+%%# such entry was given, this is the same as the
+%%# corresponding \varindexEntry1-...
+%%#
+%%# \varindexCount may be larger than 10, and correspondingly there may be
+%%# also more than 10 different \varindexEntry/Sort/Plain macros.
+%%# If you ADD entries, you have to increase \varindexCount correspondingly,
+%%# otherwise an error is produced if the format string contains an entry
+%%# larger then \varindexCount. However, your additional entries are NOT
+%%# output for EMPTY formats: For empty formats the number used is
+%%# \varindexLastEntry. So if you want to output also your additional entries
+%%# in empty formats, you have to set \varindexLastEntry to your modified
+%%# value of \varindexCount in mainprogram. You may e.g. achieve this with
+%%# the following lines:
+%%# \expandafter
+%%# \def\expandafter\varindexLastEntry\expandafter{\the\varindexCount}%
+%%# It is admissible that \varindexLastEntry is larger than \varindexCount:
+%%# In this case all entries until \varindexLastEntry are
+%%# output in empty formats without producing an error (provided, of course,
+%%# that the corresponding variables \varindexEntry.../Sort.../Plain... are
+%%# defined).
+%%#
+%%# Note that numbers in TeX command names require special handling,
+%%# i.e., you have to use something like
+%%#
+%%# \csname varindexPlain2\endcsname
+%%#
+%%# to access variables. To avoid this, you may want to use the macros
+%%# \toolboxLet and \toolboxWithNr of the toolbox package. Examples are
+%%# \toolboxWithNr 1\let{varindexEntry}\toolboxEmpty
+%%# \toolboxWithNr {10}\def{varindexSort}{Foo}
+%%# \toolboxLet \mymacro{varindexPlain\the\mycount}
+%%# These commands set \varindexEntry1 to \toolboxEmpty, \varindexSort10 to
+%%# Foo, and \mymacro to the content of \varindexPlain5 (if \mycount=5).
+%%#
+%%# All these variables are also available when {mainprogram} is expanded.
+%%# In {mainprogram} also the following functions are useful:
+%%#
+%%# \varindexFormat
+%%# This macro expands to the actual format string which is used.
+%%# The main purpose of {mainprogram} will usually be to (re)define
+%%# this macro. After {mainprogram} has been called, this macro is
+%%# modified in several ways:
+%%# 1. \varindexFormat is expanded (with \varindexedef, see below).
+%%# (thus, \varindexFormat is expanded BEFORE AND AFTER the call
+%%# of {mainprogram}).
+%%# 2. \ifvarindexStar is true (see below) a `*' resp. `* ' is prepended.
+%%# 3. If it is only "*", it is replaced by "* ".
+%%# Note that before execution of {mainprogram}, no tests on the
+%%# validity of the format are done: You may use your own symbols to
+%%# `communicate' with {mainprogram} (if {mainprogram} eliminates these
+%%# symbols afterwards).
+%%#
+%%# \varindexFormatDefault
+%%# This macro expands to formatA resp format*A (in the expanded form)
+%%# depending whether the * flag has been used in the call.
+%%# Note that this expansion was executed BEFORE the optional format
+%%# argument is expanded for the first time.
+%%#
+%%# \ifvarindexStar ifpart [ \else elsepart] \fi
+%%# If the optional * was given, the ifpart is executed, otherwise the
+%%# else-part. This is a TeX-if-command. In particular, by
+%%# \varindexStarfalse resp. \varindexStartrue
+%%# you may change the behavior for future if's. This can be used
+%%# to prevent/force that a `*' resp. `* ' is prepended to the format
+%%# after the execution of {mainprogram}.
+%%# Setting of this variable has no effect in {scanprogram}
+%%#
+%%# \ifvarindexExplicitFormat
+%%# This is a TeX-if-command (see above) which is true if the optional
+%%# format argument [formatB] was given.
+%%#
+%%#
+%%# To "compose" the format, you may want to use the macros
+%%#
+%%# \toolboxDef\macrotodefine{argumentlist}
+%%# \toolboxAppend\macrotoappend{argumentlist}
+%%# \varindexedef\macrotodefine{argumentlist}
+%%#
+%%# All commands work similar to \def resp. \edef with two differences:
+%%#
+%%# For \toolboxDef\macro the argumentlist is expanded precisely by one level
+%%# (for details, see the documentation of the toolbox package).
+%%# Of course, for \toolboxAppend, the new definition is appended to the old
+%%# definition of \macro.
+%%#
+%%# \varindexedef fully expands argumentlist. However, some active symbols
+%%# (currently only ~, but additional symbols might follow in a future release)
+%%# are deactivated before expansion, so that ~ actually expands to ~ and not
+%%# to a strange command sequence.
+%%#
+%%#
+%%# To "decompose" the format, you may want to use one of the macros
+%%#
+%%# \toolboxSplitAt{arg}{critical}{\before}{\after}
+%%# \toolboxMakeSplit{critical}{command} resp.
+%%# \varindexMakeSplitExpand{\MacrosWhichExpandToCritical}{command}
+%%# \varindexMakeVarSplit\variable{\MacrosWhichExpandToCritical}{command}
+%%#
+%%# The first two macros are described in the toolbox package.
+%%# The remaining two macros are similar to \varindexMakeSplit with the
+%%# difference that the argument {critical} is obtained by expanding
+%%# \MacrosWhichExpandToCritical with the aid of \varindexedef.
+%%# In the last form, additionally \variable is (re)defined to expand to
+%%# the value of critical.
+%%#
+%%# The following instances of a command created by \toolboxMakeSplit
+%%# exist (the content of "critical" should be obvious):
+%%#
+%%# \varindexSplitAtIndex (generated by \varindexSetIndexString)
+%%# \varindexSplitAtOutput
+%%# \varindexSplitAtTildeA
+%%# \varindexSplitAtTildeB
+%%# \varindexSplitAtSpace <- Here the default content of "critical" is "_"
+%%# \varindexSplitAtSpaceTok<- Here the default content of "critical" is "s"
+%%# \varindexSplitAtOmit
+%%# \varindexSplitAtComma
+%%# \varindexSplitAtDash
+%%# \varindexSplitAtExclam
+%%# \varindexSplitAtNr?? (here, ?? is the number as a string; use
+%%# \csname ....\endcsname to call this macro. Only those numbers are
+%%# admissible which have been introduced with \varindexSetStringForNr
+%%# (this is the case for 1-10)).
+%%#
+%%# There is also the instance
+%%# \varindexSplitSpace (to be distinguished from \varindexSplitAtSpace)
+%%# where "critical" is the space symbol.
+%%#
+%%#
+%%# In addition, you may use the variables
+%%# \varindexIndexString
+%%# \varindexOutputString
+%%# \varindexTildeAString
+%%# ....
+%%# \varindexNr??String
+%%# which expand to the corresponding strings.
+%%#
+%%# All the previous macros should not be redefined `by hand'.
+%%# They are implicitly redefined by the \varindexSet... commands.
+%%#
+%%#
+%%#
+%%#
+%%# To drop possible braces, use the command
+%%#
+%%# \toolboxDropBrace\variable
+%%#
+%%# of the toolbox package.
+%%#
+%%#
+%%# In {scanprogram} you may already want to call \toolboxMakeSplit:
+%%# In this way many choices for the tokens are put into {scanprogram},
+%%# and in this sense, you can consider {mainprogram} as `customizable'.
+%%# Anyway, the main task of {scanprogram} is to introduce new flags with
+%%#
+%%# \varindexNewFlag\token\position[program\varindexEndOfFlag]
+%%# or
+%%# \varindexNewFlag\token\position[\programmacro]
+%%#
+%%# Here, \position is an (undefined) macro, and \token an arbitrary token.
+%%# The [program(macro)] part is optional and is explained later.
+%%# If token is entered in the current call of \varindex instead (or in
+%%# addition to) the star, then \position is defined to expand to a
+%%# (literally) number, namely the (last) position where token was given
+%%# inside the "*-argument-list" (counting from 0). For example, if
+%%# \varindexNewFlag ,\commapos
+%%# \varindexNewFlag -\minuspos
+%%# \varindexNewFlag .\pointpos
+%%# are used in \programA, then in the call
+%%# \varindex(){\programA}{\programB},-**-{}
+%%# the variable \commapos will expand in \programB to `0', while
+%%# \minuspos will expand to `4' (the last position is taken). Finally,
+%%# \pointpos is \undefined (unless you defined \pointpos differently AFTER
+%%# the call of \varindexNewFlag; in this case, this is the default).
+%%# If \varindexNewFlag is called multiple times with the same token,
+%%# only the LAST call with this token takes effect.
+%%#
+%%# The flags `*' and `1' are introduced in this way with
+%%#
+%%# \varindexNewFlag *\varindexStarPos
+%%# \varindexNewFlag 1\varindexOneEntry
+%%#
+%%# BEFORE {scanprogram} is executed. This means:
+%%# 1. Usually, \varindexStarPos contains the (last) position of `*'
+%%# (resp. is undefined). Moreover, if you define \varindexStarPos in
+%%# {scanprogram} or in some flag, you get the same effect as if `*'
+%%# had been used.
+%%# An analogous remark holds for \varindexOneEntry.
+%%# 2. If you introduce `*' with \varindexNewFlag, the `*' looses its
+%%# original meaning. The same holds for `1'.
+%%#
+%%# If you have added a [program(macro)] part, this part is expanded
+%%# whenever the flag introduced by \token is used in the call of \varindex
+%%# (note that it is not excluded that this happens several times within one
+%%# call). More precisely, program is expanded AFTER the variable \position has
+%%# been set to the corresponding value, so you may already use \position in
+%%# the program part.
+%%#
+%%# IMPORTANT: The last token expanded in program MUST be \varindexEndOfFlag.
+%%# This is not nice but has to do with the way TeX parses its arguments.
+%%# Also if you use the form \programmacro, the VERY LAST token expanded
+%%# must be \varindexEndOfFlag. Even a construction like
+%%# \def\myprogrammacro{\ifx....
+%%# \CallSomeMacroWithvarindexEndOfFlagAtTheEnd
+%%# \fi
+%%# \varindexEndOfFlag}
+%%# is forbidden: In \CallSomeMacroWithvarindexEndOfFlagAtTheEnd an error
+%%# would occur at the end, since still the tokens \fi\varindexEndOfFlag
+%%# are in the tokenlist when EndOfFlag is reached there.
+%%# As a workaround, you may e.g. use
+%%# \def\myprogrammacro{\ifx...
+%%# \def\execute{....\varindexEndOfFlag}%
+%%# \else
+%%# \def\execute{\varindexEndOfFlag}%
+%%# \execute}
+%%#
+%%# If you use the form [\programmacro], your macro may even read additional
+%%# parameters. These parameters are expected in the call of \varindex BEHIND
+%%# the flag you have introduced. So you may actually use flags with
+%%# parameters. For example, if \scanprogram contains a macro like
+%%# \varindexNewFlag -\minuspos[\readpara]
+%%# and you have defined
+%%# \def\readpara#1{\def\merk{#1}\varindexEndOfFlag}
+%%# then the call \varindex(){\scanprogram}{\mainprg}*-{Foo}-{Foo 2}*{Entries}
+%%# is admissible, and in mainprogram, \merk will have the value Foo 2.
+%%#
+%%# If you are more familiar with TeX, you can even allow OPTIONAL arguments
+%%# following your flag: The value of the next (non-space) token is at the
+%%# call of \programmacro already saved into the variable
+%%# \varindexNextToken,
+%%# so you can just use it to test for e.g. [. In this connection, you may
+%%# also want to use the commands
+%%# \varindexTestAndExec
+%%# \varindexSkipAndExec
+%%# Please, see the program text how these commands are applied.
+
+%%# Since version 2.1 you can also hack in personal extensions of the format
+%%# string. To do this, use the command
+%%#
+%%# \varindexNewFormat\splitcommand{action}
+%%#
+%%# Here, \splitcommand is a command generated by \toolboxMakeSplit or
+%%# friends (preferably by \varindexMakeSplitExpand, because the command should
+%%# act on the format string which is expand with \varindexedef).
+%%# The string where it splits is the new string you can use
+%%# in the format argument after this call. For each
+%%# occurrence of the corresponding string in the format argument,
+%%# action will be executed. If \splitcommand splits at a string which already
+%%# had a previous meaning in the format string (or which is a prefix to
+%%# such a string), the old meaning of these tokens in the format string is
+%%# overridden.
+%%#
+%%# Typically, action will contain the following commands:
+%%# One action will probably be to output a desired token (sequence) via
+%%#
+%%# \varindexTokensOut{TextToken}{SortToken}
+%%# or
+%%# \varindexTokensOutExpand\MacroForTextToken\MacroForSortToken
+%%#
+%%# In the first form, TextToken resp. SortToken is the token sequence put
+%%# into the index or running text respectively into the sort entry of the
+%%# index for the corresponding format entry. The second form is similar with
+%%# the only difference that the arguments must be single macros which expand
+%%# to TextToken and SortToken, respectively.
+%%#
+%%# The variable \ifvarindexIndexMode can be used to test whether the
+%%# output goes into the running text or into the index (i.e. whether a `*'
+%%# preceeded the current entry). For output into the text, SortToken is
+%%# ignored, of course).
+%%#
+%%# Another action in \varindexNewFormat will probably be to take care of the
+%%# magic space flags. This is achieved by a call to \varindexNextSpace or
+%%# \varindexNoNextSpace (or separately via \varindexSpaceTexttrue/false resp.
+%%# \varindexSpaceTexttrue/false); see the earlier description.
+%%# The magic space flags are taken into account in "\varindexTokensOut".
+%%# Thus, if you want to ignore the previous flag for some reason you should
+%%# set them correspondingly before this call.
+%%# However, after the call you should also set them correspondingly for
+%%# further processing.
+%%#
+%%# Example:
+%%# \varindexMakeSplitExpand{:}{splitAtColon}
+%%# \varindexNewFormat\splitAtColon{%
+%%# \varindexNoNextSpace
+%%# \ifvarindexIndexMode
+%%# \varindexTokensOut{:}{}\varindexSpaceTexttrue
+%%# \else
+%%# \varindexTokensOut{---}{}\varindexNoNextSpace
+%%# \fi}
+%%#
+%%# defines a new format entry `:' which has the meaning that a colon
+%%# (automagically followed by a space) is put into the index but not into
+%%# the sort entry. Moreover, in the running text, the colon appears as a
+%%# long dash with no space followed. In any case, there is no magic space
+%%# output in front of the colon.
+%%#
+
+%%# As an alternative action in \varindexNewFormat, you can also call the
+%%# default commands for the format entries. The corresponding macros are
+%%#
+%%# \varindexAddSpace _
+%%# \varindexAddSpTok s
+%%# \varindexAddOmit .
+%%# \varindexAddDash -
+%%# \varindexAddComma ,
+%%# \varindexAddExclam !
+%%# \varindexAddTildeA ~
+%%# \varindexAddTildeB =
+%%# \varindexAddNumber{number} 0-9 (the argument is 1-...)
+%%#
+%%# The precise meaning of these macros is intentionally NOT documented,
+%%# because some details or side effects might change in a future release of
+%%# "varindex". But just for this reason, it might be advantageous to use the
+%%# above macros instead of writing personal substitutes which may fail to
+%%# have such side effects.
+%%#
+%%# Example:
+%%# \varindexMakeSplitExpand{~-}{splitPhrase}% It is important to expand
+%%# % (to have correct ~ catcode)
+%%# \varindexNewFormat\splitPhrase{%
+%%# \varindexAddTildeA
+%%# \let\remember\varindexPreceedsDash
+%%# \let\varindexPreceedsDash\toolboxEmpty
+%%# \varindexAddDash
+%%# \let\varindexPreceedsDash\remember}
+%%#
+%%# After the above command, "~" and "-" have their usual meaning in
+%%# the format string except when they follow immediately in the form "~-".
+%%# In this case, the behavior of "-" changes as if \varindexPreceedsDash
+%%# were empty (which has the effect that the output looks like "~ -" instead
+%%# of "~-".
+%%# Note that although "~" is a prefix to "~-", the converse is not true:
+%%# Thus, the above command does not change the previous meaning of "~"
+%%# (and of course also not of "-").
+
+%%#
+%%# Some hack:
+%%# Tex ignores leading spaces in the argument list of a `normal' macro.
+%%# This has the effect that you should be able to insert spaces BETWEEN any
+%%# of your arguments without any trouble.
+%%# If this does not work the expected way, you can use the command
+%%#
+%%# \let\varindexArgumentSpace\varindexSkipTricky
+%%#
+%%# which implements an own macro which does this task. Sadly, this can only
+%%# be done with some catcode trickery which in turn might bring you in trouble
+%%# with some (VERY) exotic packages. You can restore the default with
+%%#
+%%# \let\varindexArgumentSpace\varindexSkipDefault
+%%#
+%%#
+%%# All above custamization commands/variables may be used anytime between
+%%# two \varindex calls. They take effect with the next \varindex call.
+
+
+
+%%# The macros \varindextwoScan and \varindextwo are considered as a
+%%# (very useful) EXAMPLE for the customization of the \varindex command.
+%%# If you need further customization, have a look at their definition first.
+
+% This is the end of the ascii documentation
+%</asciidocu>
+%\fi\catcode\#6\relax
+%
+% \iffalse
+%<*metainfo>
+% \fi
+
+% \def\basename{varindex}
+
+%% \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 \~}
+
+% \CheckSum{2042}
+
+% \iffalse
+% \RecordChanges
+% \fi
+% \def\mypar{}
+% \def\ChangesTab{}\let\orichanges\changes
+% \def\changes#1#2#3{\orichanges{#1}{#2}{#3}%
+% \expandafter\def\expandafter\ChangesTab\expandafter{\ChangesTab
+% \item[v#1 {\mdseries(\emph{#2})}] {#3.}}}
+% \newcommand{\cmdcite}[1]{\texttt{\textbackslash#1}}
+
+% \changes{2.3}{2001/05/06}{Introduced new macros \cmdcite{varindexIndex},
+% \cmdcite{varindexDoConvert}, \cmdcite{varindexNoConvert}.
+% The layout of the documentation was slightly improved.
+% Moreover, a completely new section was added (on
+% \cmdcite{toolboxMakeDef}).\mypar
+% Use \cmdcite{typeout} instead of \cmdcite{message},
+% but provide a workaround for plain \TeX. Avoid error with
+% plain \TeX\ and \LaTeX 2.09 (because \cmdcite{newcount} is
+% defined there as \cmdcite{outer} which is rather annoying).
+% Since \texttt{toolbox} works around this problem, finally also
+% the local \cmdcite{if}'s now actually \emph{are} local}
+% \changes{2.2}{2001/05/01}{Introduced \texttt{=:\^} flags into
+% \cmdcite{varindextwo}. Changed sorting of entries
+% starting with ``\texttt{-}''
+% (see \cmdcite{varindexOutSortDashBeg}).\mypar
+% Improved documentation, in particular of \cmdcite{varindextwo}
+% and \cmdcite{varindexNewFormat}.
+% Also new examples were added for both commands}
+% \changes{2.1}{2001/04/30}{Finally implemented placeholder replacement
+% (\cmdcite{varindexPreviousATexttrue} and friends) such that
+% it works also in the expected way with commas.\mypar
+% Introduced separated command \cmdcite{varindexCommaExpandtrue}
+% which was in earlier versions automatically coupled with
+% \cmdcite{varindexCommaLeadstrue}. Changed the default of both
+% values to `true'.\mypar
+% Introduced \cmdcite{varindexOutText...} and friends and enabled
+% a hook into the format string processing via
+% \cmdcite{varindexNewFormat}.\mypar
+% Reordered documentation such that the more interesting
+% customization parts are now mentioned earlier}
+% \changes{1.21}{2001/03/29}{Divided package into two: Many macros which are
+% of independent interest have been put into the \texttt{toolbox}
+% package. For the user visible is that the macros are now called
+% e.\,g.\ \cmdcite{toolboxMakeSplit} instead of
+% \cmdcite{varindexMakeSplit}. For backward compatibility,
+% the old (now obsolete) names are still available, although not
+% documented anymore}
+% \changes{1.20}{2001/01/13}{Changed \cmdcite{varindextwo}:
+% Added the \cmdcite{varindextwoCommaTilde} functionality and the
+% corresponding three flags \texttt{?!/}. Moreover, changed the
+% default to \cmdcite{varindextwoCommaTildetrue}. Note that due to
+% this change the generated index entries may differ from those
+% of earlier versions. To get a backward compatible output,
+% you have to use \cmdcite{varindextwoCommaTildefalse}.\mypar
+% Also use now the symbols \texttt{`} and \texttt{'}
+% instead of the (now obsolete) \texttt{P} and \texttt{p} flags.
+% The reason for the latter is that \texttt{P} and \texttt{p}
+% could not be used immediately after a command without a space}
+% \changes{1.19}{2000/12/07}{Eliminated a bug in the \texttt{P} flag}
+% \changes{1.18}{2000/11/30}{Eliminated a bug in \cmdcite{SkipTricky}}
+% \changes{1.17}{2000/11/21}{\cmdcite{varindexNr??String} is now defined
+% as documented}
+% \changes{1.16}{2000/11/19}{Documentation rewritten
+% for doc and docstrip utilities (required files are now
+% \texttt{varindex.dtx} and \texttt{varindex.ins})}
+% \changes{1.15}{2000/10/10}{Fixed harmless bug which always caused a warning}
+% \changes{1.14}{2000/06/01}{First version released into public
+% (as \texttt{varindex.sty})}
+%
+% \iffalse
+%
+% The following part is the code needed to compile the documentation.
+% We do some trickery here, because we want that this file here could be used
+% for *both*: Compiling the documentation *and* as `varindex.sty'
+% (if really required).
+% Everything between the lines %<*driver> and %</driver>
+% goes to the file `varindex.tex'.
+%
+% \fi
+\ifcat @a% If this test is positive, then `@' has letter catcode which means
+% that this file is loaded as a style file (or as described in the
+% install section of the documentation).
+\def\TemporaryDummy{}
+\else\long\def\TemporaryDummy{%
+%
+%
+% \iffalse
+%</metainfo>
+%<*driver>
+\documentclass{ltxdoc}
+\OnlyDescription%% Comment this out, or
+%%\AlsoImplementation%% uncomment this line, if you want to see the source.
+
+%% If you want an index, uncomment one of the following lines.
+%% After running latex a first time, you have to use
+%% makeindex -s gind.ist varindex
+%% Then run latex again.
+%%\CodelineIndex% comment this out if you want an index referring to codelines
+%%\PageIndex% comment this out if you want an index referring to pages
+%%\OldMakeindex% uncomment this line, if your MakeIndex is pre-v2.9
+
+\setlength\hfuzz{15pt}
+\hbadness=7000
+\begin{document}
+\DocInput{varindex.dtx}
+\end{document}
+%</driver>
+%<*metainfo>
+% \fi
+}
+\fi\TemporaryDummy\let\TemporaryDummy\undefined
+%
+% \iffalse
+% Personal macros used for the doc utility:
+% \fi
+% \MakeShortVerb{"}
+% \def\bracemeta#1{\texttt{\{}\meta{#1}\texttt{\}}}
+% \def\nocomment{}
+% \def\myspace{\texttt{\textvisiblespace}}
+% \parindent0pt
+
+%
+% \newenvironment{myquote}{\begin{quote}\begin{raggedright}\relax
+%}{\end{raggedright}\end{quote}}
+% \newenvironment{myindex}{\begin{myquote}}{\end{myquote}}
+% \def\myi{\par\hangindent 40pt\relax}
+% \def\mys{\myi\hspace*{20pt}}
+% \def\myss{\myi\hspace*{30pt}}
+% \def\pnoa#1{, #1}
+% \def\pno{\pnoa{17}}
+% \def\mysee#1{\pnoa{\emph{see also} #1}}
+% \def\sortedlike#1{\hspace*{10pt}(\emph{sorted like} #1)}
+% \def\sortedlikeq#1{\sortedlike{``#1''}}
+% \def\proz{\texttt{\%}}
+% \def\ppari{\proz\\\hspace*{20pt}}
+% \def\pari{\\\hspace*{20pt}}
+% \def\myquad{\mbox{$\qquad$}}
+% \def\macrott#1{{\mdseries\cmdcite{#1}}}
+
+% \sloppy
+% \title{The \texttt{varindex} package\thanks
+% {The package has version number \fileversion{}, last revised \filedate.}}
+% \author{Martin V\"ath\thanks{This package bases on ideas of
+% \texttt{indextwo.sty} which was written jointly with
+% O.~Karch \texttt{karch@informatik.uni-wuerzburg.de} and
+% H.-C.~Wirth \texttt{wirth@informatik.uni-wuerzburg.de}}\\
+% {\texttt{vaeth@mathematik.uni-wuerzburg.de}}}
+% \date{\docdate}
+% \maketitle
+
+% \begin{abstract}
+% This \LaTeX\ package provides a luxury front-end for the "\index" command.
+% For example, it allows to generate multiple \index entries in
+% almost any form by a single command. It is extremely customizable, and works
+% with all versions of \LaTeX\ and probably most other \TeX\ formats, too.
+% \end{abstract}
+
+% You may copy this package freely, as long as you distribute only unmodified
+% and complete versions.
+
+% \tableofcontents
+
+% \section{Changes}
+%
+% \begin{description}
+% \def\mypar{\par}\ChangesTab
+% \end{description}
+%
+
+% \section{Introduction}
+%
+% If you have to write an index for a larger scientific text, you will probably
+% sooner or later have the problem that you want to put certain texts into the
+% index which consist of more than one word like \emph{Theorem of Picard}.
+% \par
+% There are several reasonable ways how one might do this: One might put the
+% text "Theorem of Picard" in the index, or "Picard theorem".
+% An alternative way is "Picard, Theorem", or "Picard's Theorem"
+% or "Theorem!Picard"
+% (here, "!" is the symbol used by "makeindex" to separate a
+% subindex, i.\,e.\ the output will actually look like
+% \begin{myindex}
+% \myi Theorem
+% \mys Picard\pno
+% \end{myindex}
+% This is useful if one also has other entries starting with \emph{Theorem}).
+% Several other natural alternatives are also possible.
+% \par
+% One may choose some or all of the above alternatives and then code them into
+% \TeX. However, if more than one of these alternatives is desired in the
+% index, this requires several "\index" commands (which are similar but not
+% identical). Moreover, if later another choice of the above alternatives
+% is required, the index entries must be completely rewritten.
+% This rewriting may be very cumbersome if one makes use of subindices
+% for two reasons.
+% \par
+% First, it may happen that one has to change even entries which are
+% apparently not affected. For example, assume there were just two subindices
+% for the index entry \emph{Theorem}, namely "Theorem!Picard" and
+% "Theorem!Riemann". If the theorem of Picard is eliminated from the main
+% text, one not only has to delete the entry "Theorem!Picard": The single
+% subindex "Theorem!Riemann" does not make much sense -- one should replace
+% it by "Theorem, Riemann". One could write a program to do this task
+% automatically, but my experience shows that it is better to do such things
+% by hand, because there are some situations where exceptions are desirable.
+% \par
+% However, things become really cumbersome, if one also has to sort the
+% entries in a different way than they are written. For example, suppose
+% that instead of \emph{Theorem} in the above example, one has the text
+% \emph{$\zeta$-function} which one wants to have sorted like
+% \emph{zeta-function}. In this case, the "\index"
+% command must be changed from
+% \begin{verbatim}
+% \index{zeta-function@$\zeta$-function!Riemann}\end{verbatim}
+%
+% into
+% \begin{verbatim}
+% \index{zeta-function, Riemann@$\zeta$-function, Riemann}\end{verbatim}
+%
+% which is rather different!
+% \par
+% Moreover, one may also want to have a placeholder. For example, instead of
+% generating the entries
+% \begin{myindex}
+% \myi Theorem
+% \mys Liouville\pno
+% \mys Open Mapping\pno
+% \mys Picard\pno
+% \end{myindex}
+% One might like to have entries like
+% \begin{myindex}
+% \myi Theorem
+% \mys $\sim$ of Liouville\pno
+% \mys Open Mapping $\sim$\pno
+% \mys $\sim$ of Picard\pno
+% \end{myindex}
+% One might use the symbol "$\sim$" for the placeholder, but this needs of
+% course its own sort entry in the "\index" command (in the above example,
+% we sorted by \emph{Liouville}, \emph{Open Mapping}, and \emph{Picard},
+% respectively, which is perhaps the most natural choice).
+% \par
+% With the package "varindex" it is rather simple to generate any of the
+% above "\index" entries, and it is easy to modify them, e.\,g.\ the above
+% placeholders can be introduced easily and then activated or deactivated by
+% a switch. Moreover, several "\index" entries like "Picard, Theorem of"
+% and "Theorem of Picard" can be generated simultaneously with a
+% \emph{single} command (i.\,e.\ you have to write the phrase
+% "Theorem of Picard" only once). In addition, it is also possible to produce
+% not only corresponding "\index" commands but also to output the content
+% into the running text.
+% \par
+% Since my experience shows that in each new book there arise new special cases
+% for the "\index" command, I was trying to provide a
+% \emph{highly customizable} solution which can be modified for all
+% needs (I hope).
+
+% \section{Installation}
+%
+% This package was tested with \LaTeX 2.09 and \LaTeXe\ and should work
+% with all other (future) versions of \LaTeX\ and friends, too.
+% It should even run with other (non-\LaTeX) formats if an "\index" command
+% (with \LaTeX-Syntax) is provided.
+%
+% To use ``varindex'', you have to put the file "varindex.sty" in a path where
+% \TeX\ looks for its input files. You must also have the file "toolbox.sty"
+% of the ``toolbox'' package in your path (toolbox~v3.1 or newer is required).
+% The \TeX\ documents using varindex need the
+% following modifications in their header:
+%
+% \begin{itemize}
+% \item If you use \LaTeXe, put in the preamble the command
+% \begin{verbatim}
+% \usepackage{varindex}\end{verbatim}
+%
+% \item If you use \LaTeX 2.09, use "varindex" as a style option, e.\,g.\
+% \begin{verbatim}
+% \documentstyle[varindex]{article}\end{verbatim}
+% or
+% \begin{verbatim}
+% \documentstyle[varindex,12pt]{article}\end{verbatim}
+%
+% \item If you use some other (non-\LaTeX) format, you will probably have to
+% insert a line like
+% \begin{verbatim}
+% \catcode`\@=11\relax\input varindex.sty\catcode`\@=12\relax\end{verbatim}
+%
+% \end{itemize}
+%
+% For \TeX\ insiders: \LaTeX-specific commands used in "varindex.sty" are only:
+%
+% \begin{itemize}
+% \item "\makeatother"
+% \item "\makeatletter"
+% \item "\typeout"
+% \item "\RequirePackage"
+% \item "\newcommand" (used only in the form "\newcommand{"\meta{command}"}{}"
+% to ensure that \meta{command} was not defined before)
+% \item "\ProvidesPackage"
+% \end{itemize}
+% The above commands are used only if they are defined (otherwise,
+% natural substitutes are used ("\newcommand" and "\ProvidesPackage" are
+% then not used at all)).\bigskip
+
+% \section{Additional hint}
+%
+% Although this package provides a convenient way to write "\index" commands,
+% this may not be sufficient: Also with this package, the "\index" commands
+% may still be rather complex. For some books, it might be necessary to write
+% the same "\index" entries several times (to get various page numbers).
+% The first idea that one might have in this case is to define a list of the
+% used "\index" commands near the beginning of the document e.\,g.\ as:
+% \begin{verbatim}
+% \newcommand{\Index}{\varindex(){\varindextwoScan}{\varindextwo}[]}
+% \newcommand{\Riemann}{\Index{Riemann Stieltjes integral}[1-23 2,1-~3 3!1-2~]}
+% \newcommand{\sigmaa}{\Index-={$\sigma$@sigma algebra}}\end{verbatim}
+% (the first line and the usage of "\Index" is explained in later sections;
+% here, it is sufficient to know that "\Index" produces in the above form
+% several "\index" entries).
+% To produce the corresponding "\index" entries in the
+% running text, one then just needs to use "\Riemann" resp.\ "\sigmaa".
+% However, this method has some disadvantages:
+% \begin{enumerate}
+% \item If one has many "\index" entries, it is easy to forget that e.\,g.\
+% "\sigmaa" is a command which should produce an index entry.
+% Then "\sigmaa" in the main text might be rather confusing.
+% \item One has to take care of macros already provided by \TeX, \LaTeX\ or
+% some packages. For example, it is not possible to use the name
+% "\sigma" for the above purpose.
+% \end{enumerate}
+% To avoid these problems, one may be very disciplinary and call the
+% involved macros systematically e.\,g.\ "\IndexRiemann" "\Indexsigmaa" etc.
+% However, this produces terrible long and unreadable macro names in the main
+% text.\par
+% The "toolbox" package (version 3.1 or newer) provides a more convenient
+% solution: You can use the command
+% \begin{verbatim}
+% \newcommand{\Index}{\varindex(){\varindextwoScan}{\varindextwo}[]}
+% \toolboxMakeDef{Idx}{#1}\end{verbatim}
+% and afterwards
+% \begin{verbatim}
+% \NewIdx{R-S}{\Index{Riemann Stieltjes integral}[1-23 2,1-~3 3!1-2~]}
+% \NewIdx{sigma-algebra}{\Index-={$\sigma$@sigma algebra}}\end{verbatim}
+% After these definitions, you can use the intuitive commands
+% "\Idx{R-S}" and "\Idx{sigma-algebra}" to produce the corresponding
+% index entries.\par
+% Note also the symbol ``-'' in the above names which is usually not allowed
+% in \TeX\ macros.\par
+%
+% If several page numbers occur for one index entry, it may be convenient for
+% the reader if the ``main page number(s)'' (e.\,g.\ the place(s)
+% where the corresponding notion is defined) is written in a different style.
+% Of course, this is supported by "\varindex" (as explained later). To use this
+% feature in connection with "\toolboxMakeDef", there are several
+% possibilities. A straightforward way is to add in addition to the above
+% commands also
+% \begin{verbatim}
+% \NewIdx{R-S*}{\Index[|textbf]%
+% {Riemann Stieltjes integral}[1-23 2,1-~3 3!1-2~]}
+% \NewIdx{sigma-algebra*}{\Index[|textbf]%
+% -={$\sigma$@sigma algebra}}\end{verbatim}
+% Then "\Idx{R-S*}" and "\Idx{sigma-algebra*}" produce index entries
+% with boldface page numbers. Of course, you can automatize the task of
+% generating macros which produce normal and boldface page numbers
+% e.\,g.\ as follows:
+% \begin{verbatim}
+% \newcommand{\Index}{\varindex(){\varindextwoScan}{\varindextwo}[]}
+% \toolboxMakeDef{Idx}{#1}
+% \newcommand{\MakeIdx}[2]{%
+% \NewIdx{#1}{\Index#2}%
+% \NewIdx{#1*}{\Index[|textbf]#2}}
+%
+% \MakeIdx{R-S}{{Riemann Stieltjes integral}[1-23 2,1-~3 3!1-2~]}
+% \MakeIdx{sigma-algebra}{-={$\sigma$@sigma algebra}}\end{verbatim}
+% This provides the commands "\Idx{R-S}" "\Idx{R-S*}"
+% "\Idx{sigma-algebra}" and "\Idx{sigma-algebra*}" with the same functionality
+% as explained before.\par
+%
+% The above approach has the disadvantage that the names ``$\ldots$"*"'' have
+% automatically a fixed meaning. Alternatively, you can also generate different
+% main commands. This is immediately supported by "\toolboxMakDef":
+% \begin{verbatim}
+% \newcommand{\Index}{\varindex(){\varindextwoScan}{\varindextwo}[]}
+% \toolboxMakeDef{Idx}{\Index#1}
+% \toolboxMakeDef{IdxMain}{\Index[|textbf]#1}
+%
+% \NewIdx{R-S}{{Riemann Stieltjes integral}[1-23 2,1-~3 3!1-2~]}
+% \NewIdxMain{R-S}{%
+% {Riemann Stieltjes integral}[1-23 2,1-~3 3!1-2~]}\end{verbatim}
+% Now you can use "\Idx{R-S}" and "\IdxMain{R-S}" to produce the
+% normal respectively boldface page numbers. Of course, you can also automatize
+% in this case the task of generating these commands:
+% \begin{verbatim}
+% \newcommand{\Index}{\varindex(){\varindextwoScan}{\varindextwo}[]}
+% \toolboxMakeDef{Idx}{\Index#1}
+% \toolboxMakeDef{IdxMain}{\Index[|textbf]#1}
+% \newcommand{\NewIdxBoth}[2]{%
+% \NewIdx{#1}{#2}%
+% \NewIdxMain{#1}{#2}}
+%
+% \NewIdxBoth{R-S}{{Riemann Stieltjes integral}[1-23 2,1-~3 3!1-2~]}
+% \NewIdxBoth{sigma-algebra}{-={$\sigma$@sigma algebra}}\end{verbatim}
+% After the above commands, you can use "\Idx{R-S}", "\IdxMain{R-S}",
+% "\Idx{sigma-algebra}" and "\IdxMain{sigma-algebra}" with their obvious
+% meaning.\par\bigskip
+%
+% \textbf{Summarizing}: The last of the above solutions is the one which
+% I recommend.\par\bigskip
+%
+% For further possibilities of the "\toolboxMakeDef" command (like making
+% copies of entries, redefining entries, etc.), please read the
+% original documentation of the "toolbox" package.
+
+% \section{Examples}
+%
+% Probably you are very impatient and want to see some examples.
+% So, here you are -- but be warned that the examples are not explained in
+% detail. You have to read the later sections to understand more precisely
+% why the examples work the way they do.
+% \par
+% Since the "\varindex" command is highly customizable,
+% the following examples can only give you a rough impression of what
+% you can actually do with it.
+%
+% \subsection{Typical example of usage (using the \texttt{varindextwo} macros)}
+% \label{s:firstex}
+%
+% Suppose the following customization of the "\varindex" command was defined:
+% \begin{verbatim}
+% \def\Index{\varindex(){\varindextwoScan}{\varindextwo}[\emph]}\end{verbatim}
+%
+% Since we used the "varindextwo" macros here, by default
+% \emph{two} "\index" entries are generated with a single command.
+% After the above definition, the command
+% \begin{verbatim}
+% \Index{ring with $1$@one}\end{verbatim}
+%
+% will produces the "\index" entries for:
+%
+% \begin{myindex}
+% \myi ring
+% \mys $\sim$ with $1$\pno\sortedlikeq{with one}
+% \myi $1$\sortedlikeq{one}
+% \mys ring with $\sim$\pno\sortedlike
+% {``ring with'' (without \mbox{``$\sim$''!})}
+% \end{myindex}
+%
+% One of the examples of the introduction can be generated with
+% \begin{verbatim}
+% \Index*{Theorem of@ Picard}\end{verbatim}
+% which produces the two "\index" entries for
+%
+% \begin{myindex}
+% \myi Theorem
+% \mys $\sim$ of Picard\pno\sortedlikeq{Picard}
+% \myi Picard
+% \mys Theorem of $\sim$\pno\sortedlikeq{Theorem}
+% \end{myindex}
+% In this example, the word "of" is ignored for the sorting, because we put
+% the symbol "@"\meta{nothing} behind it which means that it should be sorted
+% as the empty string (in cases like this, also the space in front of "Picard"
+% is automatically ignored for the sort entry).
+%
+% Since we used in the above example the form "\Index*" instead of "\Index",
+% additionally the text "\emph{Theorem of Picard}" is output into the running
+% text (the string "\emph" stems from our customization of "\Index" defined
+% in the beginning).
+% \bigskip
+%
+% \emph{Completely} different entries may be generated by your own rules.
+% To this end, an optional parameter "["\meta{format}"]" can be appended.
+% Internally, the main argument is splitted into words which are numbered
+% $1,2,\ldots$; in \meta{format}, you can refer to these words simply
+% by using the corresponding numbers. An ``empty'' entry in \meta{format}
+% means all words in the original order (i.\,e.\ it is essentially equivalent
+% to $12345\ldots$). Some other symbols besides numbers are also allowed
+% which are listed later.
+%
+% \begin{verbatim*}
+%\Index{Hausdorff measure of noncompactness}[4,23 2!~34!1= ]\end{verbatim*}
+% generates \emph{three} index entries:
+%
+% \begin{myindex}
+% \myi noncompactness, measure of\pno
+% \myi measure
+% \mys $\sim$ of noncompactness
+% \myss Hausdorff $\approx$\pno
+% \myi Hausdorff measure of noncompactness\pno
+% \end{myindex}
+%
+% The last of these entries occurs only, because the last character in
+% the \meta{format} argument "[4,23"\myspace"2!~34!1="\myspace"]" is a space
+% (the space following "=" tells "varindex" that another (empty) entry is
+% desired).
+% \par
+%
+% If you want only slight modification(s) of the default, you need also just
+% slight modification(s) of the command, e.\,g.
+% \begin{verbatim}
+% \Index*,{ring with $1$@one}\end{verbatim}
+%
+% has the same effect as in our earlier example,
+% just that the second entry reads
+%
+% \begin{myindex}
+% \myi $1$, ring with $\sim$\pno\sortedlikeq{one, ring with}
+% \end{myindex}
+% Moreover, since the `"*"' occurred in the previous command, additionally
+%
+% \begin{verbatim}
+% \emph{ring with $1$}\end{verbatim}
+%
+% appears in the running text. Praxis shows that changes in the entries as
+% above have to be made frequently in the `fine tuning' of the index of a
+% book. Note that with the original "\index", the command would have to be
+% changed completely for the above entries, because we have a ``sort'' entry
+% for which a different rule applies if we use a subitem (``"!"'')
+% instead of a ``","\myspace''.
+% (BTW: "\varindex" produces sort entries only if they are necessary).
+% \par
+%
+% Of course, you may combine the default with your own format:
+% \begin{verbatim*}\Index{internal integrable function}[23,1~ +]\end{verbatim*}
+%
+% generates
+% \begin{myindex}
+% \myi internal function, integrable $\sim$\pno
+% \myi internal
+% \mys $\sim$ integrable function\pno
+% \myi function
+% \mys internal integrable $\sim$\pno
+% \end{myindex}
+% In this example, the first entry is generated by the symbols "23,1~" in the
+% \meta{format} argument, and the last two entries are those entries which
+% would have been generated by the "varindextwo" macros if no \meta{format}
+% argument had been given -- the magic symbol "+" instructs the "varindextwo"
+% macros to not suppress these entries.
+%
+%
+% \subsection{A simple example without the \texttt{varindextwo} macros}
+%
+% As known from "\index", a "|see{...}" can be used to produce a reference to
+% another index entry instead of a page number. Such a command may optionally
+% be appended.
+% \begin{verbatim*}
+%\varindex*{topology of a normed space}{5!4~!1= 45,12}[|see{norm}]
+%\end{verbatim*}
+% \begin{myindex}
+% \myi space
+% \mys normed $\sim$
+% \myss topology $\approx$\mysee{norm}
+% \myi normed space, topology of\mysee{norm}
+% \end{myindex}
+% (the precise appearance of ``\emph{see also} '' depends on how the "\see"
+% macro is defined in your style). The above command additionally inserts the
+% tokens "{topology of a normed space}" into the running text (this would not
+% happen if "\varindex" is used in place of "\varindex*").
+% Only in the first of the above entries, an `"@"' part will be added to the
+% "*.idx" file: This entry is sorted as if ``\myspace$\sim$'' resp.\
+% ``\myspace$\approx$'' would not exist.
+%
+%
+% \subsection{Another example without the \texttt{varindextwo} macros}
+%
+% The appearance of the cited page number and the appearance in the
+% running text (only available with ``"*"'') can be customized easily.
+%
+% \begin{verbatim}
+% \varindex[\emph][|textbf]%
+% {$\sigma$@sigma!$(\sigma-)$ finite {measure space}}%
+% {*1.23 23 23,1- 1-23}\end{verbatim}
+%
+% generates the three index entries
+% \begin{myindex}
+% \myi finite measure space\pnoa{\textbf{42}}
+% \myi finite measure space, $\sigma$-\pnoa{\textbf{42}}\sortedlikeq
+% {finite measure space, \mbox{sigma-}}
+% \myi $\sigma$-finite measure space\pnoa{\textbf{42}}\sortedlikeq
+% {sigma-finite measure space}
+% \end{myindex}
+% In all three entries the pages are printed using "\textbf".
+% Moreover, the tokens
+% \begin{verbatim}
+% \emph{($\sigma$-)finite measure space}\end{verbatim}
+%
+% are put into the running text.
+%
+% \subsection{A simple example using a flag
+% (without the \texttt{varindextwo} macros)}
+%
+% Note the token "1" in the following command:
+% \begin{verbatim}
+% \varindex1{$L$ and $M$@L and M}{}\end{verbatim}
+%
+% This command generates the index entry
+% \begin{myindex}
+% \myi $L$ and $M$\pno\sortedlikeq{L and M}
+% \end{myindex}
+% With the command
+% \begin{verbatim}
+% \varindex1*{$L$ and $M$@L and M}{}\end{verbatim}
+% or
+% \begin{verbatim}
+% \varindex*1{$L$ and $M$@L and M}{}\end{verbatim}
+%
+% additionally, "{$L$ and $M$}" is output into the running text.
+%
+% Note that without the `"1"', the index generated were
+% \begin{myindex}
+% \myi "$L$ and $M$ and M"\pno\sortedlikeq{"\$L\$ and L and M"}
+% \end{myindex}
+%
+% \subsection{An example for very primitive customized index commands
+% (without the \texttt{varindextwo} macros)}
+%
+% If you defined your ``default'' shortcuts appropriately, you can still
+% override some of your own defaults.
+%
+% \begin{verbatim}
+% \def\myindexA{\varindex[\emph][|textbf]*}
+% \def\myindexB{\varindex(){}{}[\emph][|textbf]}
+%
+% \myindexA{Foo1}{}
+% \myindexB{Foo2}[][]
+% \myindexB*{Foo3!{Foo 3}}\end{verbatim}
+%
+% Generates the index entries "Foo1", "Foo2", and "Foo3". Moreover,
+% "\emph{Foo1}" and "\emph{Foo 3}" is put into the running text.
+% The page number of "Foo 2" in the index is printed normal (i.\,e.\ "|textbf"
+% is overridden), the others with "\textbf". Note that by using braces,
+% it was possible to include a space into the text "Foo 3".
+%
+%
+% \subsection{An example of a primitive customized index command
+% (without the \texttt{varindextwo} macros)}\label{s:myindex}
+%
+% \TeX\ code can be inserted to customize the default formatting string.
+% \begin{verbatim}
+% \def\myindex{\varindex(\ifnum\varindexCount=2 1!2 2,1\fi){}{}[\emph]}
+%
+% \myindex{Foo Bar}\end{verbatim}
+%
+% generates the index entries
+% \begin{myindex}
+% \myi Foo
+% \mys Bar\pno
+% \myi Bar, Foo\pno
+% \end{myindex}
+%
+% \begin{verbatim}
+% \myindex*{Foo Bar}\end{verbatim}
+%
+% generates the same index entries as above and additionally outputs
+% "\emph{Foo Bar}" into the running text.
+%
+% \begin{verbatim}
+% \myindex*{other format}[21]\end{verbatim}
+%
+% generates the index entry
+% \begin{myindex}
+% \myi format other\pno
+% \end{myindex}
+% and outputs "\emph{other format}" into the running text.
+%
+% \begin{verbatim}
+% \myindex[|textbf]*{BoBo}\end{verbatim}
+%
+% generates the index entry
+% \begin{myindex}
+% \myi BoBo\pnoa{\textbf{42}}
+% \end{myindex}
+% where the page number is printed with "\textbf".
+% Moreover, "\emph{BoBo}" is output into the running text.
+%
+% \subsection{A primitive varying customized index command
+% (without the \texttt{varindextwo} macros)}
+%
+% \begin{verbatim}
+% \def\myindex{\varindex(\ifnum\varindexCount=2 1!2 2,1\fi)%
+% (\ifnum\varindexCount=2*2,1 1!2 2,1\fi){}{}[\emph]}\end{verbatim}
+%
+% With the same commands as in Section~\ref{s:myindex}, the same index entries
+% are generated, but the tokens "\emph{Far, Boo}", "\emph{other format}",
+% and "\emph{Bobo}" are output into the running text.
+%
+%
+% \subsection{Examples with the \texttt{varindextwo} macros}
+%
+% As mentioned earlier, if the "varindextwo" macros are used (and if
+% the main arguments contains at least two entries), then two
+% "\index" entries are generated by default. Roughly speaking, one "\index"
+% entry is the argument in its given order and the other is the argument in
+% reverse order (this is not precise, but explains the idea).\par
+%
+% For the following examples,
+% we use a similar definition for "\Index" as in Section~\ref{s:firstex},
+% and define an "\iemph" macro which has `"*"' as a default and outputs with
+% "\emph". I recommend to put both sort of definitions into the preamble of
+% all of your files which should use "varindex" (the names are of course
+% subject to your personal taste).
+%
+% \begin{verbatim}
+% \def\Index{\varindex(){\varindextwoScan}{\varindextwo}[]}
+% \def\iemph{\varindex(){\varindextwoScan\def\varindexStarPos{}}%
+% {\varindextwo}[\emph]}\end{verbatim}
+%
+% (note that the apparently simpler definition
+% \begin{verbatim}
+% \def\iemph{\varindex(){\varindextwoScan}{\varindextwo}[\emph]*}\end{verbatim}
+% is not as good as the above definition of "\iemph" as is explained below).
+%
+% After the above customization, you may use the following commands.
+% \begin{verbatim}
+% \Index*{measure of $\gamma$-noncompactness@gamma-noncompactness!FOO}
+% \end{verbatim}
+% generates the index entries
+% \begin{myindex}
+% \myi measure
+% \mys $\sim$ of $\gamma$-noncompactness\pno\sortedlikeq
+% {of gamma-noncompactness}
+% \myi $\gamma$-noncompactness\sortedlike{gamma-noncompactness}
+% \mys measure of $\sim$\pno
+% \end{myindex}
+% and outputs the tokens "{measure of FOO}" into the running text.
+% Note the order of the words!
+%
+% \begin{verbatim}
+% \Index*,?_'{flic of flac}\end{verbatim}
+%
+% generates
+% \begin{myindex}
+% \myi flic of flac\pno
+% \myi flac, flic\pno
+% \end{myindex}
+% and outputs "{flic of flac}". Here, the two tokens "_" and "," had the
+% effect that a space resp.\ ``","\myspace'' was used instead of a subentry
+% in the first resp.\ second "\index" entry; the token "'" caused the
+% preposition "of" to disappear in the second entry, and the token "?"
+% suppressed a trailing $\sim$ in the second entry.\par
+%
+% A more realistic example is
+% \begin{verbatim}
+% \Index^={$\sigma$@sigma algebra}\end{verbatim}
+%
+% which in both entries inserts a ``-'':
+%
+% \begin{myindex}
+% \myi $\sigma$\sortedlikeq{sigma}
+% \mys $\sim$-algebra\sortedlike{``algebra'' or ``-algebra'', see below}
+% \myi algebra
+% \mys $\sigma$-$\sim$\pno\sortedlikeq{sigma-}
+% \end{myindex}
+% Here, the sorting ``-algebra'' is chosen when you used
+% \begin{verbatim}
+% \let\varindexOutSortDashBeg\varindexOutSortDash\end{verbatim}
+% as described later.\par
+%
+% The flag "^" in conjunction with "-" has a special meaning:
+% \begin{verbatim}
+% \Index^->{$\sigma$@sigma algebra}\end{verbatim}
+% Then the first entry reads instead (the second is canceled because of ">"):
+%
+% \begin{myindex}
+% \myi $\sigma$-\sortedlikeq{sigma-}
+% \mys $\sim$ algebra\pno\sortedlikeq{algebra}
+% \end{myindex}
+%
+% Similarly, the conjunction "^" and "." has a special meaning:
+% \begin{verbatim}
+% \Index^.,:{ultra filter}\end{verbatim}
+%
+% generates entries without a space following $\sim$ (and in view of the flag
+% "," no new subentry is used for the second entry but instead a ``,''):
+%
+% \begin{myindex}
+% \myi ultra
+% \mys $\sim$filter\pno\sortedlike{filter}
+% \myi filter, ultra$\sim$\pno\sortedlike{filter, ultra}
+% \end{myindex}
+%
+% For crossreferences, one may use something like
+% \begin{verbatim}
+% \iemph[|see{recursive recursion}],_{recursive recursion}\end{verbatim}
+%
+% which generates
+% \begin{myindex}
+% \myi recursive recursion\mysee{recursive recursion}
+% \myi recursion, recursive $\sim$\mysee{recursive recursion}
+% \end{myindex}
+% and outputs "\emph{recursive recursion}". If we would have used instead the
+% definition
+% \begin{verbatim}
+% \def\iemph{\varindex(){\varindextwoScan}{\varindextwo}[]*}\end{verbatim}
+%
+% the above call were not possible, since the optional arguments "[|see...]"
+% must occur in front of the flag `"*"'.
+%
+% \begin{verbatim}
+% \Index-;*{Flip Flop}\end{verbatim}
+%
+% generates
+% \begin{myindex}
+% \myi Flip-Flop\pno
+% \myi FlopFlip\pno
+% \end{myindex}
+% and outputs "{Flip-Flop}" (note that the symbol "-" which is caused by the
+% flag "-" occurs also in the output).
+%
+% One may freely create other entries:
+% \begin{verbatim}
+% \Index>{Flippy Flop!GO}[*2-1-2 2!1-1 1-12 +]\end{verbatim}
+%
+% generates
+% \begin{myindex}
+% \myi Flop
+% \mys Flippy-Flippy\pno\qquad\emph{(no ``$\sim$''!)}
+% \myi Flippy-Flippy Flop\pno
+% \myi Flippy
+% \mys $\sim$ Flop\pno
+% \end{myindex}
+% and outputs "{GO-Flippy-GO}" (note that even without an explicit "*" flag,
+% we were able to generate this output, just by using the "*" in
+% \meta{format}).
+%
+% \begin{verbatim}
+% \Index*_,{shape {of a} of star}\end{verbatim}
+%
+% generates
+% \begin{myindex}
+% \myi shape of a star\pno
+% \myi star, shape of $\sim$\pno\sortedlike{star, shape of}
+% \end{myindex}
+% and outputs "{shape of a star}". Note that for the first entry the
+% proposition ``"of a"'' was chosen while for the second entry the
+% alternative proposition "of" was chosen.
+%
+% Also with the "varindextwo" macros the other flags keep their old meaning.
+% For example, the flag "1" still means that the main argument is
+% considered as a single entry.
+% \begin{verbatim}
+% \Index1*{$L$ feature@L feature}
+% \Index,{No $L$@L feature}\end{verbatim}
+%
+% generate
+% \begin{myindex}
+% \myi $L$ feature\pno\sortedlikeq{"L feature"}
+% \myi No
+% \mys $\sim$ $L$ feature\pno\sortedlikeq{"L feature"}
+% \myi feature, No $L$ $\sim$\pno\sortedlikeq{"feature, No L"}
+% \end{myindex}
+% and outputs "{$L$ feature}".
+%
+%
+% \subsection{Example of a simple modification of the
+% \texttt{varindextwo} macros}\label{ss:expatch}
+%
+% All flags and magic tokens in "varindextwo" can be customized to fit your
+% own taste, just by modifying "\varindextwoScan".
+%
+% \begin{verbatim}
+% \def\myindextwoScan{%
+% \varindextwoScan
+% \varindexNewFlag ~\vxtSpaceA
+% \varindexNewFlag 1\vxtSpaceB
+% \varindexNewFlag !\varindexOneEntry
+% \varindexMakeSplitExpand{/}{vxtSplitAtMagic}%
+% \def\varindexStarPos{}%
+% }
+% \def\myIndex{\varindex(){\myindextwoScan}{\varindextwo}[]}\end{verbatim}
+%
+%
+% "\myIndex" behaves similar to the previous example with
+% the following differences:
+% \begin{enumerate}
+% \item The flag "1" now has the previous meaning of "~".
+% \item One may now use "~" and "_" equivalently.
+% \item The flag "!" now has the original meaning of the flag "1".
+% \item Instead of "+" in the format string, the character "/" has to be used.
+% \end{enumerate}
+
+%
+% \section{Main Description}
+%
+% Without additional customization, there are two possible calls for the
+% \DescribeMacro{\varindex}"\varindex" command:
+%
+% \begin{enumerate}
+% \item[a)] The first call has the form
+% \begin{myquote}
+% "\varindex["\meta{textstyle}"]["\meta{pagestyleA}"]"\meta{flags}\ppari
+% \bracemeta{main entries}\bracemeta{format}"["\meta{pagestyleB}"]"
+% \end{myquote}
+% Here, "["\meta{textstyle}"]", "["\meta{pagestyleA}"]",
+% "["\meta{pagestyleB}"]", and \meta{flags} are optional.
+% (But if "["\meta{textstyle}"]" is omitted, also "["\meta{pagestyleA}"]"
+% must be omitted).
+%
+% The meaning of the arguments is as follows:
+% \begin{description}
+% \item[\mdseries\meta{textstyle}] describes the textstyle used for the output
+% into the running text (typically, textstyle is "\emph" or empty).
+% \item[\mdseries\meta{pagestyle}] describes the pagestyle used for the output
+% of the page number (you may also use a construct like "|see{...}" here).
+% If "["\meta{pagestyleB}"]" is present, this is the value used.
+% Otherwise, the value of "["\meta{pagestyleA}"]" is used
+% (resp.\ nothing).
+% \item[\mdseries\meta{flags}] can be one (or both) of the following tokens:
+% \begin{description}
+% \item[\mdseries "*"] If this token appears in \meta{flag}, it has roughly
+% the meaning ``Output into running text''. More precisely, if no
+% "*" is occurs in \meta{format} (see below), then \meta{format}
+% is automatically prepended by the tokens ``"*"\myspace'' resp.\
+% ``"*"'' (depending whether \meta{format} starts with a space
+% or not).
+% \item[\mdseries "1"] With this flag, the content of \meta{main entries} is
+% considered as a single entry (see below).
+% \end{description}
+% \item[\mdseries\meta{main entries}] and
+% \item[\mdseries\meta{format}] are explained later.
+% \end{description}
+%
+% \item[b)] The alternative form to call "\varindex" is
+% \begin{myquote}
+% "\varindex("\meta{formatA}")("\meta{format*A}")"\relax
+% \bracemeta{scan program}\ppari
+% \bracemeta{main program}"["\meta{textstyle}"]["\meta{pagestyleA}"]"\relax
+%\meta{flags}\ppari
+% \bracemeta{main entries}"["\meta{formatB}"]["\meta{pagestyleB}"]"
+% \end{myquote}
+% The arguments "["\meta{textstyle}"]", "["\meta{pagestyleA}"]", \meta{flags},
+% and "["\meta{pagestyleB}"]" have the same meaning as in a) (in particular,
+% they are optional, but if "["\meta{textstyle}"]" is omitted, also
+% "["\meta{pagestyleA}"]" must be omitted).
+%
+% Also "("\meta{format*A}")" and "("\meta{formatA}")" are optional,
+% but if "("\meta{formatA}")" is omitted, also "("\meta{format*A}")"
+% must be omitted.
+%
+% The ``default'' value for \meta{format} is \meta{formatA} resp.\
+% \meta{format*A} (depending whether the flag "*" has been used or not).
+% If "["\meta{formatB}"]" is given, then this is used as the format (i.\,e.\
+% the optional argument \meta{formatB} can be used to override the default).
+%
+% The other values are:
+% \begin{description}
+% \item[\mdseries\meta{scan program}] is executed (i.\,e.\ expanded)
+% immediately when "\varindex" reads it. This parameter can be used
+% to introduce \emph{further} flags (other than "*" and "1"), see below.
+% \item[\mdseries\meta{main program}] is executed \emph{after} the
+% \meta{format} string(s) has been expanded.
+% \end{description}
+% \end{enumerate}
+%
+% It is recommended to define personal macros which contain all parameters up
+% to the place where \meta{flags} occurs (either with or without some flags,
+% depending on the intention). See the examples section.
+% \bigskip\par
+%
+% \meta{main entries} is the main argument which has the following form
+%
+% \begin{myquote}
+% \meta{entry1}[\myspace\meta{entry2}][\myspace\meta{entry3}]$\ldots$
+% \end{myquote}
+%
+% where each of \meta{entry1} \meta{entry2} \meta{entry3} $\ldots$
+% in turn has the form
+% \begin{myquote}
+% \meta{indextext}"@"\meta{sorttext}"!"\meta{outputtext}
+% \end{myquote}
+% or
+% \begin{myquote}
+% \meta{indextext}"!"\meta{outputtext}"@"\meta{sorttext}
+% \end{myquote}
+% In each of these forms, "@"\meta{sorttext} and "!"\meta{outputtext}
+% are optional. Here,
+% \begin{description}
+% \item[\mdseries\meta{indextext}]
+% is the text which is put into the index for the entry
+% \item[\mdseries\meta{sorttext}]
+% is what is used as a sort criterion for the entry
+% \item[\mdseries\meta{outputtext}]
+% is what is output into the running text for the entry
+% \end{description}
+%
+% Note that the symbol "@" has in a sense the opposite meaning as in the
+% original "\index" command:
+% \emph{Before} that symbol, the desired text appears, and
+% \emph{after} the symbol the place where it has to be sorted.
+% However, we chose the symbols "@" and "!", because these two
+% symbols are forbidden anyway (otherwise, "makeindex" will become confused).
+%
+% As usual, multiple spaces are considered as \emph{one} space and do not
+% generate empty ``ghost'' entries. Moreover, a space after a \TeX-command
+% like "\LaTeX" is eliminated by \TeX\ and thus also not considered as a
+% separator. You may use braces"{"$\ldots$"}" either around a whole entry or
+% around \meta{indextext} or \meta{sorttext} or \meta{outputtext} to allow
+% spaces which do not act as ``separators'' in the corresponding part.
+% The braces around these parts will vanish. In particular, you may generate an
+% empty entry with "{}" or "!" or "@" (bordered by spaces).
+% If you want that braces occur in the \emph{output}, you have to add an
+% additional pair of braces. Be aware that you write sufficiently
+% many braces, if you really should need them: For example,
+% the command "\varindex{{{{A"\myspace"B}}}}{}" produces the index entry
+% "{A"\myspace"B}": The outermost pair of braces is eliminated immediately
+% by \TeX. The second pair is eliminated, because this is a pair around a
+% complete entry in \meta{main entries}. Finally, another pair is eliminated,
+% because it is a brace around \meta{indextext}.
+% With the flag `"1"', \meta{main entries} is considered as one single entry.
+% Nevertheless, also with this flag, an additional pair of braces around
+% \meta{main entry} is eliminated.\bigskip
+%
+%
+% The \meta{format} has one of the following three forms:
+% \begin{myquote}
+% \meta{IndexA}[\myspace\meta{IndexB}][\myspace\meta{IndexC}]$\ldots$\relax
+%["*"\meta{OutputA}]["*"\meta{OutputB}]$\ldots$\\\relax
+%["*"\meta{OutputA}][\myspace\meta{IndexA}][\myspace
+%\meta{IndexB}]["*"\meta{OutputC}]$\ldots$\\
+% "*"
+% \end{myquote}
+% where the order of arguments can be arbitrarily mixed (except for the first
+% \meta{IndexA} in the first form). \meta{IndexA} \meta{IndexB} $\ldots$
+% \meta{OutputA} $\ldots$ describe the format of the index entries resp.\
+% of the output into the running text.
+% The output is generated in the given order (this might be important, if
+% a pagebreak occurs during the output into the running text).
+% The last case is exceptional and equivalent to ``"*"\myspace''.
+% The following characters/strings are allowed in the format entries:
+% \par\bigskip
+%
+% \begin{tabular}[t]{ll}
+% token &meaning\\\hline
+% "1"--"9"&\meta{entry1}--\meta{entry9}\\
+% "0" &\meta{entry10}\\
+% "~" &a placeholder sign (default is $\sim$)\\
+% "=" &a secondary placeholder sign (default is $\approx$)\\
+% "_" &the space character ``\myspace''\\
+% "s" &The token ``"\space"''
+% (but ``\myspace'' is used for the sort entry)\\
+% "." &No space will follow (see below)\\
+% "," &The character ``","'' (space will follow)\\
+% "-" &The character ``"-"'' (no space will follow)\\
+% "!" &Create a new sublevel (subitem).
+% \end{tabular}\par\bigskip
+%
+% All other tokens in this argument are forbidden. (Note that the magic
+% symbol "+" in \meta{format} is handled by the "varindextwo" macros, and
+% not by "varindex").\par
+% The token ``"!"'' above makes no sense for the output in the running text
+% and thus is forbidden behind "*".\par
+%
+% By a heuristic rule, a space is automatically inserted between two entries
+% which generate non-empty text. If the heuristic rule fails, you may always
+% force a space by either ``"_"'' or ``"s"'', or forbid a space by ``"."''.
+%
+% If a format is empty, all entries are taken in the order of input.
+% Note that \TeX\ eliminates concatenated spaces, and so you are able to
+% produce an empty format entry only at the end of \meta{format} or in front
+% of a ``"*"''. If you want to force an empty \emph{output}
+% (is this ever useful?), you may use just ``"."'' as the entry.\\
+%
+% A sort entry is only written to the "*.idx" file if it differs from the
+% text entry.
+
+%
+% \section{Description of the \texttt{varindextwo} macros}
+%
+% The macros
+% \DescribeMacro{\varindextwoScan}
+% \DescribeMacro{\varindextwo}
+% \begin{verbatim}
+% \varindextwoScan \varindextwo\end{verbatim}
+%
+% can be used together as parameters \meta{scan program} resp.\
+% \meta{main program} for the "\varindex" command.
+% If "\varindex" is called with these macros, and no
+% explicit format argument is given, these macros generate a format
+% depending on the number of entries in \meta{main entries}:
+%
+% \begin{enumerate}
+% \item[a)] If there is only one entry in \meta{main entries}, then the format
+% ``"1"'' resp.\ ``"*1"\myspace"1"'' is
+% generated (depending whether the "*" flag was used or not), i.\,e.\ the
+% entry is put into the index, and printed if "\varindex" was
+% called with the "*" flag.
+%
+% \item[b)] If there are two entries in \meta{main entries}, then
+% \meta{format} becomes ``\myspace"1!~2"\myspace"1!2~"''. For example, if
+% \meta{main entries} is ``"graulty bazola"'', then the "\index" entries
+%
+% \begin{myindex}
+% \myi graulty
+% \mys $\sim$ bazola\pno
+% \myi bazola
+% \mys graulty $\sim$\pno
+% \end{myindex}
+%
+% are produced.\par
+% You can modify the first format entry with the following flags:\par
+% \bigskip
+%
+% \begin{tabular}[t]{lll}
+% flags&format used&with ``"*"'' additionally\\\hline
+% "_" &"12" &"*12"\\
+% "-" &"1-2" &"*1-2"\\
+% "^" &"1!~-2" resp.\ "1!-2" &"*1-2"\\
+% "-^"&"1-!~.2" resp.\ "1-!~2"&"*1-2"\\
+% "." &"1.2" &"*1.2"\\
+% ".^"&"1!~.2" &"*1.2"\\
+% "/" &"1!2" (without "~") &"*12"\\
+% "<" &no entry &"*12"
+% \end{tabular}\par\bigskip
+%
+% Here, the combinations "-^" and ".^" mean that both flags are used
+% (the order plays no role).
+% The output for "^" respectively "-^" is determined by the switches
+% \begin{myquote}
+% \DescribeMacro{\varindextwoDashTildetrue}"\varindextwoDashTildetrue"
+% (default)\par
+% \DescribeMacro{\varindextwoDashTildefalse}"\varindextwoDashTildefalse"
+% \end{myquote}
+% and
+% \begin{myquote}
+% \DescribeMacro{\varindextwoDashSpacetrue}"\varindextwoDashSpacetrue"\\
+% \DescribeMacro{\varindextwoDashSpacefalse}"\varindextwoDashSpacefalse"
+% (default)
+% \end{myquote}
+% respectively. The last entry in the above table is an additional format
+% entry which is generated if also the ``"*"'' flag is used.\par
+%
+% You can modify the second format entry with the following flags:\par
+% \bigskip
+%
+% \begin{tabular}[t]{ll}
+% flags&format used\\\hline
+% "," &"2,1~" resp.\ "2,1"\\
+% "~" &"21"\\
+% "=" &"2!1-~"\\
+% ",="&"2,1-~" resp.\ "2,1-"\\
+% "+" &"2-1"\\
+% ":" &"2!1.~"\\
+% ",:"&"2,1.~" resp.\ "2,1"\\
+% ";" &"2.1"\\
+% ">" &no entry\\
+% "!" &Append "~" (if not already there)\\
+% "?" &Without trailing "~"
+% \end{tabular}\par\bigskip
+%
+% Whether the first or the second alternatives in the above forms is used
+% depends on the status of the switch
+% \begin{myquote}
+% \DescribeMacro{\varindextwoCommaTildetrue}"\varindextwoCommaTildetrue"
+% (default)\\
+% \DescribeMacro{\varindextwoCommaTildefalse}"\varindextwoCommaTildefalse"
+% \end{myquote}
+% We point out that "\varindextwoCommaTildefalse" was in earlier versions of
+% "varindex" the default (and could not be changed).
+% Note that this switch has no effect if the ! or ? flags are used.\par
+%
+% \textbf{Hint} for remembering the symbols: The symbols "_" "." "-"
+% for the first entry are the same flags as for the output and the same
+% flags which are used in the \meta{format} argument.
+% The corresponding symbols "~" ":" (and ";") "=" (and "+") for the second
+% entry ``look similar''. The "," flag is only useful in the second entry
+% (and is the same symbol as in the \meta{format} argument).
+% The two exceptional symbols ">" and "<" can be read as ``generate only the
+% `forward-directed' resp.\ `backward-directed entry'\,''.\par
+%
+%
+% \item[c)] If there are three entries in \meta{main entries}, then
+% \meta{format} becomes ``\myspace"1!~23"\myspace"3!12~"''.
+% For example, if \meta{main entries} is ``"graulty of bazola"'', then
+% the following two "\index" entries are produced.
+%
+% \begin{myindex}
+% \myi graulty
+% \mys $\sim$ of bazola\pno
+% \myi bazola
+% \mys graulty of $\sim$\pno
+% \end{myindex}
+%
+% The flags have an analogous effect to~b).
+% In addition, if the flags "`" resp.\ "'" are used, the second entry
+% (in our example: ``of'') is omitted from the output in the first
+% resp.\ in the second index entry. If the flags "*" and "`"
+% are used together, the second entry is also omitted from the output
+% into the running text.
+%
+% \item[d)] If there are four entries in \meta{main entries}, then
+% \meta{format} becomes ``\myspace"1!~24"\myspace"4!31~"''. For example, if
+% \meta{main entries} is ``"graulty of@ OF bazola"'', then the following
+% two "\index" entries are produced.
+%
+% \begin{myindex}
+% \myi graulty
+% \mys $\sim$ of bazola\pno\sortedlikeq{bazola}
+% \myi bazola
+% \mys graulty OF $\sim$\pno\sortedlikeq{graulty OF}
+% \end{myindex}
+% In other words, we have a similar effect as in~c) except that for the
+% first entry the third word is skipped, and for the second entry the
+% second word is skipped. All flags as in~c) can be used with an
+% analogous meaning.
+% Also, if the "*" flag is used, the output into the running text is
+% analogous to~c) (the third word is skipped).
+%
+% \item[e)] If there are more than four entries in \meta{main entries}, then
+% \meta{formatA} resp.\ \meta{format*A} is used.
+% \end{enumerate}
+%
+% If an explicit \meta{format} argument is given to "\varindex" (together with
+% the "\varindextwo" macro as \meta{main program}), then this format is used,
+% except when it contains the symbol "+". In this case, this symbol "+" is
+% replaced by the format which would be generated by the rules~a)--e).
+% If additionally the "*" flag is used, there is a special rule:
+% If the explicit format contains a "*", then no additional "*"-output is
+% produced. Otherwise, the "*"-output from~a)--e) is prepended to the given
+% \meta{format} (with a space at the end, unless the format string is empty).
+% This means that ``normally'' you have the output from a)--e),
+% unless you write an own explicit "*"-part in the \meta{format}.
+%
+% If you do not like the tokens chosen for the default symbols, you can
+% easily choose your own tokens by just replacing "\varindextwoScan" with your
+% own macro (or defining your own ``magic'' tokens after "\varindextwoScan",
+% see the example in Section~\ref{ss:expatch}).
+
+%
+% \section{Primitive customization}
+%
+%
+% You may use the command
+% \DescribeMacro{\varindexUsePlaceholderAfalse}
+% \DescribeMacro{\varindexUsePlaceholderBfalse}
+% \begin{verbatim}
+% \varindexUsePlaceholderAfalse
+% \varindexUsePlaceholderBfalse\end{verbatim}
+% to ignore the symbol "~" resp.\ "=" in the format entry.
+% You can easily restore the default by
+% \DescribeMacro{\varindexUsePlaceholderAtrue}
+% \DescribeMacro{\varindexUsePlaceholderBtrue}
+% \begin{verbatim}
+% \varindexUsePlaceholderAtrue
+% \varindexUsePlaceholderBtrue\end{verbatim}
+%
+% If you want to switch off the placeholder only at the beginning of
+% a new entry (resp.\ of a new subentry), you can use the commands
+% \DescribeMacro{\varindexLeadingPlaceholderAfalse}
+% \DescribeMacro{\varindexLeadingPlaceholderBfalse}
+% \begin{verbatim}
+% \varindexLeadingPlaceholderAfalse
+% \varindexLeadingPlaceholderBfalse\end{verbatim}
+% The default is restored with
+% \DescribeMacro{\varindexLeadingPlaceholderAtrue}
+% \DescribeMacro{\varindexLeadingPlaceholderBtrue}
+% \begin{verbatim}
+% \varindexLeadingPlaceholderAtrue
+% \varindexLeadingPlaceholderBtrue\end{verbatim}
+%
+% By default, the ``","'' in the format string is in this connection
+% treated as a symbol generating a new ``subentry''. You can change this
+% default with the command
+% \DescribeMacro{\varindexCommaLeadsfalse}
+% \begin{verbatim}
+% \varindexCommaLeadsfalse\end{verbatim}
+% You may switch back with
+% \DescribeMacro{\varindexCommaLeadstrue}
+% \begin{verbatim}
+% \varindexCommaLeadstrue\end{verbatim}
+%
+%
+% The content of the macros
+% \DescribeMacro{\varindexPlaceholderAText}
+% \DescribeMacro{\varindexPlaceholderASort}
+% \DescribeMacro{\varindexPlaceholderBText}
+% \DescribeMacro{\varindexPlaceholderBSort}
+% \begin{verbatim}
+% \varindexPlaceholderAText
+% \varindexPlaceholderASort
+% \varindexPlaceholderBText
+% \varindexPlaceholderBSort\end{verbatim}
+% is used as the placeholder "~" resp.\ "=" in the index resp.\ sort entry.
+% Note that if one of these entries expands empty, different rules for
+% the automatic insertion of spaces apply (for the index and sort entry
+% separately).
+%
+% You may prefer that the placeholder text resp.\ sort content changes at
+% run time to the context of the previous "!" entry. For example, you may
+% want that the command "\varindex{Gibble Gobble}{2!~2}" produces the index
+% entry
+% \begin{myindex}
+% \myi Gibble
+% \mys Gibble Gobble\pno
+% \end{myindex}
+% (or is at least \emph{sorted} as such an entry).
+%
+% You can achieve this with the commands
+% \DescribeMacro{\varindexPreviousATexttrue}
+% \DescribeMacro{\varindexPreviousASorttrue}
+% \DescribeMacro{\varindexPreviousBTexttrue}
+% \DescribeMacro{\varindexPreviousBSorttrue}
+% \begin{verbatim}
+% \varindexPreviousATexttrue
+% \varindexPreviousASorttrue
+% \varindexPreviousBTexttrue
+% \varindexPreviousBSorttrue\end{verbatim}
+% for the text and sort entry and the placeholders "~" and "=", respectively.
+% With these commands, the content of "\varindexPlaceholderAText" etc
+% is only used as the default if no previous "!" entry was given.
+% You can switch back to the default mode with the respective commands
+% \DescribeMacro{\varindexPreviousATextfalse}
+% \DescribeMacro{\varindexPreviousASortfalse}
+% \DescribeMacro{\varindexPreviousBTextfalse}
+% \DescribeMacro{\varindexPreviousBSortfalse}
+% \begin{verbatim}
+% \varindexPreviousATextfalse
+% \varindexPreviousASortfalse
+% \varindexPreviousBTextfalse
+% \varindexPreviousBSortfalse\end{verbatim}
+% By default, the ``","'' in the format entry is considered in this connection
+% similar to ``"!"''. If you want to change this, use the command
+% \DescribeMacro{\varindexCommaExpandfalse}
+% \begin{verbatim}
+% \varindexCommaExpandfalse\end{verbatim}
+% You may switch back with
+% \DescribeMacro{\varindexCommaExpandtrue}
+% \begin{verbatim}
+% \varindexCommaExpandtrue\end{verbatim}
+%
+% Since version 2.2, the dash ``"-"'' occurring at the beginning of entry
+% (or after ``"!"'' or even after ``","'' if "\varindexCommaExpandtrue" is in
+% effect) is ignored for sorting.
+% You can switch off this feature with the command
+% \DescribeMacro{\varindexOutSortDashBeg}
+% \begin{verbatim}
+% \let\varindexOutSortDashBeg\varindexOutSortDash\end{verbatim}
+% To restore the new default, use
+% \begin{verbatim}
+% \let\varindexOutSortDashBeg\toolboxEmpty\end{verbatim}
+% \bigskip
+% The commands
+% \begin{myquote}
+% \DescribeMacro{\varindexSetWordString}
+% "\varindexSetWordString{|}"\myquad
+% (Use "|" as separator for entries instead of spaces)\par
+% \DescribeMacro{\varindexSetSortString}
+% "\varindexSetSortString{>}"\myquad(default: "@")\par
+% \DescribeMacro{\varindexSetPlainString}
+% "\varindexSetPlainString{<}"\myquad(default: "!")
+% \end{myquote}
+% set the default ``magic'' strings used for \meta{main entries}.
+% The argument of the above macros is intentionally \emph{not} expanded (so
+% that you do not have troubles with active characters like "~").
+% To force expansion, use e.\,g.
+% \begin{verbatim}
+% \expandafter\varindexSetWordString\expandafter{\MacroToExpand}\end{verbatim}
+% or some similar construct.
+%
+% If you use a different separator than ``space'' for the entries, you may
+% want to change the rule how braces are eliminated. With the commands
+% \DescribeMacro{\varindexEliminateOuterBracetrue}
+% \DescribeMacro{\varindexEliminateInnerBracetrue}
+% \DescribeMacro{\varindexEliminateOuterBracefalse}
+% \DescribeMacro{\varindexEliminateInnerBracefalse}
+% \begin{verbatim}
+% \varindexEliminateOuterBracetrue
+% \varindexEliminateInnerBracetrue
+% \varindexEliminateOuterBracefalse
+% \varindexEliminateInnerBracefalse\end{verbatim}
+% you may allow resp.\ forbid the elimination of braces around the entries
+% resp.\ around \meta{indextext} \meta{sorttext} and \meta{outputtext}
+% With the flag ``"1"'', \meta{main entries} is considered as one single entry,
+% but if "\varindexEliminateOuterBracetrue" is set (which is the default)
+% also in this case an additional pair of braces around main entry is
+% eliminated.
+%
+% Similarly as above,
+% \begin{myquote}
+% \DescribeMacro{\varindexSetIndexString}
+% "\varindexSetIndexString{|}" \myquad default: space\par
+% \DescribeMacro{\varindexSetOutputString}
+% "\varindexSetOutputString{<}" \myquad default: "*"\par
+% \DescribeMacro{\varindexSetTildeAString}
+% "\varindexSetTildeAString{~}" \myquad (is default)\par
+% \DescribeMacro{\varindexSetTildeBString}
+% "\varindexSetTildeBString{=}" \myquad (is default)\par
+% \DescribeMacro{\varindexSetSpaceString}
+% "\varindexSetSpaceString{_}" \myquad (is default)\par
+% \DescribeMacro{\varindexSetSpaceTokString}
+% "\varindexSetSpaceTokString{s}"\myquad (is default)\par
+% \DescribeMacro{\varindexSetOmitString}
+% "\varindexSetOmitString{.}" \myquad (is default)\par
+% \DescribeMacro{\varindexSetCommaString}
+% "\varindexSetCommaString{,}" \myquad (is default)\par
+% \DescribeMacro{\varindexSetDashString}
+% "\varindexSetDashString{-}" \myquad (is default)\par
+% \DescribeMacro{\varindexSetExclamString}
+% "\varindexSetExclamString{!}" \myquad (is default)\par
+% \DescribeMacro{\varindexSetStringForNr}
+% "\varindexSetStringForNr 1{a}" \myquad default: "1"\par
+% "\varindexSetStringForNr{11}{b}"\myquad No default!
+% \end{myquote}
+% set the default ``magic'' strings used for \meta{format}.
+% In contrast to before, the arguments are fully expanded (with
+% "\varindexedef", see Section~\ref{s:docufeature}).
+% Note that the last command provides a way to access more than $10$ entries!
+%
+% If you use "\varindexSetIndexString{|}" (with some non-space token),
+% you may still use spaces in the format which then are just ignored.
+%
+%
+% Avoid that one string is a prefix of another string: In this case,
+% strange effects may happen, and this behavior may even change in
+% future releases of this package.
+% Note that the above effect may arise unintentionally if you use active
+% chars. For this reason, ``"~"'' is defined to expand to the letter ``"~"'',
+% before the expansion is executed. Maybe in later releases of this package
+% there will be further such redefinitions.
+% You can explicitly use this feature in your own macros by using
+% "\varindexedef" instead of the usual "\edef",
+% see Section~\ref{s:docufeature}.
+%
+% You can change the output for the text resp sort entry of the various
+% symbols used in the format string. More precisely, you can redefine
+%
+% \begin{myquote}
+% \DescribeMacro{\varindexOutExclam}
+% "\varindexOutExclam" \myquad Text output for "!"\par
+% \DescribeMacro{\varindexFollowsExclam}
+% "\varindexFollowsExclam" \myquad
+%Decide whether magic space after "!" is inserted\par
+% \DescribeMacro{\varindexOutTextComma}
+% "\varindexOutTextComma" \myquad Text output for ","\par
+% \DescribeMacro{\varindexOutSortComma}
+% "\varindexOutSortComma" \myquad Sort output for ","\par
+% \DescribeMacro{\varindexFollowsComma}
+% "\varindexFollowsComma" \myquad
+%Decide whether magic space after "," is inserted\par
+% \DescribeMacro{\varindexPreceedsComma}
+% "\varindexPreceedsComma" \myquad
+%Decide whether magic space before "," is erased\par
+% \DescribeMacro{\varindexOutTextSpace}
+% "\varindexOutTextSpace" \myquad Text output for "_"\par
+% \DescribeMacro{\varindexOutSortSpace}
+% "\varindexOutSortSpace" \myquad Sort output for "_"\par
+% \DescribeMacro{\varindexFollowsSpace}
+% "\varindexFollowsSpace" \myquad
+%Decide whether magic space after "_" is inserted\par
+% \DescribeMacro{\varindexPreceedsSpace}
+% "\varindexPreceedsSpace" \myquad
+%Decide whether magic space before "_" is erased\par
+% \DescribeMacro{\varindexOutTextSpTok}
+% "\varindexOutTextSpTok" \myquad Text output for "s"\par
+% \DescribeMacro{\varindexOutSortSpTok}
+% "\varindexOutSortSpTok" \myquad Sort output for "s"\par
+% \DescribeMacro{\varindexFollowsSpTok}
+% "\varindexFollowsSpTok" \myquad
+%Decide whether magic space after "s" is inserted\par
+% \DescribeMacro{\varindexPreceedsSpTok}
+% "\varindexPreceedsSpTok" \myquad
+%Decide whether magic space before "s" is erased\par
+% \DescribeMacro{\varindexOutTextDash}
+% "\varindexOutTextDash" \myquad Text output for "-"\par
+% \DescribeMacro{\varindexOutSortDash}
+% "\varindexOutSortDash" \myquad Sort output for "-"\par
+% \DescribeMacro{\varindexOutSortDashBeg}
+% "\varindexOutSortDashBeg" \myquad Sort output for "-"
+%if nothing preceeds.\par
+% \DescribeMacro{\varindexFollowsDash}
+% "\varindexFollowsDash" \myquad
+%Decide whether magic space after "-" is inserted\par
+% \DescribeMacro{\varindexPreceedsDash}
+% "\varindexPreceedsDash" \myquad
+%Decide whether magic space before "-" is erased\par
+% \DescribeMacro{\varindexOutTextOmit}
+% "\varindexOutTextOmit" \myquad Text output for "."\par
+% \DescribeMacro{\varindexOutSortOmit}
+% "\varindexOutSortOmit" \myquad Sort output for "."\par
+% \DescribeMacro{\varindexFollowsOmit}
+% "\varindexFollowsOmit" \myquad
+%Decide whether magic space after "." is inserted\par
+% \DescribeMacro{\varindexPreceedsOmit}
+% "\varindexPreceedsOmit" \myquad
+%Decide whether magic space before "." is erased
+% \end{myquote}
+%
+% The meaning is as follows: "\varindexOut..." should just expand to the
+% tokens which should be written into the text resp.\ sort output.
+% The corresponding macro "\varindexFollows..." is typically defined with
+% one of the following commands:
+% \begin{verbatim}
+% \let\varindexFollows...\varindexNextSpace
+% \let\varindexFollows...\varindexNoNextSpace\end{verbatim}
+% In the first case, a space is `magically' inserted in front of a
+% subsequent token (unless this token erases the magic space).
+% In the second case, no space follows, of course.
+% There is an alternative call:
+% \begin{myquote}
+% \DescribeMacro{\varindexSpaceTexttrue}
+% \DescribeMacro{\varindexSpaceTextfalse}
+% \DescribeMacro{\varindexSpaceSorttrue}
+% \DescribeMacro{\varindexSpaceSortfalse}
+% "\def\varindexFollows...{\varindexSpaceTexttrue\varindexSpaceSortfalse}"
+% \end{myquote}
+% This definition achieves that for the text output a space should follow,
+% but not for the sort output. Of course, you can also use similarly the
+% commands "\varindexSpaceTextfalse" and/or "\varindexSpaceSorttrue" in the
+% above definition (the effect should be obvious).
+% In particular, "\varindexNextSpace" is equivalent to
+% "\varindexSpaceTexttrue\varindexSorttrue".\par
+%
+% The macro "\varindexPreceeds..." is similarly as "\varindexFollows..." with
+% the difference that it is executed \emph{before} the token in question is
+% output. In particular, you can ignore a previous `magic space'.
+% All of the `magic space' commands are defined by default with
+% \begin{verbatim}
+% \let\varindexFollows...\toolboxEmpty
+% \let\varindexPreceeds...\varindexNoNextSpace\end{verbatim}
+% with the following two exceptions:
+% \begin{verbatim}
+% \let\varindexFollowsExclam\varindexNextSpace
+% \let\varindexFollowsComma\varindexNextSpace\end{verbatim}
+%
+% \section{Documented Features}\label{s:docufeature}
+%
+% The title ``documented features'' means that these are hacks which allow
+% further customization but which are ``documented'' in the sense that these
+% hacks will also be available in later versions. (You use an ``undocumented''
+% feature if you must use a macro name of the "varindex" package which
+% contains the symbol "@"). If a feature described in this section does not
+% work in the documented way, this is a bug and might be repaired in a
+% later version of "\varindex".
+%
+% (In a future release, "varindex" will cook your coffee, too).\bigskip
+%
+%
+% The argument \meta{main entries} is \emph{never} expanded, so you can
+% actually write macros into the "*.idx" file.
+% The command actually used to write the index is
+% \begin{myquote}
+% \DescribeMacro{\varindexIndex}"\varindexIndex"
+% \end{myquote}
+% (which by default is of course defined as "\index").
+% Since some implementations of the "\index" command still (partially) expand
+% their argument (which might be considered as a bug), the argument of
+% "\varindexIndex" is translated before the actual call with the aid of
+% "\toolboxMakeHarmless".
+% If you want to redefine "\varindexIndex" to a personal "\index"-output
+% function, you might want to skip the "\toolboxMakeHarmless" step.
+% This is arranged with the command
+% \begin{myquote}
+% \DescribeMacro{\varindexNoConvert}"\varindexNoConvert"
+% \end{myquote}
+% You can cancel the effect of this command with
+% \begin{myquote}
+% \DescribeMacro{\varindexNoConvert}"\varindexNoConvert"
+% \end{myquote}
+% Even if "\varindexNoConvert" is not in effect, \meta{main entries} is not
+% expanded (and in particular, the argument of "\varindexIndex" consists of
+% the corresponding entries in an unexpanded form).\par\bigskip
+%
+% The whole "\varindex" expansion takes place in a group, so all your
+% variables are local to a single call (unless you use "\gdef"
+% (and friends) of course).\par
+%
+% There are no "\global" directives used in any macro of this package.
+% In particular, if you call the above macros in a group (or redefine
+% "\varindexIndex"), the effect holds only until the end of the group.
+% \par\bigskip
+%
+% In contrast to \meta{main entries}, the \meta{format} argument is expanded
+% (with "\varindexedef", see below) (and also \meta{formatA} resp.\
+% \meta{format*A} is expanded before), so you can define abbreviations
+% (even simple conditional % abbreviations) for \meta{format}.
+% Note, however, that the expansion is essentially only evaluated with "\edef".
+% So, you will probably not want to use e.\,g.\ "\relax", since this command
+% expands to itself (and not into nothing -- use "\toolboxEmpty" if you want
+% the latter).
+% If you want more complex abbreviations, use \meta{main program} instead.
+%
+% In order to help you write conditional abbreviations, the
+% following variables are defined when your macro is expanded (and in
+% particular also in \meta{main program}). You may of course redefine them
+% appropriately:
+%
+% \begin{description}
+% \item[\macrott{varindexAppend}]\DescribeMacro{\varindexAppend}
+% The argument \meta{pagestyleA} resp.\ \meta{pagestyleB}.
+% \item[\macrott{varindexCount}]\DescribeMacro{\varindexCount}
+% A \TeX\ counter containing the number of entries in \meta{main entries}.
+% \item[\macrott{varindexLastEntry}]\DescribeMacro{\varindexLastEntry}
+% This is a macro (\emph{not} a counter) which is usually the value of
+% "\the\varindexCount". See below.
+% \item[\macrott{varindexEntry1} \macrott{varindexEntry2} \mdseries$\ldots$]
+%\DescribeMacro{\varindexEntry1-...}
+% The (index) text occurring in \meta{Entry1} \meta{Entry2} $\ldots$
+% \item[\macrott{varindexSort1} \macrott{varindexSort2} \mdseries$\ldots$]
+%\DescribeMacro{\varindexSort1-...}
+% The corresponding sort entry. If no sort entry was given, this is
+% the same as the corresponding "\varindexEntry1-..."
+% \item[\macrott{varindexPlain1} \macrott{varindexPlain2} \mdseries$\ldots$]
+%\DescribeMacro{\varindexPlain1-...}
+% The text which should be output in the text. If no such entry was given,
+% this is the same as the corresponding "\varindexEntry1-..."
+% \end{description}
+% "\varindexCount" may be larger than $10$, and correspondingly there may be
+% also more than $10$ different "\varindexEntry"/"Sort"/"Plain" macros.
+% If you \emph{add} entries, you have to increase "\varindexCount"
+% correspondingly, otherwise an error is produced if the format string
+% contains an entry larger then "\varindexCount". However, your additional
+% entries are \emph{not} output for \emph{empty} formats:
+% For empty formats the entries output are $1$--"\varindexLastEntry".
+% So if you want to output also your additional entries
+% in empty formats, you have to set "\varindexLastEntry" to your modified
+% value of "\varindexCount" in \meta{main program}. You may e.\,g.\ achieve
+% this with the following lines:
+% \begin{myquote}
+% "\expandafter"\\
+% "\def\expandafter\varindexLastEntry\expandafter{\the\varindexCount}"\proz
+% \end{myquote}
+% It is admissible that "\varindexLastEntry" is larger than "\varindexCount":
+% In this case all entries until "\varindexLastEntry" are
+% output in empty formats without producing an error (provided, of course,
+% that the corresponding variables "\varindexEntry..."/"Sort..."/"Plain..." are
+% defined).
+%
+% Note that numbers in \TeX\ command names require special handling,
+% i.\,e., you have to use something like
+%
+% \begin{verbatim}
+% \csname varindexPlain2\endcsname\end{verbatim}
+%
+% to access variables. To avoid this, you may want to use the macros
+% \DescribeMacro{\toolboxLet}"\toolboxLet" and
+% \DescribeMacro{\toolboxWithNr}"\toolboxWithNr" of the "toolbox" package.
+% Examples are
+% \begin{verbatim}
+% \toolboxWithNr 1\let{varindexEntry}\toolboxEmpty
+% \toolboxWithNr {10}\def{varindexSort}{Foo}
+% \toolboxLet \mymacro{varindexPlain\the\mycount}\end{verbatim}
+% These commands set "\varindexEntry1" to "\toolboxEmpty", "\varindexSort10"
+% to Foo, and "\mymacro" to the content of "\varindexPlain5" (if "\mycount=5").
+%
+% All these variables are also available when \meta{main program} is expanded.
+% In \meta{main program} also the following functions are useful:
+%
+% \begin{description}
+% \item[\macrott{varindexFormat}]\DescribeMacro{\varindexFormat}
+% This macro expands to the actual \meta{format} which is used.
+% The main purpose of \meta{main program} will usually be to (re)define
+% this macro. After \meta{main program} has been called, this macro is
+% modified in several ways:
+% \begin{enumerate}
+% \item "\varindexFormat" is expanded (with "\varindexedef", see below).
+% (thus, "\varindexFormat" is expanded \emph{before and after} the call
+% of \meta{main program}).
+% \item "\ifvarindexStar" is true (see below)
+% a ``"*"'' resp.\ ``"*"\myspace'' is prepended.
+% \item If it is only ``"*"'', it is replaced by ``"*"\myspace''.
+% \end{enumerate}
+% Note that before execution of \meta{main program}, no tests on the
+% validity of the format are done: You may use your own symbols to
+% `communicate' with \meta{main program} (provided that \meta{main program}
+% eliminates these symbols afterwards).
+% \item[\macrott{varindexFormatDefault}]\DescribeMacro{\varindexFormatDefault}
+% This macro expands to \meta{formatA} resp.\ \meta{format*A}
+% (in the expanded form) depending whether the "*" flag has been used in
+% the call. Note that this expansion was executed \emph{before}
+% the optional format argument is expanded for the first time.
+% \item[\macrott{ifvarindexstar}]\DescribeMacro{\ifvarindexstar}
+% \meta{ifpart} [ "\else" \meta{elsepart} ] "\fi"\par
+% If the optional "*" was given, \meta{ifpart} is executed, otherwise
+% \meta{elsepart}. This is a \TeX\ "if" command. In particular, by
+% \DescribeMacro{\varindexStarfalse}\DescribeMacro{\varindexStartrue}
+% "\varindexStarfalse" resp.\ "\varindexStartrue"
+% you may change the behavior for future "if"'s. This can be used
+% to prevent/force that a ``"*"'' resp.\ ``"*"\myspace'' is prepended to
+% the format after the execution of \meta{main program}.
+% Setting of this variable has no effect in \meta{scan program}.
+% \item[\macrott{ifvarindexExplicitFormat}]
+% \DescribeMacro{\ifvarindexExplicitFormat}
+% This is a \TeX\ "if" command (see above) which is true if the optional
+% format argument \meta{formatB} was given.
+% \end{description}
+%
+% To ``compose'' the format, you may want to use the macros
+% \begin{myquote}
+% \DescribeMacro{\toolboxDef}
+% "\toolboxDef\macrotodefine"\bracemeta{argumentlist}\par
+% \DescribeMacro{\toolboxAppend}
+% "\toolboxAppend\macrotoappend"\bracemeta{argumentlist}\par
+% \DescribeMacro{\varindexedef}
+% "\varindexedef\macrotodefine"\bracemeta{argumentlist}
+% \end{myquote}
+% All commands work similar to "\def" resp.\ "\edef" with two differences:
+%
+% For "\toolboxDef\macro", \meta{argumentlist} is expanded precisely by one
+% level (for details, see the documentation of the "toolbox" package).
+% Of course, for "\toolboxAppend", the new definition is appended to the old
+% definition of "\macro".
+%
+% "\varindexedef" fully expands \meta{argumentlist}. However, some active
+% symbols (currently only "~", but additional symbols might follow in a
+% future release) are deactivated before expansion, so that "~" actually
+% expands to "~" and not to a strange command sequence.
+%
+%
+% To ``decompose'' the format, you may want to use one of the macros
+%
+% \begin{myquote}
+% \DescribeMacro{\toolboxSplitAt}
+% "\toolboxSplitAt"\bracemeta{arg}\bracemeta{critical}\bracemeta{command}\par
+% \DescribeMacro{\toolboxMakeSplit}
+% "\toolboxMakeSplit"\bracemeta{critical}\bracemeta{command}\par
+% \DescribeMacro{\varindexMakeSplitExpand}
+% "\varindexMakeSplitExpand"\relax
+%\bracemeta{macros expanding to critical}\bracemeta{command}\par
+% \DescribeMacro{\varindexMakeVarSplit}
+% "\varindexMakeVarSplit\variable"\relax
+%\bracemeta{macros expanding to critical}\bracemeta{command}
+% \end{myquote}
+% The first two macros are described in the "toolbox" package.
+% The remaining two macros are similar to "\varindexMakeSplit" with the
+% difference that the argument \meta{critical} is obtained by expanding
+% \meta{macros expanding to critical} with the aid of "\varindexedef".
+% In the last form, additionally "\variable" is (re)defined to expand to
+% \meta{critical} ("\variable" is any free name).
+%
+% The following instances of a command created by "\toolboxMakeSplit"
+% exist (the content of \meta{critical} should be obvious):
+%
+% \begin{myquote}
+% \DescribeMacro{\varindexSplitAtIndex}
+% "\varindexSplitAtIndex"\myquad(generated by "\varindexSetIndexString")\par
+% \DescribeMacro{\varindexSplitAtOutput}
+% "\varindexSplitAtOutput"\myquad(generated by "\varindexSetOutputString")\par
+% \DescribeMacro{\varindexSplitAtTildeA}
+% "\varindexSplitAtTildeA"\myquad(generated by "\varindexSetTildeAString")\par
+% \DescribeMacro{\varindexSplitAtTildeB}
+% "\varindexSplitAtTildeB"\myquad(generated by "\varindexSetTildeBString")\par
+% \DescribeMacro{\varindexSplitAtSpace}
+% "\varindexSplitAtSpace"\myquad(generated by "\varindexSetSpaceString";
+% by default, \meta{critical} is "_")\par
+% \DescribeMacro{\varindexSplitAtSpaceTok}
+% "\varindexSplitAtSpaceTok"\myquad
+% (generated by "\varindexSetSpaceTokString";
+% by default, \meta{critical} is "s")\par
+% \DescribeMacro{\varindexSplitAtOmit}
+% "\varindexSplitAtOmit"\myquad(generated by "\varindexSetOmitString")\par
+% \DescribeMacro{\varindexSplitAtComma}
+% "\varindexSplitAtComma"\myquad(generated by "\varindexSetCommaString")\par
+% \DescribeMacro{\varindexSplitAtDash}
+% "\varindexSplitAtDash"\myquad(generated by "\varindexSetDashString")\par
+% \DescribeMacro{\varindexSplitAtExclam}
+% "\varindexSplitAtExclam"\myquad(generated by "\varindexSetExclamString")\par
+% \DescribeMacro{\varindexSplitAtNr??}
+% "\varindexSplitAtNr1"\myquad(generated by "\varindexSetStringForNr")\par
+% "\varindexSplitAtNr2"\par
+% $\ldots$
+% \end{myquote}
+% Note that you must use "\csname ....\endcsname" to call e.\,g.\ the macro
+% "\varindexSplitAtNr1". Only those numbers are admissible for
+% "\varindexSplitAtNr??" which have been introduced with
+% "\varindexSetStringForNr" (by default, this is the case for $1$--$10$).
+%
+% There is also the instance
+% \DescribeMacro{\varindexSplitSpace}
+% \begin{myquote}
+% "\varindexSplitSpace"\myquad
+% (to be distinguished from "\varindexSplitAtSpace")
+% \end{myquote}
+% where \meta{critical} is the space symbol.
+%
+%
+% In addition, you may use the variables
+% \begin{myquote}
+% \DescribeMacro{\varindexIndexString}"\varindexIndexString"\par
+% \DescribeMacro{\varindexOutputString}"\varindexOutputString"\par
+% \DescribeMacro{\varindexTildeAString}"\varindexTildeAString"\par
+% \DescribeMacro{\varindexTildeBString}"\varindexTildeBString"\par
+% \DescribeMacro{\varindexSpaceString}"\varindexSpaceString"\par
+% \DescribeMacro{\varindexSpaceTokString}"\varindexSpaceTokString"\par
+% \DescribeMacro{\varindexOmitString}"\varindexOmitString"\par
+% \DescribeMacro{\varindexCommaString}"\varindexCommaString"\par
+% \DescribeMacro{\varindexDashString}"\varindexDashString"\par
+% \DescribeMacro{\varindexExclamString}"\varindexExclamString"\par
+% \DescribeMacro{\varindexNr??String}\relax
+%"\varindexNr1String \varindexNr2String ..."
+% \end{myquote}
+% which expand to the corresponding strings.\par
+%
+% All the previous macros should not be redefined ``by hand''.
+% They are implicitly redefined by the "\varindexSet..." commands
+% (which partially also do other tasks).\par
+%
+%
+%
+% To drop possible braces, use the command
+% \DescribeMacro{\toolboxDropBrace}
+% \begin{verbatim}
+% \toolboxDropBrace\variable\end{verbatim}
+% of the "toolbox" package.\par
+%
+% In \meta{scan program} you may already want to call "\toolboxMakeSplit":
+% In this way, the choices for the ``magic'' tokens are made in the
+% (usually small) argument \meta{scan program}, and in this sense, you can
+% keep your (possibly rather complex) macro \meta{main program}
+% ``customizable'' (i.\,e.\ you can use the same macro also with a different
+% set of ``magic'' strings).
+% However, the main task of \meta{scan program} is to introduce
+% new flags with
+%
+% \begin{myquote}
+% \DescribeMacro{\varindexNewFlag}
+%"\varindexNewFlag"\meta{token}"\position["\meta{program}"\varindexEndOfFlag]"
+% \end{myquote}
+% or
+% \begin{myquote}
+% "\varindexNewFlag"\meta{token}"\position[\programmacro]"
+% \end{myquote}
+% Here, "\position" is an (undefined) macro, and \meta{token} an arbitrary
+% token. The "[program(macro)]" part is optional and is explained later.
+% If \meta{token} appears in \meta{flags}, then "\position" is defined to
+% expand to a (literally) number, namely the (last) position where token
+% was given inside the \meta{flags} list (counting from $0$). For example, if
+% \begin{verbatim}
+% \varindexNewFlag ,\commapos
+% \varindexNewFlag -\minuspos
+% \varindexNewFlag .\pointpos\end{verbatim}
+% are used in "\programA", then in the call
+% \begin{verbatim}
+% \varindex(){\programA}{\programB},-**-{}\end{verbatim}
+% the variable "\commapos" will expand in "\programB" to "0", while
+% "\minuspos" will expand to "4" (the last position is taken). Finally,
+% "\pointpos" is "\undefined" (unless you defined "\pointpos" differently
+% \emph{after} the call of "\varindexNewFlag"; in this case, this is the
+% default).
+% If "\varindexNewFlag" is called multiple times with the same token,
+% only the \emph{last} call with this token takes effect.
+%
+% The flags "*" and "1" are introduced in this way with
+% \DescribeMacro{\varindexStarPos}
+% \DescribeMacro{\varindexOneEntry}
+% \begin{verbatim}
+% \varindexNewFlag *\varindexStarPos
+% \varindexNewFlag 1\varindexOneEntry\end{verbatim}
+% \emph{before} \meta{scan program} is executed. This means:
+% \begin{enumerate}
+% \item Usually, "\varindexStarPos" contains the (last) position of "*"
+% (resp.\ is "\undefined"). Moreover, if you define "\varindexStarPos" in
+% \meta{scan program} or in some flag, you get the same effect as if "*"
+% had been used.
+% An analogous remark holds for "\varindexOneEntry".
+% \item If you introduce "*" with "\varindexNewFlag", the "*" looses its
+% original meaning. The same holds for "1".
+% \end{enumerate}
+%
+% If you have added a "[program(macro)]" part in the call of
+% "\varindexNewFlag", this part is expanded whenever the flag introduced
+% by "\token" is used in the call of "\varindex"
+% (note that it is not excluded that this happens several times within one
+% call). More precisely, program is expanded \emph{after} the variable
+% "\position" has been set to the corresponding value, so you may already
+% use "\position" in the program part.
+%
+% \textbf{Important:} The last token expanded in program \emph{must} be
+% \DescribeMacro{\varindexEndOfFlag}"\varindexEndOfFlag".
+% This is not nice but has to do with the way \TeX\ parses its arguments.
+% Also if you use the form "\programmacro", the \emph{very last} token expanded
+% must be "\varindexEndOfFlag". Even a construction like
+% \begin{verbatim}
+% \def\myprogrammacro{\ifx....
+% \CallSomeMacroWithvarindexEndOfFlagAtTheEnd
+% \fi
+% \varindexEndOfFlag}\end{verbatim}
+% is forbidden: In "\CallSomeMacroWithvarindexEndOfFlagAtTheEnd" an error
+% would occur at the end, since still the tokens "\fi\varindexEndOfFlag"
+% are in the tokenlist when EndOfFlag is reached there.
+% As a workaround, you may e.\,g.\ use
+% \begin{myquote}
+% "\def\myprogrammacro{\ifx..."\pari
+% "\def\execute{....\varindexEndOfFlag}"\ppari
+% "\else"\pari
+% "\def\execute{\varindexEndOfFlag}"\ppari
+% "\execute}"
+% \end{myquote}
+%
+% If you use the form "[\programmacro]", your macro may even read additional
+% parameters. These parameters are expected in the call of "\varindex"
+% \emph{behind} the flag you have introduced. So you may actually use flags
+% with parameters. For example, if "\scanprogram" contains a macro like
+% \begin{verbatim}
+% \varindexNewFlag -\minuspos[\readpara]\end{verbatim}
+% and you have defined
+% \begin{verbatim}
+% \def\readpara#1{\def\merk{#1}\varindexEndOfFlag}\end{verbatim}
+% then the call
+% \begin{verbatim}
+% \varindex(){\scanprogram}{\mainprg}*-{Foo}-{Foo 2}*{Entries}\end{verbatim}
+% is admissible, and in \meta{main program},
+% "\merk" will have the value ``Foo 2''.
+%
+% If you are more familiar with \TeX, you can even allow \emph{optional}
+% arguments following your flag: The value of the next (non-space) token is
+% at the call of "\programmacro" already saved into the macro
+% \DescribeMacro{\varindexNextToken}
+% \begin{verbatim}
+% \varindexNextToken\end{verbatim}
+% so you can just use it to test for e.\,g.\ ``"["''. In this connection,
+% you may also want to use the commands
+% \DescribeMacro{\varindexTestAndExec}
+% \DescribeMacro{\varindexSkipAndExec}
+% \begin{verbatim}
+% \varindexTestAndExec
+% \varindexSkipAndExec\end{verbatim}
+% Please, see the program text how these commands are applied.\bigskip
+%
+% Since version 2.1 you can also hack in personal extensions of the format
+% string. To do this, use the command
+% \begin{myquote}
+% \DescribeMacro{\varindexNewFormat}
+% "\varindexNewFormat\"\meta{splitcommand}\bracemeta{action}
+% \end{myquote}
+% Here, "\"\meta{splitcommand} is a command generated by "\toolboxMakeSplit" or
+% friends (preferably by "\varindexMakeSplitExpand", because the command should
+% act on the format string which is expand with "\varindexedef").
+% The string where it splits is the new string you can use
+% in the format argument after this call. For each
+% occurrence of the corresponding string in the format argument,
+% \meta{action} will be executed. If "\"\meta{splitcommand} splits at a string
+% which already had a previous meaning in the format string (or which is a
+% prefix to such a string) the old meaning of this string in the format string
+% is overridden.
+%
+% Typically, action will contain the following commands:
+% One action will probably be to output a desired token (sequence) via
+% \begin{myquote}
+% \DescribeMacro{\varindexTokensOut}
+% "\varindexTokensOut"\bracemeta{text token}\bracemeta{sort token}
+% \end{myquote}
+% or
+% \begin{myquote}
+% \DescribeMacro{\varindexTokensOutExpand}
+% "\varindexTokensOutExpand"\meta{macro for text token}\relax
+%\meta{macro for sort token}
+% \end{myquote}
+% In the first form, \meta{text token} resp.\ \meta{sort token} is the token
+% sequence put into the index or running text respectively into the sort entry
+% of the index for the corresponding format entry. The second form is similar
+% with the only difference that the arguments must be single macros which
+% expand to \meta{text token} and \meta{sort token}, respectively.\par
+%
+% The variable \DescribeMacro{\ifvarindexIndexMode}
+% \begin{verbatim}
+% \ifvarindexIndexMode\end{verbatim}
+% can be used to test whether the output goes into the running text or into
+% the index (i.\,e.\ whether a ``"*"'' preceeded the current entry).
+% For output into the text, \meta{sort token} is ignored, of course).
+%
+% Another action in "\varindexNewFormat" will probably be to take care of
+% the magic space flags. This is achieved by a call of "\varindexNextSpace" or
+% "\varindexNoNextSpace" (or separately via "\varindexSpaceTexttrue"/"false"
+% resp.\ "\varindexSpaceTexttrue"/"false"); see the earlier description.
+% The magic space flags are taken into account in "\varindexTokensOut".
+% Thus, if you want to ignore the previous flag for some reason you should set
+% them correspondingly before this call.
+% However, after the call you should also set them correspondingly for
+% further processing.\par
+%
+% Example:
+% \begin{verbatim}
+% \toolboxMakeSplit{:}{splitAtColon}
+% \varindexNewFormat\splitAtColon{%
+% \varindexNoNextSpace
+% \ifvarindexIndexMode
+% \varindexTokensOut{:}{}\varindexSpaceTexttrue
+% \else
+% \varindexTokensOut{---}{}\varindexNoNextSpace
+% \fi}\end{verbatim}
+% defines a new format entry ``":"'' which has the meaning that a colon
+% (automagically followed by a space) is put into the index but not into
+% the sort entry. Moreover, in the running text, the colon appears as a
+% long dash with no space followed. In any case, there is no magic space output
+% in front of the colon.\bigskip
+%
+% As an alternative action in "\varindexNewFormat", you can also call the
+% default commands for the format entries. The corresponding macros are
+% \begin{myquote}
+% \DescribeMacro{\varindexAddSpace}"\varindexAddSpace"\myquad"_"\par
+% \DescribeMacro{\varindexAddSpTok}"\varindexAddSpTok"\myquad"s"\par
+% \DescribeMacro{\varindexAddOmit}"\varindexAddOmit"\myquad"."\par
+% \DescribeMacro{\varindexAddDash}"\varindexAddDash"\myquad"-"\par
+% \DescribeMacro{\varindexAddComma}"\varindexAddComma"\myquad","\par
+% \DescribeMacro{\varindexAddExclam}"\varindexAddExclam"\myquad"!"\par
+% \DescribeMacro{\varindexAddTildeA}"\varindexAddTildeA"\myquad"~"\par
+% \DescribeMacro{\varindexAddTildeB}"\varindexAddTildeB"\myquad"="\par
+% \DescribeMacro{\varindexAddNumber}"\varindexAddNumber"\bracemeta{number}
+%\myquad"0-9" (\meta{number} is "1", "2", $\ldots$)
+% \end{myquote}
+% The precise meaning of these macros is intentionally \emph{not} documented,
+% because some details or side effects might change in a future release of
+% "varindex". But just for this reason, it might be advantageous to use the
+% above macros instead of writing personal substitutes which may fail to
+% have such side effects.\par
+%
+% Example:
+% \begin{verbatim}
+% \varindexMakeSplitExpand{~-}{splitPhrase}% It is important to expand
+% % (to have correct ~ catcode)
+% \varindexNewFormat\splitPhrase{%
+% \varindexAddTildeA
+% \let\remember\varindexPreceedsDash
+% \let\varindexPreceedsDash\toolboxEmpty
+% \varindexAddDash
+% \let\varindexPreceedsDash\remember}\end{verbatim}
+% After the above command, ``"~"'' and ``"-"'' have their usual meaning in
+% the format string except when they follow immediately in the form ``"~-"''.
+% In this case, the behavior of "-" changes as if "\varindexPreceedsDash"
+% were empty (which has the effect that the output looks like~``$\sim$~-''
+% instead of~``$\sim$-'').\par
+% Note that although "~" is a prefix to "~-", the converse is not true:
+% Thus, the above command does not change the previous meaning of~"~"
+% (and of course also not of~"-").\par
+% \bigskip
+%
+% \textbf{Some hack:}
+% \TeX\ ignores leading spaces in the argument list of a ``normal'' macro.
+% This has the effect that you should be able to insert spaces \emph{between}
+% any of your arguments without any trouble.
+% If this does not work the expected way, you can use the command
+% \DescribeMacro{\varindexArgumentSpace}
+% \DescribeMacro{\varindexSkipTricky}
+% \begin{verbatim}
+% \let\varindexArgumentSpace\varindexSkipTricky\end{verbatim}
+% which implements an own macro which does this task. Sadly, this can only
+% be done with some catcode trickery which in turn might bring you in trouble
+% with some (\emph{very}) exotic packages. You can restore the default with
+% \DescribeMacro{\varindexSkipDefault}
+% \begin{verbatim}
+% \let\varindexArgumentSpace\varindexSkipDefault\end{verbatim}
+%
+% All above customization commands/variables may be used anytime between
+% two "\varindex" calls. They take effect with the next "\varindex" call.
+
+%
+% The macros "\varindextwoScan" and "\varindextwo" are considered as a
+% (very useful) \emph{example} for the customization of the "\varindex"
+% command. If you need further customization, have a look at their
+% definition first.
+
+
+% \iffalse
+%</metainfo>
+% \fi
+% \iffalse--------------------------------------------------------------\fi
+% \StopEventually{\PrintChanges}
+% \section{Implementation}
+%
+% \iffalse--------------------------------------------------------------
+%
+%
+%<*package>
+% \fi
+% \begin{macrocode}
+%%
+%% This file was generated by the docstrip utility from varindex.dtx.
+%% You may distribute this file only together with the source varindex.dtx
+%% (and if possible with varindex.ins) and only if these files are unmodified.
+%%
+%% Author:
+%%
+%% M. V\"ath vaeth@mathematik.uni-wuerzburg.de
+%%
+
+\ifx\typeout\undefined
+ \def\vx@tmp{\immediate\write17}
+\else
+ \let\vx@tmp\typeout
+\fi\vx@tmp{varindex.sty by M. Vaeth: Release 2.3}
+\ifx\ProvidesPackage\undefined\else
+ \ProvidesPackage{varindex}[2001/05/06 v2.3]
+\fi
+\ifx\RequirePackage\undefined
+ \ifx\toolboxDef\undefined
+ \input toolbox.sty
+ \fi
+ \ifx\toolboxNewifFalse\undefined
+ \errmessage{varindex.sty requires toolbox.sty version 3.1 or higher}
+ \fi
+\else
+ \RequirePackage{toolbox}[2001/05/06]
+\fi
+
+% \end{macrocode}
+%
+% \subsection{The \texttt{varindextwo} (sample) macros and their ``submacros''}
+% \begin{macro}{\varindextwo...}\nocomment
+%
+% \begin{macrocode}
+%%
+%% The file starts with the documented (sample) macros with their "sub"macros:
+%%
+
+\ifx\newcommand\undefined\else
+ \newcommand{\varindextwoScan}{}
+ \newcommand{\varindextwo}{}
+ \newcommand{\vxtAddmyStar}{}
+ \newcommand{\vxtMakemyFormat}{}
+\fi
+
+% \end{macrocode}
+%
+% \begin{macro}{\varindextwoScan}
+% The demo ``scan'' macro. It provides some new flags.
+% \begin{macrocode}
+\def\varindextwoScan{%
+ \varindexNewFlag _\vxtSpaceA
+ \varindexNewFlag -\vxtDashA
+ \varindexNewFlag .\vxtDotA
+ \varindexNewFlag <\vxtOmitA
+ \varindexNewFlag /\vxtNoTildeA
+ \varindexNewFlag `\vxtNopropA
+ \varindexNewFlag P\vxtNopropA% Now obsolete; only for backward compatibility
+ \varindexNewFlag ^\vxtBreakifyA
+ \varindexNewFlag ,\vxtCommaB
+ \varindexNewFlag ~\vxtSpaceB
+ \varindexNewFlag +\vxtDashB
+ \varindexNewFlag ;\vxtDotB
+ \varindexNewFlag >\vxtOmitB
+ \varindexNewFlag !\vxtTildeB
+ \varindexNewFlag ?\vxtNoTildeB
+ \varindexNewFlag p\vxtNopropB% Now obsolete; only for backward compatibility
+ \varindexNewFlag '\vxtNopropB
+ \varindexNewFlag =\vxtDashifyB
+ \varindexNewFlag :\vxtOmitifyB
+ \varindexMakeSplitExpand{+}{vxtSplitAtMagic}% + is the magic symbol
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\varindextwo}
+% The ``main'' demo macro which generates two "\index" commands
+% whose format depends on the number of entries in \meta{main entries}
+% \begin{macrocode}
+\def\varindextwo{%
+ \let\vxtStarFormat\undefined
+ \def\vxtexecute{\let\vxtmyFormat\varindexFormatDefault}%
+ \ifcase\varindexCount
+ % We have 0 entries (this cannot happen: {} generates one (empty) entry)
+ \or% 1 entry:
+ \def\vxtexecute{%
+ \toolboxDef\vxtmyFormat{1}%
+ \toolboxDef\vxtStarFormat{\varindexOutputString 1}}%
+ \or% 2 entries:
+ \def\vxtentryAa{1}%
+ \def\vxtentryAb{2}%
+ \def\vxtentryBa{2}%
+ \def\vxtentryBb{1}%
+ \let\vxtexecute\vxtMakemyFormat
+ \or% 3 entries:
+ \def\vxtentryAa{1}%
+ \ifx\vxtNopropA\undefined
+ \def\vxtentryAb{23}%
+ \else
+ \def\vxtentryAb{3}%
+ \fi
+ \def\vxtentryBa{3}%
+ \ifx\vxtNopropB\undefined
+ \def\vxtentryBb{12}%
+ \else
+ \def\vxtentryBb{1}%
+ \fi
+ \let\vxtexecute\vxtMakemyFormat
+ \or% 4 entries:
+ \def\vxtentryAa{1}%
+ \ifx\vxtNopropA\undefined
+ \def\vxtentryAb{24}%
+ \else
+ \def\vxtentryAb{4}%
+ \fi
+ \def\vxtentryBa{4}%
+ \ifx\vxtNopropB\undefined
+ \def\vxtentryBb{13}%
+ \else
+ \def\vxtentryBb{1}%
+ \fi
+ \let\vxtexecute\vxtMakemyFormat
+ \else% more than 4 entries:
+ \def\vxtexecute{\let\vxtmyFormat\varindexFormatDefault}%
+ \fi
+ \ifvarindexExplicitFormat% the optional format string was given:
+ \expandafter\vxtSplitAtMagic\expandafter{\varindexFormat}\vxttmp\vxttmpa
+ \ifx\vxttmpa\undefined
+ % If the Magic symbol does not occur, we do nothing
+ \else% Otherwise:
+ % We generate our format and insert it at the place of the Magic symbol:
+ \vxtexecute
+ \toolboxDef\varindexFormat{\vxttmp\vxtmyFormat\vxttmpa}%
+ \vxtAddmyStar
+ \fi
+ \else% without an optional format string, we generate our own format
+ \vxtexecute
+ \let\varindexFormat\vxtmyFormat
+ \vxtAddmyStar
+ \fi
+}
+
+% \end{macrocode}
+% \end{macro}
+% Some flags used for the "varindextwo" macros.
+% \begin{macro}{\ifvarindextwoCommaTilde}\nocomment
+% \begin{macrocode}
+\toolboxNewiftrue{varindextwoCommaTilde}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvarindextwoDashTilde}\nocomment
+% \begin{macrocode}
+\toolboxNewiftrue{varindextwoDashTilde}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvarindextwoDashSpace}\nocomment
+% \begin{macrocode}
+\toolboxNewiffalse{varindextwoDashSpace}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\vxtAddmyStar}
+% A submacro needed by "\varindextwo"
+% \begin{macrocode}
+\def\vxtAddmyStar{%
+ \ifvarindexStar% With the * flag, and
+ \ifx\vxtStarFormat\undefined\else% if we have our own StarFormat:
+ \varindexStarfalse% <- No further prepending of `*' desired afterwards
+ \expandafter\varindexSplitAtOutput\expandafter{\varindexFormat}%
+ \vxttmp\vxttmp
+ \ifx\vxttmp\undefined% Did no `*' occur in the format string yet?
+ \ifx\varindexFormat\toolboxEmpty% Empty format means: Only the * part:
+ \let\varindexFormat\vxtStarFormat
+ \else%Normally, we prepend our *-format and a space
+ \toolboxDef\varindexFormat{%
+ \vxtStarFormat\varindexIndexString\varindexFormat}%
+ \fi
+ \fi
+ \fi
+ \fi
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\vxtAddmyStar}
+% A submacro needed by "\varindextwo"
+% \begin{macrocode}
+\def\vxtMakemyFormat{%
+ \let\vxtstarseparator\toolboxEmpty
+ \ifx\vxtBreakifyA\undefined
+ \ifx\vxtSpaceA\undefined
+ \ifx\vxtDashA\undefined
+ \ifx\vxtDotA\undefined
+ \vxtExclamSeparator
+ \else
+ \let\vxtseparator\varindexOmitString
+ \let\vxtstarseparator\vxtseparator
+ \fi
+ \else
+ \let\vxtseparator\varindexDashString
+ \let\vxtstarseparator\vxtseparator
+ \fi
+ \else
+ \let\vxtseparator\toolboxEmpty
+ \fi
+ \else% With ^
+ \ifx\vxtDotA\undefined
+ \let\vxtstarseparator\varindexDashString
+ \ifx\vxtDashA\undefined% -^
+ \ifvarindextwoDashTilde
+ \vxtExclamSeparator
+ \toolboxAppend\vxtseparator\vxtstarseparator
+ \else
+ \toolboxDef\vxtseparator{\varindexExclamString\vxtstarseparator}%
+ \fi
+ \else% Plain ^
+ \vxtExclamSeparator
+ \ifvarindextwoDashSpace
+ \toolboxDef\vxtseparator{\vxtstarseparator\vxtseparator}%
+ \else
+ \toolboxDef\vxtseparator{%
+ \vxtstarseparator\vxtseparator\varindexOmitString}%
+ \fi
+ \fi
+ \else% .^
+ \let\vxtstarseparator\varindexOmitString
+ \vxtExclamSeparator
+ \toolboxAppend\vxtseparator\vxtstarseparator
+ \fi
+ \fi
+ \ifx\vxtOmitA\undefined
+ % We define now the string "\vxtentryAa?\vxtentryAb" where
+ % ? is determined by the flags.
+ \toolboxDef\vxtmyFormat{\vxtentryAa\vxtseparator\vxtentryAb}%
+ \else
+ \let\vxtmyFormat\toolboxEmpty
+ \fi
+ % The *-format is calculated similarly:
+ \toolboxDef\vxtStarFormat{\varindexOutputString
+ \vxtentryAa\vxtstarseparator\vxtentryAb}%
+ \ifx\vxtOmitB\undefined
+ \let\vxtappend\toolboxEmpty
+ \ifx\vxtSpaceB\undefined
+ \ifx\vxtDashB\undefined
+ \ifx\vxtDotB\undefined
+ \ifx\vxtCommaB\undefined
+ \let\vxtseparator\varindexExclamString
+ \let\vxtappend\varindexTildeAString
+ \else
+ \let\vxtseparator\varindexCommaString
+ \ifvarindextwoCommaTilde
+ \let\vxtappend\varindexTildeAString
+ \fi
+ \fi
+ \ifx\vxtDashifyB\undefined
+ \ifx\vxtOmitifyB\undefined\else
+ \toolboxDef\vxtappend{\varindexOmitString\vxtappend}%
+ \fi
+ \else
+ \toolboxDef\vxtappend{\varindexDashString\vxtappend}%
+ \fi
+ \else
+ \let\vxtseparator\varindexOmitString
+ \fi
+ \else
+ \let\vxtseparator\varindexDashString
+ \fi
+ \else
+ \let\vxtseparator\toolboxEmpty
+ \fi
+ \ifx\vxtTildeB\undefined\else
+ \let\vxtappend\varindexTildeAString
+ \fi
+ \ifx\vxtNoTildeB\undefined\else
+ \let\vxtappend\toolboxEmpty
+ \fi
+ % In all cases, we prepend now the string "\vxtentryBa?\vxtentryBb??"
+ % where ? and ?? are determined by the flags
+ \ifx\vxtmyFormat\toolboxEmpty% If the previous string was empty: no space
+ \toolboxDef\vxtmyFormat{\vxtentryBa\vxtseparator\vxtentryBb\vxtappend}%
+ \else
+ \toolboxAppend\vxtmyFormat{%
+ \varindexIndexString\vxtentryBa\vxtseparator\vxtentryBb\vxtappend}%
+ \fi
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vxtAddmyStar}
+% A submacro needed by "\vxtMakemyFormat"
+% \begin{macrocode}
+\def\vxtExclamSeparator{%
+ \ifx\vxtNoTildeA\undefined
+ \toolboxDef\vxtseparator{\varindexExclamString\varindexTildeAString}%
+ \else
+ \let\vxtseparator\varindexExclamString
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+%% --------------------------------------------------------------------
+% \end{macrocode}
+% \subsection{The main implementation of \texttt{varindex}}
+% \begin{macrocode}
+%%
+%% Now the implementation of \varindex.
+%%
+% \end{macrocode}
+%
+%
+% Counters and default variables:\par
+%
+% We cannot use "\toolboxIf" for "\newcount", because in plain \TeX\ and
+% \LaTeX 2.09 the command "\newcount" is defined with the annoying "\outer"
+% flag.
+% \begin{macrocode}
+
+\ifx\varindexCount\undefined
+ \newcount\varindexCount
+\fi
+
+% \end{macrocode}
+% \begin{macro}{\varindexPlaceholderAText}\nocomment
+% \begin{macrocode}
+\toolboxIf\undefined\def\varindexPlaceholderAText{$\sim$}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexPlaceholderASort}\nocomment
+% \begin{macrocode}
+\toolboxIf\undefined\let\varindexPlaceholderASort\toolboxEmpty
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexPlaceholderBText}\nocomment
+% \begin{macrocode}
+\toolboxIf\undefined\def\varindexPlaceholderBText{$\approx$}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexPlaceholderBSort}\nocomment
+% \begin{macrocode}
+\toolboxIf\undefined\let\varindexPlaceholderBSort\toolboxEmpty
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvarindexUsePlaceholderA}\nocomment
+% \begin{macrocode}
+\toolboxNewiftrue{varindexUsePlaceholderA}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvarindexUsePlaceholderB}\nocomment
+% \begin{macrocode}
+\toolboxNewiftrue{varindexUsePlaceholderB}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvarindexLeadingPlaceholderA}\nocomment
+% \begin{macrocode}
+\toolboxNewiftrue{varindexLeadingPlaceholderA}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvarindexLeadingPlaceholderB}\nocomment
+% \begin{macrocode}
+\toolboxNewiftrue{varindexLeadingPlaceholderB}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvarindexCommaLeads}\nocomment
+% \begin{macrocode}
+\toolboxNewiftrue{varindexCommaLeads}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvarindexCommaExpand}\nocomment
+% \begin{macrocode}
+\toolboxNewiftrue{varindexCommaExpand}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvarindexPreviousAText}\nocomment
+% \begin{macrocode}
+\toolboxNewiffalse{varindexPreviousAText}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvarindexPreviousASort}\nocomment
+% \begin{macrocode}
+\toolboxNewiffalse{varindexPreviousASort}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvarindexPreviousBText}\nocomment
+% \begin{macrocode}
+\toolboxNewiffalse{varindexPreviousBText}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvarindexPreviousBSort}\nocomment
+% \begin{macrocode}
+\toolboxNewiffalse{varindexPreviousBSort}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvarindexEliminateInnerBrace}\nocomment
+% \begin{macrocode}
+\toolboxNewiftrue{varindexEliminateInnerBrace}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvarindexEliminateOuterBrace}\nocomment
+% \begin{macrocode}
+\toolboxNewiftrue{varindexEliminateOuterBrace}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% The non-local macros (they should not exist already):
+%
+% \begin{macrocode}
+\ifx\newcommand\undefined\else
+ \newcommand{\varindex}{}
+ \newcommand{\varindexNewFlag}{}
+ \newcommand{\varindexTestAndExec}{}
+ \newcommand{\varindexSkipAndExec}{}
+ \newcommand{\varindexSkipDefault}{}
+ \newcommand{\varindexSkipTricky}{}
+ \newcommand{\varindexMakeVarSplit}{}
+ \newcommand{\varindexMakeSplitExpand}{}
+ \newcommand{\varindexSetWordString}{}
+ \newcommand{\varindexSetSortString}{}
+ \newcommand{\varindexSetPlainString}{}
+ \newcommand{\varindexSetIndexString}{}
+ \newcommand{\varindexSetOutputString}{}
+ \newcommand{\varindexSetTildeAString}{}
+ \newcommand{\varindexSetTildeBString}{}
+ \newcommand{\varindexSetSpaceString}{}
+ \newcommand{\varindexSetSpaceTokString}{}
+ \newcommand{\varindexSetOmitString}{}
+ \newcommand{\varindexSetCommaString}{}
+ \newcommand{\varindexSetDashString}{}
+ \newcommand{\varindexSetExclamString}{}
+ \newcommand{\varindexSetStringForNr}{}
+ \newcommand{\varindexedef}{}
+ \newcommand{\varindexArgumentSpace}{}
+ \newcommand{\varindexNewFormat}{}
+ \newcommand{\varindexTokensOut}{}
+ \newcommand{\varindexTokensOutExpand}{}
+ \newcommand{\varindexAddNumber}{}
+ \newcommand{\varindexAddComma}{}
+ \newcommand{\varindexAddTildeA}{}
+ \newcommand{\varindexAddTildeB}{}
+ \newcommand{\varindexAddExclam}{}
+ \newcommand{\varindexAddSpace}{}
+ \newcommand{\varindexAddSpTok}{}
+ \newcommand{\varindexAddOmit}{}
+ \newcommand{\varindexAddDash}{}
+ \newcommand{\varindexDoConvert}{}
+ \newcommand{\varindexNoConvert}{}
+%% Obsolete names (only provided for backward compatibility):
+ \newcommand{\varindexdef}{}
+ \newcommand{\varindexspace}{}
+ \newcommand{\varindexDropBrace}{}
+ \newcommand{\varindexMakeSplit}{}
+ \newcommand{\varindexLet}{}
+ \newcommand{\varindexWithNr}{}
+\fi
+\let\varindexdef\toolboxDef
+\let\varindexspace\toolboxSpace
+\let\varindexDropBrace\toolboxDropBrace
+\let\varindexMakeSplit\toolboxMakeSplit
+\let\varindexLet\toolboxLet
+\let\varindexWithNr\toolboxWithNr
+
+% \end{macrocode}
+%
+% \begin{macro}{\varindex}
+%
+% The essential ``flow'' is easy:
+%
+% "\varindex" reads the arguments (using lots of auxiliary macros)
+% and then calls "\vx@Main".
+%
+% \begin{macrocode}
+\def\varindex{\begingroup
+% \end{macrocode}
+% Before "toolbox" 3.1 the following "\if"'s could not be made local.
+% The reason is that in plain \TeX\ and \LaTeX 2.09 the command "\newif" is
+% "\outer". Due to this stupid restriction, we had to define them before.
+% "toolbox" 3.1 has now implemented its own "\newif" command for this
+% reason.\par\bigskip
+%
+% "\if"'s for scanning of the parameters:
+%
+% \begin{macro}{\ifvarindexStar}\nocomment
+% \begin{macrocode}
+ \toolboxNewifFalse{varindexStar}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvarindexExplicitFormat}\nocomment
+% \begin{macrocode}
+ \toolboxNewifFalse{varindexExplicitFormat}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvx@atespace}
+% is true if a space was ate during skipping
+% \begin{macrocode}
+ \toolboxNewifFalse{vx@atespace}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvx@savespace}
+% is true if we must ``put back'' an eaten space
+% \begin{macrocode}
+ \toolboxNewifFalse{vx@savespace}%
+% \end{macrocode}
+% \end{macro}
+% "\if"'s for "\vx@main" and its submacros:
+% \begin{macro}{\ifvx@ffound}\nocomment
+% \begin{macrocode}
+ \toolboxNewifFalse{vx@ffound}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvarindexIndexMode}\nocomment
+% "\ifvarindexIndexMode" is true if the currently parsed format corresponds
+% to an index entry (in contrast to the output into the running text).
+% \begin{macrocode}
+ \toolboxNewifTrue{varindexIndexMode}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvarindexSpaceText}\nocomment
+% \begin{macrocode}
+ \toolboxNewifFalse{varindexSpaceText}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvarindexSpaceSort}\nocomment
+% \begin{macrocode}
+ \toolboxNewifFalse{varindexSpaceSort}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvx@firstiter}\nocomment
+% \begin{macrocode}
+ \toolboxNewifTrue{vx@firstiter}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvx@tildeLead}
+% Decides whether we have a leading tilde
+% \begin{macrocode}
+ \toolboxNewifFalse{vx@tildeLead}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvx@commaTextLead}
+% True if "\ifvarindexCommaExpand" is true and we have no token after comma.
+% \begin{macrocode}
+ \toolboxNewifFalse{vx@commaTextLead}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifvx@commaSortLead}\nocomment
+% True if "\ifvarindexCommaExpand" is true and we have no token after comma.
+% \begin{macrocode}
+ \toolboxNewifFalse{vx@commaSortLead}%
+% \end{macrocode}
+% \end{macro}
+% We use "\varindexCount" also for generic flags to save counters.
+% \begin{macrocode}
+ \varindexCount=0\relax
+ \let\varindexStyle\toolboxEmpty
+ \let\varindexAppend\toolboxEmpty
+ \let\vx@text\toolboxEmpty
+ \let\vx@mainprogram\undefined
+ \let\vx@formatA\undefined
+ \let\vx@formatAstar\undefined
+ \let\varindexFormat\undefined
+ \let\varindexFormatDefault\undefined
+ \varindexNewFlag 1\varindexOneEntry
+ \varindexNewFlag *\varindexStarPos
+ \varindexTestAndExec(%optional formatA)
+ \vx@ReadFormatA%else
+ \vx@TestTextStyle}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@ReadFormatA}\nocomment
+% \begin{macrocode}
+\def\vx@ReadFormatA(#1){%
+ \def\vx@formatA{#1}%
+ \varindexTestAndExec(%optional formatAstar)
+ \vx@ReadFormatAstar%else
+ \vx@SkipAndReadScan}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@ReadFormatAstar}\nocomment
+% \begin{macrocode}
+\def\vx@ReadFormatAstar(#1){%
+ \def\vx@formatAstar{#1}\vx@SkipAndReadScan}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@SkipAndReadScan}\nocomment
+% \begin{macrocode}
+\def\vx@SkipAndReadScan{\varindexSkipAndExec\vx@ReadScan}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@ReadScan}\nocomment
+% \begin{macrocode}
+\def\vx@ReadScan#1{#1\toolboxEmpty\varindexSkipAndExec\vx@ReadProgram}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@ReadProgram}\nocomment
+% \begin{macrocode}
+\def\vx@ReadProgram#1{\def\vx@mainprogram{#1}\vx@TestTextStyle}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@TestTextStyle}\nocomment
+% \begin{macrocode}
+\def\vx@TestTextStyle{%
+ \varindexTestAndExec[%textstyle]
+ \vx@ReadTextStyle%else
+ \vx@TestFlags}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@ReadTextStyle}\nocomment
+% \begin{macrocode}
+\def\vx@ReadTextStyle[#1]{%
+ \def\varindexStyle{#1}%
+ \varindexTestAndExec[%pagestyleA]
+ \vx@ReadPageStyleA%else
+ \vx@TestFlags}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@ReadTextStyleA}\nocomment
+% \begin{macrocode}
+\def\vx@ReadPageStyleA[#1]{\def\varindexAppend{#1}\vx@TestFlags}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\vx@TestFlags}
+% This macro starts the flag read loop.
+% \begin{macrocode}
+\def\vx@TestFlags{%
+% \end{macrocode}
+% In this loop, we use "\varindexCount" for the flag position.
+% \begin{macrocode}
+ \varindexCount=0\relax
+ \varindexEndOfFlag}
+
+% \end{macrocode}
+% "\varindexEndOfFlag" is the value of the `first to call' TestFlag...
+% (which is actually the last TestFlag... defined)
+% Let us first initialize it to TestFlag0:
+% \begin{macrocode}
+\varindexCount=0\relax
+\expandafter
+\def\expandafter\varindexEndOfFlag\expandafter{%
+ \csname vx@TestFlag\the\varindexCount\endcsname}
+% \end{macrocode}
+%Initialize the `last' "\vx@TestFlag0" as a macro with the meaning
+%``start to read \meta{main entries}''.
+% \begin{macrocode}
+\expandafter
+\def\varindexEndOfFlag{\varindexSkipAndExec\vx@ReadMain}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\vx@TestFlag0}
+% "\vx@TestFlag0" is the first macro generated by "\varindexNewFlag".
+%
+% \begin{macro}{\varindexNewFlag}
+% "\varindexNewFlag" calls "\vx@MakeNewFlag" with appropriate arguments:
+%
+% \begin{macrocode}
+\def\varindexNewFlag#1#2{%
+ \let#2\undefined
+ \expandafter
+ \def\expandafter\vx@tmp\expandafter{%
+ \csname vx@TestFlag\the\varindexCount\endcsname #1#2}%
+ \advance\varindexCount by 1\relax
+% \end{macrocode}
+% A bug in \TeX? Without this "\relax", the next "\expandafter"
+% is executed \emph{before} the counter is actually increased.
+% \begin{macrocode}
+ \expandafter
+ \toolboxSurround\expandafter{%
+ \csname vx@TestFlag\the\varindexCount\expandafter\endcsname
+ \csname vx@ReadFlag\the\varindexCount\endcsname}{}\vx@tmp
+ \varindexTestAndExec[%program]
+ \vx@ReadFlagProgram%else
+ {\vx@MakeFlagProgram\varindexEndOfFlag}%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\vx@ReadFlagProgram}\nocomment
+% \begin{macrocode}
+\def\vx@ReadFlagProgram[#1]{\vx@MakeFlagProgram{#1}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@MakeFlagProgram}\nocomment
+% \begin{macrocode}
+\def\vx@MakeFlagProgram#1{\expandafter\vx@MakeNewFlag\vx@tmp{#1}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\vx@MakeNewFlag}
+% Usage:
+% "\vx@MakeNewFlag\TestMacro\ReadMacro\PrevMacro\token\pos"\bracemeta{program}
+% \begin{macrocode}
+\def\vx@MakeNewFlag#1#2#3#4#5#6{%
+ \def\varindexEndOfFlag{#1}%
+ \def#1{\varindexTestAndExec#4{#2}{#3}}%
+ \def#2#4{\expandafter
+ \def\expandafter#5\expandafter{\the\varindexCount}%
+ \advance\varindexCount by 1\relax
+ \varindexSkipAndExec{#6}}%
+}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@ReadMain}\nocomment
+% \begin{macrocode}
+\long\def\vx@ReadMain#1{\def\vx@text{#1}%
+ \ifx\vx@formatA\undefined
+ \def\vx@exec{\varindexSkipAndExec\vx@ReadFormatB}%
+ \else
+ \def\vx@exec{%
+ \varindexTestAndExec[%FormatB]
+ \vx@ReadOptFormatB%else
+ {\ifvx@atespace\vx@savespacetrue\fi\vx@TestAppend}}%
+ \fi
+ \vx@exec}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@ReadFormatB}\nocomment
+% \begin{macrocode}
+\def\vx@ReadFormatB#1{\def\varindexFormat{#1}\vx@TestAppend}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@ReadOptFormatB}\nocomment
+% \begin{macrocode}
+\def\vx@ReadOptFormatB[#1]{\def\varindexFormat{#1}\vx@TestAppend}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@TestAppend}\nocomment
+% \begin{macrocode}
+\def\vx@TestAppend{%
+ \varindexTestAndExec[%Append]
+ {\vx@savespacefalse\vx@ReadAppend}%else
+ {\ifvx@atespace\vx@savespacetrue\fi\vx@Main}}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@ReadAppend}\nocomment
+% \begin{macrocode}
+\def\vx@ReadAppend[#1]{\def\varindexAppend{#1}\vx@Main}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\varindexTestAndExec}
+% "\varindexTestAndExec\Token"\bracemeta{ifpart}\bracemeta{elsepart}
+% at the end of a macro:
+% Steps forward in the token list as long as there are spaces.
+% If a space is eaten, "\vx@atespace" is set true.
+% The next (non-space) token is put into "\varindexNextToken".
+% If this token is "\Token", then \meta{ifpart} is executed, otherwise
+% \meta{elsepart}.
+% \begin{macrocode}
+\def\varindexTestAndExec#1#2#3{%
+ \varindexSkipAndExec{%
+ \ifx\varindexNextToken#1%
+ \def\vx@exec{#2}%
+ \else
+ \def\vx@exec{#3}%
+ \fi
+ \vx@exec}}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexSkipAndExec}
+% "\varindexSkipAndExec"\bracemeta{commands} at the end of a macro:
+% Steps forward in the token list as long as there are spaces.
+% The next (non-space) token is put into "\varindexNextToken".
+% Then commands are executed.
+% \begin{macrocode}
+\def\varindexSkipAndExec#1{%
+ \vx@atespacefalse
+ \def\vx@skipexec{#1}%
+ \varindexArgumentSpace}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexSkipDefault}\nocomment
+% \begin{macrocode}
+\def\varindexSkipDefault{\futurelet\varindexNextToken\vx@skipexec}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexSkipTrickery}\nocomment
+% \begin{macrocode}
+\def\varindexSkipTricky{%
+ \vx@MakeSpaceOther\futurelet\varindexNextToken\vx@SkipLoopTest}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexSkipLoopTest}\nocomment
+% \begin{macrocode}
+\def\vx@SkipLoopTest{%
+ \vx@MakeSpaceSpace
+ \ifx\varindexNextToken\vx@spaceothertok
+ \def\vx@skipnext{\vx@gobblespace a}%
+ \else
+ \let\vx@skipnext\vx@skipexec
+ \fi
+ \vx@skipnext}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@gobblespace}\nocomment
+% \begin{macrocode}
+\def\vx@gobblespace a#1{\vx@atespacetrue\varindexSkipTricky}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\vx@Main}
+% This macro is called after all arguments are read into appropriate macros.
+% Now the macros will be parsed (possibly using the argument
+% \meta{mainprogram}), and then the output is produced.
+% Finally, the group is closed and a possible ``eaten space'' is put back.
+% \begin{macrocode}
+\def\vx@Main{%
+ \ifx\varindexStarPos\undefined
+ \varindexStarfalse
+ \else
+ \varindexStartrue
+ \fi
+ \ifx\vx@formatA\undefined
+% \end{macrocode}
+% The default format is empty if no default format is given
+% \begin{macrocode}
+ \let\varindexFormatDefault\toolboxEmpty
+ \else
+ \ifvarindexStar
+ \ifx\vx@formatAstar\undefined
+ \let\varindexFormatDefault\vx@formatA
+ \else
+ \let\varindexFormatDefault\vx@formatAstar
+ \fi
+ \else
+ \let\varindexFormatDefault\vx@formatA
+ \fi
+ \fi
+% \end{macrocode}
+% Now we parse \meta{main entries}:
+% \begin{macrocode}
+ \toolboxDef\vx@toparse{\vx@text\vx@word\vx@endparse}%
+ \ifx\varindexOneEntry\undefined
+ \varindexCount=0\relax
+ \let\vx@NextLoop\vx@TextLoop
+ \vx@TextLoop
+ \else
+ \varindexCount=1\relax
+ \ifvarindexEliminateOuterBrace
+ \toolboxDropBrace\vx@text
+ \fi
+ \expandafter\vx@TextEntry\expandafter{\vx@text}%
+ \fi
+ \expandafter
+ \def\expandafter\varindexLastEntry\expandafter{\the\varindexCount}%
+% \end{macrocode}
+% Now we expand the format(s):
+% \begin{macrocode}
+ \varindexedef\varindexFormatDefault{\varindexFormatDefault}%
+ \ifx\varindexFormat\undefined
+ \varindexExplicitFormatfalse
+ \let\varindexFormat\varindexFormatDefault
+ \else
+ \varindexExplicitFormattrue
+ \varindexedef\varindexFormat{\varindexFormat}%
+ \fi
+% \end{macrocode}
+% Now we execute \meta{mainprogram}, and expand "\varindexFormat" again:
+% \begin{macrocode}
+ \ifx\vx@mainprogram\undefined\else
+ \vx@mainprogram
+ \varindexedef\varindexFormat{\varindexFormat}%
+ \fi
+% \end{macrocode}
+% Still modify "\varindexFormat":
+% \begin{macrocode}
+ \ifvarindexStar
+% \end{macrocode}
+% Prepend `"*"' resp. `"*"\myspace'
+% \begin{macrocode}
+ \expandafter\varindexSplitAtOutput\expandafter{\varindexFormat}\vx@fa\vx@fb
+ \ifx\vx@fb\undefined
+% \end{macrocode}
+% The `"*"' does not occur in "\varindexFormat"
+% \begin{macrocode}
+ \expandafter\varindexSplitAtIndex\expandafter{\varindexFormat}%
+ \vx@fa\vx@fb
+ \ifx\vx@fb\undefined
+% \end{macrocode}
+% We did not find a `space'
+% \begin{macrocode}
+ \let\vx@fa\undefined
+ \fi
+ \ifx\vx@fa\toolboxEmpty
+% \end{macrocode}
+% Did we find a `space' immediately at the start?
+% Then prepend only `"*"'
+% \begin{macrocode}
+ \toolboxDef\varindexFormat{\varindexOutputString\varindexFormat}%
+ \else
+% \end{macrocode}
+% prepend `"*"\myspace'
+% \begin{macrocode}
+ \toolboxDef\varindexFormat{%
+ \varindexOutputString\varindexIndexString\varindexFormat}%
+ \fi
+ \fi
+ \fi
+ \ifx\varindexFormat\varindexOutputString
+% \end{macrocode}
+% Replace `"*"' by `"*"\myspace'
+% \begin{macrocode}
+ \toolboxDef\varindexFormat{\varindexOutputString\varindexIndexString}%
+ \fi
+% \end{macrocode}
+% Now we interpret "\varindexFormat" and produce the output:
+% \begin{macrocode}
+ \ifx\varindexFormat\toolboxEmpty
+ \vx@FormatAll
+ \else
+ \toolboxDef\vx@toparse{\varindexFormat\varindexIndexString\vx@endparse}%
+ \let\vx@NextLoop\vx@FormLoop
+ \vx@FormLoop
+ \fi
+ \ifvx@savespace\aftergroup\space\fi
+\endgroup}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@endparse}
+% "\vx@endparse" is the end of the string to parse:
+% \begin{macrocode}
+\def\vx@endparse{\vx@endparse}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\vx@TextLoop}
+% This is the (recursive) macro which parses \meta{main entries}.
+% For each entry (separated by "\vx@word"), possibly with braces
+% eliminated, the macro "\vx@TextEntry" is called.
+%
+% \begin{macrocode}
+\def\vx@TextLoop{%
+ \ifx\vx@toparse\vx@endparse
+ \let\vx@NextLoop\toolboxEmpty
+ \else
+ \advance\varindexCount by 1\relax
+ \expandafter\vx@SplitAtWord\expandafter{\vx@toparse}%
+ \vx@textentry\vx@toparse
+ \ifvarindexEliminateOuterBrace
+ \toolboxDropBrace\vx@textentry
+ \fi
+ \expandafter\vx@TextEntry\expandafter{\vx@textentry}%
+ \fi
+ \vx@NextLoop}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@FormLoop}
+% This is the (recursive) macro which parses the \meta{format}.
+% For each entry (separated by space or by "*") the function
+% "\vx@Format" is called with "\varindexIndexMode" set correspondingly.
+% \begin{macrocode}
+\def\vx@FormLoop{%
+ \ifx\vx@toparse\vx@endparse
+ \let\vx@NextLoop\toolboxEmpty
+ \else
+ \expandafter\varindexSplitAtIndex\expandafter{\vx@toparse}\vx@fa\vx@fb
+ \expandafter\varindexSplitAtOutput\expandafter{\vx@fa}\vx@fa\vx@fc
+ \ifx\vx@fa\toolboxEmpty
+% \end{macrocode}
+% Have we reached an empty entry in the format string?
+% \begin{macrocode}
+ \ifvx@firstiter%% In the first iteration,
+%% \ifx\vx@fc\undefined% if 'space' is the very first sign,
+%% \vx@FormatAll% we output everything
+%% \fi
+ \else
+% \end{macrocode}
+% Later, we always output everything.
+% \begin{macrocode}
+ \vx@FormatAll
+ \fi
+ \else
+% \end{macrocode}
+% Usually, we just work with our current entry
+% \begin{macrocode}
+ \expandafter\vx@Format\expandafter{\vx@fa}%
+ \fi
+ \vx@firstiterfalse
+ \ifx\vx@fc\undefined
+% \end{macrocode}
+% If the first separating sign is 'space':
+% \begin{macrocode}
+ \varindexIndexModetrue
+ \let\vx@toparse\vx@fb
+ \else
+% \end{macrocode}
+% If the first separating sign is "*":
+% \begin{macrocode}
+ \varindexIndexModefalse
+ \expandafter
+ \varindexSplitAtOutput\expandafter{\vx@toparse}\vx@fa\vx@toparse
+ \fi
+ \fi
+ \vx@NextLoop}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\vx@FormatAll}
+% This macro is as "\vx@Format", just that everything is output:
+% \begin{macrocode}
+\def\vx@FormatAll{%
+ \vx@FormatInit
+ \expandafter
+ \def\expandafter\vx@Count\expandafter{\the\varindexCount}\relax
+ \varindexCount=0\relax
+ \let\vx@NextFormatAllLoop\vx@FormatAllLoop
+ \vx@FormatAllLoop
+ \expandafter\varindexCount\expandafter=\vx@Count\relax
+ \vx@Write}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@FormatAllLoop}\nocomment
+% \begin{macrocode}
+\def\vx@FormatAllLoop{%
+ \advance\varindexCount by 1\relax
+ \expandafter
+ \varindexAddNumber\expandafter{\the\varindexCount}%
+ \expandafter
+ \ifnum\varindexLastEntry=\varindexCount
+ \let\vx@NextFormatAllLoop\toolboxEmpty
+ \fi
+ \vx@NextFormatAllLoop}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@AppendwithCount}
+% The content of the variable "#2\the\varindexCount" is appended to "#1".
+% If both, "#1" and "#2\the\varindexCount" are nonempty, a space
+% is inserted between.
+% \begin{macrocode}
+\def\vx@AppendWithCount#1#2{%
+ \toolboxLet\vx@tmp{#2\the\varindexCount}%
+ \ifx#1\toolboxEmpty
+ \let#1\vx@tmp
+ \else
+ \ifx\vx@tmp\toolboxEmpty\else\toolboxAppend#1{\toolboxSpace\vx@tmp}\fi
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\vx@Format}
+% This is the macro which parses the format string "#1" for one single
+% output, either into index or into running text, depending on
+% "\ifvarindexIndexMode".
+%
+% \begin{macrocode}
+\def\vx@Format#1{%
+ \vx@FormatInit
+ \def\vx@fparse{#1}%
+ \toolboxAppend\vx@fparse\vx@endparse
+ \let\vx@FormatNextLoop\vx@FormatLoop
+ \vx@FormatLoop
+ \vx@Write
+}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@FormatInit}\nocomment
+% \begin{macrocode}
+\def\vx@FormatInit{%
+ \let\vx@outputlist\toolboxEmpty
+ \let\vx@textlist\toolboxEmpty
+ \let\vx@sortlist\toolboxEmpty
+ \let\vx@textlistBefore\toolboxEmpty
+ \let\vx@sortlistBefore\toolboxEmpty
+ \let\vx@tildeAText\varindexPlaceholderAText
+ \let\vx@tildeASort\varindexPlaceholderASort
+ \let\vx@tildeBText\varindexPlaceholderBText
+ \let\vx@tildeBSort\varindexPlaceholderBSort
+ \vx@tildeLeadtrue
+ \ifvarindexCommaExpand
+ \vx@commaTextLeadtrue
+ \vx@commaSortLeadtrue
+ \else
+ \vx@commaTextLeadfalse
+ \vx@commaSortLeadfalse
+ \fi
+ \varindexNoNextSpace
+}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@FormatLoop}
+% "\vx@FormatLoop" is the main loop which parses one (space-separated) entry
+% in the format string. The essential part here is the command
+% "\vx@HandleFormat" which is described below.
+% Essentially, "\vx@HandleFormat" is a list of subsequent calls to
+% "\vx@condexec"
+% \begin{macrocode}
+\def\vx@FormatLoop{%
+ \vx@ffoundfalse
+ \ifx\vx@fparse\vx@endparse
+ \let\vx@FormatNextLoop\toolboxEmpty
+ \else
+ \vx@HandleFormat
+ \ifvx@ffound\else
+ \expandafter\vx@ErrorFormat\vx@fparse
+ \let\vx@FormatNextLoop\toolboxEmpty
+ \fi
+ \fi
+ \vx@FormatNextLoop
+}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@condexec}\nocomment
+% \begin{macrocode}
+\def\vx@condexec#1#2{\ifvx@ffound\else
+ \expandafter #1\expandafter{\vx@fparse}\vx@fparseA\vx@fparseB
+ \ifx\vx@fparseB\undefined\else
+ \ifx\vx@fparseA\toolboxEmpty
+ \let\vx@fparse\vx@fparseB
+ \vx@ffoundtrue
+ #2%
+ \fi
+ \fi
+\fi}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@HandleFormat}
+% "\vx@HandleFormat" is a list of commands of the form
+% "\vx@condexec"\bracemeta{splitcommand}\bracemeta{action}.
+% The idea is that if \meta{splitcommand} splits at the `current' token
+% of the format string then \meta{action} is executed.
+% For details, see "\vx@condexec".
+% The list "\vx@Handle" format is generated by "\varindexNewFormat".
+% \begin{macrocode}
+\let\vx@HandleFormat\toolboxEmpty
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexNewFormat}
+% \begin{macrocode}
+\def\varindexNewFormat#1#2{%
+ \toolboxSurround{\vx@condexec{#1}{#2}}{}\vx@HandleFormat}
+
+% \end{macrocode}
+% \end{macro}
+% Now we initialize the default actions for the format string. However,
+% it is necessary to postpone the expansion of the "\vx@NewStdFormat" commands
+% (which call "\varindexNewFormat") until "\varindexOutExclam" etc.\ have
+% been initialized: In fact, the macro "\vx@NewStdFormat" uses "\csname"
+% and thus implicitly sets those variables to "\relax" which conflicts with
+% our initialization, because we define "\varindexOutExclam" and friends
+% only if they are "\undefined" (so that we do not override previous user
+% definitions of these macros).\par
+% \begin{macrocode}
+%% This macro is executed near the end of this file.
+\def\varindexAddOmit{% The name is a fake: The macro redefines this macro
+% \end{macrocode}
+% \begin{macro}{\varindexAddSpace}
+% "\varindexAddSpace" is made by a scheme from "\vx@NewStdFormat"
+% \begin{macrocode}
+ \vx@NewStdFormat\varindexSplitAtSpace{Space}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexAddSpTok}
+% "\varindexAddSpTok" is made by a scheme from "\vx@NewStdFormat"
+% \begin{macrocode}
+ \vx@NewStdFormat\varindexSplitAtSpaceTok{SpTok}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexAddOmit}
+% "\varindexAddOmit" is made by a scheme from "\vx@NewStdFormat"
+% \begin{macrocode}
+ \vx@NewStdFormat\varindexSplitAtOmit{Omit}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+ \varindexNewFormat\varindexSplitSpace{}% Spaces in inner format are ignored
+ \varindexNewFormat\varindexSplitAtDash\varindexAddDash
+ \varindexNewFormat\varindexSplitAtTildeB\varindexAddTildeB
+ \varindexNewFormat\varindexSplitAtTildeA\varindexAddTildeA
+ \varindexNewFormat\varindexSplitAtComma\varindexAddComma
+ \varindexNewFormat\varindexSplitAtExclam\varindexAddExclam
+ \let\vx@NewStdFormat\undefined% We do not need this generic macro anymore
+}
+
+% \end{macrocode}
+% \begin{macro}{\vx@NewStdFormat}
+% \begin{myquote}
+% "\vx@NewStdFormat\"\meta{splitcmd}\bracemeta{name}
+% \end{myquote}
+% calls
+% \begin{myquote}
+% "\varindexNewFormat\"\meta{splitcmd}"\varindexAdd"\meta{name}
+% \end{myquote}
+% and defines the corresponding macro "\varindexAdd"\meta{name} by
+% \begin{myquote}
+% "\def\varindexAdd"\meta{name}"{\varindexPreceeds"\meta{name}\\
+% " \varindexTokensOutExpand"\\
+% " \varindexOutText"\meta{name}\\
+% " \varindexOutSort"\meta{name}\\
+% " \varindexFollows"\meta{name}"}"
+% \end{myquote}
+% \begin{macrocode}
+\def\vx@NewStdFormat#1#2{%
+ \expandafter
+ \varindexNewFormat\expandafter#1\csname varindexAdd#2\endcsname
+ \expandafter
+ \def\expandafter\vx@tmp\expandafter{%
+ \csname varindexPreceeds#2\expandafter\endcsname
+ \expandafter
+ \varindexTokensOutExpand
+ \csname varindexOutText#2\expandafter\endcsname
+ \csname varindexOutSort#2\expandafter\endcsname
+ \csname varindexFollows#2\endcsname}
+ \expandafter\let\csname varindexAdd#2\endcsname\vx@tmp}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexAddNumber}\nocomment
+% \begin{macrocode}
+\def\varindexAddNumber#1{%
+ \ifnum\varindexCount<#1%
+ \expandafter\vx@ErrorNumber\expandafter{\the\varindexCount}{#1}%
+ \fi
+ \ifvarindexIndexMode
+ \toolboxLet\vx@adda{varindexEntry#1}%
+ \toolboxLet\vx@addb{varindexSort#1}%
+ \else
+ \toolboxLet\vx@adda{varindexPlain#1}%
+ \fi
+ \vx@Addit\varindexSpaceTexttrue\varindexSpaceSorttrue}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexAddDash}
+% \begin{macrocode}
+\def\varindexAddDash{%
+ \varindexPreceedsDash
+ \ifx\vx@sortlist\toolboxEmpty
+ \varindexTokensOutExpand\varindexOutTextDash\varindexOutSortDashBeg
+ \else
+ \varindexTokensOutExpand\varindexOutTextDash\varindexOutSortDash
+ \fi
+ \varindexFollowsDash}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexAddComma}\nocomment
+% \begin{macrocode}
+\def\varindexAddComma{%
+ \ifvarindexCommaLeads
+ \vx@tildeLeadtrue
+ \fi
+ \ifvarindexCommaExpand
+ \let\vx@tildeAText\vx@textlist
+ \let\vx@tildeBText\vx@textlist
+ \ifvarindexIndexMode
+ \let\vx@tildeASort\vx@sortlist
+ \let\vx@tildeBSort\vx@sortlist
+ \fi
+ \fi
+ \varindexPreceedsComma
+ \varindexTokensOutExpand\varindexOutTextComma\varindexOutSortComma
+ \vx@flushToBefore
+ \ifvarindexCommaExpand
+ \vx@commaTextLeadtrue\vx@commaSortLeadtrue
+ \fi
+ \varindexFollowsComma}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@flushToBefore}\nocomment
+% \begin{macrocode}
+\def\vx@flushToBefore{%
+ \ifvarindexCommaExpand
+ \toolboxAppend\vx@textlistBefore\vx@textlist
+ \let\vx@textlist\toolboxEmpty
+ \ifvarindexIndexMode
+ \toolboxAppend\vx@sortlistBefore\vx@sortlist
+ \let\vx@sortlist\toolboxEmpty
+ \fi
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexAddTildeA}\nocomment
+% \begin{macrocode}
+\def\varindexAddTildeA{%
+ \ifvarindexUsePlaceholderA
+ \ifvx@tildeLead
+ \ifvarindexLeadingPlaceholderA
+ \vx@AddingTildeA
+ \fi
+ \else
+ \vx@AddingTildeA
+ \fi
+ \fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@AddingTildeA}\nocomment
+% \begin{macrocode}
+\def\vx@AddingTildeA{%
+ \ifvarindexPreviousAText
+ \let\vx@adda\vx@tildeAText
+ \else
+ \let\vx@adda\varindexPlaceholderAText
+ \fi
+ \ifvarindexPreviousASort
+ \let\vx@addb\vx@tildeASort
+ \else
+ \let\vx@addb\varindexPlaceholderASort
+ \fi
+ \vx@Addit\varindexSpaceTexttrue\varindexSpaceSorttrue}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@AddTildeB}\nocomment
+% \begin{macrocode}
+\def\varindexAddTildeB{%
+ \ifvarindexUsePlaceholderB
+ \ifvx@tildeLead
+ \ifvarindexLeadingPlaceholderB
+ \vx@AddingTildeB
+ \fi
+ \else
+ \vx@AddingTildeB
+ \fi
+ \fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@AddingTildeB}\nocomment
+% \begin{macrocode}
+\def\vx@AddingTildeB{%
+ \ifvarindexPreviousBText
+ \let\vx@adda\vx@tildeBText
+ \else
+ \let\vx@adda\varindexPlaceholderBText
+ \fi
+ \ifvarindexPreviousBSort
+ \let\vx@addb\vx@tildeBSort
+ \else
+ \let\vx@addb\varindexPlaceholderBSort
+ \fi
+ \vx@Addit\varindexSpaceTexttrue\varindexSpaceSorttrue}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexNextSpace}\nocomment
+% \begin{macrocode}
+\def\varindexNextSpace{\varindexSpaceTexttrue\varindexSpaceSorttrue}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexNoNextSpace}\nocomment
+% \begin{macrocode}
+\def\varindexNoNextSpace{\varindexSpaceTextfalse\varindexSpaceSortfalse}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexTokensOut}\nocomment
+% \begin{macrocode}
+\long\def\varindexTokensOut#1#2{\def\vx@adda{#1}\def\vx@addb{#2}\vx@Addit{}{}}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexTokensOutExpand}\nocomment
+% \begin{macrocode}
+\def\varindexTokensOutExpand#1#2{\let\vx@adda#1\let\vx@addb#2\vx@Addit{}{}}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@Addit}
+% \begin{myquote}
+% "\vx@Addit"\bracemeta{command A}\bracemeta{command B}
+% \end{myquote}
+% Does the following if "\vx@adda"/"\vx@addb" is nonempty:
+% \begin{myquote}
+% Add (space +) "\vx@adda"/"\vx@addb" to "\vx@textlist"/"\vx@sortlist"\\
+% (Shift space to "\vx@...listBefore" if "\ifvx@comma...Lead" is true).\\
+% "\vx@tildeLeadfalse" (only if "\vx@adda" is nonempty)\\
+% "\varindexSpace...false"\\
+% "\vx@comma...Leadfalse"\\
+% Execute \meta{command A/B}
+% \end{myquote}
+% \begin{macrocode}
+\def\vx@Addit#1#2{%
+ \ifx\vx@adda\toolboxEmpty\else
+ \vx@tildeLeadfalse
+ \ifvarindexSpaceText
+ \varindexSpaceTextfalse
+ \ifvx@commaTextLead
+ \toolboxAppend\vx@textlistBefore\toolboxSpace
+ \let\vx@textlist\vx@adda
+ \else
+ \toolboxAppend\vx@textlist{\toolboxSpace\vx@adda}%
+ \fi
+ \else
+ \toolboxAppend\vx@textlist\vx@adda
+ \fi
+ \vx@commaTextLeadfalse
+ #1%
+ \fi
+ \ifvarindexIndexMode
+ \ifx\vx@addb\toolboxEmpty\else
+ \ifvarindexSpaceSort
+ \varindexSpaceSortfalse
+ \ifvx@commaSortLead
+ \toolboxAppend\vx@sortlistBefore\toolboxSpace
+ \let\vx@sortlist\vx@addb
+ \else
+ \toolboxAppend\vx@sortlist{\toolboxSpace\vx@addb}%
+ \fi
+ \else
+ \toolboxAppend\vx@sortlist\vx@addb
+ \fi
+ \vx@commaSortLeadfalse
+ #2%
+ \fi
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexAddExclam}\nocomment
+% \begin{macrocode}
+\def\varindexAddExclam{%
+ \ifvarindexIndexMode
+ \vx@Flush
+ \toolboxAppend\vx@outputlist\varindexOutExclam
+ \else
+ \errmessage{\string\varindex: %
+ Subitem can only be used for index, not for running text}%
+ \fi
+ \varindexFollowsExclam
+}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@ErrorFormat}\nocomment
+% "\vx@ErrorFormat" outputs the format until the content of "\vx@endparse" is
+% reached.
+% \begin{macrocode}
+\expandafter
+\def\expandafter\vx@ErrorFormat\expandafter#\expandafter 1\vx@endparse
+ {\errmessage{\string\varindex: Error in format `#1'}}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@ErrorNumber}\nocomment
+% \begin{macrocode}
+\def\vx@ErrorNumber#1#2{\errmessage{\string\varindex: %
+ Entry `#2' does not exist (only #1 entries)}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\vx@Write}
+% The main output macro (either into "\index" or into running text):
+%
+% \begin{macrocode}
+\def\vx@Write{%
+ \vx@Flush
+ \ifvarindexIndexMode
+ \toolboxAppend\vx@outputlist\varindexAppend
+ \vx@MakeHarmless\vx@outputlist
+ \expandafter
+ \varindexIndex\expandafter{\vx@outputlist}%
+ \else
+ \expandafter
+ \varindexStyle\expandafter{\vx@outputlist}%
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@Flush}
+% Put the text buffered in "\vx@textlistBefore\vx@textlist" and
+% "\vx@sortlistBefore\vx@sortlist" to "\vx@outputlist" in the way appropriate
+% fot the output, and delete the buffers.
+% Moreover, prepare "\vx@tilde?Text" and friends correspondingly.
+%
+% \begin{macrocode}
+\def\vx@Flush{%
+ \vx@tildeLeadtrue
+ \vx@commaTextLeadtrue
+ \vx@commaSortLeadtrue
+ \let\vx@tildeAText\vx@textlist
+ \let\vx@tildeBText\vx@textlist
+ \ifvarindexIndexMode
+ \let\vx@tildeASort\vx@sortlist
+ \let\vx@tildeBSort\vx@sortlist
+ \toolboxDef\vx@textlist{\vx@textlistBefore\vx@textlist}%
+ \toolboxDef\vx@sortlist{\vx@sortlistBefore\vx@sortlist}%
+ \ifx\vx@textlist\vx@sortlist
+ \toolboxAppend\vx@outputlist\vx@textlist
+ \else
+ \toolboxAppend\vx@outputlist{\vx@sortlist\vx@otherat\vx@textlist}%
+ \fi
+ \let\vx@sortlistBefore\toolboxEmpty
+ \let\vx@sortlist\toolboxEmpty
+ \else
+ \toolboxAppend\vx@outputlist{\vx@textlistBefore\vx@textlist}%
+ \fi
+ \let\vx@textlistBefore\toolboxEmpty
+ \let\vx@textlist\toolboxEmpty}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\vx@TextEntry}
+% "\vx@TextEntry"\bracemeta{\texttt{\#1}} defines
+% "\varindexEntry"/"Sort"/"Plain1-..."
+% with the values corresponding to entry "#1". Here, "1-..." is
+% "\the\varindexCount". If necessary, inner braces are eliminated
+%
+% \begin{macrocode}
+\def\vx@TextEntry#1{%
+ \vx@SplitAtSort{#1}\vx@textEntryA\vx@textEntryB
+ \expandafter\vx@SplitAtPlain\expandafter{\vx@textEntryA}%
+ \vx@textEntryA\vx@textEntryC
+ \vx@LetEliminated{varindexEntry}\vx@textEntryA
+ \ifx\vx@textEntryB\undefined
+% \end{macrocode}
+% No sort entry:
+% \begin{macrocode}
+ \vx@LetEliminated{varindexSort}\vx@textEntryA
+ \ifx\vx@textEntryC\undefined
+ \vx@LetEliminated{varindexPlain}\vx@textEntryA
+ \else
+ \vx@LetEliminated{varindexPlain}\vx@textEntryC
+ \fi
+ \else
+% \end{macrocode}
+% Sort entry:
+% \begin{macrocode}
+ \ifx\vx@textEntryC\undefined
+ \expandafter\vx@SplitAtPlain\expandafter{\vx@textEntryB}%
+ \vx@textEntryB\vx@textEntryC
+ \fi
+ \vx@LetEliminated{varindexSort}\vx@textEntryB
+ \ifx\vx@textEntryC\undefined
+ \vx@LetEliminated{varindexPlain}\vx@textEntryA
+ \else
+ \vx@LetEliminated{varindexPlain}\vx@textEntryC
+ \fi
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@LetEliminated}\nocomment
+% \begin{macrocode}
+\def\vx@LetEliminated#1#2{%
+ \let\vx@tmp#2%
+ \ifvarindexEliminateInnerBrace
+ \toolboxDropBrace\vx@tmp
+ \fi
+ \toolboxWithNr{\the\varindexCount}\let{#1}\vx@tmp}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexMakeVarSplit}\nocomment
+% \begin{macrocode}
+\def\varindexMakeVarSplit#1#2#3{\varindexedef#1{#2}\expandafter
+ \toolboxMakeSplit\expandafter{#1}{#3}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexMakeSplitExpand}\nocomment
+% \begin{macrocode}
+\def\varindexMakeSplitExpand#1#2{\varindexMakeVarSplit\vx@tmp{#1}{#2}}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexSetWordString}
+% \begin{macro}{\vx@SplitAtWord}\nocomment
+% \begin{macrocode}
+\def\varindexSetWordString#1{\def\vx@word{#1}%
+ \toolboxMakeSplit{#1}{vx@SplitAtWord}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\varindexSetSortString}
+% \begin{macro}{\vx@SplitAtSort}\nocomment
+% \begin{macrocode}
+\def\varindexSetSortString#1{%
+ \toolboxMakeSplit{#1}{vx@SplitAtSort}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\varindexSetPlainString}
+% \begin{macro}{\vx@SplitAtPlain}\nocomment
+% \begin{macrocode}
+\def\varindexSetPlainString#1{%
+ \toolboxMakeSplit{#1}{vx@SplitAtPlain}}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\vx@tmp}
+% Temporarily, we define a generic command:
+% \begin{myquote}
+% "\vx@tmp"\bracemeta{name}
+% \end{myquote}
+% is (temporarily) a call which is equivalent to:
+% \begin{myquote}
+% "\def\varindexSet"\meta{name}"String#1{%"\\
+% " \varindexMakeVarSplit"\relax
+%"\varindex"\meta{name}"String{#1}{varindexSplitAt"\meta{name}"}}"
+% \end{myquote}
+% \begin{macrocode}
+\def\vx@tmp#1{%
+ \expandafter
+ \def\expandafter\vx@adda\expandafter##\expandafter 1\expandafter{%
+ \expandafter
+ \varindexMakeVarSplit\csname varindex#1String\endcsname
+ {##1}{varindexSplitAt#1}}%
+ \expandafter
+ \let\csname varindexSet#1String\endcsname\vx@adda}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexSetIndexString}
+% \begin{macro}{\varindexSplitAtIndex}\nocomment
+% \begin{macrocode}
+\vx@tmp{Index}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\varindexSetOutputString}
+% \begin{macro}{\varindexSplitAtOutput}\nocomment
+% \begin{macrocode}
+\vx@tmp{Output}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\varindexSetTildeAString}
+% \begin{macro}{\varindexSplitAtTildeA}\nocomment
+% \begin{macrocode}
+\vx@tmp{TildeA}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\varindexSetTildeBString}
+% \begin{macro}{\varindexSplitAtTildeB}\nocomment
+% \begin{macrocode}
+\vx@tmp{TildeB}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\varindexSetSpaceString}
+% \begin{macro}{\varindexSplitAtSpace}\nocomment
+% \begin{macrocode}
+\vx@tmp{Space}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\varindexSetSpaceTokString}
+% \begin{macro}{\varindexSplitAtSpaceTok}\nocomment
+% \begin{macrocode}
+\vx@tmp{SpaceTok}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\varindexSetOmitString}
+% \begin{macro}{\varindexSplitAtOmit}\nocomment
+% \begin{macrocode}
+\vx@tmp{Omit}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\varindexSetCommaString}
+% \begin{macro}{\varindexSplitAtComma}\nocomment
+% \begin{macrocode}
+\vx@tmp{Comma}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\varindexSetDashString}
+% \begin{macro}{\varindexSplitAtDash}\nocomment
+% \begin{macrocode}
+\vx@tmp{Dash}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\varindexSetExclamString}
+% \begin{macro}{\varindexSplitAtExclam}\nocomment
+% \begin{macrocode}
+\vx@tmp{Exclam}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\varindexSetStringForNr}
+% \begin{macro}{\varindexSplitAtNr}\nocomment
+% \begin{macrocode}
+\def\varindexSetStringForNr#1#2{%
+ \edef\vx@adda{#1}%
+ \expandafter
+ \vx@AddToHandleNrs\csname varindexSplitAtNr\vx@adda\endcsname
+% \end{macrocode}
+% It is important to define the instance only \emph{after} the call of
+% "\vx@AddToHandleNrs" (because this macro tests the existence).
+% \begin{macrocode}
+ \expandafter
+ \varindexMakeVarSplit\csname varindexNr\vx@adda String\endcsname
+ {#2}{varindexSplitAtNr\vx@adda}}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\vx@AddToHandleNrs}
+% "\vx@AddToHandleNrs{\vx@HandleNr1}"
+% tests whether "\vx@HandleNr1" is already defined:
+% If not (i.\,e.\ "\relax" because we use it with "\csname") the call
+% \begin{myquote}
+% "\varindexNewFormat\varindexSplitAtNr1{\varindexAddNumber"\relax
+%\bracemeta{content of \cmdcite{vx@adda}}"}"
+% \end{myquote}
+% is executed.
+% \begin{macrocode}
+\def\vx@AddToHandleNrs#1{%
+ \ifx#1\relax
+ \expandafter
+ \varindexNewFormat\expandafter#1\expandafter{\expandafter
+ \varindexAddNumber\expandafter{\vx@adda}}%
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\varindexedef}
+% This macro is described in the main documentation.
+% \begin{macrocode}
+\def\varindexedef#1#2{%
+ \let\vx@tildemerk~%
+ \let~\vx@nicetilde
+ \edef#1{#2}%
+ \let~\vx@tildemerk}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\varindexDoConvert}\nocomment
+% \begin{macrocode}
+\def\varindexDoConvert{\let\vx@MakeHarmless\toolboxMakeHarmless}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexNoConvert}\nocomment
+% \begin{macrocode}
+\def\varindexNoConvert{\def\vx@MakeHarmless##1{}}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \par\hrule\par\null\par
+% Finally, some definitions which require catcode-trickery:
+%
+%
+% \begin{macro}{\vx@nicetilde}
+% "\vx@nicetilde" expands to a tilde with a nonactive catcode.
+%
+% \begin{macrocode}
+\def\vx@tmp{\catcode`\~=13\relax}
+\catcode`\~=11\relax\def\vx@nicetilde{~}\vx@tmp
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@spaceothertok}
+% \begin{macro}{\vx@MakeSpaceOther}\nocomment
+% \begin{macrocode}
+\def\vx@MakeSpaceOther{\catcode`\ =13\relax}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@MakeSpaceSpace}\nocomment
+% \begin{macrocode}
+\def\vx@MakeSpaceSpace{\catcode`\ =10\relax}
+\vx@MakeSpaceOther%<- This % is important
+\let\vx@spaceothertok= %<- This ` %' is important
+\vx@MakeSpaceSpace
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\vx@otherat}
+% "\def\vx@otherat{@}" is a bad idea, since then
+% "@" has the wrong catcode. So we use a temporary macro to define it:
+% We misuse the name "\varindexArgumentSpace" to this purpose.
+% Of course, we must redefine the latter afterwards.
+% \begin{macrocode}
+\def\varindexArgumentSpace#1{\def\vx@otherat{#1}}
+\ifx\makeatother\undefined\catcode`\@=12\relax\else\makeatother\fi
+\varindexArgumentSpace{@}
+
+% \end{macrocode}
+% \end{macro}
+%
+% Initialize default values (you should have the `usual' catcodes here.
+% In particular, "\makeatother" must be called before if `"@"'
+% is used as argument).
+% \begin{macro}{\varindexArgumentSpace}\nocomment
+% \begin{macrocode}
+\let\varindexArgumentSpace\varindexSkipDefault
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\varindexIndex}
+% We use "\def" for "\varindexIndex" so that a redefinition of "\index" also
+% redefines our command.
+% \begin{macrocode}
+\toolboxIf\undefined\def\varindexIndex{\index}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\vx@MakeHarmless}\nocomment
+% \begin{macrocode}
+\varindexDoConvert
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+\toolboxIf\undefined\def\varindexOutExclam{!}
+\toolboxIf\undefined\let\varindexFollowsExclam\varindexNoNextSpace
+\toolboxIf\undefined\def\varindexOutTextComma{,}
+\toolboxIf\undefined\def\varindexOutSortComma{,}
+\toolboxIf\undefined\let\varindexFollowsComma\varindexNextSpace
+\toolboxIf\undefined\let\varindexPreceedsComma\varindexNoNextSpace
+\toolboxIf\undefined\def\varindexOutTextSpace{ }
+\toolboxIf\undefined\def\varindexOutSortSpace{ }
+\toolboxIf\undefined\let\varindexFollowsSpace\toolboxEmpty
+\toolboxIf\undefined\let\varindexPreceedsSpace\varindexNoNextSpace
+\toolboxIf\undefined\def\varindexOutTextSpTok{\space}
+\toolboxIf\undefined\def\varindexOutSortSpTok{ }
+\toolboxIf\undefined\let\varindexFollowsSpTok\toolboxEmpty
+\toolboxIf\undefined\let\varindexPreceedsSpTok\varindexNoNextSpace
+\toolboxIf\undefined\def\varindexOutTextDash{-}
+\toolboxIf\undefined\def\varindexOutSortDash{-}
+\toolboxIf\undefined\let\varindexOutSortDashBeg\toolboxEmpty
+\toolboxIf\undefined\let\varindexFollowsDash\toolboxEmpty
+\toolboxIf\undefined\let\varindexPreceedsDash\varindexNoNextSpace
+\toolboxIf\undefined\let\varindexOutTextOmit\toolboxEmpty
+\toolboxIf\undefined\let\varindexOutSortOmit\toolboxEmpty
+\toolboxIf\undefined\let\varindexFollowsOmit\toolboxEmpty
+\toolboxIf\undefined\let\varindexPreceedsOmit\varindexNoNextSpace
+% \end{macrocode}
+% For the following macro, see the remarks in the definition of
+% the fake name "\varindexAddOmit" (after definition of "\varindexNewFormat")
+% \begin{macrocode}
+%% It is important that the following is after all \toolboxIf\undefined...
+\varindexAddOmit% Execute the fake macro and redefine \varindexAddOmit
+
+% \end{macrocode}
+%
+% \begin{macro}{\varindexSplitSpace}\nocomment
+% \begin{macrocode}
+\toolboxMakeSplit{ }{varindexSplitSpace}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\varindexSetWordString{ }
+\varindexSetSortString{@}
+\varindexSetPlainString{!}
+
+\varindexSetIndexString{ }
+\varindexSetOutputString{*}
+
+\varindexSetTildeAString{~}
+\varindexSetTildeBString{=}
+\varindexSetSpaceString{_}
+\varindexSetSpaceTokString{s}
+\varindexSetOmitString{.}
+\varindexSetCommaString{,}
+\varindexSetDashString{-}
+\varindexSetExclamString{!}
+\varindexSetStringForNr{10}{0}
+\varindexSetStringForNr 9{9}
+\varindexSetStringForNr 8{8}
+\varindexSetStringForNr 7{7}
+\varindexSetStringForNr 6{6}
+\varindexSetStringForNr 5{5}
+\varindexSetStringForNr 4{4}
+\varindexSetStringForNr 3{3}
+\varindexSetStringForNr 2{2}
+\varindexSetStringForNr 1{1}
+
+\ifx\makeatletter\undefined\catcode`\@=11\relax\else\makeatletter\fi
+
+% \end{macrocode}
+% \iffalse
+%</package>
+% \fi
+% \Finale\PrintIndex
+%
+%
+%
+% \iffalse
+%<*metainfo>
+% \fi
+\iffalse -------------------------------------------------------------
+%
+% Just in case that for some reason the file `varindex.ins' got lost:
+% The content of this file is between the lines %<*insfile> and %</insfile>:
+%
+%\iffalse
+%</metainfo>
+%<*insfile>
+\def\batchfile{varindex.ins}
+\input docstrip.tex
+\keepsilent
+\nopreamble
+\generateFile{varindex.sty}{f}{\from{varindex.dtx}{package}}
+\generateFile{varindex.txt}{f}{\from{varindex.dtx}{asciidocu}}
+\generateFile{varindex.tex}{f}{\from{varindex.dtx}{driver}}
+%%\generateFile{varindex.ins.dup}{f}{\from{varindex.dtx}{insfile}}
+
+\Msg{***************************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the}
+\Msg{* file 'varindex.sty' into a directory searched by TeX.}
+\Msg{*}
+\Msg{*}
+\Msg{* Run the file varindex.tex through LaTeX to produce the}
+\Msg{* documentation or read the ascii documentation in varindex.txt}
+\Msg{*}
+\Msg{*}
+\Msg{***************************************************************}
+\endbatchfile
+%</insfile>
+%<*metainfo>
+% \fi
+\fi
+% \iffalse
+%</metainfo>
+% \fi
+\endinput
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: "varindex.tex"
+%%% End:
diff --git a/Master/texmf-dist/source/latex/varindex/varindex.ins b/Master/texmf-dist/source/latex/varindex/varindex.ins
new file mode 100644
index 00000000000..1effe3fd4eb
--- /dev/null
+++ b/Master/texmf-dist/source/latex/varindex/varindex.ins
@@ -0,0 +1,21 @@
+\def\batchfile{varindex.ins}
+\input docstrip.tex
+\keepsilent
+\nopreamble
+\generateFile{varindex.sty}{f}{\from{varindex.dtx}{package}}
+\generateFile{varindex.txt}{f}{\from{varindex.dtx}{asciidocu}}
+\generateFile{varindex.tex}{f}{\from{varindex.dtx}{driver}}
+%%\generateFile{varindex.ins.dup}{f}{\from{varindex.dtx}{insfile}}
+
+\Msg{***************************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the}
+\Msg{* file 'varindex.sty' into a directory searched by TeX.}
+\Msg{*}
+\Msg{*}
+\Msg{* Run the file varindex.tex through LaTeX to produce the}
+\Msg{* documentation or read the ascii documentation in varindex.txt}
+\Msg{*}
+\Msg{*}
+\Msg{***************************************************************}
+\endbatchfile