]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/user/fundamental.itely
Change Info docs setup and clean up Documentation/user/GNUmakefile
[lilypond.git] / Documentation / user / fundamental.itely
index 4ac3ff25c9d64481e375d9b3915ca9bf95d33378..1e56b0e4f250f3d2d11292d75891b65d8fdbf93f 100644 (file)
@@ -4,6 +4,10 @@
 @node Fundamental concepts
 @chapter Fundamental concepts
 
+You've seen in the Tutorial how to produce beautifully printed
+music from a simple text file.  This section introduces the
+concepts and techniques required to produce equally beautiful
+but more complex scores.
 
 @menu
 * How LilyPond files work::     
@@ -26,7 +30,7 @@ description of the input format, see @ruser{File structure}.
 @menu
 * Introduction to the LilyPond file structure::  
 * Score is a (single) compound musical expression::  
-* Nesting Music Expressions::   
+* Nesting music expressions::   
 * On the un-nestedness of brackets and ties::  
 @end menu
 
@@ -36,7 +40,7 @@ description of the input format, see @ruser{File structure}.
 A basic example of a lilypond input file is
 
 @example
-\version "2.11.23"
+\version "2.11.38"
 \score @{
   @var{...compound music expression...}  % all the music goes here!
   \header @{ @}
@@ -49,10 +53,10 @@ A basic example of a lilypond input file is
 There are many variations of this basic pattern, but this
 example serves as a useful starting place.
 
-At this point, you may be confused, since you have never seen a
-@code{\score@{@}} before.  This is because LilyPond automatically
-adds the extra commands when you give it simple input.  LilyPond
-treats input like this:
+Up to this point none of the examples you have seen has used a
+@code{\score@{@}} command.  This is because LilyPond automatically
+adds the extra commands which are needed when you give it simple 
+input.  LilyPond treats input like this:
 
 @example
 \relative c'' @{
@@ -64,23 +68,31 @@ treats input like this:
 as shorthand for this:
 
 @example
-\score @{
-  \relative c'' @{
-    c4 a b c
+\book @{
+  \score @{
+    \new Staff @{
+      \new Voice @{
+        \relative c'' @{
+          c4 a b c
+        @}
+      @}
+    @}
+    \layout @{ @}
   @}
-  \layout @{ @}
 @}
 @end example
 
 In other words, if the input contains a single music expression,
 LilyPond will interpret the file as though the music expression
-was wrapped up inside a @code{\score@{@}}.
-
-@smallspace
+was wrapped up inside the commands shown above.  For now, though,
+let us return to the first example and examine the @code{\score}
+command, leaving the others to default.
 
-A @code{\score} must begin with a compound music expression.
+A @code{\score} block must always contain just one music 
+expression, and
+this must appear immediately after the @code{\score} command.
 Remember that a music expression could be anything from a single
-note to a huge
+note to a huge compound expression like
 
 @example
 @{
@@ -94,8 +106,8 @@ note to a huge
 Since everything is inside @code{@{ ... @}}, it counts
 as one music expression.
 
-As we saw previously, the @code{\score} can contain other things,
-such as
+As we saw previously, the @code{\score} block can contain other 
+things, such as
 
 @example
 \score @{
@@ -109,15 +121,25 @@ such as
 @noindent
 Some people put some of those commands outside the @code{\score}
 block -- for example, @code{\header} is often placed above the
-@code{\score}.  That's just another shorthand that LilyPond
-accepts.  Two more commands you have not previously seen are
+@code{\score} command.  That's just another shorthand that LilyPond
+accepts.
+
+Two more commands you have not previously seen are
 @code{\layout @{ @}} and @code{\midi @{@}}.  If these appear as 
 shown they will cause LilyPond to produce a printed output and a 
-MIDI out respectively.  They are described fully in the
-Notation Reference - @ruser{Score layout} and 
-@ruser{Creating MIDI files}.  
-
-@smallspace
+MIDI output respectively.  They are described fully in the
+Notation Reference -- @ruser{Score layout} and
+@ruser{Creating MIDI files}.
+
+You may code multiple @code{\score} blocks.  Each will be
+treated as a separate score, but they will be all combined into
+a single output file.  A @code{\book} command is not necessary
+-- one will be implicitly created.  However, if you would like
+separate output files from one @code{.ly} file then the
+@code{\book} command should be used to separate the different
+sections: each @code{\book} block will produce a
+separate output file.  For details see @ruser{Multiple scores
+in a book}.
 
 @cindex variables
 
@@ -137,11 +159,16 @@ melody = \relative c' @{
 When LilyPond looks at this file, it takes the value of
 @code{melody} (everything after the equals sign) and inserts it
 whenever it sees @code{\melody}.  There's nothing special about
-the names -- it could be @code{melody}, @code{global},
-@code{pianorighthand}, or @code{foofoobarbaz}.  You can use
-whatever variable names you want as along as they contain just
-alphabetic characters.  For more details, see
-@ruser{Saving typing with variables and functions}.
+the names -- it could be @code{melody}, @code{global}, 
+@code{TimeKey},
+@code{pianorighthand}, or @code{foofoobarbaz}.  For more details,
+see @ref{Saving typing with variables and functions}.
+Remember that you can use almost any name you like as long
+as it contains just alphabetic characters and is distinct from
+LilyPond command names.  The exact
+limitations on variable names are detailed in 
+@ruser{File structure}.
+
 
 
 @seealso
@@ -164,7 +191,7 @@ We didn't skip over it at all.  The big mystery is simply that
 there @emph{is} no mystery.  This line explains it all:
 
 @quotation
-@emph{A @code{\score} must begin with a compound music expression.}
+@emph{A @code{\score} block must begin with a compound music expression.}
 @end quotation
 
 @noindent
@@ -193,43 +220,42 @@ it.  We @emph{do} need a singer and a piano, though.
 
 @example
 \score @{
-  @{
-    <<
-      \new Staff = "singer" <<
-      >>
-      \new PianoStaff = piano <<
-      >>
+  <<
+    \new Staff = "singer" <<
     >>
-  @}
+    \new PianoStaff = piano <<
+    >>
+  >>
   \layout @{ @}
 @}
 @end example
 
-Remember that we use @code{<<} and @code{>>} to show simultaneous
+Remember that we use @code{<< ... >>} instead of
+@code{@{ ... @}} to show simultaneous
 music.  And we definitely want to show the vocal part and piano
 part at the same time, not one after the other!  However, the
-@code{<< .. >>} construct is not really necessary for the Singer
+@code{<< ... >>} construct is not really necessary for the Singer
 staff, as it contains only one music expression, but Staves often
-do require simultaneous Voices within them, so using @code{<< .. >>}
-rather than braces is a good habit to adopt.
+do require simultaneous Voices within them, so using 
+@code{<< ... >>}
+rather than braces is a good habit to adopt. We'll add some real
+music later; for now let's just put in some dummy notes and lyrics.
 
-@example
-\score @{
-  @{
-    <<
-      \new Staff = "singer" <<
-        \new Voice = "vocal" @{ @}
-        \addlyrics @{ @}
-      >>
-      \new PianoStaff = "piano" <<
-        \new Staff = "upper" @{ @}
-        \new Staff = "lower" @{ @}
-      >>
+@lilypond[verbatim,quote,ragged-right]
+\score {
+  <<
+    \new Staff = "singer" <<
+      \new Voice = "vocal" { c'1 }
+      \addlyrics { And }
     >>
-  @}
-  \layout @{ @}
-@}
-@end example
+    \new PianoStaff = "piano" <<
+      \new Staff = "upper" { c'1 }
+      \new Staff = "lower" { c'1 }
+    >>
+  >>
+  \layout { }
+}
+@end lilypond
 
 Now we have a lot more details.  We have the singer's staff: it
 contains a @code{Voice} (in LilyPond, this term refers to a set of
@@ -243,41 +269,40 @@ braces next to @code{\new Voice = vocal}, we could start writing
 
 @example
 \relative c'' @{
-  a4 b c d
+  r4 d8\noBeam g, c4 r
 @}
 @end example
 
 But if we did that, the @code{\score} section would get pretty
 long, and it would be harder to understand what was happening.  So
-let's use variables instead.
+let's use variables instead.  These were introduced at the end
+of the previous section, remember?  So, adding a few notes, we 
+now have a piece of real music:
 
-@example
-melody = \relative c'' @{ @}
-text   = \lyricmode @{ @}
-upper  = \relative c'' @{ @}
-lower  = \relative c @{ @}
-\score @{
-  @{
-    <<
-      \new Staff = "singer" <<
-        \new Voice = "vocal" @{ \melody @}
-        \addlyrics @{ \text @}
-      >>
-      \new PianoStaff = "piano" <<
-        \new Staff = "upper" @{ \upper @}
-        \new Staff = "lower" @{ \lower @}
-      >>
+@lilypond[verbatim,quote,ragged-right]
+melody = \relative c'' { r4 d8\noBeam g, c4 r }
+text   = \lyricmode { And God said, }
+upper  = \relative c'' { <g d g,>2~ <g d g,> }
+lower  = \relative c { b2 e2 }
+
+\score {
+  <<
+    \new Staff = "singer" <<
+      \new Voice = "vocal" { \melody }
+      \addlyrics { \text }
     >>
-  @}
-  \layout @{ @}
-@}
-@end example
+    \new PianoStaff = "piano" <<
+      \new Staff = "upper" { \upper }
+      \new Staff = "lower" {
+        \clef "bass"
+        \lower
+      }
+    >>
+  >>
+  \layout { }
+}
+@end lilypond
 
-@noindent
-Remember that you can use almost any name you like as long
-as it contains just alphabetic characters.  The exact
-limitations on variable names are detailed in
-@ruser{File structure}.
 
 Be careful about the difference between notes, which are introduced
 with @code{\relative}, and lyrics, which are introduced with
@@ -292,8 +317,8 @@ indentation -- make sure that each item on the same layer starts
 on the same horizontal position in your text editor.
 
 
-@node Nesting Music Expressions
-@subsection Nesting Music Expressions
+@node Nesting music expressions
+@subsection Nesting music expressions
 
 It is not essential to declare all staves at the beginning; 
 they may be introduced temporarily at any point.  This is
@@ -318,6 +343,12 @@ three notes:
 }
 @end lilypond
 
+@noindent
+Note that the size of the clef is the same as a clef printed
+following a clef change -- slightly smaller than the clef
+at the begining of the line.  This is usual for clefs printed
+in the middle of a line.
+
 The ossia section may be placed above the staff
 as follows:
 
@@ -339,17 +370,14 @@ as follows:
 
 This example uses @code{\with}, which will be explained more 
 fully later.  It is a means of modifying the default behaviour
-of a Staff.  Here it says that the new staff should be placed
-above the staff called @qq{main} instead of the default position
-which is below.
+of a single Staff.  Here it says that the new staff should be 
+placed above the staff called @qq{main} instead of the default 
+position which is below.
 
 Ossia are often written without clef and without
 time signature and are usually in a smaller font.
 These require further commands which
-have not yet been introduced.  See ...
-
-TODO Add ref to tweaks section where this example should
-be placed and explained.
+have not yet been introduced.  See @ref{Size of objects}
 
 @node On the un-nestedness of brackets and ties
 @subsection On the un-nestedness of brackets and ties
@@ -359,7 +387,9 @@ writing the input file to LilyPond.  These obey different rules
 which can be confusing at first.  Before we explain the rules 
 let's first review the different types of bracket.
 
-@multitable @columnfractions .3 .7 
+@c attempt to force this onto a new page
+@need 50
+@multitable @columnfractions .3 .7
 @headitem Bracket Type
   @tab Function
 @item @code{@{ .. @}}
@@ -367,7 +397,7 @@ let's first review the different types of bracket.
 @item @code{< .. >}
   @tab Encloses the notes of a chord
 @item @code{<< .. >>}
-  @tab Encloses concurrent or simultaneous sections 
+  @tab Encloses concurrent or simultaneous sections
 @item @code{( .. )}
   @tab Marks the start and end of a slur
 @item @code{\( .. \)}
@@ -381,23 +411,23 @@ between or across notes: ties (marked by a tilde, @code{~}),
 tuplets written as @code{\times x/y @{..@}}, and grace notes
 written as @code{\grace@{..@}}.
 
-Outside LilyPond, the conventional use of brackets requires 
-the different types to be properly nested, like this, 
+Outside LilyPond, the conventional use of brackets requires
+the different types to be properly nested, like this,
 @code{<< [ @{ ( .. ) @} ] >>}, with the closing brackets being
-encountered in exactly the opposite order to the opening 
-brackets.  This @strong{is} a requirement for the three types of 
-bracket described by the word @q{Encloses} in the table above - 
+encountered in exactly the opposite order to the opening
+brackets.  This @strong{is} a requirement for the three types of
+bracket described by the word @q{Encloses} in the table above --
 they must nest properly.
-However, the remaining brackets, described with the word 
+However, the remaining brackets, described with the word
 @q{Marks} in the table above together with ties and tuplets,
 do @strong{not} have to nest
-properly with any of the brackets.  In fact, these are not 
+properly with any of the brackets.  In fact, these are not
 brackets in the sense that
-they enclose something - they are simply markers to indicate
+they enclose something -- they are simply markers to indicate
 where something starts and ends.
 
 So, for example, a phrasing slur can start before a manually
-inserted beam and end before the end of the beam - not very
+inserted beam and end before the end of the beam -- not very
 musical, perhaps, but possible:
 
 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
@@ -427,7 +457,7 @@ two tuplets, and a phrasing slur extending out of a tuplet
 
 Singers need voices to sing, and so does LilyPond.
 The actual music for all instruments in a score 
-is contained in Voices - the most fundamental 
+is contained in Voices -- the most fundamental 
 of all LilyPond's concepts.
 
 @menu
@@ -450,7 +480,8 @@ packages.
 
 In fact, a Voice layer or context is the only one which can
 contain music.  If a Voice context is not explicitly declared
-one is created automatically.  Some instruments such as an 
+one is created automatically, as we saw at the beginning of
+this chapter.  Some instruments such as an 
 Oboe can play only one note at a time.  Music written for
 such instruments is monophonic and requires just a single
 voice.  Instruments which can play more than one note at a
@@ -459,97 +490,90 @@ encode the different concurrent notes and rhythms they are
 capable of playing.  
 
 A single voice can contain many notes in a chord, of course,
-so when exactly are multiple voices needed? 
-Let us analyse a short piece of music to see how many voices
-are required.  Here are the notes from the first two bars
-of the second of Chopin's Deux Nocturnes, Op 32.
+so when exactly are multiple voices needed?  Look first at
+this example of four chords:
 
-@c The following should appear as music without code
-@lilypond[quote,ragged-right]
-\new Staff \relative c'' {
-  \key aes \major
-  <<
-    { \voiceOne
-      c2 aes4. bes8 } \\
-    { \voiceTwo
-      aes2 f4 fes } \\
-    { \voiceFour
-      \once \override NoteColumn #'force-hshift = #0 <ees c>2
-      \once \override NoteColumn #'force-hshift = #0.5 des2 }
-  >> |
-  <c ees aes c>1 |
-}
-@end lilypond
-
-The direction of the stems is often used to indicate the
-continuity of two simultaneous melodic lines.  Here the
-stems of the highest notes are all pointing up and the
-stems of the lower notes are all pointing down.
-This is the first indication that more than one voice
-is required.
-
-But the real need for multiple voices arises when notes
-which start at the same time have different durations.
-Look at the notes which start at beat three in the first 
-bar.  The a-flat is a dotted quarter note, the f is a
-quarter note and the d-flat is a half note.  These 
-cannot be written as a chord as all the notes in a chord
-must have the same duration.  Neither can they be written
-as sequential notes, as they must start at the same time.
-This section of the bar requires three voices, and the
-normal practice would be to write the whole bar as three
-voices, as shown here, where we have used different noteheads
-and colors for the three voices.
-
-@c The following should appear as music without code
-@c The three voice styles should be defined in -init
-@lilypond[quote,ragged-right]
-\new Staff \relative c'' {
-  \key aes \major
-  <<
-    { \voiceOne
-      \voiceOneStyle 
-      c2 aes4. bes8 } \\
-    { \voiceTwo
-      \voiceTwoStyle
-      aes2 f4 fes } \\
-    { \voiceFour
-      \voiceThreeStyle
-      \once \override NoteColumn #'force-hshift = #0 <ees c>2
-      \once \override NoteColumn #'force-hshift = #0.5 des2 }
-  >> |
-  <c ees aes c>1 |
-}
+@lilypond[quote,verbatim,fragment,ragged-right,relative=1]
+\key g \major
+<d g>4 <d fis> <d a'> <d g>
 @end lilypond
 
-Let us see how this is done.
-
+This can be expressed using just the single angle bracket chord 
+symbols, @code{< ... >}, and for this just a single voice is 
+needed.  But suppose the F-sharp were actually an eighth-note
+followed by an eighth-note G, a passing note on the way to the A?
+Now we have two notes which start at the same time but have
+different durations: the quarter-note D and the eighth-note
+F-sharp.  How are these to be coded?  They cannot be written as
+a chord because all the notes in a chord must have the same
+duration.  And they cannot be written as two separate notes
+as they need to start at the same time.  This is when two
+voices are required.
+
+Let us see how this is done in LilyPond input syntax.
+
+@funindex << \\ >>
 @funindex \\
 
 The easiest way to enter fragments with more than one voice on a
 staff is to enter each voice as a sequence (with @code{@{...@}}),
 and combine them simultaneously with angle brackets, @code{<<...>>}.
-The fragments must also be separated with double backward slashes, 
-@code{\\}, to place them in separate voices.  Without these, the 
-notes would be entered into a single voice, which would usually 
+The fragments must also be separated with double backward slashes,
+@code{\\}, to place them in separate voices.  Without these, the
+notes would be entered into a single voice, which would usually
 cause errors.  This technique is particularly suited to pieces of
 music which are largely monophonic with occasional short sections
-of polyphony.  Here's a simple example:
+of polyphony.  
+
+Here's how we split the chords above into two voices and add both
+the passing note and a slur:
+
+@lilypond[quote,verbatim,fragment,ragged-right,relative=2]
+\key g \major
+%    Voice "1"                  Voice "2"
+<< { g4 fis8( g) a4 g }    \\ { d4 d d d }  >> |
+@end lilypond
+
+Notice how the stems of the second voice now point down.
+
+Here's another simple example:
 
 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
 \key d \minor
 %    Voice "1"             Voice "2"
 << { r4 g g4. a8 }    \\ { d,2 d4 g }       >> |
 << { bes4 bes c bes } \\ { g4 g g8( a) g4 } >> |
-<< { a2. r4 }         \\ { fis2. s4 }       >>
+<< { a2. r4 }         \\ { fis2. s4 }       >> |
+@end lilypond
+
+It is not necessary to use a separate @code{<< \\ >>} construct
+for each bar. For music with few notes in each bar this layout
+can help the legibility of the code, but if there are many
+notes in each bar it may be better to split out each voice
+separately, like this:
+
+@lilypond[quote,verbatim,fragment,ragged-right,relative=2]
+\key d \minor
+<< {
+  % Voice "1"
+  r4 g g4. a8 |
+  bes4 bes c bes |
+  a2. r4 |
+} \\ {
+  % Voice "2"
+  d,2 d4 g |
+  g4 g g8( a) g4 |
+  fis2. s4 |
+} >>
 @end lilypond
 
+
 This example has just two voices, but the same contruct may be
 used to encode three or more voices by adding more back-slash
 separators.
 
-The Voice contexts bear the names @code{"1"}, @code{"2"}, etc.  
-In each of these contexts, the vertical direction of slurs, 
+The Voice contexts bear the names @code{"1"}, @code{"2"}, etc.
+In each of these contexts, the vertical direction of slurs,
 stems, ties, dynamics etc., is set appropriately.
 
 @lilypond[quote,verbatim,fragment]
@@ -570,43 +594,56 @@ into or out of a simultaneous construct.  Conversely,
 parallel voices from separate simultaneous constructs on the same
 staff are the same voice.  Other voice-related properties also
 carry across simultaneous constructs.  Here is the same example,
-with different colors and noteheads for each voice.  Note that
-changes in one Voice do not affect other voices, but they do
-persist in the same Voice later.  Note also that tied notes may be
+with different colors and note heads for each voice.  Note that
+changes in one voice do not affect other voices, but they do
+persist in the same voice later.  Note also that tied notes may be
 split across the same voices in two constructs, shown here in the
 blue triangle voice.
 
 @lilypond[quote,verbatim]
 \new Staff \relative c' {
-  \voiceOneStyle
+  % Main voice
   c16 d e f
   << % Bar 1
-    { g4 f e } \\
-    { \voiceTwoStyle
-      r8 e4 d c8 ~ }
-  >> |
+    {
+      \voiceOneStyle
+      g4 f e
+    }
+  \\
+    {
+      \voiceTwoStyle
+      r8 e4 d c8 ~
+    }
+  >>
   << % Bar 2
-    { d2 e2 } \\
-    { c8 b16 a b8 g ~ g2 } \\
-    { \voiceThreeStyle
-      s4 b4 c2 }
+     % Voice 1 continues
+    { d2 e2 }
+  \\
+     % Voice 2 continues
+    { c8 b16 a b8 g ~ g2 }
+  \\
+    {
+      \voiceThreeStyle
+      s4 b4 c2
+    }
   >>
 }
 @end lilypond
 
 The commands @code{\voiceXXXStyle} are mainly intended for use in
 educational documents such as this one.  They modify the color
-of the notehead, the stem and the beams, and the style of the
-notehead, so that the voices may be easily distinguished.
+of the note head, the stem and the beams, and the style of the
+note head, so that the voices may be easily distinguished.
 Voice one is set to red diamonds, voice two to blue triangles,
 voice three to green crossed circles, and voice four (not used
-here) to magenta crosses.  We shall see later how commands like 
+here) to magenta crosses.  We shall see later how commands like
 these may be created by the user.
-TODO: add ref to appropriate section in Tweaks
+See @ref{Visibility and color of objects}
+TODO Add link to using variables for tweaks
 
 Polyphony does not change the relationship of notes within a
-@code{\relative @{ @}} block.  Each note is still calculated 
-relative to the note immediately preceding it, or to the first 
+@code{\relative @{ @}} block.  Each note is still calculated
+relative to the note immediately preceding it, or to the first
 note of the preceding chord.  So in
 
 @example
@@ -620,93 +657,206 @@ note of the preceding chord.  So in
 @code{noteC}.                                                 @*
 @code{noteE} is relative to @code{noteD}, not @code{noteA}
 
-We are now in a position to return to the first example from
-the Chopin Nocturne to see how this might be encoded.  As we
+An alternative way, which may be clearer if the notes in the
+voices are widely separated, is to place a @code{\relative}
+command at the start of each voice:
+
+@example
+\relative c' @{ noteA ... @}
+<<
+  \relative c'' @{ < noteB noteC > ... @}
+\\
+  \relative g' @{ noteD ... @}
+>>
+\relative c' @{ noteE ... @}
+@end example
+
+Let us finally analyse the voices in a more complex piece of 
+music.  Here are
+the notes from the first two bars of the second of Chopin's
+Deux Nocturnes, Op 32.  This example will be used at later
+stages in this and the next chapter to illustrate several
+techniques for producing notation, so please ignore for now
+anything in the underlying code which looks mysterious and
+concentrate just on the music and the voices -- the
+complications will all be explained in later sections.
+
+@c The following should appear as music without code
+@lilypond[quote,ragged-right]
+\new Staff \relative c'' {
+  \key aes \major
+  << % Voice one
+    { c2 aes4. bes8 }
+  \\ % Voice two
+    { aes2 f4 fes }
+  \\ % No voice three
+  \\ % Voice four
+    {
+      % Ignore these for now - they are explained in Ch 4
+      \once \override NoteColumn #'force-hshift = #0
+      <ees c>2
+      \once \override NoteColumn #'force-hshift = #0.5
+      des2
+    }
+  >> |
+  <c ees aes c>1 |
+}
+@end lilypond
+
+The direction of the stems is often used to indicate the
+continuity of two simultaneous melodic lines.  Here the
+stems of the highest notes are all pointing up and the
+stems of the lower notes are all pointing down.
+This is the first indication that more than one voice
+is required.
+
+But the real need for multiple voices arises when notes
+which start at the same time have different durations.
+Look at the notes which start at beat three in the first
+bar.  The A-flat is a dotted quarter note, the F is a
+quarter note and the D-flat is a half note.  These
+cannot be written as a chord as all the notes in a chord
+must have the same duration.  Neither can they be written
+as sequential notes, as they must start at the same time.
+This section of the bar requires three voices, and the
+normal practice would be to write the whole bar as three
+voices, as shown below, where we have used different note heads
+and colors for the three voices.  Again, the code behind this
+example will be explained later, so ignore anything you do
+not understand.
+
+@c The following should appear as music without code
+@c The three voice styles should be defined in -init
+@lilypond[quote,ragged-right]
+\new Staff \relative c'' {
+  \key aes \major
+  <<
+    { % Voice one
+      \voiceOneStyle
+      c2 aes4. bes8 
+    }
+  \\  % Voice two
+    { \voiceTwoStyle
+      aes2 f4 fes 
+    }
+  \\  % No Voice three (we want stems down)
+  \\  % Voice four
+    { \voiceThreeStyle
+      % Ignore these for now - they are explained in Ch 4
+      \once \override NoteColumn #'force-hshift = #0
+      <ees c>2
+      \once \override NoteColumn #'force-hshift = #0.5
+      des2 
+    }
+  >> |
+  <c ees aes c>1 |
+}
+@end lilypond
+
+
+Let us try to encode this music from scratch.  As we
 shall see, this encounters some difficulties.  We begin as
-we have learnt, using the @code{<< \\  >>} construct to 
+we have learnt, using the @code{<< \\  >>} construct to
 enter the music of the first bar in three voices:
 
 @lilypond[quote,verbatim,fragment,ragged-right]
 \new Staff \relative c'' {
   \key aes \major
-  << 
+  <<
     { c2 aes4. bes8 } \\ { aes2 f4 fes } \\ { <ees c>2 des2 }
-  >> |
-  <c ees aes c>1 |
+  >>
+  <c ees aes c>1
 }
 @end lilypond
 
 @cindex stem down
 @cindex stem up
-@funindex \voiceOne
-@funindex \voiceTwo
-@funindex \voiceThree
-@funindex \voiceFour
 
 The stem directions are automatically assigned with the
 odd-numbered voices taking upward stems and the even-numbered
 voices downward ones.  The stems for voices 1 and 2 are right,
 but the stems in voice 3 should go down in this particular piece
-of music.  We can correct this
-by telling LilyPond that this third voice is really a fourth
-voice, with stems going down, using the @code{\voiceFour} 
-command.  There are also corresponding @code{\voiceOne},
-@code{\voiceTwo}, and @code{voiceThree} 
-commands.  This results in the following:
+of music.  We can correct this simply by missing out voice three
+and placing the music in voice four:
 
 @lilypond[quote,verbatim,fragment,ragged-right]
 \new Staff \relative c'' {
   \key aes \major
-  << 
-    { c2 aes4. bes8 } \\ 
-    { aes2 f4 fes   } \\ 
-    { \voiceFour <ees c>2 des2 }
+  << % Voice one
+    { c2 aes4. bes8 }
+  \\ % Voice two
+    { aes2 f4 fes   }
+  \\ % Omit Voice three
+  \\ % Voice four
+    { <ees c>2 des2 }
   >> |
   <c ees aes c>1 |
 }
 @end lilypond
 
 @noindent
-and exposes a problem commonly encountered with multiple
-voices: the stems of notes can collide with noteheads
+We see that this fixes the stem direction, but exposes a 
+problem sometimes encountered with multiple voices -- the 
+stems of the notes in one voice can collide with the note heads
 in other voices.  In laying out the notes, LilyPond allows the
 notes or chords from two voices to occupy the same vertical
 note column provided the stems are in opposite directions, but
-the notes from a third voice are displaced to avoid the stems
-colliding.  This often works well, but in this example the
-notes of the third voice are clearly not well placed by default.
+the notes from the third and fourth voices are displaced to if
+necessary to avoid the note heads
+colliding.  This usually works well, but in this example the
+notes of the lowest voice are clearly not well placed by default.
 LilyPond provides several ways to adjust the horizontal placing
 of notes.  We are not quite ready yet to see how to correct this,
-so we shall leave this problem until a later section (see ... )
-
-TODO link.
+so we shall leave this problem until a later section
+(see the force-hshift property in @ref{Fixing overlapping 
+notation} )
 
 @node Explicitly instantiating voices
 @subsection Explicitly instantiating voices
 
+@funindex \voiceOne
+@funindex \voiceTwo
+@funindex \voiceThree
+@funindex \voiceFour
+
 Voice contexts can also be created manually
 inside a @code{<< >>} block to create polyphonic music, using
 @code{\voiceOne} ... @code{\voiceFour} to indicate the required
-directions of stems, slurs, etc.
+directions of stems, slurs, etc.  In longer scores this method
+is clearer, as it permits the voices to be separated and to be
+given more descriptive names.
 
 Specifically, the construct @code{<< \\ >>} which we used in
 the previous section:
 
 @example
-<< \upper \\ \lower >>
+\new Staff @{
+  \relative c' @{
+    << @{ e4 f g a @} \\ @{ c,4 d e f @} >>
+  @}
+@}
 @end example
 
 @noindent
-where @code{upper} and @code{lower} are user-defined variables 
-containing the music for the two voices, is equivalent to 
+is equivalent to 
 
 @example
-<<
-  \new Voice = "1" @{ \voiceOne \upper @}
-  \new Voice = "2" @{ \voiceTwo \lower @}
+\new Staff <<
+  \new Voice = "1" @{ \voiceOne \relative c' @{ e4 f g a @} @}
+  \new Voice = "2" @{ \voiceTwo \relative c' @{ c4 d e f @} @}
 >>
 @end example
 
+Both of the above would produce
+
+@c The following example should not display the code
+@lilypond[ragged-right,quote]
+\new Staff <<
+  \new Voice = "1" { \voiceOne \relative c' { e4 f g a } }
+  \new Voice = "2" { \voiceTwo \relative c' { c4 d e f } }
+>>
+@end lilypond
+
 The @code{\voiceXXX} commands set the direction of stems, slurs,
 ties, articulations, text annotations, augmentation dots of dotted
 notes, and fingerings.  @code{\voiceOne} and @code{\voiceThree}
@@ -721,50 +871,58 @@ Let us see in some simple examples exactly what effect
 markup, ties, slurs, and dynamics:
 
 @lilypond[quote,ragged-right,verbatim]
-\relative c'{ 
-  c-"default" d8 ~ d e4 ( f g a ) b-> c
+\relative c'{
+  % Default behaviour or behaviour after \oneVoice
+  c d8 ~ d e4 ( f g a ) b-> c
 }
 @end lilypond
 
 @lilypond[quote,ragged-right,verbatim]
 \relative c'{
   \voiceOne
-  c-"\\voiceOne" d8 ~ d e4 ( f g a ) b-> c
+  c d8 ~ d e4 ( f g a ) b-> c
   \oneVoice
-  c,-"\\oneVoice" d8 ~ d e4 ( f g a ) b-> c
+  c, d8 ~ d e4 ( f g a ) b-> c
 }
 @end lilypond
 
 @lilypond[quote,ragged-right,verbatim]
 \relative c'{
   \voiceTwo
-  c-"\\voiceTwo" d8 ~ d e4 ( f g a ) b-> c
+  c d8 ~ d e4 ( f g a ) b-> c
   \oneVoice
-  c,-"\\oneVoice" d8 ~ d e4 ( f g a ) b-> c
+  c, d8 ~ d e4 ( f g a ) b-> c
 }
 @end lilypond
 
 An expression that appears directly inside a @code{<< >>} belongs
 to the main voice (but, note, @strong{not} in a @code{<< \\ >>}
-contruct).  This is useful when extra voices appear while the main
-voice is playing.  Here is a more correct rendition of the example
-from the previous section.  The red diamond-shaped notes
+construct).  This is useful when extra voices appear while the
+main voice is playing.  Here is a more correct rendition of the
+example from the previous section.  The red diamond-shaped notes
 demonstrate that the main melody is now in a single voice context,
 permitting a phrasing slur to be drawn over them.
 
 @lilypond[quote,ragged-right,verbatim]
 \new Staff \relative c' {
   \voiceOneStyle
-  c16^( d e f  % These notes are monophonic
-  <<           % Start simultaneous section of three voices
-    { g4 f e | d2 e2) }  % Continue the main voice in parallel
-    \new Voice {         % Initiate second voice
-      \voiceTwo          % Set stems, etc, down
+  % The following notes are monophonic
+  c16^( d e f
+  % Start simultaneous section of three voices
+  <<
+    % Continue the main voice in parallel
+    { g4 f e | d2 e2) }
+    % Initiate second voice
+    \new Voice {
+      % Set stems, etc, down
+      \voiceTwo
       r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
     }
-    \new Voice {         % Initiate third voice
-      \voiceThree        % Set stems, etc, up
-      s2. | s4 b4 c2 
+    % Initiate third voice
+    \new Voice {
+      % Set stems, etc, up
+      \voiceThree
+      s2. | s4 b4 c2
     }
   >>
 }
@@ -787,7 +945,7 @@ typeset the music.
       r8 e4 d c8 ~ |
       <<
         {c8 b16 a b8 g ~ g2}
-        \new Voice { 
+        \new Voice {
           \voiceThree
           s4 b4 c2
         }
@@ -798,30 +956,72 @@ typeset the music.
 @end lilypond
 
 
-This method of nesting new voices briefly is useful 
+This method of nesting new voices briefly is useful
 when only small sections of the music
 are polyphonic, but when the whole staff is largely polyphonic
-it can be clearer to use multiple voices throughout, using 
-spacing notes to step over sections where the voice is silent, 
+it can be clearer to use multiple voices throughout, using
+spacing notes to step over sections where the voice is silent,
 as here:
 
 @lilypond[quote,ragged-right,verbatim]
 \new Staff \relative c' <<
-  \new Voice {   % Initiate first voice
+  % Initiate first voice
+  \new Voice {
     \voiceOne
     c16^( d e f g4 f e | d2 e2) |
   }
-  \new Voice {   % Initiate second voice
-    \voiceTwo    % set stems, etc down
+  % Initiate second voice
+  \new Voice {
+    % set stems, etc down
+    \voiceTwo
     s4 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2 |
   }
-  \new Voice {   % Initiate third voice
-    \voiceThree  % set stems, etc up
+  % Initiate third voice
+  \new Voice {
+    % set stems, etc up
+    \voiceThree
     s1 | s4 b4 c2 |
   }
 >>
 @end lilypond
 
+@cindex note column
+@cindex shift commands
+@funindex \shiftOff
+@funindex \shiftOn
+@funindex \shiftOnn
+@funindex \shiftOnnn
+
+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.  There are separate columns for each voice, and 
+the currently specified voice-dependent shift is applied to the 
+note column if there would otherwise be a collision.  This can
+be seen in the example above.  In bar 2 the C in voice two is
+shifted to the right relative to the D in voice one, and in the
+final chord the C in voice three is also shifted to the right
+relative to the other notes.
+
+The @code{\shiftOn}, @code{\shiftOnn}, @code{\shiftOnnn}, and
+@code{\shiftOff} commands specify the degree to which notes and
+chords of the voice should be shifted if a collision
+would otherwise occur. By default, the outer voices (normally 
+voices one and two) have @code{\shiftOff} specified, while the 
+inner voices (three and four) have @code{\shiftOn} specified.  
+When a shift is applied, Voices one and three are shifted to 
+the right and voices two and four to the left.
+
+@code{\shiftOnn} and @code{\shiftOnnn} define further shift
+levels which may be specified temporarily to resolve collisions
+in complex situations -- see @ref{Real music example}.
+
+A note column can contain just one note (or chord) from a voice
+with stems up and one note (or chord) from a voice with stems
+down.  If notes from two voices which have their stems in the
+same direction are placed at the same position and both voices 
+have no shift or the same shift specified, the error message
+@qq{Too many clashing note columns} will be produced.
 
 @node Voices and vocals
 @subsection Voices and vocals
@@ -829,12 +1029,12 @@ as here:
 Vocal music presents a special difficulty: we need to combine two
 expressions -- notes and lyrics.
 
-You have already seen the @code{\addlyricsd@{@}} command, which
+You have already seen the @code{\addlyrics@{@}} command, which
 handles simple scores well.  However, this technique is
 quite limited.  For more complex music, you must introduce the
 lyrics in a @code{Lyrics} context using @code{\new Lyrics} and
 explicitly link
-the lyrics to the notes with @code{\lyricsto@{@}}, using the 
+the lyrics to the notes with @code{\lyricsto@{@}}, using the
 name assigned to the Voice.
 
 @lilypond[quote,verbatim,fragment]
@@ -888,6 +1088,7 @@ SopTwoLyrics = \lyricmode {
     >>
     \new Staff <<
       \new Voice = "SopTwo" {
+        \global
         \SopTwoMusic
       }
       \new Lyrics \lyricsto "SopTwo" {
@@ -909,7 +1110,7 @@ verses, set for SATB.  In this case the words for all four
 parts are the same.
 
 @lilypond[quote,verbatim]
-global = { \time 4/4 \partial 4 \key c \major}
+TimeKey = { \time 4/4 \partial 4 \key c \major}
 SopMusic   = \relative c' { c4 | e4. e8 g4  g  | a a g }
 AltoMusic  = \relative c' { c4 | c4. c8 e4  e  | f f e }
 TenorMusic = \relative c  { e4 | g4. g8 c4. b8 | a8 b c d e4 }
@@ -927,7 +1128,7 @@ VerseFour  = \lyricmode {
   \new ChoirStaff <<
     \new Staff <<
       \clef "treble"
-      \new Voice = "Sop"  { \voiceOne \global \SopMusic }
+      \new Voice = "Sop"  { \voiceOne \TimeKey \SopMusic }
       \new Voice = "Alto" { \voiceTwo \AltoMusic }
       \new Lyrics \lyricsto "Sop" { \VerseOne   }
       \new Lyrics \lyricsto "Sop" { \VerseTwo   }
@@ -936,7 +1137,7 @@ VerseFour  = \lyricmode {
     >>
     \new Staff <<
       \clef "bass"
-      \new Voice = "Tenor" { \voiceOne \TenorMusic }
+      \new Voice = "Tenor" { \voiceOne \TimeKey \TenorMusic }
       \new Voice = "Bass"  { \voiceTwo \BassMusic  }
     >>
   >>
@@ -955,8 +1156,9 @@ in the fine-tuning of LilyPond output.
 @menu
 * Contexts explained::          
 * Creating contexts::           
-* Engravers::                   
-* Modifying contexts::          
+* Engravers explained::         
+* Modifying context properties::  
+* Adding and removing engravers::  
 @end menu
 
 @node Contexts explained
@@ -983,31 +1185,31 @@ to a single staff, while a bar line must be synchronized across
 the entire score.
 
 Within LilyPond, these rules and bits of information are grouped
-in @emph{Contexts}.  We have already met the @context{Voice} 
-context. 
-Others are the @context{Staff} and @context{Score} contexts.  
+in @emph{Contexts}.  We have already met the 
+@code{Voice} context. 
+Others are the @code{Staff} and @code{Score} contexts.  
 Contexts are hierarchical to reflect the heirarchical nature of 
 a musical score.  
-For example: a @context{Staff} context can contain many 
-@context{Voice} contexts, and a @context{Score} context can 
-contain many @context{Staff} contexts.
+For example: a @code{Staff} context can contain many 
+@code{Voice} contexts, and a @code{Score} context can 
+contain many @code{Staff} contexts.
 
 @quotation
-@image{context-example,5cm,,}
+@sourceimage{context-example,5cm,,}
 @end quotation
 
 Each context has the responsibility for enforcing some notation rules,
 creating some notation objects and maintaining the associated
-properties.  For example, the @context{Voice} context may introduce an
-accidental and then the @context{Staff} context maintains the rule to
+properties.  For example, the @code{Voice} context may introduce an
+accidental and then the @code{Staff} context maintains the rule to
 show or suppress the accidental for the remainder of the measure.
 
 As another example, the synchronization of bar lines is, by default, 
-handled in the @context{Score} context.
+handled in the @code{Score} context.
 However, in some music we may not want the bar lines to be
 synchronized -- consider a polymetric score in 4/4 and 3/4 time.
 In such cases, we must modify the default settings of the 
-@context{Score} and @context{Staff} contexts.
+@code{Score} and @code{Staff} contexts.
 
 For very simple scores, contexts are created implicitly, and you need
 not be aware of them.  For larger pieces, such as anything with more
@@ -1017,29 +1219,28 @@ need, and that they are in the correct order.  For typesetting pieces
 with specialized notation, it is usual to modify existing, or
 even to define totally new, contexts.
 
-In addition to the @context{Score,} @context{Staff} and 
-@context{Voice} contexts there are contexts which fit between
+In addition to the @code{Score,} @code{Staff} and 
+@code{Voice} contexts there are contexts which fit between
 the score and staff levels to control staff groups, such as the
-@context{PianoStaff} and @context{ChoirStaff} contexts.  There
+@code{PianoStaff} and @code{ChoirStaff} contexts.  There
 are also alternative staff and voice contexts, and contexts for
-lyrics, percussion, fret boards, figured bass, etc.  A complete
-list is shown in the Notation Reference.
-TODO: Add link
+lyrics, percussion, fret boards, figured bass, etc.
 
-The names of all context types are formed from one or more 
+The names of all context types are formed from one or more
 words, each word being capitalised and joined immediately to the 
 preceding word with no hyphen or underscore, e.g., 
-@context{GregorianTranscriptionStaff}.
+@code{GregorianTranscriptionStaff}.
 
 @node Creating contexts
 @subsection Creating contexts
 
-There can be only one top level context: the @context{Score} 
+There can be only one top level context: the 
+@code{Score} 
 context.  This is created with the @code{\score} command, 
 or, in simple scores, it is created automatically.
 
 For scores with only one voice and one staff, the 
-@context{Voice} and @context{Staff} contexts may be left to be 
+@code{Voice} and @code{Staff} contexts may be left to be 
 created automatically, but for more complex scores it is 
 necessary to create them by hand.  
 The simplest command that does this is @code{\new}.  
@@ -1050,30 +1251,27 @@ It is prepended to a music expression, for example
 @cindex Context, creating
 
 @example
-\new @var{type} @var{music expression}
+\new @var{type} @var{music-expression}
 @end example
 
 @noindent
 where @var{type} is a context name (like @code{Staff} or
 @code{Voice}).  This command creates a new context, and starts
-interpreting the @var{music expression} within that context.
+interpreting the @var{music-expression} within that context.
 
-Note that there is no @code{\new Score % Invalid!} command;
-the single top-level @context{Score} context is introduced 
-with @code{\score}.  This is because there can be only one 
-@context{Score} context, whereas there may be multiple 
-@context{Staff} and @context{Voice} contexts - each created 
-by @code{\new}.
+Note that there is no @code{\new Score} command;
+the single top-level @code{Score} context is introduced 
+with @code{\score}.  
 
 The @code{\new} command may also give a identifying name to the 
 context to distinguish it from other contexts of the same type,
 
 @example
-\new @var{type} = @var{id} @var{music}
+\new @var{type} = @var{id} @var{music-expression}
 @end example
 
 Note the distinction between the name of the context type,
-@context{Staff}, @context{Voice}, etc, and
+@code{Staff}, @code{Voice}, etc, and
 the identifying name of a particular instance of that type,
 which can be any sequence of letters invented by the user.
 The identifying name is used to refer back to that particular
@@ -1081,12 +1279,14 @@ instance of a context.  We saw this in use in the section on
 lyrics in @ref{Voices and vocals}.
 
 
-@node Engravers
-@subsection Engravers
+@node Engravers explained
+@subsection Engravers explained
+
+@cindex engravers
 
 Every mark on the printed output of a score produced by LilyPond
 is produced by an @code{Engraver}.  Thus there is an engraver
-to print staves, one to print noteheads, one for stems, one for
+to print staves, one to print note heads, one for stems, one for
 beams, etc, etc.  In total there are over 120 such engravers!
 Fortunately, for most scores it is not necessary to know about 
 more than a few, and for simple scores you do not need to know 
@@ -1095,14 +1295,14 @@ about any.
 Engravers live and operate in Contexts.
 Engravers such as the @code{Metronome_mark_engraver}, whose
 action and output applies to the score as a whole, operate in
-the highest level context - the @context{Score} context.
+the highest level context -- the @code{Score} context.
 
 The @code{Clef_engraver} and @code{Key_engraver} are to be
 found in every Staff Context, as different staves may require 
 different clefs and keys.
 
 The @code{Note_heads_engraver} and @code{Stem_engraver} live
-in each @context{Voice} context, the lowest level context of all.
+in every @code{Voice} context, the lowest level context of all.
 
 Each engraver processes the particular objects associated
 with its function, and maintains the properties that relate
@@ -1138,13 +1338,15 @@ the name, or vice versa.
 @item Metronome_mark_engraver
   @tab Engraves metronome marking
 @item Note_heads_engraver
-  @tab Engraves noteheads
+  @tab Engraves note heads
 @item Rest_engraver
   @tab Engraves rests
 @item Staff_symbol_engraver
   @tab Engraves the five (by default) lines of the staff
 @item Stem_engraver
   @tab Creates stems and single-stem tremulos
+@item Time_signature_engraver
+  @tab Creates time signatures
 @end multitable
 
 @smallspace
@@ -1153,15 +1355,8 @@ We shall see later how the output of LilyPond can be changed
 by modifying the action of Engravers.
   
 
-@node Modifying contexts
-@subsection Modifying contexts
-
-@menu
-* Changing context properties::  
-@end menu
-@node Changing context properties
-@subsubsection Changing context properties
+@node Modifying context properties
+@subsection Modifying context properties
 
 @cindex context properties
 @funindex \set
@@ -1174,90 +1369,113 @@ appearance of the output.  They are changed by the
 @code{\set} command.  This takes the form
 
 @example
-\set @emph{ContextName}.@emph{propertyName} = @emph{value}
+\set @emph{ContextName}.@emph{propertyName} = #@emph{value}
 @end example
 
-Where the @emph{ContextName} is usually @context{Score},
-@context{Staff} or @context{Voice}.  It may be omitted,
-in which case @context{Voice} is assumed.
+Where the @emph{ContextName} is usually @code{Score},
+@code{Staff} or @code{Voice}.  It may be omitted,
+in which case @code{Voice} is assumed.
 
 The names of context properties consist of words joined
 together with no hyphens or underscores, all except the
 first having a capital letter.  Here are a few examples
 of some commonly used ones.  There are many more.
 
-@multitable @columnfractions .3 .2 .5 
+@c attempt to force this onto a new page
+@need 50
+@multitable @columnfractions .25 .15 .45 .15
 @headitem propertyName
-  @tab Value
+  @tab Type
   @tab Function
+  @tab Example Value
 @item extraNatural
-  @tab ##t or ##f
-  @tab If true (##t), set extra natural sign before accidentals
+  @tab Boolean
+  @tab If true, set extra natural signs before accidentals
+  @tab @code{#t}, @code{#f}
 @item currentBarNumber
   @tab Integer
   @tab Set the current bar number
+  @tab @code{50}
 @item doubleSlurs
-  @tab ##t or ##f
-  @tab If true (##t), print slurs both above and below notes
+  @tab Boolean
+  @tab If true, print slurs both above and below notes
+  @tab @code{#t}, @code{#f}
 @item instrumentName
   @tab Text
   @tab Set the name to be placed at the start of the staff
+  @tab @code{"Cello I"}
 @item fontSize
-  @tab Number
+  @tab Real
   @tab Increase or decrease the font size
+  @tab @code{2.4}
 @item stanza
   @tab Text
   @tab Set the text to print before the start of a verse
+  @tab @code{"2"}
 @end multitable
-   
+
+@noindent
+where a Boolean is either True (@code{#t}) or False (@code{#f}),
+an Integer is a positive whole number, a Real is a positive
+or negative decimal number, and text is enclosed in double
+apostrophes.  Note the occurrence of hash signs,
+(@code{#}), in two different places -- as part of the Boolean 
+value before the @code{t} or @code{f}, and before @emph{value}
+in the @code{\set} statement.  So when a Boolean is being 
+entered you need to code two hash signs, e.g., @code{##t}.  
+
 Before we can set any of these properties we need to know
-which context they operate in.  Sometimes this is obvious,
+in which context they operate.  Sometimes this is obvious,
 but occasionally it can be tricky.  If the wrong context
 is specified, no error message is produced, but the expected
-action will not be taken.  For example, the 
+action will not take place.  For example, the
 @code{instrumentName} clearly lives in the Staff context, since
-it is the staff that is named.
-In this example the first staff is labelled, but the second,
-Alto, staff is not, because we omitted the context name.
+it is the staff that is to be named.
+In this example the first staff is labelled, but not the second,
+because we omitted the context name.
 
 @lilypond[quote,verbatim,ragged-right]
 <<
   \new Staff \relative c'' {
-    \set Staff.instrumentName = "Soprano"
+    \set Staff.instrumentName = #"Soprano"
     c4 c
  }
   \new Staff \relative c' {
-  \set instrumentName = "Alto"
+  \set instrumentName = #"Alto"  % Wrong!
   d4 d 
  }
 >>
 @end lilypond
 
 Remember the default context name is Voice, so the second
-@code{\set} command set the property @emph{instrumentName} in the
+@code{\set} command set the property @code{instrumentName} in the
 Voice context to @qq{Alto}, but as LilyPond does not look
-for any such property in the @context{Voice} context, no 
-further action took place.  No error message is logged in
-the log file.
+for any such property in the @code{Voice} context, no 
+further action took place.  This is not an error, and no error 
+message is logged in the log file.
 
 Similarly, if the property name is mis-spelt no error message 
-is produced, and the expected action clearly is not performed.
+is produced, and clearly the expected action cannot be performed.
 If fact, you can set any (fictitious) @q{property} using any 
 name you like in any context that exists by using the 
 @code{\set} command.  But if the name is not
 known to LilyPond it will not cause any action to be taken.
+This is one of the reasons why it is highly recommended to
+use a context-sensitive editor with syntax highlighting for
+editing LilyPond files, such as Vim, Jedit, ConTEXT or Emacs,
+since unknown property names will be highlighted differently.
 
 The @code{instrumentName} property will take effect only
-if it is set in the @context{Staff} context, but
+if it is set in the @code{Staff} context, but
 some properties can be set in more than one context.
 For example, the property @code{extraNatural} is by
 default set to ##t (true) for all staves.  
-If it is set to ##f (false) in the @context{Staff} context 
-it applies just to the accidentals on that staff.  
-If it is set to false in the @context{Score} context
+If it is set to ##f (false) in one particular @code{Staff} 
+context it applies just to the accidentals on that staff.
+If it is set to false in the @code{Score} context
 it applies to all staves.
 
-So this sets @code{extraNatural} in one staff:
+So this turns off extra naturals in one staff:
 
 @lilypond[quote,verbatim,ragged-right]
 <<
@@ -1272,7 +1490,7 @@ So this sets @code{extraNatural} in one staff:
 @end lilypond
 
 @noindent
-and this sets it in all staves:
+and this turns them off in all staves:
 
 @lilypond[quote,verbatim,ragged-right]
 <<
@@ -1294,15 +1512,19 @@ in the input file and will take effect from the time they are
 encountered until the end of the score or until the property is 
 @code{\set} or @code{\unset} again.  Let's try changing the 
 font size, which affects the size of the note heads (among 
-other things) several times.
+other things) several times.  The change is from the default
+value, not the current value.
 
 @lilypond[quote,verbatim,ragged-right,relative=1,fragment]
 c4 
-\set fontSize = #-4   % make noteheads smaller
+% make note heads smaller
+\set fontSize = #-4
 d e
-\set fontSize = #2.5  % make noteheads larger
+% make note heads larger
+\set fontSize = #2.5
 f g
-\unset fontSize       % return to original size
+% return to original size
+\unset fontSize
 a b
 @end lilypond
 
@@ -1322,24 +1544,37 @@ Context properties may also be set at the time the context is
 created.  Sometimes this is a clearer way of specifying a 
 property value if it is to remain fixed for the duration of
 the context.  When a context is created with a @code{\new}
-command it may be immediately followed by a 
+command it may be followed immediately by a 
 @code{\with @{ .. @}} block in which the property values are
 set.  For example, if we wish to suppress the printing of
 extra naturals for the duration of a staff we would write:
 
+@example
+\new Staff \with @{ extraNatural = ##f @}
+@end example
+
+@noindent
+like this:
+
 @lilypond[quote,verbatim,ragged-right]
-\new Staff \with {
-  extraNatural = ##f
-}
-\relative c' {
-  gis ges aes ais
-}
+<<
+  \new Staff
+  \relative c'' {
+    gis ges aes ais
+  }
+  \new Staff \with { extraNatural = ##f }
+  \relative c'' {
+    gis ges aes ais
+  }
+>>
 @end lilypond
 
 In effect this overrides the default value of the property.  It
-may still be changed dynamically using @code{\set} and 
-@code{\unset}.
+may still be changed dynamically using @code{\set} and returned
+to its (new) default value with @code{\unset}.
 
+@node Adding and removing engravers
+@subsection Adding and removing engravers
 
 @cindex Engravers, adding
 @cindex Engravers, removing
@@ -1349,18 +1584,20 @@ may still be changed dynamically using @code{\set} and
 
 We have seen that contexts each contain several engravers, each
 of which is responsible for producing a particular part of the
-output, like barlines, staves, note heads, stems, etc.  If an
+output, like bar lines, staves, note heads, stems, etc.  If an
 engraver is removed from a context it can no longer produce its
 output.  This is a crude way of modifying the output, but it
-can sometimes be useful.  
+can sometimes be useful.
+
+@subsubsection Changing a single context
 
-To remove an engraver we can use the @code{\with} command placed
-immediately after the context creation command, as in the 
-previous section.
+To remove an engraver from a single context we use the
+@code{\with} command placed immediately after the context creation 
+command, as in the previous section.
 
-As an 
-illustration let's repeat an example from the previous 
-section with the staff lines removed.  Remember that the 
+As an
+illustration let's repeat an example from the previous
+section with the staff lines removed.  Remember that the
 staff lines are produced by the Staff_symbol_engraver.
 
 @lilypond[quote,verbatim,ragged-right]
@@ -1369,9 +1606,9 @@ staff lines are produced by the Staff_symbol_engraver.
 }
 \relative c' {
   c4 
-  \set fontSize = #-4  % make noteheads smaller
+  \set fontSize = #-4  % make note heads smaller
   d e
-  \set fontSize = #2.5  % make noteheads larger
+  \set fontSize = #2.5  % make note heads larger
   f g
   \unset fontSize  % return to original size
   a b
@@ -1380,8 +1617,8 @@ staff lines are produced by the Staff_symbol_engraver.
 
 @cindex ambitus engraver
 
-Engravers can also be added to contexts.  The command
-to do this is 
+Engravers can also be added to individual contexts.  
+The command to do this is
 
 @code{\consists @emph{Engraver_name}},
 
@@ -1390,7 +1627,7 @@ have an @rglos{ambitus} placed at the beginning of a
 staff to indicate the range of notes in that staff.
 The ambitus is produced by the @code{Ambitus_engraver},
 which is not normally included in any context.  If
-we add it to the @context{Voice} context it calculates
+we add it to the @code{Voice} context it calculates
 the range from that voice only:
 
 @lilypond[quote,verbatim,ragged-right]
@@ -1412,7 +1649,7 @@ the range from that voice only:
 
 @noindent
 but if we add the Ambitus engraver to the 
-@context{Staff} context it calculates the range from all
+@code{Staff} context it calculates the range from all
 the notes in all the voices on that staff:
 
 @lilypond[quote,verbatim,ragged-right]
@@ -1433,6 +1670,47 @@ the notes in all the voices on that staff:
 >>
 @end lilypond
 
+@subsubsection Changing all contexts of the same type
+
+The examples above show how to remove or add engravers to
+individual contexts.  It is also possible to remove or add 
+engravers to every context of a specific type by placing the
+commands in the appropriate context in a @code{\layout}
+block.  For example, If we wanted to show ambiti for every
+staff in a four-staff score we could write
+
+@lilypond[quote,verbatim,ragged-right]
+\score {
+  <<
+    \new Staff <<
+      \relative c'' { c a b g }
+    >>
+    \new Staff <<
+      \relative c' { c a b g }
+    >>
+    \new Staff <<
+      \clef "G_8"
+      \relative c' { c a b g }
+    >>
+    \new Staff <<
+      \clef "bass"
+      \relative c { c a b g }
+    >>
+  >>
+  \layout {
+    \context {
+      \Staff
+      \consists Ambitus_engraver
+    }
+  }
+}
+@end lilypond
+
+@noindent
+The default values of context properties may also be set
+for all contexts of a particular type by including the
+@code{\set} command in a @code{\context} block in the
+same way.
 
 @node Extending the templates
 @section Extending the templates
@@ -1444,6 +1722,8 @@ templates (see @ref{Templates}) which may give you a start.
 But what
 if you want something that isn't covered there?  Read on.
 
+TODO Add links to templates after they have been moved to LSR
+
 @menu
 * Soprano and cello::           
 * Four-part SATB vocal score::  
@@ -1459,12 +1739,11 @@ cello.  In this case, we would start with @q{Notes and lyrics} (for the
 soprano part).
 
 @example
-\version "2.11.23"
+\version "2.11.38"
 melody = \relative c' @{
   \clef treble
   \key c \major
   \time 4/4
-
   a4 b c d
 @}
 
@@ -1488,12 +1767,11 @@ text = \lyricmode @{
 Now we want to add a cello part.  Let's look at the @q{Notes only} example:
 
 @example
-\version "2.11.23"
+\version "2.11.38"
 melody = \relative c' @{
   \clef treble
   \key c \major
   \time 4/4
-
   a4 b c d
 @}
 
@@ -1504,32 +1782,33 @@ melody = \relative c' @{
 @}
 @end example
 
-We don't need two @code{\version} commands.  We'll need the @code{melody}
-section.  We don't want two @code{\score} sections -- if we had two
-@code{\score}s, we'd get the two parts separately.  We want them together,
-as a duet.  Within the @code{\score} section, we don't need two
-@code{\layout} or @code{\midi}.
-
-If we simply cut and paste the @code{melody} section, we would end up with
-two @code{melody} sections.  So let's rename them.  We'll call the section
-for the soprano @code{sopranoMusic} and the section for the cello
-@code{celloMusic}.  While we're doing this, let's rename @code{text}
-to be @code{sopranoLyrics}.  Remember to rename both instances of all
-these names -- both the initial definition (the
-@code{melody = relative c' @{ } part) and the name's use (in the
+We don't need two @code{\version} commands.  We'll need the 
+@code{melody} section.  We don't want two @code{\score} sections
+-- if we had two @code{\score}s, we'd get the two parts separately.
+We want them together, as a duet.  Within the @code{\score} 
+section, we don't need two @code{\layout} or @code{\midi}.
+
+If we simply cut and paste the @code{melody} section, we would 
+end up with two @code{melody} definitions.  This would not generate
+an error, but the second one would be used for both melodies.
+So let's rename them to make them distinct.  We'll call the 
+section for the soprano @code{sopranoMusic} and the section for
+the cello @code{celloMusic}.  While we're doing this, let's rename
+@code{text} to be @code{sopranoLyrics}.  Remember to rename both
+instances of all these names -- both the initial definition (the
+@code{melody = \relative c' @{ } part) and the name's use (in the
 @code{\score} section).
 
-While we're doing this, let's change the cello part's staff -- celli
-normally use bass clef.  We'll also give the cello some different
-notes.
+While we're doing this, let's change the cello part's staff -- 
+celli normally use bass clef.  We'll also give the cello some 
+different notes.
 
 @example
-\version "2.11.23"
+\version "2.11.38"
 sopranoMusic = \relative c' @{
   \clef treble
   \key c \major
   \time 4/4
-
   a4 b c d
 @}
 
@@ -1541,7 +1820,6 @@ celloMusic = \relative c @{
   \clef bass
   \key c \major
   \time 4/4
-
   d4 g fis8 e d4
 @}
 
@@ -1595,12 +1873,11 @@ This looks a bit messy; the indentation is messed up now.  That is
 easily fixed.  Here's the complete soprano and cello template.
 
 @lilypond[quote,verbatim,ragged-right]
-\version "2.11.23"
+\version "2.11.37"
 sopranoMusic = \relative c' {
   \clef treble
   \key c \major
   \time 4/4
-
   a4 b c d
 }
 
@@ -1612,7 +1889,6 @@ celloMusic = \relative c {
   \clef bass
   \key c \major
   \time 4/4
-
   d4 g fis8 e d4
 }
 
@@ -1636,7 +1912,7 @@ celloMusic = \relative c {
 @node Four-part SATB vocal score
 @subsection Four-part SATB vocal score
 
-Most vocal scores of music written for four-part mixed choir 
+Most vocal scores of music written for four-part mixed choir
 with orchestral accompaniment such as Mendelssohn's Elijah or
 Handel's Messiah have the choral music and words on four
 staves, one for each of SATB, with a piano reduction of the
@@ -1645,7 +1921,7 @@ from Handel's Messiah:
 
 @c The following should appear as music without code
 @lilypond[quote,ragged-right]
-\version "2.11.23"
+\version "2.11.38"
 global = { \key d \major \time 4/4 }
 sopMusic = \relative c'' {
   \clef "treble"
@@ -1656,7 +1932,7 @@ sopWords = \lyricmode {
 }
 altoMusic = \relative a' {
   \clef "treble"
-  r4 a2 a4 | fis4. fis8 a2 | g4 fis fis2 |
+  r4 a2 a4 | fis4. fis8 a2 | g4 fis e2 |
 }
 altoWords = \sopWords
 tenorMusic = \relative c' {
@@ -1720,7 +1996,7 @@ lower = \relative c, {
 
 None of the templates provides this layout exactly.  The
 nearest is @q{SATB vocal score and automatic piano reduction},
-but we shall need to change the layout and add a piano
+but we need to change the layout and add a piano
 accompaniment which is not derived automatically from the
 vocal parts.  The variables holding the music and words for
 the vocal parts are fine, but we shall need to add variables for
@@ -1731,12 +2007,12 @@ the template do not correspond with the order in the vocal
 score shown above.  We need to rearrange them so there are
 four staves with the words written directly underneath the
 notes for each part.
-All the voices should be @code{voiceOne}, which is
-the default, so the @code{\voiceXXX} commands can be removed.
+All the voices should be @code{\voiceOne}, which is
+the default, so the @code{\voiceXXX} commands should be removed.
 We also need to specify the tenor clef for the tenors.
-The way in which lyrics are specified has also been simplified
-as we have not yet encountered the method used in the template.
-We've also added the names of each staff.
+The way in which lyrics are specified in the template has not yet
+been encountered so we need to use the method with which we are 
+familiar.  We should also add the names of each staff.
 
 Doing this gives for our ChoirStaff:
 
@@ -1819,7 +2095,7 @@ Combining all these together and adding the music
 for the three bars of the example above gives:
 
 @lilypond[quote,verbatim,ragged-right]
-\version "2.11.23"
+\version "2.11.38"
 global = { \key d \major \time 4/4 }
 sopMusic = \relative c'' {
   \clef "treble"
@@ -1910,13 +2186,14 @@ and fill in the details later.
 
 We'll use the first two bars of Bach's prelude
 based on @emph{Jesu, meine Freude} which is written for two
-manuals and pedal organ.  The top manual part has two voices,
+manuals and pedal organ.  You can see these two bars of music
+at the bottom of this section.  The top manual part has two voices,
 the lower and pedal organ one each.  So we need four
 music definitions and one to define the time signature
 and key:
 
 @example
-\version "2.11.23"
+\version "2.11.38"
 \header @{
   title = "Jesu, meine Freude"
   composer = "J S Bach"
@@ -1982,7 +2259,7 @@ see what errors it generates.
 >>
 @end example
 
-It is not strictly necessary to use the simultaneous contruct
+It is not strictly necessary to use the simultaneous construct
 @code{<<  >>} for the manual two staff and the pedal organ staff,
 since they contain only one music expression, but it does no harm
 and always using angle brackets after @code{\new Staff} is a good
@@ -2025,7 +2302,7 @@ may vary.  All that remains now
 is to add the music, and combine all the parts together.
 
 @lilypond[quote,verbatim,ragged-right]
-\version "2.11.23"
+\version "2.11.38"
 \header {
   title = "Jesu, meine Freude"
   composer = "J S Bach"
@@ -2072,3 +2349,8 @@ PedalOrganMusic = \relative c {
 @end lilypond
 
 
+
+
+
+
+