I am using the background package to add a background to each page. I want a different background for odd and even pages, which is why I use \AddEverypageHook
. However, AddEverypagehook
works on all pages, including empty pages. I want it to only add a background if the page is not empty. Therefore, empty pages from using \cleardoublepage
should not have a background. I load the emptypage package to remove headers and footers from those pages, but I also want to remove backgrounds. Maybe it should check if the pagestyle
is empty
? Here is my code so far:
\documentclass{book}
\usepackage{stix2, lipsum, ifthen, emptypage}
\usepackage[tracking]{microtype}
\usepackage[
paperwidth = 6 in,
paperheight = 9 in,
margin = 0.75 in,
bindingoffset = 0.125 in
]{geometry}
\usepackage[
contents={},
opacity=1,
scale=1.5,
color=blue!90
]{background}
\AddEverypageHook{
\ifthenelse{\isodd{\value{page}}}
{\backgroundsetup{contents = {The background package}}}
{\backgroundsetup{contents = {Version 2.1}}}
\BgMaterial
}
\begin{document}
\tableofcontents
\chapter{My chapter}
\lipsum[1-5]
\end{document}