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: Jacques Menu Muzhic
Subject: Re: Create a \bookpart in a Scheme function
Date: Wed, 27 Jul 2016 09:47:27 +0200

Hello folks,

I tried to make the use of identifiers easier to follow, « book » being used 
everywhere, with the code below.

Strangely enough, I get two scores after the title page, i.e. three pages 
altogether.
Any hint?

JM


%%%%%%%%
\version "2.19.44"

makeBookpart =
#(define-void-function (theBook)(ly:book?)
   (ly:book-add-bookpart!
    theBook
    #{ \bookpart { \score { \new Staff { d' } } } #}))

#(let* ((myBook
         #{
           \book {
             \bookpart { \markup "This is the title page" }
             %\include "bookpart.ly" inlined below
             \bookpart {
               \score {
                 \new Staff { c' }
               }
             }
           }
         #}))

   #{ \makeBookpart #myBook #}

   (ly:book-process
    myBook
    #{ \paper {} #}  ; non-functional, placeholder
    #{ \layout {} #} ; non-functional, placeholder
    (ly:parser-output-name))
   )
%%%%%%


> Le 26 juil. 2016 à 22:33, Urs Liska <address@hidden> a écrit :
> 
> 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
> 
> 
> _______________________________________________
> 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]