# Reproducing the Chapter-Picture Style of the Legrand Orange Book

I'm trying to reproduce the Chapter-Picture style of The Legrand Orange Book but with the scrbook class. Since the picture and chapter title is set by fancyhdr I can not just use the same code, as scrbook does not work well with the template. Hence I'm trying to reproduce this part. Till now, I'm able to insert the picture and draw the orange box with some text. However I don't know how to make this working that I can use it as a function that sets the title automatically.

Edit: Is it actually needed or good practice to use tikz for this kind of things?

\documentclass[a4paper]{scrbook}
\usepackage{tikz}
\usepackage{xcolor}
\definecolor{ocre}{RGB}{243,102,25}

\begin{document}

\begin{tikzpicture}[remember picture,overlay]
\node at (current page.north west)
{\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north west,inner sep=0pt] at (0,0) {\includegraphics[width=\paperwidth]{pic}};
\draw[anchor=west] (5cm,-9cm) node [line width=2pt,rounded corners=15pt,draw=ocre,fill=white,fill opacity=0.5,inner sep=15pt]{\strut\makebox[13cm]{}};
\draw[anchor=west] (5.3cm,-9.1cm) node {\huge\sffamily\bfseries\color{black}1. Title of a Chapter\strut};
\end{tikzpicture}};
\end{tikzpicture}
\vspace*{10cm}

Content of the chapter.

\end{document}


## 2 Answers

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}

\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

Here is a solution

\documentclass[a4paper]{scrbook}
\usepackage{tikz}
\usepackage{xcolor}
\definecolor{ocre}{RGB}{243,102,25}

\newcommand{\mychapheader}[2][]{%  #1 chapter's number #2 title of chapter
\begin{tikzpicture}[remember picture,overlay]
\node at (current page.north west)
{\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north west,inner sep=0pt] at (0,0) {\includegraphics[width=\paperwidth]{pic}};
\draw[anchor=west] (5cm,-9cm) node [line width=2pt,rounded corners=15pt,draw=ocre,fill=white,fill opacity=0.5,inner sep=15pt]{\strut\makebox[13cm]{}};
\draw[anchor=west] (5.3cm,-9.1cm) node {\huge\sffamily\bfseries\color{black}#1 #2\strut};
\end{tikzpicture}};
\end{tikzpicture}
\vspace*{10cm}
}
\makeatletter
\renewcommand*{\@@makechapterhead}[1]{% for numbered chapter
\mychapheader[\thechapter.\ ]{#1}}

\renewcommand*{\@@makeschapterhead}[1]{%  for unnumbered (stared) chapter
\mychapheader{#1}}
\makeatother

\begin{document}
\chapter*{Title of chapter}

Content of the chapter.
\chapter{Title of chapter}

Content of the chapter.

\end{document}