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'' }
```

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to