lilypond-user
[Top][All Lists]
Advanced

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

Re: trouble putting \book block in a scheme function


From: Jeff Olson
Subject: Re: trouble putting \book block in a scheme function
Date: Wed, 5 Apr 2023 14:50:39 -0600
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1

On 4/5/2023 2:37 PM, Jean Abou Samra wrote:

Le mercredi 05 avril 2023 à 14:30 -0600, Jeff Olson a écrit :

The conclusion of [1], on how to put nicely cropped png or svg images
into individual files with specified file names, was to wrap each score
in a \book block with an individual \bookOutputName, as shown in that
message.

Since I have 1000+ such scores, each conveniently created by a scheme
function, it should be easy to just add the book wrapper inside that
function.  The first step was beginning like this MWE:

\version "2.24.1"
scr =
#(define-scheme-function (mus) (ly:music?)
     #{
       %\book {
         \score { #mus }
       %}
     #} )
\scr { c'' }

But un-commenting the two lines above generates "error: bad _expression_
type".

Adding -lDEBUG didn't explain more.  Does that error mean \book is
forbidden here?

How can I include a \book wrapper (and \bookOutputName) in my score
function?

Yeah... there are known syntax quirks in that area. This works though:

\version "2.24.1"

scr =
#(define-void-function (mus) (ly:music?)
   (print-book-with-defaults
    #{
      \book {
        \score { #mus }
      }
    #}))

\scr { c'' }
Thanks, Jean!  I never would have guessed.  I'll give it a try.
reply via email to

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