2

Consider the code

\documentclass[12pt]{book}
\usepackage{pgfpages}
\pgfpagesuselayout{2 on 1}
\usepackage{lipsum}

\begin{document}
\tableofcontents

\cleardoublepage % Force break to an odd-numbered page.

\newpage
\thispagestyle{empty}
\lipsum[1]
\addtocontents{toc}{TOC entry.}
\end{document}

which produces the TOC output:

enter image description here

QUESTION: How may I remove the header on the extra page produced by \cleardoublepage so that an entirely blank page appears here at the end of the Contents page?

Thank you.

1 Answer 1

1

Look at the definition of \cleardoublepage (by adding \ShowCommand\cleardoublepage somewhere in your document and examining the .log):

\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
    \hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}

It does the following, sequentially:

  • Issues \clearpage to flush all pending floats, then
  • Checks whether your document is set in twoside mode (book is set in twoside mode by default);
    • If you are in twoside mode, it checks if the current page - the new page - is odd or even (via \ifodd\c@page). If it is, it does nothing, because \cleardoublepage wants to end on an odd page. If, however, the page is even, it sets an empty box (via \hbox{} - this is literally just something invisible) and then issues a \newpage to get to an odd page.
    • Additional invisible content is set if you're also in twocolumn mode, since a \newpage could flush you to the top of the second column, not the next page.

So, you could perform this process manually knowing your circumstance:

% Mimic \cleardoublepage
\clearpage
\mbox{}% Set something invisible (\hbox{} would also work)
\thispagestyle{empty}
\clearpage

Or you could patch \cleardoublepage in the preamble using etoolbox:

\usepackage{etoolbox}
\patchcmd{\cleardoublepage}% <cmd>
  {\newpage}% <search>
  {\thispagestyle{empty}\newpage}% <replace>
  {}{}% <success><failure>

Note that the patch will be global, unless you save the original definition and restore it as needed, or insert an adjustable command rather than \thispagestyle{empty} before the first \newpage.

1
  • Thank you kindly for these very helpful solutions.
    – DDS
    Jan 10, 2023 at 1:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .