1 %% Do not edit this file; it is auto-generated from LSR http://lsr.dsi.unimi.it
2 %% This file is in the public domain.
6 lsrtags = "expressive-marks, tweaks-and-overrides"
9 Some dynamic expressions involve additional text, like \"sempre pp\".
10 Since lilypond aligns all dynamics centered on the note, the \\pp would
11 be displayed way after the note it applies to.
13 To correctly align the \"sempre \\pp\" horizontally, so that it is
14 aligned as if it were only the \\pp, there are several approaches:
16 * Simply use @code{\\once\\override DynamicText #'X-offset = #-9.2}
17 before the note with the dynamics to manually shift it to the correct
18 position. Drawback: This has to be done manually each time you use that
19 dynamic markup... * Add some padding (@code{#:hspace 7.1}) into the
20 definition of your custom dynamic mark, so that after lilypond
21 center-aligns it, it is already correctly aligned. Drawback: The
22 padding really takes up that space and does not allow any other markup
23 or dynamics to be shown in that position.
25 * Shift the dynamic script @code{\\once\\override ... #'X-offset = ..}.
26 Drawback: @code{\\once\\override} is needed for every invocation!
28 * Set the dimensions of the additional text to 0 (using
29 @code{#:with-dimensions '(0 . 0) '(0 . 0)}). Drawback: To lilypond
30 \"sempre\" has no extent, so it might put other stuff there and create
31 collisions (which are not detected by the collision dection!). Also,
32 there seems to be some spacing, so it's not exactly the same alignment
33 as without the additional text
35 * Add an explicit shifting directly inside the scheme function for the
38 * Set an explicit alignment inside the dynamic-script. By default, this
39 won't have any effect, only if one sets X-offset! Drawback: One needs
40 to set @code{DynamicText #'X-offset}, which will apply to all dynamic
41 texts! Also, it is aligned at the right edge of the additional text,
42 not at the center of pp.
48 doctitle = "Horizontally aligning custom dynamics (e.g. \"sempre pp\", \"piu f\", \"subito p\")"
51 \header { title = "Horizontally aligning custom dynamics" }
53 \paper { ragged-right = ##f }
55 % Solution 1: Using a simple markup with a particular halign value
56 % Drawback: It's a markup, not a dynamic command, so \dynamicDown
57 % etc. will have no effect
58 semppMarkup = \markup { \halign #1.4 \italic "sempre" \dynamic "pp" }
60 % Solution 2: Using a dynamic script & shifting with
61 % \once \override ... #'X-offset = ..
62 % Drawback: \once \override needed for every invocation
70 % Solution 3: Padding the dynamic script so the center-alignment
71 % puts it at the correct position
72 % Drawback: the padding really reserves the space, nothing else can be there
81 % Solution 4: Dynamic, setting the dimensions of the additional text to 0
82 % Drawback: To lilypond "sempre" has no extent, so it might put
83 % other stuff there => collisions
84 % Drawback: Also, there seems to be some spacing, so it's not exactly the
85 % same alignment as without the additional text
88 (markup #:line (#:with-dimensions '(0 . 0) '(0 . 0)
89 #:right-align #:normal-text #:italic "sempre" #:dynamic "pp")))
91 % Solution 5: Dynamic with explicit shifting inside the scheme function
95 #:hspace 0 #:translate '(-18.85 . 0)
96 #:line( #:normal-text #:italic "sempre" #:dynamic "pp")))
98 % Solution 6: Dynamic with explicit alignment. This has only effect, if one sets X-offset!
99 % Drawback: One needs to set DynamicText #'X-offset!
100 % Drawback: Aligned at the right edge of the additional text, not at the center of pp
102 #(make-dynamic-script (markup #:line(#:right-align
103 #:normal-text #:italic "sempre" #:dynamic "pp")))
105 \context StaffGroup <<
106 \context Staff = "s" <<
107 \set Staff.instrumentName = "Normal"
110 c4\pp c\p c c | c\ff c c\pp c
113 \context Staff = "sMarkup" <<
114 \set Staff.instrumentName = \markup \column { Normal markup }
117 c4-\semppMarkup c\p c c | c\ff c c-\semppMarkup c
120 \context Staff = "sK" <<
121 \set Staff.instrumentName = \markup \column { Explicit shifting }
124 \once \override DynamicText #'X-offset = #-9.2
127 \once \override DynamicText #'X-offset = #-9.2
131 \context Staff = "sT" <<
132 \set Staff.instrumentName = \markup \column { Right padding }
135 c4\semppT c\p c c | c\ff c c\semppT c
138 \context Staff = "sM" <<
139 \set Staff.instrumentName = \markup \column { Setting dimension "to zero" }
142 c4\semppM c\p c c | c\ff c c\semppM c
145 \context Staff = "sG" <<
146 \set Staff.instrumentName = \markup \column { Shifting inside dynamics }
149 c4\semppG c\p c c | c\ff c c\semppG c
152 \context Staff = "sMII" <<
153 \set Staff.instrumentName = \markup \column { Alignment inside dynamics }
156 % Setting to ##f (false) gives the same result
157 \override DynamicText #'X-offset = #0
158 c4\semppMII c\p c c | c\ff c c\semppMII c