%%
%% This is file `nccfloats.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% nccfloats.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: nccfloats.dtx Copyright (C) 2002--2006 by Alexander I. Rozhenko
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{nccfloats}
         [2006/01/07 v1.2 More Float Management (NCC)]
\RequirePackage{nccboxes}[2002/03/20]
\newcommand*{\FloatStyle}[2][]{%
  \expandafter\def\csname NCC@fltstyle@#1\endcsname{#2}}
\@onlypreamble\FloatStyle
\def\NCC@setfltstyle#1{%
  \edef\@tempa{NCC@fltstyle@#1\@captype}%
  \@ifundefined{\@tempa}{\NCC@fltstyle@}{\csname\@tempa\endcsname}%
}
\g@addto@macro\@floatboxreset{\NCC@setfltstyle{}}
\newcommand\normalfloatstyle{%
  \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
  \parfillskip\@flushglue \let\\\@normalcr
  \reset@font \normalsize
}
\newcommand*\NCC@minifloat[1][c]{%
  \@ifnextchar[{\NCC@mflt{#1}}{\NCC@@mflt{#1}\relax[s]}}
\def\NCC@mflt#1[#2]{%
  \@ifnextchar[{\NCC@@mflt{#1}{#2}}{\NCC@mflt{#1}{#2}[#1]}}
\long\def\NCC@@mflt#1#2[#3]#4#5{%
  \@iiiminipage{#1}{#2}[#3]{#4}\normalfloatstyle
  \NCC@setfltstyle{mini}#5\endminipage\endgroup
}
\def\NCC@pair#1#2#3#4{\setlength\@tempdimc{#3}%
  \@ifstar{\NCC@pair@{#2}{#4}}{\NCC@pair@{#1}{#4}}}
\def\NCC@pair@#1#2{\@ifnextchar[{\NCC@pair@@{#1}}{\NCC@pair@@{#1}[#2]}}
\def\NCC@pair@@#1[#2]{\def\@tempa{#1{#2}}%
  \@ifnextchar({\NCC@pair@@@}{\NCC@@pair()()}}
\def\NCC@pair@@@(#1){\@ifnextchar({\NCC@@pair(#1)}{\NCC@@pair(#1)()}}
\def\NCC@@pair(#1)(#2){\@tempa{#1}{#2}}
\def\NCC@setwidth#1#2{\@defaultunits#1#2\unitlength\relax\@nnil}
\def\NCC@wcalc#1#2{%
  \if!#1!\@tempdima .5\linewidth \advance\@tempdima -.5\@tempdimc
  \else  \NCC@setwidth\@tempdima{#1}%
  \fi
  \if!#2!\@tempdimb \linewidth \advance\@tempdimb -\@tempdima
         \advance\@tempdimb -\@tempdimc
  \else  \NCC@setwidth\@tempdimb{#2}%
         \@tempdimc \linewidth \advance\@tempdimc -\@tempdima
         \advance\@tempdimc -\@tempdimb
  \fi
}
\newif\ifNCC@smfltleft
\newcommand{\ifleftsidefloat}{%
  \ifNCC@smfltleft
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}
\def\NCC@sidemfloat#1{%
  \NCC@smfltleftfalse
  \if@twocolumn \else
    \if@twoside
      \ifodd\c@page \else \NCC@smfltlefttrue \fi
    \fi
  \fi
  \NCC@pair{\NCC@smflt{#1}}%
    {\ifNCC@smfltleft \NCC@smfltleftfalse \else \NCC@smfltlefttrue\fi
     \NCC@smflt{#1}}%
    {1.5em}{}%
}
\long\def\NCC@smflt#1#2#3#4#5#6{%
  \let\NCC@t\relax \let\NCC@b\relax \let\NCC@j\relax \let\NCC@n\strut
  \@tfor\@tempa :=#2\do {%
    \expandafter\let\csname NCC@\@tempa\endcsname\@empty}%
  \ifx\NCC@t\@empty \def\NCC@c{t}\else
   \ifx\NCC@b\@empty \def\NCC@c{b}\else
    \def\NCC@c{c}%
   \fi
  \fi
  \ifx\NCC@j\@empty \def\NCC@j{\parfillskip\z@skip}\fi
  \edef\NCC@t{\parindent\the\parindent\ifvmode\else\noindent\fi}%
  \ifvmode\else
    \unskip{\parfillskip\rightskip\par}\vskip -\parskip
  \fi
  \setbox\@tempboxa\vbox{\hsize\linewidth\noindent
    \NCC@wcalc{#3}{#4}%
    \ifNCC@smfltleft
      \jparbox{\Strut}[\NCC@c]\@tempdima{#1\@tempdima{#5}}%
      \nobreak\hskip\@tempdimc
    \fi
    \jparbox{\NCC@n\Strut}[\NCC@c]\@tempdimb{%
      \everypar{\NCC@n\everypar{}}\NCC@t#6%
      \ifvmode \else \unskip\NCC@n\NCC@j\fi}%
    \ifNCC@smfltleft \else
      \nobreak\hskip\@tempdimc
      \jparbox{\Strut}[\NCC@c]\@tempdima{#1\@tempdima{#5}}%
    \fi
  }%
  \@tempdima\dp\@tempboxa \advance\@tempdima\lineskip
  \dp\@tempboxa\@tempdima
  \@tempdima\ht\@tempboxa \advance\@tempdima -\ht\strutbox
  \noindent \raise-\@tempdima\box\@tempboxa
}
\def\NCC@float#1#2{\@ifstar{\NCC@flt{#1*}{#2}}{\NCC@flt{#1}{#2}}}
\def\NCC@flt#1#2{\@ifnextchar[{\NCC@flt@{#1}}{\NCC@flt@{#1}[#2]}}
\def\NCC@flt@#1[#2]{\begin{#1}[#2]\normalfloatstyle\centering
 \@ifnextchar({\NCC@@flt{#1}}{\NCC@@flt{#1}()}}
\long\def\NCC@@flt#1(#2)#3{%
  \if!#2!\@tempdima\linewidth \else \NCC@setwidth\@tempdima{#2}\fi
  \begingroup\NCC@minifloat[c]\@tempdima{#3}%
  \end{#1}%
}
\def\NCC@floats#1#2#3{%
  \NCC@pair{\NCC@@flts{#1}{#2}}{\NCC@@flts{#1*}{#2}}{1em}{#3}}
\long\def\NCC@@flts#1#2#3#4#5#6#7{%
  \begin{#1}[#3]\normalfloatstyle\NCC@wcalc{#4}{#5}%
    \begingroup\NCC@minifloat[#2]\@tempdima{#6}%
    \nobreak\hskip\@tempdimc
    \begingroup\NCC@minifloat[#2]\@tempdimb{#7}%
  \end{#1}%
}
\newcommand*\newminifloat[4]{%
  \edef\@tempa{%
    \noexpand\newcommand\expandafter\noexpand\csname mini#1\endcsname{%
      \noexpand\begingroup\noexpand\def\noexpand\@captype{#2}%
      \noexpand\NCC@minifloat}%
    \noexpand\newcommand\expandafter\noexpand\csname side#1\endcsname{%
      \noexpand\NCC@sidemfloat{%
        \expandafter\noexpand\csname mini#1\endcsname}}%
    \noexpand\newcommand\expandafter\noexpand\csname #1\endcsname{%
      \noexpand\NCC@float{#2}{#3}}%
    \noexpand\newcommand\expandafter\noexpand\csname #1s\endcsname{%
      \noexpand\NCC@floats{#2}{#4}{#3}}%
  }%
  \@tempa
}
\@onlypreamble\newminifloat
\newminifloat{fig}{figure}{ht}{b}
\newminifloat{tabl}{table}{ht}{t}
\FloatStyle{}
\FloatStyle[minifigure]{\footnotesize\centering}
\FloatStyle[minitable]{\footnotesize\centering}
\endinput
%%
%% End of file `nccfloats.sty'.
