That worked beautifully. The follow-up question:

Because of the long time it naturally takes to render many scores, when I'm
working on the initial files, I run the individual scores as separate files
to be included in the main file once I'm done. Naturally, I would want to
define the scheme functions in the main file, so that it doesn't reset with
each score. However, if I need to edit an individual score, I won't get
very far because the functions/variables won't be defined without the main
file.

So...is there a command that would allow me to include a file only once (so
that if it is included a second time, it won't actually be executed) OR to
detect whether the variable has been initialized? I would prefer the first
since that would take care of some formatting-related issues, but either
would be good.

Cheers,
Carl


On Mon, Apr 8, 2013 at 10:38 PM, Jay Anderson <[email protected]> wrote:

> On Mon, Apr 8, 2013 at 7:20 PM, Carl Peterson <[email protected]>
> wrote:
> > Is there a property or counter buried somewhere in Lilypond/Scheme for a
> > running count of score contexts? This is for a hymnal/psalter project
> where
> > I want to number the songs but don't want to deal with integrating
> lilypond
> > output into something else (like LaTeX).
>
> You can create your own counter.
> ============
> \version "2.17.15"
>
> #(define count 0)
> #(define (get-next)
>   (set! count (+ 1 count))
>   count)
> #(define (numbered-title title)
>   (string-append (number->string (get-next)) ". " title))
>
> \paper
> {
>   print-all-headers = ##t
> }
>
> \score
> {
>   \new Staff \relative c' { c4 c c c }
>   \header
>   {
>     title = #(numbered-title "A")
>   }
> }
>
> \score
> {
>   \new Staff \relative c' { c4 c c c }
>   \header
>   {
>     title = #(numbered-title "B")
>   }
> }
>
> \score
> {
>   \new Staff \relative c' { c4 c c c }
>   \header
>   {
>     title = #(numbered-title "C")
>   }
> }
> ============
>
> This is quick and dirty, but it might work for what you need.
>
> Another option is to generate your scores from a function. This way
> you can generate them in a loop passing in the counter. This would be
> more complicated.
>
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to