2

I created a new dynamic marking using the method described in the documentation.

What I have is this:

\version "2.22.1"
\language "english"

subitoMF = \markup { 
  \italic subito 
  \dynamic mf 
}

{ 
f'_\subitoMF
}

Is there a way to horizontally align this markup solely around the dynamic "mf" argument so that that part is easily centered on the notehead?

Thanks!

1 Answer 1

2

I guess this would be an option. Note that doing custom dynamics should not use ^-_ with markups, but #(make-dynamic-script ...). See the example for details, and also for why this matters.

\version "2.22.1"
\language "english"

#(define-markup-command (add-left layout props m1 m2) (markup? markup?)
   (let* ((stc1 (interpret-markup layout props m1))
          (stc2 (interpret-markup layout props m2)))
     (ly:stencil-combine-at-edge stc2 X LEFT stc1 0.6)))


submf =
\tweak self-alignment-X ##f
#(make-dynamic-script
  (markup
   #:add-left
   #:normal-text #:italic "subito"
   #:dynamic #:center-align "mf"))


subitoMF = \markup { 
  \add-left
  \italic subito 
  \center-align
  \dynamic mf 
}

{ 
R1 f'_\subitoMF\> f' f' f' f'1\p R1 f'4\submf\> f' f' f' f'1\p
}
2
  • > Note that doing custom dynamics [etc.] I tried make-dynamic-script first but being a noob in Scheme I didn't know how to best work with halignment. I read up on creating markup commands to understand what you did. The command you created is very useful. I added the following when the marking appeared in the 1st beat of a bar in the middle of a system in order to avoid an unseemly space at the beginning of the bar: \once \override DynamicText.X-extent = #'(-2 . 2) \once \override DynamicText.whiteout-style = #'box \once \override DynamicText.whiteout = ##t Feb 8, 2022 at 13:44
  • 1
    @PedroTecla Sure. Note that instead of setting DynamicText.whiteout to #t you can also set it to a number, which would then be used as padding for the whiteout. E.g. \once \override DynamicText.whiteout = #1.3 or something.
    – Lazy
    Feb 8, 2022 at 22:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.