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