9. Tree Orientation
Prev |  | Next

## 9. Tree Orientation

TrEd supports two modes for displaying trees: horizontal and vertical. Switching between these modes can be achieved either by View → Orientation, or by using the `rootstyle:` instruction `#{vertical}` in the stylesheet.

In this manual, we usually only refer to the default mode, which is also called horizontal mode. In this mode the parent nodes apear above the childnodes and the horizontal position of nodes reflects the global ordering of nodes or, for balanced trees, the ordering of siblings with parents placed in between them. In the horizontal mode, node labels are placed below the nodes and edge labels are placed on the flowline between the node and its parent.

In the vertical mode, however, each node is displayed on the left of its descendants and the global ordering of the tree or siblings is reflected on the vertical position of the node, the first node in the ordering being the top-most. In other words, if displayed without labels, the tree in vertical mode would appear mirrored and rotated counterclockwise by 90 degrees compared to the horizontal mode.

The labels in vertical mode are displayed differently than in the horizontal mode. The first label, either node or edge, is displayed next to the node. All other labels, again node or edge, are displayed on the right of the first displayed label in the order in which they are defined in the stylesheet, but are aligned in a tabular way so that the horizontal position of the corresponding labels is the same for all nodes. Each node and its labels thus appears on a line. The line corresponding to the current node is highlighted (see HorizStripe and StripeColor configuration options).

The difference is best visible on Figure 5, “A tree displayed first in the horizontal mode then in the vertical mode”, which shows a simple tree with two sibling node below the root using the following stylesheet:

    style: #{EdgeLabel-dodrawbox:yes}
    node: #{red}n-1
    node: n-2
    edge: #{blue}e-1
    node: n-3
    edge: #{blue}e-2

When the vertical mode is active, key bindings for the arrow keys have a modified semantics. The Left key behaves as Up, the Right key behaves as Down, Up behaves like Left and Down behaves like Right. This change also applies to all user defined combinations with any other modifiers, but does not affect the combinations with Shift, so that in particular Shift+Up and Shift+Down select the previous/next node in the linear order, i.e. the node displayed on the previous/next line.

Figure 5. A tree displayed first in the horizontal mode then in the vertical mode

Prev |  | Next
8. Editing node attributes | Home | ToC | 10. Customizing Tree Appearance: Stylesheets