Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(372)

Delta Between Two Patch Sets: Documentation/learning/tweaks.itely

Issue 6742057: Doc: NR 5.3 Add \single command Base URL: http://git.savannah.gnu.org/gitweb/?p=lilypond.git/trunk/
Left Patch Set: Rebased patch with additions from David Created 12 years, 3 months ago
Right Patch Set: Rebase and merging (manually) changes made since the last time this patch was rebased Created 9 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Documentation/learning/fundamental.itely ('k') | Documentation/notation/changing-defaults.itely » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 @c -*- coding: utf-8; mode: texinfo; -*- 1 @c -*- coding: utf-8; mode: texinfo; -*-
2 2
3 @ignore 3 @ignore
4 Translation of GIT committish: FILL-IN-HEAD-COMMITTISH 4 Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
5 5
6 When revising a translation, copy the HEAD committish of the 6 When revising a translation, copy the HEAD committish of the
7 version that you are working on. For details, see the Contributors' 7 version that you are working on. For details, see the Contributors'
8 Guide, node Updating translation committishes.. 8 Guide, node Updating translation committishes..
9 @end ignore 9 @end ignore
10 10
11 @c \version "2.17.6" 11 @c \version "2.19.22"
12 12
13 @node Tweaking output 13 @node Tweaking output
14 @chapter Tweaking output 14 @chapter Tweaking output
15 15
16 This chapter discusses how to modify output. LilyPond is extremely 16 This chapter discusses how to modify output. LilyPond is extremely
17 configurable; virtually every fragment of output may be changed. 17 configurable; virtually every fragment of output may be changed.
18 18
19 19
20 @menu 20 @menu
21 * Tweaking basics:: 21 * Tweaking basics::
22 * The Internals Reference manual:: 22 * The Internals Reference manual::
23 * Appearance of objects:: 23 * Appearance of objects::
24 * Placement of objects:: 24 * Placement of objects::
25 * Vertical spacing::
25 * Collisions of objects:: 26 * Collisions of objects::
26 * Further tweaking:: 27 * Further tweaking::
27 @end menu 28 @end menu
28 29
29 @node Tweaking basics 30 @node Tweaking basics
30 @section Tweaking basics 31 @section Tweaking basics
31 32
32 @menu 33 @menu
33 * Introduction to tweaks:: 34 * Introduction to tweaks::
34 * Objects and interfaces:: 35 * Objects and interfaces::
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 are still objects in the generic sense above, and so they too all have 99 are still objects in the generic sense above, and so they too all have
99 properties associated with them, such as their position, size, color, 100 properties associated with them, such as their position, size, color,
100 etc. 101 etc.
101 102
102 Some layout objects are still more specialized. Phrasing slurs, 103 Some layout objects are still more specialized. Phrasing slurs,
103 crescendo hairpins, ottava marks, and many other grobs are not 104 crescendo hairpins, ottava marks, and many other grobs are not
104 localized in a single place -- they have a starting point, an 105 localized in a single place -- they have a starting point, an
105 ending point, and maybe other properties concerned with their 106 ending point, and maybe other properties concerned with their
106 shape. Objects with an extended shape like these are called 107 shape. Objects with an extended shape like these are called
107 @q{Spanners}. 108 @q{Spanners}.
109
110 What is more, there are @q{abstract} grobs which do not print
111 anything of their own, but rather collect, position and manage
112 other grobs. Common examples for this are
113 @code{DynamicLineSpanner}, @code{BreakAlignment},
114 @code{NoteColumn}, @code{VerticalAxisGroup},
115 @code{NonMusicalPaperColumn} and similar. We will see how some of
116 these are used later.
108 117
109 It remains to explain what @q{Interfaces} are. Many objects, even 118 It remains to explain what @q{Interfaces} are. Many objects, even
110 though they are quite different, share common features which need to 119 though they are quite different, share common features which need to
111 be processed in the same way. For example, all grobs have a color, a 120 be processed in the same way. For example, all grobs have a color, a
112 size, a position, etc, and all these properties are processed in the 121 size, a position, etc, and all these properties are processed in the
113 same way during LilyPond's interpretation of the input file. To 122 same way during LilyPond's interpretation of the input file. To
114 simplify these internal operations these common actions and properties 123 simplify these internal operations these common actions and properties
115 are grouped together in an object called a @code{grob-interface}. 124 are grouped together in an object called a @code{grob-interface}.
116 There are many other groupings of common properties like this, each 125 There are many other groupings of common properties like this, each
117 one given a name ending in @code{interface}. In total there are over 126 one given a name ending in @code{interface}. In total there are over
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 modified by different commands, so it is useful to be able to recognize 175 modified by different commands, so it is useful to be able to recognize
167 the types of objects and properties from their names. 176 the types of objects and properties from their names.
168 177
169 178
170 @node Tweaking methods 179 @node Tweaking methods
171 @subsection Tweaking methods 180 @subsection Tweaking methods
172 181
173 @cindex tweaking methods 182 @cindex tweaking methods
174 183
175 @menu 184 @menu
176 * The \override command:: 185 * The override command::
177 * The \revert command:: 186 * The revert command::
178 * The \once prefix:: 187 * The once prefix::
179 * The \overrideProperty command:: 188 * The overrideProperty command::
180 * The \tweak command:: 189 * The tweak command::
190 * The single prefix::
181 @end menu 191 @end menu
182 192
183 @node The \override command 193 @node The override command
184 @unnumberedsubsubsec The @code{\override} command 194 @unnumberedsubsubsec The @code{@bs{}override} command
185 195
186 @cindex override command 196 @cindex override command
187 @cindex override syntax 197 @cindex override syntax
188 198
189 @funindex \override 199 @funindex \override
190 @funindex override 200 @funindex override
191 201
192 We have already met the commands @code{\set} and @code{\with}, used to 202 We have already met the commands @code{\set} and @code{\with}, used to
193 change the properties of @strong{contexts} and to remove and add 203 change the properties of @strong{contexts} and to remove and add
194 @strong{engravers}, in @ref{Modifying context properties}, and 204 @strong{engravers}, in @ref{Modifying context properties}, and
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 Scheme mode, see @rextend{LilyPond Scheme syntax}. 246 Scheme mode, see @rextend{LilyPond Scheme syntax}.
237 247
238 @code{\override} is the most common command used in tweaking, and 248 @code{\override} is the most common command used in tweaking, and
239 most of the rest of this chapter will be directed to presenting 249 most of the rest of this chapter will be directed to presenting
240 examples of how it is used. Here is a simple example to change the 250 examples of how it is used. Here is a simple example to change the
241 color of the note head: 251 color of the note head:
242 252
243 @cindex color property, example 253 @cindex color property, example
244 @cindex NoteHead, example of overriding 254 @cindex NoteHead, example of overriding
245 255
246 @lilypond[quote,fragment,ragged-right,verbatim,relative=1] 256 @lilypond[quote,ragged-right,verbatim]
247 c4 d 257 \relative {
248 \override NoteHead.color = #red 258 c'4 d
249 e4 f | 259 \override NoteHead.color = #red
250 \override NoteHead.color = #green 260 e4 f |
251 g4 a b c | 261 \override NoteHead.color = #green
252 @end lilypond 262 g4 a b c |
253 263 }
254 264 @end lilypond
255 @node The \revert command 265
256 @unnumberedsubsubsec The @code{\revert} command 266
267 @node The revert command
268 @unnumberedsubsubsec The @code{@bs{}revert} command
257 269
258 @cindex revert command 270 @cindex revert command
259 271
260 @funindex \revert 272 @funindex \revert
261 @funindex revert 273 @funindex revert
262 274
263 Once overridden, the property retains its new value until it is 275 Once overridden, the property retains its new value until it is
264 overridden again or a @code{\revert} command is encountered. 276 overridden again or a @code{\revert} command is encountered.
265 The @code{\revert} command has the following syntax and causes 277 The @code{\revert} command has the following syntax and causes
266 the value of the property to revert to its original default 278 the value of the property to revert to its original default
267 value; note, not its previous value if several @code{\override} 279 value; note, not its previous value if several @code{\override}
268 commands have been issued. 280 commands have been issued.
269 281
270 @example 282 @example
271 \revert @var{Context}.@var{LayoutObject}.@var{layout-property} 283 \revert @var{Context}.@var{LayoutObject}.@var{layout-property}
272 @end example 284 @end example
273 285
274 Again, just like @var{Context} in the @code{\override} command, 286 Again, just like @var{Context} in the @code{\override} command,
275 @var{Context} is often not needed. It will be omitted 287 @var{Context} is often not needed. It will be omitted
276 in many of the following examples. Here we revert the color 288 in many of the following examples. Here we revert the color
277 of the note head to the default value for the final two notes: 289 of the note head to the default value for the final two notes:
278 290
279 @cindex color property, example 291 @cindex color property, example
280 @cindex NoteHead, example of overriding 292 @cindex NoteHead, example of overriding
281 293
282 @lilypond[quote,fragment,ragged-right,verbatim,relative=1] 294 @lilypond[quote,ragged-right,verbatim]
283 c4 d 295 \relative {
284 \override NoteHead.color = #red 296 c'4 d
285 e4 f | 297 \override NoteHead.color = #red
286 \override NoteHead.color = #green 298 e4 f |
287 g4 a 299 \override NoteHead.color = #green
288 \revert NoteHead.color 300 g4 a
289 b4 c | 301 \revert NoteHead.color
290 @end lilypond 302 b4 c |
291 303 }
292 304 @end lilypond
293 @node The \once prefix 305
294 @unnumberedsubsubsec The @code{\once} prefix 306
307 @node The once prefix
308 @unnumberedsubsubsec The @code{@bs{}once} prefix
295 309
296 @funindex \once 310 @funindex \once
297 @funindex once 311 @funindex once
298 312
299 Both the @code{\override} and the @code{\set} commands may be prefixed 313 @code{\override}, @code{\revert}. @code{\set}, and @code{\unset}
300 by @code{\once}. This causes the following @code{\override} or 314 commands may be prefixed with @code{\once}. This causes such a
301 @code{\set} command to be effective only during the current musical 315 command to be effective only during the current musical
302 moment before the property reverts back to its previous value (this can 316 moment before the property reverts back to its previous value (this can
303 be different from the default if another @code{\override} is still in 317 be different from the default if another @code{\override} is still in
304 effect). Using the same example, we can change the color of a single 318 effect). Using the same example, we can change the color of a single
305 note like this: 319 note like this:
306 320
307 @cindex color property, example 321 @cindex color property, example
308 @cindex NoteHead, example of overriding 322 @cindex NoteHead, example of overriding
309 323
310 @lilypond[quote,fragment,ragged-right,verbatim,relative=1] 324 @lilypond[quote,verbatim]
311 c4 d 325 \relative {
312 \override NoteHead.color = #red 326 c'4 d
313 e4 f | 327 \override NoteHead.color = #red
314 \once \override NoteHead.color = #green 328 e4 f |
315 g4 a 329 \once \override NoteHead.color = #green
316 \revert NoteHead.color 330 g4 a
317 b c | 331 \once \revert NoteHead.color
318 @end lilypond 332 b c |
319 333 \revert NoteHead.color
320 334 f2 c |
321 @node The \overrideProperty command 335 }
322 @unnumberedsubsubsec The @code{\overrideProperty} command 336 @end lilypond
337
338 The @code{\once} prefix may also be used in front of many
339 predefined commands to limit their effect to one musical moment:
340
341 @lilypond[quote,verbatim]
342 \relative {
343 c'4( d)
344 \once \slurDashed
345 e4( f) |
346 g4( a)
347 \once \hideNotes
348 b( c) |
349 }
350 @end lilypond
351
352 @node The overrideProperty command
353 @unnumberedsubsubsec The @code{@bs{}overrideProperty} command
323 354
324 @cindex overrideProperty command 355 @cindex overrideProperty command
325 356
326 @funindex \overrideProperty 357 @funindex \overrideProperty
327 @funindex overrideProperty 358 @funindex overrideProperty
328 359
329 There is another form of the override command, 360 There is another form of the override command,
330 @code{\overrideProperty}, which is occasionally required. 361 @code{\overrideProperty}, which is occasionally required.
331 We mention it here for completeness, but for details see 362 We mention it here for completeness, but for details see
332 @rextend{Difficult tweaks}. 363 @rextend{Difficult tweaks}.
333 @c Maybe explain in a later iteration -td 364 @c Maybe explain in a later iteration -td
334 365
335 366
336 @node The \tweak command 367 @node The tweak command
337 @unnumberedsubsubsec The @code{\tweak} command 368 @unnumberedsubsubsec The @code{@bs{}tweak} command
338 369
339 @cindex tweak command 370 @cindex tweak command
340 371
341 @funindex \tweak 372 @funindex \tweak
342 @funindex tweak 373 @funindex tweak
343 374
344 The final tweaking command which is available is @code{\tweak}. This 375 The final tweaking command which is available is @code{\tweak}. This
345 should be used when several objects occur at the same musical moment, 376 should be used when several objects occur at the same musical moment,
346 but you only want to change the properties of selected ones, such as a 377 but you only want to change the properties of selected ones, such as a
347 single note within a chord. Using @code{\override} would affect all the 378 single note within a chord. Using @code{\override} would affect all the
348 notes within a chord, whereas @code{\tweak} affects just the following 379 notes within a chord, whereas @code{\tweak} affects just the following
349 item in the input stream. 380 item in the input stream.
350 381
351 Here's an example. Suppose we wish to change the size of the 382 Here's an example. Suppose we wish to change the size of the
352 middle note head (the E) in a C major chord. Let's first see what 383 middle note head (the E) in a C major chord. Let's first see what
353 @code{\once \override} would do: 384 @code{\once \override} would do:
354 385
355 @cindex font-size property, example 386 @cindex font-size property, example
356 @cindex NoteHead, example of overriding 387 @cindex NoteHead, example of overriding
357 388
358 @lilypond[quote,fragment,ragged-right,verbatim,relative=1] 389 @lilypond[quote,ragged-right,verbatim]
359 <c e g>4 390 \relative {
360 \once \override NoteHead.font-size = #-3 391 <c' e g>4
361 <c e g>4 392 \once \override NoteHead.font-size = #-3
362 <c e g>4 393 <c e g>4
394 <c e g>4
395 }
363 @end lilypond 396 @end lilypond
364 397
365 We see the override affects @emph{all} the note heads in the chord. 398 We see the override affects @emph{all} the note heads in the chord.
366 This is because all the notes of a chord occur at the same 399 This is because all the notes of a chord occur at the same
367 @emph{musical moment}, and the action of @code{\once} is to 400 @emph{musical moment}, and the action of @code{\once} is to
368 apply the override to all layout objects of the type specified 401 apply the override to all layout objects of the type specified
369 which occur at the same musical moment as the @code{\override} 402 which occur at the same musical moment as the @code{\override}
370 command itself. 403 command itself.
371 404
372 The @code{\tweak} command operates in a different way. It acts on 405 The @code{\tweak} command operates in a different way. It acts on
373 the immediately following item in the input stream. In its simplest 406 the immediately following item in the input stream. In its simplest
374 form, it is effective only on objects which are created directly 407 form, it is effective only on objects which are created directly
375 from the following item, essentially note heads and articulations. 408 from the following item, essentially note heads and articulations.
376 409
377 So to return to our example, the size of the middle note of 410 So to return to our example, the size of the middle note of
378 a chord would be changed in this way: 411 a chord would be changed in this way:
379 412
380 @cindex font-size property, example 413 @cindex font-size property, example
381 @cindex @code{\tweak}, example 414 @cindex @code{\tweak}, example
382 415
383 @lilypond[quote,fragment,ragged-right,verbatim,relative=1] 416 @lilypond[quote,ragged-right,verbatim]
384 <c e g>4 417 \relative {
385 <c \tweak font-size #-3 e g>4 418 <c' e g>4
419 <c \tweak font-size #-3 e g>4
420 }
386 @end lilypond 421 @end lilypond
387 422
388 Note that the syntax of @code{\tweak} is different from that of the 423 Note that the syntax of @code{\tweak} is different from that of the
389 @code{\override} command. The context should not be specified; in 424 @code{\override} command. The context should not be specified; in
390 fact, it would generate an error to do so. Both context and layout 425 fact, it would generate an error to do so. Both context and layout
391 object are implied by the following item in the input stream. Note 426 object are implied by the following item in the input stream. Note
392 also that an equals sign should not be present. So the simple form 427 also that an equals sign should not be present. So the simple form
393 of the @code{\tweak} command is 428 of the @code{\tweak} command is
394 429
395 @example 430 @example
396 \tweak @var{layout-property} #@var{value} 431 \tweak @var{layout-property} #@var{value}
397 @end example 432 @end example
398 433
399 A @code{\tweak} command can also be used to modify just one in 434 A @code{\tweak} command can also be used to modify just one in
400 a series of articulations, as shown here: 435 a series of articulations, as shown here:
401 436
402 @cindex color property, example 437 @cindex color property, example
403 @cindex @code{\tweak}, example 438 @cindex @code{\tweak}, example
404 439
405 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 440 @lilypond[quote,fragment,ragged-right,verbatim]
406 a4^"Black" 441 a'4^"Black"
407 -\tweak color #red ^"Red" 442 -\tweak color #red ^"Red"
408 -\tweak color #green _"Green" 443 -\tweak color #green _"Green"
409 @end lilypond 444 @end lilypond
410 445
411 @noindent 446 @noindent
412 Note that the @code{\tweak} command must be preceded by an articulation 447 Note that the @code{\tweak} command must be preceded by an articulation
413 mark since the tweaked expression needs to be applied as an articulation 448 mark since the tweaked expression needs to be applied as an articulation
414 itself. In case of multiple direction overrides (@code{^} or @code{_}), 449 itself. In case of multiple direction overrides (@code{^} or @code{_}),
415 the leftmost override wins since it is applied last. 450 the leftmost override wins since it is applied last.
416 451
417 @cindex @code{\tweak}, Accidental 452 @cindex @code{\tweak}, Accidental
418 @cindex @code{\tweak}, specific layout object 453 @cindex @code{\tweak}, specific layout object
419 454
420 Objects such as stems and accidentals are created later, and not 455 Objects such as stems and accidentals are created later, and not
421 directly from the following event. It is still possible to use 456 directly from the following event. It is still possible to use
422 @code{\tweak} on such indirectly created objects by explicitly naming 457 @code{\tweak} on such indirectly created objects by explicitly naming
423 the layout object, provided that LilyPond can trace its origin back to 458 the layout object, provided that LilyPond can trace its origin back to
424 the original event: 459 the original event:
425 460
426 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 461 @lilypond[quote,fragment,ragged-right,verbatim]
427 <\tweak Accidental.color #red cis4 462 <\tweak Accidental.color #red cis''4
428 \tweak Accidental.color #green es 463 \tweak Accidental.color #green es''
429 g> 464 g''>
430 @end lilypond 465 @end lilypond
431 466
432 This long form of the @code{\tweak} command can be described as 467 This long form of the @code{\tweak} command can be described as
433 468
434 @example 469 @example
435 \tweak @var{layout-object}.@var{layout-property} @var{value} 470 \tweak @var{LayoutObject}.@var{layout-property} #@var{value}
436 @end example 471 @end example
437 472
438 @cindex tuplets, nested 473 @cindex tuplets, nested
439 @cindex triplets, nested 474 @cindex triplets, nested
440 @cindex bracket, tuplet 475 @cindex bracket, tuplet
441 @cindex bracket, triplet 476 @cindex bracket, triplet
442 @cindex tuplet bracket 477 @cindex tuplet bracket
443 @cindex triplet bracket 478 @cindex triplet bracket
444 479
445 @funindex TupletBracket 480 @funindex TupletBracket
446 481
447 The @code{\tweak} command must also be used to change the 482 The @code{\tweak} command must also be used to change the
448 appearance of one of a set of nested tuplets which begin at the 483 appearance of one of a set of nested tuplets which begin at the
449 same musical moment. In the following example, the long tuplet 484 same musical moment. In the following example, the long tuplet
450 bracket and the first of the three short brackets begin at the 485 bracket and the first of the three short brackets begin at the
451 same musical moment, so any @code{\override} command would apply 486 same musical moment, so any @code{\override} command would apply
452 to both of them. In the example, @code{\tweak} is used to 487 to both of them. In the example, @code{\tweak} is used to
453 distinguish between them. The first @code{\tweak} command 488 distinguish between them. The first @code{\tweak} command
454 specifies that the long tuplet bracket is to be placed above the 489 specifies that the long tuplet bracket is to be placed above the
455 notes and the second one specifies that the tuplet number is to be 490 notes and the second one specifies that the tuplet number is to be
456 printed in red on the first short tuplet bracket. 491 printed in red on the first short tuplet bracket.
457 492
458 @cindex @code{\tweak}, example 493 @cindex @code{\tweak}, example
459 @cindex direction property, example 494 @cindex direction property, example
460 @cindex color property, example 495 @cindex color property, example
461 496
462 @lilypond[quote,ragged-right,verbatim,fragment,relative=2] 497 @lilypond[quote,ragged-right,verbatim]
463 \tweak direction #up 498 \relative c'' {
464 \times 4/3 { 499 \tweak direction #up
465 \tweak color #red 500 \tuplet 3/4 {
466 \times 2/3 { c8[ c c] } 501 \tweak color #red
467 \times 2/3 { c8[ c c] } 502 \tuplet 3/2 { c8[ c c] }
468 \times 2/3 { c8[ c c] } 503 \tuplet 3/2 { c8[ c c] }
504 \tuplet 3/2 { c8[ c c] }
505 }
469 } 506 }
470 @end lilypond 507 @end lilypond
471 508
472 If nested tuplets do not begin at the same moment, their 509 If nested tuplets do not begin at the same moment, their
473 appearance may be modified in the usual way with 510 appearance may be modified in the usual way with
474 @code{\override} commands: 511 @code{\override} commands:
475 512
476 @cindex text property, example 513 @cindex text property, example
477 @cindex tuplet-number function, example 514 @cindex tuplet-number function, example
478 @cindex transparent property, example 515 @cindex transparent property, example
479 @cindex TupletNumber, example of overriding 516 @cindex TupletNumber, example of overriding
480 517
481 @lilypond[quote,ragged-right,verbatim,fragment,relative=1] 518 @lilypond[quote,ragged-right,verbatim]
482 \times 2/3 { c8[ c c] } 519 \relative {
483 \once \override TupletNumber.text = #tuplet-number::calc-fraction-text 520 \tuplet 3/2 { c'8[ c c] }
484 \times 2/3 { 521 \once \override TupletNumber.text = #tuplet-number::calc-fraction-text
485 c8[ c] 522 \tuplet 3/2 {
486 c8[ c] 523 c8[ c]
487 \once \override TupletNumber.transparent = ##t 524 c8[ c]
488 \times 2/3 { c8[ c c] } 525 \once \override TupletNumber.transparent = ##t
489 \times 2/3 { c8[ c c] } 526 \tuplet 3/2 { c8[ c c] }
527 \tuplet 3/2 { c8[ c c] }
528 }
490 } 529 }
491 @end lilypond 530 @end lilypond
492 531
493 532
494 @seealso 533 @seealso
495 Notation Reference: 534 Notation Reference:
496 @ruser{Tweak and single}. 535 @ruser{Tweak and single}.
536
537 @node The single prefix
538 @unnumberedsubsubsec The @code{@bs{}single} prefix
539
540 @funindex \single
541 @cindex tweak, generated from override
542
543 Suppose we wanted to emphasize particular note heads by coloring them
544 red and increasing their size, and to make it easy suppose also we
545 have defined a function to do this:
546
547 @lilypond[quote,verbatim]
548 emphNoteHead = {
549 \override NoteHead.color = #red
550 \override NoteHead.font-size = 2
551 }
552 \relative {
553 c''4 a \once \emphNoteHead f d |
554 }
555 @end lilypond
556
557 The @code{\once} prefix works fine to emphasize single notes or
558 complete chords, but it cannot be used to emphasize a single note
559 @emph{within} a chord. Earlier we have seen how @code{\tweak} can
560 be used to do this, see
561 @ref{The tweak command,,The @code{@bs{}tweak} command}. But
562 @code{\tweak} cannot be used with a function; that's where
563 @code{\single} comes in:
564
565 @lilypond[quote,verbatim]
566 emphNoteHead = {
567 \override NoteHead.color = #red
568 \override NoteHead.font-size = 2
569 }
570 \relative {
571 <c'' a \single \emphNoteHead f d>4
572 }
573 @end lilypond
574
575 In summary, @code{\single} converts overrides into tweaks so when
576 there are several objects at the same point in musical time (like
577 noteheads in a chord), @code{\single} will only affect a single one,
578 the one generated by the immediately following music expression, in
579 contrast to @code{\once} which will affect all of those objects.
580
581 By using @code{\single} in this way any shorthand function
582 containing just overrides may be applied to individual notes in a
583 chord. However, @code{\single} does not convert @code{\revert},
584 @code{\set} or @code{\unset} into tweaks.
585
586 @seealso
587 Learning Manual:
588 @ref{The tweak command,,The @code{@bs{}tweak} command},
589 @ref{Using variables for layout adjustments}.
497 590
498 591
499 @node The Internals Reference manual 592 @node The Internals Reference manual
500 @section The Internals Reference manual 593 @section The Internals Reference manual
501 594
502 @cindex Internals Reference 595 @cindex Internals Reference
503 596
504 @menu 597 @menu
505 * Properties of layout objects:: 598 * Properties of layout objects::
506 * Properties found in interfaces:: 599 * Properties found in interfaces::
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 631
539 @cindex override example 632 @cindex override example
540 @cindex Internals Reference, example of using 633 @cindex Internals Reference, example of using
541 @cindex @code{\addlyrics} example 634 @cindex @code{\addlyrics} example
542 635
543 Let's use a concrete example with a simple fragment of real 636 Let's use a concrete example with a simple fragment of real
544 music: 637 music:
545 638
546 @c Mozart, Die Zauberflöte Nr.7 Duett 639 @c Mozart, Die Zauberflöte Nr.7 Duett
547 640
548 @lilypond[quote,verbatim,relative=2] 641 @lilypond[quote,verbatim]
549 { 642 {
550 \key es \major 643 \key es \major
551 \time 6/8 644 \time 6/8
552 { 645 \relative {
553 r4 bes8 bes[( g]) g | 646 r4 bes'8 bes[( g]) g |
554 g8[( es]) es d[( f]) as | 647 g8[( es]) es d[( f]) as |
555 as8 g 648 as8 g
556 } 649 }
557 \addlyrics { 650 \addlyrics {
558 The man who | feels love's sweet e -- | mo -- tion 651 The man who | feels love's sweet e -- | mo -- tion
559 } 652 }
560 } 653 }
561 @end lilypond 654 @end lilypond
562 655
563 Suppose now that we decide we would like the slurs to be a 656 Suppose now that we decide we would like the slurs to be a
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 Don't forget the@tie{}@code{#} preceding the new value! 716 Don't forget the@tie{}@code{#} preceding the new value!
624 717
625 The final question is, @q{Where should this command be 718 The final question is, @q{Where should this command be
626 placed?} While you are unsure and learning, the best 719 placed?} While you are unsure and learning, the best
627 answer is, @q{Within the music, before the first slur and 720 answer is, @q{Within the music, before the first slur and
628 close to it.} Let's do that: 721 close to it.} Let's do that:
629 722
630 @cindex Slur example of overriding 723 @cindex Slur example of overriding
631 @cindex thickness property, example 724 @cindex thickness property, example
632 725
633 @lilypond[quote,verbatim,relative=2] 726 @lilypond[quote,verbatim]
634 { 727 {
635 \key es \major 728 \key es \major
636 \time 6/8 729 \time 6/8
637 { 730 \relative {
638 % Increase thickness of all following slurs from 1.2 to 5.0 731 % Increase thickness of all following slurs from 1.2 to 5.0
639 \override Slur.thickness = #5.0 732 \override Slur.thickness = #5.0
640 r4 bes8 bes[( g]) g | 733 r4 bes'8 bes[( g]) g |
641 g8[( es]) es d[( f]) as | 734 g8[( es]) es d[( f]) as |
642 as8 g 735 as8 g
643 } 736 }
644 \addlyrics { 737 \addlyrics {
645 The man who | feels love's sweet e -- | mo -- tion 738 The man who | feels love's sweet e -- | mo -- tion
646 } 739 }
647 } 740 }
648 @end lilypond 741 @end lilypond
649 742
650 @noindent 743 @noindent
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 the @code{\override} command it causes it to change only the slur 785 the @code{\override} command it causes it to change only the slur
693 which begins on the @strong{immediately following} note. If the 786 which begins on the @strong{immediately following} note. If the
694 immediately following note does not begin a slur the command has no 787 immediately following note does not begin a slur the command has no
695 effect at all -- it is not remembered until a slur is encountered, it 788 effect at all -- it is not remembered until a slur is encountered, it
696 is simply discarded. So the command with @code{\once} must be 789 is simply discarded. So the command with @code{\once} must be
697 repositioned as follows: 790 repositioned as follows:
698 791
699 @cindex Slur, example of overriding 792 @cindex Slur, example of overriding
700 @cindex thickness property, example 793 @cindex thickness property, example
701 794
702 @lilypond[quote,verbatim,relative=2] 795 @lilypond[quote,verbatim]
703 { 796 {
704 \key es \major 797 \key es \major
705 \time 6/8 798 \time 6/8
706 { 799 \relative {
707 r4 bes8 800 r4 bes'8
708 % Increase thickness of immediately following slur only 801 % Increase thickness of immediately following slur only
709 \once \override Slur.thickness = #5.0 802 \once \override Slur.thickness = #5.0
710 bes8[( g]) g | 803 bes8[( g]) g |
711 g8[( es]) es d[( f]) as | 804 g8[( es]) es d[( f]) as |
712 as8 g 805 as8 g
713 } 806 }
714 \addlyrics { 807 \addlyrics {
715 The man who | feels love's sweet e -- | mo -- tion 808 The man who | feels love's sweet e -- | mo -- tion
716 } 809 }
717 } 810 }
(...skipping 14 matching lines...) Expand all
732 @funindex revert 825 @funindex revert
733 826
734 Finally, what if we wanted just the first two slurs to be 827 Finally, what if we wanted just the first two slurs to be
735 heavier? Well, we could use two commands, each preceded by 828 heavier? Well, we could use two commands, each preceded by
736 @code{\once} placed immediately before each of the notes where 829 @code{\once} placed immediately before each of the notes where
737 the slurs begin: 830 the slurs begin:
738 831
739 @cindex Slur, example of overriding 832 @cindex Slur, example of overriding
740 @cindex thickness property, example 833 @cindex thickness property, example
741 834
742 @lilypond[quote,verbatim,relative=2] 835 @lilypond[quote,verbatim]
743 { 836 {
744 \key es \major 837 \key es \major
745 \time 6/8 838 \time 6/8
746 { 839 \relative {
747 r4 bes8 840 r4 bes'8
748 % Increase thickness of immediately following slur only 841 % Increase thickness of immediately following slur only
749 \once \override Slur.thickness = #5.0 842 \once \override Slur.thickness = #5.0
750 bes[( g]) g | 843 bes[( g]) g |
751 % Increase thickness of immediately following slur only 844 % Increase thickness of immediately following slur only
752 \once \override Slur.thickness = #5.0 845 \once \override Slur.thickness = #5.0
753 g8[( es]) es d[( f]) as | 846 g8[( es]) es d[( f]) as |
754 as8 g 847 as8 g
755 } 848 }
756 \addlyrics { 849 \addlyrics {
757 The man who | feels love's sweet e -- | mo -- tion 850 The man who | feels love's sweet e -- | mo -- tion
758 } 851 }
759 } 852 }
760 @end lilypond 853 @end lilypond
761 854
762 @noindent 855 @noindent
763 or we could omit the @code{\once} command and use the @code{\revert} 856 or we could omit the @code{\once} command and use the @code{\revert}
764 command to return the @code{thickness} property to its default value 857 command to return the @code{thickness} property to its default value
765 after the second slur: 858 after the second slur:
766 859
767 @cindex Slur, example of overriding 860 @cindex Slur, example of overriding
768 @cindex thickness property, example 861 @cindex thickness property, example
769 862
770 @lilypond[quote,verbatim,relative=2] 863 @lilypond[quote,verbatim]
771 { 864 {
772 \key es \major 865 \key es \major
773 \time 6/8 866 \time 6/8
774 { 867 \relative {
775 r4 bes8 868 r4 bes'8
776 % Increase thickness of all following slurs from 1.2 to 5.0 869 % Increase thickness of all following slurs from 1.2 to 5.0
777 \override Slur.thickness = #5.0 870 \override Slur.thickness = #5.0
778 bes[( g]) g | 871 bes[( g]) g |
779 g8[( es]) es 872 g8[( es]) es
780 % Revert thickness of all following slurs to default of 1.2 873 % Revert thickness of all following slurs to default of 1.2
781 \revert Slur.thickness 874 \revert Slur.thickness
782 d8[( f]) as | 875 d8[( f]) as |
783 as8 g 876 as8 g
784 } 877 }
785 \addlyrics { 878 \addlyrics {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 960
868 @noindent 961 @noindent
869 This should be placed just in front of the lyrics we wish to affect, 962 This should be placed just in front of the lyrics we wish to affect,
870 like so: 963 like so:
871 964
872 @cindex font-shape property, example 965 @cindex font-shape property, example
873 @cindex italic, example 966 @cindex italic, example
874 @cindex LyricText, example of overriding 967 @cindex LyricText, example of overriding
875 @cindex @code{\addlyrics}, example 968 @cindex @code{\addlyrics}, example
876 969
877 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 970 @lilypond[quote,ragged-right,verbatim]
878 { 971 {
879 \key es \major 972 \key es \major
880 \time 6/8 973 \time 6/8
881 { 974 \relative {
882 r4 bes8 bes[( g]) g | 975 r4 bes'8 bes[( g]) g |
883 g8[( es]) es d[( f]) as | 976 g8[( es]) es d[( f]) as |
884 as8 g 977 as8 g
885 } 978 }
886 \addlyrics { 979 \addlyrics {
887 \override LyricText.font-shape = #'italic 980 \override LyricText.font-shape = #'italic
888 The man who | feels love's sweet e -- | mo -- tion 981 The man who | feels love's sweet e -- | mo -- tion
889 } 982 }
890 } 983 }
891 @end lilypond 984 @end lilypond
892 985
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 1130
1038 This property controls the appearance of the bar lines by specifying 1131 This property controls the appearance of the bar lines by specifying
1039 the symbol (glyph) which should be printed. In common 1132 the symbol (glyph) which should be printed. In common
1040 with many other properties, it can be set to print nothing by 1133 with many other properties, it can be set to print nothing by
1041 setting its value to @code{#f}. Let's try it, as before, omitting 1134 setting its value to @code{#f}. Let's try it, as before, omitting
1042 the implied Context, @code{Voice}: 1135 the implied Context, @code{Voice}:
1043 1136
1044 @cindex BarLine, example of overriding 1137 @cindex BarLine, example of overriding
1045 @cindex stencil property, example 1138 @cindex stencil property, example
1046 1139
1047 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 1140 @lilypond[quote,ragged-right,verbatim]
1048 { 1141 \relative {
1049 \time 12/16 1142 \time 12/16
1050 \override BarLine.stencil = ##f 1143 \override BarLine.stencil = ##f
1051 c4 b8 c d16 c d8 | 1144 c''4 b8 c d16 c d8 |
1052 g,8 a16 b8 c d4 e16 | 1145 g,8 a16 b8 c d4 e16 |
1053 e8 1146 e8
1054 } 1147 }
1055 @end lilypond 1148 @end lilypond
1056 1149
1057 The bar lines are still printed. What is wrong? Go back to the IR 1150 The bar lines are still printed. What is wrong? Go back to the IR
1058 and look again at the page giving the properties of BarLine. At the 1151 and look again at the page giving the properties of BarLine. At the
1059 top of the page it says @qq{Barline objects are created by: 1152 top of the page it says @qq{Barline objects are created by:
1060 Bar_engraver}. Go to the @code{Bar_engraver} page. At the bottom it 1153 Bar_engraver}. Go to the @code{Bar_engraver} page. At the bottom it
1061 gives a list of Contexts in which the bar engraver operates. All of 1154 gives a list of Contexts in which the bar engraver operates. All of
1062 them are of the type @code{Staff}, so the reason the @code{\override} 1155 them are of the type @code{Staff}, so the reason the @code{\override}
1063 command failed to work as expected is because @code{Barline} is not in 1156 command failed to work as expected is because @code{Barline} is not in
1064 the default @code{Voice} context. If the context is specified 1157 the default @code{Voice} context. If the context is specified
1065 incorrectly, the command simply does not work. No error message is 1158 incorrectly, the command simply does not work. No error message is
1066 produced, and nothing is logged in the log file. Let's try correcting 1159 produced, and nothing is logged in the log file. Let's try correcting
1067 it by adding the correct context: 1160 it by adding the correct context:
1068 1161
1069 @cindex BarLine, example of overriding 1162 @cindex BarLine, example of overriding
1070 @cindex stencil property, example 1163 @cindex stencil property, example
1071 1164
1072 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 1165 @lilypond[quote,ragged-right,verbatim]
1073 { 1166 \relative {
1074 \time 12/16 1167 \time 12/16
1075 \override Staff.BarLine.stencil = ##f 1168 \override Staff.BarLine.stencil = ##f
1076 c4 b8 c d16 c d8 | 1169 c''4 b8 c d16 c d8 |
1077 g,8 a16 b8 c d4 e16 | 1170 g,8 a16 b8 c d4 e16 |
1078 e8 1171 e8
1079 } 1172 }
1080 @end lilypond 1173 @end lilypond
1081 1174
1082 Now the bar lines have vanished. Setting the @code{stencil} 1175 Now the bar lines have vanished. Setting the @code{stencil}
1083 property to @code{#f} is such a frequent operation that there is a 1176 property to @code{#f} is such a frequent operation that there is a
1084 shorthand for it called @code{\omit}: 1177 shorthand for it called @code{\omit}:
1085 @funindex \omit 1178 @funindex \omit
1086 1179
1087 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 1180 @lilypond[quote,ragged-right,verbatim]
1088 { 1181 \relative {
1089 \time 12/16 1182 \time 12/16
1090 \omit Staff.BarLine 1183 \omit Staff.BarLine
1091 c4 b8 c d16 c d8 | 1184 c''4 b8 c d16 c d8 |
1092 g,8 a16 b8 c d4 e16 | 1185 g,8 a16 b8 c d4 e16 |
1093 e8 1186 e8
1094 } 1187 }
1095 @end lilypond 1188 @end lilypond
1096 1189
1097 Note, though, that setting the @code{stencil} property to @code{#f} 1190 Note, though, that setting the @code{stencil} property to @code{#f}
1098 will cause errors when the dimensions of the object are required for 1191 will cause errors when the dimensions of the object are required for
1099 correct processing. For example, errors will be generated if the 1192 correct processing. For example, errors will be generated if the
1100 @code{stencil} property of the @code{NoteHead} object is set to 1193 @code{stencil} property of the @code{NoteHead} object is set to
1101 @code{#f}. If this is the case, you can instead use the 1194 @code{#f}. If this is the case, you can instead use the
1102 @code{point-stencil} function, which sets the stencil to a object 1195 @code{point-stencil} function, which sets the stencil to an object
1103 with zero size: 1196 with zero size:
1104 1197
1105 @lilypond[quote,verbatim,relative=2] 1198 @lilypond[quote,verbatim]
1106 { 1199 \relative {
1107 c4 c 1200 c''4 c
1108 \once \override NoteHead.stencil = #point-stencil 1201 \once \override NoteHead.stencil = #point-stencil
1109 c4 c 1202 c4 c
1110 } 1203 }
1111 @end lilypond 1204 @end lilypond
1112 1205
1113 @node The break-visibility property 1206 @node The break-visibility property
1114 @unnumberedsubsubsec The @code{break-visibility} property 1207 @unnumberedsubsubsec The @code{break-visibility} property
1115 1208
1116 @cindex break-visibility property 1209 @cindex break-visibility property
1117 1210
1118 We see from the @code{BarLine} properties in the IR that the 1211 We see from the @code{BarLine} properties in the IR that the
1119 @code{break-visibility} property requires a vector of three booleans. 1212 @code{break-visibility} property requires a vector of three booleans.
1120 These control respectively whether bar lines are printed at the end of 1213 These control respectively whether bar lines are printed at the end of
1121 a line, in the middle of lines, and at the beginning of lines. For 1214 a line, in the middle of lines, and at the beginning of lines. For
1122 our example we want all bar lines to be suppressed, so the value we 1215 our example we want all bar lines to be suppressed, so the value we
1123 need is @code{#(#f #f #f)} (also available 1216 need is @code{#(#f #f #f)} (also available
1124 under the name @code{all-invisible}). Let's try that, remembering to include 1217 under the name @code{all-invisible}). Let's try that, remembering to include
1125 the @code{Staff} context. Note also that in writing this value we 1218 the @code{Staff} context. Note also that in writing this value we
1126 have @code{##} before the opening parenthesis. One @code{#} is required 1219 have @code{##} before the opening parenthesis. One @code{#} is required
1127 as part of vector constant syntax, and the first@tie{}@code{#} is 1220 as part of vector constant syntax, and the first@tie{}@code{#} is
1128 required, as always, to precede the value itself in the 1221 required, as always, to precede the value itself in the
1129 @code{\override} command. 1222 @code{\override} command.
1130 1223
1131 @cindex BarLine, example of overriding 1224 @cindex BarLine, example of overriding
1132 @cindex break-visibility property, example 1225 @cindex break-visibility property, example
1133 1226
1134 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 1227 @lilypond[quote,ragged-right,verbatim]
1135 { 1228 \relative {
1136 \time 12/16 1229 \time 12/16
1137 \override Staff.BarLine.break-visibility = ##(#f #f #f) 1230 \override Staff.BarLine.break-visibility = ##(#f #f #f)
1138 c4 b8 c d16 c d8 | 1231 c''4 b8 c d16 c d8 |
1139 g,8 a16 b8 c d4 e16 | 1232 g,8 a16 b8 c d4 e16 |
1140 e8 1233 e8
1141 } 1234 }
1142 @end lilypond 1235 @end lilypond
1143 1236
1144 And we see this too removes all the bar lines. 1237 And we see this too removes all the bar lines.
1145 1238
1146 @node The transparent property 1239 @node The transparent property
1147 @unnumberedsubsubsec The @code{transparent} property 1240 @unnumberedsubsubsec The @code{transparent} property
1148 1241
1149 @cindex transparent property 1242 @cindex transparent property
1150 @cindex transparency 1243 @cindex transparency
1151 1244
1152 We see from the properties specified in the @code{grob-interface} page 1245 We see from the properties specified in the @code{grob-interface} page
1153 in the IR that the @code{transparent} property is a boolean. This 1246 in the IR that the @code{transparent} property is a boolean. This
1154 should be set to @code{#t} to make the grob transparent. In this next 1247 should be set to @code{#t} to make the grob transparent. In this next
1155 example let us make the time signature invisible rather than the bar 1248 example let us make the time signature invisible rather than the bar
1156 lines. To do this we need to find the grob name for the time 1249 lines. To do this we need to find the grob name for the time
1157 signature. Back to the @q{All layout objects} page in the IR to find 1250 signature. Back to the @q{All layout objects} page in the IR to find
1158 the properties of the @code{TimeSignature} layout object. This is 1251 the properties of the @code{TimeSignature} layout object. This is
1159 produced by the @code{Time_signature_engraver} which you can check 1252 produced by the @code{Time_signature_engraver} which you can check
1160 also lives in the @code{Staff} context and also supports the 1253 also lives in the @code{Staff} context and also supports the
1161 @code{grob-interface}. So the command to make the time signature 1254 @code{grob-interface}. So the command to make the time signature
1162 transparent is: 1255 transparent is:
1163 1256
1164 @cindex TimeSignature, example of overriding 1257 @cindex TimeSignature, example of overriding
1165 @cindex transparent property, example 1258 @cindex transparent property, example
1166 1259
1167 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 1260 @lilypond[quote,ragged-right,verbatim]
1168 { 1261 \relative {
1169 \time 12/16 1262 \time 12/16
1170 \override Staff.TimeSignature.transparent = ##t 1263 \override Staff.TimeSignature.transparent = ##t
1171 c4 b8 c d16 c d8 | 1264 c''4 b8 c d16 c d8 |
1172 g,8 a16 b8 c d4 e16 | 1265 g,8 a16 b8 c d4 e16 |
1173 e8 1266 e8
1174 } 1267 }
1175 @end lilypond 1268 @end lilypond
1176 1269
1177 @noindent 1270 @noindent
1178 Again, setting the @code{transparent} property is a rather 1271 Again, setting the @code{transparent} property is a rather
1179 frequent operation, so we have a shorthand for it called 1272 frequent operation, so we have a shorthand for it called
1180 @code{\hide}: 1273 @code{\hide}:
1181 @funindex \hide 1274 @funindex \hide
1182 1275
1183 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 1276 @lilypond[quote,ragged-right,verbatim]
1184 { 1277 \relative {
1185 \time 12/16 1278 \time 12/16
1186 \hide Staff.TimeSignature 1279 \hide Staff.TimeSignature
1187 c4 b8 c d16 c d8 | 1280 c''4 b8 c d16 c d8 |
1188 g,8 a16 b8 c d4 e16 | 1281 g,8 a16 b8 c d4 e16 |
1189 e8 1282 e8
1190 } 1283 }
1191 @end lilypond 1284 @end lilypond
1192 1285
1193 @noindent 1286 @noindent
1194 In either case, the time signature is gone, but this command 1287 In either case, the time signature is gone, but this command
1195 leaves a gap where 1288 leaves a gap where
1196 the time signature should be. Maybe this is what is wanted for 1289 the time signature should be. Maybe this is what is wanted for
1197 an exercise for the student to fill it in, but in other 1290 an exercise for the student to fill it in, but in other
1198 circumstances a gap might be undesirable. To remove it, the 1291 circumstances a gap might be undesirable. To remove it, the
1199 stencil for the time signature should be set to @code{#f} 1292 stencil for the time signature should be set to @code{#f}
1200 instead: 1293 instead:
1201 1294
1202 @cindex TimeSignature, example of overriding 1295 @cindex TimeSignature, example of overriding
1203 @cindex stencil property, example 1296 @cindex stencil property, example
1204 1297
1205 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 1298 @lilypond[quote,ragged-right,verbatim]
1206 { 1299 \relative {
1207 \time 12/16 1300 \time 12/16
1208 \omit Staff.TimeSignature 1301 \omit Staff.TimeSignature
1209 c4 b8 c d16 c d8 | 1302 c''4 b8 c d16 c d8 |
1210 g,8 a16 b8 c d4 e16 | 1303 g,8 a16 b8 c d4 e16 |
1211 e8 1304 e8
1212 } 1305 }
1213 @end lilypond 1306 @end lilypond
1214 1307
1215 @noindent 1308 @noindent
1216 and the difference is obvious: setting the stencil to @code{#f} 1309 and the difference is obvious: setting the stencil to @code{#f}
1217 (possibly via @code{\omit}) 1310 (possibly via @code{\omit})
1218 removes the object entirely; making the object @code{transparent} 1311 removes the object entirely; making the object @code{transparent}
1219 (which can be done using @code{\hide}) 1312 (which can be done using @code{\hide})
(...skipping 19 matching lines...) Expand all
1239 requires is actually a list of values in internal units, 1332 requires is actually a list of values in internal units,
1240 but, to avoid having to know what these are, several ways 1333 but, to avoid having to know what these are, several ways
1241 are provided to specify colors. The first way is to use one 1334 are provided to specify colors. The first way is to use one
1242 of the @q{normal} colors listed in the first table in 1335 of the @q{normal} colors listed in the first table in
1243 @ruser{List of colors}. To set the bar lines to white 1336 @ruser{List of colors}. To set the bar lines to white
1244 we write: 1337 we write:
1245 1338
1246 @cindex BarLine, example of overriding 1339 @cindex BarLine, example of overriding
1247 @cindex color property, example 1340 @cindex color property, example
1248 1341
1249 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 1342 @lilypond[quote,ragged-right,verbatim]
1250 { 1343 \relative {
1251 \time 12/16 1344 \time 12/16
1252 \override Staff.BarLine.color = #white 1345 \override Staff.BarLine.color = #white
1253 c4 b8 c d16 c d8 | 1346 c''4 b8 c d16 c d8 |
1254 g,8 a16 b8 c d4 e16 | 1347 g,8 a16 b8 c d4 e16 |
1255 e8 1348 e8
1256 } 1349 }
1257 @end lilypond 1350 @end lilypond
1258 1351
1259 @noindent 1352 @noindent
1260 and again, we see the bar lines are not visible. Note that 1353 and again, we see the bar lines are not visible. Note that
1261 @emph{white} is not preceded by an apostrophe -- it is not 1354 @emph{white} is not preceded by an apostrophe -- it is not
1262 a symbol, but a @emph{variable}. When evaluated, it provides 1355 a symbol, but a @emph{variable}. When evaluated, it provides
1263 the list of internal values required to set the color to 1356 the list of internal values required to set the color to
1264 white. The other colors in the normal list are variables 1357 white. The other colors in the normal list are variables
1265 too. To convince yourself this is working you might like 1358 too. To convince yourself this is working you might like
1266 to change the color to one of the other variables in the 1359 to change the color to one of the other variables in the
1267 list. 1360 list.
1268 1361
1269 @cindex color, X11 1362 @cindex color, X11
1270 @cindex X11 colors 1363 @cindex X11 colors
1271 1364
1272 @funindex x11-color 1365 @funindex x11-color
1273 1366
1274 The second way of changing the color is to use the list of 1367 The second way of changing the color is to use the list of
1275 X11 color names in the second list in @ruser{List of colors}. 1368 X11 color names in the second list in @ruser{List of colors}.
1276 However, these are mapped to the actual values by the function 1369 However, these are mapped to the actual values by the function
1277 @code{x11-color} which 1370 @code{x11-color} which
1278 converts X11 color symbols into the list of internal values like this: 1371 converts X11 color symbols into the list of internal values like this:
1279 1372
1280 @cindex BarLine, example of overriding 1373 @cindex BarLine, example of overriding
1281 @cindex color property, example 1374 @cindex color property, example
1282 1375
1283 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 1376 @lilypond[quote,ragged-right,verbatim]
1284 { 1377 \relative {
1285 \time 12/16 1378 \time 12/16
1286 \override Staff.BarLine.color = #(x11-color 'white) 1379 \override Staff.BarLine.color = #(x11-color 'white)
1287 c4 b8 c d16 c d8 | 1380 c''4 b8 c d16 c d8 |
1288 g,8 a16 b8 c d4 e16 | 1381 g,8 a16 b8 c d4 e16 |
1289 e8 1382 e8
1290 } 1383 }
1291 @end lilypond 1384 @end lilypond
1292 1385
1293 @noindent 1386 @noindent
1294 Note that in this case the function @code{x11-color} takes 1387 Note that in this case the function @code{x11-color} takes
1295 a symbol as an argument, so the symbol must be preceded by 1388 a symbol as an argument, so the symbol must be preceded by
1296 an apostrophe to keep it from being evaluated as a variable, and 1389 an apostrophe to keep it from being evaluated as a variable, and
1297 the whole function call has to be enclosed in parentheses. 1390 the whole function call has to be enclosed in parentheses.
1298 1391
1299 @cindex rgb colors 1392 @cindex rgb colors
1300 @cindex color, rgb 1393 @cindex color, rgb
1301 1394
1302 @funindex rgb-color 1395 @funindex rgb-color
1303 1396
1304 There is another function, one which converts RGB values into 1397 There is another function, one which converts RGB values into
1305 internal colors -- the @code{rgb-color} function. This takes 1398 internal colors -- the @code{rgb-color} function. This takes
1306 three arguments giving the intensities of the red, green and 1399 three arguments giving the intensities of the red, green and
1307 blue colors. These take values in the range 0 to 1. So to 1400 blue colors. These take values in the range 0 to 1. So to
1308 set the color to red the value should be @code{(rgb-color 1 0 0)} 1401 set the color to red the value should be @code{(rgb-color 1 0 0)}
1309 and to white it should be @code{(rgb-color 1 1 1)}: 1402 and to white it should be @code{(rgb-color 1 1 1)}:
1310 1403
1311 @cindex BarLine, example of overriding 1404 @cindex BarLine, example of overriding
1312 @cindex color property, example 1405 @cindex color property, example
1313 1406
1314 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 1407 @lilypond[quote,ragged-right,verbatim]
1315 { 1408 \relative {
1316 \time 12/16 1409 \time 12/16
1317 \override Staff.BarLine.color = #(rgb-color 1 1 1) 1410 \override Staff.BarLine.color = #(rgb-color 1 1 1)
1318 c4 b8 c d16 c d8 | 1411 c''4 b8 c d16 c d8 |
1319 g,8 a16 b8 c d4 e16 | 1412 g,8 a16 b8 c d4 e16 |
1320 e8 1413 e8
1321 } 1414 }
1322 @end lilypond 1415 @end lilypond
1323 1416
1324 Finally, there is also a grey scale available as part of the 1417 Finally, there is also a grey scale available as part of the
1325 X11 set of colors. These range from black, @code{'grey0}, 1418 X11 set of colors. These range from black, @code{'grey0},
1326 to white, @code{'grey100}, in steps of 1. Let's illustrate 1419 to white, @code{'grey100}, in steps of 1. Let's illustrate
1327 this by setting all the layout objects in our example to 1420 this by setting all the layout objects in our example to
1328 various shades of grey: 1421 various shades of grey:
1329 1422
1330 @cindex StaffSymbol, example of overriding 1423 @cindex StaffSymbol, example of overriding
1331 @cindex TimeSignature, example of overriding 1424 @cindex TimeSignature, example of overriding
1332 @cindex Clef, example of overriding 1425 @cindex Clef, example of overriding
1333 @cindex NoteHead, example of overriding 1426 @cindex NoteHead, example of overriding
1334 @cindex Stem, example of overriding 1427 @cindex Stem, example of overriding
1335 @cindex BarLine, example of overriding 1428 @cindex BarLine, example of overriding
1336 @cindex color property, example 1429 @cindex color property, example
1337 @cindex x11-color, example of using 1430 @cindex x11-color, example of using
1338 1431
1339 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 1432 @lilypond[quote,ragged-right,verbatim]
1340 { 1433 \relative {
1341 \time 12/16 1434 \time 12/16
1342 \override Staff.StaffSymbol.color = #(x11-color 'grey30) 1435 \override Staff.StaffSymbol.color = #(x11-color 'grey30)
1343 \override Staff.TimeSignature.color = #(x11-color 'grey60) 1436 \override Staff.TimeSignature.color = #(x11-color 'grey60)
1344 \override Staff.Clef.color = #(x11-color 'grey60) 1437 \override Staff.Clef.color = #(x11-color 'grey60)
1345 \override Voice.NoteHead.color = #(x11-color 'grey85) 1438 \override Voice.NoteHead.color = #(x11-color 'grey85)
1346 \override Voice.Stem.color = #(x11-color 'grey85) 1439 \override Voice.Stem.color = #(x11-color 'grey85)
1347 \override Staff.BarLine.color = #(x11-color 'grey10) 1440 \override Staff.BarLine.color = #(x11-color 'grey10)
1348 c4 b8 c d16 c d8 | 1441 c''4 b8 c d16 c d8 |
1349 g,8 a16 b8 c d4 e16 | 1442 g,8 a16 b8 c d4 e16 |
1350 e8 1443 e8
1351 } 1444 }
1352 @end lilypond 1445 @end lilypond
1353 1446
1354 @noindent 1447 @noindent
1355 Note the contexts associated with each of the layout objects. 1448 Note the contexts associated with each of the layout objects.
1356 It is important to get these right, or the commands will not 1449 It is important to get these right, or the commands will not
1357 work! Remember, the context is the one in which the appropriate 1450 work! Remember, the context is the one in which the appropriate
1358 engraver is placed. The default context for engravers can be 1451 engraver is placed. The default context for engravers can be
(...skipping 11 matching lines...) Expand all
1370 @cindex objects, size of 1463 @cindex objects, size of
1371 @cindex objects, changing size of 1464 @cindex objects, changing size of
1372 1465
1373 Let us begin by looking again at the earlier example 1466 Let us begin by looking again at the earlier example
1374 (see @ref{Nesting music expressions}) which showed 1467 (see @ref{Nesting music expressions}) which showed
1375 how to introduce a new temporary staff, as in an @rglos{ossia}. 1468 how to introduce a new temporary staff, as in an @rglos{ossia}.
1376 1469
1377 @cindex alignAboveContext property, example 1470 @cindex alignAboveContext property, example
1378 @cindex @code{\with}, example 1471 @cindex @code{\with}, example
1379 1472
1380 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 1473 @lilypond[quote,ragged-right,verbatim]
1381 \new Staff ="main" { 1474 \new Staff ="main" {
1382 \relative g' { 1475 \relative {
1383 r4 g8 g c4 c8 d | 1476 r4 g'8 g c4 c8 d |
1384 e4 r8 1477 e4 r8
1385 << 1478 <<
1386 { f8 c c } 1479 { f8 c c }
1387 \new Staff \with { 1480 \new Staff \with {
1388 alignAboveContext = #"main" } 1481 alignAboveContext = #"main" }
1389 { f8 f c } 1482 { f8 f c }
1390 >> 1483 >>
1391 r4 | 1484 r4 |
1392 } 1485 }
1393 } 1486 }
1394 @end lilypond 1487 @end lilypond
1395 1488
1396 Ossia are normally written without clef and time signature, and 1489 Ossia are normally written without clef and time signature, and
1397 are usually printed slightly smaller than the main staff. We 1490 are usually printed slightly smaller than the main staff. We
1398 already know now how to remove the clef and time signature -- 1491 already know now how to remove the clef and time signature --
1399 we simply set the stencil of each to @code{#f}, as follows: 1492 we simply set the stencil of each to @code{#f}, as follows:
1400 1493
1401 @cindex alignAboveContext property, example 1494 @cindex alignAboveContext property, example
1402 @cindex @code{\with}, example 1495 @cindex @code{\with}, example
1403 @funindex \omit 1496 @funindex \omit
1404 @cindex Clef, example of overriding 1497 @cindex Clef, example of overriding
1405 @cindex TimeSignature, example of overriding 1498 @cindex TimeSignature, example of overriding
1406 1499
1407 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 1500 @lilypond[quote,ragged-right,verbatim]
1408 \new Staff ="main" { 1501 \new Staff ="main" {
1409 \relative g' { 1502 \relative {
1410 r4 g8 g c4 c8 d | 1503 r4 g'8 g c4 c8 d |
1411 e4 r8 1504 e4 r8
1412 << 1505 <<
1413 { f8 c c } 1506 { f8 c c }
1414 \new Staff \with { 1507 \new Staff \with {
1415 alignAboveContext = #"main" 1508 alignAboveContext = #"main"
1416 } 1509 }
1417 { 1510 {
1418 \omit Staff.Clef 1511 \omit Staff.Clef
1419 \omit Staff.TimeSignature 1512 \omit Staff.TimeSignature
1420 { f8 f c } 1513 { f8 f c }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 If fact, an error will be generated if a context is specified 1553 If fact, an error will be generated if a context is specified
1461 in this location. 1554 in this location.
1462 1555
1463 So we could replace the example above with 1556 So we could replace the example above with
1464 1557
1465 @cindex alignAboveContext property, example 1558 @cindex alignAboveContext property, example
1466 @cindex @code{\with}, example 1559 @cindex @code{\with}, example
1467 @cindex Clef, example of overriding 1560 @cindex Clef, example of overriding
1468 @cindex TimeSignature, example of overriding 1561 @cindex TimeSignature, example of overriding
1469 1562
1470 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 1563 @lilypond[quote,ragged-right,verbatim]
1471 \new Staff ="main" { 1564 \new Staff ="main" {
1472 \relative g' { 1565 \relative {
1473 r4 g8 g c4 c8 d | 1566 r4 g'8 g c4 c8 d |
1474 e4 r8 1567 e4 r8
1475 << 1568 <<
1476 { f8 c c } 1569 { f8 c c }
1477 \new Staff \with { 1570 \new Staff \with {
1478 alignAboveContext = #"main" 1571 alignAboveContext = #"main"
1479 % Don't print clefs in this staff 1572 % Don't print clefs in this staff
1480 \override Clef.stencil = ##f 1573 \override Clef.stencil = ##f
1481 % Don't print time signatures in this staff 1574 % Don't print time signatures in this staff
1482 \override TimeSignature.stencil = ##f 1575 \override TimeSignature.stencil = ##f
1483 } 1576 }
1484 { f8 f c } 1577 { f8 f c }
1485 >> 1578 >>
1486 r4 | 1579 r4 |
1487 } 1580 }
1488 } 1581 }
1489 @end lilypond 1582 @end lilypond
1490 1583
1491 It turns out that we can also employ the shorthands @code{\hide} 1584 It turns out that we can also employ the shorthands @code{\hide}
1492 and @code{\omit} for setting the @code{transparent} property and 1585 and @code{\omit} for setting the @code{transparent} property and
1493 clearing the @code{stencil} here, leading to the result 1586 clearing the @code{stencil} here, leading to the result
1494 1587
1495 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 1588 @lilypond[quote,ragged-right,verbatim]
1496 \new Staff ="main" { 1589 \new Staff ="main" {
1497 \relative g' { 1590 \relative {
1498 r4 g8 g c4 c8 d | 1591 r4 g'8 g c4 c8 d |
1499 e4 r8 1592 e4 r8
1500 << 1593 <<
1501 { f8 c c } 1594 { f8 c c }
1502 \new Staff \with { 1595 \new Staff \with {
1503 alignAboveContext = #"main" 1596 alignAboveContext = #"main"
1504 % Don't print clefs in this staff 1597 % Don't print clefs in this staff
1505 \omit Clef 1598 \omit Clef
1506 % Don't print time signatures in this staff 1599 % Don't print time signatures in this staff
1507 \omit TimeSignature 1600 \omit TimeSignature
1508 } 1601 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 step reduces or increases the size by approximately 12%. 1642 step reduces or increases the size by approximately 12%.
1550 1643
1551 Let's try it in our ossia example: 1644 Let's try it in our ossia example:
1552 1645
1553 @cindex alignAboveContext property, example 1646 @cindex alignAboveContext property, example
1554 @cindex @code{\with}, example 1647 @cindex @code{\with}, example
1555 @cindex Clef, example of overriding 1648 @cindex Clef, example of overriding
1556 @cindex TimeSignature, example of overriding 1649 @cindex TimeSignature, example of overriding
1557 @cindex fontSize property, example 1650 @cindex fontSize property, example
1558 1651
1559 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 1652 @lilypond[quote,ragged-right,verbatim]
1560 \new Staff ="main" { 1653 \new Staff ="main" {
1561 \relative g' { 1654 \relative {
1562 r4 g8 g c4 c8 d | 1655 r4 g'8 g c4 c8 d |
1563 e4 r8 1656 e4 r8
1564 << 1657 <<
1565 { f8 c c } 1658 { f8 c c }
1566 \new Staff \with { 1659 \new Staff \with {
1567 alignAboveContext = #"main" 1660 alignAboveContext = #"main"
1568 \omit Clef 1661 \omit Clef
1569 \omit TimeSignature 1662 \omit TimeSignature
1570 % Reduce all font sizes by ~24% 1663 % Reduce all font sizes by ~24%
1571 fontSize = #-2 1664 fontSize = #-2
1572 } 1665 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 @cindex alignAboveContext property, example 1708 @cindex alignAboveContext property, example
1616 @cindex @code{\with}, example 1709 @cindex @code{\with}, example
1617 @cindex Clef, example of overriding 1710 @cindex Clef, example of overriding
1618 @cindex TimeSignature, example of overriding 1711 @cindex TimeSignature, example of overriding
1619 @cindex fontSize property, example 1712 @cindex fontSize property, example
1620 @cindex StaffSymbol, example of overriding 1713 @cindex StaffSymbol, example of overriding
1621 @cindex magstep function, example of using 1714 @cindex magstep function, example of using
1622 @cindex staff-space property, example 1715 @cindex staff-space property, example
1623 @cindex stencil property, example 1716 @cindex stencil property, example
1624 1717
1625 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 1718 @lilypond[quote,ragged-right,verbatim]
1626 \new Staff ="main" { 1719 \new Staff ="main" {
1627 \relative g' { 1720 \relative {
1628 r4 g8 g c4 c8 d | 1721 r4 g'8 g c4 c8 d |
1629 e4 r8 1722 e4 r8
1630 << 1723 <<
1631 { f8 c c } 1724 { f8 c c }
1632 \new Staff \with { 1725 \new Staff \with {
1633 alignAboveContext = #"main" 1726 alignAboveContext = #"main"
1634 \omit Clef 1727 \omit Clef
1635 \omit TimeSignature 1728 \omit TimeSignature
1636 fontSize = #-2 1729 fontSize = #-2
1637 % Reduce stem length and line spacing to match 1730 % Reduce stem length and line spacing to match
1638 \override StaffSymbol.staff-space = #(magstep -2) 1731 \override StaffSymbol.staff-space = #(magstep -2)
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 @code{outside-staff-priority} the one encountered first will be 1815 @code{outside-staff-priority} the one encountered first will be
1723 placed closer to the staff. 1816 placed closer to the staff.
1724 1817
1725 In the following example all the markup texts have the same 1818 In the following example all the markup texts have the same
1726 priority (since it is not explicitly set). Note that @q{Text3} 1819 priority (since it is not explicitly set). Note that @q{Text3}
1727 is automatically positioned close to the staff again, nestling 1820 is automatically positioned close to the staff again, nestling
1728 under @q{Text2}. 1821 under @q{Text2}.
1729 1822
1730 @cindex markup example 1823 @cindex markup example
1731 1824
1732 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 1825 @lilypond[quote,fragment,ragged-right,verbatim]
1733 c2^"Text1" 1826 c''2^"Text1"
1734 c2^"Text2" | 1827 c''2^"Text2" |
1735 c2^"Text3" 1828 c''2^"Text3"
1736 c2^"Text4" | 1829 c''2^"Text4" |
1737 @end lilypond 1830 @end lilypond
1738 1831
1739 Staves are also positioned, by default, as closely together as 1832 Staves are also positioned, by default, as closely together as
1740 possible (subject to a minimum separation). If notes project 1833 possible (subject to a minimum separation). If notes project
1741 a long way towards an adjacent staff they will force the 1834 a long way towards an adjacent staff they will force the
1742 staves further apart only if an overlap of the notation 1835 staves further apart only if an overlap of the notation
1743 would otherwise occur. The following example demonstrates 1836 would otherwise occur. The following example demonstrates
1744 this @q{nestling} of the notes on adjacent staves: 1837 this @q{nestling} of the notes on adjacent staves:
1745 1838
1746 @lilypond[quote,ragged-right,verbatim] 1839 @lilypond[quote,ragged-right,verbatim]
1747 << 1840 <<
1748 \new Staff { 1841 \new Staff {
1749 \relative c' { c4 a, } 1842 \relative { c'4 a, }
1750 } 1843 }
1751 \new Staff { 1844 \new Staff {
1752 \relative c'''' { c4 a, } 1845 \relative { c''''4 a, }
1753 } 1846 }
1754 >> 1847 >>
1755 @end lilypond 1848 @end lilypond
1756 1849
1757 1850
1758 @node Within-staff objects 1851 @node Within-staff objects
1759 @subsection Within-staff objects 1852 @subsection Within-staff objects
1760 1853
1761 We have already seen how the commands @code{\voiceXXX} affect the 1854 We have already seen how the commands @code{\voiceXXX} affect the
1762 direction of slurs, ties, fingering and everything else which depends on 1855 direction of slurs, ties, fingering and everything else which depends on
(...skipping 18 matching lines...) Expand all
1781 @end menu 1874 @end menu
1782 1875
1783 @node The direction property 1876 @node The direction property
1784 @unnumberedsubsubsec The @code{direction} property 1877 @unnumberedsubsubsec The @code{direction} property
1785 1878
1786 @cindex down 1879 @cindex down
1787 @cindex up 1880 @cindex up
1788 @cindex center 1881 @cindex center
1789 @cindex neutral 1882 @cindex neutral
1790 1883
1791 The following example shows in bar 1 the default behavior of stems, 1884 The following example shows the default positioning of slurs in the
1792 with those on high notes pointing down and those on low notes pointing 1885 first bar, with slurs starting on high notes positioned above the notes
1793 up, followed by four notes with all stems forced down, four notes with 1886 and those starting on low notes positioned below, followed by a bar
1794 all stems forced up, and finally four notes reverted back to the 1887 with both slurs forced down, a bar with both slurs forced up, and
1795 default behavior. 1888 finally a bar with both slurs reverted back to the default behavior.
1796 1889
1797 @cindex Stem, example of overriding 1890 @cindex Slur, example of overriding
1798 @cindex direction property, example 1891 @cindex direction property, example
1799 1892
1800 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 1893 @lilypond[quote,fragment,verbatim]
1801 a4 g c a | 1894 a'4( g') c''( a') |
1802 \override Stem.direction = #DOWN 1895 \override Slur.direction = #DOWN
1803 a4 g c a | 1896 a'4( g') c''( a') |
1804 \override Stem.direction = #UP 1897 \override Slur.direction = #UP
1805 a4 g c a | 1898 a'4( g') c''( a') |
1806 \revert Stem.direction 1899 \revert Slur.direction
1807 a4 g c a | 1900 a'4( g') c''( a') |
1808 @end lilypond 1901 @end lilypond
1809 1902
1810 Here we use the constants @code{DOWN} and @code{UP}. 1903 Here we have used the constants @code{DOWN} and @code{UP}.
1811 These have the values @w{@code{-1}} and @code{+1} respectively, and 1904 These have the values @w{@code{-1}} and @code{+1} respectively, and
1812 these numerical values may be used instead. The value @code{0} 1905 these numerical values may be used instead. The value @code{0}
1813 may also be used in some cases. It is simply treated as meaning 1906 may also be used in some cases. It is simply treated as meaning
1814 @code{UP} for stems, but for some objects it means @q{center}. 1907 @code{UP} for slurs, but for some objects it means @q{center}.
1815 There is a constant, @code{CENTER} which has the value @code{0}. 1908 There is a constant, @code{CENTER} which has the value @code{0}.
1816 1909
1817 However, these explicit overrides are not usually used, as there are 1910 However, these explicit overrides are not usually used, as there are
1818 simpler equivalent predefined commands available. Here is a table of 1911 simpler equivalent predefined commands available. Here is a table of
1819 the commonest. The meaning of each is stated where it is not obvious. 1912 the commonest. The meaning of each is stated where it is not obvious.
1820 1913
1821 @multitable @columnfractions .2 .2 .25 .35 1914 @multitable @columnfractions .2 .2 .25 .35
1822 @headitem Down/Left 1915 @headitem Down/Left
1823 @tab Up/Right 1916 @tab Up/Right
1824 @tab Revert 1917 @tab Revert
(...skipping 30 matching lines...) Expand all
1855 @tab @code{\tieUp} 1948 @tab @code{\tieUp}
1856 @tab @code{\tieNeutral} 1949 @tab @code{\tieNeutral}
1857 @tab 1950 @tab
1858 @item @code{\tupletDown} 1951 @item @code{\tupletDown}
1859 @tab @code{\tupletUp} 1952 @tab @code{\tupletUp}
1860 @tab @code{\tupletNeutral} 1953 @tab @code{\tupletNeutral}
1861 @tab Tuplets are below/above notes 1954 @tab Tuplets are below/above notes
1862 @end multitable 1955 @end multitable
1863 1956
1864 The neutral/normal variants of these commands are implemented 1957 The neutral/normal variants of these commands are implemented
1865 using @code{\revert} and may @strong{not} be 1958 using @code{\revert} and these may @strong{not} be
1866 preceded by @code{\once}. If you wish to limit the 1959 preceded by @code{\once}. If you wish to limit the
1867 effect of the other commands (which are implemented using 1960 effect of the other commands (which are implemented using
1868 @code{\override}) to a single timestep, you can precede them with 1961 @code{\override}) to a single timestep, you can precede them with
1869 @code{\once} like you would do with explicit overrides. 1962 @code{\once} like you would do with explicit overrides.
1963
1964 Or, if just a single layout object needs to be forced up or down, the
1965 direction indicators, @code{^} or @code{_}, may be used:
1966
1967 @lilypond[quote,fragment,verbatim]
1968 a'4( g') c''( a') |
1969 a'4^( g') c''_( a') |
1970 @end lilypond
1870 1971
1871 @node Fingering 1972 @node Fingering
1872 @unnumberedsubsubsec Fingering 1973 @unnumberedsubsubsec Fingering
1873 1974
1874 @cindex fingering, placement 1975 @cindex fingering, placement
1875 @cindex fingering, chords 1976 @cindex fingering, chords
1876 1977
1877 The placement of fingering on single notes can also be controlled 1978 The placement of fingering on single notes can also be controlled
1878 by the @code{direction} property, but changing @code{direction} 1979 by the @code{direction} property, but changing @code{direction}
1879 has no effect on chords. As we shall see, there are special 1980 has no effect on chords. As we shall see, there are special
1880 commands which allow the fingering of individual notes 1981 commands which allow the fingering of individual notes
1881 of chords to be controlled, with the fingering being placed 1982 of chords to be controlled, with the fingering being placed
1882 above, below, to the left or to the right of each note. 1983 above, below, to the left or to the right of each note.
1883 1984
1884 First, here's the effect of @code{direction} on the fingering 1985 First, here's the effect of @code{direction} on the fingering
1885 attached to single notes. The first bar shows the default 1986 attached to single notes. The first bar shows the default
1886 behaviour, and the following two bars shows the effect of 1987 behaviour, and the following two bars shows the effect of
1887 specifying @code{DOWN} and @code{UP}: 1988 specifying @code{DOWN} and @code{UP}:
1888 1989
1889 @cindex Fingering, example of overriding 1990 @cindex Fingering, example of overriding
1890 @cindex direction property, example 1991 @cindex direction property, example
1891 1992
1892 @lilypond[quote,verbatim,relative=2] 1993 @lilypond[quote,verbatim]
1893 c4-5 a-3 f-1 c'-5 | 1994 \relative {
1894 \override Fingering.direction = #DOWN 1995 c''4-5 a-3 f-1 c'-5 |
1895 c4-5 a-3 f-1 c'-5 | 1996 \override Fingering.direction = #DOWN
1896 \override Fingering.direction = #UP 1997 c4-5 a-3 f-1 c'-5 |
1897 c4-5 a-3 f-1 c'-5 | 1998 \override Fingering.direction = #UP
1999 c4-5 a-3 f-1 c'-5 |
2000 }
1898 @end lilypond 2001 @end lilypond
1899 2002
1900 However, overriding the @code{direction} property is not the 2003 However, overriding the @code{direction} property is not the
1901 easiest way of manually setting the fingering above or below 2004 easiest way of manually setting the fingering above or below
1902 the notes; using @code{_} or @code{^} instead of @code{-} before 2005 the notes; using @code{_} or @code{^} instead of @code{-} before
1903 the fingering number is usually preferable. Here is the previous 2006 the fingering number is usually preferable. Here is the previous
1904 example using this method: 2007 example using this method:
1905 2008
1906 @cindex fingering example 2009 @cindex fingering example
1907 2010
1908 @lilypond[quote,verbatim,relative=2] 2011 @lilypond[quote,verbatim]
1909 c4-5 a-3 f-1 c'-5 | 2012 \relative {
1910 c4_5 a_3 f_1 c'_5 | 2013 c''4-5 a-3 f-1 c'-5 |
1911 c4^5 a^3 f^1 c'^5 | 2014 c4_5 a_3 f_1 c'_5 |
2015 c4^5 a^3 f^1 c'^5 |
2016 }
1912 @end lilypond 2017 @end lilypond
1913 2018
1914 The @code{direction} property is ignored for chords, but the 2019 The @code{direction} property is ignored for chords, but the
1915 directional prefixes, @code{_} and @code{^} do work. By default, 2020 directional prefixes, @code{_} and @code{^} do work. By default,
1916 the fingering is automatically placed both above and below the 2021 the fingering is automatically placed both above and below the
1917 notes of a chord, as shown: 2022 notes of a chord, as shown:
1918 2023
1919 @cindex fingering example 2024 @cindex fingering example
1920 2025
1921 @lilypond[quote,verbatim,relative=2] 2026 @lilypond[quote,verbatim]
1922 <c-5 g-3>4 2027 \relative {
1923 <c-5 g-3 e-2>4 2028 <c''-5 g-3>4
1924 <c-5 g-3 e-2 c-1>4 2029 <c-5 g-3 e-2>4
2030 <c-5 g-3 e-2 c-1>4
2031 }
1925 @end lilypond 2032 @end lilypond
1926 2033
1927 @noindent 2034 @noindent
1928 but this may be overridden to manually force all or any of the 2035 but this may be overridden to manually force all or any of the
1929 individual fingering numbers above or below: 2036 individual fingering numbers above or below:
1930 2037
1931 @cindex fingering example 2038 @cindex fingering example
1932 2039
1933 @lilypond[quote,verbatim,relative=2] 2040 @lilypond[quote,verbatim]
1934 <c-5 g-3 e-2 c-1>4 2041 \relative {
1935 <c^5 g_3 e_2 c_1>4 2042 <c''-5 g-3 e-2 c-1>4
1936 <c^5 g^3 e^2 c_1>4 2043 <c^5 g_3 e_2 c_1>4
2044 <c^5 g^3 e^2 c_1>4
2045 }
1937 @end lilypond 2046 @end lilypond
1938 2047
1939 Even greater control over the placement of fingering of the 2048 Even greater control over the placement of fingering of the
1940 individual notes in a chord is possible by using the 2049 individual notes in a chord is possible by using the
1941 @code{\set fingeringOrientations} command. The format of this 2050 @code{\set fingeringOrientations} command. The format of this
1942 command is: 2051 command is:
1943 2052
1944 @example 2053 @example
1945 @code{\set fingeringOrientations = #'([up] [left/right] [down])} 2054 @code{\set fingeringOrientations = #'([up] [left/right] [down])}
1946 @end example 2055 @end example
(...skipping 17 matching lines...) Expand all
1964 @warning{To control the placement of the fingering of a single 2073 @warning{To control the placement of the fingering of a single
1965 note using this command it is necessary to write it as a single 2074 note using this command it is necessary to write it as a single
1966 note chord by placing angle brackets round it.} 2075 note chord by placing angle brackets round it.}
1967 2076
1968 Here are a few examples: 2077 Here are a few examples:
1969 2078
1970 @cindex fingering example 2079 @cindex fingering example
1971 @cindex @code{\set}, example of using 2080 @cindex @code{\set}, example of using
1972 @cindex fingeringOrientations property, example 2081 @cindex fingeringOrientations property, example
1973 2082
1974 @lilypond[quote,fragment,ragged-right,verbatim,relative=1] 2083 @lilypond[quote,ragged-right,verbatim]
1975 \set fingeringOrientations = #'(left) 2084 \relative {
1976 <f-2>4 2085 \set fingeringOrientations = #'(left)
1977 <c-1 e-2 g-3 b-5>4 2086 <f'-2>4
1978 \set fingeringOrientations = #'(left) 2087 <c-1 e-2 g-3 b-5>4
1979 <f-2>4 2088 \set fingeringOrientations = #'(left)
1980 <c-1 e-2 g-3 b-5>4 | 2089 <f-2>4
1981 \set fingeringOrientations = #'(up left down) 2090 <c-1 e-2 g-3 b-5>4 |
1982 <f-2>4 2091 \set fingeringOrientations = #'(up left down)
1983 <c-1 e-2 g-3 b-5>4 2092 <f-2>4
1984 \set fingeringOrientations = #'(up left) 2093 <c-1 e-2 g-3 b-5>4
1985 <f-2>4 2094 \set fingeringOrientations = #'(up left)
1986 <c-1 e-2 g-3 b-5>4 | 2095 <f-2>4
1987 \set fingeringOrientations = #'(right) 2096 <c-1 e-2 g-3 b-5>4 |
1988 <f-2>4 2097 \set fingeringOrientations = #'(right)
1989 <c-1 e-2 g-3 b-5>4 2098 <f-2>4
2099 <c-1 e-2 g-3 b-5>4
2100 }
1990 @end lilypond 2101 @end lilypond
1991 2102
1992 @noindent 2103 @noindent
1993 If the fingering seems a little crowded the @code{font-size} 2104 If the fingering seems a little crowded the @code{font-size}
1994 could be reduced. The default value can be seen from the 2105 could be reduced. The default value can be seen from the
1995 @code{Fingering} object in the IR to be @w{@code{-5}}, so let's 2106 @code{Fingering} object in the IR to be @w{@code{-5}}, so let's
1996 try @w{@code{-7}}: 2107 try @w{@code{-7}}:
1997 2108
1998 @lilypond[quote,fragment,ragged-right,verbatim,relative=1] 2109 @lilypond[quote,ragged-right,verbatim]
1999 \override Fingering.font-size = #-7 2110 \relative {
2000 \set fingeringOrientations = #'(left) 2111 \override Fingering.font-size = #-7
2001 <f-2>4 2112 \set fingeringOrientations = #'(left)
2002 <c-1 e-2 g-3 b-5>4 2113 <f'-2>4
2003 \set fingeringOrientations = #'(left) 2114 <c-1 e-2 g-3 b-5>4
2004 <f-2>4 2115 \set fingeringOrientations = #'(left)
2005 <c-1 e-2 g-3 b-5>4 | 2116 <f-2>4
2006 \set fingeringOrientations = #'(up left down) 2117 <c-1 e-2 g-3 b-5>4 |
2007 <f-2>4 2118 \set fingeringOrientations = #'(up left down)
2008 <c-1 e-2 g-3 b-5>4 2119 <f-2>4
2009 \set fingeringOrientations = #'(up left) 2120 <c-1 e-2 g-3 b-5>4
2010 <f-2>4 2121 \set fingeringOrientations = #'(up left)
2011 <c-1 e-2 g-3 b-5>4 | 2122 <f-2>4
2012 \set fingeringOrientations = #'(right) 2123 <c-1 e-2 g-3 b-5>4 |
2013 <f-2>4 2124 \set fingeringOrientations = #'(right)
2014 <c-1 e-2 g-3 b-5>4 2125 <f-2>4
2126 <c-1 e-2 g-3 b-5>4
2127 }
2015 @end lilypond 2128 @end lilypond
2016 2129
2017 @node Outside-staff objects 2130 @node Outside-staff objects
2018 @subsection Outside-staff objects 2131 @subsection Outside-staff objects
2019 2132
2020 Outside-staff objects are automatically placed to avoid collisions. 2133 Outside-staff objects are automatically placed to avoid collisions.
2021 There are several ways to override the automatic placement if the 2134 There are several ways to override the automatic placement if the
2022 positioning is not optimum. 2135 positioning is not optimum.
2023 2136
2024 @menu 2137 @menu
2025 * The outside-staff-priority property:: 2138 * The outside-staff-priority property::
2026 * The \textLengthOn command:: 2139 * The textLengthOn command::
2027 * Dynamics placement:: 2140 * Dynamics placement::
2028 * Grob sizing:: 2141 * Grob sizing::
2029 @end menu 2142 @end menu
2030 2143
2031 2144
2032 @node The outside-staff-priority property 2145 @node The outside-staff-priority property
2033 @unnumberedsubsubsec The @code{outside-staff-priority} property 2146 @unnumberedsubsubsec The @code{outside-staff-priority} property
2034 2147
2035 Objects with the lower value of the @code{outside-staff-priority} 2148 Objects with the lower value of the @code{outside-staff-priority}
2036 property are placed nearer to the staff, and other outside-staff 2149 property are placed nearer to the staff, and other outside-staff
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
2099 @cindex ottava bracket 2212 @cindex ottava bracket
2100 2213
2101 @funindex \startTextSpan 2214 @funindex \startTextSpan
2102 @funindex startTextSpan 2215 @funindex startTextSpan
2103 @funindex \stopTextSpan 2216 @funindex \stopTextSpan
2104 @funindex stopTextSpan 2217 @funindex stopTextSpan
2105 2218
2106 @cindex TextSpanner, example of overriding 2219 @cindex TextSpanner, example of overriding
2107 @cindex bound-details property, example 2220 @cindex bound-details property, example
2108 2221
2109 @lilypond[quote,fragment,ragged-right,verbatim,relative=1] 2222 @lilypond[quote,fragment,ragged-right,verbatim]
2110 % Set details for later Text Spanner 2223 % Set details for later Text Spanner
2111 \override TextSpanner.bound-details.left.text 2224 \override TextSpanner.bound-details.left.text
2112 = \markup { \small \bold Slower } 2225 = \markup { \small \bold Slower }
2113 % Place dynamics above staff 2226 % Place dynamics above staff
2114 \dynamicUp 2227 \dynamicUp
2115 % Start Ottava Bracket 2228 % Start Ottava Bracket
2116 \ottava #1 2229 \ottava #1
2117 c'4 \startTextSpan 2230 c''4 \startTextSpan
2118 % Add Dynamic Text and hairpin 2231 % Add Dynamic Text and hairpin
2119 c4\pp\< 2232 c''4\pp\<
2120 c4 2233 c''4
2121 % Add Text Script 2234 % Add Text Script
2122 c4^Text | 2235 c''4^Text |
2123 c4 c 2236 c''4 c''
2124 % Add Dynamic Text and terminate hairpin 2237 % Add Dynamic Text and terminate hairpin
2125 c4\ff c \stopTextSpan | 2238 c''4\ff c'' \stopTextSpan |
2126 % Stop Ottava Bracket 2239 % Stop Ottava Bracket
2127 \ottava #0 2240 \ottava #0
2128 c,4 c c c | 2241 c'4 c' c' c' |
2129 @end lilypond 2242 @end lilypond
2130 2243
2131 This example also shows how to create Text Spanners -- 2244 This example also shows how to create Text Spanners --
2132 text with extender lines above a section of music. The 2245 text with extender lines above a section of music. The
2133 spanner extends from the @code{\startTextSpan} command to 2246 spanner extends from the @code{\startTextSpan} command to
2134 the @code{\stopTextSpan} command, and the format of the 2247 the @code{\stopTextSpan} command, and the format of the
2135 text is defined by the @code{\override TextSpanner} command. 2248 text is defined by the @code{\override TextSpanner} command.
2136 For more details see @ruser{Text spanners}. 2249 For more details see @ruser{Text spanners}.
2137 2250
2138 It also shows how ottava brackets are created. 2251 It also shows how ottava brackets are created.
(...skipping 10 matching lines...) Expand all
2149 overridden. Suppose we would like the ottava bracket to be placed 2262 overridden. Suppose we would like the ottava bracket to be placed
2150 below the text spanner in the example above. All we need to do is to 2263 below the text spanner in the example above. All we need to do is to
2151 look up the priority of @code{OttavaBracket} in the IR or in the 2264 look up the priority of @code{OttavaBracket} in the IR or in the
2152 tables above, and reduce it to a value lower than that of a 2265 tables above, and reduce it to a value lower than that of a
2153 @code{TextSpanner}, remembering that @code{OttavaBracket} is created 2266 @code{TextSpanner}, remembering that @code{OttavaBracket} is created
2154 in the @code{Staff} context: 2267 in the @code{Staff} context:
2155 2268
2156 @cindex TextSpanner, example of overriding 2269 @cindex TextSpanner, example of overriding
2157 @cindex bound-details property, example 2270 @cindex bound-details property, example
2158 2271
2159 @lilypond[quote,fragment,ragged-right,verbatim,relative=1] 2272 @lilypond[quote,fragment,ragged-right,verbatim]
2160 % Set details for later Text Spanner 2273 % Set details for later Text Spanner
2161 \override TextSpanner.bound-details.left.text 2274 \override TextSpanner.bound-details.left.text
2162 = \markup { \small \bold Slower } 2275 = \markup { \small \bold Slower }
2163 % Place dynamics above staff 2276 % Place dynamics above staff
2164 \dynamicUp 2277 \dynamicUp
2165 % Place following Ottava Bracket below Text Spanners 2278 % Place following Ottava Bracket below Text Spanners
2166 \once \override Staff.OttavaBracket.outside-staff-priority = #340 2279 \once \override Staff.OttavaBracket.outside-staff-priority = #340
2167 % Start Ottava Bracket 2280 % Start Ottava Bracket
2168 \ottava #1 2281 \ottava #1
2169 c'4 \startTextSpan 2282 c''4 \startTextSpan
2170 % Add Dynamic Text 2283 % Add Dynamic Text
2171 c4\pp 2284 c''4\pp
2172 % Add Dynamic Line Spanner 2285 % Add Dynamic Line Spanner
2173 c4\< 2286 c''4\<
2174 % Add Text Script 2287 % Add Text Script
2175 c4^Text | 2288 c''4^Text |
2176 c4 c 2289 c''4 c''
2177 % Add Dynamic Text 2290 % Add Dynamic Text
2178 c4\ff c \stopTextSpan | 2291 c''4\ff c'' \stopTextSpan |
2179 % Stop Ottava Bracket 2292 % Stop Ottava Bracket
2180 \ottava #0 2293 \ottava #0
2181 c,4 c c c | 2294 c'4 c' c' c' |
2182 @end lilypond 2295 @end lilypond
2183 2296
2184 Note that some of these objects, in particular bar numbers, 2297 Note that some of these objects, in particular bar numbers,
2185 metronome marks and rehearsal marks, live by default in the 2298 metronome marks and rehearsal marks, live by default in the
2186 @code{Score} context, so be sure to use the correct context 2299 @code{Score} context, so be sure to use the correct context
2187 when these are being overriden. 2300 when these are being overriden.
2188 2301
2189 @cindex slurs and outside-staff-priority 2302 @cindex slurs and outside-staff-priority
2190 @cindex slurs and articulations 2303 @cindex slurs and articulations
2191 @cindex articulations and slurs 2304 @cindex articulations and slurs
2192 2305
2193 Slurs by default are classed as within-staff objects, but 2306 Slurs by default are classed as within-staff objects, but
2194 they often appear above the staff if the notes to 2307 they often appear above the staff if the notes to
2195 which they are attached are high on the staff. This can push 2308 which they are attached are high on the staff. This can push
2196 outside-staff objects such as articulations too high, as the slur 2309 outside-staff objects such as articulations too high, as the slur
2197 will be placed first. The @code{avoid-slur} property of the 2310 will be placed first. The @code{avoid-slur} property of the
2198 articulation can be set to @code{'inside} to bring the articulation 2311 articulation can be set to @code{'inside} to bring the articulation
2199 inside the slur, but the @code{avoid-slur} property is effective 2312 inside the slur, but the @code{avoid-slur} property is effective
2200 only if the @code{outside-staff-priority} is also set to @code{#f}. 2313 only if the @code{outside-staff-priority} is also set to @code{#f}.
2201 Alternatively, the @code{outside-staff-priority} of the slur 2314 Alternatively, the @code{outside-staff-priority} of the slur
2202 can be set to a numerical value to cause it to be placed along with 2315 can be set to a numerical value to cause it to be placed along with
2203 other outside-staff objects according to that value. Here's an 2316 other outside-staff objects according to that value. Here's an
2204 example showing the effect of the two methods: 2317 example showing the effect of the two methods:
2205 2318
2206 @lilypond[quote,verbatim,relative=2] 2319 @lilypond[quote,verbatim]
2207 c4( c^\markup { \tiny \sharp } d4.) c8 | 2320 \relative c'' {
2208 c4( 2321 c4( c^\markup { \tiny \sharp } d4.) c8 |
2209 \once \override TextScript.avoid-slur = #'inside 2322 c4(
2210 \once \override TextScript.outside-staff-priority = ##f 2323 \once \override TextScript.avoid-slur = #'inside
2211 c4^\markup { \tiny \sharp } d4.) c8 | 2324 \once \override TextScript.outside-staff-priority = ##f
2212 \once \override Slur.outside-staff-priority = #500 2325 c4^\markup { \tiny \sharp } d4.) c8 |
2213 c4( c^\markup { \tiny \sharp } d4.) c8 | 2326 \once \override Slur.outside-staff-priority = #500
2327 c4( c^\markup { \tiny \sharp } d4.) c8 |
2328 }
2214 @end lilypond 2329 @end lilypond
2215 2330
2216 Changing the @code{outside-staff-priority} can also be used to 2331 Changing the @code{outside-staff-priority} can also be used to
2217 control the vertical placement of individual objects, although 2332 control the vertical placement of individual objects, although
2218 the results may not always be desirable. Suppose we would 2333 the results may not always be desirable. Suppose we would
2219 like @qq{Text3} to be placed above @qq{Text4} in the example 2334 like @qq{Text3} to be placed above @qq{Text4} in the example
2220 under Automatic behavior, above (see @ref{Automatic behavior}). 2335 under Automatic behavior, above (see @ref{Automatic behavior}).
2221 All we need to do is to look up the priority of @code{TextScript} 2336 All we need to do is to look up the priority of @code{TextScript}
2222 in the IR or in the tables above, and increase the priority of 2337 in the IR or in the tables above, and increase the priority of
2223 @qq{Text3} to a higher value: 2338 @qq{Text3} to a higher value:
2224 2339
2225 @cindex TextScript, example of overriding 2340 @cindex TextScript, example of overriding
2226 @cindex outside-staff-priority property, example 2341 @cindex outside-staff-priority property, example
2227 2342
2228 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 2343 @lilypond[quote,fragment,ragged-right,verbatim]
2229 c2^"Text1" 2344 c''2^"Text1"
2230 c2^"Text2" | 2345 c''2^"Text2" |
2231 \once \override TextScript.outside-staff-priority = #500 2346 \once \override TextScript.outside-staff-priority = #500
2232 c2^"Text3" 2347 c''2^"Text3"
2233 c2^"Text4" | 2348 c''2^"Text4" |
2234 @end lilypond 2349 @end lilypond
2235 2350
2236 This certainly lifts @qq{Text3} above @qq{Text4} but it also lifts it 2351 This certainly lifts @qq{Text3} above @qq{Text4} but it also lifts it
2237 above @qq{Text2}, and @qq{Text4} now drops down. Perhaps this is not 2352 above @qq{Text2}, and @qq{Text4} now drops down. Perhaps this is not
2238 so good. What we would really like to do is to position all the 2353 so good. What we would really like to do is to position all the
2239 annotation at the same distance above the staff. To do this, we 2354 annotation at the same distance above the staff. To do this, we
2240 clearly will need to space the notes out horizontally to make more 2355 clearly will need to space the notes out horizontally to make more
2241 room for the text. This is done using the @code{textLengthOn} 2356 room for the text. This is done using the @code{textLengthOn}
2242 command. 2357 command.
2243 2358
2244 @node The \textLengthOn command 2359 @node The textLengthOn command
2245 @unnumberedsubsubsec The @code{\textLengthOn} command 2360 @unnumberedsubsubsec The @code{@bs{}textLengthOn} command
2246 2361
2247 @cindex notes, spreading out with text 2362 @cindex notes, spreading out with text
2248 2363
2249 @funindex \textLengthOn 2364 @funindex \textLengthOn
2250 @funindex textLengthOn 2365 @funindex textLengthOn
2251 @funindex \textLengthOff 2366 @funindex \textLengthOff
2252 @funindex textLengthOff 2367 @funindex textLengthOff
2253 2368
2254 By default, text produced by markup takes up no horizontal space 2369 By default, text produced by markup takes up no horizontal space
2255 as far as laying out the music is concerned. The @code{\textLengthOn} 2370 as far as laying out the music is concerned. The @code{\textLengthOn}
2256 command reverses this behavior, causing the notes to be spaced 2371 command reverses this behavior, causing the notes to be spaced
2257 out as far as is necessary to accommodate the text: 2372 out as far as is necessary to accommodate the text:
2258 2373
2259 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 2374 @lilypond[quote,fragment,ragged-right,verbatim]
2260 \textLengthOn % Cause notes to space out to accommodate text 2375 \textLengthOn % Cause notes to space out to accommodate text
2261 c2^"Text1" 2376 c''2^"Text1"
2262 c2^"Text2" | 2377 c''2^"Text2" |
2263 c2^"Text3" 2378 c''2^"Text3"
2264 c2^"Text4" | 2379 c''2^"Text4" |
2265 @end lilypond 2380 @end lilypond
2266 2381
2267 The command to revert to the default behavior is 2382 The command to revert to the default behavior is
2268 @code{\textLengthOff}. Remember @code{\once} only works with 2383 @code{\textLengthOff}. Alternatively, @code{\once} may be used
2269 @code{\override}, @code{\set}, @code{\revert} or @code{\unset}, 2384 with @code{\textLengthOn} if the effect is to be limited to just a
2270 so cannot be used with @code{\textLengthOn}. 2385 single musical moment.
2386 The corresponding spacing behavior for rehearsal marks and tempo
2387 indications is independently controlled with the commands
2388 @code{\markLengthOn} and @code{\markLengthOff}.
2271 2389
2272 @cindex markup text, allowing collisions 2390 @cindex markup text, allowing collisions
2273 2391
2274 Markup text will also avoid notes which project above the staff. 2392 Markup text will also avoid notes which project above the staff.
2275 If this is not desired, the automatic displacement upwards may 2393 If this is not desired, the automatic displacement upwards may
2276 be turned off by setting the priority to @code{#f}. Here's an 2394 be turned off by setting the priority to @code{#f}. Here's an
2277 example to show how markup text interacts with such notes. 2395 example to show how markup text interacts with such notes.
2278 2396
2279 @cindex TextScript, example of overriding 2397 @cindex TextScript, example of overriding
2280 @cindex outside-staff-priority property, example 2398 @cindex outside-staff-priority property, example
2281 2399
2282 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 2400 @lilypond[quote,ragged-right,verbatim]
2283 % This markup is short enough to fit without collision 2401 \relative {
2284 c2^"Tex" c'' | 2402 % This markup is short enough to fit without collision
2285 R1 | 2403 c''2^"Tex" c'' |
2286 2404 R1 |
2287 % This is too long to fit, so it is displaced upwards 2405
2288 c,,2^"Text" c'' | 2406 % This is too long to fit, so it is displaced upwards
2289 R1 | 2407 c,,2^"Text" c'' |
2290 2408 R1 |
2291 % Turn off collision avoidance 2409
2292 \once \override TextScript.outside-staff-priority = ##f 2410 % Turn off collision avoidance
2293 c,,2^"Long Text " c'' | 2411 \once \override TextScript.outside-staff-priority = ##f
2294 R1 | 2412 c,,2^"Long Text " c'' |
2295 2413 R1 |
2296 % Turn off collision avoidance 2414
2297 \once \override TextScript.outside-staff-priority = ##f 2415 % Turn off collision avoidance
2298 \textLengthOn % and turn on textLengthOn 2416 \once \override TextScript.outside-staff-priority = ##f
2299 c,,2^"Long Text " % Spaces at end are honored 2417 \textLengthOn % and turn on textLengthOn
2300 c''2 | 2418 c,,2^"Long Text " % Spaces at end are honored
2419 c''2 |
2420 }
2301 @end lilypond 2421 @end lilypond
2302 2422
2303 @node Dynamics placement 2423 @node Dynamics placement
2304 @unnumberedsubsubsec Dynamics placement 2424 @unnumberedsubsubsec Dynamics placement
2305 2425
2306 @cindex tweaking dynamics placement 2426 @cindex tweaking dynamics placement
2307 @cindex dynamics, tweaking placement 2427 @cindex dynamics, tweaking placement
2308 2428
2309 Dynamic markings will normally be positioned beneath the 2429 Dynamic markings will normally be positioned beneath the
2310 staff, but may be positioned above with the @code{\dynamicUp} 2430 staff, but may be positioned above with the @code{\dynamicUp}
2311 command. They will be positioned vertically relative to the 2431 command. They will be positioned vertically relative to the
2312 note to which they are attached, and will float below (or above) 2432 note to which they are attached, and will float below (or above)
2313 all within-staff objects such as phrasing slurs and bar numbers. 2433 all within-staff objects such as phrasing slurs and bar numbers.
2314 This can give quite acceptable results, as this example 2434 This can give quite acceptable results, as this example
2315 shows: 2435 shows:
2316 2436
2317 @lilypond[quote,fragment,ragged-right,verbatim,relative=1] 2437 @lilypond[quote,ragged-right,verbatim]
2318 \clef "bass" 2438 \relative {
2319 \key aes \major 2439 \clef "bass"
2320 \time 9/8 2440 \key aes \major
2321 \dynamicUp 2441 \time 9/8
2322 bes4.~\f\< \( bes4 bes8 des4\ff\> c16 bes\! | 2442 \dynamicUp
2323 ees,2.~\)\mf ees4 r8 | 2443 bes4.~\f\< \( bes4 bes8 des4\ff\> c16 bes\! |
2444 ees,2.~\)\mf ees4 r8 |
2445 }
2324 @end lilypond 2446 @end lilypond
2325 2447
2326 However, if the notes and attached dynamics are close 2448 However, if the notes and attached dynamics are close
2327 together the automatic placement will avoid collisions 2449 together the automatic placement will avoid collisions
2328 by displacing later dynamic markings further away, but this may 2450 by displacing later dynamic markings further away, but this may
2329 not be the optimum placement, as this rather artificial example 2451 not be the optimum placement, as this rather artificial example
2330 shows: 2452 shows:
2331 2453
2332 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 2454 @lilypond[quote,ragged-right,verbatim,fragment]
2333 \dynamicUp 2455 \dynamicUp
2334 a4\f b\mf c\mp b\p 2456 \relative { a'4\f b\mf a\mp b\p }
2335 @end lilypond 2457 @end lilypond
2336 2458
2337 @noindent 2459 @noindent
2338 Should a similar situation arise in @q{real} music, it may be 2460 Should a similar situation arise in @q{real} music, it may be
2339 preferable to space out the notes a little further, so the dynamic 2461 preferable to space out the notes a little further, so the dynamic
2340 markings can all fit at the same vertical distance from the staff. We 2462 markings can all fit at the same vertical distance from the staff. We
2341 were able to do this for markup text by using the @code{\textLengthOn} 2463 were able to do this for markup text by using the @code{\textLengthOn}
2342 command, but there is no equivalent command for dynamic marks. So we 2464 command, but there is no equivalent command for dynamic marks. So we
2343 shall have to work out how to do this using @code{\override} commands. 2465 shall have to work out how to do this using @code{\override} commands.
2344 2466
(...skipping 12 matching lines...) Expand all
2357 numbers, @code{X-extent}, which say where the left and right 2479 numbers, @code{X-extent}, which say where the left and right
2358 edges are relative to the reference point. The vertical extent 2480 edges are relative to the reference point. The vertical extent
2359 is similarly defined by a pair of numbers, @code{Y-extent}. 2481 is similarly defined by a pair of numbers, @code{Y-extent}.
2360 These are properties of all grobs which support the 2482 These are properties of all grobs which support the
2361 @code{grob-interface}. 2483 @code{grob-interface}.
2362 2484
2363 @cindex @code{extra-spacing-width} 2485 @cindex @code{extra-spacing-width}
2364 2486
2365 By default, outside-staff objects are given a width of zero so 2487 By default, outside-staff objects are given a width of zero so
2366 that they may overlap in the horizontal direction. This is done 2488 that they may overlap in the horizontal direction. This is done
2367 by the trick of adding infinity to the leftmost extent and 2489 by the trick of making the leftmost extent infinity and
2368 minus infinity to the rightmost extent by setting the 2490 the rightmost extent minus infinity by setting the
2369 @code{extra-spacing-width} to @code{'(+inf.0 . -inf.0)}. So 2491 @code{extra-spacing-width} to @code{'(+inf.0 . -inf.0)}. To
2370 to ensure they do not overlap in the horizontal direction we 2492 ensure they do not overlap in the horizontal direction we
2371 must override this value of @code{extra-spacing-width} to 2493 must override this value of @code{extra-spacing-width} to give them
2372 @code{'(0 . 0)} so the true width shines through. This is 2494 a little extra spacing. The units are the space between two staff
2373 the command to do this for dynamic text: 2495 lines, so moving the left edge half a unit to the left and the
2496 right edge half a unit to the right should do it:
2374 2497
2375 @example 2498 @example
2376 \override DynamicText.extra-spacing-width = #'(0 . 0) 2499 \override DynamicText.extra-spacing-width = #'(-0.5 . 0.5)
2377 @end example 2500 @end example
2378 2501
2379 @noindent 2502 @noindent
2380 Let's see if this works in our previous example: 2503 Let's see if this works in our previous example:
2381 2504
2382 @cindex DynamicText, example of overriding 2505 @cindex DynamicText, example of overriding
2383 @cindex extra-spacing-width property, example 2506 @cindex extra-spacing-width property, example
2384 2507
2385 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 2508
2386 \dynamicUp 2509 @lilypond[quote,ragged-right,verbatim,fragment]
2387 \override DynamicText.extra-spacing-width = #'(0 . 0)
2388 a4\f b\mf c\mp b\p |
2389 @end lilypond
2390
2391 @noindent
2392 Well, it has certainly stopped the dynamic marks being
2393 displaced, but two problems remain. The marks should be
2394 spaced a little further apart and it would be better
2395 if they were all the same distance from the staff.
2396 We can solve the first problem easily. Instead of making
2397 the @code{extra-spacing-width} zero we could add a little
2398 more to it. The units are the space between two staff
2399 lines, so moving the left edge half a unit to the left and the
2400 right edge half a unit to the right should do it:
2401
2402 @cindex DynamicText, example of overriding
2403 @cindex extra-spacing-width property, example
2404
2405 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
2406 \dynamicUp 2510 \dynamicUp
2407 % Extend width by 1 staff space 2511 % Extend width by 1 staff space
2408 \override DynamicText.extra-spacing-width = #'(-0.5 . 0.5) 2512 \override DynamicText.extra-spacing-width = #'(-0.5 . 0.5)
2409 a4\f b\mf c\mp b\p 2513 \relative { a'4\f b\mf a\mp b\p }
2410 @end lilypond 2514 @end lilypond
2411 2515
2412 @noindent 2516 @noindent
2413 This looks better, but maybe we would prefer the dynamic marks 2517 This looks better, but maybe we would prefer the dynamic marks
2414 to be aligned along the same baseline rather than going up and 2518 to be aligned along the same baseline rather than going up and
2415 down with the notes. The property to do this is 2519 down with the notes. The property to do this is
2416 @code{staff-padding} which is covered in the following section. 2520 @code{staff-padding} which is covered in the section on collisions
2417 2521 (see @ref{Collisions of objects}).
2522
2523
2524 @node Vertical spacing
2525 @section Vertical spacing
2526
2527 As a rule, LilyPond's vertical spacing of musical objects is pretty
2528 good. Let's see how it does with a simple song, with 2 voices and
2529 piano accompaniment:
2530
2531 @lilypond[quote,fragment,ragged-right]
2532 <<
2533 \new ChoirStaff
2534 <<
2535 \new Staff {
2536 \new Voice = "music" {
2537 b'2 c' c' c'
2538 }
2539 }
2540 \new Lyrics
2541 \lyricsto "music" {
2542 Here are some lyrics
2543 }
2544 \new Staff {
2545 \clef bass e'2 f e c
2546 }
2547 >>
2548 \new PianoStaff
2549 <<
2550 \new Staff {
2551 g''2 c'' c'' a''
2552 }
2553 \new Staff {
2554 \clef bass e2 f c e
2555 }
2556 >>
2557 >>
2558 @end lilypond
2559
2560 There's nothing wrong with the default vertical spacing. However, let's
2561 assume that you're working with a publisher with some specific
2562 requirements for vertical spacing of staves and lyrics: they want
2563 the lyrics spaced away from any notes, they want the piano
2564 accompaniment spaced away from the vocal line and they want the two
2565 piano staves pushed together tightly. Let's start with the lyrics.
2566
2567 Lyrics sit within a system, and therefore the commands to space them
2568 are found in @ruser{Flexible vertical spacing within systems}. It
2569 tells us that lyrics are @code{non-staff lines} and therefore the
2570 command to change their spacing will refer to the @code{nonstaff}
2571 property. Spacing them away from the staff to which they relate
2572 (the top line) will use the @code{relatedstaff} property. Spacing
2573 them from the lower line will use the @code{unrelatedstaff} property.
2574 The vocal parts are part of a @code{VerticalAxisGroup}, so we need to
2575 adjust its properties. Let's try it and see if it works.
2576
2577 @lilypond[quote,fragment,ragged-right,verbatim]
2578 <<
2579 \new ChoirStaff
2580 <<
2581 \new Staff {
2582 \new Voice = "music" {
2583 b'2 c' c' c'
2584 }
2585 }
2586 \new Lyrics \with {
2587 \override VerticalAxisGroup.
2588 nonstaff-relatedstaff-spacing.padding = #5
2589 \override VerticalAxisGroup.
2590 nonstaff-unrelatedstaff-spacing.padding = #5
2591 }
2592 \lyricsto "music" {
2593 Here are some lyrics
2594 }
2595 \new Staff {
2596 \clef bass e'2 f e c
2597 }
2598 >>
2599 \new PianoStaff
2600 <<
2601 \new Staff {
2602 g''2 c'' c'' a''
2603 }
2604 \new Staff {
2605 \clef bass e2 f c e
2606 }
2607 >>
2608 >>
2609 @end lilypond
2610
2611 Well - yes it does, but perhaps too well. When we set the
2612 @code{padding} to 5, LilyPond adds 5 staff spaces to the distance
2613 between objects, which is too much for us here. We'll use 2.
2614
2615 Next, let's move the piano music away from the vocal parts. The
2616 vocal music is a @code{ChoirStaff}, so we need to increase the
2617 spacing between that group of staves and the piano staff below.
2618 We'll do this by changing the @code{basic-distance} of the
2619 @code{StaffGrouper}'s @code{staffgroup-staff-spacing}.
2620
2621 @lilypond[quote,fragment,ragged-right,verbatim]
2622 <<
2623 \new ChoirStaff \with {
2624 \override StaffGrouper.
2625 staffgroup-staff-spacing.basic-distance = #15
2626 }
2627 <<
2628 \new Staff {
2629 \new Voice = "music" {
2630 b'2 c' c' c'
2631 }
2632 }
2633 \new Lyrics \with {
2634 \override VerticalAxisGroup.
2635 nonstaff-relatedstaff-spacing.padding = #2
2636 \override VerticalAxisGroup.
2637 nonstaff-unrelatedstaff-spacing.padding = #2
2638 }
2639 \lyricsto "music" {
2640 Here are some lyrics
2641 }
2642 \new Staff {
2643 \clef bass e'2 f e c
2644 }
2645 >>
2646 \new PianoStaff
2647 <<
2648 \new Staff {
2649 g''2 c'' c'' a''
2650 }
2651 \new Staff {
2652 \clef bass e2 f c e
2653 }
2654 >>
2655 >>
2656 @end lilypond
2657
2658 Excellent. Now just for the last requirement to make the piano staves
2659 closer together. To do this, we again alter the properties of the
2660 @code{StaffGrouper}, but this time we're going to reduce both
2661 the @code{basic-distance} and the @code{padding}. We can do this
2662 as shown below.
2663
2664 @lilypond[quote,fragment,ragged-right,verbatim]
2665 <<
2666 \new ChoirStaff \with {
2667 \override StaffGrouper.
2668 staffgroup-staff-spacing.basic-distance = #15
2669 }
2670 <<
2671 \new Staff {
2672 \new Voice = "music" {
2673 b'2 c' c' c'
2674 }
2675 }
2676 \new Lyrics \with {
2677 \override VerticalAxisGroup.
2678 nonstaff-relatedstaff-spacing.padding = #2
2679 \override VerticalAxisGroup.
2680 nonstaff-unrelatedstaff-spacing.padding = #2
2681 }
2682 \lyricsto "music" {
2683 Here are some lyrics
2684 }
2685 \new Staff {
2686 \clef bass e'2 f e c
2687 }
2688 >>
2689 \new PianoStaff \with {
2690 \override StaffGrouper.staff-staff-spacing = #'(
2691 (basic-distance . 0)
2692 (padding . 0))
2693 }
2694 <<
2695 \new Staff {
2696 g''2 c'' c'' a''
2697 }
2698 \new Staff {
2699 \clef bass e2 f c e
2700 }
2701 >>
2702 >>
2703 @end lilypond
2704
2705 That's put them really close together -- but it's what
2706 the publisher wanted. They could be moved further
2707 apart by altering the @code{padding} or @code{basic-distance}
2708 if wanted.
2709
2710 There are many ways of altering vertical spacing. A key point
2711 to remember is that the spacing between objects in a
2712 @code{StaffGroup} (like @code{GrandStaff} or
2713 @code{PianoStaff} groups) is controlled by the spacing variables
2714 of the @code{StaffGrouper}. Spacing from ungrouped staves
2715 (like @code{Lyrics} and @code{Staff}) is controlled by the
2716 variables of the @code{VerticalAxisGroup}. See the
2717 @ruser{Flexible vertical spacing paper variables} and
2718 @ruser{Flexible vertical spacing within systems} for more
2719 details.
2418 2720
2419 @node Collisions of objects 2721 @node Collisions of objects
2420 @section Collisions of objects 2722 @section Collisions of objects
2421 2723
2422 @menu 2724 @menu
2423 * Moving objects:: 2725 * Moving objects::
2424 * Fixing overlapping notation:: 2726 * Fixing overlapping notation::
2425 * Real music example:: 2727 * Real music example::
2426 @end menu 2728 @end menu
2427 2729
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2495 the separation from the note heads and between individual accidentals. 2797 the separation from the note heads and between individual accidentals.
2496 So only the @code{right-padding} property of the @code{AccidentalPlacement} 2798 So only the @code{right-padding} property of the @code{AccidentalPlacement}
2497 object has any effect on the placement of the accidentals. 2799 object has any effect on the placement of the accidentals.
2498 2800
2499 The @code{staff-padding} property is closely related to the 2801 The @code{staff-padding} property is closely related to the
2500 @code{padding} property: @code{padding} controls the minimum amount of 2802 @code{padding} property: @code{padding} controls the minimum amount of
2501 space between any object which supports the 2803 space between any object which supports the
2502 @code{side-position-interface} and the nearest other object (generally 2804 @code{side-position-interface} and the nearest other object (generally
2503 the note or the staff lines); @code{staff-padding} applies only to 2805 the note or the staff lines); @code{staff-padding} applies only to
2504 those objects which are always set outside the staff -- it controls 2806 those objects which are always set outside the staff -- it controls
2505 the minimum amount of space that should be inserted between that 2807 the minimum distance from the staff to the outside-staff object.
2506 object and the staff. Note that @code{staff-padding} has no effect on 2808 Note that @code{staff-padding} has no effect on
2507 objects which are positioned relative to the note rather than the 2809 objects that are positioned relative to the note rather than the
2508 staff, even though it may be overridden without error for such objects 2810 staff, even though it may be overridden without error for such objects
2509 -- it is simply ignored. 2811 -- it is simply ignored.
2510 2812
2511 To discover which padding property is required for the object you wish 2813 To discover which padding property is required for the object you wish
2512 to reposition, you need to return to the IR and look up the object's 2814 to reposition, you need to return to the IR and look up the object's
2513 properties. Be aware that the padding properties might not be located 2815 properties. Be aware that the padding properties might not be located
2514 in the obvious object, so look in objects that appear to be related. 2816 in the obvious object, so look in objects that appear to be related.
2515 2817
2516 All padding values are measured in staff spaces. For most 2818 All padding values are measured in staff spaces. For most
2517 objects, this value is set by default to be around 1.0 or less 2819 objects, this value is set by default to be around 1.0 or less
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2558 2860
2559 @code{staff-position} is a property of the 2861 @code{staff-position} is a property of the
2560 @code{staff-symbol-referencer-interface}, which is supported by 2862 @code{staff-symbol-referencer-interface}, which is supported by
2561 objects which are positioned relative to the staff. It specifies 2863 objects which are positioned relative to the staff. It specifies
2562 the vertical position of the object relative to the center line 2864 the vertical position of the object relative to the center line
2563 of the staff in half staff-spaces. It is useful in resolving 2865 of the staff in half staff-spaces. It is useful in resolving
2564 collisions between layout objects like multi-measure rests, ties 2866 collisions between layout objects like multi-measure rests, ties
2565 and notes in different voices. 2867 and notes in different voices.
2566 2868
2567 @item 2869 @item
2870 @code{horizontal-shift}
2871
2872 @cindex horizontal-shift property
2873 @cindex note column
2874 @cindex note collisions
2875 @cindex collisions, notes
2876 @cindex shift commands
2877 @funindex \shiftOff
2878 @funindex shiftOff
2879 @funindex \shiftOn
2880 @funindex shiftOn
2881 @funindex \shiftOnn
2882 @funindex shiftOnn
2883 @funindex \shiftOnnn
2884 @funindex shiftOnnn
2885
2886 Within a voice, all the notes occuring at the same musical moment are
2887 grouped into a note column, and a @code{NoteColumn} object is created
2888 to control the horizontal positioning of that group of notes (see
2889 @qq{Note columns} in @ref{Explicitly instantiating voices}). If
2890 @emph{and only if} two or more note columns within a single Staff
2891 context, both with stems in the same direction, occur at the same
2892 musical moment, the values of their @code{horizontal-shift} properties
2893 are used to rank them and the columns in the higher ranks are
2894 progessively offset to avoid collisions of the noteheads. This
2895 property is set by the @code{\voiceXXX} commands and may be overridden
2896 directly with an @code{\override} command or, more usually, by the
2897 @code{\shiftOn} commands. Note that this property is used to
2898 @emph{rank} the note columns for off-setting - it does not specify the
2899 magnitude of the offset, which is progressively increased in steps
2900 based on the note head's width for each rank. The steps are usually
2901 of half a note head's width, but may be a full note head's width when
2902 a closely spaced group of notes is involved.
2903
2904 @item
2568 @code{force-hshift} 2905 @code{force-hshift}
2569 2906
2570 @cindex force-hshift property 2907 @cindex force-hshift property
2571
2572 Closely spaced notes in a chord, or notes occurring at the same
2573 time in different voices, are arranged in two, occasionally more,
2574 columns to prevent the note heads overlapping. These are called
2575 note columns, and an object called @code{NoteColumn} is created
2576 to lay out the notes in that column.
2577 2908
2578 The @code{force-hshift} property is a property of a @code{NoteColumn} 2909 The @code{force-hshift} property is a property of a @code{NoteColumn}
2579 (actually of the @code{note-column-interface}). Changing it permits a 2910 (actually of the @code{note-column-interface}). Changing it permits a
2580 note column to be moved in units appropriate to a note column, 2911 note column to be moved in situations where the note columns overlap.
2581 viz. the note head width of the first voice note. It should be used 2912 Note that it has no effect on note columns that do not overlap.
2582 in complex situations where the normal @code{\shiftOn} commands (see 2913 It is specified in units appropriate to a note column, viz. the note
2914 head width of the first voice note. It should be used in complex
2915 situations where the normal @code{\shiftOn} commands (see
2583 @ref{Explicitly instantiating voices}) do not resolve the note 2916 @ref{Explicitly instantiating voices}) do not resolve the note
2584 conflict. It is preferable to the @code{extra-offset} property for 2917 conflict satisfactorily. It is preferable to the @code{extra-offset}
2585 this purpose as there is no need to work out the distance in 2918 property for this purpose as there is no need to work out the distance
2586 staff-spaces, and moving the notes into or out of a @code{NoteColumn} 2919 in staff-spaces, and moving the notes into or out of a
2587 affects other actions such as merging note heads. 2920 @code{NoteColumn} affects other actions such as merging note heads.
2588 2921
2589 @end itemize 2922 @end itemize
2590 2923
2591 @item 2924 @item
2592 Finally, when all else fails, objects may be manually repositioned 2925 Finally, when all else fails, objects may be manually repositioned
2593 relative to the staff center line vertically, or by displacing them by 2926 relative to the staff center line vertically, or by displacing them by
2594 any distance to a new position. The disadvantages are that the 2927 any distance to a new position. The disadvantages are that the
2595 correct values for the repositioning have to be worked out, often by 2928 correct values for the repositioning have to be worked out, often by
2596 trial and error, for every object individually, and, because the 2929 trial and error, for every object individually, and, because the
2597 movement is done after LilyPond has placed all other objects, the user 2930 movement is done after LilyPond has placed all other objects, the user
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
2679 @cindex fixing overlapping notation 3012 @cindex fixing overlapping notation
2680 @cindex overlapping notation 3013 @cindex overlapping notation
2681 3014
2682 The @code{padding} property can be set to increase 3015 The @code{padding} property can be set to increase
2683 (or decrease) the distance between symbols that are printed 3016 (or decrease) the distance between symbols that are printed
2684 above or below notes. 3017 above or below notes.
2685 3018
2686 @cindex Script, example of overriding 3019 @cindex Script, example of overriding
2687 @cindex padding property, example 3020 @cindex padding property, example
2688 3021
2689 @lilypond[quote,fragment,relative=1,verbatim] 3022 @lilypond[quote,fragment,verbatim]
2690 c2\fermata 3023 c'2\fermata
2691 \override Script.padding = #3 3024 \override Script.padding = #3
2692 b2\fermata 3025 b2\fermata
2693 @end lilypond 3026 @end lilypond
2694 3027
2695 @cindex MetronomeMark, example of overriding 3028 @cindex MetronomeMark, example of overriding
2696 @cindex padding property, example 3029 @cindex padding property, example
2697 3030
2698 @lilypond[quote,fragment,relative=1,verbatim] 3031 @lilypond[quote,fragment,verbatim]
2699 % This will not work, see below 3032 % This will not work, see below
2700 \override MetronomeMark.padding = #3 3033 \override MetronomeMark.padding = #3
2701 \tempo 4 = 120 3034 \tempo 4 = 120
2702 c1 | 3035 c'1 |
2703 % This works 3036 % This works
2704 \override Score.MetronomeMark.padding = #3 3037 \override Score.MetronomeMark.padding = #3
2705 \tempo 4 = 80 3038 \tempo 4 = 80
2706 d1 | 3039 d'1 |
2707 @end lilypond 3040 @end lilypond
2708 3041
2709 Note in the second example how important it is to figure out what 3042 Note in the second example how important it is to figure out what
2710 context handles a certain object. Since the @code{MetronomeMark} 3043 context handles a certain object. Since the @code{MetronomeMark}
2711 object is handled in the @code{Score} context, property changes in the 3044 object is handled in the @code{Score} context, property changes in the
2712 @code{Voice} context will not be noticed. For more details, see 3045 @code{Voice} context will not be noticed. For more details, see
2713 @ruser{Modifying properties}. 3046 @ruser{Modifying properties}.
2714 3047
2715 If the @code{padding} property of an object is increased when that 3048 If the @code{padding} property of an object is increased when that
2716 object is in a stack of objects being positioned according to 3049 object is in a stack of objects being positioned according to
(...skipping 14 matching lines...) Expand all
2731 stencil with a markup containing the desired symbol(s), like this: 3064 stencil with a markup containing the desired symbol(s), like this:
2732 3065
2733 @cindex Accidental, example of overriding 3066 @cindex Accidental, example of overriding
2734 @cindex text property, example 3067 @cindex text property, example
2735 @cindex stencil property, example 3068 @cindex stencil property, example
2736 @cindex AccidentalPlacement, example of overriding 3069 @cindex AccidentalPlacement, example of overriding
2737 @cindex right-padding property, example 3070 @cindex right-padding property, example
2738 3071
2739 @lilypond[quote,ragged-right,verbatim] 3072 @lilypond[quote,ragged-right,verbatim]
2740 sesquisharp = \markup { \sesquisharp } 3073 sesquisharp = \markup { \sesquisharp }
2741 \relative c'' { 3074 \relative {
2742 c4 3075 c''4
2743 % This prints a sesquisharp but the spacing is too small 3076 % This prints a sesquisharp but the spacing is too small
2744 \once \override Accidental.stencil = #ly:text-interface::print 3077 \once \override Accidental.stencil = #ly:text-interface::print
2745 \once \override Accidental.text = #sesquisharp 3078 \once \override Accidental.text = #sesquisharp
2746 cis4 c 3079 cis4 c
2747 % This improves the spacing 3080 % This improves the spacing
2748 \once \override Score.AccidentalPlacement.right-padding = #0.6 3081 \once \override Score.AccidentalPlacement.right-padding = #0.6
2749 \once \override Accidental.stencil = #ly:text-interface::print 3082 \once \override Accidental.stencil = #ly:text-interface::print
2750 \once \override Accidental.text = #sesquisharp 3083 \once \override Accidental.text = #sesquisharp
2751 cis4 | 3084 cis4 |
2752 } 3085 }
2753 @end lilypond 3086 @end lilypond
2754 3087
2755 @noindent 3088 @noindent
2756 This necessarily uses an override for the accidental stencil which 3089 This necessarily uses an override for the accidental stencil which
2757 will not be covered until later. The stencil type must be a 3090 will not be covered until later. The stencil type must be a
2758 procedure, here changed to print the contents of the @code{text} 3091 procedure, here changed to print the contents of the @code{text}
2759 property of @code{Accidental}, which itself is set to be a 3092 property of @code{Accidental}, which itself is set to be a
2760 sesquisharp sign. This sign is then moved further away from the 3093 sesquisharp sign. This sign is then moved further away from the
2761 note head by overriding @code{right-padding}. 3094 note head by overriding @code{right-padding}.
2762 3095
2763 @noindent 3096 @noindent
2764 3097
2765 @node The staff-padding property 3098 @node The staff-padding property
2766 @unnumberedsubsubsec The @code{staff-padding} property 3099 @unnumberedsubsubsec The @code{staff-padding} property
2767 3100
2768 @cindex aligning objects on a baseline 3101 @cindex aligning objects on a baseline
2769 @cindex objects, aligning on a baseline 3102 @cindex objects, aligning on a baseline
2770 3103
2771 @code{staff-padding} can be used to align objects such as dynamics 3104 @code{staff-padding} can be used to align objects such as dynamics
2772 along a baseline at a fixed height above the staff, rather than at a 3105 along a baseline at a fixed distance from the staff, when no other
2773 height dependent on the position of the note to which they are 3106 notation forces them further from the staff.
2774 attached. It is not a property of @code{DynamicText} but of 3107 It is not a property of @code{DynamicText} but of
2775 @code{DynamicLineSpanner}. This is because the baseline should apply 3108 @code{DynamicLineSpanner}. This is because the baseline should apply
2776 equally to @strong{all} dynamics, including those created as extended 3109 equally to @strong{all} dynamics, including those created as extended
2777 spanners. So this is the way to align the dynamic marks in the 3110 spanners. So this is the way to align the dynamic marks in the
2778 example taken from the previous section: 3111 example taken from the previous section:
2779 3112
2780 @cindex DynamicText, example of overriding 3113 @cindex DynamicText, example of overriding
2781 @cindex extra-spacing-width property, example 3114 @cindex extra-spacing-width property, example
2782 @cindex DynamicLineSpanner, example of overriding 3115 @cindex DynamicLineSpanner, example of overriding
2783 @cindex staff-padding property, example 3116 @cindex staff-padding property, example
2784 3117
2785 @lilypond[quote,fragment,ragged-right,verbatim,relative=2] 3118 @lilypond[quote,fragment,ragged-right,verbatim]
2786 \dynamicUp 3119 \override DynamicLineSpanner.staff-padding = #3
2787 % Extend width by 1 unit 3120 \relative { a'4\f b\mf a\p b\mp }
2788 \override DynamicText.extra-spacing-width = #'(-0.5 . 0.5)
2789 % Align dynamics to a base line 2 units above staff
2790 \override DynamicLineSpanner.staff-padding = #2
2791 a4\f b\mf c\mp b\p
2792 @end lilypond 3121 @end lilypond
2793 3122
2794 3123
2795 @node The self-alignment-X property 3124 @node The self-alignment-X property
2796 @unnumberedsubsubsec The @code{self-alignment-X} property 3125 @unnumberedsubsubsec The @code{self-alignment-X} property
2797 3126
2798 The following example shows how this can resolve the collision 3127 The following example shows how to adjust the position
2799 of a string fingering object with a note's stem by aligning the 3128 of a string fingering object relative to a note's stem by aligning the
2800 right edge with the reference point of the parent note: 3129 right edge with the reference point of the parent note:
2801 3130
2802 @cindex StringNumber, example of overriding 3131 @cindex StringNumber, example of overriding
2803 @cindex self-alignment-X property, example 3132 @cindex self-alignment-X property, example
2804 3133
2805 @lilypond[quote,fragment,ragged-right,verbatim,relative=3] 3134 @lilypond[quote,fragment,ragged-right,verbatim]
2806 \voiceOne 3135 \voiceOne
2807 <a\2> 3136 <a''\2>
2808 \once \override StringNumber.self-alignment-X = #RIGHT 3137 \once \override StringNumber.self-alignment-X = #RIGHT
2809 <a\2> 3138 <a''\2>
2810 @end lilypond 3139 @end lilypond
2811 3140
2812 @node The staff-position property 3141 @node The staff-position property
2813 @unnumberedsubsubsec The @code{staff-position} property 3142 @unnumberedsubsubsec The @code{staff-position} property
2814 3143
2815 @cindex object collision within a staff 3144 @cindex object collision within a staff
2816 3145
2817 Multimeasure rests in one voice can collide with notes in another. 3146 Multimeasure rests in one voice can collide with notes in another.
2818 Since these rests are typeset centered between the bar lines, it 3147 Since these rests are typeset centered between the bar lines, it
2819 would require significant effort for LilyPond to figure out which 3148 would require significant effort for LilyPond to figure out which
2820 other notes might collide with it, since all the current collision 3149 other notes might collide with it, since all the current collision
2821 handling between notes and between notes and rests is done only 3150 handling between notes and between notes and rests is done only
2822 for notes and rests that occur at the same time. Here's an 3151 for notes and rests that occur at the same time. Here's an
2823 example of a collision of this type: 3152 example of a collision of this type:
2824 3153
2825 @lilypond[quote,verbatim,fragment,ragged-right, relative=1] 3154 @lilypond[quote,verbatim,ragged-right]
2826 << { c4 c c c } \\ { R1 } >> 3155 << \relative { c'4 c c c } \\ { R1 } >>
2827 @end lilypond 3156 @end lilypond
2828 3157
2829 The best solution here is to move the multimeasure rest down, since 3158 The best solution here is to move the multimeasure rest down, since the
2830 the rest is in voice two. The default in @code{\voiceTwo} (i.e. in 3159 rest is in voice two. The default in @code{\voiceTwo} (i.e. in the
2831 the second voice of a @code{<<@{...@} \\ @{...@}>>} construct) is that 3160 second voice of a @code{<<@{@dots{}@} \\ @{@dots{}@}>>} construct) is
2832 @code{staff-position} is set to -4 for MultiMeasureRest, so we need to 3161 that @code{staff-position} is set to -4 for MultiMeasureRest, so we need
2833 move it, say, four half-staff spaces down to @w{@code{-8}}. 3162 to move it, say, four half-staff spaces down to @w{@code{-8}}.
2834 3163
2835 @cindex MultiMeasureRest, example of overriding 3164 @cindex MultiMeasureRest, example of overriding
2836 @cindex staff-position property, example 3165 @cindex staff-position property, example
2837 3166
2838 @lilypond[quote,verbatim,fragment,ragged-right, relative=1] 3167 @lilypond[quote,verbatim,ragged-right]
2839 << 3168 <<
2840 { c4 c c c } 3169 \relative { c'4 c c c }
2841 \\ 3170 \\
2842 \override MultiMeasureRest.staff-position = #-8 3171 \override MultiMeasureRest.staff-position = #-8
2843 { R1 } 3172 { R1 }
2844 >> 3173 >>
2845 @end lilypond 3174 @end lilypond
2846 3175
2847 This is better than using, for example, @code{extra-offset}, 3176 This is better than using, for example, @code{extra-offset},
2848 because the ledger line above the rest is inserted automatically. 3177 because the ledger line above the rest is inserted automatically.
2849 3178
2850 @node The extra-offset property 3179 @node The extra-offset property
2851 @unnumberedsubsubsec The @code{extra-offset} property 3180 @unnumberedsubsubsec The @code{extra-offset} property
2852 3181
2853 @cindex positioning objects 3182 @cindex positioning objects
2854 @cindex positioning grobs 3183 @cindex positioning grobs
2855 @cindex objects, positioning 3184 @cindex objects, positioning
2856 @cindex grobs, positioning 3185 @cindex grobs, positioning
2857 3186
2858 The @code{extra-offset} property provides complete control over the 3187 The @code{extra-offset} property provides complete control over the
2859 positioning of an object both horizontally and vertically. 3188 positioning of an object both horizontally and vertically.
2860 3189
2861 In the following example, the second fingering is moved a little to 3190 In the following example, the second fingering is moved a little to
2862 the left, and 1.8 staff space downwards: 3191 the left, and 1.8 staff space downwards:
2863 3192
2864 @cindex Fingering, example of overriding 3193 @cindex Fingering, example of overriding
2865 @cindex extra-offset property, example 3194 @cindex extra-offset property, example
2866 3195
2867 @lilypond[quote,fragment,relative=1,verbatim] 3196 @lilypond[quote,fragment,verbatim]
2868 \stemUp 3197 f'4-5
2869 f4-5
2870 \once \override Fingering.extra-offset = #'(-0.3 . -1.8) 3198 \once \override Fingering.extra-offset = #'(-0.3 . -1.8)
2871 f4-5 3199 f'4-5
2872 @end lilypond 3200 @end lilypond
2873 3201
2874 3202
2875 @node The positions property 3203 @node The positions property
2876 @unnumberedsubsubsec The @code{positions} property 3204 @unnumberedsubsubsec The @code{positions} property
2877 3205
2878 @cindex controlling tuplets, slurs, phrasing slurs, and beams manually 3206 @cindex controlling tuplets, slurs, phrasing slurs, and beams manually
2879 @cindex manually controlling tuplets, slurs, phrasing slurs, and beams 3207 @cindex manually controlling tuplets, slurs, phrasing slurs, and beams
2880 @cindex tuplet beams, controlling manually 3208 @cindex tuplet beams, controlling manually
2881 @cindex slurs, controlling manually 3209 @cindex slurs, controlling manually
2882 @cindex phrasing slurs, controlling manually 3210 @cindex phrasing slurs, controlling manually
2883 @cindex beams, controlling manually 3211 @cindex beams, controlling manually
2884 3212
2885 The @code{positions} property allows the vertical position and hence 3213 The @code{positions} property allows the vertical position and hence
2886 the slope of tuplets, slurs, phrasing slurs and beams to be controlled 3214 the slope of tuplets, slurs, phrasing slurs and beams to be controlled
2887 manually. 3215 manually.
2888 3216
2889 Here's an example in which the phrasing slur and slur collide: 3217 Here's an example in which the phrasing slur and slur collide:
2890 3218
2891 @lilypond[quote,verbatim,fragment,ragged-right,relative=2] 3219 @lilypond[quote,verbatim,ragged-right]
2892 a8 \( ( a'16 ) a \) 3220 \relative { a'8 \( ( a'16 ) a \) }
2893 @end lilypond 3221 @end lilypond
2894 3222
2895 @cindex PhrasingSlur, example of overriding 3223 @cindex PhrasingSlur, example of overriding
2896 @cindex positions property, example 3224 @cindex positions property, example
2897 3225
2898 @noindent 3226 @noindent
2899 One possibility would be to move the two ends of the phrasing slur 3227 One possibility would be to move the two ends of the phrasing slur
2900 higher. We can try setting the left end to 2.5 staff-spaces above the 3228 higher. We can try setting the left end to 2.5 staff-spaces above the
2901 centre line and the right end to 4.5 above, and LilyPond will 3229 centre line and the right end to 4.5 above, and LilyPond will
2902 select the phrasing slur from the candidates it has found with its 3230 select the phrasing slur from the candidates it has found with its
2903 end points closest to these: 3231 end points closest to these:
2904 3232
2905 @lilypond[quote,verbatim,fragment,ragged-right,relative=2] 3233 @lilypond[quote,verbatim,fragment,ragged-right]
2906 \once \override PhrasingSlur.positions = #'(2.5 . 4.5) 3234 \once \override PhrasingSlur.positions = #'(2.5 . 4.5)
2907 a8 \( ( a'16 ) a \) 3235 a'8 \( ( a''16 ) a'' \)
2908 @end lilypond 3236 @end lilypond
2909 3237
2910 This is an improvement, but why not lower the right end of the slur 3238 This is an improvement, but why not lower the right end of the slur
2911 a little? If you try it you'll find it can't be done in this way. 3239 a little? If you try it you'll find it can't be done in this way.
2912 That's because there are no candidate slurs lower than the one 3240 That's because there are no candidate slurs lower than the one
2913 already selected, and in this case the @code{positions} property has 3241 already selected, and in this case the @code{positions} property has
2914 no effect. However, ties, slurs and phrasing slurs @emph{can} be 3242 no effect. However, ties, slurs and phrasing slurs @emph{can} be
2915 positioned and shaped very precisely when necessary. To learn how to 3243 positioned and shaped very precisely when necessary. To learn how to
2916 do this, see @ruser{Modifying ties and slurs}. 3244 do this, see @ruser{Modifying ties and slurs}.
2917 3245
2918 Here's a further example. We see that the beams 3246 Here's a further example. We see that the beams
2919 collide with the ties: 3247 collide with the ties:
2920 3248
2921 @lilypond[quote,verbatim,fragment,ragged-right] 3249 @lilypond[quote,verbatim,ragged-right]
2922 { 3250 {
2923 \time 4/2 3251 \time 4/2
2924 << 3252 <<
2925 { c'1 ~ c'2. e'8 f' } 3253 \relative { c'1~ 2. e8 f }
2926 \\ 3254 \\
2927 { e''8 e'' e'' e'' e'' e'' e'' e'' f''2 g'' } 3255 \relative {
3256 e''8 e e e
3257 e e e e
3258 f2 g
3259 }
2928 >> 3260 >>
2929 << 3261 <<
2930 { c'1 ~ c'2. e'8 f' } 3262 \relative { c'1~ 2. e8 f }
2931 \\ 3263 \\
2932 { e''8 e'' e'' e'' e'' e'' e'' e'' f''2 g'' } 3264 \relative {
3265 e''8 e e e
3266 e e e e
3267 f2 g
3268 }
2933 >> 3269 >>
2934 } 3270 }
2935 @end lilypond 3271 @end lilypond
2936 3272
2937 @noindent 3273 @noindent
2938 This can be resolved by manually moving both ends of the beam 3274 This can be resolved by manually moving both ends of the beam
2939 up from their position at 1.81 staff-spaces below the center line to, 3275 up from their position at 1.81 staff-spaces below the center line to,
2940 say, 1: 3276 say, 1:
2941 3277
2942 @cindex Beam, example of overriding 3278 @cindex Beam, example of overriding
2943 @cindex positions property, example 3279 @cindex positions property, example
2944 3280
2945 @lilypond[quote,verbatim,fragment,ragged-right] 3281 @lilypond[quote,verbatim,ragged-right]
2946 { 3282 {
2947 \time 4/2 3283 \time 4/2
2948 << 3284 <<
2949 { c'1 ~ c'2. e'8 f' } 3285 \relative { c'1~ 2. e8 f }
2950 \\ 3286 \\
2951 { 3287 \relative {
2952 \override Beam.positions = #'(-1 . -1) 3288 \override Beam.positions = #'(-1 . -1)
2953 e''8 e'' e'' e'' e'' e'' e'' e'' f''2 g'' 3289 e''8 e e e
3290 e e e e
3291 f2 g
2954 } 3292 }
2955 >> 3293 >>
2956 << 3294 <<
2957 { c'1 ~ c'2. e'8 f' } 3295 \relative { c'1~ 2. e8 f }
2958 \\ 3296 \\
2959 { e''8 e'' e'' e'' e'' e'' e'' e'' f''2 g'' } 3297 \relative {
3298 e''8 e e e
3299 e e e e
3300 f2 g
3301 \revert Beam.positions
3302 }
2960 >> 3303 >>
2961 } 3304 }
2962 @end lilypond 3305 @end lilypond
2963 3306
2964 @noindent 3307 @noindent
2965 Note that the override continues to apply in the first voice of 3308 Note that the override continues to apply in the second voice of
2966 the second measure of eighth notes, but not to any of the beams in the 3309 the second measure of eighth notes, but not to any of the beams in the
2967 second voice. 3310 first voice, even those in the later second measure. As soon as the
3311 override should no longer apply it should be reverted, as shown.
2968 3312
2969 @node The force-hshift property 3313 @node The force-hshift property
2970 @unnumberedsubsubsec The @code{force-hshift property} 3314 @unnumberedsubsubsec The @code{force-hshift} property
2971 3315
2972 We can now see how to apply the final corrections to the Chopin 3316 We can now see how to apply the final corrections to the Chopin
2973 example introduced at the end of @ref{I'm hearing Voices}, which 3317 example introduced at the end of @ref{I'm hearing Voices}, which
2974 was left looking like this: 3318 was left looking like this:
2975 3319
2976 @lilypond[quote,verbatim,fragment,ragged-right] 3320 @lilypond[quote,verbatim,fragment,ragged-right]
2977 \new Staff \relative c'' { 3321 \new Staff \relative {
2978 \key aes \major 3322 \key aes \major
2979 << 3323 <<
2980 { c2 aes4. bes8 } 3324 { c''2 aes4. bes8 }
2981 \\ 3325 \\
2982 { <ees, c>2 des } 3326 { <ees, c>2 des }
2983 \\ 3327 \\
2984 \\ 3328 \\
2985 { aes'2 f4 fes } 3329 { aes'2 f4 fes }
2986 >> | 3330 >> |
2987 <c ees aes c>1 | 3331 <c ees aes c>1 |
2988 } 3332 }
2989 @end lilypond 3333 @end lilypond
2990 3334
2991 @noindent 3335 @noindent
2992 The inner note of the first chord (i.e. the A-flat in the fourth 3336 The inner note of the first chord (i.e. the A-flat in the fourth
2993 Voice) need not be shifted away from the note column of the higher 3337 Voice) need not be shifted away from the note column of the higher
2994 note. To correct this we set @code{force-hshift}, which is a property 3338 note, so we use @code{\shiftOff}.
2995 of @code{NoteColumn}, of this note to zero. 3339
2996 3340 In the second chord we prefer the F to line up with the A-flat and
2997 In the second chord we prefer the F to line up with the A-flat and the 3341 the lowest note to be positioned slightly right to avoid a collision
2998 lowest note to be positioned slightly right to avoid a collision of 3342 of stems. We achieve this by setting @code{force-hshift} in the
2999 stems. We achieve this by setting @code{force-hshift} in the
3000 @code{NoteColumn} of the low D-flat to move it to the right by half 3343 @code{NoteColumn} of the low D-flat to move it to the right by half
3001 a staff-space. 3344 a staff-space, and setting @code{force-hshift} for the F to zero.
3345 Note that we use @code{\once} to avoid the settings propagating
3346 beyond the immediate musical moment, although in this small example
3347 the @code{\once} and the second @code{\override} in Voice four could
3348 be omitted. This would not be good practice.
3002 3349
3003 Here's the final result: 3350 Here's the final result:
3004 3351
3005 @cindex NoteColumn, example of overriding 3352 @cindex NoteColumn, example of overriding
3006 @cindex force-hshift property, example 3353 @cindex force-hshift property, example
3007 3354
3008 @lilypond[quote,verbatim,fragment,ragged-right] 3355 @lilypond[quote,verbatim,fragment,ragged-right]
3009 \new Staff \relative c'' { 3356 \new Staff \relative {
3010 \key aes \major 3357 \key aes \major
3011 << 3358 <<
3012 { c2 aes4. bes8 } 3359 { c''2 aes4. bes8 }
3013 \\ 3360 \\
3014 { 3361 { <ees, c>2 \once \override NoteColumn.force-hshift = 0.5 des }
3015 <ees, c>2
3016 \once \override NoteColumn.force-hshift = #0.5
3017 des2
3018 }
3019 \\ 3362 \\
3020 \\ 3363 \\
3021 { 3364 { \once \shiftOff aes'2 \once \shiftOff f4 fes }
3022 \override NoteColumn.force-hshift = #0
3023 aes'2 f4 fes
3024 }
3025 >> | 3365 >> |
3026 <c ees aes c>1 | 3366 <c ees aes c>1 |
3027 } 3367 }
3028 @end lilypond 3368 @end lilypond
3029 3369
3030 3370
3031 @node Real music example 3371 @node Real music example
3032 @subsection Real music example 3372 @subsection Real music example
3033 3373
3034 We end this section on Tweaks by showing the steps to be taken to 3374 We end this section on Tweaks by showing the steps to be taken to
3035 deal with a tricky example which needs several tweaks to produce 3375 deal with a tricky example which needs several tweaks to produce
3036 the desired output. The example has been deliberately chosen to 3376 the desired output. The example has been deliberately chosen to
3037 illustrate the use of the Notation Reference to resolve unusual 3377 illustrate the use of the Notation Reference to resolve unusual
3038 problems with notation. It is not representative of the more usual 3378 problems with notation. It is not representative of the more usual
3039 engraving process, so please do not let these difficulties put 3379 engraving process, so please do not let these difficulties put
3040 you off! Fortunately, difficulties like these are not very common! 3380 you off! Fortunately, difficulties like these are not very common!
3041 3381
3042 The example is from Chopin's Première Ballade, Op. 23, bars 6 to 3382 The example is from Chopin's Première Ballade, Op. 23, bars 6 to
3043 9, the transition from the opening Lento to Moderato. 3383 9, the transition from the opening Lento to Moderato.
3044 Here, first, is what we want the output to look like, but to avoid 3384 Here, first, is what we want the output to look like, but to avoid
3045 over-complicating the example too much we have left out the 3385 over-complicating the example too much we have left out the
3046 dynamics, fingering and pedalling. 3386 dynamics, fingering and pedalling.
3047 3387
3048 @c The following should appear as music without code 3388 @c The following should appear as music without code
3049 @c This example should not be indexed 3389 @c This example should not be indexed
3050 @c line-width ensures no break 3390 @c line-width ensures no break
3051 @lilypond[quote,ragged-right,line-width=6\in] 3391 @lilypond[quote,ragged-right,line-width=6\in]
3052 rhMusic = \relative c'' { 3392 rhMusic = \relative {
3053 \new Voice { 3393 \new Voice {
3054 r2 c4.\( g8 | 3394 r2 c''4.\( g8 |
3055 \once \override Tie.staff-position = #3.5 3395 \once \override Tie.staff-position = #3.5
3056 bes1~ | 3396 bes1~ |
3057 \bar "||" 3397 \bar "||"
3058 \time 6/4 3398 \time 6/4
3059 \mergeDifferentlyHeadedOn 3399 \mergeDifferentlyHeadedOn
3060 \mergeDifferentlyDottedOn 3400 \mergeDifferentlyDottedOn
3061 bes2.^\markup { \bold "Moderato" } r8 3401 bes2.\tempo "Moderato" r8
3062 << 3402 <<
3063 { c,8 d fis bes a } 3403 { c,8 d fis bes a }
3064 \new Voice { 3404 \new Voice {
3065 \voiceTwo 3405 \voiceTwo
3066 c,8~ 3406 c,8~
3067 % Reposition the c2 to the right of the merged note 3407 % Reposition the c2 to the right of the merged note
3068 \once \override NoteColumn.force-hshift = #1.0 3408 \once \override NoteColumn.force-hshift = #1.0
3069 % Move the c2 out of the main note column 3409 % Move the c2 out of the main note column
3070 % so the merge will work 3410 % so the merge will work
3071 \shiftOnn 3411 \shiftOnn
3072 c2 3412 c2
3073 } 3413 }
3074 \new Voice { 3414 \new Voice {
3075 \voiceThree 3415 \voiceThree
3076 s8 3416 s8
3077 % Stem on the d2 must be down to permit merging 3417 % Stem on the d2 must be down to permit merging
3078 \stemDown 3418 \stemDown
3079 % Stem on the d2 should be invisible 3419 % Stem on the d2 should be invisible
3080 \tweak Stem.transparent ##t 3420 \tweak Stem.transparent ##t
3081 \tweak Flag.transparent ##t
3082 d2 3421 d2
3083 } 3422 }
3084 \new Voice { 3423 \new Voice {
3085 \voiceFour 3424 \voiceFour
3086 s4 fis4. 3425 s4 fis4.
3087 } 3426 }
3088 >> | 3427 >> |
3089 \mergeDifferentlyHeadedOff 3428 \mergeDifferentlyHeadedOff
3090 \mergeDifferentlyDottedOff 3429 \mergeDifferentlyDottedOff
3091 g2.\) 3430 g2.\)
3092 } 3431 }
3093 } 3432 }
3094 3433
3095 lhMusic = \relative c' { 3434 lhMusic = \relative {
3096 r2 <c g ees>2( | 3435 r2 <c' g ees>2( |
3097 <d g, d>1)\arpeggio | 3436 <d g, d>1)\arpeggio |
3098 r2. d,,4 r4 r | 3437 r2. d,,4 r4 r |
3099 r4 3438 r4
3100 } 3439 }
3101 3440
3102 \score { 3441 \score {
3103 \new PianoStaff << 3442 \new PianoStaff <<
3104 \new Staff = "RH" << 3443 \new Staff = "RH" <<
3105 \key g \minor 3444 \key g \minor
3106 \rhMusic 3445 \rhMusic
(...skipping 19 matching lines...) Expand all
3126 voices for the polyphonic passage, as LilyPond is better able to 3465 voices for the polyphonic passage, as LilyPond is better able to
3127 avoid collisions if all voices are instantiated explicitly in this 3466 avoid collisions if all voices are instantiated explicitly in this
3128 way. 3467 way.
3129 3468
3130 So let us begin by entering the notes as two variables, setting up 3469 So let us begin by entering the notes as two variables, setting up
3131 the staff structure in a score block, and seeing what LilyPond 3470 the staff structure in a score block, and seeing what LilyPond
3132 produces by default: 3471 produces by default:
3133 3472
3134 @c line-width ensures no break 3473 @c line-width ensures no break
3135 @lilypond[quote,verbatim,ragged-right,line-width=6\in] 3474 @lilypond[quote,verbatim,ragged-right,line-width=6\in]
3136 rhMusic = \relative c'' { 3475 rhMusic = \relative {
3137 \new Voice { 3476 \new Voice {
3138 r2 c4. g8 | 3477 r2 c''4. g8 |
3139 bes1~ | 3478 bes1~ |
3140 \time 6/4 3479 \time 6/4
3141 bes2. r8 3480 bes2. r8
3142 % Start polyphonic section of four voices 3481 % Start polyphonic section of four voices
3143 << 3482 <<
3144 { c,8 d fis bes a } % continuation of main voice 3483 { c,8 d fis bes a } % continuation of main voice
3145 \new Voice { 3484 \new Voice {
3146 \voiceTwo 3485 \voiceTwo
3147 c,8~ c2 3486 c,8~ 2
3148 } 3487 }
3149 \new Voice { 3488 \new Voice {
3150 \voiceThree 3489 \voiceThree
3151 s8 d2 3490 s8 d2
3152 } 3491 }
3153 \new Voice { 3492 \new Voice {
3154 \voiceFour 3493 \voiceFour
3155 s4 fis4. 3494 s4 fis4.
3156 } 3495 }
3157 >> | 3496 >> |
3158 g2. % continuation of main voice 3497 g2. % continuation of main voice
3159 } 3498 }
3160 } 3499 }
3161 3500
3162 lhMusic = \relative c' { 3501 lhMusic = \relative {
3163 r2 <c g ees>2 | 3502 r2 <c' g ees>2 |
3164 <d g, d>1 | 3503 <d g, d>1 |
3165 r2. d,,4 r4 r | 3504 r2. d,,4 r4 r |
3166 r4 3505 r4
3167 } 3506 }
3168 3507
3169 \score { 3508 \score {
3170 \new PianoStaff << 3509 \new PianoStaff <<
3171 \new Staff = "RH" << 3510 \new Staff = "RH" <<
3172 \key g \minor 3511 \key g \minor
3173 \rhMusic 3512 \rhMusic
3174 >> 3513 >>
3175 \new Staff = "LH" << 3514 \new Staff = "LH" <<
3176 \key g \minor 3515 \key g \minor
3177 \clef "bass" 3516 \clef "bass"
3178 \lhMusic 3517 \lhMusic
3179 >> 3518 >>
3180 >> 3519 >>
3181 } 3520 }
3182 @end lilypond 3521 @end lilypond
3183 3522
3184 All the notes are right, but the appearance is far from 3523 All the notes are right, but the appearance is far from
3185 satisfactory. The tie collides with the change in time signature, 3524 satisfactory. The tie collides with the change in time signature,
3186 some notes are not merged together, and several notation elements 3525 some notes are not merged together, and several notation elements
3187 are missing. Let's first deal with the easier things. We can 3526 are missing. Let's first deal with the easier things. We can
3188 easily add the left hand slur and the right hand phrasing slur, 3527 easily add the left hand slur and the right hand phrasing slur,
3189 since these were all covered in the Tutorial. Doing this gives: 3528 since these were all covered in the Tutorial. Doing this gives:
3190 3529
3191 @c line-width ensures no break 3530 @c line-width ensures no break
3192 @lilypond[quote,verbatim,ragged-right,line-width=6\in] 3531 @lilypond[quote,verbatim,ragged-right,line-width=6\in]
3193 rhMusic = \relative c'' { 3532 rhMusic = \relative {
3194 \new Voice { 3533 \new Voice {
3195 r2 c4.\( g8 | 3534 r2 c''4.\( g8 |
3196 bes1~ | 3535 bes1~ |
3197 \time 6/4 3536 \time 6/4
3198 bes2. r8 3537 bes2. r8
3199 % Start polyphonic section of four voices 3538 % Start polyphonic section of four voices
3200 << 3539 <<
3201 { c,8 d fis bes a } % continuation of main voice 3540 { c,8 d fis bes a } % continuation of main voice
3202 \new Voice { 3541 \new Voice {
3203 \voiceTwo 3542 \voiceTwo
3204 c,8~ c2 3543 c,8~ 2
3205 } 3544 }
3206 \new Voice { 3545 \new Voice {
3207 \voiceThree 3546 \voiceThree
3208 s8 d2 3547 s8 d2
3209 } 3548 }
3210 \new Voice { 3549 \new Voice {
3211 \voiceFour 3550 \voiceFour
3212 s4 fis4. 3551 s4 fis4.
3213 } 3552 }
3214 >> | 3553 >> |
3215 g2.\) % continuation of main voice 3554 g2.\) % continuation of main voice
3216 } 3555 }
3217 } 3556 }
3218 3557
3219 lhMusic = \relative c' { 3558 lhMusic = \relative {
3220 r2 <c g ees>2( | 3559 r2 <c' g ees>2( |
3221 <d g, d>1) | 3560 <d g, d>1) |
3222 r2. d,,4 r4 r | 3561 r2. d,,4 r4 r |
3223 r4 3562 r4
3224 } 3563 }
3225 3564
3226 \score { 3565 \score {
3227 \new PianoStaff << 3566 \new PianoStaff <<
3228 \new Staff = "RH" << 3567 \new Staff = "RH" <<
3229 \key g \minor 3568 \key g \minor
3230 \rhMusic 3569 \rhMusic
(...skipping 22 matching lines...) Expand all
3253 spaces relative to the center line of the staff. So the following 3592 spaces relative to the center line of the staff. So the following
3254 override placed just before the first tied note would move the tie up 3593 override placed just before the first tied note would move the tie up
3255 to 3.5 half staff spaces above the center line: 3594 to 3.5 half staff spaces above the center line:
3256 3595
3257 @code{\once \override Tie.staff-position = #3.5} 3596 @code{\once \override Tie.staff-position = #3.5}
3258 3597
3259 This completes bar two, giving: 3598 This completes bar two, giving:
3260 3599
3261 @c line-width ensures no break 3600 @c line-width ensures no break
3262 @lilypond[quote,verbatim,ragged-right,line-width=6\in] 3601 @lilypond[quote,verbatim,ragged-right,line-width=6\in]
3263 rhMusic = \relative c'' { 3602 rhMusic = \relative {
3264 \new Voice { 3603 \new Voice {
3265 r2 c4.\( g8 | 3604 r2 c''4.\( g8 |
3266 \once \override Tie.staff-position = #3.5 3605 \once \override Tie.staff-position = #3.5
3267 bes1~ | 3606 bes1~ |
3268 \bar "||" 3607 \bar "||"
3269 \time 6/4 3608 \time 6/4
3270 bes2. r8 3609 bes2. r8
3271 % Start polyphonic section of four voices 3610 % Start polyphonic section of four voices
3272 << 3611 <<
3273 { c,8 d fis bes a } % continuation of main voice 3612 { c,8 d fis bes a } % continuation of main voice
3274 \new Voice { 3613 \new Voice {
3275 \voiceTwo 3614 \voiceTwo
3276 c,8~ c2 3615 c,8~ 2
3277 } 3616 }
3278 \new Voice { 3617 \new Voice {
3279 \voiceThree 3618 \voiceThree
3280 s8 d2 3619 s8 d2
3281 } 3620 }
3282 \new Voice { 3621 \new Voice {
3283 \voiceFour 3622 \voiceFour
3284 s4 fis4. 3623 s4 fis4.
3285 } 3624 }
3286 >> | 3625 >> |
3287 g2.\) % continuation of main voice 3626 g2.\) % continuation of main voice
3288 } 3627 }
3289 } 3628 }
3290 3629
3291 lhMusic = \relative c' { 3630 lhMusic = \relative {
3292 r2 <c g ees>2( | 3631 r2 <c' g ees>2( |
3293 <d g, d>1)\arpeggio | 3632 <d g, d>1)\arpeggio |
3294 r2. d,,4 r4 r | 3633 r2. d,,4 r4 r |
3295 r4 3634 r4
3296 } 3635 }
3297 3636
3298 \score { 3637 \score {
3299 \new PianoStaff << 3638 \new PianoStaff <<
3300 \new Staff = "RH" << 3639 \new Staff = "RH" <<
3301 \key g \minor 3640 \key g \minor
3302 \rhMusic 3641 \rhMusic
3303 >> 3642 >>
3304 \new Staff = "LH" << 3643 \new Staff = "LH" <<
3305 \key g \minor 3644 \key g \minor
3306 \clef "bass" 3645 \clef "bass"
3307 \lhMusic 3646 \lhMusic
3308 >> 3647 >>
3309 >> 3648 >>
3310 } 3649 }
3311 @end lilypond 3650 @end lilypond
3312 3651
3313 On to bar three and the start of the Moderato section. The tutorial 3652 On to bar three and the start of the Moderato section. The tutorial
3314 showed how to add bold text with the @code{\markup} command, so 3653 showed how to add a tempo indication with the @code{\tempo} command, so
3315 adding @qq{Moderato} in bold is easy. But how do we merge notes in 3654 adding @qq{Moderato} is easy. But how do we merge notes in
3316 different voices together? This is where we need to turn again to 3655 different voices together? This is where we need to turn again to
3317 the Notation Reference for help. A search for @qq{merge} in the 3656 the Notation Reference for help. A search for @qq{merge} in the
3318 Notation Reference index quickly leads us to the commands for merging 3657 Notation Reference index quickly leads us to the commands for merging
3319 differently headed and differently dotted notes in 3658 differently headed and differently dotted notes in
3320 @ruser{Collision resolution}. In our example we need to merge both 3659 @ruser{Collision resolution}. In our example we need to merge both
3321 types of note for the duration of the polyphonic section in bar 3, 3660 types of note for the duration of the polyphonic section in bar 3,
3322 so using the information we find in the Notation Reference we add 3661 so using the information we find in the Notation Reference we add
3323 3662
3324 @example 3663 @example
3325 \mergeDifferentlyHeadedOn 3664 \mergeDifferentlyHeadedOn
3326 \mergeDifferentlyDottedOn 3665 \mergeDifferentlyDottedOn
3327 @end example 3666 @end example
3328 3667
3329 @noindent 3668 @noindent
3330 to the start of that section and 3669 to the start of that section and
3331 3670
3332 @example 3671 @example
3333 \mergeDifferentlyHeadedOff 3672 \mergeDifferentlyHeadedOff
3334 \mergeDifferentlyDottedOff 3673 \mergeDifferentlyDottedOff
3335 @end example 3674 @end example
3336 3675
3337 @noindent 3676 @noindent
3338 to the end, giving: 3677 to the end, giving:
3339 3678
3340 @c line-width ensures no break 3679 @c line-width ensures no break
3341 @lilypond[quote,ragged-right,line-width=6\in] 3680 @lilypond[quote,ragged-right,line-width=6\in]
3342 rhMusic = \relative c'' { 3681 rhMusic = \relative {
3343 \new Voice { 3682 \new Voice {
3344 r2 c4.\( g8 | 3683 r2 c''4.\( g8 |
3345 \once \override Tie.staff-position = #3.5 3684 \once \override Tie.staff-position = #3.5
3346 bes1~ | 3685 bes1~ |
3347 \bar "||" 3686 \bar "||"
3348 \time 6/4 3687 \time 6/4
3349 bes2.^\markup { \bold "Moderato" } r8 3688 bes2.\tempo "Moderato" r8
3350 \mergeDifferentlyHeadedOn 3689 \mergeDifferentlyHeadedOn
3351 \mergeDifferentlyDottedOn 3690 \mergeDifferentlyDottedOn
3352 % Start polyphonic section of four voices 3691 % Start polyphonic section of four voices
3353 << 3692 <<
3354 { c,8 d fis bes a } % continuation of main voice 3693 { c,8 d fis bes a } % continuation of main voice
3355 \new Voice { 3694 \new Voice {
3356 \voiceTwo 3695 \voiceTwo
3357 c,8~ c2 3696 c,8~ 2
3358 } 3697 }
3359 \new Voice { 3698 \new Voice {
3360 \voiceThree 3699 \voiceThree
3361 s8 d2 3700 s8 d2
3362 } 3701 }
3363 \new Voice { 3702 \new Voice {
3364 \voiceFour 3703 \voiceFour
3365 s4 fis4. 3704 s4 fis4.
3366 } 3705 }
3367 >> | 3706 >> |
3368 \mergeDifferentlyHeadedOff 3707 \mergeDifferentlyHeadedOff
3369 \mergeDifferentlyDottedOff 3708 \mergeDifferentlyDottedOff
3370 g2.\) % continuation of main voice 3709 g2.\) % continuation of main voice
3371 } 3710 }
3372 } 3711 }
3373 3712
3374 lhMusic = \relative c' { 3713 lhMusic = \relative {
3375 r2 <c g ees>2( | 3714 r2 <c' g ees>2( |
3376 <d g, d>1)\arpeggio | 3715 <d g, d>1)\arpeggio |
3377 r2. d,,4 r4 r | 3716 r2. d,,4 r4 r |
3378 r4 3717 r4
3379 } 3718 }
3380 3719
3381 \score { 3720 \score {
3382 \new PianoStaff << 3721 \new PianoStaff <<
3383 \new Staff = "RH" << 3722 \new Staff = "RH" <<
3384 \key g \minor 3723 \key g \minor
3385 \rhMusic 3724 \rhMusic
(...skipping 20 matching lines...) Expand all
3406 voices one and three, which have shift off and shift on, 3745 voices one and three, which have shift off and shift on,
3407 respectively. So we have to shift the C a further level still 3746 respectively. So we have to shift the C a further level still
3408 using @code{\shiftOnn} to avoid it interfering with the two D's. 3747 using @code{\shiftOnn} to avoid it interfering with the two D's.
3409 Applying these changes gives: 3748 Applying these changes gives:
3410 3749
3411 @cindex Tie, example of overriding 3750 @cindex Tie, example of overriding
3412 @cindex staff-position property, example 3751 @cindex staff-position property, example
3413 3752
3414 @c line-width ensures no break 3753 @c line-width ensures no break
3415 @lilypond[quote,verbatim,ragged-right,line-width=6\in] 3754 @lilypond[quote,verbatim,ragged-right,line-width=6\in]
3416 rhMusic = \relative c'' { 3755 rhMusic = \relative {
3417 \new Voice { 3756 \new Voice {
3418 r2 c4.\( g8 | 3757 r2 c''4.\( g8 |
3419 \once \override Tie.staff-position = #3.5 3758 \once \override Tie.staff-position = #3.5
3420 bes1~ | 3759 bes1~ |
3421 \bar "||" 3760 \bar "||"
3422 \time 6/4 3761 \time 6/4
3423 bes2.^\markup { \bold "Moderato" } r8 3762 bes2.\tempo "Moderato" r8
3424 \mergeDifferentlyHeadedOn 3763 \mergeDifferentlyHeadedOn
3425 \mergeDifferentlyDottedOn 3764 \mergeDifferentlyDottedOn
3426 % Start polyphonic section of four voices 3765 % Start polyphonic section of four voices
3427 << 3766 <<
3428 { c,8 d fis bes a } % continuation of main voice 3767 { c,8 d fis bes a } % continuation of main voice
3429 \new Voice { 3768 \new Voice {
3430 \voiceTwo 3769 \voiceTwo
3431 % Move the c2 out of the main note column 3770 % Move the c2 out of the main note column
3432 % so the merge will work 3771 % so the merge will work
3433 c,8~ \shiftOnn c2 3772 c,8~ \shiftOnn c2
3434 } 3773 }
3435 \new Voice { 3774 \new Voice {
3436 \voiceThree 3775 \voiceThree
3437 % Stem on the d2 must be down to permit merging 3776 % Stem on the d2 must be down to permit merging
3438 s8 \stemDown d2 3777 s8 \stemDown d2
3439 } 3778 }
3440 \new Voice { 3779 \new Voice {
3441 \voiceFour 3780 \voiceFour
3442 s4 fis4. 3781 s4 fis4.
3443 } 3782 }
3444 >> | 3783 >> |
3445 \mergeDifferentlyHeadedOff 3784 \mergeDifferentlyHeadedOff
3446 \mergeDifferentlyDottedOff 3785 \mergeDifferentlyDottedOff
3447 g2.\) % continuation of main voice 3786 g2.\) % continuation of main voice
3448 } 3787 }
3449 } 3788 }
3450 3789
3451 lhMusic = \relative c' { 3790 lhMusic = \relative {
3452 r2 <c g ees>2( | 3791 r2 <c' g ees>2( |
3453 <d g, d>1)\arpeggio | 3792 <d g, d>1)\arpeggio |
3454 r2. d,,4 r4 r | 3793 r2. d,,4 r4 r |
3455 r4 3794 r4
3456 } 3795 }
3457 3796
3458 \score { 3797 \score {
3459 \new PianoStaff << 3798 \new PianoStaff <<
3460 \new Staff = "RH" << 3799 \new Staff = "RH" <<
3461 \key g \minor 3800 \key g \minor
3462 \rhMusic 3801 \rhMusic
(...skipping 13 matching lines...) Expand all
3476 earlier tweaks: we make the stem transparent, and move the C with 3815 earlier tweaks: we make the stem transparent, and move the C with
3477 the @code{force-hshift} property. Here's the final result: 3816 the @code{force-hshift} property. Here's the final result:
3478 3817
3479 @cindex NoteColumn, example of overriding 3818 @cindex NoteColumn, example of overriding
3480 @cindex force-hshift property, example 3819 @cindex force-hshift property, example
3481 @cindex Stem, example of overriding 3820 @cindex Stem, example of overriding
3482 @cindex transparent property, example 3821 @cindex transparent property, example
3483 3822
3484 @c line-width ensures no break 3823 @c line-width ensures no break
3485 @lilypond[quote,verbatim,ragged-right,line-width=6\in] 3824 @lilypond[quote,verbatim,ragged-right,line-width=6\in]
3486 rhMusic = \relative c'' { 3825 rhMusic = \relative {
3487 \new Voice { 3826 \new Voice {
3488 r2 c4.\( g8 | 3827 r2 c''4.\( g8 |
3489 \once \override Tie.staff-position = #3.5 3828 \once \override Tie.staff-position = #3.5
3490 bes1~ | 3829 bes1~ |
3491 \bar "||" 3830 \bar "||"
3492 \time 6/4 3831 \time 6/4
3493 bes2.^\markup { \bold "Moderato" } r8 3832 bes2.\tempo "Moderato" r8
3494 \mergeDifferentlyHeadedOn 3833 \mergeDifferentlyHeadedOn
3495 \mergeDifferentlyDottedOn 3834 \mergeDifferentlyDottedOn
3496 % Start polyphonic section of four voices 3835 % Start polyphonic section of four voices
3497 << 3836 <<
3498 { c,8 d fis bes a } % continuation of main voice 3837 { c,8 d fis bes a } % continuation of main voice
3499 \new Voice { 3838 \new Voice {
3500 \voiceTwo 3839 \voiceTwo
3501 c,8~ 3840 c,8~
3502 % Reposition the c2 to the right of the merged note 3841 % Reposition the c2 to the right of the merged note
3503 \once \override NoteColumn.force-hshift = #1.0 3842 \once \override NoteColumn.force-hshift = #1.0
3504 % Move the c2 out of the main note column 3843 % Move the c2 out of the main note column
3505 % so the merge will work 3844 % so the merge will work
3506 \shiftOnn 3845 \shiftOnn
3507 c2 3846 c2
3508 } 3847 }
3509 \new Voice { 3848 \new Voice {
3510 \voiceThree 3849 \voiceThree
3511 s8 3850 s8
3512 % Stem on the d2 must be down to permit merging 3851 % Stem on the d2 must be down to permit merging
3513 \stemDown 3852 \stemDown
3514 % Stem on the d2 should be invisible 3853 % Stem on the d2 should be invisible
3515 \tweak Stem.transparent ##t 3854 \tweak Stem.transparent ##t
3516 \tweak Flag.transparent ##t
3517 d2 3855 d2
3518 } 3856 }
3519 \new Voice { 3857 \new Voice {
3520 \voiceFour 3858 \voiceFour
3521 s4 fis4. 3859 s4 fis4.
3522 } 3860 }
3523 >> | 3861 >> |
3524 \mergeDifferentlyHeadedOff 3862 \mergeDifferentlyHeadedOff
3525 \mergeDifferentlyDottedOff 3863 \mergeDifferentlyDottedOff
3526 g2.\) % continuation of main voice 3864 g2.\) % continuation of main voice
3527 } 3865 }
3528 } 3866 }
3529 3867
3530 lhMusic = \relative c' { 3868 lhMusic = \relative {
3531 r2 <c g ees>2( | 3869 r2 <c' g ees>2( |
3532 <d g, d>1)\arpeggio | 3870 <d g, d>1)\arpeggio |
3533 r2. d,,4 r4 r | 3871 r2. d,,4 r4 r |
3534 r4 3872 r4
3535 } 3873 }
3536 3874
3537 \score { 3875 \score {
3538 \new PianoStaff << 3876 \new PianoStaff <<
3539 \new Staff = "RH" << 3877 \new Staff = "RH" <<
3540 \key g \minor 3878 \key g \minor
3541 \rhMusic 3879 \rhMusic
3542 >> 3880 >>
3543 \new Staff = "LH" << 3881 \new Staff = "LH" <<
3544 \key g \minor 3882 \key g \minor
3545 \clef "bass" 3883 \clef "bass"
3546 \lhMusic 3884 \lhMusic
3547 >> 3885 >>
3548 >> 3886 >>
3549 } 3887 }
3550 @end lilypond 3888 @end lilypond
3551 3889
3552 3890
3553 @node Further tweaking 3891 @node Further tweaking
3554 @section Further tweaking 3892 @section Further tweaking
3555 3893
3556 @menu 3894 @menu
3557 * Other uses for tweaks:: 3895 * Other uses for tweaks::
3558 * Using variables for tweaks:: 3896 * Using variables for layout adjustments::
3559 * Style sheets:: 3897 * Style sheets::
3560 * Other sources of information:: 3898 * Other sources of information::
3561 * Advanced tweaks with Scheme:: 3899 * Advanced tweaks with Scheme::
3562 @end menu 3900 @end menu
3563 3901
3564 @node Other uses for tweaks 3902 @node Other uses for tweaks
3565 @subsection Other uses for tweaks 3903 @subsection Other uses for tweaks
3566 3904
3567 @menu 3905 @menu
3568 * Tying notes across voices:: 3906 * Tying notes across voices::
3569 * Simulating a fermata in MIDI:: 3907 * Simulating a fermata in MIDI::
3570 @end menu 3908 @end menu
3571 3909
3572 @cindex transparent property, use of
3573 @cindex objects, making invisible
3574 @cindex removing objects 3910 @cindex removing objects
3575 @cindex objects, removing 3911 @cindex objects, removing
3576 @cindex hiding objects
3577 @cindex objects, hiding
3578 @cindex invisible objects
3579 @cindex objects, invisible
3580 3912
3581 @node Tying notes across voices 3913 @node Tying notes across voices
3582 @unnumberedsubsubsec Tying notes across voices 3914 @unnumberedsubsubsec Tying notes across voices
3583 3915
3584 @cindex tying notes across voices 3916 @cindex tying notes across voices
3585 3917
3586 The following example demonstrates how to connect notes in 3918 The following example demonstrates how to connect notes in different
3587 different voices using ties. Normally, only two notes in the 3919 voices using ties. Normally, only notes in the same voice can be
3588 same voice can be connected with ties. By using two voices, 3920 connected with ties. By using two voices, with the tied notes in one
3589 with the tied notes in one of them 3921 of them
3590 3922
3591 @lilypond[quote,fragment,relative=2] 3923 @lilypond[quote]
3592 << { b8~ b\noBeam } \\ { b8[ g] } >> 3924 << { b'8~ 8\noBeam } \\ { b'8[ g'] } >>
3593 @end lilypond 3925 @end lilypond
3594 3926
3595 @noindent 3927 @noindent
3596 and blanking the first up-stem in that voice, the tie appears to 3928 and removing the first up-stem and its flag in that voice, the tie
3597 cross voices: 3929 appears to cross voices:
3598 3930
3599 @cindex Stem, example of overriding 3931 @funindex \omit
3600 @cindex transparent property, example 3932 @cindex Stem, example of removing
3601 3933 @cindex Flag, example of removing
3602 @lilypond[quote,fragment,relative=2,verbatim] 3934 @cindex @code{\omit}, example
3935 @cindex example of @code{\omit}
3936
3937 @lilypond[quote,verbatim]
3603 << 3938 <<
3604 { 3939 {
3605 \tweak Stem.transparent ##t 3940 \once \omit Stem
3606 \tweak Flag.transparent ##t 3941 \once \omit Flag
3607 b8~ b\noBeam 3942 b'8~ 8\noBeam
3608 } 3943 }
3609 \\ 3944 \\
3610 { b8[ g] } 3945 { b'8[ g'] }
3611 >> 3946 >>
3612 @end lilypond 3947 @end lilypond
3613 3948
3614 To make sure that the just-blanked stem doesn't squeeze the tie 3949 @seealso
3615 too much, we can lengthen the stem by setting the 3950 Learning Manual:
3616 @code{length} to @code{8}, 3951 @ref{The once prefix,,The @code{@bs{}once} prefix},
3617 3952 @ref{The stencil property}.
3618 @lilypond[quote,fragment,relative=2,verbatim] 3953
3619 <<
3620 {
3621 \tweak Stem.transparent ##t
3622 \tweak Flag.transparent ##t
3623 \tweak Stem.length #8
3624 b8~ b\noBeam
3625 }
3626 \\
3627 { b8[ g] }
3628 >>
3629 @end lilypond
3630
3631 @funindex \single
3632 @cindex tweak, generated from override
3633 Now for @emph{overriding} the transparency of a graphical object,
3634 we could have used the shorthand @code{\hide} as explained above.
3635 Tweaking is a different operation, affecting only properties
3636 generated from a single music expression. It turns out that we
3637 can convert overrides into tweaks using @code{\single}, making it
3638 possible to rewrite the above example as
3639
3640 @lilypond[quote,fragment,relative=2,verbatim]
3641 <<
3642 {
3643 \single \hide Stem
3644 \single \hide Flag
3645 \tweak Stem.length #8
3646 b8~ b\noBeam
3647 }
3648 \\
3649 { b8[ g] }
3650 >>
3651 @end lilypond
3652
3653 In this particular case, the difference to @code{\once \hide} is
3654 not apparent. It is important when there are several objects at
3655 the same point in musical time (like noteheads in a chord). In
3656 that case, @code{\once} will affect all of those objects while
3657 @code{\single} will only affect a single one, the one generated by
3658 the immediately following music expression.
3659 3954
3660 @node Simulating a fermata in MIDI 3955 @node Simulating a fermata in MIDI
3661 @unnumberedsubsubsec Simulating a fermata in MIDI 3956 @unnumberedsubsubsec Simulating a fermata in MIDI
3662 3957
3663 @cindex stencil property, use of 3958 @cindex stencil property, use of
3664 @cindex fermata, implementing in MIDI 3959 @cindex fermata, implementing in MIDI
3665 3960
3666 For outside-staff objects it is usually better to override the 3961 For outside-staff objects it is usually better to override the
3667 object's @code{stencil} property rather than its @code{transparent} 3962 object's @code{stencil} property rather than its @code{transparent}
3668 property when you wish to remove it from the printed output. 3963 property when you wish to remove it from the printed output.
3669 Setting the @code{stencil} property of an object to @code{#f} will 3964 Setting the @code{stencil} property of an object to @code{#f} will
3670 remove that object entirely from the printed output. This means it 3965 remove that object entirely from the printed output. This means it
3671 has no effect on the placement of other objects placed relative to 3966 has no effect on the placement of other objects placed relative to
3672 it. 3967 it.
3673 3968
3674 For example, if we wished to change the metronome setting in order 3969 For example, if we wished to change the metronome setting in order
3675 to simulate a fermata in the MIDI output we would not want the 3970 to simulate a fermata in the MIDI output we would not want the
3676 metronome markings to appear in the printed output, and we would 3971 metronome markings to appear in the printed output, and we would
3677 not want it to influence the spacing between the two systems or 3972 not want it to influence the spacing between the two systems or
3678 the positions of adjacent annotations on the staff. So setting 3973 the positions of adjacent annotations on the staff. So setting
3679 its @code{stencil} property to @code{#f} would be the best way. 3974 its @code{stencil} property to @code{#f} would be the best way.
3680 We show here the effect of the two methods: 3975 We show here the effect of the two methods:
3681 3976
3682 @cindex MetronomeMark, example of overriding 3977 @cindex MetronomeMark, example of overriding
3683 @cindex transparent property, example 3978 @cindex transparent property, example
3684 3979
3685 @lilypond[quote,verbatim,ragged-right] 3980 @lilypond[quote,verbatim,ragged-right]
3686 \score { 3981 \score {
3687 \relative c'' { 3982 \relative {
3688 % Visible tempo marking 3983 % Visible tempo marking
3689 \tempo 4=120 3984 \tempo 4=120
3690 a4 a a 3985 a'4 a a
3691 \once \hide Score.MetronomeMark 3986 \once \hide Score.MetronomeMark
3692 % Invisible tempo marking to lengthen fermata in MIDI 3987 % Invisible tempo marking to lengthen fermata in MIDI
3693 \tempo 4=80 3988 \tempo 4=80
3694 a4\fermata | 3989 a4\fermata |
3695 % New tempo for next section 3990 % New tempo for next section
3696 \tempo 4=100 3991 \tempo 4=100
3697 a4 a a a | 3992 a4 a a a |
3698 } 3993 }
3699 \layout { } 3994 \layout { }
3700 \midi { } 3995 \midi { }
3701 } 3996 }
3702 @end lilypond 3997 @end lilypond
3703 3998
3704 @cindex MetronomeMark, example of overriding 3999 @cindex MetronomeMark, example of overriding
3705 @cindex stencil property, example 4000 @cindex stencil property, example
3706 4001
3707 @lilypond[quote,verbatim,ragged-right] 4002 @lilypond[quote,verbatim,ragged-right]
3708 \score { 4003 \score {
3709 \relative c'' { 4004 \relative {
3710 % Visible tempo marking 4005 % Visible tempo marking
3711 \tempo 4=120 4006 \tempo 4=120
3712 a4 a a 4007 a'4 a a
3713 \once \omit Score.MetronomeMark 4008 \once \omit Score.MetronomeMark
3714 % Invisible tempo marking to lengthen fermata in MIDI 4009 % Invisible tempo marking to lengthen fermata in MIDI
3715 \tempo 4=80 4010 \tempo 4=80
3716 a4\fermata | 4011 a4\fermata |
3717 % New tempo for next section 4012 % New tempo for next section
3718 \tempo 4=100 4013 \tempo 4=100
3719 a4 a a a | 4014 a4 a a a |
3720 } 4015 }
3721 \layout { } 4016 \layout { }
3722 \midi { } 4017 \midi { }
3723 } 4018 }
3724 @end lilypond 4019 @end lilypond
3725 4020
3726 @noindent 4021 @noindent
3727 Both methods remove the metronome mark which lengthens the fermata 4022 Both methods remove the metronome mark which lengthens the fermata
3728 from the printed output, and both affect the MIDI timing as 4023 from the printed output, and both affect the MIDI timing as
3729 required, but the transparent metronome mark in the first line 4024 required, but the transparent metronome mark in the first line
3730 forces the following tempo indication too high while the 4025 forces the following tempo indication too high while the
3731 second (with the stencil removed) does not. 4026 second (with the stencil removed) does not.
3732 4027
3733 @seealso 4028 @seealso
3734 Music Glossary: 4029 Music Glossary:
3735 @rglos{system}. 4030 @rglos{system}.
3736 4031
3737 @node Using variables for tweaks 4032 @node Using variables for layout adjustments
3738 @subsection Using variables for tweaks 4033 @subsection Using variables for layout adjustments
3739 4034
3740 @cindex variables, using for tweaks 4035 @cindex variables, using for overrides
3741 @cindex using variables for tweaks 4036 @cindex overrides, using variables for
3742 @cindex tweaks, using variables for 4037 @cindex adjustments, using variables for
4038 @cindex layout adjustments, using variables for
3743 4039
3744 Override commands are often long and tedious to type, and they 4040 Override commands are often long and tedious to type, and they
3745 have to be absolutely correct. If the same overrides are to be 4041 have to be absolutely correct. If the same overrides are to be
3746 used many times it may be worth defining variables to hold them. 4042 used many times it may be worth defining variables to hold them.
3747 4043
3748 Suppose we wish to emphasize certain words in lyrics by printing 4044 Suppose we wish to emphasize certain words in lyrics by printing
3749 them in bold italics. The @code{\italic} and @code{\bold} 4045 them in bold italics. The @code{\italic} and @code{\bold}
3750 commands only work within lyrics if they are embedded, together with 4046 commands only work within lyrics if they are embedded, together with
3751 the word or words to be modified, within a @code{\markup} block, 4047 the word or words to be modified, within a @code{\markup} block,
3752 which makes them tedious to enter. The need to embed the words 4048 which makes them tedious to enter. The need to embed the words
(...skipping 27 matching lines...) Expand all
3780 \override Lyrics.LyricText.font-series = #'bold 4076 \override Lyrics.LyricText.font-series = #'bold
3781 } 4077 }
3782 4078
3783 normal = { 4079 normal = {
3784 \revert Lyrics.LyricText.font-shape 4080 \revert Lyrics.LyricText.font-shape
3785 \revert Lyrics.LyricText.font-series 4081 \revert Lyrics.LyricText.font-series
3786 } 4082 }
3787 4083
3788 global = { \key c \major \time 4/4 \partial 4 } 4084 global = { \key c \major \time 4/4 \partial 4 }
3789 4085
3790 SopranoMusic = \relative c' { c4 | e4. e8 g4 g | a4 a g } 4086 SopranoMusic = \relative { c'4 | e4. e8 g4 g | a4 a g }
3791 AltoMusic = \relative c' { c4 | c4. c8 e4 e | f4 f e } 4087 AltoMusic = \relative { c'4 | c4. c8 e4 e | f4 f e }
3792 TenorMusic = \relative c { e4 | g4. g8 c4. b8 | a8 b c d e4 } 4088 TenorMusic = \relative { e4 | g4. g8 c4. b8 | a8 b c d e4 }
3793 BassMusic = \relative c { c4 | c4. c8 c4 c | f8 g a b c4 } 4089 BassMusic = \relative { c4 | c4. c8 c4 c | f8 g a b c4 }
3794 4090
3795 VerseOne = \lyrics { 4091 VerseOne = \lyrics {
3796 E -- | ter -- nal \emphasize Fa -- ther, | \normal strong to save, 4092 E -- | ter -- nal \emphasize Fa -- ther, | \normal strong to save,
3797 } 4093 }
3798 4094
3799 VerseTwo = \lyricmode { 4095 VerseTwo = \lyricmode {
3800 O | \once \emphasize Christ, whose voice the | wa -- ters heard, 4096 O | \once \emphasize Christ, whose voice the | wa -- ters heard,
3801 } 4097 }
3802 4098
3803 VerseThree = \lyricmode { 4099 VerseThree = \lyricmode {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3837 input files that you want to apply your tweaks to? Or what if you 4133 input files that you want to apply your tweaks to? Or what if you
3838 simply want to separate your tweaks from the actual music? This 4134 simply want to separate your tweaks from the actual music? This
3839 is quite easy to do. 4135 is quite easy to do.
3840 4136
3841 Let's look at an example. Don't worry if you don't understand 4137 Let's look at an example. Don't worry if you don't understand
3842 the parts with all the @code{#()}. This is explained in 4138 the parts with all the @code{#()}. This is explained in
3843 @ref{Advanced tweaks with Scheme}. 4139 @ref{Advanced tweaks with Scheme}.
3844 4140
3845 @lilypond[quote,verbatim,ragged-right] 4141 @lilypond[quote,verbatim,ragged-right]
3846 mpdolce = 4142 mpdolce =
3847 #(make-dynamic-script 4143 \tweak self-alignment-X #-0.6
3848 #{ \markup { \hspace #0 4144 #(make-dynamic-script
3849 \translate #'(5 . 0) 4145 #{ \markup { \dynamic mp \normal-text \italic \bold dolce } #})
3850 \line { \dynamic "mp"
3851 \text \italic "dolce" } }
3852 #})
3853 4146
3854 inst = 4147 inst =
3855 #(define-music-function 4148 #(define-music-function
3856 (parser location string) 4149 (string)
3857 (string?) 4150 (string?)
3858 #{ <>^\markup \bold \box #string #}) 4151 #{ <>^\markup \bold \box #string #})
3859 4152
3860 \relative c'' { 4153 \relative {
3861 \tempo 4=50 4154 \tempo 4=50
3862 a4.\mpdolce d8 cis4--\glissando a | 4155 a'4.\mpdolce d8 cis4--\glissando a |
3863 b4 bes a2 | 4156 b4 bes a2 |
3864 \inst "Clarinet" 4157 \inst "Clarinet"
3865 cis4.\< d8 e4 fis | 4158 cis4.\< d8 e4 fis |
3866 g8(\! fis)-. e( d)-. cis2 | 4159 g8(\! fis)-. e( d)-. cis2 |
3867 } 4160 }
3868 @end lilypond 4161 @end lilypond
3869 4162
3870 Let's do something about the @code{mpdolce} and @code{inst} definitions. 4163 Let's do something about the @code{mpdolce} and @code{inst} definitions.
3871 They produce the output we desire, but we might want to use them in 4164 They produce the output we desire, but we might want to use them in
3872 another piece. We could simply copy-and-paste them at the top of every 4165 another piece. We could simply copy-and-paste them at the top of every
3873 file, but that's an annoyance. It also leaves those definitions in our 4166 file, but that's an annoyance. It also leaves those definitions in our
3874 input files, and I personally find all the @code{#()} somewhat ugly. 4167 input files, and I personally find all the @code{#()} somewhat ugly.
3875 Let's hide them in another file: 4168 Let's hide them in another file:
3876 4169
3877 @example 4170 @example
3878 %%% save this to a file called "definitions.ily" 4171 %%% save this to a file called "definitions.ily"
3879 mpdolce = 4172 mpdolce =
3880 #(make-dynamic-script 4173 \tweak self-alignment-X #-0.6
3881 #@{ \markup @{ \hspace #0 4174 #(make-dynamic-script
3882 \translate #'(5 . 0) 4175 #@{ \markup @{ \dynamic mp \normal-text \italic \bold dolce @} #@})
3883 \line @{ \dynamic "mp"
3884 \text \italic "dolce" @} @}
3885 #@})
3886 4176
3887 inst = 4177 inst =
3888 #(define-music-function 4178 #(define-music-function
3889 (parser location string) 4179 (string)
3890 (string?) 4180 (string?)
3891 #@{ <>^\markup \bold \box #string #@}) 4181 #@{ <>^\markup \bold \box #string #@})
3892 @end example 4182 @end example
3893 4183
3894 We will refer to this file using the @code{\include} command near 4184 We will refer to this file using the @code{\include} command near
3895 the top of the music file. (The extension @file{.ily} is used to 4185 the top of the music file. (The extension @file{.ily} is used to
3896 distinguish this included file, which is not meant to be compiled 4186 distinguish this included file, which is not meant to be compiled
3897 on its own, from the main file.) 4187 on its own, from the main file.)
3898 Now let's modify our music (let's save this file as @file{music.ly}). 4188 Now let's modify our music (let's save this file as @file{music.ly}).
3899 4189
3900 @c We have to do this awkward example/lilypond-non-verbatim 4190 @c We have to do this awkward example/lilypond-non-verbatim
3901 @c because we can't do the \include stuff in the manual. 4191 @c because we can't do the \include stuff in the manual.
3902 4192
3903 @example 4193 @example
3904 \include "definitions.ily" 4194 \include "definitions.ily"
3905 4195
3906 \relative c'' @{ 4196 \relative @{
3907 \tempo 4=50 4197 \tempo 4=50
3908 a4.\mpdolce d8 cis4--\glissando a | 4198 a'4.\mpdolce d8 cis4--\glissando a |
3909 b4 bes a2 | 4199 b4 bes a2 |
3910 \inst "Clarinet" 4200 \inst "Clarinet"
3911 cis4.\< d8 e4 fis | 4201 cis4.\< d8 e4 fis |
3912 g8(\! fis)-. e( d)-. cis2 | 4202 g8(\! fis)-. e( d)-. cis2 |
3913 @} 4203 @}
3914 @end example 4204 @end example
3915 4205
3916 @lilypond[quote,ragged-right] 4206 @lilypond[quote,ragged-right]
3917 mpdolce = 4207 mpdolce =
3918 #(make-dynamic-script 4208 \tweak self-alignment-X #-0.6
3919 #{ \markup { \hspace #0 4209 #(make-dynamic-script
3920 \translate #'(5 . 0) 4210 #{ \markup { \dynamic mp \normal-text \italic \bold dolce } #})
3921 \line { \dynamic "mp"
3922 \text \italic "dolce" } }
3923 #})
3924 4211
3925 inst = 4212 inst =
3926 #(define-music-function 4213 #(define-music-function
3927 (parser location string) 4214 (string)
3928 (string?) 4215 (string?)
3929 #{ <>^\markup \bold \box #string #}) 4216 #{ <>^\markup \bold \box #string #})
3930 4217
3931 \relative c'' { 4218 \relative {
3932 \tempo 4=50 4219 \tempo 4=50
3933 a4.\mpdolce d8 cis4--\glissando a | 4220 a'4.\mpdolce d8 cis4--\glissando a |
3934 b4 bes a2 | 4221 b4 bes a2 |
3935 \inst "Clarinet" 4222 \inst "Clarinet"
3936 cis4.\< d8 e4 fis | 4223 cis4.\< d8 e4 fis |
3937 g8(\! fis)-. e( d)-. cis2 | 4224 g8(\! fis)-. e( d)-. cis2 |
3938 } 4225 }
3939 @end lilypond 4226 @end lilypond
3940 4227
3941 That looks better, but let's make a few changes. The glissando is hard 4228 That looks better, but let's make a few changes. The glissando is hard
3942 to see, so let's make it thicker and closer to the note heads. Let's 4229 to see, so let's make it thicker and closer to the note heads. Let's
3943 put the metronome marking above the clef, instead of over the first 4230 put the metronome marking above the clef, instead of over the first
3944 note. And finally, my composition professor hates @q{C} time signatures, 4231 note. And finally, my composition professor hates @q{C} time signatures,
3945 so we'd better make that @q{4/4} instead. 4232 so we'd better make that @q{4/4} instead.
3946 4233
3947 Don't change @file{music.ly}, though. Replace our @file{definitions.ily} 4234 Don't change @file{music.ly}, though. Replace our @file{definitions.ily}
3948 with this: 4235 with this:
3949 4236
3950 @example 4237 @example
3951 %%% definitions.ily 4238 %%% definitions.ily
3952 mpdolce = 4239 mpdolce =
3953 #(make-dynamic-script 4240 \tweak self-alignment-X #-0.6
3954 #@{ \markup @{ \hspace #0 4241 #(make-dynamic-script
3955 \translate #'(5 . 0) 4242 #@{ \markup @{ \dynamic mp \normal-text \italic \bold dolce @} #@})
3956 \line @{ \dynamic "mp"
3957 \text \italic "dolce" @} @}
3958 #@})
3959 4243
3960 inst = 4244 inst =
3961 #(define-music-function 4245 #(define-music-function
3962 (parser location string) 4246 (string)
3963 (string?) 4247 (string?)
3964 #@{ <>^\markup \bold \box #string #@}) 4248 #@{ <>^\markup \bold \box #string #@})
3965 4249
3966 \layout@{ 4250 \layout@{
3967 \context @{ 4251 \context @{
3968 \Score 4252 \Score
3969 \override MetronomeMark.extra-offset = #'(-9 . 0) 4253 \override MetronomeMark.extra-offset = #'(-5 . 0)
3970 \override MetronomeMark.padding = #'3 4254 \override MetronomeMark.padding = #'3
3971 @} 4255 @}
3972 \context @{ 4256 \context @{
3973 \Staff 4257 \Staff
3974 \override TimeSignature.style = #'numbered 4258 \override TimeSignature.style = #'numbered
3975 @} 4259 @}
3976 \context @{ 4260 \context @{
3977 \Voice 4261 \Voice
3978 \override Glissando.thickness = #3 4262 \override Glissando.thickness = #3
3979 \override Glissando.gap = #0.1 4263 \override Glissando.gap = #0.1
3980 @} 4264 @}
3981 @} 4265 @}
3982 @end example 4266 @end example
3983 4267
3984 @lilypond[quote,ragged-right] 4268 @lilypond[quote,ragged-right]
3985 mpdolce = 4269 mpdolce =
3986 #(make-dynamic-script 4270 \tweak self-alignment-X #-0.6
3987 #{ \markup { \hspace #0 4271 #(make-dynamic-script
3988 \translate #'(5 . 0) 4272 #{ \markup { \dynamic mp \normal-text \italic \bold dolce } #})
3989 \line { \dynamic "mp"
3990 \text \italic "dolce" } }
3991 #})
3992 4273
3993 inst = 4274 inst =
3994 #(define-music-function 4275 #(define-music-function
3995 (parser location string) 4276 (string)
3996 (string?) 4277 (string?)
3997 #{ <>^\markup \bold \box #string #}) 4278 #{ <>^\markup \bold \box #string #})
3998 4279
3999 \layout{ 4280 \layout{
4000 \context { 4281 \context {
4001 \Score 4282 \Score
4002 \override MetronomeMark.extra-offset = #'(-9 . 0) 4283 \override MetronomeMark.extra-offset = #'(-5 . 0)
4003 \override MetronomeMark.padding = #'3 4284 \override MetronomeMark.padding = #'3
4004 } 4285 }
4005 \context { 4286 \context {
4006 \Staff 4287 \Staff
4007 \override TimeSignature.style = #'numbered 4288 \override TimeSignature.style = #'numbered
4008 } 4289 }
4009 \context { 4290 \context {
4010 \Voice 4291 \Voice
4011 \override Glissando.thickness = #3 4292 \override Glissando.thickness = #3
4012 \override Glissando.gap = #0.1 4293 \override Glissando.gap = #0.1
4013 } 4294 }
4014 } 4295 }
4015 4296
4016 \relative c'' { 4297 \relative {
4017 \tempo 4=50 4298 \tempo 4=50
4018 a4.\mpdolce d8 cis4--\glissando a | 4299 a'4.\mpdolce d8 cis4--\glissando a |
4019 b4 bes a2 | 4300 b4 bes a2 |
4020 \inst "Clarinet" 4301 \inst "Clarinet"
4021 cis4.\< d8 e4 fis | 4302 cis4.\< d8 e4 fis |
4022 g8(\! fis)-. e( d)-. cis2 | 4303 g8(\! fis)-. e( d)-. cis2 |
4023 } 4304 }
4024 @end lilypond 4305 @end lilypond
4025 4306
4026 That looks nicer! But now suppose that I want to publish this 4307 That looks nicer! But now suppose that I want to publish this
4027 piece. My composition professor doesn't like @q{C} time 4308 piece. My composition professor doesn't like @q{C} time
4028 signatures, but I'm somewhat fond of them. Let's copy the 4309 signatures, but I'm somewhat fond of them. Let's copy the
4029 current @file{definitions.ily} to @file{web-publish.ily} and 4310 current @file{definitions.ily} to @file{web-publish.ily} and
4030 modify that. Since this music is aimed at producing a pdf which 4311 modify that. Since this music is aimed at producing a pdf which
4031 will be displayed on the screen, we'll also increase the 4312 will be displayed on the screen, we'll also increase the
4032 overall size of the output. 4313 overall size of the output.
4033 4314
4034 @example 4315 @example
4035 %%% web-publish.ily 4316 %%% web-publish.ily
4036 mpdolce = 4317 mpdolce =
4037 #(make-dynamic-script 4318 \tweak self-alignment-X #-0.6
4038 #@{ \markup @{ \hspace #0 4319 #(make-dynamic-script
4039 \translate #'(5 . 0) 4320 #@{ \markup @{ \dynamic mp \normal-text \italic \bold dolce @} #@})
4040 \line @{ \dynamic "mp"
4041 \text \italic "dolce" @} @}
4042 #@})
4043 4321
4044 inst = 4322 inst =
4045 #(define-music-function 4323 #(define-music-function
4046 (parser location string) 4324 (string)
4047 (string?) 4325 (string?)
4048 #@{ <>^\markup \bold \box #string #@}) 4326 #@{ <>^\markup \bold \box #string #@})
4049 4327
4050 #(set-global-staff-size 23) 4328 #(set-global-staff-size 23)
4051 4329
4052 \layout@{ 4330 \layout@{
4053 \context @{ 4331 \context @{
4054 \Score 4332 \Score
4055 \override MetronomeMark.extra-offset = #'(-9 . 0) 4333 \override MetronomeMark.extra-offset = #'(-5 . 0)
4056 \override MetronomeMark.padding = #'3 4334 \override MetronomeMark.padding = #'3
4057 @} 4335 @}
4058 \context @{ 4336 \context @{
4059 \Staff 4337 \Staff
4060 @} 4338 @}
4061 \context @{ 4339 \context @{
4062 \Voice 4340 \Voice
4063 \override Glissando.thickness = #3 4341 \override Glissando.thickness = #3
4064 \override Glissando.gap = #0.1 4342 \override Glissando.gap = #0.1
4065 @} 4343 @}
4066 @} 4344 @}
4067 @end example 4345 @end example
4068 4346
4069 @lilypond[quote,ragged-right] 4347 @lilypond[quote,ragged-right]
4070 mpdolce = 4348 mpdolce =
4071 #(make-dynamic-script 4349 \tweak self-alignment-X #-0.6
4072 #{ \markup { \hspace #0 4350 #(make-dynamic-script
4073 \translate #'(5 . 0) 4351 #{ \markup { \dynamic mp \normal-text \italic \bold dolce } #})
4074 \line { \dynamic "mp"
4075 \text \italic "dolce" } }
4076 #})
4077 4352
4078 inst = 4353 inst =
4079 #(define-music-function 4354 #(define-music-function
4080 (parser location string) 4355 (string)
4081 (string?) 4356 (string?)
4082 #{ <>^\markup \bold \box #string #}) 4357 #{ <>^\markup \bold \box #string #})
4083 4358
4084 #(set-global-staff-size 23) 4359 #(set-global-staff-size 23)
4085 4360
4086 \layout{ 4361 \layout{
4087 \context { \Score 4362 \context { \Score
4088 \override MetronomeMark.extra-offset = #'(-9 . 0) 4363 \override MetronomeMark.extra-offset = #'(-5 . 0)
4089 \override MetronomeMark.padding = #'3 4364 \override MetronomeMark.padding = #'3
4090 } 4365 }
4091 \context { \Voice 4366 \context { \Voice
4092 \override Glissando.thickness = #3 4367 \override Glissando.thickness = #3
4093 \override Glissando.gap = #0.1 4368 \override Glissando.gap = #0.1
4094 } 4369 }
4095 } 4370 }
4096 4371
4097 \relative c'' { 4372 \relative {
4098 \tempo 4=50 4373 \tempo 4=50
4099 a4.\mpdolce d8 cis4--\glissando a | 4374 a'4.\mpdolce d8 cis4--\glissando a |
4100 b4 bes a2 | 4375 b4 bes a2 |
4101 \inst "Clarinet" 4376 \inst "Clarinet"
4102 cis4.\< d8 e4 fis | 4377 cis4.\< d8 e4 fis |
4103 g8(\! fis)-. e( d)-. cis2 | 4378 g8(\! fis)-. e( d)-. cis2 |
4104 } 4379 }
4105 @end lilypond 4380 @end lilypond
4106 4381
4107 Now in our music, I simply replace 4382 Now in our music, I simply replace
4108 @code{\include "definitions.ily"} with 4383 @code{\include "definitions.ily"} with
4109 @code{\include "web-publish.ily"}. Of course, we could make this 4384 @code{\include "web-publish.ily"}. Of course, we could make this
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
4197 4472
4198 @itemize 4473 @itemize
4199 @item @file{ly/} - contains files in LilyPond format 4474 @item @file{ly/} - contains files in LilyPond format
4200 @item @file{scm/} - contains files in Scheme format 4475 @item @file{scm/} - contains files in Scheme format
4201 @end itemize 4476 @end itemize
4202 4477
4203 Let's begin by looking at some files in @file{ly/}. 4478 Let's begin by looking at some files in @file{ly/}.
4204 Open @file{ly/property-init.ly} in a text editor. The one 4479 Open @file{ly/property-init.ly} in a text editor. The one
4205 you normally use for @code{.ly} files will be fine. This file 4480 you normally use for @code{.ly} files will be fine. This file
4206 contains the definitions of all the standard LilyPond predefined 4481 contains the definitions of all the standard LilyPond predefined
4207 commands, such as @code{\stemUp} and @code{\slurDotted}. You will 4482 commands, such as @code{\tieUp} and @code{\slurDotted}. You will
4208 see that these are nothing more than definitions of variables 4483 see that these are nothing more than definitions of variables
4209 containing one or a group of @code{\override} commands. For 4484 containing one or a group of @code{\override} commands. For
4210 example, @code{/tieDotted} is defined to be: 4485 example, @code{\tieDotted} is defined to be:
4211 4486
4212 @example 4487 @example
4213 tieDotted = @{ 4488 tieDotted = @{
4214 \override Tie.dash-period = #0.75 4489 \override Tie.dash-period = #0.75
4215 \override Tie.dash-fraction = #0.1 4490 \override Tie.dash-fraction = #0.1
4216 @} 4491 @}
4217 @end example 4492 @end example
4218 4493
4219 If you do not like the default values these predefined commands can 4494 If you do not like the default values these predefined commands can
4220 be redefined easily, just like any other variable, at the 4495 be redefined easily, just like any other variable, at the
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
4304 ;; Return rainbow colors 4579 ;; Return rainbow colors
4305 ((1) (x11-color 'red )) ; for C 4580 ((1) (x11-color 'red )) ; for C
4306 ((2) (x11-color 'orange )) ; for D 4581 ((2) (x11-color 'orange )) ; for D
4307 ((3) (x11-color 'yellow )) ; for E 4582 ((3) (x11-color 'yellow )) ; for E
4308 ((4) (x11-color 'green )) ; for F 4583 ((4) (x11-color 'green )) ; for F
4309 ((5) (x11-color 'blue )) ; for G 4584 ((5) (x11-color 'blue )) ; for G
4310 ((6) (x11-color 'purple )) ; for A 4585 ((6) (x11-color 'purple )) ; for A
4311 ((0) (x11-color 'violet )) ; for B 4586 ((0) (x11-color 'violet )) ; for B
4312 ))) 4587 )))
4313 4588
4314 \relative c' { 4589 \relative {
4315 % Arrange to obtain color from color-notehead procedure 4590 % Arrange to obtain color from color-notehead procedure
4316 \override NoteHead.color = #color-notehead 4591 \override NoteHead.color = #color-notehead
4317 a2 b | c2 d | e2 f | g2 a | 4592 a2 b | c2 d | e2 f | g2 a |
4318 } 4593 }
4319 @end lilypond 4594 @end lilypond
4320 4595
4321 Further examples showing the use of these programmable interfaces 4596 Further examples showing the use of these programmable interfaces
4322 can be found in @rextend{Callback functions}. 4597 can be found in @rextend{Callback functions}.
4323 4598
4324 4599
4325 4600
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b