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