Jean Abou Samra,
Thank you.
Yes variables must (and are) placed before the \score in each individual movement. That is why each complies perfectly when done individually.
The error appears when the code for the movement (that compiles) is copied and pasted into the \bookpart.
Your kind attention is appreciated.’
Mark
From: Jean Abou Samra [mailto:jean@abou-samra.fr]
Sent: Sunday, March 12, 2023 11:23 AM
To: Mark Stephen Mrotek <carsonmark@ca.rr.com>; lilypond-user@gnu.org
Subject: Re: Variables and Bookpart
Le dimanche 12 mars 2023 à 11:16 -0700, Mark Stephen Mrotek a écrit :
Hello,
Each movement of a piano piece has a separate file. In each movement the various voices are identified by a variable, e.g., ArightOne, BleftTwo. Each file compiles perfectly individually.
When the file is copied into
\bookpart {
\header {
}
Copied here
}
It does not compile correctly and the error:
syntax error, unexpected SYMBOL
appears repeatedly followed by one of the variable names, e.g. ArightOne = \relative c'' {
What is my error?
Amusingly, the same question was asked on the French-speaking list (lilypond-user-fr) yesterday. (OK, not exact same question since it was about \book
. Still.)
You apparently have assignments inside your \bookpart
, like
\bookpart {
ArightOne = \relative c'' { c }
\score { \ArightOne }
}
which is not valid. Just like you cannot do
\score {
ArightOne = \relative c'' { c }
\ArightOne
}
but need to do
ArightOne = \relative c'' { c }
\score {
\ArightOne
}
you cannot do
\bookpart {
ArightOne = \relative c'' { c }
\score { \ArightOne }
}
but you can do
ArightOne = \relative c'' { c }
\bookpart {
\score { \ArightOne }
}
Syntactically, \bookpart
encloses several elements and those are grouped into a book part. An assignment is not an "element" (it does not have a value), so it cannot be placed inside \bookpart
, but must be outside.