% REQUIRES genmacs.tex and color package for \cancel

%  ADDING ``LOGLIKE FUNCTIONS''

\newcommand{\loglike}[1]{\mathop{\rm #1}\nolimits}
 % Elsevier style suggests \mathop{\mathrm{#1}}
 % But I think \nolimits is generally desirable or harmless.
 % \mathrm is the LaTeX2e alternative to \rm.

%  LOGLIKE FUNCTIONS

\newcommand{\E}{\loglike{E}}
\newcommand{\Var}{\loglike{Var}}
\newcommand{\erfc}{\loglike{erfc}}
\newcommand{\length}{\loglike{length}}

%  LOG EXPRESSIONS

\newcommand{\lgn}{\lg n}
\newcommand{\lglgn}{\lg\lg n}
\newcommand{\lgnlglgn}{\lg n\lg\lg n}
\newcommand{\lgolglgn}{\frac{\lg n}{\lg\lg n}}

%  DELIMITER PAIRS AND ADDITIONAL MATHEMATICAL FUNCTIONS

\newcommand{\set}[1]{\left\{#1\right\}}
\newcommand{\enumset}[1]{\left\{#1\right\}}
\newcommand{\condset}[1]{\left\{\,#1\,\right\}}
\newcommand{\barset}[2]{\condset{#1\mid #2}}
\newcommand{\colonset}[2]{\condset{#1:#2}}
\newcommand{\powerset}[1]{{\cal P}(#1)}
\newcommand{\abs}[1]{\left|#1\right|}
\newcommand{\card}[1]{\left|#1\right|}
\newcommand{\norm}[1]{\left\|#1\right\|}
\newcommand{\bigo}[1]{O\left(#1\right)}
% Used to read: \newcommand{\bigo}[1]{O\hspace*{-1mm}\left(#1\right)}
% Should use ems instead of mms if spacing doesn't look right.
\newcommand{\Ocard}[1]{O\left(\card{#1}\right)}
\newcommand{\floor}[1]{\left\lfloor#1\right\rfloor}
\newcommand{\ceil}[1]{\left\lceil#1\right\rceil}
\newcommand{\ang}[1]{\ifmmode{\left\langle#1\right\rangle}
   \else{$\left\langle${#1}$\right\rangle$}\fi}
        % the \if allows use outside mathmode,
        % but will swallow following space there!
\newcommand{\prob}[1]{\Pr\left\{#1\right\}}
\newcommand{\expect}[1]{\E\left[#1\right]}
\newcommand{\variance}[1]{\Var\left[#1\right]}

%  BINARY OPERATION, RELATION, AND ARROW SYMBOLS

\newcommand{\propsubset}
    {\stackrel{\subset}{\scriptscriptstyle \not {\scriptstyle =}}}
\newcommand{\polyred}{\leq_p}
\newcommand{\logred}{\leq_L}
\newcommand{\dhrightarrow}{\rightarrow \hspace*{-15pt} \rightarrow}
\newcommand{\divides}{\mid}
\newcommand{\notdiv}{\not\:\mid}
\newcommand{\includes}{\ni} % reverse of element membership in set
%\newcommand{\union}{\cup}
%\newcommand{\intersect}{\cap}
% Better to remember above two built-ins and not trample on a name like \union
% that could have another use.

%  OTHER MATHEMATICAL SYMBOLS OR CONSTRUCTS

\newcommand{\half}{\frac{1}{2}}
\newcommand{\recip}[1]{\frac{1}{#1}}
\newcommand{\degree}{^{\circ}}
\newcommand{\degrees}{^{\circ}}
\makeatletter\@ifundefined{implies}{\newcommand{\implies}{\Rightarrow}}{}\makeatother % \iff is defined by plain and lplain
\renewcommand{\choose}[2]{{{#1}\atopwithdelims(){#2}}}
\newcommand{\js}[2]{\left(\frac{#1}{#2}\right)}  % Jacobi symbol
\newcommand{\ls}[2]{\choose{#1}{#2}}  % Legendre symbol
\makeatletter % the value of \choose{n}{r} is \multifac{n}{r,n-r}
\newcommand{\multifac}[2]{\frac{#1!}{\@for\facitem:=#2\do{\facitem!\,}\!}}
\makeatother % can also use \multifac for values of multinomial numbers
\newcommand{\lap}[1]{{\cal L}(#1)}  % Laplace Transform
\newcommand{\lapinv}[1]{{\cal L}^{-1}(#1)}  % Inverse Laplace Transform
\newcommand{\sumres}[2]{\sum\limits_{\stackrel{\scriptscriptstyle #2}{\scriptscriptstyle #1}}}
\newcommand{\prodres}[2]{\prod\limits_{\stackrel{\scriptscriptstyle #2}{\scriptscriptstyle #1}}}
%\newcommand{\goesto}[1]{\stackrel{#1}{\rightarrow}}
%\newcommand{\pgoesto}[1]{\stackrel{#1}{\dhrightarrow}}
\newcommand{\goesto}{\rightarrow}
\newcommand{\function}[3]{#1\colon #2\rightarrow #3}
\newcommand{\der}[1]{\frac{d}{d#1}}
\def\cancel{\rlap{{\shadow /}}}

%  VECTORS AND MATRICES

\newcommand{\seq}[3]{#1_{#2} \cdots #1_{#3}}
\newcommand{\mat}[6]
    {\parbox{#6}
        {$#1_{#2\hspace{.01in} #4} \ldots #1_{#2\hspace{.01in} #5}$\\
         \hspace*{.03in} .\\
         \hspace*{.03in} .\\
         \hspace*{.03in} .\\
         $#1_{#3\hspace{.01in} #4} \ldots #1_{#3\hspace{.01in} #5}$}}
\newcommand{\vect}[4]
    {\parbox{#4}
        {$#1_{#2}$\\
         \makebox[#4]{.}\\
         \makebox[#4]{.}\\
         \makebox[#4]{.}\\
         $#1_{#3}$}}

% NUMBER THEORY SYMBOLS

\newcommand{\ntsymbols}
           {%\font \ntfont=bbb10 at 12truept
            \newcommand{\ntfont}{\mathbb} % May require using amsfonts package
            \newcommand{\R}{{\ntfont R}}
            \newcommand{\Q}{{\ntfont Q}}
            \newcommand{\Z}{{\ntfont Z}}
            \newcommand{\N}{{\ntfont N}}
            \newcommand{\zp}{{\ntfont Z}_p}
            \newcommand{\zpstar}{\zp^*}
            \newcommand{\zn}{{\ntfont Z}_n}
            \newcommand{\znstar}{\zn^*}
            \newcommand{\zstar}[1]{{\ntfont Z}_{##1}^*}}

%  LINGUISTIC CONVENIENCES

\newcommand{\st}{such that }
