]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/learning/templates.itely
Merge remote-tracking branch 'origin/translation'
[lilypond.git] / Documentation / learning / templates.itely
index c0dcae46aa6ff912d0a286187a85df16c8fb56a3..cc35e50da7c4c7827b407d35f1e5b621df466b71 100644 (file)
@@ -4,10 +4,11 @@
     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
 
     When revising a translation, copy the HEAD committish of the
     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
 
     When revising a translation, copy the HEAD committish of the
-    version that you are working on.  See TRANSLATION for details.
+    version that you are working on.  For details, see the Contributors'
+    Guide, node Updating translation committishes..
 @end ignore
 
 @end ignore
 
-@c \version "2.12.0"
+@c \version "2.19.2"
 
 @node Templates
 @appendix Templates
 
 @node Templates
 @appendix Templates
@@ -16,127 +17,382 @@ This section of the manual contains templates with the LilyPond score
 already set up for you.  Just add notes, run LilyPond, and enjoy
 beautiful printed scores!
 
 already set up for you.  Just add notes, run LilyPond, and enjoy
 beautiful printed scores!
 
-@c bad node name for ancient notation to avoid conflict
 @menu
 @menu
-* Single staff::
+* Built-in templates::
+* Single staff templates::
 * Piano templates::
 * Piano templates::
-* String quartet::
-* Vocal ensembles::
+* String quartet templates::
+* Vocal ensembles templates::
 * Orchestral templates::
 * Ancient notation templates::
 * Orchestral templates::
 * Ancient notation templates::
-* Jazz combo::
-* lilypond-book templates::
+* Other templates::
 @end menu
 
 
 @end menu
 
 
-@node Single staff
-@appendixsec Single staff
+@node Built-in templates
+@appendixsec Built-in templates
+
+A template, suitable for a range of choral music, is built into
+LilyPond.  This may be used to create simple choral music, with or
+without piano accompaniment, in two or four staves.  Unlike other
+templates, this template is @q{built-in}, which means it does not
+need to be copied and edited:  instead it is simply 
+@code{\include}'d in the input file.
+
+@warning {Unlike most included files, this built-in template must be
+@code{\include}'d at the @emph{end} of the input file.}
+
+The required music expressions are entered by defining values for
+specific variables.  These definition must come before the
+@code{\include}'d file.
+
+The music may be set out with one or two voices per staff by setting
+@code{TwoVoicesPerStaff} to @code{##f} or @code{##t} respectively.
+
+Here's the complete input file for producing a full four-part SATB
+arrangement with individual lyrics and piano accompaniment:
+
+@lilypond[verbatim, quote]
+  SopranoMusic = \relative { a'4\f a8 a a4 a }
+  SopranoLyrics = \lyricmode { Sop -- ra -- no ly -- rics }
+  AltoMusic = \relative { d'4\f d d d }
+  AltoLyrics = \lyricmode { Al -- to ly -- rics }
+  TenorMusic = \relative { a4\p a a a }
+  TenorLyrics = \lyricmode { Te -- nor ly -- rics }
+  BassMusic = \relative { c2\p c4 c }
+  BassLyrics = \lyricmode { Bass ly -- rics }
+  PianoRHMusic = \relative { c' e g c }
+  PianoDynamics = { s2\mp s4 s4 }
+  PianoLHMusic = \relative { c e g c }
+  \include "satb.ly"
+@end lilypond
+
+The same input can be used to produce a score with two voices
+per staff just by setting @code{TwoVoicesPerStaff} to @code{##t}.
+Again, each voice has individual lyrics.
+
+
+@lilypond[verbatim, quote]
+  SopranoMusic = \relative { a'4\f a8 a a4 a }
+  SopranoLyrics = \lyricmode { Sop -- ra -- no ly -- rics }
+  AltoMusic = \relative { d'4\f d d d }
+  AltoLyrics = \lyricmode { Al -- to ly -- rics }
+  TenorMusic = \relative { a4\p a a a }
+  TenorLyrics = \lyricmode { Te -- nor ly -- rics }
+  BassMusic = \relative { c2\p c4 c }
+  BassLyrics = \lyricmode { Bass ly -- rics }
+  PianoRHMusic = \relative { c' e g c }
+  PianoDynamics = { s2\mp s4 s4 }
+  PianoLHMusic = \relative { c e g c }
+  TwoVoicesPerStaff = ##t
+  \include "satb.ly"
+@end lilypond
+
+When @code{TwoVoicesPerStaff} is set to false or allowed to default,
+any of the music variables may be omitted to produce arrangements
+with fewer voices.  Here, for example, is how the input file for a
+Soprano/Bass duet might be written:
+
+@lilypond[verbatim,quote]
+  SopranoMusic = \relative { c'' c c c }
+  SopranoLyrics = \lyricmode { High voice ly -- rics }
+  BassMusic = \relative { a a a a }
+  BassLyrics = \lyricmode { Low voice ly -- rics }
+  \include "satb.ly"
+@end lilypond
+
+A second verse or alternative lyrics may be added to each of the
+parts:
+
+@lilypond[verbatim, quote]
+  SopranoMusic = \relative { a'4 a a a }
+  SopranoLyricsOne = \lyricsto "Soprano" {
+    \set stanza = "1."
+    Words to verse one
+  }
+  SopranoLyricsTwo = \lyricsto "Soprano" {
+    \set stanza = "2."
+    Words to verse two
+  }
+  \include "satb.ly"
+@end lilypond
+
+When the lyrics and rhythms are the same for every part, the vocal
+music is best arranged on two staves with two voices in each.  Up to
+nine verses may be provided.  Here's an unaccompanied example with
+just three verses.
+
+@lilypond[verbatim, quote]
+  SopranoMusic = \relative { a' a a a }
+  AltoMusic = \relative { f' f f f }
+  VerseOne = \lyricmode {
+    \set stanza = "1."
+    Words to verse one
+  }
+  VerseTwo = \lyricmode {
+    \set stanza = "2."
+    Words to verse two
+  }
+  VerseThree = \lyricmode {
+    \set stanza = "3."
+    Words to verse three
+  }
+  TenorMusic = \relative { a a a a }
+  BassMusic = \relative { f f f f }
+  TwoVoicesPerStaff = ##t
+  \include "satb.ly"
+@end lilypond
+
+Other variables may be given values.  The key signature and
+the time signature may be changed from the default:
+
+@lilypond[verbatim, quote]
+  Key = \key a \major
+  Time = {
+    \time 5/4
+    \tempo "Allegro" 4 = 144
+  }
+  SopranoMusic = \relative { gis' gis gis gis gis }
+  AltoMusic = \relative { cis' cis cis cis cis }
+  VerseOne = \lyricmode { Words to this du -- et }
+  TwoVoicesPerStaff = ##t
+  \include "satb.ly"
+@end lilypond
+
+The instrument names and/or the short instrument names may be
+changed:
+
+@lilypond[verbatim,quote]
+  SopranoMusic = \relative { c'' c c c }
+  SopranoLyrics = \lyricmode { High voice ly -- rics }
+  SopranoInstrumentName = "Soprano 1"
+  SopranoShortInstrumentName = "S1"
+  AltoMusic = \relative { a' a a a }
+  AltoLyrics = \lyricmode { Low voice ly -- rics }
+  AltoInstrumentName = "Soprano 2"
+  AltoShortInstrumentName = "S2"
+  \include "satb.ly"
+@end lilypond
+
+A descant may be added by defining values for the variable
+@code{DescantMusic} and descant lyrics may be provided by
+defining values for @code{DescantLyrics}.
 
 
+@code{\header} and @code{\paper} blocks may be added as normal.
+A @code{\layout} block may be provided as the value of the
+@code{Layout} variable:
+
+@example
+Layout = \layout @{ ... @}
+@end example
+
+The complete set of variables which may be changed can be seen by
+examining the file @file{ly/satb.ly}.
+
+@seealso
+Learning Manual:
+@ref{Organizing pieces with variables},
+@ref{Vocal ensembles templates},
+@ref{Extending the templates}.
+
+@knownissues
+More complex arrangements of SATB choral music are not possible with
+these simple built-in templates.
+
+
+@node Single staff templates
+@appendixsec Single staff templates
+
+@menu
+* Notes only::
+* Notes and lyrics::
+* Notes and chords::
+* Notes lyrics and chords::
+@end menu
+
+@node Notes only
 @appendixsubsec Notes only
 
 @appendixsubsec Notes only
 
-@lilypondfile[verbatim,lilyquote,ragged-right,texidoc,addversion]
+@lilypondfile[verbatim,quote,ragged-right,texidoc,addversion]
 {single-staff-template-with-only-notes.ly}
 
 {single-staff-template-with-only-notes.ly}
 
-
+@node Notes and lyrics
 @appendixsubsec Notes and lyrics
 
 @appendixsubsec Notes and lyrics
 
-@lilypondfile[verbatim,lilyquote,ragged-right,texidoc,addversion]
+@lilypondfile[verbatim,quote,ragged-right,texidoc,addversion]
 {single-staff-template-with-notes-and-lyrics.ly}
 
 {single-staff-template-with-notes-and-lyrics.ly}
 
+@node Notes and chords
 @appendixsubsec Notes and chords
 
 @appendixsubsec Notes and chords
 
-@lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
+@lilypondfile[verbatim,quote,ragged-right,texidoc]
 {single-staff-template-with-notes-and-chords.ly}
 
 {single-staff-template-with-notes-and-chords.ly}
 
-@appendixsubsec Notes, lyrics, and chords.
+@node Notes lyrics and chords
+@appendixsubsec Notes, lyrics, and chords
 
 
-@lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
+@lilypondfile[verbatim,quote,ragged-right,texidoc]
 {single-staff-template-with-notes,-lyrics,-and-chords.ly}
 
 
 @node Piano templates
 @appendixsec Piano templates
 
 {single-staff-template-with-notes,-lyrics,-and-chords.ly}
 
 
 @node Piano templates
 @appendixsec Piano templates
 
+@menu
+* Solo piano::
+* Piano and melody with lyrics::
+* Piano centered lyrics::
+@end menu
+
+@node Solo piano
 @appendixsubsec Solo piano
 
 @appendixsubsec Solo piano
 
-@lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
+@lilypondfile[verbatim,quote,ragged-right,texidoc]
 {piano-template-simple.ly}
 
 {piano-template-simple.ly}
 
+@node Piano and melody with lyrics
 @appendixsubsec Piano and melody with lyrics
 
 @appendixsubsec Piano and melody with lyrics
 
-@lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
+@lilypondfile[verbatim,quote,ragged-right,texidoc]
 {piano-template-with-melody-and-lyrics.ly}
 
 {piano-template-with-melody-and-lyrics.ly}
 
+@node Piano centered lyrics
 @appendixsubsec Piano centered lyrics
 
 @appendixsubsec Piano centered lyrics
 
-@lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
+@lilypondfile[verbatim,quote,ragged-right,texidoc]
 {piano-template-with-centered-lyrics.ly}
 
 {piano-template-with-centered-lyrics.ly}
 
-@appendixsubsec Piano centered dynamics
 
 
-@lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
-{piano-template-with-centered-dynamics.ly}
+@node String quartet templates
+@appendixsec String quartet templates
 
 
+@menu
+* String quartet::
+* String quartet parts::
+@end menu
 
 @node String quartet
 
 @node String quartet
-@appendixsec String quartet
-
 @appendixsubsec String quartet
 
 @appendixsubsec String quartet
 
-@lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
+@lilypondfile[verbatim,quote,ragged-right,texidoc]
 {string-quartet-template-simple.ly}
 
 {string-quartet-template-simple.ly}
 
+@node String quartet parts
 @appendixsubsec String quartet parts
 
 @appendixsubsec String quartet parts
 
-@lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
+@lilypondfile[verbatim,quote,ragged-right,texidoc]
 {string-quartet-template-with-separate-parts.ly}
 
 
 {string-quartet-template-with-separate-parts.ly}
 
 
-@node Vocal ensembles
-@appendixsec Vocal ensembles
+@node Vocal ensembles templates
+@appendixsec Vocal ensembles templates
+
+The templates shown below should be copied into your score and edited
+there.  If you have a relatively simple SATB layout you may prefer to
+use the built-in templates, which can simply be @code{\include}'d, see
+@ref{Built-in templates}.
 
 
+@menu
+* SATB vocal score::
+* SATB vocal score and automatic piano reduction::
+* SATB with aligned contexts::
+* SATB on four staves::
+* Solo verse and two-part refrain::
+* Hymn tunes::
+* Psalms::
+@end menu
+
+@node SATB vocal score
 @appendixsubsec SATB vocal score
 
 @appendixsubsec SATB vocal score
 
-@lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
+@lilypondfile[verbatim,quote,ragged-right,texidoc]
 {vocal-ensemble-template.ly}
 
 {vocal-ensemble-template.ly}
 
+@node SATB vocal score and automatic piano reduction
 @appendixsubsec SATB vocal score and automatic piano reduction
 
 @appendixsubsec SATB vocal score and automatic piano reduction
 
-@lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
+@lilypondfile[verbatim,quote,ragged-right,texidoc]
 {vocal-ensemble-template-with-automatic-piano-reduction.ly}
 
 {vocal-ensemble-template-with-automatic-piano-reduction.ly}
 
+@node SATB with aligned contexts
 @appendixsubsec SATB with aligned contexts
 
 @appendixsubsec SATB with aligned contexts
 
-@lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
+@lilypondfile[verbatim,quote,ragged-right,texidoc]
 {vocal-ensemble-template-with-lyrics-aligned-below-and-above-the-staves.ly}
 
 {vocal-ensemble-template-with-lyrics-aligned-below-and-above-the-staves.ly}
 
+@node SATB on four staves
+@appendixsubsec SATB on four staves
+
+@lilypondfile[verbatim,quote,ragged-right,texidoc]
+{satb-choir-template---four-staves.ly}
+
+@node Solo verse and two-part refrain
+@appendixsubsec Solo verse and two-part refrain
+
+@lilypondfile[verbatim,quote,ragged-right,texidoc]
+{vocal-ensemble-template-with-verse-and-refrain.ly}
+
+@node Hymn tunes
+@appendixsubsec Hymn tunes
+
+@lilypondfile[verbatim,quote,ragged-right,texidoc]
+{hymn-template.ly}
+
+@node Psalms
+@appendixsubsec Psalms
+
+@lilypondfile[verbatim,quote,ragged-right,texidoc]
+{anglican-psalm-template.ly}
+
 
 @node Orchestral templates
 @appendixsec Orchestral templates
 
 
 @node Orchestral templates
 @appendixsec Orchestral templates
 
+@menu
+* Orchestra choir and piano::
+@end menu
+
+@node Orchestra choir and piano
 @appendixsubsec Orchestra, choir and piano
 @appendixsubsec Orchestra, choir and piano
-@lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
+
+@lilypondfile[verbatim,quote,ragged-right,texidoc]
 {orchestra,-choir-and-piano-template.ly}
 
 
 {orchestra,-choir-and-piano-template.ly}
 
 
-@c bad node name to avoid node name conflict
 @node Ancient notation templates
 @appendixsec Ancient notation templates
 
 @node Ancient notation templates
 @appendixsec Ancient notation templates
 
+@menu
+* Transcription of mensural music::
+* Gregorian transcription template::
+@end menu
+
+@node Transcription of mensural music
 @appendixsubsec Transcription of mensural music
 
 @appendixsubsec Transcription of mensural music
 
-@lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
+@c Line-width below is because of Issue 766.  If that's fixed, it can be removed.
+@lilypondfile[verbatim,quote,ragged-right,texidoc,line-width=140]
 {ancient-notation-template----modern-transcription-of-mensural-music.ly}
 
 {ancient-notation-template----modern-transcription-of-mensural-music.ly}
 
+@node Gregorian transcription template
 @appendixsubsec Gregorian transcription template
 
 @appendixsubsec Gregorian transcription template
 
-@lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
+@lilypondfile[verbatim,quote,ragged-right,texidoc]
 {ancient-notation-template----modern-transcription-of-gregorian-music.ly}
 
 {ancient-notation-template----modern-transcription-of-gregorian-music.ly}
 
+
+@node Other templates
+@appendixsec Other templates
+
+@menu
+* Jazz combo::
+@end menu
+
 @node Jazz combo
 @node Jazz combo
-@appendixsec Jazz combo
+@appendixsubsec Jazz combo
 
 
-@lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
+@c Line-width below is because of Issue 766.  If that's fixed, it can be removed.
+@lilypondfile[verbatim,quote,ragged-right,texidoc,line-width=140]
 {jazz-combo-template.ly}
 
 
 {jazz-combo-template.ly}
 
 
@@ -161,7 +417,7 @@ violin concerto as TchaikovskyPI, whereas perhaps you wish to print
 
 @ The `line-width' is for \header.
 @li lypond[quote,verbatim,ragged-right,line-width]
 
 @ The `line-width' is for \header.
 @li lypond[quote,verbatim,ragged-right,line-width]
-\version "2.12.0"
+\version "2.19.2"
 \header {
   dedication = "dedication"
   title = "Title"
 \header {
   dedication = "dedication"
   title = "Title"
@@ -210,117 +466,4 @@ violin concerto as TchaikovskyPI, whereas perhaps you wish to print
 @end ignore
 
 
 @end ignore
 
 
-@node lilypond-book templates
-@appendixsec lilypond-book templates
-
-These templates are for use with @code{lilypond-book}.  If you're not familiar
-with this program, please refer to 
-@rprogram{lilypond-book}.
-
-@appendixsubsec LaTeX
-
-You can include LilyPond fragments in a LaTeX document.
-
-@example
-\documentclass[]@{article@}
-
-\begin@{document@}
-
-Normal LaTeX text.
-
-\begin@{lilypond@}
-\relative c'' @{
-a4 b c d
-@}
-\end@{lilypond@}
-
-More LaTeX text.
-
-\begin@{lilypond@}
-\relative c'' @{
-d4 c b a
-@}
-\end@{lilypond@}
-\end@{document@}
-@end example
-
-@appendixsubsec Texinfo
-
-You can include LilyPond fragments in Texinfo; in fact, this entire manual
-is written in Texinfo.
-
-@example
-\input texinfo
-@@node Top
-
-Texinfo text
-
-@@lilypond[verbatim,fragment,ragged-right]
-a4 b c d
-@@end lilypond
-
-More Texinfo text
-
-@@lilypond[verbatim,fragment,ragged-right]
-d4 c b a
-@@end lilypond
-
-@@bye
-@end example
-
-
-@appendixsubsec xelatex
-
-@verbatim
-\documentclass{article}
-\usepackage{ifxetex}
-\ifxetex
-%xetex specific stuff
-\usepackage{xunicode,fontspec,xltxtra}
-\setmainfont[Numbers=OldStyle]{Times New Roman}
-\setsansfont{Arial}
-\else
-%This can be empty if you are not going to use pdftex
-\usepackage[T1]{fontenc}
-\usepackage[utf8]{inputenc}
-\usepackage{mathptmx}%Times
-\usepackage{helvet}%Helvetica
-\fi
-%Here you can insert all packages that pdftex also understands
-\usepackage[ngerman,finnish,english]{babel}
-\usepackage{graphicx}
-
-\begin{document}
-\title{A short document with LilyPond and xelatex}
-\maketitle
-
-Normal \textbf{font} commands inside the \emph{text} work,
-because they \textsf{are supported by \LaTeX{} and XeteX.}
-If you want to use specific commands like \verb+\XeTeX+, you
-should include them again in a \verb+\ifxetex+ environment.
-You can use this to print the \ifxetex \XeTeX{} command \else
-XeTeX command \fi which is not known to normal \LaTeX .
-
-In normal text you can easily use LilyPond commands, like this:
-
-\begin{lilypond}
-{a2 b c'8 c' c' c'}
-\end{lilypond}
-
-\noindent
-and so on.
-
-The fonts of snippets set with LilyPond will have to be set from
-inside
-of the snippet. For this you should read the AU on how to use
-lilypond-book.
-
-\selectlanguage{ngerman}
-Auch Umlaute funktionieren ohne die \LaTeX -Befehle, wie auch alle
-anderen
-seltsamen Zeichen: __ ______, wenn sie von der Schriftart
-unterst__tzt werden.
-\end{document}
-@end verbatim
-