Hello Johannes,

using page-turn-breaking only acts like this if ragged-bottom is set to #t 
(which should be considered as weird behaviour). I suppose what’s happening 
there is that with ragged-bottom set to #t there is no demerit for short 
pages, as the pages are not stretched out (which is the thing that would get 
demerits). This means that there is no demerit to breaking in every possible 
place, which I think is one of the first solutions tried by the breaking 
algorithm. Thus even if we find a shorter solution of equal demerit we won’t 
use it.

I’d suggest we should add a very small demerit for solutions with lots of 
pages so that with configurations with the same overall demerit the one with 
less pages is preferred.

E.g. changing line 124 in page-turn-page-breaking.cc to
ret.demerits_ = result.demerits_ + static_cast<Real>(ret.page_count_)/1000;
we do already get better behaviour (although probably not the best, for some 
weird reason it allows compression of pages when it is not nescessary, like 
here

\paper {
  page-breaking = #ly:page-turn-breaking
  ragged-bottom = ##t
}

{\repeat unfold 20 c1 }
{\repeat unfold 20 c1 }
{\repeat unfold 20 c1 }
{\repeat unfold 40 c1 }
{\repeat unfold 20 c1 }
{\repeat unfold 100 c1 }
{\repeat unfold 20 c1 }
{\repeat unfold 20 c1 }
{\repeat unfold 20 c1 }
{\repeat unfold 20 c1 }
{\repeat unfold 200 c1 }

on page 2). It might also be sensible to add a small demerit depending on the 
free whitespace to enforce a more even distribution of whitespace.

Cheers,
Valentin

Am Mittwoch, 23. Februar 2022, 18:13:15 CET schrieb Johannes Maibaum:
> Hello,
> 
> I am working on a lead-sheet song book (i.e. one \book with many short
> \scores inside), and I was looking for a way to optimize page turning
> for musicians playing tunes from the book. Most songs fit on a single
> page, but there are a few songs which span 2 or more pages.
> 
> I want to make sure that all songs which more than 1 page start on an
> even page, but all 1-page songs should be allowed to start on an even or
> an odd page.
> 
> Looking through the documentation, and testing the built-in page-
> breaking algorithms, there doesn't seem to be a turn-key solution for my
> use-case. The default optimal-breaking algorithm starts every \score on
> the next page (even or odd), and page-turn-breaking forces every \score
> to start on an even page, which causes (almost) blank pages (the last
> line is put on the odd page) after all tunes which would happily fit on
> 1 page.
> 
> I tried fiddling with the different blank-page-*-penalties, but so far I
> wasn't able to achieve my goal. Is it possible after all?
> 
> 
> Best,
> Johannes

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to