5

I would like to typeset several Czerny's études in LilyPond. In the original text they are numbered, like this:

enter image description here

How can I get this number on the left of the system? I understand I can kind of mock it with an instrument name, but is there something more specific?

Here is a template for the first étude:

\version "2.22.1"
\language "italiano"

\score {
    \header {
        opus = "Op. 261 №1"
    }
    \new PianoStaff <<
        \new Staff = "right"
        \relative do'' {
            \key do \major
            \time 4/4
            \tempo "Allegro"
            \override Fingering.avoid-slur = #'inside
            do16-1 (re-2 mi-3 fa-4 sol-5 fa-4 mi-3 fa-4 sol-5 fa mi fa sol fa mi re |
            do-1 re mi fa sol-5 fa mi fa sol fa mi fa sol-5 fa mi re) |
            do-1 (mi-3 sol-5 mi-3 re-2 sol-5 fa-4 re-2 do-1 mi-3 sol-5 mi-3 re-2 sol-5 fa-4 re-2 |
            do-1 re mi-3 fa-1 sol-2 la si do do,8-1) r r4 |
            \bar "|."
        }
        \new Staff = "left"
        \relative do' {
            <do-2 mi-1>4 r r <sol-5 si-3 fa'-1> |
            <do-2 mi-1> r r <sol-5 si-3 fa'-1> |
            <do-2 mi-1> <sol-5 si-3 fa'-1> <do mi> <sol si fa'> |
            <do-2 mi-1> r r2
        }
    >>
}

Update

Here is an example why one may need text on the left of the system that is NOT a name of the instrument (engraved with MuseScore).

enter image description here

0

2 Answers 2

3

Using the instrument name is the cleanest way you can get it by default. While it would be possible to implement a whole new mechanic for that specific thing, there would be little benefit in it.

Can you tell us what problems you have in getting this the way you want it using InstrumentName? I cannot see any relevant difference between your example image and something like this

\version "2.22.1"
\language "italiano"

\score {
    \header {
        opus = "Op. 261 №1"
    }
    \new PianoStaff \with {
      instrumentName = "1."
      \override InstrumentName.font-size = #6
      \override InstrumentName.self-alignment-X = #RIGHT
    } <<
        \new Staff = "right"
        \relative do'' {
            \key do \major
            \time 4/4
            \tempo "Allegro"
            \override Fingering.avoid-slur = #'inside
            do16-1 (re-2 mi-3 fa-4 sol-5 fa-4 mi-3 fa-4 sol-5 fa mi fa sol fa mi re |
            do-1 re mi fa sol-5 fa mi fa sol fa mi fa sol-5 fa mi re) |
            do-1 (mi-3 sol-5 mi-3 re-2 sol-5 fa-4 re-2 do-1 mi-3 sol-5 mi-3 re-2 sol-5 fa-4 re-2 |
            do-1 re mi-3 fa-1 sol-2 la si do do,8-1) r r4 |
            \bar "|."
        }
        \new Staff = "left"
        \relative do' {
            <do-2 mi-1>4 r r <sol-5 si-3 fa'-1> |
            <do-2 mi-1> r r <sol-5 si-3 fa'-1> |
            <do-2 mi-1> <sol-5 si-3 fa'-1> <do mi> <sol si fa'> |
            <do-2 mi-1> r r2
        }
    >>
}

UPDATE

We can do thing like these in your update like this

\new StaffGroup \with
{
  instrumentName = \markup {\fontsize #10 "1." \hspace #14 }
  systemStartDelimiter = #'SystemStartBar
}
<<
  \new StaffGroup 
  <<
    \new Staff \with { instrumentName = "Флейта" } c''1
    \new Staff \with { instrumentName = "Гобой" } c'1
    \new Staff \with { instrumentName = \markup { \concat {"Си" \smaller\smaller\raise #0.3 \flat } "Кларнет" } } R1
    \new Staff \with { instrumentName = "Фагот" } R1
  >>
  \new Staff \with { instrumentName = "Валторна Фа" } R1
>>

\layout {
  indent = 5\cm
  \override Score.InstrumentName.self-alignment-X = #RIGHT
}

I do not know why anyone would do that, because it does not really look that great.

0
5

I'm with Lazy; I've always seen this done with the instrument name.

If it's an automated solution you're looking for, you can include something like

#(define sn 0)

#(define (score-number)
   (set! sn (1+ sn))
   (string-append (number->string sn) "."))  % "."

And then use this score-number in your code; something like:

\new Staff \with { instrumentName = \markup {
    \box \bold \pad-around #0.25 #(score-number) }
  }

This automatically numbers the etudes that you write, assuming you place them all in the same score.

To show how this works with both single- and multi-staff scores, consider the follow code and images:

\version "2.20.0"
\language "english"

#(define sn 0)

#(define (score-number)
   (set! sn (1+ sn))
   (string-append (number->string sn) "."))  % "."

violin = {
  c'1
}

\score {
  \new Staff \with { instrumentName = \markup {
    \box \bold \pad-around #0.25 #(score-number) }
  } \violin
  \layout { }
}

%%%%%

scoreAViolinI = \relative c'' {
  c1
}

scoreAViolinII = \relative c'' {
  c
}

scoreAViola = \relative c' {
  c
}

scoreACello = \relative c {
  c
}

\score {
  \new GrandStaff \with { instrumentName = \markup {
    \box \bold \pad-around #0.25 #(score-number) }
  } <<
    \new Staff \scoreAViolinI
    \new Staff \scoreAViolinII
    \new Staff { \clef alto \scoreAViola }
    \new Staff { \clef bass \scoreACello }
  >>
  \layout { }
}

enter image description here

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.