Next: , Previous: Metronome marks, Up: Writing parts


Instrument names

Instrument names can be printed on the left side of staves for the Staff and PianoStaff contexts. The value of instrumentName is used for the first staff, and the value of shortInstrumentName is used for all succeeding staves.

     
     \set Staff.instrumentName = "Violin "
     \set Staff.shortInstrumentName = "Vln "
     c1
     \break
     c''1

[image of music]

Markup mode can be used to create more complicated instrument names:

     
     \set Staff.instrumentName = \markup {
       \column { "Clarinetti"
                 \line { "in B" \smaller \flat } } }
     c1

[image of music]

When two or more staff contexts are grouped together, the instrument names and short instrument names are centered by default. To center multi-line instrument names, \center-column must be used:

     
     <<
       \new Staff {
         \set Staff.instrumentName = \markup \center-column {
           Clarinetti
           \line { "in B" \smaller \flat }
         }
         c1
       }
       \new Staff {
         \set Staff.instrumentName = "Vibraphone"
         c1
       }
     >>

[image of music]

The indent and short-indent settings specify the level of indentation for the first system and all succeeding systems, respectively. They can be modified in the \layout block. For instrument names or short instrument names that are longer, it may be useful to increase the indent and short-indent settings:

     
     \relative c' <<
       \new Staff \with {
         instrumentName = "Oboe"
       }
       { c2 d }
       \new Staff \with {
         instrumentName = "Glockenspiel"
       }
       { c'2 d }
     >>
     
     \layout {
       indent = 2.5\cm
     }

[image of music]

To add instrument names to other contexts (such as GrandStaff, ChoirStaff, or StaffGroup), Instrument_name_engraver must be added to that context. For details, see Modifying context plug-ins.

Instrument names may be changed in the middle of a piece:

     
     \set Staff.instrumentName = "First"
     \set Staff.shortInstrumentName = "one"
     c1 c c c \break
     c1 c c c \break
     \set Staff.instrumentName = "Second"
     \set Staff.shortInstrumentName = "two"
     c1 c c c \break
     c1 c c c \break

[image of music]

Selected Snippets

Aligning and centering instrument names

Instrument names are generally printed to the left of the staves. To align the names of several different intruments, put them in a \markup block and use one of the following possibilites:

* Right-aligned instrument names: this is the default behavior

* Center-aligned instrument names: using the \hcenter-in #n command places the instrument names inside a padded box, with n being the width of the box

* Left-aligned instrument names: the names are printed on top of an empty box, using the \combine command with an \hspace #n object.

     
     \paper {
       indent = #0
       left-margin = #30
       line-width = #160
     }
     
     \new StaffGroup \relative c' <<
       \new Staff {
         \set Staff.instrumentName = #"Piccolo"
         c1^"default" | c \break
         \set Staff.instrumentName = \markup { \hcenter-in #10 Piccolo }
         c1^"centered" | c \break
         \set Staff.instrumentName = \markup { \combine \hspace #8 Piccolo }
         c1^"left-aligned" | c
       } 
       \new Staff {
         \set Staff.instrumentName = #"Flute"
         c1 | c \break
         \set Staff.instrumentName = \markup { \hcenter-in #10 Flute }
         c1 | c \break
         \set Staff.instrumentName = \markup { \combine \hspace #8 Flute }
         c1 | c
       }
     >>

[image of music]

See also

Notation Reference: Modifying context plug-ins.

Snippets: Staff notation.

Internals Reference: InstrumentName, PianoStaff, Staff.


Next: , Previous: Metronome marks, Up: Writing parts

This page is for LilyPond-2.11.57 (development-branch).

Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.

Your suggestions for the documentation are welcome.

Other languages: français, español.