lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exclude staves from keep-alive-together


From: Jean Abou Samra
Subject: Re: Exclude staves from keep-alive-together
Date: Sun, 21 Nov 2021 13:09:00 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.1

Le 20/11/2021 à 11:54, David Stephen Grant a écrit :
Hi all,

Can individual staves in eg. a StaffGroup with \consists "Keep_alive_together_engraver" be excluded from keep-alive-together?

I'm aware of VerticalAxisGroup.remove-layer which possibly does what I need it to, but this morning I can't wrap my head around it in the attached example.

- Empty staves for player 1, 2a and 3a should only be removed when the whole group is empty (system 3).
But:
- 2b should also be removed on the second system
- 3b should also be removed on both the first and second system.

Thanks!


The rules are somewhat complex. I believe what
you want here is

\layout {
  \context {
    \Staff
    \override VerticalAxisGroup.remove-layer = 0
  }
}

to set a default of 0, and

  \override VerticalAxisGroup.remove-layer = 1

in staves 2b and 3b. Full example:

\version "2.23.4"

\paper {
  indent = 1 \in
  short-indent = 1 \in
}

\layout {
  \context {
    \Staff
    \RemoveAllEmptyStaves
  }
}

music = \repeat unfold 4 { c'1 }
rests = \repeat unfold 4 { R1 }

\layout {
  \context {
    \Staff
    \override VerticalAxisGroup.remove-layer = 0
  }
}

\score {
  <<
    \new Staff \with {
          instrumentName = "0"
          shortInstrumentName = "0"
        } {
          \music \break
          \music \break
          \music
        }
    \new StaffGroup \with {
      \consists "Keep_alive_together_engraver"
    } {
      <<
        \new Staff \with {
          instrumentName = "1"
          shortInstrumentName = "1"
        } {
          \rests
          \rests
        }

        \new StaffGroup \with {
          systemStartDelimiter = #'SystemStartBrace
        } {
          <<
            \new Staff \with {
              instrumentName = "2a"
              shortInstrumentName = "2a"
            }
            {
              \music
              \music
            }
            \new Staff \with {
              instrumentName = "2b"
              shortInstrumentName = "2b"
              \override VerticalAxisGroup.remove-layer = 1
            }
            {
              \music
              \rests
            }
          >>
        }

        \new StaffGroup \with {
          systemStartDelimiter = #'SystemStartBrace
        } {
          <<
            \new Staff \with {
              instrumentName = "3a"
              shortInstrumentName = "3a"
            }
            {
              \rests
              \rests
            }
            \new Staff \with {
              instrumentName = "3b"
              shortInstrumentName = "3b"
              \override VerticalAxisGroup.remove-layer = 1
            }
            {
              \rests
              \rests
            }
          >>
        }
      >>
    }
  >>
}

Best,
Jean



reply via email to

[Prev in Thread] Current Thread [Next in Thread]