]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/new/creating-real-parenthesized-dynamics.ly
Imported Upstream version 2.18.2
[lilypond.git] / Documentation / snippets / new / creating-real-parenthesized-dynamics.ly
1 \version "2.16.0"
2
3 \header {
4   lsrtags = "expressive-marks, text, workaround"
5
6   texidoc = "
7 Although the easiest way to add parentheses to a dynamic mark is to use
8 a @code{\\markup} block, this method has a downside: the created
9 objects will behave like text markups, and not like dynamics.
10
11 However, it is possible to create a similar object using the equivalent
12 Scheme code (as described in the Notation Reference), combined with the
13 @code{make-dynamic-script} function. This way, the markup will be
14 regarded as a dynamic, and therefore will remain compatible with
15 commands such as @code{\\dynamicUp} or @code{\\dynamicDown}.
16
17
18
19 "
20   doctitle = "Creating \"real\" parenthesized dynamics"
21 }
22
23 paren =
24 #(define-event-function (parser location dyn) (ly:event?)
25    (make-dynamic-script
26     #{ \markup \concat {
27          \normal-text \italic \fontsize #2 (
28          \pad-x #0.2 #(ly:music-property dyn 'text)
29          \normal-text \italic \fontsize #2 )
30        }
31     #}))
32
33 \relative c'' {
34   c4\paren\f c c \dynamicUp c\paren\p
35 }