Sophie

Sophie

distrib > Mandriva > 2009.0 > i586 > by-pkgid > 3a7b4dfc766af1222d90c7f03a0844e6 > files > 10242

lilypond-doc-2.11.57-1mdv2009.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- header_tag -->
<html lang="en">
<head>
<title>Text - LilyPond snippets</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="LilyPond snippets">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="Editorial-annotations.html#Editorial-annotations" title="Editorial annotations">
<link rel="next" href="Vocal-music.html#Vocal-music" title="Vocal music">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
hr { border:0; height:1; color: #000000; background-color: #000000; }
/* hr {
  border:  none;
  height: 1px;
  color: #666666;
  background-color: #666666;
}
body {
  border-left: 1px solid #666666;
  border-right: 1px solid #666666;
  color: #332d28;
  margin-right: auto;
  margin-left: auto;
  width: 60em;
  list-style-type: square;
  font-family: Arial,Helvetica,sans-serif;
  padding-right: 1em;
  padding-left: 1em;
}
a {
  border-bottom: 1px dashed #344242;
  text-decoration: none;
  color: #344242;
}
a:link {
  text-decoration: none;
}
a:visited {
  border-bottom: 1px dashed #666666;
  color: #666666;
}
a:active {
  border-bottom: 1px solid #00cccc;
  color: #00cccc;
}
a:hover {
  border-bottom: 1px solid #1d7b85;
  color: #1d7b85;
}
blockquote {
  border: 1px solid #cccccc;
  padding: 3px;
  width: 40em;
}
.node {
  border-left: 1px solid #666666;
  margin: -0.5em 0px 1em;
  padding: 2px 1px 0px;
  font-style: italic;
}
.node a {
  border:  none;
  text-decoration: underline;
  font-style: normal;
  font-weight: bold;
}
.verbatim {
  font-family: "Courier New",Courier,monospace;
}
.unnumberedsubsubsec {
  font-size: large;
  color: #1d7b85;
}
.subsubheading {
  font-size: large;
  color: #3b220d;
}
.contents {
  border: 1px dashed #339999;
  margin: 3px 2em;
  list-style-type: square;
  padding-right: 1em;
  width: 40em;
  background-color: #fcfff9;
}
.contents a {
  border-bottom: 1px dashed #423d34;
  text-decoration: none;
  color: #423d34;
}
.contents a:visited {
  border-bottom: 1px dashed #666666;
  color: #666666;
}
.contents a:active {
  border-bottom: 1px solid #f0d86d;
  color: #f0d86d;
}
.contents a:hover {
  border-bottom: 1px solid #3b220d;
  color: #3b220d;
}
.menu {
  border-left: 1px dashed #339999;
  margin: 3px 2em 1em;
  list-style-type: square;
  padding-left: 1.4em;
  width: 40em;
}
.unnumbered {
}
h2 {
  font-size: x-large;
  color: #1d7b85;
}
*/
--></style>
</head>
<BODY BGCOLOR=WHITE TEXT=BLACK>

<div class="node">
<p>
<a name="Text"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Vocal-music.html#Vocal-music">Vocal music</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Editorial-annotations.html#Editorial-annotations">Editorial annotations</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>

<h2 class="unnumbered">Text</h2>

<p>These snippets illustrate the Notation Reference,
section <a href="../../../Documentation/user/lilypond/Text.html#Text">Text</a>.

   <p><a name="adjusting-lyrics-vertical-spacing.ly"></a>

<h3 class="unnumberedsec">Adjusting lyrics vertical spacing</h3>

<p>This snippet shows how to bring the lyrics line closer to the staff.

<pre class="verbatim">
% Default layout:
&lt;&lt;
  \new Staff \new Voice = melody \relative c' {
    c4 d e f
    g4 f e d
    c1
  }
  \new Lyrics \lyricsto melody { aa aa aa aa aa aa aa aa aa }

% Reducing the minimum space below the staff and above the lyrics:
  \new Staff \with {
    \override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 4)
  }
  \new Voice = melody \relative c' {
    c4 d e f
    g4 f e d
    c1
  }
  \new Lyrics \with {
    \override VerticalAxisGroup #'minimum-Y-extent = #'(-1.2 . 1)
  }
  \lyricsto melody { aa aa aa aa aa aa aa aa aa }
>>
</pre>
<p>
 <a href="../25/lily-be0a47ca.ly">
  <img align="middle"
    border="0" src="../25/lily-be0a47ca.png" alt="[image of music]">
 </a>
</p>

   <p><a name="aligning-and-centering-instrument-names.ly"></a>

<h3 class="unnumberedsec">Aligning and centering instrument names</h3>

<p>Instrument names are generally printed to the left of the staves. To
align the names of several different intruments, put them in a
<code>\markup</code> block and use one of the following possibilites:

   <p>*
    Right-aligned instrument names: this is the default behavior

   <p>*
    Center-aligned instrument names: using the <code>\hcenter-in #n</code>
command
    places the instrument names inside a padded box, with <code>n</code> being
the width
    of the box

   <p>*
    Left-aligned instrument names: the names are printed on top of an
    empty box, using the <code>\combine</code> command
    with an <code>\hspace #n</code> object.

<pre class="verbatim">
\paper {
  indent = #0
  left-margin = #30
  line-width = #160
}

\new StaffGroup \relative c' &lt;&lt;
  \new Staff {
    \set Staff.instrumentName = #"Piccolo"
    c1^"default" | c \break
    \set Staff.instrumentName = \markup { \hcenter-in #10 Piccolo }
    c1^"centered" | c \break
    \set Staff.instrumentName = \markup { \combine \hspace #8 Piccolo }
    c1^"left-aligned" | c
  } 
  \new Staff {
    \set Staff.instrumentName = #"Flute"
    c1 | c \break
    \set Staff.instrumentName = \markup { \hcenter-in #10 Flute }
    c1 | c \break
    \set Staff.instrumentName = \markup { \combine \hspace #8 Flute }
    c1 | c
  }
>>
</pre>
<p>
 <a href="../58/lily-3fb556c3.ly">
  <img align="middle"
    border="0" src="../58/lily-3fb556c3.png" alt="[image of music]">
 </a>
</p>

   <p><a name="aligning-lyrics.ly"></a>

<h3 class="unnumberedsec">Aligning lyrics</h3>

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

<pre class="verbatim">
\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"
}
</pre>
<p>
 <a href="../e5/lily-dfa6ccc0.ly">
  <img align="middle"
    border="0" src="../e5/lily-dfa6ccc0.png" alt="[image of music]">
 </a>
</p>

   <p><a name="aligning-marks-with-various-notation-objects.ly"></a>

<h3 class="unnumberedsec">Aligning marks with various notation objects</h3>

<p>If specified, text marks may be aligned with notation objects other
than bar lines.  These objects include <code>ambitus</code>,
<code>breathing-sign</code>, <code>clef</code>, <code>custos</code>, <code>staff-bar</code>,
<code>left-edge</code>, <code>key-cancellation</code>, <code>key-signature</code>, and
<code>time-signature</code>.

   <p>In such cases, text marks will be horizontally centered above the
object. However this can be changed, as demonstrated on the second line
of this example (in a score with multiple staves, this setting should
be done for all the staves).

<pre class="verbatim">
\relative c' {
  e1
  
  % the RehearsalMark will be centered above the Clef
  \override Score.RehearsalMark #'break-align-symbols = #'(clef)
  \key a \major
  \clef treble
  \mark "↓"
  e
  
  % the RehearsalMark will be centered above the TimeSignature
  \override Score.RehearsalMark #'break-align-symbols = #'(time-signature)
  \key a \major
  \clef treble
  \time 3/4
  \mark "↓"
  e2.
  
  % the RehearsalMark will be centered above the KeySignature
  \override Score.RehearsalMark #'break-align-symbols = #'(key-signature)
  \key a \major
  \clef treble
  \time 4/4
  \mark "↓"
  e1

  \break
  e
  
  % the RehearsalMark will be aligned with the left edge of the KeySignature
  \once \override Score.KeySignature #'break-align-anchor-alignment = #LEFT
  \mark "↓"
  \key a \major
  e
  
  % the RehearsalMark will be aligned with the right edge of the KeySignature
  \once \override Score.KeySignature #'break-align-anchor-alignment = #RIGHT
  \key a \major
  \mark "↓"
  e
  
  % the RehearsalMark will be aligned with the left edge of the KeySignature
  % and then shifted right by 1 unit.
  \once \override Score.KeySignature #'break-align-anchor = #1
  \key a \major
  \mark "↓"
  e1
}
</pre>
<p>
 <a href="../fe/lily-abfc1e98.ly">
  <img align="middle"
    border="0" src="../fe/lily-abfc1e98.png" alt="[image of music]">
 </a>
</p>

   <p><a name="blanking-staff-lines-using-the--whiteout-command.ly"></a>

<h3 class="unnumberedsec">Blanking staff lines using the \whiteout command</h3>

<p>The <code>\whiteout</code> command underlays a markup with a white box. 
Since staff lines are in a lower layer than most other grobs, this
white box will not overlap any other grob.

<pre class="verbatim">
\layout { ragged-right = ##f }
\relative c' {
  \override TextScript #'extra-offset = #'(2 . 4)
  c2-\markup { \whiteout \pad-markup #0.5 "middle C" } c
} 
</pre>
<p>
 <a href="../56/lily-e5c94de5.ly">
  <img align="middle"
    border="0" src="../56/lily-e5c94de5.png" alt="[image of music]">
 </a>
</p>

   <p><a name="center-text-below-hairpin-dynamics.ly"></a>

<h3 class="unnumberedsec">Center text below hairpin dynamics</h3>

<p>This example provides a function to typeset a hairpin (de)crescendo
with some additional text below it, such as "molto" or "poco". The
example also illustrates how to modify the way an object is normally
printed, using some Scheme code.

<pre class="verbatim">
hairpinWithCenteredText = #(define-music-function (parser location text) (markup?)
#{
  \override Voice.Hairpin #'stencil = #(lambda (grob)
  (ly:stencil-aligned-to
   (ly:stencil-combine-at-edge
    (ly:stencil-aligned-to (ly:hairpin::print grob) X CENTER)
    Y DOWN
    (ly:stencil-aligned-to (ly:text-interface::print grob) X CENTER))
   X LEFT))
  \override Voice.Hairpin #'text = $text
#})

hairpinMolto = \hairpinWithCenteredText \markup { \italic molto }
hairpinMore = \hairpinWithCenteredText \markup { \bigger moltissimo }

\layout { ragged-right = ##f }

{
  \hairpinMolto c'2\&lt; c'\f
  \hairpinMore  c'2\&lt; c'\f
}
</pre>
<p>
 <a href="../2f/lily-18ead2c8.ly">
  <img align="middle"
    border="0" src="../2f/lily-18ead2c8.png" alt="[image of music]">
 </a>
</p>

   <p><a name="changing-the-default-text-font-family.ly"></a>

<h3 class="unnumberedsec">Changing the default text font family</h3>

<p>The default font families for text can be overridden with
<code>make-pango-font-tree</code>.

<pre class="verbatim">
\paper {
  % change for other default global staff size. 
  myStaffSize = #20
  %{
     run
         lilypond -dshow-available-fonts blabla
     to show all fonts available in the process log.  
  %}

  #(define fonts
    (make-pango-font-tree "Times New Roman"
                          "Nimbus Sans"
                          "Luxi Mono"
;;                        "Helvetica"
;;                        "Courier"
     (/ myStaffSize 20)))
}

\relative {
  c'^\markup {
    roman: foo \bold bla \italic bar \italic \bold baz 
  }
  c'_\markup {
    \override #'(font-family . sans)
    {
      sans: foo \bold bla \italic bar \italic \bold baz
    }
  }
  c'2^\markup {
    \override #'(font-family . typewriter)
    {
      mono: foo \bold bla \italic bar \italic \bold baz
    }
  }
}  

</pre>
<p>
 <a href="../a1/lily-e2be3d91.ly">
  <img align="middle"
    border="0" src="../a1/lily-e2be3d91.png" alt="[image of music]">
 </a>
</p>

   <p><a name="combining-dynamics-with-markup-texts.ly"></a>

<h3 class="unnumberedsec">Combining dynamics with markup texts</h3>

<p>Some dynamics may involve text indications (such as "più forte" or
"piano subito"). They can be produced using a <code>\markup</code> block.

<pre class="verbatim">
piuF = \markup { \italic più \dynamic f }
\layout { ragged-right = ##f }
\relative c'' {
  c2\f c-\piuF
}

</pre>
<p>
 <a href="../8e/lily-cc388ac0.ly">
  <img align="middle"
    border="0" src="../8e/lily-cc388ac0.png" alt="[image of music]">
 </a>
</p>

   <p><a name="combining-two-parts-on-the-same-staff.ly"></a>

<h3 class="unnumberedsec">Combining two parts on the same staff</h3>

<p>The part combiner tool ( <code>\partcombine</code> command ) allows the
combination of several different parts on the same staff.  Text
directions such as "solo" or "a2" are added by default; to remove
them, simply set the property <code>printPartCombineTexts</code> to
"false". For vocal scores (hymns), there is no need to add
"solo"/"a2" texts, so they should be switched off.  However, it
might be better not to use it if there are any solos, as they won't be
indicated.  In such cases, standard polyphonic notation may be
preferable.

   <p>This snippet presents the three ways two parts can be printed on a same
staff: standard polyphony, <code>\partcombine</code> without texts, and
<code>\partcombine</code> with texts.

<pre class="verbatim">
musicUp = \relative c'' {
  \time 4/4
  a4 c4.( g8) a4 |
  g4 e' g,( a8 b) |
  c b a2.
}

musicDown = \relative c'' {
  g4 e4.( d8) c4 |
  r2 g'4( f8 e) |
  d2 \stemDown a
}

\score {
  &lt;&lt;
    &lt;&lt;
    \new Staff {
      \set Staff.instrumentName = "Standard polyphony  "
      &lt;&lt; \musicUp \\ \musicDown >>
    }
    \new Staff \with { printPartCombineTexts = ##f } {
      \set Staff.instrumentName = "PartCombine without texts  "
      \partcombine \musicUp \musicDown
    }
    \new Staff {
      \set Staff.instrumentName = "PartCombine with texts  "
      \partcombine \musicUp \musicDown
    }
    >>
  >>
  \layout {
    indent = 6.0\cm
    \context {
      \Score
      \override SystemStartBar #'collapse-height = #30
    }
  }
}
</pre>
<p>
 <a href="../5e/lily-c79da8a0.ly">
  <img align="middle"
    border="0" src="../5e/lily-c79da8a0.png" alt="[image of music]">
 </a>
</p>

   <p><a name="creating-real-parenthesized-dynamics.ly"></a>

<h3 class="unnumberedsec">Creating "real" parenthesized dynamics</h3>

<p>Although the easiest way to add parentheses to a dynamic mark is to use
a <code>\markup</code> block, this method has a downside: the created
objects will behave like text markups, and not like dynamics.

   <p>However, it is possible to create a similar object using the equivalent
Scheme code (as described in "Markup programmer interface"), combined
with the <code>make-dynamic-script</code> function. This way, the markup will
be regarded as a dynamic, and therefore will remain compatible with
commands such as <code>\dynamicUp</code> or <code>\dynamicDown</code>.

<pre class="verbatim">
\paper { ragged-right = ##t }

parenF = #(make-dynamic-script (markup #:line (#:normal-text #:italic
           #:fontsize 2 "(" #:hspace -0.8 #:dynamic "f" #:normal-text
           #:italic #:fontsize 2 ")"
          )))
\relative c'' {
  c4\parenF c c \dynamicUp c\parenF
}
</pre>
<p>
 <a href="../71/lily-7346f215.ly">
  <img align="middle"
    border="0" src="../71/lily-7346f215.png" alt="[image of music]">
 </a>
</p>

   <p><a name="creating-simultaneous-rehearsal-marks.ly"></a>

<h3 class="unnumberedsec">Creating simultaneous rehearsal marks</h3>

<p>Unlike text scripts, rehearsal marks cannot be stacked at a particular point
in a score: only one <code>RehearsalMark</code> object is created.  Using an
invisible measure and bar line, an extra rehearsal mark can be added, giving
the appearance of two marks in the same column.

   <p>This method may also prove useful for placing rehearsal marks at both the
end of one system and the start of the following system.

<pre class="verbatim">
{
  \key a \major
  \set Score.markFormatter = #format-mark-box-letters
  \once \override Score.RehearsalMark #'outside-staff-priority = #5000
  \once \override Score.RehearsalMark #'self-alignment-X = #LEFT
  \once \override Score.RehearsalMark #'break-align-symbols = #'(key-signature)
  \mark \markup { \bold { Senza denti } }
  
  % the hidden measure and bar line
  \once \override Score.TimeSignature #'stencil = ##f
  \time 1/16
  s16 \bar ""
  
  \time 4/4
  \once \override Score.RehearsalMark #'self-alignment-X = #LEFT
  \once \override Score.RehearsalMark #'break-align-symbols = #'(bar-line)
  \mark \markup { \box \bold Intro }
  d'1
  \mark \default
  d'1
}
</pre>
<p>
 <a href="../3a/lily-6eac71b0.ly">
  <img align="middle"
    border="0" src="../3a/lily-6eac71b0.png" alt="[image of music]">
 </a>
</p>

   <p><a name="creating-text-spanners.ly"></a>

<h3 class="unnumberedsec">Creating text spanners</h3>

<p>The <code>\startTextSpan</code> and <code>\stopTextSpan</code> commands allow the
creation of text spanners as easily as pedal indications or
octavations. Override some properties of the <code>TextSpanner</code> object
to modify its output.

<pre class="verbatim">
\relative c'' {
  \override TextSpanner  #'edge-text = #'("bla" . "blu")
  a \startTextSpan
  b c
  a \stopTextSpan
  
  \override TextSpanner  #'dash-period = #2
  \override TextSpanner  #'dash-fraction = #0.0
  a \startTextSpan
  b c
  a \stopTextSpan
  
  \revert TextSpanner #'style
  \override TextSpanner  #'style = #'dashed-line \override TextSpanner #'bound-details #'left #'text = \markup { \draw-line #'(0 . 1) }
 \override TextSpanner #'bound-details #'right #'text = \markup { \draw-line #'(0 . -2) }

  a \startTextSpan
  b c
  a \stopTextSpan
  
  \set Staff.middleCPosition = #-13
  \override TextSpanner  #'dash-period = #10
  \override TextSpanner  #'dash-fraction = #0.5
  \override TextSpanner  #'thickness = #10
  a \startTextSpan
  b c
  a \stopTextSpan
  \set Staff.middleCPosition = #-6
}
</pre>
<p>
 <a href="../97/lily-494f79c2.ly">
  <img align="middle"
    border="0" src="../97/lily-494f79c2.png" alt="[image of music]">
 </a>
</p>

   <p><a name="demonstrating-all-headers.ly"></a>

<h3 class="unnumberedsec">Demonstrating all headers</h3>

<p>All header fields with special meanings.
<pre class="verbatim">
\header {
  copyright = "copyright"
  title = "title"
  subtitle = "subtitle"
  composer = "composer"
  arranger = "arranger"
  instrument = "instrument"
  metre = "metre"
  opus = "opus"
  piece = "piece"
  poet = "poet"
  texidoc = "All header fields with special meanings."
  copyright = "public domain"
  enteredby = "jcn"
  source = "urtext"
}

\layout {
  ragged-right = ##f
}

\score {
  \relative c'' { c1 | c | c | c }
}

\score {
   \relative c'' { c1 | c | c | c }
   \header {
     title = "localtitle"
     subtitle = "localsubtitle"
     composer = "localcomposer"
     arranger = "localarranger"
     instrument = "localinstrument"
     metre = "localmetre"
     opus = "localopus"
     piece = "localpiece"
     poet = "localpoet"
     copyright = "localcopyright"
   }
}
</pre>
<p>
 <a href="../82/lily-bd13e6d5.ly">
  <img align="middle"
    border="0" src="../82/lily-bd13e6d5.png" alt="[image of music]">
 </a>
</p>

   <p><a name="embedding-native-postscript-in-a--markup-block.ly"></a>

<h3 class="unnumberedsec">Embedding native PostScript in a \markup block</h3>

<p>PostScript code can be directly inserted inside a <code>\markup</code>
block.

<pre class="verbatim">
% PostScript is a registered trademark of Adobe Systems Inc.

\relative c'' {
  a4-\markup { \postscript #"3 4 moveto 5 3 rlineto stroke" }
  -\markup { \postscript #"[ 0 1 ] 0 setdash 3 5 moveto 5 -3 rlineto stroke " }
  
  b4-\markup { \postscript #"3 4 moveto 0 0 1 2 8 4 20 3.5 rcurveto stroke" }
  s2
  a'1
}
</pre>
<p>
 <a href="../8f/lily-cec3187d.ly">
  <img align="middle"
    border="0" src="../8f/lily-cec3187d.png" alt="[image of music]">
 </a>
</p>

   <p><a name="formatting-lyrics-syllables.ly"></a>

<h3 class="unnumberedsec">Formatting lyrics syllables</h3>

<p>To format individual syllables in lyrics, use <code>\markup { .... 
}</code> on these lyrics.

<pre class="verbatim">
% Tip taken from http://lists.gnu.org/archive/html/lilypond-user/2007-12/msg00215.html
\header {
  title = "Markup can be used inside lyrics!"
}

mel = \relative c'' { c4 c c c }
lyr = \lyricmode {
  Lyrics \markup { \italic "can" } \markup {\with-color #red "contain" }
  \markup {\fontsize #8 \bold "Markup!" }
}

&lt;&lt;
  \context Voice = melody \mel
  \context Lyrics \lyricsto melody \lyr
>>

</pre>
<p>
 <a href="../4a/lily-a3b88491.ly">
  <img align="middle"
    border="0" src="../4a/lily-a3b88491.png" alt="[image of music]">
 </a>
</p>

   <p><a name="how-to-put-ties-between-syllables-in-lyrics.ly"></a>

<h3 class="unnumberedsec">How to put ties between syllables in lyrics</h3>

<p>This can be achieved by separating those syllables by tildes.

<pre class="verbatim">
\lyrics {
  wa~o~a 
}
</pre>
<p>
 <a href="../07/lily-e98c6f9f.ly">
  <img align="middle"
    border="0" src="../07/lily-e98c6f9f.png" alt="[image of music]">
 </a>
</p>

   <p><a name="markup-lines.ly"></a>

<h3 class="unnumberedsec">Markup lines</h3>

<p>Text that can spread over pages is entered with the
<code>\markuplines</code> command.
<pre class="verbatim">
#(set-default-paper-size "a6")

#(define-markup-list-command (paragraph layout props args) (markup-list?)
  (interpret-markup-list layout props
   (make-justified-lines-markup-list (cons (make-hspace-markup 2) args))))

% Candide, Voltaire
\markuplines \override-lines #'(baseline-skip . 2.5) {
  \paragraph {
    Il y avait en Westphalie, dans le château de M. le baron de
    Thunder-ten-tronckh, un jeune garçon à qui la nature avait donné
    les mœurs les plus douces.  Sa physionomie annonçait son âme.
    Il avait le jugement assez droit, avec l'esprit le plus simple ;
    c'est, je crois, pour cette raison qu'on le nommait Candide.  Les
    anciens domestiques de la maison soupçonnaient qu'il était fils
    de la sœur de monsieur le baron et d'un bon et honnête
    gentilhomme du voisinage, que cette demoiselle ne voulut jamais
    épouser parce qu'il n'avait pu prouver que soixante et onze
    quartiers, et que le reste de son arbre généalogique avait été
    perdu par l'injure du temps.
  }
  \paragraph {
    Monsieur le baron était un des plus puissants seigneurs de la
    Westphalie, car son château avait une porte et des fenêtres.  Sa
    grande salle même était ornée d'une tapisserie.  Tous les chiens
    de ses basses-cours composaient une meute dans le besoin ; ses
    palefreniers étaient ses piqueurs; le vicaire du village était
    son grand-aumônier.  Ils l'appelaient tous monseigneur, et ils
    riaient quand il faisait des contes.
  }
}
</pre>
<p>
 <a href="../71/lily-abf5e616.ly">
  <img align="middle"
    border="0" src="../71/lily-abf5e616.png" alt="[image of music]">
 </a>
</p>

   <p><a name="ottava-text.ly"></a>

<h3 class="unnumberedsec">Ottava text</h3>

<p>Internally, the <code>set-octavation</code> function sets the properties
<code>ottavation</code> (for example, to <code>"8va"</code> or <code>"8vb"</code>)
and <code>middleCPosition</code>.  To override the text of the bracket, set
<code>ottavation</code> after invoking <code>set-octavation</code>.

<pre class="verbatim">
{
  \ottava #1
  \set Staff.ottavation = #"8"
  c''1
  \ottava #0
  c'1
  \ottava #1
  \set Staff.ottavation = #"Text"
  c''1
}
</pre>
<p>
 <a href="../f1/lily-d72a333b.ly">
  <img align="middle"
    border="0" src="../f1/lily-d72a333b.png" alt="[image of music]">
 </a>
</p>

   <p><a name="outputting-the-version-number.ly"></a>

<h3 class="unnumberedsec">Outputting the version number</h3>

<p>By putting the output of <code>lilypond-version</code> into a lyric or a
text markup, it is possible to print the version number of LilyPond in
a score, or in a document generated with <code>lilypond-book</code>.

<pre class="verbatim">
\score {
  \new Lyrics {
    \override Score.RehearsalMark #'self-alignment-X = #LEFT
    \mark #(ly:export (string-append "Processed with LilyPond version "
                       (lilypond-version)))
    s2
  }
}
</pre>
<p>
 <a href="../98/lily-cd5a4c11.ly">
  <img align="middle"
    border="0" src="../98/lily-cd5a4c11.png" alt="[image of music]">
 </a>
</p>

   <p><a name="piano-template-with-centered-lyrics.ly"></a>

<h3 class="unnumberedsec">Piano template with centered lyrics</h3>

<p>Instead of having a full staff for the melody and lyrics, lyrics can be
centered between the staves of a piano staff.

<pre class="verbatim">
upper = \relative c'' {
  \clef treble
  \key c \major
  \time 4/4
  
  a4 b c d  
}

lower = \relative c {
  \clef bass
  \key c \major
  \time 4/4
  
  a2 c  
}

text = \lyricmode {
  Aaa Bee Cee Dee
}

\score {
  \new GrandStaff &lt;&lt;
    \new Staff = upper { \new Voice = "singer" \upper }
    \new Lyrics \lyricsto "singer" \text
    \new Staff = lower { \lower }
  >>
  \layout {
    \context {
      \GrandStaff
      \accepts "Lyrics"
    }
    \context {
      \Lyrics
      \consists "Bar_engraver"
    }
  }
  \midi { }
}
</pre>
<p>
 <a href="../37/lily-c18abd8d.ly">
  <img align="middle"
    border="0" src="../37/lily-c18abd8d.png" alt="[image of music]">
 </a>
</p>

   <p><a name="printing-marks-at-the-end-of-a-line-or-a-score.ly"></a>

<h3 class="unnumberedsec">Printing marks at the end of a line or a score</h3>

<p>Marks can be printed at the end of the current line, instead of the
beginning of the following line. This is particularly useful when a
mark has to be added at the end of a score &ndash; when there is no next
line.

   <p>In such cases, the right end of the mark has to be aligned with the
final bar line, as demonstrated on the second line of this example.

<pre class="verbatim">
\relative c'' {  
  \override Score.RehearsalMark  #'break-visibility = #begin-of-line-invisible
  g2 c
  d,2 a'
  \mark \default
  \break
  
  \override Score.RehearsalMark #'self-alignment-X = #RIGHT
  g2 b,
  c1 \bar "||"
  \mark "D.C. al Fine"
}
</pre>
<p>
 <a href="../42/lily-9f469508.ly">
  <img align="middle"
    border="0" src="../42/lily-9f469508.png" alt="[image of music]">
 </a>
</p>

   <p><a name="printing-marks-on-every-staff.ly"></a>

<h3 class="unnumberedsec">Printing marks on every staff</h3>

<p>Although text marks are normally only printed above the topmost staff,
they may also be printed on every staff.

<pre class="verbatim">
{
  \new Score \with {
    \remove "Mark_engraver"
  }
  &lt;&lt;
    \new Staff \with {
      \consists "Mark_engraver"
    }
    { c''1 \mark "molto" c'' }
    \new Staff \with {
      \consists "Mark_engraver"
    }
    { c'1 \mark "molto" c' }
  >>
}
</pre>
<p>
 <a href="../f6/lily-86a87143.ly">
  <img align="middle"
    border="0" src="../f6/lily-86a87143.png" alt="[image of music]">
 </a>
</p>

   <p><a name="three-sided-box.ly"></a>

<h3 class="unnumberedsec">Three-sided box</h3>

<p>This example shows how to add a markup command to get a three sided box
around some text (or other markup).

<pre class="verbatim">
% New command to add a three sided box, with sides north, west and south
% Based on the box-stencil command defined in scm/stencil.scm
% Note that you use ";" to comment a line in Scheme
#(define-public (NWS-box-stencil stencil thickness padding)
  "Add a box around STENCIL, producing a new stencil."
  (let* ((x-ext (interval-widen (ly:stencil-extent stencil 0) padding))
	 (y-ext (interval-widen (ly:stencil-extent stencil 1) padding))
	 (y-rule (make-filled-box-stencil (cons 0 thickness) y-ext))
	 (x-rule (make-filled-box-stencil
		  (interval-widen x-ext thickness) (cons 0 thickness))))
;    (set! stencil (ly:stencil-combine-at-edge stencil X 1 y-rule padding))
    (set! stencil (ly:stencil-combine-at-edge stencil X -1 y-rule padding))
    (set! stencil (ly:stencil-combine-at-edge stencil Y 1 x-rule 0.0))  
    (set! stencil (ly:stencil-combine-at-edge stencil Y -1 x-rule 0.0))
    stencil))

% The corresponding markup command, based on the \box command defined 
% in scm/define-markup-commands.scm
#(define-markup-command (NWS-box layout props arg) (markup?)
  "Draw a box round @var{arg}.  Looks at @code{thickness},
@code{box-padding} and @code{font-size} properties to determine line
thickness and padding around the markup."
  
  (let* ((th (chain-assoc-get 'thickness props  0.1))
	 (size (chain-assoc-get 'font-size props 0))
	 (pad (* (magstep size)
		 (chain-assoc-get 'box-padding props 0.2)))
	 (m (interpret-markup layout props arg)))
    (NWS-box-stencil m th pad)))


% Test it:

\layout { ragged-right = ##f }

\relative c' { 
  c2^\markup { \NWS-box ABCD }
  c^\markup { \NWS-box \note #"4" #1.0 } 
}
</pre>
<p>
 <a href="../ea/lily-0cb168f8.ly">
  <img align="middle"
    border="0" src="../ea/lily-0cb168f8.png" alt="[image of music]">
 </a>
</p>

   <p><a name="utf-8.ly"></a>

<h3 class="unnumberedsec">UTF-8</h3>

<p>Various scripts may be used for texts (like titles and
lyrics) by entering them in UTF-8 encoding, and using a Pango based
backend.  Depending on the fonts installed, this fragment will
render Bulgarian (Cyrillic), Hebrew, Japanese and Portuguese.

<pre class="verbatim">
% end verbatim - this comment is a hack to prevent texinfo.tex
% from choking on non-European UTF-8 subsets
% Cyrillic font
bulgarian = \lyricmode {
  Жълтата дюля беше щастлива, че пухът, който цъфна, замръзна като гьон.
}

hebrew = \lyricmode {
  זה כיף סתם לשמוע איך תנצח קרפד עץ טוב בגן.
}

japanese = \lyricmode {
  いろはにほへど ちりぬるを
  わがよたれぞ  つねならむ
  うゐのおくや  まけふこえて
  あさきゆめみじ ゑひもせず
}

% "a legal song to you"
portuguese = \lyricmode {
  à vo -- cê uma can -- ção legal
}

\relative  {
  c2 d
  e2 f
  g2 f
  e1
}
\addlyrics { \bulgarian }
\addlyrics { \hebrew }
\addlyrics { \japanese }
\addlyrics { \portuguese }
</pre>
<p>
 <a href="../48/lily-0b3aec49.ly">
  <img align="middle"
    border="0" src="../48/lily-0b3aec49.png" alt="[image of music]">
 </a>
</p>

   <p><a name="vocal-ensemble-template-with-lyrics-aligned-below-and-above-the-staves.ly"></a>

<h3 class="unnumberedsec">Vocal ensemble template with lyrics aligned below and above the staves</h3>

<p>This template is basically the same as the simple "Vocal ensemble"
template, with the exception that here all the lyrics lines are placed
using <code>alignAboveContext</code> and <code>alignBelowContext</code>.

<pre class="verbatim">
global = {
  \key c \major
  \time 4/4
}

sopMusic = \relative c'' {
  c4 c c8[( b)] c4
}
sopWords = \lyricmode {
  hi hi hi hi
}

altoMusic = \relative c' {
  e4 f d e
}
altoWords = \lyricmode {
  ha ha ha ha
}

tenorMusic = \relative c' {
  g4 a f g
}
tenorWords = \lyricmode {
  hu hu hu hu
}

bassMusic = \relative c {
  c4 c g c
}
bassWords = \lyricmode {
  ho ho ho ho
}

\score {
  \new ChoirStaff &lt;&lt;
    \new Staff = women &lt;&lt;
      \new Voice = "sopranos" { \voiceOne &lt;&lt; \global \sopMusic >> }
      \new Voice = "altos" { \voiceTwo &lt;&lt; \global \altoMusic >> }
    >>
    \new Lyrics \with { alignAboveContext = women } \lyricsto sopranos \sopWords
    \new Lyrics \with { alignBelowContext = women } \lyricsto altos \altoWords
    % we could remove the line about this with the line below, since we want
    % the alto lyrics to be below the alto Voice anyway.
    % \new Lyrics \lyricsto altos \altoWords
    
    \new Staff = men &lt;&lt;
      \clef bass
      \new Voice = "tenors" { \voiceOne &lt;&lt; \global \tenorMusic >> }
      \new Voice = "basses" { \voiceTwo &lt;&lt; \global \bassMusic >> }
    >>
    \new Lyrics \with { alignAboveContext = men } \lyricsto tenors \tenorWords
    \new Lyrics \with { alignBelowContext = men } \lyricsto basses \bassWords
    % again, we could replace the line above this with the line below.
    % \new Lyrics \lyricsto basses \bassWords
  >>
  \layout {
    \context {
      % a little smaller so lyrics
      % can be closer to the staff
      \Staff
      \override VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3)
    }
  }
}
</pre>
<p>
 <a href="../f3/lily-a11d4879.ly">
  <img align="middle"
    border="0" src="../f3/lily-a11d4879.png" alt="[image of music]">
 </a>
</p>

   <!-- footer_tag --><br><hr>
<div class="node">
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Vocal-music.html#Vocal-music">Vocal music</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Editorial-annotations.html#Editorial-annotations">Editorial annotations</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
</div>

<div style="background-color: #e8ffe8; padding: 2; border: #c0ffc0 1px solid;">
<p>
<font size="-1">
This page is for LilyPond-2.11.57 (development-branch).
<br>
<address>
Report errors to <a href="http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs">http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs</a>. </address>
<br>
Your <a href="http://lilypond.org/web/devel/participating/documentation-adding">suggestions for the documentation</a> are welcome.
</font>
</p>
</div>

</BODY></html>