[Tex/LaTex] Problem with fancy header

fancyhdrheader-footer

I have a problem when using the fancy header (\pagestyle{fancy}). When I include it, the text overlaps in the upper part as shown in this image:
enter image description here

I tried to use the geometry package, but it didn't work. I think the problem should be in this part of the code:

\fancypagestyle{plain}{
  \renewcommand{\headrulewidth}{0.0pt}
  \fancyfoot{}
  \fancyfoot[RO, LE]{\thepage}
  \fancyhead{}
}

\pagestyle{fancy}

I also include the whole code here, in case there is any other problem:

\documentclass[pdftex,11pt,openright,headsepline]{book}

\usepackage{paralist}       % List environment
\usepackage{color}      % For colored text
\usepackage{times}
\usepackage{amsfonts}       % Additional math fonts
\usepackage{amsmath}        % Math symbols
\usepackage{latexsym}
\usepackage{graphicx}       % For including images
% \usepackage{listings}     % If listings are needed
% \usepackage{mydefs}       % Some of our own definitions
% \usepackage{wrapfig}      % To wrap images
% \usepackage{algorithmic}  % Nice algorithm environment
% \usepackage{algorithm}
\usepackage{fancyhdr}       % Produce the nice header
\usepackage{fullpage} % Use the full page




\usepackage{textcomp}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage[hidelinks]{hyperref}
\usepackage{mathtools}



% Change the appearance of the header. Here \MakeUppercase is hard-coded, so renewing this command allows to elegantly change the header appearance.
\renewcommand{\MakeUppercase}{\scshape}

% Set the headings' appearance in the ``fancy'' pagestyle
\fancyhead{}
\fancyhead[RO, LE]{\leftmark}
\fancyfoot{}
\fancyfoot[RO, LE]{\thepage}

% The first pages shall be empty, even no page numbering 


\begin{document}
\pagestyle{empty} % even no page number

\fancypagestyle{plain}{
  \renewcommand{\headrulewidth}{0.0pt}
  \fancyfoot{}
  \fancyhead{}
}

% Title page, modify accordingly 
\input{title.tex}
\cleardoublepage

\input{abstract.tex}

%% Input here any acknowledgements
%\input{ack.tex}
%\cleardoublepage
%\newpage

% % Chapter-pages etc. use the ``plain'' pagestyle - since we don't want to have a heading at all at chapter-pages, redefine plain accordingly. Don't forget the page number. 
\fancypagestyle{plain}{
  \renewcommand{\headrulewidth}{0.0pt}
  \fancyfoot{}
  \fancyfoot[RO, LE]{\thepage}
  \fancyhead{}
}

\pagestyle{fancy}
\pagenumbering{Roman}

% Insert table of contents
\tableofcontents

% Insert list of figures
\listoffigures
\cleardoublepage

% Insert list of tables
\listoftables
\cleardoublepage

\newpage

\pagenumbering{arabic}

%% ----------------------------------------------------------------------------
% Actual text comes here - defer it to other files and use \input{bla.tex}, ..
%% ----------------------------------------------------------------------------
\input{intro.tex}
\input{relatedwork.tex}
\input{materialsandmethods.tex}
\input{experimentsandresults.tex}
\input{discussion.tex}
\input{conclusion.tex}


%% ----------------------------------------------------------------------------
% If Appendix is needed
%% ----------------------------------------------------------------------------
\appendix
\input{appendix.tex}

%% ----------------------------------------------------------------------------
% Bibliography is stored in references.bib file, and can often be found
% online on webpages like dblp.uni-trier.de
%
% To include it in your thesis, run
%  pdflatex main
%  bibtex main
%  pdflatex main
%  pdflatex main
%
% This ensures all references are done correctly.
%% ----------------------------------------------------------------------------

\bibliographystyle{plain}
\bibliography{/home/alvaroeg/SemesterProject/Report/Bibliography/SlidingBoundaries}

\end{document}

Thanks in advance

Best Answer

I see no reason whatsoever for loading the fullpage package. It's a package thought for very different purposes than typesetting a thesis.

Since it sets \headheight and \headsep both to zero, it's obvious that you don't want this. Neither using the headings option is satisfying.

Beware that \renewcommand{\MakeUppercase}{\scshape} is a gross mistake: remove it from your code as soon as possible. I add in the code below the good method for getting the header in small capitals.

There is no headsepline option to the book class; openright is default and pdftex should never be specified.

You can use geometry and get the same effect as fullpage, but with correct headers.

\documentclass[11pt]{book}
\usepackage[margin=1in,headheight=13.6pt]{geometry}

\usepackage{lipsum} % for filler text

\usepackage{fancyhdr}


% Set the headings' appearance in the ``fancy'' pagestyle
\pagestyle{fancy}
\fancyhf{}
\fancyhead[RO, LE]{\scshape\nouppercase{\leftmark}}
\fancyfoot[RO, LE]{\thepage}

% The first pages shall be empty, even no page numbering
\fancypagestyle{plain}{%
  \renewcommand{\headrulewidth}{0.0pt}%
  \fancyhf{}%
}

\begin{document}

\chapter{Title}
\section{Title}

\lipsum[1-20]

\end{document}

enter image description here

Related Question