Doc -- clarification to parenthesize by Jon Kulp, based on James Bailey.
[lilypond/mpolesky.git] / Documentation / user / editorial.itely
blob556db2dc66bfefb0509d60192719ad8d3560e048
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @ignore
3     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
5     When revising a translation, copy the HEAD committish of the
6     version that you are working on.  See TRANSLATION for details.
7 @end ignore
9 @c \version "2.12.0"
11 @node Editorial annotations
12 @section Editorial annotations
14 @lilypondfile[quote]{editorial-headword.ly}
16 This section discusses the various ways to change the appearance of
17 notes and add analysis or educational emphasis.
19 @menu
20 * Inside the staff::
21 * Outside the staff::
22 @end menu
25 @node Inside the staff
26 @subsection Inside the staff
28 This section discusses how to add emphasis to elements that are
29 inside the staff.
31 @menu
32 * Selecting notation font size::
33 * Fingering instructions::
34 * Hidden notes::
35 * Coloring objects::
36 * Parentheses::
37 * Stems::
38 @end menu
40 @node Selecting notation font size
41 @unnumberedsubsubsec Selecting notation font size
43 @cindex font size (notation) scaling
44 @cindex font size (notation)
45 @cindex selecting font size (notation)
46 @cindex notation font size
47 @cindex note heads
49 @funindex fontSize
50 @funindex font-size
51 @funindex magstep
52 @funindex \huge
53 @funindex \large
54 @funindex \normalsize
55 @funindex \small
56 @funindex \tiny
57 @funindex \teeny
58 @funindex huge
59 @funindex large
60 @funindex normalsize
61 @funindex small
62 @funindex tiny
63 @funindex teeny
65 The font size of notation elements may be altered.  It does not
66 change the size of variable symbols, such as beams or slurs.
68 @warning{For font sizes of text, see
69 @ref{Selecting font and font size}.}
71 @lilypond[verbatim,quote,relative=2]
72 \huge
73 c4.-> d8---3
74 \large
75 c4.-> d8---3
76 \normalsize
77 c4.-> d8---3
78 \small
79 c4.-> d8---3
80 \tiny
81 c4.-> d8---3
82 \teeny
83 c4.-> d8---3
84 @end lilypond
86 Internally, this sets the @code{fontSize} property.  This in turn
87 causes the @code{font-size} property to be set in all layout
88 objects.  The value of @code{font-size} is a number indicating the
89 size relative to the standard size for the current staff height.
90 Each step up is an increase of approximately 12% of the font size.
91 Six steps is exactly a factor of two.  The Scheme function
92 @code{magstep} converts a @code{font-size} number to a scaling
93 factor.  The @code{font-size} property can also be set directly,
94 so that only certain layout objects are affected.
96 @lilypond[verbatim,quote,relative=2]
97 \set fontSize = #3
98 c4.-> d8---3
99 \override NoteHead #'font-size = #-4
100 c4.-> d8---3
101 \override Script #'font-size = #2
102 c4.-> d8---3
103 \override Stem #'font-size = #-5
104 c4.-> d8---3
105 @end lilypond
107 @cindex standard font size (notation)
108 @cindex font size (notation), standard
110 @funindex font-interface
111 @funindex font-size
113 Font size changes are achieved by scaling the design size that is
114 closest to the desired size.  The standard font size (for
115 @w{@code{font-size = #0}}) depends on the standard staff height.
116 For a 20pt staff, a 10pt font is selected.
118 The @code{font-size} property can only be set on layout objects
119 that use fonts.  These are the ones supporting the
120 @code{font-interface} layout interface.
123 @predefined
124 @code{\teeny},
125 @code{\tiny},
126 @code{\small},
127 @code{\normalsize},
128 @code{\large},
129 @code{\huge}.
130 @endpredefined
133 @seealso
134 Snippets:
135 @rlsr{Editorial annotations}.
137 Internals Reference:
138 @rinternals{font-interface}.
141 @node Fingering instructions
142 @unnumberedsubsubsec Fingering instructions
144 @cindex fingering
145 @cindex finger change
147 @funindex \finger
148 @funindex finger
150 Fingering instructions can be entered using
151 @var{note}-@var{digit}:
153 @lilypond[verbatim,quote,relative=2]
154 c4-1 d-2 f-4 e-3
155 @end lilypond
157 Markup texts may be used for finger changes.
159 @lilypond[verbatim,quote,relative=2]
160 c4-1 d-2 f-4 c^\markup { \finger "2 - 3" }
161 @end lilypond
163 @cindex thumb-script
165 @funindex \thumb
166 @funindex thumb
168 A thumb-script can be added (e.g., in cello music) to indicate
169 that a note should be played with the thumb.
171 @lilypond[verbatim,quote,relative=2]
172 <a_\thumb a'-3>2 <b_\thumb b'-3>
173 @end lilypond
175 @cindex fingering chords
176 @cindex fingering instructions for chords
177 @cindex chords, fingering
179 Fingerings for chords can also be added to individual notes of the
180 chord by adding them after the pitches.
182 @lilypond[verbatim,quote,relative=2]
183 <c-1 e-2 g-3 b-5>2 <d-1 f-2 a-3 c-5>
184 @end lilypond
186 Fingering instructions may be manually placed above or below the
187 staff, see @ref{Direction and placement}.
189 @snippets
191 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
192 {controlling-the-placement-of-chord-fingerings.ly}
194 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
195 {allowing-fingerings-to-be-printed-inside-the-staff.ly}
197 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
198 {avoiding-collisions-with-chord-fingerings.ly}
201 @seealso
202 Notation Reference:
203 @ref{Direction and placement}
205 Snippets:
206 @rlsr{Editorial annotations}.
208 Internals Reference:
209 @rinternals{FingeringEvent},
210 @rinternals{fingering-event},
211 @rinternals{Fingering_engraver},
212 @rinternals{New_fingering_engraver},
213 @rinternals{Fingering}.
216 @node Hidden notes
217 @unnumberedsubsubsec Hidden notes
219 @cindex hidden notes
220 @cindex invisible notes
221 @cindex transparent notes
222 @cindex notes, hidden
223 @cindex notes, invisible
224 @cindex notes, transparent
226 @funindex \hideNotes
227 @funindex hideNotes
228 @funindex \unHideNotes
229 @funindex unHideNotes
231 Hidden (or invisible or transparent) notes can be useful in
232 preparing theory or composition exercises.
234 @lilypond[verbatim,quote,relative=2]
235 c4 d
236 \hideNotes
237 e4 f
238 \unHideNotes
239 g a
240 \hideNotes
242 \unHideNotes
244 @end lilypond
246 Notation objects which are attached to invisible notes are still
247 visible.
249 @lilypond[verbatim,quote,relative=2]
250 c4( d)
251 \hideNotes
252 e4(\p f)--
253 @end lilypond
256 @predefined
257 @code{\hideNotes},
258 @code{\unHideNotes}.
259 @endpredefined
262 @seealso
263 Snippets:
264 @rlsr{Editorial annotations}.
266 Internals Reference:
267 @rinternals{Note_spacing_engraver},
268 @rinternals{NoteSpacing}.
271 @node Coloring objects
272 @unnumberedsubsubsec Coloring objects
274 @cindex colored objects
275 @cindex objects, colored
276 @cindex colors
277 @cindex coloring objects
278 @cindex colored notes
279 @cindex coloring notes
280 @cindex notes, colored
281 @cindex x11 color
282 @cindex x11-color
283 @cindex with-color
285 @funindex color
286 @funindex \with-color
287 @funindex with-color
288 @funindex x11-color
290 Individual objects may be assigned colors.  Valid color names
291 are listed in the @ref{List of colors}.
293 @lilypond[verbatim,quote,relative=2]
294 \override NoteHead #'color = #red
295 c4 c
296 \override NoteHead #'color = #(x11-color 'LimeGreen)
298 \override Stem #'color = #blue
300 @end lilypond
303 The full range of colors defined for X11 can be accessed by using
304 the Scheme function @code{x11-color}.  The function takes one
305 argument; this can be a symbol in the form @var{'FooBar} or a
306 string in the form @var{"FooBar"}.  The first form is quicker to
307 write and is more efficient.  However, using the second form it is
308 possible to access X11 colors by the multi-word form of its name.
310 If @code{x11-color} cannot make sense of the parameter then the
311 color returned defaults to black.
313 @lilypond[verbatim,quote,relative=2]
314 \override Staff.StaffSymbol #'color = #(x11-color 'SlateBlue2)
315 \set Staff.instrumentName = \markup {
316   \with-color #(x11-color 'navy) "Clarinet"
319 gis8 a
320 \override Beam #'color = #(x11-color "medium turquoise")
321 gis a
322 \override Accidental #'color = #(x11-color 'DarkRed)
323 gis a
324 \override NoteHead #'color = #(x11-color "LimeGreen")
325 gis a
326 % this is deliberate nonsense; note that the stems remain black
327 \override Stem #'color = #(x11-color 'Boggle)
328 b2 cis
329 @end lilypond
331 @cindex rgb-color
332 @cindex color, rgb
333 @cindex rgb color
335 @funindex rgb-color
337 Exact RGB colors can be specified using the Scheme function
338 @code{rgb-color}.
340 @lilypond[verbatim,quote,relative=2]
341 \override Staff.StaffSymbol #'color = #(x11-color 'SlateBlue2)
342 \set Staff.instrumentName = \markup {
343   \with-color #(x11-color 'navy) "Clarinet"
346 \override Stem #'color = #(rgb-color 0 0 0)
347 gis8 a
348 \override Stem #'color = #(rgb-color 1 1 1)
349 gis8 a
350 \override Stem #'color = #(rgb-color 0 0 0.5)
351 gis4 a
352 @end lilypond
355 @seealso
356 Notation Reference:
357 @ref{List of colors}, @ref{The
358 tweak command}.
360 Snippets:
361 @rlsr{Editorial annotations}.
364 @cindex x11 color
365 @cindex colored notes in chords
366 @cindex notes, colored in chords
367 @cindex color in chords
369 @funindex x11-color
371 @knownissues
372 An X11 color is not necessarily exactly the same shade as a
373 similarly named normal color.
375 Not all X11 colors are distinguishable in a web browser, i.e.,
376 a web browser might not display a difference between @code{'LimeGreen}
377 and @code{'ForestGreen}.  For web use normal colors are recommended
378 (i.e., @code{#blue}, @code{#green}, @code{#red}).
381 Notes in a chord cannot be colored with @code{\override}; use
382 @code{\tweak} instead, see @ref{The tweak command}.
385 @node Parentheses
386 @unnumberedsubsubsec Parentheses
388 @cindex ghost notes
389 @cindex notes, ghost
390 @cindex notes, parenthesized
391 @cindex parentheses
393 @funindex \parenthesize
394 @funindex parenthesize
396 Objects may be parenthesized by prefixing @code{\parenthesize} to
397 the music event.  When prefixed to a chord, it parenthesizes every
398 note.  Individual notes inside a chord may also be parenthesized.
400 @lilypond[verbatim,quote,relative=2]
401 c2 \parenthesize d
402 c2 \parenthesize <c e g>
403 c2 <c \parenthesize e g>
404 @end lilypond
406 Non-note objects may be parenthesized as well. For articulations, 
407 a hyphen is needed before the @code{\parenthesize} command.
409 @lilypond[verbatim,quote,relative=2]
410 c2-\parenthesize -. d
411 c2 \parenthesize r
412 @end lilypond
415 @seealso
416 Snippets:
417 @rlsr{Editorial annotations}.
419 Internals Reference:
420 @rinternals{Parenthesis_engraver},
421 @rinternals{ParenthesesItem},
422 @rinternals{parentheses-interface}.
425 @knownissues
427 Parenthesizing a chord prints parentheses around each individual
428 note, instead of a single large parenthesis around the entire
429 chord.
432 @node Stems
433 @unnumberedsubsubsec Stems
435 @cindex stem
436 @cindex stem, invisible
437 @cindex invisible stem
439 @funindex \stemUp
440 @funindex stemUp
441 @funindex \stemDown
442 @funindex stemDown
443 @funindex \stemNeutral
444 @funindex stemNeutral
445 @cindex stem, direction
446 @cindex stem, up
447 @cindex stem, down
448 @cindex stem, neutral
450 Whenever a note is found, a @code{Stem} object is created
451 automatically.  For whole notes and rests, they are also created but
452 made invisible.
455 @predefined
456 @code{\stemUp},
457 @code{\stemDown},
458 @code{\stemNeutral}.
459 @endpredefined
462 @snippets
464 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
465 {default-direction-of-stems-on-the-center-line-of-the-staff.ly}
468 @seealso
469 Notation Reference:
470 @ref{Direction and placement}.
472 Snippets:
473 @rlsr{Editorial annotations}.
475 Internals Reference:
476 @rinternals{Stem_engraver},
477 @rinternals{Stem},
478 @rinternals{stem-interface}.
481 @node Outside the staff
482 @subsection Outside the staff
484 This section discusses how to add emphasis to elements in the staff
485 from outside of the staff.
487 @menu
488 * Balloon help::
489 * Grid lines::
490 * Analysis brackets::
491 @end menu
493 @node Balloon help
494 @unnumberedsubsubsec Balloon help
496 @cindex balloon
497 @cindex notation, explaining
498 @cindex balloon help
499 @cindex help, balloon
501 @funindex \balloonGrobText
502 @funindex \balloonText
503 @funindex Balloon_engraver
504 @funindex balloonGrobText
505 @funindex balloonText
506 @funindex \balloonLengthOn
507 @funindex balloonLengthOn
508 @funindex \balloonLengthOff
509 @funindex balloonLengthOff
511 Elements of notation can be marked and named with the help of a
512 square balloon.  The primary purpose of this feature is to explain
513 notation.
515 @lilypond[verbatim,quote,relative=2]
516 \new Voice \with { \consists "Balloon_engraver" }
518   \balloonGrobText #'Stem #'(3 . 4) \markup { "I'm a Stem" }
519   a8
520   \balloonGrobText #'Rest #'(-4 . -4) \markup { "I'm a rest" }
521   r
522   <c, g'-\balloonText #'(-2 . -2) \markup { "I'm a note head" } c>2.
524 @end lilypond
527 There are two music functions, @code{balloonGrobText} and
528 @code{balloonText};  the former is used like
529 @w{@code{\once \override}} to attach text to any grob, and the
530 latter is used like @code{\tweak}, typically within chords, to
531 attach text to an individual note.
533 Balloon text normally influences note spacing, but this can be
534 altered:
536 @lilypond[verbatim,quote,relative=2]
537 \new Voice \with { \consists "Balloon_engraver" }
539   \balloonLengthOff
540   \balloonGrobText #'Stem #'(3 . 4) \markup { "I'm a Stem" }
541   a8
542   \balloonGrobText #'Rest #'(-4 . -4) \markup { "I'm a rest" }
543   r
544   \balloonLengthOn
545   <c, g'-\balloonText #'(-2 . -2) \markup { "I'm a note head" } c>2.
547 @end lilypond
550 @predefined
551 @code{\balloonLengthOn},
552 @code{\balloonLengthOff}.
553 @endpredefined
556 @seealso
557 Snippets:
558 @rlsr{Editorial annotations}.
560 Internals Reference:
561 @rinternals{Balloon_engraver},
562 @rinternals{BalloonTextItem},
563 @rinternals{balloon-interface}.
566 @node Grid lines
567 @unnumberedsubsubsec Grid lines
569 @cindex grid lines
570 @cindex lines, grid
571 @cindex vertical lines between staves
572 @cindex lines, vertical between staves
574 @funindex Grid_point_engraver
575 @funindex Grid_line_span_engraver
576 @funindex gridInterval
578 Vertical lines can be drawn between staves synchronized with the
579 notes.
581 The @code{Grid_point_engraver} must be used to create the end
582 points of the lines, while the @code{Grid_line_span_engraver} must
583 be used to actually draw the lines.  By default this centers grid
584 lines horizontally below and to the left side of each note head.
585 Grid lines extend from the middle lines of each staff.  The
586 @code{gridInterval} must specify the duration between the grid
587 lines.
589 @lilypond[verbatim,quote]
590 \layout {
591   \context {
592     \Staff
593     \consists "Grid_point_engraver"
594     gridInterval = #(ly:make-moment 1 4)
595   }
596   \context {
597     \Score
598     \consists "Grid_line_span_engraver"
599   }
602 \score {
603   \new ChoirStaff <<
604     \new Staff \relative c'' {
605       \stemUp
606       c4. d8 e8 f g4
607     }
608     \new Staff \relative c {
609       \clef bass
610       \stemDown
611       c4 g' f e
612     }
613   >>
615 @end lilypond
617 @snippets
619 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
620 {grid-lines--changing-their-appearance.ly}
623 @seealso
624 Snippets:
625 @rlsr{Editorial annotations}.
627 Internals Reference:
628 @rinternals{Grid_line_span_engraver},
629 @rinternals{Grid_point_engraver},
630 @rinternals{GridLine},
631 @rinternals{GridPoint},
632 @rinternals{grid-line-interface},
633 @rinternals{grid-point-interface}.
636 @node Analysis brackets
637 @unnumberedsubsubsec Analysis brackets
639 @cindex brackets
640 @cindex bracket, phrasing
641 @cindex phrasing bracket
642 @cindex musicological analysis
643 @cindex analysis, musicological
644 @cindex note grouping bracket
645 @cindex horizontal bracket
646 @cindex bracket, horizontal
648 @funindex Horizontal_bracket_engraver
649 @funindex \startGroup
650 @funindex startGroup
651 @funindex \stopGroup
652 @funindex stopGroup
654 Brackets are used in musical analysis to indicate structure in musical
655 pieces.  Simple horizontal brackets are supported.
657 @lilypond[verbatim,quote]
658 \layout {
659   \context {
660     \Voice
661     \consists "Horizontal_bracket_engraver"
662   }
664 \relative c'' {
665   c2\startGroup
666   d\stopGroup
668 @end lilypond
670 Analysis brackets may be nested.
672 @lilypond[verbatim,quote]
673 \layout {
674   \context {
675     \Voice
676     \consists "Horizontal_bracket_engraver"
677   }
679 \relative c'' {
680   c4\startGroup\startGroup
681   d4\stopGroup
682   e4\startGroup
683   d4\stopGroup\stopGroup
685 @end lilypond
688 @seealso
689 Snippets:
690 @rlsr{Editorial annotations}.
692 Internals Reference:
693 @rinternals{Horizontal_bracket_engraver},
694 @rinternals{HorizontalBracket},
695 @rinternals{horizontal-bracket-interface},
696 @rinternals{Staff}.