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. 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);
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.
Regards, Simon
--
Simon Pepping
home page: http://www.leverkruid.nl