]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/learning/tweaks.itely
Doc: LM 4.1.2 additonal para for positioning grobs
[lilypond.git] / Documentation / learning / tweaks.itely
index f48a61a25e8cd6793f38249b4066978fc06ca849..160c0e390114e773964043530e9f7d29e1699d87 100644 (file)
@@ -8,7 +8,7 @@
     Guide, node Updating translation committishes..
 @end ignore
 
-@c \version "2.17.6"
+@c \version "2.19.2"
 
 @node Tweaking output
 @chapter Tweaking output
@@ -22,6 +22,7 @@ configurable; virtually every fragment of output may be changed.
 * The Internals Reference manual::
 * Appearance of objects::
 * Placement of objects::
+* Vertical spacing::
 * Collisions of objects::
 * Further tweaking::
 @end menu
@@ -106,6 +107,14 @@ ending point, and maybe other properties concerned with their
 shape.  Objects with an extended shape like these are called
 @q{Spanners}.
 
+What is more, there are @q{abstract} grobs which do not print
+anything of their own, but rather collect, position and manage
+other grobs.  Common examples for this are
+@code{DynamicLineSpanner}, @code{BreakAlignment},
+@code{NoteColumn}, @code{VerticalAxisGroup},
+@code{NonMusicalPaperColumn} and similar.  We will see how some of
+these are used later.
+
 It remains to explain what @q{Interfaces} are.  Many objects, even
 though they are quite different, share common features which need to
 be processed in the same way.  For example, all grobs have a color, a
@@ -173,15 +182,15 @@ the types of objects and properties from their names.
 @cindex tweaking methods
 
 @menu
-* The \override command::
-* The \revert command::
-* The \once prefix::
-* The \overrideProperty command::
-* The \tweak command::
+* The override command::
+* The revert command::
+* The once prefix::
+* The overrideProperty command::
+* The tweak command::
 @end menu
 
-@node The \override command
-@unnumberedsubsubsec The @code{\override} command
+@node The override command
+@unnumberedsubsubsec The @code{@bs{}override} command
 
 @cindex override command
 @cindex override syntax
@@ -252,8 +261,8 @@ g4 a b c |
 @end lilypond
 
 
-@node The \revert command
-@unnumberedsubsubsec The @code{\revert} command
+@node The revert command
+@unnumberedsubsubsec The @code{@bs{}revert} command
 
 @cindex revert command
 
@@ -290,8 +299,8 @@ b4 c |
 @end lilypond
 
 
-@node The \once prefix
-@unnumberedsubsubsec The @code{\once} prefix
+@node The once prefix
+@unnumberedsubsubsec The @code{@bs{}once} prefix
 
 @funindex \once
 @funindex once
@@ -307,7 +316,7 @@ note like this:
 @cindex color property, example
 @cindex NoteHead, example of overriding
 
-@lilypond[quote,fragment,ragged-right,verbatim,relative=1]
+@lilypond[quote,verbatim,relative=1]
 c4 d
 \override NoteHead.color = #red
 e4 f |
@@ -317,9 +326,26 @@ g4 a
 b c |
 @end lilypond
 
+The @code{\once} prefix may also be used in front of many
+predefined commands to limit their effect to one musical moment:
 
-@node The \overrideProperty command
-@unnumberedsubsubsec The @code{\overrideProperty} command
+@lilypond[quote,verbatim,relative=1]
+c4 d
+\once \stemDown
+e4 f |
+g4 a
+\once \hideNotes
+b c |
+@end lilypond
+
+However, predefined commands of the form @code{\@dots{}Neutral},
+@code{\@dots{}Off} and @code{\un@dots{}} use @code{\revert} internally
+rather than @code{\override} so prefixing these with @code{\once} has no
+effect.
+
+
+@node The overrideProperty command
+@unnumberedsubsubsec The @code{@bs{}overrideProperty} command
 
 @cindex overrideProperty command
 
@@ -333,8 +359,8 @@ We mention it here for completeness, but for details see
 @c Maybe explain in a later iteration  -td
 
 
-@node The \tweak command
-@unnumberedsubsubsec The @code{\tweak} command
+@node The tweak command
+@unnumberedsubsubsec The @code{@bs{}tweak} command
 
 @cindex tweak command
 
@@ -432,7 +458,7 @@ the original event:
 This long form of the @code{\tweak} command can be described as
 
 @example
-\tweak @var{layout-object}.@var{layout-property} @var{value}
+\tweak @var{LayoutObject}.@var{layout-property} #@var{value}
 @end example
 
 @cindex tuplets, nested
@@ -461,11 +487,11 @@ printed in red on the first short tuplet bracket.
 
 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
 \tweak direction #up
-\times 4/3 {
+\tuplet 3/4 {
   \tweak color #red
-  \times 2/3 { c8[ c c] }
-  \times 2/3 { c8[ c c] }
-  \times 2/3 { c8[ c c] }
+  \tuplet 3/2 { c8[ c c] }
+  \tuplet 3/2 { c8[ c c] }
+  \tuplet 3/2 { c8[ c c] }
 }
 @end lilypond
 
@@ -479,14 +505,14 @@ appearance may be modified in the usual way with
 @cindex TupletNumber, example of overriding
 
 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
-\times 2/3 { c8[ c c] }
+\tuplet 3/2 { c8[ c c] }
 \once \override TupletNumber.text = #tuplet-number::calc-fraction-text
-\times 2/3 {
+\tuplet 3/2 {
   c8[ c]
   c8[ c]
   \once \override TupletNumber.transparent = ##t
-  \times 2/3 { c8[ c c] }
-  \times 2/3 { c8[ c c] }
+  \tuplet 3/2 { c8[ c c] }
+  \tuplet 3/2 { c8[ c c] }
 }
 @end lilypond
 
@@ -1099,7 +1125,7 @@ will cause errors when the dimensions of the object are required for
 correct processing.  For example, errors will be generated if the
 @code{stencil} property of the @code{NoteHead} object is set to
 @code{#f}.  If this is the case, you can instead use the
-@code{point-stencil} function, which sets the stencil to a object
+@code{point-stencil} function, which sets the stencil to an object
 with zero size:
 
 @lilypond[quote,verbatim,relative=2]
@@ -2023,7 +2049,7 @@ positioning is not optimum.
 
 @menu
 * The outside-staff-priority property::
-* The \textLengthOn command::
+* The textLengthOn command::
 * Dynamics placement::
 * Grob sizing::
 @end menu
@@ -2241,8 +2267,8 @@ clearly will need to space the notes out horizontally to make more
 room for the text.  This is done using the @code{textLengthOn}
 command.
 
-@node The \textLengthOn command
-@unnumberedsubsubsec The @code{\textLengthOn} command
+@node The textLengthOn command
+@unnumberedsubsubsec The @code{@bs{}textLengthOn} command
 
 @cindex notes, spreading out with text
 
@@ -2265,9 +2291,12 @@ c2^"Text4" |
 @end lilypond
 
 The command to revert to the default behavior is
-@code{\textLengthOff}.  Remember @code{\once} only works with
-@code{\override}, @code{\set}, @code{\revert} or @code{\unset},
-so cannot be used with @code{\textLengthOn}.
+@code{\textLengthOff}.  Alternatively, @code{\once} may be used
+with @code{\textLengthOn} if the effect is to be limited to just a
+single musical moment.
+The corresponding spacing behavior for rehearsal marks and tempo
+indications is independently controlled with the commands
+@code{\markLengthOn} and @code{\markLengthOff}.
 
 @cindex markup text, allowing collisions
 
@@ -2331,7 +2360,7 @@ shows:
 
 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
 \dynamicUp
-a4\f b\mf c\mp b\p
+a4\f b\mf a\mp b\p
 @end lilypond
 
 @noindent
@@ -2364,16 +2393,17 @@ 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 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
-must override this value of @code{extra-spacing-width} to
-@code{'(0 . 0)} so the true width shines through.  This is
-the command to do this for dynamic text:
+by the trick of making the leftmost extent infinity and
+the rightmost extent minus infinity by setting the
+@code{extra-spacing-width} to @code{'(+inf.0 . -inf.0)}.  To
+ensure they do not overlap in the horizontal direction we
+must override this value of @code{extra-spacing-width} to give them
+a little extra spacing.  The units are the space between two staff
+lines, so moving the left edge half a unit to the left and the
+right edge half a unit to the right should do it:
 
 @example
-\override DynamicText.extra-spacing-width = #'(0 . 0)
+\override DynamicText.extra-spacing-width = #'(-0.5 . 0.5)
 @end example
 
 @noindent
@@ -2382,40 +2412,219 @@ Let's see if this works in our previous example:
 @cindex DynamicText, example of overriding
 @cindex extra-spacing-width property, example
 
-@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
-\dynamicUp
-\override DynamicText.extra-spacing-width = #'(0 . 0)
-a4\f b\mf c\mp b\p |
-@end lilypond
-
-@noindent
-Well, it has certainly stopped the dynamic marks being
-displaced, but two problems remain.  The marks should be
-spaced a little further apart and it would be better
-if they were all the same distance from the staff.
-We can solve the first problem easily.  Instead of making
-the @code{extra-spacing-width} zero we could add a little
-more to it.  The units are the space between two staff
-lines, so moving the left edge half a unit to the left and the
-right edge half a unit to the right should do it:
-
-@cindex DynamicText, example of overriding
-@cindex extra-spacing-width property, example
 
 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
 \dynamicUp
 % Extend width by 1 staff space
 \override DynamicText.extra-spacing-width = #'(-0.5 . 0.5)
-a4\f b\mf c\mp b\p
+a4\f b\mf a\mp b\p
 @end lilypond
 
 @noindent
 This looks better, but maybe we would prefer the dynamic marks
 to be aligned along the same baseline rather than going up and
 down with the notes.  The property to do this is
-@code{staff-padding} which is covered in the following section.
+@code{staff-padding} which is covered in the section on collisions
+(see @ref{Collisions of objects}).
 
 
+@node Vertical spacing
+@section Vertical spacing
+
+As a rule, LilyPond's vertical spacing of musical objects is pretty
+good.  Let's see how it does with a simple song, with 2 voices and
+piano accompaniment:
+
+@lilypond[quote,fragment,ragged-right]
+<<
+  \new ChoirStaff
+  <<
+    \new Staff {
+      \new Voice = "music" {
+        b'2 c' c' c'
+      }
+    }
+    \new Lyrics
+    \lyricsto "music" {
+      Here are some lyrics
+    }
+    \new Staff {
+      \clef bass e'2 f e c
+    }
+  >>
+  \new PianoStaff
+  <<
+    \new Staff {
+      g''2 c'' c'' a''
+    }
+    \new Staff {
+      \clef bass e2 f c e
+    }
+  >>
+>>
+@end lilypond
+
+There's nothing wrong with the default vertical spacing.  However, let's
+assume that you're working with a publisher with some specific
+requirements for vertical spacing of staves and lyrics: they want
+the lyrics spaced away from any notes, they want the piano
+accompaniment spaced away from the vocal line and they want the two
+piano staves pushed together tightly.  Let's start with the lyrics.
+
+Lyrics sit within a system, and therefore the commands to space them
+are found in @ruser{Flexible vertical spacing within systems}.  It
+tells us that lyrics are @code{non-staff lines} and therefore the
+command to change their spacing will refer to the @code{nonstaff}
+property.  Spacing them away from the staff to which they relate
+(the top line) will use the @code{relatedstaff} property.  Spacing
+them from the lower line will use the @code{unrelatedstaff} property.
+The vocal parts are part of a @code{VerticalAxisGroup}, so we need to
+adjust its properties.  Let's try it and see if it works.
+
+@lilypond[quote,fragment,ragged-right,verbatim]
+<<
+  \new ChoirStaff
+  <<
+    \new Staff {
+      \new Voice = "music" {
+        b'2 c' c' c'
+      }
+    }
+    \new Lyrics \with {
+      \override VerticalAxisGroup.
+        nonstaff-relatedstaff-spacing.padding = #5
+      \override VerticalAxisGroup.
+        nonstaff-unrelatedstaff-spacing.padding = #5
+    }
+    \lyricsto "music" {
+      Here are some lyrics
+    }
+    \new Staff {
+      \clef bass e'2 f e c
+    }
+  >>
+  \new PianoStaff
+  <<
+    \new Staff {
+      g''2 c'' c'' a''
+    }
+    \new Staff {
+      \clef bass e2 f c e
+    }
+  >>
+>>
+@end lilypond
+
+Well - yes it does, but perhaps too well.  When we set the
+@code{padding} to 5, LilyPond adds 5 staff spaces to the distance
+between objects, which is too much for us here.  We'll use 2.
+
+Next, let's move the piano music away from the vocal parts.  The
+vocal music is a @code{ChoirStaff}, so we need to increase the
+spacing between that group of staves and the piano staff below.
+We'll do this by changing the @code{basic-distance} of the
+@code{StaffGrouper}'s @code{staffgroup-staff-spacing}.
+
+@lilypond[quote,fragment,ragged-right,verbatim]
+<<
+  \new ChoirStaff \with {
+    \override StaffGrouper.
+      staffgroup-staff-spacing.basic-distance = #15
+  }
+  <<
+    \new Staff {
+      \new Voice = "music" {
+        b'2 c' c' c'
+      }
+    }
+    \new Lyrics \with {
+      \override VerticalAxisGroup.
+        nonstaff-relatedstaff-spacing.padding = #2
+      \override VerticalAxisGroup.
+        nonstaff-unrelatedstaff-spacing.padding = #2
+    }
+    \lyricsto "music" {
+      Here are some lyrics
+    }
+    \new Staff {
+      \clef bass e'2 f e c
+    }
+  >>
+  \new PianoStaff
+  <<
+    \new Staff {
+      g''2 c'' c'' a''
+    }
+    \new Staff {
+      \clef bass e2 f c e
+    }
+  >>
+>>
+@end lilypond
+
+Excellent.  Now just for the last requirement to make the piano staves
+closer together.  To do this, we again alter the properties of the
+@code{StaffGrouper}, but this time we're going to reduce both
+the @code{basic-distance} and the @code{padding}.  We can do this
+as shown below.
+
+@lilypond[quote,fragment,ragged-right,verbatim]
+<<
+  \new ChoirStaff \with {
+    \override StaffGrouper.
+      staffgroup-staff-spacing.basic-distance = #15
+  }
+  <<
+    \new Staff {
+      \new Voice = "music" {
+        b'2 c' c' c'
+      }
+    }
+    \new Lyrics \with {
+      \override VerticalAxisGroup.
+        nonstaff-relatedstaff-spacing.padding = #2
+      \override VerticalAxisGroup.
+        nonstaff-unrelatedstaff-spacing.padding = #2
+    }
+    \lyricsto "music" {
+      Here are some lyrics
+    }
+    \new Staff {
+      \clef bass e'2 f e c
+    }
+  >>
+  \new PianoStaff \with {
+    \override StaffGrouper.staff-staff-spacing = #'(
+                            (basic-distance . 0)
+                            (padding . 0))
+  }
+  <<
+    \new Staff {
+      g''2 c'' c'' a''
+    }
+    \new Staff {
+      \clef bass e2 f c e
+    }
+  >>
+>>
+@end lilypond
+
+That's put them really close together -- but it's what
+the publisher wanted.  They could be moved further
+apart by altering the @code{padding} or @code{basic-distance}
+if wanted.
+
+There are many ways of altering vertical spacing.  A key point
+to remember is that the spacing between objects in a
+@code{StaffGroup} (like @code{GrandStaff} or
+@code{PianoStaff} groups) is controlled by the spacing variables
+of the @code{StaffGrouper}. Spacing from ungrouped staves
+(like @code{Lyrics} and @code{Staff}) is controlled by the
+variables of the @code{VerticalAxisGroup}.  See the
+@ruser{Flexible vertical spacing paper variables} and
+@ruser{Flexible vertical spacing within systems} for more
+details.
+
 @node Collisions of objects
 @section Collisions of objects
 
@@ -2502,9 +2711,9 @@ space between any object which supports the
 @code{side-position-interface} and the nearest other object (generally
 the note or the staff lines); @code{staff-padding} applies only to
 those objects which are always set outside the staff -- it controls
-the minimum amount of space that should be inserted between that
-object and the staff.  Note that @code{staff-padding} has no effect on
-objects which are positioned relative to the note rather than the
+the minimum distance from the staff to the outside-staff object.
+Note that @code{staff-padding} has no effect on
+objects that are positioned relative to the note rather than the
 staff, even though it may be overridden without error for such objects
 -- it is simply ignored.
 
@@ -2564,27 +2773,58 @@ 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.
 
+@item
+@code{horizontal-shift}
+
+@cindex horizontal-shift property
+@cindex note column
+@cindex note collisions
+@cindex collisions, notes
+@cindex shift commands
+@funindex \shiftOff
+@funindex shiftOff
+@funindex \shiftOn
+@funindex shiftOn
+@funindex \shiftOnn
+@funindex shiftOnn
+@funindex \shiftOnnn
+@funindex shiftOnnn
+
+Within a voice, all the notes occuring at the same musical moment are
+grouped into a note column, and a @code{NoteColumn} object is created
+to control the horizontal positioning of that group of notes (see
+@qq{Note columns} in @ref{Explicitly instantiating voices}).  If
+@emph{and only if} two or more note columns within a single Staff
+context, both with stems in the same direction, occur at the same
+musical moment, the values of their @code{horizontal-shift} properties
+are used to rank them and the columns in the higher ranks are
+progessively offset to avoid collisions of the noteheads.  This
+property is set by the @code{\voiceXXX} commands and may be overridden
+directly with an @code{\override} command or, more usually, by the
+@code{\shiftOn} commands.  Note that this property is used to
+@emph{rank} the note columns for off-setting - it does not specify the
+magnitude of the offset, which is progressively increased in steps
+based on the note head's width for each rank.  The steps are usually
+of half a note head's width, but may be a full note head's width when
+a closely spaced group of notes is involved.
+
 @item
 @code{force-hshift}
 
 @cindex force-hshift property
 
-Closely spaced notes in a chord, or notes occurring 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
+note column to be moved in situations where the note columns overlap.
+Note that it has no effect on note columns that do not overlap.
+It is specified 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.
+conflict satisfactorily.  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
 
@@ -2769,9 +3009,9 @@ note head by overriding @code{right-padding}.
 @cindex objects, aligning on a baseline
 
 @code{staff-padding} can be used to align objects such as dynamics
-along a baseline at a fixed height above the staff, rather than at a
-height dependent on the position of the note to which they are
-attached.  It is not a property of @code{DynamicText} but of
+along a baseline at a fixed distance from the staff, when no other
+notation forces them further from the staff.
+It is not a property of @code{DynamicText} but of
 @code{DynamicLineSpanner}.  This is because the baseline should apply
 equally to @strong{all} dynamics, including those created as extended
 spanners.  So this is the way to align the dynamic marks in the
@@ -2783,20 +3023,16 @@ example taken from the previous section:
 @cindex staff-padding property, example
 
 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
-\dynamicUp
-% Extend width by 1 unit
-\override DynamicText.extra-spacing-width = #'(-0.5 . 0.5)
-% Align dynamics to a base line 2 units above staff
-\override DynamicLineSpanner.staff-padding = #2
-a4\f b\mf c\mp b\p
+\override DynamicLineSpanner.staff-padding = #3
+a4\f b\mf a\p b\mp
 @end lilypond
 
 
 @node The self-alignment-X property
 @unnumberedsubsubsec The @code{self-alignment-X} property
 
-The following example shows how this can resolve the collision
-of a string fingering object with a note's stem by aligning the
+The following example shows how to adjust the position
+of a string fingering object relative to a note's stem by aligning the
 right edge with the reference point of the parent note:
 
 @cindex StringNumber, example of overriding
@@ -2826,11 +3062,11 @@ example of a collision of this type:
 << { c4 c c c } \\ { R1 } >>
 @end lilypond
 
-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, so we need to
-move it, say, four half-staff spaces down to @w{@code{-8}}.
+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{<<@{@dots{}@} \\ @{@dots{}@}>>} construct) is
+that @code{staff-position} is set to -4 for MultiMeasureRest, so we need
+to move it, say, four half-staff spaces down to @w{@code{-8}}.
 
 @cindex MultiMeasureRest, example of overriding
 @cindex staff-position property, example
@@ -2922,12 +3158,12 @@ collide with the ties:
 {
   \time 4/2
   <<
-    { c'1 ~ c'2. e'8 f' }
+    { c'1 ~ 2. e'8 f' }
     \\
     { e''8 e'' e'' e''  e'' e'' e'' e''  f''2 g'' }
   >>
   <<
-    { c'1 ~ c'2. e'8 f' }
+    { c'1 ~ 2. e'8 f' }
     \\
     { e''8 e'' e'' e''  e'' e'' e'' e''  f''2 g'' }
   >>
@@ -2946,7 +3182,7 @@ say, 1:
 {
   \time 4/2
   <<
-    { c'1 ~ c'2. e'8 f' }
+    { c'1 ~ 2. e'8 f' }
     \\
     {
       \override Beam.positions = #'(-1 . -1)
@@ -2954,7 +3190,7 @@ say, 1:
     }
   >>
   <<
-    { c'1 ~ c'2. e'8 f' }
+    { c'1 ~ 2. e'8 f' }
     \\
     { e''8 e'' e'' e''  e'' e'' e'' e''  f''2 g'' }
   >>
@@ -2967,7 +3203,7 @@ the second measure of eighth notes, but not to any of the beams in the
 second voice.
 
 @node The force-hshift property
-@unnumberedsubsubsec The @code{force-hshift property}
+@unnumberedsubsubsec The @code{force-hshift} property
 
 We can now see how to apply the final corrections to the Chopin
 example introduced at the end of @ref{I'm hearing Voices}, which
@@ -2991,14 +3227,20 @@ was left looking like this:
 @noindent
 The inner note of the first chord (i.e. the A-flat in the fourth
 Voice) need not be shifted away from the note column of the higher
-note.  To correct this we set @code{force-hshift}, which is a property
-of @code{NoteColumn}, of this note to zero.
-
-In the second chord we prefer the F to line up with the A-flat and the
-lowest note to be positioned slightly right to avoid a collision of
-stems.  We achieve this by setting @code{force-hshift} in the
+note.  We might expect to correct this by using @code{\shiftOff}, but
+this will cause warnings about clashing note columns.  Instead, we
+set @code{force-hshift}, which is a property of @code{NoteColumn},
+of this note to zero.
+
+In the second chord we prefer the F to line up with the A-flat and
+the lowest note to be positioned slightly right to avoid a collision
+of stems.  We achieve this by setting @code{force-hshift} in the
 @code{NoteColumn} of the low D-flat to move it to the right by half
-a staff-space.
+a staff-space, and setting @code{force-hshift} for the F to zero.
+Note that we use @code{\once} to avoid the settings propagating
+beyond the immediate musical moment, although in this small example
+the @code{\once} and the second @code{\override} in Voice four could
+be omitted.  This would not be good practice.
 
 Here's the final result:
 
@@ -3011,17 +3253,11 @@ Here's the final result:
   <<
     { c2 aes4. bes8 }
     \\
-    {
-      <ees, c>2
-      \once \override NoteColumn.force-hshift = #0.5
-      des2
-    }
+    { <ees, c>2 \once \override NoteColumn.force-hshift = 0.5 des }
     \\
     \\
-    {
-      \override NoteColumn.force-hshift = #0
-      aes'2 f4 fes
-    }
+    { \once \override NoteColumn.force-hshift = 0 aes'2
+      \once \override NoteColumn.force-hshift = 0 f4 fes }
   >> |
   <c ees aes c>1 |
 }
@@ -3058,7 +3294,7 @@ rhMusic = \relative c'' {
     \time 6/4
     \mergeDifferentlyHeadedOn
     \mergeDifferentlyDottedOn
-    bes2.^\markup { \bold "Moderato" } r8
+    bes2.\tempo "Moderato" r8
     <<
       { c,8 d fis bes a }
       \new Voice {
@@ -3078,7 +3314,6 @@ rhMusic = \relative c'' {
         \stemDown
         % Stem on the d2 should be invisible
         \tweak Stem.transparent ##t
-        \tweak Flag.transparent ##t
         d2
       }
       \new Voice {
@@ -3144,7 +3379,7 @@ rhMusic = \relative c'' {
       { c,8 d fis bes a }  % continuation of main voice
       \new Voice {
         \voiceTwo
-        c,8~ c2
+        c,8~ 2
       }
       \new Voice {
         \voiceThree
@@ -3201,7 +3436,7 @@ rhMusic = \relative c'' {
       { c,8 d fis bes a }  % continuation of main voice
       \new Voice {
         \voiceTwo
-        c,8~ c2
+        c,8~ 2
       }
       \new Voice {
         \voiceThree
@@ -3273,7 +3508,7 @@ rhMusic = \relative c'' {
       { c,8 d fis bes a }  % continuation of main voice
       \new Voice {
         \voiceTwo
-        c,8~ c2
+        c,8~ 2
       }
       \new Voice {
         \voiceThree
@@ -3311,8 +3546,8 @@ lhMusic = \relative c' {
 @end lilypond
 
 On to bar three and the start of the Moderato section.  The tutorial
-showed how to add bold text with the @code{\markup} command, so
-adding @qq{Moderato} in bold is easy.  But how do we merge notes in
+showed how to add a tempo indication with the @code{\tempo} command, so
+adding @qq{Moderato} is easy.  But how do we merge notes in
 different voices together?  This is where we need to turn again to
 the Notation Reference for help.  A search for @qq{merge} in the
 Notation Reference index quickly leads us to the commands for merging
@@ -3346,7 +3581,7 @@ rhMusic = \relative c'' {
     bes1~ |
     \bar "||"
     \time 6/4
-    bes2.^\markup { \bold "Moderato" } r8
+    bes2.\tempo "Moderato" r8
     \mergeDifferentlyHeadedOn
     \mergeDifferentlyDottedOn
     % Start polyphonic section of four voices
@@ -3354,7 +3589,7 @@ rhMusic = \relative c'' {
       { c,8 d fis bes a }  % continuation of main voice
       \new Voice {
         \voiceTwo
-        c,8~ c2
+        c,8~ 2
       }
       \new Voice {
         \voiceThree
@@ -3420,7 +3655,7 @@ rhMusic = \relative c'' {
     bes1~ |
     \bar "||"
     \time 6/4
-    bes2.^\markup { \bold "Moderato" } r8
+    bes2.\tempo "Moderato" r8
     \mergeDifferentlyHeadedOn
     \mergeDifferentlyDottedOn
     % Start polyphonic section of four voices
@@ -3490,7 +3725,7 @@ rhMusic = \relative c'' {
     bes1~ |
     \bar "||"
     \time 6/4
-    bes2.^\markup { \bold "Moderato" } r8
+    bes2.\tempo "Moderato" r8
     \mergeDifferentlyHeadedOn
     \mergeDifferentlyDottedOn
     % Start polyphonic section of four voices
@@ -3513,7 +3748,6 @@ rhMusic = \relative c'' {
         \stemDown
         % Stem on the d2 should be invisible
         \tweak Stem.transparent ##t
-        \tweak Flag.transparent ##t
         d2
       }
       \new Voice {
@@ -3555,7 +3789,7 @@ lhMusic = \relative c' {
 
 @menu
 * Other uses for tweaks::
-* Using variables for tweaks::
+* Using variables for layout adjustments::
 * Style sheets::
 * Other sources of information::
 * Advanced tweaks with Scheme::
@@ -3589,7 +3823,7 @@ same voice can be connected with ties.  By using two voices,
 with the tied notes in one of them
 
 @lilypond[quote,fragment,relative=2]
-<< { b8~ b\noBeam } \\ { b8[ g] } >>
+<< { b8~ 8\noBeam } \\ { b8[ g] } >>
 @end lilypond
 
 @noindent
@@ -3603,8 +3837,7 @@ cross voices:
 <<
   {
     \tweak Stem.transparent ##t
-    \tweak Flag.transparent ##t
-    b8~ b\noBeam
+    b8~ 8\noBeam
   }
 \\
   { b8[ g] }
@@ -3619,9 +3852,8 @@ too much, we can lengthen the stem by setting the
 <<
   {
     \tweak Stem.transparent ##t
-    \tweak Flag.transparent ##t
     \tweak Stem.length #8
-    b8~ b\noBeam
+    b8~ 8\noBeam
   }
 \\
   { b8[ g] }
@@ -3643,7 +3875,7 @@ possible to rewrite the above example as
     \single \hide Stem
     \single \hide Flag
     \tweak Stem.length #8
-    b8~ b\noBeam
+    b8~ 8\noBeam
   }
 \\
   { b8[ g] }
@@ -3734,12 +3966,13 @@ second (with the stencil removed) does not.
 Music Glossary:
 @rglos{system}.
 
-@node Using variables for tweaks
-@subsection Using variables for tweaks
+@node Using variables for layout adjustments
+@subsection Using variables for layout adjustments
 
-@cindex variables, using for tweaks
-@cindex using variables for tweaks
-@cindex tweaks, using variables for
+@cindex variables, using for overrides
+@cindex overrides, using variables for
+@cindex adjustments, using variables for
+@cindex layout adjustments, using variables for
 
 Override commands are often long and tedious to type, and they
 have to be absolutely correct.  If the same overrides are to be
@@ -3844,18 +4077,15 @@ the parts with all the @code{#()}.  This is explained in
 
 @lilypond[quote,verbatim,ragged-right]
 mpdolce =
-#(make-dynamic-script
-  #{ \markup { \hspace #0
-               \translate #'(5 . 0)
-               \line { \dynamic "mp"
-                       \text \italic "dolce" } }
-  #})
+  \tweak self-alignment-X #-0.6
+  #(make-dynamic-script
+    #{ \markup { \dynamic mp \normal-text \italic \bold dolce } #})
 
 inst =
 #(define-music-function
      (parser location string)
      (string?)
-   #{ ^\markup \bold \box #string #})
+   #{ <>^\markup \bold \box #string #})
 
 \relative c'' {
   \tempo 4=50
@@ -3877,18 +4107,15 @@ Let's hide them in another file:
 @example
 %%% save this to a file called "definitions.ily"
 mpdolce =
-#(make-dynamic-script
-  #@{ \markup @{ \hspace #0
-               \translate #'(5 . 0)
-               \line @{ \dynamic "mp"
-                       \text \italic "dolce" @} @}
-  #@})
+  \tweak self-alignment-X #-0.6
+  #(make-dynamic-script
+    #@{ \markup @{ \dynamic mp \normal-text \italic \bold dolce @} #@})
 
 inst =
 #(define-music-function
      (parser location string)
      (string?)
-   #@{ ^\markup \bold \box #string #@})
+   #@{ <>^\markup \bold \box #string #@})
 @end example
 
 We will refer to this file using the @code{\include} command near
@@ -3915,18 +4142,15 @@ Now let's modify our music (let's save this file as @file{music.ly}).
 
 @lilypond[quote,ragged-right]
 mpdolce =
-#(make-dynamic-script
-  #{ \markup { \hspace #0
-               \translate #'(5 . 0)
-               \line { \dynamic "mp"
-                       \text \italic "dolce" } }
-  #})
+  \tweak self-alignment-X #-0.6
+  #(make-dynamic-script
+    #{ \markup { \dynamic mp \normal-text \italic \bold dolce } #})
 
 inst =
 #(define-music-function
      (parser location string)
      (string?)
-   #{ ^\markup \bold \box #string #})
+   #{ <>^\markup \bold \box #string #})
 
 \relative c'' {
   \tempo 4=50
@@ -3950,23 +4174,20 @@ with this:
 @example
 %%%  definitions.ily
 mpdolce =
-#(make-dynamic-script
-  #@{ \markup @{ \hspace #0
-               \translate #'(5 . 0)
-               \line @{ \dynamic "mp"
-                       \text \italic "dolce" @} @}
-  #@})
+  \tweak self-alignment-X #-0.6
+  #(make-dynamic-script
+    #@{ \markup @{ \dynamic mp \normal-text \italic \bold dolce @} #@})
 
 inst =
 #(define-music-function
      (parser location string)
      (string?)
-   #@{ ^\markup \bold \box #string #@})
+   #@{ <>^\markup \bold \box #string #@})
 
 \layout@{
   \context @{
     \Score
-    \override MetronomeMark.extra-offset = #'(-9 . 0)
+    \override MetronomeMark.extra-offset = #'(-5 . 0)
     \override MetronomeMark.padding = #'3
   @}
   \context @{
@@ -3983,23 +4204,20 @@ inst =
 
 @lilypond[quote,ragged-right]
 mpdolce =
-#(make-dynamic-script
-  #{ \markup { \hspace #0
-               \translate #'(5 . 0)
-               \line { \dynamic "mp"
-                       \text \italic "dolce" } }
-  #})
+  \tweak self-alignment-X #-0.6
+  #(make-dynamic-script
+    #{ \markup { \dynamic mp \normal-text \italic \bold dolce } #})
 
 inst =
 #(define-music-function
      (parser location string)
      (string?)
-   #{ ^\markup \bold \box #string #})
+   #{ <>^\markup \bold \box #string #})
 
 \layout{
   \context {
     \Score
-    \override MetronomeMark.extra-offset = #'(-9 . 0)
+    \override MetronomeMark.extra-offset = #'(-5 . 0)
     \override MetronomeMark.padding = #'3
   }
   \context {
@@ -4034,25 +4252,22 @@ overall size of the output.
 @example
 %%%  web-publish.ily
 mpdolce =
-#(make-dynamic-script
-  #@{ \markup @{ \hspace #0
-               \translate #'(5 . 0)
-               \line @{ \dynamic "mp"
-                       \text \italic "dolce" @} @}
-  #@})
+  \tweak self-alignment-X #-0.6
+  #(make-dynamic-script
+    #@{ \markup @{ \dynamic mp \normal-text \italic \bold dolce @} #@})
 
 inst =
 #(define-music-function
      (parser location string)
      (string?)
-   #@{ ^\markup \bold \box #string #@})
+   #@{ <>^\markup \bold \box #string #@})
 
 #(set-global-staff-size 23)
 
 \layout@{
   \context @{
     \Score
-    \override MetronomeMark.extra-offset = #'(-9 . 0)
+    \override MetronomeMark.extra-offset = #'(-5 . 0)
     \override MetronomeMark.padding = #'3
   @}
   \context @{
@@ -4068,24 +4283,21 @@ inst =
 
 @lilypond[quote,ragged-right]
 mpdolce =
-#(make-dynamic-script
-  #{ \markup { \hspace #0
-               \translate #'(5 . 0)
-               \line { \dynamic "mp"
-                       \text \italic "dolce" } }
-  #})
+  \tweak self-alignment-X #-0.6
+  #(make-dynamic-script
+    #{ \markup { \dynamic mp \normal-text \italic \bold dolce } #})
 
 inst =
 #(define-music-function
      (parser location string)
      (string?)
-   #{ ^\markup \bold \box #string #})
+   #{ <>^\markup \bold \box #string #})
 
 #(set-global-staff-size 23)
 
 \layout{
   \context { \Score
-    \override MetronomeMark.extra-offset = #'(-9 . 0)
+    \override MetronomeMark.extra-offset = #'(-5 . 0)
     \override MetronomeMark.padding = #'3
   }
   \context { \Voice