]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/notation/staff.itely
Merge remote-tracking branch 'origin/master' into translation
[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.2"
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,relative=2]
77 \new Staff { c4 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,relative=2]
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,relative=2]
104 \new TabStaff { c4 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,relative=2]
115 \new GregorianTranscriptionStaff { c4 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,relative=2]
178 <<
179   \new Staff { c1 c }
180   \new Staff { c1 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,relative=2]
188 \new StaffGroup <<
189   \new Staff { c1 c }
190   \new Staff { c1 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,relative=2]
198 \new ChoirStaff <<
199   \new Staff { c1 c }
200   \new Staff { c1 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,relative=2]
208 \new GrandStaff <<
209   \new Staff { c1 c }
210   \new Staff { c1 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,relative=2]
219 \new PianoStaff <<
220   \set PianoStaff.instrumentName = #"Piano"
221   \new Staff { c1 c }
222   \new Staff { 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,relative=2]
294 \new StaffGroup <<
295   \new Staff { c2 c | c2 c }
296   \new StaffGroup <<
297     \new Staff { g2 g | g2 g }
298     \new StaffGroup \with {
299       systemStartDelimiter = #'SystemStartSquare
300     }
301     <<
302       \new Staff { e2 e | e2 e }
303       \new Staff { c2 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 c'' {
354           c4 c c c
355           \break
356           c4 c c c
357         }
358       }
359       \new Staff {
360         \relative c'' {
361           c4 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,relative=2]
421 \stopStaff f4 d \startStaff g, e
422 f'4 d \stopStaff g, e
423 f'4 d \startStaff g, e
424 @end lilypond
425
426 @predefined
427 @code{\startStaff},
428 @code{\stopStaff}.
429 @endpredefined
430
431 The lines of a staff belong to the @code{StaffSymbol} grob (including
432 ledger lines) and can be modified using @code{StaffSymbol} properties, but
433 these modifications must be made before the staff is (re)started.
434
435 The number of staff lines can be altered:
436
437 @lilypond[verbatim,quote,relative=2]
438 f4 d \stopStaff
439 \override Staff.StaffSymbol.line-count = #2
440 \startStaff g, e |
441
442 f'4 d \stopStaff
443 \revert Staff.StaffSymbol.line-count
444 \startStaff g, e |
445 @end lilypond
446
447 The position of each staff line can also be altered.  A list of
448 numbers sets each line's position.  @code{0}@tie{}corresponds to the normal
449 center line, and the normal line positions are
450 @code{(-4@tie{}-2@tie{}0@tie{}2@tie{}4)}.  A single staff line is
451 printed for every value entered so that the number of staff lines, as
452 well as their position, can be changed with a single override.
453
454 @lilypond[verbatim,quote,relative=2]
455 f4 d \stopStaff
456 \override Staff.StaffSymbol.line-positions = #'(1 3 5 -1 -3)
457 \startStaff g, e |
458 f'4 d \stopStaff
459 \override Staff.StaffSymbol.line-positions = #'(8 6.5 -6 -8 -0.5)
460 \startStaff g, e
461 @end lilypond
462
463 To preserve typical stem directions (in the bottom half of the staff
464 stems point up, in the top half they point down), align the center
465 line (or space) of the customized staff with the position of the
466 normal center line (0).  The clef position and the position of
467 middle@tie{}C may need to be adjusted accordingly to fit the new
468 lines.  See @ref{Clef}.
469
470 Staff line thickness can be altered.  Ledger lines and note stems, by
471 default, are also affected.
472
473 @lilypond[verbatim,quote,relative=2]
474 \new Staff \with {
475   \override StaffSymbol.thickness = #3
476 }
477 { f4 d g, e }
478 @end lilypond
479
480 It is also possible to set ledger line thickness independently of staff
481 lines.
482
483 @lilypond[verbatim,quote,relative=2]
484 \new Staff \with {
485   \override StaffSymbol.thickness = #2
486   \override StaffSymbol.ledger-line-thickness = #'(0.5 . 0.4)
487 }
488 { f'4 a, a,, f }
489 @end lilypond
490
491 @noindent
492 The first value is multiplied by the staff line thickness, the second by
493 the staff space and then the two values are added together to give the
494 new thickness of the ledger line.
495
496 The vertical positions of ledger lines can be altered,
497
498 @lilypond[verbatim,quote,relative=2]
499 \new Staff \with {
500   \override StaffSymbol.ledger-positions = #'(-3 -2 -1 2 5 6)
501 }
502 { f'4 a, a,, f }
503 @end lilypond
504
505 Additional ledger lines can be made to appear above or below note heads
506 depending on the current position relative to other note heads that
507 also have their own ledger lines.
508
509 @lilypond[verbatim,quote,relative=2]
510 \new Staff \with {
511   \override StaffSymbol.ledger-extra = #4
512 }
513 { f'4 a, d, f, }
514 @end lilypond
515
516 Ledger lines can also be made to appear inside the staff where custom
517 staff lines are required.  The example shows the default position of
518 ledger lines when the explicit @code{ledger-position} is and is not set.
519 The @code{\stopStaff} is needed in the example to revert the
520 @code{\override} for the whole @code{StaffSymbol}.
521
522 @lilypond[verbatim,quote,relative=1]
523 \override Staff.StaffSymbol.line-positions = #'(-8 0 2 4)
524 d4 e f g
525 \stopStaff
526 \startStaff
527 \override Staff.StaffSymbol.ledger-positions = #'(-8 -6 (-4 -2) 0)
528 d4 e f g
529 @end lilypond
530
531 The distance between staff lines can be altered.  This affects ledger
532 line spacing as well.
533
534 @lilypond[verbatim,quote,relative=2]
535 \new Staff \with {
536   \override StaffSymbol.staff-space = #1.5
537 }
538 { f'4 d, g, e, }
539 @end lilypond
540
541 @snippets
542 @lilypondfile[verbatim,quote,texidoc,doctitle]
543 {making-some-staff-lines-thicker-than-the-others.ly}
544
545 @seealso
546 Music Glossary:
547 @rglos{line},
548 @rglos{ledger line},
549 @rglos{staff}.
550
551 Notation Reference:
552 @ref{Clef}.
553
554 Snippets:
555 @rlsr{Staff notation}.
556
557 Internals Reference:
558 @rinternals{StaffSymbol},
559 @rinternals{staff-symbol-interface}.
560
561
562 @node Ossia staves
563 @unnumberedsubsubsec Ossia staves
564
565 @cindex staff, Frenched
566 @cindex ossia
567 @cindex Frenched staves
568 @cindex staff, resizing of
569 @cindex resizing of staves
570
571 @funindex \startStaff
572 @funindex startStaff
573 @funindex \stopStaff
574 @funindex stopStaff
575
576 @notation{Ossia} staves can be set by creating a new simultaneous
577 staff in the appropriate location:
578
579 @lilypond[verbatim,quote]
580 \new Staff \relative c'' {
581   c4 b d c
582   <<
583     { c4 b d c }
584     \new Staff { e4 d f e }
585   >>
586   c4 b c2
587 }
588 @end lilypond
589
590 @noindent
591 However, the above example is not what is usually desired.  To
592 create ossia staves that are above the original staff, have no
593 time signature or clef, and have a smaller font size, tweaks must
594 be used.  The Learning Manual describes a specific technique to
595 achieve this goal, beginning with
596 @rlearning{Nesting music expressions}.
597
598 The following example uses the @code{alignAboveContext} property
599 to align the ossia staff.  This method is most appropriate when
600 only a few ossia staves are needed.
601
602 @lilypond[verbatim,quote]
603 \new Staff = "main" \relative c'' {
604   c4 b d c
605   <<
606     { c4 b d c }
607
608     \new Staff \with {
609       \remove "Time_signature_engraver"
610       alignAboveContext = #"main"
611       \magnifyStaff #2/3
612       firstClef = ##f
613     }
614     { e4 d f e }
615   >>
616   c4 b c2
617 }
618 @end lilypond
619
620 If many isolated ossia staves are needed, creating an empty
621 @code{Staff} context with a specific @emph{context id} may be more
622 appropriate; the ossia staves may then be created by
623 @emph{calling} this context and using @code{\startStaff} and
624 @code{\stopStaff} at the desired locations.  The benefits of this
625 method are more apparent if the piece is longer than the following
626 example.
627
628 @lilypond[verbatim,quote,ragged-right]
629 <<
630   \new Staff = "ossia" \with {
631     \remove "Time_signature_engraver"
632     \hide Clef
633     \magnifyStaff #2/3
634   }
635   { \stopStaff s1*6 }
636
637   \new Staff \relative c' {
638     c4 b c2
639     <<
640       { e4 f e2 }
641       \context Staff = "ossia" {
642         \startStaff e4 g8 f e2 \stopStaff
643       }
644     >>
645     g4 a g2 \break
646     c4 b c2
647     <<
648       { g4 a g2 }
649       \context Staff = "ossia" {
650         \startStaff g4 e8 f g2 \stopStaff
651       }
652     >>
653     e4 d c2
654   }
655 >>
656 @end lilypond
657
658
659 Using the @code{\Staff \RemoveEmptyStaves} command to create ossia
660 staves may be used as an alternative.  This method is most
661 convenient when ossia staves occur immediately following a line
662 break.  For more information about
663 @code{\Staff \RemoveEmptyStaves}, see @ref{Hiding staves}.
664
665 @lilypond[verbatim,quote,ragged-right]
666 <<
667   \new Staff = "ossia" \with {
668     \remove "Time_signature_engraver"
669     \hide Clef
670     \magnifyStaff #2/3
671   } \relative c'' {
672     R1*3
673     c4 e8 d c2
674   }
675   \new Staff \relative c' {
676     c4 b c2
677     e4 f e2
678     g4 a g2 \break
679     c4 b c2
680     g4 a g2
681     e4 d c2
682   }
683 >>
684
685 \layout {
686   \context {
687     \Staff \RemoveEmptyStaves
688     \override VerticalAxisGroup.remove-first = ##t
689   }
690 }
691 @end lilypond
692
693
694 @snippets
695
696 @lilypondfile[verbatim,quote,texidoc,doctitle]
697 {vertically-aligning-ossias-and-lyrics.ly}
698
699 @seealso
700 Music Glossary:
701 @rglos{ossia},
702 @rglos{staff},
703 @rglos{Frenched staff}.
704
705 Learning Manual:
706 @rlearning{Nesting music expressions},
707 @rlearning{Size of objects},
708 @rlearning{Length and thickness of objects}.
709
710 Notation Reference:
711 @ref{Hiding staves}.
712
713 Snippets:
714 @rlsr{Staff notation}.
715
716 Internals Reference:
717 @rinternals{StaffSymbol}.
718
719
720 @node Hiding staves
721 @unnumberedsubsubsec Hiding staves
722
723 @cindex Frenched score
724 @cindex Frenched staff
725 @cindex staff, hiding
726 @cindex staff, empty
727 @cindex hiding of staves
728 @cindex empty staves
729
730 @funindex \RemoveEmptyStaves
731 @funindex Staff_symbol_engraver
732 @funindex \stopStaff
733 @funindex stopStaff
734
735
736 Staff lines can be hidden by removing the
737 @code{Staff_symbol_engraver} from the @code{Staff} context.  As an
738 alternative, @code{\stopStaff} may be used.
739
740 @lilypond[verbatim,quote]
741 \new Staff \with {
742   \remove "Staff_symbol_engraver"
743 }
744 \relative c''' { a8 f e16 d c b a2 }
745 @end lilypond
746
747
748 Empty staves can be hidden by setting the
749 @code{\Staff \RemoveEmptyStaves} command in the @code{\layout}
750 block.  In orchestral scores, this style is known as @q{Frenched
751 Score}.  By default, this command hides and removes all empty
752 staves in a score except for those in the first system.
753
754 @warning{A staff is considered empty when it contains only
755 multi-measure rests, rests, skips, spacer rests, or a combination of these
756 elements.}
757
758 @lilypond[verbatim,quote,ragged-right]
759 \layout {
760   \context {
761     \Staff \RemoveEmptyStaves
762   }
763 }
764
765 \relative c' <<
766   \new Staff {
767     e4 f g a \break
768     b1 \break
769     a4 b c2
770   }
771   \new Staff {
772     c,4 d e f \break
773     R1 \break
774     f4 g c,2
775   }
776 >>
777 @end lilypond
778
779 @cindex ossia
780
781 @noindent
782 @code{\Staff \RemoveEmptyStaves} can also be used to create ossia
783 sections for a staff.  For details, see @ref{Ossia staves}.
784
785 @cindex hiding ancient staves
786 @cindex hiding rhythmic staves
787
788 @funindex \RemoveEmptyStaves
789
790 The @code{\VaticanaStaff \RemoveEmptyStaves} command may be used to
791 hide empty staves in ancient music contexts.  Similarly,
792 @code{\RhythmicStaff \RemoveEmptyStaves} may be used to hide empty
793 @code{RhythmicStaff} contexts.
794
795
796 @predefined
797 @code{\Staff \RemoveEmptyStaves},
798 @code{\VaticanaStaff \RemoveEmptyStaves},
799 @code{\RhythmicStaff \RemoveEmptyStaves}.
800 @endpredefined
801
802
803 @snippets
804
805 @lilypondfile[verbatim,quote,texidoc,doctitle]
806 {removing-the-first-empty-line.ly}
807
808 @seealso
809 Music Glossary:
810 @rglos{Frenched staff}.
811
812 Learning Manual:
813 @rlearning{Visibility and color of objects}.
814
815 Notation Reference:
816 @ref{Changing context default settings},
817 @ref{Staff symbol},
818 @ref{Ossia staves},
819 @ref{Hidden notes},
820 @ref{Invisible rests},
821 @ref{Visibility of objects}.
822
823 Snippets:
824 @rlsr{Staff notation}.
825
826 Internals Reference:
827 @rinternals{ChordNames},
828 @rinternals{FiguredBass},
829 @rinternals{Lyrics},
830 @rinternals{Staff},
831 @rinternals{VerticalAxisGroup},
832 @rinternals{Staff_symbol_engraver}.
833
834 @knownissues
835 Removing @code{Staff_symbol_engraver} also hides bar lines.  If
836 bar line visibility is forced, formatting errors may occur.  In
837 this case, use the following overrides instead of removing the
838 engraver:
839
840 @example
841 \omit StaffSymbol
842 \override NoteHead.no-ledgers = ##t
843 @end example
844
845 For the Known issues and warnings associated with
846 @code{\Staff \RemoveEmptyStaves} see
847 @ref{Changing context default settings}.
848
849
850 @node Writing parts
851 @subsection Writing parts
852
853 This section explains how to insert tempo indications and
854 instrument names into a score.  Methods to quote other voices and
855 format cue notes are also described.
856
857 @menu
858 * Instrument names::
859 * Quoting other voices::
860 * Formatting cue notes::
861 @end menu
862
863 @node Instrument names
864 @unnumberedsubsubsec Instrument names
865
866 @cindex instrument names
867 @cindex instrument names, short
868
869 Instrument names can be printed on the left side of staves in the
870 @code{Staff}, @code{PianoStaff}, @code{StaffGroup}, @code{GrandStaff}
871 and @code{ChoirStaff} contexts.  The value of
872 @code{instrumentName} is used for the first staff, and the value
873 of @code{shortInstrumentName} is used for all succeeding staves.
874
875 @lilypond[verbatim,quote,ragged-right,relative=1]
876 \new Staff \with {
877   instrumentName = #"Violin "
878   shortInstrumentName = #"Vln. "
879 }
880 { c4.. g'16 c4.. g'16 \break | c1 }
881 @end lilypond
882
883 @cindex instrument names, complex
884
885 @code{\markup} can be used to create more complex instrument names:
886
887 @lilypond[verbatim,quote,relative=2]
888 \new Staff \with {
889   instrumentName = \markup {
890     \column { "Clarinetti"
891       \line { "in B" \smaller \flat }
892     }
893   }
894 }
895 { c4 c,16 d e f g2 }
896 @end lilypond
897
898 @cindex instrument names, centering
899
900 When two or more staff contexts are grouped together, the instrument
901 names and short instrument names are centered by default.  To center
902 multi-line instrument names, @code{\center-column} must be used:
903
904 @lilypond[verbatim,quote,indent=1.5\cm,relative=2]
905 <<
906   \new Staff \with {
907     instrumentName = #"Flute"
908   }
909   { f2 g4 f }
910   \new Staff \with {
911     instrumentName = \markup {
912       \center-column { "Clarinet"
913         \line { "in B" \smaller \flat }
914       }
915     }
916   }
917   { c4 b c2 }
918 >>
919 @end lilypond
920
921 @funindex indent
922 @funindex short-indent
923
924 However, if the instrument names are longer, the instrument names in a
925 staff group may not be centered unless the @code{indent} and
926 @code{short-indent} settings are increased.  For details about these
927 settings, see @ref{paper variables for shifts and indents,,@code{@bs{}paper} variables for shifts and indents}.
928
929 @lilypond[verbatim,quote,ragged-right]
930 \relative c'' {
931   <<
932     \new Staff \with {
933       instrumentName = #"Alto Flute in G"
934       shortInstrumentName = #"Flt."
935     }
936     {
937       f2 g4 f \break
938       g4 f g2
939     }
940     \new Staff \with {
941       instrumentName = #"Clarinet"
942       shortInstrumentName = #"Clar."
943     }
944     {
945       c,4 b c2 \break
946       c2 b4 c
947     }
948   >>
949 }
950
951 \layout {
952   indent = 3.0\cm
953   short-indent = 1.5\cm
954 }
955 @end lilypond
956
957 @cindex instrument names, adding to other contexts
958
959 To add instrument names to other contexts (such as @code{ChordNames} or
960 @code{FiguredBass}), @code{Instrument_name_engraver} must be added to
961 that context.  For details, see @ref{Modifying context plug-ins}.
962
963 @cindex instrument names, changing
964 @cindex changing instrument names
965
966 The @code{shortInstrumentName} may be changed in the middle of a piece.
967 However, only the first instance of @code{instrumentName} will be
968 printed and subsequent changes will be ignored:
969
970 @lilypond[verbatim,quote,ragged-right,relative=1]
971 \new Staff \with {
972   instrumentName = #"Flute"
973   shortInstrumentName = #"Flt."
974 }
975 {
976   c1 c c c \break
977   c1 c c c \break
978   \set Staff.instrumentName = #"Clarinet"
979   \set Staff.shortInstrumentName = #"Clt."
980   c1 c c c \break
981   c1 c c c \break
982 }
983 @end lilypond
984
985 @cindex instrument switch
986 @cindex switching instruments
987
988 @funindex \addInstrumentDefinition
989 @funindex addInstrumentDefinition
990 @funindex \instrumentSwitch
991 @funindex instrumentSwitch
992
993 If an instrument @emph{switch} is needed,
994 @code{\addInstrumentDefinition} may be used in combination with
995 @code{\instrumentSwitch} to create a detailed list of the
996 necessary changes for the switch.  The
997 @code{\addInstrumentDefinition} command has two arguments: an
998 identifying string, and an association list of context properties
999 and values to be used for the instrument.  It must be placed in
1000 the toplevel scope.  @code{\instrumentSwitch} is used in the music
1001 expression to declare the instrument switch:
1002
1003 @lilypond[verbatim,quote,ragged-right]
1004 \addInstrumentDefinition #"contrabassoon"
1005   #`((instrumentTransposition . ,(ly:make-pitch -1 0 0))
1006      (shortInstrumentName . "Cbsn.")
1007      (clefGlyph . "clefs.F")
1008      (middleCPosition . 6)
1009      (clefPosition . 2)
1010      (instrumentCueName . ,(make-bold-markup "cbsn."))
1011      (midiInstrument . "bassoon"))
1012
1013 \new Staff \with {
1014   instrumentName = #"Bassoon"
1015 }
1016 \relative c' {
1017   \clef tenor
1018   \compressFullBarRests
1019   c2 g'
1020   R1*16
1021   \instrumentSwitch "contrabassoon"
1022   c,,2 g \break
1023   c,1 ~ | 1
1024 }
1025 @end lilypond
1026
1027 @seealso
1028 Notation Reference:
1029 @ref{paper variables for shifts and indents,,@code{@bs{}paper} variables for shifts and indents},
1030 @ref{Modifying context plug-ins}.
1031
1032 Snippets:
1033 @rlsr{Staff notation}.
1034
1035 Internals Reference:
1036 @rinternals{InstrumentName},
1037 @rinternals{PianoStaff},
1038 @rinternals{Staff}.
1039
1040
1041 @node Quoting other voices
1042 @unnumberedsubsubsec Quoting other voices
1043
1044 @cindex quote, voices
1045 @cindex voices, quoting
1046 @cindex fragments, quoting
1047 @cindex cue notes
1048
1049 @funindex \addQuote
1050 @funindex addQuote
1051 @funindex \quoteDuring
1052 @funindex quoteDuring
1053 @funindex \transposition
1054 @funindex transposition
1055
1056 It is very common for one voice to use the same notes as those from
1057 another voice.  For example, first and second violins playing the same
1058 phrase during a particular passage of the music.  This is done by
1059 letting one voice @emph{quote} the other, without having to re-enter the
1060 music all over again for the second voice.
1061
1062 The @code{\addQuote} command, used in the top level scope, defines a
1063 stream of music from which fragments can be quoted.
1064
1065 The @code{\quoteDuring} command is used to indicate the point where the
1066 quotation begins.  It is followed by two arguments: the name of the
1067 quoted voice, as defined with @code{\addQuote}, and a music expression
1068 for the duration of the quote.
1069
1070 @lilypond[verbatim,quote]
1071 fluteNotes = \relative c'' {
1072   a4 gis g gis | b4^"quoted" r8 ais\p a4( f)
1073 }
1074
1075 oboeNotes = \relative c'' {
1076   c4 cis c b \quoteDuring #"flute" { s1 }
1077 }
1078
1079 \addQuote "flute" { \fluteNotes }
1080
1081 \score {
1082   <<
1083     \new Staff \with { instrumentName = "Flute" } \fluteNotes
1084     \new Staff \with { instrumentName = "Oboe" } \oboeNotes
1085   >>
1086 }
1087 @end lilypond
1088
1089 If the music expression used in @code{\quoteDuring} contains notes
1090 instead of spacer or multimeasure rests then the quote will appear as
1091 polyphony and may produce unexpected results.
1092
1093 @lilypond[verbatim,quote]
1094 fluteNotes = \relative c'' {
1095   a4 gis g gis | b4^"quoted" r8 ais\p a4( f)
1096 }
1097
1098 oboeNotes = \relative c'' {
1099   c4 cis c b \quoteDuring #"flute" { e4 r8 ais b4 a }
1100 }
1101
1102 \addQuote "flute" { \fluteNotes }
1103
1104 \score {
1105   <<
1106     \new Staff \with { instrumentName = "Flute" } \fluteNotes
1107     \new Staff \with { instrumentName = "Oboe" } \oboeNotes
1108   >>
1109 }
1110 @end lilypond
1111
1112 The @code{\quoteDuring} command uses the @code{\transposition} settings
1113 of both quoted and quoting parts to produce notes for the quoting part
1114 that have the same sounding pitch as those in the quoted part.
1115
1116 @lilypond[verbatim,quote]
1117 clarinetNotes = \relative c'' {
1118   \transposition bes
1119   \key d \major
1120   b4 ais a ais | cis4^"quoted" r8 bis\p b4( f)
1121 }
1122
1123 oboeNotes = \relative c'' {
1124   c4 cis c b \quoteDuring #"clarinet" { s1 }
1125 }
1126
1127 \addQuote "clarinet" { \clarinetNotes }
1128
1129
1130 \score {
1131   <<
1132     \new Staff \with { instrumentName = "Clarinet" } \clarinetNotes
1133     \new Staff \with { instrumentName = "Oboe" } \oboeNotes
1134   >>
1135 }
1136 @end lilypond
1137
1138 @cindex note-event
1139 @cindex articulation-event
1140 @cindex dynamic-event
1141 @cindex rest-event
1142 @cindex slur-event
1143 @cindex crescendo-event
1144
1145 @funindex quotedEventTypes
1146 @funindex quotedCueEventTypes
1147
1148 By default quoted music will include all articulations, dynamics,
1149 markups, etc., in the quoted expression.  It is possible to choose which
1150 of these objects from the quoted music are displayed by using the
1151 @code{quotedEventTypes} context property.
1152
1153 @lilypond[verbatim,quote]
1154 fluteNotes = \relative c'' {
1155   a2 g2 |
1156   b4\<^"quoted" r8 ais a4\f( c->)
1157  }
1158
1159 oboeNotes = \relative c'' {
1160   c2. b4 |
1161   \quoteDuring #"flute" { s1 }
1162 }
1163
1164 \addQuote "flute" { \fluteNotes }
1165
1166 \score {
1167   <<
1168     \set Score.quotedEventTypes = #'(note-event articulation-event
1169                                      crescendo-event rest-event
1170                                      slur-event dynamic-event)
1171     \new Staff \with { instrumentName = "Flute" } \fluteNotes
1172     \new Staff \with { instrumentName = "Oboe" } \oboeNotes
1173   >>
1174  }
1175 @end lilypond
1176
1177 Quotes can also be tagged, see @ref{Using tags}.
1178
1179 @seealso
1180 Notation Reference:
1181 @ref{Instrument transpositions},
1182 @ref{Using tags}.
1183
1184 Installed Files:
1185 @file{scm/define-event-classes.scm}.
1186
1187 Snippets:
1188 @rlsr{Staff notation}.
1189
1190 Internals Reference:
1191 @rinternals{Music classes},
1192 @rinternals{QuoteMusic},
1193 @rinternals{Voice}.
1194
1195 @knownissues
1196 Only the contents of the first @code{Voice} occurring in an
1197 @code{\addQuote} command will be considered for quotation, so if the music
1198 expression contains @code{\new} or @code{\context Voice}
1199 statements, their contents will not be quoted.  Quoting grace notes
1200 is unsupported and may cause LilyPond to crash whereas quoting nested
1201 triplets may result in poor notation.
1202
1203
1204 @node Formatting cue notes
1205 @unnumberedsubsubsec Formatting cue notes
1206
1207 @cindex cue notes
1208 @cindex fragments
1209 @cindex cue notes, formatting
1210 @cindex formatting, cue notes
1211 @cindex voices, quoting
1212
1213
1214 @funindex \cueDuring
1215 @funindex cueDuring
1216 @funindex \cueClef
1217 @funindex cueClef
1218 @funindex \cueDuringWithClef
1219 @funindex cueDuringWithClef
1220 @funindex \quoteDuring
1221 @funindex quoteDuring
1222
1223 @cindex notes, smaller
1224 @cindex smaller notes
1225 @cindex CueVoice
1226
1227 The simplest way to format cue notes is to explicitly create a
1228 @code{CueVoice} context within the part.
1229
1230 @lilypond[verbatim,relative=1]
1231 R1
1232 <<
1233   { e2\rest r4. e8 }
1234   \new CueVoice {
1235     \stemUp d'8^"flute" c d e fis2
1236   }
1237 >>
1238 d,4 r a r
1239 @end lilypond
1240
1241 The @code{\cueClef} command can also be used with an explict
1242 @code{CueVoice} context if a change of clef is required and will print
1243 an appropriately sized clef for the cue notes.  The @code{\cueClefUnset}
1244 command can then be used to switch back to the original clef, again with
1245 an appropriately sized clef.
1246
1247 @lilypond[verbatim,noragged-right,relative=1]
1248 \clef "bass"
1249 R1
1250 <<
1251   { e2\rest r4. \cueClefUnset e,8 }
1252   \new CueVoice {
1253     \cueClef "treble" \stemUp d''8^"flute" c d e fis2
1254   }
1255 >>
1256 d,,4 r a r
1257 @end lilypond
1258
1259 The @code{\cueClef} and @code{\cueClefUnset} command can also be used
1260 without a @code{CueVoice} if required.
1261
1262 @lilypond[verbatim,noragged-right,relative=1]
1263 \clef "bass"
1264 R1
1265 \cueClef "treble"
1266 d'8^"flute" c d e fis2
1267 \cueClefUnset
1268 d,,4 r a r
1269 @end lilypond
1270
1271 For more complex cue note placement, e.g including transposition, or
1272 inserting cue notes from multiple music sources the @code{\cueDuring} or
1273 @code{\cueDuringWithClef} commands can be used.  These are more
1274 specialized form of @code{\quoteDuring}, see @ref{Quoting other voices}
1275 in the previous section.
1276
1277 The syntax is:
1278
1279 @example
1280 \cueDuring #@var{quotename} #@var{direction} #@var{music}
1281 @end example
1282
1283 and
1284
1285 @example
1286 \cueDuringWithClef #@var{quotename} #@var{direction} #@var{clef} #@var{music}
1287 @end example
1288
1289 The music from the corresponding measures of the @code{@var{quote name}}
1290 is added as a @code{CueVoice} context and occurs simultaneously with the
1291 @code{@var{music}}, which then creates a polyphonic situation.  The
1292 @code{@var{direction}} takes the argument @code{UP} or @code{DOWN}, and
1293 corresponds to the first and second voices respectively, determining how
1294 the cue notes are printed in relation to the other voice.
1295
1296 @lilypond[verbatim,quote]
1297 fluteNotes = \relative c'' {
1298   r2. c4 | d8 c d e fis2 | g2 d |
1299 }
1300
1301 oboeNotes = \relative c'' {
1302   R1
1303   \new CueVoice { \set instrumentCueName = "flute" }
1304   \cueDuring #"flute" #UP { R1 }
1305   g2 c,
1306 }
1307
1308 \addQuote "flute" { \fluteNotes }
1309
1310 \new Staff {
1311   \oboeNotes
1312 }
1313 @end lilypond
1314
1315 @noindent
1316
1317
1318 It is possible to adjust which aspects of the music are quoted with
1319 @code{\cueDuring} by setting the @code{quotedCueEventTypes}
1320 property.  Its default value is @code{'(note-event rest-event
1321 tie-event beam-event tuplet-span-event)}, which means that only
1322 notes, rests, ties, beams and tuplets are quoted, but not
1323 articulations, dynamic marks, markup etc.
1324
1325 @warning{When a @code{Voice} starts with @code{\cueDuring}, as in the
1326 following example, the @code{Voice} context must be explicitly declared,
1327 or else the entire music expression would belong to the @code{CueVoice}
1328 context.}
1329
1330 @lilypond[verbatim,quote]
1331 oboeNotes = \relative c'' {
1332   r2 r8 d16(\f f e g f a)
1333   g8 g16 g g2.
1334 }
1335 \addQuote "oboe" { \oboeNotes }
1336
1337 \new Voice \relative c'' {
1338   \set Score.quotedCueEventTypes = #'(note-event rest-event tie-event
1339                                       beam-event tuplet-span-event
1340                                       dynamic-event slur-event)
1341   \cueDuring #"oboe" #UP { R1 }
1342   g2 c,
1343 }
1344 @end lilypond
1345
1346 The name of the instrument playing the cue can be printed by setting
1347 the @code{instrumentCueName} property in a temporary @code{CueVoice}
1348 context.  The placement and style of the @code{instrumentCueName} is
1349 controlled by the @code{InstrumentSwitch} object, see
1350 @ref{Instrument names}.  If the cue notes require a change in clef,
1351 this can be done manually but the original clef should also be
1352 restored manually at the end of the cue notes.
1353
1354 @lilypond[verbatim,quote]
1355 fluteNotes = \relative c'' {
1356   r2. c4 d8 c d e fis2 g2 d2
1357 }
1358
1359 bassoonNotes = \relative c {
1360   \clef bass
1361   R1
1362   \clef treble
1363   \new CueVoice { \set instrumentCueName = "flute" }
1364   \cueDuring #"flute" #UP { R1 }
1365   \clef bass
1366   g4. b8 d2
1367 }
1368
1369 \addQuote "flute" { \fluteNotes }
1370
1371 \new Staff {
1372   \bassoonNotes
1373 }
1374 @end lilypond
1375
1376 Alternatively, the @code{\cueDuringWithClef} function can be used
1377 instead.  This command takes an extra argument to specify the change of
1378 clef that needs to be printed for the cue notes but will automatically
1379 print the original clef once the cue notes have finished.
1380
1381 @lilypond[verbatim,quote]
1382 fluteNotes = \relative c'' {
1383   r2. c4 d8 c d e fis2 g2 d2
1384 }
1385
1386 bassoonNotes = \relative c {
1387   \clef bass
1388   R1
1389   \new CueVoice { \set instrumentCueName = "flute" }
1390   \cueDuringWithClef #"flute" #UP #"treble" { R1 }
1391   g4. b8 d2
1392 }
1393
1394 \addQuote "flute" { \fluteNotes }
1395
1396 \new Staff {
1397   \bassoonNotes
1398 }
1399 @end lilypond
1400
1401 @funindex \transposedCueDuring
1402 @funindex transposedCueDuring
1403
1404 Like @code{\quoteDuring}, @code{\cueDuring} takes instrument
1405 transpositions into account.  Cue notes are produced at the
1406 pitches that would be written for the instrument receiving the cue
1407 to produce the sounding pitches of the source instrument.
1408
1409 To transpose cue notes differently, use
1410 @code{\transposedCueDuring}.  This command takes an extra argument
1411 to specify (in absolute mode) the printed pitch that you want to
1412 represent the sound of a concert middle C.  This is useful for
1413 taking cues from an instrument in a completely different register.
1414
1415 @lilypond[verbatim,quote]
1416 piccoloNotes = \relative c''' {
1417   \clef "treble^8"
1418   R1
1419   c8 c c e g2
1420   c4 g g2
1421 }
1422
1423 bassClarinetNotes = \relative c' {
1424   \key d \major
1425   \transposition bes,
1426   d4 r a r
1427   \transposedCueDuring #"piccolo" #UP d { R1 }
1428   d4 r a r
1429 }
1430
1431 \addQuote "piccolo" { \piccoloNotes }
1432
1433 <<
1434   \new Staff \piccoloNotes
1435   \new Staff \bassClarinetNotes
1436 >>
1437 @end lilypond
1438
1439 @cindex removing cue notes
1440 @cindex cue notes, removing
1441
1442 @funindex \killCues
1443 @funindex killCues
1444 @funindex \addInstrumentDefinition
1445 @funindex addInstrumentDefinition
1446
1447 The @code{\killCues} command removes cue notes from a music
1448 expression, so the same music expression can be used to produce
1449 the instrument part with cues and the score.  The @code{\killCues}
1450 command removes only the notes and events that were quoted by
1451 @code{\cueDuring}.  Other markup associated with cues, such as clef
1452 changes and a label identifying the source instrument, can be
1453 tagged for selective inclusion in the score; see @ref{Using tags}.
1454
1455 @lilypond[verbatim,quote]
1456 fluteNotes = \relative c'' {
1457   r2. c4 d8 c d e fis2 g2 d2
1458 }
1459
1460 bassoonNotes = \relative c {
1461   \clef bass
1462   R1
1463   \tag #'part {
1464     \clef treble
1465     \new CueVoice { \set instrumentCueName = "flute" }
1466   }
1467   \cueDuring #"flute" #UP { R1 }
1468   \tag #'part \clef bass
1469   g4. b8 d2
1470 }
1471
1472 \addQuote "flute" { \fluteNotes }
1473
1474 \new Staff {
1475   \bassoonNotes
1476 }
1477
1478 \new StaffGroup <<
1479   \new Staff {
1480     \fluteNotes
1481   }
1482   \new Staff {
1483     \removeWithTag #'part { \killCues { \bassoonNotes } }
1484   }
1485 >>
1486 @end lilypond
1487
1488 Alternatively, Clef changes and instrument labels can be
1489 collected into an instrument definition for repeated use, using
1490 @code{\addInstrumentDefinition} described in @ref{Instrument names}.
1491
1492 @seealso
1493 Notation Reference:
1494 @ref{Quoting other voices},
1495 @ref{Instrument transpositions},
1496 @ref{Instrument names},
1497 @ref{Clef},
1498 @ref{Musical cues},
1499 @ref{Using tags}.
1500
1501 Snippets:
1502 @rlsr{Staff notation}.
1503
1504 Internals Reference:
1505 @rinternals{CueVoice},
1506 @rinternals{Voice}.
1507
1508 @knownissues
1509 Collisions can occur with rests, when using @code{\cueDuring},
1510 between @code{Voice} and @code{CueVoice} contexts.  When using
1511 @code{\cueDuringWithClef} or @code{\transposedCueDuring} the extra
1512 argument required for each case must come after the quote and the
1513 direction.
1514