Skip to content

Instantly share code, notes, and snippets.

@siddMahen
Created March 18, 2019 23:03
Show Gist options
  • Select an option

  • Save siddMahen/ab3e5791be066c8a2ecce9f10ccef661 to your computer and use it in GitHub Desktop.

Select an option

Save siddMahen/ab3e5791be066c8a2ecce9f10ccef661 to your computer and use it in GitHub Desktop.

Revisions

  1. siddMahen created this gist Mar 18, 2019.
    119 changes: 119 additions & 0 deletions common.sty
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,119 @@
    % A collection of frequently used commands
    % This file is located in ~/Library/texmf/tex/latex/common/

    \NeedsTeXFormat{LaTeX2e}
    \ProvidesPackage{common}[2018/10/27 v1.0 Siddharth Mahendraker]

    % -- Typography --
    \RequirePackage[utf8]{inputenc}
    \RequirePackage{microtype}
    \RequirePackage{parskip}

    % -- Fonts --
    \RequirePackage{mathpazo}
    %\RequirePackage{palatino}
    \RequirePackage{eulervm}
    \usepackage[scaled=.90]{helvet}
    \usepackage{courier}

    \RequirePackage[T1]{fontenc}

    % -- Math --
    \RequirePackage{amsmath}
    \RequirePackage{amssymb}
    \RequirePackage{mathtools}

    \RequirePackage{amsthm}
    \RequirePackage{thmtools, thm-restate}

    % -- Fixes amsthm error which occurs when using parskip
    % -- See https://tex.stackexchange.com/questions/25346/wrong-spacing-before-theorem-environment-amsthm
    \begingroup
    \makeatletter
    \@for\theoremstyle:=definition,remark,plain\do{%
    \expandafter\g@addto@macro\csname th@\theoremstyle\endcsname{%
    \addtolength\thm@preskip\parskip
    }%
    }
    \endgroup

    \declaretheorem[name=Theorem,%
    refname={theorem,theorems},%
    Refname={Theorem,Theorems},%
    within=section]{theorem}

    \declaretheorem[name=Proposition,%
    refname={proposition,propositions},%
    Refname={Proposition,Propositions},%
    sibling=theorem]{proposition}

    \declaretheorem[name=Lemma,%
    refname={lemma,lemmas},%
    Refname={Lemma,Lemmas},%
    sibling=theorem]{lemma}

    \declaretheorem[name=Definition,%
    refname={definition,definitions},%
    Refname={Definition,Definitions},%
    sibling=theorem]{definition}

    \declaretheorem[name=Corollary,%
    refname={corollary,corollaries},%
    Refname={Corollary,Corollaries},%
    sibling=theorem]{corollary}

    % -- Misc. --
    \RequirePackage{hyperref}
    \RequirePackage{color}
    \RequirePackage{array}
    \RequirePackage{url}

    % -- Common commands and abbreviations --

    \providecommand{\F}{}
    \renewcommand{\F}{\mathbb{F}}
    \providecommand{\Q}{}
    \renewcommand{\Q}{\mathbb{Q}}
    \providecommand{\C}{}
    \renewcommand{\C}{\mathbb{C}}
    \providecommand{\Z}{}
    \renewcommand{\Z}{\mathbb{Z}}
    \providecommand{\R}{}
    \renewcommand{\R}{\mathbb{R}}

    \providecommand{\A}{}
    \renewcommand{\A}{\mathbb{A}}
    \providecommand{\P}{}
    \renewcommand{\P}{\mathbb{P}}

    %\renewcommand{\to}{\longrightarrow}

    \providecommand{\O}{}
    \renewcommand{\O}{\mathcal{O}}
    \providecommand{\p}{}
    \renewcommand{\p}{\mathfrak{p}}
    \providecommand{\q}{}
    \renewcommand{\q}{\mathfrak{q}}

    \DeclareMathOperator{\x}{\times}

    \DeclareMathOperator{\tr}{tr}
    \DeclareMathOperator{\ind}{Ind}

    \DeclareMathOperator{\im}{im}

    \newcommand{\mat}[4]{%
    \bigl(
    \begin{smallmatrix}
    #1&#2 \\%
    #3&#4
    \end{smallmatrix}
    \bigr)}

    \newcommand{\Mat}[4]{%
    \begin{pmatrix}
    #1 & #2 \\%
    #3 & #4
    \end{pmatrix}}

    \newcommand{\legendre}[2]{\genfrac{(}{)}{}{}{#1}{#2}}