[Tex/LaTex] Header problem with book class

formattingheader-footer

It seems I have a problem with the headers using the book class. On every chapter when the text is too long the chapter text and the section text merge. Also I don't know how I could make them lower case instead of upper case.

The packages I use can be seen below:

\documentclass[12pt,oneside]{book}
\usepackage[english]{babel} 
\usepackage{graphicx} 
\usepackage{natbib}
\usepackage{appendix}
\usepackage{microtype}
\usepackage[utf8]{inputenc}
\usepackage[english]{isodate}
\usepackage[parfill]{parskip} 
\usepackage[colorlinks,pagebackref,pdfpagelabels=true,plainpages=false]{hyperref} 
\usepackage{fancyhdr} 
\usepackage{makecell} 
\usepackage{amsthm} 
\usepackage{pdflscape} 
\usepackage{multirow} 
\usepackage{mdwlist} 

I then include each chapter like this:

\begin{document}
\input{title.tex}
\tableofcontents
\input{overview/overview.tex}
\input{background/background.tex}
\input{chapter1/chapter1.tex}
\end{document}

Here is a bit of code from background:

\chapter{Introduction to Simulation}\label{part:background}

\section{A Simple Example}\label{sec:sim_example1} 

There is of course content in between. First page of the chapter seems fine however second page of the chapter produces the text below but mangled. It looks a lot better below.

2.1. A SIMPLE EXAMPLEPART 2. INTRODUCTION TO SIMULATION

Best Answer

The package fancyhdr needs some code after loading it, in order to define precisely what goes in the header.

In oneside format it's not very common to have both the chapter title and the section title, because the header will be too crowded. You probably have somewhere the declaration \pagestyle{fancy}, otherwise the setting would be the standard, that prints on the header only the chapter title and the page number:

2. INTRODUCTION TO SIMULATION                            4

If you want the section title and the page number in the header, then

\usepackage{fancyhdr}
\pagestyle{fancy} % enable fancy page style
\renewcommand{\headrulewidth}{0pt} % comment if you want the rule
\fancyhf{} % clear header and footer
\fancyhead[L]{\rightmark} % section title on the left
\fancyhead[R]{\thepage}   % page number on the right

If you want the chapter title, change the fifth line into

\fancyhead[L]{\leftmark} % chapter title on the left

There's no practical way to make chapter and section titles to coexist, except to put them on two lines.