The Primitive \xleaders
The primitive \xleaders is a leaders construction which
distributes the material evenly in its surrounding box if it does not fit
perfectly. The primitive takes as the first argument a box or rule. The
second argument is a horizontal or vertical skip specification. The two
arguments have to agree on the orientation; either both are horizontal or
both are vertical.
The primitive behaves like a glue node with the given skip characteristics.
This means it participates in the distribution of the space in the
surrounding box. When the final dimensions of the leader element are
determined then the empty space is filled with the given box or rule.
The simplest case is a rule which is adjusted to the actual size of the
element. This means it either stretches horizontally or vertically according
to its orientation.
If a box is given then the contents of the box is repeated within the free
space until it is filled. If the space can not be filled exactly then the
remaining space is distributed evenly between the elements inserted and at
both ends. This means that the box material is replicated and adjusted within
the given rectangle. As a consequence nothing will appear on the page if the
available space is smaller than the natural width of the box. If only one
element is inserted then this element is centered.
Note that there are also the primitives \cleaders and
\leaders which provide essentially the same functionality but
adjust the material within the final space differently.
Syntax
The formal description of this primitive is the following:
〈xleaders〉
→ \xleaders 〈Box or Rule〉 〈Skip〉
〈Box or Rule〉
→ 〈Box〉
| 〈Rule〉
Examples
\xleaders\hrule\hfill
This example creates a horizontal rule which fills the space made up by the
\hfill. The rule stretches horizontally and has its natural
dimensions vertically.
\xleaders\vrule\vfil
This example demonstrates the same in vertical direction. Since only
\vil is used it may not appear at all when the other elements in
the surrounding box overrule it.
\xleaders\hbox to 2em{\hss .\hss}\hfill
This example shows a box of the width 2em which has a centered period in it.
The contents of the box is repeated until it fills the space available. If
the final width is a multiple of 2em then then this space is filled up. If
the available space leaves some freedom then this extra space is distributed
equally between the boxes inserted and the left and right margin.