]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/changing-defaults.itely
57469e30f006e328629570ed3ff884da16e1dc47
[lilypond.git] / Documentation / user / changing-defaults.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @node Changing defaults
3 @chapter Changing defaults
4
5
6 The purpose of LilyPond's design is to provide the finest output
7 quality as a default.  Nevertheless, it may happen that you need to
8 change this default layout.  The layout is controlled through a large
9 number of proverbial ``knobs and switches.''  This chapter does not
10 list each and every knob.  Rather, it outlines what groups of controls
11 are available and explains how to lookup which knob to use for a
12 particular effect.
13
14
15 @cindex Program reference
16
17 The controls available for tuning are described in a separate
18 document, the @internalsref{Program reference} manual.  That manual
19 lists all different variables, functions and options available in
20 LilyPond.  It is written as a HTML document, which is available
21 @uref{http://@/lilypond@/.org/@/doc/@/Documentation/@/user/@/out@/-www/@/lilypond@/-internals/,on@/-line},
22 but is also included with the LilyPond documentation package.
23
24 There are three areas where the default settings may be changed:
25
26 @itemize @bullet
27 @item
28 Output: changing the appearance of individual
29 objects.  For example, changing stem directions or the location of
30 subscripts.
31   
32 @item
33 Context: changing aspects of the translation from music events to
34 notation.  For example, giving each staff a separate time signature. 
35   
36 @item
37 Global layout: changing the appearance of the spacing, line
38 breaks, and page dimensions.
39 @end itemize
40
41 Then there are separate systems for typesetting text (like
42 @emph{ritardando}) and selecting different fonts.  This chapter also
43 discusses these.
44
45 Internally, LilyPond uses Scheme (a LISP dialect) to provide
46 infrastructure.  Overriding layout decisions in effect accesses the
47 program internals, which requires Scheme input.  Scheme elements are
48 introduced in a @code{.ly} file with the hash mark
49 @code{#}.@footnote{@ref{Scheme tutorial} contains a short tutorial
50 on entering numbers, lists, strings, and symbols in Scheme.}
51
52
53 @menu
54 * Interpretation contexts::     
55 * The \override command::       
56 * Fonts::                       
57 * Text markup::                 
58 @end menu
59
60  
61 @node Interpretation contexts
62 @section Interpretation contexts
63
64 When music is printed, a lot of notational elements must be added to the
65 input, which is often bare bones.  For example, compare the input and
66 output of the following example:
67
68 @lilypond[quote,verbatim,relative=2,fragment]
69 cis4 cis2. g4
70 @end lilypond
71
72 The input is rather sparse, but in the output, bar lines, accidentals,
73 clef, and time signature are added.  LilyPond @emph{interprets} the
74 input.  During this step, the musical information is inspected in time
75 order, similar to reading a score from left to right.  While reading,
76 the input, the program remembers where measure boundaries are, and what
77 pitches need explicit accidentals.  This information can be presented on
78 several levels.  For example, the effect of an accidental is limited
79 to a single staff, while a bar line must be synchronized across the
80 entire score.
81
82 Within LilyPond, these rules and bits of information are grouped in
83 so-called Contexts.  Examples of context are @context{Voice},
84 @context{Staff}, and @context{Score}.  They are hierarchical, for
85 example, a @context{Staff} can contain many @context{Voice}s, and a
86 @context{Score} can contain many @context{Staff} contexts.
87
88 Each context has the responsibility for enforcing some notation rules,
89 creating some notation objects and maintaining the associated
90 properties.  So, the synchronization of bar lines is handled at
91 @context{Score} context.  The @context{Voice} may introduce an
92 accidental and then the @context{Staff} context maintains the rule to
93 show or suppress the accidental for the remainder of the measure.
94
95 For simple scores, contexts are created implicitly, and you need not
96 be aware of them.  For larger pieces, such as piano music, they must be
97 created explicitly to make sure that you get as many staves as you
98 need, and that they are in the correct order.  For typesetting pieces
99 with specialized notation, it can be useful to modify existing or
100 to define new contexts.
101
102
103 A complete description of all available contexts is in the program
104 reference, see
105 @ifhtml
106 @internalsref{Contexts}.
107 @end ifhtml
108 @ifnothtml 
109 Translation @arrow{} Context.
110 @end ifnothtml
111
112 @c [TODO: describe propagation]
113
114
115 @menu
116 * Creating contexts::           
117 * Changing context properties on the fly::  
118 * Modifying context plug-ins::  
119 * Layout tunings within contexts::  
120 * Changing context default settings::  
121 * Defining new contexts::      
122 @end menu
123
124 @node Creating contexts
125 @subsection Creating contexts
126
127 For scores with only one voice and one staff, correct contexts are
128 created automatically.  For more complex scores, it is necessary to
129 create them by hand.  There are three commands that do this.
130
131 The easiest command is @code{\new}, and it also the quickest to type.
132 It is prepended to a music expression, for example
133
134 @cindex @code{\new}
135 @cindex new contexts
136 @cindex Context, creating
137
138 @example
139 \new @var{type} @var{music expression}
140 @end example
141
142 @noindent
143 where @var{type} is a context name (like @code{Staff} or
144 @code{Voice}).  This command creates a new context, and starts
145 interpreting the @var{music expression} with that.
146
147 A practical application of @code{\new} is a score with many
148 staves.  Each part that should be on its own staff, is preceded with 
149 @code{\new Staff}.
150
151 @lilypond[quote,verbatim,relative=2,raggedright,fragment]
152 << \new Staff { c4 c }
153    \new Staff { d4 d }
154 >>
155 @end lilypond
156
157 @cindex @code{\context}
158
159 Like @code{\new}, the @code{\context} command also directs a music
160 expression to a context object, but gives the context an extra name.  The
161 syntax is
162
163 @example
164 \context @var{type} = @var{id} @var{music}
165 @end example
166
167 This form will search for an existing context of type @var{type}
168 called @var{id}.  If that context does not exist yet, it is created.
169 This is useful if the context is referred to later on.  For example, when
170 setting lyrics the melody is in a named context
171
172 @example
173 \CONtext Voice = "@b{tenor}" @var{music}
174 @end example
175
176 @noindent
177 so the texts can be properly aligned to its notes,
178
179 @example
180 \new Lyrics \lyricsto "@b{tenor}" @var{lyrics} 
181 @end example
182
183 @noindent
184
185 Another possibility is funneling two different music expressions into
186 one context.  In the following example, articulations and notes are
187 entered separately,
188
189 @example
190 music = @{ c4 c4 @}
191 arts = @{ s4-. s4-> @}
192 @end example
193
194 They are combined by sending both to the same @context{Voice} context,
195
196 @example
197 << \new Staff \context Voice = "A" \music
198    \context Voice = "A" \arts
199 >>
200 @end example
201 @lilypond[quote,raggedright]
202 music = { c4 c4 }
203 arts = { s4-. s4-> }
204 \relative c'' <<
205   \new Staff \context Voice = "A" \music
206   \context Voice = "A" \arts
207 >>
208 @end lilypond
209
210 With this mechanism, it is possible to define an Urtext (original
211 edition), with the option to put several distinct articulations on the
212 same notes.
213
214 @cindex @code{\context}
215 @cindex creating contexts
216
217 The third command for creating contexts is
218 @example
219 \context @var{type} @var{music}
220 @end example
221
222
223 @noindent
224 This is similar to @code{\context} with @code{= @var{id}}, but matches
225 any context of type @var{type}, regardless of its given name.
226
227 This variant is used with music expressions that can be interpreted at
228 several levels.  For example, the @code{\applyoutput} command (see
229 @ref{Running a function on all layout objects}).  Without an explicit
230 @code{\context}, it is usually applied to @context{Voice}
231
232 @example
233 \applyoutput #@var{function}   % apply to Voice
234 @end example
235
236 To have it interpreted at the @context{Score} or @context{Staff} level use
237 these forms
238
239 @example
240 \context Score \applyoutput #@var{function}
241 \context Staff \applyoutput #@var{function}
242 @end example
243
244
245 @node Changing context properties on the fly
246 @subsection Changing context properties on the fly
247
248 @cindex properties
249 @cindex @code{\set}
250 @cindex changing properties
251
252 Each context can have different @emph{properties}, variables contained
253 in that context.  They can be changed during the interpretation step.
254 This is achieved by inserting the @code{\set} command in the music,
255
256 @example
257 \set @var{context}.@var{prop} = #@var{value}
258 @end example
259
260 For example,
261 @lilypond[quote,verbatim,relative=2,fragment]
262 R1*2 
263 \set Score.skipBars = ##t
264 R1*2
265 @end lilypond
266
267 This command skips measures that have no notes.  The result is that
268 multi-rests are condensed.  The value assigned is a Scheme object.  In
269 this case, it is @code{#t}, the boolean True value.
270
271 If the @var{context} argument is left out, then the current bottom-most
272 context (typically @context{ChordNames}, @context{Voice}, or
273 @context{Lyrics}) is used.  In this example,
274
275 @lilypond[quote,verbatim,relative=2,fragment]
276 c8 c c c
277 \set autoBeaming = ##f
278 c8 c c c
279 @end lilypond
280
281 @noindent
282 the @var{context} argument to @code{\set} is left out, so automatic
283 beaming is switched off in the current @internalsref{Voice}.  Note that
284 the bottom-most context does not always contain the property that you
285 wish to change -- for example, attempting to set the @code{skipBars}
286 property (of the bottom-most context, in this case @code{Voice}) will
287 have no effect.
288
289 @lilypond[quote,verbatim,relative=2,fragment]
290 R1*2 
291 \set skipBars = ##t
292 R1*2
293 @end lilypond
294
295 Contexts are hierarchical, so if a bigger context was specified, for
296 example @context{Staff}, then the change would also apply to all
297 @context{Voice}s in the current stave.  The change is applied
298 `on-the-fly', during the music, so that the setting only affects the
299 second group of eighth notes.
300
301 @cindex @code{\unset} 
302
303 There is also an @code{\unset} command,
304 @example
305 \unset @var{context}.@var{prop}
306 @end example
307
308 @noindent
309 which removes the definition of @var{prop}.  This command removes
310 the definition only if it is set in @var{context}, so
311
312 @example
313 \set Staff.autoBeaming = ##f
314 @end example
315
316 @noindent
317 introduces a property setting at @code{Staff} level.  The setting also
318 applies to the current @code{Voice}.  However,
319
320 @example
321 \unset Voice.autoBeaming
322 @end example
323
324 @noindent
325 does not have any effect.  To cancel this setting, the @code{\unset}
326 must be specified on the same level as the original @code{\set}.  In
327 other words, undoing the effect of @code{Staff.autoBeaming = ##f}
328 requires
329 @example
330 \unset Staff.autoBeaming
331 @end example
332
333 Like @code{\set}, the @var{context} argument does not have to be
334 specified for a bottom context, so the two statements
335
336 @example
337 \set Voice.autoBeaming = ##t 
338 \set autoBeaming = ##t 
339 @end example 
340
341 @noindent
342 are equivalent.
343
344
345 @cindex \once
346 Settings that should only apply to a single time-step can be entered
347 with @code{\once}, for example in
348
349 @lilypond[quote,verbatim,relative=2,fragment]
350 c4
351 \once \set fontSize = #4.7
352 c4
353 c4
354 @end lilypond
355
356 the property @code{fontSize} is unset automatically after the second
357 note.
358
359 A full description of all available context properties is in the
360 program reference, see
361 @ifhtml
362 @internalsref{Tunable context properties}.
363 @end ifhtml
364 @ifnothtml
365 Translation @arrow{} Tunable context properties.
366 @end ifnothtml
367
368
369 @node Modifying context plug-ins
370 @subsection Modifying context plug-ins
371
372 Notation contexts (like Score and Staff) not only store properties,
373 they also contain plug-ins, called ``engravers'' that create notation
374 elements.  For example, the Voice context contains a
375 @code{Note_head_engraver} and the Staff context contains a
376 @code{Key_signature_engraver}.
377
378 For a full a description of each plug-in, see 
379 @ifhtml
380 @internalsref{Engravers}.
381 @end ifhtml
382 @ifnothtml
383 Program reference @arrow Translation @arrow{} Engravers.
384 @end ifnothtml
385 Every context described in
386 @ifhtml
387 @internalsref{Contexts}
388 @end ifhtml
389 @ifnothtml 
390 Program reference @arrow Translation @arrow{} Context.
391 @end ifnothtml
392 lists the engravers used for that context.
393
394
395 It can be useful to shuffle around these plug-ins.  This is done by
396 starting a new context, with @code{\new} or @code{\context}, and
397 modifying it like this, 
398
399 @example
400 \new @var{context} \with @{
401   \consists @dots{}
402   \consists @dots{}
403   \remove @dots{}
404   \remove @dots{}
405   @emph{etc.}
406 @}
407 @emph{..music..}
408 @end example
409
410 @noindent
411 where the @dots{} should be the name of an engraver.  Here is a simple
412 example which removes @code{Time_signature_engraver} and
413 @code{Clef_engraver} from a @code{Staff} context,
414
415 @lilypond[quote,relative=1,verbatim,fragment]
416 << \new Staff {
417     f2 g
418   }
419   \new Staff \with {
420      \remove "Time_signature_engraver"
421      \remove "Clef_engraver"
422   } {
423     f2 g2
424   }
425 >>
426 @end lilypond
427
428 In the second staff there are no time signature or clef symbols.  This
429 is a rather crude method of making objects disappear since it will affect
430 the entire staff.  The spacing is adversely influenced too.  A more
431 sophisticated method of blanking objects is shown in @ref{Common tweaks}.
432
433 The next example shows a practical application.  Bar lines and time
434 signatures are normally synchronized across the score.  This is done
435 by the @code{Timing_engraver}.  This plug-in keeps an administration of
436 time signature, location within the measure, etc.  By moving the
437 @code{Timing_engraver} engraver from @code{Score} to @code{Staff}
438 context, we can have a score where each staff has its own time
439 signature.
440
441 @cindex polymetric scores
442 @cindex Time signatures, multiple
443
444 @lilypond[quote,relative=1,raggedright,verbatim,fragment]
445 \new Score \with {
446   \remove "Timing_engraver"
447 } <<
448   \new Staff \with {
449     \consists "Timing_engraver"
450   } {
451       \time 3/4
452       c4 c c c c c
453   }
454   \new Staff \with {
455     \consists "Timing_engraver"
456   } {
457        \time 2/4
458        c4 c c c c c
459   }
460 >>
461 @end lilypond
462
463
464 @node Layout tunings within contexts
465 @subsection Layout tunings within contexts
466
467 Each context is responsible for creating certain types of graphical
468 objects.  The settings used for printing these objects are also stored by
469 context.  By changing these settings, the appearance of objects can be
470 altered.
471  
472 The syntax for this is
473
474 @example
475 \override @var{context}.@var{name} #'@var{property} = #@var{value}
476 @end example
477
478 Here @var{name} is the name of a graphical object, like @code{Stem} or
479 @code{NoteHead}, and @var{property} is an internal variable of the
480 formatting system (`grob property' or `layout property').  The latter is a
481 symbol, so it must be quoted.  The subsection @ref{Constructing a
482 tweak} explains what to fill in for @var{name}, @var{property}, and
483 @var{value}.  Here we only discuss the functionality of this command.
484
485 The command
486
487 @verbatim
488 \override Staff.Stem #'thickness = #4.0 
489 @end verbatim
490
491 @noindent
492 makes stems thicker (the default is 1.3, with staff line thickness as a
493 unit).  Since the command specifies @context{Staff} as context, it only
494 applies to the current staff.  Other staves will keep their normal
495 appearance.  Here we see the command in action:
496
497 @lilypond[quote,verbatim,relative=2,fragment]
498 c4
499 \override Staff.Stem #'thickness = #4.0 
500 c4
501 c4
502 c4
503 @end lilypond
504
505 The @code{\override} command changes the definition of the @code{Stem}
506 within the current @context{Staff}.  After the command is interpreted
507 all stems are thickened.
508
509 Analogous to @code{\set}, the @var{context} argument may be left out,
510 causing it to default to @context{Voice}, and adding @code{\once} applies
511 the change during one timestep only 
512
513 @lilypond[quote,fragment,verbatim,relative=2]
514 c4
515 \once \override Stem #'thickness = #4.0 
516 c4
517 c4 
518 @end lilypond
519
520 The @code{\override} must be done before the object is
521 started.  Therefore, when altering @emph{Spanner} objects, like slurs or
522 beams, the @code{\override} command must be executed at the moment when
523 the object is created.  In this example,
524
525
526 @lilypond[quote,fragment,verbatim,relative=2]
527 \override Slur #'thickness = #3.0
528 c8[( c
529 \override Beam #'thickness = #0.6
530 c8 c]) 
531 @end lilypond
532
533 @noindent
534 the slur is fatter but the beam is not.  This is because the command for
535 @code{Beam} comes after the Beam is started.  Therefore it has no effect.
536
537 Analogous to @code{\unset}, the @code{\revert} command for a context
538 undoes an @code{\override} command; like with @code{\unset}, it only
539 affects settings that were made in the same context.  In other words, the
540 @code{\revert} in the next example does not do anything.
541
542 @example
543 \override Voice.Stem #'thickness = #4.0
544 \revert Staff.Stem #'thickness
545 @end example
546
547
548
549
550 @seealso
551
552 Internals: @internalsref{OverrideProperty}, @internalsref{RevertProperty},
553 @internalsref{PropertySet}, @internalsref{All-backend-properties}, and
554 @internalsref{All layout objects}.
555
556
557 @refbugs
558
559 The back-end is not very strict in type-checking object properties.
560 Cyclic references in Scheme values for properties can cause hangs
561 or crashes, or both.
562
563
564 @node Changing context default settings
565 @subsection Changing context default settings
566
567 The adjustments of the previous subsections (@ref{Changing context
568 properties on the fly}, @ref{Modifying context plug-ins}, and
569 @ref{Layout tunings within contexts}) can also be entered separately
570 from the music, in the @code{\layout} block,
571
572 @example
573 \layout @{
574   @dots{}
575   \context @{
576     \Staff
577
578     \set fontSize = #-2
579     \override Stem #'thickness = #4.0
580     \remove "Time_signature_engraver"
581   @}
582 @}
583 @end example
584
585 Here
586 @example
587 \Staff
588 @end example
589
590 @noindent
591 takes the existing definition for context @context{Staff} from the
592 identifier @code{\Staff}. 
593
594 The statements
595 @example
596 \set fontSize = #-2
597 \override Stem #'thickness = #4.0
598 \remove "Time_signature_engraver"
599 @end example
600
601 @noindent
602 affect all staves in the score.
603
604 Other contexts can be modified analogously.
605
606 The @code{\set} keyword is optional within the @code{\layout} block, so
607
608 @example
609 \context @{
610   @dots{}
611   fontSize = #-2
612 @}
613 @end example
614
615 @noindent
616 will also work.
617
618
619
620 @refbugs
621
622 It is not possible to collect context changes in a variable, and apply
623 them to one @code{\context} definition by referring to that variable.
624
625 The @code{\RemoveEmptyStaffContext} will override your current
626 @code{\Staff} variable.  If you wish to change the defaults for a
627 staff that uses @code{\RemoveEmptyStaffContext}, you must do so
628 after calling @code{\RemoveemptyStaffContext}, ie
629
630 @example
631 \layout @{
632   \context @{
633     \RemoveEmptyStaffContext
634
635     \override Stem #'thickness = #4.0
636   @}
637 @}
638 @end example
639
640
641 @node Defining new contexts
642 @subsection Defining new contexts
643
644 Specific contexts, like @context{Staff} and @code{Voice}, are made of
645 simple building blocks, and it is possible to compose engraver
646 plug-ins in different combinations, thereby creating new types of
647 contexts.
648
649 The next example shows how to build a different type of
650 @context{Voice} context from scratch.  It will be similar to
651 @code{Voice}, but prints centered slash noteheads only.  It can be used
652 to indicate improvisation in Jazz pieces,
653
654 @lilypond[quote,raggedright]
655 \layout { \context {
656   \name ImproVoice
657   \type "Engraver_group_engraver"
658   \consists "Note_heads_engraver"
659   \consists "Text_engraver"
660   \consists Pitch_squash_engraver
661   squashedPosition = #0
662   \override NoteHead #'style = #'slash
663   \override Stem #'transparent = ##t
664   \alias Voice
665 }
666 \context { \Staff
667   \accepts "ImproVoice"
668 }}
669
670 \relative c'' {
671   a4 d8 bes8 \new ImproVoice { c4^"ad lib" c 
672    c4 c^"undress" c_"while playing :)" c } 
673   a1 
674 }
675 @end lilypond
676
677
678 These settings are again done within a @code{\context} block inside a
679 @code{\layout} block,
680
681 @example
682 \layout @{
683   \context @{
684     @dots{}
685   @}
686 @}
687 @end example
688
689 In the following discussion, the example input shown should go on the
690 @dots{} in the previous fragment.
691
692 First, the context gets a name.  Instead of @context{Voice} it
693 will be called @context{ImproVoice},
694
695 @example
696 \name ImproVoice
697 @end example
698
699 Since it is similar to the @context{Voice}, we want commands that work
700 on (existing) @context{Voice}s to remain working.  This is achieved by
701 giving the new context an alias @context{Voice},
702
703 @example
704 \alias Voice
705 @end example
706
707 The context will print notes, and instructive texts
708
709 @example
710 \consists Note_heads_engraver
711 \consists Text_engraver
712 @end example
713
714 but only on the center line,
715
716 @example
717 \consists Pitch_squash_engraver
718 squashedPosition = #0
719 @end example
720
721 The @internalsref{Pitch_squash_engraver} modifies note heads (created
722 by @internalsref{Note_heads_engraver}) and sets their vertical
723 position to the value of @code{squashedPosition}, in this case@tie{}@code{0},
724 the center line.
725
726 The notes look like a slash, without a stem,
727
728 @example
729 \override NoteHead #'style = #'slash
730 \override Stem #'transparent = ##t
731 @end example
732
733
734 All these plug-ins have to cooperate, and this is achieved with a
735 special plug-in, which must be marked with the keyword @code{\type}.
736 This should always be @internalsref{Engraver_group_engraver},
737
738 @example
739 \type "Engraver_group_engraver"
740 @end example
741
742 Put together, we get
743
744 @example
745 \context @{
746   \name ImproVoice
747   \type "Engraver_group_engraver"
748   \consists "Note_heads_engraver"
749   \consists "Text_engraver"
750   \consists Pitch_squash_engraver
751   squashedPosition = #0
752   \override NoteHead #'style = #'slash
753   \override Stem #'transparent = ##t
754   \alias Voice
755 @}
756 @end example
757
758 Contexts form hierarchies.  We want to hang the @context{ImproVoice}
759 under @context{Staff}, just like normal @code{Voice}s.  Therefore, we
760 modify the @code{Staff} definition with the @code{\accepts}
761 command,@footnote{The opposite of @code{\accepts} is @code{\denies},
762 which is sometimes needed when reusing existing context definitions.}
763
764
765
766 @example
767 \context @{
768   \Staff
769   \accepts ImproVoice    
770 @}
771 @end example
772
773 Putting both into a @code{\layout} block, like
774
775 @example
776 \layout @{
777   \context @{
778     \name ImproVoice
779     @dots{}
780   @}
781   \context @{
782     \Staff
783     \accepts "ImproVoice"
784   @}
785 @}
786 @end example
787
788 Then the output at the start of this subsection can be entered as
789
790 @example
791 \relative c'' @{
792   a4 d8 bes8
793   \new ImproVoice @{
794     c4^"ad lib" c 
795     c4 c^"undress"
796     c c_"while playing :)"
797   @}
798   a1
799 @}
800 @end example
801   
802
803     
804
805 @node The \override command
806 @section The \override command
807
808 In the previous section, we have already touched on a command that
809 changes layout details: the @code{\override} command.  In this section,
810 we will look in more detail at how to use the command in practice.
811 First, we will give a few versatile commands that are sufficient
812 for many situations.  The next section will discuss the general use of
813 @code{\override}.
814
815
816 @menu
817 * Common tweaks::               
818 * Constructing a tweak::        
819 * Navigating the program reference::  
820 * Layout interfaces::           
821 * Determining the grob property::  
822 * Difficult tweaks::            
823 @end menu
824
825
826
827 @node Common tweaks
828 @subsection Common tweaks
829
830 @c  Should we point at ly/property-init.ly ?  -gp
831 Some overrides are so common that predefined commands are provided as
832 short-cuts, for example, @code{\slurUp} and @code{\stemDown}.  These
833 commands are described in
834 @ifhtml
835 the
836 @end ifhtml
837 @ref{Notation manual}, under the sections for slurs and stems
838 respectively.
839
840 The exact tuning possibilities for each type of layout object are
841 documented in the program reference of the respective
842 object.  However, many layout objects share properties, which can be
843 used to apply generic tweaks.  We mention a few of these:
844
845 @itemize @bullet
846 @item The @code{extra-offset} property, which
847 @cindex @code{extra-offset}
848 has a pair of numbers as value, moves objects around in the printout.
849 The first number controls left-right movement; a positive number will
850 move the object to the right.  The second number controls up-down
851 movement; a positive number will move it higher.  The units of these
852 offsets are staff-spaces.  The @code{extra-offset} property is a
853 low-level feature: the formatting engine is completely oblivious to
854 these offsets.
855
856 In the following example, the second fingering is moved a little to
857 the left, and 1.8 staff space downwards:
858
859 @cindex setting object properties
860
861 @lilypond[quote,fragment,relative=1,verbatim]
862 \stemUp
863 f-5
864 \once \override Fingering
865     #'extra-offset = #'(-0.3 . -1.8) 
866 f-5
867 @end lilypond
868
869 @item
870 Setting the @code{transparent} property will cause an object to be printed
871 in `invisible ink': the object is not printed, but all its other
872 behavior is retained.  The object still takes up space, it takes part in
873 collisions, and slurs, ties, and beams can be attached to it.
874
875 @cindex transparent objects
876 @cindex removing objects
877 @cindex hiding objects
878 @cindex invisible objects
879 The following example demonstrates how to connect different voices
880 using ties.  Normally, ties only connect two notes in the same
881 voice.  By introducing a tie in a different voice,
882
883 @lilypond[quote,fragment,relative=2]
884 << {
885   b8~ b8\noBeam
886 } \\ {
887   b[ g8]
888 } >>
889 @end lilypond
890
891 @noindent
892 and blanking the first up-stem in that voice, the tie appears to cross
893 voices:
894
895 @lilypond[quote,fragment,relative=2,verbatim]
896 << {
897   \once \override Stem #'transparent = ##t
898   b8~ b8\noBeam
899 } \\ {
900   b[ g8]
901 } >>
902 @end lilypond
903
904 @item
905 The @code{padding} property for objects with
906 @cindex @code{padding}
907 @code{side-position-interface} can be set to increase the distance between
908 symbols that are printed above or below notes.  We only give an
909 example; a more elaborate explanation is in @ref{Constructing a
910 tweak}:
911
912 @lilypond[quote,fragment,relative=1,verbatim]
913 c2\fermata
914 \override Script #'padding = #3
915 b2\fermata
916 @end lilypond
917
918 @end itemize
919
920 More specific overrides are also possible.  The next section
921 discusses in depth how to figure out these statements for yourself.
922
923
924 @node Constructing a tweak
925 @subsection Constructing a tweak
926
927 The general procedure of changing output, that is, entering
928 a command like
929
930 @example
931 \override Voice.Stem #'thickness = #3.0
932 @end example
933
934 @noindent
935 means that we have to determine these bits of information:
936
937 @itemize
938 @item the context: here @context{Voice}.
939 @item the layout object: here @code{Stem}.
940 @item the layout property: here @code{thickness}
941 @item a sensible value: here @code{3.0}
942 @end itemize  
943
944
945 @cindex internal documentation
946 @cindex finding graphical objects
947 @cindex graphical object descriptions 
948 @cindex tweaking
949 @cindex @code{\override}
950 @cindex internal documentation
951
952 We demonstrate how to glean this information from the notation manual
953 and the program reference.
954
955 @node Navigating the program reference
956 @subsection Navigating the program reference
957
958 Suppose we want to move the fingering indication in the fragment
959 below:
960
961 @lilypond[quote,fragment,relative=2,verbatim]
962 c-2
963 \stemUp
964 f
965 @end lilypond
966
967 If you visit the documentation on fingering instructions (in
968 @ref{Fingering instructions}), you will notice that there is written:
969
970 @quotation
971 @seealso
972
973 Program reference: @internalsref{FingerEvent} and @internalsref{Fingering}.
974
975 @end quotation
976
977
978
979 This fragment points to two parts of the program reference: a page
980 on @code{FingerEvent} and one on @code{Fingering}.
981
982 The page on @code{FingerEvent} describes the properties of the music
983 expression for the input @code{-2}.  The page contains many links
984 forward.  For example, it says
985
986 @quotation
987 Accepted by: @internalsref{Fingering_engraver},
988 @end quotation 
989
990 @noindent
991 That link brings us to the documentation for the Engraver, the
992 plug-in, which says
993
994 @quotation
995 This engraver creates the following layout objects: @internalsref{Fingering}.
996 @end quotation
997
998 In other words, once the @code{FingerEvent}s are interpreted, the
999 @code{Fingering_engraver} plug-in will process them.
1000 The @code{Fingering_engraver} is also listed to create
1001 @internalsref{Fingering} objects,
1002
1003
1004 Lo and behold, that is also the
1005 second bit of information listed under @b{See also} in the Notation
1006 manual.  By clicking around in the program reference, we can follow the
1007 flow of information within the program, either forward (like we did
1008 here), or backwards, following links like this:
1009
1010 @itemize @bullet
1011
1012 @item @internalsref{Fingering}:
1013 @internalsref{Fingering} objects are created by:
1014 @b{@internalsref{Fingering_engraver}}
1015
1016 @item @internalsref{Fingering_engraver}:
1017 Music types accepted: @b{@internalsref{fingering-event}}
1018
1019 @item @internalsref{fingering-event}:
1020 Music event type @code{fingering-event} is in Music expressions named
1021 @b{@internalsref{FingerEvent}}
1022 @end itemize
1023
1024 This path goes against the flow of information in the program: it
1025 starts from the output, and ends at the input event.
1026
1027 The program reference can also be browsed like a normal document.  It
1028 contains a chapter on
1029 @ifhtml
1030 @internalsref{Music definitions},
1031 @end ifhtml
1032 @ifnothtml
1033 @code{Music definitions}
1034 @end ifnothtml
1035 on @internalsref{Translation}, and the @internalsref{Backend}.  Every
1036 chapter lists all the definitions used, and all properties that may be
1037 tuned.
1038
1039  
1040 @node Layout interfaces
1041 @subsection Layout interfaces
1042
1043 @cindex interface, layout
1044 @cindex layout interface
1045
1046 The HTML page that we found in the previous section, describes the
1047 layout object called @internalsref{Fingering}.  Such an object is a
1048 symbol within the score.  It has properties that store numbers (like
1049 thicknesses and directions), but also pointers to related objects.  A
1050 layout object is also called @emph{grob},
1051 @cindex grob
1052 which is short for Graphical Object.
1053
1054
1055 The page for @code{Fingering} lists the definitions for the
1056 @code{Fingering} object.  For example, the page says
1057
1058 @quotation
1059 @code{padding} (dimension, in staff space):
1060   
1061 @code{0.6}
1062 @end quotation
1063
1064 @noindent
1065 which means that the number will be kept at a distance of at least 0.6
1066 of the note head.
1067
1068
1069 Each layout object may have several functions as a notational or
1070 typographical element.  For example, the Fingering object
1071 has the following aspects
1072
1073 @itemize @bullet
1074 @item
1075 Its size is independent of the horizontal spacing, unlike slurs or beams.
1076
1077 @item
1078 It is a piece of text.  Granted, it is usually a very short text.
1079
1080 @item
1081 That piece of text is typeset with a font, unlike slurs or beams.
1082
1083 @item
1084 Horizontally, the center of the symbol should be aligned to the
1085 center of the notehead.
1086
1087 @item
1088 Vertically, the symbol is placed next to the note and the staff.
1089
1090 @item
1091 The vertical position is also coordinated with other super- and subscript
1092 symbols.
1093 @end itemize
1094
1095 Each of these aspects is captured in so-called @emph{interface}s,
1096 which are listed on the @internalsref{Fingering} page at the bottom
1097
1098 @quotation
1099 This object supports the following interfaces:
1100 @internalsref{item-interface},
1101 @internalsref{self-alignment-interface},
1102 @internalsref{side-position-interface}, @internalsref{text-interface},
1103 @internalsref{text-script-interface}, @internalsref{font-interface},
1104 @internalsref{finger-interface}, and @internalsref{grob-interface}.
1105 @end quotation
1106
1107 Clicking any of the links will take you to the page of the respective
1108 object interface.  Each interface has a number of properties.  Some of
1109 them are not user-serviceable (``Internal properties''), but others
1110 are.
1111
1112 We have been talking of @emph{the} @code{Fingering} object, but actually it
1113 does not amount to much.  The initialization file
1114 @file{scm/@/define@/-grobs@/.scm} shows the soul of the `object',
1115
1116 @example
1117 (Fingering
1118   . ((print-function . ,Text_interface::print)
1119      (padding . 0.6)
1120      (staff-padding . 0.6)
1121      (self-alignment-X . 0)
1122      (self-alignment-Y . 0)
1123      (script-priority . 100)
1124      (font-size . -5)
1125      (meta . ((interfaces . (finger-interface font-interface
1126                              text-script-interface text-interface
1127                              side-position-interface
1128                              self-alignment-interface
1129                              item-interface))))))
1130 @end example
1131
1132 @noindent
1133 As you can see, the @code{Fingering} object is nothing more than a
1134 bunch of variable settings, and the webpage in the Program Reference
1135 is directly generated from this definition.
1136
1137 @node Determining the grob property
1138 @subsection Determining the grob property
1139
1140
1141 Recall that we wanted to change the position of the @b{2} in 
1142
1143 @lilypond[quote,fragment,relative=2,verbatim]
1144 c-2
1145 \stemUp
1146 f
1147 @end lilypond
1148
1149 Since the @b{2} is vertically positioned next to its note, we have to
1150 meddle with the interface associated with this positioning.  This is
1151 done using @code{side-position-interface}.  The page for this interface 
1152 says
1153
1154 @quotation
1155 @code{side-position-interface}
1156
1157 Position a victim object (this one) next to other objects (the
1158 support).  The property @code{direction} signifies where to put the
1159 victim object relative to the support (left or right, up or down?)
1160 @end quotation
1161
1162 @cindex padding
1163 @noindent
1164 below this description, the variable @code{padding} is described as
1165
1166 @quotation
1167 @table @code
1168 @item padding
1169 (dimension, in staff space)
1170
1171 Add this much extra space between objects that are next to each other. 
1172 @end table
1173 @end quotation
1174
1175 By increasing the value of @code{padding}, we can move away the
1176 fingering.  The following command inserts 3 staff spaces of white
1177 between the note and the fingering:
1178 @example
1179 \once \override Voice.Fingering #'padding = #3
1180 @end example
1181
1182 Inserting this command before the Fingering object is created,
1183 i.e., before @code{c2}, yields the following result:
1184
1185 @lilypond[quote,relative=2,fragment,verbatim]
1186 \once \override Voice.Fingering #'padding = #3
1187 c-2
1188 \stemUp
1189 f
1190 @end lilypond
1191
1192
1193 In this case, the context for this tweak is @context{Voice}.  This
1194 fact can also be deduced from the program reference, for the page for
1195 the @internalsref{Fingering_engraver} plug-in says
1196
1197 @quotation
1198 Fingering_engraver is part of contexts: @dots{} @b{@internalsref{Voice}}
1199 @end quotation
1200
1201 @node Difficult tweaks
1202 @subsection Difficult tweaks
1203
1204 There are two classes of difficult adjustments.  First, when there are
1205 several of the same objects at one point, and you want to adjust only
1206 one.  For example, if you want to change only one note head in a chord.
1207
1208 In this case, the @code{\applyoutput} function must be used.  The
1209 next example defines a Scheme function @code{set-position-font-size}
1210 that sets the @code{font-size} property, but only  
1211 on objects that have @internalsref{note-head-interface} and are at the
1212 right Y-position.
1213
1214 @lilypond[quote,verbatim]
1215 #(define ((set-position-font-size pos size) grob origin current)
1216   (let*
1217       ((interfaces (ly:grob-property grob 'interfaces))
1218        (position (ly:grob-property grob 'staff-position)))
1219    (if (and
1220         ; is this a note head?
1221         (memq 'note-head-interface interfaces)
1222
1223         ; is the Y coordinate right?
1224         (= pos position))
1225
1226       ; then do it.
1227       (set! (ly:grob-property grob 'font-size) size))))
1228
1229 \relative {
1230   c
1231   \applyoutput #(set-position-font-size -2 4)
1232   <c e g>
1233 }
1234 @end lilypond
1235
1236 @noindent
1237 A similar technique can be used for accidentals.  In that case, the
1238 function should check for @code{accidental-interface}.
1239
1240 Another difficult adjustment is the appearance of spanner objects,
1241 such as slur and tie.  Initially, only one of these objects is created,
1242 and they can be adjusted with the normal mechanism.  However, in some
1243 cases the spanners cross line breaks.  If this happens, these objects
1244 are cloned.  A separate object is created for every system that it is
1245 in.  These are clones of the original object and inherit all
1246 properties, including @code{\override}s.
1247
1248 In other words, an @code{\override} always affects all pieces of a
1249 broken spanner.  To change only one part of a spanner at a line break,
1250 it is necessary to hook into the formatting process.  The
1251 @code{after-line-breaking-callback} property contains the Scheme procedure
1252 that is called after the line breaks have been determined, and layout
1253 objects have been split over different systems.
1254
1255 In the following example, we define a procedure
1256 @code{my-callback}.  This procedure
1257  
1258 @itemize @bullet
1259 @item
1260 determines if we have been split across line breaks
1261 @item
1262 if yes, retrieves all the split objects
1263 @item
1264 checks if we are the last of the split objects
1265 @item
1266 if yes, it sets @code{extra-offset}.
1267 @end itemize
1268
1269 This procedure is installed into @internalsref{Tie}, so the last part
1270 of the broken tie is translated up.
1271
1272
1273 @lilypond[quote,verbatim,raggedright]
1274 #(define (my-callback grob)
1275   (let* (
1276          ; have we been split? 
1277          (orig (ly:grob-original grob))
1278
1279          ; if yes, get the split pieces (our siblings)
1280          (siblings (if (ly:grob? orig)
1281                      (ly:spanner-broken-into orig) '() )))
1282
1283    (if (and (>= (length siblings) 2)
1284              (eq? (car (last-pair siblings)) grob))
1285      (ly:grob-set-property! grob 'extra-offset '(-2 . 5)))))
1286
1287 \relative c'' { 
1288   \override Tie #'after-line-breaking-callback =
1289   #my-callback
1290   c1 ~ \break c2 ~ c
1291 }
1292 @end lilypond
1293
1294 @noindent
1295 When applying this trick, the new @code{after-line-breaking-callback}
1296 should also call the old @code{after-line-breaking-callback}, if there
1297 is one.  For example, if using this with @code{Slur},
1298 @code{Slur::after_line_breaking} should also be called.
1299
1300 @node Fonts
1301 @section Fonts
1302
1303 This section details the ways that the font can be changed.
1304
1305 @menu
1306 * Selecting font sizes::        
1307 * Font selection::              
1308 @end menu
1309
1310
1311
1312 @node Selecting font sizes
1313 @subsection Selecting font sizes
1314
1315
1316 The easiest method of setting the font size of any context, is by
1317 setting the @code{fontSize} property.
1318
1319 @lilypond[quote,fragment,relative=1,verbatim]
1320 c8
1321 \set fontSize = #-4
1322 c f
1323 \set fontSize = #3
1324 g
1325 @end lilypond
1326
1327 @noindent
1328 It does not change the size of variable symbols, such as beams or
1329 slurs.
1330
1331 Internally, the @code{fontSize} context property will cause the
1332 @code{font-size} property to be set in all layout objects.  The value
1333 of @code{font-size} is a number indicating the size relative to the
1334 standard size for the current staff height.  Each step up is an
1335 increase of approximately 12% of the font size.  Six steps is exactly a
1336 factor two.  The Scheme function @code{magstep} converts a
1337 @code{font-size} number to a scaling factor.
1338
1339 @lilypond[quote,fragment,relative=1,verbatim]
1340 c8
1341 \override NoteHead #'font-size = #-4
1342 c f
1343 \override NoteHead #'font-size = #3
1344 g
1345 @end lilypond
1346
1347 LilyPond has fonts in different design sizes.  The music fonts for
1348 smaller sizes are chubbier, while the text fonts are relatively wider.
1349 Font size changes are achieved by scaling the design size that is
1350 closest to the desired size.  The standard font size (for
1351 @code{font-size} equals 0), depends on the standard staff height.  For
1352 a 20pt staff, a 10pt font is selected.
1353
1354 The @code{font-size} mechanism does not work for fonts selected
1355 through @code{font-name}.  These may be scaled with
1356 @code{font-magnification}.  The @code{font-size} property can only be
1357 set on layout objects that use fonts; these are the ones supporting
1358 the @internalsref{font-interface} layout interface.
1359
1360 @refcommands
1361
1362 The following commands set @code{fontSize} for the current voice:
1363
1364 @cindex @code{\tiny}
1365 @code{\tiny}, 
1366 @cindex @code{\small}
1367 @code{\small}, 
1368 @cindex @code{\normalsize}
1369 @code{\normalsize}.
1370
1371
1372
1373 @cindex magnification
1374 @cindex cue notes
1375
1376
1377 @node Font selection
1378 @subsection Font selection
1379
1380
1381
1382 @cindex font selection
1383 @cindex font magnification
1384 @cindex @code{font-interface}
1385
1386 By setting the object properties described below, you can select a
1387 font from the preconfigured font families.  LilyPond has default
1388 support for the feta music fonts and @TeX{}'s Computer Modern text
1389 fonts.
1390
1391
1392 @itemize @bullet
1393 @item @code{font-encoding}
1394 is a symbol that sets layout of the glyphs.  This should only be set to
1395 select different types of non-text fonts, eg.
1396
1397 @code{fetaBraces} for piano staff braces, @code{fetaMusic} the
1398 standard music font, including ancient glyphs, @code{fetaDynamic} for
1399 dynamic signs and @code{fetaNumber} for the number font.
1400
1401 @item @code{font-family}
1402 is a symbol indicating the general class of the typeface.  Supported are
1403 @code{roman} (Computer Modern), @code{sans}, and @code{typewriter}.
1404   
1405 @item @code{font-shape}
1406 is a symbol indicating the shape of the font.  There are typically
1407 several font shapes available for each font family.  Choices are
1408 @code{italic}, @code{caps}, and @code{upright}.
1409
1410 @item @code{font-series}
1411 is a symbol indicating the series of the font.  There are typically
1412 several font series for each font family and shape.  Choices are
1413 @code{medium} and @code{bold}. 
1414
1415 @end itemize
1416
1417 Fonts selected in the way sketched above come from a predefined style
1418 sheet.
1419
1420 The font used for printing a object can be selected by setting
1421 @code{font-name}, e.g.,
1422 @example
1423 \override Staff.TimeSignature
1424     #'font-name = #"cmr17"
1425 @end example
1426
1427 @noindent
1428 Any font can be used, as long as it is available to @TeX{}.  Possible
1429 fonts include foreign fonts or fonts that do not belong to the
1430 Computer Modern font family.  The size of fonts selected in this way
1431 can be changed with the @code{font-magnification} property.  For
1432 example, @code{2.0} blows up all letters by a factor 2 in both
1433 directions.
1434
1435 @cindex font size
1436 @cindex font magnification
1437
1438
1439
1440 @seealso
1441
1442 Init files: @file{ly/@/declarations@/-init@/.ly} contains hints how new
1443 fonts may be added to LilyPond.
1444
1445
1446
1447 @node Text markup
1448 @section Text markup
1449 @cindex text markup
1450 @cindex markup text
1451
1452
1453 @cindex typeset text
1454
1455 The internal mechanism to typeset texts is accessed with the keyword
1456 @code{\markup}.  Within markup mode, you can enter texts similar to
1457 lyrics.  They are simply entered, while commands use the backslash @code{\}.
1458 @cindex markup
1459
1460 @lilypond[quote,verbatim,fragment,relative=1]
1461 c1^\markup { hello }
1462 c1_\markup { hi there }
1463 c1^\markup { hi \bold there, is \italic anyone home? }
1464 @end lilypond
1465
1466 @cindex font switching
1467
1468 The markup in the example demonstrates font switching commands.  The
1469 command @code{\bold} and @code{\italic} apply to the first following 
1470 word only; enclose a set of texts with braces to apply a command
1471 to more words:
1472 @example
1473 \markup @{ \bold @{ hi there @} @}
1474 @end example
1475
1476 @noindent
1477 For clarity, you can also do this for single arguments, e.g.,
1478
1479 @example
1480 \markup @{ is \italic @{ anyone @} home @}
1481 @end example
1482
1483 @cindex font size, texts
1484
1485
1486 In markup mode you can compose expressions, similar to mathematical
1487 expressions, XML documents, and music expressions.  You can stack
1488 expressions grouped vertically with the command @code{\column}.
1489 Similarly, @code{\center-align} aligns texts by their center lines:
1490
1491 @lilypond[quote,verbatim,fragment,relative=1]
1492 c1^\markup { \column { a bbbb \line { c d } } }
1493 c1^\markup { \center-align { a bbbb c } }
1494 c1^\markup { \line { a b c } }
1495 @end lilypond
1496
1497
1498 Markups can be stored in variables and these variables
1499 may be attached to notes, like
1500 @example
1501 allegro = \markup @{ \bold \large @{ Allegro @} @}
1502  @{ a^\allegro b c d @}
1503 @end example
1504
1505
1506 Some objects have alignment procedures of their own, which cancel out
1507 any effects of alignments applied to their markup arguments as a
1508 whole.  For example, the @internalsref{RehearsalMark} is horizontally
1509 centered, so using @code{\mark \markup @{ \left-align .. @}} has no
1510 effect.
1511
1512 Similarly, for moving whole texts over notes with
1513 @code{\raise}, use the following trick:
1514 @lilypond[quote,verbatim]
1515 {
1516   c'^\markup { \raise #0.5 not-raised }
1517   c'^\markup { "" \raise #0.5 raised }
1518 }
1519 @end lilypond
1520
1521 On the second note, the text @code{raised} is moved relative to the
1522 empty string @code{""} which is not visible.  Alternatively, complete
1523 objects can be moved with layout properties such as @code{padding} and
1524 @code{extra-offset}.
1525
1526
1527
1528
1529 @seealso
1530
1531 Init files: @file{scm/@/new@/-markup@/.scm}.
1532
1533
1534 @refbugs
1535
1536 Kerning or generation of ligatures is only done when the @TeX{}
1537 backend is used.  In this case, LilyPond does not account for them so
1538 texts will be spaced slightly too wide.
1539
1540 Syntax errors for markup mode are confusing.
1541
1542
1543 @menu
1544 * Text encoding::               
1545 * Nested scores::               
1546 * Overview of text markup commands::  
1547 * New dynamic marks::
1548 @end menu
1549
1550 @node Text encoding
1551 @subsection Text encoding
1552
1553 LilyPond uses the Pango library to format multi-lingual texts, and
1554 does not perform any input-encoding conversions.  This means that any
1555 text, be it title, lyric text, or musical instruction containing
1556 non-ASCII characters, must be utf-8.  Easiest to enter such texts is
1557 by using a Unicode-aware editor, and save using utf-8 encoding.  Most
1558 popular modern editors have utf-8 support, for example, vim, Emacs,
1559 jEdit, and GEdit do.
1560
1561 Depending on the fonts installed, the following fragment shows Hebrew
1562 and Cyrillic lyrics,
1563
1564 @cindex Cyrillic
1565 @cindex Hebrew
1566 @cindex ASCII, non
1567
1568 @lilypondfile[fontload]{utf8.ly}
1569
1570
1571 The @TeX{} backend does not handle encoding specially at all.  Strings
1572 in the input are put in the output as-is.  Extents of text items in the
1573 @TeX{} backend, are determined by reading a file created via the
1574 @file{texstr} backend,
1575
1576 @example
1577 lilypond -b texstr input/les-nereides.ly
1578 latex les-nereides.texstr
1579 @end example
1580
1581 The last command produces @file{les-nereides.textmetrics}, which is
1582 read when you execute
1583
1584 @example
1585 lilypond -b tex input/les-nereides.ly
1586 @end example
1587
1588 Both @file{les-nereides.texstr} and @file{les-nereides.tex} need
1589 suitable LaTeX wrappers to load appropriate La@TeX{} packages for
1590 interpreting non-ASCII strings.
1591
1592 @seealso
1593
1594 @inputfileref{input/regression,utf8.ly}
1595
1596
1597 @node Nested scores
1598 @subsection Nested scores
1599
1600 It is possible to nest music inside markups, by adding a @code{\score}
1601 block to a markup expression.  Such a score must contain a @code{\layout}
1602 block.
1603
1604 @lilypond[quote,verbatim,raggedright]
1605 \relative {
1606   c4 d^\markup {
1607     \score {
1608       \relative { c4 d e f }
1609       \layout { }
1610     }
1611   }
1612   e f
1613 }
1614 @end lilypond
1615  
1616
1617
1618 @node Overview of text markup commands
1619 @subsection Overview of text markup commands
1620
1621 The following commands can all be used inside @code{\markup @{ @}}.
1622
1623 @include markup-commands.tely
1624
1625
1626 @node New dynamic marks
1627 @subsection New dynamic marks
1628
1629 It is possible to print new dynamic marks or text that should be aligned
1630 with dynamics.  Use @code{make-dynamic-script} to create these marks.
1631
1632 @cindex make-dynamic-script
1633
1634 @lilypond[quote,verbatim,raggedright]
1635 sfzp = #(make-dynamic-script "sfzp")
1636 \relative c' {
1637   c4 c c\sfzp c
1638 }
1639 @end lilypond
1640
1641 @cindex Dynamics, editorial
1642 @cindex Dynamics, parenthesis
1643
1644 It is also possible to print dynamics in round parenthesis or square
1645 brackets.  These are often used for adding editorial dynamics.
1646
1647 @lilypond[quote,verbatim,raggedright]
1648 \version "2.4.2"
1649 rndf = \markup{ \center-align {\line { \bold{\italic (}
1650   \dynamic f \bold{\italic )} }} }
1651 boxf = \markup{ \bracket { \dynamic f } }
1652 { c'1_\rndf c'1_\boxf }
1653 @end lilypond
1654
1655
1656