%%
%% This is file `bigfoot.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% bigfoot.dtx  (with options: `style')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from bigfoot.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file bigfoot.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%
%% bigfoot is part of the bigfoot bundle for critical typesetting
%% Copyright 2004--2015  David Kastrup <dak@gnu.org>
%%
%% The license notice and corresponding source code for this file are
%% contained in bigfoot.dtx.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{bigfoot}[2015/08/30 2.1 makes footnotes work]

\DeclareOption{para}{\PackageInfo{bigfoot}{Compatibility option `para'
  has no effect:^^J%
  Spacing will be guessed from `\string\@makefntext' unless^^J%
  `\string\@preparefnhtext' is redefined}}

\DeclareOption{para*}{\PackageInfo{bigfoot}{Compatibility option
    `para*':^^J%
    Redefining `\string\@preparefnhtext'}%
  \def\@preparefnhtext{\ifx\@thefnmark\@empty
    \else\@makefnmark\nobreak\fi}}

\DeclareOption{ruled}{\PassOptionsToPackage{ruled}{manyfoot}}
\DeclareOption{robust}{\def\FN@makefncall{\FN@makefnrobust}}
\DeclareOption{fragile}{\def\FN@makefncall{\FN@makefnfragile}}
\ExecuteOptions{robust}
\DeclareOption{verbose}{\AtBeginDocument{%
    \def\@testdef #1#2#3{%
      \def\reserved@a{#3}%
      \expandafter \ifx \csname #1@#2\endcsname
        \reserved@a
      \else \@tempswatrue
        \typeout{Changed label #1/#2:
          \csname #1@#2\endcsname->#3}%
      \fi}}}
\ProcessOptions*
\ifx\hypersetup\@undefined
  \PassOptionsToPackage{hyperfootnotes=false}{hyperref}
\else
  \hypersetup{hyperfootnotes=false}
\fi
\ifx\e@alloc\@undefined
\RequirePackage{etex}
\fi
\RequirePackage{manyfoot}
\RequirePackage{suffix}
\RequirePackage{perpage}
\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
    \MFL@realinsert{#2}{\unvbox#2}%
  \fi
}
\def\MFL@reins#1#2{\ifvoid#2\else\insert#2{\floatingpenalty\@MM}\fi}
\long\def\MFL@mpinsert#1#2{%
  \global\setbox#1\vbox{%
    \unvbox#1%
    \nointerlineskip
    \vbox{#2}%
  }%
}

\def\FN@divert{%
  \let\MFL@mpinsertsave\MFL@insert
  \MFL@reinsert \let\MFL@insert\MFL@mpinsert}
\def\FN@enddivert{{\let\@elt\MFL@mpreinsert \MFL@list}}

\def\MFL@minipage{\ifinner\else \FN@divert\fi}
\def\MFL@endminipage{\ifinner\else \FN@enddivert\fi}
\def\MFL@mpreinsert#1#2{%
  \ifvoid#2\else
    \setbox\@tempboxa\vbox\bgroup\unvbox#2%
      \global\setbox#2\lastbox
      \setbox\z@\lastbox
      \ifvoid\z@
        \egroup
        \setbox\z@\box#2%
      \else
        \MFL@removevboxes \unvbox\z@
        \egroup
        \setbox\z@\box#2%
        \MFL@mpinsertsave#2{\unvbox\@tempboxa}%
      \fi
    \ifvoid\z@\else
      \MFL@mpinsertsave#2{\unvbox\z@}%
    \fi
    \marks\FN@slave{\number\FN@id}%
  \fi}
\def\MFL@removevboxes{{\setbox\z@\lastbox
    \ifvbox\z@ \MFL@removevboxes \unvbox\z@\fi}}
\ifx\NCC@makemark\@undefined
  \ifx\NCC@makefnmark\@undefined \else
    \def\NCC@makemark{\NCC@makefnmark}
  \fi
\fi
\def\MFL@startplain#1{\global\dimen#1\maxdimen
  \@cons\FN@nestlist{{}#1}%
  \expandafter\expandafter\expandafter\newbox\FN@cache#1}

\let\MFL@startpara\MFL@startplain
\def\RestyleFootnote#1#2{\expandafter\xdef
  \csname Footnotetext#1\endcsname{\expandafter
    \noexpand\csname MFL@fnote#2\endcsname{\csname footins#1\endcsname}}}
\expandafter\def\expandafter\FN@stripfootins\string\footins{}

\def\FN@restylefootnote#1#2{{\edef\next{%
      \noexpand\RestyleFootnote{\expandafter\FN@stripfootins
        \string#1}{#2}}\next}}
\def\FN@specific#1#2{\romannumeral
  \ifcsname FN\string#2\number#1\endcsname
  \expandafter
    \z@\csname FN\string#2\number#1\expandafter\endcsname
  \else\expandafter\z@
    \expandafter#2\fi}
\def\FootnoteSpecific#1{\count@\csname footins#1\endcsname\toks@{}%
  \FN@specific@ii}

\long\def\FN@specific@ii#1#2{\toks@\expandafter{\the\toks@#1}%
  \the\expandafter\toks@
  \csname FN\string#2\number\count@\endcsname}

\WithSuffix\def\FN@specific@ii\long{\toks@\expandafter
  {\the\toks@\long}\FN@specific@ii}

\WithSuffix\def\FN@specific@ii\global{\toks@\expandafter
  {\the\toks@\global}\FN@specific@ii}

\WithSuffix\def\FN@specific@ii\expandafter{\expandafter
  \FN@specific@ii\expandafter}
\def\FN@slotxdef#1{%
  \global\expandafter\xdef\csname FN@slot#1\endcsname}

\def\FN@slotget#1{\csname FN@slot#1\endcsname}
\def\FN@slotfreelist{}
\def\FN@nextslot{1}
\def\FN@newslot#1{%
  \ifx\FN@slotfreelist\@empty
    \edef#1{\FN@nextslot}%
    \xdef\FN@nextslot{\number\numexpr \FN@nextslot+\@ne}%
  \else
    \let#1\FN@slotfreelist
    \xdef\FN@slotfreelist{\csname FN@slot\FN@slotfreelist\endcsname}%
  \fi
}
\def\FN@freeslot#1{%
  \global\expandafter\let\csname FN@slot#1\endcsname=\FN@slotfreelist
  \xdef\FN@slotfreelist{#1}}
\global\let\FN@stacklist\@empty
\def\DefineFootnoteStack#1{%
  \global\expandafter\let\csname FN@stack@#1\endcsname\@empty
  \@cons\FN@stacklist{{#1}}%
}
\AtEndDocument{\FN@checkstacklist}

\def\FN@checkstacklist{{\let\@elt\FN@checkstack
  \FN@stacklist}}

\def\FN@checkstack#1{{\let\@elt\FN@checkstackentry
    \csname FN@stack#1@\endcsname}}

\def\FN@checkstackentry#1#2#3{%
  \PackageError{bigfoot}{Unfinished #1 #2 from line #3}%
  {The specified footnote range is uncomplete}}
\def\PushFootnoteMark#1{{\let\@elt\relax
  \expandafter\unrestored@protected@xdef \csname FN@stack@#1\endcsname
  {\@elt{#1}{\@thefnmark}{\number\inputlineno}\csname
  FN@stack@#1\endcsname}}}
\def\PopFootnoteMark#1{\expandafter
  \ifx\csname FN@stack@#1\endcsname\@empty
    \PackageError{bigfoot}{Empty footnote stack #1}%
    {The specified footnote type has no uncompleted range}%
  \else
  {\let\@elt\FN@firstpop
    \iffalse{\fi\csname FN@stack@#1\endcsname}}\fi}
\def\FN@firstpop#1#2#3{\protected@xdef\@thefnmark{#2}%
  \let\@elt\relax
  \expandafter\protected@xdef\csname FN@stack@#1\endcsname{%
    \iffalse}\fi}
\ifx\FN@beforebreak\@undefined
  \let\FN@beforebreak\@empty
\fi
\ifx\FN@afterbreak\@undefined
  \let\FN@afterbreak\@empty
\fi
\def\FN@cache#1{\csname FN@cache\number#1\endcsname}
\def\FN@sortlist{{%
  \setbox\z@\lastbox
  \ifvoid\z@ \else \FN@sortlist\FN@sortlistii \fi}}

\def\FN@sortlistii{%
  \setbox\tw@\lastbox
  \ifvoid\tw@\else
  \ifdim\wd\tw@<\wd\z@ {\FN@sortlistii}%
  \fi\nointerlineskip\box\tw@\fi\nointerlineskip\box\z@}
\def\FN@sortinsert#1#2{\ifvoid\FN@cache#2%
  \ifvoid#2\else\global\setbox#2\vbox{\unvbox#2%
    \FN@sortlist}\fi\fi}
\def\FN@maybeinvalidatecache#1#2{%
  \ifvoid#2\else\global\setbox\FN@cache#2=\box\voidb@x\fi}
\def\FN@regeneratecache#1#2{%
   \global\setbox\FN@cache#2=%
   \ifvoid#2%
     \box\voidb@x
   \else
     \vbox{\vbox{\unvcopy#2%
         \setbox\z@\lastbox
         \def\FN@masterinsert{#2}%
         \FN@assembleboxes
         \global\setbox\FN@cache#2\box\z@}%
       \nointerlineskip \box\FN@cache#2}%
    \fi}
\def\FN@mayberegeneratecache#1#2{%
  \ifvoid\FN@cache#2%
    \FN@regeneratecache{}#2%
  \fi}
\def\FN@cachesize#1#2{%
  \ifvoid\FN@cache#2%
  \else
    +\skip#2+(\ht\FN@cache#2+\dp\FN@cache#2)*\count#2/\@m
  \fi}
\def\FN@clearcache#1#2{%
  \global\setbox\FN@cache#2=\box\voidb@x}
\def\@makefnvtext#1{%
  \FN@specific\FN@masterinsert\@makefntext{%
    \clubpenalties\thr@@\@MM\clubpenalty\z@
    \vadjust{\nobreak\vskip-\baselineskip}\nobreak\hfill\break#1}}
\ifx\@preparefnhtext\@undefined
\def\@preparefnhtext{{%
  \setbox\z@\vbox{\FN@specific\FN@masterinsert\@makefntext{%
      \unskip\unpenalty\setbox\z@\lastbox
      \dimen@
        \ifnum\parshape>\z@
          \dimexpr\parshapeindent\tw@-\parshapeindent\@ne\relax
        \else \ifnum\hangafter=\@ne\hangindent \else
          \ifnum\hangafter=\m@ne -\hangindent
          \else \z@ \fi\fi\fi
      \dimen@ii\dimen@
      \ifhbox\z@ \advance\dimen@-\wd\z@
        \setbox\z@\hbox{\unhbox\z@}%
        \advance\dimen@\wd\z@
      \fi
      \xdef\FN@tempinfo{\hskip\the\dimen@
        \vadjust{}\nobreak\hskip-\the\dimen@ii\relax}}}}%
  \FN@tempinfo}
\fi
\def\@makefnstartbox{%
  \ifdefined\setspace@singlespace
    \def\baselinestretch{\setspace@singlespace}%
  \fi
  \reset@font\footnotesize
  \hsize\MFL@columnwidth \@parboxrestore
  \interlinepenalty\FN@specific\FN@masterinsert\interfootnotelinepenalty
  \widowpenalty\FN@specific\FN@masterinsert\footnotewidowpenalty
  \clubpenalty\FN@specific\FN@masterinsert\footnoteclubpenalty
  \advance\linepenalty500\relax}

\def\@makefnendbox{%
  \widowpenalty\FN@specific\FN@masterinsert\finalfootnotewidowpenalty}

\newcount\footnotewidowpenalty
\footnotewidowpenalty=250
\newcount\footnoteclubpenalty
\footnoteclubpenalty=250
\newcount\finalfootnotewidowpenalty
\finalfootnotewidowpenalty=4000
\ifx\@makefnvbox\@undefined
  \def\@makefnvbox#1{\vbox{%
      \@makefnstartbox
      \clubpenalties\thr@@\@MM\clubpenalty\z@
      \let\@thefnmark\@empty
      \FN@specific\FN@masterinsert\@makefntext{\rule\z@\footnotesep
        \nobreak
        #1\@finalstrut\strutbox
      \@makefnendbox}}}
\fi
\def\hfootfraction{0.9}
\def\vtypefraction{0.7}
\def\FN@assembleboxes{%
  \ifhbox\z@
    \dimen@\dp\z@
    \dimen@ii\z@
    \setbox\tw@\box\voidb@x
    \loop \advance\dimen@ii\dimexpr\ht\z@+\dp\z@\relax
      \setbox\tw@\hbox{\box\z@\unhbox\tw@}%
      \setbox\z@\lastbox
    \ifhbox\z@
    \repeat
    {\FN@assembleboxes\nointerlineskip\unvbox\z@}%
    \global\setbox\FN@tempbox\copy\tw@
    \setbox\z@\@makefnvbox{%
      {\unhbox\FN@tempbox}%
      \setbox\z@\lastbox\FN@joinhboxes}%
    \ifcase
      \ifdim\FN@vfound>\dimexpr\vtypefraction\p@*\FN@found\relax \@ne\fi
      \ifdim\dimexpr \ht\z@+\dp\z@>\hfootfraction\dimen@ii \@ne\fi \z@
    \or
      \global\setbox\FN@tempbox\box\tw@
      \setbox\z@\@makefnvbox{\let\@makefnbreak\FN@pseudofillbreak
          {\unhbox\FN@tempbox}\setbox\z@\lastbox\FN@joinhboxes}%
    \fi
    \setbox\tw@\box\voidb@x
    \ht\z@\dimexpr \ht\z@+\dp\z@-\dimen@\relax
    \dp\z@\dimen@
  \else
    \ifvbox\z@
      {\setbox\z@\lastbox
      \FN@assembleboxes\nointerlineskip\unvbox\z@}%
    \fi
  \fi}
\def\FN@fuzzyeval#1#2#3{%
  \ifdim\dimexpr(#3)<\dimexpr(#2)\relax
    \ifdim\dimexpr(#3)>\dimexpr(#1)\relax
      *(\dimexpr(#3)-(#1))%
      /(\dimexpr(#2)-(#1))%
    \else *\z@
    \fi
  \fi}
\def\FN@fuzzyor#1#2{(\p@-(\p@-(#1))*(\dimexpr\p@-(#2))/\p@)}
\def\FN@magicglue#1#2#3#4#5#6{%
  \dimen@\dimexpr\p@\FN@fuzzyeval{#1}{#2}\FN@lasthsize\relax
  \dimen@ii\dimexpr\p@\FN@fuzzyeval{#3}{#4}{\ht\z@+\dp\z@}\relax
  \dimen@\dimexpr\FN@fuzzyor\dimen@\dimen@ii
  \count@\numexpr((#6)-(#5))*\dimen@/\p@+(#5)\relax
  \xdef\FN@vfound{\the\dimexpr\FN@vfound+\dimen@}%
  \ifnum\count@>-\@M
    \penalty\count@
    \hskip\glueexpr -\parfillskip+1em minus 0.5em\relax
  \else
    \FN@pseudobreak
  \fi
  \xdef\FN@found{\number\numexpr\FN@found+\@ne}%
}
\def\FN@pseudobreak{%
  {\parskip\z@skip\parfillskip\z@skip\parindent\z@\vadjust{}\par\noindent
    \vadjust{\nobreak\vskip-\baselineskip}\nobreak\hfill\break}}
\def\FN@pseudofillbreak{\nobreak\hskip\parfillskip\FN@pseudobreak}
\def\@makefnbreak{\FN@magicglue {\footnotesep+\dp\strutbox}%
  {\footnotesep+\dp\strutbox+\baselineskip}%
  {\footnotesep+\dp\strutbox+0.5\baselineskip}%
  {\footnotesep+\dp\strutbox+2\baselineskip}{-200}{-12000}}
\def\FN@joinhboxes{%
  \begingroup\setbox\z@\lastbox
    \ifhbox\z@ \FN@joinhboxes
      \endgroup
      \nobreak\hskip\parfillskip
      \@makefnbreak
    \else
      \endgroup
      \vadjust{\nobreak\vskip-\baselineskip}\nobreak\hfill\break
      \xdef\FN@vfound{\z@}%
      \xdef\FN@found{\z@}%
    \fi
  \xdef\FN@lasthsize{\the\dimexpr \ht\z@ +\dp\z@}%
  \unhbox\z@}
\def\FN@par{\unskip\nobreak\hskip\parfillskip
  \vadjust{\vskip\parskip}\break\null\kern\parindent\ignorespaces}
\def\FN@noindent{\unkern}
\def\FN@indent{\unkern{\setbox\z@\null\wd\z@\parindent\box\z@}}
\def\MFL@fnoteplain{\FN@fnotenested{plain}}
\def\MFL@fnotepara{\FN@fnotenested{para}}
\def\FN@fnotenested#1#2#3{%
  \edef\reserved@d{#1}%
  \FN@checkvariant{\edef\reserved@d}{%
    \FN@checkvariant{\FN@restylefootnote{#2}}%
    {\csname FN@fnote\reserved@d\endcsname{#2}{#3}}}}

\def\FN@checkvariant#1#2{\def\reserved@a{#1}%
  \def\reserved@b{#2}%
  \futurelet\reserved@c\FN@checkvariantii}

\def\FN@checkvariantii{%
  \ifx\reserved@c+%
    \reserved@a{plain}\expandafter\@firstoftwo
  \else\ifx\reserved@c-%
    \reserved@a{para}\expandafter\expandafter\expandafter
    \@firstoftwo
  \fi\fi
  \reserved@b}
\newcounter{FN@totalid}
\MakeSorted{FN@totalid}
\def\FN@fnoteplain{\FN@fnotecommon\vbox}
\def\FN@fnotepara{\FN@fnotecommon\hbox}
\def\FN@masterinsert{\@cclv}
\newcount\FN@id
\FN@id\@ne
\newmarks\FN@master
\newmarks\FN@slave
\let\FN@errorstack\@empty
\def\FN@fnotecommon#1#2#3{%
  \leavevmode
  \stepcounter{FN@totalid}%
  \NCC@makemark{#3}%
  \ifnum#2<\FN@masterinsert
    \FN@colorstackbgroup\FN@divert
    \FN@newslot\FN@masterslot
    \count@\FN@id
    \dimen@=\dimexpr64\p@*\FN@masterinsert-\c@FN@totalid sp\relax
    \def\FN@masterinsert{#2}%
    \edef\FN@errorstack{\FN@errorstack^^J%
\FN@masterinsert\space entered in line \number\inputlineno}%
    \let\FN@boxtype=#1%
    \setbox\z@#1\bgroup
      \let\current@color\default@color
      \FN@@color@begingroup
      \let\MFL@minipage\relax
      \let\MFL@endminipage\relax
      \@makefnstartbox
      \let\@listdepth\@mplistdepth \@mplistdepth\z@
      \@itemdepth\z@ \@enumdepth\z@
      \protected@edef\@currentlabel{\csname p@footnote%
         \expandafter\FN@stripfootins\string#2\endcsname\@thefnmark}%
      \ifx\FN@boxtype\vbox \normalcolor\nobreak
      \else \FN@specific{#2}\@preparefnhtext \normalcolor
      \fi
      \expandafter \FN@makefncall
  \else
    \PackageError{bigfoot}{#2 forbidden in \FN@masterinsert.}%
    {Higher-placed footnotes can't be anchored in inferior ones.^^J%
    I am not putting this text in a footnote.  History:%
\FN@errorstack}%
    \rule{1em}{\ht\strutbox}%
\fi}
\providecommand{\FN@seitenobreak}{\nobreak}
\def\FN@makefnstart{%
  \expandafter\xdef\csname FN@ht\number\FN@masterinsert\endcsname
    {\the\footnotesep}%
  \expandafter\xdef\csname FN@dp\number\FN@masterinsert\endcsname
    {\the\dp\strutbox}%
  \expandafter\xdef\csname FN@wd\number\FN@masterinsert\endcsname
    {\the\hsize}%
  \marks\FN@master{\FN@masterslot}%
  \marks\FN@slave{\number\FN@id}%
  \nobreak
  \ifx\FN@boxtype\vbox
    \rule\z@\footnotesep
  \else
    \ifx\FN@par\par\else
      \let\FN@@par\par
      \let\FN@@noindent\noindent
      \let\FN@@indent\indent
    \fi
     \everyvbox\expandafter{\expandafter\everyvbox
       \expandafter{\the\everyvbox}%
       \let\par\FN@@par
       \let\noindent\FN@@noindent
       \let\indent\FN@@indent
       \the\everyvbox}%
     \let\par\FN@par
     \let\noindent\FN@noindent
     \let\indent\FN@indent
  \fi
  \FN@seitenobreak
  \afterassignment\ignorespaces}
\def\FN@makefnrobust#{%
  \FN@specific\FN@masterinsert\@makefntext
  \iffalse\fi
  \bgroup
    \aftergroup\FN@robustending
    \FN@makefnstart
    \let\next}
\def\FN@robustending{%
  \expandafter\expandafter\expandafter
  \expandafter\expandafter\expandafter\expandafter
  \iffalse  \FN@specific\FN@masterinsert\@makefntext\fi
  \FN@commonending}
\long\def\FN@makefnfragile#1{%
  \FN@specific\FN@masterinsert\@makefntext
  {\FN@makefnstart#1\FN@commonending}}
\newmarks\FN@color
\def\FN@colorstackbgroup{\let\FN@savecolorstack\FN@colorstack
  \global\let\FN@colorstack\@empty
  \bgroup
  \ifdefined\FN@savecolorstack\else
    \let\FN@@set@color\set@color
    \let\FN@@reset@color\reset@color
    \let\FN@@color@begingroup\color@begingroup
  \fi
  \let\set@color\FN@set@color
  \let\reset@color\FN@reset@color
  \let\color@begingroup\FN@color@begingroup}

\def\FN@colorstackegroup{\egroup
  \global\let\FN@colorstack\FN@savecolorstack}

\def\FN@colorstackfinish{\def\@elt##1##2{\FN@@reset@color##2}%
  \FN@colorstack
  \def\@elt##1##2{\noexpand\@elt{}{##2}}%
  \xdef\FN@colorstack{\FN@colorstack}%
  \let\@elt\relax
  \marks\FN@color{}}

\def\FN@reset@color{%
  \bgroup\def\@elt##1##2{\def\FN@next{##1}{\gdef\FN@colorstack{##2}}}%
    \let\FN@next\@empty
    \FN@colorstack
    \ifx\FN@next\@empty
      \FN@colorstackegroup
    \else \egroup
      \FN@@reset@color
      \marks\FN@color{\FN@colorstack}%
  \fi}

\def\FN@color@begingroup{%
  \let\reset@color\FN@@reset@color
  \let\color@begingroup\FN@@color@begingroup
  \let\set@color\FN@@set@color
  \color@begingroup}

\def\FN@set@color{\FN@@set@color
  \xdef\FN@colorstack{\@elt{\current@color}{\FN@colorstack}}%
  \marks\FN@color{\FN@colorstack}}

\def\FN@coloraftersplit#1{%
  \def\@elt##1##2{##2\def\current@color{##1}\set@color}%
  #1%
  \let\@elt\relax}
\def\FN@commonending{%
  \@makefnendbox
  \ifx\FN@boxtype\vbox\@finalstrut\strutbox \else \unskip \fi
  \FN@colorstackfinish
  \color@endgroup
  \egroup
  \global\advance\FN@id\@ne
  \FN@slotxdef\FN@masterslot{\number\FN@id}%
  \ifhbox\z@
    \global\setbox\FN@tempbox\copy\z@
    \setbox\tw@\@makefnvbox{\unhbox\FN@tempbox}%
    \ht\z@\dimexpr\ht\tw@+\dp\tw@-\FN@masterslot sp\relax
  \else
    \ht\z@\dimexpr\ht\z@+\dp\z@-\FN@masterslot sp\relax
  \fi
  \wd\z@\dimen@
  \dp\z@\FN@masterslot sp\relax
  \MFL@insert\FN@masterinsert{\nointerlineskip\box\z@}%
  \ifdim\lastkern=\z@ \let\FN@next\@empty\else
    \edef\FN@next{\kern\the\lastkern\relax}\unkern
  \fi
  \marks\FN@slave{\number\FN@id}%
  \expandafter\FN@enddivert\expandafter\FN@colorstackegroup
  \FN@next
}
\dimen\footins\maxdimen
\gdef\FN@nestlist{}

\newdimen\FN@outervsize
\newskip\FN@vsize

\newbox\FN@insertions

\def\FN@retaindelayed{%
  \setbox\z@\lastbox
  \ifcase
    \ifvoid\z@\m@ne\fi \FN@config\z@
    \ifnum\dp\z@=\count@\else \FN@freeslot{\number\dp\z@}\fi
    \expandafter\FN@retaindelayed
  \or
    {\FN@retaindelayed \nointerlineskip \box\z@}%
  \else \unpenalty \setbox\z@\lastbox
  \fi}
\def\MFL@processplain#1{%
   \ifvoid\FN@cache#1%
     \global\setbox\FN@tempbox\vbox\bgroup
       \unvbox#1%
       \count@\z@
       \let\@elt\FN@removecheck \FN@retaindelayed
       \ifvoid\z@ \egroup
       \else \nointerlineskip \box\z@ \egroup
         \MFL@realinsert{#1}{\unvbox\FN@tempbox}%
       \fi
     \expandafter\expandafter
   \fi\iffalse\fi
   \global\setbox#1\vbox\bgroup%
     \unvbox\FN@cache#1%
     \ifnum\lastpenalty>\z@
       \unpenalty
       \setbox\z@\lastbox
     \else
       \setbox\z@\box\voidb@x
     \fi
     \count@\dp\z@
     \global\setbox\FN@tempbox\vbox\bgroup
       \box\z@
       \nobreak
       \unvbox#1%
       \let\@elt\FN@removecheck \FN@retaindelayed
       \ifvoid\z@ \egroup \MFL@removevboxes\egroup
       \else \nointerlineskip \box\z@ \egroup
         \MFL@removevboxes \egroup
         \MFL@realinsert{#1}{\unvbox\FN@tempbox}%
       \fi}

\let\MFL@processpara\MFL@processplain
\newtoks\FN@output
\FN@output\output

\newbox\FN@tempbox
\newinsert\FN@savebox
\count\FN@savebox\@m
\dimen\FN@savebox\maxdimen
\skip\FN@savebox\z@skip
\global\setbox\FN@savebox\box\voidb@x

\expandafter\expandafter\expandafter\let\FN@cache\FN@savebox=\@cclv

\expandafter\def\csname FN@ht\number\FN@savebox\endcsname{\z@skip}%
\expandafter\def\csname FN@dp\number\FN@savebox\endcsname{\maxdepth}
\expandafter\def\csname FN@wd\number\FN@savebox\endcsname{\columnwidth}

\def\FN@list{\MFL@list\@elt{}\footins}

\def\FN@sweepbox#1#2{\ifvoid#2\else
  \nointerlineskip\box#2\penalty#2\fi}

\def\FN@sweepcachebox#1#2{\nointerlineskip
  \box\FN@cache#2%
  \penalty\FN@cache#2}

\def\FN@copycachebox#1#2{\nointerlineskip
  \copy\FN@cache#2%
  \penalty\FN@cache#2}

\def\FN@restoreboxes{\count@\lastpenalty \unpenalty
  \ifnum\count@>\z@
    \global\setbox\count@\lastbox
    \expandafter\FN@restoreboxes
  \fi}
\def\FN@removecheck#1#2{%
  \ifnum#1<\FN@slotget{\number\dp\z@} %
  \ifnum#2>\FN@slotget{\number\dp\z@} %
    \@ne\fi\fi}
\def\FN@recordinsertparam#1#2{\ifvoid#2\else
  \global\skip\number#2=\the\skip#2\relax\fi}

\def\FN@clearinsertparam#1#2{\ifvoid#2\else
  \global\skip#2=\z@skip\fi}
\def\FN@insertouterspace#1#2{\ifvoid#2\else
    +\skip#2+(\ht#2+\dp#2)*\count#2/\@m\fi}

\def\FN@list@iterate#1{\let\FN@eltsave\@elt
  \let\@elt#1%
  \FN@list
  \let\@elt\FN@eltsave}

\def\FN@nest@iterate#1{\let\FN@eltsave\@elt
  \let\@elt#1%
  \FN@nestlist
  \let\@elt\FN@eltsave}
\def\FN@allmarks#1{\@elt{#1}%
  \ifnum#1<\count266
    \expandafter\FN@allmarks\expandafter{\number\numexpr#1+\@ne}%
  \fi}
\def\FN@sweeptopmarks{\global\setbox\FN@topmarkbox\vbox{%
    \def\@elt##1{\marks##1{\unexpanded\expandafter{\topmarks##1}}}%
    \FN@allmarks0}}
\newbox\FN@topmarkbox
\long\def\FN@establishmarks#1#2{\edef\reserved@a{\unexpanded{#2}}%
  \edef\reserved@b{\unexpanded\expandafter{\splitbotmarks#1}}%
  \ifx\reserved@a\reserved@b
    \marks#1{\unexpanded\expandafter{\splitfirstmarks#1}}%
    \marks#1{\unexpanded\expandafter{\reserved@b}}%
  \fi}
\def\FN@markspassone#1{\noexpand\FN@establishmarks{#1}%
  {\unexpanded\expandafter{\splitbotmarks#1}}}
\def\FN@pseudomarks#1{\marks#1{X}}
\def\FN@insertmarks{%
  {\setbox\z@\copy\@cclv
    \splittopskip-\maxdimen\relax
    \vbadness=\@M
    \vfuzz=\maxdimen
    \loop
    \ifvoid\z@\else
      {\let\@elt\FN@pseudomarks
        \setbox\z@\vbox{\FN@allmarks0\nobreak\unvcopy\z@}%
        \setbox\z@\vsplit\z@ to\maxdimen}%
      \let\@elt\FN@markspassone
      \edef\next{\FN@allmarks0}%
      \setbox\z@\vbox{\nobreak\unvbox\z@}%
      {\setbox\z@\vsplit\z@ to\maxdimen}%
      \next
    \repeat}}
\def\FootnoteMinimum{1sp}
\def\FootnoteMainMinimum{0pt}
\expandafter\def\csname\string\FootnoteMinimum\number\FN@savebox
\endcsname{\FootnoteMainMinimum}
\savingvdiscards=\@ne
\newcount\FN@outputflag
\FN@outputflag=3158345
\output{%
  \let\@elt\relax
  \ifvoid\@cclv \PackageError{bigfoot}{Empty box 255 in \output}\fi
  \ifnum\outputpenalty=-13750
    \ifnum\insertpenalties>\z@
      \PackageError{bigfoot}{Too much insertion material}{%
        This error means that the output routine was not able to^^J%
        gather all floating insertions in a single pass.^^J%
        Complain to the author if you consider this a bug}%
    \fi
    \global\advance\FN@outervsize\dimexpr\ht\@cclv-\vsize
    \global\setbox\@cclv\box\voidb@x
  \else
  \edef\FN@outputpenalty{\number\outputpenalty}%
  \ifvoid\FN@savebox
    \ifvoid\@holdpg
      \FN@sweeptopmarks
    \fi
    \FN@nest@iterate{\FN@insertouterspace\global\FN@outervsize
      \dimexpr\z@}%
    \global\advance\FN@outervsize\ht\@cclv
    \global\setbox\@cclv\vbox{\unvbox\@cclv\boxmaxdepth\maxdepth}%
    \global\let\FN@vsadjustlist\@empty
    \FN@normaloutput
  \else
    \FN@nest@iterate{\FN@insertouterspace\global\advance\FN@outervsize
      \dimexpr\ht\@cclv}%
    \global\setbox\@cclv\vbox{\unvbox\@cclv\boxmaxdepth\maxdepth}%
    \FN@nest@iterate\FN@maybeinvalidatecache
    \vskip\z@skip
    \unvbox\FN@savebox
    \loop
      \count@\lastpenalty
    \ifnum\count@>\z@
      \unpenalty
      \setbox\z@\lastbox
      \global\setbox\count@\vbox{\unvbox\z@\unvbox\count@}%
    \repeat
    \ifcase
      \ifnum\FN@outputpenalty=-13749 \@ne\fi
      \ifnum\FN@outputpenalty=-13751 \@ne\fi \tw@
    \or
      \FN@vsadjustlist
      \global\setbox\@cclv\lastbox
      \unskip
      \ifnum\FN@outputpenalty=-13749
        \FN@normaloutput
      \else
        \the\FN@output
        \@pageht-\vsize
        \let\@currbox\footins
        \@reinserts
        \global\vsize-\@pageht
      \fi
    \else
      \dimen@\topskip
      \FN@vsadjustlist
      \setbox\z@\lastbox
      \unskip
      \global\setbox\@cclv\vbox{%
        \unvbox\z@
        \global\setbox\@cclv\vbox{\break\unvbox\@cclv}%
        {\splittopskip-\maxdimen \setbox\z@\vsplit\@cclv to\z@}%
        \ifnum\outputpenalty=\@M
          \setbox\z@\vbox{\pagediscards
            \FN@cleanpagepenalty}%
          \unvbox\z@
        \else
          \penalty\outputpenalty
          \pagediscards
        \fi
        \unvbox\@cclv
        \boxmaxdepth\maxdepth}%
      \global\outputpenalty\FN@outputpenalty\relax
      \ifdim\dimen@>\z@
        \hrule\@height\z@\@depth\z@
        \unvcopy\FN@topmarkbox
        \penalty-13750
        \penalty\FN@outputflag
        \hrule\@height\z@\@depth\z@
        \FN@insertmarks
        \penalty-13749
        \penalty\FN@outputflag
        \FN@prepareoutput
        \global\topskip-\maxdimen
        \global\vsize0.5\maxdimen
        \global\advance\FN@outervsize-\vsize
      \else
        \FN@normaloutput
      \fi
   \fi
  \fi
  \fi}
\def\FN@normaloutput{%
  \global\FN@vsize\FN@outervsize
  \global\advance\FN@vsize-\ht\@cclv\relax\relax
  \FN@nest@iterate\FN@sortinsert
  \FN@nest@iterate\FN@clearcache
  \xdef\FN@config{\@elt{\number0\botmarks\FN@slave}%
    {\number\maxdimen}}%
  \FN@nest@iterate\FN@reconfig
  \ifcase
    \ifnum\insertpenalties>\z@ \@ne\fi
    \ifnum\outputpenalty>-\@M
      \ifdim\FN@vsize>-\gluestretch\FN@vsize \tw@ \fi
      \ifdim\FootnoteMainMinimum>\ht\@cclv \tw@ \fi
    \fi
    \ifdim\FN@vsize<\glueshrink\FN@vsize \thr@@ \fi
    \ifx\FN@vsadjustlist\@empty \else \thr@@\fi\z@
    {\vbadness\@M
      \vfuzz\maxdimen
      \global\setbox\@cclv\vbox
      spread\FN@vsize{\unvbox\@cclv\boxmaxdepth\maxdepth}}%
    \the\FN@output
    \let\@currbox\footins
    \@pageht-\vsize
    \@reinserts
    \global\vsize-\@pageht
    \FN@nest@iterate\FN@clearcache
  \or
    \FN@restartoutput
    \penalty -13749
    \penalty \FN@outputflag
  \or
    \dimen@=\dimexpr\FN@vsize-\glueshrink\FN@vsize\relax
    \FN@prepareoutput
    \global\topskip \normalbaselineskip
    \global\vsize \dimen@
    \global\advance\FN@outervsize-\vsize
    \global\deadcycles\z@
  \else
    \edef\FN@masterid{\number\maxdimen}%
    \def\FN@masterslot{-1}%
    \global\setbox\@cclv\vbox{\box\@cclv}%
    \xdef\FN@config{\noexpand\@elt{\number0\botmarks\FN@slave}%
      {\number\maxdimen}}%
    \global\setbox\FN@savebox\vbox{}%
    \gdef\FN@penalties{0}%
    \edef\FN@defaultpenalty{\ifnum\outputpenalty<\@M
        \number\outputpenalty
      \else
        0\fi}%
    \let\@elt\FN@newlevel
    \@elt{}\FN@savebox\FN@nestlist\FN@mainsplitreturn
    \let\@elt\relax
    \global\setbox\FN@savebox\box\voidb@x
    {%
      \vbadness\@M
      \vfuzz\maxdimen
      \global\setbox\@cclv\vbox spread\FN@vsize{%
        \unvbox\@cclv
        \ifnum\lastpenalty>\z@
          \unpenalty
          \global\setbox\FN@tempbox\lastbox
        \else
          \global\setbox\FN@tempbox\box\voidb@x
        \fi
        \setbox\z@\lastbox
        \ifvoid\z@
          \ifvbox\FN@tempbox
            \ifnum\outputpenalty<\@M
              \global\setbox\FN@tempbox{\unvbox\FN@tempbox
                \penalty\outputpenalty}%
            \fi
            \global\outputpenalty=\@M
          \fi
        \else
          \MFL@removevboxes
          \unvbox\z@
          \edef\FN@defaultpenalty{\number\@M}%
          \FN@getbreakpenalty
          \setbox\z@\lastbox
          \global\setbox\FN@tempbox\vbox\bgroup\unvbox\z@
            \unvbox\FN@tempbox
            \ifnum\lastnodetype<\z@
            \egroup\global\setbox\FN@tempbox\box\voidb@x
            \else
              \ifnum\outputpenalty<\@M
                \penalty\outputpenalty
              \fi
            \egroup
            \global\outputpenalty\FN@breakpenalty
          \fi
        \fi
        \boxmaxdepth\maxdepth}%
    }%
    \setbox\z@\box\FN@tempbox
    \let\@elt\relax
    \dimen@=\dimexpr\FN@vsize-\glueshrink\FN@vsize\relax
    \ifcase
      \ifvoid\z@ \ifnum\outputpenalty>-\@M
                    \ifdim\dimen@<\z@ \else \@ne \fi
                 \fi
      \else \thr@@
      \fi
      \ifdim\ht\@cclv<\normalbaselineskip \@ne\fi
      \ifdim\dimen@<\normalbaselineskip \tw@\fi \@ne
    \or
      \FN@prepareoutput
      \global\topskip \normalbaselineskip
      \ifdim\dimen@<\normalbaselineskip \dimen@=2\baselineskip\fi
      \global\vsize \dimen@
      \global\advance\FN@outervsize-\vsize
      \global\deadcycles\z@
    \or
      \setbox\tw@\vbox{%
        \the\FN@output
      }%
      \unvbox\tw@
      \unvbox\z@
      \let\@currbox\footins
      \@pageht-\vsize
      \@reinserts
      \global\vsize-\@pageht
      \FN@nest@iterate\FN@clearcache
    \or
      \FN@restartoutput
      \penalty -13751
      \penalty\FN@outputflag
      \unvbox\z@
      \ifnum\outputpenalty>\@M
      \else \penalty
            \ifnum\outputpenalty=\@M \z@ \else\outputpenalty\fi
      \fi
    \fi
  \fi
}
\def\FN@prepareoutput{%
  {\let\@elt\FN@recordinsertparam
   \xdef\FN@vsadjustlist{%
     \global\vsize=\the\vsize
     \global\topskip=\the\topskip
     \global\outputpenalty=\the\outputpenalty\relax
     \FN@list}%
   \let\@elt\FN@clearinsertparam
   \FN@list}%
  \global\setbox\FN@savebox\vbox{%
    \box\@cclv
    \FN@list@iterate\FN@sweepbox}}
\def\FN@restartoutput{%
  \dimen@=\dimexpr\FN@vsize-\glueshrink\FN@vsize\relax
  \hrule\@height\z@\@depth\z@
  \unvcopy\FN@topmarkbox
  \penalty -13750
  \penalty\FN@outputflag
  \hrule\@height\z@\@depth\z@
  \FN@insertmarks
  \FN@prepareoutput
  \global\topskip-\maxdimen\relax
  \global\vsize 0.5\maxdimen
  \global\advance\FN@outervsize-\vsize
  \global\deadcycles\z@
}
\def\FN@getbreakpenalty{{\setbox\z@\lastbox
    \nointerlineskip\copy\z@
    \setbox\z@
      \vbox{\unvbox\z@
        \count@\@M
        \FN@getbreakpenaltyii
        \xdef\FN@tempinfo{\edef\noexpand\FN@breakpenalty{%
            \number\ifnum\count@=\@M \FN@defaultpenalty \else \count@\fi
          }}}}%
  \FN@tempinfo}

\def\FN@getbreakpenaltyii{%
  \ifcase
    \ifnum\lastnodetype<\z@ \m@ne\fi
    \ifnum\lastnodetype<11 \@ne\fi
    \ifnum\lastnodetype>13 \@ne\fi
    \numexpr\lastnodetype-9\relax
  \or
    \PackageError{bigfoot}{Illegal node type}{This can't happen}%
  \or
    \count@\z@ \unskip \expandafter\FN@getbreakpenaltyii
  \or
    \count@\z@ \unkern \expandafter\FN@getbreakpenaltyii
  \or
    \count@\lastpenalty
    \unpenalty \expandafter\FN@getbreakpenaltyii
  \fi}
\def\FN@cleanpagepenalty{%
  \ifcase
    \ifnum\lastnodetype<\z@ \m@ne\fi
    \ifnum\lastnodetype<11 \@ne\fi
    \ifnum\lastnodetype>13 \@ne\fi
    \numexpr\lastnodetype-9\relax
  \or
    \PackageError{bigfoot}{Illegal node type}{This can't happen}%
  \or
    \skip@=\lastskip \unskip
    \expandafter \FN@cleanpagepenalty \expandafter\vskip\the
    \expandafter\skip@
  \or
    \dimen@=\lastkern \unkern
    \expandafter \FN@cleanpagepenalty \expandafter\kern\the
    \expandafter\dimen@
  \or
    \count@\lastpenalty \unpenalty
    \ifnum\count@=\FN@outputflag
      \unpenalty\expandafter\expandafter\expandafter\FN@cleanpagepenalty
    \else
      \expandafter\FN@cleanpagepenalty\expandafter
      \penalty\the\expandafter\expandafter\expandafter\count@
    \fi
  \fi
  \relax}
\def\FN@mainsplitreturn{}
\newdimen\FN@myvsize
\newcount\bigfoottolerance
\bigfoottolerance=100
\def\FN@getbadness#1{%
  {\hfuzz\maxdimen\hbadness\@M\setbox\z@\hbox to\z@{\hskip-#1}}}
\providecommand\footnotecarryratio{2}
\def\FN@newlevel#1#2#3\FN@mainsplitreturn{%
  \count@\FN@cache#2%
  \ifvoid\count@
      #3\FN@mainsplitreturn
  \else
    {\def\FN@currentinsertion{#2}%
     \def\FN@currentrecursion{#3}%
     \let\FN@entryconfig\FN@config
     \let\FN@entrypenalties\FN@penalties
     \splittopskip\csname FN@ht\number#2\endcsname\relax
     \splitmaxdepth\csname FN@dp\number#2\endcsname\relax
     \hsize\csname FN@wd\number#2\endcsname\relax
     \vbadness=\@M
     \vfuzz\maxdimen
     \let\@elt\relax
     \expandafter\FN@newleveli\expandafter}%
  \fi}
\def\FN@newleveli{%
    \dimen@\dimexpr\ht\count@
      \ifnum\FN@currentinsertion=\FN@savebox
        +\maxdepth
      \else
        +\dp\count@
      \fi\relax
    \global\advance\FN@vsize\dimexpr \dimen@
      *\count\FN@currentinsertion/\@m\relax\relax
    \global\setbox\count@\vbox\bgroup\unvbox\count@
      \ifnum\lastpenalty=\z@
        \setbox\tw@\box\voidb@x
        \setbox\z@\lastbox
        \FN@myvsize=\ifnum\lastnodetype<\z@
          \z@
        \else
          \dimexpr\dimen@-\ht\z@-\dp\z@\relax
        \fi
      \else
        \unpenalty
        \setbox\tw@\lastbox
        \setbox\z@\lastbox
        \FN@myvsize=\dimexpr\dimen@-\ht\z@-\dp\z@\relax
        \dimen@\dp\z@
        \setbox\z@{\unvbox\z@
          \setbox\z@\lastbox
          \unvbox\z@
          \unvbox\tw@}%
        \ht\z@=\dimexpr\ht\z@+\dp\z@-\dimen@\relax
        \dp\z@\dimen@
      \fi
      \edef\FN@bestcost{\number\maxdimen}%
      \let\FN@bestbadness\FN@bestcost
      \let\FN@bestconfig\@undefined
      \def\FN@bestvsize{-\maxdimen}%
      \let\FN@splitcolors\@empty
      \ifnum\FN@currentinsertion=\FN@savebox
      \else
        \edef\FN@defaultpenalty{\number-\@M}%
        \edef\FN@masterslot{\number\dp\z@}%
        \edef\FN@masterid{\FN@slotget\FN@masterslot}%
      \fi
      \setbox\z@
      \vbox\bgroup
        \let\FN@splitcolors\@empty
        \setbox\z@\vbox{\vskip-\glueexpr(\FN@vsize-\dimexpr\FN@vsize
          \relax\@minus\glueshrink\FN@vsize)%
          *\@m/\count\FN@currentinsertion
          \penalty\z@
          \unvbox\z@
          \ifnum\FN@defaultpenalty>-\@M
            \penalty\FN@defaultpenalty\relax\nointerlineskip
            \vbox to\maxdimen{}%
          \fi}%
        \setbox\tw@\vsplit\z@ to%
          \dimexpr\FN@vsize*\@m/\count\FN@currentinsertion
          -\FN@myvsize-\splitmaxdepth
        \relax
        \ifnum\FN@defaultpenalty>-\@M
          \setbox\z@\vbox\bgroup\unvbox\z@\setbox\z@\lastbox
            \unskip
            \unpenalty
            \ifnum\lastnodetype<\z@
              \egroup \setbox\z@\box\voidb@x
            \else
              \egroup
            \fi
        \fi
        \setbox\tw@\vbox{%
          \vskip\glueexpr(\FN@vsize-\dimexpr\FN@vsize
          \relax\@minus\glueshrink\FN@vsize)%
          *\@m/\count\FN@currentinsertion
          \unvbox\tw@\boxmaxdepth\splitmaxdepth}%
        \ifnum\FN@currentinsertion=\FN@savebox
          \edef\FN@slaveid{\splitbotmarks\FN@slave}%
          \FN@contribute@tw@
        \else
          \ifnum0\splitbotmarks\FN@master=\FN@masterslot \else
            \loop
              \FN@contribute@tw@
              \setbox\tw@\vsplit\z@ to\z@
            \ifnum0\splitbotmarks\FN@master=\FN@masterslot
            \else
            \repeat
          \fi
          \let\FN@splitcolors\@empty
          \edef\FN@slaveid{\splitbotmarks\FN@slave}%
          \FN@contribute@tw@
        \fi
        \ifx\FN@slaveid\@empty
          \edef\FN@slaveid{\number0\topmarks\FN@slave}%
        \fi
        \ifnum\numexpr\FN@slaveid+\@ne<\FN@masterid
          \let\FN@next\FN@slaveid
        \else
          \let\FN@next\@empty
        \fi
        \FN@splitfurther}
\def\FN@vsizerecurse{%
    \global\advance\FN@vsize
      -\dimexpr\FN@myvsize*\count\FN@currentinsertion/\@m \relax\relax
    \let\@elt\FN@newlevel
    \FN@currentrecursion\FN@mainsplitreturn
    \let\@elt\relax
    \global\advance\FN@vsize
      \dimexpr\FN@myvsize*\count\FN@currentinsertion/\@m \relax\relax}
\def\FN@splitfurther{%
  \ifx\FN@next\@empty \else \let \FN@slaveid\FN@next \fi
  \let\FN@next\FN@config
  \xdef\FN@config{%
    \@elt{\FN@slaveid}%
    {\FN@masterid}%
    \FN@entryconfig}%
  \ifx\FN@next\FN@config
    \let\@elt\FN@rejoin
  \else
    \let\@elt\FN@reconfig
  \fi
  \FN@currentrecursion
  \let\@elt\relax
  \xdef\FN@penalties{\number\FN@entrypenalties}%
  \FN@checkcurrent
  \ifnum
    \ifdim\skip@>\z@ \FN@ebadness \else \FN@penalties \fi
    >\FN@bestcost\relax
  \else
    \xdef\FN@penalties{\number\FN@entrypenalties}%
    \FN@vsizerecurse
    \FN@checkcurrent
  \fi
  \ifcase
    \ifnum\FN@breakpenalty>-\@M \else \@ne \fi
    \ifvoid\z@ \@ne \fi
    \ifnum\badness<\@MM \else \@ne \fi
    \tw@
  \or
    \expandafter \FN@returnbest
  \else
    \FN@mayberecordbest
    \setbox\tw@\vsplit\z@ to\z@
    \edef\FN@next{\splitbotmarks\FN@slave}%
    \FN@contribute@tw@
    \expandafter \FN@splitfurther
  \fi}
\def\FN@checkcurrent{%
  \FN@getbreakpenalty
  \ifnum\FN@breakpenalty<-\@M
    \edef\FN@breakpenalty{\number-\@M}%
  \fi
  \ifnum\FN@currentinsertion=\FN@savebox
  \else
    \ifdim\FN@specific\FN@currentinsertion\footnotecarryratio\p@>\z@
      \skip@
      \ifdim\FN@specific\FN@currentinsertion\footnotecarryratio\p@>\p@
          \dimexpr\ht\z@+\dp\z@\relax
          \@plus-\dimexpr((\FN@myvsize+\ht\z@+\dp\z@)
                          *\p@/\dimexpr
                          \FN@specific\FN@currentinsertion
                          \footnotecarryratio\p@)\relax
      \else
          \FN@specific\FN@currentinsertion
          \footnotecarryratio
          \dimexpr\ht\z@+\dp\z@\relax
          \@plus-\dimexpr\FN@myvsize+\ht\z@+\dp\z@\relax
      \fi
      \relax
      \FN@getbadness\skip@
      \xdef\FN@penalties{\number\numexpr\FN@penalties+\badness}%
    \fi
  \fi
  \skip@\glueexpr\FN@vsize-\FN@myvsize
   *\count\FN@currentinsertion/\@m\relax
  \FN@getbadness\skip@
  \xdef\FN@penalties{\number\numexpr\FN@penalties+%
    \FN@breakpenalty+\@M}%
  \ifnum\badness>\@M
    \edef\FN@ebadness{\number\numexpr\maxdimen-\@ne}%
  \else
    \ifnum\badness=\@M
      \ifdim\skip@<\vsize
        \edef\FN@ebadness{\number\numexpr\maxdimen-\tw@}%
      \else
        \edef\FN@ebadness{\number\numexpr\maxdimen}%
      \fi
    \else
      \edef\FN@ebadness{\number\numexpr
        \FN@penalties+\badness
        \ifdim\FN@specific\FN@currentinsertion\FootnoteMinimum>\FN@myvsize
          1000000
        \fi
        }%
    \fi
  \fi
  \dimen@\glueexpr\FN@bestvsize\relax
}
\def\FN@checkforbest{%
    \ifnum\FN@breakpenalty>-\@M \else
      \ifnum\badness>\@M \else
         \@ne
      \fi
    \fi
    \ifnum\FN@bestcost>\FN@ebadness \@ne\fi
    \ifnum\FN@bestcost<\FN@ebadness \tw@\fi
    \ifdim\skip@<\z@
      \ifdim\dimen@<\skip@ \@ne \fi \tw@
    \fi
    \ifdim\dimen@>\skip@ \@ne\fi \tw@}
\def\FN@mayberecordbest{%
  \ifcase
    \FN@checkforbest
  \or
    \xdef\FN@tempinfo{\def\noexpand\FN@bestvsize{\the\skip@}%
      \def\noexpand\FN@bestcost{\FN@ebadness}%
      \def\noexpand\FN@bestbadness{\number\FN@penalties}%
      \def\noexpand\FN@bestconfig{\FN@config}%
      \def\noexpand\FN@bestslaveid{\FN@slaveid}%
      \def\noexpand\FN@bestsplitcolors{\FN@splitcolors}%
      \def\noexpand\FN@breakpenalty{\FN@breakpenalty}%
      \FN@myvsize=\the\FN@myvsize\relax}%
    \global\setbox\FN@tempbox\box\z@
    \egroup
    \FN@tempinfo
    \let\FN@splitcolors\FN@bestsplitcolors
    \let\FN@slaveid\FN@bestslaveid
    \setbox\tw@\vbox{%
      \copy\z@\break\nointerlineskip
      \copy\FN@tempbox\penalty\FN@tempbox
      \let\@elt\FN@copycachebox
      \FN@currentrecursion}%
    \setbox\z@
    \vbox\bgroup
      \unvbox\z@
      \setbox\z@\box\FN@tempbox
  \fi}

\def\FN@returnbest{%
  \ifcase\FN@checkforbest
  \or
    \xdef\FN@tempinfo{\def\noexpand\FN@bestvsize{\the\skip@}%
      \def\noexpand\FN@bestcost{\FN@ebadness}%
      \def\noexpand\FN@bestbadness{\number\FN@penalties}%
      \def\noexpand\FN@bestconfig{\FN@config}%
      \def\noexpand\FN@bestslaveid{\FN@slaveid}%
      \def\noexpand\FN@bestsplitcolors{\FN@splitcolors}%
      \def\noexpand\FN@breakpenalty{\FN@breakpenalty}%
      \FN@myvsize=\the\FN@myvsize\relax}%
    \global\setbox\FN@tempbox\box\z@
    \egroup
    \FN@tempinfo
    \let\FN@splitcolors\FN@bestsplitcolors
    \let\FN@slaveid\FN@bestslaveid
    \global\FN@vsize\FN@bestvsize\relax
  \or
    \global\let\FN@config\FN@bestconfig
    \global\FN@vsize\FN@bestvsize
    \global\let\FN@penalties\FN@bestbadness
    \egroup
    \setbox\z@\vbox{\unvbox\tw@ \FN@restoreboxes}%
    \let\FN@splitcolors\FN@bestsplitcolors
    \let\FN@slaveid\FN@bestslaveid
    \unvbox\z@
    \setbox\z@\lastbox
  \fi
  \ifnum\FN@currentinsertion=\FN@savebox
  \else
    \setbox\z@\vbox{%
      \prevdepth\dp\z@
      \unvbox\z@
      \ifvoid\FN@tempbox
      \else
        \global\setbox\FN@tempbox\vbox{%
          \marks\FN@master{\FN@masterslot}%
          \marks\FN@slave{\FN@slaveid}%
          \FN@coloraftersplit\FN@splitcolors
          \FN@specific\FN@currentinsertion\FN@afterbreak
          \nobreak
          \unvbox\FN@tempbox}%
        \FN@specific\FN@currentinsertion\FN@beforebreak
        \ht\FN@tempbox
        \dimexpr\ht\FN@tempbox+\dp\FN@tempbox-\FN@masterslot sp\relax
        \dp\FN@tempbox\FN@masterslot sp\relax
        \wd\FN@tempbox\maxdimen
      \fi
    \ifdim\prevdepth<\splitmaxdepth
       \hrule\@height-\prevdepth \@width\z@
             \@depth \splitmaxdepth \relax \fi}%
    \ht\z@=\dimexpr\ht\z@+\dp\z@-\FN@masterslot sp\relax
    \dp\z@=\FN@masterslot sp
  \fi
  \nointerlineskip \box\z@
  \ifvoid\FN@tempbox \egroup
  \else
    \dimen@-\dimexpr\ht\FN@tempbox+\dp\FN@tempbox\relax
    \nointerlineskip\box\FN@tempbox
    \nobreak
    \expandafter\egroup
    \expandafter\ht\expandafter\count@\expandafter\dimexpr
    \the\dimen@+\ht\count@\relax
  \fi
}
\def\FN@contribute@tw@{%
  \begingroup\edef\FN@next{\splitbotmarks\FN@color}%
  \ifx\FN@next\@empty \endgroup\else \endgroup
    \edef\FN@splitcolors{\splitbotmarks\FN@color}\fi
  \setbox4\lastbox
  \ifvoid4 \setbox4\vbox{\splitdiscards}%
    \setbox\tw@\vbox{\unvbox\tw@\boxmaxdepth\splitmaxdepth}%
  \else
    \advance\FN@myvsize-\dimexpr\ht4+\dp4\relax
    \setbox4\vbox{\unvbox4}%
    \advance\FN@myvsize\dimexpr\ht4+\dp4\relax
    \unvbox4
    \setbox4\vbox{\splitdiscards}%
    \setbox\tw@\vbox{\break\unvbox\tw@}%
    {\splittopskip-\maxdimen \setbox\tw@\vsplit\tw@ to\z@}%
  \fi
  \ht4-\dp\tw@
  \dp4\ifdim\dp\tw@<\splitmaxdepth \splitmaxdepth \else \dp\tw@ \fi
  \advance\FN@myvsize\dimexpr \ht\tw@+\dp4\relax
  \unvbox\tw@
  \nointerlineskip
  \box4 }
\def\FN@uncontribute@tw@{%
  \ifvoid\tw@ \else
  \setbox\tw@\vbox{\unvbox\tw@\splitdiscards}%
  \setbox\z@\vbox{\break\unvbox\z@}%
  {\splittopskip-\maxdimen \setbox\z@\vsplit\z@ to\z@}%
  \setbox\z@\vbox{\unvbox\tw@\unvbox\z@}\fi}
\def\FN@reconfig#1#2{\ifvoid#2%
  \else
  \count@\FN@cache#2%
  \ifvoid\count@\else
    \global\advance\FN@vsize
      \glueexpr(\ht\count@+\dp\count@)*\count#2/\@m+\skip#2\relax
    \global\setbox\count@ \box\voidb@x
  \fi
  \global\setbox\count@\vbox\bgroup\vbox\bgroup\unvcopy#2%
    \let\@elt\FN@removecheck
    \FN@retainkept
    \ifvoid\z@ \egroup\egroup \global\setbox\count@ \box\voidb@x
    \else \def\FN@masterinsert{#2}%
      \FN@assembleboxes\global\setbox\count@\box\z@\egroup
      \nointerlineskip\box\count@\egroup
    \global\advance\FN@vsize
      -\glueexpr(\ht\count@+\dp\count@)*\count#2/\@m+\skip#2\relax
  \fi\fi}
\def\FN@rejoin#1#2{{%
  \count@\FN@cache#2%
  \ifvoid\count@\else
    \global\advance\FN@vsize\dimexpr
       (\ht\count@+\dp\count@)*\count#2/\@m\relax
    \global\setbox\count@\vbox{%
      \unvbox\count@
      \ifnum\lastpenalty>\z@
        \unpenalty
        \setbox\tw@\lastbox
        \setbox\z@\lastbox
        \dimen@\dp\z@
        \setbox\z@\vbox{%
          \unvbox\z@
          \setbox\z@\lastbox
          \unvbox\z@
          \unvbox\tw@}%
        \ht\z@=\dimexpr\ht\z@+\dp\z@-\dimen@\relax
        \dp\z@=\dimen@
        \nointerlineskip
        \box\z@
      \fi}%
    \global\advance\FN@vsize-\dimexpr
        (\ht\count@+\dp\count@)*\count#2/\@m\relax
  \fi}}
\def\FN@retainkept{%
  \setbox\z@\lastbox
  \ifcase
    \ifvoid\z@\m@ne\fi \FN@config\z@
    {\FN@retainkept \nointerlineskip \box\z@}%
  \or
    \FN@retainkept
  \fi}
\let\output\FN@output
\def\FN@maybestart#1#2#3{\ifx#3\relax
  \csname MFL@start#1\endcsname{#2}\fi#3}
\@onlypreamble\FN@maybestart
\AtBeginDocument{\@ifundefined{footinsdefault}%
  {\newfootnote[plain]{default}%
    {\let\@elt\FN@maybestart
      \MFL@list\relax}%
  }{}%
  \def\@footnotetext{\Footnotetextdefault{}}%
  \def\p@footnotedefault{\p@footnote}%
}
\endinput
%%
%% End of file `bigfoot.sty'.
