lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: music-functions: #$var1 or just $var1 ?


From: Nicolas Sceaux
Subject: Re: music-functions: #$var1 or just $var1 ?
Date: Sun, 25 Apr 2010 08:56:14 +0200

Le 25 avr. 2010 à 08:13, Mark Polesky a écrit :

> In both:
>  Notation 5.6.1 "Substitution function syntax", and
>  Extending 2.1.2 "Simple substitution functions",
> 
> it says that variables inside the music block part of a
> music-function definition should be referenced using the
> hash-cash notation (#$), but this clearly doesn't work in
> several significant cases:
> 
>  \tempo \markup { \bold #$tempotext }
>  #$note
> 
> In fact, I did an experiment where I took every example from
> these sections, removing the # from every #$, and all the
> examples still compiled fine.  Are there any cases where the
> #$ is actually needed?  Also, for cases where both #$ and $
> work, is there any reason that omitting the # would be bad
> practice or something?  Any additional insights would be
> appreciated too.

Inside the #{ ... #} construct, you have to you #$variable
where a scheme token is required, but you use $variable where
\variable could be used.  Behind the scence, $variable is
actually replaced by something like \tmpvar before being parsed.

In your example, in regular LilyPond notation, you can write:
   tempotext = "blablah"
and then later use this variable:
   \tempo \markup \bold \tempotext

So you can write:
   #{ \tempo \markup \bold $tempotext #}

The same way:
   music = { c' d' e' }
   { a b \music f' g' }

So you write:
   #{ a b $music f' g' #}

The question to answer when in doubt is: can I use a backslashed
variable here?

Nicolas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]