Previous: Typesetting an index, Up: Indexing


4.12.3 Customizing indexing

By default, MakeIndex outputs ‘, ’ after each term in the index. To change this, you can add the following to your MakeIndex style (.ist) file:

     delim_0 "\\afterindexterm "
     delim_1 "\\afterindexterm "
     delim_2 "\\afterindexterm "

Eplain makes \afterindexterm equivalent to \quad.

You can also change the keywords Eplain recognizes (see Modifying index entries):

\idxrangebeginword
`begin'
\idxrangeendword
`end'
\idxseecmdword
`see'
\idxseealsocmdword
`seealso'

You can also change the magic characters Eplain puts into the .idx file, in case you've changed them in the .ist file:

\idxsubentryseparator
!
\idxencapoperator
|
\idxbeginrangemark
(
\idxendrangemark
)

There is no macro for the actual (‘@’ by default) character, because it's impossible to make it expand properly.

You can change the (imaginary) page number that “see also” entries sort as by redefining \idxmaxpagenum. This is 99999 by default, which is one digit too many for old versions of MakeIndex.

The words output by Eplain for “see” and “see also” index entries are defined by \indexseeword and \indexseealsowords respectively. You can change the typeface used for these words by redefining \seevariant. And finally, the macros \indexsee and \indexseealso actually produce the “see ...” entries, so you can redefine them if you want something entirely different. If you do redefine them, make them take two parameters, the term being referenced and the \idxmaxpagenum (the latter should normally be ignored). See the example below.

Unfortunately, it is impossible to reliably control the commas produced by MakeIndex in front of “see ...” entries in the .ind file, either at MakeIndex level or at Eplain level. However, the sed script contained in trimsee distributed with Eplain in the util directory can be used to filter out these commas from the output of MakeIndex. For example, suppose you want the following style for your “see ...” entries:

     analysis,
       archetypal (see archetypal criticism)
     archetypal criticism,
       elements of, 75, 97, 114 (see also dichotomies)

You would need to redefine these macros in your TeX file:

     \def\indexsee#1#2{({\seevariant \indexseeword\/ }#1)}
     \def\indexseealso#1#2{({\seevariant \indexseealsowords\/ }#1)}

and then filter out the commas in front of the “see ...” entries by running the following command to produce the .ind file (assuming the name of the .idx file is myfile.idx and the trimsee script is placed in the current directory):

     prompt$ cat myfile.idx | makeindex | ./trimsee > myfile.ind

By default, trimsee uses default page list separators and default “see ...” command names. If you set up MakeIndex to use different page list separator or change the names of \indexsee and \indexseealso commands, it is possible to adjust the trimsee script through its command line options, which are the following:

-i is
Use is as a regular expression matching separator before “see ...” commands in the input (default: ‘, \+’).
-o os
Use os as a separator to replace is before “see ...” commands (default: ‘ ’).
-s see
Use see as a regular expression matching “see ...” commands (default: ‘\\indexsee’).
-h
--help
Print a usage message.
-v
--version
Print version.

trimsee reads input from the standard input, and directs its output to the standard output.