joffdd
April 25, 2025, 3:32pm
1
I wondered how I can add a pagebreak before a section, sub-section, or sub-sub-section heading only in case the previous page has less than x% of the horizontal space available yet? E.g. don’t begin a new (sub)section below the middle of a page but rather move it to the next one.
1 Like
bluss
April 25, 2025, 3:51pm
2
I think this thread and this answer is an implementation of that. It supports both relative and absolute measures for space.
2 Likes
ensko
Closed
April 26, 2025, 8:22pm
3
Duplicate of
Hi !
New user of Typst, so far it’s sooo good. I really wish it was a thing when I was going through uni ahah.
I’m trying to add a pagebreak before every heading(level: 1), but only if they are below half the page.
Adding a pagebreak is easy with :
show heading.where(level: 1, outlined: true): it => {
pagebreak()
it
}
But when trying to add a little logic, I keep getting redundancy errors.
show heading.where(level: 1, outlined: true): it => {
if it.location().position().y > page.height…
Thanks for pointing it out @bluss ! @joffdd , feel free to flag my reply/message me if you think this is an error.