I need to have a distance of 15 mm between the header's baseline and the the top of the text. Similarly, I need and a distance of 15 mm between the line above the footer and the base of the text (requirements of my school).
I know I can adjust headsep
for the header but the only parameter I have been able to change for the footer is footskip
which defines the distance between the base of the footer and the text.
I guess I could increase footskip
to more than 15 mm until both header and footer look more or less like they should. Is there a more exact way to do it?
I am using the book
class and fancyhdr
. Right now this is what I am doing:
\usepackage[left=25mm,right=25mm,top=25mm,bottom=25mm,
footskip=20mm,headsep=15mm]{geometry}
\usepackage{fancyhdr}
\fancypagestyle{mystyle}{
\fancyhf{}
\fancyhead[EL]{\leftmark}
\fancyhead[ER]{}
\fancyfoot[ER]{The school}
\fancyfoot[EL]{\thepage}
\fancyhead[OR]{The title of this work}
\fancyhead[OL]{}
\fancyfoot[OL]{The name of the author}
\fancyfoot[OR]{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
}
\begin{document}
\pagestyle{mystyle}
\chapter{Introduction}
\lipsum[1-15]
\end{document}
Best Answer
The problem is well-known: it’s the “difference between
\footSKIP
and\headSEP
”, as the comments inltoutput.dtx
say. In other words, while\headsep
gives the vertical distance between the baseline of the header and the upper margin of the text body (not the baseline of the first line of text),\footskip
is assumed to be the vertical ditance between the lower margin of the text body and the baseline of the footer. The exact amount that you should add to\footskip
in order to compensate for this is therefore given by the height of the footer; but unfortunately, there is no parameter that gives that (i.e., there is not anything like\footheight
, cf.\headheight
). However, in general it can be assumed that the height of the footer equals the height of a\strut
in the normal font size.But again, the normal font size can vary if you specify options like
11pt
or12pt
: how can we devise a patch that automatically conforms to these? Well, inelegant as it might seem, I deem that this is one of those rare cases in which a crude, low-level hack can be the easiest way out of the problem. Namely, you could sayafter having set the page geometry; this should pick up the normal font size. Here’s a complete, compilable example:
You can add the
12pt
option and see what happens.