If each \item
is one or more paragraphs, sometimes ConTeXt will break these paragraphs across pages. In this specific case I would rather ConTeXt break between each item if a single paragraph or between paragraphs if multiple paragraphs. I've tried:
loose
. This changes the item group spacing sufficiently to sometimes, but not always, shift page breaks to between items.inbetween={\page[preference]}
. This is too opportunistic and forces page breaks where none are needed. It also completely breaks thepacked
,nowhite
andjoinedup
keywords especially when\setupwhitespace[big]
.\start...stoplinecorrection
. This clearly isn't ideal when the item group is longer than a page.
Edit:
The excellent answer below raises so many interesting questions. I looked into the online wiki, the manual, and the excursion tutorial and couldn't find answers to these questions, below. If they are documented elsewhere just link to them here rather than repeating everything.
You define a new userdata environment with a specific alternative. I've seen that keyword used throughout ConTeXt and assumed that it was an enumeration specific to each individual macro, i.e. every enumeration value would trigger behaviour hardcoded into the macro definition. But here you define a completely new alternative. What does that mean? At what stage is the alternative used or called? What is its scope; what does it do?
In the alternative you override the 'renderingsetup` keyword. Similar question regarding this. I assume it affects the new userdata environment before page rendering starts. Why must you use an alternative to override 'renderingsetup'?
In the setups you define a new box and contents. Why do you disable the following blank?
Then you test the height of the box. I'd ask how this is possible before rendering, i.e. in renderingsetup
, but that's more of a TeX question, so nevermind.
If the height of the box is smaller than \textheight
you just insert the box (with contents). Is it a good idea to unbox if the height is less than \pagegoal
?
Otherwise, for clarification on longer items: An item is composed of several paragraphs. Right now only paragraphs, but in the future maybe a nested item list or two. I only want pagebreaks between paragraphs with two exceptions:
- Never page break after the first paragraph, as it is somewhat of a heading.
- Only break a paragraph (into pieces) if it is longer than
0.25\textheight
, but your answer already demonstrates how to do this.
But that seems pretty advanced. Should I make it a new question, to demonstrate for loop with index, introspection (is item at index a paragraph vs glue?), etc?