lilypond-user
[Top][All Lists]
Advanced

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

Re: Different markups for odd and even lyrics lines / stanzas


From: David Kastrup
Subject: Re: Different markups for odd and even lyrics lines / stanzas
Date: Sat, 21 Jul 2012 12:44:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

Thomas Morley <address@hidden> writes:

> 2012/7/20 David Kastrup <address@hidden>:
> (...)
>> Why are you reentering all those engravers when you copy them from
>> \Lyrics anyway?
>
> Silly me!
>
> 2012/7/20 David Kastrup <address@hidden>:
> (...)
>> Oh, and of course if you first do
>>
>> \context { \Lyrics \override LyricText #'font-size = #-1 }
>> before defining \AltLyrics with reference to \Lyrics, then this change
>> will get copied into \AltLyrics as well.
>
> Thanks for the hint!
>
> I'm learning step by step. All I can promise is not to repeat my
> mistakes very often. :)

Here is another variation on the theme that gets along without a
different context type.  A tiny drawback is that it depends on
<URL:http://code.google.com/p/lilypond/issues/detail?id=2688> going
through in order to use ly:context-mod-apply!.

If you are in a tiresome mood, you can replace ly:context-mod-apply!
with a sequence of calls to ly:context-pushpop-property in order to make
this 2.14 material (of course, replacing make-engraver in the process).

\version "2.15.42"

% After:  http://lsr.dsi.unimi.it/LSR/Item?id=641

#(set-global-staff-size 18)

\paper {
        ragged-last-bottom = ##f
}

#(define (lyricswitch context)
  (let ((cnt 0))
    (make-engraver
     (listeners
      ((AnnounceNewContext translator ev)
       (if (eq? (ly:context-name (ly:event-property ev 'context)) 'Lyrics)
           (begin
             (set! cnt (1+ cnt))
             (if (even? cnt)
              (ly:context-mod-apply! (ly:event-property ev 'context)
               #{
                 \with {
                \override StanzaNumber #'font-series = #'medium
                \override LyricText #'font-shape = #'italic
                \override LyricText #'color = #(x11-color 'grey20)
                \override VerticalAxisGroup #'nonstaff-nonstaff-spacing =
                       #'((basic-distance . 0)
                          (minimum-distance . 5)  ;; <================ more 
lower space
                          (padding . 0.2)
                          (stretchability . 0))
                 }
              #})))))))))

%% Implement an alternate lyric context
myLayout =
\layout {
        \context { 
                \Lyrics 
                \override LyricText #'font-size = #-1 
        }
        \context {
                \Score
                \consists #lyricswitch
        }
        
        \context {
                \StaffGroup
                \consists #lyricswitch
        }
        
        \context {
                \ChoirStaff
                \consists #lyricswitch
        }
        
}

%%%%%%%%%%%% test %%%%%%%%%%%%%%%%%%%

mus = \relative c' \repeat unfold 3 { c4 c c c\break }

lyrOne = {
        \set stanza = "1. "
        \lyricmode { 
                \repeat unfold 2 { bla -- bla -- bla -- bla -- }
                bla -- bla -- bla -- bla
        }
}

lyrTwo = {
        \set stanza = "2. "
        \lyricmode { 
                \repeat unfold 2 { blub -- blub -- blub -- blub -- }
                blub -- blub -- blub -- blub
        }
}

lyrThree = {
        \set stanza = "3. "
        \lyricmode {
                \repeat unfold 2 { foo -- foo -- foo -- foo -- }
                foo -- foo -- foo -- foo
        }
}

lyrFour = {
        \set stanza = "4. "
        \lyricmode {
                \repeat unfold 2 { bla -- bla -- bla -- bla -- }
                bla -- bla -- bla -- bla
        }
}

lyrFive = {
        \set stanza = "5. "
        \lyricmode {
                \repeat unfold 2 { blub -- blub -- blub -- blub -- }
                blub -- blub -- blub -- blub
        }
}

lyrSix = {
        \set stanza = "6. "
        \lyricmode {
                \repeat unfold 2 { foo -- foo -- foo -- foo -- }
                foo -- foo -- foo -- foo
        }
}

\score {
        \new ChoirStaff <<
          \new Staff <<
            \new Voice = "mus" \mus
            
            \new Lyrics \lyricsto "mus" \lyrOne
            \new Lyrics \lyricsto "mus" \lyrTwo
            \new Lyrics \lyricsto "mus" \lyrThree
            \new Lyrics \lyricsto "mus" \lyrFour
            \new Lyrics \lyricsto "mus" \lyrFive
            \new Lyrics \lyricsto "mus" \lyrSix
          >>
          \new Staff <<
            \new Voice = "mus" \mus
            
            \new Lyrics \lyricsto "mus" \lyrOne
            \new Lyrics \lyricsto "mus" \lyrTwo
            \new Lyrics \lyricsto "mus" \lyrThree
            \new Lyrics \lyricsto "mus" \lyrFour
            \new Lyrics \lyricsto "mus" \lyrFive
            \new Lyrics \lyricsto "mus" \lyrSix
          >>
        >>
        \layout { \myLayout }
}


-- 
David Kastrup




reply via email to

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