-\def\hack@thm#1#2{%
- \expandafter\def\expandafter#1\expandafter{#1%
- \let\thmhead\thmhead@margin%
- \thm@headfont{\thm@headfont@margin}%
- \thm@headpunct{}%
- \advance\thm@postskip-\parskip%
- \def\after@thm{#2}%
+\def\proofstyle#1{{\thm@headfont@margin#1}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\th@base}
+% \begin{macro}{\@endtheorem}
+%
+% The |\th@base| macro provides the basis for our theorem style. The
+% argument is something to do at the end of the environment.
+%
+% \begin{macrocode}
+\def\th@base#1{%
+ \let\thmhead\thmhead@margin%
+ \thm@headfont{\thm@headfont@margin}%
+ \thm@headpunct{}%
+ \advance\thm@postskip-\parskip%
+ \@qedhack%
+ \def\after@thm{#1}%
+ \normalfont%
+}
+% \end{macrocode}
+%
+% Ah, but nobody actually does anything with |\after@thm|. Let's fix that.
+%
+% \begin{macrocode}
+\AtEndOfPackage{\def\@endtheorem{\after@thm\endtrivlist}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\th@plain}
+% \begin{macro}{\th@definition}
+% \begin{macro}{\th@remark}
+%
+% Now this is easy. The space hacking in |\th@remark| is straight from
+% \package{amsthm}.
+%
+% \begin{macrocode}
+\AtBeginDocument{
+ \def\th@plain{\th@base\relax\itshape}
+ \def\th@definition{\th@base\qed}
+ \def\th@remark{%
+ \th@base\qed%
+ \thm@preskip\topsep\divide\thm@preskip\tw@%
+ \thm@postskip\thm@preskip%