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 trying to draw a tree that has internal nodes with only one child, but which must be oriented.

    /
    \
    /\
      \
      /\

Instead of the typical qtree where said children just "hang":

    |
    |
   / \
      |
      |
     / \

I think (but I do not know how) it might be possible to have invisible leaves to force the direction, but perhaps (hopefully) there is a better solution? This can be in either qtree or tikz-qtree...

EDIT: follow-up question that would be useful, how can make each branch (in a straight line) distinct when the nodes are not labeled -- i.e., when the tree is has several connections in a row, like in the second example, how can I make them slightly spaced from one another so they do not form a straight undistinguishable line?

EDIT 2: thanks your response, I now have these two trees:

  \documentclass[tikz]{standalone}
  \usepackage{tikz-qtree}
  \begin{document}
  \begin{tikzpicture}\footnotesize
    \Tree [ \edge node[midway,left] {000};
          [ \edge[draw=none]; {} \edge node[midway,right] {111};
            [
            \edge node[midway,left] {0}; $U_2$
            \edge node[midway,right] {11};
            [ \edge[draw=none]; {} \edge node[midway,right] {11};
            [ \edge node[midway,left] {0}; $U_1$
                \edge node[midway,right] {1}; $U_3$ ] ] ] ]
          \edge[draw=none]; {}  ]
  \end{tikzpicture}
  \begin{tikzpicture}\footnotesize
    \Tree [ \edge node[midway,right] {$U_1=U_2$, $U_1=U_3$};
          [.. \edge node[midway,right] {$U_1=U_2$, $U_1=U_3$};
          [ \edge node[midway,left] {$0$}; $U_2$ 
              \edge node[midway,right] {$U_1\not=U_2$, $U_1 = U_3$}; [
                  \edge node[midway, right] {$U_1 = U_3$}; 
                  [ \edge node[midway, left] {$0$}; $U_1$
                      \edge node[midway, right] {$U_1\not=U_3$}; $U_3$ ] ] ] ] ]
  \end{tikzpicture}
  \end{document}

Any idea on how to make them look better?

share|improve this question
    
Could you clarify your latest edit and post a minimal working example (MWE)? –  Qrrbrbirlbel Apr 10 '13 at 3:50

2 Answers 2

You can also use xshift (and yshift) to fine-tune where you want your nodes to be.

\documentclass[tikz]{standalone}
\usepackage{tikz-qtree}
\begin{document}
\begin{tikzpicture}\footnotesize
  \Tree [.{a}
      \edge node[midway,left] {1};
      [.\node[xshift=0.5cm,inner sep=0pt,minimum size=0pt] {}; \edge node[midway,left] {2}; {c} ]
  ]
\end{tikzpicture}
share|improve this answer

Use an empty node {} and place an \edge[draw=none]; in front of it.

Code

\documentclass[tikz]{standalone}
\usepackage{tikz-qtree}
\tikzset{
    n/.style={draw=none},
    every node/.append style={inner ysep=+0pt,outer ysep=+0pt,minimum size=+0pt}
}
\begin{document}
\Tree
    [.{}
        [.{} 
            \edge[n];[.{} ]
            [.{}
                {} 
                [.{}
                    \edge[n];[.{} ]
                    [.{} 
                        {} 
                        {} 
                    ]
                ]
            ]
        ]
        \edge[n];{} 
    ]
\end{document}

Output (without and with every node style activated)

enter image description here enter image description here

share|improve this answer
    
Thank you. But such a tree looks a bit disjointed? –  Jérémie Apr 10 '13 at 3:59
    
@Jérémie Well, if you really do not write anything in the nodes, then yes, they won’t connect, but this can be forced with the given every node style. (See updated answer.) –  Qrrbrbirlbel Apr 10 '13 at 4:10

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.