Skip to content
/ TikZ probability tree

TikZ probability tree

Give the events of each level and the branch probabilities: the assistant draws the weighted tree and writes the TikZ code. The last branch of each node can be completed automatically (1 − …), and each outcome's probability shown at the end.

Your work is saved automatically in this browser.

How to use it

  • Each tab produces a piece of code to paste into your document. The “Preamble” line lists the \usepackage lines to add (once, before \begin{document}).
  • Copy full document gives a file ready to compile (pdfLaTeX, XeLaTeX or LuaLaTeX); Open in Overleaf compiles it online without installing anything (the document is then sent to Overleaf).
  • Previews are drawn by the tool: they show the general look, but only the compiled PDF is authoritative.
  • Each tab's work is kept in this browser; Save project creates a .json file to continue elsewhere.
  • Formula input help: in variation tables, tables, trees, matrices and formulas, a bar appears under the active field with fractions, roots, powers, subscripts, absolute values, ±∞, π, ≤, ≥, ℝ, Greek letters, etc. Selected text goes into the formula (the numerator for a fraction), and in a table cell the formula is wrapped in $…$. The ✕ hides the bar; a small √x button brings it back.
  • Send to the LaTeX editor inserts the code at the cursor in the LaTeX editor if it is open in another tab (missing packages are added to the preamble); otherwise it opens a new full document in the editor.

Frequently asked questions

Why don't my table colours show?

Load \usepackage[table]{xcolor} (with the table option) and the \definecolor lines shown under the code. If another package already loads xcolor, put this line before it or use \PassOptionsToPackage{table}{xcolor}.

The variation table does not compile

Check that \usepackage{tkz-tab} is present (it loads TikZ) and that every value is valid math-mode LaTeX. The package ships with TeX Live, MiKTeX and Overleaf.

How do I type a function in the TikZ module?

As on a calculator: x^2-3*x+1, 2x+1, exp(-x), ln(x), sqrt(x), sin(x) (radians), abs(x), pi. The tool translates it for TikZ (TikZ trigonometric functions work in degrees).

How to do it

  1. Start from an example or write the events of each level, separated by commas (A, \conj{A}); if needed, give a node its own follow-up or stop it.
  2. Enter the branch probabilities: fractions, decimals or letters (p, 1-p).
  3. Choose the direction (right or down), branch length and spacing between outcomes.
  4. Copy the TikZ code.

Tips

Frequently asked questions

Must every node have the same branches?

No: by default, a level's nodes get the next level's events, but “Different follow-ups depending on the node” gives a node its own list (3 branches under A, 2 under the other, different events) or stops it before the last level, for example for draws until the first red ball. “+ Level” adds a level, up to 4.

Are outcome probabilities computed?

Yes when the branch probabilities are numbers: product of the probabilities along the path, written at the end of each outcome with the notation P(A ∩ B) or ℙ(A ∩ B).

How do I use it in my document?

“Copy code” gives the code to paste; the preamble lines it needs are listed below. “Send to the LaTeX editor” inserts it at the cursor in the Otoolia LaTeX editor, with the preamble completed; “Open in Overleaf” creates a project.

Do I need an account or an install?

No: the assistant runs in your browser, without sign-up. Your work is saved automatically on your device and can be saved as a .json file.