%
% PACKAGES
%

% Standard Packages
\usepackage{babel}
\usepackage{enumitem}
\usepackage{hyperref}
\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}
\usepackage{mathtools}
\usepackage{varioref}
\usepackage[arrow,curve,matrix]{xy}

% Graphics Packages
\usepackage{colortbl}
\usepackage{graphicx}
\usepackage{tikz}

% Font packages
\usepackage{mathrsfs}


%
% GENERAL TYPESETTING
%

% Colours for hyperlinks
\definecolor{linkred}{rgb}{0.7,0.2,0.2}
\definecolor{linkblue}{rgb}{0,0.2,0.6}

% Limit table of contents to section titles
\setcounter{tocdepth}{1}

% Numbering of figures (see below for numbering of equations)
\numberwithin{figure}{section}

% Add an uparrow to the bibliography entries, just before the back-list of references
\usepackage[hyperpageref]{backref}
\renewcommand{\backref}[1]{$\uparrow$~#1}

% Numbering of parts in roman numbers
\renewcommand\thepart{\rm \Roman{part}}

% Sloppy formatting -- often looks better
\sloppy

% Changes the layout of descriptions and itemized lists. The indent specified in
% the original amsart style is too much for my taste.
\setdescription{labelindent=\parindent, leftmargin=2\parindent}
\setitemize[1]{labelindent=\parindent, leftmargin=2\parindent}
\setenumerate[1]{labelindent=0cm, leftmargin=*, widest=iiii}

%
% Input characters
%

\newunicodechar{א}{\ensuremath{\aleph}}
\newunicodechar{α}{\ensuremath{\alpha}}
\newunicodechar{β}{\ensuremath{\beta}}
\newunicodechar{χ}{\ensuremath{\chi}}
\newunicodechar{δ}{\ensuremath{\delta}}
\newunicodechar{ε}{\ensuremath{\varepsilon}}
\newunicodechar{Δ}{\ensuremath{\Delta}}
\newunicodechar{η}{\ensuremath{\eta}}
\newunicodechar{γ}{\ensuremath{\gamma}}
\newunicodechar{Γ}{\ensuremath{\Gamma}}
\newunicodechar{ι}{\ensuremath{\iota}}
\newunicodechar{κ}{\ensuremath{\kappa}}
\newunicodechar{λ}{\ensuremath{\lambda}}
\newunicodechar{Λ}{\ensuremath{\Lambda}}
\newunicodechar{ν}{\ensuremath{\nu}}
\newunicodechar{μ}{\ensuremath{\mu}}
\newunicodechar{ω}{\ensuremath{\omega}}
\newunicodechar{Ω}{\ensuremath{\Omega}}
\newunicodechar{π}{\ensuremath{\pi}}
\newunicodechar{Π}{\ensuremath{\Pi}}
\newunicodechar{φ}{\ensuremath{\phi}}
\newunicodechar{Φ}{\ensuremath{\Phi}}
\newunicodechar{ψ}{\ensuremath{\psi}}
\newunicodechar{Ψ}{\ensuremath{\Psi}}
\newunicodechar{ρ}{\ensuremath{\rho}}
\newunicodechar{σ}{\ensuremath{\sigma}}
\newunicodechar{Σ}{\ensuremath{\Sigma}}
\newunicodechar{τ}{\ensuremath{\tau}}
\newunicodechar{θ}{\ensuremath{\theta}}
\newunicodechar{Θ}{\ensuremath{\Theta}}
\newunicodechar{ξ}{\ensuremath{\xi}}
\newunicodechar{Ξ}{\ensuremath{\Xi}}
\newunicodechar{ζ}{\ensuremath{\zeta}}

\newunicodechar{ℓ}{\ensuremath{\ell}}
\newunicodechar{ï}{\"{\i}}

\newunicodechar{𝔸}{\ensuremath{\bA}}
\newunicodechar{𝔹}{\ensuremath{\bB}}
\newunicodechar{ℂ}{\ensuremath{\bC}}
\newunicodechar{𝔻}{\ensuremath{\bD}}
\newunicodechar{𝔼}{\ensuremath{\bE}}
\newunicodechar{𝔽}{\ensuremath{\bF}}
\newunicodechar{𝔾}{\ensuremath{\bG}}
\newunicodechar{ℕ}{\ensuremath{\bN}}
\newunicodechar{ℙ}{\ensuremath{\bP}}
\newunicodechar{ℚ}{\ensuremath{\bQ}}
\newunicodechar{ℝ}{\ensuremath{\bR}}
\newunicodechar{𝕏}{\ensuremath{\bX}}
\newunicodechar{ℤ}{\ensuremath{\bZ}}
\newunicodechar{𝒜}{\ensuremath{\sA}}
\newunicodechar{ℬ}{\ensuremath{\sB}}
\newunicodechar{𝒞}{\ensuremath{\sC}}
\newunicodechar{𝒟}{\ensuremath{\sD}}
\newunicodechar{ℰ}{\ensuremath{\sE}}
\newunicodechar{ℱ}{\ensuremath{\sF}}
\newunicodechar{𝒢}{\ensuremath{\sG}}
\newunicodechar{ℋ}{\ensuremath{\sH}}
\newunicodechar{𝒥}{\ensuremath{\sJ}}
\newunicodechar{ℒ}{\ensuremath{\sL}}
\newunicodechar{ℳ}{\ensuremath{\sM}}
\newunicodechar{𝒪}{\ensuremath{\sO}}
\newunicodechar{𝒬}{\ensuremath{\sQ}}
\newunicodechar{𝒮}{\ensuremath{\sS}}
\newunicodechar{𝒯}{\ensuremath{\sT}}
\newunicodechar{𝒲}{\ensuremath{\sW}}

\newunicodechar{∂}{\ensuremath{\partial}}
\newunicodechar{∇}{\ensuremath{\nabla}}

\newunicodechar{↺}{\ensuremath{\circlearrowleft}}
\newunicodechar{∞}{\ensuremath{\infty}}
\newunicodechar{⊕}{\ensuremath{\oplus}}
\newunicodechar{⊗}{\ensuremath{\otimes}}
\newunicodechar{•}{\ensuremath{\bullet}}
\newunicodechar{Λ}{\ensuremath{\wedge}}
\newunicodechar{↪}{\ensuremath{\into}}
\newunicodechar{→}{\ensuremath{\to}}
\newunicodechar{↦}{\ensuremath{\mapsto}}
\newunicodechar{⨯}{\ensuremath{\times}}
\newunicodechar{∪}{\ensuremath{\cup}}
\newunicodechar{∩}{\ensuremath{\cap}}
\newunicodechar{⊋}{\ensuremath{\supsetneq}}
\newunicodechar{⊇}{\ensuremath{\supseteq}}
\newunicodechar{⊃}{\ensuremath{\supset}}
\newunicodechar{⊊}{\ensuremath{\subsetneq}}
\newunicodechar{⊆}{\ensuremath{\subseteq}}
\newunicodechar{⊂}{\ensuremath{\subset}}
\newunicodechar{⊄}{\ensuremath{\not \subset}}
\newunicodechar{≥}{\ensuremath{\geq}}
\newunicodechar{≠}{\ensuremath{\neq}}
\newunicodechar{≫}{\ensuremath{\gg}}
\newunicodechar{≪}{\ensuremath{\ll}}

\newunicodechar{≤}{\ensuremath{\leq}}
\newunicodechar{∈}{\ensuremath{\in}}
\newunicodechar{∉}{\ensuremath{\not \in}}
\newunicodechar{∖}{\ensuremath{\setminus}}
\newunicodechar{◦}{\ensuremath{\circ}}
\newunicodechar{°}{\ensuremath{^\circ}}
\newunicodechar{…}{\ifmmode\mathellipsis\else\textellipsis\fi}
\newunicodechar{·}{\ensuremath{\cdot}}
\newunicodechar{⋯}{\ensuremath{\cdots}}
\newunicodechar{∅}{\ensuremath{\emptyset}}
\newunicodechar{⇒}{\ensuremath{\Rightarrow}}

\newunicodechar{⁰}{\ensuremath{^0}}
\newunicodechar{¹}{\ensuremath{^1}}
\newunicodechar{²}{\ensuremath{^2}}
\newunicodechar{³}{\ensuremath{^3}}
\newunicodechar{⁴}{\ensuremath{^4}}
\newunicodechar{⁵}{\ensuremath{^5}}
\newunicodechar{⁶}{\ensuremath{^6}}
\newunicodechar{⁷}{\ensuremath{^7}}
\newunicodechar{⁸}{\ensuremath{^8}}
\newunicodechar{⁹}{\ensuremath{^9}}
\newunicodechar{ⁱ}{\ensuremath{^i}}
\newunicodechar{⁺}{\ensuremath{^+}}

\newunicodechar{⌈}{\ensuremath{\lceil}}
\newunicodechar{⌉}{\ensuremath{\rceil}}
\newunicodechar{⌊}{\ensuremath{\lfloor}}
\newunicodechar{⌋}{\ensuremath{\rfloor}}

\newunicodechar{≅}{\ensuremath{\cong}}
\newunicodechar{⇔}{\ensuremath{\Leftrightarrow}}
\newunicodechar{∃}{\ensuremath{\exists}}
\newunicodechar{±}{\ensuremath{\pm}}


%
% FONT DEFINTIONS
%

% Script Font used for sheaves
\DeclareFontFamily{OMS}{rsfs}{\skewchar\font'60}
\DeclareFontShape{OMS}{rsfs}{m}{n}{<-5>rsfs5 <5-7>rsfs7 <7->rsfs10 }{}
\DeclareSymbolFont{rsfs}{OMS}{rsfs}{m}{n}
\DeclareSymbolFontAlphabet{\scr}{rsfs}
\DeclareSymbolFontAlphabet{\scr}{rsfs}

% Code from mathabx.sty and mathabx.dcl, define macro \wcheck
\DeclareFontFamily{U}{mathx}{\hyphenchar\font45}
\DeclareFontShape{U}{mathx}{m}{n}{
      <5> <6> <7> <8> <9> <10>
      <10.95> <12> <14.4> <17.28> <20.74> <24.88>
      mathx10
      }{}
\DeclareSymbolFont{mathx}{U}{mathx}{m}{n}
\DeclareFontSubstitution{U}{mathx}{m}{n}
\DeclareMathAccent{\wcheck}{0}{mathx}{"71}


%
% MATHEMATICS DEFINITIONS
%

% Operators
\DeclareMathOperator{\Aut}{Aut}
\DeclareMathOperator{\codim}{codim}
\DeclareMathOperator{\coker}{coker}
\DeclareMathOperator{\const}{const}
\DeclareMathOperator{\Ext}{Ext}
\DeclareMathOperator{\Hom}{Hom}
\DeclareMathOperator{\Id}{Id}
\DeclareMathOperator{\Image}{Image}
\DeclareMathOperator{\img}{img}
\DeclareMathOperator{\Pic}{Pic}
\DeclareMathOperator{\rank}{rank}
\DeclareMathOperator{\Ramification}{Ramification}
\DeclareMathOperator{\red}{red}
\DeclareMathOperator{\reg}{reg}
\DeclareMathOperator{\sat}{sat}
\DeclareMathOperator{\sEnd}{\sE\negthinspace \mathit{nd}}
\DeclareMathOperator{\sing}{sing}
\DeclareMathOperator{\Spec}{Spec}
\DeclareMathOperator{\Sym}{Sym}
\DeclareMathOperator{\supp}{supp}
\DeclareMathOperator{\tor}{tor}
\DeclareMathOperator{\Tor}{Tor}
\DeclareMathOperator{\Frob}{Frob}

% Sheaves
\newcommand{\sA}{\scr{A}}
\newcommand{\sB}{\scr{B}}
\newcommand{\sC}{\scr{C}}
\newcommand{\sD}{\scr{D}}
\newcommand{\sE}{\scr{E}}
\newcommand{\sF}{\scr{F}}
\newcommand{\sG}{\scr{G}}
\newcommand{\sH}{\scr{H}}
\newcommand{\sHom}{\scr{H}\negthinspace om}
\newcommand{\sI}{\scr{I}}
\newcommand{\sJ}{\scr{J}}
\newcommand{\sK}{\scr{K}}
\newcommand{\sL}{\scr{L}}
\newcommand{\sM}{\scr{M}}
\newcommand{\sN}{\scr{N}}
\newcommand{\sO}{\scr{O}}
\newcommand{\sP}{\scr{P}}
\newcommand{\sQ}{\scr{Q}}
\newcommand{\sR}{\scr{R}}
\newcommand{\sS}{\scr{S}}
\newcommand{\sT}{\scr{T}}
\newcommand{\sU}{\scr{U}}
\newcommand{\sV}{\scr{V}}
\newcommand{\sW}{\scr{W}}
\newcommand{\sX}{\scr{X}}
\newcommand{\sY}{\scr{Y}}
\newcommand{\sZ}{\scr{Z}}

% C-infty sheaves
\newcommand{\cA}{\mathcal A}
\newcommand{\cC}{\mathcal C}
\newcommand{\cD}{\mathcal D}
\newcommand{\cE}{\mathcal E}
\newcommand{\cM}{\mathcal M}
\newcommand{\cN}{\mathcal N}
\newcommand{\cV}{\mathcal V}

% Blackboard Bold Symbols
\newcommand{\bA}{\mathbb{A}}
\newcommand{\bB}{\mathbb{B}}
\newcommand{\bC}{\mathbb{C}}
\newcommand{\bD}{\mathbb{D}}
\newcommand{\bE}{\mathbb{E}}
\newcommand{\bF}{\mathbb{F}}
\newcommand{\bG}{\mathbb{G}}
\newcommand{\bH}{\mathbb{H}}
\newcommand{\bI}{\mathbb{I}}
\newcommand{\bJ}{\mathbb{J}}
\newcommand{\bK}{\mathbb{K}}
\newcommand{\bL}{\mathbb{L}}
\newcommand{\bM}{\mathbb{M}}
\newcommand{\bN}{\mathbb{N}}
\newcommand{\bO}{\mathbb{O}}
\newcommand{\bP}{\mathbb{P}}
\newcommand{\bQ}{\mathbb{Q}}
\newcommand{\bR}{\mathbb{R}}
\newcommand{\bS}{\mathbb{S}}
\newcommand{\bT}{\mathbb{T}}
\newcommand{\bU}{\mathbb{U}}
\newcommand{\bV}{\mathbb{V}}
\newcommand{\bW}{\mathbb{W}}
\newcommand{\bX}{\mathbb{X}}
\newcommand{\bY}{\mathbb{Y}}
\newcommand{\bZ}{\mathbb{Z}}

% Sans serif symbols
\newcommand{\aB}{{\sf B}}
\newcommand{\aD}{{\sf D}}
\newcommand{\aE}{{\sf E}}
\newcommand{\aF}{{\sf F}}


% Theorem type environments
\theoremstyle{plain}
\newtheorem{thm}{Theorem}[section]
\newtheorem{aassumption}[thm]{Additional Assumption}
\newtheorem{conjecture}[thm]{Conjecture}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{defn}[thm]{Definition}
\newtheorem{fact}[thm]{Fact}
\newtheorem{lem}[thm]{Lemma}
\newtheorem{lemDef}[thm]{Lemma and Definition}
\newtheorem{lemNot}[thm]{Lemma and Notation}
\newtheorem{problem}[thm]{Problem}
\newtheorem{prop}[thm]{Proposition}
\newtheorem{setup}[thm]{Setup}
\newtheorem{subthm}[thm]{Sub-Theorem}
\newtheorem{summary}[thm]{Summary}
\theoremstyle{remark}
\newtheorem{assumption}[thm]{Assumption}
\newtheorem{asswlog}[thm]{Assumption w.l.o.g.}
\newtheorem{claim}[thm]{Claim}
\newtheorem{c-n-d}[thm]{Claim and Definition}
\newtheorem{consequence}[thm]{Consequence}
\newtheorem{construction}[thm]{Construction}
\newtheorem{computation}[thm]{Computation}
\newtheorem{example}[thm]{Example}
\newtheorem{explanation}[thm]{Explanation}
\newtheorem{notation}[thm]{Notation}
\newtheorem{obs}[thm]{Observation}
\newtheorem{rem}[thm]{Remark}
\newtheorem{question}[thm]{Question}
\newtheorem*{rem-nonumber}{Remark}
\newtheorem{setting}[thm]{Setting}
\newtheorem{warning}[thm]{Warning}

% Numbering of equations. Number equation subordniate to theorems.
\numberwithin{equation}{thm}

% Style for enumerated lists. The following makes sure that enumerated lists are
% numbered in the same way as equations are.
\setlist[enumerate]{label=(\thethm.\arabic*), before={\setcounter{enumi}{\value{equation}}}, after={\setcounter{equation}{\value{enumi}}}}

% Shorthand notations
\newcommand{\into}{\hookrightarrow}
\newcommand{\onto}{\twoheadrightarrow}
\newcommand{\wtilde}{\widetilde}
\newcommand{\what}{\widehat}

%
% HYPENTATION
%

\hyphenation{com-po-nents}
\hyphenation{pos-i-tive}
\hyphenation{Theo-rem}
\hyphenation{Vojta}


%
% SPECIALIZED MACROS
%

% CounterStep - increases equation counter
\newcommand\CounterStep{\addtocounter{thm}{1}\setcounter{equation}{0}}

% factor - quotient groups
\newcommand{\factor}[2]{\left. \raise 2pt\hbox{$#1$} \right/\hskip -2pt\raise -2pt\hbox{$#2$}}
