diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-11 23:59:32 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-11 23:59:32 +0000 |
commit | 7dc30defbc0fd4589277ff8ab1089d7926df89c5 (patch) | |
tree | f796468f5d6a3de27048e7f9f472a640408ac573 | |
parent | 6bdfeba01eaf04a583e531ae5c15cb7fd0e5f820 (diff) |
trunk/Master/texmf-dist/source/latex/yafoot
git-svn-id: svn://tug.org/texlive/trunk@599 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/source/latex/yafoot/yafoot.dtx | 1476 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/yafoot/yafoot.ins | 8 |
2 files changed, 1484 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/yafoot/yafoot.dtx b/Master/texmf-dist/source/latex/yafoot/yafoot.dtx new file mode 100644 index 00000000000..afcc4fdedfc --- /dev/null +++ b/Master/texmf-dist/source/latex/yafoot/yafoot.dtx @@ -0,0 +1,1476 @@ +% \iffalse +%<pfnote>%% Style file `pfnote'. +%<fnpos>%% Style file `fnpos'. +%<dblfnote>%% Style file `dblfnote'. +%% Copyright (C) 1999 Hiroshi Nakashima <nakasima@tutics.tut.ac.jp> +%% (Toyohashi Univ. of Tech.) +%% +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License distributed from CTAN +%% archives in directory macros/latex/base/lppl.txt; either +%% version 1 of the License, or any later version. +%% +% \fi +% +% \CheckSum{802} +%% \CharacterTable +%% {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 +%% 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 +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +%% +% \iffalse +%% +%<*dtx> +\ProvidesFile{yafoot.dtx} +%</dtx> +%<pfnote|fnpos|dblfnote>\def\next{LaTeX2e} +%<pfnote|fnpos|dblfnote>\ifx\fmtname\next +%<pfnote|fnpos|dblfnote>\def\next{ +%<pfnote|fnpos|dblfnote>\NeedsTeXFormat{LaTeX2e}[1994/12/01] +%<pfnote>\ProvidesPackage{pfnote}} +%<fnpos>\ProvidesPackage{fnpos}} +%<dblfnote>\ProvidesPackage{dblfnote}} +%<pfnote|fnpos|dblfnote>\else\def\next[#1]{}\fi +%<pfnote|fnpos|dblfnote>\next +%<driver>\ProvidesFile{yafoot-man.tex} +% \fi +% \ProvidesFile{yafoot.dtx} +[1999/07/14 v1.0 ] +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\usepackage{pfnote} +\usepackage{fnpos} +\usepackage{dblfnote} +\DisableCrossrefs +\PageIndex +\CodelineNumbered +\RecordChanges +%</driver> +%<driver>\OnlyDescription +%<driver>\def\ONLYDESCRIPTION{} +%<*driver> +\advance\textwidth4em +\DFNcolumnsep1.5\columnsep +\begin{document} +\DocInput{yafoot.dtx} +\end{document} +%</driver> +% \fi +% \changes{v0.1}{1991/10/29} +% {The style pfnote is born.} +% \changes{v0.2}{1993/05/20} +% {Footnote pushing function is posted to comp.text.tex.} +% \changes{v0.3}{1993/08/17} +% {Exchanging footnotes and bottom floats in fnpos is posted to +% fj.comp.texhax.} +% \changes{v0.4}{1995/06/21} +% {First version of dblfnote is posted to comp.text.tex.} +% \changes{v1.0}{1999/07/14} +% {Three styles are merged into yafoot.dtx and rewritten.} +% +% \errorcontextlines10000 +% \GetFileInfo{yafoot.dtx} +% \setcounter{IndexColumns}{2} +% +% \def\bottomfraction{.9} +% \def\cs#1{\hbox{\tt\char\escapechar#1}} +% \def\Item{\vskip-\itemsep\vskip-\parsep\vskip0pt\item} +% +% \makeatletter +% \def\nosv{\catcode`\|12} +% +% \def\eqnarray{\stepcounter{equation}\let\@currentlabel=\theequation +% \global\@eqnswtrue +% \global\@eqcnt\z@\tabskip\@centering\let\\=\@eqncr +% $$\halign to \displaywidth\bgroup\hskip\@centering +% $\displaystyle\tabskip\z@{##}$\@eqnsel&\global\@eqcnt\@ne +% \hfil$\;{##}\;$\hfil +% &\global\@eqcnt\tw@ $\displaystyle\tabskip\z@{##}$\hfil +% \tabskip\@centering&\llap{##}\tabskip\z@\cr} +% +% \def\Meta#1{\penalty\@highpenalty +% \hbox{{\tt\char`\{}{\it\meta{#1}}{\tt\char`\}}}} +% \def\opt#1{{\tt[}{\it\meta{#1}}{\tt]}} +% \def\optn#1{{\tt[#1]}} +% \def\arg#1{{\tt\char`\{#1\char`\}}} +% +% \let\latex@addmarginpar\@addmarginpar +% \let\latex@latex@warning@no@line\@latex@warning@no@line +% \def\@addmarginpar{\let\@latex@warning@no@line\@gobble +% \latex@addmarginpar +% \let\@latex@warning@no@line\latex@latex@warning@no@line} +% \let\@font@warning\@gobble +% +% \long\def\m@cro@#1#2{\endgroup \topsep\MacroTopsep \trivlist +% \edef\saved@macroname{\string#2} +% \def\makelabel##1{\llap{##1\hskip\@totalleftmargin}} +% \if@inlabel +% \let\@tempa\@empty \count@\macro@cnt +% \loop \ifnum\count@>\z@ +% \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat +% \edef\makelabel##1{\llap{\vtop to\baselineskip +% {\@tempa\hbox{##1}\vss} +% \hskip\@totalleftmargin}} +% \advance \macro@cnt \@ne +% \else \macro@cnt\@ne \fi +% \edef\@tempa{\noexpand\item[ +% #1 +% \noexpand\PrintMacroName +% \else +% \noexpand\PrintEnvName +% \fi +% {\string#2}]} +% \@tempa +% \global\advance\c@CodelineNo\@ne +% #1 +% \SpecialMainIndex{#2}\nobreak +% \DoNotIndex{#2} +% \else +% \SpecialMainEnvIndex{#2}\nobreak +% \fi +% \global\advance\c@CodelineNo\m@ne +% \ignorespaces} +% +% \def\dummymacro{\topsep\MacroTopsep \trivlist \item[]} +% \let\enddummymacro\endtrivlist +% +% \def\DescribeOpt{\leavevmode\@bsphack\begingroup\MakePrivateLetters +% \Describe@Opt} +% \def\Describe@Opt#1{\endgroup \Describe@pt{#1}} +% \def\Describe@pt#1#2{ +% \marginpar{\raggedleft\PrintDescribeMacro{#1}} +% \SpecialOptUsageIndex{#1}{#2}} +% \def\SpecialOptUsageIndex#1#2{ +% \index{#1\actualchar{\protect\ttfamily#1} (#2)\encapchar usage} +% \index{#2s:\levelchar{\protect\ttfamily#1}\encapchar usage} +% \@esphack\ignorespaces} +% \def\SpecialOptMainIndex#1#2{ +% \index{#1\actualchar{\protect\ttfamily#1} (#2)\encapchar main} +% \index{#2s:\levelchar{\protect\ttfamily#1}\encapchar main} +% \@esphack\ignorespaces} +% \def\SpecialOptIndex#1#2{ +% \index{#1\actualchar{\protect\ttfamily#1} (#2)} +% \index{#2s:\levelchar{\protect\ttfamily#1}} +% \@esphack\ignorespaces} +% \def\SpecialOptIndexS#1#2{ +% \index{#1\actualchar{\protect\ttfamily#1} (#2)} +% \index{#2es:\levelchar{\protect\ttfamily#1}} +% \@esphack\ignorespaces} +% +% \begingroup +% \gdef\@sverbcat{\catcode`\@\active\catcode`\#\active} +% \catcode`\@\active \gdef@{\char`\@\penalty\exhyphenpenalty} +% \catcode`\#\active \gdef#{\penalty\exhyphenpenalty} +% \endgroup +% \let\latex@sverb\@sverb +% \def\@sverb{\@sverbcat\latex@sverb} +% +% \def\theglossary{\onecolumn \glossary@prologue +% \GlossaryParms \let\item\@idxitem \ignorespaces} +% \def\endtheglossary{\relax} +% +% +% +% \def\bracepair{`{\tt\char`\{\char`\}'}} +% +% \ifx\ONLYDESCRIPTION\undefined\else +% \let\SpecialUsageIndex\SpecialMainIndex +% \let\SpecialOptUsageIndex\SpecialOptMainIndex +% \fi +% +% +% +% \title{\textsf{pfnote}, \textsf{fnpos} and \textsf{dblfnote}\\ +% Packages for Footnotes\thanks{ +% This file has version number \fileversion, last revised \filedate.}} +% \author{Hiroshi Nakashima\\(Toyohashi Univ. of Tech.)} +% \date{\filedate} +% \maketitle +% +% \begin{abstract} +% This file provides three style files; \textsf{pfnote} to enclose footnote +% numbering in a page; \textsf{fnpos} to control the vertical position of +% footnotes; \textsf{dblfnote} to make footnote double-columned. +% \end{abstract} +% +% \tableofcontents +% \newpage +% +% +% \section{Introduction} +% \label{sec:intro} +% +% \LaTeX{} users often bother about fine points of footnote. How can I +% reset |footnote| counter when a page is produced in order to keep the +% counter from having too large, say 30, in a document with many footnotes? +% How can I place footnotes at more appropriate position? How can I make +% footnotes double-columned while main text is single-columned? +% +% The style files distributed with this document will solve these problems. +% You will have the following three style files by processing +% \textsf{yafoot.dtx}\footnote{ +% +% It stands for ``Yet Another FOOTnote.''} +% +% with \textsf{docstrip}. +% +% \begin{description} +% \item[\textsf{pfnote}] +% \DescribeOpt{pfnote}{style file} +% provides a new version of |\footnote| to make footnote numbering enclosed +% in a page. That is, the counter |footnote| is reset whenever a page is +% produced and thus the first footnote in a page is numbered 1 no matter how +% it stands in the sequence of footnotes in a document. Since this document +% itself uses \textsf{pfnote}, you will see how footnotes are numbered. +% +% \item[\textsf{fnpos}] +% \DescribeOpt{fnpos}{style file} +% provides following commands to control the vertical position of footnotes. +% +% \begin{itemize} +% \item +% \DescribeMacro{\makeFNbottom} +% \DescribeMacro{\makeFNmid} +% |\makeFNbottom| makes footnotes always placed at the bottom of a +% |\ragged#bottom| page, while |\makeFNmid| allows footnotes directly follow +% the main text of a page as standard \LaTeX{} does. +% +% \item +% \DescribeMacro{\makeFNbelow} +% \DescribeMacro{\makeFNabove} +% |\makeFNbelow| places footnotes below bottom floats (i.e. figures and +% tables), while |\makeFNabove| is to place footnotes above bottom floats as +% standard \LaTeX{} does. +% \end{itemize} +% +% This document also uses \textsf{fnpos} to make footnotes {\em bottom} and +% {\em below}\footnote{ +% +% But the effect will be hardly seen except in the right column of +% page~\pageref{pag:shfnp-2} where we show the effect explicitly.}. +% +% The first version of these commands are posted by the author to news +% groups |comp.text.tex| and |fj.comp.texhax| as the answers to the posts by +% Martin Boyer and Nobuaki Minematsu. +% +% \item[\textsf{dblfnote}] +% \DescribeOpt{dblfnote}{style file} +% makes footnotes double-columned. It also provides a few commands to +% control column breaking. The first version of the style file is created +% for Tim Armstrong's post to |comp.text.tex|. Since this document uses +% \textsf{fnpos}, you will find that the footnotes\footnote{ +%. +% This document has many footnotes, some of which are just to show how our +% footnote mechanisms work.} +% +% in this page are double-columned. +% \end{description} +% +% Note that these style files may be used either solely, or combined each +% other as done in this document. +% +% +% +% \section{Usage} +% \label{sec:usage} +% \subsection{Loading Style Files} +% \label{sec:usage-load} +% +% All the three style files are usable to both \LaTeXe{} and \LaTeX-2.09 +% users with their standard package loading declaration. If you use +% \LaTeXe{} and wish to load, for example, \textsf{pfnote} and +% \textsf{fnpos}, simply do the following. +% +% \begin{quote} +% \SpecialUsageIndex{\usepackage} +% |\usepackage{pfnote}|\\ +% |\usepackage{fnpos}| +% \end{quote} +% +% If you still love \LaTeX-2.09, the following is what you have to do. +% +% \begin{quote} +% \SpecialUsageIndex{\documentstyle} +% |\documentstyle[..,pfnote,fnpos,...]|\Meta{main-style} +% \end{quote} +% +% Note that any combination of three styles are allowed and they are +% insensitive to their loading order. +% +% +% +% \subsection{\textsf{pfnote}: Enclose Footnote Numbers within a Page} +% \label{sec:usage-pfnote} +% +% \DescribeOpt{pfnote}{style file} +% Just loading \textsf{pfnote} is everything that you have to do to make +% footnote numbering enclosed in a page\footnote{ +% +% Here you will find this fourth footnote is numbered one.}. +% +% Only one thing you have to remember is that footnote numbers will be +% adjusted after you run \LaTeX{} {\em twice}, as |\ref|-erences to +% |\label|-s are. +% +% +% +% \subsection{\textsf{fnpos}: Control Vertical Position of Footnotes} +% \label{sec:usage-fnpos} +% +% \DescribeOpt{fnpos}{style file} +% The following four commands are available to control the vertical position +% of footnotes. +% +% \begin{description} +% \item[\cs{makeFNbottom}] +% \DescribeMacro{\makeFNbottom} +% \SpecialIndex{\raggedbottom} +% makes footnotes always placed at the bottom of a |\raggedbottom| page, +% even if the page is too short to push the footnotes to its bottom because, +% for example, the page is broken just before a tall object such as a +% |tabular|. This is default. +% +% \item[\cs{makeFNmid}] +% \DescribeMacro{\maekFNmid} +% cancels the effect of |\makeFNbottom| to allow footnotes directly follow +% the main text of a page as standard \LaTeX{} does. +% +% \item[\cs{makeFNbelow}] +% \DescribeMacro{\maekFNbelow} +% places footnotes {\em below} bottom floats (i.e. figures and tables). +% This is default. +% +% \item[\cs{makeFNabove}] +% \DescribeMacro{\maekFNabove} +% cancels the effect of |\makeFNabove| to place footnotes {\em above} bottom +% floats as standard \LaTeX{} does. +% \end{description} +% +% Note that if you are using p\LaTeX{}, a Japanese version of \LaTeX, it +% might be unnecessary to use \textsf{pfnote} because p\LaTeX{} does what +% |\makeFNbottom| and |\makeFNbelow| do\footnote{ +% +% Very strictly speaking, the mechanism of p\LaTeX{} is slightly different +% from that of \textsf{fnpos} but the difference is hardly recognizable.}. +% +% However, if you wish to follow the real \LaTeX's standard, |\makeFNmid| +% and |\makeFNabove| will do for you. +% +% The following two two-columned pages show the effects of the commands. +% +% \newpage +% \twocolumn +% \def\showfnposleaders{\xleaders +% \hbox to\hsize{\hss.\vrule height.3\baselineskip width0pt\hss}\vfil} +% \def\showfnpos#1#2#3{\par#1#2\noindent +% This column is typeset with \texttt{\string#1} and \texttt{\string#2} +% \footnote{#3}.\par\nobreak +% \vbox to.4\textheight{ +% \showfnposleaders\smallskip +% \centerline{(Main text of this column is here.)}\smallskip +% \showfnposleaders} +% \begin{figure}[b] +% \fboxsep0pt +% \hbox{\fbox{\vbox to.4\textheight{\vfil +% \centerline{Here is a bottom float.}\vfil}}} +% \end{figure} +% \break} +% +% \label{pag:shfnp-1} +% \showfnpos\makeFNmid\makeFNabove{ +% Therefore, this footnote is {\em above} the bottom float leaving +% spaces at the bottom of this column.} +% +% \showfnpos\makeFNmid\makeFNbelow{ +% Therefore, this footnote is {\em below} the bottom float still +% leaving spaces at the bottom of this column.} +% +% \label{pag:shfnp-2} +% \showfnpos\makeFNbottom\makeFNabove{ +% Therefore, this footnote is {\em above} the bottom float that is +% pushed to the {\em bottom} of this column together with this footnote.} +% +% \showfnpos\makeFNbottom\makeFNbelow{ +% Therefore, this footnote is {\em below} the bottom float, and at the +% {\em bottom} of this column alone.} +% +% +% +% \newpage +% \onecolumn\par +% \subsection{\textsf{dblfnote}: Make Footnotes Double-Columned} +% +% \DescribeOpt{dblfnote}{style file} +% Simply loading \textsf{dblfnote} will make footnotes double-columned. For +% fine tuning of double-columning, however, you have a few style parameters +% and commands as follows. +% +% \begin{description} +% \item[\texttt{DFNsloppiness}] +% \DescribeOpt{DFNsloppiness}{counter}% +% defines how sloppy paragrahs in footnotes are typeset. Since lines of +% footnotes are narrow, you might wish to typeset footnotes in some +% |\sloppy| manner in order to avoid underfull. Setting |DFNsloppiness| to +% larger value up to 9999, footnote paragraphs will be sloppier. The +% default is 5000. +% +% \item[\cs{DFNcolumnsep}] +% \begin{DFNinhibitcbreak}% +% \DescribeMacro{\DFNcolumnsep}% +% \SpecialIndex{\columnsep}% +% is the distance of footnote columns is specified by the value of +% |\DFNcolumn#sep|. If you don't set this parameter explicitly\footnote{ +% +% Strictly speaking, unless you set a non-negative value in the document +% preamble.}, +% +% the value is that of |\columnsep|. For example, the author set +% |\DFNcolumnsep| to $1.5\times\hbox{|\columnsep|}$ in this document. +% \end{DFNinhibitcbreak} +% +% \item[\cs{DFNcolumnwidth}] +% \DescribeMacro{\DFNcolumnwidth}% +% is the width of a footnote column. If you don't set this parameter +% explicitly, as expected, it is automatically set to +% $(|\textwidth|-|\DFNcolumnsep|)/2$. +% +% \item[\cs{DFNallowcbreak}] +% \DescribeMacro{\DFNallowcbreak} +% \DescribeMacro{\DFNinhibitcbreak} +% allows a footnote is broken into two columns, while {\bfseries +% |\DFNinhibitcbreak|} inhibits it. In default, column breaking is allowed. +% +% \item[\cs{DFNtrysingle}] +% \DescribeMacro{\DFNtrysingle} +% \DescribeMacro{\DFNalwaysdouble} +% places footnotes only in the left column if the page containing them has +% enough space as shown in pages~1, +% \pageref{sec:usage-fnpos} and this page, while {\bfseries +% |\DFNalwaysdouble|} makes them double-columned (almost) always. In +% default, single-columning is tried. +% +% \item[\cs{DFNruleleft}] +% \DescribeMacro{\DFNruleleft} +% \DescribeMacro{\DFNruleboth} +% draws |\footnoterule| over footnotes in left column only, while {\bfseries +% |\DFNrule#both|} draws in both columns. In default, the rule is drawn in +% left column only. +% \end{description} +% +% \SpecialIndex{\twocolumn} +% \SpecialIndex{\onecolumn} +% Note that \textsf{dblfnote} will do nothing if |\twocolumn| is in effect, +% as shown in pages~\pageref{pag:shfnp-1} and~\pageref{pag:shfnp-2}. That +% is, footnotes are put as in usual double-coulumned document. If you +% change the page structure to |\onecolumn|, the mechanism of +% \textsf{dblfnote} is enabled again as shown in this page. +% +% +% \section{Known Problems} +% \label{sec:prob} +% +% \begin{enumerate} +% \item +% \SpecialOptIndex{minipage}{environment} +% The style \textsf{pfnote} does not enlose the number of footnotes in +% |minipage| environment. +% +% \item +% The style \textsf{dblfnote} may mistakingly produce a little bit too +% short pages if an extremely long paragraph has footnotes. More +% specifically, if a paragraph runs across three or more pages $p_1$, +% \ldots, $p_n$, and its first and last footnote appears in $p_i$ ($i\leq n-2$) +% and $p_j$ ($j>i$), pages $p_{i+1}$ to $p_j$ may be a little bit too short +% especially for those without footnotes. +% \end{enumerate} +% +% +% +% \IndexPrologue{\newpage\section*{Index} +% Underlined number refers to the page where the specification of +% corresponding entry is described.} +% \StopEventually{ +% \section*{Acknowledgments} +% +% The author thanks to Martin Boyer and Nobuaki Minematsu whose posts to +% news groups triggered writing very first version of macros in +% \textsf{fnpos}. He also thanks to Tim Armstrong whose post to +% \texttt{comp.text.tex} encouraged him to make the first version of +% \textsf{dblfnote} that requires considerable hack. +% +% For the implementation of three style files, the author refers the base +% implementations of the macros for \cs{footnote} and for \cs{output} +% routine. These macros are written by Leslie Lamport as a part of +% \LaTeX-2.09 and \LaTeXe{} (1997/12/01) to which Johannes Braams and other +% authors also contributed. +% +% \PrintIndex} +% +% +% +% \newpage +% \section{Implementation} +% \label{sec:imp} +% \subsection{Tricks for Compatibility} +% \label{sec:imp-compat} +% +% At the very beginning of each style file, we checks whether it is +% loaded by \LaTeXe{} or \LaTeX-2.09, and then declares |\NeedsTeXFormat| +% and |\ProvidesPackage| if \LaTeXe{}. This part is embedded at the +% beginning of \textsf{yafoot.dtx} in a tricky manner to let +% \textsf{docstrip} produce the following code, for example for +% \textsf{pfnote}. +% \SpecialIndex{\NeedsTeXFormat} +% \SpecialIndex{\ProvidesPackage} +% +%\begin{quote} +%\begin{verbatim} +%\def\next{LaTeX2e} +%\ifx\fmtname\next +%\def\next{ +%\NeedsTeXFormat{LaTeX2e}[1994/12/01] +%\ProvidesPackage{pfnote}} +%\else\def\next[#1]{}\fi +%\next +%[1999/07/14 v1.0 ] +%\end{verbatim} +%\end{quote} +% +% +% +% \subsection{\textsf{pfnote}} +% \label{sec:imp-pfnote} +% +% \iffalse +%<*pfnote> +% \fi +% To enclose |\c@footnote| within a page, we identify each footnote $f_i$ +% by a global serial number $i$ and associate it with the {\em physical} +% page number $p_i$ where it appears. These attributes $i$ and $p_i$ are +% written to |.aux| file in the form of |\pfn@fnote|\Meta{$i$}\Meta{$p_i$}. +% This macro is evaluated in \LaTeX's |\document| and |\def|-ines a macro +% whose name is ``|\pfn@fn|\meta{$i$}'' and body is \meta{$p_i$}. +% +% Then, when we process the footnote $f_i$, we can have $p_i$ by evaluating +% |\pfn@fn|\meta{$i$} and compare it with $p_{i-1}$. If $p_i=p_{i-1}$, +% $f_i$ is the first footnote in page $p_i$ and thus its number should be +% one. Otherwise, the number of $f_i$ should be that of $f_{i-1}$ plus one. +% +% \begin{macro}{\pfn@fnotectr} +% \begin{macro}{\pfn@page} +% \begin{macro}{\pfn@pageprev} +% To implement the algorithm shown above, we use three |\count| registers; +% |\pfn@fnotectr| for $i$ initialized to zero; |\pfn@page| for physical page +% number initialized to one; and |\pfn@pageprev| to keep $p_{i-1}$ with +% initial value zero. Note that |\pfn@page| is not |\c@page| but has +% physical page number, and thus any $p_i$ cannot be zero that is the initial +% value of |\pfn@pageprev|. +% \end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} + +\newcount\pfn@fnotectr \pfn@fnotectr\z@ +\newcount\pfn@page \pfn@page\@ne +\newcount\pfn@pageprev \pfn@pageprev\z@ + +% \end{macrocode} +% +% \begin{macro}{\pfn@footnote} +% \begin{macro}{\footnote} +% \begin{macro}{\pfn@footnotemark} +% \begin{macro}{\footnotemark} +% \begin{macro}{\pfn@mpfn} +% We have to modify |\footnote| and |\footnotemark| so that they invoke +% |\pfn@adjust| to do what we described at the beginning of this section, if +% they refer and increment |\c@footnote|. In order to minimize +% copy-and-modify of their original codes, we simply call their original +% versions, |\pfn@footnote| and |\pfn@footnotemark|, if optional argument is +% given accepting a little bit performance degradation by double checking of +% the optional argument\footnote{ +% +% We of course know that we can call \cs{@xfootnote} and +% \cs{@xfootnotemark}, but this implementation is safer.}. +% +% Otherwise, |\pfn@adjust| is invoked if |\@mpfn| is ``|footnote|'', the +% body of |\pfn@mpfn| in the case of |\footnote|, or always in the case of +% |\footnotemark|. Thus |mpfootnote| is eliminated from our mechanism as +% shown in \S\ref{sec:prob}, although including it is not hard. +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\let\pfn@footnote\footnote +\def\footnote{\@ifnextchar[%] + {\pfn@footnote}% + {\ifx\@mpfn\pfn@mpfn \pfn@adjust \fi \pfn@footnote}} +\let\pfn@footnotemark\footnotemark +\def\footnotemark{\@ifnextchar[%] + {\pfn@footnotemark}{\pfn@adjust \pfn@footnotemark}} +\let\pfn@mpfn\@mpfn + +% \end{macrocode} +% +% \begin{macro}{\pfn@adjust} +% The main procedure of enclosing is performed by |\pfn@adjust|. First, +% after |\global|-ly incrementing |\pfn@fnotectr| ($i$), it |\write|-s +% |\pfn@fnpage|\Meta{$i$}\Meta{$P$} by well-known technique of the +% combination of delayed evaluation of physical page number $P$ and +% immediate evaluation of other staffs. +% +% Then it obtains $p_i$ by evaluating |\pfn@fn|$i$ and compares it to +% $p_{i-1}$ in |\pfn@pageprev|. If they are not equal, |\c@footnote| is +% reset to make $f_i$ have number one, and |\pfn@pageprev| is set to $p_i$. +% Since we also reset |\c@footnote| if |\pfn@fn|$i$ is undefined, all the +% footnotes will have number one on the first run of \LaTeX{} for a +% document. +% \end{macro} +% +% \begin{macrocode} +\def\pfn@adjust{\global\advance\pfn@fnotectr by\@ne + \if@filesw + \edef\@tempa{\write\@auxout{\string\pfn@fnpage + {\number\pfn@fnotectr}% + {\noexpand\number\noexpand\pfn@page}}}\@tempa \fi + \expandafter\ifx\csname pfn@fn\number\pfn@fnotectr\endcsname\relax + \global\c@footnote\z@ \else + \expandafter\@tempcnta\csname pfn@fn\number\pfn@fnotectr\endcsname + \relax \ifnum\@tempcnta=\pfn@pageprev\else + \global\pfn@pageprev\@tempcnta \global\c@footnote\z@ \fi \fi} + +% \end{macrocode} +% +% \begin{macro}{\pfn@fnpage} +% The macro |\pfn@fnpage|\Meta{$i$}\Meta{$p_i$} written in |.aux| and +% evaluated in |\document| simply |\def|-ines |\pfn@fn|$i$ with the body +% $p_i$. +% \end{macro} +% +% \begin{macrocode} +\def\pfn@fnpage#1#2{\global\@namedef{pfn@fn#1}{#2}} + +% \end{macrocode} +% +% \begin{macro}{\pfn@outputpage} +% \begin{macro}{\@outputpage} +% To keep track physical page number in |\pfn@page|, we modify +% |\@outputpage| so that it increments |\pfn@page| when it does |\c@page|. +% \end{macro}\end{macro} +% +% \begin{macrocode} +\let\pfn@outputpage\@outputpage +\def\@outputpage{\pfn@outputpage \global\advance\pfn@page\@ne} +% \end{macrocode} +% +% \iffalse +%</pfnote> +% \fi +% +% +% +% \subsection{\textsf{fnpos}} +% \label{sec:imp-fnpos} +% +% \iffalse +%<*fnpos> +% \fi +% \begin{macro}{\iffnp@bottom} +% \begin{macro}{\iffnp@below} +% To control the position of footnotes, we introduce two switches; +% |\iffnp@bottom| is true if |\makeFNbottom| is in effect; |\iffnp@below| +% is true if |\makeFNbelow| is in effect. In default, they both are true. +% \end{macro}\end{macro} +% +% \begin{macrocode} + +\newif\iffnp@bottom \fnp@bottomtrue +\newif\iffnp@below \fnp@belowtrue + +% \end{macrocode} +% +% \newpage +% \begin{macro}{\makeFNbottom} +% \begin{macro}{\makeFNmid} +% \begin{macro}{\makeFNbelow} +% \begin{macro}{\makeFNabove} +% User interface macros are trivial, i.e. they turn the switches true or false. +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\def\makeFNbottom{\fnp@bottomtrue} +\def\makeFNmid{\fnp@bottomfalse} +\def\makeFNbelow{\fnp@belowtrue} +\def\makeFNabove{\fnp@belowfalse} + +% \end{macrocode} +% +% \begin{macro}{\@makecol} +% \begin{macro}{\fnp@textbottom} +% The essential part of \textsf{fnpos} is a modified version of |\@makecol|. +% If |\iffnp@below| is true, we reverse the order of |\@combinefloats| and +% the insertion of |\footins|. At the insertion of |\footins|, we insert +% |\@textbottom| prior to |\footins| to push it to the bottom if +% |\iffnp@bottom| is true. We also temporarily nullify |\@textbottom|, +% whose definition is saved into |\fnp@textbottom|, if it has been inserted +% with |\footins| in order to keep the following |\@outputbox| construction +% in |\@makecol| or |\@makespecialcolbox| from inserting it again. +% +% Here we discuss a few compatibility issues. In \LaTeXe, |\footins| +% inserted in the construct of |\color@begroup| and |\color@endgroup| which +% \LaTeX-2.09 does not have. Thus we call them and |\normalcolor| by +% |\csname|\slash |\endcsname| construct to allow they are undefined. +% +% The |\insert|-ion object |\@kludgeins| and the macro |\@makespecialcolbox| +% are also \LaTeXe's new comers for |\enlargethispage|. For \LaTeX-2.09, we +% make |\@klugeins| |\let|-equal to |\voidb@x| that will never be a |\vbox|, +% and thus |\@makespecialcolbox| will never be expanded. +% +% We also have to take care of p\LaTeX{} whose |\@makespecialcolbox| inserts +% |\footins| and |\@texbottom| as we do for |\makeFNbottom| and +% |\makeFNbelow|. However, since |\footins| is set to void by our insertion +% and |\@textbottom| is nullified if |\iffnp@bottom| is true, these +% insertions will have no effect as have to be. +% \end{macro}\end{macro} +% +% \begin{macrocode} +\def\@makecol{\setbox\@outputbox\box\@cclv + \xdef\@freelist{\@freelist\@midlist}\global\let\@midlist\@empty + \iffnp@below \@combinefloats \fi + \let\fnp@textbottom\@textbottom + \ifvoid\footins\else + \setbox\@outputbox\vbox{\boxmaxdepth\maxdepth + \unvbox\@outputbox + \iffnp@bottom \@textbottom \fi + \vskip\skip\footins + \csname color@begingroup \endcsname + \csname normalcolor \endcsname + \footnoterule \unvbox\footins + \csname color@endgroup \endcsname}% + \iffnp@bottom \let\@textbottom\relax \fi \fi + \iffnp@below\else \@combinefloats \fi + \ifvbox\@kludgeins \@makespecialcolbox + \else \setbox\@outputbox\vbox to\@colht{\@texttop + \dimen@\dp\@outputbox \unvbox\@outputbox + \vskip-\dimen@ \@textbottom}\fi + \let\@textbottom\fnp@textbottom + \global \maxdepth \@maxdepth} +\ifx\@kludgeins\undefined \let\@kludgeins\voidb@x \fi +% \end{macrocode} +% +% \iffalse +%</fnpos> +% \fi +% +% +% \subsection{\textsf{dblfnote}} +% \label{sec:imp-dblfnote} +% +% \iffalse +%<*dblfnote> +% \fi +% +% \subsubsection{Problems and Solutions} +% \label{sec:imp-dfn-ovv} +% +% \def\DH{{\mit\Delta}H} +% +% \LaTeX's |\footnote| utilizes \TeX's mechanism |\insert| that is perfectly +% fit to the purpose. Roughly speaking, |\footnote|\Meta{text} invokes +% |\insert\footins|\Meta{text$'$} to do the following. +% +% \begin{enumerate} +% \item +% \meta{text$'$} is kept in a special place, properly contributing to +% \TeX's page breaking mechanism with their height and depth. +% +% \item +% When the |\output| routine is invoked with the contents of a page +% including {\em footnoted} text, it is also given \meta{text$'$}, together +% with other |\footnote| texts which should appear in the page, through the +% box |\footins|. The page breaking mechanism will never, well hardly +% ever\footnote{ +% +% See Exercise 15.13 of \TeX{}book for the possibility of placing a footnote +% text in a page other than that its reference appears.}, +% +% miss to couple \meta{text$'$} and its reference in main text. +% +% \item +% The |\output| routine put |\footins| at the bottom of the page. +% \end{enumerate} +% +% This simple mechanism, however, cannot be straightforwardly applied to our +% double-columned footnotes. The major difficulty lies in the fact that +% when |\footnote| is processed we cannot know how \meta{text$'$} +% contributes to the page in which it and its reference appear after it is +% double-columned with other footnote texts. For example, \TeX{}book shows +% a simple estimation method setting |\count\footnote| to 500 so that a half +% (500/1000) of the height plus depth of \meta{text$'$} contributes to the +% page. This method, however, will underestimate the contribution of +% \meta{text$'$} having three lines, which will be broken into two and one +% lines and thus finally has two line height, by assuming the contribution +% is one and a half lines. Thus we have to have a better estimation method. +% +% Another problem is that, even if we estimate the contribution better, we +% cannot directly |\insert| \meta{text$'$} because its {\em natural} height +% plus depth may be different from the estimated contribution. Note that +% changing the magnification factor in |\count\footins| dynamically is not +% good idea because its value is referred by the page breaking mechanism not +% at the time when we do |\insert| but when the paragraph including +% |\footnote| is completed possibly after other |\footnote|-s change the +% factor again. Also note that we cannot give up using |\insert| and adopt +% a method similar to that for floats\footnote{ +% +% As the buggy implementation of earlier version of \textsf{dblfnote}.}, +% +% because a float may be decoupled from its reference and {\em float} to +% another page. Thus we have to |\insert| something other than +% \meta{text$'$} while keeping it in some other place. +% +% To solve these problems, the following algorithm is devised for +% \textsf{dblfnote}. Let $f_1$, \ldots, $f_{i-1}$ be footnote texts which +% have not yet been |\output|, and $f_i$ be that which we now process. Let +% $H_i$ be the height plus depth of double-columned typesetting result of +% $f_1$, \ldots, $f_i$, which can be obtained by tentatively doing that. We +% estimate the contribution of $f_i$ to the page as $\DH_i=H_i-H_{i-1}$, +% which will be exact if $f_1$, \ldots, $f_i$ is put in a page\footnote{ +% +% As discussed later, this condition does not always hold and thus we will +% have an error.}. +% +% Then we |\insert| an empty box whose height is $\DH_i$ through |\footins|, +% while appending $f_i$ to the tail of |\vbox| $F$, which has contained +% $f_1$, \ldots, $f_{i-1}$, so that the |\output| routine and following +% |\footnote|-s refer it. +% +% When the |\output| routine is invoked, we have $f_1$, \ldots, $f_n$ in +% $F$, and \TeX{} moved $m$ ($m\leq n$) |\insert|-ed empty |\vbox|-es into +% the box |\footins|. Thus we have to know $m$ and have to pick $f_1$, +% \ldots, $f_m$ from $F$. Since $m$ is the number of |\vbox|-es in +% |\footins|, we can count them by a well-known technique of iterative +% |\unvbox| and |\lastbox|\footnote{ +% +% Since \cs{footins} contains only a sequence of empty \cs{vbox}-es, i.e. no +% glues, penalties nor other troublesome stuffs, we can count \cs{vbox}-es +% exactly.}. +% +% In order to pick $f_1$, \ldots, $f_m$, we maintain a list +% $L=\{h_1,\ldots,h_n\}$ where $h_i$ is the height plus depth of $f_i$ and +% calculate $s_m=\sum_{i=1}^m h_i$. With this $s_m$, we can |\vsplit| the +% box $F$ to obtain a |\vbox| $F'$ containing $f_1$, \ldots, $f_m$ and to +% leave $f_{m+1}, \ldots, f_n$ in $F$. We also remove $h_1$, \ldots, $h_m$ +% from $L$. Then we |\vsplit| $F'$ into two columns to have what we finally +% put at the bottom of the page. +% +% If $m=n$, that is, if all the |\footnote|-s that have occurred are combined +% with the page, we have no problem to finish the |\output| routine and to +% continue the process. If $m<n$, that is, if there are |\footnote|-s that +% have occurred but are left for the next (or farther) page, however, we have +% a problem. Remember that we estimate the contribution of $f_i$, $\DH_i$, +% assuming that $f_1$, \ldots, $f_i$ are put in a page. Since $f_{m+1}$, +% \ldots, $f_n$ are {\em not} put in the page where $f_1$, \ldots, $f_m$ are +% put, our estimation could have some error. In fact, for example, if all +% $f_i$ has one line and $m$ is odd, $H_m=H_{m+1}$ and thus $\DH_{m+1}$ is +% zero while its real contribution should be the height of one line. In +% general, $\DH_i$ for $m<i\leq n$ were underestimated and thus somehow we +% have to compensate the underestimation that would cause overfull in the +% |\output| process for the next page. +% +% For the compensation, the element of $L$ is not just $h_i$ but the pair +% $(h_i,\DH_i)$ to remember the estimated contribution. After we put $f_1$, +% \ldots, $f_m$, we estimate the contribution of $f_{m+1}$, \ldots, $f_n$ +% again by tentatively building double-columned output to have $H'_{m+1}$, +% \ldots, $H'_n$ where $H'_i$ is the height plus depth of the double-columned +% box of $f_{m+1}$, \ldots, $f_i$. Then we calculate +% +% \begin{equation}\label{eq:eta} +% \eta=\max_{m<i\leq n}(H'_i-\sum_{\llap{$\scriptstyle j=m+1$\hss}}^i\DH_i) +% \end{equation} +% +% and |\insert| an empty |\vbox| of $\eta$ high which is conceptually placed +% at the top of next page. We also add an element $(0,\eta)$ at the head of +% $L$. Remember that this compensation makes $\DH_i$ overestimated and thus +% the next page will be too short if a part of $f_{m+1}$, \ldots, $f_n$ are +% still deferred on the next page building as noted in \S\ref{sec:prob}. +% However, this overestimation is unlikely revealed because we also +% |\insert| an empty |\vbox| whose negative height $\eta'$ is; +% +% \begin{equation}\label{eq:eta'} +% \eta'=H'_n-(\sum_{\llap{$\scriptstyle j=m+1$\hss}}^n\DH_i+\eta) +% \end{equation} +% +% at the tail of the main vertical list which is not yet |\output|, add an +% element $(0,\eta')$ to the tail of $L$, and set $H_n$ to $H'_n$. That is, +% if the next page has a |\par|, the overestimation is reset. +% +% +% +% \subsubsection{Register Declaration} +% \label{sec:imp-dfn-decl} +% +% First of all, we declare the following three switches, together with user +% interface commands to turn them. +% +% \begin{itemize} +% \item +% \begin{macro}{\ifdfn@allowcbreak} +% \begin{macro}{\DFNallowcbreak} +% \begin{macro}{\DFNinhibitcbreak} +% |\ifdfn@allowcbreak| is true (default) if |\DFNallowcbreak| is in effect +% to allow a footnote is broken into two columns. It is false if +% |\DFNinhibitcbreak| is in effect to enclose a footnote by a |\vbox| to +% inhibit the breaking. +% \end{macro}\end{macro}\end{macro} +% +% \item +% \begin{macro}{\ifdfn@trysingle} +% \begin{macro}{\DFNtrysingle} +% \begin{macro}{\DFNalwaysdouble} +% |\ifdnf@trysingle| is true (default) if |\DFNtrysingle| is in effect to +% place footnotes only in the left column if possible. It is false if +% |\DFNalwaysdouble| is in effect not to try single-columning. +% \end{macro}\end{macro}\end{macro} +% +% \item +% \begin{macro}{\ifdfn@ruleboth} +% \begin{macro}{\DFNruleboth} +% \begin{macro}{\DFNruleleft} +% |\ifdfn@ruleboth| is true if |\DFNruleboth| is in effect to draw +% |\footnoterule| over both columns. It is false (default) if +% |\DFNruleleft| is in effect to draw it over the left column only. +% \end{macro}\end{macro}\end{macro} +% \end{itemize} +% +% We also use a working switch |\@tempswa|. +% +% \begin{macrocode} + +%% Register Declaration + +\newif\ifdfn@allowcbreak \dfn@allowcbreaktrue +\def\DFNallowcbreak{\dfn@allowcbreaktrue} +\def\DFNinhibitcbreak{\dfn@allowcbreakfalse} + +\newif\ifdfn@trysingle \dfn@trysingletrue +\def\DFNtrysingle{\dfn@trysingletrue} +\def\DFNalwaysdouble{\dfn@trysinglefalse} + +\newif\ifdfn@ruleboth \dfn@rulebothfalse +\def\DFNruleboth{\dfn@rulebothtrue} +\def\DFNruleleft{\dfn@rulebothfalse} + +% \end{macrocode} +% +% \begin{macro}{\c@DFNsloppiness} +% Then we declare a \LaTeX{} counter |DFNsloppiness| that is the value of +% |\hbadness| of the footnote paragraphs, and set it to the default value +% 5000. +% \end{macro} +% We also use a working |\count| register, |\@tempcnta|. +% +% \begin{macrocode} +\newcounter{DFNsloppiness}\c@DFNsloppiness5000 + +% \end{macrocode} +% +% \begin{dummymacro} +% Next come the declarations of the following six |\dimen| registers. +% +% \begin{itemize} +% \item +% \begin{macro}{\DFNcolumnsep} +% \begin{macro}{\DFNcolumnwidth} +% |\DFNcolumnsep| and |\DFNcolumnwidth| are the counterparts of |\columnsep| +% and |\columnwidth|. Their defaults are both $-|\maxdimen|$ to indicate +% that they are set to the default values in |\document|. +% \end{macro}\end{macro} +% +% \item +% \begin{macro}{\dfn@fnht} +% |\dfn@fnht| is $H_i$ shown in \S\ref{sec:imp-dfn-ovv}. +% \end{macro} +% +% \item +% \begin{macro}{\dfn@fnmaxdp} +% |\dfn@fnmaxdp| has the depth of |\strutbox| in |\footnotesize| and is used +% to set |\boxmaxdepth| and |\splitmaxdepth| for footnote boxes. +% \end{macro} +% +% \item +% \begin{macro}{\dfn@dima} +% \begin{macro}{\dfn@dimb} +% \begin{DFNinhibitcbreak}% +% |\dfn@dima| and |\dfn@dimb| are our own scratch-pads. We also use +% \LaTeX's scratch-pads |\@tempdima| and |\@tempdimb|\footnote{ +% +% \cs{@tempdimc} is not used because it is unavailable in \LaTeX-2.09.}. +% \end{DFNinhibitcbreak}% +% \end{macro}\end{macro} +% \end{itemize} +% \end{dummymacro} +% +% \begin{macrocode} +\newdimen\DFNcolumnsep \DFNcolumnsep-\maxdimen +\newdimen\DFNcolumnwidth \DFNcolumnwidth-\maxdimen +\newdimen\dfn@fnht +\newdimen\dfn@fnmaxdp {\footnotesize \global\dfn@fnmaxdp\dp\strutbox} +\newdimen\dfn@dima \newdimen\dfn@dimb + +% \end{macrocode} +% +% \begin{macro}{\dfn@ins} +% \begin{macro}{\dfn@boxa} +% \begin{macro}{\dfn@boxb} +% Next declarations are for boxes, |\dfn@ins| for $F$ shown in +% \S\ref{sec:imp-dfn-ovv}, and two working registers |\dfn@boxa| and +% |\dfn@boxb|. +% \end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\newbox\dfn@ins +\newbox\dfn@boxa \newbox\dfn@boxb + +% \end{macrocode} +% +% \begin{macro}{\dfn@output} +% Finally, we declare a |\toks| register |\dfn@output| that contains +% original token list for |\output| that is refered in our own version of +% it. +% \end{macro} +% +% \begin{macrocode} +\newtoks\dfn@output \dfn@output\output + +%%^L +% \end{macrocode} +% +% +% +% \subsubsection{Make a Footnote} +% \label{sec:imp-dfn-fntext} +% +% \begin{macro}{\dfn@footnotetext} +% \begin{macro}{\dfn@latex@footnotetext} +% \begin{macro}{\@footnotetext} +% \begin{macro}{\dfn@gobble} +% To implement a part of our algorithm described in \S\ref{sec:imp-dfn-ovv}, +% we have to modify the part of |\footnote|, |\@footnotext|\Meta{text}, in +% which \LaTeX{} does |\insert\footins|\Meta{text$'$}. Our own +% |\@footnotext|, named |\dfn@footnotetext|, first typesets \meta{text$'$} +% in a box |\dfn@boxa| ($f_i$) by calling \LaTeX's \hbox{|\@footnotetext|} +% that is renamed |\dfn@latex@footnotetext|. Before calling it, we make +% |\insert| |\let|-equal to |\dfn@gobble| that simply returns the body to be +% |\insert|-ed, and set |\columnwidth| and |\hbadness| to appropriate values +% to make double-columned paragraphs. +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\@makefnmark} +% \begin{macro}{\dfn@makefnmark} +% \begin{DFNinhibitcbreak}% +% The other operation performed prior to calling |\dfn@latex@footnotetext| +% is redefinition of |\@makefnmark| so that it |\smash|-es the footnote +% mark produced by its original version |\dfn@makefnmark|. This prevents +% the first line of footnote being too tall\footnote{ +% +% The superscripted footnote number is sometimes taller than \cs{strut} of +% \cs{footnotesize}.} +% +% and makes columns well-balanced. +% \end{DFNinhibitcbreak}% +% \end{macro}\end{macro} +% +% \begin{dummymacro} +% Then we calculate $h_i$ (|\dfn@dima|) and append $f_i$ to the tail of $F$ +% (|\dfn@ins|). Since we need that $h_i$ is positive to get $f_i$ from $F$ +% afterward, we enclose $f_i$ with a |\vbox| of 1\,|sp| high if $h_i$ is +% unexpectedly non-positive. The appendix is done by |\unvbox| of $f_i$ if +% |\ifdfn@allowcbreak| is true, while the |\vbox| envelope is kept otherwise +% to inhibit column break in $f_i$. In both cases, $f_i$ is preceded by +% |\allowbreak| and |\nointerlinepenalty| to allow column break and to +% prevent glue for |\baslineskip| inserted. +% \end{dummymacro} +% +% \begin{macro}{\dfn@split} +% Next we evaluate $H_i$ by tentatively building double-columned typesetting +% result from $F$. This is done by the macro; +% +% \begin{quote} +% |\dfn@split|\meta{height}\meta{src}\meta{dst}\meta{maxdepth}\meta{topskip} +% \end{quote} +% +% which |\vsplit|-s the box \meta{src} at \meta{height} to set the first +% half to \meta{dst} while leaving the second half in \meta{src}. The +% parameters for |\vsplit|, |\splitmaxdepth| and |\splittopskip|, are given +% by \meta{maxdepth} and \meta{topskip}. After |\vsplit|, it sets +% conceptual height and depth of double-columned result, $h_D$ +% (|\@tempdima|) and $d_D$ (|\@tempdimb|) as follows. +% +% \begin{eqnarray*} +% h_D&=&\max({\it ht}(\meta{src}),\;{\it ht}(\meta{dst}))\\ +% d_D&=&\max({\it ht}(\meta{src})+{\it dp}(\meta{src}),\; +% {\it ht}(\meta{dst})+{\it dp}(\meta{dst}))-h_D +% \end{eqnarray*} +% +% Thus we have $H_i=h_D+d_D$ (|\dfn@fnht|) and $\DH_i=H_i-H_{i-1}$ +% (|\@tempdima|). +% \end{macro} +% +% \begin{macro}{\dfn@list} +% Finally we |\insert| an empty |\vbox| of $\DH_i$ high, and append +% |\@elt|\meta{$h_i$}\meta{$\DH_i$} at the tail of $L$ (|\dfn@list|). Note +% that $h_i$ and $\DH_i$ are represented with the unit |sp| rather than |pt| +% to avoid conversion error. +% \end{macro} +% +% \begin{macrocode} + +%% Make a Footnote + +\long\def\dfn@footnotetext#1{{\setbox\dfn@boxa\vbox{ + \let\insert\dfn@gobble + \columnwidth\DFNcolumnwidth \hbadness\c@DFNsloppiness + \def\@makefnmark{\smash{\dfn@makefnmark}} + \dfn@latex@footnotetext{#1}\par \boxmaxdepth\dfn@fnmaxdp}% + \dfn@dima\ht\dfn@boxa \advance\dfn@dima\dp\dfn@boxa + \ifdim\dfn@dima>\z@\else + \dfn@dima1sp\relax + \setbox\dfn@boxa\vbox{\vbox to1sp{\unvbox\dfn@boxa\vfil}}\fi + \global\setbox\dfn@ins\vbox{\boxmaxdepth\dfn@fnmaxdp + \ifvoid\dfn@ins\else + \unvbox\dfn@ins \allowbreak \nointerlineskip \fi + \ifdfn@allowcbreak \unvbox \else \box \fi \dfn@boxa}% + \setbox\dfn@boxa\copy\dfn@ins + \dfn@split{.5\ht\dfn@boxa}\dfn@boxa\dfn@boxb\dfn@fnmaxdp\footnotesep + \advance\@tempdima\@tempdimb \@tempdimb\@tempdima + \advance\@tempdima-\dfn@fnht \global\dfn@fnht\@tempdimb + \insert\footins{\floatingpenalty\@MM \vbox to\@tempdima{}}% + \xdef\dfn@list{\dfn@list\@elt{\number\dfn@dima}{\number\@tempdima}}}} +\let\dfn@latex@footnotetext\@footnotetext +\let\@footnotetext\dfn@footnotetext +\long\def\dfn@gobble#1#2{#2} +\let\dfn@makefnmark\@makefnmark +\def\dfn@list{} + +\def\dfn@split#1#2#3#4#5{\@tempdima#1\relax + \vbadness\@M \vfuzz\maxdimen \splitmaxdepth#4\splittopskip#5\relax + \setbox#3\vsplit#2to\@tempdima + \setbox#3\vbox{\boxmaxdepth#4\unvbox#3}% + \@tempdima\ht#3\advance\@tempdima\dp#3\relax + \@tempdimb\ht#2\advance\@tempdimb\dp#2\relax + \ifdim\@tempdimb<\@tempdima \@tempdimb\@tempdima \fi + \@tempdima\ht#3\ifdim\@tempdima<\ht#2\@tempdima\ht#2\fi + \advance\@tempdimb-\@tempdima} + +%%^L +% \end{macrocode} +% +% +% +% \subsubsection{Output Footnotes} +% \label{sec:imp-dfn-makecol} +% +% \begin{macro}{\dfn@makecol} +% The other part of our algorithm described in \S\ref{sec:imp-dfn-ovv} is +% implemented as our own version of |\@makecol|, named |\dfn@makecol|. +% First we check if |\footins| has |\insert|-ed empty boxes for $f_1$, +% \ldots, $f_m$, and do (almost) nothing if none. Then we get $H_m$ +% (|\dfn@dima|) that is the height of |\footins|. +% \end{macro} +% +% \begin{macro}{\dfn@countins} +% Next we count the boxes in |\footins| to get $m$ (|\@tempcnta|) by +% |\dfn@countins|. It repeatedly removes the |\lastbox| of |\footins| +% counting up $m$ until no box is obtained. +% \end{macro} +% +% \begin{macro}{\dfn@elt@getht} +% \begin{macro}{\dfn@endgetht} +% Then we {\em execute} $L$ (|\dfn@list|) making |\@elt| |\let|-equal to +% |\dfn@elt@getht| to calculate $s_m=\sum_{i=1}^m h_i$ (|\@tempdima|). This +% execution also removes $(h_1,\DH_1)$, \ldots, $(h_m,\DH_m)$ from $L$ by +% |\dfn@endgetht|. +% \end{macro}\end{macro} +% +% \begin{dummymacro} +% Note that $s_m$ could be zero if |\footins| only has |\vbox|-es for error +% compensation, i.e.\ $(0,\eta)$ and/or $(0,\eta')$. In this case, we don't +% have any footnotes to be output. This decision is correct because we +% enclosed footnotes having non-positive height by a |\vbox| of 1\,|sp| high +% as described in \S\ref{sec:imp-dfn-fntext}. Thus we can safely pick $f_1$, +% \ldots, $f_m$ from $F$ by |\vsplit|-ting it at $s_m$ by |\dfn@split| +% \footnote{ +% +% Unfortunately, this is not perfectly safe because $f_i$ may have +% stretchable and/or shrinkable glues together with negative penalties which +% could make the break point between $f_m$ and $f_{m+1}$ not least costly. +% Although we could have a perfect solution to cope with this unsafeness, we +% ignore such an unusual case because of the simplicity of implementation.}, +% +% and store them in |\dfn@boxa|. +% \end{dummymacro} +% +% \begin{dummymacro} +% Then if |\dfn@trysingle| is true, we check whether the page has enough +% space to put $f_1$, \ldots, $f_m$ in one column by examining the following +% inequality; +% $$ +% r\geq h_p+h_d+\sigma+s_m +% $$ +% where $r$ is |\@colroom|, $h_p$ and $h_d$ are height and depth of the body +% of the page given through |\box\@cclv|, and $\sigma$ is natural space of +% |\skip\footins|\footnote{ +% +% Thus we ignore the shrinkability of the page body and \cs{skip}\cs{footins}, +% because the former is hardly obtained. Remember \cs{pageshrink} is not the +% total shrinkability at the break point but at somewhere \cs{output} routine +% is invoked.}. +% +% Note that $h_p$ and $h_d$ are {\em not} height and depth of |\box\@cclv|, +% which are |\pagegoal| and depth of the last item (or |\maxdepth|), but +% those of the |\vbox| containing |\unvbox\@cclv|\footnote{ +% +% \TeX{} does not provide any other more convenient way to get them.}. +% +% If the inequality is satisfied, $f_1$, \ldots, $f_m$ are simply put into +% the box |\footins| together with |\footnoterule| preceding them. +% \end{dummymacro} +% +% \begin{dummymacro} +% Otherwise, we split $f_1$, \ldots, $f_m$ at $H_m$ by |\dfn@split| to +% obtain both columns to output. Then each column, preceded by +% |\footnoterule| and follwed by |\vss|, is put into a |\vbox| whose height +% is {\em conceptual} one calculated by |\dfn@split| so that first baselines +% of both column are adjusted. This also adjusts the last baseline of taller +% column with those of footnotes in other pages if |\makeFNbottom| of +% \textsf{fnpos} is in effect. Note that |\footnoterule| of the right +% column will not be put if |\ifdfn@ruleboth| is false, but a vertical space +% to compensate the height and depth of |\footnoterule| is although it is +% usually zero. For the completeness, we don't forget to set |\prevdepth| +% to the depth of |\footnoterule| though it has also no effect. +% \end{dummymacro} +% +% \begin{dummymacro} +% Then two boxes are put into |\hbox|-es of |\DFNcolumnwidth| wide separated +% by a space of |\DFNcolumnsep| surrounded by another |\hbox|. This outmost +% |\hbox| is redundantly enclosed by a |\vbox| to which |\footins| is set, +% because it will be unsealed by |\unvbox| afterward. +% \end{dummymacro} +% +% \begin{macro}{\dfn@elt@adjust} +% Now we finished the job for footnotes to be output to the current page, +% and start to take care of those left in $L$ and defered to the next (or +% farther) page. First, we {\em execute} $L$ (|\dfn@list|) making |\@elt| +% |\let|-equal to |\dfn@elt@adjust| to calculate $\eta$ (|\dfn@dimb|) of the +% equation (\ref{eq:eta}) in \S\ref{sec:imp-dfn-ovv}. It also calculate +% $H'_n$ (|\@tempdima|) and $\sum_{j=m+1}^n H_i$ (|\dfn@fnht|) for $\eta'$ +% of the equation (\ref{eq:eta'}) in \S\ref{sec:imp-dfn-ovv}. +% \end{macro} +% +% \begin{dummymacro} +% Then if $\eta$ is positive, we add $(0,\eta)$ to the head of $L$ and +% |\insert| an empty box of $\eta$ high to compensate the underestimation. +% Since \TeX{} places the vertical list constructed in |\output| routine +% at the page break point, the |\insert|-ion for $\eta$ is followed by those +% for $f_{m+1}$, \ldots, $f_n$. +% \end{dummymacro} +% +% \begin{macro}{\output} +% \begin{macro}{\dfn@afteroutput} +% We also add $(0,\eta')$ to the tail of $L$ and |\insert| an empty box of +% $\eta'$ high to compenstate the overestimation caused by $\eta$, if +% $\eta'$ is negative. This |\insert|-ion, however, should follow +% $f_{m+1}$, \ldots, $f_n$. To do this delayed |\insert|-ion, we modify +% |\output| so that it invoke |\dfn@afteroutput| through |\aftergroup|. +% Since \TeX{} closes the implicit group for |\output| {\em after} it +% reconstructs main vertical list\footnote{ +% +% This fact is not described in \TeX{}book but \texttt{tex.web} does so.}, +% +% |\dfn@afteroutput| will |\insert| the box where we wish to place and +% then nullify itself. +% \end{macro}\end{macro} +% +% \begin{macro}{\dfn@footnoterule} +% Now we finished everything for doulbe-columned footnotes. So, we call +% \LaTeX's \hbox{|\@make|}\allowbreak\hbox{|col|}, |\dfn@latex@makecol|, to +% make a page with |\footins|. Since the macro calls |\footnoterule| before +% |\footins| is put and we have already done it, we temporarily nullify +% |\footnoterule| and reactivate it after the macro with its original +% definition saved in |\dfn@footnoterule|. +% \end{macro} +% +% \begin{macrocode} + +%% Output Footnotes + +\def\dfn@makecol{{\ifvoid\footins\else + \dfn@dima\ht\footins + \@tempcnta\z@ \dfn@countins + \@tempdima\z@ \let\@elt\dfn@elt@getht + \dfn@list\@nil + \ifdim\@tempdima=\z@\else + \dfn@split\@tempdima\dfn@ins\dfn@boxa\z@\z@ + \global\setbox\dfn@ins\box\dfn@ins + \@tempswatrue + \ifdfn@trysingle + \setbox\dfn@boxb\vbox{\unvcopy\@cclv}\@tempdima\@colroom + \advance\@tempdima-\ht\dfn@boxb \advance\@tempdima-\dp\dfn@boxb + \advance\@tempdima-\skip\footins + \advance\@tempdima-\ht\dfn@boxa + \ifdim\@tempdima<\z@\else \@tempswafalse + \global\setbox\footins\vbox{\boxmaxdepth\dfn@fnmaxdp + \footnoterule \unvbox\dfn@boxa}\fi\fi + \if@tempswa + \dfn@split{\dfn@dima}\dfn@boxa\dfn@boxb\dfn@fnmaxdp\footnotesep + \global\setbox\footins\vbox{\hbox{% + \hbox to\DFNcolumnwidth{\vbox to\@tempdima{\footnoterule + \unvbox\dfn@boxb\vss}\hss}\hskip\DFNcolumnsep + \hbox to\DFNcolumnwidth{\ifvoid\dfn@boxa\else + \vbox to\@tempdima{ + \setbox\@tempboxa\vbox{\footnoterule} + \ifdfn@ruleboth \unvbox\@tempboxa + \else \@tempdima\ht\@tempboxa + \advance\@tempdima\dp\@tempboxa + \vskip\@tempdima + \prevdepth\dp\@tempboxa \fi + \unvbox\dfn@boxa\vss}\fi\hss}}}\fi\fi + \global\dfn@fnht\z@ + \ifx\dfn@list\@empty\else + \let\@elt\dfn@elt@adjust \dfn@dima\z@ \dfn@dimb\z@ + \dfn@list \global\advance\dfn@fnht\dfn@dimb + \let\@elt\relax + \ifdim\dfn@dimb>\z@ + \xdef\dfn@list{\@elt{0}{\number\dfn@dimb}\dfn@list}% + \insert\footins{\floatingpenalty\@MM + \vbox to\dfn@dimb{}}\fi + \ifdim\dfn@fnht>\@tempdima + \@tempdimb\@tempdima \advance\@tempdimb-\dfn@fnht + \global\dfn@fnht\@tempdima + \xdef\dfn@list{\dfn@list\@elt{0}{\number\@tempdimb}}% + \xdef\dfn@afteroutput{\insert\footins{ + \floatingpenalty\@MM + \vbox to\number\@tempdimb sp{}}% + \global\let\noexpand\dfn@afteroutput\relax}% + \fi\fi + \fi}% + \let\footnoterule\relax \dfn@latex@makecol + \let\footnoterule\dfn@footnoterule} +\let\dfn@footnoterule\footnoterule + +\def\dfn@countins{\setbox\footins\vbox{\unvbox\footins + \global\setbox\dfn@boxa\lastbox}% + \ifvoid\dfn@boxa \let\next\relax + \else \advance\@tempcnta\@ne \let\next\dfn@countins \fi \next} + +\def\dfn@elt@getht#1#2{\advance\@tempdima#1sp\relax \advance\@tempcnta\m@ne + \ifnum\@tempcnta>\z@ \let\next\relax + \else\let\next\dfn@endgetht \fi \next} +\def\dfn@endgetht#1\@nil{\gdef\dfn@list{#1}} + +\def\dfn@elt@adjust#1#2{\advance\dfn@dima#1sp\advance\dfn@fnht#2sp\relax + \ifvoid\dfn@ins \@tempdima\z@ \@tempdimb\z@ + \else \setbox\dfn@boxa\copy\dfn@ins + \dfn@split\dfn@dima\dfn@boxa\dfn@boxb\z@\z@ + \dfn@split{.5\ht\dfn@boxb}\dfn@boxb\dfn@boxa + \dfn@fnmaxdp\footnotesep + \advance\@tempdimb\@tempdima \@tempdima\@tempdimb \fi + \advance\@tempdimb-\dfn@fnht\relax + \ifdim\@tempdimb>\dfn@dimb \dfn@dimb\@tempdimb \fi} + +\let\dfn@afteroutput\relax +\output{\the\dfn@output \aftergroup\dfn@afteroutput} + +%%^L +% \end{macrocode} +% +% +% +% \subsubsection{Initialization, etc.} +% \label{sec:imp-dfn-init} +% +% \begin{macro}{\dfn@document} +% \begin{macro}{\document} +% Since the default value of |\DFNcolumnsep| is that of |\columnsep| that +% may be set in other styles and/or preamble, we have to modify |\document| +% to set |\DFNcolumnsep| to the value of |\columnsep| if it is negative +% after the invocation of the original version of |\document|, +% |\dfn@document|. We also set |\DFNcolumnwidth| to its default value +% calculated from |\DFNcolumnsep| and |\textwidth| if it is negative. +% \end{macro}\end{macro} +% +% \begin{macro}{\dfn@latex@makecol} +% \begin{macro}{\@makecol} +% Another reason why we modify |\document| is the modification of +% |\@makecol|. In order to allow our footnote styles (and others hopefully) +% to be loaded in any order, we capture possibly-modified definition of +% |\@makecol| in |\document| to save it in |\dfn@latex@makecol| as the +% original version, and make |\@makecol| |\let|-equal to our own version +% |\dfn@makecol|. +% \end{macro}\end{macro} +% +% \begin{macrocode} + +%% Initialization, etc. + +\let\dfn@document\document +\def\document{\dfn@document + \ifdim\DFNcolumnsep<\z@ \DFNcolumnsep\columnsep \fi + \ifdim\DFNcolumnwidth<\z@ + \DFNcolumnwidth\textwidth + \advance\DFNcolumnwidth-\DFNcolumnsep + \divide\DFNcolumnwidth\tw@ \fi + \dfn@fnht\z@ + \let\dfn@latex@makecol\@makecol + \let\@makecol\dfn@makecol} + +% \end{macrocode} +% +% \begin{macro}{\dfn@twocolumn} +% \begin{macro}{\twocolumn} +% \begin{macro}{\dfn@onecolumn} +% \begin{macro}{\onecolumn} +% We also switch |\@makecol| to original\slash own version in modified +% |\twocolumn|\slash |\onecolumn| because double-columned footnotes are +% available only in single column documents. In those macros, prior to +% the invocation of their original versions, |\dfn@twocolumn| and +% |\dfn@onecolumn|, |\@footnotetext| is also set to corresponding macros that +% are original |\dfn@latex@footnotetext| or our own |\dfn@footnotetext|. +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\let\dfn@twocolumn\twocolumn +\def\twocolumn{\clearpage + \let\@footnotetext\dfn@latex@footnotetext + \let\@makecol\dfn@latex@makecol + \dfn@twocolumn} +\let\dfn@onecolumn\onecolumn +\def\onecolumn{\clearpage + \let\@footnotetext\dfn@footnotetext + \let\@makecol\dfn@makecol + \dfn@onecolumn} +% \end{macrocode} +% +% \iffalse +%</dblfnote> +% \fi +% +% +% +% \IndexPrologue{\newpage\section*{Index} +% Italicized number refers to the page where the specification and usage of +% corresponding entry is described, while underlined is for the +% implementation of the entry.} +% \Finale +% \GlossaryPrologue{\newpage\section*{Revision History}} +% \PrintChanges +\endinput diff --git a/Master/texmf-dist/source/latex/yafoot/yafoot.ins b/Master/texmf-dist/source/latex/yafoot/yafoot.ins new file mode 100644 index 00000000000..89d5f07b6d9 --- /dev/null +++ b/Master/texmf-dist/source/latex/yafoot/yafoot.ins @@ -0,0 +1,8 @@ +\input docstrip.tex +\keepsilent +\askonceonly +\generate{\file{pfnote.sty}{\from{yafoot.dtx}{pfnote}} + \file{fnpos.sty}{\from{yafoot.dtx}{fnpos}} + \file{dblfnote.sty}{\from{yafoot.dtx}{dblfnote}} + \file{yafoot-man.tex}{\from{yafoot.dtx}{driver}}} +\endbatchfile |