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}
\abs{x}
becomes\bigabs{\frac{x}{2}}
becomes
Bigger Brackets
\newcommand{\bigbracket}[1]{\Bigl [ #1 \Bigr ]}
\bigbracket{\frac{1}{2} x^2}_{x=0}^{x=1}
becomes
Bigger Parentheses
\newcommand{\bigparen}[1]{\Bigl ( #1 \Bigr )}
\bigparen{1 + \frac{1}{n}}^n
becomes
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}
\ceil{\log_2 n}
becomes\bigfloor{\frac{n}{2}}
becomes
Norms
\newcommand{\norm}[1]{\ #1 \}
\newcommand{\bignorm}[1]{\Bigl \ #1 \Bigr \ #1}
\norm{x}_2^2
becomes\bignorm{(X^T X)^{1} X^T y}
becomes
Inner Product
\newcommand{\inner}[1]{\langle #1 \rangle}
\inner{u, v}
becomes
Sets
\newcommand{\set}[1]{\{ #1 \}}
\set{0, 1}^n
becomes
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
\overline
or\complement
$P(\overline{A})$
becomes$P(A^\complement)$
becomes
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
 Like found in binomial distribution formula
binom{n}{k}
becomes
P(X = k) = \binom{n}{k} p^k (1p)^{nk}
becomes
Fancy Expectation
\mathbb{E}
 Need the
amssymb
package.
$E[X]$ vs. $\mathbb{E}[X]$
 becomes vs .
 Use shortcut if you go with it
\newcommand{\E}{\mathbb{E}}
\mathbb
is also used for things like
 Real Numbers:
\mathbb{R}^n
becomes  Integers:
\mathbb{Z}^+
becomes
Fancy Normal
\mathcal{N}
 Needs the ‘amssymb’ package.
$X \sim N(0,1)$ vs. $X \sim \mathcal{N}(0, 1)$
 becomes vs.
 Use shortcut if you go with it
\newcommand{\N}{\mathcal{N}}
\mathcal
is also used for things like

The set of values an RV can take i.e.
\mathcal{X}
orE[X] = \sum_{x \in \mathcal{X}} x \cdot P(X = x)
becomes .
w.p.
\begin{equation}
X =
\begin{cases}
1 & \text{w.p. $p$} \\
0 & \text{w.p. $1p$}
\end{cases}
\end{equation}
 becomes
&
symbols are used to separate columns,\\
are used to make new lines