forked from insertinterestingnamehere/numerical_computing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
command.tex
317 lines (263 loc) · 9.4 KB
/
command.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
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
%------------------------------------------------------------------------------%
% command.tex %
% This file contains the various package imports, environment declarations,
% and other misc. commands.
%
%------------------------------------------------------------------------------%
% \usepackage{pkgloader} % Use this to resolve package dependencies
\usepackage{algorithmicx}
\usepackage{amsmath, amsfonts, amscd, amssymb}
\usepackage{appendix}
\usepackage{array}
\usepackage{blkarray}
\usepackage{color}
\usepackage{colortbl}
\usepackage{epsfig}
\usepackage{float}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{import}
\usepackage{listings}
\usepackage{mathrsfs}
\usepackage{mathtools}
\usepackage{makeidx}
\usepackage{multicol}
\usepackage{paralist}
\usepackage{relsize}
\usepackage{subcaption}
\usepackage{textcomp}
\usepackage{verbatim}
\usepackage{tikz}
\usepackage{xparse}
\usepackage{xcolor}
\usepackage{url}
\usepackage[plain]{algorithm}
\usepackage[noend]{algpseudocode}
\usepackage[style=alphabetic,refsection=chapter,backref=true]{biblatex}
\usepackage[customcolors]{hf-tikz}
\usepackage[framemethod=tikz]{mdframed}
% \LoadPackagesNow % Use this to resolve package dependencies
\usetikzlibrary{arrows, automata, backgrounds, calendar, chains, decorations,
matrix, mindmap, patterns, petri, positioning, shadows, shapes.geometric,
trees, shapes, decorations.pathreplacing}
% Document settings ===========================================================
\hfsetfillcolor{red!02}
\hfsetbordercolor{red}
% Set lengths that are pleasing for screen display.
\setlength{\paperheight}{11in}
\setlength{\paperwidth}{8.5in}
% Set paragraph skips and line spacing
\linespread{1.05}
\setlength{\parskip} {2pt plus1pt minus1pt}
\makeatletter
% Make all floats centered
\g@addto@macro\@floatboxreset\centering
% Reset footnote counter every chapter
\@addtoreset{footnote}{chapter}
\makeatother
\floatstyle{ruled}
\restylefloat{algorithm}
\makeatletter
\Hy@AtBeginDocument{
\def\@pdfborder{0 0 1}
\def\@pdfborderstyle{/S/U/W 1}
}
\makeatother
% Bibliography settings =======================================================
\addbibresource{references.bib}
\renewcommand{\bibname}{References}
% Lab Commands ================================================================
\renewcommand{\chaptername}{Lab}
\newcommand{\lab}[2]{\chapter[#2]{#1}}
\newcommand{\objective}[1]{{\bf Lab Objective: } \emph{#1} \bigskip}
%% Full line comments in the Algorithmic environment.
\algnewcommand{\LineComment}[1]{\State \(\triangleright\) #1}
% Misc. Environments ==========================================================
\newcounter{problemnum}[chapter]
\newenvironment{problem}{\begin{mdframed}[style=problem]\begin{problemnum}}{\end{problemnum}\end{mdframed}}
\newtheoremup{problemnum}{Problem}
\newenvironment{problem*}{\begin{mdframed}[style=problem]\begin{problemnum*}}{\end{problemnum*}\end{mdframed}}
\newtheoremup{problemnum*}[problemnum]{*Problem}
% Colors ======================================================================
\definecolor{shadecolor}{RGB}{186, 207, 188}
\definecolor{warning}{RGB}{255, 188, 163}
\definecolor{warnline}{RGB}{255, 15, 15}
\definecolor{information}{RGB}{235, 255, 223}
\definecolor{infoline}{RGB}{69, 163, 11}
\definecolor{codebase}{RGB}{250, 245, 182}
\definecolor{codekeyword}{RGB}{42, 161, 152}
\definecolor{codecomment}{RGB}{108, 153, 8}
\definecolor{codestring}{RGB}{203, 75, 22}
% Frame environments ==========================================================
\mdfdefinestyle{problem}{backgroundcolor=shadecolor,
hidealllines=true,
skipabove=10pt,
skipbelow=10pt,
innertopmargin=15pt,
innerbottommargin=15pt,
innerleftmargin=15pt,
innerrightmargin=15pt}
\newmdenv[
roundcorner=10pt,
skipabove=10pt
skipbelow=10pt
leftmargin=20pt,
rightmargin=20pt,
backgroundcolor=warning,
innertopmargin=10pt,
innerbottommargin=10pt,
innerleftmargin=10pt,
middlelinewidth=0pt,
everyline=true,
linecolor=warnline,
linewidth=1pt,
font=\normalfont\normalsize,
frametitlefont=\large\bfseries,
frametitleaboveskip=1em,
frametitlerule=true,
frametitle={\sc Achtung!}
]{warn}
\newmdenv[
roundcorner=10pt,
skipabove=10pt
skipbelow=10pt
leftmargin=20pt,
rightmargin=20pt,
backgroundcolor=information,
outerlinewidth=1,
outerlinecolor=infoline,
innertopmargin=10pt,
innerbottommargin=10pt,
innerleftmargin=10pt,
middlelinewidth=0pt,
everyline=true,
linecolor=infoline,
linewidth=1pt,
font=\normalfont\normalsize,
frametitlefont=\large\bfseries,
frametitleaboveskip=1em,
frametitlerule=true,
frametitle={\sc Note}
]{info}
%% Listings Environments ======================================================
% Default Environment
\lstset{
language=Python,
backgroundcolor=\color[RGB]{250, 245, 182},
tabsize=4,
basewidth=.5em,
rulecolor=\color{black},
basicstyle=\footnotesize\ttfamily,
upquote=true,
columns=fixed,
extendedchars=true,
breaklines=true,
prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
frame=lrtb,
xleftmargin=5pt,
framesep=4pt,
framerule=.1pt,
showtabs=false,
showspaces=false,
showstringspaces=false,
keywordstyle=\color[RGB]{42, 161, 152},
commentstyle=\color[RGB]{108, 153, 8},
stringstyle=\color[RGB]{189, 78, 98},
title=\lstname,
captionpos=b,
abovecaptionskip=-5pt,
belowcaptionskip=-5pt,
moredelim=[is][\color{black}]{<<}{>>},
moredelim=[is][\color{red}]{<r<}{>r>}
}
% \surroundwithmdframed[
% hidealllines=true,
% backgroundcolor=codebase,
% innerleftmargin=-5pt,
% innertopmargin=-1pt,
% innerrightmargin=0pt,
% innerbottommargin=-5pt]{lstlisting}
% Including source code from a file on disk
\lstdefinestyle{FromFile}{language=Python,
frame=single,
numbers=left,
numberstyle=\tiny,
stepnumber=2,
numbersep=7pt,
numberfirstline=true,
abovecaptionskip=2pt,
belowcaptionskip=2pt
}
% Shell I/O. Avoids syntax highlighting
\lstdefinestyle{ShellOutput}{language=}
\lstdefinestyle{ShellInput}{language=}
% Deprecated Environments (Replaced by Algorithmic package)
\lstdefinestyle{pseudo}{basicstyle=\rmfamily,
upquote=true,
keywordstyle=\color{black}\bfseries,
commentstyle=\color[rgb]{0.133,0.545,0.133},
stringstyle=\color[rgb]{0.627,0.126,0.941},}
\newcommand{\pseudoli}[1]{\lstinline[style=pseudo]!#1!}
\newcommand{\li}[1]{\lstinline[prebreak=]!#1!}
% Special Math Characters =====================================================
\def\0{\mathbf{0}}
\def\a{\mathbf{a}}
\def\b{\mathbf{b}}
\def\c{\mathbf{c}}
\def\e{\mathbf{e}}
\def\f{\mathbf{f}}
\def\g{\mathbf{g}}
\def\p{\mathbf{p}}
\def\q{\mathbf{q}}
\def\u{\mathbf{u}}
\def\v{\mathbf{v}}
\def\w{\mathbf{w}}
\def\x{\mathbf{x}}
\def\y{\mathbf{y}}
\def\z{\mathbf{z}}
\def\subspace{\lhd}
\def\CalL{\mathcal{L}}
\def\CalO{\mathcal{O}}
\def\CalV{\mathcal{V}}
\def\CalU{\mathcal{U}}
\def\bU{{\bar{u}}}
\def\R{\Re e}
\def\I{\Im m}
\def\M{M_n}
% Various commands that make life easier ======================================
\newcommand{\argmax}{\mbox{argmax}}
\newcommand{\indicator}[1]{\mathbb{1}_{\left[#1\right] }}
\providecommand{\abs}[1]{\left\lvert#1\right\rvert}
\providecommand{\norm}[1]{\left\lVert#1\right\rVert}
\providecommand{\set}[1]{\lbrace#1\rbrace}
\providecommand{\setconstruct}[2]{\lbrace#1:#2\rbrace}
\providecommand{\Res}[1]{\underset{#1}{Res}} % Residue
\newcommand{\trp}{^{\mathsf T}} % matrix transpose
\newcommand{\hrm}{^{\mathsf H}} % hermitian conjugate
\newcommand{\ipt}[2]{\langle #1,#2 \rangle}
\newcommand{\ip}{\int_{-\infty}^{+\infty}}
\renewcommand{\ker}[1]{\mathcal{N}(#1)}
\newcommand{\ran}[1]{\mathcal{R}(#1)}
% These commands are specifically for use in the pseudocode environment.
% Load the xparse package to use these commands
\NewDocumentCommand\allocate{m+g}{ % Empty array
\IfNoValueTF{#2}
{\mathrm{empty}(#1)} % 1 dimension
{\mathrm{empty}(#1, #2)} % 2 dimensions
}
\NewDocumentCommand\zeros{m+g}{ % Zero array
\IfNoValueTF{#2}
{\mathrm{zeros}(#1)}
{\mathrm{zeros}(#1, #2)}%
}
\newcommand{\Id}[1]{\mathrm{Id}(#1)} % Identity array
\newcommand{\makecopy}[1]{\mathrm{copy}(#1)} % Copy an array
\newcommand{\shape}[1]{\mathrm{shape}(#1)}
\newcommand{\size}[1]{\mathrm{size}(#1)}
% Math Operators ==============================================================
% Many of these are for use in the pseudocode environments.
\DeclareMathOperator{\sign}{sign}
\DeclareMathOperator{\sech}{sech}
\DeclareMathOperator{\Out}{Out} % Used in PageRank lab
\DeclareMathOperator{\In}{In} % Used in PageRank lab
\DeclareMathOperator\erf{erf}