Re: Left align first word of lyrics
Wilbert Berendsen xs4all.nl> writes: > It is complicated just now to paste the code how we did it, because > everything is so intermingled, but I'll show it later on in a nice > writeup. We wrote many functions that read custom variables from the > paper or layout blocks (using ly:output-def-lookup), so we got a very > flexible layout. Hello! I was wondering if you have written up about your process of formatting the 'Liedboek.' I am in the process of formatting a psalter using a similar layout to the psalm layout it the 'Liedboek.' I think that this would help me greatly. Kindest regards, Stephen ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left align first word of lyrics
Op Sun, 19 May 2013 03:11:12 +0200 (CEST) Gregory Heytings schreef: > > Hi list, > > Is it possible to automatically left align the first word of multiple > line lyrics ? By default the lyrics are all centered under the note, > which is okay in most situations, but perhaps not optimal for the > first word of a staff. For example, the words "Ccc", "Cc" and "C" > are centered under the c note with the following code: > > \score { >\new Staff << > \new Voice = A { \relative c' { c d e f } } > \new Lyrics \lyricsto A { Ccc ddd eee fff } > \new Lyrics \lyricsto A { Cc dd ee ff } > \new Lyrics \lyricsto A { C d e f } >>> > } > > I know that it is possible to move a particular word by hand with > "\once \override LyricText #'self-alignment-X = #...". This solution > is however not only painful to type in, but its result is also most > often only approximately correct. I have done that in our new dutch hymn book, the "Liedboek". Using a music function and the \applyOutput command I set the X-offset property and the extra-spacing-width property on every LyricText event that coincides with a \break, and also on the first LyricText event. We also made the LeftEdge object indefinitly high, so we could force the lyrics at a certain distance from the start of the staff line, and also have the first note of every line at the same spot. The other lyrics are centered. (For the single-voice hymns we used ragged-right = ##t but wit a fixed width on the StaffSymbol so we got nice looking church hymns. And we used a function based on the alignGrob idea from LSR to position the final barline neatly to the right.) It is complicated just now to paste the code how we did it, because everything is so intermingled, but I'll show it later on in a nice writeup. We wrote many functions that read custom variables from the paper or layout blocks (using ly:output-def-lookup), so we got a very flexible layout. Best regards, Wilbert -- Wilbert Berendsen (http://www.wilbertberendsen.nl) ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left align first word of lyrics
David, This is amazing. I was able to drop this into my own project without any trouble except changing the lyrics context command to reflect me using 2.16 instead of 2.17. Kudos. Cheers, Carl On Wed, May 22, 2013 at 1:06 PM, David Nalesnik wrote: > Well, comparing the lengths of strings is a bit shortsighted, as all > four-letter words don't occupy the same space... Revised to work with > stencil sizes, as David Kastrup suggests earlier in this thread. > > Argh. > ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left align first word of lyrics
Well, comparing the lengths of strings is a bit shortsighted, as all four-letter words don't occupy the same space... Revised to work with stencil sizes, as David Kastrup suggests earlier in this thread. Argh. lyrics-alignment2.ly Description: Binary data ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left align first word of lyrics
Hi Carl, On Wed, May 22, 2013 at 10:36 AM, Carl Peterson wrote: > I'm not in a position to test this at the moment, but just for > confirmation, will this work with an arbitrary number of tagged syllables > through a Lyrics context? > > ex: > > tagIt = \once \override Lyrics.LyricText #'tagged = ##t > Thank you for adding this shortcut. > > \new Lyrics \lyricsto A { > \tagIt This is the first phrase in my song. \break > \tagIt This is an -- oth -- er phrase to sing. \break > \tagIt This is a third phrase in my song. \break > \tagIt This is the last phrase in my song. > } > > Cheers, > Carl > Yes, you can use it as much as you like. (In fact, you could remove the \once in your definition of `tagIt' and have it apply to every syllable.) --David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left align first word of lyrics
I'm not in a position to test this at the moment, but just for confirmation, will this work with an arbitrary number of tagged syllables through a Lyrics context? ex: tagIt = \once \override Lyrics.LyricText #'tagged = ##t \new Lyrics \lyricsto A { \tagIt This is the first phrase in my song. \break \tagIt This is an -- oth -- er phrase to sing. \break \tagIt This is a third phrase in my song. \break \tagIt This is the last phrase in my song. } Cheers, Carl On Wed, May 22, 2013 at 9:02 AM, David Nalesnik wrote: > Hi > > > On Tue, May 21, 2013 at 8:41 PM, David Nalesnik > wrote: > >> Hi Gregory, >> >> Here's another version which will automatically find the longest >> syllable. You can tag any one of the lyric syllables at a given timestep. >> >> > Noticed a problem. Corrected file attached. > > --David > > > ___ > lilypond-user mailing list > lilypond-user@gnu.org > https://lists.gnu.org/mailman/listinfo/lilypond-user > > ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left align first word of lyrics
Hi On Tue, May 21, 2013 at 8:41 PM, David Nalesnik wrote: > Hi Gregory, > > Here's another version which will automatically find the longest syllable. > You can tag any one of the lyric syllables at a given timestep. > > Noticed a problem. Corrected file attached. --David lyrics-alignment2.ly Description: Binary data ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left align first word of lyrics
Hi Gregory, Here's another version which will automatically find the longest syllable. You can tag any one of the lyric syllables at a given timestep. HTH, David lyrics-alignment2.ly Description: Binary data ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left align first word of lyrics
On Tue, May 21, 2013 at 4:27 PM, David Nalesnik wrote: > > > Basically, the idea is that you tag the syllable you want the column to > left-align to by overriding an invented property which I called `tagged' > for lack of any inspiration. > > On a side note: I think it could potentially be very useful to be able to add markers to various grobs by overriding a property to a boolean or a string. There's \tag but that works with music expressions. --David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left align first word of lyrics
Hi, On Tue, May 21, 2013 at 4:32 AM, Gregory Heytings wrote: > >> What should the lyrics be left-aligned to then if not to the note? >> >> > To each other. This would give something like: > > o > Cccc > C > Cc > Ccc > c > > with the note on the first line, and the lyrics on the five next lines. > The lyrics are all left-aligned, and the note is centered on the longest > lyric. > > I'm kind of surprised that this works. Basically, the idea is that you tag the syllable you want the column to left-align to by overriding an invented property which I called `tagged' for lack of any inspiration. Right now, you need to choose the syllable you want to use for alignment. I don't imagine it would be difficult to determine the longest automatically. The materials between aren't strictly necessary. Without them, you'll just get a number of warnings. Hope this helps! \version "2.17.17" %% #(define (define-grob-property symbol type? description) (if (not (equal? (object-property symbol 'backend-doc) #f)) (ly:error (_ "symbol ~S redefined") symbol)) (set-object-property! symbol 'backend-type? type?) (set-object-property! symbol 'backend-doc description) symbol) #(map (lambda (x) (apply define-grob-property x)) `( (tagged ,boolean? "use this lyric syllable for alignment") )) #(define (Lyric_text_align_engraver ctx) (let ((tag #f) (syllables '())) (make-engraver (acknowledgers ((lyric-syllable-interface trans grob source) (set! syllables (cons grob syllables)) (if (eq? #t (ly:grob-property grob 'tagged)) (set! tag grob ((stop-translation-timestep trans) (if (ly:grob? tag) (for-each (lambda (x) (if (not (eq? x tag)) (set! (ly:grob-property x 'X-offset) (ly:grob-property tag 'X-offset syllables)) (set! syllables '()) (set! tag #f) \layout { \context { \Score \consists #Lyric_text_align_engraver } } \score { \new Staff << \new Voice = A { \relative c' { c d e f \break c d e f \break c d e f } } \new Lyrics \lyricsto A { \once \override Lyrics.LyricText #'tagged = ##t Cc d e f C d e f C d e f } \new Lyrics \lyricsto A { C d e f \once \override Lyrics.LyricText #'tagged = ##t Cc d e f C d e f } \new Lyrics \lyricsto A { C d e f C d e f \once \override Lyrics.LyricText #'tagged = ##t Cc d e f } >> } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left align first word of lyrics
Hi Kieren, On Tue, May 21, 2013 at 10:34 AM, Kieren MacMillan < kieren_macmil...@sympatico.ca> wrote: > > But of course it would be far better for this to be an > #'after-line-breaking callback (or whatever), to optionally override the > alignment of the first syllable on each line. > > Unfortunately, it doesn't seem as though setting 'X-offset or 'self-alignment-X has any impact after line breaks are determined. -David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left align first word of lyrics
Hi Carl, > Would it be possible to pass the lyrics to Scheme as a list of lists (a list > of verses, with each verse a list of words), so that for each syllable > placement it could look at the nth item of each list and determine correct > placement. This may require some manual line breaking (effectively a list of > lists of lists, verse --> line --> syllables) so that it can take the 1st > word of the nth line of each verse and align them. > > Not sure if this helps anybody with a place to go on this idea. I would imagine that's possible, of course… But of course it would be far better for this to be an #'after-line-breaking callback (or whatever), to optionally override the alignment of the first syllable on each line. Best, Kieren. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left align first word of lyrics
Just thinking about some of the stuff I've been working on. Would it be possible to pass the lyrics to Scheme as a list of lists (a list of verses, with each verse a list of words), so that for each syllable placement it could look at the nth item of each list and determine correct placement. This may require some manual line breaking (effectively a list of lists of lists, verse --> line --> syllables) so that it can take the 1st word of the nth line of each verse and align them. Not sure if this helps anybody with a place to go on this idea. On Tue, May 21, 2013 at 9:53 AM, Kieren MacMillan < kieren_macmil...@sympatico.ca> wrote: > Hi Gregory, > > >> A tedious solution is likely doable where you basically specify > something like > >> > >> \syllable #1 { Cccc C Cc Ccc c } > >> in the first stanza, > >> \syllable #2 { Cccc C Cc Ccc c } > >> > >> in the second stanza and so on: then each stanza would typeset the > whole column, align it, and pick out the right row. > >> > > > > That's an interesting idea. A bit tedious as you write, but better than > nothing however. > > This is far too complicated and tedious for 99% of works with lyrics — > including, I'm assuming, yours. If your layout is [relatively] static, > simply add an appropriate alignment override to all lyrics *except* the one > that's properly centered: > > \version "2.17" > > theNotes = \relative c' { > \time 3/2 > \repeat "unfold" 6 c > \break > \repeat "unfold" 6 c > } > > theWordsI = \lyricmode { > one two three four five six sev -- en eight nine ten ’leven > } > > theWordsII = \lyricmode { > \once \override LyricText #'self-alignment-X = #5 A B C D E F > \once \override LyricText #'self-alignment-X = #3.5 G H I J K L > } > > theWordsIII = \lyricmode { > \once \override LyricText #'self-alignment-X = #-10 I simp -- ly ad -- > just -- ed the cor -- rect syl -- la -- bles! > } > > \score { > << > \new Staff \theNotes > \addlyrics \theWordsI > \addlyrics \theWordsII > \addlyrics \theWordsIII > >> > } > > The tiny bit of trial-and-error necessary to accomplish this is far less > tedious than David's \syllable suggestion, except in trivial situations > (e.g., songs with less than ten syllables per verse). > > Best regards, > Kieren. > ___ > lilypond-user mailing list > lilypond-user@gnu.org > https://lists.gnu.org/mailman/listinfo/lilypond-user > ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left align first word of lyrics
Hi Gregory, >> A tedious solution is likely doable where you basically specify something >> like >> >> \syllable #1 { Cccc C Cc Ccc c } >> in the first stanza, >> \syllable #2 { Cccc C Cc Ccc c } >> >> in the second stanza and so on: then each stanza would typeset the whole >> column, align it, and pick out the right row. >> > > That's an interesting idea. A bit tedious as you write, but better than > nothing however. This is far too complicated and tedious for 99% of works with lyrics — including, I'm assuming, yours. If your layout is [relatively] static, simply add an appropriate alignment override to all lyrics *except* the one that's properly centered: \version "2.17" theNotes = \relative c' { \time 3/2 \repeat "unfold" 6 c \break \repeat "unfold" 6 c } theWordsI = \lyricmode { one two three four five six sev -- en eight nine ten ’leven } theWordsII = \lyricmode { \once \override LyricText #'self-alignment-X = #5 A B C D E F \once \override LyricText #'self-alignment-X = #3.5 G H I J K L } theWordsIII = \lyricmode { \once \override LyricText #'self-alignment-X = #-10 I simp -- ly ad -- just -- ed the cor -- rect syl -- la -- bles! } \score { << \new Staff \theNotes \addlyrics \theWordsI \addlyrics \theWordsII \addlyrics \theWordsIII >> } The tiny bit of trial-and-error necessary to accomplish this is far less tedious than David's \syllable suggestion, except in trivial situations (e.g., songs with less than ten syllables per verse). Best regards, Kieren. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left align first word of lyrics
Gregory Heytings writes: >> A tedious solution is likely doable where you basically specify >> something like >> >> \syllable #1 { Cccc C Cc Ccc c } >> in the first stanza, >> \syllable #2 { Cccc C Cc Ccc c } >> >> in the second stanza and so on: then each stanza would typeset the >> whole column, align it, and pick out the right row. >> > > That's an interesting idea. A bit tedious as you write, but better > than nothing however. Am I right that the \syllable primitive is not > part of LilyPond, and that this is just an idea of yours? It is not hard to do: #(define-markup-command (syllable layout props idx col) (index? markup-list?) (let* ((stc (interpret-markup-list layout props col)) (all (apply ly:stencil-add stc)) (me (list-ref stc (1- idx (ly:stencil-add me (ly:make-stencil "" (ly:stencil-extent all X) (ly:stencil-extent me Y) \score { \new Staff << \new Voice { c' d' e'2 \bar "|." } \addlyrics { \markup \syllable #1 { Do Cant Syll } -- mi -- nus, } \addlyrics { \markup \syllable #2 { Do Cant Syll } -- a me } \addlyrics { \markup \syllable #3 { Do Cant Syll } -- a -- bum! } >> } But you'll see another complication coming right up... One will probably need to use left alignment after all and mess with the left extent to simulate centering. But how are you going to define "centering" when the hyphen sticks out an arbitrary amount? -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left align first word of lyrics
So the lyrics are supposed to be aligned as a block first which is then centered on the note. Exactly. I think that the current machinery is rather working by aligning everything independently to the note in question. Indeed. That would place the prealignment of the lyrics into the "seriously tricky" realm. So it is quite possible that you'll not get any "off the cuff" elegant solution for this. A good solution is also constrained by the alignment only being possible when the lyrics have been turned into stencils, and that happens depending on the text font defaults at the time of typesetting. A tedious solution is likely doable where you basically specify something like \syllable #1 { Cccc C Cc Ccc c } in the first stanza, \syllable #2 { Cccc C Cc Ccc c } in the second stanza and so on: then each stanza would typeset the whole column, align it, and pick out the right row. That's an interesting idea. A bit tedious as you write, but better than nothing however. Am I right that the \syllable primitive is not part of LilyPond, and that this is just an idea of yours? Best, Gregory ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left align first word of lyrics
Gregory Heytings writes: >> >>> Indeed, many thanks, I did not expect that the solution would be so >>> trivial. I tried with various values of self-alignment-X, but not >>> with -1... >> >> -1 is the same as LEFT > > Okay, I did not read the manual carefully enough (again). That was just intended to provide some missing information. Frankly, I wouldn't know where to look for it. >>> The solution is not perfect, however. I was more expecting a >>> solution where the note is centered above the lyrics, and the >>> lyrics aligned left; in this case the lyrics are indeed left >>> aligned, but the note is also left aligned... >> >> What should the lyrics be left-aligned to then if not to the note? >> > > To each other. This would give something like: > > o > Cccc > C > Cc > Ccc > c > > with the note on the first line, and the lyrics on the five next > lines. The lyrics are all left-aligned, and the note is centered on > the longest lyric. So the lyrics are supposed to be aligned as a block first which is then centered on the note. I think that the current machinery is rather working by aligning everything independently to the note in question. That would place the prealignment of the lyrics into the "seriously tricky" realm. So it is quite possible that you'll not get any "off the cuff" elegant solution for this. A good solution is also constrained by the alignment only being possible when the lyrics have been turned into stencils, and that happens depending on the text font defaults at the time of typesetting. A tedious solution is likely doable where you basically specify something like \syllable #1 { Cccc C Cc Ccc c } in the first stanza, \syllable #2 { Cccc C Cc Ccc c } in the second stanza and so on: then each stanza would typeset the whole column, align it, and pick out the right row. I hve my doubt you can do much better than that with reasonable effort. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left align first word of lyrics
Indeed, many thanks, I did not expect that the solution would be so trivial. I tried with various values of self-alignment-X, but not with -1... -1 is the same as LEFT Okay, I did not read the manual carefully enough (again). I know and see that you put much effort in it, but please understand that lambda users do not always find their way through it. The solution is not perfect, however. I was more expecting a solution where the note is centered above the lyrics, and the lyrics aligned left; in this case the lyrics are indeed left aligned, but the note is also left aligned... What should the lyrics be left-aligned to then if not to the note? To each other. This would give something like: o Cccc C Cc Ccc c with the note on the first line, and the lyrics on the five next lines. The lyrics are all left-aligned, and the note is centered on the longest lyric. Gregory ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left align first word of lyrics
Gregory Heytings writes: >> l=\once \override LyricText #'self-alignment-X = #-1 >> >> \score { >> \new Staff << >>\new Voice = A { \relative c' { c d e f } } >>\new Lyrics \lyricsto A { \l Ccc ddd eee fff } >>\new Lyrics \lyricsto A { \l Cc dd ee ff } >>\new Lyrics \lyricsto A { \l C d e f } >> >> >> } >> >> Avoids the need for typing much, and seems to left-align accurately >> according to my output. >> > > Indeed, many thanks, I did not expect that the solution would be so > trivial. I tried with various values of self-alignment-X, but not > with -1... -1 is the same as LEFT > The solution is not perfect, however. I was more expecting a solution > where the note is centered above the lyrics, and the lyrics aligned > left; in this case the lyrics are indeed left aligned, but the note is > also left aligned... What should the lyrics be left-aligned to then if not to the note? -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left align first word of lyrics
Is it possible to automatically left align the first word of multiple line lyrics ? By default the lyrics are all centered under the note, which is okay in most situations, but perhaps not optimal for the first word of a staff. For example, the words "Ccc", "Cc" and "C" are centered under the c note with the following code: \score { \new Staff << \new Voice = A { \relative c' { c d e f } } \new Lyrics \lyricsto A { Ccc ddd eee fff } \new Lyrics \lyricsto A { Cc dd ee ff } \new Lyrics \lyricsto A { C d e f } >> } I know that it is possible to move a particular word by hand with "\once \override LyricText #'self-alignment-X = #...". This solution is however not only painful to type in, but its result is also most often only approximately correct. l=\once \override LyricText #'self-alignment-X = #-1 \score { \new Staff << \new Voice = A { \relative c' { c d e f } } \new Lyrics \lyricsto A { \l Ccc ddd eee fff } \new Lyrics \lyricsto A { \l Cc dd ee ff } \new Lyrics \lyricsto A { \l C d e f } >> } Avoids the need for typing much, and seems to left-align accurately according to my output. Indeed, many thanks, I did not expect that the solution would be so trivial. I tried with various values of self-alignment-X, but not with -1... The solution is not perfect, however. I was more expecting a solution where the note is centered above the lyrics, and the lyrics aligned left; in this case the lyrics are indeed left aligned, but the note is also left aligned... Best, Gregory ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left align first word of lyrics
- Original Message - From: "Gregory Heytings" To: Sent: Sunday, May 19, 2013 2:11 AM Subject: Left align first word of lyrics Hi list, Is it possible to automatically left align the first word of multiple line lyrics ? By default the lyrics are all centered under the note, which is okay in most situations, but perhaps not optimal for the first word of a staff. For example, the words "Ccc", "Cc" and "C" are centered under the c note with the following code: \score { \new Staff << \new Voice = A { \relative c' { c d e f } } \new Lyrics \lyricsto A { Ccc ddd eee fff } \new Lyrics \lyricsto A { Cc dd ee ff } \new Lyrics \lyricsto A { C d e f } >> } I know that it is possible to move a particular word by hand with "\once \override LyricText #'self-alignment-X = #...". This solution is however not only painful to type in, but its result is also most often only approximately correct. Many thanks in advance, Gregory l=\once \override LyricText #'self-alignment-X = #-1 \score { \new Staff << \new Voice = A { \relative c' { c d e f } } \new Lyrics \lyricsto A { \l Ccc ddd eee fff } \new Lyrics \lyricsto A { \l Cc dd ee ff } \new Lyrics \lyricsto A { \l C d e f } >> } Avoids the need for typing much, and seems to left-align accurately according to my output. -- Phil Holmes ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Left align first word of lyrics
Hi list, Is it possible to automatically left align the first word of multiple line lyrics ? By default the lyrics are all centered under the note, which is okay in most situations, but perhaps not optimal for the first word of a staff. For example, the words "Ccc", "Cc" and "C" are centered under the c note with the following code: \score { \new Staff << \new Voice = A { \relative c' { c d e f } } \new Lyrics \lyricsto A { Ccc ddd eee fff } \new Lyrics \lyricsto A { Cc dd ee ff } \new Lyrics \lyricsto A { C d e f } >> } I know that it is possible to move a particular word by hand with "\once \override LyricText #'self-alignment-X = #...". This solution is however not only painful to type in, but its result is also most often only approximately correct. Many thanks in advance, Gregory ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user