beamer add tag
Tim Hilt (imported from SE)
I have a beamer-project, where it's required to have a sidebar, but not for the `\AtBeginSection`-slides.

What i've tried is to look at the definition of the sidebar-theme (`kpsewhich beamerouterthemesidebar.sty`) and define a new, empty template that i can switch to locally in the `\AtBeginSection`-block. This does what i want, but it doesn't work locally. I get an error, if i include the `\setbeamertemplate` inside the `\AtBeginSection`-block.

MWE:

``` latex
\documentclass{beamer}

\useoutertheme[%
width=3cm,
height=1cm,
hideothersubsections,
]{sidebar}

% This works but disables sidebar globally
\makeatletter
\defbeamertemplate{sidebar \beamer@sidebarside}{dummy}{}
\setbeamertemplate{sidebar \beamer@sidebarside}[dummy] % Comment out for local option
\makeatother

\AtBeginSection[]{
  % This throws an error:
  % \makeatletter
  % \setbeamertemplate{sidebar \beamer@sidebarside}[dummy]
  % \makeatother
  \begin{frame}
    {\thesection\\[.4ex]\insertsectionhead}
  \end{frame}
}

\begin{document}

\section{First section}

\begin{frame}{Title}
  Some content
\end{frame}

\begin{frame}{Title}
  Some content
\end{frame}

\section{Second section}

\begin{frame}{Title}
  Some content
\end{frame}

\begin{frame}{Title}
  Some content
\end{frame}

\end{document}
```
Top Answer
samcarter
The problem seems to be the expansion of `\beamer@sidebarside` inside the `\AtBeginSection{...}` macro. As a simple workaround, you could "hide" the command in another macro.

To restrict the change to the section slide, you will also need to wrap it in an additional group and in case you not only want to remove the content of the sidebar, but also the space reserved for it, you can add

```
\hoffset=-\beamer@leftsidebar
\advance\textwidth\beamer@sidebarwidth
\hsize\textwidth
\columnwidth\textwidth	
```

Full MWE:

```
\documentclass{beamer}

\useoutertheme[%
width=3cm,
height=1cm,
hideothersubsections,
]{sidebar}

\makeatletter
\newcommand{\hidesidebar}{%
	\setbeamertemplate{sidebar \beamer@sidebarside}{}
	\hoffset=-\beamer@leftsidebar
	\advance\textwidth\beamer@sidebarwidth
	\hsize\textwidth
	\columnwidth\textwidth	
	}
\makeatother

\AtBeginSection[]{%
	\begingroup
		\hidesidebar
	  \begin{frame}
	    {\thesection\\[.4ex]\insertsectionhead}
	  \end{frame}
  \endgroup
}

\begin{document}

\section{First section}

\begin{frame}{Title}
  Some content
\end{frame}

\begin{frame}{Title}
  Some content
\end{frame}

\section{Second section}

\begin{frame}{Title}
  Some content
\end{frame}

\begin{frame}{Title}
  Some content
\end{frame}

\end{document}
```

(I would prefer if this answer would **not** be copied to tex.se)

This room is for discussion about this question.

Once logged in you can direct comments to any contributor here.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.