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'm finalizing my dissertation, and they require that the "Table of Contents - Continued" heading in the ToC (that shows if it flows onto a second page) be centered.

I thought I could find the code that generates the ToC and just customize it a bit, but I can't even find what's generating it...

Anybody have any ideas how I could work this out, or where the code is?

share|improve this question
    
Maybe the fancyhdr package would help? –  mbork Jul 23 '11 at 18:37
1  
Welcome to TeX.sx! Your question was migrated here from another stackexchange site. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. –  Martin Scharrer Jul 23 '11 at 19:38
add comment

migrated from stackoverflow.com Jul 23 '11 at 18:04

This question came from our site for professional and enthusiast programmers.

1 Answer

If you would like to have this "continued" heading in the body text, as heading above the continued table of contents, you can use the afterpage package. Here's an example:

\documentclass{report}
\usepackage{afterpage}
\DeclareRobustCommand*{\contheading}{%
  \afterpage{{\normalfont\large\bfseries\centering
  Table of Contents - Continued\par\bigskip}}}
\begin{document}
\addtocontents{toc}{\contheading}
\tableofcontents
\chapter{One}
...
\chapter{Twenty}
\section{One}
\chapter{Twenty one}
\section{One}
...
\end{document}

continued heading

Here I defined a macro \contheading which prints our text on the following page. That command will be written to the .toc file, where \tableofcontents can read it. To protect this command, so that it's written to the .toc file without being expanded, I used \DeclareRobustCommand.

If necessary, it can to be repeated later for further pages. Though it's easier to use header entries for that.

If you don't want the heading in the body text, but in the page header, use features of your class or your headings package, such as fancyhdr or scrpage2. Then, for example, \markboth is useful to override the existing header entry:

\newcommand*{\contheading}{Table of Contents - Continued}% in the preamble
...
% later at the beginning of the text:
\addtocontents{toc}{\protect\markboth{\contheading}{\contheading}}

Here I used \protect to prevent the expansion of \markboth when it's written to the .toc file.

Here's a complete example:

\documentclass{report}
% Some general header style settings:
\usepackage{fancyhdr}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}  
\fancyhead[C]{\leftmark}
\pagestyle{fancy}
% The text of our heading:
\newcommand*{\contheading}{Table of Contents - Continued}
\begin{document}
% Now we write the command to the TOC:
\addtocontents{toc}{\protect\markboth{\contheading}{\contheading}}
\tableofcontents
\chapter{One}
...
\chapter{Twenty}
\section{One}
\chapter{Twenty one}
\section{One}
...
\end{document}
share|improve this answer
    
Thanx for this answer, it helped me to modify the toc title, but I couldn't managed to add the "Continued" if TOC spans over 3 pages. It shows up on the second page but not on the third. Could you help me with this? –  user6629 Sep 5 '12 at 13:16
add comment

Your Answer

 
discard

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