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