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