]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/user/tweaks.itely
Merge commit 'ce4b499'
[lilypond.git] / Documentation / user / tweaks.itely
index 8889fb21c743be004ecebb0a6cc515450d961526..7698e32f74beec66a2de099a7658c1f7474f291c 100644 (file)
 This chapter discusses how to modify output.  LilyPond is extremely
 configurable; virtually every fragment of output may be changed.
 
-TODO: This chapter is still under development and this version is
-somewhat experimental; nothing is fixed.  Don't translate yet!
-
-
 
 @menu
 * Tweaking basics::             
@@ -24,7 +20,6 @@ somewhat experimental; nothing is fixed.  Don't translate yet!
 * Appearance of objects::       
 * Placement of objects::        
 * Collisions of objects::       
-* Page layout::                 
 * Further tweaking::            
 @end menu
 
@@ -50,13 +45,13 @@ permit almost any desired appearance of the printed music to be
 achieved.
 
 In this section we cover the basic concepts required to understand
-tweaking.  Later we give a variety of potted commands which can
+tweaking.  Later we give a variety of ready-made commands which can
 simply be copied to obtain the same effect in your own scores, and
 at the same time we show how these commands may be constructed so 
 that you may learn how to develop your own tweaks.
 
 Before starting on this Chapter you may wish to review the section
-@ref{Contexts and engravers}, as Contexts, Engravers, and the 
+@ref{Contexts and engravers}, as Contexts, Engravers, and the
 Properties contained within them are fundamental to understanding
 and constructing Tweaks.
 
@@ -81,14 +76,16 @@ constructed.  That @code{Staff} object then holds all the
 properties associated with that particular staff, for example, its
 name and its key signature, together with details of the engravers
 which have been assigned to operate within that staff's context.
-Similarly, there are @code{Voice} objects, @code{Score} objects,
-@code{Lyric} objects, and objects to represent barlines,
-noteheads, ties, dynamics, etc, each with their own set of
-properties.
+Similarly, there are objects to hold the properties of all other
+contexts, such as @code{Voice} objects, @code{Score} objects,
+@code{Lyrics} objects, as well as objects to represent all
+notational elements such as bar lines,
+note heads, ties, dynamics, etc.  Every object has its own set of
+property values.
 
 Some types of object are given special names.  Objects which
 represent items of notation on the printed output such as
-noteheads, stems, slurs, ties, fingering, clefs, etc are called
+ note heads, stems, slurs, ties, fingering, clefs, etc are called
 @q{Layout objects}, often known as @q{Graphical Objects}, or
 @q{Grobs} for short.  These are still objects in the generic sense
 above, and so they too all have properties associated with them,
@@ -134,9 +131,12 @@ verbatim.
 @headitem Object/property type           
   @tab Naming convention
   @tab Example
-@item Contexts, Layout Objects     
+@item Contexts
+  @tab Aaaa or AaaaAaaaAaaa
+  @tab Staff, GrandStaff
+@item Layout Objects
   @tab Aaaa or AaaaAaaaAaaa
-  @tab Staff, GrandStaff, 
+  @tab Slur, NoteHead
 @item Engravers
   @tab Aaaa_aaa_engraver
   @tab Clef_engraver, Note_heads_engraver
@@ -162,7 +162,7 @@ properties.
 
 We have already met the commands @code{\set} and @code{\with},
 used to change the properties of @strong{contexts} and to remove
-and add @strong{engravers}, in 
+and add @strong{engravers}, in
 @ref{Modifying context properties} and @ref{Adding
 and removing engravers}.  We now must meet one more command.
 
@@ -186,10 +186,10 @@ of the layout object with the name
 @emph{layout_object}, which is a member of the @emph{context}
 context, to the value @emph{value}.
 
-The @emph{context} can be omitted (and usually is) when the 
+The @emph{context} can be omitted (and usually is) when the
 required context is unambiguously implied and is one of lowest
-level contexts, i.e., @code{Voice}, @code{ChordNames} or 
-@code{Lyrics}, and we shall omit it in many of the following 
+level contexts, i.e., @code{Voice}, @code{ChordNames} or
+@code{Lyrics}, and we shall omit it in many of the following
 examples.  We shall see later when it must be specified.
 
 For now, don't worry about the @code{#'}, which must precede the
@@ -211,22 +211,22 @@ commands have been issued.
 @end example
 
 Again, just like @emph{context} in the @code{\override} command,
-@emph{context} is often not needed.  It will be omitted 
+@emph{context} is often not needed.  It will be omitted
 in many of the following examples.
 
 There is another form of the override command, 
-@code{\overrideProperty}, which is occasionally required.  
+@code{\overrideProperty}, which is occasionally required.
 We mention it here for completeness, but for details see 
 @ruser{Difficult tweaks}.
 @c Maybe explain in a later iteration  -td
 
 The final tweaking command which is available is @code{\tweak}.
-It is not really a new command but a shorthand for an 
-@code{\override} command which must be used in a few special 
-circumstances.  Again, we shall not discuss or use it here.  
-You may find the details in 
+This should be used to change the properties of objects which
+occur at the same musical moment, such as the notes within a
+chord.  Using @code{\override} would affect all the notes
+within a chord, whereas @code{\tweak} affects just the following
+item in the input stream.  You may find the details in
 @ruser{Objects connected to the input}.
-@c Maybe explain in a later iteration  -td
 
 @node The Internals Reference manual
 @section The Internals Reference manual
@@ -276,12 +276,12 @@ music:
 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
 {
   \time 6/8
-  { 
+  {
     r4 b8 b[( g]) g | 
     g[( e]) e d[( f]) a | 
     a g
   }
-  \addlyrics { 
+  \addlyrics {
     The man who feels love's sweet e -- mo -- tion 
   }
 }
@@ -354,13 +354,13 @@ property name and and @code{#} preceding the new value!
 
 The final question is, @q{Where should this command be
 placed?}  While you are unsure and learning, the best 
-answer is, @q{Within the music, before the first slur and 
+answer is, @q{Within the music, before the first slur and
 close to it.}  Let's do that:
 
 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
 {
   \time 6/8
-  { 
+  {
     % Increase thickness of all following slurs from 1.2 to 5.0
     \override Slur #'thickness = #5.0
     r4 b8 b[( g]) g |
@@ -396,7 +396,7 @@ engraver}.  So slurs will be created in whichever context
 the @code{Slur_engraver} is in.  Follow the link to the
 @code{Slur_engraver} page.  At the very bottom it tells
 us that @code{Slur_engraver} is part of five Voice contexts,
-including the standard voice context, @code{Voice}, so our 
+including the standard voice context, @code{Voice}, so our
 guess was correct.  And because @code{Voice} is one of the
 lowest level contexts which is implied unambiguously by 
 the fact that we are entering notes, we can omit it in this 
@@ -408,7 +408,7 @@ location.
 @cindex once override
 @funindex \once
 
-As you can see, @emph{all} the slurs are thicker in the 
+As you can see, @emph{all} the slurs are thicker in the
 final example above.  But what if we
 wanted just the first slur to be thicker?  This is achieved
 with the @code{\once} command.  Placed immediately before
@@ -418,13 +418,13 @@ If the
 immediately following note does not begin a slur the command
 has no effect at all -- it is not remembered until a slur
 is encountered, it is simply discarded.  So the command with
-@code{\once} must be 
+@code{\once} must be
 repositioned as follows:
 
 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
 {
   \time 6/8
-  { 
+  {
     r4 b8
     % Increase thickness of immediately following slur only
     \once \override Slur #'thickness = #5.0
@@ -432,7 +432,7 @@ repositioned as follows:
     g[( e]) e d[( f]) a | 
     a g 
   }
-  \addlyrics { 
+  \addlyrics {
     The man who feels love's sweet e -- mo -- tion 
   }
 }
@@ -469,14 +469,14 @@ the slurs begin:
     g[( e]) e d[( f]) a | 
     a g
   }
-  \addlyrics { 
+  \addlyrics {
     The man who feels love's sweet e -- mo -- tion 
   }
 }
 @end lilypond 
 
 @noindent
-or we could omit the @code{\once} command and use the 
+or we could omit the @code{\once} command and use the
 @code{\revert} command
 to return the @code{thickness} property to its default value
 after the second slur:
@@ -495,7 +495,7 @@ after the second slur:
     e d[( f]) a | 
     a g
   }
-  \addlyrics { 
+  \addlyrics {
     The man who feels love's sweet e -- mo -- tion 
   }
 }
@@ -530,7 +530,7 @@ give an italic shape.
 This is because the shape property is one that is common to all
 font objects, so, rather than including it in every layout
 object, it is grouped together with other similar common
-properties and placed in an @strong{Interface}, the 
+properties and placed in an @strong{Interface}, the
 @code{font-interface}.
 
 So now we need to learn how to find the properties of interfaces,
@@ -539,7 +539,7 @@ and to discover what objects use these interface properties.
 Look again at the IR page which describes LyricText.  At the
 bottom of the page is a list of clickable (in the html versions
 of the IR) interfaces which LyricText supports.  The list has 
-seven items, including @code{font-interface}.  
+seven items, including @code{font-interface}.
 Clicking on this brings up the properties associated
 with this interface, which are also properties of all the objects
 which support it, including LyricText.
@@ -552,11 +552,11 @@ You will notice that that @code{font-series} and @code{font-size}
 are also listed there.
 This immediately raises the question: Why are the common font
 properties @code{font-series} and @code{font-size} listed under
-@code{LyricText} as well as under the interface 
+@code{LyricText} as well as under the interface
 @code{font-interface} but @code{font-shape} is not?  The answer
 is that @code{font-series} and @code{font-size} are changed
 from their global default values when a @code{LyricText} object
-is created, but @code{font-shape} is not.  The entries in 
+is created, but @code{font-shape} is not.  The entries in
 @code{LyricText} then tell you the values for those two
 properties which apply to @code{LyricText}.  Other objects
 which support @code{font-interface} will set these
@@ -564,7 +564,7 @@ properties diferently when they are created.
 
 Let's see if we can now construct the @code{\override} command
 to change the lyrics to italics.  The object is @code{LyricText},
-the property is @code{font-shape} and the value is 
+the property is @code{font-shape} and the value is
 @code{italic}.  As before, we'll omit the context.
 
 As an aside, although it is an important one, note that because 
@@ -572,7 +572,7 @@ the values of
 @code{font-shape} are symbols they must be introduced with a
 single apostrophe, @code{'}.  That is why apostrophes
 are needed before @code{thickness} in the earlier example
-and @code{font-shape}.  These are both symbols too.  
+and @code{font-shape}.  These are both symbols too.
 Symbols are special names which are known internally to 
 LilyPond.  Some of them are the names of properties,
 like @code{thickness} or @code{font-shape}, others are in
@@ -645,7 +645,7 @@ must be of the correct type and obey the rules for that type.
 The type of property is always shown in brackets after the
 property name in the IR.  Here is a list of the types you may 
 need, together with the rules for that type, and some examples.
-You must always add a hash symbol, @code{#}, of course, 
+You must always add a hash symbol, @code{#}, of course,
 to the front of these values when they are entered in the 
 @code{\override} command.
 
@@ -661,7 +661,7 @@ to the front of these values when they are entered in the
   @tab @code{2.5}, @code{0.34}
 @item Direction
   @tab A valid direction constant or its numerical equivalent
-  @tab @code{#LEFT}, @code{#CENTER}, @code{#UP}, 
+  @tab @code{#LEFT}, @code{#CENTER}, @code{#UP},
        @code{1}, @code{-1}
 @item Integer
   @tab A positive whole number
@@ -669,7 +669,7 @@ to the front of these values when they are entered in the
 @item List
   @tab A bracketed set of items separated by spaces,
 preceded by an apostrophe
-  @tab @code{'(left-edge staff-bar)}, @code{'(1)}, 
+  @tab @code{'(left-edge staff-bar)}, @code{'(1)},
        @code{'(1.0 0.25 0.5)}
 @item Markup
   @tab Any valid markup
@@ -677,7 +677,7 @@ preceded by an apostrophe
 @item Moment
   @tab A fraction of a whole note constructed with the 
 make-moment function
-  @tab @code{(ly:make-moment 1 4)}, 
+  @tab @code{(ly:make-moment 1 4)},
        @code{(ly:make-moment 3 8)}
 @item Number
   @tab Any positive or negative decimal value
@@ -692,12 +692,12 @@ preceded by an apostrophe
   @tab @code{'italic}, @code{'inside}
 @item Unknown
   @tab A procedure or @code{#f} (to cause no action)
-  @tab @code{bend::print}, @code{ly:text-interface::print}, 
+  @tab @code{bend::print}, @code{ly:text-interface::print},
        @code{#f}
 @item Vector
   @tab A list of three items enclosed in brackets and preceded
 by a hash sign, @code{#}.
-  @tab @code{#(#t #t #f)} 
+  @tab @code{#(#t #t #f)}
 @end multitable
 
 @node Appearance of objects
@@ -710,6 +710,7 @@ appearance of the printed music.
 @menu
 * Visibility and color of objects::  
 * Size of objects::             
+* Length and thickness of objects::  
 @end menu
 
 @node Visibility and color of objects
@@ -718,26 +719,40 @@ appearance of the printed music.
 In the educational use of music we might wish to print a score
 with certain elements omitted as an exercise for the student,
 who is required to supply them.  As a simple example,
-let us suppose the exercise is to supply the missing barlines 
-in a piece of music.  But the barlines are normally inserted
+let us suppose the exercise is to supply the missing bar lines 
+in a piece of music.  But the bar lines are normally inserted
 automatically.  How do we prevent them printing?
 
-As before, we go to the IR to find the layout object which prints
-barlines.  Going via @emph{Backend} and @emph{All layout objects}
+Before we tackle this, let us remember that object properties
+are grouped in what are called @emph{interfaces} -- see
+@ref{Properties found in interfaces}.  This is simply to
+group together those properties that are commonly required
+together -- if one of them is required for an object, so are
+the others.  Some objects then need the properties in some
+interfaces, others need them from other interfaces.  The
+interfaces which contain the properties required by a 
+particular grob are listed in the IR at the bottom of the
+page describing that grob, and those properties may be
+viewed by looking at those interfaces.
+
+We explained how to find information about grobs in 
+@ref{Properties of layout objects}.  Using the same approach,
+we go to the IR to find the layout object which prints
+bar lines.  Going via @emph{Backend} and @emph{All layout objects}
 we find there
 is a layout object called @code{BarLine}.  Its properties include
 two that control its visibility: @code{break-visibility} and
-@code{stencil}.  Barline also supports a number of interfaces, 
-including the @code{grob-interface}, where we find the 
+@code{stencil}.  Barline also supports a number of interfaces,
+including the @code{grob-interface}, where we find the
 @code{transparent} and the @code{color} properties.  All
-of these can affect the visibility of barlines (and, of course,
+of these can affect the visibility of bar lines (and, of course,
 by extension, many other layout objects too.)  Let's consider
 each of these in turn.
 
 @subheading stencil
 @cindex stencil property
 
-This property controls the appearance of the barlines by specifying
+This property controls the appearance of the bar lines by specifying
 the symbol (glyph) which should be printed.  In common
 with many other properties, it can be set to print nothing by 
 setting its value to @code{#f}.  Let's try it, as before, omitting
@@ -753,7 +768,7 @@ the implied Context, @code{Voice}:
 }
 @end lilypond
 
-The barlines are still printed.  What is wrong?  Go back to the
+The bar lines are still printed.  What is wrong?  Go back to the
 IR and look again at the page giving the properties of BarLine.
 At the top of the page it says @qq{Barline objects are created
 by: Bar_engraver}.  Go to the @code{Bar_engraver} page.
@@ -777,19 +792,19 @@ file.  Let's try correcting it by adding the correct context:
 }
 @end lilypond
 
-Now the barlines have vanished.
+Now the bar lines have vanished.
 
 @subheading break-visibility
 
 @cindex break-visibility property
 
-We see from the @code{BarLine} properties in the IR that the 
-@code{break-visibility} property requires a vector of three 
+We see from the @code{BarLine} properties in the IR that the
+@code{break-visibility} property requires a vector of three
 booleans.
-These control respectively whether barlines are printed at
+These control respectively whether bar lines are printed at
 the end of a line, in the middle of lines, and at the beginning
-of lines.  For our example we want all barlines to be suppressed,
-so the value we need is @code{#(#f #f #f)}.  
+of lines.  For our example we want all bar lines to be suppressed,
+so the value we need is @code{#(#f #f #f)}.
 Let's try that, remembering
 to include the @code{Staff} context.  Note also that in writing
 this value we have two hash signs before the opening bracket.
@@ -807,7 +822,7 @@ the @code{\override} command.
 }
 @end lilypond
 
-And we see this too removes all the barlines.
+And we see this too removes all the bar lines.
 
 @subheading transparent
 @cindex transparent property
@@ -817,13 +832,13 @@ page in the IR that the @code{transparent} property is a boolean.
 This
 should be set to @code{#t} to make the grob transparent.
 In this next example let us make the time signature invisible 
-rather than the barlines.  
+rather than the bar lines.  
 To do this we need to find the grob name for the time signature.
 Back to
 the @q{All layout objects} page in the IR to find the properties
 of the @code{TimeSignature} layout object.  This is produced by
 the @code{Time_signature_engraver} which you can check also lives
-in the @code{Staff} context and also supports the 
+in the @code{Staff} context and also supports the
 @code{grob-interface}.  So the command to make the time signature
 transparent is:
 
@@ -842,7 +857,7 @@ The time signature is gone, but this command leaves a gap where
 the time signature should be.  Maybe this is what is wanted for
 an exercise for the student to fill it in, but in other 
 circumstances a gap might be undesirable.  To remove it, the 
-stencil for the time signature should be set to @code{#f} 
+stencil for the time signature should be set to @code{#f}
 instead:
 
 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
@@ -863,7 +878,7 @@ leaves it where it is, but makes it invisible.
 @subheading color
 @cindex color property
 
-Finally we could make the barlines invisible by coloring
+Finally we could make the bar lines invisible by coloring
 them white.  The @code{grob-interface} specifies that the
 color property value is a list, but there is no
 explanation of what that list should be.  The list it
@@ -871,7 +886,7 @@ requires is actually a list of values in internal units,
 but, to avoid having to know what these are, several ways
 are provided to specify colors.  The first way is to use one
 of the @q{normal} colours listed in the first table in
-@ruser{List of colors}.  To set the barlines to white
+@ruser{List of colors}.  To set the bar lines to white
 we write:
 
 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
@@ -885,7 +900,7 @@ we write:
 @end lilypond
 
 @noindent
-and again, we see the barlines are not visible.  Note that
+and again, we see the bar lines are not visible.  Note that
 @emph{white} is not preceded by an apostrophe -- it is not
 a symbol, but a @emph{function}.  When called, it provides
 the list of internal values required to set the color to
@@ -975,7 +990,7 @@ found.
 
 Let us begin by looking again at the earlier example 
 see @ref{Nesting music expressions}) which showed
-how to introduce a new temporary staff, as in an @rglos{ossia}.  
+how to introduce a new temporary staff, as in an @rglos{ossia}.
 
 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
 \new Staff ="main" {
@@ -1079,17 +1094,17 @@ So we could replace the example above with
 Finally we come to changing the size of layout objects.
 
 Some layout objects are created as glyphs selected from
-a typeface font.  These include noteheads, accidentals, markup, 
+a typeface font.  These include note heads, accidentals, markup, 
 clefs, time signatures, dynamics and lyrics.  
 Their size is changed by modifying the
-@code{font-size} property, as we shall shortly see.  Other 
+@code{font-size} property, as we shall shortly see.  Other
 layout objects such as slurs and ties -- in general, spanner
 objects -- are drawn individually, so there is no 
 @code{font-size}
 associated with them.  These objects generally derive their
 size from the objects to which they are attached, so usually
 there is no need to change their size manually.  Still other 
-properties such as the length of stems and barlines, thickness 
+properties such as the length of stems and bar lines, thickness 
 of beams and other lines, and the separation of staff lines all 
 need to be modified in special ways. 
 
@@ -1137,16 +1152,34 @@ Let's try it in our ossia example:
 }
 @end lilypond
 
-This is still not quite right.  The noteheads and flags are 
+This is still not quite right.  The note heads and flags are 
 smaller, but the stems are too long in proportion and the
 staff lines are spaced too widely apart.  These need to be
-scaled down in proportion to the font reduction.
+scaled down in proportion to the font reduction.  The next
+sub-section discusses how this is done.
+
+@node Length and thickness of objects
+@subsection Length and thickness of objects
 
+@cindex Distances
+@cindex Thickness
+@cindex Length
 @cindex magstep
 @cindex size, changing
 @cindex stem length, changing
 @cindex staff line spacing, changing
 
+Distances and lengths in LilyPond are generally measured in
+staff-spaces, the distance between adjacent lines in the staff,
+(or occasionally half staff spaces) while most @code{thickness}
+properties are measured in units of an internal property called
+@code{line-thickness.}  For example, by default, the lines of
+hairpins are given a thickness of 1 unit of @code{line-thickness},
+while the @code{thickness} of a note stem is 1.3.  Note, though,
+that some thickness properties are different; for example, the
+thickness of beams is measured in staff-spaces.
+
+So how are lengths to be scaled in proportion to the font size?
 This can be done with the help of a special function called
 @code{magstep} provided for exactly this purpose.  It takes
 one argument, the change in font size (#-2 in the example above)
@@ -1165,7 +1198,7 @@ objects in proportion.  It is used like this:
         \override Clef #'stencil = ##f
         \override TimeSignature #'stencil = ##f
         fontSize = #-2
-        % Reduce stems and line spacing to match
+        % Reduce stem length and line spacing to match
         \override StaffSymbol #'staff-space = #(magstep -2)
       }
         { f8 f c }
@@ -1180,15 +1213,26 @@ Since the length of stems and many other length-related properties
 are always calculated relative to the
 value of the @code{staff-space} property these are automatically
 scaled down in length too.  Note that this affects only the
-vertical scale of the ossia -- the horizontal scale is determined 
+vertical scale of the ossia -- the horizontal scale is determined
 by the layout of the main music in order to remain synchronised 
 with it, so it is not affected by any of these changes in size.
 Of course, if the scale of all the main music were changed in this
 way then the horizontal spacing would be affected.  This is 
 discussed later in the layout section.
 
-This, then, completes the creation of an ossia.  The sizes of all
-other objects may be modified in analogous ways.
+This, then, completes the creation of an ossia.  The sizes and
+lengths of all other objects may be modified in analogous ways.
+
+For small changes in scale, as in the example above, the
+thickness of the various drawn lines such as bar lines,
+beams, hairpins, slurs, etc does not usually require global 
+adjustment.  If the thickness of any particular layout object
+needs to be adjusted this can be best achieved by overriding its
+@code{thickness} property.  An example of changing the thickness
+of slurs was shown above in @ref{Properties of layout objects}.
+The thickness of all drawn objects (i.e., those not produced
+from a font) may be changed in the same way. 
+
 
 @node Placement of objects
 @section Placement of objects
@@ -1213,7 +1257,7 @@ Within-staff objects are those that are located on the staff
 these are usually fixed by the music itself -- they are
 vertically positioned on specific lines of the staff or are 
 tied to other objects that are so positioned.  Collisions of
-noteheads, stems and accidentals in closely set chords are
+note heads, stems and accidentals in closely set chords are
 normally avoided automatically.  There are commands and
 overrides which can modify this automatic behaviour, as we
 shall shortly see.
@@ -1230,10 +1274,10 @@ First, LilyPond places all the within-staff objects.
 Then it sorts the outside-staff objects according to their 
 @code{outside-staff-priority}.  The outside-staff objects are
 taken one by one, beginning with the object with the lowest
-@code{outside-staff-priority}, and placed so that they do not 
+@code{outside-staff-priority}, and placed so that they do not
 collide with any objects that have already been placed. That is, 
 if two outside-staff grobs are competing for the same space, the 
-one with the lower @code{outside-staff-priority} will be placed 
+one with the lower @code{outside-staff-priority} will be placed
 closer to the staff.  If two objects have the same
 @code{outside-staff-priority} the one encountered first will be
 placed closer to the staff.
@@ -1268,10 +1312,6 @@ this @q{nestling} of the notes on adjacent staves:
 >>
 @end lilypond 
 
-@c TODO Mention somewhere, probably not here, how to avoid staves
-@c interleaving too much by specifying skyline-horizontal-padding
-@c Presumably this moves the skyline boundary further out, making
-@c objects appear wider?  Not yet tested.  -td
 
 @node Within-staff objects
 @subsection Within-staff objects
@@ -1323,52 +1363,50 @@ are simpler equivalent predefined commands available.
 Here is a table of the commonest.  The meaning of each is stated
 where it is not obvious.
 
-@c TODO put @code{} round all these
-
 @multitable @columnfractions .2 .2 .2 .4
 @headitem Down/Left           
   @tab Up/Right
   @tab Revert
-  @tab Effect 
-@item \arpeggioDown
-  @tab \arpeggioUp
-  @tab \arpeggioNeutral
+  @tab Effect
+@item @code{\arpeggioDown}
+  @tab @code{\arpeggioUp}
+  @tab @code{\arpeggioNeutral}
   @tab Arrow is at bottom, at top, or no arrow
-@item \dotsDown
-  @tab \dotsUp
-  @tab \dotsNeutral
+@item @code{\dotsDown}
+  @tab @code{\dotsUp}
+  @tab @code{\dotsNeutral}
   @tab Direction of movement to avoid staff lines
-@item \dynamicDown
-  @tab \dynamicUp
-  @tab \dynamicNeutral
+@item @code{\dynamicDown}
+  @tab @code{\dynamicUp}
+  @tab @code{\dynamicNeutral}
   @tab
-@item \phrasingSlurDown
-  @tab \phrasingSlurUp
-  @tab \phrasingSlurNeutral
+@item @code{\phrasingSlurDown}
+  @tab @code{\phrasingSlurUp}
+  @tab @code{\phrasingSlurNeutral}
   @tab Note: distinct from slur commands
-@item \slurDown     
-  @tab \slurUp
-  @tab \slurNeutral
+@item @code{\slurDown}
+  @tab @code{\slurUp}
+  @tab @code{\slurNeutral}
   @tab
-@item \stemDown
-  @tab \stemUp
-  @tab \stemNeutral
+@item @code{\stemDown}
+  @tab @code{\stemUp}
+  @tab @code{\stemNeutral}
   @tab
-@item \textSpannerDown
-  @tab \textSpannerUp
-  @tab \textSpannerNeutral
+@item @code{\textSpannerDown}
+  @tab @code{\textSpannerUp}
+  @tab @code{\textSpannerNeutral}
   @tab Text entered as spanner is below/above staff
-@item \tieDown
-  @tab \tieUp
-  @tab \tieNeutral
+@item @code{\tieDown}
+  @tab @code{\tieUp}
+  @tab @code{\tieNeutral}
   @tab
-@item \tupletDown
-  @tab \tupletUp
-  @tab \tupletNeutral
+@item @code{\tupletDown}
+  @tab @code{\tupletUp}
+  @tab @code{\tupletNeutral}
   @tab Tuplets are below/above notes
 @end multitable
 
-Note that these predefined commands may @strong{not} be 
+Note that these predefined commands may @strong{not} be
 preceded by @code{\once}.  If you wish to limit the
 effect to a single note you must either use the equivalent
 @code{\once \override} command or use the predefined command
@@ -1424,8 +1462,8 @@ property of the @code{Voice} context, created and used by the
 
 The property may be set to a list of one to three values.
 It controls whether fingerings may be placed above (if 
-@code{up} appears in the list), below (if @code{down} appears), 
-to the left (if @code{left} appears, or to the right 
+@code{up} appears in the list), below (if @code{down} appears),
+to the left (if @code{left} appears, or to the right
 (if @code{right} appears).  Conversely, if a location is not
 listed, no fingering is placed there.  LilyPond takes these 
 contraints and works out the best placement for the fingering
@@ -1486,37 +1524,146 @@ try @code{-7}:
 @subsection Outside staff objects
 
 Outside-staff objects are automatically placed to avoid collisions.
-Objects with the lower value of @code{outside-staff-priority} 
+Objects with the lower value of the @code{outside-staff-priority}
 property are placed nearer to the staff, and other outside-staff
-objects are then raised as far as necessary to avoid collisions.  
-The @code{outside-staff-priority} is defined in the 
+objects are then raised as far as necessary to avoid collisions.
+The @code{outside-staff-priority} is defined in the
 @code{grob-interface} and so is a property of all layout objects.
-It is set to @code{#f} (the default) for all within-staff objects,
-and is set explicitly to the default numerical value appropriate 
-to the each object as it is created.  The following table shows
-the default numerical values for some of the commonest 
-outside-staff objects.  Others may be found in the object 
-properties listed in the IR.
-
-@multitable @columnfractions .3 .3 
+By default it is set to @code{#f} for all within-staff objects,
+and to a numerical value appropriate to each outside-staff object
+when the object is created.  The following table shows
+the default numerical values for some of the commonest
+outside-staff objects which are, by default, placed in the
+@code{Staff} or @code{Voice} contexts.
+
+@multitable @columnfractions .3 .3 .3
+@headitem Layout Object           
+  @tab Priority     
+  @tab Controls position of:
+@item @code{MultiMeasureRestText}
+  @tab @code{450}
+  @tab Text over full-bar rests
+@item @code{TextScript}
+  @tab @code{450}
+  @tab Markup text
+@item @code{OttavaBracket}
+  @tab @code{400}
+  @tab Ottava brackets
+@item @code{TextSpanner}
+  @tab @code{350}
+  @tab Text spanners
+@item @code{DynamicLineSpanner}
+  @tab @code{250}
+  @tab All dynamic markings
+@item @code{VoltaBracketSpanner}
+  @tab @code{100}
+  @tab Volta brackets
+@item @code{TrillSpanner}
+  @tab @code{50}
+  @tab Spanning trills
+@end multitable
+
+Here is an example showing the default placement of some of
+these.
+
+@cindex text spanner
+@funindex \startTextSpan
+@funindex \stopTextSpan
+@cindex ottava bracket
+
+@lilypond[quote,fragment,ragged-right,verbatim,relative=1]
+% Set details for later Text Spanner
+\override TextSpanner #'bound-details #'left #'text
+    = \markup { \small \bold Slower }
+% Place dynamics above staff
+\dynamicUp
+% Start Ottava Bracket
+#(set-octavation 1)
+c' \startTextSpan
+% Add Dynamic Text
+c\pp
+% Add Dynamic Line Spanner
+c\<
+% Add Text Script
+c^Text
+c c
+% Add Dynamic Text
+c\ff c \stopTextSpan
+% Stop Ottava Bracket
+#(set-octavation 0)
+c, c c c
+@end lilypond
+
+This example also shows how to create Text Spanners --
+text with extender lines above a section of music.  The
+spanner extends from the @code{\startTextSpan} command to
+the @code{\stopTextSpan} command, and the format of the
+text is defined by the @code{\override TextSpanner} command.
+For more details see @ruser{Text spanners}.
+
+It also shows how ottava brackets are created.
+
+Note that bar numbers, metronome marks and rehearsal marks
+are not shown. By default these are created in the
+@code{Score} context and their @code{outside-staff-priority}
+is ignored relative to the layout objects which are created
+in the @code{Staff} context.
+If you wish to place bar numbers, metronome marks or rehearsal
+marks in accordance with the value of their
+@code{outside-staff-priority} the @code{Bar_number_engraver},
+@code{Metronome_mark_engraver} or @code{Mark_engraver} respectively
+should be removed from the @code{Score} context and placed in the
+top @code{Staff} context.  If this is done, these marks will be
+given the following default @code{outside-staff-priority} values:
+
+@multitable @columnfractions .3 .3
 @headitem Layout Object           @tab Priority
-@item @code{BarNumber}            @tab @code{ 100}
-@item @code{DynamicLineSpanner}   @tab @code{ 250}
-@item @code{DynamicText}          @tab @code{ 250}
-@item @code{MetronomeMark}        @tab @code{1000}
-@item @code{OttavaBracket}        @tab @code{ 400}
 @item @code{RehearsalMark}        @tab @code{1500}
-@item @code{TextScript}           @tab @code{ 450}
+@item @code{MetronomeMark}        @tab @code{1000}
+@item @code{BarNumber}            @tab @code{ 100}
 @end multitable
 
-TODO Add example showing iteraction of all these
+If the default values of @code{outside-staff-priority} does not
+give you the placing you want, the priority of any of the objects
+may be overridden.  Suppose we would
+like the ottava bracket to be placed below the text spanner in the
+example above.  All we need to do is to look up the priority of
+@code{OttavaBracket} in the IR or in the tables above, and reduce
+it to a value lower than that of a @code{TextSpanner}, remembering
+that @code{OttavaBracket} is created in the @code{Staff} context:
 
-If this ordering does not give you the placing you want, the
-priority of the objects may be overridden.  Suppose we would
+@lilypond[quote,fragment,ragged-right,verbatim,relative=1]
+% Set details for later Text Spanner
+\override TextSpanner #'bound-details #'left #'text
+    = \markup { \small \bold Slower }
+% Place dynamics above staff
+\dynamicUp
+%Place following Ottava Bracket below Text Spanners
+\once \override Staff.OttavaBracket #'outside-staff-priority = #340
+% Start Ottava Bracket
+#(set-octavation 1)
+c' \startTextSpan
+% Add Dynamic Text
+c\pp
+% Add Dynamic Line Spanner
+c\<
+% Add Text Script
+c^Text
+c c
+% Add Dynamic Text
+c\ff c \stopTextSpan
+% Stop Ottava Bracket
+#(set-octavation 0)
+c, c c c
+@end lilypond
+
+Changing the @code{outside-staff-priority} can also be used to
+control the vertical placement of individual objects, although
+the results may not always be desirable.  Suppose we would
 like @qq{Text3} to be placed above @qq{Text4} in the example
 under Automatic behaviour, above (see @ref{Automatic behaviour}).
 All we need to do is to look up the priority of @code{TextScript}
-in the IR or in the table above, and increase the priority of
+in the IR or in the tables above, and increase the priority of
 @qq{Text3} to a higher value:
 
 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
@@ -1529,24 +1676,25 @@ c^"Text4"
 
 This certainly lifts @qq{Text3} above @qq{Text4} but it also
 lifts it above @qq{Text2}, and @qq{Text4} now drops down.
-Perhaps this is not so good.  Can we instead position them all
-at the same distance from the staff?  To do this, we clearly
+Perhaps this is not so good.  What we would really like to do
+is to position all the annotation at the same distance above
+the staff?  To do this, we clearly
 will need to space the notes out horizontally to make more
-room for the text.  This is done using the @code{fatText}
+room for the text.  This is done using the @code{textLengthOn}
 command.
 
-@subheading \fatText
+@subheading \textLengthOn
 
-@funindex \fatText
+@funindex \textLengthOn
 @cindex notes, spreading out with text
 
 By default, text produced by markup takes up no horizontal space
-as far as laying out the music is concerned.  The @code{\fatText} 
-command reverses this behaviour, causing the notes to be spaced 
+as far as laying out the music is concerned.  The @code{\textLengthOn}
+command reverses this behaviour, causing the notes to be spaced
 out as far as is necessary to accommodate the text:
 
 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
-\fatText  % Cause notes to space out to accommodate text
+\textLengthOn  % Cause notes to space out to accommodate text
 c2^"Text1"
 c^"Text2"
 c^"Text3"
@@ -1554,9 +1702,9 @@ c^"Text4"
 @end lilypond  
 
 The command to revert to the default behaviour is 
-@code{\emptyText}.  Remember @code{\once} only works with
+@code{\textLengthOff}.  Remember @code{\once} only works with
 @code{\override}, @code{\set}, @code{\revert} or @code{unset},
-so cannot be used with @code{\fatText}.
+so cannot be used with @code{\textLengthOn}.
 
 Markup text will also avoid notes which project above the staff.
 If this is not desired, the automatic displacement upwards may
@@ -1579,7 +1727,7 @@ c''2
 R1
 % Turn off collision avoidance
 \once \override TextScript #'outside-staff-priority = ##f
-\fatText  % and turn on fatText
+\textLengthOn  % and turn on textLengthOn
 c,,2^"Long Text   "  % Spaces at end are honoured
 c''2
 @end lilypond
@@ -1616,11 +1764,11 @@ a4\f b\mf c\mp b\p
 @end lilypond
 
 @noindent
-Should a similar situation arise in @q{real} music, it may 
+Should a similar situation arise in @q{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 @code{\fatText} command, but there
+for markup text by using the @code{\textLengthOn} command, but there
 is no equivalent command for dynamic marks.  So we shall have to
 work out how to do this using @code{\override} commands.
 
@@ -1649,7 +1797,7 @@ These are properties of all grobs which support the
 
 By default, outside-staff objects are given a width of zero so
 that they may overlap in the horizontal direction.  This is done
-by by the trick of adding infinity to the leftmost extent and 
+by the trick of adding infinity to the leftmost extent and 
 minus infinity to the rightmost extent by setting the 
 @code{extra-spacing-width} to @code{'(+inf.0 . -inf.0)}.  So
 to ensure they do not overlap in the horizontal direction we
@@ -1701,16 +1849,17 @@ down with the notes.  The property to do this is
 @menu
 * Moving objects::              
 * Fixing overlapping notation::  
+* Real music example::          
 @end menu
 
 @node Moving objects
 @subsection Moving objects
 
-This may come as a surprise, but LilyPond is not perfect.  Some 
-notation elements can overlap.  This is unfortunate, but in fact 
+This may come as a surprise, but LilyPond is not perfect.  Some
+notation elements can overlap.  This is unfortunate, but in fact
 rather rare.  Usually the need to move objects is for clarity or
 aesthetic reasons -- they would look better with a little more
-space around them.
+or a little less space around them.
 
 There are three main main approaches to resolving overlapping
 notation.  They should be considered in the following order:
@@ -1724,41 +1873,46 @@ Stems, slurs, beams, ties, dynamics, text and tuplets may be
 repositioned easily in this way.  The limitation is that you
 have a choice of only two positions, and neither may be
 suitable.
-@smallspace
+
 @item
 The @strong{object properties}, which LilyPond uses
-when positioning layout objects, may be modified using 
+when positioning layout objects, may be modified using
 @code{\override}.  The advantages
 of making changes to this type of property are (a) that some
 other objects will be moved automatically if necessary to make
 room and (b) the single override can apply to all instances of
 the same type of object.  Such properties include:
 @itemize
-@smallspace
-@item @code{direction}
+
+@item
+@code{direction}
 
 This has already been covered in some detail -- see
 @ref{Within-staff objects}.
-@smallspace
-@item @code{padding}, @code{left-padding},
-      @code{right-padding}, @code{staff-padding}
+
+@item
+@code{padding}, @code{left-padding},
+@code{right-padding}, @code{staff-padding}
 
 @cindex left-padding property
 @cindex padding property
 @cindex right-padding property
 @cindex staff-padding property
-The @code{padding} property specifies the gap that must be left
-between
-the top and bottom edges of objects which are positioned
-either above or below another previously placed object, or
-between the sides of objects which are positioned to the left or
-right of previously placed objects.  @code{padding} can be applied
+As an object is being positioned the value of its @code{padding}
+property specifies the gap that must be left between itself and
+the nearest edge of the object against which it is being
+positioned.  Note that it is the @code{padding} value of the object
+@strong{being placed} that is used;
+the @code{padding} value of the object which is already placed is
+ignored.  Gaps specified by @code{padding} can be applied
 to all objects which support the @code{side-position-interface}.
 
 Instead of @code{padding}, the placement of groups of accidentals
 is controlled by @code{left-padding} and @code{right-padding}.
 These properties are to be found in the @code{AccidentalPlacement}
-object which, note, lives in the @strong{staff} context.
+object which, note, lives in the @strong{staff} context.  Because
+accidentals are always positioned after and to the left of
+note heads only the @code{right-padding} property has any effect.
 
 The @code{staff-padding} property is closely related to the
 @code{padding} property:  @code{padding}
@@ -1783,33 +1937,40 @@ All padding values are measured in staff spaces.  For most
 objects, this value is set by default to be around 1.0 or less
 (it varies with each object).  It may be overridden if a larger
 (or smaller) gap is required.
-@smallspace
-@item @code{self-alignment-X}
+
+@item
+@code{self-alignment-X}
 
 @cindex self-alignment-X property
-This property aligns the object to the left, to the right, or
-centers it with respect to the parent object's reference point.
-It may be used with all objects which support the
-@code{self-alignment-interface}.  In general these are objects
+This property can be used to align the object to the left, to 
+the right, or to center it with respect to the parent object's 
+reference point.  It may be used with all objects which support
+the @code{self-alignment-interface}.  In general these are objects
 that contain text.  The values are @code{LEFT}, @code{RIGHT}
-or @code{CENTER}.  The movement is limited by the length of the
-object.  Any numerical value between @code{-1} and @code{+1} may
-also be specified, where @code{-1} is left-aligned and @code{+1}
-is right-aligned.
-@smallspace
-@item @code{extra-spacing-width} property
+or @code{CENTER}.  Alternatively, a numerical value between 
+@code{-1} and @code{+1} may be specified, where @code{-1} is 
+left-aligned, @code{+1} is right-aligned, and numbers in between 
+move the text progressively from left-aligned to right-aligned.
+Numerical values greater than @code{1} may be specified to move
+the text even further to the left, or less than @code{-1} to
+move the text even further to the right.  A change of @code{1}
+in the value corresponds to a movement of half the text's length.
+
+@item
+@code{extra-spacing-width}
 
 @cindex extra-spacing-width property
 This property is available for all objects which support the
 @code{item-interface}.  It takes two numbers, the first is added
-to the leftmost extent and the second is added to the rightmost 
+to the leftmost extent and the second is added to the rightmost
 extent.  Negative numbers move the edge to the left, positive to
-the right.  Note that not all objects honour both numbers.  For
-example, the @code{Accidental} object only takes notice of the
-first (left edge) number.
+the right, so to widen an object the first number must be negative,
+the second positive.  Note that not all objects honour both
+numbers.  For example, the @code{Accidental} object only takes
+notice of the first (left edge) number.
 
-@smallspace
-@item @code{staff-position}
+@item
+@code{staff-position}
 
 @cindex staff-position property
 @code{staff-position} is a property of the
@@ -1818,17 +1979,41 @@ objects which are positioned relative to the staff.  It specifies
 the vertical position of the object relative to the center line
 of the staff in half staff-spaces.  It is useful in resolving
 collisions between layout objects like multi-measure rests, ties
-and notes in different voices.  
+and notes in different voices.
+
+@item
+@code{force-hshift}
+
+@cindex force-hshift property
+
+Closely spaced notes in a chord, or notes occuring at the same
+time in different voices, are arranged in two, occasionally more,
+columns to prevent the note heads overlapping.  These are called
+note columns, and an object called @code{NoteColumn} is created
+to lay out the notes in that column.
+
+The @code{force-hshift}
+property is a property of a @code{NoteColumn} (actually of the
+@code{note-column-interface}).  Changing it permits a note column
+to be moved in units appropriate to a note column, viz. the note
+head width of the first voice note.  It should be used in
+complex situations where the normal @code{\shiftOn} commands (see
+@ref{Explicitly instantiating voices}) do
+not resolve the note conflict.  It is preferable to the
+@code{extra-offset} property for this purpose as there is no need
+to work out the distance in staff-spaces, and moving the notes
+into or out of a @code{NoteColumn} affects other actions such as
+merging note heads.
 
 @end itemize
 
 Objects do not all have all of these properties in general.
 It is necessary to go to the IR to look up which properties
 are available for the object in question.
-@smallspace
+
 @item
-Finally, when all else fails, objects may be repositioned 
-vertically relative to the staff center line, or by
+Finally, when all else fails, objects may be manually repositioned
+relative to the staff center line verically, or by
 displacing them by any distance to a new position.  The
 disadvantages are that the correct values for the repositioning
 have to be worked out, often by trial and error, for every object
@@ -1838,10 +2023,9 @@ collisions that might ensue.  But the main difficulty with this
 approach is that the repositioning values may need to be reworked
 if the music is later modified.  The properties that can be used
 for this type of manual repositioning are:
-@itemize
-@smallspace
-@item @code{extra-offset}
 
+@table @code
+@item extra-offset
 @cindex extra-offset property
 This property applies to any layout object
 supporting the @code{grob-interface}.  It takes a pair of
@@ -1851,33 +2035,20 @@ the left or down.  The units are staff-spaces.  The extra
 displacement is made after the typesetting of objects is
 finished, so an object may be repositioned anywhere without
 affecting anything else.
-@smallspace
-@item @code{force-hshift}
-
-@cindex force-hshift property
-Closely spaced notes in a chord, or notes occuring at the same
-time in different voices, are arranged in two, occasionally more,
-columns to prevent the noteheads overlapping.  These are called
-note columns, and an object called @code{NoteColumn} is created
-to lay out the notes in that column.  There are separate columns
-for each voice.  The @code{force-hshift}
-property is a property of a @code{NoteColumn} (actually of the
-@code{note-column-interface}).  Changing it permits a note column
-to be moved in units appropriate to a note column, viz. the note
-head width of the first voice note.  It is preferable to the
-@code{extra-offset} property for this purpose as there is no need
-to work out the distance in staff-spaces.
-@smallspace
-@item @code{positions}
 
+@item positions
 @cindex positions property
 This is most useful for manually adjusting the slope and height
 of beams, slurs, and tuplets.   It takes a pair of numbers
 giving the position of the left and right ends of the beam, slur,
 etc. relative to the center line of the staff.  Units are
-staff-spaces.
-
-@end itemize
+staff-spaces.  Note, though, that slurs and phrasing slurs cannot
+be repositioned by arbitrarily large amounts.  LilyPond first
+generates a list of possible positions for the slur and by default
+finds the slur that @qq{looks best}.  If the @code{positions}
+property has been overridden the slur that is closest to the
+requested positions is selected from the list.
+@end table
 
 Objects do not all have all of these properties in general.
 It is necessary to go to the IR to look up which properties
@@ -1890,9 +2061,10 @@ involved in collisions, together with the name of the object which
 should be looked up in the IR in order to discover which properties
 should be used to move them.
 
-@multitable @columnfractions .4 .6
+@multitable @columnfractions .5 .5
 @headitem Object type           @tab Object name
 @item Articulations             @tab @code{Script}
+@item Beams                     @tab @code{Beam}
 @item Dynamics (vertically)     @tab @code{DynamicLineSpanner}
 @item Dynamics (horizontally)   @tab @code{DynamicText}
 @item Fingerings                @tab @code{Fingering}
@@ -1900,6 +2072,7 @@ should be used to move them.
 @item Slurs                     @tab @code{Slur}
 @item Text e.g. @code{^"text"}  @tab @code{TextScript}
 @item Ties                      @tab @code{Tie}
+@item Tuplets                   @tab @code{TupletBracket}
 @end multitable
 
 
@@ -1909,7 +2082,8 @@ should be used to move them.
 Let's now see how the properties in the previous section can
 help to resolve overlapping notation.
 
-@subheading padding property
+@c FIXME: formatting
+@subheading @code{padding}
 @cindex padding property
 
 The @code{padding} property can be set to increase
@@ -1934,16 +2108,23 @@ d1
 @end lilypond
 
 Note in the second example how important it is to figure out what
-context handles a certain object.  Since the @code{MetronomeMark} object
+context handles a certain object.  Since the @code{MetronomeMark}
+object
 is handled in the @code{Score} context, property changes in the
 @code{Voice} context will not be noticed.  For more details, see
 @ruser{Constructing a tweak}.
 
-@subheading left-padding and right-padding properties
+If the @code{padding} property of an object is increased when that
+object is in a stack of objects being positioned according to
+their @code{outside-staff-priority}, then that object and all 
+objects outside it are moved.
+
+@subheading @code{left-padding} and @code{right-padding}
 @cindex left-padding property
 @cindex right-padding property
 
-TODO Example of this - at the moment I can't find one! -td
+TODO Example showing the utility of these properties  -td
 
 @subheading staff-padding property
 @cindex staff-padding property
@@ -2001,7 +2182,7 @@ The best solution here is to move the multimeasure rest down,
 since the rest is in voice two.
 The default in @code{\voiceTwo} (i.e. in the second voice of a
 @code{<<@{...@} \\ @{...@}>>} construct)
-is that @code{staff-position} is set to -4 for MultiMeasureRest, 
+is that @code{staff-position} is set to -4 for MultiMeasureRest,
 so we need to move it, say, four half-staff spaces down to
 @code{-8}.
 
@@ -2067,7 +2248,7 @@ note column of the higher two notes.  To correct this we set
 @code{NoteColumn}, of these notes to zero.
 The lower note of the second chord is best placed just to the
 right of the higher notes.  We achieve this by setting
-@code{force-hshift} of this note to 0.5, ie half a notehead's
+@code{force-hshift} of this note to 0.5, ie half a note head's
 width to the right of the note column of the higher notes.
 
 Here's the final result:
@@ -2094,7 +2275,7 @@ Here's the final result:
 The @code{positions} property allows the position and slope of
  tuplets, slurs, phrasing slurs and beams to be controlled
 manually.  Here's an example which has an ugly phrasing slur
-due to it trying to avoid the slur on the acciaccatura.
+due to its trying to avoid the slur on the acciaccatura.
 
 @lilypond[quote,verbatim,fragment,ragged-right,relative=1]
 r4  \acciaccatura e8\( d8 c ~c d c d\)
@@ -2113,7 +2294,7 @@ r4
 @noindent
 but if there were some reason why this could not be done the
 other alternative would be to move the left end of the phrasing
-slur down a little using the @code{positions} property.  This 
+slur down a little using the @code{positions} property.  This
 also resolves the rather nasty shape.
 
 @lilypond[quote,verbatim,fragment,ragged-right,relative=1]
@@ -2124,7 +2305,7 @@ e8\( d8 c ~c d c d\)
 @end lilypond
 
 Here's a further example taken from the opening of the left-hand
-staff of Chopin's Prelude Op 28 No. 2.  We see that the beam 
+staff of Chopin's Prelude Op 28 No. 2.  We see that the beam
 collides with the upper notes:
 
 @lilypond[quote,verbatim,fragment,ragged-right]
@@ -2136,8 +2317,8 @@ collides with the upper notes:
 @end lilypond
 
 @noindent
-This can only be resolved by manually moving both ends of the beam 
-up from their position at 2 staff-spaces above the center line to, 
+This can only be resolved by manually moving both ends of the beam
+up from their position at 2 staff-spaces above the center line to,
 say, 3:
 
 @lilypond[quote,verbatim,fragment,ragged-right]
@@ -2158,137 +2339,438 @@ Note that the override continues to apply in the first voice of
 the second block of quavers, but not to any of the beams in the
 second voice.
 
-TODO Examples of real music showing collisions and their resolution
+@node Real music example
+@subsection Real music example
+
+We end this section on Tweaks by showing the steps to be taken to 
+deal with a tricky example which needs several tweaks to produce 
+the desired output.  The example has been deliberately chosen to 
+illustrate the use of the Notation Reference to resolve unusual 
+problems with notation.  It is not representative of more usual 
+engraving process, so please do not let these difficulties put 
+you off!  Fortunately, difficulties like these are not very common!
+
+The example is from Chopin's Première Ballade, Op. 23, bars 6 to
+9, the transition from the opening Lento to Moderato.
+Here, first, is what we want the output to look like, but to avoid
+over-complicating the example too much we have left out the
+dynamics, fingering and pedalling.
+
+@c The following should appear as music without code
+@lilypond[quote,ragged-right]
+rhMusic = \relative c'' {
+  r2
+  c4.\( g8 |
+  \once \override Tie #'staff-position = #3.5
+  bes1~ |
+  \bar "||"
+  \time 6/4
+  \override Staff.NoteCollision #'merge-differently-headed = ##t
+  \override Staff.NoteCollision #'merge-differently-dotted = ##t
+  bes2.^\markup {\bold "Moderato"} r8
+  <<
+    {c,8[ d fis bes a] | }
+  \\
+    % Reposition the c2 to the right of the merged note
+    {c,8~ \once \override NoteColumn #'force-hshift = #1.0
+    % Move the c2 out of the main note column so the merge will work
+    \shiftOnn c2}
+  \\
+    % Stem on the d2 must be down to permit merging
+    {s8 \stemDown \once \override Stem #'transparent = ##t d2}
+  \\
+    {s4 fis4.}
+  >>
+  \revert Staff.NoteCollision #'merge-differently-headed
+  \revert Staff.NoteCollision #'merge-differently-dotted
+  g2.\)
+}
 
+lhMusic = \relative c' {
+  r2 <c g ees>2( |
+  <d g, d>1)\arpeggio |
+  r2. d,,4 r4 r |
+  r4
+}
 
-@node Page layout
-@section Page layout
+\score {
+  \new PianoStaff <<
+    \new Staff = "RH"  <<
+      \key g \minor
+      \rhMusic
+    >>
+    \new Staff = "LH" <<
+      \key g \minor
+      \clef "bass"
+      \lhMusic
+    >>
+  >>
+}
+@end lilypond
 
-@menu
-* Fitting music onto fewer pages::  
-@end menu
+We note first that the right hand part in the third bar
+requires four voices.  These are the five beamed eighth notes,
+the tied C, the half-note D which is merged with the eighth note
+D, and the dotted quarter note F-sharp, which is also merged with
+the eighth note at the same pitch.  Everything else is in a single
+voice, so the easiest way is to introduce these four voices
+temporarily at the time they are needed.  If you have forgotten
+how to do this, look at @ref{I'm hearing Voices}.  Let us begin
+by entering the notes as two variables and setting up the staff
+structure in a score block, and see what LilyPond produces by
+default:
 
-@node Fitting music onto fewer pages
-@subsection Fitting music onto fewer pages
+@lilypond[quote,verbatim,ragged-right]
+rhMusic = \relative c'' {
+  r2 c4. g8 |
+  bes1~ |
+  \time 6/4
+  bes2. r8
+  % Start polyphonic section of four voices
+  <<
+    {c,8 d fis bes a | }
+  \\
+    {c,8~ c2 | }
+  \\
+    {s8 d2 | }
+  \\
+    {s4 fis4. | }
+  >>
+  g2.
+}
 
-Sometimes you can end up with one or two staves on a second
-(or third, or fourth...) page.  This is annoying, especially
-if you look at previous pages and it looks like there is plenty
-of room left on those.
+lhMusic = \relative c' {
+  r2 <c g ees>2 |
+  <d g, d>1 |
+  r2. d,,4 r4 r |
+  r4
+}
 
-When investigating layout issues, @code{annotate-spacing} is
-an invaluable tool.  This command prints the values of various
-layout spacing commands; see @ruser{Displaying spacing}, for more
-details.  From the output of @code{annotate-spacing}, we can
-see which margins we may wish to alter.
+\score {
+  \new PianoStaff <<
+    \new Staff = "RH"  <<
+      \key g \minor
+      \rhMusic
+    >>
+    \new Staff = "LH" <<
+      \key g \minor
+      \clef "bass"
+      \lhMusic
+    >>
+  >>
+}
+@end lilypond
 
-Other than margins, there are a few other options to save space:
+All the notes are right, but the appearance is far from
+satisfactory.  The tie clashes with the change in time signature,
+the beaming in the third bar is wrong, the notes are not
+merged together, and several notation elements are missing.  
+Let's first deal with the easier things.
+We can correct the beaming by inserting a beam
+manually, and we can easily add the left hand slur and the right 
+hand phrasing slur, since these were all covered in the Tutorial.
+Doing this gives:
 
-@itemize
-@item
-You may tell LilyPond to place systems as close together as
-possible (to fit as many systems as possible onto a page), but
-then to space those systems out so that there is no blank
-space at the bottom of the page.
+@lilypond[quote,verbatim,ragged-right]
+rhMusic = \relative c'' {
+  r2 c4.\( g8 |
+  bes1~ |
+  \time 6/4
+  bes2. r8
+  % Start polyphonic section of four voices
+  <<
+    {c,8[ d fis bes a] | }
+  \\
+    {c,8~ c2 | }
+  \\
+    {s8 d2 | }
+  \\
+    {s4 fis4. | }
+  >>
+  g2.\)
+}
 
-@example
-\paper @{
-  between-system-padding = #0.1
-  between-system-space = #0.1
-  ragged-last-bottom = ##f
-  ragged-bottom = ##f
-@}
-@end example
+lhMusic = \relative c' {
+  r2 <c g ees>2( |
+  <d g, d>1) |
+  r2. d,,4 r4 r |
+  r4
+}
 
-@item
-You may force the number of systems (i.e., if LilyPond wants
-to typeset some music with 11 systems, you could force it to
-use 10).
+\score {
+  \new PianoStaff <<
+    \new Staff = "RH"  <<
+      \key g \minor
+      \rhMusic
+    >>
+    \new Staff = "LH" <<
+      \key g \minor
+      \clef "bass"
+      \lhMusic
+    >>
+  >>
+}
+@end lilypond
 
-@example
-\paper @{
-  system-count = #10
-@}
-@end example
+The first bar is now correct.  The second bar contains an arpeggio
+and is terminated by a double bar line.  How do we do these, as they
+have not been mentioned in this Learning Manual?  This is where
+we need to turn to the Notation Reference.  Looking up @q{arpeggio}
+and @q{bar line} in the
+index quickly shows us that an arpeggio is produced by appending
+@code{\arpeggio} to a chord, and a double bar line is produced by
+the @code{\bar "||"} command.  That's easily done.  We next need
+to correct the collision of the tie with the time signature.  This
+is best done by moving the tie upwards.  Moving objects was covered
+earlier in @ref{Moving objects}, which says that objects positioned
+relative to the staff can be moved by overriding their
+@code{staff-position} property, which is specified in half staff
+spaces relative to the center line of the staff.  So the following
+override placed just before the first tied note would move the tie
+up to 3.5 half staff spaces above the center line:
+
+@code{\once \override Tie #'staff-position = #3.5}
+
+This completes bar two, giving:
 
-@item
-Avoid (or reduce) objects which increase the vertical size of
-a system.  For example, volta repeats (or alternate repeats)
-require extra space.  If these repeats are spread over two
-systems, they will take up more space than one system with
-the volta repeats and another system without.
-
-Another example is moving dynamics which @q{stick out} of
-a system, as in the second bar here:
-
-@lilypond[verbatim,quote,fragment,ragged-right,relative=1]
-e4 c g\f c
-\override DynamicText #'extra-offset = #'( -2.2 . 2.0)
-e4 c g\f c
-@end lilypond
+@lilypond[quote,verbatim,ragged-right]
+rhMusic = \relative c'' {
+  r2 c4.\( g8 |
+  \once \override Tie #'staff-position = #3.5
+  bes1~ |
+  \bar "||"
+  \time 6/4
+  bes2. r8
+  % Start polyphonic section of four voices
+  <<
+    {c,8[ d fis bes a] | }
+  \\
+    {c,8~ c2 | }
+  \\
+    {s8 d2 | }
+  \\
+    {s4 fis4. | }
+  >>
+  g2.\)
+}
 
-@item
-Alter the horizontal spacing via @code{SpacingSpanner}.  See
-@ruser{Changing horizontal spacing}, for more details.  Here's
-an example first showing the default behaviour:
+lhMusic = \relative c' {
+  r2 <c g ees>2( |
+  <d g, d>1)\arpeggio |
+  r2. d,,4 r4 r |
+  r4
+}
 
-@lilypond[verbatim,quote]
 \score {
-  \relative c'' {
-    g4 e e2 |
-    f4 d d2 |
-    c4 d e f |
-    g4 g g2 |
-    g4 e e2 |
-  }
+  \new PianoStaff <<
+    \new Staff = "RH"  <<
+      \key g \minor
+      \rhMusic
+    >>
+    \new Staff = "LH" <<
+      \key g \minor
+      \clef "bass"
+      \lhMusic
+    >>
+  >>
 }
 @end lilypond
 
+On to bar three and the start of the Moderato section.  The
+tutorial showed how to add embolded text with the
+@code{\markup} command, so adding @q{Moderato} in bold is easy.
+But how do we merge notes in different voices together?  The
+index in the Notation Reference does not mention merging,
+but a search of the text for @q{merge} quickly leads us to
+the overrides for merging differently headed and differently
+dotted notes in @ruser{Collision Resolution}.  In our
+example we need to merge both types of note for the duration
+of the polyphonic section in bar 3, so using the information
+in the Notation Reference we add
+
+@example
+\override Staff.NoteCollision #'merge-differently-headed = ##t
+\override Staff.NoteCollision #'merge-differently-dotted = ##t
+@end example
+
+@noindent
+to the start of that section and
+
+@example
+\revert Staff.NoteCollision #'merge-differently-headed
+\revert Staff.NoteCollision #'merge-differently-dotted
+@end example
+
 @noindent
-and now with @code{common-shortest-duration} increased from the
-value of @code{1/4} (a quarter note is the most common in this
-example) to @code{1/2}:
+to the end, giving:
+
+@lilypond[quote,verbatim,ragged-right]
+rhMusic = \relative c'' {
+  r2 c4.\( g8 |
+  \once \override Tie #'staff-position = #3.5
+  bes1~ |
+  \bar "||"
+  \time 6/4
+  bes2.^\markup {\bold "Moderato"} r8
+  \override Staff.NoteCollision #'merge-differently-headed = ##t
+  \override Staff.NoteCollision #'merge-differently-dotted = ##t
+  % Start polyphonic section of four voices
+  <<
+    {c,8[ d fis bes a] | }
+  \\
+    {c,8~ c2 | }
+  \\
+    {s8 d2 | }
+  \\
+    {s4 fis4. | }
+  >>
+  \revert Staff.NoteCollision #'merge-differently-headed
+  \revert Staff.NoteCollision #'merge-differently-dotted  
+  g2.\)
+}
+
+lhMusic = \relative c' {
+  r2 <c g ees>2( |
+  <d g, d>1)\arpeggio |
+  r2. d,,4 r4 r |
+  r4
+}
 
-@lilypond[verbatim,quote]
 \score {
-  \relative c'' {
-    g4 e e2 |
-    f4 d d2 |
-    c4 d e f |
-    g4 g g2 |
-    g4 e e2 |
-  }
-  \layout {
-    \context {
-      \Score
-      \override SpacingSpanner
-                #'common-shortest-duration = #(ly:make-moment 1 2)
-    }
-  }
+  \new PianoStaff <<
+    \new Staff = "RH"  <<
+      \key g \minor
+      \rhMusic
+    >>
+    \new Staff = "LH" <<
+      \key g \minor
+      \clef "bass"
+      \lhMusic
+    >>
+  >>
 }
 @end lilypond
 
-@noindent
-Note that this override cannot be modified dynamically, so it must
-always be placed in a @code{\context@{..@}} block so that it applies
-to the whole score.
+These overrides have merged the two F-sharp notes, but not the two 
+on D.  Why not?  The answer is there in the same section in the
+Notation Reference -- notes being merged must have stems in 
+opposite directions and two notes cannot be merged successfully if 
+there is a third note in the same note column.  Here the two D's 
+both have upward stems and there is a third note -- the C.  We know
+how to change the stem direction using @code{\stemDown}, and
+the Notation Reference also says how to move the C -- apply a shift
+using one of the @code{\shift} commands.  But which one?
+The C is in voice two which has shift off, and the two D's are in
+voices one and three, which have shift off and shift on,
+respectively.  So we have to shift the C a further level still
+using @code{\shiftOnn} to avoid it interferring with the two D's.  
+Applying these changes gives:
+
+@lilypond[quote,verbatim,ragged-right]
+rhMusic = \relative c'' {
+  r2 c4.\( g8 |
+  \once \override Tie #'staff-position = #3.5
+  bes1~ |
+  \bar "||"
+  \time 6/4
+  bes2.^\markup {\bold "Moderato"} r8
+  \override Staff.NoteCollision #'merge-differently-headed = ##t
+  \override Staff.NoteCollision #'merge-differently-dotted = ##t
+  % Start polyphonic section of four voices
+  <<
+    {c,8[ d fis bes a] | }
+  \\
+    % Move the c2 out of the main note column so the merge will work
+    {c,8~ \shiftOnn c2 | }
+  \\
+    % Stem on the d2 must be down to permit merging
+    {s8 \stemDown d2 | }
+  \\
+    {s4 fis4. | }
+  >>
+  \revert Staff.NoteCollision #'merge-differently-headed
+  \revert Staff.NoteCollision #'merge-differently-dotted
+  g2.\)
+}
 
-TODO Add description of using \context in this way earlier if it is
-not already anywhere  -td
+lhMusic = \relative c' {
+  r2 <c g ees>2( |
+  <d g, d>1)\arpeggio |
+  r2. d,,4 r4 r |
+  r4
+}
 
-@end itemize
+\score {
+  \new PianoStaff <<
+    \new Staff = "RH"  <<
+      \key g \minor
+      \rhMusic
+    >>
+    \new Staff = "LH" <<
+      \key g \minor
+      \clef "bass"
+      \lhMusic
+    >>
+  >>
+}
+@end lilypond
 
-TODO  Mention line-thickness somewhere else and move this there
+Nearly there.  Only two problems remain: The downward stem on the
+merged D should not be there, and the C would be better positioned
+to the right of the D's.  We know how to do both of these from the
+earlier tweaks: we make the stem transparent, and move the C with
+the @code{force-hshift} property.  Here's the final result:
 
-@cindex Tweaks, distances
-@cindex Distances
+@lilypond[quote,verbatim,ragged-right]
+rhMusic = \relative c'' {
+  r2
+  c4.\( g8 |
+  \once \override Tie #'staff-position = #3.5
+  bes1~ |
+  \bar "||"
+  \time 6/4
+  bes2.^\markup {\bold "Moderato"} r8
+  \override Staff.NoteCollision #'merge-differently-headed = ##t
+  \override Staff.NoteCollision #'merge-differently-dotted = ##t
+  <<
+    {c,8[ d fis bes a] | }
+  \\
+    % Reposition the c2 to the right of the merged note
+    {c,8~ \once \override NoteColumn #'force-hshift = #1.0
+    % Move the c2 out of the main note column so the merge will work
+    \shiftOnn c2}
+  \\
+    % Stem on the d2 must be down to permit merging
+    {s8 \stemDown \once \override Stem #'transparent = ##t d2}
+  \\
+    {s4 fis4.}
+  >>
+  \revert Staff.NoteCollision #'merge-differently-headed
+  \revert Staff.NoteCollision #'merge-differently-dotted
+  g2.\)
+}
 
-Distances in LilyPond are measured in staff-spaces, while most
-thickness properties are measured in line-thickness.  Some
-properties are different; for example, the thickness of beams
-are measured in staff-spaces.  For more information, see the
-relevant portion of the program reference.
+lhMusic = \relative c' {
+  r2 <c g ees>2( |
+  <d g, d>1)\arpeggio |
+  r2. d,,4 r4 r |
+  r4
+}
 
+\score {
+  \new PianoStaff <<
+    \new Staff = "RH"  <<
+      \key g \minor
+      \rhMusic
+    >>
+    \new Staff = "LH" <<
+      \key g \minor
+      \clef "bass"
+      \lhMusic
+    >>
+  >>
+}
+@end lilypond
 
 
 @node Further tweaking
@@ -2296,6 +2778,7 @@ relevant portion of the program reference.
 
 @menu
 * Other uses for tweaks::       
+* Using variables for tweaks::  
 * Other sources of information::  
 * Advanced tweaks with Scheme::  
 * Avoiding tweaks with slower processing::  
@@ -2306,16 +2789,20 @@ relevant portion of the program reference.
 
 @itemize
 
-@item
-Setting the @code{transparent} property will cause an object to be printed
-in @q{invisible ink}: the object is not printed, but all its other
-behavior is retained.  The object still takes up space, it takes part in
-collisions, and slurs, ties, and beams can be attached to it.
-
-@cindex transparent objects
+@cindex transparent property
+@cindex objects, making invisible
 @cindex removing objects
+@cindex objects, removing
 @cindex hiding objects
 @cindex invisible objects
+
+@item
+Setting the @code{transparent} property will cause an object 
+to be printed in @q{invisible ink}: the object is not printed, 
+but all its other behavior is retained.  The object still takes 
+up space, it takes part in collisions, and slurs, ties, and beams
+can be attached to it.
+
 The following example demonstrates how to connect different voices
 using ties.  Normally, ties only connect two notes in the same
 voice.  By introducing a tie in a different voice,
@@ -2355,8 +2842,56 @@ we also lengthen the stem, by setting the @code{length} to
 } >>
 @end lilypond
 
+@cindex stencil property
+
+@item
+For outside-staff objects it is usually better to override the
+object's @code{stencil} property rather than its @code{transparent}
+property when you wish to remove it from the printed output.  
+Setting the @code{stencil} property of an object to @code{#f} will
+remove that object entirely from the printed output.  This means it
+has no effect on the placement of other objects placed relative to
+it.
+
+For example, if we wished to change the metronome setting in order
+to simulate a fermata in the MIDI output we would not want the
+metronome marking to appear in the printed output, and we would
+not want it to influence the spacing between the two systems or
+the spacing of the notes on the staff.  So setting its 
+@code{stencil} property to @code{#f} would be the best way.
+We show here the effect of the two methods:
+
+@lilypond[quote,verbatim]
+\score {
+  \relative c'' {
+    % Visible tempo marking
+    \tempo 4=120
+    a4 a a
+    \once \override Score.MetronomeMark #'transparent = ##t
+    % Invisible tempo marking to lengthen fermata note in MIDI
+    \tempo 4=80
+    a\fermata
+    \once \override Score.MetronomeMark #'stencil = ##f
+    % Invisible tempo marking to restore tempo in MIDI
+    \tempo 4=120
+    a a a a
+  }
+  \midi { }
+}
+@end lilypond
+
+@noindent
+Both methods remove the metronome mark from the printed output,
+and both affect the MIDI timing as required, but the first
+(transparent) metronome mark still influences the note spacing
+while the second (with no stencil) does not.
+
 @end itemize
 
+@node Using variables for tweaks
+@subsection Using variables for tweaks
+
+TODO Add section
 
 @node Other sources of information
 @subsection Other sources of information
@@ -2492,3 +3027,10 @@ In some cases (see issue 246), this must be done before
 
 
 
+
+
+
+
+
+
+