Skip to content

Instantly share code, notes, and snippets.

@shaabhishek
Last active February 21, 2022 21:01
Show Gist options
  • Save shaabhishek/da96457113cf247cd7ad7a1a1b7f79c3 to your computer and use it in GitHub Desktop.
Save shaabhishek/da96457113cf247cd7ad7a1a1b7f79c3 to your computer and use it in GitHub Desktop.
Style file for standard latex documents
\ProvidesPackage{mystyle}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, amssymb, bm}
\usepackage{mathtools} % for DeclarePairedDelimiter command
\usepackage{graphicx}
\usepackage{subcaption} %allows drawing subfigures
% Set page size and margins
% Replace `letterpaper' with`a4paper' for UK/EU standard size
% Don't put extra settings if you want the default page
\usepackage[letterpaper,top=2cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}
\usepackage{floatrow}
\usepackage{layout}
\usepackage{amssymb}
\usepackage{dsfont} %doublestroke package for stylish indicator function
\usepackage{multirow}
\usepackage{caption}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}
\geometry{margin=1in}
\usepackage{authblk}
\usepackage{indentfirst}
\usepackage{tikz}
\usepackage{ulem} % for strike-through text
% \usetikzlibrary{bayesnet}
% \usepackage{bayesnetcommands}
\usepackage{listings} %for code
\lstset{
frameround=fttt,
language=Python,
numbers=left,
breaklines=true,
keywordstyle=\color{blue}\bfseries,
basicstyle=\ttfamily\color{red},
numberstyle=\color{black}
}
% bibliography
\usepackage[
backend=biber,
style=alphabetic,
sorting=nyt
]{biblatex}
%%%%%%%%%%% Macros %%%%%%%%%%
%%% Formatting macros
% Converts (), {}, [] into scaled-to-text counterparts
\newcommand{\parens}[1]{\left( #1 \right)}
\newcommand{\brackets}[1]{\left[ #1 \right]}
\newcommand{\braces}[1]{\left\{ #1 \right\}}
\newcommand{\todo}{\text{\color{red} TODO: }}
% floor and ceiling symbols
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}
\DeclarePairedDelimiter\ceil{\lceil}{\rceil}
%%% Math macros
\newcommand{\indicator}[1]{\mathds{1}\left[ #1 \right]}
\newcommand{\inner}[2]{\left<#1,#2\right>}
\newcommand{\set}[1]{\{ #1 \}}
\newcommand{\norm}[1]{\| #1 \|}
\newcommand\abs[1]{\left| #1 \right|}
\newcommand{\indep}{\perp \!\!\! \perp}
\newcommand{\strike}[1]{\text{\sout{\ensuremath{#1}}}}
\newcommand{\sigmoid}[1]{\sigma \parens{#1}}
\newcommand{\logit}[1]{\log \frac{#1}{1-#1}}
% Constants
\newcommand{\R}{{\mathbb R}}
\newcommand{\ones}{{\mathbf 1}}
\newcommand{\zeroes}{{\mathbf 0}}
\newcommand{\tr}{\text{Tr}}
% Probability macros
\DeclareMathOperator*{\Eop}{\mathbb{E}}
\newcommand{\E}[2]{\Eop_{#1}\brackets{#2}}
\newcommand{\KL}[2]{\mathbb{KL}\parens{#1 || #2}}
\newcommand{\entropy}[1]{\mathbb{H} \brackets{#1}}
\newcommand{\pr}[1]{\mathbb{P}\parens{#1}}
\newcommand{\condpr}[2]{\pr{#1 \vert #2}}
% Distributions
\newcommand{\Cat}[1]{\textbf{Cat}(#1)}
\newcommand{\Bern}[1]{\textbf{Bern}(#1)}
\newcommand{\Pois}[1]{\textbf{Pois}(#1)}
\newcommand{\Geom}[1]{\textbf{Geom}(#1)}
\newcommand{\Expo}[1]{\textbf{Expo}(#1)}
\newcommand{\Unif}[2]{\textbf{Unif}(#1, #2)}
\newcommand{\Gam}[2]{\textbf{Gamma}(#1, #2)}
\newcommand{\Normal}[1]{\mathcal{N}(#1)}
\newcommand{\Dir}[1]{\textbf{Dir}(#1)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment