\ProvidesPackage{beamerbaselocalstructure}[2004/01/10 ver 1.20]
\NeedsTeXFormat{LaTeX2e}[1995/12/01]

% Copyright 2003 by Till Tantau <tantau@users.sourceforge.net>.
%
% This program can be redistributed and/or modified under the terms
% of the GNU Public License, version 2.



\mode<presentation>

\RequirePackage{enumerate}


%
%
% The \frametitle command
%
%
\newcommand<>\frametitle{\alt#1{\@dblarg\beamer@@frametitle}{\beamer@gobbleoptional}}
\long\def\beamer@@frametitle[#1]#2{%
  \beamer@ifempty{#2}{}{%
  \gdef\insertframetitle{#2\beamer@autobreaktemplate}%
  \gdef\beamer@frametitle{#2}%
  \gdef\beamer@shortframetitle{#1}%
}%
}

\newcommand\useframetitletemplate[1]{\def\beamer@headrenderer{#1\vskip0.25em}}

\newcommand\insertshortframetitle[1][]{%
  {%
    \beamer@setupshort{#1}%
    \beamer@insertshort{\beamer@shortframetitle}%
  }}


\mode
<all>
{
  \newcommand<>\framesubtitle[1]{\only#2{\gdef\insertframesubtitle{#1}}}
}


\mode
<article>
{
  \newcommand<>\frametitle[2][]{\only#3{\gdef\insertframetitle{#2}\beamer@headrenderer}}
  \long\def\useframetitletemplate#1{\def\beamer@headrenderer{#1}}
  \useframetitletemplate{\paragraph*{\insertframetitle}\ \par}
}



%
% Alerting
%

\mode
<all>
{
\newenvironment{alertenv}{\begin{altenv}%
    {\beamer@templatestartalert}
    {\beamer@templateendalert}{\color{.}}{}}{\end{altenv}}

\newenvironment{structureenv}{\begin{altenv}%
    {\beamer@templatestartstructure}
    {\beamer@templateendstructure}{\color{.}}{}}{\end{altenv}}

\newcommand<>{\alert}[1]{\begin{alertenv}#2#1\end{alertenv}}
\newcommand<>{\structure}[1]{\begin{structureenv}#2#1\end{structureenv}}

\long\def\usealerttemplate#1#2{%
  \def\beamer@templatestartalert{#1}\def\beamer@templateendalert{#2}}
\long\def\usestructuretemplate#1#2{%
  \def\beamer@templatestartstructure{#1}\def\beamer@templateendstructure{#2}}
}


\mode
<presentation>
{
\usealerttemplate{%
  \def\bmb@scheme{alert}%
  \colorlet{beamerstructure}{beameralert!85!beamerstructure}%
  \colorlet{beamerexample}{beameralert!85!beamerexample}%
  \color{beameralert}}{}
\usestructuretemplate{\color{beamerstructure}}{}
}

\mode
<article>
{
  \usealerttemplate{\ifmmode\else\begin{itshape}\fi}{\ifmmode\else\end{itshape}\fi}
  \usestructuretemplate{\begin{bfseries}}{\end{bfseries}}
}



%
%
% Predefined Blocks
%
%

\mode
<all>
{
  \long\def\useblocktemplate#1#2{%
    \def\beamer@beginblocktemplate{#1}
    \def\beamer@endblocktemplate{#2}}

  \long\def\usealertblocktemplate#1#2{%
    \def\beamer@beginalertblocktemplate{#1}
    \def\beamer@endalertblocktemplate{#2}}

  \long\def\useexampleblocktemplate#1#2{%
    \def\beamer@beginexampleblocktemplate{#1}
    \def\beamer@endexampleblocktemplate{#2}}

\newenvironment<>{block}[1]{%
  \begin{actionenv}#2%
    \def\insertblockname{#1}%
    \par%
    \beamer@beginblocktemplate}
  {\par%
    \beamer@endblocktemplate%
  \end{actionenv}}

\newenvironment<>{alertblock}[1]{%
  \begin{actionenv}#2%
    \def\insertblockname{#1}%
    \par%
    \beamer@beginalertblocktemplate}
  {\par%
    \beamer@endalertblocktemplate%
  \end{actionenv}}

\newenvironment<>{exampleblock}[1]{%
  \begin{actionenv}#2%
    \def\insertblockname{#1}%
    \par%
    \beamer@beginexampleblocktemplate}
  {\par%
    \beamer@endexampleblocktemplate%
  \end{actionenv}}
}


\mode
<article>
{
  \useblocktemplate{\par\medskip{\noindent\textbf{\insertblockname}}\par\noindent\ignorespaces}{\medskip}
  \usealertblocktemplate{\par\medskip{\noindent\textbf{\emph{\insertblockname}}}\par\noindent\ignorespaces}{\medskip}
  \useexampleblocktemplate{\par\medskip{\noindent\emph{\insertblockname}}\par\noindent\ignorespaces}{\medskip}
}


%
% List stuff
%

\setlength\leftmargini  {2em}
\setlength\leftmarginii  {2em}
\setlength\leftmarginiii  {2em}
\setlength  \labelsep  {.5em}
\setlength  \labelwidth{\leftmargini}
\addtolength\labelwidth{-\labelsep}
\renewcommand\theenumi{\@arabic\c@enumi}
\renewcommand\theenumii{\@arabic\c@enumii}
\renewcommand\theenumiii{\@arabic\c@enumiii}

\def\@listi{\leftmargin\leftmargini
            \topsep 3\p@ \@plus2\p@ \@minus2.5\p@
            \parsep 0\p@
            \itemsep3\p@ \@plus2\p@ \@minus3\p@}
\let\@listI\@listi
\def\@listii{\leftmargin\leftmarginii
              \topsep    2\p@ \@plus1\p@ \@minus2\p@
              \parsep    0\p@   \@plus\p@
              \itemsep   \parsep}
\def\@listiii{\leftmargin\leftmarginiii
              \topsep    2\p@ \@plus1\p@ \@minus2\p@
              \parsep    0\p@   \@plus\p@
              \itemsep   \parsep}

            
%
%
% Enumerations
%
%

\def\enumerate{%
  \ifnum\@enumdepth>2\relax\@toodeep
  \else%
    \advance\@enumdepth\@ne%
    \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
    \advance\@itemdepth\@ne%
  \fi%
  \@ifnextchar[{\beamer@@enum@}{\beamer@enum@}}
\def\beamer@@enum@[{\@ifnextchar<{\beamer@enumdefault[}{\beamer@@@enum@[}}
\def\beamer@enumdefault[#1]{\def\beamer@defaultospec{#1}%
  \@ifnextchar[{\beamer@@@enum@}{\beamer@enum@}}
\def\beamer@@@enum@[#1]{% partly copied from enumerate.sty
  \@enLab{}\let\@enThe\@enQmark
  \@enloop#1\@enum@
  \ifx\@enThe\@enQmark\@warning{The counter will not be printed.%
   ^^J\space\@spaces\@spaces\@spaces The label is: \the\@enLab}\fi
  \expandafter\def\csname label\@enumctr\endcsname{\def\insertenumlabel{\the\@enLab}\beamer@autoenumtemplate}%
  \expandafter\let\csname the\@enumctr\endcsname\@enThe
  \csname c@\@enumctr\endcsname7
  \expandafter\settowidth
            \csname leftmargin\romannumeral\@enumdepth\endcsname
            {\the\@enLab\hspace{\labelsep}}%
  \beamer@enum@}
\def\beamer@enum@{%
  \csname\@enumctr starttemplate\endcsname%
  \expandafter
    \list
      \csname label\@enumctr\endcsname
      {\usecounter\@enumctr%
        \def\makelabel##1{{\hss\llap{##1}}}}%
  \beamer@cramped%
  \raggedright}
\def\endenumerate{\ifhmode\unskip\fi\endlist\csname\@enumctr endtemplate\endcsname}

\def\useenumerateitemminitemplate#1{%
  \def\beamer@autoenumtemplate{#1}}
\useenumerateitemminitemplate{\color{beamerstructure}\insertenumlabel}


%
%
% Itemize
%
%

\renewcommand{\itemize}[1][]{%
  \beamer@ifempty{#1}{}{\def\beamer@defaultospec{#1}}%
  \ifnum \@itemdepth >2\relax\@toodeep\else
    \advance\@itemdepth\@ne
    \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
    \edef\@itemctr{item\romannumeral\the\@itemdepth}%
    \csname\@itemctr starttemplate\endcsname%
    \expandafter
    \list
      \csname\@itemitem\endcsname
      {\def\makelabel##1{{\hss\llap{##1}}}}
  \fi%
  \beamer@cramped%
  \raggedright}
    
\def\enditemize{\ifhmode\unskip\fi\endlist\csname\@itemctr endtemplate\endcsname}

\mode
<article>
{
  \AtBeginDocument{
    \let\beamer@origitemize=\itemize
    \renewcommand{\itemize}[1][]{\beamer@origitemize}
  }
}


\def\useenumerateitemtemplate#1{% 
  \def\labelenumi{\def\insertenumlabel{\theenumi}#1}}

\def\useenumeratetemplate#1#2{% before and after
  \def\enumistarttemplate{#1}%
  \def\enumiendtemplate{#2}}

\def\usesubenumerateitemtemplate#1{%
  \def\labelenumii{\def\insertenumlabel{\theenumi}\def\insertsubenumlabel{\theenumii}#1}}

\def\usesubenumeratetemplate#1#2{% before and after
  \def\enumiistarttemplate{#1}%
  \def\enumiiendtemplate{#2}}

\def\usesubsubenumerateitemtemplate#1{%
  \def\labelenumiii{\def\insertenumlabel{\theenumi}%
    \def\insertsubenumlabel{\theenumii}%
    \def\insertsubsubenumlabel{\theenumiii}#1}}

\def\usesubsubenumeratetemplate#1#2{% before and after
  \def\enumiiistarttemplate{#1}%
  \def\enumiiiendtemplate{#2}}


\def\useitemizeitemtemplate#1{%
  \def\labelitemi{#1}\let\beamer@labelitemi\labelitemi}

\def\useitemizetemplate#1#2{% before and after
  \def\itemistarttemplate{#1}%
  \def\itemiendtemplate{#2}}

\def\usesubitemizeitemtemplate#1{%
  \def\labelitemii{#1}\let\beamer@labelitemii\labelitemii}

\def\usesubitemizetemplate#1#2{% before and after
  \def\itemiistarttemplate{#1}%
  \def\itemiiendtemplate{#2}}

\def\usesubsubitemizeitemtemplate#1{%
  \def\labelitemiii{#1}\let\beamer@labelitemiii\labelitemiii}

\def\usesubsubitemizetemplate#1#2{% before and after
  \def\itemiiistarttemplate{#1}%
  \def\itemiiiendtemplate{#2}}

\def\description{\@ifnextchar[{\beamer@testforospec}{\beamer@descdefault\beamer@descdefaulttemp\@@description}}
\def\beamer@testforospec[{\@ifnextchar<{\beamer@scandefaultospec[}{\@description[}}
\def\beamer@scandefaultospec[#1]{\def\beamer@defaultospec{#1}\description}
\def\@description[#1]{\setbox\beamer@tempbox=\hbox{\def\insertdescriptionitem{#1}\descriptionitemtemplate}%
  \beamer@descdefault\wd\beamer@tempbox\advance\beamer@descdefault by \labelsep\@@description}
\def\@@description{\list{}{\labelwidth\beamer@descdefault\leftmargin\beamer@descdefault\let\makelabel\beamer@descriptionitem}%
  \beamer@cramped%
  \raggedright}
\def\enddescription{\ifhmode\unskip\fi\endlist}
\long\def\beamer@descriptionitem#1{\def\insertdescriptionitem{#1}%
  \hfil\hspace\labelsep\normalfont\descriptionitemtemplate}

\def\usedescriptionitemtemplate#1#2{\def\descriptionitemtemplate{#1}\global\beamer@descdefaulttemp=#2%
  \global\advance\beamer@descdefaulttemp by \labelsep}
\usedescriptionitemtemplate{\color{beamerstructure}\insertdescriptionitem}{2cm}

\def\usedescriptionitemofwidthas#1{%
  \setbox\beamer@tempbox=\hbox{\def\insertdescriptionitem{#1}\descriptionitemtemplate}%
  \beamer@descdefault\wd\beamer@tempbox\advance\beamer@descdefault by
  \labelsep%
  \beamer@descdefaulttemp=\beamer@descdefault}

\let\beamer@itemize\itemize





  
%
% Abstract command
%

\newenvironment<>{abstract}%
{\begin{actionenv}#1\beamer@templateabstractstart}{\beamer@templateabstractend\end{actionenv}}

\newcommand\usetemplateabstract[2]{\def\beamer@templateabstractstart{#1}\def\beamer@templateabstractend{#2}}

\usetemplateabstract{
  \begin{center}%
    \structure{\abstractname}\vspace{-.5em}\vspace{0pt}%
  \end{center}\small%
  \begin{quote}\normalfont}
  {\end{quote}}



  
%
% Verse, quotation, quote environments
%
    
\newenvironment<>{verse}
               {\begin{actionenv}#1\let\\\@centercr
                \list{}{\itemsep      \z@
                        \itemindent   -1.5em%
                        \listparindent\itemindent
                        \rightmargin  \leftmargin
                        \advance\leftmargin 1.5em
                        \parsep       .75em plus .25em minus.25em}%
                \item\relax\beamer@templateversestart}
               {\beamer@templateverseend\endlist\end{actionenv}}

\newcommand\usetemplateverse[2]{\def\beamer@templateversestart{#1}\def\beamer@templateverseend{#2}}
\usetemplateverse{\rmfamily\itshape}{}
               
\newenvironment<>{quotation}
               {\begin{actionenv}#1\list{}{\listparindent 1.5em%
                        \itemindent    \listparindent
                        \rightmargin   \leftmargin
                        \parsep        \z@ \@plus\p@}%
                \item\relax\beamer@templatequotationstart}
               {\beamer@templatequotationend\endlist\end{actionenv}}

\newenvironment<>{quote}
               {\begin{actionenv}#1\list{}{\rightmargin\leftmargin}%
                \item\relax\beamer@templatequotationstart}
               {\beamer@templatequotationend\endlist\end{actionenv}}

             
% applies both to quote and quotation
\newcommand\usetemplatequotation[2]{\def\beamer@templatequotationstart{#1}\def\beamer@templatequotationend{#2}}
\usetemplatequotation{\itshape}{}


\mode
<article>
{
  \renewenvironment<>{verse}{\begin{actionenv}#1\begin{originalverse}}{\end{originalverse}\end{actionenv}}
  \renewenvironment<>{quotation}{\begin{actionenv}#1\begin{originalquotation}}{\end{originalquotation}\end{actionenv}}
  \renewenvironment<>{quote}{\begin{actionenv}#1\begin{originalquote}}{\end{originalquote}\end{actionenv}}
}

    
%
% Bibliography code
%
\newenvironment{thebibliography}[1]
{%\leavevmode\unskip%
  \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\beamer@biblabeltemplate{\@biblabel{#1}}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \itemsep=0pt%
            \partopsep=0pt%
            \topsep=0pt%
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}
            \let\makelabel\beamer@biblabeltemplate}%
      \sloppy\raggedright
      \clubpenalty10000
      \@clubpenalty \clubpenalty
      \widowpenalty10000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \ifhmode\unskip\fi\endlist}

\long\def\beamer@biblabeltemplate#1{\def\insertbiblabel{#1}\biblabeltemplate\hfil}

\def\bibitem{\@ifnextchar<{\beamer@bibitem@store}{\gdef\beamer@bibstore{}\beamer@plainbibitem}}
\def\beamer@bibitem@store<#1>{\gdef\beamer@bibstore{<#1>}\beamer@plainbibitem}
\def\beamer@plainbibitem{\@ifnextchar[\@lbibitem\beamer@bibitem}
\def\@lbibitem[#1]#2{\expandafter\item\beamer@bibstore[\@biblabel{#1}\hfill]%
  \@ifundefined{beamerbib@#2@\the\c@framenumber}{\if@filesw
    {\let\protect\noexpand
      \immediate
      \write\@auxout{\string\bibcite{#2}{\noexpand\hyperlink{beamerbib#2}{#1}}}}\fi%
    \global\@namedef{beamerbib@#2@\the\c@framenumber}{\relax}%
    \hypertarget{beamerbib#2}{}%
    }{}%
  \def\newblock{\@newblock}\newblock%
  \hbox{}\ignorespaces}
\def\beamer@bibitem#1{\@bibitem{#1}\ignorespaces}
\def\@bibitem#1{\expandafter\item\beamer@bibstore\@ifundefined{beamerbib@#1@\the\c@framenumber}%
  {\if@filesw \immediate\write\@auxout
    {\string\bibcite{#1}{\noexpand\hyperlink{beamerbib#1}{\the\value{\@listctr}}}}\fi%
    \global\@namedef{beamerbib@#1@\the\c@framenumber}{\relax}%
    \hypertarget{beamerbib#1}{}}%
  {}%
  \def\newblock{\@newblock}\newblock}

\def\@newblock{\firstblocktemplate%
  \def\newblock{\secondblocktemplate%
    \def\newblock{\thirdblocktemplate%
      \def\newblock{\otherblocktemplate}}}%
  \leavevmode\setbox\beamer@tempbox=\hbox{}\ht\beamer@tempbox=1.5em\box\beamer@tempbox}

\long\def\usebibitemtemplate#1{%
  \def\biblabeltemplate{#1}}

\long\def\usebibliographyblocktemplate#1#2#3#4{%
  \def\firstblocktemplate{#1}%
  \def\secondblocktemplate{#2}%
  \def\thirdblocktemplate{#3}%
  \def\otherblocktemplate{#4}}

\beamertemplatearticlebibitems
\usebibliographyblocktemplate
  {\color{beamerstructure}}
  {\par\color{black}}
  {\par\color{beamerstructure!65}}
  {\par\color{beamerstructure!65}}


\mode
<article>
{
  \AtBeginDocument{
    \renewcommand<>{\bibitem}{\beameroriginal{\bibitem}}%should actually suppress
  }
}

  

%
% Floats and tables
%

\newenvironment{figure}[1][]{%
  \def\@captype{figure}%
  \par\nobreak\begin{center}\nobreak}
  {\par\nobreak\end{center}}
\newcounter{figure}
\renewcommand\thefigure{\@arabic\c@figure}

\newenvironment{table}[1][]{%
  \def\@captype{table}%
  \par\nobreak\begin{center}\nobreak}
  {\par\nobreak\end{center}\nobreak}
\newcounter{table}
\renewcommand\thetable{\@arabic\c@table}

\newlength\abovecaptionskip
\newlength\belowcaptionskip
\setlength\abovecaptionskip{7pt}
\setlength\belowcaptionskip{7pt}

\def\caption{
  \ifx\@captype\@undefined
    \@latex@error{\noexpand\caption outside figure or table}\@ehd
    \expandafter\@gobble
 \else
   \refstepcounter\@captype
   \expandafter\@firstofone
 \fi
 {\@dblarg{\@caption\@captype}}%
}
\long\def\@caption#1[#2]#3{% second argument ignored
  \par\nobreak
  \begingroup
    \@parboxrestore
    \if@minipage
      \@setminipage
    \fi
    \normalsize
    \beamer@makecaption{#1}{\ignorespaces #3}\par\nobreak
    \endgroup}
\long\def\beamer@makecaption#1#2{%
  \def\insertcaptionname{\csname#1name\endcsname}%
  \def\insertcaptionnumber{\csname the#1\endcsname}%
  \def\insertcaption{#2}%
  \nobreak\vskip\abovecaptionskip\nobreak
  \sbox\@tempboxa{\beamer@captiontemplate}%
  \ifdim \wd\@tempboxa >\hsize
    \beamer@captiontemplate\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \nobreak\vskip\belowcaptionskip\nobreak}

\long\def\usecaptiontemplate#1{%
  \def\beamer@captiontemplate{#1}}
\usecaptiontemplate{%
  {\small\structure{\insertcaptionname:} \insertcaption}}


\mode
<all>


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