5

I want to make a company letterhead in LaTeX (example output here), and I did it using fancyhdr and absolute positioning, which, while horrible, worked fine so far.

I must have updated XeLaTeX, because now every page after the second is broken. It used to give me warnings about badboxes, but everything worked fine. I think the badboxes were because the "background" image was really in the foreground, and the text was just forcefully positioned over it.

What I want to do is:

  1. Create a title page with \maketitle that doesn't include a background image.
  2. Include a background image on every other page.
  3. Create a "back cover" page (using \makeback) that doesn't include the background image.

I tried the wallpaper package, but it can only set a wallpaper on every page. I tried the xwatermark package, but it complains about something called undefined name grey!55, which I have no idea about. How can I accomplish what I need?

2
  • The "undefined name grey!55" seems to be some misuse of the color packages. "grey!55" is a valid xcolor color definition, but maybe an incompatible color package is loaded as well.
    – Toscho
    Commented Mar 24, 2013 at 11:55
  • Hmm, I don't use it anywhere, I don't know about the other packages... I'll have a look, thank you. Commented Mar 24, 2013 at 12:48

2 Answers 2

7

If you start your document with the title on page 1, the following is enough:

\documentclass{article}
\usepackage{graphicx}
\usepackage{eso-pic}
\usepackage{ifthen}

\title{foobar}
\usepackage{lipsum}
\begin{document}
\maketitle
\AddToShipoutPictureBG{\ifthenelse{\isodd{\value{page}}}{}{\includegraphics{backgroundimage.pdf}}}
\lipsum[1-30]
\end{document}

I don't know about the \makeback macro, so I can't tell you anything about that.

5
  • Hmm, that almost works, but only adds it on odd pages (predictably). The \makeback macro also just needs a way to remove it, as it's the last page and won't need anything else. Commented Mar 24, 2013 at 12:47
  • I used Jubobs' solution for the \ifthenelse and it works perfectly, thank you! It does include a small blank margin to the left, though, do you know how I might remove that so the graphic is flush to the left? Commented Mar 24, 2013 at 12:59
  • 1
    @StavrosKorokithakis: Change the line \AddToShipoutPictureBG{\ifthenelse{\isodd{\value{page}}}{}{\includegraphics{backgroundimage.pdf}}} to \AddToShipoutPictureBG{\ifthenelse{\value{page}<2}{}{\includegraphics{backgroundimage.pdf}}} for it to work.
    – Sony
    Commented Mar 24, 2013 at 13:56
  • That's what I did and it worked well, thanks. I do get a ~2mm margin at bottom that doesn't go away, but I don't think there's much to do about that. Commented Mar 24, 2013 at 18:07
  • By the way, I removed the blank left margin by putting the entire command on one line (having it on multiple lines was what caused it). Commented Mar 24, 2013 at 18:08
0

I recommend another kind of solution. Use the background as a separate pdf and use pdftk to "stamp" the pdf generated with TeX. With the multistamp option, you should use a two page pdf as option, where the first page is empty and the second contains your background. The multistamp option was introduced with pdftk 1.44 (AFAIK) and some linux distributions have the older version 1.41 included.

4
  • That will only stamp two pages, though. I want every page past the first one to be stamped with the same background. The solutions posted above work fine, though. Commented Mar 24, 2013 at 18:07
  • no, this stamp all pages
    – Micha
    Commented Mar 24, 2013 at 20:10
  • all pages after the last page of the "stamp pdf" will be stamped with the last page of the "stamp pdf"
    – Micha
    Commented Mar 26, 2013 at 5:12
  • see my other answer to a similiar problem: tex.stackexchange.com/questions/91243/…
    – Micha
    Commented Apr 24, 2013 at 7:38

You must log in to answer this question.

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