[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Combining crossStaff with a central beam
From: |
Thomas Morley |
Subject: |
Re: Combining crossStaff with a central beam |
Date: |
Sun, 20 Feb 2022 15:59:33 +0100 |
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
atest-109.cropped.png
Description: PNG image