[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Text scripts ] | [ Up : Writing text ] | [ Section labels > ] |
Text spanners
Some performance indications, e.g., rallentando or accelerando, are written as text and are extended over multiple notes with dotted lines. Such objects, called “spanners”, may be created from one note to another using the following syntax:
\relative { \override TextSpanner.bound-details.left.text = "rit." b'1\startTextSpan e,\stopTextSpan }
The string to be printed is set through object properties. By default
it is printed in italic characters, but different formatting can be
obtained using \markup
blocks, as described in
Formatting text.
\relative { \override TextSpanner.bound-details.left.text = \markup { \upright "rit." } b'1\startTextSpan c e,\stopTextSpan }
The line style, as well as the text string, can be defined as an object property. This syntax is described in Line styles.
Predefined commands
\textSpannerUp
,
\textSpannerDown
,
\textSpannerNeutral
,
\startTextSpan
,
\stopTextSpan
.
Known issues and warnings
LilyPond is only able to handle one text spanner per voice.
The texts at the bounds of a text spanner may collide.
{ \once \override TextSpanner.bound-details.left.text = "The text is" \once \override TextSpanner.bound-details.right.text = "too long" c'2\startTextSpan d'2\stopTextSpan }
Workarounds can be found in Horizontal spacing.
Selected Snippets
Dynamics text spanner postfix
Custom text spanners can be defined and used with hairpin and text
crescendos. \<
and \>
produce hairpins by default,
\cresc
etc. produce text spanners by default.
% Some sample text dynamic spanners, to be used as postfix operators crpoco = #(make-music 'CrescendoEvent 'span-direction START 'span-type 'text 'span-text "cresc. poco a poco") \relative c' { c4\cresc d4 e4 f4 | g4 a4\! b4\crpoco c4 | c4 d4 e4 f4 | g4 a4\! b4\< c4 | g4\dim a4 b4\decresc c4\! }
Dynamics custom text spanner postfix
Postfix functions for custom crescendo text spanners. The spanners
should start on the first note of the measure. One has to use
-\mycresc
, otherwise the spanner start will rather be assigned
to the next note.
% Two functions for (de)crescendo spanners where you can explicitly % give the spanner text. mycresc = #(define-music-function (mymarkup) (markup?) (make-music 'CrescendoEvent 'span-direction START 'span-type 'text 'span-text mymarkup)) mydecresc = #(define-music-function (mymarkup) (markup?) (make-music 'DecrescendoEvent 'span-direction START 'span-type 'text 'span-text mymarkup)) \relative c' { c4-\mycresc "custom cresc" c4 c4 c4 | c4 c4 c4 c4 | c4-\mydecresc "custom decresc" c4 c4 c4 | c4 c4\! c4 c4 }
See also
Notation Reference: Line styles, Dynamics, Formatting text.
Snippets: Text, Expressive marks.
Internals Reference: TextSpanner.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Text scripts ] | [ Up : Writing text ] | [ Section labels > ] |