[Tex/LaTex] How to get rid of page numbers on \part pages

formattingpage-numberingpartssectioning

I am writing a book of puzzles in LaTeX, using the book class. The \thispagestyle{empty} command has successfully removed page numbers on all the \chapter pages, but so far no combination of \newpage and \thispagestyle{empty} before and/or after a \part command has been able to remove the page number at the center of the bottom of the \part page.

\newpage
\tableofcontents
\thispagestyle{empty}
\newpage
\thispagestyle{empty}
\newpage
\thispagestyle{empty}
\part{}
\thispagestyle{empty}
\chapter{}
\thispagestyle{empty}

The code above produces a table of contents page, then a blank page, then a \part page, then a blank page, then a \chapter page. There are no page numbers except on the \part page, and it appears to be incredibly reluctant to disappear, as you can see from the number of empty page commands surrounding the \part command!

Any help is appreciated.

Thank you.

Best Answer

The first page of a part or chapter explicitly uses the page style plain. If you want to change this behaviour, you can make plain to mean the same as empty by adding the following lines to your preamble:

\makeatletter
\let\ps@plain\ps@empty
\makeatother

After this, page style plain is no longer available. A more flexible solution is to define

\makeatletter
\let\origps@plain\ps@plain
\newcommand\MakePlainPagestyleEmpty{\let\ps@plain\ps@empty}
\newcommand\MakePlainPagestylePlain{\let\ps@plain\origps@plain}
\makeatother

Now you can equate plain with empty using \MakePlainPagestyleEmpty and revert it again by \MakePlainPagestylePlain.

Note that you can also switch the default page style using

 \pagestyle{empty}

and later switch back to

 \pagestyle{headings}

Try the following code:

\documentclass{book}
\makeatletter
\let\origps@plain\ps@plain
\newcommand\MakePlainPagestyleEmpty{\let\ps@plain\ps@empty}
\newcommand\MakePlainPagestylePlain{\let\ps@plain\origps@plain}
\makeatother
\usepackage{blindtext}
\begin{document}
\pagestyle{empty}
\MakePlainPagestyleEmpty
\tableofcontents
\part{part}
\chapter{chapter}
\Blindtext

% Revert to standard behaviour of the book class
\chapter{chapter}
\MakePlainPagestylePlain
\pagestyle{headings}
\Blindtext
\end{document}