%% Modify by Didier Remy (Didier.Remy@inria .fr)
%% From the original Prosper package, described below:
%==============================================================================
% Prosper -- (prosper.cls) Class file
% A LaTeX class for creating slides
% Author: Frederic Goualard (Frederic.Goualard@cwi.nl)
%         Centrum voor Wiskunde en Informatica
%         Amsterdam, The Netherlands
%
% Copyright (c) 2000 Frederic Goualard
% All rights reserved.
% 
% Permission is hereby granted, without written agreement and without
% license or royalty fees, to use, copy, modify, and distribute this
% software and its documentation for any purpose, provided that the
% above copyright notice and the following two paragraphs appear in
% all copies of this software.
% 
% IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, 
% SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF 
% THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHOR HAS BEEN ADVISED 
% OF THE POSSIBILITY OF SUCH DAMAGE.
% 
% THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES,
% INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
% AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
% ON AN "AS IS" BASIS, AND THE AUTHOR HAS NO OBLIGATION TO
% PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
%
% CVSId : $Id: xprosper.sty,v 1.8 2003/11/26 19:02:51 remy Exp $
%==============================================================================

\def\xProsper@Version{1.0i}
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{xprosper}[2000/12/05, v. \xProsper@Version]
\typeout{(c) 2000 Frederic Goualard, CWI, The Netherlands}
\typeout{CVSId: $Id: xprosper.sty,v 1.8 2003/11/26 19:02:51 remy Exp $}
\typeout{ }

%% Options 

%% Requires the seminar class and the semlayer option

\@ifundefined {ver@seminar.cls}
  {\PackageError{xprosper}
      {Document class  seminar does not seem to be loaded}{}}
\@ifundefined {overlay@loop}
  {\PackageError{xprosper}
      {the seminar-class option [semlayer] is required}{}}

%%


\newif \ifDVItoPS \DVItoPSfalse
\newif \ifAccumulate \Accumulatefalse

\def \ppp@overlay@patch {\let \@overlay \pdf@overlay}
\DeclareOption {dvipdfm}{\AtBeginDocument{\ppp@overlay@patch}}
\DeclareOption {psbubble}{\PassOptionsToPackage{ps}{bubble}}

\ProcessOptions

\RequirePackage{color}
\RequirePackage{graphicx}
\RequirePackage{ifthen}
\RequirePackage{bubble}

%% More declarations

\def \ppp@error #1{\PackageError {xprosper}{#1}{Type <RETURN> to proceed.}}

%% Redefinition of the slide environment
\def \l@addto@macro #1#2{%\begingroup 
  \toks@ \expandafter {#1#2}\edef #1{\the \toks@}%\endgroup
}

\def \at@endslide
  {\ifnum \value{overlaysCount}=0\at@endlastoverlay\else
   \ifnum \value{overlaysCount}=\value{pause}\at@endlastoverlay\fi \fi}
\def \AtEndSlide {\g@addto@macro {\at@endslide}}
\def \AtEndThisSlide{\l@addto@macro {\at@endslide}}
\def \at@endlastoverlay {}
\def \AtEndLastOverlay {\g@addto@macro {\at@endlastoverlay}}
\def \AtEndThisLastOverlay {\l@addto@macro {\at@endlastoverlay}}

\newcounter{trueSlideCounter}
\def\thetrueslideCounter{\arabic{trueSlideCounter}}
\let\slide@seminar=\slide
\let\endslide@seminar=\endslide
\let\slide=\relax
\let\endslide=\relax
\newenvironment{SlideNormal}[1][\@defaultTransition]{%
  \setcounter{pause}{1}%
  \StepCounter{trueSlideCounter}%
  \setcounter{overlaysCount}{0}\relax
  \slide@seminar
        \@DefMyItem
        }{%
      \at@endslide
      \endslide@seminar}
% Slides in overlays
\global\pslongbox{posit@Box}{\rput}%

\newinsert \ppp@footins
\newcounter {pppfootnote}
\def\thepppfootnote{\itshape\@alph\c@pppfootnote}

\long\def\ppp@footnotetext#1{\ifpause[<0]{}{%
  \global\setbox\ppp@footins\vbox{%
    \unvbox\ppp@footins
    \reset@font\footnotesize
    \hsize\columnwidth
    \@parboxrestore
    \protected@edef\@currentlabel
         {\csname p@footnote\endcsname\@thefnmark}%
    \color@begingroup
      \@makefntext{%
        \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
    \color@endgroup}}{}}

\let \latex@stepcounter \stepcounter
\def\footnote{\@ifnextchar[\@xfootnote{\latex@stepcounter\@mpfn
     \protected@xdef\@thefnmark{\thempfn}%
     \@footnotemark\@footnotetext}}

\newbox \ppp@box 

\newenvironment{SlideOverlay}[1][\@defaultTransition]{%
  \let\overlay@loop=\relax
  \ifDVItoPS
  \else %% DVI -> PDF
      \setcounter{pause}{1}%
      \StepCounter{trueSlideCounter}%
  \fi 
      \slide@seminar
            \@DefMyItem
  %\begin{minipage}{\hsize}%
  % Before was:
  %\hbox \bgroup \vtop to 0em \bgroup
  % But the following seems to work better
  % [maybe \vsize is not the right dimen] work
  \hbox \bgroup \vtop to 0em \bgroup
  \hbox \bgroup \vtop to \vsize \bgroup
      \def\@mpfn{pppfootnote}\def\thempfn{\thepppfootnote}\c@pppfootnote\z@
      \let\@footnotetext\ppp@footnotetext
      \let\footnotemark \ppp@footnote
  %\vskip -0em
  }{%
  \at@endslide
  \vskip 0em plus 1fil minus 1fil
  \ifvoid \ppp@footins \else
  \vskip\skip \slide@footins
  \kern \ht\ppp@footins \kern \dp\ppp@footins \fi
  \egroup \egroup
  \ifvoid \ppp@footins \else
     \kern -\ht\ppp@footins \vskip -\dp\ppp@footins
      \normalcolor \footnoterule
     \unvbox \ppp@footins\fi
  \vss
  \egroup
  \egroup
  %\end{minipage}
  \endslide@seminar
  \ifDVItoPS
  \else %% DVI -> PDF
     \addtocounter{slide}{-1}%
  \fi
}

\let\slide=\SlideNormal
\let\endslide=\endSlideNormal



% Definition of the bullet for itemize env.
\def\@prosperItemi{{\scriptsize\color{green}%
      \raisebox{2pt}{\ensuremath{\bullet}}}}
\def\@prosperItemii{{\scriptsize\color{green}%
      \raisebox{2pt}{\ensuremath{\bullet}}}}
\def\@prosperItemiii{{\scriptsize\color{green}%
      \raisebox{2pt}{\ensuremath{\bullet}}}}
\newcommand{\myitem}[2]{%
  \ifnum#1=1 
    \gdef\@prosperItemi{#2}%
  \else
    \ifnum#1=2\gdef\@prosperItemii{#2}%
    \else
       \ifnum#1=3
          \gdef\@prosperItemiii{#2}%
       \else
          \ppp@Error{Undefined item level}%
       \fi
    \fi
  \fi
}

\def\@DefMyItem{%
  \global\let\labelitemi=\@prosperItemi
  \global\let\labelitemii=\@prosperItemii
  \global\let\labelitemiii=\@prosperItemiii
}

\RequirePackage{amssymb}
\mathchardef \mylabel "3449
\def\labelitemi{\ensuremath{\mylabel}}
\myitem{1}{\ensuremath{\color{gray}\mylabel}}
\myitem{2}{\ensuremath{\color{gray}\triangleright}}
\myitem{3}{\ensuremath{\color{gray}\diamond}} 

\expandafter\ifx\csname realpageref\endcsname\relax%
  \gdef\realpageref#1{\expandafter\real@setref
    \csname r@#1\endcsname\@secondoffive{#1}}
\else 
  \relax 
\fi

\def\nobabel{%
\let\labelitemi\@ltiORI%
\let\labelitemii\@ltiiORI%
\let\labelitemiii\@ltiiiORI%
\let\labelitemiv\@ltivORI}



%% Overlays environment
\newcounter{overlay@page}
\newenvironment{Overlays}{%
  \global\let\slide\SlideOverlay
  \global\let\endslide\endSlideOverlay
  \setcounter{overlay@page}{\value{slide}}}{%
  \global\let\slide\SlideNormal
  \global\let\endslide\endSlideNormal
  \global\let\@okForBookmark\relax
  \setcounter{slide}{\value{overlay@page}}\StepCounter{slide}}

% overlays environment
% Parameter: # of slides in the overlay
% slide 0 is the one for PostScript file
\newbox\theoverlays
\newcounter{overlaysCount}
%%% Removed \newcounter{limitOverlays}: does not need to a counter

% fromSlide, onlySlide, untilSlide
% Masks or not the parameter. 
% The stared version does not advance the position pointer and does not
% interpret its argument (to be used for graphics and commands containing
% PStricks links)

%%% Modified: so as to make code space clean (does not silently add spaces)

\def\fromSlide{%
  \@ifnextchar *\fromSlide@E\fromSlide@NE
}
\long \def\fromSlide@NE#1#2{%
  \ifDVItoPS
    \ifAccumulate #2\fi
  \else
    \ifnum#1>\value{overlaysCount}{\overlay {1}#2}\else #2\fi
  \fi
}
\long \def\fromSlide@E*#1#2{%
\ifDVItoPS
    \ifAccumulate #2\fi
\else
  \ifnum#1>\value{overlaysCount}\relax \else #2\fi
\fi
}

\def\untilSlide{%
  \@ifnextchar *\untilSlide@E\untilSlide@NE
}
\long \def\untilSlide@NE#1#2{%
\ifDVItoPS
    \ifAccumulate #2\fi
\else
  \ifnum#1<\value{overlaysCount}{\overlay {1}#2}\else #2\fi
\fi
}
\long \def\untilSlide@E*#1#2{%
\ifDVItoPS
    \ifAccumulate #2\fi
\else
  \ifnum#1<\value{overlaysCount}\relax \else #2\fi
\fi
}

\def\onlySlide{%
  \@ifnextchar *\onlySlide@E\onlySlide@NE
}
\long \def\onlySlide@NE#1#2{%
\ifDVItoPS
    \ifAccumulate #2\fi
\else
  \ifnum#1=\value{overlaysCount}#2\else {\overlay {1}#2}\fi
\fi
}
\long \def\onlySlide@E*#1#2{%
\ifDVItoPS
    \ifAccumulate #2\fi
\else
  \ifnum#1=\value{overlaysCount}#2\fi
\fi
}

\def\exceptSlide{%
  \@ifnextchar *\exceptSlide@E\exceptSlide@NE
}
\long \def\exceptSlide@NE#1#2{%
\ifDVItoPS
    \ifAccumulate #2\fi
\else
  \ifnum#1=\value{overlaysCount}{\overlay {1}#2}\else #2\fi
\fi
}
\long \def\exceptSlide@E*#1#2{%
\ifDVItoPS
    \ifAccumulate #2\fi
\else
  \ifnum#1=\value{overlaysCount}\else #2\fi
\fi
}


% FromSlide, OnlySlide, UntilSlide
% Masks or not the following material. Avances the position pointer
\newcommand{\FromSlide}[1]{%
\ifDVItoPS
\else
  \ifnum#1>\value{overlaysCount}\overlay {1}\fi
\fi
}
\newcommand{\UntilSlide}[1]{%
\ifDVItoPS
\else
  \ifnum#1<\value{overlaysCount}\overlay {1}\fi
\fi
}
\newcommand{\OnlySlide}[1]{%
\ifDVItoPS
\else
  \ifnum#1=\value{overlaysCount}\else \overlay {1}\fi
\fi
}

% Overlays. Parameter to state the number of slides composing the overlay
%\def\stepcounter#1{%
%  \ifInOverlays
%    \ifnum\value{overlayscount}<2
%    \else
%      \addtocounter{#1}\@ne
%    \fi
%  \else
%    \addtocounter{#1}\@ne
%  \fi
%  \begingroup
%    \let\@elt\@stpelt
%    \csname cl@#1\endcsname
%  \endgroup
%}

%%% The following def is not space clean. 
%%% Not too bad because in vmode, but still, it should be fixed.

\newif\ifInOverlays
\InOverlaysfalse
\long\def\overlays#1#2{%
  \global\InOverlaystrue
  \aftergroup\InOverlaysfalse
  \setcounter{overlaysCount}{1}\relax
  \ifDVItoPS #2\else
    \Overlays
    \bgroup  
%%% Changed next 3 lines for automatic end of overlays
    \def \c@limitOverlays {#1}\relax
    \ifx #1*\let \c@limitOverlays \c@pause \else 
    \def \c@limitOverlays {#1}\fi
%%% Put {#2} not to interpret commands in #2 such as \if commands
    \loop {#2}\ifnum \c@overlaysCount<\c@limitOverlays
      \StepCounter{overlaysCount}\repeat
    \egroup
    \endOverlays
  \fi
}

\AtBeginDocument{%
 \let\Label=\label
 \def\label#1{%
   \ifInOverlays
     \ifnum \value{overlaysCount}>1\else \Label{#1}\fi
   }
 % For amsmath environments
 \let\Label@in@display=\label@in@display
 \def\label@in@display#1{%
   \ifInOverlays
     \ifnum\value{overlaysCount}>1\else \Label@in@display{#1}\fi
   }%
% Next line should only be executed in SlideOverlay to let the old behavior
% in SlideNormal
%  \let\overlay@loop=\relax
  \let\StepCounter=\stepcounter
  \def\RefStepCounter#1{\StepCounter{#1}%
    \protected@edef\@currentlabel
    {\csname p@#1\endcsname\csname the#1\endcsname}%
  }%
  \def\stepcounter#1{%
    \ifInOverlays
      \ifthenelse{\equal{#1}{slide}}{%
         \StepCounter{#1}}{%
         \ifnum\value{overlaysCount}>1\relax
         \else
           \StepCounter{#1}%
         \fi}%
    \else
      \StepCounter{#1}%
    \fi}
% Macro \overlay taken from semlayer.sty
\def\overlay#1{%
  \ifoverlays\ifx\@overlay\relax\nooverlays@err\fi\fi
  \ifslide
    \@tempcnta=#1
    \@testfalse
    \ifnum\@tempcnta>-1 \ifnum\@tempcnta<10 \@testtrue\fi\fi
    \if@test
      \c@overlay=\@tempcnta
      \ifnum\c@overlay=0
        \advance\c@slide by -1
        \RefStepCounter{slide}%
      \else
        \advance\c@overlay by -1
        \RefStepCounter{overlay}%
        \ifoverlays
          \xdef\overlay@list{\overlay@list,\the\c@overlay}%
        \fi
      \fi
      \ifoverlays
        \@overlay{\the\c@overlay}%
      \fi
    \else
      \@seminarerr{\string\overlay\space argument must be
        an integer between 0 and 9}\@eha
    \fi
  \else
    \@seminarerr{\string\overlay\space can only be used
      in slide environments}\@eha
  \fi
  \ignorespaces}
} % AtBeginDocument

\def \pdf@overlay #1{\colors@cancel{white}\aftergroup \colors@restore}




% \part
\let\part=\relax
\newcommand{\part}[2][\@defaultTransition]{%
  \slide[#1]{@}%
    \vspace*{1.5cm}\@addBookmarkOnSlide{#2}%
  \endslide}

% Uses #1 if PDF option, otherwise #2
\newcommand{\PDForPS}[2]{%
  \ifDVItoPS
    #2
  \else
    #1
  \fi
}

% #1 appears on the slide only on PS mode
\newcommand{\onlyInPS}[1]{\ifDVItoPS #1\fi}
% #1 appears on the slide only on PDF mode
\newcommand{\onlyInPDF}[1]{\ifDVItoPS\relax\else #1\fi}



% To be used in conjunction with babel/french to allow ones own labels
\def\NoFrenchBabelItemize{%
\AtBeginDocument{%
\renewenvironment{itemize}%
{\ifnum \@itemdepth >\thr@@\@toodeep\else
    \advance\@itemdepth\@ne
    \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
    \expandafter
    \list
      \csname\@itemitem\endcsname%
    {\let\@trivlist\@trivlistORI
      \settowidth{\labelwidth}{\textendash}%
      \setlength{\leftmargin}{\labelwidth}%
      \addtolength{\leftmargin}{\labelsep}%
      \ifnum\@listdepth=0
      \setlength{\itemindent}{\parindent}%
      \else
      \addtolength{\leftmargin}{\parindent}%
      \fi
      \setlength{\itemsep}{\z@}%
      \setlength{\parsep}{\z@}%
      \setlength{\topsep}{\z@}%
      \setlength{\partopsep}{\z@}%
      \addtolength{\topsep}{-\parskip}%
      \addtolength{\partopsep}{\parskip}%
      }%
    \fi}%
 {\endlist}
}}

%%% Appendices: added several features

%%% Pauses: to step

\newcounter{pause}
\newcount \tmp@pause
\newenvironment{layer}[1][=0]{%
  \tmp@pause \c@overlaysCount \advance \tmp@pause by -\c@pause
  \ifnum \tmp@pause #1\relax \overlay 1\fi} 
  {}  
\newenvironment{layer*}[1][=0]{%
  \tmp@pause \c@overlaysCount \advance \tmp@pause by -\c@pause
  \ifnum \tmp@pause #1\relax \let \@do \layer@open
  \else \let \@do \layer@ignore\fi \@do} 
  {}
\expandafter \def \csname endlayer*\endcsname 
   #1\ignorespaces\fi{\endgroup\layer@close}

\long\def \layer@ignore #1{\endgroup}
\def \layer@open {\afterassignment \layer@checkopen \let \@do}
\def \layer@close {\afterassignment \layer@checkclose \let \@do}
\let \layer@bgroup{
\let \layer@egroup}
\def \layer@checkopen {\ifx \@do \layer@bgroup\else
    \PackageError{xprosper}
      {{layer*} should be folowed by open brace}{}\fi}
\def \layer@checkclose {\ifx \@do \layer@egroup\else
    \PackageError{xprosper}
      {{layer*} should be folowed by close brace}{}\fi}

\newcommand{\ppp@ifpause}[1][=0]{%
  \tmp@pause \c@overlaysCount \advance \tmp@pause by -\c@pause
  \ifnum \tmp@pause #1\relax \expandafter \@firstoftwo
  \else \expandafter \@secondoftwo \fi} 
\let \ifpause \ppp@ifpause
% \newcommand{\ifpause}[3][=0]{%
%   \tmp@pause \c@overlaysCount \advance \tmp@pause by -\c@pause
%   \ifnum \tmp@pause #1#2\else #3\fi} 
\newcommand{\ifbeforePause}{\ifpause[<0]}
\newcommand{\ifafterPause}{\ifpause[>0]}
\newcommand{\ifbetweenPauses}[4]
   {\ifpause[>#2]{#4}{\ifpause[<#1]{#4}{#3}}}
\def \@pause #1{\@ifstar {\def \pause@do{#1*}\@@pause}
                         {\def \pause@do{#1}\@@pause}}
%\def \skip@star #1*{#1}
\newcommand {\@@pause}[2][0]{\tmp@pause #1\advance \tmp@pause by \c@pause
  \pause@do{\tmp@pause}{#2}}
\newcommand {\exceptPause} {\@pause{\exceptSlide}}
\newcommand {\onlyPause} {\@pause{\onlySlide}}
\newcommand {\fromPause} {\@pause{\fromSlide}}
\newcommand {\untilPause} {\@pause{\untilSlide}}
\newcommand {\betweenPauses} {\@ifstar{\betweenPauses@i}{\betweenPauses@ii}}
\newcommand {\betweenPauses@i}[3]{\fromPause*[#1]{\untilPause*[#2]{#3}}}
\newcommand {\betweenPauses@ii}[3]{\fromPause[#1]{\untilPause[#2]{#3}}}


\def \@relax{\relax}
\def \member@true #1\relax\relax #2#3{#2}
\def \member@false #1\relax\relax #2#3{#3}
\def \member@test 
  {\let \@do \member@test@
   \ifx \member@op <\else
   \ifx \member@op >\else
   \ifx \member@op =\else
   \ifx \member@op \relax \let \@do \member@false
   \else \def \@do {\member@test@=}\fi \fi \fi \fi \@do}
\def \member@test@ #1,{%\def \@first {#1}%
   %\ifx \@first \@relax \let \member@loop \member@false \else 
   \ifnum \@member #1\let \member@loop \member@true % \fi
   \fi \futurelet \member@op \member@loop}
\def \ifmember #1#2{\edef \@member {#1}\let \member@loop \member@test
    \futurelet \member@op
    \member@loop #2,\relax,\relax\relax}

\newcommand {\ifpauses}[4][0]{\tmp@pause #1\advance \tmp@pause by \c@pause
  \advance \tmp@pause by -\c@overlaysCount 
  \tmp@pause -\tmp@pause
  \ifmember {\the\tmp@pause}{#2}{#3}{#4}}

\def \lpause #1{\advance \c@pause by #1\relax}


\def \step@pause #1{\global \advance \c@pause by #1\relax}
\newcommand {\normal@pause}[1][1]{\ifInOverlays\else
\ppp@error {\string \pause\space can only be used in slides with overlays}\fi
\step@pause{#1}\FromSlide{\c@pause}}
\def \rowemph {\ifnum \c@overlaysCount=\c@pause \rowcolor {yellow}\fi}
\newcommand {\rowpause}{\noalign{\step@pause{1}}}
\def \rowemphi{\rowpause\rowemph}

\def \gray@pause{\ifpause[=1]{\colors@restore@black}{}\normal@pause}
%\def \gray@pause{\ifpause[=1]{\colors@restore}{}\normal@pause}
\let \pause \normal@pause
\let \color@pst@color \pst@color
\let \color@color \color
\def \relax@color#1{}
\def \relax@textcolor#1#2{#2}
\def \colors@cancel #1{%
   \color{#1}\global \let \color \relax@color 
   \global \let \pst@color \relax@color}
\def \colors@restore
  {\global \let \color \color@color
   \global \let \pst@color \color@pst@color}
\def \colors@restore@black {\colors@restore \color{black}}
\def \GrayAfterPause
   {\ifpause{\color{black}}{\let \pause \gray@pause \colors@cancel{gray}}}
\def \pause@item {\pause \local@item}
\def \pause@item@ {\let \item \pause@item \local@item}
\def \PauseAfterItem {\let \local@item \item \let \item \pause@item@}
\let \CancelColors \colors@cancel
\def \CancelColorsGray {\colors@cancel{gray}}
\let \RestoreColorsBlack \colors@restore@black
\def \NormalPause {\let \pause \normal@pause \colors@restore@black}

\newcommand {\alloverlays}[1][t]
  {\DVItoPStrue 
   \def \@test{#1}\ifx #1t\Accumulatefalse \else \Accumulatetrue\fi}


%%% Bulles

\def \SetBulleBG{\def \bulle@bg}
\SetBulleBG{yellow}
\def \ppp@bubble #1{#1}
\def \ppp@ignore #1{}
\newcommand {\bulle}[2][=0]%
  {\ppp@ifpause[#1]%
      {\bubble [bg=\bulle@bg]{#2}}
      {\bubble [bubble=\ppp@ignore]{#2}}}

%%% Superposition of boxes \superpose[x]{l1\\...\ln}
%%% where x in {l, c, r} encodes justification
%%% and l1, ..., ln are lines to be superposed.

% \long \def \Superpose #1{\superpose{#1}}
% \long \def \Onlypause [#1]#2{\onlyPause[#1]{#2}}
% \long \def \cbox #1{\vbox {$\vcenter {\vbox {#1}}$}}

%%% Preparing slide fonts outside of slides

\newenvironment{noslide}
  {\set@slidesize
   \slidebox@restore
   \the\slide@hook
   \the\before@newslide
   \everyslide}
  {}

%%% Absolute placement.

\def \Place (#1,#2)#3{\hbox to 0em
   {\hskip #1\vbox to 0em {\vskip #2\hbox {#3}\vss}\hss}}

\newcommand{\lastpage@putlabel}{\addtocounter{page}{-1}%
   \immediate\write\@auxout{\string
   \newlabel{last@page}{{}{\theslide}{\relax }{}{}}}%
   \addtocounter{page}{1}}
\AtEndDocument{\clearpage \lastpage@putlabel}

\endinput

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 
