Sunday, March 2, 2008

How to background image in LaTeX

Add this code before
the \begin{document} part

\usepackage{eso-pic}
\newcommand\BackgroundPic{
\put(0,0){
\parbox[b][\paperheight]{\paperwidth}{%
\vfill
\centering
\includegraphics[width=\paperwidth,height=\paperheight,
keepaspectratio]{background.png}%
\vfill
}}}

and this one right following the \begin{document} :

\AddToShipoutPicture{\BackgroundPic}

The name of background image is background.png.

10 comments:

tismy said...

this is exactly what i was looking for, worked like a charm...
it has issues with \keepaspectratio part but i wont complain abt it....

u r just great..i love u

LotaBi said...

Great Ticks!

LostPhD said...

Anyone an idea how to place a background image only once (on my LaTex front page) maybe using a similar command?

Zoltan Kuscsik said...

I solved it by splitting the documents in to two parts. Firs one with the bg image and the second without background. After building the ps files you can join them by using the psselect command.

Rachel said...

an easier way is to just type:
\AddToShipoutPicture*{\BackgroundPic}
have a look at the eso-pic pdf for other options

ulaek said...

Worked perfectly. Altso with the \AddToShipoutPicture*-command.
Thank you!

fethi said...

thanks, worked great!

Eric said...

thx it work perfectly fine...

VĂ­ctor said...

Gracias!!! (Thanks!)

Anonymous said...

Had to \usepackage{graphicx} to make it work.