Next: Bar and bar number checks, Previous: Bar lines, Up: Bars
Bar numbers are typeset by default at the start of every line except
the first line. The number itself is stored in the
currentBarNumber
property, which is normally updated
automatically for every measure. It may also be set manually:
c1 c c c \break \set Score.currentBarNumber = #50 c1 c c c
Bar numbers can be typeset at regular intervals instead of just at
the beginning of every line. To do this the default behavior
must be overridden to permit bar numbers to be printed at places
other than the start of a line. This is controlled by the
break-visibility
property of BarNumber
. This takes
three values which may be set to #t
or #f
to specify
whether the corresponding bar number is visible or not. The order
of the three values is end of line visible
, middle of
line visible
, beginning of line visible
. In the following
example bar numbers are printed at all possible places:
\override Score.BarNumber #'break-visibility = #'#(#t #t #t) \set Score.currentBarNumber = #11 \bar "" % Permit first bar number to be printed c1 c c c \break c c c c
and here the bar numbers are printed every two measures except at the end of the line:
\override Score.BarNumber #'break-visibility = #'#(#f #t #t) \set Score.currentBarNumber = #11 \bar "" % Permit first bar number to be printed % Print a bar number every second measure \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2) c1 c c c c \break c c c c c
The size of the bar number may be changed. This is illustrated
in the following example, which also shows how to enclose bar
numbers in boxes and circles, and shows an alternative way
of specifying #(#f #t #t)
for break-visibility
.
% Prevent bar numbers at the end of a line and permit them elsewhere \override Score.BarNumber #'break-visibility = #end-of-line-invisible % Increase the size of the bar number by 2 \override Score.BarNumber #'font-size = #2 \repeat unfold 3 { c1 } \bar "|" % Draw a box round the following bar number(s) \override Score.BarNumber #'stencil = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print) \repeat unfold 3 { c1 } \bar "|" % Draw a circle round the following bar number(s) \override Score.BarNumber #'stencil = #(make-stencil-circler 0.1 0.25 ly:text-interface::print) \repeat unfold 4 { c1 } \bar "|."
Bar numbers by default are left-aligned to their parent object. This is usually the left edge of a line or, if numbers are printed within a line, the left bar line of the measure. The numbers may also be positioned directly on the bar line or right-aligned to the bar line:
\set Score.currentBarNumber = #111 \override Score.BarNumber #'break-visibility = #'#(#t #t #t) % Increase the size of the bar number by 2 \override Score.BarNumber #'font-size = #2 % Print a bar number every second measure \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2) c1 c1 % Center-align bar numbers \override Score.BarNumber #'self-alignment-X = #0 c1 c1 % Right-align bar numbers \override Score.BarNumber #'self-alignment-X = #-1 c1 c1
Bar numbers can be removed entirely by removing the
Bar_number_engraver
from the Score
context.
\layout { \context { \Score \remove "Bar_number_engraver" } } \relative c''{ c4 c c c \break c4 c c c }
Snippets: Rhythms.
Internals Reference: BarNumber.
Bar numbers may collide with the top of the
StaffGroup bracket, if there is one. To solve
this, the padding
property of BarNumber can
be used to position the number correctly.
Bar numbers may only be printed at bar lines; to print a bar
number at the beginning of a piece, an empty bar line must be
inserted there, and a value other than 1
must be placed
in currentBarNumber
:
\set Score.currentBarNumber = #50 \bar "" c1 c c c c1 c c c \break
Diese Seite ist für LilyPond-2.11.58 (Entwicklungszweig).
Fehler bitte an http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs melden.
Ihre Vorschläge für die Dokumentation sind willkommen.