I am having some issues with setting my thesis formatting and I may need some assistance with the fancyhdr package.
The problem is, I made by own style from a combination of two templates and there must be some inherited settings from each of them (and each different), but I am unable to locate them. This is what the pages look like:
As you see, the LEFT pages have the page number as a footer under a line and the RIGHT pages have the page number as a header and with no line. I want to have the chapter name in the headers and page numbers in the footers.
This is a part of my preamble:
\documentclass[a4paper,12pt,twoside,openright, english]{book}
% INSTAL THE PACKAGES I WILL MOST LIKELY NEED
\usepackage{siunitx}
\usepackage{cleveref}
\usepackage{latexsym, syntonly, textcomp, amsmath, caption, float}
\usepackage{graphicx}%[pdftex]
\usepackage{subcaption}
%\usepackage{subfig}
\usepackage{wrapfig}
\usepackage{epstopdf}%[outdir=./Figures/]{epspdfconversion}
\usepackage{blindtext, setspace, rotating}
\usepackage{natbib, longtable}
\usepackage[toc,page]{appendix}
\usepackage{babel}
\usepackage{bm}
\usepackage{longtable}
\usepackage{multirow}
\usepackage{threeparttable} %for footnote in tables
\usepackage[hyphens]{url} %break line within long url
\usepackage{lipsum}
\usepackage{titlesec}
\usepackage{fancyhdr}
\usepackage{sidecap}
\usepackage[top=2.3cm, inner=3.2cm, bottom=2.4cm, outer=2.3cm]{geometry}
\usepackage[bookmarks]{hyperref}
\usepackage[strings]{underscore}
% LOWER CASE CHAPTER AND SECTION HEADINGS
\renewcommand{\chaptermark}[1]{%
\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{%
\markright{\thesection\ #1}}
\fancyhf{} % delete current header and footer
\fancyhead[LO,RE]{\bfseries\thepage}
%\fancyhead[LO]{\bfseries\rightmark}
%\fancyhead[RE]{\bfseries\leftmark}
\fancyhead[LE]{\emph\textit{\nouppercase{\rightmark}}}
\fancyhead[RO]{\emph\textit{\nouppercase{\leftmark}}}
\fancyhead[RE]{}
\fancyhead[LO]{}
\fancyfoot[LE]{\thepage}
\fancyfoot[RO]{\thepage}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0.5pt}
\addtolength{\headheight}{3pt} % space for the rule
\fancypagestyle{plain}{%
\fancyhead{} % get rid of headers on plain pages
\renewcommand{\headrulewidth}{0.5pt} % and the line
}
\onehalfspacing
\tableofcontents
\clearpage
\listoffigures
\addcontentsline{toc}{chapter}{\listfigurename}
\listoftables
\addcontentsline{toc}{chapter}{\listtablename}
\clearpage
What have I missed? I thought I have all the settings.
Best Answer
There is at least a
\pagestyle{fancy}
missing. The normal pages still use pagestyleheadings
. Note that\pagestyle{fancy}
must be used at least once before the redefinition of\chaptermark
and\sectionmark
, because the first call of\pagestyle{fancy}
also redefines this commands.I am not sure about the desired page layout. Maybe
Code (without all the unrelated stuff):
If there should be a headsepline on plain pages too, remove the change of
\headrulewidth
inside the definition of page stylefancyplain
.Additional remark: In your code the
\addcontentsline{toc}{chapter}{\listfigurename}
and\addcontentsline{toc}{chapter}{\listtablename}
are at the wrong place. They would add the page numbers of the last pages of LoF and LoT to the table of contents. You could use packagetocbibind
instead.