+@lilypond[quote,ragged-right]
+global = { \key d \major \time 4/4 }
+
+sopranoMusic = \relative c'' {
+ \clef "treble"
+ r4 d2 a4 | d4. d8 a2 | cis4 d cis2 |
+}
+sopranoWords = \lyricmode {
+ Wor -- thy | is the lamb | that was slain |
+}
+
+altoMusic = \relative a' {
+ \clef "treble"
+ r4 a2 a4 | fis4. fis8 a2 | g4 fis e2 |
+}
+altoWords = \sopranoWords
+
+tenorMusic = \relative c' {
+ \clef "G_8"
+ r4 fis2 e4 | d4. d8 d2 | e4 a, cis2 |
+}
+tenorWords = \sopranoWords
+
+bassMusic = \relative c' {
+ \clef "bass"
+ r4 d2 cis4 | b4. b8 fis2 | e4 d a'2 |
+}
+bassWords = \sopranoWords
+
+upper = \relative a' {
+ \clef "treble"
+ \global
+ r4 <a d fis>2 <a e' a>4 |
+ <d fis d'>4. <d fis d'>8 <a d a'>2 |
+ <g cis g'>4 <a d fis> <a cis e>2 |
+}
+
+lower = \relative c, {
+ \clef "bass"
+ \global
+ <d d'>4 <d d'>2 <cis cis'>4 |
+ <b b'>4. <b' b'>8 <fis fis'>2 |
+ <e e'>4 <d d'> <a' a'>2 |
+}
+
+\score {
+ << % combine ChoirStaff and PianoStaff in parallel
+ \new ChoirStaff <<
+ \new Staff = "sopranos" <<
+ \set Staff.instrumentName = #"Soprano"
+ \new Voice = "sopranos" {
+ \global
+ \sopranoMusic
+ }
+ >>
+ \new Lyrics \lyricsto "sopranos" {
+ \sopranoWords
+ }
+ \new Staff = "altos" <<
+ \set Staff.instrumentName = #"Alto"
+ \new Voice = "altos" {
+ \global
+ \altoMusic
+ }
+ >>
+ \new Lyrics \lyricsto "altos" { \altoWords }
+ \new Staff = "tenors" <<
+ \set Staff.instrumentName = #"Tenor"
+ \new Voice = "tenors" {
+ \global
+ \tenorMusic
+ }
+ >>
+ \new Lyrics \lyricsto "tenors" { \tenorWords }
+ \new Staff = "basses" <<
+ \set Staff.instrumentName = #"Bass"
+ \new Voice = "basses" {
+ \global
+ \bassMusic
+ }
+ >>
+ \new Lyrics \lyricsto "basses" {
+ \bassWords
+ }
+ >> % end ChoirStaff
+ \new PianoStaff <<
+ \set PianoStaff.instrumentName = #"Piano"
+ \new Staff = "upper" \upper
+ \new Staff = "lower" \lower
+ >>
+ >>
+}
+@end lilypond
+
+None of the templates provides this layout exactly. The nearest is
+@q{SATB vocal score and automatic piano reduction} -- see @ref{Vocal
+ensembles} -- 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 the piano reduction.
+
+The order in which the contexts appear in the ChoirStaff of 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 should be removed. We also need to specify
+the tenor clef for the tenors. 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:
+
+@example
+\new ChoirStaff <<
+ \new Staff = "sopranos" <<
+ \set Staff.instrumentName = #"Soprano"
+ \new Voice = "sopranos" @{
+ \global
+ \sopranoMusic
+ @}
+ >>
+ \new Lyrics \lyricsto "sopranos" @{
+ \sopranoWords
+ @}
+ \new Staff = "altos" <<
+ \set Staff.instrumentName = #"Alto"
+ \new Voice = "altos" @{
+ \global
+ \altoMusic
+ @}
+ >>
+ \new Lyrics \lyricsto "altos" @{
+ \altoWords
+ @}
+ \new Staff = "tenors" <<
+ \set Staff.instrumentName = #"Tenor"
+ \new Voice = "tenors" @{
+ \global
+ \tenorMusic
+ @}
+ >>
+ \new Lyrics \lyricsto "tenors" @{
+ \tenorWords
+ @}
+ \new Staff = "basses" <<
+ \set Staff.instrumentName = #"Bass"
+ \new Voice = "basses" @{
+ \global
+ \bassMusic
+ @}
+ >>
+ \new Lyrics \lyricsto "basses" @{
+ \bassWords
+ @}
+>> % end ChoirStaff
+@end example
+
+Next we must work out the piano part. This is
+easy - we just pull out the piano part from the
+@q{Solo piano} template:
+
+@example
+\new PianoStaff <<
+ \set PianoStaff.instrumentName = #"Piano "
+ \new Staff = "upper" \upper
+ \new Staff = "lower" \lower
+>>
+@end example
+
+and add the variable definitions for @code{upper}
+and @code{lower}.
+
+The ChoirStaff and PianoStaff must be combined
+using angle brackets as we want them to be
+stacked one above the other:
+
+@example
+<< % combine ChoirStaff and PianoStaff one above the other
+ \new ChoirStaff <<
+ \new Staff = "sopranos" <<
+ \new Voice = "sopranos" @{
+ \global
+ \sopranoMusic
+ @}
+ >>
+ \new Lyrics \lyricsto "sopranos" @{
+ \sopranoWords
+ @}
+ \new Staff = "altos" <<
+ \new Voice = "altos" @{
+ \global
+ \altoMusic
+ @}
+ >>
+ \new Lyrics \lyricsto "altos" @{
+ \altoWords
+ @}
+ \new Staff = "tenors" <<
+ \clef "G_8" % tenor clef
+ \new Voice = "tenors" @{
+ \global
+ \tenorMusic
+ @}
+ >>
+ \new Lyrics \lyricsto "tenors" @{
+ \tenorWords
+ @}
+ \new Staff = "basses" <<
+ \clef "bass"
+ \new Voice = "basses" @{
+ \global
+ \bassMusic
+ @}
+ >>
+ \new Lyrics \lyricsto "basses" @{
+ \bassWords
+ @}
+ >> % end ChoirStaff
+
+ \new PianoStaff <<
+ \set PianoStaff.instrumentName = #"Piano"
+ \new Staff = "upper" \upper
+ \new Staff = "lower" \lower
+ >>
+>>
+@end example
+
+Combining all these together and adding the music
+for the three bars of the example above gives:
+
+@lilypond[quote,verbatim,ragged-right,addversion]
+global = { \key d \major \time 4/4 }
+sopranoMusic = \relative c'' {
+ \clef "treble"
+ r4 d2 a4 | d4. d8 a2 | cis4 d cis2 |
+}
+sopranoWords = \lyricmode {
+ Wor -- thy | is the lamb | that was slain |
+}
+altoMusic = \relative a' {
+ \clef "treble"
+ r4 a2 a4 | fis4. fis8 a2 | g4 fis fis2 |
+}
+altoWords = \sopranoWords
+tenorMusic = \relative c' {
+ \clef "G_8"
+ r4 fis2 e4 | d4. d8 d2 | e4 a, cis2 |
+}
+tenorWords = \sopranoWords
+bassMusic = \relative c' {
+ \clef "bass"
+ r4 d2 cis4 | b4. b8 fis2 | e4 d a'2 |
+}
+bassWords = \sopranoWords
+upper = \relative a' {
+ \clef "treble"
+ \global
+ r4 <a d fis>2 <a e' a>4 |
+ <d fis d'>4. <d fis d'>8 <a d a'>2 |
+ <g cis g'>4 <a d fis> <a cis e>2 |
+}
+lower = \relative c, {
+ \clef "bass"
+ \global
+ <d d'>4 <d d'>2 <cis cis'>4 |
+ <b b'>4. <b' b'>8 <fis fis'>2 |
+ <e e'>4 <d d'> <a' a'>2 |
+}
+
+\score {
+ << % combine ChoirStaff and PianoStaff in parallel
+ \new ChoirStaff <<
+ \new Staff = "sopranos" <<
+ \set Staff.instrumentName = #"Soprano"
+ \new Voice = "sopranos" {
+ \global
+ \sopranoMusic
+ }
+ >>
+ \new Lyrics \lyricsto "sopranos" {
+ \sopranoWords
+ }
+ \new Staff = "altos" <<
+ \set Staff.instrumentName = #"Alto"
+ \new Voice = "altos" {
+ \global
+ \altoMusic
+ }
+ >>
+ \new Lyrics \lyricsto "altos" {
+ \altoWords
+ }
+ \new Staff = "tenors" <<
+ \set Staff.instrumentName = #"Tenor"
+ \new Voice = "tenors" {
+ \global
+ \tenorMusic
+ }
+ >>
+ \new Lyrics \lyricsto "tenors" {
+ \tenorWords
+ }
+ \new Staff = "basses" <<
+ \set Staff.instrumentName = #"Bass"
+ \new Voice = "basses" {
+ \global
+ \bassMusic
+ }
+ >>
+ \new Lyrics \lyricsto "basses" {
+ \bassWords
+ }
+ >> % end ChoirStaff
+
+ \new PianoStaff <<
+ \set PianoStaff.instrumentName = #"Piano "
+ \new Staff = "upper" \upper
+ \new Staff = "lower" \lower
+ >>
+ >>
+}
+@end lilypond
+
+