Contexts for a music expression can be selected manually, using one of the following music expressions:
\new contexttype musicexpr \context contexttype [= contextname] musicexpr
This means that musicexpr should be interpreted within a context of type contexttype (with name contextname if specified). If no such context exists, it will be created:
\score { \notes \relative c'' { c4 <<d4 \context Staff = "another" e4>> f } }
In this example, the c
and d
are printed on the default
staff. For the e
, a context Staff
called another
is specified; since that does not exist, a new context is created.
Within another
, a (default) Voice context is created for the
e4
. A context is ended when when all music referring it has
finished, so after the third quarter, another
is removed.
The \new
construction creates a context with a
generated, unique contextname. An expression with
\new
always leads to a new context. This is convenient
for creating multiple staffs, multiple lyric lines, etc.
When using automatic staff changes, automatic phrasing, etc., the
context names have special meanings, so \new
cannot be
used.
This page is for LilyPond-2.0.1 (stable-branch).