2
\documentclass{article}
\usepackage{eso-pic,graphicx}
\usepackage{lipsum}

\begin{document}
%https://tex.stackexchange.com/questions/463555/how-to-get-addtoshipoutpicture-to-place-image-at-top-of-page

\AddToShipoutPictureBG{%
  \AtPageUpperLeft{%
    \raisebox{-\height}{%
      \includegraphics[width=\paperwidth]{D:/folder1/Folder2/picture.png}%
    }%
  }
}

\lipsum[1-20]

\end{document}

The code (to be found here: How to get \AddToShipoutPicture* to place image at top of page? all credits to @Werner) allows the addition of a background image (when used together with * the image only appears on the first page. Can this code be modified in a way that the background picture appears only on every second page? Thanks for any suggestions!

1 Answer 1

3

You just have to add a condition on when the image is included. The easiest would be to condition on the whether the page number is odd or even:

\ifodd\value{page}
  % <page value is odd>
\else
  % <page value is even>
\fi

Below I print the image in the background on even pages. Drop the \else to print it on odd pages.

\documentclass{article}
\usepackage{eso-pic,graphicx}
\usepackage{lipsum}

\begin{document}

\AddToShipoutPictureBG{%
  \ifodd\value{page}\else
    \AtPageUpperLeft{%
      \raisebox{-\height}{%
        \includegraphics[width=\paperwidth]{example-image}%
      }%
    }%
  \fi
}

\lipsum[1-20]

\end{document}

enter image description here

1
  • It's as simple as that! Thank you!
    – mario1000
    Commented Jul 5 at 16:19

You must log in to answer this question.

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