How to prevent across page breaks with numbered lists

Rationale:

I have reworked my CV to use Typst. Love how it looks and works. I have throughout my CV different headers. I also have sections that list various manuscripts/abstracts. There are times when a header is on one page and the text underneath the header is on the subsequent page. One thing I have found to keep the headers with the subsequent text is to wrap the header and the text of the next thing in a block(breakable: false) option. That works great to keep the headers with the text without having to add different page breaks to keep the file looking nice.

Issue

One issue that I have is that with the numbered list of manuscripts/abstracts, if I wrap the header and the first numbered manuscript in the same block(breakable: false) option, the numbering on the list restarts.

Ask/Question

Is there a better way to deal with these such across page breaks? I searched Google and thats how I found the block(breakable: false), but that doesn’t seem to be the best solution for numbered lists.

Reproducible Example

I’ve included some example code to illustrate my question. You can adjust some of the length of the lorem statements and remove some of the block(breakable: false) options to observe the issues a little more. Place this example in a new Typst.app document with Typst 0.14.2.

= Introduction

#lorem(600)

= Example 1: 

#set enum(reversed: true)

(Intent: Would be to keep headers with the bulleted lists that follow.)

+ Citation 1
+ Citation 2
+ Citation 3


#lorem(575)

#block(breakable: false)[
== Partial Solution for Example 1

#set enum(reversed: true)

(Fix: Can keep header with citation list. Issue: the numbering restarts based on this new block.)

+ Citation 1
]
+ Citation 2
+ Citation 3

#lorem(510)

== Example 2

#set enum(reversed: true)

(Intent: Would like to keep bulleted/numbered points from breaking across pages.)

+ #lorem(50)

+ Citation 2
+ Citation 3

#lorem(510)

== Solution for Example 2

#set enum(reversed: true)

(Fix: Can keep each point from individually breaking across pages. Issue: Cannot combine the fix to keep the header with the list with each point without it restarting numbering.)

+ #block(breakable: false)[#lorem(50)]
+ Citation 2
+ Citation 3

#lorem(465)

#block(breakable: false)[
== Issue Combining Solution for Example 1 with Solution for Example 2

#set enum(reversed: true)
(Random text here)

+ #block(breakable: false)[#lorem(70)]]
+ #lorem(50)
+ Citation 3

Not sure how to solve this off the top of my head, but as noone else has answered yet, thought I’d chime in. The itemize package
seems to be talked about a bunch whenever people ask for fancy itemizing logic. Maybe check that out? Otherwise, some manual stuff with the list counters might fix it.

As an aside, your code might look prettier when you use sticky blocks on just your header instead of an unbreakable block on the header and also first item: Block Function – Typst Documentation (headers already have this so I assume youre coding custom headers. Note that doing so may result in untagged pdfs, a la Accessibility – Typst Documentation) Also also, super appreciate the detailed explanation! You’ll be very easy to help for someone who knows more.

1 Like