% ----------------------------------------------------------------------
%  \newproof{type}{text}(style)[post]:
%  Define a new type of unnumbered ``theorem'' environment.  The last
%  two arguments are optional; most environments will not use them.
%
%  To change label style, put new style command in label:
%       \newproof{comment}{\sf Comment}
% ----------------------------------------------------------------------
\def\newproof#1#2{\@ifnextchar({\@snproof{#1}{#2}}{\@snproof{#1}{#2}(\rm)}}
\def\@snproof#1#2(#3){\@ifnextchar[{\@xnproof{#1}{#2}{#3}}
                                   {\@xnproof{#1}{#2}{#3}[]}}

\def\@xnproof#1#2#3[#4]{%\expandafter\@ifdefinable\csname #1\endcsname
{\global\@namedef{#1}{\@prf{#2}{#3}}\global\@namedef{end#1}{\@endprf{#4}}}}

\def\@prf#1#2{\@ifnextchar[{\@xprf{#1}{#2}}{\@yprf{#1}{#2}}}
\def\@xprf#1#2[#3]{\@yprf{#1\ (#3)}{#2}}
\def\@yprf#1#2{\begin{trivlist}\item[\hskip\labelsep{\bf\boldmath #1:}]#2}

\def\@endprf#1{#1\end{trivlist}}

%
%  Official solution environment.
%
\newsavebox{\solnbox}
\newlength{\solnwidth}
\newenvironment{soln}%
{\setlength{\solnwidth}{\linewidth}
\addtolength{\solnwidth}{-2\fboxsep}\addtolength{\solnwidth}{-2\fboxrule}
\par\nobreak\begin{lrbox}{\solnbox}\begin{minipage}[t]{\solnwidth}
\mbox{{\em Answer:\ \ }}\small\parindent=1pc\noindent\ignorespaces}
{\end{minipage}\end{lrbox}\medskip\noindent\fbox{\usebox{\solnbox}}\bigbreak}

%
%  This is much better!
%
\newproof{solution}{Solution}[\markatright{$\blacksquare$}]
\newenvironment{Solution}{\normalsize\rm\begin{solution}\parindent1em}
{\end{solution}}

%
%  \hidesolutions does just what it sounds like.
%
\RequirePackage{verbatim}
\def\hidesolutions{\let\soln\comment\let\endsoln\endcomment
\let\solution\comment\let\endsolution\endcomment} 

