lilypond-user
[Top][All Lists]
Advanced

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

Re: Paper variables in scheme function


From: Simon Albrecht
Subject: Re: Paper variables in scheme function
Date: Fri, 28 Mar 2014 23:52:26 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.3.0


Am 28.03.2014 20:44, schrieb David Kastrup:
Simon Albrecht <address@hidden> writes:

Hello,

I'm just creating a style sheet and want to create a scheme function
which sets the paper margins. However it seems the paper variables
aren't bound and I don't know why. A simple example would be:

\version "2.19.3"


test =

#(define-scheme-function (parser location num) (number?)

#{ \paper {

top-margin = #(* num paper-height)

}

#}

)


\test 0.1


{ c'1 }



Help is very much appreciated :-)
It is a scoping problem: the scope of # inside of #{ ... #} is that of
the embedding.  Try something like

test =
#(define-scheme-function (parser location num) (number?)
   #{ \paper { top-margin
                  $(* num (module-ref (current-module) 'paper-height)) } #})

\paper { \test 0.9 }


{ c'1 }


I am somewhat irritated that a plain

\test 0.9

does not work just as well.  I thought I had done something to make that
work at one point of time, but apparently not so.

Attached you find the resulting function with a test score; the 'portrait version now works perfectly, only I can’t get the 'landscape version to work as well (but I don’t need it for current work).

All the best,
Simon

Attachment: test.ly
Description: Text Data


reply via email to

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