lilypond-user
[Top][All Lists]
Advanced

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

Re: Book and variables -- lost how to remedy


From: Federico Bruni
Subject: Re: Book and variables -- lost how to remedy
Date: Fri, 11 Nov 2016 15:28:08 +0100

Il giorno ven 11 nov 2016 alle 14:40, Federico Bruni <address@hidden> ha scritto:
Il giorno ven 11 nov 2016 alle 13:50, Bernhard Kleine <address@hidden> ha scritto:
I have for the sake a MWE a main file and a included file. When this
file was compiled alone with a header and language it compiled well.
Now, given I want to get a book with several songs, I encounter errors
since the variables disturb the compilation.

The files are attached. Please let me know how to change the input that
correct compilation occurs.

Hi Bernard

2test.ly file contains a variable which is defined after it's called. This cannot work, because lilypond parses the file from top to bottom, IIUC.

If you want to compile a single piece independently from a book (collection of pieces), the best approach is probably using a .ily file for music definitions and variables. Basic example:

% File score1.ily
% The point here is: just define variables, do not print anything.
global = {
 ...
}
ScoreOneMusic = \score {
 \global
 ...
 \layout {}
}

The other point that I should have highlighted is: you must use different variable names in each score, otherwise the latest definition will override the previous ones. So instead of "global" you should rather use e.g. "ScoreOneGlobal".



% File score1.ly
\include "score1.ily"
\ScoreOneMusic


% File book.ly
\include "score1.ily"
\include "score2.ily"

\book {
 \bookpart {
   \ScoreOneMusic
 }
 \bookpart {
   \ScoreTwoMusic
 }
}




_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user




reply via email to

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