%%% ====================================================================
%%%  @LaTeX-file{
%%%     filename        = "thmtest.tex",
%%%     version         = "1.04",
%%%     date            = "29 October 1996",
%%%     time            = "09:43:16 EST",
%%%     checksum        = "02266 246 934 8281",
%%%     author          = "American Mathematical Society",
%%%     copyright       = "Copyright (C) 1996 American Mathematical Society,
%%%                        all rights reserved.  Copying of this file is
%%%                        authorized only if either:
%%%                        (1) you make absolutely no changes to your copy,
%%%                        including name; OR
%%%                        (2) if you do make changes, you first rename it
%%%                        to some other name.",
%%%     address         = "American Mathematical Society,
%%%                        Technical Support,
%%%                        Electronic Products and Services,
%%%                        P. O. Box 6248,
%%%                        Providence, RI 02940,
%%%                        USA",
%%%     telephone       = "401-455-4080 or (in the USA and Canada)
%%%                        800-321-4AMS (321-4267)",
%%%     FAX             = "401-331-3842",
%%%     email           = "tech-support@ams.org (Internet)",
%%%     supported       = "yes",
%%%     keywords        = "latex, amslatex, ams-latex, theorem, proof",
%%%     abstract        = "This is part of the AMS-\LaTeX{} distribution.
%%%                        It is a sample document illustrating the use of
%%%                        the amsthm package.",
%%%     docstring       = "The checksum field above contains a CRC-16
%%%                        checksum as the first value, followed by the
%%%                        equivalent of the standard UNIX wc (word
%%%                        count) utility output of lines, words, and
%%%                        characters.  This is produced by Robert
%%%                        Solovay's checksum utility.",
%%%  }
%%% ====================================================================

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%    Option test file, will be created during the first LaTeX run:
\begin{filecontents}{exercise.thm}
\def\th@exercise{%
  \normalfont % body font
  \thm@headpunct{:}%
}
\end{filecontents}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass{article}
\title{Newtheorem and theoremstyle test}
\author{Michael Downes}

\usepackage[exercise]{amsthm}

\newtheorem{thm}{Theorem}[section]
\newtheorem{cor}[thm]{Corollary}
\newtheorem{prop}{Proposition}
\newtheorem{lem}[thm]{Lemma}

\theoremstyle{remark}
\newtheorem*{rmk}{Remark}

\theoremstyle{plain}
\newtheorem*{Ahlfors}{Ahlfors' Lemma}

\newtheoremstyle{note}% name
  {3pt}%      Space above
  {3pt}%      Space below
  {}%         Body font
  {}%         Indent amount (empty = no indent, \parindent = para indent)
  {\itshape}% Thm head font
  {:}%        Punctuation after thm head
  {.5em}%     Space after thm head: " " = normal interword space;
        %       \newline = linebreak
  {}%         Thm head spec (can be left empty, meaning `normal')

\theoremstyle{note}
\newtheorem{note}{Note}

\newtheoremstyle{citing}% name
  {3pt}%      Space above, empty = `usual value'
  {3pt}%      Space below
  {\itshape}% Body font
  {}%         Indent amount (empty = no indent, \parindent = para indent)
  {\bfseries}% Thm head font
  {.}%        Punctuation after thm head
  {.5em}%     Space after thm head: " " = normal interword space;
        %       \newline = linebreak
  {\thmnote{#3}}% Thm head spec

\theoremstyle{citing}
\newtheorem*{varthm}{}% all text supplied in the note

\newtheoremstyle{break}% name
  {9pt}%      Space above, empty = `usual value'
  {9pt}%      Space below
  {\itshape}% Body font
  {}%         Indent amount (empty = no indent, \parindent = para indent)
  {\bfseries}% Thm head font
  {.}%        Punctuation after thm head
  {\newline}% Space after thm head: \newline = linebreak
  {}%         Thm head spec

\theoremstyle{break}
\newtheorem{bthm}{B-Theorem}

\theoremstyle{exercise}
\newtheorem{exer}{Exercise}

\swapnumbers
\theoremstyle{plain}
\newtheorem{thmsw}{Theorem}[section]
\newtheorem{corsw}[thm]{Corollary}
\newtheorem{propsw}{Proposition}
\newtheorem{lemsw}[thm]{Lemma}

%    Because the amsmath pkg is not used, we need to define a couple of
%    commands in more primitive terms.
\let\lvert=|\let\rvert=|
\newcommand{\Ric}{\mathop{\mathrm{Ric}}\nolimits}

%    Dispel annoying problem of slightly overlong lines:
\addtolength{\textwidth}{8pt}

\begin{document}
\maketitle

\section{Test of standard theorem styles}

Ahlfors' Lemma gives the principal criterion for obtaining lower bounds
on the Kobayashi metric.

\begin{Ahlfors}
Let $ds^2 = h(z)\lvert dz\rvert^2$ be a Hermitian pseudo-metric on
$\mathbf{D}_r$, $h\in C^2(\mathbf{D}_r)$, with $\omega$ the associated
$(1,1)$-form. If $\Ric\omega\geq\omega$ on $\mathbf{D}_r$,
then $\omega\leq\omega_r$ on all of $\mathbf{D}_r$ (or equivalently,
$ds^2\leq ds_r^2$).
\end{Ahlfors}

\begin{lem}[negatively curved families]
Let $\{ds_1^2,\dots,ds_k^2\}$ be a negatively curved family of metrics
on $\mathbf{D}_r$, with associated forms $\omega^1$, \dots, $\omega^k$.
Then $\omega^i \leq\omega_r$ for all $i$.
\end{lem}

Then our main theorem:
\begin{thm}\label{pigspan}
Let $d_{\max}$ and $d_{\min}$ be the maximum, resp.\ minimum distance
between any two adjacent vertices of a quadrilateral $Q$. Let $\sigma$
be the diagonal pigspan of a pig $P$ with four legs.
Then $P$ is capable of standing on the corners of $Q$ iff
\begin{equation}\label{sdq}
\sigma\geq \sqrt{d_{\max}^2+d_{\min}^2}.
\end{equation}
\end{thm}

\begin{cor}
Admitting reflection and rotation, a three-legged pig $P$ is capable of
standing on the corners of a triangle $T$ iff (\ref{sdq}) holds.
\end{cor}

\begin{rmk}
As two-legged pigs generally fall over, the case of a polygon of order
$2$ is uninteresting.
\end{rmk}

\begin{exer}
Generalize Theorem~\ref{pigspan} to three and four dimensions.
\end{exer}

\begin{note}
This is a test of the custom theorem style `note'. It is supposed to have
variant fonts and other differences.
\end{note}

\begin{bthm}
Test of the `linebreak' style of theorem heading.
\end{bthm}

This is a test of a citing theorem to cite a theorem from some other source.

\begin{varthm}[Theorem 3.6 in \cite{thatone}]
No hyperlinking available here yet \dots\ but that's not a
bad idea for the future.
\end{varthm}

\begin{proof}
Here is a test of the proof environment.
\end{proof}

\begin{proof}[Proof of Theorem \ref{pigspan}]
And another test.
\end{proof}

\begin{proof}[Proof (necessity)]
And another.
\end{proof}

\begin{proof}[Proof (sufficiency)]
And another.
\end{proof}

\section{Test of number-swapping}

This is a repeat of the first section but with numbers in theorem heads
swapped to the left.

Ahlfors' Lemma gives the principal criterion for obtaining lower bounds
on the Kobayashi metric.
\begin{Ahlfors}
Let $ds^2 = h(z)\lvert dz\rvert^2$ be a Hermitian pseudo-metric on
$\mathbf{D}_r$, $h\in C^2(\mathbf{D}_r)$, with $\omega$ the associated
$(1,1)$-form. If $\Ric\omega\geq\omega$ on $\mathbf{D}_r$,
then $\omega\leq\omega_r$ on all of $\mathbf{D}_r$ (or equivalently,
$ds^2\leq ds_r^2$).
\end{Ahlfors}

\begin{lemsw}[negatively curved families]
Let $\{ds_1^2,\dots,ds_k^2\}$ be a negatively curved family of metrics
on $\mathbf{D}_r$, with associated forms $\omega^1$, \dots, $\omega^k$.
Then $\omega^i \leq\omega_r$ for all $i$.
\end{lemsw}

Then our main theorem:
\begin{thmsw}
Let $d_{\max}$ and $d_{\min}$ be the maximum, resp.\ minimum distance
between any two adjacent vertices of a quadrilateral $Q$. Let $\sigma$
be the diagonal pigspan of a pig $P$ with four legs.
Then $P$ is capable of standing on the corners of $Q$ iff
\begin{equation}\label{sdqsw}
\sigma\geq \sqrt{d_{\max}^2+d_{\min}^2}.
\end{equation}
\end{thmsw}

\begin{corsw}
Admitting reflection and rotation, a three-legged pig $P$ is capable of
standing on the corners of a triangle $T$ iff (\ref{sdqsw}) holds.
\end{corsw}

\begin{thebibliography}{99}
\bibitem{thatone} Dummy entry.
\end{thebibliography}

\end{document}
