% Copyright 2007 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/licenses/LICENSE for more details.

\ProvidesPackageRCS $Header: /cvsroot/latex-beamer/latex-beamer/base/beamerbasemisc.sty,v 1.24 2007/01/28 20:48:21 tantau Exp $

\mode<presentation>

% Maximum dead cycles
\maxdeadcycles=1000

% Calculate maximum number of sections/subsections per part
\beamer@subsubsectionmax=0\relax
\beamer@subsectionmax=0\relax
\beamer@sectionmax=0\relax
\beamer@sectioncount=0\relax

\def\headcommand#1{\global\advance\beamer@totalheads by1\relax%
  \expandafter\gdef\csname @@head\the\beamer@totalheads\endcsname{#1}}
\def\dohead{\beamer@headcounter=0\loop\ifnum\beamer@headcounter<\beamer@totalheads%
  \advance\beamer@headcounter by1\relax%
  \csname @@head\the\beamer@headcounter\endcsname\repeat}

\def\beamer@startpageofframe{1}
\def\beamer@endpageofframe{1}
\def\beamer@startpageofsubsection{1}
\def\beamer@endpageofsubsection{1}
\def\beamer@startpageofsection{1}
\def\beamer@endpageofsection{1}
\def\beamer@startpageofpart{1}
\def\beamer@endpageofpart{1}
\def\beamer@endpageofdocument{1}
\def\beamer@startpageofappendix{}
\def\inserttotalframenumber{1}

\def\partentry#1#2{\beamer@sectioncount=0}
\def\beamer@initsectionentry#1#2#3#4#5{\advance\beamer@sectioncount by1\relax%
  \ifnum\beamer@sectionmax<\beamer@sectioncount\beamer@sectionmax=\beamer@sectioncount\fi}
\def\beamer@initslideentry#1#2#3#4#5#6{\ifnum\beamer@subsectionmax<#2\relax\beamer@subsectionmax=#2\fi}
\def\beamer@initsubsubsectionentry#1#2#3#4#5#6{\ifnum\beamer@subsubsectionmax<#4\relax\beamer@subsectionmax=#4\fi}
\def\beamer@framepages#1#2{}
\def\beamer@subsectionpages#1#2{}
\def\beamer@sectionpages#1#2{}
\def\beamer@partpages#1#2{}
\def\beamer@appendixpages#1{\gdef\beamer@startpageofappendix{#1}}
\def\beamer@documentpages#1{\gdef\beamer@endpageofdocument{#1}}

\setlength\lineskip{1\p@}
\setlength\normallineskip{1\p@}
\renewcommand\baselinestretch{}

\setlength\parskip{0\p@}% \@plus \p@}
\@lowpenalty   51
\@medpenalty  151
\@highpenalty 301
\setcounter{topnumber}{2}
\renewcommand\topfraction{.7}
\setcounter{bottomnumber}{1}
\renewcommand\bottomfraction{.3}
\setcounter{totalnumber}{3}
\renewcommand\textfraction{.9}%.2}
\renewcommand\floatpagefraction{.1}%5}
\setcounter{dbltopnumber}{2}
\renewcommand\dbltopfraction{.7}
\renewcommand\dblfloatpagefraction{.5}
\@beginparpenalty -\@lowpenalty
\@endparpenalty   -\@lowpenalty
\@itempenalty     -\@lowpenalty

\g@addto@macro\beamer@lastminutepatches{
  \beamer@activecjk
  \makeatletter
  \@input{\jobname.nav}
  \let\beamer@sectionentryorig=\sectionentry
  \let\beamer@slideentryorig=\slideentry
  \let\beamer@subsubsectionentryorig=\beamer@subsubsectionentry
  \let\sectionentry=\beamer@initsectionentry
  \let\slideentry=\beamer@initslideentry
  \let\beamer@subsubsectionentry=\beamer@initsubsubsectionentry
  \dohead
  \let\sectionentry=\beamer@sectionentryorig
  \let\slideentry=\beamer@slideentryorig
  \let\beamer@subsubsectionentry=\beamer@subsubsectionentryorig
  \beamer@calculateheadfoot
  \ifbeamer@draftmode
    \setbeamertemplate{footline}{
    \color{black!25}%
    \kern-\Gm@lmargin\vrule width\paperwidth
    height\footheight\kern-\Gm@rmargin}
    \setbeamertemplate{headline}{
    \color{black!25}%
    \kern-\Gm@lmargin\vrule width\paperwidth
    height\headheight\kern-\Gm@rmargin}
    \setbeamertemplate{sidebar left}{%
    \color{black!20}%
    \vrule width \beamer@leftsidebar height\sidebarheight}
    \setbeamertemplate{sidebar right}{%
    \color{black!20}%
    \vrule width \beamer@rightsidebar height\sidebarheight}
    \setbeamertemplate{sidebar canvas left}{}
    \setbeamertemplate{sidebar canvas right}{}
  \fi
  \makeatother
}


\setcounter{tocdepth}{3}

\setlength\arraycolsep{5\p@}
\setlength\tabcolsep{6\p@}
\setlength\arrayrulewidth{.4\p@}
\setlength\doublerulesep{2\p@}
\setlength\tabbingsep{\labelsep}
\skip\@mpfootins = \skip\footins
\setlength\fboxsep{3\p@}
\setlength\fboxrule{.4\p@}


\newcommand\contentsname{Contents}
\newcommand\listfigurename{List of Figures}
\newcommand\listtablename{List of Tables}
\newcommand\refname{References}
\newcommand\bibname{Bibliography}
\newcommand\indexname{Index}
\newcommand\figurename{Figure}
\newcommand\algorithmname{Algorithm}
\newcommand\tablename{Table}
\newcommand\partname{Part}
\newcommand\chaptername{Chapter}
\newcommand\appendixname{Appendix}
\newcommand\abstractname{Abstract}
\def\today{\ifcase\month\or
  January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or December\fi
  \space\number\day, \number\year}
\setlength\columnsep{10\p@}
\setlength\columnseprule{0\p@}
\pagenumbering{arabic}
\onecolumn

\parindent0pt

\AtEndDocument{%
  \clearpage
  \beamer@tempcount=\c@page\advance\beamer@tempcount by -1%
  \if@filesw
      \immediate\write\@auxout{\string\@writefile{nav}%
        {\noexpand\headcommand{\noexpand\beamer@partpages{\the\beamer@partstartpage}{\the\beamer@tempcount}}}}%
      \immediate\write\@auxout{\string\@writefile{nav}%
        {\noexpand\headcommand{\noexpand\beamer@subsectionpages{\the\beamer@subsectionstartpage}{\the\beamer@tempcount}}}}%
      \immediate\write\@auxout{\string\@writefile{nav}%
        {\noexpand\headcommand{\noexpand\beamer@sectionpages{\the\beamer@sectionstartpage}{\the\beamer@tempcount}}}}%
      \immediate\write\@auxout{\string\@writefile{nav}%
        {\noexpand\headcommand{\noexpand\beamer@documentpages{\the\beamer@tempcount}}}}
      \immediate\write\@auxout{\string\@writefile{nav}%
        {\noexpand\headcommand{\noexpand\def\noexpand\inserttotalframenumber{\the\c@framenumber}}}}
      \newwrite\tf@nav
      \immediate\openout\tf@nav\jobname.nav\relax
      \newwrite\tf@toc
      \immediate\openout\tf@toc\jobname.toc\relax
      \newwrite\tf@snm
      \immediate\openout\tf@snm\jobname.snm\relax
    \fi
}



%
% Managing short inserts
%


\define@key{beamerst}{respectlinebreaks}[true]{%
  \def\beamer@stlinebreakrule{}}
\define@key{beamerst}{width}{%
  \def\beamer@ststart{%
    \begin{minipage}[t]{#1}%
      \raggedright%
      \beamer@stalign%
      \beamer@stlinebreakrule%
    }%
  \def\beamer@stend{\end{minipage}}}
\define@key{beamerst}{center}[true]{%
  \def\beamer@stalign{\centering}}
\define@key{beamerst}{spill}[true]{%
  \def\beamer@stalign{\parshape...}}%
\newcommand{\beamer@setupshort}[1]{%
  \def\beamer@stlinebreakrule{\def\\{}}%
  \def\beamer@stalign{}%
  \def\beamer@ststart{\hbox\bgroup\def\\{}}%
  \def\beamer@stend{\egroup}%
  \setkeys{beamerst}{#1}}%
\newcommand{\beamer@insertshort}[1]{%
  \beamer@ststart#1\beamer@stend%
}

\mode
<all>

\AtBeginDocument
{
  \ifx\includegraphics\@undefined
  \else
    \renewcommand<>\includegraphics[2][]{\only#3{\beameroriginal\includegraphics[#1]{#2}}\ignorespaces}
  \fi

  \ifx\pgfuseimage\@undefined
  \else
    \renewcommand<>\pgfuseimage[1]{\only#2{\beameroriginal\pgfuseimage{#1}}\ignorespaces}
    \renewcommand<>\pgfimage[2][]{\only#3{\beameroriginal\pgfimage[#1]{#2}}\ignorespaces}
  \fi
}


\AtBeginDocument{
  % The following code was send to me by Rolf Niepraschk
   \@ifundefined{Gin@driver}{}%
   {%
     \ifx\Gin@driver\@empty\else%
       \filename@parse{\Gin@driver}\@tempswafalse%
       \def\reserved@a{dvips}%
       \ifx\filename@base\reserved@a\@tempswatrue\fi%
       \def\reserved@a{dvipdfm}%
       \ifx\filename@base\reserved@a\@tempswatrue\fi%
       \if@tempswa%
         \AtBeginDvi{%
           \special{papersize=\the\paperwidth,\the\paperheight}}%
       \fi%
       \def\reserved@a{pdftex}%
       \ifx\filename@base\reserved@a
         \pdfpagewidth\paperwidth\pdfpageheight\paperheight%
       \fi%
       \def\reserved@a{vtex}%
       \ifx\filename@base\reserved@a
         \mediawidth\paperwidth\mediaheight\paperheight%
       \fi%
     \fi
   }
 }

 
%%% Local Variables: 
%%% mode: latex
%%% TeX-master: "~/texmf/tex/latex/beamer/examples/beamerexample1.tex"
%%% End: 
