[Tex/LaTex] Best way to remove page numbers from a TOC

page-numberingtable of contents

What is the best way to remove Page Numbers from a Multi-Page TOC without touching the \pagestyle or \thispagestyle?

I've seen this post already, but I want to find out if there are more ways to solve this.

Furthermore, if you have a collection of "pages", how do you easily nest these inside a block that does not include page numbers?

Best Answer

If you don't want to change the page style, you could change the page numbering. For example:

\cleardoublepage
\pagenumbering{gobble}
\tableofcontents
\cleardoublepage
\pagenumbering{arabic}

Here, I switched it off by using gobble. Note, by \pagenumbering{arabic} the numbering starts with 1, so it might be that you would like to raise the page number using \refstepcounter or \addtocounter, for example.

I used \cleardoublepage to end the page before changing the page numbering. Otherwise the last table of contents page could get an arabic number.

You could use this for disabling page numbering in blocks, or consider adjusting the page style in the block, or redefine \thepage locally within in the block. If you need \thepage though, you could introduce another macro, which is \thepage by default and is used in your header or footer, and change that temporarily.