\version "2.13.1" % \paper { % ragged-right = ##f % } \markup \justify{Here, the hairpin is way too high due to the up-stem of the first note and the fact that the bounding box is a rectangle} \relative c'' { \key g \major \dynamicUp \stemUp b2\< \stemNeutral e,4 b | c2 e4 e | e2 d | e2\!\f d } \markup \justify{Setting the y-offset of the DynamicLineSpanner moves the hairpin, but it only works if I set the y-extent to an invalid value, which removes the hairpin from the skyline and the collision detection, too!!!} hairpinOffset = #(define-music-function (parser location posY) (number?) #{ \once \override DynamicLineSpanner #'Y-offset = $posY \once \override DynamicLineSpanner #'Y-extent = #(cons +0 -0.01) #}) \relative c'' { \key g \major \dynamicUp \hairpinOffset #3.5 \stemUp b2\< \stemNeutral e,4 b | c2 e4 e | e2 d | e2\!\f d } \markup\justify{A cross-measure hairpin ends at the measure-end, but it is so long that the bar number will be moved up very high -> UGLY!!!} \relative c'' { \dynamicUp \override Score.BarNumber #'break-visibility = #'#(#f #t #t) \stemUp b2\< \stemNeutral e,4 b | e2\!\f d } \markup\justify{A line-broken hairpin collides with the accidentals of the key signature and will be shown way too high.} \relative c'' { \key g \major \dynamicUp b2\< \stemNeutral e,4 b | c2 e4 e |\break e2 d | e2\!\f d } \markup\justify{The dynamicsAllInside function makes it possible to move dynamic signs inside the staff, but how can I move a hairpin up/down? I only manage to do it by also setting the Y-extent to an invalid value, which will completely ignore the hairpin for the vertical layout -> possible collisions, since the hairpin will be outside the skyline.} \relative c'' { \dynamicUp c2\pp\< a4 b | e2\!\f d } dynamicsAllInside = #(define-music-function (parser location offsetX posY) (number? number?) #{ \once \override DynamicText #'X-offset = $offsetX % \once \override DynamicText #'Y-extent = #(cons 1 -1) \once \override DynamicLineSpanner #'Y-extent = #(cons +0 -0.01) %#(cons 1 -1) \once \override DynamicText #'Y-offset = $(lambda (grob) (let* ((head (ly:grob-parent grob Y)) (offset (ly:grob-property head 'Y-offset))) (- posY offset (- 0.6)))) #}) \relative c'' { \dynamicUp \dynamicsAllInside #-2 #3 \once \override DynamicLineSpanner #'Y-offset = #4.4 c2\pp\< a4 b-.-> | e2\!\f d } \markup\justify{The dynamicsAllInside function completely removes the dynamic sign from the skyline, so that collisins will occur. I'm now looking for a way to move the dynamic sign inside the staff, but let it count towards the skyline and also use the part above the staff for collision prevention. In particular, the tempo mark is aligned as if the \dynamic ff is not there at all!} \relative c'' { \dynamicUp \tempo "Langsam" 4=60 \dynamicsAllInside #-1 #1.5 b2\ff c4 c | e2 d }