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?

  • 1
    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
  • 1
    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

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:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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