Re: Notes en lyrics left justified
> On 23 Mar 2025, at 15:59, Hans Aikema wrote: > > > >> On 21 Mar 2025, at 17:00, Valentin Petzel wrote: >> >> Hello Ad, >> >> what you want is >> >> \paper { >> ragged-right = ##t >> } >> >> the issue with this is that it will shorten the staff. So use >> >> \layout { >> \context { >> \Staff \override StaffSymbol.width = >> #(lambda (grob) >> (ly:output-def-lookup (ly:grob-layout grob) 'line-width)) >> } >> } >> >> to enforce the staff having full length. >> >> Cheers, >> Valentin > > Works great and got me into trying to apply it on my use-case (display of > hymns including melody in presentation slides), but I end up with visual > ugliness it triggers for end-of-line barlines which then appear in the middle > of the staff at the end of the music. I’d like to know whether that can be > solved as well. > > For the regular measure bars I don’t mind it that much, I’m fine with > overriding the default measure bar with an overrride that does not print > end-of-line for my purposes as in > > > \defineBarLine "|-noeol" #'(#f #f #f) > > and > > \layout { >\context { \Staff >\override StaffSymbol.width = #(lambda (grob) (ly:output-def-lookup > (ly:grob-layout grob) 'line-width)) >measureBarType = "|-noeol" >} > } > > > However for the typical closing barline at the end of a piece ( \bar “|.” ) I > would like to keep it visible, but have it appear at the end of the > staff-line rather than the end of the music. Answering on my own question with a hidden gem I managed to dig up from the archives of this list (thanks Wilbert for posting this in the distant past): https://lists.gnu.org/archive/html//lilypond-user/2013-03/msg00963.html Updated for 2.24.0 with convert-ly that would nowadays be \version "2.24.0" endbar = { \overrideProperty Staff.BarLine.after-line-breaking #(lambda (grob) (let* ((sys (ly:grob-system grob)) (staff (ly:grob-object grob 'staff-symbol)) (half-thickness (/ (ly:staff-symbol-line-thickness staff) 2)) (cur-x (cdr (ly:grob-extent grob sys X))) (new-x (cdr (ly:grob-extent staff sys X))) (xoff (+ half-thickness (- new-x cur-x (ly:grob-set-property! grob 'extra-offset (cons xoff 0 } allowing you to code an end-of-staff barline on left-aligned notes and lyrics (the typical ending-barline in this case) like: \endbar \bar “|.”
Re: Notes en lyrics left justified
> On 21 Mar 2025, at 17:00, Valentin Petzel wrote: > > Hello Ad, > > what you want is > > \paper { > ragged-right = ##t > } > > the issue with this is that it will shorten the staff. So use > > \layout { > \context { >\Staff \override StaffSymbol.width = >#(lambda (grob) > (ly:output-def-lookup (ly:grob-layout grob) 'line-width)) > } > } > > to enforce the staff having full length. > > Cheers, > Valentin Works great and got me into trying to apply it on my use-case (display of hymns including melody in presentation slides), but I end up with visual ugliness it triggers for end-of-line barlines which then appear in the middle of the staff at the end of the music. I’d like to know whether that can be solved as well. For the regular measure bars I don’t mind it that much, I’m fine with overriding the default measure bar with an overrride that does not print end-of-line for my purposes as in \defineBarLine "|-noeol" #'(#f #f #f) and \layout { \context { \Staff \override StaffSymbol.width = #(lambda (grob) (ly:output-def-lookup (ly:grob-layout grob) 'line-width)) measureBarType = "|-noeol" } } However for the typical closing barline at the end of a piece ( \bar “|.” ) I would like to keep it visible, but have it appear at the end of the staff-line rather than the end of the music.
Re: Notes en lyrics left justified
> I don’t know of a way to set “ragged-right = ##t” for the notes only > [and not the StaffSymbol], but maybe someone out there does…? In 2011, Wilbert Berendsen wrote: #(define (fixed-staff-width grob) (ly:output-def-lookup (ly:grob-layout grob) 'line-width)) \layout { ragged-right = ##t \context { \Staff \override StaffSymbol #'width = #fixed-staff-width } } I would use: \layout { ragged-right = ##t \context { \Score \override StaffSymbol.width = #fixed-staff-width } } Toine Schreurs
Re: Notes en lyrics left justified
Hello, > When I compile the code below, I get a staff over the entire width of my page > (see example 1), but the notes f and a, including the lyrics 'OK' and > 'thanks' are in the middle of the staff. > How can I make sure that the lyrics and notes on the left are justified? (see > example 2) You can always [manually] force extra space into the mix: %%% SNIPPET BEGINS \version "2.22.1" \layout { indent = #0 line-width = #180 #(layout-set-staff-size 24) } { \key f \major \time 2/4 c'4 \tweak extra-spacing-width #'(0 . 80) f' \bar "" \break c'4 \tweak extra-spacing-width #'(0 . 80) a' \bar "" \break } \addlyrics { Yes OK, No thanks, } %%% SNIPPET ENDS I don’t know of a way to set “ragged-right = ##t” for the notes only [and not the StaffSymbol], but maybe someone out there does…? Hope that helps! Kieren. __ My work day may look different than your work day. Please do not feel obligated to read or respond to this email outside of your normal working hours.
Re: Notes en lyrics left justified
Hello Ad, what you want is \paper { ragged-right = ##t } the issue with this is that it will shorten the staff. So use \layout { \context { \Staff \override StaffSymbol.width = #(lambda (grob) (ly:output-def-lookup (ly:grob-layout grob) 'line-width)) } } to enforce the staff having full length. Cheers, Valentin signature.asc Description: This is a digitally signed message part.