7

I am trying to add a photo on the header. I thought of using wallpaper package. My simple code is

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{wallpaper}
\usepackage[margin=2.8cm]{geometry}
\begin{document}%\vspace{1cm}
\ULCornerWallPaper{0.2}{headerPhoto}
\lipsum[1-3]
\end{document}

and the output is

enter image description here

As you can see the photo is placed exactly at the upper left corner. I believe it would be more fancy to look like that

enter image description here

righter and lower, that is. I tried to use hspace{} and \vspace{} but it doesn't seem to work.

Any idea on that?

1
  • Any reason you can't use fancyhdr? It's designed for putting things in the header and footer.
    – Dan
    Dec 4, 2013 at 5:21

2 Answers 2

9

The command \ULCornerWallPaper doesn't accept any offset, but \CenterWallPaper does.

You can use the lengths \wpXoffset and \wpYoffset to adjust the position in the page.

In the example below I've set

\addtolength{\wpXoffset}{-5.8cm}
\addtolength{\wpYoffset}{12.5cm}

but you will have to change these values to accomplish the positioning of your image.

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{wallpaper}
\usepackage{mwe} % only for the example
\usepackage[margin=2.8cm]{geometry}
\addtolength{\wpXoffset}{-5.8cm}
\addtolength{\wpYoffset}{12.5cm}

\begin{document}
\CenterWallPaper{0.15}{example-image-a} % change back to your image
\lipsum[1-3]
\end{document} 

Result:

enter image description here

2
  • Thank you very much for your answer! It works like a charm!!!
    – Thanos
    Dec 3, 2013 at 20:20
  • @Thanos You're welcome. Glad it helped. Dec 3, 2013 at 20:20
4

You can do this with tikz and background packages too. Unlike wallpaper these two packages allow you to put the picture anywhere in the page. I have given an example with tikz below.

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage[margin=2.8cm]{geometry}

\begin{document}
\tikz[remember picture, overlay]\node[anchor=north west,inner sep=0,outer sep=0] 
at ($(current page.north west) + (3.5cm,-.4cm) $) {\includegraphics[width=3cm]{example-image-a}}; 
% change back to your image. In (3.5cm,-.4cm) => (<xvalue>, <yvalue>) postive xvalue moves the picture 
% to the right and negative yvalue moves it below
\lipsum[1-3]
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .