[Tex/LaTex] A logo on every page

fancyhdrgraphicsheader-footer

I'm trying to have a logo typeset on every page, in the upper left corner. I'm using fancyhdr and I'm defining the logo position in the header by \lhead{\includegraphics{image.png}}. The full source code of the document is listed at the end of this post.

I'm typesetting 2 pages. I'm facing the following issue.

While the logo position is OK on the first and 2nd page, the text on the first page begins in the header while it begins correctly on the second page.

This is the first page:
Page 1

This is the second page:
Page 2

I tried with different document classes: there are some changes but in all cases the first page is not typeset properly. The only way around I've found so far is the add a ~\vspace{1.5cm} at the beginning of the document: that's dirty…

The source code is as follows:

\documentclass[10pt]{article}
\usepackage[a4paper, top=25mm, bottom=20mm, 
   left=15mm, right=15mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{blindtext}
\usepackage{showframe}

%% ============================================
\begin{document}
\pagestyle{fancy}
\fancyhf{}
\lhead{\includegraphics{image.png}}
\renewcommand{\headrulewidth}{0pt}

\blindtext

\newpage
\blindtext

\end{document}

Any idea about what I'm doing wrong ?

Best Answer

I think you could start by trying someting like this in your preamble :

\fancypagestyle{logo}{
\fancyhf{}
\fancyhead[LE,LO]{\includegraphics{image.png}}}

And then use :

\pagestyle{logo}

As for your spacing problem, you got two parameters in the geometry package : Headheight and Headsep.

Ideally, your Headheight should be the same as the height of your picture and your Headsep can be 0.2cm or any blank space you want between header and body.

Related Question