"Evan O'Dorney" <emo916m...@gmail.com> writes:

> Works great! I assume that one must manually change the name of the upper
> staff from "S" to "S1" enough measures in advance to show up correctly.

Well, no.  In that case one would use the remove-layer thingy.
Admittedly it's sort of wasteful to set the whole upper staff twice,
only distinguished by a different instrument name, and throw the version
with the incorrect instrument name away.

Let me see whether I can recook the example.

\version "2.18.2"

hideMusic = { \set Staff.keepAliveInterfaces = #'() }
showMusic =   \unset Staff.keepAliveInterfaces

\score {
  \new Score \with {
    \consists "Keep_alive_together_engraver"
  }
   <<
     \new Staff = "s" \with {
       instrumentName = "S"
       shortInstrumentName = "S"
       \override VerticalAxisGroup.remove-layer = 2
     }
     \relative g' {
       \repeat unfold 30 { g2 } a1
     }
     \new Staff = "s1" \with {
       instrumentName = "S1"
       shortInstrumentName = "S1"
       \override VerticalAxisGroup.remove-layer = 1
       \hideMusic % no independent existence
     }
     \relative g' {
       \repeat unfold 30 { g2 } a1
     }
     \new Staff = "s2" \with {
       instrumentName = "S2"
       shortInstrumentName = "S2"
       \override VerticalAxisGroup.remove-layer = 1
     }
     \relative g' {
       %% The second staff may be hidden
       \hideMusic
       \repeat unfold 30 { g2 }
       %% The second staff must be shown
       \showMusic
       f1
     }
   >>
   \layout {
      \context {
         \Staff
         \RemoveEmptyStaves
         % Remove the first staff
         \override VerticalAxisGroup.remove-first = ##t
      }
   }
}

-- 
David Kastrup
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to