Last active
December 20, 2025 02:41
-
-
Save chrisyeh96/42583c21be85e52dc088af9da7eb7bc9 to your computer and use it in GitHub Desktop.
LaTeX Macros
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % domains | |
| \newcommand{\C}{\mathbb{C}} % complex numbers | |
| \newcommand{\N}{\mathbb{N}} % natural numbers | |
| \newcommand{\Q}{\mathbb{Q}} % rational numbers | |
| \newcommand{\R}{\mathbb{R}} % real numbers | |
| \newcommand{\Z}{\mathbb{Z}} % integers | |
| \newcommand{\Sym}{\mathbb{S}} % symmetric, real matrices | |
| % general macros | |
| \newcommand{\abs}[1]{\left\lvert#1\right\rvert} % absolute value | |
| \newcommand{\Borel}{{\mathcal{B}}} % Borel sets | |
| \newcommand{\ceil}[1]{\left\lceil #1 \right\rceil} % ceiling | |
| \newcommand{\diff}{\mathop{}\!\mathrm{d}} % differential | |
| \newcommand{\deriv}[3][]{\frac{\mathrm{d}^{#1}#2}{\mathrm{d} #3^{#1}}} % derivative | |
| \newcommand{\floor}[1]{\left\lfloor #1 \right\rfloor} % floor | |
| \newcommand{\iid}{\stackrel{\mathrm{iid}}{\sim}} % iid | |
| \newcommand{\indep}{{\perp\!\!\!\perp}} % independent | |
| \newcommand{\inner}[2]{\left\langle#1,\ #2\right\rangle} % inner product | |
| \newcommand{\norm}[1]{\left\lVert#1\right\rVert} % norm | |
| \newcommand{\one}{\mathbf{1}} % ones vector | |
| \newcommand{\pderiv}[3][]{\frac{\partial^{#1}#2}{\partial #3^{#1}}} % partial derivative | |
| \newcommand{\powerset}{{\mathscr{P}}} % powerset | |
| \newcommand{\set}[1]{\left\{#1\right\}} % set | |
| \newcommand{\stodom}{\succeq_s} % stochastic domination | |
| \newcommand{\weakconv}{\rightsquigarrow} % weak convergence | |
| \newcommand{\zero}{\mathbf{0}} % zeros vector | |
| % operators | |
| \DeclareMathOperator*{\argmax}{arg\,max} | |
| \DeclareMathOperator*{\argmin}{arg\,min} | |
| \DeclareMathOperator{\algebra}{algebra} % algebra | |
| \DeclareMathOperator{\closure}{cl} % closure | |
| \DeclareMathOperator{\conv}{conv} % convex hull | |
| \DeclareMathOperator{\Cov}{Cov} % covariance | |
| \DeclareMathOperator{\diag}{diag} % diagonal | |
| \DeclareMathOperator{\diam}{diam} % diameter | |
| \DeclareMathOperator{\dist}{dist} % distance | |
| \DeclareMathOperator{\dom}{dom} % domain | |
| \DeclareMathOperator{\E}{\mathbb{E}} % expectation | |
| \DeclareMathOperator{\epi}{epi} % epigraph | |
| \DeclareMathOperator{\extreme}{extreme} % extreme point | |
| \DeclareMathOperator{\interior}{int} % interior | |
| \DeclareMathOperator{\nullspace}{null} % nullspace | |
| \DeclareMathOperator{\range}{range} % range | |
| \DeclareMathOperator{\rank}{rank} % rank | |
| \DeclareMathOperator{\softmax}{softmax} % softmax | |
| \DeclareMathOperator{\softplus}{softplus} % softplus | |
| \DeclareMathOperator{\spanset}{span} % span | |
| \DeclareMathOperator{\tr}{tr} % trace | |
| \DeclareMathOperator{\Var}{Var} % variance | |
| % requires mathtools package: | |
| % \usepackage{mathtools} | |
| \DeclarePairedDelimiterX{\infdivx}[2]{(}{)}{% | |
| #1\;\delimsize\|\;#2% | |
| } | |
| \newcommand{\KL}{\text{KL}\infdivx} % KL divergence | |
| % distributions | |
| \DeclareMathOperator{\Bernoulli}{Bernoulli} | |
| \DeclareMathOperator{\Beta}{Beta} | |
| \DeclareMathOperator{\Binomial}{Binomial} | |
| \DeclareMathOperator{\Categorical}{Categorical} | |
| \newcommand{\ChiSq}[1]{\chi^2_{#1}} % chi-squared, use as \ChiSq{k} | |
| \DeclareMathOperator{\Exponential}{Exponential} | |
| \DeclareMathOperator{\GammaDist}{Gamma} | |
| \DeclareMathOperator{\Gaussian}{\mathcal{N}} % Gaussian | |
| \DeclareMathOperator{\GP}{\mathcal{GP}} % Gaussian process | |
| \DeclareMathOperator{\Lognormal}{Lognormal} | |
| \DeclareMathOperator{\Multinomial}{Multinomial} | |
| \DeclareMathOperator{\Poisson}{Poisson} | |
| \DeclareMathOperator{\Uniform}{Uniform} | |
| % caligraphic letters | |
| \newcommand{\Acal}{\mathcal{A}} | |
| \newcommand{\Bcal}{\mathcal{B}} | |
| \newcommand{\Ccal}{\mathcal{C}} | |
| \newcommand{\Dcal}{\mathcal{D}} | |
| \newcommand{\Ecal}{\mathcal{E}} | |
| \newcommand{\Fcal}{\mathcal{F}} | |
| \newcommand{\Gcal}{\mathcal{G}} | |
| \newcommand{\Hcal}{\mathcal{H}} | |
| \newcommand{\Ical}{\mathcal{I}} | |
| \newcommand{\Jcal}{\mathcal{J}} | |
| \newcommand{\Kcal}{\mathcal{K}} | |
| \newcommand{\Lcal}{\mathcal{L}} | |
| \newcommand{\Mcal}{\mathcal{M}} | |
| \newcommand{\Ncal}{\mathcal{N}} | |
| \newcommand{\Ocal}{\mathcal{O}} | |
| \newcommand{\Pcal}{\mathcal{P}} | |
| \newcommand{\Qcal}{\mathcal{Q}} | |
| \newcommand{\Rcal}{\mathcal{R}} | |
| \newcommand{\Scal}{\mathcal{S}} | |
| \newcommand{\Tcal}{\mathcal{T}} | |
| \newcommand{\Ucal}{\mathcal{U}} | |
| \newcommand{\Vcal}{\mathcal{V}} | |
| \newcommand{\Wcal}{\mathcal{W}} | |
| \newcommand{\Xcal}{\mathcal{X}} | |
| \newcommand{\Ycal}{\mathcal{Y}} | |
| \newcommand{\Zcal}{\mathcal{Z}} | |
| % bold letters | |
| \newcommand{\Abf}{\mathbf{A}} | |
| \newcommand{\Bbf}{\mathbf{B}} | |
| \newcommand{\Cbf}{\mathbf{C}} | |
| \newcommand{\Dbf}{\mathbf{D}} | |
| \newcommand{\Ebf}{\mathbf{E}} | |
| \newcommand{\Fbf}{\mathbf{F}} | |
| \newcommand{\Gbf}{\mathbf{G}} | |
| \newcommand{\Hbf}{\mathbf{H}} | |
| \newcommand{\Ibf}{\mathbf{I}} | |
| \newcommand{\Jbf}{\mathbf{J}} | |
| \newcommand{\Kbf}{\mathbf{K}} | |
| \newcommand{\Lbf}{\mathbf{L}} | |
| \newcommand{\Mbf}{\mathbf{M}} | |
| \newcommand{\Nbf}{\mathbf{N}} | |
| \newcommand{\Obf}{\mathbf{O}} | |
| \newcommand{\Pbf}{\mathbf{P}} | |
| \newcommand{\Qbf}{\mathbf{Q}} | |
| \newcommand{\Rbf}{\mathbf{R}} | |
| \newcommand{\Sbf}{\mathbf{S}} | |
| \newcommand{\Tbf}{\mathbf{T}} | |
| \newcommand{\Ubf}{\mathbf{U}} | |
| \newcommand{\Vbf}{\mathbf{V}} | |
| \newcommand{\Wbf}{\mathbf{W}} | |
| \newcommand{\Xbf}{\mathbf{X}} | |
| \newcommand{\Ybf}{\mathbf{Y}} | |
| \newcommand{\Zbf}{\mathbf{Z}} | |
| \newcommand{\abf}{\mathbf{a}} | |
| \newcommand{\bbf}{\mathbf{b}} | |
| \newcommand{\cbf}{\mathbf{c}} | |
| \newcommand{\dbf}{\mathbf{d}} | |
| \newcommand{\ebf}{\mathbf{e}} | |
| \newcommand{\fbf}{\mathbf{f}} | |
| \newcommand{\gbf}{\mathbf{g}} | |
| \newcommand{\hbf}{\mathbf{h}} | |
| \newcommand{\ibf}{\mathbf{i}} | |
| \newcommand{\jbf}{\mathbf{j}} | |
| \newcommand{\kbf}{\mathbf{k}} | |
| \newcommand{\lbf}{\mathbf{l}} | |
| \newcommand{\mbf}{\mathbf{m}} | |
| \newcommand{\nbf}{\mathbf{n}} | |
| \newcommand{\obf}{\mathbf{o}} | |
| \newcommand{\pbf}{\mathbf{p}} | |
| \newcommand{\qbf}{\mathbf{q}} | |
| \newcommand{\rbf}{\mathbf{r}} | |
| \newcommand{\sbf}{\mathbf{s}} | |
| \newcommand{\tbf}{\mathbf{t}} | |
| \newcommand{\ubf}{\mathbf{u}} | |
| \newcommand{\vbf}{\mathbf{v}} | |
| \newcommand{\wbf}{\mathbf{w}} | |
| \newcommand{\xbf}{\mathbf{x}} | |
| \newcommand{\ybf}{\mathbf{y}} | |
| \newcommand{\zbf}{\mathbf{z}} | |
| % blackbloard letters | |
| \newcommand{\Abb}{\mathbb{A}} | |
| % \newcommand{\Bbb}{\mathbb{B}} % this conflicts with existing \Bbb command | |
| \newcommand{\Cbb}{\mathbb{C}} | |
| \newcommand{\Dbb}{\mathbb{D}} | |
| \newcommand{\Ebb}{\mathbb{E}} | |
| \newcommand{\Fbb}{\mathbb{F}} | |
| \newcommand{\Gbb}{\mathbb{G}} | |
| \newcommand{\Hbb}{\mathbb{H}} | |
| \newcommand{\Ibb}{\mathbb{I}} | |
| \newcommand{\Jbb}{\mathbb{J}} | |
| \newcommand{\Kbb}{\mathbb{K}} | |
| \newcommand{\Lbb}{\mathbb{L}} | |
| \newcommand{\Mbb}{\mathbb{M}} | |
| \newcommand{\Nbb}{\mathbb{N}} | |
| \newcommand{\Obb}{\mathbb{O}} | |
| \newcommand{\Pbb}{\mathbb{P}} | |
| \newcommand{\Qbb}{\mathbb{Q}} | |
| \newcommand{\Rbb}{\mathbb{R}} | |
| \newcommand{\Sbb}{\mathbb{S}} | |
| \newcommand{\Tbb}{\mathbb{T}} | |
| \newcommand{\Ubb}{\mathbb{U}} | |
| \newcommand{\Vbb}{\mathbb{V}} | |
| \newcommand{\Wbb}{\mathbb{W}} | |
| \newcommand{\Xbb}{\mathbb{X}} | |
| \newcommand{\Ybb}{\mathbb{Y}} | |
| \newcommand{\Zbb}{\mathbb{Z}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment