LilyPond Notation Reference: 1.6.2 Modifying single staves

### 1.6.2 Modifying single staves

This section explains how to change specific attributes of one staff: for example, modifying the number of staff lines or the staff size. Methods to start and stop staves and set ossia sections are also described.

#### Staff symbol

The lines of a staff belong to the `StaffSymbol` grob. `StaffSymbol` properties can be modified to change the appearance of a staff, but they must be modified before the staff is created.

The number of staff lines may be changed. The clef position and the position of middle C may need to be modified to fit the new staff. For an explanation, refer to the snippet section in Clef.

>     \new Staff \with {
>       \override StaffSymbol #'line-count = #3
>     }
>     { d4 d d d }

Staff line thickness can be modified. The thickness of ledger lines and stems are also affected, since they depend on staff line thickness.

>     \new Staff \with {
>       \override StaffSymbol #'thickness = #3
>     }
>     { e4 d c b }

Ledger line thickness can be set independently of staff line thickness. In the example the two numbers are factors multiplying the staff line thickness and the staff line spacing. The two contributions are added to give the ledger line thickness.

>     \new Staff \with {
>       \override StaffSymbol #'ledger-line-thickness = #'(1 . 0.2)
>     }
>     { e4 d c b }

The distance between staff lines can be changed. This setting affects the spacing of ledger lines as well.

>     \new Staff \with {
>       \override StaffSymbol #'staff-space = #1.5
>     }
>     { a4 b c d }

Further details about the properties of `StaffSymbol` can be found in staff-symbol-interface.

Modifications to staff properties in the middle of a score can be placed between `\stopStaff` and `\startStaff`:

>     c2 c
>     \stopStaff
>     \override Staff.StaffSymbol #'line-count = #2
>     \startStaff
>     b2 b
>     \stopStaff
>     \revert Staff.StaffSymbol #'line-count
>     \startStaff
>     a2 a

In general, `\startStaff` and `\stopStaff` can be used to stop or start a staff in the middle of a score.

>     c4 b a2
>     \stopStaff
>     b4 c d2
>     \startStaff
>     e4 d c2

#### Predefined commands

`\startStaff`, `\stopStaff`.

#### Selected Snippets

Making some staff lines thicker than the others

For pedagogical purposes, a staff line can be thickened (e.g., the middle line, or to emphasize the line of the G clef). This can be achieved by adding extra lines very close to the line that should be emphasized, using the `line-positions` property of the `StaffSymbol` object.

>     {
>       \override Staff.StaffSymbol #'line-positions = #'(-4 -2 -0.2 0 0.2 2 4)
>       d'4 e' f' g'
>     }

#### See also

Music Glossary: line, ledger line, staff.

Notation Reference: Clef.

Snippets: Staff notation.

Internals Reference: StaffSymbol, staff-symbol-interface.

#### Ossia staves

Ossia staves can be set by creating a new simultaneous staff in the appropriate location:

>     \new Staff \relative c'' {
>       c4 b d c
>       <<
>         { c4 b d c }
>         \new Staff { e4 d f e }
>       >>
>       c4 b c2
>     }

However, the above example is not what is usually desired. To create ossia staves that are above the original staff, have no time signature or clef, and have a smaller font size, tweaks must be used. The Learning Manual describes a specific technique to achieve this goal, beginning with Nesting music expressions.

The following example uses the `alignAboveContext` property to align the ossia staff. This method is most appropriate when only a few ossia staves are needed.

>     \new Staff = main \relative c'' {
>       c4 b d c
>       <<
>         { c4 b d c }

>         \new Staff \with {
>           \remove "Time_signature_engraver"
>           alignAboveContext = #"main"
>           fontSize = #-3
>           \override StaffSymbol #'staff-space = #(magstep -3)
>           \override StaffSymbol #'thickness = #(magstep -3)
>           firstClef = ##f
>         }
>         { e4 d f e }
>       >>
>       c4 b c2
>     }

If many isolated ossia staves are needed, creating an empty `Staff` context with a specific context id may be more appropriate; the ossia staves may then be created by calling this context and using `\startStaff` and `\stopStaff` at the desired locations. The benefits of this method are more apparent if the piece is longer than the following example.

>     <<
>       \new Staff = ossia \with {
>         \remove "Time_signature_engraver"
>         \override Clef #'transparent = ##t
>         fontSize = #-3
>         \override StaffSymbol #'staff-space = #(magstep -3)
>         \override StaffSymbol #'thickness = #(magstep -3)
>       }
>       { \stopStaff s1*6 }

>       \new Staff \relative c' {
>         c4 b c2
>         <<
>           { e4 f e2 }
>           \context Staff = ossia {
>             \startStaff e4 g8 f e2 \stopStaff
>           }
>         >>
>         g4 a g2 \break
>         c4 b c2
>         <<
>           { g4 a g2 }
>           \context Staff = ossia {
>             \startStaff g4 e8 f g2 \stopStaff
>           }
>         >>
>         e4 d c2
>       }
>     >>

Using the `\Staff \RemoveEmptyStaves` command to create ossia staves may be used as an alternative. This method is most convenient when ossia staves occur immediately following a line break. For more information about `\Staff \RemoveEmptyStaves`, see Hiding staves.

>     <<
>       \new Staff = ossia \with {
>         \remove "Time_signature_engraver"
>         \override Clef #'transparent = ##t
>         fontSize = #-3
>         \override StaffSymbol #'staff-space = #(magstep -3)
>         \override StaffSymbol #'thickness = #(magstep -3)
>       } \relative c'' {
>         R1*3
>         c4 e8 d c2
>       }
>       \new Staff \relative c' {
>         c4 b c2
>         e4 f e2
>         g4 a g2 \break
>         c4 b c2
>         g4 a g2
>         e4 d c2
>       }
>     >>

>     \layout {
>       \context {
>         \Staff \RemoveEmptyStaves
>         \override VerticalAxisGroup #'remove-first = ##t
>       }
>     }

#### Selected Snippets

Vertically aligning ossias and lyrics

This snippet demonstrates the use of the context properties `alignBelowContext` and `alignAboveContext` to control the positioning of lyrics and ossias.

>     \paper {
>       ragged-right = ##t
>     }

>     \relative c' <<
>       \new Staff = "1" { c4 c s2 }
>       \new Staff = "2" { c4 c s2 }
>       \new Staff = "3" { c4 c s2 }
>       { \skip 2
>         <<
>           \lyrics {
>             \set alignBelowContext = #"1"
>             lyrics4 below
>           }
>           \new Staff \with {
>             alignAboveContext = #"3"
>             fontSize = #-2
>             \override StaffSymbol #'staff-space = #(magstep -2)
>             \remove "Time_signature_engraver"
>           } {
>             \times 4/6 {
>               \override TextScript #'padding = #3
>               c8[^"ossia above" d e d e f]
>             }
>           }
>         >>
>       }
>     >>

#### See also

Music Glossary: ossia, staff, Frenched staff.

Learning Manual: Nesting music expressions, Size of objects, Length and thickness of objects.

Notation Reference: Hiding staves.

Snippets: Staff notation.

Internals Reference: StaffSymbol.

#### Hiding staves

Staff lines can be hidden by removing the `Staff_symbol_engraver` from the `Staff` context. As an alternative, `\stopStaff` may be used.

>     \new Staff \with {
>       \remove "Staff_symbol_engraver"
>     }
>     \relative c''' { a8 f e16 d c b a2 }

Empty staves can be hidden by setting the `\Staff \RemoveEmptyStaves` command in the `\layout` block. In orchestral scores, this style is known as ‘Frenched Score’. By default, this command hides and removes all empty staves in a score except for those in the first system.

Note: A staff is considered empty when it contains only multi-measure rests, rests, skips, spacer rests, or a combination of these elements.

>     \layout {
>       \context {
>         \Staff \RemoveEmptyStaves
>       }
>     }

>     \relative c' <<
>       \new Staff {
>         e4 f g a \break
>         b1 \break
>         a4 b c2
>       }
>       \new Staff {
>         c,4 d e f \break
>         R1 \break
>         f4 g c,2
>       }
>     >>

`\Staff \RemoveEmptyStaves` can also be used to create ossia sections for a staff. For details, see Ossia staves.

The `\VaticanaStaff \RemoveEmptyStaves` command may be used to hide empty staves in ancient music contexts. Similarly, `\RhythmicStaff \RemoveEmptyStaves` may be used to hide empty `RhythmicStaff` contexts.

#### Predefined commands

`\Staff \RemoveEmptyStaves`, `\VaticanaStaff \RemoveEmptyStaves`, `\RhythmicStaff \RemoveEmptyStaves`.

#### Selected Snippets

Removing the first empty line

The first empty staff can also be removed from the score by setting the `VerticalAxisGroup` property `remove-first`. This can be done globally inside the `\layout` block, or locally inside the specific staff that should be removed. In the latter case, you have to specify the context (`Staff` applies only to the current staff) in front of the property.

The lower staff of the second staff group is not removed, because the setting applies only to the specific staff inside of which it is written.

>     \layout {
>       \context {
>         \Staff \RemoveEmptyStaves
>         % To use the setting globally, uncomment the following line:
>         % \override VerticalAxisGroup #'remove-first = ##t
>       }
>     }
>     \new StaffGroup <<
>       \new Staff \relative c' {
>         e4 f g a \break
>         c1
>       }
>       \new Staff {
>         % To use the setting globally, comment this line,
>         % uncomment the line in the \layout block above
>         \override Staff.VerticalAxisGroup #'remove-first = ##t
>         R1 \break
>         R
>       }
>     >>
>     \new StaffGroup <<
>       \new Staff \relative c' {
>         e4 f g a \break
>         c1
>       }
>       \new Staff {
>         R1 \break
>         R
>       }
>     >>

#### See also

Music Glossary: Frenched staff.

Learning Manual: Visibility and color of objects.

Notation Reference: Changing context default settings, Staff symbol, Ossia staves, Hidden notes, Invisible rests, Visibility of objects.

Snippets: Staff notation.

Internals Reference: ChordNames, FiguredBass, Lyrics, Staff, VerticalAxisGroup, Staff_symbol_engraver.

#### Known issues and warnings

Removing `Staff_symbol_engraver` also hides bar lines. If bar line visibility is forced, formatting errors may occur. In this case, use the following overrides instead of removing the engraver:

>     \override StaffSymbol #'stencil = ##f
>     \override NoteHead #'no-ledgers = ##t

For the Known issues and warnings associated with `\Staff \RemoveEmptyStaves` see Changing context default settings.

Andere talen: deutsch, español, français, 日本語.

#### LilyPond — Notation Reference