| [ << Input structure ] | [Top][Contents][Index] | [ Titles and headers >> ] |
| [ < Structure of a score ] | [ Up: Input structure ] | [ Multiple output files from one input file > ] |
20.2 Multiple scores in a book ¶
A document may contain multiple pieces of music and text. Examples
of these are an etude book, or an orchestral part with multiple
movements. Each movement is entered with a \score block,
\score {
...music...
}
and texts are entered with a \markup block,
\markup {
...text...
}
All the movements and texts which appear in the same .ly file will normally be typeset in the form of a single output file.
\score {
...
}
\markup {
...
}
\score {
...
}
One important exception is within lilypond-book documents,
where you explicitly have to add a \book block, otherwise only
the first \score or \markup will appear in the output.
The header for each piece of music can be put inside the \score
block. The piece name from the header will be printed before
each movement. The title for the entire book can be put inside the
\book, but if it is not present, the \header which is at
the top of the file is inserted.
\header {
title = "Eight miniatures"
composer = "Igor Stravinsky"
}
\score {
\header { piece = "Romanze" }
...
}
\markup {
...text of second verse...
}
\markup {
...text of third verse...
}
\score {
\header { piece = "Menuetto" }
...
}
Pieces of music may be grouped into book parts using \bookpart
blocks. Book parts are separated by a page break, and can start with a
title, like the book itself, by specifying a \header block.
\bookpart {
\header {
title = "Book title"
subtitle = "First part"
}
\score { ... }
...
}
\bookpart {
\header {
subtitle = "Second part"
}
\score { ... }
...
}
Variables defined within a \book or \bookpart block
are local to that book or bookpart; books and bookparts have their
own ‘scope’. In contrast, a \score does not accept
assignments and has no scope of its own.
If you want to use multiple files to set up your music with variables that should be ‘local’ to single files, this can be done with the following structure:
% movement1.ly
bookpartI = \bookpart {
variable = { ... }
\score { ... use \variable ... }
}
% movement2.ly
bookpartII = \bookpart {
variable = { ... }
\score { ... use \variable ... }
}
% main.ly
\include "movement1.ly"
\include "movement2.ly"
\book {
\bookpart { \bookpartI }
\bookpart { \bookpartII }
}
The values of variable in both bookparts are not related to
one another. You cannot reference the variables outside of the
book or bookpart that they are defined in.
\layout, \paper, and \midi blocks at the
outer level of a \book or \bookpart establish local
defaults for scores at that level, similar to how this happens at
the top level of a document.
| [Top][Contents][Index] |