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

%   \oldsection{#1}
%   \begin{frame}
%      \begin{beamerboxesrounded}[scheme=esi-blue,shadow=true]{}
%      \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.

Thanks for your help

  • 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
  • Consider the definitions \newcommand\A{X}\newcommand\B{\A}\let\C\A\renewcommand\A{Y}, and then execute \A\B\C. What you will get is YYX. \B is a macro that contains \A, and the contents of \A is only used when \B is used, therefore \B gives Y. After \let\C\A, on the other hand, \C has the same contents as \A has, i.e. X. When the macro \A is later changed to mean Y, this does not affect \C, but it affects \B since it still contains \A. – gernot Mar 31 '17 at 14:11
  • 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.







enter image description here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.