%%
%% This is file `manyfoot.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% manyfoot.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: manyfoot.dtx Copyright (C) 1998--2005 by Alexander I. Rozhenko
%%
\NeedsTeXFormat{LaTeX2e}[1993/12/01]
\ProvidesPackage{manyfoot}
      [2005/09/11 v1.10 Many Footnote Levels Package (NCC)]
\RequirePackage{nccfoots}
\newcommand{\extrafootnoterule}{}
\DeclareOption{ruled}{\def\extrafootnoterule{\defaultfootnoterule}}
\newdimen\MFL@columnwidth
\def\MFL@floathook{\MFL@columnwidth\columnwidth}
\long\def\MFL@insert#1#2{%
  \insert#1{\splittopskip\footnotesep \splitmaxdepth \dp\strutbox
    \floatingpenalty\@MM #2%
  }%
  \FN@mf@prepare
}
\providecommand\FN@mf@prepare{}
\let\MFL@realinsert\MFL@insert
\def\MFL@applyhook#1{\csname MFL@hook\string#1\endcsname}
\let\MFL@startplain\@gobble
\@onlypreamble\MFL@startplain
\let\MFL@processplain\@gobble
\long\def\MFL@fnoteplain#1#2#3{\NCC@makefnmark{#2}%
  \MFL@insert#1{\reset@font\footnotesize
    \interlinepenalty\interfootnotelinepenalty
    \hsize\MFL@columnwidth \@parboxrestore
    \protected@edef\@currentlabel{\@thefnmark}%
    \color@begingroup
      \MFL@applyhook{#1}%
      \@makefntext{%
        \rule\z@\footnotesep\ignorespaces#3\@finalstrut\strutbox}%
    \color@endgroup
  }%
}
\newif\ifMFL@paraindent \MFL@paraindenttrue
\DeclareOption{para}{%
  \newskip\footglue
  {\footnotesize \global\footglue=1em plus.3em minus.3em }
  \newif\ifMFL@split  \MFL@splitfalse
  \newcommand\SplitNote{\MFL@splittrue}
  \def\MFL@startpara#1{%
    \global\advance\skip#1\MFL@paraskip
    \MFL@setsplit{#1}{\MFL@applyhook{#1}}%
  }
  \@onlypreamble\MFL@startpara
  \def\MFL@fnotepara#1#2#3{\let\@thefnmark\@empty
    \NCC@makefnmark{#2}%
    \MFL@insert#1{\reset@font\footnotesize
      \ifx\@thefnmark\@empty \@tempswafalse \else
        \@tempswatrue
        \protected@edef\@currentlabel{\@thefnmark}%
      \fi
      \color@begingroup
        \if@tempswa
          \setbox\@tempboxa\hbox{\@makefnmark}%
          \ifMFL@paraindent
            \@tempdima.8em \advance\@tempdima-\wd\@tempboxa
            \ifdim \@tempdima<\z@ \@tempdima\z@ \fi
          \else
            \@tempdima\z@
          \fi
        \fi
        \setbox\@tempboxa\hbox{%
          \if@tempswa
            \hskip\@tempdima\unhbox\@tempboxa\nobreak
          \fi
          \ignorespaces#3\unskip\strut
          \ifMFL@split \penalty\m@ne\space \else
            \penalty-10 \hskip\footglue
          \fi
        }%
        \dp\@tempboxa\z@ \ht\@tempboxa\MFL@fudgefactor\wd\@tempboxa
        \box\@tempboxa
      \color@endgroup
    }%
  }
  \def\MFL@processpara#1{%
    \advance\@tempskipa -\MFL@paraskip
    \edef\MFL@skip{\vskip\the\@tempskipa\relax}%
    \setbox#1\vbox{%
      \unvbox#1\setbox\@tempboxa\hbox{}\MFL@makehhbox
      \setbox\@tempboxa\hbox{\unhbox\@tempboxa\MFL@removehboxes}%
      \footnotesize
      \hsize\MFL@columnwidth \@parboxrestore
      \ifMFL@paraindent
        \@ifundefined{footnotemargin}%
          {\parindent\footglue}%
          {\parindent\footnotemargin\relax
           \ifdim\parindent<\z@ \parindent\footglue
           \else \advance\parindent -0.8em \fi}%
      \fi
      \csname MFL@split\string#1\endcsname
      \rule\z@\footnotesep
      \unhbox\@tempboxa\unskip
      \ifnum\lastpenalty=\m@ne \parfillskip\z@
        \MFL@setsplit{#1}{\noindent}%
      \else
        \MFL@setsplit{#1}{\MFL@applyhook{#1}}%
      \fi
    }%
  }
  \def\MFL@makehhbox{%
    \loop\setbox\z@\lastbox \ifhbox\z@
      \setbox\@tempboxa\hbox{\box\z@\unhbox\@tempboxa}%
    \repeat
    \ifvbox\z@ \unvbox\z@ \MFL@makehhbox \fi
  }
  \def\MFL@removehboxes{\setbox\@tempboxa\lastbox
    \ifhbox\@tempboxa{\MFL@removehboxes}\unhbox\@tempboxa\fi
  }
  \def\MFL@setsplit#1#2{%
    \expandafter\gdef\csname MFL@split\string#1\endcsname{#2}%
  }
  \g@addto@macro\MFL@floathook{%
    \begingroup
      \footnotesize \@tempdima\normalbaselineskip
      \multiply \@tempdima \@cclvi
      \@tempdimb \columnwidth
      \divide \@tempdimb \@cclvi
      \divide \@tempdima \@tempdimb
      \xdef\MFL@fudgefactor{\strip@pt\@tempdima}%
    \endgroup
  }
  \newcommand*\ExtraParaSkip[1]{%
    \def\MFL@xparaskip{\advance\@tempdima#1\relax}%
  }
  \let\MFL@xparaskip\relax
  \@onlypreamble\ExtraParaSkip
  \@onlypreamble\MFL@xparaskip
  \AtBeginDocument{%
    \begingroup
      \footnotesize
      \@tempdima\footnotesep
      \advance\@tempdima -\ht\strutbox
      \ifdim\@tempdima<\z@ \@tempdima\z@ \fi
      \advance\@tempdima.5\normalbaselineskip
      \MFL@xparaskip % Add extra para skip
      \xdef\MFL@paraskip{\the\@tempdima\relax}%
    \endgroup
  }
}
\DeclareOption{para*}{%
  \@ifundefined{MFL@startpara}{\ExecuteOptions{para}}{}%
  \MFL@paraindentfalse
}
\newif\ifMFL@perpage \MFL@perpagefalse
\DeclareOption{perpage}{\MFL@perpagetrue}
\ProcessOptions\relax
\ifMFL@perpage \RequirePackage{perpage}\fi
\def\MFL@list{}
\newcommand*{\SelectFootnoteRule}[2][0]{%
  \edef\@tempa{\noexpand\MFL@selectrule{#1}{%
    \expandafter\noexpand\csname #2footnoterule\endcsname}}%
  \@ifnextchar[{\@tempa}{\@tempa[]}%
}
\def\MFL@selectrule#1#2[#3]{\def\MFL@rule{\MFL@joinrule{#1}{#2}{#3}}}
\SelectFootnoteRule{extra}% Set the default footnote rule
\@onlypreamble\SelectFootnoteRule
\@onlypreamble\MFL@selectrule
\@onlypreamble\MFL@rule
\newcommand{\SetFootnoteHook}[1]{\def\MFL@footnotehook{\MFL@fhook{#1}}}
\@onlypreamble\SetFootnoteHook
\@onlypreamble\MFL@footnotehook
\SetFootnoteHook{}% Empty hook by default
\long\def\MFL@fhook#1#2{%
  \expandafter\def\csname MFL@hook\string#2\endcsname{#1}%
  \SetFootnoteHook{}%
}
\@onlypreamble\MFL@fhook
\newcommand*{\newfootnote}[2][plain]{%
  \@ifundefined{MFL@fnote#1}{%
    \PackageError{manyfoot}{Unknown footnote style #1}%
      {Known styles are `plain' and `para'\MessageBreak
       (if the package was loaded with the para or para* option)}}{}%
  \expandafter\MFL@newinsert\csname footins#2\endcsname
  \edef\@tempa{\noexpand\newcommand
    \expandafter\noexpand\csname Footnotetext#2\endcsname
      {\expandafter\noexpand\csname MFL@fnote#1\endcsname{%
        \expandafter\noexpand\csname footins#2\endcsname}}%
    \noexpand\MFL@footnotehook{%
      \expandafter\noexpand\csname footins#2\endcsname}%
  }%
  \@tempa
  \@cons\MFL@list{{#1}\csname footins#2\endcsname}%
}
\@onlypreamble\newfootnote
\def\MFL@newinsert#1{\newinsert#1%
  \expandafter\let\csname MFL@join\number #1\endcsname \MFL@rule
  \SelectFootnoteRule{extra}% Reset to default rule again
  \skip#1\skip\footins \dimen#1\dimen\footins \count#1\count\footins
}
\@onlypreamble\MFL@newinsert
\def\MFL@makemark#1#2#3{%
  \FN@mf@check
  \@ifnextchar[{\MFL@xmkmark{#1}{#3}}{#2{#1}\MFL@mkmark{#1}{#3}}%
}
\providecommand\FN@mf@check{}
\def\MFL@xmkmark#1#2[#3]{%
  \begingroup
    \csname c@#1\endcsname #3\relax
    \unrestored@protected@xdef\@thefnmark{\csname the#1\endcsname}%
  \endgroup
  #2%
}
\def\MFL@mkmark#1#2{\protected@xdef\@thefnmark{\csname the#1\endcsname}%
  #2%
}
\newcommand*{\DeclareNewFootnote}[2][plain]{%
  \@ifnextchar[{\MFL@declare{#1}{#2}}{\MFL@declare{#1}{#2}[arabic]}%
}
\def\MFL@declare#1#2[#3]{%
  \newfootnote[#1]{#2}%
  \edef\@tempa{\noexpand\newcounter{footnote#2}%
    \noexpand\renewcommand
    \expandafter\noexpand\csname thefootnote#2\endcsname{%
      \expandafter\noexpand\csname @#3\endcsname
      \expandafter\noexpand\csname c@footnote#2\endcsname
    }%
    \ifMFL@perpage \noexpand\MakePerPage{footnote#2}\fi
    \noexpand\newcommand
    \expandafter\noexpand\csname footnote#2\endcsname{%
      \noexpand\MFL@makemark{footnote#2}{\noexpand\stepcounter}{%
        \noexpand\@footnotemark
        \noexpand\let\noexpand\@tempb\noexpand\@thefnmark
        \expandafter\noexpand\csname Footnotetext#2\endcsname{%
          \noexpand\@tempb
        }%
      }%
    }%
    \noexpand\newcommand
    \expandafter\noexpand\csname footnotemark#2\endcsname{%
      \noexpand\MFL@makemark{footnote#2}{\noexpand\stepcounter}{%
        \noexpand\@footnotemark
      }%
    }%
    \noexpand\newcommand
    \expandafter\noexpand\csname footnotetext#2\endcsname{%
      \noexpand\MFL@makemark{footnote#2}{\noexpand\@gobble}{%
        \noexpand\let\noexpand\@tempb\noexpand\@thefnmark
        \expandafter\noexpand\csname Footnotetext#2\endcsname{%
          \noexpand\@tempb
        }%
      }%
    }%
    \noexpand\newcommand
    \expandafter\noexpand\csname Footnotemark#2\endcsname{%
      \noexpand\Footnotemark
    }%
    \noexpand\newcommand
    \expandafter\noexpand\csname Footnote#2\endcsname[1]{%
      \noexpand\Footnotemark{####1}%
      \expandafter\noexpand\csname Footnotetext#2\endcsname{####1}%
    }%
  }%
  \@tempa
}
\@onlypreamble\DeclareNewFootnote
\@onlypreamble\MFL@declare
\def\MFL@start#1{\csname MFL@start#1\endcsname}
\@onlypreamble\MFL@start
\newcommand{\footnoterulepriority}{1}
\newif\ifMFL@joined \MFL@joinedfalse
\def\MFL@joinnotes#1{%
  \ifMFL@joined #1%
  \else
    \let\MFL@savedrule \footnoterule
    \let\MFL@currule \defaultfootnoterule
    \ifvoid \footins
      \let\MFL@curpriority \footnoterulepriority
    \else
      \let\MFL@curpriority \m@ne
    \fi
    \let\MFL@elt\@elt
    \let\@elt\MFL@join \MFL@list
    \let\@elt\MFL@elt
    \MFL@joinedtrue #1\MFL@joinedfalse
    \let\footnoterule \MFL@savedrule
  \fi
}
\def\MFL@join#1#2{\csname MFL@join\number #2\endcsname{#1}{#2}}
\def\MFL@joinrule#1#2#3#4#5{%
  \ifnum #1<\MFL@curpriority \else
    \let\MFL@currule#2%
    \def\MFL@curpriority{#1}%
  \fi
  \ifvoid#5\else
    \@tempskipa\skip#5%
    \MFL@ifmcol{\divide\@tempskipa\col@number}{}%
    \edef\MFL@skip{\vskip\the\@tempskipa\relax}%
    \csname MFL@process#4\endcsname #5%
    \ifvoid\footins
      \let\footnoterule\MFL@currule
      \setbox\footins\vbox{#3\unvbox#5}%
    \else
      \setbox\footins\vbox{%
        \unvbox\footins\MFL@skip\MFL@currule#3\unvbox#5%
      }%
    \fi
    \let\MFL@curpriority \m@ne
  \fi
}
\def\MFL@reinsout#1#2{\ifvoid#2\else
    \ifnum\count\@currbox>\z@
      \advance\@pageht \ht#2%
      \advance\@pageht \skip#2%
      \advance\@pageht \dp#2%
    \fi
    \insert#2{\unvbox#2}%
  \fi
}
\def\MFL@reinsert{{\let\@elt\MFL@reins \MFL@list}}
\def\MFL@reins#1#2{\ifvoid#2\else\insert#2{}\fi}
\long\def\MFL@mpinsert#1#2{%
  \global\setbox#1\vbox{%
    \unvbox#1\setbox\@tempboxa\lastbox
    \ifvbox\@tempboxa \unvbox\@tempboxa \fi
    \vbox{#2}%
  }%
}
\def\MFL@mpreinsert#1#2{%
  \ifvoid#2\else
    \setbox\@tempboxa\vbox{\unvbox#2\global\setbox#2\lastbox}%
    \setbox\z@\box#2%
    \ifdim\ht\@tempboxa>\z@ \MFL@realinsert#2{\box\@tempboxa}\fi
    \MFL@realinsert#2{\unvbox\z@}%
  \fi
}
\def\MFL@minipage{%
  \ifinner\else
    \MFL@reinsert \let\MFL@insert\MFL@mpinsert
  \fi
}
\def\MFL@endminipage{%
  \ifinner\else
    {\let\@elt\MFL@mpreinsert \MFL@list}%
  \fi
}
\def\MFL@mult#1#2{%
  \multiply\count#2\col@number
  \multiply\skip#2\col@number
}
\def\MFL@ifmcol#1#2{\@tempswafalse
  \ifnum\col@number>\@ne
    \ifnum\count\footins>1999 \@tempswatrue \fi
  \fi
  \if@tempswa #1\else #2\fi
}
\AtBeginDocument{%
  {\let\@elt\MFL@start \MFL@list}
  \@ifundefined{defaultfootnoterule}{%
    \@ifundefined{pagefootnoterule}%
      {\let\defaultfootnoterule\footnoterule}%
      {\let\defaultfootnoterule\pagefootnoterule}%
  }{}%
  \let\MFL@doclearpage\@doclearpage
  \def\@doclearpage{\MFL@joinnotes\MFL@doclearpage}
  \let\MFL@makecol\@makecol
  \def\@makecol{\MFL@joinnotes\MFL@makecol}
  \g@addto@macro\@reinserts{%
    \let\MFL@elt\@elt
    \let\@elt\MFL@reinsout \MFL@list
    \let\@elt\MFL@elt
  }
  \MFL@floathook
  \g@addto@macro\@floatplacement{\MFL@ifmcol{}{\MFL@floathook}}
  \let\MFL@iminipage\@iiiminipage
  \def\@iiiminipage{\MFL@minipage\MFL@iminipage}
  \g@addto@macro\endminipage\MFL@endminipage
  \@ifundefined{multi@column@out}
    {\@onlypreamble\MFL@mult \let\MFL@ifmcol\@secondoftwo}
    {\let\MFL@mcolout\multi@column@out
      \def\multi@column@out{\MFL@joinnotes\MFL@mcolout}
      \g@addto@macro\init@mult@footins{%
        \let\MFL@elt\@elt
        \let\@elt\MFL@mult \MFL@list
        \let\@elt\MFL@elt
      }
      \g@addto@macro\reinsert@footnotes{\MFL@reinsert}
    }
}
\endinput
%%
%% End of file `manyfoot.sty'.
