[Tex/LaTex] Remove page numbers from footer for multi-page Table of Contents

table of contents

I am trying to remove page numbers that appear by default in footer of Table of Contents. I was able to do this for one page long Table of Contents like this one:

\documentclass[final]{book}
\pagestyle{plain}

\begin{document}

\tableofcontents
\thispagestyle{empty}

\chapter{Chapter 1}
\chapter{Chapter 2}
\chapter{Chapter 3}
\chapter{Chapter 4}

\end{document}

However, for long Table of Contents take 2 or more pages \thispagestyle{empty} only removes page number in footer from last page of Table of Contents, but all other pages have this number:

\documentclass[final]{book}
\pagestyle{plain}

\begin{document}

\tableofcontents
\thispagestyle{empty}

\chapter{Chapter 1}
\chapter{Chapter 2}
\chapter{Chapter 3}
\chapter{Chapter 4}
\chapter{Chapter 5}
\chapter{Chapter 6}
\chapter{Chapter 7}
\chapter{Chapter 8}
\chapter{Chapter 9}
\chapter{Chapter 10}
\chapter{Chapter 11}
\chapter{Chapter 12}
\chapter{Chapter 13}
\chapter{Chapter 14}
\chapter{Chapter 15}
\chapter{Chapter 16}
\chapter{Chapter 17}
\chapter{Chapter 18}
\chapter{Chapter 19}
\chapter{Chapter 20}
\chapter{Chapter 21}
\chapter{Chapter 22}
\chapter{Chapter 23}
\chapter{Chapter 24}
\chapter{Chapter 25}
\chapter{Chapter 26}
\chapter{Chapter 27}
\chapter{Chapter 28}
\chapter{Chapter 29}
\chapter{Chapter 30}
\chapter{Chapter 31}
\chapter{Chapter 32}
\chapter{Chapter 33}
\chapter{Chapter 34}
\chapter{Chapter 35}
\chapter{Chapter 36}
\chapter{Chapter 37}
\chapter{Chapter 38}
\chapter{Chapter 39}
\chapter{Chapter 40}
\chapter{Chapter 41}
\chapter{Chapter 42}
\chapter{Chapter 43}
\chapter{Chapter 44}
\chapter{Chapter 45}
\chapter{Chapter 46}
\chapter{Chapter 47}
\chapter{Chapter 48}
\chapter{Chapter 49}
\chapter{Chapter 50}
\chapter{Chapter 51}
\chapter{Chapter 52}
\chapter{Chapter 53}
\chapter{Chapter 54}
\chapter{Chapter 55}
\chapter{Chapter 56}
\chapter{Chapter 57}
\chapter{Chapter 58}
\chapter{Chapter 59}
\chapter{Chapter 60}
\chapter{Chapter 61}
\chapter{Chapter 62}

\end{document}

I have discovered that I can use \addtocontents{toc}{\protect\thispagestyle{empty}} before \chapter entry to remove footer from page on which given chapter will appear in Table of Contents. However, it requires me to either add \addtocontents{toc}{\protect\thispagestyle{empty}} before each \chapter command or at least do it manually for one chapter on each page of Table of Contents.

Is there any more straightforward way to remove footers from Table of Contents no matter how long Table of Content is?

Best Answer

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.

Related Question