# Creating a specific kind of tree diagram

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:

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.

• You could use forest or tikz-tree. For a forest solution check this question: tex.stackexchange.com/questions/289642/… Or use prooftree: tex.stackexchange.com/questions/289268/… Sep 22, 2017 at 19:03
• I've drawn one of these in an answer before. Not in either of the threads @jaytar linked, though. I don't see how the second one is supposed to help at all. Anyway, it is prooftrees and not prooftree. If you really want to avoid TikZ, all of these options are out anyway. In that case, the only tree-drawing packages I know of are pstricks or qtree. I wouldn't try to use qtree for this. I don't know much about pstricks, but I'm sure you can use it if you wish. Like TikZ, it is powerful and flexible.
– cfr
Sep 22, 2017 at 22:40
• There's a better example somewhere, I think. Logic is really not well supported by LaTeX. It is just supported worse by everything else I've seen.
– cfr
Sep 22, 2017 at 23:10

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.

\documentclass[border=10pt]{standalone}
\usepackage{amssymb}
\usepackage[edges]{forest}
\newcommand*{\lif}{\ensuremath{\mathbin{\rightarrow}}}
\begin{document}
\forestset{
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}}{
if={
>O_< {!u.n children}{2}%
}{l'=\baselineskip}{},
},
where n children=0{if T={child anchor=south east}{child anchor=south west}}{},
}
},
close/.style={
if n=1{label={[label distance=0pt, anchor=north]-135:\textsf{x}}}{label={[label distance=0pt, anchor=north]-45:\textsf{x}}},
},
}
\begin{forest}
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
[\alpha
[\phi, F
[\alpha, F, close ]
[\beta
[\beta, F, close ]
[\phi, close ]
]
]
]
]
]
]
]
\end{forest}

\end{document}