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