Jump to content

SemiChoirStaff is a ChoirStaff with SpanBars for non-special bar lines

From LilyPond wiki

If you wish to typeset |. and friends as connected in a ChoirStaff while ordinary bar lines stay unconnected, you can add the Span_bar_engraver and instruct it to omit the |-style bars.

In this example a new context, SemiChoirStaff, is created to achieve this.

\version "2.24"

mus = {
  \clef F
  c4 d e f | c d e f \bar "||"
  c4 d e f | c d e f \bar "|."
}

\layout {
  \context {
    \ChoirStaff
    \name "SemiChoirStaff"
    \consists "Span_bar_engraver"
    \override SpanBar.stencil =
      #(lambda (grob)
        (if (string=? (ly:grob-property grob 'glyph-name) "|")
            (set! (ly:grob-property grob 'glyph-name) ""))
        (ly:span-bar::print grob))
  }
  \context {
    \Score
    \accepts SemiChoirStaff
  }
}

\score {
  \new SemiChoirStaff {
    <<
      \new Staff \mus
      \new Staff \mus
    >>
  }
}