Is there a way in LaTeX to declare a command or environment that will "refuse" to be broken across pages unless absolutely necessary?
Use case: I have a number of documentation items (all generated via Doxygen's XML) and several of them are just a handful of lines long. In some cases up to four of these items could fit on one (A4) page.
Now one such documentation item starts a new \section or \subsection (depending on the context) and it should not break between the (sub)section heading and the contents. That is, title and content must always be kept on the same page. The only exception to that rule would be that title and content combined would not fit a single page if they started on a new page.
I guess what I am looking for could be described as "vertical badness" value and I need a way to measure items vertically and let them flow onto the next page if necessary.
minipageand the result was that the very few boxes that were bigger than the page height did not break ... which is suboptimal, so to speak. – 0xC0000022L May 09 '19 at 14:24