lilypond-learning: Dynamics placement

 
 Dynamics placement
 ..................
 
 Dynamic markings will normally be positioned beneath the staff, but may
 be positioned above with the ‘\dynamicUp’ command.  They will be
 positioned vertically relative to the note to which they are attached,
 and will float below (or above) all within-staff objects such as
 phrasing slurs and bar numbers.  This can give quite acceptable results,
 as this example shows:
 
      \clef "bass"
      \key aes \major
      \time 9/8
      \dynamicUp
      bes4.~\f\< \( bes4 bes8 des4\ff\> c16 bes\! |
      ees,2.~\)\mf ees4 r8 |
      [image src="" alt="[image of music]" text="image of music"]
 
    However, if the notes and attached dynamics are close together the
 automatic placement will avoid collisions by displacing later dynamic
 markings further away, but this may not be the optimum placement, as
 this rather artificial example shows:
 
      \dynamicUp
      a4\f b\mf a\mp b\p
      [image src="" alt="[image of music]" text="image of music"]
 
 Should a similar situation arise in ‘real’ music, it may be preferable
 to space out the notes a little further, so the dynamic markings can all
 fit at the same vertical distance from the staff.  We were able to do
 this for markup text by using the ‘\textLengthOn’ command, but there is
 no equivalent command for dynamic marks.  So we shall have to work out
 how to do this using ‘\override’ commands.