Generalvspace inside chead doesn't push down the page's text

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
jsmith6
Posts: 9
Joined: Tue Jan 15, 2008 4:15 pm

vspace inside chead doesn't push down the page's text

Post by jsmith6 »

I am using the package fancyhdr and I am trying to add space between the chead's text and the vertical line under the text. I inserted a \vspace{2cm} inside \chead{} which does push down the line, but doesn't push down the text. At least not in the first page. Everything works as I wanted on the second page and forth.

I could leave the first page blank but I sense that there is a deeper problem that I need to face here, and not just "hack it off".

I am runing Tetex on Slackware 12. I know that Tetex is not actively developed any more but I don't think I can upgrade to any other Tex distribution right now because of dial-up.

Anyone have any idea how to make it work on the first page too?

Here is the code that produces the problem:

Code: Select all

\documentclass[12pt]{article}

\usepackage{fancyhdr}

\pagestyle{fancy}

\chead{\Large{ \textbf{Hello there}} \vspace{2cm} } % vspace causes a problem on the first page
% \addtolength{\headsep}{2cm} % this fixes only part of the problem: it makes the first page look good but messes up the rest

\begin{document}

	One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. 
	One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. 
	One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. 
	One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. 
	One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. 
	One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. 
	One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. 
	One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. 

\newpage

	Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. 
	Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. 
	Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. 
	Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. 
	Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. 
	Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. 
	Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. 
	Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. 
	Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. Two. 

\end{document}

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

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

vspace inside chead doesn't push down the page's text

Post by gmedina »

Increase the value of \headheight; use something like

Code: Select all

\setlength\headheight{85pt}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
jsmith6
Posts: 9
Joined: Tue Jan 15, 2008 4:15 pm

vspace inside chead doesn't push down the page's text

Post by jsmith6 »

gmedina wrote: Increase the value of \headheight; use something like

Code: Select all

\setlength\headheight{85pt}


That saved the day! Thank you :)

I have two more questions:

1. What is causing this problem? Why does it appear only on the firt page? Help me understand this.

2. How did you knew that 85pt was just the right number? I changed it other things and it didn't work that well. I need to know because I haven't decided about the final form of my document and I will probably tweak the "\vspace{2cm}" until I find something that is just perfect.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

vspace inside chead doesn't push down the page's text

Post by gmedina »

The first time you compile a .tex file, a .log file is created. This .lof file contains all the information about the compilation process, including errors, warnings, etc. When you compile your example, a warning is generated and you can see this paragraph in the .log file:

Code: Select all

Package Fancyhdr Warning: \headheight is too small (12.0pt): 
 Make it at least 83.25554pt.
 We now make it that large for the rest of the document.
 This may cause the page layout to be inconsistent, however.
This answers both questions. As you can see, LaTeX tries to correct the size of \headheight, but it takes effect only from the second page on.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
jsmith6
Posts: 9
Joined: Tue Jan 15, 2008 4:15 pm

Re: vspace inside chead doesn't push down the page's text

Post by jsmith6 »

Yes, it does answer both. Thanks again.
Post Reply