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