Home
Random
Log in
Settings
About LilyPond wiki
LilyPond wiki
Search
Editing
Bracketed accidentals
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
The code in this snippet defines a new command <code>\bracketAcc</code> to put brackets around an accidental. It also works in chords. Note that you have to use a trailing β<code>?</code>β character after the note in the input to enforce a cautionary accidental. <lilypond version="2.24" full> % Based on code from Abraham Lee % % https://lists.gnu.org/archive/html/lilypond-user/2016-11/msg00928.html #(define make-bracketed (grob-transformer 'stencil (lambda (grob orig) (let* ((paren-stil (grob-interpret-markup grob (markup #:musicglyph "accidentals.leftparen"))) (ext (ly:stencil-extent paren-stil Y)) (stil (ly:accidental-interface::print grob)) (thick (ly:output-def-lookup (ly:grob-layout grob) 'line-thickness 0.1)) (padding thick) (protrusion (* 2.5 thick)) (lb (ly:bracket Y ext thick protrusion)) (rb (ly:bracket Y ext thick (- protrusion)))) (set! stil (ly:stencil-combine-at-edge stil X 1 rb padding)) (set! stil (ly:stencil-combine-at-edge stil X -1 lb padding)) stil)))) bracketAcc = \tweak AccidentalCautionary.parenthesized ##f \tweak AccidentalCautionary.stencil #make-bracketed \etc { <c'' es''? fis''>1 <c'' \bracketAcc es''? fis''>1 } \paper { tagline = ##f } </lilypond> [[Category:Editorial annotations]] [[Category:Tweaks and overrides]] [[Category:Pitches]] [[Category:Snippet]]
Summary:
Please note that all contributions to LilyPond wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Meta:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)