lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Parenthesize a group of notes with a square bracket


From: Matthew Fong
Subject: Re: Parenthesize a group of notes with a square bracket
Date: Mon, 7 Oct 2024 08:45:21 -0700

Thank you, Trevor and Mats, for the insights!

On Sun, Oct 6, 2024 at 1:20 PM Mats Bengtsson <matsboxergrand@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 <oxengen@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

2/ Using brackets instead of parentheses for \parenthesize

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.

--

reply via email to

[Prev in Thread] Current Thread [Next in Thread]