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