On Wed, 2016-02-17 at 10:58 +0100, David Kastrup wrote:

> Graham King <graham.k...@tremagi.org.uk> writes:
> 
> > Thanks Ben, 
> > that will be useful once I've found a solution to the immediate problem:
> > defining and using a variable within \book{} or \bookpart{} or
> > \book[part]{ \score { }}
> >
> >         \version "2.19.35"
> >         \book {
> >           music = \relative { c' d e f }
> >           \score {
> >             \music
> >           }
> >         }
> 
> Shrug.  As I stated already, there is no book-local scope where such
> variables could be defined.  So there is no solution to what you
> identify as your problem.
> 
> > (In case you were suggesting that I use \bookpart{} within
> > book-titling.ily, I've tried that too and it throws a lot of
> > "unrecognised string" errors.)
> 
> The problem with the repeated use of "I've tried that" is that nobody
> can really guess just _what_ exactly you have tried with what error
> messages as the result.  And nobody can try reproducing or debugging or
> diagnosing the problem since there is no code to work with.
> 

David,
my apologies.  You've underestimated my ignorance: I didn't realise that
"The \book block does not really have a scope of its own..." implied
that there is no solution.  I'm sorry to have cost you your time and
frustration.

For what it's worth, here is how I now understand my error:

          music = \relative { c' d e f }
          \score {
            \music
          }

works just fine.  When the Learning Manual (at section 3.1.1) says: "If
you haven't explicitly added [a \book block], LilyPond wraps your entire
input code in a \book block implicitly." it does _not_ mean that the
above code is equivalent to:

          \book {
            music = \relative { c' d e f }
            \score {
             \music
            }
          }

but rather:

          music = \relative { c' d e f }
          \book {
            \score {
              \music
            }
          }

So, for my immediate problem, I'll bite the bullet and create a
namespace in which I can define all 12 instances of the various
variables involved, and put the definitions outside the \book { ... }.
If that doesn't work, I'll just stitch some PDF's together without
further troubling the list.


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

Reply via email to