# Header disappears after second section

I am trying to set up the header for my thesis, so that odd pages have chapter names and even pages have section names.

This seems to work ok in the first chapter, however for the remaining chapters the chapter header only appears in the first section. In the remaining sections only the section header appears, but not the chapter header.

Could anyone help with this?

Sorry about the long preamble, but I have no idea what causes this.

\documentclass[twoside,12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage[top=3cm,bottom=2cm,left=3cm,right=3cm,asymmetric]{geometry}

%dummy text
\usepackage{lipsum}

\usepackage[nottoc,numbib]{tocbibind}

\usepackage{fancyhdr}
\pagestyle{fancy} % Sets fancy header and footer
\fancyfoot{} % Delete current footer settings
\fancyhf{}
\fancyhead[LE,RO]{\thepage} % Page number in left on even pages and right on odd pages

\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{\thechapter.\ #1}}{}}
\fancyhead[RE]{\itshape\nouppercase{\leftmark}} % Chapter in the right on even pages
\fancyhead[LO]{\itshape\nouppercase{\rightmark}\chaptermark}     % Section in the left on odd pages

%% Math packages
\usepackage{bm}
\usepackage[normalem]{ulem}
\usepackage{mathtools}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\newcount\colveccount
\newcommand*\colvec[1]{
\global\colveccount#1
\begin{pmatrix}
\colvecnext
}
\def\colvecnext#1{
#1
\ifnum\colveccount>0
\\
\expandafter\colvecnext
\else
\end{pmatrix}
\fi
}

\newtheoremstyle{mystyle}
{0.7em} % Space above
{0.7em} % Space below
{} % Body font
{} % Indent amount
{ ---} % Punctuation after theorem head
{.5em} % Space after theorem head
{} % Theorem head spec (can be left empty, meaning normal')

\theoremstyle{mystyle}
\newtheorem*{definition}{Definition}
\newtheorem*{remark}{Remark}
\newtheorem*{theorem}{Theorem}

%nomenclature %doesn't work yet
%\usepackage{nomencl}
%\makenomenclature
%\renewcommand{\nomname}{List of Symbols}
%\renewcommand{\nompreamble}{The next list describes several symbols that will be later used within the body of the thesis}

%% Figures and graphics
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{multirow}

%% Draw flow diagrams
\usepackage{tikz}
\usetikzlibrary{fit,calc,trees,arrows.meta,positioning,arrows,chains,shapes.geometric,decorations.pathreplacing,decorations.pathmorphing,shapes,matrix,shapes.symbols}
\tikzstyle{box} = [rectangle,draw,very thick,rounded corners, text centered,text width = 10em, minimum height = 3em]
\tikzstyle{line} = [draw, -latex']

%algorithm environment
\usepackage[titlenumbered,ruled]{algorithm2e}
\makeatletter
\renewcommand{\@algocf@capt@plain}{above}% formerly {bottom}
\makeatother

%hyperlinks and back referencing in format "(page #)"
\renewcommand\backreftwosep{, }
\renewcommand\backrefsep{, }
\renewcommand*{\backrefalt}[4]{%
\ifcase #1%
\or (page:~#2)%
\else (pages:~#2)%
\fi%
}

%epigraph
\usepackage{epigraph}

%subappendix
\usepackage{appendix}
\usepackage{chngcntr}
\usepackage{etoolbox}
\AtBeginEnvironment{subappendices}{
\chapter*{Appendix}
\counterwithin{figure}{section}
\counterwithin{table}{section}
}

% double spacing.
\usepackage{setspace} % Now set to spacing = 1, only used in the tixz flow diagram

%Table format
\usepackage{tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\renewcommand\tabularxcolumn[1]{m{#1}}

%% Custom commands
\newcommand{\red}[1]{\textcolor{red}{#1}}
\newcommand{\green}[1]{\textcolor{green}{#1}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Wass}{\mathcal{W}}
\newcommand{\etal}{\textit{et al.}}
\newcommand{\varA}[1]{{\operatorname{#1}}}
\newcommand{\norm}[1]{\left\lVert#1\right\rVert}

%\usepackage{xcolor}
%\definecolor{light-gray}{gray}{0.9}

%%%% STARTS HERE

\begin{document}

\newpage
{
\tableofcontents
}

\newpage

%\mbox{}

%\nomenclature{$c$}{Speed of light in a vacuum inertial frame}
%\nomenclature{$h$}{Planck constant}
%
%\printnomenclature

\chapter{Temporal dynamics at the cell level}\label{sect:tempdyncell}

\lipsum[1-4]

\paragraph{Experimental conditions ---}

The experiments were designed to test the dynamic response of intracellular states in response to variations in the external ammonium abundance, including the run-out, starvation and a subsequent ammonium shock.
The experimental data include
%
\lipsum[1-4]
%

\paragraph{Regulation of nitrogen uptake ---}

We now give an outline of the interactions and the dynamic behaviour of the nitrogen system. Further biochemical details will be provided in the next section during the presentation of the mathematical model.

\lipsum[3-8]

\section{Results}

\subsection{Mechanistic model of nitrogen assimilation}

\lipsum[2-8]

\paragraph{Definition of system boundaries ---}

\lipsum[4-8]

\end{document}

• Isn't \tikzstyle outdated? – user31729 Apr 12 '18 at 15:49
• With dummy text it works well – Adam Gosztolai Apr 12 '18 at 15:50
• Ok, I managed to reproduce the error using dummy text. Please see above. – Adam Gosztolai Apr 12 '18 at 16:05

You are setting the chaptermark to empty by calling \chaptermark in every second header - remove it.

\documentclass[twoside,12pt]{report}

\usepackage{lipsum}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyfoot{}
\fancyhf{}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}}

\begin{document}

\tableofcontents
\newpage

\chapter{Temporal dynamics at the cell level}
\label{sect:tempdyncell}

\lipsum[1-4]

\paragraph{Experimental conditions ---}

The experiments were designed to test the dynamic response of intracellular states in response to variations in the external ammonium abundance, including the run-out, starvation and a subsequent ammonium shock.
The experimental data include
%
\lipsum[1-4]
%

\paragraph{Regulation of nitrogen uptake ---}

We now give an outline of the interactions and the dynamic behaviour of the nitrogen system. Further biochemical details will be provided in the next section during the presentation of the mathematical model.

\lipsum[3-8]

\section{Results}

\subsection{Mechanistic model of nitrogen assimilation}

\lipsum[2-8]

\paragraph{Definition of system boundaries ---}

\lipsum[4-8]

\end{document}
`
• excellent! Thank you very much. This has saved a lot of time! – Adam Gosztolai Apr 12 '18 at 17:09