lilypond-user
[Top][All Lists]
Advanced

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

Re: Help with a 2-argument markup command definition


From: Robert Schmaus
Subject: Re: Help with a 2-argument markup command definition
Date: Sat, 19 Nov 2011 17:37:18 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20111105 Thunderbird/8.0

Am 11/19/11 4:07 PM, schrieb David Kastrup:
Robert Schmaus<address@hidden>  writes:

Hi everyone,

I'm trying to define a 2-argument markup command. the definition below
doesn't work, I get all sorts of errors when I call either
\jcStack{"x"}{"y"}
or
\jcStack "x" "y"
or
\jcStack #"x" #"y"



#(define-markup-command (jcStack layout props jcHi jcLo) (markup? markup?)
     (interpret-markup layout props
       (markup #:smaller jcHi #:larger jcLo )
     )
   )


does anyone know what's my mistake here? and which one of the function
calls above would be the correct ones?

The last variant will likely not start working until a recently proposed
change of mine gets in.  The second variant would be fine, the first
possibly not.

Your mistake simply is that the markup macro accepts a markup, and you
feed it two arguments.  You either need to create a markup-list command
(and let it create a list of two markups), or you create a single
line-markup from the two markups you have.  Or use concat or other ways
of combining the two markups into one.

If you don't want to think about all those intricacies, you can just
side-step the issue of the internals, and use

#(define-markup-command (jcStack layout props jcHi jcLo) (markup? markup?)
     (interpret-markup layout props
       #{ \markup { \smaller $jcHi \larger $jcLo } #}
     )
   )

and then \markup will by itself be smart enough to create a \line-markup
around the given markup list.


Hi David,

thanks for your reply! Yes, I should have thought of the #{ ... #} variant myself ...

however, I still can't get it to work. I've used precisely your proposal above, and I get the following errors:

When I call the command as (\jcRaise is the 1-argument command that works fine):

\markup{\jcRaise{"7"}\jcStack "5" "9" }
I get
Preprocessing graphical objects...ERROR: Wrong number of arguments to #<primitive-procedure ly:text-interface::interpret-markup>


When I call the command as
\markup{\jcRaise{"7"}\jcStack{"5"}{"9"} }
I get
error: syntax error, unexpected '{'
        <c e gis bes dis'>-\markup{\jcRaise{"7"}\jcStack
                                                        {"5"}{"9"} }

Well you already said that this last variant might not work.
but I still don't see the error in the definition. Do you know what's happening?

Best,
Robert




reply via email to

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