[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-user
Subject:    Workarounds for cross-staff
From:       Paolo Prete <paolopr976 () gmail ! com>
Date:       2020-02-29 17:20:13
Message-ID: CA+Xftr-Z-Q=JNPaVTpzs4+rGZk9ub-KOWHH0+XCf1=T9XYiJog () mail ! gmail ! com
[Download RAW message or body]

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?)

[Attachment #3 (text/html)]

<div dir="ltr">Hello,<br><br>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.<br>Cross-staff is achieved through two \
basic commands:<br><br>1) \change Staff<br>2) \crossStaff<br>  <br>And I show you how \
both the first and second command can cause problems.<br><br>An example is the \
following, in which the TupletBracket produces collisions with the NoteHead, as well \
as an incorrectly calculated Beam<br>( <a \
href="http://lilybin.com/m7bykt/1">http://lilybin.com/m7bykt/1</a> \
)<br><br>%%%%%%%%%%%%%%%%%%%%%%%%%<br><br>\layout {<br>   \context {<br>      \
\PianoStaff<br>      \consists #Span_stem_engraver<br>   }<br>}<br><br>staffUp = \
\change Staff = &quot;upper&quot;<br>staffDown = \change Staff = \
&quot;lower&quot;<br><br>{<br>   \new PianoStaff &lt;&lt;<br>      \new Staff = \
&quot;upper&quot; {<br>         s8 s   s<br>      }<br>      \new Staff = \
&quot;lower&quot;   {<br>         \stemDown<br>         \override \
TupletBracket.direction = #UP<br>         \override TupletBracket.bracket-visibility \
= ##t<br>         \tuplet 3/2 { \staffUp c&#39;&#39;8[ \staffDown c&#39; c&#39;] \
}<br>      }<br>   &gt;&gt;<br>}<br><br>%%%%%%%%%%%%%%%%%%%%%%%%%<br><br>I solved \
both problems with this workaround, by adding a fake hidden note to the lower \
staff:<br>( <a href="http://lilybin.com/nv2o2o/1">http://lilybin.com/nv2o2o/1</a> \
)<br><br>%%%%%%%%%%%%%%%%%%%%%%%%%<br><br>\layout {<br>   \context {<br>      \
\PianoStaff<br>      \consists #Span_stem_engraver<br>   }<br>}<br><br>{<br>   \new \
PianoStaff &lt;&lt;<br>      \new Staff = &quot;upper&quot; {<br>         \override \
TupletBracket.direction = #UP	<br>         \override TupletBracket.staff-padding = \
5<br>         \hide Rest<br>         \tuplet 3/2 { \ottava #1 \crossStaff \
c&#39;&#39;&#39;8 \ottava #0 r   r }<br>      }<br>      \new Staff = \
&quot;lower&quot;   {<br>         \stemDown<br>         \hide TupletBracket<br>       \
\hide TupletNumber<br>         \tuplet 3/2 { \once \hide NoteHead e&#39;8[   c&#39; \
c&#39;] }<br>      }<br>   \
&gt;&gt;<br>}<br><br>%%%%%%%%%%%%%%%%%%%%%%%%%<br><br><br>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<br><br>( <a \
href="http://lilybin.com/fl9qzx/1">http://lilybin.com/fl9qzx/1</a> \
)<br><br>%%%%%%%%%%%%%%%%%%%%%%%%%%<br><br>\layout {<br>   \context {<br>      \
\PianoStaff<br>      \consists #Span_stem_engraver<br>   }<br>}<br><br>{<br>   \new \
PianoStaff &lt;&lt;<br>      \new Staff = &quot;upper&quot; \with {<br>         \
\override VerticalAxisGroup #&#39;staff-staff-spacing = #&#39;((minimum-distance . \
11)<br>                                                                               \
(padding . -11))<br>      }<br>      {<br>         \override TupletBracket.direction \
= #UP	<br>         \override TupletBracket.staff-padding = 5<br>         \once \
\override Stem.length = 30<br>         \once \hide Flag<br>         \hide Rest<br>    \
\tuplet 3/2 { \ottava #1 c&#39;&#39;&#39;8 \ottava #0 r   r }<br>      }<br>      \
\new Staff = &quot;lower&quot;   {<br>         \stemDown<br>         \hide \
TupletBracket<br>         \hide TupletNumber<br>         \tuplet 3/2 { \once \hide \
NoteHead e&#39;8[ c&#39; c&#39;] }<br>      }<br>   \
&gt;&gt;<br>}<br><br>%%%%%%%%%%%%%%%%%%%%%%%%%%<br><br>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?<br>Obviously this is accomplished via the \
\crossStaff command, but I wonder if there is an alternative way to achieve the same \
automatic behavior.<br><br>Thanks for your attention and suggestions!<br>(Should/can \
I cross-post this to the dev ML as well?)  <br></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic