Debian Codegraph @

texk/makeindexk/makeindex.1

raw ◀ ▶
1 Debian patch touch this file
•1 .if t .ds TX \fRT\\h'-0.10m'\\v'0.17v'E\\v'-0.17v'\\h'-0.06m'X\fP
2 .if n .ds TX TeX
•3 .\" LX definition must follow TX so LX can use TX
4 .if t .ds LX \fRL\\h'-0.36m'\\v'-0.15v'\s-2A\s0\\h'-0.15m'\\v'0.15v'\fP\*(TX
5 .if n .ds LX LaTeX
6 .ds Ts T\s-2RAN\s+2S\s-2CRIPT\s+2
7 .if t .ds Uc \fIU\\h'-0.12m'C\\v'0.27m'\\h'-.23m'S\\h'-0.11m'F\\v'-0.27m'\fP
8 .if n .ds Uc UCSF
9 .ds Et \\f(boE\\h'-0.1667m'\\v'-0.20v'T\\v'0.20v'\\h'-0.125m'T\\fP
•10 .TH MAKEINDEX 1 "12 April 2026" "TeX Live"
11 .\"=====================================================================
12 .SH NAME
13 makeindex \- a general purpose, formatter-independent index processor
14 .SH SYNOPSIS
15 .B makeindex
16 .RB [ \-c ]
17 .RB [ \-g ]
18 .RB [ \-i ]
19 .RB [ \-l ]
20 .RB [ \-o
21 .IR ind ]
22 .RB [ \-p
23 .IR num ]
24 .RB [ \-q ]
25 .RB [ \-r ]
26 .RB [ \-s
27 .IR sfile ]
28 .RB [ \-t
29 .IR log ]
30 .RB [ \-L ]
31 .RB [ \-T ]
32 .RI [ idx0
33 .I idx1
34 .IR idx2 .\|.\|.]
35 .\"=====================================================================
36 .SH DESCRIPTION
37 The program
38 .I makeindex
39 is a general purpose hierarchical index generator; it accepts one or
40 more input files (often produced by a text formatter such as \*(TX
41 .RI ( tex (1L))
42 or
43 .IR troff (1),
44 sorts the entries, and produces an output file which can be formatted.
45 The index can have up to three levels (0, 1, and 2) of subitem nesting.
46 The way in which words are flagged for indexing within the main document
47 is specific to the formatter used;
48 .I makeindex
49 does
50 .I not
51 automate the process of selecting these words. As the output index
52 is hierarchical,
53 .I makeindex
54 can be considered complementary to the
55 .IR awk (1)-based
56 .IR make.index (1L)
57 system of Bentley and Kernighan, which is specific to
58 .IR troff (1),
59 generates non-hierarchical indices, and employs a much simpler syntax
60 for indicating index entries. For illustration of use with
61 .I troff
62 and
63 .IR \*(TX ,
64 see the section \s-2EXAMPLES\s+2 below.
65 .LP
66 The formats of the input and output files are
67 specified in a style file; by default, input is assumed to be a
68 .I \&.idx
69 file, as generated by \*(LX.
70 .LP
71 Unless specified explicitly, the base name of the first input file
72 .RI ( idx0 )
73 is used to determine the names of other files. For each input file
74 name specified, a file of that name is sought. If this file is not
75 found and the file name has no extension, the extension
76 .I \&.idx
77 is appended. If no file with this name is found,
78 .I makeindex
79 aborts.
80 .LP
81 If exactly one input file was given and no explicit style file was
82 specified using
83 .BR \-s ,
84 .I makeindex
85 uses a file with the extension
86 .I \&.mst
87 as default style file (when present).
88 .LP
89 For important notes on how to select index keywords, see the document
90 by Lamport cited below. As an issue separate from selecting index
91 keywords, a systematic mechanism for placing index terms in a document
92 is suggested in
93 .IR "Index Preparation and Processing" ,
94 a paper cited below.
95 .\"=====================================================================
96 .SH OPTIONS
97 .TP 10
98 .B \-c
99 Compress intermediate blanks (ignoring leading and trailing blanks and
100 tabs). By default, blanks in the index key are retained.
101 .TP 10
102 .B \-g
103 Employ German word ordering in the index, in accord with rules set forth
104 in DIN 5007. By default,
105 .I makeindex
106 employs a word ordering in which precedence is: symbols, numbers,
107 uppercase letters, lowercase letters. The sequence in German word
108 ordering is: symbols, lowercase letters, uppercase letters, numbers.
109 Additionally, this option enables
110 .I makeindex
111 to recognize the German \*(TX-commands {"a, "o, "u and "s} as {ae, oe,
112 ue and ss} during the sorting of the entries. The quote character
113 must be redefined in a style file (for example, redefine quote
114 as '+'). If the quote character is not redefined,
115 .I makeindex
116 will produce an error message and abort.
117 .TP 10
118 .B \-i
119 Take input from
120 .IR stdin .
121 When this option is specified and
122 .B \-o
123 is not, output is written to
124 .IR stdout .
125 .TP 10
126 .B \-l
127 Letter ordering; by default, word ordering is used (see
128 the \s-2ORDERING\s+2 section).
129 .TP 10
130 .BI \-o " ind"
131 Employ
132 .I ind
133 as the output index file. By default, the file name
134 is created by appending the extension
135 .I .ind
136 to the base name of
137 the first input file
138 .RI ( idx0 ).
139 .TP 10
140 .BI \-p " num"
141 Set the starting page number of the output index file to be
142 .I num
143 (useful when the index file is to be formatted separately). The
144 argument
145 .I num
146 may be numerical or one of the following:
147 .RS
148 .TP 10
149 .I any
150 The starting page is the last source page number plus 1.
151 .TP
152 .I odd
153 The starting page is the first odd page following the last source page
154 number.
155 .TP
156 .I even
157 The starting page is the first even page following the last source
158 page number.
159 .RE
160 .IP
161 The last source page is obtained by searching backward in the log file
162 for the first instance of a number included within paired square
163 brackets
164 .RB ( [ .\|.\|. ] ).
165 If a page number is missing or the log file is not found, no attempt
166 will be made to set the starting page number. The source log file
167 name is determined by appending the extension
168 .I \&.log
169 to the base name of the first input file
170 .RI ( idx0 ).
171 .TP 10
172 .B \-q
173 Quiet mode; send no messages to
174 .IR stderr .
175 By default, progress
176 and error messages are sent to
177 .I stderr
178 as well as to the
179 transcript file.
180 .TP 10
181 .B \-r
182 Disable implicit page range formation; page ranges must be created by
183 using explicit range operators; see \s-2SPECIAL EFFECTS\s+2 below. By
184 default, three or more successive pages are automatically abbreviated
185 as a range (e.g. 1\(em5).
186 .TP 10
187 .BI \-s " sty"
188 Employ
189 .I sty
190 as the style file (no default). The environment
191 variable \s-2INDEXSTYLE\s+2 defines the path where the style file
192 should be found.
193 .TP 10
194 .BI \-t " log"
195 Employ
196 .I log
197 as the transcript file. By default, the file name is
198 created by appending the extension
199 .I .ilg
200 to the base name of the
201 first input file
202 .RI ( idx0 ).
203 .TP 10
204 .BR \-L
205 sort based on locale settings. Not available on all systems.
206 .TP 10
207 .BR \-T
208 special support for Thai documents. Not available on all systems.
209 .\"=====================================================================
210 .SH "STYLE FILE"
211 The style file informs
212 .I makeindex
213 about the format of the
214 .I \&.idx
215 input files and the intended format of the final output file; examples
216 appear below. This file can reside anywhere in the path defined by
217 the environment variable \s-2INDEXSTYLE\s+2. The style file contains
218 a list of
219 .RI < specifier , " attribute" >
220 pairs. There are two types of specifiers: input and output.
221 Pairs do not have to appear in any particular order.
222 A line begun by `%' is a comment. In the following list of
223 specifiers and arguments, <string> is an arbitrary string delimited by
224 double quotes (".\|.\|."), <char> is a single letter embraced by
225 single quotes ('.\|.\|.'), and <number> is a nonnegative integer.
226 The maximum length of a <string> is 2048. A literal backslash or
227 quote must be escaped (by a backslash). Anything not specified in the
228 style file will be assigned a default value, which is shown at the
229 head of the rightmost column.
230 .\"----------------------------------------------------------------------
231 .SS "INPUT STYLE SPECIFIERS"
232 .TP 25
233 .BR actual " <char>"
234 \'@\'
235 .RS
236 Symbol indicating that the next entry is to appear in the output file.
237 .RE
238 .TP
239 .BR arg_close " <char>"
240 \'}\'
241 .RS
242 Closing delimiter for the index entry argument.
243 .RE
244 .TP
245 .BR arg_open " <char>"
246 \'{\'
247 .RS
248 Opening delimiter for the index entry argument.
249 .RE
250 .TP
251 .BR encap " <char>"
252 \'|\'
253 .RS
254 Symbol indicating that the rest of the argument list
255 is to be used as the encapsulating command for the page number.
256 .RE
257 .TP
258 .BR escape " <char>"
259 \'\\\\\'
260 .RS
261 Symbol which escapes the following letter, unless its preceding letter
262 is
263 .BR escape .
264 Note:
265 .B quote
266 is used to escape the letter which immediately follows it, but if it is
267 preceded by
268 .BR escape ,
269 it is treated as a ordinary character. These two symbols
270 .I must
271 be distinct.
272 .RE
273 .TP
274 .BR keyword " <string>"
275 "\\\\indexentry"
276 .RS
277 Command which tells
278 .I makeindex
279 that its argument is an index entry.
280 .RE
281 .TP
282 .BR level " <char>"
283 \'!\'
284 .RS
285 Delimiter denoting a new level of subitem.
286 .RE
287 .TP
288 .BR page_compositor " <string>"
289 "-"
290 .RS
291 Delimiter separating parts of a composite page number (see
292 \s-2SPECIAL EFFECTS\s+2 below).
293 .RE
294 .TP
295 .BR quote " <char>"
296 \'"\'
297 .RS
298 Note:
299 .B quote
300 is used to escape the letter which immediately follows it, but if it is
301 preceded by
302 .BR escape ,
303 it is treated as a ordinary character. These two symbols
304 .I must
305 be distinct.
306 .RE
307 .TP
308 .BR range_close " <char>"
309 \')\'
310 .RS
311 Closing delimiter indicating the end of an explicit page range.
312 .RE
313 .TP
314 .BR range_open " <char>"
315 \'(\'
316 .RS
317 Opening delimiter indicating the beginning of an explicit page range.
318 .RE
319 .\"---------------------------------------------------------------------
320 .SS "OUTPUT STYLE SPECIFIERS"
321 .TP 25
322 .BR preamble " <string>"
323 "\\\\begin{theindex}\\n"
324 .RS
325 Preamble of output file.
326 .RE
327 .TP
328 .BR postamble " <string>"
329 "\\n\\n\\\\end{theindex}\\n"
330 .RS
331 Postamble of output file.
332 .RE
333 .TP
334 .BR setpage_prefix " <string>"
335 "\\n \\\\setcounter{page}{"
336 .RS
337 Prefix of command which sets the starting page number.
338 .RE
339 .TP
340 .BR setpage_suffix " <string>"
341 "}\\n"
342 .RS
343 Suffix of command which sets the starting page number.
344 .RE
345 .TP
346 .BR group_skip " <string>"
347 "\\n\\n \\\\indexspace\\n"
348 .RS
349 Vertical space to be inserted before a new group begins.
350 .RE
351 .TP
352 .BR headings_flag " <string>"
353 0
354 .RS
355 Flag indicating treatment of new group headers, which are inserted
356 when before a new group (symbols, numbers, and the 26 letters):
357 positive values cause an uppercase letter to be inserted between
358 prefix and suffix, and negative values cause a lowercase letter to be
359 inserted (default is 0, which produces no header).
360 .RE
361 .TP
362 .BR heading_prefix " <string>"
363 ""
364 .RS
365 Letter heading prefix to be inserted before a new letter begins.
366 .RE
367 .TP
368 .BR heading_suffix " <string>"
369 ""
370 .RS
371 Letter heading suffix to be inserted when a new letter begins.
372 .RE
373 .TP
374 .BR symhead_positive " <string>"
375 "Symbols"
376 .RS
377 Heading for symbols to be inserted if
378 .B headings_flag
379 is positive.
380 .RE
381 .TP
382 .BR symhead_negative " <string>"
383 "symbols"
384 .RS
385 Heading for symbols to be inserted if
386 .B headings_flag
387 is negative.
388 .RE
389 .TP
390 .BR numhead_positive " <string>"
391 "Numbers"
392 .RS
393 Heading for numbers to be inserted if
394 .B headings_flag
395 is positive.
396 .RE
397 .TP
398 .BR numhead_negative " <string>"
399 "numbers"
400 .RS
401 Heading for numbers to be inserted if
402 .B headings_flag
403 is negative.
404 .RE
405 .TP
406 .BR item_0 " <string>"
407 "\\n \\\\item "
408 .RS
409 Command to be inserted between two primary (level 0) items.
410 .RE
411 .TP
412 .BR item_1 " <string>"
413 "\\n \\\\subitem "
414 .RS
415 Command to be inserted between two secondary (level 1) items.
416 .RE
417 .TP
418 .BR item_2 " <string>"
419 "\\n \\\\subsubitem "
420 .RS
421 Command to be inserted between two level 2 items.
422 .RE
423 .TP
424 .B item_01 " <string>"
425 "\\n \\\\subitem "
426 .RS
427 Command to be inserted between a level 0 item and a level 1 item.
428 .RE
429 .TP
430 .BR item_x1 " <string>"
431 "\\n \\\\subitem "
432 .RS
433 Command to be inserted between a level 0 item and a level 1 item,
434 where the level 0 item does not have associated page numbers.
435 .RE
436 .TP
437 .BR item_12 " <string>"
438 "\\n \\\\subsubitem "
439 .RS
440 Command to be inserted between a level 1 item and a level 2 item.
441 .RE
442 .TP
443 .BR item_x2 " <string>"
444 "\\n \\\\subsubitem "
445 .RS
446 Command to be inserted between a level 1 item and a level 2 item,
447 where the level 1 item does not have associated page numbers.
448 .RE
449 .TP
450 .BR delim_0 " <string>"
451 ", "
452 .RS
453 Delimiter to be inserted between a level 0 key and its first page number
454 (default: comma followed by a blank).
455 .RE
456 .TP
457 .BR delim_1 " <string>"
458 ", "
459 .RS
460 Delimiter to be inserted between a level 1 key and its first page number
461 (default: comma followed by a blank).
462 .RE
463 .TP
464 .BR delim_2 " <string>"
465 ", "
466 .RS
467 Delimiter to be inserted between a level 2 key and its first page number
468 (default: comma followed by a blank).
469 .RE
470 .TP
471 .BR delim_n " <string>"
472 ", "
473 .RS
474 Delimiter to be inserted between two page numbers for the same key
475 in any level (default: comma followed by a blank).
476 .RE
477 .TP
478 .BR delim_r " <string>"
479 "--"
480 .RS
481 Delimiter to be inserted between the starting and ending page numbers
482 of a range.
483 .RE
484 .TP
485 .BR delim_t " <string>"
486 ""
487 .RS
488 Delimiter to be inserted at the end of a page list. This delimiter
489 has no effect on entries which have no associated page list.
490 .RE
491 .TP
492 .BR encap_prefix " <string>"
493 "\\\\"
494 .RS
495 First part of prefix for the command which encapsulates the page number.
496 .RE
497 .TP
498 .BR encap_infix " <string>"
499 "{"
500 .RS
501 Second part of prefix for the command which encapsulates the page
502 number.
503 .RE
504 .TP
505 .BR encap_suffix " <string>"
506 "}".
507 .RS
508 Suffix for the command which encapsulates the page number.
509 .RE
510 .TP
511 .BR page_precedence " <string>"
512 "rnaRA".
513 .RS
514 Page type precedence order. The default specifies: lowercase roman,
515 numeric/arabic, lowercase alphabetic, uppercase roman, uppercase alphabetic.
516 .RE
517 .TP
518 .BR line_max " <number>"
519 72
520 .RS
521 Maximum length of a line in the output, beyond which a line wraps.
522 .RE
523 .TP
524 .BR indent_space " <string>"
525 "\\t\\t"
526 .RS
527 Space to be inserted in front of a wrapped line (default: two tabs).
528 .RE
529 .TP
530 .BR indent_length " <number>"
531 16
532 .RS
533 Length of
534 .B indent_space
535 (default: 16, equivalent to 2 tabs).
536 .RE
537 .TP
538 .BR suffix_2p " <string>"
539 ""
540 .RS
541 Delimiter to replace the range delimiter and the second page number of
542 a two page list. When present, it overrides
543 .BR delim_r .
544 Example: "f.".
545 .RE
546 .TP
547 .BR suffix_3p " <string>"
548 ""
549 .RS
550 Delimiter to replace the range delimiter and the second page number of
551 a three page list. When present, it overrides
552 .B delim_r
553 and
554 .BR suffix_mp .
555 Example: "ff.".
556 .RE
557 .TP
558 .BR suffix_mp " <string>"
559 ""
560 .RS
561 Delimiter to replace the range delimiter and the second page number of
562 a multiple page list (three or more pages). When present, it overrides
563 .BR delim_r .
564 Example: "f.".
565 .RE
566 .\"=====================================================================
567 .SH EXAMPLES
568 .\"---------------------------------------------------------------------
569 .SS "\*(TX EXAMPLE"
570 The following example shows a style file called
571 .IR book.ist ,
572 which defines an index for a book which can be formatted independently
573 of the main source:
574 .LP
575 .RS
576 .nf
•577 \f(CWpreamble
578 "\\\\documentstyle[12pt]{book}
579 \\\\begin{document}
580 \\\\begin{theindex}
581 {\\\\small\\n"
582 postamble
583 "\\n\\n}
584 \\\\end{theindex}
585 \\\\end{document}\\n\fP"
586 .fi
587 .RE
588 .LP
589 Assuming that a particular book style requires the index (as well as any
590 chapters) to start from an odd page number, and that the input file is
591 named
592 .IR foo.idx ,
593 the following command line produces output in file
594 .IR footmp.ind :
595 .LP
596 .RS
•597 \f(CWmakeindex \-s book.ist \-o footmp.ind \-p odd foo\fP
598 .RE
599 .LP
600 Here a non-default output file name is used to avoid clobbering the
601 output for the book itself (presumably
602 .IR foo.dvi ,
603 which would have been the default name for the index output file!).
604 .\"---------------------------------------------------------------------
605 .SS "TROFF EXAMPLE"
606 A sample control file for creating an index, which we will assume
607 resides in the file
608 .IR sample.ist :
609 .LP
610 .RS
611 .nf
•612 \&\f(CWkeyword "IX:"
613 \&preamble
614 \&".\\\\\\" start of index output
615 \&\\".\\\\\\" enter two column mode
616 \&.2C
617 \&.SH
618 \&.ce
619 \&INDEX
620 \&.XS
621 \&INDEX
622 \&.XE
623 \&.R
624 \&.ps 9p
625 \&.vs 11p
626 \&.sp
627 \&.de I1
628 \&.ti 0.25i
629 \&..
630 \&.de I2
631 \&.ti 0.5i
632 \&.."
633 \&postamble "\\n.\\\\\\" end of index output"
634 \&setpage_prefix "\\n.nr % "
635 \&setpage_suffix ""
636 \&group_skip "\\n.sp 1.0"
637 \&headings_flag 1
638 \&heading_prefix "\\n.IS\\n"
639 \&heading_suffix "\\n.IE"
640 \&item_0 "\\n.br\\n"
641 \&item_1 "\\n.I1\\n"
642 \&item_2 "\\n.I2\\n"
643 \&item_01 "\\n.I1\\n"
644 \&item_x1 "\\n.I1\\n"
645 \&item_12 "\\n.I2\\n"
646 \&item_x2 "\\n.I2\\n"
647 \&delim_0 ", "
648 \&delim_1 ", "
649 \&delim_2 ", "
650 \&delim_r "-"
651 \&delim_t "."
652 \&encap_prefix "\\\\fB"
653 \&encap_infix ""
654 \&encap_suffix "\\\\fP"
655 \&indent_space ""
656 \&indent_length 0\fP
657 .fi
658 .RE
659 .LP
660 The local macro package may require modification, as in this example
661 of an extension to the
662 .B \-ms
663 macros (note that at some sites, this macro should
664 .I replace
665 a pre-existing macro of the same name):
666 .LP
667 .RS
668 .nf
•669 \f(CW\&.\" IX - index words to stderr
670 \&.de IX
671 \&.ie '\\\\n(.z'' .tm IX: \\\\$1 \\\\$2 \\\\$3 \\\\$4 \\\\$5 \\\\$6 \\\\$7 \\\\$8 \\\\$9 {\\\\n(PN}
672 \&.el \\\\!.IX \\\\$1 \\\\$2 \\\\$3 \\\\$4 \\\\$5 \\\\$6 \\\\$7 \\\\$8 \\\\$9 {\\\\n(PN}
673 \&..\fP
674 .fi
675 .RE
676 .LP
•677 (note that the string {\f(CW\\\\n(PN\fP} is separated from the rest of the
678 line by a tab.
679 If your local macro package does not contain this extension,
680 just include those lines at the beginning of your file.
681 Here is a simple
682 .IR troff (1)
683 input file, which we will assume is named
684 .IR sample.txt :
685 .LP
686 .RS
687 .nf
•688 \f(CW\&This is a sample file to test the \\fImakeindex\\fP(1L)
689 \&program, and see
690 \&.IX {indexing!programs!C language}
691 \&.IX {makeindex@\\fImakeindex\\fP(1L)}
692 \&.bp
693 \&.rs
694 \&.IX {Knuth}
695 \&.IX {typesetting!computer-aided}
696 \&how well it functions in the \\fItroff\\fP(1) environment.\fP
697 .fi
698 .RE
699 .LP
700 Note that index entries are indicated by the
701 .B .IX
702 macro, which
703 causes the following text to be written to
704 .I stdout
705 along with the
706 current page number.
707 .\"---------------------------------------------------------------------
708 .SS "CREATING THE INDEX FILE IN THE BOURNE SHELL"
709 To create an input file for
710 .IR makeindex ,
711 .B "in the Bourne shell"
712 environment, do the equivalent at your site of the command:
713 .LP
714 .nf
•715 \f(CWpsroff -ms -Tpsc -t sample.txt > /dev/null 2> sample.tmp\fP
716 .fi
717 .LP
718 Some sites will require
719 .I ditroff
720 instead of
721 .IR psroff .
722 To filter out any genuine error messages, invoke
723 .IR grep (1):
724 .LP
725 .RS
•726 \f(CWgrep '^IX: ' sample.tmp > sample.idx\fP
727 .RE
728 .\"---------------------------------------------------------------------
729 .SS "CREATING THE INDEX FILE USING \*(Uc ENHANCED TROFF/\*(Ts"
730 With \*(Uc Enhanced troff/\*(Ts, the
731 .B \-I
732 option of
733 .IR psroff (1L)
734 can produce both formatter output and an index file:
735 .LP
736 .RS
•737 \f(CWpsroff -ms -I sample.inp -Tpsc sample.txt\fP
738 .RE
739 .LP
740 If it is wished to suppress the formatter output:
741 .RS
742 .LP
743 .nf
•744 \f(CWpsroff -ms -I sample.inp -Tpsc -t sample.txt > /dev/null\fP
745 .fi
746 .RE
747 .\"---------------------------------------------------------------------
748 .SS "COMPLETING THE INDEX"
749 Any of the above procedures leaves the input for
750 .I makeindex
751 in
752 .IR sample.inp .
753 The next step is to invoke
754 .IR makeindex :
755 .LP
756 .RS
•757 \f(CWmakeindex -s sample.ist sample.idx\fP
758 .RE
759 .LP
760 This leaves
761 .IR troff (1)-ready
762 output in the file
763 .IR sample.ind .
764 .\"=====================================================================
765 .SH "ORDERING"
766 By default,
767 .I makeindex
768 assumes
769 .IR "word ordering" ;
770 if the
771 .B \-l
772 option is in effect,
773 .I "letter ordering"
774 is used. In word ordering, a blank precedes any letter in the
775 alphabet, whereas in letter ordering, it does not count at all. This
776 is illustrated by the following example:
777 .LP
778 .RS
779 \fIword order letter order\fP
780 .br
781 sea lion seal
782 .br
783 seal sea lion
784 .RE
785 .LP
786 Numbers are always sorted in numeric order. For instance,
787 .LP
788 .RS
789 9 (nine), 123
790 .br
791 10 (ten), see Derek, Bo
792 .RE
793 .LP
794 Letters are first sorted without regard to case; when words are
795 identical, the uppercase version precedes its lowercase counterpart.
796 .LP
797 A special symbol is defined here to be any character not appearing in
798 the union of digits and the English alphabetic characters. Patterns
799 starting with special symbols precede numbers, which precede patterns
800 starting with letters. As a special case, a string starting with a
801 digit but mixed with non-digits is considered to be a pattern starting
802 with a special character.
803 .\"=====================================================================
804 .SH "SPECIAL EFFECTS"
805 Entries such as
806 .LP
807 .RS
808 .nf
•809 \f(CW\\indexentry{alpha}{1}
810 \\indexentry{alpha!beta}{3}
811 \\indexentry{alpha!beta!gamma}{10}\fP
812 .fi
813 .RE
814 .LP
815 in the input file will be converted to
816 .LP
817 .RS
818 .nf
•819 \f(CW\\item alpha, 1
820 \0\0\0\\subitem beta, 3
821 \0\0\0\0\0\0\\subsubitem gamma, 10\fP
822 .fi
823 .RE
824 .LP
825 in the output index file.
826 Notice that the
827 .B level
828 symbol (`!') is used above to delimit
829 hierarchical levels.
830 .LP
831 It is possible to make an item appear in a designated form by
832 using the
833 .B actual
834 (`@') operator. For instance,
835 .LP
836 .RS
•837 \f(CW\\indexentry{alpha@{\\it alpha\\/}}{1}\fP
838 .RE
839 .LP
840 will become
841 .LP
842 .RS
•843 \f(CW\\item {\\it alpha\\/}, 1\fP
844 .RE
845 .LP
846 after processing. The pattern preceding `@' is
847 used as sort key, whereas the one following it is written to the
848 output file. Note that two appearances of the same key, one with and
849 one without the
850 .B actual
851 operator, are regarded as
852 .I distinct
853 entries.
854 .LP
855 The item, subitem, and subsubitem fields may have individual sort keys:
856 .LP
857 .RS
858 .nf
•859 \f(CW\\indexentry{aa@{\\it aa\\/}!bb@{\\it bb\\/}!cc@{\\it cc\\/}}{1}\fP
860 .fi
861 .RE
862 .LP
863 This will be converted to
864 .LP
865 .RS
866 .nf
•867 \f(CW\\item {\\it aa}, 1
868 \0\0\0\\subitem {\\it bb}, 3
869 \0\0\0\0\0\0\\subsubitem {\\it cc}, 10\fP
870 .fi
871 .RE
872 .LP
873 It is possible to encapsulate a page number with a designated
874 command using the
875 .B encap
876 (`|') operator:
877 .LP
878 .RS
•879 \f(CW\\indexentry{alpha|bold}{1}\fP
880 .RE
881 .LP
882 will be converted to
883 .LP
884 .RS
•885 \f(CW\\item alpha, \\bold{1}\fP
886 .RE
887 .LP
•888 where, with a suitable definition for \*(TX, \f(CW\\bold{n}\fP
889 will expand to \f(CW{\\bf n}\fP.
890 In this example, the three output attributes associated with page
891 encapsulation
892 .BR encap_prefix ,
893 .BR encap_infix ,
894 and
895 .BR encap_suffix ,
896 correspond to backslash, left brace, and right brace, respectively.
897 This mechanism allows page numbers to be set in different fonts. For
898 example, the page where the definition of a keyword appears can be in
899 one font, the location of a primary example can be in another font,
900 and other appearances in yet a third font.
901 .LP
902 The
903 .B encap
904 operator can also be used to create cross references in
905 the index:
906 .LP
907 .RS
•908 \f(CW\\indexentry{alpha|see{beta}}{1}\fP
909 .RE
910 .LP
911 will become
912 .LP
913 .RS
•914 \f(CW\\item alpha, \\see{beta}{1}\fP
915 .RE
916 .LP
917 in the output file, where
918 .LP
919 .RS
•920 \f(CW\\see{beta}{1}\fP
921 .RE
922 .LP
923 will expand to
924 .LP
925 .RS
•926 \f(CW{\\it see\\/} beta\fP
927 .RE
928 .LP
929 Note that in a cross reference like this the page number disappears.
930 .LP
931 A pair of
932 .B encap
933 concatenated with
934 .B range_open
935 (`|(') and
936 .B range_close
937 (`|)') creates an explicit page range:
938 .LP
939 .RS
940 .nf
•941 \f(CW\\indexentry{alpha|(}{1}
942 \\indexentry{alpha|)}{5}\fP
943 .fi
944 .RE
945 .LP
946 will become
947 .LP
948 .RS
•949 \f(CW\\item alpha, 1\(em5\fP
950 .RE
951 .LP
952 Intermediate pages indexed by the same key will be merged into the
953 range implicitly. This is especially useful when an entire section
954 about a particular subject is to be indexed, in which case only the
955 range opening and closing operators need to be inserted at the
956 beginning and end of the section. Explicit page range formation can
957 also include an extra command to set the page range in a designated
958 font:
959 .LP
960 .RS
961 .nf
•962 \f(CW\\indexentry{alpha|(bold}{1}
963 \\indexentry{alpha|)}{5}\fP
964 .fi
965 .RE
966 .LP
967 will become
968 .LP
969 .RS
•970 \f(CW\\item alpha, \\bold{1--5}\fP
971 .RE
972 .LP
973 Several potential problems are worth mentioning. First, entries like
974 .LP
975 .RS
976 .nf
•977 \f(CW\\indexentry{alpha|(}{1}
978 \\indexentry{alpha|bold}{3}
979 \\indexentry{alpha|)}{5}\fP
980 .fi
981 .RE
982 .LP
983 will be interpreted as
984 .LP
985 .RS
•986 \f(CW\\item alpha, \\bold{3}, 1--5\fP
987 .RE
988 .LP
989 but with a warning message in the transcript about encountering an
990 inconsistent page encapsulator.
991 An explicit range beginning in a Roman page number and ending
992 in Arabic is also considered an error. In this instance, (if
993 possible) the range is broken into two subranges, one in Roman and the
994 other in Arabic. For instance,
995 .LP
996 .RS
997 .nf
•998 \f(CW\\indexentry{alpha|(}{i}
999 \\indexentry{alpha}{iv}
1000 \\indexentry{alpha}{3}
1001 \\indexentry{alpha|)}{7}\fP
1002 .fi
1003 .RE
1004 .LP
1005 will be turned into
1006 .LP
1007 .RS
•1008 \f(CW\\item alpha, i--iv, 3--7\fP
1009 .RE
1010 .LP
1011 with a warning message in the transcript file complaining about an
1012 illegal range formation.
1013 .LP
1014 Every special symbol mentioned in this section may be
1015 escaped by the
1016 .B quote
1017 operator (`"'). Thus
1018 .LP
1019 .RS
•1020 \f(CW\\indexentry{alpha"@beta}{1}\fP
1021 .RE
1022 .LP
1023 will actually become
1024 .LP
1025 .RS
•1026 \f(CW\\item alpha@beta, 1\fP
1027 .RE
1028 .LP
1029 as a result of executing
1030 .IR makeindex .
1031 The quoting power of
1032 .B quote
1033 is eliminated if it is immediately preceded
1034 by
1035 .B escape
1036 (`\\'). For example,
1037 .LP
1038 .RS
•1039 \f(CW\\indexentry{f\\"ur}{1}\fP
1040 .RE
1041 .LP
1042 becomes
1043 .LP
1044 .RS
•1045 \f(CW\\item f\\"ur, 1\fP
1046 .RE
1047 .LP
1048 which represents an umlaut-accented `u' to the \*(TX family of
1049 processors.
1050 .LP
1051 A page number can be a composite of one or more fields
1052 separated by the delimiter bound to
1053 .B page_compositor
1054 (`-'), e.g., II-12 for page 12 of Chapter II. Page numbers may
1055 contain up to ten fields.
1056 .PP
1057 Since version 2.11 of
1058 .IR makeindex ,
1059 the
1060 .B quote
1061 operator may quote
1062 .I any
1063 character in the range 1 .\|.\|. 255. Character 0 is excluded because
1064 it is used internally in the
1065 .I makeindex
1066 source code as a string terminator. With this change, sort keys can
1067 be created for all eight-bit characters except 0. The sorting order
1068 is
1069 .RS
1070 .nf
1071
1072 punctuation characters (in ASCII order),
1073 digits,
1074 control characters (1 .\|.\|. 31),
1075 space (32),
1076 letters (ignoring case),
1077 characters 127 .\|.\|. 255.
1078
1079 .fi
1080 .RE
1081 Here is an example showing the indexing of all printable ASCII
1082 characters other than letters and digits, assuming the default
1083 \*(TX format. For convenience, the page number references are
1084 the corresponding ASCII ordinal values.
1085 .RS
1086 .nf
1087
•1088 \f(CW\\indexentry{" @" (space)}{32}
1089 \\indexentry{"!@"! (exclamation point)}{33}
1090 \\indexentry{""@"" (quotation mark)}{34}
1091 \\indexentry{"#@"\\# (sharp sign)}{35}
1092 \\indexentry{"$@"\\$ (dollar sign)}{36}
1093 \\indexentry{"%@"\\% (percent sign)}{37}
1094 \\indexentry{"&@"\\& (ampersand)}{38}
1095 \\indexentry{"<@"$<$ (left angle bracket)}{60}
1096 \\indexentry{"=@"= (equals)}{61}
1097 \\indexentry{">@"$>$ (right angle bracket)}{62}
1098 \\indexentry{"?@"? (query)}{63}
1099 \\indexentry{"@@"@ (at sign)}{64}
1100 \\indexentry{"[@"[ (left square bracket)}{91}
1101 \\indexentry{"\\@"\\verb=\\= (backslash)}{92}
1102 \\indexentry{"]@"] (right square bracket)}{93}
1103 \\indexentry{"^@"\\verb=^= (caret)}{94}
1104 \\indexentry{"_@"\\verb=_= (underscore)}{95}
1105 \\indexentry{"`@"\\verb=~= (grave accent)}{96}
1106 \\indexentry{"{@"\\"{ (left brace)}{123}
1107 \\indexentry{"|@"\\verb="|= (vertical bar)}{124}
1108 \\indexentry{"}@"\\"} (right brace)}{125}
1109 \\indexentry{"~@"\\verb=~= (tilde)}{126}\fP
1110
1111 .fi
1112 .RE
1113 Characters in the actual fields following the `@' character which
1114 have special significance to \*(TX must be represented as control
1115 sequences, or as math mode characters. Note particularly how the
1116 entries for the at sign, left and right braces, and the vertical
1117 bar, are coded. The index file output by
1118 .I makeindex
1119 for this example looks like this:
1120 .RS
1121 .nf
1122
•1123 \f(CW\\begin{theindex}
1124
1125 \\item ! (exclamation point), 33
1126 \\item " (quotation mark), 34
1127 \\item \\# (sharp sign), 35
1128 \\item \\$ (dollar sign), 36
1129 \\item \\% (percent sign), 37
1130 \\item \\& (ampersand), 38
1131 \\item $<$ (left angle bracket), 60
1132 \\item = (equals), 61
1133 \\item $>$ (right angle bracket), 62
1134 \\item ? (query), 63
1135 \\item @ (at sign), 64
1136 \\item [ (left square bracket), 91
1137 \\item \\verb=\\= (backslash), 92
1138 \\item ] (right square bracket), 93
1139 \\item \\verb=^= (caret), 94
1140 \\item \\verb=_= (underscore), 95
1141 \\item \\verb=~= (grave accent), 96
1142 \\item \\{ (left brace), 123
1143 \\item \\verb=|= (vertical bar), 124
1144 \\item \\} (right brace), 125
1145 \\item \\verb=~= (tilde), 126
1146
1147 \\indexspace
1148
1149 \\item (space), 32
1150
1151 \\end{theindex}\fP
1152 .fi
1153 .RE
1154 .\"=====================================================================
1155 .SH "FILES"
1156 .TP 2.2i
1157 .I makeindex
1158 executable file
1159 .TP
1160 .I $TEXMFMAIN/tex/plain/makeindex/idxmac.tex
1161 \*(TX macro file used by
1162 .I makeindex
1163 .TP
1164 .I $TEXMFMAIN/tex/latex/base/makeidx.sty
1165 \*(TX macro file used by
1166 .I makeindex
1167 .\"=====================================================================
1168 .SH "SEE ALSO"
1169 ditroff(1L),
1170 latex(1L),
1171 make.index (1L),
1172 qsort(3),
1173 tex(1L),
1174 troff(1L)
1175 .LP
1176 .IR "\*(Uc Enhanced troff/\*(Ts \(em An Overview" ,
1177 R. P. C. Rodgers and Conrad Huang, LSMB Technical Report 90-2,
1178 UCSF School of Pharmacy, San Francisco, 1990.
1179 .LP
1180 .IR "Index Preparation and Processing" ,
1181 Pehong Chen and Michael A. Harrison,
1182 .IR "Software: Practice and Experience" ,
1183 .BR 19 (9),
1184 897\(en915,
1185 September 1988.
1186 .LP
1187 .IR "Automating Index Preparation" ,
1188 Pehong Chen and Michael A. Harrison. Technical Report 87/347,
1189 Computer Science Division, University of California, Berkeley, 1987
1190 (a \*(LX document supplied with
1191 .IR makeindex ).
1192 .LP
1193 .IR "MakeIndex: An Index Processor for \*(LX" ,
1194 Leslie Lamport, February 1987 (a \*(LX document supplied
1195 with
1196 .IR makeindex ).
1197 .LP
1198 .IR "Tools for Printing Indices" ,
1199 Jon L. Bentley and Brian W. Kernighan,
1200 .IR "Electronic Publishing \(em Origination, Dissemination, and Design" ,
1201 1(1), 3\(en18, June 1988 (also available as: Computing Science
1202 Technical Report No. 128,
1203 AT&T Bell Laboratories, Murray Hill, NJ 07974, 1986).
1204 .\"=====================================================================
1205 .SH "AUTHOR"
1206 Pehong Chen, Chen & Harrison International Systems, Inc.
1207 Palo Alto, California, USA.
1208 .br
1209 Manual page extensively revised and corrected, and
1210 .IR troff (1)
1211 examples created by Rick P. C. Rodgers, UCSF School
1212 of Pharmacy.
1213 .\"=====================================================================
1214 .SH ACKNOWLEDGMENTS
1215 Leslie Lamport contributed significantly to the design of MakeIndex.
1216 Michael Harrison provided valuable comments and suggestions.
1217 Nelson Beebe improved on the portable version, and maintained the
1218 source distribution for the \*(TX Users Group for many years.
1219 Andreas Brosig contributed to the German word ordering.
1220 The modification to the
1221 .B \-ms
1222 macros was derived from a method proposed by Ravi Sethi of AT&T
1223 Bell Laboratories.
1224 The
1225 .I LOG
1226 and
1227 .I CONTRIB
1228 files in the
1229 .I makeindex
1230 source distribution record other contributions.
1231 .PP
1232 .I makeindex
1233 is currently maintained as part of the \*(TX Live
•1234 distribution (https://tug.org/texlive); please send bug reports to
1235 [email protected].