Newsgroups: comp.text.tex
Newsgroups: comp.text.tex
> I'm looking for something that will turn a labelled backeting, like > > (a (b c d) (e f)) > > into an ASCII tree, like > > a > /\ > / \ > / \ > b e > /\ | > / \ | > / \ | > c d f
qtree.sty will do what you want, I think. In fact, I use it for my English Syntax course, and I'm very happy with it. There are many others, though. You might check out the following links:
BTW, most tree-drawing macros won't work with pdflatex. In the case of qtree, you can comment out the reference to eepic.sty to make things pdflatex-compatible. The trees won't look as good as with LaTeX + eepic, but the result is definitely legible.
Hope this helps,
Joe
> http://www.ifi.uio.no/~dag/ling-tex/[] > http://clwww.essex.ac.uk/latex4ling/[]
I had forgotten about those resources. That was great. I found a link to Greg Lee's "tree" preprocessor which does what I want and is based on Chris Barker's program of the same name which is what I recall using in the mid '80s. In did the "examples" in the documentation have some from me.
> http://clwww.essex.ac.uk/latex4ling/[]
404 Error.
documented on: 2001.02.20
Newsgroups: comp.text.tex
>Does anyone know of a package which I can use to typeset a directory-tree >structure in (La)TeX? > >like: > >Programming > | > | -- C-apps > | -- C++-apps > | | > | | -- templates > | > | -- Haskell-apps
This is a simple indented list. You can simply enter the lines with various indentation as you have already done in your message. Or you can feed the date into one of the index making programs like makeindex or xindy. If you want some sort of graphical representation of a tree structure try pstricks.
For requirements like this plain TeX gives you more control and less hassle IMHO. Also look at eplain.tex as well as pstricks as handy addons to plain.
HTH
John Culleton
Newsgroups: comp.text.tex
> I want to put a hierarchy diagram in my LaTeX document, something like > this:
> Level 1 > | > |-- Level 2 > | | > | |-- Level 3 > | +-- Level 3 > +-- Level 2
There are many packages to draw structured diagrams and trees. Choosing one depend on various conditions, and you must explore their documentations to found the one which would satisfy the best your needs.
Using PSTricks, you can draw your diagram as a structured one using the general "psmatrix" environment or as a tree. I give you both examples.
\documentclass{article} \usepackage{pst-tree} % Level 1 % | % |-- Level 2 % | | % | |-- Level 3 % | +-- Level 3 % +-- Level 2 \pagestyle{empty} \begin{document} % Drawn as general structured diagram in a matrix of cells \begin{psmatrix}[colsep=-0.2,rowsep=0.2] [name=Level1] Level 1 \\ & [name=Level21] Level 21 \\ & & [name=Level31] Level 31 \\ & & [name=Level32] Level 32 \\ & [name=Level22] Level 22 \\ \end{psmatrix} \psset{angleA=-90,angleB=180,armB=0,nodesep=0.1} \ncangle{Level1}{Level21} \ncangle{Level1}{Level22} \ncangle{Level21}{Level31} \ncangle{Level21}{Level32} \vspace{2cm} % Drawn as a tree (the bounding box is inaccurate) \newcommand{\MyTree}{% \pstree[treemode=R,treeflip=true,treesep=-0.7,levelsep=1,nodesep=0.1]% {\TR{Level 1}} {\Tn \pstree{\TR{Level 21}} {\Tn \TR{Level 31} \TR{Level 32}} \tspace{-1} \TR{Level 22} \TR{Level 23} \TR{Level 24}}} \renewcommand{\psedge}{\ncangle[angleA=-90,angleB=180,armB=0]} \MyTree \psset{showbbox=true} \MyTree \end{document}
Nevertheless, in the first case, you must draw the line connections explicitely, which is painful if you have a huge diagram or many ones. In the second case, as you need a special disposition of leaves, you must use a negative value for the "treesep" parameter. But, as you can see if you ask to show it ("showbbox=true"), the picture size (the corresponding "bounding box") is not correctly computed in this case. So, you must adjust vertically the position of the diagram. One time more, it is not pleasant if you have several of them.
As I found the idea useful, I try to add a complete and clean solution to the `pst-tree' package. But as there are many different cases to test, according the direction of the tree and the order of management of the leaves, my test file is a little bit to huge to be sent here. So, I sent it to you only and to the PSTricks mailing list.
Denis Girou
Date: Sat, Oct 15 2005 4:04 pm Groups: comp.text.tex
> Is it possible to draw binary trees in Latex?
Sure. Use Peter Vanroose's trees package. You'll find it at CTAN at
/macros/latex/contrib/treesvr/
Jose Carlos Santos
>>/macros/latex/contrib/treesvr/
> Thanks. > It works quite fine.
> The only question. > Tree placement is horizontal. > Is it possible to do vertical placement of tree?
With PStricks you'll be able to draw trees in any position you want (and lots of other things too).
Jose Carlos Santos
>I tried to test first sample from "Drawing Trees with PStricks" by Doug >Arnold at >http://www.essex.ac.uk/linguistics/clmt/latex4ling/trees/pstrees/index.pdf[]
>But I have some problem.
using pstricks, you have either to generate the pstricks stuff separately, and convert the resulting stuff to pdf, or you need to use latex rather than pdflatex for your whole job, and to use dvips and a distiller (ps2pdf, or whatever) to create the final output.
Robin