3

This question: How do I write “This page intentionally left blank.” in memoir with custom chapter styles? tried for an answer to the question of how to write something on blank pages, but it does not write anything on blank pages around the \part{partname} command

an answer in the question was to use

\cleartooddpage[\vspace*{\fill}\centering BLANK PAGE \vspace*{\fill}]

but that must be called for every blank page, I'd like all blank pages to get the text.

\documentclass[openright]{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

%\cleartoevenpage[\vspace*{\fill}\centering BLANK PAGE \vspace*{\fill}]
\makeatletter \def\clearforchapter{\clearpage\if@twoside \ifodd\c@page\else \hbox{}\vfill\begin{center}This page intentionally left blank.\end{center}\vfill \thispagestyle{cleared}%
\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}\makeatother


\begin{document}
Text before a part
\part{bob}
\chapter{the}
\chapter{cool}
\chapter{duck}
\end{document}

Has many blank pages, but not all are marked with text

  • Add a small complete example that can be used for tests. I e.g. have neither the will nor the time to assemble one from various snippets in older questions/answers. – Ulrike Fischer May 29 at 8:56
  • See the definitions for \cleartorecto, \cleartoverso , they both use the cleared page style. BTW: why do people want to add this page left intentionally blank? I've never understood that. – daleif May 29 at 8:59
  • @daleif To show that it wasn't left blank by mistake. – Thorbjørn E. K. Christensen May 29 at 9:50
3
+50

There seem to be three (four) macros at play here (judging from your example code).

First, \cleardoublepage, which is the standard LaTeX command for clearing pages in two-sided documents. It is used before the \part in your document.

Second (and third), \clearforchapter, which is memoir's command for using the correct page for a chapter heading. However this macro is defined to be either \cleartorecto, \clearpage, or \cleartoverso if any of openright, openany, or openleft was used, respectively (the default is openright). A less wrong change would be to add the intentionally-empty page text in these macros, so if you happen to change the open... option, your document won't be messed up. The answer you linked to happen to work because OP didn't use any option, so openright was used by default (and the redifinition was done based on \cleartorecto).

Fourth, \partpageend, which is used by memoir after a \part.

I also added, for convenience, a \clearpagetext command which shows from which of these macros it was called, just for bookkeeping. You can (and should :-) remove that from your document. That said, here is the code:

\documentclass[openright]{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\makeatletter

\def\clearpagetext#1{%
  \vfill
  \begin{center}%
    This page was intentionally left blank by \texttt{\string#1}.
  \end{center}%
  \vfill}

\if@openleft
  \def\cleartoverso{\clearpage\if@twoside
    \ifodd\c@page\hbox{}%
    \clearpagetext\cleartoverso% <--
    \thispagestyle{cleared}%
    \newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\else
  \if@openright
    \def\cleartorecto{\clearpage\if@twoside
      \ifodd\c@page\else\hbox{}%
      \clearpagetext\cleartorecto% <--
      \thispagestyle{cleared}%
      \newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
  \fi
\fi

\def\cleardoublepage{\clearpage\if@twoside
  \ifodd\c@page\else\hbox{}%
  \clearpagetext\cleardoublepage% <--
  \thispagestyle{cleared}%
  \newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}% (Yes, this is the same as \cleartoverso)

\def\partpageend{\afterpartskip
  \ifm@mnopartnewpage
  \else
    \if@twoside
      \if@openright
        \null
        \clearpagetext\partpageend% <--
        \thispagestyle{afterpart}%
        \newpage
      \fi
    \fi
  \fi
  \if@tempswa
    \twocolumn
  \fi}

\makeatother

\begin{document}
Text before a part
\part{bob}
\chapter{the}
\chapter{cool}
\chapter{duck}
\end{document}

The document structure will look like this (behold my fabulous ASCII art):

|---------------|   |---------------|
| Text before   |   | This page was |
| a part        |   | intentionally |
|               | → | left blank by |
|       1       |   | \cleardoublepage. |% <-- Overfull \hbox
|---------------| ↙ |---------------|
|---------------|   |---------------|
|     Part I    |   | This page was |
|      Bob      |   | intentionally |
|               |   | left blank by |
|       3       |   | \partpageend. |
|---------------|   |---------------|
|---------------|   |---------------|
| Chapter 1     |   | This page was |
| the           |   | intentionally |
|               |   | left blank by |
|       5       |   | \cleartorecto |
|---------------|   |---------------|
|---------------|   |---------------|
| Chapter 2     |   | This page was |
| cool          |   | intentionally |
|               |   | left blank by |
|       7       |   | \cleartorecto |
|---------------|   |---------------|
|---------------|
| Chapter 3     |
| duck          |
|               |
|       9       |
|---------------|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.