96

Apologies in advance if my question is very basic. I am still learning my beamer skills, so please bear with me.

I want to insert a background image in a beamer frame and use this "frame" as a beamer frame. I want to insert different background images on different frames. Towards this end, I tried

\usebackgroundtemplate{\includegraphics[width=\paperwidth]{../images/crayons.png}}

on a specific frame to insert a background image, but I was unsuccessful. Am I missing any package? Or is there a different way of doing this?

I found this question here about inserting image but not as a background. In addition to inserting a background image, I also want to add text to the frame. (It is highly likely that I could not understand the questions correctly)

As a side note, if any of you are an Emacs org-mode users, can you please tell me a way to do this in org-beamer. I will be very thankful.

Any pointers or help is highly appreciated.

Here is a sample slide code:

\documentclass[bigger]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{soul}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{hyperref}

\begin{frame} \frametitle{Models}
\label{sec-2_3}


\usebackgroundtemplate{\includegraphics[width=\paperwidth]{../images/crayons.png}}

\begin{itemize} 
\item choose training data set
\item choose test data set
\item choose model
\item fit on training data set
\end{itemize}

\end{frame}
  • I know most of you can are aware, but tug.org/pipermail/texhax/2007-March/008035.html is the link from where I got the idea. – suncoolsu Dec 29 '10 at 13:35
  • Do you use latex.exe or pdflatex or ? – xport Dec 29 '10 at 13:40
  • I use pdflatex. You can ignore the rest if you are not an Emacs user - I actually use Emacs Org-mode to create an .org file. I user org-import to creater a beamer file. I am sorry if you are not an Emacs user. – suncoolsu Dec 29 '10 at 13:46
66

alt text

I used images Sir Isaac Newton (rename it as newton.jpg) and Kitten (rename it as kitten.jpg)

The code snippet below is self-explanatory and I compiled using pdflatex.exe because of .jpg format.

\documentclass[bigger]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{graphicx}


%Global Background must be put in preamble
\usebackgroundtemplate%
{%
    \includegraphics[width=\paperwidth,height=\paperheight]{newton.jpg}%
}




\begin{document}

\begin{frame}{Introduction}
\begin{itemize}
\item 1
\item 2
\item 3
\end{itemize}
\end{frame}


% Local background must be enclosed by curly braces for grouping.
{
\usebackgroundtemplate{\includegraphics[width=\paperwidth]{kitten.jpg}}%
\begin{frame}{Kitten}
\begin{itemize}
\item 1
\item 2
\item 3
\end{itemize}
\end{frame}
}

\begin{frame}{Summary}
\begin{itemize}
\item 1
\item 2
\item 3
\end{itemize}
\end{frame}

\end{document}
  • 2
    gosh \usebackgroundtemplate{}? that makes things so easy. man, i love beamer. – aeroNotAuto Mar 6 '12 at 23:00
  • 3
    This doesn't work when using a theme (i.e. Darmstadt, Madrid, Warsaw). – SigmaX May 11 '15 at 15:34
  • 1
    after using "...\usebackgroundtemplate{\includegraphics[width=\paperwidth]{kitten.jpg}}%..." how is possible to modify the opacity of the background? thanks! – Iuli Sep 26 '17 at 20:40
  • @luli nest \includegraphics[width=\paperwidth]{kitten.jpg} in \tikz\node[opacity=0.1]{...}; i.e. \usebackgroundtemplate{\tikz\node[opacity=0.1]{\includegraphics[width=\paperwidth]{kitten.jpg}};} – Chernoff Jun 20 '18 at 20:35
49

Write \usebackgroundtemplate before the frame, not within:

\end{frame}
% Now we install the new template for the following frames:
\usebackgroundtemplate{%
  \includegraphics[width=\paperwidth,height=\paperheight]{crayons}} 
\begin{frame}
...
\end{frame}
% Now we install another template, effective from now on:
\usebackgroundtemplate{...}

Ensure that \includegraphics is able to find the image file, since you used ../images/crayons.png.

  • 1
    I quick question. If I don't need a background, I use a file name which doesn't exist. I am sure there is a better way of doing this. Can you pls enlighten me again? – suncoolsu Dec 29 '10 at 14:23
  • 9
    @suncoolsu: Just use an empty argument: \usebackgroundtemplate{}. – Stefan Kottwitz Dec 29 '10 at 14:56
  • 2
    @StefanKottwitz I don't know if the new syntax was present when you answered this, but from the current point of view \setbeamertemplate{background}{...} might be better. – Henri Menke Dec 31 '14 at 16:03
  • This doesn't work when using a theme (i.e. Darmstadt, Madrid, Warsaw). – SigmaX May 11 '15 at 15:34
  • 1
    How to reset it back to previous background? For example, I have set \setbeamercolor{background canvas}{bg=yellow!20} at the beginning. After the particular slide, then I use \usebackgroundtemplate{}, the background color also reset to white, instead of the yellow!20. – Chen Stats Yu Dec 6 '15 at 15:22

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.