Hi Jim, hi Kieren, I would strongly suggest to be careful with using extra-offset. Extra-offset is applied *after* the spacing is resolved, and will this not affect spacing! This means that that collisions with the new position are not avoided, but instead collisions with the old positions are avoided.
Consider this: \relative c'' { \clef treble << { \pitchedTrill c'1~\startTrillSpan des c1*7/8 s8 \stopTrillSpan } \\ { \pitchedTrill a1~\f -\tweak TrillSpanner.extra-offset #'(0 . 3.5) \startTrillSpan bes a1*7/8 s8 \stopTrillSpan } >> } This is Kieren’s code with a simple dynamic marking added. Notice how this marking is absolutely off, because Lilypond places it under the position where the trill span would have been. Rather the more sensible approach would be to tweak the TrillSpan.Y-offset. This will not allow the trill spanner to be placed within the staff, as trill spanners are outside staff grobs, so Lilypond will never place them inside the staff. So to get this to work we simply need to tell Lilypond that this thing is not to be handled as outside staff by tweaking TrillSpan.outside-staff- priority to #f. This still poses a bit of a problem if for example we transpose the music or if we change the clef: mus = \relative c'' { << { \pitchedTrill c'1~\startTrillSpan des c1*7/8 s8 \stopTrillSpan } \\ { \pitchedTrill a1~\f -\tweak TrillSpanner.Y-offset #0.2 -\tweak TrillSpanner.outside-staff-priority ##f \startTrillSpan bes a1*7/8 s8 \stopTrillSpan } >> } { \clef treble \mus \clef "treble^8" \mus } But we can in fact implement a simple function that tries to fit the TrillSpanner (or in fact any spanner) to the notes. Consult the appended file for details. Cheers, Valentin Am Freitag, 5. August 2022, 18:14:54 CEST schrieb Kieren MacMillan: > Hi Jim, > > There are many ways to do this, but the easies would probably be to tweak > the extra-offset: > > \version "2.20.0" > > \relative c'' { > \clef treble > << > { > \pitchedTrill c'1~\startTrillSpan des c1*7/8 s8 \stopTrillSpan > } > \\ > { > \pitchedTrill a1~ -\tweak TrillSpanner.extra-offset #'(0 . 3.5) > \startTrillSpan bes a1*7/8 s8 \stopTrillSpan } > > } > > You might also want to use whiteout? > > Hope that helps! > Kieren.
\version "2.22.0" #(define (spanner-y-from-elts grob) (let* ((elts (ly:grob-array->list (ly:grob-object grob 'note-columns))) (positions (map (lambda (g) (ly:grob-property g 'Y-offset)) elts)) (extents (map (lambda (g) (ly:grob-property g 'Y-extent)) elts)) (positions (map (lambda (p) (if (number? p) p 0)) positions)) (extents (map (lambda (e) (if (pair? e) e '(0 . 0))) extents)) (upper-positions (map (lambda (p e) (+ p (cdr e))) positions extents)) (lower-positions (map (lambda (p e) (+ p (car e))) positions extents)) (pos-up (apply min upper-positions)) (pos-down (apply max lower-positions)) (dir (ly:grob-property grob 'direction)) (ext (ly:grob-property grob 'Y-extent)) (det (ly:grob-property grob 'details)) (pad (assoc-get 'Y-padding det 0.8)) (pos-down (+ pos-down (car ext) (- pad))) (pos-up (+ pos-up (cdr ext) pad))) (if (< 0 dir) pos-up pos-down))) stickingTrillSpan = \tweak TrillSpanner.outside-staff-priority ##f \tweak TrillSpanner.Y-offset #spanner-y-from-elts \startTrillSpan stickingTrillSpanUP = \tweak TrillSpanner.direction #UP \stickingTrillSpan stickingTrillSpanDOWN = \tweak TrillSpanner.direction #DOWN \stickingTrillSpan %%% EXAMPLE mus = \relative c'' { <<{ \pitchedTrill c'1~^\f \stickingTrillSpan des c1*7/8 s8 \stopTrillSpan }\\{\pitchedTrill a1~\f \stickingTrillSpan bes a1*7/8 s8 \stopTrillSpan}>> } { \clef treble \mus \transpose c a, \mus \transpose c fis, \mus \transpose c c, \mus \transpose c a,, \mus \transpose c fis,, \mus \transpose c c,, \mus } % Using TrillSpanner.details.Y-padding to correct distance { f''1\stickingTrillSpanDOWN ~ 1 \stopTrillSpan 1\tweak TrillSpanner.details.Y-padding #0 \stickingTrillSpanDOWN ~ 1 \stopTrillSpan 1\tweak TrillSpanner.details.Y-padding #2 \stickingTrillSpanDOWN ~ 1 \stopTrillSpan 1\tweak TrillSpanner.details.Y-padding #-1 \stickingTrillSpanDOWN ~ 1 \stopTrillSpan }
signature.asc
Description: This is a digitally signed message part.