Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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,                         
   headinclude,         
   headsepline,                 
   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{pageheadfoot}{\color{grey}{\normalfont\sffamily}}
\setkomafont{pagenumber}{\color{grey}{\normalfont\sffamily}}
\setheadsepline{1pt}[\color{grey}]

\clearscrheadfoot                                                       
\pagestyle{scrheadings}
\rehead[ ]{Document title}              
\lohead[ ]{Document title}              
\lehead[ ]{\headmark}                   
\rohead[ ]{\headmark}                        
\refoot[\pagemark]{\pagemark}     
\lofoot[\pagemark]{\pagemark}     

\begin{document}

\section{section title}

\lipsum[1-9]

\end{document}

Thank your for your comments and answers. I have already tried the above solution (just including the graphics), but was not happy with the result because:

  • 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).

enter image description here

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

share|improve this question
    
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
1  
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
add comment

2 Answers

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
\rehead[ ]{Document title \includegraphics[height=8mm]{example-image-A.jpg}}              
\lohead[ ]{\includegraphics[height=8mm]{example-image-A.jpg} Document title} 

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

share|improve this answer
    
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
add comment

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,
  headinclude,
  headsepline,
  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{graphicx}% for loading images
\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

\setlength{\headheight}{\logoheight}
% This won't work (!!!):
%%% \KOMAoptions{headheight=\logoheight}

\usepackage{scrpage2}

\setkomafont{pageheadfoot}{\color{grey}{\normalfont\sffamily}}
\setkomafont{pagenumber}{\color{grey}{\normalfont\sffamily}}
\setheadsepline{1pt}[\color{grey}]

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

\clearscrheadfoot
\pagestyle{scrheadings}
%\rehead[]{Yaacomo}
\cehead[]{\headmark\hfill Yaacomo \rlap{\adjustbox{margin={\extramargin} 0pt 0pt 0pt}{\logo}}}
%\lohead[]{Yaacomo}
\cohead[]{\llap{\adjustbox{margin=0pt 0pt {\extramargin} 0pt}{\logo}}\ Yaacomo\hfill\headmark}
%\lehead[]{\headmark}
%\rohead[]{\headmark}
\refoot[\pagemark]{\pagemark}
\lofoot[\pagemark]{\pagemark}

\begin{document}

\Blinddocument

\end{document}

appearance

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.