[Tex/LaTex] How to make the header and footer on the first page the same as on all subsequent pages

fancyhdr

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?

Best Answer

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