Why are page breaks not allowed within containers? #1092
-
Stumbling across #934, I wonder, why are page breaks not allowed within containers? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I believe page break is an element by itself (when considering internal code), so, from my current understanding (which might not be fully accurate), it has to be a direct child of the outer page element to be recognized as such. |
Beta Was this translation helpful? Give feedback.
-
For some containers it simply doesn't make sense to have a break in them (e.g. a box in a paragraph). For others, e.g. columns, it could make sense and is more of a current limitation that it's not possible. |
Beta Was this translation helpful? Give feedback.
-
The following worked for me. I have included some comments and stuff not used to help people come up with better alternatives. Ideally one that does not require passing in the number of columns. #let my_pagebreak(n_cols: 2, ) = [
#context[
// #let n_cols = page.columns // I wrap thing inside a #columns function to allow breaking out as needed. page.columns does therefore not do the job for me.
#let width_page = page.width
#let width_col = width_page/n_cols
#let x_init = here().position().x
#let n_current_col = calc.ceil(x_init/width_col)
#let n_colbreaks_required = n_cols - n_current_col + 1
#text(1pt, luma(100%))[#n_colbreaks_required] // The function breaks without this. Seems like an anchor for the colbreaks somehow
#for _ in range(n_colbreaks_required){
colbreak()
// text[I am at page #{here().page()}] // This reports the wrong page...
}
]
] |
Beta Was this translation helpful? Give feedback.
For some containers it simply doesn't make sense to have a break in them (e.g. a box in a paragraph). For others, e.g. columns, it could make sense and is more of a current limitation that it's not possible.