# Beamer: \AtBeginSection doesn't agree with ignorenonframetext

I'm following the advice in the Beamer user guide to produce slides and printed material from the same source using the beamerarticle package. The user guide recommends using the class option ignorenonframetext, so that text living outside of a frame environment will be rendered only in the article format but not in the slideshow -- a way to include notes in handouts that you don't want to show onscreen.

I've also been using this to divide the presentation visibly into sections:

\AtBeginSection[] % Do nothing for \section*
{
\begin{frame}<beamer>
\frametitle{Outline}
\tableofcontents[currentsection]
\end{frame}
}


The trouble is, \AtBeginSection[] and its associated curly braces are outside of a frame environment, so they are ignored, and I don't get the table of contents at the beginning of every section (with highlighting).

Is there any way to get these to work together?

I don't want to reproduce the whole preamble and contents, but here's where the \AtBeginSection bit is stuffed in:

\begin{document}

\begin{frame}\maketitle\end{frame}
\begin{frame}{Outline}
\tableofcontents
\end{frame}

\AtBeginSection[] % Do nothing for \section*
{
\begin{frame}<beamer>
\frametitle{Outline}
\tableofcontents[currentsection]
\end{frame}
}

\section{Introduction}
.... blah blah ......


Thanks! hjh

• I'm not sure about your question but if you want that \AtBeginSection ... be considered only in presentations and not in handouts, use \mode<beamer>{\AtBeginSection...}. Look at section "21.3 Details on Modes" in beameruserguide – Ignasi Jan 13 '14 at 10:54
• Not exactly. For the handout (article-style), I will want to write text outside of frames -- additional notes and discussion that shouldn't clutter the slideshow. To exclude the text outside of frames from the slideshow, I need to use the ignorenonframetext class option. This option seems unfortunately to be a bit too greedy and it also kills \AtBeginSection. So, even if I use a mode indicator, it won't matter because, AFAICS, ignorenonframetext will then kill both the mode command and its contents. // ignorenonframetext is discussed in section 21.2.1 of the beamer manual. – James Jan 13 '14 at 13:48
• Please, provide us with a complete document (or documents) showing your problem. Start with \documentclass and finish with \end{document}. Include only a minimal subset of packages which you need to clearly reproduce the problem. It will be easy to help you. – Ignasi Jan 13 '14 at 14:20
• Try to move \AtBeginSection declaration to preamble (before \begin{document}) and see if this solves your problem. – Ignasi Jan 13 '14 at 16:19
• @Ignasi - that's perfect. I didn't know I could put it in the preamble! All working now. – James Jan 17 '14 at 2:50

If you move \AtBeginSection declaration to the preamble, it will work even with ignorenonframetext option.
I've could not find any explicit reference in beameruserguide about where to place \AtBeginSection commands. But on section 3 "Tutorial: Euclid's Presentation" a conference presentation example (conference-ornate-20min.en.tex) is detailed. In it, \AtBeginSection command is placed before \begin{document} so I always used this way without any problem.