# How to add some text to every page of the TOC?

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?

• Maybe the fancyhdr package would help? – mbork Jul 23 '11 at 18:37
• 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

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}
\afterpage{{\normalfont\large\bfseries\centering
\begin{document}
\tableofcontents
\chapter{One}
...
\chapter{Twenty}
\section{One}
\chapter{Twenty one}
\section{One}
...
\end{document}


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 there are more pages of the table of contents, you can repeat adding \contheading at the appropriate places. This can be error prone sdince you could forget a page if there are lots of them and an approach using header entries might be more suitable.

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 scrlayer-scrpage. 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:


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{}
\pagestyle{fancy}
% The text of our heading:
\begin{document}
% Now we write the command to the TOC:
\tableofcontents
\chapter{One}
...
\chapter{Twenty}
\section{One}
\chapter{Twenty one}
\section{One}
...
\end{document}

• 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? – Nasuf SONMEZ Sep 5 '12 at 13:16

Sorry to answer with such a delay; have you completed the thesis since ?

\documentclass[twoside]{report}

\usepackage{etoc}

% to activate some page headers:
% but we need to customize the appearance of the page headers
\makeatletter
% Make them centered.
\def\@oddhead  {\hfil {\bfseries \rightmark }\hfil }
\def\@evenhead {\hfil {\bfseries \leftmark }\hfil  }
\makeatother

\renewcommand{\etocaftertitlehook}%
% the default \tableofcontents of class report
% does a \chapter* which puts \contentsname
% in the left and right marks. We must counteract that,
% hence we use this hook which is executed after this \chapter*

\renewcommand{\etocaftertochook}
% we need to reset the header style to erase our customization
% the last page of the TOC. Thus either add to the source
% \pagestyle{headings} (or plain, or whatever) *after*  the first
% \chapter or provoke a \clearpage (which will happen anyhow)
% explictely via this hook and take this opportunity to reset
% Doing this in an \afterpage was tried, but failed.
}

\title{Test document}

\author{Anonymous}

\begin{document}

\maketitle

\tableofcontents

\newcount\loopcount
\loopcount 50

\loop
\chapter{This is a chapter}
\section {first section here}
hello
\clearpage
\section {second section here}
world
\clearpage
\section {third section here}
!