I have several chapters in a book. I want a fancy header above the first chapter, so on this page the chapter number and title should be typeset a little lower than usual (below the header). All subsequent pages and chapter titles should be typeset normally.
\documentclass[11pt]{book}
\usepackage{lipsum}
\usepackage{fancyhdr}
\fancypagestyle{firstpage}{
\fancyhf{}
\fancyhead{
\begin{minipage}{\textwidth}
{\sffamily Some information\\More information\\Another note\\This is a rather lengthy header\\foo\\bar\\buz\\blah\\beep}
\end{minipage}
}
}
\begin{document}
\chapter{A first chapter}
\thispagestyle{firstpage}
This is the first chapter. This page should include a fancy header
with some information, and as such the chapter number and title should
appear a little lower than for other chapters.
\lipsum[1-12]
\chapter{A second chapter}
This is the second chapter. It should be formatted normally, i.e., the
chapter number and title should appear at the top of the page, since
there is no special header here
\lipsum[13-19]
\end{document}
There are two problems:
- The first chapter is not typeset low enough. It overlaps with the header.
- All subsequent pages are typeset much lower. The bottom margin is almost 0, and the top margin is huge.
LaTeX outputs a warning too:
Package Fancyhdr Warning: \headheight is too small (12.0pt):
Make it at least 133.13336pt.
We now make it that large for the rest of the document.
This may cause the page layout to be inconsistent, however.
This seems to be the problem, but I don't understand how to fix it. If I put
\setlength{\headheight}{134pt}
inside the \fancypagestyle{firstpage}{...} declaration, then the first chapter title is typeset lower, and all subsequent pages look fine. This is close to what I want. However, the bottom margin of the first page is still almost 0, and so the text at the end of the first page goes all the way to the bottom. How to fix this last problem?
This does not appear to be a duplicate. There are two related questions:
However, in those cases setting \headheight seems to solve it, and they do not appear to experience my latter problem.

\patchcmd{\chapter}{plain}{firstpage}{}{}? If I understand correctly, this will cause all my chapter titles to have a fancy header, but I only wanted this for the first chapter. This is already achieved by putting\thispagestyle{firstpage}below the first\chapter. If I remove the\patchcmd{\chapter}{plain}{firstpage}{}{}I get exactly what I wanted. :-) – Malte Skoruppa Oct 21 '14 at 21:24\thispagestyleafter\chapter; the patch is intended to do precisely that. – egreg Oct 21 '14 at 21:24\thispagestyle, but your solution additionally shows an elegant way to do this for all chapters. :-) – Malte Skoruppa Oct 21 '14 at 21:28bookclass, but inmemoirclass not works, what are the changes to be made to work in the memoir class? – juanuni May 24 '15 at 18:15fancyhdrwithmemoir, which uses a different method for setting header and footer. – egreg May 24 '15 at 19:11