# Can I put a logo in the header of a twoside document?

I would like to include a graphics file with a logo in the header of all pages of a twoside document (left and right side). The logo should be left-justified on the left side and right-justified on the right side. The header line and the document title should begin beside the logo. There are two 2 Problems:

• Moving the beginning of header line and document title a litte to the right (left side) and left (right side) to create space for the logo
• Include the logo

Do you have any suggestions? Here is my code:

\documentclass[
12pt,
a4paper,
twoside,
BCOR12mm,
DIV12,
openright,
bibliography=totoc,
listof=totoc,
numbers=noenddot,
fleqn,
]{scrbook}

\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman, english]{babel}
\usepackage{lipsum}

\usepackage{xcolor}
\definecolor{grey} {RGB} {132,130,132}

\usepackage{scrpage2}

\setkomafont{pagenumber}{\color{grey}{\normalfont\sffamily}}

\refoot[\pagemark]{\pagemark}
\lofoot[\pagemark]{\pagemark}

\begin{document}

\section{section title}

\lipsum[1-9]

\end{document}


• the line is also unter the logo
• document title and section title have different heights

This time I include a layout draft (the picture in the layout is a substitute for the logo). The measurements of the final logo will be: height=15 mm, width=20 mm (or 79x61 pixel).

The Document title is "Yaacomo". In the header there should be no text and no line under the logo.

-
Could you provide a link to the logo or otherwise say something about the image dimensions? I would include it into \rehead resp. \lohead, but very likely the headheight must be enlarged. –  Speravir Oct 29 '12 at 17:11
Related Question: Place a TikZ picture on every page. You can use \ifoddpage to adjust the location of the logo depending on which type of page you are on. –  Peter Grill Oct 29 '12 at 18:18

A first try can be to include package graphicx for macro \includegraphics and change your configuration for the header to:

\usepackage{graphicx} % for macro \includegraphics


Btw: example-image-A.jpg is part of the package MWE, very useful for building MWEs ...

-
Exactly my intention, cf. my comment under the question. –  Speravir Oct 29 '12 at 17:34
@Speravir: Sorry, I didn't saw your comment (I'm not very used in writing in English so my writing took a little bit of time). If you want to answer I can delete my answer ... –  Kurt Oct 29 '12 at 17:38
See my answer now. –  Speravir Nov 1 '12 at 22:16

My solution:

I added the packages graphicx for image inclusion, calc to be able to do some calculation, and adjustbox for adding some margin, which is needed, because otherwise the headsepline would touch the logo.

I defined some lengthes; see under %Logo, perhaps you want to change them. This is also the place for your actual logo.

The head itself is now only in \cehead resp. \cohead. So it is ensured, that everything is in the same line.

All together, the package blindtext is only for, ehem, blindtext (\Blinddocument here):

\documentclass[
paper=a4, % it's the default anyway
fontsize=12pt,
twoside,
BCOR=12mm,
DIV=12,
openright,
bibliography=totoc,
listof=totoc,
numbers=noenddot,
fleqn,
]{scrbook}

\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman, english]{babel}

\usepackage{blindtext} % provides blindtext with sectioning

\usepackage{calc} % for some calculation

\usepackage{xcolor}
\definecolor{grey} {RGB} {132,130,132}

\usepackage[calc]{adjustbox} % we need some margin around the logo, for option see manual

% Logo
\newlength{\logoheight}\setlength{\logoheight}{15mm} % Adjust height of logo here
\newlength{\logowidth}\setlength{\logowidth}{20mm} % Adjust width of logo here

\newcommand*{\logo}{\raisebox{-5pt}% The bigger the amount of the negative number the more the header is raised!
{\includegraphics[height=\logoheight,width=\logowidth]{example-image-4x3.png}}}

\newlength{\extramargin}\setlength{\extramargin}{5pt} % Change to your needs

% This won't work (!!!):

\usepackage{scrpage2}

\setkomafont{pagenumber}{\color{grey}{\normalfont\sffamily}}

\setheadwidth[\logowidth+\extramargin]{\textwidth-\logowidth-\extramargin} % for calculation "calc" is needed