I am using TikZ to draw some trees in my thesis. This is a sample of what is being done:
\documentclass{article}
\usepackage{tikz-qtree}
\newcommand{\Ta}{
\begin{tikzpicture}[level distance=30pt, sibling distance=90pt]
\node {}
child {node {$p(x)$}
child{node {$skipped$} edge from parent[draw=none]}
}
child {node {$s(x)$}
child {node {$\sim s(x)$}
child{node {$closed$} edge from parent[draw=none]}
}
};
\end{tikzpicture}
}
\newcommand{\Tb}{
\begin{tikzpicture}[level distance=30pt, sibling distance=90pt]
\tikzstyle{level 2}=[level distance=30pt, sibling distance=80pt]
\node {}
child {node {$p(x)$}
child{node {$q(x)$}
child{node {$skipped$} edge from parent[draw=none]}
}
child{node {$\sim p(x)$}
child{node {$closed$} edge from parent[draw=none]}
}
}
child {node {$s(x)$}
child {node {$\sim s(x)$}
child{node {$closed$} edge from parent[draw=none]}}
};
\end{tikzpicture}
}
\newcommand{\Tc}{
\begin{tikzpicture}[level distance=30pt, sibling distance=90pt]
\tikzstyle{level 1}=[sibling distance=90pt]
\tikzstyle{level 2}=[sibling distance=80pt]
\tikzstyle{level 3}=[sibling distance=40pt]
\node {}
child {node (n1) {$p(x)$}
child{node {$q(x)$}
child{node (n2) {$\sim p(x)$}
child{node {$closed$} edge from parent[draw=none]}
}
child{node {$\sim q(x)$}
child{node {$closed$} edge from parent[draw=none]}
}
child{node {$ r(x)$}
child{node {$skipped$} edge from parent[draw=none]}
}
}
child{node {$\sim p(x)$}
child{node {$closed$} edge from parent[draw=none]}
}
}
child {node {$s(x)$}
child {node {$\sim s(x)$}
child{node {$closed$} edge from parent[draw=none]}}
};
\path[dashed, <->](n1)edge [bend right=45] node[above left]{reduction}(n2);
\end{tikzpicture}
}
\begin{document}
\pgfversion
\begin{figure}
\centering
\begin{minipage}{0.45\textwidth}
\centering\Ta
\caption{$Ta$}
\end{minipage}
\begin{minipage}{0.45\textwidth}
\centering\Tb
\caption{$Tb$}
\end{minipage}
\vspace{15pt}
\vspace{15pt}
\begin{minipage}{0.45\textwidth}
\centering\Tc
\caption{$Tc$}
\end{minipage}
\end{figure}
\end{document}
There is one little problem I cannot solve. The command:
\path[dashed,<->](n1)edge [bend right=45] node[above left]{reduction}(n2);
produces a line that is touching the bottom node, and this is a little annoying.
I tried different approaches but nothing seemed to work. Can anyone help me figure this out?
\pgfversion
after\begin{document}
in your file. Also note that it is helpful if you make your code examples full, compilable documents starting from\documentclass
so people who want to try out the code don't have to write the preamble themselves and guess at packages you might be loading.document
environment. Do you have some globaltikz
style settings? I also don't get the result. The solid lines e.g. fromq(x)
to~p(x)
is much shorter when I compile the above code.tikz-qtree
package. If you aren't using its methods for inputting trees, you shouldn't load it. (Another reason to make a minimal working example.)