Skip to content

Instantly share code, notes, and snippets.

@xiaohan2012
Created May 30, 2024 07:58
Show Gist options
  • Save xiaohan2012/f120855f9dd04c4c7426aba9755288eb to your computer and use it in GitHub Desktop.
Save xiaohan2012/f120855f9dd04c4c7426aba9755288eb to your computer and use it in GitHub Desktop.
Han's Latex macros
\ProvidesPackage{han-macros}[2023-03-03 Han Macros package]
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{bbm}
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\newcommand{\nat}{\ensuremath{\mathbb N}\xspace}
\newcommand{\nphard}{{{\np}-hard}\xspace}
\newcommand{\sharpP}{\ensuremath{\#\mathbf{P}}\xspace}
\newcommand{\set}[1]{\left\{#1\right\}}
\newcommand{\floor}[1]{\left\lfloor{#1}\right\rfloor}
\newcommand{\pr}[1]{\left(#1\right)}
\newcommand{\fpr}[1]{\mathopen{}\left(#1\right)}
\newcommand{\spr}[1]{\left[#1\right]}
\newcommand{\fspr}[1]{\mathopen{}\left[#1\right]}
\newcommand{\brak}[1]{\left<#1\right>}
\newcommand{\abs}[1]{{\left|#1\right|}}
\newcommand{\norm}[1]{\left\|#1\right\|}
\newcommand{\enset}[2]{\left\{#1 ,\ldots , #2\right\}}
\newcommand{\enpr}[2]{\pr{#1 ,\ldots , #2}}
\newcommand{\enlst}[2]{{#1} ,\ldots , {#2}}
\newcommand{\vect}[1]{\spr{#1}}
\newcommand{\envec}[2]{\vect{#1 ,\ldots , #2}}
\newcommand{\real}{\mathbb{R}}
\newcommand{\np}{\textbf{NP}\xspace}
\newcommand{\naturals}{\mathbb{N}}
\newcommand{\funcdef}[3]{{#1}:{#2} \to {#3}}
\newcommand{\define}{\leftarrow}
\newcommand{\reals}{{\mathbb{R}}\xspace}
\newcommand{\proba}[1]{\text{Pr}\left({#1}\right)\xspace}
\newcommand{\bigO}{\ensuremath{\mathcal{O}}\xspace}
\newcommand{\ind}[1]{\ensuremath{\mathbbm{1}\pr{#1}}\xspace}
\DeclarePairedDelimiter\floor{\lceil}{\rceil}
\DeclarePairedDelimiter\ceil{\lfloor}{\rfloor}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment