Boxes

Breakable boxes

A breakable box can not be declared within:

A breakable box may break across a column boundary, or a page, leaf, or column content break. TopLeaf will generate an error if a non-breakable box cannot be rendered within a single column.

If a box does break, the box frame may not extend all the way to the bottom of the page.

Box nesting

The only valid box nesting is an unbreakable box within a breakable box. Attempts to circumvent this restriction may result in unpredictable effects and can abort the typesetting run. The typesetting engine will generate a non-fatal error if the calculated vertical offset for the start of a breakable box and an unbreakable box is identical.

Box margins

The placement rules applied to a box are defined by the current margins and the content immediately adjacent to the top and bottom of the box. This may not always give the expected result.

Consider the following data:

<doc>
  <box>
    <item><label>1.</label>First.</item>
    <item><label>2.</label>Second.</item>
  </box>
</doc>

If the mapping for <item> sets a left margin, the box drawn by the <box> mapping will not enclose the label content:

To solve this problem, emit some content in the pre-content box of the mapping for <box>. For example, a custom marker containing a non-breaking space, with the custom mapping setting a small font size.

Box spacing

If a box begins with tabular content, then the vertical space above the box is determined by the box style above spacing. Otherwise, the vertical space above the box is the larger of the above space declared by the current box style and any pending inter-paragraph space.

Fixed block box frames and fill patterns

The following restriction applies to fixed block frames and fill patterns:

  • The depth of a box generated by a Header/Footer mapping is determined by the height of the header or footer defined in the page layout, not by what it contains. If the height of a header or footer block exceeds the depth of the content in that block, TopLeaf will vertically centre the content within the block.

  • If a fixed block mapping applies a box or fill pattern, then the associated fixed block must emit content before the box or fill is displayed. The simplest way to add non-visible content to a fixed block is to declare a non-breaking space (&nbsp;) within the fixed block custom content.