Jump to content

Vertically aligning stanza numbers of different staves: Difference between revisions

From LilyPond wiki
No edit summary
m New category
Tags: Mobile edit Mobile web edit
Line 50: Line 50:
[[Category:Vocal music]]
[[Category:Vocal music]]
[[Category:Tweaks and overrides]]
[[Category:Tweaks and overrides]]
[[Category:Included in the official documentation]][[Category:Snippet]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]

Revision as of 23:24, 21 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 }