Jump to content

Positioning multi-measure rests: Difference between revisions

From LilyPond wiki
No edit summary
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Unlike ordinary rests, there is no predefined command to change the staff position of a multi-measure rest symbol of either form by attaching it to a note. However, in polyphonic music multi-measure rests in odd-numbered and even-numbered voices are vertically separated.
Unlike ordinary rests, there is no predefined command to change the staff position of a multi-measure rest symbol of either form by attaching it to a note. However, in polyphonic music multi-measure rests in odd-numbered and even-numbered voices are vertically separated.


The positioning of multi-measure rests can be controlled as follows:
This snippet shows how positioning of multi-measure rests can be controlled.


<lilypond version="2.24">
<lilypond version="2.24">
\relative c'' {
\relative c'' {
   % Multi-measure rests by default are set under the fourth line
   % Multi-measure rests by default are set under the fourth line.
   R1
   R1
   % They can be moved using an override
   % They can be moved using an override.
   \override MultiMeasureRest.staff-position = -2
   \override MultiMeasureRest.staff-position = -2
   R1
   R1
Line 21: Line 21:
   \break
   \break


   % In two Voices, odd-numbered voices are under the top line
   % In two Voices, odd-numbered voices are under the top line.
   << { R1 } \\ { a1 } >>
   << { R1 } \\ { a1 } >>
   % Even-numbered voices are under the bottom line
   % Even-numbered voices are under the bottom line.
   << { a1 } \\ { R1 } >>
   << { a1 } \\ { R1 } >>
   % Multi-measure rests in both voices remain separate
   % Multi-measure rests in both voices remain separate.
   << { R1 } \\ { R1 } >>
   << { R1 } \\ { R1 } >>


   % Separating multi-measure rests in more than two voices
   % Separating multi-measure rests in more than two voices
   % requires an override
   % requires an override.
   << { R1 } \\ { R1 } \\
   << { R1 } \\ { R1 } \\
     \once \override MultiMeasureRest.staff-position = 0
     \once \override MultiMeasureRest.staff-position = 0
Line 36: Line 36:


   % Using compressed bars in multiple voices requires another override
   % Using compressed bars in multiple voices requires another override
   % in all voices to avoid multiple instances being printed
   % in all voices to avoid multiple instances being printed.
   \compressMMRests
   \compressMMRests
   <<
   <<
  \revert MultiMeasureRest.direction
    \revert MultiMeasureRest.direction
     { R1*3 }
     { R1*3 } \\
    \\
    \revert MultiMeasureRest.direction
  \revert MultiMeasureRest.direction
     { R1*3 }
     { R1*3 }
   >>
   >>
Line 50: Line 49:
[[Category:Rhythms]]
[[Category:Rhythms]]
[[Category:Tweaks and overrides]]
[[Category:Tweaks and overrides]]
[[Category:Included in the official documentation]][[Category:Snippet]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]

Latest revision as of 14:49, 30 November 2025

Unlike ordinary rests, there is no predefined command to change the staff position of a multi-measure rest symbol of either form by attaching it to a note. However, in polyphonic music multi-measure rests in odd-numbered and even-numbered voices are vertically separated.

This snippet shows how positioning of multi-measure rests can be controlled.

\version "2.24"

\relative c'' {
  % Multi-measure rests by default are set under the fourth line.
  R1
  % They can be moved using an override.
  \override MultiMeasureRest.staff-position = -2
  R1
  \override MultiMeasureRest.staff-position = 0
  R1
  \override MultiMeasureRest.staff-position = 2
  R1
  \override MultiMeasureRest.staff-position = 3
  R1
  \override MultiMeasureRest.staff-position = 6
  R1
  \revert MultiMeasureRest.staff-position
  \break

  % In two Voices, odd-numbered voices are under the top line.
  << { R1 } \\ { a1 } >>
  % Even-numbered voices are under the bottom line.
  << { a1 } \\ { R1 } >>
  % Multi-measure rests in both voices remain separate.
  << { R1 } \\ { R1 } >>

  % Separating multi-measure rests in more than two voices
  % requires an override.
  << { R1 } \\ { R1 } \\
     \once \override MultiMeasureRest.staff-position = 0
     { R1 }
  >>

  % Using compressed bars in multiple voices requires another override
  % in all voices to avoid multiple instances being printed.
  \compressMMRests
  <<
    \revert MultiMeasureRest.direction
    { R1*3 } \\
    \revert MultiMeasureRest.direction
    { R1*3 }
  >>
}