summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-multind.html
blob: 5cfa73dfebf148bc42ac534d92ee80b2acb9e2b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<head>
<title>UK TeX FAQ -- question label multind</title>
</head><body>
<h3>Multiple indexes</h3>
<p/>LaTeX&rsquo;s standard indexing capabilities (those provided by the
<i>makeidx</i> package) only provide for one index in your
document; even quite modest documents can be improved by indexes for
separate topics.
<p/>The <i>multind</i> package provides simple and straightforward
multiple indexing.  You tag each <code>\</code><code>makeindex</code>, <code>\</code><code>index</code> and
<code>\</code><code>printindex</code> command with a file name, and indexing commands are
written to (or read from) the name with the appropriate (<code>.idx</code> or
<code>.ind</code>) extension appended.  The <code>\</code><code>printindex</code> command is modified
from the LaTeX standard so that it doesn&rsquo;t create its own chapter
or section heading; you therefore decide what names (or sectioning
level, even) to use for the indexes, and
<a href="FAQ-fixnam.html"><code>\</code><code>indexname</code></a> is completely ignored.
<p/>To create a &ldquo;general&rdquo; and an &ldquo;authors&rdquo; index, one might write:
<blockquote>
<pre>
\usepackage{multind}
\makeindex{general}
\makeindex{authors}
...
\index{authors}{Another Idiot}
...
\index{general}{FAQs}
...
\printindex{general}{General index}
\printindex{authors}{Author index}
</pre>
</blockquote><p>
To complete the job, run LaTeX on your file enough times that
labels, etc., are stable, and then execute the commands
<blockquote>
<pre>
makeindex general
makeindex authors
</pre>
</blockquote><p>
before running LaTeX again.  Note that the names of the index files
to process are not necessarily related to the name of the LaTeX
file you&rsquo;re processing, at all.  (There&rsquo;s no documentation that comes
with the package: what you see above is as good as you will
get&hellip;)
<p/>The <i>index</i> package provides a comprehensive set of indexing
facilities, including a <code>\</code><code>newindex</code> command that allows the
definition of new styles of index.  <code>\</code><code>newindex</code> takes a &lsquo;tag&rsquo; (for
use in indexing commands), replacements for the <code>.idx</code> and
<code>.ind</code> file extensions, and a title for the index when it&rsquo;s
finally printed; it can also change the item that&rsquo;s being indexed
against (for example, one might have an index of artists referenced by
the figure number where their work is shown).
<p/>Using <i>index</i>, to create an author index together with a
&ldquo;normal&rdquo; index, one would start with preamble commands:
<blockquote>
<pre>
\usepackage{index}
\makeindex
\newindex{aut}{adx}{and}{Name Index}
</pre>
</blockquote><p>
which load the package, define a &ldquo;main&rdquo; (original-style) index, and
then define an author index.  Then, in the body of the document, we
might find commands like:
<blockquote>
<pre>
\index[aut]{Another Idiot}
...
\index{FAQs}
</pre>
</blockquote><p>
Which place an entry in the author index, and then one in the main
index.  At the end of the document, we have two commands:
<blockquote>
<pre>
\printindex
\printindex[aut]
</pre>
</blockquote><p>
Which will print the main index and then the author index.  Supposing
this lot to be in <i>myfile.tex</i>, after enough runs through
LaTeX that labels are stable, execute the following commands
(Unix-style shell commands shown here, but the principle is the same
whatever system you&rsquo;re using):
<blockquote>
<pre>
makeindex myfile
makeindex myfile.adx -o myfile.and
</pre>
</blockquote><p>
and rerun LaTeX.  The <i>makeindex</i> commands process
<i>myfile.idx</i> to <i>myfile.ind</i> (the default action), and then
<i>myfile.adx</i> to <i>myfile.and</i>, the two files needed as input
by the two <code>\</code><code>printindex</code> commands in <i>myfile.tex</i>.
<p/>The <i>splitidx</i> package can operate in the same way as the
others: load the package with the <code>split</code> option, and
declare each index with a <code>\</code><code>newindex</code> command:
<blockquote>
  <code>\</code><code>newindex[&lt;<i>index name</i>&gt;]{&lt;<i>shortcut</i>&gt;}</code>
</blockquote><p>
and <i>splitidx</i> will generate a file
<code>\</code><code>jobname</code><code>.&lt;<i>shortcut</i>&gt;</code> to receive index entries
generated by commands like <code>\</code><code>sindex[&lt;<i>shortcut</i>&gt;]{&lt;<i>item</i>&gt;}</code>.
As with the other packages, this method is limited by TeX&rsquo;s total
number of output files.  However, <i>splitindex</i> also comes with
a small executable <i>splitindex</i> (available for a variety of
operating systems); if you use this auxiliary program (and don&rsquo;t use
<code>split</code>), there&rsquo;s no limit to the number of indexes.  Apart
from this trick, <i>splitidx</i> supports the same sorts of things
as does <i>index</i>.  An example of use appears in
the documentation.
<p/>The <i>memoir</i> class has its own multiple-index functionality (as
well as its own index layout options, which other packages delegate to
the index style used by <i>makeindex</i>).
<dl>
<dt><tt><i>index.sty</i></tt><dd><a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/index.zip">macros/latex/contrib/index</a> (or <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/index/">browse the directory</a>)
<dt><tt><i>makeidx.sty</i></tt><dd>Part of the LaTeX distribution
<dt><tt><i>memoir.cls</i></tt><dd><a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/memoir.zip">macros/latex/contrib/memoir</a> (or <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/memoir/">browse the directory</a>)
<dt><tt><i>multind.sty</i></tt><dd><a href="http://www.tex.ac.uk/tex-archive/macros/latex209/contrib/misc/multind.sty">macros/latex209/contrib/misc/multind.sty</a>
<dt><tt><i>splitidx.sty and splitindex</i></tt><dd>
  <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/splitindex.zip">macros/latex/contrib/splitindex</a> (or <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/splitindex/">browse the directory</a>)
</dl>
<p/>
<p/><p/><p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=multind">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=multind</a>
</body>