Create a contents page using Latex

  • LaTeX
  • Thread starter sara_87
  • Start date
  • Tags
    Latex
In summary: You can tell it to format something in a specific way, but if the source material changes, LaTeX is usually able to adapt and still look good.
  • #1
sara_87
763
0

Homework Statement



I want to create a contents page using Latex.
Say I want the first link to be Statistics which is on page 1 then a sublink called estimators which is on page 3.

Homework Equations





The Attempt at a Solution


\tableofcontents
\setcounter{tocdepth}{2}

Then I'm stuck. how do i go on from here. also, how do i make dots all the way from the title to the page number column?

Thank you
 
Physics news on Phys.org
  • #2


Hi sara_87

When you type in the \tableofcontents control sequence, LaTeX automatically creates a table of contents whose items are based upon what sections you have in your document. That is to say, you do not manually add items to the table of contents, LaTeX does it for you. If you want items to appear in the table of contents, you have to add sections to your document. For example, try the following. I have included a barebones example LaTeX source file with an (empty) document preamble below:

Code:
\documentclass{article}

\begin{document}

\tableofcontents

\section{Statistics}
\subsection{Estimators}
\end{document}

Notes:

1. You don't control what page your section appears on. LaTeX checks the page on which your section starts in the document and assigns a page number in the table of contents accordingly. In this empty test document, since both sections are empty and therefore start on page 1, LaTeX will assign page 1 to both of them in the table of contents.

2. LaTeX automatically creates the list of items with dots leading to page numbers on the right hand side.

3. To get the stuff in #2 to appear, you'll probably have to typeset the document twice in a row.

LaTeX typesetting is not at all like word processing. You enter some simple lines of code, and LaTeX does the vast majority of formatting and layout automatically based upon how it thinks things should be placed. That is the point. :wink:
 
  • #3


Thank you very much.
It's working now :)
 
  • #4


cepheid said:
LaTeX typesetting is not at all like word processing. You enter some simple lines of code, and LaTeX does the vast majority of formatting and layout automatically based upon how it thinks things should be placed. That is the point. :wink:
I might add that LaTeX is very smart in that respect.
 

1. What is Latex and why should I use it for creating a contents page?

Latex is a typesetting software used for creating professional-looking documents. It is particularly useful for creating technical or scientific documents with complex formatting and equations. It offers precise control over document layout and produces high-quality output.

2. How do I create a contents page in Latex?

To create a contents page in Latex, you need to use the \tableofcontents command. This will automatically generate a contents page based on the sections and subsections in your document. You can also customize the appearance of your contents page by using different packages and commands.

3. Can I add page numbers to my contents page in Latex?

Yes, you can add page numbers to your contents page by using the \pagenumbering command. This will assign page numbers to your contents page and the rest of your document. You can also customize the style and format of the page numbers.

4. How can I add additional entries to my contents page in Latex?

To add additional entries to your contents page, you can use the \addcontentsline command. This allows you to manually add sections, subsections, or other headings to your contents page. You can also specify the level of the entry and customize its appearance.

5. Is it possible to create a multi-page contents page in Latex?

Yes, it is possible to create a multi-page contents page in Latex. If your document has a large number of sections and subsections, Latex will automatically split your contents page into multiple pages. You can also use the \addtocontents command to force a page break and start a new contents page at a specific point in your document.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
2K
Back
Top