Am 26.07.2011 12:25, schrieb David Kastrup:
Urs Liska<lilyp...@ursliska.de>  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



_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to