summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/appendixnumberbeamer
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-03-31 22:45:51 +0000
committerKarl Berry <karl@freefriends.org>2012-03-31 22:45:51 +0000
commite48200a9daf7b606346dc7fdfe088b29c8671f75 (patch)
treeb3179be6d60cc04eb8bc712a225da3b26935a054 /Master/texmf-dist/tex/latex/appendixnumberbeamer
parentaeb52de85a365d28a2b85ef54696a7477a0b470b (diff)
new beamer package appendixnumberbeamer (21mar12)
git-svn-id: svn://tug.org/texlive/trunk@25809 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/appendixnumberbeamer')
-rw-r--r--Master/texmf-dist/tex/latex/appendixnumberbeamer/appendixnumberbeamer.sty64
1 files changed, 64 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/appendixnumberbeamer/appendixnumberbeamer.sty b/Master/texmf-dist/tex/latex/appendixnumberbeamer/appendixnumberbeamer.sty
new file mode 100644
index 00000000000..ec6b0066927
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/appendixnumberbeamer/appendixnumberbeamer.sty
@@ -0,0 +1,64 @@
+% vim:ft=plaintex:
+%
+% Written and (C) by Jérôme Lelong <jerome.lelong@gmail.com>
+% 2007 - 2012
+%
+% This program is free software; you can redistribute it and/or modify it
+% under the terms of the GNU General Public License as published by the
+% Free Software Foundation; either version 3 of the License, or (at your
+% option) any later version.
+%
+% This program is distributed in the hope that it will be useful, but
+% WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+% General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License along
+% with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+% This small piece of code fixes the frame numbering in beamer when using
+% an appendix such that the slides of the appendix are not counted in the
+% total framenumber of the main part of the document. The total
+% framenumber counter is reset to 0 and starts counting again when
+% entering the appendix.
+%
+% Usage: \usepackage{appendixnumberbeamer}
+% and declare the appendix as usual using the \appendix command.
+
+
+\makeatletter
+
+
+\let\appendixtotalframenumber\empty
+\def\mainend{-1}
+\let\appendixorig\appendix
+
+% Redefine the \appendix command:
+% - it resets the framenumber counter
+% - freezes the total framenumber for this first part of the document
+\def\appendix{
+ \edef\mainend{\theframenumber}
+ \immediate\write\@auxout{\string\global\string\@namedef{mainendframenumber}{\mainend}}
+ \appendixorig
+ \def\inserttotalframenumber{\appendixtotalframenumber}%
+ \setcounter{framenumber}{0}
+}
+
+% To be called at the end of document to fix the total framenumber in the
+% main document and in the appendix.
+\def\pageatend{
+ \edef\appendixend{\theframenumber}
+ \ifnum\mainend>0%
+ \immediate\write\@auxout{\string\global\string\@namedef{appendixtotalframenumber}{\appendixend}}%
+ \immediate\write\@auxout{\string\global\string\@namedef{inserttotalframenumber}{\mainend}}%
+ \immediate\write\@auxout{\string\@writefile{nav}{\noexpand \headcommand {%
+ \noexpand \def\noexpand \inserttotalframenumber{\mainend}}}}%
+ \immediate\write\@auxout{\string\@writefile{nav}{\noexpand \headcommand {%
+ \noexpand \def\noexpand \appendixtotalframenumber{\appendixend}}}}%
+ \else
+ \fi
+}
+
+
+\AtEndDocument{\pageatend}
+\makeatother