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: Han-Wen Nienhuys
Subject: Re: Still confused about context vs. new
Date: Sat, 16 Aug 2008 11:39:56 -0300

On Tue, Aug 12, 2008 at 8:45 PM, Carl Sorensen <address@hidden> wrote:
>> \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
>   }
>>>
>

There is a \alias mechanism to make sure that you can set things at
Staff level in a TabStaff,
eg.  \set Staff.timeSignatureFraction = #'(4 . 5) will work.

This however means that

  \context TabStaff { .. } \context Staff { .. }

will just create a tabstaff, as the 2nd \context will find the aliased
TabStaff and be satisfied.

For alias definitions, see ly/engraver-init.ly

I second Francisco's sentiment; for all questions on how things work,
you can ultimately look at the source code or ask the authors.


-- 
Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen




reply via email to

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