File indexing completed on 2024-11-24 04:34:43
0001 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 0002 <html> 0003 <!-- This document is an unofficial reference manual for LaTeX, a 0004 document preparation system, version of November 2018. 0005 0006 This manual was originally translated from LATEX.HLP v1.0a in the 0007 VMS Help Library. The pre-translation version was written by 0008 George D. Greenwade of Sam Houston State University. The 0009 LaTeX 2.09 version was written by Stephen Gilmore. The 0010 LaTeX2e version was adapted from this by Torsten Martinsen. Karl 0011 Berry made further updates and additions, and gratefully acknowledges 0012 using Hypertext Help with LaTeX, by Sheldon Green, and 0013 LaTeX Command Summary (for LaTeX 2.09) by 0014 L. Botway and C. Biemesderfer (published by the TeX Users 0015 Group as TeXniques number 10), as reference material. We also 0016 gratefully acknowledge additional material appearing in 0017 latex2e-reference by Martin Herbert Dietze. (From these references no 0018 text was directly copied.) 0019 0020 Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013, 0021 2014, 2015, 2016, 2017, 2018 Karl Berry. 0022 0023 Copyright 1988, 1994, 2007 Stephen Gilmore. 0024 0025 Copyright 1994, 1995, 1996 Torsten Martinsen. 0026 0027 Permission is granted to make and distribute verbatim copies of 0028 this manual provided the copyright notice and this permission notice 0029 are preserved on all copies. 0030 0031 0032 Permission is granted to copy and distribute modified versions of this 0033 manual under the conditions for verbatim copying, provided that the entire 0034 resulting derived work is distributed under the terms of a permission 0035 notice identical to this one. 0036 0037 Permission is granted to copy and distribute translations of this manual 0038 into another language, under the above conditions for modified versions. --> 0039 <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ --> 0040 <head> 0041 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 0042 <title>\index (LaTeX2e unofficial reference manual (November 2018))</title> 0043 0044 <meta name="description" content="\index (LaTeX2e unofficial reference manual (November 2018))"> 0045 <meta name="keywords" content="\index (LaTeX2e unofficial reference manual (November 2018))"> 0046 <meta name="resource-type" content="document"> 0047 <meta name="distribution" content="global"> 0048 <meta name="Generator" content="makeinfo"> 0049 <link href="index.html#Top" rel="start" title="Top"> 0050 <link href="IndexDocument.html#Index" rel="index" title="Index"> 0051 <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> 0052 <link href="Indexes.html#Indexes" rel="up" title="Indexes"> 0053 <link href="makeindex.html#makeindex" rel="next" title="makeindex"> 0054 <link href="Indexes.html#Indexes" rel="prev" title="Indexes"> 0055 <style type="text/css"> 0056 <!-- 0057 /* $Id: latex2e.css 690 2018-09-15 15:20:19Z jimhefferon $ 0058 Minor css for latexrefman. Public domain. 0059 Originally written by Jim Hefferon and Karl Berry, 2018. */ 0060 0061 /* So you can style for yourself */ 0062 @import url("/css/latexreflocal.css"); 0063 0064 0065 0066 a.summary-letter {text-decoration: none} 0067 blockquote.indentedblock {margin-right: 0em} 0068 blockquote.smallindentedblock {margin-right: 0em; font-size: smaller} 0069 blockquote.smallquotation {font-size: smaller} 0070 div.display {margin-left: 3.2em} 0071 div.example {margin-left: 3.2em} 0072 div.lisp {margin-left: 3.2em} 0073 div.smalldisplay {margin-left: 3.2em} 0074 div.smallexample {margin-left: 3.2em} 0075 div.smalllisp {margin-left: 3.2em} 0076 kbd {font-style: oblique} 0077 pre.display {font-family: inherit} 0078 pre.format {font-family: inherit} 0079 pre.menu-comment {font-family: serif} 0080 pre.menu-preformatted {font-family: serif} 0081 pre.smalldisplay {font-family: inherit; font-size: smaller} 0082 pre.smallexample {font-size: smaller} 0083 pre.smallformat {font-family: inherit; font-size: smaller} 0084 pre.smalllisp {font-size: smaller} 0085 span.nolinebreak {white-space: nowrap} 0086 span.roman {font-family: initial; font-weight: normal} 0087 span.sansserif {font-family: sans-serif; font-weight: normal} 0088 ul.no-bullet {list-style: none} 0089 BODY { 0090 margin-top: 1em; 0091 margin-left: 1em; /* auto results in two-digit <ol> lost off left */ 0092 margin-right: 1em; 0093 margin-bottom: 1em; 0094 /* the idea is to use the whole window, unless it is ridiculously 0095 wide, probably with too-small fonts, too. */ 0096 max-width: 64em; 0097 } 0098 0099 /* Because we want @math{... @code ...} to be upright, not slanted, 0100 and Texinfo won't fix it. */ 0101 code {font-style:normal; font-family:monospace; } 0102 0103 /* We put a link to our own home page at the bottom. */ 0104 div.referenceinfo {font-size:small;} 0105 0106 --> 0107 </style> 0108 0109 0110 </head> 0111 0112 <body lang="en"> 0113 <a name="g_t_005cindex"></a> 0114 <div class="header"> 0115 <p> 0116 Next: <a href="makeindex.html#makeindex" accesskey="n" rel="next">makeindex</a>, Up: <a href="Indexes.html#Indexes" accesskey="u" rel="up">Indexes</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="IndexDocument.html#Index" title="Index" rel="index">Index</a>]</p> 0117 </div> 0118 <hr> 0119 <a name="g_t_005cindex-1"></a> 0120 <h4 class="subsection">25.2.1 <code>\index</code></h4> 0121 0122 <a name="index-index-entry"></a> 0123 <a name="index-_005cindex-1"></a> 0124 0125 <p>Synopsis: 0126 </p> 0127 <div class="example"> 0128 <pre class="example">\index{<var>index-entry-string</var>} 0129 </pre></div> 0130 0131 <p>Declare an entry in the index. This command is fragile 0132 (see <a href="_005cprotect.html#g_t_005cprotect">\protect</a>). 0133 </p> 0134 <p>For example, as described in <a href="Indexes.html#Indexes">Indexes</a>, one way to get an index from 0135 what’s below is to compile the document with <code>pdflatex test</code>, then 0136 process the index entries with <code>makeindex test</code>, and then compile 0137 again with <code>pdflatex test</code>. 0138 </p> 0139 <div class="example"> 0140 <pre class="example">W~Ackermann (1896--1962).\index{Ackermann} 0141 ... 0142 Ackermann function\index{Ackermann!function} 0143 ... 0144 rate of growth\index{Ackermann!function!growth rate} 0145 </pre></div> 0146 0147 <p>All three index entries will get a page number, such as ‘<samp>Ackermann, 0148 22</samp>’. LaTeX will format the second as a subitem of the first, on the 0149 line below it and indented, and the third as a subitem of the second. 0150 Three levels deep is as far as you can nest subentries. (If you add 0151 <code>\index{Ackermann!function!growth rate!comparison}</code> then 0152 <code>makeindex</code> says ‘<samp>Scanning input file test.idx....done (4 0153 entries accepted, 1 rejected)</samp>’ and nothing appears in the index). 0154 </p> 0155 <p>If you enter a second <code>\index</code> with the same 0156 <var>index-entry-string</var> then you will get a single index entry with two 0157 page numbers (unless they happen to fall on the same page). Thus, 0158 adding <code>as for Ackermann.\index{Ackermann}</code> later in the same 0159 document as above will give an index entry like ‘<samp>Ackermann, 22, 0160 151</samp>’. Also, you can enter the index entries in any order, so for 0161 instance <code>\index{Ackermann!function}</code> could come before 0162 <code>\index{Ackermann}</code>. 0163 </p> 0164 <a name="index-index_002c-page-range"></a> 0165 <p>Get a page range in the output, like ‘<samp>Hilbert, 23--27</samp>’, as here. 0166 </p> 0167 <div class="example"> 0168 <pre class="example">W~Ackermann (1896--1962).\index{Ackermann} 0169 ... 0170 D~Hilbert (1862--1943)\index{Ackermann!Hilbert\(} 0171 ... 0172 disapproved of his marriage.\index{Ackermann!Hilbert\)} 0173 </pre></div> 0174 0175 <p>If the beginning and ending of the page range are equal then the system 0176 just gives a single page entry, not a range. 0177 </p> 0178 <p>If you index subentries but not a main entry, as with 0179 <code>\index{Jones!program}</code> and <code>\index{Jones!results}</code>, then 0180 the output is the item ‘<samp>Jones</samp>’ with no comma or page number, 0181 followed by two subitems, like ‘<samp>program, 50</samp>’ and ‘<samp>results, 0182 51</samp>’. 0183 </p> 0184 <a name="index-_0060see_0027-and-_0060see-also_0027-index-entries"></a> 0185 <a name="index-index-entries_002c-_0060see_0027-and-_0060see-also_0027"></a> 0186 <a name="index-_005cseename"></a> 0187 <a name="index-_005calsoname"></a> 0188 <a name="index-package_002c-babel-5"></a> 0189 <a name="index-babel-package-5"></a> 0190 <a name="index-package_002c-polyglossia-3"></a> 0191 <a name="index-polyglossia-package-3"></a> 0192 0193 0194 <p>Generate a index entry that says ‘<samp>See</samp>’ by using a vertical bar 0195 character: <code>\index{Ackermann!function|see{P\'eter's 0196 function}}</code>. You can instead get ‘<samp>See also</samp>’ with <code>seealso</code>. 0197 (The text ‘<samp>See</samp>’ is defined by <code>\seename</code>, and ‘<samp>See also</samp>’ 0198 by <code>\alsoname</code>. You can redefine these either by using an 0199 internationalization package such as <samp>babel</samp> or <samp>polyglossia</samp>, 0200 or directly as with <code>\renewcommand{\alsoname}[1]{Also see 0201 #1}</code>.) 0202 </p> 0203 <p>The ‘<samp>See</samp>’ feature is part of a more general functionality. After 0204 the vertical bar you can put the name of a one-input command, as in 0205 <code>\index{group|textit}</code> (note the missing backslash on the 0206 <code>\textit</code> command) and the system will apply that command to the 0207 page number, here giving something like <code>\textit{7}</code>. You can 0208 define your own one-input commands, such as 0209 <code>\newcommand{\definedpage}[1]{{\color{blue}#1}}</code> and then 0210 <code>\index{Ackermann!function|definedpage}</code> will give a blue page 0211 number (see <a href="Color.html#Color">Color</a>). Another, less practical, example is this, 0212 </p> 0213 <div class="example"> 0214 <pre class="example">\newcommand\indexownpage[1]{#1, \thepage} 0215 ... Epimenides.\index{self-reference|indexownpage} 0216 </pre></div> 0217 0218 <p>which creates an entry citing the page number of its own index listing. 0219 </p> 0220 <p>The two functions just described combine, as here 0221 </p> 0222 <div class="example"> 0223 <pre class="example">\index{Ackermann!function|(definedpage} 0224 ... 0225 \index{Ackermann!function|)} 0226 </pre></div> 0227 0228 <p>which outputs an index entry like ‘<samp>function, 23--27</samp>’ where the page 0229 number range is in blue. 0230 </p> 0231 <p>Consider an index entry such as ‘<samp>α-ring</samp>’. Entering 0232 it as <code>$\alpha$-ring</code> will cause it to be alphabetized according to 0233 the dollar sign. You can instead enter it using an at-sign, as 0234 <code>\index{alpha-ring@$\alpha$-ring}</code>. If you specify an entry 0235 with an at-sign separating two strings, <code><var>pos</var>@<var>text</var></code>, 0236 then <var>pos</var> gives the alphabetical position of the entry while 0237 <var>text</var> produces the text of the entry. Another example is that 0238 <code>\index{Saint Michael's College@SMC}</code> produces an index entry 0239 ‘<samp>SMC</samp>’ alphabetized into a different location than its spelling 0240 would naturally give it. 0241 </p> 0242 <p>To put a <code>!</code>, or <code>@</code>, or <code>|</code> character in an index 0243 entry, preceding it with a double quote, <code>"</code>. (The double quote 0244 gets deleted before alphabetization.) 0245 </p> 0246 <a name="index-package_002c-index"></a> 0247 <a name="index-index-package"></a> 0248 0249 <p>A number of packages on CTAN have additional functionality beyond that 0250 provided by <samp>makeidx</samp>. One is <samp>index</samp>, which allows for 0251 multiple indices and contains a command 0252 <code>\index*{<var>index-entry-string</var>}</code> that prints the 0253 <var>index-entry-string</var> as well as indexing it. 0254 </p> 0255 <a name="index-_005cindexentry"></a> 0256 <a name="index-idx-file"></a> 0257 <p>The <code>\index</code> command writes the indexing information to the file 0258 <samp><var>root-name</var>.idx</samp> file. Specifically, it writes text of the 0259 command 0260 <code>\indexentry{<var>index-entry-string</var>}{<var>page-num</var>}</code>, 0261 where <var>page-num</var> is the value of the <code>\thepage</code> counter. On 0262 occasion, when the <code>\printindex</code> command is confused, you have to 0263 delete this file to start with a fresh slate. 0264 </p> 0265 <p>If you omit the closing brace of an <code>\index</code> command then you get a 0266 message like this. 0267 </p> 0268 <div class="example"> 0269 <pre class="example">Runaway argument? {Ackermann!function 0270 ! Paragraph ended before \@wrindex was complete. 0271 </pre></div> 0272 0273 0274 0275 0276 <hr/><div class='referenceinfo'> <a href='https://latexref.xyz/'> <i>Unofficial LaTeX2e reference manual</i></a></div> 0277 </body> 0278 </html>