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'd like to align all leaves of a tree at the bottom, so what I'd like to achieve should look like:

    p
   / \
  /  /\
 c  d  e

What I've tried so far (using tikz-qtree) results in:

    p
   / \
  c  /\
    d  e

I'm currently using tikz-qtree, but if there's an alternative better suited to the task, feel free to suggest one ;) Sidenote: I'm actually not labeling nodes, but edges.

Code:

\documentclass[12pt]{article}
\usepackage[active,pdftex,tightpage]{preview}
\usepackage{tikz-qtree}
\PreviewEnvironment[]{tikzpicture}
\begin{document}
\begin{tikzpicture}[every tree node/.style={draw,circle},sibling distance=10pt,
edge from parent path={(\tikzparentnode) -- (\tikzchildnode)}]
\tikzstyle{every node}=[font=\tiny, sloped,anchor=south,auto=false,inner sep=1pt]
\Tree
[.{}
    \edge node[]{C};
    [.{}
    ]
    \edge node[]{A};
    [.{}
        \edge node[]{D};
        [.{}
        ]
        \edge node[]{E};
        [.{}
        ]
    ]
]
\end{tikzpicture}
\end{document}
share|improve this question
1  
Welcome to TeX.SX! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Jubobs Jun 13 '13 at 9:44
    
Slightly related: qtree items do not have the same baseline –  Claudio Fiandrino Jun 13 '13 at 11:52
2  
A related question: How to draw syntactical trees with parallel leafs for a natural language? Will this question solve your problem? –  Alan Munn Jun 13 '13 at 12:12

1 Answer 1

This code generates what you need:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{trees}

\begin{document}
    \begin{figure}
        \begin{center}
        \tikzstyle{level 1}=[level distance=1.5cm, sibling distance=2.5cm]
        \tikzstyle{level 2}=[level distance=1.5cm, sibling distance=2.5cm]
        \tikzstyle{level 3}=[level distance=1.5cm, sibling distance=1cm]
        \tikzstyle{level 4}=[level distance=1.5cm, sibling distance=2cm]
            \begin{tikzpicture}
            \node {p}
                child{
                    child{
                        node(a){c}
                    } child{edge from parent[draw=none] }
                }
                child{
                    node{}
                    child{
                        node(b){d}
                    }
                    child{
                        node(c){e}
                    }
                };
            \end{tikzpicture}
        \end{center}
    \end{figure}
\end{document}

enter image description here

Credits to this page.

share|improve this answer

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.