4

I'm replicating (parts of) a PowerPoint design as a beamer template. In this design some PP layouts, most noticeable the title page use a full color bg, whereas the rest have a white bg.

Any advice on how to provide this?

I was looking at \setbeamercolor{background canvas}{bg=...}, but that has to be set outside frames, so that is a no go, ends up giving a cumbersome interface.

I'm tempted to remove head and foot line (if possible) and just make a beamercolorbox that takes up everything

Any suggestions?

daleif
  • 54,450

3 Answers3

5

You could provide the background using a command and a TikZ \node:

\documentclass{beamer}
\usepackage{tikz}

\newcommand\Background{%
\begin{tikzpicture}[remember picture,overlay]
\node[inner sep=0pt,outer sep=0pt,opacity=0.5] 
  at (current page.center)
  {\includegraphics[width=\paperwidth,height=\paperheight]{expl3}};  
\end{tikzpicture}%
}
\begin{document}

\begin{frame}
Test frame with no background
\end{frame}

\begin{frame}
\Background
Test frame with background
\end{frame}

\begin{frame}
Test frame with no background
\end{frame}

\end{document}

The result:

enter image description here

A more sophisticated option would be to redefine the frame environment to add the background as an option.

Gonzalo Medina
  • 505,128
  • ahh, man, been trying and failing all day. Seems I was missing the overlay option. Without it current page.south west was very unpredictable. – daleif Jul 21 '15 at 14:29
1

You can always define a new environment which builds a frame with a particular background color. Following code is just an starting point. It won't work with fragile frames and doesn't allow other frame options like b,c,t or overlay specifications.

\documentclass[11pt]{beamer}

\newenvironment{colorframe}[2][]{%
\setbeamercolor{background canvas}{bg=#1}
\begin{frame}\frametitle{#2}}
{\end{frame}}

\begin{document}

\begin{frame}{Global Background Color}
  No Content
\end{frame}

\begin{colorframe}[red]{Red background}
  Some Content
\end{colorframe}

\begin{colorframe}[green]{Green background}
  Some Content on Green Background
\end{colorframe}

\begin{frame}{Global Background Color}
  No Content
\end{frame}

\end{document}

enter image description here

Ignasi
  • 136,588
  • 1
    That is the bad part of it. It limits the user (which I don't like). Really annoying that options cannot be passed on to frame – daleif Jul 21 '15 at 14:43
  • @daleif You're right. I would like to know how to add new options to frame, something like \begin{frame}[background color=...] similar to \begin{frame}[plain] but there's nothing in beameruserguide about it. – Ignasi Jul 21 '15 at 15:08
  • Never trust the manual, go straight for the source. ;-) – daleif Jul 21 '15 at 15:11
  • Holy crap, that was easy: \define@key{beamerframe}{background color}{% \setbeamercolor{background canvas}{bg=#1} } – daleif Jul 21 '15 at 15:14
  • Damn, it ends up being global for some reason – daleif Jul 21 '15 at 15:16
  • @daleif: Does it help? http://tex.stackexchange.com/questions/7126/run-a-macro-before-the-start-of-each-frame-slide – Ignasi Jul 21 '15 at 15:22
  • Not really. Looking at the code, I can see that \setkeys does not seem to be set inside a group. So basically one would have to store the current background canvas settings, and restore them later on. Might be worth a feature request – daleif Jul 21 '15 at 15:26
0

The easiest way to do this is to put the \setbeamercolor and the frame inside a group.

\documentclass[11pt]{beamer}

\begin{document}

\begin{frame}{Global Background Color}
  No Content
\end{frame}

\begingroup
\setbeamercolor{background canvas}{bg=green}
\begin{frame}{Different Background Color}
  No Content
\end{frame}
\endgroup

\begin{frame}{Global Background Color}
  No Content
\end{frame}

\end{document}
Benjamin
  • 4,781
  • 2
    But that is not a particularly attractive interface for users. It makes it look as an after thought or even cheesy. – daleif Jul 21 '15 at 12:37
  • It depends on the application. I use it this way to create section slides. There it doesn't matter, as the regular user does not see the code. In case of the title page you can redefine the \maketitle command that way. Then the user will not see the changes either. – Benjamin Jul 21 '15 at 12:47
  • As this is a template for use at a university, for both students and faculty, the interface need to be simple and easy to understand. Plus it is not only the title page that need a bg change. There are other layouts as well. The main problem here might be that we cannot easily use frame as an internal part of another env. At least not if we want to be able to accept options to the env. – daleif Jul 21 '15 at 12:51
  • Ok, from my point of view it wasn't clear that you need this for other frames as well. Yet I still don't see the use case where you need to define a custom frame which also needs to accept options. Imho the individual frames of a presentation should be as consistent as possible. Maybe you can elaborate the other cases you need this a bit more. – Benjamin Jul 21 '15 at 13:21
  • In student presentations it is quite often needed to specify the fragile option to the frame env, because of e.g. listings. I'm quite sure they will never need this background for this sort of thing, but it is better to be on the safe side and know how to do it, or why one cannot do this. – daleif Jul 21 '15 at 13:24
  • It's clear to me why options are necessary. Also allowframebreaks is used quite often. But I still do not understand where (other than special pages like the title or so) you need a different background color. Can you maybe provide an example document of the PowerPoint presentation you are replicating? – Benjamin Jul 21 '15 at 13:30
  • Not unless you install the PP design. The design is not provided with PDF refeerence (though I had to make my own). In the design there are end pages (so what easy to do), but also a layout for a ending remark page. All of these plus the title page have full color bg. – daleif Jul 21 '15 at 13:40