Aligning bar numbers: Difference between revisions
Appearance
m New category |
Fix code and description for version 2.24 . |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
The default alignment of bar numbers depends on its position: at the beginning of a staff, bar numbers are right-aligned; at all other positions, they are left-aligned. Using Scheme function <code>break-alignment-list</code>, this can be changed; the three arguments of this function are the alignment for end-of-line, middle-of-line, and start-of-line position (in this order). | |||
<lilypond version="2.24"> | <lilypond version="2.24"> | ||
| Line 9: | Line 9: | ||
% Print a bar number every second measure | % Print a bar number every second measure | ||
\set Score.barNumberVisibility = #(every-nth-bar-number-visible 2) | \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2) | ||
c1 | c1 | |||
c1 | c1 | c1 | \break | |||
\override Score.BarNumber.self-alignment-X = #CENTER | c1 | c1 | c1 | \break | ||
c1 | c1 | |||
\override Score.BarNumber.self-alignment-X = | |||
#(break-alignment-list CENTER RIGHT CENTER) | |||
c1 | c1 | c1 | \break | |||
c1 | c1 | c1 | | |||
} | |||
\paper { | |||
line-width = 70\mm | |||
} | } | ||
</lilypond> | </lilypond> | ||
Latest revision as of 06:22, 8 December 2025
The default alignment of bar numbers depends on its position: at the beginning of a staff, bar numbers are right-aligned; at all other positions, they are left-aligned. Using Scheme function break-alignment-list, this can be changed; the three arguments of this function are the alignment for end-of-line, middle-of-line, and start-of-line position (in this order).
\version "2.24"
\relative c' {
\set Score.currentBarNumber = 111
\override Score.BarNumber.break-visibility = #all-visible
% 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 | c1 | \break
c1 | c1 | c1 | \break
\override Score.BarNumber.self-alignment-X =
#(break-alignment-list CENTER RIGHT CENTER)
c1 | c1 | c1 | \break
c1 | c1 | c1 |
}
\paper {
line-width = 70\mm
}