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?
2 Answers
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}
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.
-
@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?– waremCommented Feb 13, 2011 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.– waremCommented Feb 13, 2011 at 14:07 -
@warem: Funny
geometry
should work. However AFAIK it stoes sets thehead=
value in\headheight
andfoot=
in\footskip
. Check its manual again for the details. Commented Feb 13, 2011 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
.:(– waremCommented Feb 14, 2011 at 9: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. Commented Feb 14, 2011 at 9:52