[Tex/LaTex] How to include the logo in some slides and remove in others, using beamer

beamer

I want to include a logo in my slides. I am using this:

\logo{\includegraphics[scale=0.05]{../../Logos/CMS_logo_black.png}}

but, due to some graphics are big, in some slides the main graphic overlays the logo.

How can I remove the logo from some slides but keep it in others?

Thanks,

Best Answer

There are two simple ways to do this:

With a conditional

You can create a conditional to insert the logo only if the condition is true, and then turn the logo on and off as needed.

\documentclass{beamer}
\newif\ifplacelogo % create a new conditional
\placelogotrue % set it to true
\logo{\ifplacelogo\color{red}\rule{.5cm}{.5cm}\fi} % replace with your own command
\begin{document}
\begin{frame}
   \frametitle{Test frame}
\end{frame}
\placelogofalse % turn the logo off (needs to be outside the {frame} environment)
\begin{frame}
   \frametitle{Test frame no logo}
\end{frame}
\placelogotrue % turn the logo back on for subsequent slides
\begin{frame}
   \frametitle{Test frame with logo again}
\end{frame}
\end{document}

With grouping and local redefinition

Another alternative, which doesn't require a conditional, would be to enclose the frame (or set of frames) in a group and redefine the logo template within the group.

\documentclass{beamer}

\logo{\color{red}\rule{.5cm}{.5cm}}
\newcommand{\nologo}{\setbeamertemplate{logo}{}} % command to set the logo to nothing
\title{A title}
\author{An author}

\begin{document}

\maketitle

\begin{frame}[t]\frametitle{Test frame}
\end{frame}

% must enclose the frame(s) without the logo in braces
% any number of frames can be within the group (here 2).

{\nologo
\begin{frame}\frametitle{Test frame no logo}
\end{frame}
\begin{frame}\frametitle{Another Test frame no logo}
\end{frame}
}

\begin{frame}\frametitle{Test frame with logo again}
\end{frame}
\end{document}