File indexing completed on 2024-11-24 04:34:44

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>Table of contents etc. (LaTeX2e unofficial reference manual (November 2018))</title>
0043 
0044 <meta name="description" content="Table of contents etc. (LaTeX2e unofficial reference manual (November 2018))">
0045 <meta name="keywords" content="Table of contents etc. (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="Front_002fback-matter.html#Front_002fback-matter" rel="up" title="Front/back matter">
0053 <link href="_005caddcontentsline.html#g_t_005caddcontentsline" rel="next" title="\addcontentsline">
0054 <link href="Front_002fback-matter.html#Front_002fback-matter" rel="prev" title="Front/back matter">
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="Table-of-contents-etc_002e"></a>
0114 <div class="header">
0115 <p>
0116 Next: <a href="Indexes.html#Indexes" accesskey="n" rel="next">Indexes</a>, Up: <a href="Front_002fback-matter.html#Front_002fback-matter" accesskey="u" rel="up">Front/back matter</a> &nbsp; [<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="Table-of-contents-etc_002e-1"></a>
0120 <h3 class="section">25.1 Table of contents etc.</h3>
0121 
0122 <a name="index-table-of-contents_002c-creating"></a>
0123 
0124 <a name="index-_005ctableofcontents"></a>
0125 <a name="index-_002etoc-file-1"></a>
0126 <a name="index-_005clistoffigures"></a>
0127 <a name="index-_005clistoftables"></a>
0128 <a name="index-_002elof-file-1"></a>
0129 <a name="index-_002elot-file-1"></a>
0130 
0131 <p>Synopsis, one of:
0132 </p>
0133 <div class="example">
0134 <pre class="example">\tableofcontents
0135 \listoffigures
0136 \listoftables
0137 </pre></div>
0138 
0139 <p>Produce a table of contents, or list of figures, or list of tables.  Put
0140 the command in the input file where you want the table or list to
0141 go. You do not type the entries; for example, typically the table of
0142 contents entries are automatically generated from the sectioning
0143 commands <code>\chapter</code>, etc.
0144 </p>
0145 <p>This example illustrates the first command, <code>\tableofcontents</code>.
0146 LaTeX will produce a table of contents on the book&rsquo;s first page.
0147 </p>
0148 <div class="example">
0149 <pre class="example">\documentclass{book}
0150 % \setcounter{tocdepth}{1}
0151 \begin{document}
0152 \tableofcontents\newpage
0153   ...
0154 \chapter{...}
0155   ...
0156 \section{...}
0157   ...
0158 \subsection{...}
0159   ...
0160 \end{document}
0161 </pre></div>
0162 
0163 <p>Uncommenting the second line would cause that table to contain chapter
0164 and section listings but not subsection listings, because the
0165 <code>\section</code> command has level&nbsp;1.  See <a href="Sectioning.html#Sectioning">Sectioning</a> for level
0166 numbers of the sectioning units.  For more on the <code>tocdepth</code>
0167 see <a href="Sectioning.html#Sectioning_002ftocdepth">Sectioning/tocdepth</a>.
0168 </p>
0169 <p>Another example of the use of <code>\tableofcontents</code> is in <a href="Larger-book-template.html#Larger-book-template">Larger book template</a>.
0170 </p>
0171 <p>If you want a page break after the table of contents, write a
0172 <code>\newpage</code> command after the <code>\tableofcontents</code> command, as
0173 above.
0174 </p>
0175 <p>To make the table of contents LaTeX stores the information in an
0176 auxiliary file named <samp><var>root-file</var>.toc</samp> (see <a href="Splitting-the-input.html#Splitting-the-input">Splitting the input</a>).  For example, this LaTeX file <samp>test.tex</samp>
0177 </p>
0178 <div class="example">
0179 <pre class="example">\documentclass{article}
0180 \begin{document}
0181 \tableofcontents\newpage
0182 \section{First section}
0183 \subsection{First subsection}
0184   ...
0185 </pre></div>
0186 
0187 <p>writes the following line to <samp>test.toc</samp>.
0188 </p>
0189 <div class="example">
0190 <pre class="example">\contentsline {section}{\numberline {1}First section}{2}
0191 \contentsline {subsection}{\numberline {1.1}First subsection}{2}
0192 </pre></div>
0193 
0194 <p>The <code>section</code> or <code>subsection</code> is the sectioning unit.  The
0195 hook <code>\numberline</code> lets you to change how the information appears
0196 in the table of contents.  Of its two arguments, <code>1</code> or <code>1.1</code>
0197 is the sectioning unit number and <code>First section</code> or <code>First
0198 subsection</code> is the title.  Finally, <code>2</code> is the page number on which
0199 the sectioning units start.
0200 </p>
0201 <p>One consequence of this auxiliary file storage strategy is that to get the
0202 contents page correct you must run LaTeX twice, once to store the
0203 information and once to get it.  In particular, the first time that you
0204 run LaTeX on a new document, the table of contents page will be empty
0205 except for its &lsquo;<samp>Contents</samp>&rsquo; header.  Just run it again.
0206 </p>
0207 <p>The commands <code>\listoffigures</code> and <code>\listoftables</code> produce a
0208 list of figures and a list of tables.  They work the same way as the
0209 contents commands; for instance, these work with information stored in
0210 <samp>.lof</samp> and <samp>.lot</samp> files.
0211 </p>
0212 <a name="index-package_002c-babel-4"></a>
0213 <a name="index-babel-package-4"></a>
0214 
0215 <a name="index-package_002c-polyglossia-2"></a>
0216 <a name="index-polyglossia-package-2"></a>
0217 
0218 <p>To change the header for the table of contents page do something like
0219 the first line here.
0220 </p>
0221 <div class="example">
0222 <pre class="example">\renewcommand{\contentsname}{Table of contents}
0223 \renewcommand{\listfigurename}{Plots}
0224 \renewcommand{\listtablename}{Tables}
0225 </pre></div>
0226 
0227 <p>Similarly, the other two lines will do the other two.
0228 Internationalization packages such as <samp>babel</samp> or <samp>polyglossia</samp>
0229 will change the headers depending on the chosen base language.
0230 </p>
0231 <a name="index-package_002c-tocloft"></a>
0232 <a name="index-tocloft-package"></a>
0233 
0234 <a name="index-package_002c-tocbibbind"></a>
0235 <a name="index-tocbibbind-package"></a>
0236 
0237 <p>CTAN has many packages for the table of contents and lists of figures
0238 and tables.  One convenient one for adjusting some aspects of the
0239 default, such as spacing, is <samp>tocloft</samp>.  And, <samp>tocbibbind</samp>
0240 will automatically add the bibliography, index, etc. to the table of
0241 contents.
0242 </p>
0243 <table class="menu" border="0" cellspacing="0">
0244 <tr><td align="left" valign="top">&bull; <a href="_005caddcontentsline.html#g_t_005caddcontentsline" accesskey="1">\addcontentsline</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Add an entry to table of contents, etc.
0245 </td></tr>
0246 <tr><td align="left" valign="top">&bull; <a href="_005caddtocontents.html#g_t_005caddtocontents" accesskey="2">\addtocontents</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Add text directly to table of contents file, etc.
0247 </td></tr>
0248 <tr><td align="left" valign="top">&bull; <a href="_005cnofiles.html#g_t_005cnofiles" accesskey="3">\nofiles</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Prevent writing to auxiliary files.
0249 </td></tr>
0250 </table>
0251 
0252 
0253 
0254 
0255 <hr/><div class='referenceinfo'> <a href='https://latexref.xyz/'> <i>Unofficial LaTeX2e reference manual</i></a></div>
0256 </body>
0257 </html>