Thank you both!
Knute, if I’m understanding your code correctly, it will generate a
separate PDF file for each numbered copy. Instead, I’m hoping to generate
one single output file, so that I only have to send that one file to my
printer.
Timothy, your method generates one PDF, which is very helpful.
At first the code in your \paper block wasn’t working on my end. But then I
moved your \paper block inside of \book {}, and now
bookpart-level-page-numbering and \if \on-last-page-of-part { \null
\fromproperty #'header:tagline \null } are working.
I find that in Frescobaldi, automatic engraving does not occur with your
code. But that’s no problem, as it’s easy to click LilyPond > Engrave
(preview).
Many thanks again to you both!
On Sat, 29 Nov 2025 at 04:23, Timothy Lanfear wrote:
> On 28/11/2025 14:58, Gabriel Ellsworth wrote:
>
> In my choir, each singer has an assigned number, akin to an athlete’s
> jersey number. Whenever we print a new piece, we number our set of paper
> copies, using a Bates automatic-numbering machine
> <https://en.wikipedia.org/wiki/Bates_numbering> to stamp the hard-copy
> scores with each chorister’s number.
>
> I am hoping to create an automated and digital alternative to Bates
> numbering within LilyPond. The goal: Have LilyPond generate a single PDF
> file that I can send to the printer. This file would contain NN copies of
> my score (where NN is a numerical variable that I can tweak). Every hard
> copy would be identical to every other (same page numbering, same \header
> content), except for the “Copy #” field.
>
> As an alternative to Knute's shell script, you can do the whole process in
> LilyPond/Scheme.
>
> \version "2.24.4"
>
> #(use-modules (srfi srfi-1))
>
> NN = 2 % how many numbered copies
>
> myTitlePage = \markup \fill-line \huge { "This Is My Title Page" }
>
> myScore = { c' \pageBreak d' \pageBreak e' }
>
> myBookpart = #(define-scheme-function (n) ((lambda (x) (or (integer? x)
> (string? x))))
> #{
> \bookpart {
> \markup \fill-line { #(format #f "Copy ~a" n) }
> \myTitlePage
> \pageBreak
> \myScore
> }
> #})
>
> myBook = \book {}
>
> \paper {
> bookpart-level-page-numbering = ##t
> oddFooterMarkup = \markup \fill-line {
> \if \on-last-page-of-part { \null \fromproperty #'header:tagline
> \null }
> }
> }
>
> #(for-each
> (lambda (i) (ly:book-add-bookpart! myBook (myBookpart i)))
> (append '("for Choirmaster" "for Organist") (iota NN 1)))
>
> #(ly:book-process myBook $defaultpaper $defaultlayout (
> ly:parser-output-name))
>
>
> --
> Timothy Lanfear, Bristol, UK.
>
>