Hi Freeman,

Am 04.05.20 um 16:02 schrieb Freeman Gilmore:
The first one below works fine but the second does not work when the
dollar is replaced with \markup \vcenter \huge \bold "$".   Please
explain why?    Why is \markup bound in the first and not in the
second.    I see \markup used in many places like to the second
example that works, what is the difference?

The # in \override Accidental.before-line-breaking = #... enters Scheme-mode, so to speak. You may reference LilyPond variables (your first version), but \markup ... is LilyPond syntax which cannot be used in Scheme mode. (Rule of thumb: No \anything inside of #...)

(You see the difference even in the way you reference your dollar variable: In LilyPond mode, you'd have to write \dollar, but in Scheme mode, it's just dollar.)

Solution: Either construct your markup in Scheme mode, or use the wonderful #{ #} way of switching back to LilyPond mode. I'm not sure if the latter is available in 2.18.2 (which should be considered outdated by now!), since I lost track of when which syntax simplification was added (probably by David K.), but you can try:

(ly:grob-set-property! grob 'text #{ \markup \vcenter \huge \with-color #darkgreen \bold 
"$" #})

If it doesn't work, or if you insist on writing everything in Scheme, you can find out what to write by using your dollar variable

dollar = \markup \vcenter \huge \bold "$"

and asking LilyPond what it looks like in Scheme:

#(display-scheme-music dollar)

which displays

(markup #:vcenter (#:huge (#:bold "$")))

Hence, you may write

(ly:grob-set-property! grob 'text (markup #:vcenter (#:huge (#:bold "$"))))

Best
Lukas

Reply via email to