2

I have been trying to recreate this exact tree using tikz, but I just cant seem to align the nodes correctly:

horizontal tikz tree

Is it even possible with the tikz library? I have been looking into the tikz-qtree package as well.

I did not add a MWE as i have nothing.

  • 1
    You could modify the answer to this question How to align parent nodes to the left/top in a tree, most of the job is done. – Alenanno Jun 16 '16 at 18:38
  • You could add an MWE with the nodes you want in the tree. Otherwise, you are asking people even to type in the text for you from an image which is a PITA. However, if you want that exact tree, then you have to do \includegraphics{<name of file>}. Nothing else will be identical with that tree. (Even then, it might not be exactly that tree - it depends how we individuate trees.) – cfr Jun 16 '16 at 21:44
  • @Alenanno Is there an answer with current Forest? This kind of tree is much easier with version 2 than it was with version 1. – cfr Jun 16 '16 at 21:46
  • @cfr Well now there is, I think it makes this question a duplicate. :P – Alenanno Jun 16 '16 at 23:13
  • @Alenanno True. I answered this one first and then thought it might be useful to post a current solution there as well. – cfr Jun 16 '16 at 23:39
6

This illustrates one way to achieve the desired structure with current Forest. It is not this exact tree in part because the question doesn't include any of the contents for the tree and copying alien terms from a low-resolution image is both tedious and irrelevant to the TeX, and partly because that tree is ugly and unfinished looking with all kinds of gaps and ill-fitting joins which, as far as I can tell, serve no representative purpose at all.

\documentclass[tikz,border=10pt,multi,rgb]{standalone}
\usepackage[edges]{forest}
\begin{document}
\begin{forest}
  for tree={
    grow'=0,
    parent anchor=children,
    child anchor=parent,
    anchor=parent,
  },
  where level=0{
    draw
  }{
    if={(n()==1)&&(level()>1)}{
      calign with current edge
    }{},
    if n children=0{folder}{},
    edge path'={(!u.parent anchor) -- ++(5pt,0) |- (.child anchor)},
  }
  [something
    [thing
      [something something something something something and something else]
      [thing thing thing thing thing and another thing]
      [non-thing non-thing non-thing non-thing non-thing and another non-thing]
    ]
    [non-thing
      [something
        [pigeon]
        [avocado and coffee grounds]
        [vine fruit]
        [thing in itself]
      ]
      [something else again
        [thing as it appears]
        [thing not itself]
        [random]
        [transcendental deduction from pure reason]
      ]
      [non-something
        [paradoxical antinomies involving synonyms]
        [antithesis]
        [thesis]
        [synthesis]
        [banana]
        [penguin]
      ]
    ]
  ]
\end{forest}
\end{document}

tree structure with current Forest

Since I have no idea what the questioner does or doesn't know or where the problem in constructing the tree lies, I can't say much of any help by way of explanation. Suffice to say that Forest is a specialist TikZ-based package for drawing trees and that the code for this one is pretty simple. It should be straightforward to understand in conjunction with the package manual.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.