summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/genmisc/emtrees.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/genmisc/emtrees.tex')
-rw-r--r--Master/texmf-dist/tex/generic/genmisc/emtrees.tex87
1 files changed, 87 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/genmisc/emtrees.tex b/Master/texmf-dist/tex/generic/genmisc/emtrees.tex
new file mode 100644
index 00000000000..3c9c5e1a3fb
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/genmisc/emtrees.tex
@@ -0,0 +1,87 @@
+%From: hwb@texnix.stgt.sub.org (Harald Boegeholz)
+%Newsgroups: comp.text.tex
+%Date: 14 Jan 91 13:44:29 GMT
+%
+%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:
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\endinput
+
+{\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