# Beamer, framebreaks with different subtitles

A frame in Beamer presentation can be broken in number frames with the same frame title. Those titles can be subsequently enumerated. Is there way, that in such cases each slide in common frame with common title have individual subtitles for belonging slides? As you can see from minimal example, now is considered last subtitle as common subtitle for slides ...

\documentclass{beamer}
%---------------------------------------------------------------%
\usepackage{graphics,tikz}
%---------------------------------------------------------------%
\begin{document}
%---------------------------------------------------------------%
\begin{frame}[allowframebreaks]
\frametitle{Common title, appearing on all slides in one frame}
\framesubtitle{The first frame subtitle}
%------------------------------------------------------------ 1
\begin{itemize}
\item some text
\item some text
\item some text
\item   \dots

\end{itemize}
%------------------------------------------------------------ 2
\framebreak
\framesubtitle{The second frame subtitle}
\begin{itemize}
\item some text
\item some text
\item some text
\item   \dots
\end{itemize}
%------------------------------------------------------------ 3
\framebreak
\framesubtitle{The third frame subtitle}
\begin{itemize}
\item some text
\item some text
\item some text
\item   \dots
\end{itemize}

\end{frame}
%---------------------------------------------------------------%
\end{document}

-
Why not individual slides and no complications? Also you can use \begin{frame}{Title}{Subtitle} ..... \end{frame} to ease the typing load. –  percusse Jun 13 '12 at 17:54
add comment

## 1 Answer

Don't use allowframebreaks; the documentation of beamer has the following recommendation:

Using the allowframebreaks option invites the creation of horrible, endless presentations that resemble more a "paper projected on the wall" than a presentation. Nevertheless, the option does have its uses. Most noticeably, it can be convenient for automatically splitting bibliographies or long equations.

You can use overlay specifications instead; here's an example using \only:

\documentclass{beamer}
%---------------------------------------------------------------%
\usepackage{graphics,tikz}
%---------------------------------------------------------------%
\begin{document}
%---------------------------------------------------------------%
\begin{frame}
\frametitle{Common title, appearing on all slides in one frame}
%------------------------------------------------------------ 1
\only<1>{
\framesubtitle{The first frame subtitle}
\begin{itemize}
\item some text on slide 1
\item some text
\item some text
\item   \dots

\end{itemize}}
%------------------------------------------------------------ 2
\only<2>{
\framesubtitle{The second frame subtitle}
\begin{itemize}
\item some text on slide 2
\item some text
\item some text
\item   \dots

\end{itemize}}
%------------------------------------------------------------ 3
\only<3>{
\framesubtitle{The third frame subtitle}
\begin{itemize}
\item some text on slide 3
\item some text
\item some text
\item   \dots

\end{itemize}}
\end{frame}
%---------------------------------------------------------------%
\end{document}


If verbatim material created with the listings package must be in the argument of \only (or any other command), then some precautions must be taken; the additional work is described in Section 5.1 Listings inside arguments of the listings documentation (notice that this is an experimental feature):

\documentclass[compress]{beamer}
\usepackage[english]{babel}
\usepackage{listings}

%---------------------------------------------------------------%
\begin{document}
%---------------------------------------------------------------%

\begin{frame}[fragile]

\begin{lstlisting}
\usepackage{graphicx}
\end{lstlisting}

\end{frame}
%------------------------------------------------------------------------------------

\begin{frame}[fragile]
\frametitle{Figures and Graphics}

%------------------------------------------------------------------------------------
\only<1>{
\framesubtitle{Including Graphics}
\begin{lstlisting}^^J
\\usepackage\{graphicx\}^^J
\end{lstlisting}
}
%------------------------------------------------------------ 2
\only<2>{
\framesubtitle{The second frame subtitle}
\begin{itemize}
\item some text on slide 2
\item some text
\item some text
\item   \dots

\end{itemize}}
%%------------------------------------------------------------ 3
\only<3>{
\framesubtitle{The third frame subtitle}
\begin{itemize}
\item some text on slide 3
\item some text
\item some text
\item   \dots

\end{itemize}}
\end{frame}
%---------------------------------------------------------------%
\end{document}


-
Apparently only doesn't work with listings. Is that correct? Is there a way to solve this? –  MCB Jun 13 '12 at 18:32
@MCB yes, it does. Please see my updated answer. –  Gonzalo Medina Jun 13 '12 at 20:18
I have a question, if in the \only<3> I have a lot things that related to "The third frame subtitle" so that the \only<3> cannot holds ,then what can I do ? breaks? –  Alex Mar 23 at 14:39
@Alex please feel free to ask a follow-up question, providing all necessay information there (you can also add a link to this question if it's relevent). –  Gonzalo Medina Mar 23 at 18:55
@GonzaloMedina: I just think this cannot support a question –  Alex Mar 23 at 23:51
add comment