4

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' 
}
1
  • \markup allows arbitrary text (above or below) which should work fine. But I would definitely add note lengths and bars, and I can't imagine, that your apostrophes are as intended (at least if relative notation is used, which simplifies the source somewhat).
    – guidot
    Apr 1, 2018 at 20:45

2 Answers 2

2

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' }

enter image description here

2
4

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'' }

example rendering of the above lilypond code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.