Mark Knoop <[email protected]> writes:
> Is there any way to use a variable in a \markup \override?
That has nothing to do with LilyPond, but rather with Scheme.
> gap = 5
> bskip = #'(baseline-skip . 5)
' means: don't evaluate the following expression. When expressions are
evaluated, lists and symbols are converted into function calls and
variable references, respectively.
An override always consists of a symbol and a value. 5 is a
"self-evaluating constant": there is no difference between '5 and 5 at
all.
>
> \markup {
> \override #bskip % <--- this does work
> %\override #'(baseline-skip . gap) % <--- this does not work
The easiest way is to use a backquoted list here:
\override #`(baseline-skip . ,gap)
When you backquote a list, it is quoted as usual _except_ that any comma
expression inside _does_ get evaluated. Which in this case means
replacing the _symbol_ gap with the value in the _variable_ named gap.
You can also cobble together your (dotted) list manually:
\override #(cons 'baseline-skip gap)
Note that cons is a function for making a "dotted pair". We need to
quote the symbol baseline-skip to keep Scheme from trying to look at the
value of a variable called baseline-skip. We don't quote gap since here
we _do_ want the variable value instead of a symbol gap.
--
David Kastrup
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user