Having multiple slide templates in LaTeX Beamer
Asked Answered
D

4

7

I'd like to create a presentation using LaTeX beamer, that has two different sort of slide templates/layouts: one for slides with a background image and one layout/template for slides without a specified background image.

Is there any trick to do this using beamer?

Damp answered 1/7, 2010 at 14:21 Comment(1)
Have you tried asking here: tex.stackexchange.com ?Karim
H
1

Basically I boils down to putting \usebackgroundtemplate before each \begin{frame}...\end{frame}.

Heretical answered 8/12, 2010 at 7:29 Comment(0)
P
1

If you want a specific background image for a single slide, just put an

{\usebackgroundtemplate{\includegraphics[width=\paperwidth]{background.jpg}}

directly before your \begin{frame}.

Phonetics answered 28/2, 2013 at 12:59 Comment(0)
Q
1

This can easily be done via a new frame option:

\documentclass{beamer}

\defbeamertemplate{background canvas}{mydefault}{%
  \includegraphics[width=1cm]{example-image-duck}
}
\defbeamertemplate{background canvas}{fullimage}{%
  \includegraphics[width=\paperwidth]{example-image-duck}
}

\BeforeBeginEnvironment{frame}{%
  \setbeamertemplate{background canvas}[mydefault]%
}

\makeatletter
\define@key{beamerframe}{fullimage}[true]{%
  \setbeamertemplate{background canvas}[fullimage]%
}
\makeatother

\begin{document}

\begin{frame}
  left
\end{frame} 

\begin{frame}[fullimage]
  right
\end{frame}

\begin{frame}
  is left again
\end{frame}

\end{document}
Quintanilla answered 28/2, 2019 at 10:38 Comment(0)
F
0

If I understand correctly, the question is how to generate two copies of the presentation simultaneously. To do this, you use some low-level tex commands and several files.

In Presentation.tex you might have

%&pdftex
\relax
\immediate\write18{pdflatex -synctex=1 PresentationWithBG.tex}
\relax
\immediate\write18{pdflatex -synctex=1 PresentationWithoutBG.tex}
\end

That is the only file you will actually have to run latex on, which you do with pdftex --shell-escape Presentation.tex. But you will also need the following.

In PresentationWithBG.tex (note that you don't actually need \usebackgroundtemplate before each frame):

\documentclass{beamer}
\setbeamercolor{background canvas}{bg=}
\usebackgroundtemplate{\includegraphics[width=\paperwidth]{<your_background_fig>}}
\input{PresentationContent}

In PresentationWithoutBG.tex:

\documentclass{beamer}
\input{PresentationContent}

In PresentationContent.tex:

\begin{document}
[All your actual presentation goes here...]
\end{document}

When you run pdftex --shell-escape Presentation.tex, you'll get PresentationWithBG.pdf and PresentationWithoutBG.pdf.

Note that %&pdftex in Presentation.tex makes sure that whichever version of TeX is running switches into the right mode. You could actually run it with pdflatex.

Fane answered 13/2, 2012 at 4:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.