Search code examples
lilypond

Connected "[" bar lines with Lilypond


How can I let "["-type bars connect across staves? I couldn't find anything helpful in the docs and in the snippets repo. Here's the MWE that illustrates the problem.

\version "2.19.82"

rightHand = \relative c'' {

  \bar "[|:"
  \repeat volta 4 {
    ees8 g, ees' ees aes, ees' a, f' |
  }
}

leftHand = \relative c {

  \bar "[|:"
  \repeat volta 4 {
    ees8 bes' ees e, b' e f, c' |
  }
}

\score {
  \context PianoStaff <<
    \new Staff = RH {
      \clef treble \rightHand
    }

    \new Staff = LH {
      \clef bass \leftHand
    }
  >>
  \layout {
    \context {
      \Score
      %% Changing the defaults from engraver-init.ly
      startRepeatType = #"[|:"
      endRepeatType = #":|]"
      doubleRepeatType = #":|][|:"
    }
  }
}

PDF output

Thanks in advance!


Solution

  • Unfortunately there seems to be no easy solution to this problem. There is a custom function named repeatBarGroupAlter available at http://lsr.di.unimi.it/LSR/Item?id=991 which does get the job done but it is a bit cumbersome as it requires you to manually set the distance between the 'angle-wings' as well as their offset.

    enter image description here