How to place a different background image on each part of a book?

How to place a different background image on each part of a book

  • Do you know if it is possible to place a background image on each \part{} of a book? Ideally, for each part I would like to be able to put a different background image. Currently, I am using the following commands to create the a background image in a latex document, but I cannot think of a way to use on the page of \part{}. Definitions: \usepackage{eso-pic} \newcommand\BackgroundPic{% \put(0,0){% \parbox[b][\paperheight]{\paperwidth}{% \vfill \centering \includegraphics[width=\paperwidth,height=\paperheight,% keepaspectratio]{background.pdf}% \vfill }}} Usage: \AddToShipoutPicture*{\BackgroundPic} \ClearShipoutPicture

  • Answer:

    The following provides \partimage[<options>]{<image>} that places <image> as a full-page spread on a \part page. You can adjust any of the options passed to http://ctan.org/pkg/graphicx using the optional <options> argument. The default sets the image at full page height/width, anchored at the bottom-left of the page. \documentclass{book} \usepackage{graphicx,eso-pic,lipsum,etoolbox} \providecommand{\parthook}{} \patchcmd{\part}{\thispagestyle}{\parthook\thispagestyle}{}{} \newcommand{\partimage}[2][]{% \parthook[<options>]{<image>} \renewcommand{\parthook}{% Update \parthook \AddToShipoutPictureBG*{% Add picture to background of THIS page only \AtPageLowerLeft{\includegraphics[width=\paperwidth,height=\paperheight,#1]{#2}}}% Insert image \renewcommand{\parthook}{}}}% Restore \parthook \begin{document} \partimage{example-image-a} \part{First part} \lipsum[1-20] \partimage[keepaspectratio]{example-image-b} \part{Second part} \lipsum[1-20] \end{document} For optimal management of image properties, you can consider adding \usepackage[export]{adjustbox}% http://ctan.org/pkg/adjustbox to your preamble, which would allow you to add more options to the image inclusion <options>.

Dion_E at TeX - LaTeX Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.