%%
%% This is file `lwarp-ntheorem.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% lwarp.dtx  (with options: `ntheorem')
%% This is a generated file.
%% Copyright 2016-2017 Brian Dunn
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.

\DeclareOption{thref}{}

\newbool{LWR@ntheoremmarks}
\boolfalse{LWR@ntheoremmarks}

\DeclareOption{thmmarks}{
\booltrue{LWR@ntheoremmarks}
\newif\ifsetendmark\setendmarktrue
}

\newbool{LWR@ntheoremamsthm}
\boolfalse{LWR@ntheoremamsthm}

\DeclareOption{amsthm}{\booltrue{LWR@ntheoremamsthm}}

\DeclareOption{amsmath}{}
\DeclareOption{hyperref}{}

\LWR@ProvidesPackagePass{ntheorem}
\newcommand{\LWR@newtheoremstyle}{plain}
\gdef\theoremstyle#1{%
   \@ifundefined{th@#1}{\@warning
          {Unknown theoremstyle `#1'. Using `plain'}%
          \theorem@style{plain}
            \renewcommand{\LWR@newtheoremstyle}{plain}% new
}%
      {
\theorem@style{#1}
        \renewcommand{\LWR@newtheoremstyle}{#1}% new
}
}


\gdef\@xnthm#1#2[#3]{%
  \ifthm@tempif
     \csedef{LWR@thmstyle#1}{\LWR@newtheoremstyle}% new
     \expandafter\@ifundefined{c@#1}%
        {\@definecounter{#1}}{}%
     \@newctr{#1}[#3]%
     \expandafter\xdef\csname the#1\endcsname{%
       \expandafter\noexpand\csname the#3\endcsname \@thmcountersep
          {\noexpand\csname\the\theoremnumbering\endcsname{#1}}}%
     \expandafter\gdef\csname mkheader@#1\endcsname
       {\csname setparms@#1\endcsname
        \@thm{#1}{#1}{#2}
}%
     \global\@namedef{end#1}{\@endtheorem}
     \AtBeginEnvironment{#1}{\edef\LWR@thisthmstyle{\csuse{LWR@thmstyle#1}}}% new
  \fi
}

\gdef\@ynthm#1#2{%
  \ifthm@tempif
     \csedef{LWR@thmstyle#1}{\LWR@newtheoremstyle}% new
     \expandafter\@ifundefined{c@#1}%
        {\@definecounter{#1}}{}%
     \expandafter\xdef\csname the#1\endcsname
        {\noexpand\csname\the\theoremnumbering\endcsname{#1}}%
     \expandafter\gdef\csname mkheader@#1\endcsname
       {\csname setparms@#1\endcsname
        \@thm{#1}{#1}{#2}
}%
     \global\@namedef{end#1}{\@endtheorem}
     \AtBeginEnvironment{#1}{\edef\LWR@thisthmstyle{\csuse{LWR@thmstyle#1}}}% new
  \fi
}

\gdef\@othm#1[#2]#3{%
  \@ifundefined{c@#2}{\@nocounterr{#2}}%
   {\ifthm@tempif
     \csedef{LWR@thmstyle#1}{\LWR@newtheoremstyle}% new
     \global\@namedef{the#1}{\@nameuse{the#2}}%
     \expandafter\protected@xdef\csname num@addtheoremline#1\endcsname{%
              \noexpand\@num@addtheoremline{#1}{#3}}%
     \expandafter\protected@xdef\csname nonum@addtheoremline#1\endcsname{%
              \noexpand\@nonum@addtheoremline{#1}{#3}}%
    \theoremkeyword{#3}%
    \expandafter\protected@xdef\csname #1Keyword\endcsname
             {\the\theoremkeyword}%
     \expandafter\gdef\csname mkheader@#1\endcsname
       {\csname setparms@#1\endcsname
                \@thm{#1}{#2}{#3}
}%
     \global\@namedef{end#1}{\@endtheorem}
     \AtBeginEnvironment{#1}{\edef\LWR@thisthmstyle{\csuse{LWR@thmstyle#1}}}% new
  \fi}
}
\newcommand{\LWR@inctheorem}{%
\addtocounter{LWR@thisfloat}{1}%
\LWR@stoppars%
\LWR@htmltag{a id="autofloat-\arabic{LWR@thisfloat}"{}}\LWR@htmltag{/a}%
\LWR@startpars%
}
\gdef\newtheoremstyle#1#2#3{%
  \expandafter\@ifundefined{th@#1}%
   {\expandafter\gdef\csname th@#1\endcsname{%
    \def\@begintheorem####1####2{%
\LWR@forcenewpage% new
\BlockClass{theorembody#1}%\LWR@thisthmstyle% new
\LWR@inctheorem% new
#2}%
    \def\@opargbegintheorem####1####2####3{%
\LWR@forcenewpage% new
\BlockClass{theorembody#1}%\LWR@thisthmstyle% new
\LWR@inctheorem% new
#3}%
}%
}%
{\PackageError{\basename}{Theorem style #1 already defined}\@eha}
}

\renewtheoremstyle{plain}%
  {\item[\hskip\labelsep \theorem@headerfont
\InlineClass{theoremheaderplain}{##1\ ##2\theorem@separator}]}%
  {\item[\hskip\labelsep \theorem@headerfont
\InlineClass{theoremheaderplain}{##1\ ##2\ (##3)\theorem@separator}]}

\renewtheoremstyle{break}%
  {\item[
\hskip\labelsep \theorem@headerfont
\InlineClass{theoremheaderbreak}{##1\ ##2\theorem@separator}\newline
]}%
  {\item[
\hskip\labelsep \theorem@headerfont
\InlineClass{theoremheaderbreak}{##1\ ##2\ (##3)\theorem@separator}\newline
]}

\renewtheoremstyle{change}%
  {\item[\hskip\labelsep
\theorem@headerfont
\InlineClass{theoremheaderchange}{##2\ ##1\theorem@separator}]}%
  {\item[\hskip\labelsep
\theorem@headerfont
\InlineClass{theoremheaderchange}{##2\ ##1\ (##3)\theorem@separator}]}

\renewtheoremstyle{changebreak}%
  {\item[
\hskip\labelsep \theorem@headerfont
\InlineClass{theoremheaderchangebreak}{##2\ ##1\theorem@separator}\newline
]}%
  {\item[
\hskip\labelsep \theorem@headerfont
\InlineClass{theoremheaderchangebreak}{##2\ ##1\ (##3)\theorem@separator}\newline
]}

\renewtheoremstyle{margin}%
  {\item[\hskip\labelsep\theorem@headerfont
\InlineClass{theoremheadermargin}{##2 \qquad ##1\theorem@separator}
]}%
  {\item[\hskip\labelsep\theorem@headerfont
\InlineClass{theoremheadermargin}{##2 \qquad ##1\ (##3)\theorem@separator}
]}

\renewtheoremstyle{marginbreak}%
  {\item[\hskip\labelsep\theorem@headerfont
\InlineClass{theoremheadermarginbreak}{##2 \qquad ##1\theorem@separator}\newline
]}%
  {\item[\hskip\labelsep\theorem@headerfont
\InlineClass{theoremheadermarginbreak}{##2 \qquad ##1\ (##3)\theorem@separator}\newline
]}

\renewtheoremstyle{nonumberplain}%
  {\item[\theorem@headerfont\hskip\labelsep
\InlineClass{theoremheaderplain}{##1\theorem@separator}]}%
  {\item[\theorem@headerfont\hskip \labelsep
\InlineClass{theoremheaderplain}{##1\ (##3)\theorem@separator}]}

\renewtheoremstyle{nonumberbreak}%
  {\item[
\hskip\labelsep \theorem@headerfont
\InlineClass{theoremheaderbreak}{##1\theorem@separator}\newline
]}%
  {\item[
\hskip\labelsep \theorem@headerfont
\InlineClass{theoremheaderbreak}{##1\ (##3)\theorem@separator}\newline
]}

\renewtheoremstyle{empty}%
  {\item[]}%
  {\item[\theorem@headerfont \hskip\labelsep\relax
\InlineClass{theoremheaderplain}{##3}]}

\renewtheoremstyle{emptybreak}%
  {\item[]}%
  {\item[\theorem@headerfont \hskip\labelsep\relax
\InlineClass{theoremheaderplain}{##3}] \ \newline}
\ifbool{LWR@ntheoremamsthm}{}{
\newtheoremstyle{plainupright}%
  {\item[\hskip\labelsep \theorem@headerfont
\InlineClass{theoremheaderplain}{##1\ ##2\theorem@separator}]}%
  {\item[\hskip\labelsep \theorem@headerfont
\InlineClass{theoremheaderplain}{##1\ ##2\ (##3)\theorem@separator}]}

\newtheoremstyle{nonumberplainuprightsc}%
  {\item[\theorem@headerfont\hskip\labelsep
\InlineClass{theoremheadersc}{##1\theorem@separator}]}%
  {\item[\theorem@headerfont\hskip \labelsep
\InlineClass{theoremheadersc}{##1\ (##3)\theorem@separator}]}
\theoremstyle{plainupright}
\theorembodyfont{\upshape}
\theoremsymbol{\ensuremath{_\Box}}
\renewtheorem{Example}{Example}
\renewtheorem{example}{Example}
\renewtheorem{Beispiel}{Beispiel}
\renewtheorem{beispiel}{Beispiel}
\renewtheorem{Bemerkung}{Bemerkung}
\renewtheorem{bemerkung}{Bemerkung}
\renewtheorem{Anmerkung}{Anmerkung}
\renewtheorem{anmerkung}{Anmerkung}
\renewtheorem{Remark}{Remark}
\renewtheorem{remark}{Remark}
\renewtheorem{Definition}{Definition}
\renewtheorem{definition}{Definition}

\theoremstyle{nonumberplainuprightsc}
\theoremsymbol{\ensuremath{_\blacksquare}}
\renewtheorem{Proof}{Proof}
\renewtheorem{proof}{Proof}
\renewtheorem{Beweis}{Beweis}
\renewtheorem{beweis}{Beweis}
\qedsymbol{\ensuremath{_\blacksquare}}

\theoremsymbol{}
}% not amsthm
\ifbool{LWR@ntheoremamsthm}{

\gdef\th@plain{%
  \def\theorem@headerfont{\normalfont\bfseries}\itshape%
  \def\@begintheorem##1##2{%
\LWR@forcenewpage% new
\BlockClass{theorembodyplain}% new
\LWR@inctheorem% new
      \item[\hskip\labelsep
  \InlineClass{theoremheaderplain}{##1\ ##2.}
]}%
  \def\@opargbegintheorem##1##2##3{%
\LWR@forcenewpage% new
\BlockClass{theorembodyplain}% new
\LWR@inctheorem% new
     \item[\hskip\labelsep
  \InlineClass{theoremheaderplain}{##1\ ##2\ (##3).}
]}}

\gdef\th@nonumberplain{%
  \def\theorem@headerfont{\normalfont\bfseries}\itshape%
  \def\@begintheorem##1##2{%
\LWR@forcenewpage% new
\BlockClass{theorembodyplain}% new
\LWR@inctheorem% new
      \item[\hskip\labelsep
  \InlineClass{theoremheaderplain}{##1.}
]}%
  \def\@opargbegintheorem##1##2##3{%
\LWR@forcenewpage% new
\BlockClass{theorembodyplain}% new
\LWR@inctheorem% new
     \item[\hskip\labelsep
  \InlineClass{theoremheaderplain}{##1\ (##3).}
]}}

\gdef\th@definition{%
  \def\theorem@headerfont{\normalfont\bfseries}\normalfont%
  \def\@begintheorem##1##2{%
\LWR@forcenewpage% new
\BlockClass{theorembodydefinition}% new
\LWR@inctheorem% new
      \item[\hskip\labelsep
  \InlineClass{theoremheaderdefinition}{##1\ ##2.}
]}%
  \def\@opargbegintheorem##1##2##3{%
\LWR@forcenewpage% new
\BlockClass{theorembodydefinition}% new
\LWR@inctheorem% new
     \item[\hskip\labelsep
  \InlineClass{theoremheaderdefinition}{##1\ ##2\ (##3).}
]}}

\gdef\th@nonumberdefinition{%
  \def\theorem@headerfont{\normalfont\bfseries}\normalfont%
  \def\@begintheorem##1##2{%
\LWR@forcenewpage% new
\BlockClass{theorembodydefinition}% new
\LWR@inctheorem% new
      \item[\hskip\labelsep
  \InlineClass{theoremheaderdefinition}{##1.}
]}%
  \def\@opargbegintheorem##1##2##3{%
\LWR@forcenewpage% new
\BlockClass{theorembodydefinition}% new
\LWR@inctheorem% new
     \item[\hskip\labelsep
  \InlineClass{theoremheaderdefinition}{##1\ (##3).}
]}}

\gdef\th@remark{%
  \def\theorem@headerfont{\itshape}\normalfont%
  \def\@begintheorem##1##2{%
\LWR@forcenewpage% new
\BlockClass{theorembodyremark}% new
\LWR@inctheorem% new
      \item[\hskip\labelsep
  \InlineClass{theoremheaderremark}{##1\ ##2.}
]}%
  \def\@opargbegintheorem##1##2##3{%
\LWR@forcenewpage% new
\BlockClass{theorembodyremark}% new
\LWR@inctheorem% new
     \item[\hskip\labelsep
  \InlineClass{theoremheaderremark}{##1\ ##2\ (##3).}
]}}

\gdef\th@nonumberremark{%
  \def\theorem@headerfont{\itshape}\normalfont%
  \def\@begintheorem##1##2{%
\LWR@forcenewpage% new
\BlockClass{theorembodyremark}% new
\LWR@inctheorem% new
      \item[\hskip\labelsep
  \InlineClass{theoremheaderremark}{##1.}
]}%
  \def\@opargbegintheorem##1##2##3{%
\LWR@forcenewpage% new
\BlockClass{theorembodyremark}% new
\LWR@inctheorem% new
     \item[\hskip\labelsep
  \InlineClass{theoremheaderremark}{##1\ (##3).}
]}}

\gdef\th@proof{%
  \def\theorem@headerfont{\normalfont\bfseries}\itshape%
  \def\@begintheorem##1##2{%
\LWR@forcenewpage% new
\BlockClass{theorembodyproof}% new
\LWR@inctheorem% new
      \item[\hskip\labelsep
  \InlineClass{theoremheaderproof}{##1.}
]}%
  \def\@opargbegintheorem##1##2##3{%
\LWR@forcenewpage% new
\BlockClass{theorembodyroof}% new
\LWR@inctheorem% new
     \item[\hskip\labelsep
  \InlineClass{theoremheaderproof}{##1\ (##3).}
]}}

\newcounter{proof}%
\if@thmmarks
\newcounter{currproofctr}%
\newcounter{endproofctr}%
\fi

\gdef\proofSymbol{\openbox}

\newcommand{\proofname}{Proof}

\newenvironment{proof}[1][\proofname]{
\th@proof
\def\theorem@headerfont{\itshape}%
\normalfont
\theoremsymbol{\ensuremath{_\blacksquare}}
\@thm{proof}{proof}{#1}
}%
{\@endtheorem}

}{}% amsthm option
\let\LWR@origendtheorem\@endtheorem
\renewcommand{\@endtheorem}{%
\ifbool{LWR@ntheoremmarks}{%
\ifsetendmark%
\InlineClass{theoremendmark}{\csname\InTheoType Symbol\endcsname}%
\setendmarkfalse%
\fi%
}{}%
\LWR@origendtheorem%
\ifbool{LWR@ntheoremmarks}{\global\setendmarktrue}{}%
\endBlockClass%
}

\gdef\NoEndMark{\global\setendmarkfalse}

\renewcommand{\thm@@thmline@noname}[4]{%
\hypertocfloat{1}{theorem}{thm}{#2 #3}{}%
}

\renewcommand{\thm@@thmline@name}[4]{%
\hypertocfloat{1}{theorem}{thm}{#1 #2 #3}{}%
}
\def\thm@@thmline{\thm@@thmline@name}

\def\listtheorems#1{
\LWR@htmlelementclass{nav}{lothm}%
\begingroup
\c@tocdepth=-2%
\def\thm@list{#1}\thm@processlist
\endgroup
\LWR@htmlelementclassend{nav}{lothm}%
}


\newcommand{\qed}{\qquad\the\qedsymbol}

\AtBeginDocument{
\def\openbox{\text{\HTMLunicode{25A1}}}% UTF-8 white box
\def\blacksquare{\text{\HTMLunicode{220E}}}% UTF-8 end-of-proof
\def\Box{\text{\HTMLunicode{25A1}}}% UTF-8 white box
}
\newcommand*{\thref}[1]{\cref{#1}}
\endinput
%%
%% End of file `lwarp-ntheorem.sty'.
