# Chapters not starting on the same height

And I have no idea why ! Why in my example, do I have the first chapter ok, and the second that stand higher on the page ?

\documentclass[12pt]{report}

\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{fancyhdr}
\usepackage{microtype}
\usepackage[x11names]{xcolor}
\usepackage{tabularx}
\usepackage{colortbl}
\usepackage{titlesec}

%%%%%%%%%%%%%%%

\colorlet{titlecolour}{Aquamarine3}
\newlength\labelframewd
\settowidth{\labelframewd}{\lsstyle\scshape\small\MakeLowercase{\chaptername}}

\newsavebox\chaplabelbox%

\newcommand\chaplabel{\color{titlecolour}%
\begin{tabularx}{\linewidth}{c@{\enspace}X}
\lsstyle\scshape\small\MakeLowercase{\chaptername}\\
\cellcolor{titlecolour}\raisebox{-1ex}[5ex][20ex]{\color{black}\bfseries\fontsize{36}{40}\selectfont\thechapter} & \titlerule[2pt]
\end{tabularx}
}%

\titleformat{\chapter}[display]{\centering}
{\setlength{\tabcolsep}{0pt} \smash{\chaplabel}}%
{2ex}
{\thispagestyle{fancy}\vskip-10ex\hskip\labelframewd\fontsize{28}{32}\selectfont\bfseries}%

\titlespacing{\chapter}{0pt}{1.8\baselineskip}{10\baselineskip}
\renewcommand\thechapter{\arabic{chapter}}

%%%%%%%%%%%%%%%

\makeatletter
\renewcommand\part{%
\thispagestyle{fancy}%
\if@twocolumn
\onecolumn
\@tempswatrue
\else
\@tempswafalse
\fi
\null\vfil
\secdef\@part\@spart}

\renewcommand\chapter{
\thispagestyle{fancy}%
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}
\makeatother

%%%%%%%%%%%%%%

\begin{document}
\chapter{Test}
\pagebreak
\chapter{Nice Chapter}
\pagebreak

\end{document}


Output :

Warnings :

LaTeX Font Warning: Font shape OT1/cmr/m/n' in size <28> not
available (Font) size <24.88> substituted on input line 61.
LaTeX Font Warning: Font shape OT1/cmr/bx/n' in size <28> not
available (Font) size <24.88> substituted on input line 61.
LaTeX Font Warning: Size substitutions with differences (Font) up
11.12pt have occurred.


The culprit is your re-definition of \chapter – it interferes with the re-definition via titlesec. Furthermore, I don't understand you want a fancy page style on the first page of a chapter: what's the use of having the chapter title in the header on there page which contains, precisely, this chapter title?

In a general way, if you use titlesec, make all your re-definition through the package (the same is true for part).

Below is the result when I comment the re-deinition of \chapter. In my opinion, it would look better without the header rule.

\renewcommand\chapter{
\thispagestyle{fancy}%
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}


• This is perfect, thank you. Well, I have text only on the recto page, which will be 'fancy' and so that they all have a header rule (verso have figure, pagestyle is empty), and if every chapter break this continuity, I don't like it. – Paul Giroud May 25 '16 at 14:23
• There is something I don't understand : How do I control the position of the rule in the chapter head (\titlerule[2pt]). What if I want to make it higher ? – Paul Giroud May 25 '16 at 14:57
• You can add a \vskip some length just before titlerule. This will move only the horizontal rule. – Bernard May 25 '16 at 15:16