Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 18 down vote accepted

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}}
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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