3

I am having trouble typesetting multi-line headers using fancyhdr The header on the first page behaves differently than the header on subsequent pages. The first page header has no depth, but produces a greater vertical displacement on subsequent pages.

Here is a sample tex file to illustrate the difficulty

\documentclass{article}

\usepackage{fancyhdr}

\chead{line 1\\line 2\\line 3\\line 4\\line 5\\line 6\\line 7\\line 8}

\cfoot{footer}

\fancypagestyle{plain}{}

\pagestyle{fancy}

\begin{document}
\thispagestyle{fancy}
page 1 \newpage
page 2 \newpage
page 3 


\end{document}
9

You get a warning when you compile your MWE:

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

Adding \setlength{\headheight}{96pt} fixes the problem.

1

And the log-file is telling you

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

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.