2

I'm using this solution provided here to clear the pagestyle when blank pages are introduced due to the usage of the openright option in the report class and the \cleardoublepage command:

\let\origdoublepage\cleardoublepage
\newcommand{\clearemptydoublepage}{\clearpage{\pagestyle{empty}\origdoublepage}}
\let\cleardoublepage\clearemptydoublepage

However, besides clearing the pagestyle, I'd like to display a note in the middle of the page. I've tried with eso-pic and tikz (to get it centered, taking the left and right margins into account):

\let\origdoublepage\cleardoublepage
\newcommand{\clearemptydoublepage}{
\clearpage{\pagestyle{empty}\AddToShipoutPictureBG*{
 \begin{tikzpicture}[overlay]
  \pgfmathsetmacro{\correct}{((\rmargin-\lmargin)/(2*28.453)}
  \node[font=\normalfont] at ($(current page.center)+(\correct,0)$) {\blanknote};
 \end{tikzpicture}
}
\origdoublepage}}
\let\cleardoublepage\clearemptydoublepage

Since \AddToShipoutPictureBG* gets executed before \origdoublepage, which is in fact \cleardoublepage, the note is added to the blank page, if inserted, or to the first page of the next chapter. I'd like to avoid the latter behaviour, i.e. not to execute \AddToShipoutPictureBG* if \origdoublepage does nothing.

I'm using eso-pic instead of background because \NoBgThispage is not working at the moment, and I use it to create other backgrounds, as exposed in this question. But I'm open to other approaches.

MWE (the incorrect behaviour is shown in page 5):

\documentclass[a4paper,titlepage,11pt,twoside,openright]{report}
\usepackage{lipsum}
\usepackage{eso-pic}
\def\lmargin{3.5cm}
\def\rmargin{1.5cm}
\def\blanknote{This page intentionally left blank}
\usepackage[left=\lmargin, right=\rmargin]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc,positioning}

\let\origdoublepage\cleardoublepage
\newcommand{\clearemptydoublepage}{
\clearpage{\pagestyle{empty}\AddToShipoutPictureBG*{
 \begin{tikzpicture}[overlay]
  \pgfmathsetmacro{\correct}{((\rmargin-\lmargin)/(2*28.453)}
  \node[font=\normalfont] at ($(current page.center)+(\correct,0)$) {\blanknote};
 \end{tikzpicture}
}
\origdoublepage}}
\let\cleardoublepage\clearemptydoublepage

\begin{document}
Introduction text...
\chapter{First}  \lipsum[1-9]
\chapter{Second} \lipsum[10-12]
\chapter{Third}  \lipsum[15]
\end{document}
1
4

I think you're making it a lot more complicated than needed, \cleardoublepage is already generating the page: you just need to add text, no need for hooking into the output routine shipout.

\documentclass[a4paper,titlepage,11pt,twoside,openright]{report}
\usepackage{lipsum}

\def\lmargin{3.5cm}
\def\rmargin{1.5cm}
\def\blanknote{This page intentionally left blank}
\usepackage[left=\lmargin, right=\rmargin]{geometry}

\makeatletter
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
 \thispagestyle{empty}%
 \hbox{}\vfill\centerline\blanknote\vfill\hbox{}\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother

\begin{document}
Introduction text...
\chapter{First}  \lipsum[1-9]
\chapter{Second} \lipsum[10-12]
\chapter{Third}  \lipsum[15]
\end{document}
2
  • Certainly an straight forward solution... Thank you for providing it! It works perfect for single line notes. However, it ignores \par commands in the \blanknote. How should I avoid it? I tried with \hbox{}\vfill\centerline\mbox{\blanknote}\vfill\hbox{} but it is not centered. – U.Martinez-Corral Sep 27 '14 at 5:05
  • 1
    @U.Martinez-Corralchange \centerline\blanknote to \begin{center}\blanknote\end{center) (which is better latex anyway;-) – David Carlisle Sep 27 '14 at 8:58

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.