LilyPond Internals Reference: 2.2.8 Bar_number_engraver

### 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.

Properties (read)

> `barNumberVisibility` (procedure)

>   A Procedure that takes an integer and returns whether the corresponding bar number should be printed.

> `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 bar-line-interface.

This engraver creates the following layout object(s):

BarNumber.

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

#### Internals Reference