I am using family recipes to teach myself Typst. With help from many of you, it is going well, but I’ve just hit another problem that I don’t know how to solve. I have created a test version of part of it, where the problem occurs, which can be accessed, I hope at Typst.
The problem is that the anchor of the footnote at the bottom of page 2 occurs in the first paragraph on page 3.
In the code of that project there are two versions of Heading 2. As it stands, the version which is active is the one I have created following exchanges in other threads to avoid the problem of having a Heading 2 as a widow at the bottom of a page — what in a word processor I would solve with “Keep with Next”. As I couldn’t find any “Keep with Next” coding examples, I used the “conditional upon available space” option.
#show heading.where(level: 2): it => {
set text(18pt, weight: "semibold")
let threshold = 6em
block(breakable: false, height: threshold)
v(-threshold, weak: true)
it
}
// #show heading.where(level: 2): set text(18pt, weight: "semibold")
While that code solves the heading problem, the result is that in the redrawing of the pages, the footnote remains on page 2 but the text with the anchor is moved to page three.
If you comment out the conditional code and re-instate the simple text size and weight assignment code, the footnote and its anchor are both on page two, but there is an ugly end of page 1 and widowed Heading 2s elsewhere in the full project.
Any help with solving this will be most welcome — and do feel free to try any of the recipes!
![]()
Mark

