4

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}
2
  • It’s a well-known problem, the “difference between \footSKIP and \headSEP”. Please clarify whether or not the lower edge of the main text should be modified as well; that is, do you want the bottom margin of the text block to stay put at 25mm from the bottom egde of the paper and the page number to be lowered, or the page number to stay put and the bottom margin of text to be moved up?
    – GuM
    Jun 16, 2017 at 14:33
  • Sorry if that wasn't very clear. The bottom margin of the text block should stay put at 25mm from the bottom edge of the paper while the footer should begin 15mm below the text block.
    – MrBeat
    Jun 16, 2017 at 14:47

1 Answer 1

5

The problem is well-known: it’s the “difference between \footSKIP and \headSEP”, as the comments in ltoutput.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 or 12pt: 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 say

\advance \footskip by \ht\strutbox

after having set the page geometry; this should pick up the normal font size. Here’s a complete, compilable example:

\documentclass[a4paper]{book}
\usepackage[T1]{fontenc} % unrelated to the problem, but I always load it
\usepackage[
        left=15mm,right=25mm,top=25mm,bottom=25mm,
        footskip=15mm,headsep=15mm
    ]{geometry}
\advance \footskip by \ht\strutbox
% \begingroup
% \showboxbreadth = 1000
% \showboxdepth = 10
% \tracingonline = 1
% \showbox\strutbox
% \endgroup
\usepackage{fancyhdr}
\usepackage{lipsum}

\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-32]
\end{document}

You can add the 12pt option and see what happens.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.