Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Tree diagrams in LaTeX?

  1. Aug 1, 2005 #1

    honestrosewater

    User Avatar
    Gold Member

    Like so. Can we already do this? Does anyone else want to? I think it would be helpful. For explaining some things, trees are just so much clearer than anything else. What I can do in code seems quite limited.
    Code (Text):

            N
            /\
           /  \
         A   -ness
         /\
        /  \
      un-  A
            |
          happy
    Some info I found: http://www.essex.ac.uk/linguistics/clmt/latex4ling/trees/
     
  2. jcsd
  3. Aug 2, 2005 #2

    robphy

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Here's a tedious solution
    [tex]
    \begin{picture}(400,200)(0,0)
    \put(125,200){\makebox(0,15){N}}
    \put(125,200){\line(-1,-1){35}}
    \put(125,200){\line(1,-1){35}}
    \put(75,150){\makebox(0,15){A}}
    \put(175,150){\makebox(0,15){-ness}}
    \put(75,140){\line(-1,-1){35}}
    \put(75,140){\line(1,-1){35}}
    \put(25,90){\makebox(0,15){un-}}
    \put(125,90){\makebox(0,15){A}}
    \linethickness{2pt}
    \textcolor{red}{ \put(120,80){\line(0,-1){50}} }
    \put(125,10){\makebox(0,15){happy}}
    \end{picture}
    [/tex]

    Here's an attempt to nest the branches
    [tex]
    \def\BOX#1{\makebox(0,15){#1}}
    \begin{picture}(400,200)(0,0)
    \put(125,200){\BOX{A}}
    \put(125,200){\line(-1,-1){35}}
    \put(125,200){\line(1,-1){35}}
    \put(75,150){
    \put(0,0){\BOX{B}}
    \put(0,0){\line(-1,-1){35}}
    \put(0,0){\line(1,-1){35}}
    \put(50,-50){
    \put(0,0){\BOX{C}}
    \put(0,0){\line(-1,-1){35}}
    \put(0,0){\line(1,-1){35}}
    \put(50,-50){
    \put(0,0){\BOX{D}}
    \put(0,0){\line(-1,-1){35}}
    \put(0,0){\line(1,-1){35}}
    }
    }
    }

    \end{picture}
    [/tex]
    ...maybe a macro can help.


    ...along these lines, maybe one can interface with http://www.liafa.jussieu.fr/~gastin/JasTeX/JastexApplet.html (needs \usepackage{gastex} ) or some variation of it.
     
  4. Aug 3, 2005 #3

    honestrosewater

    User Avatar
    Gold Member

    Oh, wow, thanks. I'll try that and see if it's easier than it looks.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Tree diagrams in LaTeX?
  1. Problem with latex (Replies: 2)

  2. Latex test (Replies: 2)

  3. Facebook and Latex (Replies: 3)

  4. LaTeX incomplete (Replies: 2)

  5. Latex broken? (Replies: 2)

Loading...