# My footer disappears when I increase headheight

I have created a custom simple layout with the fancyhdr package. Because the header I must use is somewhat big, LaTeX instructed me to increase the headheight to at least a minimum value. The problem is, the footer gets moved down until it eventually disappears.

Here is a MWE, where the footer can still be seen at the bottom:

\documentclass[12pt,a4paper,oneside]{article}
\usepackage[utf8]{inputenc}
\usepackage[landscape,left=3cm,right=3cm,top=3cm,bottom=3cm]{geometry}
\usepackage{fancyhdr}

\pagestyle{fancy}

\lfoot{}
\cfoot{This is the footer}
\rfoot{}
\renewcommand{\footrulewidth}{0pt}

\begin{document}

First line of the document.

Second line of the document.

\end{document}


Now change 60pt for 80pt and compile again. Goodbye, footer!

Is there any way to fix this? I can't change the header, and I must have both header and footer.

Edit: The amount of support is incredible, 3 answers plus comments in one hour! Upvoting you all, and choosing most simple and idiot-proof solution as correct. Thanks!

-
Use the geometry options to change the headheight. –  Ulrike Fischer Mar 1 '13 at 9:28
Welcome to TeX.sx! –  Peter Jansson Mar 1 '13 at 9:41
@PeterJansson Thanks! Quite a nice place to be in. –  user2061099 Mar 1 '13 at 11:34

You may want to fiddle around with the includeheadfoot option that comes with the geometry package (and adjust your geometry settings accordingly to suit your needs):

\documentclass[12pt,a4paper,oneside]{article}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}

\pagestyle{fancy}

\lfoot{}
\cfoot{This is the footer}
\rfoot{}
\renewcommand{\footrulewidth}{0pt}

\begin{document}

First line of the document.

Second line of the document.

\end{document}


-
you can add the option showframe to the geometry-package. It sould be easier to manually set the sizes. –  ralfix Mar 1 '13 at 9:37

First of all, you should leave to geometry all settings about page dimensions; setting \headheight post facto will ruin all the computations made by geometry.

Second, your setting of \headheight to 80pt is incompatible with the top margin you want, because the default head separation is 25pt and

80pt + 25pt = 105pt = 3.69cm

Your header is computed by fancyhdr to almost 71pt, actually; if you want to fit the header and have a top margin of 3cm, just do the exact computation for the headsep:

headheight=72pt, % give a bit more room


So finally you'll have

\usepackage[a4paper,landscape,
left=3cm,right=3cm,top=3cm,bottom=3cm,
\usepackage{fancyhdr}


Here's a picture, where I used a slightly larger paper size, in order to show precisely what happens:

\usepackage[paperwidth=31.7cm,paperheight=23cm, % larger paper
layoutwidth=29.7cm,layoutheight=21cm, % A4 landscape
layouthoffset=1cm,layoutvoffset=1cm, % 1cm to crop on all sides
left=3cm,right=3cm,top=3cm,bottom=3cm,
\usepackage{fancyhdr}


The crop marks show the "real" paper size which is A4 landscape.

-

Here is an exakt solution, without playing around to find the correct size.

You have to calculate the totalheight of the page, that is the phyical paper height, on DIN A4 it's 21cm, minus the top margin, in your example that is 3cm, minus the headheight, which is 80pt in your example, minus the bottom margin, which is 3cm, minus the headsep and finally plus the footskip.

By default, headsep and footskip are the same, so they cancel each other in this example.

80pt corresponds to 2.8169014084507cm, according to wikibooks.

So your totalheadheight should be 12.1830985915493cm, say 12.183cm which sould be precise enough.

Now use geometry with the following options:

\usepackage[landscape,left=3cm,right=3cm,top=3cm,includeheadfoot,totalheight=12.183cm,showframe]{geometry}

Do not set the bottom margin directly with bottom=..., it is included in the calculation.

\documentclass[12pt,a4paper,oneside]{article}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}

\pagestyle{fancy}

\lfoot{}
\cfoot{This is the footer}
\rfoot{}
\renewcommand{\footrulewidth}{0pt}

\begin{document}

First line of the document.

Second line of the document.

\end{document}


Edit : added footskip and headsep to the calculation

-