I have been using this trick to avoid these awkward English numerals...
(/verse.1/ instead of /verseOne/, /verse.2/, etc.)
but never tried this more sophisticated use.
verse.1 = {...} — used as \verse.1
It does create a single variable which refers to a structured Lisp
object (an object with multiple slots), instead of distinct variables,
but for the user, this does not change anything in the syntax itself.
Unfortunately, this feature is very hard to find in the documentation.
It would be nice to give this information in the main page explaining
the syntax of variable names.
Silvain
Le 13.10.25 à 20:33, Timothy Lanfear a écrit :
On 13/10/2025 18:12, YTG1234 wrote:
The trouble is that numbers and punctuation (…all that I've tried)
other than - are not allowed in LilyPond identifier syntax. In my own
projects, I've been using camelCase, - for hierarchy, and Roman
numerals for numbers: stuff like `\movementXVII-tenoreII-lyrics-it'
(not a real example). Roman numerals can get annoying very quickly,
though. So my question:
* Is there some way to express hierarchy other than in variable names?
* Is there some way to express hierarchy and plain Arabic numerals
in variable names, that can be used from LilyPond syntax directly
without relying on $?
You can write this:
\version "2.24.0"
movement.17.tenore.2.lyrics.it = \new Lyrics \lyricsto "v1" { Come si
chia -- ma? }
movement.17.tenore.2.notes = { a'2 4 4 1 }
<<
\new Voice="v1" { \movement.17.tenore.2.notes }
\movement.17.tenore.2.lyrics.it
>>
The full stop characters are not part of the variable name, but
LilyPond syntax that builds a nested structure of Scheme association
lists. I think commas work similarly. The part before the first full
stop must be a legal LilyPond variable name. Some more info in this
thread
https://lists.gnu.org/archive/html/lilypond-user/2019-11/msg00046.html,
especially David Kastrup's comments.
--
Timothy Lanfear, Bristol, UK.
--
Silvain Dupertuis
Route de Lausanne 335
1293 Bellevue (Switzerland)
tél. +41-(0)22-774.20.67
portable +41-(0)79-604.87.52
web: silvain-dupertuis.net <https://www.silvain-dupertuis.net/>