Various text elements can be added to a score using
the syntax described in @ref{Rehearsal marks}:
+@c \mark needs to be placed on a separate line (it's not
+@c attached to an object like \markup is). -vv
+
@lilypond[verbatim,quote,ragged-right,fragment,relative=2]
-c4\mark "Allegro" c c c
+c4
+\mark "Allegro"
+c c c
@end lilypond
This syntax makes it possible to put any text on a bar line;
symbol name:
@lilypond[fragment,quote,ragged-right,verbatim,relative=2]
-c1 \mark \markup { \musicglyph #"scripts.ufermata" }
+c1
+\mark \markup { \musicglyph #"scripts.ufermata" }
c1
@end lilypond
the beginning of the line (the next line, in case of a line break).
@lilypond[fragment,quote,ragged-right,verbatim,relative=2]
-\mark "Allegro" c1
-c\mark "assai" \break
-c c
+\mark "Allegro"
+c1 c
+\mark "assai" \break
+c c
@end lilypond
@menu
* Text markup introduction::
-* Common markup commands::
+* Selecting font and font size::
* Text alignment::
* Graphic notation inside markup::
* Music notation inside markup::
@cindex quoted text in markup mode
A @code{\markup} block may also contain quoted text, which
-can be useful to print special characters (such as @code{\} and @code{#}).
-Quoted text even allows to print double quotation marks, by preceding
-them with backslashes:
+can be useful to print special characters such as @code{\} and @code{#},
+or even double quotation marks -- these have to be preceded
+with backslashes:
@lilypond[quote,verbatim,fragment,relative=1]
\clef bass
@end lilypond
Lists of words that are not enclosed with double quotes
-or preceded by a command are not kept distinct. In
-the following example, the first two @code{\markup} expressions
-are equivalent:
+or preceded by a command are not treated as a distinct
+expression. In the following example, the first two
+@code{\markup} expressions are equivalent:
@lilypond[quote,verbatim,fragment,relative=1]
c1^\markup { \center-align { a bbb c } }
@knownissues
-Syntax errors for markup mode are confusing.
+Syntax errors for markup mode can be confusing.
-@node Common markup commands
-@subsubsection Common markup commands
-
-Markup text may be formatted in different ways.
+@node Selecting font and font size
+@subsubsection Selecting font and font size
@cindex font switching
@funindex \italic
@funindex \bold
@funindex \underline
-Basic font switching is supported:
+Basic font switching is supported in markup mode:
@lilypond[quote,verbatim,relative=2]
{
predefined commands allow to easily select standard sizes,
@item
-other commands allow to change the size relatively to its previous value.
+the font size can also be changed relatively to its previous value.
@end itemize
@noindent
}
@end lilypond
+@cindex font families
+
The markup mode provides an easy way to select alternate
font families. The default serif font, of roman type, is automatically
selected unless specified otherwise: on the last line of the following example,
-there is no difference between the first word and the following words.
+there is no difference between the first word and the second word.
@lilypond[quote,verbatim]
\markup {
\line { Act \number 1 }
\line { \sans { Scene I. } }
\line { \typewriter { Verona. An open place. } }
- \line { \roman Enter Valentine and Proteus. }
+ \line { Enter \roman Valentine and Proteus. }
}
}
@end lilypond
@node Text alignment
@subsubsection Text alignment
-@warning{This subsection discusses how to place text in markup mode,
-inside a @code{\markup} block. However, markup objects can also
-be moved as a whole using the syntax described in
-@rlearning{Moving objects}.}
+@cindex text, aligning
+@cindex aligning text
-Markup objects can be aligned in different ways. By default,
+This subsection discusses how to place text in markup mode,
+inside a @code{\markup} block. Markup objects can also
+be moved as a whole, using the syntax described in
+@rlearning{Moving objects}.
+
+@cindex text, horizontal alignment
+@cindex horizontal text alignment
+@funindex \left-align
+@funindex \hcenter
+@funindex \right-align
+
+Markup objects may be aligned in different ways. By default,
a text indication is aligned on its left edge: in the following
example, there's no difference between the first and the second
markup.
e'
a,-\markup { \left-align poco }
e'
-a,-\markup { \center-align { poco } }
+a,-\markup { \hcenter { poco } }
e'
a,-\markup { \right-align poco }
@end lilypond
-@c FIXME: \center-align actually doesn't belong here
-@c \center-align vs \column
-@c \center-align vs \hcenter
+@funindex \halign
+
+The horizontal alignment may be fine-tuned
+using a numeric value:
+
+@lilypond[quote,verbatim,fragment,relative=1]
+a1-\markup { \halign #-1 poco }
+e'
+a,-\markup { \halign #0 poco }
+e'
+a,-\markup { \halign #0.5 poco }
+e'
+a,-\markup { \halign #2 poco }
+@end lilypond
+
+@cindex text, vertical alignment
+@cindex vertical text alignment
+@funindex \raise
+@funindex \lower
-Horizontal alignment:
-\hcenter
-\general-align
-\halign
+Vertical alignment is a bit more complex. As stated above,
+markup objects can be moved as a whole; however, it is also
+possible to move specific elements inside a markup block.
+In this case, the element to be moved needs to be preceded
+with an @emph{anchor point}, that can be another markup element
+or an invisible object. The following example demonstrates these
+two possibilities; the last markup in this example has no anchor
+point, and therefore is not moved.
+@lilypond[quote,verbatim,fragment,relative=1]
+d2^\markup {
+ Acte I
+ \raise #2 { Scène 1 } }
+a'
+g_\markup {
+ \null
+ \lower #4 \bold { Très modéré } }
+a
+d,^\markup {
+ \raise #4 \italic { Une forêt. } }
+a'4 a g2 a
+@end lilypond
+
+@funindex \general-align
+@funindex \translate
+@funindex \translate-scaled
+
+Some commands can affect both the horizontal and vertical
+alignment of text objects in markup mode. Any object
+affected by these commands must be preceded by an
+anchor point:
+
+@lilypond[quote,verbatim,fragment,relative=1]
+d2^\markup {
+ Acte I
+ \translate #'(-1 . 2) "Scène 1" }
+a'
+g_\markup {
+ \null
+ \general-align #Y #3.2 \bold "Très modéré" }
+a
+d,^\markup {
+ \null
+ \translate-scaled #'(-1 . 2) \teeny "Une forêt." }
+a'4 a g2 a
+@end lilypond
+
+@cindex multi-line markup
+@cindex multi-line text
+@cindex columns, text
+
+A markup object may include several lines of text.
+In the following example, each element or expression
+is placed on its own line:
+
+@lilypond[quote,verbatim]
+\markup {
+ \column {
+
-\null
-\hspace
-\lower
-\raise
-\translate
-\translate-scaled
\rotate
\transparent
\whiteout
Vertical alignment:
\vcenter
-\column
-\dir-column
+\column
+\dir-column
Building a "large" markup: