Lukas-Fabian Moser <l...@gmx.de> writes: > 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.),
I may be mistaken, but I think it was the comparatively vaguely described and actually rather small commit commit d8ee829c73452cc35ef17c6c22abf5b47c754c15 Author: David Kastrup <d...@gnu.org> Date: Sat Aug 27 22:23:44 2011 +0200 Make #{ #} accept everything an assignment accepts. This also makes #{ #} return a void music event, and does not create sequential music if not necessary. which would correspond to version 2.15.9 . So it's comparatively old news. > 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 "$")))) Personally, I'd just recommend to go with #{ ... #} here. -- David Kastrup