TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have basic class file and I would like to use fancyhdr. Here is the markup of some-class.cls:


    \setlength\paperheight {297mm}%
    \setlength\paperwidth  {210mm}
\DeclareOption{landscape} {
    \setlength\@tempdima   {\paperheight}%
    \setlength\paperheight {\paperwidth}%
    \setlength\paperwidth  {\@tempdima}

%Default options for design
%Process user given options

\RequirePackage[top=20mm, bottom=25mm, left=25mm, right=0mm]{geometry}
  \fancyhf{} % this clears all six fields (left, center, right in header and footer)
  \fancyhead[C]{\thepage. oldal}
  \headsep 20mm

Content of my document.tex:

\title{some title}

When don't use fancyhdr package every margin I set are what I wanted. But when I'm using \headsep command the whole document (except header) gets an offset of 20 mm. It would be ok but in this case the bottom margin is 'disappearing'.

I would like to use some kind of code that could subtract from \textlength, or make margin "sticky".

Do you know something like this?

share|improve this question
Why is that \headsep inside the pagestyle and not a general part of the page layout, it has nothing to do there. – daleif Jul 30 '13 at 14:26
I don't know of any \textlength, do you mean \textheight? And \addtolength{\textheight}{-20mm} is what you are looking for? – karlkoeller Jul 30 '13 at 14:46
I would take your suggestion, @daleif ! – roncsak Jul 30 '13 at 17:23
@karlkoeller, I had meant that, and your code is what I was looking for! Thank you, all! (How could I accept your answer?) – roncsak Jul 30 '13 at 17:24
up vote 3 down vote accepted

I don't know exactly what you are going to have in your class file, but I think you want to modify the value of textheight.

To do that (supposing you want to reduce that value of an amount=20mm) add this line to your file:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.