lilypond-user
[Top][All Lists]
Advanced

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

Re: Compile twice with different includes


From: Jan-Peter Voigt
Subject: Re: Compile twice with different includes
Date: Fri, 15 Feb 2013 12:18:07 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130106 Thunderbird/17.0.2

Am 15.02.2013 11:40, schrieb Urs Liska:
After a few test I have one further question.

I managed to tweak your functions to my needs (i.e. make it _less_ generic, because I need it for a specific purpose).

Attached you'll find my version of the function with example.
I created a function that only takes the \book as its argument, then processes it twice, assigning different first pages each. While this actually does what I want I would like to make the input structure still more simple by passing the \score instead of the \book to the function.

What I'm actually doing is:
mybook = \book {
   \include "file-containing-score-block.ily"
}

\writeBookOddEven #mybook
which is somewhat redundant.

What I would like to write is:
\writeBookOddEven \include "file-containing-score-block.ily"
this will only work, if you have *only* one score block in this file and nothing else ... I would think its somewhat dangerous ;)
(or - slightly more generic:
\writeBookOddEven
   \score {
     ...
   }
You can create an adhoc-book in scheme with a #{-#} construct:

writeScoreOddEven =

#(define-void-function (parser location score)

(ly:score?)

(let ((book #{ \book { \score { $score } } #}))

; process with first-number 1

...

Now you have a book object to process. Of course you can also build a book in pure scheme (*ly:make-book*/paper header scores/), but you don't need to.

HTH

Best Jan-Peter

Probably my problem is really tiny, but I can't find the solution because the documentation of the ly:... functions isn't really helpful. If I change the passed parameter from ly:book? to ly:score? then I don't know how to access the implicit \book object inside the function. I assume that I should use ly:book-add-score! to add the score object passed into the function to the book. But I don't know how to access this book object (i.e. what to write instead of book-smob in *"ly:book-add-score!*/book-smob score")
/

Attached is my attempt (writeScoreOddEven.ly) with comments on where I assume changes to be done.
Help is highly appreciated.

Best
Urs






reply via email to

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