How do I avoid splitting footnote on multiple pages?

In principle, block(breakable: false)[content] prevents any content from being split, so the following would work…

#footnote(block(breakable: false, text(red)[#lorem(800)]))

However, it would end up separating your text from the footnote number, as a block triggers a paragraph break. In the case of really long text, they can end up in separate pages. Using a box instead (which is unbreakable and stays in the same paragraph) helps:

#footnote(box(text(red)[#lorem(800)]))

But there will still be a linebreak between the footnote number and its body. If that would be undesirable, the best solution then is

// At the TOP of your document:
#show footnote.entry: block.with(breakable: false)

#footnote(text(red)[#lorem(800)])

which doesn’t affect the text in the entry and instead ensures the entry as a whole is unbreakable.


Note that the solution above will force all entries to be unbreakable. Here’s one way to only pick a few of them.

#show footnote.entry: it => if it.note.at("label", default: none) == <unbreakable> { block(breakable: false, it) } else { it }

= A
#lorem(200)
#footnote(text(red)[#lorem(800)])<unbreakable>
#lorem(200)
= B
#lorem(200)
// This one will be breakable
#footnote(text(blue)[#lorem(800)])
#lorem(200)
Results

5 Likes