[Tex/LaTex] Reusing slides from Beamer presentations

beamer

I give a good number of talks and find that I can share some slides but not others based on audience, topic, etc. Powerpoint and Keynote make it pretty easy to pull slides from a deck into another deck. I'm curious about how folks deal with this situation with beamer. I can think of a few possibilities.

  1. Simply cut-and-paste text from one show to the next
  2. Use an IDE to improve on 1
  3. Make a "supershow" that contains most of what I would want to say, but build a menu system that allows me to customize on-the-fly.

Are there other options or ideas that I should consider?

Best Answer

I have a mountain of beamer slides that I combine in all sorts of ways for a number of different courses and presentations that I make. Here's what I do, slightly simplified:

  1. I use beamer templates as containers for series of slides (sometimes a series is just a single slide, sometimes it is 40 slides):

    \newcommand{\defsection}[3]{
     \setbeamertemplate{slide #1 #2}{{#3}}}
    

    I.e. in my source I put everything in "sections" a la:

    \defsection{intro}{string-to-describe-what-this-is}{
    \begin{frame}...\end{frame}
    ...
    \begin{frame}...\end{frame}
    } % end of \defsection
    
  2. I use the sections of slides with the macro \usesection:

    \newcommand{\usesection}[2]{
      \ifbeamertemplateempty{slide #1 #2}
      {\errmessage empty section: {#1}{#2}}
      {\opt{texdebug}{\message{
            *** Using section: (#1)(#2) }}
        \usebeamertemplate{slide #1 #2}}}
    
  3. I use the optional package to be allow conditional inclusion of stuff:

    \usepackage[advanced,use-foo,dont-use-bar,do-xyz,do-frotz]{optional}
    
  4. I include ALL stuff in a master file (main.tex):

    \begin{document}
    \include{stuff.tex}
    \include{more-stuff.tex}
    \include{even-more-stuff.tex}
    
    \usesection{intro}{intro}
    
    \opt{advanced}{
      \usesection{adv}{intro}
      \usesection{adv}{bla-bla-bla}
    }
    
    \opt{use-foo}{
      \usesection{adv}{foo}
    }
    
    \opt{use-bar}{
      \usesection{adv}{bar}
    }
    
    \opt{dont-use-bar}{
      \usesection{adv}{alternative-stuff-if-bar-skipped-over}
    }
    ...
    \end{document}
    
  5. Now each "version" or "course" or "subset of stuff" (or whatever) is basically just a matter of defining the right options and then include main.tex.

I realise this may seem a bit complicated at first go, but the key idea is to separate definition of some slides (\defsection) from the use of them (\usesection). Once that separation is made, all sorts of reuse, different selections based on options, etc, etc, becomes quite trivial.

The one thing I'm missing is an enhancement to the optional package so that I could define things like "include this section if option bar is NOT defined. As it is I need to define EITHER use-bar OR dont-use-bar to be able to trigger on both positive and negative matches.