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.

This is what I'm trying to do:

{\Huge Table of Contents}\vspace{-3mm}
\rule{\linewidth}{0.5mm} \\[-4mm]

Using babel, I can get this code to work:


    {Table of Contents}


but the second I try to add in that \vspace as a test, it fails. Any ideas how to fix this? Because I really want to add those options to the table of contents and I need the babel package as well.

share|improve this question
\contentsname should contain only a string. Formatting changes to the table of contents should be made by modifying \tableofcontents. –  egreg Nov 19 '12 at 17:24
hmm, but the first snippet of code I posted works as long as babel is not being used –  justin.dong Nov 19 '12 at 17:29
It only "works" by accident. it would fail if \contentsname was used anywhere other than the main section title, for example page heading pdf bookmarks, ... –  David Carlisle Nov 19 '12 at 17:31
I see. What is the proper way to modify the spacing only around the ToC title then? And add the horizontal line just below the title? –  justin.dong Nov 19 '12 at 17:42

1 Answer 1

up vote 3 down vote accepted

Here's a way; modify the spacings to suit you.

  \vspace*{-4mm}% reduce space before
  \vspace{2mm}% space between title and rule
  \vspace{2mm}% space below rule

Don't add formatting instructions to \contentsname, which should only contain the string to print.

share|improve this answer
Fantastic, thanks. This is exactly what I needed –  justin.dong Nov 19 '12 at 18:02

Your Answer


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.