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?
Best Answer
The problem is caused by the
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.)However, because of the way
tikz-qtree
draws its trees, you might prefer the tree to look that way, in which case Martin's solution will solve the problem. Here's a comparison of the same tree withtikz-qtree
loaded and not loaded: (The one withtikz-qtree
uses theshorten
solution on the path.)Without
tikz-qtree
With
tikz-qtree