-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmathcommands-basic.sty
More file actions
152 lines (110 loc) · 3.58 KB
/
mathcommands-basic.sty
File metadata and controls
152 lines (110 loc) · 3.58 KB
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{basicmathcommands}[2021/10/12 Basic mathematics commands]
% Packages
\RequirePackage{mathtools}
\RequirePackage{bm}
% ======================= Formatting =======================
% Alternative overline (daleif p. 64 + email correspondence)
\DeclareRobustCommand\altoverline[2][0.8]{%
\mathmakebox[\widthof{\ensuremath{#2}}][c]{\overline{\mathmakebox[\widthof{\ensuremath{#2}}*\real{#1}][c]{#2}}}}
% ================= Symbols and operators ==================
% Constants
\DeclareMathOperator{\e}{\mathrm{e}}
% Greek letters
\renewcommand{\epsilon}{\varepsilon}
\renewcommand{\phi}{\varphi}
% Definitions
\newcommand{\defn}{\coloneqq}
\newcommand{\nfed}{\eqqcolon}
% ======================= Set theory =======================
% Set builder notation
\DeclarePairedDelimiterX{\set}[2]{\lbrace}{\rbrace}{#1\;\delimsize\vert\;#2} % Daleif uses \, on page 66
% Products
\let\oldprod\prod
\renewcommand*\prod\times
\newcommand*\bigprod\oldprod
% Unions and intersections
\newcommand*\union\cup
\newcommand*\intersect\cap
% New bigcup, bigcap, but use mathchoice to make sure it works between math styles (inline, display, etc.)
% \bigunion has to use \DeclareMathOperator and not \newcommand! Otherwise the limits don't work properly.
\DeclareMathOperator*{\smallbigcup}{\textstyle\bigcup}
\DeclareMathOperator*{\bigunion}{\mathchoice
{\smallbigcup}%
{\bigcup}%
{\bigcup}%
{\bigcup}%
}
\DeclareMathOperator*{\smallbigcap}{\textstyle\bigcap}
\DeclareMathOperator*{\bigintersect}{\mathchoice
{\smallbigcap}%
{\bigcap}%
{\bigcap}%
{\bigcap}%
}
% Symmetric difference
\newcommand{\symdiff}{\mathbin{\Delta}}
% ========================= Algebra =========================
% Miscellaneous
\newcommand\inv{^{-1}}
\newcommand{\preim}{^{-1}}
% Lattice operations
\newcommand{\meet}{\land}
\newcommand{\join}{\lor}
\DeclareMathOperator*{\smallbigvee}{\textstyle\bigvee}
\DeclareMathOperator*{\bigjoin}{\mathchoice
{\smallbigvee}%
{\bigvee}%
{\bigvee}%
{\bigvee}%
}
\DeclareMathOperator*{\smallbigwedge}{\textstyle\bigwedge}
\DeclareMathOperator*{\bigmeet}{\mathchoice
{\smallbigwedge}%
{\bigwedge}%
{\bigwedge}%
{\bigwedge}%
}
% ====================== Miscellaneous ======================
% Logic
\renewcommand{\implies}{\Rightarrow}
% Set theory
\DeclarePairedDelimiter{\card}{\lvert}{\rvert}
\newcommand{\powerset}[1]{2^{#1}}
% Functions
\DeclareMathOperator{\id}{id}
\newcommand*{\indicator}[1]{\mathbf{1}_{#1}}
% Number sets
\newcommand{\naturals}{\mathbb{N}}
\newcommand{\ints}{\mathbb{Z}}
\newcommand{\rationals}{\mathbb{Q}}
\newcommand{\reals}{\mathbb{R}}
\newcommand{\complex}{\mathbb{C}}
% Number sets for compatibility
\newcommand{\setN}{\naturals}
\newcommand{\setZ}{\ints}
\newcommand{\setQ}{\rationals}
\newcommand{\setR}{\reals}
\newcommand{\setC}{\complex}
% Complex numbers
\newcommand{\dotlessi}{\i}
\newcommand{\iu}{\operatorname{i}}
\renewcommand{\Re}{\operatorname{Re}}
\renewcommand{\Im}{\operatorname{Im}}
\newcommand{\conj}[1]{\altoverline{#1}}
% Vectors
\renewcommand{\vec}[1]{\bm{#1}}
\newcommand*\dotp\cdot
\newcommand*\crossp\times
% Norms and inner products
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
\DeclarePairedDelimiterX{\inner}[2]{\langle}{\rangle}{#1,#2}
% Calculus
\newcommand*\dif{\mathop{}\!\mathrm{d}}
\endinput
% Issues:
% - Need to implement big meet and join.
% - Need to implement different types of arrows, monos and epis.
% - Implement isomorphism symbol \cong.
% - Factor out linear algebra and calculus + more calculus commands like derivatives.