[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Context creation

From: Mats Bengtsson
Subject: Re: Context creation
Date: Tue, 03 Jun 2008 16:22:05 +0200
User-agent: Thunderbird (X11/20070716)

I'm not sure that the previous followups to your email has clarified this issue completely. The reason that your example does not do what you expected is that it is equivalent to

\version "2.10.33"

\new Staff = "mycontext" \relative c' { c4 d e f g2. }
\context Staff = "mycontext" \relative c' { g'4 g f e d c1 }

Depending on what you want to achieve, you could either do as Kieren proposed and specify that the two lines of music should be consecutive or you could say that they should be typeset in parallel. The following somewhat extended example illustrates the latter case and by introducing an extra stave, I tried to pinpoint why you may want to
connect something to an already existing stave:
\version "2.10.33"

 \new Staff = "mycontext" \relative c' { c4 d e f g2. }
 \new Staff = "inbetween" \relative c''{ c4 b a g f e d c }
 \context Staff = "mycontext" \relative c' { g'4 f e d c1 }


Jesse Engle wrote:
If \context allegedly allows one to add notes to an existing context,
why does the following example not do so?

\version "2.10.33"

\new Staff = "mycontext" \relative c' { c4 d e f g2. }

\context Staff = "mycontext" \relative c' { g'4 g f e d c1 }

On 6/2/08, James E. Bailey <address@hidden> wrote:
Am 02.06.2008 um 12:30 schrieb Mats Bengtsson:

James E. Bailey wrote:
Am 02.06.2008 um 09:57 schrieb Valentin Villenave:

2008/6/1 James E. Bailey <address@hidden>:

How coincidental. I've been wondering myself about the difference
\new and \context. I kinda just use them interchangably and see
if anything
new happens.
The only difference AFAIK is that \context allows you to tap into an
existing context:

\new Staff = "coolStaff" " { (your music here) }

and then later:

\context Staff = "coolStaff" % look! the same context!
                                 { (your other music here) }

But couldn't you do that with coolStaff = { (my music here) }

\context Staff = \coolStaff

No, the point is that you can add contents to an existing context
"afterwards". A classical
example is shown in the first SATB template in
where you first create an empty Lyrics context and call in sopranos,
in order to place it above the
staff and then fill it with its contents some lines later in the
\score block, in order to be able to
use \lyricsto. (In this particular example, there's now an
alternative solution using aligned contexts,
but before that property was introduced, the only possibility was to
use \context = "alreadydefinedcontext").

Also, your code isn't syntactically correct. Did you mean
\context Staff \coolStaff ?


Wait, I think I just larned something. If I understand \context is for
referring to a context; whereas \new is for creating the context. So,
if I understand correctly from the manual:
\new Lyrics = sopranos { s1 }
is the same as
\new Lyrics  \lyricsto sopranos \sopWords

Or did I totally miss that?

Oh, and that's why it has to have a name? So it can be referred back
to later on.

lilypond-user mailing list

lilypond-user mailing list

        Mats Bengtsson
        Signal Processing
        School of Electrical Engineering
        Royal Institute of Technology (KTH)
        SE-100 44  STOCKHOLM
        Phone: (+46) 8 790 8463                         
       Fax:   (+46) 8 790 7260
        Email: address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]