[Tex/LaTex] Lining up edges of a tree with TikZ

tikz-pgftrees

I'm drawing trees with TikZ and

\begin{tikzpicture}
    \node {$C$}
        child[missing]
 child{node {$i$}
 child[missing]
 child{node {$j$}}
    };
\end{tikzpicture}

produces edges that don't line up as I want them to. If I were to draw circles around the nodes, an edge goes from the bottom center of the parent's circle to the top center of the child's, making the arm appear jagged. I've tried moving the anchors around, but that wasn't it. What I want seems to occur automatically in the examples in the pgf manual (see the final tree example on page 192). What am I not doing?

Best Answer

Not quite sure what's going on here. Have you altered the default parent and child anchors?

Here are 3 examples:

\begin{tikzpicture}[parent anchor=south,child anchor=north,every  node/.style={circle,draw}]
\node {$C1$}
    child[missing]
    child{node {$i$}
        child[missing]
        child{node {$j$}}
        };
\end{tikzpicture}
\begin{tikzpicture}[parent anchor=center,child anchor=center,every  node/.style={circle,draw}]
\node {$C2$}
    child[missing]
    child{node {$i$}
        child[missing]
        child{node {$j$}}
        };
\end{tikzpicture}
\begin{tikzpicture}[every node/.style={circle,draw}]
\node {$C3$}
    child[missing]
    child{node {$i$}
        child[missing]
        child{node {$j$}}
        };
\end{tikzpicture}

which produce:

Three trees

Now, your example (my C3) appears to be the best; is it C1 you're looking for?

Related Question