SOLVED

Hello again,

Given that \unset Staff.keepAliveInterfaces would affect the entire
StaffGroup, instead of trying to break out from that limitation, I moved
the Keep_alive_together_engraver to those two internal, mini-StaffGroups,
along with the \partCombine staves.

The final score structure looks like this:

\version "2.25.9"
>
> \layout {
>     short-indent = #20
>     indent = #30
>     \context {
>         \Staff
>         keepAliveInterfaces = #'()
>     }
> }
>
> violinI = {
>     \key c \minor
>     \repeat unfold 26 { d'4 }
>     \once \unset Staff.keepAliveInterfaces
>     <d' bes'>2
>     \repeat unfold 40 { d'4 }
> }
>
> violinII = {
>     \key c \minor
>     \repeat unfold 26 { g4 }
>     <g d'>2
>     \repeat unfold 40 { g4 }
> }
>
> celloI = {
>     \clef "bass"
>     \key c \minor
>     \repeat unfold 56 { bes,4 }
>     \once \unset Staff.keepAliveInterfaces
>     <d bes>2
>     \repeat unfold 10 { bes,4 }
> }
>
> celloII = {
>     \clef "bass"
>     \key c \minor
>     \repeat unfold 56 { g,4 }
>     <g, d>2
>     \repeat unfold 10 { g,4 }
> }
>
> \new StaffGroup <<
>     \new StaffGroup \with {
>         systemStartDelimiter = #'SystemStartSquare
>         \consists "Keep_alive_together_engraver"
>     }
>     <<
>         \new Staff \with {
>             instrumentName = "Violins"
>             shortInstrumentName = "Vn I & II"
>             %\override VerticalAxisGroup.remove-layer = 2
>         } { <>^"remove-layer = 2" \transpose c c \partCombine \violinI
> \violinII }
>         \new Staff \with {
>             instrumentName = "Violin I"
>             shortInstrumentName = "Vn I"
>             \RemoveAllEmptyStaves
>             %\override VerticalAxisGroup.remove-layer = 1
>         } { <>^"remove-layer = 1" \transpose c c \violinI }
>         \new Staff \with {
>             instrumentName = "Violin II"
>             shortInstrumentName = "Vn II"
>             \RemoveAllEmptyStaves
>             %\override VerticalAxisGroup.remove-layer = 1
>         } { <>^"remove-layer = 1" \transpose c c \violinII }
>     >>
>     \new StaffGroup \with {
>         systemStartDelimiter = #'SystemStartSquare
>         \consists "Keep_alive_together_engraver"
>     }
>     <<
>         \new Staff \with {
>             instrumentName = "Violoncellos"
>             shortInstrumentName = "Vc I & II"
>             %\override VerticalAxisGroup.remove-layer = 2
>         } { <>^"remove-layer = 2" \partCombine \celloI \celloII }
>         \new Staff \with {
>             instrumentName = "Violoncello I"
>             shortInstrumentName = "Vc I"
>             \RemoveAllEmptyStaves
>             %\override VerticalAxisGroup.remove-layer = 1
>         } { <>^"remove-layer = 1" \celloI }
>         \new Staff \with {
>             instrumentName = "Violoncello II"
>             shortInstrumentName = "Vc II"
>             \RemoveAllEmptyStaves
>             %\override VerticalAxisGroup.remove-layer = 1
>         } { <>^"remove-layer = 1" \celloII }
>     >>
> >>
>

 Uncomment the \override VerticalAxisGroup.remove-layer lines and then it
works perfectly.

I hope this solution will be helpful to others.


On Fri, 10 Nov 2023 at 14:43, Adam M. Griggs <adammgri...@gmail.com> wrote:

> Hello list,
>
> https://lilypond.org/doc/v2.25/Documentation/notation/hiding-staves
>
> Is there a way I can get more control over the workings of
> the Keep_alive_together_engraver for the purpose of engraving divisi staves?
>
> Please consider the following, based on the linked example in the
> documentation:
>
> \version "2.25.9"
>>
>> \layout {
>>     short-indent = #20
>>     indent = #30
>>     \context {
>>         \Staff
>>         keepAliveInterfaces = #'()
>>     }
>> }
>>
>> violinI = {
>>     \key c \minor
>>     \repeat unfold 30 { d'4 }
>>     \unset Staff.keepAliveInterfaces
>>     <d' bes'>2
>>     \repeat unfold 48 { d'4 }
>> }
>>
>> violinII = {
>>     \key c \minor
>>     \repeat unfold 30 { g4 }
>>     <g d'>2
>>     \repeat unfold 28 { g4 }
>>     <> ^\markup \center-column { "unwanted" "violin div. " }
>>     \repeat unfold 20 { g4 }
>> }
>>
>> celloI = {
>>     \clef "bass"
>>     \key c \minor
>>     \repeat unfold 60 { bes,4 }
>>     \once \unset Staff.keepAliveInterfaces
>>     <d bes>2
>>     \repeat unfold 18 { bes,4 }
>> }
>>
>> celloII = {
>>     \clef "bass"
>>     \key c \minor
>>     \repeat unfold 28 { g,4 }
>>     <> ^\markup \center-column { "unwanted" "cello div. " }
>>     \repeat unfold 32 { g,4 }
>>     <g, d>2
>>     \repeat unfold 18 { g,4 }
>> }
>>
>> \new StaffGroup \with { \consists Keep_alive_together_engraver } <<
>>     \new Staff \with {
>>         instrumentName = "Violins"
>>         shortInstrumentName = "Vn I & II"
>>         \override VerticalAxisGroup.remove-layer = 2
>>     } { \transpose c c \partCombine \violinI \violinII }
>>     \new StaffGroup \with {
>>         systemStartDelimiter = #'SystemStartSquare
>>     }
>>     <<
>>         \new Staff \with {
>>             instrumentName = "Violin I"
>>             shortInstrumentName = "Vn I"
>>             \RemoveAllEmptyStaves
>>             \override VerticalAxisGroup.remove-layer = 1
>>         } { \transpose c c \violinI }
>>         \new Staff \with {
>>             instrumentName = "Violin II"
>>             shortInstrumentName = "Vn II"
>>             \RemoveAllEmptyStaves
>>             \override VerticalAxisGroup.remove-layer = 1
>>         } { \transpose c c \violinII }
>>     >>
>>     \new Staff \with {
>>         instrumentName = "Violoncellos"
>>         shortInstrumentName = "Vc I & II"
>>         \override VerticalAxisGroup.remove-layer = 2
>>     } { \partCombine \celloI \celloII }
>>     \new StaffGroup \with {
>>         systemStartDelimiter = #'SystemStartSquare
>>     }
>>     <<
>>         \new Staff \with {
>>             instrumentName = "Violoncello I"
>>             shortInstrumentName = "Vc I"
>>             \RemoveAllEmptyStaves
>>             \override VerticalAxisGroup.remove-layer = 1
>>         } { \celloI }
>>         \new Staff \with {
>>             instrumentName = "Violoncello II"
>>             shortInstrumentName = "Vc II"
>>             \RemoveAllEmptyStaves
>>             \override VerticalAxisGroup.remove-layer = 1
>>         } { \celloII }
>>     >>
>> >>
>>
>
> Is there a way I can divisi selected staves rather than the entire
> StaffGroup?
>
> Thank you.
>
>

Reply via email to