LilyPond : how to write numbers before staves?
I'm writing some exercises, one per line, and I would like to write a number before each one.
I can't figure out how to do that, so a little help would be appreciated!
My code is pretty simple :
language "english"
header {title = "C Major"}
{
time 4/4
c' d' e' f' d' e' f' g' e' f' g' a' f' g' a' b' g' a' b' c'' a' b' c'' d'' b' c'' d'' e'' c'' d'' e'' f''
}
{
time 4/4
f'' e'' d'' c'' e'' d'' c'' b' d'' c'' b' a' c'' b' a' g' b' a' g' f' a' g' f' e' g' f' e' d' f' e' d' c'
}
2 Comments
Sorted by latest first Latest Oldest Best
The standard way of putting anything before a staff is by setting its instrumentName property.
You can put
set Staff.instrumentName = "1"
into the music, or declare the staff adding a 'with' clause:
new Staff with { instrumentName = "1" } { time 4/4 c' d' e' }
new Staff with { instrumentName = "2" } { time 4/4 f'' e'' d'' }
If you want to number the staves automatically, you can write some Scheme and label each staff with instrumentName = #(score-number):
version "2.19.81"
#(define sn 0)
#(define (score-number)
(set! sn (1+ sn))
(string-append (number->string sn))) % "."
new Staff with { instrumentName = #(score-number) } { time 4/4 c' d' e' }
new Staff with { instrumentName = #(score-number) } { time 4/4 c' d' e' }
Terms of Use Privacy policy Contact About Cancellation policy © freshhoot.com2025 All Rights reserved.