Debian Codegraph @

texmf-dist/doc/latex/robustindex/robustmanual.tex

raw
1 % robustmanual.tex 2018/04/11
2 \documentclass{article}
3 \usepackage{makeidx}
4 \usepackage[multind]{robustindex}[2018/04/15]
5 \usepackage[hyperindex=false,colorlinks=true]{hyperref}
6
7 \title {Manual of robustindex package}
8
9 \author{Wilberd van der Kallen\index{Wilberd}}
10 \date{April 2018}
11
12 \makeindex % obligatory with robustindex
13
14 \begin{document}
15
16 \maketitle
17
18 \section*{Introduction}
19
20 \index{discussion|(}
21
22 Amazingly often a third party changes the page numbers without rerunning
23 makeindex. We therefore want to have an index in which the page numbers automatically synchronise with the document.
24
25 The package \texttt{robustindex} achieves this
26 by invoking the \verb|\pageref| mechanism on automatically generated labels
27 of the form \verb|ind.2|, \verb|ind.4|, \dots.
28
29 Only after adding/deleting/modifying an \verb|\index{|\textit{entry}\verb|}|
30 command, or after changing the order of \verb|\index{|\textit{entry}\verb|}|
31 commands, does one have to rerun makeindex. (How would you change the order? By moving a block of text that contains
32 an \verb!\index! command.)
33
34 Make sure to run makeindex at least once after the last change to the \verb!\index! commands.
35 Keep an eye on the \TeX\ log file. It often contains a warning that you need to rerun \LaTeX\ or makeindex.
36
37 \section*{Standard usage}
38 Put
39 $$
40 \verb!\usepackage{makeidx}!
41 $$
42 $$
43 \verb!\usepackage{robustindex}!
44 $$
45 $$\verb!\makeindex!$$
46 in your preamble.
47 If you use the hyperref package, go against their advice and put
48 $$\verb!\usepackage{robustindex}! $$
49 \emph{after} the hyperref declaration, \emph{or}
50 turn off \verb!hyperindex! as in
51 $$
52 \verb!\usepackage[plainpages=false,hyperindex=false]{hyperref}!.
53 $$
54
55 That should be all. (You may have to trash old auxiliary files, the \verb!ind! file included.)
56
57 You can now use \index{alpha}\index{gamma|textbf}
58 $$\verb!\index{alpha}!$$
59 $$\verb?\index{alpha!see beta}?$$
60 $$\verb!\index{gamma|textbf}!$$
61 $$\verb!\index{ampersand@\&|textbf}!$$
62 in the usual manner.
63 \index{ampersand@\&|textbf}
64
65 See \url{https://en.wikibooks.org/wiki/LaTeX/Indexing}.\\
66
67
68
69 The symbol \verb!|! has a special meaning inside an \verb!\index! command and cannot be escaped.
70 To get \verb!|! as output use the \LaTeX\ command \verb!\vert!.
71
72
73 We also have a command \verb!\gobblepageref!, a variant of \verb!\see!,
74 used as in
75 $$\verb?\index{alpha!see also gamma\gobblepageref}?$$
76 \index{alpha!see also gamma\gobblepageref}
77
78 \subsection*{Page ranges}
79 Some features of makeindex had to be repurposed.
80 In particular, \emph{implicit} page ranges are no longer supported.
81
82
83 If you want a page range in the index you have to use
84 the \emph{explicit} page range mechanism of makeindex as in
85 $$\verb!\index{discussion|(}!$$% used above
86
87
88
89
90 on the first page of the range, followed by
91 $$\verb!\index{discussion|)}!$$\index{discussion|)}on the last page of the range.\\
92
93 \subsection*{Table of contents}
94 If there is a table of contents and you want the index listed in it, put the command
95 $$\verb!\indexincontents!$$
96 somewhere before the \verb!\printindex!.
97 \index{alpha!see beta}
98
99 Before discussing the \verb|multind| option we now use $\verb!\printindex!$ to get an index (on a new page).
100
101 \printindex
102
103 \section*{The \texttt{multind} option}
104 The \verb!multind! option provides
105 support for many indexes.
106 Suppose the preamble contains \verb!\usepackage[multind]{robustindex}[2018/04/15]!.
107
108 Let us say we want to use four indexes. First we choose tags to identify them.
109 Say we use the tags \verb|main|, \verb|bis|, \verb|a1|, \verb|b1|.
110 The tag \verb|main| is always known and
111 the index with tag \verb|main| becomes active at the \verb|\begin{document}|.
112
113 With the \verb!\setindex! command we activate an index.
114 Thus \verb!\setindex{bis}! tells \LaTeX\ that the active index is now the index identified by the tag
115 \verb|bis|, until the next \verb!\setindex! command. The other indexes are inactivated.
116 If a tag has not been encountered
117 before, then a new index with that tag is created.
118 The \verb!\index! command and
119 the \verb|\printindex| commands write to/from the active index. All indexes are hidden in one
120 big index file (with extension \verb!ind!) and \LaTeX\ knows how to find the active index in there.
121
122 If you wish you may use \verb!\sindex[bis]{!\emph{entry}\verb!}! as shorthand for\\
123
124 \hspace{5em} \verb!\setindex{bis}\index{!\emph{entry}\verb!}!\\
125
126 and \verb!\sindex{!\emph{entry}\verb!}! as shorthand for\\
127
128 \hspace{5em} \verb!\setindex{main}\index{!\emph{entry}\verb!}!.\\
129
130
131
132 Option \verb!multind! works with the original compilation sequence. That is the main point of all our hacking.
133 For instance, the file \verb!multisample.tex! produces multiple indexes and may be processed in this
134 old fashioned way:
135
136 latex multisample.tex
137
138 makeindex multisample
139
140 latex multisample.tex
141
142 latex multisample.tex\\
143
144 Older versions of \verb!robustindex.sty!
145 may give different results. Use version \verb!2018/04/15! or later.
146 We recommend to bundle \verb!robustindex.sty! with your \verb!tex! and \verb!ind! file when moving
147 files to another computer.
148
149
150 If you have an entry that should go before the letter a, then you may start the argument of \verb!\index! with \verb!<!,
151 as in \index{<@$<$ comes before alphabet}\verb!\index{<@$<$ comes before alphabet}!.
152
153 \subsection*{Embellishment}
154 One may embellish an index with letter headings, like this.
155
156 \verb!\setindex{main}!
157
158 \verb!\renewcommand{\indexname}{Embellished Index}!
159
160 \verb!\renewcommand{\indexcapstyle}[1]{\indexspace\textsc{#1}\par}!%
161
162 \verb!\printindex! \\
163
164 \noindent This gives
165
166 \setindex{main}
167
168 \renewcommand{\indexname}{Embellished Index}
169
170 \renewcommand{\indexcapstyle}[1]{\indexspace\textsc{#1}\par}%
171
172 \printindex
173
174
175 \end{document}