Hello, Cross-staff stems do currently work by simply connecting to any stem that is on the correct side and matches the positions. This often does not work out when we have shifted note columns due to collision. In such cases we’d need to do manual positioning. So I’ve written a small engraver that matches positions of stems. This way we can tell Lilypond: Place this note column in such a way that the stems can be connected.
Cheers, Valentin
#(define (match-stem-engraver context) (let ((stems '()) (roots '())) (make-engraver (acknowledgers ((stem-interface engraver grob source-engraver) (let* ((det (ly:grob-property grob 'details)) (stem-id (assoc-get 'stem-id det #f)) (root (assoc-get 'is-root det #f))) (if stem-id (if root (set! roots (assoc-set! roots stem-id grob)) (set! stems (assoc-set! stems stem-id (cons grob (assoc-get stem-id stems '()))))))))) ((process-acknowledged engraver) (for-each (lambda (pair) (let ((id (car pair)) (root (cdr pair))) (for-each (lambda (stem) (ly:grob-set-parent! (ly:grob-parent stem X) X (ly:grob-parent root X)) (ly:grob-set-property! (ly:grob-parent stem X) 'X-offset (- (ly:grob-property root 'X-offset) (ly:grob-property stem 'X-offset))) (ly:grob-set-property! (ly:grob-parent stem X) 'ignore-collision #t) ) (assoc-get id stems '())))) roots) (set! roots '()) (set! stems '()))))) \layout { \context { \PianoStaff \consists "Span_stem_engraver" } } \new PianoStaff << \new Staff << <c' g'> \\ e' >> \new Staff { \clef bass << \crossStaff g \\ c >> } >> \new PianoStaff \with { \consists #match-stem-engraver } << \new Staff << { \override Stem.details.stem-id = #'A \override Stem.details.is-root = ##t <c' g'> } \\ e' >> \new Staff { \clef bass << { \override Stem.details.stem-id = #'A \crossStaff g } \\ c >> } >>
signature.asc
Description: This is a digitally signed message part.