On 10.09.2005 21:54:56 Simon Pepping wrote:
> On Fri, Sep 09, 2005 at 02:04:08PM +0200, Luca Furini wrote:
> > Luca Furini wrote:
> > 
> > For example, if we have this LM tree
> > 
> >            Outer BlockLM
> >                  |
> >     +------------+------------+
> >     |            |            |
> > BlockLM 1    BlockLM 2    BlockLM 3
> >                  |
> >           +------+-----+
> >           |            |
> >       BlockLM A    BlockLM B
> > 
> > BlockLM1.getNextKnuthElements() would return to the outer BlockLM only the 
> > elements representing its block content, without any space.
> > 
> > In order to decide which elements it has to create, the outer BlockLM 
> > could have some lines like:
> > 
> > (currentChild = BlockLM 1
> >  nextChild = BlockLM 2)
> > 
> > space1 = currentChild.getSpaceAfter();
> > space2 = nextChild.getSpaceBefore();
> > if (this.mustKeepTogether()
> >     || currentChild.mustKeepWithNext() && !nextChild.hasBreakBefore()
> >     || !currentChild.hasBreakAfter() && nextChild.mustKeepWithPrevious) {
> >     // there cannot be a break between the two children,
> >     createElementsForSpace(resolve(space1, space2, false, false));
> > } else {
> >     // there can be a break between the children
> >     createElementsForSpace(resolve(space1, null, false, true),
> >                            resolve(null, space2, true, false),
> >                            resolve(space1, space2, false, false));
> > }
> 
> This is a good idea. 

I agree.

> Each LM would invoke this whenever it steps from
> one child to another. Only the top level LM would also invoke it for
> its before and after edges.
> 
> I would think of a different treatment of the spaces (space specifiers):
> List spaces = new List(currentChild.getSpacesAfter(),
>   nextChild.getSpacesBefore());
> createElementsForSpaces(spaces);

Good idea, too. I actually wondered how to implement Luca's suggestion
and I ended up subclassing Knuth classes (in my mind for now) to hold
the additional space specifier info, but this is a much cleaner approach
even if a little more objects might be instantiated here. I'll try to
document this on the Wiki once I'm through playing through my examples
so I really understand every aspect of the topic.

> createElementsForSpaces would create a single glue and a single
> penalty, because all space specifiers in a single block stacking
> constraint need to be considered together to calculate the space
> value. Resolution and creating elements go together, as a penalty must
> be created to reflect the influence of a page break.

I'm not sure about this part, yet. I have some doubts about the rule 1
whose effects are only seen after the page breaking. But I'll find out
while creating my examples.


Jeremias Maerki

Reply via email to