lilypond-user
[Top][All Lists]
Advanced

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

automatically populating \header from top-level variables?


From: Graham Percival
Subject: automatically populating \header from top-level variables?
Date: Fri, 29 Jul 2016 13:07:51 -0700
User-agent: Mutt/1.5.23 (2014-03-12)

I'm preparing a few books of my compositions, and looking for the
best way to organize my files.  For example, one such book
consists of 5 pieces for 3 cellos.  I have:
- 5 "music data" files
- 20 "print instrument \bookpart" files ((1 score + 3 cellos) * 5
  pieces)
- 4 "top-level" files which combine the relevant "print
  instrument \bookpart" files into \books.

I have a working system (below), but I'm wondering if I can
simplify it.  In particular, I'd like to avoid repeating the
  \bookpart {
    \header { ... }
material in every "print instrument" file.

Essentially, I'm hoping that it's possible to say "any time you
see a \bookpart, set its \header{} values to these
currently-defined variables, then clear those variables and
continue parsing".  So far all my attempts along those lines
result in definitions intended for the second piece being used for
the first piece as well.

Cheers,
- Graham


\version "2.18.2"

%%% music-op-1-1.ly
title = "title 1 in C"
opus = "Op 1, no. 1"
piece = "This is a short performance note."
music = <<
  \tag #'score \tag #'one { e'4 }
  \tag #'score \tag #'two { c'4 }
>>

%%% print-score-op-1-1.ly
\bookpart {
  \header {
    title = \title
    opus = \opus
    piece = \piece
  }
  \score { \keepWithTag #'score \music }
}

%%% music-op-1-2.ly
title = "title 2 in D"
opus = "Op 1, no. 2"
piece = ""
music = <<
  \tag #'score \tag #'one { f'4 }
  \tag #'score \tag #'two { d'4 }
>>

%%% print-score-op-1-2.ly
\bookpart {
  \header {
    title = \title
    opus = \opus
    piece = \piece
  }
  \score { \keepWithTag #'score \music }
}




reply via email to

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