]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/new/numbering-groups-of-measures.ly
Issue 2924: Doc: \startMeasureCount and \stopMeasureCount needs documenting
[lilypond.git] / Documentation / snippets / new / numbering-groups-of-measures.ly
1 \version "2.17.7"
2
3 \header {
4   lsrtags = "contexts-and-engravers, editorial-annotations, repeats, staff-notation"
5
6   texidoc = "
7 This snippet demonstrates the use of the @code{Measure_counter_engraver} to
8 number groups of successive measures.  Any stretch of measures may be numbered,
9 whether consisting of repetitions or not.
10
11 The engraver must be added to the appropriate context.  Here, a @code{Staff}
12 context is used; another possibility is a @code{Dynamics} context.
13
14 The counter is begun with @code{\\startMeasureCount} and ended with
15 @code{\\stopMeasureCount}.  Numbering will start by default with @code{1}, but
16 this behavior may be modified by overriding the @code{count-from} property.
17
18 When a measure extends across a line break, the number will appear twice, the
19 second time in parentheses.
20
21 "
22   doctitle = "Numbering groups of measures"
23 }
24
25 \layout {
26   \context {
27     \Staff
28     \consists #Measure_counter_engraver
29   }
30 }
31
32 \new Staff {
33   \startMeasureCount
34   \repeat unfold 7 {
35     c'4 d' e' f'
36   }
37   \stopMeasureCount
38   \bar "||"
39   g'4 f' e' d'
40   \override Staff.MeasureCounter.count-from = #2
41   \startMeasureCount
42   \repeat unfold 5 {
43     g'4 f' e' d'
44   }
45   g'4 f'
46   \bar ""
47   \break
48   e'4 d'
49   \repeat unfold 7 {
50     g'4 f' e' d'
51   }
52   \stopMeasureCount
53 }