[Tex/LaTex] Beamer: title-page full page image

beamerpresentations

I need to create a full-slide image as the first and final slides, as well as having a separate theme for the title page.

I've been given the first/last slides, the title page and the generic slides as .jpg files. They're called firstpage.jpg, titlepage.jpg, slide.png respectively.

So far I can create the generic slide with this sty file (beamerinnerthemecdt.sty):

\mode<presentation>

\setbeamertemplate{background canvas}{\begin{tikzpicture}\node[opacity=.9]
{\includegraphics [width=\paperwidth]{slide.png}};
\end{tikzpicture}}

% Title page
\defbeamertemplate*{title page}{cdt}[1][]
{ \begin{tikzpicture}
  \titlegraphic{\includegraphics[width=\paperwidth]{titlepage.jpg}}
  \end{tikzpicture}}

\mode
<all>

My colour theme is:

\mode<presentation>

% Settings
\setbeamercolor*{title page header}{fg=white}
\setbeamercolor*{author}{fg=white}
\setbeamercolor*{date}{fg=white}

\mode
<all>

and my outer theme is:

\mode<presentation>

% Frame title
\defbeamertemplate*{frametitle}{texsx}[1][]
{
\vskip1cm%
  \begin{beamercolorbox}[wd=\paperwidth,ht=1.2cm]{frametitle} 

 \end{beamercolorbox}
}

\mode<all>

Here is an example presentation file:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\title{There Is No Largest Prime Number}
\date[ISPN ’80]{27th International Symposium of Prime Numbers}
\author[Euclid]{Euclid of Alexandria \texttt{euclid@alexandria.edu}}

\usetheme{cdt}

\begin{document}

\begin{frame} 
\frametitle{There Is No Largest Prime Number} 
\framesubtitle{The proof uses \textit{reductio ad absurdum}.} 
\begin{theorem}
There is no largest prime number. \end{theorem} 
\begin{enumerate} 
\item<1-| alert@1> Suppose $p$ were the largest prime number. 
\item<2-> Let $q$ be the product of the first $p$ numbers. 
\item<3-> Then $q+1$ is not divisible by any of them. 
\item<1-> But $q + 1$ is greater than $1$, thus divisible by some prime
number not in the first $p$ numbers.
\end{enumerate}
\end{frame}


\end{document}

This seems to work ok, but I can't get beamer to add the other slides as well.

How would I go about defining the .sty files so that I had a first page, title page, generic slide and final (same as first) page slides. I.e. how do I get beamer to accept these images as backgrounds for the appropriate slide?

Best Answer

The following minimal working example shows how you can include arbitrary background images on any frame within your presentation.

This code tells LaTeX to include the figure default.jpg as the background for every frame except those for which you specify a different background. The below code produces a document of five slides with the following background images:

(1) picture1.jpg; (2) default.jpg; (3) default.jpg; (4) picture2.jpg; (5) no bckground image.

\documentclass{beamer}
\usepackage{graphicx}
\usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{default.jpg}}
\begin{document}


{
\usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{picture1.jpg}}
\begin{frame}
  [...]
\end{frame}
}


\begin{frame}
  [...]
\end{frame}


\begin{frame}
  [...]
\end{frame}


{
\usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{picture2.jpg}}
\begin{frame}
  [...]
\end{frame}
}


{
\usebackgroundtemplate{}
\begin{frame}
  [...]
\end{frame}
}
\end{document}

Replace the [...] with whatever content you want on the frame and LaTeX will simply overlay that content on top of the background image. Alternatively, if you want to produce a slide with only the background image and no other content, you can simply make an empty frame:

{
\usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{picture.jpg}}
\begin{frame}
\end{frame}
}