[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Repeating stanza numbers
From: |
Neil Puttock |
Subject: |
Re: Repeating stanza numbers |
Date: |
Thu, 26 Jan 2012 17:49:06 +0000 |
On 26 January 2012 17:27, Matie Holtzhausen <address@hidden> wrote:
> I suppose what I'm looking for is "shortStanza"? Any other tricks?
You need a scheme engraver to do this, since it must generate a
StanzaNumber for every lyric then discard the mid-line stanza numbers:
\version "2.14"
\relative c' { c2 c \break c c }
\addlyrics{ \set stanza = #"1. " la la la la }
\addlyrics{ \set stanza = #"2. " ho ho ho ho }
\layout {
\context {
\Lyrics
\remove "Stanza_number_engraver"
\consists #(lambda (ctx)
(let ((text #f))
`((process-music .
,(lambda (trans)
(let ((stanza (ly:context-property ctx 'stanza)))
(and (markup? stanza)
(set! text (ly:engraver-make-grob
trans 'StanzaNumber '()))
(set! (ly:grob-property text 'text) stanza)))))
(stop-translation-timestep .
,(lambda (trans)
(set! text #f))))))
\override StanzaNumber #'after-line-breaking =
#(lambda (grob)
(and (= (ly:item-break-dir (ly:grob-object (ly:grob-parent grob
X) 'left-neighbor))
CENTER)
(ly:grob-suicide! grob)))
}
}
Cheers,
Neil