Next: , Previous: Rehearsal marks, Up: Orchestral music



5.15.4 Bar numbers

Bar numbers are printed by default at the start of the line. The number itself is stored in the currentBarNumber property, which is normally updated automatically for every measure.

Bar numbers can be typeset at regular intervals instead of at the beginning of each line. This is illustrated in the following example, whose source is available as input/test/bar-number-regular-interval.ly

[image of music]

Bar numbers can be typeset manually by tweaking the markFormatter property

     \relative c' {
       \set Score.markFormatter
         = #(lambda (mark context)
           (make-bold-markup
             (make-box-markup
               (number->string (ly:context-property context
                                                    'currentBarNumber)))))
     
       c1 \bar "||" \mark \default c1 c1 \mark \default c1 \bar "|."
     }

[image of music]

Bar numbers can be manually changed by setting the Staff.currentBarNumber property

     \relative c' {
       \repeat unfold 4 {c4 c c c} \break
       \set Score.currentBarNumber = #50
       \repeat unfold 4 {c4 c c c}
     }

[image of music]

See also

Program reference: BarNumber (lilypond-internals) .

Examples: input/test/bar-number-every-five-reset.ly, and input/test/bar-number-regular-interval.ly.

Bugs

Bar numbers can collide with the StaffGroup (lilypond-internals) bracket, if there is one at the top. To solve this, the padding property of BarNumber (lilypond-internals) can be used to position the number correctly.

Read comments on this page, or add one.

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

Report errors to <bug-lilypond@gnu.org>.

Other languages: English.
Using automatic language selection.