Reproducing the Chapter-Picture Style of the Legrand Orange Book
Update redefining \chapterlinesformat
Since KOMA-Script version 3.19 the command \chapterlinesformat
can be redefined to change the layout of chapter titles that have no prefix line. Now it is possible to set a different entry for the page headings or to use the starred versions of the chapter title command. Chapter titles with more than one line are possible too.
The following example uses open=any
to show that it also works on left handed pages.
\documentclass[open=any]{scrbook}[2015/10/03]
%\providecommand*\Ifthispageodd{\ifthispageodd}% needed up to and including KOMA-Script version 3.27, see https://komascript.de/faq_deprecatedif
\usepackage{blindtext}% dummy text
\usepackage{tikz}
\usetikzlibrary{positioning}
\RedeclareSectionCommand[
beforeskip=1sp minus 1sp,
afterskip=4\baselineskip plus .5ex minus .5ex
]{chapter}
\newcommand*\chapterimageheight{.5\paperwidth}% height of the chapter images
\newcommand*\chapterboxvoffset{1cm}% offset from text bottom to image bottom
\newcommand*\chapterboxhoffset{1cm}% offset from outer text margin to outer box border
\newcommand*\chapterboxwidth{\textwidth+1cm}% width of the chapter box
\newcommand*\chapterboxsep{1em}% inner sep of the chapter box
\definecolor{ocre}{RGB}{243,102,25}
\colorlet{chapterbordercolor}{ocre}
\tikzset{
chapterbox/.style={
line width=2pt,rounded corners=20pt,draw=chapterbordercolor,
fill=white,fill opacity=.5,text opacity=1,
inner sep=\chapterboxsep,
font=\usekomafont{disposition}\usekomafont{chapter}\huge
}
}
\makeatletter
\newcommand*\@chapterimage{example-image.pdf}
\newcommand*\chapterimage[1]{\renewcommand*\@chapterimage{#1}}
\renewcommand\chapterlinesformat[3]{%
\vspace*{\dimexpr-1in-\headsep-\headheight-\topmargin-1ex\relax}%
\Ifthispageodd
{\hspace*{\dimexpr-1in-\oddsidemargin\relax}%
\tikzset{chapterboxpos/.style={
anchor=south east,
above left= \chapterboxvoffset and \chapterboxhoffset of bb.south east
}}%
}
{\hspace*{\dimexpr\textwidth+1in+\oddsidemargin-\paperwidth\relax}%
\tikzset{chapterboxpos/.style={
anchor=south west,
above right= \chapterboxvoffset and \chapterboxhoffset of bb.south west
}}%
}%
\makebox[0pt][l]{%
\parbox[b][\chapterimageheight][b]{\paperwidth}{%
\begin{tikzpicture}[inner sep=0pt,outer sep=0pt]
\node[use as bounding box,minimum width=\paperwidth,minimum height=\chapterimageheight](bb){};
\node[anchor=center] at (bb.center)
{\includegraphics[width=\paperwidth,height=\chapterimageheight]
{\@chapterimage}};
\node[chapterbox,chapterboxpos]
{\parbox{\dimexpr\chapterboxwidth-\chapterboxsep*2\relax}{\@hangfrom{#2}{\raggedchapter#3}}};
\end{tikzpicture}%
}%
}%
}%
\makeatother
\begin{document}
\chapterimage{chapter_head_1}
\tableofcontents
\addchap*{Unnumbered Chapter without entry in table of contents}
\Blindtext
\addchap{Unnumbered Chapter with entry in table of contents}
\Blindtext[2]
\chapter{Numbered chapter}
\blindtext
\chapter[Numbered chapter with long title]{Numbered chapter that is really long and needs more than one line}
\chapterimage{chapter_head_2}% change the image
\colorlet{chapterbordercolor}{purple!80!black}% change the bordercolor
\Blindtext[10]
\blinddocument
\end{document}
Run twice (because \Ifthispageodd
) to get