[Tex/LaTex] How to make pages after the first come out correctly with fancyhdr

fancyhdrheader-footer

I am trying to write a recommendation letter with a fancy heading at the top of the first page, using fancyhdr. I copy my code below.

The results are that the first page looks good but subsequent pages do not. Subsequent pages omit the logo (as desired) but leave enough space for it, and the text starts from the same place on every page. Starting from the second page, I would like the text to start higher.

It seems that the only code which could cause the text to appear lower is within the \fancypagestyle{firstpage}{…}, and I use \thispagestyle{firstpage} with the intent that this should only affect the first page — but this is not what happens when I compile and view my document.

I read related posts here and here, and attempted to modify my code based on what I read there, but without achieving the results I was looking for.

Thank you very much.

LaTeX code (which compiles):

\documentclass[11pt]{article}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{color,hyperref}
\usepackage{graphics}
\usepackage{times}
\usepackage{fancyhdr}
\usepackage{datetime}


\definecolor{darkblue}{RGB}{0,0,50}
\hypersetup{colorlinks,breaklinks,
            linkcolor=darkblue,urlcolor=darkblue,
            anchorcolor=darkblue,citecolor=darkblue}


%%%%%%%%%%%%%%%%%%date in format Sunday, October 25, 2011$$$
\usdate
\def\theday {\dayofweekname{\day}{\month}{\year}}
\def\mydate {\theday , \today}

%%%%%%%%%%return address%%%%%%%%%%
\def\myname     {Frank Thorne}
\def\mydeptname     {Department of Mathematics}
\def\myaffiliation  {University of South Carolina}
\def\mystreet       {1523 Greene Street}
\def\mycitystatezip {Columbia,\ SC\ \ 29208}
\def\myphone        {{\it Phone:} (803)404-4057 (home)}
\def\office     {(803)777-4224}
\def\fax        {{\it Fax:}(803)777-3783}
\def\email      {thorne@math.sc.edu}
\def\url        {http://www.math.sc.edu/$\sim$thornef} % NOTE: use $\sim$ for tilde
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%margins%%%%%%%%%%%%%%%%%%
\oddsidemargin   0in
\evensidemargin  0in
\topmargin  -0.75in
\textwidth   6.5in
\textheight  6.25in
\headwidth  \textwidth
\parindent      0ex %controls how the indentation of new paragraphs behaves
\parskip        6pt %controls the space between paragraphs
\headheight     1.25in
\headsep    1in %This controls how far below the letterhead the text of the letter will begin



\addtolength{\textheight}{.5in}
%%%%%%%%%%%%%%%%letterhead%%%%%%%%%%%%%%%%
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

%\thispagestyle{fancy}
\fancypagestyle{firstpage}{
\fancyhf{}
%%%usc logo
\fancyhead[L]{\resizebox{2.5in}{!}{
%\includegraphics{USC_Linear.jpg}
} \vspace{0.6in}}

%%%%%%%%%%return address on right%%%%%%%
\fancyhead[R]{
\parbox[t]{3.1in}{ \footnotesize   \em \vspace{0.5in}
                \myname \\
                \mydeptname   \\
                \myaffiliation \\
                \mystreet \\
                \mycitystatezip \\
                \email \\
\\ 
                \mydate
                }\hspace{-1.3in}
\vspace{0.2in}}
}

\begin{document}

\thispagestyle{firstpage}

Blah blah blah.


Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.

Blah blah blah.



\hspace{.5\textwidth}\parbox[t]{2.95in}{
            Sincerely,\\

            Frank Thorne\\
            Assistant Professor of Mathematics
           }

\vfill





\end{document}

Best Answer

If you don't set a proper head height, fancyhdr reports the following:

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

As such, the newly-set \headheight will be the same throughout the document. To avoid this, I've created the following minimal document that sets a consistent head height, adding a vertical space (gap) on the first page to simulate a larger header:

enter image description here

\documentclass{article}

\usepackage{fancyhdr,datetime,geometry,lipsum,graphicx}

%%%%%%%%%%%%%%%%%%date in format Sunday, October 25, 2011
\usdate
\def\theday {\dayofweekname{\day}{\month}{\year}}
\def\mydate {\theday , \today}

%%%%%%%%%%return address%%%%%%%%%%
\def\myname         {Frank Thorne}
\def\mydeptname     {Department of Mathematics}
\def\myaffiliation  {University of South Carolina}
\def\mystreet       {1523 Greene Street}
\def\mycitystatezip {Columbia,~SC \quad 29208}
\def\myphone        {\textit{Phone:} (803)404-4057 (home)}
\def\office         {(803)777-4224}
\def\fax            {\textit{Fax:}(803)777-3783}
\def\email          {thorne@math.sc.edu}
\def\url            {\texttt{http://www.math.sc.edu/~thornef}} % NOTE: use $\sim$ for tilde
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%margins%%%%%%%%%%%%%%%%%%
\geometry{
  margin = 1in,
  headheight = 13.5pt
}
\setlength{\parindent}{0pt} %controls how the indentation of new paragraphs behaves
\setlength{\parskip}{6pt} %controls the space between paragraphs

%%%%%%%%%%%%%%%%letterhead%%%%%%%%%%%%%%%%
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\pagestyle{fancy}%

\fancypagestyle{firstpage}{
  \fancyhf{}% Clear header/footer
  %%%usc logo
  \fancyhead[L]{\raisebox{\dimexpr-\height+\baselineskip}[0pt][0pt]{\includegraphics[width=2.5in]{example-image}}}
  %%%%%%%%%%return address on right%%%%%%%
  \fancyhead[R]{\leavevmode\footnotesize\itshape%
  \begin{tabular}[t]{l@{}}
    \myname \\ \mydeptname \\
    \myaffiliation \\ \mystreet \\
    \mycitystatezip \\ \email \\[\normalbaselineskip]
    \mydate
  \end{tabular}}
}

\begin{document}

\thispagestyle{firstpage}

\vspace*{8\baselineskip}

\lipsum[1-10]

\bigskip

\hspace{.5\textwidth}%
\begin{tabular}{@{}l}
  Sincerely, \\[2\normalbaselineskip]
  Frank Thorne \\
  \textit{Assistant Professor of Mathematics}
\end{tabular}

\end{document}

I've used geometry to adjust the page layout - it's just easier/more convenient.