On Mon, Mar 13, 2017 at 9:58 AM, David Nalesnik <david.nales...@gmail.com> wrote: > Hi Andrew, > > On Mon, Mar 13, 2017 at 3:11 AM, Andrew Bernard > <andrew.bern...@gmail.com> wrote: >> This issue has dogged me for a long time, and searching the archives does >> not produce a reliable answer as far as I can see. >> >> When using proportional notation with cross staff beamed groups, it looks >> vastly better if the stems are evenly spaced, but proportional notation >> messes this up, and only in the cross staff situation. >> >> I have tried using \newSpacing section in my scores and I am so deep in >> confusion perhaps that I cannot find a way to make this work, while >> preserving the proportional notation for the score overall. >> >> There is a thread concerning this matter here, with no resolution, but >> pertinent: >> >> https://lists.gnu.org/archive/html/lilypond-user/2014-07/msg00303.html >> >> It would be great if this could be made to work. What lilypond incantations >> do I need, or is it a current limitation? Could we have some sort of >> \spaceStemsEvenly command? >> >> Andrew >> >> == snip >> >> \version "2.19.56" >> >> tsd = { \change Staff = treble \stemDown } >> bsu = { \change Staff = bass \stemUp } >> >> treble = { >> \clef treble >> aes''32[ \bsu c' \tsd d''' \bsu d' \tsd d''' \bsu ees'] >> } >> >> bass = { >> \clef bass >> s4 >> } >> >> \score { >> >> \new PianoStaff >> << >> \new Staff = "treble" { \treble } >> \new Staff = "bass" { \bass } >> >> >> >> \layout { >> } >> } >> >> \score { >> >> \new PianoStaff >> << >> \new Staff = "treble" { \treble } >> \new Staff = "bass" { \bass } >> >> >> >> \layout { >> \context { >> \Score >> proportionalNotationDuration = #(ly:make-moment 1/32) >> \override SpacingSpanner.uniform-stretching = ##t >> \override Score.SpacingSpanner.strict-note-spacing = ##t >> } >> } >> } >> > > How about this? > > It's not a deep solution which adjusts spacing; rather, it adjusts the > X-offset of NoteColumns based on stem position. > > The example shows a corrected group surrounded by default to > illustrate usage of the music function I've wrapped the correction > into. > > Best, > David > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > \version "2.19.56" > > %% Grob should be a NoteColumn object > #(define (space-by-stems grob) > (let* ((stem (ly:grob-object grob 'stem)) > (beam (ly:grob-object stem 'beam)) > (stems (ly:grob-array->list (ly:grob-object beam 'stems))) > (note-columns (map (lambda (s) (ly:grob-parent s X)) stems)) > ;; which NoteColumn am I? > (me-nc (memq grob note-columns)) > (nth (- (length note-columns) (length me-nc))) > (orig-stem-pos (map (lambda (s nc) > (ly:grob-relative-coordinate s nc X)) > stems note-columns))) > (* -1 (list-ref orig-stem-pos nth)))) > > spaceStemsEvenly = > #(define-music-function (mus) (ly:music?) > (let ((done #f)) > #{ > \override NoteColumn.X-offset = #space-by-stems > #mus > \revert NoteColumn.X-offset > #}))
Oh, there's some extra code. I decided to use a flag to avoid redundant calculations, but didn't follow through. The music function should read spaceStemsEvenly = #(define-music-function (mus) (ly:music?) #{ \override NoteColumn.X-offset = #space-by-stems #mus \revert NoteColumn.X-offset #}) > > %%%%%%%%%%%%%%%%%% EXAMPLE %%%%%%%%%%%%%%%%% > > tsd = { \change Staff = treble \stemDown } > bsu = { \change Staff = bass \stemUp } > > treble = { > \clef treble > aes''32[ \bsu c' \tsd d''' \bsu d' \tsd d''' \bsu ees'] > } > > bass = { > \clef bass > s8. > } > > \score { > > \new PianoStaff > << > \new Staff = "treble" { \treble \spaceStemsEvenly \treble \treble } > \new Staff = "bass" { \bass \bass \bass } > >> > > \layout { > \context { > \Score > proportionalNotationDuration = #(ly:make-moment 1/32) > \override SpacingSpanner.uniform-stretching = ##t > \override Score.SpacingSpanner.strict-note-spacing = ##t > } > } > } _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user