# Force footnotes to bottom of page in plain TeX

I have a large (~3000 pages) document typeset using plain TeX plus some local macros. The document uses the plain TeX \footnote macro for footnotes. The document also uses \raggedbottom. This means that footnotes on shorter pages are attached to the bottom of the text block. Ideally I'd like the footnotes on such pages to be flush with the bottom of the page.

While Looking for solutions I found that the LaTeX command \usepackage[bottom]{footmisc} would do exactly what I need, were I using LaTeX. Can anyone suggest how I could get this function by modifying the plain TeX macros?

I'm fairly comfortable with modifying TeX's output routine, but \vfootnote and fontmisc have defeated me.

Just to fix ideas, here's an MWE which currently fails to place the footnotes at the bottom of the text block.

\raggedbottom

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna
aliqua.\footnote{*}{This footnote should be at bottom of the
text block.} Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur.\footnote{**}{A
second footnote.} Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id
est laborum.

\eject % important: not "\vfill\eject"
\end

• Do you have to use \raggedbottom ? Wouldn't \flushbottom solve the issue? – Ingmar Dec 4 '20 at 10:20
• Never mind, see my answer below. – Ingmar Dec 4 '20 at 10:27
• Which compiler do you use -- pdfTeX, XeTeX, LuaTeX, or "Knuth TEX"? Have you considered simply copying and pasting the relevant portion of the footmisc package into your document? – Mico Dec 4 '20 at 10:56
• I've taken the liberty of adding an MWE. Feel free to revert. – Mico Dec 4 '20 at 14:41

You'll probably want to redefine \footnoterule and add some vertical fill at that location on the page content. Try this:

\raggedbottom
\kern-3pt\hrule width 2truein \kern 2.6pt} % the \hrule is .4pt high

Lorem ipsum\footnote *{This footnote should be at the bottom of
the textblock} dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
onsequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur.

Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.

\par\break
\bye

• Since the OP uses PlainTeX rather than LaTeX, can you recast your answer to fit inside the PlainTeX framework? – Mico Dec 4 '20 at 10:55
• Not off the top off my head, no. Can you? Happy to delete my answer in favor of a better one. – Ingmar Dec 4 '20 at 10:58
• I'm afraid I don't know either. All I know is that Knuth wrote, on p. 363 of the TeXbook, "The \footnote macro has a few subtle features that can best be appreciated by someone who reads Chapter 15 very carefully. It also uses some \bgroup and \futurelet and \aftergroup trickery, so that the footnote text does not need to be a parameter to \vfootnote." Ouch. – Mico Dec 4 '20 at 11:13
• \footnoterule is (almost) unchanged from plainTeX, so Ingmar's answer should work. You can check with texdef -t <format> footnoterule on the command line, where <format> is one of "tex", "latex", or "context". The tool is included with most TeX distributions. The definition in the TeXbook is in Appendix B on page 364. – Ben Jones Dec 4 '20 at 19:35
• OK if I edit it to use plain TeX compatible code? – Donald Arseneau Dec 4 '20 at 21:23

The key bit of code in plain.tex is this:

\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
\unvbox\footins\fi
\ifr@ggedbottom \kern-\dimen@ \vfil \fi}


You want to override that \vfil so the easiest way to do this is to change the value of \skip\footins which is initially set to \bigskipamount (12pt plus 4pt minus 4pt) changing this to have plus 1fill would do the job so just add the following to your document:

\skip\footins=12pt plus 1fill minus 4pt


and you should get the expected output.

(and as an aside, creating a 3000 page document in plain TeX in 2020? Interesting choice).

(also, I don't have a working TeX system at the moment so this is all untested).

• Tested and working – egreg Dec 4 '20 at 23:20
• No don't do this! Put the fill in \pagecontents (or \footnoterule) instead. A fill in \skip\footins is used by the page builder to choose ridiculously bad page breaks at any negative penalty! – Donald Arseneau Dec 5 '20 at 1:00