Le 25/05/2022 à 19:21, Simon Bailey a écrit :
Hi everyone,

I can print bar numbers every n (let's say 5) bars using:

\set Score.barNumberVisibility = #(every-nth-bar-number-visible 5)

However, I'd like to have my cake and eat it and *also* have bar numbers printed at the beginning of every line, regardless of whether it's a multiple of 5. So in the attached screenshot, the first line should have 28 at the beginning, and the second line should have 36. the bar numbers at 30, 35, 40 should also be printed.

Does anyone know any magic words to make that happen?



As practically everything, you could program it in Scheme.
There's a cheaper solution though:

\version "2.22.2"

regularBarNumbers = \with {
  \consists Bar_number_engraver
  barNumberVisibility = #(every-nth-bar-number-visible 5)
  \override BarNumber.break-visibility = #center-visible
}

<<
  \new Staff \with \regularBarNumbers \repeat unfold 50 { c'1 }
  \repeat unfold 50 { c'1 }
>>


The idea is that the Bar_number_engraver gets duplicated,
in Score and and in the top Staff. The Score prints a
bar number at the beginning of every line, as usual.
The Staff prints a bar number every 5th measure, but
only in the middle of a line, so that it won't duplicate
the number typeset by the Score if it happens to be at
the beginning of the line.


Best,
Jean



Reply via email to