# Why is still everything compiled despite using \includeonlyframes? [closed]

I have a presentation with about 50 slides and a lot of PgfPlots which take long to compile. I tried to use \includeonlyframes{} with the result that only the selected frame is in the resulting PDF but that compilation just takes as long as before. From the log file I can see that still everything seems to be compiled: all SVG images are converted to PDFs and I see PgfPlots log messages for all my plots.

Update

The problem only occurs if not all frames that include images have a label. Please consider the following MWE (compile with xelatex mwe.tex):

\documentclass{beamer}
\includeonlyframes{ex1}
\begin{document}
\frame{
Whether this frame has a label or not, seems to be irrelevant.
\typeout{No, the graphic does not matter}
}
\frame[label=ex1]{
This frame should have a label.
\includegraphics{example-image-a}
}
\frame[label=ex2]{
This frame should also have a label.
\includegraphics{example-image-b}
}
\end{document}


This behaves as expected: only the second frame is in the output PDF and the log file mentions only the inclusion of example-image-a. Now remove the label ex2 from the third frame:

\documentclass{beamer}
\includeonlyframes{ex1}
\begin{document}
\frame{
Whether this frame has a label or not, seems to be irrelevant.
\typeout{it is relevant, it just does not show in the log file}
}
\frame[label=ex1]{
This frame should have a label.
\includegraphics{example-image-a}
}
\frame{
This frame should also have a label.
\includegraphics{example-image-b}
}
\end{document}


Beamer now behaves differently: it seems like all frames are compiled (at least those with images) but the PDF still contains only the second frame. Here's a snippet from the log:

File: example-image-a.pdf Graphic file (type QTm)

<use  "example-image-a.pdf" >

LaTeX Font Warning: Font shape OT1/cmss/m/n' in size <4> not available
(Font)              size <5> substituted on input line 10.

[1

]
File: example-image-b.pdf Graphic file (type QTm)
<use  "example-image-b.pdf" >


When compiling the first MWE, example-image-b.pdf is not mentioned.

In my original document I use a lot of PDF and PgfPlots inputs, but I have only used one label. The consquence was that all frames got compiled despite defining only one frame with \includeonlyframes{}. The weird thing is, that it seems to be irrelevant whether plain frames without images have a label or not (see the first frame in the MWE).

So either I'm totally misunderstanding the Beamer doc or this is a bug. What do you think?

• this does seem to contradict the beamer documentation (section 4.3.3), so an inquiry to the maintainer(s) would seem to be in order. for that purpose, a minimal example with only two frames, and only one included, and the log showing that both are in fact compiled, would seen adequate. Aug 18, 2016 at 17:53
• I'm voting to close this question as it's status by design, see chat.stackexchange.com/transcript/message/31881278#31881278 Aug 24, 2016 at 18:47
• @AlexG All frames which don't have a label that is not in the list of \includeonlyframes{...} are processed, also ones without images (try the example with \typeout{No, the graphic does not matter}). Feel free to vote for reopening. Aug 25, 2016 at 9:17
• Vaguely related: tex.stackexchange.com/a/52904/86 (in particular, note what I say in the 3rd paragraph about TeX still compiling the whole document). You may be better off looking at the TikZ externalisation library to solve the issue with recompiling the graphics every time. Aug 25, 2016 at 9:23
• It may be status-by-design for \includeonlyframes but there's a sensible question here. Why don't you rephrase the question to ask how to limit beamer`s attention to just one frame, completely ignoring all others? Or how to optimise your compilation so that you aren't compiling every plot every time. (Mind you, there are probably other questions on those themes that this might then be a duplicate of, but that would depend on how you rephrase it.) Aug 25, 2016 at 9:50