This question already has an answer here:

I'm trying to use \ifthenelse from the ifthen package to vary the size of \headheight within a document. I'd like this to be larger for the first page and then smaller for each subsequent page.

I had thought I could accomplish this using code like the following in my preamble.


Unfortunately, that's not working for some reason. Below is some code that illustrates what I'm trying to do.


%%%% Margins %%%%


%%%% Packages %%%%


%%%% Headers/Footers %%%%

\renewcommand\headrule{{\color{BrickRed} \hrule height 1pt width\headwidth}}

\lhead{\ifthenelse{\thepage = 1}
              {\textcolor{light-gray}{My Name} \\ [4ex] \vspace{36pt} \textcolor{light-gray}{Telephone Number}}
              {\textcolor{light-gray}{My Name}}}

\rhead{\ifthenelse{\thepage = 1}
              {\textcolor{light-gray}{Page \thepage \ of \zpageref{LastPage}} \\ [4ex] \vspace{36pt}
               \textcolor{light-gray}{Email Address}}
              {\textcolor{light-gray}{Page \thepage \ of \zpageref{LastPage}}}}

\chead{\ifthenelse{\thepage = 1}
              {{\large\bfseries MY NAME, TITLE} \\
               Address Line 2 \\
               Address Line 3 \\
               Address Line 4 \\ [1ex]}


%%%% Main Document %%%%


Some text


More text


This code produces the desired output. The drawback though is that I need to manually specify where the first page break should occur and then reset the headheight using:


Is there some way to automate this, using \ifthenelse or some other means? Setting things manually when the contents of the first page change doesn't require much effort, but I'd like to understand what's going wrong and how to do this properly.

marked as duplicate by Joseph Wright Nov 1 '14 at 22:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.