Re: Variables and Bookpart

2023-03-12 Thread Werner LEMBERG

> use:
> 
> ```
> % movement1.ly
> variable = \relative c'' { ... }
> bookpartI = \bookpart { \score { \variable } }
> 
> % movement2.ly
> variableII = \relative c'' { ... }
> bookpartII = \bookpart { \score { \variableII } }
> 
> % main.ly
> \include "movement1.ly"
> \include "movement2.ly"
> \book {
>   \bookpart { \bookpartI }
>   \bookpart { \bookpartII }
> }
> ```

https://gitlab.com/lilypond/lilypond/-/merge_requests/1868


Werner


RE: Variables and Bookpart

2023-03-12 Thread Mark Stephen Mrotek
Jean,

 

Shall follow you explicit structure printed at the bottom. 

Please consider including it in the Learning Manual.

Thank you is inadequate for your efforts.

 

Mark

 

 

From: Jean Abou Samra [mailto:j...@abou-samra.fr] 
Sent: Sunday, March 12, 2023 5:10 PM
To: Mark Stephen Mrotek ; 'Hans Aikema' 

Cc: 'lilypond-user mailinglist' 
Subject: Re: Variables and Bookpart

 

Le dimanche 12 mars 2023 à 16:54 -0700, Mark Stephen Mrotek a écrit :

Hans,
 
Thank you for your advice.
That format is not what is given in the manual.
 
\bookpart {
  \header { … }
  \score { … }
}.

I find this fascinating, because the user who asked this question on -user-fr 
yesterday also thought the documentation was wrong. But it's not! Or I haven't 
seen a proof yet.

There is nothing contradicting the reality in the structure sketch you wrote 
above. You just have to understand that lilypon makes a distinction between 
assignments, which don't have a value but execute an action, and values. The 
"..." in this code are placeholders for values, not for other things. Does it 
surprise you that you cannot write

music = \relative c'' {
  var = { c d e }
  \var \var
}

but instead must write

var = { c d e }
 
music = \relative c'' {
  \var \var
}

?

If not, I'm not exactly sure why it is surprising to you, although I see that 
it's not surprising just to you, that

\bookpart {
  var = { c' }
  \score { \var }
}

does not work, but

var = { c' }
\bookpart {
  \score { \var }
}

does.

An what is the advantage of being able to code separate files (for individual 
movements) if the variables for each must be copied into the book part?

Instead of

% movement1.ly
variable = \relative c'' { ... }
\bookpart { \score { \variable } }
 
% movement2.ly
variableII = \relative c'' { ... }
\bookpart { \score { \variableII } }
 
% main.ly
% \book { % whoops, does not work
\include "movement1.ly"
\include "movement2.ly"
% }

use:

% movement1.ly
variable = \relative c'' { ... }
bookpartI = \bookpart { \score { \variable } }
 
% movement2.ly
variableII = \relative c'' { ... }
bookpartII = \bookpart { \score { \variableII } }
 
% main.ly
\include "movement1.ly"
\include "movement2.ly"
\book {
  \bookpart { \bookpartI }
  \bookpart { \bookpartII }
}


Re: Variables and Bookpart

2023-03-12 Thread Saul Tobin
That really only addresses the full score, not the parts, since in the
parts multiple movements share the same bookpart.

On Sun, Mar 12, 2023 at 5:19 PM Jean Abou Samra  wrote:

> Le dimanche 12 mars 2023 à 17:06 -0700, Saul Tobin a écrit :
>
> For what it's worth my use case was that I use the same variable names for
> each instrument in a separate file for each movement of a piece. I
> therefore need to \include the music for each movement immediately before
> the \score for that movement, in order to redefine the variables with the
> music for that movement. For the full score, that doesn't require
> \parserDefine because each movement can be its own \bookpart. However, for
> printing parts, I find it helpful to have all instruments output in the
> same \book, with each instrument as a \bookpart. That means that I need to
> be able to redefine the music variables within a \bookpart.
> If I were willing to use different variable names for instruments in each
> movement this wouldn't be needed, but I just find that ugly. I want my
> violinI to always be called violinI. There might be other ways to
> accomplish a similar goal but this has worked fine for me.
>
> Why not just save the bookparts into variables as you create them and
> later assemble them in a book? (See also my reply to Mark.)
>


RE: Variables and Bookpart

2023-03-12 Thread Mark Stephen Mrotek
Valentin,

Thank you for your input.
Note that my knowledge of programming and programming language does not exceed 
what I learned In FORTRAN as the foreign language requirement of my Master's 
degree.
My question then is, what file structure is used by others to combine multiple 
movements into one "book" without having to retype something that is already in 
each movement?

Your efforts on my behave are greatly appreciated.

Mark

-Original Message-
From: Valentin Petzel [mailto:valen...@petzel.at] 
Sent: Sunday, March 12, 2023 4:25 PM
To: Mark Stephen Mrotek ; lilypond-user@gnu.org; Hans 
Aikema 
Cc: j...@abou-samra.fr
Subject: Re: Variables and Bookpart

If I’m thinking correctly what Mark attempts to do is to have multiple files 
containing scores and then to

\bookpart {
  \include ...
}

to combine these scores. The problem here is quite simple: The notation

name = value

is something that is evalutated by the parser and will generally evaluate 
differently depending on which context this is used in. Only on top level this 
will be valuated to "define a music macro". In the context of an output def 
such as \paper of \layout and in \header this is interpreted as "set this 
particular property". In other cases this will only be allowed in conjuction 
with the reserved keywords \override and \set.

Anyway the point is that the parser will not allow you to do this kind of 
syntax if you are not at toplevel.

But that does not mean you cannot set such values, it just means you cannot use 
this syntax for it. By directly setting the scheme binding we can still do
this:

\bookpart {
  #(define ArightOne #{ \relative c'' { c b a b } #})
  \score { \ArightOne }
}

(by the way this also allows us to define bindings the parser does not handle 
well such as e.g. \c: c = ... will not be allowed, as c is a note name, but 
#(define c ...) works).

Cheers,
Valentin

Am Sonntag, 12. März 2023, 23:51:28 CET schrieb Hans Aikema:
> > On 12 Mar 2023, at 20:38, Mark Stephen Mrotek 
> > wrote:
> > 
> > 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
> 
> […]
> 
> Mark,
> 
> Based on your response I think you did not get the nuances of what 
> Jean tried to tell you.
> 
> The copying/pasting of your working score INSIDE \bookpart means that 
> you are copying your variable definition (which is already properly 
> outside the
> \score) INSIDE the \bookpart, while it should be outside both the 
> \bookpart and the \score
> 
> So you should
> 
> {copy variables to here}
> \bookpart {
>   {copy rest of the score here}
> }
> 
> When using copy/paste of your score into a file with a \bookpart
> 
> 
> HTH
> Hans





Re: Variables and Bookpart

2023-03-12 Thread Jean Abou Samra
Le dimanche 12 mars 2023 à 17:06 -0700, Saul Tobin a écrit :
> For what it's worth my use case was that I use the same variable names for 
> each instrument in a separate file for each movement of a piece. I therefore 
> need to \include the music for each movement immediately before the \score 
> for that movement, in order to redefine the variables with the music for that 
> movement. For the full score, that doesn't require \parserDefine because each 
> movement can be its own \bookpart. However, for printing parts, I find it 
> helpful to have all instruments output in the same \book, with each 
> instrument as a \bookpart. That means that I need to be able to redefine the 
> music variables within a \bookpart.  
> If I were willing to use different variable names for instruments in each 
> movement this wouldn't be needed, but I just find that ugly. I want my 
> violinI to always be called violinI. There might be other ways to accomplish 
> a similar goal but this has worked fine for me.

Why not just save the bookparts into variables as you create them and later 
assemble them in a book? (See also my reply to Mark.)


signature.asc
Description: This is a digitally signed message part


Re: Variables and Bookpart

2023-03-12 Thread Jean Abou Samra
Le dimanche 12 mars 2023 à 16:54 -0700, Mark Stephen Mrotek a écrit :
> Hans,  
>    
> Thank you for your advice.  
> That format is not what is given in the manual.  
>    
> \bookpart {  
>   \header { … }  
>   \score { … }  
> }.  

I find this fascinating, because the user who asked this question on -user-fr 
yesterday also thought the documentation was wrong. But it's not! Or I haven't 
seen a proof yet.

There is nothing contradicting the reality in the structure sketch you wrote 
above. You just have to understand that lilypon makes a distinction between 
assignments, which don't have a value but execute an action, and values. The 
"..." in this code are placeholders for values, not for other things. Does it 
surprise you that you cannot write

```
music = \relative c'' {
  var = { c d e }
  \var \var
}
```

but instead must write

```
var = { c d e }

music = \relative c'' {
  \var \var
}
```

? 

If not, I'm not exactly sure why it is surprising to you, although I see that 
it's not surprising just to you, that

```
\bookpart {
  var = { c' }
  \score { \var }
}
```

does not work, but

```
var = { c' }
\bookpart {
  \score { \var }
}
```

does.

> An what is the advantage of being able to code separate files (for individual 
> movements) if the variables for each must be copied into the book part?  

Instead of

```
% movement1.ly
variable = \relative c'' { ... }
\bookpart { \score { \variable } }

% movement2.ly
variableII = \relative c'' { ... }
\bookpart { \score { \variableII } }

% main.ly
% \book { % whoops, does not work
\include "movement1.ly"
\include "movement2.ly"
% }
```

use:

```
% movement1.ly
variable = \relative c'' { ... }
bookpartI = \bookpart { \score { \variable } }

% movement2.ly
variableII = \relative c'' { ... }
bookpartII = \bookpart { \score { \variableII } }

% main.ly
\include "movement1.ly"
\include "movement2.ly"
\book {
  \bookpart { \bookpartI }
  \bookpart { \bookpartII }
}
```



signature.asc
Description: This is a digitally signed message part


Re: Variables and Bookpart

2023-03-12 Thread Saul Tobin
For what it's worth my use case was that I use the same variable names for
each instrument in a separate file for each movement of a piece. I
therefore need to \include the music for each movement immediately before
the \score for that movement, in order to redefine the variables with the
music for that movement. For the full score, that doesn't require
\parserDefine because each movement can be its own \bookpart. However, for
printing parts, I find it helpful to have all instruments output in the
same \book, with each instrument as a \bookpart. That means that I need to
be able to redefine the music variables within a \bookpart.

If I were willing to use different variable names for instruments in each
movement this wouldn't be needed, but I just find that ugly. I want my
violinI to always be called violinI. There might be other ways to
accomplish a similar goal but this has worked fine for me.

On Sun, Mar 12, 2023 at 4:45 PM Jean Abou Samra  wrote:

> Le dimanche 12 mars 2023 à 16:34 -0700, Saul Tobin a écrit :
>
> A slightly nicer syntax to workaround this limitation is to use the
> function:
> parserDefine =
> #(define-void-function (name val)(symbol? scheme?)
> (ly:parser-define! name val))
>
> Then instead of var = { ... } you can write \parserDefine var { ... }.
>
> I believe this was posted on the list a few years ago.
>
> Yes. However, if you end up finding this useful, I consider it likely that
> it indicates you should refactor your code. Off the top, I can't even think
> of a case where this is the best way to proceed.
>


RE: Variables and Bookpart

2023-03-12 Thread Mark Stephen Mrotek
Hans,

 

Thank you for your advice.

That format is not what is given in the manual.

 

\bookpart {

  \header { … }

  \score { … }

}.

 

An what is the advantage of being able to code separate files (for individual 
movements) if the variables for each must be copied into the book part?

If in the future I wanted to change anything in an individual movement I would 
need to compile all of the bookparts. 

The only option, that I can see, is to not use variables and insert all pitches 
within \score.

 

Your guidance is appreciated.

 

M

 

From: Hans Aikema [mailto:hans.aik...@aikebah.net] 
Sent: Sunday, March 12, 2023 3:51 PM
To: Mark Stephen Mrotek 
Cc: lilypond-user mailinglist 
Subject: Re: Variables and Bookpart

 





On 12 Mar 2023, at 20:38, Mark Stephen Mrotek mailto:carsonm...@ca.rr.com> > wrote:

 

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

[…]

 

Mark,

 

Based on your response I think you did not get the nuances of what Jean tried 
to tell you.

 

The copying/pasting of your working score INSIDE \bookpart means that you are 
copying your variable definition (which is already properly outside the \score) 
INSIDE the \bookpart, while it should be outside both the \bookpart and the 
\score

 

So you should 

 

{copy variables to here}

\bookpart {

{copy rest of the score here}

}

 

When using copy/paste of your score into a file with a \bookpart

 

 

HTH

Hans

\version "2.22.2"


  ArightOne = \relative c'' {c1}
  ArightTwo = \relative c'' {c,1}
  AleftOne = \relative c' {c1}
  AleftTwo = \relative c' {c,1}
  
  \score {
  \new PianoStaff
  <<
\new Staff = "right" << \ArightOne \\ \ArightTwo >>
\new Staff = "left" { \clef bass << \AleftOne \\ \AleftTwo >> }
  >>
}
  
  
  
  
  
  
  
  
  
\version "2.22.2"

\bookpart {
  ArightOne = \relative c'' {c'1}
  ArightTwo = \relative c'' {c,1}
  AleftOne = \relative c' {c'1}
  AleftTwo = \relative c' {c,1}
  
  \score {
  \new PianoStaff
  <<
\new Staff = "right" << \ArightOne \\ \ArightTwo >>
\new Staff = "left" { \clef bass << \AleftOne \\ \AleftTwo >> }
  >>
}
  
  
  
  
  
  
  
  
  
}

Re: Variables and Bookpart

2023-03-12 Thread Jean Abou Samra
Le dimanche 12 mars 2023 à 16:34 -0700, Saul Tobin a écrit :
> A slightly nicer syntax to workaround this limitation is to use the function: 
>  
> parserDefine =  
> #(define-void-function (name val)(symbol? scheme?)  
>     (ly:parser-define! name val))
> 
> Then instead of var = { ... } you can write \parserDefine var { ... }.
> 
> I believe this was posted on the list a few years ago.

Yes. However, if you end up finding this useful, I consider it likely that it 
indicates you should refactor your code. Off the top, I can't even think of a 
case where this is the best way to proceed.


signature.asc
Description: This is a digitally signed message part


Re: Variables and Bookpart

2023-03-12 Thread Jean Abou Samra
Le lundi 13 mars 2023 à 00:24 +0100, Valentin Petzel a écrit :
> (by the way this also allows us to define bindings the parser does not handle 
>  
> well such as e.g. \c: c = ... will not be allowed, as c is a note name, but  
> #(define c ...) works).

You can write

```
"c" = ...
```

though.


signature.asc
Description: This is a digitally signed message part


Re: Variables and Bookpart

2023-03-12 Thread Saul Tobin
A slightly nicer syntax to workaround this limitation is to use the
function:

parserDefine =
#(define-void-function (name val)(symbol? scheme?)
(ly:parser-define! name val))

Then instead of var = { ... } you can write \parserDefine var { ... }.

I believe this was posted on the list a few years ago.

On Sun, Mar 12, 2023 at 4:26 PM Valentin Petzel  wrote:

> If I’m thinking correctly what Mark attempts to do is to have multiple
> files
> containing scores and then to
>
> \bookpart {
>   \include ...
> }
>
> to combine these scores. The problem here is quite simple: The notation
>
> name = value
>
> is something that is evalutated by the parser and will generally evaluate
> differently depending on which context this is used in. Only on top level
> this
> will be valuated to "define a music macro". In the context of an output
> def
> such as \paper of \layout and in \header this is interpreted as "set this
> particular property". In other cases this will only be allowed in
> conjuction
> with the reserved keywords \override and \set.
>
> Anyway the point is that the parser will not allow you to do this kind of
> syntax if you are not at toplevel.
>
> But that does not mean you cannot set such values, it just means you
> cannot
> use this syntax for it. By directly setting the scheme binding we can
> still do
> this:
>
> \bookpart {
>   #(define ArightOne #{ \relative c'' { c b a b } #})
>   \score { \ArightOne }
> }
>
> (by the way this also allows us to define bindings the parser does not
> handle
> well such as e.g. \c: c = ... will not be allowed, as c is a note name,
> but
> #(define c ...) works).
>
> Cheers,
> Valentin
>
> Am Sonntag, 12. März 2023, 23:51:28 CET schrieb Hans Aikema:
> > > On 12 Mar 2023, at 20:38, Mark Stephen Mrotek 
> > > wrote:
> > >
> > > 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
> >
> > […]
> >
> > Mark,
> >
> > Based on your response I think you did not get the nuances of what Jean
> > tried to tell you.
> >
> > The copying/pasting of your working score INSIDE \bookpart means that you
> > are copying your variable definition (which is already properly outside
> the
> > \score) INSIDE the \bookpart, while it should be outside both the
> \bookpart
> > and the \score
> >
> > So you should
> >
> > {copy variables to here}
> > \bookpart {
> >   {copy rest of the score here}
> > }
> >
> > When using copy/paste of your score into a file with a \bookpart
> >
> >
> > HTH
> > Hans
>
>


Re: Variables and Bookpart

2023-03-12 Thread Valentin Petzel
If I’m thinking correctly what Mark attempts to do is to have multiple files 
containing scores and then to

\bookpart {
  \include ...
}

to combine these scores. The problem here is quite simple: The notation

name = value

is something that is evalutated by the parser and will generally evaluate 
differently depending on which context this is used in. Only on top level this 
will be valuated to "define a music macro". In the context of an output def 
such as \paper of \layout and in \header this is interpreted as "set this 
particular property". In other cases this will only be allowed in conjuction 
with the reserved keywords \override and \set.

Anyway the point is that the parser will not allow you to do this kind of 
syntax if you are not at toplevel.

But that does not mean you cannot set such values, it just means you cannot 
use this syntax for it. By directly setting the scheme binding we can still do 
this:

\bookpart {
  #(define ArightOne #{ \relative c'' { c b a b } #})
  \score { \ArightOne }
}

(by the way this also allows us to define bindings the parser does not handle 
well such as e.g. \c: c = ... will not be allowed, as c is a note name, but 
#(define c ...) works).

Cheers,
Valentin

Am Sonntag, 12. März 2023, 23:51:28 CET schrieb Hans Aikema:
> > On 12 Mar 2023, at 20:38, Mark Stephen Mrotek 
> > wrote:
> > 
> > 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
> 
> […]
> 
> Mark,
> 
> Based on your response I think you did not get the nuances of what Jean
> tried to tell you.
> 
> The copying/pasting of your working score INSIDE \bookpart means that you
> are copying your variable definition (which is already properly outside the
> \score) INSIDE the \bookpart, while it should be outside both the \bookpart
> and the \score
> 
> So you should
> 
> {copy variables to here}
> \bookpart {
>   {copy rest of the score here}
> }
> 
> When using copy/paste of your score into a file with a \bookpart
> 
> 
> HTH
> Hans



signature.asc
Description: This is a digitally signed message part.


Re: Variables and Bookpart

2023-03-12 Thread Hans Aikema

> On 12 Mar 2023, at 20:38, Mark Stephen Mrotek  wrote:
> 
> 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
[…]

Mark,

Based on your response I think you did not get the nuances of what Jean tried 
to tell you.

The copying/pasting of your working score INSIDE \bookpart means that you are 
copying your variable definition (which is already properly outside the \score) 
INSIDE the \bookpart, while it should be outside both the \bookpart and the 
\score

So you should 

{copy variables to here}
\bookpart {
{copy rest of the score here}
}

When using copy/paste of your score into a file with a \bookpart


HTH
Hans

RE: Variables and Bookpart

2023-03-12 Thread Mark Stephen Mrotek
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:j...@abou-samra.fr] 
Sent: Sunday, March 12, 2023 11:23 AM
To: Mark Stephen Mrotek ; 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.



Re: Variables and Bookpart

2023-03-12 Thread Jean Abou Samra
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.


signature.asc
Description: This is a digitally signed message part


Variables and Bookpart

2023-03-12 Thread Mark Stephen Mrotek
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?

 

Thank you for your kind attention.

 

Mark