lilypond-user
[Top][All Lists]
Advanced

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

Re: Strings as variable names


From: Johan Vromans
Subject: Re: Strings as variable names
Date: Mon, 28 Dec 2015 20:28:58 +0100

On Mon, 28 Dec 2015 18:49:30 +0100
David Kastrup <address@hidden> wrote:

> > I have always been frustrated by the fact that I can't (or thought I
> > couldn't) use underscores in variable names,  
> 
> Well, that is hopefully more or less documented though probably not
> everywhere.

NR refers to
http://www.lilypond.org/doc/v2.19/Documentation/learning/organizing-pieces-with-variables
which does not mention the quoted syntax, and explicitly disallows dashes
and underscores.

=== Suggested replacement text ===

The name of a variable must consist of alphabetic characters, underscores
and dashes. Underscores and dashes must always follow and be followed by an
alphabetic character. Also, the name of a variable may not be one of
LilyPond's predefined keywords.

These are valid variable names:

pieceIV
myMusic
alternate-one
big_loud_part

Examples of invalid names:

piece4 (numbers not allowed)
-my-Music (leading dash)
alternate--one (more than one consecutive dash)
example_ (ends with underscore)

A variable name may be enclosed in double quotes, e.g. "pieceIV" is
the same as pieceIV. When using quotes, the name may consist of any
sequence of characters. For example "My New Music Piece 14²" is a valid
variable but there is no quote-less way to refer to it.

"My New Music Piece 14²" = \new Staff {
  \relative {
    a'4 b c b
  }
}

{
  <<
    \"My New Music Piece 14²"
  >>
}

=== end of suggestion ===

> But really, \"violin1" is so much more ugly than \violinI or if you must
> \violin_I.

Let's consider this a matter of taste...

BTW, you can use unicode characters including numerals ☺ .

bella_melódia-① = { ... }

-- Johan
   http://johan.vromans.org/seasons_greetings.html




reply via email to

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