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'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?

share|improve this question
1  
Could you please add a picture of what you are trying to achieve. –  Caramdir Sep 30 '10 at 22:55

1 Answer 1

up vote 4 down vote accepted

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?

share|improve this answer
    
I wanted C3, but was getting C1 with the same code. For whatever reason, deleting \usetikzlibrary{tikz-qtrees} (which I don't need--it was left from an earlier tree-drawing experiment) solves the problem. I assume it changes the anchors. –  hoyland Oct 2 '10 at 0:49

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.