On Wed, 15 Nov 2023 at 12:09, Ken Ledeen <kled...@nevo.com> wrote:

> Hi All,
>
> From time to time I would like to include / exclude portions of the total
> score. For now, in the crudest of ways, I just comment out the parts I
> don't want (%{ ..... %}).  That works, of course, but I was wondering if
> there was a more elegant way.
>
> Ideally I would have some variable that I set to boolean #t or #f to
> indicate what I want included.  Then, instead of the  %{ .... %} if would
> be something like
>
> if includeFlag {   ...       }
>
> Then I wouldn't have to search around for where I'd included the comment
> start and end brackets.
>
> I found the scheme if function but it didn't seem like an option.
>
> Many thanks in advance.
>
>
> Ken Ledeen
>
> Mobile:   617-817-3183
>
> www.nevo.com
> www.bitsbook.com
> tiny.cc/KenLedeen <https://kledeen.wixsite.com/kenledeen/>
>

Hi Ken,

For big projects I use something like this. You change a string set at the
top of the file, and it compiles the movements you ask for. My Requiem was
in 7 movements. It was fiddly to set up, but once that was done, it was
easy to just work on one movement.

Cheers,
Vaughan

%%%%%%
\version "2.24.0"

compileTheseMovements = "12" % can be "1", "2", or "12"

EmptyBookpart = {}

FirstMovementBP = \bookpart {
  \score {
    { c'1^"1st movement" }
    \layout {}
  }
}


SecondMovementBP = \bookpart {
  \score {
    { d'1^"2nd movement" }
    \layout {}
  }
}

\book {

  \bookpart {
    $(if
      (string-contains compileTheseMovements "1")
      FirstMovementBP
      EmptyBookpart)
  }

  \bookpart {
    $(if
      (string-contains compileTheseMovements "2")
      SecondMovementBP
      EmptyBookpart)
  }
}

%%%%%

Cheers,
Vaughan

Reply via email to