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?

  • 1
    Just add in the preamble the minimum measure that you advise. For example: ``` \setlength\headheight{24pt} ```
    – oroverdino
    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.
    – Davislor
    Aug 2, 2020 at 17:09
  • 5
    @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.
    – Davislor
    Jul 13, 2021 at 15:11

1 Answer 1


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).

    (from the fancyhdr README)

  • \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):

    enter image description here

    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:

    enter image description here

    \fancyhead[C]{\rule{.5\textwidth}{4\baselineskip}}% Add something BIG in the header

    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.

    Correcting for this we add

    \setlength{\headheight}{52pt}% ...at least 51.60004pt

    to the preamble:

    enter image description here

    \fancyhead[C]{\rule{.5\textwidth}{4\baselineskip}}% Add something BIG in the header
    \setlength{\headheight}{52pt}% ...at least 51.60004pt

Note, load or place your geometry settings before loading fancyhdr/selecting \pagestyle{fancy}.

  • you do the Oppostite of your note : settings before pagestyle!
    – droid192
    Jun 24, 2019 at 8:35
  • 4
    @qrtLs: I specifically refer to geometry settings, which is not used in my code.
    – Werner
    Jun 24, 2019 at 15:05
  • Note if you come to this answer because you are writing in Markdown (or RMarkdown) and using pandoc to convert to TeX, you can include headheight = 52pt in your YAML underneath of your geometry: line (make sure to tab in once!)
    – mikoontz
    Aug 25, 2021 at 15:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .