| [ << Changing defaults ] | [Top][Contents][Index] | [ Notation manual tables >> ] |
| [ < Modifying ties and slurs ] | [ Up : Advanced tweaks ] | [ Using alterBroken > ] |
5.5.5 Modifying broken spanners
Using \alterBroken |
| [ << Changing defaults ] | [Top][Contents][Index] | [ Notation manual tables >> ] |
| [ < Modifying broken spanners ] | [ Up : Modifying broken spanners ] | [ Unpure-pure containers > ] |
Using \alterBroken
When a spanner crosses a line break or breaks, each piece
inherits the attributes of the original spanner. Thus, ordinary
tweaking of a broken spanner applies the same modifications to
each of its segments. In the example below, overriding
thickness affects the slur on either side of the line
break.
\relative c'' {
r2
\once\override Slur.thickness = 10
c8( d e f
\break
g8 f e d) r2
}
Independently modifying the appearance of individual pieces
of a broken spanner is possible with the \alterBroken
command. This command can produce either an \override
or a \tweak of a spanner property.
The syntax for \alterBroken is
[-]\alterBroken property values item
The argument values is a list of values, one for each
broken piece. If item is a grob name like Slur or
Staff.PianoPedalBracket, the result is an \override
of the specified grob type. If item is a music expression
such as “(” or “[” the result is the same music expression
with an appropriate tweak applied.
The leading hyphen must be used with the \tweak form. Do
not add it when \alterBroken is used as an
\override.
In its \override usage, \alterBroken may be prefaced
by \once or \temporary and reverted by using
\revert with property (see
substitution functions
Intermediate substitution functions).
The following code applies an independent \override to
each of the slur segments in the previous example:
\relative c'' {
r2
\alterBroken thickness #'(10 1) Slur
c8( d e f
\break
g8 f e d) r2
}
The \alterBroken command may be used with any spanner
object, including Tie, PhrasingSlur, Beam
and TextSpanner. For example, an editor preparing a
scholarly edition may wish to indicate the absence of part of a
phrasing slur in a source by dashing only the segment which has
been added. The following example illustrates how this can be
done, in this case using the \tweak form of the command:
% The empty list is conveniently used below, because it is the
% default setting of dash-definition, resulting in a solid curve.
\relative {
c''2-\alterBroken dash-definition #'(() ((0 1.0 0.4 0.75))) \(e
\break
g2 e\)
}
It is important to understand that \alterBroken will set
each piece of a broken spanner to the corresponding value in
values. When there are fewer values than pieces, any
additional piece will be assigned the empty list. This may lead
to undesired results if the layout property is not set to the
empty list by default. In such cases, each segment should be
assigned an appropriate value.
Known issues and warnings
Line breaks may occur in different places following changes in
layout. Settings chosen for \alterBroken may be unsuitable
for a spanner that is no longer broken or is split into more
segments than before. Explicit use of \break can guard
against this situation.
The \alterBroken command is ineffective for spanner
properties accessed before line-breaking such as
direction.
See also
Extending LilyPond: Difficult tweaks.
| [ << Changing defaults ] | [Top][Contents][Index] | [ Notation manual tables >> ] |
| [ < Modifying broken spanners ] | [ Up : Modifying broken spanners ] | [ Unpure-pure containers > ] |