1

I am in the course of composing a long beamer document, which should serve both as slides for class presentation and as a mini-textbook. My document includes about 600 slides, which are partitioned to sections, subsections, and subsubsections.

I use the article beamer mode for producing the handouts. In these I would like to present a list of frames for each subsection. Ideally, also for subsubsections. To this end, I found the beamer code for the frame environment in /usr/local/texlive/2014/texmf-dist/tex/latex/beamer/beamerbaseframe.sty:

%
% Frames in article mode
%
\mode
<article>
{
  \def\endframe{\egroup}

  \def\frame{\@ifnextchar<\beamer@frame{\beamer@frame<*>}}
  \def\beamer@frame<#1>{\@ifnextchar[{\beamer@@frame<#1>}{\beamer@@frame<#1>[]}}
  \long\def\beamer@@frame<#1>[#2]{%
    \global\let\insertframetitle=\@empty%
    \global\let\insertframesubtitle=\@empty%
    \beamer@slideinframe=1\relax%
    \refstepcounter{framenumber}%
    \beamer@slideinframe=0\relax%
    \beamer@anotherslidefalse%
    {\beamer@masterdecode{#1}}%
    \ifbeamer@anotherslide%
      \let\beamer@howtotreatframe\beamer@dosingleframe%
    \else% no slides in frame
      \let\beamer@howtotreatframe\beamer@donoframe%
    \fi%
    \beamer@slideinframe=1\relax%
    \beamer@howtotreatframe}

  \long\def\beamer@donoframe{%
    \setbox\beamer@tempbox\vbox\bgroup%
    \beamer@inframetrue%
    \let\frame=\framelatex
    \usebeamertemplate{frame begin}%
    \bgroup\aftergroup\beamer@endframe%
    \beamer@article@startframe}%
  \def\beamer@dosingleframe{%
    \bgroup%
    \beamer@inframetrue%
    \let\frame=\framelatex
    \usebeamertemplate{frame begin}%
    \bgroup\aftergroup\beamer@endframe%
    \beamer@article@startframe}%
  \def\beamer@endframe{%
    \usebeamertemplate{frame end}\egroup}

  \def\beamer@article@startframe{%
    \ifx\@currenvir\beamer@frametext%
      \let\beamer@next=\beamer@checkframetitle%
    \else%
      \let\beamer@next=\beamer@article@framecmd%
    \fi%
    \beamer@next}%

  \def\beamer@article@framecmd{%
    \afterassignment\beamer@checkframetitle
    \let\beamer@next=}

  \providecommand\includeonlyframes[1]{}% no effect
}

I would like hook into this code to produce:

  1. Numbering frames within each subsection
  2. Generating a list of frames for each subsection

I use minitoc for producing the per-section table of contents, so ideally, the solution would extend this use, or at least not interfere with it.

Any tips, ideas, or even a solution?

(Here is a related questions and answers: How to produce a list of frames with Beamer if frame titles have LaTeX tags in them? and here is another one: Is there any way to produce List of frames with beamer?)

5
  • 1
    Perhaps \AtBeginEnvironment{frame}{Your sophisticated code} from etoolbox will provide the hook?
    – user31729
    Sep 20, 2014 at 17:22
  • 2
    Please show, what you already have or some dummy beamer file with some subsections/frames etc.
    – user31729
    Sep 20, 2014 at 17:26
  • Does *Numbering frames within each subsection` mean, that the framenumber should be reset with a new subsection?
    – user31729
    Sep 20, 2014 at 17:37
  • Yes, within a subsection.
    – Yossi Gil
    Sep 20, 2014 at 19:03
  • 2
    Add \makeatletter\@addtoreset{framenumber}{subsection}\makeatother to the preamble -- it will reset the framenumber then after every new subsection
    – user31729
    Sep 20, 2014 at 19:04

1 Answer 1

0

As it turns out, this question sheds its light at the wrong corner. Hooking into the the frame environment is the equivalent of banging your had into the wall, when beamer provides a simple interface for doing it, as in e.g.,

\setbeamertemplate{frametitle}{%
  \paragraph{\insertframenumber.~\insertframetitle}\\
  \noindent\emph{\insertframesubtitle}\par 
}

To so it is useful to examine the previous contents of the template, as explained here: "Examining the current value of a beamertemplate".

To restrict changes to the article mode, wrap the above in a \mode<>, e.g.,

\mode<article>{\setbeamertemplate{frametitle}{%
  \paragraph{\insertframenumber.~\insertframetitle}\\
  \noindent\emph{\insertframesubtitle}\par 
}}

You can also use \addtobeamertemplate which adds to the current value of the template, but for purposes such as described in question, such a change would not be sufficient.

Other dead-end directions include:

  • package minitoc: this package cannot generate contents of subsections
  • package titletoc: this package does not play well with hyperref

Seems as if the solution has to be done by hand; package newfile may be of use here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .