| 1 |
% \iffalse |
| 2 |
%<pfnote>%% Style file `pfnote'. |
| 3 |
%<fnpos>%% Style file `fnpos'. |
| 4 |
%<dblfnote>%% Style file `dblfnote'. |
| 5 |
%% Copyright (C) 1999-2018 |
| 6 |
%% Hiroshi Nakashima <h.nakashima@DOMAIN; DOMAIN=media.kyoto-u.ac.jp> |
| 7 |
%% (Kyoto University) |
| 8 |
%% |
| 9 |
%% This program can be redistributed and/or modified under the terms |
| 10 |
%% of the LaTeX Project Public License distributed from CTAN |
| 11 |
%% archives in directory macros/latex/base/lppl.txt; either |
| 12 |
%% version 1 of the License, or any later version. |
| 13 |
%% |
| 14 |
% \fi |
| 15 |
% |
| 16 |
% \CheckSum{802} |
| 17 |
%% \CharacterTable |
| 18 |
%% {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 |
| 19 |
%% 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 |
| 20 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 21 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 22 |
%% Dollar \$ Percent \% Ampersand \& |
| 23 |
%% Acute accent \' Left paren \( Right paren \) |
| 24 |
%% Asterisk \* Plus \+ Comma \, |
| 25 |
%% Minus \- Point \. Solidus \/ |
| 26 |
%% Colon \: Semicolon \; Less than \< |
| 27 |
%% Equals \= Greater than \> Question mark \? |
| 28 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 29 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 30 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 31 |
%% Right brace \} Tilde \~} |
| 32 |
%% |
| 33 |
% \iffalse |
| 34 |
%% |
| 35 |
%<*dtx> |
| 36 |
\ProvidesFile{yafoot.dtx} |
| 37 |
%</dtx> |
| 38 |
%<pfnote|fnpos|dblfnote>\def\next{LaTeX2e} |
| 39 |
%<pfnote|fnpos|dblfnote>\ifx\fmtname\next |
| 40 |
%<pfnote|fnpos|dblfnote>\def\next{ |
| 41 |
%<pfnote|fnpos|dblfnote>\NeedsTeXFormat{LaTeX2e}[1994/12/01] |
| 42 |
%<pfnote>\ProvidesPackage{pfnote}} |
| 43 |
%<fnpos>\ProvidesPackage{fnpos}} |
| 44 |
%<dblfnote>\ProvidesPackage{dblfnote}} |
| 45 |
%<pfnote|fnpos|dblfnote>\else\def\next[#1]{}\fi |
| 46 |
%<pfnote|fnpos|dblfnote>\next |
| 47 |
%<driver>\ProvidesFile{yafoot-man.tex} |
| 48 |
% \fi |
| 49 |
% \ProvidesFile{yafoot.dtx} |
| 50 |
[2018/09/03 v1.1 ] |
| 51 |
% \iffalse |
| 52 |
%<*driver> |
| 53 |
\documentclass{ltxdoc} |
| 54 |
\usepackage{pfnote} |
| 55 |
\usepackage{fnpos} |
| 56 |
\usepackage{dblfnote} |
| 57 |
\DisableCrossrefs |
| 58 |
\PageIndex |
| 59 |
\CodelineNumbered |
| 60 |
\RecordChanges |
| 61 |
%</driver> |
| 62 |
%<driver>\OnlyDescription |
| 63 |
%<driver>\def\ONLYDESCRIPTION{} |
| 64 |
%<*driver> |
| 65 |
\advance\textwidth4em |
| 66 |
\DFNcolumnsep1.5\columnsep |
| 67 |
\begin{document} |
| 68 |
\DocInput{yafoot.dtx} |
| 69 |
\end{document} |
| 70 |
%</driver> |
| 71 |
% \fi |
| 72 |
% |
| 73 |
% \makeatletter |
| 74 |
% |
| 75 |
% \newcount\ChangeCount \ChangeCount10000 |
| 76 |
% \def\changes@#1#2#3{% |
| 77 |
% \global\advance\ChangeCount\@ne |
| 78 |
% \protected@edef\@tempa{\noexpand\glossary{#1\levelchar |
| 79 |
% \number\ChangeCount |
| 80 |
% \actualchar |
| 81 |
% \ifx\saved@macroname\@empty |
| 82 |
% \generalname |
| 83 |
% \else |
| 84 |
% \string\verb\quotechar* |
| 85 |
% \verbatimchar\saved@macroname |
| 86 |
% \verbatimchar |
| 87 |
% \fi |
| 88 |
% :\levelchar #3}}% |
| 89 |
% \@tempa\endgroup\@esphack} |
| 90 |
% |
| 91 |
% \def\theglossary{\onecolumn \glossary@prologue |
| 92 |
% \GlossaryParms \let\item\@idxitem |
| 93 |
% \rightskip 1em plus 1fil |
| 94 |
% \parfillskip-1em |
| 95 |
% \ignorespaces} |
| 96 |
% \def\endtheglossary{\relax} |
| 97 |
% |
| 98 |
% \changes{v0.1}{1991/10/29} |
| 99 |
% {The style pfnote is born.} |
| 100 |
% \changes{v0.2}{1993/05/20} |
| 101 |
% {Footnote pushing function is posted to comp.text.tex.} |
| 102 |
% \changes{v0.3}{1993/08/17} |
| 103 |
% {Exchanging footnotes and bottom floats in fnpos is posted to |
| 104 |
% fj.comp.texhax.} |
| 105 |
% \changes{v0.4}{1995/06/21} |
| 106 |
% {First version of dblfnote is posted to comp.text.tex.} |
| 107 |
% \changes{v1.0}{1999/07/14} |
| 108 |
% {Three styles are merged into yafoot.dtx and rewritten.} |
| 109 |
% \changes{v1.1-1}{2018/09/03} |
| 110 |
% {Fix a footnote coloring problem in \string\textsf{fnpos}. (2018/09/03)} |
| 111 |
% |
| 112 |
% \errorcontextlines10000 |
| 113 |
% \GetFileInfo{yafoot.dtx} |
| 114 |
% \setcounter{IndexColumns}{2} |
| 115 |
% |
| 116 |
% \def\bottomfraction{.9} |
| 117 |
% \def\cs#1{\hbox{\tt\char\escapechar#1}} |
| 118 |
% \def\Item{\vskip-\itemsep\vskip-\parsep\vskip0pt\item} |
| 119 |
% |
| 120 |
% \makeatletter |
| 121 |
% \def\nosv{\catcode`\|12} |
| 122 |
% |
| 123 |
% \def\eqnarray{\stepcounter{equation}\let\@currentlabel=\theequation |
| 124 |
% \global\@eqnswtrue |
| 125 |
% \global\@eqcnt\z@\tabskip\@centering\let\\=\@eqncr |
| 126 |
% $$\halign to \displaywidth\bgroup\hskip\@centering |
| 127 |
% $\displaystyle\tabskip\z@{##}$\@eqnsel&\global\@eqcnt\@ne |
| 128 |
% \hfil$\;{##}\;$\hfil |
| 129 |
% &\global\@eqcnt\tw@ $\displaystyle\tabskip\z@{##}$\hfil |
| 130 |
% \tabskip\@centering&\llap{##}\tabskip\z@\cr} |
| 131 |
% |
| 132 |
% \def\Meta#1{\penalty\@highpenalty |
| 133 |
% \hbox{{\tt\char`\{}{\it\meta{#1}}{\tt\char`\}}}} |
| 134 |
% \def\opt#1{{\tt[}{\it\meta{#1}}{\tt]}} |
| 135 |
% \def\optn#1{{\tt[#1]}} |
| 136 |
% \def\arg#1{{\tt\char`\{#1\char`\}}} |
| 137 |
% |
| 138 |
% \let\latex@addmarginpar\@addmarginpar |
| 139 |
% \let\latex@latex@warning@no@line\@latex@warning@no@line |
| 140 |
% \def\@addmarginpar{\let\@latex@warning@no@line\@gobble |
| 141 |
% \latex@addmarginpar |
| 142 |
% \let\@latex@warning@no@line\latex@latex@warning@no@line} |
| 143 |
% \let\@font@warning\@gobble |
| 144 |
% |
| 145 |
% \long\def\m@cro@#1#2{\endgroup \topsep\MacroTopsep \trivlist |
| 146 |
% \edef\saved@macroname{\string#2} |
| 147 |
% \def\makelabel##1{\llap{##1\hskip\@totalleftmargin}} |
| 148 |
% \if@inlabel |
| 149 |
% \let\@tempa\@empty \count@\macro@cnt |
| 150 |
% \loop \ifnum\count@>\z@ |
| 151 |
% \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat |
| 152 |
% \edef\makelabel##1{\llap{\vtop to\baselineskip |
| 153 |
% {\@tempa\hbox{##1}\vss} |
| 154 |
% \hskip\@totalleftmargin}} |
| 155 |
% \advance \macro@cnt \@ne |
| 156 |
% \else \macro@cnt\@ne \fi |
| 157 |
% \edef\@tempa{\noexpand\item[ |
| 158 |
% #1 |
| 159 |
% \noexpand\PrintMacroName |
| 160 |
% \else |
| 161 |
% \noexpand\PrintEnvName |
| 162 |
% \fi |
| 163 |
% {\string#2}]} |
| 164 |
% \@tempa |
| 165 |
% \global\advance\c@CodelineNo\@ne |
| 166 |
% #1 |
| 167 |
% \SpecialMainIndex{#2}\nobreak |
| 168 |
% \DoNotIndex{#2} |
| 169 |
% \else |
| 170 |
% \SpecialMainEnvIndex{#2}\nobreak |
| 171 |
% \fi |
| 172 |
% \global\advance\c@CodelineNo\m@ne |
| 173 |
% \ignorespaces} |
| 174 |
% |
| 175 |
% \def\dummymacro{\topsep\MacroTopsep \trivlist \item[]} |
| 176 |
% \let\enddummymacro\endtrivlist |
| 177 |
% |
| 178 |
% \def\DescribeOpt{\leavevmode\@bsphack\begingroup\MakePrivateLetters |
| 179 |
% \Describe@Opt} |
| 180 |
% \def\Describe@Opt#1{\endgroup \Describe@pt{#1}} |
| 181 |
% \def\Describe@pt#1#2{ |
| 182 |
% \marginpar{\raggedleft\PrintDescribeMacro{#1}} |
| 183 |
% \SpecialOptUsageIndex{#1}{#2}} |
| 184 |
% \def\SpecialOptUsageIndex#1#2{ |
| 185 |
% \index{#1\actualchar{\protect\ttfamily#1} (#2)\encapchar usage} |
| 186 |
% \index{#2s:\levelchar{\protect\ttfamily#1}\encapchar usage} |
| 187 |
% \@esphack\ignorespaces} |
| 188 |
% \def\SpecialOptMainIndex#1#2{ |
| 189 |
% \index{#1\actualchar{\protect\ttfamily#1} (#2)\encapchar main} |
| 190 |
% \index{#2s:\levelchar{\protect\ttfamily#1}\encapchar main} |
| 191 |
% \@esphack\ignorespaces} |
| 192 |
% \def\SpecialOptIndex#1#2{ |
| 193 |
% \index{#1\actualchar{\protect\ttfamily#1} (#2)} |
| 194 |
% \index{#2s:\levelchar{\protect\ttfamily#1}} |
| 195 |
% \@esphack\ignorespaces} |
| 196 |
% \def\SpecialOptIndexS#1#2{ |
| 197 |
% \index{#1\actualchar{\protect\ttfamily#1} (#2)} |
| 198 |
% \index{#2es:\levelchar{\protect\ttfamily#1}} |
| 199 |
% \@esphack\ignorespaces} |
| 200 |
% |
| 201 |
% \begingroup |
| 202 |
% \gdef\@sverbcat{\catcode`\@\active\catcode`\#\active} |
| 203 |
% \catcode`\@\active \gdef@{\char`\@\penalty\exhyphenpenalty} |
| 204 |
% \catcode`\#\active \gdef#{\penalty\exhyphenpenalty} |
| 205 |
% \endgroup |
| 206 |
% \let\latex@sverb\@sverb |
| 207 |
% \def\@sverb{\@sverbcat\latex@sverb} |
| 208 |
% |
| 209 |
% \def\theglossary{\onecolumn \glossary@prologue |
| 210 |
% \GlossaryParms \let\item\@idxitem \ignorespaces} |
| 211 |
% \def\endtheglossary{\relax} |
| 212 |
% |
| 213 |
% |
| 214 |
% |
| 215 |
% \def\bracepair{`{\tt\char`\{\char`\}'}} |
| 216 |
% |
| 217 |
% \ifx\ONLYDESCRIPTION\undefined\else |
| 218 |
% \let\SpecialUsageIndex\SpecialMainIndex |
| 219 |
% \let\SpecialOptUsageIndex\SpecialOptMainIndex |
| 220 |
% \fi |
| 221 |
% |
| 222 |
% |
| 223 |
% |
| 224 |
% \title{\textsf{pfnote}, \textsf{fnpos} and \textsf{dblfnote}\\ |
| 225 |
% Packages for Footnotes\thanks{ |
| 226 |
% This file has version number \fileversion, last revised \filedate.}} |
| 227 |
% \author{Hiroshi Nakashima\\(Kyoto University)} |
| 228 |
% \date{\filedate} |
| 229 |
% \maketitle |
| 230 |
% |
| 231 |
% \begin{abstract} |
| 232 |
% This file provides three style files; \textsf{pfnote} to enclose footnote |
| 233 |
% numbering in a page; \textsf{fnpos} to control the vertical position of |
| 234 |
% footnotes; \textsf{dblfnote} to make footnote double-columned. |
| 235 |
% \end{abstract} |
| 236 |
% |
| 237 |
% \tableofcontents |
| 238 |
% \newpage |
| 239 |
% |
| 240 |
% |
| 241 |
% \section{Introduction} |
| 242 |
% \label{sec:intro} |
| 243 |
% |
| 244 |
% \LaTeX{} users often bother about fine points of footnote. How can I |
| 245 |
% reset |footnote| counter when a page is produced in order to keep the |
| 246 |
% counter from having too large, say 30, in a document with many footnotes? |
| 247 |
% How can I place footnotes at more appropriate position? How can I make |
| 248 |
% footnotes double-columned while main text is single-columned? |
| 249 |
% |
| 250 |
% The style files distributed with this document will solve these problems. |
| 251 |
% You will have the following three style files by processing |
| 252 |
% \textsf{yafoot.dtx}\footnote{ |
| 253 |
% |
| 254 |
% It stands for ``Yet Another FOOTnote.''} |
| 255 |
% |
| 256 |
% with \textsf{docstrip}. |
| 257 |
% |
| 258 |
% \begin{description} |
| 259 |
% \item[\textsf{pfnote}] |
| 260 |
% \DescribeOpt{pfnote}{style file} |
| 261 |
% provides a new version of |\footnote| to make footnote numbering enclosed |
| 262 |
% in a page. That is, the counter |footnote| is reset whenever a page is |
| 263 |
% produced and thus the first footnote in a page is numbered 1 no matter how |
| 264 |
% it stands in the sequence of footnotes in a document. Since this document |
| 265 |
% itself uses \textsf{pfnote}, you will see how footnotes are numbered. |
| 266 |
% |
| 267 |
% \item[\textsf{fnpos}] |
| 268 |
% \DescribeOpt{fnpos}{style file} |
| 269 |
% provides following commands to control the vertical position of footnotes. |
| 270 |
% |
| 271 |
% \begin{itemize} |
| 272 |
% \item |
| 273 |
% \DescribeMacro{\makeFNbottom} |
| 274 |
% \DescribeMacro{\makeFNmid} |
| 275 |
% |\makeFNbottom| makes footnotes always placed at the bottom of a |
| 276 |
% |\ragged#bottom| page, while |\makeFNmid| allows footnotes directly follow |
| 277 |
% the main text of a page as standard \LaTeX{} does. |
| 278 |
% |
| 279 |
% \item |
| 280 |
% \DescribeMacro{\makeFNbelow} |
| 281 |
% \DescribeMacro{\makeFNabove} |
| 282 |
% |\makeFNbelow| places footnotes below bottom floats (i.e. figures and |
| 283 |
% tables), while |\makeFNabove| is to place footnotes above bottom floats as |
| 284 |
% standard \LaTeX{} does. |
| 285 |
% \end{itemize} |
| 286 |
% |
| 287 |
% This document also uses \textsf{fnpos} to make footnotes {\em bottom} and |
| 288 |
% {\em below}\footnote{ |
| 289 |
% |
| 290 |
% But the effect will be hardly seen except in the right column of |
| 291 |
% page~\pageref{pag:shfnp-2} where we show the effect explicitly.}. |
| 292 |
% |
| 293 |
% The first version of these commands are posted by the author to news |
| 294 |
% groups |comp.text.tex| and |fj.comp.texhax| as the answers to the posts by |
| 295 |
% Martin Boyer and Nobuaki Minematsu. |
| 296 |
% |
| 297 |
% \item[\textsf{dblfnote}] |
| 298 |
% \DescribeOpt{dblfnote}{style file} |
| 299 |
% makes footnotes double-columned. It also provides a few commands to |
| 300 |
% control column breaking. The first version of the style file is created |
| 301 |
% for Tim Armstrong's post to |comp.text.tex|. Since this document uses |
| 302 |
% \textsf{dblfnote}, you will find that the footnotes\footnote{ |
| 303 |
%. |
| 304 |
% This document has many footnotes, some of which are just to show how our |
| 305 |
% footnote mechanisms work.} |
| 306 |
% |
| 307 |
% in this page are double-columned. |
| 308 |
% \end{description} |
| 309 |
% |
| 310 |
% Note that these style files may be used either solely, or combined each |
| 311 |
% other as done in this document. |
| 312 |
% |
| 313 |
% |
| 314 |
% |
| 315 |
% \section{Usage} |
| 316 |
% \label{sec:usage} |
| 317 |
% \subsection{Loading Style Files} |
| 318 |
% \label{sec:usage-load} |
| 319 |
% |
| 320 |
% All the three style files are usable to both \LaTeXe{} and \LaTeX-2.09 |
| 321 |
% users with their standard package loading declaration. If you use |
| 322 |
% \LaTeXe{} and wish to load, for example, \textsf{pfnote} and |
| 323 |
% \textsf{fnpos}, simply do the following. |
| 324 |
% |
| 325 |
% \begin{quote} |
| 326 |
% \SpecialUsageIndex{\usepackage} |
| 327 |
% |\usepackage{pfnote}|\\ |
| 328 |
% |\usepackage{fnpos}| |
| 329 |
% \end{quote} |
| 330 |
% |
| 331 |
% If you still love \LaTeX-2.09, the following is what you have to do. |
| 332 |
% |
| 333 |
% \begin{quote} |
| 334 |
% \SpecialUsageIndex{\documentstyle} |
| 335 |
% |\documentstyle[..,pfnote,fnpos,...]|\Meta{main-style} |
| 336 |
% \end{quote} |
| 337 |
% |
| 338 |
% Note that any combination of three styles are allowed and they are |
| 339 |
% insensitive to their loading order. |
| 340 |
% |
| 341 |
% |
| 342 |
% |
| 343 |
% \subsection{\textsf{pfnote}: Enclose Footnote Numbers within a Page} |
| 344 |
% \label{sec:usage-pfnote} |
| 345 |
% |
| 346 |
% \DescribeOpt{pfnote}{style file} |
| 347 |
% Just loading \textsf{pfnote} is everything that you have to do to make |
| 348 |
% footnote numbering enclosed in a page\footnote{ |
| 349 |
% |
| 350 |
% Here you will find this fourth footnote is numbered one.}. |
| 351 |
% |
| 352 |
% Only one thing you have to remember is that footnote numbers will be |
| 353 |
% adjusted after you run \LaTeX{} {\em twice}, as |\ref|-erences to |
| 354 |
% |\label|-s are. |
| 355 |
% |
| 356 |
% |
| 357 |
% |
| 358 |
% \subsection{\textsf{fnpos}: Control Vertical Position of Footnotes} |
| 359 |
% \label{sec:usage-fnpos} |
| 360 |
% |
| 361 |
% \DescribeOpt{fnpos}{style file} |
| 362 |
% The following four commands are available to control the vertical position |
| 363 |
% of footnotes. |
| 364 |
% |
| 365 |
% \begin{description} |
| 366 |
% \item[\cs{makeFNbottom}] |
| 367 |
% \DescribeMacro{\makeFNbottom} |
| 368 |
% \SpecialIndex{\raggedbottom} |
| 369 |
% makes footnotes always placed at the bottom of a |\raggedbottom| page, |
| 370 |
% even if the page is too short to push the footnotes to its bottom because, |
| 371 |
% for example, the page is broken just before a tall object such as a |
| 372 |
% |tabular|. This is default. |
| 373 |
% |
| 374 |
% \item[\cs{makeFNmid}] |
| 375 |
% \DescribeMacro{\maekFNmid} |
| 376 |
% cancels the effect of |\makeFNbottom| to allow footnotes directly follow |
| 377 |
% the main text of a page as standard \LaTeX{} does. |
| 378 |
% |
| 379 |
% \item[\cs{makeFNbelow}] |
| 380 |
% \DescribeMacro{\maekFNbelow} |
| 381 |
% places footnotes {\em below} bottom floats (i.e. figures and tables). |
| 382 |
% This is default. |
| 383 |
% |
| 384 |
% \item[\cs{makeFNabove}] |
| 385 |
% \DescribeMacro{\maekFNabove} |
| 386 |
% cancels the effect of |\makeFNbelow| to place footnotes {\em above} bottom |
| 387 |
% floats as standard \LaTeX{} does. |
| 388 |
% \end{description} |
| 389 |
% |
| 390 |
% Note that if you are using p\LaTeX{}, a Japanese version of \LaTeX, it |
| 391 |
% might be unnecessary to use \textsf{pfnote} because p\LaTeX{} does what |
| 392 |
% |\makeFNbottom| and |\makeFNbelow| do\footnote{ |
| 393 |
% |
| 394 |
% Very strictly speaking, the mechanism of p\LaTeX{} is slightly different |
| 395 |
% from that of \textsf{fnpos} but the difference is hardly recognizable.}. |
| 396 |
% |
| 397 |
% However, if you wish to follow the real \LaTeX's standard, |\makeFNmid| |
| 398 |
% and |\makeFNabove| will do for you. |
| 399 |
% |
| 400 |
% The following two two-columned pages show the effects of the commands. |
| 401 |
% |
| 402 |
% \newpage |
| 403 |
% \twocolumn |
| 404 |
% \def\showfnposleaders{\xleaders |
| 405 |
% \hbox to\hsize{\hss.\vrule height.3\baselineskip width0pt\hss}\vfil} |
| 406 |
% \def\showfnpos#1#2#3{\par#1#2\noindent |
| 407 |
% This column is typeset with \texttt{\string#1} and \texttt{\string#2} |
| 408 |
% \footnote{#3}.\par\nobreak |
| 409 |
% \vbox to.4\textheight{ |
| 410 |
% \showfnposleaders\smallskip |
| 411 |
% \centerline{(Main text of this column is here.)}\smallskip |
| 412 |
% \showfnposleaders} |
| 413 |
% \begin{figure}[b] |
| 414 |
% \fboxsep0pt |
| 415 |
% \hbox{\fbox{\vbox to.4\textheight{\vfil |
| 416 |
% \centerline{Here is a bottom float.}\vfil}}} |
| 417 |
% \end{figure} |
| 418 |
% \break} |
| 419 |
% |
| 420 |
% \label{pag:shfnp-1} |
| 421 |
% \showfnpos\makeFNmid\makeFNabove{ |
| 422 |
% Therefore, this footnote is {\em above} the bottom float leaving |
| 423 |
% spaces at the bottom of this column.} |
| 424 |
% |
| 425 |
% \showfnpos\makeFNmid\makeFNbelow{ |
| 426 |
% Therefore, this footnote is {\em below} the bottom float still |
| 427 |
% leaving spaces at the bottom of this column.} |
| 428 |
% |
| 429 |
% \label{pag:shfnp-2} |
| 430 |
% \showfnpos\makeFNbottom\makeFNabove{ |
| 431 |
% Therefore, this footnote is {\em above} the bottom float that is |
| 432 |
% pushed to the {\em bottom} of this column together with this footnote.} |
| 433 |
% |
| 434 |
% \showfnpos\makeFNbottom\makeFNbelow{ |
| 435 |
% Therefore, this footnote is {\em below} the bottom float, and at the |
| 436 |
% {\em bottom} of this column alone.} |
| 437 |
% |
| 438 |
% |
| 439 |
% |
| 440 |
% \newpage |
| 441 |
% \onecolumn\par |
| 442 |
% \subsection{\textsf{dblfnote}: Make Footnotes Double-Columned} |
| 443 |
% |
| 444 |
% \DescribeOpt{dblfnote}{style file} |
| 445 |
% Simply loading \textsf{dblfnote} will make footnotes double-columned. For |
| 446 |
% fine tuning of double-columning, however, you have a few style parameters |
| 447 |
% and commands as follows. |
| 448 |
% |
| 449 |
% \begin{description} |
| 450 |
% \item[\texttt{DFNsloppiness}] |
| 451 |
% \DescribeOpt{DFNsloppiness}{counter}% |
| 452 |
% defines how sloppy paragrahs in footnotes are typeset. Since lines of |
| 453 |
% footnotes are narrow, you might wish to typeset footnotes in some |
| 454 |
% |\sloppy| manner in order to avoid underfull. Setting |DFNsloppiness| to |
| 455 |
% larger value up to 9999, footnote paragraphs will be sloppier. The |
| 456 |
% default is 5000. |
| 457 |
% |
| 458 |
% \item[\cs{DFNcolumnsep}] |
| 459 |
% \begin{DFNinhibitcbreak}% |
| 460 |
% \DescribeMacro{\DFNcolumnsep}% |
| 461 |
% \SpecialIndex{\columnsep}% |
| 462 |
% is the distance of footnote columns is specified by the value of |
| 463 |
% |\DFNcolumn#sep|. If you don't set this parameter explicitly\footnote{ |
| 464 |
% |
| 465 |
% Strictly speaking, unless you set a non-negative value in the document |
| 466 |
% preamble.}, |
| 467 |
% |
| 468 |
% the value is that of |\columnsep|. For example, the author set |
| 469 |
% |\DFNcolumnsep| to $1.5\times\hbox{|\columnsep|}$ in this document. |
| 470 |
% \end{DFNinhibitcbreak} |
| 471 |
% |
| 472 |
% \item[\cs{DFNcolumnwidth}] |
| 473 |
% \DescribeMacro{\DFNcolumnwidth}% |
| 474 |
% is the width of a footnote column. If you don't set this parameter |
| 475 |
% explicitly, as expected, it is automatically set to |
| 476 |
% $(|\textwidth|-|\DFNcolumnsep|)/2$. |
| 477 |
% |
| 478 |
% \item[\cs{DFNallowcbreak}] |
| 479 |
% \DescribeMacro{\DFNallowcbreak} |
| 480 |
% \DescribeMacro{\DFNinhibitcbreak} |
| 481 |
% allows a footnote is broken into two columns, while {\bfseries |
| 482 |
% |\DFNinhibitcbreak|} inhibits it. In default, column breaking is allowed. |
| 483 |
% |
| 484 |
% \item[\cs{DFNtrysingle}] |
| 485 |
% \DescribeMacro{\DFNtrysingle} |
| 486 |
% \DescribeMacro{\DFNalwaysdouble} |
| 487 |
% places footnotes only in the left column if the page containing them has |
| 488 |
% enough space as shown in pages~1, |
| 489 |
% \pageref{sec:usage-fnpos} and this page, while {\bfseries |
| 490 |
% |\DFNalwaysdouble|} makes them double-columned (almost) always. In |
| 491 |
% default, single-columning is tried. |
| 492 |
% |
| 493 |
% \item[\cs{DFNruleleft}] |
| 494 |
% \DescribeMacro{\DFNruleleft} |
| 495 |
% \DescribeMacro{\DFNruleboth} |
| 496 |
% draws |\footnoterule| over footnotes in left column only, while {\bfseries |
| 497 |
% |\DFNrule#both|} draws in both columns. In default, the rule is drawn in |
| 498 |
% left column only. |
| 499 |
% \end{description} |
| 500 |
% |
| 501 |
% \SpecialIndex{\twocolumn} |
| 502 |
% \SpecialIndex{\onecolumn} |
| 503 |
% Note that \textsf{dblfnote} will do nothing if |\twocolumn| is in effect, |
| 504 |
% as shown in pages~\pageref{pag:shfnp-1} and~\pageref{pag:shfnp-2}. That |
| 505 |
% is, footnotes are put as in usual double-coulumned document. If you |
| 506 |
% change the page structure to |\onecolumn|, the mechanism of |
| 507 |
% \textsf{dblfnote} is enabled again as shown in this page. |
| 508 |
% |
| 509 |
% |
| 510 |
% \section{Known Problems} |
| 511 |
% \label{sec:prob} |
| 512 |
% |
| 513 |
% \begin{enumerate} |
| 514 |
% \item |
| 515 |
% \SpecialOptIndex{minipage}{environment} |
| 516 |
% The style \textsf{pfnote} does not enlose the number of footnotes in |
| 517 |
% |minipage| environment. |
| 518 |
% |
| 519 |
% \item |
| 520 |
% The style \textsf{dblfnote} may mistakingly produce a little bit too |
| 521 |
% short pages if an extremely long paragraph has footnotes. More |
| 522 |
% specifically, if a paragraph runs across three or more pages $p_1$, |
| 523 |
% \ldots, $p_n$, and its first and last footnote appears in $p_i$ ($i\leq n-2$) |
| 524 |
% and $p_j$ ($j>i$), pages $p_{i+1}$ to $p_j$ may be a little bit too short |
| 525 |
% especially for those without footnotes. |
| 526 |
% \end{enumerate} |
| 527 |
% |
| 528 |
% |
| 529 |
% |
| 530 |
% \IndexPrologue{\newpage\section*{Index} |
| 531 |
% Underlined number refers to the page where the specification of |
| 532 |
% corresponding entry is described.} |
| 533 |
% \StopEventually{ |
| 534 |
% \section*{Acknowledgments} |
| 535 |
% |
| 536 |
% The author thanks to Martin Boyer and Nobuaki Minematsu whose posts to |
| 537 |
% news groups triggered writing very first version of macros in |
| 538 |
% \textsf{fnpos}, and to Tim Armstrong whose post to \texttt{comp.text.tex} |
| 539 |
% encouraged him to make the first version of \textsf{dblfnote} that |
| 540 |
% requires considerable hack. He also thanks to Hironobu Yamashita who |
| 541 |
% found a bug, hidden in \textsf{fnpos} for 19 years (!!), by which |
| 542 |
% footnotes were colored inappropriately. |
| 543 |
% |
| 544 |
% For the implementation of three style files, the author refers the base |
| 545 |
% implementations of the macros for \cs{footnote} and for \cs{output} |
| 546 |
% routine. These macros are written by Leslie Lamport as a part of |
| 547 |
% \LaTeX-2.09 and \LaTeXe{} (1997/12/01) to which Johannes Braams and other |
| 548 |
% authors also contributed. |
| 549 |
% |
| 550 |
% \PrintIndex} |
| 551 |
% |
| 552 |
% |
| 553 |
% |
| 554 |
% \newpage |
| 555 |
% \section{Implementation} |
| 556 |
% \label{sec:imp} |
| 557 |
% \subsection{Tricks for Compatibility} |
| 558 |
% \label{sec:imp-compat} |
| 559 |
% |
| 560 |
% At the very beginning of each style file, we checks whether it is |
| 561 |
% loaded by \LaTeXe{} or \LaTeX-2.09, and then declares |\NeedsTeXFormat| |
| 562 |
% and |\ProvidesPackage| if \LaTeXe{}. This part is embedded at the |
| 563 |
% beginning of \textsf{yafoot.dtx} in a tricky manner to let |
| 564 |
% \textsf{docstrip} produce the following code, for example for |
| 565 |
% \textsf{pfnote}. |
| 566 |
% \SpecialIndex{\NeedsTeXFormat} |
| 567 |
% \SpecialIndex{\ProvidesPackage} |
| 568 |
% |
| 569 |
%\begin{quote} |
| 570 |
%\begin{verbatim} |
| 571 |
%\def\next{LaTeX2e} |
| 572 |
%\ifx\fmtname\next |
| 573 |
%\def\next{ |
| 574 |
%\NeedsTeXFormat{LaTeX2e}[1994/12/01] |
| 575 |
%\ProvidesPackage{pfnote}} |
| 576 |
%\else\def\next[#1]{}\fi |
| 577 |
%\next |
| 578 |
%[1999/07/14 v1.0 ] |
| 579 |
%\end{verbatim} |
| 580 |
%\end{quote} |
| 581 |
% |
| 582 |
% |
| 583 |
% |
| 584 |
% \subsection{\textsf{pfnote}} |
| 585 |
% \label{sec:imp-pfnote} |
| 586 |
% |
| 587 |
% \iffalse |
| 588 |
%<*pfnote> |
| 589 |
% \fi |
| 590 |
% To enclose |\c@footnote| within a page, we identify each footnote $f_i$ |
| 591 |
% by a global serial number $i$ and associate it with the {\em physical} |
| 592 |
% page number $p_i$ where it appears. These attributes $i$ and $p_i$ are |
| 593 |
% written to |.aux| file in the form of |\pfn@fnote|\Meta{$i$}\Meta{$p_i$}. |
| 594 |
% This macro is evaluated in \LaTeX's |\document| and |\def|-ines a macro |
| 595 |
% whose name is ``|\pfn@fn|\meta{$i$}'' and body is \meta{$p_i$}. |
| 596 |
% |
| 597 |
% Then, when we process the footnote $f_i$, we can have $p_i$ by evaluating |
| 598 |
% |\pfn@fn|\meta{$i$} and compare it with $p_{i-1}$. If $p_i\neq p_{i-1}$, |
| 599 |
% $f_i$ is the first footnote in page $p_i$ and thus its number should be |
| 600 |
% one. Otherwise, the number of $f_i$ should be that of $f_{i-1}$ plus one. |
| 601 |
% |
| 602 |
% \begin{macro}{\pfn@fnotectr} |
| 603 |
% \begin{macro}{\pfn@page} |
| 604 |
% \begin{macro}{\pfn@pageprev} |
| 605 |
% To implement the algorithm shown above, we use three |\count| registers; |
| 606 |
% |\pfn@fnotectr| for $i$ initialized to zero; |\pfn@page| for physical page |
| 607 |
% number initialized to one; and |\pfn@pageprev| to keep $p_{i-1}$ with |
| 608 |
% initial value zero. Note that |\pfn@page| is not |\c@page| but has |
| 609 |
% physical page number, and thus any $p_i$ cannot be zero that is the initial |
| 610 |
% value of |\pfn@pageprev|. |
| 611 |
% \end{macro}\end{macro}\end{macro} |
| 612 |
% |
| 613 |
% \begin{macrocode} |
| 614 |
|
| 615 |
\newcount\pfn@fnotectr \pfn@fnotectr\z@ |
| 616 |
\newcount\pfn@page \pfn@page\@ne |
| 617 |
\newcount\pfn@pageprev \pfn@pageprev\z@ |
| 618 |
|
| 619 |
% \end{macrocode} |
| 620 |
% |
| 621 |
% \begin{macro}{\pfn@footnote} |
| 622 |
% \begin{macro}{\footnote} |
| 623 |
% \begin{macro}{\pfn@footnotemark} |
| 624 |
% \begin{macro}{\footnotemark} |
| 625 |
% \begin{macro}{\pfn@mpfn} |
| 626 |
% We have to modify |\footnote| and |\footnotemark| so that they invoke |
| 627 |
% |\pfn@adjust| to do what we described at the beginning of this section, if |
| 628 |
% they refer and increment |\c@footnote|. In order to minimize |
| 629 |
% copy-and-modify of their original codes, we simply call their original |
| 630 |
% versions, |\pfn@footnote| and |\pfn@footnotemark|, if optional argument is |
| 631 |
% given accepting a little bit performance degradation by double checking of |
| 632 |
% the optional argument\footnote{ |
| 633 |
% |
| 634 |
% We of course know that we can call \cs{@xfootnote} and |
| 635 |
% \cs{@xfootnotemark}, but this implementation is safer.}. |
| 636 |
% |
| 637 |
% Otherwise, |\pfn@adjust| is invoked if |\@mpfn| is ``|footnote|'', the |
| 638 |
% body of |\pfn@mpfn| in the case of |\footnote|, or always in the case of |
| 639 |
% |\footnotemark|. Thus |mpfootnote| is eliminated from our mechanism as |
| 640 |
% shown in \S\ref{sec:prob}, although including it is not hard. |
| 641 |
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} |
| 642 |
% |
| 643 |
% \begin{macrocode} |
| 644 |
\let\pfn@footnote\footnote |
| 645 |
\def\footnote{\@ifnextchar[%] |
| 646 |
{\pfn@footnote}% |
| 647 |
{\ifx\@mpfn\pfn@mpfn \pfn@adjust \fi \pfn@footnote}} |
| 648 |
\let\pfn@footnotemark\footnotemark |
| 649 |
\def\footnotemark{\@ifnextchar[%] |
| 650 |
{\pfn@footnotemark}{\pfn@adjust \pfn@footnotemark}} |
| 651 |
\let\pfn@mpfn\@mpfn |
| 652 |
|
| 653 |
% \end{macrocode} |
| 654 |
% |
| 655 |
% \begin{macro}{\pfn@adjust} |
| 656 |
% The main procedure of enclosing is performed by |\pfn@adjust|. First, |
| 657 |
% after |\global|-ly incrementing |\pfn@fnotectr| ($i$), it |\write|-s |
| 658 |
% |\pfn@fnpage|\Meta{$i$}\Meta{$P$} by well-known technique of the |
| 659 |
% combination of delayed evaluation of physical page number $P$ and |
| 660 |
% immediate evaluation of other staffs. |
| 661 |
% |
| 662 |
% Then it obtains $p_i$ by evaluating |\pfn@fn|$i$ and compares it to |
| 663 |
% $p_{i-1}$ in |\pfn@pageprev|. If they are not equal, |\c@footnote| is |
| 664 |
% reset to make $f_i$ have number one, and |\pfn@pageprev| is set to $p_i$. |
| 665 |
% Since we also reset |\c@footnote| if |\pfn@fn|$i$ is undefined, all the |
| 666 |
% footnotes will have number one on the first run of \LaTeX{} for a |
| 667 |
% document. |
| 668 |
% \end{macro} |
| 669 |
% |
| 670 |
% \begin{macrocode} |
| 671 |
\def\pfn@adjust{\global\advance\pfn@fnotectr by\@ne |
| 672 |
\if@filesw |
| 673 |
\edef\@tempa{\write\@auxout{\string\pfn@fnpage |
| 674 |
{\number\pfn@fnotectr}% |
| 675 |
{\noexpand\number\noexpand\pfn@page}}}\@tempa \fi |
| 676 |
\expandafter\ifx\csname pfn@fn\number\pfn@fnotectr\endcsname\relax |
| 677 |
\global\c@footnote\z@ \else |
| 678 |
\expandafter\@tempcnta\csname pfn@fn\number\pfn@fnotectr\endcsname |
| 679 |
\relax \ifnum\@tempcnta=\pfn@pageprev\else |
| 680 |
\global\pfn@pageprev\@tempcnta \global\c@footnote\z@ \fi \fi} |
| 681 |
|
| 682 |
% \end{macrocode} |
| 683 |
% |
| 684 |
% \begin{macro}{\pfn@fnpage} |
| 685 |
% The macro |\pfn@fnpage|\Meta{$i$}\Meta{$p_i$} written in |.aux| and |
| 686 |
% evaluated in |\document| simply |\def|-ines |\pfn@fn|$i$ with the body |
| 687 |
% $p_i$. |
| 688 |
% \end{macro} |
| 689 |
% |
| 690 |
% \begin{macrocode} |
| 691 |
\def\pfn@fnpage#1#2{\global\@namedef{pfn@fn#1}{#2}} |
| 692 |
|
| 693 |
% \end{macrocode} |
| 694 |
% |
| 695 |
% \begin{macro}{\pfn@outputpage} |
| 696 |
% \begin{macro}{\@outputpage} |
| 697 |
% To keep track physical page number in |\pfn@page|, we modify |
| 698 |
% |\@outputpage| so that it increments |\pfn@page| when it does |\c@page|. |
| 699 |
% \end{macro}\end{macro} |
| 700 |
% |
| 701 |
% \begin{macrocode} |
| 702 |
\let\pfn@outputpage\@outputpage |
| 703 |
\def\@outputpage{\pfn@outputpage \global\advance\pfn@page\@ne} |
| 704 |
% \end{macrocode} |
| 705 |
% |
| 706 |
% \iffalse |
| 707 |
%</pfnote> |
| 708 |
% \fi |
| 709 |
% |
| 710 |
% |
| 711 |
% |
| 712 |
% \subsection{\textsf{fnpos}} |
| 713 |
% \label{sec:imp-fnpos} |
| 714 |
% |
| 715 |
% \iffalse |
| 716 |
%<*fnpos> |
| 717 |
% \fi |
| 718 |
% \begin{macro}{\iffnp@bottom} |
| 719 |
% \begin{macro}{\iffnp@below} |
| 720 |
% To control the position of footnotes, we introduce two switches; |
| 721 |
% |\iffnp@bottom| is true if |\makeFNbottom| is in effect; |\iffnp@below| |
| 722 |
% is true if |\makeFNbelow| is in effect. In default, they both are true. |
| 723 |
% \end{macro}\end{macro} |
| 724 |
% |
| 725 |
% \begin{macrocode} |
| 726 |
|
| 727 |
\newif\iffnp@bottom \fnp@bottomtrue |
| 728 |
\newif\iffnp@below \fnp@belowtrue |
| 729 |
|
| 730 |
% \end{macrocode} |
| 731 |
% |
| 732 |
% \newpage |
| 733 |
% \begin{macro}{\makeFNbottom} |
| 734 |
% \begin{macro}{\makeFNmid} |
| 735 |
% \begin{macro}{\makeFNbelow} |
| 736 |
% \begin{macro}{\makeFNabove} |
| 737 |
% User interface macros are trivial, i.e. they turn the switches true or false. |
| 738 |
% \end{macro}\end{macro}\end{macro}\end{macro} |
| 739 |
% |
| 740 |
% \begin{macrocode} |
| 741 |
\def\makeFNbottom{\fnp@bottomtrue} |
| 742 |
\def\makeFNmid{\fnp@bottomfalse} |
| 743 |
\def\makeFNbelow{\fnp@belowtrue} |
| 744 |
\def\makeFNabove{\fnp@belowfalse} |
| 745 |
|
| 746 |
% \end{macrocode} |
| 747 |
% |
| 748 |
% \begin{macro}{\@makecol} |
| 749 |
% \changes{v1.1-1}{2018/09/03} |
| 750 |
% {Remove inappropriate spaces preceeding three \cs{endcsname}.} |
| 751 |
% \begin{macro}{\fnp@textbottom} |
| 752 |
% The essential part of \textsf{fnpos} is a modified version of |\@makecol|. |
| 753 |
% If |\iffnp@below| is true, we reverse the order of |\@combinefloats| and |
| 754 |
% the insertion of |\footins|. At the insertion of |\footins|, we insert |
| 755 |
% |\@textbottom| prior to |\footins| to push it to the bottom if |
| 756 |
% |\iffnp@bottom| is true. We also temporarily nullify |\@textbottom|, |
| 757 |
% whose definition is saved into |\fnp@textbottom|, if it has been inserted |
| 758 |
% with |\footins| in order to keep the following |\@outputbox| construction |
| 759 |
% in |\@makecol| or |\@makespecialcolbox| from inserting it again. |
| 760 |
% |
| 761 |
% Here we discuss a few compatibility issues. In \LaTeXe, |\footins| |
| 762 |
% inserted in the construct of |\color@begroup| and |\color@endgroup| which |
| 763 |
% \LaTeX-2.09 does not have. Thus we call them and |\normalcolor| by |
| 764 |
% |\csname|\slash |\endcsname| construct to allow they are undefined. |
| 765 |
% |
| 766 |
% The |\insert|-ion object |\@kludgeins| and the macro |\@makespecialcolbox| |
| 767 |
% are also \LaTeXe's new comers for |\enlargethispage|. For \LaTeX-2.09, we |
| 768 |
% make |\@klugeins| |\let|-equal to |\voidb@x| that will never be a |\vbox|, |
| 769 |
% and thus |\@makespecialcolbox| will never be expanded. |
| 770 |
% |
| 771 |
% We also have to take care of p\LaTeX{} whose |\@makespecialcolbox| inserts |
| 772 |
% |\footins| and |\@texbottom| as we do for |\makeFNbottom| and |
| 773 |
% |\makeFNbelow|. However, since |\footins| is set to void by our insertion |
| 774 |
% and |\@textbottom| is nullified if |\iffnp@bottom| is true, these |
| 775 |
% insertions will have no effect as have to be. |
| 776 |
% \end{macro}\end{macro} |
| 777 |
% |
| 778 |
% \begin{macrocode} |
| 779 |
\def\@makecol{\setbox\@outputbox\box\@cclv |
| 780 |
\xdef\@freelist{\@freelist\@midlist}\global\let\@midlist\@empty |
| 781 |
\iffnp@below \@combinefloats \fi |
| 782 |
\let\fnp@textbottom\@textbottom |
| 783 |
\ifvoid\footins\else |
| 784 |
\setbox\@outputbox\vbox{\boxmaxdepth\maxdepth |
| 785 |
\unvbox\@outputbox |
| 786 |
\iffnp@bottom \@textbottom \fi |
| 787 |
\vskip\skip\footins |
| 788 |
\csname color@begingroup\endcsname |
| 789 |
\csname normalcolor\endcsname |
| 790 |
\footnoterule \unvbox\footins |
| 791 |
\csname color@endgroup\endcsname}% |
| 792 |
\iffnp@bottom \let\@textbottom\relax \fi \fi |
| 793 |
\iffnp@below\else \@combinefloats \fi |
| 794 |
\ifvbox\@kludgeins \@makespecialcolbox |
| 795 |
\else \setbox\@outputbox\vbox to\@colht{\@texttop |
| 796 |
\dimen@\dp\@outputbox \unvbox\@outputbox |
| 797 |
\vskip-\dimen@ \@textbottom}\fi |
| 798 |
\let\@textbottom\fnp@textbottom |
| 799 |
\global \maxdepth \@maxdepth} |
| 800 |
\ifx\@kludgeins\undefined \let\@kludgeins\voidb@x \fi |
| 801 |
% \end{macrocode} |
| 802 |
% |
| 803 |
% \iffalse |
| 804 |
%</fnpos> |
| 805 |
% \fi |
| 806 |
% |
| 807 |
% |
| 808 |
% \subsection{\textsf{dblfnote}} |
| 809 |
% \label{sec:imp-dblfnote} |
| 810 |
% |
| 811 |
% \iffalse |
| 812 |
%<*dblfnote> |
| 813 |
% \fi |
| 814 |
% |
| 815 |
% \subsubsection{Problems and Solutions} |
| 816 |
% \label{sec:imp-dfn-ovv} |
| 817 |
% |
| 818 |
% \def\DH{{\mit\Delta}H} |
| 819 |
% |
| 820 |
% \LaTeX's |\footnote| utilizes \TeX's mechanism |\insert| that is perfectly |
| 821 |
% fit to the purpose. Roughly speaking, |\footnote|\Meta{text} invokes |
| 822 |
% |\insert\footins|\Meta{text$'$} to do the following. |
| 823 |
% |
| 824 |
% \begin{enumerate} |
| 825 |
% \item |
| 826 |
% \meta{text$'$} is kept in a special place, properly contributing to |
| 827 |
% \TeX's page breaking mechanism with their height and depth. |
| 828 |
% |
| 829 |
% \item |
| 830 |
% When the |\output| routine is invoked with the contents of a page |
| 831 |
% including {\em footnoted} text, it is also given \meta{text$'$}, together |
| 832 |
% with other |\footnote| texts which should appear in the page, through the |
| 833 |
% box |\footins|. The page breaking mechanism will never, well hardly |
| 834 |
% ever\footnote{ |
| 835 |
% |
| 836 |
% See Exercise 15.13 of \TeX{}book for the possibility of placing a footnote |
| 837 |
% text in a page other than that its reference appears.}, |
| 838 |
% |
| 839 |
% miss to couple \meta{text$'$} and its reference in main text. |
| 840 |
% |
| 841 |
% \item |
| 842 |
% The |\output| routine put |\footins| at the bottom of the page. |
| 843 |
% \end{enumerate} |
| 844 |
% |
| 845 |
% This simple mechanism, however, cannot be straightforwardly applied to our |
| 846 |
% double-columned footnotes. The major difficulty lies in the fact that |
| 847 |
% when |\footnote| is processed we cannot know how \meta{text$'$} |
| 848 |
% contributes to the page in which it and its reference appear after it is |
| 849 |
% double-columned with other footnote texts. For example, \TeX{}book shows |
| 850 |
% a simple estimation method setting |\count\footnote| to 500 so that a half |
| 851 |
% (500/1000) of the height plus depth of \meta{text$'$} contributes to the |
| 852 |
% page. This method, however, will underestimate the contribution of |
| 853 |
% \meta{text$'$} having three lines, which will be broken into two and one |
| 854 |
% lines and thus finally has two line height, by assuming the contribution |
| 855 |
% is one and a half lines. Thus we have to have a better estimation method. |
| 856 |
% |
| 857 |
% Another problem is that, even if we estimate the contribution better, we |
| 858 |
% cannot directly |\insert| \meta{text$'$} because its {\em natural} height |
| 859 |
% plus depth may be different from the estimated contribution. Note that |
| 860 |
% changing the magnification factor in |\count\footins| dynamically is not |
| 861 |
% good idea because its value is referred by the page breaking mechanism not |
| 862 |
% at the time when we do |\insert| but when the paragraph including |
| 863 |
% |\footnote| is completed possibly after other |\footnote|-s change the |
| 864 |
% factor again. Also note that we cannot give up using |\insert| and adopt |
| 865 |
% a method similar to that for floats\footnote{ |
| 866 |
% |
| 867 |
% As the buggy implementation of earlier version of \textsf{dblfnote}.}, |
| 868 |
% |
| 869 |
% because a float may be decoupled from its reference and {\em float} to |
| 870 |
% another page. Thus we have to |\insert| something other than |
| 871 |
% \meta{text$'$} while keeping it in some other place. |
| 872 |
% |
| 873 |
% To solve these problems, the following algorithm is devised for |
| 874 |
% \textsf{dblfnote}. Let $f_1$, \ldots, $f_{i-1}$ be footnote texts which |
| 875 |
% have not yet been |\output|, and $f_i$ be that which we now process. Let |
| 876 |
% $H_i$ be the height plus depth of double-columned typesetting result of |
| 877 |
% $f_1$, \ldots, $f_i$, which can be obtained by tentatively doing that. We |
| 878 |
% estimate the contribution of $f_i$ to the page as $\DH_i=H_i-H_{i-1}$, |
| 879 |
% which will be exact if $f_1$, \ldots, $f_i$ is put in a page\footnote{ |
| 880 |
% |
| 881 |
% As discussed later, this condition does not always hold and thus we will |
| 882 |
% have an error.}. |
| 883 |
% |
| 884 |
% Then we |\insert| an empty box whose height is $\DH_i$ through |\footins|, |
| 885 |
% while appending $f_i$ to the tail of |\vbox| $F$, which has contained |
| 886 |
% $f_1$, \ldots, $f_{i-1}$, so that the |\output| routine and following |
| 887 |
% |\footnote|-s refer it. |
| 888 |
% |
| 889 |
% When the |\output| routine is invoked, we have $f_1$, \ldots, $f_n$ in |
| 890 |
% $F$, and \TeX{} moved $m$ ($m\leq n$) |\insert|-ed empty |\vbox|-es into |
| 891 |
% the box |\footins|. Thus we have to know $m$ and have to pick $f_1$, |
| 892 |
% \ldots, $f_m$ from $F$. Since $m$ is the number of |\vbox|-es in |
| 893 |
% |\footins|, we can count them by a well-known technique of iterative |
| 894 |
% |\unvbox| and |\lastbox|\footnote{ |
| 895 |
% |
| 896 |
% Since \cs{footins} contains only a sequence of empty \cs{vbox}-es, i.e. no |
| 897 |
% glues, penalties nor other troublesome stuffs, we can count \cs{vbox}-es |
| 898 |
% exactly.}. |
| 899 |
% |
| 900 |
% In order to pick $f_1$, \ldots, $f_m$, we maintain a list |
| 901 |
% $L=\{h_1,\ldots,h_n\}$ where $h_i$ is the height plus depth of $f_i$ and |
| 902 |
% calculate $s_m=\sum_{i=1}^m h_i$. With this $s_m$, we can |\vsplit| the |
| 903 |
% box $F$ to obtain a |\vbox| $F'$ containing $f_1$, \ldots, $f_m$ and to |
| 904 |
% leave $f_{m+1}, \ldots, f_n$ in $F$. We also remove $h_1$, \ldots, $h_m$ |
| 905 |
% from $L$. Then we |\vsplit| $F'$ into two columns to have what we finally |
| 906 |
% put at the bottom of the page. |
| 907 |
% |
| 908 |
% If $m=n$, that is, if all the |\footnote|-s that have occurred are combined |
| 909 |
% with the page, we have no problem to finish the |\output| routine and to |
| 910 |
% continue the process. If $m<n$, that is, if there are |\footnote|-s that |
| 911 |
% have occurred but are left for the next (or farther) page, however, we have |
| 912 |
% a problem. Remember that we estimate the contribution of $f_i$, $\DH_i$, |
| 913 |
% assuming that $f_1$, \ldots, $f_i$ are put in a page. Since $f_{m+1}$, |
| 914 |
% \ldots, $f_n$ are {\em not} put in the page where $f_1$, \ldots, $f_m$ are |
| 915 |
% put, our estimation could have some error. In fact, for example, if all |
| 916 |
% $f_i$ has one line and $m$ is odd, $H_m=H_{m+1}$ and thus $\DH_{m+1}$ is |
| 917 |
% zero while its real contribution should be the height of one line. In |
| 918 |
% general, $\DH_i$ for $m<i\leq n$ were underestimated and thus somehow we |
| 919 |
% have to compensate the underestimation that would cause overfull in the |
| 920 |
% |\output| process for the next page. |
| 921 |
% |
| 922 |
% For the compensation, the element of $L$ is not just $h_i$ but the pair |
| 923 |
% $(h_i,\DH_i)$ to remember the estimated contribution. After we put $f_1$, |
| 924 |
% \ldots, $f_m$, we estimate the contribution of $f_{m+1}$, \ldots, $f_n$ |
| 925 |
% again by tentatively building double-columned output to have $H'_{m+1}$, |
| 926 |
% \ldots, $H'_n$ where $H'_i$ is the height plus depth of the double-columned |
| 927 |
% box of $f_{m+1}$, \ldots, $f_i$. Then we calculate |
| 928 |
% |
| 929 |
% \begin{equation}\label{eq:eta} |
| 930 |
% \eta=\max_{m<i\leq n}(H'_i-\sum_{\llap{$\scriptstyle j=m+1$\hss}}^i\DH_i) |
| 931 |
% \end{equation} |
| 932 |
% |
| 933 |
% and |\insert| an empty |\vbox| of $\eta$ high which is conceptually placed |
| 934 |
% at the top of next page. We also add an element $(0,\eta)$ at the head of |
| 935 |
% $L$. Remember that this compensation makes $\DH_i$ overestimated and thus |
| 936 |
% the next page will be too short if a part of $f_{m+1}$, \ldots, $f_n$ are |
| 937 |
% still deferred on the next page building as noted in \S\ref{sec:prob}. |
| 938 |
% However, this overestimation is unlikely revealed because we also |
| 939 |
% |\insert| an empty |\vbox| whose negative height $\eta'$ is; |
| 940 |
% |
| 941 |
% \begin{equation}\label{eq:eta'} |
| 942 |
% \eta'=H'_n-(\sum_{\llap{$\scriptstyle j=m+1$\hss}}^n\DH_i+\eta) |
| 943 |
% \end{equation} |
| 944 |
% |
| 945 |
% at the tail of the main vertical list which is not yet |\output|, add an |
| 946 |
% element $(0,\eta')$ to the tail of $L$, and set $H_n$ to $H'_n$. That is, |
| 947 |
% if the next page has a |\par|, the overestimation is reset. |
| 948 |
% |
| 949 |
% |
| 950 |
% |
| 951 |
% \subsubsection{Register Declaration} |
| 952 |
% \label{sec:imp-dfn-decl} |
| 953 |
% |
| 954 |
% First of all, we declare the following three switches, together with user |
| 955 |
% interface commands to turn them. |
| 956 |
% |
| 957 |
% \begin{itemize} |
| 958 |
% \item |
| 959 |
% \begin{macro}{\ifdfn@allowcbreak} |
| 960 |
% \begin{macro}{\DFNallowcbreak} |
| 961 |
% \begin{macro}{\DFNinhibitcbreak} |
| 962 |
% |\ifdfn@allowcbreak| is true (default) if |\DFNallowcbreak| is in effect |
| 963 |
% to allow a footnote is broken into two columns. It is false if |
| 964 |
% |\DFNinhibitcbreak| is in effect to enclose a footnote by a |\vbox| to |
| 965 |
% inhibit the breaking. |
| 966 |
% \end{macro}\end{macro}\end{macro} |
| 967 |
% |
| 968 |
% \item |
| 969 |
% \begin{macro}{\ifdfn@trysingle} |
| 970 |
% \begin{macro}{\DFNtrysingle} |
| 971 |
% \begin{macro}{\DFNalwaysdouble} |
| 972 |
% |\ifdnf@trysingle| is true (default) if |\DFNtrysingle| is in effect to |
| 973 |
% place footnotes only in the left column if possible. It is false if |
| 974 |
% |\DFNalwaysdouble| is in effect not to try single-columning. |
| 975 |
% \end{macro}\end{macro}\end{macro} |
| 976 |
% |
| 977 |
% \item |
| 978 |
% \begin{macro}{\ifdfn@ruleboth} |
| 979 |
% \begin{macro}{\DFNruleboth} |
| 980 |
% \begin{macro}{\DFNruleleft} |
| 981 |
% |\ifdfn@ruleboth| is true if |\DFNruleboth| is in effect to draw |
| 982 |
% |\footnoterule| over both columns. It is false (default) if |
| 983 |
% |\DFNruleleft| is in effect to draw it over the left column only. |
| 984 |
% \end{macro}\end{macro}\end{macro} |
| 985 |
% \end{itemize} |
| 986 |
% |
| 987 |
% We also use a working switch |\@tempswa|. |
| 988 |
% |
| 989 |
% \begin{macrocode} |
| 990 |
|
| 991 |
%% Register Declaration |
| 992 |
|
| 993 |
\newif\ifdfn@allowcbreak \dfn@allowcbreaktrue |
| 994 |
\def\DFNallowcbreak{\dfn@allowcbreaktrue} |
| 995 |
\def\DFNinhibitcbreak{\dfn@allowcbreakfalse} |
| 996 |
|
| 997 |
\newif\ifdfn@trysingle \dfn@trysingletrue |
| 998 |
\def\DFNtrysingle{\dfn@trysingletrue} |
| 999 |
\def\DFNalwaysdouble{\dfn@trysinglefalse} |
| 1000 |
|
| 1001 |
\newif\ifdfn@ruleboth \dfn@rulebothfalse |
| 1002 |
\def\DFNruleboth{\dfn@rulebothtrue} |
| 1003 |
\def\DFNruleleft{\dfn@rulebothfalse} |
| 1004 |
|
| 1005 |
% \end{macrocode} |
| 1006 |
% |
| 1007 |
% \begin{macro}{\c@DFNsloppiness} |
| 1008 |
% Then we declare a \LaTeX{} counter |DFNsloppiness| that is the value of |
| 1009 |
% |\hbadness| of the footnote paragraphs, and set it to the default value |
| 1010 |
% 5000. |
| 1011 |
% \end{macro} |
| 1012 |
% We also use a working |\count| register, |\@tempcnta|. |
| 1013 |
% |
| 1014 |
% \begin{macrocode} |
| 1015 |
\newcounter{DFNsloppiness}\c@DFNsloppiness5000 |
| 1016 |
|
| 1017 |
% \end{macrocode} |
| 1018 |
% |
| 1019 |
% \begin{dummymacro} |
| 1020 |
% Next come the declarations of the following six |\dimen| registers. |
| 1021 |
% |
| 1022 |
% \begin{itemize} |
| 1023 |
% \item |
| 1024 |
% \begin{macro}{\DFNcolumnsep} |
| 1025 |
% \begin{macro}{\DFNcolumnwidth} |
| 1026 |
% |\DFNcolumnsep| and |\DFNcolumnwidth| are the counterparts of |\columnsep| |
| 1027 |
% and |\columnwidth|. Their defaults are both $-|\maxdimen|$ to indicate |
| 1028 |
% that they are set to the default values in |\document|. |
| 1029 |
% \end{macro}\end{macro} |
| 1030 |
% |
| 1031 |
% \item |
| 1032 |
% \begin{macro}{\dfn@fnht} |
| 1033 |
% |\dfn@fnht| is $H_i$ shown in \S\ref{sec:imp-dfn-ovv}. |
| 1034 |
% \end{macro} |
| 1035 |
% |
| 1036 |
% \item |
| 1037 |
% \begin{macro}{\dfn@fnmaxdp} |
| 1038 |
% |\dfn@fnmaxdp| has the depth of |\strutbox| in |\footnotesize| and is used |
| 1039 |
% to set |\boxmaxdepth| and |\splitmaxdepth| for footnote boxes. |
| 1040 |
% \end{macro} |
| 1041 |
% |
| 1042 |
% \item |
| 1043 |
% \begin{macro}{\dfn@dima} |
| 1044 |
% \begin{macro}{\dfn@dimb} |
| 1045 |
% \begin{DFNinhibitcbreak}% |
| 1046 |
% |\dfn@dima| and |\dfn@dimb| are our own scratch-pads. We also use |
| 1047 |
% \LaTeX's scratch-pads |\@tempdima| and |\@tempdimb|\footnote{ |
| 1048 |
% |
| 1049 |
% \cs{@tempdimc} is not used because it is unavailable in \LaTeX-2.09.}. |
| 1050 |
% \end{DFNinhibitcbreak}% |
| 1051 |
% \end{macro}\end{macro} |
| 1052 |
% \end{itemize} |
| 1053 |
% \end{dummymacro} |
| 1054 |
% |
| 1055 |
% \begin{macrocode} |
| 1056 |
\newdimen\DFNcolumnsep \DFNcolumnsep-\maxdimen |
| 1057 |
\newdimen\DFNcolumnwidth \DFNcolumnwidth-\maxdimen |
| 1058 |
\newdimen\dfn@fnht |
| 1059 |
\newdimen\dfn@fnmaxdp {\footnotesize \global\dfn@fnmaxdp\dp\strutbox} |
| 1060 |
\newdimen\dfn@dima \newdimen\dfn@dimb |
| 1061 |
|
| 1062 |
% \end{macrocode} |
| 1063 |
% |
| 1064 |
% \begin{macro}{\dfn@ins} |
| 1065 |
% \begin{macro}{\dfn@boxa} |
| 1066 |
% \begin{macro}{\dfn@boxb} |
| 1067 |
% Next declarations are for boxes, |\dfn@ins| for $F$ shown in |
| 1068 |
% \S\ref{sec:imp-dfn-ovv}, and two working registers |\dfn@boxa| and |
| 1069 |
% |\dfn@boxb|. |
| 1070 |
% \end{macro}\end{macro}\end{macro} |
| 1071 |
% |
| 1072 |
% \begin{macrocode} |
| 1073 |
\newbox\dfn@ins |
| 1074 |
\newbox\dfn@boxa \newbox\dfn@boxb |
| 1075 |
|
| 1076 |
% \end{macrocode} |
| 1077 |
% |
| 1078 |
% \begin{macro}{\dfn@output} |
| 1079 |
% Finally, we declare a |\toks| register |\dfn@output| that contains |
| 1080 |
% original token list for |\output| that is refered in our own version of |
| 1081 |
% it. |
| 1082 |
% \end{macro} |
| 1083 |
% |
| 1084 |
% \begin{macrocode} |
| 1085 |
\newtoks\dfn@output \dfn@output\output |
| 1086 |
|
| 1087 |
%%^L |
| 1088 |
% \end{macrocode} |
| 1089 |
% |
| 1090 |
% |
| 1091 |
% |
| 1092 |
% \subsubsection{Make a Footnote} |
| 1093 |
% \label{sec:imp-dfn-fntext} |
| 1094 |
% |
| 1095 |
% \begin{macro}{\dfn@footnotetext} |
| 1096 |
% \begin{macro}{\dfn@latex@footnotetext} |
| 1097 |
% \begin{macro}{\@footnotetext} |
| 1098 |
% \begin{macro}{\dfn@gobble} |
| 1099 |
% To implement a part of our algorithm described in \S\ref{sec:imp-dfn-ovv}, |
| 1100 |
% we have to modify the part of |\footnote|, |\@footnotext|\Meta{text}, in |
| 1101 |
% which \LaTeX{} does |\insert\footins|\Meta{text$'$}. Our own |
| 1102 |
% |\@footnotext|, named |\dfn@footnotetext|, first typesets \meta{text$'$} |
| 1103 |
% in a box |\dfn@boxa| ($f_i$) by calling \LaTeX's \hbox{|\@footnotetext|} |
| 1104 |
% that is renamed |\dfn@latex@footnotetext|. Before calling it, we make |
| 1105 |
% |\insert| |\let|-equal to |\dfn@gobble| that simply returns the body to be |
| 1106 |
% |\insert|-ed, and set |\columnwidth| and |\hbadness| to appropriate values |
| 1107 |
% to make double-columned paragraphs. |
| 1108 |
% \end{macro}\end{macro}\end{macro}\end{macro} |
| 1109 |
% |
| 1110 |
% \begin{macro}{\@makefnmark} |
| 1111 |
% \begin{macro}{\dfn@makefnmark} |
| 1112 |
% \begin{DFNinhibitcbreak}% |
| 1113 |
% The other operation performed prior to calling |\dfn@latex@footnotetext| |
| 1114 |
% is redefinition of |\@makefnmark| so that it |\smash|-es the footnote |
| 1115 |
% mark produced by its original version |\dfn@makefnmark|. This prevents |
| 1116 |
% the first line of footnote being too tall\footnote{ |
| 1117 |
% |
| 1118 |
% The superscripted footnote number is sometimes taller than \cs{strut} of |
| 1119 |
% \cs{footnotesize}.} |
| 1120 |
% |
| 1121 |
% and makes columns well-balanced. |
| 1122 |
% \end{DFNinhibitcbreak}% |
| 1123 |
% \end{macro}\end{macro} |
| 1124 |
% |
| 1125 |
% \begin{dummymacro} |
| 1126 |
% Then we calculate $h_i$ (|\dfn@dima|) and append $f_i$ to the tail of $F$ |
| 1127 |
% (|\dfn@ins|). Since we need that $h_i$ is positive to get $f_i$ from $F$ |
| 1128 |
% afterward, we enclose $f_i$ with a |\vbox| of 1\,|sp| high if $h_i$ is |
| 1129 |
% unexpectedly non-positive. The appendix is done by |\unvbox| of $f_i$ if |
| 1130 |
% |\ifdfn@allowcbreak| is true, while the |\vbox| envelope is kept otherwise |
| 1131 |
% to inhibit column break in $f_i$. In both cases, $f_i$ is preceded by |
| 1132 |
% |\allowbreak| and |\nointerlinepenalty| to allow column break and to |
| 1133 |
% prevent glue for |\baslineskip| inserted. |
| 1134 |
% \end{dummymacro} |
| 1135 |
% |
| 1136 |
% \begin{macro}{\dfn@split} |
| 1137 |
% Next we evaluate $H_i$ by tentatively building double-columned typesetting |
| 1138 |
% result from $F$. This is done by the macro; |
| 1139 |
% |
| 1140 |
% \begin{quote} |
| 1141 |
% |\dfn@split|\meta{height}\meta{src}\meta{dst}\meta{maxdepth}\meta{topskip} |
| 1142 |
% \end{quote} |
| 1143 |
% |
| 1144 |
% which |\vsplit|-s the box \meta{src} at \meta{height} to set the first |
| 1145 |
% half to \meta{dst} while leaving the second half in \meta{src}. The |
| 1146 |
% parameters for |\vsplit|, |\splitmaxdepth| and |\splittopskip|, are given |
| 1147 |
% by \meta{maxdepth} and \meta{topskip}. After |\vsplit|, it sets |
| 1148 |
% conceptual height and depth of double-columned result, $h_D$ |
| 1149 |
% (|\@tempdima|) and $d_D$ (|\@tempdimb|) as follows. |
| 1150 |
% |
| 1151 |
% \begin{eqnarray*} |
| 1152 |
% h_D&=&\max({\it ht}(\meta{src}),\;{\it ht}(\meta{dst}))\\ |
| 1153 |
% d_D&=&\max({\it ht}(\meta{src})+{\it dp}(\meta{src}),\; |
| 1154 |
% {\it ht}(\meta{dst})+{\it dp}(\meta{dst}))-h_D |
| 1155 |
% \end{eqnarray*} |
| 1156 |
% |
| 1157 |
% Thus we have $H_i=h_D+d_D$ (|\dfn@fnht|) and $\DH_i=H_i-H_{i-1}$ |
| 1158 |
% (|\@tempdima|). |
| 1159 |
% \end{macro} |
| 1160 |
% |
| 1161 |
% \begin{macro}{\dfn@list} |
| 1162 |
% Finally we |\insert| an empty |\vbox| of $\DH_i$ high, and append |
| 1163 |
% |\@elt|\meta{$h_i$}\meta{$\DH_i$} at the tail of $L$ (|\dfn@list|). Note |
| 1164 |
% that $h_i$ and $\DH_i$ are represented with the unit |sp| rather than |pt| |
| 1165 |
% to avoid conversion error. |
| 1166 |
% \end{macro} |
| 1167 |
% |
| 1168 |
% \begin{macrocode} |
| 1169 |
|
| 1170 |
%% Make a Footnote |
| 1171 |
|
| 1172 |
\long\def\dfn@footnotetext#1{{\setbox\dfn@boxa\vbox{ |
| 1173 |
\let\insert\dfn@gobble |
| 1174 |
\columnwidth\DFNcolumnwidth \hbadness\c@DFNsloppiness |
| 1175 |
\def\@makefnmark{\smash{\dfn@makefnmark}} |
| 1176 |
\dfn@latex@footnotetext{#1}\par \boxmaxdepth\dfn@fnmaxdp}% |
| 1177 |
\dfn@dima\ht\dfn@boxa \advance\dfn@dima\dp\dfn@boxa |
| 1178 |
\ifdim\dfn@dima>\z@\else |
| 1179 |
\dfn@dima1sp\relax |
| 1180 |
\setbox\dfn@boxa\vbox{\vbox to1sp{\unvbox\dfn@boxa\vfil}}\fi |
| 1181 |
\global\setbox\dfn@ins\vbox{\boxmaxdepth\dfn@fnmaxdp |
| 1182 |
\ifvoid\dfn@ins\else |
| 1183 |
\unvbox\dfn@ins \allowbreak \nointerlineskip \fi |
| 1184 |
\ifdfn@allowcbreak \unvbox \else \box \fi \dfn@boxa}% |
| 1185 |
\setbox\dfn@boxa\copy\dfn@ins |
| 1186 |
\dfn@split{.5\ht\dfn@boxa}\dfn@boxa\dfn@boxb\dfn@fnmaxdp\footnotesep |
| 1187 |
\advance\@tempdima\@tempdimb \@tempdimb\@tempdima |
| 1188 |
\advance\@tempdima-\dfn@fnht \global\dfn@fnht\@tempdimb |
| 1189 |
\insert\footins{\floatingpenalty\@MM \vbox to\@tempdima{}}% |
| 1190 |
\xdef\dfn@list{\dfn@list\@elt{\number\dfn@dima}{\number\@tempdima}}}} |
| 1191 |
\let\dfn@latex@footnotetext\@footnotetext |
| 1192 |
\let\@footnotetext\dfn@footnotetext |
| 1193 |
\long\def\dfn@gobble#1#2{#2} |
| 1194 |
\let\dfn@makefnmark\@makefnmark |
| 1195 |
\def\dfn@list{} |
| 1196 |
|
| 1197 |
\def\dfn@split#1#2#3#4#5{\@tempdima#1\relax |
| 1198 |
\vbadness\@M \vfuzz\maxdimen \splitmaxdepth#4\splittopskip#5\relax |
| 1199 |
\setbox#3\vsplit#2to\@tempdima |
| 1200 |
\setbox#3\vbox{\boxmaxdepth#4\unvbox#3}% |
| 1201 |
\@tempdima\ht#3\advance\@tempdima\dp#3\relax |
| 1202 |
\@tempdimb\ht#2\advance\@tempdimb\dp#2\relax |
| 1203 |
\ifdim\@tempdimb<\@tempdima \@tempdimb\@tempdima \fi |
| 1204 |
\@tempdima\ht#3\ifdim\@tempdima<\ht#2\@tempdima\ht#2\fi |
| 1205 |
\advance\@tempdimb-\@tempdima} |
| 1206 |
|
| 1207 |
%%^L |
| 1208 |
% \end{macrocode} |
| 1209 |
% |
| 1210 |
% |
| 1211 |
% |
| 1212 |
% \subsubsection{Output Footnotes} |
| 1213 |
% \label{sec:imp-dfn-makecol} |
| 1214 |
% |
| 1215 |
% \begin{macro}{\dfn@makecol} |
| 1216 |
% The other part of our algorithm described in \S\ref{sec:imp-dfn-ovv} is |
| 1217 |
% implemented as our own version of |\@makecol|, named |\dfn@makecol|. |
| 1218 |
% First we check if |\footins| has |\insert|-ed empty boxes for $f_1$, |
| 1219 |
% \ldots, $f_m$, and do (almost) nothing if none. Then we get $H_m$ |
| 1220 |
% (|\dfn@dima|) that is the height of |\footins|. |
| 1221 |
% \end{macro} |
| 1222 |
% |
| 1223 |
% \begin{macro}{\dfn@countins} |
| 1224 |
% Next we count the boxes in |\footins| to get $m$ (|\@tempcnta|) by |
| 1225 |
% |\dfn@countins|. It repeatedly removes the |\lastbox| of |\footins| |
| 1226 |
% counting up $m$ until no box is obtained. |
| 1227 |
% \end{macro} |
| 1228 |
% |
| 1229 |
% \begin{macro}{\dfn@elt@getht} |
| 1230 |
% \begin{macro}{\dfn@endgetht} |
| 1231 |
% Then we {\em execute} $L$ (|\dfn@list|) making |\@elt| |\let|-equal to |
| 1232 |
% |\dfn@elt@getht| to calculate $s_m=\sum_{i=1}^m h_i$ (|\@tempdima|). This |
| 1233 |
% execution also removes $(h_1,\DH_1)$, \ldots, $(h_m,\DH_m)$ from $L$ by |
| 1234 |
% |\dfn@endgetht|. |
| 1235 |
% \end{macro}\end{macro} |
| 1236 |
% |
| 1237 |
% \begin{dummymacro} |
| 1238 |
% Note that $s_m$ could be zero if |\footins| only has |\vbox|-es for error |
| 1239 |
% compensation, i.e.\ $(0,\eta)$ and/or $(0,\eta')$. In this case, we don't |
| 1240 |
% have any footnotes to be output. This decision is correct because we |
| 1241 |
% enclosed footnotes having non-positive height by a |\vbox| of 1\,|sp| high |
| 1242 |
% as described in \S\ref{sec:imp-dfn-fntext}. Thus we can safely pick $f_1$, |
| 1243 |
% \ldots, $f_m$ from $F$ by |\vsplit|-ting it at $s_m$ by |\dfn@split| |
| 1244 |
% \footnote{ |
| 1245 |
% |
| 1246 |
% Unfortunately, this is not perfectly safe because $f_i$ may have |
| 1247 |
% stretchable and/or shrinkable glues together with negative penalties which |
| 1248 |
% could make the break point between $f_m$ and $f_{m+1}$ not least costly. |
| 1249 |
% Although we could have a perfect solution to cope with this unsafeness, we |
| 1250 |
% ignore such an unusual case because of the simplicity of implementation.}, |
| 1251 |
% |
| 1252 |
% and store them in |\dfn@boxa|. |
| 1253 |
% \end{dummymacro} |
| 1254 |
% |
| 1255 |
% \begin{dummymacro} |
| 1256 |
% Then if |\dfn@trysingle| is true, we check whether the page has enough |
| 1257 |
% space to put $f_1$, \ldots, $f_m$ in one column by examining the following |
| 1258 |
% inequality; |
| 1259 |
% $$ |
| 1260 |
% r\geq h_p+h_d+\sigma+s_m |
| 1261 |
% $$ |
| 1262 |
% where $r$ is |\@colroom|, $h_p$ and $h_d$ are height and depth of the body |
| 1263 |
% of the page given through |\box\@cclv|, and $\sigma$ is natural space of |
| 1264 |
% |\skip\footins|\footnote{ |
| 1265 |
% |
| 1266 |
% Thus we ignore the shrinkability of the page body and \cs{skip}\cs{footins}, |
| 1267 |
% because the former is hardly obtained. Remember \cs{pageshrink} is not the |
| 1268 |
% total shrinkability at the break point but at somewhere \cs{output} routine |
| 1269 |
% is invoked.}. |
| 1270 |
% |
| 1271 |
% Note that $h_p$ and $h_d$ are {\em not} height and depth of |\box\@cclv|, |
| 1272 |
% which are |\pagegoal| and depth of the last item (or |\maxdepth|), but |
| 1273 |
% those of the |\vbox| containing |\unvbox\@cclv|\footnote{ |
| 1274 |
% |
| 1275 |
% \TeX{} does not provide any other more convenient way to get them.}. |
| 1276 |
% |
| 1277 |
% If the inequality is satisfied, $f_1$, \ldots, $f_m$ are simply put into |
| 1278 |
% the box |\footins| together with |\footnoterule| preceding them. |
| 1279 |
% \end{dummymacro} |
| 1280 |
% |
| 1281 |
% \begin{dummymacro} |
| 1282 |
% Otherwise, we split $f_1$, \ldots, $f_m$ at $H_m$ by |\dfn@split| to |
| 1283 |
% obtain both columns to output. Then each column, preceded by |
| 1284 |
% |\footnoterule| and follwed by |\vss|, is put into a |\vbox| whose height |
| 1285 |
% is {\em conceptual} one calculated by |\dfn@split| so that first baselines |
| 1286 |
% of both column are adjusted. This also adjusts the last baseline of taller |
| 1287 |
% column with those of footnotes in other pages if |\makeFNbottom| of |
| 1288 |
% \textsf{fnpos} is in effect. Note that |\footnoterule| of the right |
| 1289 |
% column will not be put if |\ifdfn@ruleboth| is false, but a vertical space |
| 1290 |
% to compensate the height and depth of |\footnoterule| is although it is |
| 1291 |
% usually zero. For the completeness, we don't forget to set |\prevdepth| |
| 1292 |
% to the depth of |\footnoterule| though it has also no effect. |
| 1293 |
% \end{dummymacro} |
| 1294 |
% |
| 1295 |
% \begin{dummymacro} |
| 1296 |
% Then two boxes are put into |\hbox|-es of |\DFNcolumnwidth| wide separated |
| 1297 |
% by a space of |\DFNcolumnsep| surrounded by another |\hbox|. This outmost |
| 1298 |
% |\hbox| is redundantly enclosed by a |\vbox| to which |\footins| is set, |
| 1299 |
% because it will be unsealed by |\unvbox| afterward. |
| 1300 |
% \end{dummymacro} |
| 1301 |
% |
| 1302 |
% \begin{macro}{\dfn@elt@adjust} |
| 1303 |
% Now we finished the job for footnotes to be output to the current page, |
| 1304 |
% and start to take care of those left in $L$ and defered to the next (or |
| 1305 |
% farther) page. First, we {\em execute} $L$ (|\dfn@list|) making |\@elt| |
| 1306 |
% |\let|-equal to |\dfn@elt@adjust| to calculate $\eta$ (|\dfn@dimb|) of the |
| 1307 |
% equation (\ref{eq:eta}) in \S\ref{sec:imp-dfn-ovv}. It also calculate |
| 1308 |
% $H'_n$ (|\@tempdima|) and $\sum_{j=m+1}^n H_i$ (|\dfn@fnht|) for $\eta'$ |
| 1309 |
% of the equation (\ref{eq:eta'}) in \S\ref{sec:imp-dfn-ovv}. |
| 1310 |
% \end{macro} |
| 1311 |
% |
| 1312 |
% \begin{dummymacro} |
| 1313 |
% Then if $\eta$ is positive, we add $(0,\eta)$ to the head of $L$ and |
| 1314 |
% |\insert| an empty box of $\eta$ high to compensate the underestimation. |
| 1315 |
% Since \TeX{} places the vertical list constructed in |\output| routine |
| 1316 |
% at the page break point, the |\insert|-ion for $\eta$ is followed by those |
| 1317 |
% for $f_{m+1}$, \ldots, $f_n$. |
| 1318 |
% \end{dummymacro} |
| 1319 |
% |
| 1320 |
% \begin{macro}{\output} |
| 1321 |
% \begin{macro}{\dfn@afteroutput} |
| 1322 |
% We also add $(0,\eta')$ to the tail of $L$ and |\insert| an empty box of |
| 1323 |
% $\eta'$ high to compenstate the overestimation caused by $\eta$, if |
| 1324 |
% $\eta'$ is negative. This |\insert|-ion, however, should follow |
| 1325 |
% $f_{m+1}$, \ldots, $f_n$. To do this delayed |\insert|-ion, we modify |
| 1326 |
% |\output| so that it invoke |\dfn@afteroutput| through |\aftergroup|. |
| 1327 |
% Since \TeX{} closes the implicit group for |\output| {\em after} it |
| 1328 |
% reconstructs main vertical list\footnote{ |
| 1329 |
% |
| 1330 |
% This fact is not described in \TeX{}book but \texttt{tex.web} does so.}, |
| 1331 |
% |
| 1332 |
% |\dfn@afteroutput| will |\insert| the box where we wish to place and |
| 1333 |
% then nullify itself. |
| 1334 |
% \end{macro}\end{macro} |
| 1335 |
% |
| 1336 |
% \begin{macro}{\dfn@footnoterule} |
| 1337 |
% Now we finished everything for doulbe-columned footnotes. So, we call |
| 1338 |
% \LaTeX's \hbox{|\@make|}\allowbreak\hbox{|col|}, |\dfn@latex@makecol|, to |
| 1339 |
% make a page with |\footins|. Since the macro calls |\footnoterule| before |
| 1340 |
% |\footins| is put and we have already done it, we temporarily nullify |
| 1341 |
% |\footnoterule| and reactivate it after the macro with its original |
| 1342 |
% definition saved in |\dfn@footnoterule|. |
| 1343 |
% \end{macro} |
| 1344 |
% |
| 1345 |
% \begin{macrocode} |
| 1346 |
|
| 1347 |
%% Output Footnotes |
| 1348 |
|
| 1349 |
\def\dfn@makecol{{\ifvoid\footins\else |
| 1350 |
\dfn@dima\ht\footins |
| 1351 |
\@tempcnta\z@ \dfn@countins |
| 1352 |
\@tempdima\z@ \let\@elt\dfn@elt@getht |
| 1353 |
\dfn@list\@nil |
| 1354 |
\ifdim\@tempdima=\z@\else |
| 1355 |
\dfn@split\@tempdima\dfn@ins\dfn@boxa\z@\z@ |
| 1356 |
\global\setbox\dfn@ins\box\dfn@ins |
| 1357 |
\@tempswatrue |
| 1358 |
\ifdfn@trysingle |
| 1359 |
\setbox\dfn@boxb\vbox{\unvcopy\@cclv}\@tempdima\@colroom |
| 1360 |
\advance\@tempdima-\ht\dfn@boxb \advance\@tempdima-\dp\dfn@boxb |
| 1361 |
\advance\@tempdima-\skip\footins |
| 1362 |
\advance\@tempdima-\ht\dfn@boxa |
| 1363 |
\ifdim\@tempdima<\z@\else \@tempswafalse |
| 1364 |
\global\setbox\footins\vbox{\boxmaxdepth\dfn@fnmaxdp |
| 1365 |
\footnoterule \unvbox\dfn@boxa}\fi\fi |
| 1366 |
\if@tempswa |
| 1367 |
\dfn@split{\dfn@dima}\dfn@boxa\dfn@boxb\dfn@fnmaxdp\footnotesep |
| 1368 |
\global\setbox\footins\vbox{\hbox{% |
| 1369 |
\hbox to\DFNcolumnwidth{\vbox to\@tempdima{\footnoterule |
| 1370 |
\unvbox\dfn@boxb\vss}\hss}\hskip\DFNcolumnsep |
| 1371 |
\hbox to\DFNcolumnwidth{\ifvoid\dfn@boxa\else |
| 1372 |
\vbox to\@tempdima{ |
| 1373 |
\setbox\@tempboxa\vbox{\footnoterule} |
| 1374 |
\ifdfn@ruleboth \unvbox\@tempboxa |
| 1375 |
\else \@tempdima\ht\@tempboxa |
| 1376 |
\advance\@tempdima\dp\@tempboxa |
| 1377 |
\vskip\@tempdima |
| 1378 |
\prevdepth\dp\@tempboxa \fi |
| 1379 |
\unvbox\dfn@boxa\vss}\fi\hss}}}\fi\fi |
| 1380 |
\global\dfn@fnht\z@ |
| 1381 |
\ifx\dfn@list\@empty\else |
| 1382 |
\let\@elt\dfn@elt@adjust \dfn@dima\z@ \dfn@dimb\z@ |
| 1383 |
\dfn@list \global\advance\dfn@fnht\dfn@dimb |
| 1384 |
\let\@elt\relax |
| 1385 |
\ifdim\dfn@dimb>\z@ |
| 1386 |
\xdef\dfn@list{\@elt{0}{\number\dfn@dimb}\dfn@list}% |
| 1387 |
\insert\footins{\floatingpenalty\@MM |
| 1388 |
\vbox to\dfn@dimb{}}\fi |
| 1389 |
\ifdim\dfn@fnht>\@tempdima |
| 1390 |
\@tempdimb\@tempdima \advance\@tempdimb-\dfn@fnht |
| 1391 |
\global\dfn@fnht\@tempdima |
| 1392 |
\xdef\dfn@list{\dfn@list\@elt{0}{\number\@tempdimb}}% |
| 1393 |
\xdef\dfn@afteroutput{\insert\footins{ |
| 1394 |
\floatingpenalty\@MM |
| 1395 |
\vbox to\number\@tempdimb sp{}}% |
| 1396 |
\global\let\noexpand\dfn@afteroutput\relax}% |
| 1397 |
\fi\fi |
| 1398 |
\fi}% |
| 1399 |
\let\footnoterule\relax \dfn@latex@makecol |
| 1400 |
\let\footnoterule\dfn@footnoterule} |
| 1401 |
\let\dfn@footnoterule\footnoterule |
| 1402 |
|
| 1403 |
\def\dfn@countins{\setbox\footins\vbox{\unvbox\footins |
| 1404 |
\global\setbox\dfn@boxa\lastbox}% |
| 1405 |
\ifvoid\dfn@boxa \let\next\relax |
| 1406 |
\else \advance\@tempcnta\@ne \let\next\dfn@countins \fi \next} |
| 1407 |
|
| 1408 |
\def\dfn@elt@getht#1#2{\advance\@tempdima#1sp\relax \advance\@tempcnta\m@ne |
| 1409 |
\ifnum\@tempcnta>\z@ \let\next\relax |
| 1410 |
\else\let\next\dfn@endgetht \fi \next} |
| 1411 |
\def\dfn@endgetht#1\@nil{\gdef\dfn@list{#1}} |
| 1412 |
|
| 1413 |
\def\dfn@elt@adjust#1#2{\advance\dfn@dima#1sp\advance\dfn@fnht#2sp\relax |
| 1414 |
\ifvoid\dfn@ins \@tempdima\z@ \@tempdimb\z@ |
| 1415 |
\else \setbox\dfn@boxa\copy\dfn@ins |
| 1416 |
\dfn@split\dfn@dima\dfn@boxa\dfn@boxb\z@\z@ |
| 1417 |
\dfn@split{.5\ht\dfn@boxb}\dfn@boxb\dfn@boxa |
| 1418 |
\dfn@fnmaxdp\footnotesep |
| 1419 |
\advance\@tempdimb\@tempdima \@tempdima\@tempdimb \fi |
| 1420 |
\advance\@tempdimb-\dfn@fnht\relax |
| 1421 |
\ifdim\@tempdimb>\dfn@dimb \dfn@dimb\@tempdimb \fi} |
| 1422 |
|
| 1423 |
\let\dfn@afteroutput\relax |
| 1424 |
\output{\the\dfn@output \aftergroup\dfn@afteroutput} |
| 1425 |
|
| 1426 |
%%^L |
| 1427 |
% \end{macrocode} |
| 1428 |
% |
| 1429 |
% |
| 1430 |
% |
| 1431 |
% \subsubsection{Initialization, etc.} |
| 1432 |
% \label{sec:imp-dfn-init} |
| 1433 |
% |
| 1434 |
% \begin{macro}{\dfn@document} |
| 1435 |
% \begin{macro}{\document} |
| 1436 |
% Since the default value of |\DFNcolumnsep| is that of |\columnsep| that |
| 1437 |
% may be set in other styles and/or preamble, we have to modify |\document| |
| 1438 |
% to set |\DFNcolumnsep| to the value of |\columnsep| if it is negative |
| 1439 |
% after the invocation of the original version of |\document|, |
| 1440 |
% |\dfn@document|. We also set |\DFNcolumnwidth| to its default value |
| 1441 |
% calculated from |\DFNcolumnsep| and |\textwidth| if it is negative. |
| 1442 |
% \end{macro}\end{macro} |
| 1443 |
% |
| 1444 |
% \begin{macro}{\dfn@latex@makecol} |
| 1445 |
% \begin{macro}{\@makecol} |
| 1446 |
% Another reason why we modify |\document| is the modification of |
| 1447 |
% |\@makecol|. In order to allow our footnote styles (and others hopefully) |
| 1448 |
% to be loaded in any order, we capture possibly-modified definition of |
| 1449 |
% |\@makecol| in |\document| to save it in |\dfn@latex@makecol| as the |
| 1450 |
% original version, and make |\@makecol| |\let|-equal to our own version |
| 1451 |
% |\dfn@makecol|. |
| 1452 |
% \end{macro}\end{macro} |
| 1453 |
% |
| 1454 |
% \begin{macrocode} |
| 1455 |
|
| 1456 |
%% Initialization, etc. |
| 1457 |
|
| 1458 |
\let\dfn@document\document |
| 1459 |
\def\document{\dfn@document |
| 1460 |
\ifdim\DFNcolumnsep<\z@ \DFNcolumnsep\columnsep \fi |
| 1461 |
\ifdim\DFNcolumnwidth<\z@ |
| 1462 |
\DFNcolumnwidth\textwidth |
| 1463 |
\advance\DFNcolumnwidth-\DFNcolumnsep |
| 1464 |
\divide\DFNcolumnwidth\tw@ \fi |
| 1465 |
\dfn@fnht\z@ |
| 1466 |
\let\dfn@latex@makecol\@makecol |
| 1467 |
\let\@makecol\dfn@makecol} |
| 1468 |
|
| 1469 |
% \end{macrocode} |
| 1470 |
% |
| 1471 |
% \begin{macro}{\dfn@twocolumn} |
| 1472 |
% \begin{macro}{\twocolumn} |
| 1473 |
% \begin{macro}{\dfn@onecolumn} |
| 1474 |
% \begin{macro}{\onecolumn} |
| 1475 |
% We also switch |\@makecol| to original\slash own version in modified |
| 1476 |
% |\twocolumn|\slash |\onecolumn| because double-columned footnotes are |
| 1477 |
% available only in single column documents. In those macros, prior to |
| 1478 |
% the invocation of their original versions, |\dfn@twocolumn| and |
| 1479 |
% |\dfn@onecolumn|, |\@footnotetext| is also set to corresponding macros that |
| 1480 |
% are original |\dfn@latex@footnotetext| or our own |\dfn@footnotetext|. |
| 1481 |
% \end{macro}\end{macro}\end{macro}\end{macro} |
| 1482 |
% |
| 1483 |
% \begin{macrocode} |
| 1484 |
\let\dfn@twocolumn\twocolumn |
| 1485 |
\def\twocolumn{\clearpage |
| 1486 |
\let\@footnotetext\dfn@latex@footnotetext |
| 1487 |
\let\@makecol\dfn@latex@makecol |
| 1488 |
\dfn@twocolumn} |
| 1489 |
\let\dfn@onecolumn\onecolumn |
| 1490 |
\def\onecolumn{\clearpage |
| 1491 |
\let\@footnotetext\dfn@footnotetext |
| 1492 |
\let\@makecol\dfn@makecol |
| 1493 |
\dfn@onecolumn} |
| 1494 |
% \end{macrocode} |
| 1495 |
% |
| 1496 |
% \iffalse |
| 1497 |
%</dblfnote> |
| 1498 |
% \fi |
| 1499 |
% |
| 1500 |
% |
| 1501 |
% |
| 1502 |
% \IndexPrologue{\newpage\section*{Index} |
| 1503 |
% Italicized number refers to the page where the specification and usage of |
| 1504 |
% corresponding entry is described, while underlined is for the |
| 1505 |
% implementation of the entry.} |
| 1506 |
% \Finale |
| 1507 |
% \GlossaryPrologue{\newpage\section*{Revision History}} |
| 1508 |
% \PrintChanges |
| 1509 |
\endinput |