Blob Blame History Raw
%%
%% This is file `nomulticol.sty',
%% a tweak in package multicol.sty [2000/07/10 v1.5z  multicolumn formatting (FMi)]
%% Tweaked by Dirk Roorda 2003/01/09
%%
%% purpose: to have the \begin{multicols} \end{multicols} functionality without
%% putting the material inside a group
%%
%% reason: in PassiveTeX a fo:flow is embedded in a multicols environment.
%% But the fo:block span="all" must be able to interrupt this.
%% However, sayin \end{multicols} just before and \begin{multicols}{N} just after
%% does not work, because it makes the attributes, set between the start of the flow
%% and the beginning of the block, invisible.
%% That's why a grouping-transparent multicol setup is needed.
%%
%% method:
%% providing macros \nobeginmulticols \noendmulticols that do essentially the same
%% but do not create a group.
%% I just removed the crucial \begingroup and \endgroup from \mult@@cols and \endmulticols.
%% Instead of relying on the TeX group restore mechanism, I have added macros
%% \save@mult@settings and \restore@mult@settings to mimick the grouping as far
%% as the settings for the multicol package are concerned.

%%
%% This is file `multicol.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% multicol.dtx  (with options: `package,badness,check,marktrace,nobalance,colbreak')
%% 
%% This is a generated file.
%% 
%% Copyright 1993 1994 1995 1996 1997 1998 1999 2000
%% The LaTeX3 Project and any individual authors listed elsewhere
%% in this file.
%% 
%% This file was generated from file(s) of the Standard LaTeX `Tools Bundle'.
%% --------------------------------------------------------------------------
%% 
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.2
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%% and version 1.2 or later is part of all distributions of LaTeX
%% version 1999/12/01 or later.
%% 
%% This file may only be distributed together with a copy of the LaTeX
%% `Tools Bundle'. You may however distribute the LaTeX `Tools Bundle'
%% without such generated files.
%% 
%% The list of all files belonging to the LaTeX `Tools Bundle' is
%% given in the file `manifest.txt'.
%% 
%% Package `multicol' to use with LaTeX2e
%% Copyright 1989-2000 Frank Mittelbach
%%
%%  In addition to the terms of LPPL any distributed version
%%  (unchanged or modified) of multicol has to keep the statement
%%  about the moral obligation for using multicol. In case of major
%%  changes where this would not be appropriate the author of the
%%  changed version should contact the copyright holder.
%%
%%
%%  Moral obligation for using multicol:
%%  ------------------------------------
%%
%%  Users of multicol who wish to include or use multicol or a modified
%%  version in a proprietary and commercially market product are asked
%%  under certain conditions (see below) for the payment of a license
%%  fee.  The size of this fee is to be determined, in each instance,
%%  by the commercial user, depending on his/her judgment of the value of
%%  multicol for his/her product.
%%
%%
%%  The conditions for this are as follows:
%%
%%   The producer of a proprietary and commercially market product
%%   that involves typesetting using multicol is asked to determine
%%   the value of a license fee for using multicol if
%%
%%   - the product is a document and the producer has decided to
%%     include multicol to typeset (parts of) the document or has
%%     directed the author of the document to include multicol (for
%%     example, by providing a class file to be used by the author)
%%
%%   - the product is a LaTeX class or package that includes multicol
%%
%%
%%   There is no moral obligation in case
%%
%%   - the product is a document but producer has not directed
%%     the author to include multicol (in that case the moral obligation
%%     lies with the author of the document)
%%
%%   - the product does not involve typesetting, e.g., consists, for
%%     example, of distributing multicol and its documentation.
%%
%%   - the product is not proprietary, i.e., is made available as free
%%     software itself (which doesn't prohibit its commercial marketing)
%%
%%   - multicol is used for non-commercial purposes
%%
%%
%% Determinating a license fee might result in a license fee of zero
%% (i.e., no payment) in case a producer has determined that the use
%% of multicol has no enhancing effect on the product. This is a
%% plausible scenario, i.e., in the above two cases the producer is
%% only asked to evaluate the value of multicol for the product
%% not for the payment of a license fee per se (which might or might
%% not follow from this evaluation).
%%
%% The license fee, if any, can be payed either to the LaTeX3 fund
%% (see ltx3info.txt in the base LaTeX distribution) or to the author of
%% the program who can be contacted at
%%
%%     Frank.Mittelbach@latex-project.org
%%
\NeedsTeXFormat{LaTeX2e}[1997/12/01]
\ProvidesPackage{nomulticol}
          [2003/01/09 v1.5z  multicolumn formatting (FMi)]
%% \CheckSum{1451}
%% \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         \~}
%%
\DeclareOption{twocolumn}
   {\PackageWarning{nomulticol}{May not work
             with the twocolumn option}}
\newcount\c@tracingmulticols
\DeclareOption{errorshow}
    {\c@tracingmulticols\z@}
\DeclareOption{infoshow}
    {\c@tracingmulticols\@ne}
\DeclareOption{balancingshow}
    {\c@tracingmulticols\tw@}
\DeclareOption{markshow}
    {\c@tracingmulticols\thr@@}
\DeclareOption{debugshow}
    {\c@tracingmulticols5\relax}
\ProcessOptions

%%
%% Start Additions by Dirk Roorda
%%

\def\show@mult@settings{%
   \typeout{LINEWIDTH=SAVED=\sav@linewidth; CURRENT=\the\linewidth}%
   \typeout{COLUMNWIDTH=SAVED=\sav@columnwidth; CURRENT=\the\columnwidth}%
   \typeout{FULL@WIDTH=SAVED=\sav@full@width; CURRENT=\the\full@width}%
   \typeout{HSIZE=SAVED=\sav@hsize; CURRENT=\the\hsize}%
   \typeout{VSIZE=SAVED=\sav@vsize; CURRENT=\the\vsize}%
   \typeout{BASELINESKIP=SAVED=\sav@baselineskip; CURRENT=\the\baselineskip}%
   \typeout{EMERGENCYSTRETCH=SAVED=\sav@emergencystretch; CURRENT=\the\emergencystretch}%
   \typeout{PRETOLERANCE=SAVED=\sav@pretolerance; CURRENT=\the\pretolerance}%
   \typeout{TOLERANCE=SAVED=\sav@tolerance; CURRENT=\the\tolerance}%
   \typeout{HBADNESS=SAVED=\sav@hbadness; CURRENT=\the\hbadness}%
   \typeout{VBADNESS=SAVED=\sav@vbadness; CURRENT=\the\vbadness}%
   \typeout{PARSHAPE=SAVED=\sav@parshape; CURRENT=\the\parshape}%
   \typeout{@TOTALLEFTMARGIN=SAVED=\sav@totalleftmargin; CURRENT=\the\@totalleftmargin}%
   \typeout{MULTICOL@LEFTMARGIN=SAVED=\sav@multicol@leftmargin; CURRENT=\the\multicol@leftmargin}%
   \typeout{@COLROOM=SAVED=\sav@colroom; CURRENT=\the\@colroom}%
   \typeout{DOUBLECOL@NUMBER=SAVED=\sav@doublecol@number; CURRENT=\the\doublecol@number}%
   \typeout{@TEMPDIMA=SAVED=\sav@tempdima; CURRENT=\the\@tempdima}%
   \typeout{FOOTINS=SAVED=\sav@count@footins; CURRENT=\the\count\footins}%
   \typeout{FOOTINS=SAVED=\sav@skip@footins; CURRENT=\the\skip\footins}%
%
   \typeout{COL@NUMBER=SAVED=\sav@col@number; CURRENT=\the\col@number}%
   \typeout{PAGE@FREE=SAVED=\sav@page@free; CURRENT=\the\page@free}%
   \typeout{@TEMPSKIPA=SAVED=\sav@tempskipa; CURRENT=\the\@tempskipa}%
}

\def\explain@mult@settings{%
	\typeout{linewidth=\meaning\linewidth}%
	\typeout{columnwidth=\meaning\columnwidth}%
	\typeout{full-width=\meaning\full@width}%
	\typeout{hsize=\meaning\hsize}%
	\typeout{vsize=\meaning\vsize}%
	\typeout{baselineskip=\meaning\baselineskip}%
	\typeout{emergencystretch=\meaning\emergencystretch}%
	\typeout{pretolerance=\meaning\pretolerance}%
	\typeout{tolerance=\meaning\tolerance}%
	\typeout{hbadness=\meaning\hbadness}%
	\typeout{vbadness=\meaning\vbadness}%
	\typeout{parshape=\meaning\parshape}%
	\typeout{-totalleftmargin=\meaning\@totalleftmargin}%
	\typeout{multicol-leftmargin=\meaning\multicol@leftmargin}%
	\typeout{-colroom=\meaning\@colroom}%
	\typeout{doublecol-number=\meaning\doublecol@number}%
	\typeout{-tempdima=\meaning\@tempdima}%
	\typeout{-tempskipa=\meaning\@tempskipa}%
	\typeout{page-free=\meaning\page@free}%
	\typeout{col-number=\meaning\col@number}%
}

\def\save@mult@settings{%
   \xdef\sav@linewidth{\the\linewidth}%
   \xdef\sav@columnwidth{\the\columnwidth}%
   \xdef\sav@full@width{\the\full@width}%
   \xdef\sav@hsize{\the\hsize}%
   \xdef\sav@vsize{\the\vsize}%
   \xdef\sav@baselineskip{\the\baselineskip}%
   \xdef\sav@emergencystretch{\the\emergencystretch}%
   \xdef\sav@pretolerance{\the\pretolerance}%
   \xdef\sav@tolerance{\the\tolerance}%
   \xdef\sav@hbadness{\the\hbadness}%
   \xdef\sav@vbadness{\the\vbadness}%
   \xdef\sav@parshape{\the\parshape}%
   \xdef\sav@totalleftmargin{\the\@totalleftmargin}%
   \xdef\sav@multicol@leftmargin{\the\multicol@leftmargin}%
   \xdef\sav@colroom{\the\@colroom}%
   \xdef\sav@doublecol@number{\the\doublecol@number}%
   \xdef\sav@tempdima{\the\@tempdima}%
   \xdef\sav@count@footins{\the\count\footins}%
   \xdef\sav@skip@footins{\the\skip\footins}%
   \global\let\sav@dblfloat\@dblfloat
   \global\let\sav@end@dblfloat\end@dblfloat
   \xdef\sav@output{\the\output}%
   \global\let\sav@reserved@c\reserved@c
%
   \xdef\sav@col@number{\the\col@number}%
   \xdef\sav@page@free{\the\page@free}%
   \xdef\sav@tempskipa{\the\@tempskipa}%
   \global\let\sav@reserved@a\reserved@a
   \global\let\sav@reserved@b\reserved@b
   \global\let\sav@reserved@d\reserved@d
   \global\let\sav@let@token\@let@token
   \global\let\sav@footnotetext\@footnotetext
   \global\let\sav@orig@footnotetext\orig@footnotetext
}

\def\restore@mult@settings{%
	\global\linewidth\sav@linewidth\relax
	\global\columnwidth\sav@columnwidth\relax
	\global\full@width\sav@full@width\relax
	\global\hsize\sav@hsize\relax
	\global\vsize\sav@vsize\relax
	\global\baselineskip\sav@baselineskip\relax
	\global\emergencystretch\sav@emergencystretch\relax
	\global\pretolerance\sav@pretolerance\relax
	\global\tolerance\sav@tolerance\relax
	\global\hbadness\sav@hbadness\relax
	\global\vbadness\sav@vbadness\relax
	\global\parshape\sav@parshape\relax
	\global\@totalleftmargin\sav@totalleftmargin\relax
	\global\multicol@leftmargin\sav@multicol@leftmargin\relax
	\global\@colroom\sav@colroom\relax
	\global\doublecol@number\sav@doublecol@number\relax
	\global\@tempdima\sav@tempdima\relax
	\global\count\footins\sav@count@footins\relax
	\global\skip\footins\sav@skip@footins\relax
	\global\let\@dblfloat\sav@dblfloat
	\global\let\end@dblfloat\sav@end@dblfloat
	\global\expandafter\output\expandafter{\sav@output}%
	\global\let\reserved@c\sav@reserved@c
%
	\global\col@number\sav@col@number\relax
	\global\page@free\sav@page@free\relax
	\global\@tempskipa\sav@tempskipa\relax
	\global\let\reserved@a\sav@reserved@a
	\global\let\reserved@b\sav@reserved@b
	\global\let\reserved@d\sav@reserved@d
	\global\let\@let@token\sav@let@token
	\global\let\@footnotetext\sav@footnotetext
	\global\let\orig@footnotetext\sav@orig@footnotetext
}

\def\nobeginmulticols#1{%
\typeout{^^JSTART #1 COLUMNS}%
	\save@mult@settings
	\global\col@number#1\relax
  \ifnum\col@number<\tw@
     \PackageWarning{multicol}%
      {Using `\number\col@number'
       columns doesn't seem a good idea.^^J
       I therefore use two columns instead}%
     \global\col@number\tw@ \fi
  \ifnum\col@number>10
     \PackageError{multicol}%
      {Too many columns}%
      {Current implementation doesn't
       support more than 10 columns.%
       \MessageBreak
       I therefore use 10 columns instead}%
     \global\col@number10 \fi
     \global\let\orig@footnotetext\@footnotetext
     \long\gdef\@footnotetext##1{\begingroup
         \columnwidth\textwidth
         \orig@footnotetext{##1}\endgroup}%
  \@ifnextchar[\nomult@cols{\nomult@cols[]}}

\def\nomult@cols[#1]{\@ifnextchar[%
  {\nomult@@cols{#1}}%
  {\nomult@@cols{#1}[\premulticols]}}

\def\nomult@@cols#1[#2]{%
  \par
  \ifinner \global\@boxedmulticolstrue
  \else
    \ifnum \doublecol@number>\z@
       \global\@boxedmulticolstrue
    \fi
  \fi
  \mult@info\z@
      {Starting environment with
       \the\col@number\space columns%
        \if@boxedmulticols\MessageBreak
           (boxed mode)\fi
      }%
   \enough@room{#2}%
   #1\par\addvspace\multicolsep
%   \begingroup
     \prepare@multicols
     \if@boxedmulticols
       \global\setbox\mult@box\vbox\bgroup
     \fi
     \ignorespaces}

\def\noendmulticols{\par
  \if@boxedmulticols
    \egroup
    %\balance@columns
    \return@nonemptymark{first}%
                 \kept@firstmark
    \return@nonemptymark{bot}%
                  \kept@botmark
    \page@sofar
    \global\let\kept@firstmark\l@kept@firstmark
    \global\let\kept@botmark\l@kept@botmark
    \mult@info\tw@
      {Restore kept marks to\MessageBreak
       first: \meaning\kept@firstmark
       \MessageBreak bot\space\space:
                     \meaning\kept@botmark }%
  \else
   \penalty\z@
    \global\output{\balance@columns@out}\eject
    \ifvbox\partial@page
         \unvbox\partial@page\fi
     \global\let\kept@firstmark\@empty
     \global\let\kept@botmark\@empty
     \mult@info\tw@
       {Make kept marks empty}%
  \fi
%  \@checkend{multicols}%
%  \endgroup
  \global\c@unbalance\z@
  \if@boxedmulticols\else
    \reinsert@footnotes
    \ifdim \pagegoal=\maxdimen
      \global\vsize\@colroom
    \else
      \enough@room\postmulticols
    \fi
  \fi
  \addvspace\multicolsep
  \mult@info\z@
     {Ending environment
             \if@boxedmulticols
                \space(boxed mode)\fi
              }%
\typeout{^^JSTOP \the\col@number\space COLUMNS}%
	   \restore@mult@settings
}

%%
%% End Additions by Dirk Roorda
%%

%%
%% The following code is unmodified, except that many local
%% statements have been globalized
%%

\newif\if@boxedmulticols
\global\@boxedmulticolsfalse

\newbox\mult@box

\def\enough@room#1{%
   \if@boxedmulticols\else
   \par
   \bgroup\@nobreakfalse\addpenalty\z@\egroup
   \global\page@free\pagegoal
   \global\advance\page@free -\pagetotal
     \global\@tempskipa#1\relax
   \mult@info\z@
       {Current page:\MessageBreak
        height=%
        \the\pagegoal: used \the\pagetotal
        \space -> free=\the\page@free
        \MessageBreak
        needed \the\@tempskipa
              \space(for #1)}%
   \ifdim\page@free<#1\newpage \fi
  \fi}

\newif\ifmult@just@prepared

\def\prepare@multicols{%
  \global\multicol@leftmargin\@totalleftmargin
  \global\@totalleftmargin\z@
  \global\parshape\z@
  \global\doublecol@number\col@number
  \global\multiply\doublecol@number\tw@
  \global\advance\doublecol@number\mult@rightbox
  \if@boxedmulticols
    \global\let\l@kept@firstmark\kept@firstmark
    \global\let\l@kept@botmark\kept@botmark
    \global\let\kept@firstmark\@empty
    \global\let\kept@botmark\@empty
  \else
    \nointerlineskip {\global\topskip\z@\null}%
    \global\output{%
      \global\setbox\partial@page\vbox
        {%
         \ifvoid\partial@page\else
           \PackageError{multicol}%
            {Error saving partial page}%
            {The part of the page before
             the multicols environment was
             nearly full with^^Jthe result
             that starting the environment
             will produce an overfull
             page.  Some^^Jtext may be lost!
             Please increase \premulticols
             either generally or for this%
             ^^Jenvironment by specifying a
             suitable value in the second
             optional argument to^^Jthe
             multicols environment.}
           \unvbox\partial@page
           \box\last@line
         \fi
         \unvbox\@cclv
         \global\setbox\last@line\lastbox
        }%
           \prep@keptmarks
           \global\let\kept@topmark\firstmark
          }\eject
    \global\advance\@colroom-\ht\partial@page
    \set@mult@vsize\relax
    \global\output{\multi@column@out}%
    \init@mult@footins
    \reinsert@footnotes
  \fi
  \global\vbadness\@Mi \global\hbadness5000
  \global\tolerance\multicoltolerance
  \global\pretolerance\multicolpretolerance
  \setemergencystretch\col@number\hsize
  \set@floatcmds
  \global\advance\baselineskip\multicolbaselineskip
  \global\hsize\linewidth \global\advance\hsize\columnsep
  \global\advance\hsize-\col@number\columnsep
  \global\divide\hsize\col@number
  \global\full@width\linewidth
  \global\linewidth\hsize
  \global\columnwidth\hsize
  \global\mult@just@preparedtrue
%\typeout{SETTING JUSTPREPARED to TRUE}%
}

\def\refreshmulticols{%
%\typeout{REFRESH?}%
  \ifmult@just@prepared
%\typeout{NO, JUSTPREPARED!}%
  \else
%\typeout{YES}%
	\global\multicol@leftmargin\@totalleftmargin
	\global\@totalleftmargin\z@
	\global\parshape\z@
	\global\doublecol@number\col@number
	\global\multiply\doublecol@number\tw@
	\global\advance\doublecol@number\mult@rightbox
	\if@boxedmulticols
		\global\let\l@kept@firstmark\kept@firstmark
		\global\let\l@kept@botmark\kept@botmark
		\global\let\kept@firstmark\@empty
		\global\let\kept@botmark\@empty
	\else
		\nointerlineskip {\global\topskip\z@\null}%
		\global\advance\@colroom-\ht\partial@page
		\set@mult@vsize\relax
		\init@mult@footins
	%   \reinsert@footnotes
	\fi
	\global\vbadness\@Mi \global\hbadness5000
	\global\tolerance\multicoltolerance
	\global\pretolerance\multicolpretolerance
	\setemergencystretch\col@number\hsize
	\set@floatcmds
	%  \global\advance\baselineskip\multicolbaselineskip
	\global\hsize\linewidth \global\advance\hsize\columnsep
	\global\advance\hsize-\col@number\columnsep
	\global\divide\hsize\col@number
	\global\full@width\linewidth
	\global\linewidth\hsize
	\global\columnwidth\hsize
	\global\mult@just@preparedtrue
%\typeout{SETTING JUSTPREPARED to TRUE}%
  \fi
}

\def\init@mult@footins{%
    \global\multiply\count\footins\col@number
    \global\multiply\skip \footins\col@number
}

\def\set@mult@vsize#1{%
    \global\vsize\@colroom
    \global\@tempdima\baselineskip
    \global\advance\@tempdima-\topskip
    \global\advance\vsize\@tempdima
    \global\vsize\col@number\vsize
    \global\advance\vsize-\@tempdima
    #1\global\advance\vsize\c@collectmore\baselineskip}

\newdimen\multicol@leftmargin
\newcount\c@unbalance
\newcount\c@collectmore
\newcount\doublecol@number
\newcount\multicoltolerance
\newcount\multicolpretolerance
\newdimen\full@width
\newdimen\page@free
\newdimen\premulticols
\newdimen\postmulticols
\newskip\multicolsep
\newskip\multicolbaselineskip
\newbox\partial@page
\newbox\last@line
\global\c@unbalance   = 0
\global\c@collectmore = 0
\global\col@number = 1
\global\multicoltolerance = 9999
\global\multicolpretolerance = -1
\global\premulticols = 50pt
\global\postmulticols= 20pt
\global\multicolsep = 12pt plus 4pt minus 3pt
\global\multicolbaselineskip=0pt

\def\process@cols#1#2{\global\count@#1\relax
     \loop
      #2%
     \global\advance\count@\tw@
     \ifnum\count@<\doublecol@number
   \repeat}

\def\page@sofar{%
   \process@cols\mult@rightbox
       {\ifvoid\count@
          \setbox\count@\hbox to\hsize{}%
        \else
          \wd\count@\hsize
        \fi}%
   \mult@info\z@
    {Column spec:\MessageBreak
       (\the\multicol@leftmargin\space -->
        \the\full@width\space = \the\hsize
        \space x \the\col@number)%
     }%
\ifvmode\else\errmessage{Multicol Error}\fi
   \moveright\multicol@leftmargin
    \hbox to\full@width{%
     \process@cols\mult@gfirstbox{\box\count@
       \hss{\normalcolor\vrule\@width\columnseprule}\hss}%
     \box\mult@rightbox
      \rlap{\phantom p}%
    }%
}

\def\reinsert@footnotes{\ifvoid\footins\else
         \insert\footins{}\fi}

\def\multi@column@out{%
	\ifnum\outputpenalty <-\@M
   		\speci@ls
	\else
		\global\mult@just@preparedfalse
%\typeout{SETTING JUSTPREPARED TO FALSE}%
   		\ifvoid\colbreak@box
		\else
     		\mult@info\@ne{Re-adding forced
               break(s) for splitting}%
     		\setbox\@cclv\vbox{%
        	\unvbox\colbreak@box
        	\penalty-\@Mv\unvbox\@cclv}%
   		\fi
   		\splittopskip\topskip
   		\splitmaxdepth\maxdepth
   		\global\dimen@\@colroom
   		\global\divide\skip\footins\col@number
   		\ifvoid\footins
		\else
      		\leave@mult@footins
   		\fi
   		\process@cols\mult@gfirstbox{%
        	\setbox\count@\vsplit\@cclv to\dimen@
        	\set@keptmarks
   			\ifshr@nking
       			\setbox\count@\vbox to\dimen@{\unvbox\count@\vfill}%
      		\fi
    	}%
   		\global\setbox\mult@rightbox\vsplit\@cclv to\dimen@
   		\set@keptmarks
   		\ifshr@nking
      		\global\setbox\mult@rightbox\vbox to\dimen@{\unvbox\mult@rightbox\vfill}%
   		\fi
   		\ifvoid\@cclv
		\else
       		\unvbox\@cclv
       		\penalty\outputpenalty
       		\ifvoid\footins
			\else
         		\PackageWarning{multicol}%
          				{I moved some lines to
           				the next page.\MessageBreak
           				Footnotes on page
           				\thepage\space might be wrong}%
       		\fi
       		\ifnum \c@tracingmulticols>\thr@@
       			\hrule\allowbreak
			\fi
   		\fi
   		\ifx\@empty\kept@firstmark
      		\global\let\firstmark\kept@topmark
      		\global\let\botmark\kept@topmark
   		\else
      		\global\let\firstmark\kept@firstmark
      		\global\let\botmark\kept@botmark
   		\fi
   		\global\let\topmark\kept@topmark
   		\mult@info\tw@
        	{Use kept top mark:\MessageBreak
          	\meaning\kept@topmark
         	\MessageBreak
         	Use kept first mark:\MessageBreak
          	\meaning\kept@firstmark
        	\MessageBreak
         	Use kept bot mark:\MessageBreak
          	\meaning\kept@botmark
        	\MessageBreak
         	Produce first mark:\MessageBreak
          	\meaning\firstmark
        	\MessageBreak
        	Produce bot mark:\MessageBreak
          	\meaning\botmark
         	\@gobbletwo}%
   		\setbox\@cclv\vbox{\unvbox\partial@page\page@sofar}%
   		\@makecol\@outputpage
     	\global\let\kept@topmark\botmark
     	\global\let\kept@firstmark\@empty
     	\global\let\kept@botmark\@empty
     	\mult@info\tw@
        	{(Re)Init top mark:\MessageBreak
         	\meaning\kept@topmark
         	\@gobbletwo}%
   		\global\@colroom\@colht
   		\process@deferreds
   		\@whilesw\if@fcolmade\fi{\@outputpage
      		\global\@colroom\@colht
      		\process@deferreds}%
   		\mult@info\@ne
     		{Colroom:\MessageBreak
      		\the\@colht\space
              	after float space removed
              	= \the\@colroom \@gobble}%
    	\set@mult@vsize \global
  	\fi
}

\def\leave@mult@footins{%
   \global\advance\dimen@-\skip\footins
   \global\advance\dimen@-\ht\footins
}

\def\speci@ls{%
 \ifnum\outputpenalty <-\@Mi
  \ifnum \outputpenalty<-\@MM
   \PackageError{multicol}{Document end
           inside multicols environment}\@ehd
   \@specialoutput
  \else
     \ifnum\outputpenalty = -\@Mv
         \mult@info\@ne{Forced column
                        break seen}%
         \global\advance\vsize-\pagetotal
         \global\setbox\colbreak@box
                \vbox{\ifvoid\colbreak@box
                      \else
                        \unvbox\colbreak@box
                        \penalty-\@Mv
                      \fi
                      \unvbox\@cclv}
         \reinsert@footnotes
     \else
        \PackageWarning{multicol}%
           {Floats and marginpars not
            allowed inside `multicols'
            environment!
           \@gobble}%
        \unvbox\@cclv\reinsert@footnotes
       \xdef\@freelist{\@freelist\@currlist}%
       \gdef\@currlist{}%
     \fi
  \fi
 \else \@doclearpage \fi
}

\def\process@deferreds{%
   \@floatplacement
   \@tryfcolumn\@deferlist
   \if@fcolmade\else
     \begingroup
    \let\@tempb\@deferlist
      \gdef\@deferlist{}%
      \let\@elt\@scolelt
        \@tempb \endgroup
   \fi}

\newif\ifshr@nking

\def\raggedcolumns{%
   \@bsphack\global\shr@nkingtrue\@esphack}

\def\flushcolumns{%
   \@bsphack\global\shr@nkingfalse\@esphack}

\def\balance@columns@out{%
   \global\setbox\mult@box\vbox{%
       \ifvoid\colbreak@box\else
         \unvbox\colbreak@box\break
         \mult@info\@ne{Re-adding
           forced break(s) in balancing}%
       \fi
       \unvbox\@cclv}%
   \balance@columns
   \global\vsize\@colroom
   \global\advance\vsize\ht\partial@page
   \unvbox\partial@page
   \return@nonemptymark{first}\kept@firstmark
   \return@nonemptymark{bot}\kept@botmark
   \page@sofar
   \penalty\z@
}

\def\balance@columns{%
   \get@keptmarks\mult@box
   \global\setbox\mult@box\vbox{%
        \penalty-\@M
        \unvbox\mult@box
        \remove@discardable@items
        }%
   \global\@tempdima\topskip
   \global\splittopskip\@tempdima
       \@plus\multicolundershoot
       \@minus\multicolovershoot
   \splitmaxdepth\maxdepth
   \setbox\@tempboxa\vsplit\mult@box to\z@
   \global\@tempdima\ht\mult@box
   \global\advance\@tempdima\dp\mult@box
   \global\divide\@tempdima\col@number
   \global\count@\@tempdima
   \global\divide\count@\baselineskip
   \global\dimen@\count@\baselineskip
   \global\advance\dimen@\topskip
   \ifdim \dimen@ >\@tempdima
     \global\advance\dimen@-\baselineskip
   \fi
   \global\advance\dimen@\c@unbalance\baselineskip
   \mult@info\@ne
      {Balance columns\on@line:
        \ifnum\c@unbalance=\z@\else
       (off balance=\number\c@unbalance)\fi
      \@gobbletwo}%
   \ifnum\dimen@<\topskip
     \mult@info\@ne
       {Start value
          \the\dimen@  \space ->
          \the\topskip \space (corrected)}%
     \global\dimen@\topskip
   \fi
   \global\vbadness\@M
   \global\vfuzz \col@number\baselineskip
   \global\last@try-\p@
   \loop
    {\process@cols\mult@grightbox
           {\global\setbox\count@
                   \box\voidb@x}}%
    \global\setbox\mult@grightbox
           \copy\mult@box
   \global\too@badfalse
   {\process@cols\mult@firstbox{%
         \global\setbox\count@
         \vsplit\mult@grightbox to\dimen@
         \ifnum\c@tracingmulticols>\@ne
           \@tempcnta\count@
           \advance\@tempcnta-\mult@grightbox
           \divide\@tempcnta \tw@
           \message{^^JColumn
              \number\@tempcnta\space
               badness: \the\badness\space}%
         \fi
         \ifnum\badness>\c@columnbadness
           \ifnum\c@tracingmulticols>\@ne
             \message{too bad
                  (>\the\c@columnbadness)}%
           \fi
           \global\too@badtrue
         \fi
                        }}%
   \global\boxmaxdepth\maxdepth
   \global\setbox\mult@grightbox
      \vbox{\unvbox\mult@grightbox}%
   \global\setbox\mult@nat@firstbox
      \vbox{\unvcopy\mult@firstbox}%
    \ifnum\c@tracingmulticols>\@ne
       \message{^^JFirst column
           = \the\dimen@\space
           (\the\ht\mult@nat@firstbox)}\fi
    \ifnum\c@tracingmulticols>\@ne
      \message{<> last column =
               \the\ht\mult@grightbox^^J}%
     \fi
    \ifdim\ht\mult@grightbox >\dimen@
      \global\too@badtrue
      \ifnum\c@tracingmulticols>\@ne
         \typeout{Rejected: last
                 column too large!}%
      \fi
    \else
      \setbox\@tempboxa
           \copy\mult@grightbox
      \setbox\z@\vsplit\@tempboxa to\maxdimen
      \ifvoid\@tempboxa
        \global\setbox\mult@grightbox
           \vbox to\dimen@
              {\unvbox\mult@grightbox}%
        \ifnum\c@tracingmulticols>\@ne
          \message{Final badness:
                   \the\badness}%
        \fi
        \ifnum\badness>\c@finalcolumnbadness
          \global\setbox\mult@grightbox
           \vbox to\dimen@
              {\unvbox\mult@grightbox\vfill}%
           \ifnum\c@tracingmulticols>\@ne
             \message{ setting natural
              (> \the\c@finalcolumnbadness)}%
           \fi
        \fi
      \else
        \global\too@badtrue
        \ifnum\c@tracingmulticols>\@ne
          \typeout{Rejected: unprocessed
            forced break(s) in last column!}%
        \fi
      \fi
    \fi
    \ifdim\ht\mult@nat@firstbox<\dimen@
      \ifdim\ht\mult@nat@firstbox>\last@try
        \global\too@badtrue
        \ifnum\c@tracingmulticols>\@ne
           \typeout{Retry: using natural
                    height of first column!}%
        \fi
        \global\dimen@\ht\mult@nat@firstbox
        \global\last@try\dimen@
        \global\advance\dimen@-\p@
      \fi
    \fi
    \iftoo@bad
      \global\advance\dimen@\p@
    \repeat
   \if@boxedmulticols\else
     \ifdim\dimen@>\@colroom
       \global\dimen@\@colroom
     \fi
   \fi
   \process@cols\mult@rightbox
       {\@tempcnta\count@
        \advance\@tempcnta\@ne
        \setbox\count@\vbox to\dimen@
           {%
            \vskip \z@
              \@plus-\multicolundershoot
              \@minus-\multicolovershoot
            \unvbox\@tempcnta
            \ifshr@nking\vfill\fi}}%
}

\newbox\mult@rightbox
\newbox\mult@grightbox
\newbox\mult@gfirstbox
\newbox\mult@firstbox
\newbox\@tempa\newbox\@tempa
\newbox\@tempa\newbox\@tempa
\newbox\@tempa\newbox\@tempa
\newbox\@tempa\newbox\@tempa
\newbox\@tempa\newbox\@tempa
\newbox\@tempa\newbox\@tempa
\newbox\@tempa\newbox\@tempa
\newbox\@tempa\newbox\@tempa
\newbox\@tempa

\global\let\@tempa\relax

\@ifundefined{emergencystretch}
     {\newdimen\emergencystretch}{}

\def\setemergencystretch#1#2{%
   \global\emergencystretch 4pt
   \global\multiply\emergencystretch#1}

\def\set@floatcmds{%
 \global\let\@dblfloat\@dbflt
 \gdef\end@dblfloat{\par
   \vskip\z@
   \egroup
   \color@endbox
   \@largefloatcheck
   \outer@nobreak
   \ifnum\@floatpenalty<\z@
     \@cons\@deferlist\@currbox
   \fi
   \ifnum\@floatpenalty=-\@Mii
     \@Esphack
   \fi}}

\def\kept@topmark{{}{}}

\global\let\kept@firstmark\@empty
\global\let\kept@botmark\@empty

\def\return@nonemptymark#1#2{%
  \ifx#2\@empty
  \else
    \mult@info\tw@
      {Returned #1 mark:\MessageBreak
       \meaning#2}%
    \toks@\expandafter{#2}%
    \mark{\the\toks@}%
    \nobreak
  \fi}

\def\get@keptmarks#1{%
  \begingroup
   \vbadness\@M
   \setbox#1\copy#1%
   \setbox#1\vsplit#1to\maxdimen
   \set@keptmarks
 \endgroup
}

\def\set@keptmarks{%
   \ifx\kept@firstmark\@empty
     \expandafter\gdef\expandafter
        \kept@firstmark
        \expandafter{\splitfirstmark}%
     \ifx\kept@firstmark\@empty\else
       \mult@info\tw@
         {Set kept first mark:\MessageBreak
          \meaning\kept@firstmark%
          \@gobbletwo}%
     \fi
   \fi
   \expandafter\gdef\expandafter\@tempa
      \expandafter{\splitbotmark}%
   \ifx\@tempa\@empty\else
      \global\let\kept@botmark\@tempa
      \mult@info\tw@
        {Set kept bot mark:\MessageBreak
         \meaning\kept@botmark%
         \@gobbletwo}%
   \fi}%

\def\prep@keptmarks{%
   \if@boxedmulticols \else
     \get@keptmarks\partial@page
   \fi}

\def\remove@discardable@items{%
        \unskip\unpenalty\unkern
        \unskip\unpenalty\unkern
        \unskip\unpenalty\unkern
        \unskip\unpenalty\unkern
}

\newif\iftoo@bad
\newcount\c@columnbadness
\global\c@columnbadness=10000

\newcount\c@finalcolumnbadness
\global\c@finalcolumnbadness=9999

\newdimen\last@try
\newdimen\multicolovershoot
\global\multicolovershoot=2pt

\newdimen\multicolundershoot
\global\multicolundershoot=2pt

\newbox\mult@nat@firstbox

\def\mult@info#1#2{%
  \ifnum\c@tracingmulticols>#1%
   \GenericWarning
       {(multicol)\@spaces\@spaces}%
       {Package multicol: #2}%
  \fi
}

\@namedef{multicols*}{%
   \ifinner
     \PackageWarning{multicol}%
       {multicols* inside a box does
        not make sense.\MessageBreak
        Going to balance anyway}%
   \else
     \global\let\balance@columns@out
         \multi@column@out
   \fi
   \begin{multicols}
}
\@namedef{endmulticols*}{\vfill
   \end{multicols}}

\mathchardef\@Mv=10005

\def\columnbreak{%
 \ifnum\col@number<\tw@
  \PackageError{multicol}%
   {\noexpand\columnbreak outside multicols}%
   {This command can only be used within
    a multicols or multicols* environment.}%
 \else
  \ifvmode
    \penalty -\@Mv\relax
  \else
    \@bsphack
    \vadjust{\penalty -\@Mv\relax}%
    \@esphack
  \fi
 \fi}

\newbox\colbreak@box

\global\let\interbeginmulticols\nobeginmulticols
\global\let\interendmulticols\noendmulticols
\endinput
%%
%% End of file `multicol.sty'.