\newcommand\ifpub[2]{\if\published y #1 \else #2 \fi}

\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\newtheorem{principle}[theorem]{Principle}
\newtheorem{axiom}[theorem]{Axiom}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{defprop}[theorem]{Definition-Proposition}
\newtheorem{fact}[theorem]{Fact}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{Truth}[theorem]{Truth}
\newtheorem{AlmostTruth}[theorem]{Almost Truth}
\newtheorem{conjecture}[theorem]{Conjecture}
\newtheorem{slogan}[theorem]{Slogan}

\theoremstyle{definition}
\newtheorem{convention}[theorem]{Convention}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{defwarn}[theorem]{Definition and Warning}
\newtheorem{figcap}[theorem]{Figure}
\newtheorem{image}[theorem]{Image}
\newtheorem{lemmadefinition}[theorem]{Lemma-Definition}
\newtheorem{problem}[theorem]{Problem}
\newtheorem{question}[theorem]{Question}
\newtheorem{solution}[theorem]{Solution}
\newtheorem{prize}[theorem]{Prize}

\newtheorem{comment}[theorem]{Comment}
\newtheorem{comments}[theorem]{Comments}
\newtheorem{discussion}[theorem]{Discussion}
\newtheorem{example}[theorem]{Example}
\newtheorem{exercise}[theorem]{Exercise}
\newtheorem{hint}[theorem]{Hint}
\newtheorem{motivation}[theorem]{Motivation}
\newtheorem{note}[theorem]{Note}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{warning}[theorem]{Warning}

\newcommand{\prtag}[1]{\tag*{\llap{$#1$\hskip-\displaywidth}}}

\newcommand{\mathmode}[1]{$#1$}
\newlength{\standardunitlength}
\setlength{\standardunitlength}{0.00083333in}

\newcommand{\ad}{\operatorname{ad}}
\newcommand{\Ad}{\operatorname{Ad}}
\newcommand{\Alt}{\operatorname{Alt}}
\newcommand{\Aut}{\operatorname{Aut}}
\newcommand{\Diff}{\operatorname{Diff}}
\newcommand{\End}{\operatorname{End}}
\newcommand{\gr}{\operatorname{gr}}
\newcommand{\im}{\operatorname{im}}
\newcommand{\mor}{\operatorname{mor}}
\newcommand{\Span}{\operatorname{span}}
\newcommand{\sign}{\operatorname{sign}}
\newcommand{\sym}{\operatorname{sym}}
\newcommand{\tr}{\operatorname{tr}}

\def\car{\reflectbox{\usym{1F697}}}
\def\rac{\usym{1F697}}

\def\qed{{\linebreak[1]\null\hfill\text{$\Box$}}}

\newlength{\globalparindent}
\setlength{\globalparindent}{\parindent}

%\newcommand{\udot}{{\mathaccent\cdot\cup}}

\def\proof{{\par\noindent {\em Proof. } }}

\def\arXiv#1{{\href{https://arxiv.org/abs/#1}{arXiv:\linebreak[0]#1}}}

\def\weburl{http://drorbn.net/SL2PO}
\def\web#1{\href{\weburl/#1}{\begin{greek}web\end{greek}/#1}}

\def\bbe{{\mathbb e}}
\def\bbA{{\mathbb A}}
\def\bbB{{\mathbb B}}
\def\bbC{{\mathbb C}}
\def\bbD{{\mathbb D}}
\def\bbE{{\mathbb E}}
\def\bbF{{\mathbb F}}
\def\bbH{{\mathbb H}}
\def\bbN{{\mathbb N}}
\def\bbQ{{\mathbb Q}}
\def\bbR{{\mathbb R}}
\def\bbV{{\mathbb V}}
\def\calB{{\mathcal B}}
\def\calD{{\mathcal D}}
\def\calF{{\mathcal F}}
\def\calG{{\mathcal G}}
\def\calK{{\mathcal K}}
\def\calL{{\mathcal L}}
\def\calR{{\mathcal R}}
\def\calU{{\mathcal U}}
\def\fraka{{\mathfrak a}}
\def\frakb{{\mathfrak b}}
\def\frakd{{\mathfrak d}}
\def\frakg{{\mathfrak g}}
\def\frakh{{\mathfrak h}}
\def\frakl{{\mathfrak l}}
\def\frakn{{\mathfrak n}}
\def\fraku{{\mathfrak u}}
\def\hatcalU{\hat{\mathcal U}}

\def\act{{\hspace{-1pt}\sslash\hspace{-0.75pt}}}

\def\Hom{\operatorname{Hom}}
\def\Id{\text{\it Id}}
\def\sleps{{sl_{2+}^\eps}}

\def\draftcut{\if\draft y \cleardoublepage \fi}
%\def\draftcut{\cleardoublepage}

\definecolor{lightred}{RGB}{255, 217, 217}
\def\lightred#1{\setlength{\fboxsep}{0pt}\colorbox{lightred}{#1}}
\def\gray{\color{gray}}
\def\red{\color{red}}
\def\yellowm#1{{\setlength{\fboxsep}{0pt}\colorbox{yellow}{$#1$}}}
\def\yellowt#1{{\setlength{\fboxsep}{0pt}\colorbox{yellow}{#1}}}

% Following
% http://tex.stackexchange.com/questions/23521/tabular-vertical-alignment-to-top
\def\imagetop#1{\vtop{\null\hbox{#1}}}

\def\ds{\displaystyle}

\def\eps{\epsilon}
\def\so{\mathfrak{so}}
\def\gl{\mathfrak{gl}}
\def\spl{\mathfrak{sl}}
\def\slneps{{\spl_{n+}^\eps}}
\def\glneps{{\gl_{n+}^\eps}}

\def\endpar#1{~\hfill\fbox{\footnotesize#1}}

\def\ip{{i^+}} \def\jp{{j^+}} \def\kp{{k^+}}
\def\ipp{{i^{+\!+}}} \def\jpp{{j^{+\!+}}} \def\kpp{{k^{+\!+}}}

\def\face{\input{figs/face.pdf_t}}
\def\human{\input{figs/human.pdf_t}}
\def\machine{\input{figs/machine.pdf_t}}

\ifpub{\def\cellscale{0.76}}{\def\cellscale{1}}
\newsavebox\pdfbox
\newlength{\pdfheight}

\def\nbpdfInput#1{{%
  \savebox{\pdfbox}{\includegraphics[scale=\cellscale]{#1}}%
  \settoheight{\pdfheight}{\usebox{\pdfbox}}%
  %\uselengthunit{mm}\printlength{\pdfheight}%
  \noindent\imagetop{\ifdim\pdfheight<10mm\face\else\human\fi}\ %
  \imagetop{\usebox{\pdfbox}}%
  \vskip 2mm%
}}

\def\nbpdfEcho#1{{\noindent{\imagetop{\machine}\ \imagetop{\includegraphics[scale=\cellscale]{#1}}\vskip 2mm}}}
\def\nbpdfMessage#1{{\noindent{\imagetop{\machine}\ \imagetop{\includegraphics[scale=\cellscale]{#1}}\vskip 2mm}}}
\def\nbpdfOutput#1{{\noindent{\imagetop{\machine}\ \imagetop{\includegraphics[scale=\cellscale]{#1}}\vskip 2mm}}}
\def\nbpdfPrint#1{{\noindent{\imagetop{\machine}\ \imagetop{\includegraphics[scale=\cellscale]{#1}}\vskip 2mm}}}
