Debian Codegraph @

texmf-dist/source/latex/varindex/varindex.dtx

raw
1 % \def\fileversion{2.3}\def\filedate{2001/05/06}\def\docdate{2013/11/26}
2 %\iffalse These lines are necessary for the doc and docstrip utilities
3 %<*asciidocu>
4
5 %%#
6 %%# Author:
7 %%#
8 %%# M. V\"ath [email protected]
9 %%#
10 %%# This package bases on ideas of indextwo.sty which was written jointly with
11 %%#
12 %%# O. Karch [email protected]
13 %%# H.-C. Wirth [email protected]
14
15 %%# The package may be distributed and/or modified under the conditions of
16 %%# the LaTeX Project Public License (version 1.3c or later).
17
18 %%#############################################################################
19 %%#
20 %%# This LaTeX package provides a luxury front-end for the \index command.
21 %%# For example, it allows to generate multiple \index entries in
22 %%# almost any form by a single command. Extremely customizable.
23 %%# Works with all versions of LaTeX and probably most other TeX formats, too.
24 %%# This package requires the toolbox package at least in version 3.1.
25 %%#
26 %%#############################################################################
27
28 %%#
29 %%# This package was tested with LaTeX 2.09 and LaTeX 2e and should work
30 %%# with all other (future) versions of LaTeX and friends, too.
31 %%# It should even run with other (non-LaTeX) formats if an \index command
32 %%# with LaTeX-Syntax is provided.
33 %%#
34
35 % If you have access to (reasonable new) docstrip TeXfiles, you should run
36 % tex/latex on the file
37 % `varindex.ins'
38 % to produce the files `varindex.sty', `varindex.txt' and `varindex.tex'.
39 % (In case `varindex.ins' is lost: You can find its content in the last
40 % few lines of the file you are currently reading between the
41 % lines %<*insfile> and %</insfile>;
42 % BTW: You should name this file here `varindex.dtx' before you run tex
43 % on varindex.ins).
44 %
45 % The file `varindex.txt' contains a `brief' (but complete) ascii
46 % documentation. If you have additionally access to LaTeX2e, you may run
47 % latex on the generated file `varindex.tex' to produce `varindex.dvi' which
48 % contains a more luxury documentation. (If you want an index or
49 % implementation details in the documentation read the comments in
50 % `varindex.tex' before running it through latex).
51 %
52 % If you do not have access to the docstrip TeXfiles you may simply
53 % copy/rename this file here into
54 % `varindex.sty'
55 % to use the package and read the ascii documentation in this file.
56 % The ascii documentation (the content of `varindex.txt') consists of all
57 % lines in this file which start with %%# (this is the above block and another
58 % (very large) block which follows soon).
59 %
60 % But I do not recommended this, because TeX will need more time to read this
61 % longer file, and because there might be a (very slight) incompatibility if
62 % you use it (namely if you load `varindex.sty' with some *extremely* strange
63 % catcodes).
64 % I recommend in this case instead to generate the file `varindex.sty' as
65 % anything between the lines %<*package> and %</package> by hand.
66 % (This is not precisely the file which you get with the docstrip TeXfiles,
67 % but a reasonable good substitute. To speed up loading, you may also
68 % eliminate all lines starting with `% ' in `varindex.sty').
69 % For your information: The file `varindex.tex' produced by the docstrip
70 % TeXfiles is anything between the lines %<*driver> and %</driver>
71 % (with a line containing \endinput and two comment lines appended)
72 %
73 %
74 % In any case, you end up with the file `varindex.sty'.
75 %
76 % If you can generate `varindex.tex', you will probably want to stop
77 % reading now and instead read the `luxury' documentation in `varindex.dvi'.
78 %
79 % Otherwise, you have to make due with the following ascii documentation.
80 %
81 %
82 % \fi\catcode\#14\relax\iffalse (This line is needed for the doc utility)
83 %
84
85 %%# To use varindex, you have to put `varindex.sty' in a path where TeX looks
86 %%# for its input files. You must also have the file `toolbox.sty' of the
87 %%# toolbox package in your path. The TeX documents using varindex need the
88 %%# following modifications in their header:
89 %%#
90 %%# a) If you use LaTeX2.09, use varindex as a style option, e.g.
91 %%# \documentstyle[varindex]{article}
92 %%# or
93 %%# \documentstyle[varindex,12pt]{article}
94 %%# b) If you use LaTeX2e, put in the preamble the command
95 %%# \usepackage{varindex}
96 %%# c) If you use some other (non-LaTeX) format, you will probably have to
97 %%# insert a line like
98 %%# \catcode`\@=11\input varindex.sty\catcode`\@=12\relax
99 %%#
100 %%# For TeX insiders: LaTeX-specific commands used in `varindex.sty' are only:
101 %%#
102 %%# \makeatother
103 %%# \makeatletter
104 %%# \typeout
105 %%# \RequirePackage
106 %%# \newcommand (only in the form \newcommand{\command}{} to ensure that
107 %%# \command was not defined before)
108 %%# \ProvidesPackage
109 %%#
110 %%# The above commands are used only if they are defined (otherwise,
111 %%# natural substitutes are used (\newcommand and \Provides package are
112 %%# then not used at all))
113
114
115 %%#
116 %%# I strongly recommend to have additionally a look at the documentation
117 %%# of the "toolbox" package, in particular the \toolboxMakeDef command
118 %%# (provided since toolbox v3.1) which supplements \varindex.
119 %%#
120
121 %%#
122 %%# The \varindex command is highly customizable.
123 %%# So the following examples can only give you a rough impression of what
124 %%# you can actually do with it. You do not need to understand them now:
125 %%# The general usage is explained later. (Maybe you want to look up the
126 %%# examples afterwards).
127 %%#
128 %%#
129 %%# 1. Typical example of usage (using the \varindextwo macros):
130 %%#
131 %%#
132 %%#
133 %%# Suppose the following customization of the \varindex command was defined:
134 %%# \def\Index{\varindex(){\varindextwoScan}{\varindextwo}[\emph]}
135 %%# Since we used the \varindextwo macros here, by default
136 %%# TWO index entries are generated with a single command:
137 %%#
138 %%# \Index{ring with $1$@one}
139 %%#
140 %%# ring
141 %%# ~ with $1$ [sorted like: "with one"]
142 %%#
143 %%# $1$ [sorted like: "one" ]
144 %%# ring with ~ [sorted like: "ring with" (without " ~") ]
145 %%#
146 %%# DIFFERENT entries may be generated by your own rules. E.g.:
147 %%#
148 %%# \Index{Hausdorff measure of noncompactness}[4,23 2!~34!1= ]
149 %%#
150 %%# generates THREE index entries:
151 %%#
152 %%# noncompactness, measure of ~ (sorted like "noncompactness, measure of")
153 %%#
154 %%# measure
155 %%# ~ of noncompactness
156 %%# Hausdorff = (here, = stands for the $\approx$ symbol)
157 %%#
158 %%# Hausdorff measure of noncompactness
159 %%#
160 %%# The last of these entries occurs only, because the last character in
161 %%# the format argument [...] was a space.
162 %%#
163 %%# If you want only slight modification(s) of the default, you need also just
164 %%# slight modifications of the command, e.g.
165 %%#
166 %%# \Index*,{ring with $1$@one} is as above, just that the second entry reads
167 %%#
168 %%# $1$, ring with ~ [sorted like "one, ring with" ]
169 %%#
170 %%# Moreover, since the `*' occured in the previous command, additionally
171 %%#
172 %%# \emph{ring with $1$}
173 %%#
174 %%# appears in the running text. Praxis shows that changes in the entries as
175 %%# above have to be made frequently in the `fine tuning' of the index of a
176 %%# book. Note that with the original \index the command would have to be
177 %%# changed completely for the above entries, because we have a "sort" entry
178 %%# for which a different rule applies if we use a subitem instead of a ",".
179 %%# (BTW: \varindex produces sort entries only if they are necessary).
180 %%#
181 %%# Of course, you may combine the default with your own format:
182 %%#
183 %%# \Index{internal integrable function}[23,1~ +] generates
184 %%#
185 %%# integrable function, internal ~
186 %%#
187 %%# internal
188 %%# ~ integrable function
189 %%#
190 %%# function
191 %%# internal integrable ~
192 %%#
193 %%#
194 %%# 2. A simple example without the \varindextwo macros:
195 %%#
196 %%# \varindex*{topology of a normed space}{5!4~!1= 45,12}[|see{norm}]
197 %%#
198 %%# produces the two index entries:
199 %%#
200 %%# space
201 %%# normed ~
202 %%# topology =
203 %%#
204 %%# normed space, topology of
205 %%#
206 %%# In both entries not the pagenumber is cited, but the text "see also norm".
207 %%# Additionally, the tokens {topology of a normed space} are
208 %%# inserted into the running text (this would not happen if
209 %%# \varindex is used in place of \varindex*).
210 %%# Only in the first of the above entries, an `@' part will be added to the
211 %%# *.idx file: This entry is sorted as if " ~" resp. " =" would not exist.
212 %%#
213 %%#
214 %%# 3. Another example without the \varindextwo macros:
215 %%#
216 %%# \varindex[\emph][|textbf]%
217 %%# {$\sigma$@sigma!$(\sigma-)$ finite {measure space}}%
218 %%# {*1.23 23 23,1- 1-23}
219 %%#
220 %%# generates the three index entries:
221 %%#
222 %%# finite measure space
223 %%#
224 %%# finite measure space, $\sigma$- (sorted as "finite measure space, sigma-")
225 %%#
226 %%# $\sigma$-finite measure space (sorted as "sigma-finite measure space")
227 %%#
228 %%# In all three entries the pages are printed using \textbf.
229 %%#
230 %%# Moreover, the tokens
231 %%# \emph{($\sigma$-)finite measure space}
232 %%# are put into the running text.
233 %%#
234 %%#
235 %%# 4. A simple example using a flag (without the \varindextwo macros):
236 %%#
237 %%# \varindex1{$L$ and $M$@L and M}{}
238 %%# ^
239 %%#
240 %%# generates the index entry "$L$ and $M$" which is sorted like "L and M".
241 %%# In the form
242 %%# \varindex1*{$L$ and $M$@L and M}{}
243 %%# or
244 %%# \varindex*1{$L$ and $M$@L and M}{}
245 %%# additionally, {$L$ and $M$} is output into the running text.
246 %%#
247 %%# Note that without the `1', the index generated were
248 %%# "$L$ and $M$ and M" which were sorted like "$L$ and L and M".
249 %%#
250 %%#
251 %%# 5. An example for very primitive customized index commands (without the
252 %%# \varindextwo macros):
253 %%#
254 %%# \def\myindexA{\varindex[\emph][|textbf]*}
255 %%# \def\myindexB{\varindex(){}{}[\emph][|textbf]}
256 %%#
257 %%# \myindexA{Foo1}{}
258 %%# \myindexB{Foo2}[][]
259 %%# \myindexB*{Foo3!{Foo 3}}
260 %%#
261 %%# Generates the index entries Foo1, Foo2, and Foo3. Moreover, \emph{Foo1}
262 %%# and \emph{Foo 3} is put into the running text. The pagenumber of Foo 2 in
263 %%# the index is printed normal, the others with \textbf.
264 %%#
265 %%#
266 %%# 6. An example of a primitive customized index command (without the
267 %%# \varindextwo macros):
268 %%#
269 %%# \def\myindex{\varindex(\ifnum\varindexCount=2 1!2 2,1\fi){}{}[\emph]}
270 %%#
271 %%# \myindex{Foo Bar}
272 %%# generates the index entries
273 %%# Foo
274 %%# Bar
275 %%#
276 %%# Bar, Foo
277 %%#
278 %%# \myindex*{Foo Bar}
279 %%# generates the same index entries as above and additionally outputs
280 %%# \emph{Foo Bar} into the running text.
281 %%#
282 %%# \myindex*{other format}[21]
283 %%# generates the index entry
284 %%# format other
285 %%# and outputs \emph{other format} into the running text.
286 %%#
287 %%# \myindex[|textbf]*{BoBo}
288 %%# generates the index entry
289 %%# BoBo
290 %%# where the pagenumber is printed with \textbf.
291 %%# Moreover, \emph{BoBo} is output into the running text.
292 %%#
293 %%#
294 %%# 7. A primitive varying customized index command (without the \varindextwo
295 %%# macros):
296 %%#
297 %%# \def\myindex{\varindex(\ifnum\varindexCount=2 1!2 2,1\fi)%
298 %%# (\ifnum\varindexCount=2*2,1 1!2 2,1\fi){}{}[\emph]}
299 %%#
300 %%# With the same commands as in 6. the same index entries are generated,
301 %%# but the tokens \emph{Far, Boo}, \emph{other format}, and \emph{Bobo}
302 %%# are output into the running text.
303 %%#
304 %%#
305 %%# 8. Examples with the \varindextwo macros:
306 %%# We use a similar definition for \Index as in 1., and define an \iemph
307 %%# macro which has `*' as a default and outputs with \emph.
308 %%# Both sort of definitions are highly recommended for you private style.
309 %%#
310 %%# \def\Index{\varindex(){\varindextwoScan}{\varindextwo}[]}
311 %%# \def\iemph{\varindex(){\varindextwoScan\def\varindexStarPos{}}%
312 %%# {\varindextwo}[\emph]}
313 %%# (note that \def\iemph{\varindex(){\varindextwoScan}{\varindextwo}[\emph]*}
314 %%# is not so good as the above definition of \iemph as is explained below).
315 %%#
316 %%# \Index*{measure of $\gamma$-noncompactness@gamma-noncompactness!FOO}
317 %%#
318 %%# generates the index entries
319 %%#
320 %%# measure
321 %%# ~ of $\gamma$-noncompactness (sorted as "of gamma-noncompactness")
322 %%#
323 %%# $\gamma$-noncompacntess
324 %%# measure of ~
325 %%#
326 %%# and outputs the tokens {measure of FOO} into the running text.
327 %%#
328 %%# \Index*,?_'{flic of flac} generates
329 %%#
330 %%# flic of flac
331 %%#
332 %%# flac, flic
333 %%#
334 %%# and outputs {flic of flac}.
335 %%#
336 %%# \Index^={$\sigma$@sigma algebra} generates
337 %%#
338 %%# $\sigma$ (sorted as "sigma")
339 %%# ~-algebra (sorted as "algebra" resp. "-algebra", see below)
340 %%#
341 %%# algebra
342 %%# $\sigma$-~ (sorted as "sigma-")
343 %%#
344 %%# Here, the sorting "-algebra" is chosen when you used
345 %%# \let\varindexOutSortDashBeg\varindexOutSortDash
346 %%# as described later.
347 %%#
348 %%# \Index-^>{$\sigma$@sigma algebra} generates
349 %%#
350 %%# $\sigma$- (sorted as "sigma-")
351 %%# ~ algebra (sorted as "algebra")
352 %%#
353 %%# \Index^.,:{ultra filter} generates
354 %%#
355 %%# ultra
356 %%# ~filter (no space following ~)
357 %%# filter, ultra~ (no space in front of ~)
358 %%#
359 %%# \iemph[|see{recursive recursion}],_{recursive recursion} generates
360 %%#
361 %%# recursive recursion, \see{recursive recursion}
362 %%#
363 %%# recursion, recursive ~, \see{recursive recursion}
364 %%#
365 %%# and outputs \emph{recursive recursion}. If we would have used instead the
366 %%# definition \def\iemph{\varindex(){\varindextwoScan}{\varindextwo}[]*},
367 %%# the above call were not possible, since the optional arguments [|see...]
368 %%# must occur in front of the flag `*'.
369 %%#
370 %%# \Index-;*{Flip Flop} generates
371 %%#
372 %%# Flip-Flop
373 %%#
374 %%# FlopFlip
375 %%#
376 %%# and outputs {Flip-Flop} (!!!!!!!)
377 %%#
378 %%# \Index>{Flippy Flop!GO}[*2-1-2 2!1-1 1-12 +]
379 %%#
380 %%# generates
381 %%#
382 %%# Flop
383 %%# Flippy-Flippy (no tilde!)
384 %%#
385 %%# Flippy-Flippy Flop
386 %%#
387 %%# Flippy
388 %%# ~ Flop
389 %%#
390 %%# and outputs {GO-Flippy-GO} (!!!)
391 %%#
392 %%# \Index*_,{shape {of a} of star} generates
393 %%#
394 %%# shape of a star
395 %%#
396 %%# star, shape of ~ (sorted like "star, shape of")
397 %%#
398 %%# and outputs {shape of a star}.
399 %%#
400 %%# \Index1*{$L$ feature@L feature}
401 %%# \Index,{No $L$@L feature}
402 %%# generate
403 %%#
404 %%# $L$ feature (sorted like "L feature")
405 %%#
406 %%# No
407 %%# ~ $L$ feature (sorted like "L feature")
408 %%#
409 %%# feature, No $L$ ~ (sorted like "feature, No L")
410 %%#
411 %%# and outputs {$L$ feature}.
412 %%#
413 %%#
414 %%# 9. Example of a simple modification of the \varindextwo macros:
415 %%#
416 %%# \def\myindextwoScan{%
417 %%# \varindextwoScan
418 %%# \varindexNewFlag ~\vxtSpaceA
419 %%# \varindexNewFlag 1\vxtSpaceB
420 %%# \varindexNewFlag !\varindexOneEntry
421 %%# \varindexMakeSplitExpand{/}{vxtSplitAtMagic}%
422 %%# \def\varindexStarPos{}%
423 %%# }
424 %%# \def\myIndex{\varindex(){\myindextwoScan}{\varindextwo}[]}
425 %%#
426 %%# \myIndex behaves similar to the previous example with
427 %%# the following differences:
428 %%# 1. The flag `1' now has the previous meaning of "~".
429 %%# 2. One may now use "~" and "_" equivalently.
430 %%# 3. The flag `!' now has the originial meaning of the flag `1'.
431 %%# 4. Instead of `+' in the format string, the character `/' has to be used.
432
433 %%#
434 %%#
435 %%# Description:
436 %%#
437 %%# There are two possible calls:
438 %%#
439 %%# a) \varindex[textstyle][pagestyleA]flags{main entries}{format}[pagestyleB]
440 %%#
441 %%# Here, [textstyle], [pagestyleA], [pagestyleB], and flags are optional.
442 %%# (If [textstyle] is omitted, also [pagestyleA] must be omitted).
443 %%#
444 %%# textstyle: describes the textstyle used for the output into the
445 %%# running text (typically, textstyle is \emph or empty).
446 %%# pagestyle: describes the pagestyle used for the output of the pagenumber
447 %%# (you may also use a construct like |see{...} here).
448 %%# If [pagestyleB] is present, this is the value used.
449 %%# Otherwise, the value of [pagestyleA] is used (resp. nothing).
450 %%# flags can be one (or both) of the following tokens:
451 %%# `*': "Output into running text":
452 %%# If no * is used in the format string (see below),
453 %%# then the format is automatically prepended by the tokens `* '
454 %%# resp. `*' (depending whether format starts with ` ' or not)
455 %%# `1': The content of {main entries} is considered as a single entry
456 %%# (see below).
457 %%# {main entries} and
458 %%# {format} are explained later.
459 %%#
460 %%# b) \varindex(formatA)(format*A){scanprogram}{mainprogram}
461 %%# [textstyle][pagestyleA]flags{main entries}[formatB][pagestyleB]
462 %%#
463 %%# Concerning [textstyle], [pagestyleA], flags, [pagestyleB], the same
464 %%# remarks as in a) hold. Also (format*A) and (formatA) are optional.
465 %%# (if (formatA) is omitted, also (format*A) must be omitted).
466 %%#
467 %%# The "default" format is formatA resp. format*A (depending whether the
468 %%# flag "*" has been used or not). If [formatB] is given, then this is
469 %%# used as the format (i.e. it overrides the default).
470 %%#
471 %%# scanprogram is executed immediately when \varindex reads it.
472 %%# This can be used to introduce FURTHER flags (other than '*' and `1'),
473 %%# see below.
474 %%# mainprogram is executed AFTER the format string(s) has been expanded.
475 %%#
476 %%#
477 %%#
478 %%# It is recommended to define personal macros which contain all parameters up
479 %%# to the place where the flags occur (either with or without some flags,
480 %%# depending on the intention). See the examples above.
481 %%#
482 %%#
483 %%#
484 %%#
485 %%# The main argument (called {main entries} above) has the form
486 %%#
487 %%# entry1[`space' entry2][`space' entry3] ...
488 %%#
489 %%# where each of entry1 entry2 entry3 ... in turn has the form
490 %%# indextext@sorttext!outputtext or
491 %%# indextext!outputtext@sorttext
492 %%# In each of these forms, @sorttext and !outputtext are optional.
493 %%# Here,
494 %%# indextext is the text which is put into the index for the entry
495 %%# sorttext is what is used as a sort criterion for the entry
496 %%# outputtext is what is output into the running text for the entry
497 %%#
498 %%# Note that the symbol @ has in a sense the opposite meaning as in the
499 %%# original \index command:
500 %%# BEFORE that symbol, the desired text appears, and
501 %%# AFTER the symbol the place where it has to be sorted.
502 %%# However, we chose the symbols @ and !, because these two
503 %%# symbols are forbidden anyway (otherwise, makeindex will become confused).
504 %%#
505 %%# As usual, multiple spaces are considered as ONE space and do not generate
506 %%# empty "ghost" entries. Moreover, a space after a TeX-command like \LaTeX
507 %%# is eliminated by TeX and thus also not considered as a separator.
508 %%# You may use braces {...} either around a whole entry or
509 %%# around indextext resp. sorttext resp. outputtext to allow spaces
510 %%# which do not act as "separators" in the corresponding part. The braces
511 %%# around these parts will vanish. In particular, you may generate an
512 %%# empty entry with {} or ! or @ (bordered by spaces).
513 %%# If you want that braces occur in the OUTPUT, you have to add an
514 %%# additional pair of braces. Be aware that you write sufficiently
515 %%# many braces, if you really should need them: For example,
516 %%# the command \varindex{{{{A B}}}}{} produces the index entry {A B}:
517 %%# The outermost pair of braces is eliminated immediately by TeX. The second
518 %%# pair is eliminated, because this is a pair around a complete entry.
519 %%# Finally, another pair is eliminated, because it is a brace around
520 %%# indextext.
521 %%# With the flag `1', {main entries} is considered as one single entry.
522 %%# Nevertheless, also with this flag, an additional pair of braces around
523 %%# main entry is eliminated.
524 %%#
525 %%#
526 %%# The format string has one of the following three forms
527 %%# indexa[`space' indexb][`space' indexc] ... [*outputa][*outputb] ...
528 %%# [*outputa][`space' indexa][`space' indexb][*outputc] ...
529 %%# *
530 %%# where the order of arguments can be arbitrarily mixed (except for the first
531 %%# indexa in the first form). indexa indexb ... outputa ... describe the
532 %%# format of the index entries resp. of the output into the running text.
533 %%# The output is generated in the given order (this might be important, if
534 %%# a pagebreak occurs during the output into the running text).
535 %%# The last case is exceptional and equivalent to `*space'.
536 %%# The following characters/strings describe the format:
537 %%#
538 %%# 1-9: entry1-9
539 %%# 0: entry 10
540 %%# ~: a placeholder sign
541 %%# =: alternative placeholder sign
542 %%# _: a space character
543 %%# s: The token \space (but _ is used for the sort entry)
544 %%# .: No space will follow
545 %%# ,: The character , (space will follow)
546 %%# -: The character - (no space will follow)
547 %%# !: Create a new sublevel
548 %%# All other tokens in this argument are forbidden.
549 %%# The token ! makes no sense for the output in the running text and thus
550 %%# is forbidden behind *.
551 %%#
552 %%# By a heuristic rule, a space is automatically inserted between two entries
553 %%# which generate non-empty text. If the heuristic rule fails, you may always
554 %%# force a space by either "_" or "s", or forbid a space by ".".
555 %%#
556 %%# If a format is empty, all entries are taken in the order of input.
557 %%# Note that TeX eliminates concatenated spaces, and so you are able to
558 %%# produce an empty format entry only at the end or in front of a `*'.
559 %%# If you want to force an empty OUTPUT (is this ever useful?), you may use
560 %%# just "." as the entry.
561 %%#
562 %%# A sort entry is only written to the *.idx file if it differs from the
563 %%# text entry.
564
565 %%#
566 %%#
567 %%# Description of the \varindextwo macros:
568 %%#
569 %%# The macros
570 %%#
571 %%# \varindextwoScan \varindextwo
572 %%#
573 %%# can be used together as parameters {scanprogram} resp. {mainprogram}
574 %%# for the \varindex command.
575 %%# If \varindex is called with these macros, and no
576 %%# explicit format argument is given, these macros generate a format
577 %%# depending on the number of entries in {main entries}:
578 %%#
579 %%# a) If there is only one entry in {main entries},
580 %%# then the format "1" resp. "*1 1" is generated
581 %%# (depending whether the * flag was used or not), i.e. the
582 %%# entry is put into the index, and printed if \varindex was
583 %%# called with the * flag.
584 %%#
585 %%# b) If there are two main entries like {graulty bazola},
586 %%# then the format becomes { 1!~2 1!2~}, i.e. the index entries
587 %%#
588 %%# graulty
589 %%# ~ bazola
590 %%#
591 %%# bazola
592 %%# graulty ~
593 %%#
594 %%# are produced.
595 %%#
596 %%# You can modify the first format entry with the following flags:
597 %%# flags format used: If used with `*' additionally:
598 %%# _ 12 *12
599 %%# - 1-2 *1-2
600 %%# ^ 1!~-2 resp. 1!-2 *1-2
601 %%# -^ 1-!~.2 resp. 1-!~2 *1-2
602 %%# . 1.2 *1.2
603 %%# .^ 1!~.2 *1.2
604 %%# / 1!2 (without ~) *12
605 %%# < no entry *12
606 %%#
607 %%# Here, the combinations -^ and .^ mean that both flags are used
608 %%# (the order plays no role).
609 %%# The output for ^ respectively -^ is determined by the switches
610 %%# \varindextwoDashTildetrue (default)
611 %%# \varindextwoDashTildefalse
612 %%# \varindextwoDashSpacetrue
613 %%# \varindextwoDashSpacefalse (default)
614 %%#
615 %%# You can modify the second format entry with the following flags:
616 %%# flags format used:
617 %%# , 2,1~ resp. 2,1
618 %%# ~ 21
619 %%# = 2!1-~
620 %%# ,= 2,1-~ resp. 2,1-
621 %%# + 2-1
622 %%# : 2!1.~
623 %%# ,: 2,1.~ resp. 2,1
624 %%# ; 2.1
625 %%# > no entry
626 %%# ! Append ~ (if not already there)
627 %%# ? Without ~
628 %%#
629 %%# Whether the first or the second alternatives in the above forms is used
630 %%# depends on the status of the switch
631 %%# \varindextwoCommaTildetrue (default)
632 %%# \varindextwoCommaTildefalse
633 %%# We point out that "\varindextwoCommaTildefalse" was in earlier versions
634 %%# of "varindex" the default (and could not be changed).
635 %%# Note that this switch has no effect if the ! or ? flags are used.
636 %%#
637 %%# HINT for remembering the symbols: The symbols _ . - for the first entry
638 %%# are the same flags as for the output and the same flags which are used
639 %%# in the format string. The corresponding symbols ~ : (and ;) = (and +)
640 %%# for the second entry "look similar". The "," is only useful in the
641 %%# second entry (and is the same symbol as in the format string).
642 %%# The two exceptional symbols ">" and "<" can be read as "generate only
643 %%# the forward-directed resp. backward-directed entry".
644 %%#
645 %%# c) If there are three main entries like {graulty of bazola}, then the
646 %%# format becomes { 1!~23 3!12~}, i.e. the output becomes
647 %%#
648 %%# graulty
649 %%# ~ of bazola
650 %%#
651 %%# bazola
652 %%# graulty of ~
653 %%#
654 %%# The flags have an analogous effect to b).
655 %%# In addition, if the flags ` resp. ' are used, the second word
656 %%# (in our example: `of') is omitted from the output in the first resp.
657 %%# in the second index entry. If the * flag and ` are used together, the
658 %%# second entry is also omitted from the output into the running text.
659 %%#
660 %%# d) If there are four main entries like {graulty of OF bazola}, then the
661 %%# format becomes { 1!~24 4!31~}, i.e. the output becomes
662 %%#
663 %%# graulty
664 %%# ~ of bazola
665 %%#
666 %%# bazola
667 %%# graulty OF ~
668 %%#
669 %%# i.e. we have a similar effect as in c) except that for the first entry
670 %%# the third word is skipped, and for the second entry the second word is
671 %%# skipped. All flags as in c) can be used with an analogous meaning.
672 %%# Also if the * flag is used, the output into the running text is
673 %%# analogous to c) (the third word is skipped).
674 %%#
675 %%# e) If there are more than four main entries, then
676 %%# (formatA) resp. (format*A) is used.
677 %%#
678 %%# If an explicit format argument is provided, then this is used except
679 %%# when it contains the symbol +. In this case, this symbol is replaced by the
680 %%# output which would be generated "normally". If additionally the `*'-flag
681 %%# is used, there is a special rule:
682 %%# If the explicit format contains a `*', then no additional `*'-output is
683 %%# produced. Otherwise, the `*'-output from a)-e) is prepended to the given
684 %%# format string (with a space at the end, unless the format string is empty).
685 %%# This means that `normally' you have the output from a)-e),
686 %%# unless you write an own `*'-part in the argument.
687 %%#
688 %%# If you do not like the tokens chosen for the default symbols, you can
689 %%# easily choose your own tokens by just replacing \varindextwoScan with your
690 %%# own macro (or defining your own ``magic'' tokens after \varindextwoScan,
691 %%# see Example 9. above).
692
693 %%#
694 %%#
695 %%# Primitive customization:
696 %%#
697 %%#
698 %%# You may use the command
699 %%# \varindexUsePlaceholderAfalse
700 %%# \varindexUsePlaceholderBfalse
701 %%# to ignore the sign ~ resp. = in the format entry.
702 %%# You can easily restore the default by
703 %%# \varindexUsePlaceholderAtrue
704 %%# \varindexUsePlaceholderBtrue
705 %%#
706 %%# If you want to switch off the placeholder only at the beginning of
707 %%# a new entry (resp. of a new subentry), you can use the commands
708 %%# \varindexLeadingPlaceholderAfalse
709 %%# \varindexLeadingPlaceholderBfalse
710 %%# The default is restored with
711 %%# \varindexLeadingPlaceholderAtrue
712 %%# \varindexLeadingPlaceholderBtrue
713 %%#
714 %%# By default, the "," in the format string is in this connection
715 %%# treated as a symbol generating a new "subentry". You can change this
716 %%# default with the command
717 %%# \varindexCommaLeadsfalse
718 %%# You may switch back with
719 %%# \varindexCommaLeadstrue
720 %%#
721 %%#
722 %%# The content of the macro
723 %%# \varindexPlaceholderAText
724 %%# \varindexPlaceholderASort
725 %%# \varindexPlaceholderBText
726 %%# \varindexPlaceholderBSort
727 %%# is used as the placeholder ~ resp. = in the index resp. sort entry.
728 %%# Note that if one of these entries expands empty, different rules for
729 %%# the automatic insertion of spaces apply (for the index and sort entry
730 %%# separately).
731 %%#
732 %%# You may prefer that the placeholder text resp. sort content changes at
733 %%# run time to the context of the previous ! entry. For example, you may
734 %%# want that the command \varindex{Gibble Gobble}{2!~2} produces the index
735 %%# entry
736 %%# Gibble
737 %%# Gibble Gobble
738 %%# (or is at least SORTED as such an entry).
739 %%#
740 %%# You can achieve this with the commands
741 %%# \varindexPreviousATexttrue
742 %%# \varindexPreviousASorttrue
743 %%# \varindexPreviousBTexttrue
744 %%# \varindexPreviousBSorttrue
745 %%# for the text and sort entry and the placeholders ~ and =, respectively.
746 %%# With these commands, the content of \varindexPlaceholderAText etc
747 %%# is only used as the default if no previous ! entry was given.
748 %%# You can switch back to the default mode with the respective commands
749 %%# \varindexPreviousATextfalse
750 %%# \varindexPreviousASortfalse
751 %%# \varindexPreviousBTextfalse
752 %%# \varindexPreviousBSortfalse
753 %%#
754 %%# By default, the ',' in the format entry is considered in this connection
755 %%# similar to '!'. If you want to change this, use the command
756 %%# \varindexCommaExpandfalse
757 %%# You may switch back with
758 %%# \varindexCommaExpandtrue
759 %%#
760 %%# Since version 2.2, the dash "-" occurring at the beginning of entry
761 %%# (or after "!" or even after "," if \varindexCommaExpandtrue is in effect)
762 %%# is ignored for sorting. You can switch off this feature with the command
763 %%#
764 %%# \let\varindexOutSortDashBeg\varindexOutSortDash
765 %%#
766 %%# To restore the new default, use
767 %%#
768 %%# \let\varindexOutSortDashBeg\toolboxEmpty
769 %%#
770 %%#
771 %%# The commands
772 %%#
773 %%# \varindexSetWordString{|} % Use | as separator for entries instead
774 %%# % of spaces.
775 %%# \varindexSetSortString{>} % default: @
776 %%# \varindexSetPlainString{<} % default: !
777 %%#
778 %%# set the default "magic" strings used for the main argument.
779 %%# The argument of the above macros is intentionally NOT expanded (so that
780 %%# you do not have troubles with active characters like ~).
781 %%# To force expansion, use e.g.
782 %%# \expandafter\varindexSetWordString\expandafter{\MacroToExpand}
783 %%# or some similar construct.
784 %%#
785 %%# If you use a different separator than `space' for the entries, you may want
786 %%# to change the rule how braces are eliminated. With the commands
787 %%# \varindexEliminateOuterBracetrue
788 %%# \varindexEliminateInnerBracetrue
789 %%# \varindexEliminateOuterBracefalse
790 %%# \varindexEliminateInnerBracefalse
791 %%# you may allow resp. forbid the elimination of braces around the entries
792 %%# resp. around {indextext} {sorttext} and {outputtext}
793 %%# With the flag `1', {main entries} is considered as one single entry,
794 %%# but if \varindexEliminateOuterBracetrue is set (which is the default)
795 %%# also in this case an additional pair of braces around main entry is
796 %%# eliminated.
797 %%#
798 %%# Similarly as above,
799 %%#
800 %%# \varindexSetIndexString{|} % default: space
801 %%# \varindexSetOutputString{<} % default: *
802 %%# \varindexSetTildeAString{~} % (is default)
803 %%# \varindexSetTildeBString{=} % (is default)
804 %%# \varindexSetSpaceString{_} % (is default)
805 %%# \varindexSetSpaceTokString{s} % (is default)
806 %%# \varindexSetOmitString{.} % (is default)
807 %%# \varindexSetCommaString{,} % (is default)
808 %%# \varindexSetDashString{-} % (is default)
809 %%# \varindexSetExclamString{!} % (is default)
810 %%# \varindexSetStringForNr 1{a} % default: 1
811 %%# \varindexSetStringForNr{11}{b}% No default!
812 %%#
813 %%# sets the default "magic" strings used for the format argument.
814 %%# In contrast to before, the arguments are fully expanded (with
815 %%# \varindexedef, see below).
816 %%# Note that the last command provides a way to access more than 10 entries!
817 %%#
818 %%# If you use \varindexSetIndexString{|} (with some non-space token),
819 %%# you may still use spaces in the format which then are just ignored.
820 %%#
821 %%#
822 %%# Avoid that one string is a prefix of another string: In this case,
823 %%# strange effects may happen, and this behavior may even change in
824 %%# future releases of this package.
825 %%# Note that the above effect may arise unintentionally if you use active
826 %%# chars. For this reason, `~' is defined to expand to the letter `~',
827 %%# before the expansion is executed. Maybe in later releases of this package
828 %%# there will be further such redefinitions.
829 %%# You can explicitly use this feature in your own macros by using
830 %%# \varindexedef instead of the usual \edef, see below.
831 %%#
832 %%#
833 %%# You can change the output for the text resp sort entry of the various
834 %%# symbols used in the format string. More precisely, you can redefine
835 %%#
836 %%# \varindexOutExclam % Text output for !
837 %%# \varindexFollowsExclam % Decide whether magic space after ! is inserted
838 %%# \varindexOutTextComma % Text output for ,
839 %%# \varindexOutSortComma % Sort output for ,
840 %%# \varindexFollowsComma % Decide whether magic space after , is inserted
841 %%# \varindexPreceedsComma % Decide whether magic space before , is erased
842 %%# \varindexOutTextSpace % Text output for _
843 %%# \varindexOutSortSpace % Sort output for _
844 %%# \varindexFollowsSpace % Decide whether magic space after _ is inserted
845 %%# \varindexPreceedsSpace % Decide whether magic space before _ is erase
846 %%# \varindexOutTextSpTok % Text output for s
847 %%# \varindexOutSortSpTok % Sort output for s
848 %%# \varindexFollowsSpTok % Decide whether magic space after s is inserted
849 %%# \varindexPreceedsSpTok % Decide whether magic space before s is erased
850 %%# \varindexOutTextDash % Text output for -
851 %%# \varindexOutSortDash % Sort output for -
852 %%# \varindexOutSortDashBeg% Sort output for - if nothing preceeds
853 %%# \varindexFollowsDash % Decide whether magic space after - is inserted
854 %%# \varindexPreceedsDash % Decide whether magic space before - is erased
855 %%# \varindexOutTextOmit % Text output for .
856 %%# \varindexOutSortOmit % Sort output for .
857 %%# \varindexFollowsOmit % Decide whether magic space after . is inserted
858 %%# \varindexPreceedsOmit % Decide whether magic space before . is erased
859 %%#
860 %%# The meaning is as follows: \varindexOut... should just expand to the
861 %%# tokens which should be written into the text resp. sort output.
862 %%# The corresponding macro \varindexFollows... is typically defined with
863 %%# one of the following commands:
864 %%# \let\varindexFollows...\varindexNextSpace
865 %%# \let\varindexFollows...\varindexNoNextSpace
866 %%# In the first case, a space is `magically' inserted in front of a
867 %%# subsequent token (unless this token erases the magic space).
868 %%# In the second case, no space follows, of course.
869 %%# There is an alternative call:
870 %%# \def\varindexFollows...{\varindexSpaceTexttrue\varindexSpaceSortfalse}
871 %%# This definition achieves that for the text output a space should follow,
872 %%# but not for the sort output. Of course, you can also use similarly the
873 %%# commands \varindexSpaceTextfalse and/or \varindexSpaceSorttrue
874 %%# in the above definition (the effect should be obvious).
875 %%# In particular, \varindexNextSpace is equivalent to
876 %%# \varindexSpaceTexttrue\varindexSorttrue.
877 %%#
878 %%# The macro \varindexPreceeds... is similarly as \varindexFollows... with
879 %%# the difference that it is executed BEFORE the token in question is
880 %%# output. In particular, you can ignore a previous `magic space'.
881 %%# All of the `magic space' commands are defined by default with
882 %%# \let\varindexFollows...\toolboxEmpty
883 %%# \let\varindexPreceeds...\varindexNoNextSpace
884 %%# with the following two exceptions:
885 %%# \let\varindexFollowsExclam\varindexNoNextSpace
886 %%# \let\varindexFollowsComma\varindexNextSpace
887 %%#
888 %%# Documented Features (in later versions, these will still be available,
889 %%# and if they contain a bug now, they will be repaired to work this way):
890 %%#
891 %%# (In a future release, varindex will cook your coffee, too)
892 %%#
893 %%#
894 %%#
895 %%# The main argument is NOT expanded, so you can actually write macros
896 %%# into the *.idx file. The command actually used to write the index is
897 %%#
898 %%# \varindexIndex
899 %%#
900 %%# (which by default is of course defined as \index).
901 %%# Since some implementations of the \index command still (partially) expand
902 %%# their argument (which might be considered as a bug), the argument of
903 %%# \varindexIndex is translated before the actual call with the aid of
904 %%# \toolboxMakeHarmless.
905 %%# If you want to redefine \varindexIndex to a personal \index-output
906 %%# function, you might want to skip the \toolboxMakeHarmless step.
907 %%# This is arranged with the command
908 %%#
909 %%# \varindexNoConvert
910 %%#
911 %%# You can cancel the effect of this command with
912 %%#
913 %%# \varindexDoConvert
914 %%#
915 %%# Even if \varindexNoConvert is not in effect, the main argument is not
916 %%# expanded (and in particular, the argument of \varindexIndex consists of
917 %%# the corresponding entries in an unexpanded form).
918 %%#
919 %%# The whole \varindex... procedure takes place in a group, so all your
920 %%# variables are local to a single call (unless you use \gdef...
921 %%# (and friends) of course).
922 %%#
923 %%# There are no \global directives in any macro related with this package.
924 %%# In particular, if you call the above macros in a group (or redefine
925 %%# \varindexIndex), the effect holds only until the end of the group.
926 %%#
927 %%# In contrast to the main argument, the format argument is expanded
928 %%# (with \varindexedef, see below)
929 %%# (and also formatA resp. format*A is expanded before),
930 %%# so you can define abbreviations (even simple conditional abbreviations)
931 %%# for the format. Note, however, that the expansion is essentially only
932 %%# evaluated with \edef. So, you will probably not want to use e.g. \relax,
933 %%# since this command expands to itself (and not into nothing - use
934 %%# \toolboxEmpty if you want the latter).
935 %%# If you want more complex abbreviations, use {mainprogram} instead.
936 %%#
937 %%# In order to help you write conditional abbreviations, the
938 %%# following variables are defined when your macro is expanded (and in
939 %%# particular also in {mainprogram}). You may of course redefine them
940 %%# appropriately:
941 %%#
942 %%# \varindexAppend The argument pagestyleA resp. pagestyleB.
943 %%# \varindexCount a TeX counter containing the number of entries in
944 %%# the main argument.
945 %%# \varindexLastEntry This is a macro (NOT a counter) which is usually
946 %%# the value of \the\varindexCount. See below.
947 %%# \varindexEntry1-... The (index) text occuring in entry 1-...
948 %%# \varindexSort1-... The corresponding sort entry. If no sort entry was
949 %%# given, this is the same as the corresponding
950 %%# \varindexEntry1-...
951 %%# \varindexPlain1-... The text which should be output in the text. If no
952 %%# such entry was given, this is the same as the
953 %%# corresponding \varindexEntry1-...
954 %%#
955 %%# \varindexCount may be larger than 10, and correspondingly there may be
956 %%# also more than 10 different \varindexEntry/Sort/Plain macros.
957 %%# If you ADD entries, you have to increase \varindexCount correspondingly,
958 %%# otherwise an error is produced if the format string contains an entry
959 %%# larger then \varindexCount. However, your additional entries are NOT
960 %%# output for EMPTY formats: For empty formats the number used is
961 %%# \varindexLastEntry. So if you want to output also your additional entries
962 %%# in empty formats, you have to set \varindexLastEntry to your modified
963 %%# value of \varindexCount in mainprogram. You may e.g. achieve this with
964 %%# the following lines:
965 %%# \expandafter
966 %%# \def\expandafter\varindexLastEntry\expandafter{\the\varindexCount}%
967 %%# It is admissible that \varindexLastEntry is larger than \varindexCount:
968 %%# In this case all entries until \varindexLastEntry are
969 %%# output in empty formats without producing an error (provided, of course,
970 %%# that the corresponding variables \varindexEntry.../Sort.../Plain... are
971 %%# defined).
972 %%#
973 %%# Note that numbers in TeX command names require special handling,
974 %%# i.e., you have to use something like
975 %%#
976 %%# \csname varindexPlain2\endcsname
977 %%#
978 %%# to access variables. To avoid this, you may want to use the macros
979 %%# \toolboxLet and \toolboxWithNr of the toolbox package. Examples are
980 %%# \toolboxWithNr 1\let{varindexEntry}\toolboxEmpty
981 %%# \toolboxWithNr {10}\def{varindexSort}{Foo}
982 %%# \toolboxLet \mymacro{varindexPlain\the\mycount}
983 %%# These commands set \varindexEntry1 to \toolboxEmpty, \varindexSort10 to
984 %%# Foo, and \mymacro to the content of \varindexPlain5 (if \mycount=5).
985 %%#
986 %%# All these variables are also available when {mainprogram} is expanded.
987 %%# In {mainprogram} also the following functions are useful:
988 %%#
989 %%# \varindexFormat
990 %%# This macro expands to the actual format string which is used.
991 %%# The main purpose of {mainprogram} will usually be to (re)define
992 %%# this macro. After {mainprogram} has been called, this macro is
993 %%# modified in several ways:
994 %%# 1. \varindexFormat is expanded (with \varindexedef, see below).
995 %%# (thus, \varindexFormat is expanded BEFORE AND AFTER the call
996 %%# of {mainprogram}).
997 %%# 2. \ifvarindexStar is true (see below) a `*' resp. `* ' is prepended.
998 %%# 3. If it is only "*", it is replaced by "* ".
999 %%# Note that before execution of {mainprogram}, no tests on the
1000 %%# validity of the format are done: You may use your own symbols to
1001 %%# `communicate' with {mainprogram} (if {mainprogram} eliminates these
1002 %%# symbols afterwards).
1003 %%#
1004 %%# \varindexFormatDefault
1005 %%# This macro expands to formatA resp format*A (in the expanded form)
1006 %%# depending whether the * flag has been used in the call.
1007 %%# Note that this expansion was executed BEFORE the optional format
1008 %%# argument is expanded for the first time.
1009 %%#
1010 %%# \ifvarindexStar ifpart [ \else elsepart] \fi
1011 %%# If the optional * was given, the ifpart is executed, otherwise the
1012 %%# else-part. This is a TeX-if-command. In particular, by
1013 %%# \varindexStarfalse resp. \varindexStartrue
1014 %%# you may change the behavior for future if's. This can be used
1015 %%# to prevent/force that a `*' resp. `* ' is prepended to the format
1016 %%# after the execution of {mainprogram}.
1017 %%# Setting of this variable has no effect in {scanprogram}
1018 %%#
1019 %%# \ifvarindexExplicitFormat
1020 %%# This is a TeX-if-command (see above) which is true if the optional
1021 %%# format argument [formatB] was given.
1022 %%#
1023 %%#
1024 %%# To "compose" the format, you may want to use the macros
1025 %%#
1026 %%# \toolboxDef\macrotodefine{argumentlist}
1027 %%# \toolboxAppend\macrotoappend{argumentlist}
1028 %%# \varindexedef\macrotodefine{argumentlist}
1029 %%#
1030 %%# All commands work similar to \def resp. \edef with two differences:
1031 %%#
1032 %%# For \toolboxDef\macro the argumentlist is expanded precisely by one level
1033 %%# (for details, see the documentation of the toolbox package).
1034 %%# Of course, for \toolboxAppend, the new definition is appended to the old
1035 %%# definition of \macro.
1036 %%#
1037 %%# \varindexedef fully expands argumentlist. However, some active symbols
1038 %%# (currently only ~, but additional symbols might follow in a future release)
1039 %%# are deactivated before expansion, so that ~ actually expands to ~ and not
1040 %%# to a strange command sequence.
1041 %%#
1042 %%#
1043 %%# To "decompose" the format, you may want to use one of the macros
1044 %%#
1045 %%# \toolboxSplitAt{arg}{critical}{\before}{\after}
1046 %%# \toolboxMakeSplit{critical}{command} resp.
1047 %%# \varindexMakeSplitExpand{\MacrosWhichExpandToCritical}{command}
1048 %%# \varindexMakeVarSplit\variable{\MacrosWhichExpandToCritical}{command}
1049 %%#
1050 %%# The first two macros are described in the toolbox package.
1051 %%# The remaining two macros are similar to \varindexMakeSplit with the
1052 %%# difference that the argument {critical} is obtained by expanding
1053 %%# \MacrosWhichExpandToCritical with the aid of \varindexedef.
1054 %%# In the last form, additionally \variable is (re)defined to expand to
1055 %%# the value of critical.
1056 %%#
1057 %%# The following instances of a command created by \toolboxMakeSplit
1058 %%# exist (the content of "critical" should be obvious):
1059 %%#
1060 %%# \varindexSplitAtIndex (generated by \varindexSetIndexString)
1061 %%# \varindexSplitAtOutput
1062 %%# \varindexSplitAtTildeA
1063 %%# \varindexSplitAtTildeB
1064 %%# \varindexSplitAtSpace <- Here the default content of "critical" is "_"
1065 %%# \varindexSplitAtSpaceTok<- Here the default content of "critical" is "s"
1066 %%# \varindexSplitAtOmit
1067 %%# \varindexSplitAtComma
1068 %%# \varindexSplitAtDash
1069 %%# \varindexSplitAtExclam
1070 %%# \varindexSplitAtNr?? (here, ?? is the number as a string; use
1071 %%# \csname ....\endcsname to call this macro. Only those numbers are
1072 %%# admissible which have been introduced with \varindexSetStringForNr
1073 %%# (this is the case for 1-10)).
1074 %%#
1075 %%# There is also the instance
1076 %%# \varindexSplitSpace (to be distinguished from \varindexSplitAtSpace)
1077 %%# where "critical" is the space symbol.
1078 %%#
1079 %%#
1080 %%# In addition, you may use the variables
1081 %%# \varindexIndexString
1082 %%# \varindexOutputString
1083 %%# \varindexTildeAString
1084 %%# ....
1085 %%# \varindexNr??String
1086 %%# which expand to the corresponding strings.
1087 %%#
1088 %%# All the previous macros should not be redefined `by hand'.
1089 %%# They are implicitly redefined by the \varindexSet... commands.
1090 %%#
1091 %%#
1092 %%#
1093 %%#
1094 %%# To drop possible braces, use the command
1095 %%#
1096 %%# \toolboxDropBrace\variable
1097 %%#
1098 %%# of the toolbox package.
1099 %%#
1100 %%#
1101 %%# In {scanprogram} you may already want to call \toolboxMakeSplit:
1102 %%# In this way many choices for the tokens are put into {scanprogram},
1103 %%# and in this sense, you can consider {mainprogram} as `customizable'.
1104 %%# Anyway, the main task of {scanprogram} is to introduce new flags with
1105 %%#
1106 %%# \varindexNewFlag\token\position[program\varindexEndOfFlag]
1107 %%# or
1108 %%# \varindexNewFlag\token\position[\programmacro]
1109 %%#
1110 %%# Here, \position is an (undefined) macro, and \token an arbitrary token.
1111 %%# The [program(macro)] part is optional and is explained later.
1112 %%# If token is entered in the current call of \varindex instead (or in
1113 %%# addition to) the star, then \position is defined to expand to a
1114 %%# (literally) number, namely the (last) position where token was given
1115 %%# inside the "*-argument-list" (counting from 0). For example, if
1116 %%# \varindexNewFlag ,\commapos
1117 %%# \varindexNewFlag -\minuspos
1118 %%# \varindexNewFlag .\pointpos
1119 %%# are used in \programA, then in the call
1120 %%# \varindex(){\programA}{\programB},-**-{}
1121 %%# the variable \commapos will expand in \programB to `0', while
1122 %%# \minuspos will expand to `4' (the last position is taken). Finally,
1123 %%# \pointpos is \undefined (unless you defined \pointpos differently AFTER
1124 %%# the call of \varindexNewFlag; in this case, this is the default).
1125 %%# If \varindexNewFlag is called multiple times with the same token,
1126 %%# only the LAST call with this token takes effect.
1127 %%#
1128 %%# The flags `*' and `1' are introduced in this way with
1129 %%#
1130 %%# \varindexNewFlag *\varindexStarPos
1131 %%# \varindexNewFlag 1\varindexOneEntry
1132 %%#
1133 %%# BEFORE {scanprogram} is executed. This means:
1134 %%# 1. Usually, \varindexStarPos contains the (last) position of `*'
1135 %%# (resp. is undefined). Moreover, if you define \varindexStarPos in
1136 %%# {scanprogram} or in some flag, you get the same effect as if `*'
1137 %%# had been used.
1138 %%# An analogous remark holds for \varindexOneEntry.
1139 %%# 2. If you introduce `*' with \varindexNewFlag, the `*' looses its
1140 %%# original meaning. The same holds for `1'.
1141 %%#
1142 %%# If you have added a [program(macro)] part, this part is expanded
1143 %%# whenever the flag introduced by \token is used in the call of \varindex
1144 %%# (note that it is not excluded that this happens several times within one
1145 %%# call). More precisely, program is expanded AFTER the variable \position has
1146 %%# been set to the corresponding value, so you may already use \position in
1147 %%# the program part.
1148 %%#
1149 %%# IMPORTANT: The last token expanded in program MUST be \varindexEndOfFlag.
1150 %%# This is not nice but has to do with the way TeX parses its arguments.
1151 %%# Also if you use the form \programmacro, the VERY LAST token expanded
1152 %%# must be \varindexEndOfFlag. Even a construction like
1153 %%# \def\myprogrammacro{\ifx....
1154 %%# \CallSomeMacroWithvarindexEndOfFlagAtTheEnd
1155 %%# \fi
1156 %%# \varindexEndOfFlag}
1157 %%# is forbidden: In \CallSomeMacroWithvarindexEndOfFlagAtTheEnd an error
1158 %%# would occur at the end, since still the tokens \fi\varindexEndOfFlag
1159 %%# are in the tokenlist when EndOfFlag is reached there.
1160 %%# As a workaround, you may e.g. use
1161 %%# \def\myprogrammacro{\ifx...
1162 %%# \def\execute{....\varindexEndOfFlag}%
1163 %%# \else
1164 %%# \def\execute{\varindexEndOfFlag}%
1165 %%# \execute}
1166 %%#
1167 %%# If you use the form [\programmacro], your macro may even read additional
1168 %%# parameters. These parameters are expected in the call of \varindex BEHIND
1169 %%# the flag you have introduced. So you may actually use flags with
1170 %%# parameters. For example, if \scanprogram contains a macro like
1171 %%# \varindexNewFlag -\minuspos[\readpara]
1172 %%# and you have defined
1173 %%# \def\readpara#1{\def\merk{#1}\varindexEndOfFlag}
1174 %%# then the call \varindex(){\scanprogram}{\mainprg}*-{Foo}-{Foo 2}*{Entries}
1175 %%# is admissible, and in mainprogram, \merk will have the value Foo 2.
1176 %%#
1177 %%# If you are more familiar with TeX, you can even allow OPTIONAL arguments
1178 %%# following your flag: The value of the next (non-space) token is at the
1179 %%# call of \programmacro already saved into the variable
1180 %%# \varindexNextToken,
1181 %%# so you can just use it to test for e.g. [. In this connection, you may
1182 %%# also want to use the commands
1183 %%# \varindexTestAndExec
1184 %%# \varindexSkipAndExec
1185 %%# Please, see the program text how these commands are applied.
1186
1187 %%# Since version 2.1 you can also hack in personal extensions of the format
1188 %%# string. To do this, use the command
1189 %%#
1190 %%# \varindexNewFormat\splitcommand{action}
1191 %%#
1192 %%# Here, \splitcommand is a command generated by \toolboxMakeSplit or
1193 %%# friends (preferably by \varindexMakeSplitExpand, because the command should
1194 %%# act on the format string which is expand with \varindexedef).
1195 %%# The string where it splits is the new string you can use
1196 %%# in the format argument after this call. For each
1197 %%# occurrence of the corresponding string in the format argument,
1198 %%# action will be executed. If \splitcommand splits at a string which already
1199 %%# had a previous meaning in the format string (or which is a prefix to
1200 %%# such a string), the old meaning of these tokens in the format string is
1201 %%# overridden.
1202 %%#
1203 %%# Typically, action will contain the following commands:
1204 %%# One action will probably be to output a desired token (sequence) via
1205 %%#
1206 %%# \varindexTokensOut{TextToken}{SortToken}
1207 %%# or
1208 %%# \varindexTokensOutExpand\MacroForTextToken\MacroForSortToken
1209 %%#
1210 %%# In the first form, TextToken resp. SortToken is the token sequence put
1211 %%# into the index or running text respectively into the sort entry of the
1212 %%# index for the corresponding format entry. The second form is similar with
1213 %%# the only difference that the arguments must be single macros which expand
1214 %%# to TextToken and SortToken, respectively.
1215 %%#
1216 %%# The variable \ifvarindexIndexMode can be used to test whether the
1217 %%# output goes into the running text or into the index (i.e. whether a `*'
1218 %%# preceeded the current entry). For output into the text, SortToken is
1219 %%# ignored, of course).
1220 %%#
1221 %%# Another action in \varindexNewFormat will probably be to take care of the
1222 %%# magic space flags. This is achieved by a call to \varindexNextSpace or
1223 %%# \varindexNoNextSpace (or separately via \varindexSpaceTexttrue/false resp.
1224 %%# \varindexSpaceTexttrue/false); see the earlier description.
1225 %%# The magic space flags are taken into account in "\varindexTokensOut".
1226 %%# Thus, if you want to ignore the previous flag for some reason you should
1227 %%# set them correspondingly before this call.
1228 %%# However, after the call you should also set them correspondingly for
1229 %%# further processing.
1230 %%#
1231 %%# Example:
1232 %%# \varindexMakeSplitExpand{:}{splitAtColon}
1233 %%# \varindexNewFormat\splitAtColon{%
1234 %%# \varindexNoNextSpace
1235 %%# \ifvarindexIndexMode
1236 %%# \varindexTokensOut{:}{}\varindexSpaceTexttrue
1237 %%# \else
1238 %%# \varindexTokensOut{---}{}\varindexNoNextSpace
1239 %%# \fi}
1240 %%#
1241 %%# defines a new format entry `:' which has the meaning that a colon
1242 %%# (automagically followed by a space) is put into the index but not into
1243 %%# the sort entry. Moreover, in the running text, the colon appears as a
1244 %%# long dash with no space followed. In any case, there is no magic space
1245 %%# output in front of the colon.
1246 %%#
1247
1248 %%# As an alternative action in \varindexNewFormat, you can also call the
1249 %%# default commands for the format entries. The corresponding macros are
1250 %%#
1251 %%# \varindexAddSpace _
1252 %%# \varindexAddSpTok s
1253 %%# \varindexAddOmit .
1254 %%# \varindexAddDash -
1255 %%# \varindexAddComma ,
1256 %%# \varindexAddExclam !
1257 %%# \varindexAddTildeA ~
1258 %%# \varindexAddTildeB =
1259 %%# \varindexAddNumber{number} 0-9 (the argument is 1-...)
1260 %%#
1261 %%# The precise meaning of these macros is intentionally NOT documented,
1262 %%# because some details or side effects might change in a future release of
1263 %%# "varindex". But just for this reason, it might be advantageous to use the
1264 %%# above macros instead of writing personal substitutes which may fail to
1265 %%# have such side effects.
1266 %%#
1267 %%# Example:
1268 %%# \varindexMakeSplitExpand{~-}{splitPhrase}% It is important to expand
1269 %%# % (to have correct ~ catcode)
1270 %%# \varindexNewFormat\splitPhrase{%
1271 %%# \varindexAddTildeA
1272 %%# \let\remember\varindexPreceedsDash
1273 %%# \let\varindexPreceedsDash\toolboxEmpty
1274 %%# \varindexAddDash
1275 %%# \let\varindexPreceedsDash\remember}
1276 %%#
1277 %%# After the above command, "~" and "-" have their usual meaning in
1278 %%# the format string except when they follow immediately in the form "~-".
1279 %%# In this case, the behavior of "-" changes as if \varindexPreceedsDash
1280 %%# were empty (which has the effect that the output looks like "~ -" instead
1281 %%# of "~-".
1282 %%# Note that although "~" is a prefix to "~-", the converse is not true:
1283 %%# Thus, the above command does not change the previous meaning of "~"
1284 %%# (and of course also not of "-").
1285
1286 %%#
1287 %%# Some hack:
1288 %%# Tex ignores leading spaces in the argument list of a `normal' macro.
1289 %%# This has the effect that you should be able to insert spaces BETWEEN any
1290 %%# of your arguments without any trouble.
1291 %%# If this does not work the expected way, you can use the command
1292 %%#
1293 %%# \let\varindexArgumentSpace\varindexSkipTricky
1294 %%#
1295 %%# which implements an own macro which does this task. Sadly, this can only
1296 %%# be done with some catcode trickery which in turn might bring you in trouble
1297 %%# with some (VERY) exotic packages. You can restore the default with
1298 %%#
1299 %%# \let\varindexArgumentSpace\varindexSkipDefault
1300 %%#
1301 %%#
1302 %%# All above custamization commands/variables may be used anytime between
1303 %%# two \varindex calls. They take effect with the next \varindex call.
1304
1305
1306
1307 %%# The macros \varindextwoScan and \varindextwo are considered as a
1308 %%# (very useful) EXAMPLE for the customization of the \varindex command.
1309 %%# If you need further customization, have a look at their definition first.
1310
1311 % This is the end of the ascii documentation
1312 %</asciidocu>
1313 %\fi\catcode\#6\relax
1314 %
1315 % \iffalse
1316 %<*metainfo>
1317 % \fi
1318
1319 % \def\basename{varindex}
1320
1321 %% \CharacterTable
1322 %% {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
1323 %% 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
1324 %% Digits \0\1\2\3\4\5\6\7\8\9
1325 %% Exclamation \! Double quote \" Hash (number) \#
1326 %% Dollar \$ Percent \% Ampersand \&
1327 %% Acute accent \' Left paren \( Right paren \)
1328 %% Asterisk \* Plus \+ Comma \,
1329 %% Minus \- Point \. Solidus \/
1330 %% Colon \: Semicolon \; Less than \<
1331 %% Equals \= Greater than \> Question mark \?
1332 %% Commercial at \@ Left bracket \[ Backslash \\
1333 %% Right bracket \] Circumflex \^ Underscore \_
1334 %% Grave accent \` Left brace \{ Vertical bar \|
1335 %% Right brace \} Tilde \~}
1336
1337 % \CheckSum{2042}
1338
1339 % \iffalse
1340 % \RecordChanges
1341 % \fi
1342 % \def\mypar{}
1343 % \def\ChangesTab{}\let\orichanges\changes
1344 % \def\changes#1#2#3{\orichanges{#1}{#2}{#3}%
1345 % \expandafter\def\expandafter\ChangesTab\expandafter{\ChangesTab
1346 % \item[v#1 {\mdseries(\emph{#2})}] {#3.}}}
1347 % \newcommand{\cmdcite}[1]{\texttt{\textbackslash#1}}
1348
1349 % \changes{2.3}{2013/11/26}{Update email, add license. Date/version remains the
1350 % same since only commments and documentation are modified}
1351 % \changes{2.3}{2001/05/06}{Introduced new macros \cmdcite{varindexIndex},
1352 % \cmdcite{varindexDoConvert}, \cmdcite{varindexNoConvert}.
1353 % The layout of the documentation was slightly improved.
1354 % Moreover, a completely new section was added (on
1355 % \cmdcite{toolboxMakeDef}).\mypar
1356 % Use \cmdcite{typeout} instead of \cmdcite{message},
1357 % but provide a workaround for plain \TeX. Avoid error with
1358 % plain \TeX\ and \LaTeX 2.09 (because \cmdcite{newcount} is
1359 % defined there as \cmdcite{outer} which is rather annoying).
1360 % Since \texttt{toolbox} works around this problem, finally also
1361 % the local \cmdcite{if}'s now actually \emph{are} local}
1362 % \changes{2.2}{2001/05/01}{Introduced \texttt{=:\^} flags into
1363 % \cmdcite{varindextwo}. Changed sorting of entries
1364 % starting with ``\texttt{-}''
1365 % (see \cmdcite{varindexOutSortDashBeg}).\mypar
1366 % Improved documentation, in particular of \cmdcite{varindextwo}
1367 % and \cmdcite{varindexNewFormat}.
1368 % Also new examples were added for both commands}
1369 % \changes{2.1}{2001/04/30}{Finally implemented placeholder replacement
1370 % (\cmdcite{varindexPreviousATexttrue} and friends) such that
1371 % it works also in the expected way with commas.\mypar
1372 % Introduced separated command \cmdcite{varindexCommaExpandtrue}
1373 % which was in earlier versions automatically coupled with
1374 % \cmdcite{varindexCommaLeadstrue}. Changed the default of both
1375 % values to `true'.\mypar
1376 % Introduced \cmdcite{varindexOutText...} and friends and enabled
1377 % a hook into the format string processing via
1378 % \cmdcite{varindexNewFormat}.\mypar
1379 % Reordered documentation such that the more interesting
1380 % customization parts are now mentioned earlier}
1381 % \changes{1.21}{2001/03/29}{Divided package into two: Many macros which are
1382 % of independent interest have been put into the \texttt{toolbox}
1383 % package. For the user visible is that the macros are now called
1384 % e.\,g.\ \cmdcite{toolboxMakeSplit} instead of
1385 % \cmdcite{varindexMakeSplit}. For backward compatibility,
1386 % the old (now obsolete) names are still available, although not
1387 % documented anymore}
1388 % \changes{1.20}{2001/01/13}{Changed \cmdcite{varindextwo}:
1389 % Added the \cmdcite{varindextwoCommaTilde} functionality and the
1390 % corresponding three flags \texttt{?!/}. Moreover, changed the
1391 % default to \cmdcite{varindextwoCommaTildetrue}. Note that due to
1392 % this change the generated index entries may differ from those
1393 % of earlier versions. To get a backward compatible output,
1394 % you have to use \cmdcite{varindextwoCommaTildefalse}.\mypar
1395 % Also use now the symbols \texttt{`} and \texttt{'}
1396 % instead of the (now obsolete) \texttt{P} and \texttt{p} flags.
1397 % The reason for the latter is that \texttt{P} and \texttt{p}
1398 % could not be used immediately after a command without a space}
1399 % \changes{1.19}{2000/12/07}{Eliminated a bug in the \texttt{P} flag}
1400 % \changes{1.18}{2000/11/30}{Eliminated a bug in \cmdcite{SkipTricky}}
1401 % \changes{1.17}{2000/11/21}{\cmdcite{varindexNr??String} is now defined
1402 % as documented}
1403 % \changes{1.16}{2000/11/19}{Documentation rewritten
1404 % for doc and docstrip utilities (required files are now
1405 % \texttt{varindex.dtx} and \texttt{varindex.ins})}
1406 % \changes{1.15}{2000/10/10}{Fixed harmless bug which always caused a warning}
1407 % \changes{1.14}{2000/06/01}{First version released into public
1408 % (as \texttt{varindex.sty})}
1409 %
1410 % \iffalse
1411 %
1412 % The following part is the code needed to compile the documentation.
1413 % We do some trickery here, because we want that this file here could be used
1414 % for *both*: Compiling the documentation *and* as `varindex.sty'
1415 % (if really required).
1416 % Everything between the lines %<*driver> and %</driver>
1417 % goes to the file `varindex.tex'.
1418 %
1419 % \fi
1420 \ifcat @a% If this test is positive, then `@' has letter catcode which means
1421 % that this file is loaded as a style file (or as described in the
1422 % install section of the documentation).
1423 \def\TemporaryDummy{}
1424 \else\long\def\TemporaryDummy{%
1425 %
1426 %
1427 % \iffalse
1428 %</metainfo>
1429 %<*driver>
1430 \documentclass{ltxdoc}
1431 \OnlyDescription%% Comment this out, or
1432 %%\AlsoImplementation%% uncomment this line, if you want to see the source.
1433
1434 %% If you want an index, uncomment one of the following lines.
1435 %% After running latex a first time, you have to use
1436 %% makeindex -s gind.ist varindex
1437 %% Then run latex again.
1438 %%\CodelineIndex% comment this out if you want an index referring to codelines
1439 %%\PageIndex% comment this out if you want an index referring to pages
1440 %%\OldMakeindex% uncomment this line, if your MakeIndex is pre-v2.9
1441
1442 \setlength\hfuzz{15pt}
1443 \hbadness=7000
1444 \begin{document}
1445 \DocInput{varindex.dtx}
1446 \end{document}
1447 %</driver>
1448 %<*metainfo>
1449 % \fi
1450 }
1451 \fi\TemporaryDummy\let\TemporaryDummy\undefined
1452 %
1453 % \iffalse
1454 % Personal macros used for the doc utility:
1455 % \fi
1456 % \MakeShortVerb{"}
1457 % \def\bracemeta#1{\texttt{\{}\meta{#1}\texttt{\}}}
1458 % \def\nocomment{}
1459 % \def\myspace{\texttt{\textvisiblespace}}
1460 % \parindent0pt
1461
1462 %
1463 % \newenvironment{myquote}{\begin{quote}\begin{raggedright}\relax
1464 %}{\end{raggedright}\end{quote}}
1465 % \newenvironment{myindex}{\begin{myquote}}{\end{myquote}}
1466 % \def\myi{\par\hangindent 40pt\relax}
1467 % \def\mys{\myi\hspace*{20pt}}
1468 % \def\myss{\myi\hspace*{30pt}}
1469 % \def\pnoa#1{, #1}
1470 % \def\pno{\pnoa{17}}
1471 % \def\mysee#1{\pnoa{\emph{see also} #1}}
1472 % \def\sortedlike#1{\hspace*{10pt}(\emph{sorted like} #1)}
1473 % \def\sortedlikeq#1{\sortedlike{``#1''}}
1474 % \def\proz{\texttt{\%}}
1475 % \def\ppari{\proz\\\hspace*{20pt}}
1476 % \def\pari{\\\hspace*{20pt}}
1477 % \def\myquad{\mbox{$\qquad$}}
1478 % \def\macrott#1{{\mdseries\cmdcite{#1}}}
1479
1480 % \sloppy
1481 % \title{The \texttt{varindex} package\thanks
1482 % {This package has version number \fileversion{}, last revised \filedate.
1483 % The package may be distributed and/or modified under the conditions of the
1484 % LaTeX Project Public License, either version 1.3c of this license or (at
1485 % your option) any later version. The latest version of this license is in
1486 % \texttt{http://www.latex-project.org/lppl.txt}, and version 1.3c or later
1487 % is part of all distributions of LaTeX version 2005/12/01 or later.}}
1488 % \author{Martin V\"ath\thanks{This package bases on ideas of
1489 % \texttt{indextwo.sty} which was written jointly with
1490 % O.~Karch \texttt{[email protected]} and
1491 % H.-C.~Wirth \texttt{[email protected]}}\\
1492 % {\texttt{[email protected]}}}
1493 % \date{\docdate}
1494 % \maketitle
1495
1496 % \begin{abstract}
1497 % This \LaTeX\ package provides a luxury front-end for the "\index" command.
1498 % For example, it allows to generate multiple \index entries in
1499 % almost any form by a single command. It is extremely customizable, and works
1500 % with all versions of \LaTeX\ and probably most other \TeX\ formats, too.
1501 % \end{abstract}
1502
1503 % You may copy this package freely, as long as you distribute only unmodified
1504 % and complete versions.
1505
1506 % \tableofcontents
1507
1508 % \section{Changes}
1509 %
1510 % \begin{description}
1511 % \def\mypar{\par}\ChangesTab
1512 % \end{description}
1513 %
1514
1515 % \section{Introduction}
1516 %
1517 % If you have to write an index for a larger scientific text, you will probably
1518 % sooner or later have the problem that you want to put certain texts into the
1519 % index which consist of more than one word like \emph{Theorem of Picard}.
1520 % \par
1521 % There are several reasonable ways how one might do this: One might put the
1522 % text "Theorem of Picard" in the index, or "Picard theorem".
1523 % An alternative way is "Picard, Theorem", or "Picard's Theorem"
1524 % or "Theorem!Picard"
1525 % (here, "!" is the symbol used by "makeindex" to separate a
1526 % subindex, i.\,e.\ the output will actually look like
1527 % \begin{myindex}
1528 % \myi Theorem
1529 % \mys Picard\pno
1530 % \end{myindex}
1531 % This is useful if one also has other entries starting with \emph{Theorem}).
1532 % Several other natural alternatives are also possible.
1533 % \par
1534 % One may choose some or all of the above alternatives and then code them into
1535 % \TeX. However, if more than one of these alternatives is desired in the
1536 % index, this requires several "\index" commands (which are similar but not
1537 % identical). Moreover, if later another choice of the above alternatives
1538 % is required, the index entries must be completely rewritten.
1539 % This rewriting may be very cumbersome if one makes use of subindices
1540 % for two reasons.
1541 % \par
1542 % First, it may happen that one has to change even entries which are
1543 % apparently not affected. For example, assume there were just two subindices
1544 % for the index entry \emph{Theorem}, namely "Theorem!Picard" and
1545 % "Theorem!Riemann". If the theorem of Picard is eliminated from the main
1546 % text, one not only has to delete the entry "Theorem!Picard": The single
1547 % subindex "Theorem!Riemann" does not make much sense -- one should replace
1548 % it by "Theorem, Riemann". One could write a program to do this task
1549 % automatically, but my experience shows that it is better to do such things
1550 % by hand, because there are some situations where exceptions are desirable.
1551 % \par
1552 % However, things become really cumbersome, if one also has to sort the
1553 % entries in a different way than they are written. For example, suppose
1554 % that instead of \emph{Theorem} in the above example, one has the text
1555 % \emph{$\zeta$-function} which one wants to have sorted like
1556 % \emph{zeta-function}. In this case, the "\index"
1557 % command must be changed from
1558 % \begin{verbatim}
1559 % \index{zeta-function@$\zeta$-function!Riemann}\end{verbatim}
1560 %
1561 % into
1562 % \begin{verbatim}
1563 % \index{zeta-function, Riemann@$\zeta$-function, Riemann}\end{verbatim}
1564 %
1565 % which is rather different!
1566 % \par
1567 % Moreover, one may also want to have a placeholder. For example, instead of
1568 % generating the entries
1569 % \begin{myindex}
1570 % \myi Theorem
1571 % \mys Liouville\pno
1572 % \mys Open Mapping\pno
1573 % \mys Picard\pno
1574 % \end{myindex}
1575 % One might like to have entries like
1576 % \begin{myindex}
1577 % \myi Theorem
1578 % \mys $\sim$ of Liouville\pno
1579 % \mys Open Mapping $\sim$\pno
1580 % \mys $\sim$ of Picard\pno
1581 % \end{myindex}
1582 % One might use the symbol "$\sim$" for the placeholder, but this needs of
1583 % course its own sort entry in the "\index" command (in the above example,
1584 % we sorted by \emph{Liouville}, \emph{Open Mapping}, and \emph{Picard},
1585 % respectively, which is perhaps the most natural choice).
1586 % \par
1587 % With the package "varindex" it is rather simple to generate any of the
1588 % above "\index" entries, and it is easy to modify them, e.\,g.\ the above
1589 % placeholders can be introduced easily and then activated or deactivated by
1590 % a switch. Moreover, several "\index" entries like "Picard, Theorem of"
1591 % and "Theorem of Picard" can be generated simultaneously with a
1592 % \emph{single} command (i.\,e.\ you have to write the phrase
1593 % "Theorem of Picard" only once). In addition, it is also possible to produce
1594 % not only corresponding "\index" commands but also to output the content
1595 % into the running text.
1596 % \par
1597 % Since my experience shows that in each new book there arise new special cases
1598 % for the "\index" command, I was trying to provide a
1599 % \emph{highly customizable} solution which can be modified for all
1600 % needs (I hope).
1601
1602 % \section{Installation}
1603 %
1604 % This package was tested with \LaTeX 2.09 and \LaTeXe\ and should work
1605 % with all other (future) versions of \LaTeX\ and friends, too.
1606 % It should even run with other (non-\LaTeX) formats if an "\index" command
1607 % (with \LaTeX-Syntax) is provided.
1608 %
1609 % To use ``varindex'', you have to put the file "varindex.sty" in a path where
1610 % \TeX\ looks for its input files. You must also have the file "toolbox.sty"
1611 % of the ``toolbox'' package in your path (toolbox~v3.1 or newer is required).
1612 % The \TeX\ documents using varindex need the
1613 % following modifications in their header:
1614 %
1615 % \begin{itemize}
1616 % \item If you use \LaTeXe, put in the preamble the command
1617 % \begin{verbatim}
1618 % \usepackage{varindex}\end{verbatim}
1619 %
1620 % \item If you use \LaTeX 2.09, use "varindex" as a style option, e.\,g.\
1621 % \begin{verbatim}
1622 % \documentstyle[varindex]{article}\end{verbatim}
1623 % or
1624 % \begin{verbatim}
1625 % \documentstyle[varindex,12pt]{article}\end{verbatim}
1626 %
1627 % \item If you use some other (non-\LaTeX) format, you will probably have to
1628 % insert a line like
1629 % \begin{verbatim}
1630 % \catcode`\@=11\relax\input varindex.sty\catcode`\@=12\relax\end{verbatim}
1631 %
1632 % \end{itemize}
1633 %
1634 % For \TeX\ insiders: \LaTeX-specific commands used in "varindex.sty" are only:
1635 %
1636 % \begin{itemize}
1637 % \item "\makeatother"
1638 % \item "\makeatletter"
1639 % \item "\typeout"
1640 % \item "\RequirePackage"
1641 % \item "\newcommand" (used only in the form "\newcommand{"\meta{command}"}{}"
1642 % to ensure that \meta{command} was not defined before)
1643 % \item "\ProvidesPackage"
1644 % \end{itemize}
1645 % The above commands are used only if they are defined (otherwise,
1646 % natural substitutes are used ("\newcommand" and "\ProvidesPackage" are
1647 % then not used at all)).\bigskip
1648
1649 % \section{Additional hint}
1650 %
1651 % Although this package provides a convenient way to write "\index" commands,
1652 % this may not be sufficient: Also with this package, the "\index" commands
1653 % may still be rather complex. For some books, it might be necessary to write
1654 % the same "\index" entries several times (to get various page numbers).
1655 % The first idea that one might have in this case is to define a list of the
1656 % used "\index" commands near the beginning of the document e.\,g.\ as:
1657 % \begin{verbatim}
1658 % \newcommand{\Index}{\varindex(){\varindextwoScan}{\varindextwo}[]}
1659 % \newcommand{\Riemann}{\Index{Riemann Stieltjes integral}[1-23 2,1-~3 3!1-2~]}
1660 % \newcommand{\sigmaa}{\Index-={$\sigma$@sigma algebra}}\end{verbatim}
1661 % (the first line and the usage of "\Index" is explained in later sections;
1662 % here, it is sufficient to know that "\Index" produces in the above form
1663 % several "\index" entries).
1664 % To produce the corresponding "\index" entries in the
1665 % running text, one then just needs to use "\Riemann" resp.\ "\sigmaa".
1666 % However, this method has some disadvantages:
1667 % \begin{enumerate}
1668 % \item If one has many "\index" entries, it is easy to forget that e.\,g.\
1669 % "\sigmaa" is a command which should produce an index entry.
1670 % Then "\sigmaa" in the main text might be rather confusing.
1671 % \item One has to take care of macros already provided by \TeX, \LaTeX\ or
1672 % some packages. For example, it is not possible to use the name
1673 % "\sigma" for the above purpose.
1674 % \end{enumerate}
1675 % To avoid these problems, one may be very disciplinary and call the
1676 % involved macros systematically e.\,g.\ "\IndexRiemann" "\Indexsigmaa" etc.
1677 % However, this produces terrible long and unreadable macro names in the main
1678 % text.\par
1679 % The "toolbox" package (version 3.1 or newer) provides a more convenient
1680 % solution: You can use the command
1681 % \begin{verbatim}
1682 % \newcommand{\Index}{\varindex(){\varindextwoScan}{\varindextwo}[]}
1683 % \toolboxMakeDef{Idx}{#1}\end{verbatim}
1684 % and afterwards
1685 % \begin{verbatim}
1686 % \NewIdx{R-S}{\Index{Riemann Stieltjes integral}[1-23 2,1-~3 3!1-2~]}
1687 % \NewIdx{sigma-algebra}{\Index-={$\sigma$@sigma algebra}}\end{verbatim}
1688 % After these definitions, you can use the intuitive commands
1689 % "\Idx{R-S}" and "\Idx{sigma-algebra}" to produce the corresponding
1690 % index entries.\par
1691 % Note also the symbol ``-'' in the above names which is usually not allowed
1692 % in \TeX\ macros.\par
1693 %
1694 % If several page numbers occur for one index entry, it may be convenient for
1695 % the reader if the ``main page number(s)'' (e.\,g.\ the place(s)
1696 % where the corresponding notion is defined) is written in a different style.
1697 % Of course, this is supported by "\varindex" (as explained later). To use this
1698 % feature in connection with "\toolboxMakeDef", there are several
1699 % possibilities. A straightforward way is to add in addition to the above
1700 % commands also
1701 % \begin{verbatim}
1702 % \NewIdx{R-S*}{\Index[|textbf]%
1703 % {Riemann Stieltjes integral}[1-23 2,1-~3 3!1-2~]}
1704 % \NewIdx{sigma-algebra*}{\Index[|textbf]%
1705 % -={$\sigma$@sigma algebra}}\end{verbatim}
1706 % Then "\Idx{R-S*}" and "\Idx{sigma-algebra*}" produce index entries
1707 % with boldface page numbers. Of course, you can automatize the task of
1708 % generating macros which produce normal and boldface page numbers
1709 % e.\,g.\ as follows:
1710 % \begin{verbatim}
1711 % \newcommand{\Index}{\varindex(){\varindextwoScan}{\varindextwo}[]}
1712 % \toolboxMakeDef{Idx}{#1}
1713 % \newcommand{\MakeIdx}[2]{%
1714 % \NewIdx{#1}{\Index#2}%
1715 % \NewIdx{#1*}{\Index[|textbf]#2}}
1716 %
1717 % \MakeIdx{R-S}{{Riemann Stieltjes integral}[1-23 2,1-~3 3!1-2~]}
1718 % \MakeIdx{sigma-algebra}{-={$\sigma$@sigma algebra}}\end{verbatim}
1719 % This provides the commands "\Idx{R-S}" "\Idx{R-S*}"
1720 % "\Idx{sigma-algebra}" and "\Idx{sigma-algebra*}" with the same functionality
1721 % as explained before.\par
1722 %
1723 % The above approach has the disadvantage that the names ``$\ldots$"*"'' have
1724 % automatically a fixed meaning. Alternatively, you can also generate different
1725 % main commands. This is immediately supported by "\toolboxMakDef":
1726 % \begin{verbatim}
1727 % \newcommand{\Index}{\varindex(){\varindextwoScan}{\varindextwo}[]}
1728 % \toolboxMakeDef{Idx}{\Index#1}
1729 % \toolboxMakeDef{IdxMain}{\Index[|textbf]#1}
1730 %
1731 % \NewIdx{R-S}{{Riemann Stieltjes integral}[1-23 2,1-~3 3!1-2~]}
1732 % \NewIdxMain{R-S}{%
1733 % {Riemann Stieltjes integral}[1-23 2,1-~3 3!1-2~]}\end{verbatim}
1734 % Now you can use "\Idx{R-S}" and "\IdxMain{R-S}" to produce the
1735 % normal respectively boldface page numbers. Of course, you can also automatize
1736 % in this case the task of generating these commands:
1737 % \begin{verbatim}
1738 % \newcommand{\Index}{\varindex(){\varindextwoScan}{\varindextwo}[]}
1739 % \toolboxMakeDef{Idx}{\Index#1}
1740 % \toolboxMakeDef{IdxMain}{\Index[|textbf]#1}
1741 % \newcommand{\NewIdxBoth}[2]{%
1742 % \NewIdx{#1}{#2}%
1743 % \NewIdxMain{#1}{#2}}
1744 %
1745 % \NewIdxBoth{R-S}{{Riemann Stieltjes integral}[1-23 2,1-~3 3!1-2~]}
1746 % \NewIdxBoth{sigma-algebra}{-={$\sigma$@sigma algebra}}\end{verbatim}
1747 % After the above commands, you can use "\Idx{R-S}", "\IdxMain{R-S}",
1748 % "\Idx{sigma-algebra}" and "\IdxMain{sigma-algebra}" with their obvious
1749 % meaning.\par\bigskip
1750 %
1751 % \textbf{Summarizing}: The last of the above solutions is the one which
1752 % I recommend.\par\bigskip
1753 %
1754 % For further possibilities of the "\toolboxMakeDef" command (like making
1755 % copies of entries, redefining entries, etc.), please read the
1756 % original documentation of the "toolbox" package.
1757
1758 % \section{Examples}
1759 %
1760 % Probably you are very impatient and want to see some examples.
1761 % So, here you are -- but be warned that the examples are not explained in
1762 % detail. You have to read the later sections to understand more precisely
1763 % why the examples work the way they do.
1764 % \par
1765 % Since the "\varindex" command is highly customizable,
1766 % the following examples can only give you a rough impression of what
1767 % you can actually do with it.
1768 %
1769 % \subsection{Typical example of usage (using the \texttt{varindextwo} macros)}
1770 % \label{s:firstex}
1771 %
1772 % Suppose the following customization of the "\varindex" command was defined:
1773 % \begin{verbatim}
1774 % \def\Index{\varindex(){\varindextwoScan}{\varindextwo}[\emph]}\end{verbatim}
1775 %
1776 % Since we used the "varindextwo" macros here, by default
1777 % \emph{two} "\index" entries are generated with a single command.
1778 % After the above definition, the command
1779 % \begin{verbatim}
1780 % \Index{ring with $1$@one}\end{verbatim}
1781 %
1782 % will produces the "\index" entries for:
1783 %
1784 % \begin{myindex}
1785 % \myi ring
1786 % \mys $\sim$ with $1$\pno\sortedlikeq{with one}
1787 % \myi $1$\sortedlikeq{one}
1788 % \mys ring with $\sim$\pno\sortedlike
1789 % {``ring with'' (without \mbox{``$\sim$''!})}
1790 % \end{myindex}
1791 %
1792 % One of the examples of the introduction can be generated with
1793 % \begin{verbatim}
1794 % \Index*{Theorem of@ Picard}\end{verbatim}
1795 % which produces the two "\index" entries for
1796 %
1797 % \begin{myindex}
1798 % \myi Theorem
1799 % \mys $\sim$ of Picard\pno\sortedlikeq{Picard}
1800 % \myi Picard
1801 % \mys Theorem of $\sim$\pno\sortedlikeq{Theorem}
1802 % \end{myindex}
1803 % In this example, the word "of" is ignored for the sorting, because we put
1804 % the symbol "@"\meta{nothing} behind it which means that it should be sorted
1805 % as the empty string (in cases like this, also the space in front of "Picard"
1806 % is automatically ignored for the sort entry).
1807 %
1808 % Since we used in the above example the form "\Index*" instead of "\Index",
1809 % additionally the text "\emph{Theorem of Picard}" is output into the running
1810 % text (the string "\emph" stems from our customization of "\Index" defined
1811 % in the beginning).
1812 % \bigskip
1813 %
1814 % \emph{Completely} different entries may be generated by your own rules.
1815 % To this end, an optional parameter "["\meta{format}"]" can be appended.
1816 % Internally, the main argument is splitted into words which are numbered
1817 % $1,2,\ldots$; in \meta{format}, you can refer to these words simply
1818 % by using the corresponding numbers. An ``empty'' entry in \meta{format}
1819 % means all words in the original order (i.\,e.\ it is essentially equivalent
1820 % to $12345\ldots$). Some other symbols besides numbers are also allowed
1821 % which are listed later.
1822 %
1823 % \begin{verbatim*}
1824 %\Index{Hausdorff measure of noncompactness}[4,23 2!~34!1= ]\end{verbatim*}
1825 % generates \emph{three} index entries:
1826 %
1827 % \begin{myindex}
1828 % \myi noncompactness, measure of\pno
1829 % \myi measure
1830 % \mys $\sim$ of noncompactness
1831 % \myss Hausdorff $\approx$\pno
1832 % \myi Hausdorff measure of noncompactness\pno
1833 % \end{myindex}
1834 %
1835 % The last of these entries occurs only, because the last character in
1836 % the \meta{format} argument "[4,23"\myspace"2!~34!1="\myspace"]" is a space
1837 % (the space following "=" tells "varindex" that another (empty) entry is
1838 % desired).
1839 % \par
1840 %
1841 % If you want only slight modification(s) of the default, you need also just
1842 % slight modification(s) of the command, e.\,g.
1843 % \begin{verbatim}
1844 % \Index*,{ring with $1$@one}\end{verbatim}
1845 %
1846 % has the same effect as in our earlier example,
1847 % just that the second entry reads
1848 %
1849 % \begin{myindex}
1850 % \myi $1$, ring with $\sim$\pno\sortedlikeq{one, ring with}
1851 % \end{myindex}
1852 % Moreover, since the `"*"' occurred in the previous command, additionally
1853 %
1854 % \begin{verbatim}
1855 % \emph{ring with $1$}\end{verbatim}
1856 %
1857 % appears in the running text. Praxis shows that changes in the entries as
1858 % above have to be made frequently in the `fine tuning' of the index of a
1859 % book. Note that with the original "\index", the command would have to be
1860 % changed completely for the above entries, because we have a ``sort'' entry
1861 % for which a different rule applies if we use a subitem (``"!"'')
1862 % instead of a ``","\myspace''.
1863 % (BTW: "\varindex" produces sort entries only if they are necessary).
1864 % \par
1865 %
1866 % Of course, you may combine the default with your own format:
1867 % \begin{verbatim*}\Index{internal integrable function}[23,1~ +]\end{verbatim*}
1868 %
1869 % generates
1870 % \begin{myindex}
1871 % \myi internal function, integrable $\sim$\pno
1872 % \myi internal
1873 % \mys $\sim$ integrable function\pno
1874 % \myi function
1875 % \mys internal integrable $\sim$\pno
1876 % \end{myindex}
1877 % In this example, the first entry is generated by the symbols "23,1~" in the
1878 % \meta{format} argument, and the last two entries are those entries which
1879 % would have been generated by the "varindextwo" macros if no \meta{format}
1880 % argument had been given -- the magic symbol "+" instructs the "varindextwo"
1881 % macros to not suppress these entries.
1882 %
1883 %
1884 % \subsection{A simple example without the \texttt{varindextwo} macros}
1885 %
1886 % As known from "\index", a "|see{...}" can be used to produce a reference to
1887 % another index entry instead of a page number. Such a command may optionally
1888 % be appended.
1889 % \begin{verbatim*}
1890 %\varindex*{topology of a normed space}{5!4~!1= 45,12}[|see{norm}]
1891 %\end{verbatim*}
1892 % \begin{myindex}
1893 % \myi space
1894 % \mys normed $\sim$
1895 % \myss topology $\approx$\mysee{norm}
1896 % \myi normed space, topology of\mysee{norm}
1897 % \end{myindex}
1898 % (the precise appearance of ``\emph{see also} '' depends on how the "\see"
1899 % macro is defined in your style). The above command additionally inserts the
1900 % tokens "{topology of a normed space}" into the running text (this would not
1901 % happen if "\varindex" is used in place of "\varindex*").
1902 % Only in the first of the above entries, an `"@"' part will be added to the
1903 % "*.idx" file: This entry is sorted as if ``\myspace$\sim$'' resp.\
1904 % ``\myspace$\approx$'' would not exist.
1905 %
1906 %
1907 % \subsection{Another example without the \texttt{varindextwo} macros}
1908 %
1909 % The appearance of the cited page number and the appearance in the
1910 % running text (only available with ``"*"'') can be customized easily.
1911 %
1912 % \begin{verbatim}
1913 % \varindex[\emph][|textbf]%
1914 % {$\sigma$@sigma!$(\sigma-)$ finite {measure space}}%
1915 % {*1.23 23 23,1- 1-23}\end{verbatim}
1916 %
1917 % generates the three index entries
1918 % \begin{myindex}
1919 % \myi finite measure space\pnoa{\textbf{42}}
1920 % \myi finite measure space, $\sigma$-\pnoa{\textbf{42}}\sortedlikeq
1921 % {finite measure space, \mbox{sigma-}}
1922 % \myi $\sigma$-finite measure space\pnoa{\textbf{42}}\sortedlikeq
1923 % {sigma-finite measure space}
1924 % \end{myindex}
1925 % In all three entries the pages are printed using "\textbf".
1926 % Moreover, the tokens
1927 % \begin{verbatim}
1928 % \emph{($\sigma$-)finite measure space}\end{verbatim}
1929 %
1930 % are put into the running text.
1931 %
1932 % \subsection{A simple example using a flag
1933 % (without the \texttt{varindextwo} macros)}
1934 %
1935 % Note the token "1" in the following command:
1936 % \begin{verbatim}
1937 % \varindex1{$L$ and $M$@L and M}{}\end{verbatim}
1938 %
1939 % This command generates the index entry
1940 % \begin{myindex}
1941 % \myi $L$ and $M$\pno\sortedlikeq{L and M}
1942 % \end{myindex}
1943 % With the command
1944 % \begin{verbatim}
1945 % \varindex1*{$L$ and $M$@L and M}{}\end{verbatim}
1946 % or
1947 % \begin{verbatim}
1948 % \varindex*1{$L$ and $M$@L and M}{}\end{verbatim}
1949 %
1950 % additionally, "{$L$ and $M$}" is output into the running text.
1951 %
1952 % Note that without the `"1"', the index generated were
1953 % \begin{myindex}
1954 % \myi "$L$ and $M$ and M"\pno\sortedlikeq{"\$L\$ and L and M"}
1955 % \end{myindex}
1956 %
1957 % \subsection{An example for very primitive customized index commands
1958 % (without the \texttt{varindextwo} macros)}
1959 %
1960 % If you defined your ``default'' shortcuts appropriately, you can still
1961 % override some of your own defaults.
1962 %
1963 % \begin{verbatim}
1964 % \def\myindexA{\varindex[\emph][|textbf]*}
1965 % \def\myindexB{\varindex(){}{}[\emph][|textbf]}
1966 %
1967 % \myindexA{Foo1}{}
1968 % \myindexB{Foo2}[][]
1969 % \myindexB*{Foo3!{Foo 3}}\end{verbatim}
1970 %
1971 % Generates the index entries "Foo1", "Foo2", and "Foo3". Moreover,
1972 % "\emph{Foo1}" and "\emph{Foo 3}" is put into the running text.
1973 % The page number of "Foo 2" in the index is printed normal (i.\,e.\ "|textbf"
1974 % is overridden), the others with "\textbf". Note that by using braces,
1975 % it was possible to include a space into the text "Foo 3".
1976 %
1977 %
1978 % \subsection{An example of a primitive customized index command
1979 % (without the \texttt{varindextwo} macros)}\label{s:myindex}
1980 %
1981 % \TeX\ code can be inserted to customize the default formatting string.
1982 % \begin{verbatim}
1983 % \def\myindex{\varindex(\ifnum\varindexCount=2 1!2 2,1\fi){}{}[\emph]}
1984 %
1985 % \myindex{Foo Bar}\end{verbatim}
1986 %
1987 % generates the index entries
1988 % \begin{myindex}
1989 % \myi Foo
1990 % \mys Bar\pno
1991 % \myi Bar, Foo\pno
1992 % \end{myindex}
1993 %
1994 % \begin{verbatim}
1995 % \myindex*{Foo Bar}\end{verbatim}
1996 %
1997 % generates the same index entries as above and additionally outputs
1998 % "\emph{Foo Bar}" into the running text.
1999 %
2000 % \begin{verbatim}
2001 % \myindex*{other format}[21]\end{verbatim}
2002 %
2003 % generates the index entry
2004 % \begin{myindex}
2005 % \myi format other\pno
2006 % \end{myindex}
2007 % and outputs "\emph{other format}" into the running text.
2008 %
2009 % \begin{verbatim}
2010 % \myindex[|textbf]*{BoBo}\end{verbatim}
2011 %
2012 % generates the index entry
2013 % \begin{myindex}
2014 % \myi BoBo\pnoa{\textbf{42}}
2015 % \end{myindex}
2016 % where the page number is printed with "\textbf".
2017 % Moreover, "\emph{BoBo}" is output into the running text.
2018 %
2019 % \subsection{A primitive varying customized index command
2020 % (without the \texttt{varindextwo} macros)}
2021 %
2022 % \begin{verbatim}
2023 % \def\myindex{\varindex(\ifnum\varindexCount=2 1!2 2,1\fi)%
2024 % (\ifnum\varindexCount=2*2,1 1!2 2,1\fi){}{}[\emph]}\end{verbatim}
2025 %
2026 % With the same commands as in Section~\ref{s:myindex}, the same index entries
2027 % are generated, but the tokens "\emph{Far, Boo}", "\emph{other format}",
2028 % and "\emph{Bobo}" are output into the running text.
2029 %
2030 %
2031 % \subsection{Examples with the \texttt{varindextwo} macros}
2032 %
2033 % As mentioned earlier, if the "varindextwo" macros are used (and if
2034 % the main arguments contains at least two entries), then two
2035 % "\index" entries are generated by default. Roughly speaking, one "\index"
2036 % entry is the argument in its given order and the other is the argument in
2037 % reverse order (this is not precise, but explains the idea).\par
2038 %
2039 % For the following examples,
2040 % we use a similar definition for "\Index" as in Section~\ref{s:firstex},
2041 % and define an "\iemph" macro which has `"*"' as a default and outputs with
2042 % "\emph". I recommend to put both sort of definitions into the preamble of
2043 % all of your files which should use "varindex" (the names are of course
2044 % subject to your personal taste).
2045 %
2046 % \begin{verbatim}
2047 % \def\Index{\varindex(){\varindextwoScan}{\varindextwo}[]}
2048 % \def\iemph{\varindex(){\varindextwoScan\def\varindexStarPos{}}%
2049 % {\varindextwo}[\emph]}\end{verbatim}
2050 %
2051 % (note that the apparently simpler definition
2052 % \begin{verbatim}
2053 % \def\iemph{\varindex(){\varindextwoScan}{\varindextwo}[\emph]*}\end{verbatim}
2054 % is not as good as the above definition of "\iemph" as is explained below).
2055 %
2056 % After the above customization, you may use the following commands.
2057 % \begin{verbatim}
2058 % \Index*{measure of $\gamma$-noncompactness@gamma-noncompactness!FOO}
2059 % \end{verbatim}
2060 % generates the index entries
2061 % \begin{myindex}
2062 % \myi measure
2063 % \mys $\sim$ of $\gamma$-noncompactness\pno\sortedlikeq
2064 % {of gamma-noncompactness}
2065 % \myi $\gamma$-noncompactness\sortedlike{gamma-noncompactness}
2066 % \mys measure of $\sim$\pno
2067 % \end{myindex}
2068 % and outputs the tokens "{measure of FOO}" into the running text.
2069 % Note the order of the words!
2070 %
2071 % \begin{verbatim}
2072 % \Index*,?_'{flic of flac}\end{verbatim}
2073 %
2074 % generates
2075 % \begin{myindex}
2076 % \myi flic of flac\pno
2077 % \myi flac, flic\pno
2078 % \end{myindex}
2079 % and outputs "{flic of flac}". Here, the two tokens "_" and "," had the
2080 % effect that a space resp.\ ``","\myspace'' was used instead of a subentry
2081 % in the first resp.\ second "\index" entry; the token "'" caused the
2082 % preposition "of" to disappear in the second entry, and the token "?"
2083 % suppressed a trailing $\sim$ in the second entry.\par
2084 %
2085 % A more realistic example is
2086 % \begin{verbatim}
2087 % \Index^={$\sigma$@sigma algebra}\end{verbatim}
2088 %
2089 % which in both entries inserts a ``-'':
2090 %
2091 % \begin{myindex}
2092 % \myi $\sigma$\sortedlikeq{sigma}
2093 % \mys $\sim$-algebra\sortedlike{``algebra'' or ``-algebra'', see below}
2094 % \myi algebra
2095 % \mys $\sigma$-$\sim$\pno\sortedlikeq{sigma-}
2096 % \end{myindex}
2097 % Here, the sorting ``-algebra'' is chosen when you used
2098 % \begin{verbatim}
2099 % \let\varindexOutSortDashBeg\varindexOutSortDash\end{verbatim}
2100 % as described later.\par
2101 %
2102 % The flag "^" in conjunction with "-" has a special meaning:
2103 % \begin{verbatim}
2104 % \Index^->{$\sigma$@sigma algebra}\end{verbatim}
2105 % Then the first entry reads instead (the second is canceled because of ">"):
2106 %
2107 % \begin{myindex}
2108 % \myi $\sigma$-\sortedlikeq{sigma-}
2109 % \mys $\sim$ algebra\pno\sortedlikeq{algebra}
2110 % \end{myindex}
2111 %
2112 % Similarly, the conjunction "^" and "." has a special meaning:
2113 % \begin{verbatim}
2114 % \Index^.,:{ultra filter}\end{verbatim}
2115 %
2116 % generates entries without a space following $\sim$ (and in view of the flag
2117 % "," no new subentry is used for the second entry but instead a ``,''):
2118 %
2119 % \begin{myindex}
2120 % \myi ultra
2121 % \mys $\sim$filter\pno\sortedlike{filter}
2122 % \myi filter, ultra$\sim$\pno\sortedlike{filter, ultra}
2123 % \end{myindex}
2124 %
2125 % For crossreferences, one may use something like
2126 % \begin{verbatim}
2127 % \iemph[|see{recursive recursion}],_{recursive recursion}\end{verbatim}
2128 %
2129 % which generates
2130 % \begin{myindex}
2131 % \myi recursive recursion\mysee{recursive recursion}
2132 % \myi recursion, recursive $\sim$\mysee{recursive recursion}
2133 % \end{myindex}
2134 % and outputs "\emph{recursive recursion}". If we would have used instead the
2135 % definition
2136 % \begin{verbatim}
2137 % \def\iemph{\varindex(){\varindextwoScan}{\varindextwo}[]*}\end{verbatim}
2138 %
2139 % the above call were not possible, since the optional arguments "[|see...]"
2140 % must occur in front of the flag `"*"'.
2141 %
2142 % \begin{verbatim}
2143 % \Index-;*{Flip Flop}\end{verbatim}
2144 %
2145 % generates
2146 % \begin{myindex}
2147 % \myi Flip-Flop\pno
2148 % \myi FlopFlip\pno
2149 % \end{myindex}
2150 % and outputs "{Flip-Flop}" (note that the symbol "-" which is caused by the
2151 % flag "-" occurs also in the output).
2152 %
2153 % One may freely create other entries:
2154 % \begin{verbatim}
2155 % \Index>{Flippy Flop!GO}[*2-1-2 2!1-1 1-12 +]\end{verbatim}
2156 %
2157 % generates
2158 % \begin{myindex}
2159 % \myi Flop
2160 % \mys Flippy-Flippy\pno\qquad\emph{(no ``$\sim$''!)}
2161 % \myi Flippy-Flippy Flop\pno
2162 % \myi Flippy
2163 % \mys $\sim$ Flop\pno
2164 % \end{myindex}
2165 % and outputs "{GO-Flippy-GO}" (note that even without an explicit "*" flag,
2166 % we were able to generate this output, just by using the "*" in
2167 % \meta{format}).
2168 %
2169 % \begin{verbatim}
2170 % \Index*_,{shape {of a} of star}\end{verbatim}
2171 %
2172 % generates
2173 % \begin{myindex}
2174 % \myi shape of a star\pno
2175 % \myi star, shape of $\sim$\pno\sortedlike{star, shape of}
2176 % \end{myindex}
2177 % and outputs "{shape of a star}". Note that for the first entry the
2178 % proposition ``"of a"'' was chosen while for the second entry the
2179 % alternative proposition "of" was chosen.
2180 %
2181 % Also with the "varindextwo" macros the other flags keep their old meaning.
2182 % For example, the flag "1" still means that the main argument is
2183 % considered as a single entry.
2184 % \begin{verbatim}
2185 % \Index1*{$L$ feature@L feature}
2186 % \Index,{No $L$@L feature}\end{verbatim}
2187 %
2188 % generate
2189 % \begin{myindex}
2190 % \myi $L$ feature\pno\sortedlikeq{"L feature"}
2191 % \myi No
2192 % \mys $\sim$ $L$ feature\pno\sortedlikeq{"L feature"}
2193 % \myi feature, No $L$ $\sim$\pno\sortedlikeq{"feature, No L"}
2194 % \end{myindex}
2195 % and outputs "{$L$ feature}".
2196 %
2197 %
2198 % \subsection{Example of a simple modification of the
2199 % \texttt{varindextwo} macros}\label{ss:expatch}
2200 %
2201 % All flags and magic tokens in "varindextwo" can be customized to fit your
2202 % own taste, just by modifying "\varindextwoScan".
2203 %
2204 % \begin{verbatim}
2205 % \def\myindextwoScan{%
2206 % \varindextwoScan
2207 % \varindexNewFlag ~\vxtSpaceA
2208 % \varindexNewFlag 1\vxtSpaceB
2209 % \varindexNewFlag !\varindexOneEntry
2210 % \varindexMakeSplitExpand{/}{vxtSplitAtMagic}%
2211 % \def\varindexStarPos{}%
2212 % }
2213 % \def\myIndex{\varindex(){\myindextwoScan}{\varindextwo}[]}\end{verbatim}
2214 %
2215 %
2216 % "\myIndex" behaves similar to the previous example with
2217 % the following differences:
2218 % \begin{enumerate}
2219 % \item The flag "1" now has the previous meaning of "~".
2220 % \item One may now use "~" and "_" equivalently.
2221 % \item The flag "!" now has the original meaning of the flag "1".
2222 % \item Instead of "+" in the format string, the character "/" has to be used.
2223 % \end{enumerate}
2224
2225 %
2226 % \section{Main Description}
2227 %
2228 % Without additional customization, there are two possible calls for the
2229 % \DescribeMacro{\varindex}"\varindex" command:
2230 %
2231 % \begin{enumerate}
2232 % \item[a)] The first call has the form
2233 % \begin{myquote}
2234 % "\varindex["\meta{textstyle}"]["\meta{pagestyleA}"]"\meta{flags}\ppari
2235 % \bracemeta{main entries}\bracemeta{format}"["\meta{pagestyleB}"]"
2236 % \end{myquote}
2237 % Here, "["\meta{textstyle}"]", "["\meta{pagestyleA}"]",
2238 % "["\meta{pagestyleB}"]", and \meta{flags} are optional.
2239 % (But if "["\meta{textstyle}"]" is omitted, also "["\meta{pagestyleA}"]"
2240 % must be omitted).
2241 %
2242 % The meaning of the arguments is as follows:
2243 % \begin{description}
2244 % \item[\mdseries\meta{textstyle}] describes the textstyle used for the output
2245 % into the running text (typically, textstyle is "\emph" or empty).
2246 % \item[\mdseries\meta{pagestyle}] describes the pagestyle used for the output
2247 % of the page number (you may also use a construct like "|see{...}" here).
2248 % If "["\meta{pagestyleB}"]" is present, this is the value used.
2249 % Otherwise, the value of "["\meta{pagestyleA}"]" is used
2250 % (resp.\ nothing).
2251 % \item[\mdseries\meta{flags}] can be one (or both) of the following tokens:
2252 % \begin{description}
2253 % \item[\mdseries "*"] If this token appears in \meta{flag}, it has roughly
2254 % the meaning ``Output into running text''. More precisely, if no
2255 % "*" is occurs in \meta{format} (see below), then \meta{format}
2256 % is automatically prepended by the tokens ``"*"\myspace'' resp.\
2257 % ``"*"'' (depending whether \meta{format} starts with a space
2258 % or not).
2259 % \item[\mdseries "1"] With this flag, the content of \meta{main entries} is
2260 % considered as a single entry (see below).
2261 % \end{description}
2262 % \item[\mdseries\meta{main entries}] and
2263 % \item[\mdseries\meta{format}] are explained later.
2264 % \end{description}
2265 %
2266 % \item[b)] The alternative form to call "\varindex" is
2267 % \begin{myquote}
2268 % "\varindex("\meta{formatA}")("\meta{format*A}")"\relax
2269 % \bracemeta{scan program}\ppari
2270 % \bracemeta{main program}"["\meta{textstyle}"]["\meta{pagestyleA}"]"\relax
2271 %\meta{flags}\ppari
2272 % \bracemeta{main entries}"["\meta{formatB}"]["\meta{pagestyleB}"]"
2273 % \end{myquote}
2274 % The arguments "["\meta{textstyle}"]", "["\meta{pagestyleA}"]", \meta{flags},
2275 % and "["\meta{pagestyleB}"]" have the same meaning as in a) (in particular,
2276 % they are optional, but if "["\meta{textstyle}"]" is omitted, also
2277 % "["\meta{pagestyleA}"]" must be omitted).
2278 %
2279 % Also "("\meta{format*A}")" and "("\meta{formatA}")" are optional,
2280 % but if "("\meta{formatA}")" is omitted, also "("\meta{format*A}")"
2281 % must be omitted.
2282 %
2283 % The ``default'' value for \meta{format} is \meta{formatA} resp.\
2284 % \meta{format*A} (depending whether the flag "*" has been used or not).
2285 % If "["\meta{formatB}"]" is given, then this is used as the format (i.\,e.\
2286 % the optional argument \meta{formatB} can be used to override the default).
2287 %
2288 % The other values are:
2289 % \begin{description}
2290 % \item[\mdseries\meta{scan program}] is executed (i.\,e.\ expanded)
2291 % immediately when "\varindex" reads it. This parameter can be used
2292 % to introduce \emph{further} flags (other than "*" and "1"), see below.
2293 % \item[\mdseries\meta{main program}] is executed \emph{after} the
2294 % \meta{format} string(s) has been expanded.
2295 % \end{description}
2296 % \end{enumerate}
2297 %
2298 % It is recommended to define personal macros which contain all parameters up
2299 % to the place where \meta{flags} occurs (either with or without some flags,
2300 % depending on the intention). See the examples section.
2301 % \bigskip\par
2302 %
2303 % \meta{main entries} is the main argument which has the following form
2304 %
2305 % \begin{myquote}
2306 % \meta{entry1}[\myspace\meta{entry2}][\myspace\meta{entry3}]$\ldots$
2307 % \end{myquote}
2308 %
2309 % where each of \meta{entry1} \meta{entry2} \meta{entry3} $\ldots$
2310 % in turn has the form
2311 % \begin{myquote}
2312 % \meta{indextext}"@"\meta{sorttext}"!"\meta{outputtext}
2313 % \end{myquote}
2314 % or
2315 % \begin{myquote}
2316 % \meta{indextext}"!"\meta{outputtext}"@"\meta{sorttext}
2317 % \end{myquote}
2318 % In each of these forms, "@"\meta{sorttext} and "!"\meta{outputtext}
2319 % are optional. Here,
2320 % \begin{description}
2321 % \item[\mdseries\meta{indextext}]
2322 % is the text which is put into the index for the entry
2323 % \item[\mdseries\meta{sorttext}]
2324 % is what is used as a sort criterion for the entry
2325 % \item[\mdseries\meta{outputtext}]
2326 % is what is output into the running text for the entry
2327 % \end{description}
2328 %
2329 % Note that the symbol "@" has in a sense the opposite meaning as in the
2330 % original "\index" command:
2331 % \emph{Before} that symbol, the desired text appears, and
2332 % \emph{after} the symbol the place where it has to be sorted.
2333 % However, we chose the symbols "@" and "!", because these two
2334 % symbols are forbidden anyway (otherwise, "makeindex" will become confused).
2335 %
2336 % As usual, multiple spaces are considered as \emph{one} space and do not
2337 % generate empty ``ghost'' entries. Moreover, a space after a \TeX-command
2338 % like "\LaTeX" is eliminated by \TeX\ and thus also not considered as a
2339 % separator. You may use braces"{"$\ldots$"}" either around a whole entry or
2340 % around \meta{indextext} or \meta{sorttext} or \meta{outputtext} to allow
2341 % spaces which do not act as ``separators'' in the corresponding part.
2342 % The braces around these parts will vanish. In particular, you may generate an
2343 % empty entry with "{}" or "!" or "@" (bordered by spaces).
2344 % If you want that braces occur in the \emph{output}, you have to add an
2345 % additional pair of braces. Be aware that you write sufficiently
2346 % many braces, if you really should need them: For example,
2347 % the command "\varindex{{{{A"\myspace"B}}}}{}" produces the index entry
2348 % "{A"\myspace"B}": The outermost pair of braces is eliminated immediately
2349 % by \TeX. The second pair is eliminated, because this is a pair around a
2350 % complete entry in \meta{main entries}. Finally, another pair is eliminated,
2351 % because it is a brace around \meta{indextext}.
2352 % With the flag `"1"', \meta{main entries} is considered as one single entry.
2353 % Nevertheless, also with this flag, an additional pair of braces around
2354 % \meta{main entry} is eliminated.\bigskip
2355 %
2356 %
2357 % The \meta{format} has one of the following three forms:
2358 % \begin{myquote}
2359 % \meta{IndexA}[\myspace\meta{IndexB}][\myspace\meta{IndexC}]$\ldots$\relax
2360 %["*"\meta{OutputA}]["*"\meta{OutputB}]$\ldots$\\\relax
2361 %["*"\meta{OutputA}][\myspace\meta{IndexA}][\myspace
2362 %\meta{IndexB}]["*"\meta{OutputC}]$\ldots$\\
2363 % "*"
2364 % \end{myquote}
2365 % where the order of arguments can be arbitrarily mixed (except for the first
2366 % \meta{IndexA} in the first form). \meta{IndexA} \meta{IndexB} $\ldots$
2367 % \meta{OutputA} $\ldots$ describe the format of the index entries resp.\
2368 % of the output into the running text.
2369 % The output is generated in the given order (this might be important, if
2370 % a pagebreak occurs during the output into the running text).
2371 % The last case is exceptional and equivalent to ``"*"\myspace''.
2372 % The following characters/strings are allowed in the format entries:
2373 % \par\bigskip
2374 %
2375 % \begin{tabular}[t]{ll}
2376 % token &meaning\\\hline
2377 % "1"--"9"&\meta{entry1}--\meta{entry9}\\
2378 % "0" &\meta{entry10}\\
2379 % "~" &a placeholder sign (default is $\sim$)\\
2380 % "=" &a secondary placeholder sign (default is $\approx$)\\
2381 % "_" &the space character ``\myspace''\\
2382 % "s" &The token ``"\space"''
2383 % (but ``\myspace'' is used for the sort entry)\\
2384 % "." &No space will follow (see below)\\
2385 % "," &The character ``","'' (space will follow)\\
2386 % "-" &The character ``"-"'' (no space will follow)\\
2387 % "!" &Create a new sublevel (subitem).
2388 % \end{tabular}\par\bigskip
2389 %
2390 % All other tokens in this argument are forbidden. (Note that the magic
2391 % symbol "+" in \meta{format} is handled by the "varindextwo" macros, and
2392 % not by "varindex").\par
2393 % The token ``"!"'' above makes no sense for the output in the running text
2394 % and thus is forbidden behind "*".\par
2395 %
2396 % By a heuristic rule, a space is automatically inserted between two entries
2397 % which generate non-empty text. If the heuristic rule fails, you may always
2398 % force a space by either ``"_"'' or ``"s"'', or forbid a space by ``"."''.
2399 %
2400 % If a format is empty, all entries are taken in the order of input.
2401 % Note that \TeX\ eliminates concatenated spaces, and so you are able to
2402 % produce an empty format entry only at the end of \meta{format} or in front
2403 % of a ``"*"''. If you want to force an empty \emph{output}
2404 % (is this ever useful?), you may use just ``"."'' as the entry.\\
2405 %
2406 % A sort entry is only written to the "*.idx" file if it differs from the
2407 % text entry.
2408
2409 %
2410 % \section{Description of the \texttt{varindextwo} macros}
2411 %
2412 % The macros
2413 % \DescribeMacro{\varindextwoScan}
2414 % \DescribeMacro{\varindextwo}
2415 % \begin{verbatim}
2416 % \varindextwoScan \varindextwo\end{verbatim}
2417 %
2418 % can be used together as parameters \meta{scan program} resp.\
2419 % \meta{main program} for the "\varindex" command.
2420 % If "\varindex" is called with these macros, and no
2421 % explicit format argument is given, these macros generate a format
2422 % depending on the number of entries in \meta{main entries}:
2423 %
2424 % \begin{enumerate}
2425 % \item[a)] If there is only one entry in \meta{main entries}, then the format
2426 % ``"1"'' resp.\ ``"*1"\myspace"1"'' is
2427 % generated (depending whether the "*" flag was used or not), i.\,e.\ the
2428 % entry is put into the index, and printed if "\varindex" was
2429 % called with the "*" flag.
2430 %
2431 % \item[b)] If there are two entries in \meta{main entries}, then
2432 % \meta{format} becomes ``\myspace"1!~2"\myspace"1!2~"''. For example, if
2433 % \meta{main entries} is ``"graulty bazola"'', then the "\index" entries
2434 %
2435 % \begin{myindex}
2436 % \myi graulty
2437 % \mys $\sim$ bazola\pno
2438 % \myi bazola
2439 % \mys graulty $\sim$\pno
2440 % \end{myindex}
2441 %
2442 % are produced.\par
2443 % You can modify the first format entry with the following flags:\par
2444 % \bigskip
2445 %
2446 % \begin{tabular}[t]{lll}
2447 % flags&format used&with ``"*"'' additionally\\\hline
2448 % "_" &"12" &"*12"\\
2449 % "-" &"1-2" &"*1-2"\\
2450 % "^" &"1!~-2" resp.\ "1!-2" &"*1-2"\\
2451 % "-^"&"1-!~.2" resp.\ "1-!~2"&"*1-2"\\
2452 % "." &"1.2" &"*1.2"\\
2453 % ".^"&"1!~.2" &"*1.2"\\
2454 % "/" &"1!2" (without "~") &"*12"\\
2455 % "<" &no entry &"*12"
2456 % \end{tabular}\par\bigskip
2457 %
2458 % Here, the combinations "-^" and ".^" mean that both flags are used
2459 % (the order plays no role).
2460 % The output for "^" respectively "-^" is determined by the switches
2461 % \begin{myquote}
2462 % \DescribeMacro{\varindextwoDashTildetrue}"\varindextwoDashTildetrue"
2463 % (default)\par
2464 % \DescribeMacro{\varindextwoDashTildefalse}"\varindextwoDashTildefalse"
2465 % \end{myquote}
2466 % and
2467 % \begin{myquote}
2468 % \DescribeMacro{\varindextwoDashSpacetrue}"\varindextwoDashSpacetrue"\\
2469 % \DescribeMacro{\varindextwoDashSpacefalse}"\varindextwoDashSpacefalse"
2470 % (default)
2471 % \end{myquote}
2472 % respectively. The last entry in the above table is an additional format
2473 % entry which is generated if also the ``"*"'' flag is used.\par
2474 %
2475 % You can modify the second format entry with the following flags:\par
2476 % \bigskip
2477 %
2478 % \begin{tabular}[t]{ll}
2479 % flags&format used\\\hline
2480 % "," &"2,1~" resp.\ "2,1"\\
2481 % "~" &"21"\\
2482 % "=" &"2!1-~"\\
2483 % ",="&"2,1-~" resp.\ "2,1-"\\
2484 % "+" &"2-1"\\
2485 % ":" &"2!1.~"\\
2486 % ",:"&"2,1.~" resp.\ "2,1"\\
2487 % ";" &"2.1"\\
2488 % ">" &no entry\\
2489 % "!" &Append "~" (if not already there)\\
2490 % "?" &Without trailing "~"
2491 % \end{tabular}\par\bigskip
2492 %
2493 % Whether the first or the second alternatives in the above forms is used
2494 % depends on the status of the switch
2495 % \begin{myquote}
2496 % \DescribeMacro{\varindextwoCommaTildetrue}"\varindextwoCommaTildetrue"
2497 % (default)\\
2498 % \DescribeMacro{\varindextwoCommaTildefalse}"\varindextwoCommaTildefalse"
2499 % \end{myquote}
2500 % We point out that "\varindextwoCommaTildefalse" was in earlier versions of
2501 % "varindex" the default (and could not be changed).
2502 % Note that this switch has no effect if the ! or ? flags are used.\par
2503 %
2504 % \textbf{Hint} for remembering the symbols: The symbols "_" "." "-"
2505 % for the first entry are the same flags as for the output and the same
2506 % flags which are used in the \meta{format} argument.
2507 % The corresponding symbols "~" ":" (and ";") "=" (and "+") for the second
2508 % entry ``look similar''. The "," flag is only useful in the second entry
2509 % (and is the same symbol as in the \meta{format} argument).
2510 % The two exceptional symbols ">" and "<" can be read as ``generate only the
2511 % `forward-directed' resp.\ `backward-directed entry'\,''.\par
2512 %
2513 %
2514 % \item[c)] If there are three entries in \meta{main entries}, then
2515 % \meta{format} becomes ``\myspace"1!~23"\myspace"3!12~"''.
2516 % For example, if \meta{main entries} is ``"graulty of bazola"'', then
2517 % the following two "\index" entries are produced.
2518 %
2519 % \begin{myindex}
2520 % \myi graulty
2521 % \mys $\sim$ of bazola\pno
2522 % \myi bazola
2523 % \mys graulty of $\sim$\pno
2524 % \end{myindex}
2525 %
2526 % The flags have an analogous effect to~b).
2527 % In addition, if the flags "`" resp.\ "'" are used, the second entry
2528 % (in our example: ``of'') is omitted from the output in the first
2529 % resp.\ in the second index entry. If the flags "*" and "`"
2530 % are used together, the second entry is also omitted from the output
2531 % into the running text.
2532 %
2533 % \item[d)] If there are four entries in \meta{main entries}, then
2534 % \meta{format} becomes ``\myspace"1!~24"\myspace"4!31~"''. For example, if
2535 % \meta{main entries} is ``"graulty of@ OF bazola"'', then the following
2536 % two "\index" entries are produced.
2537 %
2538 % \begin{myindex}
2539 % \myi graulty
2540 % \mys $\sim$ of bazola\pno\sortedlikeq{bazola}
2541 % \myi bazola
2542 % \mys graulty OF $\sim$\pno\sortedlikeq{graulty OF}
2543 % \end{myindex}
2544 % In other words, we have a similar effect as in~c) except that for the
2545 % first entry the third word is skipped, and for the second entry the
2546 % second word is skipped. All flags as in~c) can be used with an
2547 % analogous meaning.
2548 % Also, if the "*" flag is used, the output into the running text is
2549 % analogous to~c) (the third word is skipped).
2550 %
2551 % \item[e)] If there are more than four entries in \meta{main entries}, then
2552 % \meta{formatA} resp.\ \meta{format*A} is used.
2553 % \end{enumerate}
2554 %
2555 % If an explicit \meta{format} argument is given to "\varindex" (together with
2556 % the "\varindextwo" macro as \meta{main program}), then this format is used,
2557 % except when it contains the symbol "+". In this case, this symbol "+" is
2558 % replaced by the format which would be generated by the rules~a)--e).
2559 % If additionally the "*" flag is used, there is a special rule:
2560 % If the explicit format contains a "*", then no additional "*"-output is
2561 % produced. Otherwise, the "*"-output from~a)--e) is prepended to the given
2562 % \meta{format} (with a space at the end, unless the format string is empty).
2563 % This means that ``normally'' you have the output from a)--e),
2564 % unless you write an own explicit "*"-part in the \meta{format}.
2565 %
2566 % If you do not like the tokens chosen for the default symbols, you can
2567 % easily choose your own tokens by just replacing "\varindextwoScan" with your
2568 % own macro (or defining your own ``magic'' tokens after "\varindextwoScan",
2569 % see the example in Section~\ref{ss:expatch}).
2570
2571 %
2572 % \section{Primitive customization}
2573 %
2574 %
2575 % You may use the command
2576 % \DescribeMacro{\varindexUsePlaceholderAfalse}
2577 % \DescribeMacro{\varindexUsePlaceholderBfalse}
2578 % \begin{verbatim}
2579 % \varindexUsePlaceholderAfalse
2580 % \varindexUsePlaceholderBfalse\end{verbatim}
2581 % to ignore the symbol "~" resp.\ "=" in the format entry.
2582 % You can easily restore the default by
2583 % \DescribeMacro{\varindexUsePlaceholderAtrue}
2584 % \DescribeMacro{\varindexUsePlaceholderBtrue}
2585 % \begin{verbatim}
2586 % \varindexUsePlaceholderAtrue
2587 % \varindexUsePlaceholderBtrue\end{verbatim}
2588 %
2589 % If you want to switch off the placeholder only at the beginning of
2590 % a new entry (resp.\ of a new subentry), you can use the commands
2591 % \DescribeMacro{\varindexLeadingPlaceholderAfalse}
2592 % \DescribeMacro{\varindexLeadingPlaceholderBfalse}
2593 % \begin{verbatim}
2594 % \varindexLeadingPlaceholderAfalse
2595 % \varindexLeadingPlaceholderBfalse\end{verbatim}
2596 % The default is restored with
2597 % \DescribeMacro{\varindexLeadingPlaceholderAtrue}
2598 % \DescribeMacro{\varindexLeadingPlaceholderBtrue}
2599 % \begin{verbatim}
2600 % \varindexLeadingPlaceholderAtrue
2601 % \varindexLeadingPlaceholderBtrue\end{verbatim}
2602 %
2603 % By default, the ``","'' in the format string is in this connection
2604 % treated as a symbol generating a new ``subentry''. You can change this
2605 % default with the command
2606 % \DescribeMacro{\varindexCommaLeadsfalse}
2607 % \begin{verbatim}
2608 % \varindexCommaLeadsfalse\end{verbatim}
2609 % You may switch back with
2610 % \DescribeMacro{\varindexCommaLeadstrue}
2611 % \begin{verbatim}
2612 % \varindexCommaLeadstrue\end{verbatim}
2613 %
2614 %
2615 % The content of the macros
2616 % \DescribeMacro{\varindexPlaceholderAText}
2617 % \DescribeMacro{\varindexPlaceholderASort}
2618 % \DescribeMacro{\varindexPlaceholderBText}
2619 % \DescribeMacro{\varindexPlaceholderBSort}
2620 % \begin{verbatim}
2621 % \varindexPlaceholderAText
2622 % \varindexPlaceholderASort
2623 % \varindexPlaceholderBText
2624 % \varindexPlaceholderBSort\end{verbatim}
2625 % is used as the placeholder "~" resp.\ "=" in the index resp.\ sort entry.
2626 % Note that if one of these entries expands empty, different rules for
2627 % the automatic insertion of spaces apply (for the index and sort entry
2628 % separately).
2629 %
2630 % You may prefer that the placeholder text resp.\ sort content changes at
2631 % run time to the context of the previous "!" entry. For example, you may
2632 % want that the command "\varindex{Gibble Gobble}{2!~2}" produces the index
2633 % entry
2634 % \begin{myindex}
2635 % \myi Gibble
2636 % \mys Gibble Gobble\pno
2637 % \end{myindex}
2638 % (or is at least \emph{sorted} as such an entry).
2639 %
2640 % You can achieve this with the commands
2641 % \DescribeMacro{\varindexPreviousATexttrue}
2642 % \DescribeMacro{\varindexPreviousASorttrue}
2643 % \DescribeMacro{\varindexPreviousBTexttrue}
2644 % \DescribeMacro{\varindexPreviousBSorttrue}
2645 % \begin{verbatim}
2646 % \varindexPreviousATexttrue
2647 % \varindexPreviousASorttrue
2648 % \varindexPreviousBTexttrue
2649 % \varindexPreviousBSorttrue\end{verbatim}
2650 % for the text and sort entry and the placeholders "~" and "=", respectively.
2651 % With these commands, the content of "\varindexPlaceholderAText" etc
2652 % is only used as the default if no previous "!" entry was given.
2653 % You can switch back to the default mode with the respective commands
2654 % \DescribeMacro{\varindexPreviousATextfalse}
2655 % \DescribeMacro{\varindexPreviousASortfalse}
2656 % \DescribeMacro{\varindexPreviousBTextfalse}
2657 % \DescribeMacro{\varindexPreviousBSortfalse}
2658 % \begin{verbatim}
2659 % \varindexPreviousATextfalse
2660 % \varindexPreviousASortfalse
2661 % \varindexPreviousBTextfalse
2662 % \varindexPreviousBSortfalse\end{verbatim}
2663 % By default, the ``","'' in the format entry is considered in this connection
2664 % similar to ``"!"''. If you want to change this, use the command
2665 % \DescribeMacro{\varindexCommaExpandfalse}
2666 % \begin{verbatim}
2667 % \varindexCommaExpandfalse\end{verbatim}
2668 % You may switch back with
2669 % \DescribeMacro{\varindexCommaExpandtrue}
2670 % \begin{verbatim}
2671 % \varindexCommaExpandtrue\end{verbatim}
2672 %
2673 % Since version 2.2, the dash ``"-"'' occurring at the beginning of entry
2674 % (or after ``"!"'' or even after ``","'' if "\varindexCommaExpandtrue" is in
2675 % effect) is ignored for sorting.
2676 % You can switch off this feature with the command
2677 % \DescribeMacro{\varindexOutSortDashBeg}
2678 % \begin{verbatim}
2679 % \let\varindexOutSortDashBeg\varindexOutSortDash\end{verbatim}
2680 % To restore the new default, use
2681 % \begin{verbatim}
2682 % \let\varindexOutSortDashBeg\toolboxEmpty\end{verbatim}
2683 % \bigskip
2684 % The commands
2685 % \begin{myquote}
2686 % \DescribeMacro{\varindexSetWordString}
2687 % "\varindexSetWordString{|}"\myquad
2688 % (Use "|" as separator for entries instead of spaces)\par
2689 % \DescribeMacro{\varindexSetSortString}
2690 % "\varindexSetSortString{>}"\myquad(default: "@")\par
2691 % \DescribeMacro{\varindexSetPlainString}
2692 % "\varindexSetPlainString{<}"\myquad(default: "!")
2693 % \end{myquote}
2694 % set the default ``magic'' strings used for \meta{main entries}.
2695 % The argument of the above macros is intentionally \emph{not} expanded (so
2696 % that you do not have troubles with active characters like "~").
2697 % To force expansion, use e.\,g.
2698 % \begin{verbatim}
2699 % \expandafter\varindexSetWordString\expandafter{\MacroToExpand}\end{verbatim}
2700 % or some similar construct.
2701 %
2702 % If you use a different separator than ``space'' for the entries, you may
2703 % want to change the rule how braces are eliminated. With the commands
2704 % \DescribeMacro{\varindexEliminateOuterBracetrue}
2705 % \DescribeMacro{\varindexEliminateInnerBracetrue}
2706 % \DescribeMacro{\varindexEliminateOuterBracefalse}
2707 % \DescribeMacro{\varindexEliminateInnerBracefalse}
2708 % \begin{verbatim}
2709 % \varindexEliminateOuterBracetrue
2710 % \varindexEliminateInnerBracetrue
2711 % \varindexEliminateOuterBracefalse
2712 % \varindexEliminateInnerBracefalse\end{verbatim}
2713 % you may allow resp.\ forbid the elimination of braces around the entries
2714 % resp.\ around \meta{indextext} \meta{sorttext} and \meta{outputtext}
2715 % With the flag ``"1"'', \meta{main entries} is considered as one single entry,
2716 % but if "\varindexEliminateOuterBracetrue" is set (which is the default)
2717 % also in this case an additional pair of braces around main entry is
2718 % eliminated.
2719 %
2720 % Similarly as above,
2721 % \begin{myquote}
2722 % \DescribeMacro{\varindexSetIndexString}
2723 % "\varindexSetIndexString{|}" \myquad default: space\par
2724 % \DescribeMacro{\varindexSetOutputString}
2725 % "\varindexSetOutputString{<}" \myquad default: "*"\par
2726 % \DescribeMacro{\varindexSetTildeAString}
2727 % "\varindexSetTildeAString{~}" \myquad (is default)\par
2728 % \DescribeMacro{\varindexSetTildeBString}
2729 % "\varindexSetTildeBString{=}" \myquad (is default)\par
2730 % \DescribeMacro{\varindexSetSpaceString}
2731 % "\varindexSetSpaceString{_}" \myquad (is default)\par
2732 % \DescribeMacro{\varindexSetSpaceTokString}
2733 % "\varindexSetSpaceTokString{s}"\myquad (is default)\par
2734 % \DescribeMacro{\varindexSetOmitString}
2735 % "\varindexSetOmitString{.}" \myquad (is default)\par
2736 % \DescribeMacro{\varindexSetCommaString}
2737 % "\varindexSetCommaString{,}" \myquad (is default)\par
2738 % \DescribeMacro{\varindexSetDashString}
2739 % "\varindexSetDashString{-}" \myquad (is default)\par
2740 % \DescribeMacro{\varindexSetExclamString}
2741 % "\varindexSetExclamString{!}" \myquad (is default)\par
2742 % \DescribeMacro{\varindexSetStringForNr}
2743 % "\varindexSetStringForNr 1{a}" \myquad default: "1"\par
2744 % "\varindexSetStringForNr{11}{b}"\myquad No default!
2745 % \end{myquote}
2746 % set the default ``magic'' strings used for \meta{format}.
2747 % In contrast to before, the arguments are fully expanded (with
2748 % "\varindexedef", see Section~\ref{s:docufeature}).
2749 % Note that the last command provides a way to access more than $10$ entries!
2750 %
2751 % If you use "\varindexSetIndexString{|}" (with some non-space token),
2752 % you may still use spaces in the format which then are just ignored.
2753 %
2754 %
2755 % Avoid that one string is a prefix of another string: In this case,
2756 % strange effects may happen, and this behavior may even change in
2757 % future releases of this package.
2758 % Note that the above effect may arise unintentionally if you use active
2759 % chars. For this reason, ``"~"'' is defined to expand to the letter ``"~"'',
2760 % before the expansion is executed. Maybe in later releases of this package
2761 % there will be further such redefinitions.
2762 % You can explicitly use this feature in your own macros by using
2763 % "\varindexedef" instead of the usual "\edef",
2764 % see Section~\ref{s:docufeature}.
2765 %
2766 % You can change the output for the text resp sort entry of the various
2767 % symbols used in the format string. More precisely, you can redefine
2768 %
2769 % \begin{myquote}
2770 % \DescribeMacro{\varindexOutExclam}
2771 % "\varindexOutExclam" \myquad Text output for "!"\par
2772 % \DescribeMacro{\varindexFollowsExclam}
2773 % "\varindexFollowsExclam" \myquad
2774 %Decide whether magic space after "!" is inserted\par
2775 % \DescribeMacro{\varindexOutTextComma}
2776 % "\varindexOutTextComma" \myquad Text output for ","\par
2777 % \DescribeMacro{\varindexOutSortComma}
2778 % "\varindexOutSortComma" \myquad Sort output for ","\par
2779 % \DescribeMacro{\varindexFollowsComma}
2780 % "\varindexFollowsComma" \myquad
2781 %Decide whether magic space after "," is inserted\par
2782 % \DescribeMacro{\varindexPreceedsComma}
2783 % "\varindexPreceedsComma" \myquad
2784 %Decide whether magic space before "," is erased\par
2785 % \DescribeMacro{\varindexOutTextSpace}
2786 % "\varindexOutTextSpace" \myquad Text output for "_"\par
2787 % \DescribeMacro{\varindexOutSortSpace}
2788 % "\varindexOutSortSpace" \myquad Sort output for "_"\par
2789 % \DescribeMacro{\varindexFollowsSpace}
2790 % "\varindexFollowsSpace" \myquad
2791 %Decide whether magic space after "_" is inserted\par
2792 % \DescribeMacro{\varindexPreceedsSpace}
2793 % "\varindexPreceedsSpace" \myquad
2794 %Decide whether magic space before "_" is erased\par
2795 % \DescribeMacro{\varindexOutTextSpTok}
2796 % "\varindexOutTextSpTok" \myquad Text output for "s"\par
2797 % \DescribeMacro{\varindexOutSortSpTok}
2798 % "\varindexOutSortSpTok" \myquad Sort output for "s"\par
2799 % \DescribeMacro{\varindexFollowsSpTok}
2800 % "\varindexFollowsSpTok" \myquad
2801 %Decide whether magic space after "s" is inserted\par
2802 % \DescribeMacro{\varindexPreceedsSpTok}
2803 % "\varindexPreceedsSpTok" \myquad
2804 %Decide whether magic space before "s" is erased\par
2805 % \DescribeMacro{\varindexOutTextDash}
2806 % "\varindexOutTextDash" \myquad Text output for "-"\par
2807 % \DescribeMacro{\varindexOutSortDash}
2808 % "\varindexOutSortDash" \myquad Sort output for "-"\par
2809 % \DescribeMacro{\varindexOutSortDashBeg}
2810 % "\varindexOutSortDashBeg" \myquad Sort output for "-"
2811 %if nothing preceeds.\par
2812 % \DescribeMacro{\varindexFollowsDash}
2813 % "\varindexFollowsDash" \myquad
2814 %Decide whether magic space after "-" is inserted\par
2815 % \DescribeMacro{\varindexPreceedsDash}
2816 % "\varindexPreceedsDash" \myquad
2817 %Decide whether magic space before "-" is erased\par
2818 % \DescribeMacro{\varindexOutTextOmit}
2819 % "\varindexOutTextOmit" \myquad Text output for "."\par
2820 % \DescribeMacro{\varindexOutSortOmit}
2821 % "\varindexOutSortOmit" \myquad Sort output for "."\par
2822 % \DescribeMacro{\varindexFollowsOmit}
2823 % "\varindexFollowsOmit" \myquad
2824 %Decide whether magic space after "." is inserted\par
2825 % \DescribeMacro{\varindexPreceedsOmit}
2826 % "\varindexPreceedsOmit" \myquad
2827 %Decide whether magic space before "." is erased
2828 % \end{myquote}
2829 %
2830 % The meaning is as follows: "\varindexOut..." should just expand to the
2831 % tokens which should be written into the text resp.\ sort output.
2832 % The corresponding macro "\varindexFollows..." is typically defined with
2833 % one of the following commands:
2834 % \begin{verbatim}
2835 % \let\varindexFollows...\varindexNextSpace
2836 % \let\varindexFollows...\varindexNoNextSpace\end{verbatim}
2837 % In the first case, a space is `magically' inserted in front of a
2838 % subsequent token (unless this token erases the magic space).
2839 % In the second case, no space follows, of course.
2840 % There is an alternative call:
2841 % \begin{myquote}
2842 % \DescribeMacro{\varindexSpaceTexttrue}
2843 % \DescribeMacro{\varindexSpaceTextfalse}
2844 % \DescribeMacro{\varindexSpaceSorttrue}
2845 % \DescribeMacro{\varindexSpaceSortfalse}
2846 % "\def\varindexFollows...{\varindexSpaceTexttrue\varindexSpaceSortfalse}"
2847 % \end{myquote}
2848 % This definition achieves that for the text output a space should follow,
2849 % but not for the sort output. Of course, you can also use similarly the
2850 % commands "\varindexSpaceTextfalse" and/or "\varindexSpaceSorttrue" in the
2851 % above definition (the effect should be obvious).
2852 % In particular, "\varindexNextSpace" is equivalent to
2853 % "\varindexSpaceTexttrue\varindexSorttrue".\par
2854 %
2855 % The macro "\varindexPreceeds..." is similarly as "\varindexFollows..." with
2856 % the difference that it is executed \emph{before} the token in question is
2857 % output. In particular, you can ignore a previous `magic space'.
2858 % All of the `magic space' commands are defined by default with
2859 % \begin{verbatim}
2860 % \let\varindexFollows...\toolboxEmpty
2861 % \let\varindexPreceeds...\varindexNoNextSpace\end{verbatim}
2862 % with the following two exceptions:
2863 % \begin{verbatim}
2864 % \let\varindexFollowsExclam\varindexNextSpace
2865 % \let\varindexFollowsComma\varindexNextSpace\end{verbatim}
2866 %
2867 % \section{Documented Features}\label{s:docufeature}
2868 %
2869 % The title ``documented features'' means that these are hacks which allow
2870 % further customization but which are ``documented'' in the sense that these
2871 % hacks will also be available in later versions. (You use an ``undocumented''
2872 % feature if you must use a macro name of the "varindex" package which
2873 % contains the symbol "@"). If a feature described in this section does not
2874 % work in the documented way, this is a bug and might be repaired in a
2875 % later version of "\varindex".
2876 %
2877 % (In a future release, "varindex" will cook your coffee, too).\bigskip
2878 %
2879 %
2880 % The argument \meta{main entries} is \emph{never} expanded, so you can
2881 % actually write macros into the "*.idx" file.
2882 % The command actually used to write the index is
2883 % \begin{myquote}
2884 % \DescribeMacro{\varindexIndex}"\varindexIndex"
2885 % \end{myquote}
2886 % (which by default is of course defined as "\index").
2887 % Since some implementations of the "\index" command still (partially) expand
2888 % their argument (which might be considered as a bug), the argument of
2889 % "\varindexIndex" is translated before the actual call with the aid of
2890 % "\toolboxMakeHarmless".
2891 % If you want to redefine "\varindexIndex" to a personal "\index"-output
2892 % function, you might want to skip the "\toolboxMakeHarmless" step.
2893 % This is arranged with the command
2894 % \begin{myquote}
2895 % \DescribeMacro{\varindexNoConvert}"\varindexNoConvert"
2896 % \end{myquote}
2897 % You can cancel the effect of this command with
2898 % \begin{myquote}
2899 % \DescribeMacro{\varindexNoConvert}"\varindexNoConvert"
2900 % \end{myquote}
2901 % Even if "\varindexNoConvert" is not in effect, \meta{main entries} is not
2902 % expanded (and in particular, the argument of "\varindexIndex" consists of
2903 % the corresponding entries in an unexpanded form).\par\bigskip
2904 %
2905 % The whole "\varindex" expansion takes place in a group, so all your
2906 % variables are local to a single call (unless you use "\gdef"
2907 % (and friends) of course).\par
2908 %
2909 % There are no "\global" directives used in any macro of this package.
2910 % In particular, if you call the above macros in a group (or redefine
2911 % "\varindexIndex"), the effect holds only until the end of the group.
2912 % \par\bigskip
2913 %
2914 % In contrast to \meta{main entries}, the \meta{format} argument is expanded
2915 % (with "\varindexedef", see below) (and also \meta{formatA} resp.\
2916 % \meta{format*A} is expanded before), so you can define abbreviations
2917 % (even simple conditional % abbreviations) for \meta{format}.
2918 % Note, however, that the expansion is essentially only evaluated with "\edef".
2919 % So, you will probably not want to use e.\,g.\ "\relax", since this command
2920 % expands to itself (and not into nothing -- use "\toolboxEmpty" if you want
2921 % the latter).
2922 % If you want more complex abbreviations, use \meta{main program} instead.
2923 %
2924 % In order to help you write conditional abbreviations, the
2925 % following variables are defined when your macro is expanded (and in
2926 % particular also in \meta{main program}). You may of course redefine them
2927 % appropriately:
2928 %
2929 % \begin{description}
2930 % \item[\macrott{varindexAppend}]\DescribeMacro{\varindexAppend}
2931 % The argument \meta{pagestyleA} resp.\ \meta{pagestyleB}.
2932 % \item[\macrott{varindexCount}]\DescribeMacro{\varindexCount}
2933 % A \TeX\ counter containing the number of entries in \meta{main entries}.
2934 % \item[\macrott{varindexLastEntry}]\DescribeMacro{\varindexLastEntry}
2935 % This is a macro (\emph{not} a counter) which is usually the value of
2936 % "\the\varindexCount". See below.
2937 % \item[\macrott{varindexEntry1} \macrott{varindexEntry2} \mdseries$\ldots$]
2938 %\DescribeMacro{\varindexEntry1-...}
2939 % The (index) text occurring in \meta{Entry1} \meta{Entry2} $\ldots$
2940 % \item[\macrott{varindexSort1} \macrott{varindexSort2} \mdseries$\ldots$]
2941 %\DescribeMacro{\varindexSort1-...}
2942 % The corresponding sort entry. If no sort entry was given, this is
2943 % the same as the corresponding "\varindexEntry1-..."
2944 % \item[\macrott{varindexPlain1} \macrott{varindexPlain2} \mdseries$\ldots$]
2945 %\DescribeMacro{\varindexPlain1-...}
2946 % The text which should be output in the text. If no such entry was given,
2947 % this is the same as the corresponding "\varindexEntry1-..."
2948 % \end{description}
2949 % "\varindexCount" may be larger than $10$, and correspondingly there may be
2950 % also more than $10$ different "\varindexEntry"/"Sort"/"Plain" macros.
2951 % If you \emph{add} entries, you have to increase "\varindexCount"
2952 % correspondingly, otherwise an error is produced if the format string
2953 % contains an entry larger then "\varindexCount". However, your additional
2954 % entries are \emph{not} output for \emph{empty} formats:
2955 % For empty formats the entries output are $1$--"\varindexLastEntry".
2956 % So if you want to output also your additional entries
2957 % in empty formats, you have to set "\varindexLastEntry" to your modified
2958 % value of "\varindexCount" in \meta{main program}. You may e.\,g.\ achieve
2959 % this with the following lines:
2960 % \begin{myquote}
2961 % "\expandafter"\\
2962 % "\def\expandafter\varindexLastEntry\expandafter{\the\varindexCount}"\proz
2963 % \end{myquote}
2964 % It is admissible that "\varindexLastEntry" is larger than "\varindexCount":
2965 % In this case all entries until "\varindexLastEntry" are
2966 % output in empty formats without producing an error (provided, of course,
2967 % that the corresponding variables "\varindexEntry..."/"Sort..."/"Plain..." are
2968 % defined).
2969 %
2970 % Note that numbers in \TeX\ command names require special handling,
2971 % i.\,e., you have to use something like
2972 %
2973 % \begin{verbatim}
2974 % \csname varindexPlain2\endcsname\end{verbatim}
2975 %
2976 % to access variables. To avoid this, you may want to use the macros
2977 % \DescribeMacro{\toolboxLet}"\toolboxLet" and
2978 % \DescribeMacro{\toolboxWithNr}"\toolboxWithNr" of the "toolbox" package.
2979 % Examples are
2980 % \begin{verbatim}
2981 % \toolboxWithNr 1\let{varindexEntry}\toolboxEmpty
2982 % \toolboxWithNr {10}\def{varindexSort}{Foo}
2983 % \toolboxLet \mymacro{varindexPlain\the\mycount}\end{verbatim}
2984 % These commands set "\varindexEntry1" to "\toolboxEmpty", "\varindexSort10"
2985 % to Foo, and "\mymacro" to the content of "\varindexPlain5" (if "\mycount=5").
2986 %
2987 % All these variables are also available when \meta{main program} is expanded.
2988 % In \meta{main program} also the following functions are useful:
2989 %
2990 % \begin{description}
2991 % \item[\macrott{varindexFormat}]\DescribeMacro{\varindexFormat}
2992 % This macro expands to the actual \meta{format} which is used.
2993 % The main purpose of \meta{main program} will usually be to (re)define
2994 % this macro. After \meta{main program} has been called, this macro is
2995 % modified in several ways:
2996 % \begin{enumerate}
2997 % \item "\varindexFormat" is expanded (with "\varindexedef", see below).
2998 % (thus, "\varindexFormat" is expanded \emph{before and after} the call
2999 % of \meta{main program}).
3000 % \item "\ifvarindexStar" is true (see below)
3001 % a ``"*"'' resp.\ ``"*"\myspace'' is prepended.
3002 % \item If it is only ``"*"'', it is replaced by ``"*"\myspace''.
3003 % \end{enumerate}
3004 % Note that before execution of \meta{main program}, no tests on the
3005 % validity of the format are done: You may use your own symbols to
3006 % `communicate' with \meta{main program} (provided that \meta{main program}
3007 % eliminates these symbols afterwards).
3008 % \item[\macrott{varindexFormatDefault}]\DescribeMacro{\varindexFormatDefault}
3009 % This macro expands to \meta{formatA} resp.\ \meta{format*A}
3010 % (in the expanded form) depending whether the "*" flag has been used in
3011 % the call. Note that this expansion was executed \emph{before}
3012 % the optional format argument is expanded for the first time.
3013 % \item[\macrott{ifvarindexstar}]\DescribeMacro{\ifvarindexstar}
3014 % \meta{ifpart} [ "\else" \meta{elsepart} ] "\fi"\par
3015 % If the optional "*" was given, \meta{ifpart} is executed, otherwise
3016 % \meta{elsepart}. This is a \TeX\ "if" command. In particular, by
3017 % \DescribeMacro{\varindexStarfalse}\DescribeMacro{\varindexStartrue}
3018 % "\varindexStarfalse" resp.\ "\varindexStartrue"
3019 % you may change the behavior for future "if"'s. This can be used
3020 % to prevent/force that a ``"*"'' resp.\ ``"*"\myspace'' is prepended to
3021 % the format after the execution of \meta{main program}.
3022 % Setting of this variable has no effect in \meta{scan program}.
3023 % \item[\macrott{ifvarindexExplicitFormat}]
3024 % \DescribeMacro{\ifvarindexExplicitFormat}
3025 % This is a \TeX\ "if" command (see above) which is true if the optional
3026 % format argument \meta{formatB} was given.
3027 % \end{description}
3028 %
3029 % To ``compose'' the format, you may want to use the macros
3030 % \begin{myquote}
3031 % \DescribeMacro{\toolboxDef}
3032 % "\toolboxDef\macrotodefine"\bracemeta{argumentlist}\par
3033 % \DescribeMacro{\toolboxAppend}
3034 % "\toolboxAppend\macrotoappend"\bracemeta{argumentlist}\par
3035 % \DescribeMacro{\varindexedef}
3036 % "\varindexedef\macrotodefine"\bracemeta{argumentlist}
3037 % \end{myquote}
3038 % All commands work similar to "\def" resp.\ "\edef" with two differences:
3039 %
3040 % For "\toolboxDef\macro", \meta{argumentlist} is expanded precisely by one
3041 % level (for details, see the documentation of the "toolbox" package).
3042 % Of course, for "\toolboxAppend", the new definition is appended to the old
3043 % definition of "\macro".
3044 %
3045 % "\varindexedef" fully expands \meta{argumentlist}. However, some active
3046 % symbols (currently only "~", but additional symbols might follow in a
3047 % future release) are deactivated before expansion, so that "~" actually
3048 % expands to "~" and not to a strange command sequence.
3049 %
3050 %
3051 % To ``decompose'' the format, you may want to use one of the macros
3052 %
3053 % \begin{myquote}
3054 % \DescribeMacro{\toolboxSplitAt}
3055 % "\toolboxSplitAt"\bracemeta{arg}\bracemeta{critical}\bracemeta{command}\par
3056 % \DescribeMacro{\toolboxMakeSplit}
3057 % "\toolboxMakeSplit"\bracemeta{critical}\bracemeta{command}\par
3058 % \DescribeMacro{\varindexMakeSplitExpand}
3059 % "\varindexMakeSplitExpand"\relax
3060 %\bracemeta{macros expanding to critical}\bracemeta{command}\par
3061 % \DescribeMacro{\varindexMakeVarSplit}
3062 % "\varindexMakeVarSplit\variable"\relax
3063 %\bracemeta{macros expanding to critical}\bracemeta{command}
3064 % \end{myquote}
3065 % The first two macros are described in the "toolbox" package.
3066 % The remaining two macros are similar to "\varindexMakeSplit" with the
3067 % difference that the argument \meta{critical} is obtained by expanding
3068 % \meta{macros expanding to critical} with the aid of "\varindexedef".
3069 % In the last form, additionally "\variable" is (re)defined to expand to
3070 % \meta{critical} ("\variable" is any free name).
3071 %
3072 % The following instances of a command created by "\toolboxMakeSplit"
3073 % exist (the content of \meta{critical} should be obvious):
3074 %
3075 % \begin{myquote}
3076 % \DescribeMacro{\varindexSplitAtIndex}
3077 % "\varindexSplitAtIndex"\myquad(generated by "\varindexSetIndexString")\par
3078 % \DescribeMacro{\varindexSplitAtOutput}
3079 % "\varindexSplitAtOutput"\myquad(generated by "\varindexSetOutputString")\par
3080 % \DescribeMacro{\varindexSplitAtTildeA}
3081 % "\varindexSplitAtTildeA"\myquad(generated by "\varindexSetTildeAString")\par
3082 % \DescribeMacro{\varindexSplitAtTildeB}
3083 % "\varindexSplitAtTildeB"\myquad(generated by "\varindexSetTildeBString")\par
3084 % \DescribeMacro{\varindexSplitAtSpace}
3085 % "\varindexSplitAtSpace"\myquad(generated by "\varindexSetSpaceString";
3086 % by default, \meta{critical} is "_")\par
3087 % \DescribeMacro{\varindexSplitAtSpaceTok}
3088 % "\varindexSplitAtSpaceTok"\myquad
3089 % (generated by "\varindexSetSpaceTokString";
3090 % by default, \meta{critical} is "s")\par
3091 % \DescribeMacro{\varindexSplitAtOmit}
3092 % "\varindexSplitAtOmit"\myquad(generated by "\varindexSetOmitString")\par
3093 % \DescribeMacro{\varindexSplitAtComma}
3094 % "\varindexSplitAtComma"\myquad(generated by "\varindexSetCommaString")\par
3095 % \DescribeMacro{\varindexSplitAtDash}
3096 % "\varindexSplitAtDash"\myquad(generated by "\varindexSetDashString")\par
3097 % \DescribeMacro{\varindexSplitAtExclam}
3098 % "\varindexSplitAtExclam"\myquad(generated by "\varindexSetExclamString")\par
3099 % \DescribeMacro{\varindexSplitAtNr??}
3100 % "\varindexSplitAtNr1"\myquad(generated by "\varindexSetStringForNr")\par
3101 % "\varindexSplitAtNr2"\par
3102 % $\ldots$
3103 % \end{myquote}
3104 % Note that you must use "\csname ....\endcsname" to call e.\,g.\ the macro
3105 % "\varindexSplitAtNr1". Only those numbers are admissible for
3106 % "\varindexSplitAtNr??" which have been introduced with
3107 % "\varindexSetStringForNr" (by default, this is the case for $1$--$10$).
3108 %
3109 % There is also the instance
3110 % \DescribeMacro{\varindexSplitSpace}
3111 % \begin{myquote}
3112 % "\varindexSplitSpace"\myquad
3113 % (to be distinguished from "\varindexSplitAtSpace")
3114 % \end{myquote}
3115 % where \meta{critical} is the space symbol.
3116 %
3117 %
3118 % In addition, you may use the variables
3119 % \begin{myquote}
3120 % \DescribeMacro{\varindexIndexString}"\varindexIndexString"\par
3121 % \DescribeMacro{\varindexOutputString}"\varindexOutputString"\par
3122 % \DescribeMacro{\varindexTildeAString}"\varindexTildeAString"\par
3123 % \DescribeMacro{\varindexTildeBString}"\varindexTildeBString"\par
3124 % \DescribeMacro{\varindexSpaceString}"\varindexSpaceString"\par
3125 % \DescribeMacro{\varindexSpaceTokString}"\varindexSpaceTokString"\par
3126 % \DescribeMacro{\varindexOmitString}"\varindexOmitString"\par
3127 % \DescribeMacro{\varindexCommaString}"\varindexCommaString"\par
3128 % \DescribeMacro{\varindexDashString}"\varindexDashString"\par
3129 % \DescribeMacro{\varindexExclamString}"\varindexExclamString"\par
3130 % \DescribeMacro{\varindexNr??String}\relax
3131 %"\varindexNr1String \varindexNr2String ..."
3132 % \end{myquote}
3133 % which expand to the corresponding strings.\par
3134 %
3135 % All the previous macros should not be redefined ``by hand''.
3136 % They are implicitly redefined by the "\varindexSet..." commands
3137 % (which partially also do other tasks).\par
3138 %
3139 %
3140 %
3141 % To drop possible braces, use the command
3142 % \DescribeMacro{\toolboxDropBrace}
3143 % \begin{verbatim}
3144 % \toolboxDropBrace\variable\end{verbatim}
3145 % of the "toolbox" package.\par
3146 %
3147 % In \meta{scan program} you may already want to call "\toolboxMakeSplit":
3148 % In this way, the choices for the ``magic'' tokens are made in the
3149 % (usually small) argument \meta{scan program}, and in this sense, you can
3150 % keep your (possibly rather complex) macro \meta{main program}
3151 % ``customizable'' (i.\,e.\ you can use the same macro also with a different
3152 % set of ``magic'' strings).
3153 % However, the main task of \meta{scan program} is to introduce
3154 % new flags with
3155 %
3156 % \begin{myquote}
3157 % \DescribeMacro{\varindexNewFlag}
3158 %"\varindexNewFlag"\meta{token}"\position["\meta{program}"\varindexEndOfFlag]"
3159 % \end{myquote}
3160 % or
3161 % \begin{myquote}
3162 % "\varindexNewFlag"\meta{token}"\position[\programmacro]"
3163 % \end{myquote}
3164 % Here, "\position" is an (undefined) macro, and \meta{token} an arbitrary
3165 % token. The "[program(macro)]" part is optional and is explained later.
3166 % If \meta{token} appears in \meta{flags}, then "\position" is defined to
3167 % expand to a (literally) number, namely the (last) position where token
3168 % was given inside the \meta{flags} list (counting from $0$). For example, if
3169 % \begin{verbatim}
3170 % \varindexNewFlag ,\commapos
3171 % \varindexNewFlag -\minuspos
3172 % \varindexNewFlag .\pointpos\end{verbatim}
3173 % are used in "\programA", then in the call
3174 % \begin{verbatim}
3175 % \varindex(){\programA}{\programB},-**-{}\end{verbatim}
3176 % the variable "\commapos" will expand in "\programB" to "0", while
3177 % "\minuspos" will expand to "4" (the last position is taken). Finally,
3178 % "\pointpos" is "\undefined" (unless you defined "\pointpos" differently
3179 % \emph{after} the call of "\varindexNewFlag"; in this case, this is the
3180 % default).
3181 % If "\varindexNewFlag" is called multiple times with the same token,
3182 % only the \emph{last} call with this token takes effect.
3183 %
3184 % The flags "*" and "1" are introduced in this way with
3185 % \DescribeMacro{\varindexStarPos}
3186 % \DescribeMacro{\varindexOneEntry}
3187 % \begin{verbatim}
3188 % \varindexNewFlag *\varindexStarPos
3189 % \varindexNewFlag 1\varindexOneEntry\end{verbatim}
3190 % \emph{before} \meta{scan program} is executed. This means:
3191 % \begin{enumerate}
3192 % \item Usually, "\varindexStarPos" contains the (last) position of "*"
3193 % (resp.\ is "\undefined"). Moreover, if you define "\varindexStarPos" in
3194 % \meta{scan program} or in some flag, you get the same effect as if "*"
3195 % had been used.
3196 % An analogous remark holds for "\varindexOneEntry".
3197 % \item If you introduce "*" with "\varindexNewFlag", the "*" looses its
3198 % original meaning. The same holds for "1".
3199 % \end{enumerate}
3200 %
3201 % If you have added a "[program(macro)]" part in the call of
3202 % "\varindexNewFlag", this part is expanded whenever the flag introduced
3203 % by "\token" is used in the call of "\varindex"
3204 % (note that it is not excluded that this happens several times within one
3205 % call). More precisely, program is expanded \emph{after} the variable
3206 % "\position" has been set to the corresponding value, so you may already
3207 % use "\position" in the program part.
3208 %
3209 % \textbf{Important:} The last token expanded in program \emph{must} be
3210 % \DescribeMacro{\varindexEndOfFlag}"\varindexEndOfFlag".
3211 % This is not nice but has to do with the way \TeX\ parses its arguments.
3212 % Also if you use the form "\programmacro", the \emph{very last} token expanded
3213 % must be "\varindexEndOfFlag". Even a construction like
3214 % \begin{verbatim}
3215 % \def\myprogrammacro{\ifx....
3216 % \CallSomeMacroWithvarindexEndOfFlagAtTheEnd
3217 % \fi
3218 % \varindexEndOfFlag}\end{verbatim}
3219 % is forbidden: In "\CallSomeMacroWithvarindexEndOfFlagAtTheEnd" an error
3220 % would occur at the end, since still the tokens "\fi\varindexEndOfFlag"
3221 % are in the tokenlist when EndOfFlag is reached there.
3222 % As a workaround, you may e.\,g.\ use
3223 % \begin{myquote}
3224 % "\def\myprogrammacro{\ifx..."\pari
3225 % "\def\execute{....\varindexEndOfFlag}"\ppari
3226 % "\else"\pari
3227 % "\def\execute{\varindexEndOfFlag}"\ppari
3228 % "\execute}"
3229 % \end{myquote}
3230 %
3231 % If you use the form "[\programmacro]", your macro may even read additional
3232 % parameters. These parameters are expected in the call of "\varindex"
3233 % \emph{behind} the flag you have introduced. So you may actually use flags
3234 % with parameters. For example, if "\scanprogram" contains a macro like
3235 % \begin{verbatim}
3236 % \varindexNewFlag -\minuspos[\readpara]\end{verbatim}
3237 % and you have defined
3238 % \begin{verbatim}
3239 % \def\readpara#1{\def\merk{#1}\varindexEndOfFlag}\end{verbatim}
3240 % then the call
3241 % \begin{verbatim}
3242 % \varindex(){\scanprogram}{\mainprg}*-{Foo}-{Foo 2}*{Entries}\end{verbatim}
3243 % is admissible, and in \meta{main program},
3244 % "\merk" will have the value ``Foo 2''.
3245 %
3246 % If you are more familiar with \TeX, you can even allow \emph{optional}
3247 % arguments following your flag: The value of the next (non-space) token is
3248 % at the call of "\programmacro" already saved into the macro
3249 % \DescribeMacro{\varindexNextToken}
3250 % \begin{verbatim}
3251 % \varindexNextToken\end{verbatim}
3252 % so you can just use it to test for e.\,g.\ ``"["''. In this connection,
3253 % you may also want to use the commands
3254 % \DescribeMacro{\varindexTestAndExec}
3255 % \DescribeMacro{\varindexSkipAndExec}
3256 % \begin{verbatim}
3257 % \varindexTestAndExec
3258 % \varindexSkipAndExec\end{verbatim}
3259 % Please, see the program text how these commands are applied.\bigskip
3260 %
3261 % Since version 2.1 you can also hack in personal extensions of the format
3262 % string. To do this, use the command
3263 % \begin{myquote}
3264 % \DescribeMacro{\varindexNewFormat}
3265 % "\varindexNewFormat\"\meta{splitcommand}\bracemeta{action}
3266 % \end{myquote}
3267 % Here, "\"\meta{splitcommand} is a command generated by "\toolboxMakeSplit" or
3268 % friends (preferably by "\varindexMakeSplitExpand", because the command should
3269 % act on the format string which is expand with "\varindexedef").
3270 % The string where it splits is the new string you can use
3271 % in the format argument after this call. For each
3272 % occurrence of the corresponding string in the format argument,
3273 % \meta{action} will be executed. If "\"\meta{splitcommand} splits at a string
3274 % which already had a previous meaning in the format string (or which is a
3275 % prefix to such a string) the old meaning of this string in the format string
3276 % is overridden.
3277 %
3278 % Typically, action will contain the following commands:
3279 % One action will probably be to output a desired token (sequence) via
3280 % \begin{myquote}
3281 % \DescribeMacro{\varindexTokensOut}
3282 % "\varindexTokensOut"\bracemeta{text token}\bracemeta{sort token}
3283 % \end{myquote}
3284 % or
3285 % \begin{myquote}
3286 % \DescribeMacro{\varindexTokensOutExpand}
3287 % "\varindexTokensOutExpand"\meta{macro for text token}\relax
3288 %\meta{macro for sort token}
3289 % \end{myquote}
3290 % In the first form, \meta{text token} resp.\ \meta{sort token} is the token
3291 % sequence put into the index or running text respectively into the sort entry
3292 % of the index for the corresponding format entry. The second form is similar
3293 % with the only difference that the arguments must be single macros which
3294 % expand to \meta{text token} and \meta{sort token}, respectively.\par
3295 %
3296 % The variable \DescribeMacro{\ifvarindexIndexMode}
3297 % \begin{verbatim}
3298 % \ifvarindexIndexMode\end{verbatim}
3299 % can be used to test whether the output goes into the running text or into
3300 % the index (i.\,e.\ whether a ``"*"'' preceeded the current entry).
3301 % For output into the text, \meta{sort token} is ignored, of course).
3302 %
3303 % Another action in "\varindexNewFormat" will probably be to take care of
3304 % the magic space flags. This is achieved by a call of "\varindexNextSpace" or
3305 % "\varindexNoNextSpace" (or separately via "\varindexSpaceTexttrue"/"false"
3306 % resp.\ "\varindexSpaceTexttrue"/"false"); see the earlier description.
3307 % The magic space flags are taken into account in "\varindexTokensOut".
3308 % Thus, if you want to ignore the previous flag for some reason you should set
3309 % them correspondingly before this call.
3310 % However, after the call you should also set them correspondingly for
3311 % further processing.\par
3312 %
3313 % Example:
3314 % \begin{verbatim}
3315 % \toolboxMakeSplit{:}{splitAtColon}
3316 % \varindexNewFormat\splitAtColon{%
3317 % \varindexNoNextSpace
3318 % \ifvarindexIndexMode
3319 % \varindexTokensOut{:}{}\varindexSpaceTexttrue
3320 % \else
3321 % \varindexTokensOut{---}{}\varindexNoNextSpace
3322 % \fi}\end{verbatim}
3323 % defines a new format entry ``":"'' which has the meaning that a colon
3324 % (automagically followed by a space) is put into the index but not into
3325 % the sort entry. Moreover, in the running text, the colon appears as a
3326 % long dash with no space followed. In any case, there is no magic space output
3327 % in front of the colon.\bigskip
3328 %
3329 % As an alternative action in "\varindexNewFormat", you can also call the
3330 % default commands for the format entries. The corresponding macros are
3331 % \begin{myquote}
3332 % \DescribeMacro{\varindexAddSpace}"\varindexAddSpace"\myquad"_"\par
3333 % \DescribeMacro{\varindexAddSpTok}"\varindexAddSpTok"\myquad"s"\par
3334 % \DescribeMacro{\varindexAddOmit}"\varindexAddOmit"\myquad"."\par
3335 % \DescribeMacro{\varindexAddDash}"\varindexAddDash"\myquad"-"\par
3336 % \DescribeMacro{\varindexAddComma}"\varindexAddComma"\myquad","\par
3337 % \DescribeMacro{\varindexAddExclam}"\varindexAddExclam"\myquad"!"\par
3338 % \DescribeMacro{\varindexAddTildeA}"\varindexAddTildeA"\myquad"~"\par
3339 % \DescribeMacro{\varindexAddTildeB}"\varindexAddTildeB"\myquad"="\par
3340 % \DescribeMacro{\varindexAddNumber}"\varindexAddNumber"\bracemeta{number}
3341 %\myquad"0-9" (\meta{number} is "1", "2", $\ldots$)
3342 % \end{myquote}
3343 % The precise meaning of these macros is intentionally \emph{not} documented,
3344 % because some details or side effects might change in a future release of
3345 % "varindex". But just for this reason, it might be advantageous to use the
3346 % above macros instead of writing personal substitutes which may fail to
3347 % have such side effects.\par
3348 %
3349 % Example:
3350 % \begin{verbatim}
3351 % \varindexMakeSplitExpand{~-}{splitPhrase}% It is important to expand
3352 % % (to have correct ~ catcode)
3353 % \varindexNewFormat\splitPhrase{%
3354 % \varindexAddTildeA
3355 % \let\remember\varindexPreceedsDash
3356 % \let\varindexPreceedsDash\toolboxEmpty
3357 % \varindexAddDash
3358 % \let\varindexPreceedsDash\remember}\end{verbatim}
3359 % After the above command, ``"~"'' and ``"-"'' have their usual meaning in
3360 % the format string except when they follow immediately in the form ``"~-"''.
3361 % In this case, the behavior of "-" changes as if "\varindexPreceedsDash"
3362 % were empty (which has the effect that the output looks like~``$\sim$~-''
3363 % instead of~``$\sim$-'').\par
3364 % Note that although "~" is a prefix to "~-", the converse is not true:
3365 % Thus, the above command does not change the previous meaning of~"~"
3366 % (and of course also not of~"-").\par
3367 % \bigskip
3368 %
3369 % \textbf{Some hack:}
3370 % \TeX\ ignores leading spaces in the argument list of a ``normal'' macro.
3371 % This has the effect that you should be able to insert spaces \emph{between}
3372 % any of your arguments without any trouble.
3373 % If this does not work the expected way, you can use the command
3374 % \DescribeMacro{\varindexArgumentSpace}
3375 % \DescribeMacro{\varindexSkipTricky}
3376 % \begin{verbatim}
3377 % \let\varindexArgumentSpace\varindexSkipTricky\end{verbatim}
3378 % which implements an own macro which does this task. Sadly, this can only
3379 % be done with some catcode trickery which in turn might bring you in trouble
3380 % with some (\emph{very}) exotic packages. You can restore the default with
3381 % \DescribeMacro{\varindexSkipDefault}
3382 % \begin{verbatim}
3383 % \let\varindexArgumentSpace\varindexSkipDefault\end{verbatim}
3384 %
3385 % All above customization commands/variables may be used anytime between
3386 % two "\varindex" calls. They take effect with the next "\varindex" call.
3387
3388 %
3389 % The macros "\varindextwoScan" and "\varindextwo" are considered as a
3390 % (very useful) \emph{example} for the customization of the "\varindex"
3391 % command. If you need further customization, have a look at their
3392 % definition first.
3393
3394
3395 % \iffalse
3396 %</metainfo>
3397 % \fi
3398 % \iffalse--------------------------------------------------------------\fi
3399 % \StopEventually{\PrintChanges}
3400 % \section{Implementation}
3401 %
3402 % \iffalse--------------------------------------------------------------
3403 %
3404 %
3405 %<*package>
3406 % \fi
3407 % \begin{macrocode}
3408 %%
3409 %% This file was generated by the docstrip utility from varindex.dtx.
3410 %% You may distribute this file only together with the source varindex.dtx
3411 %% (and if possible with varindex.ins) and only if these files are unmodified.
3412 %%
3413 %% Author:
3414 %%
3415 %% M. V\"ath [email protected]
3416 %%
3417
3418 \ifx\typeout\undefined
3419 \def\vx@tmp{\immediate\write17}
3420 \else
3421 \let\vx@tmp\typeout
3422 \fi\vx@tmp{varindex.sty by M. Vaeth: Release 2.3}
3423 \ifx\ProvidesPackage\undefined\else
3424 \ProvidesPackage{varindex}[2001/05/06 v2.3]
3425 \fi
3426 \ifx\RequirePackage\undefined
3427 \ifx\toolboxDef\undefined
3428 \input toolbox.sty
3429 \fi
3430 \ifx\toolboxNewifFalse\undefined
3431 \errmessage{varindex.sty requires toolbox.sty version 3.1 or higher}
3432 \fi
3433 \else
3434 \RequirePackage{toolbox}[2001/05/06]
3435 \fi
3436
3437 % \end{macrocode}
3438 %
3439 % \subsection{The \texttt{varindextwo} (sample) macros and their ``submacros''}
3440 % \begin{macro}{\varindextwo...}\nocomment
3441 %
3442 % \begin{macrocode}
3443 %%
3444 %% The file starts with the documented (sample) macros with their "sub"macros:
3445 %%
3446
3447 \ifx\newcommand\undefined\else
3448 \newcommand{\varindextwoScan}{}
3449 \newcommand{\varindextwo}{}
3450 \newcommand{\vxtAddmyStar}{}
3451 \newcommand{\vxtMakemyFormat}{}
3452 \fi
3453
3454 % \end{macrocode}
3455 %
3456 % \begin{macro}{\varindextwoScan}
3457 % The demo ``scan'' macro. It provides some new flags.
3458 % \begin{macrocode}
3459 \def\varindextwoScan{%
3460 \varindexNewFlag _\vxtSpaceA
3461 \varindexNewFlag -\vxtDashA
3462 \varindexNewFlag .\vxtDotA
3463 \varindexNewFlag <\vxtOmitA
3464 \varindexNewFlag /\vxtNoTildeA
3465 \varindexNewFlag `\vxtNopropA
3466 \varindexNewFlag P\vxtNopropA% Now obsolete; only for backward compatibility
3467 \varindexNewFlag ^\vxtBreakifyA
3468 \varindexNewFlag ,\vxtCommaB
3469 \varindexNewFlag ~\vxtSpaceB
3470 \varindexNewFlag +\vxtDashB
3471 \varindexNewFlag ;\vxtDotB
3472 \varindexNewFlag >\vxtOmitB
3473 \varindexNewFlag !\vxtTildeB
3474 \varindexNewFlag ?\vxtNoTildeB
3475 \varindexNewFlag p\vxtNopropB% Now obsolete; only for backward compatibility
3476 \varindexNewFlag '\vxtNopropB
3477 \varindexNewFlag =\vxtDashifyB
3478 \varindexNewFlag :\vxtOmitifyB
3479 \varindexMakeSplitExpand{+}{vxtSplitAtMagic}% + is the magic symbol
3480 }
3481
3482 % \end{macrocode}
3483 % \end{macro}
3484 %
3485 % \begin{macro}{\varindextwo}
3486 % The ``main'' demo macro which generates two "\index" commands
3487 % whose format depends on the number of entries in \meta{main entries}
3488 % \begin{macrocode}
3489 \def\varindextwo{%
3490 \let\vxtStarFormat\undefined
3491 \def\vxtexecute{\let\vxtmyFormat\varindexFormatDefault}%
3492 \ifcase\varindexCount
3493 % We have 0 entries (this cannot happen: {} generates one (empty) entry)
3494 \or% 1 entry:
3495 \def\vxtexecute{%
3496 \toolboxDef\vxtmyFormat{1}%
3497 \toolboxDef\vxtStarFormat{\varindexOutputString 1}}%
3498 \or% 2 entries:
3499 \def\vxtentryAa{1}%
3500 \def\vxtentryAb{2}%
3501 \def\vxtentryBa{2}%
3502 \def\vxtentryBb{1}%
3503 \let\vxtexecute\vxtMakemyFormat
3504 \or% 3 entries:
3505 \def\vxtentryAa{1}%
3506 \ifx\vxtNopropA\undefined
3507 \def\vxtentryAb{23}%
3508 \else
3509 \def\vxtentryAb{3}%
3510 \fi
3511 \def\vxtentryBa{3}%
3512 \ifx\vxtNopropB\undefined
3513 \def\vxtentryBb{12}%
3514 \else
3515 \def\vxtentryBb{1}%
3516 \fi
3517 \let\vxtexecute\vxtMakemyFormat
3518 \or% 4 entries:
3519 \def\vxtentryAa{1}%
3520 \ifx\vxtNopropA\undefined
3521 \def\vxtentryAb{24}%
3522 \else
3523 \def\vxtentryAb{4}%
3524 \fi
3525 \def\vxtentryBa{4}%
3526 \ifx\vxtNopropB\undefined
3527 \def\vxtentryBb{13}%
3528 \else
3529 \def\vxtentryBb{1}%
3530 \fi
3531 \let\vxtexecute\vxtMakemyFormat
3532 \else% more than 4 entries:
3533 \def\vxtexecute{\let\vxtmyFormat\varindexFormatDefault}%
3534 \fi
3535 \ifvarindexExplicitFormat% the optional format string was given:
3536 \expandafter\vxtSplitAtMagic\expandafter{\varindexFormat}\vxttmp\vxttmpa
3537 \ifx\vxttmpa\undefined
3538 % If the Magic symbol does not occur, we do nothing
3539 \else% Otherwise:
3540 % We generate our format and insert it at the place of the Magic symbol:
3541 \vxtexecute
3542 \toolboxDef\varindexFormat{\vxttmp\vxtmyFormat\vxttmpa}%
3543 \vxtAddmyStar
3544 \fi
3545 \else% without an optional format string, we generate our own format
3546 \vxtexecute
3547 \let\varindexFormat\vxtmyFormat
3548 \vxtAddmyStar
3549 \fi
3550 }
3551
3552 % \end{macrocode}
3553 % \end{macro}
3554 % Some flags used for the "varindextwo" macros.
3555 % \begin{macro}{\ifvarindextwoCommaTilde}\nocomment
3556 % \begin{macrocode}
3557 \toolboxNewiftrue{varindextwoCommaTilde}
3558 % \end{macrocode}
3559 % \end{macro}
3560 % \begin{macro}{\ifvarindextwoDashTilde}\nocomment
3561 % \begin{macrocode}
3562 \toolboxNewiftrue{varindextwoDashTilde}
3563 % \end{macrocode}
3564 % \end{macro}
3565 % \begin{macro}{\ifvarindextwoDashSpace}\nocomment
3566 % \begin{macrocode}
3567 \toolboxNewiffalse{varindextwoDashSpace}
3568 % \end{macrocode}
3569 % \end{macro}
3570 %
3571 % \begin{macro}{\vxtAddmyStar}
3572 % A submacro needed by "\varindextwo"
3573 % \begin{macrocode}
3574 \def\vxtAddmyStar{%
3575 \ifvarindexStar% With the * flag, and
3576 \ifx\vxtStarFormat\undefined\else% if we have our own StarFormat:
3577 \varindexStarfalse% <- No further prepending of `*' desired afterwards
3578 \expandafter\varindexSplitAtOutput\expandafter{\varindexFormat}%
3579 \vxttmp\vxttmp
3580 \ifx\vxttmp\undefined% Did no `*' occur in the format string yet?
3581 \ifx\varindexFormat\toolboxEmpty% Empty format means: Only the * part:
3582 \let\varindexFormat\vxtStarFormat
3583 \else%Normally, we prepend our *-format and a space
3584 \toolboxDef\varindexFormat{%
3585 \vxtStarFormat\varindexIndexString\varindexFormat}%
3586 \fi
3587 \fi
3588 \fi
3589 \fi
3590 }
3591
3592 % \end{macrocode}
3593 % \end{macro}
3594 %
3595 % \begin{macro}{\vxtAddmyStar}
3596 % A submacro needed by "\varindextwo"
3597 % \begin{macrocode}
3598 \def\vxtMakemyFormat{%
3599 \let\vxtstarseparator\toolboxEmpty
3600 \ifx\vxtBreakifyA\undefined
3601 \ifx\vxtSpaceA\undefined
3602 \ifx\vxtDashA\undefined
3603 \ifx\vxtDotA\undefined
3604 \vxtExclamSeparator
3605 \else
3606 \let\vxtseparator\varindexOmitString
3607 \let\vxtstarseparator\vxtseparator
3608 \fi
3609 \else
3610 \let\vxtseparator\varindexDashString
3611 \let\vxtstarseparator\vxtseparator
3612 \fi
3613 \else
3614 \let\vxtseparator\toolboxEmpty
3615 \fi
3616 \else% With ^
3617 \ifx\vxtDotA\undefined
3618 \let\vxtstarseparator\varindexDashString
3619 \ifx\vxtDashA\undefined% -^
3620 \ifvarindextwoDashTilde
3621 \vxtExclamSeparator
3622 \toolboxAppend\vxtseparator\vxtstarseparator
3623 \else
3624 \toolboxDef\vxtseparator{\varindexExclamString\vxtstarseparator}%
3625 \fi
3626 \else% Plain ^
3627 \vxtExclamSeparator
3628 \ifvarindextwoDashSpace
3629 \toolboxDef\vxtseparator{\vxtstarseparator\vxtseparator}%
3630 \else
3631 \toolboxDef\vxtseparator{%
3632 \vxtstarseparator\vxtseparator\varindexOmitString}%
3633 \fi
3634 \fi
3635 \else% .^
3636 \let\vxtstarseparator\varindexOmitString
3637 \vxtExclamSeparator
3638 \toolboxAppend\vxtseparator\vxtstarseparator
3639 \fi
3640 \fi
3641 \ifx\vxtOmitA\undefined
3642 % We define now the string "\vxtentryAa?\vxtentryAb" where
3643 % ? is determined by the flags.
3644 \toolboxDef\vxtmyFormat{\vxtentryAa\vxtseparator\vxtentryAb}%
3645 \else
3646 \let\vxtmyFormat\toolboxEmpty
3647 \fi
3648 % The *-format is calculated similarly:
3649 \toolboxDef\vxtStarFormat{\varindexOutputString
3650 \vxtentryAa\vxtstarseparator\vxtentryAb}%
3651 \ifx\vxtOmitB\undefined
3652 \let\vxtappend\toolboxEmpty
3653 \ifx\vxtSpaceB\undefined
3654 \ifx\vxtDashB\undefined
3655 \ifx\vxtDotB\undefined
3656 \ifx\vxtCommaB\undefined
3657 \let\vxtseparator\varindexExclamString
3658 \let\vxtappend\varindexTildeAString
3659 \else
3660 \let\vxtseparator\varindexCommaString
3661 \ifvarindextwoCommaTilde
3662 \let\vxtappend\varindexTildeAString
3663 \fi
3664 \fi
3665 \ifx\vxtDashifyB\undefined
3666 \ifx\vxtOmitifyB\undefined\else
3667 \toolboxDef\vxtappend{\varindexOmitString\vxtappend}%
3668 \fi
3669 \else
3670 \toolboxDef\vxtappend{\varindexDashString\vxtappend}%
3671 \fi
3672 \else
3673 \let\vxtseparator\varindexOmitString
3674 \fi
3675 \else
3676 \let\vxtseparator\varindexDashString
3677 \fi
3678 \else
3679 \let\vxtseparator\toolboxEmpty
3680 \fi
3681 \ifx\vxtTildeB\undefined\else
3682 \let\vxtappend\varindexTildeAString
3683 \fi
3684 \ifx\vxtNoTildeB\undefined\else
3685 \let\vxtappend\toolboxEmpty
3686 \fi
3687 % In all cases, we prepend now the string "\vxtentryBa?\vxtentryBb??"
3688 % where ? and ?? are determined by the flags
3689 \ifx\vxtmyFormat\toolboxEmpty% If the previous string was empty: no space
3690 \toolboxDef\vxtmyFormat{\vxtentryBa\vxtseparator\vxtentryBb\vxtappend}%
3691 \else
3692 \toolboxAppend\vxtmyFormat{%
3693 \varindexIndexString\vxtentryBa\vxtseparator\vxtentryBb\vxtappend}%
3694 \fi
3695 \fi
3696 }
3697 % \end{macrocode}
3698 % \end{macro}
3699 % \begin{macro}{\vxtAddmyStar}
3700 % A submacro needed by "\vxtMakemyFormat"
3701 % \begin{macrocode}
3702 \def\vxtExclamSeparator{%
3703 \ifx\vxtNoTildeA\undefined
3704 \toolboxDef\vxtseparator{\varindexExclamString\varindexTildeAString}%
3705 \else
3706 \let\vxtseparator\varindexExclamString
3707 \fi}
3708
3709 % \end{macrocode}
3710 % \end{macro}
3711 % \end{macro}
3712 %
3713 % \begin{macrocode}
3714 %% --------------------------------------------------------------------
3715 % \end{macrocode}
3716 % \subsection{The main implementation of \texttt{varindex}}
3717 % \begin{macrocode}
3718 %%
3719 %% Now the implementation of \varindex.
3720 %%
3721 % \end{macrocode}
3722 %
3723 %
3724 % Counters and default variables:\par
3725 %
3726 % We cannot use "\toolboxIf" for "\newcount", because in plain \TeX\ and
3727 % \LaTeX 2.09 the command "\newcount" is defined with the annoying "\outer"
3728 % flag.
3729 % \begin{macrocode}
3730
3731 \ifx\varindexCount\undefined
3732 \newcount\varindexCount
3733 \fi
3734
3735 % \end{macrocode}
3736 % \begin{macro}{\varindexPlaceholderAText}\nocomment
3737 % \begin{macrocode}
3738 \toolboxIf\undefined\def\varindexPlaceholderAText{$\sim$}
3739 % \end{macrocode}
3740 % \end{macro}
3741 % \begin{macro}{\varindexPlaceholderASort}\nocomment
3742 % \begin{macrocode}
3743 \toolboxIf\undefined\let\varindexPlaceholderASort\toolboxEmpty
3744 % \end{macrocode}
3745 % \end{macro}
3746 % \begin{macro}{\varindexPlaceholderBText}\nocomment
3747 % \begin{macrocode}
3748 \toolboxIf\undefined\def\varindexPlaceholderBText{$\approx$}
3749 % \end{macrocode}
3750 % \end{macro}
3751 % \begin{macro}{\varindexPlaceholderBSort}\nocomment
3752 % \begin{macrocode}
3753 \toolboxIf\undefined\let\varindexPlaceholderBSort\toolboxEmpty
3754
3755 % \end{macrocode}
3756 % \end{macro}
3757 % \begin{macro}{\ifvarindexUsePlaceholderA}\nocomment
3758 % \begin{macrocode}
3759 \toolboxNewiftrue{varindexUsePlaceholderA}
3760 % \end{macrocode}
3761 % \end{macro}
3762 % \begin{macro}{\ifvarindexUsePlaceholderB}\nocomment
3763 % \begin{macrocode}
3764 \toolboxNewiftrue{varindexUsePlaceholderB}
3765 % \end{macrocode}
3766 % \end{macro}
3767 % \begin{macro}{\ifvarindexLeadingPlaceholderA}\nocomment
3768 % \begin{macrocode}
3769 \toolboxNewiftrue{varindexLeadingPlaceholderA}
3770 % \end{macrocode}
3771 % \end{macro}
3772 % \begin{macro}{\ifvarindexLeadingPlaceholderB}\nocomment
3773 % \begin{macrocode}
3774 \toolboxNewiftrue{varindexLeadingPlaceholderB}
3775 % \end{macrocode}
3776 % \end{macro}
3777 % \begin{macro}{\ifvarindexCommaLeads}\nocomment
3778 % \begin{macrocode}
3779 \toolboxNewiftrue{varindexCommaLeads}
3780 % \end{macrocode}
3781 % \end{macro}
3782 % \begin{macro}{\ifvarindexCommaExpand}\nocomment
3783 % \begin{macrocode}
3784 \toolboxNewiftrue{varindexCommaExpand}
3785 % \end{macrocode}
3786 % \end{macro}
3787 % \begin{macro}{\ifvarindexPreviousAText}\nocomment
3788 % \begin{macrocode}
3789 \toolboxNewiffalse{varindexPreviousAText}
3790 % \end{macrocode}
3791 % \end{macro}
3792 % \begin{macro}{\ifvarindexPreviousASort}\nocomment
3793 % \begin{macrocode}
3794 \toolboxNewiffalse{varindexPreviousASort}
3795 % \end{macrocode}
3796 % \end{macro}
3797 % \begin{macro}{\ifvarindexPreviousBText}\nocomment
3798 % \begin{macrocode}
3799 \toolboxNewiffalse{varindexPreviousBText}
3800 % \end{macrocode}
3801 % \end{macro}
3802 % \begin{macro}{\ifvarindexPreviousBSort}\nocomment
3803 % \begin{macrocode}
3804 \toolboxNewiffalse{varindexPreviousBSort}
3805 % \end{macrocode}
3806 % \end{macro}
3807 % \begin{macro}{\ifvarindexEliminateInnerBrace}\nocomment
3808 % \begin{macrocode}
3809 \toolboxNewiftrue{varindexEliminateInnerBrace}
3810 % \end{macrocode}
3811 % \end{macro}
3812 % \begin{macro}{\ifvarindexEliminateOuterBrace}\nocomment
3813 % \begin{macrocode}
3814 \toolboxNewiftrue{varindexEliminateOuterBrace}
3815
3816 % \end{macrocode}
3817 % \end{macro}
3818 %
3819 %
3820 % The non-local macros (they should not exist already):
3821 %
3822 % \begin{macrocode}
3823 \ifx\newcommand\undefined\else
3824 \newcommand{\varindex}{}
3825 \newcommand{\varindexNewFlag}{}
3826 \newcommand{\varindexTestAndExec}{}
3827 \newcommand{\varindexSkipAndExec}{}
3828 \newcommand{\varindexSkipDefault}{}
3829 \newcommand{\varindexSkipTricky}{}
3830 \newcommand{\varindexMakeVarSplit}{}
3831 \newcommand{\varindexMakeSplitExpand}{}
3832 \newcommand{\varindexSetWordString}{}
3833 \newcommand{\varindexSetSortString}{}
3834 \newcommand{\varindexSetPlainString}{}
3835 \newcommand{\varindexSetIndexString}{}
3836 \newcommand{\varindexSetOutputString}{}
3837 \newcommand{\varindexSetTildeAString}{}
3838 \newcommand{\varindexSetTildeBString}{}
3839 \newcommand{\varindexSetSpaceString}{}
3840 \newcommand{\varindexSetSpaceTokString}{}
3841 \newcommand{\varindexSetOmitString}{}
3842 \newcommand{\varindexSetCommaString}{}
3843 \newcommand{\varindexSetDashString}{}
3844 \newcommand{\varindexSetExclamString}{}
3845 \newcommand{\varindexSetStringForNr}{}
3846 \newcommand{\varindexedef}{}
3847 \newcommand{\varindexArgumentSpace}{}
3848 \newcommand{\varindexNewFormat}{}
3849 \newcommand{\varindexTokensOut}{}
3850 \newcommand{\varindexTokensOutExpand}{}
3851 \newcommand{\varindexAddNumber}{}
3852 \newcommand{\varindexAddComma}{}
3853 \newcommand{\varindexAddTildeA}{}
3854 \newcommand{\varindexAddTildeB}{}
3855 \newcommand{\varindexAddExclam}{}
3856 \newcommand{\varindexAddSpace}{}
3857 \newcommand{\varindexAddSpTok}{}
3858 \newcommand{\varindexAddOmit}{}
3859 \newcommand{\varindexAddDash}{}
3860 \newcommand{\varindexDoConvert}{}
3861 \newcommand{\varindexNoConvert}{}
3862 %% Obsolete names (only provided for backward compatibility):
3863 \newcommand{\varindexdef}{}
3864 \newcommand{\varindexspace}{}
3865 \newcommand{\varindexDropBrace}{}
3866 \newcommand{\varindexMakeSplit}{}
3867 \newcommand{\varindexLet}{}
3868 \newcommand{\varindexWithNr}{}
3869 \fi
3870 \let\varindexdef\toolboxDef
3871 \let\varindexspace\toolboxSpace
3872 \let\varindexDropBrace\toolboxDropBrace
3873 \let\varindexMakeSplit\toolboxMakeSplit
3874 \let\varindexLet\toolboxLet
3875 \let\varindexWithNr\toolboxWithNr
3876
3877 % \end{macrocode}
3878 %
3879 % \begin{macro}{\varindex}
3880 %
3881 % The essential ``flow'' is easy:
3882 %
3883 % "\varindex" reads the arguments (using lots of auxiliary macros)
3884 % and then calls "\vx@Main".
3885 %
3886 % \begin{macrocode}
3887 \def\varindex{\begingroup
3888 % \end{macrocode}
3889 % Before "toolbox" 3.1 the following "\if"'s could not be made local.
3890 % The reason is that in plain \TeX\ and \LaTeX 2.09 the command "\newif" is
3891 % "\outer". Due to this stupid restriction, we had to define them before.
3892 % "toolbox" 3.1 has now implemented its own "\newif" command for this
3893 % reason.\par\bigskip
3894 %
3895 % "\if"'s for scanning of the parameters:
3896 %
3897 % \begin{macro}{\ifvarindexStar}\nocomment
3898 % \begin{macrocode}
3899 \toolboxNewifFalse{varindexStar}%
3900 % \end{macrocode}
3901 % \end{macro}
3902 % \begin{macro}{\ifvarindexExplicitFormat}\nocomment
3903 % \begin{macrocode}
3904 \toolboxNewifFalse{varindexExplicitFormat}%
3905 % \end{macrocode}
3906 % \end{macro}
3907 % \begin{macro}{\ifvx@atespace}
3908 % is true if a space was ate during skipping
3909 % \begin{macrocode}
3910 \toolboxNewifFalse{vx@atespace}%
3911 % \end{macrocode}
3912 % \end{macro}
3913 % \begin{macro}{\ifvx@savespace}
3914 % is true if we must ``put back'' an eaten space
3915 % \begin{macrocode}
3916 \toolboxNewifFalse{vx@savespace}%
3917 % \end{macrocode}
3918 % \end{macro}
3919 % "\if"'s for "\vx@main" and its submacros:
3920 % \begin{macro}{\ifvx@ffound}\nocomment
3921 % \begin{macrocode}
3922 \toolboxNewifFalse{vx@ffound}%
3923 % \end{macrocode}
3924 % \end{macro}
3925 % \begin{macro}{\ifvarindexIndexMode}\nocomment
3926 % "\ifvarindexIndexMode" is true if the currently parsed format corresponds
3927 % to an index entry (in contrast to the output into the running text).
3928 % \begin{macrocode}
3929 \toolboxNewifTrue{varindexIndexMode}%
3930 % \end{macrocode}
3931 % \end{macro}
3932 % \begin{macro}{\ifvarindexSpaceText}\nocomment
3933 % \begin{macrocode}
3934 \toolboxNewifFalse{varindexSpaceText}%
3935 % \end{macrocode}
3936 % \end{macro}
3937 % \begin{macro}{\ifvarindexSpaceSort}\nocomment
3938 % \begin{macrocode}
3939 \toolboxNewifFalse{varindexSpaceSort}%
3940 % \end{macrocode}
3941 % \end{macro}
3942 % \begin{macro}{\ifvx@firstiter}\nocomment
3943 % \begin{macrocode}
3944 \toolboxNewifTrue{vx@firstiter}%
3945 % \end{macrocode}
3946 % \end{macro}
3947 % \begin{macro}{\ifvx@tildeLead}
3948 % Decides whether we have a leading tilde
3949 % \begin{macrocode}
3950 \toolboxNewifFalse{vx@tildeLead}%
3951 % \end{macrocode}
3952 % \end{macro}
3953 % \begin{macro}{\ifvx@commaTextLead}
3954 % True if "\ifvarindexCommaExpand" is true and we have no token after comma.
3955 % \begin{macrocode}
3956 \toolboxNewifFalse{vx@commaTextLead}%
3957 % \end{macrocode}
3958 % \end{macro}
3959 % \begin{macro}{\ifvx@commaSortLead}\nocomment
3960 % True if "\ifvarindexCommaExpand" is true and we have no token after comma.
3961 % \begin{macrocode}
3962 \toolboxNewifFalse{vx@commaSortLead}%
3963 % \end{macrocode}
3964 % \end{macro}
3965 % We use "\varindexCount" also for generic flags to save counters.
3966 % \begin{macrocode}
3967 \varindexCount=0\relax
3968 \let\varindexStyle\toolboxEmpty
3969 \let\varindexAppend\toolboxEmpty
3970 \let\vx@text\toolboxEmpty
3971 \let\vx@mainprogram\undefined
3972 \let\vx@formatA\undefined
3973 \let\vx@formatAstar\undefined
3974 \let\varindexFormat\undefined
3975 \let\varindexFormatDefault\undefined
3976 \varindexNewFlag 1\varindexOneEntry
3977 \varindexNewFlag *\varindexStarPos
3978 \varindexTestAndExec(%optional formatA)
3979 \vx@ReadFormatA%else
3980 \vx@TestTextStyle}
3981
3982 % \end{macrocode}
3983 % \end{macro}
3984 % \begin{macro}{\vx@ReadFormatA}\nocomment
3985 % \begin{macrocode}
3986 \def\vx@ReadFormatA(#1){%
3987 \def\vx@formatA{#1}%
3988 \varindexTestAndExec(%optional formatAstar)
3989 \vx@ReadFormatAstar%else
3990 \vx@SkipAndReadScan}
3991
3992 % \end{macrocode}
3993 % \end{macro}
3994 % \begin{macro}{\vx@ReadFormatAstar}\nocomment
3995 % \begin{macrocode}
3996 \def\vx@ReadFormatAstar(#1){%
3997 \def\vx@formatAstar{#1}\vx@SkipAndReadScan}
3998
3999 % \end{macrocode}
4000 % \end{macro}
4001 % \begin{macro}{\vx@SkipAndReadScan}\nocomment
4002 % \begin{macrocode}
4003 \def\vx@SkipAndReadScan{\varindexSkipAndExec\vx@ReadScan}
4004 % \end{macrocode}
4005 % \end{macro}
4006 % \begin{macro}{\vx@ReadScan}\nocomment
4007 % \begin{macrocode}
4008 \def\vx@ReadScan#1{#1\toolboxEmpty\varindexSkipAndExec\vx@ReadProgram}
4009 % \end{macrocode}
4010 % \end{macro}
4011 % \begin{macro}{\vx@ReadProgram}\nocomment
4012 % \begin{macrocode}
4013 \def\vx@ReadProgram#1{\def\vx@mainprogram{#1}\vx@TestTextStyle}
4014
4015 % \end{macrocode}
4016 % \end{macro}
4017 % \begin{macro}{\vx@TestTextStyle}\nocomment
4018 % \begin{macrocode}
4019 \def\vx@TestTextStyle{%
4020 \varindexTestAndExec[%textstyle]
4021 \vx@ReadTextStyle%else
4022 \vx@TestFlags}
4023
4024 % \end{macrocode}
4025 % \end{macro}
4026 % \begin{macro}{\vx@ReadTextStyle}\nocomment
4027 % \begin{macrocode}
4028 \def\vx@ReadTextStyle[#1]{%
4029 \def\varindexStyle{#1}%
4030 \varindexTestAndExec[%pagestyleA]
4031 \vx@ReadPageStyleA%else
4032 \vx@TestFlags}
4033
4034 % \end{macrocode}
4035 % \end{macro}
4036 % \begin{macro}{\vx@ReadTextStyleA}\nocomment
4037 % \begin{macrocode}
4038 \def\vx@ReadPageStyleA[#1]{\def\varindexAppend{#1}\vx@TestFlags}
4039
4040 % \end{macrocode}
4041 % \end{macro}
4042 %
4043 % \begin{macro}{\vx@TestFlags}
4044 % This macro starts the flag read loop.
4045 % \begin{macrocode}
4046 \def\vx@TestFlags{%
4047 % \end{macrocode}
4048 % In this loop, we use "\varindexCount" for the flag position.
4049 % \begin{macrocode}
4050 \varindexCount=0\relax
4051 \varindexEndOfFlag}
4052
4053 % \end{macrocode}
4054 % "\varindexEndOfFlag" is the value of the `first to call' TestFlag...
4055 % (which is actually the last TestFlag... defined)
4056 % Let us first initialize it to TestFlag0:
4057 % \begin{macrocode}
4058 \varindexCount=0\relax
4059 \expandafter
4060 \def\expandafter\varindexEndOfFlag\expandafter{%
4061 \csname vx@TestFlag\the\varindexCount\endcsname}
4062 % \end{macrocode}
4063 %Initialize the `last' "\vx@TestFlag0" as a macro with the meaning
4064 %``start to read \meta{main entries}''.
4065 % \begin{macrocode}
4066 \expandafter
4067 \def\varindexEndOfFlag{\varindexSkipAndExec\vx@ReadMain}%
4068 % \end{macrocode}
4069 % \end{macro}
4070 %
4071 % \begin{macro}{\vx@TestFlag0}
4072 % "\vx@TestFlag0" is the first macro generated by "\varindexNewFlag".
4073 %
4074 % \begin{macro}{\varindexNewFlag}
4075 % "\varindexNewFlag" calls "\vx@MakeNewFlag" with appropriate arguments:
4076 %
4077 % \begin{macrocode}
4078 \def\varindexNewFlag#1#2{%
4079 \let#2\undefined
4080 \expandafter
4081 \def\expandafter\vx@tmp\expandafter{%
4082 \csname vx@TestFlag\the\varindexCount\endcsname #1#2}%
4083 \advance\varindexCount by 1\relax
4084 % \end{macrocode}
4085 % A bug in \TeX? Without this "\relax", the next "\expandafter"
4086 % is executed \emph{before} the counter is actually increased.
4087 % \begin{macrocode}
4088 \expandafter
4089 \toolboxSurround\expandafter{%
4090 \csname vx@TestFlag\the\varindexCount\expandafter\endcsname
4091 \csname vx@ReadFlag\the\varindexCount\endcsname}{}\vx@tmp
4092 \varindexTestAndExec[%program]
4093 \vx@ReadFlagProgram%else
4094 {\vx@MakeFlagProgram\varindexEndOfFlag}%
4095 }
4096 % \end{macrocode}
4097 % \end{macro}
4098 % \end{macro}
4099 % \begin{macro}{\vx@ReadFlagProgram}\nocomment
4100 % \begin{macrocode}
4101 \def\vx@ReadFlagProgram[#1]{\vx@MakeFlagProgram{#1}}
4102 % \end{macrocode}
4103 % \end{macro}
4104 % \begin{macro}{\vx@MakeFlagProgram}\nocomment
4105 % \begin{macrocode}
4106 \def\vx@MakeFlagProgram#1{\expandafter\vx@MakeNewFlag\vx@tmp{#1}}
4107
4108 % \end{macrocode}
4109 % \end{macro}
4110 %
4111 % \begin{macro}{\vx@MakeNewFlag}
4112 % Usage:
4113 % "\vx@MakeNewFlag\TestMacro\ReadMacro\PrevMacro\token\pos"\bracemeta{program}
4114 % \begin{macrocode}
4115 \def\vx@MakeNewFlag#1#2#3#4#5#6{%
4116 \def\varindexEndOfFlag{#1}%
4117 \def#1{\varindexTestAndExec#4{#2}{#3}}%
4118 \def#2#4{\expandafter
4119 \def\expandafter#5\expandafter{\the\varindexCount}%
4120 \advance\varindexCount by 1\relax
4121 \varindexSkipAndExec{#6}}%
4122 }
4123
4124 % \end{macrocode}
4125 % \end{macro}
4126 % \begin{macro}{\vx@ReadMain}\nocomment
4127 % \begin{macrocode}
4128 \long\def\vx@ReadMain#1{\def\vx@text{#1}%
4129 \ifx\vx@formatA\undefined
4130 \def\vx@exec{\varindexSkipAndExec\vx@ReadFormatB}%
4131 \else
4132 \def\vx@exec{%
4133 \varindexTestAndExec[%FormatB]
4134 \vx@ReadOptFormatB%else
4135 {\ifvx@atespace\vx@savespacetrue\fi\vx@TestAppend}}%
4136 \fi
4137 \vx@exec}
4138
4139 % \end{macrocode}
4140 % \end{macro}
4141 % \begin{macro}{\vx@ReadFormatB}\nocomment
4142 % \begin{macrocode}
4143 \def\vx@ReadFormatB#1{\def\varindexFormat{#1}\vx@TestAppend}
4144 % \end{macrocode}
4145 % \end{macro}
4146 % \begin{macro}{\vx@ReadOptFormatB}\nocomment
4147 % \begin{macrocode}
4148 \def\vx@ReadOptFormatB[#1]{\def\varindexFormat{#1}\vx@TestAppend}
4149
4150 % \end{macrocode}
4151 % \end{macro}
4152 % \begin{macro}{\vx@TestAppend}\nocomment
4153 % \begin{macrocode}
4154 \def\vx@TestAppend{%
4155 \varindexTestAndExec[%Append]
4156 {\vx@savespacefalse\vx@ReadAppend}%else
4157 {\ifvx@atespace\vx@savespacetrue\fi\vx@Main}}
4158
4159 % \end{macrocode}
4160 % \end{macro}
4161 % \begin{macro}{\vx@ReadAppend}\nocomment
4162 % \begin{macrocode}
4163 \def\vx@ReadAppend[#1]{\def\varindexAppend{#1}\vx@Main}
4164
4165 % \end{macrocode}
4166 % \end{macro}
4167 %
4168 % \begin{macro}{\varindexTestAndExec}
4169 % "\varindexTestAndExec\Token"\bracemeta{ifpart}\bracemeta{elsepart}
4170 % at the end of a macro:
4171 % Steps forward in the token list as long as there are spaces.
4172 % If a space is eaten, "\vx@atespace" is set true.
4173 % The next (non-space) token is put into "\varindexNextToken".
4174 % If this token is "\Token", then \meta{ifpart} is executed, otherwise
4175 % \meta{elsepart}.
4176 % \begin{macrocode}
4177 \def\varindexTestAndExec#1#2#3{%
4178 \varindexSkipAndExec{%
4179 \ifx\varindexNextToken#1%
4180 \def\vx@exec{#2}%
4181 \else
4182 \def\vx@exec{#3}%
4183 \fi
4184 \vx@exec}}
4185
4186 % \end{macrocode}
4187 % \end{macro}
4188 % \begin{macro}{\varindexSkipAndExec}
4189 % "\varindexSkipAndExec"\bracemeta{commands} at the end of a macro:
4190 % Steps forward in the token list as long as there are spaces.
4191 % The next (non-space) token is put into "\varindexNextToken".
4192 % Then commands are executed.
4193 % \begin{macrocode}
4194 \def\varindexSkipAndExec#1{%
4195 \vx@atespacefalse
4196 \def\vx@skipexec{#1}%
4197 \varindexArgumentSpace}
4198
4199 % \end{macrocode}
4200 % \end{macro}
4201 % \begin{macro}{\varindexSkipDefault}\nocomment
4202 % \begin{macrocode}
4203 \def\varindexSkipDefault{\futurelet\varindexNextToken\vx@skipexec}
4204
4205 % \end{macrocode}
4206 % \end{macro}
4207 % \begin{macro}{\varindexSkipTrickery}\nocomment
4208 % \begin{macrocode}
4209 \def\varindexSkipTricky{%
4210 \vx@MakeSpaceOther\futurelet\varindexNextToken\vx@SkipLoopTest}
4211 % \end{macrocode}
4212 % \end{macro}
4213 % \begin{macro}{\varindexSkipLoopTest}\nocomment
4214 % \begin{macrocode}
4215 \def\vx@SkipLoopTest{%
4216 \vx@MakeSpaceSpace
4217 \ifx\varindexNextToken\vx@spaceothertok
4218 \def\vx@skipnext{\vx@gobblespace a}%
4219 \else
4220 \let\vx@skipnext\vx@skipexec
4221 \fi
4222 \vx@skipnext}
4223 % \end{macrocode}
4224 % \end{macro}
4225 % \begin{macro}{\vx@gobblespace}\nocomment
4226 % \begin{macrocode}
4227 \def\vx@gobblespace a#1{\vx@atespacetrue\varindexSkipTricky}
4228
4229 % \end{macrocode}
4230 % \end{macro}
4231 %
4232 % \begin{macro}{\vx@Main}
4233 % This macro is called after all arguments are read into appropriate macros.
4234 % Now the macros will be parsed (possibly using the argument
4235 % \meta{mainprogram}), and then the output is produced.
4236 % Finally, the group is closed and a possible ``eaten space'' is put back.
4237 % \begin{macrocode}
4238 \def\vx@Main{%
4239 \ifx\varindexStarPos\undefined
4240 \varindexStarfalse
4241 \else
4242 \varindexStartrue
4243 \fi
4244 \ifx\vx@formatA\undefined
4245 % \end{macrocode}
4246 % The default format is empty if no default format is given
4247 % \begin{macrocode}
4248 \let\varindexFormatDefault\toolboxEmpty
4249 \else
4250 \ifvarindexStar
4251 \ifx\vx@formatAstar\undefined
4252 \let\varindexFormatDefault\vx@formatA
4253 \else
4254 \let\varindexFormatDefault\vx@formatAstar
4255 \fi
4256 \else
4257 \let\varindexFormatDefault\vx@formatA
4258 \fi
4259 \fi
4260 % \end{macrocode}
4261 % Now we parse \meta{main entries}:
4262 % \begin{macrocode}
4263 \toolboxDef\vx@toparse{\vx@text\vx@word\vx@endparse}%
4264 \ifx\varindexOneEntry\undefined
4265 \varindexCount=0\relax
4266 \let\vx@NextLoop\vx@TextLoop
4267 \vx@TextLoop
4268 \else
4269 \varindexCount=1\relax
4270 \ifvarindexEliminateOuterBrace
4271 \toolboxDropBrace\vx@text
4272 \fi
4273 \expandafter\vx@TextEntry\expandafter{\vx@text}%
4274 \fi
4275 \expandafter
4276 \def\expandafter\varindexLastEntry\expandafter{\the\varindexCount}%
4277 % \end{macrocode}
4278 % Now we expand the format(s):
4279 % \begin{macrocode}
4280 \varindexedef\varindexFormatDefault{\varindexFormatDefault}%
4281 \ifx\varindexFormat\undefined
4282 \varindexExplicitFormatfalse
4283 \let\varindexFormat\varindexFormatDefault
4284 \else
4285 \varindexExplicitFormattrue
4286 \varindexedef\varindexFormat{\varindexFormat}%
4287 \fi
4288 % \end{macrocode}
4289 % Now we execute \meta{mainprogram}, and expand "\varindexFormat" again:
4290 % \begin{macrocode}
4291 \ifx\vx@mainprogram\undefined\else
4292 \vx@mainprogram
4293 \varindexedef\varindexFormat{\varindexFormat}%
4294 \fi
4295 % \end{macrocode}
4296 % Still modify "\varindexFormat":
4297 % \begin{macrocode}
4298 \ifvarindexStar
4299 % \end{macrocode}
4300 % Prepend `"*"' resp. `"*"\myspace'
4301 % \begin{macrocode}
4302 \expandafter\varindexSplitAtOutput\expandafter{\varindexFormat}\vx@fa\vx@fb
4303 \ifx\vx@fb\undefined
4304 % \end{macrocode}
4305 % The `"*"' does not occur in "\varindexFormat"
4306 % \begin{macrocode}
4307 \expandafter\varindexSplitAtIndex\expandafter{\varindexFormat}%
4308 \vx@fa\vx@fb
4309 \ifx\vx@fb\undefined
4310 % \end{macrocode}
4311 % We did not find a `space'
4312 % \begin{macrocode}
4313 \let\vx@fa\undefined
4314 \fi
4315 \ifx\vx@fa\toolboxEmpty
4316 % \end{macrocode}
4317 % Did we find a `space' immediately at the start?
4318 % Then prepend only `"*"'
4319 % \begin{macrocode}
4320 \toolboxDef\varindexFormat{\varindexOutputString\varindexFormat}%
4321 \else
4322 % \end{macrocode}
4323 % prepend `"*"\myspace'
4324 % \begin{macrocode}
4325 \toolboxDef\varindexFormat{%
4326 \varindexOutputString\varindexIndexString\varindexFormat}%
4327 \fi
4328 \fi
4329 \fi
4330 \ifx\varindexFormat\varindexOutputString
4331 % \end{macrocode}
4332 % Replace `"*"' by `"*"\myspace'
4333 % \begin{macrocode}
4334 \toolboxDef\varindexFormat{\varindexOutputString\varindexIndexString}%
4335 \fi
4336 % \end{macrocode}
4337 % Now we interpret "\varindexFormat" and produce the output:
4338 % \begin{macrocode}
4339 \ifx\varindexFormat\toolboxEmpty
4340 \vx@FormatAll
4341 \else
4342 \toolboxDef\vx@toparse{\varindexFormat\varindexIndexString\vx@endparse}%
4343 \let\vx@NextLoop\vx@FormLoop
4344 \vx@FormLoop
4345 \fi
4346 \ifvx@savespace\aftergroup\space\fi
4347 \endgroup}
4348 % \end{macrocode}
4349 % \end{macro}
4350 % \begin{macro}{\vx@endparse}
4351 % "\vx@endparse" is the end of the string to parse:
4352 % \begin{macrocode}
4353 \def\vx@endparse{\vx@endparse}
4354
4355 % \end{macrocode}
4356 % \end{macro}
4357 %
4358 % \begin{macro}{\vx@TextLoop}
4359 % This is the (recursive) macro which parses \meta{main entries}.
4360 % For each entry (separated by "\vx@word"), possibly with braces
4361 % eliminated, the macro "\vx@TextEntry" is called.
4362 %
4363 % \begin{macrocode}
4364 \def\vx@TextLoop{%
4365 \ifx\vx@toparse\vx@endparse
4366 \let\vx@NextLoop\toolboxEmpty
4367 \else
4368 \advance\varindexCount by 1\relax
4369 \expandafter\vx@SplitAtWord\expandafter{\vx@toparse}%
4370 \vx@textentry\vx@toparse
4371 \ifvarindexEliminateOuterBrace
4372 \toolboxDropBrace\vx@textentry
4373 \fi
4374 \expandafter\vx@TextEntry\expandafter{\vx@textentry}%
4375 \fi
4376 \vx@NextLoop}
4377
4378 % \end{macrocode}
4379 % \end{macro}
4380 % \begin{macro}{\vx@FormLoop}
4381 % This is the (recursive) macro which parses the \meta{format}.
4382 % For each entry (separated by space or by "*") the function
4383 % "\vx@Format" is called with "\varindexIndexMode" set correspondingly.
4384 % \begin{macrocode}
4385 \def\vx@FormLoop{%
4386 \ifx\vx@toparse\vx@endparse
4387 \let\vx@NextLoop\toolboxEmpty
4388 \else
4389 \expandafter\varindexSplitAtIndex\expandafter{\vx@toparse}\vx@fa\vx@fb
4390 \expandafter\varindexSplitAtOutput\expandafter{\vx@fa}\vx@fa\vx@fc
4391 \ifx\vx@fa\toolboxEmpty
4392 % \end{macrocode}
4393 % Have we reached an empty entry in the format string?
4394 % \begin{macrocode}
4395 \ifvx@firstiter%% In the first iteration,
4396 %% \ifx\vx@fc\undefined% if 'space' is the very first sign,
4397 %% \vx@FormatAll% we output everything
4398 %% \fi
4399 \else
4400 % \end{macrocode}
4401 % Later, we always output everything.
4402 % \begin{macrocode}
4403 \vx@FormatAll
4404 \fi
4405 \else
4406 % \end{macrocode}
4407 % Usually, we just work with our current entry
4408 % \begin{macrocode}
4409 \expandafter\vx@Format\expandafter{\vx@fa}%
4410 \fi
4411 \vx@firstiterfalse
4412 \ifx\vx@fc\undefined
4413 % \end{macrocode}
4414 % If the first separating sign is 'space':
4415 % \begin{macrocode}
4416 \varindexIndexModetrue
4417 \let\vx@toparse\vx@fb
4418 \else
4419 % \end{macrocode}
4420 % If the first separating sign is "*":
4421 % \begin{macrocode}
4422 \varindexIndexModefalse
4423 \expandafter
4424 \varindexSplitAtOutput\expandafter{\vx@toparse}\vx@fa\vx@toparse
4425 \fi
4426 \fi
4427 \vx@NextLoop}
4428
4429 % \end{macrocode}
4430 % \end{macro}
4431 %
4432 % \begin{macro}{\vx@FormatAll}
4433 % This macro is as "\vx@Format", just that everything is output:
4434 % \begin{macrocode}
4435 \def\vx@FormatAll{%
4436 \vx@FormatInit
4437 \expandafter
4438 \def\expandafter\vx@Count\expandafter{\the\varindexCount}\relax
4439 \varindexCount=0\relax
4440 \let\vx@NextFormatAllLoop\vx@FormatAllLoop
4441 \vx@FormatAllLoop
4442 \expandafter\varindexCount\expandafter=\vx@Count\relax
4443 \vx@Write}
4444
4445 % \end{macrocode}
4446 % \end{macro}
4447 % \begin{macro}{\vx@FormatAllLoop}\nocomment
4448 % \begin{macrocode}
4449 \def\vx@FormatAllLoop{%
4450 \advance\varindexCount by 1\relax
4451 \expandafter
4452 \varindexAddNumber\expandafter{\the\varindexCount}%
4453 \expandafter
4454 \ifnum\varindexLastEntry=\varindexCount
4455 \let\vx@NextFormatAllLoop\toolboxEmpty
4456 \fi
4457 \vx@NextFormatAllLoop}
4458
4459 % \end{macrocode}
4460 % \end{macro}
4461 % \begin{macro}{\vx@AppendwithCount}
4462 % The content of the variable "#2\the\varindexCount" is appended to "#1".
4463 % If both, "#1" and "#2\the\varindexCount" are nonempty, a space
4464 % is inserted between.
4465 % \begin{macrocode}
4466 \def\vx@AppendWithCount#1#2{%
4467 \toolboxLet\vx@tmp{#2\the\varindexCount}%
4468 \ifx#1\toolboxEmpty
4469 \let#1\vx@tmp
4470 \else
4471 \ifx\vx@tmp\toolboxEmpty\else\toolboxAppend#1{\toolboxSpace\vx@tmp}\fi
4472 \fi}
4473
4474 % \end{macrocode}
4475 % \end{macro}
4476 %
4477 % \begin{macro}{\vx@Format}
4478 % This is the macro which parses the format string "#1" for one single
4479 % output, either into index or into running text, depending on
4480 % "\ifvarindexIndexMode".
4481 %
4482 % \begin{macrocode}
4483 \def\vx@Format#1{%
4484 \vx@FormatInit
4485 \def\vx@fparse{#1}%
4486 \toolboxAppend\vx@fparse\vx@endparse
4487 \let\vx@FormatNextLoop\vx@FormatLoop
4488 \vx@FormatLoop
4489 \vx@Write
4490 }
4491
4492 % \end{macrocode}
4493 % \end{macro}
4494 % \begin{macro}{\vx@FormatInit}\nocomment
4495 % \begin{macrocode}
4496 \def\vx@FormatInit{%
4497 \let\vx@outputlist\toolboxEmpty
4498 \let\vx@textlist\toolboxEmpty
4499 \let\vx@sortlist\toolboxEmpty
4500 \let\vx@textlistBefore\toolboxEmpty
4501 \let\vx@sortlistBefore\toolboxEmpty
4502 \let\vx@tildeAText\varindexPlaceholderAText
4503 \let\vx@tildeASort\varindexPlaceholderASort
4504 \let\vx@tildeBText\varindexPlaceholderBText
4505 \let\vx@tildeBSort\varindexPlaceholderBSort
4506 \vx@tildeLeadtrue
4507 \ifvarindexCommaExpand
4508 \vx@commaTextLeadtrue
4509 \vx@commaSortLeadtrue
4510 \else
4511 \vx@commaTextLeadfalse
4512 \vx@commaSortLeadfalse
4513 \fi
4514 \varindexNoNextSpace
4515 }
4516
4517 % \end{macrocode}
4518 % \end{macro}
4519 % \begin{macro}{\vx@FormatLoop}
4520 % "\vx@FormatLoop" is the main loop which parses one (space-separated) entry
4521 % in the format string. The essential part here is the command
4522 % "\vx@HandleFormat" which is described below.
4523 % Essentially, "\vx@HandleFormat" is a list of subsequent calls to
4524 % "\vx@condexec"
4525 % \begin{macrocode}
4526 \def\vx@FormatLoop{%
4527 \vx@ffoundfalse
4528 \ifx\vx@fparse\vx@endparse
4529 \let\vx@FormatNextLoop\toolboxEmpty
4530 \else
4531 \vx@HandleFormat
4532 \ifvx@ffound\else
4533 \expandafter\vx@ErrorFormat\vx@fparse
4534 \let\vx@FormatNextLoop\toolboxEmpty
4535 \fi
4536 \fi
4537 \vx@FormatNextLoop
4538 }
4539
4540 % \end{macrocode}
4541 % \end{macro}
4542 % \begin{macro}{\vx@condexec}\nocomment
4543 % \begin{macrocode}
4544 \def\vx@condexec#1#2{\ifvx@ffound\else
4545 \expandafter #1\expandafter{\vx@fparse}\vx@fparseA\vx@fparseB
4546 \ifx\vx@fparseB\undefined\else
4547 \ifx\vx@fparseA\toolboxEmpty
4548 \let\vx@fparse\vx@fparseB
4549 \vx@ffoundtrue
4550 #2%
4551 \fi
4552 \fi
4553 \fi}
4554
4555 % \end{macrocode}
4556 % \end{macro}
4557 % \begin{macro}{\vx@HandleFormat}
4558 % "\vx@HandleFormat" is a list of commands of the form
4559 % "\vx@condexec"\bracemeta{splitcommand}\bracemeta{action}.
4560 % The idea is that if \meta{splitcommand} splits at the `current' token
4561 % of the format string then \meta{action} is executed.
4562 % For details, see "\vx@condexec".
4563 % The list "\vx@Handle" format is generated by "\varindexNewFormat".
4564 % \begin{macrocode}
4565 \let\vx@HandleFormat\toolboxEmpty
4566
4567 % \end{macrocode}
4568 % \end{macro}
4569 % \begin{macro}{\varindexNewFormat}
4570 % \begin{macrocode}
4571 \def\varindexNewFormat#1#2{%
4572 \toolboxSurround{\vx@condexec{#1}{#2}}{}\vx@HandleFormat}
4573
4574 % \end{macrocode}
4575 % \end{macro}
4576 % Now we initialize the default actions for the format string. However,
4577 % it is necessary to postpone the expansion of the "\vx@NewStdFormat" commands
4578 % (which call "\varindexNewFormat") until "\varindexOutExclam" etc.\ have
4579 % been initialized: In fact, the macro "\vx@NewStdFormat" uses "\csname"
4580 % and thus implicitly sets those variables to "\relax" which conflicts with
4581 % our initialization, because we define "\varindexOutExclam" and friends
4582 % only if they are "\undefined" (so that we do not override previous user
4583 % definitions of these macros).\par
4584 % \begin{macrocode}
4585 %% This macro is executed near the end of this file.
4586 \def\varindexAddOmit{% The name is a fake: The macro redefines this macro
4587 % \end{macrocode}
4588 % \begin{macro}{\varindexAddSpace}
4589 % "\varindexAddSpace" is made by a scheme from "\vx@NewStdFormat"
4590 % \begin{macrocode}
4591 \vx@NewStdFormat\varindexSplitAtSpace{Space}%
4592 % \end{macrocode}
4593 % \end{macro}
4594 % \begin{macro}{\varindexAddSpTok}
4595 % "\varindexAddSpTok" is made by a scheme from "\vx@NewStdFormat"
4596 % \begin{macrocode}
4597 \vx@NewStdFormat\varindexSplitAtSpaceTok{SpTok}%
4598 % \end{macrocode}
4599 % \end{macro}
4600 % \begin{macro}{\varindexAddOmit}
4601 % "\varindexAddOmit" is made by a scheme from "\vx@NewStdFormat"
4602 % \begin{macrocode}
4603 \vx@NewStdFormat\varindexSplitAtOmit{Omit}%
4604 % \end{macrocode}
4605 % \end{macro}
4606 % \begin{macrocode}
4607 \varindexNewFormat\varindexSplitSpace{}% Spaces in inner format are ignored
4608 \varindexNewFormat\varindexSplitAtDash\varindexAddDash
4609 \varindexNewFormat\varindexSplitAtTildeB\varindexAddTildeB
4610 \varindexNewFormat\varindexSplitAtTildeA\varindexAddTildeA
4611 \varindexNewFormat\varindexSplitAtComma\varindexAddComma
4612 \varindexNewFormat\varindexSplitAtExclam\varindexAddExclam
4613 \let\vx@NewStdFormat\undefined% We do not need this generic macro anymore
4614 }
4615
4616 % \end{macrocode}
4617 % \begin{macro}{\vx@NewStdFormat}
4618 % \begin{myquote}
4619 % "\vx@NewStdFormat\"\meta{splitcmd}\bracemeta{name}
4620 % \end{myquote}
4621 % calls
4622 % \begin{myquote}
4623 % "\varindexNewFormat\"\meta{splitcmd}"\varindexAdd"\meta{name}
4624 % \end{myquote}
4625 % and defines the corresponding macro "\varindexAdd"\meta{name} by
4626 % \begin{myquote}
4627 % "\def\varindexAdd"\meta{name}"{\varindexPreceeds"\meta{name}\\
4628 % " \varindexTokensOutExpand"\\
4629 % " \varindexOutText"\meta{name}\\
4630 % " \varindexOutSort"\meta{name}\\
4631 % " \varindexFollows"\meta{name}"}"
4632 % \end{myquote}
4633 % \begin{macrocode}
4634 \def\vx@NewStdFormat#1#2{%
4635 \expandafter
4636 \varindexNewFormat\expandafter#1\csname varindexAdd#2\endcsname
4637 \expandafter
4638 \def\expandafter\vx@tmp\expandafter{%
4639 \csname varindexPreceeds#2\expandafter\endcsname
4640 \expandafter
4641 \varindexTokensOutExpand
4642 \csname varindexOutText#2\expandafter\endcsname
4643 \csname varindexOutSort#2\expandafter\endcsname
4644 \csname varindexFollows#2\endcsname}
4645 \expandafter\let\csname varindexAdd#2\endcsname\vx@tmp}
4646
4647 % \end{macrocode}
4648 % \end{macro}
4649 % \begin{macro}{\varindexAddNumber}\nocomment
4650 % \begin{macrocode}
4651 \def\varindexAddNumber#1{%
4652 \ifnum\varindexCount<#1%
4653 \expandafter\vx@ErrorNumber\expandafter{\the\varindexCount}{#1}%
4654 \fi
4655 \ifvarindexIndexMode
4656 \toolboxLet\vx@adda{varindexEntry#1}%
4657 \toolboxLet\vx@addb{varindexSort#1}%
4658 \else
4659 \toolboxLet\vx@adda{varindexPlain#1}%
4660 \fi
4661 \vx@Addit\varindexSpaceTexttrue\varindexSpaceSorttrue}
4662
4663 % \end{macrocode}
4664 % \end{macro}
4665 % \begin{macro}{\varindexAddDash}
4666 % \begin{macrocode}
4667 \def\varindexAddDash{%
4668 \varindexPreceedsDash
4669 \ifx\vx@sortlist\toolboxEmpty
4670 \varindexTokensOutExpand\varindexOutTextDash\varindexOutSortDashBeg
4671 \else
4672 \varindexTokensOutExpand\varindexOutTextDash\varindexOutSortDash
4673 \fi
4674 \varindexFollowsDash}
4675
4676 % \end{macrocode}
4677 % \end{macro}
4678 % \begin{macro}{\varindexAddComma}\nocomment
4679 % \begin{macrocode}
4680 \def\varindexAddComma{%
4681 \ifvarindexCommaLeads
4682 \vx@tildeLeadtrue
4683 \fi
4684 \ifvarindexCommaExpand
4685 \let\vx@tildeAText\vx@textlist
4686 \let\vx@tildeBText\vx@textlist
4687 \ifvarindexIndexMode
4688 \let\vx@tildeASort\vx@sortlist
4689 \let\vx@tildeBSort\vx@sortlist
4690 \fi
4691 \fi
4692 \varindexPreceedsComma
4693 \varindexTokensOutExpand\varindexOutTextComma\varindexOutSortComma
4694 \vx@flushToBefore
4695 \ifvarindexCommaExpand
4696 \vx@commaTextLeadtrue\vx@commaSortLeadtrue
4697 \fi
4698 \varindexFollowsComma}
4699
4700 % \end{macrocode}
4701 % \end{macro}
4702 % \begin{macro}{\vx@flushToBefore}\nocomment
4703 % \begin{macrocode}
4704 \def\vx@flushToBefore{%
4705 \ifvarindexCommaExpand
4706 \toolboxAppend\vx@textlistBefore\vx@textlist
4707 \let\vx@textlist\toolboxEmpty
4708 \ifvarindexIndexMode
4709 \toolboxAppend\vx@sortlistBefore\vx@sortlist
4710 \let\vx@sortlist\toolboxEmpty
4711 \fi
4712 \fi}
4713
4714 % \end{macrocode}
4715 % \end{macro}
4716 % \begin{macro}{\varindexAddTildeA}\nocomment
4717 % \begin{macrocode}
4718 \def\varindexAddTildeA{%
4719 \ifvarindexUsePlaceholderA
4720 \ifvx@tildeLead
4721 \ifvarindexLeadingPlaceholderA
4722 \vx@AddingTildeA
4723 \fi
4724 \else
4725 \vx@AddingTildeA
4726 \fi
4727 \fi}
4728 % \end{macrocode}
4729 % \end{macro}
4730 % \begin{macro}{\vx@AddingTildeA}\nocomment
4731 % \begin{macrocode}
4732 \def\vx@AddingTildeA{%
4733 \ifvarindexPreviousAText
4734 \let\vx@adda\vx@tildeAText
4735 \else
4736 \let\vx@adda\varindexPlaceholderAText
4737 \fi
4738 \ifvarindexPreviousASort
4739 \let\vx@addb\vx@tildeASort
4740 \else
4741 \let\vx@addb\varindexPlaceholderASort
4742 \fi
4743 \vx@Addit\varindexSpaceTexttrue\varindexSpaceSorttrue}
4744
4745 % \end{macrocode}
4746 % \end{macro}
4747 % \begin{macro}{\vx@AddTildeB}\nocomment
4748 % \begin{macrocode}
4749 \def\varindexAddTildeB{%
4750 \ifvarindexUsePlaceholderB
4751 \ifvx@tildeLead
4752 \ifvarindexLeadingPlaceholderB
4753 \vx@AddingTildeB
4754 \fi
4755 \else
4756 \vx@AddingTildeB
4757 \fi
4758 \fi}
4759 % \end{macrocode}
4760 % \end{macro}
4761 % \begin{macro}{\vx@AddingTildeB}\nocomment
4762 % \begin{macrocode}
4763 \def\vx@AddingTildeB{%
4764 \ifvarindexPreviousBText
4765 \let\vx@adda\vx@tildeBText
4766 \else
4767 \let\vx@adda\varindexPlaceholderBText
4768 \fi
4769 \ifvarindexPreviousBSort
4770 \let\vx@addb\vx@tildeBSort
4771 \else
4772 \let\vx@addb\varindexPlaceholderBSort
4773 \fi
4774 \vx@Addit\varindexSpaceTexttrue\varindexSpaceSorttrue}
4775
4776 % \end{macrocode}
4777 % \end{macro}
4778 % \begin{macro}{\varindexNextSpace}\nocomment
4779 % \begin{macrocode}
4780 \def\varindexNextSpace{\varindexSpaceTexttrue\varindexSpaceSorttrue}
4781 % \end{macrocode}
4782 % \end{macro}
4783 % \begin{macro}{\varindexNoNextSpace}\nocomment
4784 % \begin{macrocode}
4785 \def\varindexNoNextSpace{\varindexSpaceTextfalse\varindexSpaceSortfalse}
4786
4787 % \end{macrocode}
4788 % \end{macro}
4789 % \begin{macro}{\varindexTokensOut}\nocomment
4790 % \begin{macrocode}
4791 \long\def\varindexTokensOut#1#2{\def\vx@adda{#1}\def\vx@addb{#2}\vx@Addit{}{}}
4792
4793 % \end{macrocode}
4794 % \end{macro}
4795 % \begin{macro}{\varindexTokensOutExpand}\nocomment
4796 % \begin{macrocode}
4797 \def\varindexTokensOutExpand#1#2{\let\vx@adda#1\let\vx@addb#2\vx@Addit{}{}}
4798
4799 % \end{macrocode}
4800 % \end{macro}
4801 % \begin{macro}{\vx@Addit}
4802 % \begin{myquote}
4803 % "\vx@Addit"\bracemeta{command A}\bracemeta{command B}
4804 % \end{myquote}
4805 % Does the following if "\vx@adda"/"\vx@addb" is nonempty:
4806 % \begin{myquote}
4807 % Add (space +) "\vx@adda"/"\vx@addb" to "\vx@textlist"/"\vx@sortlist"\\
4808 % (Shift space to "\[email protected]" if "\[email protected]" is true).\\
4809 % "\vx@tildeLeadfalse" (only if "\vx@adda" is nonempty)\\
4810 % "\varindexSpace...false"\\
4811 % "\[email protected]"\\
4812 % Execute \meta{command A/B}
4813 % \end{myquote}
4814 % \begin{macrocode}
4815 \def\vx@Addit#1#2{%
4816 \ifx\vx@adda\toolboxEmpty\else
4817 \vx@tildeLeadfalse
4818 \ifvarindexSpaceText
4819 \varindexSpaceTextfalse
4820 \ifvx@commaTextLead
4821 \toolboxAppend\vx@textlistBefore\toolboxSpace
4822 \let\vx@textlist\vx@adda
4823 \else
4824 \toolboxAppend\vx@textlist{\toolboxSpace\vx@adda}%
4825 \fi
4826 \else
4827 \toolboxAppend\vx@textlist\vx@adda
4828 \fi
4829 \vx@commaTextLeadfalse
4830 #1%
4831 \fi
4832 \ifvarindexIndexMode
4833 \ifx\vx@addb\toolboxEmpty\else
4834 \ifvarindexSpaceSort
4835 \varindexSpaceSortfalse
4836 \ifvx@commaSortLead
4837 \toolboxAppend\vx@sortlistBefore\toolboxSpace
4838 \let\vx@sortlist\vx@addb
4839 \else
4840 \toolboxAppend\vx@sortlist{\toolboxSpace\vx@addb}%
4841 \fi
4842 \else
4843 \toolboxAppend\vx@sortlist\vx@addb
4844 \fi
4845 \vx@commaSortLeadfalse
4846 #2%
4847 \fi
4848 \fi}
4849
4850 % \end{macrocode}
4851 % \end{macro}
4852 % \begin{macro}{\varindexAddExclam}\nocomment
4853 % \begin{macrocode}
4854 \def\varindexAddExclam{%
4855 \ifvarindexIndexMode
4856 \vx@Flush
4857 \toolboxAppend\vx@outputlist\varindexOutExclam
4858 \else
4859 \errmessage{\string\varindex: %
4860 Subitem can only be used for index, not for running text}%
4861 \fi
4862 \varindexFollowsExclam
4863 }
4864
4865 % \end{macrocode}
4866 % \end{macro}
4867 % \begin{macro}{\vx@ErrorFormat}\nocomment
4868 % "\vx@ErrorFormat" outputs the format until the content of "\vx@endparse" is
4869 % reached.
4870 % \begin{macrocode}
4871 \expandafter
4872 \def\expandafter\vx@ErrorFormat\expandafter#\expandafter 1\vx@endparse
4873 {\errmessage{\string\varindex: Error in format `#1'}}
4874
4875 % \end{macrocode}
4876 % \end{macro}
4877 % \begin{macro}{\vx@ErrorNumber}\nocomment
4878 % \begin{macrocode}
4879 \def\vx@ErrorNumber#1#2{\errmessage{\string\varindex: %
4880 Entry `#2' does not exist (only #1 entries)}}
4881
4882 % \end{macrocode}
4883 % \end{macro}
4884 %
4885 % \begin{macro}{\vx@Write}
4886 % The main output macro (either into "\index" or into running text):
4887 %
4888 % \begin{macrocode}
4889 \def\vx@Write{%
4890 \vx@Flush
4891 \ifvarindexIndexMode
4892 \toolboxAppend\vx@outputlist\varindexAppend
4893 \vx@MakeHarmless\vx@outputlist
4894 \expandafter
4895 \varindexIndex\expandafter{\vx@outputlist}%
4896 \else
4897 \expandafter
4898 \varindexStyle\expandafter{\vx@outputlist}%
4899 \fi}
4900
4901 % \end{macrocode}
4902 % \end{macro}
4903 % \begin{macro}{\vx@Flush}
4904 % Put the text buffered in "\vx@textlistBefore\vx@textlist" and
4905 % "\vx@sortlistBefore\vx@sortlist" to "\vx@outputlist" in the way appropriate
4906 % fot the output, and delete the buffers.
4907 % Moreover, prepare "\vx@tilde?Text" and friends correspondingly.
4908 %
4909 % \begin{macrocode}
4910 \def\vx@Flush{%
4911 \vx@tildeLeadtrue
4912 \vx@commaTextLeadtrue
4913 \vx@commaSortLeadtrue
4914 \let\vx@tildeAText\vx@textlist
4915 \let\vx@tildeBText\vx@textlist
4916 \ifvarindexIndexMode
4917 \let\vx@tildeASort\vx@sortlist
4918 \let\vx@tildeBSort\vx@sortlist
4919 \toolboxDef\vx@textlist{\vx@textlistBefore\vx@textlist}%
4920 \toolboxDef\vx@sortlist{\vx@sortlistBefore\vx@sortlist}%
4921 \ifx\vx@textlist\vx@sortlist
4922 \toolboxAppend\vx@outputlist\vx@textlist
4923 \else
4924 \toolboxAppend\vx@outputlist{\vx@sortlist\vx@otherat\vx@textlist}%
4925 \fi
4926 \let\vx@sortlistBefore\toolboxEmpty
4927 \let\vx@sortlist\toolboxEmpty
4928 \else
4929 \toolboxAppend\vx@outputlist{\vx@textlistBefore\vx@textlist}%
4930 \fi
4931 \let\vx@textlistBefore\toolboxEmpty
4932 \let\vx@textlist\toolboxEmpty}
4933
4934 % \end{macrocode}
4935 % \end{macro}
4936 %
4937 % \begin{macro}{\vx@TextEntry}
4938 % "\vx@TextEntry"\bracemeta{\texttt{\#1}} defines
4939 % "\varindexEntry"/"Sort"/"Plain1-..."
4940 % with the values corresponding to entry "#1". Here, "1-..." is
4941 % "\the\varindexCount". If necessary, inner braces are eliminated
4942 %
4943 % \begin{macrocode}
4944 \def\vx@TextEntry#1{%
4945 \vx@SplitAtSort{#1}\vx@textEntryA\vx@textEntryB
4946 \expandafter\vx@SplitAtPlain\expandafter{\vx@textEntryA}%
4947 \vx@textEntryA\vx@textEntryC
4948 \vx@LetEliminated{varindexEntry}\vx@textEntryA
4949 \ifx\vx@textEntryB\undefined
4950 % \end{macrocode}
4951 % No sort entry:
4952 % \begin{macrocode}
4953 \vx@LetEliminated{varindexSort}\vx@textEntryA
4954 \ifx\vx@textEntryC\undefined
4955 \vx@LetEliminated{varindexPlain}\vx@textEntryA
4956 \else
4957 \vx@LetEliminated{varindexPlain}\vx@textEntryC
4958 \fi
4959 \else
4960 % \end{macrocode}
4961 % Sort entry:
4962 % \begin{macrocode}
4963 \ifx\vx@textEntryC\undefined
4964 \expandafter\vx@SplitAtPlain\expandafter{\vx@textEntryB}%
4965 \vx@textEntryB\vx@textEntryC
4966 \fi
4967 \vx@LetEliminated{varindexSort}\vx@textEntryB
4968 \ifx\vx@textEntryC\undefined
4969 \vx@LetEliminated{varindexPlain}\vx@textEntryA
4970 \else
4971 \vx@LetEliminated{varindexPlain}\vx@textEntryC
4972 \fi
4973 \fi
4974 }
4975 % \end{macrocode}
4976 % \end{macro}
4977 % \begin{macro}{\vx@LetEliminated}\nocomment
4978 % \begin{macrocode}
4979 \def\vx@LetEliminated#1#2{%
4980 \let\vx@tmp#2%
4981 \ifvarindexEliminateInnerBrace
4982 \toolboxDropBrace\vx@tmp
4983 \fi
4984 \toolboxWithNr{\the\varindexCount}\let{#1}\vx@tmp}
4985
4986 % \end{macrocode}
4987 % \end{macro}
4988 % \begin{macro}{\varindexMakeVarSplit}\nocomment
4989 % \begin{macrocode}
4990 \def\varindexMakeVarSplit#1#2#3{\varindexedef#1{#2}\expandafter
4991 \toolboxMakeSplit\expandafter{#1}{#3}}
4992 % \end{macrocode}
4993 % \end{macro}
4994 % \begin{macro}{\varindexMakeSplitExpand}\nocomment
4995 % \begin{macrocode}
4996 \def\varindexMakeSplitExpand#1#2{\varindexMakeVarSplit\vx@tmp{#1}{#2}}
4997
4998 % \end{macrocode}
4999 % \end{macro}
5000 % \begin{macro}{\varindexSetWordString}
5001 % \begin{macro}{\vx@SplitAtWord}\nocomment
5002 % \begin{macrocode}
5003 \def\varindexSetWordString#1{\def\vx@word{#1}%
5004 \toolboxMakeSplit{#1}{vx@SplitAtWord}}
5005 % \end{macrocode}
5006 % \end{macro}
5007 % \end{macro}
5008 % \begin{macro}{\varindexSetSortString}
5009 % \begin{macro}{\vx@SplitAtSort}\nocomment
5010 % \begin{macrocode}
5011 \def\varindexSetSortString#1{%
5012 \toolboxMakeSplit{#1}{vx@SplitAtSort}}
5013 % \end{macrocode}
5014 % \end{macro}
5015 % \end{macro}
5016 % \begin{macro}{\varindexSetPlainString}
5017 % \begin{macro}{\vx@SplitAtPlain}\nocomment
5018 % \begin{macrocode}
5019 \def\varindexSetPlainString#1{%
5020 \toolboxMakeSplit{#1}{vx@SplitAtPlain}}
5021
5022 % \end{macrocode}
5023 % \end{macro}
5024 % \end{macro}
5025 % \begin{macro}{\vx@tmp}
5026 % Temporarily, we define a generic command:
5027 % \begin{myquote}
5028 % "\vx@tmp"\bracemeta{name}
5029 % \end{myquote}
5030 % is (temporarily) a call which is equivalent to:
5031 % \begin{myquote}
5032 % "\def\varindexSet"\meta{name}"String#1{%"\\
5033 % " \varindexMakeVarSplit"\relax
5034 %"\varindex"\meta{name}"String{#1}{varindexSplitAt"\meta{name}"}}"
5035 % \end{myquote}
5036 % \begin{macrocode}
5037 \def\vx@tmp#1{%
5038 \expandafter
5039 \def\expandafter\vx@adda\expandafter##\expandafter 1\expandafter{%
5040 \expandafter
5041 \varindexMakeVarSplit\csname varindex#1String\endcsname
5042 {##1}{varindexSplitAt#1}}%
5043 \expandafter
5044 \let\csname varindexSet#1String\endcsname\vx@adda}
5045 % \end{macrocode}
5046 % \end{macro}
5047 % \begin{macro}{\varindexSetIndexString}
5048 % \begin{macro}{\varindexSplitAtIndex}\nocomment
5049 % \begin{macrocode}
5050 \vx@tmp{Index}
5051 % \end{macrocode}
5052 % \end{macro}
5053 % \end{macro}
5054 % \begin{macro}{\varindexSetOutputString}
5055 % \begin{macro}{\varindexSplitAtOutput}\nocomment
5056 % \begin{macrocode}
5057 \vx@tmp{Output}
5058 % \end{macrocode}
5059 % \end{macro}
5060 % \end{macro}
5061 % \begin{macro}{\varindexSetTildeAString}
5062 % \begin{macro}{\varindexSplitAtTildeA}\nocomment
5063 % \begin{macrocode}
5064 \vx@tmp{TildeA}
5065 % \end{macrocode}
5066 % \end{macro}
5067 % \end{macro}
5068 % \begin{macro}{\varindexSetTildeBString}
5069 % \begin{macro}{\varindexSplitAtTildeB}\nocomment
5070 % \begin{macrocode}
5071 \vx@tmp{TildeB}
5072 % \end{macrocode}
5073 % \end{macro}
5074 % \end{macro}
5075 % \begin{macro}{\varindexSetSpaceString}
5076 % \begin{macro}{\varindexSplitAtSpace}\nocomment
5077 % \begin{macrocode}
5078 \vx@tmp{Space}
5079 % \end{macrocode}
5080 % \end{macro}
5081 % \end{macro}
5082 % \begin{macro}{\varindexSetSpaceTokString}
5083 % \begin{macro}{\varindexSplitAtSpaceTok}\nocomment
5084 % \begin{macrocode}
5085 \vx@tmp{SpaceTok}
5086 % \end{macrocode}
5087 % \end{macro}
5088 % \end{macro}
5089 % \begin{macro}{\varindexSetOmitString}
5090 % \begin{macro}{\varindexSplitAtOmit}\nocomment
5091 % \begin{macrocode}
5092 \vx@tmp{Omit}
5093 % \end{macrocode}
5094 % \end{macro}
5095 % \end{macro}
5096 % \begin{macro}{\varindexSetCommaString}
5097 % \begin{macro}{\varindexSplitAtComma}\nocomment
5098 % \begin{macrocode}
5099 \vx@tmp{Comma}
5100 % \end{macrocode}
5101 % \end{macro}
5102 % \end{macro}
5103 % \begin{macro}{\varindexSetDashString}
5104 % \begin{macro}{\varindexSplitAtDash}\nocomment
5105 % \begin{macrocode}
5106 \vx@tmp{Dash}
5107 % \end{macrocode}
5108 % \end{macro}
5109 % \end{macro}
5110 % \begin{macro}{\varindexSetExclamString}
5111 % \begin{macro}{\varindexSplitAtExclam}\nocomment
5112 % \begin{macrocode}
5113 \vx@tmp{Exclam}
5114
5115 % \end{macrocode}
5116 % \end{macro}
5117 % \end{macro}
5118 % \begin{macro}{\varindexSetStringForNr}
5119 % \begin{macro}{\varindexSplitAtNr}\nocomment
5120 % \begin{macrocode}
5121 \def\varindexSetStringForNr#1#2{%
5122 \edef\vx@adda{#1}%
5123 \expandafter
5124 \vx@AddToHandleNrs\csname varindexSplitAtNr\vx@adda\endcsname
5125 % \end{macrocode}
5126 % It is important to define the instance only \emph{after} the call of
5127 % "\vx@AddToHandleNrs" (because this macro tests the existence).
5128 % \begin{macrocode}
5129 \expandafter
5130 \varindexMakeVarSplit\csname varindexNr\vx@adda String\endcsname
5131 {#2}{varindexSplitAtNr\vx@adda}}
5132
5133 % \end{macrocode}
5134 % \end{macro}
5135 % \end{macro}
5136 %
5137 % \begin{macro}{\vx@AddToHandleNrs}
5138 % "\vx@AddToHandleNrs{\vx@HandleNr1}"
5139 % tests whether "\vx@HandleNr1" is already defined:
5140 % If not (i.\,e.\ "\relax" because we use it with "\csname") the call
5141 % \begin{myquote}
5142 % "\varindexNewFormat\varindexSplitAtNr1{\varindexAddNumber"\relax
5143 %\bracemeta{content of \cmdcite{vx@adda}}"}"
5144 % \end{myquote}
5145 % is executed.
5146 % \begin{macrocode}
5147 \def\vx@AddToHandleNrs#1{%
5148 \ifx#1\relax
5149 \expandafter
5150 \varindexNewFormat\expandafter#1\expandafter{\expandafter
5151 \varindexAddNumber\expandafter{\vx@adda}}%
5152 \fi}
5153
5154 % \end{macrocode}
5155 % \end{macro}
5156 %
5157 % \begin{macro}{\varindexedef}
5158 % This macro is described in the main documentation.
5159 % \begin{macrocode}
5160 \def\varindexedef#1#2{%
5161 \let\vx@tildemerk~%
5162 \let~\vx@nicetilde
5163 \edef#1{#2}%
5164 \let~\vx@tildemerk}
5165
5166 % \end{macrocode}
5167 % \end{macro}
5168 %
5169 % \begin{macro}{\varindexDoConvert}\nocomment
5170 % \begin{macrocode}
5171 \def\varindexDoConvert{\let\vx@MakeHarmless\toolboxMakeHarmless}
5172
5173 % \end{macrocode}
5174 % \end{macro}
5175 % \begin{macro}{\varindexNoConvert}\nocomment
5176 % \begin{macrocode}
5177 \def\varindexNoConvert{\def\vx@MakeHarmless##1{}}
5178
5179 % \end{macrocode}
5180 % \end{macro}
5181 %
5182 %
5183 % \par\hrule\par\null\par
5184 % Finally, some definitions which require catcode-trickery:
5185 %
5186 %
5187 % \begin{macro}{\vx@nicetilde}
5188 % "\vx@nicetilde" expands to a tilde with a nonactive catcode.
5189 %
5190 % \begin{macrocode}
5191 \def\vx@tmp{\catcode`\~=13\relax}
5192 \catcode`\~=11\relax\def\vx@nicetilde{~}\vx@tmp
5193
5194 % \end{macrocode}
5195 % \end{macro}
5196 % \begin{macro}{\vx@spaceothertok}
5197 % \begin{macro}{\vx@MakeSpaceOther}\nocomment
5198 % \begin{macrocode}
5199 \def\vx@MakeSpaceOther{\catcode`\ =13\relax}
5200 % \end{macrocode}
5201 % \end{macro}
5202 % \begin{macro}{\vx@MakeSpaceSpace}\nocomment
5203 % \begin{macrocode}
5204 \def\vx@MakeSpaceSpace{\catcode`\ =10\relax}
5205 \vx@MakeSpaceOther%<- This % is important
5206 \let\vx@spaceothertok= %<- This ` %' is important
5207 \vx@MakeSpaceSpace
5208
5209 % \end{macrocode}
5210 % \end{macro}
5211 % \end{macro}
5212 % \begin{macro}{\vx@otherat}
5213 % "\def\vx@otherat{@}" is a bad idea, since then
5214 % "@" has the wrong catcode. So we use a temporary macro to define it:
5215 % We misuse the name "\varindexArgumentSpace" to this purpose.
5216 % Of course, we must redefine the latter afterwards.
5217 % \begin{macrocode}
5218 \def\varindexArgumentSpace#1{\def\vx@otherat{#1}}
5219 \ifx\makeatother\undefined\catcode`\@=12\relax\else\makeatother\fi
5220 \varindexArgumentSpace{@}
5221
5222 % \end{macrocode}
5223 % \end{macro}
5224 %
5225 % Initialize default values (you should have the `usual' catcodes here.
5226 % In particular, "\makeatother" must be called before if `"@"'
5227 % is used as argument).
5228 % \begin{macro}{\varindexArgumentSpace}\nocomment
5229 % \begin{macrocode}
5230 \let\varindexArgumentSpace\varindexSkipDefault
5231
5232 % \end{macrocode}
5233 % \end{macro}
5234 % \begin{macro}{\varindexIndex}
5235 % We use "\def" for "\varindexIndex" so that a redefinition of "\index" also
5236 % redefines our command.
5237 % \begin{macrocode}
5238 \toolboxIf\undefined\def\varindexIndex{\index}
5239
5240 % \end{macrocode}
5241 % \end{macro}
5242 % \begin{macro}{\vx@MakeHarmless}\nocomment
5243 % \begin{macrocode}
5244 \varindexDoConvert
5245
5246 % \end{macrocode}
5247 % \end{macro}
5248 % \begin{macrocode}
5249 \toolboxIf\undefined\def\varindexOutExclam{!}
5250 \toolboxIf\undefined\let\varindexFollowsExclam\varindexNoNextSpace
5251 \toolboxIf\undefined\def\varindexOutTextComma{,}
5252 \toolboxIf\undefined\def\varindexOutSortComma{,}
5253 \toolboxIf\undefined\let\varindexFollowsComma\varindexNextSpace
5254 \toolboxIf\undefined\let\varindexPreceedsComma\varindexNoNextSpace
5255 \toolboxIf\undefined\def\varindexOutTextSpace{ }
5256 \toolboxIf\undefined\def\varindexOutSortSpace{ }
5257 \toolboxIf\undefined\let\varindexFollowsSpace\toolboxEmpty
5258 \toolboxIf\undefined\let\varindexPreceedsSpace\varindexNoNextSpace
5259 \toolboxIf\undefined\def\varindexOutTextSpTok{\space}
5260 \toolboxIf\undefined\def\varindexOutSortSpTok{ }
5261 \toolboxIf\undefined\let\varindexFollowsSpTok\toolboxEmpty
5262 \toolboxIf\undefined\let\varindexPreceedsSpTok\varindexNoNextSpace
5263 \toolboxIf\undefined\def\varindexOutTextDash{-}
5264 \toolboxIf\undefined\def\varindexOutSortDash{-}
5265 \toolboxIf\undefined\let\varindexOutSortDashBeg\toolboxEmpty
5266 \toolboxIf\undefined\let\varindexFollowsDash\toolboxEmpty
5267 \toolboxIf\undefined\let\varindexPreceedsDash\varindexNoNextSpace
5268 \toolboxIf\undefined\let\varindexOutTextOmit\toolboxEmpty
5269 \toolboxIf\undefined\let\varindexOutSortOmit\toolboxEmpty
5270 \toolboxIf\undefined\let\varindexFollowsOmit\toolboxEmpty
5271 \toolboxIf\undefined\let\varindexPreceedsOmit\varindexNoNextSpace
5272 % \end{macrocode}
5273 % For the following macro, see the remarks in the definition of
5274 % the fake name "\varindexAddOmit" (after definition of "\varindexNewFormat")
5275 % \begin{macrocode}
5276 %% It is important that the following is after all \toolboxIf\undefined...
5277 \varindexAddOmit% Execute the fake macro and redefine \varindexAddOmit
5278
5279 % \end{macrocode}
5280 %
5281 % \begin{macro}{\varindexSplitSpace}\nocomment
5282 % \begin{macrocode}
5283 \toolboxMakeSplit{ }{varindexSplitSpace}
5284
5285 % \end{macrocode}
5286 % \end{macro}
5287 %
5288 % \begin{macrocode}
5289 \varindexSetWordString{ }
5290 \varindexSetSortString{@}
5291 \varindexSetPlainString{!}
5292
5293 \varindexSetIndexString{ }
5294 \varindexSetOutputString{*}
5295
5296 \varindexSetTildeAString{~}
5297 \varindexSetTildeBString{=}
5298 \varindexSetSpaceString{_}
5299 \varindexSetSpaceTokString{s}
5300 \varindexSetOmitString{.}
5301 \varindexSetCommaString{,}
5302 \varindexSetDashString{-}
5303 \varindexSetExclamString{!}
5304 \varindexSetStringForNr{10}{0}
5305 \varindexSetStringForNr 9{9}
5306 \varindexSetStringForNr 8{8}
5307 \varindexSetStringForNr 7{7}
5308 \varindexSetStringForNr 6{6}
5309 \varindexSetStringForNr 5{5}
5310 \varindexSetStringForNr 4{4}
5311 \varindexSetStringForNr 3{3}
5312 \varindexSetStringForNr 2{2}
5313 \varindexSetStringForNr 1{1}
5314
5315 \ifx\makeatletter\undefined\catcode`\@=11\relax\else\makeatletter\fi
5316
5317 % \end{macrocode}
5318 % \iffalse
5319 %</package>
5320 % \fi
5321 % \Finale\PrintIndex
5322 %
5323 %
5324 %
5325 % \iffalse
5326 %<*metainfo>
5327 % \fi
5328 \iffalse -------------------------------------------------------------
5329 %
5330 % Just in case that for some reason the file `varindex.ins' got lost:
5331 % The content of this file is between the lines %<*insfile> and %</insfile>:
5332 %
5333 %\iffalse
5334 %</metainfo>
5335 %<*insfile>
5336 \def\batchfile{varindex.ins}
5337 \input docstrip.tex
5338 \keepsilent
5339 \nopreamble
5340 \generateFile{varindex.sty}{f}{\from{varindex.dtx}{package}}
5341 \generateFile{varindex.txt}{f}{\from{varindex.dtx}{asciidocu}}
5342 \generateFile{varindex.tex}{f}{\from{varindex.dtx}{driver}}
5343 %%\generateFile{varindex.ins.dup}{f}{\from{varindex.dtx}{insfile}}
5344
5345 \Msg{***************************************************************}
5346 \Msg{*}
5347 \Msg{* To finish the installation you have to move the}
5348 \Msg{* file 'varindex.sty' into a directory searched by TeX.}
5349 \Msg{*}
5350 \Msg{*}
5351 \Msg{* Run the file varindex.tex through LaTeX to produce the}
5352 \Msg{* documentation or read the ascii documentation in varindex.txt}
5353 \Msg{*}
5354 \Msg{*}
5355 \Msg{***************************************************************}
5356 \endbatchfile
5357 %</insfile>
5358 %<*metainfo>
5359 % \fi
5360 \fi
5361 % \iffalse
5362 %</metainfo>
5363 % \fi
5364 \endinput
5365
5366 %%% Local Variables:
5367 %%% mode: latex
5368 %%% TeX-master: "varindex.tex"
5369 %%% End: