Jump to content

Horizontally aligning stanza numbers of different staves: Difference between revisions

From LilyPond wiki
mNo edit summary
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
It can happen that stanza numbers don't align vertically if the verses are attached to different staves. To fix that, override the <code>self-alignment-X</code> property of the <code>LyricText</code> grob.
It can happen that stanza numbers don’t align horizontally if the verses are attached to different staves. To fix that, override the <code>self-alignment-X</code> property of the <code>LyricText</code> grob.


<lilypond version="2.24">
<lilypond version="2.24">

Latest revision as of 15:39, 26 June 2026

It can happen that stanza numbers don’t align horizontally if the verses are attached to different staves. To fix that, override the self-alignment-X property of the LyricText grob.

\version "2.24"

\markup { default behavior }

<<
  \new Staff { b b b b }
  \lyrics {
    \set stanza = "3."
    a a a a
  }

  \new Staff { b b b b }
  \lyrics {
    \set stanza = "1."
    aaaaaaaaaa a a a
  }
  \lyrics {
    \set stanza = "2."
    a a a a
  }
>>

\markup \vspace #1
\markup {
  using \typewriter "self-alignment-X = #LEFT" }

<<
  \new Staff { b b b b }
  \new Lyrics \lyricmode {
    \set stanza = "3."
    a a a a
  }

  \new Staff { b b b b }
  \new Lyrics \lyricmode {
    \set stanza = "1."
    \once \override LyricText.self-alignment-X = #LEFT
    aaaaaaaaaa a a a
  }
  \new Lyrics \lyricmode {
    \set stanza = "2."
    a a a a
  }
>>