Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am currently taking a sentential logic class and we've just begun the chapter on truth-trees, so I've been looking into how to generate truth-trees with the qtree package. I think I've been able to get the syntax down for the tree itself, but was wondering if there was a way to put columns with aligned captions for each branch on either side of the tree.

Here's an idea of what I'm trying to accomplish:

http://i.imgur.com/7vF6A.png

Edit 1: The above image isn't actually the tree I created. Mine actually looks more like

generated tree

Here's my source code, from Lyx.

\documentclass[english]{article}
\usepackage[OT1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{qtree}

\makeatother

\usepackage{babel}
\begin{document}
$\mbox{\Tree[.A\&\ensuremath{\sim}B [.C [.\ensuremath{\sim}A\ensuremath{\vee\sim}C [.A [.\ensuremath{\sim}B [.\ensuremath{\sim}A \ensuremath{\otimes} ] [.\ensuremath{\sim}C \ensuremath{\otimes} ] ] ] ] ] ]}$
\end{document}

Edit 2: I've managed to get a little bit closer to what I want by using three trees in an eqnarray environment. The question I guess I'm asking now is whether or not there's a way to make branches in qtree invisible.

thirdtree

\documentclass[english]{article}
\usepackage[OT1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{qtree}

\makeatother

\usepackage{babel}
\begin{document}

\begin{eqnarray*}
\mbox{\Tree[.1.\\2.\\3.\\4.\\5. [.6. ] ]} & 
\mbox{\Tree[.A\&\ensuremath{\sim}B\\C\\\ensuremath{\sim}A\ensuremath{\vee\sim}C\\A\\\ensuremath{\sim}B [.\ensuremath{\sim}A\\\ensuremath{\otimes} ] [.\ensuremath{\sim}C\\\ensuremath{\otimes} ] ]} & 
\mbox{\Tree[.SM\\SM\\SM\\1,\&D\\1,\&D [.3,\ensuremath{\vee}D ] ]}
\end{eqnarray*}
\end{document}
share|improve this question
    
Can you show how you created your tree? –  Alan Munn May 12 '12 at 3:47

2 Answers 2

Although I'm not totally happy with this way of doing these trees, you can patch qtree so that the single branch tree produces no line. As long as you don't also need single branches, this will do what you want. I've made some other adjustments to your code: replacing \ensuremath{} with $...$ and just putting the trees into a simple tabular.

\documentclass{article}
\usepackage{etoolbox}
\usepackage{qtree}
\makeatletter
\patchcmd{\qdraw@branches}{(0,1)}{(0,.75)}{}{}
\patchcmd{\qdraw@branches}{\line(0,1){1}}{}{}{}
\makeatother
\begin{document}
\begin{tabular}{ccc}
\Tree[.{1.\\2.\\3.\\4.\\5.} [.6. ] ] &
\Tree[.A\&$\sim$B\\C\\$\sim$A$\vee\sim$C\\A\\$\sim$B {$\sim$A\\$\otimes$} $\sim$C\\$\otimes$  ] &
\Tree[.SM\\SM\\SM\\1,\&D\\1,\&D [.3,$\vee$D ] ]
\end{tabular}
\end{document}

output of code

share|improve this answer

Here is another way to achieve the same result.

\documentclass[12pt]{article}
\usepackage{tikz} % for trees
\usepackage{tikz-qtree}

\begin{document}

\begin{tikzpicture}[sibling distance=.5cm]
\begin{scope}[xshift=-1.5in] %Column #1 For Numbering
\tikzset{level distance=3.5em}
\tikzset{edge from parent/.style={edge from parent path={(\tikzparentnode\tikzparentanchor) -- (\tikzchildnode\tikzchildanchor)}},every tree node/.style={text width=5em,align=center,anchor=south}}
\Tree [.1\\2\\3\\4\\5 [.6 ] ]
\end{scope}

\begin{scope} %Column #2 For Tree
\tikzset{level distance=5em}
\tikzset{every tree node/.style={align=center,anchor=south}}
    \Tree 
    [.A\&$\sim$B\\C\\$\sim$A$\vee\sim$C\\A\\$\sim$B $\sim$A\\$\otimes$ $\sim$C\\$\otimes$  ]  
\end{scope}

\begin{scope}[xshift=1.5in] %Column #3 For Justification
\tikzset{level distance=3.5em}
\tikzset{edge from parent/.style={edge from parent path={(\tikzparentnode\tikzparentanchor) -- (\tikzchildnode\tikzchildanchor)}},every tree node/.style={text width=5em,align=center,anchor=south}}
\Tree [.SM\\SM\\SM\\1,\&D\\1,\&D
        [.3,$\vee$D
         ] ]
\end{scope}

\end{tikzpicture}
\end{document}

The problem I have with this is that it doesn't generalize since the level distances need to be specified and coordinated.

share|improve this answer
    
Welcome to TeX.SX! –  Papiro Jun 11 '13 at 20:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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