[ << Changing defaults ] | [Part superior][Continguts][Índex][ ? ] | [ Notation manual tables >> ] | ||
[ < Overview of modifying properties ] | [ Amunt : Modifying properties ] | [ The override command > ] |
5.3.2 The \set
command
Each context has a set of properties, variables contained
in that context. Context properties are changed with the \set
command, which has the following syntax:
\set context.property = #value
value is a Scheme object, which is why it must be preceded by
the #
character.
Contexts properties are usually named in
studlyCaps
. They mostly control the translation from
music to notation, e.g., localAlterations
(for determining
whether to print accidentals), or measurePosition
(for
determining when to print a bar line). Context properties can
change value over time while interpreting a piece of music;
measurePosition
is an obvious example of
this. Context properties are modified with \set
.
For example, multimeasure rests will be combined into a single bar
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 will be
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 }
The change is applied ‘on-the-fly’, during the music, so that the setting only affects the second group of eighth notes.
Note that the bottom-most context does not always contain the property
that you wish to change – for example, attempting to set the
skipBars
property of the default bottom context, in this case
Voice
, will have no effect, because skipBars is a property of
the Score
context.
R1*2 \set skipBars = ##t R1*2
Contexts are hierarchical, so if an enclosing context was specified, for
example Staff
, then the change would also apply to all
Voice
s in the current staff.
The \unset
command:
\unset context.property
is used to remove the definition of property from context. This command removes the definition only if it is set in context. Properties that have been set in enclosing contexts will not be altered by an unset in an enclosed context:
\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
.
Preceding a \set
or \unset
command by \once
makes the setting apply to only a single time-step:
c''4 \once \set fontSize = #4.7 c''4 c''4
A full description of all available context properties is in the internals reference, see Tunable context properties.
Vegeu també
Internals Reference: Tunable context properties.
[ << Changing defaults ] | [Part superior][Continguts][Índex][ ? ] | [ Notation manual tables >> ] | ||
[ < Overview of modifying properties ] | [ Amunt : Modifying properties ] | [ The override command > ] |
Altres idiomes: English, deutsch, español, français, italiano, 日本語.
Quant a la selecció automàtica de la llengua.