Jump to content

Vertically aligning stanza numbers of different staves: Difference between revisions

From LilyPond wiki
Import snippet from LSR
 
m Replace version="2.24.0" with version="2.24" now that the LilyWiki extension supports auto-selecting the latest release in a stable series
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 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.


<lilypond version="2.24.0" full>
<lilypond version="2.24" full>
\markup { default behavior }
\markup { default behavior }



Revision as of 18:55, 16 November 2025

It can happen that stanza numbers don't align vertically 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
  }
>>

\paper { tagline = ##f }