]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/staff.itely
Merge branch 'master' into lilypond/translation
[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 @c \version "2.11.51"
10
11 @node Staff notation
12 @section Staff notation
13
14 @lilypondfile[quote]{staff-headword.ly}
15
16 This section explains how to influence the staff appearance, print
17 scores with more than one staff, and how to apply specific
18 performance marks to single staves.
19
20 @menu
21 * Displaying staves::
22 * Modifying single staves::
23 * Writing parts::
24 @end menu
25
26
27 @node Displaying staves
28 @subsection Displaying staves
29
30 This section shows the different possibilities of creating and
31 grouping staves, which are marked at the beginning of each line
32 with either a bracket or a brace.
33
34 @menu
35 * Instantiating new staves::
36 * Grouping staves::
37 * Deeper nested staff groups::
38 @end menu
39
40 @node Instantiating new staves
41 @unnumberedsubsubsec Instantiating new staves
42
43 @cindex new staff
44 @cindex staff initiation
45 @cindex staff instantiation
46 @cindex staff, new
47 @cindex staff, single
48 @cindex drum staff
49 @cindex percussion staff
50 @cindex Gregorian transcription staff
51 @cindex rhythmic staff
52 @cindex tabstaff
53 @cindex tablature
54
55 @notation{Staves} (singular: @notation{staff}) are created with
56 the @code{\new} or @code{\context} commands.  For details, see
57 @ref{Creating contexts}.
58
59 The basic staff context is @code{Staff}:
60
61 @lilypond[verbatim,quote,relative=2]
62 \new Staff { c4 d e f }
63 @end lilypond
64
65 @code{DrumStaff} creates a five-line staff set up for a
66 typical drum set.  It uses different names for each instrument.
67 The instrument names are set using the @code{\drummode} command.
68 For details, see @ref{Percussion staves}.
69
70 @lilypond[verbatim,quote]
71 \new DrumStaff {
72   \drummode { cymc hh ss tomh }
73 }
74 @end lilypond
75
76 @c FIXME: remove when mentioned in NR 2.8
77 @code{GregorianTranscriptionStaff} creates a staff to notate
78 modern Gregorian chant.  It does not show bar lines.
79
80 @lilypond[verbatim,quote,relative=2]
81 \new GregorianTranscriptionStaff { c4 d e f }
82 @end lilypond
83
84 @code{RhythmicStaff} creates a single-line staff that only
85 displays the rhythmic values of the input.  Real durations are
86 preserved. For details, see @ref{Showing melody rhythms}.
87
88 @lilypond[verbatim,quote,relative=2]
89 \new RhythmicStaff { c4 d e f }
90 @end lilypond
91
92 @code{TabStaff} creates a tablature with six strings in standard
93 guitar tuning.  For details, see @ref{Default tablatures}.
94
95 @lilypond[verbatim,quote,relative=2]
96 \new TabStaff { c4 d e f }
97 @end lilypond
98
99 There are two staff contexts specific for the notation of ancient
100 music: @code{MensuralStaff} and @code{VaticanaStaff}.  They are
101 described in @ref{Pre-defined contexts}.
102
103 Staves can be started or stopped at any point in the score.  The
104 commands @code{\startStaff} and @code{\stopStaff} are used for
105 this purpose.  For details, see @ref{Staff symbol}.
106
107
108 @seealso
109
110 Music Glossary:
111 @rglos{staff},
112 @rglos{staves}.
113
114 Notation Reference:
115 @ref{Creating contexts},
116 @ref{Percussion staves},
117 @ref{Default tablatures},
118 @ref{Gregorian chant contexts},
119 @ref{Mensural contexts},
120 @ref{Staff symbol},
121 @ref{Pre-defined contexts},
122 @ref{Showing melody rhythms}.
123
124 Snippets:
125 @rlsr{Staff notation}.
126
127 Internals Reference:
128 @rinternals{Staff},
129 @rinternals{DrumStaff},
130 @rinternals{GregorianTranscriptionStaff},
131 @rinternals{RhythmicStaff},
132 @rinternals{TabStaff},
133 @rinternals{MensuralStaff},
134 @rinternals{VaticanaStaff},
135 @rinternals{StaffSymbol}.
136
137
138 @node Grouping staves
139 @unnumberedsubsubsec Grouping staves
140
141 @cindex start of system
142 @cindex staff, multiple
143 @cindex staves, multiple
144 @cindex system start delimiters
145 @cindex bracket, vertical
146 @cindex brace, vertical
147 @cindex choir staff
148 @cindex grand staff
149 @cindex piano staff
150 @cindex staff group
151 @cindex staff, choir
152 @cindex staff, piano
153 @cindex system
154
155 Various contexts exist to group single staves together in order to
156 form multi-stave systems.  Each grouping context sets the style of
157 the system start delimiter and the behavior of bar lines.
158
159 If no context is specified, the default properties will be used:
160 the group is started with a vertical line, and the bar lines are
161 not connected.
162
163 @lilypond[verbatim,quote,relative=2]
164 <<
165   \new Staff { c1 c }
166   \new Staff { c1 c }
167 >>
168 @end lilypond
169
170 In the @code{StaffGroup} context, the group is started with a
171 bracket and bar lines are drawn through all the staves.
172
173 @lilypond[verbatim,quote,relative=2]
174 \new StaffGroup <<
175   \new Staff { c1 c }
176   \new Staff { c1 c }
177 >>
178 @end lilypond
179
180 In a @code{ChoirStaff}, the group starts with a bracket, but bar
181 lines are not connected.
182
183 @lilypond[verbatim,quote,relative=2]
184 \new ChoirStaff <<
185   \new Staff { c1 c }
186   \new Staff { c1 c }
187 >>
188 @end lilypond
189
190 In a @code{GrandStaff}, the group begins with a brace, and bar
191 lines are connected between the staves.
192
193 @lilypond[verbatim,quote,relative=2]
194 \new GrandStaff <<
195   \new Staff { c1 c }
196   \new Staff { c1 c }
197 >>
198 @end lilypond
199
200 The @code{PianoStaff} is almost identical to a @code{GrandStaff},
201 except that it supports printing the instrument name directly.
202 For details, see @ref{Instrument names}.
203
204 @lilypond[verbatim,quote,relative=2]
205 \new PianoStaff <<
206   \set PianoStaff.instrumentName = "Piano"
207   \new Staff { c1 c }
208   \new Staff { c1 c }
209 >>
210 @end lilypond
211
212 Each staff group context sets the property
213 @code{systemStartDelimiter} to one of the following values:
214 @code{SystemStartBar}, @code{SystemStartBrace}, or
215 @code{SystemStartBracket}.  A fourth delimiter,
216 @code{SystemStartSquare}, is also available, but it must be
217 explicitly specified.
218
219
220 @snippets
221
222 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
223 {use-square-bracket-at-the-start-of-a-staff-group.ly}
224
225 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
226 {display-bracket-with-only-one-staff-in-a-system.ly}
227
228 @cindex mensurstriche layout
229 @cindex renaissance music
230 @cindex transcription of mensural music
231 @cindex mensural music, transcription of
232
233 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
234 {mensurstriche-layout-bar-lines-between-the-staves.ly}
235 @c FIXME: move to NR 2.8.x when sectioning is ready
236
237
238 @seealso
239
240 Music Glossary:
241 @rglos{brace},
242 @rglos{bracket},
243 @rglos{grand staff}.
244
245 Notation Reference:
246 @ref{Instrument names}.
247
248 Snippets:
249 @rlsr{Staff notation}.
250
251 Internals Reference:
252 @rinternals{Staff},
253 @rinternals{ChoirStaff},
254 @rinternals{GrandStaff},
255 @rinternals{PianoStaff},
256 @rinternals{StaffGroup},
257 @rinternals{SystemStartBar},
258 @rinternals{SystemStartBrace},
259 @rinternals{SystemStartBracket},
260 @rinternals{SystemStartSquare}.
261
262
263 @node Deeper nested staff groups
264 @unnumberedsubsubsec Deeper nested staff groups
265
266 @cindex staff, nested
267 @cindex staves, nested
268 @cindex nesting of staves
269 @cindex system start delimiters, nested
270 @cindex nested staff brackets
271 @cindex brackets, nesting of
272 @cindex braces, nesting of
273 @cindex inner staff group
274 @cindex inner choir staff group
275
276 Two additional staff-group contexts are available that can be
277 nested within a @code{StaffGroup} or @code{ChoirStaff} context:
278 @code{InnerStaffGroup} and @code{InnerChoirStaff}.  These contexts
279 create an additional bracket next to the original bracket of their
280 parent staff group.
281
282 An @code{InnerStaffGroup} is treated similarly to a
283 @code{StaffGroup}; bar lines are connected between each stave
284 within the context:
285
286 @lilypond[verbatim,quote,relative=2]
287 \new StaffGroup <<
288   \new Staff { c2 c }
289   \new InnerStaffGroup <<
290     \new Staff { g2 g }
291     \new Staff { e2 e }
292   >>
293 >>
294 @end lilypond
295
296 Bar lines are @emph{not} connected between staves of an
297 @code{InnerChoirStaff}, just like a @code{ChoirStaff}:
298
299 @lilypond[verbatim,quote,relative=2]
300 \new ChoirStaff <<
301   \new Staff { c2 c }
302   \new InnerChoirStaff <<
303     \new Staff { g2 g }
304     \new Staff { e2 e }
305   >>
306   \new Staff { c1 }
307 >>
308 @end lilypond
309
310
311 @snippets
312
313 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
314 {nesting-staves.ly}
315
316
317 @seealso
318
319 Snippets:
320 @rlsr{Staff notation}.
321
322 Notation Reference:
323 @ref{Grouping staves},
324 @ref{Instrument names}.
325
326 Internals Reference:
327 @rinternals{InnerStaffGroup},
328 @rinternals{StaffGroup},
329 @rinternals{InnerChoirStaff},
330 @rinternals{ChoirStaff},
331 @rinternals{SystemStartBar},
332 @rinternals{SystemStartBrace},
333 @rinternals{SystemStartBracket}.
334
335
336 @node Modifying single staves
337 @subsection Modifying single staves
338
339 This section explains how to change specific attributes of one
340 staff: for example, modifying the number of staff lines or the
341 staff size.  Methods to start and stop staves and set ossia
342 sections are also described.
343
344 @menu
345 * Staff symbol::
346 * Ossia staves::
347 * Hiding staves::
348 @end menu
349
350
351 @node Staff symbol
352 @unnumberedsubsubsec Staff symbol
353
354 @cindex adjusting staff symbol
355 @cindex drawing staff symbol
356 @cindex staff symbol, setting of
357 @cindex stop staff lines
358 @cindex start staff lines
359 @cindex staff lines, amount of
360 @cindex staff lines, number of
361 @cindex staff line, thickness of
362 @cindex amount of staff lines
363 @cindex thickness of staff lines
364 @cindex ledger lines, setting
365 @cindex setting of ledger lines
366 @cindex spacing of ledger lines
367 @cindex number of staff lines
368
369 The grob @code{StaffSymbol} is responsible for drawing the lines
370 of a staff.  Its properties can be altered in order to change the
371 appearance of a staff, but they must be changed before the staff
372 is created.  A staff may be started or stopped at any point in the
373 score.
374
375 The number of staff lines may be changed.  The clef position and
376 the position of middle C may need to be modified to fit the new
377 staff.  For an explanation, refer to the snippet section in
378 @ref{Clef}.
379
380 @lilypond[verbatim,quote,relative=2]
381 \new Staff {
382   \override Staff.StaffSymbol #'line-count = #3
383   d4 d d d
384 }
385 @end lilypond
386
387 The vertical position of staff lines and the number of staff lines
388 can be defined at the same time.  As the example shows, the
389 positions of the notes are not influenced by the position of the
390 staff lines.  Details for modifying this property are found in
391 @rinternals{staff-symbol-interface}.
392
393 @warning{The @code{'line-positions} property overrides the
394 @code{'line-count} property.  The number of staff lines is
395 implicitly defined by the number of elements in the list of values
396 for @code{'line-positions}}
397
398 @lilypond[verbatim,quote,relative=1]
399 \new Staff \with {
400   \override StaffSymbol #'line-positions = #'(7 3 0 -4 -6 -7)
401 }
402 { a4 e' f b | d1 }
403 @end lilypond
404
405 The staff line thickness can be modified.  The thickness of ledger
406 lines and stems are also affected, since they depend on staff line
407 thickness.
408
409 @lilypond[verbatim,quote,relative=1]
410 \new Staff \with {
411   \override StaffSymbol #'thickness = #3
412 }
413 { e4 d c b }
414 @end lilypond
415
416 The thickness of ledger lines can be set independently of staff
417 line thickness.  A description of this property is also found in
418 @rinternals{staff-symbol-interface}.
419
420 @lilypond[verbatim,quote,relative=1]
421 \new Staff \with {
422   \override StaffSymbol #'ledger-line-thickness = #'(1 . 0.2)
423 }
424 { e4 d c b }
425 @end lilypond
426
427 The distance between staff lines can be changed.  The setting has
428 influence on ledger lines as well.
429
430 @lilypond[verbatim,quote,relative=1]
431 \new Staff \with {
432   \override StaffSymbol #'staff-space = #1.5
433 }
434 { a4 b c d }
435 @end lilypond
436
437 The width of a staff can be adjusted.  The unit is one staff
438 space.  The spacing of objects inside the staff is not influenced
439 by this setting.
440
441 @lilypond[verbatim,quote,relative=1]
442 \new Staff \with {
443   \override StaffSymbol #'width = #23
444 }
445 { a4 e' f b | d1 }
446 @end lilypond
447
448 Modifications to staff properties in the middle of a score can be
449 placed between @code{\stopStaff} and @code{\startStaff}:
450
451 @lilypond[verbatim,quote,relative=2]
452 c2 c
453 \stopStaff
454 \override Staff.StaffSymbol #'line-count = #2
455 \startStaff
456 b2 b
457 \stopStaff
458 \revert Staff.StaffSymbol #'line-count
459 \startStaff
460 a2 a
461 @end lilypond
462
463
464 @predefined
465
466 @funindex \startStaff
467 @code{\startStaff},
468 @funindex \stopStaff
469 @code{\stopStaff}.
470
471
472 @snippets
473
474 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
475 {making-some-staff-lines-thicker-than-the-others.ly}
476
477
478 @seealso
479
480 Music Glossary:
481 @rglos{line},
482 @rglos{ledger line},
483 @rglos{staff}.
484
485 Notation Reference:
486 @ref{Displaying pitches}.
487
488 Internals Reference:
489 @rinternals{StaffSymbol},
490 @rinternals{staff-symbol-interface}.
491
492
493 @knownissues
494
495 When setting staff lines manually, bar lines are always drawn
496 centered on the position 0, so the maximum distance of the bar
497 lines in either direction must be equal.
498
499
500 @node Ossia staves
501 @unnumberedsubsubsec Ossia staves
502
503 @cindex staff, Frenched
504 @cindex ossia
505 @cindex Frenched staves
506 @cindex staff, resizing of
507 @cindex resizing of staves
508
509 Tweaking the staff object allows to resize the staff:
510
511 @lilypond[verbatim,quote]
512 \new Staff \with {
513   fontSize = #-3
514   \override StaffSymbol #'staff-space = #(magstep -3)
515   \override StaffSymbol #'thickness = #(magstep -3)
516 }
517 \relative c {
518   \clef bass
519   c8 c c c  c c c c
520 }
521 @end lilypond
522
523 This involves shrinking the staff spaces, the staff lines and the
524 font size by the factor 3.  You find a more precise explanation in
525 @ref{Setting the staff size}.
526
527 The @emph{ossia} section in the next example are just put parallel
528 to the main staff with @code{<<} and @code{>>} brackets.  The
529 @emph{ossia} staff is stopped and started explicitely and white
530 space is inserted with the @code{\skip} command.
531
532 @lilypond[verbatim,quote]
533 <<
534   \new Staff \with
535   {
536     %No time signature in the ossia staff
537     \remove "Time_signature_engraver"
538     fontSize = #-3
539     \override StaffSymbol #'staff-space = #(magstep -3)
540     \override StaffSymbol #'thickness = #(magstep -3)
541     firstClef = ##f
542   }
543   \relative c'' {
544     \stopStaff
545     \skip 2
546
547     \startStaff
548     \clef treble
549     bes8[^"ossia" g bes g]
550     \stopStaff
551
552     s2
553
554     \startStaff
555     f8 d g4
556   }
557   \new Staff \relative c'' {
558     \time 2/4
559     c4 c g' g a a g2
560   }
561 >>
562 @end lilypond
563
564
565 @snippets
566
567 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
568 {vertically-aligning-ossias-and-lyrics.ly}
569
570
571 @seealso
572
573 Music Glossary:
574 @rglos{ossia},
575 @rglos{staff},
576 @rglos{Frenched staff}.
577
578 Learning Manual:
579 @rlearning{Nesting music expressions},
580 @rlearning{Size of objects},
581 @rlearning{Length and thickness of objects}.
582
583 Notation Reference:
584 @ref{Setting the staff size}.
585
586 Snippets:
587 @rlsr{Staff notation}.
588
589 Internals Reference:
590 @rinternals{StaffSymbol}.
591
592
593 @node Hiding staves
594 @unnumberedsubsubsec Hiding staves
595
596 @cindex Frenched scores
597 @cindex staff, hiding
598 @cindex staff, empty
599 @cindex hiding of staves
600 @cindex empty staves
601 @cindex Frenched staves
602
603 In orchestral scores, staff lines that only have rests are usually
604 removed; this saves some space.  This style is called @q{French
605 Score}.  For the @code{Lyrics}, @code{ChordNames}, and
606 @code{FiguredBass} contexts, this is switched on by default.  When
607 the lines of these contexts turn out empty after the line-breaking
608 process, they are removed.
609
610 For normal staves this behaviour is called with the
611 @code{\RemoveEmptyStaffContext} command.  It is set in the
612 @code{\layout} block.  As a result staves containing nothing or
613 whole mesure rests are removed after a line break.
614
615 @lilypond[verbatim,quote]
616 \layout {
617   \context {
618     \RemoveEmptyStaffContext
619   }
620 }
621 \relative c'' {
622   <<
623     \new Staff { e4 f g a \break c1 }
624     \new Staff { c4 d e f \break R1 }
625   >>
626 }
627 @end lilypond
628
629 To remove other types of contexts, use
630 @code{\AncientRemoveEmptyStaffContext} or
631 @code{\RemoveEmptyRhythmicStaffContext}.
632
633 @cindex ossia
634
635 @c FIXME Really? I need to see about this.  -pm
636
637 Another application of the @code{\RemoveEmptyStaffContext} is to
638 make ossia sections, i.e., alternative melodies on a separate
639 piece of staff, with help of a Frenched staff.  See
640 @ref{Ossia staves}.
641
642 @c FIXME Is this in the right section?
643 @c maybe move to Staff symbol -pm
644
645 You can make the staff lines invisible by removing the
646 @code{Staff_symbol_engraver} from the @code{Staff} context.
647
648 @lilypond[verbatim,quote]
649 \score {
650   \new Staff \relative c'' { c8 c c16 c c c }
651   \layout{
652     \context {
653       \Staff
654       \remove Staff_symbol_engraver
655     }
656   }
657 }
658 @end lilypond
659
660
661 @snippets
662
663 The first empty staff can also be removed from the score with a
664 setting in the @code{VerticalAxisGroup} property.  This can be
665 done globally inside the @code{\layout} block, or locally inside
666 the specific staff that should be removed. In the latter case, you
667 have to specify the context (@code{Staff} applies only to the
668 current staff) in front of the property.
669
670 The lower staff of the second staff group is not removed, because
671 the setting applies only to the specific staff inside of which it
672 is written.
673
674 @lilypond[verbatim,quote]
675 \layout {
676   \context {
677     \RemoveEmptyStaffContext
678     %To use the setting globally, uncomment the following line:
679     %\override VerticalAxisGroup #'remove-first = ##t
680   }
681 }
682 \new StaffGroup
683   \relative c'' <<
684     \new Staff {
685       e4 f g a \break c1 }
686     \new Staff {
687       %To use the setting globally, comment this line, uncomment the line above
688       \override Staff.VerticalAxisGroup #'remove-first = ##t
689       R1 \break R1 }
690   >>
691 \new StaffGroup
692   <<
693     \new Staff { e4 f g a \break c1 }
694     \new Staff { R \break R1 }
695   >>
696 @end lilypond
697
698 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
699 {removing-the-first-empty-line.ly}
700
701
702 @predefined
703
704 @funindex \RemoveEmptyStaffContext
705 @code{\RemoveEmptyStaffContext},
706 @funindex \AncientRemoveEmptyStaffContext
707 @code{\AncientRemoveEmptyStaffContext},
708 @funindex \RemoveEmptyRhythmicStaffContext
709 @code{\RemoveEmptyRhythmicStaffContext}.
710
711
712 @seealso
713
714 Notation Reference:
715 @ref{Staff symbol},
716 @ref{Ossia staves}.
717
718 Snippets:
719 @rlsr{Staff notation}.
720
721 Internals Reference:
722 @rinternals{ChordNames},
723 @rinternals{FiguredBass},
724 @rinternals{Lyrics},
725 @rinternals{Staff},
726 @rinternals{VerticalAxisGroup}.
727
728
729 @node Writing parts
730 @subsection Writing parts
731
732 @menu
733 * Metronome marks::
734 * Instrument names::
735 * Quoting other voices::
736 * Formatting cue notes::
737 @end menu
738
739
740 @node Metronome marks
741 @unnumberedsubsubsec Metronome marks
742
743 @cindex tempo
744 @cindex beats per minute
745 @cindex metronome marking
746
747 Metronome settings can be entered as follows
748
749 @example
750 \tempo @var{duration} = @var{per-minute}
751 @end example
752
753 In the MIDI output, they are interpreted as a tempo change.  In
754 the layout output, a metronome marking is printed
755
756 @funindex \tempo
757
758 @lilypond[verbatim,quote,relative=2]
759 \tempo 8. = 120
760 c1
761 @end lilypond
762
763
764 @snippets
765
766 To change the tempo in the MIDI output without printing anything,
767 make the metronome marking invisible @example \once \override
768 Score.MetronomeMark #'transparent = ##t @end example
769
770 To print other metronome markings, use these markup commands
771 @lilypond[verbatim,quote,relative=1]
772 c4^\markup {
773   (
774   \smaller \general-align #Y #DOWN \note #"16." #1
775   =
776   \smaller \general-align #Y #DOWN \note #"8" #1
777   ) }
778 @end lilypond
779
780 For more details, see @ref{Formatting text}.
781
782
783 @seealso
784
785 Music Glossary:
786 @rglos{metronome},
787 @rglos{metronomic indication},
788 @rglos{tempo indication},
789 @rglos{metronome mark}.
790
791 Notation Reference:
792 @ref{Formatting text},
793 @ref{MIDI output}.
794
795 Snippets:
796 @rlsr{Staff notation}.
797
798 Internals Reference:
799 @rinternals{MetronomeMark}.
800
801
802 @knownissues
803
804 Collisions are not checked.  If you have notes above the top line
805 of the staff (or notes with articulations, slurs, text, etc), then
806 the metronome marking may be printed on top of musical symbols.
807 If this occurs, increase the padding of the metronome mark to
808 place it further away from the staff.
809
810 @example
811 \override Score.MetronomeMark #'padding = #2.5
812 @end example
813
814 @c perhaps also an example of how to move it horizontally?
815
816
817 @node Instrument names
818 @unnumberedsubsubsec Instrument names
819
820 @cindex instrument names
821 @cindex instrument names, short
822
823 In an orchestral score, instrument names are printed at the left
824 side of the staves.
825
826 This can be achieved by setting @code{Staff}.@code{instrumentName}
827 and @code{Staff}.@code{shortInstrumentName}, or
828 @code{PianoStaff}.@code{instrumentName} and
829 @code{PianoStaff}.@code{shortInstrumentName}.  This will print
830 text before the start of the staff.  For the first staff,
831 @code{instrumentName} is used.  If set, @code{shortInstrumentName}
832 is used for the following staves.
833
834 @lilypond[verbatim,quote,relative=1]
835 \set Staff.instrumentName = "Ploink "
836 \set Staff.shortInstrumentName = "Plk "
837 c1
838 \break
839 c''1
840 @end lilypond
841
842 Markup mode can be used to create more complicated instrument
843 names:
844
845 @lilypond[verbatim,quote,relative=2]
846 \set Staff.instrumentName = \markup {
847   \column { "Clarinetti"
848             \line { "in B" \smaller \flat } } }
849 c1
850 @end lilypond
851
852 @cindex instrument names, centering
853
854 As instrument names are centered by default, multi line names are
855 better entered using @code{\center-align}:
856
857 @lilypond[verbatim,quote,relative=2]
858 <<
859   \new Staff {
860     \set Staff.instrumentName = \markup \center-align {
861       Clarinetti
862       \line { "in B" \smaller \flat }
863     }
864     c1
865   }
866   \new Staff {
867     \set Staff.instrumentName = "Vibraphone"
868     c1
869   }
870 >>
871 @end lilypond
872
873 For longer instrument names, it may be useful to increase the
874 @code{indent} setting in the @code{\layout} block.
875
876 Short instrument names, printed before the systems following the
877 first one, are also centered by default, in a space which width is
878 given by the @code{short-indent} variable of the @code{\layout}
879 block.
880
881 To add instrument names to other contexts (such as
882 @code{GrandStaff}, @code{ChoirStaff}, or @code{StaffGroup}), the
883 engraver must be added to that context.
884
885 @example
886 \layout@{
887   \context @{\GrandStaff \consists "Instrument_name_engraver"@}
888 @}
889 @end example
890
891 @noindent
892 More information about adding and removing engravers can be found
893 in @ref{Modifying context plug-ins}.
894
895 @cindex instrument names, changing
896
897 Instrument names may be changed in the middle of a piece:
898
899 @lilypond[verbatim,quote,relative=1]
900 \set Staff.instrumentName = "First"
901 \set Staff.shortInstrumentName = "one"
902 c1 c c c \break
903 c1 c c c \break
904 \set Staff.instrumentName = "Second"
905 \set Staff.shortInstrumentName = "two"
906 c1 c c c \break
907 c1 c c c \break
908 @end lilypond
909
910
911 @seealso
912
913 Notation Reference:
914 @ref{Modifying context plug-ins}.
915
916 Snippets:
917 @rlsr{Staff notation}.
918
919 Internals Reference:
920 @rinternals{InstrumentName},
921 @rinternals{PianoStaff},
922 @rinternals{Staff}.
923
924
925 @node Quoting other voices
926 @unnumberedsubsubsec Quoting other voices
927
928 @cindex cues
929 @cindex quoting other voices
930 @cindex fragments
931 @cindex cue notes
932
933 With quotations, fragments of other parts can be inserted into a
934 part directly.  Before a part can be quoted, it must be marked
935 especially as quotable.  This is done with the @code{\addQuote}
936 command.
937
938 @example
939 \addQuote @var{name} @var{music}
940 @end example
941
942 @noindent
943 Here, @var{name} is an identifying string.  The @var{music} is any
944 kind of music.  Here is an example of @code{\addQuote}
945
946 @example
947 \addQuote clarinet \relative c' @{
948   f4 fis g gis
949 @}
950 @end example
951
952 This command must be entered at toplevel, i.e., outside any music
953 blocks.  Typically, one would use an already defined music event
954 as the @var{music}:
955
956 @example
957 clarinet = \relative c' @{
958   f4 fis g gis
959 @}
960 \addQuote clarinet @{ \clarinet @}
961 @end example
962
963 After calling @code{\addQuote}, the quotation may then be done
964 with @code{\quoteDuring} or @code{\cueDuring},
965
966 @example
967 \quoteDuring #@var{name} @var{music}
968 @end example
969
970 During a part, a piece of music can be quoted with the
971 @code{\quoteDuring} command.
972
973 @example
974 \quoteDuring #"clarinet" @{ s2. @}
975 @end example
976
977 This would cite three quarter notes (the duration of @code{s2.})
978 of the previously added @code{clarinet} voice.
979
980 More precisely, it takes the current time-step of the part being
981 printed, and extracts the notes at the corresponding point of the
982 @code{\addQuote}d voice.  Therefore, the argument to
983 @code{\addQuote} should be the entire part of the voice to be
984 quoted, including any rests at the beginning.
985
986 It is possible to use another music expression instead of
987 @code{s}, thus creating a polyphonic section, but this may not
988 always give the desired result.
989
990 Quotations take into account the transposition of both source and
991 target instruments, if they are specified using the
992 @code{\transposition} command.
993
994 @lilypond[verbatim,quote,relative=1]
995 \addQuote clarinet
996 {
997   \transposition bes
998   f4 fis g gis
999 }
1000
1001 {
1002   e8 f8 \quoteDuring #"clarinet" { s2 }
1003 }
1004 @end lilypond
1005
1006 The type of events that are present in the quoted music can be
1007 trimmed with the @code{quotedEventTypes} property.  The default
1008 value is @code{(note-event rest-event)}, which means that only
1009 notes and rests of the quoted voice end up in the
1010 @code{\quoteDuring}.  Setting
1011
1012 @example
1013 \set Staff.quotedEventTypes =
1014        #'(note-event articulation-event dynamic-event)
1015 @end example
1016
1017 @noindent
1018 will quote notes (but no rests), together with scripts and
1019 dynamics.
1020
1021
1022 @seealso
1023
1024 Notation Reference:
1025 @ref{Instrument transpositions}.
1026
1027 Snippets:
1028 @rlsr{Staff notation}.
1029
1030 Internals Reference:
1031 @rinternals{QuoteMusic},
1032 @rinternals{Voice}.
1033
1034
1035 @knownissues
1036
1037 Only the contents of the first @code{Voice} occurring in an
1038 @code{\addQuote} command will be considered for quotation, so
1039 @var{music} can not contain @code{\new} and @code{\context Voice}
1040 statements that would switch to a different Voice.
1041
1042 Quoting grace notes is broken and can even cause LilyPond to
1043 crash.
1044
1045 Quoting nested triplets may result in poor notation.
1046
1047 In earlier versions of LilyPond (pre 2.11), @code{addQuote} was
1048 written entirely in lower-case letters: @code{\addquote}.
1049
1050
1051 @node Formatting cue notes
1052 @unnumberedsubsubsec Formatting cue notes
1053
1054 @cindex cues
1055 @cindex cue notes
1056 @cindex cue notes, formatting
1057 @cindex fragments
1058 @cindex quoting other voices
1059 @cindex cues, formatting
1060
1061 The previous section deals with inserting notes from another
1062 voice.  There is a more advanced music function called
1063 @code{\cueDuring}, which makes formatting cue notes easier.
1064
1065 The syntax is
1066
1067 @example
1068   \cueDuring #@var{name} #@var{updown} @var{music}
1069 @end example
1070
1071 This will insert notes from the part @var{name} into a
1072 @code{Voice} called @code{cue}.  This happens simultaneously with
1073 @var{music}, which usually is a rest.  When the cue notes start,
1074 the staff in effect becomes polyphonic for a moment.  The argument
1075 @var{updown} determines whether the cue notes should be notated as
1076 a first or second voice.
1077
1078 @lilypond[verbatim]
1079 smaller = {
1080   \set fontSize = #-2
1081   \override Stem #'length-fraction = #0.8
1082   \override Beam #'thickness = #0.384
1083   \override Beam #'length-fraction = #0.8
1084 }
1085
1086 \addQuote clarinet
1087 \relative c' {
1088   R1*20
1089   r2 r8 c' f f
1090 }
1091
1092 \new Staff \relative c' <<
1093
1094   % setup a context for cue notes.
1095   \new Voice = "cue" { \smaller \skip 1*21 }
1096
1097   \set Score.skipBars = ##t
1098
1099   \new Voice {
1100     R1*20
1101     \cueDuring #"clarinet" #UP {
1102       R1
1103     }
1104     g4 g2.
1105   }
1106 >>
1107 @end lilypond
1108
1109 Here are a couple of hints for successful cue notes:
1110
1111 @itemize
1112 @item
1113 Cue notes have smaller font sizes.
1114
1115 @item
1116 The cued part is marked with the instrument playing the cue.
1117
1118 @item
1119 When the original part takes over again, this should be marked
1120 with the name of the original instrument.
1121
1122 @item
1123 Any other changes introduced by the cued part should also be
1124 undone.  For example, if the cued instrument plays in a different
1125 clef, the original clef should be stated once again.
1126
1127 @end itemize
1128
1129 The macro @code{\transposedCueDuring} is useful to add cues to
1130 instruments which use a completely different octave range (for
1131 example, having a cue of a piccolo flute within a contra bassoon
1132 part).
1133
1134 @lilypond[verbatim,quote]
1135 picc = \relative c''' {
1136   \clef "treble^8"
1137   R1 |
1138   c8 c c e g2 |
1139   a4 g g2 |
1140 }
1141 \addQuote "picc" { \picc }
1142
1143 cbsn = \relative c, {
1144   \clef "bass_8"
1145   c4 r g r
1146   \transposedCueDuring #"picc" #UP c,, { R1 } |
1147   c4 r g r |
1148 }
1149
1150 <<
1151   \new Staff = "picc" \picc
1152   \new Staff = "cbsn" \cbsn
1153 >>
1154 @end lilypond
1155
1156
1157 @seealso
1158
1159 Snippets:
1160 @rlsr{Staff notation}.
1161
1162 Internals Reference:
1163 @rinternals{Voice}.
1164