-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtwilight.sty
385 lines (361 loc) · 13.5 KB
/
twilight.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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
% In a project, always first use the following mandatory packages
% \usepackage{graphicx, amssymb, amsmath, amsthm, dsfont, tikz, pgfplots, hyperref, xcolor, enumitem, fancyhdr, xparse, geometry, bbm, calligra, environ, comment, twilight}
\RequirePackage{graphicx}
\RequirePackage{amssymb, amsmath, amsthm, dsfont}
\RequirePackage{tikz}
\RequirePackage{pgfplots}
\RequirePackage{hyperref}
\RequirePackage{xcolor}
\RequirePackage{enumitem}
\RequirePackage{fancyhdr}
\RequirePackage{xparse}
\RequirePackage{geometry}
\RequirePackage{bbm}
\RequirePackage{calligra}
\RequirePackage{environ}
\RequirePackage{comment}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{patterns}
\pgfplotsset{compat=1.18}
% Follow British English: No Indentation
\setlength\parindent{0pt}
% Title Page Setup
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Example Usage: %
% \def\CourseTitle{ExampleCourse} %
% \def\CourseAuthor{ExampleAuthor} %
% \def\CourseDate{Fall 20xx Semester} %
% \CoursePage %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\CoursePage}{
\begin{center}\LARGE \CourseTitle\end{center}
\begin{center}\Large ---\ \CourseAuthor\ --- \\ \CourseDate\end{center}
\phantom{}\hrule\phantom{}
}
% Review Mode
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% use \begin{reviewmode}{1} to turn on and {0} to turn off %
% When in review mode, all proofs are replaced with 10 empty lines %
% that allow you to print down and work by hand on the class-proofs %
% In all cases, use \begin{visibleproof}...\end{visibleproof} to make %
% certain proofs always visible, no matter of the parameter given %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NewEnviron{reviewmode}[1]{%
\let\visibleproof\proof
\let\endvisibleproof\endproof
\ifnum#1=1
\RenewEnviron{proof}{\phantom{}\\ \\ \\ \\ \\ \\ \\ \\ \\ \\}{}
\fi
\BODY
\let\proof\visibleproof
\let\endproof\endvisibleproof
}
% Color Definitions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Usage: \textcolor{NavyBlue}{lorum ipsum} %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{NavyBlue}{RGB}{0,0,128}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Citation of the code below %
% TITLE: How to trim the spaces for `\BODY` in `\NewEnviron` %
% SUBTITLE: I'm not sure what the purpose of ansproofbase is. Just set the color at the outset. ... %
% AUTHOR: egreg @ Tex StackExchange %
% DATE: Jan 28th, 2024 %
% AVAILABILITY: https://tex.stackexchange.com/a/711780/315951 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Begin of Borrowed Code
\ExplSyntaxOn
\NewDocumentEnvironment{ansproof}{O{\proofname}+b}{%
\par\color{NavyBlue}
\begin{proof}[#1]
\twilight_if_empty:nF { #2 } { #2 }
\end{proof}
}{}
\prg_new_protected_conditional:Nnn \twilight_if_empty:n { T,F,TF }
{
\tl_set:Nn \l_tmpa_tl { #1 }
\tl_replace_all:Nnn \l_tmpa_tl { \par } { }
\tl_if_blank:VTF \l_tmpa_tl { \prg_return_true: } { \prg_return_false: }
}
\ExplSyntaxOff
% End of Borrowed Code
% Mathematical Notations
\newcommand{\pf}[2]{\dfrac{\partial #1}{\partial #2}} % Partial Derivative
\newcommand{\df}[2]{\dfrac{\text{d} #1}{\text{d} #2}} % Derivative
% Number Sets
\newcommand{\R}{\mathds{R}}
\newcommand{\N}{\mathds{N}}
\newcommand{\Q}{\mathds{Q}}
\newcommand{\C}{\mathds{C}}
\newcommand{\Z}{\mathds{Z}}
\newcommand{\E}{\mathbb{E}}
\newcommand{\I}{\mathbb{I}}
% Calligraphic Letters
\newcommand{\Ac}{\mathcal{A}}
\newcommand{\Bc}{\mathcal{B}}
\newcommand{\Cc}{\mathcal{C}}
\newcommand{\Dc}{\mathcal{D}}
\newcommand{\Ec}{\mathcal{E}}
\newcommand{\Fc}{\mathcal{F}}
\newcommand{\Gc}{\mathcal{G}}
\newcommand{\Hc}{\mathcal{H}}
\newcommand{\Ic}{\mathcal{I}}
\newcommand{\Jc}{\mathcal{J}}
\newcommand{\Kc}{\mathcal{K}}
\newcommand{\Lc}{\mathcal{L}}
\newcommand{\Mc}{\mathcal{M}}
\newcommand{\Nc}{\mathcal{N}}
\newcommand{\Oc}{\mathcal{O}}
\newcommand{\Pc}{\mathcal{P}}
\newcommand{\Qc}{\mathcal{Q}}
\newcommand{\Rc}{\mathcal{R}}
\newcommand{\Sc}{\mathcal{S}}
\newcommand{\Tc}{\mathcal{T}}
\newcommand{\Uc}{\mathcal{U}}
\newcommand{\Vc}{\mathcal{V}}
\newcommand{\Wc}{\mathcal{W}}
\newcommand{\Xc}{\mathcal{X}}
\newcommand{\Yc}{\mathcal{Y}}
\newcommand{\Zc}{\mathcal{Z}}
% Bold & Italic Letters
\newcommand{\av}{\boldsymbol{a}}
\newcommand{\bv}{\boldsymbol{b}}
\newcommand{\cv}{\boldsymbol{c}}
\newcommand{\dv}{\boldsymbol{d}}
\newcommand{\ev}{\boldsymbol{e}}
\newcommand{\fv}{\boldsymbol{f}}
\newcommand{\gv}{\boldsymbol{g}}
\newcommand{\hv}{\boldsymbol{h}}
\newcommand{\iv}{\boldsymbol{i}}
\newcommand{\jv}{\boldsymbol{j}}
\newcommand{\kv}{\boldsymbol{k}}
\newcommand{\lv}{\boldsymbol{l}}
\newcommand{\mv}{\boldsymbol{m}}
\newcommand{\nv}{\boldsymbol{n}}
\newcommand{\ov}{\boldsymbol{o}}
\newcommand{\pv}{\boldsymbol{p}}
\newcommand{\qv}{\boldsymbol{q}}
\newcommand{\rv}{\boldsymbol{r}}
\newcommand{\sv}{\boldsymbol{s}}
\newcommand{\tv}{\boldsymbol{t}}
\newcommand{\uv}{\boldsymbol{u}}
\newcommand{\vv}{\boldsymbol{v}}
\newcommand{\wv}{\boldsymbol{w}}
\newcommand{\xv}{\boldsymbol{x}}
\newcommand{\yv}{\boldsymbol{y}}
\newcommand{\zv}{\boldsymbol{z}}
\newcommand{\Av}{\boldsymbol{A}}
\newcommand{\Bv}{\boldsymbol{B}}
\newcommand{\Cv}{\boldsymbol{C}}
\newcommand{\Dv}{\boldsymbol{D}}
\newcommand{\Ev}{\boldsymbol{E}}
\newcommand{\Fv}{\boldsymbol{F}}
\newcommand{\Gv}{\boldsymbol{G}}
\newcommand{\Hv}{\boldsymbol{H}}
\newcommand{\Iv}{\boldsymbol{I}}
\newcommand{\Jv}{\boldsymbol{J}}
\newcommand{\Kv}{\boldsymbol{K}}
\newcommand{\Lv}{\boldsymbol{L}}
\newcommand{\Mv}{\boldsymbol{M}}
\newcommand{\Nv}{\boldsymbol{N}}
\newcommand{\Ov}{\boldsymbol{O}}
\newcommand{\Pv}{\boldsymbol{P}}
\newcommand{\Qv}{\boldsymbol{Q}}
\newcommand{\Rv}{\boldsymbol{R}}
\newcommand{\Sv}{\boldsymbol{S}}
\newcommand{\Tv}{\boldsymbol{T}}
\newcommand{\Uv}{\boldsymbol{U}}
\newcommand{\Vv}{\boldsymbol{V}}
\newcommand{\Wv}{\boldsymbol{W}}
\newcommand{\Xv}{\boldsymbol{X}}
\newcommand{\Yv}{\boldsymbol{Y}}
\newcommand{\Zv}{\boldsymbol{Z}}
% Bold Letters (Vectors, Matrices, Tensors, etc.)
\newcommand{\ab}{\mathbf{a}}
\newcommand{\bb}{\mathbf{b}}
\newcommand{\cb}{\mathbf{c}}
\newcommand{\db}{\mathbf{d}}
\newcommand{\eb}{\mathbf{e}}
\newcommand{\fb}{\mathbf{f}}
\newcommand{\gb}{\mathbf{g}}
\newcommand{\hb}{\mathbf{h}}
\newcommand{\ib}{\mathbf{i}}
\newcommand{\jb}{\mathbf{j}}
\newcommand{\kb}{\mathbf{k}}
\newcommand{\lb}{\mathbf{l}}
\newcommand{\mb}{\mathbf{m}}
\newcommand{\nb}{\mathbf{n}}
\newcommand{\ob}{\mathbf{o}}
\newcommand{\pb}{\mathbf{p}}
\newcommand{\qb}{\mathbf{q}}
\newcommand{\rb}{\mathbf{r}}
\renewcommand{\sb}{\mathbf{s}} % If you want to use the original \sb, you need to use \renewcommand
\newcommand{\ub}{\mathbf{u}}
\newcommand{\vb}{\mathbf{v}}
\newcommand{\wb}{\mathbf{w}}
\newcommand{\xb}{\mathbf{x}}
\newcommand{\yb}{\mathbf{y}}
\newcommand{\zb}{\mathbf{z}}
\newcommand{\Ab}{\mathbf{A}}
\newcommand{\Bb}{\mathbf{B}}
\newcommand{\Cb}{\mathbf{C}}
\newcommand{\Db}{\mathbf{D}}
\newcommand{\Eb}{\mathbf{E}}
\newcommand{\Fb}{\mathbf{F}}
\newcommand{\Gb}{\mathbf{G}}
\newcommand{\Hb}{\mathbf{H}}
\newcommand{\Ib}{\mathbf{I}}
\newcommand{\Jb}{\mathbf{J}}
\newcommand{\Kb}{\mathbf{K}}
\newcommand{\Lb}{\mathbf{L}}
\newcommand{\Mb}{\mathbf{M}}
\newcommand{\Nb}{\mathbf{N}}
\newcommand{\Ob}{\mathbf{O}}
\newcommand{\Pb}{\mathbf{P}}
\newcommand{\Qb}{\mathbf{Q}}
\newcommand{\Rb}{\mathbf{R}}
\newcommand{\Sb}{\mathbf{S}}
\newcommand{\Tb}{\mathbf{T}}
\newcommand{\Ub}{\mathbf{U}}
\newcommand{\Vb}{\mathbf{V}}
\newcommand{\Wb}{\mathbf{W}}
\newcommand{\Xb}{\mathbf{X}}
\newcommand{\Yb}{\mathbf{Y}}
\newcommand{\Zb}{\mathbf{Z}}
\newcommand{\zerob}{\mathbf{0}} % Zero Vector
\newcommand{\oneb}{\mathbf{1}} % Vector of Ones
\newcommand{\phib}{\boldsymbol{\phi}} % Feature Vector
\newcommand{\Phib}{\boldsymbol{\Phi}} % Feature Matrix
\newcommand{\mub}{\boldsymbol{\mu}}
\newcommand{\xib}{\boldsymbol{\xi}}
\newcommand{\sigmab}{\boldsymbol{\sigma}}
\newcommand{\Sigmab}{\boldsymbol{\Sigma}}
\newcommand{\alphab}{\boldsymbol{\alpha}}
\newcommand{\betab}{\boldsymbol{\beta}}
\newcommand{\gammab}{\boldsymbol{\gamma}}
\newcommand{\deltab}{\boldsymbol{\delta}}
\newcommand{\Deltab}{\boldsymbol{\Delta}}
\newcommand{\Lambdab}{\boldsymbol{\Lambda}}
\newcommand{\lambdab}{\boldsymbol{\lambda}}
\newcommand{\T}{\top} % Transpose of a Matrix
\newcommand{\idc}{\mathbbm{1}}
\NewDocumentCommand{\norm}{m o}{\IfNoValueTF{#2} {\ensuremath{\left|\left|#1\right|\right|}} {\ensuremath{\left\|#1\right\|_{#2}}}}
\newcommand{\djunion}{\perp\kern-5pt\perp} % Disjoint Union
\newcommand{\sjt}{\textnormal{subject to}}
\newcommand{\st}{\textnormal{s.t.}}
\newcommand{\opt}[1]{{{#1}^*}}
% Machine Learning and Statistics Symbols
\NewDocumentCommand{\ith}{o m o}{
\IfNoValueTF{#3} {
\IfNoValueTF{#1} {{#2^{(i)}}} {{#2^{(#1)}}}
} {
\IfNoValueTF{#1} {{#2^{(i)}_{#3}}} {{#2^{(#1)}_{#3}}}
}
}
\newcommand{\xnor}{\text{XNOR}}
\newcommand{\VC}{\text{VC}}
% Real Analysis Symbols
\newcommand{\bdry}[1]{\partial#1} % Boundary
\newcommand{\itrr}[1]{{#1^o}} % Interior
\newcommand{\clsr}[1]{\bar{#1}} % Closure
% Machine Learning, Matrix Notations
\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator{\sgn}{sgn}
\DeclareMathOperator{\sign}{sign}
\DeclareMathOperator{\rank}{rank}
\DeclareMathOperator{\diag}{\textbf{diag}}
% Real Analysis Notations
\DeclareMathOperator{\interior}{interior}
\DeclareMathOperator{\closure}{closure}
\DeclareMathOperator{\boundary}{boundary}
\DeclareMathOperator{\exterior}{exterior}
\newcommand{\seqn}[1]{\left\{#1_n\right\}} %Standard Sequence
\newcommand{\sseqn}[1]{\left\{#1_{n_k}\right\}} %Standard Subsequence
% Theorem Notes Taking
\newtheorem{theorem}{Theorem}
\newtheorem{define}{Definition}
\newtheorem{corollary}{Corollary}
\newtheorem{lemma}{Lemma}
\newtheorem{prop}{Properties}
\newtheorem{axiom}{Axiom}
\newtheorem{program}{Program} % For Optimization Problems
% Tikz Commands
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Draw a Point in TikzPicture %
% Example Usage %
% \drawPt{(1,1.5)} % draw a point at (1,1.5) %
% \drawPt{(1,1.5)}[A] % same & with label A %
% \drawPt{(1,1.5)}[A][below] % same & label below the node %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NewDocumentCommand{\drawPt}{m o o}{%
\IfNoValueTF{#3} {
\IfNoValueTF{#2} {
\draw[fill=white] #1 circle (1.5pt) node[below] {};
} {
\draw[fill=white] #1 circle (1.5pt) node[below] {#2};
}
} {
\draw[fill=white] #1 circle (1.5pt) node[#3] {#2};
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Draw points in TikzPicture w/o label %
% Example Usage %
% \drawPts{(1,1.5), (2,3), (5,7)} %
% draw three points, respectively at the coordinate given %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\drawPts}[1]{
\foreach \coor in {#1} {
% Draw circles at the points
\edef\temp{\noexpand\draw[fill=white] \coor circle (1.5pt);}
\temp
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Citation of the code below %
% TITLE: PGF/TikZ Manual %
% SUBTITLE: Pattern Library %
% AUTHOR: Mark Wibrow %
% DATE: Jan 8th, 2024 %
% AVAILABILITY: https://tikz.dev/library-patterns %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Begin of Borrowed Code
% How to use "mylines" pattern
% Example Usage:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \begin{tikzpicture} %
% \begin{axis} [axis lines=center, axis on top, axis equal] %
% \addplot [draw=none, domain=-2:0, name path=p1] {x+2}; %
% \addplot [draw=none, domain=-0.5:1.5, name path=p2] {x-1};%
%\addplot[pattern={mylines[size=5pt,line width=.8pt,angle=45]}, %
% pattern color=blue!40] fill between[of=p5 and p6]; %
% \end{axis} %
%\end{tikzpicture} %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usetikzlibrary {patterns.meta}
\tikzdeclarepattern{
name=mylines,
parameters={
\pgfkeysvalueof{/pgf/pattern keys/size},
\pgfkeysvalueof{/pgf/pattern keys/angle},
\pgfkeysvalueof{/pgf/pattern keys/line width},
},
bounding box={
(0,-0.5*\pgfkeysvalueof{/pgf/pattern keys/line width}) and
(\pgfkeysvalueof{/pgf/pattern keys/size},
0.5*\pgfkeysvalueof{/pgf/pattern keys/line width})},
tile size={(\pgfkeysvalueof{/pgf/pattern keys/size},
\pgfkeysvalueof{/pgf/pattern keys/size})},
tile transformation={rotate=\pgfkeysvalueof{/pgf/pattern keys/angle}},
defaults={
size/.initial=5pt,
angle/.initial=45,
line width/.initial=.4pt,
},
code={
\draw [line width=\pgfkeysvalueof{/pgf/pattern keys/line width}]
(0,0) -- (\pgfkeysvalueof{/pgf/pattern keys/size},0);
},
}
% End of Borrowed Code