Page LayoutTwo page chapter title + background images. Minor TOC problem

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
hyb
Posts: 1
Joined: Sat Oct 24, 2020 4:58 pm

Two page chapter title + background images. Minor TOC problem

Post by hyb »

Hi all,

I am working on a book-type document in which I would like to start each chapter in an open-right manner with the title on the right-hand page (odd). However, I would also like to add a background image to both the left (even) and right page (odd) that contains the chapter number and title.

My current approach is to force open-left, and add the background figures with a combination of titlesec and eso-pic with \titleformat.

This approach works well, however an unwanted side-effect is that the TOC now always refers to the left (even) page. I would however like the TOC to point to the right (odd) page that contains the chapter number and title. See below two figures to clarify this issue.
chapterpage.png
chapterpage.png (57.38 KiB) Viewed 3122 times
toc.png
toc.png (14.44 KiB) Viewed 3122 times
My current approach in a MWE:

Code: Select all

\documentclass[10pt,openany,twoside,titlepage]{book}

% change openright to openleft. i.e. chapter starts on even page
\makeatletter
\renewcommand*\cleardoublepage{\clearpage\if@twoside
  \ifodd\c@page \hbox{}\newpage\if@twocolumn\hbox{}%
  \newpage\fi\fi\fi}
\makeatother

% include some required packages
\usepackage{blindtext}
\usepackage{titlesec, titletoc, xcolor}
\usepackage{graphicx}
\usepackage{eso-pic}		  
\usepackage{hyperref}

\usepackage{geometry}
\geometry{inner=40mm}

% new command for even/odd background figures
\newcommand\BackgroundPicEven
{ \includegraphics[height=\paperheight , width=\paperwidth]{example-image-a} }

\newcommand\BackgroundPicOdd
{ \includegraphics[height=\paperheight , width=\paperwidth]{example-image-b} }

% add two-page title format as chapter title-page. Uses clearpage
\titleformat{\chapter}
	[block]
	{ \flushright \thispagestyle{plain} }
	{ } 
	{40 pt}
	{\LARGE \bfseries \AddToShipoutPicture*{\BackgroundPicEven}
	\clearpage
	\AddToShipoutPicture*{\BackgroundPicOdd}
	Chapter \thechapter \\ \vspace{50mm}  }
	[\newpage]

\titleformat{\section}[hang]{\large\bfseries}{\thesection}{1em}{}

\begin{document}
\pagestyle{plain}
\tableofcontents

\chapter{First very long chapter title} \label{chapters:01}
\section{First section}
\blindtext[6]

\chapter{Second very long chapter title} \label{chapters:02}
\section{First section}
\blindtext[10]

\chapter{Third very long chapter title} \label{chapters:03}
\section{First section}
\Blindtext[3]

\end{document}
I have tried to find a solution for this, but so far without success. Does anyone have any suggestions? In my actual document I am using scrbook class, so I am open to alternatives that use scrbook as well.

Cheers,
Hyb

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply