2

In the Train­ing slides, with ex­am­ples of the fancyhdr resources there's an example which unfortunately doesn't work or is poorly documented. According to http://mirrors.ctan.org/info/german/fancyhdr/fancyfolien+bsp.pdf (page after 17)

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{lipsum}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[EL]{\thepage}
\fancyhead[OR]{\thepage}
\fancyhead[ER]{
\begin{tabular}[b]{l}
Beispielezu\texttt{fancyhdr}\\
HansFriedrichSteffani\\
LehrstuhlElektr.Masch.u.Antriebe
\end{tabular}
\includegraphics[height=3\baselineskip]{tulogo}
}
\fancyhead[OL]{
\includegraphics[height=3\baselineskip]{tulogo}
\begin{tabular}[b]{l}
Beispielezu\texttt{fancyhdr}\\
HansFriedrichSteffani\\
LehrstuhlElektr.Masch.u.Antriebe
\end{tabular}
}

\addtolength{\headheight}{2\baselineskip}
\addtolength{\headheight}{0.61pt}

\begin{document}
\maketitle
\begin{abstract}
\end{abstract}

\section{}
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn

fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
fdklsafjlksdafjlksadjf fjdsaklfj sdalk fdskjlaf lkösad jfklösad jflöksadjf lsdkfj kölsadjf dsklalöjdfj

kfdjslakjf salökfj klsdöafj klsdafj lksöadfj lkösadfj lkösadf jklösafmn
v
\end{document}

should work, but it only compiles with one text for one page on which the header is not displayed (picture tulogo is present), \lipsum[1-20] doesn't work neither.

1
  • 1
    This is not a minimal working example. There's no \title command, no \author command, there's an \includegraphics command but by don't load the graphicx package. I'm afraid you won't find many people who're willing to fix this for you.
    – user10274
    May 17, 2014 at 12:59

1 Answer 1

1

It works OK here, as does \lipsum. Of course, as Marc van Dongen pointed out, you need to load graphicx. If you want to see the different headers, you also want twoside as a class option. I don't have tulogo so I used some images from mwe.

fancy headers

\documentclass[a4paper,10pt,twoside]{article}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr,graphicx}
\usepackage{lipsum}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[EL]{\thepage}
\fancyhead[OR]{\thepage}
\fancyhead[ER]{
\begin{tabular}[b]{l}
Beispielezu\texttt{fancyhdr}\\
HansFriedrichSteffani\\
LehrstuhlElektr.Masch.u.Antriebe
\end{tabular}
\includegraphics[height=3\baselineskip]{example-image-a}
}
\fancyhead[OL]{
\includegraphics[height=3\baselineskip]{example-image-b}
\begin{tabular}[b]{l}
Beispielezu\texttt{fancyhdr}\\
HansFriedrichSteffani\\
LehrstuhlElektr.Masch.u.Antriebe
\end{tabular}
}

\addtolength{\headheight}{2\baselineskip}
\addtolength{\headheight}{0.61pt}

\begin{document}
\lipsum[1-7]

\end{document}

Note that \maketitle will not use the standard page style on the page with the title. The assumption is that you will not want a header on the title page since you'll have, well, the title. And as Marc van Dongen also pointed out, \maketitle will cause errors if you have not specified anything for it to make the title with.

2
  • Thank you! Let's put it in the drawer "completely avoidable time waisting due to useless latex error messages"... May 17, 2014 at 13:19
  • 1
    @KarlRichter I agree that the errors were somewhat misleading in this case. The most obvious culprit seemed to be \lipsum when \maketitle was the real issue. Scrolling up the output in a console helped to clarify this. (If you are using an editor which doesn't show the console output, it is always worth trying the command line if you are getting weird errors which don't make sense. Kile, at least, which I use is useless in this respect.)
    – cfr
    May 17, 2014 at 13:21

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.