lilypond-user
[Top][All Lists]
Advanced

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

Workarounds for cross-staff


From: Paolo Prete
Subject: Workarounds for cross-staff
Date: Sat, 29 Feb 2020 18:20:13 +0100

Hello,

I am doing some experiments with the cross-staff and I want to show you how some limits and collisions can be bypassed through some workarounds that I would like to automate.
Cross-staff is achieved through two basic commands:

1) \change Staff
2) \crossStaff
 
And I show you how both the first and second command can cause problems.

An example is the following, in which the TupletBracket produces collisions with the NoteHead, as well as an incorrectly calculated Beam
( http://lilybin.com/m7bykt/1 )

%%%%%%%%%%%%%%%%%%%%%%%%%

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

staffUp = \change Staff = "upper"
staffDown = \change Staff = "lower"

{
  \new PianoStaff <<
    \new Staff = "upper" {
      s8 s  s
    }
    \new Staff = "lower"  {
      \stemDown
      \override TupletBracket.direction = #UP
      \override TupletBracket.bracket-visibility = ##t
      \tuplet 3/2 { \staffUp c''8[ \staffDown c' c'] }
    }
  >>
}

%%%%%%%%%%%%%%%%%%%%%%%%%

I solved both problems with this workaround, by adding a fake hidden note to the lower staff:
( http://lilybin.com/nv2o2o/1 )

%%%%%%%%%%%%%%%%%%%%%%%%%

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

{
  \new PianoStaff <<
    \new Staff = "upper" {
      \override TupletBracket.direction = #UP
      \override TupletBracket.staff-padding = 5
      \hide Rest
      \tuplet 3/2 { \ottava #1 \crossStaff c'''8 \ottava #0 r  r }
    }
    \new Staff = "lower"  {
      \stemDown
      \hide TupletBracket
      \hide TupletNumber
      \tuplet 3/2 { \once \hide NoteHead e'8[  c' c'] }
    }
  >>
}

%%%%%%%%%%%%%%%%%%%%%%%%%


But there is still a problem: as you can see, the staff-padding property on the TupletBracket is not set. This can be solved if I remove the \ crossStaff command, and manually adjust the stem length on the top staff

( http://lilybin.com/fl9qzx/1 )

%%%%%%%%%%%%%%%%%%%%%%%%%%

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

{
  \new PianoStaff <<
    \new Staff = "upper" \with {
      \override VerticalAxisGroup #'staff-staff-spacing = #'((minimum-distance . 11)
                                                             (padding . -11))
    }
    {
      \override TupletBracket.direction = #UP
      \override TupletBracket.staff-padding = 5
      \once \override Stem.length = 30
      \once \hide Flag
      \hide Rest
      \tuplet 3/2 { \ottava #1 c'''8 \ottava #0 r  r }
    }
    \new Staff = "lower"  {
      \stemDown
      \hide TupletBracket
      \hide TupletNumber
      \tuplet 3/2 { \once \hide NoteHead e'8[ c' c'] }
    }
  >>
}

%%%%%%%%%%%%%%%%%%%%%%%%%%

As you can see, by making all this manually, the problems disappear. At this point I ask you: is it possible to automatically increase the length of the stem in the upper staff until it meets a Beam or a aligned stem in the lower staff?
Obviously this is accomplished via the \crossStaff command, but I wonder if there is an alternative way to achieve the same automatic behavior.

Thanks for your attention and suggestions!
(Should/can I cross-post this to the dev ML as well?) 

reply via email to

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