lilypond-user
[Top][All Lists]
Advanced

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

Re: Hiding a staff with notes in it


From: David Kastrup
Subject: Re: Hiding a staff with notes in it
Date: Sat, 20 Aug 2016 12:15:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

"Evan O'Dorney" <address@hidden> 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

reply via email to

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