On 03/11/2019 12:54, Peter Toye wrote:
Is there a
case for introducing scoped variables into Lilypond?
As I understand it (please correct me if I'm wrong), variables
have to be declared at the top of the document, before any music
_expression_. I'm trying to work on a document with many different
scores, each if which is in its own file. According to what I
gather is best practice I use variables to hold the basic music
text: one variable for each staff. When engraving each
individual score, I need to put its variable declarations at the
head of its file. But when I want to gather them all together
into a book or bookpart, this doesn't work, so each score has to
be edited to remove the definitions.
There are ways to use Lilypond's variable syntax to manage
multi-instrument, multi-movement pieces such as this skeleton for
a two movement string quartet.
\version "2.19.83"
I.Violin.1 = { \clef "treble" b'1 }
I.Violin.2 = { \clef "treble" g' }
I.Viola = { \clef "alto" d' }
I.Cello = { \clef "bass" g1 }
II.Violin.1 = { \clef "treble" c''1 }
II.Violin.2 = { \clef "treble" e' }
II.Viola = { \clef "alto" g' }
II.Cello = { \clef "bass" c1 }
\book {
\bookpart {
\score {
<<
\new Staff { \I.Violin.1 }
\new Staff { \I.Violin.2 }
\new Staff { \I.Viola }
\new Staff { \I.Cello }
>>
}
}
\bookpart {
\score {
<<
\new Staff { \II.Violin.1 }
\new Staff { \II.Violin.2 }
\new Staff { \II.Viola }
\new Staff { \II.Cello }
>>
}
}
}
--
Timothy Lanfear, Bristol, UK.