3 \ifcat a\noexpand @\let\next\relax\else \def\next{%
4 \documentclass{kluwer}\usepackage{doc}\MakePercentIgnore}\fi\next
5 \def\filedate{1998/03/13}
6 \def\filename{klumath.sty}
7 %\DoNotIndex{\@M,\def,\c@secnumdepth,\baselineskip,\@pnumwidth,\else,\fi}
8 %\DoNotIndex{\newcommand,\z@,\relax,\renewcommand,\ifnum,\csname,\endcsname}
9 %\DoNotIndex{\baselineskip,\vskip,\hskip,\relax,\secdef,\refstepcounter}
10 %\DoNotIndex{\normalsize,\numberline,\protect,\endinput}
11 %\DoNotIndex{\@compare,\ifx,\global}
13 %\newcommand{\Bs}{$\backslash$}
18 %\setlength{\marginparwidth}{0in}
19 %\addtolength{\textwidth}{4pc}
24 %\author{T. \surname{Hoekwater}}
25 %\institute{Kluwer Academic Publishers}
27 % The math environments |varequation| and |subequation|, and the
28 % |mathsec| and |mathchap| options have been moved here.
29 % These are intended for large articles or books.
31 % This package also implements theorem-like environment
32 % support. There is one option: |thms|, which also defines the
33 % theorems, instead of just controlling layout for user defined
34 % theorems. This option is only supplied for backward compatibility,
39 %\newpage\section{Usage notes}
40 %\subsection{Math environments}
41 % Two environments are defined to use with equations: |varequation|
42 % and\\ |subequation|.
44 % For |varequation|, there is one argument needed to be typeset as the
45 % `equation counter'. Usage example:
47 %\begin{varequation}{A.345}
52 %\begin{varequation}{A.345}
55 % This environment does not step the equation counter.
58 % there is one {\it optional\/} argument, that allows selecting the formatted
59 % layout of the added part of the equation number. Example usage:
61 %\begin{subequation}[alph] % this is also the default value
68 % There are four package options, namely:
70 % \item[leqno] For equation numbers on the left.
71 % \item[fleqn] For flush left equations.
72 %\item[mathsec] For numbering within sections.
73 %\item[mathchap] For numbering within chapters.
74 % (make sure the chapter counter is defined before you use this one)
77 % There are two user settings:
79 % \item |\mathindent| controls the amount of left indentation of
80 % equations under |fleqn|.
81 % \item |\eqnoindent| controls indentation for equation numbers.
82 % This only makes sense when used together with flush left equations, in
83 % which case it will move the equation counter from the right side to
84 % the left, with the specified indentation from the margin.
88 % \subsection{Theorems}
89 % This part of the stylefile is a bit strange, because it doesn't really do
90 % much. For the theorem part, all it does is redefining the internal
91 % \LaTeX\ command from |\newtheorem| to recognize some common
92 % strings. Then it tries to extract meaning from the string it has
93 % found, and typesets the entire theorem accordingly.
95 % All this has the following effect: If you define something like
97 %\newtheorem{thm}{THEOREM}[subsubsection]
99 % It will still be typeset according to the rules defined in the
100 % stylefile you're using, regardless of the environment name and the
103 % At this time, the following ``names'' are recognized:
105 %\begin{tabular}{lllll} \hline
106 %THEOREM & COROLLARY & LEMMA & CLAIM\\
107 %ALGORITHM & DEFINITION & EXAMPLE & REMARK\\
108 %PROBLEM & CONJECTURE & PROPOSITION & \\[6pt]
109 %Remark & Note & Summary & Case & Criterion\\ \hline
112 % The case distinction is significant here, so please note that
113 % |REMARK| and |Remark| are typeset differently.
115 % \subsection{Proof environments}
117 % The stylefile defines the environments |pf| and |pf*| for use in
118 % proofs. |pf*| requires one argument, to be used as the `name' of the
119 % proof. Example usage:
131 % |\qed| Typesets an open box on the right margin.
133 %\newpage\section{Implementation}
135 \NeedsTeXFormat{LaTeX2e}
136 \ProvidesPackage{klumath}[\filedate ]
137 \DeclareOption{leqno}{\AtEndOfPackage{\varleqno}}
138 \DeclareOption{fleqn}{\AtEndOfPackage{\varfleqn}}
139 \DeclareOption{mathsec}{%
140 \def\theequation{\arabic{section}.\arabic{equation}}}
141 \DeclareOption{mathchap}{%
142 \def\theequation{\arabic{chapter}.\arabic{equation}}}
143 \newif\if@thms \@thmsfalse
144 \DeclareOption{thms}{\@thmstrue }
145 \DeclareOption{secthm}{\AtEndOfPackage{\if@thms
146 \renewcommand{\thethm}{\thesection.\arabic{thm}.}%
147 \renewcommand{\thecrit}{\thesection.\arabic{crit}.}%
148 \renewcommand{\therem}{\thesection.\arabic{rem}.}%
149 \renewcommand{\theNote}{\thesection.\arabic{Note}.}%
150 \renewcommand{\thesumm}{\thesection.\arabic{summ}.}%
151 \renewcommand{\thecase}{\thesection.\arabic{case}.}%
157 % \subsection{Math environments}
158 % First off is |varequation|. Doesn't step any counters, and it has one
159 % argument to define the `equationnumber' to be used. The option
160 % |\eqnoindent| allows fooling around with the location of the number.
165 \def\varequation#1{$$ \gdef\curr@vareq{#1}}
166 \def\endvarequation{\eqno \var@eqnnum $$\global\@ignoretrue }
167 \def\var@eqnnum{\reset@font\normalcolor (\curr@vareq)}
172 \def\@eqnnum{\hbox to .01\p@{}%
173 \rlap{\reset@font\rmfamily\normalcolor
174 \hskip -\displaywidth (\theequation)}}%
175 \def\var@eqnnum{\hbox to .01\p@{}%
176 \rlap{\reset@font\rmfamily\normalcolor
177 \hskip -\displaywidth (\curr@vareq)}}%
180 % For |fleqn|, |varequation| has to be redefined, because it uses a
185 \mathindent\leftmargini
186 \def\varequation##1{%
187 \@beginparpenalty\predisplaypenalty
188 \@endparpenalty\postdisplaypenalty
189 \gdef\curr@vareq{##1}\trivlist
191 \hbox to\linewidth\bgroup $ \displaystyle
193 \def\endvarequation{$\hfil \displaywidth\linewidth
194 \ifdim \eqnoindent =\z@
195 \llap{\hbox{\var@eqnnum}}%
197 \llap{\hbox to 2pc{\var@eqnnum\hss}\kern \displaywidth
200 \egroup \endtrivlist}%
202 \def\[{\relax \ifmmode\@badmath
204 \@beginparpenalty\predisplaypenalty
205 \@endparpenalty\postdisplaypenalty
207 \hbox to\linewidth\bgroup $\m@th\displaystyle %$
208 \hskip\mathindent\bgroup \fi}%
209 \def\]{\relax \ifmmode \egroup $\hfil \egroup \endtrivlist % $
210 \else \@badmath \fi }%
212 \renewenvironment{equation}%
213 {\@beginparpenalty\predisplaypenalty
214 \@endparpenalty\postdisplaypenalty
215 \refstepcounter{equation}%
216 \trivlist \item[]\leavevmode
217 \hbox to\linewidth\bgroup $\m@th% $
221 \displaywidth\linewidth
222 \ifdim \eqnoindent =\z@
223 \llap{\hbox{\@eqnnum}}%
225 \llap{\hbox to 2pc{\@eqnnum\hss}\kern \displaywidth
231 \renewenvironment{eqnarray}{%
232 \stepcounter{equation}%
233 \def\@currentlabel{\p@equation\theequation}%
234 \global\@eqnswtrue\m@th
238 \setlength{\abovedisplayskip}{\topsep}%
240 \addtolength{\abovedisplayskip}{\partopsep}%
242 \addtolength{\abovedisplayskip}{\parskip}%
243 \setlength{\belowdisplayskip}{\abovedisplayskip}%
244 \setlength{\belowdisplayshortskip}{\abovedisplayskip}%
245 \setlength{\abovedisplayshortskip}{\abovedisplayskip}%
246 $$\everycr{}\halign to\linewidth% $$
249 $\displaystyle\tabskip\z@skip{####}$\@eqnsel&%
250 \global\@eqcnt\@ne \hskip \tw@\arraycolsep \hfil${####}$\hfil&%
251 \global\@eqcnt\tw@ \hskip \tw@\arraycolsep
252 $\displaystyle{####}$\hfil \tabskip\@centering&%
255 \ifdim \eqnoindent =\z@ \else
256 \hbox to 2pc \bgroup \fi
257 ####\ifdim \eqnoindent =\z@
258 \egroup \else \hss\egroup\kern \displaywidth
259 \kern -\eqnoindent\egroup
260 \fi \tabskip\z@skip\cr}%
263 \global\advance\c@equation\m@ne$$% $$
267 % |subequation| is a lot smarter, it implements subnumbering by
268 % moving the current value of the |equation| counter to a fixed place,
269 % then resets |equation| and restarts numbering.
271 % Now the equation number consists of the `fixed' part and the
275 \def\subequation{\@ifnextchar[{\@subequation}{\@subequation[alph]}}
276 \def\@subequation[#1]{\refstepcounter{equation}%
278 % |\@testoption| is needed because we would like to have
281 %$$\hfill (1a)$$ without.
284 \def\@testoption{arabic}%
290 \edef\old@equation{\the\c@equation}%
291 \edef\old@theequation{\theequation}%
292 \setcounter{equation}{0}%
294 % If the optional arg. == arabic; typeset a dot in between.
296 \ifx\@testoption\@testparam
297 \def\theequation{\old@theequation.\csname #1\endcsname{equation}}
299 \def\theequation{\old@theequation\csname #1\endcsname{equation}}
304 \def\endsubequation{%
305 \setcounter{equation}{\old@equation}%
310 % \subsection{Fixed macros}
313 \let\@thmscase\uppercase
317 \def\@stylehead{\rm }
318 \def\@styletext{\em }
326 % Definition of the |pf| and |pf*| environments. These take into
327 % account the value of |\if@novspace| that is set by the theorem-like
331 \expandafter\def\csname #1\endcsname{\par
332 \if@novspace \vskip-\lastskip
333 \else \addvspace{1\baselineskip
334 \@plus 0.5\baselineskip \@minus 0.1\baselineskip}%
336 {\it #2.\/} \ignorespaces }%
337 \expandafter\def\csname end#1\endcsname
338 {\par \addvspace{1\baselineskip \@plus 0.5\baselineskip \@minus
340 \global\@novspacefalse
345 % |pf*| has an argument that allow on-the-spot redefinition of
348 \@namedef{pf*}#1{\par
350 \def\proofname{#1}\pf
353 \@namedef{endpf*}{\endpf}
355 % |\qed| takes into account whether it is called during math mode or
356 % text mode. This is important because outside of math mode there will
357 % usually be a line to much in the output.
363 \unskip\nobreak ~\hfill$\Box$%
366 %|\@begintheorem| and |\@opargbegintheorem| do the real work. Both
367 %have roughly the same layout:
369 \def\@begintheorem#1#2{\trivlist
370 \global\@novspacetrue \itemindent\theoremsep
372 {\@stylehead\@thmscase{#1}\ #2\thmdot\/}]\ \@styletext}
373 \def\@opargbegintheorem#1#2#3{\trivlist \labelsep\z@
374 \global\@novspacetrue \itemindent\theoremsep
375 \item[\kern \labelsep {\@stylehead\@thmscase{#1}\ #2\thmdot\
376 (#3). \/}]\ \@styletext}
377 \def\@endtheorem{\endtrivlist}
379 \expandafter\g@addto@macro\csname #1\endcsname{\rmfamily\upshape }%
385 % This is taken from |ltthm.dtx|. It echoes the redefinitions
388 \def\newdisplay#1{\@ifnextchar[{\@odisp{#1}}{\@ndisp{#1}}}
390 \@ifnextchar[{\@xndisp{#1}{#2}}{\@yndisp{#1}{#2}}}
391 \def\@xndisp#1#2[#3]{\expandafter\@ifdefinable\csname #1\endcsname
392 {\@definecounter{#1}\@newctr{#1}[#3]%
393 \expandafter\xdef\csname the#1\endcsname{\expandafter\noexpand
394 \csname the#3\endcsname \@dispcountersep \@dispcounter{#1}}%
395 \global\@namedef{#1}{%
396 \@disp{#1}{#2}}\global\@namedef{end#1}{\@enddisplay}}}
397 \def\@yndisp#1#2{\expandafter\@ifdefinable\csname #1\endcsname
398 {\@definecounter{#1}%
399 \expandafter\xdef\csname the#1\endcsname{\@dispcounter{#1}}%
400 \global\@namedef{#1}{%
401 \@disp{#1}{#2}}\global\@namedef{end#1}{\@enddisplay}}}
402 \def\@odisp#1[#2]#3{%
403 \@ifundefined{c@#2}{\@nocounterr{#2}}%
404 {\expandafter\@ifdefinable\csname #1\endcsname
405 {\global\@namedef{the#1}{\@nameuse{the#2}}%
406 \global\@namedef{#1}{\@disp{#2}{#3}}%
407 \global\@namedef{end#1}{\@enddisplay}}}}
408 \def\@disp#1#2{\refstepcounter
409 {#1}\@ifnextchar[{\@ydisp{#1}{#2}}{\@xdisp{#1}{#2}}}
410 \def\@xdisp#1#2{\@begindisplay{#2}{\csname the#1\endcsname}\ignorespaces}
411 \def\@ydisp#1#2[#3]{\@opargbegindisplay{#2}{\csname
412 the#1\endcsname}{#3}\ignorespaces}
413 \def\@dispcounter#1{\noexpand\arabic{#1}}
414 \def\@dispcountersep{.}
415 \def\@begindisplay#1#2{\trivlist
416 \global\@novspacefalse \itemindent\dispsep
418 \@dispcase{#1}\ #2\dispdot \/}]\@disptext}
419 \def\@opargbegindisplay#1#2#3{\trivlist
420 \global\@novspacefalse
422 \item[{\@disphead \@dispcase{#1}\ #2\dispdot\
423 (\@dispcase{#3})\/}]\@disptext}
424 \def\@enddisplay{\endtrivlist}
428 \newtheorem{thm}{THEOREM}
429 \newtheorem{cor}[thm]{COROLLARY}
430 \newtheorem{lem}[thm]{LEMMA}
431 \newtheorem{claim}[thm]{CLAIM}
432 \newtheorem{conj}[thm]{CONJECTURE}
433 \newtheorem{prop}[thm]{PROPOSITION}
434 \newtheorem{exer}[thm]{EXERCISE}
435 \newtheorem{REM}[thm]{REMARK}
436 \newtheorem{prob}[thm]{PROBLEM}
437 \newtheorem{alg}{ALGORITHM}
439 \newtheorem{defn}[thm]{DEFINITION}
441 \newtheorem{exmp}[thm]{EXAMPLE}
443 \newdisplay{crit}{Criterion}
444 \newdisplay{rem}{Remark}
445 \newdisplay{Note}{Note}
446 \newdisplay{summ}{Summary}
447 \newdisplay{case}{Case}
452 % \IndexParms{\hbadness=10000}