[Tex/LaTex] Does \\* within footnotes have any effect

footnotesline-breakingpage-breaking

One is taught that \\* is an alternative to the line-breaking \\ that tries (often unsuccessfully) to inhibit a page break. Normally \\* would be used in ordinary ("body") text.

(And I hereby acknowledge user egreg's admonition that "\\* should not be used".)

What about footnotes? Does the use of \\* instead of \\ have any effect within footnotes? (And what about \nopagebreak?)

The justification for asking whether \\* works in footnotes like it does in body text is that under a naive but sensible understanding of LaTeX, someone might think that "one page has exactly one pagebreak, so that's probably the pagebreak in the body text and not anything within some footnote".

In the following code

\documentclass{article}
\usepackage{lipsum}


\begin{document}

\lipsum[1-4]\footnote{
  no asterisk \\ asterisk \\*
  no asterisk \\ asterisk \\*
  no asterisk \\ asterisk \\*
  no asterisk \\ asterisk \\*
  no asterisk \\ asterisk \\*
  % the pagebreak happens here
  last line}
\lipsum[5]

\end{document}

the use of \\* seems to have no effect (it's the same as if I had used \\ in all five places; note that keeping only the fifth \\* doesn't prevent that particular page break either)

pagebreak within footnote

but who knows why. (I am showing the bottom left of the first page of the 2 output pages.)

Best Answer

The problem is not related to footnotes. This is explained in the beginning of my answer to a derived question. What follows is a shortened version of that answer; it's a fix that works in body text as well as footnotes:

The problem is the automatically inserted \interlinepenalty. It is usually smaller than 10000 and allows a page break even if it is preceded by a \nobreak (= \penalty10000).

The following uses a workaround. Instead of ending the line, the paragraph is ended. Then the effects of \parskip and \parindent need to be reversed and avoided:

\documentclass{article}
\usepackage{lipsum}

\newcommand*{\NLS}{%
  \par
  \nobreak
  \vspace{-\parskip}%
  \noindent
  \ignorespaces
}

\begin{document}

\lipsum[1-4]\footnote{
  no asterisk \\ asterisk \NLS
  no asterisk \\ asterisk \NLS
  no asterisk \\ asterisk \NLS
  no asterisk \\ asterisk \NLS
  no asterisk \\ asterisk \NLS
  last line}
\lipsum[5]  

\end{document}

page1 page2

Related Question