2

When trying to create an ossia Staff, that is used multiple times, above a PianoStaff, Lilypond does not reuse the context, but creates a new one. How can I tell Lilypond to find the existing context outside the PianoStaff?

\version "2.20.0"
<<
  \new Staff = "ossia" \with {
    \remove "Time_signature_engraver"
    \remove "Clef_engraver"
    fontSize = #-3
    \override StaffSymbol.staff-space = #(magstep -3)
    \override StaffSymbol.thickness = #(magstep -3)
    %alignAboveContext = "left"
  }
  { \stopStaff s1*5 }

  %\new PianoStaff = "piano" \with { instrumentName = "Piano" } % <<< if I add this, it does not find the context anymore
  <<
    \new Staff = "right" \relative {
      c'4 b c2
      <<
        { e4 f }
        \context Staff = "ossia" {
          \startStaff e4 e8 f \stopStaff
        }
      >> e2
      g4 a g2
      <<
        { g4 a }
        \context Staff = "ossia" { 
          %\change Staff = "ossia"
          \startStaff g4 e8 f \stopStaff
          %\change Staff = "right"
        }
      >> g2
      e4 d c2
  }
  \new Staff = "left" \relative { \clef F c1 c c c c }
  >>
>>

Without PianoStaff: Ossia Staff without PianoStaff

With PianoStaff: Ossia Staff with PianoStaff

Note: I also tried to add the ossia Staff inside the PianoStaff: that works for the ossia staff, but it centers the name of the instument wrongly: Ossia Staff inside PianoStaff

  • 1
    You should probably stick with the last one and mess with \override Staff.InstrumentName.extra-offset = ..., or whatever property will give you the spacing you want. – Kilian Foth Apr 15 at 16:07
1

Does this work for you?

\version "2.20.0"

\new PianoStaff = "piano" \with {
  \override InstrumentName.extra-offset = #'(0 . -4)
  instrumentName = "Piano"
} <<
  \new Staff = "ossia" \with {
    \remove "Time_signature_engraver"
    \remove "Clef_engraver"
    fontSize = #-3
    \override StaffSymbol.staff-space = #(magstep -3)
    \override StaffSymbol.thickness = #(magstep -3)
    %alignAboveContext = "left"
  }
  { \stopStaff s1*5 }

  <<
    \new Staff = "right" \relative {
      c'4 b c2
      <<
    { e4 f }
    \context Staff = "ossia" {
      \startStaff e4 e8 f \stopStaff
    }
      >> e2
      g4 a g2
      <<
    { g4 a }
    \context Staff = "ossia" {
      %\change Staff = "ossia"
      \startStaff g4 e8 f \stopStaff
      %\change Staff = "right"
    }
      >> g2
      e4 d c2
    }
    \new Staff = "left" \relative { \clef F c1 c c c c }
  >>
>>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.