I’m trying to get footnotes set in two columns in Plain TeX. This is my minimum working example:
%!TEX TS-program = pdftex
\output{\ifvoid\footins\else\vskip\skip\footins\rigidbalance\footins 2 7pt
\fi\plainoutput}
\newcount\k \newdimen\h % registers used by the \rigidbalance routine
\def\rigidbalance#1#2 #3 {\setbox0=\box#1 \k=#2 \h=#3
\line{\splittopskip=\h \vbadness=10000 \hfilneg
\valign{##\vfil\cr\dosplits}}}
\def\dosplits{\ifnum\k>0 \noalign{\hfil}\splitoff
\global\advance\k-1\cr\dosplits\fi}
\def\splitoff{\dimen0=\ht0
\divide\dimen0 by\k \advance\dimen0 by\h
\vsplit0 to \dimen0 }
\catcode`\@=11
\def\vfootnote#1{\insert\footins\bgroup
\interlinepenalty\interfootnotelinepenalty
\splittopskip\ht\strutbox % top baseline for broken footnotes
\splitmaxdepth\dp\strutbox \floatingpenalty\@MM
\leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip
\count\footins 500
\multiply\dimen\footins by 2
\hsize .45\hsize
\parindent=0pt
\tolerance=5000
\raggedright
\textindent{#1}\footstrut\futurelet\next\fo@t}
\catcode`\@=12
\noindent
The entire set of footnotes could be set in two (or more) columns, with
a ragged right margin. For example, the ten footnotes
we have been considering might appear as follows:\footnote{$^1$}{First footnote.}
And some more.\footnote{$^2$}{Second footnote. (Every once in a while a long
footnote might occur, just to make things difficult.)}
And some more.
And some more.\footnote{$^3$}{Third footnote.}$N,$\footnote{$^4$}{Fourth footnote.}
And some more.
And some more.\footnote{$^5$}{Fifth footnote. (This is incredibly boring, but it's just an
example.)}$N,$\footnote{$^6$}{Another.}
And some more.
And some more.
And some more.\footnote{$^7$}{And another.}$N,$\footnote{$^8$}{Ho
hum.}$N,$\footnote{$^9$}{Umpteenth
footnote.}$N,$\footnote{$^{10}$}{Oodles of them.}
\bye
Most of this stuff comes from pages 395–398 of the TeXbook, some of it is from the EDMAC Critical Edition macros. \rigidbalance is the macro that divides the footnote material into two (or more) columns. I modified the Plain \vfootnote macro to format the footnotes into two columns.
Everything works fine, except that instead of appearing at the bottom of the current page, the footnotes appear at the top of the next page.
I think that the problem is something to do with \output. I’m not very good with \output. Any help would be appreciated.