version that you are working on. See TRANSLATION for details.
@end ignore
-@c \version "2.11.61"
+@c \version "2.11.65"
@node Tweaking output
@chapter Tweaking output
@menu
-* Tweaking basics::
-* The Internals Reference manual::
-* Appearance of objects::
-* Placement of objects::
-* Collisions of objects::
-* Further tweaking::
+* Tweaking basics::
+* The Internals Reference manual::
+* Appearance of objects::
+* Placement of objects::
+* Collisions of objects::
+* Further tweaking::
@end menu
@node Tweaking basics
@section Tweaking basics
@menu
-* Introduction to tweaks::
-* Objects and interfaces::
-* Naming conventions of objects and properties::
-* Tweaking methods::
+* Introduction to tweaks::
+* Objects and interfaces::
+* Naming conventions of objects and properties::
+* Tweaking methods::
@end menu
@node Introduction to tweaks
@q{Tweaking} is a LilyPond term for the various methods available
to the user for modifying the actions taken during interpretation
-of the input file and modifying the appearance of the printed
-output. Some tweaks are very easy to use; others are more
-complex. But taken together the methods available for tweaking
-permit almost any desired appearance of the printed music to be
+of the input file and modifying the appearance of the printed
+output. Some tweaks are very easy to use; others are more
+complex. But taken together the methods available for tweaking
+permit almost any desired appearance of the printed music to be
achieved.
In this section we cover the basic concepts required to understand
tweaking. Later we give a variety of ready-made commands which can
simply be copied to obtain the same effect in your own scores, and
-at the same time we show how these commands may be constructed so
+at the same time we show how these commands may be constructed so
that you may learn how to develop your own tweaks.
Before starting on this Chapter you may wish to review the section
Tweaking involves modifying the internal operation and structures
of the LilyPond program, so we must first introduce some terms
-which are used to describe those internal operations and
+which are used to describe those internal operations and
structures.
The term @q{Object} is a generic term used to refer to the
100 such interfaces. We shall see later why this is of interest and
use to the user.
-These, then, are the main terms relating to objects which we
+These, then, are the main terms relating to objects which we
shall use in this chapter.
@node Naming conventions of objects and properties
@cindex objects, naming conventions
@cindex properties, naming conventions
-We met some object naming conventions previously, in
+We met some object naming conventions previously, in
@ref{Contexts and engravers}. Here for reference is a list
-of the most common object and property types together with
-the conventions for naming them and a couple of examples of
+of the most common object and property types together with
+the conventions for naming them and a couple of examples of
some real names. We have used @q{A} to stand for any capitalized
alphabetic character and @q{aaa} to stand for any number of
lower-case alphabetic characters. Other characters are used
-verbatim.
+verbatim.
@multitable @columnfractions .33 .33 .33
-@headitem Object/property type
+@headitem Object/property type
@tab Naming convention
@tab Examples
@item Contexts
@tab Clef_engraver, Note_heads_engraver
@item Interfaces
@tab aaa-aaa-interface
- @tab grob-interface, break-aligned-interface
+ @tab grob-interface, break-aligned-interface
@item Context Properties
@tab aaa or aaaAaaaAaaa
@tab alignAboveContext, skipBars
@tab direction, beam-thickness
@end multitable
-As we shall see shortly, the properties of different types of
+As we shall see shortly, the properties of different types of
object are modified by different commands, so it is useful to
be able to recognize the type of object from the names of its
properties.
used. Here is a simple example to change the color of the
note head:
+@cindex color property, example
+@cindex NoteHead, example of overriding
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=1]
c d
\override NoteHead #'color = #red
in many of the following examples. Here we revert the color
of the note head to the default value for the final two notes:
+@cindex color property, example
+@cindex NoteHead, example of overriding
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=1]
c d
\override NoteHead #'color = #red
back to its default value. Using the same example, we can
change the color of a single note like this:
+@cindex color property, example
+@cindex NoteHead, example of overriding
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=1]
c d
\once \override NoteHead #'color = #red
middle note head (the E) in a C major chord. Let's first see what
@code{\once \override} would do:
+@cindex font-size property, example
+@cindex NoteHead, example of overriding
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=1]
<c e g>4
\once \override NoteHead #'font-size = #-3
So to return to our example, the size of the middle note of
a chord would be changed in this way:
+@cindex font-size property, example
+@cindex @code{\tweak}, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=1]
<c e g>4
<c \tweak #'font-size #-3 e g>4
A @code{\tweak} command can also be used to modify just one in
a series of articulations, as shown here:
+@cindex color property, example
+@cindex @code{\tweak}, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
a ^Black
-\tweak #'color #red ^Red
@cindex tuplets, nested
@cindex triplets, nested
@cindex bracket, tuplet
+@cindex bracket, triplet
@cindex tuplet bracket
@cindex triplet bracket
@funindex TupletBracket
-The @code{\tweak} command must also be used to change the
-appearance of one of a set of nested tuplets which begin at the
+The @code{\tweak} command must also be used to change the
+appearance of one of a set of nested tuplets which begin at the
same musical moment. In the following example, the long tuplet
bracket and the first of the three short brackets begin at the
same musical moment, so any @code{\override} command would apply
notes and the second one specifies that the tuplet number is to be
printed in red on the first short tuplet bracket.
+@cindex @code{\tweak}, example
+@cindex direction property, example
+@cindex color property, example
+
@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
\tweak #'direction #up
\times 4/3 {
appearance may be modified in the usual way with
@code{\override} commands:
+@cindex text property, example
+@cindex tuplet-number function, example
+@cindex transparent property, example
+@cindex TupletNumber, example of overriding
+
@c NOTE Tuplet brackets collide if notes are high on staff
@c See issue 509
@lilypond[quote,ragged-right,verbatim,fragment,relative=1]
}
@end lilypond
-@seealso
+@seealso
Notation Reference:
@ruser{The tweak command}.
@cindex Internals Reference
@menu
-* Properties of layout objects::
-* Properties found in interfaces::
-* Types of properties::
+* Properties of layout objects::
+* Properties found in interfaces::
+* Types of properties::
@end menu
@node Properties of layout objects
earlier about the flexibility of LilyPond that such a thing
should be possible, and you would probably guess that an
@code{\override} command would be needed. But is there a
-heaviness property for a slur, and if there is, how might it
+heaviness property for a slur, and if there is, how might it
be modified? This is where the Internals Reference manual
comes in. It contains all the information you might need to
construct this and all other @code{\override} commands.
@cindex override example
@cindex Internals Reference, example of using
+@cindex @code{\addlyrics} example
Let's use a concrete example with a simple fragment of real
music:
The man who feels love's sweet e -- mo -- tion
}
}
-@end lilypond
+@end lilypond
Suppose now that we decide we would like the slurs to be a
little heavier. Is this possible? The slur is certainly a
Under the heading @strong{Top} you will see five links. Select
the link to the @emph{Backend}, which is where information about
-layout objects is to be found. There, under the heading
+layout objects is to be found. There, under the heading
@strong{Backend}, select the link to @emph{All layout objects}.
The page that appears lists all the layout objects used in your
version of LilyPond, in alphabetic order. Select the link to
As we said earlier, there are few to no explanations in the IR,
but we already have enough information to try changing the
-slur thickness. We see that the name of the layout object
+slur thickness. We see that the name of the layout object
is @code{Slur}, that the name of the property to change is
@code{thickness} and that the new value should be a number
somewhat larger than 1.2 if we are to make slurs thicker.
We can now construct the @code{\override} command by simply
substituting the values we have found for the names, omitting
-the context. Let's use a very large value for the thickness
+the context. Let's use a very large value for the thickness
at first, so we can be sure the command is working. We get:
@example
\override Slur #'thickness = #5.0
-@end example
+@end example
Don't forget the @code{#'} preceding the
-property name and and @code{#} preceding the new value!
+property name and a @code{#} preceding the new value!
The final question is, @q{Where should this command be
-placed?} While you are unsure and learning, the best
+placed?} While you are unsure and learning, the best
answer is, @q{Within the music, before the first slur and
close to it.} Let's do that:
+@cindex Slur example of overriding
+@cindex thickness property, example
+
@lilypond[quote,verbatim,relative=2]
{
\time 6/8
The man who feels love's sweet e -- mo -- tion
}
}
-@end lilypond
+@end lilypond
@noindent
and we see that the slur is indeed heavier.
@cindex context, finding
@cindex context, identifying correct
-But first, what if we had needed to specify the Context?
+But first, what if we had needed to specify the Context?
What should it be? We could guess that slurs are in
the Voice context, as they are clearly closely associated
with individual lines of music, but can we be sure? To
us that @code{Slur_engraver} is part of five Voice contexts,
including the standard voice context, @code{Voice}, so our
guess was correct. And because @code{Voice} is one of the
-lowest level contexts which is implied unambiguously by
-the fact that we are entering notes, we can omit it in this
+lowest level contexts which is implied unambiguously by
+the fact that we are entering notes, we can omit it in this
location.
@subheading Overriding once only
is simply discarded. So the command with @code{\once} must be
repositioned as follows:
+@cindex Slur, example of overriding
+@cindex thickness property, example
+
@lilypond[quote,verbatim,relative=2]
{
\time 6/8
The man who feels love's sweet e -- mo -- tion
}
}
-@end lilypond
+@end lilypond
@noindent
Now only the first slur is made heavier.
@code{\once} placed immediately before each of the notes where
the slurs begin:
+@cindex Slur, example of overriding
+@cindex thickness property, example
+
@lilypond[quote,verbatim,relative=2]
{
\time 6/8
The man who feels love's sweet e -- mo -- tion
}
}
-@end lilypond
+@end lilypond
@noindent
or we could omit the @code{\once} command and use the @code{\revert}
command to return the @code{thickness} property to its default value
after the second slur:
+@cindex Slur, example of overriding
+@cindex thickness property, example
+
@lilypond[quote,verbatim,relative=2]
{
\time 6/8
That concludes our introduction to the IR, and the basic
method of tweaking. Several examples follow in the later
sections of this Chapter, partly to introduce you to some of the
-additional features of the IR, and partly to give you more
+additional features of the IR, and partly to give you more
practice in extracting information from it. These examples will
-contain progressively fewer words of guidance and explanation.
+contain progressively fewer words of guidance and explanation.
@node Properties found in interfaces
and this should be placed just in front of and close to the
lyrics which it should affect, like this:
+@cindex font-shape property, example
+@cindex italic, example
+@cindex LyricText, example of overriding
+@cindex @code{\addlyrics}, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
{
\time 6/8
@cindex context, specifying in lyric mode
@cindex lyric mode, specifying context
-In the case of lyrics, if you try specifying the context in the
+In the case of lyrics, if you try specifying the context in the
format given earlier the command will fail. A syllable
entered in lyricmode is terminated by either a space,
-a newline or a digit. All other characters are included
+a newline or a digit. All other characters are included
as part of the syllable. For this reason a space or newline
must appear before the terminating @code{@}} to prevent it being
included as part of the final syllable. Similarly,
@warning{In overrides in lyrics always place spaces around
the dot between the context name and the object name.}
-@seealso
+@seealso
Learning Manual: @ref{Scheme tutorial}.
@code{symbol}. To be valid, the value given to a property
must be of the correct type and obey the rules for that type.
The type of property is always shown in brackets after the
-property name in the IR. Here is a list of the types you may
+property name in the IR. Here is a list of the types you may
need, together with the rules for that type, and some examples.
You must always add a hash symbol, @code{#}, of course,
-to the front of these values when they are entered in the
+to the front of these values when they are entered in the
@code{\override} command.
@multitable @columnfractions .2 .45 .35
-@headitem Property type
+@headitem Property type
@tab Rules
@tab Examples
@item Boolean
@tab Any valid markup
@tab @code{\markup @{ \italic "cresc." @}}
@item Moment
- @tab A fraction of a whole note constructed with the
+ @tab A fraction of a whole note constructed with the
make-moment function
@tab @code{(ly:make-moment 1 4)},
@code{(ly:make-moment 3 8)}
@tab @code{'#(#t #t #f)}
@end multitable
-@seealso
+@seealso
Learning Manual: @ref{Scheme tutorial}.
@section Appearance of objects
Let us now put what we have learned into practice with a few
-examples which show how tweaks may be used to change the
+examples which show how tweaks may be used to change the
appearance of the printed music.
@menu
-* Visibility and color of objects::
-* Size of objects::
-* Length and thickness of objects::
+* Visibility and color of objects::
+* Size of objects::
+* Length and thickness of objects::
@end menu
@node Visibility and color of objects
In the educational use of music we might wish to print a score
with certain elements omitted as an exercise for the student,
who is required to supply them. As a simple example,
-let us suppose the exercise is to supply the missing bar lines
+let us suppose the exercise is to supply the missing bar lines
in a piece of music. But the bar lines are normally inserted
automatically. How do we prevent them printing?
This property controls the appearance of the bar lines by specifying
the symbol (glyph) which should be printed. In common
-with many other properties, it can be set to print nothing by
+with many other properties, it can be set to print nothing by
setting its value to @code{#f}. Let's try it, as before, omitting
the implied Context, @code{Voice}:
+@cindex BarLine, example of overriding
+@cindex stencil property, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
{
\time 12/16
produced, and nothing is logged in the log file. Let's try correcting
it by adding the correct context:
+@cindex BarLine, example of overriding
+@cindex stencil property, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
{
\time 12/16
required, as always, to precede the value itself in the
@code{\override} command.
+@cindex BarLine, example of overriding
+@cindex break-visibility property, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
{
\time 12/16
@code{grob-interface}. So the command to make the time signature
transparent is:
+@cindex TimeSignature, example of overriding
+@cindex transparent property, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
{
\time 12/16
stencil for the time signature should be set to @code{#f}
instead:
+@cindex TimeSignature, example of overriding
+@cindex stencil property, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
{
\time 12/16
@ruser{List of colors}. To set the bar lines to white
we write:
+@cindex BarLine, example of overriding
+@cindex color property, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
{
\time 12/16
converts X11 color names into the list of internal values,
@code{x11-color}, like this:
+@cindex BarLine, example of overriding
+@cindex color property, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
{
\time 12/16
set the color to red the value should be @code{(rgb-color 1 0 0)}
and to white it should be @code{(rgb-color 1 1 1)}:
+@cindex BarLine, example of overriding
+@cindex color property, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
{
\time 12/16
this by setting all the layout objects in our example to
various shades of grey:
+@cindex StaffSymbol, example of overriding
+@cindex TimeSignature, example of overriding
+@cindex Clef, example of overriding
+@cindex NoteHead, example of overriding
+@cindex Stem, example of overriding
+@cindex BarLine, example of overriding
+@cindex color property, example
+@cindex x11-color, example of using
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
{
\time 12/16
engraver is placed. The default context for engravers can be
found by starting from the layout object, going from there to
the engraver which produces it, and on the engraver page in the
-IR it tells you in which context the engraver will normally be
-found.
+IR it tells you in which context the engraver will normally be
+found.
@node Size of objects
@cindex objects, size of
@cindex objects, changing size of
-Let us begin by looking again at the earlier example
+Let us begin by looking again at the earlier example
see @ref{Nesting music expressions}) which showed
how to introduce a new temporary staff, as in an @rglos{ossia}.
+@cindex alignAboveContext property, example
+@cindex @code{\with}, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
\new Staff ="main" {
\relative g' {
already know now how to remove the clef and time signature --
we simply set the stencil of each to @code{#f}, as follows:
+@cindex alignAboveContext property, example
+@cindex @code{\with}, example
+@cindex stencil property, example
+@cindex Clef, example of overriding
+@cindex TimeSignature, example of overriding
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
\new Staff ="main" {
\relative g' {
required to ensure the enclosed overrides and music are applied
to the ossia staff.
-But what is the difference between modifying the staff context by
+But what is the difference between modifying the staff context by
using @code{\with} and modifying the stencils of the clef and the
-time signature with \override? The main difference is that
+time signature with \override? The main difference is that
changes made in a @code{\with} clause are made at the time the
context is created, and remain in force as the @strong{default}
values for the duration of that context, whereas
music are dynamic -- they make changes synchronized with
a particular point in the music. If changes are unset or
reverted using @code{\unset} or @code{\revert} they return to
-their default values, which will be the ones set in the
+their default values, which will be the ones set in the
@code{\with} clause, or if none have been set there, the normal
default values.
So we could replace the example above with
+@cindex alignAboveContext property, example
+@cindex @code{\with}, example
+@cindex Clef, example of overriding
+@cindex TimeSignature, example of overriding
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
\new Staff ="main" {
\relative g' {
Let's try it in our ossia example:
+@cindex alignAboveContext property, example
+@cindex @code{\with}, example
+@cindex Clef, example of overriding
+@cindex TimeSignature, example of overriding
+@cindex fontSize property, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
\new Staff ="main" {
\relative g' {
}
@end lilypond
-This is still not quite right. The note heads and flags are
+This is still not quite right. The note heads and flags are
smaller, but the stems are too long in proportion and the
staff lines are spaced too widely apart. These need to be
scaled down in proportion to the font reduction. The next
and returns a scaling factor suitable for reducing other
objects in proportion. It is used like this:
+@cindex alignAboveContext property, example
+@cindex @code{\with}, example
+@cindex Clef, example of overriding
+@cindex TimeSignature, example of overriding
+@cindex fontSize property, example
+@cindex StaffSymbol, example of overriding
+@cindex magstep function, example of using
+@cindex staff-space property, example
+@cindex stencil property, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
\new Staff ="main" {
\relative g' {
For small changes in scale, as in the example above, the
thickness of the various drawn lines such as bar lines,
-beams, hairpins, slurs, etc does not usually require global
+beams, hairpins, slurs, etc does not usually require global
adjustment. If the thickness of any particular layout object
needs to be adjusted this can be best achieved by overriding its
@code{thickness} property. An example of changing the thickness
of slurs was shown above in @ref{Properties of layout objects}.
The thickness of all drawn objects (i.e., those not produced
-from a font) may be changed in the same way.
+from a font) may be changed in the same way.
@node Placement of objects
@section Placement of objects
@menu
-* Automatic behavior::
-* Within-staff objects::
-* Outside-staff objects::
+* Automatic behavior::
+* Within-staff objects::
+* Outside-staff objects::
@end menu
@cindex objects, outside-staff
There are some objects in musical notation that belong to
-the staff and there are other objects that should be
+the staff and there are other objects that should be
placed outside the staff. These are called within-staff
objects and outside-staff objects respectively.
Within-staff objects are those that are located on the staff
-- note heads, stems, accidentals, etc. The positions of
these are usually fixed by the music itself -- they are
-vertically positioned on specific lines of the staff or are
+vertically positioned on specific lines of the staff or are
tied to other objects that are so positioned. Collisions of
note heads, stems and accidentals in closely set chords are
normally avoided automatically. There are commands and
which the objects should be placed, as follows.
First, LilyPond places all the within-staff objects.
-Then it sorts the outside-staff objects according to their
+Then it sorts the outside-staff objects according to their
@code{outside-staff-priority}. The outside-staff objects are
taken one by one, beginning with the object with the lowest
@code{outside-staff-priority}, and placed so that they do not
-collide with any objects that have already been placed. That is,
-if two outside-staff grobs are competing for the same space, the
+collide with any objects that have already been placed. That is,
+if two outside-staff grobs are competing for the same space, the
one with the lower @code{outside-staff-priority} will be placed
closer to the staff. If two objects have the same
@code{outside-staff-priority} the one encountered first will be
placed closer to the staff.
-In the following example all the markup texts have the same
+In the following example all the markup texts have the same
priority (since it is not explicitly set). Note that @q{Text3}
is automatically positioned close to the staff again, nestling
under @q{Text2}.
+@cindex markup example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
c2^"Text1"
c^"Text2"
\relative c'''' { c a, }
}
>>
-@end lilypond
+@end lilypond
@node Within-staff objects
@subsection Within-staff objects
We have already seen how the commands @code{\voiceXXX} affect
-the direction of slurs, ties, fingering and
+the direction of slurs, ties, fingering and
everything else which depends on the direction of the stems.
These commands are essential when writing polyphonic music to
permit interweaving melodic lines to be distinguished.
ready-made commands which avoid your having to code explicit
overrides for the more common modifications.
-Some layout objects like slurs and ties curve, bend or point
+Some layout objects like slurs and ties curve, bend or point
either up or down; others like stems and flags also move to
right or left when they point up or down. This is controlled
automatically when @code{direction} is set.
all stems forced up, and finally four notes reverted back to the
default behavior.
+@cindex Stem, example of overriding
+@cindex direction property, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
a4 g c a
\override Stem #'direction = #DOWN
preceded by @code{\once}. If you wish to limit the
effect to a single note you must either use the equivalent
@code{\once \override} command or use the predefined command
-followed after the affected note by the corresponding
+followed after the affected note by the corresponding
@code{\xxxNeutral} command.
@subheading Fingering
behaviour, and the following two bars shows the effect of
specifying @code{DOWN} and @code{UP}:
+@cindex Fingering, example of overriding
+@cindex direction property, example
+
@lilypond[quote,verbatim,relative=2]
c-5 a-3 f-1 c'-5
\override Fingering #'direction = #DOWN
the fingering number is usually preferable. Here is the previous
example using this method:
+@cindex fingering example
+
@lilypond[quote,verbatim,relative=2]
c-5 a-3 f-1 c'-5
c_5 a_3 f_1 c'_5
the fingering is automatically placed both above and below the
notes of a chord, as shown:
+@cindex fingering example
+
@lilypond[quote,verbatim,relative=2]
<c-5 g-3>
<c-5 g-3 e-2>
but this may be overriden to manually force all or any of the
individual fingering numbers above or below:
+@cindex fingering example
+
@lilypond[quote,verbatim,relative=2]
<c-5 g-3 e-2 c-1>
<c^5 g_3 e_2 c_1>
Here are a few examples:
+@cindex fingering example
+@cindex @code{\set}, example of using
+@cindex fingeringOrientations property, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=1]
\set fingeringOrientations = #'(left)
<f-2>
@code{Staff} or @code{Voice} contexts.
@multitable @columnfractions .3 .3 .3
-@headitem Layout Object
- @tab Priority
+@headitem Layout Object
+ @tab Priority
@tab Controls position of:
@item @code{MultiMeasureRestText}
@tab @code{450}
@funindex \stopTextSpan
@funindex stopTextSpan
+@cindex TextSpanner, example of overriding
+@cindex bound-details property, example
@lilypond[quote,fragment,ragged-right,verbatim,relative=1]
% Set details for later Text Spanner
-\override TextSpanner #'bound-details #'left #'text
+\override TextSpanner #'(bound-details left text)
= \markup { \small \bold Slower }
% Place dynamics above staff
\dynamicUp
@code{TextSpanner}, remembering that @code{OttavaBracket} is created
in the @code{Staff} context:
+@cindex TextSpanner, example of overriding
+@cindex bound-details property, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=1]
% Set details for later Text Spanner
-\override TextSpanner #'bound-details #'left #'text
+\override TextSpanner #'(bound-details left text)
= \markup { \small \bold Slower }
% Place dynamics above staff
\dynamicUp
in the IR or in the tables above, and increase the priority of
@qq{Text3} to a higher value:
+@cindex TextScript, example of overriding
+@cindex outside-staff-priority property, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
c2^"Text1"
c^"Text2"
c^"Text2"
c^"Text3"
c^"Text4"
-@end lilypond
+@end lilypond
-The command to revert to the default behavior is
+The command to revert to the default behavior is
@code{\textLengthOff}. Remember @code{\once} only works with
@code{\override}, @code{\set}, @code{\revert} or @code{unset},
so cannot be used with @code{\textLengthOn}.
be turned off by setting the priority to @code{#f}. Here's an
example to show how markup text interacts with such notes.
+@cindex TextScript, example of overriding
+@cindex outside-staff-priority property, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
% This markup is short enough to fit without collision
c2^"Tex"
However, if the notes and attached dynamics are close
together the automatic placement will avoid collisions
-by displacing later dynamic markings further away, but this may
+by displacing later dynamic markings further away, but this may
not be the optimum placement, as this rather artificial example
shows:
@cindex sizing grobs
First we must learn how grobs are sized. All grobs have a
-reference point defined within them which is used to position
+reference point defined within them which is used to position
them relative to their parent object. This point in the grob
is then positioned at a horizontal distance, @code{X-offset},
and at a vertical distance, @code{Y-offset}, from its parent.
numbers, @code{X-extent}, which say where the left and right
edges are relative to the reference point. The vertical extent
is similarly defined by a pair of numbers, @code{Y-extent}.
-These are properties of all grobs which support the
+These are properties of all grobs which support the
@code{grob-interface}.
@cindex @code{extra-spacing-width}
By default, outside-staff objects are given a width of zero so
that they may overlap in the horizontal direction. This is done
-by the trick of adding infinity to the leftmost extent and
-minus infinity to the rightmost extent by setting the
+by the trick of adding infinity to the leftmost extent and
+minus infinity to the rightmost extent by setting the
@code{extra-spacing-width} to @code{'(+inf.0 . -inf.0)}. So
to ensure they do not overlap in the horizontal direction we
must override this value of @code{extra-spacing-width} to
@noindent
Let's see if this works in our previous example:
+@cindex DynamicText, example of overriding
+@cindex extra-spacing-width property, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
\dynamicUp
\override DynamicText #'extra-spacing-width = #'(0 . 0)
lines, so moving the left edge half a unit to the left and the
right edge half a unit to the right should do it:
+@cindex DynamicText, example of overriding
+@cindex extra-spacing-width property, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
\dynamicUp
% Extend width by 1 staff space
@section Collisions of objects
@menu
-* Moving objects::
-* Fixing overlapping notation::
-* Real music example::
+* Moving objects::
+* Fixing overlapping notation::
+* Real music example::
@end menu
@node Moving objects
@cindex self-alignment-X property
This property can be used to align the object to the left, to
-the right, or to center it with respect to the parent object's
+the right, or to center it with respect to the parent object's
reference point. It may be used with all objects which support
the @code{self-alignment-interface}. In general these are objects
that contain text. The values are @code{LEFT}, @code{RIGHT}
-or @code{CENTER}. Alternatively, a numerical value between
-@code{-1} and @code{+1} may be specified, where @code{-1} is
-left-aligned, @code{+1} is right-aligned, and numbers in between
+or @code{CENTER}. Alternatively, a numerical value between
+@code{-1} and @code{+1} may be specified, where @code{-1} is
+left-aligned, @code{+1} is right-aligned, and numbers in between
move the text progressively from left-aligned to right-aligned.
Numerical values greater than @code{1} may be specified to move
the text even further to the left, or less than @code{-1} to
(or decrease) the distance between symbols that are printed
above or below notes.
+@cindex Script, example of overriding
+@cindex padding property, example
+
@lilypond[quote,fragment,relative=1,verbatim]
c2\fermata
\override Script #'padding = #3
b2\fermata
@end lilypond
+@cindex MetronomeMark, example of overriding
+@cindex padding property, example
+
@lilypond[quote,fragment,relative=1,verbatim]
% This will not work, see below:
\override MetronomeMark #'padding = #3
with a markup containing the natural and flat symbols in the
order we would like, like this:
+@cindex Accidental, example of overriding
+@cindex text property, example
+@cindex stencil property, example
+@cindex AccidentalPlacement, example of overriding
+@cindex right-padding property, example
+
@lilypond[quote,ragged-right,verbatim]
naturalplusflat = \markup { \natural \flat }
\relative c'' {
This necessarily uses an override for the accidental stencil which
will not be covered until later. The stencil type must be a
procedure, here changed to print the contents of the @code{text}
-property of @code{Accidental}, which itself is set to be a natural
-sign followed by a flat sign. These are then moved further away
+property of @code{Accidental}, which itself is set to be a natural
+sign followed by a flat sign. These are then moved further away
from the note head by overriding @code{right-padding}.
@noindent
spanners. So this is the way to align the dynamic marks in the
example taken from the previous section:
+@cindex DynamicText, example of overriding
+@cindex extra-spacing-width property, example
+@cindex DynamicLineSpanner, example of overriding
+@cindex staff-padding property, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=2]
\dynamicUp
% Extend width by 1 unit
of a string fingering object with a note's stem by aligning the
right edge with the reference point of the parent note:
+@cindex StringNumber, example of overriding
+@cindex self-alignment-X property, example
+
@lilypond[quote,fragment,ragged-right,verbatim,relative=3]
\voiceOne
< a \2 >
@code{staff-position} is set to -4 for MultiMeasureRest, so we need to
move it, say, four half-staff spaces down to @code{-8}.
+@cindex MultiMeasureRest, example of overriding
+@cindex staff-position property, example
+
@lilypond[quote,verbatim,fragment,ragged-right, relative=1]
<<
{c c c c}
In the following example, the second fingering is moved a little to
the left, and 1.8 staff space downwards:
+@cindex Fingering, example of overriding
+@cindex extra-offset property, example
+
@lilypond[quote,fragment,relative=1,verbatim]
\stemUp
f-5
slur down a little using the @code{positions} property. This
also resolves the rather nasty shape.
+@cindex PhrasingSlur, example of overriding
+@cindex positions property, example
+
@lilypond[quote,verbatim,fragment,ragged-right,relative=1]
r4
\once \override PhrasingSlur #'positions = #'(-4 . -3)
up from their position at 2 staff-spaces above the center line to,
say, 3:
+@cindex Beam, example of overriding
+@cindex positions property, example
+
@lilypond[quote,verbatim,fragment,ragged-right]
{
\clef "bass"
Here's the final result:
+@cindex NoteColumn, example of overriding
+@cindex force-hshift property, example
+
@lilypond[quote,verbatim,fragment,ragged-right]
\new Staff \relative c'' {
\key aes \major
dynamics, fingering and pedalling.
@c The following should appear as music without code
+@c This example should not be indexed
@lilypond[quote,ragged-right]
rhMusic = \relative c'' {
r2
using @code{\shiftOnn} to avoid it interfering with the two D's.
Applying these changes gives:
+@cindex Tie, example of overriding
+@cindex staff-position property, example
+
@lilypond[quote,verbatim,ragged-right]
rhMusic = \relative c'' {
r2 c4.\( g8 |
earlier tweaks: we make the stem transparent, and move the C with
the @code{force-hshift} property. Here's the final result:
+@cindex NoteColumn, example of overriding
+@cindex force-hshift property, example
+@cindex Stem, example of overriding
+@cindex transparent property, example
+
@lilypond[quote,verbatim,ragged-right]
rhMusic = \relative c'' {
r2
* Using variables for tweaks::
* Other sources of information::
* Avoiding tweaks with slower processing::
-* Advanced tweaks with Scheme::
+* Advanced tweaks with Scheme::
@end menu
@node Other uses for tweaks
and blanking the first up-stem in that voice, the tie appears to
cross voices:
+@cindex Stem, example of overriding
+@cindex transparent property, example
+
@lilypond[quote,fragment,relative=2,verbatim]
<<
{
its @code{stencil} property to @code{#f} would be the best way.
We show here the effect of the two methods:
+@cindex MetronomeMark, example of overriding
+@cindex transparent property, example
+
@lilypond[quote,verbatim,ragged-right]
\score {
\relative c'' {
}
@end lilypond
+@cindex MetronomeMark, example of overriding
+@cindex stencil property, example
+
@lilypond[quote,verbatim,ragged-right]
\score {
\relative c'' {
@noindent
Both methods remove the metronome mark which lengthens the fermata
-from the printed output, and both affect the MIDI timing as
+from the printed output, and both affect the MIDI timing as
required, but the transparent metronome mark in the first line
forces the following tempo indication too high while the
second (with the stencil removed) does not.
them in bold italics. The @code{\italic} and @code{\bold}
commands only work within lyrics if they are also embedded in
@code{\markup}, which makes them tedious to enter, so as an
-alternative can we instead use the @code{\override} and
+alternative can we instead use the @code{\override} and
@code{\revert} commands?
@example
perhaps choose shorter names for the variables to make them
quicker to type:
+@cindex LyricText, example of overriding
+@cindex font-shape property, example
+@cindex font-series property, example
+
@lilypond[quote,verbatim]
emphasize = {
\override Lyrics . LyricText #'font-shape = #'italic
by downloading a precompiled binary from lilypond.org
or whether you installed it from a package manager (i.e.
distributed with Linux, or installed under fink or cygwin) or
-compiled it from source, and (b) on which operating system it is
+compiled it from source, and (b) on which operating system it is
being used:
@strong{Downloaded from lilypond.org}
example we color the note head in accordance with its position on
the staff.
+@cindex x11-color function, example of using
+@cindex NoteHead, example of overriding
+@cindex color property, setting to Scheme procedure
+
@lilypond[quote,verbatim,ragged-right]
#(define (color-notehead grob)
"Color the notehead according to its position on the staff."
\relative c' {
% Arrange to obtain color from color-notehead procedure
\override NoteHead #'color = #color-notehead
- c2 c' |
- b4 g8 a b4 c |
- c,2 a' |
+ c2 c' |
+ b4 g8 a b4 c |
+ c,2 a' |
g1 |
}
\addlyrics {