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.

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 :

 |\
 |\
/|
share|improve this question

1 Answer 1

up vote 4 down vote accepted

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

share|improve this answer
    
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 at 17:48
1  
@BonyHoax, This one is easy, use {[compl]}. –  Ignasi Mar 24 at 17:50

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.