# Redefining section in beamer

I'd like to redefine the \section command in beamer in such a way that it has the "default" behaviours and additionally creates a slide with a certain shape.

So far, I've tried to code sth like

%\newcommand{\oldsection}[1]{\section{#1}}
%\renewcommand{\section}[1]
%{
%   \oldsection{#1}
%   \begin{frame}
%      \begin{center}
%        \LARGE{\textcolor{white}{\textbf{#1}}}
%       \end{center}
%      \end{beamerboxesrounded}
%   \end{frame}
%}


but it doesn't work (looks like some kind of infinite loop. Tries with \titleformat failed as well, but I may be using this command wrongly.

• It results in an infinite loop, because \section expands to \oldsection (and other stuff), and \oldsection expands again to \section. Try \let\oldsection\section instead of \newcommand{\oldsection}[1]{\section{#1}}. – gernot Mar 31 '17 at 13:54
• Alright, it works fine. Care to explain how what you are doing is different ? – R. Absil Mar 31 '17 at 14:01
• In your application \oldsection effectively refers to the new \section, since \oldsection contains literally the name \section, and \section is redefined to mean \oldsection.... If you use \let\oldsection\section, then \oldsection gets the current contents of \section and will be independent of any redefinition of \section. – gernot Mar 31 '17 at 14:15

No need to mess with the \section command, beamer itself has mechanism to easily insert section frames.

\documentclass{beamer}

\usetheme{Berlin}

\AtBeginSection{%
\begin{frame}
\sectionpage
\end{frame}
}

\begin{document}

\section{Blub}
\begin{frame}
abc
\end{frame}

\end{document}


If you don't like this layout, just create your own using

\setbeamertemplate{section page}{...}

• The sad thing with this solution is that it makes all sections behave the same (and for turning this off for some slides only, needs an entire command instead of just a single parameter being empty). – Nobody-Knows-I-am-a-Dog Oct 8 '20 at 15:49