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 anautomated and digital alternative to Bates numbering within LilyPond. The goal: Have LilyPond generate a singlePDF 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.

Reply via email to