Hla Hla Htay's Notes


Latex : Drawing tree in latex
July 12, 2008, 10:59 am
Filed under: Latex, Writing | Tags: , ,
  • Taken from the following URL
    http://wiki.loria.fr/wiki/Drawing_LaTeX_trees

  • need \package{tree-dvips}

  • Example


    \begin{figure}[htbp]
    \begin{center}
    \small
    % ------------------------------------------ John calls Mary
    \begin{tabular}{c@{\hspace{-3em}}c@{\hspace{-3em}}c}
    \multicolumn{3}{c}{\hspace{-2em}\node{x1}{S}}
    \\[2ex]
    \node{x1.1}{NP$^{idx=j}$} &
    \multicolumn{2}{c}{\hspace{4em}\node{x1.2}{VP$^{idx=c}$}}
    \\[2ex]
    \node{x1.1.1}{John} &
    \node{x1.2.1}{V} &
    \node{x1.2.2}{NP$^{idx=m}$}
    \\[2ex]
    &
    \node{x1.2.1.1}{calls} &
    \node{x1.2.2.1}{Mary}
    \\
    & \textit{\tiny name(j,john), l$_0$:calls(c,j,m), name(m,mary)} & \\
    \end{tabular}
    \nodeconnect{x1}{x1.1}
    \nodeconnect{x1}{x1.2}
    \nodeconnect{x1.1}{x1.1.1}
    \nodeconnect{x1.2}{x1.2.1}
    \nodeconnect{x1.2}{x1.2.2}
    \nodeconnect{x1.2.1}{x1.2.1.1}
    \nodeconnect{x1.2.2}{x1.2.2.1}
    \caption{\label{fig:tag-with-semantics-2} \textsf{John calls Mary}}
    \end{center}
    \end{figure}

  • How the example will show

  • The following is HHH’s example for drawing tree. The WordNet’s snipet is from the following ppt. Huuuh.. it is a bit difficult :P www.hcsnet.edu.au/files2/Aggire_seminar_2007.ppt


    \begin{figure}[htbp]
    \begin{center}
    \small
    \begin{tabular}{c@{\hspace{-3em}}c@{\hspace{-3em}}c@{\hspace{-3em}}c@{\hspace{-3em}}}
    \multicolumn{2}{c}{\hspace{5em}\node{x1}{event}}\multicolumn{2}{c}{\hspace{6em}\node{x2}{group, grouping}}
    \\[3ex]
    \multicolumn{2}{c}{\hspace{3em}\node{x1.1}{social\_event}}\multicolumn{2}{c}{\hspace{5em}\node{x2.1}{social\_group}}
    \\[3ex]
    \multicolumn{2}{c}{\hspace{1em}\node{x1.2}{affair, social\_occasion}}\multicolumn{2}{c}{\hspace{4em}\node{x2.2}{organisation}}
    \\[3ex]
    \multicolumn{2}{c}{\hspace{6em}\node{x1.3}{textbf{party\_2}}}\multicolumn{2}{c}{\hspace{7em}\node{x2.3}{\textbf{party\_1}, political\_party}}
    \\[3ex]
    \node{x1.3.1}{coctail\_party}\node{x1.3.2}{birthday\_party}\node{x2.3.1}{Labour, Labour\_party}\node{x2.3.2}{Liberal\_Party}
    \\[3ex]
    \end{tabular}
    \nodeconnect{x1}{x1.1}
    \nodeconnect{x2}{x2.1}
    \nodeconnect{x1.1}{x1.2}
    \nodeconnect{x2.1}{x2.2}
    \nodeconnect{x1.2}{x1.3}
    \nodeconnect{x2.2}{x2.3}
    \nodeconnect{x1.3}{x1.3.1}
    \nodeconnect{x1.3}{x1.3.2}
    \nodeconnect{x2.3}{x2.3.1}
    \nodeconnect{x2.3}{x2.3.2}
    \caption{\label{fig:AcquisitionSenseExamples} \textsf{Acquisition: Sense Examples}}
    \end{center}
    \end{figure}

  • You will see like this.