There's a difference between "labeling a frame
" and "inserting a label in a frame
". The former should be passed as a key-value label=<label>
using the optional argument of the frame
environment/macro while the latter uses \label
where needed. For \includeonlyframes
to work as expected, you need the former not the latter. The following is taken from the beamer
documentation (section 4.3.3 Ways of Improving Compilation Speed, p 30):
\includeonlyframes{⟨frame label list⟩}
This command behaves a little bit like the \includeonly
command: Only the frames mentioned in the list are included. All other frames are suppressed. Nevertheless, the section and subsection commands are still executed, so that you still have the correct navigation bars. By labeling the current frame as, say, current
and then saying \includeonlyframes{current}
, you can work on a single frame quickly.
The ⟨frame label list⟩
is a comma-separated list (without spaces) of the names of frames that have been labeled. To label a frame, you must pass the option label=⟨name⟩
to the \frame
command or frame
environment.
You can achieve this in LyX by a right-click on the frame title and selecting to "Insert Short Title":

Now use the label=<label>
inside the optional argument:

However, this is not enough. While the interface of LyX in this regard seems okay, the accompanying definition for using the optional argument isn't. Add the following to your preamble as well (Document > Settings... > LaTeX Preamble):
\makeatletter
\renewcommand{\lyxframe}[2][]{%
\@@@@lyxframe<*>[<*>][#1]{#2}\@lyxframestop}
\makeatother
The above circumvents the intricate definition of \lyxframe
, skipping beamer
's overlay functionality. But, since you're using LyX, I don't think this is needed. Moreover, I don't think the actual code produced by the beamer
layout (beamer.layout
) in the preamble works as expected...
Now you can use
\includeonlyframes{abc}
in your LaTeX Preamble and things should work fine.