Re: LyricText.self-alignment-X doesn't work with custom function

Thomas Morley <[email protected]>
Newsgroups gmane.comp.gnu.lilypond.general
Message-ID <CABsfGyXzsUTAB4ocUoxrgwpGokzihYr3jm6fwBqMkCsqmug77w@mail.gmail.com>
Am So., 16. Aug. 2026 um 22:19 Uhr schrieb Matthew Fong <[email protected]>:
>
> Dear Lilyponders,
>
> Many years ago, Aaron Hall wrote a function that would allow a cluster of notes to be grouped together like a chant neume in modern notation, and effectively represent a single note. In essence, a melisma.
>
> However, I've noticed that I'm unable to use LyricText.self-alignment-X to shift these notes/melismas relative to the Lyrics when I add a bit of rubric notation, like a dagger. The preference is that the notes/melisma start at the center of the text. There is no problem when it's just a single note. Only when using this function.
>
> Any idea what I might be missing, or other things to try?
>
>
> Many thanks,
> Matt
>
> Sort of MWE:
>
> \version "2.24.4"
> \language "english"
>
> %
> % multiNoteNeume: Solution to note spacing issue (authored by Aaron Hall)
> % [LINK] https://lists.gnu.org/archive/html/lilypond-user/2020-10/msg00083.html
> %
> multiNoteNeume =
> #(define-music-function
>     (notes)
>     (ly:music?)
>     ;; Adjust this number to support longer runs of notes.
>     (define denominator 11)
>     (let ((dur (ly:make-duration 2 0 1 denominator))
>             (count 0)
>             (last '()))
>         (for-some-music
>             (lambda (m)
>                 (if (music-is-of-type? m 'rhythmic-event)
>                     (begin
>                         (set! count (1+ count))
>                         (set! last m)
>                         (ly:music-set-property! m 'duration dur)
>                     #t)
>                 #f))
>             notes)
>         (if (ly:music? last)
>             (ly:music-set-property! last
>             'duration
>                 (ly:make-duration 2 0
>                 (- denominator (1- count))
>                 denominator)))
>         notes))
>
> redDagger = \markup {
>     \with-color #red
>     &dagger;
> }
>
> daggerAndGo = \markup { \override #'(word-space . 0.5) \line { { \redDagger } Go } }
>
> customLayout = \layout {
>     ragged-last = ##t
>
>     \context {
>         \Staff
>         \override TimeSignature.stencil = ##f
>         \override BarLine.extra-spacing-width = #'(0 . 2)
>     }
>
>     \context {
>         \Voice
>         \override Stem.stencil = ##f
>     }
>
>     \context {
>         \Lyrics
>         lyricMelismaAlignment = #CENTER
>     }
> } % end layout
>
> \score {
>     \new Staff
>     <<
>         \new Voice = "Cantus"
>         <<
>             \relative c' {
>                 \multiNoteNeume {c'4 (b)} \bar "||"
>                 \multiNoteNeume {c4 (b)} \bar "||"
>                 c \bar "||"
>             }
>         >>
>         \new Lyrics \lyricsto "Cantus" {
>             Go % This is the model
>             \tweak LyricText.self-alignment-X #1 \daggerAndGo % No shifting of lyrics at all
>             \tweak LyricText.self-alignment-X #0.47 \daggerAndGo % Single note works
>         }
>     >>
>     \customLayout
> } % end score
>
> % Paper settings
> #(set! paper-alist (cons '("content-size" . (cons (* 3.25 in) (* 7 in))) paper-alist))
>
> zerospacing = #'((basic-distance . 0) (minimum-distance . 0) (padding . 0) (stretchability . 0))
>
> \paper {
>     tagline = ##f
>     #(include-special-characters)
>
>     page-breaking = #ly:one-page-breaking
>
>     #(set-paper-size "content-size")
>
>     left-margin = 0.0\in
>     top-margin = 0.0\in
>     right-margin = 0.0\in
>     bottom-margin = 0.0\in
>
>     system-system-spacing =
>         #'((basic-distance . 11) (minimum-distance . 11) (padding . 0) (stretchability . 0))
>
>     score-system-spacing =
>         #'((basic-distance . 11) (minimum-distance . 11) (padding . 0) (stretchability . 0))
>
>     score-markup-spacing = \zerospacing
>     markup-system-spacing = \zerospacing
>     markup-markup-spacing = \zerospacing
>     top-system-spacing = \zerospacing
>     top-markup-spacing = \zerospacing
>     last-bottom-spacing = \zerospacing
> }

Quoting the docs: "By default, lyrics syllables that start a melisma
are left-aligned on their note. The alignment can be altered using the
lyricMelismaAlignment property"
https://lilypond.org/doc/v2.24/Documentation/snippets/text#text-aligning-syllables-with-melisma
In 2.26. this snippet is in NR
https://lilypond.org/doc/v2.26/Documentation/notation/techniques-specific-to-lyrics#placing-syllables-horizontally
Look for "Aligning syllables with melisma"

Cheers,
  Harm
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.