org.extex.unit.tex.typesetter.leaders Class Xleaders

java.lang.Object
org.extex.interpreter.type.AbstractCode
org.extex.unit.tex.typesetter.leaders.Leaders
org.extex.unit.tex.typesetter.leaders.Xleaders

All Implemented Interfaces:
java.io.Serializable, Code

public class Xleadersextends Leaders

This class provides an implementation for the primitive \xleaders.

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.

Version:
$Revision:4431$
Author:
Gerd Neugebauer
See Also:
ExpandedLeadersNode, Serialized Form

Field Summary
protected static long serialVersionUID
The constant serialVersionUID contains the id for serialization.

Constructor Summary
Xleaders(CodeToken token)
Creates a new object.

Method Summary
protected  void addNode(Typesetter typesetter, OrientedNode node, FixedGlue skip)
Finally make an appropriate node and add it to the typesetter.

Methods inherited from class org.extex.unit.tex.typesetter.leaders.Leaders
execute

Methods inherited from class org.extex.interpreter.type.AbstractCode
getLocalizer, getName, getToken, isIf, isOuter, readResolve, toString, toText, toText

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail

serialVersionUID

protected static final long serialVersionUID
The constant serialVersionUID contains the id for serialization.

See Also:
Constant Field Values
Constructor Detail

Xleaders

public Xleaders(CodeToken token)
Creates a new object.

Parameters:
token - the initial token for the primitive
Method Detail

addNode

protected void addNode(Typesetter typesetter,
OrientedNode node,
FixedGlue skip)
throws TypesetterException
Finally make an appropriate node and add it to the typesetter.

Overrides:
addNode in class Leaders
Parameters:
typesetter - the typesetter
node - the node
skip - the skip amount
Throws:
TypesetterException - in case of an error