lilypond-user
[Top][All Lists]
Advanced

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

Re: Basic function question


From: Urs Liska
Subject: Re: Basic function question
Date: Tue, 26 Jul 2011 10:35:00 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110617 Lightning/1.0b2 Thunderbird/3.1.11

Am 26.07.2011 10:27, schrieb address@hidden:
On Jul 26, 2011, at 10:14 AM, Urs Liska wrote:

Hello list members,

after fiddling around too long and getting lost with the basics, I decided to 
ask my question here.
I know it's basic, and I wonder why I get stuck this way, but obviously I'm 
confused and unable to find the right place in the docs.

I want to write a function "instr" to produce formatted markup that I can use 
like

{ c d e f^\instr "Vl." }

which should be translated to (e.g.)

{ c d e f^\markup \bold \italic \huge { "Vl." } }

Unfortunately I seem absolutely unable to find out how to define the function 
so I can attach it to the note like in the example.

Hopefully someone can either give me a working example or point me to the exact 
location in the docs where I can fully understand this issue.

Thanks in advance
Urs
To do this, you need to use a music function.

instr = #(define-music-function (parser location m s) (ly:music? string?)
   (make-music 'EventChord 'elements (append (ly:music-property m 'elements)
                                             (list (make-music 'TextScriptEvent 
'direction 1
                                                                                
 'text (markup #:huge #:bold #:italic s))))))

\instr a4 "foo"

Cheers,
MS
OK, thank you very much.
I think with this example I can work my way through the doc (analyzing a working example is much easier than analyzing error messages ...).

But is it also possible to replace a \markup command with a function as in my example above?

Best
Urs



reply via email to

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