I'm trying to generate a latex report (via Sweave and R) where the header of the document is an image that covers everything (including the top/left/right page margin) and the footer covers everything (including the bottom/left/right page margin) such that the graphics for header and footer are flush to the page edges.

Kind of like this:

enter image description here

I've been playing around with fancyhdr but I can't seem to get it to do anything but stick out in the middle of the page. Additionally, I can't seem to get the header/footer to show up on ALL pages.

Help would be appreciated, here's where I am so far:


\title{Example Document}
\author{Author Name}
\date {\today}
\section{This is a good example}
Example text goes here \\
Repeat me to force a new page \\ 

3 Answers 3


I found a better solution using the wallpaper package, replacing foo and bar produces the desired result.

\usepackage{lipsum}% http://ctan.org/pkg/lipsum

  • This is perfect for what I wanted - thank you!
    – Savara
    Commented Dec 3, 2012 at 11:50
  • Is there a simple way of putting say ULCornerWallPaper on odd pages, and URCornerWallPaper on even?
    – ilya
    Commented Sep 24, 2013 at 16:48

If you are not stuck on using fancyhdr, you could adapt the solution from How do I add an image in the upper, left-hand corner using TikZ and graphicx which uses the background package:

enter image description here


  • Need at least two runs to see the images.




\newcommand{\MyGraphicLogo}{% For imported graphic logo
\begin{tikzpicture}[remember picture,overlay]
  \node at (current page.north) {\includegraphics[width=\paperwidth,height=4cm]{foo}};
  \node at (current page.south) {\includegraphics[width=\paperwidth,height=4cm]{bar}};

\SetBgContents{\MyGraphicLogo}% Select included image

\SetBgPosition{current page.north west}% Select location
\SetBgOpacity{1.0}% Select opacity
\SetBgAngle{0.0}% Select roation of logo
\SetBgScale{1.0}% Select scale factor of logo

\section*{Lorem Ipsum}
  • Thanks Peter, this seems to get close to what I'm looking for. Could you help me in understanding where I utilize the names of the images. Would it be a simple matter of replacing foo and bar? Commented Jan 24, 2012 at 2:51
  • Actually, I figured that part out. Although I'm having problems with the positioning of the image. It seems to be that {current page.north west} puts the image in the top right but it is centered with the horizontal midpoint of the image is at the top edge of the page. Commented Jan 24, 2012 at 3:50
  • Yes foo and bar are the files names options to \includegraphics. You also need to remove the [demo] option when loading the graphicx package. Also, in my example I had used current page.north, but you can still use current page.north west and include [anchor=west] if you want the image to be on the top left hand side. Commented Jan 24, 2012 at 19:41
  • I had some problems with using the background package to place things on pages containing only floats.
    – yo'
    Commented Jan 25, 2012 at 10:14
  • @tohecz: If that is not already a question on that issue it would be helpful to post one with a MWE. Off the top of my head I don't understand why that would be the case. Commented Jan 25, 2012 at 15:46

I think the command you are looking for is \fancyhfoffset. The left side seems needs to increase by \oddsidemargin + \hoffset + 1in and the right side needs to increase by \evensidemargin + \marginparwidth - \marginparsep (this is surprising to me I thought it would have been plus \marginparsep).



\fancyhfoffset[L]{\oddsidemargin + \hoffset + 1in}
\fancyhfoffset[R]{\evensidemargin + \marginparwidth - \marginparsep}

First page


Second page

You must log in to answer this question.

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