This is a well-known problem and you can find several alternative work-arounds in the manual, see https://lilypond.org/doc/v2.24/Documentation/notation/setting-the-staff-size

   /Mats

On 2024-07-11 22:09, Tom Brennan wrote:
Hi all

When using `\magnifyStaff #2/3`, I'm seeing weird transitions between the staves of a `StaffGroup`. For example, 

```
\version "2.24.3"

music = \relative c'' {
    \repeat unfold 10 { c4 d e f } \bar "||" c d e f \bar "|."
}

% Weird transition between I and II -- I "wins"
\bookpart {
    \new StaffGroup {
        <<
            \tag #'a-normal {
                \new Staff \with {
                    instrumentName = "Inst I"
                    shortInstrumentName = "I"
                    \RemoveEmptyStaves
                } { \music }
            }
            \tag #'b-small {
                \new Staff \with {
                    instrumentName = "Inst II"
                    shortInstrumentName = "II"
                    \magnifyStaff #2/3
                    \RemoveEmptyStaves
                } { \music }
            }
        >>
    }
}
```

which produces this:

image.png

You can see the staff size transition -- the top one "wins" in the sense that its larger barlines are longer. If you flip the magnification from the bottom to the top, then the smaller lines "win" and they are longer instead, meaning that the staff on top seems to always be the one chosen to dictate the barline vertical span.

It looks like you can get the barlines to be consistent by using the following workaround in a staff `\with` block:

```
fontSize = #-3
\override StaffSymbol.staff-space = #(magstep -3)
```

But I figure this (basically a constant cue staff) probably isn't a great use for a StaffGroup, though. If you look at this Mozart example the StaffGroup is grouping two staves of the same size, whereas in this Ravel example, where it looks like a cello part of a duo/duet because the violin is smaller, the staves aren't grouped. I think the Ravel example is probably what I'm looking for, but when you do this kind of thing, where there are exactly the same number of bars in each staff, the final barline incorrectly leaves room at the end of the staff:

```
\version "2.24.3"

music = \relative c'' {
    \repeat unfold 10 { c4 d e f } \bar "||" c d e f \bar "|."
}

% No `StaffGroup` -- right padding/margin on small staff should not be there
\bookpart {
    <<
        {
            \new Staff \with {
                instrumentName = "Inst I"
                shortInstrumentName = "I"
                \magnifyStaff #2/3
                \RemoveEmptyStaves
            } { \music }
        }
        {
            \new Staff \with {
                instrumentName = "Inst II"
                shortInstrumentName = "II"
                \RemoveEmptyStaves
            } { \music }
        }
    >>
}
```

which gives you this:

image.png

As you can see, there's a little bit of margin/padding on the right of the final barline of the small staff. It could be fixed by using the `StaffSymbol.staff-space` and `fontsize` workaround, but I think it probably looks better to have these scaled-down barlines. The only issue is that I think this last one needs to be positioned at the end of the staff, small or not, like it is in the Ravel example above.

The question is, is this a bug or expected behavior? Is there a workaround to get that barline to snap to the end?

Thanks
Tom

Reply via email to