Repository navigation
Expand file tree
/
Copy pathmath.sty
More file actions
88 lines (78 loc) · 2.56 KB
/
Copy pathmath.sty
File metadata and controls
88 lines (78 loc) · 2.56 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
% math.sty
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{math}[Math Optimization Config]
\RequirePackage{base}
\usepackage{bbold}
\usepackage{optidef}
\usepackage{etoolbox}
\usepackage{stmaryrd}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{fillbetween}
\usepackage{wrapfig}
\usepackage{changepage} % adjustwidth
\usepackage{pst-node} % Rnode
% ---------- TIKZ LIBRARIES ----------
\usetikzlibrary{patterns, intersections, backgrounds}
% ---------- MACROS ----------
\newcommand{\I}{\mathcal{I}}
\newcommand{\D}{\mathcal{D}}
\newcommand{\F}{\mathcal{F}}
\renewcommand{\O}{\mathcal{O}}
\newcommand{\M}{\mathbb{M}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\1}{\mathbb{1}}
\newcommand{\A}{\mathbb{A}}
\newcommand{\E}{\mathbb{E}}
\newcommand*\dif{\mathop{}\!\mathrm{d}} % differential 'd'
\newcommand\restr[2]{\left.\kern-\nulldelimiterspace #1 \vphantom{\big|} \right|_{#2}} % function restriction
\newcommand{\ol}[1]{\overline{#1}}
\DeclareMathOperator*{\lcm}{lcm}
\newlength{\mylen}
% ---------- CUSTOM ENVIRONMENT FOR OPTIMIZATION PROBLEMS ------
%
% Usage:
% \Opt[<label>]{<min/max>}{<vars>}{<function to optimize>}{<subject to>}
%
% Arguments:
% #1 [optional]: Label for numbering and references.
% If not entered, the equation will not be numbered.
% #2 {mandatory}: String "min" or "max".
% #3 {optional}: Variables, through which optimization is performed (e.g.. w, \xi).
% #4 {mandatory}: Mathematical expression for a function.
% #5 {mandatory}: Restrictive conditions. Separate multiple conditions using \\.
%---------------------------------------------------------------
\newcommand{\Opt}[5][]{%
\ifstrempty{#1}{\begin{equation*}}{\begin{equation}\label{#1}}
\begin{aligned}
& \ifstrempty{#3}{\ifstrequal{#2}{min}{\text{minimalisujte}}{\text{maximalisujte}}}
{\underset{#3}{\ifstrequal{#2}{min}{\text{minimalisujte}}{\text{maximalisujte}}}}
& & #4 \\
& \text{za podmínek}
% we use ‘{r @{} l}’ for alignment
% to two columns (right and left) without a space between them.
& & {
\renewcommand{\arraystretch}{1.25}
\begin{array}[t]{r @{} l}
#5
\end{array}
}
\end{aligned}
\ifstrempty{#1}{\end{equation*}}{\end{equation}}
}
\ExplSyntaxOn
\newcommand\optAs[3]{%
\begin{table}[H]
\centering
\begin{tabular}{l l}
\str_case_e:nnF{#1}{
{min} {minimalisujte}
{max} {maximalisujte}
}{
\PackageError{cfg}{'#1' is not a supported}{}
} & $#2$ \\
za \space podmínek & {$\!\begin{array}[t]{@{}l@{}ll} #3 \end{array}$}
\end{tabular}
\end{table}
}
\ExplSyntaxOff