I'm trying to create a tree diagram for logic. I've used syntax trees before to do normal truth trees for logic. The trees I'm trying to create, however, don't look like syntax trees. They look like this:

enter image description here

The trees progress downward, and the branches branch out at right angles. The formulas go on the left and right of the various branches rather than at the bottom of nodes.

I have to make a lot of these, so I'd like to avoid anything too complicated, like using TikZ.


1 Answer 1


Note that I think I ought not answer do-it-for-me questions such as this one. When I do so, I do so for me. I provide code for the heck of it. I generally do not explain it as I have no idea what to explain and, besides, I spent my efforts setting the puzzle up, in addition to solving it. I am typically less than sympathetic to requests for changes, explanations, tweaks and adjustments. These are left as exercises for the under-exercised reader. If my code happens to be useful, so be it; if not, tough. Good answers are responses to good questions. Do-it-for-mes cannot expect the same privileges.

Caveat emptor.

Yes, of course it uses TikZ. It is a tree. Every tree needs a Forest.

  declare boolean={T}{true},
  F/.style={not T},
  lr tableau/.style={
    before typesetting nodes={
      for tree={
        math content,
        fork sep'=7.5pt,
        if T={
          parent anchor=east,
          child anchor=east,
          anchor=mid east,
          parent anchor=west,
          child anchor=west,
          anchor=mid west,
    forked edges,
    before computing xy={
      where level=0{if T={parent anchor=north east}{parent anchor=north west}}{
          >O_< {!u.n children}{2}%
      where n children=0{if T={child anchor=south east}{child anchor=south west}}{},
    if n=1{label={[label distance=0pt, anchor=north]-135:\textsf{x}}}{label={[label distance=0pt, anchor=north]-45:\textsf{x}}},
  lr tableau,
  [\lnot \phi, label=left:\checkmark
    [\alpha \lif \beta, label=left:\checkmark
      [\beta \lif \phi, label=left:\checkmark
        [\lnot\alpha, F, label=right:\checkmark
            [\phi, F
              [\alpha, F, close ]
                [\beta, F, close ]
                [\phi, close ]


tableau with Forest

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.