# Output different beamer presentations from same tex file

I am asking a very similar question to that posed here Reusing slides from Beamer presentations but may be slightly different. I teach a number of very similar modules with differences mainly being in the quantity and detail of topic. I know I could use a main-file and just include the slides as individual files as the case may require.

I was thinking more along the line of the following pseudocode...

\modulelist{CHEM6005,CHEM7002,CHEM8005}
.
.
.
\begin{frame}{Grignard Reagents}[]
This frame appears for all modules
\end{frame}
\begin{frame}{Grignard Reagents-General reaction mechanisms}[CHEM7002, CHEM8005]
This frame only appears for modules CHEM7002 and CHEM8005 when compiled
\end{frame}
\begin{frame}{Grignard Reagents-Aldehydes and Ketones}[]
This frame appears for all modules
\end{frame}
\begin{frame}{Grignard Reagents-Esters}[CHEM8005]
This frame appears for module CHEM8005 only when compiled
\end{frame}


When the document is compiled (without having to manually comment out frames etc), it outputs in the above case, three different files, lecture-chem6005.pdf, lecture-chem7002.pdf and lecture-chem8005.pdf which have the requisite depth and detail as required by the module...

-
Have a look at \includeonlyframes in the beamer manual. You can add a label=<text> to every frame and then only include certain ones. –  Martin Scharrer Apr 19 '12 at 13:36
Howdy you may take a look at beameraudience. This package is made to reassemble beamer frames. I never worked with it so i neither have a example ready nor any experience but from its description it seems to be handy. –  bloodworks Apr 19 '12 at 13:55
@bloodworks I had a quick look at the description and it seems almost exactly what I want to do..it is very new, released in August2011, I must give it a try... –  Leeser Apr 19 '12 at 17:22
@Leeser If beameraudience works for you, please post an answer to your question so the rest of us can get an idea of what it can do. –  Loop Space Apr 20 '12 at 8:44
@AndrewStacey I haven't attempted to use it yet and the documentation is minimal but when I have I will let you all know –  Leeser Apr 21 '12 at 18:21

I have given an example below of the beameraudience package. It is fairly minimal and not very exciting. Although it doesn't answer exactly the question that I asked it comes very close to it. All I need to do is comment out the modules I don't want and then compile.

The three macros \framefor{}{} \justfor{}{} \showcontentfor{}{} are used below. \framefor{audience}{frame contents} basically selects the whole frame for a the [audience]. As \begin{frame} and \end{frame} are defined in the macro they are not needed but the frame title is. \justfor{audience}{contents} can include full frame contents (requires use of \begin{frame}...\end{frame} or just in-frame content. \showcontentfor{audience}{content} is a slightly more subtle usage of \justfor{}{}

Looking at the beameraudience style file, one can only define one audience. If it was possible to define a list of audiences using the ifthenelsecommand allowing more than one audience type to be selected that would be ideal. By this I mean that I don't have to repeat the content for say two of three audience types, I can include the two in the option [audience=intermediate,expert].

\documentclass{beamer}

\usepackage[audience=
CHEM7002
%CHEM6005
%CHEM8005
]{beameraudience}% comment in the audience you are reaching out to...

\begin{document}

\begin{frame}{Grignard Reagents}
This frame appears for all modules as we do not use any of the beameraudience commands.

\end{frame}

\framefor{CHEM8005}
{
{Grignard Reagents-General reaction mechanisms}% definition of \framefor{audience}     {\begin{Frame}  Frame contents\end{frame}} hence the frame title being in parentheses and no \begin{frame} \end{frame} environment
This frame only appears for module CHEM8005 when compiled...
}

\begin{frame}{Grignard Reagents-Aldehydes and Ketones}
This frame appears for all modules as does this line.\\
\justfor{CHEM6005}{But this line only appears for module CHEM6005.}
\justfor{CHEM7002}{This line only appears for module CHEM7002.}
\justfor{CHEM8005}{This line only appears for CHEM8005.}

\end{frame}

\begin{frame}{Grignard Reagents-Esters}%[CHEM8005]
This frame appears for all modules.
\showcontentfor{CHEM6005}{CHEM6005. Only the barest details are necessary.}\showcontentfor{CHEM7002}{CHEM7002. A little bit more information is given.}\showcontentfor{CHEM8005}{CHEM8005. A lot more information and maybe a few diagrams are given for this module.}\end{frame}

\justfor{CHEM7002}{
\begin{frame}
Only content for CHEM7002
\end{frame}
}

\end{document}

-
Can I accept my own answer so the questions "Answered" for future searches on this topic? –  Leeser Apr 23 '12 at 8:33