\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{jerrylicious}[Jerry's Tex Mess]


\RequirePackage{amsthm,amssymb,amsfonts,amsmath}
\RequirePackage{enumerate}
\RequirePackage{tikz-cd}

% ------------- Block Environmets ---------------


\makeatletter

\theoremstyle{plain}
\newtheorem{theorem}[subsection]{Theorem}
\newtheorem{proposition}[subsection]{Proposition}
\newtheorem{lemma}[subsection]{Lemma}

\theoremstyle{definition}
\newtheorem{definition}[subsection]{Definition}
\newtheorem{example}[subsection]{Example}
% \newtheorem{exercise}[subsection]{Exercise}
% \newtheorem{situation}[subsection]{Situation}

\theoremstyle{remark}
\newtheorem{rem}[subsection]{Remark}
\newtheorem{remark}[subsection]{Remark}
% \newtheorem{remarks}[subsection]{Remarks}

\numberwithin{equation}{subsection}

\makeatother

% ------------- References --------------

\newcommand{\lemmaautorefname}{Lemma}
\newcommand{\lemautorefname}{Lemma}


% ------------------ Shortcuts --------------------------

% All kinds of brackets.
\newcommand{\paren}[1]{\left(#1\right)}
\newcommand{\parens}[1]{\left(#1\right)}
\newcommand{\bracs}[1]{\left\{#1\right\}}
\newcommand{\braks}[1]{\left[#1\right]}
\newcommand{\angles}[1]{\left\langle#1\right\rangle}
\newcommand{\abs}[1]{\left|#1\right|}
\newcommand{\bracsn}[1]{\{{#1}\}}
\newcommand{\anglesn}[1]{\langle {#1} \rangle}

% Probability
\newcommand{\ev}{\mathbb{E}}
\newcommand{\var}[1]{\text{Var}\paren{#1}}
\newcommand{\cov}[1]{\text{Cov}\paren{#1}}
\newcommand{\sig}[1]{\sigma_{#1}^2}
\newcommand{\bp}{\mathbf{P}}

% Complex numbers
\newcommand{\re}[1]{\text{Re}\paren{#1}}
\newcommand{\im}[1]{\text{Im}\paren{#1}}
\newcommand{\sgn}{\text{sgn}}

% Bold stuff for algebra.
\newcommand{\zero}{\mathbf{0}}
\newcommand{\one}{\mathbf{1}}

% Number Systems/Algebraic Structures
\newcommand{\polyfield}[1]{\mathbb{F}[#1]}
\newcommand{\field}{\mathbb{F}}
\newcommand{\nat}{\mathbb{N}}
\newcommand{\natp}{\mathbb{N}^+}
\newcommand{\natz}{\mathbb{N}_0}
\newcommand{\integer}{\mathbb{Z}}
\newcommand{\complex}{\mathbb{C}}
\newcommand{\real}{\mathbb{R}}
\newcommand{\rd}{\real^d}
\newcommand{\realp}{\mathbb{R}_{>0}} % Real positive
\newcommand{\realnn}{\mathbb{R}_{\ge 0}} % Real non-negative
\newcommand{\rational}{\mathbb{Q}}
\newcommand{\quot}[1]{\integer/{#1}\integer}
\newcommand{\polyfields}[1]{F[{#1}_1, \cdots, {#1}_n]}
\newcommand{\polyfieldf}[1]{F({#1}_1, \cdots, {#1}_n)}
\newcommand{\gal}[1]{\text{Gal}\paren{#1}}
\newcommand{\aut}[1]{\text{Aut}\paren{#1}}
\newcommand{\fa}{\mathfrak{a}}
\newcommand{\fb}{\mathfrak{b}}
\newcommand{\fv}{\mathfrak{v}}

% Sequences and Limits
\newcommand{\limv}[1]{\lim_{#1 \to \infty}}
\newcommand{\seq}[1]{\bracs{#1}_{1}^{\infty}}
\newcommand{\limsupd}[1]{\underset{#1}{\ol{\lim}}}
\newcommand{\liminfd}[1]{\underset{#1}{\underline{\lim}}}
\newcommand{\seqi}[1]{\bracs{{#1}_{i}}_{i \in I}}
\newcommand{\seqj}[1]{\bracs{{#1}_{j}}_{j \in J}}
\newcommand{\drarrow}{\searrow}
\newcommand{\downto}{\searrow}
\newcommand{\upto}{\nearrow}
\newcommand{\eps}{\varepsilon}
% Optional upper index argument.
\newcommand{\seqf}[2][n]{\bracs{#2}_{1}^{#1}}
\newcommand{\seqfz}[2][n]{\bracs{#2}_{0}^{#1}}

% Isomorphisms
\newcommand{\isoto}{\tilde{\rightarrow}}
\newcommand{\iso}{\cong}

\newcommand{\modulo}{\text{mod }}

% Algebra properties
\newcommand{\ord}{\text{Ord }}
\newcommand{\orb}[1]{\text{Orb}\paren{#1}}
\newcommand{\stab}[1]{\text{Stab}\paren{#1}}
\newcommand{\rank}{\text{rank }}
\newcommand{\inp}{\angles{\cdot, \cdot}}
\newcommand{\eig}{\text{Eig}}
\newcommand{\proj}{\text{proj}}
\newcommand{\tr}{\text{tr}}
\newcommand{\spec}[1]{\text{Spec}\paren{#1}}
\newcommand{\ba}{\mathbf{A}}

% Dual Pairings & Inner Products

\newcommand{\dpb}[2]{\angles{#1}_{#2}} % Dual Pairing with a specific space. B because it's apparently already defined in tex.
\newcommand{\dpn}[2]{\langle {#1} \rangle_{#2}} % Dual Pairing, without scaling the braces.
\newcommand{\dprd}[1]{\dpb{#1}{\rd}} % R^d dual pairing.
\newcommand{\dprdn}[1]{\dpn{#1}{\rd}} % R^d dual pairing.
\newcommand{\dpd}[1]{\dpb{#1}{\mathcal{D}}} % Distribution dual pairing
\newcommand{\dpdn}[1]{\dpn{#1}{\mathcal{D}}}
\newcommand{\dpe}[1]{\dpb{#1}{E}} % E for Banach.
\newcommand{\dpen}[1]{\dpn{#1}{E}} % E for Banach.
\newcommand{\dph}[1]{\dpb{#1}{H}} % H for Hilbert.
\newcommand{\dphn}[1]{\dpn{#1}{H}} % H for Hilbert.

% Floor and ceiling
\newcommand{\fl}[1]{\left\lfloor #1 \right\rfloor}
\newcommand{\cl}[1]{\left\lceil #1 \right\rceil}

% Topology
\newcommand{\topo}{\mathcal{T}}
\newcommand{\inte}{\text{int}}
\newcommand{\exte}{\text{ext}}
\newcommand{\diam}{\text{diam}}
\newcommand{\net}[1]{\angles{{#1}_{\alpha}}_{\alpha \in A}}
\newcommand{\netb}[1]{\angles{{#1}_{\beta}}_{\beta \in B}}
\newcommand{\supp}[1]{\text{supp}\paren{#1}}
\newcommand{\fF}{\mathfrak{F}}
\newcommand{\fS}{\mathfrak{S}}
\newcommand{\fB}{\mathfrak{B}}
\newcommand{\fU}{\mathfrak{U}}
\newcommand{\fV}{\mathfrak{V}}
\newcommand{\fG}{\mathfrak{G}}
\newcommand{\bs}{\mathbf{S}}

% Curly Letters
\newcommand{\alg}{\mathcal{A}}
\newcommand{\agb}[1]{\mathcal{M}\paren{#1}}
\newcommand{\cm}{\mathcal{M}}
\newcommand{\cf}{\mathcal{F}}
\newcommand{\ce}{\mathcal{E}}
\newcommand{\ci}{\mathcal{I}}
\newcommand{\pow}[1]{\mathcal{P}\paren{#1}}
\newcommand{\cb}{\mathcal{B}}
\newcommand{\cn}{\mathcal{N}}
\newcommand{\lms}{\mathcal{L}}
\newcommand{\ch}{\mathcal{H}}
\newcommand{\cg}{\mathcal{H}}
\renewcommand{\cl}{\mathcal{L}}
\newcommand{\cc}{\mathcal{C}}
\newcommand{\ct}{\mathcal{T}}
\newcommand{\cx}{\mathcal{X}}
\newcommand{\cy}{\mathcal{Y}}
\newcommand{\cs}{\mathcal{S}}
\newcommand{\cd}{\mathcal{D}}
\newcommand{\calr}{\mathcal{R}}
\newcommand{\scp}{\mathscr{P}}

% Jokes
\newcommand{\lol}{\boxed{\text{LOL.}}}
\newcommand{\ez}{\boxed{\mathbb{EZ}}}

% Colours
\newcommand{\pblue}[1]{\textcolor[rgb]{0, 0.44, 0.75}{#1}}
\newcommand{\poran}[1]{\textcolor{orange}{#1}}
\newcommand{\pb}[1]{\pblue{#1}}
\newcommand{\po}[1]{\poran{#1}}
\newcommand{\pg}[1]{\textcolor[rgb]{0, 0.69, 0.31}{#1}}
\newcommand{\pp}[1]{\textcolor[rgb]{0.35, 0.25, 0.64}{#1}}
\newcommand{\ps}[1]{\textcolor[rgb]{0.58, 0.25, 0.45}{#1}}

% Formatting
\newcommand{\ol}[1]{\overline{#1}}
\newcommand{\ul}[1]{\underline{#1}}
\newcommand{\wh}[1]{\widehat{#1}}
\newcommand{\td}[1]{\widetilde{#1}}

\newcommand{\norm}[1]{\abs{\abs{#1}}}
\newcommand{\norms}[2]{\abs{\abs{#1}}_{#2}}
\newcommand{\normn}[1]{||{#1}||}
\newcommand{\normns}[2]{||{#1}||_{#1}}
\newcommand{\normrd}[1]{\norms{#1}{\real^d}}
\newcommand{\normrdn}[1]{\normns{#1}{\real^d}}

% for variation
\newcommand{\var}{\text{var}}


% Category Shenanigans
\newcommand{\mf}[1]{\mathfrak{#1}}
\newcommand{\catc}{\mathfrak{C}}
\newcommand{\cata}{\mathfrak{A}}
\newcommand{\obj}[1]{\text{Ob}\paren{#1}}
\newcommand{\mor}[1]{\text{Mor}\paren{#1}}

% Tangent Space Shenanigans
\newcommand{\ppi}{\frac{\partial}{\partial x^i}}
\newcommand{\ppj}{\frac{\partial}{\partial y^j}}
\newcommand{\ppip}{\ppi\bigg\vert_p}
\renewcommand{\part}[2]{\frac{\partial{#1}}{\partial{#2}}}
\newcommand{\vf}{\mathfrak{X}}
\newcommand{\grad}[1]{\text{grad}\paren{#1}}
\newcommand{\Grad}[1]{\text{Grad}\paren{#1}}
\renewcommand{\div}[1]{\text{div}\paren{#1}}

% Random spaces
\newcommand{\laut}[1]{\text{Laut}({#1})}
\newcommand{\loci}{L^1_{\text{loc}}}
\newcommand{\symbi}{L^2_{\text{sym}}}
\newcommand{\met}{\text{Met}}
\newcommand{\ri}{\text{Ri}}
\newcommand{\ind}[1]{\text{ind}\paren{#1}}
\newcommand{\scl}{\mathscr{L}}
\newcommand{\sch}{\mathscr{H}}
\newcommand{\frl}{\mathfrak{L}}

% Real or Complex Numbers
\newcommand{\RC}{\bracs{\real, \complex}}
