[ << Changing defaults ] | [Part superior][Continguts][Índex][ ? ] | [ Notation manual tables >> ] | ||
[ < Defining new contexts ] | [ Amunt : Interpretation contexts ] | [ Explaining the Internals Reference > ] |
5.1.7 Context layout order
Contexts are normally positioned in a system from top to bottom in the order in which they are encountered in the input file. When contexts are nested, the outer context will include inner nested contexts as specified in the input file, provided the inner contexts are included in the outer context’s “accepts” list. Nested contexts which are not included in the outer context’s “accepts” list will be repositioned below the outer context rather than nested within it.
The “accepts” list of a context can be changed with the
\accepts
or \denies
commands. \accepts
adds a
context to the “accepts” list and \denies
removes a context
from the list.
For example, a square-braced staff group is not usually found within a
curved-braced staff with connecting staff bars, and a GrandStaff
does not accept a StaffGroup
inside it by default.
\score { \new GrandStaff << \new StaffGroup << \new Staff { c'1 } \new Staff { d'1 } >> \new Staff { \set Staff.instrumentName = bottom f'1 } >> }
However, by using the \accepts
command, StaffGroup
can be
added to the GrandStaff
context:
\score { \new GrandStaff << \new StaffGroup << \new Staff { c'1 } \new Staff { d'1 } >> \new Staff { \set Staff.instrumentName = bottom f'1 } >> \layout { \context { \GrandStaff \accepts "StaffGroup" } } }
\denies
is mainly used when a new context is being based on
another, but the required nesting differs. For example, the
VaticanaStaff
context is based on the Staff
context, but
with the VaticanaVoice
context substituted for the Voice
context in the “accepts” list.
Note that a context will be silently created implicitly if a command is encountered when there is no suitable context available to contain it.
Within a context definition, the type of subcontext to be
implicitly created is specified using \defaultchild
. A
number of music events require a ‘Bottom’ context: when such
an event is encountered, subcontexts are created recursively until
reaching a context with no ‘defaultchild’ setting.
Implicit context creation can at times give rise to unexpected new
staves or scores. Using \new
to create contexts explicitly
avoids those problems.
Sometimes a context is required to exist for just a brief period, a good example being the staff context for an ossia. This is usually achieved by introducing the context definition at the appropriate place in parallel with corresponding section of the main music. By default, the temporary context will be placed below all the existing contexts. To reposition it above the context called “main”, it should be defined like this:
\new Staff \with { alignAboveContext = #"main" }
A similar situation arises when positioning a temporary lyrics
context within a multi-staved layout such as a ChoirStaff
,
for example, when adding a second verse to a repeated section.
By default the temporary lyrics context will be placed beneath the
lower staves. By defining the temporary lyrics context with
alignBelowContext
it can be positioned correctly beneath
the (named) lyrics context containing the first verse.
Examples showing this repositioning of temporary contexts can be found elsewhere — see Nesting music expressions, Modificació de pentagrames separats and Techniques specific to lyrics.
Vegeu també
Learning Manual: Nesting music expressions.
Notation Reference: Modificació de pentagrames separats, Techniques specific to lyrics.
Application Usage: An extra staff appears.
Installed Files: ‘ly/engraver-init.ly’.
[ << Changing defaults ] | [Part superior][Continguts][Índex][ ? ] | [ Notation manual tables >> ] | ||
[ < Defining new contexts ] | [ Amunt : Interpretation contexts ] | [ Explaining the Internals Reference > ] |
Altres idiomes: English, deutsch, español, français, italiano, 日本語.
Quant a la selecció automàtica de la llengua.