LaTeX-Package-Repositories / geometry

Updating Hideo Umeki's geometry package for LaTeX page dimensions
38 stars 5 forks source link

Multi line header does not play well with geometry headsep parameter #11

Open amine-aboufirass opened 2 years ago

amine-aboufirass commented 2 years ago

I would like to use the geometry package alongside fancyhdr. To control the distance between header and main text in my article documentclass, this question recommends use of the headsep parameter:

\documentclass[11pt, a4paper]{article}
\usepackage[includehead, headsep=5pt]{geometry}
\usepackage{fontspec}
\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[C]{A header}%\\a new line in the header}

\renewcommand{\headrulewidth}{1.5pt}

\begin{document}
  \section*{Education}

\end{document}

This seems to work fine, and modifying the headsep indeed modifies the distance between the header and the section title. enter image description here However, it so happens that my header is multi-line. as soon as I uncomment line 9 as follows:

\fancyhead[C]{A header\\a new line in the header}

The section title clashes with the header, which I do not want. enter image description here How can I get headsep to remain aware that my header is now multi line?

davidcarlisle commented 2 years ago

as noted in comments on this question, the problem is not headsep but headheight it is a user-setable length that you need to set to be at least the height of the actual content. Especially if as here you change the heading adding tall content after the page head has been set up then there is not really anything geometry can do here.