% This is the LaTeX preamble code used for all typesetting by the
% notebook UI. It is very similar to ../client_server/notebook.tex;
% keep them in sync.

\usepackage{setspace}
\usepackage[fleqn]{amsmath}
\usepackage{color}
\usepackage{ytableau}
\usepackage{etoolbox}
\usepackage{amssymb}  
\newcommand{\sech}{\operatorname{sech}} 
\newcommand{\csch}{\operatorname{csch}}
\newcommand{\arcsec}{\operatorname{arcsec}}
\newcommand{\arccot}{\operatorname{arccot}}
\newcommand{\arccsc}{\operatorname{arccsc}}
\newcommand{\arccosh}{\operatorname{arccosh}}
\newcommand{\arcsinh}{\operatorname{arcsinh}}
\newcommand{\arctanh}{\operatorname{arctanh}}
\newcommand{\arcsech}{\operatorname{arcsech}}
\newcommand{\arccsch}{\operatorname{arccsch}}
\newcommand{\arccoth}{\operatorname{arccoth}}
\usepackage[utf8]{inputenc}
%\usepackage{inconsolata}
\usepackage[parfill]{parskip}
%\usepackage{tableaux}
\def\specialcolon{\mathrel{\mathop{:}}\hspace{-.5em}}
\renewcommand{\bar}[1]{\overline{#1}}
\newcommand{\algorithm}[2]{{\tt\Large\detokenize{#1}}\\[1ex]
{\emph{#2}}\\[1ex]
}
\newcommand{\property}[2]{{\tt\Large\detokenize{#1}}\\[1ex]
{\emph{#2}}\\[1ex]
}
\newcommand{\package}[2]{{\tt\Large\detokenize{#1}}\\[1ex]
{{\bfseries\Large #2}}\\[1ex]
}
\newcommand{\algo}[1]{{\tt \detokenize{#1}}}
\newcommand{\prop}[1]{{\tt \detokenize{#1}}}
\renewcommand{\author}[1]{{\bfseries \detokenize{#1}}}
\newcommand{\email}[1]{, {\tt \detokenize{#1}}}

\newcommand{\bigO}{{\cal O}}

% \newcommand{\sequence}[2]{{#1}\ldots{#2}}

% Math expressions wrapped in \brwrap will get typeset with
% round brackets around them, which have the appropriate size.
% The expression itself can still be broken over multiple lines.

\newcommand\brwrap[3]{%
  \setbox0=\hbox{$#2$}
  \left#1\vbox to \the\ht0{\hbox to 0pt{}}\right.\kern-.2em
  \begingroup #2\endgroup\kern-.15em
  \left.\vbox to \the\ht0{\hbox to 0pt{}}\right#3
}
%\message{\meaning\brwrap{\frac{A}{B}}}
\everymath{\makeatletter\def\old@comma{,}\catcode`\,=13 \def,{%
\ifmmode\old@comma\discretionary{}{}{}\else\old@comma\fi}\makeatother}

%  \left.\vbox to \brwrapht {\hbox to 0pt{!}}\right)%

% Long formulas are much easier to read if they break such that
% the '+' or '-' sign ends up on the next line, not at the end
% of the previous

% \makeatletter
% \newcommand{\DeclareMathActive}[2]{%
%   % #1 is the character, #2 is the definition
%   \expandafter\edef\csname keep@#1@code\endcsname{\mathchar\the\mathcode`#1 }
%   \begingroup\lccode`~=`#1\relax
%   \lowercase{\endgroup\def~}{#2}%
%   \AtBeginDocument{\mathcode`#1="8000 }%
% }
% 
% \DeclareMathActive{+}{\mathbreak\std{+}}
% 
% \newcommand{\std}[1]{\csname keep@#1@code\endcsname}
% \patchcmd{\newmcodes@}{\mathcode`\-\relax}{\std@minuscode\relax}{}{\ddt}
% \AtBeginDocument{\edef\std@minuscode{\the\mathcode`-}}
% \makeatother
% 
% \def\mathbreak{\discretionary{}{}{}}
% 

% % Typesetting Young tableaux, originally in a separate style
% % file, now included to avoid path searching problems. 
% % Some internals for the typesetting macros below; nothing
% % user-servicable here; please read on.
% 
% \def\@tabforc#1#2#3{\expandafter\tabf@rc\expandafter#1{#2 \^}{#3}}
% \def\tabf@@rc#1#2#3\tabf@@rc#4{\def#1{#2}#4\tabf@rc#1{#3}{#4}}
% \long\def\ReturnAfterFi#1\fi{\fi#1}
%     \def\tabf@rc#1#2#3{%
%       \def\temp@ty{#2}%
%       \ifx\@empty\temp@ty
%       \else
%         \ReturnAfterFi{%
%           \tabf@@rc#1#2\tabf@@rc{#3}%
%         }%
%       \fi
%     }%
% 
% % Sorry, some global registers for sizes and keeping track of
% % measurements.
%     
% \newdimen\ytsize\ytsize=2mm
% \newdimen\ytfsize\ytfsize=4mm
% \newcount\repcnt
% \newdimen\acchspace
% \newdimen\accvspace
% \newdimen\raiseh
% \newdimen\maxw
% 
% \newcommand\phrule[1]{\hbox{\vbox to0pt{\hrule height .2pt width#1\vss}}}
% 
% % Typeset a Young tableau with filled boxes. Takes a single 
% % argument which is a string of symbols for each row,
% % separated by commas. Examples:
% %
% %   \ftableau{abc,de}
% %   \ftableau{ab{d_2},f{g_3}}
% 
% \newcommand\ftableau[1]{%
% \def\ctest{,}
% \def\Ktest{\^}
% \acchspace=0ex
% \accvspace=0ex
% \maxw=0ex
% \vbox{\hbox{%
% \@tabforc\thisel{#1}{%
%  \ifx\thisel\Ktest{%
%      \ifnum\maxw=0\maxw=\acchspace\fi%
%      \raisebox{\accvspace}{\vbox to \ytfsize{\hbox to
% 		 0pt{\vrule height \ytfsize\hss}}}\kern\acchspace\kern-\maxw}
%  \else\ifx\thisel\ctest
%      \ifnum\maxw=0\maxw=\acchspace\fi%
%      \raisebox{\accvspace}{\vbox to \ytfsize{\hbox to 0pt{\vrule height \ytfsize\hss}}}%
%      \kern\acchspace\acchspace=0ex
% 	  \advance\accvspace by -\ytfsize
%  \else
%      \setbox3=\hbox{$\thisel$}%
% 	  \raiseh=\ytfsize%
% 	  \advance\raiseh by -1ex%
% 	  \divide\raiseh by 2%
%      \advance\acchspace by-\ytfsize%
%      \raisebox{\accvspace}{\vbox to \ytfsize{\hrule\hbox to%
%         \ytfsize{\vrule height \ytfsize\hskip.5ex%
%          \raisebox{\raiseh}{\tiny$\thisel$}\hss}\vss\phrule{\ytfsize}}}%
%  \fi\fi}}}}
% 
% % Typeset a Young tableau with unlabelled boxes. Takes a single 
% % argument which is a string of numbers, one for the length of
% % each row of the tableau. Example:
% %
% %   \tableau{{10}{8}{3}}
% %
% % typesets a tableau with 10 boxes in the 1st row, 8 in the 2nd
% % and 3 in the 3rd. Curly brackets can be omitted if numbers
% % are less than 10.
% 
% \newcommand\tableau[1]{%
% \def\stest{ }
% \def\Ktest{\^}
% \acchspace=0ex
% \accvspace=0ex
% \maxw=0ex
% \hbox{%
% \@tabforc\thisel{#1}{%
%  \ifx\thisel\Ktest{}
%  \else
%      \repcnt=\thisel%
%      \loop{}%
%      \advance\acchspace by-\ytsize%
%      \raisebox{\accvspace}{\vbox to \ytsize{\hrule \hbox to%
% 			\ytsize{\vrule height \ytsize\hss}\vss\phrule{\ytsize}}}%
%      \advance\repcnt by -1\ifnum\repcnt>1{}\repeat%
%      \ifnum\maxw=0\maxw=\acchspace\fi%
%      \raisebox{\accvspace}{\vbox to \ytsize{\hbox to 0pt{\vrule height \ytsize\hss}}}%
%      \kern\acchspace\acchspace=0ex%
% 	  \advance\accvspace by -\ytsize%
%  \fi}\kern-\maxw}}
 
\ytableausetup{centertableaux}

% Document start.

\begin{document}
\pagestyle{empty}\everymath{\displaystyle}
\renewcommand{\arraystretch}{1.2}
\tolerance=10000
\relpenalty=10
\binoppenalty=10
\hyphenpenalty=10
\raggedright

% Ensure that maths broken over multiple lines has a bit of spacing
% between lines.
\lineskiplimit=0mm
\lineskip=1.5ex
