0

I am using the fancyhdr package to create a specific headline and footline.

My code:

\begin{document}
    \renewcommand\headrule{\textcolor{gray!60}{\rule{\textwidth}{.5pt}}}%
    \renewcommand{\footrule}{\textcolor{gray!60}{\rule{\textwidth}{.5pt}}}%
    \pagenumbering{arabic}
    \rfoot{\textcolor{gray}{\small Site: \thepage}}
    \lhead{\textcolor{gray}{\small \@title}}
    \rhead{\begin{tikzpicture}%
                \node[opacity=.4]{\includegraphics[width=.08\linewidth]{img/logo}};
           \end{tikzpicture}}
    \newgeometry{bottom = 5cm}

    My text appears here

    \newpage

    Now my text appears at the right position
\end{document}

But the text of the first page is printed into the headline. After the use of \newpage, the Text is printed as expected.

My first page:

First page

My seccond page:

Seccond page

How to justify the position of the body box directly?

WikiPedia Logo from: https://commons.wikimedia.org/wiki/File:Logo_de_wikipedia.png License: Wikimedia Foundation [CC BY-SA 3.0 (https://creativecommons.org/licenses/by-sa/3.0)]

A whole example for coppy and post:

\documentclass{scrartcl}

\title{My title}
\author{Ahrtaler}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage[a4paper]{geometry}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{fancyhdr}
\usepackage[export]{adjustbox}
\usepackage{showframe}

\pagestyle{fancy}
\fancyhf{}

\renewcommand\headrule{\textcolor{gray!60}{\rule{\textwidth}{0pt}}}%

\begin{document}
\newgeometry{bottom = 15mm}
\pagenumbering{gobble}

\makeatletter
\centering

\vspace{3.5cm}
\Large\textbf{\@title}
\normalsize
\vfill
\raggedright
\textbf{Date:}\\
\hspace{.5cm}\@date

\vspace{1cm}
\textbf{Author:}\\
\hspace{.5cm} \@author

\centering
\includegraphics[width=0.1\linewidth]{example-image}

    \raggedright

\pagebreak

\renewcommand\headrule{\textcolor{gray!60}{\rule{\textwidth}{.5pt}}}%
\renewcommand{\footrule}{\textcolor{gray!60}{\rule{\textwidth}{.5pt}}}%
\pagenumbering{arabic}
\rfoot{\textcolor{gray}{\small Site: \thepage}}
\lhead{\textcolor{gray}{\small \@title}}
\rhead{\begin{tikzpicture}%
            \node[opacity=.4]{\includegraphics[width=.08\linewidth]{example-image}};
       \end{tikzpicture}}
\newgeometry{bottom = 5cm}

My text appears here

\newpage

Now my text appears at the right position
\end{document}
  • Please provide a complete working example. – Steven B. Segletes Mar 25 at 14:33
  • 1
    I bet you get a warning in the log from fancyhdr that the headheight is not large enough. – Ulrike Fischer Mar 25 at 14:40
  • @UlrikeFischer Yes you are right. Do I have to set the headheight manually? – Ahrtaler Mar 25 at 15:01

Your Answer

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

Browse other questions tagged or ask your own question.