# Clear tableofcontents page in book or report

How do I clear the \tableofcontents page in book or report?

\documentclass[a4paper]{book}
\usepackage{lipsum}
\begin{document}

{\thispagestyle{empty} %but is not work
\tableofcontents}

\chapter{Book tableofcontents without page number}

\lipsum

\end{document}

-

Use the following in your document preamble:

\documentclass[a4paper]{book}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\tableofcontents}{\@starttoc{toc}}{\thispagestyle{empty}\pagestyle{empty}\@starttoc{toc}}{}{}
\makeatother
\begin{document}

\tableofcontents
\clearpage
\cleardoublepage
%...
\end{document}


You patch \tableofcontents using etoolbox to set the current page style to empty, as well as the following page styles (if your ToC spans more than one page) to empty. \clearpage flushes the current page (last one of the ToC), after which you can reset your page style to headings (or whatever you like). The additional \cleardoublepage makes sure that there's an additional page flush (if necessary) to make sure the chapter starts on a recto page.

The approach is similar to that followed in Clear tableofcontents page in memoir.

-
all odd page are without number too. –  Regis da Silva Dec 20 '11 at 2:00
@RegisdaSilva: Look back at your original question. There is no mention that you want odd pages to have numbers and even pages to have no number. Is this what you want? That is, do you want odd pages to have numbers, but even pages have no number? Where should these numbers be? In the header, or the footer? And should this configuration hold for just the ToC? It helps being specific about these things, since a solution will be much more forthcoming that way. –  Werner Dec 20 '11 at 2:18
I want numbering on all pages except the tableofcontents, but this is not happening with your code. –  Regis da Silva Dec 20 '11 at 2:28
@RegisdaSilva: If I compile my code with a \chapter{Book tableofcontents without page number} \lipsum after \pagestyle{headings}, I get a 4-page document. Page 1 and 2 have no headings (and no page numbers), while page 3 and 4 have the regular plain (for chapter first pages) and headings headings. Do you want page 2 to have headings as well? –  Werner Dec 20 '11 at 2:52
yes!!!!!!!!!!!!!!!! –  Regis da Silva Dec 20 '11 at 3:25

I would combine \pagestyle and add \thispagestyle to the .tocfile, to have effect on the first page of the ToC.

\documentclass[a4paper]{book}
\usepackage{lipsum}
\begin{document}
% writes \thispagestyle{empty} into the .toc file, so here at the beginning
\pagestyle{empty}% switches to empty page style
\tableofcontents
\cleardoublepage% clear the page before changing back the page style
\pagestyle{headings}% switching back to the page style you use in your document

\protect is used to prevent expansion of \thispagestyle before it's written to the .toc file.
This is much cleaner and etoolbox`-free! –  Werner Dec 20 '11 at 7:21