I am trying to remove section names in headers. I am using fancyhdr
package. When I try to specify new text in \lhead{}
, text is just overlayed on section name. P.S. 3 hours of googling did not help.
Here is the section of code that I want to make work.
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{Student ID: 1123123/1}
\chead{University}
\rhead{}
\lfoot{}
\cfoot{}
\rfoot{Page \thepage\ of \pageref{LastPage}}
UPDATE: \fancyhf{}
is not working – nothing changes.
Edit by Speravir – Example taken from http://pastebin.com/W6V9GUCs
(link given by OP in comment to Gonzalo’s answer):
\documentclass{report}
\usepackage[a4paper]{geometry}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{fullpage, graphicx, wrapfig, subcaption, setspace}
\usepackage[T1]{fontenc}
\usepackage[font=small, labelfont=bf]{caption}
\usepackage{fourier}
\usepackage[protrusion=true, expansion=true]{microtype}
\usepackage[english]{babel}
\newcommand{\HRule}[1]{\rule{\linewidth}{#1}}
\onehalfspacing
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% HEADER & FOOTER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{Student ID: 1123123/1}
\fancyhead[C]{University}
\fancyfoot[R]{Page \thepage\ of \pageref{LastPage}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TITLE PAGE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\title{ \normalsize \textsc{SUBTITLE}
\\ [2.0cm]
\HRule{0.5pt} \\
\LARGE \textbf{\uppercase{TITLE}}
\HRule{2pt} \\ [0.5cm]
\normalsize \today
}
\date{}
\author{\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\
SID: \\
University \\
Department of Life Sciences
}
\maketitle
\pagebreak
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% BODY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{\textsc{SECTION}}
\end{document}
Best Answer
To clear all predefined fields in the header and footer, use
\fancyhf{}
before assigning your headers and footers. Also, it's preferable to use the modern syntax\fancyhead
,\fancyfoot
:After a MWE was provided, it was clear that the problem was the use of the
fullpage
package without theheadings
option; since headers/footers were used and the option was not passed, the header and the text area overlapped. The solution is then to loadfullpage
in the following mannerBy the way, since the
geometry
package is also used, I think there's some redundancy; you can use only one of those packages, depending on the desired page layout.I also made some other changes to the document provided as MWE; particularly, I used the
sectsty
package to use small caps for the section titles (this was being made manually), and suppressed the incorrect use of several consecutive\\
commands (producing underfull bad boxes).I would also suggest not (ab)using the
\title
and\author
commands to design a full titlepage (this could have undesired effects in bookmarks, for example), but to design a customized titlepage.The code showing the changes mentioned: