lilypond-user
[Top][All Lists]
Advanced

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

Re: Variables and Bookpart


From: Jean Abou Samra
Subject: Re: Variables and Bookpart
Date: Mon, 13 Mar 2023 01:09:48 +0100
User-agent: Evolution 3.46.4 (3.46.4-1.fc37)

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 }
}

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


reply via email to

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