From 3eb843585fc56ace68d2c095ff32de0c743b9446 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Thu, 12 Jan 2006 23:57:34 +0000
Subject: kluwer

git-svn-id: svn://tug.org/texlive/trunk@1017 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/kluwer/klumath.sty | 516 +++++++++++++++++++++++++
 1 file changed, 516 insertions(+)
 create mode 100644 Master/texmf-dist/tex/latex/kluwer/klumath.sty

(limited to 'Master/texmf-dist/tex/latex/kluwer/klumath.sty')

diff --git a/Master/texmf-dist/tex/latex/kluwer/klumath.sty b/Master/texmf-dist/tex/latex/kluwer/klumath.sty
new file mode 100644
index 00000000000..b4f9b9d1eef
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/kluwer/klumath.sty
@@ -0,0 +1,516 @@
+%
+%<*other>
+%
+\ifcat a\noexpand @\let\next\relax\else \def\next{%
+\documentclass{kluwer}\usepackage{doc}\MakePercentIgnore}\fi\next
+\def\filedate{1999/09/09}
+% \def\changes#1#2{}
+% \changes{1999/09/09}{bugfix pf* environment}
+% \changes{1999/11/08}{AtEndOfPackage replaced with custom hook AtEndKluMath
+%   for the benefit of a single docstripped kluwer.cls}
+% \changes{1999/12/01}{Fixed indent after fleqn / displaymath}
+% \changes{2000/01/19}{Removed begin/endgroup for subequations to
+%   eliminate unwanted indentation}
+% \changes{2000/02/10}{Removed superfluous thmdot in case of opt. arg}
+% \changes{2000/02/24}{Preserved some list parameters within theorem}
+% \changes{2000/03/27}{trivlist replaced with trivm@th for
+%   displaymath to preserve spacing inside enumerate and itemize}
+% \changes{2000/04/03}{removed bgroup/egroup from trivma@th to
+%   eliminate spurious indentation}
+\def\filename{klumath.sty}
+%\DoNotIndex{\@M,\def,\c@secnumdepth,\baselineskip,\@pnumwidth,\else,\fi}
+%\DoNotIndex{\newcommand,\z@,\relax,\renewcommand,\ifnum,\csname,\endcsname}
+%\DoNotIndex{\baselineskip,\vskip,\hskip,\relax,\secdef,\refstepcounter}
+%\DoNotIndex{\normalsize,\numberline,\protect,\endinput}
+%\DoNotIndex{\@compare,\ifx,\global}
+%\CodelineIndex
+%\newcommand{\Bs}{$\backslash$}
+%\parindent=0pt
+%\parskip=3pt
+%\hfuzz=10pt
+%\MakeShortVerb{\|}
+%\setlength{\marginparwidth}{0in}
+%\addtolength{\textwidth}{4pc}
+%\begin{document}
+%\begin{opening}
+%\title{\filename}
+%\date{\filedate}
+%\author{T. \surname{Hoekwater}}
+%\institute{Kluwer Academic Publishers}
+%\begin{abstract}
+% The math environments |varequation| and |subequation|, and the
+% |mathsec| and |mathchap| options have been moved here. 
+% These are  intended for large articles or books.
+%
+% This package also implements theorem-like environment
+% support. There is one option: |thms|, which also defines the
+% theorems, instead of just controlling layout for user defined
+% theorems. This option is only supplied for backward compatibility,
+% use is deprecated.   
+%\end{abstract} 
+%\end{opening}
+%\tableofcontents
+%\newpage\section{Usage notes}
+%\subsection{Math environments}
+% Two environments are defined to use with equations: |varequation|
+% and\\ |subequation|. 
+%
+%  For |varequation|, there is one argument needed to be typeset as the
+%  `equation counter'. Usage example: 
+%\begin{verbatim}
+%\begin{varequation}{A.345}
+%...  
+%\end{varequation}
+%\end{verbatim}
+%results in: 
+%\begin{varequation}{A.345}
+%...  
+%\end{varequation}
+% This environment does not step the equation counter.
+% 
+% For |subequation|,
+% there is one {\it optional\/} argument, that allows selecting the formatted
+% layout of the added part of the equation number. Example usage:
+%\begin{verbatim}
+%\begin{subequation}[alph] % this is also the default value
+%\begin{equation}
+%...    
+%\end{equation}
+%\end{subequation}
+%\end{verbatim}  
+%
+% There are four package options, namely:
+% \begin{itemize}
+% \item[leqno] For equation numbers on the left.
+% \item[fleqn] For flush left equations.
+%\item[mathsec] For numbering within sections.
+%\item[mathchap] For numbering within chapters. 
+% (make sure the chapter counter is defined before you use this one)                                             
+% \end{itemize}
+%
+% There are two user settings:
+% \begin{itemize}
+% \item |\mathindent| controls the amount of left indentation of
+%    equations under |fleqn|. 
+% \item |\eqnoindent| controls indentation for equation numbers. 
+% This only makes sense when used together with flush left equations, in 
+% which case it will move the equation counter from the right side to 
+% the left, with the specified indentation from the margin.                                                                     
+%                                                         
+% \end{itemize}
+%
+% \subsection{Theorems}
+% This part of the stylefile is a bit strange, because it doesn't really do
+% much. For the theorem part, all it does is redefining the internal
+% \LaTeX\ command from |\newtheorem| to recognize some common
+% strings. Then it tries to extract meaning from the string it has
+% found, and typesets the entire theorem accordingly. 
+%
+% All this has the following effect: If you define something like 
+%\begin{verbatim}
+%\newtheorem{thm}{THEOREM}[subsubsection] 
+%\end{verbatim}
+% It will still be typeset according to the rules defined in the
+% stylefile you're using, regardless of the environment name and the
+% used counter. 
+%
+% At this time, the following ``names'' are recognized: 
+%
+%\begin{tabular}{lllll} \hline
+%THEOREM & COROLLARY & LEMMA & CLAIM\\
+%ALGORITHM & DEFINITION & EXAMPLE & REMARK\\
+%PROBLEM & CONJECTURE & PROPOSITION & \\[6pt]
+%Remark & Note & Summary & Case & Criterion\\ \hline
+%\end{tabular}
+%
+% The case distinction is significant here, so please note that
+% |REMARK| and |Remark| are typeset differently.
+%
+% \subsection{Proof environments}
+%
+% The stylefile defines the environments |pf|  and |pf*| for use in
+% proofs. |pf*| requires one argument, to be used as the `name' of the
+% proof. Example usage:
+%\begin{verbatim}
+%\begin{thm}
+%......  
+%\end{thm}
+%\begin{pf*}{Proofs}  
+%....
+%\end{pf*}\qed
+%\end{verbatim}
+%\begin{pf*}{Proofs}  
+%....
+%\end{pf*}\qed
+% |\qed| Typesets an open box on the right margin.
+%
+%\newpage\section{Implementation}
+%    \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{klumath}[\filedate ]
+%</other>
+%<*head>
+\let\@EndKlumathook\@empty
+\def\AtEndKluMath{\g@addto@macro\@EndKlumathook}
+
+\DeclareOption{leqno}{\AtEndKluMath{\varleqno}}                       
+\DeclareOption{fleqn}{\AtEndKluMath{\varfleqn}}      
+\DeclareOption{mathsec}{%
+   \def\theequation{\arabic{section}.\arabic{equation}}}
+\DeclareOption{mathchap}{%
+   \def\theequation{\arabic{chapter}.\arabic{equation}}}
+\newif\if@thms \@thmsfalse
+\DeclareOption{thms}{\@thmstrue } 
+\DeclareOption{secthm}{\AtEndKluMath{\if@thms
+    \renewcommand{\thethm}{\thesection.\arabic{thm}.}%
+    \renewcommand{\thecrit}{\thesection.\arabic{crit}.}%            
+    \renewcommand{\therem}{\thesection.\arabic{rem}.}%
+    \renewcommand{\theNote}{\thesection.\arabic{Note}.}%
+    \renewcommand{\thesumm}{\thesection.\arabic{summ}.}%
+    \renewcommand{\thecase}{\thesection.\arabic{case}.}%
+    \fi
+    }}
+%\ExecuteOptions{}
+%</head>
+%<*other>
+\ProcessOptions 
+%    \end{macrocode}
+% \subsection{Math environments} 
+% First off is |varequation|. Doesn't step any counters, and it has one
+% argument to define the `equationnumber' to be used.  The option
+% |\eqnoindent| allows fooling around with the location of the number.
+% 
+%    \begin{macrocode}
+%</other>
+%<*main>
+\def\trivm@th{%
+%  \bgroup
+  \ifnum \@itemdepth >0 \topsep\topsepm@th \fi
+  \ifnum \@enumdepth >0 \topsep\topsepm@th \fi
+  \trivlist}
+\def\endtrivm@th{\endtrivlist %\egroup
+}
+\newdimen\eqnoindent
+\setlength{\eqnoindent}{0pt}
+\def\varequation#1{$$ \gdef\curr@vareq{#1}}
+\def\endvarequation{\eqno \var@eqnnum $$\global\@ignoretrue }
+\def\var@eqnnum{\reset@font\normalcolor  (\curr@vareq)}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\def\varleqno{%
+   \def\@eqnnum{\hbox to .01\p@{}%
+     \rlap{\reset@font\rmfamily\normalcolor
+     \hskip -\displaywidth (\theequation)}}%
+   \def\var@eqnnum{\hbox to .01\p@{}%
+     \rlap{\reset@font\rmfamily\normalcolor
+     \hskip -\displaywidth (\curr@vareq)}}%
+}%
+%    \end{macrocode}      
+% |varfleqn| takes care of redefinitions in case of fleqn.
+% |varequation| also has to be redefined, because it uses a
+% trivlist.
+%    \begin{macrocode}                                  
+\def\varfleqn{%
+  \newdimen\mathindent
+  \mathindent\leftmargini
+  \def\varequation##1{%
+    \@beginparpenalty\predisplaypenalty
+    \@endparpenalty\postdisplaypenalty                  
+    \gdef\curr@vareq{##1}\trivm@th 
+    \item[]\leavevmode
+    \hbox to\linewidth\bgroup $ \displaystyle              
+    \hskip\mathindent }%
+  \def\endvarequation{$\hfil \displaywidth\linewidth 
+    \ifdim \eqnoindent =\z@ 
+       \llap{\hbox{\var@eqnnum}}%
+     \else                                
+       \llap{\hbox to 2pc{\var@eqnnum\hss}\kern \displaywidth
+        \kern -\eqnoindent}%
+     \fi
+     \egroup  \endtrivm@th}%
+% code copied from ltmath.ltx
+  \def\[{\relax
+          \ifmmode\@badmath
+         \else
+         \begin{trivm@th}%
+           \@beginparpenalty\predisplaypenalty
+           \@endparpenalty\postdisplaypenalty
+           \item[]\leavevmode
+           \hbox to\linewidth\bgroup $\m@th\displaystyle %$
+             \hskip\mathindent\bgroup
+         \fi}%
+  \def\]{\relax
+          \ifmmode
+                \egroup $\hfil% $
+              \egroup
+            \end{trivm@th}%
+          \else \@badmath
+          \fi}%
+%
+% equation/endequation: as above, but with equation number
+%
+  \renewenvironment{equation}{%
+     \@beginparpenalty\predisplaypenalty
+     \@endparpenalty\postdisplaypenalty
+     \refstepcounter{equation}%
+     \trivm@th
+       \item[]\leavevmode
+       \hbox to\linewidth\bgroup $\m@th% $
+         \displaystyle
+         \hskip\mathindent}%%%%%%%
+        {$\hfil % $
+         \displaywidth\linewidth
+    \ifdim \eqnoindent =\z@ 
+       \llap{\hbox{\@eqnnum}}%
+     \else
+       \llap{\hbox to 2pc{\@eqnnum\hss}\kern \displaywidth
+        \kern -\eqnoindent}%
+     \fi
+       \egroup
+     \endtrivm@th}%
+%
+  \renewenvironment{eqnarray}{%
+    \stepcounter{equation}%
+    \def\@currentlabel{\p@equation\theequation}%
+    \global\@eqnswtrue\m@th
+    \global\@eqcnt\z@
+    \tabskip\mathindent
+    \let\\=\@eqncr
+    \setlength{\abovedisplayskip}{\topsep}%
+    \ifvmode
+      \addtolength{\abovedisplayskip}{\partopsep}%
+    \fi
+    \addtolength{\abovedisplayskip}{\parskip}%
+    \setlength{\belowdisplayskip}{\abovedisplayskip}%
+    \setlength{\belowdisplayshortskip}{\abovedisplayskip}%
+    \setlength{\abovedisplayshortskip}{\abovedisplayskip}%
+    $$\everycr{}\halign to\linewidth% $$
+    \bgroup
+      \hskip\@centering
+      $\displaystyle\tabskip\z@skip{####}$\@eqnsel&%
+      \global\@eqcnt\@ne \hskip \tw@\arraycolsep \hfil${####}$\hfil&%
+      \global\@eqcnt\tw@ \hskip \tw@\arraycolsep
+        $\displaystyle{####}$\hfil \tabskip\@centering&%
+      \global\@eqcnt\thr@@
+           \llap \bgroup 
+          \ifdim \eqnoindent =\z@ \else
+         \hbox to 2pc \bgroup \fi 
+              ####\ifdim \eqnoindent =\z@ 
+              \egroup \else \hss\egroup\kern \displaywidth
+        \kern -\eqnoindent\egroup
+     \fi \tabskip\z@skip\cr}%
+      {\@@eqncr
+    \egroup
+    \global\advance\c@equation\m@ne$$% $$
+    \global\@ignoretrue
+    }}                   
+%    \end{macrocode}
+% |subequation| is a lot smarter, it implements subnumbering by
+% moving the current value of the |equation| counter to a fixed place,
+% then resets |equation| and restarts numbering. 
+%
+%  Now the equation number consists of the `fixed' part and the
+%  updated new part. 
+%
+%    \begin{macrocode}
+\def\subequation{\@ifnextchar[{\@subequation}{\@subequation[alph]}}
+\def\@subequation[#1]{\refstepcounter{equation}%
+%    \end{macrocode}
+% |\@testoption| is needed because we would like to have 
+% $$\hfill (1.1)$$
+% with a dot, but 
+%$$\hfill (1a)$$ without.  
+% 
+%    \begin{macrocode}
+  \def\@testoption{arabic}%
+  \def\@testparam{#1}%
+%  \begingroup
+%    \end{macrocode}
+% Save old values
+%    \begin{macrocode}
+  \edef\old@equation{\the\c@equation}%
+  \edef\old@theequation{\theequation}%
+  \setcounter{equation}{0}%
+%    \end{macrocode}
+% If the optional arg. == arabic; typeset a dot in between.
+%    \begin{macrocode}
+  \ifx\@testoption\@testparam
+    \def\theequation{\old@theequation.\csname #1\endcsname{equation}}%
+  \else
+    \def\theequation{\old@theequation\csname #1\endcsname{equation}}%
+  \fi}
+%    \end{macrocode}
+% Restore old values
+%    \begin{macrocode}
+\def\endsubequation{%
+  \setcounter{equation}{\old@equation}%
+%  \endgroup
+  \global\@ignoretrue
+}
+%    \end{macrocode}
+%\section{Theorems}
+% \subsection{Fixed macros}
+%    \begin{macrocode}
+\newif\if@novspace
+\let\@thmscase\uppercase
+\newdimen\theoremsep
+\theoremsep\z@
+\def\thmdot{.}
+\def\@stylehead{\rm }
+\def\@styletext{\em }
+\let\@dispcase\relax  
+\newdimen\dispsep
+\dispsep\parindent
+\def\dispdot{.}
+\def\@disphead{\it }
+\def\@disptext{\rm }
+%    \end{macrocode}
+% Definition of the |pf| and |pf*| environments. These take into
+% account the value of |\if@novspace| that is set by the theorem-like
+% environments. 
+%    \begin{macrocode} 
+% |pf*| has an argument that allow on-the-spot redefinition of
+% |\proofname|. 
+%    \begin{macrocode}
+
+\def\pr@@f#1{% 
+  \par
+    \if@novspace \vskip-\lastskip
+    \else \addvspace{1\baselineskip 
+            \@plus 0.5\baselineskip \@minus 0.1\baselineskip}%
+    \fi \indent
+    {\it #1.\/} \ignorespaces
+}
+\def\endpr@@f{%
+  \par
+   \addvspace{1\baselineskip \@plus 0.5\baselineskip \@minus 
+        0.1\baselineskip}%
+    \global\@novspacefalse
+}
+
+\def\newproof#1#2{% 
+  \expandafter\def\csname #1\endcsname{\pr@@f{#2}}%
+  \expandafter\def\csname end#1\endcsname{\endpr@@f}}
+\newproof{pf}{Proof}
+
+\newenvironment{pf*}[1]{\pr@@f{#1}}{\endpr@@f}
+%    \end{macrocode}
+% |\qed| takes into account whether it is called during math mode or
+% text mode. This is important because outside of math mode there will
+% usually be a line to much in the output.
+%    \begin{macrocode}
+\def\qed{\relax
+     \ifmmode
+       ~\hfill\Box
+     \else
+        \unskip\nobreak ~\hfill$\Box$%
+      \fi \par}
+%    \end{macrocode}
+%|\@begintheorem| and |\@opargbegintheorem| do the real work.  Both
+%have roughly the same layout: 
+%    \begin{macrocode}
+\newlength\items@ve\newlength\labels@ve
+\def\@begintheorem#1#2{%
+  \items@ve=\itemindent \labels@ve=\labelsep
+  \trivlist  
+    \global\@novspacetrue \itemindent\theoremsep 
+     \item[\kern\labelsep 
+     {\@stylehead\@thmscase{#1}\ #2\thmdot\/}]\ \@styletext
+     \itemindent=\items@ve \labelsep=\labels@ve}
+\def\@opargbegintheorem#1#2#3{%
+      \items@ve=\itemindent \labels@ve=\labelsep
+      \trivlist \labelsep\z@  
+      \global\@novspacetrue \itemindent\theoremsep 
+      \item[\kern \labelsep {\@stylehead\@thmscase{#1}\ #2\ 
+      (#3). \/}]\ \@styletext
+      \itemindent=\items@ve \labelsep=\labels@ve}
+\def\@endtheorem{\endtrivlist}     
+\def\rmtheorem#1{% 
+    \expandafter\g@addto@macro\csname #1\endcsname{\rmfamily\upshape }%
+    }
+%    \end{macrocode}
+%
+% |\newdisplay|.
+%
+% This is taken from |ltthm.dtx|. It echoes the redefinitions
+% for theorems. 
+%    \begin{macrocode} 
+\def\newdisplay#1{\@ifnextchar[{\@odisp{#1}}{\@ndisp{#1}}}
+\def\@ndisp#1#2{%
+  \@ifnextchar[{\@xndisp{#1}{#2}}{\@yndisp{#1}{#2}}}
+\def\@xndisp#1#2[#3]{\expandafter\@ifdefinable\csname #1\endcsname
+  {\@definecounter{#1}\@newctr{#1}[#3]%                     
+      \expandafter\xdef\csname the#1\endcsname{\expandafter\noexpand
+        \csname the#3\endcsname \@dispcountersep \@dispcounter{#1}}%
+\global\@namedef{#1}{%
+  \@disp{#1}{#2}}\global\@namedef{end#1}{\@enddisplay}}}
+\def\@yndisp#1#2{\expandafter\@ifdefinable\csname #1\endcsname
+{\@definecounter{#1}%
+\expandafter\xdef\csname the#1\endcsname{\@dispcounter{#1}}%
+\global\@namedef{#1}{%
+  \@disp{#1}{#2}}\global\@namedef{end#1}{\@enddisplay}}}
+\def\@odisp#1[#2]#3{%
+  \@ifundefined{c@#2}{\@nocounterr{#2}}%
+  {\expandafter\@ifdefinable\csname #1\endcsname
+  {\global\@namedef{the#1}{\@nameuse{the#2}}%
+\global\@namedef{#1}{\@disp{#2}{#3}}%
+\global\@namedef{end#1}{\@enddisplay}}}}
+\def\@disp#1#2{\refstepcounter         
+    {#1}\@ifnextchar[{\@ydisp{#1}{#2}}{\@xdisp{#1}{#2}}}
+\def\@xdisp#1#2{\@begindisplay{#2}{\csname the#1\endcsname}\ignorespaces}
+\def\@ydisp#1#2[#3]{\@opargbegindisplay{#2}{\csname
+       the#1\endcsname}{#3}\ignorespaces}
+\def\@dispcounter#1{\noexpand\arabic{#1}}
+\def\@dispcountersep{.}
+\def\@begindisplay#1#2{%
+    \items@ve=\itemindent \labels@ve=\labelsep
+    \trivlist
+    \global\@novspacefalse \itemindent\dispsep
+        \item[{\@disphead 
+        \@dispcase{#1}\ #2\dispdot \/}]\@disptext
+        \itemindent=\items@ve \labelsep=\labels@ve}
+\def\@opargbegindisplay#1#2#3{%
+    \items@ve=\itemindent \labels@ve=\labelsep
+      \trivlist
+      \global\@novspacefalse
+      \itemindent \dispsep
+      \item[{\@disphead \@dispcase{#1}\ #2\dispdot\ 
+      (\@dispcase{#3})\/}]\@disptext
+      \itemindent=\items@ve \labelsep=\labels@ve}
+\def\@enddisplay{\endtrivlist}     
+%    \end{macrocode}
+%    \begin{macrocode}
+\if@thms
+  \newtheorem{thm}{THEOREM}
+  \newtheorem{cor}[thm]{COROLLARY} 
+  \newtheorem{lem}[thm]{LEMMA}
+  \newtheorem{claim}[thm]{CLAIM}
+  \newtheorem{conj}[thm]{CONJECTURE}
+  \newtheorem{prop}[thm]{PROPOSITION}
+  \newtheorem{exer}[thm]{EXERCISE}
+  \newtheorem{REM}[thm]{REMARK}
+  \newtheorem{prob}[thm]{PROBLEM}
+  \newtheorem{alg}{ALGORITHM}
+  \rmtheorem{alg}
+  \newtheorem{defn}[thm]{DEFINITION}
+  \rmtheorem{defn}
+  \newtheorem{exmp}[thm]{EXAMPLE}
+  \rmtheorem{exmp}
+  \newdisplay{crit}{Criterion}
+  \newdisplay{rem}{Remark}
+  \newdisplay{Note}{Note}
+  \newdisplay{summ}{Summary}
+  \newdisplay{case}{Case}
+\fi
+\arraycolsep = 3pt
+\@EndKlumathook
+%</main>
+%<*other>
+\endinput
+%    \end{macrocode}
+% \IndexParms{\hbadness=10000}
+%\PrintIndex
+%\end{document}
+% end of klumath.sty
+%</other>
-- 
cgit v1.2.3

