Why there might be a new page after the final `colbreak`?

According to Column Break Function – Typst Documentation, colbreak should behave like pagebreak:

The function (colbreak) will behave like a page break when used in a single column layout or the last column on a page.

If weak is true, the column break is skipped if the current column is already empty.

However, I found a few cases that sometimes there’s a new page after the final colbreak, and sometimes there isn’t.

Could anyone explain what’s happening here? Is it a bug?
Thanks in advance.

Case A: Does consecutive colbreaks collapse?

If the document ends with a single colbreak (no matter weak or strong), then there’s no new page after it.

// Case A.1
page
#colbreak(weak: false) // or true

But if the document ends with multiple colbreaks (no matter weak or strong or mixed, and no matter how many), then there’s a single new page after them.

// Case A.2
page
#colbreak(weak: true) // or false
#colbreak(weak: true) // or false
#colbreak(weak: true) // or false



Case B: What’s happening at the end of a show rule?

The variable foo defined below ends with a colbreak.
If it’s put directly in the document, then there’s no new page after it.

// Case B.1
#let foo = range(3).map(_ => [page] + colbreak()).join()

#foo

But if it’s put in a show rule, then there’s a new page after it.

// Case B.2
#let foo = range(3).map(_ => [page] + colbreak()).join()

#{
  show strong: foo
  strong[whatever]
}

1 Like