lilypond-user
[Top][All Lists]
Advanced

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

Re: numbers as arguments in define-markup-command


From: Han-Wen Nienhuys
Subject: Re: numbers as arguments in define-markup-command
Date: Fri, 29 Dec 2006 20:26:15 +0100
User-agent: Thunderbird 1.5.0.9 (X11/20061219)

Orm Finnendahl escreveu:
> Hi,
> 
> I try to define a markup for vertical arrows and can't get the
> function to take two numbers as arguments. Using strings as arguments
> or a number and a string works. It seems the last argument to
> define-markup-command has to be a string. Does anybody know why and
> how to make it work with numbers? I'd rather supply the y-offset and
> length of the arrow as a number.
> 
> This doesn't work:
> 
> \version "2.11.2"
> 
> #(define-markup-command (varrow layout props yoff len) (number? number?)
>   (interpret-markup layout props
>    (markup
>     #:line
>     (#:postscript
>      (string-append 
>       "1 1 scale 0.1 setlinewidth 0 "
>       (number->string yoff)
>       " translate 0 0 moveto -0.25 1 lineto 0.25 1 lineto 0 0 lineto 
> closepath fill 0 1 moveto 0 "
>       (number->string len)
>       " rlineto stroke")))))
> 
> {c4^\markup {\varrow #3 #10}}
> 
> lilypond signals an error about the 10 being an unbound variable. I
> don't get this error when supplying the "10" directly as a string:

try 

  #10 } 

iso 

  #10}


-- 

Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen

LilyPond Software Design
 -- Code for Music Notation
http://www.lilypond-design.com





reply via email to

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