Consider the following piece of code:
\documentclass{scrartcl}
\usepackage{ifthen}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{}
\chead{
\ifthenelse{\equal{\thepage}{1}}{}{
\textbf{foo}\\
\textbf{bar}\\
\textbf{baz}
}
}
\rhead{}
\lfoot{}
\cfoot{}
\rfoot{}
\renewcommand{\headrulewidth}{0pt}
\begin{document}
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
\newpage
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
\newpage
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
\end{document}
This is how pages 2 and 3 of the example look like:
as you can see the rows of x are not at the same height. Additionall baz does not start where foo and bar do – it is a bit more at the left.
Do you have any idea what the problem might be?
Best Answer
This is a well known and documented behavior of
fancyhdr
. If at the first usage of the defined header the package finds that the header is vertically bigger than\headheight
, it will issue a message and change\headheight
for the subsequent pages.You will find the following message in your
.log
file:Thus you know that you need to set:
in your preamble (rounding is better):