4

I created background canvas for my presentation. I don't want the image if the frame style is plain. How can I extend my style file that no background image appears if \begin{frame}[plain] is used.

What I already have

\setbeamertemplate{background canvas}
    {\ifnum\thepage=1\relax%
        {%
        \includegraphics{Background_page1}
        }
        \else%
\includegraphics{Background}
     \fi%
    }

1 Answer 1

6

beamer has the boolean beamer@plainframe to decide whether the plain option is activated or not, so you can use it in your conditional installment of the background canvas template:

\documentclass{beamer}
\usetheme{CambridgeUS}

\makeatletter
\setbeamertemplate{background canvas}{%
\ifbeamer@plainframe%
\else
  \ifnum\thepage=1\relax% 
  \includegraphics{example-image-a}% 
  \else 
  \includegraphics{example-image-b}% 
  \fi
\fi 
}
\makeatother

\begin{document}

\begin{frame}
\frametitle{A test regular frame}
\end{frame}

\begin{frame}[plain]
\frametitle{A test frame with the \texttt{plain} option}
\end{frame}

\begin{frame}
\frametitle{Another test regular frame}
\end{frame}

\end{document}

The result:

enter image description here

You must log in to answer this question.

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