Page LayoutChanging vertical gaps in header

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
Silvo
Posts: 3
Joined: Sun Jun 28, 2009 11:49 am

Changing vertical gaps in header

Post by Silvo »

G'day,

Sorry if this has been asked before, but I couldn't find it. I have a header with a horizontal rule in my document. This works fine, except where there are section titles immediatly after the header on the page. There simply is not enough space after the decorative line for the title to go -- it collides and looks awful.

Here is what I mean:

Image

See how the title collides with the line?

My first question is: how do I make the gap underneath the line bigger? I know I can make the header area bigger with \renewcommand{\headheight}{XXpt}, but this just moves the line further down on the page.

Currently, I have removed the line, but this doesnt leave enough space between my header and the text, so I wanted to move the header text further up the page. I thought I could make the header size bigger, but this moves the header text DOWN the page, which seems stupid. How can I make the text appear at the TOP of the header, rather than the bottom? At the moment, I have put in blank lines after my text, so that it goes further up the header, leaving a bigger gap.

It works:

Image

But it is obviously not ideal. I have to do it for each column in the header.

So my questions are:
1. How do I leave a bigger gap under the decorative line in the header?
2. How do I make the text appear at the top of the header rather than at the bottom?

Thank you in advance, and my apologies for the length of this post. I would like it if both questions could be answered, as although either would work for what I need, I would rather learn it properly.

Thanks again!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Changing vertical gaps in header

Post by localghost »

Build a minimal working example (MWE) that causes the misbehaviour shown in the first picture.

Please upload attachments to the forum server. External links can get lost with the time.


Best regards and welcome to the board
Thorsten
Silvo
Posts: 3
Joined: Sun Jun 28, 2009 11:49 am

Changing vertical gaps in header

Post by Silvo »

I suppose an example would be helpful. I didn't think to, because I just assumed that there was a command I could use to do this that I didn't know.

It turns out that this issue only occurs when using the package "fullpage", which I used to give me smaller margins. Does that help any? I'm guessing your advice will be to just not use that package, wouldn't it?

Code: Select all

\documentclass[a4paper,10pt]{article}
\usepackage{fancyhdr}
\usepackage{fullpage}
\begin{document}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{Header text here}
First page
\pagebreak
\section*{Section title goes here}
\end{document}
Look at the second page for the collision issue. It appears that there is an ever bigger issue with the first page, where the text overlaps entirely, but I have a cover-page in my real document, so I don't really mind too much about that (although knowing a fix would be handy).

Second page collision issue:
Screenshot.png
Screenshot.png (10.87 KiB) Viewed 7465 times
First page overlap issue:
Screenshot-1.png
Screenshot-1.png (6.59 KiB) Viewed 7465 times
Sorry about the external images. I didn't know that would be a problem.

Thank you!
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Changing vertical gaps in header

Post by localghost »

Compiling your MWE, I get a notable warning from the fancyhdr package which you should also find in your log file.

Code: Select all

Package Fancyhdr Warning: \headheight is too small (0.0pt):
  Make it at least 12.0pt.
  We now make it that large for the rest of the document.
  This may cause the page layout to be inconsistent, however.
And the cause is the fullpage package with does the wrong settings for the type area. Page dimensions for the standard classes should be set with the geometry package. Do the according modification to get a proper page layout.

Code: Select all

\documentclass[10pt,a4paper]{article}
\usepackage[includeheadfoot,margin=2cm]{geometry}
\usepackage{fancyhdr}

\fancyhf{}
\fancyhead[L]{Header text here}
\pagestyle{fancy}

\begin{document}
  First page
  \pagebreak
  \section*{Section title goes here}
\end{document}
For more information about the capabilities of the package take a look at its manual.
Silvo
Posts: 3
Joined: Sun Jun 28, 2009 11:49 am

Re: Changing vertical gaps in header

Post by Silvo »

Thank you very much for that! All fixed now!
Post Reply