[Tex/LaTex] [Tikz-]Qtree: force direction of single child to left or right

nodestikz-pgftikz-qtreetikz-treestrees

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?

Best 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

Related Question