4

I read the instructions here Beamer: title-page full page image to create a presentation with a background only in the title page, I don't know too much about LaTex because I use pandoc to generate the presentations. Anyway, I can modify the LaTex file pandoc generates to add the background, but it doesn't work. Here is the LaTex, there are a lot of things generated by pandoc:

\documentclass[ignorenonframetext,]{beamer}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{caption label separator}{: }
\setbeamercolor{caption name}{fg=normal text.fg}
\beamertemplatenavigationsymbolsempty
\usepackage{lmodern}
\usepackage{tikz}

\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
\else % if luatex or xelatex
  \ifxetex
    \usepackage{mathspec}
  \else
    \usepackage{fontspec}
  \fi
  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\fi
\usecolortheme{fly}
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\newif\ifbibliography
\hypersetup{
            pdftitle={Testing background images},
            pdfauthor={First Author; Second Author},
            pdfborder={0 0 0},
            breaklinks=true}

% Prevent slide breaks in the middle of a paragraph:
\widowpenalties 1 10000
\raggedbottom

\AtBeginPart{
  \let\insertpartnumber\relax
  \let\partname\relax
  \frame{\partpage}
}
\AtBeginSection{
  \ifbibliography
  \else
    \let\insertsectionnumber\relax
    \let\sectionname\relax
    \frame{\sectionpage}
  \fi
}
\AtBeginSubsection{
  \let\insertsubsectionnumber\relax
  \let\subsectionname\relax
  \frame{\subsectionpage}
}

\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em}  % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{0}
\usebackgroundtemplate{\includegraphics[width=\paperwidth]{Figures1.jpg}}
\title{Testing background images}
\author{First Author \and Second Author}
\institute{Universidad Nacional De Gral. Sarmiento}
\date{May 2017}

\begin{document}

\frame{\titlepage}
{
\usebackgroundtemplate{}

\begin{frame}{Test slide}

This is a test with no background

\begin{itemize}
\tightlist
\item
  Item 1
\end{itemize}

\end{frame}
}
\end{document}

2 Answers 2

6

You should remove the option specified for beamer, and then use:

{
\usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{yourimagename}}
\begin{frame}
\titlepage
\end{frame}
}

To make an image only slide, with titles. Here is an example, with a cat on the first slide and the glimpse of the second slide (Test slide). Please bear in mind that I'm using the frame environment; I don't recommend using the frame command (I think it has no benefit here and causes confusion about the usage) :

    \documentclass{beamer}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{caption label separator}{: }
\setbeamercolor{caption name}{fg=normal text.fg}
\beamertemplatenavigationsymbolsempty
\usepackage{lmodern}
\usepackage{tikz}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
\else % if luatex or xelatex
  \ifxetex
    \usepackage{mathspec}
  \else
    \usepackage{fontspec}
  \fi
  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\fi
\usecolortheme{fly}
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\newif\ifbibliography
\hypersetup{
            pdftitle={Testing background images},
            pdfauthor={First Author; Second Author},
            pdfborder={0 0 0},
            breaklinks=true}

% Prevent slide breaks in the middle of a paragraph:
\widowpenalties 1 10000
\raggedbottom

\AtBeginPart{
  \let\insertpartnumber\relax
  \let\partname\relax
  \frame{\partpage}
}
\AtBeginSection{
  \ifbibliography
  \else
    \let\insertsectionnumber\relax
    \let\sectionname\relax
    \frame{\sectionpage}
  \fi
}
\AtBeginSubsection{
  \let\insertsubsectionnumber\relax
  \let\subsectionname\relax
  \frame{\subsectionpage}
}

\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em}  % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{0}


\title{Testing background images}
\author{First Author \and Second Author}
\institute{Universidad Nacional De Gral. Sarmiento}
\date{May 2017}

\begin{document}

{
\usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{example}}
\begin{frame}
\titlepage
\end{frame}
}
\begin{frame}{Test slide}

This is a test with no background

\begin{itemize}
\tightlist
\item
  Item 1
\end{itemize}

\end{frame}

\end{document}

enter image description here

I think the main reason behind this behaviour is that the ignorenonframetext option alters the parsing mode of the beamer file, entering the so-called mode*.

Quoting the beamer manual:

The text is gobbled token by token until one of the following tokens is found: \mode, \frame, \againframe, \part, \section, \subsection, \appendix, \note, \begin{frame}, and \end{document}

Basically this ignores the usebeamertemplate command, thus yielding the result

9
  • Nice cat! _____________________ Jun 9, 2017 at 19:41
  • @samcarter thanks, I wish I could say it was mine
    – Moriambar
    Jun 9, 2017 at 19:58
  • I added this because I need the titles but I don't work \begin{document} { \usebackgroundtemplate{\includegraphics[width=\paperwidth]{Figures/Schloss_krill_Fig2.jpg}} \frame{\titlepage} } \begin{frame}{Test slide} ...
    – Leosar
    Jun 9, 2017 at 21:58
  • @Leosar I don't understand your comment
    – Moriambar
    Jun 9, 2017 at 22:02
  • Instead of \begin{frame} \end{frame} I put \frame{\titlepage} but in any case it doesn't show the bacground image
    – Leosar
    Jun 9, 2017 at 22:07
0

The reason, as was noted by @moriambar, is the ignorenonframetext option which pandoc adds. So to circumvent this restrictions, you have to mark the \setbeamertemplate (or \usebackgroundtemplate for the legacy command) as belonging to the presentation, like so:

\begin{document}
\mode<all>  % enable the interpretation of the next line
\setbeamertemplate{background canvas}{\includegraphics[width=\paperwidth]{Figures1.jpg}}
\frame{\titlepage}

% Undo the background and reset the mode to \mode*
\mode<all>\setbeamertemplate{background canvas}{}
\mode*

\begin{frame}{My next frame title}
...
\end{frame}

You must log in to answer this question.

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