lilypond-user
[Top][All Lists]
Advanced

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

Re: Show TacetStaff when StaffGroup empty


From: Michael Werner
Subject: Re: Show TacetStaff when StaffGroup empty
Date: Mon, 30 Oct 2023 13:27:50 -0400

On Mon, Oct 30, 2023 at 9:57 AM Pierre-Luc Gauthier <p.luc.gauthier@gmail.com> wrote:
Hello there,

Please let this not be a duplicate.

Is there a way for the tacet staff to be shown *only* when all the other staves are empty ? Manual intervention is not a viable option here.

If I understand correctly what you're after, the following seems to do the trick:

\version "2.25.9"

\language "english"

tacet = {
  R1*40
}

musicA = {
  \repeat unfold 28 g'4 |
  \repeat unfold 4 g'4 |
  R1*10
  \repeat unfold 16 f'4 |
}
musicB = {
  R1*4
  \break
  \repeat unfold 16 c'4 |
  \break
  R1*10
  \break
  \repeat unfold 16 d'4 |
}

\new StaffGroup \with { \consists Keep_alive_together_engraver }
<<
  \new Staff \with {
    instrumentName = "Tacet"
    shortInstrumentName = "Tacet"
    \override VerticalAxisGroup.remove-layer = 2
  } \tacet
  \new Staff \with {
    instrumentName = "A"
    shortInstrumentName = "A"
    \RemoveAllEmptyStaves
    \override VerticalAxisGroup.remove-layer = 1
  } \musicA
  \new Staff \with {
    instrumentName = "B"
    shortInstrumentName = "B"
    \RemoveAllEmptyStaves
    \override VerticalAxisGroup.remove-layer = 1
  } \musicB
>>

This is based on http://lilypond.org/doc/v2.25/Documentation/notation/hiding-staves
--
Michael


reply via email to

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