lilypond-user
[Top][All Lists]
Advanced

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

Re: Still confused about context vs. new


From: Carl Sorensen
Subject: Re: Still confused about context vs. new
Date: Tue, 12 Aug 2008 23:45:44 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

 <lily-user <at> chubb.wattle.id.au> writes:

> 
> 
> I personally have *never* needed to use \new.  
> 
> \context implicitly instantiates a new context if the
> one named doesn't yet exist, so \new is redundant, *except* where you
> want multiple distinct contexts with the same name, or you're using
> unnamed contexts (which, internally, is the same thing)
> 

I have found a place where \new is needed.

If you would like to make a StaffGroup consisting of a TabStaff (on the top) 
and a Staff on the bottom, you would normally do:

\context StaffGroup <<
  \context TabStaff {
     \mymusic
   }
   \context Staff {
     \mymusic
   }
>>


However, if you do this, LilyPond returns errors, and the TabStaff and Staff 
are somehow combined (the clef shows on the TabStaff, for example).

However, if you do

\context StaffGroup <<
  \context TabStaff {
     \mymusic
   }
   \new Staff {
     \mymusic
   }
>>

everything works as it should.  Apparently, in the first usage, the unnamed 
Staff context had been implicitly created and was unsuccessfully reused.

Given this result, it appears to me that \new is safer than  \context for
unnamed context, so I believe it should be the preferred behavior.

Thanks,

Carl







reply via email to

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