forked from artempolyvyanyy/ReuseLaTeX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore.include.tex
273 lines (246 loc) · 10.8 KB
/
core.include.tex
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Improting useful packages and defining useful commands for LaTeX
%
% First created on: Dec 2, 2019
% Last updated on: Dec 30, 2023
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% USE PACKAGES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Use natbib package
\usepackage[square,sort&compress,comma,numbers]{natbib}
\renewcommand{\bibfont}{\small}
\renewcommand{\bibsep}{0pt}
\renewcommand{\bibsection}{\section*{References}\vspace{-2mm}}
%-------------------------------------------------------------------------------
%\usepackage{amsthm}
%\usepackage{amssymb}
%-------------------------------------------------------------------------------
% A comprehensive (SI) units package
% https://ctan.org/pkg/siunitx?lang=en
%\usepackage{siunitx}
%\sisetup{
%group-separator={,},
%round-mode=places,
%round-precision=3,
%table-format=1.3,
%}
%-------------------------------------------------------------------------------
% Useful table packages
% booktabs - the package enhances the quality of tables
% https://ctan.org/pkg/booktabs?lang=en
% multirow - create tabular cells spanning multiple rows
% https://ctan.org/pkg/multirow?lang=en
\usepackage{booktabs}
\usepackage{multirow}
%-------------------------------------------------------------------------------
% The package typesets fractions “nicely” — in the form ‘a/b’
% https://ctan.org/pkg/nicefrac?lang=en
% USAGE: $\nicefrac{1}{2}$
\usepackage{nicefrac}
%-------------------------------------------------------------------------------
% https://ctan.org/pkg/ifthen?lang=en
\usepackage{ifthen}
%-------------------------------------------------------------------------------
% https://en.wikibooks.org/wiki/LaTeX/Colors
\usepackage[usenames,dvipsnames]{xcolor}
%-------------------------------------------------------------------------------
%https://ctan.org/pkg/algorithm2e?lang=en
\usepackage[algoruled,vlined,linesnumbered]{algorithm2e}
%-------------------------------------------------------------------------------
% https://ctan.org/pkg/amsmath?lang=en
%
% Recommended as an adjunct to serious mathematical typesetting in LATEX.
\usepackage{amsmath}
%-------------------------------------------------------------------------------
% https://ctan.org/pkg/amsfonts?lang=en
%
% An extended set of fonts for use in mathematics, including: extra mathematical
% symbols; blackboard bold letters (uppercase only); fraktur letters; subscript
% sizes of bold math italic and bold Greek letters; subscript sizes of large
% symbols such as sum and product; added sizes of the Computer Modern small caps
% font; cyrillic fonts (from the University of Washington); Euler mathematical
% fonts.
\usepackage{amsfonts}
%-------------------------------------------------------------------------------
\usepackage{mdframed}
%-------------------------------------------------------------------------------
% https://ctan.org/pkg/paralist?lang=en
\usepackage{paralist}
\setdefaultleftmargin{1em}{1em}{1em}{1em}{1em}{1em}
%-------------------------------------------------------------------------------
\usepackage{datetime}
\newdateformat{monthyeardate}{\monthname[\THEMONTH] \THEYEAR}
%-------------------------------------------------------------------------------
\usepackage[algoruled]{algorithm2e}
%-------------------------------------------------------------------------------
% Manage to do items
% https://ctan.org/pkg/todonotes?lang=en
\ifshowtodos
\usepackage[textsize=scriptsize,colorinlistoftodos]{todonotes}
\else
\usepackage[textsize=scriptsize,colorinlistoftodos,disable]{todonotes} % disable all todo notes
\fi
% useful commands
% \missingfigure{My comment} - specify a missing figure
% \listoftodos - list all todos in the current document
\let\todonote\todo
\renewcommand{\todo}[2]{\todonote[inline,color=red!20]{TODO (#1): #2}}
\newcommand{\done}[2]{\todonote[inline,color=green!20]{DONE (#1): #2}}
\newcommand{\chat}[2]{\todonote[inline,color=black!20,nolist]{#1: #2}}
\newcommand{\idea}[2]{\todonote[inline,color=blue!20,nolist]{IDEA (#1): #2}}
%-------------------------------------------------------------------------------
\usepackage{tikz,pgf,xcolor}
\usetikzlibrary{arrows,automata,trees,plotmarks,shadows,shapes}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.groupplots}
%-------------------------------------------------------------------------------
% TODO: check the usage
%\usepackage{url}
%\urlstyle{same}
%-------------------------------------------------------------------------------
% TODO: check the usage
\usepackage{mathtools}
%-------------------------------------------------------------------------------
% Manage references
% https://ctan.org/tex-archive/macros/latex/contrib/cleveref
\usepackage[capitalise,nameinlink]{cleveref}
%-------------------------------------------------------------------------------
% Flow text around small figures
\usepackage{wrapfig}
%-------------------------------------------------------------------------------
% Can be useful
%http://anorien.csc.warwick.ac.uk/mirrors/CTAN/macros/latex/contrib/constants/constants.pdf
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CONSTANTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{mybluecolor}{RGB}{50,106,218}
\definecolor{myredcolor}{RGB}{176,53,53}
\definecolor{mygreencolor}{RGB}{93,172,0}
\definecolor{myyellowcolor}{RGB}{255,163,34}
\definecolor{mypurplecolor}{RGB}{86,35,132}
\definecolor{mytealcolor}{RGB}{30,161,165}
\newcommand{\redtext}[1]{\textcolor{myredcolor}{{#1}}}
\newcommand{\bluetext}[1]{\textcolor{mybluecolor}{{#1}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DEFINE NEW COMMANDS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\splitatcommas}[1]{%
\begingroup
\ifnum\mathcode`,="8000
\else
\begingroup\lccode`~=`, \lowercase{\endgroup
\edef~{\mathchar\the\mathcode`, \penalty0 \noexpand\hspace{-1pt plus 3em}}%
}\mathcode`,="8000
\fi
#1%
\endgroup
}
%-------------------------------------------------------------------------------
% Arithmetic operations
\newcommand{\mult}{{\ensuremath \,\cdot\,}}
% Math symbols
\providecommand{\bigsum}{\ensuremath \mbox{\LARGE $\mathsurround0pt\sum$}}
\renewcommand {\bigsum}{\ensuremath \mbox{\LARGE $\mathsurround0pt\sum$}}
% Math functions
\newcommand{\func}[3]{{{#1}:{#2} \rightarrow {#3}}}
\newcommand{\funcCall}[2]{{\ensuremath {\mathit{#1}}_{\!}\left({#2}\right)}}
\newcommand{\funcDomain}[1]{{\ensuremath {\mathit{dom}}_{\!}\left({#1}\right)}}
\newcommand{\funcRange}[1]{{\ensuremath {\mathit{rng}}_{\!}\left({#1}\right)}}
% Math paired delimiters
\DeclarePairedDelimiter\ceil{\lceil}{\rceil}
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}
% Math intervals
\newcommand{\intintervalcc}[2]{{\ensuremath \left[#1 \,..\, #2\right]}}
\newcommand{\intervalcc}[2]{{\ensuremath \left[#1, #2\right]}}
% Math powerset
\providecommand{\powerset}[1]{{\ensuremath \mathcal{P}\!\left({#1}\right)}}
\renewcommand{\powerset}[1]{{\ensuremath \mathcal{P}\!\left({#1}\right)}}
% Math multiset
\providecommand{\support}[1]{{\ensuremath \mathit{Supp}\left({#1}\right)}}
\renewcommand{\support}[1]{{\ensuremath \mathit{Supp}\left({#1}\right)}}
\providecommand{\cardinality}[1]{\ensuremath \left|{#1}\right|}
\renewcommand{\cardinality}[1]{\ensuremath \left|{#1}\right|}
\providecommand{\multiplicity}[2]{\ensuremath \funcCall{m_{#1}}{#2}}
\renewcommand{\multiplicity}[2]{\ensuremath \funcCall{m_{#1}}{#2}}
\newcommand{\mset}[1] {\ensuremath [\splitatcommas{#1}]}
\newcommand{\msetel}[2]{{\ensuremath {{#1}^{#2}}}}
% Math sets
\newcommand{\set}[1]{\ensuremath \left\{\splitatcommas{#1}\right\}}
\newcommand{\setbuilder}[2]{\ensuremath \left\{ #1 \,|\, #2 \right\}}
% Math tuple functions
\newcommand{\pair}[2]{\ensuremath \left(\splitatcommas{#1, #2}\right)}
\newcommand{\triple}[3]{\ensuremath \left(\splitatcommas{#1, #2, #3}\right)}
\newcommand{\tuple}[1]{\ensuremath \left(\splitatcommas{#1}\right)}
% Math sequences
\newcommand{\kleenestar}[1]{{\ensuremath {#1}^{*}}}
\newcommand{\emptysequence}{{\ensuremath \epsilon}}
\newcommand{\sequence}[1]{\ensuremath \langle\splitatcommas{#1}\rangle}
\newcommand{\seqLength}[1]{\ensuremath \left|{#1}\right|}
\newcommand{\concat}[2]{\ensuremath #1 \circ #2}
\newcommand{\subseq}[3]{\ensuremath \funcCall{subseq}{#1, #2, #3}}
\newcommand{\subseqid}[3]{\ensuremath \triple{#1}{#2}{#3}}
\newcommand{\crossover}[3]{\ensuremath #1 \,\otimes\, #2 \,=\, #3}
\newcommand{\crossoverop}[2]{\ensuremath #1 \otimes #2}
% Petri nets
\newcommand{\enabled}[3]{\ensuremath \pair{#1}{#2}\left[#3\right\rangle}
\newcommand{\occurrence}[4]{\ensuremath \pair{#1}{#2}\left[#3\right\rangle\pair{#1}{#4}}
\newcommand{\leadsfromto}[4]{\ensuremath \pair{#1}{#2}\left[#3\right\rangle\pair{#1}{#4}}
% Predicates
\newcommand{\predicate}[3]{\ensuremath #1 \, #2 : #3}
% Theorems and proofs
\providecommand{\qed}{\hfill\ensuremath{\filledsquare}}
\renewcommand {\qed}{\hfill\ensuremath{\filledsquare}}
\providecommand{\holds}{\ensuremath :}
\renewcommand {\holds}{\ensuremath :}
\providecommand{\iff}{\ensuremath \Leftrightarrow}
\renewcommand {\iff}{\ensuremath \Leftrightarrow}
\providecommand{\implies}{\ensuremath \Rightarrow}
\renewcommand {\implies}{\ensuremath \Rightarrow}
\providecommand{\bigforall}{\ensuremath \mbox{\LARGE $\mathsurround0pt\forall$}}
\renewcommand {\bigforall}{\ensuremath \mbox{\LARGE $\mathsurround0pt\forall$}}
% Logs
\newcommand{\action}[1]{\texttt{#1}}
\newcommand{\trace}[1]{\texttt{#1}}
%-------------------------------------------------------------------------------
% Figure functions
% Use: \fig{pos}{vspace(mm)}{scale}{trim(0 0 0 0)}{figure}{vspace(mm)}{Caption}{vspace(mm)}{fig:label}
\newcommand{\fig}[9]{\begin{figure}[#1]
\vspace{#2mm}
\begin{center}
\includegraphics[scale=#3,trim=#4]{#5}
\end{center}
\vspace{#6mm}
\caption{#7.}
\vspace{#8mm}
\label{#9}
\end{figure}}
%-------------------------------------------------------------------------------
% An initial attempt to fix orphan lines in a pargraph
\newcommand\fixit[2][.05]{%
\setbox0=\hbox{\hspace{\parindent}#2}\fixithelp{#1}{#2}}
\newcommand\fixithelp[2]{%
\wd0=\dimexpr\wd0-\linewidth\relax%
\ifdim\wd0>0pt\relax%
\fixithelp{#1}{#2}%
\else%
\wd0=\dimexpr\wd0+\linewidth\relax
\ifdim\wd0>.9\linewidth\relax%
{\parfillskip0pt\relax#2\par}%
\else%
\ifdim\wd0>.8\linewidth\relax%
{\parfillskip0pt\relax#2\hspace{.2\linewidth}\par}%
\else%
\ifdim\wd0<#1\linewidth\relax%
{\parfillskip0pt\relax#2\par}%
\else%
\ifdim\wd0<.2\linewidth\relax%
{\parfillskip0pt\relax#2\hspace{.8\linewidth}\mbox{}\par}%
\else%
#2%
\fi
\fi
\fi
\fi
\fi%
}