9.3 Keeps

9.3.1 Keep conditions

You can prevent information from separating over line, column, or page contexts, by using

  • line-oriented keeps for inline-level constructs only;

    • use keep .within-line= for the line context,

  • column- and page-oriented keeps for block-level constructs;

    • use keep .within-column= for the column context;

    • use keep .within-page= for the page context.

Overriding widows and orphans with the keep-together property:

  • keeps descendants together,

  • adds a context break to the flow before an area whose entire content will not fit within the keep-together component context.

Injecting context breaks with the keep-with-previous and keep-with- next properties:

  • keeps siblings together,

  • adds a context break to the flow before an area when

    • the following area has a keep-with-previous property component and both areas will not fit within the component context,

    • the area has a keep-with-next property component and both areas will not fit within the component context.

Relative strengths of keeps can be specified to ensure "more important" areas are kept together when "less important" areas cannot be kept together.

  • Consider a safety publication where a list of steps is attempted to be kept together.

    • There may be warnings found in the list of steps.

    • If the steps cannot be kept together, the more important blocks associated with the warning are to be kept together.

9.3.2 Examples of keeps

Consider the "before and after" comparison of using keeps and not using keeps shown in Figure 9-3.

Figure 9-3. Examples of keeps

graphics/09fig03.jpg

The markup in Example 9-1 illustrates controlling the keeps for descendants.

Of note:

  • the lines reading "Block in block" spread over the column break on page 1;

  • these lines are kept together within the column on page 2.

Consider the "before and after" comparison of not using keeps of siblings and then using keeps shown in Figure 9-4.

Figure 9-4. Examples of sibling keeps

graphics/09fig04.jpg

Note that the space at the head of each reference area is conditional and is therefore discarded.

The markup in Example 9-2 illustrates controlling the keeps for siblings.

Of note:

  • on page 1 the heading for the third group of names is not in the same column as the names ;

  • on page 2 the heading for the third group of names is kept together with the names.

Example 9-1 Keeping a group of areas together in a reference area
 Line 01 <layout-master-set>      02   ...      03     <region-body region-name="frame-body" column-count="2" .../>      04   ...      05 </layout-master-set>      06  ...      07 <flow flow-name="frame-body" font-size="40pt">      08   <block break-before="page">New page</block>      09   <block>This is a test</block>      10   ...      11   <block>This is a test</block>      12   <block>This is a block      13     <block>Block in block</block>      14     ...      15     <block>Block in block</block>      16     End block</block>      17   <block>This is a test</block>      18   ...      19   <block>This is a test</block>      20   <block break-before="page">New page</block>      21   <block>This is a test</block>      22   ...      23   <block>This is a test</block>      24   <block  keep-together.within-column="always"  >This is a block      25     <block>Block in block</block>      26     ...      27     <block>Block in block</block>      28     End block</block>      29   <block>This is a test</block>      30   ...      31   <block>This is a test</block>      32 </flow> 

9.3.3 Keep strength

The strength of a keep is specified in the corresponding property's value.

  • " auto " indicates no keep condition imposed.

  • " integer-number " indicates a relative keep strength that can be ignored;

    • it is ignored without overflow condition if the keep area doesn't fit.

  • " always " indicates a keep that cannot be ignored;

    • it implies an overflow condition if the keep area doesn't fit.

  • Consider the situation where the pieces of a warning notice have to be kept together within a set of blocks that would be nice to keep together but may not fit on a page;

    • the keep of the warning components would have a higher value than the keep of the set of blocks.

A keep is attempted to be fit first into what remains within the context.

  • If a keep doesn't fit what remains, it begins within the next context (e.g. next column or next page).

  • A keep is ignored if the amount being kept doesn't fit an entire context.

    • When ignored, the keep's content is flowed as if there was no keep specified.

    • It does not begin at the start of the next context, but after the last flowed area.

  • The keeps of next higher strength within the flow of the keep being ignored are attempted to be kept together.

    • Any keeps of lower strength are ignored as that strength has already been addressed.

  • The keep of the next higher strength is then ignored if the length of that keep's flow cannot fit within the context.

    • That keep's content is flowed as if there was no keep specified.

  • A keep of " always " is never ignored; if the areas do not fit in the context, an overflow condition is triggered.

Example 9-2 Keeping a group of areas together in a reference area
 Line 01 <block space-before="1.5cm" space-after="1.3cm"      02        font-weight="bold">L</block>      03 <block space-before=".2em">Lee, Nancy</block>      04 <block space-before=".2em">Lee, Ian</block>      05 <block space-before=".2em">Lee, Mathew</block>      06 <block space-before=".2em">Lee, Allison</block>      07       08 <block space-before="1.5cm" space-after="1.3cm"      09        font-weight="bold">P</block>      10 <block space-before=".2em">Prole, Diane</block>      11 <block space-before=".2em">Prole, Mark</block>      12 <block space-before=".2em">Prole, Connor</block>      13 <block space-before=".2em">Prole, Sydney</block>      14 ...      15 <block space-before="1.5cm" space-after="1.3cm"      16  keep-with-next.within-column="always"  17        font-weight="bold">L</block>      18 <block space-before=".2em">Lee, Nancy</block>      19 <block space-before=".2em">Lee, Ian</block>      20 <block space-before=".2em">Lee, Mathew</block>      21 <block space-before=".2em">Lee, Allison</block>      22       23 <block space-before="1.5cm" space-after="1.3cm"      24  keep-with-next.within-column="always"  25        font-weight="bold">P</block>      26 <block space-before=".2em">Prole, Diane</block>      27 <block space-before=".2em">Prole, Mark</block>      28 <block space-before=".2em">Prole, Connor</block>      29 <block space-before=".2em">Prole, Sydney</block> 

The size of the flow for a keep doesn't affect the choice of page geometry.

  • A page-level keep will be tested on the next page geometry chosen by page sequencing.

  • A smaller page geometry is not simply ignored if it cannot accommodate the information in the keep and a subsequent page happens to fit the content.

  • The choice of page geometry is solely based on page sequencing and never on flow.

Explicit break conditions are stronger than any keep conditions.

  • A keep is ignored if a break is specified.

Consider two situations in Figure 9-5 where keeps are allowed to be ignored and not allowed to be ignored.

Figure 9-5. Keep strength

graphics/09fig05.gif

Of note:

  • for each of the two examples, the blocks on the left depict the blocks in the flow, while the pages on the right depict where the blocks end up on the pages;

  • the pages are depicted with the odd page numbers on the right and the even page numbers on the left as is typical in left-to-right writing systems.

In this example, each labeled block includes an area with that label plus the areas of the labeled blocks found therein.

Using a numeric value allows the keep to be ignored.

  • A has no keep and flows as usual.

  • B has keep="2" and contains C, F, and G.

    • All of B is longer than what remains on the first page, so the second page is attempted.

    • Because it doesn't fit on the second page, the B keep is ignored and its content is flowed as if no keep was specified for B.

  • C has keep="1" and contains D and E.

    • Though all of C would fit on the next page, the keep strength specified is less than what has already been rejected, so the keep has no force and is ignored as if no keep was specified for C.

  • D has no keep and flows as usual.

  • E has keep="3" and doesn't fit on the rest of the first page.

    • The keep strength is higher than what has been rejected, so it is respected.

    • Content is placed on the second page.

  • F has keep="3" and doesn't fit on the second page.

    • The keep strength is higher than what has been rejected, so it is respected.

    • Content is placed on the third page.

  • G has no keep and flows as usual.

  • H has keep="1" and doesn't fit on the rest of the third page.

    • It hasn't been part of any keep that has been rejected, and it fits in its entirety on a page, so it is moved to the next page.

  • I through L do not break over a page so their keep values are not considered .

Using " always " does not allow the keep to be ignored.

  • X has no keep and flows as usual.

  • Y doesn't fit on the remainder of the first page;

    • because of the " always " it begins on the second page;

    • because it is longer than the second page, an overflow condition exists;

      • whatever doesn't fit is lost.

  • Z has no keep and flows as usual.

    • It ends up at the start of the third page because the second page is full.



Definitive XSL-FO
Definitive XSL-FO
ISBN: 0131403745
EAN: 2147483647
Year: 2002
Pages: 99
Authors: G. Ken Holman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net