summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/skmath/skmath.sty
blob: c378474654a77281fe2dad43428b5b903da083f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
%% 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