9

I use the trick from How to get header and footer over ToC, LoF and Nomeclature? to ensure that all pages[1] (including the 1st page of the Table of Contents) have headers and footers:

\tableofcontents\thispagestyle{fancy}

That works fine. However, I then use the trick from TOC Text - numbers alignment to widen the space reserved for section numbers (so that section "10.10" doesn't cause overlapping text)

\usepackage{tocloft}
\setlength{\cftsubsecnumwidth}{3em}

Adding the tocloft command seems to reverse the 'fancy page style' command, so that the ToC no longer has headers and footers.

Do these commands need to be in some specific order to work correctly?

Alternatively, is there some other (non-tocloft) way to fix ToC numbers and text that overlap?

[1] Actually, we want the title page to not have header/footer, so can't just redefine \fancypagestyle{plain} like in Header and Footer on multipage listoffigures

11

If the tocloft package is loaded, the page style of pages in the ToC, LoT, and LoF is governed by the package's \tocloftpagestyle macro. Tocloft's default page style is plain. To change the page style of these pages to fancy, issue the command

\tocloftpagestyle{fancy}

Addendum, prompted by a comment by @egreg: You can also achieve your objective by loading the tocloft package with the titles option:

\usepackage[titles]{tocloft}

The manual of the tocloft package has the following to say about this option:

The titles option causes the titles of the ToC, LoF, and LoT lists to be typeset using the default LATEX methods. This can be useful, for example, when the tocloft and fncychap packages are used together and the 'fancy' chapter styles should be used for the ToC, etc., titles.

It turns out that the titles option is quite useful not only if the fncychap package is in use, but also if the fancyhdr package is employed.

  • 1
    Probably it's better to pass the titles option to tocloft. – egreg Oct 10 '13 at 20:12
  • @egreg - Thanks for pointing out the use of the titles option. I've augmented my answer to mention this possibility. I must confess that I had been vaguely aware of the option, but because the package's manual mentions it for use with packages such as fncychap, it hadn't occurred to me until now that the option may come in handy with other packages too, including fancyhdr. – Mico Oct 10 '13 at 20:55

Your Answer

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

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