21

I'm trying to use an image as a background for Beamer presentation according to this post. However, I do not want the image spanning the entire background. Thus, I'm doing something like:

\usebackgroundtemplate{% \centering
\hspace{4.5cm}
\includegraphics[width=1.5in]{image.jpeg}
}

The \hspace command works, but \vspace does not work. Basically, I'm trying to get the image to be at the center of the page. Any ideas on how this can be done?

29

You can box the image and then use \vfil and \hfil to center it:

\PassOptionsToPackage{demo}{graphicx}
\documentclass{beamer}

\usebackgroundtemplate{%
  \vbox to \paperheight{\vfil\hbox to \paperwidth{\hfil\includegraphics[width=1.5in]{name}\hfil}\vfil}
}

\begin{document}

\begin{frame}
Test
\end{frame}

\end{document}

The line \PassOptionsToPackage{demo}{graphicx} was used to make my example compilable for everyone (replacing the image for a black rectangle); do not use that line in your actual document.

You can also use a \parbox with width and height equal to \paperwidth and \paperheight, resp., and center vertically with the optional argument, and horizontally using \centering:

\usebackgroundtemplate{%
  \parbox[c][\paperheight][c]{\paperwidth}{\centering\includegraphics[width=1.5in]{name}}
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.