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 have a binomial tree with arrows pointing backwards. I currently have short arrows pointing towards the left-most node (which is invisible). This first colum is taking up very little visual space, except it's pushing my tikz lattice to the right by a whole column's width.

How to fix?

     \documentclass{article}
    \usepackage{tikz}
    \usetikzlibrary{matrix,fit,backgrounds}

    \begin{document}



       \begin{tikzpicture}[>=stealth,sloped]
          \matrix (tree) [%
            matrix of nodes,
            minimum size=1cm,
            column sep=2.7cm,
            row sep=0.4cm,
          column 4/.style={nodes={draw,fill=cyan!30,rounded corners}},
          ]
          {
          &                    &                                               &  $^\tau S_0$     \\
          &                    &  $R^{-1}(p (_\tau S_0) + (1-p) (_\tau S_2))$  &              \\
          & ...                &                                               &  $^\tau S_1$     \\
    $  $   &                    &  $R^{-1}(p (_\tau S_1) + (1-p) (_\tau S_2))$  &              \\
          & ...                &                                               &  $^\tau S_2$     \\
          &                    &  $R^{-1}(p (_\tau S_2) + (1-p) (_\tau S_3))$  &              \\
          &                    &                                               &  $^\tau S_3$     \\
          };
          \draw[<-,shorten <=2cm,double,double distance=1pt] (tree-4-1) -- (tree-3-2) node [midway,above] {};
          \draw[<-,shorten <=2cm,double,double distance=1pt] (tree-4-1) -- (tree-5-2) node [midway,above] {};

          \draw[<-,double,double distance=1pt] (tree-3-2) -- (tree-2-3) node [midway,above] {};
          \draw[<-,double,double distance=1pt] (tree-3-2) -- (tree-4-3) node [midway,below] {};
          \draw[<-,double,double distance=1pt] (tree-5-2) -- (tree-4-3) node [midway,above] {};
          \draw[<-,double,double distance=1pt] (tree-5-2) -- (tree-6-3) node [midway,below] {};
          \draw[<-,double,double distance=1pt] (tree-2-3) -- (tree-1-4) node [midway,above] {};
          \draw[<-,double,double distance=1pt] (tree-2-3) -- (tree-3-4) node [midway,below] {};
          \draw[<-,double,double distance=1pt] (tree-4-3) -- (tree-3-4) node [midway,above] {};
          \draw[<-,double,double distance=1pt] (tree-4-3) -- (tree-5-4) node [midway,below] {};
          \draw[<-,double,double distance=1pt] (tree-6-3) -- (tree-5-4) node [midway,above] {};
          \draw[<-,double,double distance=1pt] (tree-6-3) -- (tree-7-4) node [midway,below] {};

        \end{tikzpicture}

    \end{document}
share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

Your column sep option is valid for the first column too. So you need to override it. Also if all of your nodes involve math operators you can simply use the matrix of math nodes such that you don't need to use $ signs for the entries.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix,fit,backgrounds}

\begin{document}



   \begin{tikzpicture}[>=stealth,sloped,mypath/.style={<-,double,double distance=1pt}]
      \matrix (tree) [%
        matrix of nodes,
        minimum size=1cm,
        column sep=2.7cm,
        row sep=0.4cm,
      column 4/.style={nodes={draw,fill=cyan!30,rounded corners}},
      column 1/.style={nodes={minimum size=3mm,inner sep=1pt,outer sep=0},column sep=3mm},
      ]
      {
      &                    &                                               &$^\tau S_0$     \\
      &                    &  $R^{-1}(p (_\tau S_0) + (1-p) (_\tau S_2))$  &              \\
      & ...                &                                               &  $^\tau S_1$     \\
$  $  &                    &  $R^{-1}(p (_\tau S_1) + (1-p) (_\tau S_2))$  &              \\
      & ...                &                                               &  $^\tau S_2$     \\
      &                    &  $R^{-1}(p (_\tau S_2) + (1-p) (_\tau S_3))$  &              \\
      &                    &                                               &  $^\tau S_3$     \\
      };
      \draw[mypath,shorten <=2mm] (tree-4-1) -- (tree-3-2) node [midway,above] {};
      \draw[mypath,shorten <=2mm] (tree-4-1) -- (tree-5-2) node [midway,above] {};

      \draw[mypath] (tree-3-2) -- (tree-2-3) node [midway,above] {};
      \draw[mypath] (tree-3-2) -- (tree-4-3) node [midway,below] {};
      \draw[mypath] (tree-5-2) -- (tree-4-3) node [midway,above] {};
      \draw[mypath] (tree-5-2) -- (tree-6-3) node [midway,below] {};
      \draw[mypath] (tree-2-3) -- (tree-1-4) node [midway,above] {};
      \draw[mypath] (tree-2-3) -- (tree-3-4) node [midway,below] {};
      \draw[mypath] (tree-4-3) -- (tree-3-4) node [midway,above] {};
      \draw[mypath] (tree-4-3) -- (tree-5-4) node [midway,below] {};
      \draw[mypath] (tree-6-3) -- (tree-5-4) node [midway,above] {};
      \draw[mypath] (tree-6-3) -- (tree-7-4) node [midway,below] {};

    \end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.