mernst@theory.lcs.mit.edu (Michael Ernst) (01/11/91)
I'm looking for a macro that will let me draw hierarchical trees in the style of genealogical, organizational, or parse charts. I'd like to get A | -------------------------------- | | | B J K | | -------------------------------- L | | | | | C D E I ------- | | | ------------ M N | | | F G H from the "obvious" input, say \tree{A}[\tree{B}[C,D,\tree{E}[F,G,H],I],J,\tree{K}[\tree{L}[M,N]]] or something similar (the format of the TeX code is flexible). Your help is much appreciated. -Michael Ernst mernst@theory.lcs.mit.edu
isozaki@csli.Stanford.EDU (Hideki Isozaki) (01/12/91)
>I'm looking for a macro that will let me draw hierarchical trees in the >style of genealogical, organizational, or parse charts. >I'd like to get You can get my style file by anonymous ftp in sun.soe.clarkson.edu:pub/tex/latex-style/nodeedge.shar. > A > | > -------------------------------- > | | | > B J K It draws direct slanted lines using epic/eepic commands by default, but I think you can draw such a tree with an additional macro definition for \crank as below. Ex. \documentstyle[epic,ecltree]{article} \makeatletter \newdimen\@midY \def\crank#1(#2,#3)(#4,#5){% \@midY=#3\p@\advance\@midY by #5\p@\divide\@midY by 2\relax \edef\@MidY{\expandafter\@RemoveDim\the\@midY}% #1(#2,#3)(#2,\@MidY)(#4,\@MidY)(#4,#5)} \makeatother \begin{document} \drawwith{\crank\drawline} \begin{bundle}{A} \chunk{\begin{bundle}{B} \chunk{C} \chunk{D} \chunk{E} \chunk{I} \end{bundle}} \chunk{J} \chunk{K} \end{bundle} \end{document} Hideki ISOZAKI Stanford Univ. & NTT
teexdwu@ioe.lon.ac.uk (DOMINIK WUJASTYK) (01/13/91)
In article <MERNST.91Jan11023825@emu.lcs.mit.edu> mernst@theory.lcs.mit.edu (Michael Ernst) writes: >I'm looking for a macro that will let me draw hierarchical trees in the >style of genealogical, organizational, or parse charts. I'd like to get > > A > | > -------------------------------- > | | | > B J K > | | > -------------------------------- L > | | | | | > C D E I ------- > | | | > ------------ M N > | | | > F G H > >from the "obvious" input, say > >\tree{A}[\tree{B}[C,D,\tree{E}[F,G,H],I],J,\tree{K}[\tree{L}[M,N]]] There's a file chomsky.tex that is in the standard TeX archives and will do exactly what you want. Dominik
hwb@texnix.stgt.sub.org (Harald Boegeholz) (01/14/91)
Hi! Some time ago I wrote some TeX-macros to typeset trees. Since two people asked recently, here they are (quite short, so I thought I might post). Be aware, though, of two possible problems: 1. The macros use the \specials defined by emTeX. If your DVI-driver doesn't support these, you won't see any lines. 2. The semantic nest size required is considerable (too many boxes inside of boxes inside of boxes...), so you'll possibly need a TeX which is "large" in this respect for typesetting complex trees. Hope this helps Harald ------------------ cut here with a sharp knife ------------------------ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % tree macros by Harald Boegeholz % This file uses the \specials defined by emTeX to draw the lines! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcount\pointnumber \pointnumber=0 \newcount\father \font\nodefont=cmr7 \def\nextpoint{\global\advance\pointnumber by 1\relax} \def\endsubtrees{\endsubtrees} \def\tn#1{\vbox{% \vskip.5mm \hbox{\nodefont\hskip1ex\relax #1\hskip1ex} \vskip.5mm }% } \def\tree#1#2{% \vtop{% \nextpoint \father=\pointnumber \halign{\hfil##\hfil\cr #1\cr \special{em:point \number\father}\cr \noalign{\vskip5mm} \hbox{\subtrees#2\endsubtrees}\cr }% }% }% \def\subtrees#1{\ifx#1\endsubtrees\let\next\relax\else \vbox{\halign{\hfil##\hfil\cr \nextpoint \special{em:point \number\pointnumber}% \special{em:line \number\pointnumber h,\number\father h}\cr #1\cr }}% \let\next\subtrees\fi \next } \def\labeledtree#1#2{\vbox{\offinterlineskip\halign{\hfil##\hfil\cr #1\cr \noalign{\vskip3pt}% $\scriptstyle#2$\cr }}} \parindent0pt \raggedbottom %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % macros end here ... sample follows: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% {\labeledtree{% {\tree{\tn{1}}{% {\tree{\tn{2}}{% {\tn{3}}% {\tn{4}}% }}% {\tree{\tn{5}}{% {\tn{6}}% }}% }}% }{[1,2,2,1,5]}}% \bye ------------------ cut here with a sharp knife ------------------------ -- Harald Boegeholz |Home: hwb@texnix.stgt.sub.org (read daily) |University: boegehol@az3.informatik.uni-stuttgart.de | ^ please use the latter for large (>100k) mails