[ << Changing defaults ] | [Top][Contents][Index] | [ Notation manual tables >> ] |
[ < Overview of modifying properties ] | [ Up : Modifying properties ] | [ \override and \revert > ] |
5.3.2 \set
and \unset
The \set
command syntax is
\set context.property = value
where value must be preceded by the ‘#’ character if it is a Scheme object.
The counterpart command \unset
’s syntax is
\unset context.property
This removes a previously set definition of the property
from the context. Any properties that have been set in an
enclosing context are not altered by an \unset
in the
same enclosed context.
For example, multi-measure rests are combined into a single bar
(as explained in Compressing empty measures) if the context
property skipBars
is set to #t
:
R1*2 \set Score.skipBars = ##t R1*2
If the context argument is left out, then the property is
set in the current ‘bottom’ context (typically
ChordNames
, Voice
, TabVoice
, or
Lyrics
).
<< \set Score.autoBeaming = ##f \relative { e''8 e e e \set autoBeaming = ##t e8 e e e } \\ \relative { c''8 c c c c8 c c c } >>
Note that the bottom context may not always contain an
engraver that uses the property that you wish to
change. For example, attempting to set the skipBars
property of the default, bottom context has no effect because it
is a property of the Score
, not Voice
context.
R1*2 \set skipBars = ##t R1*2
Contexts are hierarchical; any change specified for an enclosing
context (e.g., Staff
) would also apply to all Voice
s
in that current Staff
context (assuming, of course, that
the Voice
context didn’t have an override of its own).
All contexts inherit settings established in the top-most
Global
context (via \grobdescriptions
), although a
few of those defaults get overridden in their own context
definitions.
<< \set Score.autoBeaming = ##t \relative { \unset autoBeaming e''8 e e e \unset Score.autoBeaming e8 e e e } \\ \relative { c''8 c c c c8 c c c } >>
Like \set
, the context argument does not have to be
specified for a bottom context, so the two statements
\set Voice.autoBeaming = ##t \set autoBeaming = ##t
are equivalent if the current bottom context is Voice
.
As described above, \unset
restores the default value of a
context property. However, it is sometimes useful to change a
value for some time, then returning to the previously used value.
For this purpose, there are the two commands
\pushContextProperty
and \popContextProperty
: the
first one pushes the current value to a stack and sets a new
value, while the second one pops off the value from the stack and
uses it to restore the previous value.
{ c' \pushContextProperty Staff.fontSize 3 c' \pushContextProperty Staff.fontSize 6 c' \popContextProperty Staff.fontSize c' \popContextProperty Staff.fontSize c' }
[ << Changing defaults ] | [Top][Contents][Index] | [ Notation manual tables >> ] |
[ < Overview of modifying properties ] | [ Up : Modifying properties ] | [ \override and \revert > ] |