Thank you, Trevor and Mats, for the insights!

On Sun, Oct 6, 2024 at 1:20 PM Mats Bengtsson <matsboxergr...@gmail.com>
wrote:

> In LSR, you can also find https://lsr.di.unimi.it/LSR/Item?id=377
>
>    /Mats
> On 2024-10-06 21:52, Trevor Bača wrote:
>
>
>
> On Thu, Oct 3, 2024 at 2:24 PM Matthew Fong <oxen...@gmail.com> wrote:
>
>> Dear LilyPonders,
>>
>> I've been trying to combine two solutions in the LSR, but I haven't been
>> able to figure out how. I want *square brackets* for parenthesizing a group
>> of notes
>>
>> 1/ Parenthesize a group of notes using a Scheme function
>> https://lsr.di.unimi.it/LSR/Item?id=902
>>
>> 2/ Using brackets instead of parentheses for \parenthesize
>> https://lsr.di.unimi.it/LSR/Item?id=564
>>
>> Any advice would be appreciated.
>>
>
> Hi Matt,
>
> LSR gives these:
>
> %%% LSR 564 %%%
>
> #(define-public (bracket-stencils grob)
>   (let ((lp (grob-interpret-markup grob (markup #:fontsize 3.5 #:translate
> (cons -0.3 -0.5) "[")))
>         (rp (grob-interpret-markup grob (markup #:fontsize 3.5 #:translate
> (cons -0.3 -0.5) "]"))))
>     (list lp rp)))
>
> %%% LSR 902 %%%
>
> startParenthesis = {
>   \once \override Parentheses.stencils = #(lambda (grob)
>         (let ((par-list (parentheses-interface::calc-parenthesis-stencils
> grob)))
>           (list (car par-list) point-stencil )))
> }
>
> endParenthesis = {
>   \once \override Parentheses.stencils = #(lambda (grob)
>         (let ((par-list (parentheses-interface::calc-parenthesis-stencils
> grob)))
>           (list point-stencil (cadr par-list))))
> }
>
> %%% END %%%
>
> So plugging 564 into 902 maybe looks something like this:
>
> %%% 564 + 902 %%%
>
> \version "2.25.19"
>
> openBracket = {
>   \once \override Parentheses.stencils = #(lambda (grob)
>         (let ((par-list (*bracket-stencils* grob)))
>           (list (car par-list) point-stencil )))
> }
>
> closeBracket = {
>   \once \override Parentheses.stencils = #(lambda (grob)
>         (let ((par-list (*bracket-stencils* grob)))
>           (list point-stencil (cadr par-list))))
> }
>
> {
>   \override Parentheses.font-size = #5
>   \once \override Parentheses.extra-offset = #'(-1 . 0)
>   \openBracket
>   <c \parenthesize c'>
>   d' e' f'
>   \closeBracket
>   \parenthesize
>   g'
> }
>
> %%% END %%%
>
>
>
> HTH,
>
> Trevor.
>
> --
> Trevor Bača
> www.trevorbaca.com
> soundcloud.com/trevorbaca
>
>

Reply via email to