# Defining a command to close and open environment

While preparing my lectures with beamer, I often find myself having to split a frame into two different ones. For instance, a first version of my slides contains:

\begin{frame}
\begin{block}{Theorem}
Blah, blah, blah
\end{block}
\begin{block}{Corollary}
Etc, etc, etc
\end{block}
\end{frame}


When I complete my slides and add the proofs to these results, I must split it into two different frames

\begin{frame}
\begin{block}{Theorem}
Blah, blah, blah
\end{block}
\begin{block}{Proof}
Blah, blah, blah
\end{block}
\end{frame}

\begin{frame}
\begin{block}{Corollary}
Etc, etc, etc
\end{block}
\begin{block}{Proof}
Etc, etc, etc
\end{block}
\end{frame}


I think that it would be very helpful I if could simply define a command to close and then open the frame environment:

\def\newframe{ \end{frame} \begin{frame} }

\begin{frame}
\begin{block}{Theorem}
Blah, blah, blah
\end{block}
\begin{block}{Proof}
Blah, blah, blah
\end{block}

\newframe

\begin{block}{Corollary}
Etc, etc, etc
\end{block}
\begin{block}{Proof}
Etc, etc, etc
\end{block}
\end{frame}


However, this approach does not work. Does anyone know if there is any way to define such a command?

-
Welcome to TeX.SX! frame is not really like normal LaTeX environments. Beamer determines the contents of a frame by finding what's between \begin{frame} and \end{frame}; with \newframe it wouldn't see the implied \end{frame}, which would show up only when \newframe is "executed" (and probably give errors). –  egreg Oct 3 '12 at 9:30
beamer provides \framebreak in collaboration with the allowframebreaks option to the frame environment, but it breaks overlay support. –  Andrew Swann Oct 3 '12 at 11:53
Thank you for your comments. Unfortunately, I use tikz in my slides, and hence I have to make my frames fragile. This seems to break the \framebreak option... I'll close and open the environment manually. –  Biel Cardona Oct 4 '12 at 12:42
Try if you can use a keyboard shortcut in your editor that inserts \begin{frame} \end{frame} for you (preferably with a line break inbetween). This way your code becomes clearer. –  Hendrik Vogt Oct 5 '12 at 7:24
Thanks Hendrik, I can indeed make such a shortcut (I use emacs, so no problem about that), but I wanted a solution more TeXnical ;) –  Biel Cardona Oct 7 '12 at 15:17

There is no way to define a macro that issues \end{frame}\begin{frame} in beamer.
This is because frame is a very peculiar environment: when beamer finds \begin{frame} it looks for the next \end{frame} and stores in memory the entire contents without expanding macros; the macro expansion will take place later, when the frame contents will be processed. Such a way to proceed is necessary, because the contents needs to be processed many times, one for each slide in the frame.
Thus \end{frame} must appear explicitly, not hidden in a macro; if you use \newframe defined as
\def\newframe{ \end{frame} \begin{frame} }

the \end{frame} will appear when LaTeX is already processing a frame, where \end{frame} and \begin{frame} mean nothing: so an error will be raised.