Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

fancyhdr and \headheight

275 views
Skip to first unread message

Pierre

unread,
Aug 4, 2008, 5:23:16 PM8/4/08
to
Hello,


I’m trying to do my own header for my own class with fancyhdr.


When my header is too large, the body of my document is written on top
of my header. When I compile I have a warning :

Package Fancyhdr Warning: \headheight is too small (12.0pt):
Make it at least 120.58968pt.
We now make it that large for the rest of the document.
This may cause the page layout to be inconsistent, however.


So I’m doing in my doc :

\addtolength{\headheight}{121pt}
\addtolength{\textheight}{-121pt}


And it’s ok. However I have to manually set the value to 121... Is there
any way to do it automatically, to make latex figure out/sets the
headheight alone ?

Thanks.

Ulrike Fischer

unread,
Aug 5, 2008, 3:27:58 AM8/5/08
to
Am Mon, 04 Aug 2008 23:23:16 +0200 schrieb Pierre:

> Hello,
>
>
> I’m trying to do my own header for my own class with fancyhdr.
>
>
> When my header is too large, the body of my document is written on top
> of my header. When I compile I have a warning :
>
> Package Fancyhdr Warning: \headheight is too small (12.0pt):
> Make it at least 120.58968pt.
> We now make it that large for the rest of the document.
> This may cause the page layout to be inconsistent, however.
>
>
> So I’m doing in my doc :
>
> \addtolength{\headheight}{121pt}
> \addtolength{\textheight}{-121pt}

121pt for a header? That's about 10 lines. Are you sure that's a good
idea?


> And it’s ok. However I have to manually set the value to 121... Is there
> any way to do it automatically, to make latex figure out/sets the
> headheight alone ?

You can (like fancyhdr) measure the content and then set the height.

--
Ulrike Fischer

Pierre

unread,
Aug 5, 2008, 8:10:14 AM8/5/08
to
Ulrike Fischer a écrit :

> Am Mon, 04 Aug 2008 23:23:16 +0200 schrieb Pierre:
>> \addtolength{\headheight}{121pt}
>> \addtolength{\textheight}{-121pt}
>
> 121pt for a header? That's about 10 lines. Are you sure that's a good
> idea?
>
>

Well it’s to reserve a space (with a pspicture+text) on the top of each
page, where the reader will be able to write something (once the paper
has been printed). Is there any better way to do this ?


>> And it’s ok. However I have to manually set the value to 121... Is there
>> any way to do it automatically, to make latex figure out/sets the
>> headheight alone ?
>
> You can (like fancyhdr) measure the content and then set the height.
>

The problem is I only know the height of the pspicture, not of the text,
so how can I measure the content please ?

Ulrike Fischer

unread,
Aug 5, 2008, 8:34:15 AM8/5/08
to
Am Tue, 05 Aug 2008 14:10:14 +0200 schrieb Pierre:


>>> And it’s ok. However I have to manually set the value to 121... Is there
>>> any way to do it automatically, to make latex figure out/sets the
>>> headheight alone ?
>>
>> You can (like fancyhdr) measure the content and then set the height.
>>
>
> The problem is I only know the height of the pspicture, not of the text,
> so how can I measure the content please ?

\documentclass{article}
\usepackage{fancyhdr,calc}
\pagestyle{fancy}
\fancyhf{}
\newcommand\mycontent{%
\begin{tabular}{l}
\rule{3cm}{4cm}\\
some text\\
and more
\end{tabular}}

\settototalheight\headheight{\mycontent}
\lhead{\mycontent}

\begin{document}
x
\end{document}


--
Ulrike Fischer

Pierre

unread,
Aug 5, 2008, 10:24:13 AM8/5/08
to
Ulrike Fischer a écrit :

> \documentclass{article}
> \usepackage{fancyhdr,calc}
> \pagestyle{fancy}
> \fancyhf{}
> \newcommand\mycontent{%
> \begin{tabular}{l}
> \rule{3cm}{4cm}\\
> some text\\
> and more
> \end{tabular}}
>
> \settototalheight\headheight{\mycontent}
> \lhead{\mycontent}
>
> \begin{document}
> x
> \end{document}
>
>


Thanks ! Where did you find this useful function which is
\settototalheight please ? :-)

Ulrike Fischer

unread,
Aug 5, 2008, 10:34:41 AM8/5/08
to
Am Tue, 05 Aug 2008 16:24:13 +0200 schrieb Pierre:


>
> Thanks ! Where did you find this useful function which is
> \settototalheight please ? :-)

\settoheight, \settowidth and \settodepth are standard LaTeX commands,
\settototalheight (=\settoheight+\settodepth) is defined in calc.


--
Ulrike Fischer

Pierre

unread,
Aug 5, 2008, 11:25:55 AM8/5/08
to
Ulrike Fischer a écrit :

> \settoheight, \settowidth and \settodepth are standard LaTeX commands,
> \settototalheight (=\settoheight+\settodepth) is defined in calc.
>
Ok thanks a lot :-)
0 new messages