124

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.

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}
3
  • 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, 2010 at 13:35
  • Do you use latex.exe or pdflatex or ? Dec 29, 2010 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, 2010 at 13:46

3 Answers 3

94

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}
5
  • 3
    gosh \usebackgroundtemplate{}? that makes things so easy. man, i love beamer. Mar 6, 2012 at 23:00
  • 5
    This doesn't work when using a theme (i.e. Darmstadt, Madrid, Warsaw).
    – SigmaX
    May 11, 2015 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, 2017 at 20:40
  • 3
    @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, 2018 at 20:35
  • This formulation is no longer functional with more recent versions of TexLive. I am currently on version 2022, \usebackgroundtemplate{} has no effect whatsoever. Jun 23, 2023 at 14:13
65

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.

Edit: The \usebackgroundtemplate should be enclosed with curly braces along with frame (or frames) which it should affect

8
  • 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, 2010 at 14:23
  • 9
    @suncoolsu: Just use an empty argument: \usebackgroundtemplate{}.
    – Stefan Kottwitz
    Dec 29, 2010 at 14:56
  • 3
    @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. Dec 31, 2014 at 16:03
  • This doesn't work when using a theme (i.e. Darmstadt, Madrid, Warsaw).
    – SigmaX
    May 11, 2015 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. Dec 6, 2015 at 15:22
2
\documentclass{beamer}
\usetheme{metropolis}
\begin{document}
{
\usebackgroundtemplate{\includegraphics[width=\paperwidth]{example-image-a}}
\begin{frame}{Title}
Content
\end{frame}
}
\begin{frame}{Title}
Content
\end{frame}
\end{document}
1
  • This doesn't do a thing with TexLive 2022. Jun 23, 2023 at 14:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .