%auto-ignore
%!TEX root = blob1.tex
%this ensures the arxiv doesn't try to start TeXing here.

\usepackage{amsmath,amssymb,amsfonts,amsthm}
\usepackage{ifpdf}

\usepackage[all,color]{xy}
\SelectTips{cm}{}
% This may speed up compilation of complex documents with many xymatrices.
%\CompileMatrices

\usepackage[section]{placeins}
\usepackage{leftidx}
\usepackage{stmaryrd} % additional math symbols, e.g. \mapsfrom
\usepackage{microtype}


% ----------------------------------------------------------------
\vfuzz2pt % Don't report over-full v-boxes if over-edge is small
\hfuzz2pt % Don't report over-full h-boxes if over-edge is small
% ----------------------------------------------------------------

% don't warn about PDF 1.5 (default was 1.4); dangerous?
\pdfminorversion=5

% diagrams -------------------------------------------------------
% figures ---------------------------------------------------------
\newcommand{\pathtodiagrams}{\pathtotrunk diagrams/}

\newcommand{\mathfig}[2]{\ensuremath{\hspace{-3pt}\begin{array}{c}%
  \raisebox{-2.5pt}{\includegraphics[width=#1\textwidth]{\pathtodiagrams #2}}%
\end{array}\hspace{-3pt}}}
\newcommand{\reflectmathfig}[2]{{\hspace{-3pt}\begin{array}{c}%
  \raisebox{-2.5pt}{\reflectbox{\includegraphics[width=#1\textwidth]{\pathtodiagrams #2}}}%
\end{array}\hspace{-3pt}}}
\newcommand{\rotatemathfig}[3]{{\hspace{-3pt}\begin{array}{c}%
  \raisebox{-2.5pt}{\rotatebox{#2}{\includegraphics[height=#1\textwidth]{\pathtodiagrams #3}}}%
\end{array}\hspace{-3pt}}}
\newcommand{\placefig}[2]{\includegraphics[width=#1\linewidth]{\pathtodiagrams #2}}

\newcommand{\arxiv}[1]{\href{http://arxiv.org/abs/#1}{\tt arXiv:\nolinkurl{#1}}}
\newcommand{\doi}[1]{\href{http://dx.doi.org/#1}{{\tt DOI:#1}}}
\newcommand{\euclid}[1]{\href{http://projecteuclid.org/euclid.cmp/#1}{{\tt at Project Euclid: #1}}}
\newcommand{\mathscinet}[1]{\href{http://www.ams.org/mathscinet-getitem?mr=#1}{\tt #1}}
\newcommand{\googlebooks}[1]{(preview at \href{http://books.google.com/books?id=#1}{google books})}


% THEOREMS -------------------------------------------------------
\theoremstyle{plain}
%\newtheorem*{fact}{Fact}
\newtheorem{prop}{Proposition}[subsection]
\makeatletter
\@addtoreset{prop}{section}
\makeatother
\newtheorem{conj}[prop]{Conjecture}
\newtheorem{thm}[prop]{Theorem}
\newtheorem{lem}[prop]{Lemma}
\newtheorem*{lem*}{Lemma}
\newtheorem{cor}[prop]{Corollary}
\newtheorem*{cor*}{Corollary}
\newtheorem*{exc}{Exercise}
\newtheorem{defn}[prop]{Definition}         % numbered definition
\newtheorem*{defn*}{Definition}             % unnumbered definition
\newtheorem{question}{Question}
\newtheorem{property}[prop]{Property}
\newtheorem{axiom}[prop]{Axiom}
\newtheorem{module-axiom}[prop]{Module Axiom}
\newenvironment{rem}{\noindent\textsl{Remark.}}{}  % perhaps looks better than rem above?
\newtheorem{rem*}[prop]{Remark}
\numberwithin{equation}{section}
%% example, claim and remark are defined in article_preamble.tex, for compatibility with beamer and PNAS


% Marginal notes in draft mode -----------------------------------
\newcommand{\scott}[1]{\stepcounter{comment}{{\color{blue} $\star^{(\arabic{comment})}$}}\marginpar{\color{blue}  $\star^{(\arabic{comment})}$ \usefont{T1}{scott}{m}{n}  #1 --S}}     % draft mode
\newcommand{\kevin}[1]{\stepcounter{comment}{\color[rgb]{.2,.5,.6} $\star^{(\arabic{comment})}$}\marginpar{\color{green}  $\star^{(\arabic{comment})}$  #1 --K}}     % draft mode
\newcommand{\comment}[1]{\stepcounter{comment}$\star^{(\arabic{comment})}$\marginpar{\tiny $\star^{(\arabic{comment})}$ #1}}     % draft mode
\newcounter{comment}
\newcommand{\noop}[1]{}
\newcommand{\todo}[1]{\textbf{\color[rgb]{.8,.2,.5}\small TODO: #1}}

% \mathrlap -- a horizontal \smash--------------------------------
% For comparison, the existing overlap macros:
% \def\llap#1{\hbox to 0pt{\hss#1}}
% \def\rlap#1{\hbox to 0pt{#1\hss}}
\def\clap#1{\hbox to 0pt{\hss#1\hss}}
\def\mathllap{\mathpalette\mathllapinternal}
\def\mathrlap{\mathpalette\mathrlapinternal}
\def\mathclap{\mathpalette\mathclapinternal}
\def\mathllapinternal#1#2{%
\llap{$\mathsurround=0pt#1{#2}$}}
\def\mathrlapinternal#1#2{%
\rlap{$\mathsurround=0pt#1{#2}$}}
\def\mathclapinternal#1#2{%
\clap{$\mathsurround=0pt#1{#2}$}}

% MATH -----------------------------------------------------------
\newcommand{\Natural}{\mathbb N}
\newcommand{\Integer}{\mathbb Z}
\newcommand{\Rational}{\mathbb Q}
\newcommand{\Real}{\mathbb R}
\newcommand{\Complex}{\mathbb C}
\newcommand{\Field}{\mathbb F}

\newcommand{\id}{\boldsymbol{1}}
\renewcommand{\imath}{\mathfrak{i}}
\renewcommand{\jmath}{\mathfrak{j}}

\newcommand{\qRing}{\Integer[q,q^{-1}]}
\newcommand{\qMod}{\qRing-\operatorname{Mod}}
\newcommand{\ZMod}{\Integer-\operatorname{Mod}}

\newcommand{\lmod}[1]{\leftidx{_{#1}}{\operatorname{mod}}{}}

\newcommand{\HC}{\operatorname{Hoch}}
\newcommand{\HH}{\operatorname{HH}}

\newcommand{\cell}{\mathfrak{D}}

\def\bc{{\mathcal B}}
\def\btc{{\mathcal{BT}}}

\newcommand{\into}{\hookrightarrow}
\newcommand{\onto}{\twoheadrightarrow}
\newcommand{\iso}{\cong}
\newcommand{\quism}{\underset{\text{q.i.}}{\simeq}}
\newcommand{\htpy}{\simeq}
\newcommand{\actsOn}{\circlearrowright}
\newcommand{\xto}[1]{\xrightarrow{#1}}
\newcommand{\isoto}{\xto{\iso}}
\newcommand{\quismto}{\xrightarrow[\text{q.i.}]{\iso}}
\newcommand{\diffeoto}{\xrightarrow[\text{diffeo}]{\iso}}
\newcommand{\htpyto}{\xrightarrow[\text{htpy}]{\htpy}}

\newcommand{\restrict}[2]{#1{}_{\mid #2}{}}
\newcommand{\set}[1]{\left\{#1\right\}}
\newcommand{\setc}[2]{\setcl{#1}{#2}}
\newcommand{\setcl}[2]{\left\{ \left. #1 \;\right| \; #2 \right\}}
\newcommand{\setcr}[2]{\left\{ #1 \;\left| \; #2 \right\}\right.}
\newcommand{\relations}[2]{\left<#1 \;\left| \; #2 \right. \right>}
\newcommand{\cone}[3]{C\left(#1 \xrightarrow{#2} #3\right)}
\newcommand{\pairing}[2]{\left\langle#1 ,#2 \right\rangle}

\newcommand{\floor}[1]{\left\lfloor#1\right\rfloor}
\newcommand{\norm}[1]{\left|\left|#1\right|\right|}
\newcommand{\abs}[1]{\left|#1\right|}

\newcommand{\card}[1]{\sharp{#1}}

\newcommand{\bdy}{\partial}
\newcommand{\compose}{\circ}
\newcommand{\eset}{\emptyset}

\newcommand{\psmallmatrix}[1]{\left(\begin{smallmatrix} #1 \end{smallmatrix}\right)}

\newcommand{\directSum}{\oplus}
\newcommand{\DirectSum}{\bigoplus}
\newcommand{\tensor}{\otimes}
\newcommand{\Tensor}{\bigotimes}

%\newcommand{\selfarrow}{\ensuremath{\!\!\!\!\!\!\xymatrix{ \ar@(ru,rd)@<-1ex>[]}\phantom{++.\!\!}}}
%\newsavebox{\selfarrowcontents}
%\savebox{\selfarrowcontents}{\selfarrow}
%\renewcommand{\selfarrow}{\usebox{\selfarrowcontents}}
\newcommand{\selfarrow}{\ensuremath{\smash{\tikz[baseline]{\clip (0,0.36) rectangle (0.48,-0.16); \draw[->] (0,0.2) .. controls (0.6,0.8) and (0.6,-0.6) .. (0,0);}}}}

\newcommand{\CM}[2]{C_*(\Maps(#1 \to #2))}
\newcommand{\CD}[1]{C_*(\Diff(#1))}
\newcommand{\CH}[1]{C_*(\Homeo(#1))}

\newcommand{\colimit}[1]{\underrightarrow{#1}}

\newcommand{\Set}{\text{\textbf{Set}}}
\newcommand{\Vect}{\text{\textbf{Vect}}}
\newcommand{\Kom}{\text{\textbf{Kom}}}
\newcommand{\Cat}{\mathcal{C}}

\newcommand{\Bord}{\operatorname{Bord}}

\newcommand{\Inv}[1]{\operatorname{Inv}\left(#1\right)}
\newcommand{\Hom}[3]{\operatorname{Hom}_{#1}\left(#2,#3\right)}
\newcommand{\End}[1]{\operatorname{End}\left(#1\right)}
\newcommand{\Obj}{\operatorname{Obj}}

\newenvironment{narrow}[2]{%
\vspace{-0.4cm}% horrible hack, by scott % this only seems to be appropriate in beamer mode...
\begin{list}{}{%
\setlength{\topsep}{0pt}%
\setlength{\leftmargin}{#1}%
\setlength{\rightmargin}{#2}%
\setlength{\listparindent}{\parindent}%
\setlength{\itemindent}{\parindent}%
\setlength{\parsep}{\parskip}}%
\item[]}{\end{list}}
% ----------------------------------------------------------------


