| 1 |
% \iffalse |
| 2 |
%% |
| 3 |
%% File: footbib.dtx Copyright (C) 1997-2010 Eric Domenjoud |
| 4 |
%% |
| 5 |
%% Eric Domenjoud, |
| 6 |
%% LORIA/CNRS |
| 7 |
%% E-mail: [email protected] |
| 8 |
%% |
| 9 |
% This program may be distributed and/or modified under the |
| 10 |
% conditions of the LaTeX Project Public License, either version 1.2 |
| 11 |
% of this license or (at your option) any later version. |
| 12 |
% The latest version of this license is in |
| 13 |
% http://www.latex-project.org/lppl.txt |
| 14 |
% and version 1.2 or later is part of all distributions of LaTeX |
| 15 |
% version 1999/12/01 or later. |
| 16 |
% |
| 17 |
% This program consists of the files footbib.dtx and footbib.ins |
| 18 |
|
| 19 |
\def\fileversion{2.0.7} |
| 20 |
\def\filedate{2007/02/20} |
| 21 |
%<*driver> |
| 22 |
%% |
| 23 |
%% To produce the documentation, do the following: |
| 24 |
%% |
| 25 |
%% latex footbib.dtx |
| 26 |
%% latex footbib.dtx |
| 27 |
%% makeindex -s gind.ist footbib.idx -o footbib.ind |
| 28 |
%% makeindex -s gglo.ist footbib.glo -o footbib.gls |
| 29 |
%% latex footbib.dtx |
| 30 |
%% |
| 31 |
%% In case makeindex does not find the style files gind.ist and gglo.ist, |
| 32 |
%% either set the environment variable INDEXSTYLE to the path where these |
| 33 |
%% files reside or use the full path in the commands above. |
| 34 |
%% |
| 35 |
\documentclass{ltxdoc} |
| 36 |
%\DisableCrossrefs % uncomment when index is ready |
| 37 |
\CodelineIndex |
| 38 |
\RecordChanges |
| 39 |
%\OnlyDescription % comment out for implementation details |
| 40 |
%\OldMakeindex % use if your MakeIndex is pre-v2.9 |
| 41 |
|
| 42 |
\title{The \textsf{footbib} package\thanks{This file has version |
| 43 |
number \fileversion, last revised \filedate.}} |
| 44 |
\author{Eric Domenjoud\\[email protected]} |
| 45 |
\date{\filedate} |
| 46 |
|
| 47 |
\hfuzz=20pt |
| 48 |
\begin{document} |
| 49 |
\DocInput{footbib.dtx} |
| 50 |
\end{document} |
| 51 |
%</driver> |
| 52 |
% \fi |
| 53 |
% |
| 54 |
% \CheckSum{2069} |
| 55 |
% |
| 56 |
% \CharacterTable |
| 57 |
% {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 |
| 58 |
% 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 |
| 59 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 60 |
% Exclamation \! Double quote \" Hash (number) \# |
| 61 |
% Dollar \$ Percent \% Ampersand \& |
| 62 |
% Acute accent \' Left paren \( Right paren \) |
| 63 |
% Asterisk \* Plus \+ Comma \, |
| 64 |
% Minus \- Point \. Solidus \/ |
| 65 |
% Colon \: Semicolon \; Less than \< |
| 66 |
% Equals \= Greater than \> Question mark \? |
| 67 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 68 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 69 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 70 |
% Right brace \} Tilde \~} |
| 71 |
% |
| 72 |
% \DoNotIndex{\',\+,\-,\.,\:,\<,\=,\>,\?,\^,\`,\~,\,,\@MM,\@Mii} |
| 73 |
% \DoNotIndex{\@Miii,\@addmarginpar,\@addtocurcol,\@botlist,\@bsphack,\@cclv} |
| 74 |
% \DoNotIndex{\@colht,\@colroom,\@combinefloats,\@currbox,\@currlist} |
| 75 |
% \DoNotIndex{\@dbldeferlist,\@dblfloatplacement,\@dbltoplist,\@deferlist} |
| 76 |
% \DoNotIndex{\@doclearpage,\@ehb,\@empty,\@esphack,\@finalstrut,\@firstofone} |
| 77 |
% \DoNotIndex{\@firstoftwo,\@for,\@freelist,\@gobble,\@holdpg,\@ifnextchar} |
| 78 |
% \DoNotIndex{\@ifpackagelater,\@ifstar,\@ifundefined,\@input,\@kludgeins} |
| 79 |
% \DoNotIndex{\@latexbug,\@latexerr,\@m,\@M,\@makecol,\@makefcolumn} |
| 80 |
% \DoNotIndex{\@makeother,\@makespecialcolbox,\@maxdepth,\@midlist,\@nameuse} |
| 81 |
% \DoNotIndex{\@ne,\@next,\@nil,\@nnil,\@onlypreamble,\@opcol,\@outputbox} |
| 82 |
% \DoNotIndex{\@outputpage,\@pagedp,\@pageht,\@parboxrestore,\@reinserts} |
| 83 |
% \DoNotIndex{\@specialoutput,\@tempa,\@tempb} |
| 84 |
% \DoNotIndex{\@tempboxa,\@tempdima,\@tempswafalse,\@tempswatrue,\@textbottom} |
| 85 |
% \DoNotIndex{\@texttop,\@toplist,\@undefined,\@whilesw,\active,\addpenalty} |
| 86 |
% \DoNotIndex{\advance,\afterassignment,\begingroup,\bfseries,\bigskipamount} |
| 87 |
% \DoNotIndex{\box,\boxmaxdepth,\c@fb,\catcode,\clearpage,\color@begingroup} |
| 88 |
% \DoNotIndex{\color@endgroup,\columnwidth,\count,\count@,\csname} |
| 89 |
% \DoNotIndex{\CurrentOption,\deadcycles,\DeclareOption,\DeclareRobustCommand} |
| 90 |
% \DoNotIndex{\def,\dimen} |
| 91 |
% \DoNotIndex{\dimen@,\do,\dp,\edef,\else,\end,\endcsname,\endgroup,\endinput} |
| 92 |
% \DoNotIndex{\ExecuteOptions,\expandafter,\fi,\floatingpenalty,\footins} |
| 93 |
% \DoNotIndex{\footnotesize,\gdef,\GenericError,\global,\hbox,\hfil,\hrule} |
| 94 |
% \DoNotIndex{\hsize,\hskip,\ht,\if@fcolmade,\if@filesw,\if@firstcolumn} |
| 95 |
% \DoNotIndex{\if@nobreak,\if@tempswa,\if@twocolumn,\ifdim,\iffalse,\ifnum} |
| 96 |
% \DoNotIndex{\ifodd,\ifvbox,\ifvoid,\ifx,\ignorespaces,\immediate} |
| 97 |
% \DoNotIndex{\input,\inputlineno,\insert,\interfootnotelinepenalty} |
| 98 |
% \DoNotIndex{\interlinepenalty,\jobname,\kern,\lastbox,\lccode,\leftskip} |
| 99 |
% \DoNotIndex{\let,\long,\lowercase,\maxdepth,\maxdimen,\meaning} |
| 100 |
% \DoNotIndex{\MessageBreak,\NeedsTeXFormat,\newcommand,\newcount,\newdimen} |
| 101 |
% \DoNotIndex{\newif,\newinsert,\newtoks,\newwrite,\nobreak,\noexpand} |
| 102 |
% \DoNotIndex{\normalcolor,\normalfont,\outputpenalty,\p@,\PackageError} |
| 103 |
% \DoNotIndex{\PackageWarning,\par,\penalty,\ProcessOptions,\ProvidesPackage} |
| 104 |
% \DoNotIndex{\relax,\renewcommand,\reset@font,\rule,\scriptspace,\setbox} |
| 105 |
% \DoNotIndex{\settowidth,\skip,\space,\splitmaxdepth,\splittopskip,\string} |
| 106 |
% \DoNotIndex{\strutbox,\textheight,\textsuperscript,\the,\thepage,\toks@} |
| 107 |
% \DoNotIndex{\unhbox,\unskip,\unvbox} |
| 108 |
% \DoNotIndex{\vbox,\vfil,\vskip,\vsplit,\wd,\write,\xdef,\z@} |
| 109 |
% |
| 110 |
%\makeatletter |
| 111 |
% \newcommand\SpecialNonMacroIndex[2]{^^A |
| 112 |
% \@bsphack\index{#2\actualchar{\protect\ttfamily#2} (#1)\encapchar usage}^^A |
| 113 |
% \index{#1s:\levelchar{\protect\ttfamily#2}\encapchar usage}\@esphack} |
| 114 |
% \newcommand\SpecialMainNonMacroIndex[2]{^^A |
| 115 |
% \@bsphack\special@index{#2\actualchar{\string\ttfamily\space#2} |
| 116 |
% (#1)\encapchar main}^^A |
| 117 |
% \index{#1s:\levelchar{\protect\ttfamily#2}\encapchar main}\@esphack} |
| 118 |
% \newcommand*\NonM@cro@[1]{\m@cro@\iffalse{#1}^^A |
| 119 |
% \let\SpecialMainEnvIndex\fb@tmp\ignorespaces} |
| 120 |
% \newenvironment{NonMacro}[1]{\let\fb@tmp\SpecialMainEnvIndex |
| 121 |
% \def\SpecialMainEnvIndex{\SpecialMainNonMacroIndex{#1}}^^A |
| 122 |
% \begingroup\@makeother\\\MakePrivateLetters\NonM@cro@} |
| 123 |
% {\endenvironment} |
| 124 |
% \newcommand\DescribeNonMacro[2]{^^A |
| 125 |
% {\def\SpecialEnvIndex{\SpecialNonMacroIndex{#1}}\DescribeEnv{#2}}} |
| 126 |
% \newcommand\newNonMacro[1]{\@newnonmacro#1\@nil} |
| 127 |
% \def\@newnonmacro#1#2\@nil{\uppercase{\@@newnonmacro{#1}}{#1}{#2}} |
| 128 |
% \newcommand\@@newnonmacro[3]{^^A |
| 129 |
% \newenvironment{#2#3}{\NonMacro{#2#3}}{\endNonMacro}^^A |
| 130 |
% \@namedef{Special#1#3Index}{\SpecialNonMacroIndex{#2#3}}^^A |
| 131 |
% \@namedef{SpecialMain#1#3Index}{\SpecialMainNonMacroIndex{#2#3}}^^A |
| 132 |
% \@namedef{Describe#1#3}{\DescribeNonMacro{#2#3}}} |
| 133 |
% \newNonMacro{option} |
| 134 |
% \newNonMacro{package} |
| 135 |
% \newcommand\Index[2]{^^A |
| 136 |
% \SortIndex{#1 #2}{#1 #2\encapchar usage}^^A |
| 137 |
% \SortIndex{#2}{#2\levelchar#1 \string\*\encapchar usage}} |
| 138 |
% \newcommand*\EndVerbChar{/} |
| 139 |
% \begingroup |
| 140 |
% \catcode`^=\active |
| 141 |
% \gdef\IndexSetup{\catcode\expandafter`\EndVerbChar=\active\begingroup |
| 142 |
% \lccode`^=\expandafter`\verbatimchar\lccode`~=\expandafter`\EndVerbChar |
| 143 |
% \lowercase{\endgroup\def~{^\verbmeta}\def\verbmeta##1{\meta{##1}\verb*^}}} |
| 144 |
% \endgroup |
| 145 |
% \newcommand*\VerbSetup[1]{\begingroup\lccode`\~=\expandafter`\EndVerbChar |
| 146 |
% \lowercase{\let~\meta#1}\endgroup} |
| 147 |
% \newcommand\Fb@Index[2]{\addvspace{-\lastskip}\VerbSetup{#1{#2}}^^A |
| 148 |
% \vskip-\MacrocodeTopsep\leavevmode} |
| 149 |
% \newcommand\FbIndex{\Fb@Index\SpecialIndex} |
| 150 |
% \newcommand\FbMainIndex{\Fb@Index\SpecialMainIndex} |
| 151 |
% \newenvironment{FbPatch}[1] |
| 152 |
% {\vskip-\MacrocodeTopsep$\setbox\z@\hbox{$\braceld\m@th$}^^A |
| 153 |
% \braceld\leaders\vrule \@height\ht\z@ \@depth\z@\hfill |
| 154 |
% \lower.5ex\hbox{\kern1em{\tt footbib} #1\kern1em}^^A |
| 155 |
% \leaders\vrule\@height\ht\z@\@depth\z@\hfill\bracerd\m@th$^^A |
| 156 |
% \nobreak\vskip-\MacrocodeTopsep\nobreak} |
| 157 |
% {\nobreak\vskip-\MacrocodeTopsep$\setbox\z@\hbox{$\braceld\m@th$}^^A |
| 158 |
% \bracelu\leaders\vrule\@height\ht\z@\@depth\z@\hfill\braceru\m@th$^^A |
| 159 |
% \nobreak\vskip-\MacrocodeTopsep} |
| 160 |
%\makeatother |
| 161 |
% |
| 162 |
% \newcommand\LATEX{({\let\TeX\relax\LaTeX})\TeX} |
| 163 |
% \maketitle |
| 164 |
% \setcounter{tocdepth}{2} |
| 165 |
% \tableofcontents |
| 166 |
% |
| 167 |
% \section{General overview} |
| 168 |
% |
| 169 |
% This package makes bibliographic references appear |
| 170 |
% as footnotes. It defines a command |\footcite| which is similar to |
| 171 |
% the |\cite| command of \LaTeX\ but the references cited in this way |
| 172 |
% are inserted at the bottom of the pages. This \emph{foot |
| 173 |
% bibliography} does not conflict with the standard one and both may |
| 174 |
% exist simultaneously in a document. The command |\cite| may still be |
| 175 |
% used to produce the standard bibliography. |
| 176 |
% |
| 177 |
% The foot bibliography uses its own style and bibliographic |
| 178 |
% database which are specified independently of the standard ones. |
| 179 |
% Any standard bibliography style may be used. If the style does not provide |
| 180 |
% explicit labels (e.g.~|plain|), the references are numbered. |
| 181 |
% The default is to number the references in the order in which they |
| 182 |
% appear in the |thebibliography| environment. This may be overridden through |
| 183 |
% options which allow the user to define a \emph{numbering |
| 184 |
% unit}\Index{numbering}{unit}. Then |
| 185 |
% the references will be numbered in the order in which they are |
| 186 |
% cited in the unit and the numbering restarts from 1 in each unit. |
| 187 |
% The numbering unit may be a page, a double page, a chapter, a part or |
| 188 |
% the whole document. Chapter and part may be used only if they are |
| 189 |
% defined by the document class. |
| 190 |
% |
| 191 |
% The user may also define a \emph{citation unit}\Index{citation}{unit} |
| 192 |
% which may be a page, a double page, a chapter, a part or the whole |
| 193 |
% document. The text of a reference will be inserted only once in |
| 194 |
% each citation unit, on the page where the first citation occurs in |
| 195 |
% the unit. |
| 196 |
% |
| 197 |
% The mechanism used to put a reference only once in each citation |
| 198 |
% unit may require several runs of \LaTeX\ (usually at least two) before the |
| 199 |
% references find their exact place. If necessary, \LaTeX\ will issue, near |
| 200 |
% the end of the document, a warning saying |
| 201 |
% \begin{center} |
| 202 |
% |Package footbib Warning: Bibliography not yet stable. Rerun LaTeX.| |
| 203 |
% \end{center} |
| 204 |
% |
| 205 |
% Using |footbib| in a document \meta{doc}|.tex| produces a file |
| 206 |
% \meta{doc}|.fb.aux|. One must pass the argument \meta{doc}|.fb| to \BibTeX\ |
| 207 |
% to produce the bibliography which will be put in the file |
| 208 |
% \meta{doc}|.fb.bbl|. The exact sequence of commands is |
| 209 |
% \begin{trivlist}\leftskip=\leftmargini\parindent=0pt\item[] |
| 210 |
% |latex|~\meta{doc}\\ |
| 211 |
% |bibtex|~\meta{doc}|.fb|\\ |
| 212 |
% |latex|~\meta{doc}\\ |
| 213 |
% |latex|~\meta{doc}\\ |
| 214 |
% \dots |
| 215 |
% \end{trivlist} |
| 216 |
% |
| 217 |
% \begin{description} |
| 218 |
% \item[Note:] The name \meta{doc}|.fb.aux| might cause some |
| 219 |
% problem on systems which do not allow a double extension in |
| 220 |
% a file name or put a limit on the length of file names. |
| 221 |
% A user command is provided to change it (see section~\ref{sec:custom}). |
| 222 |
% \end{description} |
| 223 |
% |
| 224 |
% At the beginning of the document, |footbib| inputs the bibliography |
| 225 |
% from the file \meta{doc}|.fb.bbl| (or the name given by the |
| 226 |
% user). If one wants to include the |thebibliography| |
| 227 |
% environment\SpecialEnvIndex{thebibliography} in the main document, |
| 228 |
% this may be done with a |filecontents| |
| 229 |
% environment\SpecialEnvIndex{filecontents} before the |
| 230 |
% |\documentclass| command. See the \LaTeXe\ documentation for more |
| 231 |
% details about this environment. |
| 232 |
% |
| 233 |
% \section{User interface} |
| 234 |
% |
| 235 |
% \subsection{Package options} |
| 236 |
% |
| 237 |
% \subsubsection{\texttt{oneside}/\texttt{twoside}} |
| 238 |
% \DescribeOption{oneside}^^A |
| 239 |
% \DescribeOption{twoside}^^A |
| 240 |
% The |oneside| and |twoside| options affect the behaviour |
| 241 |
% of |footbib| when either unit (citation or numbering) is |
| 242 |
% the page. In |oneside| mode, the actual unit is a single |
| 243 |
% page while in |twoside| mode, the unit is a double page. These |
| 244 |
% options may be used to override a global |oneside| or |
| 245 |
% |twoside| option. |
| 246 |
% |
| 247 |
% \subsubsection{\texttt{citeonce}{\normalfont[\texttt*]}} |
| 248 |
% \DescribeOption{citeonce}^^A |
| 249 |
% \DescribeOption{citeonce*}^^A |
| 250 |
% The |citeonce| option overrides the default \emph{citation |
| 251 |
% unit}\Index{citation}{unit}. |footbib| puts the text of a |
| 252 |
% reference only once in each citation unit which may be a |
| 253 |
% (double) page, a chapter, a part or the whole document. The |
| 254 |
% default citation unit is the page in |oneside| mode and the |
| 255 |
% double page in |twoside| mode. The new citation unit (|chapter|, |
| 256 |
% |part| or |document|) is given as an optional argument |
| 257 |
% between parentheses (|citeonce(chapter)|, |citeonce(part)| |
| 258 |
% or |citeonce(document)|). If no argument is supplied, |
| 259 |
% |document| is assumed. The argument |chapter| (resp.~|part|) |
| 260 |
% may be used only if the document class defines |\chapter| |
| 261 |
% (resp.~|\part|). The argument |page| may also be used but has a |
| 262 |
% somehow special meaning. It defines a |
| 263 |
% citation unit which is not overridden by another |citeonce| option |
| 264 |
% but instead has a cumulative effect. For instance if one says |
| 265 |
%\begin{verbatim} |
| 266 |
% \usepackage[twoside,citeonce(page),citeonce(chapter)]{footbib} |
| 267 |
%\end{verbatim} |
| 268 |
% then each double page and also each |\chapter| command starts a new |
| 269 |
% citation unit. This may be useful if one wants a chapter to |
| 270 |
% start a new unit even if it starts on a right page. |
| 271 |
% It is only meaningful in |twoside| mode in conjunction with |
| 272 |
% another |citeonce| option. In all other cases, it has no effect. |
| 273 |
% |
| 274 |
% The |citeonce| option has a star form |citeonce*| with the same |
| 275 |
% optional argument. When the star form is used, for each subsequent |
| 276 |
% citation of a reference in the same citation unit but on another |
| 277 |
% (double) page, the text of the reference is not omitted but |
| 278 |
% replaced with a cross reference to the first citation in the |
| 279 |
% same citation unit. The |page| argument is not available since it |
| 280 |
% would have no effect. |
| 281 |
% |
| 282 |
% \subsubsection{\texttt{firstcite}} |
| 283 |
% \DescribeOption{firstcite}^^A |
| 284 |
% The |firstcite| option affects the way the references are |
| 285 |
% labelled. When the bibliography style does not provide |
| 286 |
% explicit labels, the references are numbered. The default |
| 287 |
% is to assign to each reference a \emph{static} |
| 288 |
% label\Index{static}{label} |
| 289 |
% which is its order in the |thebibliography| environment. |
| 290 |
% The label is then the same for all citations of a |
| 291 |
% given reference. The |firstcite| option causes the |
| 292 |
% references to be numbered dynamically\Index{dynamic}{label} |
| 293 |
% according to the order of their first citations. |firstcite| |
| 294 |
% takes an optional argument between parentheses |
| 295 |
% |firstcite(|\meta{unit}|)| which defines the |
| 296 |
% \emph{numbering unit}\Index{numbering}{unit}. |
| 297 |
% The numbering restarts then from 1 in each numbering unit. |
| 298 |
% The argument \meta{unit} may take the value |page|, |
| 299 |
% |chapter|, |part| |
| 300 |
% or |document|. If |page| is used, then the numbering |
| 301 |
% unit is a page in |oneside| mode and a double page in |
| 302 |
% |twoside| mode. If no argument is supplied, |document| is |
| 303 |
% assumed. |
| 304 |
% |
| 305 |
% The effect of several |firstcite| options is cumulative in |
| 306 |
% the sense that if one says for instance |
| 307 |
%\begin{verbatim} |
| 308 |
% \usepackage[twoside,firstcite(page),firstcite(chapter)]{footbib} |
| 309 |
%\end{verbatim} |
| 310 |
% \noindent then each double page \emph{and} each |\chapter| command |
| 311 |
% starts a new numbering unit. This means that a |\chapter| |
| 312 |
% command starts a new numbering unit even if it is on a right page. |
| 313 |
% |
| 314 |
% If the bibliography style provides explicit |
| 315 |
% labels, the |firstcite| option has no effect. |
| 316 |
% |
| 317 |
% \subsubsection{{\normalfont\texttt{crossrefs}[\texttt*]} and |
| 318 |
% \texttt{nocrossrefs}} |
| 319 |
% \DescribeOption{crossrefs}^^A |
| 320 |
% \DescribeOption{crossrefs*}^^A |
| 321 |
% \DescribeOption{nocrossrefs}^^A |
| 322 |
% When an entry in the bibliographic database contains a |
| 323 |
% |CROSSREF| field, \BibTeX\ includes the cross-referenced |
| 324 |
% entry in the bibliography and puts a |\cite| |
| 325 |
% command in the entry where the |CROSSREF| field occurs. |
| 326 |
% If no standard bibliography is produced, \LaTeX\ |
| 327 |
% will complain about an undefined reference. |
| 328 |
% One may generally inhibit this behaviour of \BibTeX\ by |
| 329 |
% invoking it with the |-min-crossrefs=|\meta{number} |
| 330 |
% option which tells how many times an entry must |
| 331 |
% be cross-referenced before it is included in the |
| 332 |
% bibliography and replaced with a |\cite| |
| 333 |
% command. Setting \meta{number} to a large value will |
| 334 |
% generally inhibit the cross-referencing mechanism. |
| 335 |
% However, this option has no effect if the |
| 336 |
% cross-referenced entry is explicitely cited in the |
| 337 |
% document. |
| 338 |
% |
| 339 |
% The |crossrefs| option of |footbib| solves this problem by |
| 340 |
% replacing each |\cite| command in a foot reference with |
| 341 |
% |\footcite| (see the description of this command below). |
| 342 |
% The star form |crossrefs*| replaces the |
| 343 |
% |\cite| command with a |\footcite*|, which means that |
| 344 |
% the text of the reference is not inserted. It is then the |
| 345 |
% responsibility of the user to insert the text in the right |
| 346 |
% place with a |\footnocite| command. Of course, standard |
| 347 |
% citation through |\cite| is not possible anymore in a foot |
| 348 |
% reference when either form of this option is used. |
| 349 |
% |
| 350 |
% A |nocrossrefs| option is also provided to inhibit this |
| 351 |
% behaviour in case it is not wanted but |crossrefs| occurs |
| 352 |
% in the global options. |
| 353 |
% |
| 354 |
% \subsubsection{{\normalfont\texttt{split}} and \texttt{nosplit}} |
| 355 |
% \DescribeOption{split}^^A |
| 356 |
% \DescribeOption{nosplit}^^A |
| 357 |
% The |nosplit| option tells |footbib| not to split the references |
| 358 |
% across pages. The |split| option allows references to be |
| 359 |
% split. |split| is the default and exists only to allow the |
| 360 |
% user to override a global |nosplit| option. |
| 361 |
% |
| 362 |
% \subsection{Commands to generate the foot bibliography} |
| 363 |
% \begin{list}{}{\leftmargin=0pt \labelsep=0pt} |
| 364 |
% \item[] \DescribeMacro{\footbibliography} |
| 365 |
% |\footbibliography{|\meta{file}|,|\meta{file}|,|\dots|}|\\ |
| 366 |
% Defines the list of bibliographic databases for the foot |
| 367 |
% bibliography. This command has the same syntax as the |
| 368 |
% |\bibliography| command of \LaTeX. |
| 369 |
% \item[] \DescribeMacro{\footbibliographystyle}\leavevmode\noindent |
| 370 |
% |\footbibliographystyle{|\meta{style}|}|\\ |
| 371 |
% Defines the style of the foot bibliography. This command has |
| 372 |
% the same syntax as |
| 373 |
% the |\bibliographystyle| command of \LaTeX. |
| 374 |
% \item[] \DescribeMacro{\footcite}\noindent |
| 375 |
% |\footcite{|\meta{key}|,|\meta{key}|,|\dots|}|\\ |
| 376 |
% Puts the list of labels in the text and the text of the |
| 377 |
% references at the bottom of the page. The text of each |
| 378 |
% reference is inserted at most once in a citation unit, |
| 379 |
% even if it is cited several times. |
| 380 |
% \item[] \DescribeMacro{\footcite*}\noindent |
| 381 |
% |\footcite*{|\meta{key}|,|\meta{key}|,|\dots|}|\\ |
| 382 |
% Puts the list of labels in the text but does not put the |
| 383 |
% reference at the bottom of the page. |
| 384 |
% \item[] \DescribeMacro{\footnocite}\noindent |
| 385 |
% |\footnocite{|\meta{key}|,|\meta{key}|,|\dots|}|\\ |
| 386 |
% Puts the reference at the bottom of the page but puts |
| 387 |
% nothing in the text. |
| 388 |
% \end{list} |
| 389 |
% \begin{description} |
| 390 |
% \item[Note:] The main purpose of the commands |\footcite*| and |
| 391 |
% |\footnocite| is to solve the problem of a |
| 392 |
% |\footcite| occuring inside an environment where the |
| 393 |
% reference will be lost (for instance in a |minipage| or |
| 394 |
% |tabular| environment, in a |\mbox|, etc.). In this case, |
| 395 |
% if the reference is not cited otherwise on the same page, it |
| 396 |
% won't show up at the bottom of the page. It suffices to add |
| 397 |
% a |\footnocite| command just before or after this environment. |
| 398 |
% The command |\footcite{|\meta{key}|}| is more or less (but |
| 399 |
% not completely) equivalent to |
| 400 |
% |\footcite*{|\meta{key}|}\footnocite{|\meta{key}|}|. |
| 401 |
% \end{description} |
| 402 |
% |
| 403 |
% \subsection{Customisation}\label{sec:custom} |
| 404 |
% |
| 405 |
% \begin{list}{}{\leftmargin=0pt \labelsep=0pt} |
| 406 |
% \item[] \DescribeMacro{\footbibliographyname} |
| 407 |
% The basename of the |.aux| and |.bbl| files used for the |
| 408 |
% foot bibliography may be redefined by |
| 409 |
% |
| 410 |
% \qquad |\footbibliographyname{|\meta{name}|}| |
| 411 |
% |
| 412 |
% The default value is |
| 413 |
% |\jobname.fb|\footnote{\texttt{\string\jobname} is a |
| 414 |
% primitive \TeX\ command which holds the name of the main |
| 415 |
% document.} which causes |footbib| to read the bibliography |
| 416 |
% from |
| 417 |
% |\jobname.fb.bbl| and to use |\jobname.fb.aux| as an |
| 418 |
% auxiliary file. This command may be used only in the preamble. |
| 419 |
% The name supplied to |\footbibliographyname| must be |
| 420 |
% different from the name of the main document. |
| 421 |
% \item[] \DescribeMacro{\footcitelabel}^^A |
| 422 |
% \DescribeMacro{\putfootcitelabel}^^A |
| 423 |
% \DescribeMacro{\footcitelistformat}^^A |
| 424 |
% The list of citations in the text may not be typeset in |
| 425 |
% one step as done by the |\cite| command of \LaTeX. |
| 426 |
% The reason is that the command which creates the text of |
| 427 |
% the reference must be inserted after each citation. |
| 428 |
% The way \LATEX\ handles insertions makes |
| 429 |
% them vanish if they occur in a box. Hence if the command |
| 430 |
% which formats the list of citations puts them in a box, |
| 431 |
% the text is lost and the references do not show up at the |
| 432 |
% bottom of the page. All references could be inserted at |
| 433 |
% once, either before or after the list of citations but if |
| 434 |
% this list gets split across pages, the text of some |
| 435 |
% references could show up on the wrong page. Hence |
| 436 |
% the list is created one piece at a time and the text of |
| 437 |
% the corresponding reference is inserted after each |
| 438 |
% citation. The list of citation is created as follows: |
| 439 |
% \begin{tabbing} |
| 440 |
% \qquad\=1)~\=start of list\\ |
| 441 |
% \>2)\>for each citation:\\ |
| 442 |
% \>\>a)~if it is not the first one, separator of citations\\ |
| 443 |
% \>\>b)~label of the reference, to which |\footcitelabel| is applied\\ |
| 444 |
% \>\>c)~insertion of the text of the reference\\ |
| 445 |
% \>3)\>end of list |
| 446 |
% \end{tabbing} |
| 447 |
% The separator of citations is made of two parts: \meta{sep$_1$} and |
| 448 |
% \meta{sep$_2$}. |
| 449 |
% The command |\putfootcitelabel| is applied to each component of the |
| 450 |
% list, excepted \meta{sep$_2$} which is put as such. |
| 451 |
% Typically, \meta{sep$_2$} is a separator which may disappear at a line |
| 452 |
% break, like a penalty or some spacing. That's why |
| 453 |
% |\putfootcitelabel| is not applied to it so that it won't be put |
| 454 |
% in a box. The effect is as follows: |
| 455 |
% \begin{trivlist}\leftskip=\leftmargini\parindent=0pt\item[] |
| 456 |
% |\putfootcitelabel{|\meta{start of list}|}|\\ |
| 457 |
% |\putfootcitelabel{\footcitelabel{|\meta{label $1$}|}}|\\ |
| 458 |
% \meta{insertion of the text of reference $1$}\\ |
| 459 |
% |\putfootcitelabel{|\meta{sep$_1$}|}|\\ |
| 460 |
% \meta{sep$_2$}\\ |
| 461 |
% |\putfootcitelabel{\footcitelabel{|label $2$|}}|\\ |
| 462 |
% \meta{insertion of the text of reference $2$}\\ |
| 463 |
% |\putfootcitelabel{|\meta{sep$_1$}|}|\\ |
| 464 |
% \meta{sep$_2$}\\ |
| 465 |
% \null\quad\vdots\\ |
| 466 |
% |\putfootcitelabel{\footcitelabel{|label $n$|}}|\\ |
| 467 |
% \meta{insertion of the text of reference $n$}\\ |
| 468 |
% |\putfootcitelabel{|\meta{end of list}|}| |
| 469 |
% \end{trivlist} |
| 470 |
% |
| 471 |
% Each component of the list may be redefined as follows: |
| 472 |
% \begin{trivlist}\leftskip=\leftmargini\parindent=0pt\item[] |
| 473 |
% |\renewcommand*\footcitelabel[1]{|\dots|}|\\ |
| 474 |
% |\renewcommand*\putfootcitelabel[1]{|\dots|}|\\ |
| 475 |
% |\footcitelistformat|\meta{start of list}\meta{sep$_1$}^^A |
| 476 |
% \meta{sep$_2$}\meta{end of list} |
| 477 |
% \end{trivlist} |
| 478 |
% \end{list} |
| 479 |
% Here are some examples of the variations allowed by this mechanism. |
| 480 |
% \begin{description}\topsep=0pt |
| 481 |
% \item[example 1:]list of citations \emph{a la \LaTeX}: [label $1$, |
| 482 |
% label $2$, \dots] |
| 483 |
%\begin{verbatim*} |
| 484 |
%\renewcommand*\footcitelabel[1]{#1} |
| 485 |
%\renewcommand*\putfootcitelabel[1]{#1} |
| 486 |
%\footcitelistformat[,{\penalty1000\ }] |
| 487 |
%\end{verbatim*} |
| 488 |
% \item[example 2:]ditto but the list may not be cut\par |
| 489 |
% \leavevmode\quad\vdots |
| 490 |
%\begin{verbatim*} |
| 491 |
%\footcitelistformat[,{\nobreak\ }] |
| 492 |
%\end{verbatim*} |
| 493 |
% \item[example 3:] the list is raised and the labels are |
| 494 |
% separated only by commas, without any space: |
| 495 |
% \textsuperscript{\normalfont[label $1$,label $2$,\dots]} |
| 496 |
%\begin{verbatim*} |
| 497 |
%\renewcommand*\footcitelabel[1]{#1} |
| 498 |
%\renewcommand*\putfootcitelabel[1]{\textsuperscript{\normalfont#1}} |
| 499 |
%\footcitelistformat[,{\penalty1000\relax}] |
| 500 |
%\end{verbatim*} |
| 501 |
% \item[example 4:] ditto, but no brackets around the list of labels: |
| 502 |
% \textsuperscript{\normalfont label $1$,label $2$,\dots}\par |
| 503 |
% \leavevmode\quad\vdots |
| 504 |
%\begin{verbatim*} |
| 505 |
%\footcitelistformat{},{\penalty1000\relax}{} |
| 506 |
%\end{verbatim*} |
| 507 |
% \item[example 5:] [label $1$], [label $2$], \dots |
| 508 |
%\begin{verbatim*} |
| 509 |
%\renewcommand*\footcitelabel[1]{[#1]} |
| 510 |
%\renewcommand*\putfootcitelabel[1]{#1} |
| 511 |
%\footcitelistformat{},{\penalty1000\ }{} |
| 512 |
%\end{verbatim*} |
| 513 |
% \end{description} |
| 514 |
% The default definitions are the ones of example 3 above. |
| 515 |
% |
| 516 |
% \begin{list}{}{\leftmargin=0pt\labelsep=0pt} |
| 517 |
% \item[] \DescribeMacro{\footbibskip}^^A |
| 518 |
% \DescribeMacro{\footbibrule}^^A |
| 519 |
% The foot bibliography is |
| 520 |
% separated from the rest of the page by a vertical skip of |
| 521 |
% length |\footbibskip| in which a horizontal line is |
| 522 |
% drawn by the command |\footbibrule|. The height of the |
| 523 |
% skip and the horizontal |
| 524 |
% line may be redefined in the preamble by\par\medskip |
| 525 |
% {\leftskip=\leftmargini\parskip=0pt |
| 526 |
% |\setlength\footbibskip{|\dots|}|\par |
| 527 |
% |\renewcommand\footbibrule{|\dots|}|\par} |
| 528 |
% \textbf{CAUTION}~~|\footbibrule| must take zero vertical space. |
| 529 |
% \item[] \DescribeMacro{\footreflabel}^^A |
| 530 |
% The label of the reference is formated by the macro |
| 531 |
% |\footreflabel| which takes the label as argument. It |
| 532 |
% may be redefined by |\renewcommand*\footreflabel[1]{|\ldots|}|. |
| 533 |
% \item[] \DescribeMacro{\footrefstyle} |
| 534 |
% The label and the text of the reference at the bottom of |
| 535 |
% the page are typeset in the style defined by the command |
| 536 |
% |\footrefstyle| which may be redefined in the preamble by |
| 537 |
% |\renewcommad\footrefstyle{|\dots|}|. The default definition |
| 538 |
% is |\normalfont\footnotesize|. |
| 539 |
% \item[] \DescribeMacro{\footxref}^^A |
| 540 |
% The options |citeonce*(|\meta{unit}|)|\SpecialOptionIndex{citeonce*} |
| 541 |
% tells |footbib| to replace the text of each reference but the first |
| 542 |
% in each citation unit with a cross-reference to the last place where |
| 543 |
% the full text of the reference appeared. The text of the |
| 544 |
% cross-reference is generated by the command |\footxref| which takes |
| 545 |
% two arguments: (1)~the label and (2)~the page of the last full |
| 546 |
% citation. |\footxref| may be redefined in the preamble by |
| 547 |
% |
| 548 |
% \qquad |\renewcommand*\footxref[2]{|\dots|}|. |
| 549 |
% |
| 550 |
% \end{list} |
| 551 |
% |
| 552 |
% \section{Known and potential problems} |
| 553 |
% |
| 554 |
% \begin{list}{$\bullet$}{\settowidth\leftmargin{$\bullet$\hskip\labelsep}} |
| 555 |
% \item At present, the convergence is not proved. There is no guarantee |
| 556 |
% that the references eventually find their place. However, |
| 557 |
% |footbib| was used in large documents (several |
| 558 |
% hundreds pages) and such a problem never occured. |
| 559 |
% |
| 560 |
% \item The foot bibliography is not sorted. The references appear at the |
| 561 |
% bottom of the page in the order in which they are cited on the page. |
| 562 |
% |
| 563 |
% \item A |\footcite| command may not appear in a floating environment |
| 564 |
% like |figure| or |table|. |
| 565 |
% |
| 566 |
% \item If a float is inserted at the bottom of the page, the foot |
| 567 |
% bibliography is put \emph{above} it, like footnotes. |
| 568 |
% |
| 569 |
% \item The result is not very nice in |twocolumn| mode. |
| 570 |
% The references should be balanced between the two columns of the |
| 571 |
% page (if there are two) or put in the right column like the |
| 572 |
% package |ftnright|\SpecialPackageIndex{ftnright} of Frank |
| 573 |
% Mittelbach does for footnotes. |
| 574 |
% |
| 575 |
% \item |footbib| does not work with most packages which |
| 576 |
% modify the output routine of \LaTeX: |
| 577 |
% |multicol|\SpecialPackageIndex{multicol}, |
| 578 |
% |ftnright|\SpecialPackageIndex{ftnright}, |
| 579 |
% |floatflt|\SpecialPackageIndex{floatflt}, |
| 580 |
% |wrapfig|\SpecialPackageIndex{wrapfig}, etc. |
| 581 |
% |
| 582 |
% \item The references must not contain any |
| 583 |
% |verbatim|\SpecialEnvIndex{verbatim} environment. But |
| 584 |
% |\verb|\SpecialUsageIndex{\verb} is allowed since it is sometime used |
| 585 |
% to typeset filenames, \textsc{url}'s, etc. |
| 586 |
% |
| 587 |
% \item The braces must be balanced in the references, excepted the ones |
| 588 |
% that might occur inside the argument of a |\verb| |
| 589 |
% command\SpecialUsageIndex{\verb}. This implies that a reference |
| 590 |
% may not contain say |\hbox\bgroup|\dots|}| which is otherwise correct |
| 591 |
% in \LATEX. |
| 592 |
% |
| 593 |
% \item When references are numbered, the space between the label and |
| 594 |
% the reference itself may be too large because the |
| 595 |
% longest label is determined from the argument of |
| 596 |
% |\begin{thebibliography}{|\meta{longest label}|}| and its length |
| 597 |
% is used for all references. If all references on a page |
| 598 |
% have small numbers and the bibliography contains many references |
| 599 |
% (say more than 100), |
| 600 |
% this length is not reliable. The longest label should be deduced |
| 601 |
% from the maximal number of references on a page, |
| 602 |
% but this may not be known at the beginning of the document, at |
| 603 |
% least at the first run. At the second run, the |
| 604 |
% information could be deduces from what was written into the |.aux| file, |
| 605 |
% provided |
| 606 |
% the |\nofiles| command was not used (otherwise, the |.aux| file |
| 607 |
% was not written). When per page numbering is used (option |
| 608 |
% |firstcite(page)|), the longest label could also be simply initialised |
| 609 |
% to |99| which is not too large and should be enough. |
| 610 |
% \end{list} |
| 611 |
% |
| 612 |
% \StopEventually{\IndexSetup\PrintIndex\PrintChanges} |
| 613 |
% |
| 614 |
% \section{Implementation} |
| 615 |
% |
| 616 |
% \subsection{Identification} |
| 617 |
% \begin{macrocode} |
| 618 |
%<*package> |
| 619 |
\NeedsTeXFormat{LaTeX2e} |
| 620 |
\ProvidesPackage{footbib}[\filedate\space v\fileversion\space(E.Domenjoud)] |
| 621 |
% \end{macrocode} |
| 622 |
% |
| 623 |
% \subsection{Initial setup} |
| 624 |
% |
| 625 |
% Some badly behaved packages (written for \LaTeX\kern.15em2.09) change the |
| 626 |
% catcodes before the |
| 627 |
% beginning of the document and make some commands like |\@for| |
| 628 |
% unusable. The catcodes needed in the definitions are set here and |
| 629 |
% restored at the end of the package. |
| 630 |
% \begin{macrocode} |
| 631 |
\@makeother\` |
| 632 |
\edef\@tempa{\catcode\string`\string`\string=\the\catcode\string``\relax} |
| 633 |
\def\@tempb#1{\catcode`\noexpand#1\string=\the\catcode`#1\relax} |
| 634 |
\edef\@tempa{\@tempa |
| 635 |
\@tempb\:\@tempb\?\@tempb\=\@tempb\<\@tempb\>\@tempb\+\@tempb\-% |
| 636 |
\@tempb\.\@tempb\'\@tempb\~} |
| 637 |
\expandafter\AtEndOfPackage\expandafter{\@tempa} |
| 638 |
\@makeother\: \@makeother\? \@makeother\= \@makeother\< \@makeother\> |
| 639 |
\@makeother\+ \@makeother\- \@makeother\. \@makeother\' |
| 640 |
\catcode`\~=\active |
| 641 |
% \end{macrocode} |
| 642 |
% |
| 643 |
% \subsection{Test of the output routine} |
| 644 |
% |
| 645 |
% If the \LaTeXe\ format is more recent than the package, we test |
| 646 |
% whether the output routine changed. If so, a warning is issued |
| 647 |
% because the user might get unexpected results. The package should |
| 648 |
% work with all previous versions of \LaTeXe. |
| 649 |
% |
| 650 |
% When |docstrip| is used to extract the package, this code is included only |
| 651 |
% if the `|checkoutput|' flag is used in addition to `|package|'. |
| 652 |
% |
| 653 |
% \begin{macrocode} |
| 654 |
%<*checkoutput> |
| 655 |
\@ifpackagelater{footbib}\fmtversion\@tempswafalse\@tempswatrue |
| 656 |
\if@tempswa |
| 657 |
\def\@tempa#1#2{\def\@tempb{#2}\ifx#1\@tempb\else\@tempswatrue\fi} |
| 658 |
\@tempswafalse |
| 659 |
\@tempa\@specialoutput{\ifnum\outputpenalty>-\@Mii\@doclearpage\else |
| 660 |
\ifnum\outputpenalty<-\@Miii\ifnum\outputpenalty<-\@MM\deadcycles\z@ |
| 661 |
\fi\global\setbox\@holdpg\vbox{\unvbox\@cclv}\else\global\setbox |
| 662 |
\@holdpg\vbox{\unvbox\@holdpg\unvbox\@cclv\setbox\@tempboxa\lastbox |
| 663 |
\unskip}\@pagedp\dp\@holdpg\@pageht\ht\@holdpg\unvbox\@holdpg\@next |
| 664 |
\@currbox\@currlist{\ifnum\count\@currbox>\z@\advance\@pageht\@pagedp |
| 665 |
\ifvoid\footins\else\advance\@pageht\ht\footins\advance\@pageht\skip |
| 666 |
\footins\advance\@pageht\dp\footins\fi\ifvbox\@kludgeins\ifdim\wd |
| 667 |
\@kludgeins=\z@\advance\@pageht\ht\@kludgeins\fi\fi\@reinserts |
| 668 |
\@addtocurcol\else\@reinserts\@addmarginpar\fi}\@latexbug\ifnum |
| 669 |
\outputpenalty<\z@\if@nobreak\nobreak\else\addpenalty\interlinepenalty |
| 670 |
\fi\fi\fi\fi} |
| 671 |
\@tempa\@doclearpage{\ifvoid\footins\ifvbox\@kludgeins{\setbox\@tempboxa |
| 672 |
\box\@kludgeins}\fi\setbox\@tempboxa\vsplit\@cclv to\z@ |
| 673 |
\unvbox\@tempboxa\setbox\@tempboxa\box\@cclv\xdef\@deferlist{\@toplist |
| 674 |
\@botlist\@deferlist}\global\let\@toplist\@empty\global\let\@botlist |
| 675 |
\@empty\global\@colroom\@colht\ifx\@currlist\@empty\else\@latexerr |
| 676 |
{Float(s) lost}\@ehb\global\let\@currlist\@empty\fi\@makefcolumn |
| 677 |
\@deferlist\@whilesw\if@fcolmade\fi{\@opcol\@makefcolumn\@deferlist |
| 678 |
}\if@twocolumn\if@firstcolumn\xdef\@dbldeferlist{\@dbltoplist |
| 679 |
\@dbldeferlist}\global\let\@dbltoplist\@empty\global\@colht\textheight |
| 680 |
\begingroup\@dblfloatplacement\@makefcolumn\@dbldeferlist\@whilesw |
| 681 |
\if@fcolmade\fi{\@outputpage\@makefcolumn\@dbldeferlist}\endgroup\else |
| 682 |
\vbox{}\clearpage\fi\fi\else\setbox\@cclv\vbox{\box\@cclv\vfil}\@makecol |
| 683 |
\@opcol\clearpage\fi} |
| 684 |
\@tempa\@makecol{\ifvoid\footins\setbox\@outputbox\box\@cclv\else\setbox |
| 685 |
\@outputbox\vbox{\boxmaxdepth\@maxdepth\unvbox\@cclv |
| 686 |
\vskip\skip\footins\color@begingroup\normalcolor\footnoterule\unvbox |
| 687 |
\footins\color@endgroup}\fi\let\@elt\relax\xdef\@freelist{\@freelist |
| 688 |
\@midlist}\global\let\@midlist\@empty\@combinefloats\ifvbox\@kludgeins |
| 689 |
\@makespecialcolbox\else\setbox\@outputbox\vbox to\@colht{\@texttop\dimen@ |
| 690 |
\dp\@outputbox\unvbox\@outputbox\vskip-\dimen@\@textbottom}\fi\global |
| 691 |
\maxdepth\@maxdepth} |
| 692 |
\@tempa\@reinserts{\ifvoid\footins\else\insert\footins{\unvbox\footins}\fi |
| 693 |
\ifvbox\@kludgeins\insert\@kludgeins{\unvbox\@kludgeins}\fi} |
| 694 |
\fi |
| 695 |
\if@tempswa |
| 696 |
\PackageError{footbib}{the output routine of LaTeX changed} |
| 697 |
{The output routine of LaTeX changed since the current version of |
| 698 |
`footbib'.\MessageBreak Since `footbib' patches this routine, |
| 699 |
using it may produce unexpected\MessageBreak results. Send a mail to \space |
| 700 |
[email protected] \space to get a new version.\MessageBreak\MessageBreak |
| 701 |
Type \space X <return> \space to quit or cross your fingers and |
| 702 |
just type <return>.\MessageBreak} |
| 703 |
\fi |
| 704 |
%</checkoutput> |
| 705 |
% \end{macrocode} |
| 706 |
% |
| 707 |
% \subsection{Package Options} |
| 708 |
% |
| 709 |
% \subsubsection{Initial code} |
| 710 |
% |
| 711 |
% \begin{macro}{\iffb@twoside} |
| 712 |
% \begin{macro}{\iffb@citeonce} |
| 713 |
% \begin{macro}{\iffb@pagecite} |
| 714 |
% \begin{macro}{\fb@chaptercite} |
| 715 |
% \begin{macro}{\fb@partcite} |
| 716 |
% \begin{macro}{\iffb@firstcite} |
| 717 |
% \begin{macro}{\iffb@pagenum} |
| 718 |
% \begin{macro}{\fb@chapternum} |
| 719 |
% \begin{macro}{\fb@partnum} |
| 720 |
% \begin{macro}{\iffb@xref} |
| 721 |
% \begin{macro}{\iffb@crossrefs} |
| 722 |
% \begin{macro}{\iffb@xcrossrefs} |
| 723 |
% \begin{macro}{\iffb@nosplit} |
| 724 |
% First we define some switches which record the user options. The |
| 725 |
% switch |\iffb@twoside| is initialised from the current value of |
| 726 |
% |\if@twoside| because default global options are not passed to packages. |
| 727 |
% If one says |\documentclass{book}| then the document is in |
| 728 |
% |twoside|\SpecialOptionIndex{twoside} mode but the packages |
| 729 |
% \emph{don't know} it. |
| 730 |
% \begin{macrocode} |
| 731 |
\newif\iffb@twoside \let\iffb@twoside\if@twoside |
| 732 |
\newif\iffb@citeonce \fb@citeoncefalse |
| 733 |
\newif\iffb@pagecite \fb@pagecitefalse |
| 734 |
\let\fb@chaptercite\@empty |
| 735 |
\let\fb@partcite\@empty |
| 736 |
\newif\iffb@firstcite \fb@firstcitefalse |
| 737 |
\newif\iffb@pagenum \fb@pagenumfalse |
| 738 |
\let\fb@chapternum\@empty |
| 739 |
\let\fb@partnum\@empty |
| 740 |
\newif\iffb@xref \fb@xreffalse |
| 741 |
\newif\iffb@crossrefs \fb@crossrefsfalse |
| 742 |
\newif\iffb@xcrossrefs \fb@xcrossrefsfalse |
| 743 |
\newif\iffb@nosplit \fb@nosplitfalse |
| 744 |
% \end{macrocode} |
| 745 |
% \end{macro} |
| 746 |
% \end{macro} |
| 747 |
% \end{macro} |
| 748 |
% \end{macro} |
| 749 |
% \end{macro} |
| 750 |
% \end{macro} |
| 751 |
% \end{macro} |
| 752 |
% \end{macro} |
| 753 |
% \end{macro} |
| 754 |
% \end{macro} |
| 755 |
% \end{macro} |
| 756 |
% \end{macro} |
| 757 |
% \end{macro} |
| 758 |
% |
| 759 |
% \begin{macro}{\fb@checksec} |
| 760 |
% The macro |\fb@checksec| checks whether its first argument (a sectioning |
| 761 |
% command) is defined. If so, the second argument (a list of command) |
| 762 |
% is executed. Otherwise an error is raised and the second argument |
| 763 |
% is discarded. It is called while processing the options which must |
| 764 |
% patch a sectioning command. |
| 765 |
% \begin{macrocode} |
| 766 |
\newcommand\fb@checksec[2]{% |
| 767 |
\ifx#1\@undefined |
| 768 |
\PackageError{footbib}{Bad option `\CurrentOption'}% |
| 769 |
{{footbib}: The current document class does not define `\string#1'}% |
| 770 |
\else |
| 771 |
#2% |
| 772 |
\fi} |
| 773 |
% \end{macrocode} |
| 774 |
% \end{macro} |
| 775 |
% |
| 776 |
% \subsubsection{Declaration and processing of options} |
| 777 |
% {\MacroFont |
| 778 |
% \begin{option}{oneside} |
| 779 |
% \begin{option}{twoside} |
| 780 |
% \leavevmode\vspace{-1.2\baselineskip} |
| 781 |
% \begin{macrocode} |
| 782 |
\DeclareOption{oneside}{\fb@twosidefalse} |
| 783 |
\DeclareOption{twoside}{\fb@twosidetrue} |
| 784 |
% \end{macrocode} |
| 785 |
% \end{option} |
| 786 |
% \end{option} |
| 787 |
% \begin{option}{firstcite} |
| 788 |
% \leavevmode\vspace{-1.2\baselineskip} |
| 789 |
% \begin{macrocode} |
| 790 |
\DeclareOption{firstcite}{\fb@firstcitetrue} |
| 791 |
\DeclareOption{firstcite(page)}{\fb@firstcitetrue\fb@pagenumtrue} |
| 792 |
\DeclareOption{firstcite(chapter)}{\fb@firstcitetrue |
| 793 |
\fb@checksec\chapter{\def\fb@chapternum{\fb@newnumunit}}} |
| 794 |
\DeclareOption{firstcite(part)}{\fb@firstcitetrue |
| 795 |
\fb@checksec\part{\def\fb@partnum{\fb@newnumunit}}} |
| 796 |
\DeclareOption{firstcite(document)}{\fb@firstcitetrue} |
| 797 |
% \end{macrocode} |
| 798 |
% \end{option} |
| 799 |
% \begin{option}{citeonce} |
| 800 |
% \begin{option}{citeonce*} |
| 801 |
% \leavevmode\vspace{-1.2\baselineskip} |
| 802 |
% \begin{macrocode} |
| 803 |
\DeclareOption{citeonce}{\fb@citeoncetrue} |
| 804 |
\DeclareOption{citeonce(page)}{\fb@pagecitetrue} |
| 805 |
\DeclareOption{citeonce(chapter)}{\fb@citeoncetrue |
| 806 |
\fb@checksec\chapter{\def\fb@chaptercite{\fb@newciteunit}}} |
| 807 |
\DeclareOption{citeonce(part)}{\fb@citeoncetrue |
| 808 |
\fb@checksec\part{\def\fb@partcite{\fb@newciteunit}}} |
| 809 |
\DeclareOption{citeonce(document)}{\fb@citeoncetrue} |
| 810 |
\DeclareOption{citeonce*}{\fb@citeoncetrue\fb@xreftrue} |
| 811 |
\DeclareOption{citeonce*(chapter)}{% |
| 812 |
\ExecuteOptions{citeonce(chapter)}\fb@xreftrue} |
| 813 |
\DeclareOption{citeonce*(part)}{% |
| 814 |
\ExecuteOptions{citeonce(part)}\fb@xreftrue} |
| 815 |
\DeclareOption{citeonce*(document)}{\ExecuteOptions{citeonce*}} |
| 816 |
% \end{macrocode} |
| 817 |
% \end{option} |
| 818 |
% \end{option} |
| 819 |
% \begin{option}{crossrefs} |
| 820 |
% \begin{option}{crossrefs*} |
| 821 |
% \begin{option}{nocrossrefs} |
| 822 |
% \leavevmode\vspace{-1.2\baselineskip} |
| 823 |
% \begin{macrocode} |
| 824 |
\DeclareOption{crossrefs}{\fb@crossrefstrue\fb@xcrossrefstrue} |
| 825 |
\DeclareOption{crossrefs*}{\fb@crossrefstrue\fb@xcrossrefsfalse} |
| 826 |
\DeclareOption{nocrossrefs}{\fb@crossrefsfalse\fb@xcrossrefsfalse} |
| 827 |
% \end{macrocode} |
| 828 |
% \end{option} |
| 829 |
% \end{option} |
| 830 |
% \end{option} |
| 831 |
% |
| 832 |
% \begin{option}{split} |
| 833 |
% \begin{option}{nosplit} |
| 834 |
% \leavevmode\vspace{-1.2\baselineskip} |
| 835 |
% \begin{macrocode} |
| 836 |
\DeclareOption{split}{\fb@nosplitfalse} |
| 837 |
\DeclareOption{nosplit}{\fb@nosplittrue} |
| 838 |
% \end{macrocode} |
| 839 |
% \end{option} |
| 840 |
% \end{option} |
| 841 |
% \begin{macrocode} |
| 842 |
\ProcessOptions* |
| 843 |
\iffb@pagecite |
| 844 |
\fb@citeoncefalse |
| 845 |
\fb@xreffalse |
| 846 |
\fi |
| 847 |
\let\fb@firstcitetrue\@undefined \let\fb@firstcitefalse\@undefined |
| 848 |
\let\fb@citeoncetrue\@undefined \let\fb@citeoncefalse\@undefined |
| 849 |
\let\fb@pagecitetrue\@undefined \let\fb@pagecitefalse\@undefined |
| 850 |
\let\fb@xreftrue\@undefined \let\fb@xreffalse\@undefined |
| 851 |
\let\fb@crossrefstrue\@undefined \let\fb@crossrefsfalse\@undefined |
| 852 |
\let\fb@xcrossrefstrue\@undefined \let\fb@xcrossrefsfalse\@undefined |
| 853 |
\let\fb@pagenumtrue\@undefined \let\fb@pagenumfalse\@undefined |
| 854 |
\let\fb@nosplittrue\@undefined \let\fb@nosplitfalse\@undefined |
| 855 |
\let\fb@checksec\@undefined |
| 856 |
% \end{macrocode} |
| 857 |
% } |
| 858 |
% |
| 859 |
% \begin{macro}{\chapter} |
| 860 |
% \begin{macro}{\part} |
| 861 |
% At the beginning of the document, the commands |\chapter| and |\part| are |
| 862 |
% patched if necessary so that they start a new citation or numbering unit. |
| 863 |
% This is achieved by adding in front of them the commands hold in |
| 864 |
% |\fb@chaptercite|, |\fb@chapternum|, |\fb@partcite| and |\fb@partnum| |
| 865 |
% defined while processing the options. When a command is patched, a |
| 866 |
% |\clearpage| is added so that a new unit always starts at the top of a page. |
| 867 |
% \begin{macrocode} |
| 868 |
\AtBeginDocument{% |
| 869 |
\begingroup |
| 870 |
\def\@tempb#1{% |
| 871 |
\ifx\@tempa\@empty\else |
| 872 |
\edef\@tempa{\noexpand\clearpage\@tempa}% |
| 873 |
\toks@\expandafter\expandafter\expandafter{\expandafter\@tempa#1}% |
| 874 |
\xdef#1{\the\toks@}% |
| 875 |
\fi}% |
| 876 |
\let\fb@newnumunit\relax |
| 877 |
\let\fb@newciteunit\relax |
| 878 |
\edef\@tempa{\fb@partcite\fb@partnum}% |
| 879 |
\@tempb\part |
| 880 |
\edef\@tempa{\fb@chaptercite\fb@chapternum}% |
| 881 |
\@tempb\chapter |
| 882 |
\endgroup} |
| 883 |
% \end{macrocode} |
| 884 |
% \end{macro} |
| 885 |
% \end{macro} |
| 886 |
% |
| 887 |
% \subsection{Customisation} |
| 888 |
% |
| 889 |
% \subsubsection{Basename of the files used for the foot bibliography} |
| 890 |
% |
| 891 |
% \begin{macro}{\footbibliographyname} |
| 892 |
% The basename of the |.aux| and |.bbl| files is produced by the |
| 893 |
% command |\fb@bibname| which is redefined by a call to |
| 894 |
% |\footbibliographyname| in the preamble. |
| 895 |
% |
| 896 |
% |\footbibliographyname| first checks that its argument is different |
| 897 |
% from |\jobname|. Since the characters in |\jobname| have catcode |
| 898 |
% 12 (other), the first two commands below yield the argument of |
| 899 |
% |\footbibliographyname| also with catcodes 12 so that it may be |
| 900 |
% compared to |\jobname|. |
| 901 |
% \begin{macrocode} |
| 902 |
\newcommand*\footbibliographyname[1]{% |
| 903 |
\edef\@tempa{#1}% |
| 904 |
\edef\@tempa{\expandafter\strip@prefix\meaning\@tempa}% |
| 905 |
\edef\@tempb{\jobname}% |
| 906 |
\ifx\@tempa\@tempb |
| 907 |
\PackageError{footbib}{Bad argument `#1'\on@line}% |
| 908 |
{The name supplied to `\string\footbibliographyname' must be |
| 909 |
different from the name\MessageBreak |
| 910 |
of the current document to avoid conflicts with the standard |
| 911 |
bibliography.\MessageBreak\MessageBreak |
| 912 |
Type \space X <return> \space to quit.\MessageBreak}% |
| 913 |
\else |
| 914 |
\xdef\fb@bibname{#1}% |
| 915 |
\fi} |
| 916 |
\@onlypreamble\footbibliographyname |
| 917 |
\footbibliographyname{\jobname.fb} |
| 918 |
% \end{macrocode} |
| 919 |
% \end{macro} |
| 920 |
% |
| 921 |
% \subsubsection{Layout of the list of citations in the text} |
| 922 |
% |
| 923 |
% \begin{macro}{\footcitelabel} |
| 924 |
% \begin{macro}{\putfootcitelabel} |
| 925 |
% \begin{macro}{\footcitelistformat} |
| 926 |
% \begin{macro}{\fb@putfootcitelabel} |
| 927 |
% \begin{macro}{\fb@citestart} |
| 928 |
% \begin{macro}{\fb@citesep} |
| 929 |
% \begin{macro}{\fb@citeend} |
| 930 |
% Here we define the layout parameters for the list of citations in the |
| 931 |
% text. We define an additional macro |\fb@putfootcitelabel| which is |
| 932 |
% essentially |\putfootcitelabel|. Only |\scriptspace| and |\mathsurround| are |
| 933 |
% set to 0 pt in case |\putfootcitelabel| involves some math. |
| 934 |
% The modified version is applied to all components of the citation |
| 935 |
% list but |\fb@citeend| to which the standard version is applied. |
| 936 |
% This avoids unwanted spacing inside the list while allowing some |
| 937 |
% additional spacing after it. The macro |\footcitelistformat| defines the |
| 938 |
% macros |\fb@citestart|, |\fb@citesep| and |\fb@citeend| used by |\fb@cite| |
| 939 |
% to build the list of citations in the text. |
| 940 |
% \begin{macrocode} |
| 941 |
\newcommand*\footcitelabel[1]{#1} |
| 942 |
\newcommand*\putfootcitelabel[1]{\textsuperscript{\normalfont#1}} |
| 943 |
\newcommand*\fb@putfootcitelabel[1]{% |
| 944 |
{\m@th\scriptspace\z@\putfootcitelabel{#1}}} |
| 945 |
\newcommand*\footcitelistformat[4]{% |
| 946 |
\def\fb@citestart{\fb@putfootcitelabel{#1}}% |
| 947 |
\def\fb@citesep{\fb@putfootcitelabel{#2}#3}% |
| 948 |
\def\fb@citeend{\putfootcitelabel{#4}}}% |
| 949 |
\footcitelistformat[,{\penalty\@m}] |
| 950 |
% \end{macrocode} |
| 951 |
% \end{macro} |
| 952 |
% \end{macro} |
| 953 |
% \end{macro} |
| 954 |
% \end{macro} |
| 955 |
% \end{macro} |
| 956 |
% \end{macro} |
| 957 |
% \end{macro} |
| 958 |
% |
| 959 |
% \subsubsection{Style of the foot bibliography} |
| 960 |
% |
| 961 |
% \begin{macro}{\footbibskip} |
| 962 |
% \begin{macro}{\footbibrule} |
| 963 |
% \begin{macro}{\footrefstyle} |
| 964 |
% \begin{macro}{\footreflabel} |
| 965 |
% \begin{macro}{\footxref} |
| 966 |
% \begin{macro}{\fb@ins} |
| 967 |
% Here are defined all the layout parameters for the foot bibliography. |
| 968 |
% |\fb@ins| is the insertion number for the foot bibliography. It is not |
| 969 |
% really the right place for its declaration but it is needed to define the |
| 970 |
% user definable parameter |\footbibskip|. By the way we set |
| 971 |
% all the parameters for these insertions: 1 to 1 magnification and |
| 972 |
% no limit on the height of the foot bibliography. |
| 973 |
% \begin{macrocode} |
| 974 |
\newinsert\fb@ins |
| 975 |
\count\fb@ins=1000 |
| 976 |
\AtBeginDocument{\dimen\fb@ins=\textheight} |
| 977 |
\newcommand\footbibskip{\skip\fb@ins} |
| 978 |
\footbibskip=\bigskipamount |
| 979 |
\newcommand\footbibrule{\kern-3\p@\hrule\kern 2.6\p@}% \hrule is .4pt high |
| 980 |
\newcommand\footrefstyle{\normalfont\footnotesize} |
| 981 |
\newcommand*\footreflabel[1]{[#1]} |
| 982 |
\newcommand*\footxref[2]{See~#1~on page~#2.} |
| 983 |
% \end{macrocode} |
| 984 |
% \end{macro} |
| 985 |
% \end{macro} |
| 986 |
% \end{macro} |
| 987 |
% \end{macro} |
| 988 |
% \end{macro} |
| 989 |
% \end{macro} |
| 990 |
% |
| 991 |
% \subsection{Some useful definitions} |
| 992 |
% |
| 993 |
% \begin{macro}{\fb@vedef} |
| 994 |
% \begin{macro}{\fb@doactive} |
| 995 |
% The keys of the references must be read and written \emph{more or |
| 996 |
% less} verbatim. Since some packages make some |
| 997 |
% characters permanently active, the catcodes should be changed before |
| 998 |
% reading or writing a key or a list of keys and reset afterward. |
| 999 |
% Unfortunately, in some situations this is not possible because the |
| 1000 |
% catcodes have already been attached to the characters. One solution is to scan |
| 1001 |
% the key and replace each active character with its non-active |
| 1002 |
% equivalent but this is fairly costly and does not work if some active |
| 1003 |
% character have been let equal to a non-active one or is hidden in a |
| 1004 |
% command occuring in the (list of) key(s). Another solution is to use |
| 1005 |
% |\meaning| to get a \emph{verbatim} copy of the keys but this does |
| 1006 |
% not allow them to contain commands like in |\foocite{\mylistofcitations}| |
| 1007 |
% The method used here consists in redefining the active characters |
| 1008 |
% so that their expansion produces the same character with a catcode |
| 1009 |
% 12 (other). Then an expansion of the key yields an almost |
| 1010 |
% \emph{verbatim} copy of it. Only then, |\meaning| is used to \emph{remove} |
| 1011 |
% the category code of any special character which might remain in the key |
| 1012 |
% like |$| or |_|. This mechanism allows the list of keys |
| 1013 |
% to contain itself commands which expand in the normal way. |
| 1014 |
% All characters which may both be active in the document and appear in the |
| 1015 |
% key of a reference must be treated in this way. Since \BibTeX\ allows almost |
| 1016 |
% any character in a key, it is safer to consider all |
| 1017 |
% characters which may be active in a document. No matter that they |
| 1018 |
% indeed are. The command |\dospecials| usually contains, among |
| 1019 |
% other, all such characters, each one escaped and preceded by |\do|. |
| 1020 |
% The \LaTeXe\ kernel defines |\dospecials|\SpecialUsageIndex{\dospecials} as |
| 1021 |
%\begin{trivlist}\leftskip=\parindent\item[]\MacroFont |
| 1022 |
% \verb*|\def\dospecials{\do\ \do\\\do\{\do\}\do\$\do\&\do\#\do\^\do\_\do\%\do\~}| |
| 1023 |
%\end{trivlist} |
| 1024 |
% \noindent Any package which define new \emph{special} characters |
| 1025 |
% should add them to this list. |
| 1026 |
% \medskip |
| 1027 |
% |
| 1028 |
% An active character is needed to start with. Since |~| was |
| 1029 |
% made active at the beginning of the package, it may be safely used |
| 1030 |
% for this purpose. |
| 1031 |
% \begin{macrocode} |
| 1032 |
\newcommand*\fb@doactive[1]{\lccode`~=`#1\lowercase{\def~{\string~}}} |
| 1033 |
\newcommand*\fb@vedef[2]{% |
| 1034 |
\begingroup |
| 1035 |
\let\do\fb@doactive \dospecials |
| 1036 |
\edef\@tempa{\endgroup\def\noexpand#1{#2}}% |
| 1037 |
\@tempa |
| 1038 |
\edef#1{\expandafter\strip@prefix\meaning#1}} |
| 1039 |
% \end{macrocode} |
| 1040 |
% \end{macro} |
| 1041 |
% \end{macro} |
| 1042 |
% \begin{macro}{\fb@namexdef} |
| 1043 |
% |\fb@namexdef| is similar to the |\@namedef| command of \LaTeX\ but uses |
| 1044 |
% |\xdef| instead of |\def| |
| 1045 |
% \begin{macrocode} |
| 1046 |
\newcommand*\fb@namexdef[1]{\expandafter\xdef\csname#1\endcsname} |
| 1047 |
% \end{macrocode} |
| 1048 |
% \end{macro} |
| 1049 |
% |
| 1050 |
% \begin{macro}{\fb@auxout} |
| 1051 |
% \begin{macro}{\fb@writeaux} |
| 1052 |
% |\fb@auxout| is the auxiliary file used to record information about |
| 1053 |
% citations and as input to \BibTeX. |
| 1054 |
% The commands |\footbibliographystyle| and |\footbibliography| do an |
| 1055 |
% immediate |\write| to this file. However, since these commands may |
| 1056 |
% be used in the preamble, this file might not yet be open for |
| 1057 |
% writing at the time they are used. We must wait until the end of the |
| 1058 |
% preamble before opening the auxiliary file to give the user a chance to |
| 1059 |
% define its name with |\footbibliographyname|. Therefore, we define the |
| 1060 |
% macro |\fb@writeaux| which postpones the write until the beginning of the |
| 1061 |
% document. It is somehow a \emph{delayed immediate write} which means that |
| 1062 |
% the write will be performed as soon as possible, i.e.~as soon as the |
| 1063 |
% auxiliary file is open for writing. This definition is temporary and will |
| 1064 |
% be changed to a \emph{true} immediate write by |\AtBeginDocument|. |
| 1065 |
% \begin{macrocode} |
| 1066 |
\newwrite\fb@auxout |
| 1067 |
\newcommand*\fb@writeaux[2]{% |
| 1068 |
\AtBeginDocument{% |
| 1069 |
\if@filesw |
| 1070 |
\immediate\write\fb@auxout{\string#1{#2}}% |
| 1071 |
\fi}} |
| 1072 |
% \end{macrocode} |
| 1073 |
% \end{macro} |
| 1074 |
% \end{macro} |
| 1075 |
% |
| 1076 |
% \subsection{Units handling} |
| 1077 |
% |
| 1078 |
% \begin{macro}{\fb@numunit} |
| 1079 |
% \begin{macro}{\fb@citeunit} |
| 1080 |
% \begin{macro}{\fb@xrefunit} |
| 1081 |
% We handle 3 counters: the \emph{numbering unit}\Index{numbering}{unit} |
| 1082 |
% counter (|\fb@numunit|), the \emph{citation unit}\Index{citation}{unit} |
| 1083 |
% counter (|\fb@citeunit|) and the \emph{cross-referencing |
| 1084 |
% unit}\Index{cross-referencing}{unit} counter (|\fb@xrefunit|). This last |
| 1085 |
% counter is meaningful only if a |citeonce*| option was used. It essentially |
| 1086 |
% counts pages in |oneside| mode and double pages in |twoside| mode. However, |
| 1087 |
% if the citation unit is a chapter (resp.~a part), each |\chapter| |
| 1088 |
% (resp.~|\part|) command also increments this counter. |
| 1089 |
% \begin{macrocode} |
| 1090 |
\newcount\fb@numunit \fb@numunit\@ne |
| 1091 |
\newcount\fb@citeunit \fb@citeunit\@ne |
| 1092 |
\newcount\fb@xrefunit \fb@xrefunit\@ne |
| 1093 |
% \end{macrocode} |
| 1094 |
% \end{macro} |
| 1095 |
% \end{macro} |
| 1096 |
% \end{macro} |
| 1097 |
% |
| 1098 |
% \begin{macro}{\fb@refciteunit} |
| 1099 |
% \begin{macro}{\fb@refxrefunit} |
| 1100 |
% \begin{macro}{\fb@refnumunit} |
| 1101 |
% \begin{macro}{\fb@refpage} |
| 1102 |
% \begin{macro}{\fb@theunits} |
| 1103 |
% \begin{macro}{\fb@getunits} |
| 1104 |
% \begin{macro}{\fb@get@units} |
| 1105 |
% The macros |\fb@ref|\dots|unit| and |\fb@refpage| hold the units and the |
| 1106 |
% page of the current citation. |
| 1107 |
% \begin{macrocode} |
| 1108 |
\newcommand\fb@theunits{% |
| 1109 |
{\the\fb@citeunit}{\the\fb@xrefunit}{\the\fb@numunit}{\thepage}} |
| 1110 |
\newcommand*\fb@getunits[1]{% |
| 1111 |
\ifx#1\relax |
| 1112 |
\xdef#1{{\fb@key}\fb@theunits}% |
| 1113 |
\fi |
| 1114 |
\expandafter\fb@get@units#1} |
| 1115 |
\newcommand*\fb@get@units[5]{% |
| 1116 |
\def\fb@refciteunit{#2}% |
| 1117 |
\def\fb@refxrefunit{#3}% |
| 1118 |
\def\fb@refnumunit{#4}% |
| 1119 |
\def\fb@refpage{#5}}% |
| 1120 |
% \end{macrocode} |
| 1121 |
% \end{macro} |
| 1122 |
% \end{macro} |
| 1123 |
% \end{macro} |
| 1124 |
% \end{macro} |
| 1125 |
% \end{macro} |
| 1126 |
% \end{macro} |
| 1127 |
% \end{macro} |
| 1128 |
% |
| 1129 |
% \begin{macro}{\fb@newciteunit} |
| 1130 |
% \begin{macro}{\fb@newnumunit} |
| 1131 |
% The macros |\fb@newciteunit| and |\fb@newnumunit| are called by the |
| 1132 |
% patched versions of |\part| or |
| 1133 |
% |\chapter| to start a new citation or numbering unit. The patched |
| 1134 |
% sectioning unit also forces a page break so that a unit always |
| 1135 |
% starts at the top of a page. |
| 1136 |
% \begin{macrocode} |
| 1137 |
\newcommand\fb@newciteunit{% |
| 1138 |
\global\advance\fb@citeunit\@ne |
| 1139 |
\global\advance\fb@xrefunit\@ne} |
| 1140 |
\newcommand\fb@newnumunit{\global\advance\fb@numunit\@ne} |
| 1141 |
% \end{macrocode} |
| 1142 |
% \end{macro} |
| 1143 |
% \end{macro} |
| 1144 |
% |
| 1145 |
% \begin{macro}{\fb@checkpage} |
| 1146 |
% \begin{macro}{\fb@prevpage} |
| 1147 |
% Each time the page counter is incremented, i.e.~at the top of a new |
| 1148 |
% page, the macro |\fb@checkpage| updates the units counters if necessary. We |
| 1149 |
% first check whether the current page is a right page. In |oneside| mode, it |
| 1150 |
% is never the case. In |twoside| mode, it is the case if its number is |
| 1151 |
% |\fb@prevpage|${}+1$ and is odd, where |\fb@prevpage| is a counter which |
| 1152 |
% holds the number of the last shiped out page. If the number |
| 1153 |
% of the current page is not |\fb@prevpage|${}+1$, it means that |
| 1154 |
% either the user has manually changed the page counter or the page numbering |
| 1155 |
% has changed. In both cases, we consider the current page as a left page. If |
| 1156 |
% the current page is a right page, we do nothing. Otherwise, it may start a |
| 1157 |
% new unit\footnote{A right page may actually also start a new unit if for |
| 1158 |
% instance the |firstcite(chapter)|\SpecialOptionIndex{firstcite} |
| 1159 |
% option is in effect and the current |
| 1160 |
% page starts a new chapter. But in this case, the units are updated by the |
| 1161 |
% |\string\chapter| command.} and we update the unit counters. |
| 1162 |
% \begin{macrocode} |
| 1163 |
\newcount\fb@prevpage \fb@prevpage\@ne |
| 1164 |
\newcommand*\fb@checkpage{% |
| 1165 |
\@tempswatrue |
| 1166 |
\iffb@twoside |
| 1167 |
\global\advance\fb@prevpage\@ne |
| 1168 |
\ifnum\fb@prevpage=\c@page |
| 1169 |
\ifodd\c@page |
| 1170 |
\@tempswafalse |
| 1171 |
\fi |
| 1172 |
\fi |
| 1173 |
\fi |
| 1174 |
\if@tempswa |
| 1175 |
% \end{macrocode} |
| 1176 |
% The counter |\fb@numunit| is incremented if the switch |\iffb@pagenum| is |
| 1177 |
% true, i.e.~the option |
| 1178 |
% |firstcite(page)|\SpecialOptionIndex{firstcite} was used. |
| 1179 |
% \begin{macrocode} |
| 1180 |
\iffb@pagenum |
| 1181 |
\global\advance\fb@numunit\@ne |
| 1182 |
\fi |
| 1183 |
% \end{macrocode} |
| 1184 |
% The switch |\iffb@citeonce| is true iff a |
| 1185 |
% |citeonce|\SpecialOptionIndex{citeonce} or |
| 1186 |
% |citeonce*|\SpecialOptionIndex{citeonce*} |
| 1187 |
% option was used. In this case, the |\fb@citeunit| counter is |
| 1188 |
% incremented by the |\chapter| or |\part| command. We just increment |
| 1189 |
% |\fb@xrefunit| in case |citeonce*| was used. If |
| 1190 |
% |\iffb@citeonce| is false, the citation unit is the (double) page and |
| 1191 |
% we increment |\fb@citeunit|. Since no |
| 1192 |
% |citeonce*|\SpecialOptionIndex{citeonce*} option was |
| 1193 |
% used, we do not need to handle |\fb@xrefunit|. |
| 1194 |
% \begin{macrocode} |
| 1195 |
\iffb@citeonce |
| 1196 |
\global\advance\fb@xrefunit\@ne |
| 1197 |
\else |
| 1198 |
\global\advance\fb@citeunit\@ne |
| 1199 |
\fi |
| 1200 |
\fi |
| 1201 |
\global\fb@prevpage\c@page} |
| 1202 |
% \end{macrocode} |
| 1203 |
% \end{macro} |
| 1204 |
% \end{macro} |
| 1205 |
% |
| 1206 |
% \begingroup\lccode`P=`\%\lowercase{\endgroup\begin{macro}{\c@fbPcheckpage}} |
| 1207 |
% The next definition is a trick to make the macro |\fb@checkpage| |
| 1208 |
% execute each time the page counter is incremented. Each counter |
| 1209 |
% \meta{cnt} declared by |\@addtoreset{|\meta{cnt}|}{page}| is reset to |
| 1210 |
% 0 by |\global\c@|\meta{cnt}|\z@| when the counter |page| is |
| 1211 |
% incremented. We define a macro |\c@|\emph{xxx} which \emph{looks like} |
| 1212 |
% a counter and we say |\@addtoreset{|\emph{xxx}|}{page}|. To |
| 1213 |
% be sure that the user will never define a counter named \emph{xxx}, we |
| 1214 |
% name our macro |\c@fb%checkpage|. The name of the associated \emph{pseudo |
| 1215 |
% counter} is |fb%checkpage| that the user may normally not type. |
| 1216 |
% Each time the page counter is incremented, |\global\c@fb%checkpage\z@| |
| 1217 |
% is executed. The macro |\c@fb%checkpage| starts with an assignment |
| 1218 |
% (|\count@\z@|) which \emph{uses} the |\global| and ends with a |
| 1219 |
% counter (|\count@|) which \emph{gobbles} the following |\z@|. Since |
| 1220 |
% we change the catcode of |%|, it may not be used for comments below. |
| 1221 |
% \begin{macrocode} |
| 1222 |
\catcode`\%=11 |
| 1223 |
\newcommand\c@fb%checkpage{\count@\z@ |
| 1224 |
\fb@checkpage |
| 1225 |
\count@} |
| 1226 |
\@addtoreset{fb%checkpage}{page} |
| 1227 |
\catcode`\%=14 |
| 1228 |
% \end{macrocode} |
| 1229 |
% \end{macro} |
| 1230 |
% |
| 1231 |
% \subsection{Commands to handle the references} |
| 1232 |
% |
| 1233 |
% \begin{macro}{\fb@refcount} |
| 1234 |
% The counter |\fb@refcount| holds the number of the last numbered reference. |
| 1235 |
% It is reset to 0 at the beginning of each numbering unit. |
| 1236 |
% \begin{macrocode} |
| 1237 |
\newcount\fb@refcount |
| 1238 |
% \end{macrocode} |
| 1239 |
% \end{macro} |
| 1240 |
% \begin{macro}{\fb@lbl} |
| 1241 |
% \begin{macro}{\fb@txt} |
| 1242 |
% The token registers |\fb@lbl| and |\fb@txt| always holds the label |
| 1243 |
% and the text of the current reference. |
| 1244 |
% \begin{macrocode} |
| 1245 |
\newtoks\fb@lbl |
| 1246 |
\newtoks\fb@txt |
| 1247 |
% \end{macrocode} |
| 1248 |
% \end{macro} |
| 1249 |
% \end{macro} |
| 1250 |
% \begin{macro}{\fb@setref} |
| 1251 |
% \begin{macro}{\fb@getref} |
| 1252 |
% \VerbSetup{\begin{macro}{\fb@r.\noexpand~{key}}} |
| 1253 |
% |\fb@setref| stores the current value of the token registers |
| 1254 |
% |\fb@lbl| and |\fb@txt| in the macro |\fb@r.|\meta{key} where |
| 1255 |
% \meta{key} is the key of the current reference. This key is always |
| 1256 |
% stored in the macro |\fb@key|. |\fb@setref| is called each time a component |
| 1257 |
% of a reference changes: when it is first read at the beginning of the |
| 1258 |
% document, and when the dynamic label or the text of the reference has |
| 1259 |
% been updated. |\fb@getref| does the converse: given |
| 1260 |
% a key, it updates |\fb@lbl| and |\fb@txt| from |\fb@r.|\meta{key}. |
| 1261 |
% \begin{macrocode} |
| 1262 |
\newcommand\fb@setref{% |
| 1263 |
\fb@namexdef{fb@r.\fb@key}{{\the\fb@lbl}{\the\fb@txt}}} |
| 1264 |
\newcommand\fb@getref{\afterassignment\fb@txt\fb@lbl} |
| 1265 |
% \end{macrocode} |
| 1266 |
% \end{macro} |
| 1267 |
% \end{macro} |
| 1268 |
% \begin{macro}{\fb@setlbl} |
| 1269 |
% \begin{macro}{\fb@getlbl} |
| 1270 |
% |\fb@setlbl| updates the dynamic label of a reference. |\fb@getlbl| gets |
| 1271 |
% the label after calling |\fb@setlbl| if necessary to update it. |
| 1272 |
% \begin{macrocode} |
| 1273 |
\newcommand\fb@setlbl{% |
| 1274 |
\global\advance\fb@refcount\@ne |
| 1275 |
\edef\@tempa{{\fb@refnumunit}{\the\fb@refcount}}% |
| 1276 |
\global\fb@lbl\expandafter{\expandafter\fb@getlbl\@tempa}% |
| 1277 |
\fb@setref |
| 1278 |
\the\fb@refcount} |
| 1279 |
\newcommand*\fb@getlbl[2]{\ifnum\fb@refnumunit=#1{#2}\else\fb@setlbl\fi} |
| 1280 |
% \end{macrocode} |
| 1281 |
% \end{macro} |
| 1282 |
% \end{macro} |
| 1283 |
% \begin{macro}{\fb@settxt} |
| 1284 |
% \begin{macro}{\fb@gettxt} |
| 1285 |
% |\fb@settxt| and |\fb@gettxt| are similar to |\fb@setlbl| and |
| 1286 |
% |\fb@getlbl| but update the text of the reference instead of the label. |
| 1287 |
% When |\fb@settxt| is called, the label must have been expanded just |
| 1288 |
% before so that it has been updated if necessary. Then |\fb@lbl| |
| 1289 |
% has either the form |{|\meta{static label}|}|\Index{static}{label} or |
| 1290 |
% the form |\fb@getlbl{|\meta{current numunit}|}{|\meta{dynamic |
| 1291 |
% label}|}|\Index{dynamic}{label}. |
| 1292 |
% In the later case, the test at the beginning of |\fb@getlbl| must |
| 1293 |
% succeed so that in both cases, the first command in |\fb@settxt| |
| 1294 |
% below assigns the label to |\toks@|. |
| 1295 |
% \begin{macrocode} |
| 1296 |
\newcommand\fb@settxt[1]{% |
| 1297 |
\toks@=\the\fb@lbl |
| 1298 |
\toks@\expandafter\expandafter\expandafter{\expandafter |
| 1299 |
\footreflabel\expandafter{\the\toks@}}% |
| 1300 |
\edef\@tempa{{\fb@refciteunit}{\the\toks@}{\fb@refpage}}% |
| 1301 |
\global\fb@txt\expandafter{\expandafter\fb@gettxt\@tempa{#1}}% |
| 1302 |
\fb@setref |
| 1303 |
#1} |
| 1304 |
\newcommand\fb@gettxt[4]{% |
| 1305 |
\ifnum\fb@refciteunit=#1\relax |
| 1306 |
\footxref{#2}{#3}% |
| 1307 |
\else |
| 1308 |
\fb@settxt{#4}% |
| 1309 |
\fi} |
| 1310 |
% \end{macrocode} |
| 1311 |
% \end{macro} |
| 1312 |
% \end{macro} |
| 1313 |
% |
| 1314 |
% \subsection{Commands to handle the foot bibliography} |
| 1315 |
% |
| 1316 |
% \begin{macro}{\footbibliography} |
| 1317 |
% \begin{macro}{\footbibliographystyle} |
| 1318 |
% |\footbibliography| and |\footbibliographystyle| are the commands which |
| 1319 |
% define the bibliography file and the bibliography style. They just write |
| 1320 |
% their argument to the auxiliary file. If they are used in the preamble, the |
| 1321 |
% |\fb@writeaux| macro in use is the delayed one. The write will actually |
| 1322 |
% take place at the beginning of the document. |
| 1323 |
% \begin{macrocode} |
| 1324 |
\newcommand\footbibliography{\fb@writeaux\bibdata} |
| 1325 |
\newcommand\footbibliographystyle{\fb@writeaux\bibstyle} |
| 1326 |
% \end{macrocode} |
| 1327 |
% \end{macro} |
| 1328 |
% \end{macro} |
| 1329 |
% |
| 1330 |
% \begin{macro}{\fb@refnotfound} |
| 1331 |
% When a reference is not found by \LaTeX, it is replaced by a |
| 1332 |
% default one generated by the command |\fb@refnotfound| which |
| 1333 |
% takes the key of the reference as an argument and expands to the |
| 1334 |
% default label and the default text. |
| 1335 |
% \begin{macrocode} |
| 1336 |
\newcommand*\fb@refnotfound[1]{% |
| 1337 |
{?}{*** ERROR: citation `{\normalfont\ttfamily\bfseries#1}' undefined ***}} |
| 1338 |
% \end{macrocode} |
| 1339 |
% \end{macro} |
| 1340 |
% |
| 1341 |
% \subsubsection{Creation of the foot references} |
| 1342 |
% |
| 1343 |
% \begin{macro}{\footcite} |
| 1344 |
% \begin{macro}{\footcite*} |
| 1345 |
% \begin{macro}{\footnocite} |
| 1346 |
% \begin{macro}{\fb@@cite} |
| 1347 |
% \begin{macro}{\fb@optlbl} |
| 1348 |
% \begin{macro}{\iffb@lbl} |
| 1349 |
% \begin{macro}{\iffb@txt} |
| 1350 |
% All 3 citation commands |\footcite|, |\footcite*| and |\footnocite| |
| 1351 |
% actually call the same macro |\fb@cite|. Before this call, they just |
| 1352 |
% set the flags |
| 1353 |
% |\iffb@lbl| and |\iffb@txt| according to whether the label and the |
| 1354 |
% text of the reference are requested. The settings are as follows: |
| 1355 |
% \begin{center} |
| 1356 |
% \DeleteShortVerb\|\MakeShortVerb\" |
| 1357 |
% \begin{tabular}{|l|c|c|}\hline |
| 1358 |
% & "\iffb@lbl" & "\iffb@txt" \\\hline |
| 1359 |
% "\footcite" & true & true \\ |
| 1360 |
% "\footcite*" & true & false \\ |
| 1361 |
% "\footnocite" & false & true \\\hline |
| 1362 |
% \end{tabular} |
| 1363 |
% \DeleteShortVerb\"\MakeShortVerb\| |
| 1364 |
% \end{center} |
| 1365 |
% In addition, |\footcite| calls |\fb@@cite| to get the optional argument |
| 1366 |
% which is put in |\fb@optlbl|. |
| 1367 |
% \begin{macrocode} |
| 1368 |
\newif\iffb@lbl |
| 1369 |
\newif\iffb@txt |
| 1370 |
\DeclareRobustCommand\footcite{% |
| 1371 |
\fb@lbltrue\@ifstar{\fb@txtfalse\fb@@cite}{\fb@txttrue\fb@@cite}} |
| 1372 |
\newcommand\footnocite{\fb@lblfalse\fb@txttrue\fb@cite} |
| 1373 |
\newcommand*\fb@@cite[1][\@nil]{% |
| 1374 |
\def\fb@optlbl{#1}% |
| 1375 |
\ifx\fb@optlbl\@nnil |
| 1376 |
\let\fb@optlbl\relax |
| 1377 |
\else |
| 1378 |
\def\fb@optlbl{\fb@putfootcitelabel{, #1}}% |
| 1379 |
\fi |
| 1380 |
\fb@cite} |
| 1381 |
% \end{macrocode} |
| 1382 |
% \end{macro} |
| 1383 |
% \end{macro} |
| 1384 |
% \end{macro} |
| 1385 |
% \end{macro} |
| 1386 |
% \end{macro} |
| 1387 |
% \end{macro} |
| 1388 |
% \end{macro} |
| 1389 |
% |
| 1390 |
% \begin{macro}{\fb@cite} |
| 1391 |
% |\fb@cite| is the macro which handles the list of citations. It |
| 1392 |
% calls |\fb@xcite| to produce the actual label and insert the text |
| 1393 |
% of each individual reference. |
| 1394 |
% \begin{macrocode} |
| 1395 |
\newcommand*\fb@cite[1]{% |
| 1396 |
\fb@vedef\fb@keys{#1}% |
| 1397 |
\iffb@lbl |
| 1398 |
\fb@citestart |
| 1399 |
\def\fb@citea{\let\fb@citea\fb@citesep}% |
| 1400 |
\fi |
| 1401 |
% \end{macrocode} |
| 1402 |
% If the list of citation is empty, the |\@for| loop is not |
| 1403 |
% entered and no warning is issued. Therefore, we check for this now. |
| 1404 |
% \begin{macrocode} |
| 1405 |
\ifx\fb@keys\@empty |
| 1406 |
\PackageWarning{footbib}{Empty citation on page \thepage}% |
| 1407 |
\fi |
| 1408 |
\@for\fb@key:=\fb@keys\do{% |
| 1409 |
\iffb@lbl\fb@citea\fi |
| 1410 |
\fb@xcite |
| 1411 |
\ifx\fb@deferredcite\@empty\else |
| 1412 |
\begingroup |
| 1413 |
\fb@lblfalse |
| 1414 |
\expandafter\fb@xnocite\fb@deferredcite\@nil |
| 1415 |
\endgroup |
| 1416 |
\fi}% |
| 1417 |
\iffb@lbl\fb@optlbl\fb@citeend\fi} |
| 1418 |
% \end{macrocode} |
| 1419 |
% \end{macro} |
| 1420 |
% \begin{macro}{\fb@xfootcite} |
| 1421 |
% \begin{macro}{\fb@deferredcite} |
| 1422 |
% The macro |\fb@xfootcite| is a replacement for the |\cite| command of |
| 1423 |
% \LaTeX\ inside a foot reference if the |
| 1424 |
% |crossrefs|\SpecialOptionIndex{crossrefs} or |
| 1425 |
% |crossrefs*|\SpecialOptionIndex{crossrefs*} option was used. |
| 1426 |
% In both cases, |\fb@xfootcite| performs a |
| 1427 |
% |\footcite*|. If the |crossrefs|\SpecialOptionIndex{crossrefs} option was |
| 1428 |
% used, in addition, |\fb@xfootcite| adds globally the list of citation |
| 1429 |
% keys to the list |\fb@deferredcite|. After the insertion of the current |
| 1430 |
% reference has been completed, a |\footnocite|\SpecialUsageIndex{\footnocite} |
| 1431 |
% will be performed for each key in the list. The format of this list is |
| 1432 |
% \meta{key}|,|\dots,\meta{key}|,| (the trailing comma makes it easier to |
| 1433 |
% handle than \meta{key}|,|\dots|,|\meta{key} and allows to distinguish between |
| 1434 |
% an empty list and a list containing only an empty element). This list is |
| 1435 |
% initially empty. |
| 1436 |
% \begin{macrocode} |
| 1437 |
\newcommand\fb@xfootcite[2][\@nil]{% |
| 1438 |
\footcite*[#1]{#2}% |
| 1439 |
\iffb@xcrossrefs |
| 1440 |
\fb@vedef\fb@keys{#2}% |
| 1441 |
\xdef\fb@deferredcite{\fb@deferredcite\fb@keys,}% |
| 1442 |
\fi} |
| 1443 |
\let\fb@deferredcite\@empty |
| 1444 |
% \end{macrocode} |
| 1445 |
% \end{macro} |
| 1446 |
% \end{macro} |
| 1447 |
% \begin{macro}{\fb@xnocite} |
| 1448 |
% After the insertion of the current reference has been completed, if some |
| 1449 |
% deferred cross-references are present, the macro |\fb@xnocite| is called. |
| 1450 |
% It calls |\fb@xcite| with |\iffb@lbl|=\emph{false} to insert the text of |
| 1451 |
% the cross-references if necessary. This might produce more deferred |
| 1452 |
% cross-references which will be added to |\fb@deferredcite|. |
| 1453 |
% \begin{macrocode} |
| 1454 |
\def\fb@xnocite#1,#2\@nil{% |
| 1455 |
\gdef\fb@deferredcite{#2}% |
| 1456 |
\def\fb@key{#1}% |
| 1457 |
\fb@xcite |
| 1458 |
\ifx\fb@deferredcite\@empty |
| 1459 |
\let\@tempa\@gobble |
| 1460 |
\else |
| 1461 |
\let\@tempa\fb@xnocite |
| 1462 |
\fi |
| 1463 |
\expandafter\@tempa\fb@deferredcite\@nil} |
| 1464 |
% \end{macrocode} |
| 1465 |
% \end{macro} |
| 1466 |
% \begin{macro}{\fb@xcite} |
| 1467 |
% The macro |\fb@xcite| is called both by |\fb@cite| and |
| 1468 |
% |\fb@xnocite| to handle each individual citation. It writes to the auxiliary |
| 1469 |
% file the information about the citation, puts the label in the text if |
| 1470 |
% requested and put the text of the reference on the page if necessary. If the |
| 1471 |
% reference is not found, it issues a warning. |
| 1472 |
% |
| 1473 |
% The first command in |\fb@xcite| removes any space in front of the key. |
| 1474 |
% |\@empty| is inserted after the key to prevent an error in case it is |
| 1475 |
% empty. |
| 1476 |
% |
| 1477 |
% If the key is empty or the reference is undefined, the \LaTeX\ command |
| 1478 |
% |\G@refundefinedtrue| is used to set the switch |
| 1479 |
% |\if@refundefined| which indicates that some reference was |
| 1480 |
% undefined. |
| 1481 |
% \begin{macrocode} |
| 1482 |
\newcommand\fb@xcite{% |
| 1483 |
\edef\fb@key{\expandafter\@firstofone\fb@key\@empty}% |
| 1484 |
\ifx\fb@key\@empty |
| 1485 |
\PackageWarning{footbib}{Empty citation on page \thepage}% |
| 1486 |
\G@refundefinedtrue |
| 1487 |
\else |
| 1488 |
\@ifundefined{fb@r.\fb@key}% |
| 1489 |
% \end{macrocode} |
| 1490 |
% \FbIndex{\fb@r.\noexpand~{key}}^^A |
| 1491 |
% \begin{macrocode} |
| 1492 |
{\G@refundefinedtrue |
| 1493 |
\PackageWarning{footbib}{% |
| 1494 |
Citation `\fb@key' on page \thepage \space undefined}% |
| 1495 |
\fb@getref\fb@refnotfound\fb@key\fb@setref}% |
| 1496 |
{\fb@getref\@nameuse{fb@r.\fb@key}}% |
| 1497 |
% \end{macrocode} |
| 1498 |
% \FbIndex{\fb@r.\noexpand~{key}}^^A |
| 1499 |
% \begin{macrocode} |
| 1500 |
\fb@bibcite |
| 1501 |
\iffb@lbl\fb@putfootcitelabel{\footcitelabel{\the\fb@lbl}}\fi |
| 1502 |
% \end{macrocode} |
| 1503 |
% The text of the reference is inserted if requested (|\iffb@txt|=\emph{true}) |
| 1504 |
% and either it has not yet been inserted in the current citation unit, or a |
| 1505 |
% |citeonce*| option was used and the last citation was on |
| 1506 |
% another (double) page. |
| 1507 |
% \begin{macrocode} |
| 1508 |
\iffb@txt |
| 1509 |
\expandafter\let\expandafter\@tempa\csname |
| 1510 |
fb@fn\fb@key.\fb@refciteunit\endcsname |
| 1511 |
% \end{macrocode} |
| 1512 |
% \FbIndex{\fb@fn\noexpand~{key}.\noexpand~{num}}^^A |
| 1513 |
% \begin{macrocode} |
| 1514 |
\@tempswatrue |
| 1515 |
\ifx\@tempa\relax\else |
| 1516 |
\iffb@xref |
| 1517 |
\ifx\@tempa\fb@refxrefunit |
| 1518 |
\@tempswafalse |
| 1519 |
\fi |
| 1520 |
\else |
| 1521 |
\@tempswafalse |
| 1522 |
\fi |
| 1523 |
\fi |
| 1524 |
\if@tempswa |
| 1525 |
\fb@namexdef{fb@fn\fb@key.\fb@refciteunit}{\fb@refxrefunit}% |
| 1526 |
% \end{macrocode} |
| 1527 |
% \FbMainIndex{\fb@fn\noexpand~{key}.\noexpand~{num}}^^A |
| 1528 |
% \begin{macrocode} |
| 1529 |
\fb@citefn |
| 1530 |
\fi |
| 1531 |
\fi |
| 1532 |
\fi} |
| 1533 |
% \end{macrocode} |
| 1534 |
% \end{macro} |
| 1535 |
% \begin{macro}{\fb@bibcite} |
| 1536 |
% \begin{macro}{\fb@lastrefnumunit} |
| 1537 |
% \begin{macro}{\fb@citecount} |
| 1538 |
% The command |\fb@bibcite| writes |
| 1539 |
% to the auxiliary file all the informations about the current |
| 1540 |
% citation: the key, the units, and the page. It also resets to 0 the counter |
| 1541 |
% |\fb@refcount| if the numbering unit changed between the last reference and |
| 1542 |
% the current one. This counter is used to number the references. The counter |
| 1543 |
% |\fb@lastrefnumunit| holds the numbering unit of the last reference. |
| 1544 |
% The counter |\fb@citecount| holds the number of the current citation. |
| 1545 |
% \begin{macrocode} |
| 1546 |
\newcount\fb@citecount |
| 1547 |
\newcount\fb@lastrefnumunit \fb@lastrefnumunit\m@ne |
| 1548 |
\newcommand\fb@bibcite{% |
| 1549 |
\fb@writeaux\citation\fb@key |
| 1550 |
\global\advance\fb@citecount\@ne |
| 1551 |
\expandafter\fb@getunits\csname fb@c.\the\fb@citecount\endcsname |
| 1552 |
% \end{macrocode} |
| 1553 |
% \FbIndex{\fb@c.\noexpand~{num}}^^A |
| 1554 |
% \begin{macrocode} |
| 1555 |
\ifnum\fb@refnumunit=\fb@lastrefnumunit\else |
| 1556 |
\global\fb@lastrefnumunit\fb@refnumunit\relax |
| 1557 |
\global\fb@refcount\z@ |
| 1558 |
\fi |
| 1559 |
\if@filesw |
| 1560 |
\write\fb@auxout\expandafter{\expandafter\string\expandafter |
| 1561 |
\bibcite\expandafter{\fb@key}\fb@theunits}% |
| 1562 |
\fi} |
| 1563 |
% \end{macrocode} |
| 1564 |
% \end{macro} |
| 1565 |
% \end{macro} |
| 1566 |
% \end{macro} |
| 1567 |
% |
| 1568 |
% \begin{macro}{\fb@citefn} |
| 1569 |
% |\fb@citefn| inserts the text of the reference. It is called |
| 1570 |
% only if the reference was not already cited in the same citation |
| 1571 |
% unit or a |citeonce*|\SpecialOptionIndex{citeonce*} option was used. |
| 1572 |
% The code is mainly borrowed from the footnotes handling in \LaTeX. |
| 1573 |
% \begin{macrocode} |
| 1574 |
\newcommand\fb@citefn{% |
| 1575 |
\insert\fb@ins{% |
| 1576 |
\reset@font\footrefstyle |
| 1577 |
\interlinepenalty\iffb@nosplit\@M\else\interfootnotelinepenalty\fi |
| 1578 |
\splittopskip 1.2\ht\strutbox |
| 1579 |
\splitmaxdepth \dp\strutbox |
| 1580 |
\floatingpenalty \@MM |
| 1581 |
\hsize\columnwidth |
| 1582 |
\@parboxrestore |
| 1583 |
\ifx\newblock\@undefined\let\newblock\relax\fi |
| 1584 |
\iffb@crossrefs\let\cite\fb@xfootcite\fi |
| 1585 |
\@tempdima\fb@lblwidth |
| 1586 |
\advance\@tempdima\labelsep |
| 1587 |
\leftskip\@tempdima |
| 1588 |
\color@begingroup |
| 1589 |
\setbox\@tempboxa\hbox{\footreflabel{\the\fb@lbl}}% |
| 1590 |
\hskip-\@tempdima |
| 1591 |
\ifdim\wd\@tempboxa<\fb@lblwidth |
| 1592 |
\hb@xt@\fb@lblwidth{\unhbox\@tempboxa\hfil}% |
| 1593 |
\else |
| 1594 |
\box\@tempboxa |
| 1595 |
\fi |
| 1596 |
\hskip\labelsep |
| 1597 |
\rule\z@{1.2\ht\strutbox}\ignorespaces\the\fb@txt\@finalstrut\strutbox |
| 1598 |
\color@endgroup}} |
| 1599 |
% \end{macrocode} |
| 1600 |
% \end{macro} |
| 1601 |
% |
| 1602 |
% \subsection{AtBeginDocument, AtEndDocument} |
| 1603 |
% |
| 1604 |
% At the beginning of the document, we read the bibliography file and |
| 1605 |
% record all the references. This is memory consuming but the only |
| 1606 |
% alternative is to read again the bibliography file for each |
| 1607 |
% |\footcite| command which would be much slower. |
| 1608 |
% We must wait until the beginning of the document to give the user a |
| 1609 |
% chance to redefine |\fb@bibname| through |\footbibliographyname|. |
| 1610 |
% The preamble of the bibliography is executed once for all when the |
| 1611 |
% bibliography is read. After recording the bibliography, we read the |.aux| |
| 1612 |
% file (if it exists) and record the parameters (citation and numbering unit, |
| 1613 |
% page, etc.) of all citations as determined during the previous run. The |
| 1614 |
% parameters of the $n^{th}$ citation are recorded in the macro |
| 1615 |
% |\fb@c.|\meta{n}. |
| 1616 |
% \begin{macrocode} |
| 1617 |
\AtBeginDocument{% |
| 1618 |
% \end{macrocode} |
| 1619 |
% Save the current value of |\thebibliography| and redefine it |
| 1620 |
% \begin{macrocode} |
| 1621 |
\let\fb@savethebibliography\thebibliography |
| 1622 |
\let\thebibliography\fb@thebibliography |
| 1623 |
\let\fb@thebibliography\@undefined |
| 1624 |
% \end{macrocode} |
| 1625 |
% Read the |bbl| file. This executes the preamble, and if a |
| 1626 |
% |thebibliography| environment is found, sets |\fb@lblwidth| to the |
| 1627 |
% length of the longest label and records all references. |\fb@lblwidth| |
| 1628 |
% is initialised with a negative value which allows us to detect |
| 1629 |
% afterward whether a |thebibliography| environment was present. |
| 1630 |
% \begin{macrocode} |
| 1631 |
\global\fb@lblwidth=-\maxdimen |
| 1632 |
\fb@refcount\z@ |
| 1633 |
\@input{\[email protected]}% |
| 1634 |
% \end{macrocode} |
| 1635 |
% Restore the standard value of |\thebibliography| |
| 1636 |
% \begin{macrocode} |
| 1637 |
\let\thebibliography\fb@savethebibliography |
| 1638 |
\let\fb@savethebibliography\@undefined |
| 1639 |
% \end{macrocode} |
| 1640 |
% Assign a default value to |\fb@lblwidth| in case the |bbl| file |
| 1641 |
% was not found or contained no |thebibliography| environment. |
| 1642 |
% \begin{macrocode} |
| 1643 |
\ifdim\fb@lblwidth<\z@ |
| 1644 |
\settowidth\fb@lblwidth |
| 1645 |
{\footrefstyle\footreflabel{\expandafter\@firstoftwo\fb@refnotfound{?}}}% |
| 1646 |
\fi |
| 1647 |
% \end{macrocode} |
| 1648 |
% \begin{macro}{\bibcite} |
| 1649 |
% \VerbSetup{\begin{macro}{\fb@c.\noexpand~{num}}} |
| 1650 |
% Then read the auxiliary file and record the parameters of each citation. |
| 1651 |
% \begin{macrocode} |
| 1652 |
\fb@citecount\z@ |
| 1653 |
\begingroup |
| 1654 |
\let\citation\@gobble \let\bibstyle\@gobble \let\bibdata\@gobble |
| 1655 |
\def\bibcite#1#2#3#4#5{% |
| 1656 |
\advance\fb@citecount\@ne |
| 1657 |
\fb@vedef\fb@key{#1}% |
| 1658 |
\fb@namexdef{fb@c.\the\fb@citecount}{{\fb@key}{#2}{#3}{#4}{#5}}}% |
| 1659 |
\@input{\[email protected]}% |
| 1660 |
\endgroup |
| 1661 |
% \end{macrocode} |
| 1662 |
% \end{macro} |
| 1663 |
% \end{macro} |
| 1664 |
% \end{macro} |
| 1665 |
% \begin{macro}{\fb@auxout} |
| 1666 |
% Prepare the auxiliary file for writing |
| 1667 |
% \begin{macrocode} |
| 1668 |
\if@filesw |
| 1669 |
\immediate\openout\fb@auxout=\[email protected] |
| 1670 |
\immediate\write\fb@auxout{\relax}% |
| 1671 |
\fi |
| 1672 |
% \end{macrocode} |
| 1673 |
% \end{macro} |
| 1674 |
% \begin{macro}{\fb@writeaux} |
| 1675 |
% Finally, define a non delayed version of |\fb@writeaux|. |
| 1676 |
% \begin{macrocode} |
| 1677 |
\renewcommand*\fb@writeaux[2]{% |
| 1678 |
\if@filesw |
| 1679 |
\immediate\write\fb@auxout{\string#1{#2}}% |
| 1680 |
\fi}% |
| 1681 |
} |
| 1682 |
% \end{macrocode} |
| 1683 |
% \end{macro} |
| 1684 |
% |
| 1685 |
% \begin{macro}{\fb@thebibliography} |
| 1686 |
% \begin{macro}{\fb@lblwidth} |
| 1687 |
% The macro |\fb@thebibliography| records the length of the longest |
| 1688 |
% label in the \meta{dimen} register |\fb@lblwidth| and then scans the |
| 1689 |
% bibliography and stores each reference in a global macro |
| 1690 |
% |\fb@r.|\meta{key} where \meta{key} is the key |
| 1691 |
% of the reference. The references are read one token at a time so that we |
| 1692 |
% may detect |\verb| commands even if they are hidden in groups. |
| 1693 |
% \begin{macrocode} |
| 1694 |
\newdimen\fb@lblwidth |
| 1695 |
% \end{macrocode} |
| 1696 |
% \end{macro} |
| 1697 |
% \begin{macrocode} |
| 1698 |
\newcommand*\fb@thebibliography[1]{% |
| 1699 |
% \end{macrocode} |
| 1700 |
% We open still a new group to prevent our definitions to conflict with |
| 1701 |
% macros that might be used by |\end{thebibliography}|. We let |
| 1702 |
% |\endthebibliography| equal to |\endgroup| so that it closes this group. |
| 1703 |
% \begin{macrocode} |
| 1704 |
\begingroup |
| 1705 |
\let\endthebibliography\endgroup |
| 1706 |
% \end{macrocode} |
| 1707 |
% Record the size of the longest label |
| 1708 |
% \begin{macrocode} |
| 1709 |
\settowidth\dimen@{\footrefstyle\footreflabel{#1}}% |
| 1710 |
\ifdim\dimen@>\fb@lblwidth\global\fb@lblwidth=\dimen@\fi |
| 1711 |
% \end{macrocode} |
| 1712 |
% |
| 1713 |
% \begin{macro}{\@bracelevel} |
| 1714 |
% \begin{macro}{\@bgrouplineno} |
| 1715 |
% \begin{macro}{\@on@line} |
| 1716 |
% \begin{macro}{\@eat} |
| 1717 |
% Some definitions necessary to read the bibliography entries. |
| 1718 |
% All these definitions are local since the command |
| 1719 |
% |\begin{thebibliography}| opened a new group. They will be |
| 1720 |
% cancelled when |\end{thebibliography}| is executed. |
| 1721 |
% The names of global definitions have the form |\fb@|\dots\ while the |
| 1722 |
% names of local definitions simply start with |\@|\dots\ We reuse as |
| 1723 |
% much as possible |
| 1724 |
% existing global names so that we do not use memory unnecessarily. |
| 1725 |
% the |\@bracelevel| counter keeps track of groups nesting while |
| 1726 |
% reading the bibliography. The |\@bgrouplineno| counter holds the |
| 1727 |
% number of the input line where the current group started. It is |
| 1728 |
% used for error messages. |\@on@line| is similar to the |\on@line| |
| 1729 |
% command of the \LaTeXe\ kernel but also shows the name of the |
| 1730 |
% current file. |
| 1731 |
% \begin{macrocode} |
| 1732 |
\newcount\@bracelevel |
| 1733 |
\newcount\@bgrouplineno |
| 1734 |
\def\@on@line{\on@line\space of \[email protected]}% |
| 1735 |
\def\@eat{\let\@tempa= }% |
| 1736 |
% \end{macrocode} |
| 1737 |
% \end{macro} |
| 1738 |
% \end{macro} |
| 1739 |
% \end{macro} |
| 1740 |
% \end{macro} |
| 1741 |
% \begin{macro}{\@bgroup} |
| 1742 |
% \begin{macro}{\@egroup} |
| 1743 |
% \begin{macro}{\bgroup} |
| 1744 |
% \begin{macro}{\egroup} |
| 1745 |
% |\bgroup| and |\egroup| are redefined so that we may distinguish |
| 1746 |
% between explicit and implicit begin or end group characters. |
| 1747 |
% \begin{macrocode} |
| 1748 |
\let\@bgroup{% |
| 1749 |
\let\@egroup}% |
| 1750 |
\let\bgroup\relax |
| 1751 |
\let\egroup\relax |
| 1752 |
% \end{macrocode} |
| 1753 |
% \end{macro} |
| 1754 |
% \end{macro} |
| 1755 |
% \end{macro} |
| 1756 |
% \end{macro} |
| 1757 |
% \begin{macro}{\@actlet} |
| 1758 |
% |\@actlet\|\meta{char}\meta{cmd} makes \meta{char} active and lets it |
| 1759 |
% equal to \meta{cmd}. |
| 1760 |
% \begin{macrocode} |
| 1761 |
\def\@actlet##1{% |
| 1762 |
\catcode`##1=\active |
| 1763 |
\begingroup\lccode`~=`##1\lowercase{\endgroup\let~}}% |
| 1764 |
% \end{macrocode} |
| 1765 |
% \end{macro} |
| 1766 |
% \begin{macro}{\@noitemerror} |
| 1767 |
% |\@noitemerror| is called to raise an error if anything is seen |
| 1768 |
% between |\begin{thebibliography}| and the first |\bibitem|. If the |
| 1769 |
% user types \meta{return} at the prompt, the next token is swallowed |
| 1770 |
% and the processing goes on. |
| 1771 |
% \begin{macrocode} |
| 1772 |
\def\@noitemerr{% |
| 1773 |
\PackageError{footbib}{Missing \string\bibitem\@on@line}\@empty |
| 1774 |
\afterassignment\@readbib\@eat}% |
| 1775 |
% \end{macrocode} |
| 1776 |
% \end{macro} |
| 1777 |
% \begin{macro}{\@errifbraces} |
| 1778 |
% |\@errifbraces|\meta{cmp} compares |\@bracelevel| with 0 using |
| 1779 |
% \meta{cmp} ($=$ or $>$) and raises an error if the test succeeds. |
| 1780 |
% \begin{macrocode} |
| 1781 |
\def\@errifbraces##1{% |
| 1782 |
\ifnum\@bracelevel##1\z@ |
| 1783 |
{\ifx##1>\let\inputlineno\@bgrouplineno\fi |
| 1784 |
\PackageError{footbib}{% |
| 1785 |
\ifx##1>Unmatched begin\else Extra end\fi-group |
| 1786 |
character\@on@line}\@empty}% |
| 1787 |
\fi}% |
| 1788 |
% \end{macrocode} |
| 1789 |
% \end{macro} |
| 1790 |
% Now come all the commands which read and handle the tokens. |
| 1791 |
% |
| 1792 |
% \begin{macro}{\@readbib} |
| 1793 |
% \begin{macro}{\@xreadbib} |
| 1794 |
% These macros read the next token and take the appropriate action. |
| 1795 |
% \begin{macrocode} |
| 1796 |
\def\@readbib{\futurelet\@tok\@xreadbib}% |
| 1797 |
\def\@xreadbib{% |
| 1798 |
\ifx\@tok\@sptoken\let\@tempa\@readsp |
| 1799 |
\else\ifx\@tok\par\let\@tempa\@readpar |
| 1800 |
\else\ifx\@tok\bibitem\let\@tempa\@endbibitem |
| 1801 |
\else\ifx\@tok\end\let\@tempa\@checkendbib |
| 1802 |
\else\if@newlist\let\@tempa\@noitemerr |
| 1803 |
\else\ifx\@tok\@bgroup\let\@tempa\@eat\afterassignment\@begingroup |
| 1804 |
\else\ifx\@tok\@egroup\let\@tempa\@eat\afterassignment\@endgroup |
| 1805 |
\else\ifx\@tok\verb\let\@tempa\relax |
| 1806 |
\else\let\@tempa\@addtotxt |
| 1807 |
\fi\fi\fi\fi\fi\fi\fi\fi\@tempa}% |
| 1808 |
% \end{macrocode} |
| 1809 |
% \end{macro} |
| 1810 |
% \end{macro} |
| 1811 |
% |
| 1812 |
% \begin{macro}{\bibitem} |
| 1813 |
% \begin{macro}{\@bibitem} |
| 1814 |
% \begin{macro}{\@lbibitem} |
| 1815 |
% The macro |\bibitem| is called if the next token is |\bibitem|. It |
| 1816 |
% calls |\@lbibitem| or |\@bibitem| depending on whether a label is |
| 1817 |
% provided or not. If no label is provided, |\@bibitem| provides one. |
| 1818 |
% The definition of this macro depends on the switch |\iffb@firstcite| |
| 1819 |
% which is true iff a |firstcite|\SpecialOptionIndex{firstcite} option |
| 1820 |
% was used. If so, a \emph{dynamic} label\Index{dynamic}{label} is |
| 1821 |
% provided. Otherwise, a \emph{static} label\Index{static}{label} is |
| 1822 |
% provided which is the current value of the counter |\fb@refcount|. |
| 1823 |
% \begin{macrocode} |
| 1824 |
\def\bibitem{% |
| 1825 |
\@errifbraces>% |
| 1826 |
\@newlistfalse |
| 1827 |
\@ifnextchar[\@lbibitem\@bibitem}% |
| 1828 |
\iffb@firstcite |
| 1829 |
\def\@bibitem{\@lbibitem[\fb@setlbl]}% |
| 1830 |
\else |
| 1831 |
\def\@bibitem{% |
| 1832 |
\advance\fb@refcount\@ne |
| 1833 |
\expandafter\@lbibitem\expandafter[\the\fb@refcount]}% |
| 1834 |
\fi |
| 1835 |
\def\@lbibitem[##1]##2{% |
| 1836 |
\fb@lbl{{##1}}% |
| 1837 |
\fb@vedef\fb@key{##2}% |
| 1838 |
\fb@txt{}% |
| 1839 |
\let\@lastsptok\@empty |
| 1840 |
\@inlabeltrue |
| 1841 |
\@readbib}% |
| 1842 |
% \end{macrocode} |
| 1843 |
% \end{macro} |
| 1844 |
% \end{macro} |
| 1845 |
% \end{macro} |
| 1846 |
% \begin{macro}{\@checkendbib} |
| 1847 |
% The macro |\@checkendbib| is called when the next token is |\end|. It |
| 1848 |
% reads the argument of |\end| and checks whether it is |
| 1849 |
% |thebibliography|. If so it calls |\@endbibitem| to terminate the |
| 1850 |
% current reference (if any) and reinserts |\end{thebibliography}| which will |
| 1851 |
% terminate the bibliography. |
| 1852 |
% \begin{macrocode} |
| 1853 |
\def\@checkendbib\end##1{% |
| 1854 |
\def\@tempa{##1}\def\@tempb{thebibliography}% |
| 1855 |
\ifx\@tempa\@tempb |
| 1856 |
\def\@tempa{\@endbibitem\end{##1}}% |
| 1857 |
\else |
| 1858 |
\if@newlist |
| 1859 |
\let\@tempa\@noitemerr |
| 1860 |
\else |
| 1861 |
\def\@tempa{\@addtotxt{\end{##1}}}% |
| 1862 |
\fi |
| 1863 |
\fi\@tempa}% |
| 1864 |
% \end{macrocode} |
| 1865 |
% \end{macro} |
| 1866 |
% \begin{macro}{\@endbibitem} |
| 1867 |
% The macro |\@endbibitem| terminates the current reference (if any) and |
| 1868 |
% calls |\fb@setref| which stores it in a macro. If the switch |
| 1869 |
% |\iffb@xref| is true, i.e~a |citeonce*|\SpecialOptionIndex{citeonce*} |
| 1870 |
% option was used, |
| 1871 |
% |\@endbibitem| adds to the text of the reference the command |
| 1872 |
% |\fb@settxt| which will modify it dynamically. |
| 1873 |
% \begin{macrocode} |
| 1874 |
\def\@endbibitem{% |
| 1875 |
\if@newlist\else |
| 1876 |
\@errifbraces>% |
| 1877 |
\iffb@xref |
| 1878 |
\fb@txt\expandafter{\expandafter\fb@settxt\expandafter{\the\fb@txt}}% |
| 1879 |
\fi |
| 1880 |
\fb@setref |
| 1881 |
\fi}% |
| 1882 |
% \end{macrocode} |
| 1883 |
% \end{macro} |
| 1884 |
% \begin{macro}{\@addtotxt} |
| 1885 |
% The macro |\@addtotxt| adds to the text of the reference so far, first |
| 1886 |
% the last \emph{space} token (\meta{space} or |\par|) and then its |
| 1887 |
% argument. |
| 1888 |
% \begin{macrocode} |
| 1889 |
\long\def\@addtotxt##1{% |
| 1890 |
\fb@txt\expandafter\expandafter\expandafter |
| 1891 |
{\expandafter\the\expandafter\fb@txt\@lastsptok##1}% |
| 1892 |
\let\@lastsptok\@empty |
| 1893 |
\@inlabelfalse |
| 1894 |
\@readbib}% |
| 1895 |
% \end{macrocode} |
| 1896 |
% \end{macro} |
| 1897 |
% \begin{macro}{\@readsp} |
| 1898 |
% \begin{macro}{\@readpar} |
| 1899 |
% \begin{macro}{\@lastsptok} |
| 1900 |
% The \emph{space} tokens \meta{space} and |\par| are handled in a |
| 1901 |
% delayed way. They are first recorded in a single place |
| 1902 |
% (|\@lastsptok|), so that each one overrides the previous one. |
| 1903 |
% The most recent one is added to the text of the reference each time |
| 1904 |
% |\@addtotxt| is called. This mechanism discards any space preceding |
| 1905 |
% a |\par| token and also the |\par| which occurs generally at the |
| 1906 |
% end of each reference. |
| 1907 |
% \begin{macrocode} |
| 1908 |
\expandafter\def\expandafter\@readsp\space{% |
| 1909 |
\if@inlabel\else\let\@lastsptok\space\fi |
| 1910 |
\@readbib}% |
| 1911 |
\def\@readpar\par{% |
| 1912 |
\if@inlabel\else\def\@lastsptok{\par}\fi |
| 1913 |
\@readbib}% |
| 1914 |
% \end{macrocode} |
| 1915 |
% \end{macro} |
| 1916 |
% \end{macro} |
| 1917 |
% \end{macro} |
| 1918 |
% \begin{macro}{\@begingroup} |
| 1919 |
% \begin{macro}{\@endgroup} |
| 1920 |
% The macros |\@begingroup| and |\@endgroup| are called when a begin- |
| 1921 |
% or end-group character is seen. |\@begingroup| opens a new group and |
| 1922 |
% increments the counter |\@bracelevel|. It also records the number of the |
| 1923 |
% input line which may be used later for error reporting. |\@endgroup| closes |
| 1924 |
% the group, which restores the previous value of |\@bracelevel|, and calls |
| 1925 |
% |\@addtotxt| to add the group to the text of the reference so far. |
| 1926 |
% \begin{macrocode} |
| 1927 |
\def\@begingroup{% |
| 1928 |
\@bgroup |
| 1929 |
\advance\@bracelevel\@ne |
| 1930 |
\@bgrouplineno=\inputlineno |
| 1931 |
\fb@txt{}% |
| 1932 |
\let\@lastsptok\@empty |
| 1933 |
\@readbib}% |
| 1934 |
\def\@endgroup{% |
| 1935 |
\@errifbraces=% |
| 1936 |
\edef\@tempa{\@egroup\noexpand\@addtotxt{{\the\fb@txt\@lastsptok}}}% |
| 1937 |
\@tempa}% |
| 1938 |
% \end{macrocode} |
| 1939 |
% \end{macro} |
| 1940 |
% \end{macro} |
| 1941 |
% \begin{macro}{\verb} |
| 1942 |
% \begin{macro}{\@sverb} |
| 1943 |
% We provide special support for the |\verb| command. The following code |
| 1944 |
% is essentially borrowed from the \LaTeXe\ kernel. Just we let the |
| 1945 |
% active characters equal to |\relax| so that they are not expanded. |
| 1946 |
% \begin{macrocode} |
| 1947 |
\def\verb{% |
| 1948 |
\begingroup |
| 1949 |
% \end{macrocode} |
| 1950 |
% First make all special characters `other' |
| 1951 |
% \begin{macrocode} |
| 1952 |
\let\do\@makeother \dospecials |
| 1953 |
% \end{macrocode} |
| 1954 |
% Avoid ligatures |
| 1955 |
% \begin{macrocode} |
| 1956 |
\def\do####1{\@actlet####1\relax}\verbatim@nolig@list |
| 1957 |
% \end{macrocode} |
| 1958 |
% An end of line character in the argument of |\verb| is an error. |
| 1959 |
% \begin{macrocode} |
| 1960 |
\@actlet\^^M\verb@eol@error |
| 1961 |
\@ifstar{\@sverb*}{\@actlet\ \relax\@sverb\@empty}}% |
| 1962 |
\def\@sverb##1##2{% |
| 1963 |
\@actlet##2\verb@egroup |
| 1964 |
% \end{macrocode} |
| 1965 |
% Read the argument of |\verb|. |
| 1966 |
% \begin{macrocode} |
| 1967 |
\edef\@tempa{\noexpand\verb##1\noexpand~\iffalse}\fi}% |
| 1968 |
% \end{macrocode} |
| 1969 |
% \end{macro} |
| 1970 |
% \end{macro} |
| 1971 |
% \begin{macro}{\verb@egroup} |
| 1972 |
% Normal termination of |\verb|. The |~| must be protected against expansion |
| 1973 |
% because we are still inside the |\edef| started by |\@sverb|. |
| 1974 |
% \begin{macrocode} |
| 1975 |
\def\verb@egroup{% |
| 1976 |
\noexpand~\iffalse{\fi}% |
| 1977 |
\expandafter\endgroup\expandafter\@addtotxt\expandafter{\@tempa}}% |
| 1978 |
% \end{macrocode} |
| 1979 |
% \end{macro} |
| 1980 |
% \begin{macro}{\verb@eol@error} |
| 1981 |
% The macro |\verb@eol@error| is called if an end of line character |
| 1982 |
% occurs before the normal termination of |\verb|. Unlike it is done in the |
| 1983 |
% \LaTeXe\ kernel, we do not terminate the |\verb| because the most frequent |
| 1984 |
% case is when \BibTeX\ breaks the argument of |\verb| because the line is too |
| 1985 |
% long. The closing delimiter will generally be found on the next line. |
| 1986 |
% \begin{macrocode} |
| 1987 |
\def\verb@eol@error{\iffalse{\fi}% |
| 1988 |
\GenericError\@empty{LaTeX Error: |
| 1989 |
\noexpand\verb ended by end of line\@on@line}\@gobble% |
| 1990 |
{The argument of \string\verb\@on@line\space contains |
| 1991 |
an end of line.\MessageBreak |
| 1992 |
Type \space X <return> \space to quit.\MessageBreak}% |
| 1993 |
% \end{macrocode} |
| 1994 |
% We try to recover from error in case the user types \meta{return} at the |
| 1995 |
% prompt. We where defining |\@tempa| which contains now |
| 1996 |
% |\verb|?|~|\dots\ where\ ?\ stands for |*| or nothing. |
| 1997 |
% \begin{macrocode} |
| 1998 |
\toks@\expandafter{\@tempa}% |
| 1999 |
\edef\@tempa{\the\toks@\iffalse}\fi}% |
| 2000 |
% \end{macrocode} |
| 2001 |
% \end{macro} |
| 2002 |
% Some initialisation before starting to read the |
| 2003 |
% bibliography. |
| 2004 |
% \begin{macrocode} |
| 2005 |
\@bracelevel\z@ |
| 2006 |
\@newlisttrue |
| 2007 |
\@inlabeltrue |
| 2008 |
% \end{macrocode} |
| 2009 |
% And finally start to read the bibliography. This is the end of |
| 2010 |
% |\fb@thebibliography| |
| 2011 |
% \begin{macrocode} |
| 2012 |
\@readbib} |
| 2013 |
% \end{macrocode} |
| 2014 |
% \end{macro} |
| 2015 |
% |
| 2016 |
% At the end of the document, we first do a |\clearpage| to be sure |
| 2017 |
% that all the writes have been performed. Then we close the |
| 2018 |
% auxiliary file and finally read it to check whether any change |
| 2019 |
% occured between the previous run and the current one. If so, we issue a |
| 2020 |
% warning. |
| 2021 |
% \begin{macrocode} |
| 2022 |
\AtEndDocument{% |
| 2023 |
\clearpage |
| 2024 |
\if@filesw |
| 2025 |
\immediate\closeout\fb@auxout |
| 2026 |
\begingroup |
| 2027 |
\let\citation\@gobble \let\bibstyle\@gobble \let\bibdata\@gobble |
| 2028 |
\def\bibcite#1#2#3#4#5{% |
| 2029 |
\advance\fb@citecount\@ne |
| 2030 |
\fb@vedef\@tempa{#1}% |
| 2031 |
\edef\@tempa{{\@tempa}{#2}{#3}{#4}{#5}}% |
| 2032 |
\expandafter\ifx\csname fb@c.\the\fb@citecount\endcsname |
| 2033 |
% \end{macrocode} |
| 2034 |
% \FbIndex{\fb@c.\noexpand~{num}}^^A |
| 2035 |
% \begin{macrocode} |
| 2036 |
\@tempa\else\@tempswatrue\fi}% |
| 2037 |
\fb@citecount\z@ |
| 2038 |
\@tempswafalse |
| 2039 |
\input\[email protected] |
| 2040 |
\if@tempswa |
| 2041 |
\PackageWarning{footbib}{Bibliography not yet stable. Rerun |
| 2042 |
LaTeX\@gobble}% |
| 2043 |
\fi |
| 2044 |
\endgroup |
| 2045 |
\fi} |
| 2046 |
% \end{macrocode} |
| 2047 |
% |
| 2048 |
% \subsection{Output routine} |
| 2049 |
% |
| 2050 |
% We redefine the macros |\@specialoutput|, |\@doclearpage|, |
| 2051 |
% |\@makecol| and |\@reinserts| used by the output routine of \LaTeX\ |
| 2052 |
% so that we may insert the foot bibliography. |
| 2053 |
% The code is just a patch to the macros defined in the \LaTeXe\ kernel. |
| 2054 |
% |
| 2055 |
% \begin{macro}{\@specialoutput} |
| 2056 |
% If a foot bibliography is present, |\@specialoutput| must add to |
| 2057 |
% the height of the page the height plus depth of the foot |
| 2058 |
% bibliography and the length of the skip above it. |
| 2059 |
% \begin{macrocode} |
| 2060 |
\def\@specialoutput{% |
| 2061 |
\ifnum \outputpenalty>-\@Mii |
| 2062 |
\@doclearpage |
| 2063 |
\else |
| 2064 |
\ifnum \outputpenalty<-\@Miii |
| 2065 |
\ifnum \outputpenalty<-\@MM \deadcycles \z@ \fi |
| 2066 |
\global \setbox\@holdpg \vbox {\unvbox\@cclv}% |
| 2067 |
\else |
| 2068 |
\global \setbox\@holdpg \vbox{% |
| 2069 |
\unvbox\@holdpg |
| 2070 |
\unvbox\@cclv |
| 2071 |
\setbox\@tempboxa \lastbox |
| 2072 |
\unskip}% |
| 2073 |
\@pagedp \dp\@holdpg |
| 2074 |
\@pageht \ht\@holdpg |
| 2075 |
\unvbox \@holdpg |
| 2076 |
\@next\@currbox\@currlist{% |
| 2077 |
\ifnum \count\@currbox>\z@ |
| 2078 |
\advance \@pageht \@pagedp |
| 2079 |
\ifvoid\footins \else |
| 2080 |
\advance \@pageht \ht\footins |
| 2081 |
\advance \@pageht \skip\footins |
| 2082 |
\advance \@pageht \dp\footins |
| 2083 |
\fi |
| 2084 |
% \end{macrocode} |
| 2085 |
% \begin{FbPatch}{addition} |
| 2086 |
% \begin{macrocode} |
| 2087 |
\ifvoid\fb@ins\else |
| 2088 |
\advance\@pageht\ht\fb@ins |
| 2089 |
\advance\@pageht\skip\fb@ins |
| 2090 |
\advance\@pageht\dp\fb@ins |
| 2091 |
\fi |
| 2092 |
% \end{macrocode} |
| 2093 |
% \end{FbPatch} |
| 2094 |
% \begin{macrocode} |
| 2095 |
\ifvbox \@kludgeins |
| 2096 |
\ifdim \wd\@kludgeins=\z@ |
| 2097 |
\advance \@pageht \ht\@kludgeins |
| 2098 |
\fi |
| 2099 |
\fi |
| 2100 |
\@reinserts |
| 2101 |
\@addtocurcol |
| 2102 |
\else |
| 2103 |
\@reinserts |
| 2104 |
\@addmarginpar |
| 2105 |
\fi}% |
| 2106 |
\@latexbug |
| 2107 |
\ifnum \outputpenalty<\z@ |
| 2108 |
\if@nobreak |
| 2109 |
\nobreak |
| 2110 |
\else |
| 2111 |
\addpenalty \interlinepenalty |
| 2112 |
\fi |
| 2113 |
\fi |
| 2114 |
\fi |
| 2115 |
\fi} |
| 2116 |
% \end{macrocode} |
| 2117 |
% \end{macro} |
| 2118 |
% |
| 2119 |
% \begin{macro}{\@doclearpage} |
| 2120 |
% The test at the beginning of |\@doclearpage| has been modified so that |
| 2121 |
% it checks that \emph{both} footnotes and the foot bibliography are empty. |
| 2122 |
% \begin{macrocode} |
| 2123 |
\def \@doclearpage {% |
| 2124 |
% \end{macrocode} |
| 2125 |
% \begin{FbPatch}{modification} |
| 2126 |
% \begin{macrocode} |
| 2127 |
% \ifvoid\footins |
| 2128 |
\@tempswatrue |
| 2129 |
\ifvoid\footins\else\@tempswafalse\fi |
| 2130 |
\ifvoid\fb@ins\else\@tempswafalse\fi |
| 2131 |
\if@tempswa |
| 2132 |
% \end{macrocode} |
| 2133 |
% \end{FbPatch} |
| 2134 |
% \begin{macrocode} |
| 2135 |
\ifvbox\@kludgeins |
| 2136 |
{\setbox \@tempboxa \box \@kludgeins}% |
| 2137 |
\fi |
| 2138 |
\setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa |
| 2139 |
\setbox\@tempboxa\box\@cclv |
| 2140 |
\xdef\@deferlist{\@toplist\@botlist\@deferlist}% |
| 2141 |
\global \let \@toplist \@empty |
| 2142 |
\global \let \@botlist \@empty |
| 2143 |
\global \@colroom \@colht |
| 2144 |
\ifx \@currlist\@empty |
| 2145 |
\else |
| 2146 |
\@latexerr{Float(s) lost}\@ehb |
| 2147 |
\global \let \@currlist \@empty |
| 2148 |
\fi |
| 2149 |
\@makefcolumn\@deferlist |
| 2150 |
\@whilesw\if@fcolmade \fi{\@opcol\@makefcolumn\@deferlist}% |
| 2151 |
\if@twocolumn |
| 2152 |
\if@firstcolumn |
| 2153 |
\xdef\@dbldeferlist{\@dbltoplist\@dbldeferlist}% |
| 2154 |
\global \let \@dbltoplist \@empty |
| 2155 |
\global \@colht \textheight |
| 2156 |
\begingroup |
| 2157 |
\@dblfloatplacement |
| 2158 |
\@makefcolumn\@dbldeferlist |
| 2159 |
\@whilesw\if@fcolmade \fi{\@outputpage\@makefcolumn\@dbldeferlist}% |
| 2160 |
\endgroup |
| 2161 |
\else |
| 2162 |
\vbox{}\clearpage |
| 2163 |
\fi |
| 2164 |
\fi |
| 2165 |
\else |
| 2166 |
\setbox\@cclv\vbox{\box\@cclv\vfil}% |
| 2167 |
\@makecol\@opcol |
| 2168 |
\clearpage |
| 2169 |
\fi} |
| 2170 |
% \end{macrocode} |
| 2171 |
% \end{macro} |
| 2172 |
% |
| 2173 |
% \begin{macro}{\@makecol} |
| 2174 |
% In addition to footnotes (if any), |\@makecol| must add the foot |
| 2175 |
% bibliography to the page. It is added immediately below the footnotes. |
| 2176 |
% The test at the beginning of |\@makecol| has been modified in the same |
| 2177 |
% way as in |\@doclearpage| |
| 2178 |
% \begin{macrocode} |
| 2179 |
\def \@makecol {% |
| 2180 |
% \end{macrocode} |
| 2181 |
% \begin{FbPatch}{modification} |
| 2182 |
% \begin{macrocode} |
| 2183 |
% \ifvoid\footins |
| 2184 |
\@tempswatrue |
| 2185 |
\ifvoid\footins\else\@tempswafalse\fi |
| 2186 |
\ifvoid\fb@ins\else\@tempswafalse\fi |
| 2187 |
\if@tempswa |
| 2188 |
% \end{macrocode} |
| 2189 |
% \end{FbPatch} |
| 2190 |
% \begin{macrocode} |
| 2191 |
\setbox\@outputbox \box\@cclv |
| 2192 |
\else |
| 2193 |
\setbox\@outputbox \vbox {% |
| 2194 |
\boxmaxdepth \@maxdepth |
| 2195 |
\unvbox \@cclv |
| 2196 |
% \end{macrocode} |
| 2197 |
% \begin{FbPatch}{addition} |
| 2198 |
% \begin{macrocode} |
| 2199 |
\ifvoid\footins \else |
| 2200 |
% \end{macrocode} |
| 2201 |
% \end{FbPatch} |
| 2202 |
% \begin{macrocode} |
| 2203 |
\vskip \skip\footins |
| 2204 |
\color@begingroup |
| 2205 |
\normalcolor |
| 2206 |
\footnoterule |
| 2207 |
\unvbox \footins |
| 2208 |
\color@endgroup |
| 2209 |
% \end{macrocode} |
| 2210 |
% \begin{FbPatch}{addition} |
| 2211 |
% \begin{macrocode} |
| 2212 |
\fi |
| 2213 |
\ifvoid\fb@ins\else |
| 2214 |
\vskip\skip\fb@ins |
| 2215 |
\color@begingroup |
| 2216 |
\normalcolor |
| 2217 |
\footbibrule |
| 2218 |
\unvbox\fb@ins |
| 2219 |
\color@endgroup |
| 2220 |
\fi |
| 2221 |
% \end{macrocode} |
| 2222 |
% \end{FbPatch} |
| 2223 |
% \begin{macrocode} |
| 2224 |
}% |
| 2225 |
\fi |
| 2226 |
\let\@elt\relax |
| 2227 |
\xdef\@freelist{\@freelist\@midlist}% |
| 2228 |
\global \let \@midlist \@empty |
| 2229 |
\@combinefloats |
| 2230 |
\ifvbox\@kludgeins |
| 2231 |
\@makespecialcolbox |
| 2232 |
\else |
| 2233 |
\setbox\@outputbox \vbox to\@colht {% |
| 2234 |
\@texttop |
| 2235 |
\dimen@ \dp\@outputbox |
| 2236 |
\unvbox \@outputbox |
| 2237 |
\vskip -\dimen@ |
| 2238 |
\@textbottom}% |
| 2239 |
\fi |
| 2240 |
\global \maxdepth \@maxdepth} |
| 2241 |
% \end{macrocode} |
| 2242 |
% \end{macro} |
| 2243 |
% |
| 2244 |
% \begin{macro}{\@reinserts} |
| 2245 |
% The macro |\@reinsert| was modified to reinsert also the foot |
| 2246 |
% bibliography after float processing. |
| 2247 |
% \begin{macrocode} |
| 2248 |
\def\@reinserts{% |
| 2249 |
\ifvoid\footins\else\insert\footins{\unvbox\footins}\fi |
| 2250 |
% \end{macrocode} |
| 2251 |
% \begin{FbPatch}{addition} |
| 2252 |
% \begin{macrocode} |
| 2253 |
\ifvoid\fb@ins\else\insert\fb@ins{\unvbox\fb@ins}\fi |
| 2254 |
% \end{macrocode} |
| 2255 |
% \end{FbPatch} |
| 2256 |
% \begin{macrocode} |
| 2257 |
\ifvbox\@kludgeins\insert\@kludgeins{\unvbox\@kludgeins}\fi} |
| 2258 |
% \end{macrocode} |
| 2259 |
% \end{macro} |
| 2260 |
% \begin{macrocode} |
| 2261 |
\endinput |
| 2262 |
%</package> |
| 2263 |
% \end{macrocode} |
| 2264 |
% |
| 2265 |
% \Finale |