I’m using the vocalName and shortVocalName context properties in Lyrics and for 
a particular project, I always set them to be the same thing (i.e. so that the 
verse numbers appear on every line).  Right now, that means putting two “\set” 
commands in each Lyrics context in order to set both properties.  I’m looking 
to simplify this and thus am looking for two things:

1) Can I establish that shortVocalName should default to vocalName at the top 
level of the file (effectively placing it where I can transport it over to my 
format file)?

2) Can I automate the numbering so that I don’t have to manually number the 
verses?  I’ve seen http://lsr.di.unimi.it/LSR/Item?id=543, but this has two 
problems: one, the counter increments each time the markup is printed, which is 
problematic for verse numbers which should stay the same within a verse, no 
matter how many times it is printed, and only increment between verses.  Two, 
it introduces a spurious space after the counter that I don’t know how to get 
rid of.

My MnonWE (with the counter in place):

\version "2.24.0"

% This is where my \include "format.ily" would go.

#(define counter-alist '())

#(define-markup-command (counter layout props name) (string?)
  "Increases and prints out the value of the given counter named @var{name}.
  If the counter does not yet exist, it is initialized with 1."
  (let* ((oldval (assoc-ref counter-alist name))
         (newval (if (number? oldval) (+ oldval 1) 1)))
  (set! counter-alist (assoc-set! counter-alist name newval))
  (interpret-markup layout props
    (markup (number->string newval)))))

music = { c c c c | \break c c c c | \break c c c c }

verseI = \lyricmode { a a a a a a a a a a a a }

verseII = \lyricmode { b b b b b b b b b b b b }

verseIII = \lyricmode { c c c c c c c c c c c c c }


\new Staff
<<
    \new Voice = "mel" { \music }
    \new Lyrics \lyricsto "mel" { 
        \set vocalName = \markup { \counter #"versenumber". }
        \set shortVocalName = \markup { \counter #"versenumber". } 
        \verseI }
    \new Lyrics \lyricsto "mel" { 
        \set vocalName =\markup { \counter #"versenumber". }
        \set shortVocalName = \markup { \counter #"versenumber". }
        \verseII }
    \new Lyrics \lyricsto "mel" { 
        \set vocalName = \markup { \counter #"versenumber". }
        \set shortVocalName = \markup { \counter #"versenumber". }
        \verseIII }
>>


✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


Reply via email to