2017-06-12 6:43 GMT+02:00 David Wright <[email protected]>:
> I can't figure out how to make crossStaff work when one component
> has been displaced by the interval of a second. I came up with a
> hack (a hidden note) in example 3, but it has the side effect of
> leaving the accidental (when there is one) rather far over.
> Is there a better way?

See:
http://lists.gnu.org/archive/html/lilypond-user/2016-11/msg00230.html

For your example:

\version "2.19.59"

\header { tagline = ##f }

pushNC =
\once \override NoteColumn.X-offset =
  #(lambda (grob)
    (let* ((p-c (ly:grob-parent grob X))
           (p-c-elts (ly:grob-object p-c 'elements))
           (stems
             (if (ly:grob-array? p-c-elts)
                 (filter
                   (lambda (elt)(grob::has-interface elt 'stem-interface))
                   (ly:grob-array->list p-c-elts))
                 #f))
           (stems-x-exts
             (if stems
                 (map
                   (lambda (stem)
                     (ly:grob-extent
                       stem
                       (ly:grob-common-refpoint grob stem X)
                       X))
                   stems)
                 '()))
           (sane-ext
             (filter interval-sane? stems-x-exts))
           (cars (map car sane-ext)))
    (if (pair? cars)
        (abs (- (apply max cars)  (apply min cars)))
        0)))

\layout {
  \context {
    \PianoStaff
    \consists #Span_stem_engraver
    \omit TimeSignature
  }
}

middle =  { \time 3/4 \voiceTwo \autoBeamOff \crossStaff { f'4 e'8 d' e'4 } }

\new PianoStaff <<
  \new Staff <<
    \new Voice { \voiceOne <d'' g'>4 g'8 f' g'4 }
    \new Voice { \middle }
  >>
  \new Staff <<
    \new Voice {
      \clef bass
      \voiceTwo
      %% the value 1.3 is not close/exact enough
      %% 1.304212 would have worked
      %\once \override NoteColumn.X-offset = #1.3
      %% better do:
      \pushNC
      cis'4 cis'8 cis' cis'4
    }
  >>
>>


HTH,
  Harm

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to