5

I have been using AtBeginSection to insert a title page at the beginning of a new section (following the answer to this question). The title page follows the format of the beamer theme. However, I want to deactivate this automatic title page or change the formatting for some specific sections. How can I do this?

2 Answers 2

8

You can use the optional argument of \AtBeginSection and \section* to insert a different code at the beginning of some sections. So you can use an empty optional argument for \AtBeginSection and \section* for the specific section without automatic title page.

\documentclass{beamer}
\usetheme{Madrid}

\AtBeginSection[]{
  \begin{frame}
  \vfill
  \centering
  \begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
    \usebeamerfont{title}\insertsectionhead\par%
  \end{beamercolorbox}
  \vfill
  \end{frame}
}

\title{The Title}
\author{The Author}
\institute{The Institute}

\begin{document}

\begin{frame}
\maketitle
\end{frame}

\section{Test section one}
\begin{frame}
test frame for section one
\end{frame}

\section*{Test section two}
\begin{frame}
test frame for section two
\end{frame}

\section{Test section three}
\begin{frame}
test frame for section three
\end{frame}

\end{document}

Result:

enter image description here


Update

If you can not use the starred version of \section because you need the bookmark, then maybe you can use \newif and define commands to switch for the next section or all following sections:

\documentclass{beamer}
\usetheme{Madrid}

\newif\ifSectionTitlePage
\newcommand*\SectionTitlePagedefault{\SectionTitlePagefalse}

\newcommand\AllSectionsWithTitlePage{%
  \SectionTitlePagetrue
  \renewcommand*\SectionTitlePagedefault{\SectionTitlePagetrue}%
}
\newcommand\AllSectionsWithoutTitlePage{%
  \SectionTitlePagefalse
  \renewcommand*\SectionTitlePagedefault{\SectionTitlePagefalse}%
}
\newcommand\NextSectionWithTitlePage{\SectionTitlePagetrue}
\newcommand\NextSectionWithoutTitlePage{\SectionTitlePagefalse}

\AtBeginSection[]{%
  \ifSectionTitlePage
    \begin{frame}
    \vfill
    \centering
    \begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
      \usebeamerfont{title}\insertsectionhead\par%
    \end{beamercolorbox}
    \vfill
    \end{frame}
  \fi
  \SectionTitlePagedefault
}

\AllSectionsWithTitlePage% <- enable the title pages

\title{The Title}
\author{The Author}
\institute{The Institute}

\begin{document}

\begin{frame}
\maketitle
\end{frame}

\section{Test section one}
\begin{frame}
test frame for section one
\end{frame}

\NextSectionWithoutTitlePage% <- disable the title page for the next section
\section{Test section two}
\begin{frame}
test frame for section two
\end{frame}

\section{Test section three}
\begin{frame}
test frame for section three
\end{frame}
\end{document}

The result is the same as above but with a bookmark for section 2 too.

2
  • Thank you. With the starred section, however, the section name disappears from the bookmarks. Is there a way to use the optional argument of AtBeginSection and maintain the section name in the bookmarks?
    – Andre
    Jul 27, 2017 at 14:05
  • @user115089 See my updated answer.
    – esdd
    Jul 27, 2017 at 15:42
5

In case you don't want to use a starred section for some reason (personally I would use the solution of esdd), you could redefine \AtBeginSection[]{} within a group:

\documentclass{beamer}
\usetheme{Madrid}

\AtBeginSection[]{
  \begin{frame}
  \vfill
  \centering
  \begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
    \usebeamerfont{title}\insertsectionhead\par%
  \end{beamercolorbox}
  \vfill
  \end{frame}
}

\title{The Title}
\author{The Author}
\institute{The Institute}

\begin{document}

\begin{frame}
\maketitle
\end{frame}

\section{Test section one}
\begin{frame}
test frame for section one
\end{frame}

{
\AtBeginSection[]{}
\section{Test section two}
\begin{frame}
test frame for section two
\end{frame}
}

\section{Test section three}
\begin{frame}
test frame for section three
\end{frame}

\end{document}

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.