[Tex/LaTex] Allow footnote to appear on next page

footnotespage-breaking

This is sort of the opposite of this question. I have a document which is challenging to typeset because it has a lot of long footnotes. One particular page has a lot of ugly vertical space because it can't move subsequent paragraphs forward due to their footnotes.

Is there a way to relax the rules on footnotes to allow them to be either (a) split more aggressively or (b) to be pushed down one page altogether to try to make things typeset better? Bonus points if there's a way to apply these changes locally since I only really want to do this when absolutely necessary.

Best Answer

You have the following levers:

  • Declare the footnote mark (which prints the number 1, 2, ... in superscript position) separate from the footnote text (what goes at the bottom of page body) using \footnotemark and footnotetext.

  • Set \floatingpenalty=〈number〉 inside a footnote text in order to tune how bad TeX considers the fact of accepting text containing \footnote calls on the current page even though there is already a split footnote on it (i.e., accepting text on the current page containing footnotes that will have to be printed on subsequent pages). The default is \floatingpenalty=10000 (see definition of \@footnotetext in ltfoat.dtx or source2e.pdf). Use some number < 10000, as in \floatingpenalty=0\relax (you can use a space token instead of \relax) to make it more acceptable to have footnotes that don't start on the page containing the footnote mark. See below for an easy way to do this change.

  • Insert \penalty〈number〉 in vertical mode inside footnote text (for instance after \par) to suggest or even force TeX (on a case by case basis, when preparing the final version of your document) to split a footnote at a particular point. Finish the 〈number〉 with either \relax or a space token—same as above. Values less than or equal to -10000 force a break (i.e., a footnote split). See the TeXbook p. 124, second paragraph.

  • Lower \interfootnotelinepenalty (100 by default) to make TeX more willing to break lines in the middle of paragraphs contained in footnotes. The default value being rather low already, I wouldn't bother with this parameter unless all other possibilities have been exhausted.

Note: changing \floatingpenalty from inside a footnote text should affect only that footnote (the change is local to the insert1). Attempting to change it from outside footnotes in order to encompass several footnotes wouldn't work, and moreover could affect other floats coming along; however, as I'll show below, with etoolbox, you can locally patch \@footnotetext to use the \floatingpenalty of your choice inside a given TeX group.

Declaring \footnotemark and footnotetext separately

Compare this:

\documentclass{article}
\usepackage{lipsum}

\begin{document}
\lipsum[1-2]%
abcd\footnote{\lipsum[1-4]\lipsum[4][1-4]}~and%
\footnote{Footnote text declared along with its mark.}
\lipsum[3][2]%
\lipsum[3][2-4]
\end{document}

with this:

\documentclass{article}
\usepackage{lipsum}

\begin{document}
\lipsum[1-2]%
abcd\footnote{\lipsum[1-4]\lipsum[4][1-4]}~and%
\footnotemark
\lipsum[3][2]%
\footnotetext{Footnote text forcibly separate from its mark.}
\lipsum[3][2-4]
\end{document}

The first gives:

Page 1

Page 1


Page 2

Page 2

whereas the second produces:

Page 1

Page 1


Page 2

Page 2

Patching @footnotetext to locally change \floatingpenalty

Example

Consider the following example:

\documentclass{article}
\usepackage{etoolbox}
\usepackage{lipsum}

\makeatletter
% Argument: custom value to use locally for \floatingpenalty inside footnotes
\newcommand*{\mySpecialfootnotes}[1]{%
  \patchcmd{\@footnotetext}{\floatingpenalty\@MM}{\floatingpenalty#1\relax}%
           {}{\errmessage{Couldn't patch \string\@footnotetext}}%
}
\makeatother

\begin{document}
\lipsum[1-2]%
abcd\footnote{\lipsum[1-4]\lipsum[4][1-4]}~and%
{%
  \mySpecialfootnotes{0}%
  \footnote{Footnote we can delay to the next page.}%
}%
\lipsum[3-5]
\end{document}

With the normal \@footnotetext definition, TeX would refuse to split the first footnote, because that would cause the second footnote to start on page 2 whereas the footnote mark would be on page 1 (same line as the mark for the first footnote). This is what you get if you comment out the \mySpecialfootnotes{0} call.2 But if you do execute the \mySpecialfootnotes{0} as shown above, then for every footnote starting inside this group:

{%
  \mySpecialfootnotes{0}%
  \footnote{Footnote we can delay to the next page.}%
}%

(in this case, this means “for the second footnote”), starting a footnote text on a page later than where the footnote mark appears is considered okay (penalty 0 passed as argument to \mySpecialfootnotes—0 is neutral: neither considered good, nor considered bad). This allows the first footnote to be split and causes the second footnote to appear on page 2, separate from its mark which is on page 1.

Screenshots of the example

  • First, what you get without the call to \mySpecialfootnotes (i.e., \@footnotetext unmodified and \floatingpenalty as in standard LaTeX):

Page 1

Page 1 without patching @footnotetext


Page 2

Page 2 without patching @footnotetext

(there is a third page in this case; I don't include a screenshot for it, as it is not particularly interesting for this discussion)

  • Now, with the call to \mySpecialfootnotes (i.e., \@footnotetext patched in the scope that encompasses the second call to \footnote):

Page 1

Page 1 with @footnotetext patched


Page 2

Page 2 with @footnotetext patched

(there is no third page in this example)

Footnotes

  1. See definition of \@footnotetext in ltfoat.dtx or source2e.pdf, and the TeXbook p. 280­–281 on \insert (\@makefntext can have various definitions depending on the context, see article.cls for instance).

  2. And this causes the first page to have a horrible “Underfull \vbox (badness 10000) has occurred while \output is active” if you try it with \flushbottom in effect, for instance with the default parameters of the book class.