5

I have a number of related beamer slide decks that I'd like to print as a bound handout "book".

My file layout is as follows:

A general include file (include.tex) used by most other files:

\documentclass[12pt,table,english,t,compress]{beamer}
\author{...}
% \usepackage defintions

\title{...}

\usetheme{Warsaw}
\usecolortheme{seahorse}

% Various color and command definitions

Then, for each of my slide decks, I have a pair of files (deck_1.tex, deck_1_slides.tex) structured as follows:

% deck_1.tex

\input{include.tex}

\begin{document}

\input{deck_1_slides.tex}

\end{document}

And:

% deck_1_slides.tex

\subtitle{Deck 1 subtitle}

\begin{frame}
    \titlepage
\end{frame}

\begin{frame}
    \frametitle{Outline}

    %\tableofcontents[pausesections]
    \tableofcontents
\end{frame}


\section{Section A}

\begin{frame} \frametitle{XXX} ... \end{frame}
\begin{frame} \frametitle{YYY} ... \end{frame}
\begin{frame} \frametitle{ZZZ} ... \end{frame}

\section{Section B}

\begin{frame} \frametitle{AAA} ... \end{frame}
\begin{frame} \frametitle{BBB} ... \end{frame}
\begin{frame} \frametitle{CCC} ... \end{frame}

...

The above set up works fine for producing the individual slide decks. I get the conventional numbering "Page-N/Total-pages" on each slide, and I have Section TOCs that appear at the start of each section. All well and good.

However, I am stuck when it comes to producing the "book" version of the slides. What I would like to do is this:

  1. Treat each slide deck as a numbered chapter. When producing the handout version, make the running number at the bottom of each slide "Chapter-number / slide-number" (i.e., drop the "Total slides").

  2. Change the Section TOC's in each slide deck to be just the "Section Title" or, perhaps the "Chapter Title" (i.e., the \subtitle in the decks above) plus the "Section Title".

  3. Produce a "Grand TOC" at the start of the "book", which consists of just the "Chapter" titles and "Section" titles. I'd like the Grand TOC to include the "Chapter-number / slide-number" page numbering used in the individual decks.

  4. Update: I realize that there is another point that I had in mind that I did not make explicit in my original formulation. In the grand TOC I'd like to see numbering of the form Chapter.Section.

For example, the Chapter.Section numbering in the Grant TOC might look like this:

1    Deck 1 title                   1-nn
1.1  Deck 1 Section 1 title         1-nn
1.2  Deck 1 Section 2 title         1-nn
1.3  Deck 1 Section 3 title         1-nn
2    Deck 2 title                   2-nn
2.1  Deck 2 Section 1 title         2-nn
2.2  Deck 2 Section 2 title         2-nn

("nn" are frame numbers)

Analogously, in the Deck TOCs I'd like to have something like this (here, for Deck 2)

2    Deck 2 title                   2-nn
2.1  Deck 2 Section 1 title         2-nn
2.2  Deck 2 Section 2 title         2-nn

I'm assuming all of the above is possible, since LaTeX is fairly flexible (I'm a relative newbie), but I'm a little lost trying to achieve the book version with the features described above (especially 1 and 3). Any tips would be greatly appreciated.

  • 1
    Welcome to TeX.sx! The pgfpages package might help you. Check this link. – masu Nov 15 '13 at 20:29
  • @masu: Thanks for your reply. Maybe I'm missing something, but I'm not sure how pgfpages helps with my questions. Could you elaborate? – mtk Nov 16 '13 at 10:24
  • I don't really have any time for this right now, but I've just started a bounty. :) – masu Nov 18 '13 at 10:07
  • Not sure if it helps you but a-lecture folder in your LaTeX distribution contains a nice example mixing a beamer presentation and its printed (book) version. (links point to CTAN corresponding folder and files) – Ignasi Nov 19 '13 at 8:10
  • I have two questions regarding the example: (1) I think that \input{lsp_include.tex} should be \input{include.tex}, where \input{include.tex} is your first code snippet. (2) If I compile it I have no running number at the bottom. Do you use a specific outer theme (infolines for example)? – crixstox Nov 20 '13 at 12:09
2

As proposed by the question-opener in the comments to my first answer, here a different approach: Change section to subsection and include the different decks a sections.

  • No changes in deck_n.tex.
  • Replace \section by \subsection in deck_n_slides.tex.
  • To specify the appearance of the "Deck TOC" use the options for for \tableofcontents. (e.g. use \tableofcontents[sectionstyle=hide,subsection=show] in deck_n_slides.tex).

Replace include.tex with

\documentclass[12pt,table,english,t,compress]{beamer}
\author{Author}
\institute{Institute}

\title{Title}

\usetheme{Warsaw}
\useoutertheme{infolines}
\usecolortheme{seahorse}

\makeatletter
    \let\origSubsection\subsection
    \def\subsection#1{\stepcounter{framenumber} \origSubsection[#1]{#1 \hfill \ \arabic{section} -- \arabic{framenumber}} \addtocounter{framenumber}{-1}}
    \let\origSection\section
    \def\section#1{\setcounter{framenumber}{1} \origSection[#1]{#1 \hfill \ \arabic{section} -- \arabic{framenumber}} \addtocounter{framenumber}{-1}}
\makeatother

\newcommand{\sectionnumber}[1]{\setcounter{section}{#1} \addtocounter{section}{-1}}

\setbeamertemplate{section in toc}{\inserttocsectionnumber~\inserttocsection}
\setbeamertemplate{subsection in toc}{\inserttocsectionnumber.\inserttocsubsectionnumber~\inserttocsubsection\\}

\makeatletter
\setbeamertemplate{footline}
{
    \leavevmode%
    \hbox
    {%
        \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
            \usebeamerfont{author in head/foot}\insertshortauthor~~\beamer@ifempty{\insertshortinstitute}{}{(\insertshortinstitute)}
        \end{beamercolorbox}%
        \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
            \usebeamerfont{title in head/foot}\insertshorttitle
        \end{beamercolorbox}%
        \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
            \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
            \insertsectionnumber{} -- \insertframenumber\hspace*{2ex} 
        \end{beamercolorbox}
    }%
    \vskip0pt%
}
\makeatother

For the collection of all slides you can use then handout.tex given as follows

% handout.tex

\input{include.tex}
\date{yyyy-mm-dd}

\begin{document}

\begin{frame}
    \titlepage
\end{frame}

\begin{frame}
    \frametitle{Grand TOC}
    \tableofcontents
\end{frame}

\input{deck_1_slides.tex}
\input{deck_2_slides.tex}

\end{document}
5
+50

I leave my original answer. Some possible changes according to the edit in the question are listed below. A little piece to cover all the details of the question is still missing and explained in the last section.


Original answer

I tried to find a solution within the following design principles:

  1. No changes in the files include.tex, deck_1.tex, deck_1_slides.tex, such that the individual slide sets remain unchanged.
  2. Usage of high-level commands, when possible.
  3. Usage of as few additional packages as possible. In my solution only nameref is needed.

This led to the following solution (the full code and the image of the "Grand TOC" are posted below):

  • The changes are all made in a main file named handout.tex, there the slide files (e.g. deck_1_slide.tex) are loaded with included with input
  • I use the part option of \tableofcontents in the beamer class. Therefore I redifined \subtitle

    \let\origSubtitle\subtitle
    \renewcommand{\subtitle}[1]{%
        \origSubtitle{#1}%
        \stepcounter{chapter} \part{\thechapter}%
        \labelname{#1} \label{chapter:\thechapter}}
    
  • To change the numbering style I adjusted the beamertemplate footline. (In the example code below I adapted it to the outer theme infolines.)

  • Since this numbering style can not be used at the beginning for the "Grand TOC" `footline``is changed locally once more.
  • To get the desired numbering in the table of contents I used the short sectiontitle ability. Hence the redefinition of \section

    \makeatletter
    \let\origSection\section
    \def\section#1{\stepcounter{framenumber} \origSection[#1]{#1 \dotfill \ \insertpartnumber{} / \arabic{framenumber}} \addtocounter{framenumber}{-1}}
    \makeatother
    
  • Finally I define a new command \grandtoc which take the "part"-number as input, to set the "Grand TOC".

Full code (deck_2.tex and deck_2_slides.tex have the same form as there counterparts deck_1.tex and deck_1_slides.tex):

% handout.tex

\input{include.tex}

% Outher theme to have running numbers at the bottom
\useoutertheme{infolines}
\institute{Institute}
\date{yyyy-mm-dd}

\usepackage{nameref} % new package

\makeatletter
\newcommand{\labelname}[1]{\def\@currentlabelname{#1}}
\makeatother

\newcounter{chapter}

% redefinition fo subtitle
\let\origSubtitle\subtitle
\renewcommand{\subtitle}[1]{%
    \origSubtitle{#1}%
    \stepcounter{chapter} \part{\thechapter}%
    \labelname{#1} \label{chapter:\thechapter}}

\makeatletter
\setbeamertemplate{footline}
{
    \leavevmode%
    \hbox{%
        \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
            \usebeamerfont{author in head/foot}\insertshortauthor~~\beamer@ifempty{\insertshortinstitute}{}{(\insertshortinstitute)}
        \end{beamercolorbox}%
        \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
            \usebeamerfont{title in head/foot}\insertshorttitle
        \end{beamercolorbox}%
        \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
            \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
            \insertpartnumber{} / \insertframenumber\hspace*{2ex} 
        \end{beamercolorbox}}%
    \vskip0pt%
}
\makeatother

\AtBeginPart{\setcounter{framenumber}{0}}

% redinition of section
\makeatletter
\let\origSection\section
\def\section#1{\stepcounter{framenumber} \origSection[#1]{#1 \dotfill \ \insertpartnumber{} / \arabic{framenumber}} \addtocounter{framenumber}{-1}}
\makeatother

\newcommand{\grandtoc}[1]
{%
    {\usebeamercolor[fg]{structure} \nameref{chapter:#1}}%
    \tableofcontents[part=#1,sectionsstyle=show,subsectionstyle=hide]%
}

\begin{document}

{
    \makeatletter
    \setbeamertemplate{footline}
    {
        \leavevmode%
        \hbox{%
            \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
                \usebeamerfont{author in head/foot}\insertshortauthor~~\beamer@ifempty{\insertshortinstitute}{}{(\insertshortinstitute)}
            \end{beamercolorbox}%
            \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
                \usebeamerfont{title in head/foot}\insertshorttitle
            \end{beamercolorbox}%
            \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
                \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
            \end{beamercolorbox}}%
        \vskip0pt%  
    }
    \makeatother

    \begin{frame}
        \titlepage
    \end{frame}

    \begin{frame}
        \frametitle{Grand TOC}
        \grandtoc{1}
        \grandtoc{2}
    \end{frame}
}

\input{deck_1_slides.tex}
\input{deck_2_slides.tex}

\end{document}

This results in the following "Grand TOC":

Grand TOC

Changes (to be made to answer the edited question)

To do not reset the framenumber for a new part delete the line \AtBeginPart{\setcounter{framenumber}{0}}.

To reset the section number for each part include (following this)

\makeatletter
\AtBeginPart{%
    \beamer@tocsectionnumber=0\relax
    \setcounter{section}{0}
}
\makeatother

Attention: You can only have one active \AtBeginPart. To reset the framenumber and the section number, merge them together.

To have (almost) the desired numbering style of the "Grand TOC" replace the redefinition of \section and the definition of \grandtoc with

% redinition of section
\makeatletter
\let\origSection\section
\def\section#1{\stepcounter{framenumber} \origSection[#1]{#1 \hfill \ \insertpartnumber{} -- \arabic{framenumber}} \addtocounter{framenumber}{-1}}
\makeatother

\newcommand{\grandtoc}[1]
{%
    {\usebeamercolor[fg]{structure} #1 \nameref{chapter:#1}}%
    \setbeamertemplate{section in toc}{#1.\inserttocsectionnumber~\inserttocsection}
    \tableofcontents[part=#1,sectionsstyle=show,subsectionstyle=hide]%
} 

To have the "Deck TOC" formatted accordingly do the following (in contrast to my design principles - but I have no other idea):

  • Add \newcommand{\grandtoc}[1]{\tableofcontents} and \renewcommand{\thepart}{0} to the preamble of every deck_n.tex.
  • Replace in every deck_n_slides.tex \tableofcontents with \grandtoc{\thepart}

With this two command the style of compiling a single deck will not be altered, but for the book, the "Deck TOC" is redefined.

With these changes the "Grand TOC" now looks as follows.

new Grand Toc

What is still missing

For the TOC there is no framenumber shown for the start of the different parts. The main reason therefore is, that with my solution the part title is not stored in the .toc-file but typeset directly. To include really the parts into the .toc, one might use ideas from here. However, I assume,that this would lead to major necessary changes in other parts of the solution presented. Additionally, the difficulty described above is the reason, why title of parts are not aligned properly.

  • Thanks for this. Could you post the resulting Grand TOC that you see from your test? – mtk Nov 21 '13 at 3:03
  • @mtk: I edited my answer and attached an image of the "Grand TOC" like proposed. – crixstox Nov 21 '13 at 9:06
  • thanks for posting the result. It confirms what I saw too. Your solution is impressive--it does I think the key points of what I explicitly asked, but I realize there was another point that was implicit. I should have made that point explicit too. In the TOC, I'm wanting to see Chapter.Section numbering on the LHS. I'll edit the main question to describe what I mean. – mtk Nov 21 '13 at 18:48
  • Hey @crixstox, that's pretty good! Thank you. Even without the last piece (page numbering on the "Chapter" entries in the TOC), it's probably workable for me, but I'll investigate your pointers as well. I have just one question: would the task have been easier if my "Chapters" had been "\section"s and my "Sections" had been \subsections" (and I dispensed with the use of "\subtitle"s to generate the TOC)? That would of course have been (is) an easy (sed) edit to my *_slide.tex source files. – mtk Nov 22 '13 at 3:07
  • 1
    @mtk: Yes, with this setting it would be a lot easier. I will post another answer for this case. – crixstox Nov 22 '13 at 16:51

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.