3 % $Id: mdwthm.dtx,v 1.1 2002/02/03 20:49:03 mdw Exp $
5 % Standard theorem typesetting
7 % (c) 2001 Mark Wooding
9 %----- Revision history -----------------------------------------------------
11 % $Log: mdwthm.dtx,v $
12 % Revision 1.1 2002/02/03 20:49:03 mdw
13 % Checkin for new build system.
18 % \begin{meta-comment} <general public licence>
20 %% mdwthm package -- standard theorem stuff
21 %% Copyright (c) 2001 Mark Wooding
23 %% This program is free software; you can redistribute it and/or modify
24 %% it under the terms of the GNU General Public License as published by
25 %% the Free Software Foundation; either version 2 of the License, or
26 %% (at your option) any later version.
28 %% This program is distributed in the hope that it will be useful,
29 %% but WITHOUT ANY WARRANTY; without even the implied warranty of
30 %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 %% GNU General Public License for more details.
33 %% You should have received a copy of the GNU General Public License
34 %% along with this program; if not, write to the Free Software Foundation,
35 %% Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
38 % \begin{meta-comment} <Package preambles>
39 %<+package>\NeedsTeXFormat{LaTeX2e}
40 %<+package>\ProvidesPackage{mdwthm}
41 %<+package> [2001/09/16 1.0 theorem typesetting]
42 %<+thmstyle>\ProvidesFile{mdwmargin.thm}
43 %<+thmstyle> [2001/09/16 1.0 numbers-in-the-margin theorem style]
48 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
49 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
50 %% Digits \0\1\2\3\4\5\6\7\8\9
51 %% Exclamation \! Double quote \" Hash (number) \#
52 %% Dollar \$ Percent \% Ampersand \&
53 %% Acute accent \' Left paren \( Right paren \)
54 %% Asterisk \* Plus \+ Comma \,
55 %% Minus \- Point \. Solidus \/
56 %% Colon \: Semicolon \; Less than \<
57 %% Equals \= Greater than \> Question mark \?
58 %% Commercial at \@ Left bracket \[ Backslash \\
59 %% Right bracket \] Circumflex \^ Underscore \_
60 %% Grave accent \` Left brace \{ Vertical bar \|
61 %% Right brace \} Tilde \~}
64 % \begin{meta-comment}
68 \describespackage{mdwthm}
74 %^^A-------------------------------------------------------------------------
75 % \section{User guide}
77 % \subsection{Environments provided}
79 % \DescribeEnv{theorem}
81 % \DescribeEnv{proposition}
82 % \DescribeEnv{corollary}
83 % \DescribeEnv{definition}
84 % \DescribeEnv{example}
86 % \DescribeEnv{remark}
88 % The package defines a collection of theorem environments, declared in the
89 % usual way. All of them except \env{claim} share the same counter. If the
90 % document class has a |\chapter| command, then they are numbered within the
91 % chapter; otherwise there is a single numbering system throughout the
94 % Every environment has a $*$-version, which doesn't print a number. This
95 % might be useful every now and then.
97 % The environments \env{theorem}, \env{lemma}, \env{proposition},
98 % \env{claim}and \env{corollary} are set using the `plain' style, with the
99 % body text in \textit{italics}. The environments \env{definition} and
100 % \env{example} are set in the `definition' style, with body text in roman.
101 % The remaining environments, \env{fact}, \env{remark}, and \env{note} are
102 % set in the `remark' style.
104 % \DescribeEnv{claim}
105 % \DescribeEnv{proof}
106 % The \env{claim} environment has its own counter, which is reset at the
107 % beginning of the \env{proof} environment.
109 % \subsection{The \package{mdwmargin} style}
111 % This package also provides a pretty `number-hanging-in-the-margin' theorem
112 % style collection, available under the name \env{mdwmargin}.
117 %^^A-------------------------------------------------------------------------
118 % \section{Implementation of the environments}
122 \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{amsthm}}
123 \ProcessOptions\relax
124 \RequirePackage{amsthm}
127 % \subsection{The simple bits}
129 % \begin{environment}{theorem}
131 % Do the right thing with the numbering rules.
134 \toks@{\newtheorem{theorem}{Theorem}}
136 \ifx\if@article\iftrue\@tempswafalse\fi
137 \ifx\chapter\@@undefined\@tempswafalse\fi
138 \if@tempswa\toks@\expandafter{\the\toks@[chapter]}\fi
140 \newtheorem*{theorem*}{Theorem}
145 % \begin{environment}{lemma}
146 % \begin{environment}{proposition}
147 % \begin{environment}{corollary}
148 % \begin{environment}{claim}
149 % \begin{environment}{definition}
150 % \begin{environment}{example}
151 % \begin{environment}{fact}
152 % \begin{environment}{remark}
154 % Most of this is very easy.
158 \newtheorem{lemma}[theorem]{Lemma}
159 \newtheorem*{lemma*}{Lemma}
160 \newtheorem{proposition}[theorem]{Proposition}
161 \newtheorem*{proposition*}{Proposition}
162 \newtheorem{corollary}[theorem]{Corollary}
163 \newtheorem*{corollary*}{Corollary}
164 \newtheorem{fact}[theorem]{Fact}
165 \newtheorem*{fact*}{Fact}
166 \newtheorem{claim}{Claim}
167 \newtheorem*{claim*}{Claim}
171 \theoremstyle{definition}
172 \newtheorem{definition}[theorem]{Definition}
173 \newtheorem*{definition*}{Definition}
174 \newtheorem{example}[theorem]{Example}
175 \newtheorem*{example*}{Example}
179 \theoremstyle{remark}
180 \newtheorem{remark}[theorem]{Remark}
181 \newtheorem*{remark*}{Remark}
193 % \begin{environment}{note}
195 % Someone else might also have a \env{note} environment. Be careful.
198 \ifx\note\@@undefined
199 \newtheorem{note}[theorem]{Note}
200 \newtheorem*{note*}{Note}
206 % \begin{environment}{proof}
208 % Now to hack the proof environment.
211 \renewenvironment{proof}[1][\proofname]{%
212 \setcounter{claim}{0}%
214 \trivlist\advance\itemindent\labelsep\let\makelabel\textit%
215 \advance\@topsep-\parskip%
216 \advance\@topsepadd-\parskip%
231 %^^A-------------------------------------------------------------------------
232 % \section{Implementation of the theorem style}
238 % \begin{macro}{\thmhead@margin}
240 % Firstly, a macro to typeset the theorem environment header, with the number
244 \def\thmhead@margin#1#2#3{%
245 \thmnumber{\llap{#2{\normalsize\quad}}}%
247 \thmnote{ \the\thm@notefont(#3)}%
252 % \begin{macro}{\thm@headfont@margin}
254 % Now to decide on the header font. Definitely we want boldface; if the
255 % documentclass (or \package{mdwfonts}) has decided on a different font
256 % family for the headings, then we use that.
259 \def\thm@headfont@margin{%
261 \ifx\headdefault\@@undfined\else\fontfamily\headdefault\fi%
267 % \begin{macro}{\qedsymbol}
269 % Use the nice symbol if available.
272 \AtBeginDocument{\ifx\square\@@undefined\else\def\qedsymbol{$\square$}\fi}
276 % \begin{macro}{\hack@thm}
278 % Now we hack the standard theorem styles to do what we want. This is a
279 % tedious enough game with |\expandafter|.
283 \expandafter\def\expandafter#1\expandafter{#1%
284 \let\thmhead\thmhead@margin%
285 \thm@headfont{\thm@headfont@margin}%
287 \advance\thm@postskip-\parskip%
291 \def\@endtheorem{\after@thm\endtrivlist\@endpefalse}
294 \hack@thm\th@definition{\qed}
295 \hack@thm\th@remark{\qed}
300 % \hfill Mark Wooding, \today