Graphics, Figures & TablesDraw Binomial option pricing tree/lattice

Information and discussion about graphics, figures & tables in LaTeX documents.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Draw Binomial option pricing tree/lattice

Post by Stefan Kottwitz »

Hi feanor,

you need to replace the ampersand with beamer, as stated in the TikZ manual.

Working code:

Code: Select all

\documentclass[xcolor=pdflatex,dvipsnames,table]{beamer}
\usepackage{tikz}
\usetikzlibrary{matrix}
\mode<presentation>
\usetheme{JuanLesPins}
\setbeamercovered{transparent=30}
\title[Investment Science ]{ Investment Science  \\  Introduction to Binomial Trees }
\author[ Anonymous]
{ Investment Science}
\institute{ Blah University }
\date{today}
\begin{document}
\frame{\maketitle}
\begin{frame}
  \begin{tikzpicture}[>=stealth,sloped]
    \matrix (tree) [%
      matrix of nodes,
      minimum size=1cm,
      column sep=3.5cm,
      row sep=1cm,
      ampersand replacement=\&
    ]
    {
          \&   \& F \\
          \& C \&   \\
      \$A \&   \& E \\
          \& B \&   \\
          \&   \& D \\
    };
    \draw[->] (tree-3-1) -- (tree-2-2) node [midway,above] {$p$};
    \draw[->] (tree-3-1) -- (tree-4-2) node [midway,below] {$(1-p)$};
    \draw[->] (tree-2-2) -- (tree-1-3) node [midway,above] {$p^2$};
    \draw[->] (tree-2-2) -- (tree-3-3) node [midway,below] {$(1-p)p$};
    \draw[->] (tree-4-2) -- (tree-3-3) node [midway,above] {$(1-p)p$};
    \draw[->] (tree-4-2) -- (tree-5-3) node [midway,below] {$(1-p)^2$};
  \end{tikzpicture}
  \end{frame}
\end{document}
LaTeX.org admin

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply