Re: How to define a every-nth-bar-number-visible-except-first procedure?
Thomas Morley <[email protected]> Sat, 27 Jun 2026 13:07:17 +0200
| Newsgroups | gmane.comp.gnu.lilypond.general |
|---|---|
| Message-ID | <CABsfGyVNGUAXqwkhOyAb331dG79rXSse5QXY6SKk8Vg_Zoq+og@mail.gmail.com> |
Am Sa., 27. Juni 2026 um 12:50 Uhr schrieb Richard Shann <[email protected]>: > > When typesetting music where line breaks are allowed at half bars the > every-nth-bar-number-visible set to 1 and the break-visibility set to > #begin-of-line-visible gives the bar numbers at the start of each line > with the bar number in parenthesis if the line starts half way through > the bar. This is good, but has the unfortunate consequence that it > prints the bar number 1 at the start of the music. > Can someone suggest how to avoid that? I can see that it would be > possible to augment translations-functions.scm file in the Lily sources > to include something like > > (define-public ((every-nth-bar-number-visible-except-first n) barnum > mp) > (and (> n 0) (= 0 (modulo barnum n)))) > > but I can't figure out how to do this from a LilyPond score. > > Here's a MWE that shows the problem > > \version "2.24" > > \layout {\context {\Score > barNumberVisibility = #(every-nth-bar-number-visible 1) > \override Score.BarNumber.break-visibility = #begin-of-line-visible }} > { > \repeat unfold 200 {c''d'' \bar "" e'' f'' } > } > > Richard Shann > > > Below works here: #(define-public ((every-nth-bar-number-visible-except-first n) barnum mp) (and (> barnum 1) (= 0 (modulo barnum n)))) \layout { \context { \Score barNumberVisibility = #(every-nth-bar-number-visible-except-first 1) } } { \repeat unfold 200 { c''d'' \bar "" e'' f'' } } Cheers, Harm