Home

LaTeX Reference for Probability

Below are some common LaTeX commands I find myself using for probability classes.

Shortcuts

These are commands you would define in the preamble.

\documentclass{article}
\usepackage{amsmath}

% COMMANDS GO HERE

\begin{document}

Absolute Value

\newcommand{\abs}[1]{\lvert #1 \rvert}
\newcommand{\bigabs}[1]{\Bigl \lvert #1 \Bigr \rvert}

Bigger Brackets

\newcommand{\bigbracket}[1]{\Bigl [ #1 \Bigr ]}

Bigger Parentheses

\newcommand{\bigparen}[1]{\Bigl ( #1 \Bigr )}

Ceiling and Floor

\newcommand{\ceil}[1]{\lceil #1 \rceil}
\newcommand{\bigceil}[1]{\Bigl \lceil #1 \Bigr \rceil}
\newcommand{\floor}[1]{\lfloor #1 \rfloor}
\newcommand{\bigfloor}[1]{\Bigl \lfloor #1 \Bigr \rfloor}

Norms

\newcommand{\norm}[1]{\| #1 \|}
\newcommand{\bignorm}[1]{\Bigl \| #1 \Bigr \| #1}

Inner Product

\newcommand{\inner}[1]{\langle #1 \rangle}

Sets

\newcommand{\set}[1]{\{ #1 \}}

Style Files

To avoid defining these commands in the preamble of every document, you can make .sty file that contains these commands. For example, add this file eecs.sty to an Overleaf project and then add the following command in the preamble.

\documentclass[11pt]{article}
\usepackage[margin=1in]{geometry}

\usepackage{eecs}

\begin{document}

If you don’t use Overleaf, just make sure eecs.sty is in the same directory as your .tex file. You can also have it in a parent folder, and reference it like this

\usepackage{../eecs}

Sets / Probability

Intersection / Union

$P(A \cap B)$

becomes

$P(\cup_{i=1}^n A_i)$

becomes

Complement

Set Subtraction

$A^\complement = \Omega \setminus A$

becomes

Subset

$A \subset B$ or $A \subseteq B$

becomes or .

Conditional Probability

$P(A \mid B)$

becomes

Symbols in Distributions

Sim

The squiggly \sim i.e.

X_i \stackrel{iid}{\sim} U[0, 1]

becomes

Choose / nCr

P(X = k) = \binom{n}{k} p^k (1-p)^{n-k}

becomes

Fancy Expectation

$E[X]$ vs. $\mathbb{E}[X]$
\newcommand{\E}{\mathbb{E}}

\mathbb is also used for things like

Fancy Normal

$X \sim N(0,1)$ vs. $X \sim \mathcal{N}(0, 1)$
\newcommand{\N}{\mathcal{N}}

\mathcal is also used for things like

w.p.

\begin{equation}
  X =
  \begin{cases}
    1 & \text{w.p. $p$} \\
    0 & \text{w.p. $1-p$}
  \end{cases}
\end{equation}