]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/new/positioning-multi-measure-rests.ly
Issue 3687 (part 3) Update snippets to use \compressMMRests
[lilypond.git] / Documentation / snippets / new / positioning-multi-measure-rests.ly
1
2 \version "2.19.20"
3
4 \header {
5   lsrtags = "rhythms, tweaks-and-overrides"
6
7   texidoc = "
8 Unlike ordinary rests, there is no predefined command to change the
9 staff position of a multi-measure rest symbol of either form by
10 attaching it to a note.  However, in polyphonic music multi-measure
11 rests in odd-numbered and even-numbered voices are vertically
12 separated. The positioning of multi-measure rests can be controlled as
13 follows:
14
15 "
16   doctitle = "Positioning multi-measure rests"
17 }
18
19 \relative c'' {
20   % Multi-measure rests by default are set under the fourth line
21   R1
22   % They can be moved using an override
23   \override MultiMeasureRest.staff-position = #-2
24   R1
25   \override MultiMeasureRest.staff-position = #0
26   R1
27   \override MultiMeasureRest.staff-position = #2
28   R1
29   \override MultiMeasureRest.staff-position = #3
30   R1
31   \override MultiMeasureRest.staff-position = #6
32   R1
33   \revert MultiMeasureRest.staff-position
34   \break
35
36   % In two Voices, odd-numbered voices are under the top line
37   << { R1 } \\ { a1 } >>
38   % Even-numbered voices are under the bottom line
39   << { a1 } \\ { R1 } >>
40   % Multi-measure rests in both voices remain separate
41   << { R1 } \\ { R1 } >>
42
43   % Separating multi-measure rests in more than two voices
44   % requires an override
45   << { R1 } \\ { R1 } \\
46      \once \override MultiMeasureRest.staff-position = #0
47      { R1 }
48   >>
49
50   % Using compressed bars in multiple voices requires another override
51   % in all voices to avoid multiple instances being printed
52   \compressMMRests
53   <<
54    \revert MultiMeasureRest.direction
55     { R1*3 }
56     \\
57    \revert MultiMeasureRest.direction
58     { R1*3 }
59   >>
60 }