# What does this warning mean? (fancyhdr and headheight)

My LaTeX file compiles fine. However, in reading my .log file, I see many repeated instances of

Package Fancyhdr Warning: \headheight is too small

Looking for it in google, I found some 'fixes', but first I'd like to know what the error is about.

What is fancyhdr? What is \headheight? What does the error mean?

• Well, you compile your document , so you should know what fancyhdr is meant for, shouldn't you? ;-) headheight is the vertical space left for the page headers at the top of the page. The error just means that the setting is too small, i.e. the page header is squeezed. The geometry package has a nice sketch what headheight means, see page 3 of v5.6 manual, for example, please
– user31729
Aug 30, 2016 at 23:59
• Just add in the preamble the minimum measure that you advise. For example:  \setlength\headheight{24pt}  Aug 2, 2020 at 16:35
• It’s pretty common for people to start by copying someone else’s preamble—or even many different ones. My advice is usually to try to write a minimal template with only the packages you actually use. You’ll get fewer bugs that way. Aug 2, 2020 at 17:09
• @Davislor: People are often given a style file from their publisher or from an academic journal. They have to use that, and it's then reasonable for them to ask for help understanding it.
– user6853
Jul 13, 2021 at 15:10
• @BenCrowell You are correct. If that’s the situation, my advice would not apply. Jul 13, 2021 at 15:11

First of all, this is just a warning, which is different from an error.

• fancyhdr is a package that

pro­vides ex­ten­sive fa­cil­i­ties, both for con­struct­ing head­ers and foot­ers, and for con­trol­ling their use (for ex­am­ple, at times when LATEX would au­to­mat­i­cally change the head­ing style in use).

• \headheight is the (vertical) height associated with the header of the page. Where is this located at on the page? Here's a schematic (from the geometry package documentation):

The notation in the above image corresponds to the geometry settings, but is similar to the lengths used by fancyhdr.

• The warning mentions that the space currently allocated for the header is too small and should be enlarged. A more comprehensive view of the message will actually tell you what the suggested minimum height should be.

You can ignore this warning, but page layouts will be adjusted by fancyhdr automatically and therefore differ from one page to the next. Here's an example that highlights this:

\documentclass{article}

\usepackage{fancyhdr,lipsum}
\pagestyle{fancy}

\begin{document}

\lipsum[1-10]

\end{document}

Note how the header rule remains at the same height from one page to the next (the red arrow). However, the first line of text on the page is pushed down immediately following the incorrect \headheight page. fancyhdr adjusted this manually, as noted by the warning text:

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

to the preamble:

\documentclass{article}

\usepackage{fancyhdr,lipsum}
\pagestyle{fancy}

\begin{document}

\lipsum[1-10]

\end{document}