%%
%% This is file `nidanfloat.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% nidanfloat.dtx  (with options: `core')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from nidanfloat.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file nidanfloat.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.)
%%File: nidanfloat.dtx
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{nidanfloat}%
  [2005/12/09 v2.7 Put double-floats at top/bottom within twocolumn mode]
\DeclareOption{balance}{\AtEndDocument{\let\clearpage\balanceclearpage}}
\DeclareOption{nobalance}{\relax}
\ExecuteOptions{nobalance}
\ProcessOptions
\newcommand\dblbotfraction{0.5}
\newcount\c@dblbotnumber
\setcounter{dblbotnumber}{2}
\newdimen\@dblbotroom
\newcount\@dblbotnum
\def\@dblfloatplacement{%
   \global\@dbltopnum\c@dbltopnumber
   \global\@dblbotnum\c@dblbotnumber % added
   \global\@dbltoproom\dbltopfraction\@colht
   \global\@dblbotroom\dblbotfraction\@colht % added
   \@textmin\@colht
     \advance\@textmin-\@dbltoproom
     \advance\@textmin-\@dblbotroom % added
   \@fpmin\dblfloatpagefraction\textheight
   \@fptop\@dblfptop
   \@fpsep\@dblfpsep
   \@fpbot\@dblfpbot
}
\gdef\@dblbotlist{}
\gdef\L@toplist{}
\gdef\R@toplist{}
\gdef\L@botlist{}
\gdef\R@botlist{}
\def\@dblfloat{%
  \if@twocolumn\let\reserved@a\@dbflt\else\let\reserved@a\@float\fi
  \reserved@a}
\def\@dbflt#1{\@ifnextchar[{\@xdblfloat{#1}}{\@xdblfloat{#1}[tb]}}
\def\@xdblfloat#1[#2]{%
  \@xfloat{#1}[#2]\hsize\textwidth\linewidth\textwidth}
\let\end@dblfloat\end@float
\def\@addtocurcol{%
  \ifdim\wd\@currbox>\columnwidth
    \@addtodblcol
  \else
    \@insertfalse
    \@setfloattypecounts
    \ifnum\@fpstype=8 % is only `!p'
    \else
      \ifnum\@fpstype=24 % is only `p'
      \else
        \@flsettextmin
        \advance\@textmin\@textfloatsheight
        \@reqcolroom\@pageht
        \ifdim\@textmin>\@reqcolroom \@reqcolroom\@textmin\fi
        \advance\@reqcolroom\ht\@currbox
        \ifdim\@colroom>\@reqcolroom
          \@flsetnum\@colnum
          \ifnum\@colnum>\z@
            \@bitor\@currtype\@deferlist
            \if@test
            \else
              \@bitor\@currtype{\L@botlist\R@botlist}%
              \if@test
                \@addtobot
              \else
                \ifodd\count\@currbox
                  \advance\@reqcolroom\intextsep
                  \ifdim\@colroom>\@reqcolroom
                    \global\advance\@colnum\m@ne
                    \global\advance\@textfloatsheight\ht\@currbox
                    \global\advance\@textfloatsheight 2\intextsep
                    \@cons\@midlist\@currbox
                    \if@nobreak
                      \nobreak
                      \@nobreakfalse
                      \everypar{}%
                    \else
                      \addpenalty \interlinepenalty
                    \fi
                    \vskip\intextsep
                    \box\@currbox
                    \penalty\interlinepenalty
                    \vskip\intextsep
                    \ifnum\outputpenalty<-\@Mii \vskip-\parskip \fi
                    \outputpenalty\z@
                    \@inserttrue
                  \fi
                \fi
                \if@insert\else\@addtotoporbot\fi
              \fi
            \fi
          \fi
        \fi
      \fi
    \fi
    \if@insert\else\@resethfps\@cons\@deferlist\@currbox\fi
  \fi
}
\def\@addtotoporbot{%
  \@getfpsbit \tw@
  \ifodd\@tempcnta
    \@flsetnum\@topnum
    \ifnum\@topnum>\z@
      \@tempswafalse
      \@flcheckspace\@toproom\@toplist\L@toplist\R@toplist
      \if@tempswa
        \@bitor\@currtype{\@midlist\L@botlist\R@botlist}%
        \if@test\else
          \if@firstcolumn
            \@flupdates \@topnum \@toproom \L@toplist
          \else
            \@flupdates \@topnum \@toproom \R@toplist
          \fi
          \@inserttrue
        \fi
      \fi
    \fi
  \fi
  \if@insert\else\@addtobot\fi
}
\def\@addtobot{%
  \@getfpsbit 4\relax
  \ifodd\@tempcnta
    \@flsetnum\@botnum
    \ifnum\@botnum>\z@
      \@tempswafalse
      \@flcheckspace\@botroom\@botlist\L@botlist\R@botlist
      \if@tempswa
        \global\maxdepth\z@
        \if@firstcolumn
          \@flupdates \@botnum \@botroom \L@botlist
        \else
          \@flupdates \@botnum \@botroom \R@botlist
        \fi
        \@inserttrue
      \fi
    \fi
  \fi
}
\let\org@addtonextcol\@addtonextcol
\def\@addtonextcol{%
  \ifdim\wd\@currbox>\columnwidth
    \@addtodblcol
  \else
    \org@addtonextcol
  \fi
}
\def\@addtodblcol{%
  \begingroup
  \@insertfalse
  \@setfloattypecounts
  \ifnum\@fpstype=8 % is only `!p'
  \else
    \ifnum\@fpstype=24 % is only `p'
    \else
      \@bitor\@currtype{\@dbldeferlist}
      %\@bitor\@currtype{\@deferlist\@dbldeferlist}
      \if@test
      \else
        \@tempswafalse
        \@checkdblspace
        \if@tempswa
          \@addtodbltoporbot
        \fi
      \fi
    \fi
  \fi
  \if@insert\else\@cons\@dbldeferlist\@currbox\fi
  \endgroup
}
\def\@addtodbltoporbot{%
  \@getfpsbit \tw@
  \ifodd\@tempcnta
    \@flsetnum\@dbltopnum
    \ifnum\@dbltopnum>\z@
      \@bitor\@currtype{%
         \L@toplist\R@toplist\L@botlist\R@botlist\@dblbotlist}
      \if@test
      \else
        \@tempswafalse
        \@dblflcheckspace \@dbltoproom \@dbltoplist
        \if@tempswa
          \@tempdima-\ht\@currbox
          \advance\@tempdima
           -\ifx\@dbltoplist\@empty \dbltextfloatsep\else\dblfloatsep\fi
          \global\advance\@dbltoproom\@tempdima
          \global\advance\@dbltopnum\m@ne
          \@cons\@dbltoplist\@currbox
          \if@firstcolumn
            \advance\@colroom\@tempdima
            \global\advance\@colroom\maxdepth
          \else
            \@tempdima\textheight
            \@chkdblfloatht\advance\@tempdima-\@floatht
            \L@chkfloatht\advance\@tempdima-\@floatht
            \vbadness=\@M \splittopskip=\topskip \splitmaxdepth=\maxdepth
            \setbox\z@=\vbox{\unvcopy\@leftcolumn}%
            \setbox\@ne=\vsplit\z@ to\@tempdima
            \advance\@colroom-\ht\z@
            \global\advance\@colroom-\dp\z@
          \fi
          \@inserttrue
        \fi
      \fi
    \fi
  \fi
  \if@insert\else\@addtodblbot\fi
}
\def\@addtodblbot{%
  \@getfpsbit 4\relax
  \ifodd\@tempcnta
    \@flsetnum\@botnum
    \ifnum\@botnum>\z@
      \@tempswafalse
      \@dblflcheckspace \@dbltoproom \@dbltoplist
      \if@tempswa
        \@tempdima-\ht\@currbox \advance\@tempdima
           -\ifx\@dblbotlist\@empty \dbltextfloatsep\else\dblfloatsep\fi
        \global\advance\@dblbotroom\@tempdima
        \global\advance\@dblbotnum\m@ne
        \@cons\@dblbotlist\@currbox
        \if@firstcolumn
          \advance\@colroom\@tempdima
          \global\advance\@colroom\maxdepth
        \else
          \@tempdima\textheight
          \@chkdblfloatht\advance\@tempdima-\@floatht
          \L@chkfloatht\advance\@tempdima-\@floatht
          \vbadness=\@M \splittopskip=\topskip \splitmaxdepth=\maxdepth
          \setbox\z@=\vbox{\unvcopy\@leftcolumn}%
          \setbox\@ne=\vsplit\z@ to\@tempdima
          \advance\@colroom-\ht\z@
          \global\advance\@colroom-\dp\z@
        \fi
        \@inserttrue
      \fi
    \fi
  \fi
}
\global\newdimen\@floatht \@floatht\z@
\def \@flcheckspace #1#2#3#4{%
   \advance \@reqcolroom
  \if@twocolumn
    \if@firstcolumn
      \ifx #3\@empty \textfloatsep \else \floatsep \fi
    \else
      \ifx #4\@empty \textfloatsep \else \floatsep \fi
    \fi
  \else
     \ifx #2\@empty \textfloatsep \else \floatsep \fi
  \fi
   \ifdim \@colroom>\@reqcolroom
     \ifdim #1>\ht\@currbox
       \@tempswatrue
     \else
       \ifnum \@fpstype<\sixt@@n
         \@tempswatrue
       \fi
     \fi
   \fi
}
\def\@dblflcheckspace#1#2{%
  \@tempdima=#1\relax
  \advance\@tempdima
     -\ifx #2\@empty \dbltextfloatsep\else\dblfloatsep\fi
  \ifdim\@tempdima>\ht\@currbox
    \@tempswatrue
  \else
    \ifnum\@fpstype<\sixt@@n
      \advance\@tempdima\@textmin
      \if \@tempdima>\ht\@currbox
        \@tempswatrue
      \fi
    \fi
  \fi
}
\def\@checkdblspace{%
   \@tempdima\@pageht\advance\@tempdima\@pagedp
   \@tempdimb\textfraction\@colht
   \ifdim\@tempdima<\@tempdimb \@tempdima\@tempdimb\fi
   \if@firstcolumn\else
     \advance\@tempdima\ht\@leftcolumn
     \advance\@tempdima\dp\@leftcolumn
   \fi
   \L@chkfloatht\advance\@tempdima\@floatht
   \R@chkfloatht\advance\@tempdima\@floatht
   \@chkdblfloatht\advance\@tempdima\tw@\@floatht
   \@tempdimb\ht\@currbox\advance\@tempdimb\dp\@currbox
   \advance\@tempdimb
      \ifdim\@floatht>\z@ \dbltextfloatsep\else\dblfloatsep\fi
   \multiply\@tempdimb\tw@ \advance\@tempdima\@tempdimb
   \ifdim\@tempdima>\tw@\textheight
     \@tempswafalse
   \else
     \@tempswatrue
   \fi
}
\def\tmp@comflelt#1{%
  \setbox\@tempboxa
  \vbox{\unvbox\@tempboxa\copy #1\vskip\floatsep}%
}
\def\tmp@comdblflelt#1{%
  \setbox\@tempboxa
  \vbox{\unvbox\@tempboxa\copy #1\vskip\dblfloatsep}%
}
\def\L@chkfloatht{\@floatht\z@
  \ifx\L@toplist\@empty\else
    \let\@elt\tmp@comflelt\setbox\@tempboxa\vbox{}\L@toplist
    \setbox\@ne\vbox{\boxmaxdepth\maxdepth
        \unvbox\@tempboxa\vskip-\floatsep\topfigrule\vskip\textfloatsep
        }%
    \let\@elt\relax \advance\@floatht\ht\@ne \advance\@floatht\dp\@ne
  \fi
  \ifx\L@botlist\@empty\else
    \let\@elt\tmp@comflelt\setbox\@tempboxa\vbox{}\L@botlist
    \setbox\@ne\vbox{\boxmaxdepth\maxdepth
        \vskip\textfloatsep\botfigrule\unvbox\@tempboxa\vskip-\floatsep
        }%
    \let\@elt\relax \advance\@floatht\ht\@ne \advance\@floatht\dp\@ne
  \fi
  \global\@floatht\@floatht
}
\def\R@chkfloatht{\@floatht\z@
  \ifx\R@toplist\@empty\else
    \let\@elt\tmp@comflelt\setbox\@tempboxa\vbox{}\R@toplist
    \setbox\@ne\vbox{\boxmaxdepth\maxdepth
        \unvbox\@tempboxa\vskip-\floatsep\topfigrule\vskip\textfloatsep
        }%
    \let\@elt\relax \advance\@floatht\ht\@ne \advance\@floatht\dp\@ne
  \fi
  \ifx\R@botlist\@empty\else
    \let\@elt\tmp@comflelt\setbox\@tempboxa\vbox{}\R@botlist
    \setbox\@ne\vbox{\boxmaxdepth\maxdepth
        \vskip\textfloatsep\botfigrule\unvbox\@tempboxa\vskip-\floatsep
        }%
    \let\@elt\relax \advance\@floatht\ht\@ne \advance\@floatht\dp\@ne
  \fi
  \global\@floatht\@floatht
}
\def\@chkdblfloatht{\@floatht\z@
  \ifx\@dbltoplist\@empty\else
    \let\@elt\tmp@comdblflelt\setbox\@tempboxa\vbox{}\@dbltoplist
    \setbox\@ne\vbox{\boxmaxdepth\maxdepth
        \unvbox\@tempboxa
        \vskip-\dblfloatsep
        \dblfigrule
        \vskip\dbltextfloatsep
        }%
    \let\@elt\relax \advance\@floatht\ht\@ne \advance\@floatht\dp\@ne
  \fi
  \ifx\@dblbotlist\@empty\else
    \let\@elt\tmp@comdblflelt\setbox\@tempboxa\vbox{}\@dblbotlist
    \setbox\@ne\vbox{\boxmaxdepth\maxdepth
        \vskip\dbltextfloatsep
        \dblfigrule
        \unvbox\@tempboxa
        \vskip-\dblfloatsep
        }%
    \let\@elt\relax \advance\@floatht\ht\@ne \advance\@floatht\dp\@ne
  \fi
  \global\@floatht\@floatht
}
\global\newdimen\@fixht
\def\@combinefloats{%
  %%\boxmaxdepth\maxdepth
  \if@twocolumn
    \if@firstcolumn
    \else
      \@fixht\ht\@leftcolumn \advance\@fixht\dp\@leftcolumn
      \@chkdblfloatht \@tempdima\@floatht
      \L@chkfloatht \advance\@tempdima\@floatht
      \advance\@fixht\@tempdima
      \ifdim\@fixht>\textheight
        \@fixht\textheight
        \advance\@fixht-\@tempdima
        \advance\@fixht\maxdepth
        \vbadness=\@M \splittopskip=\topskip \splitmaxdepth=\maxdepth
        \setbox\z@=\vsplit\@leftcolumn to\@fixht
        \advance\@fixht-\maxdepth
        \@tempdima\baselineskip \advance\@tempdima-\topskip
        \setbox\@outputbox=\vbox to\@fixht{%
            \ifvoid\@leftcolumn
            \else
              \unvbox\@leftcolumn\vskip\@tempdima
            \fi\relax
            \unvbox\@outputbox\vss}%
        \setbox\@leftcolumn=\vbox to\@fixht{\unvbox\z@}%
      \fi
      \@fixht\ht\@leftcolumn
        \advance\@fixht\dp\@leftcolumn \advance\@fixht\@floatht
      \ifx\L@toplist\@empty\else\L@cflt\fi
      \ifx\L@botlist\@empty\else\L@cflb\fi
      \ifx\R@toplist\@empty\else\R@cflt\fi
      \ifx\R@botlist\@empty\else\R@cflb\fi
    \fi
  \else
      \ifx\@toplist\@empty\else\@cflt\fi
      \ifx\@botlist\@empty\else\@cflb\fi
  \fi
}
\def\L@cflt{%
  \let\@elt\@comflelt\setbox\@tempboxa\vbox{}\L@toplist
  \setbox\@leftcolumn\vbox to\@fixht{\boxmaxdepth\maxdepth
      \unvbox\@tempboxa
      \vskip-\floatsep\topfigrule\vskip\textfloatsep\unvbox\@leftcolumn
      \vss}%
  \let\@elt\relax
  \xdef\@freelist{\@freelist\L@toplist}\global\let\L@toplist\@empty
}
\def\L@cflb{%
  \let\@elt\@comflelt\setbox\@tempboxa\vbox{}\L@botlist
  \setbox\@leftcolumn\vbox to\@fixht{\boxmaxdepth\maxdepth
      \unvbox\@leftcolumn
      \vskip\textfloatsep\botfigrule\unvbox\@tempboxa\vskip-\floatsep
      \vss}%
  \let\@elt\relax
  \xdef\@freelist{\@freelist\L@botlist}\global\let\L@botlist\@empty
}
\def\R@cflt{%
  \let\@elt\@comflelt\setbox\@tempboxa\vbox{}\R@toplist
  \setbox\@outputbox\vbox to\@fixht{\boxmaxdepth\maxdepth
      \unvbox\@tempboxa
      \vskip-\floatsep\topfigrule\vskip\textfloatsep\unvbox\@outputbox
      \vss}%
  \let\@elt\relax
  \xdef\@freelist{\@freelist\R@toplist}\global\let\R@toplist\@empty
}
\def\R@cflb{%
  \let\@elt\@comflelt\setbox\@tempboxa\vbox{}\R@botlist
  \setbox\@outputbox\vbox to\@fixht{\boxmaxdepth\maxdepth
      \unvbox\@outputbox
      \vskip\textfloatsep\botfigrule\unvbox\@tempboxa\vskip-\floatsep
      \vss}%
  \let\@elt\relax
  \xdef\@freelist{\@freelist\R@botlist}\global\let\R@botlist\@empty
}
\def\@combinedblfloats{%
  \ifx\@dbltoplist\@empty
  \else
    \let\@elt\@comdblflelt\setbox\@tempboxa\vbox{}\@dbltoplist
    \setbox\@outputbox\vbox{\boxmaxdepth\maxdepth
       \unvbox\@tempboxa
       \vskip-\dblfloatsep
       \dblfigrule
       \vskip\dbltextfloatsep
       \box\@outputbox}%
    \let\@elt\relax\xdef\@freelist{\@freelist\@dbltoplist}%
    \global\let\@dbltoplist\@empty
  \fi
  \ifx\@dblbotlist\@empty
  \else
    \let\@elt\@comdblflelt\setbox\@tempboxa\vbox{}\@dblbotlist
    \setbox\@outputbox\vbox{\boxmaxdepth\maxdepth
       \box\@outputbox
       \vskip\dbltextfloatsep
       \dblfigrule
       \unvbox\@tempboxa
       \vskip-\dblfloatsep
       }%
    \let\@elt\relax\xdef\@freelist{\@freelist\@dblbotlist}%
    \global\let\@dblbotlist\@empty
  \fi
  \global\setbox\@outputbox\vbox to\textheight{\unvbox\@outputbox}%
}
\newif\if@balance \@balancefalse
\newbox\@combinebox
\def\@outputdblcol{%
  \if@firstcolumn
    \global\@firstcolumnfalse
    \global\setbox\@leftcolumn\box\@outputbox
    \@colht\textheight
    \@chkdblfloatht\global\advance\@colht-\@floatht
  \else
    \global\@firstcolumntrue
    \if@balance % $B:81&%+%i%`$r6QEy$KJ,3d(B
      \@tempdima\baselineskip
      \advance\@tempdima-\topskip
      % $BO"7k(B
      \setbox\@combinebox=\vbox{%
          \unvbox\@leftcolumn\vskip\@tempdima\unvbox\@outputbox}%
      \@tempdima\ht\@combinebox
      \advance\@tempdima\dp\@combinebox
      \divide\@tempdima\tw@
      % $BJ,3d(B
      \vbadness=\@M \splittopskip=\topskip \splitmaxdepth=\maxdepth
      \setbox\@leftcolumn=\vsplit\@combinebox to\@tempdima
      \setbox\@outputbox=\vtop{\unvbox\@combinebox}
      \setbox\@leftcolumn=\vtop{\unvbox\@leftcolumn}
    \fi
    % $B@07A(B
    \@tempdima\ht\@leftcolumn
    \setbox\@outputbox\vbox to\@tempdima{%
      \hb@xt@\textwidth{%
        \hb@xt@\columnwidth{%
           \vbox to\@tempdima{\box\@leftcolumn\vss}\hss}%
        \hfil
        \vrule width\columnseprule
        \hfil
        \hb@xt@\columnwidth{%
           \vbox to\@tempdima{\box\@outputbox\vss}\hss}%
      }%
      \vss
    }%
    \@combinedblfloats
    \@outputpage
    \begingroup
      \@dblfloatplacement
      \@startdblcolumn
      \@whilesw\if@fcolmade \fi{\@outputpage\@startdblcolumn}%
    \endgroup
  \fi
  \global\@balancefalse
}
\def\@startdblcolumn{%
  \global\@colht\textheight
  \@tryfcolumn\@dbldeferlist
  \if@fcolmade
  \else
    \begingroup
      \let\reserved@b\@dbldeferlist
      \global\let\@dbldeferlist\@empty
      \let\@elt\@sdblcolelt
      \reserved@b
    \endgroup
  \fi
  \@chkdblfloatht
  \global\advance\@colht-\@floatht
}
\def\@doclearpage{%
  \ifvoid\footins
    \setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa
    \setbox\@tempboxa\box\@cclv
    \xdef\@deferlist{%
       \L@toplist\R@toplist\L@botlist\R@botlist\@deferlist}%
    \global\let\L@toplist\@empty % changed from \@toplist
    \global\let\R@toplist\@empty % added
    \global\let\L@botlist\@empty % changed from \@botlist
    \global\let\R@botlist\@empty % added
    \global\@colroom\@colht
    \ifx\@currlist\@empty
    \else
      \@latexerr{Float(s) lost}\@ehb
        \global\let\@currlist\@empty
    \fi
    \@makefcolumn\@deferlist
    \@whilesw\if@fcolmade \fi{\@opcol\@makefcolumn\@deferlist}%
    \if@twocolumn
      \if@firstcolumn
        % added \@dblbotlist
        \xdef\@dbldeferlist{\@dbltoplist\@dblbotlist\@dbldeferlist}%
        \global\let\@dbltoplist\@empty
        \global\let\@dblbotlist\@empty % added
        \global\@colht\textheight
        \begingroup
          \@dblfloatplacement
          \@makefcolumn\@dbldeferlist
          \@whilesw\if@fcolmade \fi{\@outputpage
                                    \@makefcolumn\@dbldeferlist}%
        \endgroup
      \else
        \vbox{}\clearpage
      \fi
    \fi
  \else
    \setbox\@cclv\vbox{\box\@cclv\vfil}%
    \@makecol\@opcol
    \clearpage
  \fi
}
\long\def\@topnewpage[#1]{%
  %\@nodocument
  \@next\@currbox\@freelist{}{}%
  \global\setbox\@currbox
    \color@vbox
      \normalcolor
      \vbox{\hsize\textwidth
            \@parboxrestore
            \col@number\@ne
            #1%
            \vskip-\dbltextfloatsep}%
    \color@endbox
  \ifdim\ht\@currbox>\textheight
    \ht\@currbox\textheight
  \fi
  \global\count\@currbox\tw@
  \@tempdima-\ht\@currbox
  \advance\@tempdima-\dbltextfloatsep
  \global\advance\@colht\@tempdima
  \ifx\@dbltoplist\@empty
  \else
    \@latexerr{Float(s) lost}\@ehb
    \let\@dbltoplist\@empty
  \fi
  \@cons\@dbltoplist\@currbox
  \global\@dbltopnum\m@ne
  \global\@dblbotnum\m@ne % added
  \ifdim\@colht<2.5\baselineskip
    \@latex@warning@no@line {Optional argument of \noexpand\twocolumn
          too tall on page \thepage}%
    \@emptycol
    \if@firstcolumn
    \else
      \@emptycol
    \fi
  \else
    \global\vsize\@colht
    \global\@colroom\@colht
    \@floatplacement
  \fi
  %\global\@dbltoproom\maxdimen
  %\global\@dblbotroom\maxdimen
  %\@addtodblcol
}
\def\balancenewpage{\par\vfil\global\@balancetrue\penalty-\@M}
\def\balanceclearpage{\balancenewpage
    \write\m@ne{}\vbox{}\global\@balancetrue\penalty-\@Mi}
\endinput
%%
%% End of file `nidanfloat.sty'.
