%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Theorems, Examples, ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\usepackage{ntheorem}

\makeatletter

\newtheoremstyle{DBPrem}%
  {\item[\theorem@headerfont  ##1\theorem@separator]}%
  {\item[\theorem@headerfont  ##1\ (##3)\theorem@separator]}

\def\shim#1{\hskip#1pt\relax}

\newtheoremstyle{DBP4}%
  {\item[\hbox to5.5pt{\hss$<$##2$>$\shim{20}}\theorem@headerfont  ##1\theorem@separator]}%
  {\item[\hbox to6pt{\hss$<$##2$>$\shim{21}}\theorem@headerfont  ##1\ [##3]\theorem@separator]}

\newtheoremstyle{named}%
  {\item[\hbox to5.5pt{\hss$<$##2$>$\shim{20}}\theorem@headerfont  ##1\theorem@separator]}%
  {\item[\hbox to6pt{\hss$<$##2$>$\shim{21}}\theorem@headerfont  ##1\ [##3]\theorem@separator]}




\theoremstyle{DBP4}
\theoremseparator{.}
\theoremheaderfont{\normalfont\bfseries}
%\theoremheaderfont{\sc} %commented out 9 nov09
\theorembodyfont{\itshape}
\newtheorem{theorem}[equation]{Theorem}
%\newtheorem{theorem}[equation]{$|$Theorem}  % for testing

\newtheorem{definition}[equation]{Definition}
\newtheorem{lemma}[equation]{Lemma}
\newtheorem{corollary}[equation]{Corollary}
\newtheorem{assumption}[equation]{Assumption}

\newcommand{\thmname}{\relax}
\newtheorem{named}[equation]{\thmname}

\theorembodyfont{\normalfont}

\newtheorem{example}[equation]{Example}
\newtheorem{exercise}[equation]{Exercise}


\theoremstyle{DBPrem}
\theoremindent2em
\theorembodyfont{\small}
\newtheorem{remark}{Remark}
\newtheorem{remarks}{Remarks}


\theoremindent0pt

%\theoremheaderfont{\sc}
\theoremheaderfont{\scshape}
\theorembodyfont{\upshape}
\theoremstyle{nonumberplain}
\theoremseparator{}
\theoremsymbol{\rule{1ex}{1ex}}
\newtheorem{proof}{Proof}
\newtheorem{solution}{{\scshape Solution:}}


%\def\Remark{\begin{remark}\rightskip=3em plus2em minus2pt}
\def\Remark{% 15 aug 2014
	\vskip-\lastskip\smallskip
	\begin{remark}\rightskip=3em plus2em minus2pt}
\def\endRemark{\end{remark}}

\def\Remarks{\begin{remarks}\rightskip=3em plus2em minus2pt}
\def\endRemarks{\end{remarks}}

\def\Corollary{\begin{corollary}}
\def\endCorollary{\end{corollary}}

\def\Definition{\begin{definition}}
\def\endDefinition{\end{definition}}

\def\Theorem{\begin{theorem}}
\def\endTheorem{\end{theorem}}

\def\NamedTheorem{\begin{theorem}}
\def\endNamedTheorem{\end{theorem}}

\def\Lemma{\begin{lemma}}
\def\endLemma{\end{lemma}}

\def\Assumption{\begin{assumption}}
\def\endAssumption{\end{assumption}}

\def\Example{\begin{example}}
%\def\endExample{\end{example}}
\def\endExample{\noindent\vadjust{\llap{\qedsymbol\qquad}}\end{example}}

\def\Exercise{\begin{exercise}}
%\def\endExample{\end{example}}
\def\endExercise{\noindent\vadjust{\llap{\qedsymbol\qquad}}\end{exercise}}


%\def\Proof{\begin{proof}}
%31 aug 2014: 
\def\Proof{%
	\vskip-\lastskip\smallskip
	\begin{proof}}
\def\endProof{\end{proof}}

\def\Solution{\begin{solution}}
\def\endSolution{\end{solution}}

\def\mnote#1{\marginpar{\par\tiny#1}}
\def\msymbol#1{\marginpar{\par\tiny#1}}


\def\qed@{\ifmmode{\square}\else{$\square$}\fi}
\let\qedsymbol=\qed@
\def\endProof{\noindent\vadjust{\llap{\qedsymbol\qquad}}\end{proof}}


\makeatother
