A tree macro

Hideki ISOZAKI NTT Basic Research Labs & Stanford Univ.

Nov. 30, 1990

1 Setup

Include epic.sty and ecltree.sty^{1} in your document as below:

\documentclass{article}
\usepackage{epic,ecltree}

If your printer driver accepts tpic commands, you should specify eepic.sty after epic.sty.

\usepackage{epic,eepic,ecltree}

As eepic.sty redefines some macros defined in epic.sty, Do not reverse this order.

2 bundle environment

A tree is drawn by bundle environment. The bundle environment has one argument. This argument specifies the top node label. Leaves should be specified by \chunk in this environment.

If you write

\begin{bundle}{xxx}
\chunk{aaa}
\chunk{bbb}
\chunk{ccc}
\end{bundle}

you get aaa bbb ccc xxx .

You can nest the bundle environment. If you write

1Electrical Communications Labs

\begin{bundle}{xxx}
\chunk{aaa}
\chunk{
        \begin{bundle}{yyy}
        \chunk{bbb}
        \chunk{ddd}
        \end{bundle}}
\chunk{ccc}
\end{bundle}

you get aaa _{bbb ddd yyy} ccc xxx .

3 Line attribute

You can draw not only solid lines but also dotted lines and dash lines. epic.sty and eepic.sty define several commands for them. If you want to use

\dashline[65]{3}(x1,y1)(x2,y2)

to draw lines, use \drawwith command before (or in) the bundle environment.

\drawwith{\dashline[65]{3}}

Then you get aaa _{bbb ddd yyy} ccc xxx .

The argument of \drawwith is evaluated at \end{bundle}. Hence, if you write

\begin{bundle}{xxx}
\chunk{aaa}
\chunk{
        \begin{bundle}{yyy}
        \drawwith{\drawline}
        \chunk{bbb}
        \drawwith{\dashline[65]{3}}
        \chunk{ddd}
        \end{bundle}}
\drawwith{\dottedline{3}}
\chunk{ccc}
\end{bundle}

you get aaa _{bbb ddd yyy} ccc xxx .

You can nest the \drawwith. If you write

\drawwith{\drawwith{\drawwith{\dottedline{3}}\drawline}\dashline{3}}
\begin{bundle}{xxx}
\chunk{aaa}
\chunk{
        \begin{bundle}{yyy}
        \chunk{bbb}
        \chunk{ddd}
        \chunk{eee}
        \end{bundle}}
\chunk{ccc}
\chunk{fff}
\end{bundle}

you get aaa _{bbb ddd eee yyy} ccc fff xxx .Thus the nested \drawwith is used in the reverse

order.

4 Edge labels

You can write edge labels. They should be specified as the optional argument of \chunk. Note that the width of an edge label is neglected. If you write

\begin{bundle}{xxx}
\chunk[left]{aaa}
\chunk{
        \begin{bundle}{yyy}
        \chunk{bbb}
        \chunk{ddd}
        \end{bundle}}
\chunk[right]{ccc}
\end{bundle}

you get aaa _{bbb ddd yyy} ccc^{left xxx right}.

5 Spacing

The bundle environment has three parameters for spacing.

• \GapDepth means minimum height of gaps between adjacent nodes.

• \GapWidth means minimum width of gaps between adjacent nodes.

• \EdgeLabelSep means height of an edge label from the lower node of the edge.

You should set these parameters before the bundle environment if you dislike default values.

If you write

\begin{bundle}{xxx}
\chunk{aaa}
\chunk{
        \setlength{\GapDepth}{5pt}
        \setlength{\GapWidth}{5pt}
        \begin{bundle}{yyy}
        \chunk{bbb}
        \chunk{ddd}
        \end{bundle}}
\chunk{ccc}
\end{bundle}

you get aaa _{bbb ddd yyy} ccc xxx .