-
Notifications
You must be signed in to change notification settings - Fork 1
/
preamble_general.sty
254 lines (229 loc) · 10.3 KB
/
preamble_general.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
\usepackage{amsthm, amsmath, mathtools, amssymb, physics} % for math and physics commands and symbols.
\usepackage[intlimits]{esint} % for more options on integrals.
\usepackage{standalone} % for compiling individually .tex images.
\usepackage[hypcap=false]{caption} % basically for using the command \captionof{}, which is useful in some environments, others than \begin{figure}.
\usepackage{subcaption} % for subfigures, when many captions come into play.
\usepackage{multicol} % organize the whole document in multiple columns.
\usepackage[USenglish]{babel} % for improving use of English and mainly the use of hyphenation.
\usepackage[version=4]{mhchem} % used for chemistry and nuclear physics.
\usepackage{multirow} % multirow in a table, for example.
\usepackage{array, makecell} % for additional options in tables and tabular.
\usepackage{hyperref} % link automatically references.
% \usepackage{hycolor} % implements options of colors for hyperref (it ables the user to use colors from xcolor package)
\usepackage[capitalise,nameinlink]{cleveref} % for clever references. That is, for example, for automatically write "Definition 2.13" instead of only "2.13".
\usepackage{graphicx} % for options like \definecolor{}{}{}, \textcolor{}{},...
\usepackage[usenames,x11names]{xcolor} % to customize RGB colors.
\usepackage{colortbl} % for colors in tables.
\usepackage{tcolorbox} % for coloring boxes.
\setlength{\parindent}{0pt} % Indentation disabled.
\usepackage{float} % to allow using argument [H] in figure environtment
\setlength\multlinegap{0pt} % disable the margins on \begin{multline} command.
\allowdisplaybreaks % allows to break an align environment in two pages.
%% colors - subjects %%
\newcommand{\col}{red}% % DEFAULT
\newcommand{\ana}{DeepSkyBlue2}% % analysis
\newcommand{\alg}{Green3}% % algebra
\newcommand{\geo}{Purple2}% % geometry and topology
\newcommand{\apl}{Red2}% % applied mathematics
\newcommand{\pro}{Orange2}% % probability and statistics
\newcommand{\phy}{SlateBlue2}% % physics
\ExplSyntaxOn
\NewExpandableDocumentCommand{\refcol}{m}{
\str_case_e:nnF {\FirstWord{#1}}{
{FM}{\alg} % fundamentals of mathematics
{LA}{\alg} % linear algebra
{RVF}{\ana} % real valued functions
{AS}{\alg} % algebraic structures
{DM}{\alg} % discrete mathematics
{FSV}{\ana} % functions of several variables
{LG}{\geo} % linear geometry
{MA}{\ana} % mathematical analysis
{NM}{\apl} % numerical methods
{CA}{\ana} % complex analysis
{DE}{\apl} % differential equations
{DG}{\geo} % differential geometry
{GT}{\alg} % Galois theory
{P}{\pro} % probability
{S}{\pro} % statistics
{TOP}{\geo} % topology
{AT}{\geo} % algebraic topology
{A}{\alg} % arithmetic
{CAL}{\alg} % commutative algebra
{DS}{\apl} % dynamical systems
{HA}{\ana} % harmonic analysis
{LM}{\pro} % linear models
{NC}{\apl} % numeric calculus
{NIPDE}{\apl} % numeric integration of pde
{PDE}{\apl} % partial differential equations
{RFA}{\ana} % real and functional analysis
{SP}{\pro} % stochastic processes
{ADS}{\apl} % advanced dynamical systems
{AP}{\pro} % advanced probability
{ATFAPDE}{\ana} % advanced topics in functional analysis and pdes
{IEPDE}{\ana} % introduction to evolution pdes
{INEPDE}{\ana} % introduction to non linear elliptic pdes
{LTLD}{\pro} % limit theorems and large deviations
{SC}{\pro} % stochastic calculus
{INLP}{\phy} % Instabilities and nonlinear phenomena
{MM}{\pro} % Montecarlo methods
{CO}{\apl} % Continuous optimization
{NMPDE}{\apl} % Numerical methods for pdes
{SCO}{\pro} % Stochastic control
{JP}{\pro} % Jump processes
{ICT}{\ana} % Introduction to control theory
}{\col}%
}
\ExplSyntaxOff
%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\FirstWord[1]{\@removedots#1:\@nil}%
\newcommand\@removedots{}%
\def\@removedots#1:#2\@nil{#1}%
\newcommand\changecolor[1]{
\renewcommand{\col}{\refcol{#1}}
\hypersetup{linkcolor = \col}
}
%% for references (hyperref)
\hypersetup{
colorlinks = true,
linkcolor = Blue4, % color of internal links (sections, pages, etc.)
filecolor = cyan, % color for URLs which open local files
citecolor = green, % color for bibliographical citations in text.
urlcolor = cyan, % color of URL links (mail, web)
}
%%%%%%%%%%%%%%%%%%%%
%% Color box for important theorems
\def\sep{1mm}
\newtcolorbox{important}{colback=\col!5, colframe=\col, left=\sep, right=\sep, top=\sep, bottom=\sep}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%% Enumeration - commands %%%%%%%
\usepackage{enumitem} % for the command [leftmargin=1.15cm] in customized-label enumerations
\renewcommand{\labelenumi}{\arabic{enumi}.}
\renewcommand{\theenumi}{\thetheorem-\arabic{enumi}}
\renewcommand{\labelenumii}{\roman{enumii})}
\renewcommand{\theenumii}{\theenumi.\roman{enumii})}
\renewcommand{\labelenumiii}{\alph{enumiii})}
\renewcommand{\theenumiii}{\theenumii.\alph{enumiii})}
% for doing things like:
% 1. ..............
% 2. ..............
% 3, 4. ...........
% 5. ..............
\newcommand{\doubleitem}{%
\begingroup
\stepcounter{enumi}%
\edef\tmp{\arabic{enumi}, }%
\stepcounter{enumi}
\edef\tmp{\endgroup\noexpand\item[\tmp\labelenumi]}%
\tmp}
%% for proving two-way implications
% Usage:
% \begin{itemizeiff}
% First implication ...
% \item Second implication ...
% \end{itemizeiff}
\newlist{itemizeiff}{enumerate}{2}
\setlist[itemizeiff]{
first=\item[{$\implies\!\!$)}],
label={$\impliedby\!\!$)},
leftmargin=1.2cm,
}
\newcommand*\ifftoright{\item[$\implies$:]}
\newcommand*\ifftoleft{\item[$\ \impliedby$:]}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% Theorems, definitions,... environments %%%%%
\newtheoremstyle{math_theorems}
{\topsep} % ABOVESPACE
{\topsep} % BELOWSPACE
{} % BODYFONT
{0pt} % INDENT (empty value is the same as 0pt)
{\bfseries} % HEADFONT
{.} % HEADPUNCT
{5pt plus 1pt minus 1pt} % HEADSPACE
{\color{\col}\thmname{#1}\thmnumber{\@ifnotempty{#1}{ }\@upn{#2}}%
\thmnote{{ \bfseries\color{black}(#3)\index{#3}}}} % CUSTOM-HEAD-SPEC
\theoremstyle{math_theorems}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{axiom}[theorem]{Axiom}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{law}[theorem]{Law}
\newtheorem{principle}[theorem]{Principle}
\newtheorem{model}[theorem]{Model}
\newtheoremstyle{math_remarks}
{\topsep} % ABOVESPACE
{\topsep} % BELOWSPACE
{} % BODYFONT
{0pt} % INDENT (empty value is the same as 0pt)
{\itshape} % HEADFONT
{.} % HEADPUNCT
{5pt plus 1pt minus 1pt} % HEADSPACE
{\color{\col}\thmname{#1}\thmnote{{ \color{black}(#3)}}} % CUSTOM-HEAD-SPEC
\theoremstyle{math_remarks}
\newtheorem{remark}{Remark}
% \renewcommand*{\qed}{{\color{\col}\qed}}
% \renewcommand{\qedsymbol}{\textcolor{\col}{\qed}}
\newcommand*{\QED}[1][$\square$]{%
\color{\col}
\leavevmode\unskip\penalty9999 \hbox{}\nobreak\hfill
\quad\hbox{#1}%
}
\makeatletter
\renewenvironment{proof}[1][\proofname]{
\par%
\pushQED{\QED}%
\normalfont%
\topsep5\p@\@plus\p@\@minus\p@\relax%
\trivlist%
\item\relax%
{%
\color{\col}%
\itshape#1\@addpunct{.}}\hspace\labelsep\ignorespaces%
}{%
% \color{\col!30}
\popQED\endtrivlist\@endpefalse%
}
\makeatother
\newcommand\explanationname{Sketch of the proof} % could be made language-dependent
\newenvironment{sproof}%
{\renewcommand\proofname\explanationname%
\begin{proof}}%
{\end{proof}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%% Extra references %%%%%%%
\makeatletter
\if@cref@capitalise % if we pass the option 'capitalise' on cleveref package
% \crefname{theorem}{\bfseries\color{\col} Theorem}{\bfseries\color{\col} Theorems}
% \crefname{lemma}{\bfseries\color{\col} Lemma}{\bfseries\color{\col} Lemmas}
% \crefname{proposition}{\bfseries\color{\col} Proposition}{\bfseries\color{\col} Propositions}
% \crefname{corollary}{\bfseries\color{\col} Corollary}{\bfseries\color{\col} Corollary}
% \crefname{axiom}{\bfseries\color{\col} Axiom}{\bfseries\color{\col} Axioms}
% \crefname{definition}{\bfseries\color{\col} Definition}{\bfseries\color{\col} Definitions}
% \crefname{law}{\bfseries\color{\col} Law}{\bfseries\color{\col} Laws}
% \crefname{principle}{\bfseries\color{\col} Principle}{\bfseries\color{\col} Principles}
% \crefname{enumi}{\textcolor{\col}{Item}}{\textcolor{\col}{Items}}
% \else
% \crefname{theorem}{\bfseries\color{\col} theorem}{\bfseries\color{\col} theorems}
% \crefname{lemma}{\bfseries\color{\col} lemma}{\bfseries\color{\col} lemmas}
% \crefname{proposition}{\bfseries\color{\col} proposition}{\bfseries\color{\col} propositions}
% \crefname{corollary}{\bfseries\color{\col} corollary}{\bfseries\color{\col} corollary}
% \crefname{axiom}{\bfseries\color{\col} axiom}{\bfseries\color{\col} axioms}
% \crefname{definition}{\bfseries\color{\col} definition}{\bfseries\color{\col} definitions}
% \crefname{law}{\bfseries\color{\col} law}{\bfseries\color{\col} laws}
% \crefname{principle}{\bfseries\color{\col} principle}{\bfseries\color{\col} principles}
% \crefname{enumi}{\textcolor{\col}{item}}{\textcolor{\col}{items}}
\crefname{axiom}{Axiom}{Axioms}
\else
\crefname{axiom}{axiom}{axioms}
\fi
\makeatother
\newcommand{\mref}[1]{\hypersetup{linkcolor = \refcol{#1}}\ref{#1}\hypersetup{linkcolor = \col}} % custom ref
\newcommand{\mcref}[1]{\hypersetup{linkcolor = \refcol{#1}}\cref{#1}\hypersetup{linkcolor = \col}} % custom cref
% \newcommand{\mnameref}[1]{\hypersetup{linkcolor = \refcol{#1}}\nameref{#1}\hypersetup{linkcolor = \col}} % custom nameref
\newcommand{\mnameref}[1]{\hypersetup{linkcolor = \refcol{#1}}\hyperref[{#1}]{\ref{#1} \nameref{#1}}\hypersetup{linkcolor = \col}} % custom nameref
% \newcommand{\mfullref}[1]{\hypersetup{linkcolor = \refcol{#1}}\hyperref[{#1}]{\ref{#1} \nameref{#1}}\hypersetup{linkcolor = \col}}
% \newcommand{\fullref}[1]{\hypersetup{linkcolor = \refcol{#1}}\hyperref[{#1}]{\autoref{#1} \nameref{#1}}\hypersetup{linkcolor = \col}}
% \crefformat{enumerate}{#2\textcolor{\col}{Item} #1#3}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%