# how to put header (and footer) on title page with correct positioning?

I tried to use fancyhdr package and the result I have with the output is as shown here. The screenshot shows the junction between pages (bottom of) 3 and (top of) 4 (both header and footer being the same; with lfoot and lhead being "Lecture 1" and rfoot and rhead being "Handout 1").

As you might notice, both header and footer are placed leftwards (taking the page number along with them).

Also, they do not appear on the title page whereas unlike most other cases, I would like them to be present on it.

MWE below:

\documentclass[10pt]{article}

\usepackage{soul}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lfoot{Lecture 1}
\rfoot{Handout 1}

\usepackage[margin=0.5in]{geometry}
\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist
\title{\ul{Proper positioning of headers and footers}}
\usepackage{lipsum}
\begin{document}
\maketitle
\lipsum[4-57]
\end{document}

• did you try putting geometry package before fancyhdr? – Thruston Aug 16 '14 at 20:25

In order to get fancyhdr to obey your geometry settings you need to call geometry first.

And to get the title page to use the same style as the rest, use \thispagestyle after \maketitle.

\documentclass{article}
\usepackage[a4paper,margin=1in]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lfoot{Lecture 1}
\rfoot{Handout 1}
%\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
%\let\endchangemargin=\endlist
\title{Proper positioning of headers and footers}
\usepackage{lipsum}
\begin{document}
\maketitle
\thispagestyle{fancy}
\lipsum[4-57]
\end{document}


I used 1in margins because 0.5in is just too small. I also added a4paper but you can ignore that if you use another size. The top of the output looks like this:

Normally you use \thispagestyle to change the page style temporarily, so for eaxmple you might want to change to plain or empty for certain pages later in the document, but here I've made a temporary change to override the pagestyle that's set by \maketitle. Note that the page style in force at the end of the page is the one used (since the headers and footers are added by the output routine when it ships out a page).

• Indeed! These kinds of subtle aspects are difficult to grasp from the manual. Cheers! – Abhimanyu Arora Aug 16 '14 at 20:41
• Can one change the header and footer for say few pages in the document, say when handout 2 begins? – Abhimanyu Arora Aug 16 '14 at 20:48
• Strictly speaking new questions don;t belong in comments, but since this is more in the way of a clarification, I've updated the answer. – Thruston Aug 17 '14 at 18:34