lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Combining crossStaff with a central beam


From: Paul Hodges
Subject: Re: Combining crossStaff with a central beam
Date: Mon, 21 Feb 2022 10:09:29 +0000

Thank you very much - that's a nicer resolution than I had managed (which was very much a hack - less code for a single example, but poorer spacing).

As for crossStaff and direction, I have certainly found matching to be necessary in my experience; and it's logical to require the same, because otherwise it's not clear which end gets the stem and flags (if any).

Paul


From: Thomas Morley <thomasmorley65@gmail.com>
To: Paul Hodges <pwh@cassland.org>
Cc: lilypond-user <lilypond-user@gnu.org>
Sent: 20/02/2022 14:59
Subject: Re: Combining crossStaff with a central beam

Am Sa., 19. Feb. 2022 um 19:45 Uhr schrieb Paul Hodges <pwh@cassland.org>:
>
> I am trying to set the attached image (both staves are bass clef).  I have written the tuplet (without the note on the top staff in the first chord) in my lower staff voice and jumping between staves as required; the missing note I have set in my top staff voice as the first note of a tuplet with bracket and number hidden and followed by the required skip.  But I can't find any way to make the two parts of the first chord join up, because the \crossStaff directive requires the stems to be in the same direction, and here they are inherently not so.
>
> Any ideas?
>
> I can produce non-working code if required, but I think the description of the problem is enough.
>
> Paul

Afaict, \crossStaff does not _require_ Stems in the same direction.
Ofcourse different directions usually make the Stem to far apart from
each other to connect them.
Though, if you move a NoteColumn so that the Stems are very close,
they are connectable.
Sometimes this is very tedious, but quite often the below defined
pushNC works nicely:

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 {
   \Score
   \consists #Span_stem_engraver
 }
}
\new PianoStaff <<
 \new Staff = "1" {
     \pushNC
     g''4*1/8 s16.
 }
 \new Staff = "2" {
     \clef "bass"
     \override Beam.auto-knee-gap = 1
     \override Beam.positions =
     #(grob-transformer 'positions
       (lambda (grob original) (coord-translate original -1)))
     \override TupletBracket.direction = #DOWN
     \override TupletBracket.bracket-visibility = ##t
     \tuplet 5/4 {
       \crossStaff <b,! f>32[
       \change Staff = "1"
       c''' bis'
       \change Staff = "2"
       a <b, f>]

     }
 }
>>

HTH,
 Harm

reply via email to

[Prev in Thread] Current Thread [Next in Thread]