I using the book class for my thesis and I want to insert a "This page intentionally left blank" message on the left pages when using openright. However, I only want to display this message in the frontmatter of my document, and use the headers set by fancyhdr in the mainmatter on an otherwise potantially empty page. I'm using the code below, adapted from this answer:
\documentclass[11pt,openright]{book}
\makeatletter
\def\cleardoublepage{\clearpage\if@twoside%
\ifodd\c@page\else
\vspace*{5cm}
\begin{center}
This page intentionally left blank.
\end{center}
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi
}
\makeatother
\usepackage{fancyhdr}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[CE]{\textit{\MakeUppercase{My name}}}
\fancyhead[RE]{}
\fancyhead[LO]{}
\fancyhead[CO]{\textit{\MakeUppercase{\The title}}}
\pagestyle{fancy}
\title{The title}
\author{My name}
\date{\today}
\begin{document}
\maketitle
\frontmatter
\chapter{Abstract}
\mainmatter
\chapter{The first chapter}
\chapter{The second chapter}
\end{document}
I tried to put \if@mainmatter in different places in the definition of the cleardoublepage command, but I couldn't get it to work. Any help? Thanks.
\endgroupand\mainmatter. Otherwise, I don't get the message on the page after the abstract. I will wait a bit longer for an answer that changes the definition of the\cleardoublepagecommand and fits in the preamble. Otherwise I will accept your answer. Thanks! – avs Jun 21 '19 at 11:31