On 30/08/2025 05:51, Werner LEMBERG wrote:
Is there a way to modify the page number arbitrarily? I tried
This solution may need further refinement to be completely robust. The
idea is to take the default set of pages, create new pages with the
desired new page numbering, and transfer the contents of the default
pages into the new pages. To illustrate, I've incremented by 10 from
page 3 onwards. This was inspired by a snippet by the redoubtable Jean
Abou Samra.
\version "2.24.0"
#(use-modules (lily page))
adjust-page-number =
#(lambda (paper-book)
(let ((default-pages (ly:optimal-breaking paper-book)))
(map
(lambda (this-page)
(let* ((page-number (page-property this-page 'page-number))
(config (page-property this-page 'configuration))
(lines (page-property this-page 'lines))
(is-last-page (page-property this-page
'is-bookpart-last-page))
(new-page-number (if (> page-number 2) (+ 10
page-number) page-number))
(new-page (make-page paper-book new-page-number
is-last-page)))
(page-set-property! new-page 'lines lines)
(page-set-property! new-page 'configuration config)
new-page))
default-pages)))
\paper {
page-breaking = #adjust-page-number
}
#(set-default-paper-size "a6")
{
\relative c'' {
\repeat unfold 70 {a4 b c d}
}
}
--
Timothy Lanfear, Bristol, UK.