0

I need help in the following, I am trying to make all pages facing the chapter openings contain a gray of x% when they do not contain text (exclusive condition) only for the mainmatter section. The frontmatter and the backmatter are excluded from this condition.

the image below shows the result in two openings

imagen de muestra

I get this result by reviewing the opening of each chapter and placing the instruction at the end of the chapter

\pagecolor{black!10}

and then at the beginning of the chapter

\pagecolor{white}

to retake the color white

But what I am looking for is that this can be achieved automatically, since it is common to modify the texts and the box widths, which leads to having to constantly check the chapter openings

  • 1
    Please show us a short compilable code (that is usual here!) we can play with ... – Kurt Jan 9 at 1:31
1

Something like this?

\documentclass{book}

\usepackage{blindtext}
\usepackage{xcolor}

%% Adapted from fancyhdr, section 14
%% http://ctan.triasinformatica.nl/macros/latex/contrib/fancyhdr/fancyhdr.pdf
\makeatletter
\renewcommand*{\cleardoublepage}{\clearpage\if@twoside \ifodd\c@page\else
    \hbox{}\pagecolor{black!10}%
    \thispagestyle{empty}%
    \newpage%
    \if@twocolumn\hbox{}\newpage\fi\fi\fi\pagecolor{white}}
\makeatother


\begin{document}
\chapter{One}
\blindtext\blindtext

\chapter{Two}
\blindtext\blindtext

\chapter{Three}
\blindtext\blindtext

\end{document}

enter image description here

  • Jesse, it is perfect. thank you!!! – Imago Mundi Jan 9 at 13:28

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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