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:

Anonymous 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

Unknown said...

Great Ticks!

Anonymous 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.

Unknown said...

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

Anonymous said...

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

fethi said...

thanks, worked great!

Eric said...

thx it work perfectly fine...

V said...

Gracias!!! (Thanks!)

Anonymous said...

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