16

is it possible to define different \headerheight for head and foot respectively? For example, there is a logo image in the header which needs a large \headerheight and only text is in foot which needs a small \headerheight. Or does it have two variables to control the heights of foot and head respectively?

Martin Scharrer
  • 262,582
warem
  • 3,239

2 Answers2

22

if you want to see your page layout with the given values, then print it:

\documentclass[twoside]{article}
\usepackage{layout}
\begin{document}

\layout

\end{document}

enter image description here

10

The height of the header is given by \headheight (not \headerheight). The distance between the baseline of the header and the top of the page text is then given by \headersep.

The height of the footer is defined differently. The dimension \footskip states in what distance the baseline of the footer is set to the bottom of the page text. Have a look at the manuals of fancyhdr and geometry, both show a nice drawing explaining all page related dimensions.

If you use fancyhdr for your header and footer it tells you automatically which dimension is to small and to what value you have to set it. This can then be done using geometry:

\documentclass{article}
\usepackage[head=30pt,foot=<..>]{geometry}
\usepackage{fancyhdr}

\fancyhead{}
\fancyfoot{}
\fancyhead[c]{\Huge LOGO}
\fancyfoot[c]{Some normal text}
\pagestyle{fancy}
% Disable header and footer rules
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

\begin{document}
 Text ...
\end{document}

Without the head= setting fancyhdr showed the following warning:

Package Fancyhdr Warning: \headheight is too small (12.0pt): 
 Make it at least 30.0pt.
 We now make it that large for the rest of the document.
 This may cause the page layout to be inconsistent, however.
lockstep
  • 250,273
Martin Scharrer
  • 262,582
  • @Martin defining the values for head and foot in geometry does work. thanks. i have another question. how can i know the exact height value, e.g., 30pt in your example? one way is that i don't define \headheight then i get the value from the warning. however, i generate tex source files of calculate sheets from my own program. it is a bundle of files. if i update the height value manually, it will be depressing. i can get the height value by \settototalheight\headheight{\maxof{\leftheadercalc}{\rightheadercalc}{\midheadercalc}}. so how can i set this value to head in geometry? – warem Feb 13 '11 at 14:01
  • @Martin due to character limit, i have to split my comment into two pieces. in above comment, \leftheadercalc, \rightheadercalc, \midheadercalc are newcommand definition of the real content of head. in tex, how to set value to a variable especially it is in preamble. – warem Feb 13 '11 at 14:07
  • @warem: Funny geometry should work. However AFAIK it stoes sets the head= value in \headheight and foot= in \footskip. Check its manual again for the details. – Martin Scharrer Feb 13 '11 at 14:13
  • @Martin what is the meaning of "AFAIK"? on the other hand, i found i had made a concept mistake. the foot height is controlled by footskip.:( – warem Feb 14 '11 at 09:26
  • @waren: AFAIK = As Far As I Know; and IMHO = In My Humble Opinion. And I state that the footer height is controlled by \footskip in my answer. – Martin Scharrer Feb 14 '11 at 09:52
  • @Martin \footskip means the distance from the bottom of the last line of text in the body to the bottom of the footer. it doesn't control footer height. there is \footheight in LaTeX2.09 but it doesn't exist in current release. so how to define footer height now? – warem Feb 14 '11 at 14:29
  • Yes @warem, that is what I wrote in my answer: "The dimension \footskip states in what distance the baseline of the footer is set to the bottom of the page text." There is no direct dimension which controls the foot height. You need to set \footskip to a large enough number and reduce \textheight appropriately. – Martin Scharrer Feb 14 '11 at 15:14
  • @Martin it seemed that there is no way to get correct \footskip by tex itself. then i have to update the values for my bundle of files manually.:( – warem Feb 15 '11 at 01:57
  • @warem: If you want to set the \footskip automatically then you should have asked this as part of your question. Maybe you should open a new one asking about this. – Martin Scharrer Feb 15 '11 at 02:13
  • @Martin i tried to set \footskip automatically today and found that it can be set a correct value by using the method i mentioned in my above comment, say, \settototalheight\footskip{\maxof{\leftfootercalc}{\rightfootercalc}{\midfootercalc}} where \leftfootercalc, \rightfootercalc, \midfootercalc are newcommand definition of the real content of footer. this didn't work yesterday due to other errors. for a newbie, misunderstanding some concept could lead to unpredictable errors. anyway, thanks a lot. – warem Feb 15 '11 at 07:59