lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bar numbers every nth bar *and* at beginning of line


From: Jean Abou Samra
Subject: Re: Bar numbers every nth bar *and* at beginning of line
Date: Wed, 25 May 2022 19:48:04 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1

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

[Prev in Thread] Current Thread [Next in Thread]