Hi Vaughan,

you have to wrap the scheme-expression in another \bookpart{} statement and use "instant" scheme expressions with a '$'-sign for this to work:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
...

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

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

HTH


Am 25.02.2016 um 00:48 schrieb Vaughan McAlley:
Greetings,

I’d like to be able to specify at the top of my main score which
movements are printed. I can store a \bookpart in a variable, but I
can’t seem to return it from a scheme expression. Is there a bookpart
equivalent to define-music-function that I haven’t found?

Vaughan


%%%%%%%%%%%%%%%%%%
\version "2.18.2"

compileTheseMovements = "2" % change to "12" to compile both movements

EmptyBookpart = \bookpart {}

FirstMovement = \bookpart {
    \tocItem "First Movement"
    \header {
       title = "Multi-movement piece"
       composer = "LvB"
       subtitle = "First Movement"
    }

    \score {
       { \time 2/4 r8 g' [ g' g'] es'2 }
       \layout {}
       \midi {}
    }

}

SecondMovement = \bookpart {
    \tocItem "Second Movement"
    \header {
       title = ##f
       subtitle = "Second Movement"
    }
    \score {
       { \time 3/8 \partial 8 es16. as32 c'8 c'16. bes32 as16. c'32 f4 }
       \layout {}
       \midi {}
    }
}

\book {
    #(if
      (string-contains compileTheseMovements "1")
      FirstMovement
      EmptyBookpart)

    #(if
      (string-contains compileTheseMovements "2")
      SecondMovement
      EmptyBookpart)

%{
    % This works fine
    \FirstMovement
    \SecondMovement
%}

} % \book
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

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



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

Reply via email to