1

This is what I have so far. The vertical dots go beyond the two edges. I want them to end before they reach them.

\documentclass[fleqn]{article}

\usepackage{amsmath,amsthm,amssymb,amsfonts}
\usepackage{tikz}
\usepackage{cancel}
\usepackage{color}
\usepackage{polynom}
\usepackage{graphicx}
\usepackage{fouriernc}
\usepackage[T1]{fontenc}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{listing}
\usepackage{qtree}% For drawing trees.
\usepackage{pstricks,pst-node,pst-tree,pstricks-add}%This might be better.
\title{Trees}

\author{G}

\date{\today}

\begin{document}
\maketitle
{\pstree[treemode=R,levelsep=3.5]{\Tdot*[name=A] \taput{$\emptyset$}}{
\pstree[treemode=R, levelsep=3.5]{\Tdot*[name=B]\taput{$p_{1}$}}{%
  {\pstree[treemode=R,levelsep=3.5]{\Tdot*[name=C]\taput{$p_{1}$}}% %
        {\Tdot*[name=D]~{\dots}\taput{$p_{1}$} \Tdot*[name=E]~{\dots}\tbput{$p_{2}$}}}
  {\pstree[treemode=R,levelsep=3.5]{\Tdot*[name=F]\tbput{$p_{2}$}}% %
        {\Tdot*[name=G]~{\dots}\taput{$p_{1}$} \Tdot*[name=H]~{\dots}\tbput{$p_{2}$}}}}
\pstree[treemode=R, levelsep=3.5]{\Tdot*[name=I]\tbput{$p_{2}$}}{%\vdots
  {\pstree[treemode=R,levelsep=3.5]{\Tdot*[name=J]\taput{$p_{1}$}}% %
        {\Tdot*[name=K]~{\dots}\taput{$p_{1}$} \Tdot*[name=L]~{\dots}\tbput{$p_{2}$}}}
  {\pstree[treemode=R,levelsep=3.5]{\Tdot*[name=M]\tbput{$p_{2}$}}% %
        {\Tdot*[name=N]~{\dots}\taput{$p_{1}$} \Tdot*[name=P]~{\dots}\tbput{$p_{2}$}}}}
}}
\ncline[linestyle=dotted,nodesep=1.5mm,offset=1cm]{I}{B}

\end{document}
2

Here is a way. I removed unnecessary packages. Note it doesn't produce any result with pdflatex and auto-pst-pdf, but works with xelatex and, of course with latex:

\documentclass[fleqn]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, amssymb,amsfonts}
\usepackage{fouriernc}
\usepackage[T1]{fontenc}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{pst-tree,pstricks-add}%This might be better.
\title{Trees}

\author{G}

\date{\today}
\pagestyle{empty}

\begin{document}

\maketitle
\clearpage
\psset{treemode=R, levelsep=3.5}
\pstree{\Tdot*[name=A] \taput{$\varnothing$}}{%
    \pstree{\Tdot*[name=B]\taput{$p_{1}$}\ncput[npos=0.7]{\rnode{X}{}}}{%
        {\pstree{\Tdot*[name=C]\taput{$p_{1}$}}% %
            {\Tdot*[name=D]~{$ \cdots $}\taput{$p_{1}$} \Tdot*[name=E]~{$ \cdots $}\tbput{$p_{2}$}}}
        {\pstree{\Tdot*[name=F]\tbput{$p_{2}$}}% %
            {\Tdot*[name=G]~{$ \cdots $}\taput{$p_{1}$} \Tdot*[name=H]~{$ \cdots $}\tbput{$p_{2}$}}}}
    \pstree{\Tdot*[name=I]\tbput{$p_{2}$} \ncput[npos=0.7]{\rnode{Y}{}}}{%\vdots
        {\pstree{\Tdot*[name=J]\taput{$p_{1}$}}% %
            {\Tdot*[name=K]~{$ \cdots $}\taput{$p_{1}$} \Tdot*[name=L]~{$ \cdots $}\tbput{$p_{2}$}}}
        {\pstree{\Tdot*[name=M]\tbput{$p_{2}$}}% %
            {\Tdot*[name=N]~{$ \cdots $}\taput{$p_{1}$} \Tdot*[name=P]~{$ \cdots $}\tbput{$p_{2}$}}}}
}
\ncline[linestyle=dotted,nodesep=2pt]{X}{Y}%

\end{document} 

enter image description here

1

Just for fun, here's a forest version. Note that the actual tree specification is very concise:

  [
    [, tikz={
        \draw [dotted] ($()!1/3!(!u)$) -- ($(!s)!1/3!(!u)$);
      }
      [[][]]
      [[][]]
    ]
    [
      [[][]]
      [[][]]
    ]
  ]

The tikz bit is responsible for drawing the vertical dotted line.

Everything else is done in the specification of the style, including the setting of the labels, the customisation of nodes and spacing and the addition of the dots on the right.

Code:

\documentclass[tikz,border=10pt,multi]{standalone}
\usepackage{forest,amssymb}
\usetikzlibrary{calc}
\begin{document}
\begin{forest}
  for tree={
    grow=0,
    inner sep=0pt,
    minimum width=2.5pt,
    fill,
    draw,
    circle,
    s sep+=5pt,
    l+=15pt,
    if level=0{
      label={[font=\scriptsize]above:$\varnothing$}
    }{
      if n=1{
        edge label={node [below, midway, font=\scriptsize] {$p_2$} }
      }{
        edge label={node [above, midway, font=\scriptsize] {$p_1$} }
      }
    },
    if n children=0{
      append={[, l-=25pt, edge={dotted}]}
    }{}
  }
  [
    [, tikz={
        \draw [dotted] ($()!1/3!(!u)$) -- ($(!s)!1/3!(!u)$);
      }
      [[][]]
      [[][]]
    ]
    [
      [[][]]
      [[][]]
    ]
  ]
\end{forest}
\end{document}

Result:

auto-dots

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.