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

\title{A tree macro}

\author{Hideki ISOZAKI\\NTT Basic Research Labs \& Stanford Univ.}

\date{Nov. 30, 1990}


\addtolength{\textwidth}{12pt}

\begin{document}

\maketitle


\section{Setup}

Include epic.sty and ecltree.sty\footnote{Electrical Communications Labs}
in your document as below:
\begin{verbatim}
\documentclass{article}
\usepackage{epic,ecltree}
\end{verbatim}
If your printer driver accepts tpic commands,
you should specify eepic.sty after epic.sty.
\begin{verbatim}
\usepackage{epic,eepic,ecltree}
\end{verbatim}
As eepic.sty redefines some macros defined in epic.sty,
Do not reverse this order.

\section{bundle environment}

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

If you write
\begin{verbatim}
\begin{bundle}{xxx}
\chunk{aaa}
\chunk{bbb}
\chunk{ccc}
\end{bundle}
\end{verbatim}
you get
\begin{bundle}{xxx}
\chunk{aaa}
\chunk{bbb}
\chunk{ccc}
\end{bundle}.

You can nest the {\it bundle} environment.
If you write
\begin{verbatim}
\begin{bundle}{xxx}
\chunk{aaa}
\chunk{
        \begin{bundle}{yyy}
        \chunk{bbb}
        \chunk{ddd}
        \end{bundle}}
\chunk{ccc}
\end{bundle}
\end{verbatim}
you get
\begin{bundle}{xxx}
\chunk{aaa}
\chunk{
        \begin{bundle}{yyy}
        \chunk{bbb}
        \chunk{ddd}
        \end{bundle}}
\chunk{ccc}
\end{bundle}.

\section{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
\begin{verbatim}
\dashline[65]{3}(x1,y1)(x2,y2)
\end{verbatim}
to draw lines, use \verb|\drawwith| command
before (or in) the bundle environment.
\begin{verbatim}
\drawwith{\dashline[65]{3}}
\end{verbatim}

\drawwith{\dashline[65]{3}}
Then you get
\begin{bundle}{xxx}
\chunk{aaa}
\chunk{
        \begin{bundle}{yyy}
        \chunk{bbb}
        \chunk{ddd}
        \end{bundle}}
\chunk{ccc}
\end{bundle}.

The argument of \verb|\drawwith| is evaluated
at \verb|\end{bundle}|. Hence, if you write
\begin{verbatim}
\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}
\end{verbatim}
you get
\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 can nest the \verb|\drawwith|. If you write
\begin{verbatim}
\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}
\end{verbatim}
you get
\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}.
Thus the nested \verb|\drawwith| is used in the reverse order.

\section{Edge labels}

You can write edge labels. They should be specified as the optional
argument of \verb|\chunk|. Note that the width of an edge label
is neglected. If you write
\drawwith{\drawline}
\begin{verbatim}
\begin{bundle}{xxx}
\chunk[left]{aaa}
\chunk{
        \begin{bundle}{yyy}
        \chunk{bbb}
        \chunk{ddd}
        \end{bundle}}
\chunk[right]{ccc}
\end{bundle}
\end{verbatim}
you get
\begin{bundle}{xxx}
\chunk[left]{aaa}
\chunk{
        \begin{bundle}{yyy}
        \chunk{bbb}
        \chunk{ddd}
        \end{bundle}}
\chunk[right]{ccc}
\end{bundle}.


\section{Spacing}

The {\it bundle} environment
has three parameters for spacing.

\begin{itemize}

\item \verb|\GapDepth| means minimum height of gaps between
adjacent nodes.

\item \verb|\GapWidth| means minimum width of gaps between
adjacent nodes.

\item \verb|\EdgeLabelSep| means height of an edge label
from the lower node of the edge.

\end{itemize}

You should set these parameters before the {\tt bundle} environment
if you dislike default values.

If you write
\begin{verbatim}
\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}
\end{verbatim}
you get
\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}.




\end{document}

