[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question about score count
From: |
Jay Anderson |
Subject: |
Re: Question about score count |
Date: |
Mon, 8 Apr 2013 19:38:03 -0700 |
On Mon, Apr 8, 2013 at 7:20 PM, Carl Peterson <address@hidden> 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.