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 have a header with two columns; On the first column, I have an image (the logo) and I would like to slightly adjust its position. Here is the relevant piece of code:

\fancyhead[LE,LO]{\tt\begin{multicols}{2}\includegraphics[scale=0.5]{logo.eps}\vfill\columnbreak some more text...\end{multicols}}

Is it possible to move a little bit to the top/left my image?

[edit]

here is a minimal working example:

\documentclass[a4paper,11pt]{article}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{multicol}
\pagestyle{fancy}
\fancyhead{} % clear all header fields
\fancyhead[LE,LO]{\begin{multicols}{2}\includegraphics[height=3cm]{logo.eps}\vfill\columnbreak Right column text\end{multicols}}
\setlength\topmargin{2cm}
\setlength\oddsidemargin{2cm}
\setlength\textheight{200 mm}
\setlength\textwidth{17cm}
\setlength\headheight{3cm}
\setlength\headsep{2cm}
\begin{document}
some content
\end{document}

thanks

share|improve this question
    
I don't think that multicols is the best way to do this; how should the picture be in relation to the side text? –  egreg Feb 15 '13 at 14:39
    
my design is based on a grid that's why I used multicols. I'm open to other suggestions if multicols is a problem. Thanks –  Alex Feb 15 '13 at 14:41
    
Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out possible solutions when we see compilable code, starting with \documentclass{...} and ending with \end{document}. For the logo, just approximate dimensions are sufficient. –  egreg Feb 15 '13 at 14:45
    
Here it the minimal working example! –  Alex Feb 15 '13 at 15:44
    
Where should the image be placed? Slightly higher and a bit offset into the left margin? Do you need the rule below the header? –  egreg Feb 15 '13 at 15:55

1 Answer 1

multicols is not the best for a header; I suggest using a tabular; moreover, geometry makes defining page dimensions easier.

\documentclass[a4paper,11pt]{article}
\usepackage[
  top=1cm, % top margin
  left=2cm, % left margin
  textwidth=17cm,
  textheight=20cm,
  includehead, % the header is included in the computations
  headheight=3cm, % height of the header
  headsep=2cm,
  heightrounded, % to have an integer number of lines
]{geometry}

\usepackage[demo]{graphicx}

\usepackage{url}    % for demonstration purposes
\usepackage{lipsum} % mock text

%% Define the text in the header
\newcommand{\headertext}{%
  The name of the firm\newline
  Address \newline
  \url{http://firm.com}
}

%% Let's define the header
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhead{} % clear all header fields
\fancyhead[L]{%
  %% assuming the width of the logo is 4cm, we put it 1cm left in the margin
  %% and we cut 3cm (width - offset) from the remaining space, for the text
  \hspace*{-1cm}\begin{tabular}{@{}lp{\dimexpr\textwidth-3cm-2\tabcolsep}@{}}
  \raisebox{\dimexpr-\height+\ht\strutbox}{\includegraphics[height=3cm,width=4cm]{logo.eps}}
  & \headertext
  \end{tabular}%
}

\begin{document}
\lipsum[1-2]
\end{document}

It's not difficult to separate more the logo from the header text

enter image description here

share|improve this answer
    
thanks a lot for your answer. Could you explain the meaning of @{}lp{\dimexpr\textwidth-3cm-2\tabcolsep}@{}? (I mean especially the @{}lp{}@{} structure) –  Alex Feb 16 '13 at 23:15
    
p{<dimension>} states that the column is a "paragraph" column. I set it to be as wide as the \textwidth minus the offset for the logo and the intercolumn space (between the first and second column it is 2\tabcolsep. With @{} at the sides I announce that I don't want the padding LaTeX usually adds at the sides of a tabular. –  egreg Feb 16 '13 at 23:17
    
thanks egreg. \raisebox{\dimexpr-\height+\ht\strutbox} seems to correct the vertical alignement of the second cell text, but it does not seem however to move up the graphic. Do you have any idea? –  Alex Feb 17 '13 at 0:02

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.