3

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

  • didn't you get a warning from the package that \headheight is too small? – David Carlisle Sep 15 '15 at 17:24
5

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

6

When you process your document you should see a warning like this one:

Package Fancyhdr Warning: \headheight is too small (0.0pt): 
Make it at least 13.59999pt.

Since the \headheight is set to 0pt, because of the fullpage package, the header and the text clash. Increase \headheight as suggested: this can be done by loading fullpage with the headings option:

\usepackage[headings]{fullpage}

But then, due to your settings, your headheight is still too small:

Package Fancyhdr Warning: \headheight is too small (12.0pt): 
Make it at least 13.59999pt.

So you need to also add something like

\setlength\headheight{13.6pt}

Or load the geometry package instead of fullpage and customize the page layout using this package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.