koma add tag
Caleb (imported from SE)
I am working on a document that has a large number of external Lilypond files included. These render quite well and (while a bit of a pain to use) `lilypond-book` is smart enough to render the music systems at the available width of the host document and add line breaks (and potentially page breaks) between systems.

I can even override the function Lilypond uses between systems to tell latex that I really-really don't want page breaks inside individual scores if it can help it:


This works great for keeping short scores together on a page, but there are a few cases where this is simply not possible. Some scores are simply too long and must span two or more pages. In these cases it much easier on musicians if the score starts on an even (left) page and runs over onto an odd (right) page.

I would like to be able to change the weight of the page-break penalty so that scores tried to stay on a page but that scores starting on even pages shouldn't care much (say `\nopagebreak[1]`), while ones on odd pages make a big deal out of it (`\nopagebreak[3]` or even `4`). Additionally, it would be nice to have some sort  of page-clear inserted before scores that were going to run over such that longer scores always start on even pages.

How could this be accomplished?
Top Answer
Matthias (imported from SE)
You can try to use the command `\ifthispageodd{<true part>}{<false part>}`, which is part of KOMA-Script. It uses a label in the .aux file and therefore needs at least two LaTeX passes to function. In your case it could look like:


Without a MWE, however, it is difficult to tell whether this really works or not.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.