On 01/02/2023 02:56, Ahanu Banerjee wrote: > I am trying to modify the color of the ledger lines for a single note. My > understanding is that I need to use \stopStaff and \startStaff for this. > However, doing so causes the staff lines to be discontinuous. This rounds the > ends of the staff lines surrounding the point at which the staff is stopped > and causes adjacent notes to have increased horizontal spacing. How can this > be avoided? > > See code below. > > \version "2.24.0" > \language "english" > { g8 \stopStaff \startStaff > \once \override Staff.LedgerLineSpanner.color = green > g \stopStaff \startStaff g g }
Actually a known issue, https://gitlab.com/lilypond/lilypond/-/issues/3949 You can find a workaround there. It will change autobeaming and affect spacing even more, though. You could also try this alternative approach: \version "2.24.0" \language "english" \layout { \context { \Score \override StaffSymbol.width = #(lambda (grob) (and (unbroken-or-last-broken-spanner? grob) (not (let ((sys (ly:grob-system grob))) (and (unbroken-or-last-broken-spanner? sys) (eq? (ly:spanner-bound grob RIGHT) (ly:spanner-bound sys RIGHT))))) (+ (interval-end (ly:paper-column::break-align-width (ly:spanner-bound grob RIGHT) (ly:grob-property grob 'break-align-symbols))) 0.1))) } } { g8 \stopStaff \startStaff \once \override Staff.LedgerLineSpanner.color = green g \stopStaff \startStaff g g } Basically, it increases the width of the first staff symbol by a tad in such a situation in order to make the two overlap. The effect on spacing is caused by the "paper column" objects that holds the start/end point of the staff symbols between notes being marked as "used" because of those staff symbols. You cannot prevent a column from being marked as used (and if you could, it would mess up), but as a workaround, you can mark the column between the third and the fourth note, the one where no staff symbol starts/ends, as used, like this: { g8 \stopStaff \startStaff \once \override Staff.LedgerLineSpanner.color = green g \stopStaff \startStaff g \once \override Score.NonMusicalPaperColumn.used = ##t g } HTH, Jean
OpenPGP_signature
Description: OpenPGP digital signature