]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/refman.itely
patch::: 1.3.130.jcn1
[lilypond.git] / Documentation / user / refman.itely
1
2 @c Note:
3 @c
4 @c A menu is needed before every deeper *section nesting of @nodes
5 @c Run M-x texinfo-all-menus-update
6 @c to automagically fill in these menus
7 @c before saving changes
8
9
10 @ignore
11  TODO:
12
13    fix all FIXMEs
14
15    Rhythm staff (clef, x-notehead)
16
17    postscript, scheme output?
18
19    (links to?) using/existance of ly2dvi, lilypond-book
20
21 @end ignore
22
23
24 @c .{Reference Manual}
25
26 @node Reference Manual
27 @chapter Reference Manual
28
29 This document describes GNU LilyPond and its input format. This document
30 has been revised for LilyPond 1.3.125
31
32
33
34 @menu
35 * Overview::                    
36 * Repeats::                     
37 * Note entry::                  
38 * Music notation::              
39 * Polyphony::                   
40 * Spanners::                    
41 * Piano music::                 
42 * Lyrics::                      
43 * Chords::                      
44 * Writing parts::               
45 * Custodes::                    
46 * Page layout::                 
47 * Sound::                       
48 * Music entry::                 
49 * Engravers::                   
50 * Syntactic details::           
51 * Unsorted::                    
52 @end menu
53
54 @c . {Overview}
55 @node Overview
56 @section Overview
57
58
59 The purpose of LilyPond is explained informally by the term `music
60 typesetter'.  This is not a fully correct name: not only does the
61 program print musical symbols, it also makes esthetic decisions.  All
62 symbols and their placement is @emph{generated} from a high-level
63 musical description.  In other words, LilyPond would be best described
64 by `music compiler' or `music to notation compiler'.
65
66 Internally, LilyPond is written in a mixture of Scheme and C++. Most of
67 the algorithms and low-level routines are written in C++, but these low
68 level components are glued together using Scheme data
69 structures. LilyPond is linked to GUILE, GNU's Scheme library for
70 extension.
71
72 When lilypond is run to typeset sheet music, the following happens:
73
74 @itemize @bullet
75 @item GUILE Initialization: various scheme files are read
76 @item parsing: first standard .ly initialization  files are read, and
77 then the user @file{.ly} file is read.
78 @item interpretation: the music in the file is processed "in playing
79 order", i.e. in the same order as your eyes scan sheet music, and in the
80 same order that you hear the notes play.
81
82 @item typesetting:
83 in this step, the results of the interpretation, a typesetting
84 specification, is solved.
85
86 @item the visible results ("virtual ink") is written to the output file.
87 @end itemize
88
89 These stages, involve data of a specific type: during parsing,
90 @strong{Music} objects are created.  During the interpretation,
91 @strong{context} is constructed, and with this context af network of
92 @strong{graphical objects} (``grobs'') is created. The grobs contain
93 unknown variables, and the network forms a set of equations. After
94 solving the equations and filling in these variables, the printed output
95 (in the form of @strong{molecules}) is written to an output file.
96
97 These threemanship of tasks (parsing, translating, typesetting) and
98 data-structures (music, context, graphical objects) permeates the entire
99 design of the program.  This manual is ordered in terms of user
100 tasks. With each concept will be explained to which of the three parts
101 it belongs.
102
103 LilyPond input can be classified into three types:
104 @itemize @bullet
105   @item musical expressions: a musical expression is some combination of
106 rest, notes, lyrics
107   @item output definitions: recipes for translating those musical
108 expressions into performances (MIDI) or graphics (eg. PostScript).
109
110   @item declarations: by declaring and naming musical expressions, you
111 can enter and edit them in manageable chunks.
112 @end itemize
113
114
115
116
117 @c .  {Repeats}
118 @node Repeats
119 @section Repeats
120
121
122 @cindex repeats
123 @cindex @code{\repeat}
124
125 In order to specify repeats, use the @code{\repeat}
126 keyword.  Since repeats look and sound differently when played or
127 printed, there are a few different variants of repeats.
128
129 @table @asis
130 @item unfolded  
131 Repeated music is fully written (played) out.  Useful for MIDI
132 output.
133
134 @item volta  
135 This is the normal notation: Repeats are not written out, but
136 alternative endings (voltas) are printed, left to right.
137
138 @item folded  
139 Alternative endings are written stacked.  Which is unfortunately not
140 practical for anything right now.
141
142 @item tremolo
143 Make tremolo beams.
144 @end table  
145
146 @menu
147 * Repeat syntax::               
148 * Manual repeat commands::      
149 * Tremolo repeats::             
150 * Tremolo subdivision::         
151 @end menu
152
153 @node Repeat syntax
154 @subsection Repeat syntax
155
156 The syntax for repeats is
157
158 @example
159   \repeat @var{variant} @var{repeatcount} @var{repeatbody}
160 @end example
161
162 If you have alternative endings, you may add
163
164 @cindex @code{\alternative}
165 @example
166  \alternative @code{@{} @var{alternative1}
167             @var{alternative2}
168             @var{alternative3} @dots{} @code{@}}
169 @end example
170
171 where each @var{alternative} is a Music expression.
172
173 Normal notation repeats are used like this:
174
175 @quotation
176
177 @lilypond[fragment,verbatim]
178   c'1
179   \repeat volta 2 { c'4 d' e' f' }
180   \repeat volta 2 { f' e' d' c' }
181 @end lilypond
182 @end quotation
183
184 With alternative endings:
185
186 @quotation
187
188 @lilypond[fragment,verbatim]
189   c'1
190   \repeat volta 2 {c'4 d' e' f'} 
191   \alternative { {d'2 d'} {f' f} }
192 @end lilypond
193 @end quotation
194
195 Folded repeats look like this:@footnote{Folded repeats offer little
196 more over simultaneous music.  However, it is to be expected that
197 more functionality -- especially for the MIDI backend -- will be
198 implemented at some point in the future.}
199
200 @quotation
201
202 @lilypond[fragment,verbatim]
203   c'1
204   \repeat fold 2 {c'4 d' e' f'} 
205   \alternative { {d'2 d'} {f' f} }
206
207 @end lilypond
208 @end quotation
209
210
211 If you don't give enough alternatives for all of the repeats, then
212 the first alternative is assumed to be repeated often enough to equal
213 the specified number of repeats.
214
215 @quotation
216 @lilypond[fragment,verbatim]
217 \context Staff {
218   \relative c' {
219     \partial 4;
220     \repeat volta 3 { e | c2 d2 | e2 f2 | }
221     \alternative { { g4 g g } { a | a a a a | b2. } }
222   }
223 }
224
225 @end lilypond
226 @end quotation
227
228
229 As you can see, LilyPond doesn't remember the timing information, nor
230 are slurs or ties repeated, so you have to reset timing information
231 after a repeat, eg using bar-checks, @code{Score.measurePosition} or
232 @code{\partial}. We hope to fix this after 1.4.
233
234 It is possible to nest @code{\repeat}, although it probably is only
235 meaningful for unfolded repeats.
236
237 @node Manual repeat commands
238 @subsection Manual repeat commands
239
240 @cindex @code{repeatCommands}
241
242 The property @code{repeatCommands} can be used to control the layout of
243 repeats. Its value is a Scheme list of repeat commands, where each repeat
244 command can be
245
246 @table @code
247 @item 'start-repeat
248  Print a |: bar line
249 @item 'stop-repeat
250  Print a :| bar line
251 @item (volta . @var{text})
252   Print a volta bracket saying @var{text}.
253 @item (volta . #f)
254   Stop a running volta bracket
255 @end table
256
257 @lilypond[verbatim, fragment]
258  c''4
259     \property Score.repeatCommands = #'((volta "93") end-repeat)
260  c4 c4
261     \property Score.repeatCommands = #'((volta #f))
262  c4 c4
263 @end lilypond
264
265
266 @node Tremolo repeats
267 @subsection Tremolo repeats
268 @cindex tremolo beams
269
270 To place tremolo marks between notes, use @code{\repeat} with tremolo
271 style.  
272 @lilypond[verbatim,center]
273 \score { 
274   \context Voice \notes\relative c' {
275     \repeat "tremolo" 8 { c16 d16 }
276     \repeat "tremolo" 4 { c16 d16 }    
277     \repeat "tremolo" 2 { c16 d16 }
278     \repeat "tremolo" 4 c16
279   }
280   \paper {
281     linewidth = 40*\staffspace;
282   }  
283 }
284 @end lilypond
285
286 @node Tremolo subdivision
287 @subsection Tremolo subdivision
288 @cindex tremolo marks
289 @cindex @code{tremoloFlags}
290
291 Tremolo marks can be printed on a single note by adding
292 `@code{:}[@var{length}]' after the note.  The length must be at least 8.
293 A @var{length} value of 8 gives one line across the note stem.  If the
294 length is omitted, then the last value is used, or the value of the
295 @code{tremoloFlags} property if there was no last value.
296
297 @lilypond[verbatim,fragment,center]
298   c'2:8 c':32
299 @end lilypond
300
301 Tremolos in this style do not carry over into the MIDI output.
302
303 Using this mechanism pays off when you entering many tremolos, since the
304 default argument saves a lot of typing.
305
306
307 @c . {Note entry}
308 @node Note entry
309 @section Note entry
310 @cindex Note entry
311
312 @menu
313 * Notes mode::                  
314 * Pitches::                     
315 * Defining pitch names::        
316 * Durations::                   
317 * Notes::                       
318 * Rests::                       
319 * Skip::                        
320 @end menu
321
322 @c .  {Notes mode}
323 @node Notes mode
324 @subsection Notes mode
325
326 @cindex note mode
327
328 @cindex @code{\notes}
329 Note mode is introduced by the keyword
330 @code{\notes}.  In Note mode, words can only
331 contain alphabetic characters.  If @code{word} is encountered,
332 LilyPond first checks for a notename of @code{word}.  If no
333 notename is found, then @code{word} is treated as a string.
334
335 Since combinations of numbers and dots are used for indicating
336 durations, it is not possible to enter real numbers in this mode.
337
338 @cindex Notes mode
339
340 @c .  {Pitches}
341 @node Pitches
342 @subsection Pitches
343
344 @cindex Pitch names
345 @cindex Note specification
346 @cindex pitches
347 @cindex entering notes
348
349 The verbose syntax for pitch specification is
350
351 @cindex @code{\pitch}
352 @example
353   \pitch @var{scmpitch}
354 @end example
355
356 @var{scmpitch} is a pitch scheme object, see @ref{Pitch data type}.
357
358 In Note and Chord mode, pitches may be designated by names.  The default
359 names are the Dutch note names.  The notes are specified by the letters
360 @code{c} through @code{b}, where @code{c} is an octave below middle C
361 and the letters span the octave above that C.  In Dutch,
362 @cindex note names, Dutch
363 a sharp is formed by adding @code{-is} to the end of a pitch name.  A
364 flat is formed by adding @code{-es}. Double sharps and double flats are
365 obtained by adding @code{-isis} or @code{-eses}.  @code{aes} and
366 @code{ees} are contracted to @code{as} and @code{es} in Dutch, but both
367 forms will be accepted.
368
369 LilyPond has predefined sets of notenames for various other languages.
370 To use them, simply include the language specific init file.  For
371 example: @code{\include "english.ly"}.  The available language files and
372 the names they define are:
373
374 @example 
375                         Note Names               sharp       flat
376 nederlands.ly  c   d   e   f   g   a   bes b   -is         -es
377 english.ly     c   d   e   f   g   a   bf  b   -s/-sharp   -f/-flat
378 deutsch.ly     c   d   e   f   g   a   b   h   -is         -es
379 norsk.ly       c   d   e   f   g   a   b   h   -iss/-is    -ess/-es
380 svenska.ly     c   d   e   f   g   a   b   h   -iss        -ess
381 italiano.ly    do  re  mi  fa  sol la  sib si  -d          -b
382 catalan.ly     do  re  mi  fa  sol la  sib si  -d/-s       -b 
383 @end example 
384
385 @cindex @code{'}
386 @cindex @code{,}
387
388
389
390
391 The optional octave specification takes the form of a series of
392 single quote (`@code{'}') characters or a series of comma
393 (`@code{,}') characters.  Each @code{'} raises the pitch by one
394 octave; each @code{,} lowers the pitch by an octave.
395
396 @lilypond[fragment,verbatim,center]
397   c' d' e' f' g' a' b' c''
398 @end lilypond
399
400 @lilypond[fragment,verbatim,center]
401   cis' dis' eis' fis' gis' ais' bis'
402 @end lilypond
403
404 @lilypond[fragment,verbatim,center]
405   ces' des' es' fes' ges' as' bes'
406 @end lilypond
407
408 @lilypond[fragment,verbatim,center]
409   cisis' eisis' gisis' aisis' beses'
410 @end lilypond
411
412 @lilypond[fragment,verbatim,center]
413   ceses' eses' geses' ases' beses'
414 @end lilypond
415
416
417 @c .  {Defining pitch names}
418 @node Defining pitch names
419 @subsection Defining pitch names
420
421 @cindex defining pitch names
422 @cindex pitch names, defining 
423
424 Note names and chord modifiers can be customised for nationalities.  The
425 syntax is as follows.
426
427 @cindex @code{\pitchnames}
428 @cindex @code{\chordmodifiers}
429 @example
430    \pitchnames @var{scheme-alist}
431    \chordmodifiers @var{scheme-alist}
432 @end example
433
434 See @file{ly/nederlands.ly} and @file{ly/chord-modifiers.ly} for
435 specific examples how to do this.  Some national note names have been
436 provided, among others: Norwegian, Swedish, German, Italian, Catalan,
437 French, Dutch and English.
438
439
440 @c .  {Durations}
441 @node Durations
442 @subsection Durations
443
444
445 @cindex duration
446 @cindex @code{\duration}
447
448 The syntax for an verbose duration specification is
449 @example
450  \duration @var{scmduration}
451 @end example
452
453 In Note, Chord, and Lyrics mode, durations may be designated by numbers
454 and dots: durations are entered as their reciprocal values.  For notes
455 longer than a whole note, use identifiers.
456
457 @quotation
458
459 @example 
460 c'\longa c'\breve  
461 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64 
462 r\longa r\breve  
463 r1 r2 r4 r8 r16 r32 r64 r64 
464 @end example 
465
466
467 @lilypond[]
468 \score {
469   \notes \relative c'' {
470     a\longa a\breve  \autoBeamOff
471     a1 a2 a4 a8 a16 a32 a64 a64 
472     r\longa r\breve  
473     r1 r2 r4 r8 r16 r32 r64 r64 
474   }
475   \paper {
476     \translator {
477       \StaffContext
478         \remove "Clef_engraver";
479         \remove "Staff_symbol_engraver";
480         \remove "Time_signature_engraver";
481         \consists "Pitch_squash_engraver";
482     }
483   }
484 }
485 @end lilypond
486 @end quotation
487
488 As you  can see, the longa is not printed. To get a longa note head, you
489 have to use a different style of note heads. See [TODO].
490
491 If the duration is omitted then it is set equal to the previous duration
492 entered.  At the start of parsing there is no previous duration, so then
493 a quarter note is assumed.  The duration can be followed by a dot
494 (`@code{.}')  to obtain dotted note lengths.
495 @cindex @code{.}
496
497 @lilypond[fragment,verbatim,center]
498   a'4. b'4.
499 @end lilypond
500 @cindex @code{r}
501 @cindex @code{s}
502
503 You can alter the length of duration by writing `@code{*}@var{fraction}'
504 after it.  This will not affect the appearance of note heads or rests.
505
506 @c . {Notes}
507 @node Notes
508 @subsection Notes
509
510 A note specification has the form
511
512 @example
513   @var{pitch}[@var{octavespec}][!][?][@var{duration}]
514 @end example
515
516
517 LilyPond will determine what accidentals to typeset depending on the key
518 and context, so alteration refer to what note is heard, not to whether
519 accidentals are printed.  A reminder accidental
520 @cindex reminder accidental
521 @cindex @code{?}
522 can be forced by adding an exclamation mark @code{!} after the pitch.
523 A cautionary accidental,
524 @cindex cautionary accidental
525
526 i.e., an accidental within parentheses can be obtained by adding the
527 question mark `@code{?}' after the pitch.
528
529 @lilypond[fragment,verbatim,center]
530   cis' d' e' cis'  c'? d' e' c'!
531 @end lilypond
532
533
534 @c .  {Rests}
535 @node  Rests
536 @subsection Rests
537 @cindex Rests
538
539 Rests are entered like notes, with note name `@code{r}'.
540 There is also a note name
541 `@code{s}', which produces a space of the specified
542 duration.
543
544
545 @c .  {Skip}
546 @node Skip
547 @subsection Skip
548 @cindex Skip
549
550
551 @example
552   \skip @var{duration} @code{;}
553 @end example
554 @cindex @code{\skip}
555
556 Skips the amount of time specified by @var{duration}.  If no other
557 music is played, a gap will be left for the skipped time with no
558 notes printed.  It works in Note Mode or Lyrics Mode.  In Note mode,
559 this has the same effect as the spacer rest.
560
561
562
563 @c . {Music notation}
564 @node Music notation
565 @section Music notation
566 @cindex Music notation
567 @menu
568 * Key::                         
569 * Time signature::              
570 @end menu
571
572 @c .  {Key}
573 @node Key
574 @subsection Key
575 @cindex Key
576
577 @cindex @code{\key}
578
579 @example
580   @code{\key} @var{pitch} @var{type} @code{;}
581 @end example
582 @cindex @code{\minor}
583 @cindex @code{\major}
584 @cindex @code{\minor}
585 @cindex @code{\ionian}
586 @cindex @code{\locrian}
587 @cindex @code{\aeolian}
588 @cindex @code{\mixolydian}
589 @cindex @code{\lydian}
590 @cindex @code{\phrygian}
591 @cindex @code{\dorian}
592
593 Change the key signature.  @var{type} should be @code{\major} or
594 @code{\minor} to get @var{pitch}-major or @var{pitch}-minor,
595 respectively.  The second argument is optional; the default is major
596 keys.  The @var{\context} argument can also be given as an integer,
597 which tells the number of semitones that should be added to the pitch
598 given in the subsequent @code{\key} commands to get the corresponding
599 major key, e.g., @code{\minor} is defined as 3.  The standard mode names
600 @code{\ionian}, @code{\locrian}, @code{\aeolian}, @code{\mixolydian},
601 @code{\lydian}, @code{\phrygian}, and @code{\dorian} are also defined.
602
603 This command sets @code{Staff.keySignature}. 
604
605 @cindex @code{keySignature}
606
607 @c .   {Clef changes}
608 @subsubsection Clef changes
609 @cindex @code{\clef}
610 @example
611   \clef @var{clefname} @code{;}
612 @end example
613
614 Short-cut for
615
616 @example
617   \property Staff.clefGlyph = @var{symbol associated with clefname} 
618   \property Staff.clefPosition = @var{clef Y-position for clefname}
619   \property Staff.clefOctavation = @var{extra pitch of clefname}
620 @end example
621
622 Supported clef-names include 
623
624 @itemize @bullet
625 @item treble, violin, G, G2: G clef on 2nd line
626 @item french: G clef on 1st line
627 @item soprano: C clef on 1st line
628 @item mezzosoprano: C clef on 2nd line
629 @item alto: C clef on 3rd line
630 @item tenor: C clef on 4th line
631 @item baritone: C clef on 5th line
632 @item varbaritone: F clef on 3rd line
633 @item bass, F: F clef on 4th line
634 @item subbass: F clef on 5th line
635 @item percussion: percussion clef
636 @end itemize
637
638 [todo: ancient clefs]
639
640 Supported associated symbols (for Staff.clefGlyph) are:
641
642 @itemize @bullet
643 @item clefs-C: modern style C clef
644 @item clefs-F: modern style F clef
645 @item clefs-G: modern style G clef
646 @item clefs-vaticana_do: Editio Vaticana style do clef
647 @item clefs-vaticana_fa: Editio Vaticana style fa clef
648 @item clefs-medicaea_do: Editio Medicaea style do clef
649 @item clefs-medicaea_fa: Editio Medicaea style fa clef
650 @item clefs-mensural1_c: modern style mensural C clef
651 @item clefs-mensural2_c: historic style small mensural C clef
652 @item clefs-mensural3_c: historic style big mensural C clef
653 @item clefs-mensural1_f: historic style traditional mensural F clef
654 @item clefs-mensural2_f: historic style new mensural F clef
655 @item clefs-mensural_g: historic style mensural G clef
656 @item clefs-hufnagel_do: historic style hufnagel do clef
657 @item clefs-hufnagel_fa: historic style hufnagel fa clef
658 @item clefs-hufnagel_do_fa: historic style hufnagel combined do/fa clef
659 @item clefs-percussion: modern style percussion clef
660 @end itemize
661
662 @emph{Modern style} means "as is typeset in current editions".
663 @emph{Historic style} means "as was typeset or written in contemporary
664 historic editions".  @emph{Editio XXX style} means "as is/was printed in
665 Editio XXX".
666
667 @c .  {Time signature}
668 @node Time signature
669 @subsection Time signature
670 @cindex Time signature
671 @cindex meter
672 @cindex @code{\time}
673
674 @example
675   \time @var{numerator}@code{/}@var{denominator} @code{;}
676 @end example
677
678 A short-cut for doing
679 @example
680      \property Score.timeSignatureFraction = #'(@var{numerator} . @var{denominator})
681 @end example
682
683 See the documentation of @code{timeSignatureFraction}
684
685
686 @c .   {Partial}
687 @subsubsection Partial
688 @cindex Partial
689 @cindex anacrusis
690 @cindex upstep
691 @cindex partial measure
692 @cindex measure, partial
693 @cindex shorten measures
694 @cindex @code{\partial}
695 @example
696   \partial @var{duration} @code{;}
697 @end example
698
699 Short cut for 
700
701 @example
702   \property Score.measurePosition = @var{length of duration}
703 @end example
704 @cindex @code{|}
705
706 See the documentation of @code{measurePosition}.
707
708
709 @c .   {Polyphony}
710 @node Polyphony
711 @section Polyphony
712 @cindex Polyphony
713
714 [todo : collisiosn, rest-collisinos, voiceX identifiers, how to
715 which  contexts to instantiate.]
716
717
718 @table @code
719 @cindex @code{\shiftOff}  
720   @item @code{\shiftOff}
721     Disable horizontal shifting of note heads that collide. 
722
723 @cindex @code{\shiftOn}  
724   @item @code{\shiftOn}
725     Enable note heads that collide with other note heads to be
726     shifted horiztonally. Also @code{\shiftOnn} and @code{\shiftOnnn}
727 set different shift values.
728
729 @cindex @code{\stemBoth}  
730   @item @code{\stemBoth}
731     Allow stems, beams, and slurs to point either upwards or
732     downwards, decided automatically by LilyPond.
733
734 @cindex @code{\stemDown}  
735   @item @code{\stemDown}
736     Force stems, beams, and slurs to point down.
737
738 @cindex @code{\stemUp}  
739   @item @code{\stemUp}
740     Force stems, beams and slurs to point up.
741 @end table
742
743 @c .  {Spanners}
744 @node Spanners
745 @section Spanners
746 @cindex Spanners
747
748 @menu
749 * Beam::                        
750 * Slur ::                       
751 * Phrasing slur::               
752 * Ornaments::                   
753 * Grace notes::                 
754 * Bar check::                   
755 @end menu
756
757
758
759 @c .   {Beam}
760 @node Beam
761 @subsection Beams
762
763 @cindex beams
764
765 @c .    {Automatic beams}
766 @subsubsection Automatic beams
767
768
769 @cindex automatic beam generation
770 @cindex autobeam
771 @cindex @code{Voice.noAutoBeaming}
772
773 LilyPond will group flagged notes and generate beams autmatically, where
774 appropriate.
775
776 This feature can be disabled by setting the @code{Voice.noAutoBeaming}
777 property to true, which you may find necessary for the melody that goes
778 with lyrics, eg.  Automatic beaming can easily be overridden for
779 specific cases by specifying explicit beams. This is discussed in the
780 next subsubsection.
781
782
783
784 @cindex @code{Voice.autoBeamSettings}
785 @cindex @code{(end * * * *)}
786 @cindex @code{(begin * * * *)}
787
788 A large number of Voice properties are used to decide how to generate
789 beams.  Their default values appear in @file{scm/auto-beam.scm}.  In
790 general, beams can begin anywhere, but their ending location is
791 significant.  Beams can end on a beat, or at durations specified by the
792 properties in @code{Voice.autoBeamSettings}.  To end beams every quarter
793 note, for example, you could set the property @code{(end * * * *)} to
794 @code{(make-moment 1 4)}.  To end beams at every three eighth notes you
795 would set it to @code{(make-moment 1 8)}.  The same syntax can be used
796 to specify beam starting points using @code{(begin * * * *)}, eg:
797 @quotation
798 @example
799 \property Voice.autoBeamSettings \override
800     #'(end * * * *) = #(make-moment 1 4)
801 \property Voice.autoBeamSettings \override
802     #'(begin * * * *) = #(make-moment 1 8)
803 @end example
804 @end quotation
805
806 To allow different settings for different time signatures, instead of
807 the first two asterisks @code{* *} you can specify a time signature; use
808 @code{(end N M * *)} to restrict the definition to
809 `@var{N}@code{/}@var{M}' time.  For example, to specify beams ending
810 only for 6/8 time you would use the property @code{(end 6 8 * *)}.
811
812 To allow different endings for notes of different durations, instead of
813 th last two asterisks you can specify a duration; use @code{(end * * N
814 M)} to restrict the definition to beams that contain notes of
815 `@var{N}@code{/}@var{M}' duration.
816
817 For example, to specify beam endings for beams that contain 32nd notes,
818 you would use @code{(end * * 1 32)}.
819
820
821
822 @c .    {Manual beams}
823 @cindex Automatic beams
824 @subsubsection Manual beams
825 @cindex beams, manual
826 @cindex @code{]}
827 @cindex @code{[}
828
829 In some cases it may be necessary to override LilyPond's automatic
830 beaming algorithm.  For example, the auto beamer will not beam over
831 rests or bar lines, so if you want that, specify the begin and end point
832 manually using @code{[} and @code{]}:
833
834 @quotation
835 @lilypond[fragment,relative,verbatim]
836   \context Staff {
837     r4 [r8 g'' a r8] r8 [g | a] r8
838   }
839 @end lilypond
840
841
842 @cindex @code{stemLeftBeamCount}
843
844 If you have specific wishes for the number of beams, you can fully
845 control the number of beams through the properties
846 y@code{Voice.stemLeftBeamCount} and @code{Voice.stemRightBeamCount}.
847
848 @lilypond[fragment,relative,verbatim]
849   \context Staff {
850     [f'8 r16 f g a]
851     [f8 r16 \property Voice.stemLeftBeamCount = #1 f g a]
852   }
853 @end lilypond
854 @end quotation
855 @cindex @code{stemRightBeamCount}
856
857
858 @c .    {Adjusting beams}
859 @unnumberedsubsubsec Adjusting beams
860 @cindex Adjusting beams
861
862 FIXME
863
864
865         
866
867 @c .   {Slur}
868 @node Slur 
869 @subsection Slur
870 @cindex slur
871
872 @menu
873 * Slur attachments::            
874 @end menu
875
876 A slur connects chords and is used to indicate legato.  Slurs avoid
877 crossing stems.  A slur is started with @code{(} and stopped with
878 @code{)}.  The starting @code{(} appears to the right of the first note
879 in the slur.  The terminal @code{)} appears to the left of the last note
880 in the slur.  This makes it possible to put a note in slurs from both
881 sides:
882
883 @lilypond[fragment,verbatim,center]
884   f'()g'()a' [a'8 b'(] a'4 g'2 )f'4
885 @end lilypond
886
887 @c .    {Adjusting slurs}
888 @unnumberedsubsubsec Adjusting slurs
889
890
891 @node Slur attachments
892 @subsubsection Slur attachments
893
894 The ending of a slur should whenever possible be attached to a note
895 head.  Only in some instances where beams are involved, LilyPond may
896 attach a slur to a stem end.  In some cases, you may want to override
897 LilyPond's decision, e.g., to attach the slur to the stem end.  This can
898 be done through @code{Voice.Slur}'s grob-property @code{attachment}:
899
900
901 @quotation
902 @lilypond[fragment,relative,verbatim]
903   \property Voice.Slur \set #'direction = #1
904   \property Voice.Stem \set #'length = #5.5
905   g''8(g)g4
906   \property Voice.Slur \set #'attachment = #'(stem . stem)
907   g8(g)g4
908 @end lilypond
909 @end quotation
910
911 Similarly, slurs can be attached to note heads even when beams are
912 involved:
913
914 @quotation
915 @lilypond[fragment,relative,verbatim]
916   \property Voice.Slur \set #'direction = #1
917   \property Voice.Slur \set #'attachment = #'(head . head)
918   g''16()g()g()g()d'()d()d()d
919 @end lilypond
920 @end quotation
921
922 If a slur would strike through a stem or beam, LilyPond will move the
923 slur away vertically (upward or downward).  In some cases, this may
924 cause ugly slurs that you may want to correct:
925
926 @quotation
927 @lilypond[fragment,relative,verbatim]
928   \property Voice.Stem \set #'direction = #1
929   \property Voice.Slur \set #'direction = #1
930   d'32( d'4 )d8..
931   \property Voice.Slur \set #'attachment = #'(stem . stem)
932   d,32( d'4 )d8..
933 @end lilypond
934 @end quotation
935
936 LilyPond will increase the curvature of a slur trying to stay free of
937 note heads and stems.  However, if the curvature would increase too much,
938 the slur will be reverted to its default shape.  This decision is based
939 on @code{Voice.Slur}'s grob-property @code{beautiful} value.  In some
940 cases, you may find ugly slurs beautiful, and tell LilyPond so by
941 increasing the @code{beautiful} value:
942
943 [hoe  gedefd?? wat betekent beautiful = X?]
944
945 @quotation
946 @lilypond[verbatim]
947 \score {
948   \notes \context PianoStaff <
949     \time 6/4;
950     \context Staff=up { s1 * 6/4 }
951     \context Staff=down <
952       \clef bass;
953       \autochange Staff \context Voice
954         \notes \relative c {
955           d,8( a' d f a d f d a f d )a
956         }
957     >
958   >
959   \paper {
960     linewidth = -1.;
961     \translator {
962       \VoiceContext
963       Slur \override #'beautiful = #5.0
964       Slur \override #'direction = #1
965       Stem \override #'direction = #-1
966       autoBeamSettings \override #'(end * * * *)
967         = #(make-moment 1 2)
968     }
969     \translator {
970       \PianoStaffContext
971       VerticalAlignment \override #'threshold = #'(5 . 5)
972     }
973   }
974 }
975 @end lilypond
976 @end quotation
977
978 @cindex Adusting slurs
979
980
981
982 @c .   {Phrasing slur}
983 @node Phrasing slur
984 @subsection Phrasing slur
985 @cindex phrasing slur
986 @cindex phrasing mark
987
988 A phrasing slur (or phrasing mark) connects chords and is used to
989 indicate a musical sentence.  Phrasing slurs avoid crossing stems.  A
990 phrasing slur is started with @code{\(} and stopped with @code{\)}.  The
991 starting @code{\(} appears to the right of the first note in the
992 phrasing slur.  The terminal @code{\)} appears to the left of the last
993 note in the phrasing slur.
994
995 @lilypond[fragment,verbatim,center,relative]
996   \time 6/4; c''\((d)e f(e)\)d
997 @end lilypond
998
999
1000 @c .   {Tie}
1001 @menu
1002 * Tie::                         
1003 * Tuplets::                     
1004 * Text spanner::                
1005 * Ottava::                      
1006 * Span requests::               
1007 @end menu
1008
1009 @node Tie
1010 @subsubsection Tie
1011
1012 @cindex Tie
1013 @cindex ties
1014 @cindex @code{~}
1015
1016 A tie connects two adjacent note heads of the same pitch.  When used
1017 with chords, it connects all of the note heads whose pitches match.
1018 Ties are indicated using the tilde symbol `@code{~}'.
1019 If you try to tie together chords which have no common pitches, a
1020 warning message will appear and no ties will be created.
1021
1022 @lilypond[fragment,verbatim,center]
1023   e' ~ e' <c' e' g'> ~ <c' e' g'>
1024 @end lilypond
1025
1026 [sparseTies]
1027
1028
1029 @c .   {Tuplets}
1030 @node Tuplets
1031 @subsubsection Tuplets
1032 @cindex Tuplets
1033 @cindex Times 
1034
1035 Tuplets are made out of a music expression by multiplying their duration
1036 with a fraction.
1037
1038 @cindex @code{\times}
1039 @example
1040   \times @var{fraction} @var{musicexpr}
1041 @end example
1042
1043 The duration of @var{musicexpr} will be multiplied by the fraction. 
1044 In print, the fraction's denominator will be printed over the notes,
1045 optionally with a bracket.  The most common tuplet is the triplet in
1046 which 3 notes have the length of 2, so the notes are 2/3 of
1047 their written length:
1048
1049 @lilypond[fragment,verbatim,center]
1050   g'4 \times 2/3 {c'4 c' c'} d'4 d'4
1051 @end lilypond
1052
1053 [todo: document tupletSpannerDuration]
1054
1055
1056
1057 @c .   {Text spanner}
1058 @node Text spanner
1059 @subsubsection Text spanner
1060 @cindex Text spanner
1061
1062 @c .   {Ottava}
1063 @node Ottava
1064 @subsubsection Ottava
1065 @cindex Ottava
1066 @unnumberedsubsubsec Ottava
1067
1068 [move to trick. Not a supported feature.]
1069
1070 @lilypond[fragment,relative,verbatim]
1071   a'''' b c a
1072   \property Voice.TextSpanner \set #'type = #'dotted-line
1073   \property Voice.TextSpanner \set #'edge-height = #'(0 . 1.5)
1074   \property Voice.TextSpanner \set #'edge-text = #'("8va " . "")
1075   \property Staff.centralCPosition = #-13
1076   a\spanrequest \start "text" b c a \spanrequest \stop "text"
1077 @end lilypond
1078
1079
1080
1081 @c .   {Span requests}
1082 @node Span requests
1083 @subsubsection Span requests
1084 @cindex Span requests
1085
1086 @cindex @code{\spanrequest}
1087
1088 @example
1089   \spanrequest @var{startstop} @var{type}
1090 @end example
1091 @cindex @code{\start}
1092 @cindex @code{\stop}
1093
1094 Define a spanning request. The @var{startstop} parameter is either -1
1095 (@code{\start}) or 1 (@code{\stop}) and @var{type} is a string that
1096 describes what should be started.  Supported types are @code{crescendo},
1097 @code{decrescendo}, @code{beam}, @code{slur}.  [FIXME: many more] This
1098 is an internal command.  Users should use the shorthands which are
1099 defined in the initialization file @file{spanners.ly}.
1100
1101 You can attach a (general) span request to a note using
1102
1103 @lilypond[fragment,verbatim,center]
1104   c'4-\spanrequest \start "slur"
1105   c'4-\spanrequest \stop "slur"
1106 @end lilypond
1107
1108 The slur syntax with parentheses is a shorthand for this.
1109
1110
1111 @c .  {Ornaments}
1112 @node Ornaments
1113 @subsection Ornaments
1114 @cindex Ornaments
1115 @menu
1116 * Articulation::                
1117 * Text scripts::                
1118 @end menu
1119
1120 @c .   {Articulation}
1121 @node Articulation
1122 @subsubsection Articulation
1123 @cindex Articulation
1124
1125 @cindex articulations
1126 @cindex scripts
1127 @cindex ornaments
1128
1129 A variety of symbols can appear above and below notes to indicate
1130 different characteristics of the performance.  These symbols can be
1131 added to a note with `@var{note}@code{-\}@var{name}'.  Numerous symbols
1132 are defined in @file{script.ly} and @file{script.scm}.  Symbols can be
1133 forced to appear above or below the note by writing
1134 `@var{note}@code{^\}@var{name}' and `@var{note}@code{_\}@var{name}'
1135 respectively.  Here is a chart showing symbols above notes, with the
1136 name of the corresponding symbol appearing underneath.
1137
1138 @lilypond[]
1139
1140   \score {
1141     < \notes {
1142         \property Score.LyricSyllable \override #'font-family =
1143 #'typewriter
1144         \property Score.LyricSyllable \override #'font-shape = #'upright
1145         c''-\accent      c''-\marcato      c''-\staccatissimo c''-\fermata 
1146         c''-\stopped     c''-\staccato     c''-\tenuto        c''-\upbow
1147         c''-\downbow     c''^\lheel        c''-\rheel         c''^\ltoe
1148         c''-\rtoe        c''-\turn         c''-\open          c''-\flageolet
1149         c''-\reverseturn c''-\trill        c''-\prall         c''-\mordent
1150         c''-\prallprall  c''-\prallmordent c''-\upprall       c''-\downprall
1151         c''-\thumb       c''-\segno        c''-\coda
1152       }
1153       \context Lyrics \lyrics {
1154         accent__      marcato__      staccatissimo__ fermata
1155         stopped__     staccato__     tenuto__        upbow
1156         downbow__     lheel__        rheel__         ltoe
1157         rtoe__        turn__         open__          flageolet
1158         reverseturn__ trill__        prall__         mordent
1159         prallprall__  prallmordent__ uprall__        downprall
1160         thumb__       segno__        coda
1161       }
1162     >
1163     \paper {
1164       linewidth = 5.875\in;          
1165       indent    = 0.0;
1166     }
1167   }
1168
1169 @end lilypond
1170
1171 @c .   {Text scripts}
1172 @node Text scripts
1173 @subsubsection Text scripts
1174 @cindex Text scripts
1175
1176 In addition, it is possible to place arbitrary strings of text or markup
1177 text (see @ref{Text markup}) above or below notes by using a string
1178 instead of an identifier: @code{c^"text"}.  It is possible to use @TeX{}
1179 commands, but this should be avoided because this makes it impossible
1180 for LilyPond to compute the exact length of the string, which may lead
1181 to collisions.  Also, @TeX{} commands won't work with direct postscript
1182 output.  Fingerings can be placed by simply using digits.  All of these
1183 note ornaments appear in the printed output but have no effect on the
1184 MIDI rendering of the music.
1185
1186 @c .    {Fingerings}
1187 @unnumberedsubsubsec Fingerings
1188 @cindex Fingerings
1189
1190 To save typing, fingering instructions (digits 0 to 9 are
1191 supported) and single characters shorthands exist for a few
1192 common symbols
1193
1194 @lilypond[]
1195   \score {
1196     \notes \context Voice {
1197       \property Voice.TextScript \set #'font-family = #'typewriter
1198       \property Voice.TextScript \set #'font-shape = #'upright
1199       c''4-._"c-."      s4
1200       c''4--_"c-{}-"    s4
1201       c''4-+_"c-+"      s4
1202       c''4-|_"c-|"      s4
1203       c''4->_"c->"      s4
1204       c''4-^_"c-\\^{ }" s4
1205       c''4-1_"c-1"      s4
1206       c''4-2_"c-2"      s4
1207       c''4-3_"c-3"      s4
1208       c''4-4_"c-4"      s4
1209     }
1210     \paper {
1211       linewidth = 5.875 \in;
1212       indent    = 0.0;
1213     }
1214   }
1215
1216 @end lilypond
1217
1218
1219 @cindex @code{\textscript}
1220
1221 @example
1222
1223   \textscript @var{text} @var{style}
1224 @end example
1225
1226 Defines a text to be printed over or under a note.  @var{style} is a
1227 string that may be one of @code{roman}, @code{italic}, @code{typewriter}, 
1228 @code{bold}, @code{Large}, @code{large}, @code{dynamic} or @code{finger}.
1229
1230 You can attach a general textscript request using this syntax:
1231
1232 @quotation
1233
1234 @example 
1235 c4-\textscript "6" "finger"
1236 c4-\textscript "foo" "normal" 
1237 @end example 
1238
1239 @end quotation
1240
1241 This is equivalent to @code{c4-6 c4-"foo"}.  
1242
1243 @cindex @code{\script}
1244 @cindex scripts
1245 @cindex superscript
1246 @cindex subscript
1247
1248 @example
1249   \script @var{alias}
1250 @end example
1251
1252 Prints a symbol above or below a note.  The argument is a string which
1253 points into the script-alias table defined in @file{scm/script.scm}.
1254 Usually the @code{\script} keyword is not used directly.  Various
1255 helpful identifier definitions appear in @file{script.ly}.
1256
1257 For information on how to add scripts, consult @file{scm/script.scm}.
1258
1259
1260
1261
1262 @c .   {Grace notes}
1263 @node Grace notes
1264 @subsection Grace notes
1265
1266
1267
1268
1269
1270
1271
1272 @cindex Grace music
1273 @cindex @code{\grace}
1274 @cindex ornaments
1275 @cindex grace notes
1276 @cindex @code{graceAlignPosition}
1277
1278 @example
1279   \grace @var{musicexpr}
1280 @end example
1281
1282 A grace note expression has duration 0; the next real note is
1283 assumed to be the main note.
1284
1285 You cannot have the grace note after the main note, in terms of
1286 duration, and main notes, but you can typeset the grace notes to the
1287 right of the main note using the property
1288 @code{graceAlignPosition}.
1289 @cindex @code{flagStyle}
1290
1291 When grace music is interpreted, a score-within-a-score is set up:
1292 @var{musicexpr} has its own time bookkeeping, and you could (for
1293 example) have a separate time signature within grace notes.  While in
1294 this score-within-a-score, you can create notes, beams, slurs, etc.
1295 Unbeamed eighth notes and shorter by default have a slash through the
1296 stem.  This behavior can be controlled with the
1297 @code{flagStyle} property.
1298
1299 @quotation
1300 @lilypond[fragment,verbatim]
1301 \relative c'' {
1302   \grace c8 c4 \grace { [c16 c16] } c4
1303   \grace { \property Grace.flagStyle = "" c16 } c4
1304 }
1305
1306 @end lilypond
1307 @end quotation
1308
1309
1310 At present, nesting @code{\grace} notes is not supported. The following
1311 may cause run-time errors:
1312 @example
1313   @code{\grace @{ \grace c32 c16 @} c4}
1314 @end example
1315 Since the meaning of such a construct is unclear, we don't consider
1316 this a loss.  Similarly, juxtaposing two @code{\grace} sections is
1317 syntactically valid, but makes no sense and may cause runtime errors.
1318
1319 Ending a staff or score with grace notes may also generate a run-time
1320 error, since there will be no main note to attach the grace notes to.
1321
1322 The present implementation is not robust and generally kludgy. We expect
1323 it to change after LilyPond 1.4. Syntax changes might also be
1324 implemented.
1325
1326
1327
1328
1329
1330
1331
1332 @c .   {Stem tremolo}
1333 @menu
1334 * Glissando ::                  
1335 * Dynamics::                    
1336 * Crescendo and Decrescendo::   
1337 * Bar lines::                   
1338 * Breath marks::                
1339 @end menu
1340
1341
1342
1343 @c .   {Glissando}
1344 @node Glissando 
1345 @subsubsection Glissando
1346 @cindex Glissando 
1347
1348 @cindex @code{\glissando}
1349
1350 A glissando line can be requested by attaching a @code{\glissando} to a
1351 note:
1352
1353 @quotation
1354 @lilypond[fragment,relative,verbatim]
1355   c'' \glissando c'
1356 @end lilypond
1357 @end quotation
1358
1359 Printing of an additional text (such as @emph{gliss.}) must be done
1360 manually.
1361
1362
1363
1364 @c .   {Dynamics}
1365 @node Dynamics
1366 @subsubsection Dynamics
1367 @cindex Dynamics
1368
1369
1370
1371 @cindex @code{\ppp}
1372 @cindex @code{\pp}
1373 @cindex @code{\p}
1374 @cindex @code{\mp}
1375 @cindex @code{\mf}
1376 @cindex @code{\f}
1377 @cindex @code{\ff}
1378 @cindex @code{\fff}
1379 @cindex @code{\ffff}
1380 @cindex @code{\fp}
1381 @cindex @code{\sf}
1382 @cindex @code{\sff}
1383 @cindex @code{\sp}
1384 @cindex @code{\spp}
1385 @cindex @code{\sfz}
1386 @cindex @code{\rfz}
1387
1388
1389
1390
1391
1392
1393 Dynamic marks are specified by using an identifier after a note:
1394 @code{c4-\ff}.  The available dynamic marks are:
1395 @code{\ppp}, @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f},
1396 @code{\ff}, @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf},
1397 @code{\sff}, @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
1398
1399 @c .   {Crescendo and Decrescendo}
1400 @node Crescendo and Decrescendo
1401 @subsubsection Crescendo and Decrescendo
1402
1403 @cindex Crescendo and Decrescendo
1404 @cindex crescendo
1405 @cindex @code{\cr}
1406 @cindex @code{\rc}
1407 @cindex @code{\decr}
1408 @cindex @code{\rced}
1409 @cindex @code{\<}
1410 @cindex @code{\>}
1411 @cindex @code{\"!}
1412
1413
1414
1415 A crescendo mark is started with @code{\cr} and terminated with
1416 @code{\rc}, the textual reverse of @code{cr}.  A decrescendo mark is
1417 started with @code{\decr} and terminated with @code{\rced}.  There are
1418 also shorthands for these marks.  A crescendo can be started with
1419 @code{\<} and a decrescendo can be started with @code{\>}.  Either one
1420 can be terminated with @code{\!}.  Note that @code{\!}  must go before
1421 the last note of the dynamic mark whereas @code{\rc} and @code{\rced} go
1422 after the last note.  Because these marks are bound to notes, if you
1423 want to get several marks during one note, you must use spacer notes.
1424
1425 @lilypond[fragment,verbatim,center]
1426   c'' \< \! c''   d'' \decr e'' \rced 
1427   < f''1 { s4 \< \! s2 \> \! s4 } >
1428 @end lilypond
1429
1430 You can also use a text saying @emph{cresc.} instead of hairpins. Here
1431 is an example how to do it:
1432
1433 @lilypond[fragment,relative,verbatim]
1434   \context Voice {
1435     \property Voice.crescendoText = "cresc."
1436     \property Voice.crescendoSpanner = #'dashed-line
1437     a''2\mf\< a a \!a 
1438   }
1439 @end lilypond
1440
1441
1442
1443 @c .   {Bar lines}
1444 @node Bar lines
1445 @subsubsection Bar lines
1446 @cindex Bar lines
1447
1448 @cindex @code{\bar}
1449 @cindex measure lines
1450 @cindex repeat bars
1451
1452 @example
1453   \bar @var{bartype};
1454 @end example
1455
1456 This is a short-cut for doing
1457 @example
1458   \property Score.whichBar = @var{bartype} 
1459 @end example
1460
1461 You are encouraged to use @code{\repeat} for repetitions.  See
1462 @ref{Repeats}, and the documentation of @code{whichBar} in
1463 @ref{(lilypond-internals)LilyPond context properties}.
1464
1465
1466 [FIXME]
1467
1468 @c .   {Breath marks}
1469 @node Breath marks
1470 @subsubsection Breath marks
1471 @cindex Breath marks
1472
1473
1474
1475 @c .  {Bar check}
1476 @node Bar check
1477 @subsection Bar check
1478 @cindex Bar check
1479
1480 @cindex bar check
1481 @cindex @code{barCheckNoSynchronize}
1482 @cindex @code{|}
1483
1484
1485 Whenever a bar check is encountered during interpretation, a warning
1486 message is issued if it doesn't fall at a measure boundary.  This can
1487 help you find errors in the input.  Depending on the value of
1488 @code{barCheckNoSynchronize}, the beginning of the measure will be
1489 relocated, so this can also be used to shorten measures.
1490
1491 A bar check is entered using the bar symbol, @code{|}
1492
1493
1494
1495
1496
1497
1498
1499
1500 @c . {Piano music}
1501 @node Piano music
1502 @section Piano music
1503 @menu
1504 * Automatic staff changes::     
1505 * Manual staff switches::       
1506 * Pedals::                      
1507 * Arpeggio::                    
1508 * Follow Thread::               
1509 @end menu 
1510
1511
1512 @c .   {Automatic staff changes}
1513 @node Automatic staff changes
1514 @subsection Automatic staff changes
1515 @cindex Automatic staff changes
1516
1517 [\autochange]
1518
1519 @node Manual staff switches
1520 @subsection Manual staff switches
1521
1522 @cindex manual staff switches
1523 @cindex staff switch, manual
1524
1525 @cindex @code{\translator}
1526 @example
1527   \translator @var{contexttype} = @var{name}
1528 @end example
1529
1530 A music expression indicating that the context which is a direct
1531 child of the a context of type @var{contexttype} should be shifted to
1532 a context of type @var{contexttype} and the specified name.
1533
1534 Usually this is used to switch staffs in Piano music, e.g.
1535
1536 @example
1537   \translator Staff = top @var{Music}
1538 @end example
1539
1540
1541 @c .   {Pedals}
1542 @node Pedals
1543 @subsection Pedals
1544 @cindex Pedals
1545
1546 [todo]
1547
1548
1549 @c .   {Arpeggio}
1550 @node Arpeggio
1551 @subsection Arpeggio
1552 @cindex Arpeggio
1553
1554 @cindex broken arpeggio
1555 @cindex @code{\arpeggio}
1556
1557 You can specify an arpeggio sign on a chord by attaching an
1558 @code{\arpeggio} to a note of the chord.
1559
1560
1561 @quotation
1562 @lilypond[fragment,relative,verbatim]
1563   \context Voice <c'\arpeggio e g c>
1564 @end lilypond
1565 @end quotation
1566
1567 When an arpeggio crosses staffs in piano music, you attach an arpeggio
1568 to the chords in both staffs, and set
1569 @code{PianoStaff.connectArpeggios}. LilyPond will connect the arpeggios
1570 in both staffs.
1571
1572 @quotation
1573 @lilypond[fragment,relative,verbatim]
1574   \context PianoStaff <
1575     \property PianoStaff.connectArpeggios = ##t
1576     \context Voice = one  { <c''\arpeggio e g c> }
1577     \context Voice = other { \clef bass;  <c,,\arpeggio e g>}
1578   >  
1579 @end lilypond
1580 @end quotation
1581
1582
1583
1584 @c .    {Follow Thread}
1585 @node Follow Thread
1586 @subsection Follow Thread
1587 @cindex follow thread
1588 @cindex staff switching
1589 @cindex cross staff
1590
1591 [todo: different name, eg. voice line ? ]
1592
1593 @cindex @code{followThread}
1594
1595 Whenever a voice switches to another staff a line connecting the notes
1596 can be printed automatically. This is enabled if the property
1597 @code{PianoStaff.followThread} is set to true:
1598
1599 @quotation
1600 @lilypond[fragment,relative,verbatim]
1601   \context PianoStaff <
1602     \property PianoStaff.followThread = ##t
1603     \context Staff \context Voice {
1604       c'1
1605       \translator Staff=two
1606       b2 a
1607     }
1608     \context Staff=two {\clef bass; \skip 1*2;}
1609   >  
1610 @end lilypond
1611 @end quotation
1612
1613
1614 @c . {Lyrics}
1615 @node Lyrics
1616 @section Lyrics
1617
1618
1619 @menu
1620 * Lyrics mode::                 
1621 * Printing lyrics::             
1622 * Automatic syllable durations::  
1623 @end menu
1624
1625 @c .  {Lyrics mode}
1626 @node Lyrics mode
1627 @subsection Lyrics mode
1628 @cindex Lyrics mode
1629
1630 @cindex lyric mode
1631 @cindex @code{\lyrics}
1632
1633 Lyrics mode is introduced by the keyword @code{\lyrics}.  This mode has
1634 rules that make it easy to include punctuation and diacritical marks in
1635 words: The purpose of Lyrics mode is that you can enter lyrics in @TeX{}
1636 format or a standard encoding without needing quotes.  The precise
1637 definition of this mode is ludicrous, and this will remain so until the
1638 authors of LilyPond acquire a deeper understanding of character
1639 encoding, or someone else steps up to fix this.
1640
1641 A word in Lyrics mode begins with: an alphabetic character, @code{_},
1642 @code{?}, @code{!}, @code{:}, @code{'}, the control characters @code{^A}
1643 through @code{^F}, @code{^Q} through @code{^W}, @code{^Y}, @code{^^},
1644 any 8-bit character with ASCII code over 127, or a two-character
1645 combination of a backslash followed by one of @code{`}, @code{'},
1646 @code{"}, or @code{^}.
1647
1648 Subsequent characters of a word can be any character that is not a digit
1649 and not white space.  One important consequence of this is that a word
1650 can end with `@code{@}}', which may be confusing. However, LilyPond will
1651 issue a warning.  Any @code{_} character which appears in an unquoted
1652 word is converted to a space.  This provides a mechanism for introducing
1653 spaces into words without using quotes.  Quoted words can also be used
1654 in Lyrics mode to specify words that cannot be written with the above
1655 rules.  Here are some examples.  Not all of these words are printable by
1656 @TeX{}.
1657
1658 @example 
1659 Ah!             % a word
1660 2B_||_!2B       % not a word because it starts with a digit
1661 ``Hello''       % not a word because it starts with `
1662 _ _ _ _         % 4 words, each one a space 
1663 @end example 
1664
1665 Since combinations of numbers and dots are used for indicating
1666 durations, you can not enter real numbers in this mode.
1667
1668 @cindex lyrics expressions
1669
1670 Syllables are entered like notes, with pitches replaced by text.  For
1671 example, @code{Twin-4 kle4 twin-4 kle4} enters four syllables, each
1672 with quarter note duration.  Note that the hyphen has no special
1673 meaning for lyrics, and does not introduce special symbols.  See
1674 section @ref{Lexical modes} for a description of what is interpreted as
1675 lyrics.
1676
1677 Spaces can be introduced into a lyric either by using quotes
1678 (@code{"}) or by using an underscore without quotes: @code{He_could4
1679 not4}.  All unquoted underscores are converted to spaces.  Printing
1680 lyrics is discussed in the next section.
1681
1682
1683 @c .  {Printing lyrics}
1684 @node Printing lyrics
1685 @subsection Printing lyrics
1686 @cindex lyrics
1687
1688
1689 Lyric syllables must be interpreted within a @code{Lyrics} context for
1690 printing them. Here is a full example:
1691
1692 @quotation
1693 @lilypond[verbatim]
1694 \score {
1695   <
1696     \notes \transpose c'' {
1697       c d e c | c d e c |
1698       e f g2 | e4 f g2 \bar "|.";
1699     }
1700     \context Lyrics \lyrics { 
1701       Va-4 der Ja- cob Va- der Ja- cob
1702       Slaapt gij nog?2 Slaapt4 gij nog?2
1703     }
1704   >
1705 }
1706
1707 @end lilypond
1708 @end quotation
1709
1710
1711
1712
1713 @cindex extender
1714 @cindex lyric extender
1715
1716 You may want a continuous line after the syllables to show melismata. 
1717 To achieve this effect, add a @code{__} lyric as a separate word
1718 after the lyric to be extended.  This will create an extender, a line
1719 that extends over the entire duration of the lyric.  This line will
1720 run all the way to the start of the next lyric, so you may want to
1721 shorten it by using a blank lyric (using @code{_}).
1722
1723 @quotation
1724
1725 @lilypond[verbatim]
1726 \score {
1727   <
1728     \notes \relative c'' {
1729       a4 () b () c () d | c () d () b () a | c () d () b () a
1730     }
1731     \context Lyrics \lyrics {
1732       foo1 __ | bar2. __ _4 | baz1 __
1733     }
1734   >
1735 }
1736
1737 @end lilypond
1738 @end quotation
1739
1740 @cindex Lyric hyphen
1741
1742 If you want to have hyphens centered between syllables (rather than
1743 attached to the end of the first syllable) you can use the special
1744 `@code{-}@code{-}' lyric as a separate word between syllables.  This
1745 will result in a hyphen which length varies depending on the space
1746 between syllables, and which will be centered between the syllables. 
1747 For example:
1748
1749 @quotation
1750
1751 @lilypond[verbatim]
1752 \score {
1753   <
1754     \notes \transpose c'' {
1755       c d e c | c d e c |
1756       e f g2 | e4 f g2 \bar "|.";
1757     }
1758     \context Lyrics \lyrics {
1759       Va4 -- der Ja -- cob | Va -- der Ja -- cob |
1760       Slaapt gij nog?2 | Slaapt4 gij nog?2
1761     }
1762   >
1763 }
1764
1765 @end lilypond
1766 @end quotation
1767
1768
1769 @c .  {Automatic syllable durations}
1770 @node Automatic syllable durations
1771 @subsection Automatic syllable durations
1772 @cindex Automatic syllable durations
1773
1774
1775 [explain automatic phrasing]
1776 @cindex automatic lyric durations
1777 @cindex @code{\addlyrics}
1778
1779 If you have lyrics that are set to a melody, you can import the rhythm
1780 of that melody into the lyrics using @code{\addlyrics}.  The syntax for
1781 this is
1782 @example
1783   \addlyrics @var{musicexpr1 musicexpr2}
1784 @end example
1785
1786 This means that both @var{musicexpr1} and @var{musicexpr2} are
1787 interpreted, but that every non-command atomic music expression
1788 (``every syllable'') in @var{musicexpr2} is interpreted using timing
1789 of @var{musicexpr1}.
1790 @cindex @code{automaticMelismata}
1791
1792 If the property @code{automaticMelismata} is set in the
1793 context of @var{musicexpr1}, no lyrics will be put on slurred or tied
1794 notes.
1795
1796 @quotation
1797 @lilypond[verbatim,fragment]
1798 \addlyrics
1799 \transpose c'' {
1800   \property Voice.automaticMelismata = ##t
1801   c8 () cis d8. e16 f2
1802 }
1803 \context Lyrics \lyrics {
1804  do4 re mi fa }
1805 @end lilypond
1806 @end quotation
1807
1808 You should use a single rhythm melody, and single rhythm lyrics (a
1809 constant duration is the obvious choice).  If you do not, you will get
1810 undesired effects when using multiple stanzas:
1811
1812 @quotation
1813 @lilypond[verbatim,fragment]
1814 \addlyrics
1815 \transpose c'' {
1816   c8 () cis d8. e16 f2
1817 }
1818 \context Lyrics \lyrics
1819 < { do4 re mi fa }
1820   { do8 re mi fa } >
1821
1822 @end lilypond
1823 @end quotation
1824
1825 It is valid (but probably not very useful) to use notes instead of
1826 lyrics for @var{musicexpr2}.
1827
1828
1829
1830 @c . {Chords}
1831 @node Chords
1832 @section Chords
1833 @cindex Chords
1834
1835 [chords vs. simultaneous music]
1836
1837 @menu
1838 * Chords mode::                 
1839 * Entering named chords::       
1840 * Printing named chords::       
1841 @end menu
1842
1843 @c .  {Chords mode}
1844 @node Chords mode
1845 @subsection Chords mode
1846 @cindex Chords mode
1847
1848 Chord mode is introduced by the keyword
1849 @code{\chords}.  It is similar to Note mode, but
1850 words are also looked up in a chord modifier table (containing
1851 @code{maj}, @code{dim}, etc).
1852
1853 Since combinations of numbers and dots are used for indicating
1854 durations, you can not enter real numbers in this mode.  Dashes
1855 and carets are used to indicate chord additions and subtractions,
1856 so scripts can not be entered in Chord mode.
1857
1858 @c .  {Entering named chords}
1859 @node Entering named chords
1860 @subsection Entering named chords
1861 @cindex Chords names
1862
1863 Chord names are a way to generate simultaneous music expressions that
1864 correspond with traditional chord names.  It can only be used in
1865 Chord mode (see section @ref{Lexical modes}).
1866
1867 @example
1868
1869   @var{tonic}[@var{duration}][@code{-}@var{modifiers}][@code{^}@var{subtractions}][@code{/}@var{inversion}][@code{/+}@var{bass}].
1870 @end example
1871
1872 @var{tonic} should be the tonic note of the chord, and @var{duration}
1873 is the chord duration in the usual notation.  There are two kinds of
1874 modifiers.  One type is @emph{chord additions}, which are obtained by
1875 listing intervals separated by dots.  An interval is written by its
1876 number with an optional @code{+} or @code{-} to indicate raising or
1877 lowering by half a step.  Chord additions has two effects: It adds
1878 the specified interval and all lower odd numbered intervals to the
1879 chord, and it may lower or raise the specified interval.  Intervals
1880 must be separated by a dot (@code{.}).
1881
1882
1883 Throughout these examples, chords have been shifted around the staff
1884 using @code{\transpose}.
1885
1886
1887 @quotation
1888
1889 @lilypond[fragment,verbatim]
1890 \transpose c'' {
1891   \chords {
1892     c1  c:3-       c:7     c:8
1893     c:9 c:9-.5+.7+ c:3-.5- c:4.6.8
1894   }
1895 }
1896
1897 @end lilypond
1898 @end quotation
1899
1900 @cindex @code{aug}
1901 @cindex @code{dim}
1902 @cindex @code{maj}
1903 @cindex @code{sus}
1904
1905 The second type of modifier that may appear after the @code{:} is a
1906 named modifier.  Named modifiers are listed in the file
1907 @file{chord-modifiers.ly}.  The available modifiers are @code{m} and
1908 @code{min} which lower the 3rd half a step, `@code{aug}' which
1909 raises the 5th, `@code{dim}' which lowers the 5th,
1910 `@code{maj}' which adds a raised 7th, and `@code{sus}'
1911 which replaces the 5th with a 4th.
1912
1913 @quotation
1914
1915 @lilypond[fragment,verbatim]
1916 \transpose c'' {
1917   \chords {
1918     c1:m c:min7 c:maj c:aug c:dim c:sus
1919   }
1920 }
1921
1922 @end lilypond
1923 @end quotation
1924  
1925
1926 Chord subtractions are used to eliminate notes from a chord.  The
1927 notes to be subtracted are listed after a @code{^} character,
1928 separated by dots.
1929
1930 @lilypond[fragment,verbatim,center]
1931   \transpose c'' {
1932     \chords {
1933       c1^3 c:7^5.3 c:8^7
1934     }
1935   }
1936 @end lilypond 
1937 @cindex @code{/}
1938
1939 Chord inversions can be specified by appending `@code{/}' and
1940 the name of a single note to a chord.  This has the effect of
1941 lowering the specified note by an octave so it becomes the lowest
1942 note in the chord.  If the specified note is not in the chord, a
1943 warning will be printed.
1944
1945 @lilypond[fragment,verbatim,center]
1946   \transpose c''' {
1947     \chords {
1948       c1 c/e c/g c:7/e
1949     }
1950   }
1951
1952 @end lilypond 
1953 @cindex @code{/+}
1954
1955 Bass notes can be added by `@code{/+}' and
1956 the name of a single note to a chord.  This has the effect of
1957 adding the specified note to the chord, lowered by an octave,
1958 so it becomes the lowest note in the chord.
1959
1960 @lilypond[fragment,verbatim,center]
1961   \transpose c''' {
1962     \chords {
1963       c1 c/+c c/+g c:7/+b
1964     }
1965   }
1966
1967 @end lilypond 
1968
1969 The most interesting application is printing  chord names, which is
1970 explained in the next subsection.
1971
1972 You should not combine @code{\relative} with named chords. [FIXME]
1973
1974 @c .  {Printing named chords}
1975 @node Printing named chords
1976 @subsection Printing named chords
1977
1978
1979
1980
1981
1982 @cindex printing chord names
1983 @cindex chord names
1984 @cindex chords
1985 @cindex @code{ChordNames}
1986 @cindex @code{ChordNameVoice}
1987
1988 For displaying printed chord names, use the @code{ChordNames} and
1989 @code{ChordNameVoice} contexts.  The chords may be entered either using
1990 the notation described above, or directly using simultaneous music.
1991
1992 @quotation
1993 @lilypond[verbatim]
1994 scheme = \notes {
1995   \chords {a1 b c} <d f g>  <e g b>
1996 }
1997 \score {
1998   \notes<
1999     \context ChordNamesVoice \scheme
2000     \context Staff \transpose c'' \scheme
2001   >
2002   \paper { linewidth = -1.; }
2003 }
2004 @end lilypond
2005 @end quotation
2006
2007 You can make the chord changes stand out more by setting property
2008 @code{ChordNames.chordChanges} to true.  This will only display chord
2009 names when there's a change in the chords scheme, but always display the
2010 chord name after a line break:
2011
2012 @c bug
2013 @quotation
2014 @lilypond[verbatim]
2015 scheme = \chords {
2016   c1:m \break c:m c:m c:m d
2017 }
2018
2019 \score {
2020   \notes <
2021     \context ChordNames \scheme
2022     \context Staff \transpose c'' \scheme
2023   >
2024   \paper{
2025     linewidth = 40 * \staffspace;
2026     \translator {
2027       \ChordNamesContext
2028       chordChanges = ##t
2029     }
2030   }
2031 }
2032 @end lilypond
2033 @end quotation
2034
2035
2036
2037 LilyPond examines chords specified as lists of notes to determine a
2038 name to give the chord. LilyPond will not try to
2039 identify chord inversions or added base, which may result in strange
2040 chord names when chords are entered as a list of pitches:
2041
2042 @quotation
2043 @lilypond[verbatim,center]
2044 scheme = \notes {
2045   <c'1 e' g'>
2046   <e' g' c''>
2047   <e e' g' c''>
2048 }
2049
2050 \score {
2051   <
2052     \context ChordNamesVoice \scheme
2053     \context Staff \scheme
2054   >
2055   \paper { linewidth = -1.; }
2056 }
2057 @end lilypond
2058 @end quotation
2059
2060 To specify chord inversions, append @code{/<notename>}.  To specify an
2061 added bass note, append @code{/+<notename}:
2062
2063 @quotation
2064 @lilypond[verbatim,center]
2065 scheme = \chords {
2066   d1 d/a d/+gis
2067 }
2068
2069 \score {
2070   \notes <
2071     \context ChordNames \scheme
2072     \context Staff \transpose c'' \scheme
2073   >
2074   \paper { linewidth = -1.; }
2075 }
2076 @end lilypond
2077 @end quotation
2078
2079 The chord names that LilyPond should print are fully customizable.  The
2080 code to print chord names is written in Scheme. It can be found in
2081 @file{scm/chord-name.scm}.  Chord names are based on Banter style
2082 naming, which is unambiguous and has a logical structure.  Typical
2083 American style chord names are implemented as a variation on Banter
2084 names, they can be selected by setting property @code{ChordName.style}
2085 to @code{american}:
2086
2087 @quotation
2088 @lilypond[verbatim]
2089 \include "english.ly"
2090
2091 scheme = \chords {
2092   c         % Major triad
2093   cs:m      % Minor triad
2094   df:m5-    % Diminished triad
2095   c:5^3     % Root-fifth chord
2096   c:4^3     % Suspended fourth triad
2097   c:5+      % Augmented triad
2098   c:2^3     % "2" chord
2099   c:m5-.7-  % Diminished seventh
2100   c:7+      % Major seventh
2101   c:7.4^3   % Dominant seventh suspended fourth
2102   c:5+.7    % Augmented dominant seventh
2103   c:m5-.7   % "Half" diminished seventh
2104   c:5-.7    % Dominant seventh flat fifth
2105   c:5-.7+   % Major seventh flat fifth
2106   c:m7+     % Minor-major seventh
2107   c:m7      % Minor seventh
2108   c:7       % Dominant seventh
2109   c:6       % Major sixth
2110   c:m6      % Minor sixth
2111   c:9^7     % Major triad w/added ninth
2112   c:6.9^7   % Six/Nine chord
2113   c:9       % Dominant ninth 
2114   c:7+.9    % Major ninth
2115   c:m7.9    % Minor ninth
2116 }
2117
2118 \score {
2119   \notes <
2120     \context ChordNames \scheme
2121     \context Staff \transpose c'' \scheme
2122   >
2123   \paper {
2124     \translator { 
2125       \ChordNamesContext
2126       ChordName \override #'word-space = #1 
2127       ChordName \override #'style = #'american
2128     }
2129   }
2130 }
2131 @end lilypond
2132 @end quotation
2133
2134 Similarly, Jazz style chord names are implemented as a variation on
2135 American style names:
2136 @quotation
2137 @lilypond[verbatim]
2138 scheme = \chords {
2139   % major chords
2140   c
2141   c:6           % 6 = major triad with added sixth
2142   c:maj         % triangle = maj
2143   c:6.9^7       % 6/9 
2144   c:9^7         % add9
2145
2146   % minor chords
2147   c:m           % m = minor triad
2148   c:m.6         % m6 = minor triad with added sixth
2149   c:m.7+        % m triangle = minor major seventh chord
2150   c:3-.6.9^7    % m6/9 
2151   c:m.7         % m7
2152   c:3-.9        % m9
2153   c:3-.9^7      % madd9
2154
2155   % dominant chords
2156   c:7           % 7 = dominant
2157   c:7.5+        % +7 = augmented dominant
2158   c:7.5-        % 7b5 = hard diminished dominant
2159   c:9           % 7(9)
2160   c:9-          % 7(b9)
2161   c:9+          % 7(#9)
2162   c:13^9.11     % 7(13)
2163   c:13-^9.11    % 7(b13)
2164   c:13^11       % 7(9,13)
2165   c:13.9-^11    % 7(b9,13)
2166   c:13.9+^11    % 7(#9,13)
2167   c:13-^11      % 7(9,b13)
2168   c:13-.9-^11   % 7(b9,b13)
2169   c:13-.9+^11   % 7(#9,b13)
2170
2171   % half diminished chords
2172   c:m5-.7               % slashed o = m7b5
2173   c:9.3-.5-     % o/7(pure 9)
2174
2175   % diminished chords
2176   c:m5-.7-      % o = diminished seventh chord
2177 }
2178
2179 \score {
2180   \notes <
2181     \context ChordNames \scheme
2182     \context Staff \transpose c'' \scheme
2183   >
2184   \paper {
2185     \translator { 
2186       \ChordNamesContext
2187       ChordName \override #'word-space = #1 
2188       ChordName \override #'style = #'jazz
2189     }
2190   }
2191 }
2192 @end lilypond
2193 @end quotation
2194
2195 @node Writing parts
2196 @section Writing parts
2197
2198 @c .  {Transpose}
2199 @menu
2200 * Rehearsal marks::             
2201 * Instrument names::            
2202 * Transpose::                   
2203 * Multi measure rests::         
2204 @end menu
2205
2206 [TODO:
2207
2208 partcombine
2209
2210 rehearsal marks
2211
2212 tranposing midi property.
2213
2214 instrument names
2215
2216
2217
2218 @c .   {Rehearsal marks}
2219 @node Rehearsal marks
2220 @subsection Rehearsal marks
2221 @cindex Rehearsal marks
2222 @cindex mark
2223 @cindex @code{\mark}
2224 @cindex @code{Mark_engraver}
2225
2226 @example
2227   \mark @var{unsigned};
2228   \mark @var{string};
2229   \mark ; 
2230 @end example
2231
2232 With this command, you can print a rehearsal mark above the system. You
2233 can provide a number, a string or a markup text as argument. If there is
2234 no argument, the property @code{rehearsalMark} is used and automatically
2235 incremented.
2236
2237 @lilypond[fragment,verbatim]
2238 \relative c'' {
2239   c1 \mark "A2";
2240   c1 \mark ; 
2241   c1 \mark ; 
2242   c1 \mark "12";
2243   c1 \mark #'(music "scripts-segno") ;
2244   c1
2245 }
2246 @end lilypond
2247
2248 @node Instrument names
2249 @subsection Instrument names
2250
2251 You can specify an instrument name for a staff by setting
2252 @code{Staff.instrument} and @code{Staff.instr}. This will print a string
2253 before the start of the staff. For the first start, @code{instrument} is
2254 used, for the next ones @code{instr} is used.
2255
2256 @lilypond[verbatim]
2257 \score { \notes {
2258   \property Staff.instrument = "instr " { c''4 } }
2259   \paper { linewidth = -1.;
2260     \translator { \StaffContext
2261     \consists "Instrument_name_engraver"; } } }
2262 @end lilypond
2263
2264 This requires  that you add the @code{Instrument_name_engraver} to the
2265 staff context.
2266
2267
2268 @node Transpose
2269 @subsection Transpose
2270 @cindex Transpose
2271 @cindex transposition of pitches
2272 @cindex @code{\transpose}
2273
2274 A music expression can be transposed with @code{\transpose}.  The syntax
2275 is
2276 @example
2277   \transpose @var{pitch} @var{musicexpr}
2278 @end example
2279
2280 This means that middle C in @var{musicexpr} is transposed to
2281 @var{pitch}.
2282
2283 @code{\transpose} distinguishes between enharmonic pitches: both
2284 @code{\transpose cis'} or @code{\transpose des'} will transpose up half
2285 a tone.  The first version will print sharps and the second version
2286 will print flats.
2287
2288 @quotation
2289 @lilypond[fragment,verbatim]
2290 \context Staff {
2291   \clef "F";
2292   { \key e \major; c d e f }
2293   \clef "G";
2294   \transpose des'' { \key e \major; c d e f }
2295   \transpose cis'' { \key e \major; c d e f }
2296 }
2297
2298 @end lilypond
2299 @end quotation
2300
2301 If you want to use both @code{\transpose} and @code{\relative}, then
2302 you must use @code{\transpose} first.  @code{\relative} will have no
2303 effect music that appears inside a @code{\transpose}.
2304
2305
2306 @c .  {Multi measure rests}
2307 @node  Multi measure rests
2308 @subsection Multi measure rests
2309 @cindex Multi measure rests
2310
2311 @cindex @code{R}
2312
2313 Multi measure rests are entered using `@code{R}'. It is specifically
2314 meant for entering parts: the rest can expand to fill a score with
2315 rests, or it can be printed as a single multimeasure rest This expansion
2316 is controlled by the property @code{Score.skipBars}. If this is set to true,
2317 Lily will not expand empty measures, and the appropriate number is added
2318 automatically.
2319
2320 @lilypond[fragment,verbatim]
2321  \time 3/4; R2.*2 \property Score.skipBars = ##t R2.*17  R2.*4
2322 @end lilypond
2323
2324 Currently, there is  no way to condense multiple rests into a single
2325 multimeasure rest.
2326
2327 @cindex condensing rests
2328
2329 @c . {Custodes}
2330 @node Custodes
2331 @section Custodes
2332 @cindex Custos
2333 @cindex Custodes
2334
2335 A @emph{custos} (plural: @emph{custodes}; latin word for "guard") is a
2336 staff context symbol that appears at the end of a staff line.  It
2337 anticipates the pitch of the first note(s) of the following line and
2338 thus helps the player or singer to manage line breaks during
2339 performance, thus enhancing readability of a score.
2340
2341 @quotation
2342 @lilypond[verbatim]
2343 \score {
2344   \notes { c'1 d' e' d' \break c' d' e' d' }
2345   \paper {
2346     \translator {
2347       \StaffContext
2348       \consists Custos_engraver;
2349       Custos \override #'style = #'mensural;
2350     }
2351   }
2352 }
2353 @end lilypond
2354 @end quotation
2355
2356 Custodes were frequently used in music notation until the 16th century.
2357 There were different appearences for different notation styles.
2358 Nowadays, they have survived only in special forms of musical notation
2359 such as via the editio vaticana dating back to the beginning of the 20th
2360 century.
2361
2362 For typesetting custodes, just put a @code{Custos_engraver} into the
2363 @code{StaffContext} when declaring the @code{\paper} block.  In this
2364 block, you can also globally control the appearance of the custos symbol
2365 by setting the custos @code{style} property.  Currently supported styles
2366 are @code{vaticana}, @code{medicaea}, @code{hufnagel} and
2367 @code{mensural}.
2368
2369 @quotation
2370 \paper @{
2371   \translator @{
2372       \StaffContext
2373       \consists Custos_engraver;
2374       Custos \override #'style = #'mensural;
2375   @}
2376 @}
2377 @end quotation
2378
2379 The property can also be set locally, for example in a @code{\notes}
2380 block:
2381
2382 @quotation
2383 \notes @{
2384   \property Staff.Custos \override #'style = #'vaticana
2385   c'1 d' e' d' \break c' d' e' d'
2386 @}
2387 @end quotation
2388
2389 @c . {Page layout}
2390 @node Page layout
2391 @section Page layout
2392 @cindex Page layout
2393
2394 @menu
2395 * Paper block::                 
2396 * Paper variables::             
2397 * Font Size::                   
2398 * Paper size::                  
2399 * Line break::                  
2400 * Page break::                  
2401 @end menu
2402
2403 @c .  {Paper block}
2404 @node Paper block
2405 @subsection Paper block
2406 @cindex Paper block
2407
2408 The most important output definition is the @code{\paper} block, for
2409 music notation.  The syntax is
2410
2411 @example
2412   @code{\paper @{} [@var{paperidentifier}] @var{items} @code{@}}
2413 @end example
2414
2415 where each of the items is one of
2416
2417 @itemize @bullet
2418   @item  An assignment.  The assignment must be terminated by a
2419        semicolon.  
2420
2421   @item  A context definition.  See section @ref{Context definitions} for
2422        more information on context definitions.
2423
2424   @item  \stylesheet  declaration.  Its syntax is
2425        @example
2426                 \stylesheet @var{alist}
2427        @end example
2428
2429         See @file{font.scm} for details of @var{alist}.
2430 @end itemize
2431
2432 @c .  {Paper variables}
2433 @node Paper variables
2434 @subsection Paper variables 
2435 @cindex Paper variables
2436
2437 The paper block has some variables you may want to use or change:
2438
2439 @table @code
2440 @cindex @code{indent}
2441   @item @code{indent}  
2442     The indentation of the first line of music.
2443 @cindex @code{staffspace}
2444
2445   @item @code{staffspace}
2446     The distance between two staff lines, calculated from the center
2447     of the lines.  You should use either this or @code{stafflinethickness}
2448     as a unit for distances you modify.
2449   
2450 @cindex @code{linewidth}
2451   @item @code{linewidth}  
2452     Sets the width of the lines.
2453
2454 If set to a negative value, a single
2455     unjustified line is produced.
2456
2457 @cindex @code{textheight}
2458
2459   @item @code{textheight}  
2460     Sets the total height of the music on each page. Only used by
2461     ly2dvi.
2462 @cindex @code{interscoreline}
2463
2464   @item @code{interscoreline}  
2465     Sets the spacing between the score lines. Defaults to 16 pt.
2466 @cindex @code{interscorelinefill}
2467
2468   @item @code{interscorelinefill}  
2469     If set to a positive number, the distance between the score 
2470     lines will stretch in order to fill the full page. In that
2471     case @code{interscoreline} specifies the minimum spacing.
2472     Defaults to 0.
2473 @cindex @code{stafflinethickness}
2474
2475   @item @code{stafflinethickness}  
2476     Determines the thickness of staff lines, and also acts as a scaling
2477     parameter for other line thicknesses.
2478 @end table
2479
2480
2481
2482 @c .  {Font size}
2483 @node Font Size
2484 @subsection Font size
2485 @cindex font size
2486
2487 The Feta font provides musical symbols at six different sizes.  These
2488 fonts are 11 point, 13 point, 16 point, 20 point,
2489 23 point, and 26 point.  The point size of a font is the
2490 height of the five lines in a staff when displayed in the font.
2491
2492 Definitions for these sizes are the files @file{paperSZ.ly}, where
2493 @code{SZ} is one of 11, 13, 16, 20, 23 and 26.  If you include any of
2494 these files, the identifiers @code{paperEleven}, @code{paperThirteen},
2495 @code{paperSixteen}, @code{paperTwenty}, @code{paperTwentythree}, and
2496 @code{paperTwentysix} are defined respectively.  The default
2497 @code{\paper} block is also set.
2498
2499 The font definitions are generated using a Scheme function. For more
2500 details, see the file @file{font.scm}.
2501
2502
2503
2504 @c .  {Paper size}
2505 @node Paper size
2506 @subsection Paper size
2507 @cindex Paper size
2508
2509 @cindex paper size
2510 @cindex page size
2511 @cindex @code{papersize}
2512
2513 To change the paper size, you must first set the
2514 @code{papersize} variable at top level.  Set it to
2515 the strings @code{a4}, @code{letter}, or @code{legal}.  After this
2516 specification, you must set the font as described above.  If you want
2517 the default font, then use the 20 point font.  The new paper size will
2518 not take effect if the font is not loaded and selected afterwards.
2519
2520 @example
2521         papersize = "a4"
2522         \include "paper16.ly"
2523
2524         \score @{
2525                 ...
2526                 \paper @{ \paperSixteen @}
2527         @}
2528 @end example
2529
2530 The file "paper16.ly" will now include a file named @file{a4.ly}, which
2531 will set the paper variables @code{hsize} and @code{vsize} (used by
2532 @code{ly2dvi})
2533
2534
2535
2536
2537
2538
2539
2540 @c .  {Line break}
2541 @node Line break
2542 @subsection Line break
2543
2544 @cindex line breaks
2545 @cindex breaking lines
2546
2547 Line breaks are normally computed automatically. They are chosen such
2548 that the resulting spacing has low variation, and looks neither cramped
2549 nor loose.
2550
2551 Occasionally you might want to override the automatic breaks; you can do
2552 this by specifying @code{\break}. This will force a line break at this
2553 point. Do remember that line breaks can only occur at places where there
2554 are barlines.  If you want to have a line break where there is no
2555 barline, you can force a barline by entering @code{\bar "";}.
2556
2557 Similarly, @code{\noBreak} forbids a  line break at a certain point.
2558
2559 @cindex @code{\penalty}
2560
2561 The @code{\break} and @code{\noBreak} commands are defined in terms of
2562 the penalty command:
2563 @example
2564   \penalty @var{int} @code{;}
2565 @end example
2566
2567 This imposes   encourages or discourages LilyPond to make a line break
2568 at this point.
2569
2570 @strong{Warning} do not use @code{\penalty} directly. It is rather
2571 kludgy, and slated for rewriting.
2572
2573 @c .  {Page break}
2574 @node Page break
2575 @subsection Page break
2576
2577 @cindex page breaks
2578 @cindex breaking pages
2579
2580
2581 Page breaks are normally computed by @TeX{}, so they are not under direct
2582 control.  However, you can insert a commands into the @file{.tex} output to
2583 instruct @TeX{} where to break pages. For more details, see  the
2584 example file @file{input/test/between-systems.ly}
2585
2586 [or -> Tricks? ]
2587
2588
2589
2590
2591
2592
2593 @c . {Sound}
2594 @node Sound
2595 @section Sound
2596 @cindex Sound
2597 @menu
2598 * MIDI block::                  
2599 * MIDI instrument names::       
2600 * Tempo::                       
2601 @end menu
2602
2603 @c .  {MIDI block}
2604 @node MIDI block
2605 @subsection MIDI block
2606 @cindex MIDI block
2607
2608
2609 The MIDI block is analogous to the paper block, but it is somewhat
2610 simpler.  The @code{\midi} block can contain:
2611 @cindex MIDI block
2612
2613 @itemize @bullet
2614   @item  a @code{\tempo} definition
2615   @item  context definitions
2616 @end itemize
2617
2618 Assignments in the @code{\midi} block are not allowed.
2619
2620
2621
2622 @cindex context definition
2623
2624 Context definitions follow precisely the same syntax as within the
2625 \paper block.  Translation modules for sound are called performers.
2626 The contexts for MIDI output are defined in @file{ly/performer.ly}.
2627
2628
2629 @c .  {MIDI instrument names}
2630 @node MIDI instrument names
2631 @subsection MIDI instrument names
2632 @cindex instrument names
2633 @cindex @code{Staff.midiInstrument}
2634 @cindex @code{Staff.instrument}
2635
2636 The MIDI instrument name is set by the @code{Staff.midiInstrument}
2637 property or, if that property is not set, the @code{Staff.instrument}
2638 property.  The instrument name should be chosen from the following list.
2639 If the selected string does not exactly match, then LilyPond uses the
2640 default piano.
2641
2642 [FIXME: to appendix ]
2643
2644
2645 @example 
2646 "acoustic grand"            "contrabass"           "lead 7 (fifths)"
2647 "bright acoustic"           "tremolo strings"      "lead 8 (bass+lead)"
2648 "electric grand"            "pizzicato strings"    "pad 1 (new age)"
2649 "honky-tonk"                "orchestral strings"   "pad 2 (warm)"
2650 "electric piano 1"          "timpani"              "pad 3 (polysynth)"
2651 "electric piano 2"          "string ensemble 1"    "pad 4 (choir)"
2652 "harpsichord"               "string ensemble 2"    "pad 5 (bowed)"
2653 "clav"                      "synthstrings 1"       "pad 6 (metallic)"
2654 "celesta"                   "synthstrings 2"       "pad 7 (halo)"
2655 "glockenspiel"              "choir aahs"           "pad 8 (sweep)"
2656 "music box"                 "voice oohs"           "fx 1 (rain)"
2657 "vibraphone"                "synth voice"          "fx 2 (soundtrack)"
2658 "marimba"                   "orchestra hit"        "fx 3 (crystal)"
2659 "xylophone"                 "trumpet"              "fx 4 (atmosphere)"
2660 "tubular bells"             "trombone"             "fx 5 (brightness)"
2661 "dulcimer"                  "tuba"                 "fx 6 (goblins)"
2662 "drawbar organ"             "muted trumpet"        "fx 7 (echoes)"
2663 "percussive organ"          "french horn"          "fx 8 (sci-fi)"
2664 "rock organ"                "brass section"        "sitar"
2665 "church organ"              "synthbrass 1"         "banjo"
2666 "reed organ"                "synthbrass 2"         "shamisen"
2667 "accordion"                 "soprano sax"          "koto"
2668 "harmonica"                 "alto sax"             "kalimba"
2669 "concertina"                "tenor sax"            "bagpipe"
2670 "acoustic guitar (nylon)"   "baritone sax"         "fiddle"
2671 "acoustic guitar (steel)"   "oboe"                 "shanai"
2672 "electric guitar (jazz)"    "english horn"         "tinkle bell"
2673 "electric guitar (clean)"   "bassoon"              "agogo"
2674 "electric guitar (muted)"   "clarinet"             "steel drums"
2675 "overdriven guitar"         "piccolo"              "woodblock"
2676 "distorted guitar"          "flute"                "taiko drum"
2677 "guitar harmonics"          "recorder"             "melodic tom"
2678 "acoustic bass"             "pan flute"            "synth drum"
2679 "electric bass (finger)"    "blown bottle"         "reverse cymbal"
2680 "electric bass (pick)"      "skakuhachi"           "guitar fret noise"
2681 "fretless bass"             "whistle"              "breath noise"
2682 "slap bass 1"               "ocarina"              "seashore"
2683 "slap bass 2"               "lead 1 (square)"      "bird tweet"
2684 "synth bass 1"              "lead 2 (sawtooth)"    "telephone ring"
2685 "synth bass 2"              "lead 3 (calliope)"    "helicopter"
2686 "violin"                    "lead 4 (chiff)"       "applause"
2687 "viola"                     "lead 5 (charang)"     "gunshot"
2688 "cello"                     "lead 6 (voice)" 
2689 @end example 
2690
2691
2692
2693
2694
2695 @c .  {Tempo}
2696 @node Tempo
2697 @subsection Tempo
2698 @cindex Tempo
2699 @cindex beats per minute
2700 @cindex metronome marking
2701
2702 @cindex @code{\tempo}
2703 @example
2704   \tempo @var{duration} = @var{perminute} @code{;}
2705 @end example
2706
2707 Used to specify the tempo.  For example, @code{\tempo 4 = 76;} requests
2708 output with 76 quarter notes per minute.
2709
2710
2711
2712
2713
2714 @c . {Music entry}
2715 @node Music entry
2716 @section Music entry
2717 @cindex Music entry
2718 @menu
2719 * Relative::                    
2720 * Point and click::             
2721 @end menu
2722
2723
2724
2725 @c .  {Relative}
2726 @node Relative
2727 @subsection Relative
2728 @cindex Relative
2729 @cindex relative octave specification
2730
2731 Octaves are specified by adding @code{'} and @code{,} to pitch names.
2732 When you copy existing music, it is easy to accidentally put a pitch in
2733 the wrong octave and hard to find such an error.  To prevent these
2734 errors, LilyPond features octave entry.
2735
2736 @cindex @code{\relative}
2737 @example
2738   \relative @var{startpitch} @var{musicexpr}
2739 @end example
2740
2741 The octave of notes that appear in @var{musicexpr} are calculated as
2742 follows: If no octave changing marks are used, the basic interval
2743 between this and the last note is always taken to be a fourth or less.
2744   The octave changing marks @code{'} and @code{,} can then
2745 be added to raise or lower the pitch by an extra octave.  Upon entering
2746 relative mode, an absolute starting pitch must be specified that will
2747 act as the predecessor of the first note of @var{musicexpr}.
2748
2749 This distance is determined without regarding accidentals: a
2750 @code{fisis} following a @code{ceses} will be put above the
2751 @code{ceses}.
2752
2753 Entering scales is straightforward in relative mode.
2754
2755 @lilypond[fragment,verbatim,center]
2756   \relative c'' {
2757     g a b c d e f g g, g
2758   }
2759 @end lilypond
2760
2761 And octave changing marks are used for intervals greater than a fourth.
2762
2763 @lilypond[fragment,verbatim,center]
2764   \relative c'' {
2765     c g c f, c' a, e'' }
2766 @end lilypond
2767
2768 If the preceding item is a chord, the first note of the chord is used
2769 to determine the first note of the next chord.  But other notes
2770 within the second chord are determined by looking at the immediately
2771 preceding note.
2772
2773 @lilypond[fragment,verbatim,center]
2774   \relative c' {
2775     c <c e g> 
2776     <c' e g>
2777     <c, e' g>
2778   }
2779 @end lilypond 
2780 @cindex @code{\notes}
2781
2782 The pitch after the @code{\relative} contains a notename.  To parse
2783 the pitch as a notename, you have to be in note mode, so there must
2784 be a surrounding @code{\notes} keyword (which is not
2785 shown here).
2786
2787 The relative conversion will not affect @code{\transpose} or
2788 @code{\relative} sections in its argument.  If you want to use
2789 relative within transposed music, you must place an additional
2790 @code{\relative} inside the @code{\transpose}.
2791
2792
2793 @c .  {Point and click}
2794 @node Point and click
2795 @subsection Point and click
2796
2797 [todo]
2798
2799 @c . {Engravers}
2800 @node Engravers
2801 @section Engravers
2802 @cindex engravers
2803 @menu
2804 * Selecting contexts::          
2805 * Context definitions::         
2806 * Notation Contexts::           
2807 @end menu
2808
2809 @c .  {Music expressions}
2810 @node Selecting contexts
2811 @subsection Selecting contexts
2812
2813 @cindex @code{\context}
2814 @cindex context selection
2815
2816 @example
2817   \context @var{contexttype} [= @var{contextname}] @var{musicexpr}
2818 @end example
2819
2820 Interpret @var{musicexpr} within a context of type @var{contexttype}. 
2821 If the context does not exist, it will be created.  The new context
2822 can optionally be given a name.  
2823
2824
2825
2826 @c .  {Context definitions}
2827 @node Context definitions
2828 @subsection Context definitions
2829
2830 @cindex context definition
2831 @cindex translator definition
2832 @cindex engraver hacking
2833
2834
2835 A notation contexts is defined by the following information
2836
2837 @enumerate 1
2838   @item  A name.
2839
2840   @item  The LilyPond modules that do the actual conversion of music to
2841        notation.  Each module is a so-called
2842        @emph{engraver}
2843 @cindex engraver
2844 .
2845
2846   @item  How these modules should cooperate, i.e. which ``cooperation
2847        module'' should be used.  This cooperation module is a special
2848        type of engraver.
2849
2850   @item  What other contexts the context can contain,
2851
2852   @item  What properties are defined.
2853 @end enumerate
2854
2855 A context definition has this syntax:
2856
2857 @example
2858
2859   \translator @code{@{}
2860                       @var{translatorinit} @var{translatormodifierlist}
2861                     @code{@}}
2862 @end example
2863
2864 @var{translatorinit} can be an identifier or 
2865 @example
2866   \type @var{typename} @code{;}
2867 @end example
2868 where @var{typename} is one of
2869
2870 @table @code
2871 @cindex @code{Engraver_group_engraver}
2872   @item @code{Engraver_group_engraver}  
2873     The standard cooperation engraver.
2874 @cindex @code{Score_engraver}
2875
2876   @item @code{Score_engraver}  
2877     This is cooperation module that should be in the top level context.
2878 @cindex @code{Grace_engraver_group}
2879
2880   @item @code{Grace_engraver_group}  
2881     This is a special cooperation module (resembling
2882     @code{Score_engraver}) that is used to created an embedded
2883     `miniscore'.
2884 @end table 
2885
2886 @var{translatormodifierlist} is a list of items where each item is
2887 one of
2888
2889 @itemize @bullet
2890   @item  @code{\consists} @var{engravername} @code{;}  
2891     Add @var{engravername} to the list of modules in this context. 
2892   The order of engravers added with @code{\consists} is
2893     significant.
2894   
2895   @item  @code{\consistsend} @var{engravername} @code{;}  
2896     Analogous to @code{\consists}, but makes sure that
2897     @var{engravername} is always added to the end of the list of
2898     engravers.
2899
2900     Some engraver types need to be at the end of the list; this
2901     insures they are put there, and stay there, if a user adds or
2902     removes engravers.  This command is usually not needed for
2903     end-users.
2904     
2905   @item  @code{\accepts} @var{contextname} @code{;}  
2906     Add @var{contextname} to the list of  context this context can
2907     contain.  The first listed context is the context to create by
2908     default.
2909
2910   @item @code{\denies}. The opposite of @code{\accepts}. Added for
2911 completeness, but is never used in practice.
2912  
2913   
2914   @item  @code{\remove} @var{engravername} @code{;}  
2915     Remove a previously added (with @code{\consists}) engraver.
2916   
2917   @item  @code{\name} @var{contextname} @code{;}  
2918     This sets name of the context, e.g. @code{Staff}, @code{Voice}.  If
2919     the name is not specified, the translator won't do anything.
2920
2921   @item  @var{propname} @code{=} @var{value} @code{;}  
2922     A property assignment.
2923 @end itemize
2924
2925 In the @code{\paper} block, it is also possible to define translator
2926 identifiers.  Like other block identifiers, the identifier can only
2927 be used as the very first item of a translator.  In order to define
2928 such an identifier outside of @code{\score}, you must do
2929
2930 @quotation
2931
2932 @example 
2933 \paper @{
2934   foo = \translator @{ @dots{} @}
2935 @}
2936 \score @{
2937   \notes @{
2938     @dots{}
2939   @}
2940   \paper @{
2941     \translator @{ \foo @dots{} @}
2942   @}
2943 @} 
2944 @end example 
2945
2946 @end quotation
2947
2948
2949 @cindex paper types, engravers, and pre-defined translators
2950
2951 Some pre-defined identifiers can simplify modification of
2952 translators.  The pre-defined identifiers are:
2953
2954 @table @code
2955 @cindex @code{StaffContext}
2956   @item @code{StaffContext}  
2957     Default Staff context. 
2958 @cindex @code{RhythmicStaffContext}
2959
2960   @item @code{RhythmicStaffContext}  
2961     Default RhythmicStaff context. 
2962 @cindex @code{VoiceContext}
2963
2964   @item @code{VoiceContext}  
2965     Default Voice context.  
2966 @cindex @code{ScoreContext}
2967
2968   @item @code{ScoreContext}  
2969     Default Score context. 
2970
2971 @cindex @code{HaraKiriStaffContext}
2972
2973   @item @code{HaraKiriStaffContext}  
2974     Staff context that does not print if it only contains rests. 
2975     Useful for orchestral scores.@footnote{Harakiri, also called
2976     Seppuku, is the ritual suicide of the Japanese Samourai warriors.}
2977
2978 @end table
2979
2980 Using these pre-defined values, you can remove or add items to the
2981 translator:
2982
2983 @quotation
2984
2985 @example 
2986 \paper @{
2987   \translator @{
2988     \StaffContext
2989     \remove Some_engraver;
2990     \consists Different_engraver;
2991   @}
2992 @} 
2993 @end example 
2994
2995 @end quotation
2996
2997       
2998
2999
3000 @c .  {Notation Contexts}
3001 @node Notation Contexts
3002 @subsection Notation Contexts
3003
3004 @cindex notation contexts
3005
3006 Notation contexts are objects that only exist during a run of
3007 LilyPond.  During the interpretation phase of LilyPond, the Music
3008 expression contained in a @code{\score} block is interpreted in time
3009 order.  This is the order in which humans read, play, and write
3010 music.
3011
3012 A context is an object that holds the reading state of the
3013 expression; it contains information like
3014
3015 @itemize @bullet
3016   @item What notes are playing at this point?
3017   @item What symbols will be printed at this point?
3018   @item In what style will they printed?
3019   @item What is the current key signature, time signature, point within
3020        the measure, etc.?
3021 @end itemize
3022
3023 Contexts are grouped hierarchically: A @code{Voice} context is
3024 contained in a @code{Staff} context (because a staff can contain
3025 multiple voices at any point), a @code{Staff} context is contained in
3026 a @code{Score}, @code{StaffGroup}, or @code{ChoirStaff} context (because
3027 these can all contain multiple staffs).
3028
3029 Contexts associated with sheet music output are called @emph{notation
3030 contexts}, those for sound output are called performance contexts.
3031
3032 Contexts are created either manually or automatically.  Initially, the
3033 top level music expression is interpreted by the top level context (the
3034 @code{Score} context).  When a atomic music expression (i.e. a note, a
3035 rest, etc.), a nested set of contexts is created that can process these
3036 atomic expressions, as in this example:
3037
3038 @example
3039 \score @{ \notes @{ c4 @} @} 
3040 @end example 
3041
3042 The sequential music, `@code{@{ c4 @}}' is interpreted by @code{Score}
3043 context. When the note @code{c4} itself is interpreted, a set of
3044 contexts is needed that will accept notes.  The default for this is a
3045 @code{Voice} context, contained in a @code{Staff} context.  Creation of
3046 these contexts results in the staff being printed.
3047
3048 @cindex context
3049
3050 You can also create contexts manually, and you probably have to do so
3051 if you want to typeset complicated multiple part material.  If a
3052 `@code{\context} @var{name} @var{musicexpr}' expression is encountered
3053 during the interpretation phase, the @var{musicexpr} argument will be
3054 interpreted with a context of type @var{name}.  If you specify a name,
3055 the specific context with that name is searched.
3056
3057 [type vs id]
3058
3059 If a context of the specified type and name can not be found, a new
3060 one is created.  For example,
3061
3062 @quotation
3063
3064 @lilypond[verbatim]
3065 \score {
3066   \notes \relative c'' {
3067     c4 <d4 \context Staff = "another" e4> f
3068   }
3069 }
3070
3071 @end lilypond
3072 @end quotation
3073
3074 In this example, the @code{c} and @code{d} are printed on the
3075 default staff.  For the @code{e}, a context Staff called
3076 @code{another} is specified; since that does not exist, a new
3077 context is created.  Within @code{another}, a (default) Voice context
3078 is created for the @code{e4}.  When all music referring to a
3079 context is finished, the context is ended as well.  So after the
3080 third quarter, @code{another} is removed.
3081
3082 Almost all music expressions inherit their interpretation context
3083 from their parent.  In other words, suppose that the syntax for a
3084 music expression is
3085
3086 @example
3087
3088   \keyword @var{musicexpr1} @var{musicexpr2} @dots{}
3089 @end example
3090
3091 When the interpretation of this music expression starts, the context
3092 for @var{musicexpr1}, @var{musicexpr2}, etc. is that of the total
3093 expression.
3094
3095 Lastly, you may wonder, why this:
3096
3097 @quotation
3098
3099 @example 
3100 \score @{
3101   \notes \relative c'' @{
3102     c4 d4 e4
3103   @}
3104 @} 
3105 @end example 
3106
3107 @end quotation
3108
3109 doesn't result in this:
3110
3111 @lilypond[]
3112
3113   \score {
3114     \notes \relative c'' {
3115       <c4> <d4> <e4>
3116     }
3117   }
3118
3119 @end lilypond
3120
3121 For the @code{c4}, a default @code{Staff} (with a contained
3122 @code{Voice}) context is created.  After the @code{c4} ends, no
3123 music refers to this default staff, so it would be ended, with the
3124 result shown.  To prevent this inconvenient behavior, the context to
3125 which the sequential music refers is adjusted during the
3126 interpretation.  So after the @code{c4} ends, the context of the
3127 sequential music is also the default @code{Voice} context. 
3128 The @code{d4} gets interpreted in the same context
3129 as @code{c4}.
3130
3131 Properties that are set in one context are inherited by all of the
3132 contained contexts.  This means that a property valid for the
3133 @code{Voice} context can be set in the @code{Score} context (for
3134 example) and thus take effect in all @code{Voice} contexts.
3135
3136 Properties can be preset within the @code{\translator} block
3137 corresponding to the appropriate context.  In this case, the syntax
3138 is
3139
3140 @example
3141   @var{propname} @code{=} @var{value}
3142 @end example
3143
3144 This assignment happens before interpretation starts, so a
3145 @code{\property} expression will override any predefined settings.
3146
3147 The property settings are used during the interpretation phase.  They
3148 are read by the LilyPond modules where interpretation contexts are
3149 built of.  These modules are called @emph{translators}.  Translators for
3150 notation are called @emph{engravers}, and translators for sound are
3151 called @emph{performers}.
3152
3153
3154
3155 @c . {Syntactic details}
3156 @node Syntactic details
3157 @section Syntactic details
3158 @cindex Syntactic details
3159 @menu
3160 * Top level::                   
3161 * Identifiers::                 
3162 * Music expressions::           
3163 * Manipulating music expressions::  
3164 * Assignments::                 
3165 * Lexical details::             
3166 * Lexical modes::               
3167 * Ambiguities::                 
3168 @end menu
3169
3170 @c .  {Top level}
3171 @node Top level
3172 @subsection Top level
3173 @cindex Top level
3174
3175 This section describes what you may enter at top level.
3176
3177
3178 @unnumberedsubsec Score definition
3179 @cindex score definition
3180
3181 The output is generated combining a music expression with an output
3182 definition.  A score block has the following syntax:
3183
3184 @example
3185   \score @{ @var{musicexpr} @var{outputdefs} @}
3186 @end example
3187
3188 @var{outputdefs} are zero or more output definitions.  If no output
3189 definition is supplied, the default @code{\paper} block will be added.
3190
3191
3192 @c .   {Score}
3193 @subsubsection Score
3194 @cindex Score
3195
3196 @c .   {Paper}
3197 @subsubsection Paper
3198 @cindex Paper
3199
3200 @c .   {Midi}
3201 @subsubsection Midi
3202 @cindex Midi
3203
3204 @c .   {Header}
3205 @subsubsection Header
3206 @cindex Header
3207 @cindex @code{\header}
3208
3209 The syntax is
3210
3211 @example
3212   \header @{ @var{key1} = @var{val1};
3213 @cindex @code{ly2dvi}
3214              @var{key2} = @var{val2}; @dots{} @}
3215 @end example
3216
3217
3218 A header describes the file's contents.  It can also appear in a
3219 @code{\score} block.  Tools like @code{ly2dvi} can use this
3220 information for generating titles.  Key values that are used by
3221 @code{ly2dvi} are: title, subtitle, composer, opus, poet, instrument,
3222 metre, arranger, piece and tagline.
3223
3224 It is customary to put the @code{\header} at the top of the file.
3225
3226 @subsubsection Default output
3227
3228 A @code{\midi} or @code{\paper} block at top-level sets the default
3229
3230 paper block for all scores that lack an explicit paper block.
3231
3232 @c .  {Identifiers}
3233 @node Identifiers
3234 @subsection Identifiers
3235 @cindex  Identifiers
3236
3237 All of the information in a LilyPond input file, is represented as a
3238 Scheme value. In addition to normal Scheme data types (such as pair,
3239 number, boolean, etc.), LilyPond has a number of specialized data types,
3240
3241 @itemize @bullet
3242 @item Input
3243 @item c++-function
3244 @item Music
3245 @item Identifier
3246 @item Translator_def
3247 @item Duration
3248 @item Pitch
3249 @item Score
3250 @item Music_output_def
3251 @item Moment (rational number)
3252 @end itemize
3253
3254 LilyPond also includes some transient object types. Objects of these
3255 types are built during a LilyPond run, and do not `exist' per se within
3256 your input file. These objects are created as a result of your input
3257 file, so you can include commands in the input to manipulate them,
3258 during a lilypond run.
3259
3260 @itemize @bullet
3261 @item Grob: short for Graphical object. See @ref{Grobs}. 
3262 @item Molecule: device-independent page output object,
3263 including dimensions.  Produced by some Grob functions
3264 See @ref{Molecules}
3265 @item Translator: object that produces audio objects or Grobs. This is
3266 not yet user accessible.
3267 @item Font_metric: object representing a font. (See @ref{Font metrics})
3268
3269 @end itemize
3270
3271
3272 @node Music expressions
3273 @subsection Music expressions
3274
3275 @cindex music expressions
3276
3277 Music in LilyPond is entered as a music expression.  Notes, rests, lyric
3278 syllables are music expressions, and you can combine music expressions
3279 to form new ones, for example by enclosing a list of expressions in
3280 @code{\sequential @{ @}} or @code{< >}.  In this example, a compound
3281 expression is formed out of the quarter note @code{c} and a quarter note
3282 @code{d}:
3283
3284 @example 
3285 \sequential @{ c4 d4 @} 
3286 @end example 
3287
3288 @cindex Sequential music
3289 @cindex @code{\sequential}
3290 @cindex sequential music
3291 @cindex @code{<}
3292 @cindex @code{>}
3293 @cindex Simultaneous music
3294 @cindex @code{\simultaneous}
3295
3296 The two basic compound  music expressions are simultaneous  and
3297 sequential music.
3298
3299 @example
3300   \sequential @code{@{} @var{musicexprlist} @code{@}}
3301   \simultaneous @code{@{} @var{musicexprlist} @code{@}}
3302 @end example
3303 For both, there is a shorthand:
3304 @example
3305   @code{@{} @var{musicexprlist} @code{@}}
3306 @end example
3307 for sequential and
3308 @example
3309   @code{<} @var{musicexprlist} @code{>}
3310 @end example
3311 for simultaneous music.
3312 Other compound music expressions include
3313 @example
3314  \repeat @var{expr}
3315  \transpose @var{pitch} @var{expr}
3316  \apply @var{func} @var{expr}
3317  \context @var{type} = @var{id} @var{expr}
3318  \times @var{fraction} @var{expr}
3319 @end example
3320
3321 In principle, the way in which you nest sequential and simultaneous to
3322 produce music is not relevant.  In the following example, three chords
3323 are expressed in two different ways:
3324
3325 @lilypond[fragment,verbatim,center]
3326   \notes \context Voice {
3327     <a c'> <b  d' > <c' e'>
3328     < { a b  c' } { c' d' e' } >
3329   }
3330 @end lilypond
3331
3332 However, in some cases, LilyPond will also try to choose contexts, and
3333 use the structure of the music expression  to do so. This can have
3334 undesired effects: for example, LilyPond will create a separate staff
3335 for each note if you start a @code{\score} with a  chord:
3336 @lilypond[verbatim,center]
3337   \score {
3338     \notes <c''4 e''>
3339     \paper {
3340       linewidth = -1.;
3341     }
3342   }
3343 @end lilypond
3344   The solution is to explicitly instantiate the context you desire.
3345 In this case this is typically a Voice context
3346 @lilypond[verbatim,center]
3347   \score {
3348     \notes\context Voice <c''4 e''>
3349     \paper {
3350       linewidth = -1.;
3351     }
3352   }
3353 @end lilypond
3354 If you use @code{\context Staff} you will get separate stems for each
3355 note head, leading to collisions, so don't use that.
3356
3357
3358
3359 @c . {Manipulating music expressions}
3360 @node Manipulating music expressions
3361 @subsection  Manipulating music expressions
3362
3363 The @code{\apply} mechanism gives you access to the internal
3364 representation of music. You can write Scheme-functions that operate
3365 directly on it. The syntax is 
3366 @example
3367         \apply #@var{func} @var{music}
3368 @end example
3369 This means that @var{func} is applied to @var{music}.  The function
3370 @var{func} should return a music expression.
3371
3372 This example replaces the text string of a script. It also shows a dump
3373 of the music it processes, which is useful if you want to know more
3374 about how music is stored.
3375 @lilypond[verbatim]
3376 #(define (testfunc x)
3377         (if (equal? (ly-get-mus-property x 'text) "foo")
3378                 (ly-set-mus-property x 'text "bar"))
3379         ;; recurse
3380         (ly-set-mus-property x 'elements
3381           (map testfunc (ly-get-mus-property x 'elements)))
3382         (display x)
3383         x        
3384 )
3385 \score { \notes
3386   \apply #testfunc { c4_"foo" }
3387
3388 @end lilypond
3389
3390 For more information on what is possible, see the @ref{Tricks} and the
3391 automatically generated documentation.
3392
3393 As always: directly accessing internal representations is dangerous: the
3394 implementation is subject to changes, so you should not use this if
3395 possible.
3396
3397
3398 @c .   {Assignments}
3399 @node Assignments
3400 @subsection Assignments
3401 @cindex Assignments
3402
3403 Identifiers allow objects to be assigned to names during the parse
3404 stage.  To assign an identifier, you use @var{name}@code{=}@var{value}
3405 and to refer to an identifier, you preceed its name with a backslash:
3406 `@code{\}@var{name}'.  @var{value} is any valid Scheme value or any of
3407 the input-types listed above.  Identifier assignments can appear at top
3408 level in the LilyPond file, but also in @code{\paper} blocks.
3409
3410 Semicolons are forbidden after top level assignments, but mandatory in
3411 other places. The rules about semicolons and assignments are very
3412 confusing, but when LilyPond input evolves more towards Scheme, we hope
3413 that this problem will grow smaller.
3414
3415 An identifier can be created with any string for its name, but you will
3416 only be able to refer to identifiers whose names begin with a letter,
3417 being entirely alphabetical.  It is impossible to refer to an identifier
3418 whose name is the same as the name of a keyword.
3419
3420 The right hand side of an identifier assignment is parsed completely
3421 before the assignment is done, so it is allowed to redefine an
3422 identifier in terms of its old value, e.g.
3423
3424 @example
3425 foo = \foo * 2.0
3426 @end example
3427
3428 When an identifier is referenced, the information it points to is
3429 copied.  For this reason, an identifier reference must always be the
3430 first item in a block.
3431 @example
3432 \paper  @{
3433         foo = 1.0
3434         \paperIdent % wrong and invalid
3435 @}
3436
3437 \paper @{
3438         \paperIdent % correct
3439         foo = 1.0 @}
3440 @end example
3441
3442 @c .  {Lexical details}
3443 @node Lexical details
3444 @subsection Lexical details
3445 @cindex Lexical details
3446 @menu
3447 @end menu
3448
3449 @c .   {Comments}
3450 @subsubsection Comments
3451 @cindex Comments
3452
3453 @cindex @code{%}
3454
3455
3456 A one line comment is introduced by a @code{%} character. 
3457 Block comments are started by @code{%@{} and ended by @code{%@}}. 
3458 They cannot be nested.
3459
3460 @c .  {Direct Scheme}
3461 @subsubsection Direct Scheme
3462 @cindex Scheme
3463 @cindex GUILE
3464 @cindex Scheme, in-line code
3465
3466
3467 LilyPond contains a Scheme interpreter (the GUILE library) for
3468 internal use. In some places Scheme expressions also form valid syntax:
3469 whereever it is allowed,
3470 @example
3471   #@var{scheme}
3472 @end example
3473 evaluates the specified Scheme code. If this is used at toplevel, then
3474 the result is discarded. Example:
3475 @example
3476   \property Staff.TestObject \override #'foobar =  #(+ 1 2)
3477 @end example
3478
3479 @code{\override} expects two Scheme expressions, so there are two Scheme
3480 expressions. The first one is a symbol (@code{foobar}), the second one
3481 an integer (namely, 3).
3482
3483 Scheme is a full-blown programming language, and a full discussion is
3484 outside the scope of this document. Interested readers are referred to
3485 the website @uref{http://www.schemers.org/} for more information on
3486 Scheme.
3487
3488
3489 @c .   {Keywords}
3490 @subsubsection Keywords
3491 @cindex Keywords
3492
3493
3494 Keywords start with a backslash, followed by a number of lower case
3495 alphabetic characters.  These are all the keywords.
3496
3497 @example
3498 apply arpeggio autochange spanrequest commandspanrequest
3499 simultaneous sequential accepts alternative bar breathe
3500 char chordmodifiers chords clef cm consists consistsend
3501 context denies duration dynamicscript elementdescriptions
3502 font grace header in lyrics key mark pitch
3503 time times midi mm name pitchnames notes outputproperty
3504 override set revert partial paper penalty property pt
3505 relative remove repeat addlyrics partcombine score
3506 script stylesheet skip textscript tempo translator
3507 transpose type
3508 @end example
3509
3510 @c .   {Integers}
3511 @subsubsection Integers
3512
3513 @cindex integers
3514 @cindex @code{+}
3515 @cindex @code{-}
3516 @cindex @code{*}
3517 @cindex @code{/}
3518
3519 Formed from an optional minus sign followed by digits.  Arithmetic
3520 operations cannot be done with integers, and integers cannot be mixed
3521 with reals.
3522
3523 @c .   {Reals}
3524 @subsubsection Reals
3525 @cindex real numbers
3526
3527
3528
3529
3530
3531 Formed from an optional minus sign and a sequence of digits followed
3532 by a @emph{required} decimal point and an optional exponent such as
3533 @code{-1.2e3}.  Reals can be built up using the usual operations:
3534 `@code{+}', `@code{-}', `@code{*}', and
3535 `@code{/}', with parentheses for grouping.
3536
3537 @cindex @code{\mm},
3538 @cindex @code{\in}
3539 @cindex @code{\cm}
3540 @cindex @code{\pt}
3541 @cindex dimensions
3542
3543 A real constant can be followed by one of the dimension keywords:
3544 @code{\mm} @code{\pt}, @code{\in}, or @code{\cm}, for millimeters,
3545 points, inches and centimeters, respectively.  This converts the number
3546 to a real that is the internal representation of dimensions.
3547
3548
3549 @c .   {Strings}
3550 @subsubsection Strings
3551 @cindex string
3552 @cindex concatenate
3553
3554 Begins and ends with the @code{"} character.  To include a @code{"}
3555 character in a string write @code{\"}.  Various other backslash
3556 sequences have special interpretations as in the C language.  A string
3557 that contains no spaces can be written without the quotes.  See
3558 @ref{Lexical modes} for details on unquoted strings; their
3559 interpretation varies depending on the situation.  Strings can be
3560 concatenated with the @code{+} operator.
3561
3562 The tokenizer accepts the following commands. They have no grammatical
3563 function, hence they can appear anywhere in the input.
3564
3565
3566 @c .   {Main input}
3567 @subsubsection Main input
3568 @cindex Main input
3569
3570 @cindex @code{\maininput}
3571
3572 The @code{\maininput} command is used in init files to signal that the
3573 user file must be read. This command cannot be used in a user file.
3574
3575 @c .   {File inclusion}
3576 @subsubsection Main input
3577 @cindex Main input
3578
3579 @subsubsection File inclusion
3580 @cindex @code{\include}
3581 @example
3582   \include @var{filename}
3583 @end example
3584
3585 Include @var{filename}.  The argument @var{filename} may be a quoted string (an
3586 unquoted string will not work here!) or a string identifier.  The full
3587 filename including the @file{.ly} extension must be given,
3588
3589 @subsubsection Version information 
3590 @cindex @code{\version}
3591 @example
3592   \version @var{string} ;
3593 @end example
3594
3595 Specify the version of LilyPond that a file was written for.  The
3596 argument is a version string in quotes, for example @code{"1.2.0"}. 
3597 This is used to detect invalid input, and to aid
3598 @code{convert-ly}  a tool that automatically upgrades input files. See
3599 See @ref{convert-ly} for more information on @code{convert-ly}.
3600
3601 @cindex convert-ly
3602
3603
3604 @c .   {Pitch names}
3605 @subsubsection Defining pitch names
3606 @cindex Lexical modes
3607 @cindex definining pitch names
3608 @cindex pitch names, definining
3609 @cindex note names
3610 @cindex chord modifier names
3611
3612 A @code{\paper} block at top level sets the default paper block.  A
3613 @code{\midi} block at top level works similarly.
3614
3615 @c .   {Assignments}
3616 @subsubsection Assignments
3617 @cindex assignments
3618 @cindex @code{#}
3619
3620 Identifier assignments may appear at top level.  @ref{Assignments}
3621
3622
3623
3624 @c .    {Direct scheme}
3625 @subsubsection Direct scheme
3626 @cindex Direct scheme
3627
3628 Scheme statements maybe issued to produce interesting side-effects. 
3629
3630
3631 @c .  {Lexical modes}
3632 @node Lexical modes
3633 @subsection Lexical modes
3634 @cindex Lexical modes
3635 @cindex input mode
3636 @cindex mode, input 
3637 @cindex @code{\notes}
3638 @cindex @code{\chords}
3639 @cindex @code{\lyrics}
3640
3641 To simplify entering notes, lyrics, and chords, LilyPond has three
3642 special input modes on top of the default mode: note, lyrics and chords
3643 mode.  These input modes change the way that normal, unquoted words are
3644 interpreted: for example, the word @code{cis} may be interpreted as a
3645 C-sharp, as a lyric syllable `cis' or as a C-sharp major triad
3646 respectively.
3647
3648 A mode switch is entered as a compound music expressions
3649 @example
3650 @code{\notes} @var{musicexpr}
3651 @code{\chords} @var{musicexpr}
3652 @code{\lyrics}  @var{musicexpr}.
3653 @end example
3654
3655 In each of these cases, these expressions do not add anything to the
3656 meaning of their arguments.  They are just a way to indicate that the
3657 arguments should be parsed in indicated mode.  The modes are treated in
3658 more detail in the sections @ref{Note entry}, @ref{Lyrics} and
3659 @ref{Chords}.
3660
3661 You may nest different input modes.
3662
3663 @c .  {Ambiguities}
3664 @node Ambiguities
3665 @subsection Ambiguities
3666 @cindex ambiguities
3667 @cindex grammar
3668
3669
3670 The grammar contains a number of ambiguities. We hope to resolve them at
3671 some time.
3672
3673 @itemize @bullet
3674   @item  The assignment
3675
3676          @example 
3677 foo = bar 
3678 @end example 
3679
3680        can be interpreted as making a string identifier @code{\foo}
3681        containing @code{"bar"}, or a music identifier @code{\foo}
3682        containing the syllable `bar'.
3683
3684   @item  The assignment
3685
3686          @example 
3687 foo = -6 
3688 @end example 
3689
3690        can be interpreted as making an integer identifier
3691        containing -6, or a Request identifier containing the
3692        fingering `6' (with neutral direction).
3693
3694   @item  If you do a nested repeat like
3695
3696        @quotation
3697
3698 @example 
3699 \repeat @dots{}
3700 \repeat @dots{}
3701 \alternative 
3702 @end example 
3703
3704        @end quotation
3705
3706        then it is ambiguous to which @code{\repeat} the
3707        @code{\alternative} belongs.  This is the classic if-then-else
3708        dilemma.  It may be solved by using braces.
3709
3710   @item  (an as yet unidentified ambiguity :-)
3711 @end itemize
3712
3713
3714
3715
3716 @c . {Unsorted}
3717 @node Unsorted
3718 @section Unsorted
3719
3720 [mucho todo]
3721
3722 Translation?
3723
3724 @cindex properties
3725 @unnumberedsubsec Translation property
3726
3727 [todo: add \set/\override/\revert]
3728
3729
3730 @cindex @code{\property}
3731 @example
3732   \property @var{contextname}.@var{propname} =  @var{value}
3733 @end example
3734
3735 Sets the @var{propname} property of the context @var{contextname} to
3736 the specified @var{value}.  All three arguments are strings. 
3737 Depending on the context, it may be necessary to quote the strings or
3738 to leave space on both sides of the dot.
3739
3740
3741 @cindex output properties
3742 @unnumberedsubsec Output properties
3743
3744 These allow you to tweak what is happening in the back-end
3745 directly. If you want to control every detail of the output
3746 formatting, this is the feature to use. The downside to this is that
3747 you need to know exactly how the backend works. Example:
3748
3749
3750 @lilypond[fragment,verbatim]
3751 \relative c'' { c4
3752   \context Staff \outputproperty
3753   #(make-type-checker 'note-head-interface)
3754   #'extra-offset = #'(0.5 . 0.75)
3755   <c8 e g> }
3756 @end lilypond
3757
3758 This selects all note heads occurring at current staff level, and sets
3759 the @code{extra-offset} of those heads to @code{(0.5,0.75)}, shifting
3760 them up and right.
3761
3762 Use of this feature is entirely on your own risk: if you use this, the
3763 result will depend very heavily on the implementation of the backend,
3764 which we change regularly and unscrupulously.
3765
3766
3767 Don't move the finger 2, only text "m.d." ...
3768 @lilypond[verbatim]
3769 #(define (make-text-checker text)
3770    (lambda (grob) (equal? text (ly-get-elt-property grob 'text))))
3771
3772 \score {    
3773   \notes\relative c''' {
3774     \property Voice.Stem \set #'direction = #1
3775     \outputproperty #(make-text-checker "m.d.")
3776       #'extra-offset = #'(-3.5 . -4.5)
3777     a^2^"m.d."    
3778   }
3779   \paper { linewidth = -1.; }
3780 }
3781 @end lilypond
3782
3783
3784 @menu
3785 * Text markup::
3786 @end menu
3787
3788 @node Text markup
3789 @subsection Text markup
3790 @cindex text markup
3791 @cindex markup text
3792
3793 LilyPond has an internal mechanism to typeset texts: you can
3794 form text markup expressions by composing scheme expressions
3795 in the following way:
3796
3797 @lilypond[verbatim]
3798 \score { \notes \relative c' {
3799   b-#"text"
3800   c-#'(bold "text")
3801   d-#'(lines "one" (bold "text"))
3802   e-#'(music (named "noteheads-2" "flags-u3"))
3803 }
3804 \paper { linewidth = 10.\cm; } }
3805 @end lilypond
3806
3807 Formally, Scheme markup text is defined as follows:
3808
3809 @example
3810 text: string | (head? text+)
3811 head: markup | (markup+)
3812 markup-item: property | abbrev | @var{fontstyle}
3813 property: (@var{key} . @var{value})
3814 abbrev: @code{rows lines roman music bold italic named super sub text}
3815 @end example
3816
3817 The markup is broken down and converted into a list of grob properties,
3818 which are prepended to the grop's property list.  The
3819 @var{key}-@var{value} pair is a grob property.
3820 @ignore
3821 [Why is this useful?]
3822
3823 ?Snapnie: markup text is eerste item dat voldoet aan mijn gewelfdige,
3824 ideale idee van direct-en-eenmalig-per-item te zetten properties, ipv
3825 gehaspel via \property en hopen dat je property (enkel) in juiste item
3826 terecht gaat komen.  Heb je deze wel bewust meegemaakt:
3827
3828 Sender: jan@appel.lilypond.org
3829 To: Han-Wen <hanwen@cs.uu.nl>   
3830 Subject: (elt) properties
3831 Organization: Jan at Appel
3832 From: janneke@gnu.org
3833 Date: 01 Nov 2000 10:39:10 +0100
3834 Message-ID: <m3og00av5t.fsf@appel.lilypond.org>
3835 User-Agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.7
3836 MIME-Version: 1.0
3837 Content-Type: text/plain; charset=us-ascii
3838 Lines: 77
3839 Xref: appel.lilypond.org vers:1991
3840
3841 Hi,
3842
3843 Wat ik vooral mis, is een koele manier om een propertie eenmalig aan
3844 een element te hangen.  Hoop dat je zinvol over wilt meedenken; zie
3845 het monster van les-nereides.  Misschien dat we 't niet moeten doen
3846 voor 1.4 maar wachten tot properties nog wat verder
3847 uitgekristalliseerd zijn?
3848
3849 Nu moet je
3850
3851    \property Voice.Stem \push #'length = #'6
3852    a
3853    \property Voice.Stem \pop #'length
3854    b
3855
3856 waarmee je in feite zeg tegen de stem-engraver: vanaf nu aan moet je
3857 alle stems 6 lang maken (maakt stem); onee, doe maar weer default
3858 lengte.
3859
3860 Maar dat is eigenlijk niet wat je bedoelt, wat je zou willen is net
3861 zo'n directe interface als wat we nu hebben voor markup text, bv. iets
3862 van:
3863
3864    a+#'(Stem::length . 6) b
3865
3866 Bij markup text kun je direct en eenmalig een reeks properties aan een
3867 enkel item toevoegen; iets wat je volgens mij vaak nodig hebt.
3868
3869 Ik zat eerst te denken aan ``request properties'': properties
3870 toevoegen aan request, die dan worden doorgegeven aan alle items die
3871 door dat request worden gemaakt.
3872
3873 Maar misschien zuigt dat wel te vreselijk en moeten we iets van
3874 ``volatile'' properties maken.
3875
3876 Btw,
3877
3878     \property Voice.Slur \push #'dash = #1
3879     \property Voice.Slur \pop #'dash
3880     a()b
3881     \property Voice.Slur \push #'direction = #-1
3882     \property Voice.Slur \pop #'direction
3883     ()c
3884
3885 of de kluts waar ik brr van word, eigenlijk ook alleen doenbaar is
3886 voor wat veelgebruikte properties:
3887
3888     slurDotted = \property Voice.Slur \push #'dash = #1
3889     slurNoDots = \property Voice.Slur \pop #'dash
3890     slurUp = \property Voice.Slur \push #'direction = #1
3891     slurDown = \property Voice.Slur \push #'direction = #-1
3892     slurBoth = \property Voice.Slur \pop #'direction
3893
3894     [..]
3895
3896     \slurDotted\slurDown
3897     a()b
3898     ()c
3899     \slurNoDots\slurBoth
3900
3901 zou toch graag meer iets in trant van, als je begrijpt wat ik bedoel
3902
3903     Slur+#'((dash . 1) (direction . 1))
3904     b () c
3905     Slur-#'(dash direction)
3906
3907 ofwel
3908
3909     a(+#'((dash . 1) (direction . 1))
3910     )b(+#'((dash . 1) (direction . 1))
3911     )c
3912 @end ignore
3913
3914 The following abbreviations are currently
3915 defined:
3916
3917 @table @code
3918 @item rows
3919 horizontal mode: set all text on one line (default)
3920 @item lines
3921  vertical mode: set every text on new line
3922 @item roman
3923  select roman font
3924 @item music
3925  select feta font
3926 @item bold
3927  select bold series
3928 @item italic
3929  select italic shape
3930 @item named
3931  lookup by character name
3932 @item text
3933  plain text lookup (by character value)
3934 @item super
3935  superscript
3936 @item sub
3937  subscript
3938 @end table
3939
3940
3941 @var{fontstyle} may be any of @code{finger volta timesig mmrest mark
3942 script large Large dynamic}
3943
3944 @ignore
3945 [kern, raise ??]
3946 Wat is daarmee, zijn toch gewoon grob properties van text-interface?
3947 @end ignore
3948
3949 @c .{Local emacs vars}
3950 @c Local variables:
3951 @c mode: texinfo
3952 @c minor-mode: font-lock
3953 @c minor-mode: outline
3954 @c outline-layout: (-1 : 0)
3955 @c outline-use-mode-specific-leader: "@c \."
3956 @c outline-primary-bullet: "{"
3957 @c outline-stylish-prefixes: nil
3958 @c outline-override-protect: t
3959 @c End:
3960