On 30 Oct 2023, at 02:04, Evan Driscoll <eva...@gmail.com> wrote:


On Sun, Oct 29, 2023 at 2:08 AM Werner LEMBERG <w...@gnu.org> wrote:
Look up the documentation of `Keep_alive_together_engraver`, which
explains how to make LilyPond split such divisi parts automatically.

https://lilypond.org/doc/v2.24/Documentation/notation/modifying-single-staves#hiding-staves

Thanks. I've been playing around with this, but I still am not sure how to make it work -- I've tried a few things, and it's not removing the empty staves. I'm attaching my current attempt below:


IIUC what you're looking for is use of \RemoveAllEmptyStaves
without using "\consists Keep_alive_together_engraver", as you appear to want the Cello I staff to disappear when it contains rests only (rather than making it disappear only when Cello I and Cello II share a section of rests-only music.

 Keep_alive_together_engraver is meant to keep an entire set of staffs (despite the \RemoveAllEmptyStaves) as long as at least one of them is not rests only.

\score {
  \new StaffGroup \with { \consists Keep_alive_together_engraver } <<
  \new Staff \with {
    instrumentName = "Cello I"
    \RemoveAllEmptyStaves
    %\override VerticalAxisGroup.remove-layer = 1
  } \celloI
  \new Staff \with {
    instrumentName = "Cello II"
    \RemoveAllEmptyStaves
    %\override VerticalAxisGroup.remove-layer = 1
  } \celloII
>>

Ensures that either both Cello staves are on display or both are hidden as the are part of a staffgroup with the keep alive together engraver

\score {
  \new StaffGroup <<
  \new Staff \with {
    instrumentName = "Cello I"
    \RemoveAllEmptyStaves
    %\override VerticalAxisGroup.remove-layer = 1
  } \celloI
  \new Staff \with {
    instrumentName = "Cello II"
    \RemoveAllEmptyStaves
    %\override VerticalAxisGroup.remove-layer = 1
  } \celloII
>>

Should hide Cello I when it has rests only on a staff-line, leaving only Cello II

Reply via email to