LilyPond Notation Reference: 2.1.2 Techniques specific to lyrics

### 2.1.2 Techniques specific to lyrics

#### Working with lyrics and variables

Variables containing lyrics can be created, but the lyrics must be entered in lyric mode:

>     musicOne = \relative c'' {
>       c4 b8. a16 g4. f8 e4 d c2
>     }
>     verseOne = \lyricmode {
>       Joy to the world, the Lord is come.
>     }
>     \score {
>       <<
>         \new Voice = "one" {
>           \time 2/4
>           \musicOne
>         }
>         \new Lyrics \lyricsto "one" {
>           \verseOne
>         }
>       >>
>     }

Durations do not need to be added if the variable is to be invoked with `\addlyrics` or `\lyricsto`.

For different or more complex orderings, the best way is to define the music and lyric variables first, then set up the hierarchy of staves and lyrics, omitting the lyrics themselves, and then add the lyrics using `\context` underneath. This ensures that the voices referenced by `\lyricsto` have always been defined earlier. For example:

>     sopranoMusic = \relative c'' { c4 c c c }
>     contraltoMusic = \relative c'' { a4 a a a }
>     sopranoWords = \lyricmode { Sop -- ra -- no words }
>     contraltoWords = \lyricmode { Con -- tral -- to words }

>     \score {
>       \new ChoirStaff <<
>         \new Staff {
>           \new Voice = "sopranos" {
>             \sopranoMusic
>           }
>         }
>         \new Lyrics = "sopranos"
>         \new Lyrics = "contraltos"
>         \new Staff {
>           \new Voice = "contraltos" {
>             \contraltoMusic
>           }
>         }
>         \context Lyrics = "sopranos" {
>           \lyricsto "sopranos" {
>             \sopranoWords
>           }
>         }
>         \context Lyrics = "contraltos" {
>           \lyricsto "contraltos" {
>             \contraltoWords
>           }
>         }
>       >>
>     }

#### See also

Notation Reference: Placing lyrics vertically.

Internals Reference: LyricCombineMusic, Lyrics.

#### Placing lyrics vertically

Depending on the type of music, lyrics may be positioned above the staff, below the staff, or between staves. Placing lyrics below the associated staff is the easiest, and can be achieved by simply defining the Lyrics context below the Staff context:

>     \score {
>       <<
>         \new Staff {
>           \new Voice = "melody" {
>             \relative c'' { c4 c c c }
>           }
>         }
>         \new Lyrics {
>           \lyricsto "melody" {
>             Here are the words
>           }
>         }
>       >>
>     }

Lyrics may be positioned above the staff using one of two methods. The simplest (and preferred) method is to use the same syntax as above and explicitly specify the position of the lyrics:

>     \score {
>       <<
>         \new Staff = "staff" {
>           \new Voice = "melody" {
>             \relative c'' { c4 c c c }
>           }
>         }
>         \new Lyrics \with { alignAboveContext = "staff" } {
>           \lyricsto "melody" {
>             Here are the words
>           }
>         }
>       >>
>     }

Alternatively, a two-step process may be used. First the Lyrics context is declared (without any content) before the Staff and Voice contexts, then the `\lyricsto` command is placed after the Voice declaration it references by using `\context`, as follows:

>     \score {
>       <<
>         \new Lyrics = "lyrics" \with {
>           % lyrics above a staff should have this override
>           \override VerticalAxisGroup #'staff-affinity = #DOWN
>         }
>         \new Staff {
>           \new Voice = "melody" {
>             \relative c'' { c4 c c c }
>           }
>         }
>         \context Lyrics = "lyrics" {
>           \lyricsto "melody" {
>             Here are the words
>           }
>         }
>       >>
>     }

When there are two voices on separate staves the lyrics may be placed between the staves using either of these methods. Here is an example of the second method:

>     \score {
>       \new ChoirStaff <<
>         \new Staff {
>           \new Voice = "sopranos" {
>             \relative c'' { c4 c c c }
>           }
>         }
>         \new Lyrics = "sopranos"
>         \new Lyrics = "contraltos" \with {
>           % lyrics above a staff should have this override
>           \override VerticalAxisGroup #'staff-affinity = #DOWN
>         }
>         \new Staff {
>           \new Voice = "contraltos" {
>             \relative c'' { a4 a a a }
>           }
>         }
>         \context Lyrics = "sopranos" {
>           \lyricsto "sopranos" {
>             Sop -- ra -- no words
>           }
>         }
>         \context Lyrics = "contraltos" {
>           \lyricsto "contraltos" {
>             Con -- tral -- to words
>           }
>         }
>       >>
>     }

Other combinations of lyrics and staves may be generated by elaborating these examples, or by examining the Vocal ensembles templates in the Learning Manual.

#### Selected Snippets

Obtaining 2.12 lyrics spacing in newer versions

The vertical spacing engine changed for version 2.14. This can cause lyrics to be spaced differently. It is possible to set properties for `Lyric` and `Staff` contexts to get the spacing engine to behave as it did in version 2.12.

>     global = {
>       \key d \major
>       \time 3/4
>     }

>     sopMusic = \relative c' {
>       % VERSE ONE
>       fis4 fis fis | \break
>       fis4. e8 e4
>     }

>     altoMusic = \relative c' {
>       % VERSE ONE
>       d4 d d |
>       d4. b8 b4 |
>     }

>     tenorMusic = \relative c' {
>       a4 a a |
>       b4. g8 g4 |
>     }

>     bassMusic = \relative c {
>       d4 d d |
>       g,4. g8 g4 |
>     }

>     words = \lyricmode {
>       Great is Thy faith- ful- ness,
>     }

>     \score {
>       \new ChoirStaff <<
>         \new Lyrics = sopranos
>         \new Staff = women <<
>           \new Voice = "sopranos" {
>             \voiceOne
>             \global \sopMusic
>           }
>           \new Voice = "altos" {
>             \voiceTwo
>             \global \altoMusic
>           }
>         >>
>         \new Lyrics = "altos"
>         \new Lyrics = "tenors"
>         \new Staff = men <<
>           \clef bass
>           \new Voice = "tenors" {
>             \voiceOne
>             \global \tenorMusic
>           }
>           \new Voice = "basses" {
>             \voiceTwo  \global \bassMusic
>           }
>         >>
>         \new Lyrics = basses
>         \context Lyrics = sopranos \lyricsto sopranos \words
>         \context Lyrics = altos \lyricsto altos \words
>         \context Lyrics = tenors \lyricsto tenors \words
>         \context Lyrics = basses \lyricsto basses \words
>       >>
>       \layout {
>         \context {
>           \Lyrics
>           \override VerticalAxisGroup #'staff-affinity = ##f
>           \override VerticalAxisGroup #'staff-staff-spacing =
>             #'((basic-distance . 0)
>     	   (minimum-distance . 2)
>     	   (padding . 2))
>         }
>         \context {
>           \Staff
>           \override VerticalAxisGroup #'staff-staff-spacing =
>             #'((basic-distance . 0)
>     	   (minimum-distance . 2)
>     	   (padding . 2))
>         }
>       }
>     }

#### See also

Learning Manual: Vocal ensembles.

Notation Reference: Aligning contexts, Creating contexts.

#### Placing syllables horizontally

To increase the spacing between lyrics, set the `minimum-distance` property of `LyricSpace`.

>     {
>       c c c c
>       \override Lyrics.LyricSpace #'minimum-distance = #1.0
>       c c c c
>     }
>     \addlyrics {
>       longtext longtext longtext longtext
>       longtext longtext longtext longtext
>     }

To make this change for all lyrics in the score, set the property in the `\layout` block.

>     \score {
>       \relative c' {
>       c c c c
>       c c c c
>       }
>       \addlyrics {
>       longtext longtext longtext longtext
>       longtext longtext longtext longtext
>       }
>       \layout {
>         \context {
>           \Lyrics
>           \override LyricSpace #'minimum-distance = #1.0
>         }
>       }
>     }

#### Selected Snippets

Lyrics alignment

Horizontal alignment for lyrics cam be set by overriding the `self-alignment-X` property of the `LyricText` object. `#-1` is left, `#0` is center and `#1` is right; however, you can use `#LEFT`, `#CENTER` and `#RIGHT` as well.

>     \layout { ragged-right = ##f }
>     \relative c'' {
>       c1
>       c1
>       c1
>     }
>     \addlyrics {
>       \once \override LyricText #'self-alignment-X = #LEFT
>       "This is left-aligned"
>       \once \override LyricText #'self-alignment-X = #CENTER
>       "This is centered"
>       \once \override LyricText #'self-alignment-X = #1
>       "This is right-aligned"
>     }

Checking to make sure that text scripts and lyrics are within the margins requires additional calculations. To speed up processing slightly, this feature can be disabled:

>     \override Score.PaperColumn #'keep-inside-line = ##f

To make lyrics avoid bar lines as well, use

>     \layout {
>       \context {
>         \Lyrics
>           \consists "Bar_engraver"
>           \consists "Separating_line_group_engraver"
>           \override BarLine #'transparent = ##t
>       }
>     }

#### Lyrics and repeats

### Simple repeats

Repeats in music are fully described elsewhere; see Repeats. This section explains how to add lyrics to repeated sections of music.

Lyrics to a section of music that is repeated should be surrounded by exactly the same repeat construct as the music, if the words are unchanged.

>     \score {
>       <<
>         \new Staff {
>           \new Voice = "melody" {
>             \relative c'' {
>               a4 a a a
>               \repeat volta 2 { b4 b b b }
>             }
>           }
>         }
>         \new Lyrics {
>           \lyricsto "melody" {
>             Not re -- peat -- ed.
>             \repeat volta 2 { Re -- peat -- ed twice. }
>           }
>         }
>       >>
>     }

The words will then be correctly expanded if the repeats are unfolded.

>     \score {
>       \unfoldRepeats {
>         <<
>           \new Staff {
>             \new Voice = "melody" {
>               \relative c'' {
>                 a4 a a a
>                 \repeat volta 2 { b4 b b b }
>               }
>             }
>           }
>           \new Lyrics {
>             \lyricsto "melody" {
>               Not re -- peat -- ed.
>               \repeat volta 2 { Re -- peat -- ed twice. }
>             }
>           }
>         >>
>       }
>     }

If the repeated section is to be unfolded and has different words, simply enter all the words:

>     \score {
>       <<
>         \new Staff {
>           \new Voice = "melody" {
>             \relative c'' {
>               a4 a a a
>               \repeat unfold 2 { b4 b b b }
>             }
>           }
>         }
>         \new Lyrics {
>           \lyricsto "melody" {
>             Not re -- peat -- ed.
>             The first time words.
>             Sec -- ond time words.
>           }
>         }
>       >>
>     }

When the words to a repeated volta section are different, the words to each repeat must be entered in separate `Lyrics` contexts, correctly nested in parallel sections:

>     \score {
>       <<
>         \new Staff {
>           \new Voice = "melody" {
>             \relative c'' {
>               a4 a a a
>               \repeat volta 2 { b4 b b b }
>             }
>           }
>         }
>         \new Lyrics \lyricsto "melody" {
>           Not re -- peat -- ed.
>           <<
>     	{ The first time words. }
>     	\new Lyrics {
>     	  \set associatedVoice = "melody"
>     	  Sec -- ond time words.
>     	}
>           >>
>         }
>       >>
>     }

More verses may be added in a similar way:

>     \score {
>       <<
>         \new Staff {
>           \new Voice = "singleVoice" {
>             \relative c'' {
>     	  a4 a a a
>     	  \repeat volta 3 { b4 b b b }
>               c4 c c c
>     	}
>           }
>         }
>         \new Lyrics \lyricsto "singleVoice" {
>           Not re -- peat -- ed.
>           <<
>             { The first time words.	}
>     	\new Lyrics {
>     	  \set associatedVoice = "singleVoice"
>     	  Sec -- ond time words.
>     	}
>     	\new Lyrics {
>     	  \set associatedVoice = "singleVoice"
>     	  The third time words.
>     	}
>           >>
>           The end sec -- tion.
>         }
>       >>
>     }

### Repeats with alternative endings

If the words of the repeated section are the same, exactly the same structure can be used for both the lyrics and music.

>     \score {
>       <<
>         \new Staff {
>           \time 2/4
>           \new Voice = "melody" {
>             \relative c'' {
>               a4 a a a
>               \repeat volta 2 { b4 b }
>               \alternative { { b b } { b c } }
>             }
>           }
>         }
>         \new Lyrics {
>           \lyricsto "melody" {
>             Not re -- peat -- ed.
>             \repeat volta 2 { Re -- peat -- }
>             \alternative { { ed twice. } { ed twice. } }
>           }
>         }
>       >>
>     }

But when the repeated section has different words, a repeat construct cannot be used around the words and `\skip` commands have to be inserted manually to skip over the notes in the alternative sections which do not apply.

Note: do not use an underscore, `_`, to skip notes – an underscore indicates a melisma, causing the preceding syllable to be left-aligned.

Note: The `\skip` command must be followed by a number, but this number is ignored in lyrics which derive their durations from the notes in an associated melody through `addlyrics` or `lyricsto`. Each `\skip` skips a single note of any value, irrespective of the value of the following number.

>     \score {
>       <<
>         \new Staff {
>           \time 2/4
>           \new Voice = "melody" {
>             \relative c'' {
>               \repeat volta 2 { b4 b }
>               \alternative { { b b } { b c } }
>               c4 c
>             }
>           }
>         }
>         \new Lyrics {
>           \lyricsto "melody" {
>             The first time words.
>             \repeat unfold 2 { \skip 1 }
>             End here.
>           }
>         }
>         \new Lyrics {
>           \lyricsto "melody" {
>             Sec -- ond
>             \repeat unfold 2 { \skip 1 }
>             time words.
>           }
>         }
>       >>
>     }

When a note is tied over into two or more alternative endings a tie is used to carry the note into the first alternative ending and a `\repeatTie` is used in the second and subsequent endings. This structure causes difficult alignment problems when lyrics are involved and increasing the length of the alternative sections so the tied notes are contained wholly within them may give a more acceptable result.

The tie creates a melisma into the first alternative, but not into the second and subsequent alternatives, so to align the lyrics correctly it is necessary to disable the automatic creation of melismata over the volta section and insert manual skips.

>     \score {
>       <<
>         \new Staff {
>           \time 2/4
>           \new Voice = "melody" {
>             \relative c'' {
>               \set melismaBusyProperties = #'()
>               \repeat volta 2 { b4 b ~}
>               \alternative { { b b } { b \repeatTie c } }
>               \unset melismaBusyProperties
>               c4 c
>             }
>           }
>         }
>         \new Lyrics {
>           \lyricsto "melody" {
>             \repeat volta 2 { Here's a __ }
>             \alternative {
>               { \skip 1 verse }
>               { \skip 1 sec }
>             }
>             ond one.
>           }
>         }
>       >>
>     }

Note that if `\unfoldRepeats` is used around a section containing `\repeatTie`, the `\repeatTie` should be removed to avoid both types of tie being printed.

When the repeated section has different words a `\repeat` cannot be used around the lyrics and `\skip` commands need to be inserted manually, as before.

>     \score {
>       <<
>         \new Staff {
>           \time 2/4
>           \new Voice = "melody" {
>             \relative c'' {
>               \repeat volta 2 { b4 b ~}
>               \alternative { { b b } { b \repeatTie c } }
>               c4 c
>             }
>           }
>         }
>         \new Lyrics {
>           \lyricsto "melody" {
>             Here's a __ verse.
>             \repeat unfold 2 { \skip 1 }
>           }
>         }
>         \new Lyrics {
>           \lyricsto "melody" {
>             Here's one
>             \repeat unfold 2 { \skip 1 }
>             more to sing.
>           }
>         }
>       >>
>     }

If you wish to show extenders and hyphens into and out of alternative sections these must be inserted manually.

>     \score {
>       <<
>         \new Staff {
>           \time 2/4
>           \new Voice = "melody" {
>             \relative c'' {
>               \repeat volta 2 { b4 b ~}
>               \alternative { { b b } { b \repeatTie c } }
>               c4 c
>             }
>           }
>         }
>         \new Lyrics {
>           \lyricsto "melody" {
>             Here's a __ verse.
>             \repeat unfold 2 { \skip 1 }
>           }
>         }
>         \new Lyrics {
>           \lyricsto "melody" {
>             Here's "a_"
>             \skip 1
>             "_" sec -- ond one.
>           }
>         }
>       >>
>     }

#### See also

Notation Reference: Keeping contexts alive, Repeats.

#### Divisi lyrics

When just the words and rhythms of the two parts differ with the pitches remaining the same, temporarily turning off the automatic detection of melismata and indicating the melisma in the lyrics may be the appropriate method to use:

>     \score {
>       <<
>         \new Voice = "melody" {
>           \relative c' {
>             \set melismaBusyProperties = #'()
>             \slurDown
>             \slurDashed
>             e4 e8 ( e ) c4 c |
>             \unset melismaBusyProperties
>             c
>           }
>         }
>         \new Lyrics \lyricsto "melody" {
>           They shall not o -- ver -- come
>         }
>         \new Lyrics \lyricsto "melody" {
>           We will _
>         }
>       >>
>     }

When both music and words differ it may be better to display the differing music and lyrics by naming voice contexts and attaching lyrics to those specific contexts:

>     \score {
>       <<
>         \new Voice = "melody" {
>           \relative c' {
>             <<
>               {
>                 \voiceOne
>                 e4 e8 e
>               }
>               \new Voice = "splitpart" {
>                 \voiceTwo
>                 c4 c
>               }
>             >>
>             \oneVoice
>             c4 c |
>             c
>           }
>         }
>         \new Lyrics \lyricsto "melody" {
>           They shall not o -- ver -- come
>         }
>         \new Lyrics \lyricsto "splitpart" {
>           We will
>         }
>       >>
>     }

其它语言：deutsch, español, 日本語。

#### LilyPond — Notation Reference