[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: variables for numbers
From: |
Thomas Morley |
Subject: |
Re: variables for numbers |
Date: |
Fri, 11 May 2018 00:01:46 +0200 |
2018-05-10 22:51 GMT+02:00 Flaming Hakama by Elaine <address@hidden>:
>
> On Tue, May 1, 2018 at 11:03 AM, <address@hidden> wrote:
>>
>> Send lilypond-user mailing list submissions to
>> address@hidden
>
>
>
> I'm having difficulty understanding how to use a variable that stores a
> number, for use with a \raise command.
>
>
> I have numerous markup definitions similar to this one:
>
> sottoVoce = <>^\markup \raise #1.3 { \italic "sotto voce" }
> mezzoVoce = <>^\markup \raise #1.3 { \italic "mezzo voce" }
> { \sottoVoce a'1 \mezzoVoce c''1 }
>
> And I'd like to use a variable for the raise value, instead of repeating
> #1.3 for each definnition.
>
>
>
> Here are three MWE's of failed approaches.
>
> % The common sense approach
> raiseDistance = #1.3
> sottoVoce = <>^\markup \raise \raiseDistance { \italic "sotto voce" }
> { \sottoVoce a'1 }
>
>
> % Based on the line-width example on
> http://lilypond.org/doc/v2.19/Documentation/learning/organizing-pieces-with-variables
> %{
> myWidth = 60 % a number to pass to a \paper variable (the unit is
> millimeter)
> Depending on its contents, the variable can be used in different places. The
> following example \paper {
> line-width = \myWidth
> }
> {
> c1
> }
> %}
> raiseDistance = 1.3
> sottoVoce = <>^\markup \raise \raiseDistance { \italic "sotto voce" }
> { \sottoVoce a'1 }
>
>
>
> % Based on
> http://lilypond.org/doc/v2.19/Documentation/extending/lilypond-variables
> %{
> twelve = 12
> twentyFour = #(* 2 twelve)
> %}
> raiseDistance = 1.3
> sottoVoce = <>^\markup \raise #(raiseDistance) { \italic "sotto voce" }
> { \sottoVoce a'1 }
>
>
>
> Does anyone have either a suggestion for how to do this, or the appropriate
> place to RTFM?
>
> The examples on
> http://lilypond.org/doc/v2.19/Documentation/notation/substitution-function-examples
> all are of functions that consume a value. There are no examples of using a
> variable that is a number.
>
>
>
> Thanks,
>
> David Elaine Alt
Markup expects the scheme-representation of arguments, i.e. prepend
the variable with #
A single static variable shouldn't be enclosed into ()
Otherwise the first element would be seen as the operator doing
something with the other elements.
raiseDistance = #1.3
\markup \raise #raiseDistance { \italic "sotto voce" }
\markup \raise 1.3 { \italic "sotto voce" }
doesn't work either.
Cheers,
Harm