]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/staff.itely
Merge branch 'master' of ssh+git://git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / Documentation / user / staff.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @ignore
3     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
4
5     When revising a translation, copy the HEAD committish of the
6     version that you are working on.  See TRANSLATION for details.
7 @end ignore
8
9 @node Staff notation
10 @section Staff notation
11
12 @lilypondfile[quote]{staff-headword.ly}
13
14
15 This section explains how to influence the staff appearance, 
16 print scores with more than one staff, and 
17 how to apply specific performance marks to single staves.
18
19 @menu
20 * Displaying staves::           
21 * Modifying single staves::     
22 * Writing parts::               
23 @end menu
24
25
26 @node Displaying staves
27 @subsection Displaying staves
28
29 This section shows the different possibilities to create and group
30 staves into groups, which can be marked in the beginning of each
31 line with either a bracket or a brace.
32
33 @menu
34 * Initiating new staves::       
35 * Grouping staves::             
36 @end menu
37
38 @node Initiating new staves
39 @subsubsection Initiating new staves
40
41 @cindex new staff
42 @cindex staff initiation
43 @cindex staff, new
44
45 The lines of a staff (pl. staves) are produced by a @code{staff symbol} 
46 layout object.
47 LilyPond ensures that all music is printed on staff lines so if you just
48 type in some notes, the staff symbol is added automatically to the output.
49 This is just a shortcut to make the program usage more easy, but in most
50 cases where you want to print more complex music on more than on staff
51 it is better to create the staff explicitly at the beginning of your
52 music inside of the @code{\score} environment.
53
54 With the command @code{\new Staff @{ ... @}} you actually call a new 
55 Staff context that has already everything set up to the default 
56 engraving rules. @ref{Creating contexts} explains how different contexts
57 are called.
58
59 Once a staff is instantiated it can be started or stopped at every point
60 in the score. This is done with the commands @code{\startStaff} and 
61 @code{\stopStaff}. How to use it is shown in @ref{Staff symbol}.
62
63 Besides the default @code{Staff} context there are also
64 specialized staff contexts for setting percussion, Guitar music,
65 and ancient music.
66 See @ref{Printing chord names}, @ref{Percussion staves}, 
67 @ref{Tablatures basic}, @ref{Gregorian Chant contexts}, and
68 @ref{Mensural contexts} for an explanation.
69
70 @seealso
71
72 Music Glossary: @rglos{staff}, @rglos{staves}.
73
74 Notation Reference: @ref{Printing chord names}, @ref{Percussion staves}, 
75 @ref{Tablatures basic}, @ref{Gregorian Chant contexts}, and
76 @ref{Mensural contexts}.
77
78 Snippets: @lsrdir{Staff,Staff-notation}.
79
80 Internals Reference: @internalsref{Staff}.
81
82
83
84 @node Grouping staves
85 @subsubsection Grouping staves
86
87 @cindex start of system
88 @cindex staff, multiple
89 @cindex staves, multiple
90 @cindex system start delimiters
91 @cindex bracket, vertical
92 @cindex brace, vertical
93 @cindex grand staff
94 @cindex piano staff
95 @cindex staff group
96 @cindex staff, choir
97 @cindex choir staff
98 @cindex system
99
100 LilyPond provides different types of contexts to group single staves 
101 together. These contexts influence in the first place the appearance
102 of the system start delimiter, but they have also influence on the
103 behaviour of the bar lines.
104
105
106 @itemize
107 @item
108 If no context is specified, the default properties for the score
109 will be used: the group is started with a vertical line, and the
110 bar lines are not connected.  
111
112 @lilypond[verbatim,ragged-right,quote]
113 \relative c'' { <<
114   \new Staff { c1 c }
115   \new Staff { c c }
116 >> }
117 @end lilypond
118
119 @item
120 In a @code{StaffGroup}, the bar lines will be drawn through
121 all the staves, and the group is started with a bracket.
122
123 @lilypond[verbatim,ragged-right,quote]
124 \new StaffGroup {
125   \relative c'' <<
126     \new Staff { c1 c }
127     \new Staff { c c }
128   >>
129 }
130 @end lilypond
131
132 @item
133 In a @code{ChoirStaff}, the group is 
134 started with a bracket, but bar lines are not connected. 
135
136 @lilypond[verbatim,ragged-right,quote]
137 \new ChoirStaff {
138   \relative c'' <<
139     \new Staff { c1 c }
140     \new Staff { c c }
141   >>
142 }
143 @end lilypond
144
145 @item
146 In a @code{GrandStaff}, the group is started with a brace
147 at the left, and bar lines are connected between the staves. 
148
149 @lilypond[verbatim,ragged-right,quote]
150 \new GrandStaff {
151   \relative c'' <<
152     \new Staff { c1 c }
153     \new Staff { c c }
154   >>
155 }
156 @end lilypond
157
158 @item
159 The @code{PianoStaff} behaves almost as the @code{GrandStaff} but is
160 optimized for setting piano music.
161
162 @lilypond[verbatim,ragged-right,quote]
163 \new PianoStaff
164 \relative c'' <<
165   \new Staff { c1 c }
166   \new Staff { c c }
167 >>
168 @end lilypond
169
170 @end itemize
171
172 According to classic engraver rules an orchestral score consists of
173 staves connected only with a single line at the beginning of the system.
174 In LilyPond this is produced grouping the @code{Staff} contexts with
175 @code{<< ... >>}.
176
177 Each instrument family is grouped inside of a @code{StaffGroup} with a 
178 starting bracket. A group of same instruments or an instrument using
179 more than one staff is grouped with braces in a @code{GrandStaff}.
180
181 As the context names tell, @code{PianoStaff} is used for notating
182 piano music and @code{ChoirStaff} for all kind of vocal ensemble music.
183
184 Here is an example of an orchestral score using groupings. Note that the
185 instrument names are omited here, see @ref{Instrument names} how to set 
186 them.
187
188 @lilypond[verbatim,ragged-right,quote]
189 \score{ \relative c' {
190 <<
191   \new StaffGroup %the woodwinds group
192   <<
193     \new Staff { c1 c }
194     \new Staff { c c }
195     \new Staff { c c }
196   >>
197   \new StaffGroup %the brass group
198   <<
199     \new Staff { c c }
200     \new Staff { c c }
201     \new GrandStaff %the horns need a GrandStaff (same instrument)
202     <<
203       \new Staff { c c }
204       \new Staff {\clef bass c c }
205     >>
206   >>
207   \new ChoirStaff %for a vocal part
208   <<
209     \new Staff { c c }
210     \new Staff {\clef alto c c }
211     \new Staff {\clef bass c c }
212   >>
213   \new PianoStaff %for the piano
214   <<
215     \new Staff { c c }
216     \new Staff {\clef bass c c }
217   >>
218 >>
219 } }
220 @end lilypond
221
222 The different staff contexts are already nested in this example, as
223 the @q{horn section} is contained both in a @code{StaffGroup} and a 
224 @code{GrandStaff}.
225
226 @cindex staff, nested
227
228 It is also possible to nest staves of the same type with the contexts
229 @code{InnerStaffGroup} and @code{InnerChoirStaffGroup}. These behave like
230 the corresponding normal staff groups but can only initiated inside of
231 another staff context. Again LilyPond would add a normal @code{StaffGroup}
232 to the output, if you would start a score with an @code{InnerStaffGroup}. 
233
234 Note that @code{GrandStaff} and @code{PianoStaff} do not have any inner
235 grouping contexts. They can both be inside an inner staff context, though.
236
237 @c snippet staff-brackets.ly
238 @lilypond[verbatim,ragged-right,quote]
239 \score { 
240 <<
241   \new StaffGroup << 
242   \new Staff {c' d' e' f'}
243   \new InnerStaffGroup <<
244    \new Staff {c' d' e' f'}
245    \new GrandStaff <<
246      \new Staff {c' d' e' f'}
247      \new Staff {c' d' e' f'}
248    >>
249   \new Staff {c' d' e' f'}
250   >>
251   \new ChoirStaff <<
252    \new Staff {c' d' e' f'}
253     \new InnerStaffGroup <<
254      \new Staff {c' d' e' f'}
255     >>
256    \new Staff {c' d' e' f'}
257   >>
258   >>
259   \new ChoirStaff << 
260    \new Staff {c' d' e' f'}
261    \new InnerChoirStaff <<
262     \new Staff {c' d' e' f'}
263     \new Staff {c' d' e' f'}
264    >>
265    \new Staff {c' d' e' f'}
266   >>
267 >> }
268 @end lilypond
269
270
271 @snippets
272
273 @c FIXME: not yet in master
274 @c @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
275 @c {nesting-staves.ly}
276
277
278 More complex nesting can be accomplished using the property
279 @code{systemStartDelimiterHierarchy}: 
280
281 @lilypond[quote,ragged-right,verbatim]
282 \new StaffGroup
283 \relative <<
284   \set StaffGroup.systemStartDelimiterHierarchy
285     = #'(SystemStartSquare (SystemStartBracket a
286                              (SystemStartSquare b)) d)
287   \new Staff { c1 }
288   \new Staff { c1 }
289   \new Staff { c1 }
290   \new Staff { c1 }
291   \new Staff { c1 }
292 >>
293 @end lilypond
294
295 Each staff group context sets the property
296 @code{systemStartDelimiter} to one of the values
297 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace},
298 and @internalsref{SystemStartBracket}.  A fourth delimiter,
299 @code{systemStartSquare}, is also available, but must be
300 instantiated manually
301
302
303
304 @cindex mensurstriche layout
305 @cindex renaissance music
306 @cindex transcription of mensural music
307 @cindex mensural music, transcription of
308
309
310 @c FIXME: not yet in master
311 @c @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
312 @c {mensurstriche-layout.ly}
313
314 Other groupings may be achieved by changing various properties.
315 E.g., the
316 @q{Mensurstriche} layout common in Renaissance music, with
317 bar lines running between but not through the staves, can be
318 produced from a @code{StaffGroup} or @code{GrandStaff} context if
319 the bar lines are made transparent in the @code{Staff} itself:
320
321 @lilypond[verbatim,ragged-right,quote]
322 global = {\override Staff.BarLine #'transparent = ##t
323           s1 s
324           %the final bar line is not interupted
325           \once \override Staff.BarLine #'transparent = ##f
326           \bar "|."}
327 \new StaffGroup
328 \relative c'' <<
329   \new Staff {<< \global { c1 c } >>}
330   \new Staff {<< \global { c c } >>}
331 >>
332 @end lilypond
333
334
335
336 @c FIXME: Graham will deal with this.  -gp
337 @c snippet 201
338 To display a bracket even if there is only one staff, see
339 @c @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
340 @c {staff,display-bracket-with-only-one-staff-in-a system.ly}
341
342 @seealso
343
344 Music Glossary: @rglos{brace}, 
345 @rglos{bracket}.
346
347 Snippets: @lsrdir{Staff,Staff-notation}
348
349 Internals Reference: @internalsref{ChoirStaff},
350 @internalsref{GrandStaff}, @internalsref{PianoStaff}, 
351 @internalsref{StaffGroup},
352 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace},
353 @internalsref{SystemStartBracket}, @internalsref{SystemStartSquare}.
354
355
356
357 @node Modifying single staves
358 @subsection Modifying single staves
359
360 @menu
361 * Staff symbol::                
362 * Ossia staves::                
363 * Hiding staves::               
364 @end menu
365
366 @node Staff symbol
367 @subsubsection Staff symbol
368
369 @cindex adjusting staff symbol
370
371 The layout object which draws the lines of a staff is called
372 @code{staff symbol}.  The staff symbol may be tuned in the number,
373 thickness and distance of lines, using properties.  This is
374 demonstrated in the example files
375 @c @lsr{staff,changing-the-number-of-lines-in-a-staff.ly} and
376 @c @lsr{staff,changing-the-staff-size.ly}.
377
378 In addition, staves may be started and stopped at will.  This is
379 done with @code{\startStaff} and @code{\stopStaff}.
380
381 @lilypond[verbatim,relative=2,fragment]
382 b4 b
383 \override Staff.StaffSymbol #'line-count = 2
384 \stopStaff \startStaff
385 b b
386 \revert Staff.StaffSymbol #'line-count
387 \stopStaff \startStaff
388 b b
389 @end lilypond
390
391 @node Ossia staves
392 @subsubsection Ossia staves
393
394 @cindex staves, Frenched
395 @cindex ossia
396 @cindex Frenched staves
397
398 In combination with Frenched staves, this may be used to typeset
399 @emph{ossia} sections.  An example is shown here
400
401 @lilypond[verbatim,relative=2,quote]
402 <<
403   \new Staff \with
404   {
405     \remove "Time_signature_engraver"
406     fontSize = #-2
407     \override StaffSymbol #'staff-space = #(magstep -2)
408     firstClef = ##f
409   }
410   \relative c'' {
411     \stopStaff
412     \skip 2
413
414     \startStaff
415     \clef treble
416     bes8[^"ossia" g bes g]
417     \stopStaff
418
419     s2
420
421     \startStaff
422     f8 d g4 
423   }
424   \new Staff  \relative
425   {
426     \time 2/4
427     c4 c g' g a a g2
428   }
429
430 >>
431 @end lilypond
432
433 @cindex staff lines, setting number of
434 @cindex staff lines, setting thickness of
435 @cindex thickness of staff lines, setting
436 @cindex number of staff lines, setting
437
438 @seealso
439
440 Music Glossary: @rglos{ossia}, @rglos{staff}, @rglos{Frenched staff}.
441
442 Snippets: @lsrdir{Staff,Staff-notation}
443
444 Internals Reference: @internalsref{StaffSymbol},
445 @internalsref{DrumStaff}.
446
447
448 @node Hiding staves
449 @subsubsection Hiding staves
450
451 @cindex Frenched scores
452 @cindex staves, hiding
453 @cindex staves, empty 
454
455 In orchestral scores, staff lines that only have rests are usually
456 removed; this saves some space.  This style is called @q{French
457 Score}.  For @code{Lyrics}, @code{ChordNames} and
458 @code{FiguredBass}, this is switched on by default.  When
459 the lines of these contexts turn out empty after the line-breaking
460 process, they are removed.
461
462 For normal staves, a specialized @code{Staff} context is
463 available, which does the same: staves containing nothing (or only
464 multi-measure rests) are removed.  The context definition is
465 stored in @code{\RemoveEmptyStaffContext} variable.  Observe how
466 the second staff in this example disappears in the second line
467
468 @lilypond[quote,ragged-right,verbatim]
469 \layout {
470   \context { \RemoveEmptyStaffContext }
471 }
472
473 {
474   \relative c' <<
475     \new Staff { e4 f g a \break c1 }
476     \new Staff { c4 d e f \break R1 }
477   >>
478 }
479 @end lilypond
480
481 The first system shows all staves in full.  If empty staves should
482 be removed from the first system too, set @code{remove-first} to
483 true in @code{VerticalAxisGroup}.
484
485 @example
486 \override Score.VerticalAxisGroup #'remove-first = ##t
487 @end example
488
489 To remove other types of contexts, use
490 @code{\AncientRemoveEmptyStaffContext} or
491 @code{\RemoveEmptyRhythmicStaffContext}.
492
493 @cindex ossia
494
495 Another application of the @code{\RemoveEmptyStaffContext} is to
496 make ossia sections, i.e., alternative melodies on a separate
497 piece of staff, with help of a Frenched staff.  See @ref{Staff
498 symbol}. 
499
500 You can make the staff lines invisible by removing the
501 @code{Staff_symbol_engraver} from the @code{Staff} context.
502
503
504 @lilypond[quote,ragged-right,verbatim]
505 \score {
506   \context Staff \relative c'' { c8 c c16 c c c }
507   \layout{
508     \context {
509       \Staff
510       \remove Staff_symbol_engraver
511     }
512   }
513 }
514 @end lilypond
515
516 @seealso
517
518 Notation Reference: @ref{Staff symbol}.
519
520 Snippets: @lsrdir{Staff,Staff-notation}
521
522 Internals Reference: @internalsref{ChordNames},
523 @internalsref{FiguredBass}, @internalsref{Lyrics},
524 @internalsref{Staff}, @internalsref{VerticalAxisGroup}.
525
526 @node Writing parts
527 @subsection Writing parts
528
529 @menu
530 * Metronome marks::             
531 * Instrument names::            
532 * Quoting other voices::        
533 * Formatting cue notes::        
534 @end menu
535
536 @node Metronome marks
537 @subsubsection Metronome marks
538
539 @cindex Tempo
540 @cindex beats per minute
541 @cindex metronome marking
542
543 Metronome settings can be entered as follows
544
545 @example
546 \tempo @var{duration} = @var{per-minute}
547 @end example
548
549 In the MIDI output, they are interpreted as a tempo change.  In
550 the layout output, a metronome marking is printed
551
552 @funindex \tempo
553
554 @lilypond[quote,ragged-right,verbatim,fragment]
555 \tempo 8.=120 c''1
556 @end lilypond
557
558
559 @snippets
560
561 To change the tempo in the MIDI output without printing anything,
562 make the metronome marking invisible @example \once \override
563 Score.MetronomeMark #'transparent = ##t @end example
564
565 To print other metronome markings, use these markup commands
566 @lilypond[quote,ragged-right,verbatim,relative,fragment]
567 c4^\markup {
568   (
569   \smaller \general-align #Y #DOWN \note #"16." #1
570   =
571   \smaller \general-align #Y #DOWN \note #"8" #1
572   ) }
573 @end lilypond
574
575 @noindent
576 For more details, see @ref{Text markup}.
577
578
579 @seealso
580
581 Music Glossary: @rglos{metronome}, @rglos{metronomic indication},
582 @rglos{tempo indication}, @rglos{metronome mark}.
583
584 Notation Reference: @ref{Text markup}.
585
586 Snippets: @lsrdir{Staff,Staff-notation}.
587
588 Internals Reference: @internalsref{MetronomeMark}, @ref{MIDI
589 output}.
590
591
592 @knownissues
593
594 Collisions are not checked.  If you have notes above the top line
595 of the staff (or notes with articulations, slurs, text, etc), then
596 the metronome marking may be printed on top of musical symbols.
597 If this occurs, increase the padding of the metronome mark to
598 place it further away from the staff.
599
600 @example
601 \override Score.MetronomeMark #'padding = #2.5
602 @end example
603
604 @c perhaps also an example of how to move it horizontally?
605
606
607 @node Instrument names
608 @subsubsection Instrument names
609
610 @cindex instrument names
611 @cindex instrument names, short
612
613 In an orchestral score, instrument names are printed at the left
614 side of the staves.
615
616 This can be achieved by setting @code{Staff}.@code{instrumentName} and
617 @code{Staff}.@code{shortInstrumentName}, or
618 @code{PianoStaff}.@code{instrumentName} and
619 @code{PianoStaff}.@code{shortInstrumentName}.  This will print text
620 before the start of the staff.  For the first staff,
621 @code{instrumentName} is used.  If set, @code{shortInstrumentName} is
622 used for the following staves.
623
624 @lilypond[quote,verbatim,ragged-right,relative=1,fragment]
625 \set Staff.instrumentName = "Ploink "
626 \set Staff.shortInstrumentName = "Plk "
627 c1
628 \break
629 c''
630 @end lilypond
631
632 You can also use markup texts to construct more complicated
633 instrument names, for example
634
635 @lilypond[quote,fragment,verbatim,ragged-right]
636 \set Staff.instrumentName = \markup {
637   \column { "Clarinetti"
638             \line { "in B" \smaller \flat } } }
639 c''1
640 @end lilypond
641
642 @cindex instrument names, centering
643
644 As instrument names are centered by default, multi line names
645 are better entered using @code{\center-align}:
646
647 @lilypond[quote,verbatim,ragged-right]
648 { <<
649 \new Staff {
650   \set Staff.instrumentName = \markup \center-align {
651     Clarinetti
652     \line { "in B" \smaller \flat }
653   }
654   c''1
655 }
656 \new Staff {
657   \set Staff.instrumentName = "Vibraphone"
658   c''1
659 }
660 >>
661 }
662 @end lilypond
663
664 For longer instrument names, it may be useful to increase the
665 @code{indent} setting in the @code{\layout} block.
666
667 Short instrument names, printed before the systems following the first
668 one, are also centered by default, in a space which width is given by
669 the @code{short-indent} variable of the @code{\layout} block.
670
671 To add instrument names to other contexts (such as
672 @code{GrandStaff}, @code{ChoirStaff}, or @code{StaffGroup}), the
673 engraver must be added to that context.
674
675 @example
676 \layout@{
677   \context @{\GrandStaff \consists "Instrument_name_engraver"@}
678 @}
679 @end example
680
681 @noindent
682 More information about adding and removing engravers can be found
683 in @ref{Modifying context plug-ins}.
684
685 @cindex instrument names, changing
686
687 Instrument names may be changed in the middle of a piece,
688
689 @lilypond[quote,fragment,verbatim,ragged-right]
690 \set Staff.instrumentName = "First"
691 \set Staff.shortInstrumentName = "one"
692 c1 c c c \break
693 c1 c c c \break
694 \set Staff.instrumentName = "Second"
695 \set Staff.shortInstrumentName = "two"
696 c1 c c c \break
697 c1 c c c \break
698 @end lilypond
699
700
701 @seealso
702
703 Notation Reference: @ref{Modifying context plug-ins}.
704
705 Snippets: @lsrdir{Staff,Staff-notation}
706
707 Internals Reference: @internalsref{InstrumentName},
708 @internalsref{PianoStaff}, @internalsref{Staff}.
709
710
711 @node Quoting other voices
712 @subsubsection Quoting other voices
713
714 @cindex cues
715 @cindex quoting other voices
716 @cindex fragments
717 @cindex cue notes
718
719 With quotations, fragments of other parts can be inserted into a
720 part directly.  Before a part can be quoted, it must be marked
721 especially as quotable.  This is done with the @code{\addQuote}
722 command.
723
724 @example
725 \addQuote @var{name} @var{music}
726 @end example
727
728
729 @noindent
730 Here, @var{name} is an identifying string.  The @var{music} is any
731 kind of music.  Here is an example of @code{\addQuote}
732
733 @example
734 \addQuote clarinet \relative c' @{
735   f4 fis g gis
736 @}
737 @end example
738
739 This command must be entered at toplevel, i.e., outside any music
740 blocks.  Typically, one would use an already defined music event
741 as the @var{music}:
742
743 @example
744 clarinet = \relative c' @{
745   f4 fis g gis
746 @}
747 \addQuote clarinet @{ \clarinet @}
748 @end example
749
750
751 After calling @code{\addQuote}, the quotation may then be done
752 with @code{\quoteDuring} or @code{\cueDuring},
753
754 @example
755 \quoteDuring #@var{name} @var{music}
756 @end example
757
758 During a part, a piece of music can be quoted with the
759 @code{\quoteDuring} command.
760
761 @example
762 \quoteDuring #"clarinet" @{ s2. @}
763 @end example
764
765 This would cite three quarter notes (the duration of @code{s2.})
766 of the previously added @code{clarinet} voice.
767
768 More precisely, it takes the current time-step of the part being
769 printed, and extracts the notes at the corresponding point of the
770 @code{\addQuote}d voice.  Therefore, the argument to
771 @code{\addQuote} should be the entire part of the voice to be
772 quoted, including any rests at the beginning.
773
774 It is possible to use another music expression instead of
775 @code{s}, thus creating a polyphonic section, but this may not
776 always give the desired result.
777
778 Quotations take into account the transposition of both source and
779 target instruments, if they are specified using the
780 @code{\transposition} command.
781
782 @lilypond[quote,ragged-right,verbatim]
783 \addQuote clarinet \relative c' {
784   \transposition bes
785   f4 fis g gis
786 }
787
788 {
789   e'8 f'8 \quoteDuring #"clarinet" { s2 }
790 }
791 @end lilypond
792
793 The type of events that are present in the quoted music can be
794 trimmed with the @code{quotedEventTypes} property.  The default
795 value is @code{(note-event rest-event)}, which means that only
796 notes and rests of the quoted voice end up in the
797 @code{\quoteDuring}.  Setting
798
799 @example
800 \set Staff.quotedEventTypes =
801        #'(note-event articulation-event dynamic-event)
802 @end example
803
804 @noindent
805 will quote notes (but no rests), together with scripts and
806 dynamics.
807
808 @knownissues
809
810 Only the contents of the first @code{Voice} occurring in an
811 @code{\addQuote} command will be considered for quotation, so
812 @var{music} can not contain @code{\new} and @code{\context Voice}
813 statements that would switch to a different Voice.
814
815 Quoting grace notes is broken and can even cause LilyPond to
816 crash.
817
818 Quoting nested triplets may result in poor notation.
819
820 In earlier versions of LilyPond (pre 2.11), @code{addQuote} was
821 written entirely in lower-case letters: @code{\addquote}.
822
823 @seealso
824
825 Notation Reference: @ref{Instrument transpositions}.
826
827 Snippets: @lsrdir{Staff,Staff-notation}
828
829 Internals Reference: @internalsref{QuoteMusic}, @internalsref{Voice}.
830
831
832 @node Formatting cue notes
833 @subsubsection Formatting cue notes
834
835 @cindex cues
836 @cindex cue notes
837 @cindex cue notes, formatting
838 @cindex fragments
839 @cindex quoting other voices 
840 @cindex cues, formatting
841
842 The previous section deals with inserting notes from another
843 voice.  There is a more advanced music function called
844 @code{\cueDuring}, which makes formatting cue notes easier.
845
846 The syntax is
847
848 @example
849   \cueDuring #@var{name} #@var{updown} @var{music}
850 @end example
851
852 This will insert notes from the part @var{name} into a
853 @code{Voice} called @code{cue}.  This happens
854 simultaneously with @var{music}, which usually is a rest.  When
855 the cue notes start, the staff in effect becomes polyphonic for a
856 moment.  The argument @var{updown} determines whether the cue
857 notes should be notated as a first or second voice.
858
859
860 @lilypond[verbatim,ragged-right]
861 smaller = {
862   \set fontSize = #-2
863   \override Stem #'length-fraction = #0.8
864   \override Beam #'thickness = #0.384
865   \override Beam #'length-fraction = #0.8
866 }
867
868 \addQuote clarinet \relative {
869   R1*20
870   r2 r8 c' f f
871 }
872
873 \new Staff \relative  <<
874
875   % setup a context for cue notes.
876   \new Voice = "cue" { \smaller \skip 1*21 }
877
878   \set Score.skipBars = ##t
879
880   \new Voice {
881     R1*20
882     \cueDuring #"clarinet" #UP {
883       R1
884     }
885     g4 g2.
886   }
887 >>
888 @end lilypond
889
890
891 Here are a couple of hints for successful cue notes:
892
893 @itemize
894 @item
895 Cue notes have smaller font sizes.
896
897 @item
898 The cued part is marked with the instrument playing the cue.
899
900 @item
901 When the original part takes over again, this should be marked
902 with the name of the original instrument.
903
904 @item
905 Any other changes introduced by the cued part should also be
906 undone.  For example, if the cued instrument plays in a different
907 clef, the original clef should be stated once again.
908
909 @end itemize
910
911 The macro @code{\transposedCueDuring} is useful to add cues to
912 instruments which use a completely different octave range (for
913 example, having a cue of a piccolo flute within a contra bassoon
914 part).
915
916 @lilypond[verbatim,ragged-right,quote]
917 picc = \relative c''' {
918   \clef "treble^8"
919   R1 |
920   c8 c c e g2 |
921   a4 g g2 |
922 }
923 \addQuote "picc" { \picc }
924
925 cbsn = \relative c, {
926   \clef "bass_8"
927   c4 r g r
928   \transposedCueDuring #"picc" #UP c,, { R1 } |
929   c4 r g r |
930 }
931
932 <<
933   \context Staff = "picc" \picc
934   \context Staff = "cbsn" \cbsn
935 >>
936 @end lilypond
937
938 @seealso
939
940 Snippets: @lsrdir{Staff,Staff-notation}.
941
942 Internals Reference: @internalsref{Voice}.
943
944