|
From: | Lukas-Fabian Moser |
Subject: | Re: Unbound variable: \markup |
Date: | Mon, 4 May 2020 16:40:20 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
Hi Freeman,
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
[Prev in Thread] | Current Thread | [Next in Thread] |