|
From: | Han-Wen Nienhuys |
Subject: | Re: Why do chords print below staff? |
Date: | Wed, 25 May 2005 12:52:51 +0200 |
User-agent: | Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324) |
Mats Bengtsson wrote:
Of course, but your explanation does not say why the second ChordNames context appears below the Staff context. However, Han-Wen provided the missing piece of information, namely that the inner ChordNames context is treated as if it was created "after" the Staff context. So, the intuitive notion that contexts are ordered in the order they appear in the score is actually very tricky. The rules I have seen so far are: A) If two contexts are created at different (time) locations in the piece, then the one created first is processed first. B) If two contexts are created at the same time location, then the one that is created first within \score{...} (when reading from top to bottom) is processed first. C) When interpreting rule A), Property settings within a context are considered to happen after the creation of the score but before the first note of the piece. In mathematical terms, these rules clearly define a partial order. However, it's not clear to me if they also define a complete order or if there's some more tricky special case to be considered. Thanks to Han-Wen who hinted to rule C), which I learnt today.
The actual rule is: they are put in the order that \new <contextName> expressions are opened for processing. "Opening" a music expression for processing means calling Music_iterator::construct_children for that expression.
When "opening" a Simultaneous expression << \new Foo { x y z } \new Foo { p q r } >>the two "\new Foo"s are processed in the order of specification, and then x and p are "opened" (Simultaneous_music_iterator::construct_children calls Music_iterator::construct_children for each of its child iterators).
Of course, if construct_children for x and p has no side effects, nothing else happens. Then, normal side-effects occur when processing Eg. x and p are typeset as notes, or the property settings are effected. If y is another "\new Foo", it is only opened after x is finished. It's perfectly logical that the new context appears below the 2 existing ones if x has non-zero duration; it's just the case when x has no duration that it could be confusing.
-- Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen
[Prev in Thread] | Current Thread | [Next in Thread] |