%%
%% This is file `xtheorem.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xtheorem.dtx  (with options: `package,trace')
%% 
%% Not for distribution
%%
%% (C) Copyright 1999 Achim Blumensath
%% All rights reserved.
%%
%% Not for general distribution. In its present form it is not allowed
%% to put this package onto CD or an archive without consulting the
%% the authors.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{xtheorem}
          [1999/12/19 v0.1 theorem styles]
\RequirePackage{xparse}
\RequirePackage{template}

\IgnoreWhiteSpace
\DeclareTemplateType{theoremstyle}{3}

\newskip\TSpre@skip
\newskip\TSpost@skip
\newdimen\TShead@indent
\newskip\TShead@sep

\DeclareTemplate{theoremstyle}{std}{3}
{
  pre-skip    =l  [\DelayEvaluation{\topsep}]     \TSpre@skip,
  post-skip   =l  [\DelayEvaluation{\topsep}]     \TSpost@skip,
  body-style  =f0 [\itshape]                      \TSbody@style,
  head-style  =f0 [\bfseries]                     \TShead@style,
  note-style  =f0 [\fontseries\mddefault\upshape] \TSnote@style,
  head-punct  =f0 [.]                             \TShead@punct,
  head-format =f3 [\IfNoValueF{#1}{#1\IfNoValueF{#2}{\space}}
                   \IfNoValueF{#2}{\textup{#2}}
                   \IfNoValueF{#3}{\space{\TSnote@style(#3)}}]
                                                  \TShead@format,
  head-indent      =l  [0pt]                      \TShead@indent,
  head-sep         =l  [5pt plus 1pt minus 1pt]   \TShead@sep,
  post-head-action =f0 []                         \TSpost@head@action
}
{
  \DoParameterAssignments
  \ifhmode\unskip\unskip\par\fi
  \normalfont
  \trivlist
  \let\thmheadnl\relax
  \@topsep\TSpre@skip
  \@topsepadd\TSpost@skip
  \IfNoValueF{#1}
    {\refstepcounter{#1}}
  \deferred@thm@head{
    \TShead@style
    \hskip\TShead@indent
    \IfNoValueTF{#1}
      {\TShead@format{#2}{#1}{#3}}
      {\TShead@format{#2}{\csname the#1\endcsname}{#3}}
    \TShead@punct
    \TSpost@head@action
    \hskip\TShead@sep
  }
  \TSbody@style
  \ignorespaces
}
\let\adjust@parskip@nobreak=\@nbitem
\newtoks\dth@everypar
\dth@everypar={
  \@minipagefalse
  \global\@newlistfalse
  \if@inlabel
    \global\@inlabelfalse
    \begingroup
      \setbox\z@\lastbox
      \ifvoid\z@ \kern-\itemindent \fi
    \endgroup
    \unhbox\@labels
  \fi
  \if@nobreak
    \@nobreakfalse
    \clubpenalty\@M
  \else
    \clubpenalty\@clubpenalty
    \everypar{}
  \fi
}
\def\deferred@thm@head#1{%
  \if@inlabel \indent \par \fi % eject a section head if one is pending
  \if@nobreak
    \adjust@parskip@nobreak
  \else
    \addpenalty\@beginparpenalty
    \addvspace\@topsep
    \addvspace{-\parskip}%
  \fi
  \global\@inlabeltrue
  \everypar\dth@everypar
  \sbox\@labels{\normalfont#1}%
  \ignorespaces
}
\DeclareInstance{theoremstyle}{plain}{std}{}

\DeclareInstance{theoremstyle}{definition}{std}
{
  body-style = \normalfont
}

\DeclareInstance{theoremstyle}{remark}{std}
{
  pre-skip   = \DelayEvaluation{0.5\topsep},
  post-skip  = \DelayEvaluation{0.5\topsep},
  body-style = \normalfont,
  head-style = \itshape
}
\def\@endtheorem{\endtrivlist\@endpefalse }
\DeclareDocumentCommand{\newtheorem}{smmomo}
{
  \expandafter\@ifdefinable\csname #3\endcsname
  {
    \global\expandafter\let\csname end#3\endcsname\@endtheorem
    \IfBooleanTF{#1}
    {
      \expandafter\DeclareDocumentCommand\csname #3\endcsname{o}
        {\UseInstance{theoremstyle}{#2}{\NoValue}{#5}{##1}}
    }
    {
      \IfNoValueTF{#4}
      {
        \IfNoValueTF{#6}
        {
          \newcounter{#3}
        }
        {
          \newcounter{#3}[#6]
          \expandafter\xdef\csname the#3\endcsname{
            \expandafter\noexpand\csname the#6\endcsname
            \@thmcountersep\@thmcounter{#3}}
        }
        \expandafter\DeclareDocumentCommand\csname #3\endcsname{o}
          {\UseInstance{theoremstyle}{#2}{#3}{#5}{##1}}
      }
      {
        \@ifundefined{c@#4}
        {
          \@nocounterr{#4}
        }
        {
          \expandafter\xdef\csname the#3\endcsname{
            \expandafter\noexpand\csname the#4\endcsname}
          \expandafter\DeclareDocumentCommand\csname #3\endcsname{o}
            {\UseInstance{theoremstyle}{#2}{#4}{#5}{##1}}
        }
      }
    }
  }
}
\endinput
%%
%% End of file `xtheorem.sty'.
