In the below example, is there any way to prevent the barline from sticking out over the 1 line staff?

\version "2.24.2"

\new PianoStaff { <<
        \new Staff \with {
                \remove Time_signature_engraver
                \hide Clef
        } {
              \override Staff.StaffSymbol.line-positions = #'(5)
              \stopStaff \override Staff.StaffSymbol.line-count = #1 \startStaff
        \new Staff {
>> }

\layout {
        \context {
              \alterBroken transparent #'(#t) SystemStartBrace

enter image description here

2 Answers 2


To reduce the height of the barline to zero use:
\override Staff.BarLine.bar-extent = #'(0 . 0)

But, if you just apply this to your example you’ll see a gap between the inter-staff barline and the staff line. This is because that upper staff line is not in the middle of the upper staff (it’s at position 5) as you have used:
\override Staff.StaffSymbol.line-positions = #'(5)

I assume this is because you want the upper staff to be further away from lower. Instead, to achieve this you should remove the above line of code, and use an override that sets the staff-staff spacing, such as:
\override Staff.VerticalAxisGroup.staff-staff-spacing.basic-distance = #12

  • The gap you encounter comes from a wrong extent (which is measured relative to the 0 position of the VAG), you should rather set it to #'(5 . 5) to sit at the correct position.
    – Lazy
    Commented Mar 27 at 15:10
  • @Lazy Sure, that’d be the way to go if the single staff line is really supposed to be in position 5. Commented Mar 28 at 6:51
  • I simply intended to explain to you why your solution produces that gap, not to claim that setting the barline to position 5 was the best thing to do :-). Also see my answer to understand why things happen the way they do and how to actually prevent that from happening (rather than just forcing a fixed extent for the bar lines).
    – Lazy
    Commented Mar 28 at 19:21

This is intended behaviour. Lilypond will by default enforce a minimum extent for the bar lines, which matters for e.g. regular one line staves (where you want the bar lines to protrude from the line). This is internally handled by the widened-extent property of the StaffSymbol, which gives the minimum values the extent must have. This is calculated by staff-symbol::calc-widened-extent, which will widen the extent by one staff space in both directions if the bar line is shorter than two staff spaces.

To get the behaviour you want set these limits to infinitely high/low:

\override Staff.StaffSymbol.widened-extent = #'(+inf.0 . -inf.0)

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.