I have a case where I'm trying to use tags to either show or not show the Staff line.

Here is a MWE.  The first line in the screen shot shows the desired results when staff is to be printed.

The next desired results should look the same except that only chords and lyrics are to be shown (don't blame me - that's what they want the rhythm guys).

So my though was to use tag for the staff notes.  And then use NullVoice to align the lyrics when the staff is not to be shown.

But I'm having trouble getting the right syntax.

-------------

\version "2.24.2"

chorusChords = \chordmode { c1 c c c \break }

chorusLeadNotes = \relative c' {
  c1 c
  <<
    { c2 c c c } \\
    { \teeny a2 a a a  }
  >>
}

chorusLeadLyrics = \lyricmode { test test test test }

chorusHarmonyNotes = \relative c' { a'1 a s1 s1 }

chorusHarmonyLyrics = \lyricmode { ooh ooh }

chorusScoreA = <<
  \new ChordNames { \chorusChords }
  \new Staff { \voiceOne \chorusLeadNotes }
  \addlyrics { \chorusLeadLyrics }
  \new Staff { \voiceTwo \chorusHarmonyNotes }
  \addlyrics { \chorusHarmonyLyrics }
>>

chorusScoreB = <<
  \new ChordNames { \chorusChords }
  \tag #'theNotes { \new Staff { \voiceOne \chorusLeadNotes } }
  \new NullVoice = "testa" { \chorusLeadNotes }
  \new Lyrics \lyricsto "testa" { \chorusLeadLyrics }
  \tag #'theNotes { \new Staff { \voiceTwo \chorusHarmonyNotes } }
  \new NullVoice = "testb" { \chorusHarmonyNotes }
  \new Lyrics \lyricsto "testb" { \chorusHarmonyLyrics }
>>

theLayout = \layout {
  \context {
    \Score
    \accepts NullVoice
  }
}
\book {
  \score {
    \theLayout
    {
      { \chorusScoreA }
      \keepWithTag  #'(theNotes) { \chorusScoreB }
      \removeWithTag  #'(theNotes) { \chorusScoreB }
    }
  }
}

Reply via email to