%%
%% This is file `nccmath.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% nccmath.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% This file is a generated file from the sources of the `ncctools'
%% bundle.
%% 
%% You are not allowed to modify this file.
%% 
%% You are allowed to distribute this file if and only if
%% it is distributed with the corresponding source files in
%% the `ncctools' bundle.
%% 
%% For the copying and distribution conditions of the source files,
%% see the README file distributed with the ncctools bundle.
%%
%% File: nccmath.dtx Copyright (C) 2002--2006 by Alexander I. Rozhenko
%%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{nccmath}
         [2006/01/20 v1.3 Additional Math Commands (NCC)]
\DeclareOption{mediummath}{\newcommand\NCC@op{}}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{amsmath}}
\ProcessOptions\relax
\RequirePackage{amsmath}[2000/07/18]
\newif\ifNCC@star
\def\NCC@cr{\relax\iffalse{\fi\ifnum0=`}\fi
  \@ifstar{\global\NCC@startrue\NCC@cr@}{\global\NCC@starfalse\NCC@cr@}%
}
\def\NCC@cr@{\new@ifnextchar[\NCC@cr@@{\NCC@cr@@[\z@]}}
\def\NCC@cr@@[#1]{\ifnum0=`{\fi \iffalse}\fi\NCC@cr@@@{#1}}
\def\NCC@aligncr#1{\cr\noalign{\vskip #1\relax}}
\def\NCC@default@cr{\let\\\NCC@cr \let\NCC@cr@@@\NCC@aligncr}
\newcommand{\nr}{%
  \let\NCC@temp\NCC@cr@@@
  \let\NCC@cr@@@\NCC@nr
  \NCC@cr
}
\def\NCC@nr#1{%
  \let\NCC@cr@@@\NCC@temp
  \setlength\@tempskipa{#1}\advance\@tempskipa .5ex
  \ifNCC@star
    \edef\@tempa{\noexpand\\*[\the\@tempskipa]}%
  \else
    \edef\@tempa{\noexpand\\[\the\@tempskipa]}%
  \fi
  \@tempa
}
\newcommand{\mrel}{\mathpalette\NCC@rel}
\def\NCC@rel#1#2{\mathrel{\vcenter{\NCC@default@cr
  \offinterlineskip \ialign{\hfil$\m@th#1##$\hfil\cr#2\crcr}}}}
\newcommand{\underrel}[2]{\mathrel{\mathop{#1}\limits_{#2}}}
\newdimen\NCC@fracrulewidth
\def\NCC@select@msize{\relax
  \@tempdima \f@size\p@
  \ifdim\@tempdima>11.5\p@
    \@tempdimb .83\@tempdima
  \else
    \@tempdimb .8\@tempdima
    \ifdim\@tempdimb<5\p@ \@tempdimb 5\p@\fi
  \fi
  \NCC@fracrulewidth .04\@tempdima
  \@tempdima 1.25\NCC@fracrulewidth
  \ifdim\NCC@fracrulewidth>.45\p@ \else
    \ifdim\NCC@fracrulewidth>.34\p@ \NCC@fracrulewidth .4\p@
    \else \NCC@fracrulewidth .3\p@
    \fi
  \fi
}
\def\NCC@innerfrac#1{\genfrac{}{}\NCC@fracrulewidth{#1}}
\def\NCC@prepare@msize{%
  \@tempdima 1.2\@tempdimb
  \advance\@tempdimb .5\p@
  \edef\@tempa{\strip@pt\@tempdimb}%
  \expandafter\NCC@floor\expandafter\@tempa\@tempa.\@nil
  \fontsize\@tempa\@tempdima\selectfont
  \def\frac{\protect\NCC@innerfrac{}}%
  \def\dfrac{\NCC@innerfrac\z@}%
  \def\tfrac{\NCC@innerfrac\@ne}%
  \def\binom{\protect\genfrac()\z@{}}%
}
\def\NCC@floor#1#2.#3\@nil{\def#1{#2}}
\DeclareRobustCommand*\NCC@op@prepare[1]{%
  \def\NCC@op{#1}%
  \let\NCC@op@print\NCC@op@printm
  \NCC@op@prepare@
}
\def\NCC@op@prepare@{%
  \let\NCC@op@lim\ilimits@
  \let\NCC@op@sp\relax
  \let\NCC@op@sb\relax
  \NCC@op@next
}
\def\NCC@op@next{\futurelet\@let@token\NCC@op@getnext}
\def\NCC@op@getnext{%
  \let\@tempa\NCC@op@skip
  \ifx\@let@token\limits
   \let\NCC@op@lim\limits \else
    \ifx\@let@token\nolimits
     \let\NCC@op@lim\nolimits \else
      \ifx\@let@token\displaylimits
       \let\NCC@op@lim\displaylimits \else
        \ifx\@let@token\sp
         \NCC@op@test\NCC@op@sp
         \def\@tempa{\NCC@op@get\NCC@op@sp}\else
          \ifx\@let@token\sb
           \NCC@op@test\NCC@op@sb
           \def\@tempa{\NCC@op@get\NCC@op@sb}\else
            \ifx\@let@token\@sptoken
             \let\@tempa\NCC@op@skipsp \else
             \let\@tempa\NCC@op@print
            \fi
          \fi
        \fi
      \fi
    \fi
  \fi
  \@tempa
}
\def\NCC@op@skip#1{\NCC@op@next}
\def\NCC@op@skipsp{%
  \@ifnextchar0{\NCC@op@next}{\NCC@op@next}%
}
\def\NCC@op@test#1{%
  \ifx#1\relax \else
    \PackageError{nccmath}{Double index in math operator}{}
  \fi
}
\def\NCC@op@get#1#2#3{\def#1{#3}\NCC@op@next}
\def\NCC@op@printm{%
  \ifx\NCC@op@lim\nolimits \NCC@op@printm@\@ne \else
    \ifx\NCC@op@lim\limits \NCC@op@printm@\z@ \else
      \mathchoice{\displaystyle\NCC@op@printm@\z@}%
                 {\textstyle\NCC@op@printm@\@ne}%
                 {\scriptstyle\NCC@op@printm@\@ne}%
                 {\scriptscriptstyle\NCC@op@printm@\@ne}%
    \fi
  \fi
}
\def\NCC@op@printm@{\NCC@op@print@\NCC@op\NCC@op@kern}
\def\NCC@op@print@#1#2#3{\mathop{#1}%
  \setlength\@tempdima{#2}%
  \@tempswatrue
  \ifx\NCC@op@sb\relax \else \ifnum#3>\z@ \@tempswafalse \fi \fi
  \ifx\NCC@op@sp\relax \else \ifnum#3>\z@ \@tempswafalse \fi \fi
  \edef\@tempa{%
    \ifnum#3=\z@ \noexpand\limits \else \noexpand\nolimits \fi
    \ifx\NCC@op@sb\relax \else
      \noexpand\sb{%
        \ifnum#3=\z@ \kern -\@tempdima\else \kern -.8\@tempdima \fi
        \noexpand\NCC@op@sb}%
    \fi
    \ifx\NCC@op@sp\relax \else
      \noexpand\sp{\ifnum#3=\z@ \kern \@tempdima\fi
        \noexpand\NCC@op@sp}%
    \fi
    \if@tempswa \kern -.2\@tempdima \fi
  }%
  \@tempa
}
\DeclareRobustCommand*\medmath[1]{\NCC@select@msize
  \mathord{\raise\@tempdima\hbox{\NCC@prepare@msize
    $\displaystyle#1$}}%
}
\newcommand*\medop[1]{\DOTSB\mathop{\medmath{#1}}\slimits@}
\newcommand*\medintcorr[1]{\def\NCC@op@kern{#1}}
\medintcorr{.5em}
\newcommand*\medint[1]{\DOTSI\NCC@op@prepare{\medmath{#1}}}
\DeclareRobustCommand*\mfrac[2]{\medmath{\frac{#1}{#2}}}
\DeclareRobustCommand*\mbinom[2]{%
  \Bigl(\medmath{\genfrac{}{}{\z@}{}{#1}{#2}}\Bigr)%
}
\newenvironment{medsize}{\NCC@select@msize
  \mathord\bgroup
    \raise\@tempdima\hbox\bgroup\NCC@prepare@msize
      \arraycolsep .8\arraycolsep $}{$\egroup\egroup}
\newenvironment{mmatrix}{\medsize\begin{matrix}}{\end{matrix}\endmedsize}
\renewcommand*{\MultiIntegral}[1]{%
  \edef\NCC@op{\noexpand\intop
    \ifnum#1=\z@\noexpand\intdots@\else\noexpand\intkern@\fi
    \ifnum#1>\tw@\noexpand\intop\noexpand\intkern@\fi
    \ifnum#1>\thr@@\noexpand\intop\noexpand\intkern@\fi
    \noexpand\intop
  }%
  \let\NCC@op@print\NCC@op@printd
  \NCC@op@prepare@
}
\def\NCC@op@printd{%
  \setlength\@tempdima{\NCC@op@kern}%
  \ifx\NCC@op@lim\nolimits \@tempcnta\@ne \else
    \ifx\NCC@op@lim\limits \@tempcnta\z@ \else
      \@tempcnta\m@ne
    \fi
  \fi
  \mathchoice{\NCC@op@printd@{\displaystyle}{1.2\@tempdima}}%
             {\NCC@op@printd@{\textstyle}{.8\@tempdima}}%
             {\NCC@op@printd@{\scriptstyle}{.8\@tempdima}}%
             {\NCC@op@printd@{\scriptscriptstyle}{.8\@tempdima}}%
}
\def\NCC@op@printd@#1#2{#1%
  \ifnum\@tempcnta>\m@ne
    \NCC@op@print@{\hbox{$#1\NCC@op$}}{#2}\@tempcnta
  \else
    \ifx#1\displaystyle
      \NCC@op@print@{\hbox{$#1\NCC@op$}}{#2}\z@
    \else
      \NCC@op@print@{\hbox{$#1\NCC@op$}}{#2}\@ne
    \fi
  \fi
}
\def\@tempa{%
  \if@eqnsw \gdef\df@tag{\tagform@\theequation}\fi
  \if@fleqn \@xp\endmathdisplay@fleqn
  \else \ifx\df@tag\@empty \else \veqno \alt@tag \df@tag \fi
    \ifx\df@label\@empty \else \@xp\ltx@label\@xp{\df@label}\fi
  \fi
  \ifnum\dspbrk@lvl>\m@ne
    \postdisplaypenalty -\@getpen\dspbrk@lvl
    \global\dspbrk@lvl\m@ne
  \fi
}
\ifx\@tempa\endmathdisplay@a
  \def\endmathdisplay@a{%
    \ifnum\dspbrk@lvl>\m@ne
      \postdisplaypenalty -\@getpen\dspbrk@lvl
      \global\dspbrk@lvl\m@ne
    \fi
    \if@eqnsw \gdef\df@tag{\tagform@\theequation}\fi
    \if@fleqn \@xp\endmathdisplay@fleqn
    \else \ifx\df@tag\@empty \else \veqno \alt@tag \df@tag \fi
      \ifx\df@label\@empty \else \@xp\ltx@label\@xp{\df@label}\fi
    \fi
  }
\else
  \PackageWarning{nccmath}%
    {The \string\endmathdisplay@a\ command differs from\MessageBreak
     waited value in this version of amsmath package.\MessageBreak
     We don't fix it!}
\fi
\renewcommand*{\intertext}[1][]{\@amsmath@err{\Invalid@@\intertext}\@eha}
\def\intertext@{%
  \def\intertext{%
    \ifvmode\else\\\@empty\fi
    \noalign{\ifnum0=`}\fi
      \@ifnextchar[{\NCC@intertext}{\NCC@intertext[]}%
  }%
}
\def\NCC@intertext[#1]#2{%
  \penalty\postdisplaypenalty
  \@ifempty{#1}{\vskip\belowdisplayskip}{\vskip#1\relax}%
  \vbox{\normalbaselines
    \ifdim\linewidth=\columnwidth
    \else \parshape\@ne \@totalleftmargin \linewidth
    \fi
    \noindent#2\par}%
  \penalty\predisplaypenalty
  \@ifempty{#1}{\vskip\abovedisplayskip}{\vskip#1\relax}%
  \ifnum0=`{\fi}%
}
\newif\ifNCC@shortskip \NCC@shortskipfalse
\newcommand{\useshortskip}{\global\NCC@shortskiptrue}
\def\NCC@ignorepar{\relax
  \ifNCC@shortskip
    \abovedisplayskip\abovedisplayshortskip
    \global\NCC@shortskipfalse
  \fi
  \ifmmode \else \ifvmode
    \addvspace{\abovedisplayskip}%
    \abovedisplayskip\z@skip
    \abovedisplayshortskip\z@skip
    \belowdisplayshortskip\belowdisplayskip
    \noindent
  \fi\fi
}
\let\NCC@startgather\start@gather
\let\NCC@startalign\start@align
\let\NCC@startmultline\start@multline
\let\NCC@startdisplay\mathdisplay
\def\start@gather{\NCC@ignorepar\NCC@startgather}
\def\start@align{\ifingather@\else\NCC@ignorepar\fi\NCC@startalign}
\def\start@multline{\NCC@ignorepar\NCC@startmultline}
\def\mathdisplay{\NCC@ignorepar\NCC@startdisplay}
\newenvironment{darray}[2][c]{%
  \null\,%
  \if #1t\vtop \else \if#1b \vbox \else \vcenter \fi \fi
  \bgroup
    \NCC@default@cr
    \spread@equation
    \NCC@mkpream{#2}%
    \edef\@preamble{\ialign \bgroup \strut@ \@preamble \tabskip\z@skip \cr}%
    \let\par\@empty \let\@sharp##%
    \set@typeset@protect
    \tabskip\z@skip
    \@preamble
}{%
    \crcr\egroup\egroup
}
\newcommand\dmulticolumn[3]{\multispan{#1}%
  \begingroup
    \NCC@mkpream{#2}%
    \def\@sharp{#3}\set@typeset@protect
    \@preamble
  \endgroup
  \ignorespaces
}
\def\NCC@mkpream#1{%
  \@lastchclass\@ne \@firstamptrue
  \settowidth\alignsep@{$\m@th\mskip\thickmuskip$}%
  \let\@sharp\relax
  \let\@preamble\@empty
  \let\protect\@unexpandable@protect
  \NCC@xexpast #1*0x\@@
  \expandafter \@tfor \expandafter \@nextchar
   \expandafter :\expandafter =\reserved@a \do
  {\@chclass
   \ifnum \@lastchclass=\tw@ \@ne \else
    \z@
    \edef\@nextchar{\expandafter\string\@nextchar}%
    \if \@nextchar @\@chclass \tw@ \else
     \@chnum
     \if \@nextchar c\z@ \else
      \if \@nextchar l\@ne \else
       \if \@nextchar r\tw@ \else
        \z@ \@preamerr \z@
       \fi
      \fi
     \fi
    \fi
   \fi
   \ifcase \@chclass
    \ifnum \@lastchclass=\z@ \@addtopreamble{\hskip \alignsep@}\fi
    \@addamp
    \@addtopreamble{%
      \ifcase \@chnum \hfil$\displaystyle{\@sharp}$\hfil
      \or             $\displaystyle{\@sharp}$\hfil
      \or             \hfil$\displaystyle{\@sharp}$%
      \fi
    }%
   \or
    \@addtopreamble{$\@nextchar$}%
   \fi
   \@lastchclass\@chclass
  }%
  \ifnum\@lastchclass=\tw@ \@preamerr\@ne \fi
}
\def\NCC@xexpast#1*#2#3#4\@@{%
  \edef\reserved@a{#1}%
  \@tempcnta#2\relax
  \ifnum\@tempcnta>\z@
    \@whilenum\@tempcnta>\z@\do
       {\edef\reserved@a{\reserved@a#3}\advance\@tempcnta \m@ne}%
    \let\reserved@b\NCC@xexpast
  \else
    \let\reserved@b\NCC@xexnoop
  \fi
  \expandafter\reserved@b\reserved@a #4\@@
}
\def\NCC@xexnoop #1\@@{}
\newenvironment*{fleqn}[1][\z@]{\@fleqntrue
  \setlength\@mathmargin{#1}\ignorespaces
}{%
  \ignorespacesafterend
}
\newenvironment{ceqn}{\@fleqnfalse
  \@mathmargin\@centering \ignorespaces
}{%
  \ignorespacesafterend
}
\newcommand{\eq}{\@ifstar{\NCC@eqx}{\NCC@eq}}
\def\NCC@eqx#1{\begin{equation*}#1\end{equation*}}
\def\NCC@eq#1{\begin{equation}#1\end{equation}}
\newcommand{\eqalign}{%
  \@ifstar{\let\@tempa\NCC@eqx \NCC@eqa}%
          {\let\@tempa\NCC@eq \NCC@eqa}%
}
\newcommand*{\NCC@eqa}[2][rcl]{%
  \@tempa{\begin{darray}{#1}#2\end{darray}}%
}
\newcommand{\eqs}{\@ifstar{\st@rredtrue\NCC@eqs}{\st@rredfalse \NCC@eqs}}
\newcommand*{\NCC@eqs}[2][]{%
  \begingroup\NCC@beqs{#1}#2\NCC@eeqs\endgroup\ignorespaces
}
\renewenvironment{eqnarray}{\st@rredfalse\NCC@beqs{}}
                           {\NCC@eeqs\ignorespacesafterend}
\renewenvironment{eqnarray*}{\st@rredtrue\NCC@beqs{}}
                            {\NCC@eeqs\ignorespacesafterend}
\def\NCC@beqs#1{%
  \NCC@ignorepar$$
  \inalign@true \intertext@ \displ@y@ \Let@
  \chardef\dspbrk@context\z@
  \let\math@cr@@@\NCC@eqcr \let\tag\tag@in@align
  \let\label\label@in@display \let\split\insplit@
  \ifst@rred\else \global\@eqnswtrue \fi
  \tabskip\@mathmargin
  \@ifempty{#1}{\settowidth\alignsep@{$\m@th\mskip\thickmuskip$}}%
               {\setlength\alignsep@{#1}}%
  \halign to \displaywidth\bgroup
    \strut@ \global\column@\z@ \hfil$\displaystyle{##}$\tabskip\z@skip
   &\column@plus \hskip\alignsep@ \hfil$\displaystyle{##}$\hfil
   &\column@plus \hskip\alignsep@ $\displaystyle{##{}}$\hfil
    \tabskip\@centering
   &\column@plus \llap{##}\tabskip\z@skip\cr
}
\def\NCC@eqcr{%
  \let\@tempa\relax
  \ifcase\column@ \def\@tempa{&&&}\or \def\@tempa{&&}\or\def\@tempa{&}%
  \else
    \let\@tempa\@empty
    \@latex@error{Too many columns in eqnarray environment}\@ehc
  \fi
  \@tempa
  \ifst@rred\nonumber\fi
  \if@eqnsw \global\tag@true \fi
  \iftag@ \@lign\strut@
    \iftagsleft@ \rlap{\hskip -\displaywidth\make@display@tag}%
    \else \make@display@tag \fi
  \fi
  \ifst@rred\else\global\@eqnswtrue\fi
  \cr
}
\def\NCC@eeqs{\math@cr\egroup$$}
\@ifundefined{NCC@op}{\endinput}{}
\DeclareRobustCommand\frac{\NCC@op@select\mfrac{\genfrac{}{}{}{}}}
\DeclareRobustCommand\binom{\NCC@op@select\mbinom{\genfrac()\z@{}}}
\def\NCC@op@select#1#2#3#4{%
  \mathchoice{#1{#3}{#4}}{#1{#3}{#4}}%
             {\scriptstyle#2{#3}{#4}}{\scriptscriptstyle#2{#3}{#4}}%
}
\def\@tempa#1#2{%
  \ifx#2\@undefined \let#2#1\fi
  \def#1{\DOTSB\medop{#2}}%
}
\@tempa \coprod    \coprod@
\@tempa \bigvee    \bigvee@
\@tempa \bigwedge  \bigwedge@
\@tempa \biguplus  \biguplus@
\@tempa \bigcap    \bigcap@
\@tempa \bigcup    \bigcup@
\@tempa \prod      \prod@
\@tempa \sum       \sum@
\@tempa \bigotimes \bigotimes@
\@tempa \bigoplus  \bigoplus@
\@tempa \bigodot   \bigodot@
\@tempa \bigsqcup  \bigsqcup@
\def\@tempa#1#2#3{\let#3#2%
  \DeclareRobustCommand#2{\mathop{\medmath{#3}}}%
  \def#1{\DOTSI\NCC@op@prepare{#2}}%
}
\@tempa\int  \intop  \NCC@op@int
\@tempa\oint \ointop \NCC@op@oint
\let\@tempa\relax
\renewcommand*{\MultiIntegral}[1]{%
  \edef\NCC@op{\noexpand\intop
    \ifnum#1=\z@\noexpand\intdots@\else\noexpand\intkern@\fi
    \ifnum#1>\tw@\noexpand\intop\noexpand\intkern@\fi
    \ifnum#1>\thr@@\noexpand\intop\noexpand\intkern@\fi
    \noexpand\intop
  }%
  \let\NCC@op@print\NCC@op@printm
  \NCC@op@prepare@
}
\def\intkern@{\kern-\NCC@op@kern}
\def\intdots@{\setlength\@tempdima{\NCC@op@kern}%
  \kern-.4\@tempdima{\cdotp}\mkern1.5mu{\cdotp}%
  \mkern1.5mu{\cdotp}\kern-.4\@tempdima}
\endinput
%%
%% End of file `nccmath.sty'.
