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