On page 9 of the generated document, you can see that the section title is so long that is gets on two lines and overrides the chapter title. In some programming languages, I would think of including some kind of "truncate" version in my header definition. I also read things about having shorter versions of chapter/section title, (something like \sectionmark) , but this was not recognised by my compiler.
What would be a way to have a shorter title in header.
Code: Main.tex
%Preamble
\documentclass[a4paper,french,oneside,openright]{book}
\usepackage{afterpage}
\newcommand{\blankpage}{
\null
\thispagestyle{empty}
\addtocounter{page}{-1}
\newpage
}
\usepackage[french]{babel}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{tocloft,calc}
\renewcommand{\cftchappresnum}{Chapter }
\AtBeginDocument{\addtolength\cftchapnumwidth{\widthof{\bfseries Chapter }}}
\title{Title}
\author{Name}
\date{2020}
\begin{document}
\input{Pages/TitlePage.tex}
\input{Pages/Thanks.tex}
\tableofcontents
\pagestyle{fancy}
\lfoot{Title}
\rfoot{Page \thepage/\pageref{LastPage}}
\renewcommand{\headrulewidth}{0.0pt}
\renewcommand{\footrulewidth}{0.1pt}
\fancypagestyle{plain}{%
\fancyhf{}%
\fancyfoot[L]{Title}%
\fancyfoot[R]{Page \thepage/\pageref{LastPage}}%
\renewcommand{\headrulewidth}{0pt}% Line at the header invisible
\renewcommand{\footrulewidth}{0.1pt}% Line at the footer visible
}
\chapter{Introduction}
\section{Introduction}
\lipsum
\chapter{Chapter title}
\section{This section title is toooooooooooooooooooooooooooo long}
\lipsum
\chapter{Chapter title}
\section{SectionTitle}
\lipsum
\chapter{Chapter title}
\section{SectionTitle}
\lipsum
\chapter{Chapter title}
\section{SectionTitle}
\lipsum
\chapter{Chapter title}
\section{SectionTitle}
\lipsum
\chapter{Chapter title}
%\section{SectionTitle} %Testing what happens in table of contents when there is a chapter without section.
\lipsum
\chapter{Chapter title}
\section{SectionTitle}
\lipsum
\end{document}
Pages\TitlePage.tex
\begin{titlepage}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\HRule \[0.9cm]
\begin{center}
\textsc{\Huge Title}\[1cm]
\textsc{\LARGE Subtitle}\[1.5cm]
\end{center}
\HRule \[1.5cm]
\begin{center} \Large
\begin{tabular}{ l r }
\emph{Text} & Text\
\emph{Text} & Text
\end{tabular}
\end{center}
\vfill
\begin{center} \large
\begin{tabular}{\textwidth}{@{\extracolsep{\fill}} l r @{}}
\ Text & Text\
\ Text & Text\
\ Text & Text\
\ Text & Text\
\ Text & Text
\end{tabular}
\end{center}
\afterpage{\blankpage}
\end{titlepage}
Pages\Thanks.tex
\pagestyle{empty}
\part*{Thanks}
\blankpage