[Tex/LaTex] Creating Table of Contents / Section Headings

formattingnamingpage-breakingsectioningtable of contents

I found this article and would like to know how can one create a template (generic) to accomplish this. It would be great to implement a (generic) template to be able to make it for a table of contents, list of figures, list of tables, list of listings (code), etc… I would like the table of contents, table of figures, etc.. to all start on a fresh page instead of running on from the previous section. I will post a external like because you will able to get a better idea of what I am asking. I could post a picture, but the functionality would be taken away, i.e., being able to click the link and it takes you to the appropriate part of the document. I would like to know how is this done for contents,figures, sections, references, footnotes, etc. Also, if one can include how to play around with the color of the wording for the contents would be great. Can I also add, (I know its already a lot, but I think this is the last thing) I would like to be able to move the contents, list of figures, list of tables to the center of the page and I would like if I could have control of what to name them, i.e., Table of Contents instead of Contents produced from \tableofcontents,\listofigures,\listoftables. Okay I will stop here, its already a lot to digest I think.

  • microtype

  • TOC and Headings (This is the document that has the centered and underlined section titles that I would like to accomplish).

Best Answer

In the report class, the table of contents and related lists are typeset as (unnumbered) chapters, i.e., with a page break before them. To center chapter titles and add a rule below them, use the titlesec package. To rename the ToC & friends, redefine the \contentsname, \listfigurename, and\listtablename macros. (If you're using babel, have a look at this question.)

\documentclass{report}

\usepackage{titlesec}
\titleformat{\chapter}[display]{\Large\bfseries\centering}%
    {\chaptername~\thechapter}{1ex}{}[\titlerule]

\renewcommand{\contentsname}{Table of Contents}

\usepackage{lipsum}

\begin{document}

\tableofcontents

\chapter{foo}

\lipsum[1]

\end{document}

Page 1:

enter image description here

Page 2:

enter image description here