]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/notation/staff.itely
Doc: NR - using \unfoldRepeat with \addQuote
[lilypond.git] / Documentation / notation / 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.  For details, see the Contributors'
7     Guide, node Updating translation committishes..
8 @end ignore
9
10 @c \version "2.19.21"
11
12 @node Staff notation
13 @section Staff notation
14
15 @c The line width is a bit of a hack to allow space for the
16 @c  instrument names.
17 @lilypondfile[quote,ragged-right,line-width=14.5\cm,staffsize=16]{staff-headword.ly}
18
19 This section explains how to influence the appearance of staves,
20 how to print scores with more than one staff, and how to add tempo
21 indications and cue notes to staves.
22
23 @menu
24 * Displaying staves::
25 * Modifying single staves::
26 * Writing parts::
27 @end menu
28
29
30 @node Displaying staves
31 @subsection Displaying staves
32
33 This section describes the different methods of creating and
34 grouping staves.
35
36 @menu
37 * Instantiating new staves::
38 * Grouping staves::
39 * Nested staff groups::
40 * Separating systems::
41 @end menu
42
43
44 @node Instantiating new staves
45 @unnumberedsubsubsec Instantiating new staves
46
47 @cindex new staff
48 @cindex staff initiation
49 @cindex staff instantiation
50 @cindex staff, new
51 @cindex staff, single
52 @cindex staff, drum
53 @cindex staff, percussion
54 @cindex drum staff
55 @cindex percussion staff
56 @cindex Gregorian transcription staff
57 @cindex rhythmic staff
58 @cindex tabstaff
59 @cindex tablature
60
61 @funindex \drummode
62 @funindex drummode
63 @funindex DrumStaff
64 @funindex RhythmicStaff
65 @funindex TabStaff
66 @funindex MensuralStaff
67 @funindex VaticanaStaff
68 @funindex GregorianTranscriptionStaff
69
70 @notation{Staves} (singular: @notation{staff}) are created with
71 the @code{\new} or @code{\context} commands.  For details, see
72 @ref{Creating and referencing contexts}.
73
74 The basic staff context is @code{Staff}:
75
76 @lilypond[verbatim,quote]
77 \new Staff \relative { c''4 d e f }
78 @end lilypond
79
80 The @code{DrumStaff} context creates a five-line staff set up for
81 a typical drum set.  Each instrument is shown with a different
82 symbol.  The instruments are entered in drum mode following a
83 @code{\drummode} command, with each instrument specified by name.
84 For details, see @ref{Percussion staves}.
85
86 @lilypond[verbatim,quote]
87 \new DrumStaff {
88   \drummode { cymc hh ss tomh }
89 }
90 @end lilypond
91
92 @code{RhythmicStaff} creates a single-line staff that only
93 displays the rhythmic values of the input.  Real durations are
94 preserved.  For details, see @ref{Showing melody rhythms}.
95
96 @lilypond[verbatim,quote]
97 \new RhythmicStaff { c4 d e f }
98 @end lilypond
99
100 @code{TabStaff} creates a tablature with six strings in standard
101 guitar tuning.  For details, see @ref{Default tablatures}.
102
103 @lilypond[verbatim,quote]
104 \new TabStaff \relative { c''4 d e f }
105 @end lilypond
106
107 There are two staff contexts specific for the notation of ancient
108 music: @code{MensuralStaff} and @code{VaticanaStaff}.  They are
109 described in @ref{Pre-defined contexts}.
110
111 The @code{GregorianTranscriptionStaff} context creates a staff to
112 notate modern Gregorian chant.  It does not show bar lines.
113
114 @lilypond[verbatim,quote]
115 \new GregorianTranscriptionStaff \relative { c''4 d e f e d }
116 @end lilypond
117
118 New single staff contexts may be defined.  For details, see
119 @ref{Defining new contexts}.
120
121 @seealso
122 Music Glossary:
123 @rglos{staff},
124 @rglos{staves}.
125
126 Notation Reference:
127 @ref{Creating and referencing contexts},
128 @ref{Percussion staves},
129 @ref{Showing melody rhythms},
130 @ref{Default tablatures},
131 @ref{Pre-defined contexts},
132 @ref{Staff symbol},
133 @ref{Gregorian chant contexts},
134 @ref{Mensural contexts},
135 @ref{Defining new contexts}.
136
137 Snippets:
138 @rlsr{Staff notation}.
139
140 Internals Reference:
141 @rinternals{Staff},
142 @rinternals{DrumStaff},
143 @rinternals{GregorianTranscriptionStaff},
144 @rinternals{RhythmicStaff},
145 @rinternals{TabStaff},
146 @rinternals{MensuralStaff},
147 @rinternals{VaticanaStaff},
148 @rinternals{StaffSymbol}.
149
150
151 @node Grouping staves
152 @unnumberedsubsubsec Grouping staves
153
154 @cindex start of system
155 @cindex staff, multiple
156 @cindex staves, multiple
157 @cindex system start delimiters
158 @cindex bracket, vertical
159 @cindex brace, vertical
160 @cindex choir staff
161 @cindex grand staff
162 @cindex piano staff
163 @cindex staff group
164 @cindex staff, choir
165 @cindex staff, piano
166 @cindex staff, grand
167 @cindex system
168
169 Various contexts exist to group single staves together in order to
170 form multi-stave systems.  Each grouping context sets the style of
171 the system start delimiter and the behavior of bar lines.
172
173 If no context is specified, the default properties will be used:
174 the group is started with a vertical line, and the bar lines are
175 not connected.
176
177 @lilypond[verbatim,quote]
178 <<
179   \new Staff \relative { c''1 c }
180   \new Staff \relative { c''1 c }
181 >>
182 @end lilypond
183
184 In the @code{StaffGroup} context, the group is started with a
185 bracket and bar lines are drawn through all the staves.
186
187 @lilypond[verbatim,quote]
188 \new StaffGroup <<
189   \new Staff \relative { c''1 c }
190   \new Staff \relative { c''1 c }
191 >>
192 @end lilypond
193
194 In a @code{ChoirStaff}, the group starts with a bracket, but bar
195 lines are not connected.
196
197 @lilypond[verbatim,quote]
198 \new ChoirStaff <<
199   \new Staff \relative { c''1 c }
200   \new Staff \relative { c''1 c }
201 >>
202 @end lilypond
203
204 In a @code{GrandStaff}, the group begins with a brace, and bar
205 lines are connected between the staves.
206
207 @lilypond[verbatim,quote]
208 \new GrandStaff <<
209   \new Staff \relative { c''1 c }
210   \new Staff \relative { c''1 c }
211 >>
212 @end lilypond
213
214 The @code{PianoStaff} is identical to a @code{GrandStaff}, except
215 that it supports printing the instrument name directly.  For
216 details, see @ref{Instrument names}.
217
218 @lilypond[verbatim,quote]
219 \new PianoStaff <<
220   \set PianoStaff.instrumentName = #"Piano"
221   \new Staff \relative { c''1 c }
222   \new Staff \relative { \clef bass c1 c }
223 >>
224 @end lilypond
225
226 Each staff group context sets the property
227 @code{systemStartDelimiter} to one of the following values:
228 @code{SystemStartBar}, @code{SystemStartBrace}, or
229 @code{SystemStartBracket}.  A fourth delimiter,
230 @code{SystemStartSquare}, is also available, but it must be
231 explicitly specified.
232
233 New staff group contexts may be defined.  For details, see
234 @ref{Defining new contexts}.
235
236
237 @snippets
238
239 @lilypondfile[verbatim,quote,texidoc,doctitle]
240 {use-square-bracket-at-the-start-of-a-staff-group.ly}
241
242 @lilypondfile[verbatim,quote,texidoc,doctitle]
243 {display-bracket-with-only-one-staff-in-a-system.ly}
244
245 @cindex mensurstriche layout
246 @cindex renaissance music
247 @cindex transcription of mensural music
248 @cindex mensural music, transcription of
249
250 @lilypondfile[verbatim,quote,texidoc,doctitle]
251 {mensurstriche-layout-bar-lines-between-the-staves.ly}
252
253 @seealso
254 Music Glossary:
255 @rglos{brace},
256 @rglos{bracket},
257 @rglos{grand staff}.
258
259 Notation Reference:
260 @ref{Instrument names},
261 @ref{Defining new contexts}.
262
263 Snippets:
264 @rlsr{Staff notation}.
265
266 Internals Reference:
267 @rinternals{Staff},
268 @rinternals{StaffGroup},
269 @rinternals{ChoirStaff},
270 @rinternals{GrandStaff},
271 @rinternals{PianoStaff},
272 @rinternals{SystemStartBar},
273 @rinternals{SystemStartBrace},
274 @rinternals{SystemStartBracket},
275 @rinternals{SystemStartSquare}.
276
277
278 @node Nested staff groups
279 @unnumberedsubsubsec Nested staff groups
280
281 @cindex staff, nested
282 @cindex staves, nested
283 @cindex nesting of staves
284 @cindex system start delimiters, nested
285 @cindex nested staff brackets
286 @cindex brackets, nesting of
287 @cindex braces, nesting of
288
289 Staff-group contexts can be nested to arbitrary depths.  In this
290 case, each child context creates a new bracket adjacent to the
291 bracket of its parent group.
292
293 @lilypond[verbatim,quote]
294 \new StaffGroup <<
295   \new Staff \relative { c''2 c | c2 c }
296   \new StaffGroup <<
297     \new Staff \relative { g'2 g | g2 g }
298     \new StaffGroup \with {
299       systemStartDelimiter = #'SystemStartSquare
300     }
301     <<
302       \new Staff \relative { e'2 e | e2 e }
303       \new Staff \relative { c'2 c | c2 c }
304     >>
305   >>
306 >>
307 @end lilypond
308
309 New nested staff group contexts can be defined.  For details, see
310 @ref{Defining new contexts}.
311
312
313 @snippets
314
315 @lilypondfile[verbatim,quote,texidoc,doctitle]
316 {nesting-staves.ly}
317
318 @seealso
319 Notation Reference:
320 @ref{Grouping staves},
321 @ref{Instrument names},
322 @ref{Defining new contexts}.
323
324 Snippets:
325 @rlsr{Staff notation}.
326
327 Internals Reference:
328 @rinternals{StaffGroup},
329 @rinternals{ChoirStaff},
330 @rinternals{SystemStartBar},
331 @rinternals{SystemStartBrace},
332 @rinternals{SystemStartBracket},
333 @rinternals{SystemStartSquare}.
334
335
336 @node Separating systems
337 @unnumberedsubsubsec Separating systems
338
339 @cindex system separator mark
340
341 If the number of systems per page changes from page to page it is
342 customary to separate the systems by placing a system separator mark
343 between them.  By default the system separator is blank, but can be
344 turned on with a @code{\paper} option.
345
346 @c \book is required here to display the system separator
347 @c ragged-right is required as there are two systems
348 @lilypond[verbatim,quote,ragged-right]
349 \book {
350   \score {
351     \new StaffGroup <<
352       \new Staff {
353         \relative {
354           c''4 c c c
355           \break
356           c4 c c c
357         }
358       }
359       \new Staff {
360         \relative {
361           c''4 c c c
362           \break
363           c4 c c c
364         }
365       }
366     >>
367   }
368   \paper {
369     system-separator-markup = \slashSeparator
370     % following commands are needed only to format this documentation
371     paper-width = 100\mm
372     paper-height = 100\mm
373     tagline = ##f
374   }
375 }
376 @end lilypond
377
378 @seealso
379 Notation Reference:
380 @ref{Page layout}.
381
382 Snippets:
383 @rlsr{Staff notation}.
384
385
386 @node Modifying single staves
387 @subsection Modifying single staves
388
389 This section explains how to change specific attributes of one
390 staff: for example, modifying the number of staff lines or the
391 staff size.  Methods to start and stop staves and set ossia
392 sections are also described.
393
394 @menu
395 * Staff symbol::
396 * Ossia staves::
397 * Hiding staves::
398 @end menu
399
400
401 @node Staff symbol
402 @unnumberedsubsubsec Staff symbol
403
404 @cindex staff symbol
405 @cindex staff lines, stopping and starting
406 @cindex staff lines, modifying
407 @cindex ledger lines
408 @cindex ledger lines, internal
409 @cindex ledger lines, modifying
410
411 @funindex \startStaff
412 @funindex startStaff
413 @funindex \stopStaff
414 @funindex stopStaff
415
416 The @code{\stopStaff} and @code{\startStaff} commands can be used to
417 stop or (re)start the staff lines respectively, from being printed at
418 any point witin a score.
419
420 @lilypond[verbatim,quote]
421 \relative {
422   \stopStaff f''4 d \startStaff g, e
423   f'4 d \stopStaff g, e
424   f'4 d \startStaff g, e
425 }
426 @end lilypond
427
428 @predefined
429 @code{\startStaff},
430 @code{\stopStaff}.
431 @endpredefined
432
433 The lines of a staff belong to the @code{StaffSymbol} grob (including
434 ledger lines) and can be modified using @code{StaffSymbol} properties, but
435 these modifications must be made before the staff is (re)started.
436
437 The number of staff lines can be altered:
438
439 @lilypond[verbatim,quote]
440 \relative {
441   f''4 d \stopStaff
442   \override Staff.StaffSymbol.line-count = #2
443   \startStaff g, e |
444
445   f'4 d \stopStaff
446   \revert Staff.StaffSymbol.line-count
447   \startStaff g, e |
448 }
449 @end lilypond
450
451 The position of each staff line can also be altered.  A list of
452 numbers sets each line's position.  @code{0}@tie{}corresponds to the normal
453 center line, and the normal line positions are
454 @code{(-4@tie{}-2@tie{}0@tie{}2@tie{}4)}.  A single staff line is
455 printed for every value entered so that the number of staff lines, as
456 well as their position, can be changed with a single override.
457
458 @lilypond[verbatim,quote]
459 \relative {
460   f''4 d \stopStaff
461   \override Staff.StaffSymbol.line-positions = #'(1 3 5 -1 -3)
462   \startStaff g, e |
463   f'4 d \stopStaff
464   \override Staff.StaffSymbol.line-positions = #'(8 6.5 -6 -8 -0.5)
465   \startStaff g, e |
466 }
467 @end lilypond
468
469 To preserve typical stem directions (in the bottom half of the staff
470 stems point up, in the top half they point down), align the center
471 line (or space) of the customized staff with the position of the
472 normal center line (0).  The clef position and the position of
473 middle@tie{}C may need to be adjusted accordingly to fit the new
474 lines.  See @ref{Clef}.
475
476 Staff line thickness can be altered.  Ledger lines and note stems, by
477 default, are also affected.
478
479 @lilypond[verbatim,quote]
480 \new Staff \with {
481   \override StaffSymbol.thickness = #3
482 } \relative {
483   f''4 d g, e
484 }
485 @end lilypond
486
487 It is also possible to set ledger line thickness independently of staff
488 lines.
489
490 @lilypond[verbatim,quote]
491 \new Staff \with {
492   \override StaffSymbol.thickness = #2
493   \override StaffSymbol.ledger-line-thickness = #'(0.5 . 0.4)
494 } \relative {
495   f'''4 a, a,, f
496 }
497 @end lilypond
498
499 @noindent
500 The first value is multiplied by the staff line thickness, the second by
501 the staff space and then the two values are added together to give the
502 new thickness of the ledger line.
503
504 The vertical positions of ledger lines can be altered,
505
506 @lilypond[verbatim,quote]
507 \new Staff \with {
508   \override StaffSymbol.ledger-positions = #'(-3 -2 -1 2 5 6)
509 } \relative {
510   f'''4 a, a,, f
511 }
512 @end lilypond
513
514 Additional ledger lines can be made to appear above or below note heads
515 depending on the current position relative to other note heads that
516 also have their own ledger lines.
517
518 @lilypond[verbatim,quote]
519 \new Staff \with {
520   \override StaffSymbol.ledger-extra = #4
521 } \relative {
522   f'''4 a, d, f,
523 }
524 @end lilypond
525
526 Ledger lines can also be made to appear inside the staff where custom
527 staff lines are required.  The example shows the default position of
528 ledger lines when the explicit @code{ledger-position} is and is not set.
529 The @code{\stopStaff} is needed in the example to revert the
530 @code{\override} for the whole @code{StaffSymbol}.
531
532 @lilypond[verbatim,quote]
533 \relative d' {
534   \override Staff.StaffSymbol.line-positions = #'(-8 0 2 4)
535   d4 e f g
536   \stopStaff
537   \startStaff
538   \override Staff.StaffSymbol.ledger-positions = #'(-8 -6 (-4 -2) 0)
539   d4 e f g
540 }
541 @end lilypond
542
543 The distance between staff lines can be altered.  This affects ledger
544 line spacing as well.
545
546 @lilypond[verbatim,quote]
547 \new Staff \with {
548   \override StaffSymbol.staff-space = #1.5
549 } \relative {
550   f'''4 d, g, e,
551 }
552 @end lilypond
553
554 @snippets
555 @lilypondfile[verbatim,quote,texidoc,doctitle]
556 {making-some-staff-lines-thicker-than-the-others.ly}
557
558 @seealso
559 Music Glossary:
560 @rglos{line},
561 @rglos{ledger line},
562 @rglos{staff}.
563
564 Notation Reference:
565 @ref{Clef}.
566
567 Snippets:
568 @rlsr{Staff notation}.
569
570 Internals Reference:
571 @rinternals{StaffSymbol},
572 @rinternals{staff-symbol-interface}.
573
574
575 @node Ossia staves
576 @unnumberedsubsubsec Ossia staves
577
578 @cindex staff, Frenched
579 @cindex ossia
580 @cindex Frenched staves
581 @cindex staff, resizing of
582 @cindex resizing of staves
583
584 @funindex \startStaff
585 @funindex startStaff
586 @funindex \stopStaff
587 @funindex stopStaff
588
589 @notation{Ossia} staves can be set by creating a new simultaneous
590 staff in the appropriate location:
591
592 @lilypond[verbatim,quote]
593 \new Staff \relative {
594   c''4 b d c
595   <<
596     { c4 b d c }
597     \new Staff { e4 d f e }
598   >>
599   c4 b c2
600 }
601 @end lilypond
602
603 @noindent
604 However, the above example is not what is usually desired.  To
605 create ossia staves that are above the original staff, have no
606 time signature or clef, and have a smaller font size, tweaks must
607 be used.  The Learning Manual describes a specific technique to
608 achieve this goal, beginning with
609 @rlearning{Nesting music expressions}.
610
611 The following example uses the @code{alignAboveContext} property
612 to align the ossia staff.  This method is most appropriate when
613 only a few ossia staves are needed.
614
615 @lilypond[verbatim,quote]
616 \new Staff = "main" \relative {
617   c''4 b d c
618   <<
619     { c4 b d c }
620
621     \new Staff \with {
622       \remove "Time_signature_engraver"
623       alignAboveContext = #"main"
624       \magnifyStaff #2/3
625       firstClef = ##f
626     }
627     { e4 d f e }
628   >>
629   c4 b c2
630 }
631 @end lilypond
632
633 If many isolated ossia staves are needed, creating an empty
634 @code{Staff} context with a specific @emph{context id} may be more
635 appropriate; the ossia staves may then be created by
636 @emph{calling} this context and using @code{\startStaff} and
637 @code{\stopStaff} at the desired locations.  The benefits of this
638 method are more apparent if the piece is longer than the following
639 example.
640
641 @lilypond[verbatim,quote,ragged-right]
642 <<
643   \new Staff = "ossia" \with {
644     \remove "Time_signature_engraver"
645     \hide Clef
646     \magnifyStaff #2/3
647   }
648   { \stopStaff s1*6 }
649
650   \new Staff \relative {
651     c'4 b c2
652     <<
653       { e4 f e2 }
654       \context Staff = "ossia" {
655         \startStaff e4 g8 f e2 \stopStaff
656       }
657     >>
658     g4 a g2 \break
659     c4 b c2
660     <<
661       { g4 a g2 }
662       \context Staff = "ossia" {
663         \startStaff g4 e8 f g2 \stopStaff
664       }
665     >>
666     e4 d c2
667   }
668 >>
669 @end lilypond
670
671
672 Using the @code{\Staff \RemoveEmptyStaves} command to create ossia
673 staves may be used as an alternative.  This method is most
674 convenient when ossia staves occur immediately following a line
675 break.  For more information about
676 @code{\Staff \RemoveEmptyStaves}, see @ref{Hiding staves}.
677
678 @lilypond[verbatim,quote,ragged-right]
679 <<
680   \new Staff = "ossia" \with {
681     \remove "Time_signature_engraver"
682     \hide Clef
683     \magnifyStaff #2/3
684   } \relative {
685     R1*3
686     c''4 e8 d c2
687   }
688   \new Staff \relative {
689     c'4 b c2
690     e4 f e2
691     g4 a g2 \break
692     c4 b c2
693     g4 a g2
694     e4 d c2
695   }
696 >>
697
698 \layout {
699   \context {
700     \Staff \RemoveEmptyStaves
701     \override VerticalAxisGroup.remove-first = ##t
702   }
703 }
704 @end lilypond
705
706
707 @snippets
708
709 @lilypondfile[verbatim,quote,texidoc,doctitle]
710 {vertically-aligning-ossias-and-lyrics.ly}
711
712 @seealso
713 Music Glossary:
714 @rglos{ossia},
715 @rglos{staff},
716 @rglos{Frenched staff}.
717
718 Learning Manual:
719 @rlearning{Nesting music expressions},
720 @rlearning{Size of objects},
721 @rlearning{Length and thickness of objects}.
722
723 Notation Reference:
724 @ref{Hiding staves}.
725
726 Snippets:
727 @rlsr{Staff notation}.
728
729 Internals Reference:
730 @rinternals{StaffSymbol}.
731
732
733 @node Hiding staves
734 @unnumberedsubsubsec Hiding staves
735
736 @cindex Frenched score
737 @cindex Frenched staff
738 @cindex staff, hiding
739 @cindex staff, empty
740 @cindex hiding of staves
741 @cindex empty staves
742
743 @funindex \RemoveEmptyStaves
744 @funindex Staff_symbol_engraver
745 @funindex \stopStaff
746 @funindex stopStaff
747
748
749 Staff lines can be hidden by removing the
750 @code{Staff_symbol_engraver} from the @code{Staff} context.  As an
751 alternative, @code{\stopStaff} may be used.
752
753 @lilypond[verbatim,quote]
754 \new Staff \with {
755   \remove "Staff_symbol_engraver"
756 }
757 \relative { a''8 f e16 d c b a2 }
758 @end lilypond
759
760
761 Empty staves can be hidden by setting the
762 @code{\Staff \RemoveEmptyStaves} command in the @code{\layout}
763 block.  In orchestral scores, this style is known as @q{Frenched
764 Score}.  By default, this command hides and removes all empty
765 staves in a score except for those in the first system.
766
767 @warning{A staff is considered empty when it contains only
768 multi-measure rests, rests, skips, spacer rests, or a combination of these
769 elements.}
770
771 @lilypond[verbatim,quote,ragged-right]
772 \layout {
773   \context {
774     \Staff \RemoveEmptyStaves
775   }
776 }
777
778 \relative <<
779   \new Staff {
780     e'4 f g a \break
781     b1 \break
782     a4 b c2
783   }
784   \new Staff {
785     c,4 d e f \break
786     R1 \break
787     f4 g c,2
788   }
789 >>
790 @end lilypond
791
792 @cindex ossia
793
794 @noindent
795 @code{\Staff \RemoveEmptyStaves} can also be used to create ossia
796 sections for a staff.  For details, see @ref{Ossia staves}.
797
798 @cindex hiding ancient staves
799 @cindex hiding rhythmic staves
800
801 @funindex \RemoveEmptyStaves
802
803 The @code{\VaticanaStaff \RemoveEmptyStaves} command may be used to
804 hide empty staves in ancient music contexts.  Similarly,
805 @code{\RhythmicStaff \RemoveEmptyStaves} may be used to hide empty
806 @code{RhythmicStaff} contexts.
807
808
809 @predefined
810 @code{\Staff \RemoveEmptyStaves},
811 @code{\VaticanaStaff \RemoveEmptyStaves},
812 @code{\RhythmicStaff \RemoveEmptyStaves}.
813 @endpredefined
814
815
816 @snippets
817
818 @lilypondfile[verbatim,quote,texidoc,doctitle]
819 {removing-the-first-empty-line.ly}
820
821 @seealso
822 Music Glossary:
823 @rglos{Frenched staff}.
824
825 Learning Manual:
826 @rlearning{Visibility and color of objects}.
827
828 Notation Reference:
829 @ref{Changing context default settings},
830 @ref{Staff symbol},
831 @ref{Ossia staves},
832 @ref{Hidden notes},
833 @ref{Invisible rests},
834 @ref{Visibility of objects}.
835
836 Snippets:
837 @rlsr{Staff notation}.
838
839 Internals Reference:
840 @rinternals{ChordNames},
841 @rinternals{FiguredBass},
842 @rinternals{Lyrics},
843 @rinternals{Staff},
844 @rinternals{VerticalAxisGroup},
845 @rinternals{Staff_symbol_engraver}.
846
847 @knownissues
848 Removing @code{Staff_symbol_engraver} also hides bar lines.  If
849 bar line visibility is forced, formatting errors may occur.  In
850 this case, use the following overrides instead of removing the
851 engraver:
852
853 @example
854 \omit StaffSymbol
855 \override NoteHead.no-ledgers = ##t
856 @end example
857
858 For the Known issues and warnings associated with
859 @code{\Staff \RemoveEmptyStaves} see
860 @ref{Changing context default settings}.
861
862
863 @node Writing parts
864 @subsection Writing parts
865
866 This section explains how to insert tempo indications and
867 instrument names into a score.  Methods to quote other voices and
868 format cue notes are also described.
869
870 @menu
871 * Instrument names::
872 * Quoting other voices::
873 * Formatting cue notes::
874 @end menu
875
876 @node Instrument names
877 @unnumberedsubsubsec Instrument names
878
879 @cindex instrument names
880 @cindex instrument names, short
881
882 Instrument names can be printed on the left side of staves in the
883 @code{Staff}, @code{PianoStaff}, @code{StaffGroup}, @code{GrandStaff}
884 and @code{ChoirStaff} contexts.  The value of
885 @code{instrumentName} is used for the first staff, and the value
886 of @code{shortInstrumentName} is used for all succeeding staves.
887
888 @lilypond[verbatim,quote,ragged-right]
889 \new Staff \with {
890   instrumentName = #"Violin "
891   shortInstrumentName = #"Vln. "
892 } \relative {
893   c'4.. g'16 c4.. g'16 \break | c1 |
894 }
895 @end lilypond
896
897 @cindex instrument names, complex
898
899 @code{\markup} can be used to create more complex instrument names:
900
901 @lilypond[verbatim,quote]
902 \new Staff \with {
903   instrumentName = \markup {
904     \column { "Clarinetti"
905       \line { "in B" \smaller \flat }
906     }
907   }
908 } \relative {
909   c''4 c,16 d e f g2
910 }
911 @end lilypond
912
913 @cindex instrument names, centering
914
915 When two or more staff contexts are grouped together, the instrument
916 names and short instrument names are centered by default.  To center
917 multi-line instrument names, @code{\center-column} must be used:
918
919 @lilypond[verbatim,quote,indent=1.5\cm]
920 <<
921   \new Staff \with {
922     instrumentName = #"Flute"
923   } \relative {
924     f''2 g4 f
925 }
926   \new Staff \with {
927     instrumentName = \markup {
928       \center-column { "Clarinet"
929         \line { "in B" \smaller \flat }
930       }
931     }
932   } \relative { c''4 b c2 }
933 >>
934 @end lilypond
935
936 @funindex indent
937 @funindex short-indent
938
939 However, if the instrument names are longer, the instrument names in a
940 staff group may not be centered unless the @code{indent} and
941 @code{short-indent} settings are increased.  For details about these
942 settings, see @ref{paper variables for shifts and indents,,@code{@bs{}paper} variables for shifts and indents}.
943
944 @lilypond[verbatim,quote,ragged-right]
945 <<
946   \new Staff \with {
947     instrumentName = #"Alto Flute in G"
948     shortInstrumentName = #"Flt."
949   } \relative {
950     f''2 g4 f \break
951     g4 f g2
952   }
953   \new Staff \with {
954     instrumentName = #"Clarinet"
955     shortInstrumentName = #"Clar."
956   } \relative {
957     c''4 b c2 \break
958     c2 b4 c
959   }
960 >>
961
962 \layout {
963   indent = 3.0\cm
964   short-indent = 1.5\cm
965 }
966 @end lilypond
967
968 @cindex instrument names, adding to other contexts
969
970 To add instrument names to other contexts (such as @code{ChordNames} or
971 @code{FiguredBass}), @code{Instrument_name_engraver} must be added to
972 that context.  For details, see @ref{Modifying context plug-ins}.
973
974 @cindex instrument names, changing
975 @cindex changing instrument names
976
977 The @code{shortInstrumentName} may be changed in the middle of a piece,
978 along with other settings as needed for the new instrument.
979 However, only the first instance of @code{instrumentName} will be
980 printed and subsequent changes will be ignored:
981
982 @lilypond[verbatim,quote,ragged-right]
983 prepPiccolo = <>^\markup \italic { muta in Piccolo }
984
985 setPiccolo = {
986   \set Staff.instrumentName = #"Piccolo"
987   \set Staff.shortInstrumentName = #"Picc."
988   \set Staff.midiInstrument = #"piccolo"
989   <>^\markup \bold { Piccolo }
990   \transposition c''
991 }
992
993 prepFlute = <>^\markup \italic { muta in Flauto }
994
995 setFlute = {
996   \set Staff.instrumentName = #"Flute"
997   \set Staff.shortInstrumentName = #"Flt."
998   \set Staff.midiInstrument = #"flute"
999   <>^\markup \bold { Flute }
1000   \transposition c'
1001 }
1002
1003 \new Staff \with {
1004   instrumentName = #"Flute"
1005   shortInstrumentName = #"Flt."
1006   midiInstrument = #"flute"
1007 }
1008 \relative {
1009   g'1 g g g \break
1010   g1 g \prepPiccolo R R \break
1011   \setPiccolo
1012   g1 g g g \break
1013   g1 g \prepFlute R R \break
1014   \setFlute
1015   g1 g g g
1016 }
1017 @end lilypond
1018
1019
1020 @seealso
1021 Notation Reference:
1022 @ref{paper variables for shifts and indents,,@code{@bs{}paper} variables for shifts and indents},
1023 @ref{Modifying context plug-ins}.
1024
1025 Snippets:
1026 @rlsr{Staff notation}.
1027
1028 Internals Reference:
1029 @rinternals{InstrumentName},
1030 @rinternals{PianoStaff},
1031 @rinternals{Staff}.
1032
1033
1034 @node Quoting other voices
1035 @unnumberedsubsubsec Quoting other voices
1036
1037 @cindex quote, voices
1038 @cindex voices, quoting
1039 @cindex fragments, quoting
1040 @cindex cue notes
1041
1042 @funindex \addQuote
1043 @funindex addQuote
1044 @funindex \quoteDuring
1045 @funindex quoteDuring
1046 @funindex \transposition
1047 @funindex transposition
1048
1049 It is very common for one voice to use the same notes as those from
1050 another voice.  For example, first and second violins playing the same
1051 phrase during a particular passage of the music.  This is done by
1052 letting one voice @emph{quote} the other, without having to re-enter the
1053 music all over again for the second voice.
1054
1055 The @code{\addQuote} command, used in the top level scope, defines a
1056 stream of music from which fragments can be quoted.
1057
1058 The @code{\quoteDuring} command is used to indicate the point where the
1059 quotation begins.  It is followed by two arguments: the name of the
1060 quoted voice, as defined with @code{\addQuote}, and a music expression
1061 for the duration of the quote.
1062
1063 @lilypond[verbatim,quote]
1064 fluteNotes = \relative {
1065   a'4 gis g gis | b4^"quoted" r8 ais\p a4( f)
1066 }
1067
1068 oboeNotes = \relative {
1069   c''4 cis c b \quoteDuring #"flute" { s1 }
1070 }
1071
1072 \addQuote "flute" { \fluteNotes }
1073
1074 \score {
1075   <<
1076     \new Staff \with { instrumentName = "Flute" } \fluteNotes
1077     \new Staff \with { instrumentName = "Oboe" } \oboeNotes
1078   >>
1079 }
1080 @end lilypond
1081
1082 If the music expression used in @code{\quoteDuring} contains notes
1083 instead of spacer or multimeasure rests then the quote will appear as
1084 polyphony and may produce unexpected results.
1085
1086 @lilypond[verbatim,quote]
1087 fluteNotes = \relative {
1088   a'4 gis g gis | b4^"quoted" r8 ais\p a4( f)
1089 }
1090
1091 oboeNotes = \relative {
1092   c''4 cis c b \quoteDuring #"flute" { e4 r8 ais b4 a }
1093 }
1094
1095 \addQuote "flute" { \fluteNotes }
1096
1097 \score {
1098   <<
1099     \new Staff \with { instrumentName = "Flute" } \fluteNotes
1100     \new Staff \with { instrumentName = "Oboe" } \oboeNotes
1101   >>
1102 }
1103 @end lilypond
1104
1105 If an @code{\unfoldRepeat} command in a music expression is required to
1106 be printed when using @code{\quoteDuring}, then it too must also contain
1107 its own @code{\unfoldRepeat} command;
1108
1109 @lilypond[verbatim,quote]
1110 fluteNotes = \relative {
1111   \repeat volta 2 { a'4 gis g gis }
1112 }
1113
1114 oboeNotesDW = \relative {
1115   \repeat volta 2 \quoteDuring #"incorrect" { s1 }
1116 }
1117
1118 oboeNotesW = \relative {
1119   \repeat volta 2 \quoteDuring #"correct" { s1 }
1120 }
1121
1122
1123 \addQuote "incorrect" { \fluteNotes }
1124
1125 \addQuote "correct" { \unfoldRepeats \fluteNotes }
1126
1127 \score {
1128   \unfoldRepeats
1129   <<
1130     \new Staff \with { instrumentName = "Flute" }
1131     \fluteNotes
1132     \new Staff \with { instrumentName = "Oboe (incorrect)" }
1133     \oboeNotesDW
1134     \new Staff \with { instrumentName = "Oboe (correct)" }
1135     \oboeNotesW
1136   >>
1137 }
1138 @end lilypond
1139
1140 The @code{\quoteDuring} command uses the @code{\transposition} settings
1141 of both quoted and quoting parts to produce notes for the quoting part
1142 that have the same sounding pitch as those in the quoted part.
1143
1144 @lilypond[verbatim,quote]
1145 clarinetNotes = \relative c'' {
1146   \transposition bes
1147   \key d \major
1148   b4 ais a ais | cis4^"quoted" r8 bis\p b4( f)
1149 }
1150
1151 oboeNotes = \relative {
1152   c''4 cis c b \quoteDuring #"clarinet" { s1 }
1153 }
1154
1155 \addQuote "clarinet" { \clarinetNotes }
1156
1157
1158 \score {
1159   <<
1160     \new Staff \with { instrumentName = "Clarinet" } \clarinetNotes
1161     \new Staff \with { instrumentName = "Oboe" } \oboeNotes
1162   >>
1163 }
1164 @end lilypond
1165
1166 @cindex note-event
1167 @cindex articulation-event
1168 @cindex dynamic-event
1169 @cindex rest-event
1170 @cindex slur-event
1171 @cindex crescendo-event
1172
1173 @funindex quotedEventTypes
1174 @funindex quotedCueEventTypes
1175
1176 By default quoted music will include all articulations, dynamics,
1177 markups, etc., in the quoted expression.  It is possible to choose which
1178 of these objects from the quoted music are displayed by using the
1179 @code{quotedEventTypes} context property.
1180
1181 @lilypond[verbatim,quote]
1182 fluteNotes = \relative {
1183   a'2 g2 |
1184   b4\<^"quoted" r8 ais a4\f( c->)
1185  }
1186
1187 oboeNotes = \relative {
1188   c''2. b4 |
1189   \quoteDuring #"flute" { s1 }
1190 }
1191
1192 \addQuote "flute" { \fluteNotes }
1193
1194 \score {
1195   <<
1196     \set Score.quotedEventTypes = #'(note-event articulation-event
1197                                      crescendo-event rest-event
1198                                      slur-event dynamic-event)
1199     \new Staff \with { instrumentName = "Flute" } \fluteNotes
1200     \new Staff \with { instrumentName = "Oboe" } \oboeNotes
1201   >>
1202  }
1203 @end lilypond
1204
1205 Quotes can also be tagged, see @ref{Using tags}.
1206
1207 @seealso
1208 Notation Reference:
1209 @ref{Instrument transpositions},
1210 @ref{Using tags}.
1211
1212 Installed Files:
1213 @file{scm/define-event-classes.scm}.
1214
1215 Snippets:
1216 @rlsr{Staff notation}.
1217
1218 Internals Reference:
1219 @rinternals{Music classes},
1220 @rinternals{QuoteMusic},
1221 @rinternals{Voice}.
1222
1223 @knownissues
1224 Only the contents of the first @code{Voice} occurring in an
1225 @code{\addQuote} command will be considered for quotation, so if the music
1226 expression contains @code{\new} or @code{\context Voice}
1227 statements, their contents will not be quoted.  Quoting grace notes
1228 is unsupported and may cause LilyPond to crash whereas quoting nested
1229 triplets may result in poor notation.
1230
1231
1232 @node Formatting cue notes
1233 @unnumberedsubsubsec Formatting cue notes
1234
1235 @cindex cue notes
1236 @cindex fragments
1237 @cindex cue notes, formatting
1238 @cindex formatting, cue notes
1239 @cindex voices, quoting
1240
1241
1242 @funindex \cueDuring
1243 @funindex cueDuring
1244 @funindex \cueClef
1245 @funindex cueClef
1246 @funindex \cueDuringWithClef
1247 @funindex cueDuringWithClef
1248 @funindex \quoteDuring
1249 @funindex quoteDuring
1250
1251 @cindex notes, smaller
1252 @cindex smaller notes
1253 @cindex CueVoice
1254
1255 The simplest way to format cue notes is to explicitly create a
1256 @code{CueVoice} context within the part.
1257
1258 @lilypond[verbatim]
1259 \relative {
1260   R1
1261   <<
1262     { e'2\rest r4. e8 }
1263     \new CueVoice {
1264       \stemUp d'8^"flute" c d e fis2
1265     }
1266   >>
1267   d,4 r a r
1268 }
1269 @end lilypond
1270
1271 The @code{\cueClef} command can also be used with an explict
1272 @code{CueVoice} context if a change of clef is required and will print
1273 an appropriately sized clef for the cue notes.  The @code{\cueClefUnset}
1274 command can then be used to switch back to the original clef, again with
1275 an appropriately sized clef.
1276
1277 @lilypond[verbatim,noragged-right]
1278 \relative {
1279   \clef "bass"
1280   R1
1281   <<
1282     { e'2\rest r4. \cueClefUnset e,8 }
1283     \new CueVoice {
1284       \cueClef "treble" \stemUp d''8^"flute" c d e fis2
1285     }
1286   >>
1287   d,,4 r a r
1288 }
1289 @end lilypond
1290
1291 The @code{\cueClef} and @code{\cueClefUnset} command can also be used
1292 without a @code{CueVoice} if required.
1293
1294 @lilypond[verbatim,noragged-right]
1295 \relative {
1296   \clef "bass"
1297   R1
1298   \cueClef "treble"
1299   d''8^"flute" c d e fis2
1300   \cueClefUnset
1301   d,,4 r a r
1302 }
1303 @end lilypond
1304
1305 For more complex cue note placement, e.g including transposition, or
1306 inserting cue notes from multiple music sources the @code{\cueDuring} or
1307 @code{\cueDuringWithClef} commands can be used.  These are more
1308 specialized form of @code{\quoteDuring}, see @ref{Quoting other voices}
1309 in the previous section.
1310
1311 The syntax is:
1312
1313 @example
1314 \cueDuring #@var{quotename} #@var{direction} #@var{music}
1315 @end example
1316
1317 and
1318
1319 @example
1320 \cueDuringWithClef #@var{quotename} #@var{direction} #@var{clef} #@var{music}
1321 @end example
1322
1323 The music from the corresponding measures of the @code{@var{quote name}}
1324 is added as a @code{CueVoice} context and occurs simultaneously with the
1325 @code{@var{music}}, which then creates a polyphonic situation.  The
1326 @code{@var{direction}} takes the argument @code{UP} or @code{DOWN}, and
1327 corresponds to the first and second voices respectively, determining how
1328 the cue notes are printed in relation to the other voice.
1329
1330 @lilypond[verbatim,quote]
1331 fluteNotes = \relative {
1332   r2. c''4 | d8 c d e fis2 | g2 d |
1333 }
1334
1335 oboeNotes = \relative c'' {
1336   R1
1337   <>^\markup \tiny { flute }
1338   \cueDuring #"flute" #UP { R1 }
1339   g2 c,
1340 }
1341
1342 \addQuote "flute" { \fluteNotes }
1343
1344 \new Staff {
1345   \oboeNotes
1346 }
1347 @end lilypond
1348
1349 @noindent
1350
1351
1352 It is possible to adjust which aspects of the music are quoted with
1353 @code{\cueDuring} by setting the @code{quotedCueEventTypes}
1354 property.  Its default value is @code{'(note-event rest-event
1355 tie-event beam-event tuplet-span-event)}, which means that only
1356 notes, rests, ties, beams and tuplets are quoted, but not
1357 articulations, dynamic marks, markup etc.
1358
1359 @warning{When a @code{Voice} starts with @code{\cueDuring}, as in the
1360 following example, the @code{Voice} context must be explicitly declared,
1361 or else the entire music expression would belong to the @code{CueVoice}
1362 context.}
1363
1364 @lilypond[verbatim,quote]
1365 oboeNotes = \relative {
1366   r2 r8 d''16(\f f e g f a)
1367   g8 g16 g g2.
1368 }
1369 \addQuote "oboe" { \oboeNotes }
1370
1371 \new Voice \relative c'' {
1372   \set Score.quotedCueEventTypes = #'(note-event rest-event tie-event
1373                                       beam-event tuplet-span-event
1374                                       dynamic-event slur-event)
1375   \cueDuring #"oboe" #UP { R1 }
1376   g2 c,
1377 }
1378 @end lilypond
1379
1380 Markup can be used to show the name of the quoted instrument.
1381 If the cue notes require a change in clef,
1382 this can be done manually but the original clef should also be
1383 restored manually at the end of the cue notes.
1384
1385 @lilypond[verbatim,quote]
1386 fluteNotes = \relative {
1387   r2. c''4 d8 c d e fis2 g2 d2
1388 }
1389
1390 bassoonNotes = \relative c {
1391   \clef bass
1392   R1
1393   \clef treble
1394   <>^\markup \tiny { flute }
1395   \cueDuring #"flute" #UP { R1 }
1396   \clef bass
1397   g4. b8 d2
1398 }
1399
1400 \addQuote "flute" { \fluteNotes }
1401
1402 \new Staff {
1403   \bassoonNotes
1404 }
1405 @end lilypond
1406
1407 Alternatively, the @code{\cueDuringWithClef} function can be used
1408 instead.  This command takes an extra argument to specify the change of
1409 clef that needs to be printed for the cue notes but will automatically
1410 print the original clef once the cue notes have finished.
1411
1412 @lilypond[verbatim,quote]
1413 fluteNotes = \relative {
1414   r2. c''4 d8 c d e fis2 g2 d2
1415 }
1416
1417 bassoonNotes = \relative c {
1418   \clef bass
1419   R1
1420   <>^\markup { \tiny "flute" }
1421   \cueDuringWithClef #"flute" #UP #"treble" { R1 }
1422   g4. b8 d2
1423 }
1424
1425 \addQuote "flute" { \fluteNotes }
1426
1427 \new Staff {
1428   \bassoonNotes
1429 }
1430 @end lilypond
1431
1432 @funindex \transposedCueDuring
1433 @funindex transposedCueDuring
1434
1435 Like @code{\quoteDuring}, @code{\cueDuring} takes instrument
1436 transpositions into account.  Cue notes are produced at the
1437 pitches that would be written for the instrument receiving the cue
1438 to produce the sounding pitches of the source instrument.
1439
1440 To transpose cue notes differently, use
1441 @code{\transposedCueDuring}.  This command takes an extra argument
1442 to specify (in absolute mode) the printed pitch that you want to
1443 represent the sound of a concert middle C.  This is useful for
1444 taking cues from an instrument in a completely different register.
1445
1446 @lilypond[verbatim,quote]
1447 piccoloNotes = \relative {
1448   \clef "treble^8"
1449   R1
1450   c'''8 c c e g2
1451   c4 g g2
1452 }
1453
1454 bassClarinetNotes = \relative c' {
1455   \key d \major
1456   \transposition bes,
1457   d4 r a r
1458   \transposedCueDuring #"piccolo" #UP d { R1 }
1459   d4 r a r
1460 }
1461
1462 \addQuote "piccolo" { \piccoloNotes }
1463
1464 <<
1465   \new Staff \piccoloNotes
1466   \new Staff \bassClarinetNotes
1467 >>
1468 @end lilypond
1469
1470 @cindex removing cue notes
1471 @cindex cue notes, removing
1472
1473 @funindex \killCues
1474 @funindex killCues
1475
1476 The @code{\killCues} command removes cue notes from a music
1477 expression, so the same music expression can be used to produce
1478 the instrument part with cues and the score.  The @code{\killCues}
1479 command removes only the notes and events that were quoted by
1480 @code{\cueDuring}.  Other markup associated with cues, such as clef
1481 changes and a label identifying the source instrument, can be
1482 tagged for selective inclusion in the score; see @ref{Using tags}.
1483
1484 @lilypond[verbatim,quote]
1485 fluteNotes = \relative {
1486   r2. c''4 d8 c d e fis2 g2 d2
1487 }
1488
1489 bassoonNotes = \relative c {
1490   \clef bass
1491   R1
1492   \tag #'part {
1493     \clef treble
1494     <>^\markup \tiny { flute }
1495   }
1496   \cueDuring #"flute" #UP { R1 }
1497   \tag #'part \clef bass
1498   g4. b8 d2
1499 }
1500
1501 \addQuote "flute" { \fluteNotes }
1502
1503 \new Staff {
1504   \bassoonNotes
1505 }
1506
1507 \new StaffGroup <<
1508   \new Staff {
1509     \fluteNotes
1510   }
1511   \new Staff {
1512     \removeWithTag #'part { \killCues { \bassoonNotes } }
1513   }
1514 >>
1515 @end lilypond
1516
1517 Alternatively, Clef changes and instrument labels can be
1518 collected into an instrument definition for repeated use, using
1519 @code{\addInstrumentDefinition} described in @ref{Instrument names}.
1520
1521 @seealso
1522 Notation Reference:
1523 @ref{Quoting other voices},
1524 @ref{Instrument transpositions},
1525 @ref{Instrument names},
1526 @ref{Clef},
1527 @ref{Musical cues},
1528 @ref{Using tags}.
1529
1530 Snippets:
1531 @rlsr{Staff notation}.
1532
1533 Internals Reference:
1534 @rinternals{CueVoice},
1535 @rinternals{Voice}.
1536
1537 @knownissues
1538 Collisions can occur with rests, when using @code{\cueDuring},
1539 between @code{Voice} and @code{CueVoice} contexts.  When using
1540 @code{\cueDuringWithClef} or @code{\transposedCueDuring} the extra
1541 argument required for each case must come after the quote and the
1542 direction.
1543