%%
%% This is file `footnote.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% footnote.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE
%%
%% footnote package -- Save footnotes around boxing environments
%% Copyright (c) 1996 Mark Wooding
%%
%% This program is free software; you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
%% the Free Software Foundation; either version 2 of the License, or
%% (at your option) any later version.
%%
%% This program is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%% GNU General Public License for more details.
%%
%% You should have received a copy of the GNU General Public License
%% along with this program; if not, write to the Free Software
%% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{footnote}
                [1997/01/28 1.13 Save footnotes around boxes]
%% \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         \~}
%%
\ifx\fn@notes\@@undefined%
  \newbox\fn@notes%
\fi
\newdimen\fn@width
\let\fn@colwidth\columnwidth
\newif\if@savingnotes
\def\fn@startnote{%
  \hsize\fn@colwidth%
  \interlinepenalty\interfootnotelinepenalty%
  \reset@font\footnotesize%
  \floatingpenalty\@MM% Is this right???
  \@parboxrestore%
  \protected@edef\@currentlabel{\csname p@\@mpfn\endcsname\@thefnmark}%
  \color@begingroup%
}
\let\fn@endnote\color@endgroup
\def\fn@fntext#1{%
  \ifx\ifmeasuring@\@@undefined%
    \expandafter\@secondoftwo\else\expandafter\@iden%
  \fi%
  {\ifmeasuring@\expandafter\@gobble\else\expandafter\@iden\fi}%
  {%
    \global\setbox\fn@notes\vbox{%
      \unvbox\fn@notes%
      \fn@startnote%
      \@makefntext{%
        \rule\z@\footnotesep%
        \ignorespaces%
        #1%
        \@finalstrut\strutbox%
      }%
      \fn@endnote%
    }%
  }%
}
\def\savenotes{%
  \begingroup%
  \if@savingnotes\else%
    \@savingnotestrue%
    \let\@footnotetext\fn@fntext%
    \let\@mpfootnotetext\fn@fntext%
    \fn@width\columnwidth%
    \let\fn@colwidth\fn@width%
    \global\setbox\fn@notes\box\voidb@x%
    \let\fn@thempfn\thempfn%
    \let\fn@mpfn\@mpfn%
    \ifx\@minipagerestore\relax\let\@minipagerestore\@empty\fi%
    \expandafter\def\expandafter\@minipagerestore\expandafter{%
      \@minipagerestore%
      \let\thempfn\fn@thempfn%
      \let\@mpfn\fn@mpfn%
    }%
  \fi%
}
\def\spewnotes{%
  \endgroup%
  \if@savingnotes\else\ifvoid\fn@notes\else\begingroup%
    \let\@makefntext\@empty%
    \let\@finalstrut\@gobble%
    \let\rule\@gobbletwo%
    \@footnotetext{\unvbox\fn@notes}%
  \endgroup\fi\fi%
}
\let\endsavenotes\spewnotes
\def\fn@getmark#1#2{%
  \begingroup%
  \@ifnextchar[%
    {\fn@getmark@i{#1}}%
    {#1\fn@getmark@ii{#2}}%
}
\def\fn@getmark@i#1[#2]{%
  \csname c@\@mpfn\endcsname#2%
  \fn@getmark@ii%
}
\def\fn@getmark@ii#1{%
  \unrestored@protected@xdef\@thefnmark{\thempfn}%
  \endgroup%
  #1%
}
\def\fn@startfntext{%
  \setbox\z@\vbox\bgroup%
    \fn@startnote%
    \fn@prefntext%
    \rule\z@\footnotesep%
    \ignorespaces%
}
\def\fn@endfntext{%
    \@finalstrut\strutbox%
    \fn@postfntext%
  \egroup%
  \begingroup%
    \let\@makefntext\@empty%
    \let\@finalstrut\@gobble%
    \let\rule\@gobbletwo%
    \@footnotetext{\unvbox\z@}%
  \endgroup%
}
\let\fn@latex@@footnote\footnote
\def\fn@footnote{footnote}
\def\footnote{%
  \ifx\@currenvir\fn@footnote%
    \expandafter\@firstoftwo%
  \else%
    \expandafter\@secondoftwo%
  \fi%
  {\fn@getmark{\stepcounter\@mpfn}%
              {\leavevmode\unskip\@footnotemark\fn@startfntext}}%
  {\fn@latex@@footnote}%
}
\let\endfootnote\fn@endfntext
\def\fn@footnotetext{footnotetext}
\let\fn@latex@@footnotetext\footnotetext
\def\footnotetext{%
  \ifx\@currenvir\fn@footnotetext%
    \expandafter\@firstoftwo%
  \else%
    \expandafter\@secondoftwo%
  \fi%
  {\fn@getmark{}\fn@startfntext}%
  {\fn@latex@@footnotetext}%
}
\let\endfootnotetext\endfootnote
\long\def\@tempa#1\@@#2\@@@{\def\fn@prefntext{#1}\def\fn@postfntext{#2}}
\expandafter\@tempa\@makefntext\@@\@@@
\def\makesavenoteenv{\@ifnextchar[\fn@msne@ii\fn@msne@i}
\def\fn@msne@i#1{%
  \expandafter\let\csname msne$#1\expandafter\endcsname%
                  \csname #1\endcsname%
  \expandafter\let\csname endmsne$#1\expandafter\endcsname%
                  \csname end#1\endcsname%
  \fn@msne@ii[#1]{msne$#1}%
}
\def\fn@msne@ii[#1]#2{%
  \expandafter\edef\csname#1\endcsname{%
    \noexpand\savenotes%
    \expandafter\noexpand\csname#2\endcsname%
  }%
  \expandafter\edef\csname end#1\endcsname{%
    \expandafter\noexpand\csname end#2\endcsname%
    \noexpand\expandafter%
    \noexpand\spewnotes%
    \noexpand\if@endpe\noexpand\@endpetrue\noexpand\fi%
  }%
}
\makesavenoteenv[minipage*]{minipage}
\let\fn@parbox\parbox
\def\parbox{\@ifnextchar[{\fn@parbox@i{}}{\fn@parbox@ii{}}}
\def\fn@parbox@i#1[#2]{%
  \@ifnextchar[{\fn@parbox@i{#1[#2]}}{\fn@parbox@ii{#1[#2]}}%
}
\long\def\fn@parbox@ii#1#2#3{\savenotes\fn@parbox#1{#2}{#3}\spewnotes}
\endinput
%%
%% End of file `footnote.sty'.