How To Make A Table Of Contents In Latex
LaTeX provides features to automatically generate a table of contents, lists of figures, and lists of tables. Learn here how to use them.
Contents
Table of contents
Creating a table of contents can be done with a few simple commands. LaTeX will use section headings to create a table of contents and has commands to generate a list of shapes and a list of tables. I will give a small example code to create the table of contents first: documentclass {article} begin {document} tableofcontents newpage section {Section} Dummy text subsection {Subsection} Dummy text end {document} After compiling the .tex file twice , you will get the following table of contents: Read: how to create a table of contents in latex
List of figures/tables
Creating lists of shapes and tables works the same way. I added a dummy figure and table and included the list in the appendix of my document: begin {document}… begin {figure} caption {Dummy figure} end {figure} begin {table} caption {Dummy table} end {table}… begin {appnex} listoffigures listoftables end {appcharge} end {document} After recompiling twice, the lists will be generated as follows:
Depth
Read more: how to remove knots on a lace front wig Sometimes only a subset of the titles are shown for all sections or for a specific section. For this reason, you can set the tocdepth using the setcounter {tocdepth} {X} command, where X is the desired depth. A value of 0 means that your table of contents will not display at all, and 5 means that even subparagraphs will be displayed. The value should be set in the preamble of your document and automatically applied to the entire document: %… setcounter {tocdepth} {1}% Show %setcounter {tocdepth} {2}% + subsection% setcounter {tocdepth} {3 }% + subsubsices% setcounter {tocdepth} {4}% + paragraphs% setcounter {tocdepth} {5}% + subparagraphs begin {document}%… tableofcontents%… end {document} Using the example above above, setting tocdepth=1 will result in the following:You can easily increase the length of the table of contents, by setting the tocdepth to something higher like 3, which will result in the following:If you don’t want to change the depth for all sections, you can also adjust the tocdepth for each section individually. In this case you don’t have to put tocdepth before the part that should have more or less depth. %… Begin {document}%… addtocontents {toc} {setcounter {tocdepth} {1}}% Set the depth to 1 section {Another section} subsubsection {Subsection} subsubsection {Subsubsection}%… addtocontents {toc} {setcounter {tocdepth } {3}}% Reset to default (3) end {document} Read more: how to clean louis vutton damier azur canvas This will create the following table of contents, use default tocdepth for the first part, but tocdepth = 1 for this part:
distance
If you’re not happy with the spacing of headings in your table of contents, the easiest way to change the spacing of your table of contents (and documents in general) is to use the setspace package. First, add usepackage {setspace} to your preamble:%… usepackage {setspace}%… begin {document}%… Then you can proceed with spacing individual parts of the document, include the following table of contents:%… begin {document}%… doublepacing tableofcontents singleplacing%… This will result in the following:
Summary
- Dynamically create a table of contents using tableofcontents
- Create your lists of figures and tables with list and softlist configurations
- Always compile twice to see the changes
- Change global depth with setcounter {tocdepth} {X}; X = {1,2,3,4,5}
- For single sections, use addtocontents {toc} {setcounter {tocdepth} {X}} instead.
Next article: 07 BiBTeXRead more: A guide to treating fractures caused by Thermia
Last, Wallx.net sent you details about the topic “How To Make A Table Of Contents In Latex❤️️”.Hope with useful information that the article “How To Make A Table Of Contents In Latex” It will help readers to be more interested in “How To Make A Table Of Contents In Latex [ ❤️️❤️️ ]”.
Posts “How To Make A Table Of Contents In Latex” posted by on 2021-10-29 21:15:17. Thank you for reading the article at wallx.net