Short answer: no, or at least not using the documented interfaces. This can be verified with an example such as
\documentclass{beamer}
\begin{document}
\frame[fragile]{% Fails
\frametitle{FRAME TITLE}
}
\end{document}
However, using some code which is there purely for compatibility you may be OK:
\documentclass{beamer}
\begin{document}
\frame[containsverbatim]{
\frametitle{FRAME TITLE}
\begin{verbatim}
Hello % # &
\end{verbatim}
}
\end{document}
Reading over the code, it's clear that the \frame
approach for collecting frames is there mainly for historical reasons. The environment-based approach has more flexibility, particularly as without 'trickery' collecting verbatim material inside an argument is much more awkward/risky than within an environment.
Whilst the current maintenance team are committed to avoiding breaking beamer
or altering 'defined' behaviours, that does not mean all of them are equally sensible! Speaking personally, I would not recommend using \frame...
for new beamer
slides at all.
(This is an explanation. I am not going to answer it. I gave an workaround, but I do not know if it will always work.)
In beamerbaseframe.sty
line 417-493 one sees this decision tree
\def\beamer@@@@frame<#1>[#2]{%
\framewidth\textwidth
\beamer@savemode%
\def\beamer@mode{\mode<all>}%
\def\beamer@frametemplate{}%
\def\beamer@againname{}%
\def\beamer@undolabels{}%
\def\beamer@cramped{}%
\def\beamer@displaybreak{}%
\setbox\beamer@footins=\box\voidb@x%
\beamer@autobreakcount=0\relax%
\beamer@autobreaklastheight=16000pt%
\beamer@zoomcount=0\relax%
\beamer@containsverbatimfalse%
\beamer@isfragilefalse%
\beamer@autobreakfalse%
\beamer@shrinkfalse%
\beamer@plainframefalse%
\global\advance\beamer@zoomframecount by1\relax%
\csname beamer@dosecondmode\beamer@defaultdosecondmode\endcsname%
\ifbeamer@centered\setkeys{beamerframe}{c}\else\setkeys{beamerframe}{t}\fi%
\setkeys{beamerframe}{environment=frame}%
\setkeys{beamerframe}{#2}%
\beamer@frametemplate%
\ifbeamer@noframenumbering%
\beamer@noframenumberingfalse%
\else%
\stepcounter{framenumber}%do not set \label here - it interferes with AtBegin*
\fi%
{\let\@elt\beamer@savecounter\beamer@overlaycounterresets}
\gdef\beamer@framestartpage{}%
\gdef\beamer@whichframes{#1}%
\ifx\beamer@framerestriction\@undefined\else% restriction stuff
\expandafter\beamer@checkifinlist\beamer@framerestriction\relax%
\fi%
\ifbeamer@inlecture%
\else%
\gdef\beamer@whichframes{all:0}%
\fi%
\ifx\beamer@againname\@empty%
\beamer@slideinframe=0\relax%
\beamer@anotherslidefalse%
{\beamer@masterdecode{\beamer@whichframes}}%
\ifbeamer@anotherslide%
%% \beamer@slideinframe=2\relax%
%% \def\beamer@doifnotinframe{}%
%% \def\beamer@doifinframe{\let\beamer@howtotreatframe\beamer@doseveralframes}%
%% \beamer@anotherslidefalse%
%% {\beamer@masterdecode{\beamer@whichframes}}%
%% \ifbeamer@anotherslide%
\let\beamer@howtotreatframe\beamer@doseveralframes%
%% \else% single slide in frame
%% \let\beamer@howtotreatframe\beamer@dosingleframe%
%% \fi%
%% \beamer@donow%
\ifbeamer@containsverbatim%
\let\beamer@howtotreatframe\beamer@dosingleframe%
\fi%
\ifbeamer@autobreak%
\let\beamer@howtotreatframe\beamer@autobreakframe%
\fi%
\ifbeamer@isfragile%
\let\beamer@howtotreatframe\beamer@doexternalframe%
\fi%
\else% no slides in frame
\let\beamer@howtotreatframe\beamer@donoframe%
\fi%
\else% again mode
\let\beamer@howtotreatframe\beamer@doseveralframes%
\ifbeamer@isfragile%
\let\beamer@howtotreatframe\beamer@doexternalframe%
\fi%
\ifbeamer@containsverbatim
\let\beamer@howtotreatframe\beamer@dosingleframe
\fi
\fi%
\beamer@howtotreatframe}
In short
- test if
\includeonlyframe
includes this frame;
- test if
\includeonlylecture
includes this lecture;
- test if
[lable=something]
is given; if so
- test if
\beamer@whichframes
(\begin{frame}<something>
) is given; if so
- test if
[containsverbatim]
is given;
- test if
[allowframebreak]
is given;
- test if
[fragile]
is given;
- otherwise if no
[lable=something]
is given;
- test if
[fragile]
is given;
- test if
[containsverbatim]
is given;
Notice that \beamer@againname
stores the label of the frame, so \ifx\beamer@againname\@empty
tests whether you set [label=something]
or not, corresponding to the third item above.
The problem is that when no [label=something]
is given, Beamer does not test [allowframebreaks]
. So no matter how Beamer treat that frame, it is not going to be \beamer@autobreakframe
.
An immediate workaround is to add the \ifbeamer@autobreak
-test manually. But the result is disappointing: surely Beamer now gives you two-page output, but you are no longer able to control its appearance by \includeonlyframes
, and that makes labeling a frame meaningless.
This is because Beamer passes the negative result of \includeonlyframe
-test by redefining \beamer@whichframes
to be all:0
, which is received only by the first branch. Ideally, the new decision tree should be like
- test if
\includeonlyframe
includes this frame;
- test if
\includeonlylecture
includes this lecture;
- test if
[lable=something]
is given; if so
- test if
\beamer@whichframes
(\begin{frame}<something>
) is given; if so
- test if
[containsverbatim]
is given;
- test if
[allowframebreak]
is given;
- test if
[fragile]
is given;
- otherwise if no
[lable=something]
is given;
- test if
\beamer@whichframes
(\begin{frame}<something>
) is given; if so
- test if
[containsverbatim]
is given;
- test if
[allowframebreak]
is given;
- test if
[fragile]
is given;
The following is an example combining [allowframebreak]
and [label=something]
and \includeonlyframes
. But \againframe
does not work. Probably it is the next question.
\documentclass{beamer}
\usepackage{lipsum}
\makeatletter
\def\beamer@@@@frame<#1>[#2]{%
\framewidth\textwidth
\beamer@savemode%
\def\beamer@mode{\mode<all>}%
\def\beamer@frametemplate{}%
\def\beamer@againname{}%
\def\beamer@undolabels{}%
\def\beamer@cramped{}%
\def\beamer@displaybreak{}%
\setbox\beamer@footins=\box\voidb@x%
\beamer@autobreakcount=0\relax%
\beamer@autobreaklastheight=16000pt%
\beamer@zoomcount=0\relax%
\beamer@containsverbatimfalse%
\beamer@isfragilefalse%
\beamer@autobreakfalse%
\beamer@shrinkfalse%
\beamer@plainframefalse%
\global\advance\beamer@zoomframecount by1\relax%
\csname beamer@dosecondmode\beamer@defaultdosecondmode\endcsname%
\ifbeamer@centered\setkeys{beamerframe}{c}\else\setkeys{beamerframe}{t}\fi%
\setkeys{beamerframe}{environment=frame}%
\setkeys{beamerframe}{#2}%
\beamer@frametemplate%
\ifbeamer@noframenumbering%
\beamer@noframenumberingfalse%
\else%
\stepcounter{framenumber}%do not set \label here - it interferes with AtBegin*
\fi%
{\let\@elt\beamer@savecounter\beamer@overlaycounterresets}
\gdef\beamer@framestartpage{}%
\gdef\beamer@whichframes{#1}%
\ifx\beamer@framerestriction\@undefined\else% restriction stuff
\expandafter\beamer@checkifinlist\beamer@framerestriction\relax%
\fi%
\ifbeamer@inlecture%
\else%
\gdef\beamer@whichframes{all:0}%
\fi%
\ifx\beamer@againname\@empty%
\beamer@slideinframe=0\relax%
\beamer@anotherslidefalse%
{\beamer@masterdecode{\beamer@whichframes}}%
\ifbeamer@anotherslide%
%% \beamer@slideinframe=2\relax%
%% \def\beamer@doifnotinframe{}%
%% \def\beamer@doifinframe{\let\beamer@howtotreatframe\beamer@doseveralframes}%
%% \beamer@anotherslidefalse%
%% {\beamer@masterdecode{\beamer@whichframes}}%
%% \ifbeamer@anotherslide%
\let\beamer@howtotreatframe\beamer@doseveralframes%
%% \else% single slide in frame
%% \let\beamer@howtotreatframe\beamer@dosingleframe%
%% \fi%
%% \beamer@donow%
\ifbeamer@containsverbatim%
\let\beamer@howtotreatframe\beamer@dosingleframe%
\fi%
\ifbeamer@autobreak%
\let\beamer@howtotreatframe\beamer@autobreakframe%
\fi%
\ifbeamer@isfragile%
\let\beamer@howtotreatframe\beamer@doexternalframe%
\fi%
\else% no slides in frame
\let\beamer@howtotreatframe\beamer@donoframe%
\fi%
\else% again mode
\let\beamer@howtotreatframe\beamer@doseveralframes%
\ifbeamer@isfragile%
\let\beamer@howtotreatframe\beamer@doexternalframe%
\fi%
\ifbeamer@containsverbatim
\let\beamer@howtotreatframe\beamer@dosingleframe
\fi
\beamer@slideinframe=0\relax%
\beamer@anotherslidefalse%
{\beamer@masterdecode{\beamer@whichframes}}%
\message{^^J^^J \beamer@againname:\beamer@whichframes ^^J^^J}
\ifbeamer@anotherslide%
\message{^^J^^J \beamer@againname:I am Here ^^J^^J}
\ifbeamer@autobreak%
\let\beamer@howtotreatframe\beamer@autobreakframe%
\fi%
\fi
\fi%
\beamer@howtotreatframe
}
\includeonlyframes{two}
\begin{document}
\frame[allowframebreaks,label=one]{{Test one}\lipsum}
\frame[allowframebreaks,label=two]{{Test two}\lipsum}
\end{document}
Best Answer
Your frame is perfectly top aligned - however beamer puts a
\vfill
between each section entry which causes the space between the entries to stretch so the whole page is filled.To disable it you can use https://tex.stackexchange.com/a/170438/36296