1

I'm studying at a Cooperative State University and need to write a report about my activities at work. Our department provided us with templates for all kind of document we have to fill out and attach to our report and I converted them from Office to LaTeX documents. In the next step I wanted to combine all the templates to one single document.

Now my question is: Is there a way to define different \headheight in one document? I would need at least 4 different headers for all particular documents.

Here is an example of my documents code:

\documentclass[12pt, oneside]{report}

\usepackage{atveryend}
\makeatletter
\AtVeryEndDocument{%
    \if@filesw % respect \nofiles
    \begingroup
        % same write register as environment `filecontents` uses
        \chardef\reserved@c=15 %
        \immediate\openout\reserved@c=\jobname.heights\relax
        \immediate\write\reserved@c{%
            \string\setlength{\string\headheight}{\the\headheight}%
        }%
        \immediate\write\reserved@c{%
            \string\setlength{\string\footskip}{\the\footskip}%
        }%
        \immediate\closeout\reserved@c
    \endgroup
    \fi
}
\makeatother
\InputIfFileExists{\jobname.heights}{}{}

\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{color}

\usepackage[top = 2cm, bottom = 2cm, left = 2.5cm, right = 2cm, includehead, showframe]{geometry}

\usepackage{fancyhdr}
\fancypagestyle{titlepage}
{
    \fancyhf{}
    \fancyhead[L]{\includegraphics[height=2cm]{./dhbw_logo}}
    \fancyhead[R]{\includegraphics[width=2cm]{./cz_logo}}
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
}
\fancypagestyle{plainpage}
{
    \fancyhf{}
    \fancyfoot[R]{\thepage}
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0.5pt}
}

\begin{document}

    \input{./Deckblatt.tex}

    \newpage
    \thispagestyle{plainpage}
    Hello World!

\end{document}

And here is an example of my title page:

\begin{titlepage}

    \thispagestyle{titlepage}

    \begin{center}

        ~\\[2.5cm]

        \textsc{\bfseries\LARGE\color{red} Praxisarbeitsthema} \\[2.5cm]

        \textsc{\Large Praxisarbeit} \\[1cm]
        \textsc{\Large für das 1. Studienjahr} \\[2cm]

        im Studiengang Informatik \\[0.5cm]
        an der Dualen Hochschule \\[0.5cm]
        Baden--Württemberg Heidenheim \\[1cm]

        vorgelegt von \\[0.5cm]
        \textsc{\Large Name} \\[2cm]

        \today

    \end{center}

    \vfill

    \begin{tabular}{ l l }
        Matrikelnummer: & whatever\\
        Ausbildungsfirma: & whatever\\
         & whatever | whatever \\
        Gutachter der Ausbildungsfirma: & {\color{red}Name}
    \end{tabular}

\end{titlepage}

As you can see, actually I hope you can, the header on the page after my title page still got the same \headheight, but without the content. I hoped that the atveryend package would set the \headheight for each page individually, but it doesn't work or I'm doing something wrong.

So is there a nice and nifty way to solve this problem? And sorry for the really long question and code examples.

Chris

2

Since you're using the geometry package, you can set the \headheight using that. To set the initial value, use

\usepackage[...other options...,headheight=<length>]{geometry}

and to change it on successive pages, use

\newgeometry{headheight=<new value>}

However, all of the other options will also have to be given again in \newgeometry.

For more information, check the geometry package documentation, also available from your local distrubution with texdoc geometry.

  • Thank you for your fast reply and it really does the job. I've got some little issues with the layout, but I think that shouldn't be a problem. – Chris.V Jun 10 '13 at 8:22

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.