lilypond-user
[Top][All Lists]
Advanced

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

Re: Change stanza formatting


From: Aaron Hill
Subject: Re: Change stanza formatting
Date: Fri, 01 Mar 2019 00:04:08 -0800
User-agent: Roundcube Webmail/1.3.8

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.
}

%%%%
\version "2.19.82"

\layout { \context { \Lyrics
  \override StanzaNumber.direction = #UP
  \override StanzaNumber.side-axis = #Y
  \override StanzaNumber.self-alignment-X = #CENTER
\override StanzaNumber.X-offset = #ly:self-alignment-interface::aligned-on-x-parent \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. }
%%%%

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. }
%%%%

-- Aaron Hill



reply via email to

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