lilypond-user
[Top][All Lists]
Advanced

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

Re: Change stanza formatting


From: David F.
Subject: Re: Change stanza formatting
Date: Fri, 1 Mar 2019 11:20:12 -0700

On Mar 1, 2019, at 1:04 AM, Aaron Hill <address@hidden> wrote:

> On 2019-02-28 8:53 pm, David F. wrote:
>> Given a line of lyrics with the stanza number in front, how can I move
>> the stanza number (“1.”) so that it is above the first syllable of the
>> lyrics instead of to the left of the lyrics?
>> \version "2.19"
>> \new Voice \relative {
>>    \time 3/4 g'2 e4 a2 f4 g2.
>> }
>> \addlyrics {
>>    \set stanza = #"1. "
>>    Hi, my name is Bert.
>> }
> 
> The above snippet cheats a little because StanzaNumber does not actually 
> support self-alignment-interface, but it is reusing some code to ensure the 
> text is centered to the parent note.
> 
> It would be possible to support alignment to the LyricText with a little 
> extra work.  The following left-aligns the StanzaNumber to the supporting 
> text:
> 
> %%%%
> \version "2.19.82"
> 
> \layout { \context { \Lyrics
>  \override StanzaNumber.direction = #UP
>  \override StanzaNumber.side-axis = #Y
>  \override StanzaNumber.X-offset = #(lambda (grob)
>    (let* ((sse (ly:grob-object grob 'side-support-elements))
>           (lyr (car (ly:grob-array->list sse)))
>           (xoff (ly:grob-property lyr 'X-offset)))
>      xoff))
>  \override StanzaNumber.Y-offset = #ly:side-position-interface::y-aligned-side
> } }
> 
> \new Voice \relative { \time 3/4 g'2 e4 a2 f4 g2. }
> \addlyrics { \set stanza = #"1." Hi, my name is Bert. }
> %%%%

Thanks, Aron, that’s exactly what I was looking for.

There’s one small issue that I noticed.  I’m engraving music with simultaneous 
bilingual lyrics and I’m using the stanza number to print the language name. 
Since the language name is almost always longer than the first syllable, it is 
making that first note column wider than it would be without the stanza number. 
Is there a way to keep the sanza number from influencing the width of the note 
column?

(On the one hand, the extra space isn’t necessarily a big deal.  But the whole 
reason I want to print the language names on top of the lyrics instead of to 
the left of them is that I’ve run into cases where the extra text in the stanza 
number is preventing me from getting everything I want onto the first line of 
music.)

%%%%

\version "2.19"

\layout { \context { \Lyrics
 \override StanzaNumber.direction = #UP
 \override StanzaNumber.side-axis = #Y
 \override StanzaNumber.X-offset = #(lambda (grob)
   (let* ((sse (ly:grob-object grob 'side-support-elements))
          (lyr (car (ly:grob-array->list sse)))
          (xoff (ly:grob-property lyr 'X-offset)))
     xoff))
 \override StanzaNumber.Y-offset = #ly:side-position-interface::y-aligned-side
} }

\new Voice \relative { \time 3/4 g'2 e4 a2 f4 g2. }
\addlyrics { \set stanza = #"English" Hi, my name is Bert. }
\addlyrics { \set stanza =  #"Français" Oh, ché -- ri, je t'aime }

%%%%

Thanks,
David




reply via email to

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