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,