%%% Save file as: FTN.STY                Source: FILESERV@SHSU.BITNET
%%% Submitted:  Thu, 2 Jan 92 08:07:45 +0100
%%% Author: Kresten Krab Thorup <krab@iesd.auc.dk>
%%% Use: \ftn{Text for footnote} in tabular/array/minipage-type environments
%%%
%%% Modified on: Thu, 20 Aug 92 10:01:35 MDT
%%%          by: Zdenek Wagner <WAGNER@CSEARN.BITNET>
%%%     purpose: To use ftn.sty with the multicolpar environment, one must 
%%%              also place
%%%              \ftn{multicolpar}
%%%              into the preamble of the document.  You may want to use it
%%%              frequently, so you would like to place this command to
%%%              ftn.sty. If you do this, you should remember that multicolpar
%%%              must be defined BEFORE you include ftn.sty. So:
%%%
%%%              \documentstyle[ftn,multicolpar]{any}
%%%              will cause lots of error messages and the whole document will
%%%              be spoiled, while:
%%%              \documentstyle[multicolpar,ftn]{any}
%%%              will work.
%%% The following checksum includes all SHSU-generated topmatter
%%% checksum = "04506 91 323 3260"
%
% I've made a little hack to allow footnotes inside tabular environments
% (i.e. footnotes in inner vertical mode). This is NOT possible per
% default, as the floats will simply dissapear...
%
% Well, here it is - I'd like to hav any comments on it.
%
% ftn.sty (krab@iesd.auc.dk 13.08.91)
%
% Makes footnotes available in any environment...
%  -- it will, however, not work correctly inside floats.

% Following 3 macros defined by Z. Wagner

\def\ftnmark{\@ifnextchar[{\@xftnmark
    }{\stepcounter{ftnt}\xdef\@thefnmark{\theftnt}\@ftnmark}}

\def\@xftnmark[#1]{\begingroup \c@ftnt #1\relax
   \xdef\@thefnmark{\theftnt}\endgroup \@ftnmark}

\def\@ftnmark{\leavevmode\ifhmode
  \edef\@x@sf{\the\spacefactor}\fi \@makefnmark
   \ifhmode\spacefactor\@x@sf\fi\relax}

\def\inner@ftn{%
      \@ifnextchar[{\in@xftn}{\in@ftn{ }}}

\def\in@xftn[#1]#2{%
      \in@ftn{[#1]}{#2}}

\def\in@ftn#1#2{%                  This macro changed by Z. Wagner
      \@temptokena={\footnotemark#1\footnotetext#1{#2}}%
      \@temptokenb=\expandafter{\ftn@list}%
      \xdef\ftn@list{\the\@temptokenb\the\@temptokena}%
      \ftnmark#1\relax}

\def\exec@ftn{%
      \let\@makefnmark\relax%        This line added by Z. Wagner
      \let\@temptokena=\ftn@list
      \gdef\ftn@list{}%              This line changed by Z. Wagner
      \@temptokena}

\def\ftn#1{%
      \expandafter\let\csname o@#1\expandafter\endcsname
            \expandafter=\csname #1\endcsname
      \expandafter\let\csname o@end#1\expandafter\endcsname
            \expandafter=\csname end#1\endcsname
      \expandafter\def\csname #1\endcsname{\bgroup
            \let\footnote\inner@ftn\csname o@#1\endcsname}
      \expandafter\def\csname end#1\endcsname{\csname o@end#1\endcsname
            \exec@ftn\egroup}}

%
%      INITIALIZING
%

\newcounter{ftnt}%               New counter added by Z. Wagner
\newtoks\@temptokenb
\def\ftn@list{}

% add more to this list...

\ftn{tabular}
\ftn{array}
\ftn{minipage}
\ftn{eqnarray}
\ftn{multicolpar}  % Added by Z. Wagner, may appear in the preamble
\endinput
%%%%%%%%%%%%%%%%%%%%%%%%%%% End of ftn.sty %%%%%%%%%%%%%%%%%%%%%%%%%%
