3

EDIT: See improved code in bottom of this post

I've succeeded in getting a beamer pdf presented on dual screen (projector and laptop) with \setbeameroption{show notes on second screen=right} and Dual-Screen PDF viewer. Now I'm preparing my presentation (will be around 30 unique slides and 30 minutes) including allocating time to each slide and writing notes. I've added the following code in my preamble for managing and adding timer details to the notes shown on the laptop:

% Add timer counters
\newcounter{TotalS} % Total time seconds
\newcounter{TotalM} % Total time minutes
\newcounter{Slide}  % Slide time seconds

% Use ifthen for counter adding
\usepackage{ifthen}

% Command for timer and note
\newcommand{\timer}[1]{\setcounter{Slide}{#1}
\addtocounter{TotalS}{\value{Slide}}
\ifthenelse{\value{TotalS}>59}
    {\addtocounter{TotalM}{1}\addtocounter{TotalS}{-60}}{}
\note{T: \ifthenelse{\value{TotalM}<10}{0}{}
    \arabic{TotalM}:\ifthenelse{\value{TotalS}<10}{0}{}\arabic{TotalS}, 
    S: 00:\arabic{Slide}}}

Now, by using \timer{x} on each slide, I'll get x seconds for that slide and add x seconds to the total timer, as well as getting the timers displayed in the notes.

Pros:

  • Automatic total time keeping
  • Automatic time note
  • When a slide is split using \only, \onslide, \visible or similar, the counter is added each time. This is a pro, since the slide timer in Dual-Screen PDF Viewer resets as well (because beamer produces explicit pages in the pdf), but requires the time allocation to be split accordingly

Cons:

  • Only works with <60 seconds per slide
  • Doesn't work well with >60 minute presentation

Wanted improvements:

  • Only use 1 total timer (seconds), and divide it into hours, minutes and seconds in the note command
  • Since I'm (relatively) new to LaTeX, the code may be fragile and contain issues I'm not aware of. It would be great to have more experienced people review and improve the code

Question:

  • Can anyone suggest how to improve the code according to the above?

EDIT: Improved code, suggestions still very welcome:

% Add timer counters
\newcounter{TotalS}
\newcounter{TotalM}
\newcounter{SlideS}
\newcounter{SlideM}

% Use ifthen for counter adding and leading zero
\usepackage{ifthen}

% Command for timer and note
\newcommand{\timer}[1]{\setcounter{SlideS}{#1}
    \setcounter{SlideM}{0}
    \addtocounter{TotalS}{\value{SlideS}}
    \loop
    \ifnum\value{TotalS}>59
    \addtocounter{TotalM}{1}
    \addtocounter{TotalS}{-60}
    \repeat
    \loop
    \ifnum\value{SlideS}>59
    \addtocounter{SlideM}{1}
    \addtocounter{SlideS}{-60}
    \repeat
    \note{T:
        \ifthenelse{\value{TotalM}<10}{0}{}\arabic{TotalM}:%
        \ifthenelse{\value{TotalS}<10}{0}{}\arabic{TotalS},
        S:
        \ifthenelse{\value{SlideM}<10}{0}{}\arabic{SlideM}:%
        \ifthenelse{\value{SlideS}<10}{0}{}\arabic{SlideS}
    \\}
}

What has been improved:

  • \timer{125} now correctly splits into 2 minutes and 5 seconds \timer{125} now correctly splits into 2 minutes and 5 seconds

  • newline added to avoid jumping time allocation when notes are otherwise empty

4
  • I don't see a question, so do I assume correctly the wanted points should be taken as such?
    – naphaneal
    Apr 5, 2016 at 10:40
  • Yes, you're right. Apr 5, 2016 at 10:52
  • Maybe tex.stackexchange.com/questions/191010/time-calculations might help in converting seconds to minutes. Apr 5, 2016 at 11:02
  • @samcarter Yes, there were definitely some good points in that thread. After doing some research based on the info there, I decided to use a \loop, \ifnum, \repeat instead, since that seems a bit easier to control. Apr 5, 2016 at 15:05

0

Browse other questions tagged or ask your own question.