On Mon, 2025-11-03 at 10:44 -0800, Donald J. Stewart wrote:
> I'm trying to parenthesize (or even bracket) a group of grace notes.
> I've
> looked through the Lilypond Notation Reference, but haven't had any
> luck. It
> seems to me that \parenthesize and \parenthesize off would be great
> commands.
The open and close parens don't work for grace notes as the syntax
starts with \grace rather than a note.
The commands for opening and closing parens in the Chords menu define
commands \startParenthesize and \endParenthesize
which need to be inserted at the notes, thus:
\grace { \startParenthesize\parenthesize d''8 \endParenthesize\parenthesize c''
}
The following Scheme script does the open paren (cloned from the Chords
menu one):
;; OpenParenthesizeNote
(let ((tag "OpenParenthesizeNote"))
(if (d-Directive-note? tag)
(d-DirectiveDelete-note tag)
(begin
(d-LilyPondDefinition (cons "startParenthesize"
(if (d-CheckLilyVersion "2.24.0")
" \\once \\override Parentheses.stencils = #(lambda (grob)
(let ((par-list (parentheses-interface::calc-parenthesis-stencils
grob)))
(list (car par-list) point-stencil)))"
" \\once \\override ParenthesesItem.stencils = #(lambda (grob)
(let ((par-list (parentheses-item::calc-parenthesis-stencils grob)))
(list (car par-list) point-stencil )))")))
(d-DirectivePut-note-prefix tag "\\startParenthesize\\parenthesize ")
(d-DirectivePut-note-display tag "(")))
(d-SetSaved #f))
With a corresponding one to close the parens.
HTH
Richard