Document Classeshow to avoid unwanted page-shift?

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
martian
Posts: 2
Joined: Mon May 12, 2008 5:32 pm

how to avoid unwanted page-shift?

Post by martian »

Hello everybody! While making a report for school I've encounterd a problem I wasn't able to find a suitable solution for. The basic tex code looks like this:

Code: Select all

\documentclass[a4paper,12pt]{article}
\usepackage{geometry}
\usepackage{fancyhdr}
\geometry{paper=a4paper,left=25mm,right=25mm,top=25mm,bottom=30mm}
\pagestyle{fancy}
\lhead{left\\left\\left}
\rhead{right\\right\\right}
\cfoot{\thepage}
\begin{document}
% \phantom{}
blubb
\newpage
blah
\end{document}
When I compile the code the first page's text appears inside the header. After a closer look i discovered, that the whole page (including page number in the footer!) gets shifted upwards for no reason. Using a dummy (\phantom) moves the text out of the header, but still the footer isn't in its place. As I need the three lines in the header removing them isn't an option. This whole problem of mine only seems to affect the first page, as further pages are rendered correctly. Does anyone in here have a clue how to make my pages look right?

Thanks for helping!
Matthias

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

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

how to avoid unwanted page-shift?

Post by Stefan Kottwitz »

Hi Matthias,

welcome to the LaTeX Community board!
Very good that you gave a complete minimal working example, that makes it easy to help. You have to set the \headheight value. The compiler shows a warning, you can see this at least in the logfile: \headheight is too small (12.0pt):Make it at least 41.68335pt. That's why the solution is:

Code: Select all

\setlength{\headheight}{41.68335pt}
Stefan
LaTeX.org admin
martian
Posts: 2
Joined: Mon May 12, 2008 5:32 pm

Re: how to avoid unwanted page-shift?

Post by martian »

Wow, that was super-fast help! Seems that i missed to check the log...
Thanks a lot!
Matthias
Post Reply