-
Notifications
You must be signed in to change notification settings - Fork 0
/
thesismath.sty
127 lines (105 loc) · 3.56 KB
/
thesismath.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
% Math packages
\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage{mathtools}
% Command helper library
\RequirePackage{xparse}
% Scale
% see http://tex.stackexchange.com/questions/60453/reducing-font-size-in-equation
\newcommand*{\Scale}[2][4]{\scalebox{#1}{$#2$}}%
% For conditions after equations
\newcommand{\Condition}[1]{\Scale[0.85]{(\text{if} \: #1)}}
% Set of natural numbers
\newcommand*\NaturalNumbers{\mathbb{N}}
% Given
% see http://tex.stackexchange.com/questions/141570/sizing-for-given-that-symbol-vertical-bar
\newcommand\Givenbase[1][]{\,#1\lvert\,}
\let\Given\Givenbase
\newcommand\Sgiven{\Givenbase[\delimsize]}
\DeclarePairedDelimiterX\Basics[1](){\let\Given\Sgiven #1}
% Set
% see http://tex.stackexchange.com/questions/13634/define-pretty-sets-in-latex-esp-how-to-do-the-condition-separator
\newcommand*\SetSymbol[1][]{
\nonscript\,#1\vert\nonscript\,\mathopen{}\allowbreak
}
\DeclarePairedDelimiterX\Set[1]{\{}{\}}%
{ \renewcommand\Given{\SetSymbol[\delimsize]} #1 }
\newcommand{\DummyArg}{\cdot}
\newcommand{\DummyIndex}{\bullet}
% % Argmax
\DeclareMathOperator*{\ArgmaxOp}{arg\,max}
\NewDocumentCommand{\Argmax}{s o g}{
\ArgmaxOp_{\IfNoValueTF{#3}{}{#3}}\IfNoValueTF{#2}{}{\!{}_{#2}^{\IfBooleanTF{#1}{\star}{}}\,}
}
% Cardinality of a set
\newcommand{\Cardinality}[1]{\left|#1\right|}
% Probability
\NewDocumentCommand{\Prob}{s o g g}{
\IfBooleanTF{#1}{\operatorname{\hat P}}{\operatorname{P}}_{\IfNoValueTF{#2}{\,}{#2}}
\IfNoValueTF{#3}{}{(\IfNoValueTF{#4}{#3}{#3 \Given #4})}
}
\NewDocumentCommand{\ProbMKN}{s g g}{
\IfBooleanTF{#1}{\Prob*[\text{MKN}]{#2}{#3}}
{\Prob [\text{MKN}]{#2}{#3}}
}
\NewDocumentCommand{\ProbGLM}{s g g}{
\IfBooleanTF{#1}{\Prob*[\text{GLM}]{#2}{#3}}
{\Prob [\text{GLM}]{#2}{#3}}
}
% Counts
\DeclareMathOperator{\Count}{c}
\DeclareMathOperator{\ContCount}{N}
% roman numbering because numbers are not allowed in commands
\newcommand{\ContCountIp} {\ContCount_{\Scale[0.5]{1+}}}
\newcommand{\ContCountI} {\ContCount_{\Scale[0.5]{1 }}}
\newcommand{\ContCountII} {\ContCount_{\Scale[0.5]{2 }}}
\newcommand{\ContCountIIIp}{\ContCount_{\Scale[0.5]{3+}}}
\DeclareMathOperator{\Discount}{D}
\NewDocumentCommand{\DiscountedCount}{s}{
\operatorname{\IfBooleanTF{#1}{\ContCountIp}{\Count}^d}
}
% Absolute Skip
\newcommand{\Skp}{\ensuremath{\,\Scale[0.7]{\square}\,}}
% Continuation Skip
\newcommand{\WSkp}{\ensuremath{\,\bullet\,}}
% Language
\newcommand*\Language{\mathcal{L}}
% Vocabulary
\newcommand*\Vocab{\Sigma}
% Next Word Prediction
\NewDocumentCommand{\NWP}{o o g}{
\operatorname{NWP}_{\IfNoValueTF{#1}{}{#1}}^{\IfNoValueTF{#2}{}{#2}}\IfNoValueTF{#3}{}{(#3)}
}
% Next Keystroke Savings
\NewDocumentCommand{\NKSS}{g}{
\operatorname{NKSS}\IfNoValueTF{#1}{}{(#1)}
}
% Skip Operator
\NewDocumentCommand{\SkpOp}{o g}{
\partial_{\IfNoValueTF{#1}{}{#1}} \IfNoValueTF{#2}{}{#2}
}
%\newcommand*\SkpOp{\partial}
%\newcommand*\SkpOpInv{\SkpOp^{-1}}
%\newcommand*\SkpOpMult{\SkpOp^\star}
\NewDocumentCommand{\NumSkpOp}{g}{
\#_{\SkpOp} \IfNoValueTF{#1}{}{#1}
}
% Weighted Sum
%\DeclareMathOperator\SumWeight{\lambda}
\newcommand*\SumWeight{\lambda}
%\DeclareMathOperator\SumArg{\alpha}
\newcommand*\SumArg{\alpha}
% Can we avoid this?
% \newcommand{\SeenHistory}{h^\prime}
%\DeclareMathOperator\History{\eta}
%\newcommand*\History{\eta}
% Derived History
\NewDocumentCommand{\DerivedHistory}{o}{
\hat{h}_{\IfNoValueTF{#1}{}{#1}}
}
% Concatenation of N-Grams
\newcommand*\NGramConcat{*}
% Length N of an N-Gram
\newcommand*\NGramLength[1]{{\left|#1\right|}}
% Empty n-Gram
\newcommand*\EmptyNGram{\epsilon}