When I use the parenthesizeMusic function or the snippet in LSR-902 with a
winged repeat bar, the parenthesis collides with the bar. I have not been
able to find a way to pad the bar or the parentheses in a way that avoids
this.
[in this code I could simply reduce the font size, but that does not fix
the issue in my score]
\relative c''
{
\override ParenthesesItem.font-size = 7
\override ParenthesesItem.extra-offset =
#(lambda (grob) (cons 0 (* -1/2 (ly:grob-staff-position grob))))
g2 r4
\parenthesizeMusic {
d'8 bes8
}
\bar":|]"
}
On Thu, Jul 1, 2021 at 12:59 AM Aaron Hill <[email protected]> wrote:
> On 2021-06-30 9:07 pm, Aaron Hill wrote:
> > On 2021-06-30 9:00 pm, Mark Probert wrote:
> >> Hi.
> >>
> >> I've looked through docs and snippets and can't seem to find a way to
> >> place parens around a horizontal group of notes (an "optional"
> >> indicator for leadsheets). I've tried
> >>
> >> \parenthesize { a8 bes }
> >>
> >> but nope. Is there a simple way? I want to do something like:
> >>
> >> \mark "(" a8 bes \mark ")"
> >>
> >> and have the parens aligned on the center of the staff.
> >
> > Does LSR 902 [1] help?
> >
> > [1]: https://lsr.di.unimi.it/LSR/Item?id=902
> >
>
> Or perhaps this which might be easier to use if this sort of thing
> occurs often:
>
> %%%%
> \version "2.22.0"
>
> parenthesizeMusic =
> #(define-music-function (music) (ly:music?)
> (define ((stencils which) grob)
> (let* ((stens (parentheses-item::calc-parenthesis-stencils grob))
> (sten (which stens)))
> (if (eq? which first) (list sten point-stencil) (list point-stencil
> sten))))
> (define (add-tweak event tweak)
> (ly:music-set-property! event 'tweaks
> (cons tweak (ly:music-property event 'tweaks '()))))
> (let ((evs (extract-typed-music music 'rhythmic-event)))
> (ly:music-set-property! (first evs) 'parenthesize #t)
> (add-tweak (first evs) `((ParenthesesItem . stencils) . ,(stencils
> first)))
> (ly:music-set-property! (last evs) 'parenthesize #t)
> (add-tweak (last evs) `((ParenthesesItem . stencils) . ,(stencils
> second))))
> music)
>
> {
> \override ParenthesesItem.font-size = 5
> \override ParenthesesItem.extra-offset =
> #(lambda (grob) (cons 0 (* -1/2 (ly:grob-staff-position grob))))
> \parenthesizeMusic { <c' c''> d' e' f' g' }
> }
> %%%%
>
>
> -- Aaron Hill