Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to center the caption of my table of contents, so that it looks as follows:

                         Table of contents 

1.   Section                                              1
1.1  Subsection                                           3
1.2  Subsection                                           5
2    Section                                             11

Instead of

Table of contents 

1.   Section                                              1
1.1  Subsection                                           3
1.2  Subsection                                           5
2    Section                                             11

I've tried to \renewcommand{\contentsname}{\centerline{Table of contents}}, which worked fine for the apperance on the page.

But I'm using a book style where at the top of the page, on the left side, I want to have the name of the current chapter/section/whatsoever. But if I do the above, the text Table of contents is not on the left side, but in the middle (because of the \centerline).

Is there a way to accomplish what I want?

share|improve this question

2 Answers 2

up vote 10 down vote accepted

There are several package to modify the layout of contents. The simplest one for standard document classes may be tocloft. You can use:

\usepackage{tocloft}
\renewcommand{\cfttoctitlefont}{\hfill\Large\bfseries}
\renewcommand{\cftaftertoctitle}{\hfill}

\tableofcontents is typesetted as \chapter*(for book and report) or \section*(for article). You can modify the layout of chapter(section) titles for table of contents. Thus sectsty or titlesec can be used for standard classes. You can use:

% \documentclass{article}
% \usepackage{sectsty}
\sectionfont{\centering}
\tableofcontents
\sectionfont{}

or

% \documentclass{article}
% \usepackage{titlesec}
\titleformat*{\section}{\centering\bfseries\Large}
\tableofcontents
\titleformat*{\section}{\bfseries\Large}

If you are using classes such as memoir and koma-script, there will be other command for this purpose. You'd better read the manual of these classes.

share|improve this answer
    
Thank you, worked perfectly fine. –  phimuemue Feb 7 '11 at 12:38
\documentclass{book}
\begin{document}

\makeatletter
\chapter*{\centerline{\contentsname}}
\@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}%
\@starttoc{toc}%
\makeatother

\chapter{foo}
bar

\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.