summaryrefslogtreecommitdiff
path: root/macros/latex209/contrib/misc/ftn.sty
blob: dde117846c3ecedaf28e29c9bc514af6494fc13f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
% 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}