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.

In the past, I believe this technique was used to center the Contents heading in the table of contents via tocloft:

\documentclass{report}
\usepackage{tocloft}

\renewcommand{\cfttoctitlefont}{\hfill \Huge}
\renewcommand{\cftaftertoctitle}{\hfill}

\begin{document}

\tableofcontents

\chapter{Chap 1}
\chapter{Chap 2}
\chapter{Chap 3}

\end{document}

However I recently updated the package to version v2.3f (2013-05-02) and this no longer centers the heading.

contents

How do I fix this? The answers for a related question do not work.

share|improve this question
2  
You can use \renewcommand{\cfttoctitlefont}{\hfil \Huge}. Than you don't need any \cftaftertoctitle –  Marco Daniel Jun 6 '13 at 20:21
    
I had the same problem, but while the solution suggested below worked in the example it did not work for my project. Instead I added an empty \hbox{} to \cftaftertoctitle to make it \renewcommand{\cftaftertoctitle}{\hfill\hbox{}}. Then the title was centered. –  christianhaargaard Nov 13 at 20:44

1 Answer 1

up vote 0 down vote accepted

From the comment by Marco Daniel, the following modification works.

\documentclass{report}
\usepackage{tocloft}

\renewcommand{\cfttoctitlefont}{\hfil \Huge}

\begin{document}

\tableofcontents

\chapter{Chap 1}
\chapter{Chap 2}
\chapter{Chap 3}

\end{document}

enter image description here

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.