]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/tutorial.itely
* scripts/convert-ly.py (FatalConversionError.conv): conversion
[lilypond.git] / Documentation / user / tutorial.itely
1 @c -*-texinfo-*-
2
3 @c TODO:
4 @c   * LilyPond Lilypond lilypond (sometimes: the program)
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 @node Tutorial
10 @chapter Tutorial
11
12 @html
13 <!--- @@WEB-TITLE@@=Tutorial --->
14 @end html
15
16 @menu
17 * First steps::                 Music language of LilyPond
18 * Running LilyPond::            Printing music
19 * More basics::                 
20 * Printing lyrics::             
21 * A lead sheet::                
22 * Listening to output::         
23 * Titling ::                    
24 * Single staff polyphony  ::    
25 * Piano staffs::                
26 * Organising larger pieces::    
27 * Fine tuning a piece::         
28 * An orchestral part::          
29 * Integrating text and music::  Integrating text and music
30 @end menu
31
32 Operating is done through text files: To print a piece of music, you
33 enter the music in a file.  When LilyPond is run (normally using the
34 program @code{ly2dvi}) on that file, another file containing formatted
35 sheet music, is produced. That file may be printed or viewed.
36
37 This tutorial starts with a small introduction to the LilyPond music
38 language.  After this first contact, we will show which commands to
39 run to produce printed output, so you should then be able to create
40 your first sheets of music.  When starting out, it will be convenient
41 to print out
42 @ifhtml
43 the
44 @end ifhtml
45 @ref{Cheat sheet}, which is a table listing all commands for
46 convenient reference.
47
48
49
50 @node First steps
51 @section First steps
52
53 We start off by showing how very simple music is entered in LilyPond:
54 you get a note simply by typing its @htmlref{note name}, from @samp{a}
55 through @samp{g}.  So if you enter
56
57 @example
58 c d e f g a b
59 @end example
60
61 @noindent
62 then the result looks like this:
63
64 @c ?
65 @c \transpose c c' { c d e f g a b }
66 @c @lily pond[notime]
67 @c \property Score.timing = ##f
68 @lilypond[notime, relative=2]
69 c d e f g a b
70 @end lilypond
71
72 We will continue with this format: First we show a snippet of input,
73 then the resulting output.
74
75 The length of a note is specified by adding a number, @samp{1} for a
76 @rglos{whole note}, @samp{2} for a @rglos{half note}, and so on:
77
78 @example
79 a1 a2 a4 a16 a32
80 @end example
81
82 @lilypond[notime]
83 \property Score.timing = ##f
84 \property Staff.autoBeaming = ##f
85 \transpose c c' { a1 a2 a4 a16 a32 s16_" " }
86 @end lilypond
87
88 If you do not specify a @rglos{duration}, the previous one is used: 
89
90 @example
91 a4 a a2 a
92 @end example
93
94 @lilypond[notime]
95 \property Score.timing = ##f
96 \transpose c c' { a a a2 a s16_" " }
97 @end lilypond
98
99 A @rglos{sharp} (@texisharp{}) is made by adding @samp{is}, a
100 @rglos{flat} (@texiflat{}) by adding @samp{es}.  As you might expect,
101 a @rglos{double sharp} or @rglos{double flat} is made by adding
102 @samp{isis} or @samp{eses}:@footnote{This syntax derived from note
103 naming conventions in Nordic and Germanic languages, like German and
104 Dutch}
105
106 @example
107 cis1 ees fisis aeses
108 @end example
109
110 @lilypond[notime]
111 \property Score.timing = ##f
112 \transpose c c' { cis1 ees fisis aeses s16_" " }
113 @end lilypond
114
115 Add a dot @samp{.} after the duration to get a @rglos{dotted note}:
116
117 @example
118 a2. a4 a8. a16
119 @end example
120
121 @lilypond[notime]
122 \property Score.timing = ##f
123 \transpose c c' { a2. a4 a8. a16 s16_" " }
124 @end lilypond
125
126 Entering pitches and durations is fully explained in @ref{Pitches} and
127 @ref{Durations}.
128
129
130 The @rglos{meter} (or @rglos{time signature}) can be set with the
131 @code{\time} command:
132
133 @example
134 \time 3/4
135 \time 6/8
136 \time 4/4
137 @end example
138
139 @c a clef here may lead to confusion
140 @lilypond
141 \property Staff.Clef \set #'transparent = ##t 
142 \time 3/4
143 s4_" "
144 \time 6/8
145 s4_" "
146 \time 4/4
147 s16_" "
148 @end lilypond
149
150 Time signatures and other timing commands are described in @ref{Time
151 signature}.
152
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, its violin.
158 @c in English its definitely treble.
159 @example
160 \clef treble
161 \clef bass
162 \clef alto
163 \clef tenor
164 @end example
165
166 @lilypond[notime]
167 \property 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 Clefs are fully explained in @ref{Clef}.
179
180
181 When you enter these commands in a file, you must to enclose them in
182 @code{\notes @{@dots{}@}}.  This lets LilyPond know that music (as
183 opposed to @rglos{lyrics}) follows:
184
185 @example
186 \notes @{
187   \time 3/4
188   \clef bass
189   c2 e4 g2.
190   f4 e d c2.
191 @}
192 @end example
193 Now the piece of music is almost ready to be printed.  The final step is to
194 combine the music with a printing command.
195
196 The printing command is the so-called @code{\paper} block.  Later on
197 you will see that the @code{\paper} block is used to customize
198 printing specifics.  The music and the @code{\paper} block are combined by
199 enclosing them in @code{\score @{ ... @}}.  This is what a full source file looks like:
200
201 @example
202 \score @{
203   \notes @{
204     \time 3/4
205     \clef bass
206     c2 e4 g2.
207     f4 e d c2.
208   @}
209   \paper @{ @}
210 @}
211 @end example
212
213 @lilypond[noindent]
214 \score {
215   \notes {
216      \time 3/4
217      \clef bass
218      c2 e4 g2.
219      f4 e d c2.
220   }
221   \paper {
222     linewidth = 55 * \staffspace
223   }
224 }
225 @end lilypond
226
227
228 @node Running LilyPond
229 @section Running LilyPond
230
231 In the last section we explained what kind of things you could enter
232 in a LilyPond file.  In this section we explain what commands to run
233 and how to view or print the output.  If you have not used LilyPond
234 before, want to test your setup, or want to run an example file
235 yourself, read this section.  The instructions that follow are for
236 Unix-like systems.  Some additional instructions for Microsoft Windows are given
237 at the end of this section.
238
239 Begin by opening a terminal window and starting a text editor.
240 For example, you could open an xterm and execute @code{joe}.  In your
241 text editor, enter the following input and save the file as
242 @file{test.ly}:
243
244 @quotation
245 @example
246 \score @{
247   \notes @{ c'4 e' g' @}
248 @} 
249 @end example
250 @end quotation
251
252 @cindex ly2dvi
253
254 @c now this is weird, running ly2dvi to run LilyPond
255 @c (therefore name change proposal) 
256
257 LilyPond is the program that computes the sheet music. All other
258 things, such as adding titles, page breaking and other page layout,
259 are done by a small wrapper program called
260 @code{ly2dvi}. @code{ly2dvi} calls LilyPond to render the music, and
261 then adds the titling and page layout instructions.  To process
262 @file{test.ly} with @code{ly2dvi}, proceed as follows:
263
264 @quotation
265 @example
266 ly2dvi -p test.ly
267 @end example
268 @end quotation
269
270 You will see the following on your screen:
271
272 @quotation
273 @example
274 GNU LilyPond 1.7.16
275 Now processing: `/home/fred/ly/test.ly'
276 Parsing...
277 Interpreting music...[1]
278  @emph{ ... more interesting stuff ... }
279 PDF output to `test.pdf'...
280 DVI output to `test.dvi'...
281 @end example
282 @end quotation
283 @cindex DVI file
284 @cindex Viewing music
285 @cindex xdvi
286
287 The results of the ly2dvi run are two files, @file{test.dvi} and
288 @file{test.pdf}.  The PDF file (@file{test.pdf}) is the one you can
289 print or view.  For example, viewing PDF can be done with ghostview.
290 If a version of ghostview is installed on your system, one of these
291 commands will produce a window with some music notation on your
292 screen:
293 @c eeek
294 @quotation
295 @example
296   gv test.pdf
297   ghostview test.pdf
298   ggv test.pdf
299   kghostview test.pdf
300   xpdf test.pdf
301   gpdf test.pdf
302 @end example
303 @end quotation
304 If the music on your screen looks good, you can print it by clicking
305 File/Print inside ghostview.
306
307 The DVI file (@file{test.dvi}) contains the same sheet music in a
308 different format. DVI files are more easily processed by the computer,
309 so viewing them usually is quicker.  You can run @code{xdvi test.dvi}
310 @c KDVI doesn't grok the PS specials.
311 @c or
312 @c @code{kdvi test.dvi}
313 @c
314 to view the DVI file. In Xdvi, the mouse buttons
315 activate magnifying glasses.  Unfortunately, variable symbols (such as
316 beams and slurs) are not displayed in the magnifying glasses.
317
318
319 @cindex Ghostscript
320 @cindex @code{lpr}
321 @cindex Printing output
322 @cindex PostScript
323 @cindex PDF
324
325 If you are familiar with @TeX{}, be warned: do not use other DVI
326 drivers like @code{dvilj}.  LilyPond DVI use embedded PostScript code
327 and will not render correctly with other DVI drivers besides
328 @code{dvips}.
329
330 @cindex dvips
331 @cindex dvilj
332 @cindex DVI driver
333
334
335 Various commands for formatting and printing music are detailed in
336 @ref{Invoking LilyPond}.
337
338
339 @unnumberedsubsec Windows users
340
341 On Windows,  the terminal is started by clicking on the LilyPond or
342 Cygwin icon.  Any text editor (such as NotePad, Emacs or Vim) may be
343 used to edit the LilyPond file.  When Cygwin's @code{XFree86} X11
344 window system is installed along with @code{tetex-x11} and
345 @code{ghostscript-x11} packages, then the @code{dvi} output may be
346 viewed with @code{xdvi test.dvi} as described above.  If you have
347 installed a PostScript/PDF viewer, such as @code{GSView} from
348 @uref{http://www.cs.wisc.edu/~ghost}, viewing the PDF file can be done
349 with:
350 @quotation
351 @example
352 @code{gsview32 test.pdf}
353 @end example
354 @end quotation
355 Printing may be done by executing
356 @quotation
357 @example
358 @code{gsview32 /s test.pdf}
359 @end example
360 @end quotation
361
362
363 @node More basics
364 @section More basics 
365
366 We continue with the introduction of more musical constructs.  Normal
367 rests are entered just like notes with the name ``@code{r}'':
368
369 @quotation
370 @example
371 r2 r4 r8 r16
372 @end example
373
374 @lilypond[fragment]
375 \property Score.timing = ##f
376 \property Staff.Clef = \turnOff
377 \property Staff.TimeSignature = \turnOff
378 r2 r4 r8 r16
379 s16_" "
380 @end lilypond
381 @end quotation
382 @separate
383
384 Rests are described in full detail in @ref{Rests}. 
385
386
387 @c Tim wants to move this quotes example just before the: quotes-do not-work
388 @c score, but we'd need to remove quotes from the other two (key and
389 @c tie) examples...
390
391 @c better to have this just before the `octaves are bad' snipped
392 @c but we'd need to remove the ', from \key and tie 
393 To raise a note by an octave, add a high quote @code{'} (apostrophe) to
394 the note name, to lower a note one octave, add a ``low quote'' @code{,}
395 (a comma).  Middle C is @code{c'}:
396
397 @quotation
398 @example
399 c'4 c'' c''' \clef bass c c,
400 @end example
401
402 @lilypond[fragment]
403 \property Score.timing = ##f
404 \property Staff.TimeSignature = \turnOff
405 c'4 c'' c''' \clef bass c c,
406 @end lilypond
407 @end quotation
408 @separate
409
410 A tie is created by adding a tilde ``@code{~}'' to the first note
411 being tied.
412 @quotation
413 @lilypond[fragment,verbatim]
414 g'4-~ g' a'2-~ a'4
415 @end lilypond
416 @end quotation
417 @separate
418 A tie is different from a slur. A tie simply makes the first note
419 sound longer, and can only be used on pairs of notes with the same
420 pitch. Slurs indicate the articulations of notes, and can be used on
421 larger groups of notes. Slurs and ties are also nested in practice:
422 @lilypond[fragment, relative=1]
423 c2-~-( c8 fis fis4 ~ fis2 g2-)
424 @end lilypond
425
426 The notation manual discusses ties in @ref{Ties}.
427
428 The key signature is set with the command ``@code{\key}'', followed by
429 a pitch and  @code{\major} or @code{\minor}:
430 @quotation
431 @example
432 \key d \major
433 g'1
434 \key c \minor
435 g'
436 @end example
437
438 @lilypond[fragment]
439 \property Staff.TimeSignature = \turnOff
440 \key d \major
441 g'1
442 \key c \minor
443 g'
444 @end lilypond
445 @end quotation
446
447
448
449 @c bit on the long/complex/scary taste
450 @c cheating a bit: two lines makes for a friendlier look
451 This example shows notes, ties, octave marks, and rests in action.
452
453 @quotation
454 @example
455 \score @{
456   \notes @{
457     \time 4/4
458     \key d \minor
459     \clef violin
460     r4 r8 d''8 cis''4 e''
461     d''8 a'4.-~ a' b'8
462     cis''4 cis''8 cis'' bis'4 d''8 cis''-~
463     cis''2 r2
464   @}
465   \paper @{ @}
466 @}
467 @end example
468
469 @lilypond
470 \score {
471   \notes {
472     \time 4/4
473     \clef violin
474     \key d \minor
475     r4 r8 d''8 cis''4 e''
476     d''8 a'4.-~ a' b'8
477     cis''4 cis''8 cis'' bis'4 d''8 cis''-~
478     cis''2 r2
479   }
480   \paper { linewidth = 50*\staffspace }
481 }
482 @end lilypond
483 @end quotation
484
485 @c accidentals...
486 There are some interesting points to note in this example.
487 Accidentals (sharps and flats) do not have to be marked explicitly:
488 you just enter the note name, and an accidental is printed
489 automatically, only when necessary.  Bar lines and beams are drawn
490 automatically.  Line breaks are calculated automatically; it does not
491 matter where the lines breaks are in the source file. Finally, the
492 order of time, key and clef changes is not relevant: in the printout,
493 these are ordered using standard notation conventions.
494
495 The example also indicates that a piece of music written in a high
496 register needs lots of quotes.  This makes the input less readable,
497 and is also a potential source of errors.
498
499 The solution is to use ``relative octave'' mode.  In practice, this is
500 the most convenient way to copy existing music.  To use relative mode,
501 add @code{\relative} before the piece of music.  You must also give a
502 note from which relative starts, in this case @code{c''}.  If you do
503 not use octavation quotes (i.e. do not add ' or , after a note),
504 relative mode chooses the note that is closest to the previous one.
505 @c do not use commas or quotes in this sentence
506 For example: @code{c f} goes up; @code{c g} goes down:
507
508 @quotation
509 @example
510 \relative c'' @{
511   c f c g c
512 @}
513 @end example
514
515 @lilypond[fragment]
516 \property Score.timing = ##f
517 \property Staff.TimeSignature = \turnOff
518 \relative c'' {
519   c f c g c
520 }
521 @end lilypond
522 @end quotation
523 @separate
524
525
526 Since most music has small intervals, in relative mode pieces can be
527 written almost without using octavation quotes.
528
529 @c needed better, maybe even redundant explanation
530 @c   added another example below.
531 @c grappig: Pa vond het heel logies, en slim toen-i eenmaal begreep.
532 @c in eerste instantie drong het `relative' niet door zonder extra uitleg.
533 Larger intervals are made by adding octavation quotes.  Quotes or
534 commas do not determine the absolute height of a note; the height of a
535 note is relative to the previous one.
536 @c do not use commas or quotes in this sentence
537 For example: @code{c f,} goes down; @code{f, f} are both the same;
538 @code{c' c} are the same; and @code{c g'} goes up:
539
540 @quotation
541 @example
542 \relative c'' @{
543   c f, f c' c g' c,
544 @}
545 @end example
546
547 @lilypond[fragment]
548 \property Score.timing = ##f
549 \property Staff.TimeSignature = \turnOff
550 \relative c'' {
551   c f, f c' c g' c,
552 }
553 @end lilypond
554 @end quotation
555 @separate
556
557
558 Here is an example of the difference between relative mode and
559 ``normal'' (non-relative) mode:
560
561 @quotation
562 @example
563 \relative a @{
564 \clef bass
565   a d a e d c' d'
566 @}
567 @end example
568
569 @lilypond[fragment]
570 \property Score.timing = ##f
571 \property Staff.TimeSignature = \turnOff
572 \relative a {
573 \clef bass
574   a d a e d c' d'
575 }
576 @end lilypond
577 @end quotation
578 @separate
579
580 @quotation
581 @example
582 \clef bass
583   a d a e d c' d'
584 @end example
585
586 @lilypond[fragment]
587 \property Score.timing = ##f
588 \property Staff.TimeSignature = \turnOff
589 \clef bass
590   a d a e d c' d'
591 @end lilypond
592 @end quotation
593 @separate
594
595 A slur is drawn across many notes, and indicates bound articulation
596 (legato).  The starting note and ending note are marked with a
597 ``@code{(}'' and a ``@code{)}'' respectively:
598
599 @quotation
600 @lilypond[fragment,relative 1, verbatim]
601 d4-( c16-)-( cis d e c cis d e-)-( d4-)
602 @end lilypond
603 @end quotation
604 @separate
605
606 If you need two slurs at the same time (one for articulation, one for
607 phrasing), you can also make a phrasing slur with @code{\(} and
608 @code{\)}.
609
610 @c lousy example
611 @c ? --hwn
612 @c fragment of 1st hrn in Adams' The Chairman Dances, with creative
613 @c chromatic thing pasted in front.  (admittedly the original does not
614 @c have a phrasing slur. The problem is that we do not want the slur
615 @c and the Phrasing slur to collide. We are trying to make a good
616 @c impression here.
617
618 @quotation
619 @lilypond[fragment,relative 1, verbatim]
620 a8-(-\( ais b  c-) cis2 b'2 a4 cis,  c-\)
621 @end lilypond
622 @end quotation
623 @separate
624
625 Beams are drawn automatically, but if you do not like where they are
626 put, they can be entered by hand. Mark the first note to be beamed
627 with @code{[} and the last one with @code{]}:
628 @quotation
629 @lilypond[fragment,relative 1, verbatim]
630 a8-[ ais-] d-[ es r d-]
631 @end lilypond
632 @end quotation
633 @separate
634
635 To print more than one staff, each piece of music that makes up a staff
636 is marked by adding @code{\context Staff} before it.  These
637 @code{Staff}'s are then grouped inside @code{\simultaneous @{} and @code{@}}, as is
638 demonstrated here:
639
640 @quotation
641 @lilypond[fragment,verbatim]
642 \simultaneous {
643   \context Staff = staffA { \clef violin c'' }
644   \context Staff = staffB { \clef bass c }
645 }
646 @end lilypond
647 @end quotation
648
649 In this example, @code{staffA} and @code{staffB} are names that are
650 given to the staves.  It does not matter what names you give, as long
651 as each staff has a different name. If you give them the same name,
652 they are assumed to belong on the same staff, and will be printed like
653 that. @code{\simultaneous } indicates that both fragments happen at
654 the same time, and must be printed stacked vertically.
655
656 @separate
657
658 We can now typeset a melody with two staves:
659
660 @quotation
661 @lilypond[verbatim,singleline]
662 \score {
663   \notes 
664   < \context Staff = staffA {
665       \time 3/4
666       \clef violin
667       \relative c'' {
668         e2-( d4 c2 b4 a8-[ a-]
669         b-[ b-] g-[ g-] a2.-) }  
670     }
671     \context Staff = staffB {
672        \clef bass
673        c2 e4  g2.
674        f4 e d c2.
675     }
676   >
677   \paper {} 
678 }
679 @end lilypond
680 @end quotation
681
682 The time signature is specified in one melody staff only
683 (the top staff), but is printed on both, since common practice
684 dictates that all staves have the same time signature. 
685
686 @separate
687
688 Common accents can be added to a note using @code{-.}, @code{--}, @code{->}:
689 @quotation
690 @lilypond[verbatim,relative 1]
691 c-. c-- c->
692 @end lilypond
693 @end quotation
694 @separate
695
696 Similarly, fingering indications can be added to a note using @code{-}
697 and the digit to be printed.
698 @lilypond[verbatim,relative 1]
699   c-3 e-5 b-2 a-1
700 @end lilypond
701
702
703   
704
705
706 Dynamic signs are made by adding the markings to the note:
707 @quotation
708 @lilypond[verbatim,relative 1]
709 c-\ff c-\mf
710 @end lilypond
711 @end quotation
712 @separate
713
714 Crescendi and decrescendi are started with the commands @code{\<} and
715 @code{\>}. The command @code{\!} finishes a crescendo on the note it
716 is attached to.
717 @quotation
718 @lilypond[verbatim,relative 1]
719 c2-\<  c2-\!-\ff  c2-\>  c2-\!
720 @end lilypond
721 @end quotation
722 @separate
723
724 Chords can be made by
725 surrounding pitches with @code{<<} and @code{>}>:
726 @quotation
727 @lilypond[relative 0, fragment,verbatim]
728 r4 <<c e g>>4 <<c f a>>8
729 @end lilypond
730 @end quotation
731 @separate
732
733
734 You can combine beams and ties with chords.  Beam and tie markings
735 must be placed outside the chord markers:
736 @quotation
737 @lilypond[relative 0, fragment,verbatim]
738 r4 <<c e g>>8-[ <<c f a>>-]-~ <<c f a>>
739 @end lilypond
740 @end quotation
741
742 @quotation
743 @example
744 r4 <<c e g>>8-\>-( <<c e g>> <<c e g>>  <<c f a>>8-\!-)
745 @end example
746 @lilypond[relative 0, fragment]
747 \slurUp
748 r4 <<c e g>>8-\>-( <<c e g>> <<c e g>>  <<c f a>>8-\!-)
749 @end lilypond
750 @end quotation
751 @separate
752
753
754 A pickup (or upstep) is entered with the keyword @code{\partial}. It
755 is followed by a duration: @code{\partial 4} is a quarter note upstep
756 and @code{\partial 8} an eighth note.
757 @lilypond[relative 1,verbatim,fragment]
758   \partial 8
759   f8 c2 d e
760 @end lilypond
761
762 Tuplets are made with the @code{\times} keyword.  It takes two
763 arguments: a fraction and a piece of music.  The duration of the piece
764 of music is multiplied by the fraction.  Triplets make notes occupy
765 2/3 of their notated duration, so  a triplet has  2/3 as its fraction.
766 @c
767 @lilypond[relative 0,verbatim,fragment]
768   \times 2/3 { f8 g a }
769   \times 2/3 { c r c }
770 @end lilypond 
771
772 Grace notes are also made by prefixing a note, or a set of notes with
773 a keyword. In this case, the keyword is @code{\grace}. 
774 @lilypond[relative 1, verbatim,fragment]
775   \grace b16-( c4-)
776   \grace { d16-( e } d4-)
777 @end lilypond
778
779 @noindent
780 More information on the use of grace notes is in @ref{Grace notes}.
781
782
783 Comments are pieces of the input that are ignored.  There are two
784 types of comments. A line comments are introduced by @code{%}: after
785 that, the rest of that line is ignored.  Block comments span larger
786 sections of input.  Anything that is enclosed in @code{%@{} and
787 @code{%@}} is ignored too. The following fragment shows possible uses
788 for comments.
789
790 @example
791   % notes for twinkle twinkle follow:
792   c4 c   g' g  a a
793   
794   %@{
795   
796     This line, and the notes below
797     are ignored, since they are in a
798     block comment.
799
800     g g f f e e d d c2 
801   %@}
802 @end example
803
804
805
806
807 @node Printing lyrics
808 @section Printing lyrics
809 @cindex lyrics
810
811 Lyrics are entered by separating each syllable with a space, and
812 surrounding them with @code{\lyrics @{ @dots{} @}}, for example
813 @example
814   \lyrics @{ I want to break free @}
815 @end example
816
817 Like notes, lyrics are also a form of music, but they must not be
818 printed on a staff, which is the default way to print music. To print
819 them as lyrics, they must be marked with @code{ \context Lyrics}:
820 @example
821   \context Lyrics  \lyrics @{ I want to break free @}
822 @end example
823 The melody for this song is as follows
824
825 @lilypond[fragment,relative=1]
826    \partial 8
827      c8
828    \times 2/3 {  f4 g g } \times 2/3 { g4-( a2-) }
829 @end lilypond
830
831 The lyrics can be set to these notes, combining both with the
832 @code{\addlyrics} keyword:
833 @example
834  \addlyrics
835     \notes @{ @dots{} @}
836     \context Lyrics @dots{}
837 @end example
838
839 The final result is 
840 @lilypond[singleline,verbatim]
841 \score  {
842  \notes {
843   \addlyrics
844    \relative c' {
845      \partial 8
846      c8
847      \times 2/3 { f g g } \times 2/3 { g4-( a2-) }
848    }
849    \context Lyrics  \lyrics { I want to break free }
850  }
851  \paper{ }
852 }
853 @end lilypond
854
855 This melody ends on a @rglos{melisma}, a single syllable (``free'')
856 sung to more than one note. This is indicated with a @emph{extender
857 line}. It is entered as two  underscores, i.e.,
858 @example
859   \lyrics @{ I want to break free __ @}
860 @end example 
861 @lilypond[]
862 \score  {
863  \notes {
864   \addlyrics
865    \relative c' {
866    \partial 8
867      c8
868      \times 2/3 { f g g } \times 2/3 { g4-( a2-) }
869
870      %% ugh, this is to deal with bugs in the extender implementation
871      \blankNotes
872      c8
873    }
874    \context Lyrics  \lyrics { I want to break free __ }
875  }
876  \paper{ linewidth = 9.0 \cm }
877 }
878 @end lilypond
879
880 Similarly, hyphens between words can be entered as two dashes,
881 resulting in a centered hyphen between two syllables.
882 @example
883   Twin -- kle twin -- kle
884 @end example
885 @lilypond[singleline]
886 \score {
887   \addlyrics \notes \relative f' { \time 2/4
888     f4 f c' c' }
889     \context Lyrics \lyrics { Twin -- kle twin -- kle
890  }
891 \paper { linewidth = 6.0 \cm }
892  }
893  
894 @end lilypond
895
896 More options, like putting multiple lines of lyrics below a melody are
897 discussed in @ref{Vocal music}.
898
899
900 @node A lead sheet
901 @section A lead sheet
902
903 In popular music, it is common to denote accompaniment as chord-names.
904 Using them in LilyPond has two parts, just like lyrics: entering the
905 chords (with @code{\chords}), and printing them (with @code{\context
906 ChordNames}).
907
908 Chord names are entered by starting chords mode (with @code{\chords}).
909 In chords mode, you can enter chords with a letter (indicating the
910 root of the chord), and a durations following that.
911 @c
912 @lilypond[verbatim]
913   \chords { c2 f4. g8 } 
914 @end lilypond
915
916 @noindent
917 The result of @code{\chords} is a list of chords, and is  equivalent
918 to entering chords with @code{<<@dots{}>>}.
919
920 Other chords can be created by adding modifiers, after a colon.  The
921 following example shows a few common modifiers
922 @c
923 @lilypond[verbatim]
924   \chords { c2 f4:m g4:maj7 gis1:dim7 }
925 @end lilypond
926
927 Printing chords is done by adding @code{\context ChordNames}
928 before the chords thus entered:
929 @c
930 @lilypond[verbatim]
931  \context ChordNames \chords \chords { c2 f4.:m g4.:maj7 gis8:dim7 }
932 @end lilypond
933
934 A complete list of modifiers, and other options for layout are in the
935 reference manual section @ref{Chords}.
936
937 @cindex lead sheet 
938 When put together,  chord names, lyrics and a melody form
939 a lead sheet, for example,
940
941 @example
942 \score @{
943   <
944     \context ChordNames \chords @{ @emph{chords} @}
945     \addlyrics
946       \notes @emph{the melody}
947       \context Lyrics \lyrics @{ @emph{the text} @}
948   >
949   \paper @{ @}
950 @}
951 @end example
952 @lilypond[]
953 \score  {
954   < 
955    \context ChordNames \chords { r8 c2:sus4 f } 
956    \addlyrics
957     \notes \relative c' {
958      \partial 8
959      c8
960      \times 2/3 { f g g } \times 2/3 { g4-( a2-) } }
961    \context Lyrics  \lyrics { I want to break free __ }
962   >
963  \paper{ raggedright = ##t }
964 }
965 @end lilypond
966
967
968 @node Listening to output
969 @section Listening to output
970
971 MIDI (Musical Instrument Digital Interface) is a standard for
972 connecting and recording digital instruments.  A MIDI file is like a
973 tape recording of a MIDI instrument. The @code{\midi} block makes the
974 music go to a MIDI file, so you can listen to the music you entered.
975 It is great for checking the music: octaves that are off, or
976 accidentals that were mistyped, stand out very much when listening to
977 the musical transcription.
978
979 @code{\midi} can be used in similarly to @code{\paper @{ @}}, for
980 example
981 @example 
982 \score @{
983     @var{..music..}
984     \midi  @{ \tempo 4=72 @}
985     \paper  @{ @}
986 @}
987 @end example 
988
989 Here, the tempo is specified using the @code{\tempo} command.  In this
990 case the tempo of quarter notes is set to 72 beats per minute. More
991 information on auditory output is in the @ref{Sound} section in the
992 notation manual.
993
994
995 @node Titling 
996 @section Titling
997
998 Bibliographic information is entered in a separate block, the
999 @code{\header} block. The name of the piece, its composer, etc. are
1000 entered as assignment within @code{\header @{ @dots{} @}}. For
1001 example,
1002 @example 
1003   \header @{
1004     title = "Eight miniatures" 
1005     composer = "Igor Stravinsky"
1006     tagline = "small is beautiful"
1007   @}
1008   
1009   \score @{ @dots{} @}
1010 @end example
1011
1012 @cindex bibliographic information
1013 @cindex titles
1014 @cindex composer
1015 @cindex ly2dvi
1016
1017
1018 When the file is processed by @code{ly2dvi}, the title and composer
1019 specified are printed above the music. The `tagline' is a short line
1020 printed at bottom of the last page, which normally says ``Lily was
1021 here, version @dots{}''. In the example above, it is replaced by the
1022 line ``small is beautiful.'' 
1023
1024 Normally, the @code{\header} is put at the top of the file. However,
1025 for a document that contains multiple pieces (e.g. a etude book, or
1026 part with multiple movements), then the header can be put into the
1027 @code{\score} block as follows In this case, the name of each piece
1028 will be printed before each movement.
1029
1030
1031 @cindex Lily was here
1032 @cindex signature line
1033 @cindex tag line
1034
1035 @example 
1036   \header @{
1037     title = "Eight miniatures" 
1038     composer = "Igor Stravinsky"
1039     tagline = "small is beautiful"
1040   @}
1041   
1042   \score @{ @dots{}
1043     \header @{ piece = "Adagio" @}
1044   @}
1045   \score @{ @dots{}
1046     \header @{ piece = "Menuetto" @}
1047   @}
1048 @end example
1049
1050 More information on titling can be found in @ref{Invoking ly2dvi}.
1051
1052
1053 @node Single staff polyphony  
1054 @section Single staff polyphony
1055
1056 When different melodic lines are combined on a single staff, these are
1057 printed as polyphonic voices: each voice has its own stems, slurs
1058 and beams, and the top voice has the stems up, while the bottom voice
1059 has stems down.
1060
1061 Entering such parts is done by entering each voice as a sequence (with
1062 @code{@{ .. @}}), and combing those simultaneously, separating the
1063 voices with @code{\\}:
1064
1065 @lilypond[verbatim,relative]
1066   < { a4 g2 f4-~ f4 } \\
1067     { r4 g4 f2 f4 } >
1068 @end lilypond
1069 The notation @code{< .. >} is a shorthand for @code{\simultaneous @{
1070 .. @}}.
1071
1072 For polyphonic typesetting spacer rests can also be convenient: these
1073 are rests that do not print.  It is useful for filling up voices that
1074 temporarily do not play:
1075 @lilypond[verbatim,relative]
1076   < { a4 g2 f4-~ f4 } \\
1077     { s4 g4 f2 f4 } >
1078 @end lilypond
1079
1080 More features of polyphonic typesetting are in the notation manual
1081 in @ref{Polyphony}.
1082
1083 @node Piano staffs
1084 @section Piano staffs
1085
1086 @cindex staff switch, manual
1087 @cindex cross staff voice, manual
1088 @cindex @code{\translator}
1089
1090 Piano music is always typeset in two staffs connected by a brace.
1091 Printing such a staff is done similar to the polyphonic example in
1092 @ref{More basics}:
1093 @example
1094  < \context Staff = up @{ @dots{} @}
1095    \context Staff = down @{ @dots{} @}
1096  >
1097 @end example
1098 but now this entire expression must be interpreted as a
1099 @code{PianoStaff}:
1100 @example
1101  \context PianoStaff < \context Staff @dots{} >
1102 @end example
1103
1104 Here is a complete-fledged example:
1105 @lilypond[relative 0,fragment]
1106 \context PianoStaff
1107  < \context Staff = up {
1108      c4 c g g  }
1109    \context Staff = down {
1110      \clef bass c, c' e c }
1111  >
1112 @end lilypond
1113
1114 More information on formatting piano music is in @ref{Piano music}. 
1115
1116 @node Setting variables
1117 @section Setting variables
1118
1119
1120
1121 @node Organising larger pieces
1122 @section Organising larger pieces
1123
1124 TODO: discuss identifiers, p&c, .
1125
1126 @separate
1127 @example 
1128 \version "1.5.72"
1129 @end example 
1130 Lilypond and its language are still under development, and
1131 occasionally details of the syntax are changed.  The @code{version}
1132 fragment indicates which LilyPond version the input file was written
1133 for.  When you compile this file, the version number will be
1134 checked. When the file is too old, a warning is issued.  The version
1135 number is also used by the @code{convert-ly} program (See
1136 @ref{Invoking convert-ly}), which updates the file to the latest
1137 version automatically.
1138
1139
1140
1141 @node Fine tuning a piece
1142 @section  Fine tuning a piece
1143
1144 In this section we show some ways to fine tune the final output of a
1145 piece.  We do so using a single measure of a moderately complex piano
1146 piece: a Brahms intermezzo (opus 119, no. 1).  Both fragments (the
1147 tuned and the untuned versions) are in @file{input/tutorial/}.
1148
1149 The code for the untuned example shows us some new things.
1150
1151 @lilypondfile[verbatim]{brahms-original.ly}
1152
1153
1154 @cindex dynamics
1155 @cindex loudness
1156 @cindex forte
1157 @cindex crescendo
1158
1159
1160
1161
1162 Now that we have the basic piece of music entered, we want to fine
1163 tune it so that we get something that resembles the original printed
1164 edition by Schott/Universal Edition:
1165
1166 @lilypondfile{brahms-tweaked.ly}
1167
1168 @cindex tuning graphical objects
1169
1170 Fine tuning involves overriding the defaults of the printing system.
1171 We do this by setting variables which control how Lilypond prints
1172 symbols.  Printed symbols are called graphical objects (often
1173 abbreviated to @emph{grob}). Each object is described by a bunch of
1174 settings.  Every setting is a variable: it has a name and a value
1175 which you can change.  These values determine the fonts, offsets,
1176 sub-routines to be called on the object, etc.  The initial values of
1177 these settings are set in the Scheme file
1178 @file{scm/grob-description.scm}.
1179
1180 @cindex slur attachments
1181
1182 We start with the slur in the upper part, running from F sharp to A.  In
1183 the printed edition, this slur runs from stem to stem; in our version,
1184 the slur begins at the note head of the F sharp.  The following property
1185 setting forces all slurs to run from stem to stem (not from or to note
1186 heads!).
1187
1188 @example
1189   \property Voice.Slur \set #'attachment = #'(stem . stem)
1190 @end example
1191
1192 More precisely, this command modifies the definition of the @code{Slur}
1193 object in the current @code{Voice}.  The variable @code{attachment} is
1194 set to the pair of symbols @code{'(stem . stem)}. 
1195
1196 @cindex internal documentation
1197 @cindex finding graphical objects
1198 @cindex graphical object descriptions 
1199
1200 This command fixes one particular problem with a slur. The rest of
1201 this section explains how to figure out which properties to tune for
1202 your own scores. To discover this, you must have a copy of the
1203 internals document. This is a set of HTML pages which should be
1204 included if you installed a binary distribution.  [TODO: revise for
1205 new site.]  These HTML pages are also available on the web: go to the
1206 LilyPond website, click ``Documentation: Index'' on the side bar, look
1207 in the ``Information for uses'' section, and click on ``Documentation
1208 of internals.''
1209
1210 You might want to bookmark either the HTML files on your disk, or the
1211 one on the web (the HTML on your hard drive will load much faster than
1212 the ones on the web!).  One word of caution: the internals
1213 documentation is generated from the definitions that the program uses.
1214 Hence, the internals documentation is strongly tied to the version you
1215 use.  Before you proceed, make sure that the program and documentation
1216 have matching version numbers.
1217
1218 @c  TODO: the quote is incorrect, although that shouldn't be a big
1219 @c    problem for the reader.
1220 Suppose that you wanted to tune the behavior of the slur.  The first
1221 step is to get some general information on slurs in LilyPond.  Turn to
1222 the index, and look up ``slur''. The section on slurs says
1223 @quotation
1224 The grob for this object is @internalsref{Slur}, generally in
1225 @internalsref{Voice} context.
1226 @end quotation
1227
1228 So the graphical object for this object is called @code{Slur}, and
1229 slurs are created in the @code{Voice} context.  If you are reading
1230 this tutorial in the HTML version, then you can simply click Slur,
1231 otherwise, you should look it up the internal documentation: click
1232 ``grob overview'' and select ``slur'' (the list is alphabetical).
1233
1234 Now you get a list of all the properties that the slur object
1235 supports, along with their default values.  Among the properties we
1236 find the @code{attachment} property with its default setting.  
1237 The property documentation explains that the following setting will
1238 produce the desired effect:
1239 @example 
1240  \property Voice.Slur \set #'attachment = #'(stem . stem)
1241 @end example
1242
1243 @c this is a long section, and adding an extra space here helps to
1244 @c break it into smaller subsections and thus is easier to understand.
1245 @separate
1246
1247 Next we want to move the fingering `3'.  In the printed edition it is
1248 not above the stem, but a little lower and slightly left of the stem.
1249 From the user manual we find that the associated graphical object is
1250 called @code{Fingering}, but how do we know if we should use
1251 @code{Voice} or @code{Staff}?  In many cases, @code{Voice} is a safe
1252 bet, but you can also deduce this information from the internals
1253 documentation: if you visit the documentation of @code{Fingering}, you
1254 will notice
1255 @example
1256 Fingering grobs are created by: Fingering_engraver
1257 @end example
1258
1259 Clicking @code{Fingering_engraver} will show you the documentation of
1260 the module responsible for interpreting the fingering instructions and
1261 translating them to a @code{Fingering} object.  Such a module is called
1262 an @emph{engraver}.  The documentation of the @code{Fingering_engraver}
1263 says
1264 @example
1265 Fingering_engraver is part of contexts: Voice and TabVoice
1266 @end example
1267 so tuning the settings for Fingering should be done using either
1268 @example
1269   \property Voice.Fingering \set @dots{}
1270 @end example
1271 or
1272 @example
1273   \property TabVoice.Fingering \set @dots{}
1274 @end example
1275
1276 Since the @code{TabVoice} is only used for tab notation, we see that
1277 the first guess @code{Voice} was indeed correct.
1278
1279 @cindex setting object properties
1280 @cindex @code{extra-offset}
1281
1282 For shifting the fingering, we use the property @code{extra-offset}.
1283 The following command manually adds an offset to the object.  We move
1284 it a little to the left, and 1.8 staff space downwards.
1285 @example
1286  \once \property Voice.Fingering \set #'extra-offset = #'(-0.3 . -1.8) 
1287 @end example   
1288 The @code{extra-offset} is a low-level feature: it moves around
1289 objects in the printout; the formatting engine is completely oblivious
1290 to these offsets.  The unit of these offsets are staff-spaces.  The
1291 first number controls left-right movement; a positive number will move
1292 the object to the right.  The second number controls up-down movement;
1293 a positive number will move it higher.
1294 We only want to offset a single object, so this statement is adorned
1295 with @code{\once}.
1296
1297 @cindex property types
1298 @cindex translator properties
1299 @cindex grob properties
1300 @cindex music properties
1301 @separate
1302
1303 There are three different types of variables in LilyPond, something
1304 which can be confusing at first (and for some people it stays
1305 confusing).  Variables such as @code{extra-offset} and
1306 @code{attachment} are called grob properties.  They are not the same
1307 as translator properties, like @code{autoBeaming}.  Finally, music
1308 expressions are internally stored using properties (so-called music
1309 properties).  You will encounter music properties if you run Scheme
1310 functions on music using @code{\apply}.
1311
1312 The second fingering instruction should be moved up a little to avoid
1313 a collision with the slur.  This could be achieved with
1314 @code{extra-offset}, but in this case, a simpler mechanism also
1315 works.  We insert an empty text between the 5 and the note. The empty
1316 text pushes the fingering instruction away:
1317 @example
1318   a-)^" "^\markup @{ \finger "5" @} 
1319 @end example
1320
1321 A fingering instruction, which would be entered as @code{^5}, is put
1322 as close to the notes as possible, closer than the space entered to
1323 push away the 5. Hence, the 5 is entered as a normal text, with the
1324 formatting of fingering instructions.
1325  
1326 @separate
1327
1328 Normally one would specify all dynamics in the same voice, so that
1329 dynamics (such as @b{f} and @b{p}) will be aligned with hairpins.  But
1330 in this case, we do not want the decrescendo to be aligned with the
1331 piano sign.  We achieve this by putting the dynamic markings in different
1332 voices.  The crescendo should be above the upper staff.  This can be
1333 forced by using the precooked command 
1334 @example
1335   \dynamicsUp
1336 @end example
1337
1338 However, if you do that the decrescendo will be too close to the upper
1339 voice and collide with the stems.  Looking at the manual for dynamics,
1340 we notice that ``Vertical positioning of these symbols is handled by
1341 the @internalsref{DynamicLineSpanner} grob.''.  If we turn to the
1342 documentation of @code{DynamicLineSpanner}, we find that
1343 @code{DynamicLineSpanner} supports several so-called `interfaces'.
1344 This object not only puts objects next to the staff
1345 (@code{side-position-interface}), but it also groups dynamic objects
1346 (@code{axis-group-interface}), is considered a dynamic sign itself
1347 (@code{dynamic-interface}), and is an spanning object
1348 (@code{spanner-interface}).  It also has the standard
1349 @code{grob-interface} with all the variables that come with it.
1350
1351 For the moment we are interested in side positioning:
1352 @quotation
1353  side-position-interface
1354
1355   Position a victim object (this one) next to other objects (the
1356   support).  In this case, the direction signifies where to put the
1357   victim object relative to the support (left or right, up or down?)
1358 @end quotation
1359 Between the object and its support (in this case, the descending
1360 notes), there should be more space.  This space is controlled by
1361 @code{padding}, so we increase it.
1362 @example
1363  \property Voice.DynamicLineSpanner \override #'padding = #5.0
1364 @end example
1365
1366
1367 @separate
1368
1369 Brahms uses music notation is a slightly unorthodox way.  Ties
1370 usually happen only within one voice.  In this piece, the composer
1371 gladly produces ties that jump voices.  We deal with this by faking
1372 these ties: whenever we need such a tie, we insert a notehead in a
1373 different voice, and blank the stem.  This is done in the following
1374 snippet of code.
1375
1376 @cindex transparent objects
1377 @cindex removing objects
1378 @cindex invisible objects
1379 @example
1380 \property Voice.Stem \set #'transparent = ##t
1381 d'
1382 @end example
1383 Blanking the stem should be done for only one object. One of the ways
1384 to achieve that, is by setting the property before a note. Reverting
1385 it afterwards is tedious, so for setting a property only once, we have
1386 the syntax @code{\once}: it reverts the property directly before
1387 proceeding to the next step in time.
1388
1389 The @code{\once} keyword is added to @code{\property}.
1390
1391
1392 Finally, the last tie is forced up using @code{\tieUp}.
1393
1394 @separate
1395
1396 Here is the complete ``fine tuned'' version, which includes all the
1397 modifications we discussed in this section:
1398
1399 @lilypondfile[verbatim]{brahms-tweaked.ly}
1400
1401
1402 @node An orchestral part
1403 @section An orchestral part
1404
1405
1406 TODO:
1407
1408 \markup, mmrest, transposing, cue notes, identifiers?.
1409
1410
1411 @node Integrating text and music
1412 @section Integrating text and music
1413
1414
1415 @cindex La@TeX{}, music in
1416 @cindex HTML, music in
1417 @cindex Texinfo, music in
1418
1419 Sometimes you might want to use music examples in a text that you are
1420 writing (for example a musicological treatise, a songbook, or (like us)
1421 the LilyPond manual).  You can make such texts by hand, simply by
1422 importing a PostScript figure into your word processor.  However,
1423 there is an automated procedure to reduce the amount of work.
1424
1425 If you use HTML, La@TeX{}, or Texinfo, you can mix text and LilyPond
1426 code.  A script called @code{lilypond-book} will extract the music
1427 fragments, run LilyPond on them, and put back the resulting notation.
1428 This program is fully described in @ref{lilypond-book manual}.  Here
1429 we show a small example.  Since the example also contains explanatory
1430 text, we will not comment it further.
1431
1432 @example
1433 \documentclass[a4paper]@{article@}
1434 \begin@{document@}
1435
1436 In a lilypond-book document, you can freely mix music and text. For
1437 example:
1438 \begin@{lilypond@}
1439   \score @{ \notes \relative c' @{
1440      c2 g'2 \times 2/3 @{ f8 e d @} c'2 g4
1441   @} @}
1442 \end@{lilypond@}
1443
1444 Notice that the music line length matches the margin settings of the
1445 document.
1446
1447 If you have no \verb+\score+ block in the fragment,
1448 \texttt@{lilypond-book@} will supply one:
1449
1450 \begin@{lilypond@}
1451   c'4
1452 \end@{lilypond@}
1453
1454 In the example you see here, two things happened: a
1455 \verb+\score+ block was added, and the line width was set to natural
1456 length. You can specify many more options using  \LaTeX style options
1457 in brackets:
1458
1459 \begin[verbatim,11pt,singleline,
1460   fragment,relative,intertext="hi there!"]@{lilypond@}
1461   c'4 f bes es
1462 \end@{lilypond@}
1463
1464 The option \texttt@{verbatim@} prints the LilyPond code in addition to
1465 the graphical score, \texttt@{11pt@} selects the default music size,
1466 \texttt@{fragment@} adds a score block, \texttt@{relative@} uses
1467 relative mode for the fragment, and \texttt@{intertext@} specifies
1468 what to print between the \texttt@{verbatim@} code and the music.
1469
1470 If you want to include large examples into the text, it may be more
1471 convenient to put the example in a separate file:
1472
1473 \lilypondfile[printfilename]@{screech-boink.ly@}
1474
1475 The \texttt@{printfilename@} option adds the file name to the output.
1476
1477 \end@{document@}
1478 @end example
1479
1480 Under Unix, you can view the results as follows.
1481 @example
1482 $ cd input/tutorial
1483 $ mkdir -p out/
1484 $ lilypond-book --outdir=out/ lilbook.tex
1485 lilypond-book (GNU LilyPond) 1.7.16
1486 Reading `input/tutorial/lilbook.tex'
1487 Reading `input/screech-boink6.ly'
1488 @var{lots of stuff deleted}
1489 Writing `out/lilbook.latex'
1490 $ cd out
1491 $ latex lilbook.latex
1492 @var{lots of stuff deleted}
1493 $ xdvi lilbook 
1494 @end example
1495
1496 Notice the @code{outdir} option to lilypond-book. Running lilypond-book
1497 and running latex creates a lot of temporary files, and you would not want
1498 those to clutter up your working directory. Hence, we have them created
1499 in a separate subdirectory.
1500
1501 The result looks more or less like this: 
1502
1503 @separate
1504
1505 In a lilypond-book document, you can freely mix music and text. For
1506 example:
1507 @lilypond
1508 \score {
1509   \notes \relative c' {
1510     c2 g'2 \times 2/3 { f8 e d } c'2 g4
1511   }
1512   \paper {
1513     raggedright = ##t
1514   }
1515 }
1516 @end lilypond
1517
1518 Notice that the music line length matches the margin settings of the
1519 document.
1520
1521 If you have no @code{\score} block in the fragment,
1522 @code{lilypond-book} will supply one:
1523
1524 @lilypond
1525   c'4
1526 @end lilypond
1527
1528 In the example you see here, a number of things happened: a
1529 @code{\score} block was added, and the line width was set to natural
1530 length. You can specify many more options using  La@TeX{} style options
1531 in brackets:
1532
1533 @lilypond[verbatim,11pt,singleline,
1534   fragment,relative,intertext="hi there!"]
1535   c'4 f bes es
1536 @end lilypond
1537
1538 The option @code{verbatim} also shows the LilyPond code, @code{11pt} selects
1539 the default music size, @code{fragment} adds a score block,
1540 @code{relative} uses relative mode for the fragment, and
1541 @code{intertext} specifies what to print between the
1542 @code{verbatim} code and the music.
1543
1544 If you include large examples into the text, it may be more convenient
1545 to put the example in a separate file:
1546
1547 @lilypondfile[printfilename]{screech-boink.ly}
1548
1549 The @code{printfilename} option adds the file name to the output.
1550