1

Various versions of this question have been asked before, but they either have special issues (such as a title page) or I simply can't understand the answer.

Here is the start of my latex:

\documentclass[12pt]{article}
\usepackage{fancyhdr}

\textwidth = 7 in
\textheight = 9.5 in
\oddsidemargin = -0.25 in
\evensidemargin = 0.0 in
\topmargin = -0.25 in
\headheight = 0.0 in
\headsep = 0.0 in
\parskip = 0.1 in
\parindent = 0.0 in

\pagestyle{fancy}
\lhead{}
\rhead{my name}
\cfoot{\thepage}
\renewcommand{\headrulewidth}{0.4pt}

\begin{document}

The result is that on the first page the header overwrites the text, but the page number is in a good position. On all remaining pages the header is fine, but the page number is placed too low. Can anyone offer assistance please?

  • Hi and Welcome, a little hint, package geometry is better suited to specify the margins. Be sure to load package fancyhdr after setting the margins. – Johannes_B Sep 12 '14 at 15:21
2

When you compile your code, you get this warning:

Package Fancyhdr Warning: \headheight is too small (12.0pt): 
 Make it at least 14.49998pt.
 We now make it that large for the rest of the document.
 This may cause the page layout to be inconsistent, however.

Hence you have to give proper headheight and better way of doing this is through geometry package:

\documentclass[12pt]{article}
\usepackage{fancyhdr}

\usepackage{geometry}
\geometry{text={7in,9.5in}
,headheight=15pt
}

%\textwidth = 7 in
%\textheight = 9.5 in
%\oddsidemargin = -0.25 in
%\evensidemargin = 0.0 in
%\topmargin = -0.25 in
%\headheight = 0.0 in
%\headsep = 0.0 in
\setlength{\parskip}{0.1in}
\setlength{\parindent}{0.0in}

\pagestyle{fancy}
\lhead{}
\rhead{my name}
\cfoot{\thepage}
\renewcommand{\headrulewidth}{0.4pt}

\usepackage{blindtext}

\begin{document}
  \Blinddocument
\end{document}

For your case, ideal will be to use

\geometry{text={7in,9.5in}
,headheight=15pt
,headsep=0.1in
,includehead
}

enter image description here

  • Do you mind changing parskip and parindent to be set using setlength? – Johannes_B Sep 12 '14 at 20:23
  • @Johannes_B No mind at all ;-). You know the edit button, Please go on. I would comment both the lines as I don't like changing those values at all, personally. :-) – user11232 Sep 12 '14 at 22:35

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.