]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/tutorial.itely
* scripts/convert-ly.py (conv): remove \lyrics from \lyricsto.
[lilypond.git] / Documentation / user / tutorial.itely
1 @c -*-texinfo-*-
2 @c This file is part of lilypond.tely
3
4 @c TODO:
5 @c   * more details about running lilypond; error messages,
6 @c     compiling/viewing (emacs?)
7 @c   * where to go from First steps+More basics?
8
9 @c Your first LilyPond score in 10 minutes?
10
11 @node Tutorial
12 @chapter Tutorial
13
14 This tutorial starts with a short introduction to the LilyPond music
15 language.  After this first contact we will show you how to produce
16 printed output.  Then you will be able to create and print your own
17 sheets of music.
18
19 @ifhtml
20 Many people learn programs by trying and fiddling around with the
21 program.  This is also possible with LilyPond.  If you click on a
22 picture in the HTML version of this manual, you will see the exact
23 LilyPond input that was used to generate that image.
24 Try it on this image
25
26 @lilypond[fragment,quote,raggedright,relative=2]
27 c-\markup { \bold \huge { Click here.  } }
28 @end lilypond
29 @end ifhtml
30
31 By cutting and pasting the full input into a test file, you have a
32 starting template for experiments.  If you like learning in this way,
33 you will probably want to print out or bookmark
34 @ifhtml
35 the
36 @end ifhtml
37 @ref{Cheat sheet}, which is a table listing all commands for quick
38 reference.
39
40 @menu
41 * First steps::                 
42 * Running LilyPond::            
43 * More about pitches::          
44 * Entering ties::               
45 * Automatic and manual beams::  
46 * Octave entry::                
47 * Music expressions explained::  
48 * More staves::                 
49 * Adding articulation marks to notes::  
50 * Combining notes into chords::  
51 * Basic rhythmical commands::   
52 * Commenting input files::      
53 * Printing lyrics::             
54 * A lead sheet::                
55 * Listening to output::         
56 * Adding titles::               
57 * Single staff polyphony::      
58 * Piano staves::                
59 * Organizing larger pieces::    
60 * An orchestral part::          
61 * Integrating text and music::  
62 @end menu
63
64
65 @node First steps
66 @section First steps
67
68 The first example demonstrates how to enter the most elementary piece
69 of music, a scale.  A note can be entered by typing its name, from
70 @samp{a} through @samp{g}.  So, if you enter
71
72 @example
73 c d e f g a b
74 @end example
75
76 @noindent
77 the result looks like this
78
79 @lilypond[fragment,quote,notime,relative=1]
80 c d e f g a b
81 @end lilypond
82
83 The duration of a note is specified by a number after the note name.
84 @samp{1} for a @rglos{whole note}, @samp{2} for a @rglos{half note},
85 @samp{4} for a @rglos{quarter note} and so on
86
87 @example
88 a1 a2 a4 a16 a32
89 @end example
90
91 @c FIXME: have NOTIME also remove Score.timing?
92 @lilypond[fragment,quote,notime,relative=1]
93 \set Score.timing = ##f
94 \set Staff.autoBeaming = ##f
95 { a1 a2 a4 a16 a32 s16_" " }
96 @end lilypond
97
98 If you do not specify a @rglos{duration}, the duration last entered is
99 used for the next notes.  The duration of the first note in input
100 defaults to a quarter
101
102 @example
103 a a8 a a2 a
104 @end example
105
106 @lilypond[fragment,quote,notime,relative=1]
107 \set Score.timing = ##f
108 { a a8 a a2 a s16_" " }
109 @end lilypond
110
111
112 Rests are entered just like notes, but with the name @samp{r}
113
114 @cindex rests
115 @example
116 r2 r4 r8 r16
117 @end example
118
119 @lilypond[fragment,quote,notime]
120 \set Score.timing = ##f
121 r2 r4 r8 r16 s16_" "
122 @end lilypond
123
124 Add a dot @samp{.} after the duration to get a @rglos{dotted note}
125
126 @example
127 a2. a4 a8. a16
128 @end example
129
130 @lilypond[fragment,quote,notime,relative=1]
131 \set Score.timing = ##f
132 { a2. a4 a8. a16 s16_" " }
133 @end lilypond
134
135 The @rglos{meter} (or @rglos{time signature}) can be set with the
136 @code{\time} command
137
138 @example
139 \time 3/4
140 \time 6/8
141 \time 4/4
142 @end example
143
144 @c A clef here may lead to confusion, remove it.
145 @lilypond[fragment,quote]
146 \override Staff.Clef #'transparent = ##t 
147 \time 3/4
148 s4_" "
149 \time 6/8
150 s4_" "
151 \time 4/4
152 s16_" "
153 @end lilypond
154
155 The @rglos{clef} can be set using the @code{\clef} command
156
157 @c what is more common name treble or violin?
158 @c in Dutch, it is violin.
159 @c in English it is definitely treble.
160 @example
161 \clef treble
162 \clef bass
163 \clef alto
164 \clef tenor
165 @end example
166
167 @lilypond[fragment,quote,notime]
168 \set Score.timing = ##f
169 \clef violin
170 s4_" "
171 \clef bass
172 s4_" "
173 \clef alto
174 s4_" "
175 \clef tenor
176 s16_" "
177 @end lilypond
178
179
180 Remember to enclose the notes and commands in curly braces
181 @code{@{@tie{}@dots{}@tie{}@}} to convert it to printable output.
182
183 @lilypond[fragment,quote,noindent,linewidth=55\staffspace]
184 {
185   \time 3/4
186   \clef bass
187   c2 e4 g2.
188   f4 e d c2 r4
189 }
190 @end lilypond
191
192 For more elaborate information on
193
194 @quotation
195 @table @asis
196 @item Entering pitches and durations
197 see 
198 @ref{Pitches}, and @ref{Durations}.
199 @item Clefs
200 see @ref{Clef}.
201 @item Rests
202 see @ref{Rests}.  
203 @item Time signatures and other timing commands
204 see @ref{Time signature}.
205 @end table
206 @end quotation
207
208
209 @node Running LilyPond
210 @section Running LilyPond
211
212 @c FIXME: let's not be so casual about Emacs and VIM, but rather
213 @c instruct (how) to use them; let advanced user figure-out what
214 @c commands to type?
215
216 @c
217 @c We don't have enough space to explain either VIM
218 @c or Emacs non-advanced users, and I fear that both editors will only
219 @c confuse newbies. I vote for keeping the material in footnotes.
220 @c 
221 @c --hwn 
222
223 In the last section we explained what kind of things you could enter
224 in a LilyPond file.  In this section we will explain what commands to
225 run and how to view or print the output.  If you have not used
226 LilyPond before, want to test your setup, or want to run an example
227 file yourself, read this section.  The instructions that follow are
228 for Unix-like systems.  Some additional instructions for Microsoft
229 Windows are given at the end of this section.
230
231 Begin by opening a terminal window and starting a text editor.  For
232 example, you could open an xterm and execute
233 @code{joe}.@footnote{There are macro files for VIM addicts, and there
234 is a @code{LilyPond-mode} for Emacs addicts.  If it has not been
235 installed already, refer to
236 @c FIXME lousy reference.
237 the file @file{INSTALL.txt}.}  In your text editor, enter the following
238 input and save the file as @file{test.ly}
239
240 @example
241 @{ c'4 e' g' @}
242 @end example
243
244 @noindent
245 To process @file{test.ly}, proceed as follows
246
247 @example
248 lilypond test.ly
249 @end example
250
251 @noindent
252 You will see something resembling
253
254 @example
255 lilypond (GNU LilyPond) 2.2.0
256 Running lilypond...
257 Now processing `/home/fred/ly/test.ly'
258 Parsing...
259 Interpreting music...[1]
260 @emph{... more interesting stuff ... }
261 DVI output to `test.dvi'...
262 PDF output to `test.pdf'...
263 PS output to `test.ps'...
264 @end example
265
266 @cindex DVI file
267 @cindex Viewing music
268 @cindex xdvi
269 @noindent
270 The result is the file @file{test.pdf}@footnote{For @TeX{}
271 aficionados: there is also a @file{test.dvi} file.  It can be viewed
272 with @code{xdvi}.  The DVI uses a lot of PostScript specials, which do
273 not show up in the magnifying glass.  The specials also mean that the
274 DVI file cannot be processed with @code{dvilj}.  Use @code{dvips} for
275 printing.
276 @cindex dvips
277 @cindex dvilj
278 @cindex DVI driver
279 } which you can print or with the standard facilities of your
280 operating system.@footnote{If your system does not have any tools
281 installed, you can try @uref{http://www.cs.wisc.edu/~ghost/,Ghostscript}, a freely available package for
282 viewing and printing PDF and PostScript files.}
283
284 On Windows, start up a text-editor@footnote{Any simple or
285 programmer-oriented editor will do, for example Notepad.  Do not use a
286 word processor, its formatting codes will confuse LilyPond.} and enter
287
288 @example
289 @{ c'4 e' g' @}
290 @end example
291
292 Save it on the desktop as @file{test.ly} and make sure that it is not
293 called @file{test.ly.TXT}.  Double clicking @file{test.ly} will process
294 the file and show the resulting PDF file.
295
296
297 @node More about pitches
298 @section More about pitches 
299
300 A @rglos{sharp} (@texisharp{}) pitch is made by adding @samp{is} to
301 the name, a @rglos{flat} (@texiflat{}) pitch by adding @samp{es}.  As
302 you might expect, a @rglos{double sharp} or @rglos{double flat} is
303 made by adding @samp{isis} or @samp{eses}@footnote{This syntax
304 derived from note naming conventions in Nordic and Germanic languages,
305 like German and Dutch.}
306
307 @example
308 cis1 ees fisis aeses
309 @end example
310
311 @lilypond[fragment,quote,notime]
312 \set Score.timing = ##f
313 \transpose c c' { cis1 ees fisis aeses s16_" " }
314 @end lilypond
315
316 @cindex key signature, setting
317 The key signature is set with the command @code{\key}, followed by
318 a pitch and @code{\major} or @code{\minor}
319
320 @example
321 \key d \major
322 g1
323 \key c \minor
324 g
325 @end example
326
327 @lilypond[fragment,quote,notime,fragment]
328 \key d \major
329 g'1
330 \key c \minor
331 g'
332 @end lilypond
333
334 @noindent
335 Key signatures together with the pitches (including alterations) are
336 used to determine when to print accidentals.  This is a
337 feature that often causes confusion to newcomers, so let us explain it
338 in more detail.
339
340
341 LilyPond makes a sharp distinction between musical content and
342 layout.  The alteration (flat, natural or sharp) of a note is part of
343 the pitch, and is therefore musical content.  Whether an accidental (a
344 flat, natural or sharp @emph{sign}) is printed in front of the
345 corresponding note is a question of layout.  Layout is something that
346 follows rules, so accidentals are printed automatically according to
347 those rules.  The pitches in your music are works of art, so they will
348 not be added automatically, and you must enter what you want to hear.
349
350 In this example
351
352 @lilypond[quote,notime,fragment]
353 \key d \major
354 d' cis' fis'
355 @end lilypond
356
357 @noindent
358 no note gets an explicit accidental, but you still must enter
359
360 @example
361 \key d \major
362 d cis fis
363 @end example
364
365 @noindent
366 The code @samp{d} does not mean `print a black dot just below the
367 staff.'  Rather, it means: `a note with pitch D-natural.'  In the key
368 of A-flat, it does get an accidental
369
370 @lilypond[quote,notime,fragment]
371 \key as \major
372 d'
373 @end lilypond
374
375 @example
376 \key as \major
377 d
378 @end example
379
380 Adding all alterations explicitly might require a little more effort
381 when typing, but the advantage is that transposing is easier, and
382 music can be printed according to different conventions.  See
383 @ref{Accidentals}, for some examples how accidentals can be printed
384 according to different rules.
385
386
387 For more information on
388
389 @quotation
390 @table @asis
391 @item Accidentals
392 see @ref{Accidentals}.
393
394 @item Key signature
395 see @ref{Key signature}.
396 @end table
397 @end quotation
398
399 @node Entering ties
400 @section Entering ties
401
402 @cindex tie
403 A tie is created by appending a tilde @samp{~} to the first note
404 being tied
405
406 @lilypond[quote,notime,fragment,verbatim,relative=3]
407 g4~ g a2~ a4
408 @end lilypond
409
410 For more information on Ties see @ref{Ties}.
411
412
413
414 @node Automatic and manual beams
415 @section Automatic and manual beams
416
417 @cindex beams, by hand 
418 Beams are drawn automatically
419
420 @lilypond[quote,fragment,relative=2,verbatim]
421 a8 ais d es r d
422 @end lilypond
423
424 @noindent
425 If you do not like where beams are put, they can be entered by
426 hand.  Mark the first note to be beamed with @samp{[} and the last one
427 with @samp{]}.
428
429 @lilypond[quote,fragment,relative=2,verbatim]
430 a8[ ais] d[ es r d]
431 @end lilypond
432
433 For more information on beams, see @ref{Beaming}.
434
435
436 Here are key signatures, accidentals and ties in action
437
438 @example
439 @{
440   \time 4/4
441   \key g \minor
442   \clef violin
443   r4 r8 a8 gis4 b
444   a8 d4.~ d e8
445   fis4 fis8 fis8 eis4 a8 gis~
446   gis2 r2
447 @}
448 @end example
449
450 @ignore
451 FIXME
452 ugr: removing the ignore block, leaving the comment line below
453 @c TODO: use relative mode, verbatim, junk \transpose and above @example
454 @end ignore
455
456
457 @lilypond[fragment,quote,noindent,linewidth=50\staffspace]
458 \transpose c c' {
459   \time 4/4
460   \key g \minor
461   \clef violin
462   r4 r8 a8 gis4 b
463   a8 d4.~ d e8
464   fis4 fis8 fis8 eis4 a8 gis~
465   gis2 r2
466 }
467 @end lilypond
468
469 @cindex accidentals
470
471
472 @noindent
473 There are some interesting points to note in this example.  Bar lines
474 and beams are drawn automatically.  Line breaks are calculated
475 automatically; it does not matter where the line breaks are in the
476 source file.  Finally, the order in which time, key and clef changes
477 are entered is not relevant: in the printout, these are ordered
478 according to standard notation conventions.
479
480
481
482 @node Octave entry
483 @section Octave entry
484
485
486 @c Tim wants to move this quotes example just before the: quotes-do not-work
487 @c score, but we'd need to remove quotes from the other two (key and
488 @c tie) examples...
489
490 @c better to have this just before the `octaves are bad' snipped
491 @c but we'd need to remove the ', from \key and tie 
492 To raise a note by an octave, add a high quote @code{'} (apostrophe) to
493 the note name, to lower a note one octave, add a `low quote' @code{,}
494 (a comma).  Middle C is @code{c'}
495
496 @example
497 c'4 c'' c''' \clef bass c c,
498 @end example
499
500 @lilypond[quote,notime,fragment]
501 c'4 c'' c''' \clef bass c c,
502 @end lilypond
503
504 An example of the use of quotes is in the following Mozart fragment
505
506 @lilypond[quote,raggedright,fragment,verbatim]
507 \key a \major
508 \time 6/8
509 cis''8. d''16 cis''8 e''4 e''8
510 b'8. cis''16 b'8 d''4 d''8 
511 @end lilypond
512
513 @noindent
514 The last example shows that music in a high register needs lots of quotes.
515 This makes the input less readable, and it is a source of errors.  The
516 solution is to use `relative octave' mode.  In practice, this is the
517 most convenient way to copy existing music.  To use relative mode, add
518 @code{\relative} before the piece of music.
519 @ignore
520 FIXME: move to notation manual?
521  You must also give a note
522 from which relative mode starts, in this case @code{c''}.
523 @end ignore
524 If you do not
525 use octavation quotes (i.e., do not add @code{'} or @code{,} after a
526 note), relative mode chooses the note that is closest to the previous
527 one.  For example, @samp{c f} goes up while @samp{c g} goes down
528
529 @lilypond[quote,notime,fragment,verbatim]
530 \relative {
531   c' f c g c
532 }
533 @end lilypond
534
535
536 Since most music has small intervals, pieces can be written almost
537 without octavation quotes in relative mode.  The previous example is
538 entered as
539
540 @lilypond[quote,raggedright,fragment,verbatim]
541 \relative {
542   \key a \major
543   \time 6/8
544   cis''8. d16 cis8 e4 e8
545   b8. cis16 b8 d4 d8
546 }
547 @end lilypond
548
549 @c needed better, maybe even redundant explanation
550 @c   added another example below.
551 @c grappig: Pa vond het heel logies, en slim toen-i eenmaal begreep.
552 @c in eerste instantie drong het `relative' niet door zonder extra uitleg.
553 Larger intervals are made by adding octavation quotes.
554
555 @lilypond[quote,notime,verbatim,fragment]
556 \relative c {
557   c'' f, f c' c g' c,
558 }
559 @end lilypond
560
561 In summary, quotes or commas no longer determine the absolute height
562 of a note in @code{\relative} mode.  Rather, the height of a note is
563 relative to the previous one, and changing the octave of a single note
564 shifts all following notes an octave up or down.
565
566 For more information on Relative octaves see @ref{Relative octaves},
567 and @ref{Octave check}.
568
569
570 @node Music expressions explained
571 @section Music expressions explained
572
573
574 In input files, music is represent by so-called @emph{music
575 expression}.  We have already seen in the previous examples; 
576 a single note is a music expression
577
578 @lilypond[fragment,quote,verbatim,relative=3]
579 a4
580 @end lilypond
581
582 Enclosing group of notes in braces creates a new music
583 expression
584
585 @lilypond[fragment,quote,verbatim,relative=3]
586 { a4 g4 }
587 @end lilypond
588
589 Putting a bunch of music expressions (notes) in braces, means that
590 they should be played in sequence.  The result again is a music
591 expression, which can be grouped with other expressions sequentially.
592 Here, the expression from the previous example is combined with two
593 notes
594
595 @lilypond[fragment,quote,verbatim,relative=3]
596 { { a4 g } f g } 
597 @end lilypond
598
599 This technique is useful for non-monophonic music.  To enter music
600 with more voices or more staves, we also combine expressions in
601 parallel.  Two voices that should play at the same time, are entered
602 as a simultaneous combination of two sequences.  A `simultaneous'
603 music expression is formed by enclosing expressions in @code{<<} and
604 @code{>>}.  In the following example, three sequences (all containing
605 two notes) are combined simultaneously
606
607 @lilypond[fragment,quote,verbatim,relative=3]
608 <<
609    { a4 g }
610    { f e }
611    { d b }
612 >>
613 @end lilypond
614
615 This mechanism is similar to mathematical
616 formulas: a big formula is created by composing small formulas.  Such
617 formulas are called expressions, and their definition is recursive, so
618 you can make arbitrarily complex and large expressions.  For example,
619
620 @example
621 1
622
623 1 + 2
624
625 (1 + 2) * 3
626
627 ((1 + 2) * 3) / (4 * 5)
628 @end example
629
630 @cindex expression
631 @cindex music expression
632 This example shows a sequence of expressions, where each expression is
633 contained in the next one.  The simplest expressions are numbers and
634 operators (like @samp{+}, @samp{*} and @samp{/}).  Parentheses are used
635 to group expressions.
636
637 Like mathematical expressions, music expressions can be nested
638 arbitrarily deep@footnote{The reason for getting three staves in the
639 previous example but just a single staff in the current one will be
640 explained later.}
641
642 @lilypond[fragment,quote,verbatim,relative=2] 
643 {
644   c <<c e>>
645   << { e f } { c <<b d>> } >>
646 }
647 @end lilypond
648
649
650 @cindex indent
651 When spreading expressions over multiple lines, it is customary to use
652 an indent that indicates the nesting level.  Formatting music like this
653 eases reading, and helps you insert the right number of closing
654 braces at the end of an expression.  For example,
655
656 @example
657 \book @{
658   \score @{
659     <<
660       @{
661         @dots{}
662       @}
663       @{
664         @dots{}
665       @}
666       \paper @{
667         @dots{}
668       @}
669     >>
670   @}
671 @}  
672 @end example
673
674 Some editors have special support for entering LilyPond, and can help
675 indenting source files.  See @ref{Editor support}, for more information.
676
677 @node More staves
678 @section More staves
679
680 To print more than one staff, each piece of music that makes up a
681 staff is marked by adding @code{\new Staff} before it.  These
682 @code{Staff} elements are then combined parallel with @code{<<} and
683 @code{>>}, as demonstrated here
684
685 @lilypond[quote,fragment,verbatim]
686 <<
687   \new Staff { \clef violin c'' }
688   \new Staff { \clef bass c }
689 >>
690 @end lilypond
691
692
693 The command @code{\new} introduces a `notation context.'  A notation
694 context is an environment in which musical events (like notes or
695 @code{\clef} commands) are interpreted.  For simple pieces, such
696 notation contexts are created implicitly.  For more complex pieces, it
697 is best to mark contexts explicitly.  This ensures that each fragment
698 gets its own stave.
699
700 There are several types of contexts: @code{Staff}, @code{Voice} and
701 @code{Score} handle normal music notation.  Other contexts are also
702 @code{Lyrics} (for setting lyric texts) and @code{ChordNames} (for
703 printing chord names).
704
705
706 In terms of syntax, prepending @code{\new} to a music expression
707 creates a bigger music expression.  In this way it resembles the minus
708 sign in mathematics.  The formula @math{(4+5)} is an expression, so
709 @math{-(4+5)} is a bigger expression.
710
711 We can now typeset a melody with two staves
712
713 @c TODO: (c) status of this Paul McCartney (?) song (let's all stand together)
714
715 @lilypond[fragment,quote,verbatim,raggedright]
716 <<
717   \new Staff {
718     \time 3/4
719     \clef violin
720     \relative {
721       e''2 d4 c2 b4 a8[ a]
722       b[ b] g[ g] a2. }  
723   }
724   \new Staff {
725      \clef bass
726      c2 e4 g2.
727      f4 e d c2.
728   }
729 >>
730 @end lilypond
731
732 For more information on context see the description in
733 @ref{Interpretation contexts}.
734
735
736
737 @node Adding articulation marks to notes
738 @section Adding articulation marks to notes
739
740 @cindex articulation
741 @cindex accents
742 @cindex staccato
743
744 Common accents can be added to a note using a dash (@samp{-}) and a
745 single character
746
747 @lilypond[fragment,quote,verbatim,relative=2]
748 c-.  c-- c-> c-^ c-+ c-_
749 @end lilypond
750
751 @cindex fingering
752 Similarly, fingering indications can be added to a note using a dash
753 (@samp{-}) and the digit to be printed
754
755 @lilypond[fragment,quote,verbatim,relative=2]
756 c-3 e-5 b-2 a-1
757 @end lilypond
758
759
760 Dynamic signs are made by adding the markings (with a backslash) to
761 the note
762
763 @lilypond[fragment,quote,verbatim,relative=2]
764 c\ff c\mf
765 @end lilypond
766
767 @cindex dynamics
768 @cindex decrescendo
769 @cindex crescendo
770
771 Crescendi and decrescendi are started with the commands @code{\<} and
772 @code{\>}.  An ending dynamic, for example @code{\f}, will finish the
773 crescendo, or the command @code{\!} can be used
774
775 @lilypond[fragment,quote,verbatim,relative=2]
776 c2\< c2\ff\> c2 c2\!
777 @end lilypond
778
779
780
781 @cindex slur
782
783 A slur is a curve drawn across many notes, and indicates legato
784 articulation.  The starting note and ending note are marked with
785 @samp{(} and @samp{)}, respectively
786
787 @lilypond[fragment,quote,fragment,relative=2,verbatim]
788 d4( c16)( cis d e c cis d e)( d4)
789 @end lilypond
790
791 @cindex slurs versus ties
792 A slur looks like a tie, but it has a different meaning.  A tie simply
793 makes the first note sound longer, and can only be used on pairs of
794 notes with the same pitch.  Slurs indicate the articulations of notes,
795 and can be used on larger groups of notes.  Slurs and ties are also
796 nested in practice
797
798 @lilypond[quote,fragment,relative=2]
799 c2~( c8 fis fis4 ~ fis2 g2)
800 @end lilypond
801
802 @cindex phrasing slurs
803 Slurs to indicate phrasing can be entered with @code{\(} and
804 @code{\)}, so you can have both legato slurs and phrasing slurs at the
805 same time.
806
807 @lilypond[quote,fragment,relative=2,verbatim]
808 a8(\( ais b c) cis2 b'2 a4 cis, c\)
809 @end lilypond
810
811
812 For more information on
813
814 @quotation
815 @table @asis
816 @item Fingering
817 see @ref{Fingering instructions}.
818 @item Articulations
819 see @ref{Articulations}.
820 @item Slurs
821 see @ref{Slurs}.
822 @item Phrasing slurs
823 see @ref{Phrasing slurs}.
824 @item Dynamics
825 see @ref{Dynamics}.
826 @end table
827 @end quotation
828
829
830 @node Combining notes into chords
831 @section Combining notes into chords
832
833 @cindex chords
834 Chords can be made by surrounding pitches with angle brackets.
835 Angle brackets are the symbols @samp{<} and @samp{>}.
836
837 @lilypond[quote,relative=1,fragment,verbatim]
838 r4 <c e g>4 <c f a>8
839 @end lilypond
840
841
842 You can combine markings like beams and ties with chords.  They must
843 be placed outside the angled brackets
844
845 @lilypond[quote,relative=1,fragment,verbatim]
846 r4 <c e g>8[ <c f a>]~ <c f a>
847 @end lilypond
848
849 @example
850 r4 <c e g>8\>( <c e g> <c e g> <c f a>8\!)
851 @end example
852
853 @lilypond[quote,relative=1,fragment]
854 \slurUp
855 r4 <c e g>8\>( <c e g> <c e g> <c f a>8\!)
856 @end lilypond
857
858
859
860
861 @node Basic rhythmical commands
862 @section Basic rhythmical commands
863
864 @cindex pickup
865 @cindex anacruse
866 @cindex partial measure
867 A pickup is entered with the keyword @code{\partial}.  It
868 is followed by a duration: @code{\partial 4} is a quarter note upstep
869 and @code{\partial 8} an eighth note
870
871 @lilypond[quote,relative=2,verbatim,fragment]
872 \partial 8
873 f8 c2 d e
874 @end lilypond
875
876 @cindex tuplets
877 @cindex triplets
878 Tuplets are made with the @code{\times} keyword.  It takes two
879 arguments: a fraction and a piece of music.  The duration of the piece
880 of music is multiplied by the fraction.  Triplets make notes occupy
881 2/3 of their notated duration, so a triplet has 2/3 as its fraction
882
883 @lilypond[quote,relative=1,verbatim,fragment]
884 \times 2/3 { f8 g a }
885 \times 2/3 { c r c }
886 @end lilypond
887
888 @cindex grace notes
889 @cindex acciaccatura
890 Grace notes are also made by prefixing a music expression with the
891 keyword @code{\appoggiatura} or @code{\acciaccatura}
892 @cindex appoggiatura
893 @cindex acciaccatura
894
895 @lilypond[quote,relative=2,verbatim,fragment]
896 c4 \appoggiatura b16 c4
897 c4 \acciaccatura b16 c4
898 @end lilypond
899
900 @noindent
901
902 For more information on
903
904 @quotation
905 @table @asis
906 @item Grace notes
907 see @ref{Grace notes},
908 @item Tuplets
909 see @ref{Tuplets},
910 @item Pickups
911 see @ref{Partial measures}.
912 @end table
913 @end quotation
914
915
916 @node Commenting input files
917 @section Commenting input files
918
919 @cindex comments
920 @cindex line comment
921 @cindex block comment
922 A comment is a remark for the human reader of the music input; it is
923 ignored and has no effect on the printed output.  There are two types
924 of comments.  The percent symbol @samp{%} introduces a line comment;
925 the rest of the line is ignored.  A block comments marks a whole
926 section of music input---anything that is enclosed in @code{%@{} and
927 @code{%@}} is ignored.  The following fragment shows possible uses for
928 comments
929
930 @example
931 % notes for twinkle twinkle follow
932 c4 c g' g a a
933
934 %@{
935     This line, and the notes below
936     are ignored, since they are in a
937     block comment.
938
939     g g f f e e d d c2 
940 %@}
941 @end example
942
943 There is a special statement that really is a kind of comment.  The
944 version statement marks for which version of LilyPond the file was
945 written.  To mark a file for version 2.1.17, use
946
947 @example
948 \version "2.1.17"
949 @end example
950
951 @noindent
952 These annotations make future upgrades of LilyPond go more
953 smoothly. Changes in the syntax are handled with a special program,
954 @file{convert-ly} (see @ref{Invoking convert-ly}), and it uses
955 @code{\version} to determine what rules to apply.
956
957
958 @node Printing lyrics
959 @section Printing lyrics
960 @cindex lyrics
961
962 @c TODO: (c) status of the Queen fragment.
963
964 @cindex Lyrics
965 @cindex Songs
966 Lyrics are entered by separating each syllable with a space
967
968 @example
969 I want to break free
970 @end example
971
972 Consider the melody
973
974 @lilypond[quote,verbatim,fragment,raggedright]
975 \relative {
976     r4 c \times 2/3 { f g g }
977     \times 2/3 { g4( a2) }
978 }
979 @end lilypond
980
981 @c FIXME: when/how/to what rename newlyrics?
982 The lyrics can be set to these notes, combining both with the
983 @code{\newlyrics} keyword
984
985 @lilypond[quote,verbatim,fragment,raggedright]
986 <<
987   \relative {
988     r4 c \times 2/3 { f g g }
989     \times 2/3 { g4( a2) }
990   }
991   \newlyrics { I want to break free }
992 >>
993 @end lilypond
994
995 @cindex melisma
996 @cindex extender line
997 @c synonyms?
998 This melody ends on a @rglos{melisma}, a single syllable (`free')
999 sung to more than one note.  This is indicated with an @emph{extender
1000 line}.  It is entered as two underscores, i.e.,
1001
1002 @example
1003 @{ I want to break free __ @}
1004 @end example 
1005
1006 @lilypond[fragment,quote,raggedright]
1007 <<
1008   \relative {
1009     r4 c \times 2/3 { f g g }
1010     \times 2/3 { g4( a2) }
1011   }
1012   \newlyrics { I want to break free __ }
1013 >>
1014 @end lilypond
1015
1016 Similarly, hyphens between words can be entered as two dashes,
1017 resulting in a centered hyphen between two syllables
1018
1019 @example
1020 Twin -- kle twin -- kle
1021 @end example
1022
1023 @lilypond[fragment,quote,raggedright]
1024 <<
1025   \relative {
1026      \time 2/4
1027      f4 f c' c
1028    }
1029    \newlyrics { Twin -- kle twin -- kle }
1030 >>
1031 @end lilypond
1032
1033 More options, like putting multiple lines of lyrics below a melody are
1034 discussed in @ref{Vocal music}.
1035
1036 @c FIXME: too geeky, for notation manual?
1037 @c or introduce using foo = \lyrics { a b c } ?
1038
1039 When using variables for a piece of lyrics
1040 To prevent certain words (for example `as') as being read as a
1041 pitch, the input-mode must be switched.  This is done with
1042 @code{\lyrics}.  In @code{\lyrics} mode, all words are read as lyric
1043 syllables.
1044
1045 @example
1046 myText = \lyrics @{ I want to break free @}
1047 @end example
1048
1049 @noindent
1050 The braces @code{@{@}} signify that the syllables are sung in
1051 sequence.
1052
1053 @ignore
1054 By default, music expressions are interpreted in @code{Staff} context.  For
1055 lyrics, this is obviously not desirable, so it is necessary
1056 to explicitly specify a @code{Lyrics} context,
1057
1058 @example
1059 \lyrics @{ I want to break free @}
1060 @end example
1061
1062 The melody for this song is as follows
1063
1064 @lilypond[fragment,quote,fragment,relative=2]
1065 r4 c \times 2/3 { f4 g g }
1066 \times 2/3 { g4( a2) }
1067 @end lilypond
1068
1069 @end ignore
1070
1071
1072 @node A lead sheet
1073 @section A lead sheet
1074
1075 @cindex Lead sheets
1076 @cindex chords
1077 @cindex chord names
1078
1079 In popular music, it is common to denote accompaniment as chord names.
1080 Such chords can be entered like notes,
1081
1082 @example
1083 c2 f4. g8
1084 @end example
1085
1086 @noindent
1087 but now, each pitch is read as the root of a chord instead of a note.
1088 This mode is switched on with @code{\chords}
1089
1090 @lilypond[quote,verbatim,raggedright]
1091 \chords { c2 f4. g8 }
1092 @end lilypond
1093
1094 Other chords can be created by adding modifiers after a colon.  The
1095 following example shows a few common modifiers
1096
1097 @lilypond[quote,verbatim]
1098 \chords { c2 f4:m g4:maj7 gis1:dim7 }
1099 @end lilypond
1100
1101 For lead sheets, chords are not printed on staves, but as names on a
1102 line of themselves.  Hence, we have to override the context with
1103 @code{\new}, rendering the music expression in a @code{ChordNames}
1104 context
1105
1106 @lilypond[quote,verbatim]
1107 \new ChordNames \chords { c2 f4.:m g4.:maj7 gis8:dim7 }
1108 @end lilypond
1109
1110 @cindex lead sheet
1111 When put together, chord names, lyrics and a melody form
1112 a lead sheet, for example,
1113
1114 @example
1115 <<
1116   \new ChordNames \chords @{ @emph{chords} @}
1117   @emph{the melody}
1118   \newlyrics @{ @emph{the text} @}
1119 >>
1120 @}
1121 @end example
1122
1123 @lilypond[quote,raggedright]
1124 <<
1125   \new ChordNames \chords { r2 c:sus4 f } 
1126   \relative {
1127     r4 c' \times 2/3 { f g g }
1128     \times 2/3 { g4( a2) }
1129   }
1130  \newlyrics { I want to break free __ }
1131 >>
1132 @end lilypond
1133
1134 A complete list of modifiers and other options for layout can be found
1135 in @ref{Chords}.
1136
1137 @c FIXME: we talk about \midi before mentioning \paper (or \layout?)
1138 @node Listening to output
1139 @section Listening to output
1140
1141 @cindex sound
1142 @cindex MIDI
1143
1144 MIDI (Musical Instrument Digital Interface) is a standard for
1145 connecting and controlling digital instruments.  A MIDI file is like a
1146 tape recording of a MIDI instrument.
1147
1148 To create a MIDI from a music piece of music, add a @code{\midi}
1149 block. This causes LilyPond to create a MIDI file, so you can listen
1150 to what you just entered.  It is great for checking the music.
1151 Octaves that are off or accidentals that were mistyped stand out very
1152 much when listening to the musical transcription.
1153
1154 The @code{\midi} block is added to @code{\score}, for example,
1155
1156 @example 
1157 \score @{
1158     @var{...music...}
1159     \midi @{ \tempo 4=72 @}
1160 @}
1161 @end example 
1162
1163 Here, the tempo is specified using the @code{\tempo} command.  In this
1164 case the tempo of quarter notes is set to 72 beats per minute.  More
1165 information on auditory output in the notation manual can be found in
1166 @ref{Sound}.
1167
1168 If there is a @code{\midi} command in a @code{\score}, only MIDI will
1169 be produced.  If notation is needed too, a @code{\paper} block must be
1170 added
1171
1172 @example 
1173 \score @{
1174     @var{...music...}
1175     \midi @{ \tempo 4=72 @}
1176     \paper @{ @}
1177 @}
1178 @end example 
1179 @cindex paper block
1180
1181
1182 @node Adding titles
1183 @section Adding titles
1184
1185 Bibliographic information is entered in a separate block, the
1186 @code{\header} block.  The name of the piece, its composer, etc., are
1187 entered as an assignment, within @code{\header
1188 @{@tie{}@dots{}@tie{}@}}.  The @code{\header} block is usually put at
1189 the top of the file.  For example,
1190
1191 @example 
1192 \header @{
1193   title = "Eight miniatures" 
1194   composer = "Igor Stravinsky"
1195   tagline = "small is beautiful"
1196 @}
1197
1198 @{ @dots{} @}
1199 @end example
1200
1201 @cindex bibliographic information
1202 @cindex titles
1203 @cindex composer
1204 @cindex Engraved by LilyPond
1205
1206 When the file is processed the title and composer are printed above
1207 the music.  The `tagline' is a short line printed at bottom of the last
1208 page which normally says `Engraved by LilyPond, version @dots{}'.  In
1209 the example above it is replaced by the line `small is
1210 beautiful.'@footnote{Nicely printed parts are good PR for us, so
1211 please leave the tagline if you can.}
1212
1213
1214 The @code{\header} block is usually put at the top of the file.
1215
1216 A document may contains multiple pieces of music, examples are an
1217 etude book, or an orchestral part with multiple movements.
1218 @c FIXME: ugh.  \header can only live at toplevel, or inside \score.
1219 @c If we allow it also to live inside \book, we do not need \score here?
1220 The @code{\book} block is used to group the individual @code{\score}
1221 blocks.
1222
1223 The header for each piece of music can be put inside the @code{\score}
1224 block.  The @code{piece} name from the header will be printed before
1225 each movement.
1226
1227 @ignore
1228
1229 FIXME: introduce \BOOK
1230
1231 FIXME: Using "Adagio" as a name is confusing, it's more common to be
1232 a plain tempo indication.
1233
1234 Since today (CVS-1.211) we also allow headers and composite music
1235 inside book:
1236
1237   \header { ... }
1238   \book {
1239     \header { ... }
1240     { ... }
1241     \header { ... }
1242     { ... }
1243   }
1244
1245 @end ignore
1246
1247 @cindex Engraved by LilyPond
1248 @cindex signature line
1249 @cindex tag line
1250
1251 @example 
1252 \header @{
1253   title = "Eight miniatures" 
1254   composer = "Igor Stravinsky"
1255   tagline = "small is beautiful"
1256 @}
1257
1258 \book @{
1259   \score @{
1260     @dots{}
1261     \header @{ piece = "Adagio" @}
1262   @}
1263   \score @{
1264     @dots{}
1265     \header @{ piece = "Menuetto" @}
1266   @}
1267 @}
1268 @end example
1269
1270 More information on titling can be found in @ref{Invoking lilypond}.
1271
1272
1273 @node Single staff polyphony
1274 @section Single staff polyphony
1275
1276 @cindex polyphony
1277 @cindex multiple voices
1278 @cindex voices, more -- on a staff
1279 When different melodic lines are combined on a single staff they are
1280 printed as polyphonic voices; each voice has its own stems, slurs and
1281 beams, and the top voice has the stems up, while the bottom voice has
1282 them down.
1283
1284 Entering such parts is done by entering each voice as a sequence (with
1285 @code{@{...@}}), and combining those simultaneously, separating the
1286 voices with @code{\\}
1287
1288 @lilypond[quote,verbatim,relative=3]
1289 << { a4 g2 f4~ f4 } \\
1290    { r4 g4 f2 f4 } >>
1291 @end lilypond
1292
1293 For polyphonic music typesetting, spacer rests can also be convenient; these
1294 are rests that do not print.  It is useful for filling up voices that
1295 temporarily do not play.  Here is the same example with a spacer rest
1296 instead of a normal rest---just use @samp{s} instead of @samp{r}
1297
1298 @lilypond[quote,verbatim,relative=3]
1299 << { a4 g2 f4~ f4 } \\
1300    { s4 g4 f2 f4 } >>
1301 @end lilypond
1302
1303 @noindent
1304 Again, these expressions can be nested arbitrarily
1305
1306 @lilypond[quote,fragment,verbatim,relative=3]
1307 <<
1308   \new Staff <<
1309     { a4 g2 f4~ f4 } \\
1310     { s4 g4 f2 f4 }
1311   >>
1312   \new Staff <<
1313     \clef bass
1314     { <c, g>1 ~ <c g>4 } \\
1315     { f4 d e2 ~ e4}
1316   >>
1317 >>
1318 @end lilypond
1319
1320 More features of polyphonic typesetting in the notation manual are
1321 described in @ref{Polyphony}.
1322
1323
1324 @node Piano staves
1325 @section Piano staves
1326
1327 @cindex staff switch, manual
1328 @cindex cross staff voice, manual
1329 @cindex @code{\context}
1330 Piano music is typeset in two staves connected by a brace.  Printing
1331 such a staff is similar to the polyphonic example in @ref{More staves},
1332
1333 @example
1334 << \new Staff @{ @dots{} @}
1335    \new Staff @{ @dots{} @} >>
1336 @end example
1337
1338 @noindent
1339 but now this entire expression must be interpreted as a
1340 @code{PianoStaff}
1341
1342 @example
1343 \new PianoStaff << \new Staff @dots{} >>
1344 @end example
1345
1346 Here is a full-fledged example
1347
1348 @lilypond[quote,verbatim,relative=1,fragment]
1349 \new PianoStaff <<
1350   \new Staff { \time 2/4 c4 c g' g }
1351   \new Staff { \clef bass c,, c' e c }
1352 >>
1353 @end lilypond
1354
1355 More information on formatting piano music is in @ref{Piano music}.  
1356
1357
1358 @node Organizing larger pieces
1359 @section Organizing larger pieces
1360
1361 When all of the elements discussed earlier are combined to produce
1362 larger files, the @code{\score} blocks get a lot bigger, because the
1363 music expressions are longer, and, in the case of polyphonic pieces,
1364 more deeply nested.  Such large expressions can become unwieldy.
1365
1366 By using variables, also known as identifiers, it is possible to break
1367 up complex music expressions.  An identifier is assigned as follows
1368
1369 @example
1370 namedMusic = @{ @dots{} @}
1371 @end example
1372
1373 @noindent
1374 The contents of the music expression @code{namedMusic}, can be used
1375 later by preceding the name with a backslash, i.e., @code{\namedMusic}.
1376 In the next example, a two-note motive is repeated two times by using
1377 variable substitution
1378
1379 @lilypond[quote,raggedright,verbatim,nofragment]
1380 seufzer = {
1381   e'4( dis'4)
1382 }
1383 { \seufzer \seufzer }
1384 @end lilypond
1385
1386 The name of an identifier should have alphabetic characters only;
1387 no numbers, underscores or dashes.  The assignment should be outside of
1388 running music.
1389
1390 It is possible to use variables for many other types of objects in the
1391 input.  For example,
1392
1393 @example
1394 width = 4.5\cm
1395 name = "Wendy"
1396 aFivePaper = \paper @{ paperheight = 21.0 \cm @}
1397 @end example
1398
1399 Depending on its contents, the identifier can be used in different
1400 places.  The following example uses the above variables
1401
1402 @example
1403   \paper @{
1404     \aFivePaper
1405     linewidth = \width
1406   @}
1407   @{ c4^\name @}
1408 @end example
1409
1410 More information on the possible uses of identifiers is in the
1411 technical manual, in TODO.
1412
1413
1414 @node An orchestral part
1415 @section An orchestral part
1416
1417 In orchestral music, all notes are printed twice; in a part for
1418 the musicians, and in a full score for the conductor.  Identifiers can
1419 be used to avoid double work. The music is entered once, and stored in
1420 a variable.  The contents of that variable is then used to generate
1421 both the part and the score.
1422
1423 It is convenient to define the notes in a special file.  For example,
1424 suppose that the file @file{horn-music.ly} contains the following part
1425 of a horn/bassoon duo
1426
1427 @example
1428 hornNotes =  \relative c @{
1429   \time 2/4
1430   r4 f8 a cis4 f e d
1431 @}
1432 @end example
1433
1434 @noindent
1435 Then, an individual part is made by putting the following in a file
1436
1437 @example
1438 \include "horn-music.ly"
1439 \header @{
1440   instrument = "Horn in F"
1441 @}
1442
1443 @{
1444  \transpose f c' \hornNotes
1445 @}
1446 @end example
1447
1448 The line
1449
1450 @example
1451 \include "horn-music.ly"
1452 @end example
1453
1454 @noindent
1455 substitutes the contents of @file{horn-music.ly} at this position in
1456 the file, so @code{hornNotes} is defined afterwards.  The command
1457 @code{\transpose f@tie{}c'} indicates that the argument, being
1458 @code{\hornNotes}, should be transposed by a fifth downwards. Sounding
1459 @samp{f} is denoted by notated @code{c'}, which corresponds with
1460 tuning of a normal French Horn in@tie{}F.  The transposition can be seen
1461 in the following output
1462
1463 @lilypond[quote,raggedright]
1464   \transpose f c' \relative c {
1465     \time 2/4
1466     r4 f8 a cis4 f e d
1467   }
1468 @end lilypond
1469
1470 In ensemble pieces, one of the voices often does not play for many
1471 measures.  This is denoted by a special rest, the multi-measure
1472 rest.  It is entered with a capital @samp{R} followed by a duration
1473 (1@tie{}for a whole note, 2@tie{}for a half note, etc.).  By multiplying the
1474 duration, longer rests can be constructed.  For example, this rest
1475 takes 3@tie{}measures in 2/4 time
1476
1477 @example
1478 R2*3
1479 @end example
1480
1481 When printing the part, multi-rests
1482 must be condensed.  This is done by setting a run-time variable
1483
1484 @example
1485 \set Score.skipBars = ##t
1486 @end example
1487
1488 @noindent
1489 This command sets the property @code{skipBars} in the
1490 @code{Score} context to true (@code{##t}).  Prepending the rest and
1491 this option to the music above, leads to the following result
1492
1493 @lilypond[quote,raggedright]
1494 \transpose f c' \relative c {
1495     \time 2/4
1496     \set Score.skipBars = ##t 
1497     R2*3
1498     r4 f8 a cis4 f e d
1499   }
1500 @end lilypond
1501
1502
1503 The score is made by combining all of the music together.  Assuming
1504 that the other voice is in @code{bassoonNotes} in the file
1505 @file{bassoon-music.ly}, a score is made with
1506
1507 @example
1508 \include "bassoon-music.ly"
1509 \include "horn-music.ly"
1510
1511   <<
1512     \new Staff \hornNotes
1513     \new Staff \bassoonNotes
1514   >>
1515 @end example
1516
1517 @noindent
1518 leading to 
1519
1520 @lilypond[quote,raggedright]
1521   \relative c <<
1522     \new Staff {
1523       \time 2/4 R2*3
1524       r4 f8 a cis4 f e d
1525     }
1526     \new Staff {
1527       \clef bass
1528       r4 d,8 f | gis4 c | b bes |
1529       a8 e f4 | g d | gis f
1530     }
1531   >>
1532 @end lilypond
1533
1534 More in-depth information on preparing parts and scores can be found
1535 in the notation manual; see @ref{Orchestral music}.
1536
1537 Setting run-time variables (`properties') is discussed in ref-TODO.
1538
1539
1540 @node Integrating text and music
1541 @section Integrating text and music
1542
1543 @cindex La@TeX{}, music in
1544 @cindex HTML, music in
1545 @cindex Texinfo, music in
1546 Some texts include music examples.  Examples are musicological
1547 treatises, songbooks or manuals like this.  Such texts can be made by
1548 hand, simply by importing a PostScript figure into the word processor.
1549 However, there is an automated procedure to reduce the amount of work
1550 involved HTML, La@TeX{}, and Texinfo documents.
1551
1552 A script called @code{lilypond-book} will extract the music fragments,
1553 run format them, and put back the resulting notation.  This program is
1554 fully described in @ref{lilypond-book manual}.  Here we show a small
1555 example.  The example also contains explanatory text, so we will not
1556 comment on it further
1557
1558 @example
1559 \documentclass[a4paper]@{article@}
1560 \begin@{document@}
1561
1562 Documents for lilypond-book may freely mix music and text.  For
1563 example,
1564
1565 \begin@{lilypond@}
1566  @{ \relative c' @{
1567      c2 g'2 \times 2/3 @{ f8 e d @} c'2 g4
1568   @} 
1569 \end@{lilypond@}
1570
1571 Options are put in brackets.
1572
1573 \begin[fragment,quote,staffsize=26,verbatim]@{lilypond@}
1574   c'4 f16
1575 \end@{lilypond@}
1576
1577 Larger examples can be put in a separate file, and introduced with
1578 \verb+\lilypondfile+.
1579
1580 \lilypondfile[quote,noindent]@{screech-boink.ly@}
1581
1582 \end@{document@}
1583 @end example
1584
1585 Under Unix, you can view the results as follows
1586
1587 @example
1588 $ cd input/tutorial
1589 $ mkdir -p out/
1590 $ lilypond-book --output=out/ lilybook.tex
1591 lilypond-book (GNU LilyPond) 2.1.19
1592 Reading `input/tutorial/lilybook.tex'
1593 Reading `input/screech-boink.ly'
1594 @var{lots of stuff deleted}
1595 Writing `out/lilybook.tex'
1596 $ cd out
1597 $ latex lilybook
1598 @var{lots of stuff deleted}
1599 $ xdvi lilybook 
1600 @end example
1601
1602 To convert the file into a nice PDF document, run the following
1603 commands
1604
1605 @example
1606 $ dvips -Ppdf -u+lilypond -u+ec-mftrace lilybook
1607 $ ps2pdf lilybook.ps
1608 @end example
1609
1610 Running lilypond-book and running latex creates a lot of temporary
1611 files, which would clutter up the working directory.  To remedy this,
1612 use the @code{--output=@var{dir}} option.  It will create the files in
1613 a separate subdirectory @file{dir}.
1614
1615 Finally the result of the La@TeX{} example shown above.@footnote{Note
1616 that in this tutorial the example is processed with Texinfo.  This gives
1617 slightly different results in layout.}  This finishes the tutorial
1618 section.
1619
1620 @page
1621
1622 Documents for lilypond-book may freely mix music and text.  For
1623 example,
1624
1625 @lilypond
1626 \relative c' {
1627   c2 g'2 \times 2/3 { f8 e d } c'2 g4
1628 }
1629 @end lilypond
1630
1631 Options are put in brackets.
1632
1633 @lilypond[fragment,quote,staffsize=26,verbatim]
1634 c'4 f16
1635 @end lilypond
1636
1637 Larger examples can be put in a separate file, and introduced with
1638 @code{\lilypondfile}.
1639
1640 @lilypondfile[quote,noindent]{screech-boink.ly}