Debian Codegraph @

texmf-dist/tex/latex/ltxmisc/thrmappendix.sty

raw
1 \long\def\comment#1{}
2 \comment{
3 This is my implementation of theorems, lemmas, &c. The main goal is
4 to let you reprint theorems in the appendix with their proofs, so the
5 text isn't cluttered with long proofs, but the reader doesn't have to
6 keep flipping back to the text to find out what you're talking about in
7 the appendix.
8
9 It also has the side benefits that the syntax here involves less typing
10 and fewer redundancies than the default, so I use it even for things
11 that won't ever be proven. Compare the standard:
12
13 \begin{definition} \label{xdef}
14 Let $x$ be a number.
15 \end{definition}
16
17 versus the alternative here:
18
19 \stmt{defn}{xdef}{
20 Let $x$ be a number.
21 }
22
23
24 __________________________________________
25
26 Here is a quick summary of the macros defined in this file:
27 \stmt{statement_type}{label}{This is what I want to say}
28 The definition of a theorem, assumption, &c.
29 \stmtproof{label}{This is the proof.}
30 Where you should write your proof, for use with:
31 \rptstmtwithproof{label}
32 This states the theorem and proof together.
33 \rptstmt{label}
34 This restates just the theorem.
35 \refstmt{label}
36 Prints, e.g., `Theorem 7'---like \ref{label} but you don't have
37 to remember if it's a theorem, corollary, or lemma.
38 \comment{blather}
39 Delineates comments without all those darn percent signs.
40
41 __________________________________________
42 Here is a sample document using most all of the above. You can cut and
43 paste it to another file and compile it to see what it does.
44
45 \documentclass{article}
46 \usepackage{thrmappendix}
47 \begin{document}
48
49 \section{A theorem}
50
51 \stmt{thrm}{sample}{Socrates is mortal.}
52
53 \refstmt{sample} can either be proven using data (the fact that
54 Socrates is dead), or by the proof which is provided in the appendix.
55
56
57
58 \section{Appendix}
59 In this appendix, the reader will find proofs of theorems not given in the text.
60
61 \stmtproof{sample}{Socrates is a man. All men are mortal.}
62
63 \rptstmtwithproof{sample}
64
65 \comment{Notice that you can put the \stmtproof{sample}{...} anywhere
66 you want, including right after your statement, just before using
67 \rptstmtwithproof, or a separate file (then use \input{proofs.tex}). That
68 way, neither your finished paper nor your source will be cluttered with
69 proofs.}
70 \end{document}
71 __________________________________________
72
73
74
75 Here are the definitions of the types of theorems you can use
76 with these commands, and the proof markers:
77 }
78
79 \long\def\theproofmarkersforthrmappendix{
80
81 %Format:
82 %\newtype{nickname}{numbered like}{title}
83
84 %inputs
85 \newtype{ass}{ass}{Assumption}
86 \newtype{defnition}{ass}{Definition}
87 \newtype{defn}{ass}{Definition}
88
89 %outputs
90 \newtype{statement}{statement}{Proposition}
91 \newtype{prop}{statement}{Proposition}
92 \newtype{thrm}{statement}{Theorem}
93 \newtype{corr}{statement}{Corollary}
94 \newtype{lma}{statement}{Lemma}
95 \newtype{guess}{statement}{Conjecture}
96
97
98 \def\pf{{\bf Proof: }}
99 \def\endpf{\hfill $\diamondsuit$}
100 }
101
102 \comment{
103 These are my preferred environments (and numbering scheme);
104 add your own or modify to suit. The format here is:
105 \newtype{nickname}{numbered like}{title}
106
107 E.g., the second line lets me put
108 \stmt{thrm}{mortalityresult}{Socrates is mortal.}
109 in the tex file, since it defined the nickname `thrm'. If the statement
110 counter is up to #7, then the output will be:
111 Theorem 7: Socrates is mortal.
112 since thrms use the statement counter and print `Theorem'. To refer to
113 this theorem in the text, you have two choices:
114 \refstmt{mortalityresult} ===> Theorem 7
115 Theorem \ref{mortalityresult} ===> Theorem 7
116 The first form is nice because after you prove your result, you can
117 change it from a theorem to a conjecture without hunting through the
118 text to fix every reference.
119
120 You can see that all of the results use the `statement' counter and
121 all of the inputs use the `ass' counter. Proposition 1 may be followed
122 by Theorem 2, followed by Corollary 3. This is my preferred numbering
123 scheme, suggested by Paolo Ghirardato. After all, the intent of numbering
124 these things is not to keep score as to how many theorems you've got,
125 but to make it easy for the reader to find what you're referring to;
126 a consistent numbering system facilitates this (especially in a long proof
127 appendix).
128
129 [On the other hand, a referee of one of my papers complained that
130 17 theorems and 18 corollaries was too many, and I could cut that in
131 half. Of course, there were only 18 results total, and s/he was only
132 glancing at the two results on the last page.]
133
134 To use independent numbering for each type, simply change the second field
135 in the definitions above to match the first field in each case. E.g.:
136 \newthrm{thrm}{thrm}{Theorem}
137 will allow you to count theorems separately from other results.
138
139
140 The \rptstmtwithproof macro here will include a marker at the beginning
141 and end of the proof, so you don't have to include them yourself.
142 The macros \pf and \endpf are defined above and can be redefined to
143 suit. Popular endproof markers include:
144
145 \def\endpf{$blackbox$}
146 \def\endpf{$blacklozenge$}
147 \def\endpf{{\sc QED}}
148
149
150 --Ben Klemens, 2 Jan 2003
151 [email protected]
152
153
154
155 PS: thrmappendix.sty (c)2003, Ben Klemens
156 This program is free software; you can redistribute it and/or modify
157 it under the terms of the GNU General Public License as published by
158 the Free Software Foundation; either version 2 of the License, or
159 (at your option) any later version.
160 __________________________________________}
161
162 \usepackage{ifthen}
163 \def\newtype#1#2#3{
164 \ifthenelse{\equal{#1}{#2}}{
165 \long\expandafter\gdef\csname #1txt\endcsname{#3}
166 \long\expandafter\gdef\csname #1ctr\endcsname{#2}
167 \newtheorem{#1}{\csname #1txt\endcsname}
168 }{
169 \long\expandafter\gdef\csname #1txt\endcsname{#3}
170 \long\expandafter\gdef\csname #1ctr\endcsname{#2}
171 \newtheorem{#1}[\csname #1ctr\endcsname]{\csname #1txt\endcsname}
172 }}
173
174 \theproofmarkersforthrmappendix %from the user-readable section above.
175
176 \def\cs#1{\csname #1\endcsname}
177 \newcounter{dummycounter}
178
179 \long\def\defstmt#1#2#3{
180 }
181
182 \long\def\stmt#1#2#3{
183 \long\expandafter\gdef\csname #2\endcsname{#3}
184 \expandafter\gdef\csname #2type\endcsname{#1}
185 \begin{#1} \label{#2}
186 {#3}
187 \end{#1}
188 \immediate\write\@mainaux{\string
189 \newlabel{#2type}{{\cs{#1txt}}}
190 }
191 }
192
193 \long\def\stmtproof#1#2{
194 \long\expandafter\gdef\csname #1proof\endcsname{#2}
195 }
196
197 \long\def\rptstmt#1{
198 \def\ctr{\cs{\cs{#1type}ctr}}
199 % \setcounter{paragraph}{\value{\ctr}}
200 \setcounter{dummycounter}{\value{\ctr}}
201 \batchmode
202 \setcounter{\ctr}{\ref{#1}}
203 \errorstopmode
204 \addtocounter{\ctr}{-1}
205 \begin{\cs{#1type}}
206 \cs{#1}
207 \end{\cs{#1type}}
208 \setcounter{\ctr}{\value{dummycounter}}
209 }
210
211 \long\def\rptstmtwithproof#1{
212 \rptstmt{#1}
213
214 \pf \cs{#1proof} \endpf
215 }
216
217 \def\refstmt#1{\ref{#1type} \ref{#1}}