Differences between revisions 1 and 2
Revision 1 as of 2005-05-16 18:27:06
Size: 12481
Editor: SimonPepping
Comment:
Revision 2 as of 2009-09-20 23:52:47
Size: 12481
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

It is possible to integrate the header and the footer in the calculation of the step, remaining height and no-break height. It is then no longer necessary to add penalties and boxes for the header and footer. They are added automatically by the stepping algorithm. Note that in the last step the header and footer appear automatically in the box height. This is due to the fact that the duplicate header and footer disappear and that therefore the remaining height reduces to zero. The amount of reduction of the remaining height goes into the last box (see TableLayout/KnuthElementsForTables/SteppingAlgorithmDerivation).

The example of the page TableLayout/KnuthElementsForTables/RowBorder2

We demonstrate the integration on the example of the page TableLayout/KnuthElementsForTables/RowBorder2.

Note that the box height can also be calculated as: previous remaining height - remaining height (see TableLayout/KnuthElementsForTables/SteppingAlgorithmDerivation); this is used below.

no-break:

header: col1+col2+col3: 5 + 8 + (8/2) = 17
row1:
col2: (6/2) + 15 + (6/2) = 21
col3: (8/2) + 15 + (8/2) = 23
height: 23
row2:
col1: (6/2) + 3*10 + (4/2) = 35, 35 - 23 = 12
col2: (6/2) + 20 + (4/2) = 25
col3: (8/2) + 20 + (8/2) = 28
height: 28
row1+row2 height: 51
footer: col1+col2+col3: (8/2) + 8 + 5 = 17
no-break height: 17 + 51 + 17 = 85

step 1:

header: col1+col2+col3: 5 + 8 + (8/2) = 17
row1: 
col2: (6/2) + (6/2) = 6
col3: (8/2) + (8/2) = 8
height: 8
row2:
col1: (6/2) + 10 + (6/2) = 16, 16 - 8 = 8
col2: 6 + 0 = 6
col3: 8 + 0 = 8
height: 8
row1+row2 height: 16
footer: col1+col2+col3: (8/2) + 8 + 5 = 17
step height: 17 + 16 + 17 = 50

header: col1+col2+col3: 5 + 8 + (8/2) = 17
row1:
col2: (6/2) + 15 + (6/2) = 21
col3: (8/2) + 15 + (8/2) = 23
height: 23
row1+row2:
col1: (6/2) + 20 + (4/2) = 25, 25 - 23 = 2
col2: (6/2) + 20 + (4/2) = 25
col3: (8/2) + 20 + (8/2) = 28
height: 28
row1+row2 height: 51
footer: col1+col2+col3: (8/2) + 8 + 5 = 17
remaining height: 17 + 51 + 17 = 85

Split the step height into box and penalty heights:

box height     = previous remaining height - remaining height
penalty height = step height + remaining height - no-break height
box height: 85 - 85 = 0
penalty height: 50 + 85 - 85 = 50

Check consistency:

step height    = previous box heights + box height + penalty height
step height 50 = 0 + (85 - 85) + (50 + 85 - 85)

step 2:

header: col1+col2+col3: 5 + 8 + (8/2) = 17
row1:
col2: (6/2) + 15 + (6/2) = 21
col3: (8/2) + (8/2) = 8
height: 21
row2:
col1: (6/2) + 10 + (6/2) = 16, 16 - 21 = -5
col2: 0
col3: 0
height: 0
row1+row2 height: 21
footer: col1+col2+col3: (8/2) + 8 + 5 = 17
step height: 17 + 21 + 17 = 55

header: col1+col2+col3: 5 + 8 + (8/2) = 17
row1:
col2: (6/2) + (6/2) = 6
col3: (8/2) + 15 + (8/2) = 23
height: 23
row2:
col1: (6/2) + 20 + (4/2) = 25, 25 - 23 = 2
col2: (6/2) + 20 + (4/2) = 25
col3: (8/2) + 20 + (8/2) = 28
height: 28
row1+row2 height: 51
footer: col1+col2+col3: (8/2) + 8 + 5 = 17
remaining height: 17 + 51 + 17 = 85
box height: 85 - 85 = 0
penalty height: 55 + 85 - 85 = 55
step height 55 = 0 + (85 - 85) + (55 + 85 - 85)

step 3:

header: col1+col2+col3: 5 + 8 + (8/2) = 17
row1:
col2: (6/2) + 15 + (6/2) = 21
col3: (8/2) + 15 + (8/2) = 23
height: 23
row2:
col1: (6/2) + 10 + (6/2) = 16, 16 - 23 = -7
col2: 0
col3: 0
height: 0
row1+row2 height: 23
footer: col1+col2+col3: (8/2) + 8 + 5 = 17
step height: 17 + 23 + 17 = 57

header: col1+col2+col3: 5 + 8 + (8/2) = 17
row1: no content
row2:
col1: (4/2) + 20 + (4/2) = 24, 24 - 0 = 24
col2: (4/2) + 20 + (4/2) = 24
col3: (8/2) + 20 + (8/2) = 28
height: 28
row1+row2 height: 28
footer: col1+col2+col3: (8/2) + 8 + 5 = 17
remaining height: 17 + 28 + 17 = 62
box height: 85 - 62 = 23
penalty height: 57 + 62 - 85 = 34
step height 57 = 0 + (85 - 62) + (57 + 62 - 85)

step 4:

header: col1+col2+col3: 5 + 8 + (8/2) = 17
row1:
col2: (6/2) + 15 + (6/2) = 21
col3: (8/2) + 15 + (8/2) = 23
height: 23
row2:
col1: (6/2) + 20 + (6/2) = 26, 26 - 23 = 3
col2: 0
col3: 0
height: 3
row1+row2 height: 26
footer: col1+col2+col3: (8/2) + 8 + 5 = 17
step height: 17 + 26 + 17 = 60

header: col1+col2+col3: 5 + 8 + (8/2) = 17
row1: no content
row2:
col1: (4/2) + 10 + (4/2) = 24, 24 - 0 = 24
col2: (4/2) + 20 + (4/2) = 24
col3: (8/2) + 20 + (8/2) = 28
height: 28
row1+row2 height: 28
footer: col1+col2+col3: (8/2) + 8 + 5 = 17
remaining height: 17 + 28 + 17 = 62
box height: 62 - 62 = 0
penalty height: 60 + 62 - 85 = 37
step height 60 = 23 + (62 - 62) + (60 + 62 - 85)

step 5:

header: col1+col2+col3: 5 + 8 + (8/2) = 17
row1:
col2: (6/2) + 15 + (6/2) = 21
col3: (8/2) + 15 + (8/2) = 23
height: 23
row2:
col1: (6/2) + 30 + (4/2) = 35, 35 - 23 = 12
col2: 0
col3: 0
height: 12
row1+row2 height: 35
footer: col1+col2+col3: (8/2) + 8 + 5 = 17
step height: 17 + 35 + 17 = 69

header: col1+col2+col3: 5 + 8 + (8/2) = 17
row1: no content
row2:
col1: (4/2) + (4/2) = 4, 4 - 0 = 4
col2: (4/2) + 20 + (4/2) = 24
col3: (8/2) + 20 + (8/2) = 28
height: 28
row1+row2 height: 28
footer: col1+col2+col3: (8/2) + 8 + 5 = 17
remaining height: 17 + 28 + 17 = 62
box height: 62 - 62 = 0
penalty height: 69 + 62 - 85 = 46
step height 69 = 23 + (62 - 62) + (69 + 62 - 85)

step 6:

header: col1+col2+col3: 5 + 8 + (8/2) = 17
row1:
col2: (6/2) + 15 + (6/2) = 21
col3: (8/2) + 15 + (8/2) = 23
height: 23
row2:
col1: (6/2) + 30 + (4/2) = 35, 35 - 23 = 12
col2: (6/2) + 20 + (4/2) = 25
col3: (8/2) + (8/2) = 8
height: 25
row1+row2 height: 48
footer: col1+col2+col3: (8/2) + 8 + 5 = 17
step height: 17 + 48 + 17 = 82

header: col1+col2+col3: 5 + 8 + (8/2) = 17
row1: no content
row2:
col1: (4/2) + (4/2) = 4, 4 - 0 = 4
col2: (4/2) + (4/2) = 4
col3: (8/2) + 20 + (8/2) = 28
height: 28
row1+row2 height: 28
footer: col1+col2+col3: (8/2) + 8 + 5 = 17
remaining height: 17 + 28 + 17 = 62
box height: 62 - 62 = 0
penalty height: 82 + 62 - 85 = 59
step height 82 = 23 + (62 - 62) + (82 + 62 - 85)

step 7 = no-break:

step height: 85
remaining height: 0
box height: 62 - 0 = 62
penalty height: 85 + 0 - 85 = 0
step height 85 = 23 + (62 - 0) + (85 + 0 - 85)

End result:

box( 0 +  0) + penalty(50), 50/85
box( 0 +  0) + penalty(55), 55/85
box( 0 + 23) + penalty(34), 57/62
box(23 +  0) + penalty(37), 60/62
box(23 +  0) + penalty(46), 69/62
box(23 +  0) + penalty(59), 82/62
box(23 + 62) + penalty( 0), 85/ 0

A somewhat different situation occurs when the conditions table-omit-header-at-break and table-omit-footer-at-break are set to true. This situation is easily dealt with using the integrated approach. Note that the box for the header appears automatically in the first step. This is because the stepping algorithm puts table height in a box when it can no longer appear after the page break (see TableLayout/KnuthElementsForTables/SteppingAlgorithmDerivation). With table-omit-header-at-break that is immediately true for the header.

We demonstrate this on the same example of the page TableLayout/KnuthElementsForTables/RowBorder2, but now with table-omit-header-at-break="true" and table-omit-footer-at-break="true".

no-break:

header: col1+col2+col3: 5 + 8 + (8/2) = 17
row1:
col2: (6/2) + 15 + (6/2) = 21
col3: (8/2) + 15 + (8/2) = 23
height: 23
row2:
col1: (6/2) + 3*10 + (4/2) = 35, 35 - 23 = 12
col2: (6/2) + 20 + (4/2) = 25
col3: (8/2) + 20 + (8/2) = 28
height: 28
row1+row2 height: 51
footer: col1+col2+col3: (8/2) + 8 + 5 = 17
no-break height: 17 + 51 + 17 = 85

step 1:

header: col1+col2+col3: 5 + 8 + (8/2) = 17
row1: 
col2: (6/2) + (6/2) = 6
col3: (8/2) + (8/2) = 8
height: 8
row2:
col1: (6/2) + 10 + (6/2) = 16, 16 - 8 = 8
col2: 6 + 0 = 6
col3: 8 + 0 = 8
height: 8
row1+row2 height: 16
step height: 17 + 16 = 33

row1:
col2: (6/2) + 15 + (6/2) = 21
col3: (8/2) + 15 + (8/2) = 23
height: 23
row1+row2:
col1: (6/2) + 20 + (4/2) = 25, 25 - 23 = 2
col2: (6/2) + 20 + (4/2) = 25
col3: (8/2) + 20 + (8/2) = 28
height: 28
row1+row2 height: 51
footer: col1+col2+col3: (8/2) + 8 + 5 = 17
remaining height: 51 + 17 = 68

Split the step height into box and penalty heights:

box height     = previous remaining height - remaining height
penalty height = step height + remaining height - no-break height
box height: 85 - 68 = 17
penalty height: 33 + 68 - 85 = 16

Check consistency:

step height    = previous box heights + box height + penalty height
step height 33 = 0 + (85 - 68) + (33 + 68 - 85)

step 2:

header: col1+col2+col3: 5 + 8 + (8/2) = 17
row1:
col2: (6/2) + 15 + (6/2) = 21
col3: (8/2) + (8/2) = 8
height: 21
row2:
col1: (6/2) + 10 + (6/2) = 16, 16 - 21 = -5
col2: 0
col3: 0
height: 0
row1+row2 height: 21
step height: 17 + 21 = 38

row1:
col2: (6/2) + (6/2) = 6
col3: (8/2) + 15 + (8/2) = 23
height: 23
row2:
col1: (6/2) + 20 + (4/2) = 25, 25 - 23 = 2
col2: (6/2) + 20 + (4/2) = 25
col3: (8/2) + 20 + (8/2) = 28
height: 28
row1+row2 height: 51
footer: col1+col2+col3: (8/2) + 8 + 5 = 17
remaining height: 51 + 17 = 68
box height: 68 - 68 = 0
penalty height: 38 + 68 - 85 = 21
step height 38 = 17 + (68 - 68) + (38 + 68 - 85)

step 3:

header: col1+col2+col3: 5 + 8 + (8/2) = 17
row1:
col2: (6/2) + 15 + (6/2) = 21
col3: (8/2) + 15 + (8/2) = 23
height: 23
row2:
col1: (6/2) + 10 + (6/2) = 16, 16 - 23 = -7
col2: 0
col3: 0
height: 0
row1+row2 height: 23
step height: 17 + 23 = 40

row1: no content
row2:
col1: (4/2) + 20 + (4/2) = 24, 24 - 0 = 24
col2: (4/2) + 20 + (4/2) = 24
col3: (8/2) + 20 + (8/2) = 28
height: 28
row1+row2 height: 28
footer: col1+col2+col3: (8/2) + 8 + 5 = 17
remaining height: 17 + 28 = 45
box height: 68 - 45 = 23
penalty height: 40 + 45 - 85 = 0
step height 40 = 17 + (68 - 45) + (40 + 45 - 85)

step 4:

header: col1+col2+col3: 5 + 8 + (8/2) = 17
row1:
col2: (6/2) + 15 + (6/2) = 21
col3: (8/2) + 15 + (8/2) = 23
height: 23
row2:
col1: (6/2) + 20 + (6/2) = 26, 26 - 23 = 3
col2: 0
col3: 0
height: 3
row1+row2 height: 26
step height: 17 + 26 = 43

row1: no content
row2:
col1: (4/2) + 10 + (4/2) = 24, 24 - 0 = 24
col2: (4/2) + 20 + (4/2) = 24
col3: (8/2) + 20 + (8/2) = 28
height: 28
row1+row2 height: 28
footer: col1+col2+col3: (8/2) + 8 + 5 = 17
remaining height: 28 + 17 = 45
box height: 45 - 45 = 0
penalty height: 43 + 45 - 85 = 3
step height 43 = 40 + (45 - 45) + (43 + 45 - 85)

step 5:

header: col1+col2+col3: 5 + 8 + (8/2) = 17
row1:
col2: (6/2) + 15 + (6/2) = 21
col3: (8/2) + 15 + (8/2) = 23
height: 23
row2:
col1: (6/2) + 30 + (4/2) = 35, 35 - 23 = 12
col2: 0
col3: 0
height: 12
row1+row2 height: 35
step height: 17 + 35 = 52

row1: no content
row2:
col1: (4/2) + (4/2) = 4, 4 - 0 = 4
col2: (4/2) + 20 + (4/2) = 24
col3: (8/2) + 20 + (8/2) = 28
height: 28
row1+row2 height: 28
footer: col1+col2+col3: (8/2) + 8 + 5 = 17
remaining height: 28 + 17 = 45
box height: 45 - 45 = 0
penalty height: 52 + 45 - 85 = 12
step height 52 = 40 + (45 - 45) + (52 + 45 - 85)

step 6:

header: col1+col2+col3: 5 + 8 + (8/2) = 17
row1:
col2: (6/2) + 15 + (6/2) = 21
col3: (8/2) + 15 + (8/2) = 23
height: 23
row2:
col1: (6/2) + 30 + (4/2) = 35, 35 - 23 = 12
col2: (6/2) + 20 + (4/2) = 25
col3: (8/2) + (8/2) = 8
height: 25
row1+row2 height: 48
step height: 17 + 48 = 65

row1: no content
row2:
col1: (4/2) + (4/2) = 4, 4 - 0 = 4
col2: (4/2) + (4/2) = 4
col3: (8/2) + 20 + (8/2) = 28
height: 28
row1+row2 height: 28
footer: col1+col2+col3: (8/2) + 8 + 5 = 17
remaining height: 28 + 17 = 45
box height: 45 - 45 = 0
penalty height: 65 + 45 - 85 = 25
step height 65 = 40 + (45 - 45) + (65 + 45 - 85)

step 7 = no-break:

step height: 85
remaining height: 0
box height: 45 - 0 = 45
penalty height: 85 + 0 - 85 = 0
step height 85 = 40 + (45 - 0) + (85 + 0 - 85)

End result:

box( 0 + 17) + penalty(16), 33/68
box(17 +  0) + penalty(21), 38/68
box(17 + 23) + penalty( 0), 40/45
box(40 +  0) + penalty( 3), 43/45
box(40 +  0) + penalty(12), 52/45
box(40 +  0) + penalty(25), 65/45
box(40 + 45) + penalty( 0), 85/ 0

TableLayout/KnuthElementsForTables/HfIntegrationInSteppingAlgorithm (last edited 2009-09-20 23:52:47 by localhost)