]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/notation/pitches.itely
NR: Replace \set Staff.instrumentName
[lilypond.git] / Documentation / notation / pitches.itely
index ffa4e33b0b30276c932f0a1c000678ea9975b45d..15af95d1405ba6ff626fd31ee912f7581f559274 100644 (file)
@@ -7,7 +7,7 @@
     Guide, node Updating translation committishes..
 @end ignore
 
-@c \version "2.19.22"
+@c \version "2.19.53"
 
 
 @node Pitches
@@ -87,7 +87,6 @@ octave.
 }
 @end lilypond
 
-@funindex fixed
 @funindex \fixed
 Common octave marks can be entered just once on a reference pitch
 after @code{\fixed} placed before the music.  Pitches inside
@@ -129,7 +128,6 @@ Snippets:
 @cindex relative octave specification
 @cindex octave specification, relative
 
-@funindex relative
 @funindex \relative
 
 Absolute octave entry requires specifying the octave for every
@@ -182,7 +180,7 @@ Writing @code{\relative gis''' @{ gis @dots{} @}} makes it easy to
 determine the absolute pitch of the first note inside.
 
 @item no explicit starting pitch
-The form @code{\relative @{ gis''' @dots{} @}}) serves
+The form @code{\relative @{ gis''' @dots{} @}} serves
 as a compact version of the previous option: the first note
 inside is written in absolute pitch itself.  (This happens to be
 equivalent to choosing @code{f} as the reference pitch.)
@@ -299,6 +297,24 @@ that each interval contains.
 }
 @end lilypond
 
+In complex situations, it is sometimes useful to get back to a
+certain pitch regardless of what happened before. This can be
+done using @code{\resetRelativeOctave}:
+
+@lilypond[verbatim,quote]
+\relative {
+  <<
+    { c''2 d }
+    \\
+    { e,,2 f }
+  >>
+  \resetRelativeOctave c''
+  c2
+}
+@end lilypond
+
+@funindex \resetRelativeOctave
+
 
 @seealso
 Music Glossary:
@@ -319,11 +335,8 @@ Internals Reference:
 @cindex transposition and relative octave entry
 
 @funindex \transpose
-@funindex transpose
 @funindex \chordmode
-@funindex chordmode
 @funindex \relative
-@funindex relative
 
 
 @node Accidentals
@@ -360,16 +373,16 @@ is made by adding @code{isis} or @code{eses}.  This syntax is
 derived from Dutch note naming conventions.  To use other names
 for accidentals, see @ref{Note names in other languages}.
 
-@lilypond[verbatim,quote,relative=2]
-ais1 aes aisis aeses
+@lilypond[verbatim,quote,fragment]
+\relative c'' { ais1 aes aisis aeses }
 @end lilypond
 
 A natural pitch is entered as a simple note name; no suffix is
 required.  A natural sign will be printed when needed to cancel
 the effect of an earlier accidental or key signature.
 
-@lilypond[verbatim,quote,relative=2]
-a4 aes a2
+@lilypond[verbatim,quote,fragment]
+\relative c'' { a4 aes a2 }
 @end lilypond
 
 @cindex quarter tones
@@ -379,8 +392,8 @@ a4 aes a2
 Quarter tones may be added; the following is a series of Cs with
 increasing pitches:
 
-@lilypond[verbatim,quote,relative=2]
-ceseh1 ces ceh c cih cis cisih
+@lilypond[verbatim,quote,fragment]
+\relative c'' { ceseh1 ces ceh c cih cis cisih }
 @end lilypond
 
 
@@ -403,8 +416,8 @@ cautionary accidental (i.e., an accidental within parentheses) can
 be obtained by adding the question mark@tie{}@code{?} after the
 pitch.
 
-@lilypond[verbatim,quote,relative=2]
-cis cis cis! cis? c c c! c?
+@lilypond[verbatim,quote,fragment]
+\relative c'' { cis cis cis! cis? c c c! c? }
 @end lilypond
 
 @cindex accidental on tied note
@@ -413,10 +426,12 @@ cis cis cis! cis? c c c! c?
 Accidentals on tied notes are only printed at the beginning of a
 new system:
 
-@lilypond[verbatim,quote,relative=2,ragged-right]
-cis1~ 1~
-\break
-cis
+@lilypond[verbatim,quote,fragment,ragged-right]
+\relative c'' {
+  cis1~ 1~
+  \break
+  cis
+}
 @end lilypond
 
 
@@ -459,7 +474,7 @@ Internals Reference:
 
 @knownissues
 There are no generally accepted standards for denoting
-quarter-tone accidentals, so LilyPond's symbol does not conform to
+quarter-tone accidentals, so LilyPond's symbols do not conform to
 any standard.
 
 
@@ -487,7 +502,7 @@ using Italian note names:
 The available languages and the note names they define are:
 
 @quotation
-@multitable {@code{nederlands}} {do re mi fa sol la sib si}
+@multitable {@code{nederlands}} {do re/re mi fa sol la sib si}
 @headitem Language
   @tab Note Names
 @item @code{nederlands}
@@ -500,7 +515,9 @@ The available languages and the note names they define are:
   @tab c d e f g a bf b
 @item @code{espanol} or @code{español}
   @tab do re mi fa sol la sib si
-@item @code{italiano} or @code{français}
+@item @code{français}
+  @tab do ré/re mi fa sol la sib si
+@item @code{italiano}
   @tab do re mi fa sol la sib si
 @item @code{norsk}
   @tab c d e f g a b h
@@ -519,7 +536,7 @@ In addition to note names, accidental suffixes may
 also vary depending on the language:
 
 @quotation
-@multitable {@code{nederlands}} {-@code{s}/-@code{-sharp}} {-@code{ess}/-@code{es}} {-@code{ss}/-@code{x}/-@code{-sharpsharp}} {-@code{essess}/-@code{eses}}
+@multitable {@code{nederlands}} {-@code{s}/-@code{-sharp}} {-@code{f}/-@code{-flat}} {-@code{ss}/-@code{x}/-@code{-sharpsharp}} {-@code{ff}/-@code{-flatflat}}
 @headitem Language
   @tab sharp @tab flat @tab double sharp @tab double flat
 @item @code{nederlands}
@@ -533,7 +550,9 @@ also vary depending on the language:
     @tab -@code{ff}/-@code{-flatflat}
 @item @code{espanol} or @code{español}
   @tab -@code{s} @tab -@code{b} @tab -@code{ss}/-@code{x} @tab -@code{bb}
-@item @code{italiano} or @code{français}
+@item @code{français}
+  @tab -@code{d} @tab -@code{b} @tab -@code{dd}/-@code{x} @tab -@code{bb}
+@item @code{italiano}
   @tab -@code{d} @tab -@code{b} @tab -@code{dd} @tab -@code{bb}
 @item @code{norsk}
   @tab -@code{iss}/-@code{is} @tab -@code{ess}/-@code{es} @tab -@code{ississ}/-@code{isis}
@@ -556,8 +575,8 @@ are accepted in LilyPond.  Similarly, both @code{es} and
 @code{eeses}@tie{}/@tie{}@code{eses}.  Sometimes only these
 contracted names are defined in the corresponding language files.
 
-@lilypond[verbatim,quote,relative=2]
-a2 as e es a ases e eses
+@lilypond[verbatim,quote,fragment]
+\relative c'' { a2 as e es a ases e eses }
 @end lilypond
 
 
@@ -587,7 +606,9 @@ appear in this table do not provide special note names yet.
   @tab -qs @tab -qf @tab -tqs @tab -tqf
 @item @code{espanol} or @code{español}
   @tab -cs @tab -cb @tab -tcs @tab -tcb
-@item @code{italiano} or @code{français}
+@item @code{français}
+  @tab -sd @tab -sb @tab -dsd @tab -bsb
+@item @code{italiano}
   @tab -sd @tab -sb @tab -dsd @tab -bsb
 @item @code{portugues}
   @tab -sqt @tab -bqt @tab -stqt @tab -btqt
@@ -637,7 +658,6 @@ This section discusses how to modify pitches.
 
 @funindex =
 @funindex \octaveCheck
-@funindex octaveCheck
 @funindex controlpitch
 
 In relative mode, it is easy to forget an octave changing mark.
@@ -664,8 +684,8 @@ The octave of notes may also be checked with the
 checks that the interval between the previous note and the
 @code{@var{controlpitch}} is within a fourth (i.e., the normal
 calculation of relative mode).  If this check fails, a warning is
-printed, but the previous note is not changed.  Future notes are
-relative to the @code{@var{controlpitch}}.
+printed.  While the previous note itself is not changed, future
+notes are relative to the corrected value.
 
 @lilypond[verbatim,quote]
 \relative {
@@ -712,7 +732,6 @@ Internals Reference:
 @cindex notes, transposition of
 
 @funindex \transpose
-@funindex transpose
 
 A music expression can be transposed with @code{\transpose}.  The
 syntax is
@@ -830,11 +849,8 @@ Internals Reference:
 @rinternals{TransposedMusic}.
 
 @funindex \transpose
-@funindex transpose
 @funindex \chordmode
-@funindex chordmode
 @funindex \relative
-@funindex relative
 
 @knownissues
 The relative conversion will not affect @code{\transpose},
@@ -843,7 +859,7 @@ relative mode within transposed music, an additional @code{\relative}
 must be placed inside @code{\transpose}.
 
 Triple accidentals will not be printed if using @code{\transpose}. An
-@q{enharmonically equivalent} pitch will be used instead (e.g. d-flat
+@q{enharmonically equivalent} pitch will be used instead (e.g., d-flat
 rather than e-triple-flat).
 
 
@@ -892,7 +908,6 @@ Notation Reference:
 @cindex transformation, retrograde
 @cindex operation, retrograde
 @funindex \retrograde
-@funindex retrograde
 
 A music expression can be reversed to produce its retrograde:
 
@@ -906,9 +921,14 @@ music = \relative { c'8. ees16( fis8. a16 b8.) gis16 f8. d16 }
 @end lilypond
 
 @knownissues
-Manual ties inside @code{\retrograde} will be broken and
-generate warnings.  Some ties can be generated automatically
-by enabling @ref{Automatic note splitting}.
+@code{\retrograde} is a rather simple tool.  Since many events are
+@q{mirrored} rather than exchanged, tweaks and directional
+modifiers for opening spanners need to be added at the matching
+closing spanners: @code{^(} needs to be ended by @code{^)}, every
+@code{\<} or @code{\cresc} needs to be ended by @code{\!} or
+@code{\endcr}, every @code{\>} or @code{\decr} needs to be ended
+by @code{\enddecr}.  Property-changing commands/overrides with a
+lasting effect will likely cause surprises.
 
 @seealso
 Notation Reference:
@@ -940,7 +960,6 @@ left untransformed.}
 @cindex transposition, modal
 @cindex operation, transposition
 @funindex \modalTranspose
-@funindex modalTranspose
 
 A motif can be transposed within a given scale with:
 
@@ -997,7 +1016,6 @@ motif = \relative { c'8 d e f g a b c }
 @cindex inversion, modal
 @cindex operation, modal inversion
 @funindex \modalInversion
-@funindex modalInversion
 
 A motif can be inverted within a given scale around a given pivot
 note and transposed in a single operation with:
@@ -1111,28 +1129,27 @@ This section discusses how to alter the output of pitches.
 
 
 @funindex \clef
-@funindex clef
 
 Without any explicit command, the default clef for LilyPond is the
 treble (or @emph{G}) clef.
 
-@lilypond[verbatim,quote,relative=1,ragged-right]
-c2 c
+@lilypond[verbatim,quote,fragment,ragged-right]
+c'2 c'
 @end lilypond
 
 However, the clef can be changed by using the @code{\clef} command and
 an appropriate clef name.  @emph{Middle C} is shown in each of the
 following examples.
 
-@lilypond[verbatim,quote,relative=1]
+@lilypond[verbatim,quote,fragment]
 \clef treble
-c2 c
+c'2 c'
 \clef alto
-c2 c
+c'2 c'
 \clef tenor
-c2 c
+c'2 c'
 \clef bass
-c2 c
+c'2 c'
 @end lilypond
 
 For the full range of possible clef names see @ref{Clef styles}.
@@ -1161,29 +1178,29 @@ and@tie{}@code{_15} and@tie{}@code{^15} transpose by two octaves.
 Other integers can be used if required.  Clef names containing
 non-alphabetic characters must be enclosed in quotes
 
-@lilypond[verbatim,quote,relative=1]
+@lilypond[verbatim,quote,fragment]
 \clef treble
-c2 c
+c'2 c'
 \clef "treble_8"
-c2 c
+c'2 c'
 \clef "bass^15"
-c2 c
+c'2 c'
 \clef "alto_2"
-c2 c
+c'2 c'
 \clef "G_8"
-c2 c
+c'2 c'
 \clef "F^5"
-c2 c
+c'2 c'
 @end lilypond
 
 Optional octavation can be obtained by enclosing the numeric
 argument in parentheses or brackets:
 
-@lilypond[verbatim,quote,relative=1]
+@lilypond[verbatim,quote,fragment]
 \clef "treble_(8)"
-c2 c
+c'2 c'
 \clef "bass^[15]"
-c2 c
+c'2 c'
 @end lilypond
 
 The pitches are displayed as if the numeric argument were
@@ -1194,52 +1211,59 @@ the new clef symbol to be printed at the end of the previous line,
 as a @emph{warning} clef, as well as the beginning of the next.
 This @emph{warning} clef can be suppressed.
 
-@lilypond[verbatim,quote,relative=1]
-\clef treble { c2 c } \break
-\clef bass { c2 c } \break
+@lilypond[verbatim,quote,fragment]
+\clef treble { c'2 c' } \break
+\clef bass { c'2 c' } \break
 \clef alto
   \set Staff.explicitClefVisibility = #end-of-line-invisible
-  { c2 c } \break
+  { c'2 c' } \break
   \unset Staff.explicitClefVisibility
-\clef bass { c2 c } \break
+\clef bass { c'2 c' } \break
 @end lilypond
 
 By default, a clef that has previously been printed will not be
 re-printed if the same @code{\clef} command is issued again and
-will be ignored.  The the command
+will be ignored.  The command
 @code{\set Staff.forceClef = ##t} changes this behaviour.
 
-@lilypond[verbatim,quote,relative=1]
+@lilypond[verbatim,quote,fragment]
   \clef treble
-  c1
+  c'1
   \clef treble
-  c1
+  c'1
   \set Staff.forceClef = ##t
-  c1
+  c'1
   \clef treble
-  c1
+  c'1
 @end lilypond
 
+@noindent
+To be more precise, it is not the @code{\clef} command itself that
+prints a clef.  Instead, it sets or changes a property of the
+@code{Clef_engraver}, which then decides by its own whether to
+display a clef or not in the current staff.  The @code{forceClef}
+property overrides this decision locally to re-print a clef once.
+
 When there is a manual clef change, the glyph of the changed clef
 will be smaller than normal.  This behaviour can be overridden.
 
-@lilypond[verbatim,quote,relative=1]
+@lilypond[verbatim,quote,fragment]
   \clef "treble"
-  c1
+  c'1
   \clef "bass"
-  c1
+  c'1
   \clef "treble"
-  c1
+  c'1
   \override Staff.Clef.full-size-change = ##t
   \clef "bass"
-  c1
+  c'1
   \clef "treble"
-  c1
+  c'1
   \revert Staff.Clef.full-size-change
   \clef "bass"
-  c1
+  c'1
   \clef "treble"
-  c1
+  c'1
 @end lilypond
 
 @snippets
@@ -1272,13 +1296,13 @@ grobs.  So any @code{\override} done to the @var{Clef} will also
 need to be applied, as a separate @code{\override}, to the
 @var{ClefModifier} grob.
 
-@lilypond[fragment,quote,verbatim,relative=1]
+@lilypond[fragment,quote,verbatim]
 \new Staff \with {
   \override Clef.color = #blue
   \override ClefModifier.color = #red
 }
 
-\clef "treble_8" c4
+\clef "treble_8" c'4
 @end lilypond
 
 
@@ -1288,7 +1312,6 @@ need to be applied, as a separate @code{\override}, to the
 @cindex key signature
 
 @funindex \key
-@funindex key
 
 @c duplicated in Key signature and Accidentals
 @warning{New users are sometimes confused about accidentals and
@@ -1307,23 +1330,14 @@ at the start of the staff.  The key signature may be altered:
 @end example
 
 @funindex \major
-@funindex major
 @funindex \minor
-@funindex minor
 @funindex \ionian
-@funindex ionian
 @funindex \locrian
-@funindex locrian
 @funindex \aeolian
-@funindex aeolian
 @funindex \mixolydian
-@funindex mixolydian
 @funindex \lydian
-@funindex lydian
 @funindex \phrygian
-@funindex phrygian
 @funindex \dorian
-@funindex dorian
 
 @cindex church modes
 @cindex modes
@@ -1345,11 +1359,13 @@ standard mode names, also called @notation{church modes}:
 @code{\ionian}, @code{\dorian}, @code{\phrygian}, @code{\lydian},
 @code{\mixolydian}, @code{\aeolian}, and @code{\locrian}.
 
-@lilypond[verbatim,quote,relative=2]
-\key g \major
-fis1
-f
-fis
+@lilypond[verbatim,quote,fragment]
+\relative {
+  \key g \major
+  fis''1
+  f
+  fis
+}
 @end lilypond
 
 Additional modes can be defined, by listing the alterations
@@ -1374,14 +1390,14 @@ printed.  If a single position is specified in an entry, the
 accidentals are placed within the octave ending at that staff
 position.
 
-@lilypond[verbatim, quote,relative=0]
+@lilypond[verbatim, quote,fragment]
 \override Staff.KeySignature.flat-positions = #'((-5 . 5))
 \override Staff.KeyCancellation.flat-positions = #'((-5 . 5))
-\clef bass \key es \major es g bes d
-\clef treble \bar "||" \key es \major es g bes d
+\clef bass \key es \major es g bes d'
+\clef treble \bar "||" \key es \major es' g' bes' d''
 
 \override Staff.KeySignature.sharp-positions = #'(2)
-\bar "||" \key b \major b fis b2
+\bar "||" \key b \major b' fis' b'2
 @end lilypond
 
 @snippets
@@ -1424,23 +1440,24 @@ Internals Reference:
 
 @funindex set-octavation
 @funindex \ottava
-@funindex ottava
 
 @notation{Ottava brackets} introduce an extra transposition of an
 octave for the staff:
 
-@lilypond[verbatim,quote,relative=2]
-a2 b
-\ottava #-2
-a2 b
-\ottava #-1
-a2 b
-\ottava #0
-a2 b
-\ottava #1
-a2 b
-\ottava #2
-a2 b
+@lilypond[verbatim,quote]
+\relative a' {
+  a2 b
+  \ottava #-2
+  a2 b
+  \ottava #-1
+  a2 b
+  \ottava #0
+  a2 b
+  \ottava #1
+  a2 b
+  \ottava #2
+  a2 b
+}
 @end lilypond
 
 @snippets
@@ -1477,7 +1494,6 @@ Internals Reference:
 @cindex MIDI transposition
 
 @funindex \transposition
-@funindex transposition
 
 When typesetting scores that involve transposing instruments, some
 parts can be typeset in a different pitch than the
@@ -1507,26 +1523,24 @@ playing in unison.
 
 @lilypond[verbatim,quote]
 \new GrandStaff <<
-  \new Staff = "violin" {
-    \relative c'' {
-      \set Staff.instrumentName = #"Vln"
-      \set Staff.midiInstrument = #"violin"
-      % not strictly necessary, but a good reminder
-      \transposition c'
-
-      \key c \major
-      g4( c8) r c r c4
-    }
+  \new Staff = "violin" \with {
+    instrumentName = #"Vln"
+    midiInstrument = #"violin"
   }
-  \new Staff = "clarinet" {
-    \relative c'' {
-      \set Staff.instrumentName = \markup { Cl (B\flat) }
-      \set Staff.midiInstrument = #"clarinet"
-      \transposition bes
-
-      \key d \major
-      a4( d8) r d r d4
-    }
+  \relative c'' {
+    % not strictly necessary, but a good reminder
+    \transposition c'
+    \key c \major
+    g4( c8) r c r c4
+  }
+  \new Staff = "clarinet" \with {
+    instrumentName = \markup { Cl (B\flat) }
+    midiInstrument = #"clarinet"
+  }
+  \relative c'' {
+    \transposition bes
+    \key d \major
+    a4( d8) r d r d4
   }
 >>
 @end lilypond
@@ -1894,12 +1908,10 @@ musicB = {
 
 @funindex modern-cautionary
 
-This rule is similar to @code{modern}, but the @q{extra}
-accidentals (the ones not typeset by @code{default}) are typeset
-as cautionary accidentals.  They are by default printed with
-parentheses, but they can also be printed in reduced size by
-defining the @code{cautionary-style} property of
-@code{AccidentalSuggestion}.
+This rule is similar to @code{modern}, but the @q{extra} accidentals
+are printed as cautionary accidentals (with parentheses).  They can also
+be printed at a different size by overriding
+@code{AccidentalCautionary}'s @code{font-size} property.
 
 @lilypond[quote]
 musicA = {
@@ -2201,6 +2213,129 @@ musicB = {
 @end lilypond
 
 
+@item choral
+
+@cindex accidental style, choral
+@cindex accidentals, choral
+@cindex choral accidental style
+@cindex choral accidentals
+
+@funindex choral
+
+This rule is a combination of the @code{modern-voice} and the @code{piano}
+style. It shows all accidentals required for singers that only follow their
+own voice, as well as additional accidentals for readers that follow all
+voices of an entire @code{ChoirStaff} simultaneously.
+
+This accidental style applies to the current @code{ChoirStaff} by default.
+
+@lilypond[quote]
+musicA = {
+  <<
+    \relative {
+      cis''8 fis, bes4 <a cis>8 f bis4 |
+      cis2. <c, g'>4 |
+    }
+    \\
+    \relative {
+      ais'2 cis, |
+      fis8 b a4 cis2 |
+    }
+  >>
+}
+
+musicB = {
+  \clef bass
+  \new Voice {
+    \voiceTwo \relative {
+      <fis a cis>8[ <fis a cis>
+      \change Staff = up
+      cis' cis
+      \change Staff = down
+      <fis, a> <fis a>]
+      \showStaffSwitch
+      \change Staff = up
+      dis'4 |
+      \change Staff = down
+      <fis, a cis>4 gis <f a d>2 |
+    }
+  }
+}
+
+\new ChoirStaff {
+  <<
+    \context Staff = "up" {
+      \accidentalStyle choral
+      \musicA
+    }
+    \context Staff = "down" {
+      \musicB
+    }
+  >>
+}
+@end lilypond
+
+@item choral-cautionary
+
+@cindex accidentals, choral cautionary
+@cindex cautionary accidentals, choral
+@cindex choral cautionary accidentals
+@cindex accidental style, choral cautionary
+@cindex cautionary accidental style, choral
+@cindex choral cautionary accidental style
+
+@funindex choral-cautionary
+
+This is the same as @code{choral} but with the extra accidentals
+typeset as cautionaries.
+
+@lilypond[quote]
+musicA = {
+  <<
+    \relative {
+      cis''8 fis, bes4 <a cis>8 f bis4 |
+      cis2. <c, g'>4 |
+    }
+    \\
+    \relative {
+      ais'2 cis, |
+      fis8 b a4 cis2 |
+    }
+  >>
+}
+
+musicB = {
+  \clef bass
+  \new Voice {
+    \voiceTwo \relative {
+      <fis a cis>8[ <fis a cis>
+      \change Staff = up
+      cis' cis
+      \change Staff = down
+      <fis, a> <fis a>]
+      \showStaffSwitch
+      \change Staff = up
+      dis'4 |
+      \change Staff = down
+      <fis, a cis>4 gis <f a d>2 |
+    }
+  }
+}
+
+\new ChoirStaff {
+  <<
+    \context Staff = "up" {
+      \accidentalStyle choral-cautionary
+      \musicA
+    }
+    \context Staff = "down" {
+      \musicB
+    }
+  >>
+}
+@end lilypond
+
+
 @item neo-modern
 
 @cindex neo-modern accidental style
@@ -2267,8 +2402,10 @@ musicB = {
 
 @funindex neo-modern-cautionary
 
-This rule is similar to @code{neo-modern}, but the extra
-accidentals are printed as cautionary accidentals.
+This rule is similar to @code{neo-modern}, but the @q{extra} accidentals
+are printed as cautionary accidentals (with parentheses).  They can also
+be printed at a different size by overriding
+@code{AccidentalCautionary}'s @code{font-size} property.
 
 @lilypond[quote]
 musicA = {
@@ -2964,16 +3101,18 @@ This section suggests ways of altering note heads.
 
 The appearance of note heads may be altered:
 
-@lilypond[verbatim,quote,relative=2]
-c4 b
-\override NoteHead.style = #'cross
-c4 b
-\revert NoteHead.style
-a b
-\override NoteHead.style = #'harmonic
-a b
-\revert NoteHead.style
-c4 d e f
+@lilypond[verbatim,quote]
+\relative c'' {
+  c4 b
+  \override NoteHead.style = #'cross
+  c4 b
+  \revert NoteHead.style
+  a b
+  \override NoteHead.style = #'harmonic
+  a b
+  \revert NoteHead.style
+  c4 d e f
+}
 @end lilypond
 
 To see all note head styles, see @ref{Note head styles}.
@@ -2983,22 +3122,26 @@ intentions.  The following generic predefined commands modify the
 note head in both staff and tablature contexts and can be used to
 represent any musical meaning:
 
-@lilypond[verbatim,quote,relative=2]
-c4 b
-\xNotesOn
- a b c4 b
-\xNotesOff
-c4 d
+@lilypond[verbatim,quote]
+\relative {
+  c''4 b
+  \xNotesOn
+   a b c4 b
+  \xNotesOff
+  c4 d
+}
 @end lilypond
 
 The music function form of this predefined command may be used
 inside and outside chords to generate crossed note heads in both
 staff and tablature contexts:
 
-@lilypond[verbatim,quote,relative=2]
-c4 b
-\xNote { e f }
-c b < g \xNote c f > b
+@lilypond[verbatim,quote]
+\relative {
+  c''4 b
+  \xNote { e f }
+  c b < g \xNote c f > b
+}
 @end lilypond
 
 As synonyms for @code{\xNote}, @code{\xNotesOn} and @code{\xNotesOff},
@@ -3007,8 +3150,10 @@ be used.  The term @notation{dead note} is commonly used by guitarists.
 
 There is also a similar shorthand for diamond shapes:
 
-@lilypond[verbatim,quote,relative=2]
-<c f\harmonic>2 <d a'\harmonic>4 <c g'\harmonic> f\harmonic
+@lilypond[verbatim,quote]
+\relative c'' {
+  <c f\harmonic>2 <d a'\harmonic>4 <c g'\harmonic> f\harmonic
+}
 @end lilypond
 
 @predefined
@@ -3050,9 +3195,7 @@ Internals Reference:
 @cindex note heads, easy play
 
 @funindex \easyHeadsOn
-@funindex easyHeadsOn
 @funindex \easyHeadsOff
-@funindex easyHeadsOff
 
 The @q{easy play} note head includes a note name inside the head.
 It is used in music for beginners.  To make the letters readable,
@@ -3117,15 +3260,10 @@ Internals Reference:
 @cindex note heads, Walker
 
 @funindex \aikenHeads
-@funindex aikenHeads
 @funindex \sacredHarpHeads
-@funindex sacredHarpHeads
 @funindex \southernHarmonyHeads
-@funindex southernHarmonyHeads
 @funindex \funkHeads
-@funindex funkHeads
 @funindex \walkerHeads
-@funindex walkerHeads
 
 In shape note head notation, the shape of the note head
 corresponds to the harmonic function of a note in the scale.  This
@@ -3133,52 +3271,49 @@ notation was popular in nineteenth-century American song books.
 Shape note heads can be produced in Sacred Harp, Southern Harmony,
 Funk (Harmonica Sacra), Walker, and Aiken (Christian Harmony) styles:
 
-@lilypond[verbatim,quote,relative=2]
-\aikenHeads
-c, d e f g2 a b1 c \break
-\sacredHarpHeads
-c,4 d e f g2 a b1 c \break
-\southernHarmonyHeads
-c,4 d e f g2 a b1 c \break
-\funkHeads
-c,4 d e f g2 a b1 c \break
-\walkerHeads
-c,4 d e f g2 a b1 c \break
+@lilypond[verbatim,quote]
+\relative c'' {
+  \aikenHeads
+  c, d e f g2 a b1 c \break
+  \sacredHarpHeads
+  c,4 d e f g2 a b1 c \break
+  \southernHarmonyHeads
+  c,4 d e f g2 a b1 c \break
+  \funkHeads
+  c,4 d e f g2 a b1 c \break
+  \walkerHeads
+  c,4 d e f g2 a b1 c \break
+}
 @end lilypond
 
 @funindex \key
-@funindex key
 @funindex \aikenHeadsMinor
-@funindex aikenHeadsMinor
 @funindex \sacredHarpHeadsMinor
-@funindex sacredHarpHeadsMinor
 @funindex \southernHarmonyHeadsMinor
-@funindex southernHarmonyHeadsMinor
 @funindex \funkHeadsMinor
-@funindex funkHeadsMinor
 @funindex \walkerHeadsMinor
-@funindex walkerHeadsMinor
 
 Shapes are typeset according to the step in the scale, where the base
 of the scale is determined by the @code{\key} command.  When writing
 in a minor key, the scale step can be determined from the relative
 major:
 
-@lilypond[verbatim,quote,relative=2]
-\key a \minor
-\aikenHeads
-a b c d e2 f g1 a \break
-\aikenHeadsMinor
-a,4 b c d e2 f g1 a \break
-\sacredHarpHeadsMinor
-a,2 b c d \break
-\southernHarmonyHeadsMinor
-a2 b c d \break
-\funkHeadsMinor
-a2 b c d \break
-\walkerHeadsMinor
-a2 b c d \break
-
+@lilypond[verbatim,quote]
+\relative c'' {
+  \key a \minor
+  \aikenHeads
+  a b c d e2 f g1 a \break
+  \aikenHeadsMinor
+  a,4 b c d e2 f g1 a \break
+  \sacredHarpHeadsMinor
+  a,2 b c d \break
+  \southernHarmonyHeadsMinor
+  a2 b c d \break
+  \funkHeadsMinor
+  a2 b c d \break
+  \walkerHeadsMinor
+  a2 b c d \break
+}
 @end lilypond
 
 
@@ -3226,19 +3361,17 @@ Internals Reference:
 @cindex note heads, slashed
 
 @funindex \improvisationOn
-@funindex improvisationOn
 @funindex \improvisationOff
-@funindex improvisationOff
 
 Improvisation is sometimes denoted with slashed note heads, where
 the performer may choose any pitch but should play the specified
 rhythm.  Such note heads can be created:
 
-@lilypond[verbatim,quote,relative=2]
+@lilypond[verbatim,quote]
 \new Voice \with {
   \consists "Pitch_squash_engraver"
-} {
-  e8 e g a a16( bes) a8 g
+} \relative {
+  e''8 e g a a16( bes) a8 g
   \improvisationOn
   e8 ~
   2 ~ 8 f4 f8 ~