%% This is file `skmath.sty', generated from `skmath.tex' (key `package').
%% skmath improved math commands
%%
%% Copyright (C) 2012 by Simon Sigurdhsson <sigurdhsson@gmail.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainer of this work is Simon Sigurdhsson.
%%
%% This work consists of the file skmath.tex
%% and the derived file skmath.sty.

\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{skmath}%
    [2013/02/18 v0.1e skmath improved math commands]
\RequirePackage{xparse}
\PassOptionsToPackage{intlimits}{amsmath}
\RequirePackage{kvoptions,amssymb,mathtools,xfrac,isomath}
\SetupKeyvalOptions{family=skmath,prefix=skmath@}
\DeclareBoolOption[false]{commonsets}
\ProcessKeyvalOptions*
\ifskmath@commonsets
  \NewDocumentCommand\N{}{\ensuremath{\mathbb{N}}}
  \NewDocumentCommand\Z{}{\ensuremath{\mathbb{Z}}}
  \NewDocumentCommand\Q{}{\ensuremath{\mathbb{Q}}}
  \NewDocumentCommand\R{}{\ensuremath{\mathbb{R}}}
  \NewDocumentCommand\C{}{\ensuremath{\mathbb{C}}}
\fi
\DeclarePairedDelimiter\abs{\lvert}{\rvert}
\DeclarePairedDelimiter\norm{\lVert}{\rVert}
\AtBeginDocument{
  \DeclareDocumentCommand\E{m}{%
    \ensuremath{\mathop{\mathrm{E}}\left[#1\right]}%
  }
}
\DeclareDocumentCommand\P{m}{%
  \ensuremath{\mathop{\mathrm{P}}%
    \left(%
    \let\skmath@given\given%
    \DeclareDocumentCommand\given{}{\mid}%
    #1%
    \let\given\skmath@given%
    \right)%
  }%
}
  \DeclareDocumentCommand\var{m}{%
    \ensuremath{\mathop{\mathrm{Var}}\left(#1\right)}%
  }
  \DeclareDocumentCommand\cov{mm}{%
    \ensuremath{\mathop{\mathrm{Cov}}\left(#1,#2\right)}%
  }
\let\skmath@sin\sin
\let\skmath@cos\cos
\let\skmath@tan\tan
\let\skmath@cot\cot
\let\skmath@arcsin\arcsin
\let\skmath@arccos\arccos
\let\skmath@arccos\arctan
\let\skmath@ln\log
\let\skmath@log\log
\let\skmath@exp\exp
\RenewDocumentCommand\sin{om}{%
  \IfNoValueTF{#1}
    {\ensuremath{\skmath@sin\left(#2\right)}}
    {\ensuremath{\skmath@sin^{#1}\left(#2\right)}}%
}
\RenewDocumentCommand\cos{om}{%
  \IfNoValueTF{#1}
    {\ensuremath{\skmath@cos\left(#2\right)}}
    {\ensuremath{\skmath@cos^{#1}\left(#2\right)}}%
}
\RenewDocumentCommand\tan{om}{%
  \IfNoValueTF{#1}
    {\ensuremath{\skmath@tan\left(#2\right)}}
    {\ensuremath{\skmath@tan^{#1}\left(#2\right)}}%
}
\RenewDocumentCommand\cot{om}{%
  \IfNoValueTF{#1}
    {\ensuremath{\skmath@cot\left(#2\right)}}
    {\ensuremath{\skmath@cot^{#1}\left(#2\right)}}%
}
\RenewDocumentCommand\arcsin{m}{%
  \ensuremath{\skmath@arcsin\left(#1\right)}%
}
\RenewDocumentCommand\arccos{m}{%
  \ensuremath{\skmath@arccos\left(#1\right)}%
}
\RenewDocumentCommand\arctan{m}{%
  \ensuremath{\skmath@arctan\left(#1\right)}%
}
\RenewDocumentCommand\ln{m}{%
  \ensuremath{\skmath@ln\left(#1\right)}%
}
\RenewDocumentCommand\log{om}{%
  \IfNoValueTF{#1}
    {\ensuremath{\skmath@log\left(#2\right)}}
    {\ensuremath{\skmath@log_{#1}\left(#2\right)}}%
}
\RenewDocumentCommand\exp{m}{\ensuremath{\mathchoice%
  {e^{#1}}%
  {\skmath@exp\left(#1\right)}%
  {\skmath@exp\left(#1\right)}%
  {\skmath@exp\left(#1\right)}%
}}
\RenewDocumentCommand\frac{mm}{\genfrac{}{}{}{}%
             {\displaystyle #1}{\displaystyle #2}}
\RenewDocumentCommand\bar{m}{%
    \ensuremath{\mkern 1.5mu\overline{\mkern-1.5mu{#1}\mkern-1.5mu}\mkern 1.5mu}}
\AtBeginDocument{%
\DeclareDocumentCommand\d{m}{\ensuremath{\,\mathrm{d}#1%
                              \@ifnextchar\d{\!}{}}}
}
\let\vec\vectorsym
\endinput

