]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/notation/text.itely
Doc -- add links on script columns
[lilypond.git] / Documentation / notation / text.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @ignore
3     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
4
5     When revising a translation, copy the HEAD committish of the
6     version that you are working on.  See TRANSLATION for details.
7 @end ignore
8
9 @c \version "2.12.0"
10
11 @node Text
12 @section Text
13
14 @lilypondfile[quote]{text-headword.ly}
15
16 This section explains how to include text (with various
17 formatting) in music scores.
18
19 @noindent
20 Some text elements that are not dealt with here are discussed in other
21 specific sections: @ref{Vocal music}, @ref{Titles and headers}.
22
23 @menu
24 * Writing text::
25 * Formatting text::
26 * Fonts::
27 @end menu
28
29 @node Writing text
30 @subsection Writing text
31
32 This section introduces different ways of adding text to a score.
33
34 @cindex Text, other languages
35 @warning{To write accented and special text (such as characters
36 from other languages), simply insert the characters directly into
37 the LilyPond file.  The file must be saved as UTF-8.  For more
38 information, see @ref{Text encoding}.}
39
40 @menu
41 * Text scripts::
42 * Text spanners::
43 * Text marks::
44 * Separate text::
45 @end menu
46
47
48 @node Text scripts
49 @unnumberedsubsubsec Text scripts
50
51 @cindex Text scripts
52 @cindex text items, non-empty
53 @cindex non-empty texts
54 @cindex quoted text
55
56 Simple @qq{quoted text} indications may be added to a score, as
57 demonstrated in the following example.  Such indications may be
58 manually placed above or below the staff, using the syntax described
59 in @ref{Direction and placement}.
60
61 @lilypond[quote,verbatim,relative=2]
62 a8^"pizz." g f e a4-"scherz." f
63 @end lilypond
64
65 This syntax is actually a shorthand; more complex text
66 formatting may be added to a note by explicitly using a
67 @code{\markup} block, as described in @ref{Formatting text}.
68
69 @lilypond[quote,verbatim,relative=2]
70 a8^\markup { \italic pizz. } g f e
71 a4_\markup { \tiny scherz. \bold molto } f
72 @end lilypond
73
74 By default, text indications do not influence the note spacing.
75 However, their widths can be taken into account:
76 in the following example, the first text string does not affect
77 spacing, whereas the second one does.
78
79 @lilypond[quote,verbatim,relative=2]
80 a8^"pizz." g f e
81 \textLengthOn
82 a4_"scherzando" f
83 @end lilypond
84
85 In addition to text scripts, articulations can be attached to notes.
86 For more information, see @ref{Articulations and ornamentations}.
87
88 For more information about the relative ordering of text scripts and
89 articulations, see @rlearning{Placement of objects}.
90
91 @funindex \textLengthOn
92 @funindex textLengthOn
93 @funindex \textLengthOff
94 @funindex textLengthOff
95
96 @predefined
97 @code{\textLengthOn},
98 @code{\textLengthOff}.
99 @endpredefined
100
101
102 @seealso
103 Learning Manual:
104 @rlearning{Placement of objects}.
105
106 Notation Reference:
107 @ref{Formatting text},
108 @ref{Direction and placement}.
109
110 Snippets:
111 @rlsr{Text}.
112
113 Internals Reference:
114 @rinternals{TextScript}.
115
116
117 @cindex text outside margin
118 @cindex margin, text running over
119 @cindex text, keeping inside margin
120 @cindex lyrics, keeping inside margin
121
122
123 @knownissues
124
125 Checking to make sure that text scripts and lyrics are within the
126 margins is a relatively large computational task.  To speed up
127 processing, LilyPond does not perform such calculations by
128 default; to enable it, use
129
130 @example
131 \override Score.PaperColumn #'keep-inside-line = ##t
132 @end example
133
134
135 @node Text spanners
136 @unnumberedsubsubsec Text spanners
137
138 @cindex text spanners
139
140 Some performance indications, e.g., @notation{rallentando} or
141 @notation{accelerando}, are written as text and are extended over
142 multiple notes with dotted lines.  Such objects, called @qq{spanners},
143 may be created from one note to another using the following syntax:
144
145 @lilypond[verbatim,quote,relative=2]
146 \override TextSpanner #'(bound-details left text) = "rit."
147 b1\startTextSpan
148 e,\stopTextSpan
149 @end lilypond
150
151 @cindex text spanners, formatting
152 @cindex formatting text spanners
153
154 @noindent
155 The string to be printed is set through object properties.  By default
156 it is printed in italic characters, but different formatting can be
157 obtained using @code{\markup} blocks, as described in @ref{Formatting
158 text}.
159
160 @lilypond[quote,relative=2,verbatim]
161 \override TextSpanner #'(bound-details left text) =
162   \markup { \upright "rit." }
163 b1\startTextSpan c
164 e,\stopTextSpan
165 @end lilypond
166
167 The line style, as well as the text string, can be defined as an
168 object property.  This syntax is described in @ref{Line styles}.
169
170
171 @funindex \textSpannerUp
172 @funindex textSpannerUp
173 @funindex \textSpannerDown
174 @funindex textSpannerDown
175 @funindex \textSpannerNeutral
176 @funindex textSpannerNeutral
177
178
179 @predefined
180 @code{\textSpannerUp},
181 @code{\textSpannerDown},
182 @code{\textSpannerNeutral}.
183 @endpredefined
184
185
186 @seealso
187 Notation Reference:
188 @ref{Line styles},
189 @ref{Dynamics}.
190
191 Snippets:
192 @rlsr{Text}.
193
194 Internals Reference:
195 @rinternals{TextSpanner}.
196
197
198 @node Text marks
199 @unnumberedsubsubsec Text marks
200
201
202 @cindex text marks
203 @cindex marks, text
204 @cindex text on bar line
205 @cindex coda on bar line
206 @cindex segno on bar line
207 @cindex fermata on bar line
208 @cindex bar lines, symbols on
209
210 @funindex \mark
211 @funindex mark
212 @funindex \markup
213 @funindex markup
214
215 Various text elements may be added to a score using
216 the syntax described in @ref{Rehearsal marks}:
217
218 @c \mark needs to be placed on a separate line (it's not
219 @c attached to an object like \markup is). -vv
220
221 @lilypond[verbatim,quote,relative=2]
222 c4
223 \mark "Allegro"
224 c c c
225 @end lilypond
226
227 This syntax makes it possible to put any text on a bar line;
228 more complex text formatting may be added using a @code{\markup}
229 block, as described in @ref{Formatting text}:
230
231 @lilypond[quote,verbatim,relative=1]
232 <c e>1
233 \mark \markup { \italic { colla parte } }
234 <d f>2 <e g>
235 <c f aes>1
236 @end lilypond
237
238 @noindent
239 This syntax also allows to print special signs, like coda, segno
240 or fermata, by specifying the appropriate symbol name as explained in
241 @ref{Music notation inside markup}:
242
243 @lilypond[quote,verbatim,relative=2]
244 <bes f>2 <aes d>
245 \mark \markup { \musicglyph #"scripts.ufermata" }
246 <e g>1
247 @end lilypond
248
249 @noindent
250 Such objects are only typeset above the top staff of the score; depending on
251 whether they are specified at the end or the middle of a bar, they
252 can be placed above the bar line or between notes.  When specified at a
253 line break, the mark will be printed at the beginning of the next line.
254
255 @lilypond[quote,verbatim,relative=2]
256 \mark "Allegro"
257 c1 c
258 \mark "assai" \break
259 c  c
260 @end lilypond
261
262
263 @snippets
264
265 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
266 {printing-marks-at-the-end-of-a-line.ly}
267
268 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
269 {aligning-marks-with-various-notation-objects.ly}
270
271 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
272 {printing-marks-on-every-staff.ly}
273
274
275 @seealso
276 Notation Reference:
277 @ref{Rehearsal marks},
278 @ref{Formatting text},
279 @ref{Music notation inside markup},
280 @ref{The Feta font}.
281
282 Snippets:
283 @rlsr{Text}.
284
285 Internals Reference:
286 @rinternals{MarkEvent},
287 @rinternals{Mark_engraver},
288 @rinternals{RehearsalMark}.
289
290
291 @node Separate text
292 @unnumberedsubsubsec Separate text
293
294 @cindex separate text
295 @cindex text, separate
296 @cindex standalone text
297 @cindex top-level text
298 @cindex text, top-level
299 @cindex text, standalone
300
301 @funindex \markup
302 @funindex markup
303
304 A @code{\markup} block can exist by itself, outside of any
305 any @code{\score} block, as a @qq{top-level
306 expression}.  This syntax is described in @ref{File structure}.
307
308 @lilypond[verbatim,quote]
309 \markup {
310   Tomorrow, and tomorrow, and tomorrow...
311 }
312 @end lilypond
313
314 @noindent
315 This allows printing text separately from the music, which is
316 particularly useful when the input file contains several music pieces,
317 as described in @ref{Multiple scores in a book}.
318
319 @lilypond[quote,verbatim]
320 \score {
321   c'1
322 }
323 \markup {
324   Tomorrow, and tomorrow, and tomorrow...
325 }
326 \score {
327   c'1
328 }
329 @end lilypond
330
331 Separate text blocks can be spread over multiple pages,
332 making it possible to print text documents or books entirely
333 within LilyPond.  This feature, and the specific syntax it
334 requires, are described in @ref{Multi-page markup}.
335
336
337 @funindex \markup
338 @funindex markup
339 @funindex \markuplines
340 @funindex markuplines
341
342 @predefined
343 @code{\markup},
344 @code{\markuplines}.
345 @endpredefined
346
347
348 @snippets
349
350 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
351 {stand-alone-two-column-markup.ly}
352
353
354 @seealso
355 Notation Reference:
356 @ref{Formatting text},
357 @ref{File structure},
358 @ref{Multiple scores in a book},
359 @ref{Multi-page markup}.
360
361 Snippets:
362 @rlsr{Text}.
363
364 Internals Reference:
365 @rinternals{TextScript}.
366
367
368 @node Formatting text
369 @subsection Formatting text
370
371 This section presents basic and advanced text formatting,
372 using the @code{\markup} mode specific syntax.
373
374 @menu
375 * Text markup introduction::
376 * Selecting font and font size::
377 * Text alignment::
378 * Graphic notation inside markup::
379 * Music notation inside markup::
380 * Multi-page markup::
381 @end menu
382
383 @node Text markup introduction
384 @unnumberedsubsubsec Text markup introduction
385
386 @cindex markup
387 @cindex text markup
388 @cindex markup text
389 @cindex typeset text
390
391 @funindex \markup
392 @funindex markup
393
394 A @code{\markup} block is used to typeset text with an extensible
395 syntax called @qq{markup mode}.
396
397 @cindex markup expressions
398 @cindex expressions, markup
399 @cindex markup syntax
400 @cindex synatax, markup
401
402 The markup syntax is similar to LilyPond's usual syntax: a
403 @code{\markup} expression is enclosed in curly braces @code{@{
404 @dots{} @}}.  A single word is regarded as a minimal expression,
405 and therefore does not need to be enclosed with braces.
406
407 Unlike simple @qq{quoted text} indications, @code{\markup} blocks may
408 contain nested expressions or markup commands, entered using the
409 backslash @code{\} character.  Such commands only affect the first
410 following expression.
411
412 @lilypond[quote,verbatim,relative=2]
413 a1-\markup intenso
414 a2^\markup { poco \italic più forte  }
415 c e1
416 d2_\markup { \italic "string. assai" }
417 e
418 b1^\markup { \bold { molto \italic  agitato } }
419 c
420 @end lilypond
421
422 @cindex special characters in markup mode
423 @cindex markup mode, special characters
424 @cindex reserved characters, printing
425 @cindex printing reserved characters
426 @cindex printing special characters
427 @cindex quoted text in markup mode
428 @cindex markup mode, quoted text
429
430 A @code{\markup} block may also contain quoted text strings.  Such
431 strings are treated as minimal text expressions, and therefore any
432 markup command or special character (such as @code{\} and @code{#})
433 will be printed verbatim without affecting the formatting of the text.
434 Double quotation marks themselves may be printed by preceding them
435 with backslashes.
436
437 @lilypond[quote,verbatim,relative=2]
438 a1^"\italic markup..."
439 a_\markup { \italic "... prints \"italic\" letters!" }
440 a a
441 @end lilypond
442
443 To be treated as a distinct expression, a list of words needs to be
444 enclosed with double quotes or preceded by a command.  The way markup
445 expressions are defined affects how these expressions will be stacked,
446 centered and aligned; in the following example, the second
447 @code{\markup} expression is treated the same as the first one:
448
449 @lilypond[quote,verbatim,relative=2]
450 c1^\markup { \center-column { a bbb c } }
451 c1^\markup { \center-column { a { bbb c } } }
452 c1^\markup { \center-column { a \line { bbb c } } }
453 c1^\markup { \center-column { a "bbb c" } }
454 @end lilypond
455
456 Markups can be stored in variables.  Such variables may be
457 directly attached to notes:
458
459 @lilypond[quote,verbatim]
460 allegro = \markup { \bold \large Allegro }
461
462 {
463   d''8.^\allegro
464   d'16 d'4 r2
465 }
466 @end lilypond
467
468
469 @noindent
470 An exhaustive list of @code{\markup}-specific commands can be found in
471 @ref{Text markup commands}.
472
473
474 @seealso
475 Notation Reference:
476 @ref{Text markup commands}.
477
478 Snippets:
479 @rlsr{Text}.
480
481 Installed files:
482 @file{scm/@/markup@/.scm}.
483
484
485 @knownissues
486
487 Syntax errors for markup mode can be confusing.
488
489
490 @node Selecting font and font size
491 @unnumberedsubsubsec Selecting font and font size
492
493 @cindex font switching
494 @cindex changing fonts
495 @cindex switching fonts
496
497 @funindex \italic
498 @funindex italic
499 @funindex \bold
500 @funindex bold
501 @funindex \underline
502 @funindex underline
503
504 Basic font switching is supported in markup mode:
505
506 @lilypond[quote,verbatim,relative=2]
507 d1^\markup {
508   \bold { Più mosso }
509   \italic { non troppo \underline Vivo }
510 }
511 r2 r4 r8
512 d,_\markup { \italic quasi \smallCaps Tromba }
513 f1 d2 r
514 @end lilypond
515
516 @cindex font size
517 @cindex text size
518
519 @funindex \fontsize
520 @funindex fontsize
521 @funindex \smaller
522 @funindex smaller
523 @funindex \larger
524 @funindex larger
525 @funindex \magnify
526 @funindex magnify
527
528 The size of the characters can also be altered in different ways:
529 @itemize
530 @item
531 the font size can be set to predefined standard sizes,
532
533 @item
534 the font size can be set to an absolute value,
535
536 @item
537 the font size can also be changed relatively to its previous value.
538 @end itemize
539
540 @noindent
541 The following example demonstrates these three methods:
542
543 @lilypond[quote,verbatim,relative=1]
544 f1_\markup {
545   \tiny espressivo
546   \large e
547   \normalsize intenso
548 }
549 a^\markup {
550   \fontsize #5 Sinfonia
551   \fontsize #2 da
552   \fontsize #3 camera
553 }
554 bes^\markup { (con
555   \larger grande
556   \smaller emozione
557   \magnify #0.6 { e sentimento } )
558 }
559 d c2 r8 c bes a g1
560 @end lilypond
561
562 @cindex subscript
563 @cindex superscript
564
565 @funindex \super
566 @funindex super
567 @funindex \sub
568 @funindex sub
569
570 Text may be printed as subscript or superscript.  By default these are
571 printed in a smaller size, but a normal size can be used as well:
572
573 @lilypond[quote,verbatim]
574 \markup {
575   \column {
576     \line { 1 \super st movement }
577     \line { 1 \normal-size-super st movement
578       \sub { (part two) }  }
579   }
580 }
581 @end lilypond
582
583 @cindex font families
584
585 The markup mode provides an easy way to select alternate font
586 families.  The default serif font, of roman type, is automatically
587 selected unless specified otherwise; on the last line of the following
588 example, there is no difference between the first and the second word.
589
590 @lilypond[quote,verbatim]
591 \markup {
592   \column {
593     \line { Act \number 1 }
594     \line { \sans { Scene I. } }
595     \line { \typewriter { Verona. An open place. } }
596     \line { Enter \roman Valentine and Proteus. }
597   }
598 }
599 @end lilypond
600
601 @noindent
602 Some of these font families, used for specific items such as numbers
603 or dynamics, do not provide all characters, as mentioned in @ref{New
604 dynamic marks} and @ref{Manual repeat marks}.
605
606 @c \concat is actually documented in Align (it is not
607 @c a font-switching command). But we need it here. -vv
608
609 When used inside a word, some font-switching or formatting commands
610 may produce an unwanted blank space.  This can easily be solved by
611 concatenating the text elements together:
612
613 @lilypond[quote,verbatim]
614 \markup {
615   \column {
616     \line {
617       \concat { 1 \super st }
618       movement
619     }
620     \line {
621       \concat { \dynamic p , }
622       \italic { con dolce espressione }
623     }
624   }
625 }
626 @end lilypond
627
628 An exhaustive list of font switching commands and custom font usage
629 commands can be found in @ref{Font}.
630
631 Defining custom font sets is also possible, as explained in
632 @ref{Fonts}.
633
634 @funindex \teeny
635 @funindex teeny
636 @funindex \tiny
637 @funindex tiny
638 @funindex \small
639 @funindex small
640 @funindex \normalsize
641 @funindex normalsize
642 @funindex \large
643 @funindex large
644 @funindex \huge
645 @funindex huge
646 @funindex \smaller
647 @funindex smaller
648 @funindex \larger
649 @funindex larger
650
651
652 @predefined
653 @code{\teeny},
654 @code{\tiny},
655 @code{\small},
656 @code{\normalsize},
657 @code{\large},
658 @code{\huge},
659 @code{\smaller},
660 @code{\larger}.
661 @endpredefined
662
663
664 @seealso
665 Notation Reference:
666 @ref{Font},
667 @ref{New dynamic marks},
668 @ref{Manual repeat marks},
669 @ref{Fonts}.
670
671 Snippets:
672 @rlsr{Text}.
673
674 Internals Reference:
675 @rinternals{TextScript}.
676
677 Installed files:
678 @file{scm/@/define@/-markup@/-commands@/.scm}.
679
680
681 @node Text alignment
682 @unnumberedsubsubsec Text alignment
683
684 @cindex text, aligning
685 @cindex aligning text
686 @cindex aligning markup text
687 @cindex aligning markups
688 @cindex markups, aligning
689 @cindex markup text, aligning
690
691 This subsection discusses how to place text in markup mode.  Markup
692 objects can also be moved as a whole, using the syntax described in
693 @rlearning{Moving objects}.
694
695 @c Padding commands should be mentioned on this page, but
696 @c most of these require \box to be more clearly illustrated. -vv
697
698 @cindex text, horizontal alignment
699 @cindex horizontal text alignment
700
701 @funindex \left-align
702 @funindex left-align
703 @funindex \center-align
704 @funindex center-align
705 @funindex \right-align
706 @funindex right-align
707
708 Markup objects may be aligned in different ways.  By default, a text
709 indication is aligned on its left edge: in the following example,
710 there is no difference between the first and the second markup.
711
712 @lilypond[quote,verbatim,relative=2]
713 d1-\markup { poco }
714 f
715 d-\markup { \left-align poco }
716 f
717 d-\markup { \center-align { poco } }
718 f
719 d-\markup { \right-align poco }
720 @end lilypond
721
722 @funindex \halign
723 @funindex halign
724
725 Horizontal alignment may be fine-tuned using a numeric value:
726
727 @lilypond[quote,verbatim,relative=2]
728 a1-\markup { \halign #-1 poco }
729 e'
730 a,-\markup { \halign #0 poco }
731 e'
732 a,-\markup { \halign #0.5 poco }
733 e'
734 a,-\markup { \halign #2 poco }
735 @end lilypond
736
737 @noindent
738 Some objects may have alignment procedures of their own, and therefore
739 are not affected by these commands.  It is possible to move such
740 markup objects as a whole, as shown for instance in @ref{Text marks}.
741
742 @cindex text, vertical alignment
743 @cindex vertical text alignment
744
745 @funindex \raise
746 @funindex raise
747 @funindex \lower
748 @funindex lower
749 @funindex \null
750 @funindex null
751
752 @c QUERY Should the function of ``\null'' be clarified? rp
753
754 Vertical alignment is a bit more complex.  As stated above, markup
755 objects can be moved as a whole; however, it is also possible to move
756 specific elements inside a markup block.  In this case, the element to
757 be moved needs to be preceded with an @emph{anchor point}, that can be
758 another markup element or an invisible object.  The following example
759 demonstrates these two possibilities; the last markup in this example
760 has no anchor point, and therefore is not moved.
761
762 @lilypond[quote,verbatim,relative=1]
763 d2^\markup {
764   Acte I
765   \raise #2 { Scène 1 }
766 }
767 a'
768 g_\markup {
769   \null
770   \lower #4 \bold { Très modéré }
771 }
772 a
773 d,^\markup {
774   \raise #4 \italic { Une forêt. }
775 }
776 a'4 a g2 a
777 @end lilypond
778
779 @funindex \general-align
780 @funindex general-align
781 @funindex \translate
782 @funindex translate
783 @funindex \translate-scaled
784 @funindex translate-scaled
785
786 Some commands can affect both the horizontal and vertical alignment of
787 text objects in markup mode.  Any object affected by these commands
788 must be preceded with an anchor point:
789
790 @lilypond[quote,verbatim,relative=1]
791 d2^\markup {
792   Acte I
793   \translate #'(-1 . 2) "Scène 1"
794 }
795 a'
796 g_\markup {
797   \null
798   \general-align #Y #3.2 \bold "Très modéré"
799 }
800 a
801 d,^\markup {
802   \null
803   \translate-scaled #'(-1 . 2) \teeny "Une forêt."
804 }
805 a'4 a g2 a
806 @end lilypond
807
808 @cindex multi-line markup
809 @cindex markup, multi-line
810 @cindex multi-line text
811 @cindex text, multi-line
812 @cindex text in columns
813 @cindex columns, text
814
815 @funindex \column
816 @funindex column
817 @funindex \center-column
818 @funindex center-column
819
820 A markup object may include several lines of text.  In the following
821 example, each element or expression is placed on its own line, either
822 left-aligned or centered:
823
824 @lilypond[quote,verbatim]
825 \markup {
826   \column {
827     a
828     "b c"
829     \line { d e f }
830   }
831   \hspace #10
832   \center-column {
833     a
834     "b c"
835     \line { d e f }
836   }
837 }
838 @end lilypond
839
840 @cindex centering text on the page
841 @cindex text, centering on the page
842 @cindex markup, centering on the page
843
844 @funindex \fill-line
845 @funindex fill-line
846
847 Similarly, a list of elements or expressions may be spread to fill the
848 entire horizontal line width (if there is only one element, it will be
849 centered on the page).  These expressions can, in turn, include
850 multi-line text or any other markup expression:
851
852 @lilypond[quote,verbatim]
853 \markup {
854   \fill-line {
855     \line { William S. Gilbert }
856     \center-column {
857       \huge \smallCaps "The Mikado"
858       or
859       \smallCaps "The Town of Titipu"
860     }
861     \line { Sir Arthur Sullivan }
862   }
863 }
864 \markup {
865   \fill-line { 1885 }
866 }
867 @end lilypond
868
869 @cindex wordwrapped text
870 @cindex justified text
871 @cindex text, justified
872 @cindex text, wordwrapped
873 @cindex markup text, wordwrapped
874 @cindex markup text, justified
875
876 @funindex \wordwrap
877 @funindex wordwrap
878 @funindex \justify
879 @funindex justify
880
881 Long text indications can also be automatically wrapped accordingly to
882 the given line width.  These will be either left-aligned or justified,
883 as shown in the following example.
884
885 @lilypond[quote,verbatim]
886 \markup {
887   \column {
888     \line  \smallCaps { La vida breve }
889     \line \bold { Acto I }
890     \wordwrap \italic {
891       (La escena representa el corral de una casa de
892       gitanos en el Albaicín de Granada. Al fondo una
893       puerta por la que se ve el negro interior de
894       una Fragua, iluminado por los rojos resplandores
895       del fuego.)
896     }
897     \hspace #0
898
899     \line \bold { Acto II }
900     \override #'(line-width . 50)
901     \justify \italic {
902       (Calle de Granada. Fachada de la casa de Carmela
903       y su hermano Manuel con grandes ventanas abiertas
904       a través de las que se ve el patio
905       donde se celebra una alegre fiesta)
906     }
907   }
908 }
909 @end lilypond
910
911 @cindex text alignment commands
912 @cindex markup text alignment commands
913 @cindex alignment, text, commands
914
915 An exhaustive list of text alignment commands can be found in
916 @ref{Align}.
917
918
919 @seealso
920 Learning Manual:
921 @rlearning{Moving objects}.
922
923 Notation Reference:
924 @ref{Align},
925 @ref{Text marks}.
926
927 Snippets:
928 @rlsr{Text}.
929
930 Internals Reference:
931 @rinternals{TextScript}.
932
933 Installed files:
934 @file{scm/@/define@/-markup@/-commands@/.scm}.
935
936
937 @node Graphic notation inside markup
938 @unnumberedsubsubsec Graphic notation inside markup
939
940 @cindex graphics, embedding
941 @cindex drawing graphic objects
942 @cindex graphic objects, drawing
943 @cindex embedding graphic objects
944 @cindex graphic objects, embedding
945
946 Various graphic objects may be added to a score, using markup
947 commands.
948
949 @cindex decorating text
950 @cindex framing text
951 @cindex text, framing
952 @cindex text, decorating
953 @cindex markup text, decorating
954 @cindex markup text, framing
955
956 @funindex \box
957 @funindex box
958 @funindex \circle
959 @funindex circle
960 @funindex \rounded-box
961 @funindex rounded-box
962 @funindex \bracket
963 @funindex bracket
964 @funindex \hbracket
965 @funindex hbracket
966
967 Some markup commands allow decoration of text elements with graphics,
968 as demonstrated in the following example.
969
970 @lilypond[quote,verbatim]
971 \markup \fill-line {
972   \center-column {
973     \circle Jack
974     \box "in the box"
975     \null
976     \line {
977       Erik Satie
978       \hspace #3
979       \bracket "1866 - 1925"
980     }
981     \null
982     \rounded-box \bold Prelude
983   }
984 }
985 @end lilypond
986
987 @cindex padding around text
988 @cindex text padding
989 @cindex markup text padding
990
991 @funindex \pad-markup
992 @funindex pad-markup
993 @funindex \pad-x
994 @funindex pad-x
995 @funindex \pad-to-box
996 @funindex pad-to-box
997 @funindex \pad-around
998 @funindex pad-around
999
1000 Some commands may require an increase in the padding around the text;
1001 this is achieved with some markup commands exhaustively described in
1002 @ref{Align}.
1003
1004 @lilypond[quote,verbatim]
1005 \markup \fill-line {
1006   \center-column {
1007     \box "Charles Ives (1874 - 1954)"
1008     \null
1009     \box \pad-markup #2 "THE UNANSWERED QUESTION"
1010     \box \pad-x #8 "A Cosmic Landscape"
1011     \null
1012   }
1013 }
1014 \markup \column {
1015   \line {
1016     \hspace #10
1017     \box \pad-to-box #'(-5 . 20) #'(0 . 5)
1018       \bold "Largo to Presto"
1019   }
1020   \pad-around #3
1021       "String quartet keeps very even time,
1022 Flute quartet keeps very uneven time."
1023 }
1024 @end lilypond
1025
1026 @cindex graphic notation
1027 @cindex symbols, non-musical
1028 @cindex non-musical symbols
1029 @cindex notation, graphic
1030
1031 @funindex \combine
1032 @funindex combine
1033 @funindex \draw-circle
1034 @funindex draw-circle
1035 @funindex \filled-box
1036 @funindex filled-box
1037 @funindex \triangle
1038 @funindex triangle
1039 @funindex \draw-line
1040 @funindex draw-line
1041 @funindex \arrow-head
1042 @funindex arrow-head
1043
1044 Other graphic elements or symbols may be printed without requiring any
1045 text.  As with any markup expression, such objects can be combined.
1046
1047 @lilypond[quote,verbatim]
1048 \markup {
1049   \combine
1050     \draw-circle #4 #0.4 ##f
1051     \filled-box #'(-4 . 4) #'(-0.5 . 0.5) #1
1052   \hspace #5
1053
1054   \center-column {
1055     \triangle ##t
1056     \combine
1057       \draw-line #'(0 . 4)
1058       \arrow-head #Y #DOWN ##f
1059   }
1060 }
1061 @end lilypond
1062
1063 @cindex embedded graphics
1064 @cindex images, embedding
1065 @cindex graphics, embedding
1066 @cindex postscript
1067
1068 @funindex \epsfile
1069 @funindex epsfile
1070 @funindex \postscript
1071 @funindex postscript
1072
1073 Advanced graphic features include the ability to include external
1074 image files converted to the Encapsulated PostScript format
1075 (@emph{eps}), or to directly embed graphics into the input file, using
1076 native PostScript code.  In such a case, it may be useful to
1077 explicitely specify the size of the drawing, as demonstrated below:
1078
1079 @lilypond[quote,verbatim,relative=1]
1080 c1^\markup {
1081   \combine
1082     \epsfile #X #10 #"./context-example.eps"
1083     \with-dimensions #'(0 . 6) #'(0 . 10)
1084     \postscript #"
1085       -2 3 translate
1086       2.7 2 scale
1087       newpath
1088       2 -1 moveto
1089       4 -2 4 1 1 arct
1090       4 2 3 3 1 arct
1091       0 4 0 3 1 arct
1092       0 0 1 -1 1 arct
1093       closepath
1094       stroke"
1095   }
1096 c
1097 @end lilypond
1098
1099 An exhaustive list of graphics-specific commands can be found in
1100 @ref{Graphic}.
1101
1102
1103 @seealso
1104 Notation Reference:
1105 @ref{Graphic},
1106 @ref{Editorial annotations}.
1107
1108 Snippets:
1109 @rlsr{Text}.
1110
1111 Internals Reference:
1112 @rinternals{TextScript}.
1113
1114 Installed files:
1115 @file{scm/@/define@/-markup@/-commands@/.scm},
1116 @file{scm/@/stencil@/.scm}.
1117
1118
1119 @node Music notation inside markup
1120 @unnumberedsubsubsec Music notation inside markup
1121
1122 @cindex notation inside markup
1123 @cindex music inside markup
1124 @cindex markup, music notation inside
1125
1126 Various musical notation elements may be added to a score, inside a
1127 markup object.
1128
1129 Notes and accidentals can be entered using markup commands:
1130
1131 @lilypond[quote,verbatim,relative=2]
1132 a2 a^\markup {
1133   \note #"4" #1
1134   =
1135   \note-by-number #1 #1 #1.5
1136 }
1137 b1_\markup {
1138   \natural \semiflat \flat
1139   \sesquiflat \doubleflat
1140 }
1141 \glissando
1142 a1_\markup {
1143   \natural \semisharp \sharp
1144   \sesquisharp \doublesharp
1145 }
1146 \glissando b
1147 @end lilypond
1148
1149 Other notation objects may also be printed
1150 in markup mode:
1151
1152 @lilypond[quote,verbatim,relative=1]
1153 g1 bes
1154 ees-\markup {
1155   \finger 4
1156   \tied-lyric #"~"
1157   \finger 1
1158 }
1159 fis_\markup { \dynamic rf }
1160 bes^\markup {
1161   \beam #8 #0.1 #0.5
1162 }
1163 cis
1164 d-\markup {
1165   \markalphabet #8
1166   \markletter #8
1167 }
1168 @end lilypond
1169
1170 More generally, any available musical symbol may be included
1171 separately in a markup object, as demonstrated below; an exhaustive
1172 list of these symbols and their names can be found in @ref{The Feta
1173 font}.
1174
1175 @lilypond[quote,verbatim,relative=2]
1176 c2
1177 c'^\markup { \musicglyph #"eight" }
1178 c,4
1179 c,8._\markup { \musicglyph #"clefs.G_change" }
1180 c16
1181 c2^\markup { \musicglyph #"timesig.neomensural94" }
1182 @end lilypond
1183
1184 Another way of printing non-text glyphs is described in @ref{Fonts
1185 explained}.  This is useful for printing braces of various sizes.
1186
1187 The markup mode also supports diagrams for specific
1188 instruments:
1189
1190 @lilypond[quote,verbatim,relative=2]
1191 c1^\markup {
1192   \fret-diagram-terse #"x;x;o;2;3;2;"
1193 }
1194 c^\markup {
1195   \harp-pedal #"^-v|--ov^"
1196 }
1197 c
1198 c^\markup {
1199   \combine
1200     \musicglyph #"accordion.accDiscant"
1201     \combine
1202       \raise #0.5 \musicglyph #"accordion.accDot"
1203       \raise #1.5 \musicglyph #"accordion.accDot"
1204 }
1205 @end lilypond
1206
1207 @c The accordion diagram is actually taken from a snippet.
1208
1209 @noindent
1210 Such diagrams are documented in @ref{Instrument Specific Markup}.
1211
1212 @cindex score inside markup
1213 @cindex markup, score inside
1214
1215 A whole score can even be nested inside a markup object.  In such a
1216 case, the nested @code{\score} block must contain a @code{\layout}
1217 block, as demonstrated here:
1218
1219 @lilypond[quote,verbatim,relative=1]
1220 c4 d^\markup {
1221   \score {
1222     \relative c' { c4 d e f }
1223     \layout { }
1224   }
1225 }
1226 e f |
1227 c d e f
1228 @end lilypond
1229
1230 An exhaustive list of music notation related commands can be found in
1231 @ref{Music}.
1232
1233
1234 @seealso
1235 Notation Reference:
1236 @ref{Music},
1237 @ref{The Feta font},
1238 @ref{Fonts explained}.
1239
1240 Snippets:
1241 @rlsr{Text}.
1242
1243 Internals Reference:
1244 @rinternals{TextScript}.
1245
1246 Installed files:
1247 @file{scm/@/define@/-markup@/-commands@/.scm},
1248 @file{scm/@/fret@/-diagrams@/.scm},
1249 @file{scm/@/harp@/-pedals@/.scm}.
1250
1251
1252 @node Multi-page markup
1253 @unnumberedsubsubsec Multi-page markup
1254
1255 @cindex multi-page markup
1256 @cindex markup, multi-page
1257 @cindex markup text, multi-page
1258 @cindex text spread over multiple pages
1259
1260 @funindex \markuplines
1261 @funindex markuplines
1262 @funindex \justified-lines
1263 @funindex justified-lines
1264 @funindex \wordwrap-lines
1265 @funindex wordwrap-lines
1266
1267 Although standard markup objects are not breakable, a specific syntax
1268 makes it possible to enter lines of text that can spread over multiple
1269 pages:
1270
1271 @lilypond[quote,verbatim]
1272 \markuplines {
1273   \justified-lines {
1274     A very long text of justified lines.
1275     ...
1276   }
1277   \wordwrap-lines {
1278     Another very long paragraph.
1279     ...
1280   }
1281   ...
1282 }
1283 @end lilypond
1284
1285 This syntax accepts a list of markups, that can be
1286 @itemize
1287 @item
1288 the result of a markup list command,
1289 @item
1290 a list of markups,
1291 @item
1292 a list of markup lists.
1293 @end itemize
1294
1295 An exhaustive list of markup list commands can be found in
1296 @ref{Text markup list commands}.
1297
1298
1299 @seealso
1300 Notation Reference:
1301 @ref{Text markup list commands},
1302
1303 Snippets:
1304 @rlsr{Text}.
1305
1306 Extending:
1307 @rextend{New markup list command definition}.
1308
1309 Internals Reference:
1310 @rinternals{TextScript}.
1311
1312 Installed files:
1313 @file{scm/@/define@/-markup@/-commands@/.scm}.
1314
1315
1316 @funindex \markuplines
1317 @funindex markuplines
1318
1319 @predefined
1320 @code{\markuplines}.
1321 @endpredefined
1322
1323
1324 @node Fonts
1325 @subsection Fonts
1326
1327 This section presents the way fonts are handled, and how they may be
1328 changed in scores.
1329
1330 @menu
1331 * Fonts explained::
1332 * Single entry fonts::
1333 * Entire document fonts::
1334 @end menu
1335
1336 @node Fonts explained
1337 @unnumberedsubsubsec Fonts explained
1338
1339 @cindex Pango
1340 @cindex fonts, explained
1341 @cindex braces, various sizes
1342 @cindex fonts, non-text in markup
1343 @cindex non-text fonts in markup
1344
1345 @funindex font-interface
1346
1347 Fonts are handled through several libraries.  FontConfig is used to
1348 detect available fonts on the system; the selected fonts are rendered
1349 using Pango.
1350
1351 Music notation fonts can be described as a set of specific glyphs,
1352 ordered in several families.  The following syntax allows various
1353 LilyPond @code{feta} non-text fonts to be used directly in markup
1354 mode:
1355
1356 @lilypond[quote,verbatim,relative=2]
1357 a1^\markup {
1358   \vcenter {
1359     \override #'(font-encoding . fetaBraces)
1360     \lookup #"brace120"
1361     \override #'(font-encoding . fetaNumber)
1362     \column { 1 3 }
1363     \override #'(font-encoding . fetaDynamic)
1364     sf
1365     \override #'(font-encoding . fetaMusic)
1366     \lookup #"noteheads.s0petrucci"
1367   }
1368 }
1369 @end lilypond
1370
1371 @noindent
1372 However, all these glyphs except the braces of various sizes contained
1373 in @code{fetaBraces} are available using the simpler syntax described
1374 in @ref{Music notation inside markup}.
1375
1376 When using the glyphs contained in @code{fetaBraces}, the size of the
1377 brace is specified by the numerical part of the glyph name, in
1378 arbitrary units.  Any integer from @code{0} to @code{575} inclusive
1379 may be specified, @code{0} giving the smallest brace.  The optimum
1380 value must be determined by trial and error.  These glyphs are all
1381 left braces; right braces may be obtained by rotation, see
1382 @ref{Rotating objects}.
1383
1384 Three families of text fonts are made available: the @emph{roman}
1385 (serif) font, that defaults to New Century Schoolbook, the @emph{sans}
1386 font and the monospaced @emph{typewriter} font -- these last two
1387 families are determined by the Pango installation.
1388
1389 Each family may include different shapes and series.  The following
1390 example demonstrates the ability to select alternate families, shapes,
1391 series and sizes.  The value supplied to @code{font-size} is the
1392 required change from the default size.
1393
1394 @lilypond[quote,verbatim,relative=2]
1395 \override Score.RehearsalMark #'font-family = #'typewriter
1396 \mark \markup "Ouverture"
1397 \override Voice.TextScript #'font-shape = #'italic
1398 \override Voice.TextScript #'font-series = #'bold
1399 d2.^\markup "Allegro"
1400 \override Voice.TextScript #'font-size = #-3
1401 c4^smaller
1402 @end lilypond
1403
1404 @noindent
1405 A similar syntax may be used in markup mode; however in this case it
1406 is preferable to use the simpler syntax explained in @ref{Selecting
1407 font and font size}:
1408
1409 @lilypond[quote,verbatim]
1410 \markup {
1411   \column {
1412     \line {
1413       \override #'(font-shape . italic)
1414       \override #'(font-size . 4)
1415       Idomeneo,
1416     }
1417     \line {
1418       \override #'(font-family . typewriter)
1419       {
1420         \override #'(font-series . bold)
1421         re
1422         di
1423       }
1424       \override #'(font-family . sans)
1425       Creta
1426     }
1427   }
1428 }
1429 @end lilypond
1430
1431 Although it is easy to switch between preconfigured fonts, it is also
1432 possible to use other fonts, as explained in the following sections:
1433 @ref{Single entry fonts} and @ref{Entire document fonts}.
1434
1435
1436 @seealso
1437 Notation Reference:
1438 @ref{The Feta font},
1439 @ref{Music notation inside markup},
1440 @ref{Selecting font and font size},
1441 @ref{Font}.
1442
1443
1444 @node Single entry fonts
1445 @unnumberedsubsubsec Single entry fonts
1446
1447 Any font that is installed on the operating system and recognized by
1448 FontConfig may be used in a score, using the following syntax:
1449
1450 @lilypond[quote,verbatim,relative=2]
1451 \override Staff.TimeSignature #'font-name = #"Bitstream Charter"
1452 \override Staff.TimeSignature #'font-size = #2
1453 \time 3/4
1454
1455 a1_\markup {
1456   \override #'(font-name . "Vera Bold")
1457     { Vera Bold }
1458 }
1459 @end lilypond
1460
1461 @cindex fonts, finding available
1462 @cindex finding available fonts
1463 @cindex listing available fonts
1464 @cindex available fonts, listing
1465
1466 @funindex show-available-fonts
1467
1468 The following command displays a list of all available fonts on the
1469 operating system:
1470
1471 @example
1472 lilypond -dshow-available-fonts x
1473 @end example
1474
1475
1476 @seealso
1477 Notation Reference:
1478 @ref{Fonts explained},
1479 @ref{Entire document fonts}.
1480
1481 Snippets:
1482 @rlsr{Text}.
1483
1484 @c A source file gets never installed...
1485 @c Installed files:
1486 @c @file{lily/@/font@/-config@/-scheme@/.cc}.
1487
1488
1489 @node Entire document fonts
1490 @unnumberedsubsubsec Entire document fonts
1491
1492 It is possible to change the fonts to be used as the default fonts in
1493 the @emph{roman}, @emph{sans} and @emph{typewriter} font families by
1494 specifying them, in that order, as shown in the example below.  For an
1495 explanation of fonts, see @ref{Fonts explained}.
1496
1497 @cindex font families, setting
1498 @cindex fonts, changing for entire document
1499
1500 @funindex make-pango-font-tree
1501
1502 @lilypond[verbatim,quote]
1503 \paper  {
1504   myStaffSize = #20
1505   #(define fonts
1506     (make-pango-font-tree "Times New Roman"
1507                           "Nimbus Sans"
1508                           "Luxi Mono"
1509                            (/ myStaffSize 20)))
1510 }
1511
1512 \relative c'{
1513   c1-\markup {
1514     roman,
1515     \sans sans,
1516     \typewriter typewriter. }
1517 }
1518 @end lilypond
1519
1520 @c we don't do Helvetica / Courier, since GS incorrectly loads
1521 @c Apple TTF fonts
1522
1523
1524 @seealso
1525 Notation Reference:
1526 @ref{Fonts explained},
1527 @ref{Single entry fonts},
1528 @ref{Selecting font and font size},
1529 @ref{Font}.
1530