Path: blob/main/a3/a3_latex/std_macros.tex
995 views
% version 1.2 05/21/081\newcommand\sa{\ensuremath{\mathcal{a}}}2\newcommand\sd{\ensuremath{\mathcal{d}}}3\newcommand\se{\ensuremath{\mathcal{e}}}4\newcommand\sg{\ensuremath{\mathcal{g}}}5\newcommand\sh{\ensuremath{\mathcal{h}}}6\newcommand\si{\ensuremath{\mathcal{i}}}7\newcommand\sj{\ensuremath{\mathcal{j}}}8\newcommand\sk{\ensuremath{\mathcal{k}}}9\newcommand\sm{\ensuremath{\mathcal{m}}}10\newcommand\sn{\ensuremath{\mathcal{n}}}11\newcommand\so{\ensuremath{\mathcal{o}}}12\newcommand\sq{\ensuremath{\mathcal{q}}}13\newcommand\sr{\ensuremath{\mathcal{r}}}14\newcommand\st{\ensuremath{\mathcal{t}}}15\newcommand\su{\ensuremath{\mathcal{u}}}16\newcommand\sv{\ensuremath{\mathcal{v}}}17\newcommand\sw{\ensuremath{\mathcal{w}}}18\newcommand\sx{\ensuremath{\mathcal{x}}}19\newcommand\sy{\ensuremath{\mathcal{y}}}20\newcommand\sz{\ensuremath{\mathcal{z}}}21\newcommand\sA{\ensuremath{\mathcal{A}}}22\newcommand\sB{\ensuremath{\mathcal{B}}}23\newcommand\sC{\ensuremath{\mathcal{C}}}24\newcommand\sD{\ensuremath{\mathcal{D}}}25\newcommand\sE{\ensuremath{\mathcal{E}}}26\newcommand\sF{\ensuremath{\mathcal{F}}}27\newcommand\sG{\ensuremath{\mathcal{G}}}28\newcommand\sH{\ensuremath{\mathcal{H}}}29\newcommand\sI{\ensuremath{\mathcal{I}}}30\newcommand\sJ{\ensuremath{\mathcal{J}}}31\newcommand\sK{\ensuremath{\mathcal{K}}}32\newcommand\sL{\ensuremath{\mathcal{L}}}33\newcommand\sM{\ensuremath{\mathcal{M}}}34\newcommand\sN{\ensuremath{\mathcal{N}}}35\newcommand\sO{\ensuremath{\mathcal{O}}}36\newcommand\sP{\ensuremath{\mathcal{P}}}37\newcommand\sQ{\ensuremath{\mathcal{Q}}}38\newcommand\sR{\ensuremath{\mathcal{R}}}39\newcommand\sS{\ensuremath{\mathcal{S}}}40\newcommand\sT{\ensuremath{\mathcal{T}}}41\newcommand\sU{\ensuremath{\mathcal{U}}}42\newcommand\sV{\ensuremath{\mathcal{V}}}43\newcommand\sW{\ensuremath{\mathcal{W}}}44\newcommand\sX{\ensuremath{\mathcal{X}}}45\newcommand\sY{\ensuremath{\mathcal{Y}}}46\newcommand\sZ{\ensuremath{\mathcal{Z}}}47\newcommand\ba{\ensuremath{\mathbf{a}}}48\newcommand\bb{\ensuremath{\mathbf{b}}}49\newcommand\bc{\ensuremath{\mathbf{c}}}50\newcommand\bd{\ensuremath{\mathbf{d}}}51\newcommand\be{\ensuremath{\mathbf{e}}}52\newcommand\bef{\ensuremath{\mathbf{f}}}53\newcommand\bg{\ensuremath{\mathbf{g}}}54\newcommand\bh{\ensuremath{\mathbf{h}}}55\newcommand\bi{\ensuremath{\mathbf{i}}}56\newcommand\bj{\ensuremath{\mathbf{j}}}57\newcommand\bk{\ensuremath{\mathbf{k}}}58\newcommand\bl{\ensuremath{\mathbf{l}}}59\newcommand\bm{\ensuremath{\mathbf{m}}}60\newcommand\bn{\ensuremath{\mathbf{n}}}61\newcommand\bo{\ensuremath{\mathbf{o}}}62\newcommand\bp{\ensuremath{\mathbf{p}}}63\newcommand\bq{\ensuremath{\mathbf{q}}}64\newcommand\br{\ensuremath{\mathbf{r}}}65\newcommand\bs{\ensuremath{\mathbf{s}}}66\newcommand\bt{\ensuremath{\mathbf{t}}}67\newcommand\bu{\ensuremath{\mathbf{u}}}68\newcommand\bv{\ensuremath{\mathbf{v}}}69\newcommand\bw{\ensuremath{\mathbf{w}}}70\newcommand\bx{\ensuremath{\mathbf{x}}}71\newcommand\by{\ensuremath{\mathbf{y}}}72\newcommand\bz{\ensuremath{\mathbf{z}}}73\newcommand\bA{\ensuremath{\mathbf{A}}}74\newcommand\bB{\ensuremath{\mathbf{B}}}75\newcommand\bC{\ensuremath{\mathbf{C}}}76\newcommand\bD{\ensuremath{\mathbf{D}}}77\newcommand\bE{\ensuremath{\mathbf{E}}}78\newcommand\bF{\ensuremath{\mathbf{F}}}79\newcommand\bG{\ensuremath{\mathbf{G}}}80\newcommand\bH{\ensuremath{\mathbf{H}}}81\newcommand\bI{\ensuremath{\mathbf{I}}}82\newcommand\bJ{\ensuremath{\mathbf{J}}}83\newcommand\bK{\ensuremath{\mathbf{K}}}84\newcommand\bL{\ensuremath{\mathbf{L}}}85\newcommand\bM{\ensuremath{\mathbf{M}}}86\newcommand\bN{\ensuremath{\mathbf{N}}}87\newcommand\bO{\ensuremath{\mathbf{O}}}88\newcommand\bP{\ensuremath{\mathbf{P}}}89\newcommand\bQ{\ensuremath{\mathbf{Q}}}90\newcommand\bR{\ensuremath{\mathbf{R}}}91\newcommand\bS{\ensuremath{\mathbf{S}}}92\newcommand\bT{\ensuremath{\mathbf{T}}}93\newcommand\bU{\ensuremath{\mathbf{U}}}94\newcommand\bV{\ensuremath{\mathbf{V}}}95\newcommand\bW{\ensuremath{\mathbf{W}}}96\newcommand\bX{\ensuremath{\mathbf{X}}}97\newcommand\bY{\ensuremath{\mathbf{Y}}}98\newcommand\bZ{\ensuremath{\mathbf{Z}}}99\newcommand\Ba{\ensuremath{\mathbb{a}}}100\newcommand\Bb{\ensuremath{\mathbb{b}}}101\newcommand\Bc{\ensuremath{\mathbb{c}}}102\newcommand\Bd{\ensuremath{\mathbb{d}}}103\newcommand\Be{\ensuremath{\mathbb{e}}}104\newcommand\Bf{\ensuremath{\mathbb{f}}}105\newcommand\Bg{\ensuremath{\mathbb{g}}}106\newcommand\Bh{\ensuremath{\mathbb{h}}}107\newcommand\Bi{\ensuremath{\mathbb{i}}}108\newcommand\Bj{\ensuremath{\mathbb{j}}}109\newcommand\Bk{\ensuremath{\mathbb{k}}}110\newcommand\Bl{\ensuremath{\mathbb{l}}}111\newcommand\Bm{\ensuremath{\mathbb{m}}}112\newcommand\Bn{\ensuremath{\mathbb{n}}}113\newcommand\Bo{\ensuremath{\mathbb{o}}}114\newcommand\Bp{\ensuremath{\mathbb{p}}}115\newcommand\Bq{\ensuremath{\mathbb{q}}}116\newcommand\Br{\ensuremath{\mathbb{r}}}117\newcommand\Bs{\ensuremath{\mathbb{s}}}118\newcommand\Bt{\ensuremath{\mathbb{t}}}119\newcommand\Bu{\ensuremath{\mathbb{u}}}120\newcommand\Bv{\ensuremath{\mathbb{v}}}121\newcommand\Bw{\ensuremath{\mathbb{w}}}122\newcommand\Bx{\ensuremath{\mathbb{x}}}123\newcommand\By{\ensuremath{\mathbb{y}}}124\newcommand\Bz{\ensuremath{\mathbb{z}}}125\newcommand\BA{\ensuremath{\mathbb{A}}}126\newcommand\BB{\ensuremath{\mathbb{B}}}127\newcommand\BC{\ensuremath{\mathbb{C}}}128\newcommand\BD{\ensuremath{\mathbb{D}}}129\newcommand\BE{\ensuremath{\mathbb{E}}}130\newcommand\BF{\ensuremath{\mathbb{F}}}131\newcommand\BG{\ensuremath{\mathbb{G}}}132\newcommand\BH{\ensuremath{\mathbb{H}}}133\newcommand\BI{\ensuremath{\mathbb{I}}}134\newcommand\BJ{\ensuremath{\mathbb{J}}}135\newcommand\BK{\ensuremath{\mathbb{K}}}136\newcommand\BL{\ensuremath{\mathbb{L}}}137\newcommand\BM{\ensuremath{\mathbb{M}}}138\newcommand\BN{\ensuremath{\mathbb{N}}}139\newcommand\BO{\ensuremath{\mathbb{O}}}140\newcommand\BP{\ensuremath{\mathbb{P}}}141\newcommand\BQ{\ensuremath{\mathbb{Q}}}142\newcommand\BR{\ensuremath{\mathbb{R}}}143\newcommand\BS{\ensuremath{\mathbb{S}}}144\newcommand\BT{\ensuremath{\mathbb{T}}}145\newcommand\BU{\ensuremath{\mathbb{U}}}146\newcommand\BV{\ensuremath{\mathbb{V}}}147\newcommand\BW{\ensuremath{\mathbb{W}}}148\newcommand\BX{\ensuremath{\mathbb{X}}}149\newcommand\BY{\ensuremath{\mathbb{Y}}}150\newcommand\BZ{\ensuremath{\mathbb{Z}}}151\newcommand\balpha{\ensuremath{\mbox{\boldmath$\alpha$}}}152\newcommand\bbeta{\ensuremath{\mbox{\boldmath$\beta$}}}153\newcommand\btheta{\ensuremath{\mbox{\boldmath$\theta$}}}154\newcommand\bphi{\ensuremath{\mbox{\boldmath$\phi$}}}155\newcommand\bpi{\ensuremath{\mbox{\boldmath$\pi$}}}156\newcommand\bpsi{\ensuremath{\mbox{\boldmath$\psi$}}}157\newcommand\bmu{\ensuremath{\mbox{\boldmath$\mu$}}}158% Basic159\newcommand\T{\text}160\newcommand\sign{\text{sign}}161\newcommand\tr{\text{tr}}162\newcommand\fig[1]{\begin{center} \includegraphics{#1} \end{center}}163\newcommand\Fig[4]{\begin{figure}[tb] \begin{center} \includegraphics[scale=#2]{#1} \end{center} \caption{\label{fig:#3} #4} \end{figure}}164\newcommand\FigTop[4]{\begin{figure}[t] \begin{center} \includegraphics[scale=#2]{#1} \end{center} \caption{\label{fig:#3} #4} \end{figure}}165\newcommand\FigStar[4]{\begin{figure*}[tb] \begin{center} \includegraphics[scale=#2]{#1} \end{center} \caption{\label{fig:#3} #4} \end{figure*}}166\newcommand\aside[1]{\quad\text{[#1]}}167\newcommand\homework[3]{\title{#1} \author{#2} \date{#3} \maketitle}168% Math169\newcommand\argmin{\mathop{\text{argmin}}}170\newcommand\argmax{\mathop{\text{argmax}}}171\newcommand\p[1]{\ensuremath{\left( #1 \right)}} % Parenthesis ()172\newcommand\pb[1]{\ensuremath{\left[ #1 \right]}} % []173\newcommand\pc[1]{\ensuremath{\left\{ #1 \right\}}} % {}174\newcommand\eval[2]{\ensuremath{\left. #1 \right|_{#2}}} % Evaluation175\newcommand\inv[1]{\ensuremath{\frac{1}{#1}}}176%\newcommand\half{\ensuremath{\frac{1}{2}}}177\newcommand\R{\ensuremath{\mathbb{R}}} % Real numbers178\newcommand\inner[2]{\ensuremath{\left< #1, #2 \right>}} % Inner product179\newcommand\mat[2]{\ensuremath{\left(\begin{array}{#1}#2\end{array}\right)}} % Matrix180\newcommand\eqn[1]{\begin{eqnarray} #1 \end{eqnarray}} % Equation (array)181\newcommand\eqnl[2]{\begin{eqnarray} \label{eqn:#1} #2 \end{eqnarray}} % Equation (array) with label182\newcommand\eqdef{\ensuremath{\stackrel{\rm def}{=}}} % Equal by definition183%\newcommand{\1}{\mathbb{I}} % Indicator (don't use \mathbbm{1} because bbm is not TrueType though)184\newcommand{\1}{\ensuremath{\mathbbm{1}}}185\newcommand{\bone}{\mathbf{1}} % for vector one186\newcommand{\bzero}{\mathbf{0}} % for vector zero187\newcommand\refeqn[1]{(\ref{eqn:#1})}188\newcommand\refeqns[2]{(\ref{eqn:#1}) and (\ref{eqn:#2})}189\newcommand\refchp[1]{Chapter~\ref{chp:#1}}190\newcommand\refsec[1]{Section~\ref{sec:#1}}191\newcommand\refsecs[2]{Sections~\ref{sec:#1} and~\ref{sec:#2}}192\newcommand\reffig[1]{Figure~\ref{fig:#1}}193\newcommand\reffigs[2]{Figures~\ref{fig:#1} and~\ref{fig:#2}}194\newcommand\reffigss[3]{Figures~\ref{fig:#1},~\ref{fig:#2}, and~\ref{fig:#3}}195\newcommand\reffigsss[4]{Figures~\ref{fig:#1},~\ref{fig:#2},~\ref{fig:#3}, and~\ref{fig:#4}}196\newcommand\reftab[1]{Table~\ref{tab:#1}}197\newcommand\refapp[1]{Appendix~\ref{sec:#1}}198\newcommand\refthm[1]{Theorem~\ref{thm:#1}}199\newcommand\refthms[2]{Theorems~\ref{thm:#1} and~\ref{thm:#2}}200\newcommand\reflem[1]{Lemma~\ref{lem:#1}}201\newcommand\reflems[2]{Lemmas~\ref{lem:#1} and~\ref{lem:#2}}202\newcommand\refprop[1]{Proposition~\ref{prop:#1}}203\newcommand\refdef[1]{Definition~\ref{def:#1}}204\newcommand\refcor[1]{Corollary~\ref{cor:#1}}205\newcommand\refalg[1]{Algorithm~\ref{alg:#1}}206\newcommand\Chapter[2]{\chapter{#2}\label{chp:#1}}207\newcommand\Section[2]{\section{#2}\label{sec:#1}}208\newcommand\Subsection[2]{\subsection{#2}\label{sec:#1}}209\newcommand\Subsubsection[2]{\subsubsection{#2}\label{sec:#1}}210\newtheorem{definition}{Definition}211\newtheorem{assumption}{Assumption}212\newtheorem{proposition}{Proposition}213\newtheorem{theorem}{Theorem}214\newtheorem{lemma}{Lemma}215\newtheorem{corollary}{Corollary}216% Probability217\newcommand\cv{\ensuremath{\to}} % Convergence218\newcommand\cvL{\ensuremath{\xrightarrow{\mathcal{L}}}} % Convergence in law219\newcommand\cvd{\ensuremath{\xrightarrow{d}}} % Convergence in distribution220\newcommand\cvP{\ensuremath{\xrightarrow{P}}} % Convergence in probability221\newcommand\cvas{\ensuremath{\xrightarrow{a.s.}}} % Convergence almost surely222\newcommand\eqdistrib{\ensuremath{\stackrel{d}{=}}} % Equal in distribution223\newcommand\E{\ensuremath{\mathbb{E}}} % Expectation224\newcommand\Ex[2]{\ensuremath{\mathbb{E}_{#1}\left[#2\right]}} % Expectation225\newcommand\var{\ensuremath{\text{var}}} % Variance226\newcommand\cov{\ensuremath{\text{cov}}} % Covariance227\newcommand\diag{\ensuremath{\text{diag}}} % Diagnonal matrix228\newcommand\cE[2]{\ensuremath{\E \left( #1 \mid #2 \right)}} % Conditional expectation229\newcommand\KL[2]{\ensuremath{\T{KL}\left( #1 \,||\, #2 \right)}} % KL-divergence230\newcommand\D[2]{\ensuremath{\bD\left( #1 \,||\, #2 \right)}} % KL-divergence231232% Utilities233\newcommand\lte{\leq}234\newcommand\gte{\geq}235\newcommand\lone[1]{\ensuremath{\|#1\|_1}}236\newcommand\ltwo[1]{\ensuremath{\|#1\|_2^2}}237\renewcommand{\vec}[1]{\mathbf{#1}}238239% Debug240\usepackage{color}241\newcommand{\hl}[2]{\colorbox{#2}{#1}}242\newcommand{\hly}[1]{\hl{yellow}{#1}}243\def\todo#1{\hl{{\bf TODO:} #1}{yellow}}244\def\needcite{\hl{{$^{\tt\small[citation\ needed]}$}}{blue}}245\def\needfig{\hl{Figure X}{green}}246\def\note#1{\hl{{\bf NOTE:} #1}{yellow}}247\def\dome{\hl{{\bf TODO:} write me!}{yellow}}248249