# Change Beamer frame background between slides in same itemize

I would like to use the slide backgrounds to illustrate the individual items of an itemize environment. However, the background image has to be specified outside the frame for all I know, and only, onslide, uncover, etc. don’t seem to work as expected there (the background is displayed on all slides for values equal 1 and hidden on all slides otherwise).

This is sort of how I’d like to use it, but it doesn’t work of course:

{
\only<1>{\usebackgroundtemplate{\includegraphics[width=\paperwidth]{assets/background-01.png}}}%
\only<2>{\usebackgroundtemplate{\includegraphics[width=\paperwidth]{assets/background-02.png}}}%
\only<3>{\usebackgroundtemplate{\includegraphics[width=\paperwidth]{assets/background-03.png}}}%
\frame{
\frametitle{Promotion}
\begin{itemize}[<+->]
\item Identifying the target audience
\item Understanding the target audience
\item Identifying partners
\end{itemize}
}
}


Thank you!

• Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Nov 6 '14 at 19:22
• I had a similar problem and used TikZ to place a different background for each slide. However that needs some adjustments based on the theme, since the TikZ loaded background would cover the frame title and other outer elements (in my case the background was resized to not cover any theme-related element). – Nico Boni Nov 6 '14 at 20:45

I think what you want is not possible. Take a look at How does beamer build the frame? and will see that background canvas and background are constructed before anything else and the frame contents is the last piece, after titles and sidebars. Therefore even trying to supply a false background with TiKZ overlay and remember picture this background will cover any previous layer.

Next code shows a manual solution built playing with \visible and \invisible. You'll need to build as much as frames as items and if your slides are numbered, you'll need to find how to adjust them.

\documentclass{beamer}

\usepackage{mwe}

\begin{document}
\usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{example-image-a}}
\begin{frame}{Promotion}
\begin{itemize}
\item\visible<1>{Identifying the target audience}
\item\invisible<1>{Understanding the target audience}
\item \invisible<1>{Identifying partners}
\end{itemize}
Some text
\end{frame}

\usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{example-image-b}}
\begin{frame}{Promotion}
\begin{itemize}
\item\visible<1>{Identifying the target audience}
\item\visible<1>{Understanding the target audience}
\item \invisible<1>{Identifying partners}
\end{itemize}
Some text
\end{frame}

\usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{example-image-c}}
\begin{frame}{Promotion}
\begin{itemize}
\item\visible<1>{Identifying the target audience}
\item\visible<1>{Understanding the target audience}
\item\visible<1>{Identifying partners}
\end{itemize}
Some text
\end{frame}

\end{document}


• Wow, thanks! That explains why I haven’t been able to find any solutions for this. – Denis Drescher Nov 7 '14 at 15:29

Now I’ve also experimented with the solution below. It’s seriously hacky, but it’s more DRY, meaning it leads to less code duplication. There’s also no problem with frame numbers.

Many thanks to diabonas for the backgroundblock code.

\documentclass{beamer}

\usepackage{mwe}

% beamer: How to place images behind text (z-order)
% (https://tex.stackexchange.com/a/134311)
\makeatletter
\newbox\@backgroundblock
\newenvironment{backgroundblock}[2]{%
\global\setbox\@backgroundblock=\vbox\bgroup%
\unvbox\@backgroundblock%
\vbox to0pt\bgroup\vskip#2\hbox to0pt\bgroup\hskip#1\relax%
}{\egroup\egroup\egroup}
\makeatother

\begin{document}

\begin{frame}{Promotion}
\only<1>{
\begin{backgroundblock}{-1mm}{0mm}
\includegraphics[width=1.01\paperwidth]{example-image-a}
\end{backgroundblock}
}
\only<2>{
\begin{backgroundblock}{-1mm}{0mm}
\includegraphics[width=1.01\paperwidth]{example-image-b}
\end{backgroundblock}
}
\only<3>{
\begin{backgroundblock}{-1mm}{0mm}
\includegraphics[width=1.01\paperwidth]{example-image-c}
\end{backgroundblock}
}

\begin{itemize}[<+->]
\item Identifying the target audience
\item Understanding the target audience
\item Identifying partners
\end{itemize}

Some text
\end{frame}

\end{document}