I'd like to know how to create a table of contents in LaTeX. For example, if I were to write a book, I would want something like this


    Chapter 1
      1.1 Real Analysis .............. 1
      1.2 Role of LUB Axiom........... 3

How do I create this? I'd like to know.

  • 4
    This is generally referred to as table of contents, the index is the list of important words with page reference that is typically at the very end of a book. – Caramdir Aug 12 '10 at 13:24
  • @Caramdir: Your comment's content is correct, but why comment rather than edit the question as I have done? (I suggest that you and I both ought to delete these comments, given the edit.) – vanden Aug 12 '10 at 14:58
  • The comment is for education purposes. I'm sure other people - especially non-native speakers - are confused about this too. Generally I avoid doing any edits that potentially significantly change the meaning of questions. Though in this case you are probably right that I should have corrected the question too. – Caramdir Aug 12 '10 at 21:47

A table of contents (ToC) is produced by inserting \tableofcontents at the appropriate place in your document.




\chapter{(Chapter Name)}

\section{Real Analysis}

\section{Role of LUB Axiom}


Note that you need at least two LaTeX runs to produce the ToC (LaTeX collects the data for the ToC in the first run and typesets it in the second run). If the ToC itself comprises several pages, a third LaTeX run may be necessary to get the ToC's page references right.


There's just one command necessary: \tableofcontents, as already mentioned by lockstep. It takes the entries from the sectioning commands \part, \chapter, \section etc.

Additionally, you could use the optional argument of a sectioning command to get a different, shorter entry for the table of contents, for example:

\section[short entry]{long title}

This is useful if you have very long titles in the body text but need shorter list entries in the table of contents.

There are package for further customization of the contents list, if desired, for example:

A very similar index could be created for your figures and tables. The commands are \listoffigures and \listoftables. I mention it because it's the same concept, here the content entries come from the \caption commands.

  • 1
    IMO, tocbasic is rather dedicated to create new "lists of" than to customize the TOC. – lockstep Aug 12 '10 at 13:40
  • Yes, that's the primary function. Though it may be used to replace the standard TOC and lists, and because it's used in KOMA-Script classes its features like \setuptoc can be used to customize the TOC. – Stefan Kottwitz Aug 12 '10 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy