As you stated, the \thispagestyle{...}
command only affects the current page, so it will not help for a multi-page table of contents, except, as you do in your solution, if you ensure that it's called at least once on each page.
To momentarily change the page footer over several pages, you can use \pagestyle{...}
. So the first naive thing to try is:
\pagestyle{empty}
\tableofcontents
\clearpage
\pagestyle{plain}
note the \clearpage
command, so that the following \pagestyle
command only takes effect on the following page and not on the last page of the table of contents.
However, there is a catch: \tableofcontents
internally calls \chapter*{...}
, which itself calls \thispagestyle{plain}
(see book.cls
source). So the first page will still have the "plain" footer style. To hack around that, I don't have a more elegant solution than to momentarily disable the \thispagestyle
command itself; the total code block is then:
\pagestyle{empty}
{
\renewcommand{\thispagestyle}[1]{}
\tableofcontents
}
\clearpage
\pagestyle{plain}
Note the pair of braces, meant to restore the macro \thispagestyle
to its original meaning after the block.
Best Answer
Using
\clearpage
is the mechanism in LaTeX to force content to be sent to the next page. In this case since you want to have the table of content on its own page, you need to call\clearpage
before and after invoking\tableofcontents