Syntax: c4 \context \set #'padding =
- \property
+ \override
Objects: Music expressions Contexts Layout object
Engravers (aka. Grob)
@code{break-align-symbol}. They most often assigned as follows:
@example
- \override Score.RehearsalMark #'break-align-symbol = ...
+ \override Score.RehearsalMark #'break-align-symbol = ...
@end example
@noindent
Contexts have properties. These properties are set from the @file{.ly}
file using the following expression:
-@cindex @code{\property}
@cindex context properties
@cindex properties, context
@internalsref{Voice} context can be set in the @internalsref{Score} context
(for example) and thus take effect in all @internalsref{Voice} contexts.
-@cindex @code{Current}
-If you do not wish to specify the name of the context in the
-@code{\property}-expression itself, you can refer to the abstract context
-name, @code{Current}. The @code{Current} context is the latest
-used context. This will typically mean the @internalsref{Voice} context,
-but you can force another context with the
-@code{\property}-command. Hence the expressions
-
-@example
-\set @var{contextname}.@var{propname} = @var{value}
-@end example
-
-@noindent
-and
-
-@example
-\context @var{contextname}
-\set Current.@var{propname} = @var{value}
-@end example
-
-@noindent
-do the same thing. The main use for this is in predefined variables.
-This construction allows the specification of a property-setting
-without restriction to a specific context.
-
Properties can be unset using the following statement.
@example
\unset @var{contextname}.@var{propname}
@var{propname} was not defined in @var{contextname} (but was inherited
from a higher context), then this has no effect.
-@refbugs
+If @var{contextname} is left out, then it defaults to the current
+``bottom'' context: this is a context like @internalsref{Voice} that
+cannot contain any other contexts.
-The context @code{Current} is confusing.
@node Context evaluation
defaultBarType = #"||"
@}
@end example
-These assignments happen before interpretation starts, so a @code{\property}
+These assignments happen before interpretation starts, so a property
command will override any predefined settings.
@cindex engraver
@subsection Staff symbol
@cindex adjusting staff symbol
-@cindex StaffSymbol, using \property
Notes, dynamic signs, etc. are grouped
with a set of horizontal lines, into a staff (plural `staves'). In our
@code{defaultBarType}. The contents of @code{repeatCommands} are used
to override default measure bars.
-Property @code{whichBar} can also be set directly, using @code{\property}
+Property @code{whichBar} can also be set directly, using @code{\set}
or @code{\bar}. These settings take precedence over the automatic
@code{whichBar} settings.
@code{\override} and restored with @code{\revert}:
@example
\override autoBeamSettings #'(@var{BE} @var{P} @var{Q} @var{N} @var{M}) = @var{dur}
-\property autoBeamSettings \revert #'(@var{BE} @var{P} @var{Q} @var{N} @var{M})
+\revert autoBeamSettings #'(@var{BE} @var{P} @var{Q} @var{N} @var{M})
@end example
Here, @var{BE} is the symbol @code{begin} or @code{end}. It determines
whether the rule applies to begin or end-points. The quantity
@end example
@cindex @code{\property}, in @code{\lyrics}
-Similarly, a period following a alphabetic sequence, is included in the
-resulting string. As a consequence, spaces must be inserted around
-@code{\property} commands:
+Similarly, a period following a alphabetic sequence, is included in
+the resulting string. As a consequence, spaces must be inserted around
+property commands:
@example
- \override Lyrics .LyricText #'font-shape = #'italic
+ \override Score . LyricText #'font-shape = #'italic
@end example
@cindex @code{_}
Chords is a mode similar to @code{\lyrics}, @code{\notes} etc. Most
of the commands continue to work, for example, @code{r} and
-@code{\skip} can be used to insert rests and spaces, and
-@code{\property} may be used to change various settings.
+@code{\skip} can be used to insert rests and spaces, and property
+commands may be used to change various settings.
Do not confuse layout properties with translation
properties. Translation properties always use a mixed caps style
-naming, and are manipulated using @code{\property}:
+naming, and are manipulated using @code{\set} and @code{\unset}:
@example
\set Context.propertyName = @var{value}
@end example
@lilypond[verbatim,fragment,relative=1]
c4
- \once \override Stem #'thickness = #4
+ \once \override Voice.Stem #'thickness = #4
c4
c4
@end lilypond
\property @var{context}.@var{objectname} \revert @var{symbol}
@end example
@c
-All @code{\override} and @code{\revert} commands should be balanced.
-The @code{\set} shorthand performs a revert followed by an override,
-and is often more convenient to use
-
-@example
-\override @var{context}.@var{objectname} @var{symbol} = @var{value}
-@end example
Some examples:
@lilypond[verbatim,quote]
@end lilypond
Reverting a setting which was not set in the first place has no
-effect. However, if the setting was set as a system default, this may
-remove the default value, and this may give surprising results,
-including crashes. In other words, @code{\override} and
-@code{\revert} must be carefully balanced. The following are examples
-of correct nesting of @code{\override}, @code{\set}, @code{\revert}:
-
-@itemize @bullet
-@item
-a clumsy but correct form:
-@example
- \override \revert \override \revert \override \revert
-@end example
-
-@item
-shorter version of the same:
-@example
- \override \set \set \revert
-@end example
-
-@item
-a short form, using only @code{\set}. This requires you to know the
-default value:
-@example
- \set \set \set \set @var{to default value}
-@end example
-
-@item
-if there is no default (i.e. by default, the object property is unset),
-then you can use
-@example
- \set \set \set \revert
-@end example
-@end itemize
+effect.
-The object description is an Scheme association list. Since a Scheme
-list is a singly linked list, we can treat it as a stack, and
-@code{\override} and @code{\revert} are push and pop operations. The
-association list is stored in a normal context property, hence
-@example
- \set NoteHead = #'()
-@end example
-will effectively erase @internalsref{NoteHead}s from the current
-@internalsref{Voice}. Typically, this will blank the object. However,
-this mechanism should not be used: it may cause crashes or other
-anomalous behavior.
@seealso
@refbugs
The backend is not very strict in type-checking object properties.
-Cyclic references in Scheme values for properties cause hangs and/or
-crashes. Reverting properties that are system defaults may also lead
-to crashes.
+Cyclic references in Scheme values for properties can cause hangs
+and/or crashes.
@menu
* Constructing a tweak::
@end example
so tuning the settings for Fingering should be done with
@example
- \override Fingering @dots{}
+ \override Fingering @dots{}
@end example
Of course, the tweak may also done in a larger context than
Properties of the @internalsref{SpacingSpanner} must be overridden
from the @code{\paper} block, since the @internalsref{SpacingSpanner} is
-created before any @code{\property} statements are interpreted.
+created before any property commands are interpreted.
@example
\paper @{ \translator @{
\ScoreContext
@end example
@lilypond[notime]
-\set Score.timing = ##f
-\set Staff.autoBeaming = ##f
+\set Score.timing = ##f
+\set Staff.autoBeaming = ##f
\transpose c c' { a1 a2 a4 a16 a32 s16_" " }
@end lilypond
@end example
@lilypond[notime]
-\set Score.timing = ##f
+\set Score.timing = ##f
\transpose c c' { a a a2 a s16_" " }
@end lilypond
@end example
@lilypond[fragment]
-\set Score.timing = ##f
+\set Score.timing = ##f
\set Staff.Clef = \turnOff
\set Staff.TimeSignature = \turnOff
r2 r4 r8 r16
@end example
@lilypond[notime]
-\set Score.timing = ##f
+\set Score.timing = ##f
\transpose c c' { a2. a4 a8. a16 s16_" " }
@end lilypond
@c a clef here may lead to confusion
@lilypond
-\override Staff.Clef #'transparent = ##t
+\override Staff.Clef #'transparent = ##t
\time 3/4
s4_" "
\time 6/8
@end example
@lilypond[notime]
-\set Score.timing = ##f
+\set Score.timing = ##f
\clef violin
s4_" "
\clef bass
@end example
@lilypond[notime]
-\set Score.timing = ##f
+\set Score.timing = ##f
\transpose c c' { cis1 ees fisis aeses s16_" " }
@end lilypond
@end example
@lilypond[fragment]
-\set Score.timing = ##f
+\set Score.timing = ##f
\set Staff.TimeSignature = \turnOff
c'4 c'' c''' \clef bass c c,
@end lilypond
@end example
@lilypond[fragment]
-\set Score.timing = ##f
+\set Score.timing = ##f
\set Staff.TimeSignature = \turnOff
\relative c'' {
c f c g c
@end example
@lilypond[fragment]
-\set Score.timing = ##f
+\set Score.timing = ##f
\set Staff.TimeSignature = \turnOff
\relative c'' {
c f, f c' c g' c,
@end example
@lilypond[fragment]
-\set Score.timing = ##f
+\set Score.timing = ##f
\set Staff.TimeSignature = \turnOff
\relative a {
\clef bass
@end example
@lilypond[fragment]
-\set Score.timing = ##f
+\set Score.timing = ##f
\set Staff.TimeSignature = \turnOff
\clef bass
a d a e d c' d'
variables. These variables are called @emph{context properties}.
The properties can also be manipulated from input files. Consider this input:
@example
-\set Staff.autoBeaming = ##f
+\set Staff.autoBeaming = ##f
@end example
@noindent
@c
@lilypond[relative=1,fragment,verbatim]
c8 c c c
- \set Staff.autoBeaming = ##f
+ \set Staff.autoBeaming = ##f
c8 c c c
@end lilypond
@noindent
LilyPond includes a built-in programming language, namely, a dialect
-of Scheme. The argument to @code{\property}, @code{##f}, is an
+of Scheme. The argument to @code{\set}, @code{##f}, is an
expression in that language. The first hash-mark signals that a piece
of Scheme code follows. The second hash character is part of the
boolean value true (@code{#t}). Values of other types may be
@itemize @bullet
@item a string, enclosed in double quotes, for example,
@example
- \set Staff.instrument = #"French Horn"
+ \set Staff.instrument = #"French Horn"
@end example
@item a boolean: either @code{#t} or @code{#f}, for true and false
respectively, e.g.
@example
- \set autoBeaming = ##f
- \set Score.skipBars = ##t
+ \set autoBeaming = ##f
+ \set Score.skipBars = ##t
@end example
@item a number, such as
@example
- \set Score.currentBarNumber = #20
+ \set Score.currentBarNumber = #20
@end example
@item a symbol, which is introduced by a quote character, as in
@example
- \set Staff.crescendoSpanner = #'dashed-line
+ \set Staff.crescendoSpanner = #'dashed-line
@end example
@item a pair, which is also introduced by a quote character, like in
and (3, 4) respectively:
@example
- \set Staff.minimumVerticalExtent = #'(-7.5 . 6)
- \set Staff.timeSignatureFraction = #'(3 . 4)
+ \set Staff.minimumVerticalExtent = #'(-7.5 . 6)
+ \set Staff.timeSignatureFraction = #'(3 . 4)
@end example
@item a list, which is also introduced by a quote character. In the
list of symbols:
@example
\set Score.breakAlignOrder =
- #'(left-edge time-signature key-signatures)
+ #'(left-edge time-signature key-signatures)
@end example
@lilypond[verbatim,relative]
c4
- \override Stem #'thickness = #3.0
+ \override Stem #'thickness = #3.0
c4 c4 c4
@end lilypond
@noindent
In the example shown here, the layout property @code{thickness} (a
symbol) is set to 3 in the @code{Stem} layout objects of the current
- As a result, the notes following @code{\property} have thicker
+As a result, the notes following @code{\override} have thicker
stems.
In most cases of manual overrides, only a single object must be
changed. This can be achieved by prefixing @code{\once} to the
-@code{\property} statement, i.e.
+@code{\override} statement, i.e.
@example
- \once \override Stem #'thickness = #3.0
+ \once \override Stem #'thickness = #3.0
@end example
@lilypond[relative]
c4
- \once \override Stem #'thickness = #3.0
+ \once \override Stem #'thickness = #3.0
c4 c4 c4
@end lilypond
@lilypond[fragment,relative=1,verbatim]
c4 << {
- \once \override Stem #'transparent = ##t
+ \once \override Stem #'transparent = ##t
b8~ b8
} \\ {
b[ g8]
@lilypond[relative=1,verbatim]
c2\fermata
- \override Script #'padding = #3
+ \override Script #'padding = #3
b2\fermata
@end lilypond
set to false, to prevent the rest from being expanded in three one bar
rests:
@example
- \set Score.skipBars = ##t
+ \set Score.skipBars = ##t
@end example
Prepending the rest and the property setting above, leads to the
following result:
@lilypond[raggedright]
\score {\notes { \transpose f c' \relative c { \time 2/4
-\set Score.skipBars = ##t
+\set Score.skipBars = ##t
R2*3
r4 f8 a cis4 f e d } }}
@end lilypond