Document ClassesFancyhdr

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
vhii
Posts: 9
Joined: Sun Feb 10, 2008 11:11 pm

Fancyhdr

Post by vhii »

Hi, a question about the fancyheader package:

I'm using the package to draw headlines and footlines. I noticed that the footline on the first page containing a footline is always a bit off (i.e. set just a few points higher) in comparison to the footlines of the following pages. Maybe it's also a bit more thick, not sure about that.

This applies only to the first footline appearing in the document, all the others are fine (identical to each other). I.e. when I offset the first appearance of footlines and headlines using \pagestyle{empty}, it still happens on the first page with a footline. This is also not dependent in any way on the content of a page, I've tried various almost empty pages, full pages, pages with floats - no difference.

It's only noticeable when comparing the pages in full view, but anyway.. Has anybody else noticed this? Is this a bug in the package, or maybe I'm doing something wrong after all. The code is copied from an online example, so presumably nothing wrong there..

Code: Select all

\pagestyle{fancy}
\renewcommand{\headrulewidth}{0.4pt}
\fancyhf{} %alle Kopf- und Fußzeilenfelder bereinigen
\fancyhead[L]{\bfseries Studienarbeit} %Kopfzeile links
\fancyhead[C]{} %zentrierte Kopfzeile
\fancyhead[R]{\bfseries André} %Kopfzeile rechts
\renewcommand{\headrulewidth}{0.4pt} %obere Trennlinie
\fancyfoot[C]{\bfseries Seite \thepage} %Seitennummer
\renewcommand{\footrulewidth}{0.4pt} %untere Trennlinie

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

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

Fancyhdr

Post by localghost »

Please provide a minimal working example (MWE) to make clear the undesired behaviour. If necessary, include screen shots that allow to compare two affected pages. This phenomenon may be more a problem of your viewer than a problem of LaTeX.


Best regards
Thorsten
vhii
Posts: 9
Joined: Sun Feb 10, 2008 11:11 pm

Fancyhdr

Post by vhii »

It doesn't have anything to with the viewer, same thing happens in Adobe Reader and Foxit Reader.

Ok, here some minimal working code:

Code: Select all

\documentclass[a4paper, 12pt]{article}
\usepackage{fancyhdr}

\renewcommand{\headrulewidth}{0.4pt}
\fancyhf{} %alle Kopf- und Fußzeilenfelder bereinigen
\fancyhead[L]{\bfseries Studienarbeit} %Kopfzeile links
\fancyhead[C]{} %zentrierte Kopfzeile
\fancyhead[R]{\bfseries André} %Kopfzeile rechts
\renewcommand{\headrulewidth}{0.4pt} %obere Trennlinie
\fancyfoot[C]{\bfseries Seite \thepage} %Seitennummer
\renewcommand{\footrulewidth}{0.4pt} %untere Trennlinie
\pagestyle{fancy}

\begin{document}

\pagestyle{empty}
Empty page

\newpage
\pagestyle{fancy}
Page with headers

\newpage
Page with headers - shifted!

\newpage
Page with headers - same as previous page

\end{document}
vhii
Posts: 9
Joined: Sun Feb 10, 2008 11:11 pm

Re: Fancyhdr

Post by vhii »

Example picture, this shows page 3 pasted right over page 2. It can be noticed that both text and lower bar are at a different level.
Attachments
beispiel.gif
beispiel.gif (2.49 KiB) Viewed 17091 times
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: Fancyhdr

Post by localghost »

Running your example, I can't see the shown behaviour. Neither in Adobe Reader nor in Foxit Reader. I also processed it under Linux with Kile 2.0 and TeXLive 2007 with the same result. I didn't see any shifting in all the viewers I used (KDVI. KGhostview, KPDF, XPDF). All pages are congruent.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Fancyhdr

Post by gmedina »

Same result as the one reported by localghost (using Linux with Kile 1.9.3 and TeXLive 2007).

One only comment, when processing your example code, I got the following warning:

Code: Select all

\headheight is too small (12.0pt):Make it at least 14.49998pt.
So, in the preamble, add something like

Code: Select all

\setlength{\headheight}{15pt}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Re: Fancyhdr

Post by meho_r »

I did notice different position of footer lines like in the example above (Kile 2.0, TeXLive 2007, Adobe Reader 8), only on pages 2 and 3. But after \setlength{\headheight}{15pt} the difference has dissapeared.
vhii
Posts: 9
Joined: Sun Feb 10, 2008 11:11 pm

Re: Fancyhdr

Post by vhii »

Yes, \setlength{\headheight}{15pt} fixes the problem. Thanks a lot for your help!
Post Reply