4

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{[email protected]}}

\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?

6
  • 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
    Jun 25, 2014 at 12:54
  • I've added an example file, but I'm not sure that'll help.
    – Tom Kealy
    Jun 25, 2014 at 13:11
  • Try this: \begin{tikzpicture}[remember picture,overlay] \begin{pgfonlayer}{background} \node at (current page.center) {\includegraphics[width=\paperwidth,height=\paperheight]{YUR_IMG}}; \end{pgfonlayer} \end{tikzpicture}
    – s__C
    Jun 25, 2014 at 13:19
  • @s__C in the defbeamertemplate in the inner theme?
    – Tom Kealy
    Jun 25, 2014 at 13:22
  • @TomKealy if you want this image to appear on each frame... else just in the specific frame you want. Plus you may need to play with width + height (and also add \usetikzlibrary{backgrounds} in your preamble)
    – s__C
    Jun 25, 2014 at 13:27

1 Answer 1

3

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}
}

You must log in to answer this question.

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