The procdefs package^{∗}

Andrew D. Lewis

1998/04/13

1 Using the procdefs macros

The term “proc” means “proclamation” and I use this term to mean things like theorems, lemmas, definitions, etc. In procdefs I have set up a bunch a macros and environments which make for easier handling of certain chores along these lines.

1.1 Files loaded by procdefs

procdefs loads the internal packages qedtheorem and thmytools. These should not concern you, unless you dislike the theorem style I use (I shall permit this — many do not). In this latter case, you should specify the option plain which will use the standard theorem style, and you can choose the other standard options as normal. qedtheorem makes some hacks to the standard theorem environment in order that it work properly with the proof environment I will describe below. Also loaded are amssymb (to get the right symbols for “QED”) and xspace which is used internally in the proof macros.

A package which is loaded which has actual user functionality is proclist which is documented separately.

This documentation includes the implementation of procdefs.sty, qedtheorem.sty,

and thmytools.sty.

1.2 New theorem environments defined

The most basic thing which procdefs does is define a bunch of new theorem environments. These are all numbered together (i.e., Lemma 2 will follow Theorem 1, even if there is no Lemma 1) and are reset in every chapter if you are using the book document class (more precisely, if \chapter is defined) and in every section otherwise. If you select the option sections, then numbers will be reset with every section, even when \chapter is defined. If you select the option eqnum then the theorems will be numbered with the equations. I find this useful in long documents with few numbered equations, but many numbered theorems. If you select the separatenumbering option, proclamation environments (theorems, definitions, lemmas, etc.) will be numbered independently.

∗This file has version number v1.0c, last revised 1998/04/13.

Some of the theorem environments are typeset with the body of the environment being italicised. These are: theorem, proposition, lemma, sublemma, corollary, claim, conjecture, and thesis The remaining environments use ro-

man font in their body: definition, remark, remarks, example, counterexample,
notation, question, assumption, assumptions, axiom, axioms, postulate, and

postulates. Some people like to have the equations in roman if the theorem is in italics. If you like this, use the romaneqns option. You can also specify the italiceqns option if you want normal fonts in your equations within the italic

\defn theorems. This is the default. There is also a command \defn which takes a single

argument. You can use this when you want to define a term.

\theoremheaderfont The header of the theorem environments is set via the \theoremheaderfont macro which has a single argument setting the font. The default is \normalfont\scshape. If you happen to have the package smallcap installed, the default header font is then \normalfont\scfamily\bfseries since this package makes this make sense. When these font options becomes available to L^{A}TEX in general, the bold small caps will be default. If you are also using the floatlib package, an attempt will be made to make the caption font match the theorem header font. So if you set either of these by hand (see the floatlib documentation for how to do this there) you might see some warning messages indicating font mismatches. If you see more than one such message, heed only the last one which might say everything is OK. If you want a different font for theorem headers and captions, ignore all such messages.

Sometimes one wishes to add a description to a theorem. The font in which

\theoremdescriptionfont such a description appears is specified by the \theoremdescriptionfont macro.

prooflemma A special environment is prooflemma. I use this when I am in a proof and I wish to use a few lemmas which I will not need to refer to outside the proof. The lemmas are numbered starting at 1 inside the proof. The lemmas may be labelled and referenced as usual. There is a similar environment proofsublemma.

procnonum Another environment which you may find useful is procnonum (proclamations with no numbers). Typing

     \begin{procnonum}[Theorem:]
     Let\/ $F:S^2\rightarrow R^2$ be continuous.  Then there exists\/
     $x\in R^2$ so that\/ $f(x)=f(-x)$\@.
     \end{procnonum}

will give you

Theorem: Let F : S^{2} → R^{2} be continuous. Then there exists x ∈ R^{2} so that f(x) = f(−x).

procnunum* If you want the body font to be roman, use procnunum*. If you don’t add anything

in brackets ([]), then you will get no header of any sort.

procname The “opposite” of procnonum is procname. Use this environment when you want a number, but you want to specify the name yourself. The syntax is, for example,

     \begin{procname}{Zorn's Lemma}[Equivalent to Axiom of Choice]
     If every chain in a partially ordered set has an upper bound
     in the set, then the set contains a maximal element.\end{procname}

The result will be something like

2.1 Zorn’s Lemma: (Equivalent to Axiom of Choice) If every chain in a partially ordered set has an upper bound in the set, then the set contains a maximal element.

procname* If you want the body to be in roman, use the procname* environment.

1.3 The proof environment

proof procdefs provides a fairly sophisticated proof environment. From the point of view of user interaction, however, it is quite straightforward. Most of the time one can simply type the proof within the environment and everything looks OK. As a tip, I have found that the following arrangement leads to better spacing between the theorem and the proof:

     \begin{theorem}

Statement of theorem.

     \begin{proof}

Proof goes here.

     \end{proof}
     \end{theorem}

Of course, this works with any of the other theorem-like environments.

\qedsymbol The symbol for the end of the proof is defined by \qedsymbol. The default is

\blacksquare which is a solid square.

subproof There are also environments subproof and proofidea. The former is disproofidea tinguished by having the QED symbol defined by \subqedsymbol (default is

\subqedsymbol \blacktriangledown — a solid triangle pointing down). The latter starts off “Idea of Proof” rather than “Proof”. If you want to customise the header of the proof use the syntax

     \begin{proof}[your-text]

The font used for the words “Proof”, “Subproof”, and “Idea of Proof” are in

\proofheaderfont the font \proofheaderfont whose default value is {\normalfont\sffamily}.

When one ends a proof with an equation, this can lead to complications with the QED symbol appearing on the next page by itself, etc. To get around this,

\eqqed use the command \eqqed at the same point you would usually use \tag for the

equation which ends the proof. The QED symbol will then be placed on the

\eqsubqed same line as the equation. There is also a \eqsubqed macro for the subproof environment. To use these macros you need to load amsmath (as you probably will have anyway). It is not automatically loaded to avoid option clashes.

For the theorem environments which use a roman body font, it is sometimes nice to use a symbol to mark the end of the statement since the font will likely \oprocend match the font being used in the text. I use \oprocend (other proclamation

ending) to do this. Simply place it at the end of the environment. As with the proof environment, perhaps you may wish to end one of these environments

\eqoprocend with an equation. In this, case, use \eqoprocend just like you’d use \eqqed. \oprocendsymbol The symbol for \oprocend is defined by \oprocendsymbol whose default value is

\bullet — a hollow square. You can also give \oprocend an optional argument, \oprocend[altsym], if you want to use a different symbol. Here altsym will be placed in math mode.

If you are writing conference papers with silly low page limits, you may want to compress space before and after your theorems. To do this, load procdefs with the squeeze option.

1.4 The mytools theorem style

As mentioned above, if you wish to use the standard styles which come with the theorem package, load procdefs with the plain option. However, I was not all that obsessed with any of the available theorem styles, so I made one of my own. The basic layout will look something like

2.3 Theorem: (Example theorem) Let F : S^{2} → R^{2} be continuous. Then there exists x ∈ R^{2} so that f(x) = f(−x).

if you type

     \begin{theorem}[Example theorem]
     Let\/ $F:S^2\rightarrow R^2$ be continuous.  Then there exists\/
     $x\in R^2$ so that\/ $f(x)=f(-x)$\@.
     \end{theorem}

Note the font and the location of the number.

If you would like to define yourself a new theoremstyle, you may use thmytools.sty as a pattern. You should probably know a bit of L^{A}TEX before embarking on this path. But if you choose to do so, to load your new style type

     \newtheoremstyle{mystyle}
     \theoremstyle{mystyle}

in the document preamble.

2 Implementation

We give documentation for procdefs.sty, thmytools.sty, and qedtheorem.sty,

in that order.

1 ⟨∗package⟩

Declare the roman font shape options.

2

 3 \def\@ADL@eq@procnums{\z@}

 4 \def\@ADL@loadplain{\z@}
 5 \def\@ADL@procsecs{\z@}
 6 \def\@ADL@sepprocs{\z@}
 7 \DeclareOption{romaneqns}{\def\@ADL@@rmeqns{\@ne}}
 8 \DeclareOption{italiceqns}{\def\@ADL@@rmeqns{\z@}}
 9 \DeclareOption{eqnum}{\def\@ADL@eq@procnums{\@ne}}
10 \DeclareOption{plain}{\def\@ADL@loadplain{\@ne}}
11 \DeclareOption{squeeze}{\def\@ADL@squeeze{\@ne}}
12 \DeclareOption{sections}{\def\@ADL@procsecs{\@ne}}
13 \DeclareOption{separatenumbering}{\def\@ADL@sepprocs{\@ne}}
14 \def\@ADL@squeeze{\z@}
15 \ExecuteOptions{italiceqns}
16 \ProcessOptions
Load the packages amssymb, xspace, proclist, and qedtheorem. If smallcap

exists, load it as well.

17

18 \RequirePackage[psamsfonts]{amssymb}
19 \RequirePackage{xspace,proclist,qedtheorem}
20 \ifnum\@ADL@loadplain=\z@
21 \IfFileExists{smallcap.sty}{\RequirePackage{smallcap}}{}
22 \fi

Make it possible to define a theorem style mytools and do so if the plain option is not set. I have to make some kludges here to allow new style types. If you want to design your own style type, you’ll need to understand what’s going on here…

23

24 \ifnum\@ADL@loadplain=\z@
25 \def\newtheoremstyle#1{\@namedef{th@#1}%
26  {\@input@{th#1.sty}}}
27 \let\@ADL@extheoremstyle\theoremstyle
28 \def\theoremstyle#1{\@ADL@extheoremstyle{#1}\th@mytools}
29 \newtheoremstyle{mytools}
30 \theoremstyle{mytools}
31 \else

If we are using plain, then define the extra theorem environments so these losers can use them (hey, I count myself among them sometimes). First do procnonum

and procnonum*.

32

33 \def\procnonum{\trivlist \@topsep \theorempreskipamount
34 \@topsepadd \theorempostskipamount
35 \ifnum\@ADL@@rmeqns=\@ne\everymath={\eqrmhack}
36 \everydisplay={\eqrmhack\let\textrm\@ADL@rmhacktextrm}\fi\normalfont\itshape
37 \@ifnextchar[{\@ADL@xprocnonum}{\@ADL@yprocnonum}}
38 \def\endprocnonum{\endtrivlist}
39 \def\@ADL@xprocnonum[#1]{\item[\hskip \labelsep{\theorem@headerfont #1}]
40 \normalfont\rmfamily\itshape}
41 \def\@ADL@yprocnonum{\item[] \normalfont\rmfamily\itshape}
42 \@namedef{procnonum*}{\trivlist \@topsep \theorempreskipamount
43 \@topsepadd \theorempostskipamount

44 \@ifnextchar[{\@ADL@xprocnonumstar}{\@ADL@yprocnonumstar}}
45 \@namedef{endprocnonum*}{\endtrivlist}
46 \def\@ADL@xprocnonumstar[#1]{\item[\hskip \labelsep{\theorem@headerfont #1}]
47 \normalfont\rmfamily}
48 \def\@ADL@yprocnonumstar{\item[] \normalfont\rmfamily}

The procname and procname* environments.

49

50 \def\procname#1{\refstepcounter{theorem}%
51 \trivlist \@topsep \theorempreskipamount
52 \@topsepadd \theorempostskipamount
53 \ifnum\@ADL@@rmeqns=\@ne\everymath={\eqrmhack}
54 \everydisplay={\eqrmhack\let\textrm\@ADL@rmhacktextrm}\fi\normalfont\itshape
55 \@ifnextchar[{\@ADL@xprocname{#1}{\thetheorem}}%
56  {\@ADL@yprocname{#1}{\thetheorem}}}
57 \def\@ADL@xprocname#1#2[#3]{%
58 \item[\hskip\labelsep \theorem@headerfont #1\ #2\
59 {\normalfont\rmfamily(#3)}]\ignorespaces%
60 \normalfont\rmfamily\itshape}
61 \def\@ADL@yprocname#1#2{%
62 \item[\hskip\labelsep \theorem@headerfont #1\ #2]\ignorespaces%
63 \normalfont\rmfamily\itshape}
64 \def\endprocname{\endtrivlist}
65 \@namedef{procname*}{\@ADL@procnamestar}
66 \def\@ADL@procnamestar#1{\refstepcounter{theorem}%
67 \trivlist \@topsep \theorempreskipamount
68 \@topsepadd \theorempostskipamount
69 \@ifnextchar[{\@ADL@xprocnamestar{#1}{\thetheorem}}%
70  {\@ADL@yprocnamestar{#1}{\thetheorem}}}
71 \def\@ADL@xprocnamestar#1#2[#3]{%
72 \item[\hskip\labelsep \theorem@headerfont #1\ #2\
73 {\normalfont\rmfamily(#3)}]\ignorespaces%
74 \normalfont\rmfamily}
75 \def\@ADL@yprocnamestar#1#2{%
76 \item[\hskip\labelsep \theorem@headerfont #1\ #2]\ignorespaces%
77 \normalfont\rmfamily}
78 \@namedef{endprocname*}{\endtrivlist}
79 \fi

This is the font for things like “2.3 Theorem”. Also, change the definition of \theoremheaderfont so that it doesn’t complain if you try to redefine it… Also fix things up with floatlib if possible. We specify a bold header font if this is

available. Define \theoremdescriptionfont.

80

81 \def\theoremheaderfont#1{\def\theorem@headerfont{#1}%
82 \@ifundefined{@ADLfloat@captionfont}{\relax}
83 {\ifx\theorem@headerfont\@ADLfloat@captionfont%
84 \PackageWarning{procdefs}{Theorem header and caption fonts OK}\else
85 \PackageWarning{procdefs}{Font mismatch in theorem headers and captions}
86 \fi}}

 87 \def\theoremdescriptionfont#1{\def\theorem@descriptionfont{#1}}

88

 89 \ifnum\@ADL@loadplain=\z@
 90 \IfFileExists{smallcap.sty}%
 91  {\def\theorem@headerfont{\normalfont\scfamily\bfseries}}
 92  {\def\theorem@headerfont{\normalfont\scshape}}
 93 \def\theorem@descriptionfont{\normalfont\rmfamily}
 94 \fi

The first thing we define is the actual theorem environment. This also defines the counter to be used by the rest of the environments. We check to see if we are using a document class which defines \chapter. The first environments we get are those with italic body font. With the italic body font theorems, check to see if romaneqns has been selected. At this point we also look to see if the eqnum option has been selected, and if it has, we number theorems with equations.

95

 96 \ifnum\@ADL@eq@procnums=\@ne
 97 \def\@ADL@proc@countername{equation}
 98 \else
 99 \def\@ADL@proc@countername{theorem}
100 \fi
101 \def\@ADL@rmimath{{\normalfont\textrm{\i}}}
102 \def\@ADL@rmjmath{{\normalfont\textrm{\j}}}
103 \let\@ADL@textrm\textrm
104 \def\@ADL@rmhacktextrm#1{\@ADL@textrm{\everymath={\eqrmhack}#1}}
105 \def\eqrmhack{\let\imath\@ADL@rmimath\let\jmath\@ADL@rmjmath\rm}
106 {\ifnum\@ADL@@rmeqns=\@ne
107 \theorembodyfont{\everymath={\eqrmhack}%
108 \everydisplay={\eqrmhack\let\textrm\@ADL@rmhacktextrm}\normalfont\itshape}
109 \fi
110 \@ifundefined{chapter}{%
111 \def\@ADL@procsecs{\@ne}}{}
112 \ifnum\@ADL@procsecs=\@ne
113 \def\@ADL@numthmwithin{section}
114 \ifnum\@ADL@eq@procnums=\@ne
115  \newtheorem{theorem}[\@ADL@proc@countername]{Theorem}
116 \else
117  \newtheorem{theorem}{Theorem}[section]
118 \fi
119 \else
120 \def\@ADL@numthmwithin{chapter}
121 \ifnum\@ADL@eq@procnums=\@ne
122  \newtheorem{theorem}[\@ADL@proc@countername]{Theorem}
123 \else
124  \newtheorem{theorem}{Theorem}[chapter]
125 \fi
126 \fi

127

128 \ifnum\@ADL@sepprocs=\@ne
129 \newtheorem{proposition}{Proposition}[\@ADL@numthmwithin]

130 \newtheorem{lemma}{Lemma}[\@ADL@numthmwithin]
131 \newtheorem{sublemma}{Sublemma}[\@ADL@numthmwithin]
132 \newtheorem{corollary}{Corollary}[\@ADL@numthmwithin]
133 \newtheorem{claim}{Claim}[\@ADL@numthmwithin]
134 \newtheorem{conjecture}{Conjecture}[\@ADL@numthmwithin]
135 \newtheorem{thesis}{Thesis}[\@ADL@numthmwithin]

Here are the environments with roman body font.

136

137 {\theorembodyfont{\normalfont\rmfamily}
138 \newtheorem{axiom}{Axiom}[\@ADL@numthmwithin]
139 \newtheorem{axioms}[\@ADL@proc@countername]{Axioms}
140 \newtheorem{postulate}{Postulate}[\@ADL@numthmwithin]
141 \newtheorem{postulates}[\@ADL@proc@countername]{Postulates}
142 \newtheorem{definition}{Definition}[\@ADL@numthmwithin]
143 \newtheorem{remark}{Remark}[\@ADL@numthmwithin]
144 \newtheorem{remarks}{Remarks}[\@ADL@numthmwithin]
145 \newtheorem{example}{Example}[\@ADL@numthmwithin]
146 \newtheorem{examples}{Examples}[\@ADL@numthmwithin]
147 \newtheorem{counterexample}{Counterexample}[\@ADL@numthmwithin]
148 \newtheorem{notation}{Notation}[\@ADL@numthmwithin]
149 \newtheorem{problem}{Problem}[\@ADL@numthmwithin]
150 \@ifundefined{problems}{%
151 \newtheorem{problems}{Problems}[\@ADL@numthmwithin]}{\relax}
152 \newtheorem{question}{Question}[\@ADL@numthmwithin]
153 \newtheorem{assumption}{Assumption}[\@ADL@numthmwithin]
154 \newtheorem{assumptions}{Assumptions}[\@ADL@numthmwithin]}

The prooflemma and proofsublemma environments. Their counters get reset inside every theorem environment. It is probably broken with the separatenumbering option.

155

156 \newtheorem{prooflemma}{Lemma}[\@ADL@proc@countername]
157 \newtheorem{proofsublemma}{Sublemma}[\@ADL@proc@countername]}
158 \renewcommand\theprooflemma{\arabic{prooflemma}}
159 \renewcommand\theproofsublemma{\arabic{proofsublemma}}

160

161 \else

162

163 \newtheorem{proposition}[\@ADL@proc@countername]{Proposition}
164 \newtheorem{lemma}[\@ADL@proc@countername]{Lemma}
165 \newtheorem{sublemma}[\@ADL@proc@countername]{Sublemma}
166 \newtheorem{corollary}[\@ADL@proc@countername]{Corollary}
167 \newtheorem{claim}[\@ADL@proc@countername]{Claim}
168 \newtheorem{conjecture}[\@ADL@proc@countername]{Conjecture}
169 \newtheorem{thesis}[\@ADL@proc@countername]{Thesis}

The prooflemma and proofsublemma environments. Their counters get reset inside every theorem environment.

170

171 \newtheorem{prooflemma}{Lemma}[\@ADL@proc@countername]

172 \newtheorem{proofsublemma}{Sublemma}[\@ADL@proc@countername]}
173 \renewcommand\theprooflemma{\arabic{prooflemma}}
174 \renewcommand\theproofsublemma{\arabic{proofsublemma}}

Here are the environments with roman body font.

175

176 {\theorembodyfont{\normalfont\rmfamily}
177 \newtheorem{axiom}[\@ADL@proc@countername]{Axiom}
178 \newtheorem{axioms}[\@ADL@proc@countername]{Axioms}
179 \newtheorem{postulate}[\@ADL@proc@countername]{Postulate}
180 \newtheorem{postulates}[\@ADL@proc@countername]{Postulates}
181 \newtheorem{definition}[\@ADL@proc@countername]{Definition}
182 \newtheorem{remark}[\@ADL@proc@countername]{Remark}
183 \newtheorem{remarks}[\@ADL@proc@countername]{Remarks}
184 \newtheorem{example}[\@ADL@proc@countername]{Example}
185 \newtheorem{examples}[\@ADL@proc@countername]{Examples}
186 \newtheorem{counterexample}[\@ADL@proc@countername]{Counterexample}
187 \newtheorem{notation}[\@ADL@proc@countername]{Notation}
188 \newtheorem{problem}[\@ADL@proc@countername]{Problem}
189 \@ifundefined{problems}{%
190 \newtheorem{problems}[\@ADL@proc@countername]{Problems}}{\relax}
191 \newtheorem{question}[\@ADL@proc@countername]{Question}
192 \newtheorem{assumption}[\@ADL@proc@countername]{Assumption}
193 \newtheorem{assumptions}[\@ADL@proc@countername]{Assumptions}}
194 \fi
195 \newcommand\defn[1]{{\normalfont\bfseries%
196 \ifnum\@ADL@@rmeqns=\@ne\everymath={\eqrmhack}\fi%
197 \emph{\mathversion{bold}#1}}}

Define the default fonts and the default QED, etc. symbols. Also define the expressions that will make up the proof headers. In other words, define all the things which are variable in the proof environment.

198

199 \newcommand\proofheaderfont[1]{\def\@ADL@proofheaderfont{#1}}
200 \proofheaderfont{\normalfont\sffamily}
201 \newcommand\prooffont[1]{\def\@ADL@prooffont{#1}}
202 \prooffont{\normalfont\rmfamily\everymath={\relax}\everydisplay={\relax}}
203 \newcommand\qed{\protect\@ADL@qed{$\@ADL@qedsymbol$}}
204 \newcommand\subqed{\protect\@ADL@subqed{$\@ADL@subqedsymbol$}}
205 \newcommand\ideaqed{\protect\@ADL@ideaqed{$\@ADL@ideaqedsymbol$}}
206 \newcommand\oprocend{\@ifnextchar[
207 {\@ADL@altsymoprocend}{\@ADL@normsymoprocend}}
208 \def\@ADL@altsymoprocend[#1]{\@ADLsave@set@oprocend
209 \protect\@ADL@oprocend{$#1$}\@ADLrestore@oprocend}
210 \newcommand\@ADL@normsymoprocend{\@ADLsave@set@oprocend
211 \protect\@ADL@oprocend{$\@ADL@oprocendsymbol$}\@ADLrestore@oprocend}
212 \newcommand\pushright{\protect\@ADL@pushright}
213 \newcommand\qedsymbol[1]{\def\@ADL@qedsymbol{#1}}
214 \qedsymbol{\blacksquare}
215 \newcommand\subqedsymbol[1]{\def\@ADL@subqedsymbol{#1}}

216 \subqedsymbol{\blacktriangledown}
217 \newcommand\ideaqedsymbol[1]{\def\@ADL@ideaqedsymbol{#1}}
218 \ideaqedsymbol{\blacksquare}
219 \newcommand\oprocendsymbol[1]{\def\@ADL@oprocendsymbol{#1}}
220 \oprocendsymbol{\bullet}
221 \newcommand\@ADL@prooftitle[1]{{\@ADL@proofheaderfont #1:\/}}
222 \newcommand\thewordproof{\@ADL@prooftitle{Proof}}
223 \newcommand\thewordsubproof{\@ADL@prooftitle{Proof}}
224 \newcommand\thewordideaproof{\@ADL@prooftitle{Idea of Proof}}

Here’s the meat of the proof and like environments. The basic idea is that you need to check where you are so you can decide what to do with the QED symbol. If you are already at the end of a line, then the environment has to figure this out and shove the symbol to the end of the next line. The big decisions are made by

 \@ADLparag@pushright and \@ADLhbox@pushright. It’s wordy as I do it for the

four possible ways to end a proclamation.

225

226 \newcommand\@ADLparag@pushright[1]{{\parfillskip=0pt\widowpenalty=10000%
227 \displaywidowpenalty=10000\finalhyphendemerits=0\@ADLhbox@pushright#1\par}}
228 \newcommand\@ADLhbox@pushright{\unskip\nobreak\hfil\penalty50\hskip.2em%
229 \null\hfill\hfill}
230 \newif\if@ADL@qed\@ADL@qedfalse
231 \newif\if@ADL@subqed\@ADL@subqedfalse
232 \newif\if@ADL@ideaqed\@ADL@ideaqedfalse
233 \newif\if@ADL@oprocend\@ADL@oprocendfalse
234 \newcommand\@ADLsave@set@qed{\let\@ADLsaved@ifqed
235 \if@ADL@qed\global\@ADL@qedtrue}
236 \newcommand\@ADLsave@set@subqed{\let\@ADLsaved@ifsubqed
237 \if@ADL@subqed\global\@ADL@subqedtrue}
238 \newcommand\@ADLsave@set@ideaqed{\let\@ADLsaved@ifideaqed\if@ADL@ideaqed%
239 \global\@ADL@ideaqedtrue}
240 \newcommand\@ADLsave@set@oprocend{\let\@ADLsaved@ifoprocend\if@ADL@oprocend%
241 \global\@ADL@oprocendtrue}
242 \newcommand\@ADLrestore@qed{\global\let\if@ADL@qed\@ADLsaved@ifqed}
243 \newcommand\@ADLrestore@subqed{\global\let\if@ADL@subqed\@ADLsaved@ifsubqed}
244 \newcommand\@ADLrestore@ideaqed{\global\let\if@ADL@ideaqed\@ADLsaved@ifideaqed}
245 \newcommand\@ADLrestore@oprocend{\global
246 \let\if@ADL@oprocend\@ADLsaved@ifoprocend}
247 \newenvironment{proof}{\@ifnextchar[{\@ADL@proofname}{\@ADL@proof}}
248 {\qed\@ADLrestore@qed\endtrivlist}
249 \def\@ADL@proofname[#1]{\trivlist\item[\hskip\labelsep\@ADL@prooftitle{#1}]%
250 \@ADLsave@set@qed\@ADL@prooffont}
251 \newcommand\@ADL@proof{\trivlist\item[\hskip\labelsep\thewordproof]%
252 \@ADLsave@set@qed\xspace\@ADL@prooffont}
253 \newenvironment{subproof}{\trivlist\item[\hskip\labelsep\thewordsubproof]%
254 \@ADLsave@set@subqed\@ADL@prooffont}
255 {\subqed\@ADLrestore@subqed\endtrivlist}
256 \newenvironment{proofidea}{\trivlist\item[\hskip\labelsep\thewordideaproof]%
257 \@ADLsave@set@ideaqed\@ADL@prooffont}
258 {\ideaqed\@ADLrestore@ideaqed\endtrivlist}

259 \newcommand\@ADL@qed[1]{\if@ADL@qed\global\@ADL@qedfalse%
260 \pushright{#1}\else\ifhmode\ifinner\else\par\fi\fi\fi}
261 \newcommand\@ADL@subqed[1]{\if@ADL@subqed\global\@ADL@subqedfalse%
262 \pushright{#1}\else\ifhmode\ifinner\else\par\fi\fi\fi}
263 \newcommand\@ADL@ideaqed[1]{\if@ADL@ideaqed\global\@ADL@ideaqedfalse%
264 \pushright{#1}\else\ifhmode\ifinner\else\par\fi\fi\fi}
265 \newcommand\@ADL@oprocend[1]{\if@ADL@oprocend\global\@ADL@oprocendfalse%
266 \pushright{#1}\else\ifhmode\ifinner\else\par\fi\fi\fi}
267 \newcommand\@ADL@pushright[1]{{\ifvmode\null\hfill{#1}\par\else\ifmmode%
268 \@ADLmaths@pushright{\hbox{#1}}\else\ifinner\@ADLhbox@pushright{#1}%
269 \else\@ADLparag@pushright{#1}\fi\fi\fi}}
270 \newcommand\@ADLmaths@pushright[1]{{\ifinner\@ADLhbox@pushright{#1}\else%
271 \tag*{$#1$}\fi}}

Now for the equation proclamation endings. What happens here depends on whether we have asked amsmath to use left or right equation numbers.

272

273 \newdimen\@ADL@qedwidth
274 \newdimen\@ADL@qedskip

275

276 \newcommand\eqqed{\iftagsleft@\@ADL@lefteqqed\else\@ADL@righteqqed\fi}
277 \newcommand\@ADL@lefteqqed{\tag*{\settowidth\@ADL@qedwidth{$\@ADL@qedsymbol$}%
278 \setlength\@ADL@qedskip\displaywidth%
279 \addtolength{\@ADL@qedskip}{-\@ADL@qedwidth}%
280 \hskip\@ADL@qedskip\qed$\@ADL@qedsymbol$}}
281 \newcommand\@ADL@righteqqed{\tag*{\qed}}

282

283 \newcommand\eqsubqed{\iftagsleft@\@ADL@lefteqsubqed\else\@ADL@righteqsubqed\fi}
284 \newcommand\@ADL@lefteqsubqed{%
285 \tag*{\settowidth\@ADL@qedwidth{$\@ADL@subqedsymbol$}%
286 \setlength\@ADL@qedskip\displaywidth%
287 \addtolength{\@ADL@qedskip}{-\@ADL@qedwidth}%
288 \hskip\@ADL@qedskip\subqed$\@ADL@subqedsymbol$}}
289 \newcommand\@ADL@righteqsubqed{\tag*{\subqed}}

290

291 \newcommand\eqoprocend{\iftagsleft@\@ADL@lefteqoprocend\else%
292 \@ADL@righteqoprocend\fi}
293 \newcommand\@ADL@lefteqoprocend{\tag*%
294 {\settowidth\@ADL@qedwidth{$\@ADL@oprocendsymbol$}%
295 \setlength\@ADL@qedskip\displaywidth
296 \addtolength{\@ADL@qedskip}{-\@ADL@qedwidth}%
297 \hskip\@ADL@qedskip\@ADL@qed{$\@ADL@oprocendsymbol$}$\@ADL@oprocendsymbol$}}
298 \newcommand\@ADL@righteqoprocend{\tag*{\oprocend}}

These commands should be used in the preamble only.

299

300 \@onlypreamble\newtheoremstyle
301 \@onlypreamble\theoremstyle

302

303 ⟨/package⟩

Now for the thmytools theorem style definitions.

304 ⟨∗thmytools⟩

305

306 \begingroup \makeatletter
307 \@ifundefined{theorem@style}{\input{theorem.sty}}{}
308 \ProvidesFile{thmytools.sty}
309  [\ADLthminfo]
310 \gdef\th@mytools{\normalfont\itshape
311 \def\@begintheorem##1##2{%
312 \item[\hskip\labelsep\theorem@headerfont##2\space##1:]}%
313 \def\@opargbegintheorem##1##2##3{%
314 \item[\hskip\labelsep\theorem@headerfont##2\space##1:]%
315 {\theorem@descriptionfont(##3)\space}}

Lower skips if we are using squeeze.

316

317 \global\setlength\theorempreskipamount{6pt plus 2.5pt minus 1.5pt}
318 \global\setlength\theorempostskipamount{4pt plus 1.5pt minus 0.75pt}
 The procnonum and procnonum* environments.

319

320 \def\procnonum{\trivlist \@topsep \theorempreskipamount
321 \@topsepadd \theorempostskipamount
322 \ifnum\@ADL@@rmeqns=\@ne\everymath={\eqrmhack}
323 \everydisplay={\eqrmhack\let\textrm\@ADL@rmhacktextrm}\normalfont\itshape\fi
324 \@ifnextchar[{\@ADL@xprocnonum}{\@ADL@yprocnonum}}
325 \def\endprocnonum{\endtrivlist}
326 \def\@ADL@xprocnonum[##1]{\item[\hskip\labelsep{\theorem@headerfont##1:}]
327 \normalfont\rmfamily\itshape}
328 \def\@ADL@yprocnonum{\item[]\normalfont\rmfamily\itshape}
329 \@namedef{procnonum*}{\trivlist \@topsep \theorempreskipamount
330 \@topsepadd \theorempostskipamount
331 \@ifnextchar[{\@ADL@xprocnonumstar}{\@ADL@yprocnonumstar}}
332 \@namedef{endprocnonum*}{\endtrivlist}
333 \def\@ADL@xprocnonumstar[##1]{\item[\hskip\labelsep{\theorem@headerfont##1:}]
334 \normalfont\rmfamily}
335 \def\@ADL@yprocnonumstar{\item[]\normalfont\rmfamily}

The procname and procname* environments.

336

337 \def\procname##1{\refstepcounter{theorem}%
338 \trivlist \@topsep \theorempreskipamount
339 \@topsepadd \theorempostskipamount
340 \ifnum\@ADL@@rmeqns=\@ne\everymath={\eqrmhack}
341 \everydisplay={\eqrmhack\let\textrm\@ADL@rmhacktextrm}\normalfont\itshape\fi
342 \@ifnextchar[{\@ADL@xprocname{##1}{\thetheorem}}%
343  {\@ADL@yprocname{##1}{\thetheorem}}}
344 \def\@ADL@xprocname##1##2[##3]{%
345 \item[\hskip\labelsep\theorem@headerfont##2\space##1:\space]
346 {\normalfont\rmfamily(##3)space}\ignorespaces%
347 \normalfont\rmfamily\itshape}

348 \def\@ADL@yprocname##1##2{%
349 \item[\hskip\labelsep\theorem@headerfont##2\space##1:]\ignorespaces%
350 \normalfont\rmfamily\itshape}
351 \def\endprocname{\endtrivlist}
352 \@namedef{procname*}{\@ADL@procnamestar}
353 \def\@ADL@procnamestar##1{\refstepcounter{theorem}%
354 \trivlist \@topsep \theorempreskipamount
355 \@topsepadd \theorempostskipamount
356 \@ifnextchar[{\@ADL@xprocnamestar{##1}{\thetheorem}}%
357  {\@ADL@yprocnamestar{##1}{\thetheorem}}}
358 \def\@ADL@xprocnamestar##1##2[##3]{%
359 \item[\hskip\labelsep\theorem@headerfont##2\space##1:\space]
360 {\normalfont\rmfamily(##3)\space}\ignorespaces%
361 \normalfont\rmfamily}
362 \def\@ADL@yprocnamestar##1##2{%
363 \item[\hskip\labelsep\theorem@headerfont##2\space##1:]\ignorespaces%
364 \normalfont\rmfamily}
365 \@namedef{endprocname*}{\endtrivlist}

366 }

367 \endgroup

368

369 ⟨/thmytools⟩

Now for the hacks to the theorem environment so as to be in concert with the proof environment.

370 ⟨∗qedtheorem⟩

371

372 \ProvidesPackage{qedtheorem}
373  [\ADLthminfo]
374 \RequirePackage{theorem}
375 \def\@ADLnonqed@thm#1#2{\refstepcounter{#1}%
376 \trivlist
377 \@topsep \theorempreskipamount               % used by first \item
378 \@topsepadd \theorempostskipamount           % used by \@endparenv
379 \@ifnextchar [%
380 {\@ythm{#1}{#2}}%
381 {\@begintheorem{#2}{\csname the#1\endcsname}\ignorespaces}}
382 \let\@ADLnonqed@endthm=\endtrivlist
383 \renewcommand\@thm{\@ADLsave@set@qed\@ADLnonqed@thm}
384 \renewcommand\@endtheorem{\@ADLrestore@qed\@ADLnonqed@endthm}

385

386 ⟨/qedtheorem⟩