In a previous life I [asked a question](https://topanswers.xyz/tex?q=340) about page break penalties and weighting them differently depending on whether they landed on odd or even pages.
The basic answer to that using KOMA-Script classes (which I happened to be using) ran something like this:
This worked okay, and it is something I use in producion every day. However it has one significant draw back: **it onnly works on the second pass**. This means it sometimes lets me down pretty hard because I have one project that does _many_ passes, basically fitting arbitrary content into a fixed page count by iterating over the intput incrementally taking predefined steps to shrink things until it all fits.
Unless I did three passes of every itteration in that process, I don't get accurate break weights.
Is there any way to expidite this and know what page I'm on in the current rendering pass (not the previous one) and set a penalty based on that?
I didn't test this, so I'm entirely unsure whether it does what it should in your context.
The idea is to measure the height of your score and test for a few things (I hope the comments are enough). One could of course test for other things (e.g. if this page is even and already started, will the score fit on the remaining space of this page plus the next page).
All you have to do is make sure that the scores are typeset inside the `myscores` environment, the environment should handle the rest.
% this is analogue to how `\cleardoublepage' works
% we're at the start of a page
% score will be bigger than one page, so we want to start on the next
% even page
% score will not fit on the remaining space of this page
% score will not fit on a single page
% score will fit on a single page