Multiple versions of a document

135 views
Skip to first unread message

Akim Demaille

unread,
Oct 31, 2012, 12:48:10 PM10/31/12
to beamer...@googlegroups.com
Hi all,

I swear I did my homework, and checked on the Internet if someone had already asked/answered a similar question, and I did not find any satisfying answer.  That being said, I might have missed something, and please don't hesitate to point me to the right direction!

I have this presentation which comes in two flavors: short and long, and I would like to have a _convenient_ way to handle this in Beamer.

I am aware of the \includeonlyframes feature, but it does not scale well: you have to label every single frame, and that's really painful.

I have started to use iftoggle to do what I need, but I quickly found out that iftoggle does not work well with lstlistings.  Fortunately I have found the following snippet which helps making it work:

\newtoggle{long}
\toggletrue{long}

\makeatletter
\newcommand{\iftoggleverb}[1]{%
  \ifcsdef{etb@tgl@#1}
    {\csname etb@tgl@#1\endcsname\iftrue\iffalse}
    {\etb@noglobal\etb@err@notoggle{#1}\iffalse}%
}
\makeatother

\iftoggleverb{long}
\begin{frame}[containsverbatim]{Plop}
\begin{lstlisting}
foo bar baz and the like
\end{lstlisting}
\end{frame}
\fi


That works, but it's ugly. My dream would be to have some additional options that I could pass to the frame environment, something like

\begin{frame}[containsverbatim,versions={long,medium}]{Plop}
\begin{lstlisting}
foo bar baz and the like
\end{lstlisting}
\end{frame}

and somewhere in the preamble

\defaultversions{short}  %% By default a frame is attached to "short"
\includeonlyversions{short,long,medium}

That's similar to labels, except that there is no need for unicity.

Just my wishes for this years' Christmas :)

Cheers,

       Akim

Jan Bredereke

unread,
Nov 1, 2012, 10:31:59 AM11/1/12
to beamer...@googlegroups.com
Hi Akim,

I hope I can be a bit of help to you. I have the need to generate
different sets of Beamer slides from the same sources, too. For
example, I teach the subject of sequential circuits in several
different courses, and make the set of slides longer or shorter,
depending on the course.

My current approach is based on the mode specifications of Beamer.
Beamer allows to have different variants for the presentation and
for the handout, for example, by adding <presentation| handout:0> or
<handout| presentation:0> to many commands, including \begin{frame}.

For itself, this does not help much. But Beamer ignores any invalid
mode specification, which I take advantage of. I specify something
like <all:0| tecin1-all> to have an extra frame for my TECIN1
course. Beamer ignores it, but first I feed my source code to a
little script that conditionally removes all "tecin1-" in the right
places. Therefore, it can become <all:0| all>, which is equivalent
to <all>.

When it comes to ranges of Beamer frames, I use something like

\mode<all:0| tecin1-all>{%

\begin{frame}
.....
\end{frame}

} % \mode<all:0| tecin1-all>

The only caveat is that this can break on "fragile" frames. In this
case, a per-frame mode specification helps.

I just uploaded the script at
http://homepages.hs-bremen.de/~jbredereke/en/software/slide-families/index.html

This approach was sufficient for a single source file feeding four
courses, each with two variants of Beamer slides, each with a
presentation and a handout variant. However, this is the upper limit
which I can handle.

I am currently working on a more generalized form, which will need
some new TeX code. However, I have not written any code yet, and my
technical report which will investigate the best syntax is still
*very* incomplete. The work progresses slowly because of all the
day-to-day teaching work I have to do.

As soon as I have a description of how it should work, I will post
it here (and on the above Web page) for feedback. One of the points
that is important to me is that I can have "modules" of several
frames which can be configured together to larger "modules", a bit
similar to what you described, but multi-level. (I once wrote an
entire Habilitation thesis on maintaining and configuring modules of
requirements specifications. Therefore my particular interest in
this subject.)

By the way, my draft report identifies some more ways of maintaining
variants:
- the ifthen package
- the input command
- the docstrip package

All of these have their limitations, of course. Otherwise I would
not be thinking about a more general approach.

> Just my wishes for this years' Christmas :)

So maybe it is now at least the first sunday of advent...

Best regards,
Jan

--
Prof. Dr. Jan Bredereke
University of Applied Sciences Bremen, Germany.
http://homepages.hs-bremen.de/~jbredereke GnuPG key available.
Reply all
Reply to author
Forward
0 new messages