4

Let's consider a really simple tree like the following :

\documentclass[12pt]{beamer}
\usepackage{qtree, tikz-qtree, tikz}
\begin{document}

\begin{frame}{Title}
\begin{tikzpicture}
\Tree 
    [.XP
    [.X ] [.compl ] ]   
\end{tikzpicture}
\end{frame}

\end{document}

In its natural form, it looks like two symetric branches /\ . How can I make it looks like |\ (or eventually the reverse, /|). In other words, given that I only use binary branches, how can I "tell my tree" to put a branch straight, and the other one oblic left of oblic right? I may eventually want to draw a tree like this :

 |\
 |\
/|
5

I don't know with qtree but with forest it's easy with options calign=first or calign=last.

\documentclass[12pt]{beamer}
%\usepackage{qtree, tikz-qtree, tikz}
\usepackage{forest}
\begin{document}

\begin{frame}{Title}
\begin{forest}
    [XP, for tree={calign=first}
    [X [a [A, calign=last [B] [D]] [B]] [b] [c]] [compl, calign=last [A] [B] ] ]   
\end{forest}
\end{frame}

\end{document}

enter image description here

  • Oh, I never heard of this package. It seems very powerful. Maybe I'll start using only it. One small thing though, how do you do to print the bracket symbol on the tree (I want my node to print [compl] instead of simply compl ? – BonyHoax Mar 24 '14 at 17:48
  • 1
    @BonyHoax, This one is easy, use {[compl]}. – Ignasi Mar 24 '14 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.