Insert lecture number and page number of lecture in footline
I am dividing a semester's worth of lectures via the \lecture command. I'd like to have in the footline (among other things) the lecture number, date, and page number of t开发者_运维技巧he current lecture. I would also like to use the default style footline, with the black box on the left and the blue on the right. So I define a lecture with e.g.
\lecture{January 28, 2010}{lecture01}
with
\title[Lecture \insertlecturenumber{}(\insertlecture)\quad{}Page \insertframenumber]{Course Title}
in the preamble, I get an error; it will not accept \insertlecture there. If I remove \insertlecture, it does what I want, except that the page number is counted from the start of the semester, not the lecture. Is there any way to do this? Thank you.
Liam
OK, I've finally found a solution to this. First, define
\newcounter{lectureframe}
\newcounter{lectureframestart} % The last frame number of the previous lecture
\newcommand{\lect}[2]{
\setcounter{lectureframestart}{\value{framenumber}}
\date{#1}
\lecture{#1}{#2}
}
and then I add a couple lines to the footline template, which is modified from CambridgeUS:
\setbeamertemplate{footline}
{
\setcounter{lectureframe}{\value{framenumber}}
\addtocounter{lectureframe}{-\value{lectureframestart}}
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
\usebeamerfont{author in head/foot}\insertshortauthor
\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}
\insertframenumber{} / \inserttotalframenumber\hspace*{2ex}
\end{beamercolorbox}}%
\vskip0pt%
}
with the title:
\title[Classname\quad{}Lecture \insertlecturenumber
\quad{}Page \thelectureframe{}]{Classname Lecture}
Instead of using \lecture
, I use \lect
:
\lect{April 13, 2010}{lecture16}
Now the title appears appears in the center segment of the footline, and the date on the right. This is what I was after.
Here's an answer to one of my questions. To reset the page number at each section, use
\setcounter{framenumber}{0}
after (or before) the \lecture command.
精彩评论