lilypond-user
[Top][All Lists]
Advanced

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

Re: Storing a bookpart in a variable


From: Jan-Peter Voigt
Subject: Re: Storing a bookpart in a variable
Date: Thu, 25 Feb 2016 11:50:25 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

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
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user





reply via email to

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