2

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

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{some-class}[2013/07/29]

\renewcommand{\normalsize}{\fontsize{10pt}{12pt}\selectfont}
\DeclareOption{a4paper}{
    \setlength\paperheight {297mm}%
    \setlength\paperwidth  {210mm}
}
\DeclareOption{landscape} {
    \setlength\@tempdima   {\paperheight}%
    \setlength\paperheight {\paperwidth}%
    \setlength\paperwidth  {\@tempdima}
}

%Default options for design
\ExecuteOptions{a4paper}
%Process user given options
\ProcessOptions

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

Content of my document.tex:

\documentclass[]{some-class}
\usepackage{lipsum}
\author{roncsak}
\title{some title}
\date{2013/07/28}
\begin{document}
\lipsum
\lipsum
\end{document}

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
3

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:

\addtolength{\textheight}{-20mm} 

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.