TeX - LaTeX Asked by josinalvo on November 30, 2020
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?
First of all, this is just a warning, which is different from an error.
fancyhdr
is a package that
provides extensive facilities, both for constructing headers and footers, and for controlling their use (for example, at times when LATEX would automatically change the heading 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):
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}
fancyhead[C]{rule{.5textwidth}{4baselineskip}}% Add something BIG in the header
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.
Correcting for this we add
setlength{headheight}{52pt}% ...at least 51.60004pt
to the preamble:
documentclass{article}
usepackage{fancyhdr,lipsum}
pagestyle{fancy}
fancyhead[C]{rule{.5textwidth}{4baselineskip}}% Add something BIG in the header
setlength{headheight}{52pt}% ...at least 51.60004pt
begin{document}
lipsum[1-10]
end{document}
Note, load or place your geometry
settings before loading fancyhdr
/selecting pagestyle{fancy}
.
Correct answer by Werner on November 30, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP