I have a beamer presentation containing slides for multiple lectures in a single file. Exercises in the slides should be number continuously from the first lecture to the last. So lecture 1 ends with exercise 10, lecture 2 starts with exercise 11 and so on.

When I use \includeonlyframes to make a presentation for a particular lecture it always starts numbering from one again. So, lecture 2 starts again from 1, rather then 11 I would like to see.

It appears that \includeonlyframes doesn't read frames that are not included at all. Is there a way to make it read all frames and output the right ones, but preserve the numbering in the process?

  • You can compile the whole document then extract the frames for your particular lecture via pdftk... – Paul Gaborit Mar 6 '13 at 23:31
  • Consider some of the solutions suggested in Compiling only a page range or page selection. – Werner Mar 6 '13 at 23:45
  • Thanks for the quick answer. That's what I am doing right now, but I am wondering if there is a way of doing it from inside latex – user26977 Mar 6 '13 at 23:46
  • @user26977: You can select pages (not frames) using \usepackage[<page range>]{pagesel}. – Werner Mar 7 '13 at 1:25

It appears that \includeonlyframes isn't designed to read all the frames. From the Beamer User Guide, Section 4.3.3 (Ways of Improving Compilation Speed):

This command behaves a little bit like the \includeonly command: Only the frames mentioned in the list are included.

(emphasis mine). Only the section and subsection commands are still executed, for getting correct navigation bars. Since \includeonlyframes is a way to improve the compilation speed, it shouldn't read the contents of the frames. Of course it would be nice to have a version that does it nonetheless ...

I see only one simple way out of your problem: add something like \setcounter{exercise}{10} before your frames for lecture 2, where 10 should be the last exercise from lecture 1. Here's an example:

First theorem
Second theorem

By the way, it would be good if you include an MWE in your next question; it took me some time to write the above code since I didn't know about \setbeamertemplate{theorems}[numbered] before.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.