Debian Codegraph @

texmf-dist/source/latex/savefnmark/savefnmark.dtx

raw
1 % \iffalse meta-comment
2 % %%----------------------------------------------------------------------------
3 %
4 %% File: savefnmark.dtx Copyright (C) 2000 Volker Kuhlmann
5 %% All rights are reserved.
6 %%
7 %
8 %<*dtx>
9 \NeedsTeXFormat{LaTeX2e}[1999/06/01]
10 \ProvidesFile{savefnmark.dtx}
11 %</dtx>
12 %<package|maindoc>\NeedsTeXFormat{LaTeX2e}[1998/06/01]
13 %<package>\ProvidesPackage{savefnmark}
14 %<driver> \ProvidesFile{savefnmark.drv}
15 %<maindoc>\ProvidesFile{savefnmark.tex}
16 %
17 % \fi
18 % \ProvidesFile{savefnmark.dtx}
19 [2000/05/11 v1.0 save footnote marks for multiple use (VK)]
20 %
21 %%
22 %% \CharacterTable
23 %% {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
24 %% 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
25 %% Digits \0\1\2\3\4\5\6\7\8\9
26 %% Exclamation \! Double quote \" Hash (number) \#
27 %% Dollar \$ Percent \% Ampersand \&
28 %% Acute accent \' Left paren \( Right paren \)
29 %% Asterisk \* Plus \+ Comma \,
30 %% Minus \- Point \. Solidus \/
31 %% Colon \: Semicolon \; Less than \<
32 %% Equals \= Greater than \> Question mark \?
33 %% Commercial at \@ Left bracket \[ Backslash \\
34 %% Right bracket \] Circumflex \^ Underscore \_
35 %% Grave accent \` Left brace \{ Vertical bar \|
36 %% Right brace \} Tilde \~}
37 %%
38 %
39 % \iffalse
40 %<*driver>
41
42 \NeedsTeXFormat{LaTeX2e}[1999/06/01]
43 \documentclass{ltxdoc}
44 %%\IfFileExists{ltxdoc.cfg}{}{\OnlyDescription\RecordChanges\CodelineIndex}
45
46 %\OnlyDescription % uncomment to suppress code line listing
47 \RecordChanges % uncomment for a change history
48 %\CodelineIndex\EnableCrossrefs % uncomment for command index
49 \GetFileInfo{savefnmark.dtx}
50
51 \usepackage{savefnmark}
52
53 \begin{document}
54 \DocInput{savefnmark.dtx}
55 %%\IfFileExists{ltxdoc.cfg}{}{\PrintChanges\PrintIndex}
56 \PrintChanges % uncomment for a change history
57 %\PrintIndex % uncomment for command index
58 \end{document}
59
60 %</driver>
61 % \fi
62 %
63 %
64 % \GetFileInfo{savefnmark.dtx}
65 % \CheckSum{30}
66 %
67 % \title{The \textsf{savefnmark} Package\thanks
68 % {This file has version number \fileversion,
69 % last modified \filedate.}}
70 % \author{Volker Kuhlmann\thanks{%^^A
71 % Email:\ \url{[email protected]}.
72 % For a postal address refer to the license section.}}
73 % \date{\filedate}
74 %
75 %
76 % %^^A MACROS used for this document
77 % \let\package\textsf
78 % \let\env\textsf
79 % \let\url\texttt
80 % \newcommand\optmeta[1]{[\meta{#1}]}
81 % \providecommand\MF{\textsc{meta-font}}
82 % \providecommand\fixendverbatim{\vspace{-\bigskipamount}}
83 % \newenvironment{pckcmd}{%^^A
84 % \ifvmode \else \par\vspace{-\parskip}\fi
85 % \vspace{1mm}\noindent \hangindent 4em\hangafter 0\ignorespaces
86 % }{%^^A
87 % \par\vspace{1mm}\vspace{-\parskip}}
88 % \renewenvironment{quote}{%
89 % \list{}{\leftmargin=0.5\leftmargin\rightmargin\leftmargin}\item\relax
90 % }{%
91 % \endlist
92 % }
93 % \makeatletter
94 % \providecommand\DescribeWord[1]{%
95 % \leavevmode\@bsphack
96 % \marginpar{\raggedleft\PrintDescribeEnv{#1}}%^^A
97 % \@bsphack\index{#1\actualchar{\protect\ttfamily#1}\encapchar usage}\@esphack
98 % \@esphack\ignorespaces
99 % }
100 % \makeatother
101 %
102 % \changes{v1.0}{2000/05/10}
103 % {Initial version.}
104 %
105 %
106 %
107 % \maketitle
108 %
109 % \begin{abstract}
110 % Sometimes the same footnote applies to more than one location in a table. With
111 % this package the mark of a footnote can be saved into a name, and re-used
112 % subsequently without creating another footnote at the bottom.
113 % \end{abstract}
114 %
115 % \tableofcontents
116 %
117 %
118 % \section{License}
119 %
120 % This package is copyright \textcopyright\ 2000 by:
121 %
122 % \begin{quote}
123 % Volker Kuhlmann,
124 % c/o University of Canterbury,
125 % ELEC Dept, Creyke Road,
126 % Christchurch, New Zealand\\
127 % E-Mail: \url{[email protected]}
128 % \end{quote}
129 %
130 % This program is free software; you can redistribute it and/or modify
131 % it under the terms of the GNU General Public License as published by
132 % the Free Software Foundation; either version 2 of the License, or
133 % (at your option) any later version.
134 %
135 % To obtain a copy of the license, write to the
136 % Free Software Foundation, Inc.,
137 % 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA,
138 % or browse \url{http://www.fsf.org/}.
139 %
140 %
141 % \section{Introduction}
142 %
143 % Sometimes the same footnote applies to more than one location in a table. With
144 % this package the mark of a footnote can be saved into a name, and re-used
145 % subsequently without creating another footnote at the bottom.
146 %
147 % This even works between tables (in minipages) and footnotes in surrounding
148 % text. The appearance of the footnote mark is kept, that is when a footnote of
149 % a previous table is mentioned in the text following the table, the mark looks
150 % the same as it does in the table.
151 %
152 % The footnote marks are saved globally into a given control sequence. This
153 % control sequence must not have already been used and is defined for the whole
154 % of the document.
155 %
156 % \pagebreak
157 %
158 % Currently forward references are not possible. In other words footnotes which
159 % appear later in the text can't be referenced.
160 %
161 % \DescribeMacro{\saveFN}
162 % The following two commands are defined by this package:
163 %
164 % \begin{pckcmd}
165 % |\saveFN{|\meta{name}|}|
166 % \end{pckcmd}
167 %
168 % saves the number of the footnote which was last introduced into \meta{name}.
169 % \meta{name} can be any valid control sequence not already used.
170 %
171 % \DescribeMacro{\useFN}
172 % To place the same footnote mark again later in the text, use
173 %
174 % \begin{pckcmd}
175 % |\useFN{|\meta{name}|}|
176 % \end{pckcmd}
177 %
178 %
179 % \section{Example}
180 %
181 % The following example is produced with this input:
182 %
183 % %^^A************************************************************************
184 % \begingroup
185 % \small
186 % \begin{verbatim}
187 % Surrounding text before the minipage with table.
188 % text text text\footnote{footnote 1 in text} text
189 % text\footnote{footnote 2 in text; also in table}\saveFN\sft\ text text text
190 %
191 % \begin{minipage}{\textwidth}
192 % \begin{tabular}{lll}
193 % abc
194 % &abc abc abc\footnote{footnote 1}\saveFN\sfn
195 % &abc\\
196 % abc abc abc
197 % &abc abcdef efgh\footnote{footnote 2} abc
198 % &same mark as first\useFN\sfn\ footnote\\
199 % www\footnote{footnote 3}
200 % &mark as text\useFN\sft\ footnote
201 % &abc\\
202 % \end{tabular}
203 % \end{minipage}
204 %
205 % Surrounding text after the minipage with table.
206 % text text text\footnote{footnote 3 in text} text text text
207 % \end{verbatim}
208 % \fixendverbatim
209 % \endgroup
210 % %^^A************************************************************************
211 %
212 % \parskip 2.5ex
213 % \parindent 0em
214 %
215 % Surrounding text before the minipage with table.
216 % text text text\footnote{footnote 1 in text} text
217 % text\footnote{footnote 2 in text; also in table}\saveFN\sft\ text text text
218 %
219 % \begin{minipage}{\textwidth}
220 % \begin{tabular}{lll}
221 % abc
222 % &abc abc abc\footnote{footnote 1}\saveFN\sfn
223 % &abc\\
224 % abc abc abc
225 % &abc abcdef efgh\footnote{footnote 2} abc
226 % &same mark as first\useFN\sfn\ footnote\\
227 % www\footnote{footnote 3}
228 % &mark as text\useFN\sft\ footnote
229 % &abc\\
230 % \end{tabular}
231 % \end{minipage}
232 %
233 % Surrounding text after the minipage with table.
234 % text text text\footnote{footnote 3 in text} text text text
235 %
236 %
237 % \section{To Do and Bugs}
238 %
239 % Any bugs?
240 %
241 % Is it worth implementing a forward reference capability?
242 %
243 %
244 % %^^A This command extracts all index entries:
245 % %^^A sed < savefnmark.idx -e 's,indexentry{,,' -e 's,=.*$,,'
246 %
247 % \DoNotIndex{\ ,\.,\_}%^^A DOES NOT WORK!!
248 % \DoNotIndex{\@footnotetext,\@mpfn,\@xfootnote,\begingroup,\csname,\def}
249 % \DoNotIndex{\endcsname,\endgroup,\expandafter,\let,\newcommand,\noexpand}
250 % \DoNotIndex{\relax,\show,\the,\thempfn,\xdef}
251 %
252 % \StopEventually{}
253 %
254 %
255 %
256 % \section{Implementation}
257 %
258 %
259 % \begin{macrocode}
260 %<*package>
261 % \end{macrocode}
262 %
263 % \begin{macro}{\saveFN}
264 % First part: save the footnote number and whether it was a normal footnote or
265 % one from inside a minipage. We test first whether the control sequence to save
266 % it in is already defined.
267 %
268 % \begin{macrocode}
269 \newcommand\saveFN[1]{%
270 \newcommand{#1}{}%
271 \xdef#1{\noexpand\@useFN{\@mpfn}{\the\csname c@\@mpfn\endcsname}}%
272 %\show#1%
273 }
274 % \end{macrocode}
275 % \end{macro}
276 %
277 % \begin{macro}{\useFN}
278 % Start a new group and temporarily disable the creation of the footnote text by
279 % \cs{@xfootnote}, then run the command defined when saving the mark. This
280 % restores the footnote type and its number, then prints the corresponding mark.
281 %
282 % \begin{macrocode}
283 \newcommand\useFN[1]{\begingroup\let\@footnotetext\relax#1\endgroup}
284 \newcommand\@useFN[2]{%
285 \def\@mpfn{#1}%
286 \expandafter\let\expandafter\thempfn\csname the#1\endcsname
287 \@xfootnote[#2]%
288 }
289 % \end{macrocode}
290 % \end{macro}
291 %
292 % \begin{macrocode}
293 %</package>
294 % \end{macrocode}
295 %
296 %
297 % \Finale
298 %
299 % \iffalse
300 % %% EOF savefnmark.dtx
301 % %%----------------------------------------------------------------------------
302 % \fi