Next: Other sources of information, Previous: Other uses for tweaks, Up: Further tweaking
Override commands are often long and tedious to type, and they
have to be absolutely correct. If the same overrides are to be
used many times it may be worth defining variables to hold them.
Suppose we wish to emphasize certain words in lyrics by printing
them in bold italics. The \italic
and \bold
commands only work within lyrics if they are also embedded in
\markup
, which makes them tedious to enter, so as an
alternative can we instead use the \override
and
\revert
commands?
\override Lyrics . LyricText #'font-shape = #'italic
\override Lyrics . LyricText #'font-series = #'bold
\revert Lyrics . LyricText #'font-shape
\revert Lyrics . LyricText #'font-series
These would also be extremely tedious to enter if there were many words requiring emphasis. So instead we define these as two variables, and use them as follows, although normally we would perhaps choose shorter names for the variables to make them quicker to type:
emphasize = { \override Lyrics . LyricText #'font-shape = #'italic \override Lyrics . LyricText #'font-series = #'bold } normal = { \revert Lyrics . LyricText #'font-shape \revert Lyrics . LyricText #'font-series } global = { \time 4/4 \partial 4 \key c \major} SopranoMusic = \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 } BassMusic = \relative c { c4 | c4. c8 c4 c | f8 g a b c4 } VerseOne = \lyrics { E -- | ter -- nal \emphasize Fa -- ther, \normal | strong to save, } VerseTwo = \lyricmode { O | \emphasize Christ, \normal whose voice the | wa -- ters heard, } VerseThree = \lyricmode { O | \emphasize Ho -- ly Spi -- rit, \normal | who didst brood } VerseFour = \lyricmode { O | \emphasize Tri -- ni -- ty \normal of | love and pow'r } \score { \new ChoirStaff << \new Staff << \clef "treble" \new Voice = "Soprano" { \voiceOne \global \SopranoMusic } \new Voice = "Alto" { \voiceTwo \AltoMusic } \new Lyrics \lyricsto "Soprano" { \VerseOne } \new Lyrics \lyricsto "Soprano" { \VerseTwo } \new Lyrics \lyricsto "Soprano" { \VerseThree } \new Lyrics \lyricsto "Soprano" { \VerseFour } >> \new Staff << \clef "bass" \new Voice = "Tenor" { \voiceOne \TenorMusic } \new Voice = "Bass" { \voiceTwo \BassMusic } >> >> }
This page is for LilyPond-2.11.58 (development-branch).
Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.
Your suggestions for the documentation are welcome.
Other languages: espaƱol.