2.2.8 Bar_number_engraver

A bar number is created whenever measurePosition is zero and when there is a bar line (i.e., when whichBar is set). It is put on top of all staves, and appears only at the left side of the staff. The staves are taken from stavesFound, which is maintained by Staff_collecting_engraver.

Music types accepted:

alternative-event

Properties (read)

alternativeNumberingStyle (symbol)

The style of an alternative’s bar numbers. Can be numbers for going back to the same number or numbers-with-letters for going back to the same number with letter suffixes. No setting will not go back in measure-number time.

barNumberFormatter (procedure)

A procedure that takes a bar number, measure position, and alternative number and returns a markup of the bar number to print.

barNumberVisibility (procedure)

A procedure that takes a bar number and a measure position and returns whether the corresponding bar number should be printed. Note that the actual print-out of bar numbers is controlled with the break-visibility property.

The following procedures are predefined:

all-bar-numbers-visible

Enable bar numbers for all bars, including the first one and broken bars (which get bar numbers in parentheses).

first-bar-number-invisible

Enable bar numbers for all bars (including broken bars) except the first one. If the first bar is broken, it doesn’t get a bar number either.

first-bar-number-invisible-save-broken-bars

Enable bar numbers for all bars (including broken bars) except the first one. A broken first bar gets a bar number.

first-bar-number-invisible-and-no-parenthesized-bar-numbers

Enable bar numbers for all bars except the first bar and broken bars. This is the default.

(every-nth-bar-number-visible n)

Assuming n is value 2, for example, this enables bar numbers for bars 2, 4, 6, etc.

(modulo-bar-number-visible n m)

If bar numbers 1, 4, 7, etc., should be enabled, n (the modulo) must be set to 3 and m (the division remainder) to 1.

currentBarNumber (integer)

Contains the current barnumber. This property is incremented at every bar line.

stavesFound (list of grobs)

A list of all staff-symbols found.

whichBar (string)

This property is read to determine what type of bar line to create.

Example:

\set Staff.whichBar = ".|:"

This will create a start-repeat bar in this staff only. Valid values are described in ‘scm/bar-line.scm’.

Properties (write)

currentBarNumber (integer)

Contains the current barnumber. This property is incremented at every bar line.

This engraver creates the following layout object(s):

BarNumber.

Bar_number_engraver is part of the following context(s): Score.


Internals Reference v2.18.2 (stable-branch).