]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/advanced-notation.itely
Fix merging problem
[lilypond.git] / Documentation / user / advanced-notation.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @c This file is part of lilypond.tely
3 @ignore
4     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
5
6     When revising a translation, copy the HEAD committish of the
7     version that you are working on.  See TRANSLATION for details.
8 @end ignore
9
10 @c A menu is needed before every deeper *section nesting of @node's; run
11 @c     M-x texinfo-all-menus-update
12 @c to automatically fill in these menus before saving changes
13
14
15 @node Advanced notation
16 @chapter Advanced notation
17
18 This chapter deals with rarely-used and advanced notation.
19
20 @menu
21 * Text::                        
22 * Preparing parts::             
23 * Orchestral music::            
24 * Contemporary notation::       
25 * Educational use::             
26 @end menu
27
28
29
30 @node Text
31 @section Text
32
33 This section explains how to include text (with various formatting) in
34 your scores.
35
36 @cindex Text, other languages
37 To write non-ascii text (such as characters from other languages), simply
38 insert the characters directly into the lilypond file.  The file must be
39 saved as UTF-8.  For more information, see @ref{Text encoding}.
40
41 @menu
42 * Text scripts::                
43 * Text spanners::               
44 * Text marks::                  
45 * Text markup::                 
46 * Nested scores::               
47 * Overview of text markup commands::  
48 * Font selection::              
49 * New dynamic marks::           
50 @end menu
51
52
53 @node Text scripts
54 @subsection Text scripts
55
56 @cindex Text scripts
57 @cindex text items, non-empty
58 @cindex non-empty texts
59
60 It is possible to place arbitrary strings of text or @ref{Text markup}
61 above or below notes by using a string @code{c^"text"}.  By default,
62 these indications do not influence the note spacing, but by using the
63 command @code{\fatText}, the widths will be taken into account
64
65 @lilypond[quote,fragment,ragged-right,verbatim,relative=1]
66 c4^"longtext" \fatText c4_"longlongtext" c4
67 @end lilypond
68
69 @noindent
70 To prevent text from influencing spacing, use @code{\emptyText}.
71
72 More complex formatting may also be added to a note by using the
73 markup command,
74 @lilypond[fragment,ragged-right,verbatim,quote]
75 c'4^\markup { bla \bold bla }
76 @end lilypond
77
78 The @code{\markup} is described in more detail in
79 @ref{Text markup}.
80
81
82 @refcommands
83
84 @funindex \fatText
85 @code{\fatText},
86 @funindex \emptyText
87 @code{\emptyText}.
88
89
90 @commonprop
91
92 Checking to make sure that text scripts and lyrics are within the margins is
93 a relatively large computational task.  To speed up processing, lilypond does
94 not perform such calculations by default; to enable it, use
95
96 @example
97 \override Score.PaperColumn #'keep-inside-line = ##t
98 @end example
99
100
101 @seealso
102
103 In this manual: @ref{Text markup}.
104
105 Program reference: @internalsref{TextScript}.
106
107
108 @node Text spanners
109 @subsection Text spanners
110
111 @cindex Text spanners
112
113 Some performance indications, e.g., @i{rallentando} or @i{accelerando},
114 are written as text and are extended over many measures with dotted
115 lines.  Such texts are created using text spanners; attach
116 @code{\startTextSpan} and @code{\stopTextSpan} to the first and last
117 notes of the spanner.
118
119 The string to be printed, as well as the style, is set through object
120 properties
121
122 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
123 c1
124 \textSpannerDown
125 \override TextSpanner #'edge-text = #'("rall " . "")
126 c2\startTextSpan b c\stopTextSpan a
127 \break
128 \textSpannerUp
129 \override TextSpanner #'edge-text = #(cons (markup #:italic "rit" ) "")
130 c2\startTextSpan b c\stopTextSpan a
131 @end lilypond
132
133 @refcommands
134
135 @cindex textSpannerUp
136 @code{textSpannerUp},
137 @cindex textSpannerDown
138 @code{textSpannerDown},
139 @cindex textSpannerNeutral
140 @code{textSpannerNeutral}.
141
142
143 @commonprop
144
145 To print a solid line, use
146
147 @example
148 \override TextSpanner #'dash-fraction = #'()
149 @end example
150
151
152 @seealso
153
154 Program reference: @internalsref{TextSpanner}.
155
156 Examples: @inputfileref{input/@/regression,text@/-spanner@/.ly}.
157
158
159 @node Text marks
160 @subsection Text marks
161
162 @cindex coda on bar line
163 @cindex segno on bar line
164 @cindex fermata on bar line
165 @cindex bar lines, symbols on
166 @funindex \mark
167
168 The @code{\mark} command is primarily used for
169 @ref{Rehearsal marks},
170 but it can also be used to put signs like coda,
171 segno, and fermata on a bar line.  Use @code{\markup} to
172 access the appropriate symbol (symbols are listed in
173 @ref{The Feta font})
174
175 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
176 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
177 c1
178 @end lilypond
179
180 @noindent
181 @code{\mark} is only typeset above the top stave of the score.  If
182 you specify the @code{\mark} command at a bar line, the resulting
183 mark is placed above the bar line.  If you specify it in the middle
184 of a bar, the resulting mark is positioned between notes.  If it is
185 specified before the beginning of a score line, it is placed
186 before the first note of the line.  Finally, if the mark occurs at
187 a line break, the mark will be printed at the
188 beginning of the next line.
189 @c  IMO this is a bug; hopefully it'll be fixed soon, so I can
190 @c  delete this sentence.   -gp
191 If there is no next line, then the mark will not be printed at all.
192
193
194 @commonprop
195
196 To print the mark at the end of the current line, use
197
198 @example
199 \override Score.RehearsalMark
200   #'break-visibility = #begin-of-line-invisible
201 @end example
202
203 @code{\mark} is often useful for adding text to the end of bar.  In
204 such cases, changing the @code{#'self-alignment} is very useful
205
206 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
207 \override Score.RehearsalMark
208   #'break-visibility = #begin-of-line-invisible
209 c1 c c c4 c c c
210 \once \override Score.RehearsalMark #'self-alignment-X = #right
211 \mark "D.S. al Fine "
212 @end lilypond
213
214 Text marks may be aligned with notation objects other than
215 bar lines,
216
217 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
218 \relative {
219   c1
220   \key cis \major
221   \clef alto
222   \override Score.RehearsalMark #'break-align-symbol = #'key-signature
223   \mark "on key"
224   cis
225   \key ces \major
226   \override Score.RehearsalMark #'break-align-symbol = #'clef
227   \clef treble
228   \mark "on clef"
229   ces
230   \override Score.RehearsalMark #'break-align-symbol = #'time-signature
231   \key d \minor
232   \clef tenor
233   \time 3/4
234   \mark "on time"
235   c
236 }
237 @end lilypond
238
239 Although text marks are normally only printed above the topmost
240 staff, you may alter this to print them on every staff,
241
242 @lilypond[quote,ragged-right,verbatim,relative=2]
243 {
244   \new Score \with {
245     \remove "Mark_engraver"
246   }
247   <<
248     \new Staff \with {
249       \consists "Mark_engraver"
250     }
251     { c''1 \mark "foo" c'' }
252     \new Staff \with {
253       \consists "Mark_engraver"
254     }
255     { c'1 \mark "foo" c' }
256   >>
257 }
258 @end lilypond
259
260
261 @seealso
262
263 Program reference: @internalsref{RehearsalMark}.
264
265
266 @node Text markup
267 @subsection Text markup
268
269 @cindex markup
270 @cindex text markup
271 @cindex markup text
272 @cindex typeset text
273
274 Use @code{\markup} to typeset text.  Commands are entered with the
275 backslash @code{\}.  To enter @code{\} and @code{#}, use double
276 quotation marks.
277
278 @lilypond[quote,verbatim,fragment,relative=1]
279 c1^\markup { hello }
280 c1_\markup { hi there }
281 c1^\markup { hi \bold there, is \italic {anyone home?} }
282 c1_\markup { "\special {weird} #characters" }
283 @end lilypond
284
285 @noindent
286 See @ref{Overview of text markup commands} for a list of all
287 commands.
288
289 @code{\markup} is primarily used for @internalsref{TextScript}s,
290 but it can also be used anywhere text is called in lilypond
291
292 @lilypond[quote,verbatim]
293 \header{ title = \markup{ \bold { foo \italic { bar! } } } }
294 \score{
295   \relative c'' {
296     \override Score.RehearsalMark
297       #'break-visibility = #begin-of-line-invisible
298     \override Score.RehearsalMark #'self-alignment-X = #right
299
300     \set Staff.instrumentName = \markup{ \column{ Alto solo } }
301     c2^\markup{ don't be \flat }
302     \override TextSpanner #'edge-text = #(cons (markup #:italic "rit" ) "")
303     b2\startTextSpan
304     a2\mark \markup{ \large \bold Fine }
305     r2\stopTextSpan
306     \bar "||"
307   }
308   \addlyrics { bar, foo \markup{ \italic bar! } }
309 }
310 @end lilypond
311
312 A @code{\markup} command can also be placed on its own, away from any
313 @code{\score} block, see @ref{Multiple scores in a book}.
314
315 @lilypond[quote,ragged-right,verbatim]
316 \markup{ Here is some text. }
317 @end lilypond
318
319 @cindex font switching
320
321 The markup in the example demonstrates font switching commands.  The
322 command @code{\bold} and @code{\italic} apply to the first following
323 word only; to apply a command to more than one word, enclose the
324 words with braces,
325
326 @example
327 \markup @{ \bold @{ hi there @} @}
328 @end example
329
330 @noindent
331 For clarity, you can also do this for single arguments, e.g.,
332
333 @example
334 \markup @{ is \italic @{ anyone @} home @}
335 @end example
336
337 In markup mode you can compose expressions, similar to mathematical
338 expressions, XML documents, and music expressions.  You can stack
339 expressions grouped vertically with the command @code{\column}.
340 Similarly, @code{\center-align} aligns texts by their center lines:
341
342 @lilypond[quote,verbatim,fragment,relative=1]
343 c1^\markup { \column { a bbbb \line { c d } } }
344 c1^\markup { \center-align { a bbbb c } }
345 c1^\markup { \line { a b c } }
346 @end lilypond
347
348 Lists with no previous command are not kept distinct.  The expression
349
350 @example
351 \center-align @{ @{ a b @} @{ c d @} @}
352 @end example
353
354 @noindent
355
356 is equivalent to
357
358 @example
359 \center-align @{ a b c d @}
360 @end example
361
362 @noindent
363
364 To keep lists of words distinct, please use quotes @code{"} or
365 the @code{\line} command
366
367 @lilypond[quote,verbatim,fragment,relative=1]
368 \fatText
369 c4^\markup{ \center-align { on three lines } }
370 c4^\markup{ \center-align { "all one line" } }
371 c4^\markup{ \center-align { { on three lines } } }
372 c4^\markup{ \center-align { \line { on one line } } }
373 @end lilypond
374
375 Markups can be stored in variables and these variables
376 may be attached to notes, like
377 @example
378 allegro = \markup @{ \bold \large @{ Allegro @} @}
379  @{ a^\allegro b c d @}
380 @end example
381
382 Some objects have alignment procedures of their own, which cancel out
383 any effects of alignments applied to their markup arguments as a
384 whole.  For example, the @internalsref{RehearsalMark} is horizontally
385 centered, so using @code{\mark \markup @{ \left-align .. @}} has no
386 effect.
387
388 In addition, vertical placement is performed after creating the
389 text markup object.  If you wish to move an entire piece of markup,
390 you need to use the #'padding property or create an "anchor" point
391 inside the markup (generally with @code{\hspace #0}).
392
393 @lilypond[quote,verbatim,fragment,relative=1]
394 \fatText
395 c'4^\markup{ \raise #5 "not raised" }
396 \once \override TextScript #'padding = #3
397 c'4^\markup{ raised }
398 c'4^\markup{ \hspace #0 \raise #1.5 raised }
399 @end lilypond
400
401 Some situations (such as dynamic marks) have preset font-related
402 properties.  If you are creating text in such situations, it
403 is advisable to cancel those properties with
404 @code{normal-text}.  See @ref{Overview of text markup commands}
405 for more details.
406
407
408 @seealso
409
410 This manual: @ref{Overview of text markup commands}.
411
412 Program reference: @internalsref{TextScript}.
413
414 Init files: @file{scm/@/new@/-markup@/.scm}.
415
416
417 @refbugs
418
419 Kerning or generation of ligatures is only done when the @TeX{}
420 backend is used.  In this case, LilyPond does not account for them so
421 texts will be spaced slightly too wide.
422
423 Syntax errors for markup mode are confusing.
424
425
426 @node Nested scores
427 @subsection Nested scores
428
429 It is possible to nest music inside markups, by adding a @code{\score}
430 block to a markup expression.  Such a score must contain a @code{\layout}
431 block.
432
433 @lilypond[quote,verbatim,ragged-right]
434 \relative {
435   c4 d^\markup {
436     \score {
437       \relative { c4 d e f }
438       \layout { }
439     }
440   }
441   e f
442 }
443 @end lilypond
444
445
446 @node Overview of text markup commands
447 @subsection Overview of text markup commands
448
449 The following commands can all be used inside @code{\markup @{ @}}.
450
451 @include markup-commands.tely
452
453
454 @node Font selection
455 @subsection Font selection
456
457 @cindex font selection
458 @cindex font magnification
459 @funindex font-interface
460
461 By setting the object properties described below, you can select a
462 font from the preconfigured font families.  LilyPond has default
463 support for the feta music fonts. Text fonts are selected through
464 Pango/FontConfig. The serif font defaults to New Century Schoolbook,
465 the sans and typewriter to whatever the Pango installation defaults
466 to.
467
468
469 @itemize @bullet
470 @item @code{font-encoding}
471 is a symbol that sets layout of the glyphs.  This should only be set to
472 select different types of non-text fonts, e.g.
473
474 @code{fetaBraces} for piano staff braces, @code{fetaMusic} the
475 standard music font, including ancient glyphs, @code{fetaDynamic} for
476 dynamic signs and @code{fetaNumber} for the number font.
477
478 @item @code{font-family}
479 is a symbol indicating the general class of the typeface.  Supported are
480 @code{roman} (Computer Modern), @code{sans}, and @code{typewriter}.
481
482 @item @code{font-shape}
483 is a symbol indicating the shape of the font.  There are typically
484 several font shapes available for each font family.  Choices are
485 @code{italic}, @code{caps}, and @code{upright}.
486
487 @item @code{font-series}
488 is a symbol indicating the series of the font.  There are typically
489 several font series for each font family and shape.  Choices are
490 @code{medium} and @code{bold}.
491
492 @end itemize
493
494 Fonts selected in the way sketched above come from a predefined style
495 sheet. If you want to use a font from outside the style sheet,
496 then set the
497 @code{font-name} property,
498
499 @lilypond[fragment,verbatim]
500 {
501   \override Staff.TimeSignature #'font-name = #"Charter"
502   \override Staff.TimeSignature #'font-size = #2
503   \time 3/4
504   c'1_\markup {
505     \override #'(font-name . "Vera Bold")
506       { This text is in Vera Bold }
507   }
508 }
509 @end lilypond
510
511 @noindent
512 Any font can be used, as long as it is available to Pango/FontConfig.
513 To get a full list of all available fonts, run the command
514 @example
515 lilypond -dshow-available-fonts blabla
516 @end example
517 (the last argument of the command can be anything, but has to be present).
518
519
520 The size of the font may be set with the @code{font-size}
521 property. The resulting size is taken relative to the
522 @code{text-font-size} as defined in the @code{\paper} block.
523
524 @cindex font size
525 @cindex font magnification
526
527
528 It is also possible to change the default font family for the entire
529 document. This is done by calling the @code{make-pango-font-tree} from
530 within the @code{\paper} block. The function takes names for the font
531 families to use for roman, sans serif and monospaced text. For
532 example,
533
534 @cindex font families, setting
535 @cindex Pango
536
537
538 @lilypond[verbatim]
539 \paper  {
540   myStaffSize = #20
541
542   #(define fonts
543     (make-pango-font-tree "Times New Roman"
544                           "Nimbus Sans"
545                           "Luxi Mono"
546                            (/ myStaffSize 20)))
547 }
548
549 {
550   c'^\markup { roman: foo \sans bla \typewriter bar }
551 }
552 @end lilypond
553
554 @c we don't do Helvetica / Courier, since GS incorrectly loads
555 @c Apple TTF fonts
556
557
558
559 @seealso
560
561 Examples: @inputfileref{input/@/regression,font@/-family@/-override.ly}.
562
563
564 @node New dynamic marks
565 @subsection New dynamic marks
566
567 It is possible to print new dynamic marks or text that should be aligned
568 with dynamics.  Use @code{make-dynamic-script} to create these
569 marks.  Note that the dynamic font only contains the characters
570 @code{f,m,p,r,s} and @code{z}.
571
572 Some situations (such as dynamic marks) have preset font-related
573 properties.  If you are creating text in such situations, it
574 is advisable to cancel those properties with
575 @code{normal-text}.  See @ref{Overview of text markup commands}
576 for more details.
577
578 @cindex make-dynamic-script
579
580 @lilypond[quote,verbatim,ragged-right]
581 sfzp = #(make-dynamic-script "sfzp")
582 \relative c' {
583   c4 c c\sfzp c
584 }
585 @end lilypond
586
587 @cindex Dynamics, editorial
588 @cindex Dynamics, parenthesis
589
590 It is also possible to print dynamics in round parenthesis or square
591 brackets.  These are often used for adding editorial dynamics.
592
593 @lilypond[quote,verbatim,ragged-right]
594 rndf = \markup{ \center-align {\line { \bold{\italic (}
595   \dynamic f \bold{\italic )} }} }
596 boxf = \markup{ \bracket { \dynamic f } }
597 { c'1_\rndf c'1_\boxf }
598 @end lilypond
599
600
601
602 @node Preparing parts
603 @section Preparing parts
604
605 This section describes various notation that are useful for preparing
606 individual parts.
607
608 @menu
609 * Multi measure rests::         
610 * Metronome marks::             
611 * Rehearsal marks::             
612 * Bar numbers::                 
613 * Instrument names::            
614 * Instrument transpositions::   
615 * Ottava brackets::             
616 * Different editions from one source::  
617 @end menu
618
619
620 @node Multi measure rests
621 @subsection Multi measure rests
622
623 @cindex multi measure rests
624 @cindex full measure rests
625 @cindex Rests, multi measure
626 @cindex Rests, full measure
627 @cindex whole rests for a full measure
628 @funindex R
629
630 Rests for one full measure (or many bars) are entered using @samp{R}.  It
631 is specifically meant for full bar rests and for entering parts: the rest
632 can expand to fill a score with rests, or it can be printed as a single
633 multi-measure rest.  This expansion is controlled by the property
634 @code{Score.skipBars}.  If this is set to true, empty measures will not
635 be expanded, and the appropriate number is added automatically
636
637 @lilypond[quote,ragged-right,fragment,verbatim]
638 \time 4/4 r1 | R1 | R1*2 \time 3/4 R2. \time 2/4 R2 \time 4/4
639 \set Score.skipBars = ##t R1*17 R1*4
640 @end lilypond
641
642 The @code{1} in @code{R1} is similar to the duration notation used for
643 notes.  Hence, for time signatures other than 4/4, you must enter other
644 durations.  This can be done with augmentation dots or fractions
645
646 @lilypond[quote,ragged-right,fragment,verbatim]
647 \set Score.skipBars = ##t
648 \time 3/4
649 R2. | R2.*2
650 \time 13/8
651 R1*13/8
652 R1*13/8*12 |
653 \time 10/8 R4*5*4 |
654 @end lilypond
655
656 An @code{R} spanning a single measure is printed as either a whole rest
657 or a breve, centered in the measure regardless of the time signature.
658
659 If there are only a few measures of rest, LilyPond prints @q{church rests}
660 (a series of rectangles) in the staff.  To replace that with a simple
661 rest, use @code{MultiMeasureRest.expand-limit}.
662
663 @lilypond[quote,ragged-right,fragment,verbatim]
664 \set Score.skipBars = ##t
665 R1*2 | R1*5 | R1*9
666 \override MultiMeasureRest #'expand-limit = 1
667 R1*2 | R1*5 | R1*9
668 @end lilypond
669
670 @cindex text on multi-measure rest
671 @cindex script on multi-measure rest
672 @cindex fermata on multi-measure rest
673
674 Texts can be added to multi-measure rests by using the
675 @var{note}-@code{markup} syntax @ref{Text markup}.
676 A variable (@code{\fermataMarkup}) is provided for
677 adding fermatas
678
679 @lilypond[quote,ragged-right,verbatim,fragment]
680 \set Score.skipBars = ##t
681 \time 3/4
682 R2.*10^\markup { \italic "ad lib." }
683 R2.^\fermataMarkup
684 @end lilypond
685
686 Warning!  This text is created by @code{MultiMeasureRestText}, not
687 @code{TextScript}.
688
689 @lilypond[quote,ragged-right,verbatim,fragment]
690 \override TextScript #'padding = #5
691 R1^"low"
692 \override MultiMeasureRestText #'padding = #5
693 R1^"high"
694 @end lilypond
695
696 If you want to have text on the left end of a multi-measure rest,
697 attach the text to a zero-length skip note, i.e.,
698
699 @example
700 s1*0^"Allegro"
701 R1*4
702 @end example
703
704
705 @seealso
706
707 Program reference: @internalsref{MultiMeasureRestMusicGroup},
708 @internalsref{MultiMeasureRest}.
709
710 The layout object @internalsref{MultiMeasureRestNumber} is for the
711 default number, and @internalsref{MultiMeasureRestText} for user
712 specified texts.
713
714
715 @refbugs
716
717 It is not possible to use fingerings (e.g., @code{R1-4}) to put numbers
718 over multi-measure rests.  And the pitch of multi-measure rests (or
719 staff-centered rests) can not be influenced.
720
721 @cindex condensing rests
722
723 There is no way to automatically condense multiple rests into a single
724 multi-measure rest.  Multi-measure rests do not take part in rest
725 collisions.
726
727 Be careful when entering multi-measure rests followed by whole
728 notes.  The following will enter two notes lasting four measures each
729 @example
730 R1*4 cis cis
731 @end example
732 When @code{skipBars} is set, the result will look OK, but the bar
733 numbering will be off.
734
735
736 @node Metronome marks
737 @subsection Metronome marks
738
739 @cindex Tempo
740 @cindex beats per minute
741 @cindex metronome marking
742
743 Metronome settings can be entered as follows
744 @example
745 \tempo @var{duration} = @var{per-minute}
746 @end example
747
748 In the MIDI output, they are interpreted as a tempo change.  In the
749 layout output, a metronome marking is printed
750 @funindex \tempo
751 @lilypond[quote,ragged-right,verbatim,fragment]
752 \tempo 8.=120 c''1
753 @end lilypond
754
755
756 @commonprop
757
758 To change the tempo in the MIDI output without printing anything, make
759 the metronome marking invisible
760 @example
761 \once \override Score.MetronomeMark #'transparent = ##t
762 @end example
763
764 To print other metronome markings, use these markup commands
765 @lilypond[quote,ragged-right,verbatim,relative,fragment]
766 c4^\markup {
767   (
768   \smaller \general-align #Y #DOWN \note #"16." #1
769   =
770   \smaller \general-align #Y #DOWN \note #"8" #1
771   ) }
772 @end lilypond
773
774 @noindent
775 See @ref{Text markup} for more details.
776
777
778 @seealso
779
780 Program reference: @internalsref{MetronomeMark}.
781
782
783 @refbugs
784
785 Collisions are not checked.  If you have notes above the top line of
786 the staff (or notes with articulations, slurs, text, etc), then the
787 metronome marking may be printed on top of musical symbols.  If this
788 occurs, increase the padding of the metronome mark to place it
789 further away from the staff.
790
791 @example
792 \override Score.MetronomeMark #'padding = #2.5
793 @end example
794
795
796 @node Rehearsal marks
797 @subsection Rehearsal marks
798
799 @cindex Rehearsal marks
800 @funindex \mark
801
802 To print a rehearsal mark, use the @code{\mark} command
803
804 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
805 c1 \mark \default
806 c1 \mark \default
807 c1 \mark #8
808 c1 \mark \default
809 c1 \mark \default
810 @end lilypond
811
812 @noindent
813 The letter@tie{}@q{I} is skipped in accordance with engraving traditions.
814 If you wish to include the letter @q{I}, then use
815
816 @example
817 \set Score.markFormatter = #format-mark-alphabet
818 @end example
819
820 The mark is incremented automatically if you use @code{\mark
821 \default}, but you can also use an integer argument to set the mark
822 manually.  The value to use is stored in the property
823 @code{rehearsalMark}.
824
825 The style is defined by the property @code{markFormatter}.  It is a
826 function taking the current mark (an integer) and the current context
827 as argument.  It should return a markup object.  In the following
828 example, @code{markFormatter} is set to a canned procedure.  After a
829 few measures, it is set to function that produces a boxed number.
830
831 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
832 \set Score.markFormatter = #format-mark-numbers
833 c1 \mark \default
834 c1 \mark \default
835 \set Score.markFormatter = #format-mark-box-numbers
836 c1 \mark \default
837 c1 \mark \default
838 c1
839 @end lilypond
840
841 The file @file{scm/@/translation@/-functions@/.scm} contains the definitions
842 of @code{format-mark-numbers} (the default format),
843 @code{format-mark-box-numbers},
844 @code{format-mark-letters} and @code{format-mark-box-letters}.
845 These can be used as inspiration for other formatting functions.
846
847 You may use @code{format-mark-barnumbers}, @code{format-mark-box-barnumbers},
848 and @code{format-mark-circle-barnumbers} to get bar numbers instead of
849 incremented numbers or letters.
850
851 Other styles of rehearsal mark can be specified manually
852
853 @example
854 \mark "A1"
855 @end example
856
857 @noindent
858 @code{Score.markFormatter} does not affect marks specified in this manner.
859 However, it is possible to apply a @code{\markup} to the string.
860
861 @example
862 \mark \markup@{ \box A1 @}
863 @end example
864
865 @cindex segno
866 @cindex coda
867 @cindex D.S al Fine
868
869 Music glyphs (such as the segno sign) may be printed inside
870 a @code{\mark}
871
872 @lilypond[fragment,quote,ragged-right,verbatim,relative]
873 c1 \mark \markup { \musicglyph #"scripts.segno" }
874 c1 \mark \markup { \musicglyph #"scripts.coda" }
875 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
876 c1
877 @end lilypond
878
879 @noindent
880 See @ref{The Feta font} for a list of symbols which may be
881 printed with @code{\musicglyph}.
882
883 The horizontal location of rehearsal marks can be adjusted by
884 setting @code{break-align-symbol}
885
886 @lilypond[fragment,quote,ragged-right,verbatim,relative]
887 c1
888 \key cis \major
889 \clef alto
890 \override Score.RehearsalMark #'break-align-symbol = #'key-signature
891 \mark "on-key"
892 cis
893 \key ces \major
894 \override Score.RehearsalMark #'break-align-symbol = #'clef
895 \clef treble
896 \mark "on clef"
897 ces
898 @end lilypond
899
900 @code{break-align-symbol} may also accept the following values:
901 @code{ambitus}, @code{breathing-sign}, @code{clef}, @code{custos},
902 @code{staff-bar}, @code{left-edge}, @code{key-cancellation},
903 @code{key-signature}, and @code{time-signature}.  Setting
904 @code{break-align-symbol} will only have an effect if the symbol
905 appears at that point in the music.
906
907
908 @seealso
909
910 This manual: @ref{Text marks}.
911
912 Program reference: @internalsref{RehearsalMark}.
913
914 Init files: @file{scm/@/translation@/-functions@/.scm} contains the
915 definition of @code{format-mark-numbers} and
916 @code{format-mark-letters}.  They can be used as inspiration for other
917 formatting functions.
918
919 Examples: @inputfileref{input/@/regression,rehearsal@/-mark@/-letter@/.ly},
920
921 @inputfileref{input/@/regression,rehearsal@/-mark@/-number@/.ly}.
922
923
924 @node Bar numbers
925 @subsection Bar numbers
926
927 @cindex Bar numbers
928 @cindex measure numbers
929 @funindex currentBarNumber
930
931 Bar numbers are printed by default at the start of the line.  The
932 number itself is stored in the @code{currentBarNumber} property, which
933 is normally updated automatically for every measure.
934
935 @lilypond[verbatim,ragged-right,quote,fragment,relative]
936 \repeat unfold 4 {c4 c c c} \break
937 \set Score.currentBarNumber = #50
938 \repeat unfold 4 {c4 c c c}
939 @end lilypond
940
941 Bar numbers may only be printed at bar lines; to print a bar
942 number at the beginning of a piece, an empty bar line must
943 be added
944
945 @lilypond[verbatim,ragged-right,quote,fragment,relative]
946 \set Score.currentBarNumber = #50
947 \bar ""
948 \repeat unfold 4 {c4 c c c} \break
949 \repeat unfold 4 {c4 c c c}
950 @end lilypond
951
952 Bar numbers can be typeset at regular intervals instead of at the
953 beginning of each line.  This is illustrated in the following example,
954 whose source is available as
955 @inputfileref{input/@/test,bar@/-number@/-regular@/-interval@/.ly}
956
957 @lilypondfile[ragged-right,quote]{bar-number-regular-interval.ly}
958
959 Bar numbers can be removed entirely by removing the Bar number
960 engraver from the score.
961
962 @lilypond[verbatim,ragged-right,quote]
963 \layout {
964   \context {
965     \Score
966     \remove "Bar_number_engraver"
967   }
968 }
969 \relative c''{
970 c4 c c c \break
971 c4 c c c
972 }
973 @end lilypond
974
975
976 @seealso
977
978 Program reference: @internalsref{BarNumber}.
979
980 Examples:
981 @inputfileref{input/@/test,bar@/-number@/-every@/-five@/-reset@/.ly},
982 and @inputfileref{input/@/test,bar@/-number@/-regular@/-interval@/.ly}.
983
984
985 @refbugs
986
987 Bar numbers can collide with the @internalsref{StaffGroup} bracket, if
988 there is one at the top.  To solve this, the
989 @code{padding} property of @internalsref{BarNumber} can be
990 used to position the number correctly.
991
992
993 @node Instrument names
994 @subsection Instrument names
995
996 In an orchestral score, instrument names are printed at the left side
997 of the staves.
998
999 This can be achieved by setting @internalsref{Staff}.@code{instrumentName}
1000 and @internalsref{Staff}.@code{shortInstrumentName}, or
1001 @internalsref{PianoStaff}.@code{instrumentName} and
1002 @internalsref{PianoStaff}.@code{shortInstrumentName}.  This will
1003 print text before
1004 the start of the staff.  For the first staff, @code{instrumentName} is
1005 used, for the following ones, @code{shortInstrumentName} is used.
1006
1007 @lilypond[quote,verbatim,ragged-right,relative=1,fragment]
1008 \set Staff.instrumentName = "Ploink "
1009 \set Staff.shortInstrumentName = "Plk "
1010 c1
1011 \break
1012 c''
1013 @end lilypond
1014
1015 You can also use markup texts to construct more complicated instrument
1016 names, for example
1017
1018 @lilypond[quote,fragment,verbatim,ragged-right]
1019 \set Staff.instrumentName = \markup {
1020   \column { "Clarinetti"
1021             \line { "in B" \smaller \flat } } }
1022 c''1
1023 @end lilypond
1024
1025 If you wish to center the instrument names, you must center all of them
1026
1027 @lilypond[quote,verbatim,ragged-right]
1028 { <<
1029 \new Staff {
1030   \set Staff.instrumentName = \markup {
1031     \center-align { "Clarinetti"
1032       \line { "in B" \smaller \flat } } }
1033   c''1
1034 }
1035 \new Staff {
1036   \set Staff.instrumentName = \markup{ \center-align { Vibraphone }}
1037   c''1
1038 }
1039 >>
1040 }
1041 @end lilypond
1042
1043 For longer instrument names, it may be useful to increase the
1044 @code{indent} setting in the @code{\layout} block.
1045
1046 To center instrument names while leaving extra space to the right,
1047
1048 @lilypond[quote,verbatim,ragged-right]
1049 \new StaffGroup \relative
1050 <<
1051   \new Staff {
1052     \set Staff.instrumentName = \markup { \hcenter-in #10 "blabla" }
1053     c1 c1
1054   }
1055   \new Staff {
1056     \set Staff.instrumentName = \markup { \hcenter-in #10 "blo" }
1057     c1 c1
1058   }
1059 >>
1060 @end lilypond
1061
1062 To add instrument names to other contexts (such as @code{GrandStaff},
1063 @code{ChoirStaff}, or @code{StaffGroup}), the engraver must
1064 be added to that context.
1065
1066 @example
1067 \layout@{
1068   \context @{\GrandStaff \consists "Instrument_name_engraver"@}
1069 @}
1070 @end example
1071
1072 @noindent
1073 More information about adding and removing engravers can
1074 be found in @ref{Modifying context plug-ins}.
1075
1076 Instrument names may be changed in the middle of a piece,
1077
1078 @lilypond[quote,fragment,verbatim,ragged-right]
1079 \set Staff.instrumentName = "First"
1080 \set Staff.shortInstrumentName = "one"
1081 c1 c c c \break
1082 c1 c c c \break
1083 \set Staff.instrumentName = "Second"
1084 \set Staff.shortInstrumentName = "two"
1085 c1 c c c \break
1086 c1 c c c \break
1087 @end lilypond
1088
1089
1090 @seealso
1091
1092 Program reference: @internalsref{InstrumentName}.
1093
1094
1095
1096 @node Instrument transpositions
1097 @subsection Instrument transpositions
1098
1099 @cindex transposition, MIDI
1100 @cindex transposition, instrument
1101
1102 The key of a transposing instrument can also be specified.  This
1103 applies to many wind instruments, for example, clarinets (B-flat, A, and
1104 E-flat), horn (F) and trumpet (B-flat, C, D, and E-flat).
1105
1106 The transposition is entered after the keyword @code{\transposition}
1107
1108 @example
1109 \transposition bes   %% B-flat clarinet
1110 @end example
1111
1112 @noindent
1113 This command sets the property @code{instrumentTransposition}.  The value of
1114 this property is used for MIDI output and quotations.  It does not
1115 affect how notes are printed in the current staff.  To change the printed
1116 output, see @ref{Transpose}.
1117
1118 The pitch to use for @code{\transposition} should correspond to the
1119 real sound heard when a @code{c'} written on the staff is played by the
1120 transposing instrument.  For example, when entering a score in
1121 concert pitch, typically all voices are entered in C, so
1122 they should be entered as
1123
1124 @example
1125 clarinet = @{
1126   \transposition c'
1127   ...
1128 @}
1129 saxophone = @{
1130   \transposition c'
1131   ...
1132 @}
1133 @end example
1134
1135 The command @code{\transposition} should be used when the music is
1136 entered from a (transposed) orchestral part.  For example, in
1137 classical horn parts, the tuning of the instrument is often changed
1138 during a piece.  When copying the notes from the part, use
1139 @code{\transposition}, e.g.,
1140
1141 @example
1142 \transposition d'
1143 c'4^"in D"
1144 ...
1145 \transposition g'
1146 c'4^"in G"
1147 ...
1148 @end example
1149
1150
1151 @node Ottava brackets
1152 @subsection Ottava brackets
1153
1154 @q{Ottava} brackets introduce an extra transposition of an octave for
1155 the staff.  They are created by invoking the function
1156 @code{set-octavation}
1157
1158 @cindex ottava
1159 @cindex 15ma
1160 @cindex octavation
1161
1162 @lilypond[quote,ragged-right,verbatim,fragment]
1163 \relative c''' {
1164   a2 b
1165   #(set-octavation 1)
1166   a b
1167   #(set-octavation 0)
1168   a b
1169 }
1170 @end lilypond
1171
1172 The @code{set-octavation} function also takes -1 (for 8va bassa), 2@tie{}(for 15ma),
1173 and -2 (for 15ma bassa) as arguments.  Internally the function sets the properties
1174 @code{ottavation} (e.g., to @code{"8va"} or @code{"8vb"}) and
1175 @code{centralCPosition}.  For overriding the text of the bracket, set
1176 @code{ottavation} after invoking @code{set-octavation}, i.e.,
1177
1178 @lilypond[quote,ragged-right,verbatim]
1179 {
1180   #(set-octavation 1)
1181   \set Staff.ottavation = #"8"
1182   c'''
1183 }
1184 @end lilypond
1185
1186
1187 @seealso
1188
1189 Program reference: @internalsref{OttavaBracket}.
1190
1191 Examples: @inputfileref{input/@/regression,ottava@/.ly},
1192 @inputfileref{input/@/regression,ottava@/-broken@/.ly}.
1193
1194
1195 @refbugs
1196
1197 @code{set-octavation} will get confused when clef changes happen
1198 during an octavation bracket.
1199
1200
1201 @node Different editions from one source
1202 @subsection Different editions from one source
1203
1204 @funindex \tag
1205 @cindex tag
1206
1207 The @code{\tag} command marks music expressions with a name.  These
1208 tagged expressions can be filtered out later.  With this mechanism it
1209 is possible to make different versions of the same music source.
1210
1211 In the following example, we see two versions of a piece of music, one
1212 for the full score, and one with cue notes for the instrumental part
1213
1214 @example
1215 c1
1216 <<
1217   \tag #'part <<
1218     R1 \\
1219     @{
1220       \set fontSize = #-1
1221       c4_"cue" f2 g4 @}
1222   >>
1223   \tag #'score R1
1224 >>
1225 c1
1226 @end example
1227
1228 The same can be applied to articulations, texts, etc.: they are
1229 made by prepending
1230 @example
1231 -\tag #@var{your-tag}
1232 @end example
1233 to an articulation, for example,
1234 @example
1235 c1-\tag #'part ^4
1236 @end example
1237
1238 This defines a note with a conditional fingering indication.
1239
1240 @cindex keepWithTag
1241 @cindex removeWithTag
1242 By applying the @code{\keepWithTag} and @code{\removeWithTag}
1243 commands, tagged expressions can be filtered.  For example,
1244 @example
1245 <<
1246   @var{the music}
1247   \keepWithTag #'score @var{the music}
1248   \keepWithTag #'part @var{the music}
1249 >>
1250 @end example
1251 would yield
1252
1253 @lilypondfile[ragged-right,quote]{tag-filter.ly}
1254
1255 The arguments of the @code{\tag} command should be a symbol
1256 (such as @code{#'score} or @code{#'part}), followed by a
1257 music expression.  It is possible to put multiple tags on
1258 a piece of music with multiple @code{\tag} entries,
1259
1260 @example
1261   \tag #'original-part \tag #'transposed-part @dots{}
1262 @end example
1263
1264
1265 @seealso
1266
1267 Examples: @inputfileref{input/@/regression,tag@/-filter@/.ly}.
1268
1269
1270 @refbugs
1271
1272 Multiple rests are not merged if you create the score with both tagged
1273 sections.
1274
1275
1276
1277 @node Orchestral music
1278 @section Orchestral music
1279
1280 Orchestral music involves some special notation, both in the full
1281 score and the individual parts.  This section explains how to tackle
1282 some common problems in orchestral music.
1283
1284 @menu
1285 * Automatic part combining::    
1286 * Hiding staves::               
1287 * Quoting other voices::        
1288 * Formatting cue notes::        
1289 * Aligning to cadenzas::        
1290 @end menu
1291
1292
1293 @node Automatic part combining
1294 @subsection Automatic part combining
1295 @cindex automatic part combining
1296 @cindex part combiner
1297
1298 Automatic part combining is used to merge two parts of music onto a
1299 staff.  It is aimed at typesetting orchestral scores.  When the two
1300 parts are identical for a period of time, only one is shown.  In
1301 places where the two parts differ, they are typeset as separate
1302 voices, and stem directions are set automatically.  Also, solo and
1303 @emph{a due} parts are identified and can be marked.
1304
1305 The syntax for part combining is
1306
1307 @example
1308 \partcombine @var{musicexpr1} @var{musicexpr2}
1309 @end example
1310
1311
1312 The following example demonstrates the basic functionality of the part
1313 combiner: putting parts on one staff, and setting stem directions and
1314 polyphony
1315
1316 @lilypond[quote,verbatim,ragged-right,fragment]
1317 \new Staff \partcombine
1318   \relative g' { g g a( b) c c r r }
1319   \relative g' { g g r4 r e e g g }
1320 @end lilypond
1321
1322 The first @code{g} appears only once, although it was
1323 specified twice (once in each part).  Stem, slur, and tie directions are
1324 set automatically, depending whether there is a solo or unisono.  The
1325 first part (with context called @code{one}) always gets up stems, and
1326 @q{Solo}, while the second (called @code{two}) always gets down stems and
1327 @q{Solo II}.
1328
1329 If you just want the merging parts, and not the textual markings, you
1330 may set the property @code{printPartCombineTexts} to false
1331
1332 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
1333 \new Staff <<
1334   \set Staff.printPartCombineTexts = ##f
1335   \partcombine
1336     \relative g' { g a( b) r }
1337     \relative g' { g r4 r f }
1338 >>
1339 @end lilypond
1340
1341 To change the text that is printed for solos or merging, you may
1342 set the @code{soloText}, @code{soloIIText}, and @code{aDueText}
1343 properties.
1344
1345 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
1346 \new Staff <<
1347   \set Score.soloText = #"ichi"
1348   \set Score.soloIIText = #"ni"
1349   \set Score.aDueText = #"tachi"
1350   \partcombine
1351     \relative g' { g4 g a( b) r }
1352     \relative g' { g4 g r r f }
1353 >>
1354 @end lilypond
1355
1356 Both arguments to @code{\partcombine} will be interpreted as
1357 @internalsref{Voice} contexts.  If using relative octaves,
1358 @code{\relative} should be specified for both music expressions, i.e.,
1359
1360 @example
1361 \partcombine
1362   \relative @dots{} @var{musicexpr1}
1363   \relative @dots{} @var{musicexpr2}
1364 @end example
1365
1366 @noindent
1367 A @code{\relative} section that is outside of @code{\partcombine} has
1368 no effect on the pitches of @var{musicexpr1} and @var{musicexpr2}.
1369
1370 @seealso
1371
1372 Program reference: @internalsref{PartCombineMusic}.
1373
1374 @refbugs
1375
1376 When @code{printPartCombineTexts} is set, when the two voices play the
1377 same notes on and off, the part combiner may typeset @code{a2} more
1378 than once in a measure.
1379
1380 @code{\partcombine} cannot be inside @code{\times}.
1381
1382 @code{\partcombine} cannot be inside @code{\relative}.
1383
1384 Internally, the @code{\partcombine} interprets both arguments as
1385 @code{Voice}s named @code{one} and @code{two}, and then decides when
1386 the parts can be combined.  Consequently, if the arguments switch to
1387 differently named @internalsref{Voice} contexts, the events in those
1388 will be ignored.
1389
1390
1391 @node Hiding staves
1392 @subsection Hiding staves
1393
1394 @cindex Frenched scores
1395 @cindex Hiding staves
1396
1397 In orchestral scores, staff lines that only have rests are usually
1398 removed; this saves some space.  This style is called @q{French Score}.
1399 For @internalsref{Lyrics},
1400 @internalsref{ChordNames} and @internalsref{FiguredBass}, this is
1401 switched on by default.  When the lines of these contexts turn out
1402 empty after the line-breaking process, they are removed.
1403
1404 For normal staves, a specialized @internalsref{Staff} context is
1405 available, which does the same: staves containing nothing (or only
1406 multi-measure rests) are removed.  The context definition is stored in
1407 @code{\RemoveEmptyStaffContext} variable.  Observe how the second staff
1408 in this example disappears in the second line
1409
1410 @lilypond[quote,ragged-right,verbatim]
1411 \layout {
1412   \context { \RemoveEmptyStaffContext }
1413 }
1414
1415 {
1416   \relative c' <<
1417     \new Staff { e4 f g a \break c1 }
1418     \new Staff { c4 d e f \break R1 }
1419   >>
1420 }
1421 @end lilypond
1422
1423 The first system shows all staves in full.  If empty staves should be
1424 removed from the first system too, set @code{remove-first} to true in
1425 @internalsref{VerticalAxisGroup}.
1426
1427 @example
1428 \override Score.VerticalAxisGroup #'remove-first = ##t
1429 @end example
1430
1431 To remove other types of contexts, use @code{\AncientRemoveEmptyStaffContext}
1432 or @code{\RemoveEmptyRhythmicStaffContext}.
1433
1434 Another application is making ossia sections, i.e., alternative
1435 melodies on a separate piece of staff, with help of a Frenched
1436 staff.  
1437
1438
1439 @node Quoting other voices
1440 @subsection Quoting other voices
1441
1442 @cindex cues
1443
1444 With quotations, fragments of other parts can be inserted into a part
1445 directly.  Before a part can be quoted, it must be marked especially as
1446 quotable.  This is done with the @code{\addQuote} command.
1447
1448 @example
1449 \addQuote @var{name} @var{music}
1450 @end example
1451
1452
1453 @noindent
1454 Here, @var{name} is an identifying string.  The @var{music} is any kind
1455 of music.  Here is an example of @code{\addQuote}
1456
1457 @example
1458 \addQuote clarinet \relative c' @{
1459   f4 fis g gis
1460 @}
1461 @end example
1462
1463 This command must be entered at toplevel, i.e., outside any music
1464 blocks.
1465
1466 After calling @code{\addQuote}, the quotation may then be done with
1467 @code{\quoteDuring} or @code{\cueDuring},
1468
1469 @example
1470 \quoteDuring #@var{name} @var{music}
1471 @end example
1472
1473 During a part, a piece of music can be quoted with the @code{\quoteDuring}
1474 command.
1475
1476 @example
1477 \quoteDuring #"clarinet" @{ s2. @}
1478 @end example
1479
1480 This would cite three quarter notes (the duration of @code{s2.})  of
1481 the previously added @code{clarinet} voice.
1482
1483
1484 More precisely, it takes the current time-step of the part being
1485 printed, and extracts the notes at the corresponding point of the
1486 @code{\addQuote}d voice.  Therefore, the argument to @code{\addQuote}
1487 should be the entire part of the voice to be quoted, including any
1488 rests at the beginning.
1489
1490 Quotations take into account the transposition of both source and target
1491 instruments, if they are specified using the @code{\transposition} command.
1492
1493 @lilypond[quote,ragged-right,verbatim]
1494 \addQuote clarinet \relative c' {
1495   \transposition bes
1496   f4 fis g gis
1497 }
1498
1499 {
1500   e'8 f'8 \quoteDuring #"clarinet" { s2 }
1501 }
1502 @end lilypond
1503
1504 The type of events that are present in cue notes can be trimmed with
1505 the @code{quotedEventTypes} property.  The default value is
1506 @code{(note-event rest-event)}, which means that only notes and
1507 rests of the cued voice end up in the @code{\quoteDuring}.
1508 Setting
1509
1510 @example
1511 \set Staff.quotedEventTypes =
1512        #'(note-event articulation-event dynamic-event)
1513 @end example
1514
1515 @noindent
1516 will quote notes (but no rests), together with scripts and dynamics.
1517
1518 @refbugs
1519
1520 Only the contents of the first @internalsref{Voice} occurring in an
1521 @code{\addQuote} command will be considered for quotation, so
1522 @var{music} can not contain @code{\new} and @code{\context Voice}
1523 statements that would switch to a different Voice.
1524
1525 Quoting grace notes is broken and can even cause LilyPond to crash.
1526
1527 Quoting nested triplets may result in poor notation.
1528
1529
1530 @seealso
1531
1532 In this manual: @ref{Instrument transpositions}.
1533
1534 Examples: @inputfileref{input/@/regression,quote@/.ly}
1535 @inputfileref{input/@/regression,quote@/-transposition@/.ly}
1536
1537 Program reference: @internalsref{QuoteMusic}.
1538
1539
1540 @node Formatting cue notes
1541 @subsection Formatting cue notes
1542
1543 @cindex cues, formatting
1544
1545 The previous section deals with inserting notes from another voice.
1546 There is a more advanced music function called @code{\cueDuring},
1547 which makes formatting cue notes easier.
1548
1549 The syntax is
1550
1551 @example
1552   \cueDuring #@var{name} #@var{updown} @var{music}
1553 @end example
1554
1555 This will insert notes from the part @var{name} into a
1556 @internalsref{Voice} called @code{cue}.  This happens simultaneously
1557 with @var{music}, which usually is a rest.  When the cue notes start,
1558 the staff in effect becomes polyphonic for a moment.  The argument
1559 @var{updown} determines whether the cue notes should be notated as a
1560 first or second voice.
1561
1562
1563 @lilypond[verbatim,ragged-right]
1564 smaller = {
1565   \set fontSize = #-2
1566   \override Stem #'length-fraction = #0.8
1567   \override Beam #'thickness = #0.384
1568   \override Beam #'length-fraction = #0.8
1569 }
1570
1571 \addQuote clarinet \relative {
1572   R1*20
1573   r2 r8 c f f
1574 }
1575
1576 \new Staff \relative  <<
1577
1578   % setup a context for  cue  notes.
1579   \new Voice = "cue" { \smaller \skip 1*21 }
1580
1581   \set Score.skipBars = ##t
1582
1583   \new Voice {
1584     R1*20
1585     \cueDuring #"clarinet" #1 {
1586       R1
1587     }
1588     g4 g2.
1589   }
1590 >>
1591 @end lilypond
1592
1593
1594 Here are a couple of hints for successful cue notes
1595
1596 @itemize @bullet
1597 @item
1598 Cue notes have smaller font sizes.
1599 @item
1600  the cued part is marked with the instrument playing the cue.
1601 @item
1602  when the original part takes over again, this should be marked with
1603  the name of the original instrument.
1604
1605 @c really?  Are you sure about that last point?  I'll check after 3.0 -gp
1606
1607 @c Yes, this is good practice.  Otherwise, the start of the original
1608 @c part can only be seen from the font size.  This is not good enough
1609 @c for sight-reading.  It is possilbe to use other
1610 @c markers (e.g. a big close-bracket over the staff) to indicate the cue
1611 @c   notes are
1612 @c finished.
1613 @c -hwn
1614
1615
1616 Any other changes introduced by the cued part should also be
1617 undone.  For example, if the cued instrument plays in a different clef,
1618 the original clef should be stated once again.
1619
1620 @end itemize
1621
1622 The macro @code{\transposedCueDuring} is
1623 useful to add cues to instruments which use a completely different
1624 octave range (for example, having a cue of a piccolo flute within
1625 a contra bassoon part).
1626
1627 @lilypond[verbatim,ragged-right,quote]
1628 picc = \relative c''' {
1629   \clef "treble^8"
1630   R1 |
1631   c8 c c e g2 |
1632   a4 g g2 |
1633 }
1634 \addQuote "picc" { \picc }
1635
1636 cbsn = \relative c, {
1637   \clef "bass_8"
1638   c4 r g r
1639   \transposedCueDuring #"picc" #UP c,, { R1 } |
1640   c4 r g r |
1641 }
1642
1643 <<
1644   \context Staff = "picc" \picc
1645   \context Staff = "cbsn" \cbsn
1646 >>
1647 @end lilypond
1648
1649
1650
1651 @node Aligning to cadenzas
1652 @subsection Aligning to cadenzas
1653
1654 In an orchestral context, cadenzas present a special problem:
1655 when constructing a score that includes a cadenza, all other
1656 instruments should skip just as many notes as the length of the
1657 cadenza, otherwise they will start too soon or too late.
1658
1659 A solution to this problem are the functions @code{mmrest-of-length}
1660 and @code{skip-of-length}.  These Scheme functions take a piece of music
1661 as argument, and generate a @code{\skip} or multi-rest, exactly as
1662 long as the piece.  The use of @code{mmrest-of-length} is demonstrated
1663 in the following example.
1664
1665 @lilypond[verbatim,ragged-right,quote]
1666 cadenza = \relative c' {
1667   c4 d8 << { e f g } \\ { d4. } >>
1668   g4 f2 g4 g
1669 }
1670
1671 \new GrandStaff <<
1672   \new Staff { \cadenza c'4 }
1673   \new Staff {
1674     #(ly:export (mmrest-of-length cadenza))
1675     c'4
1676   }
1677 >>
1678 @end lilypond
1679
1680
1681
1682
1683 @node Contemporary notation
1684 @section Contemporary notation
1685
1686 In the 20th century, composers have greatly expanded the musical
1687 vocabulary.  With this expansion, many innovations in musical notation
1688 have been tried.  The book @q{Music Notation in the 20th century} by
1689 Kurt Stone gives a comprehensive overview (see @ref{Literature
1690 list}).
1691
1692 This section describes notation that does
1693 not fit into traditional notation categories, such as pitches,
1694 tuplet beams, and articulation.  For contemporary notation
1695 that fits into traditional notation categories, such as
1696 microtones, nested tuplet beams, and unusual fermatas, please
1697 see those sections of the documentation.
1698
1699 @menu
1700 * Polymetric notation::         
1701 * Time administration::         
1702 * Proportional notation::       
1703 * Clusters::                    
1704 * Special noteheads::           
1705 * Feathered beams::             
1706 * Improvisation::               
1707 * Selecting notation font size::  
1708 @end menu
1709
1710
1711 @node Polymetric notation
1712 @subsection Polymetric notation
1713
1714 @cindex double time signatures
1715 @cindex signatures, polymetric
1716 @cindex polymetric signatures
1717 @cindex meter, polymetric
1718
1719 Double time signatures are not supported explicitly, but they can be
1720 faked.  In the next example, the markup for the time signature is
1721 created with a markup text.  This markup text is inserted in the
1722 @internalsref{TimeSignature} grob. See also
1723 @inputfileref{input/@/test,compound@/-time@/.ly}).
1724
1725 @lilypond[verbatim,ragged-right]
1726 % create 2/4 + 5/8
1727 tsMarkup =\markup {
1728   \override #'(baseline-skip . 2) \number {
1729     \column { "2" "4" }
1730     \vcenter "+"
1731     \bracket \column { "5" "8" }
1732   }
1733 }
1734
1735 {
1736   \override Staff.TimeSignature #'stencil = #ly:text-interface::print
1737   \override Staff.TimeSignature #'text = #tsMarkup
1738   \time 3/2
1739   c'2 \bar ":" c'4 c'4.
1740 }
1741 @end lilypond
1742
1743 Each staff can also have its own time signature.  This is done by
1744 moving the @internalsref{Timing_translator} to the @internalsref{Staff}
1745 context.
1746
1747 @example
1748 \layout @{
1749   \context @{ \Score
1750      \remove "Timing_translator"
1751      \remove "Default_bar_line_engraver"
1752   @}
1753   \context @{
1754     \Staff
1755     \consists "Timing_translator"
1756     \consists "Default_bar_line_engraver"
1757   @}
1758
1759 @}
1760 @end example
1761
1762
1763 Now, each staff has its own time signature.
1764 @example
1765 <<
1766   \new Staff @{
1767     \time 3/4
1768     c4 c c | c c c |
1769   @}
1770   \new Staff @{
1771     \time 2/4
1772     c4 c | c c | c c
1773   @}
1774   \new Staff @{
1775     \time 3/8
1776     c4. c8 c c c4. c8 c c
1777   @}
1778 >>
1779 @end example
1780
1781 @lilypond[quote,ragged-right]
1782 \layout{
1783   \context{
1784      \Score
1785      \remove "Timing_translator"
1786      \remove "Default_bar_line_engraver"
1787     }
1788   \context{ \Staff
1789     \consists "Timing_translator"
1790     \consists "Default_bar_line_engraver"
1791   }
1792 }
1793
1794 \relative c' <<
1795   \new Staff {
1796     \time 3/4
1797     c4 c c | c c c |
1798   }
1799   \new Staff {
1800     \time 2/4
1801     c4 c | c c | c c
1802   }
1803   \new Staff {
1804     \time 3/8
1805     c4. c8 c c c4. c8 c c
1806   }
1807 >>
1808 @end lilypond
1809
1810
1811 A different form of polymetric notation is where note lengths have
1812 different values across staves.
1813
1814 This notation can be created by setting a common time signature for
1815 each staff but replacing it manually using
1816 @code{timeSignatureFraction} to the desired fraction.  Then the printed
1817 durations in each staff are scaled to the common time signature.
1818 The latter is done with @code{\compressMusic}, which is used similar
1819 to @code{\times}, but does not create a tuplet bracket. The syntax is
1820 @example
1821 \compressMusic #'(@var{numerator} . @var{denominator}) @var{musicexpr}
1822 @end example
1823
1824
1825
1826 In this example, music with the time signatures of 3/4, 9/8, and 10/8 are
1827 used in parallel.  In the second staff, shown durations are multiplied by
1828 2/3, so that 2/3 * 9/8 = 3/4, and in the third staff, shown durations are
1829 multiplied by 3/5, so that 3/5 * 10/8 = 3/4.
1830
1831 @lilypond[quote,ragged-right,verbatim,fragment]
1832 \relative c' { <<
1833   \new Staff {
1834     \time 3/4
1835     c4 c c | c c c |
1836   }
1837   \new Staff {
1838     \time 3/4
1839     \set Staff.timeSignatureFraction = #'(9 . 8)
1840     \compressMusic #'(2 . 3)
1841       \repeat unfold 6 { c8[ c c] }
1842   }
1843   \new Staff {
1844     \time 3/4
1845     \set Staff.timeSignatureFraction = #'(10 . 8)
1846     \compressMusic #'(3 . 5) {
1847       \repeat unfold 2 { c8[ c c] }
1848       \repeat unfold 2 { c8[ c] }
1849       | c4. c4. \times 2/3 { c8 c c } c4
1850     }
1851   }
1852 >> }
1853 @end lilypond
1854
1855
1856
1857
1858 @refbugs
1859
1860 When using different time signatures in parallel, the spacing is
1861 aligned vertically, but bar lines distort the regular spacing.
1862
1863
1864 @node Time administration
1865 @subsection Time administration
1866
1867 @cindex Time administration
1868
1869 Time is administered by the @internalsref{Time_signature_engraver},
1870 which usually lives in the @internalsref{Score} context.  The
1871 bookkeeping deals with the following variables
1872
1873 @table @code
1874 @item currentBarNumber
1875 The measure number.
1876
1877 @item measureLength
1878 The length of the measures in the current time signature.  For a 4/4
1879 time this is@tie{}1, and for 6/8 it is 3/4.
1880
1881 @item measurePosition
1882 The point within the measure where we currently are.  This quantity
1883 is reset to@tie{}0 whenever it exceeds @code{measureLength}.  When that
1884 happens, @code{currentBarNumber} is incremented.
1885
1886 @item timing
1887 If set to true, the above variables are updated for every time
1888 step.  When set to false, the engraver stays in the current measure
1889 indefinitely.
1890 @end table
1891
1892 Timing can be changed by setting any of these variables explicitly.
1893 In the next example, the 4/4 time signature is printed, but
1894 @code{measureLength} is set to 5/4.  After a while, the measure is
1895 shortened by 1/8, by setting @code{measurePosition} to 7/8 at 2/4
1896 in the measure, so the next bar line will fall at 2/4 + 3/8.  The
1897 3/8 arises because 5/4 normally has 10/8, but we have manually
1898 set the measure position to be 7/8 and 10/8 - 7/8 = 3/8.
1899
1900 @lilypond[quote,ragged-right,verbatim,relative,fragment]
1901 \set Score.measureLength = #(ly:make-moment 5 4)
1902 c1 c4
1903 c1 c4
1904 c4 c4
1905 \set Score.measurePosition = #(ly:make-moment 7 8)
1906 b8 b b
1907 c4 c1
1908 @end lilypond
1909
1910 @noindent
1911 As the example illustrates, @code{ly:make-moment n m} constructs a
1912 duration of n/m of a whole note.  For example, @code{ly:make-moment 1 8} is
1913 an eighth
1914 note duration and @code{ly:make-moment 7 16} is the duration of
1915 seven sixteenths notes.
1916
1917
1918 @node Proportional notation
1919 @subsection Proportional notation
1920 @cindex Proportional notation
1921
1922 Notes can be spaced proportionally to their time-difference by
1923 assigning a duration to @code{proportionalNotationDuration}
1924
1925 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
1926 <<
1927   \set Score.proportionalNotationDuration = #(ly:make-moment 1 16)
1928   \new Staff { c8[ c c c c c]  c4 c2 r2 }
1929   \new Staff { c2  \times 2/3 { c8 c c } c4 c1 }
1930 >>
1931 @end lilypond
1932
1933 Setting this property only affects the ideal spacing between
1934 consecutive notes.  For true proportional notation, the following
1935 settings are also required.
1936
1937 @itemize @bullet
1938
1939 @item True proportional notation requires that symbols are allowed to
1940 overstrike each other.  That is achieved by removing the
1941 @internalsref{Separating_line_group_engraver} from
1942 @internalsref{Staff} context.
1943
1944 @item Spacing influence of  prefatory matter (clefs, bar lines, etc.)
1945 is removed by setting the @code{strict-note-spacing} property to
1946 @code{#t} in @internalsref{SpacingSpanner} grob.
1947
1948 @item Optical spacing tweaks are switched by setting 
1949 @code{uniform-stretching} in @internalsref{SpacingSpanner} to true.
1950
1951
1952 @end itemize
1953
1954 @seealso
1955
1956 @inputfileref{input/@/regression,spacing-proportional/.ly}
1957 @inputfileref{input/@/regression,spacing-strict-notespacing/.ly}
1958 @inputfileref{input/@/regression,spacing-strict-spacing-grace/.ly}
1959
1960 An example of strict proportional notation is in the
1961 example file @file{input/proportional.ly}.
1962
1963
1964 @node Clusters
1965 @subsection Clusters
1966
1967 @cindex cluster
1968
1969 A cluster indicates a continuous range of pitches to be played.  They
1970 can be denoted as the envelope of a set of notes.  They are entered by
1971 applying the function @code{makeClusters} to a sequence of
1972 chords, e.g.,
1973 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1974 \makeClusters { <c e > <b f'> }
1975 @end lilypond
1976
1977 The following example (from
1978 @inputfileref{input/@/regression,cluster@/.ly}) shows what the result
1979 looks like
1980
1981 @lilypondfile[ragged-right,quote]{cluster.ly}
1982
1983 Ordinary notes and clusters can be put together in the same staff,
1984 even simultaneously.  In such a case no attempt is made to
1985 automatically avoid collisions between ordinary notes and clusters.
1986
1987 @seealso
1988
1989 Program reference: @internalsref{ClusterSpanner},
1990 @internalsref{ClusterSpannerBeacon},
1991 @internalsref{Cluster_spanner_engraver}.
1992
1993 Examples: @inputfileref{input/@/regression,cluster@/.ly}.
1994
1995 @refbugs
1996
1997 Music expressions like @code{<< @{ g8 e8 @} a4 >>} are not printed
1998 accurately.  Use @code{<g a>8 <e a>8} instead.
1999
2000
2001 @node Special noteheads
2002 @subsection Special noteheads
2003
2004 @cindex note heads, special
2005
2006 Different noteheads are used by various instruments for various
2007 meanings -- crosses are used for @q{parlato} with vocalists, stopped
2008 notes on guitar; diamonds are used for harmonics on string instruments,
2009 etc.  There is a shorthand (@code{\harmonic}) for diamond shapes; the
2010 other notehead styles are produced by tweaking the property
2011
2012 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
2013 c4 d
2014 \override NoteHead #'style = #'cross
2015 e f
2016 \revert NoteHead #'style
2017 e d <c f\harmonic> <d a'\harmonic>
2018 @end lilypond
2019
2020 @noindent
2021 To see all notehead styles, please see
2022 @inputfileref{input/@/regression,note@/-head@/-style@/.ly}.
2023
2024
2025 @seealso
2026
2027 Program reference: @internalsref{NoteHead}.
2028
2029
2030 @node Feathered beams
2031 @subsection Feathered beams
2032
2033 Feathered beams are printed by setting the @code{grow-direction}
2034 property of a @code{Beam}.  The @code{\featherDurations} function
2035 can be used to adjust note durations.
2036
2037 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
2038 \featherDurations #(ly:make-moment 5 4) 
2039 {
2040   \override Beam #'grow-direction = #LEFT
2041   c16[ c c c c c c]
2042 }
2043 @end lilypond
2044
2045 @refbugs
2046
2047 The @code{\featherDuration} command only works with very short
2048 music snippets.
2049
2050 @node Improvisation
2051 @subsection Improvisation
2052
2053 Improvisation is sometimes denoted with slashed note heads.  Such note
2054 heads can be created by adding a @internalsref{Pitch_squash_engraver}
2055 to the @internalsref{Staff} or @internalsref{Voice} context.  Then, the
2056 following command
2057
2058 @example
2059 \set squashedPosition = #0
2060 \override NoteHead #'style = #'slash
2061 @end example
2062
2063 @noindent
2064 switches on the slashes.
2065
2066 There are shortcuts @code{\improvisationOn} (and an accompanying
2067 @code{\improvisationOff}) for this command sequence.  They are used in
2068 the following example
2069
2070 @lilypond[verbatim,ragged-right,quote]
2071 \new Staff \with {
2072   \consists Pitch_squash_engraver
2073 } \transpose c c' {
2074   e8 e g a a16(bes)(a8) g \improvisationOn
2075   e8
2076   ~e2~e8 f4 fis8
2077   ~fis2 \improvisationOff a16(bes) a8 g e
2078 }
2079 @end lilypond
2080
2081
2082 @node Selecting notation font size
2083 @subsection Selecting notation font size
2084
2085 The easiest method of setting the font size of any context is by
2086 setting the @code{fontSize} property.
2087
2088 @lilypond[quote,fragment,relative=1,verbatim]
2089 c8
2090 \set fontSize = #-4
2091 c f
2092 \set fontSize = #3
2093 g
2094 @end lilypond
2095
2096 @noindent
2097 It does not change the size of variable symbols, such as beams or
2098 slurs.
2099
2100 Internally, the @code{fontSize} context property will cause the
2101 @code{font-size} property to be set in all layout objects.  The value
2102 of @code{font-size} is a number indicating the size relative to the
2103 standard size for the current staff height.  Each step up is an
2104 increase of approximately 12% of the font size.  Six steps is exactly a
2105 factor two.  The Scheme function @code{magstep} converts a
2106 @code{font-size} number to a scaling factor.
2107
2108 @lilypond[quote,fragment,relative=1,verbatim]
2109 c8
2110 \override NoteHead #'font-size = #-4
2111 c f
2112 \override NoteHead #'font-size = #3
2113 g
2114 @end lilypond
2115
2116 Font size changes are achieved by scaling the design size that is
2117 closest to the desired size.  The standard font size (for
2118 @code{font-size} equals 0), depends on the standard staff height.  For
2119 a 20pt staff, a 10pt font is selected.
2120
2121 The @code{font-size} property can only be set on layout objects that
2122 use fonts. These are the ones supporting the
2123 @internalsref{font-interface} layout interface.
2124
2125 @refcommands
2126
2127 The following commands set @code{fontSize} for the current voice:
2128
2129 @funindex \tiny
2130 @code{\tiny},
2131 @funindex \small
2132 @code{\small},
2133 @funindex \normalsize
2134 @code{\normalsize}.
2135
2136
2137
2138 @node Educational use
2139 @section Educational use
2140
2141 With the amount of control that LilyPond offers, one can make great
2142 teaching tools in addition to great musical scores.
2143
2144 @menu
2145 * Balloon help::                
2146 * Blank music sheet::           
2147 * Hidden notes::                
2148 * Shape note heads::            
2149 * Easy Notation note heads::    
2150 * Analysis brackets::           
2151 * Coloring objects::            
2152 * Parentheses::                 
2153 * Grid lines::                  
2154 @end menu
2155
2156 @node Balloon help
2157 @subsection Balloon help
2158
2159 Elements of notation can be marked and named with the help of a square
2160 balloon.  The primary purpose of this feature is to explain notation.
2161
2162 The following example demonstrates its use.
2163
2164 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
2165 \new Voice \with { \consists "Balloon_engraver" }
2166 {
2167   \balloonGrobText #'Stem #'(3 . 4) \markup { "I'm a Stem" }
2168   <c-\balloonText #'(-2 . -2) \markup { Hello }  >8
2169 }
2170 @end lilypond
2171
2172 @noindent
2173 There are two music functions, @code{balloonText} and
2174 @code{balloonGrobText}. The latter takes the name of the grob to
2175 adorn, while the former may be used as an articulation on a note. 
2176 The other arguments  are the offset and the text of the label.
2177
2178 @cindex balloon
2179 @cindex notation, explaining
2180
2181 @seealso
2182
2183 Program reference: @internalsref{text-balloon-interface}.
2184
2185 Examples: @inputfileref{input/@/regression,balloon@/.ly}.
2186
2187
2188
2189
2190 @node Blank music sheet
2191 @subsection Blank music sheet
2192
2193 @cindex Sheet music, empty
2194 @cindex Staves, blank sheet
2195
2196 A blank music sheet can be produced also by using invisible notes, and
2197 removing @code{Bar_number_engraver}.
2198
2199
2200 @lilypond[quote,verbatim]
2201 \layout{ indent = #0 }
2202 emptymusic = {
2203   \repeat unfold 2 % Change this for more lines.
2204   { s1\break }
2205   \bar "|."
2206 }
2207 \new Score \with {
2208   \override TimeSignature #'transparent = ##t
2209 % un-comment this line if desired
2210 %  \override Clef #'transparent = ##t
2211   defaultBarType = #""
2212   \remove Bar_number_engraver
2213 } <<
2214
2215 % modify these to get the staves you want
2216   \new Staff \emptymusic
2217   \new TabStaff \emptymusic
2218 >>
2219 @end lilypond
2220
2221
2222 @node Hidden notes
2223 @subsection Hidden notes
2224
2225 @cindex Hidden notes
2226 @cindex Invisible notes
2227 @cindex Transparent notes
2228
2229 @funindex \hideNotes
2230 @funindex \unHideNotes
2231 Hidden (or invisible or transparent) notes can be useful in preparing theory
2232 or composition exercises.
2233
2234 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
2235 c4 d4
2236 \hideNotes
2237 e4 f4
2238 \unHideNotes
2239 g4 a
2240 @end lilypond
2241
2242
2243 @node Shape note heads
2244 @subsection Shape note heads
2245
2246 @cindex note heads, shape
2247
2248 In shape note head notation, the shape of the note head corresponds
2249 to the harmonic function of a note in the scale.  This notation was
2250 popular in the 19th century American song books.
2251
2252 Shape note heads can be produced by setting @code{\aikenHeads} or
2253 @code{\sacredHarpHeads}, depending on the style desired.
2254
2255 @lilypond[verbatim,relative=1,fragment]
2256   \aikenHeads
2257   c8 d4 e8 a2 g1
2258   \sacredHarpHeads
2259   c8 d4. e8 a2 g1
2260 @end lilypond
2261
2262 Shapes are determined on the step in the scale, where the base of the
2263 scale is determined by  the @code{\key} command
2264
2265 @funindex \key
2266 @funindex shapeNoteStyles
2267 @funindex \aikenHeads
2268 @funindex \sacredHarpHeads
2269
2270 Shape note heads are implemented through the @code{shapeNoteStyles}
2271 property.  Its value is a vector of symbols.  The k-th element indicates
2272 the style to use for the k-th step of the scale.  Arbitrary
2273 combinations are possible, e.g.
2274
2275 @lilypond[verbatim,relative=1,fragment]
2276   \set shapeNoteStyles  = ##(cross triangle fa #f mensural xcircle diamond)
2277   c8 d4. e8 a2 g1
2278 @end lilypond
2279
2280
2281 @node Easy Notation note heads
2282 @subsection Easy Notation note heads
2283
2284 @cindex note heads, practice
2285 @cindex note heads, easy notation
2286 @cindex easy notation
2287 @cindex Hal Leonard
2288
2289 The @q{easy play} note head includes a note name inside the head.  It is
2290 used in music for beginners
2291
2292 @lilypond[quote,ragged-right,verbatim,fragment,staffsize=26]
2293   \setEasyHeads
2294   c'2 e'4 f' | g'1
2295 @end lilypond
2296
2297 The command @code{\setEasyHeads} overrides settings for the
2298 @internalsref{NoteHead} object.  To make the letters readable, it has
2299 to be printed in a large font size.  To print with a larger font, see
2300 @ref{Setting the staff size}.
2301
2302 @refcommands
2303
2304 @funindex \setEasyHeads
2305 @code{\setEasyHeads}
2306
2307
2308 @node Analysis brackets
2309 @subsection Analysis brackets
2310 @cindex brackets
2311 @cindex phrasing brackets
2312 @cindex musicological analysis
2313 @cindex note grouping bracket
2314
2315 Brackets are used in musical analysis to indicate structure in musical
2316 pieces.  LilyPond supports a simple form of nested horizontal
2317 brackets.  To use this, add the @internalsref{Horizontal_bracket_engraver}
2318 to @internalsref{Staff} context.  A bracket is started with
2319 @code{\startGroup} and closed with @code{\stopGroup}
2320
2321 @lilypond[quote,ragged-right,verbatim]
2322 \score {
2323   \relative c'' {
2324     c4\startGroup\startGroup
2325     c4\stopGroup
2326     c4\startGroup
2327     c4\stopGroup\stopGroup
2328   }
2329   \layout {
2330     \context {
2331       \Staff \consists "Horizontal_bracket_engraver"
2332 }}}
2333 @end lilypond
2334
2335 @seealso
2336
2337 Program reference: @internalsref{HorizontalBracket}.
2338
2339 Examples: @inputfileref{input/@/regression,note@/-group@/-bracket@/.ly}.
2340
2341
2342 @node Coloring objects
2343 @subsection Coloring objects
2344
2345 Individual objects may be assigned colors.  You may use the
2346 color names listed in the @ref{List of colors}.
2347
2348 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
2349 \override NoteHead #'color = #red
2350 c4 c
2351 \override NoteHead #'color = #(x11-color 'LimeGreen)
2352 d
2353 \override Stem #'color = #blue
2354 e
2355 @end lilypond
2356
2357 The full range of colors defined for X11 can be accessed by using the
2358 Scheme function x11-color.  The function takes one argument that can be a
2359 symbol
2360
2361 @example
2362 \override Beam #'color = #(x11-color 'MediumTurquoise)
2363 @end example
2364
2365 or a string
2366
2367 @example
2368 \override Beam #'color = #(x11-color "MediumTurquoise")
2369 @end example
2370
2371 The first form is quicker to write and is more efficient.  However, using
2372 the second form it is possible to access X11 colors by the multi-word
2373 form of its name
2374
2375 @example
2376 \override Beam #'color = #(x11-color "medium turquoise")
2377 @end example
2378
2379 If x11-color cannot make sense of the parameter then the color returned
2380 defaults to black.  It should be obvious from the final score that
2381 something is wrong.
2382
2383 This example illustrates the use of x11-color.  Notice that the stem
2384 color remains black after being set to (x11-color 'Boggle), which is
2385 deliberate nonsense.
2386
2387 @lilypond[quote,ragged-right,verbatim]
2388 {
2389   \override Staff.StaffSymbol #'color = #(x11-color 'SlateBlue2)
2390   \set Staff.instrumentName = \markup {
2391     \with-color #(x11-color 'navy) "Clarinet"
2392   }
2393   \time 2/4
2394   gis''8 a''
2395   \override Beam #'color = #(x11-color "medium turquoise")
2396   gis'' a''
2397   \override NoteHead #'color = #(x11-color "LimeGreen")
2398   gis'' a''
2399   \override Stem #'color = #(x11-color 'Boggle)
2400   gis'' a''
2401 }
2402 @end lilypond
2403
2404
2405 @seealso
2406
2407 Appendix: @ref{List of colors}.
2408
2409
2410 @refbugs
2411 Not all x11 colors are distinguishable in a web browser.  For web use
2412 normal colors are recommended.
2413
2414 An x11 color is not necessarily exactly the same shade as a similarly
2415 named normal color.
2416
2417 Notes in a chord cannot be colored with @code{\override}; use
2418 @code{\tweak} instead.  See @ref{Objects connected to the input}
2419 for details.
2420
2421
2422 @node Parentheses
2423 @subsection Parentheses
2424
2425 @cindex ghost notes
2426 @cindex notes, ghost
2427 @cindex notes, parenthesized
2428
2429 Objects may be parenthesized by prefixing @code{\parenthesize} to the music
2430 event,
2431
2432 @lilypond[relative=2,fragment,verbatim,ragged-right]
2433 <
2434   c
2435   \parenthesize d
2436   g
2437 >4-\parenthesize -.
2438 @end lilypond
2439
2440 This only functions inside chords, even for single notes
2441
2442 @example
2443 < \parenthesize NOTE>
2444 @end example
2445
2446
2447 @node Grid lines
2448 @subsection Grid lines
2449
2450 Vertical lines can be drawn between staves synchronized with
2451 the notes.
2452
2453 Examples: @inputfileref{input/@/regression,grid@/-lines@/.ly}.
2454