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 12:41:38 +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 12:25, schrieb David Kastrup:
Urs Liska <address@hidden> writes:

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.
The docs are not useful for this.  A sequential music _expression_ like
that generated with #{ #} can't be attached in this manner.  But you
should be able to do

instr=#(define-music-function (parser location instrument) (string?)
	(make-music
	 'TextScriptEvent
	 'direction
	 UP
	 'text
	 (markup #:bold #:italic #:huge instrument)))

Note that this has the upward direction builtin.  If you don't want to
have the direction fixed in advance (you can always override it with
explicit ^ and _ instead of -, however), remove 'direction UP.

How do you arrive there?

Take a look what
\displayMusic { c^\markup { whatever } }
produces and go from there by stripping the layers that don't belong in
your _expression_.

Thank you very much,
that's the solution!

The point is to nest the markup construct within the 'text element.

Best
Urs




reply via email to

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