Debian Codegraph @

texmf-dist/tex/latex/mdwtools/footnote.sty

raw
1 %%
2 %% This is file `footnote.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% footnote.dtx (with options: `package')
8 %%
9 %% IMPORTANT NOTICE
10 %%
11 %% footnote package -- Save footnotes around boxing environments
12 %% Copyright (c) 1996 Mark Wooding
13 %%
14 %% This program is free software; you can redistribute it and/or modify
15 %% it under the terms of the GNU General Public License as published by
16 %% the Free Software Foundation; either version 2 of the License, or
17 %% (at your option) any later version.
18 %%
19 %% This program is distributed in the hope that it will be useful,
20 %% but WITHOUT ANY WARRANTY; without even the implied warranty of
21 %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 %% GNU General Public License for more details.
23 %%
24 %% You should have received a copy of the GNU General Public License
25 %% along with this program; if not, write to the Free Software
26 %% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 %%
28 \NeedsTeXFormat{LaTeX2e}
29 \ProvidesPackage{footnote}
30 [1997/01/28 1.13 Save footnotes around boxes]
31 %% \CharacterTable
32 %% {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
33 %% 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
34 %% Digits \0\1\2\3\4\5\6\7\8\9
35 %% Exclamation \! Double quote \" Hash (number) \#
36 %% Dollar \$ Percent \% Ampersand \&
37 %% Acute accent \' Left paren \( Right paren \)
38 %% Asterisk \* Plus \+ Comma \,
39 %% Minus \- Point \. Solidus \/
40 %% Colon \: Semicolon \; Less than \<
41 %% Equals \= Greater than \> Question mark \?
42 %% Commercial at \@ Left bracket \[ Backslash \\
43 %% Right bracket \] Circumflex \^ Underscore \_
44 %% Grave accent \` Left brace \{ Vertical bar \|
45 %% Right brace \} Tilde \~}
46 %%
47 \ifx\fn@notes\@@undefined%
48 \newbox\fn@notes%
49 \fi
50 \newdimen\fn@width
51 \let\fn@colwidth\columnwidth
52 \newif\if@savingnotes
53 \def\fn@startnote{%
54 \hsize\fn@colwidth%
55 \interlinepenalty\interfootnotelinepenalty%
56 \reset@font\footnotesize%
57 \floatingpenalty\@MM% Is this right???
58 \@parboxrestore%
59 \protected@edef\@currentlabel{\csname p@\@mpfn\endcsname\@thefnmark}%
60 \color@begingroup%
61 }
62 \let\fn@endnote\color@endgroup
63 \def\fn@fntext#1{%
64 \ifx\ifmeasuring@\@@undefined%
65 \expandafter\@secondoftwo\else\expandafter\@iden%
66 \fi%
67 {\ifmeasuring@\expandafter\@gobble\else\expandafter\@iden\fi}%
68 {%
69 \global\setbox\fn@notes\vbox{%
70 \unvbox\fn@notes%
71 \fn@startnote%
72 \@makefntext{%
73 \rule\z@\footnotesep%
74 \ignorespaces%
75 #1%
76 \@finalstrut\strutbox%
77 }%
78 \fn@endnote%
79 }%
80 }%
81 }
82 \def\savenotes{%
83 \begingroup%
84 \if@savingnotes\else%
85 \@savingnotestrue%
86 \let\@footnotetext\fn@fntext%
87 \let\@mpfootnotetext\fn@fntext%
88 \fn@width\columnwidth%
89 \let\fn@colwidth\fn@width%
90 \global\setbox\fn@notes\box\voidb@x%
91 \let\fn@thempfn\thempfn%
92 \let\fn@mpfn\@mpfn%
93 \ifx\@minipagerestore\relax\let\@minipagerestore\@empty\fi%
94 \expandafter\def\expandafter\@minipagerestore\expandafter{%
95 \@minipagerestore%
96 \let\thempfn\fn@thempfn%
97 \let\@mpfn\fn@mpfn%
98 }%
99 \fi%
100 }
101 \def\spewnotes{%
102 \endgroup%
103 \if@savingnotes\else\ifvoid\fn@notes\else\begingroup%
104 \let\@makefntext\@empty%
105 \let\@finalstrut\@gobble%
106 \let\rule\@gobbletwo%
107 \@footnotetext{\unvbox\fn@notes}%
108 \endgroup\fi\fi%
109 }
110 \let\endsavenotes\spewnotes
111 \def\fn@getmark#1#2{%
112 \begingroup%
113 \@ifnextchar[%
114 {\fn@getmark@i{#1}}%
115 {#1\fn@getmark@ii{#2}}%
116 }
117 \def\fn@getmark@i#1[#2]{%
118 \csname c@\@mpfn\endcsname#2%
119 \fn@getmark@ii%
120 }
121 \def\fn@getmark@ii#1{%
122 \unrestored@protected@xdef\@thefnmark{\thempfn}%
123 \endgroup%
124 #1%
125 }
126 \def\fn@startfntext{%
127 \setbox\z@\vbox\bgroup%
128 \fn@startnote%
129 \fn@prefntext%
130 \rule\z@\footnotesep%
131 \ignorespaces%
132 }
133 \def\fn@endfntext{%
134 \@finalstrut\strutbox%
135 \fn@postfntext%
136 \egroup%
137 \begingroup%
138 \let\@makefntext\@empty%
139 \let\@finalstrut\@gobble%
140 \let\rule\@gobbletwo%
141 \@footnotetext{\unvbox\z@}%
142 \endgroup%
143 }
144 \let\fn@latex@@footnote\footnote
145 \def\fn@footnote{footnote}
146 \def\footnote{%
147 \ifx\@currenvir\fn@footnote%
148 \expandafter\@firstoftwo%
149 \else%
150 \expandafter\@secondoftwo%
151 \fi%
152 {\fn@getmark{\stepcounter\@mpfn}%
153 {\leavevmode\unskip\@footnotemark\fn@startfntext}}%
154 {\fn@latex@@footnote}%
155 }
156 \let\endfootnote\fn@endfntext
157 \def\fn@footnotetext{footnotetext}
158 \let\fn@latex@@footnotetext\footnotetext
159 \def\footnotetext{%
160 \ifx\@currenvir\fn@footnotetext%
161 \expandafter\@firstoftwo%
162 \else%
163 \expandafter\@secondoftwo%
164 \fi%
165 {\fn@getmark{}\fn@startfntext}%
166 {\fn@latex@@footnotetext}%
167 }
168 \let\endfootnotetext\endfootnote
169 \long\def\@tempa#1\@@#2\@@@{\def\fn@prefntext{#1}\def\fn@postfntext{#2}}
170 \expandafter\@tempa\@makefntext\@@\@@@
171 \def\makesavenoteenv{\@ifnextchar[\fn@msne@ii\fn@msne@i}
172 \def\fn@msne@i#1{%
173 \expandafter\let\csname msne$#1\expandafter\endcsname%
174 \csname #1\endcsname%
175 \expandafter\let\csname endmsne$#1\expandafter\endcsname%
176 \csname end#1\endcsname%
177 \fn@msne@ii[#1]{msne$#1}%
178 }
179 \def\fn@msne@ii[#1]#2{%
180 \expandafter\edef\csname#1\endcsname{%
181 \noexpand\savenotes%
182 \expandafter\noexpand\csname#2\endcsname%
183 }%
184 \expandafter\edef\csname end#1\endcsname{%
185 \expandafter\noexpand\csname end#2\endcsname%
186 \noexpand\expandafter%
187 \noexpand\spewnotes%
188 \noexpand\if@endpe\noexpand\@endpetrue\noexpand\fi%
189 }%
190 }
191 \makesavenoteenv[minipage*]{minipage}
192 \let\fn@parbox\parbox
193 \def\parbox{\@ifnextchar[{\fn@parbox@i{}}{\fn@parbox@ii{}}}
194 \def\fn@parbox@i#1[#2]{%
195 \@ifnextchar[{\fn@parbox@i{#1[#2]}}{\fn@parbox@ii{#1[#2]}}%
196 }
197 \long\def\fn@parbox@ii#1#2#3{\savenotes\fn@parbox#1{#2}{#3}\spewnotes}
198 \endinput
199 %%
200 %% End of file `footnote.sty'.