Next: , Up: Tweaking output


5.1 Moving objects

This may come as a surprise, but LilyPond is not perfect. Some notation elements can overlap. This is unfortunate, but (in most cases) is easily solved.

     
     e4^\markup{ \italic ritenuto } g b e

[image of music]

The easiest solution is to increase the distance between the object (in this case text, but it could easily be fingerings or dynamics instead) and the note. In LilyPond, this is called the padding property; it is measured in staff spaces. For most objects, this value is around 1.0 or less (it varies with each object). We want to increase it, so let's try 1.5

     
     \once \override TextScript #'padding = #1.5
     e4^\markup{ \italic ritenuto } g b e

[image of music]

That looks better, but it isn't quite big enough. After experimenting with a few values, we think 2.3 is the best number in this case. However, this number is merely the result of experimentation and my personal taste in notation. Try the above example with 2.3... but also try higher (and lower) numbers. Which do you think looks the best?

The staff-padding property is closely related. padding controls the minimum amount of space between an object and the nearest other object (generally the note or the staff lines); staff-padding controls the minimum amount of space between an object and the staff. This is a subtle difference, but you can see the behavior here.

     
     c4^"piu mosso" b a b
     \once \override TextScript #'padding = #2.6
     c4^"piu mosso" d e f
     \once \override TextScript #'staff-padding = #2.6
     c4^"piu mosso" fis a g
     \break
     c'4^"piu mosso" b a b
     \once \override TextScript #'padding = #2.6
     c4^"piu mosso" d e f
     \once \override TextScript #'staff-padding = #2.6
     c4^"piu mosso" fis a g

[image of music]

Another solution gives us complete control over placing the object – we can move it horizontally or vertically. This is done with the extra-offset property. It is slightly more complicated and can cause other problems. When we move objects with extra-offset, the movement is done after LilyPond has placed all other objects. This means that the result can overlap with other objects.

     
     \once \override TextScript #'extra-offset = #'( 1.0 . -1.0 )
     e4^\markup{ \italic ritenuto } g b e

[image of music]

With extra-offset, the first number controls the horizontal movement (left is negative); the second number controls the vertical movement (up is positive). After a bit of experimenting, we decided that these values look good

     
     \once \override TextScript #'extra-offset = #'( -1.6 . 1.0 )
     e4^\markup{ \italic ritenuto } g b e

[image of music]

Again, these numbers are simply the result of a few experiments and looking at the output. You might prefer the text to be slightly higher, or to the left, or whatever. Try it and look at the result!

One final warning: in this section, we used

\once \override TextScript ...

This tweaks the display of text for the next note. If the note has no text, this tweak does nothing (and does not wait until the next bit of text). To change the behavior of everything after the command, omit the \once. To stop this tweak, use a \revert. This is explained in depth in The \override command.

     
     c4^"piu mosso" b
     \once \override TextScript #'padding = #2.6
       a4 b
     c4^"piu mosso" d e f
     \once \override TextScript #'padding = #2.6
     c4^"piu mosso" d e f
     c4^"piu mosso" d e f
     \break
     \override TextScript #'padding = #2.6
     c4^"piu mosso" d e f
     c4^"piu mosso" d e f
     \revert TextScript #'padding
     c4^"piu mosso" d e f

[image of music]

See also

This manual: The \override command, Common tweaks.


Next: , Up: Tweaking output

This page is for LilyPond-2.10.33 (stable-branch).

Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.