Dear Aaron, > 2020/09/12 14:25、Aaron Hill <lilyp...@hillvisions.com>のメール: > > On 2020-09-11 9:18 pm, Jun Tamura wrote: >> Hello, >> Is there an easy way to have a slur enclosed by parentheses or >> brackets? Some urtext editions use parenthesized slurs to indicate >> editorial additions. > > \parenthesize does not currently handle spanners, so you would need to do > some manual work. > > Consider: > > %%%% > \version "2.20.0" > > parenthesizeSlur = > -\tweak stencil > #(lambda (grob) > (let* ((cp (ly:grob-property grob 'control-points)) > (lp (grob-interpret-markup grob (markup #:teeny "("))) > (rp (grob-interpret-markup grob (markup #:teeny ")")))) > (set! lp (ly:stencil-aligned-to lp Y CENTER)) > (set! lp (ly:stencil-aligned-to lp X 0.2)) > (set! lp (ly:stencil-translate lp (first cp))) > (set! rp (ly:stencil-aligned-to rp Y CENTER)) > (set! rp (ly:stencil-aligned-to rp X -0.2)) > (set! rp (ly:stencil-translate rp (last cp))) > (list-set! cp 0 > (cons (cdr (ly:stencil-extent lp X)) > (cdr (first cp)))) > (list-set! cp (1- (length cp)) > (cons (car (ly:stencil-extent rp X)) > (cdr (last cp)))) > (ly:grob-set-property! grob 'control-points cp) > (apply ly:stencil-add (list lp rp > (ly:slur::print grob))))) > \etc > > { g'4\parenthesizeSlur ( > \parenthesizeSlur \( b' c''2 ) | > g'2\parenthesizeSlur ( f'4 e' ) \) } > %%%% > > > -- Aaron Hill<paren-slur.cropped.png>
Thank you! This is exactly what I was looking for. I think that this is worthwhile to be in the LSR. (I wish I could understand Scheme code better.) Jun