On 14/06/2026 17:30, Eric Benson wrote:
Is there any way to get LilyPond to report some actual data about how many pages it has produced and how many staves are on each page?

You can get intercept the list of pages in the paper block and retrieve information by writing a customised page-breaking function. The default algorithm for page breaking is ly:optimal-breaking, but you can pass in other algorithms (https://lilypond.org/doc/v2.26/Documentation/notation/page-breaking).

\version "2.26.0"

#(use-modules (lily page))

#(define (page-info page-break-algorithm)
(lambda (paper-book)
   (let ((pages (page-break-algorithm paper-book)))
     (for-each
       (lambda (page n) (ly:message "page ~s: ~s systems\n" n (length (page-property page 'lines))))
       pages (iota (length pages) 1))
     pages)))

\paper {
  page-breaking = #(page-info ly:optimal-breaking)
}

\score {
  <<
    {
      \repeat unfold 5 { c'4 d' e' f' g' a' b' c'' }
      \pageBreak
      \repeat unfold 65 { c'4 d' e' f' g' a' b' c'' }
    }
    \repeat unfold 70 { c'4 d' e' f' g' a' b' c'' }
  >>
}


--
Timothy Lanfear, Bristol, UK.

Reply via email to