5

I'm using LilyPond and trying to get bar numbers to render on every measure, but when I have lyrics above the staff (which is pretty common in this style of music, which usually uses one staff line per two voices), the bar numbers appear above them which looks completely wrong.

A minimal example of the issue looks like this:

\version "2.25.4"
\pointAndClickOff
\language "english"

tenorPart = \fixed c {
    \set Score.barNumberVisibility = #all-bar-numbers-visible
    \override Score.BarNumber.break-visibility = #end-of-line-invisible
    % \override Score.BarNumber.outside-staff-priority = ##f
    % \override Score.BarNumber.outside-staff-padding = 0
    % \override Score.BarNumber.outside-staff-horizontal-padding = 0
    a'4 b'4 c''4 d''4 | d''4 c''4 b'4 a'4
}
leadPart = \fixed c { r1 }

tenorWords = \lyricmode {
    Some tenor words and some more words
}

\score {
    \new ChoirStaff <<
        \new Staff = "tenorStaff"
        <<
            \context Staff << 
                \mergeDifferentlyDottedOn\mergeDifferentlyHeadedOn
                \context Voice = "tenorPart" {  \voiceOne \tenorPart }
                \context Voice = "leadPart" {  \voiceTwo \leadPart }
                >>
            >>
          \new Lyrics \with { alignAboveContext = #"tenorStaff" }
          \lyricsto "tenorPart" \tenorWords
    >>
}

enter image description here

The closest I've gotten is my messing with the outside-staff properties for the BarNumber (uncommenting those three lines near the top), but this still ends up with an incorrect result

enter image description here

Setting an outside-staff-priority for the LyricText does fix the relative positioning, but the bar numbers still end up in the wrong spot:

enter image description here

Does anyone have any suggestions for how I could resolve this issue? Thanks!

1 Answer 1

5

Simply move the Bar number engraver from Score to the Staff (either in a \layout block for all Staves or a \with block for a single Staff):

\version "2.25.4"
\pointAndClickOff
\language "english"

\layout {
  \context {
    \Score
    \remove Bar_number_engraver
  }
}

tenorPart = \fixed c {
    a'4 b'4 c''4 d''4 | d''4 c''4 b'4 a'4
}
leadPart = \fixed c { r1 }

tenorWords = \lyricmode {
    Some tenor words and some more words
}

\score {
    \new ChoirStaff <<
        \new Staff = "tenorStaff" \with {
          \consists Bar_number_engraver
          barNumberVisibility = #all-bar-numbers-visible
          \override BarNumber.break-visibility = #end-of-line-invisible
        }
        <<
            \context Staff << 
                \mergeDifferentlyDottedOn\mergeDifferentlyHeadedOn
                \context Voice = "tenorPart" {  \voiceOne \tenorPart }
                \context Voice = "leadPart" {  \voiceTwo \leadPart }
                >>
            >>
          \new Lyrics \with { alignAboveContext = #"tenorStaff" }
          \lyricsto "tenorPart" \tenorWords
    >>
}
1
  • Worked like a charm - thank you very much!
    – duck
    Commented Jun 15 at 4:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.