]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/changing-defaults.itely
Misc small changes.
[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 @c @ref{Notation manual},
838 Notation manual
839 @c FIXME 
840 under the sections for slurs and stems
841 respectively.
842
843 The exact tuning possibilities for each type of layout object are
844 documented in the program reference of the respective
845 object.  However, many layout objects share properties, which can be
846 used to apply generic tweaks.  We mention a few of these:
847
848 @itemize @bullet
849 @item The @code{extra-offset} property, which
850 @cindex @code{extra-offset}
851 has a pair of numbers as value, moves objects around in the printout.
852 The first number controls left-right movement; a positive number will
853 move the object to the right.  The second number controls up-down
854 movement; a positive number will move it higher.  The units of these
855 offsets are staff-spaces.  The @code{extra-offset} property is a
856 low-level feature: the formatting engine is completely oblivious to
857 these offsets.
858
859 In the following example, the second fingering is moved a little to
860 the left, and 1.8 staff space downwards:
861
862 @cindex setting object properties
863
864 @lilypond[quote,fragment,relative=1,verbatim]
865 \stemUp
866 f-5
867 \once \override Fingering
868     #'extra-offset = #'(-0.3 . -1.8) 
869 f-5
870 @end lilypond
871
872 @item
873 Setting the @code{transparent} property will cause an object to be printed
874 in `invisible ink': the object is not printed, but all its other
875 behavior is retained.  The object still takes up space, it takes part in
876 collisions, and slurs, ties, and beams can be attached to it.
877
878 @cindex transparent objects
879 @cindex removing objects
880 @cindex hiding objects
881 @cindex invisible objects
882 The following example demonstrates how to connect different voices
883 using ties.  Normally, ties only connect two notes in the same
884 voice.  By introducing a tie in a different voice,
885
886 @lilypond[quote,fragment,relative=2]
887 << {
888   b8~ b8\noBeam
889 } \\ {
890   b[ g8]
891 } >>
892 @end lilypond
893
894 @noindent
895 and blanking the first up-stem in that voice, the tie appears to cross
896 voices:
897
898 @lilypond[quote,fragment,relative=2,verbatim]
899 << {
900   \once \override Stem #'transparent = ##t
901   b8~ b8\noBeam
902 } \\ {
903   b[ g8]
904 } >>
905 @end lilypond
906
907 @item
908 The @code{padding} property for objects with
909 @cindex @code{padding}
910 @code{side-position-interface} can be set to increase the distance between
911 symbols that are printed above or below notes.  We only give an
912 example; a more elaborate explanation is in @ref{Constructing a
913 tweak}:
914
915 @lilypond[quote,fragment,relative=1,verbatim]
916 c2\fermata
917 \override Script #'padding = #3
918 b2\fermata
919 @end lilypond
920
921 @end itemize
922
923 More specific overrides are also possible.  The next section
924 discusses in depth how to figure out these statements for yourself.
925
926
927 @node Constructing a tweak
928 @subsection Constructing a tweak
929
930 The general procedure of changing output, that is, entering
931 a command like
932
933 @example
934 \override Voice.Stem #'thickness = #3.0
935 @end example
936
937 @noindent
938 means that we have to determine these bits of information:
939
940 @itemize
941 @item the context: here @context{Voice}.
942 @item the layout object: here @code{Stem}.
943 @item the layout property: here @code{thickness}
944 @item a sensible value: here @code{3.0}
945 @end itemize  
946
947
948 @cindex internal documentation
949 @cindex finding graphical objects
950 @cindex graphical object descriptions 
951 @cindex tweaking
952 @cindex @code{\override}
953 @cindex internal documentation
954
955 We demonstrate how to glean this information from the notation manual
956 and the program reference.
957
958 @node Navigating the program reference
959 @subsection Navigating the program reference
960
961 Suppose we want to move the fingering indication in the fragment
962 below:
963
964 @lilypond[quote,fragment,relative=2,verbatim]
965 c-2
966 \stemUp
967 f
968 @end lilypond
969
970 If you visit the documentation on fingering instructions (in
971 @ref{Fingering instructions}), you will notice that there is written:
972
973 @quotation
974 @seealso
975
976 Program reference: @internalsref{FingerEvent} and @internalsref{Fingering}.
977
978 @end quotation
979
980
981
982 This fragment points to two parts of the program reference: a page
983 on @code{FingerEvent} and one on @code{Fingering}.
984
985 The page on @code{FingerEvent} describes the properties of the music
986 expression for the input @code{-2}.  The page contains many links
987 forward.  For example, it says
988
989 @quotation
990 Accepted by: @internalsref{Fingering_engraver},
991 @end quotation 
992
993 @noindent
994 That link brings us to the documentation for the Engraver, the
995 plug-in, which says
996
997 @quotation
998 This engraver creates the following layout objects: @internalsref{Fingering}.
999 @end quotation
1000
1001 In other words, once the @code{FingerEvent}s are interpreted, the
1002 @code{Fingering_engraver} plug-in will process them.
1003 The @code{Fingering_engraver} is also listed to create
1004 @internalsref{Fingering} objects,
1005
1006
1007 Lo and behold, that is also the
1008 second bit of information listed under @b{See also} in the Notation
1009 manual.  By clicking around in the program reference, we can follow the
1010 flow of information within the program, either forward (like we did
1011 here), or backwards, following links like this:
1012
1013 @itemize @bullet
1014
1015 @item @internalsref{Fingering}:
1016 @internalsref{Fingering} objects are created by:
1017 @b{@internalsref{Fingering_engraver}}
1018
1019 @item @internalsref{Fingering_engraver}:
1020 Music types accepted: @b{@internalsref{fingering-event}}
1021
1022 @item @internalsref{fingering-event}:
1023 Music event type @code{fingering-event} is in Music expressions named
1024 @b{@internalsref{FingerEvent}}
1025 @end itemize
1026
1027 This path goes against the flow of information in the program: it
1028 starts from the output, and ends at the input event.
1029
1030 The program reference can also be browsed like a normal document.  It
1031 contains a chapter on
1032 @ifhtml
1033 @internalsref{Music definitions},
1034 @end ifhtml
1035 @ifnothtml
1036 @code{Music definitions}
1037 @end ifnothtml
1038 on @internalsref{Translation}, and the @internalsref{Backend}.  Every
1039 chapter lists all the definitions used, and all properties that may be
1040 tuned.
1041
1042  
1043 @node Layout interfaces
1044 @subsection Layout interfaces
1045
1046 @cindex interface, layout
1047 @cindex layout interface
1048
1049 The HTML page that we found in the previous section, describes the
1050 layout object called @internalsref{Fingering}.  Such an object is a
1051 symbol within the score.  It has properties that store numbers (like
1052 thicknesses and directions), but also pointers to related objects.  A
1053 layout object is also called @emph{grob},
1054 @cindex grob
1055 which is short for Graphical Object.
1056
1057
1058 The page for @code{Fingering} lists the definitions for the
1059 @code{Fingering} object.  For example, the page says
1060
1061 @quotation
1062 @code{padding} (dimension, in staff space):
1063   
1064 @code{0.6}
1065 @end quotation
1066
1067 @noindent
1068 which means that the number will be kept at a distance of at least 0.6
1069 of the note head.
1070
1071
1072 Each layout object may have several functions as a notational or
1073 typographical element.  For example, the Fingering object
1074 has the following aspects
1075
1076 @itemize @bullet
1077 @item
1078 Its size is independent of the horizontal spacing, unlike slurs or beams.
1079
1080 @item
1081 It is a piece of text.  Granted, it is usually a very short text.
1082
1083 @item
1084 That piece of text is typeset with a font, unlike slurs or beams.
1085
1086 @item
1087 Horizontally, the center of the symbol should be aligned to the
1088 center of the notehead.
1089
1090 @item
1091 Vertically, the symbol is placed next to the note and the staff.
1092
1093 @item
1094 The vertical position is also coordinated with other super- and subscript
1095 symbols.
1096 @end itemize
1097
1098 Each of these aspects is captured in so-called @emph{interface}s,
1099 which are listed on the @internalsref{Fingering} page at the bottom
1100
1101 @quotation
1102 This object supports the following interfaces:
1103 @internalsref{item-interface},
1104 @internalsref{self-alignment-interface},
1105 @internalsref{side-position-interface}, @internalsref{text-interface},
1106 @internalsref{text-script-interface}, @internalsref{font-interface},
1107 @internalsref{finger-interface}, and @internalsref{grob-interface}.
1108 @end quotation
1109
1110 Clicking any of the links will take you to the page of the respective
1111 object interface.  Each interface has a number of properties.  Some of
1112 them are not user-serviceable (``Internal properties''), but others
1113 are.
1114
1115 We have been talking of @emph{the} @code{Fingering} object, but actually it
1116 does not amount to much.  The initialization file
1117 @file{scm/@/define@/-grobs@/.scm} shows the soul of the `object',
1118
1119 @example
1120 (Fingering
1121   . ((print-function . ,Text_interface::print)
1122      (padding . 0.6)
1123      (staff-padding . 0.6)
1124      (self-alignment-X . 0)
1125      (self-alignment-Y . 0)
1126      (script-priority . 100)
1127      (font-size . -5)
1128      (meta . ((interfaces . (finger-interface font-interface
1129                              text-script-interface text-interface
1130                              side-position-interface
1131                              self-alignment-interface
1132                              item-interface))))))
1133 @end example
1134
1135 @noindent
1136 As you can see, the @code{Fingering} object is nothing more than a
1137 bunch of variable settings, and the webpage in the Program Reference
1138 is directly generated from this definition.
1139
1140 @node Determining the grob property
1141 @subsection Determining the grob property
1142
1143
1144 Recall that we wanted to change the position of the @b{2} in 
1145
1146 @lilypond[quote,fragment,relative=2,verbatim]
1147 c-2
1148 \stemUp
1149 f
1150 @end lilypond
1151
1152 Since the @b{2} is vertically positioned next to its note, we have to
1153 meddle with the interface associated with this positioning.  This is
1154 done using @code{side-position-interface}.  The page for this interface 
1155 says
1156
1157 @quotation
1158 @code{side-position-interface}
1159
1160 Position a victim object (this one) next to other objects (the
1161 support).  The property @code{direction} signifies where to put the
1162 victim object relative to the support (left or right, up or down?)
1163 @end quotation
1164
1165 @cindex padding
1166 @noindent
1167 below this description, the variable @code{padding} is described as
1168
1169 @quotation
1170 @table @code
1171 @item padding
1172 (dimension, in staff space)
1173
1174 Add this much extra space between objects that are next to each other. 
1175 @end table
1176 @end quotation
1177
1178 By increasing the value of @code{padding}, we can move away the
1179 fingering.  The following command inserts 3 staff spaces of white
1180 between the note and the fingering:
1181 @example
1182 \once \override Voice.Fingering #'padding = #3
1183 @end example
1184
1185 Inserting this command before the Fingering object is created,
1186 i.e., before @code{c2}, yields the following result:
1187
1188 @lilypond[quote,relative=2,fragment,verbatim]
1189 \once \override Voice.Fingering #'padding = #3
1190 c-2
1191 \stemUp
1192 f
1193 @end lilypond
1194
1195
1196 In this case, the context for this tweak is @context{Voice}.  This
1197 fact can also be deduced from the program reference, for the page for
1198 the @internalsref{Fingering_engraver} plug-in says
1199
1200 @quotation
1201 Fingering_engraver is part of contexts: @dots{} @b{@internalsref{Voice}}
1202 @end quotation
1203
1204 @node Difficult tweaks
1205 @subsection Difficult tweaks
1206
1207 There are two classes of difficult adjustments.  First, when there are
1208 several of the same objects at one point, and you want to adjust only
1209 one.  For example, if you want to change only one note head in a chord.
1210
1211 In this case, the @code{\applyoutput} function must be used.  The
1212 next example defines a Scheme function @code{set-position-font-size}
1213 that sets the @code{font-size} property, but only  
1214 on objects that have @internalsref{note-head-interface} and are at the
1215 right Y-position.
1216
1217 @lilypond[quote,verbatim]
1218 #(define ((set-position-font-size pos size) grob origin current)
1219   (let*
1220       ((interfaces (ly:grob-property grob 'interfaces))
1221        (position (ly:grob-property grob 'staff-position)))
1222    (if (and
1223         ; is this a note head?
1224         (memq 'note-head-interface interfaces)
1225
1226         ; is the Y coordinate right?
1227         (= pos position))
1228
1229       ; then do it.
1230       (set! (ly:grob-property grob 'font-size) size))))
1231
1232 \relative {
1233   c
1234   \applyoutput #(set-position-font-size -2 4)
1235   <c e g>
1236 }
1237 @end lilypond
1238
1239 @noindent
1240 A similar technique can be used for accidentals.  In that case, the
1241 function should check for @code{accidental-interface}.
1242
1243 Another difficult adjustment is the appearance of spanner objects,
1244 such as slur and tie.  Initially, only one of these objects is created,
1245 and they can be adjusted with the normal mechanism.  However, in some
1246 cases the spanners cross line breaks.  If this happens, these objects
1247 are cloned.  A separate object is created for every system that it is
1248 in.  These are clones of the original object and inherit all
1249 properties, including @code{\override}s.
1250
1251 In other words, an @code{\override} always affects all pieces of a
1252 broken spanner.  To change only one part of a spanner at a line break,
1253 it is necessary to hook into the formatting process.  The
1254 @code{after-line-breaking-callback} property contains the Scheme procedure
1255 that is called after the line breaks have been determined, and layout
1256 objects have been split over different systems.
1257
1258 In the following example, we define a procedure
1259 @code{my-callback}.  This procedure
1260  
1261 @itemize @bullet
1262 @item
1263 determines if we have been split across line breaks
1264 @item
1265 if yes, retrieves all the split objects
1266 @item
1267 checks if we are the last of the split objects
1268 @item
1269 if yes, it sets @code{extra-offset}.
1270 @end itemize
1271
1272 This procedure is installed into @internalsref{Tie}, so the last part
1273 of the broken tie is translated up.
1274
1275
1276 @lilypond[quote,verbatim,raggedright]
1277 #(define (my-callback grob)
1278   (let* (
1279          ; have we been split? 
1280          (orig (ly:grob-original grob))
1281
1282          ; if yes, get the split pieces (our siblings)
1283          (siblings (if (ly:grob? orig)
1284                      (ly:spanner-broken-into orig) '() )))
1285
1286    (if (and (>= (length siblings) 2)
1287              (eq? (car (last-pair siblings)) grob))
1288      (ly:grob-set-property! grob 'extra-offset '(-2 . 5)))))
1289
1290 \relative c'' { 
1291   \override Tie #'after-line-breaking-callback =
1292   #my-callback
1293   c1 ~ \break c2 ~ c
1294 }
1295 @end lilypond
1296
1297 @noindent
1298 When applying this trick, the new @code{after-line-breaking-callback}
1299 should also call the old @code{after-line-breaking-callback}, if there
1300 is one.  For example, if using this with @code{Slur},
1301 @code{Slur::after_line_breaking} should also be called.
1302
1303 @node Fonts
1304 @section Fonts
1305
1306 This section details the ways that the font can be changed.
1307
1308 @menu
1309 * Selecting font sizes::        
1310 * Font selection::              
1311 @end menu
1312
1313
1314
1315 @node Selecting font sizes
1316 @subsection Selecting font sizes
1317
1318
1319 The easiest method of setting the font size of any context, is by
1320 setting the @code{fontSize} property.
1321
1322 @lilypond[quote,fragment,relative=1,verbatim]
1323 c8
1324 \set fontSize = #-4
1325 c f
1326 \set fontSize = #3
1327 g
1328 @end lilypond
1329
1330 @noindent
1331 It does not change the size of variable symbols, such as beams or
1332 slurs.
1333
1334 Internally, the @code{fontSize} context property will cause the
1335 @code{font-size} property to be set in all layout objects.  The value
1336 of @code{font-size} is a number indicating the size relative to the
1337 standard size for the current staff height.  Each step up is an
1338 increase of approximately 12% of the font size.  Six steps is exactly a
1339 factor two.  The Scheme function @code{magstep} converts a
1340 @code{font-size} number to a scaling factor.
1341
1342 @lilypond[quote,fragment,relative=1,verbatim]
1343 c8
1344 \override NoteHead #'font-size = #-4
1345 c f
1346 \override NoteHead #'font-size = #3
1347 g
1348 @end lilypond
1349
1350 LilyPond has fonts in different design sizes.  The music fonts for
1351 smaller sizes are chubbier, while the text fonts are relatively wider.
1352 Font size changes are achieved by scaling the design size that is
1353 closest to the desired size.  The standard font size (for
1354 @code{font-size} equals 0), depends on the standard staff height.  For
1355 a 20pt staff, a 10pt font is selected.
1356
1357 The @code{font-size} mechanism does not work for fonts selected
1358 through @code{font-name}.  These may be scaled with
1359 @code{font-magnification}.  The @code{font-size} property can only be
1360 set on layout objects that use fonts; these are the ones supporting
1361 the @internalsref{font-interface} layout interface.
1362
1363 @refcommands
1364
1365 The following commands set @code{fontSize} for the current voice:
1366
1367 @cindex @code{\tiny}
1368 @code{\tiny}, 
1369 @cindex @code{\small}
1370 @code{\small}, 
1371 @cindex @code{\normalsize}
1372 @code{\normalsize}.
1373
1374
1375
1376 @cindex magnification
1377 @cindex cue notes
1378
1379
1380 @node Font selection
1381 @subsection Font selection
1382
1383
1384
1385 @cindex font selection
1386 @cindex font magnification
1387 @cindex @code{font-interface}
1388
1389 By setting the object properties described below, you can select a
1390 font from the preconfigured font families.  LilyPond has default
1391 support for the feta music fonts and @TeX{}'s Computer Modern text
1392 fonts.
1393
1394
1395 @itemize @bullet
1396 @item @code{font-encoding}
1397 is a symbol that sets layout of the glyphs.  This should only be set to
1398 select different types of non-text fonts, eg.
1399
1400 @code{fetaBraces} for piano staff braces, @code{fetaMusic} the
1401 standard music font, including ancient glyphs, @code{fetaDynamic} for
1402 dynamic signs and @code{fetaNumber} for the number font.
1403
1404 @item @code{font-family}
1405 is a symbol indicating the general class of the typeface.  Supported are
1406 @code{roman} (Computer Modern), @code{sans}, and @code{typewriter}.
1407   
1408 @item @code{font-shape}
1409 is a symbol indicating the shape of the font.  There are typically
1410 several font shapes available for each font family.  Choices are
1411 @code{italic}, @code{caps}, and @code{upright}.
1412
1413 @item @code{font-series}
1414 is a symbol indicating the series of the font.  There are typically
1415 several font series for each font family and shape.  Choices are
1416 @code{medium} and @code{bold}. 
1417
1418 @end itemize
1419
1420 Fonts selected in the way sketched above come from a predefined style
1421 sheet.
1422
1423 The font used for printing a object can be selected by setting
1424 @code{font-name}, e.g.,
1425 @example
1426 \override Staff.TimeSignature
1427     #'font-name = #"cmr17"
1428 @end example
1429
1430 @noindent
1431 Any font can be used, as long as it is available to @TeX{}.  Possible
1432 fonts include foreign fonts or fonts that do not belong to the
1433 Computer Modern font family.  The size of fonts selected in this way
1434 can be changed with the @code{font-magnification} property.  For
1435 example, @code{2.0} blows up all letters by a factor 2 in both
1436 directions.
1437
1438 @cindex font size
1439 @cindex font magnification
1440
1441
1442
1443 @seealso
1444
1445 Init files: @file{ly/@/declarations@/-init@/.ly} contains hints how new
1446 fonts may be added to LilyPond.
1447
1448
1449
1450 @node Text markup
1451 @section Text markup
1452 @cindex text markup
1453 @cindex markup text
1454
1455
1456 @cindex typeset text
1457
1458 The internal mechanism to typeset texts is accessed with the keyword
1459 @code{\markup}.  Within markup mode, you can enter texts similar to
1460 lyrics.  They are simply entered, while commands use the backslash @code{\}.
1461 @cindex markup
1462
1463 @lilypond[quote,verbatim,fragment,relative=1]
1464 c1^\markup { hello }
1465 c1_\markup { hi there }
1466 c1^\markup { hi \bold there, is \italic anyone home? }
1467 @end lilypond
1468
1469 @cindex font switching
1470
1471 The markup in the example demonstrates font switching commands.  The
1472 command @code{\bold} and @code{\italic} apply to the first following 
1473 word only; enclose a set of texts with braces to apply a command
1474 to more words:
1475 @example
1476 \markup @{ \bold @{ hi there @} @}
1477 @end example
1478
1479 @noindent
1480 For clarity, you can also do this for single arguments, e.g.,
1481
1482 @example
1483 \markup @{ is \italic @{ anyone @} home @}
1484 @end example
1485
1486 @cindex font size, texts
1487
1488
1489 In markup mode you can compose expressions, similar to mathematical
1490 expressions, XML documents, and music expressions.  You can stack
1491 expressions grouped vertically with the command @code{\column}.
1492 Similarly, @code{\center-align} aligns texts by their center lines:
1493
1494 @lilypond[quote,verbatim,fragment,relative=1]
1495 c1^\markup { \column { a bbbb \line { c d } } }
1496 c1^\markup { \center-align { a bbbb c } }
1497 c1^\markup { \line { a b c } }
1498 @end lilypond
1499
1500
1501 Markups can be stored in variables and these variables
1502 may be attached to notes, like
1503 @example
1504 allegro = \markup @{ \bold \large @{ Allegro @} @}
1505  @{ a^\allegro b c d @}
1506 @end example
1507
1508
1509 Some objects have alignment procedures of their own, which cancel out
1510 any effects of alignments applied to their markup arguments as a
1511 whole.  For example, the @internalsref{RehearsalMark} is horizontally
1512 centered, so using @code{\mark \markup @{ \left-align .. @}} has no
1513 effect.
1514
1515 Similarly, for moving whole texts over notes with
1516 @code{\raise}, use the following trick:
1517 @lilypond[quote,verbatim]
1518 {
1519   c'^\markup { \raise #0.5 not-raised }
1520   c'^\markup { "" \raise #0.5 raised }
1521 }
1522 @end lilypond
1523
1524 On the second note, the text @code{raised} is moved relative to the
1525 empty string @code{""} which is not visible.  Alternatively, complete
1526 objects can be moved with layout properties such as @code{padding} and
1527 @code{extra-offset}.
1528
1529
1530
1531
1532 @seealso
1533
1534 Init files: @file{scm/@/new@/-markup@/.scm}.
1535
1536
1537 @refbugs
1538
1539 Kerning or generation of ligatures is only done when the @TeX{}
1540 backend is used.  In this case, LilyPond does not account for them so
1541 texts will be spaced slightly too wide.
1542
1543 Syntax errors for markup mode are confusing.
1544
1545
1546 @menu
1547 * Text encoding::               
1548 * Nested scores::               
1549 * Overview of text markup commands::  
1550 * New dynamic marks::           
1551 * Other text markup issues::    
1552 @end menu
1553
1554 @node Text encoding
1555 @subsection Text encoding
1556
1557 LilyPond uses the Pango library to format multi-lingual texts, and
1558 does not perform any input-encoding conversions.  This means that any
1559 text, be it title, lyric text, or musical instruction containing
1560 non-ASCII characters, must be utf-8.  Easiest to enter such texts is
1561 by using a Unicode-aware editor, and save using utf-8 encoding.  Most
1562 popular modern editors have utf-8 support, for example, vim, Emacs,
1563 jEdit, and GEdit do.
1564
1565 Depending on the fonts installed, the following fragment shows Hebrew
1566 and Cyrillic lyrics,
1567
1568 @cindex Cyrillic
1569 @cindex Hebrew
1570 @cindex ASCII, non
1571
1572 @lilypondfile[fontload]{utf8.ly}
1573
1574
1575 The @TeX{} backend does not handle encoding specially at all.  Strings
1576 in the input are put in the output as-is.  Extents of text items in the
1577 @TeX{} backend, are determined by reading a file created via the
1578 @file{texstr} backend,
1579
1580 @example
1581 lilypond -b texstr input/les-nereides.ly
1582 latex les-nereides.texstr
1583 @end example
1584
1585 The last command produces @file{les-nereides.textmetrics}, which is
1586 read when you execute
1587
1588 @example
1589 lilypond -b tex input/les-nereides.ly
1590 @end example
1591
1592 Both @file{les-nereides.texstr} and @file{les-nereides.tex} need
1593 suitable LaTeX wrappers to load appropriate La@TeX{} packages for
1594 interpreting non-ASCII strings.
1595
1596 @seealso
1597
1598 @inputfileref{input/regression,utf8.ly}
1599
1600
1601 @node Nested scores
1602 @subsection Nested scores
1603
1604 It is possible to nest music inside markups, by adding a @code{\score}
1605 block to a markup expression.  Such a score must contain a @code{\layout}
1606 block.
1607
1608 @lilypond[quote,verbatim,raggedright]
1609 \relative {
1610   c4 d^\markup {
1611     \score {
1612       \relative { c4 d e f }
1613       \layout { }
1614     }
1615   }
1616   e f
1617 }
1618 @end lilypond
1619  
1620
1621
1622 @node Overview of text markup commands
1623 @subsection Overview of text markup commands
1624
1625 The following commands can all be used inside @code{\markup @{ @}}.
1626
1627 @include markup-commands.tely
1628
1629
1630 @node New dynamic marks
1631 @subsection New dynamic marks
1632
1633 It is possible to print new dynamic marks or text that should be aligned
1634 with dynamics.  Use @code{make-dynamic-script} to create these marks.
1635
1636 @cindex make-dynamic-script
1637
1638 @lilypond[quote,verbatim,raggedright]
1639 sfzp = #(make-dynamic-script "sfzp")
1640 \relative c' {
1641   c4 c c\sfzp c
1642 }
1643 @end lilypond
1644
1645 @cindex Dynamics, editorial
1646 @cindex Dynamics, parenthesis
1647
1648 It is also possible to print dynamics in round parenthesis or square
1649 brackets.  These are often used for adding editorial dynamics.
1650
1651 @lilypond[quote,verbatim,raggedright]
1652 \version "2.4.2"
1653 rndf = \markup{ \center-align {\line { \bold{\italic (}
1654   \dynamic f \bold{\italic )} }} }
1655 boxf = \markup{ \bracket { \dynamic f } }
1656 { c'1_\rndf c'1_\boxf }
1657 @end lilypond
1658
1659
1660 @node Other text markup issues
1661 @subsection Other text markup issues
1662
1663 To use a normal font within a title, you must define it manually
1664
1665 @example
1666 #(def-markup-command (normal-font layout props arg) (markup?)
1667   "Switch to normal text font"
1668   (interpret-markup layout (cons '((font-series . 'medium) (font-shape . 'upright)) props) arg))
1669
1670 \header@{
1671   title = \markup@{ ABCD \normal-font ABCD @}
1672 @}
1673 @end example
1674
1675
1676