Gang, I'm currently working on keeps. As you might have seen, I've found a little problem concerning keep-with-next even on blocks. I've already fixed it locally, but I am not quite ready to commit, yet, since I want to get be sure first that my approach pays off (but it seems that way). Here's what I changed:
Until now, the LMs kept track of the previous LM and created an infinite penalty if a keep-with-next situation presented itself. This ignores the fact, however, that lower-level FOs can have a keep-with-next that influences a following FO on a higher level (see keep-with-next1a). I solved it by introducing a flag (KEEP_WITH_NEXT_PENDING) on the LayoutContext which will be propagated up the LM hierarchy. The next LM in charge of adding a penalty will check for that flag on the LayoutContext. That even made keep-with-next on tables very easy. It already works locally. What remains is to implement keep-with-previous on tables and then spread the new approach for keep-with-next to the rest of the LMs. I'm keeping the keeps strictly boolean for now which should cover >95% of the use cases in reality. Later we will need to refine the handling to distinguish between the two contexts (column/page) and strengths. JFYI Jeremias Maerki
