% ftn.sty - footnotes inside tabular/array environments
% Kresten Krab Thorup <krab@iesd.auc.dk>     1991-06-25

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

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

\def\in@ftn#1#2{%
	\@temptokena={\footnotetext#1{#2}}%
	\@temptokenb=\expandafter{\ftn@list}%
	\xdef\ftn@list{\the\@temptokenb\the\@temptokena}%
	\footnotemark#1}

\def\exec@ftn{%
	\let\@temptokena=\ftn@list
	\let\ftn@list=\empty
	\@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
%

\newtoks\@temptokenb
\def\ftn@list{}

% add more to this list...

\ftn{tabular}
\ftn{array}
\ftn{minipage}
\ftn{eqnarray}



