On Tue, 1 Dec 2020 at 04:08, Matthew Fong <[email protected]> wrote:
>
> Hello everyone,
>
> I have multiple scores in my LilyPond file, and I was wondering if there
is a programmatic way to selectively hide and show scores based on
variables, or would this have to be done at the note and lyrics level?
>
>
> Many thanks,
> mattfong

Hi Matthew,

I used something like the attached file for a big eight-movement work…

Cheers,
Vaughan
\version "2.20.0"

compileTheseMovements = "12" % try "1" or "2" instead

FirstMovementScore = \score {
  { c' d' e' f' }
}

SecondMovementScore = \score {
  { \clef bass f e d c }
}

CompleteFirstMovement = \bookpart {
  \tocItem "First Movement"
  \header {
    title = "Multi-Movement Piece"
    subtitle = "First Movement"
  }

  \score {
    \FirstMovementScore
    \layout {}
    \midi {}
  }
}


CompleteSecondMovement = \bookpart {
  \tocItem "Second Movement"
  \header {
    title = ##f
    subtitle = "Second Movement"
  }

  \score {
    \SecondMovementScore
    \layout {}
    \midi {}
  }

}

\book {
  %%{
  \markuplist \table-of-contents
  \pageBreak
  %}
  \bookpart {
    $(if
      (string-contains compileTheseMovements "1")
      CompleteFirstMovement
      EmptyBookpart)
  }

  \bookpart {
    $(if
      (string-contains compileTheseMovements "2")
      CompleteSecondMovement
      EmptyBookpart)
  }
} % \book

Reply via email to