Debian Codegraph @

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

raw
1 %\iffalse meta-comment, etc.
2 %% This is footmisx.dtx, and it's -*-LaTeX-*- text
3 %
4 % We use the same body for the \cs{ProvidesFile} as for the
5 % \cs{ProvidesPackage} command.
6 %
7 % \begin{macrocode}
8 %<*!debugins>
9 \NeedsTeXFormat{LaTeX2e}
10 %</!debugins>
11 %<*dtx>
12 \ProvidesFile{footmisx.dtx}%
13 %</dtx>
14 %<package>\ProvidesPackage{footmisx}%
15 %<*!debugins>
16 [2016/12/01 20161201
17 %</!debugins>
18 %<package> a miscellany of footnote facilities%
19 %<*dtx>
20 footmisx package source file%
21 %</dtx>
22 %<*!debugins>
23 ]
24 %</!debugins>
25 % \end{macrocode}
26 %
27 % Code to enable LaTeX processing of the file without the intervention
28 % of a driver file.
29 % \begin{macrocode}
30 %<*driver>
31 \setcounter{errorcontextlines}{999}
32 \documentclass{ltxdoc}
33 % \end{macrocode}
34 %
35 % we limit the things that we will index
36 % \begin{macrocode}
37 \DoNotIndex{\#,\@MM,\@cclv,\@gobble,\@ifnextchar,\@ifundefined}
38 \DoNotIndex{\|,\advance,\begingroup,\bgroup,\box,\csname}
39 \DoNotIndex{\dagger,\ddagger,\def,\divide,\dp}
40 \DoNotIndex{\edef,\egroup,\ifx,\else,\fi,\endcsname,\endgroup,\end}
41 \DoNotIndex{\endinput,\ensuremath,\expandafter}
42 \DoNotIndex{\gdef,\global,\hbox,\hskip,\hss,\ht}
43 \DoNotIndex{\ifcase,\or,\ifdim,\ifhbox,\ifhmode,\ifnum,\ifvbox,
44 \fi ,\fi ,\fi ,\fi ,\fi ,\fi }
45 \DoNotIndex{\ifvoid,\fi,\kern,\let,\long,\loop}
46 \DoNotIndex{\MessageBreak,\newbox,\newcommand,\newcounter}
47 \DoNotIndex{\newdimen,\newif,\newskip,\newtoks,\noexpand}
48 \DoNotIndex{\P,\p@,\par,\penalty,\protect,\providecommand}
49 \DoNotIndex{\relax,\renewcommand,\S,\setbox,\setcounter}
50 \DoNotIndex{\skip,\space,\the,\typeout,\vbox,\vskip}
51 \DoNotIndex{\wd,\xdef,\@}
52 \GetFileInfo{footmisx.dtx}
53 \EnableCrossrefs
54 % to get documented source of the package, comment out the next line,
55 % and uncomment the following one; otherwise, create yourself
56 % (somewhere on your LaTeX input path) a file ltxdoc.cfg that contains
57 % simply \AtBeginDocument{\AlsoImplementation}
58 %\OnlyDescription
59 \AlsoImplementation
60 \setcounter{StandardModuleDepth}{1}
61 \begin{document}
62 \DocInput{footmisx.dtx}
63 \end{document}
64 %</driver>
65 % \end{macrocode}
66 % \fi
67 %
68 %
69 %
70 % \title{\texttt{footmisx} ---\\
71 % a portmanteau package\\
72 % for customising footnotes in \LaTeX\thanks{This file has
73 % version number \fileversion, last revised \filedate}}
74 % \author{Bastien Roucari\`es formerly
75 Robin Fairbairns\thanks{University of Cambridge Computer
76 % Laboratory, William Gates Building, J.\,J. Thompson Avenue,
77 % Cambridge, CB2 0FD, UK
78 % (\texttt{rf10<snail-shape>cam.ac.uk})}}
79 % \maketitle
80 %
81 % \section*{Copyright statement}
82 %
83 % \noindent Program: \texttt{footmisx.dtx}\par
84 % \noindent Copyright 1995 1996 1998 1999 2001--2003 2008 2009 Robin Fairbairns
85 % \noindent Copyright 2016 Bastien Roucari\`es
86 %
87 % This program is offered under the terms
88 % of the LaTeX Project Public License, version 1.3c of this license or
89 % (at your option) any later version. The latest version of this
90 % license is in http://www.latex-project.org/lppl.txt, and version
91 % 1.3c or later is part of all distributions of LaTeX version
92 % 2005/12/01 or later.
93 %
94 % This work has the LPPL maintenance status `author-maintained'.
95 %
96 % \section*{History}
97 %
98 % This package is based of Robin Fairbairns footmisc package.
99 %
100 % This package originated as support of a personal project, which Robin
101 % was switching to \LaTeX{} 2e over the Christmas holiday period of
102 % 1993, using the first \ensuremath{\beta} release.
103 %
104 % In its first form, it was known as the ``footnote'' package, but by
105 % the time I had released it to CTAN, that name had already been
106 % used by a package written by Mark Wooding. So the package is now
107 % known (as you can see) as ``footmisc''.
108 %
109 % In 2016 it was forked as footmisx
110 %
111 % \section{User interface~--- package options}
112 %
113 % The \textsf{footmisx} package provides several different
114 % customisations of the way foonotes are represented in \LaTeXe{}
115 % documents (the sources of the code in this package are various, but
116 % all of it has been massaged by the author; where the code comes from
117 % elsewhere, there are attributions given below, somewhere or other).
118 %
119 % The interface to the
120 % package's options is mostly rather simple~--- each one is presented as an
121 % option in the |\usepackage| command, and for most, nothing else
122 % needs to be done. For example, to use a useful
123 % and consistent set, the author invokes the package with the
124 % command |\usepackage[perpage,para,symbol*]{footmisx}|.
125 %
126 % For a small number of options, there are additional parameters
127 % available; these are described in the subsections below.
128 %
129 % \subsection{Option \texttt{perpage}}
130 % \label{sec:perpagedoc}
131 %
132 % This option resets footnote numbering for each page of the document.
133 % It needs at least two passes to do this correctly (though it comes
134 % as close as possible on the first pass). You generally have to make
135 % two passes with \LaTeX{} anyway, to get the cross-references right,
136 % so an additional pass for this purpose shouldn't cause any
137 % additional problem. The option includes code to report that
138 % `\emph{Label(s) may have changed}', which will help the poor user to
139 % realise that (yet) another run is in order.
140 %
141 % \subsection{Option \texttt{para}}
142 %
143 % This option (derived from code by Dominik Wujastyk and Chris Rowley)
144 % causes footnotes to be typeset as a single paragraph at the bottom
145 % of the page on which they occur. In the case that there is only one
146 % footnote on the page, no effect will be observed. However, if there
147 % are several footnotes on the page, they will be run together in the
148 % page foot, each introduced by its footnote mark. The original
149 % demand for the option came from the needs of those preparing
150 % critical editions; such documents typically have large numbers of
151 % small footnotes, which look ridiculous if each is typeset in a
152 % paragraph of its own; in most other disciplines, such multiplicities
153 % of footnotes represent mere self-indulgence: the author of this
154 % package is disgracefully guilty of this.
155 %
156 % Please note that ``old'' \LaTeX{} installations may have problems
157 % with the algorithm for \texttt{para} footnotes on very wide pages
158 % (for example, those used by the \textsf{a0poster} class). Recent
159 % \LaTeX{} installations use an improved technique that is believed
160 % not to be susceptible to this problem.
161 %
162 % \subsection{Option \texttt{side}}
163 %
164 % This option (suggested by Frank Mittelbach) causes footnotes to be
165 % typeset using the \cs{marginpar} command: this has the advantage
166 % that the note appears close to its ``call-up'', but has all the
167 % disadvantages associated with the \cs{marginpar} command (which
168 % consumes `float' slots, and doesn't always place itself correctly at
169 % the top of pages in two-sided documents). Since the measure in
170 % which the footnote is to be typeset is likely to be pretty narrow,
171 % users of the \texttt{side} option are recommended also to use the
172 % \texttt{ragged} option, to avoid ugly spacing and line breaks.
173 %
174 % There is a further problem (apart from the occasional failure to
175 % place the marginal note on the correct side of the page) in
176 % two-sided documents: one would like `raggedness' to appear
177 % differently in different margins (setting the left, rather than the
178 % right, side ragged in the left margin). (The author would welcome
179 % suggestions on means of addressing the problem.)
180 %
181 % \subsection{Option \texttt{ragged} and \cs{footnotelayout}}
182 %
183 % The package provides facilities for ragged right setting of
184 % footnotes (so long as the \texttt{para} option isn't in effect).
185 % The change is effected by use of the command \cs{footnotelayout};
186 % the package inserts this command into the start of the argument of
187 % \cs{footnotetext} (in effect: \cs{footnote} works, roughly, by
188 % calling the guts of \cs{footnotetext} at its end).
189 %
190 % If you want to use some special effect other than ragged right, feel
191 % free to change \cs{footnotelayout} yourself: some intriguing (and
192 % completely undesirable) results are no doubt available. Change the
193 % setting simply by use of
194 % \cs{renewcommand}\cs{footnotelayout}\texttt{\dots}\@. The
195 % \texttt{ragged} option simply sets \cs{footnotelayout} to set
196 % \cs{raggedright} or \cs{RaggedRight} as appropriate. (If you intend
197 % to use the \textsf{ragged2e} package, load it before
198 % \textsf{footmisx}~--- if \textsf{footmisx} finds \cs{RaggedRight} is
199 % available, it automatically uses it in place of \cs{raggedright}.)
200 %
201 % \subsection{Option \texttt{symbol}}
202 %
203 % This option simply establishes that footnotes are `labelled' by
204 % a symbol sequence. The command used is equivalent to that
205 % suggested in \LaTeX{} manuals such as Lamport's (the job performed
206 % by the option is very simple, and doesn't really need a package).
207 %
208 % Using symbols to `number' your footnotes can be problematic: there
209 % is a limited number of symbols, and \LaTeX{} will report an error if
210 % your footnotes exceed that limit. To avoid such problems, consider
211 % the \texttt{symbol*} option, or the \cs{setfnsymbol} command (see
212 % the next two sections), or number your footnotes by the page (see
213 % section~\ref{sec:perpagedoc}).
214 %
215 % \subsection{Option \texttt{symbol*}}
216 % \label{doc-symbol*}
217 %
218 % This is the \texttt{symbol} option, but with protection against the
219 % tedium that arises because of the instability of the
220 % \texttt{perpage} option. When executing the \texttt{perpage}
221 % option, the package often allocates footnotes to the wrong pages,
222 % only to correct itself on a later run (having warned the user of the
223 % need for the later run with a `\emph{Label(s) may have changed}'
224 % message). In these circumstances the \texttt{symbol} option is
225 % prone to producing \LaTeX{} errors, which stop processing, and
226 % confound automatic generation procedures. In the same situation,
227 % the \texttt{symbol*} option produces information messages and a
228 % warning message at end document, and the user may scan the log for
229 % those messages \emph{after} processing has stabilised. The option
230 % produces numbers (17 and higher, in the case of the default symbol
231 % set) in place of symbols, when the footnote number is too large.
232 %
233 % \subsection{The \cs{setfnsymbol} and \cs{DefineFNsymbols} commands}
234 % \label{footnote-symbols}
235 %
236 % These commands permit the definition and use of alternative
237 % (ordered) sets of symbols for numbering footnotes. \LaTeX{} of
238 % course comes with such a set ready-defined, but the choice of
239 % symbols isn't universally loved.
240 %
241 % You may define a set of symbols with the \cs{DefineFNsymbols}
242 % command. \LaTeX{}'s default set would be defined by the command:
243 % \begin{center}
244 % \verb|\DefineFNsymbols*{lamport}|%
245 % \unskip\verb|{*\dagger\ddagger\S\P|\texttt{\char`\\\char`\|\%}\\
246 % \unskip\verb| {**}{\dagger\dagger}{\ddagger\ddagger}}|
247 % \end{center}
248 % Defined this way, the symbol set produces a ``counter too large''
249 % error; a robust version of the set (cf.~the \texttt{symbol*} option
250 % (see \ref{doc-symbol*}) using the \cs{DefineFNsymbols} command
251 % without the optional |*|.
252 % You may select a set of symbols by use of the \cs{setfnsymbol}
253 % command; so to restore use of the default set, you would type:
254 % \begin{center}
255 % \verb|\setfnsymbol{lamport}|
256 % \end{center}
257 %
258 % This package defines a small selection of alternative sets of
259 % symbols, using \cs{DefineFNsymbol}:
260 % \begin{center}
261 % \begin{tabular}{ll}
262 % \texttt{bringhurst} & $*\,\dagger\,\ddagger\,\S\,\|\,\P$ \\
263 % \texttt{chicago} & $*\,\dagger\,\ddagger\,\S\,\|\,\#$ \\
264 % \texttt{wiley} & $*\,\mathop{**}\,\dagger\,\ddagger\,\S\,\P\,\|$
265 % \end{tabular}
266 % \end{center}
267 % together with a version of Lamport's original set that, with doubled
268 % versions of $\S$ and $\P$, and tripled versions of everything but
269 % the vertical bars, provides a symbol range to cover counters up to
270 % 16.
271 %
272 % This last set, known as \texttt{lamport*} is selected as the default
273 % symbol set by the package.
274 %
275 % \subsection{Option \texttt{bottom}}
276 %
277 % This option forces footnotes to the bottom of the page; this is only
278 % noticeably useful in case that \cs{raggedbottom} is in effect, when
279 % \LaTeX{} would normally set the footnotes a mere
280 % \cs{skip}\cs{footins} distant from the bottom of the text.
281 %
282 % There's a further infelicity in \LaTeX{}'s placing of footnotes of
283 % the bottom of pages: if a bottom float appears on a page, \LaTeX{}
284 % places the footnote \emph{above} it. The \texttt{bottom} option
285 % places the footnote at the foot of the page.
286 %
287 % \subsection{Option \texttt{marginal}}
288 %
289 % This option adjusts the position of footnote mark relative to the
290 % start of the line in which they appear (the the option is
291 % incompatible with option \texttt{para}, for obvious reasons).
292 %
293 % When this option is in effect, the footnote is set
294 % \cs{footnotemargin} relative to the left margin of the page; the
295 % default setting for \cs{footnotemargin} is -0.8em, which means that
296 % the footnote mark will be set jutting 0.8em into the margin. If
297 % \cs{footnotemargin} is a positive length, the footnote mark will be
298 % set with its right edge \cs{footnotemargin} from the margin. (In
299 % the absence of the option, \cs{footnotemargin} is set to 1.8em; you
300 % may change that value with a \cs{setlength} command.)
301 %
302 % \subsection{Option \texttt{flushmargin}}
303 %
304 % This option is as option marginal, but sets the footnote marker
305 % flush with, but just inside the margin from, the text of the
306 % footnote.
307 %
308 % \subsection{Option \texttt{hang}}
309 %
310 % This option sets the footnote mark flush with the margin, and makes
311 % the body of the footnote hang at an indentation of
312 % \cs{footnotemargin} (if that is a positive distance), or the width
313 % of the marker (if \cs{footnotemargin}$\leq0$). The option code
314 % itself leaves \cs{footnotemargin} at its default value of 1.8em.
315 %
316 % The footnote itself may of course be longer than one paragraph; if
317 % so, the paragraphs will be separated by the vertical space specified
318 % by \cs{hangfootparskip}, and the second and subsequent paragraphs
319 % are indented by \cs{hangfootparindent}. Default values are:
320 % \begin{center}
321 % \begin{tabular}{ll}
322 % \cs{hangfootparskip} & 0.5\cs{baselineskip} \\
323 % \cs{hangfootparindent} & 0em
324 % \end{tabular}
325 % \end{center}
326 % The user may redefine these values (using
327 % \cs{renewcommand}): it is best to use the font-size-dependent
328 % measures (multiples of \cs{baselineskip} for the skip, multiples of
329 % |em| for the indent). Note that the default has only one of the two
330 % values non-zero; both zero may result in easily-missed paragraph
331 % breaks, and both non-zero is not generally thought to be a
332 % good-looking option.
333 %
334 % \subsection{Option \texttt{norule}}
335 %
336 % This option suppresses the `normal' footnote rule, and advances
337 % \cs{skip}\cs{footins} a bit to compensate
338 %
339 % \subsection{Option \texttt{splitrule}}
340 %
341 % This option makes puts a full-width rule above the split-off part of
342 % a split footnote. (Remember that split footnotes don't happen if
343 % you're doing paragraph footnotes.)
344 %
345 % The option provides three different \cs{footnoterule} commands:
346 % \begin{center}
347 % \begin{tabular}{ll}
348 % \cs{mpfootnoterule} & for use in minipages \\
349 % \cs{pagefootnoterule} & for normal footnotes on regular pages \\
350 % \cs{splitfootnoterule} & for the tail of a split footnote
351 % \end{tabular}
352 % \end{center}
353 % By default, \cs{mpfootnoterule} and \cs{pagefootnoterule} retain the
354 % original definition of \cs{footnoterule} (which nay have been
355 % modified by a \texttt{norule} option), while \cs{splitfootnoterule}
356 % becomes a full-width rule.
357 %
358 % \subsection{The \texttt{stable} option}
359 %
360 % This option deals with the problem of placing footnotes in section
361 % titles (and so on). While there is (sometimes, just) justification
362 % for putting footnotes in titles, \LaTeX's treatment of the content
363 % of titles militates against them. Of course, the title argument is
364 % ordinarily a moving one, and \cs{footnote} is a fragile command, but
365 % the real problem comes from the way the argument actually moves~---
366 % which is to two places. The argument moves to the table of
367 % contents, where the footnote will (at least) look odd. But the
368 % argument also moves to the marks that make up page headers, etc.,
369 % and \emph{there} it creates havoc, since page headers are executed
370 % in page make-up, and page make-up \emph{must not} create footnotes.
371 %
372 % If you use the \texttt{stable} option, the footnote won't move to
373 % the table of contents or the page headers, but it will be typeset
374 % correctly within the title itself.
375 %
376 % The situation with \cs{footnotemark} is less dire (it could in
377 % principle appear in page headers, for example); footnote marks
378 % appearing on pages other than where their text appears are none the
379 % less confusing, and the stable option treats \cs{footnotemark} in
380 % the same way that it treats \cs{footnote}.
381 %
382 % \subsection{The \texttt{multiple} option}
383 %
384 % This option deals with the case where the author needs to type
385 % things like
386 % \begin{verbatim}
387 % mumble\footnote{blah}\footnote{grumble}
388 % \end{verbatim}
389 % Without special treatment, \LaTeX{} would output something like
390 % \begin{quote}
391 % mumble\textsuperscript{1314}
392 % \end{quote}
393 % \noindent What the \texttt{multiple} option makes of the above is
394 % \begin{quote}
395 % mumble\textsuperscript{13,14}
396 % \end{quote}
397 % which is what most people would expect. The comma separator
398 % actually derives from the definition of \cs{multfootsep}, which
399 % may be changed by \cs{renewcommand} if the option is in effect.
400 %
401 % The option also treats \cs{footnotemark} in the same way.
402 %
403 % \subsection{User interface~--- miscellaneous commands}
404 %
405 % The package also defines some miscellaneous footnote-related
406 % commands. The present group provides alternative means of producing
407 % footnote marks: \cs{footref} and \cs{mpfootnotemark}.
408 %
409 % When you're in a minipage, \cs{footnote} numbers run according to the
410 % minipage's own footnote counter, and the marks are set in italic
411 % letters. However, the numbers used by \cs{footnotemark} make
412 % reference to the `main'
413 % footnote counter, and are set in whatever is the current style for
414 % that: this behaviour often surprises, and there's no obvious way in
415 % standard \LaTeX{} to ``get around'' it. The command
416 % \cs{mpfootnotemark} gets around this problem in a minipage, by
417 % generating footnote marks in the same way as those used by
418 % \cs{footnote}.
419 %
420 % In fact, making reference to footnotes in
421 % general can be problematic: it can be done by noting down the
422 % value of the footnote
423 % marker in a counter (or the like) and then using the value in a
424 % subsequent \cs{footnotemark} or \cs{mpfootnotemark}. This is a
425 % tedious way of going about things, and doesn't allow representation
426 % of all possible forms of footnote mark; \cs{footref} is a form of
427 % reference command that sets the reference as if it were a footnote.
428 % The label should be set \emph{within} the argument of the footnote
429 % command that is being labelled:
430 % \begin{verbatim}
431 % ...\footnote{Note text\label{fnlabel}}
432 % ...
433 % ... potato head\footref{fnlabel}
434 % \end{verbatim}
435 %
436 % \section{User interface~--- interactions with other packages}
437 %
438 % The \textsf{footmisx} package modifies several parts of the \LaTeX{}
439 % kernel; what gets modified depends on the options you select. This
440 % behaviour can cause problems with other packages, particularly those
441 % that also modify the kernel.
442 %
443 % Known interactions are:
444 % \begin{description}
445 % \item[\normalfont\textsf{setspace}] The \textsf{setspace} package
446 % modifies the way line spacing is calculated in footnotes.
447 % \textsf{footmisx} knows about this, and preserves the change.
448 % However, you \emph{must} load \textsf{setspace} \emph{before}
449 % \textsf{footmisx}.
450 % \item[\normalfont\textsf{memoir} class] The class emulates
451 % \textsf{setspace}, and we detect that emulation and deal with it
452 % in the same way as \textsf{setspace}.
453 % \item[\normalfont\textsf{hyperref}] The \textsf{hyperref} package
454 % has ambitions to make hyperlinks from footnote marks to the
455 % corresponding footnote body; \textsf{footmisx} knows about this,
456 % and preserves hyperlink.
457 % However, you \emph{must} load \textsf{setspace} \emph{before}
458 % \textsf{footmisx}.
459 % \item[\normalfont\textsf{manyfoot}] The \textsf{manyfoot} package
460 % permits several independent sequences of footnotes. Some
461 % preliminary work towards interworking with \textsf{footmisx} has
462 % been completed, but more remains to be done at the time of
463 % writing.
464 % \end{description}
465 %
466 % \StopEventually{}
467 %
468 % \section{Code: Preliminaries}
469 %
470 % Well~--- here we go: let's make the package file:
471 %
472 % \begin{macrocode}
473 %<*package>
474 % \end{macrocode}
475 %
476 % Now declare what environment we need:
477 % \begin{macrocode}
478 \NeedsTeXFormat{LaTeX2e}[1994/12/01]
479 % \end{macrocode}
480 %
481 % We need a token register in case we have to patch \cs{@makecol}:
482 % \begin{macrocode}
483 \newtoks\FN@temptoken
484 % \end{macrocode}
485 %
486 % \begin{macro}{\protected@writeaux}
487 % This command is defined for future compatibility with Matt Swift's
488 % \textsf{newclude} package (still, after all this time, not out of
489 % beta status).
490 % \begin{macrocode}
491 \providecommand\protected@writeaux{%
492 \protected@write\@auxout
493 }% \end{macrocode}
494 % \end{macro}
495 %
496 % \begin{macro}{\l@advance@macro}
497 % \begin{macro}{@@dvance@macro}
498 % \begin{macro}{\@advance@macro}
499 % We make the following (\cs{@@dvance@macro}) generalisable as follows
500 % (the global form isn't used in this package \dots\ yet):
501 %
502 % \begin{macrocode}
503 \def\l@advance@macro{\@@dvance@macro\edef}
504 \def\@@dvance@macro#1#2#3{\expandafter\@tempcnta#2\relax
505 \advance\@tempcnta#3\relax
506 #1#2{\the\@tempcnta}%
507 }
508 % \end{macrocode}
509 %
510 % Now we define a jolly little macro to advance a macro count (|#1|)
511 % by a given amount (|#2|).
512 % \begin{macrocode}
513 \let\@advance@macro\l@advance@macro
514 % \end{macrocode}
515 % \end{macro}
516 % \end{macro}
517 % \end{macro}
518 %
519 % \begin{macro}{\ifFN@etex}
520 % Check whether we're using etex
521 % \begin{macrocode}
522 \newif\ifFN@etex
523 \ifx\dimexpr\undefined
524 \FN@etexfalse
525 \else
526 \FN@etextrue
527 \fi
528 % \end{macrocode}
529 % \end{macro}
530 % \begin{macro}{\footnotemargin}
531 % Finally, we define the length used by the \texttt{marginal} option,
532 % and initialise it as if we've not had the option.
533 % \begin{macrocode}
534 \newdimen\footnotemargin
535 \footnotemargin1.8em\relax
536 % \end{macrocode}
537 % \end{macro}
538 %
539 % \section{Package options}
540 %
541 % Most of the code of the package is contained within the option
542 % processing, one way or another (that which isn't, is executed after
543 % \cs{ProcessOptions} as a result of flags set in the option
544 % processing).
545 %
546 % \subsection{The \texttt{symbol} option}
547 %
548 % This is a declaration that appears in the original \LaTeX{} book.
549 % Since it appeared in the old |pagefoots.sty| (presumably since it
550 % goes so naturally with the |perpage| option), I've added this
551 % trivial piece of customisation to the package.
552 %
553 % \begin{macrocode}
554 \DeclareOption{symbol}{\renewcommand\thefootnote{\fnsymbol{footnote}}}
555 % \end{macrocode}
556 %
557 % \subsection{The \texttt{symbol*} option}
558 %
559 % The robust version of the \texttt{symbol} option: if the current
560 % `symbol' option doesn't provide enough variants, use arabic footnote
561 % number. We use a robust version of the ``extended ordinary'' symbol set,
562 % described later (in section~\ref{footnote-symbols}).
563 % \begin{macrocode}
564 \DeclareOption{symbol*}{%
565 \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
566 \AtEndOfPackage{\setfnsymbol{lamport*-robust}}%
567 }
568 % \end{macrocode}
569 %
570 % \subsection{The \texttt{para} option}
571 %
572 % The basis of the code for this option comes from \TeX{}book, p.398
573 % ff.~(``Dirty Tricks''), though it does (of course) avoid
574 % redefining |\\| which has some other (somewhat significant) uses in
575 % \LaTeX{}! The user should be aware of
576 % Knuth's note on the limitations of this method of doing the job: the
577 % \TeX{} stack is used four times per footnote, and the stack is
578 % limited (see the \TeX{}book, p.300 ff.). If you have very large
579 % numbers of footnotes (in the hundreds), and encounter the error
580 % ``|! TeX capacity exceeded, sorry (... save size ...)|'', you may
581 % need to break your text into smaller sections and compile the
582 % separately. Fortunately (say the comments on the original
583 % |fnpara.sty|) this is very easy to do with \LaTeX{}, provided that
584 % you reset the footnote counter to make the joins seamless.
585 %
586 % \begin{macro}{\ifFN@para}
587 % Define the |para| option: now simply sets a marker for use later
588 % when defining the option's auxiliary code and when patching the
589 % output routine and so on.
590 % \begin{macrocode}
591 \newif\ifFN@para \FN@parafalse
592 \DeclareOption{para}{\ifFN@sidefn
593 \PackageError{footmisx}{Option "\CurrentOption" incompatible with
594 option "side"}%
595 {I shall ignore "\CurrentOption"}%
596 \else
597 \FN@paratrue
598 \fi
599 }
600 % \end{macrocode}
601 % \end{macro}
602 %
603 % \subsection{The \texttt{side} option}
604 %
605 % \begin{macro}{\ifFN@sidefn}
606 % Simply changes the behaviour of \cs{@footnotetext}; incompatible
607 % with paragraph footnotes.
608 % \begin{macrocode}
609 \newif\ifFN@sidefn \FN@sidefnfalse
610 \DeclareOption{side}{\ifFN@para
611 \PackageError{footmisx}{Option "\CurrentOption" incompatible with
612 option "para"}%
613 {I shall ignore "\CurrentOption"}%
614 \else
615 \FN@sidefntrue
616 \fi
617 }
618 % \end{macrocode}
619 % \end{macro}
620 %
621 % \subsection{The \texttt{ragged} option}
622 %
623 % \begin{macro}{\footnotelayout}
624 % A very simple option that merely changes the definition of one
625 % macro. Note detection of the presence of the \textsf{ragged2e}
626 % package.
627 % \begin{macrocode}
628 \let\footnotelayout\@empty
629 \DeclareOption{ragged}{%
630 \@ifundefined{RaggedRight}%
631 {\renewcommand\footnotelayout{\linepenalty50 \raggedright}}%
632 {\renewcommand\footnotelayout{\linepenalty50 \RaggedRight}}%
633 }
634 % \end{macrocode}
635 % \end{macro}
636 %
637 % \subsection{The \texttt{perpage} option}
638 %
639 % \begin{macro}{\ifFN@perpage}
640 % A footnote-numbering modification: a new algorithm replacing one
641 % from Brian T. Schellenberger, which has proved to be flawed. We
642 % simply set a marker here, and define code later depending on the
643 % state of the marker (see section \ref{sec:perpage-code}).
644 % \begin{macrocode}
645 \newif\ifFN@perpage
646 \FN@perpagefalse
647 \DeclareOption{perpage}{%
648 \FN@perpagetrue
649 }
650 % \end{macrocode}
651 % \end{macro}
652 %
653 % \subsection{The \texttt{PPdebug} option}
654 %
655 % \begin{macro}{\ifFN@pp@debug}
656 % Sets a flag; the messages are generated in various places throughout
657 % the code. The option is not available in the package as
658 % distributed: modify the |.ins| file to generate a version of the
659 % package that includes the option, if you feel you need it.
660 % \begin{macrocode}
661 %<*PPdebug>
662 \newif\ifFN@pp@debug \FN@pp@debugfalse
663 \DeclareOption{PPdebug}{\FN@pp@debugtrue}
664 %</PPdebug>
665 % \end{macrocode}
666 % \end{macro}
667 %
668 % \subsection{The \texttt{bottom} option}
669 %
670 % \begin{macro}{\ifFN@bottom}
671 % All this needs to do is to set a flag to say that it should happen
672 % \begin{macrocode}
673 \newif\ifFN@bottom \FN@bottomfalse
674 \DeclareOption{bottom}{%
675 \FN@bottomtrue
676 }
677 % \end{macrocode}
678 % \end{macro}
679 %
680 % \subsection{The \texttt{marginal} option}
681 %
682 % Again, the processing of the option is pretty trivial:
683 % \begin{macrocode}
684 \DeclareOption{marginal}{%
685 \footnotemargin-0.8em\relax
686 }
687 % \end{macrocode}
688 %
689 % \subsection{The \texttt{flushmargin} option}
690 %
691 % Again, the processing of the option is pretty trivial:
692 % \begin{macrocode}
693 \DeclareOption{flushmargin}{%
694 \footnotemargin0pt\relax
695 }
696 % \end{macrocode}
697 %
698 % \subsection{The \texttt{hang} option}
699 %
700 % \begin{macro}{\ifFN@hangfoot}
701 % We need a switch, since \cs{@makefntext} needs to be patched.
702 % \begin{macrocode}
703 \newif\ifFN@hangfoot \FN@hangfootfalse
704 \DeclareOption{hang}{%
705 \FN@hangfoottrue
706 }
707 % \end{macrocode}
708 % \end{macro}
709 %
710 % \begin{macro}{\hangfootparskip}
711 % \begin{macro}{\hangfootparindent}
712 % Layout parameters for hanging footnotes; \cs{hangfootparskip} and
713 % \cs{hangfootparindent} are (respectively) values to use for
714 % \cs{parskip} and \cs{parindent} when in hanging footnotes.
715 % \begin{macrocode}
716 \newcommand*\hangfootparskip{0.5\baselineskip}
717 \newcommand*\hangfootparindent{0em}%
718 % \end{macrocode}
719 % \end{macro}
720 % \end{macro}
721 %
722 % \subsection{The \texttt{norule} option}
723 %
724 % Pretty simple too\dots
725 %
726 % \begin{macrocode}
727 \DeclareOption{norule}{%
728 \renewcommand\footnoterule{}%
729 \advance\skip\footins 4\p@\@plus2\p@\relax
730 }
731 % \end{macrocode}
732 %
733 % \subsection{The \texttt{splitrule} option}
734 %
735 % \begin{macro}{\split@prev}
736 % This is from a posting by Donald Arseneau dated 13 November 1996.
737 % The code relies on the fact that \LaTeX{} only uses inserts for
738 % footnotes, so that if any insert is going to be split, it's going to
739 % be a footnote.
740 % \begin{macrocode}
741 \DeclareOption{splitrule}{%
742 \gdef\split@prev{0}
743 % \end{macrocode}
744 % \end{macro}
745 %
746 % \begin{macro}{\pagefootnoterule}
747 % \begin{macro}{\mpfootnoterule}
748 % \begin{macro}{\splitfootnoterule}
749 % Define defaults for the three footnote rules: note, we inherit the
750 % current state of \cs{footnoterule} for the two `regular' footnote
751 % defaults, and if we've been preceded by option \texttt{norule}, they
752 % will both become null\dots
753 % \begin{macrocode}
754 \let\pagefootnoterule\footnoterule
755 \let\mpfootnoterule\footnoterule
756 \def\splitfootnoterule{\kern-3\p@ \hrule \kern2.6\p@}
757 % \end{macrocode}
758 % \end{macro}
759 % \end{macro}
760 % \end{macro}
761 %
762 % Now redefine \cs{footnoterule} to distinguish the three situations.
763 % \begin{macrocode}
764 \def\footnoterule{\relax
765 \ifx \@listdepth\@mplistdepth
766 % \end{macrocode}
767 %
768 % In a minipage
769 % \begin{macrocode}
770 \mpfootnoterule
771 \else
772 \ifnum\split@prev=\z@
773 % \end{macrocode}
774 %
775 % Normal footnote on a regular page
776 % \begin{macrocode}
777 \pagefootnoterule
778 \else
779 % \end{macrocode}
780 %
781 % Second part of a split footnote
782 % \begin{macrocode}
783 \splitfootnoterule
784 \fi
785 % \end{macrocode}
786 %
787 % Remember a split for next page
788 % \begin{macrocode}
789 \xdef\split@prev{\the\insertpenalties}%
790 \fi
791 }%
792 }
793 % \end{macrocode}
794 %
795 % \begin{macro}{\ifFN@stablefootnote}
796 % \subsection{The \texttt{stable} option}
797 %
798 % Simply set a flag: the code of this gets executed at the very end of
799 % the package.
800 % \begin{macrocode}
801 \newif\ifFN@stablefootnote \FN@stablefootnotefalse
802 \DeclareOption{stable}{\FN@stablefootnotetrue}
803 % \end{macrocode}
804 % \end{macro}
805 %
806 % \subsection{The \texttt{multiple} option}
807 %
808 % \begin{macro}{\ifFN@multiplefootnote}
809 % Again, simply set a flag, for code that gets executed at the very
810 % very very end of the package.
811 % \begin{macrocode}
812 \newif\ifFN@multiplefootnote \FN@multiplefootnotefalse
813 \DeclareOption{multiple}{\FN@multiplefootnotetrue}
814 % \end{macrocode}
815 % \end{macro}
816 %
817 % \subsection{The start of the endgame}
818 %
819 % Exercise the options that the user has requested\dots
820 % \begin{macrocode}
821 \ProcessOptions
822 % \end{macrocode}
823 %
824 % \section{Hacking kernel commands}
825 %
826 % Various standard commands (some of them internal ones) need to be
827 % hacked to achieve our effects, and we do all of this now, according
828 % to flags set in option processing.
829 %
830 % \subsection{The output routine}
831 %
832 % Now; do we need to mess about with the output routine? If either
833 % |para| or |bottom| has been invoked, we do.
834 % \begin{macrocode}
835 \let \if@tempswa \ifFN@bottom
836 \ifFN@para \@tempswatrue \fi
837 \if@tempswa
838 % \end{macrocode}
839 % \dots{} so we've patching to do.
840 %
841 % First, we ensure that \cs{@makecol} is as expected from the time at
842 % which these macros were written: since we're going to patch it, we
843 % had better be sure that we're patching the right thing. (There was
844 % a minuscule change to the definition 1999, but this doesn't as far
845 % as I can tell make any difference to the semantics of the definition
846 % we base our patch on.)
847 % \begin{macrocode}
848 \@ifl@t@r\fmtversion{2005/12/01}{%
849 \CheckCommand*\@makecol{\ifvoid \footins
850 \setbox\@outputbox \box\@cclv
851 \else
852 \setbox\@outputbox \vbox{%
853 \boxmaxdepth \@maxdepth
854 \unvbox\@cclv
855 \vskip \skip\footins
856 \color@begingroup
857 \normalcolor\footnoterule
858 \unvbox\footins
859 \color@endgroup
860 }%
861 \fi
862 \let \@elt \relax
863 \xdef\@freelist{\@freelist\@midlist}%
864 \global\let\@midlist\@empty
865 \@combinefloats
866 \ifvbox\@kludgeins
867 \@makespecialcolbox
868 \else
869 \setbox\@outputbox \vbox to\@colht{%
870 \@texttop \dimen@\dp\@outputbox
871 \unvbox\@outputbox
872 \vskip -\dimen@\@textbottom
873 }%
874 \fi
875 \global\maxdepth\@maxdepth
876 }
877 }{%
878 \@ifl@t@r\fmtversion{2003/12/01}{%
879 \CheckCommand*\@makecol{\ifvoid \footins
880 \setbox\@outputbox \box\@cclv
881 \else
882 \setbox\@outputbox \vbox{%
883 \boxmaxdepth\@maxdepth
884 \@tempdima\dp\@cclv
885 \unvbox\@cclv
886 \vskip \skip\footins
887 \color@begingroup
888 \normalcolor
889 \footnoterule
890 \unvbox\footins
891 \color@endgroup
892 }%
893 \fi
894 \let \@elt \relax
895 \xdef\@freelist{\@freelist\@midlist}%
896 \global\let\@midlist\@empty
897 \@combinefloats
898 \ifvbox\@kludgeins
899 \@makespecialcolbox
900 \else
901 \setbox\@outputbox \vbox to\@colht{%
902 \@texttop
903 \dimen@\dp\@outputbox
904 \unvbox\@outputbox
905 \vskip -\dimen@
906 \@textbottom
907 }%
908 \fi
909 \global\maxdepth\@maxdepth
910 }%
911 }{%
912 \@ifl@t@r\fmtversion{1999/12/01}{%
913 \CheckCommand*\@makecol{\ifvoid \footins
914 \setbox\@outputbox \box\@cclv
915 \else
916 \setbox\@outputbox \vbox{%
917 \boxmaxdepth\@maxdepth
918 \@tempdima\dp\@cclv
919 \unvbox\@cclv
920 \vskip \skip\footins
921 \color@begingroup
922 \normalcolor\footnoterule
923 \unvbox\footins
924 \color@endgroup
925 }%
926 \fi
927 \xdef\@freelist{\@freelist\@midlist}%
928 \global\let\@midlist\@empty
929 \@combinefloats
930 \ifvbox\@kludgeins
931 \@makespecialcolbox
932 \else
933 \setbox\@outputbox \vbox to\@colht{%
934 \@texttop \dimen@\dp\@outputbox
935 \unvbox\@outputbox
936 \vskip -\dimen@\@textbottom
937 }%
938 \fi
939 \global\maxdepth\@maxdepth
940 }%
941 }%
942 }{%
943 \CheckCommand*\@makecol{\ifvoid \footins
944 \setbox\@outputbox \box\@cclv
945 \else
946 \setbox\@outputbox \vbox{%
947 \boxmaxdepth\@maxdepth
948 \unvbox\@cclv
949 \vskip \skip\footins
950 \color@begingroup
951 \normalcolor\footnoterule
952 \unvbox\footins
953 \color@endgroup
954 }%
955 \fi
956 \xdef\@freelist{\@freelist\@midlist}%
957 \global\let\@midlist\@empty
958 \@combinefloats
959 \ifvbox\@kludgeins
960 \@makespecialcolbox
961 \else
962 \setbox\@outputbox \vbox to\@colht{%
963 \@texttop \dimen@\dp\@outputbox
964 \unvbox\@outputbox
965 \vskip -\dimen@\@textbottom
966 }%
967 \fi
968 \global\maxdepth\@maxdepth
969 }%
970 }%
971 }
972 % \end{macrocode}
973 %
974 % If we're doing paragraph footnotes, the output routine needs
975 % different code to place the actual text. We prepare this code here,
976 % since it's potentially used in two different places.
977 %
978 % We prepare the code in a token register to be used at the
979 % appropriate place in the patching of \cs{@makecol}; thus it becomes
980 % a token register containing code to place stuff in a token register
981 % \begin{macrocode}
982 \ifFN@para
983 % \end{macrocode}
984 %
985 % We make a box out of the paragraph of footnotes, and then stuff the
986 % contents of the box into that which is going to be \cs{ship}ped
987 % |out|.
988 % \begin{macrocode}
989 \FN@temptoken{%
990 \toks@\expandafter{\the\toks@
991 \vskip\skip\footins
992 \color@begingroup
993 \normalcolor\footnoterule
994 \global\setbox\FN@tempboxc\vbox{\makefootnoteparagraph}%
995 \unvbox\FN@tempboxc
996 \color@endgroup
997 }%
998 }%
999 % \end{macrocode}
1000 %
1001 % If we're not doing paragraph footnotes, we insert the little bit of
1002 % code that would have been replaced by the stuff above:
1003 % \begin{macrocode}
1004 \else
1005 \FN@temptoken{%
1006 \toks@\expandafter{\the\toks@
1007 \vskip\skip\footins
1008 \color@begingroup
1009 \normalcolor\footnoterule
1010 \unvbox\footins
1011 \color@endgroup
1012 }%
1013 }%
1014 \fi
1015 % \end{macrocode}
1016 %
1017 % Now we start building up the revised version of \cs{@makecol}. The
1018 % definition starts out in \cs{toks@}; first the \textsf{bottom} version:
1019 % \begin{macrocode}
1020 \ifFN@bottom
1021 \toks@{\setbox\@outputbox \box\@cclv
1022 \xdef\@freelist{\@freelist\@midlist}%
1023 \global\let\@midlist\@empty
1024 \@combinefloats
1025 \ifvoid\footins
1026 \else
1027 \setbox\@outputbox \vbox\bgroup
1028 \boxmaxdepth\@maxdepth
1029 \unvbox\@outputbox
1030 \vfill\relax
1031 }
1032 \the\FN@temptoken
1033 \toks@\expandafter{\the\toks@\egroup\fi}
1034 % \end{macrocode}
1035 %
1036 % Not putting stuff at the bottom: footnotes are placed using the
1037 % kernel's algorithm.
1038 % \begin{macrocode}
1039 \else
1040 \toks@{\ifvoid\footins
1041 \setbox\@outputbox\box\@cclv
1042 \else
1043 \setbox\@outputbox \vbox\bgroup
1044 \boxmaxdepth\@maxdepth
1045 \unvbox\@cclv
1046 }
1047 \the\FN@temptoken
1048 % \end{macrocode}
1049 %
1050 % Finally, close the \cs{setbox} and the \cs{ifvoid} and tag the parts
1051 % of the definition of \cs{@makecol} up to the end of the definition
1052 % of the \textsf{bottom} version on to \cs{toks@}.
1053 % \begin{macrocode}
1054 \toks@\expandafter{\the\toks@
1055 \egroup
1056 \fi
1057 \xdef\@freelist{\@freelist\@midlist}%
1058 \global\let\@midlist\@empty
1059 \@combinefloats
1060 }%
1061 \fi
1062 % \end{macrocode}
1063 %
1064 % Finally, create the new definition from the resulting object with
1065 % the remainder of the original \cs{@makecol} tagged on at the end.
1066 % \begin{macrocode}
1067 \toks@\expandafter{\the\toks@
1068 \ifvbox\@kludgeins
1069 \@makespecialcolbox
1070 \else
1071 \setbox\@outputbox \vbox to\@colht{%
1072 \@texttop \dimen@\dp\@outputbox
1073 \unvbox\@outputbox
1074 \vskip -\dimen@\@textbottom
1075 }%
1076 \fi
1077 \global\maxdepth\@maxdepth
1078 }
1079 \edef\@makecol{\the\toks@}
1080 % \end{macrocode}
1081 %
1082 % All of the above occurred conditionally on the `or' of
1083 % \cs{ifFN@para} and \cs{ifFN@bottom}, so we now close the
1084 % conditional.
1085 % \begin{macrocode}
1086 \fi
1087 % \end{macrocode}
1088 %
1089 %
1090 % \subsection{The requirements of \cs{@footnotetext}}
1091 %
1092 % \begin{macro}{\ifFN@baselinestretch}
1093 % \begin{macro}{\FN@singlespace}
1094 % Whatever we do, we are going to patch \cs{@footnotetext}; so first
1095 % of all, we'll check it's not been hacked by anyone other than
1096 % \texttt{setspace.sty} (while we're at it we also record whether
1097 % \texttt{setspace} is loaded).
1098 % so we do this here:
1099 % \begin{macrocode}
1100 \newif\ifFN@setspace
1101 \@ifpackageloaded{setspace}{%
1102 \FN@setspacetrue
1103 \@ifclassloaded{memoir}{%
1104 % \end{macrocode}
1105 % we're seeing \textsf{memoir}'s emulation of \textsf{setspace}
1106 % \begin{macrocode}
1107 \let\FN@baselinestretch\m@m@singlespace
1108 }{%
1109 % \end{macrocode}
1110 % we're seeing \textsf{setspace} in its own right
1111 % \begin{macrocode}
1112 \let\FN@baselinestretch\setspace@singlespace
1113 }%
1114 }{%
1115 \FN@setspacefalse
1116 }
1117 % \end{macrocode}
1118 % \end{macro}
1119 % \end{macro}
1120 %
1121 % There's substantial patching to be done if we're doing paragraph
1122 % footnotes:
1123 % \begin{macrocode}
1124 \ifFN@para
1125 \newcommand\@footmisxnotetext[1]{%
1126 \insert\footins{%
1127 % \end{macrocode}
1128 % insert compatibility code with |setspace.sty| if necessary
1129 % \begin{macrocode}
1130 \ifFN@setspace
1131 \let\baselinestretch\FN@baselinestretch
1132 \fi
1133 \reset@font\footnotesize
1134 \interlinepenalty\interfootnotelinepenalty
1135 \splittopskip\footnotesep
1136 \splitmaxdepth \dp\strutbox
1137 \floatingpenalty\@MM
1138 \hsize\columnwidth
1139 \@parboxrestore
1140 \protected@edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}%
1141 \color@begingroup
1142 % \end{macrocode}
1143 %
1144 % We set the paragraph in an \cs{hbox} and apply the fudge factor
1145 % here:
1146 %
1147 % \begin{macrocode}
1148 \setbox\FN@tempboxa=\hbox{%
1149 % \end{macrocode}
1150 %
1151 % This needs a parameter; the rule should be moved to the beginning of
1152 % the footnote paragraph, but the \cs{ignorespaces} should be left
1153 % here.
1154 %
1155 % \begin{macrocode}
1156 \@makefntext{\ignorespaces#1\strut
1157 % \end{macrocode}
1158 %
1159 % We insert a penalty here to help line breaking in the
1160 % footnote paragraph; the value is taken from the \TeX{}book.
1161 %
1162 % \begin{macrocode}
1163 \penalty-10\relax
1164 \hskip\footglue
1165 }% end of \@makefntext parameter
1166 }% end of \hbox
1167 \dp\FN@tempboxa=0pt
1168 \ifFN@etex
1169 \ht\FN@tempboxa=\dimexpr\wd\FN@tempboxa *
1170 \footnotebaselineskip / \columnwidth\relax
1171 \else
1172 \ht\FN@tempboxa=\fudgefactor\wd\FN@tempboxa
1173 \fi
1174 \box\FN@tempboxa
1175 \color@endgroup
1176 }%
1177 \FN@mf@prepare
1178 }
1179 % \end{macrocode}
1180 %
1181 % If we're not doing paragraph footnotes, we now simply tag a
1182 % \cs{FN@mf@prepare} command on the end of the definition; of course,
1183 % there are different definitions according as whether we're using
1184 % |side| footnotes\dots
1185 % \begin{macrocode}
1186 \else
1187 \ifFN@sidefn
1188 \newcommand\@footmisxnotetext[1]{%
1189 \marginpar{%
1190 % \end{macrocode}
1191 % insert compatibility code with |setspace.sty| if necessary
1192 % \begin{macrocode}
1193 \ifFN@setspace
1194 \let\baselinestretch\FN@baselinestretch
1195 \fi
1196 \reset@font\footnotesize
1197 \protected@edef\@currentlabel{%
1198 \csname p@footnote\endcsname\@thefnmark
1199 }%
1200 \color@begingroup
1201 \@makefntext{%
1202 \ignorespaces#1%
1203 }%
1204 \color@endgroup
1205 }%
1206 \FN@mf@prepare
1207 }%
1208 \else
1209 \newcommand\@footmisxnotetext[1]{%
1210 \insert\footins{%
1211 % \end{macrocode}
1212 % insert compatibility code with \textsf{setspace} if necessary
1213 % \begin{macrocode}
1214 \ifFN@setspace
1215 \let\baselinestretch\FN@baselinestretch
1216 \fi
1217 \reset@font\footnotesize
1218 \interlinepenalty\interfootnotelinepenalty
1219 \splittopskip\footnotesep
1220 \splitmaxdepth \dp\strutbox
1221 \floatingpenalty\@MM
1222 \hsize\columnwidth
1223 \@parboxrestore
1224 \protected@edef\@currentlabel{%
1225 \csname p@footnote\endcsname\@thefnmark
1226 }%
1227 \color@begingroup
1228 \@makefntext{%
1229 \rule\z@\footnotesep
1230 \ignorespaces#1\@finalstrut\strutbox
1231 }%
1232 \color@endgroup
1233 }%
1234 \FN@mf@prepare
1235 }%
1236 \fi
1237 \fi
1238 % \end{macrocode}
1239 % Now define \cs{@footnotetext} to be \cs{@footmisxnotetext}
1240 % \begin{macrocode}
1241 \@ifpackageloaded{hyperref}
1242 {
1243 \let\H@@footnotetext\@footmisxnotetext
1244 }{
1245 \renewcommand{\@footnotetext}[1]{\@footmisxnotetext{#1}}
1246 }
1247 % \end{macrocode}
1248 %
1249 % \subsection{Support code for paragraph footnotes}
1250 %
1251 % This code used (most inefficiently) to be in the argument of the
1252 % \cs{DeclareOption}; this no doubt comes of that code having been
1253 % written over Christmas 1993\dots
1254 %
1255 % Now all executed under the |para| conditional set in the option
1256 % declaration.
1257 % \begin{macrocode}
1258 \ifFN@para
1259 % \end{macrocode}
1260 %
1261 % \begin{macro}{\FN@tempboxa}
1262 % \begin{macro}{\FN@tempboxb}
1263 % \begin{macro}{\FN@tempboxb}
1264 % We need some temporary boxes, and \LaTeX{} only defines one
1265 % \begin{macrocode}
1266 \let\FN@tempboxa\@tempboxa
1267 \newbox\FN@tempboxb
1268 \newbox\FN@tempboxc
1269 % \end{macrocode}
1270 % \end{macro}
1271 % \end{macro}
1272 % \end{macro}
1273 %
1274 % \begin{macro}{\footglue}
1275 % A direct crib from the \TeX{}book:
1276 % \begin{macrocode}
1277 \newskip\footglue \footglue=1em plus.3em minus.3em
1278 % \end{macrocode}
1279 % \end{macro}
1280 %
1281 % \begin{macro}{\@makefntext}
1282 % The standard classes set the footnote mark flush with the text of
1283 % the footnote, but that's not appropriate for paragraph footnotes, we
1284 % find.
1285 %
1286 % There's not much point in patching this code from the original,
1287 % since the only things it has in common with the original are the
1288 % footnote mark and the footnote text (which last is the argument).
1289 % Note that the \cs{leavevmode} isn't necessary except in the case of
1290 % footnotes in minipages, which otherwise end up with the
1291 % \cs{@makefnmark} being executed in restricted vertical mode, which
1292 % results in its \cs{hbox} ending up in a line of its own.
1293 %
1294 % \begin{macrocode}
1295 \long\def\@makefntext#1{\leavevmode
1296 \@makefnmark\nobreak
1297 \hskip.5em\relax#1%
1298 }
1299 % \end{macrocode}
1300 % \end{macro}
1301 %
1302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1303 %
1304 % \begin{macro}{\footnotebaselineskip}
1305 % We need to record a value for the baseline skip when in footnotes:
1306 % \begin{macrocode}
1307 \newdimen\footnotebaselineskip
1308 {%
1309 \footnotesize
1310 \global
1311 \footnotebaselineskip=\normalbaselineskip
1312 }
1313 % \end{macrocode}
1314 % \end{macro}
1315 %
1316 % \begin{macro}{\fudgefactor}
1317 % Now we derive a fudge factor from the baselineskip we've just
1318 % established (we use \cs{dimexpr} if we're in etex, so there's no need
1319 % for the fudge factor in that case).
1320 % \begin{macrocode}
1321 \ifFN@etex
1322 \else
1323 \@tempdima=\footnotebaselineskip \multiply\@tempdima by 1024
1324 \divide \@tempdima by \columnwidth \multiply\@tempdima by 64
1325 \xdef\fudgefactor{\strip@pt\@tempdima }%
1326 \fi
1327 % \end{macrocode}
1328 % \end{macro}
1329 %
1330 % \begin{macro}{\makefootnoteparagraph}
1331 % For use in the output routine
1332 % \begin{macrocode}
1333 \long\def\makefootnoteparagraph{\unvbox\footins \makehboxofhboxes
1334 \setbox\FN@tempboxa=\hbox{\unhbox\FN@tempboxa \removehboxes}
1335 % \end{macrocode}
1336 % Now we are ready to set the paragraph:
1337 % \begin{macrocode}
1338 \hsize\columnwidth
1339 \@parboxrestore
1340 \baselineskip=\footnotebaselineskip
1341 \noindent
1342 \rule{\z@}{\footnotesep}%
1343 \unhbox\FN@tempboxa\par
1344 }
1345 % \end{macrocode}
1346 % \end{macro}
1347 %
1348 % \begin{macro}{\makehboxofhboxes}
1349 % \begin{macro}{\removehboxes}
1350 % Support code for \cs{makefootnoteparagraph}
1351 % \begin{macrocode}
1352 \def\makehboxofhboxes{\setbox\FN@tempboxa=\hbox{}%
1353 \loop
1354 \setbox\FN@tempboxb=\lastbox
1355 \ifhbox\FN@tempboxb
1356 \setbox\FN@tempboxa=\hbox{\box\FN@tempboxb\unhbox\FN@tempboxa}%
1357 \repeat
1358 }
1359 \def\removehboxes{\setbox\FN@tempboxa=\lastbox
1360 \ifhbox
1361 \FN@tempboxa{\removehboxes}%
1362 \unhbox\FN@tempboxa
1363 \fi
1364 }
1365 \fi
1366 % \end{macrocode}
1367 % \end{macro}
1368 % \end{macro}
1369 %
1370 %
1371 % \subsection{The other footnote commands}\label{sec:perpage-code}
1372 %
1373 % \begin{macro}{\ifFN@pp@footnotehint}
1374 % A conditional needed by the perpage code: must be defined outside
1375 % the \textsl{perpage} conditional
1376 % \begin{macrocode}
1377 \newif\ifFN@pp@footnotehint
1378 % \end{macrocode}
1379 % \end{macro}
1380 %
1381 % \begin{macro}{\c@pp@next@reset}
1382 % Counter used to store information about the next reset of the
1383 % footnote number, in perpage mode.
1384 % \begin{macrocode}
1385 \newcounter{pp@next@reset}%
1386 % \end{macrocode}
1387 % \end{macro}
1388 %
1389 % \begin{macro}{\ifFN@pp@towrite}
1390 % A conditional that mediates the interaction between the
1391 % \texttt{perpage} option and the \texttt{multiple} option.
1392 % \begin{macrocode}
1393 \newif\ifFN@pp@towrite
1394 \FN@pp@towritefalse
1395 % \end{macrocode}
1396 % \end{macro}
1397 %
1398 % \begin{macro}{\ifFN@pp@lastseq}
1399 % We prevent endless processions of diagnostics `footnote sequence
1400 % lost' by using this conditional (again, needs to be defined outside
1401 % the \textsl{perpage} conditional:
1402 % \begin{macrocode}
1403 %<*PPdebug>
1404 \newif\ifFN@pp@lastseq
1405 \global\FN@pp@lastseqfalse
1406 %</PPdebug>
1407 % \end{macrocode}
1408 % \end{macro}
1409 %
1410 % Now, do we need to patch \cs{footnote} for per-page footnotes?
1411 % \begin{macrocode}
1412 \ifFN@perpage
1413 \CheckCommand*\footnote{\@ifnextchar [%]
1414 \@xfootnote
1415 {%
1416 \stepcounter\@mpfn \protected@xdef\@thefnmark{\thempfn}%
1417 \@footnotemark \@footnotetext
1418 }%
1419 }
1420 \renewcommand*\footnote{\@ifnextchar [%]
1421 \@xfootnote
1422 {%
1423 \stepcounter\@mpfn \protected@xdef\@thefnmark{\thempfn}%
1424 \FN@pp@footnote\@footnotemark
1425 % \end{macrocode}
1426 %
1427 % In case that we're \emph{not} running \texttt{multiple} option,
1428 % \cs{@footnotemark} \emph{won't} have written details to the |.aux|
1429 % file, so do it now:
1430 % \begin{macrocode}
1431 \ifFN@pp@towrite
1432 \FN@pp@writetemp
1433 \FN@pp@towritefalse
1434 \fi
1435 \@footnotetext
1436 }%
1437 }
1438 % \end{macrocode}
1439 %
1440 % And the analagous change for \cs{footnotemark}
1441 % \begin{macrocode}
1442 \CheckCommand*\footnotemark{%
1443 \@ifnextchar [%]
1444 \@xfootnotemark
1445 {%
1446 \stepcounter{footnote}%
1447 \protected@xdef\@thefnmark{\thefootnote}%
1448 \@footnotemark
1449 }%
1450 }
1451 \renewcommand*\footnotemark{%
1452 \@ifnextchar [%]
1453 \@xfootnotemark
1454 {%
1455 \stepcounter{footnote}%
1456 \protected@xdef\@thefnmark{\thefootnote}%
1457 \FN@pp@footnote\@footnotemark
1458 % \end{macrocode}
1459 %
1460 % again, tidy up if we're not doing \texttt{multiple} option
1461 % \begin{macrocode}
1462 \ifFN@pp@towrite
1463 \FN@pp@writetemp
1464 \FN@pp@towritefalse
1465 \fi
1466 }%
1467 }
1468 % \end{macrocode}
1469 %
1470 % \begin{macro}{\FN@pp@initialstab}
1471 % Now the supporting commands\dots
1472 %
1473 % if we encounter no information in the |.aux| file, we make a first
1474 % stab resetting footnote on the page number counter
1475 % \begin{macrocode}
1476 \gdef\FN@pp@initial@stab{\@addtoreset{footnote}{page}}
1477 \AtBeginDocument{\FN@pp@initial@stab}
1478 % \end{macrocode}
1479 % \end{macro}
1480 %
1481 % We use a counter to keep pace with the footnotes: this counter is
1482 % used in the data that's written to the |.aux| file, and matched to
1483 % create the correct footnote numbers on the second and subsequent
1484 % passes.
1485 % \begin{macrocode}
1486 \newcounter{@fnserial}
1487 % \end{macrocode}
1488 %
1489 % \begin{macro}{\FN@pp@cpage}
1490 % The package requires a ``knowledge'' of the current page number.
1491 % It's kept in \cs{FN@pp@cpage}
1492 % \begin{macrocode}
1493 \def\FN@pp@cpage{0}
1494 % \end{macrocode}
1495 % \end{macro}
1496 %
1497 % \begin{macro}{\footnotehint}
1498 % However, the progress of page numbers isn't predictable, so we have
1499 % a flag saying `reset footnote number'. The flag is for indirect use
1500 % by people who diddle with the page number, via the \cs{footnotehint}
1501 % command, as well as various places where we \emph{know} there could
1502 % be a discontinuity.
1503 % \begin{macrocode}
1504 \FN@pp@footnotehinttrue
1505 \newcommand{\footnotehint}{%
1506 \setcounter{footnote}{0}%
1507 \protected@writeaux\relax{\protect\FN@pp@footnotehinttrue}%
1508 \@tempcnta\c@@fnserial
1509 \advance\@tempcnta\@ne
1510 \global\c@pp@next@reset\@tempcnta
1511 }
1512 \AtBeginDocument{\protected@writeaux\relax{%
1513 \protect\providecommand{\protect\FN@pp@footnotehinttrue}{}%
1514 }%
1515 }
1516 % \end{macrocode}
1517 % \end{macro}
1518 %
1519 % \begin{macro}{\FN@pp@lastfoot}
1520 % Dummy value for the number of the last footnote we came across.
1521 % \begin{macrocode}
1522 \def\FN@pp@lastfoot{-1}
1523 % \end{macrocode}
1524 % \end{macro}
1525 %
1526 % \begin{macro}{\FN@pp@footnote@aux}
1527 % The command \cs{FN@pp@footnote@aux} is written to the |.aux| file
1528 % for every footnote counter allocated (other than in minipages):\\
1529 % |#1| is the footnote serial number\\
1530 % |#2| is the page the footnote was actually written on
1531 % \begin{macrocode}
1532 \newcommand{\FN@pp@footnote@aux}[2]{%
1533 \ifnum\FN@pp@lastfoot<#1
1534 \ifFN@pp@footnotehint
1535 \FN@pp@resetfn{#1}{#2}%
1536 \FN@pp@footnotehintfalse
1537 \else
1538 \gdef\@tempa{#2}%
1539 \ifx\@tempa\FN@pp@cpage
1540 \else
1541 \FN@pp@resetfn{#1}{#2}%
1542 \fi
1543 \fi
1544 \def\FN@pp@lastfoot{#1}%
1545 %<*PPdebug>
1546 \else
1547 \ifFN@pp@debug
1548 \typeout{not considering footnote serial number #1
1549 (last valid was \FN@pp@lastfoot)}%
1550 \fi
1551 %</PPdebug>
1552 \fi
1553 % \end{macrocode}
1554 %
1555 % Since we've now had at least one item of footnote information from
1556 % a |.aux| file, we can't allow footnote resetting per page.
1557 % \begin{macrocode}
1558 \global\let\FN@pp@initial@stab\relax
1559 }
1560 % \end{macrocode}
1561 % \end{macro}
1562 %
1563 % \begin{macro}{\FN@pp@resetfn}
1564 % Set the flag to reset the footnote number; this constructs a chain
1565 % through the footnote serial numbers at the start of each page
1566 % \begin{macrocode}
1567 \newcommand{\FN@pp@resetfn}[2]{%
1568 \gdef\FN@pp@cpage{#2}%
1569 \expandafter\gdef
1570 \csname FN@pp@next-\FN@pp@prev@foot\endcsname{#1}%
1571 \def\FN@pp@prev@foot{#1}%
1572 \expandafter\xdef
1573 \csname FN@pp@next-\FN@pp@prev@foot\endcsname{\the\@MM}%
1574 }
1575 % \end{macrocode}
1576 % \end{macro}
1577 %
1578 % \begin{macro}{\FN@pp@prev@foot}
1579 % The base of the footnote serial number chain (this element is never
1580 % looked at: footnote serial 1 must always have number 1)
1581 % \begin{macrocode}
1582 \newcommand{\FN@pp@prev@foot}{root}
1583 % \end{macrocode}
1584 % \end{macro}
1585 %
1586 % again, avoid confusion; also establish \cs{FN@pp@footnote@aux} in the
1587 % |.aux| file
1588 % \begin{macrocode}
1589 \AtBeginDocument{\protected@writeaux\relax{%
1590 \protect\providecommand{\protect\FN@pp@footnote@aux}[2]{}}%
1591 \c@pp@next@reset\@ne
1592 }
1593 % \end{macrocode}
1594 %
1595 % At end document, establish a new \cs{FN@pp@footnote@aux} which
1596 % checks whether numbers have changed during the scan of the |.aux|
1597 % files for changed labels and the like
1598 % \begin{macrocode}
1599 \AtEndDocument{\let\FN@pp@footnote@aux\FN@pp@footnote@endaux
1600 \def\FN@pp@lastfoot{-1}%
1601 \FN@pp@footnotehintfalse
1602 \renewcommand{\FN@pp@prev@foot}{root}
1603 }
1604 % \end{macrocode}
1605 %
1606 % \begin{macro}{\FN@pp@footnote@endaux}
1607 % The footnote analysis command for end document
1608 % \begin{macrocode}
1609 \newcommand{\FN@pp@footnote@endaux}[2]{%
1610 \ifnum\FN@pp@lastfoot<#1
1611 \ifFN@pp@footnotehint
1612 \FN@pp@resetfn@end{#1}{#2}%
1613 \FN@pp@footnotehintfalse
1614 \else
1615 \gdef\@tempa{#2}%
1616 \ifx\@tempa\FN@pp@cpage
1617 \else
1618 \FN@pp@resetfn@end{#1}{#2}%
1619 \fi
1620 \fi
1621 \def\FN@pp@lastfoot{#1}%
1622 %<*PPdebug>
1623 \else
1624 \ifFN@pp@debug
1625 \typeout{not considering footnote serial number #1
1626 (last valid was \FN@pp@lastfoot)}%
1627 \fi
1628 %</PPdebug>
1629 \fi
1630 }
1631 % \end{macrocode}
1632 % \end{macro}
1633 %
1634 % \begin{macro}{\FN@pp@resetfn@end}
1635 % Deal with the \verb'.aux' file footnote details, at end document
1636 % \begin{macrocode}
1637 \newcommand{\FN@pp@resetfn@end}[2]{%
1638 \def\@tempa{#1}%
1639 \expandafter\ifx\csname FN@pp@next-\FN@pp@prev@foot\endcsname\@tempa%
1640 \else
1641 \@tempswatrue
1642 %<*PPdebug>
1643 \ifFN@pp@debug
1644 \expandafter\ifx\csname FN@pp@next-\FN@pp@prev@foot\endcsname\relax
1645 \ifFN@pp@lastseq\else
1646 \typeout{footnote sequence lost between pages
1647 \FN@pp@cpage\space and #2}%
1648 \global\FN@pp@lastseqtrue
1649 \fi
1650 \else
1651 \typeout{footnotes changed between pages \FN@pp@cpage\space and #2:
1652 next was \csname FN@pp@next-\FN@pp@prev@foot\endcsname, now #1}%
1653 \global\FN@pp@lastseqfalse
1654 \fi
1655 \fi
1656 %</PPdebug>
1657 \fi
1658 \gdef\FN@pp@prev@foot{#1}%
1659 \gdef\FN@pp@cpage{#2}%
1660 }
1661 % \end{macrocode}
1662 % \end{macro}
1663 %
1664 % \begin{macro}{\clearpage}
1665 % \begin{macro}{\FN@pp@@clearpage}
1666 % Now, how do we cope with \cs{include}d documents? We can't insert
1667 % anything (the |includex| package offers \cs{AtBeginIncludedDocument}
1668 % but there's no corresponding command for files included by the
1669 % kernel \cs{include}. So we insert a footnote hint at every
1670 % \cs{clearpage}
1671 % \begin{macrocode}
1672 \let\FN@pp@@clearpage\clearpage
1673 \renewcommand{\clearpage}{\footnotehint\FN@pp@@clearpage}
1674 % \end{macrocode}
1675 % \end{macro}
1676 % \end{macro}
1677 %
1678 % \begin{macro}{\FN@pp@footnote}
1679 % The business end of the option: a macro to decide on footnote
1680 % numbers, called from \cs{footnote} and \cs{footnotemark} (see
1681 % above).
1682 % \begin{macrocode}
1683 \def\FN@pp@footnote{%
1684 \if@minipage\else
1685 \global\advance\c@@fnserial\@ne
1686 \if@filesw
1687 % \end{macrocode}
1688 %
1689 % In case we're also doing \texttt{multiple} option, we now save up
1690 % the command to write to the |.aux| file, and mark we've done so
1691 % \begin{macrocode}
1692 \xdef\FN@pp@writetemp{%
1693 \noexpand\protected@writeaux\relax{%
1694 \string\FN@pp@footnote@aux
1695 {\the\c@@fnserial}{\noexpand\thepage}%
1696 }%
1697 }%
1698 \FN@pp@towritetrue
1699 \fi
1700 \ifnum\c@pp@next@reset>\c@@fnserial
1701 \else
1702 \global\expandafter\csname c@\@mpfn\endcsname\@ne
1703 \protected@xdef\@thefnmark{\thempfn}%
1704 % \end{macrocode}
1705 %
1706 % Now look at the next element in the chain:
1707 % \begin{macrocode}
1708 \expandafter\let\expandafter\@tempa
1709 \csname FN@pp@next-\number\c@pp@next@reset\endcsname
1710 % \end{macrocode}
1711 %
1712 % If the chain is broken here, set the next reset point to something
1713 % (one hopes) infeasibly large\dots{} a weak point?
1714 % \begin{macrocode}
1715 \ifx\@tempa\relax
1716 \global\c@pp@next@reset\@MM
1717 \else
1718 \global\c@pp@next@reset\@tempa
1719 \fi
1720 \fi
1721 \fi
1722 }
1723 % \end{macrocode}
1724 % \end{macro}
1725 %
1726 % End of code loaded when \texttt{perpage} option is given
1727 % \begin{macrocode}
1728 \fi
1729 % \end{macrocode}
1730 %
1731 % Finally, if we're not doing paragraph footnotes, we redefine
1732 % \cs{@makefntext} to take account of the value of
1733 % \cs{footnotemargin}, to impose \cs{footnotelayout}, and to make the
1734 % footnote body text hang, if appropriate.
1735 % \begin{macrocode}
1736 \ifFN@para
1737 \else
1738 % \end{macrocode}
1739 %
1740 % hanging footnote version:
1741 % \begin{macrocode}
1742 \long\def\@makefntext#1{%
1743 \ifFN@hangfoot
1744 \bgroup
1745 % \end{macrocode}
1746 %
1747 % get the marker so we can measure it:
1748 % \begin{macrocode}
1749 \setbox\@tempboxa\hbox{%
1750 \ifdim\footnotemargin>0pt
1751 \hb@xt@\footnotemargin{\@makefnmark\hss}%
1752 \else
1753 \@makefnmark
1754 \fi
1755 }%
1756 % \end{macrocode}
1757 %
1758 % use the width of the box to set up hanging (potentially for more
1759 % than one paragraph); note that the hanging \cs{parskip} and
1760 % \cs{parindent} are set \emph{after} we've executed \cs{leavevmode}(!)
1761 % \begin{macrocode}
1762 \leftmargin\wd\@tempboxa
1763 \rightmargin\z@
1764 \linewidth \columnwidth
1765 \advance \linewidth -\leftmargin
1766 \parshape \@ne \leftmargin \linewidth
1767 \footnotesize
1768 % \end{macrocode}
1769 %
1770 % stop the \cs{parshape} being overwritten:
1771 % \begin{macrocode}
1772 \@setpar{{\@@par}}%
1773 % \end{macrocode}
1774 %
1775 % and finally put the marker in its chosen place:
1776 % \begin{macrocode}
1777 \leavevmode
1778 \llap{\box\@tempboxa}%
1779 \parskip\hangfootparskip\relax
1780 \parindent\hangfootparindent\relax
1781 \else
1782 % \end{macrocode}
1783 %
1784 % ordinary (non-hanging) footnote version:
1785 % \begin{macrocode}
1786 \parindent1em
1787 \noindent
1788 \ifdim\footnotemargin>\z@
1789 \hb@xt@ \footnotemargin{\hss\@makefnmark}%
1790 \else
1791 \ifdim\footnotemargin=\z@
1792 \llap{\@makefnmark}%
1793 \else
1794 \llap{\hb@xt@ -\footnotemargin{\@makefnmark\hss}}%
1795 \fi
1796 \fi
1797 \fi
1798 \footnotelayout#1%
1799 % \end{macrocode}
1800 %
1801 % if we're hanging, close the hang group
1802 % \begin{macrocode}
1803 \ifFN@hangfoot
1804 \par\egroup
1805 \fi
1806 }
1807 \fi
1808 % \end{macrocode}
1809 %
1810 % \section{Remaining requirements}
1811 %
1812 % We have to insert the code that executes the \texttt{stable} and
1813 % \texttt{multiple} options. Since \texttt{stable} may suppress the
1814 % setting of a footnote altogether, we put the \texttt{multiple}
1815 % option first, as otherwise we might get isolated superscripted
1816 % commas that separate footnotes that have otherwise been suppressed.
1817 %
1818 % \subsection{The code that executes the \texttt{multiple} option}
1819 %
1820 % \begin{macro}{\multiplefootnotemarker}
1821 % \begin{macro}{\multfootsep}
1822 % \begin{macro}{\@footnotemark}
1823 % \begin{macro}{\FN@mf@prepare}
1824 % \begin{macro}{\FN@mf@check}
1825 % This (revised) code derives from a suggestion by Alexander Rozhenko
1826 % (the author of the \textit{manyfoot} package): the intention is that
1827 % \textit{footmisx} and \textit{manyfoot} should be able to
1828 % `interwork', in the sense that each would recognise the other's
1829 % footnote marks and behave appropriately. The trick is that
1830 % both \cs{footnote} and \cs{footnotemark} insert a marker (a
1831 % cancelling pair of kerns of \cs{multiplefootnotemarker} (of opposite
1832 % signs), which is detected in following \cs{footnote} or
1833 % \cs{footnotemark} commands. Note we have to take special
1834 % precautions to ensure that the kerns are the last things added to
1835 % the horizontal list by the commands.
1836 % \begin{macrocode}
1837 \ifFN@multiplefootnote
1838 \providecommand*{\multiplefootnotemarker}{3sp}
1839 \providecommand*{\multfootsep}{,}
1840 \@ifpackageloaded{hyperref}{
1841 \newcommand*{\@footmicx@makefnmark}{%
1842 \stepcounter{Hfootnote}%
1843 \global\let\Hy@saved@currentHref\@currentHref%
1844 \hyper@makecurrent{Hfootnote}%
1845 \global\let\Hy@footnote@currentHref\@currentHref%
1846 \global\let\@currentHref\Hy@saved@currentHref%
1847 \hyper@linkstart{link}{\Hy@footnote@currentHref}%
1848 \@makefnmark%
1849 \hyper@linkend%
1850 }
1851 }{
1852 \newcommand*{\@footmicx@makefnmark}{\@makefnmark}
1853 }
1854 \newcommand*\@footmisxnotemark{%
1855 \leavevmode
1856 \ifhmode
1857 \edef\@x@sf{\the\spacefactor}%
1858 \FN@mf@check
1859 \nobreak
1860 \fi
1861 \@footmicx@makefnmark
1862 % \end{macrocode}
1863 %
1864 % if we're also doing option \texttt{perpage}, write its stuff to the
1865 % |.aux| file for it, so the \emph{wotsit} node doesn't interfere with
1866 % our \cs{kern} detection.
1867 % \begin{macrocode}
1868 \ifFN@pp@towrite
1869 \FN@pp@writetemp
1870 \FN@pp@towritefalse
1871 \fi
1872 \FN@mf@prepare
1873 \ifhmode\spacefactor\@x@sf\fi
1874 \relax
1875 }
1876 \def\FN@mf@prepare{%
1877 \kern-\multiplefootnotemarker
1878 \kern\multiplefootnotemarker\relax
1879 }
1880 \def\FN@mf@check{%
1881 \ifdim\lastkern=\multiplefootnotemarker\relax
1882 \edef\@x@sf{\the\spacefactor}%
1883 \unkern
1884 \textsuperscript{\multfootsep}%
1885 \spacefactor\@x@sf\relax
1886 \fi
1887 }
1888 \CheckCommand*\@footnotemark{%
1889 \leavevmode
1890 \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi
1891 \@makefnmark
1892 \ifhmode\spacefactor\@x@sf\fi
1893 \relax
1894 }
1895 \let\@footnotemark\@footmisxnotemark
1896
1897 % \end{macrocode}
1898 %
1899 % If we're not doing multiple, just create an empty \cs{FN@mf@prepare}
1900 % \begin{macrocode}
1901 \else
1902 \let\FN@mf@prepare\relax
1903 \fi
1904 % \end{macrocode}
1905 % \end{macro}
1906 % \end{macro}
1907 % \end{macro}
1908 % \end{macro}
1909 % \end{macro}
1910 %
1911 % \subsection{The code that executes the \texttt{stable} option}
1912 %
1913 % \begin{macro}{\ifFN@stablefootnote}
1914 % \begin{macro}{\FN@sf@@footnote}
1915 % The basic idea is to use the `original' code of \cs{footnote} (which
1916 % this package may have hacked around something chronic) only if we're
1917 % in typesetting mode (as determined by the state of the \cs{protect}
1918 % command. Otherwise, the command becomes an elaborate multistage
1919 % `gobble'.
1920 % \begin{macrocode}
1921 \ifFN@stablefootnote
1922 \let\FN@sf@@footnote\footnote
1923 \def\footnote{\ifx\protect\@typeset@protect
1924 \expandafter\FN@sf@@footnote
1925 \else
1926 \expandafter\FN@sf@gobble@opt
1927 \fi
1928 }
1929 % \end{macrocode}
1930 % \end{macro}
1931 % \end{macro}
1932 %
1933 % \begin{macro}{\FN@sf@gobble@opt}
1934 % \begin{macro}{\FN@sf@gobble@twobracket}
1935 % Define \cs{FN@sf@gobble@opt} as a robust command that gobbles either
1936 % an optional and a mandatory argument, or just a mandatory one.
1937 % \begin{macrocode}
1938 \edef\FN@sf@gobble@opt{\noexpand\protect
1939 \expandafter\noexpand\csname FN@sf@gobble@opt \endcsname}
1940 \expandafter\def\csname FN@sf@gobble@opt \endcsname{%
1941 \@ifnextchar[%]
1942 \FN@sf@gobble@twobracket
1943 \@gobble
1944 }
1945 \def\FN@sf@gobble@twobracket[#1]#2{}
1946 % \end{macrocode}
1947 % \end{macro}
1948 % \end{macro}
1949 %
1950 % \begin{macro}{\FN@sf@@footnotemark}
1951 % \begin{macro}{\FN@sf@gobble@optonly}
1952 % \begin{macro}{\FN@sf@gobble@bracket}
1953 % Now the same for \cs{footnotemark}
1954 % \begin{macrocode}
1955 \let\FN@sf@@footnotemark\footnotemark
1956 \def\footnotemark{\ifx\protect\@typeset@protect
1957 \expandafter\FN@sf@@footnotemark
1958 \else
1959 \expandafter\FN@sf@gobble@optonly
1960 \fi
1961 }
1962 \edef\FN@sf@gobble@optonly{\noexpand\protect
1963 \expandafter\noexpand\csname FN@sf@gobble@optonly \endcsname}
1964 \expandafter\def\csname FN@sf@gobble@optonly \endcsname{%
1965 \@ifnextchar[%]
1966 \FN@sf@gobble@bracket
1967 {}%
1968 }
1969 \def\FN@sf@gobble@bracket[#1]{}
1970 \fi
1971 % \end{macrocode}
1972 % \end{macro}
1973 % \end{macro}
1974 % \end{macro}
1975 %
1976 % \begin{macro}{\setfnsymbol}
1977 % \begin{macro}{\FN@fnsymbol@lamport}
1978 % \section{Symbol option variants}
1979 %
1980 % Lamport's choice of symbols for \cs{fnsymbol} wasn't entirely
1981 % ``traditional'', so we (now) provide alternatives. The
1982 % \cs{setfnsymbol} command offers a small number of choices, and the
1983 % user may define more still, using the \cs{DefineFNsymbols} or
1984 % \cs{DefineFNsymbolsTM} commands, defined below.
1985 % \begin{macrocode}
1986 \newcommand\setfnsymbol[1]{%
1987 \@bsphack
1988 \@ifundefined{FN@fnsymbol@#1}%
1989 {%
1990 \PackageError{footmisx}{Symbol style "#1" not known}%
1991 \@eha
1992 }{%
1993 \expandafter\let\expandafter\@fnsymbol\csname
1994 FN@fnsymbol@#1\endcsname
1995 }%
1996 \@esphack
1997 }
1998 % \end{macrocode}
1999 %
2000 % The default selection is Lamport's original, as represented in
2001 % current \LaTeX{}~--- we preserve it in case we need to ``get back''
2002 % to it.
2003 % \begin{macrocode}
2004 \let\FN@fnsymbol@lamport\@fnsymbol
2005 %</package>
2006 % \end{macrocode}
2007 % \end{macro}
2008 % \end{macro}
2009 %
2010 % \begin{macro}{\if@tempswb}
2011 % \begin{macro}{\@tempswbfalse}
2012 % \begin{macro}{\@tempswbtrue}
2013 % We need another temp conditional
2014 % \begin{macrocode}
2015 \newif\if@tempswb
2016 % \end{macrocode}
2017 % \end{macro}
2018 % \end{macro}
2019 % \end{macro}
2020 %
2021 % \begin{macro}{\DefineFNsymbols}
2022 % \begin{macro}{\@DefineFNsymbols}
2023 % \begin{macro}{\@DefineFNsymbols@}
2024 % \begin{macro}{\FN@build@symboldef}
2025 % The macro \cs{DefineFNsymbols} allows the user to define a set of
2026 % footnote symbols, to be used with the \cs{setfnsymbol} command.
2027 % Syntax:\par\noindent
2028 % \cs{DefineFNsymbols}|[*]|\marg{set name}\oarg{style}\marg{symbol list}
2029 %
2030 % If the optional asterisk is present, the set defined will produce an
2031 % error if the symbol number is too large; otherwise it will quietly
2032 % change to numbering in place of symbol use (a warning is produced at
2033 % the end of the document). The set name is the future argument of
2034 % \cs{setfnsymbol}). The style (default \texttt{text}) gives the style
2035 % the symbols are typeset (this is the \emph{correct} method, but
2036 % unfortunately not all symbols, even for Lamport's original set for
2037 % \LaTeX{} \cs{fnsymbol} may be expressed this way in a sufficiently
2038 % old \LaTeX{} distribution). The symbol list is a set of objects to
2039 % be used when the set is selected.
2040 %
2041 % Example of use:\par\noindent define a direct replacement for
2042 % Lamport's original \cs{fnsymbol} command ---
2043 %\begin{verbatim}
2044 %\DefineFNsymbols*{lamport}[math]{*\dagger\ddagger\mathsection
2045 % \mathparagraph\|{**}{\dagger\dagger}{\ddagger\ddagger}%
2046 %}
2047 %\end{verbatim}
2048 % Note that doubled-up (and worse\,---\,see below) symbols need braces
2049 % around them.
2050 % \begin{macrocode}
2051 \newcommand{\DefineFNsymbols}{%
2052 \@ifstar{\@tempswbtrue\@DefineFNsymbols}%
2053 {\@tempswbfalse\@DefineFNsymbols}%
2054 }
2055 \newcommand{\@DefineFNsymbols}[1]{%
2056 \@ifnextchar[% ]
2057 {\@DefineFNsymbols@{#1}}{\@DefineFNsymbols@{#1}[text]}%
2058 }
2059 \def\@DefineFNsymbols@#1[#2]#3{%
2060 \expandafter\ifx\csname FN@fnsymbol@#1\endcsname\relax
2061 \PackageInfo{footmisx}{Declaring symbol style #1}%
2062 \else
2063 \PackageWarning{footmisx}{Redeclaring symbol style #1}%
2064 \fi
2065 \toks@{}%
2066 \def\@tempb{\end}%
2067 \FN@build@symboldef#3\end
2068 \def\@tempc{math}%
2069 \def\@tempd{#2}%
2070 \expandafter\xdef\csname FN@fnsymbol@#1\endcsname##1{%
2071 \ifx\@tempc\@tempd
2072 \noexpand\ensuremath
2073 \else
2074 \noexpand\nfss@text
2075 \fi
2076 {%
2077 \noexpand\ifcase##1%
2078 \the\toks@
2079 \noexpand\else
2080 \if@tempswb
2081 \noexpand\@ctrerr
2082 \else
2083 \noexpand\@arabic##1\noexpand\FN@orange##1%
2084 \fi
2085 \noexpand\fi
2086 }%
2087 }%
2088 }
2089 \def\FN@build@symboldef#1{%
2090 \def\@tempa{#1}%
2091 \ifx\@tempa\@tempb
2092 \else
2093 \toks@\expandafter{\the\toks@\or#1}%
2094 \expandafter\FN@build@symboldef
2095 \fi
2096 }
2097 % \end{macrocode}
2098 % \end{macro}
2099 % \end{macro}
2100 % \end{macro}
2101 % \end{macro}
2102 %
2103 % \begin{macro}{\DefineFNsymbolsTM}
2104 % \begin{macro}{\@DefineFNsymbolsTM}
2105 % \begin{macro}{\FN@build@symboldefTM}
2106 %
2107 % Now do the same job for the ``modern'' way of having both text and
2108 % maths variants of everything.
2109 % \begin{macrocode}
2110 \newcommand{\DefineFNsymbolsTM}{%
2111 \@ifstar{\@tempswbtrue\@DefineFNsymbolsTM}%
2112 {\@tempswbfalse\@DefineFNsymbolsTM}}%
2113 \newcommand{\@DefineFNsymbolsTM}[2]{%
2114 \expandafter\ifx\csname FN@fnsymbol@#1\endcsname\relax
2115 \PackageInfo{footmisx}{Declaring symbol style #1}%
2116 \else
2117 \PackageWarning{footmisx}{Redeclaring symbol style #1}%
2118 \fi
2119 \toks@{}%
2120 \def\@tempb{\end}%
2121 \FN@build@symboldefTM#2\end\@null
2122 \expandafter\xdef\csname FN@fnsymbol@#1\endcsname##1{%
2123 \noexpand\ifcase##1%
2124 \the\toks@
2125 \noexpand\else
2126 \if@tempswb
2127 \noexpand\@ctrerr
2128 \else
2129 \noexpand\@arabic##1\noexpand\FN@orange##1%
2130 \fi
2131 \noexpand\fi
2132 }%
2133 }%
2134 % \end{macrocode}
2135 % Note that this version has two variants of every definition, so
2136 % needs two stopper codes above.
2137 % \begin{macrocode}
2138 \def\FN@build@symboldefTM#1#2{%
2139 \def\@tempa{#1}%
2140 \ifx\@tempa\@tempb
2141 \else
2142 \toks@\expandafter{\the\toks@\or\TextOrMath{#1}{#2}}%
2143 \expandafter\FN@build@symboldefTM
2144 \fi
2145 }
2146 % \end{macrocode}
2147 % \end{macro}
2148 % \end{macro}
2149 % \end{macro}
2150 %
2151 % \begin{macro}{\TextOrMath}
2152 % This is a stripped down (e-\TeX{} only) version of what appears in
2153 % fixltx2e. If the command's already defined, we assume it's that
2154 % version.
2155 % \begin{macrocode}
2156 \@ifundefined{TextOrMath}{%
2157 \@ifundefined{eTeXversion}{%
2158 \PackageError{footmisx}{Can't define commands for footnote symbol}%
2159 {Use e-LaTeX, or load package fixltx2e before
2160 footmisx}%
2161 }{%
2162 \protected\expandafter\def\csname TextOrMath\space\endcsname{%
2163 \ifmmode \expandafter\@secondoftwo
2164 \else \expandafter\@firstoftwo \fi
2165 }
2166 \edef\TextOrMath#1#2{%
2167 \expandafter\noexpand\csname TextOrMath\space\endcsname
2168 {#1}{#2}%
2169 }%
2170 }%
2171 }{}
2172 % \end{macrocode}
2173 % \end{macro}
2174 %
2175 % \begin{macro}{\FN@orange}
2176 % \begin{macro}{\@fnsymbol@orange}
2177 % \begin{macro}{\@diagnose@fnsymbol@orange}
2178 % Macros to deal with footnote symbols going out of range (when
2179 % they're allowed to\,--\,e.g., in the \texttt{symbol*} option).
2180 % \begin{macrocode}
2181 \def\FN@orange#1{%
2182 \@bsphack
2183 \PackageInfo{footmisx}{Footnote number \number#1 out of range}%
2184 \protect\@fnsymbol@orange
2185 \@esphack
2186 }
2187 \global\let\@diagnose@fnsymbol@orange\relax
2188 \AtEndDocument{\@diagnose@fnsymbol@orange}
2189 \def\@fnsymbol@orange{%
2190 \gdef\@diagnose@fnsymbol@orange{%
2191 \PackageWarningNoLine{footmisx}{Some footnote number(s)
2192 were out of range
2193 \MessageBreak
2194 see log for details%
2195 }%
2196 }%
2197 }
2198 % \end{macrocode}
2199 % \end{macro}
2200 % \end{macro}
2201 % \end{macro}
2202 %
2203 % \begin{macro}{\textbardbl}
2204 % This is defined in recent \LaTeX{} releases, but not in (for
2205 % example) that distributed with the last release of te\TeX{}. Since
2206 % it's needed in some symbol set definitions (including Lamport's) we
2207 % define it here.
2208 % \begin{macrocode}
2209 \@ifundefined{textbardbl}{%
2210 \DeclareTextSymbol{\textbardbl}{OMS}{107}%
2211 \DeclareTextSymbolDefault{\textbardbl}{TS1}}{}%
2212 % \end{macrocode}
2213 % (This definition comes from the \LaTeX{} sources.)
2214 % \end{macro}
2215 %
2216 % \begin{macro}{\FN@fnsymbol@bringhurst}
2217 % \begin{macro}{\FN@fnsymbol@chicago}
2218 % \begin{macro}{\FN@fnsymbol@wiley}
2219 % \begin{macro}{\FN@fnsymbol@lamport-robust}
2220 % \begin{macro}{\FN@fnsymbol@lamport}
2221 % These macros provide replacement orderings (and symbol sets) for
2222 % footnote symbols, plus a robust version of the original Lamport set,
2223 % and an extended version of Lamport's original
2224 % \begin{macrocode}
2225 \DefineFNsymbolsTM*{bringhurst}{%
2226 \textasteriskcentered *
2227 \textdagger \dagger
2228 \textdaggerdbl \ddagger
2229 \textsection \mathsection
2230 \textbardbl \|%
2231 \textparagraph \mathparagraph
2232 }%
2233 \DefineFNsymbolsTM*{chicago}{%
2234 \textasteriskcentered *
2235 \textdagger \dagger
2236 \textdaggerdbl \ddagger
2237 \textsection \mathsection
2238 \textbardbl \|%
2239 \#\#%
2240 }%
2241 \DefineFNsymbolsTM*{wiley}{
2242 \textasteriskcentered *
2243 {\textasteriskcentered\textasteriskcentered}{**}%
2244 \textdagger \dagger
2245 \textdaggerdbl \ddagger
2246 \textsection \mathsection
2247 \textparagraph \mathparagraph
2248 \textbardbl \|%
2249 }%
2250 \DefineFNsymbolsTM{lamport-robust}{
2251 \textasteriskcentered *
2252 \textdagger \dagger
2253 \textdaggerdbl \ddagger
2254 \textsection \mathsection
2255 \textparagraph \mathparagraph
2256 \textbardbl \|%
2257 {\textasteriskcentered\textasteriskcentered}{**}%
2258 {\textdagger\textdagger}{\dagger\dagger}%
2259 {\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger}%
2260 }
2261 \DefineFNsymbolsTM*{lamport*}{%
2262 \textasteriskcentered *
2263 \textdagger \dagger
2264 \textdaggerdbl \ddagger
2265 \textsection \mathsection
2266 \textparagraph \mathparagraph
2267 \textbardbl \|%
2268 {\textasteriskcentered\textasteriskcentered}{**}%
2269 {\textdagger\textdagger}{\dagger\dagger}%
2270 {\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger}%
2271 {\textsection\textsection}{\mathsection\mathsection}%
2272 {\textparagraph\textparagraph}{\mathparagraph\mathparagraph}%
2273 {\textasteriskcentered\textasteriskcentered\textasteriskcentered}{***}%
2274 {\textdagger\textdagger\textdagger}{\dagger\dagger\dagger}%
2275 {\textdaggerdbl\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger\ddagger}%
2276 {\textsection\textsection\textsection}%%
2277 {\mathsection\mathsection\mathsection}%
2278 {\textparagraph\textparagraph\textparagraph}%%
2279 {\mathparagraph\mathparagraph\mathparagraph}%
2280 }
2281 \setfnsymbol{lamport*}
2282 \DefineFNsymbolsTM{lamport*-robust}{%
2283 \textasteriskcentered *
2284 \textdagger \dagger
2285 \textdaggerdbl \ddagger
2286 \textsection \mathsection
2287 \textparagraph \mathparagraph
2288 \textbardbl \|%
2289 {\textasteriskcentered\textasteriskcentered}{**}%
2290 {\textdagger\textdagger}{\dagger\dagger}%
2291 {\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger}%
2292 {\textsection\textsection}{\mathsection\mathsection}%
2293 {\textparagraph\textparagraph}{\mathparagraph\mathparagraph}%
2294 {\textasteriskcentered\textasteriskcentered\textasteriskcentered}{***}%
2295 {\textdagger\textdagger\textdagger}{\dagger\dagger\dagger}%
2296 {\textdaggerdbl\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger\ddagger}%
2297 {\textsection\textsection\textsection}%%
2298 {\mathsection\mathsection\mathsection}%
2299 {\textparagraph\textparagraph\textparagraph}%%
2300 {\mathparagraph\mathparagraph\mathparagraph}%
2301 }
2302 % \end{macrocode}
2303 % \end{macro}
2304 % \end{macro}
2305 % \end{macro}
2306 % \end{macro}
2307 % \end{macro}
2308 %
2309 % \section{Other miscellaneous commands}
2310 %
2311 % \subsection{Footnote references}
2312 %
2313 % \begin{macro}{\footref}
2314 % Syntax: \cs{footref}\marg{label-name}
2315 %
2316 % One often wishes to refer to a footnote; in some circumstances,
2317 % \cs{footnotemark} just isn't good enough (for example, inside a
2318 % |minipage|, when \cs{footnotemark} creates a reference to footnotes
2319 % outside the minipage).
2320 %
2321 % \cs{footref} addresses this problem by making a label reference that
2322 % actually looks like a \cs{footnotemark}. (The command is available
2323 % in the |memoir| class, and we therefore \cs{providecommand} it
2324 % rather than defining it ``outright''.)
2325 % \begin{macrocode}
2326 \providecommand*{\footref}[1]{%
2327 \begingroup
2328 \unrestored@protected@xdef\@thefnmark{\ref{#1}}%
2329 \endgroup
2330 \@footnotemark
2331 }
2332 % \end{macrocode}
2333 % \end{macro}
2334 %
2335 % \subsection{Minipage \cs{footnotemark}s}
2336 %
2337 % \begin{macro}{\mpfootnotemark}
2338 % Syntax: \cs{mpfootnotemark}\oarg{number}
2339 %
2340 % Here we define \cs{mpfootnotemark}, which has the same syntax as
2341 % \cs{footnotemark}, and which applies the semantics of
2342 % \cs{footnotemark} to the minipage footnote series.
2343 % \begin{macrocode}
2344 \newcommand\mpfootnotemark{%
2345 \@ifnextchar[%
2346 \@xmpfootnotemark
2347 {%
2348 \stepcounter\@mpfn
2349 \protected@xdef\@thefnmark{\thempfn}%
2350 \@footnotemark
2351 }%
2352 }
2353 \def\@xmpfootnotemark[#1]{%
2354 \begingroup
2355 \csname c@\@mpfn\endcsname #1\relax
2356 \unrestored@protected@xdef\@thefnmark{\thempfn}%
2357 \endgroup
2358 \@footnotemark
2359 }
2360 % \end{macrocode}
2361 % \end{macro}
2362 %
2363 % \begin{macrocode}
2364 \endinput
2365 %</package>
2366 % \end{macrocode}
2367 %
2368 % \Finale
2369 %
2370 %
2371 %% \CharacterTable
2372 %% {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
2373 %% 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
2374 %% Digits \0\1\2\3\4\5\6\7\8\9
2375 %% Exclamation \! Double quote \" Hash (number) \#
2376 %% Dollar \$ Percent \% Ampersand \&
2377 %% Acute accent \' Left paren \( Right paren \)
2378 %% Asterisk \* Plus \+ Comma \,
2379 %% Minus \- Point \. Solidus \/
2380 %% Colon \: Semicolon \; Less than \<
2381 %% Equals \= Greater than \> Question mark \?
2382 %% Commercial at \@ Left bracket \[ Backslash \\
2383 %% Right bracket \] Circumflex \^ Underscore \_
2384 %% Grave accent \` Left brace \{ Vertical bar \|
2385 %% Right brace \} Tilde \~}