I wrote the following code in order to design a chapter title but there is two things I did not succeed to do.
\documentclass{book}
\title{Titre de la thèse}
\author{moi}
\date{\today}
\usepackage{lipsum}
\usepackage[top = 2cm, left = 2cm, right = 2cm, bottom = 2cm, head = 14pt, headsep = .5cm]{geometry}
\usepackage{tikz}
\def\docColor{blue}
\usepackage{titlesec}
\titleformat{\chapter}
{\color{white}\sffamily\Huge\bfseries}
{}{0pt}
{\begin{tikzpicture}[overlay, remember picture]
\fill[\docColor] (current page.north west) -- (current page.north east)
-- ++ (0, -6cm) -- ++ (-\paperwidth, -2cm)
node[pos=.5, fill=black!60, text=white, minimum width=6cm,
inner sep=3mm]
{\sffamily\textsc\chaptername~\thechapter}
-- cycle;
\end{tikzpicture}
}
\titlespacing*{\chapter}{0pt}{0cm}{4cm}
\begin{document}
\maketitle
\chapter{Un premier chapitre, Un premier chapitre, Un premier chapitre}
\lipsum[1-5]
\chapter{Un second chapitre, Un second chapitre, Un second chapitre}
\lipsum[1-5]
\end{document}
1) I would like to remove the indentation. As you can see, if the title span over two lines they are not left justified.
2) I would like to shift on the right the title in order to put a picture on the left side. I would like to do something like
\parbox[c]{.2\textwidth}{a picture}
\parbox[c]{.8\textwidth}{Chapter title}
Best Answer
Here's one possibility:
Simply comment out a spurious blank space after
\end{tikzpicture}
.I used the
explicit
option fortitlesec
and then used two side-by-syde\node
s of predefined width; one for the image, the other one for#1
(the actual title).I also defined a variant using
numberless
for starred chapters (such as the table of contents, the list of figures, etc).The code (adjust the settings according to your needs):