-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpreamble_math.sty
280 lines (247 loc) · 11.8 KB
/
preamble_math.sty
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
\usepackage{amsthm, amsmath, mathtools, amssymb, physics} % for math and physics commands and symbols.
%%%%%%% Math-commands %%%%%%%
%%% GENERAL
\newcommand{\function}[5]{
\if\relax\detokenize{#1}\relax % first argument empty
\begin{array}{c@{\hspace{0.5\tabcolsep}}c@{\hspace{0.5\tabcolsep}}c}
#2 & \longrightarrow & #3 \\
#4 & \longmapsto & #5
\end{array}
\else % first argument non-empty
\begin{array}{r@{\hspace{0.5\tabcolsep}}c@{\hspace{0.5\tabcolsep}}c@{\hspace{0.5\tabcolsep}}c}
#1: & #2 & \longrightarrow & #3 \\
& #4 & \longmapsto & #5
\end{array}
\fi
} % 1 - name of the function
% 2 - domain
% 3 - image
% 4 - element in the domain
% 5 - element in the image
\newcommand{\rrightarrow}{\mathrel{\mathrlap{\rightarrow}\mkern1mu\rightarrow}} % a larger version of \twoheadrightarrow
% Default \Re{} for real part of a number
% Default \Im{} for imaginary part of a number
% Default \abs for absolute value. \newcommand{\abs}[1]{\lvert#1\rvert}
\newcommand{\floor}[1]{
\left\lfloor #1 \right\rfloor
}
\newcommand{\ceil}[1]{
\left\lceil #1 \right\rceil
}
%%% CALCULUS
% command \grad is by default \nabla in bold face
% \renewcommand{\grad}{\operatorname{\vf{grad}}} % gradient
\DeclareMathOperator{\rot}{\vf{rot}} % curl
\DeclareMathOperator{\rotp}{\vf{\nabla}\times} % curl for physics
\renewcommand{\div}{\operatorname{\vf{div}}} % divergence
\DeclareMathOperator{\divp}{\vf{\nabla}\cdot} % divergence for physics
% command \laplacian is by default \nabla^2
%\newcommand{\laplacian}{\nabla^2} % laplacian
\renewcommand{\laplacian}{\Delta} % laplacian
\DeclareDocumentCommand\derivative{ s o m g d() }{
% Total derivative
% s: star for \flatfrac flat derivative
% o: optional n for nth derivative
% m: mandatory (x in df/dx)
% g: optional (f in df/dx)
% d: long-form d/dx(...)
\IfBooleanTF{#1}
{\let\fractype\flatfrac}
{\let\fractype\frac}
\IfNoValueTF{#4}
{
\IfNoValueTF{#5}
{\fractype{\diffd \IfNoValueTF{#2}{}{^{#2}}}{\diffd #3\IfNoValueTF{#2}{}{^{#2}}}}
{\fractype{\diffd \IfNoValueTF{#2}{}{^{#2}}}{\diffd #3\IfNoValueTF{#2}{}{^{#2}}} \argopen(#5\argclose)}
}
{\fractype{\diffd \IfNoValueTF{#2}{}{^{#2}} #3}{\diffd #4\IfNoValueTF{#2}{}{^{#2}}}\IfValueT{#5}{(#5)}}
} % differential operator
\DeclareDocumentCommand\partialderivative{ s o m g d() }{
% Total derivative
% s: star for \flatfrac flat derivative
% o: optional n for nth derivative
% m: mandatory (x in df/dx)
% g: optional (f in df/dx)
% d: long-form d/dx(...)
\IfBooleanTF{#1}
{\let\fractype\flatfrac}
{\let\fractype\frac}
\IfNoValueTF{#4}{
\IfNoValueTF{#5}
{\fractype{\partial \IfNoValueTF{#2}{}{^{#2}}}{\partial #3\IfNoValueTF{#2}{}{^{#2}}}}
{\fractype{\partial \IfNoValueTF{#2}{}{^{#2}}}{\partial #3\IfNoValueTF{#2}{}{^{#2}}} \argopen(#5\argclose)}
}
{\fractype{\partial \IfNoValueTF{#2}{}{^{#2}} #3}{\partial #4\IfNoValueTF{#2}{}{^{#2}}}\IfValueT{#5}{(#5)}}
} % partial differential operator
\newcommand{\ii}{\mathrm{i}} % imaginary unit
\renewcommand{\exp}[1]{\mathrm{e}^{#1}} % exponential function
\newcommand{\expp}[1]{\mathrm{exp}\!\left(#1\right)} % exponential function 2.0
\newcommand{\upint}[2]{\overline{\int_{#1}^{#2}}} % upper integral
\newcommand{\lowint}[2]{\underline{\int_{#1}^{#2}}} % lower integral
\DeclareMathOperator{\domain}{dom} % domain of a function
\DeclareMathOperator{\graph}{graph} % graph of a function
\DeclareMathOperator{\supp}{supp} % support of a function
\DeclareMathOperator{\vol}{vol} % volume of a region
\DeclareMathOperator{\area}{area} % area of a region
\newcommand{\crossprod}{\crossproduct} % cross product
%%% ALGEBRA
\newcommand{\bigzero}{\makebox(0,0){\text{\Huge0}}} % 0 big zero in a matrix
\DeclareMathOperator{\lcm}{lcm} % least common multiple
\DeclareMathOperator{\im}{im} % Image of a function
\newcommand{\id}{\mathrm{id}} % identity function
\DeclareMathOperator{\ch}{char} % characteristic of a field
\DeclareMathOperator{\sig}{sig} % signature of a bilinear map
\DeclareMathOperator{\rad}{rad} % radical of a bilinear map
\DeclareMathOperator{\sign}{sgn} % sign of a permutation
\DeclareMathOperator{\ord}{ord} % order of an element in a group
\newcommand{\quot}[2]{
\mathchoice
{% \displaystyle
\text{\raise1ex\hbox{$#1$}\!\Big/\!\lower1ex\hbox{$#2$}}}
{% \textstyle
#1/#2}
{% \scriptstyle
#1/#2}
{% \scriptscriptstyle
#1/#2}
}% quotient group. Usage A/B--->\quot{A}{B}.
\newcommand{\NN}{\ensuremath{\mathbb{N}}} % set of natural numbers
\newcommand{\ZZ}{\ensuremath{\mathbb{Z}}} % set of integers
\newcommand{\QQ}{\ensuremath{\mathbb{Q}}} % set of rationals
\newcommand{\RR}{\ensuremath{\mathbb{R}}} % set of real numbers
\newcommand{\CC}{\ensuremath{\mathbb{C}}} % set of complex numbers
\newcommand{\KK}{\ensuremath{\mathbb{K}}} % a general field
\newcommand{\TT}{\ensuremath{\mathbb{T}}} % time for stochastic processes
\renewcommand{\SS}{\ensuremath{\mathbb{S}}} % other things
\newcommand{\MM}{\ensuremath{\mathbb{M}}} % other things
%%% TOPOLOGY
\DeclareMathOperator{\Int}{Int} % interior set
\DeclareMathOperator{\Ext}{Ext} % exterior set
\DeclareMathOperator{\Cl}{Cl} % clousure set
\newcommand{\cl}[1]{\overline{#1}} % clousure set
\DeclareMathOperator{\Fr}{\partial} % boundary set
\newcommand{\topo}{\tau} % symbol for the topology. Feasible options are: \tau, \mathcal{T}...
\newcommand{\conn}{\mathrel{\#}} % connected sum. \mathrel gives the space of a relation (like +,-,...) while \mathbin gives the space of a binary operator (like =).
\renewcommand{\S}{S} % S of the S ^ n (n-th dimensional sphere)
\newcommand{\Homeo}{\mathrm{Homeo}} % set of homeomorphisms
\newcommand{\Homeoplus}{\mathrm{Homeo}_+} % set of orientation-preserving homeomorphisms
\newcommand{\Diff}{\mathrm{Diff}} % set of diffeomorphisms
\newcommand{\Diffplus}{\mathrm{Diff}_+} % set of orientation-preserving diffeomorphisms
%%% GALOIS THEORY
\newcommand{\FF}{\ensuremath{\mathbb{F}}} % finite fields
\DeclareMathOperator{\irr}{Irr} % irreducible polynomial
\DeclareMathOperator{\Mor}{Mor} % set of morphisms
\DeclareMathOperator{\Iso}{Iso} % set of isomorphisms
\DeclareMathOperator{\Aut}{Aut} % set of automorphisms
\DeclareMathOperator{\Gal}{Gal} % Galois group
\DeclareMathOperator{\Disc}{Disc} % discriminant of a polynomial
%%% PROBABILITY
\newcommand{\Prob}{\ensuremath{\mathbb{P}}} % probability
\newcommand{\Exp}{\mathbb{E}} % expected value
\newcommand{\Var}{\mathrm{Var}} % variance
\newcommand{\cov}{\mathrm{Cov}} % covariance
\newcommand{\iid}{i.i.d.\ } % independent and identically distributed
\newcommand{\indi}[1]{\vf{1}_{#1}}
%%% STATISTICS
\DeclareMathOperator{\bias}{bias} % Bias
\DeclareMathOperator{\MSE}{MSE} % Mean Square Error
\DeclareMathOperator{\Mod}{Mod} % mode
\DeclareMathOperator{\Med}{Med} % median
\DeclareMathOperator*{\argmax}{arg\,max} % argument where the maximum is attained
\DeclareMathOperator*{\argmin}{arg\,min} % argument where the minimum is attained
%%% COMPLEX ANALYSIS
% \DeclareMathOperator{\arg}{arg} % argument. By default is arg(z).
\DeclareMathOperator{\Arg}{Arg} % principal argument
\DeclareMathOperator{\Ln}{Ln} % principal logarithm
\DeclareMathOperator{\Ind}{Ind} % index of a curve
% \DeclareMathOperator{\Res}{Res} % residue of a function at a point. It is already defined as "Res".
\newcommand{\homoleg}[1]{\mathbin{\underset{#1}{\approx}}} % homology. \mathrel gives the space of a relation (like +,-,...) while \mathbin gives the space of a binary operator (like =).
\newcommand{\DD}{\ensuremath{\mathbb{D}}} % unit disk
%%% DIFFERENTIAL GEOMETRY
\newcommand{\T}[1]{{\vf{T}_{\vf{#1}}}} % tangent vector
\newcommand{\N}[1]{{\vf{N}_{\vf{#1}}}} % normal vector
\newcommand{\B}[1]{{\vf{B}_{\vf{#1}}}} % binormal vector
\newcommand{\ka}[1]{{\kappa_{\vf{#1}}}} % curvature
\newcommand{\ta}[1]{{\tau_{\vf{#1}}}} % torsion
\newcommand{\rh}[1]{{\rho_{\vf{#1}}}} % radius of curvature
\newcommand{\I}{\ensuremath{\mathrm{I}}} % 1st fundamental form
\newcommand{\II}{\ensuremath{\mathrm{I\!I}}} % 2nd fundamental form
\newcommand{\homotop}{\mathbin{\sim}} % homotopy. \mathrel gives the space of a relation (like +,-,...) while \mathbin gives the space of a binary operator (like =).
\newcommand{\HH}{\ensuremath{\mathbb{H}}} % half upper plane
%%% REAL AND FUNCTIONAL ANALYSIS
\newcommand{\m}[1]{
\if\relax\detokenize{#1}\relax % first argument empty
\abs{\cdot}
\else % first argument non-empty
\abs{#1}
\fi
} % measure
\newcommand{\om}[1]{
\if\relax\detokenize{#1}\relax % first argument empty
\abs{\cdot}^*
\else % first argument non-empty
\abs{#1}^*
\fi
} % outer measure
\newcommand{\almoste}[1]{\overset{\text{a.e.}}{#1}} % almost everywhere
\newcommand{\dotp}[2]{{\left\langle#1,#2\right\rangle}} % inner product
\DeclareMathOperator{\diam}{diam} % diameter
%%% PARTIAL DIFFERENTIAL EQUATIONS
\newcommand{\matdv}[2]{\frac{\mathrm{D}#1}{\mathrm{D}#2}} % material derivative
% \newcommand{\Tr}{\mathrm{Tr}} % trace of an operator (already defined and it is equal to Tr, so perfect)
%%% LINEAR MODELS
\DeclareMathOperator{\MST}{MST} % Total Mean Square
\DeclareMathOperator{\MSR}{MSR} % Regression Mean Square
\DeclareMathOperator{\SSE}{SSE} % Sum Square Error
\DeclareMathOperator{\SST}{SST} % Total Sum of Squares
\DeclareMathOperator{\SSR}{SSR} % Regression Sum of Squares
\DeclareMathOperator{\SSPE}{SSPE}
\DeclareMathOperator{\MSPE}{MSPE}
\DeclareMathOperator{\SSLOF}{SSLOF}
\DeclareMathOperator{\MSLOF}{MSLOF}
\DeclareMathOperator{\logit}{logit} % logit
\DeclareMathOperator{\VIF}{VIF} % Variance inflation factor
\newcommand{\Ent}{\mathrm{H}} % Shannon entropy
%%% DYNAMICAL SYSTEMS
\renewcommand{\o}[1]{\mathrm{o}\left(#1\right)} % little O notation
\renewcommand{\O}[1]{\mathrm{O}\left(#1\right)} % big O notation
\newcommand{\lyapunov}[1]{{\mathrm{L}}_{#1}} % Lyapunov constants
\newcommand{\poincare}[1]{{\mathrm{P}}_{#1}} % Poincaré constants
\newcommand{\sharkgeq}{\mathbin{\geq_{\mathrm{s}}}} % Sharkovskii order. \mathrel gives the space of a relation (like +,-,...) while \mathbin gives the space of a binary operator (like =).
\newcommand{\sharkleq}{\mathbin{\leq_{\mathrm{s}}}} % Sharkovskii order. \mathrel gives the space of a relation (like +,-,...) while \mathbin gives the space of a binary operator (like =).
\DeclareMathOperator{\Per}{Per} % Periods of a function
%%% HARMONIC ANALYSIS
\newcommand{\F}{\mathcal{F}} % Fourier transformoperator
\renewcommand{\H}{\mathcal{H}} % Fourier transform operator
\renewcommand{\pv}{\mathrm{p.v.}} % Cauchy principal value
%%% JUMP PROCESSES
\newcommand{\CPP}{\mathrm{CPP}} % Compound Poisson Process
\newcommand{\RPM}{\mathrm{RPM}} % Random Poisson Measure
%%% ADVANCED DYNAMICAL SYSTEMS
\newcommand{\Fix}{\mathrm{Fix}} % Fixed points
%%% NONLINEAR PDES
\newcommand{\Conv}{\mathrm{Conv}} % convex hull
\newcommand{\codim}{\mathrm{codim}} % codimension
%%% vectors and matrices
\newcommand{\vf}[1]{\boldsymbol{\mathrm{#1}}} % math style for vectors and matrices and vector-values functions (previously it was \*vb{#1} but this does not apply to greek letters)
\newcommand{\transpose}[1]{{#1}^{\mathrm{T}}} % math style for vectors and matrices
\DeclareMathOperator{\adjugate}{adj} % adjugate matrix
\DeclareMathOperator{\cofactor}{cof} % cofactor matrix
\DeclareMathOperator{\diag}{diag} % diagonal matrix
\newcommand{\GL}{\mathrm{GL}} % set of invertible matrices
\renewcommand{\norm}[1]{\left\|#1\right\|} % norm of a vector
%%% PHYSICS
\newcommand{\const}{\text{const.}}
\newcommand{\Rey}{\mathrm{Re}} % Reynolds number
\newcommand{\Ma}{\mathrm{Ma}} % Mach number
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% for long-vector arrows %%%%%
\newcommand{\vect}[1]{%
\vbox{\m@th \ialign {##\crcr\vectfill\crcr\noalign{\kern-\p@ \nointerlineskip}$\hfil\displaystyle{#1}\hfil$\crcr}}
}
\def\vectfill{%
$\m@th\smash-\mkern-7mu%
\cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill
\mkern-7mu\raisebox{-3.66pt}[\p@][\p@]{$\mathord\mathchar"017E$}$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%