lilypond-user
[Top][All Lists]
Advanced

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

Re: Create a \bookpart in a Scheme function


From: Urs Liska
Subject: Re: Create a \bookpart in a Scheme function
Date: Tue, 26 Jul 2016 22:33:46 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1

Hi Harm,


Am 26.07.2016 um 20:58 schrieb Thomas Morley:
> 2016-07-26 20:03 GMT+02:00 Urs Liska <address@hidden>:
>> Hi all,
>>
>> one more of my recent confusing ideas: I would like to generate a number of
>> \bookpart-s in a Scheme function. The reason is that I have to loop over a
>> number of works and create scores for them that are in a bookpart each.
>>
>> Attached is something that resembles the structure I have in my actual
>> files.
>>
>> I successfully factored out the bookpart to an includable file. With this I
>> can produce multiple scores. However, it would be better to have that
>> factored out to a function because I have to set some values to select which
>> score to create, and this would be more natural to do as function arguments
>> rather than setting global variables and reading that from the code that
>> generates the scores.
>>
>> As the files are they compile finely, but when I uncomment the \makeBookpart
>> call I get
>>
>> /home/uliska/Aktuell/lily/bookpart-in-scheme-function/main.ly:23:9: error:
>> bad expression type
>>
>> \makeBookpart
>>
>> /home/uliska/Aktuell/lily/bookpart-in-scheme-function/main.ly:14:2: error:
>> error in #{ ... #}
>>
>> # (let* errors. Any suggestions how I can make the outer construct handle a
>> bookpart returned from a function? Thanks Urs
>
> Not sure I understood what your aiming, but maybe:
>
> \version "2.19.45"
> makeBookpart =
> #(define-void-function (book)(ly:book?)
>   (ly:book-add-bookpart!
>     book
>     #{ \bookpart { \score { \new Staff { d' } } } #}))
>
> #(let* ((book
>          #{
>            \book {
>              \bookpart { \markup "This will be a title page" }
>              \include "bookpart.ily"
>              \include "bookpart.ily"
>            }
>          #}))
>   #{ \makeBookpart #book #}
>   (ly:book-process
>     book
>     #{ \paper {} #}  ; non-functional, placeholder
>     #{ \layout {} #} ; non-functional, placeholder
>     (ly:parser-output-name)))
>
> HTH,
>   Harm

Yes, at least in the MWE your proposal does exactly what I need. And I
think I will be able to incorporate it perfectly in my original context.

Thanks a lot
Urs




reply via email to

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