[tex-eplain] footnotes

Adam Fenn acwfenn at ntlworld.com
Sun May 23 15:56:42 CEST 2010


> Edmac is certainly good at double-column footnotes, and works in plain 
> TeX. I think there is a package multifoot, but as far as I recall 
> specifically for LaTeX.
>
> The TeXBook itself gives some advice (and sample code) on columnar 
> footnotes at pp. 395-6.

I discovered fnpara.tex, on a field trip through CTAN, which puts 
footnotes into a paragraph at the foot of the page and is by one of the 
Edmac authors. Unfortunately the file has been corrupted so that  left 
braces appear as commas and  right braces as hyphens.  I include a 
cleaned up version here (although I might have missed something).

Although this works well it causes my poetry environment (see below) to 
fail if the poem crosses from one page to another (complains about a 
misplaced \cr) even though it appears to work if I force it in 
nonstopmode. Can I modify one or the other so that they live in harmony 
together?

Thanks,
Adam.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FNPARA.TEX  based on D. E. Knuth's "Dirty Tricks" macros from pages
% 398--400 of The TeXbook.
% Dominik Wujastyk September 15, 1988.
%
% Set the footnote text font here:
%
\font\footnotesize=cmr8
%
% Set the font for the footnote numbers at the bottom of the page here
%
\font\footnumberfont=cmbx8
%
% Set any text to follow each footnote here:
%
\def\endnotetext{$\parallel$\hskip.5em}
%
% Switch off above endnote text, for comparison:
%
\let\endnotetext=\relax
%
% Normal @}character macro lock:
%
\catcode`\@=11
%
% Initialize counters:
%
\newcount\footno
\footno=0
%
% Clever code for \getfactor (The TeXbook{ p.375):
%
{\catcode`p=12 \catcode`t=12 \gdef\\#1pt{#1}}
\let\getfactor=\\
%
% Set space to follow footnote text:
%
\newskip\footglue \footglue=1em plus.3em minus.3em
%
% Set leading of footnotes:
%
\newdimen\footnotebaselineskip \footnotebaselineskip=10pt
%
% Calculate \fudgefactor (ratio of \baselineskip to \hsize):
%
\dimen0=\footnotebaselineskip \multiply\dimen0 by 1024
\divide \dimen0 by \hsize \multiply\dimen0 by 64
\xdef\fudgefactor{\expandafter\getfactor\the\dimen0 }
%
% Redefine footnotes to be automatically numbered:
%
\def\footnote{\global\advance\footno by 1
   \let\@sf=\empty%
   \ifhmode\edef\@sf{\spacefactor=\the\spacefactor}\/\fi%
%$N{\the\footno}$\@sf\vfootnote}
$^{\the\footno}$\@sf\vfootnote}
\def\vfootnote#1{\insert\footins{\floatingpenalty=20000
   \footnotesize \setbox0=\hbox{%
     {\footnumberfont \the\footno\penalty10000\hskip.5em}#1%
\penalty-10\hskip\footglue\endnotetext}
% The \hbox should end before the following assignments
   \dp0=0pt \ht0=\fudgefactor\wd0 \box0}}
%
% Assume \plainoutput routine, but change \pagecontents:
%
\def\pagecontents{\ifvoid\topins\else\unvbox\topins\fi
   \dimen@=\dp\@cclv \unvbox\@cclv % open up \box255
   \ifvoid\footins\else % footnote info is present
     \vskip\skip\footins
     \footnoterule
     \global\setbox1=\vbox{\makefootnoteparagraph}\unvbox1\fi
   \ifr at ggedbottom \kern-\dimen@ \vfil \fi}
\def\footnoterule{\kern-3\p@
   \hrule width 2truein \kern 2.6\p@} % the \hrule is .4pt high
%
% Box manipulation code from The TeXbook, p.399:
%
\def\makefootnoteparagraph{\unvbox\footins \makehboxofhboxes
   \setbox0=\hbox{\unhbox0 \removehboxes}
   \baselineskip=\footnotebaselineskip\noindent\unhbox0\par }
\def\makehboxofhboxes{\setbox0=\hbox{}
   \loop\setbox2=\lastbox
   \ifhbox2 \setbox0=\hbox{\box2\unhbox0}\repeat}
\def\removehboxes{\setbox0=\lastbox
   \ifhbox0{\removehboxes}\unhbox0 \fi}
%
% Reimpose @}lock.
%
\catcode`\@=12
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



One\footnote{First footnote.}
two\footnote{Second footnote. (Every once in a~while a long
footnote might occur, just to make things difficult.)}
three.\footnote{Third footnote.}
four\footnote{Fourth footnote.}
five\footnote{Fifth footnote. (This is incredibly boring, but it's just 
an example.)}
six\footnote{Another.}
seven\footnote{And another.}
eight\footnote{Ho hum.}
nine\footnote{Umpteenth footnote.}
ten.\footnote{Oodles of them.}


\def\poem{\environment{@poem}%
\begingroup\bigskip
\let\par=\cr \obeylines
\tabskip=0pt   plus 1fil
\halign to\hsize\bgroup%
##\hfil}

\def\endpoem{%
\egroup
\endgroup\bigskip\endenvironment{@poem}%
}

\poem
I wandered lonely as a cloud
That floats on high o'er vales and hills,
When all at once I saw a crowd,
A host, of golden daffodils;
Beside the lake, beneath the trees,
Fluttering and dancing in the breeze.

Continuous as the stars that shine
And twinkle on the milky way,
They stretched in never-ending line
Along the margin of a bay:
Ten thousand saw I at a glance,
Tossing their heads in sprightly dance.
\endpoem


\bye



More information about the tex-eplain mailing list