I answered my own question: create an invisible context with remove-layer =
3. For anyone curious:

\version "2.24.0"

\layout {
  \context {
    \name "NullStaff"
    \type "Engraver_group"
    \consists Axis_group_engraver
    \override VerticalAxisGroup.staff-affinity = #DOWN
  }
  \context {
    \Score
    \accepts NullStaff
  }
  \context {
    \StaffGroup
    \consists Keep_alive_together_engraver
  }
}

restsAlive = #'(stem-interface
                note-head-interface
                rest-interface
                )

I = {
  \tag #'individual \unset Staff.keepAliveInterfaces
  e'1
  \break
  \tag #'individual \set Staff.keepAliveInterfaces = #'()
  e'1
  \break
  R1^"show rests in the combined staff for normal systems"
  \tag #'combined \set Staff.keepAliveInterfaces = #'()
  % When rests are set to "worth living" don't put these changes on the
system break
  % This is due to a bug when an MMR is before or after the break
  R1
  \break
  R1
  \break
  R1
  \tag #'combined \set Staff.keepAliveInterfaces = \restsAlive
  R1
}

II = {
  c'1
  c'1
  R1
  R1*2
  R1*2
}

<<
  \new Staff { g'1 g'1 g'1 g'1 g'1^"hide the combined staff for crowded
systems" g'1 g'1 }
  \new StaffGroup <<
    \new NullStaff \with {
      \override VerticalAxisGroup.remove-layer = 3
    } { s1*5 }
     \new Staff = "1+2" \with {
       instrumentName = "1 2"
       shortInstrumentName = "1 2"
       \override VerticalAxisGroup.remove-empty = ##t
       \override VerticalAxisGroup.remove-first = ##t
       \override VerticalAxisGroup.remove-layer = 2
       keepAliveInterfaces = \restsAlive
     } \removeWithTag #'individual << \partCombine \I \II >>
     \new Staff = "1" \with {
       instrumentName = "1"
       shortInstrumentName = "1"
       \override VerticalAxisGroup.remove-empty = ##t
       \override VerticalAxisGroup.remove-first = ##t
       \override VerticalAxisGroup.remove-layer = 1
       keepAliveInterfaces = #'()
     } \removeWithTag #'combined \I
     \new Staff = "2" \with {
       instrumentName = "2"
       shortInstrumentName = "2"
       \override VerticalAxisGroup.remove-empty = ##t
       \override VerticalAxisGroup.remove-first = ##t
       \override VerticalAxisGroup.remove-layer = 1
       keepAliveInterfaces = #'()
     } \removeWithTag #'combined \II
   >>
 \new Staff { \clef bass c1 c1 c1 c1 c1 c1 c1 }
>>

On Sun, Jan 8, 2023 at 5:13 PM Saul Tobin <saul.james.to...@gmail.com>
wrote:

> Hi all,
>
> When condensing staves using remove-layer as described here
> https://lilypond.org/doc/v2.24/Documentation/notation/modifying-single-staves#hiding-staves,
> what is the best way to temporarily hide the combined staff as well as the
> individual staves? E.g. for a particularly crowded system where both
> players have rests.
>
> Thanks for your help,
>
> Saul
>

Reply via email to