1

I have a patterned background vector image that I'd like to place across the top of one page of my multipage document (a report if it matters).

The image is not the full size of the page, so what I'd like to do is scale it so that it is edge-to-edge from the left to the right, flush with the top edge (e.g. a bit like how the image on this page looks). The rest of the page contents would be laid out as if the background image wasn't there.

How would I be able to place this image without having to pull in some very heavy weight packages?

  • Perhaps a duplicate? tex.stackexchange.com/questions/207332/… – Steven B. Segletes Jan 25 '15 at 17:41
  • Hi Steve. Thanks. Let me see if that question is similar. – ana Jan 25 '15 at 17:55
  • Steven, the answer posted in that question doesn't seem to work. The image is in the PDF file but it is not flushed against the sides & top. I'm compiling with pdflatex. Do you know why? – ana Jan 25 '15 at 19:23
  • What document class are you using? I could foresee some issues if it is beamer. – Steven B. Segletes Jan 25 '15 at 20:32
2

Probably the easiest way is using the background package. Hopefully, this does not count as "heavy weight":)

Here's how I would do it:

\documentclass{article}
\usepackage{background}
\usepackage{graphicx}

\usepackage{mwe}
\backgroundsetup{placement=top,
  contents={\includegraphics[width=\textwidth,height=2truemm]{example-image-a}}
}
\begin{document}
  \lipsum[1]
\end{document}

and this is what this produces:

enter image description here

You can scale, trim, crop, .. the image using the option of the graphicx package.

  • I'd like to suggest the following modifications to your code: to use the firstpage=true package option (to guarantee that the image appears only on the first page, as required) and setting scale=1 and width=\paperwidth; something like this \usepackage[firstpage=true]{background} \usepackage{graphicx} \usepackage{mwe} \backgroundsetup{placement=top,nodeanchor=north west, scale=1,contents={\includegraphics[width=\paperwidth,height=2cm]{example-image-a}} } – Gonzalo Medina Jan 26 '15 at 2:14
  • Ah, I misread the OP's question; since the image is to appear on just one page, but not necessarily the first one, it's better to use \usepackage[pages=some]{background} \usepackage{graphicx} \usepackage{mwe} \backgroundsetup{placement=top,nodeanchor=north west, scale=1,contents={\includegraphics[width=\paperwidth,height=2cm]{example-image-a}} } and then say \BgThispage at some place on the one page which should receive the image. – Gonzalo Medina Jan 26 '15 at 3:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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