I have setup my document using a chapters folder that contains single .tex files for each chapter. In the main file, I have done all the formatting. When I first included some sample chapters, everything looked fine.
However, as soon as the first chapter exceeded the first page, the formatting of that chapter was destroyed. The first page of the following chapter used the supposed format (see screenshot).

I used the fancyhdr package to do the formatting. Here is the source code of the main .tex file:
% packages and general setup
\documentclass[12pt,twoside]{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\graphicspath{{images/}}
\usepackage[a4paper, width = 150mm, top = 25mm, bottom = 20mm, bindingoffset = 6mm]{geometry}
\AtBeginDocument{\renewcommand{\bibname}{References}}
%----------------------------------------------------------------------------------------------------------
% package for Chapter Headings
\usepackage[T1]{fontenc}
\usepackage{titlesec, blindtext, color}
\definecolor{gray75}{gray}{0.75}
\newcommand{\hsp}{\hspace{20pt}}
\titleformat{\chapter}[hang]{\Huge\bfseries}{\thechapter\hsp\textcolor{gray75}{|}\hsp}{0pt}{\Huge\bfseries}
%----------------------------------------------------------------------------------------------------------
% package and setup for header and footer
\setlength{\headsep}{-15mm} % reduce space between header and textblock
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{%
\markboth{#1}{}}
\fancyhf{}
\fancypagestyle{plain}{% the preset of fancyhdr
\fancyhf{} % clear all header and footer fields
\fancyhead{}
\fancyhead[RO, LE]{\ifnum\value{chapter}>0 \thechapter \hspace{1pt} \leftmark \fi}
\fancyfoot{}
\fancyfoot[LE, RO]{\thepage}
\fancyfoot[LO, RE]{J. Berlemann}
}
%----------------------------------------------------------------------------------------------------------
% package used for underscores (solving the issues with underscores in bibtex)
\usepackage[strings]{underscore}
%----------------------------------------------------------------------------------------------------------
% package used to prevent floats to be in other sections
% use "\FloatBarrier" command to make sure a float stays in place
\usepackage[section]{placeins}
%----------------------------------------------------------------------------------------------------------
% multi-row for tables
\usepackage{multirow}
%----------------------------------------------------------------------------------------------------------
% package for list of symbols
\usepackage[printonlyused]{acronym}
%----------------------------------------------------------------------------------------------------------
\begin{document}
\pagenumbering{Roman}
\input{titlepage}
\setcounter{page}{1}
\chapter*{Abstract}
\addcontentsline{toc}{chapter}{Abstract}
\cleardoublepage\pagenumbering{arabic}
\chapter{Introduction}
\input{chapters/01_Introduction}
\chapter{Another Example Chapter}
\input{chapters/02_State of the Art}
\bibliographystyle{acm}
\bibliography{references}
\end{document}
What can be the possible reason for that? Is it due to the fancyhdr package? I am using overleaf to write the document.
Thanks in advance!
\headseplike\setlength{\headsep}{10pt}to reduce the space between the header and the textblock. – Simon Dispa Apr 04 '22 at 14:14\setlength{\headsep}{-15mm}. You can set it to 0mm, but if you set it a negative number it'll pull the text over the headerrule. BTW you can setheadsep = 0mmright in the geometry package options; you don't need to use a separate command. Not sure why you had that there though, there may be something else you want to accomplish which should be done differently. – frabjous Apr 04 '22 at 14:22\setlength{\headsep}{10pt}command solved the problem. Now, I have uge spaces before each chapter starts. This is why I initially placed the -15mm command. Is there a way to reduce the space above the chapter heading? – Jannik Ber Apr 04 '22 at 14:26